Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Private Attributes
MessageWindow Struct Reference

List of all members.

Public Member Functions

 MessageWindow ()
HWND getHWND ()
NS_IMETHOD Create ()
NS_IMETHOD Destroy ()
NS_IMETHOD SendRequest (const char *cmd)
 MessageWindow ()
 operator HWND ()
NS_IMETHOD Create ()
NS_IMETHOD Destroy ()
NS_IMETHOD SendRequest (const char *cmd)
 MessageWindow ()
HWND getHWND ()
NS_IMETHOD Create ()
NS_IMETHOD Destroy ()
NS_IMETHOD SendRequest (const char *cmd)
 MessageWindow ()
 operator HWND ()
NS_IMETHOD Create ()
NS_IMETHOD Destroy ()
NS_IMETHOD SendRequest (const char *cmd)

Static Public Member Functions

static const char * className ()
static MRESULT EXPENTRY WindowProc (HWND msgWindow, ULONG msg, MPARAM wp, MPARAM lp)
static const char * className ()
static long CALLBACK WindowProc (HWND msgWindow, UINT msg, WPARAM wp, LPARAM lp)
static const char * className ()
static MRESULT EXPENTRY WindowProc (HWND msgWindow, ULONG msg, MPARAM wp, MPARAM lp)
static const char * className ()
static long CALLBACK WindowProc (HWND msgWindow, UINT msg, WPARAM wp, LPARAM lp)

Private Attributes

HWND mHandle
USHORT mMsgWindowAtom

Detailed Description

Definition at line 550 of file nsNativeAppSupportOS2.cpp.


Constructor & Destructor Documentation

Definition at line 552 of file nsNativeAppSupportOS2.cpp.

                    {
        // Try to find window.
        HATOMTBL  hatomtbl;
        HENUM     henum;
        HWND      hwndNext;
        char      classname[CCHMAXPATH];

        mHandle = NULLHANDLE;

        hatomtbl = WinQuerySystemAtomTable();
        mMsgWindowAtom = WinFindAtom(hatomtbl, className());
        if (mMsgWindowAtom == 0)
        {
          // If there is not atom in the system table for this class name, then
          // we can assume that the app is not currently running.
          mMsgWindowAtom = WinAddAtom(hatomtbl, className());
        } else {
          // Found an existing atom for this class name.  Cycle through existing
          // windows and see if one with our window id and class name already 
          // exists
          henum = WinBeginEnumWindows(HWND_OBJECT);
          while ((hwndNext = WinGetNextWindow(henum)) != NULLHANDLE)
          {
            if (WinQueryWindowUShort(hwndNext, QWS_ID) == (USHORT)mMsgWindowAtom)
            {
              WinQueryClassName(hwndNext, CCHMAXPATH, classname);
              if (strcmp(classname, className()) == 0)
              {
                mHandle = hwndNext;
                break;
              }
            }
          }
        }
    }

Here is the call graph for this function:

Definition at line 494 of file nsNativeAppSupportWin.cpp.

                    {
        // Try to find window.
        mHandle = ::FindWindow( className(), 0 );
    }

Here is the call graph for this function:

Definition at line 988 of file nsNativeAppSupportOS2.cpp.

                    {
        // Try to find window.
        HATOMTBL  hatomtbl;
        HENUM     henum;
        HWND      hwndNext;
        char      classname[CCHMAXPATH];

        mHandle = NULLHANDLE;

        hatomtbl = WinQuerySystemAtomTable();
        mMsgWindowAtom = WinFindAtom(hatomtbl, className());
        if (mMsgWindowAtom == 0)
        {
          // If there is not atom in the system table for this class name, then
          // we can assume that the app is not currently running.
          mMsgWindowAtom = WinAddAtom(hatomtbl, className());
        } else {
          // Found an existing atom for this class name.  Cycle through existing
          // windows and see if one with our window id and class name already 
          // exists
          henum = WinBeginEnumWindows(HWND_OBJECT);
          while ((hwndNext = WinGetNextWindow(henum)) != NULLHANDLE)
          {
            if (WinQueryWindowUShort(hwndNext, QWS_ID) == (USHORT)mMsgWindowAtom)
            {
              WinQueryClassName(hwndNext, CCHMAXPATH, classname);
              if (strcmp(classname, className()) == 0)
              {
                mHandle = hwndNext;
                break;
              }
            }
          }
        }
    }

Here is the call graph for this function:

Definition at line 836 of file nsNativeAppSupportWin.cpp.

                    {
        // Try to find window.
        mHandle = ::FindWindow( className(), 0 );
    }

Here is the call graph for this function:


Member Function Documentation

static const char* MessageWindow::className ( ) [inline, static]

Definition at line 505 of file nsNativeAppSupportWin.cpp.

                                   {
        static char classNameBuffer[128];
        static char *mClassName = 0;
        if ( !mClassName ) {
            ::_snprintf( classNameBuffer,
                         sizeof classNameBuffer,
                         "%s%s",
                         gAppData->name,
                         "MessageWindow" );
            mClassName = classNameBuffer;
        }
        return mClassName;
    }
static const char* MessageWindow::className ( ) [inline, static]

Definition at line 593 of file nsNativeAppSupportOS2.cpp.

                                   {
        static char classNameBuffer[128];
        static char *mClassName = 0;
        if ( !mClassName ) { 
            sprintf( classNameBuffer,
                         "%s%s",
                         gAppData->name,
                         "MessageWindow" );
            mClassName = classNameBuffer;
        }
        return mClassName;
    }

Here is the caller graph for this function:

static const char* MessageWindow::className ( ) [inline, static]

Definition at line 847 of file nsNativeAppSupportWin.cpp.

                                   {
        static char classNameBuffer[128];
        static char *mClassName = 0;
        if ( !mClassName ) {
            ::_snprintf( classNameBuffer,
                         sizeof classNameBuffer,
                         "%s%s",
                         nsNativeAppSupportWin::mAppName,
                         "MessageWindow" );
            mClassName = classNameBuffer;
        }
        return mClassName;
    }
static const char* MessageWindow::className ( ) [inline, static]

Definition at line 1029 of file nsNativeAppSupportOS2.cpp.

                                   {
        static char classNameBuffer[128];
        static char *mClassName = 0;
        if ( !mClassName ) { 
            sprintf( classNameBuffer,
                         "%s%s",
                         nsNativeAppSupportOS2::mAppName,
                         "MessageWindow" );
            mClassName = classNameBuffer;
        }
        return mClassName;
    }

Definition at line 520 of file nsNativeAppSupportWin.cpp.

                        {
        WNDCLASS classStruct = { 0,                          // style
                                 &MessageWindow::WindowProc, // lpfnWndProc
                                 0,                          // cbClsExtra
                                 0,                          // cbWndExtra
                                 0,                          // hInstance
                                 0,                          // hIcon
                                 0,                          // hCursor
                                 0,                          // hbrBackground
                                 0,                          // lpszMenuName
                                 className() };              // lpszClassName

        // Register the window class.
        NS_ENSURE_TRUE( ::RegisterClass( &classStruct ), NS_ERROR_FAILURE );

        // Create the window.
        NS_ENSURE_TRUE( ( mHandle = ::CreateWindow( className(),
                                                    0,          // title
                                                    WS_CAPTION, // style
                                                    0,0,0,0,    // x, y, cx, cy
                                                    0,          // parent
                                                    0,          // menu
                                                    0,          // instance
                                                    0 ) ),      // create struct
                        NS_ERROR_FAILURE );

#if MOZ_DEBUG_DDE
        printf( "Message window = 0x%08X\n", (int)mHandle );
#endif

        return NS_OK;
    }

Here is the call graph for this function:

Definition at line 607 of file nsNativeAppSupportOS2.cpp.

                        {

        // Register the window class.
        NS_ENSURE_TRUE( WinRegisterClass( 0, className(), 
                                          (PFNWP)&MessageWindow::WindowProc, 
                                          0L, 0 ), 
                        NS_ERROR_FAILURE );

        /* Giving a size but offscreen so that won't be seen, even if all
         * goes wrong.  Giving a size so that can be seen and understood by
         * tools
         */
        const char * pszClassName = className();
        mHandle = WinCreateWindow( HWND_OBJECT,
                                   pszClassName,
                                   NULL,        // name
                                   WS_DISABLED, // style
                                   0,0,     // x, y
                                   0,0,       // cx,cy
                                   HWND_DESKTOP,// owner
                                   HWND_BOTTOM,  // hwndbehind
                                   (USHORT)mMsgWindowAtom, // id
                                   NULL,        // pCtlData
                                   NULL );      // pres params

#if MOZ_DEBUG_DDE
        printf( "Message window = 0x%08X\n", (int)mHandle );
#endif

        return NS_OK;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 862 of file nsNativeAppSupportWin.cpp.

                        {
        WNDCLASS classStruct = { 0,                          // style
                                 &MessageWindow::WindowProc, // lpfnWndProc
                                 0,                          // cbClsExtra
                                 0,                          // cbWndExtra
                                 0,                          // hInstance
                                 0,                          // hIcon
                                 0,                          // hCursor
                                 0,                          // hbrBackground
                                 0,                          // lpszMenuName
                                 className() };              // lpszClassName

        // Register the window class.
        NS_ENSURE_TRUE( ::RegisterClass( &classStruct ), NS_ERROR_FAILURE );

        // Create the window.
        NS_ENSURE_TRUE( ( mHandle = ::CreateWindow( className(),
                                                    0,          // title
                                                    WS_CAPTION, // style
                                                    0,0,0,0,    // x, y, cx, cy
                                                    0,          // parent
                                                    0,          // menu
                                                    0,          // instance
                                                    0 ) ),      // create struct
                        NS_ERROR_FAILURE );

#if MOZ_DEBUG_DDE
        printf( "Message window = 0x%08X\n", (int)mHandle );
#endif

        return NS_OK;
    }

Here is the call graph for this function:

Definition at line 1043 of file nsNativeAppSupportOS2.cpp.

                        {

        // Register the window class.
        NS_ENSURE_TRUE( WinRegisterClass( 0, className(), 
                                          (PFNWP)&MessageWindow::WindowProc, 
                                          0L, 0 ), 
                        NS_ERROR_FAILURE );

        /* Giving a size but offscreen so that won't be seen, even if all
         * goes wrong.  Giving a size so that can be seen and understood by
         * tools
         */
        const char * pszClassName = className();
        mHandle = WinCreateWindow( HWND_OBJECT,
                                   pszClassName,
                                   NULL,        // name
                                   WS_DISABLED, // style
                                   0,0,     // x, y
                                   0,0,       // cx,cy
                                   HWND_DESKTOP,// owner
                                   HWND_BOTTOM,  // hwndbehind
                                   (USHORT)mMsgWindowAtom, // id
                                   NULL,        // pCtlData
                                   NULL );      // pres params

#if MOZ_DEBUG_DDE
        printf( "Message window = 0x%08X\n", (int)mHandle );
#endif

        return NS_OK;
    }

Here is the call graph for this function:

Definition at line 554 of file nsNativeAppSupportWin.cpp.

                         {
        nsresult retval = NS_OK;

        if ( mHandle ) {
            // DestroyWindow can only destroy windows created from
            //  the same thread.
            BOOL desRes = DestroyWindow( mHandle );
            if ( FALSE != desRes ) {
                mHandle = NULL;
            }
            else {
                retval = NS_ERROR_FAILURE;
            }
        }

        return retval;
    }

Definition at line 640 of file nsNativeAppSupportOS2.cpp.

                         {
        nsresult retval = NS_OK;

        if ( mHandle ) {
           HATOMTBL hatomtbl = WinQuerySystemAtomTable();
           WinDeleteAtom(hatomtbl, mMsgWindowAtom);
           
            // DestroyWindow can only destroy windows created from
            //  the same thread.
            BOOL desRes = WinDestroyWindow( mHandle );
            if ( FALSE != desRes ) {
                mHandle = NULL;
            }
            else {
                retval = NS_ERROR_FAILURE;
            }
        }

        return retval;
    }

Here is the caller graph for this function:

Definition at line 896 of file nsNativeAppSupportWin.cpp.

                         {
        nsresult retval = NS_OK;

        if ( mHandle ) {
            // DestroyWindow can only destroy windows created from
            //  the same thread.
            BOOL desRes = DestroyWindow( mHandle );
            if ( FALSE != desRes ) {
                mHandle = NULL;
            }
            else {
                retval = NS_ERROR_FAILURE;
            }
        }

        return retval;
    }

Definition at line 1076 of file nsNativeAppSupportOS2.cpp.

                         {
        nsresult retval = NS_OK;

        if ( mHandle ) {
           HATOMTBL hatomtbl = WinQuerySystemAtomTable();
           WinDeleteAtom(hatomtbl, mMsgWindowAtom);
           
            // DestroyWindow can only destroy windows created from
            //  the same thread.
            BOOL desRes = WinDestroyWindow( mHandle );
            if ( FALSE != desRes ) {
                mHandle = NULL;
            }
            else {
                retval = NS_ERROR_FAILURE;
            }
        }

        return retval;
    }

Definition at line 588 of file nsNativeAppSupportOS2.cpp.

                   {
        return mHandle;
    }

Here is the caller graph for this function:

Definition at line 1024 of file nsNativeAppSupportOS2.cpp.

                   {
        return mHandle;
    }
MessageWindow::operator HWND ( ) [inline]

Definition at line 500 of file nsNativeAppSupportWin.cpp.

                    {
        return mHandle;
    }
MessageWindow::operator HWND ( ) [inline]

Definition at line 842 of file nsNativeAppSupportWin.cpp.

                    {
        return mHandle;
    }
NS_IMETHOD MessageWindow::SendRequest ( const char *  cmd) [inline]

Definition at line 573 of file nsNativeAppSupportWin.cpp.

                                              {
        // Construct a data buffer <commandline>\0<workingdir>\0
        int cmdlen = strlen(cmd);
        char* cmdbuf = (char*) malloc(cmdlen + MAX_PATH + 1);
        if (!cmdbuf)
            return NS_ERROR_OUT_OF_MEMORY;

        strcpy(cmdbuf, cmd);
        _getcwd(cmdbuf + cmdlen + 1, MAX_PATH);

        // We used to set dwData to zero, when we didn't send the working dir.
        // Now we're using it as a version number.
        COPYDATASTRUCT cds = {
            1,
            cmdlen + strlen(cmdbuf + cmdlen + 1) + 2,
            (void*) cmdbuf
        };
        // Bring the already running Mozilla process to the foreground.
        // nsWindow will restore the window (if minimized) and raise it.
        ::SetForegroundWindow( mHandle );
        ::SendMessage( mHandle, WM_COPYDATA, 0, (LPARAM)&cds );
        free (cmdbuf);
        return NS_OK;
    }
NS_IMETHOD MessageWindow::SendRequest ( const char *  cmd) [inline]

Definition at line 664 of file nsNativeAppSupportOS2.cpp.

    {
    /* Nothing like WM_COPYDATA in OS/2, where the OS allows pointers to be
     * passed to a different process and automatically accessible by that
     * process.  So we have to create shared mem on our side and then the
     * process that gets the WM_COPYDATA message has to do a 
     * DosGetSharedMem on this pointer to be able to access the data
    */

        COPYDATASTRUCT *pcds;
        PVOID pvData = NULL;

        if (!cmd)
            return NS_ERROR_FAILURE;

        ULONG ulSize = sizeof(COPYDATASTRUCT)+strlen(cmd)+1+CCHMAXPATH;
        if (DosAllocSharedMem( &pvData, NULL, ulSize,
                               (PAG_COMMIT|PAG_READ|PAG_WRITE|OBJ_GETTABLE)))
            return NS_ERROR_OUT_OF_MEMORY;

        // We used to set dwData to zero, when we didn't send the
        // working dir.  Now we're using it as a version number.
        // The commandline goes in the buffer space immediately after
        // the COPYDATASTRUCT;  the current directory follows that.
        pcds = (COPYDATASTRUCT *)(pvData);
        pcds->dwData = 1;

        char * ptr = &(pcds->chBuff);
        pcds->lpData = ptr;
        strcpy( ptr, cmd);
        pcds->cbData = strlen( ptr) + 1;
        ptr += pcds->cbData;

        if (DosQueryPathInfo( ".", FIL_QUERYFULLNAME, ptr, CCHMAXPATH)) {
            ptr[0] = '.';
            ptr[1] = '\0';
        }
        pcds->cbData += strlen( ptr) + 1;

        WinSendMsg( mHandle, WM_COPYDATA, 0, (MPARAM)pcds );
        DosFreeMem( pvData );

        return NS_OK;
    }

Here is the caller graph for this function:

NS_IMETHOD MessageWindow::SendRequest ( const char *  cmd) [inline]

Definition at line 915 of file nsNativeAppSupportWin.cpp.

                                              {
        COPYDATASTRUCT cds = { 0, ::strlen( cmd ) + 1, (void*)cmd };
        // Bring the already running Mozilla process to the foreground.
        // nsWindow will restore the window (if minimized) and raise it.
        ::SetForegroundWindow( mHandle );
        ::SendMessage( mHandle, WM_COPYDATA, 0, (LPARAM)&cds );
        return NS_OK;
    }
NS_IMETHOD MessageWindow::SendRequest ( const char *  cmd) [inline]

Definition at line 1098 of file nsNativeAppSupportOS2.cpp.

                                              {
        /* Nothing like WM_COPYDATA in OS/2, where the OS allows pointers to be
         * passed to a different process and automatically accessible by that
         * process.  So we have to create shared mem on our side and then the
         * process that gets the WM_COPYDATA message has to do a 
         * DosGetSharedMem on this pointer to be able to access the data
         */

        COPYDATASTRUCT *pcds;
        APIRET rc = NO_ERROR;
        PVOID pvData = NULL;
        ULONG ulSize = sizeof(COPYDATASTRUCT)+strlen(cmd)+1;
        rc = DosAllocSharedMem( &pvData, NULL, ulSize,
                                (PAG_COMMIT|PAG_READ|PAG_WRITE|OBJ_GETTABLE) );

        if( rc != NO_ERROR )
        {
           /* don't even try doing anything else.  Windows doesn't worry about
            * errors so I guess that we shouldn't either
            */
           return NS_OK;
        }

        memset( pvData, '\0', ulSize );
        pcds = (COPYDATASTRUCT *)(pvData);
        pcds->dwData = 0;
        pcds->cbData = strlen(cmd)+1;
        /* put the data in the buffer space immediately after the 
         * COPYDATASTRUCT
         */
        pcds->lpData = &(pcds->chBuff);
        if( cmd )
        {
           strcpy( (char *)pcds->lpData, cmd );
        }
        WinSendMsg( mHandle, WM_COPYDATA, 0, (MPARAM)pcds );
        DosFreeMem( pvData );

        return NS_OK;
    }

Here is the call graph for this function:

static long CALLBACK MessageWindow::WindowProc ( HWND  msgWindow,
UINT  msg,
WPARAM  wp,
LPARAM  lp 
) [inline, static]

Definition at line 599 of file nsNativeAppSupportWin.cpp.

                                                                                      {
        if ( msg == WM_COPYDATA ) {
            if (!nsNativeAppSupportWin::mCanHandleRequests)
                return 0;

            // This is an incoming request.
            COPYDATASTRUCT *cds = (COPYDATASTRUCT*)lp;
#if MOZ_DEBUG_DDE
            printf( "Incoming request: %s\n", (const char*)cds->lpData );
#endif
            nsCOMPtr<nsILocalFile> workingDir;

            if (1 >= cds->dwData) {
                char* wdpath = (char*) cds->lpData;
                // skip the command line, and get the working dir of the
                // other process, which is after the first null char
                while (*wdpath)
                    ++wdpath;

                ++wdpath;

#ifdef MOZ_DEBUG_DDE
                printf( "Working dir: %s\n", wdpath);
#endif

                NS_NewNativeLocalFile(nsDependentCString(wdpath),
                                      PR_FALSE,
                                      getter_AddRefs(workingDir));
            }
            (void)nsNativeAppSupportWin::HandleCommandLine((char*)cds->lpData, workingDir, nsICommandLine::STATE_REMOTE_AUTO);

            // Get current window and return its window handle.
            nsCOMPtr<nsIDOMWindowInternal> win;
            GetMostRecentWindow( 0, getter_AddRefs( win ) );
            return win ? (long)hwndForDOMWindow( win ) : 0;
        } else if ( msg == WM_QUERYENDSESSION ) {
            if (!nsNativeAppSupportWin::mCanHandleRequests)
                return 0;
            // Invoke "-killAll" cmd line handler.  That will close all open windows,
            // and display dialog asking whether to save/don't save/cancel.  If the
            // user says cancel, then we pass that indicator along to the system
            // in order to stop the system shutdown/logoff.
            nsCOMPtr<nsICommandLineRunner> cmdLine
                (do_CreateInstance("@mozilla.org/toolkit/command-line;1"));
            char* argv[] = { "-killAll", 0 };
            if (cmdLine &&
                NS_SUCCEEDED(cmdLine->Init(1, argv, nsnull,
                                           nsICommandLine::STATE_REMOTE_AUTO))) {
                return cmdLine->Run() != NS_ERROR_ABORT;
            }
        }
        return DefWindowProc( msgWindow, msg, wp, lp );
    }

Here is the call graph for this function:

static MRESULT EXPENTRY MessageWindow::WindowProc ( HWND  msgWindow,
ULONG  msg,
MPARAM  wp,
MPARAM  lp 
) [inline, static]

Definition at line 711 of file nsNativeAppSupportOS2.cpp.

    {
        // We have to return a FALSE from WM_CREATE
        if ( msg == WM_CREATE )
            return (MRESULT)FALSE;

        if ( msg != WM_COPYDATA ) 
            return (MRESULT)TRUE;

        // This is an incoming request.
        COPYDATASTRUCT *cds = (COPYDATASTRUCT*)lp;
        DosGetSharedMem( (PVOID)cds, PAG_READ|PAG_WRITE );

        nsCOMPtr<nsILocalFile> workingDir;

        // a "1" or greater indicates that the other process's working
        // directory follows the commandline string - locate & convert it
        if (cds->dwData >= 1) {
            char* wdpath = strchr( (char*)cds->lpData, 0) + 1;
            NS_NewNativeLocalFile(nsDependentCString(wdpath),
                                  PR_FALSE, getter_AddRefs(workingDir));
        }

        nsNativeAppSupportOS2::HandleCommandLine((char*)cds->lpData,
                                workingDir, nsICommandLine::STATE_REMOTE_AUTO);

        return (MRESULT)TRUE;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

static long CALLBACK MessageWindow::WindowProc ( HWND  msgWindow,
UINT  msg,
WPARAM  wp,
LPARAM  lp 
) [inline, static]

Definition at line 925 of file nsNativeAppSupportWin.cpp.

                                                                                      {
        if ( msg == WM_COPYDATA ) {
            // This is an incoming request.
            COPYDATASTRUCT *cds = (COPYDATASTRUCT*)lp;
#if MOZ_DEBUG_DDE
            printf( "Incoming request: %s\n", (const char*)cds->lpData );
#endif
            // Get current window and return its window handle.
            nsCOMPtr<nsIDOMWindow> win;
            (void)nsNativeAppSupportWin::HandleRequest( (LPBYTE)cds->lpData, PR_FALSE, getter_AddRefs( win ) );
            return win ? (long)hwndForDOMWindow( win ) : 0;
#ifndef MOZ_PHOENIX
 } else if ( msg == WM_USER ) {
     if ( lp == WM_RBUTTONUP ) {
         // Show menu with Exit disabled/enabled appropriately.
         nsCOMPtr<nsIDOMWindowInternal> win;
         GetMostRecentWindow( 0, getter_AddRefs( win ) );
         ::EnableMenuItem( nsNativeAppSupportWin::mTrayIconMenu, TURBO_EXIT, win ? MF_GRAYED : MF_ENABLED );
         POINT pt;
         GetCursorPos( &pt );

         SetForegroundWindow(msgWindow);
         int selectedItem = ::TrackPopupMenu( nsNativeAppSupportWin::mTrayIconMenu,
                                              TPM_NONOTIFY | TPM_RETURNCMD |
                                              TPM_RIGHTBUTTON,
                                              pt.x,
                                              pt.y,
                                              0,
                                              msgWindow,
                                              0 );

         nsCOMPtr<nsIDOMWindow> newWin;
         switch (selectedItem) {
         case TURBO_NAVIGATOR:
             (void)nsNativeAppSupportWin::HandleRequest( (LPBYTE)(NS_STRINGIFY(MOZ_APP_NAME) " -browser"), PR_TRUE, getter_AddRefs( newWin ) );
             break;
         case TURBO_MAIL:
             (void)nsNativeAppSupportWin::HandleRequest( (LPBYTE)(NS_STRINGIFY(MOZ_APP_NAME) " -mail"), PR_TRUE, getter_AddRefs( newWin ) );
              break;
         case TURBO_EDITOR:
             (void)nsNativeAppSupportWin::HandleRequest( (LPBYTE)(NS_STRINGIFY(MOZ_APP_NAME) " -editor"), PR_TRUE, getter_AddRefs( newWin ) );
             break;
         case TURBO_ADDRESSBOOK:
             (void)nsNativeAppSupportWin::HandleRequest( (LPBYTE)(NS_STRINGIFY(MOZ_APP_NAME) " -addressbook"), PR_TRUE, getter_AddRefs( newWin ) );
             break;
         case TURBO_EXIT:
             (void)nsNativeAppSupportWin::HandleRequest( (LPBYTE)(NS_STRINGIFY(MOZ_APP_NAME) " -kill"), PR_TRUE, getter_AddRefs( newWin ) );
             break;
         case TURBO_DISABLE:
             nsresult rv;
             nsCOMPtr<nsIStringBundleService> stringBundleService( do_GetService( NS_STRINGBUNDLE_CONTRACTID ) );
             nsCOMPtr<nsIStringBundle> turboMenuBundle;
             nsCOMPtr<nsIStringBundle> brandBundle;
             if ( stringBundleService ) {
                 stringBundleService->CreateBundle( "chrome://branding/locale/brand.properties", getter_AddRefs( brandBundle ) );
                 stringBundleService->CreateBundle( "chrome://navigator/locale/turboMenu.properties",
                                                    getter_AddRefs( turboMenuBundle ) );
             }
             nsXPIDLString dialogMsg;
             nsXPIDLString dialogTitle;
             nsXPIDLString brandName;
             if ( brandBundle && turboMenuBundle ) {
                 brandBundle->GetStringFromName( NS_LITERAL_STRING( "brandShortName" ).get(),
                                                 getter_Copies( brandName ) );
                 const PRUnichar *formatStrings[] = { brandName.get() };
                 turboMenuBundle->FormatStringFromName( NS_LITERAL_STRING( "DisableDlgMsg" ).get(), formatStrings,
                                                        1, getter_Copies( dialogMsg ) );
                 turboMenuBundle->FormatStringFromName( NS_LITERAL_STRING( "DisableDlgTitle" ).get(), formatStrings,
                                                        1, getter_Copies( dialogTitle ) );

             }
             if ( !dialogMsg.IsEmpty() && !dialogTitle.IsEmpty() && !brandName.IsEmpty() ) {
                 nsCOMPtr<nsIPromptService> dialog( do_GetService( NS_PROMPTSERVICE_CONTRACTID ) );
                 if ( dialog ) {
                     PRBool reallyDisable;
                     nsNativeAppSupportWin::mLastWindowIsConfirmation = PR_TRUE;
                     dialog->Confirm( nsnull, dialogTitle.get(), dialogMsg.get(), &reallyDisable );
                     if ( !reallyDisable ) {
                          break;
                     }
                 }

             }
             nsCOMPtr<nsIWindowsHooks> winHooksService ( do_GetService( NS_IWINDOWSHOOKS_CONTRACTID, &rv ) );
             if ( NS_SUCCEEDED( rv ) )
                 winHooksService->StartupRemoveOption("-turbo");

             nsCOMPtr<nsIAppStartup> appStartup
                 (do_GetService(NS_APPSTARTUP_CONTRACTID, &rv));
             if ( NS_SUCCEEDED( rv ) ) {
                 nsCOMPtr<nsINativeAppSupport> native;
                 rv = appStartup->GetNativeAppSupport( getter_AddRefs( native ) );
                 if ( NS_SUCCEEDED( rv ) )
                     native->SetIsServerMode( PR_FALSE );
                 if ( !win )
                     appStartup->Quit(nsIAppStartup::eAttemptQuit);
             }
             break;
         }
         PostMessage(msgWindow, WM_NULL, 0, 0);
     } else if ( lp == WM_LBUTTONDBLCLK ) {
         // Dbl-click will open nav/mailnews/composer based on prefs
         // (if no windows are open), or, open nav (if some windows are
         // already open).  That's done in HandleRequest.
         nsCOMPtr<nsIDOMWindow> win;
         (void)nsNativeAppSupportWin::HandleRequest( (LPBYTE)NS_STRINGIFY(MOZ_APP_NAME), PR_TRUE, getter_AddRefs( win ) );
     }
     return TRUE;
#endif
  } else if ( msg == WM_QUERYENDSESSION ) {
    // Invoke "-killAll" cmd line handler.  That will close all open windows,
    // and display dialog asking whether to save/don't save/cancel.  If the
    // user says cancel, then we pass that indicator along to the system
    // in order to stop the system shutdown/logoff.
    nsCOMPtr<nsICmdLineHandler>
        killAll( do_CreateInstance( "@mozilla.org/commandlinehandler/general-startup;1?type=killAll" ) );
    if ( killAll ) {
        nsXPIDLCString unused;
        // Note: "GetChromeUrlForTask" is a euphemism for
        //       "ProcessYourCommandLineSwitch".  The interface was written
        //       presuming a less general-purpose role for command line
        //       handlers than it ought to have.
        nsresult rv = killAll->GetChromeUrlForTask( getter_Copies( unused ) );
        if ( rv == NS_ERROR_ABORT ) {
            // User cancelled shutdown/logoff.
            return FALSE;
        } else {
            // Shutdown/logoff OK.
            return TRUE;
        }
    }
  } else if ((nsNativeAppSupportWin::mTrayRestart) && (msg == nsNativeAppSupportWin::mTrayRestart)) {
     //Re-add the icon. The taskbar must have been destroyed and recreated
     ::Shell_NotifyIcon( NIM_ADD, &nsNativeAppSupportWin::mIconData );
  }
  return DefWindowProc( msgWindow, msg, wp, lp );
}

Here is the call graph for this function:

static MRESULT EXPENTRY MessageWindow::WindowProc ( HWND  msgWindow,
ULONG  msg,
MPARAM  wp,
MPARAM  lp 
) [inline, static]

Definition at line 1140 of file nsNativeAppSupportOS2.cpp.

    {
        MRESULT rc = (MRESULT)TRUE;

        if ( msg == WM_COPYDATA ) {
            // This is an incoming request.
            COPYDATASTRUCT *cds = (COPYDATASTRUCT*)lp;
            DosGetSharedMem( (PVOID)cds, PAG_READ|PAG_WRITE );
#if MOZ_DEBUG_DDE
            printf( "Incoming request: %s\n", (const char*)cds->lpData );
#endif
            // Get current window and return its window handle.
            nsCOMPtr<nsIDOMWindow> win;
            (void)nsNativeAppSupportOS2::HandleRequest( (LPBYTE)cds->lpData, PR_FALSE, getter_AddRefs( win ) );
            return win ? (MRESULT)hwndForDOMWindow( win ) : 0;
 }

    /* We have to return a FALSE from WM_CREATE or this window will never
     * get off of the ground
     */
    else if ( msg == WM_CREATE ) {
        rc = (MRESULT)FALSE;
    }

    return rc;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 741 of file nsNativeAppSupportOS2.cpp.

Definition at line 742 of file nsNativeAppSupportOS2.cpp.


The documentation for this struct was generated from the following files: