diff --git a/mozilla/widget/src/os2/nsAppShell.cpp b/mozilla/widget/src/os2/nsAppShell.cpp index 64ee0a0cc57..9cafad314d1 100644 --- a/mozilla/widget/src/os2/nsAppShell.cpp +++ b/mozilla/widget/src/os2/nsAppShell.cpp @@ -289,18 +289,19 @@ extern "C" nsresult NS_CreateAppshell( nsIAppShell **aAppShell) if( !aAppShell) return NS_ERROR_NULL_POINTER; - BOOL bFirstTime = FALSE; - if( !pManager) { - bFirstTime = TRUE; pManager = new nsAppshellManager; } *aAppShell = pManager->GetAppshell(); - if( bFirstTime) - gModuleData.Init( *aAppShell); + // only do this the very first time + if (gModuleData == nsnull) + { + gModuleData = new nsWidgetModuleData(); + gModuleData->Init(*aAppShell); + } return NS_OK; } diff --git a/mozilla/widget/src/os2/nsCanvas.cpp b/mozilla/widget/src/os2/nsCanvas.cpp index d785b94b1d8..720fecc814f 100644 --- a/mozilla/widget/src/os2/nsCanvas.cpp +++ b/mozilla/widget/src/os2/nsCanvas.cpp @@ -111,7 +111,7 @@ PRBool nsCanvas::OnReposition( PSWP pSwp) if( mIsTLB) { if( pSwp->fl & SWP_MOVE && !(pSwp->fl & SWP_MINIMIZE)) - rc = OnMove( pSwp->x, gModuleData.szScreen.cy - pSwp->y - pSwp->cy); + rc = OnMove( pSwp->x, gModuleData->szScreen.cy - pSwp->y - pSwp->cy); if( pSwp->fl & SWP_SIZE && !(pSwp->fl & SWP_MINIMIZE)) rc = OnResize( pSwp->cx, pSwp->cy); } diff --git a/mozilla/widget/src/os2/nsClipboard.cpp b/mozilla/widget/src/os2/nsClipboard.cpp index 8f063f318fd..87f54eb5be8 100644 --- a/mozilla/widget/src/os2/nsClipboard.cpp +++ b/mozilla/widget/src/os2/nsClipboard.cpp @@ -64,7 +64,7 @@ nsClipboard::nsClipboard() : nsBaseClipboard() for (int cnt=0 ; cnt < sizeof(formatEntries) / sizeof(formatEntries[0]) ; cnt++) { if (formatEntries[cnt].ulClipboardFmt == 0) // Not yet registered - formatEntries[cnt].ulClipboardFmt = gModuleData.GetAtom( formatEntries[cnt].szFmtName ); + formatEntries[cnt].ulClipboardFmt = gModuleData->GetAtom( formatEntries[cnt].szFmtName ); } } @@ -141,7 +141,7 @@ PRBool nsClipboard::GetClipboardDataByID(ULONG ulFormatID, const char *aFlavor) pTempBuf = nsMemory::Alloc( NumOfBytes + sizeof(UniChar) ); TempBufAllocated = PR_TRUE; - NumOfChars = gModuleData.ConvertToUcs( NS_STATIC_CAST(char*, pDataMem), NS_STATIC_CAST(PRUnichar*, pTempBuf), NumOfChars + 1 ); + NumOfChars = gModuleData->ConvertToUcs( NS_STATIC_CAST(char*, pDataMem), NS_STATIC_CAST(PRUnichar*, pTempBuf), NumOfChars + 1 ); NumOfBytes = NumOfChars * sizeof(UniChar); pDataMem = pTempBuf; } @@ -260,7 +260,7 @@ void nsClipboard::SetClipboardData(const char *aFlavor) if (DosAllocSharedMem( NS_REINTERPRET_CAST(PPVOID, &pByteMem), nsnull, NumOfBytes + 1, PAG_WRITE | PAG_COMMIT | OBJ_GIVEABLE ) == NO_ERROR) { - gModuleData.ConvertFromUcs( NS_STATIC_CAST(PRUnichar*, pMozData), pByteMem, NumOfBytes + 1 ); + gModuleData->ConvertFromUcs( NS_STATIC_CAST(PRUnichar*, pMozData), pByteMem, NumOfBytes + 1 ); pByteMem [NumOfBytes] = '\0'; WinSetClipbrdData( 0, NS_REINTERPRET_CAST(ULONG, pByteMem), CF_TEXT, CFI_POINTER ); @@ -352,7 +352,7 @@ ULONG nsClipboard::GetFormatID(const char *aMimeStr) } } - return gModuleData.GetAtom( aMimeStr ); // Unknown flavor. Register it in OS/2 atom table as is + return gModuleData->GetAtom( aMimeStr ); // Unknown flavor. Register it in OS/2 atom table as is } NS_IMETHODIMP nsClipboard::ForceDataToClipboard(PRInt32 aWhichClipboard) diff --git a/mozilla/widget/src/os2/nsDragService.cpp b/mozilla/widget/src/os2/nsDragService.cpp index dce3a1c2504..fdada450240 100644 --- a/mozilla/widget/src/os2/nsDragService.cpp +++ b/mozilla/widget/src/os2/nsDragService.cpp @@ -91,7 +91,7 @@ static void GetTempFile( nsFileSpec &tempfile); nsDragService::nsDragService() : mDragInfo(0), mDragItems(0) { // XXX temporary icon until xptoolkit realises it needs to give us one - mIcon = WinLoadPointer( HWND_DESKTOP, gModuleData.hModResources, + mIcon = WinLoadPointer( HWND_DESKTOP, gModuleData->hModResources, ID_ICO_DRAGITEM); // Window for doing things @@ -178,7 +178,7 @@ nsresult nsDragService::GetData( nsITransferable *aTransferable, { nsString *pFlavour = (nsString*) pFormats->ElementAt( i); char buff[40]; - gModuleData.ConvertFromUcs( *pFlavour, buff, 40); + gModuleData->ConvertFromUcs( *pFlavour, buff, 40); const char *rf = MimeTypeToRF( buff); if( rf && DrgVerifyRMF( pItem, 0, rf)) { @@ -324,7 +324,7 @@ nsresult nsDragService::IsDataFlavorSupported( nsString *aDataFlavour) nsresult rc = NS_ERROR_FAILURE; char buff[40]; - gModuleData.ConvertFromUcs( *aDataFlavour, buff, 40); + gModuleData->ConvertFromUcs( *aDataFlavour, buff, 40); const char *rf = MimeTypeToRF( buff); @@ -434,7 +434,7 @@ nsresult NS_GetDragService( nsISupports **aDragService) if( !aDragService) return NS_ERROR_NULL_POINTER; - *aDragService = (nsIDragService*)gModuleData.dragService; + *aDragService = (nsIDragService*)gModuleData->dragService; NS_ADDREF(*aDragService); return NS_OK; @@ -523,7 +523,7 @@ void nsDragService::FillDragItem( PDRAGITEM aItem, nsITransferable *aTransferabl for( PRUint32 i = 0; i < cFormats; i++) { nsString *pFlavour = (nsString*) pFormats->ElementAt( i); - gModuleData.ConvertFromUcs( *pFlavour, buff, 40); + gModuleData->ConvertFromUcs( *pFlavour, buff, 40); const char *rf = MimeTypeToRF( buff); if( rf) { @@ -631,8 +631,8 @@ MRESULT EXPENTRY fnwpDragSource( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { MRESULT mr; - if( gModuleData.dragService) - mr = gModuleData.dragService->HandleMessage( msg, mp1, mp2); + if( gModuleData->dragService) + mr = gModuleData->dragService->HandleMessage( msg, mp1, mp2); else mr = WinDefWindowProc( hwnd, msg, mp1, mp2); @@ -717,7 +717,7 @@ MRESULT nsDragService::HandleMessage( ULONG msg, MPARAM mp1, MPARAM mp2) for( i = 0; i < cFormats; i++) { nsString *pFlavour = (nsString*) pFormats->ElementAt( i); - gModuleData.ConvertFromUcs( *pFlavour, buff, 40); + gModuleData->ConvertFromUcs( *pFlavour, buff, 40); const char *this_rf = MimeTypeToRF( buff); if( this_rf && !strcmp( this_rf, rf)) { diff --git a/mozilla/widget/src/os2/nsFilePicker.cpp b/mozilla/widget/src/os2/nsFilePicker.cpp index 49225591167..1cd58e3ba61 100644 --- a/mozilla/widget/src/os2/nsFilePicker.cpp +++ b/mozilla/widget/src/os2/nsFilePicker.cpp @@ -101,7 +101,7 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval) DIRPICKER dp = { { 0 }, 0, TRUE, 0 }; // modal dialog HWND ret = FS_PickDirectory(HWND_DESKTOP, mWnd, - gModuleData.hModResources, &dp); + gModuleData->hModResources, &dp); if (ret && dp.lReturn == DID_OK) { result = PR_TRUE; @@ -118,7 +118,7 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval) PRInt32 l = (mFilterList.Length()+2)*2; char *filterBuffer = (char*) nsMemory::Alloc(l); - int len = gModuleData.WideCharToMultiByte(0, + int len = gModuleData->WideCharToMultiByte(0, mFilterList.GetUnicode(), mFilterList.Length(), filterBuffer, @@ -154,7 +154,7 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval) // Store the current directory in mDisplayDirectory char* newCurrentDirectory = NS_STATIC_CAST( char*, nsMemory::Alloc( MAX_PATH+1 ) ); - VERIFY(gModuleData.GetCurrentDirectory(MAX_PATH, newCurrentDirectory) > 0); + VERIFY(gModuleData->GetCurrentDirectory(MAX_PATH, newCurrentDirectory) > 0); mDisplayDirectory->InitWithPath(newCurrentDirectory); nsMemory::Free( newCurrentDirectory ); diff --git a/mozilla/widget/src/os2/nsFileWidget.cpp b/mozilla/widget/src/os2/nsFileWidget.cpp index 022d185b724..b9fdf46d3ec 100644 --- a/mozilla/widget/src/os2/nsFileWidget.cpp +++ b/mozilla/widget/src/os2/nsFileWidget.cpp @@ -152,7 +152,7 @@ PRBool nsFileWidget::Show() // Store the current directory in mDisplayDirectory char* newCurrentDirectory = new char[MAX_PATH+1]; - VERIFY(gModuleData.GetCurrentDirectory(MAX_PATH, newCurrentDirectory) > 0); + VERIFY(gModuleData->GetCurrentDirectory(MAX_PATH, newCurrentDirectory) > 0); mDisplayDirectory = newCurrentDirectory; delete[] newCurrentDirectory; @@ -312,10 +312,10 @@ nsFileDlgResults nsFileWidget::GetFolder(nsIWidget * aParent, DIRPICKER dp = { { 0 }, 0, TRUE, 0 }; // modal dialog - gModuleData.ConvertFromUcs( promptString, dp.szFullFile, CCHMAXPATH); + gModuleData->ConvertFromUcs( promptString, dp.szFullFile, CCHMAXPATH); HWND ret = FS_PickDirectory( HWND_DESKTOP, hwndOwner, - gModuleData.hModResources, &dp); + gModuleData->hModResources, &dp); if( ret && dp.lReturn == DID_OK) { diff --git a/mozilla/widget/src/os2/nsFrameWindow.cpp b/mozilla/widget/src/os2/nsFrameWindow.cpp index 8d0e58e715d..5b302b49b10 100644 --- a/mozilla/widget/src/os2/nsFrameWindow.cpp +++ b/mozilla/widget/src/os2/nsFrameWindow.cpp @@ -171,7 +171,7 @@ void nsFrameWindow::RealDoCreate( HWND hwndP, nsWindow *aParent, fnwpDefFrame = WinSubclassWindow( hwndFrame, fnwpFrame); WinSetWindowPtr( hwndFrame, QWL_USER, this); BOOL brc = (BOOL) WinSendMsg( hwndFrame, WM_SETICON, - MPFROMLONG( gModuleData.GetFrameIcon()), 0); + MPFROMLONG( gModuleData->GetFrameIcon()), 0); // make the client the client. WinSetWindowUShort( mWnd, QWS_ID, FID_CLIENT); @@ -188,7 +188,7 @@ ULONG nsFrameWindow::GetFCFlags() { ULONG style = FCF_TITLEBAR | FCF_SYSMENU | FCF_TASKLIST | FCF_CLOSEBUTTON | FCF_NOBYTEALIGN | - (gModuleData.bIsDBCS ? FCF_DBE_APPSTAT : 0); + (gModuleData->bIsDBCS ? FCF_DBE_APPSTAT : 0); if (mWindowType == eWindowType_dialog) { style |= FCF_DIALOGBOX; @@ -333,7 +333,7 @@ MRESULT nsFrameWindow::FrameMessage( ULONG msg, MPARAM mp1, MPARAM mp2) { // These commented-out `-1's cancel each other out. POINTL ptl = { pSwp->x, pSwp->y + pSwp->cy /* - 1 */ }; - ptl.y = gModuleData.szScreen.cy - ptl.y /* - 1*/ ; + ptl.y = gModuleData->szScreen.cy - ptl.y /* - 1*/ ; mBounds.x = ptl.x; mBounds.y = ptl.y; OnMove( ptl.x, ptl.y); diff --git a/mozilla/widget/src/os2/nsModule.cpp b/mozilla/widget/src/os2/nsModule.cpp index d8cd76df38c..592afd6a1df 100644 --- a/mozilla/widget/src/os2/nsModule.cpp +++ b/mozilla/widget/src/os2/nsModule.cpp @@ -54,8 +54,12 @@ #define KBD_CTRL KBD_CONTROL #endif +NS_IMPL_ISUPPORTS(nsWidgetModuleData, NS_GET_IID(nsISupports)) + nsWidgetModuleData::nsWidgetModuleData() -{} +{ + hModResources = NULLHANDLE; +} // This is called when the first appshell is created. void nsWidgetModuleData::Init( nsIAppShell *aPrimaevalAppShell) @@ -98,8 +102,10 @@ void nsWidgetModuleData::Init( nsIAppShell *aPrimaevalAppShell) // NS_ADDREF(dragService); // keep a ref beyond the client app so we shut ourselves down properly. + // don't do this for embedding where the appshell pointer is nsnull appshell = aPrimaevalAppShell; - NS_ADDREF(appshell); + if (appshell != nsnull) + NS_ADDREF(appshell); converter = 0; supplantConverter = FALSE; @@ -135,7 +141,9 @@ nsWidgetModuleData::~nsWidgetModuleData() // finally shut down the appshell. No more PM. // (hope that gfxos2 has gone first!) - NS_IF_RELEASE(appshell); + // don't do this if appshell is nsnull for embedding + if (appshell != nsnull) + NS_IF_RELEASE(appshell); } HPOINTER nsWidgetModuleData::GetPointer( nsCursor aCursor) @@ -525,5 +533,4 @@ int nsWidgetModuleData::WideCharToMultiByte( int CodePage, const PRUnichar *pTex return ulSize - cplen; } -nsWidgetModuleData gModuleData; - +nsWidgetModuleData *gModuleData = nsnull; diff --git a/mozilla/widget/src/os2/nsModule.h b/mozilla/widget/src/os2/nsModule.h new file mode 100644 index 00000000000..67a1beeff75 --- /dev/null +++ b/mozilla/widget/src/os2/nsModule.h @@ -0,0 +1,114 @@ +/* + * 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 OS/2 libraries. + * + * The Initial Developer of the Original Code is John Fairhurst, + * . Portions created by John Fairhurst are + * Copyright (C) 1999 John Fairhurst. All Rights Reserved. + * + * Contributor(s): + * + * This Original Code has been modified by IBM Corporation. + * Modifications made by IBM described herein are + * Copyright (c) International Business Machines + * Corporation, 2000 + * + * Modifications to Mozilla code or documentation + * identified per MPL Section 3.3 + * + * Date Modified by Description of modification + * 03/20/2001 achimha@innotek.de created + * + */ + +#ifndef _H_NSMODULE +#define _H_NSMODULE + +#include "nsISupports.h" +#include "nsIFontRetrieverService.h" +#include "nsDragService.h" +#include "nsWidgetDefs.h" + +#define NS_MODULEDATAOS2_CID \ + { 0xa506d27e, 0x1dd1, 0x11b2, \ + { 0x8a, 0x52, 0x82, 0xc3, 0x9, 0xe6, 0xdc, 0xc30 } } + +// Module data -- anything that would be static, should be module-visible, +// or any magic constants. +class nsWidgetModuleData : public nsISupports +{ + public: + + // nsISupports + NS_DECL_ISUPPORTS + + HMODULE hModResources; // resource module + SIZEL szScreen; // size of screen in pixels + BOOL bMouseSwitched; // true if MB1 is the RH mouse button + LONG lHtEntryfield; // ideal height of an entryfield + BOOL bIsDBCS; // true if system is dbcs + + // xptoolkit services we look after, & the primaeval appshell too. + nsIFontRetrieverService *fontService; + nsDragService *dragService; + nsIAppShell *appshell; + + // We're caching resource-loaded things here too. This may be + // better-suited elsewhere, but there shouldn't be very many of them. + HPOINTER GetPointer( nsCursor aCursor); + HPOINTER GetFrameIcon(); + + // local->Unicode cp. conversion + ULONG ConvertToUcs( const char *szText, PRUnichar *pBuffer, ULONG ulSize); + + // Unicode->local cp. conversions + char *ConvertFromUcs( const PRUnichar *pText, char *szBuffer, ULONG ulSize); + char *ConvertFromUcs( const nsString &aStr, char *szBuffer, ULONG ulSize); + // these methods use a single static buffer + const char *ConvertFromUcs( const PRUnichar *pText); + const char *ConvertFromUcs( const nsString &aStr); + + // Atom service; clients don't need to bother about freeing them. + ATOM GetAtom( const char *atomname); + ATOM GetAtom( const nsString &atomname); + + ULONG GetCurrentDirectory(ULONG bufLen, PSZ dirString); + + int WideCharToMultiByte( int CodePage, const PRUnichar *pText, ULONG ulLength, char* szBuffer, ULONG ulSize ); + +#if 0 + HWND GetWindowForPrinting( PCSZ pszClass, ULONG ulStyle); +#endif + + nsWidgetModuleData(); + ~nsWidgetModuleData(); + + void Init( nsIAppShell *aPrimaevalAppShell); + + private: + ULONG idSelect; + HPOINTER hptrSelect; // !! be more sensible about this... + HPOINTER hptrFrameIcon; +#if 0 + nsHashtable *mWindows; +#endif + + // Utility function for creating the Unicode conversion object + int CreateUcsConverter(); + + UconvObject converter; + BOOL supplantConverter; + + nsVoidArray atoms; +}; + +#endif \ No newline at end of file diff --git a/mozilla/widget/src/os2/nsWidgetDefs.h b/mozilla/widget/src/os2/nsWidgetDefs.h index d00b4ae0122..baa9fdd0e5f 100644 --- a/mozilla/widget/src/os2/nsWidgetDefs.h +++ b/mozilla/widget/src/os2/nsWidgetDefs.h @@ -36,6 +36,8 @@ #include // Rather not have to include these two, but need types... #include // +#include "nsModule.h" + #ifndef MAX_PATH #define MAX_PATH CCHMAXPATH #endif @@ -122,72 +124,7 @@ class nsIFontRetrieverService; class nsDragService; class nsIAppShell; -// Module data -- anything that would be static, should be module-visible, -// or any magic constants. -class nsWidgetModuleData -{ - public: - HMODULE hModResources; // resource module - SIZEL szScreen; // size of screen in pixels - BOOL bMouseSwitched; // true if MB1 is the RH mouse button - LONG lHtEntryfield; // ideal height of an entryfield - BOOL bIsDBCS; // true if system is dbcs - - // xptoolkit services we look after, & the primaeval appshell too. - nsIFontRetrieverService *fontService; - nsDragService *dragService; - nsIAppShell *appshell; - - // We're caching resource-loaded things here too. This may be - // better-suited elsewhere, but there shouldn't be very many of them. - HPOINTER GetPointer( nsCursor aCursor); - HPOINTER GetFrameIcon(); - - // local->Unicode cp. conversion - ULONG ConvertToUcs( const char *szText, PRUnichar *pBuffer, ULONG ulSize); - - // Unicode->local cp. conversions - char *ConvertFromUcs( const PRUnichar *pText, char *szBuffer, ULONG ulSize); - char *ConvertFromUcs( const nsString &aStr, char *szBuffer, ULONG ulSize); - // these methods use a single static buffer - const char *ConvertFromUcs( const PRUnichar *pText); - const char *ConvertFromUcs( const nsString &aStr); - - // Atom service; clients don't need to bother about freeing them. - ATOM GetAtom( const char *atomname); - ATOM GetAtom( const nsString &atomname); - - ULONG GetCurrentDirectory(ULONG bufLen, PSZ dirString); - - int WideCharToMultiByte( int CodePage, const PRUnichar *pText, ULONG ulLength, char* szBuffer, ULONG ulSize ); - -#if 0 - HWND GetWindowForPrinting( PCSZ pszClass, ULONG ulStyle); -#endif - - nsWidgetModuleData(); - ~nsWidgetModuleData(); - - void Init( nsIAppShell *aPrimaevalAppShell); - - private: - ULONG idSelect; - HPOINTER hptrSelect; // !! be more sensible about this... - HPOINTER hptrFrameIcon; -#if 0 - nsHashtable *mWindows; -#endif - - // Utility function for creating the Unicode conversion object - int CreateUcsConverter(); - - UconvObject converter; - BOOL supplantConverter; - - nsVoidArray atoms; -}; - -extern nsWidgetModuleData gModuleData; +extern nsWidgetModuleData *gModuleData; // messages - here to avoid duplication #define WMU_CALLMETHOD (WM_USER + 1) diff --git a/mozilla/widget/src/os2/nsWidgetFactory.cpp b/mozilla/widget/src/os2/nsWidgetFactory.cpp index 28e1a7b6d96..e0d211234e6 100644 --- a/mozilla/widget/src/os2/nsWidgetFactory.cpp +++ b/mozilla/widget/src/os2/nsWidgetFactory.cpp @@ -32,6 +32,7 @@ * 05/31/2000 IBM Corp. Enabled timer stuff * 06/30/2000 sobotka@axess.com Added nsFilePicker * 03/11/2001 achimha@innotek.de converted to XPCOM module + * 03/20/2001 achimha@innotek.de Added class for embedded module init */ #include "nsIGenericFactory.h" @@ -54,6 +55,7 @@ #include "nsScrollbar.h" #include "nsSound.h" #include "nsToolkit.h" +#include "nsModule.h" #include "nsWindowsTimer.h" #include "nsTimerManager.h" @@ -120,6 +122,42 @@ static nsresult nsAppShellConstructor (nsISupports *aOuter, REFNSIID aIID, void return rv; } +static nsresult nsWidgetModuleDataConstructor (nsISupports *aOuter, REFNSIID aIID, void **aResult) +{ + nsresult rv; + nsISupports *inst = nsnull; + + if ( NULL == aResult ) + { + rv = NS_ERROR_NULL_POINTER; + return rv; + } + *aResult = NULL; + if (NULL != aOuter) + { + rv = NS_ERROR_NO_AGGREGATION; + return rv; + } + + // we need to create an object, store it in a global + // pointer and call its init method. This object is only + // instantiated in the embedding case - for the retail + // browser this is done in NS_CreateAppshell + gModuleData = new nsWidgetModuleData(); + gModuleData->Init(nsnull); + inst = (nsISupports*)gModuleData; + + if (inst == NULL) + { + return NS_ERROR_OUT_OF_MEMORY; + } + NS_ADDREF(inst); + rv = inst->QueryInterface(aIID, aResult); + NS_RELEASE(inst); + + return rv; +} + static nsresult nsHorizScrollbarConstructor (nsISupports *aOuter, REFNSIID aIID, void **aResult) { nsresult rv; @@ -186,6 +224,10 @@ static nsModuleComponentInfo components[] = NS_APPSHELL_CID, "@mozilla.org/widget/appshell/os2;1", nsAppShellConstructor }, + { "OS/2 Embedded Module Data Init", + NS_MODULEDATAOS2_CID, + "@mozilla.org/widget/widgetmoduledata/os2;1", + nsWidgetModuleDataConstructor }, { "OS/2 Bidi Keyboard", NS_BIDIKEYBOARD_CID, "@mozilla.org/widget/bidikeyboard;1", diff --git a/mozilla/widget/src/os2/nsWindow.cpp b/mozilla/widget/src/os2/nsWindow.cpp index f0816d89e9e..b99a0f3c6bb 100644 --- a/mozilla/widget/src/os2/nsWindow.cpp +++ b/mozilla/widget/src/os2/nsWindow.cpp @@ -1344,7 +1344,7 @@ NS_METHOD nsWindow::SetFont(const nsFont &aFont) { if( mToolkit) // called from print-routine (XXX check) { - const char *fontname = gModuleData.ConvertFromUcs( aFont.name); + const char *fontname = gModuleData->ConvertFromUcs( aFont.name); // jump through hoops to convert the size in the font (in app units) // into points. @@ -1433,7 +1433,7 @@ NS_METHOD nsWindow::SetCursor(nsCursor aCursor) if( sptr) mPointer = WinQuerySysPointer( HWND_DESKTOP, sptr, FALSE); else - mPointer = gModuleData.GetPointer( aCursor); + mPointer = gModuleData->GetPointer( aCursor); WinSetPointer( HWND_DESKTOP, mPointer); mCursor = aCursor; @@ -1820,7 +1820,7 @@ PRBool nsWindow::OnKey( MPARAM mp1, MPARAM mp2) inbuf[1] = '\0'; outbuf[0] = (UniChar)0; - gModuleData.ConvertToUcs( (char *)inbuf, (PRUnichar *)outbuf, 4); + gModuleData->ConvertToUcs( (char *)inbuf, (PRUnichar *)outbuf, 4); event.charCode = outbuf[0]; @@ -2610,7 +2610,7 @@ NS_METHOD nsWindow::SetTitle(const nsString& aTitle) else if( mWnd) { WinSetWindowText( GetMainWindow(), - gModuleData.ConvertFromUcs( aTitle)); + gModuleData->ConvertFromUcs( aTitle)); } return NS_OK; } @@ -2786,7 +2786,7 @@ PRBool nsWindow::OnDragOver( MPARAM mp1, MPARAM mp2, MRESULT &mr) // somehow. // Tell drag service about the drag - // gModuleData.dragService->InitDragOver( (PDRAGINFO) mp1); + // gModuleData->dragService->InitDragOver( (PDRAGINFO) mp1); // Invoke gecko for enter if appropriate // if( !mDragInside) @@ -2799,16 +2799,16 @@ PRBool nsWindow::OnDragOver( MPARAM mp1, MPARAM mp2, MRESULT &mr) // DispatchDragDropEvent( NS_DRAGDROP_OVER); // Get action back from drag service - // mr = gModuleData.dragService->TermDragOver(); + // mr = gModuleData->dragService->TermDragOver(); return PR_TRUE; } PRBool nsWindow::OnDragLeave( MPARAM mp1, MPARAM mp2) { - // gModuleData.dragService->InitDragExit( (PDRAGINFO) mp1); + // gModuleData->dragService->InitDragExit( (PDRAGINFO) mp1); // DispatchDragDropEvent( NS_DRAGDROP_EXIT); - // gModuleData.dragService->TermDragExit(); + // gModuleData->dragService->TermDragExit(); // mDragInside = FALSE; @@ -2817,9 +2817,9 @@ PRBool nsWindow::OnDragLeave( MPARAM mp1, MPARAM mp2) PRBool nsWindow::OnDrop( MPARAM mp1, MPARAM mp2) { - // gModuleData.dragService->InitDrop( (PDRAGINFO) mp1); + // gModuleData->dragService->InitDrop( (PDRAGINFO) mp1); // DispatchDragDropEvent( NS_DRAGDROP_DROP); - // gModuleData.dragService->TermDrop(); + // gModuleData->dragService->TermDrop(); mDragInside = FALSE; diff --git a/mozilla/widget/src/os2/nsdefs.h b/mozilla/widget/src/os2/nsdefs.h index b65b67f048c..260b9f3cb8e 100644 --- a/mozilla/widget/src/os2/nsdefs.h +++ b/mozilla/widget/src/os2/nsdefs.h @@ -24,9 +24,10 @@ #define NSDEFS_H #include +#include #ifdef _DEBUG - #define BREAK_TO_DEBUGGER DebugBreak() + #define BREAK_TO_DEBUGGER _interrupt(3) #else #define BREAK_TO_DEBUGGER #endif