]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/window.cpp
Committing in .
[wxWidgets.git] / src / msw / window.cpp
index 742aa707aae12a192e8145b8773d3f60a88d6ebe..fa407353a86094345c0d453e57a4aafb67cc5542 100644 (file)
     #endif
 #endif
 
-
 // ---------------------------------------------------------------------------
 // global variables
 // ---------------------------------------------------------------------------
@@ -2562,7 +2561,10 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
             break;
 #endif // __WIN32__
 
-#ifdef __WXUNIVERSAL__
+            // unfortunately this doesn't really work as then window which
+            // doesn't accept focus doesn't get any mouse events neither which
+            // means it can't get any input at all
+#if 0 //def __WXUNIVERSAL__
         case WM_NCHITTEST:
             // we shouldn't allow the windows which don't want to get focus to
             // get it
@@ -2591,14 +2593,11 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
 // wxWindow <-> HWND map
 // ----------------------------------------------------------------------------
 
-wxList *wxWinHandleList = NULL;
+wxWinHashTable *wxWinHandleHash = NULL;
 
 wxWindow *wxFindWinFromHandle(WXHWND hWnd)
 {
-    wxNode *node = wxWinHandleList->Find((long)hWnd);
-    if ( !node )
-        return NULL;
-    return (wxWindow *)node->Data();
+    return wxWinHandleHash->Get((long)hWnd);
 }
 
 void wxAssociateWinWithHandle(HWND hWnd, wxWindowMSW *win)
@@ -2619,13 +2618,13 @@ void wxAssociateWinWithHandle(HWND hWnd, wxWindowMSW *win)
 #endif // __WXDEBUG__
     if (!oldWin)
     {
-        wxWinHandleList->Append((long)hWnd, win);
+        wxWinHandleHash->Put((long)hWnd, win);
     }
 }
 
 void wxRemoveHandleAssociation(wxWindowMSW *win)
 {
-    wxWinHandleList->DeleteObject(win);
+    wxWinHandleHash->Delete((long)win->GetHWND());
 }
 
 // ----------------------------------------------------------------------------
@@ -3523,7 +3522,7 @@ bool wxWindowMSW::HandleGetMinMaxInfo(void *mmInfo)
 bool wxWindowMSW::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
 {
 #if wxUSE_MENUS_NATIVE
-    if ( wxCurrentPopupMenu )
+    if ( !cmd && wxCurrentPopupMenu )
     {
         wxMenu *popupMenu = wxCurrentPopupMenu;
         wxCurrentPopupMenu = NULL;
@@ -3532,14 +3531,14 @@ bool wxWindowMSW::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
     }
 #endif // wxUSE_MENUS_NATIVE
 
-    wxWindow *win = (wxWindow*) NULL;
+    wxWindow *win = NULL;
     if ( cmd == 0 || cmd == 1 ) // menu or accel - use id
     {
         // must cast to a signed type before comparing with other ids!
         win = FindItem((signed short)id);
     }
 
-    if (!win && control)
+    if ( !win && control )
     {
         // find it from HWND - this works even with the broken programs using
         // the same ids for different controls