]> git.saurik.com Git - wxWidgets.git/commitdiff
I debug DialogEd for five hours and then Karsten
authorRobert Roebling <robert@roebling.de>
Mon, 7 Sep 1998 22:38:10 +0000 (22:38 +0000)
committerRobert Roebling <robert@roebling.de>
Mon, 7 Sep 1998 22:38:10 +0000 (22:38 +0000)
  tells me that CaptureMouse is broken. Doh.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@712 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/window.cpp
src/gtk1/window.cpp
utils/dialoged/src/dlghndlr.cpp

index 7cba0eb41e9b2742a49c68241b8f229c092203ef..eec08efb5b81f040a63ceff1767e522ee24e7f9e 100644 (file)
 extern wxList wxPendingDelete;
 extern wxList wxTopLevelWindows;
 extern bool   g_blockEventsOnDrag;
-wxWindow     *g_captureWindow = (wxWindow*)NULL;
+       bool   g_capturing = FALSE;
 
 //-----------------------------------------------------------------------------
 // "expose_event" (of m_wxwindow, not of m_widget)
@@ -300,8 +300,6 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
 {
   if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
   
-  if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
-  
   if (g_blockEventsOnDrag) return TRUE;
 
   if (win->m_wxwindow)
@@ -374,21 +372,24 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
   // Some control don't have their own X window and thus cannot get
   // any events. 
   
-  wxNode *node = win->GetChildren()->First();
-  while (node)
+  if (!g_capturing)
   {
-    wxWindow *child = (wxWindow*)node->Data();
-    if ((child->m_x <= event.m_x) &&
-        (child->m_y <= event.m_y) &&
-       (child->m_x+child->m_width  >= event.m_x) &&
-       (child->m_y+child->m_height >= event.m_y))
+    wxNode *node = win->GetChildren()->First();
+    while (node)
     {
-      win = child;
-      event.m_x -= child->m_x;
-      event.m_y -= child->m_y;
-      break;
+      wxWindow *child = (wxWindow*)node->Data();
+      if ((child->m_x <= event.m_x) &&
+          (child->m_y <= event.m_y) &&
+         (child->m_x+child->m_width  >= event.m_x) &&
+         (child->m_y+child->m_height >= event.m_y))
+      {
+        win = child;
+        event.m_x -= child->m_x;
+        event.m_y -= child->m_y;
+        break;
+      }
+      node = node->Next();
     }
-    node = node->Next();
   }
   
   event.SetEventObject( win );
@@ -407,8 +408,6 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
 { 
   if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
   
-  if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
-  
   if (g_blockEventsOnDrag) return TRUE;
 
   if (!win->HasVMT()) return TRUE;
@@ -443,21 +442,24 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
   // Some control don't have their own X window and thus cannot get
   // any events. 
   
-  wxNode *node = win->GetChildren()->First();
-  while (node)
+  if (!g_capturing)
   {
-    wxWindow *child = (wxWindow*)node->Data();
-    if ((child->m_x <= event.m_x) &&
-        (child->m_y <= event.m_y) &&
-       (child->m_x+child->m_width  >= event.m_x) &&
-       (child->m_y+child->m_height >= event.m_y))
+    wxNode *node = win->GetChildren()->First();
+    while (node)
     {
-      win = child;
-      event.m_x -= child->m_x;
-      event.m_y -= child->m_y;
-      break;
+      wxWindow *child = (wxWindow*)node->Data();
+      if ((child->m_x <= event.m_x) &&
+          (child->m_y <= event.m_y) &&
+         (child->m_x+child->m_width  >= event.m_x) &&
+         (child->m_y+child->m_height >= event.m_y))
+      {
+        win = child;
+        event.m_x -= child->m_x;
+        event.m_y -= child->m_y;
+        break;
+      }
+      node = node->Next();
     }
-    node = node->Next();
   }
   
   event.SetEventObject( win );
@@ -476,8 +478,6 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
 { 
   if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
   
-  if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
-  
   if (g_blockEventsOnDrag) return TRUE;
 
   if (!win->HasVMT()) return TRUE;
@@ -504,21 +504,24 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
   // Some control don't have their own X window and thus cannot get
   // any events. 
   
-  wxNode *node = win->GetChildren()->First();
-  while (node)
+  if (!g_capturing)
   {
-    wxWindow *child = (wxWindow*)node->Data();
-    if ((child->m_x <= event.m_x) &&
-        (child->m_y <= event.m_y) &&
-       (child->m_x+child->m_width  >= event.m_x) &&
-       (child->m_y+child->m_height >= event.m_y))
+    wxNode *node = win->GetChildren()->First();
+    while (node)
     {
-      win = child;
-      event.m_x -= child->m_x;
-      event.m_y -= child->m_y;
-      break;
+      wxWindow *child = (wxWindow*)node->Data();
+      if ((child->m_x <= event.m_x) &&
+          (child->m_y <= event.m_y) &&
+         (child->m_x+child->m_width  >= event.m_x) &&
+         (child->m_y+child->m_height >= event.m_y))
+      {
+        win = child;
+        event.m_x -= child->m_x;
+        event.m_y -= child->m_y;
+        break;
+      }
+      node = node->Next();
     }
-    node = node->Next();
   }
   
   event.SetEventObject( win );
@@ -609,8 +612,6 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_
 {
   if (widget->window != gdk_event->window) return TRUE;
   
-  if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
-  
   if (g_blockEventsOnDrag) return TRUE;
   
   if (!win->HasVMT()) return TRUE;
@@ -635,8 +636,6 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_
 {
   if (widget->window != gdk_event->window) return TRUE;
   
-  if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
-  
   if (g_blockEventsOnDrag) return TRUE;
   
   if (!win->HasVMT()) return TRUE;
@@ -1998,7 +1997,7 @@ void wxWindow::CaptureMouse(void)
         GDK_BUTTON_RELEASE_MASK |
         GDK_POINTER_MOTION_MASK), 
         (GdkWindow *) NULL, (GdkCursor *) NULL, GDK_CURRENT_TIME );
-  g_captureWindow = this;
+  g_capturing = TRUE;
 }
 
 void wxWindow::ReleaseMouse(void)
@@ -2006,7 +2005,7 @@ void wxWindow::ReleaseMouse(void)
   GtkWidget *connect_widget = GetConnectWidget();
   gtk_grab_remove( connect_widget );
   gdk_pointer_ungrab ( GDK_CURRENT_TIME );
-  g_captureWindow = (wxWindow*) NULL;;
+  g_capturing = FALSE;
 }
 
 void wxWindow::SetTitle( const wxString &WXUNUSED(title) )
index 7cba0eb41e9b2742a49c68241b8f229c092203ef..eec08efb5b81f040a63ceff1767e522ee24e7f9e 100644 (file)
 extern wxList wxPendingDelete;
 extern wxList wxTopLevelWindows;
 extern bool   g_blockEventsOnDrag;
-wxWindow     *g_captureWindow = (wxWindow*)NULL;
+       bool   g_capturing = FALSE;
 
 //-----------------------------------------------------------------------------
 // "expose_event" (of m_wxwindow, not of m_widget)
@@ -300,8 +300,6 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
 {
   if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
   
-  if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
-  
   if (g_blockEventsOnDrag) return TRUE;
 
   if (win->m_wxwindow)
@@ -374,21 +372,24 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
   // Some control don't have their own X window and thus cannot get
   // any events. 
   
-  wxNode *node = win->GetChildren()->First();
-  while (node)
+  if (!g_capturing)
   {
-    wxWindow *child = (wxWindow*)node->Data();
-    if ((child->m_x <= event.m_x) &&
-        (child->m_y <= event.m_y) &&
-       (child->m_x+child->m_width  >= event.m_x) &&
-       (child->m_y+child->m_height >= event.m_y))
+    wxNode *node = win->GetChildren()->First();
+    while (node)
     {
-      win = child;
-      event.m_x -= child->m_x;
-      event.m_y -= child->m_y;
-      break;
+      wxWindow *child = (wxWindow*)node->Data();
+      if ((child->m_x <= event.m_x) &&
+          (child->m_y <= event.m_y) &&
+         (child->m_x+child->m_width  >= event.m_x) &&
+         (child->m_y+child->m_height >= event.m_y))
+      {
+        win = child;
+        event.m_x -= child->m_x;
+        event.m_y -= child->m_y;
+        break;
+      }
+      node = node->Next();
     }
-    node = node->Next();
   }
   
   event.SetEventObject( win );
@@ -407,8 +408,6 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
 { 
   if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
   
-  if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
-  
   if (g_blockEventsOnDrag) return TRUE;
 
   if (!win->HasVMT()) return TRUE;
@@ -443,21 +442,24 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
   // Some control don't have their own X window and thus cannot get
   // any events. 
   
-  wxNode *node = win->GetChildren()->First();
-  while (node)
+  if (!g_capturing)
   {
-    wxWindow *child = (wxWindow*)node->Data();
-    if ((child->m_x <= event.m_x) &&
-        (child->m_y <= event.m_y) &&
-       (child->m_x+child->m_width  >= event.m_x) &&
-       (child->m_y+child->m_height >= event.m_y))
+    wxNode *node = win->GetChildren()->First();
+    while (node)
     {
-      win = child;
-      event.m_x -= child->m_x;
-      event.m_y -= child->m_y;
-      break;
+      wxWindow *child = (wxWindow*)node->Data();
+      if ((child->m_x <= event.m_x) &&
+          (child->m_y <= event.m_y) &&
+         (child->m_x+child->m_width  >= event.m_x) &&
+         (child->m_y+child->m_height >= event.m_y))
+      {
+        win = child;
+        event.m_x -= child->m_x;
+        event.m_y -= child->m_y;
+        break;
+      }
+      node = node->Next();
     }
-    node = node->Next();
   }
   
   event.SetEventObject( win );
@@ -476,8 +478,6 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
 { 
   if (!win->IsOwnGtkWindow( gdk_event->window )) return TRUE;
   
-  if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
-  
   if (g_blockEventsOnDrag) return TRUE;
 
   if (!win->HasVMT()) return TRUE;
@@ -504,21 +504,24 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
   // Some control don't have their own X window and thus cannot get
   // any events. 
   
-  wxNode *node = win->GetChildren()->First();
-  while (node)
+  if (!g_capturing)
   {
-    wxWindow *child = (wxWindow*)node->Data();
-    if ((child->m_x <= event.m_x) &&
-        (child->m_y <= event.m_y) &&
-       (child->m_x+child->m_width  >= event.m_x) &&
-       (child->m_y+child->m_height >= event.m_y))
+    wxNode *node = win->GetChildren()->First();
+    while (node)
     {
-      win = child;
-      event.m_x -= child->m_x;
-      event.m_y -= child->m_y;
-      break;
+      wxWindow *child = (wxWindow*)node->Data();
+      if ((child->m_x <= event.m_x) &&
+          (child->m_y <= event.m_y) &&
+         (child->m_x+child->m_width  >= event.m_x) &&
+         (child->m_y+child->m_height >= event.m_y))
+      {
+        win = child;
+        event.m_x -= child->m_x;
+        event.m_y -= child->m_y;
+        break;
+      }
+      node = node->Next();
     }
-    node = node->Next();
   }
   
   event.SetEventObject( win );
@@ -609,8 +612,6 @@ static gint gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_
 {
   if (widget->window != gdk_event->window) return TRUE;
   
-  if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
-  
   if (g_blockEventsOnDrag) return TRUE;
   
   if (!win->HasVMT()) return TRUE;
@@ -635,8 +636,6 @@ static gint gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_
 {
   if (widget->window != gdk_event->window) return TRUE;
   
-  if ((g_captureWindow) && (win != g_captureWindow)) return TRUE;
-  
   if (g_blockEventsOnDrag) return TRUE;
   
   if (!win->HasVMT()) return TRUE;
@@ -1998,7 +1997,7 @@ void wxWindow::CaptureMouse(void)
         GDK_BUTTON_RELEASE_MASK |
         GDK_POINTER_MOTION_MASK), 
         (GdkWindow *) NULL, (GdkCursor *) NULL, GDK_CURRENT_TIME );
-  g_captureWindow = this;
+  g_capturing = TRUE;
 }
 
 void wxWindow::ReleaseMouse(void)
@@ -2006,7 +2005,7 @@ void wxWindow::ReleaseMouse(void)
   GtkWidget *connect_widget = GetConnectWidget();
   gtk_grab_remove( connect_widget );
   gdk_pointer_ungrab ( GDK_CURRENT_TIME );
-  g_captureWindow = (wxWindow*) NULL;;
+  g_capturing = FALSE;
 }
 
 void wxWindow::SetTitle( const wxString &WXUNUSED(title) )
index f312fb0ec0c0419c10f87ca30dc6e8052d71ecdb..4c6b67b9dacd1855257ee1bab452384aecf10cb0 100644 (file)
@@ -379,8 +379,6 @@ void wxResourceEditorDialogHandler::ProcessItemEvent(wxControl *item, wxMouseEve
 {
   wxResourceEditorControlHandler *childHandler = (wxResourceEditorControlHandler *)item->GetEventHandler();
   
-  if (dragItem) childHandler = (wxResourceEditorControlHandler *)dragItem->GetEventHandler();
-  
   long x, y;
   event.Position(&x, &y);
   int keys = 0;