Adding a script to print out which of a given list of files do not end with a newline. Source files that do not end with a newline break at least the HP-UX compiler. Adding newlines to all of the source files found at this point.

This commit is contained in:
cls%seawood.org 2000-04-02 07:17:25 +00:00
Родитель 2b6e7b13ae
Коммит 0d63199902
52 изменённых файлов: 84 добавлений и 1803 удалений

47
build/unix/print-non-newline.sh Executable file
Просмотреть файл

@ -0,0 +1,47 @@
#!/bin/sh
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is test-ending-newline.sh
#
# The Initial Developer of the Original Code is Christopher
# Seawood <cls@seawood.org>. Portions created by Christopher Seawood
# are Copyright (C) 2000 Christopher Seawood. All Rights Reserved.
#
# The purpose of this file is to find the files that do not end with a
# newline. Some compilers fail if the source files do not end with a
# newline.
#
#
test_file=newline_test
test_dummy=newline_testee
inlist="$*"
broken_list=
if test "$inlist" = ""; then
echo "Usage: $0 *.c *.cpp";
exit 0;
fi
echo "" > $test_file
for f in $inlist; do
if test -f $f; then
tail -c 1 $f > $test_dummy
if ! `cmp -s $test_file $test_dummy`; then
broken_list="$broken_list $f"
fi
fi
done
rm -f $test_file $test_dummy
echo $broken_list

Просмотреть файл

@ -1 +1 @@
#include "StdAfx.h"
#include "StdAfx.h"

Просмотреть файл

@ -488,4 +488,4 @@ TestSet aTestSets[] =
};
int nTestSets = sizeof(aTestSets) / sizeof(aTestSets[0]);
int nTestSets = sizeof(aTestSets) / sizeof(aTestSets[0]);

Просмотреть файл

@ -501,4 +501,4 @@ static getUnicodeBlock gAllGetBlock[16] =
nsUnicodeBlock nsUnicodeFontMappingMac:: GetBlock(PRUnichar aChar)
{
return (*(gAllGetBlock[(aChar >> 12)]))(aChar);
}
}

Просмотреть файл

@ -60,4 +60,4 @@ NS_IMETHODIMP nsDeviceContextSpecPh :: GetPrintContext(PpPrintContext_t *&aPrint
{
aPrintContext = mPC;
return NS_OK;
}
}

Просмотреть файл

@ -688,4 +688,4 @@ nsFontEnumeratorPh::EnumerateFonts(const char* aLangGroup,
// XXX still need to implement aLangGroup and aGeneric
return EnumerateAllFonts(aCount, aResult);
}
}

Просмотреть файл

@ -65,4 +65,4 @@ main(int argc, const char** argv)
printf("DefaultCharset for %s is %s\n",categoryAsNSString.ToNewCString(),charsetAsNSString.ToNewCString());
return 0;
}
}

Просмотреть файл

@ -0,0 +1 @@

Просмотреть файл

@ -2037,4 +2037,4 @@ nsBoxFrameInner::GetFrameSizeWithMargin(nsIBox* aBox, nsSize& aSize)
aSize.width = rect.width;
aSize.height = rect.height;
return NS_OK;
}
}

Просмотреть файл

@ -1,62 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "nsCOMPtr.h"
#include "nsCheckBoxFrame.h"
#include "nsIDOMXULCheckboxElement.h"
#include "nsIContent.h"
#include "nsIDOMXULRadioElement.h"
#include "nsIDocument.h"
#include "nsIDOMXULDocument.h"
#include "nsIDOMNodeList.h"
#include "nsHTMLAtoms.h"
#include "nsINameSpaceManager.h"
//
// NS_NewCheckBoxFrame
//
// Creates a new checkbox frame and returns it in |aNewFrame|
//
nsresult
NS_NewCheckBoxFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame )
{
NS_PRECONDITION(aNewFrame, "null OUT ptr");
if (nsnull == aNewFrame) {
return NS_ERROR_NULL_POINTER;
}
nsCheckBoxFrame* it = new (aPresShell) nsCheckBoxFrame (aPresShell);
if (nsnull == it)
return NS_ERROR_OUT_OF_MEMORY;
*aNewFrame = it;
return NS_OK;
} // NS_NewCheckBoxFrame
PRIntn nsCheckBoxFrame::GetDefaultAlignment()
{
return NS_SIDE_LEFT;
}
nsCheckBoxFrame::nsCheckBoxFrame(nsIPresShell* aPresShell):nsButtonBoxFrame(aPresShell)
{
}

Просмотреть файл

@ -223,4 +223,4 @@ nsColorPickerFrame::GetDesiredSize(nsIPresContext* aPresContext,
{
} // GetDesiredSize
*/
*/

Просмотреть файл

@ -243,4 +243,4 @@ NS_INTERFACE_MAP_BEGIN(nsLeafBoxFrame)
NS_INTERFACE_MAP_ENTRY(nsIFrameDebug)
#endif
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIBox)
NS_INTERFACE_MAP_END_INHERITING(nsLeafFrame)
NS_INTERFACE_MAP_END_INHERITING(nsLeafFrame)

Просмотреть файл

@ -108,4 +108,4 @@ void nsOEStringBundle::Cleanup( void)
if (m_pBundle)
m_pBundle->Release();
m_pBundle = nsnull;
}
}

Просмотреть файл

@ -766,4 +766,4 @@ void nsSimpleUInt32Array::Allocate( void)
delete [] m_pData;
m_pData = pData;
}
}
}

Просмотреть файл

@ -59,4 +59,4 @@ int main(int argc, char **argv)
OleUninitialize();
return 0;
}
}

Просмотреть файл

@ -563,4 +563,4 @@ void TestBuild(MenuHandle theMenu, PRBool isChild)
}
*/
#pragma options align=reset
#pragma options align=reset

Просмотреть файл

@ -178,4 +178,4 @@ NS_METHOD nsButton::CreateNative( PtWidget_t* aParent )
return res;
}

Просмотреть файл

@ -283,4 +283,4 @@ NS_METHOD nsCheckButton::CreateNative( PtWidget_t* aParent )
return res;
}

Просмотреть файл

@ -342,4 +342,4 @@ nsFileDlgResults nsFileWidget::PutFile(
}
}
return theResult;
}
}

Просмотреть файл

@ -1,521 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#include "nsListBox.h"
#include "nsColor.h"
#include "nsGUIEvent.h"
#include "nsString.h"
#include "nsStringUtil.h"
#include <Pt.h>
#include "nsPhWidgetLog.h"
NS_IMPL_ADDREF(nsListBox)
NS_IMPL_RELEASE(nsListBox)
//-------------------------------------------------------------------------
//
// nsListBox constructor
//
//-------------------------------------------------------------------------
nsListBox::nsListBox() : nsWidget(), nsIListWidget(), nsIListBox()
{
NS_INIT_REFCNT();
mMultiSelect = PR_FALSE;
}
//-------------------------------------------------------------------------
//
// nsListBox:: destructor
//
//-------------------------------------------------------------------------
nsListBox::~nsListBox()
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::~nsListBox - Destructor Called\n"));
}
//-------------------------------------------------------------------------
//
// Query interface implementation
//
//-------------------------------------------------------------------------
nsresult nsListBox::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr);
static NS_DEFINE_IID(kInsListBoxIID, NS_ILISTBOX_IID);
static NS_DEFINE_IID(kInsListWidgetIID, NS_ILISTWIDGET_IID);
if (result == NS_NOINTERFACE) {
if (aIID.Equals(kInsListBoxIID)) {
*aInstancePtr = (void*) ((nsIListBox*)this);
AddRef();
result = NS_OK;
}
else if (aIID.Equals(kInsListWidgetIID)) {
*aInstancePtr = (void*) ((nsIListWidget*)this);
AddRef();
result = NS_OK;
}
}
return result;
}
//-------------------------------------------------------------------------
//
// initializer
//
//-------------------------------------------------------------------------
NS_METHOD nsListBox::SetMultipleSelection(PRBool aMultipleSelections)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::SetMultipleSelection aMultipleSelections=<%d>\n", aMultipleSelections));
PtArg_t arg;
nsresult res = NS_ERROR_FAILURE;
mMultiSelect = aMultipleSelections;
if (mWidget)
{
if (mMultiSelect)
PtSetArg( &arg, Pt_ARG_SELECTION_MODE, (Pt_EXTENDED_MODE), 0);
else
PtSetArg( &arg, Pt_ARG_SELECTION_MODE, (Pt_SINGLE_MODE), 0);
if ( PtSetResources(mWidget, 1, &arg ) == 0)
res = NS_OK;
}
return NS_OK;
}
//-------------------------------------------------------------------------
//
// AddItemAt
//
//-------------------------------------------------------------------------
NS_METHOD nsListBox::AddItemAt(nsString &aItem, PRInt32 aPosition)
{
char *str = aItem.ToNewCString();
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::AddItemAt aItem=<%s> aPosition=<%d>\n", str, aPosition));
PtArg_t arg;
nsresult res = NS_ERROR_FAILURE;
int err;
if (mWidget)
{
err = PtListAddItems(mWidget, (const char **) &str, 1, (unsigned int) (aPosition+1));
if (err == 0)
res = NS_OK;
}
delete [] str;
return res;
}
//-------------------------------------------------------------------------
//
// Finds an item at a postion
//
//-------------------------------------------------------------------------
PRInt32 nsListBox::FindItem(nsString &aItem, PRInt32 aStartPos)
{
char *str = aItem.ToNewCString();
int index = -1;
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::AddItemAt aItem=<%s> aStartPos=<%d>\n", str, aStartPos));
if (mWidget)
{
index = PtListItemPos(mWidget, str);
if (index == 0)
index = -1; /* item wasn't found */
}
delete [] str;
return index;
}
//-------------------------------------------------------------------------
//
// CountItems - Get Item Count
//
//-------------------------------------------------------------------------
PRInt32 nsListBox::GetItemCount()
{
PtArg_t arg;
short *theCount;
PRInt32 total = 0;
if (mWidget)
{
PtSetArg( &arg, Pt_ARG_LIST_ITEM_COUNT, &theCount, 0);
PtGetResources(mWidget, 1, &arg );
total = *theCount;
}
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::GetItemCount is <%d>\n", total));
return total;
}
//-------------------------------------------------------------------------
//
// Removes an Item at a specified location
//
//-------------------------------------------------------------------------
PRBool nsListBox::RemoveItemAt(PRInt32 aPosition)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::RemoveItemAt %d\n", aPosition));
int err;
PRBool res = PR_FALSE;
if (mWidget)
{
if (PtListDeleteItemPos(mWidget, 1, (aPosition+1)) == 0)
res = PR_TRUE;
}
return res;
}
//-------------------------------------------------------------------------
//
//
//
//-------------------------------------------------------------------------
PRBool nsListBox::GetItemAt(nsString& anItem, PRInt32 aPosition)
{
PRBool result = PR_FALSE;
short *num;
char **items;
PtArg_t arg;
/* Clear the nsString */
anItem.SetLength(0);
if (mWidget)
{
PtSetArg( &arg, Pt_ARG_ITEMS, &items, &num);
PtGetResources(mWidget, 1, &arg );
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::GetItemAt aPosition=<%d> aItem=<%s>\n", aPosition, items[aPosition]));
anItem.Append(items[aPosition]);
result = PR_TRUE;
}
return result;
}
//-------------------------------------------------------------------------
//
// Gets the text from the first selected Item
//
//-------------------------------------------------------------------------
NS_METHOD nsListBox::GetSelectedItem(nsString& aItem)
{
int theFirstSelectedItem = GetSelectedIndex();
nsresult res = NS_ERROR_FAILURE;
if (mWidget)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::GetSelectedItem theFirstSelectedItem is <%d>\n", theFirstSelectedItem));
GetItemAt(aItem, theFirstSelectedItem);
res = NS_OK;
}
return res;
}
//-------------------------------------------------------------------------
//
// Gets the list of selected items
// Gets the Position of the first selected Item or -1 if no items.
//-------------------------------------------------------------------------
PRInt32 nsListBox::GetSelectedIndex()
{
// PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::GetSelectedIndex - Not Implemented\n"));
PRInt32 index=-1;
int theFirstSelectedItem[1];
nsresult res = NS_ERROR_FAILURE;
if (mWidget)
{
GetSelectedIndices(theFirstSelectedItem, 1);
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::GetSelectedIndex theFirstSelectedItem is <%d>\n", theFirstSelectedItem[0]));
index = theFirstSelectedItem[0];
res = NS_OK;
}
return index;
}
//-------------------------------------------------------------------------
//
// SelectItem
//
//-------------------------------------------------------------------------
NS_METHOD nsListBox::SelectItem(PRInt32 aPosition)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::SelectItem %d\n", aPosition));
nsresult res = NS_ERROR_FAILURE;
if (mWidget)
{
PtListSelectPos(mWidget, (aPosition+1)); /* Photon is 1 based */
res = NS_OK;
}
return res;
}
//-------------------------------------------------------------------------
//
// GetSelectedCount
//
//-------------------------------------------------------------------------
PRInt32 nsListBox::GetSelectedCount()
{
PtArg_t arg;
short *theCount;
PRInt32 total = 0;
if (mWidget)
{
PtSetArg( &arg, Pt_ARG_LIST_SEL_COUNT, &theCount, 0);
PtGetResources(mWidget, 1, &arg );
total = *theCount;
}
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::GetSelectedCount theCount=<%d>\n", total));
return total;
}
//-------------------------------------------------------------------------
//
// GetSelectedIndices
//
//-------------------------------------------------------------------------
NS_METHOD nsListBox::GetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::GetSelectedIndices aSize=<%d>\n", aSize));
PRInt32 i=0, num = 0;
short *theSelectedIndices, *theSelectedCount;
nsresult res = NS_ERROR_FAILURE;
PtArg_t arg;
if (mWidget)
{
PtSetArg( &arg, Pt_ARG_SELECTION_INDEXES, &theSelectedIndices, &theSelectedCount);
PtGetResources(mWidget, 1, &arg );
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::GetSelectedIndices Found %d Selected Items\n", *theSelectedCount));
for (i=0; i < *theSelectedCount && i < aSize; i++)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::GetSelectedIndices %d is Selected.\n", theSelectedIndices[i]));
aIndices[i] = (theSelectedIndices[i]-1) ; /* photon is 1 based, mozilla appears to be 0 based */
}
res = NS_OK;
}
return res;
}
//-------------------------------------------------------------------------
//
// SetSelectedIndices
//
//-------------------------------------------------------------------------
NS_METHOD nsListBox::SetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::SetSelectedIndices\n"));
/* De-Select Everything ... */
Deselect();
int i;
for (i=0;i<aSize;i++)
{
SelectItem(aIndices[i]);
}
return NS_OK;
}
//-------------------------------------------------------------------------
//
// Deselect
//
//-------------------------------------------------------------------------
NS_METHOD nsListBox::Deselect()
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::Deselect\n"));
nsresult res = NS_ERROR_FAILURE;
if (mWidget)
{
const int theSelectedCount = GetSelectedCount();
int theList[theSelectedCount];
int i;
GetSelectedIndices(theList, theSelectedCount);
for(i=0;i<theSelectedCount;i++)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::Deselect Unselecting <%d>\n", theList[i]));
PtListUnselectPos(mWidget, theList[i]);
}
res = NS_OK;
}
return res;
}
//-------------------------------------------------------------------------
//
// Set initial parameters
//
//-------------------------------------------------------------------------
NS_METHOD nsListBox::PreCreateWidget(nsWidgetInitData *aInitData)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::PreCreateWidget - Not Implemented\n"));
if (nsnull != aInitData) {
nsListBoxInitData* data = (nsListBoxInitData *) aInitData;
mMultiSelect = data->mMultiSelect;
}
return NS_OK;
}
//-------------------------------------------------------------------------
//
// Create the native widget
//
//-------------------------------------------------------------------------
NS_METHOD nsListBox::CreateNative(PtWidget_t *parentWindow)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::CreateNative\n"));
nsresult res = NS_ERROR_FAILURE;
PtArg_t arg[5];
PhPoint_t pos;
PhDim_t dim;
pos.x = mBounds.x;
pos.y = mBounds.y;
dim.w = mBounds.width - 4; // Correct for border width
dim.h = mBounds.height - 4;
PtSetArg( &arg[0], Pt_ARG_POS, &pos, 0 );
PtSetArg( &arg[1], Pt_ARG_DIM, &dim, 0 );
PtSetArg( &arg[2], Pt_ARG_BORDER_WIDTH, 2, 0 );
mWidget = PtCreateWidget( PtList, parentWindow, 3, arg );
if( mWidget )
{
res = NS_OK;
/* Mozilla calls this first before we have a widget so re-call this */
SetMultipleSelection(mMultiSelect);
/* Add a Callback so I can keep track of whats selected or not */
// PtAddCallback(mWidget, Pt_CB_SELECTION, handle_selection_event, this);
}
return res;
}
//-------------------------------------------------------------------------
//
// move, paint, resizes message - ignore
//
//-------------------------------------------------------------------------
PRBool nsListBox::OnMove(PRInt32, PRInt32)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::OnMove - Not Implemented\n"));
return PR_FALSE;
}
//-------------------------------------------------------------------------
//
// paint message. Don't send the paint out
//
//-------------------------------------------------------------------------
PRBool nsListBox::OnPaint(nsPaintEvent &aEvent)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::OnPaint - Not Implemented\n"));
return PR_FALSE;
}
PRBool nsListBox::OnResize(nsSizeEvent &aEvent)
{
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsListBox::OnResize - Not Implemented\n"));
return PR_FALSE;
}
//-------------------------------------------------------------------------
//
// Callback when user selects or deselects an item
//
//-------------------------------------------------------------------------
int nsListBox::handle_selection_event (PtWidget_t *aWidget, void *aData, PtCallbackInfo_t *aCbinfo )
{
nsListBox *me = (nsListBox *) aData;
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsListBox::handle_select_event widget=<%p>\n",me));
if ((me) && (aCbinfo->reason == Pt_CB_SELECTION) &&
(aCbinfo->reason_subtype == Pt_LIST_SELECTION_FINAL))
{
PtListCallback_t *ListCallback = (PtListCallback_t *) aCbinfo->cbdata;
// PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsListBox::handle_select_event mode=<%d>\n",ListCal));
}
return (Pt_CONTINUE);
}

Просмотреть файл

@ -1005,4 +1005,4 @@ int nsMenu::SubMenuMenuItemMenuCb (PtWidget_t *widget, void *aNSMenu, PtCallback
}
return( Pt_CONTINUE );
}
}

Просмотреть файл

@ -675,4 +675,4 @@ int nsMenuItem::MenuItemDisarmCb (PtWidget_t *widget, void *nsClassPtr, PtCallba
delete [] str;
return Pt_CONTINUE;
}
}

Просмотреть файл

@ -413,4 +413,4 @@ int nsScrollbar::handle_scroll_move_event (PtWidget_t *aWidget, void *aData, PtC
me->OnScroll(scroll_event, thePos);
return (Pt_CONTINUE);
}
}

Просмотреть файл

@ -163,4 +163,4 @@ int nsTextWidget::handle_activate_event (PtWidget_t *aWidget, void *aData, PtCal
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsTextWidget::handle_activate_event me=<%p> - Not Implemented\n",me));
return (Pt_CONTINUE);
}
}

Просмотреть файл

@ -104,4 +104,4 @@ PhPoint_t nsToolkit::GetConsoleOffset()
}
return(PhPoint_t) {0,0};
}
}

Просмотреть файл

@ -1,73 +0,0 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications, Inc. Portions created by Netscape are
* Copyright (C) 1999, Mozilla. All Rights Reserved.
*
* Contributor(s):
* Travis Bogard <travis@netscape.com>
*/
#include "nsCAppLoop.h"
#include "nsCPhFilter.h"
#include "nsPhEventLog.h"
//*****************************************************************************
//*** nsCAppLoop: Object Management
//*****************************************************************************
nsCAppLoop::nsCAppLoop() : nsCBaseAppLoop()
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCAppLoop::nsCAppLoop m_PhThreadId=<%d>\n", m_PhThreadId));
}
nsCAppLoop::~nsCAppLoop()
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCAppLoop::~nsCAppLoop m_PhThreadId=<%d>\n", m_PhThreadId));
}
NS_METHOD nsCAppLoop::Create(nsISupports* aOuter, const nsIID& aIID,
void** ppv)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCAppLoop::Create\n"));
NS_ENSURE_ARG_POINTER(ppv);
NS_ENSURE_NO_AGGREGATION(aOuter);
nsCAppLoop* app = new nsCAppLoop();
NS_ENSURE_TRUE(app, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(app);
nsresult rv = app->QueryInterface(aIID, ppv);
NS_RELEASE(app);
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCAppLoop::Create the end rv=<%d>\n", rv));
return rv;
}
//*****************************************************************************
// nsCAppLoop:: Internal Platform Implementations of nsIEventLoop
// (Error checking is ensured above)
//*****************************************************************************
nsresult nsCAppLoop::PlatformExit(PRInt32 exitCode)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCAppLoop::PlatformExit exitCode=<%d>\n", exitCode));
PostQuitMessage(exitCode);
return NS_OK;
}

Просмотреть файл

@ -1,103 +0,0 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications, Inc. Portions created by Netscape are
* Copyright (C) 1999, Mozilla. All Rights Reserved.
*
* Contributor(s):
* Travis Bogard <travis@netscape.com>
* Jerry Kirk <Jerry.Kirk@NexwareCorp.com>
*/
#include "nsCRT.h"
#include "nsCEvent.h"
#include <prlog.h>
PRLogModuleInfo *PhEventLog = PR_NewLogModule("PhEventLog");
#include "nsPhEventLog.h"
//*****************************************************************************
//*** nsCEvent: Object Management
//*****************************************************************************
nsCEvent::nsCEvent(void* platformEventData)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCEvent::nsCEvent platformEventData=<%p>\n", platformEventData));
NS_INIT_REFCNT();
m_msg = new nsCPhEvent( (PhEvent_t *) platformEventData);
}
nsCEvent::~nsCEvent()
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCEvent::~nsCEvent\n"));
if (m_msg)
{
delete m_msg;
}
}
//*****************************************************************************
// nsCEvent::nsISupports
//*****************************************************************************
NS_IMPL_ISUPPORTS1(nsCEvent, nsIEvent)
//*****************************************************************************
// nsCEvent::nsIEvent
//*****************************************************************************
NS_IMETHODIMP nsCEvent::GetNativeData(nsNativeEventDataType dataType,
void** data)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCEvent::GetNativeData dataType=<%d> data=<%p>\n", dataType, data));
NS_ENSURE_ARG(nsNativeEventDataTypes::PhotonMsgStruct == dataType);
NS_ENSURE_ARG_POINTER(data);
*data = m_msg;
return NS_OK;
}
NS_IMETHODIMP nsCEvent::SetNativeData(nsNativeEventDataType dataType,
void* data)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCEvent::SetNativeData dataType=<%d>\n", dataType));
NS_ENSURE_ARG(nsNativeEventDataTypes::PhotonMsgStruct == dataType);
if(!data)
{
/* Get rid of the Event */
if (m_msg)
delete m_msg;
m_msg = new nsCPhEvent(NULL);
}
else
{
/* Get rid of the Event */
if (m_msg)
delete m_msg;
nsCPhEvent *aEvent = (nsCPhEvent *) data;
m_msg = new nsCPhEvent(aEvent->m_msg);
}
return NS_OK;
}

Просмотреть файл

@ -1,78 +0,0 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications, Inc. Portions created by Netscape are
* Copyright (C) 1999, Mozilla. All Rights Reserved.
*
* Contributor(s):
* Travis Bogard <travis@netscape.com>
* Jerry Kirk <Jerry.Kirk@NexwareCorp.com>
*/
#include "nsCRT.h"
#include "nsCEventFilter.h"
//*****************************************************************************
//*** nsCEventFilter: Object Management
//*****************************************************************************
nsCEventFilter::nsCEventFilter(void* platformFilterData)
{
NS_INIT_REFCNT();
if(platformFilterData)
nsCRT::memcpy(&m_filter, platformFilterData, sizeof(m_filter));
else
nsCRT::memset(&m_filter, 0, sizeof(m_filter));
}
nsCEventFilter::~nsCEventFilter()
{
}
//*****************************************************************************
// nsCEventFilter::nsISupports
//*****************************************************************************
NS_IMPL_ISUPPORTS1(nsCEventFilter, nsIEventFilter)
//*****************************************************************************
// nsCEventFilter::nsIEventFilter
//*****************************************************************************
NS_IMETHODIMP nsCEventFilter::GetNativeData(nsNativeFilterDataType dataType,
void** data)
{
NS_ENSURE_ARG(nsNativeFilterDataTypes::PhotonFilter == dataType);
NS_ENSURE_ARG_POINTER(data);
*data = &m_filter;
return NS_OK;
}
NS_IMETHODIMP nsCEventFilter::SetNativeData(nsNativeFilterDataType dataType,
void* data)
{
NS_ENSURE_ARG(nsNativeFilterDataTypes::PhotonFilter == dataType);
if(!data)
nsCRT::memset(&m_filter, 0, sizeof(m_filter));
else
nsCRT::memcpy(&m_filter, data, sizeof(m_filter));
return NS_OK;
}

Просмотреть файл

@ -1,89 +0,0 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications, Inc. Portions created by Netscape are
* Copyright (C) 1999, Mozilla. All Rights Reserved.
*
* Contributor(s):
* Jerry Kirk <Jerry.Kirk@NexwareCorp.com>
*/
#include "nsCRT.h"
#include "nsCPhEvent.h"
#include "nsPhEventLog.h"
//*****************************************************************************
//*** nsCPhEvent: Object Management
//*****************************************************************************
nsCPhEvent::nsCPhEvent(PhEvent_t* platformEventData)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPhEvent::nsCPhEvent platformEventData=<%p>\n", platformEventData));
if (platformEventData)
{
mEventBufferSz = PhGetMsgSize ( platformEventData );
m_msg = (PhEvent_t *) malloc( mEventBufferSz );
if (m_msg);
nsCRT::memcpy(m_msg, platformEventData, mEventBufferSz);
}
else
{
mEventBufferSz = sizeof(PhEvent_t);
m_msg = (PhEvent_t *) malloc( mEventBufferSz );
if (m_msg);
nsCRT::memset(m_msg, 0, mEventBufferSz);
}
}
nsCPhEvent::~nsCPhEvent()
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPhEvent::~nsCPhEvent\n"));
if (m_msg)
{
free(m_msg);
m_msg = nsnull;
mEventBufferSz = 0;
}
}
unsigned long nsCPhEvent::GetEventBufferSize()
{
return mEventBufferSz;
}
unsigned long nsCPhEvent::GetEventSize()
{
unsigned long theEventSize = 0;
if (m_msg)
theEventSize = PhGetMsgSize ( (PhEvent_t *) m_msg );
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPhEvent::GetEventSize theEventSize=<%d>\n", theEventSize));
return theEventSize;
}
nsresult nsCPhEvent::ResizeEvent(unsigned long aEventSize)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPhEvent::ResizeEvent old_size=<%d> new_size=<%d>\n", mEventBufferSz, aEventSize));
mEventBufferSz = aEventSize;
m_msg = (PhEvent_t *) realloc( m_msg, mEventBufferSz );
NS_ENSURE_ARG_POINTER(m_msg);
return NS_OK;
}

Просмотреть файл

@ -1,188 +0,0 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications, Inc. Portions created by Netscape are
* Copyright (C) 1999, Mozilla. All Rights Reserved.
*
* Contributor(s):
* Travis Bogard <travis@netscape.com>
* Jerry Kirk <Jerry.Kirk@NexwareCorp.com>
*/
#include "nsCPlatformBaseLoop.h"
#include "nsCPhEvent.h"
#include "nsCPhFilter.h"
#include "nsPhEventLog.h"
#include <Pt.h>
//*****************************************************************************
//*** nsCPlatformBaseLoop: Object Management
//*****************************************************************************
nsCPlatformBaseLoop::nsCPlatformBaseLoop(nsEventLoopType type) :
nsCBaseLoop(type)
{
m_PhThreadId = pthread_self();
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::nsCPlatformBaseLoop nsEventLoopType=<%d> m_PhThreadId=<%d>\n", type, m_PhThreadId));
}
nsCPlatformBaseLoop::~nsCPlatformBaseLoop()
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::~nsCPlatformBaseLoop m_PhThreadId=<%d>\n", m_PhThreadId));
}
//*****************************************************************************
// nsCPlatformBaseLoop:: Internal Platform Implementations of nsIEventLoop
// (Error checking is ensured above)
//*****************************************************************************
nsresult nsCPlatformBaseLoop::PlatformGetNextEvent(void* platformFilterData,
void* platformEventData)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformGetNextEvent platformFilterData=<%p> platformEventData=<%p>\n", platformFilterData, platformEventData));
nsCPhFilter* filter=(nsCPhFilter*)platformFilterData;
nsCPhEvent* pEvent = (nsCPhEvent*) platformEventData;
PRBool done = PR_FALSE;
if(filter != NULL)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformGetNextEvent Filters not supported\n"));
return NS_COMFALSE;
}
while(!done)
{
switch( PhEventNext(pEvent->m_msg, pEvent->GetEventBufferSize()))
{
case Ph_EVENT_MSG:
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformGetNextEvent GetMessage\n"));
done = PR_TRUE;
break;
case Ph_RESIZE_MSG:
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformGetNextEvent Resize Message from <%d> to <%d>\n", pEvent->GetEventBufferSize(), pEvent->GetEventSize()));
pEvent->ResizeEvent(pEvent->GetEventSize());
break;
}
}
return NS_OK;
}
nsresult nsCPlatformBaseLoop::PlatformPeekNextEvent(void* platformFilterData,
void* platformEventData, PRBool fRemoveEvent)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformPeekNextEvent platformFilterData=<%p> platformEventData=<%p> fRemoveEvent=<%d>\n", platformFilterData, platformEventData, fRemoveEvent));
if(fRemoveEvent == PR_FALSE)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformPeekNextEvent Leaving the element on the queue is not supported\n"));
return NS_COMFALSE;
}
#if 0
nsCWinFilter* filter=(nsCWinFilter*)platformFilterData;
MSG* pMsg=(MSG*)platformEventData;
if(fRemoveEvent)
filter->wRemoveFlags|= PM_REMOVE;
else
filter->wRemoveFlags&= ~PM_REMOVE;
if(::PeekMessage(pMsg, filter->hWnd, filter->wMsgFilterMin,
filter->wMsgFilterMax, filter->wRemoveFlags))
return NS_OK;
#endif
return NS_COMFALSE;
}
nsresult nsCPlatformBaseLoop::PlatformTranslateEvent(void* platformEventData)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformTranslateEvent platformEventData=<%p>\n", platformEventData));
#if 0
MSG* pMsg=(MSG*)platformEventData;
::TranslateMessage(pMsg);
#endif
return NS_OK;
}
nsresult nsCPlatformBaseLoop::PlatformDispatchEvent(void* platformEventData)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformDispatchEvent platformEventData=<%p>\n", platformEventData));
#if 0
MSG* pMsg=(MSG*)platformEventData;
::DispatchMessage(pMsg);
#endif
return NS_OK;
}
nsresult nsCPlatformBaseLoop::PlatformSendLoopEvent(void* platformEventData, PRInt32* result)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformSendLoopEvent platformEventData=<%p>\n", platformEventData));
#if 0
MSG* pMsg=(MSG*)platformEventData;
*result = ::SendMessage(pMsg->hwnd, pMsg->message, pMsg->wParam,pMsg->lParam);
#endif
return NS_OK;
}
nsresult nsCPlatformBaseLoop::PlatformPostLoopEvent(void* platformEventData)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformPostLoopEvent platformEventData=<%p>\n", platformEventData));
#if 0
MSG* pMsg=(MSG*)platformEventData;
if(!pMsg->hwnd)
{
if(!::PostThreadMessage(m_WinThreadId, pMsg->message, pMsg->wParam,
pMsg->lParam))
return NS_ERROR_FAILURE;
}
else if(!::PostMessage(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam))
return NS_ERROR_FAILURE;
#endif
return NS_OK;
}
nsNativeEventDataType nsCPlatformBaseLoop::PlatformGetEventType()
{
return nsNativeEventDataTypes::PhotonMsgStruct;
}
nsNativeEventDataType nsCPlatformBaseLoop::PlatformGetFilterType()
{
return nsNativeFilterDataTypes::PhotonFilter;
}
PRInt32 nsCPlatformBaseLoop::PlatformGetReturnCode(void* platformEventData)
{
PR_LOG(PhEventLog, PR_LOG_DEBUG, ("nsCPlatformBaseLoop::PlatformGetReturnCode platformEventData=<%p>\n", platformEventData));
#if 0
MSG* pMsg=(MSG*)platformEventData;
return pMsg->wParam;
#endif
return -1;
}

Просмотреть файл

@ -1,62 +0,0 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications, Inc. Portions created by Netscape are
* Copyright (C) 1999, Mozilla. All Rights Reserved.
*
* Contributor(s):
* Travis Bogard <travis@netscape.com>
*/
#include "nsCAppLoop.h"
#include "nsCWinFilter.h"
//*****************************************************************************
//*** nsCAppLoop: Object Management
//*****************************************************************************
nsCAppLoop::nsCAppLoop() : nsCBaseAppLoop()
{
}
nsCAppLoop::~nsCAppLoop()
{
}
NS_METHOD nsCAppLoop::Create(nsISupports* aOuter, const nsIID& aIID,
void** ppv)
{
NS_ENSURE_ARG_POINTER(ppv);
NS_ENSURE_NO_AGGREGATION(aOuter);
nsCAppLoop* app = new nsCAppLoop();
NS_ENSURE_TRUE(app, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(app);
nsresult rv = app->QueryInterface(aIID, ppv);
NS_RELEASE(app);
return rv;
}
//*****************************************************************************
// nsCAppLoop:: Internal Platform Implementations of nsIEventLoop
// (Error checking is ensured above)
//*****************************************************************************
nsresult nsCAppLoop::PlatformExit(PRInt32 exitCode)
{
PostQuitMessage(exitCode);
return NS_OK;
}

Просмотреть файл

@ -1,80 +0,0 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications, Inc. Portions created by Netscape are
* Copyright (C) 1999, Mozilla. All Rights Reserved.
*
* Contributor(s):
* Travis Bogard <travis@netscape.com>
*/
#include "nsCBreathLoop.h"
#include "nsCWinFilter.h"
//*****************************************************************************
//*** nsCBreathLoop: Object Management
//*****************************************************************************
nsCBreathLoop::nsCBreathLoop() : nsCBaseBreathLoop()
{
}
nsCBreathLoop::~nsCBreathLoop()
{
}
NS_METHOD nsCBreathLoop::Create(nsISupports* aOuter, const nsIID& aIID,
void** ppv)
{
NS_ENSURE_ARG_POINTER(ppv);
NS_ENSURE_NO_AGGREGATION(aOuter);
nsCBreathLoop* app = new nsCBreathLoop();
NS_ENSURE_TRUE(app, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(app);
nsresult rv = app->QueryInterface(aIID, ppv);
NS_RELEASE(app);
return rv;
}
//*****************************************************************************
// nsCBreathLoop:: Internal Platform Implementations of nsIEventLoop
// (Error checking is ensured above)
//*****************************************************************************
nsresult nsCBreathLoop::PlatformExit(PRInt32 exitCode)
{
// XXX Not sure we can force PeekMessage out....
return NS_OK;
}
PRInt32 nsCBreathLoop::PlatformGetReturnCode(void* platformEventData)
{
return 0;
}
nsresult nsCBreathLoop::PlatformRetrieveNextEvent(void* platformFilterData,
void* platformEventData)
{
nsCWinFilter* filter=(nsCWinFilter*)platformFilterData;
MSG* pMsg=(MSG*)platformEventData;
filter->wRemoveFlags|= PM_REMOVE;
if(::PeekMessage(pMsg, filter->hWnd, filter->wMsgFilterMin,
filter->wMsgFilterMax, filter->wRemoveFlags))
return NS_OK;
return NS_COMFALSE;
}

Просмотреть файл

@ -1,180 +0,0 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications, Inc. Portions created by Netscape are
* Copyright (C) 1999, Mozilla. All Rights Reserved.
*
* Contributor(s):
* Travis Bogard <travis@netscape.com>
*/
#include "nsCRT.h"
#include "nsCEvent.h"
//*****************************************************************************
//*** nsCEvent: Object Management
//*****************************************************************************
nsCEvent::nsCEvent(void* platformEventData)
{
NS_INIT_REFCNT();
if(platformEventData)
nsCRT::memcpy(&m_msg, platformEventData, sizeof(m_msg));
else
nsCRT::memset(&m_msg, 0, sizeof(m_msg));
}
nsCEvent::~nsCEvent()
{
}
//*****************************************************************************
// nsCEvent::nsISupports
//*****************************************************************************
NS_IMPL_ISUPPORTS2(nsCEvent, nsIEvent, nsIWinEvent)
//*****************************************************************************
// nsCEvent::nsIEvent
//*****************************************************************************
NS_IMETHODIMP nsCEvent::GetNativeData(nsNativeEventDataType dataType,
void** data)
{
NS_ENSURE_ARG(nsNativeEventDataTypes::WinMsgStruct == dataType);
NS_ENSURE_ARG_POINTER(data);
*data = &m_msg;
return NS_OK;
}
NS_IMETHODIMP nsCEvent::SetNativeData(nsNativeEventDataType dataType,
void* data)
{
NS_ENSURE_ARG(nsNativeEventDataTypes::WinMsgStruct == dataType);
if(!data)
nsCRT::memset(&m_msg, 0, sizeof(m_msg));
else
nsCRT::memcpy(&m_msg, data, sizeof(m_msg));
return NS_OK;
}
NS_IMETHODIMP nsCEvent::GetIsExitEvent(PRBool* aIsExitEvent)
{
NS_ENSURE_ARG_POINTER(aIsExitEvent);
*aIsExitEvent = m_msg.message == WM_QUIT ? PR_TRUE : PR_FALSE;
return NS_OK;
}
//*****************************************************************************
// nsCEvent::nsIWinEvent
//*****************************************************************************
NS_IMETHODIMP nsCEvent::GetHwnd(void** aHwnd)
{
NS_ENSURE_ARG_POINTER(aHwnd);
*aHwnd = m_msg.hwnd;
return NS_OK;
}
NS_IMETHODIMP nsCEvent::SetHwnd(void* aHwnd)
{
m_msg.hwnd = (HWND)aHwnd;
return NS_OK;
}
NS_IMETHODIMP nsCEvent::GetMessage(PRUint32* aMessage)
{
NS_ENSURE_ARG_POINTER(aMessage);
*aMessage = m_msg.message;
return NS_OK;
}
NS_IMETHODIMP nsCEvent::SetMessage(PRUint32 aMessage)
{
m_msg.message = aMessage;
return NS_OK;
}
NS_IMETHODIMP nsCEvent::GetWParam(PRUint32* aWParam)
{
NS_ENSURE_ARG_POINTER(aWParam);
*aWParam = m_msg.wParam;
return NS_OK;
}
NS_IMETHODIMP nsCEvent::SetWParam(PRUint32 aWParam)
{
m_msg.wParam = aWParam;
return NS_OK;
}
NS_IMETHODIMP nsCEvent::GetLParam(PRUint32* aLParam)
{
NS_ENSURE_ARG_POINTER(aLParam);
*aLParam = m_msg.lParam;
return NS_OK;
}
NS_IMETHODIMP nsCEvent::SetLParam(PRUint32 aLParam)
{
m_msg.lParam = aLParam;
return NS_OK;
}
NS_IMETHODIMP nsCEvent::GetTime(PRUint32* aTime)
{
NS_ENSURE_ARG_POINTER(aTime);
*aTime = m_msg.time;
return NS_OK;
}
NS_IMETHODIMP nsCEvent::SetTime(PRUint32 aTime)
{
m_msg.time = aTime;
return NS_OK;
}
NS_IMETHODIMP nsCEvent::GetPointX(PRInt32* aPointX)
{
NS_ENSURE_ARG_POINTER(aPointX);
*aPointX = m_msg.pt.x;
return NS_OK;
}
NS_IMETHODIMP nsCEvent::SetPointX(PRInt32 aPointX)
{
m_msg.pt.x = aPointX;
return NS_OK;
}
NS_IMETHODIMP nsCEvent::GetPointY(PRInt32* aPointY)
{
NS_ENSURE_ARG_POINTER(aPointY);
*aPointY = m_msg.pt.y;
return NS_OK;
}
NS_IMETHODIMP nsCEvent::SetPointY(PRInt32 aPointY)
{
m_msg.pt.y = aPointY;
return NS_OK;
}

Просмотреть файл

@ -1,133 +0,0 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications, Inc. Portions created by Netscape are
* Copyright (C) 1999, Mozilla. All Rights Reserved.
*
* Contributor(s):
* Travis Bogard <travis@netscape.com>
*/
#include "nsCRT.h"
#include "nsCEventFilter.h"
//*****************************************************************************
//*** nsCEventFilter: Object Management
//*****************************************************************************
nsCEventFilter::nsCEventFilter(void* platformFilterData)
{
NS_INIT_REFCNT();
if(platformFilterData)
nsCRT::memcpy(&m_filter, platformFilterData, sizeof(m_filter));
else
nsCRT::memset(&m_filter, 0, sizeof(m_filter));
}
nsCEventFilter::~nsCEventFilter()
{
}
//*****************************************************************************
// nsCEventFilter::nsISupports
//*****************************************************************************
NS_IMPL_ISUPPORTS2(nsCEventFilter, nsIEventFilter, nsIWinEventFilter)
//*****************************************************************************
// nsCEventFilter::nsIEventFilter
//*****************************************************************************
NS_IMETHODIMP nsCEventFilter::GetNativeData(nsNativeFilterDataType dataType,
void** data)
{
NS_ENSURE_ARG(nsNativeFilterDataTypes::WinFilter == dataType);
NS_ENSURE_ARG_POINTER(data);
*data = &m_filter;
return NS_OK;
}
NS_IMETHODIMP nsCEventFilter::SetNativeData(nsNativeFilterDataType dataType,
void* data)
{
NS_ENSURE_ARG(nsNativeFilterDataTypes::WinFilter == dataType);
if(!data)
nsCRT::memset(&m_filter, 0, sizeof(m_filter));
else
nsCRT::memcpy(&m_filter, data, sizeof(m_filter));
return NS_OK;
}
//*****************************************************************************
// nsCEventFilter::nsIEventFilter
//*****************************************************************************
NS_IMETHODIMP nsCEventFilter::GetHwnd(void** aHwnd)
{
NS_ENSURE_ARG_POINTER(aHwnd);
*aHwnd = m_filter.hWnd;
return NS_OK;
}
NS_IMETHODIMP nsCEventFilter::SetHwnd(void* aHwnd)
{
m_filter.hWnd = (HWND)aHwnd;
return NS_OK;
}
NS_IMETHODIMP nsCEventFilter::GetMsgFilterMin(PRUint32* aMsgFilterMin)
{
NS_ENSURE_ARG_POINTER(aMsgFilterMin);
*aMsgFilterMin = m_filter.wMsgFilterMin;
return NS_OK;
}
NS_IMETHODIMP nsCEventFilter::SetMsgFilterMin(PRUint32 aMsgFilterMin)
{
m_filter.wMsgFilterMin = aMsgFilterMin;
return NS_OK;
}
NS_IMETHODIMP nsCEventFilter::GetMsgFilterMax(PRUint32* aMsgFilterMax)
{
NS_ENSURE_ARG_POINTER(aMsgFilterMax);
*aMsgFilterMax = m_filter.wMsgFilterMax;
return NS_OK;
}
NS_IMETHODIMP nsCEventFilter::SetMsgFilterMax(PRUint32 aMsgFilterMax)
{
m_filter.wMsgFilterMax = aMsgFilterMax;
return NS_OK;
}
NS_IMETHODIMP nsCEventFilter::GetRemoveFlags(PRUint32* aRemoveFlags)
{
NS_ENSURE_ARG_POINTER(aRemoveFlags);
*aRemoveFlags = m_filter.wRemoveFlags;
return NS_OK;
}
NS_IMETHODIMP nsCEventFilter::SetRemoveFlags(PRUint32 aRemoveFlags)
{
m_filter.wRemoveFlags = aRemoveFlags;
return NS_OK;
}

Просмотреть файл

@ -1,132 +0,0 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications, Inc. Portions created by Netscape are
* Copyright (C) 1999, Mozilla. All Rights Reserved.
*
* Contributor(s):
* Travis Bogard <travis@netscape.com>
*/
#include "nsCPlatformBaseLoop.h"
#include "nsCWinFilter.h"
//*****************************************************************************
//*** nsCPlatformBaseLoop: Object Management
//*****************************************************************************
nsCPlatformBaseLoop::nsCPlatformBaseLoop(nsEventLoopType type) :
nsCBaseLoop(type)
{
m_WinThreadId = ::GetCurrentThreadId();
}
nsCPlatformBaseLoop::~nsCPlatformBaseLoop()
{
}
//*****************************************************************************
// nsCPlatformBaseLoop:: Internal Platform Implementations of nsIEventLoop
// (Error checking is ensured above)
//*****************************************************************************
nsresult nsCPlatformBaseLoop::PlatformGetNextEvent(void* platformFilterData,
void* platformEventData)
{
nsCWinFilter* filter=(nsCWinFilter*)platformFilterData;
MSG* pMsg=(MSG*)platformEventData;
if(::GetMessage(pMsg, filter->hWnd, filter->wMsgFilterMin,
filter->wMsgFilterMax))
return NS_OK;
return NS_COMFALSE;
}
nsresult nsCPlatformBaseLoop::PlatformPeekNextEvent(void* platformFilterData,
void* platformEventData, PRBool fRemoveEvent)
{
nsCWinFilter* filter=(nsCWinFilter*)platformFilterData;
MSG* pMsg=(MSG*)platformEventData;
if(fRemoveEvent)
filter->wRemoveFlags|= PM_REMOVE;
else
filter->wRemoveFlags&= ~PM_REMOVE;
if(::PeekMessage(pMsg, filter->hWnd, filter->wMsgFilterMin,
filter->wMsgFilterMax, filter->wRemoveFlags))
return NS_OK;
return NS_COMFALSE;
}
nsresult nsCPlatformBaseLoop::PlatformTranslateEvent(void* platformEventData)
{
MSG* pMsg=(MSG*)platformEventData;
::TranslateMessage(pMsg);
return NS_OK;
}
nsresult nsCPlatformBaseLoop::PlatformDispatchEvent(void* platformEventData)
{
MSG* pMsg=(MSG*)platformEventData;
::DispatchMessage(pMsg);
return NS_OK;
}
nsresult nsCPlatformBaseLoop::PlatformSendLoopEvent(void* platformEventData, PRInt32* result)
{
MSG* pMsg=(MSG*)platformEventData;
*result = ::SendMessage(pMsg->hwnd, pMsg->message, pMsg->wParam,pMsg->lParam);
return NS_OK;
}
nsresult nsCPlatformBaseLoop::PlatformPostLoopEvent(void* platformEventData)
{
MSG* pMsg=(MSG*)platformEventData;
if(!pMsg->hwnd)
{
if(!::PostThreadMessage(m_WinThreadId, pMsg->message, pMsg->wParam,
pMsg->lParam))
return NS_ERROR_FAILURE;
}
else if(!::PostMessage(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam))
return NS_ERROR_FAILURE;
return NS_OK;
}
nsNativeEventDataType nsCPlatformBaseLoop::PlatformGetEventType()
{
return nsNativeEventDataTypes::WinMsgStruct;
}
nsNativeEventDataType nsCPlatformBaseLoop::PlatformGetFilterType()
{
return nsNativeFilterDataTypes::WinFilter;
}
PRInt32 nsCPlatformBaseLoop::PlatformGetReturnCode(void* platformEventData)
{
MSG* pMsg=(MSG*)platformEventData;
return pMsg->wParam;
}
nsresult nsCPlatformBaseLoop::PlatformRetrieveNextEvent(void* platformFilterData,
void* platformEventData)
{
nsCWinFilter* filter=(nsCWinFilter*)platformFilterData;
MSG* pMsg=(MSG*)platformEventData;
if(::GetMessage(pMsg, filter->hWnd, filter->wMsgFilterMin,
filter->wMsgFilterMax))
return NS_OK;
return NS_COMFALSE;
}

Просмотреть файл

@ -1,62 +0,0 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the Mozilla browser.
*
* The Initial Developer of the Original Code is Netscape
* Communications, Inc. Portions created by Netscape are
* Copyright (C) 1999, Mozilla. All Rights Reserved.
*
* Contributor(s):
* Travis Bogard <travis@netscape.com>
*/
#include "nsCThreadLoop.h"
#include "nsCWinFilter.h"
//*****************************************************************************
//*** nsCThreadLoop: Object Management
//*****************************************************************************
nsCThreadLoop::nsCThreadLoop() : nsCBaseThreadLoop()
{
}
nsCThreadLoop::~nsCThreadLoop()
{
}
NS_METHOD nsCThreadLoop::Create(nsISupports* aOuter, const nsIID& aIID,
void** ppv)
{
NS_ENSURE_ARG_POINTER(ppv);
NS_ENSURE_NO_AGGREGATION(aOuter);
nsCThreadLoop* app = new nsCThreadLoop();
NS_ENSURE_TRUE(app, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(app);
nsresult rv = app->QueryInterface(aIID, ppv);
NS_RELEASE(app);
return rv;
}
//*****************************************************************************
// nsCThreadLoop:: Internal Platform Implementations of nsIEventLoop
// (Error checking is ensured above)
//*****************************************************************************
nsresult nsCThreadLoop::PlatformExit(PRInt32 exitCode)
{
::PostThreadMessage(m_WinThreadId, WM_QUIT, 0, 0);
return NS_OK;
}

Просмотреть файл

@ -1,4 +0,0 @@
static void dummy()
{
// This is just so that base.shlb has something to compile.
}

Просмотреть файл

@ -460,4 +460,4 @@ nsAppleSingleEncoder::FSpGetCatInfo(CInfoPBRec *pb, FSSpecPtr aFile)
ERR_CHECK( PBGetCatInfoSync(pb) );
return err;
}
}

Просмотреть файл

@ -267,4 +267,4 @@ nsEventHandler::HandleMenuChoice(SInt32 aChoice)
}
return err;
}
}

Просмотреть файл

@ -173,4 +173,4 @@ nsFileSelector::GetCWD(long *aOutDirID, short *aOutVRefNum)
}
return err;
}
}

Просмотреть файл

@ -741,4 +741,4 @@ nsAppleSingleDecoder::PLstrcmp(StringPtr str1, StringPtr str2)
bEqual = false;
return bEqual;
}
}

Просмотреть файл

@ -59,4 +59,4 @@ DisableAdditionsWin(void)
DisableNavButtons();
// TO DO
}
}

Просмотреть файл

@ -105,4 +105,4 @@ DrawCheckedCheckbox(Rect *cellRect)
MoveTo(checkbox.right-2, checkbox.top+1);
LineTo(checkbox.left+1, checkbox.bottom-2);
}
}

Просмотреть файл

@ -590,4 +590,4 @@ DisableComponentsWin(void)
DisableNavButtons();
// TO DO
}
}

Просмотреть файл

@ -409,4 +409,4 @@ aurevoir:
if (pcoreDir)
DisposePtr((Ptr) pcoreDir);
return err;
}
}

Просмотреть файл

@ -377,4 +377,4 @@ void React2InContent(EventRecord* evt, WindowPtr wCurrPtr)
gDone = true;
break;
}
}
}

Просмотреть файл

@ -764,4 +764,4 @@ UnloadSDLib(CFragConnectionID *connID)
return false;
return true;
}
}

Просмотреть файл

@ -504,4 +504,4 @@ DisableNavButtons(void)
HiliteControl(gControls->nextB, kDisableControl);
// TO DO
}
}

Просмотреть файл

@ -346,4 +346,4 @@ void Shutdown(void)
HideWindow(gWPtr);
DisposeWindow(gWPtr);
}
}
}

Просмотреть файл

@ -1017,4 +1017,4 @@ DisableSetupTypeWin(void)
HiliteControl(gControls->stw->instType, kDisableControl);
if (gControls->stw->destLoc)
HiliteControl(gControls->stw->destLoc, kDisableControl);
}
}

Просмотреть файл

@ -202,4 +202,4 @@ DisableTerminalWin(void)
DisableNavButtons();
// TO DO
}
}

Просмотреть файл

@ -424,4 +424,4 @@ IsArchiveXPI(StringPtr archive)
return true;
return false;
}
}