Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
nsToolkit Class Reference

Wrapper around the thread running the message pump. More...

#include <nsToolkit.h>

Inheritance diagram for nsToolkit:
Inheritance graph
[legend]
Collaboration diagram for nsToolkit:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS nsToolkit ()
NS_IMETHOD Init (PRThread *aThread)
void CallMethod (MethodInfo *info)
void CallMethodAsync (MethodInfo *info)
PRBool IsGuiThread (void)
PRThreadGetGuiThread (void)
void Kill ()
 nsToolkit ()
virtual ~nsToolkit ()
 nsToolkit ()
virtual ~nsToolkit ()
NS_DECL_ISUPPORTS NS_IMETHOD Init (PRThread *aThread)
void CreateSharedGC (void)
GdkGC * GetSharedGC (void)
 nsToolkit ()
virtual ~nsToolkit ()
NS_DECL_ISUPPORTS NS_IMETHOD Init (PRThread *aThread)
void CreateSharedGC (void)
GdkGC * GetSharedGC (void)
 nsToolkit ()
virtual ~nsToolkit ()
NS_DECL_ISUPPORTS nsToolkit ()
NS_IMETHOD Init (PRThread *aThread)
void CallMethod (MethodInfo *info)
MRESULT SendMsg (HWND hwnd, ULONG msg, MPARAM mp1=0, MPARAM mp2=0)
PRBool IsGuiThread (void)
PRThreadGetGuiThread (void)
HWND GetDispatchWindow (void)
void CreateInternalWindow (PRThread *aThread)
 nsToolkit ()
virtual ~nsToolkit ()
NS_DECL_ISUPPORTS NS_IMETHOD Init (PRThread *aThread)
 nsToolkit ()
virtual ~nsToolkit ()
NS_DECL_ISUPPORTS NS_IMETHOD Init (PRThread *aThread)
NS_DECL_ISUPPORTS nsToolkit ()
NS_IMETHOD Init (PRThread *aThread)
void CallMethod (MethodInfo *info)
PRBool IsGuiThread (void)
PRThreadGetGuiThread (void)
HWND GetDispatchWindow (void)
void CreateInternalWindow (PRThread *aThread)
PRBool UserIsMovingWindow (void)
nsIEventQueueGetEventQueue (void)
 nsToolkit ()
virtual ~nsToolkit ()
NS_DECL_ISUPPORTS NS_IMETHOD Init (PRThread *aThread)
xGCGetSharedGC ()
void Init (in PRThread aThread)
 Initialize this toolkit with aThread.

Static Public Member Functions

static void GetWindowEventSink (WindowPtr aWindow, nsIEventSink **outSink)
static void GetTopWidget (WindowPtr aWindow, nsIWidget **outWidget)
static nsIViewGetViewFor (nsIWidget *aWidget)
static nsIDocumentGetDocumentFor (nsIWidget *aWidget)
static long OSXVersion ()
static nsIViewGetViewFor (nsIWidget *aWidget)
static LRESULT CALLBACK WindowProc (HWND hWnd, UINT Msg, WPARAM WParam, LPARAM lParam)
static void Startup (HINSTANCE hModule)
static void Shutdown ()
NS_DECL_ISUPPORTS static
NS_DECL_NSITOOLKIT void 
PostSleepWakeNotification (const char *aNotification)

Static Public Attributes

static HINSTANCE mDllInstance = 0
static PRBool mIsNT = PR_FALSE
static PRBool mIsWinXP = PR_FALSE
static PRBool mUseImeApiW = PR_FALSE
static PRBool mW2KXP_CP936 = PR_FALSE
static IActiveIMMApp * gAIMMApp = NULL
static PRInt32 gAIMMCount = 0
static HMODULE mShell32Module = NULL
static NS_DefWindowProc mDefWindowProc = DefWindowProcA
static NS_CallWindowProc mCallWindowProc = CallWindowProcA
static NS_SetWindowLong mSetWindowLong = SetWindowLongA
static NS_GetWindowLong mGetWindowLong = GetWindowLongA
static NS_SendMessage mSendMessage = nsSendMessage
static NS_DispatchMessage mDispatchMessage = DispatchMessageA
static NS_GetMessage mGetMessage = GetMessageA
static NS_PeekMessage mPeekMessage = PeekMessageA
static NS_GetOpenFileName mGetOpenFileName = nsGetOpenFileName
static NS_GetSaveFileName mGetSaveFileName = nsGetSaveFileName
static NS_GetClassName mGetClassName = nsGetClassName
static NS_CreateWindowEx mCreateWindowEx = nsCreateWindowEx
static NS_RegisterClass mRegisterClass = nsRegisterClass
static NS_UnregisterClass mUnregisterClass = nsUnregisterClass
static NS_DragQueryFile mDragQueryFile = nsDragQueryFile
static NS_SHGetPathFromIDList mSHGetPathFromIDList = nsSHGetPathFromIDList
static NS_SHBrowseForFolder mSHBrowseForFolder = nsSHBrowseForFolder

Protected Member Functions

void GetInterface ()
virtual nsresult InitEventQueue (PRThread *aThread)
virtual nsresult InitEventQueue (PRThread *aThread)
nsresult RegisterForSleepWakeNotifcations ()
void RemoveSleepWakeNotifcations ()

Static Protected Member Functions

static void RunPump (void *arg)
static int QuartzChangedCallback (const char *pref, void *data)
static void SetupQuartzRendering ()

Protected Attributes

PRThreadmGuiThread
bool cached
bool localthread
port_id eventport
HWND mDispatchWnd
PRMonitormMonitor
bool mInited
CFRunLoopSourceRef mSleepWakeNotificationRLS
io_object_t mPowerNotifier

Private Member Functions

virtual ~nsToolkit ()
void CreateUIThread (void)
 ~nsToolkit ()
void CreateUIThread (void)
 ~nsToolkit ()
void CreateUIThread (void)
void CreateSharedGC ()

Private Attributes

GdkGC * mSharedGC
DisplaymDisplay
xGCmGC

Detailed Description

Wrapper around the thread running the message pump.

The toolkit abstraction is necessary because the message pump must execute within the same thread that created the widget under Win32.

Definition at line 54 of file nsToolkit.h.


Constructor & Destructor Documentation

Definition at line 129 of file nsToolkit.cpp.

{
  localthread = false;
  mGuiThread  = NULL;
}
nsToolkit::~nsToolkit ( ) [private, virtual]

Definition at line 141 of file nsToolkit.cpp.

Here is the call graph for this function:

virtual nsToolkit::~nsToolkit ( ) [virtual]
virtual nsToolkit::~nsToolkit ( ) [virtual]
virtual nsToolkit::~nsToolkit ( ) [virtual]
virtual nsToolkit::~nsToolkit ( ) [virtual]
nsToolkit::~nsToolkit ( ) [private]
virtual nsToolkit::~nsToolkit ( ) [virtual]
virtual nsToolkit::~nsToolkit ( ) [virtual]
nsToolkit::~nsToolkit ( ) [private]
virtual nsToolkit::~nsToolkit ( ) [virtual]

Member Function Documentation

void nsToolkit::CallMethod ( MethodInfo info) [inline]

Definition at line 240 of file nsToolkit.cpp.

{
  ThreadInterfaceData id;

  GetInterface();

  id.data = info;
  id.waitingThread = find_thread(NULL);
  if(write_port(eventport, WM_CALLMETHOD, &id, sizeof(id)) == B_OK)
  {
    // semantics for CallMethod are that it should be synchronous
    suspend_thread(id.waitingThread);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 256 of file nsToolkit.cpp.

{
  ThreadInterfaceData id;

  GetInterface();

  id.data = info;
  id.waitingThread = 0;
       
  // Check message count to not exceed the port's capacity.
  // There seems to be a BeOS bug that allows more 
  // messages on a port than its capacity.
  port_info portinfo;
  if (get_port_info(eventport, &portinfo) != B_OK)
  {
    return;
  }
  
  if (port_count(eventport) < portinfo.capacity - 20) 
  {
    write_port_etc(eventport, WM_CALLMETHOD, &id, sizeof(id), B_TIMEOUT, 0);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 123 of file nsToolkit.cpp.

{
    
    NS_PRECONDITION(aThread, "null thread");
    mGuiThread  = aThread;

    //
    // create the internal window
    //
    WinRegisterClass((HAB)0, "nsToolkitClass", nsToolkitWindowProc, NULL, 0);
    mDispatchWnd = ::WinCreateWindow(HWND_DESKTOP,
                                     "nsToolkitClass",
                                     "NetscapeDispatchWnd",
                                     WS_DISABLED,
                                     -50, -50,
                                     10, 10,
                                     HWND_DESKTOP,
                                     HWND_BOTTOM,
                                     0, 0, 0);
    VERIFY(mDispatchWnd);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 80 of file nsToolkit.cpp.

{
  GdkPixmap *pixmap;

  if (mSharedGC)
    return;

  pixmap = gdk_pixmap_new(NULL, 1, 1, gdk_rgb_get_visual()->depth);
  mSharedGC = gdk_gc_new(pixmap);
  gdk_pixmap_unref(pixmap);
}

Definition at line 163 of file nsToolkit.cpp.

{
  PRMonitor *monitor = ::PR_NewMonitor();
       
  PR_EnterMonitor(monitor);
       
  ThreadInitInfo *ti = new ThreadInitInfo();
  if (ti)
  {
    ti->monitor = monitor;
    ti->toolkit = this;
  
    // create a gui thread
    mGuiThread = PR_CreateThread(PR_SYSTEM_THREAD,
                                   RunPump,
                                   (void*)ti,
                                   PR_PRIORITY_HIGH,
                                   PR_LOCAL_THREAD,
                                   PR_UNJOINABLE_THREAD,
                                   0);

    // wait for the gui thread to start
    while(gThreadState == PR_FALSE)
    {
      PR_Wait(monitor, PR_INTERVAL_NO_TIMEOUT);
    }
  }
    
  // at this point the thread is running
  PR_ExitMonitor(monitor);
  PR_DestroyMonitor(monitor);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 71 of file nsToolkit.h.

{ return mDispatchWnd; }

Definition at line 81 of file nsToolkit.h.

{ return mDispatchWnd; }
nsIDocument * nsToolkit::GetDocumentFor ( nsIWidget aWidget) [static]

Definition at line 158 of file nsToolkit.cpp.

{
  if (!aWidget)
    return nsnull;
  nsIFrame *frame = nsnull;
  nsIContent *content = nsnull;
  nsIDocument *document = nsnull;
  nsIView *view = nsToolkit::GetViewFor(aWidget);
  if (view)
    frame = NS_STATIC_CAST(nsIFrame*, view->GetClientData());
  if (frame)
    content = frame->GetContent();
  if (content)
    document = content->GetCurrentDoc();
  if (document)
    return document;
  nsIWidget *widgetChild = aWidget->GetFirstChild();
  while (widgetChild) {
    if ((document = GetDocumentFor(widgetChild)) != nsnull)
      return document;
    widgetChild = widgetChild->GetNextSibling();
  }
  return nsnull;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 720 of file nsToolkit.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 65 of file nsToolkit.h.

{ return mGuiThread;   }

Definition at line 70 of file nsToolkit.h.

{ return mGuiThread;   }

Definition at line 80 of file nsToolkit.h.

{ return mGuiThread;   }
void nsToolkit::GetInterface ( ) [protected]

Definition at line 225 of file nsToolkit.cpp.

{
  if(! cached)
  {
    char portname[64];

    PR_snprintf(portname, sizeof(portname), "event%lx", 
                (long unsigned) mGuiThread);

    eventport = find_port(portname);

    cached = true;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 92 of file nsToolkit.cpp.

{
  return gdk_gc_ref(mSharedGC);
}

Here is the call graph for this function:

void nsToolkit::GetTopWidget ( WindowPtr  aWindow,
nsIWidget **  outWidget 
) [static]

Definition at line 106 of file nsToolkit.cpp.

{
  nsIWidget* topLevelWidget = nsnull;
  ::GetWindowProperty ( aWindow,
      kTopLevelWidgetPropertyCreator, kTopLevelWidgetRefPropertyTag,
      sizeof(nsIWidget*), nsnull, (void*)&topLevelWidget);
  if ( topLevelWidget ) {
    *outWidget = topLevelWidget;
    NS_ADDREF(*outWidget);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static nsIView* nsToolkit::GetViewFor ( nsIWidget aWidget) [static]
nsIView * nsToolkit::GetViewFor ( nsIWidget aWidget) [static]

Definition at line 141 of file nsToolkit.cpp.

{
  if (!aWidget)
    return nsnull;
  nsIView *retval = nsnull;
  nsISupports *data = nsnull;
  aWidget->GetClientData((void*&)data);
  nsCOMPtr<nsIInterfaceRequestor> req(do_QueryInterface(data));
  if (req)
    req->GetInterface(NS_GET_IID(nsIView), (void**) &retval);
  return retval;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsToolkit::GetWindowEventSink ( WindowPtr  aWindow,
nsIEventSink **  outSink 
) [static]

Definition at line 126 of file nsToolkit.cpp.

{
  *outSink = nsnull;
  
  nsCOMPtr<nsIWidget> topWidget;
  GetTopWidget ( aWindow, getter_AddRefs(topWidget) );
  nsCOMPtr<nsIEventSink> sink ( do_QueryInterface(topWidget) );
  if ( sink ) {
    *outSink = sink;
    NS_ADDREF(*outSink);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIToolkit::Init ( in PRThread  aThread) [inherited]

Initialize this toolkit with aThread.

Parameters:
aThreadThe thread passed in runs the message pump. NULL can be passed in, in which case a new thread gets created and a message pump will run in that thread

Here is the caller graph for this function:

Definition at line 201 of file nsToolkit.cpp.

{
  Kill();

  // Store the thread ID of the thread containing the message pump.  
  // If no thread is provided create one
  if (NULL != aThread) 
  {
    mGuiThread = aThread;
    localthread = false;
  } 
  else 
  {
    localthread = true;

    // create a thread where the message pump will run
    CreateUIThread();
  }

  cached = false;

  return NS_OK;
}

Here is the call graph for this function:

nsresult nsToolkit::InitEventQueue ( PRThread aThread) [protected, virtual]

Implements nsToolkitBase.

Definition at line 73 of file nsToolkit.mm.

{
  // nothing to do
  return NS_OK;
}
virtual nsresult nsToolkit::InitEventQueue ( PRThread aThread) [protected, virtual]

Implements nsToolkitBase.

Definition at line 64 of file nsToolkit.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 69 of file nsToolkit.h.

Here is the call graph for this function:

Definition at line 79 of file nsToolkit.h.

Here is the call graph for this function:

Definition at line 147 of file nsToolkit.cpp.

{
  if(localthread)
  {
    GetInterface();

    // interrupt message flow
    close_port(eventport);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 85 of file nsToolkit.cpp.

{
  static long gOSXVersion = 0x0;
  if (gOSXVersion == 0x0) {
    OSErr err = ::Gestalt(gestaltSystemVersion, &gOSXVersion);
    if (err != noErr) {
      NS_ERROR("Couldn't determine OS X version, assume 10.0");
      gOSXVersion = MAC_OS_X_VERSION_10_0_HEX;
    }
  }
  return gOSXVersion;
}

Here is the caller graph for this function:

void nsToolkitBase::PostSleepWakeNotification ( const char *  aNotification) [static, inherited]

Definition at line 200 of file nsToolkitBase.cpp.

{
  nsCOMPtr<nsIObserverService> observerService = do_GetService("@mozilla.org/observer-service;1");
  if (observerService)
  {
    observerService->NotifyObservers(nsnull, aNotification, nsnull);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int nsToolkitBase::QuartzChangedCallback ( const char *  pref,
void data 
) [static, protected, inherited]

Definition at line 118 of file nsToolkitBase.cpp.

{
  SetupQuartzRendering();
  return NS_OK;
}

Here is the call graph for this function:

Definition at line 210 of file nsToolkitBase.cpp.

{
  IONotificationPortRef   notifyPortRef;

  NS_ASSERTION(!mSleepWakeNotificationRLS, "Already registered for sleep/wake");

  gRootPort = ::IORegisterForSystemPower(0, &notifyPortRef, ToolkitSleepWakeCallback, &mPowerNotifier);
  if (gRootPort == NULL)
  {
    NS_ASSERTION(0, "IORegisterForSystemPower failed");
    return NS_ERROR_FAILURE;
  }

  mSleepWakeNotificationRLS = ::IONotificationPortGetRunLoopSource(notifyPortRef);
  ::CFRunLoopAddSource(::CFRunLoopGetCurrent(),
                        mSleepWakeNotificationRLS,
                        kCFRunLoopDefaultMode);

  return NS_OK;
}

Here is the call graph for this function:

Definition at line 233 of file nsToolkitBase.cpp.

{
  if (mSleepWakeNotificationRLS)
  {
    ::IODeregisterForSystemPower(&mPowerNotifier);
    ::CFRunLoopRemoveSource(::CFRunLoopGetCurrent(),
                          mSleepWakeNotificationRLS,
                          kCFRunLoopDefaultMode);

    mSleepWakeNotificationRLS = nsnull;
  }
}

Here is the caller graph for this function:

void nsToolkit::RunPump ( void arg) [static, protected]

Definition at line 75 of file nsToolkit.cpp.

{
  int32              code;
  char        portname[64];
  ThreadInterfaceData id;

  ThreadInitInfo *info = (ThreadInitInfo*)arg;
  PR_EnterMonitor(info->monitor);

  gThreadState = PR_TRUE;

  PR_Notify(info->monitor);
  PR_ExitMonitor(info->monitor);

  delete info;

  // system wide unique names
  PR_snprintf(portname, sizeof(portname), "event%lx", 
              (long unsigned) PR_GetCurrentThread());

  port_id event = create_port(100, portname);

  while(read_port(event, &code, &id, sizeof(id)) >= 0)
  {
    switch(code)
    {
      case WM_CALLMETHOD :
        {
          MethodInfo *mInfo = (MethodInfo *)id.data;
          mInfo->Invoke();
          if(id.waitingThread != 0)
            resume_thread(id.waitingThread);
          delete mInfo;
        }
        break;
      case 'natv' :  // native queue PLEvent
        {
          PREventQueue *queue = (PREventQueue *)id.data;
          PR_ProcessPendingEvents(queue);
        }
        break;

      default :
        printf("nsToolkit::RunPump - UNKNOWN EVENT\n");
        break;
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

MRESULT nsToolkit::SendMsg ( HWND  hwnd,
ULONG  msg,
MPARAM  mp1 = 0,
MPARAM  mp2 = 0 
)
void nsToolkitBase::SetupQuartzRendering ( ) [static, protected, inherited]

Definition at line 130 of file nsToolkitBase.cpp.

{
  // from Apple's technote at http://developer.apple.com/qa/qa2001/qa1193.html
  enum {
    kQDDontChangeFlags = 0xFFFFFFFF,         // don't change anything
    kQDUseDefaultTextRendering = 0,          // bit 0
    kQDUseTrueTypeScalerGlyphs = (1 << 0),   // bit 1
    kQDUseCGTextRendering = (1 << 1),        // bit 2
    kQDUseCGTextMetrics = (1 << 2)
  };

  const int kFlagsWeUse = kQDUseCGTextRendering | kQDUseCGTextMetrics;

  // turn on quartz rendering if we find the symbol in the app framework. Just turn
  // on the bits that we need, don't turn off what someone else might have wanted. If
  // the pref isn't found, assume we want it on. That way, we have to explicitly put
  // in a pref to disable it, rather than force everyone who wants it to carry around
  // an extra pref.
  nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_CONTRACTID);
  if (!prefs)
    return;

  PRBool enableQuartz = PR_TRUE;
  nsresult rv = prefs->GetBoolPref(kQuartzRenderingPref, &enableQuartz);
  UInt32 oldFlags = QDSwapTextFlags(kQDDontChangeFlags);
  if (NS_FAILED(rv) || enableQuartz) {
    QDSwapTextFlags(oldFlags | kFlagsWeUse);
    
    // the system defaults to not anti-aliasing small fonts, but some people
    // think it looks better that way. If the pref is set, turn them on
    PRBool antiAliasAllFontSizes = PR_FALSE;
    rv = prefs->GetBoolPref(kAllFontSizesPref, &antiAliasAllFontSizes);
    if (NS_SUCCEEDED(rv) && antiAliasAllFontSizes)
      SetOutlinePreferred(true);
  }
  else 
    QDSwapTextFlags(oldFlags & !kFlagsWeUse);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsToolkit::Shutdown ( void  ) [static]

Definition at line 710 of file nsToolkit.cpp.

{
    if (nsToolkit::mShell32Module)
      ::FreeLibrary(nsToolkit::mShell32Module);

    //VERIFY(::UnregisterClass("nsToolkitClass", nsToolkit::mDllInstance));
    nsToolkit::mUnregisterClass(L"nsToolkitClass", nsToolkit::mDllInstance);
}

Here is the caller graph for this function:

void nsToolkit::Startup ( HINSTANCE  hModule) [static]

Definition at line 605 of file nsToolkit.cpp.

{
#ifndef WINCE
    //
    // Set flag of nsToolkit::mUseImeApiW due to using Unicode API.
    //

    OSVERSIONINFOEX osversion;
    BOOL osVersionInfoEx;
    
    ::ZeroMemory(&osversion, sizeof(OSVERSIONINFOEX));
    osversion.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);

    if (!(osVersionInfoEx = GetVersionEx((OSVERSIONINFO *)&osversion))) {
      // if OSVERSIONINFOEX doesn't work, try OSVERSIONINFO.
      osversion.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
      if (!GetVersionEx((OSVERSIONINFO *)&osversion)) {
        // maybe we are running on very old Windows OS. Assign FALSE.
        nsToolkit::mUseImeApiW = PR_FALSE; 
        return;
      }
    }

    nsToolkit::mIsNT = (osversion.dwPlatformId == VER_PLATFORM_WIN32_NT);
    if (nsToolkit::mIsNT)
#endif // #ifndef WINCE

    {
      // For Windows 9x base OS nsFoo is already pointing to A functions
      // However on NT base OS we should point them to respective W functions
      nsToolkit::mDefWindowProc = DefWindowProcW;
      nsToolkit::mCallWindowProc = CallWindowProcW;
      nsToolkit::mSetWindowLong = SetWindowLongW;
      nsToolkit::mGetWindowLong = GetWindowLongW; 
      nsToolkit::mSendMessage = SendMessageW;
      nsToolkit::mDispatchMessage = DispatchMessageW;
      nsToolkit::mGetMessage = GetMessageW;
      nsToolkit::mPeekMessage = PeekMessageW;
      nsToolkit::mGetOpenFileName = GetOpenFileNameW;
      nsToolkit::mGetSaveFileName = GetSaveFileNameW;
      nsToolkit::mGetClassName = GetClassNameW;
      nsToolkit::mCreateWindowEx = CreateWindowExW;
      nsToolkit::mRegisterClass = RegisterClassW; 
      nsToolkit::mUnregisterClass = UnregisterClassW; 
      // Explicit call of SHxxxW in Win95 makes moz fails to run (170969)
      // we use GetProcAddress() to hide
#ifndef WINCE
      nsToolkit::mDragQueryFile = DragQueryFileW;
      nsToolkit::mShell32Module = ::LoadLibrary("Shell32.dll");
      if (nsToolkit::mShell32Module) {
        nsToolkit::mSHGetPathFromIDList = (NS_SHGetPathFromIDList)GetProcAddress(nsToolkit::mShell32Module, "SHGetPathFromIDListW"); 
        if (!nsToolkit::mSHGetPathFromIDList)
          nsToolkit::mSHGetPathFromIDList = &nsSHGetPathFromIDList;
        nsToolkit::mSHBrowseForFolder = (NS_SHBrowseForFolder)GetProcAddress(nsToolkit::mShell32Module, "SHBrowseForFolderW"); 
        if (!nsToolkit::mSHBrowseForFolder)
          nsToolkit::mSHBrowseForFolder = &nsSHBrowseForFolder;
      }
      nsToolkit::mUseImeApiW = PR_TRUE;
      // XXX Hack for stopping the crash (125573)
      if (osversion.dwMajorVersion == 5 && (osversion.dwMinorVersion == 0 || osversion.dwMinorVersion == 1))  { 
        nsToolkit::mIsWinXP = (osversion.dwMinorVersion == 1);
        // "Microsoft Windows 2000 " or "Microsoft Windows XP "
        if (936 == ::GetACP())  {  // Chinese (PRC, Singapore)
          nsToolkit::mUseImeApiW = PR_FALSE;
          nsToolkit::mW2KXP_CP936 = PR_TRUE;
        }
      }
#endif // #ifndef WINCE
    }
    nsToolkit::mDllInstance = hModule;

    //
    // register the internal window class
    //
    WNDCLASSW wc;
    wc.style            = CS_GLOBALCLASS;
    wc.lpfnWndProc      = nsToolkit::WindowProc;
    wc.cbClsExtra       = 0;
    wc.cbWndExtra       = 0;
    wc.hInstance        = nsToolkit::mDllInstance;
    wc.hIcon            = NULL;
    wc.hCursor          = NULL;
    wc.hbrBackground    = NULL;
    wc.lpszMenuName     = NULL;
    wc.lpszClassName    = L"nsToolkitClass";
    VERIFY(nsToolkit::mRegisterClass(&wc));

    // Vista API.  Mozilla is DPI Aware.
    typedef BOOL (*SetProcessDPIAwareFunc)(VOID);
 
    SetProcessDPIAwareFunc setDPIAware = (SetProcessDPIAwareFunc)
      GetProcAddress(LoadLibrary("user32.dll"),
                     "SetProcessDPIAware");
    
    if (setDPIAware)
      setDPIAware();

#ifdef WINCE
    nsToolkit::mUseImeApiW  = PR_TRUE;
#endif

}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 831 of file nsToolkit.cpp.

{
    return gIsMovingWindow;
}
LRESULT CALLBACK nsToolkit::WindowProc ( HWND  hWnd,
UINT  Msg,
WPARAM  WParam,
LPARAM  lParam 
) [static]

Definition at line 841 of file nsToolkit.cpp.

{
    switch (msg) {
        case WM_CALLMETHOD:
        {
            MethodInfo *info = (MethodInfo *)lParam;
            return info->Invoke();
        }

        case WM_SYSCOLORCHANGE:
        {
          // WM_SYSCOLORCHANGE messages are only dispatched to top
          // level windows but NS_SYSCOLORCHANGE messages must be dispatched
          // to all windows including child windows. We dispatch these messages 
          // from the nsToolkit because if we are running embedded we may not 
          // have a top-level nsIWidget window.
          
          // On WIN32 all windows are automatically invalidated after the 
          // WM_SYSCOLORCHANGE is dispatched so the window is drawn using
          // the current system colors.
          nsWindow::GlobalMsgWindowProc(hWnd, msg, wParam, lParam);
        }

    }

    if(nsToolkit::gAIMMApp) {
        LRESULT lResult;
        if (nsToolkit::gAIMMApp->OnDefWindowProc(hWnd, msg, wParam, lParam, &lResult) == S_OK)
            return lResult;
    }
    return nsToolkit::mDefWindowProc(hWnd, msg, wParam, lParam);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

bool nsToolkit::cached [protected]

Definition at line 76 of file nsToolkit.h.

port_id nsToolkit::eventport [protected]

Definition at line 78 of file nsToolkit.h.

IActiveIMMApp * nsToolkit::gAIMMApp = NULL [static]

Definition at line 116 of file nsToolkit.h.

Definition at line 117 of file nsToolkit.h.

Definition at line 77 of file nsToolkit.h.

NS_CallWindowProc nsToolkit::mCallWindowProc = CallWindowProcA [static]

Definition at line 122 of file nsToolkit.h.

NS_CreateWindowEx nsToolkit::mCreateWindowEx = nsCreateWindowEx [static]

Definition at line 132 of file nsToolkit.h.

NS_DefWindowProc nsToolkit::mDefWindowProc = DefWindowProcA [static]

Definition at line 121 of file nsToolkit.h.

NS_DispatchMessage nsToolkit::mDispatchMessage = DispatchMessageA [static]

Definition at line 126 of file nsToolkit.h.

Definition at line 82 of file nsToolkit.h.

Definition at line 55 of file nsToolkit.h.

Definition at line 105 of file nsToolkit.h.

NS_DragQueryFile nsToolkit::mDragQueryFile = nsDragQueryFile [static]

Definition at line 136 of file nsToolkit.h.

xGC* nsToolkit::mGC [private]

Definition at line 57 of file nsToolkit.h.

NS_GetClassName nsToolkit::mGetClassName = nsGetClassName [static]

Definition at line 131 of file nsToolkit.h.

NS_GetMessage nsToolkit::mGetMessage = GetMessageA [static]

Definition at line 127 of file nsToolkit.h.

NS_GetOpenFileName nsToolkit::mGetOpenFileName = nsGetOpenFileName [static]

Definition at line 129 of file nsToolkit.h.

NS_GetSaveFileName nsToolkit::mGetSaveFileName = nsGetSaveFileName [static]

Definition at line 130 of file nsToolkit.h.

NS_GetWindowLong nsToolkit::mGetWindowLong = GetWindowLongA [static]

Definition at line 124 of file nsToolkit.h.

Definition at line 73 of file nsToolkit.h.

bool nsToolkitBase::mInited [protected, inherited]

Definition at line 75 of file nsToolkitBase.h.

Definition at line 107 of file nsToolkit.h.

Definition at line 108 of file nsToolkit.h.

Definition at line 86 of file nsToolkit.h.

NS_PeekMessage nsToolkit::mPeekMessage = PeekMessageA [static]

Definition at line 128 of file nsToolkit.h.

io_object_t nsToolkitBase::mPowerNotifier [protected, inherited]

Definition at line 78 of file nsToolkitBase.h.

NS_RegisterClass nsToolkit::mRegisterClass = nsRegisterClass [static]

Definition at line 133 of file nsToolkit.h.

NS_SendMessage nsToolkit::mSendMessage = nsSendMessage [static]

Definition at line 125 of file nsToolkit.h.

NS_SetWindowLong nsToolkit::mSetWindowLong = SetWindowLongA [static]

Definition at line 123 of file nsToolkit.h.

GdkGC * nsToolkit::mSharedGC [private]

Definition at line 65 of file nsToolkit.h.

NS_SHBrowseForFolder nsToolkit::mSHBrowseForFolder = nsSHBrowseForFolder [static]

Definition at line 138 of file nsToolkit.h.

HMODULE nsToolkit::mShell32Module = NULL [static]

Definition at line 120 of file nsToolkit.h.

NS_SHGetPathFromIDList nsToolkit::mSHGetPathFromIDList = nsSHGetPathFromIDList [static]

Definition at line 137 of file nsToolkit.h.

CFRunLoopSourceRef nsToolkitBase::mSleepWakeNotificationRLS [protected, inherited]

Definition at line 77 of file nsToolkitBase.h.

NS_UnregisterClass nsToolkit::mUnregisterClass = nsUnregisterClass [static]

Definition at line 134 of file nsToolkit.h.

Definition at line 109 of file nsToolkit.h.

Definition at line 110 of file nsToolkit.h.


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