]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/window.cpp
Corrected small mistake (set static variable)
[wxWidgets.git] / src / gtk / window.cpp
index c9001096b0565291e4b4197a00bc0b23b64a9acc..c6b827a1e4ee66d34130638ef4f0eda6d4954c95 100644 (file)
@@ -1061,13 +1061,6 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
         }
     }
 
-/*
-    wxPrintf( wxT("2) OnButtonPress from ") );
-    if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
-        wxPrintf( win->GetClassInfo()->GetClassName() );
-    wxPrintf( wxT(".\n") );
-*/
-
     wxEventType event_type = wxEVT_LEFT_DOWN;
 
     if (gdk_event->button == 1)
@@ -1116,16 +1109,27 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
 
     if (!g_captureWindow)
     {
+        int x = event.m_x;
+        int y = event.m_y;
+        if (win->m_wxwindow)
+        {
+            GtkMyFixed *myfixed = GTK_MYFIXED(win->m_wxwindow);
+           x += myfixed->xoffset;
+           y += myfixed->yoffset;
+        }
+
         wxNode *node = win->GetChildren().First();
         while (node)
         {
             wxWindow *child = (wxWindow*)node->Data();
+           
+            node = node->Next();
+           if (!child->IsShown())
+               continue;
 
             if (child->m_isStaticBox)
             {
                 // wxStaticBox is transparent in the box itself
-                int x = event.m_x;
-                int y = event.m_y;
                 int xx1 = child->m_x;
                 int yy1 = child->m_y;
                 int xx2 = child->m_x + child->m_width;
@@ -1150,10 +1154,10 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
             else
             {
                 if ((child->m_wxwindow == (GtkWidget*) NULL) &&
-                    (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))
+                    (child->m_x <= x) &&
+                    (child->m_y <= y) &&
+                    (child->m_x+child->m_width  >= x) &&
+                    (child->m_y+child->m_height >= y))
                 {
                     win = child;
                     event.m_x -= child->m_x;
@@ -1161,7 +1165,6 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
                     break;
                 }
             }
-            node = node->Next();
         }
     }
 
@@ -1169,6 +1172,13 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, GdkEventButton
 
     gs_timeLastClick = gdk_event->time;
 
+/*
+    wxPrintf( wxT("2) OnButtonPress from ") );
+    if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
+        wxPrintf( win->GetClassInfo()->GetClassName() );
+    wxPrintf( wxT(".\n") );
+*/
+
     if (win->GetEventHandler()->ProcessEvent( event ))
     {
         gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "button_press_event" );
@@ -1226,16 +1236,27 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
 
     if (!g_captureWindow)
     {
+        int x = event.m_x;
+        int y = event.m_y;
+        if (win->m_wxwindow)
+        {
+            GtkMyFixed *myfixed = GTK_MYFIXED(win->m_wxwindow);
+           x += myfixed->xoffset;
+           y += myfixed->yoffset;
+        }
+
         wxNode *node = win->GetChildren().First();
         while (node)
         {
             wxWindow *child = (wxWindow*)node->Data();
 
+            node = node->Next();
+           if (!child->IsShown())
+               continue;
+
             if (child->m_isStaticBox)
             {
                 // wxStaticBox is transparent in the box itself
-                int x = event.m_x;
-                int y = event.m_y;
                 int xx1 = child->m_x;
                 int yy1 = child->m_y;
                 int xx2 = child->m_x + child->m_width;
@@ -1260,10 +1281,10 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
             else
             {
                 if ((child->m_wxwindow == (GtkWidget*) NULL) &&
-                    (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))
+                    (child->m_x <= x) &&
+                    (child->m_y <= y) &&
+                    (child->m_x+child->m_width  >= x) &&
+                    (child->m_y+child->m_height >= y))
                 {
                     win = child;
                     event.m_x -= child->m_x;
@@ -1271,7 +1292,6 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, GdkEventButto
                     break;
                 }
             }
-            node = node->Next();
         }
     }
 
@@ -1336,16 +1356,27 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
 
     if (!g_captureWindow)
     {
+        int x = event.m_x;
+        int y = event.m_y;
+        if (win->m_wxwindow)
+        {
+            GtkMyFixed *myfixed = GTK_MYFIXED(win->m_wxwindow);
+           x += myfixed->xoffset;
+           y += myfixed->yoffset;
+        }
+
         wxNode *node = win->GetChildren().First();
         while (node)
         {
             wxWindow *child = (wxWindow*)node->Data();
 
+            node = node->Next();
+           if (!child->IsShown())
+               continue;
+
             if (child->m_isStaticBox)
             {
                 // wxStaticBox is transparent in the box itself
-                int x = event.m_x;
-                int y = event.m_y;
                 int xx1 = child->m_x;
                 int yy1 = child->m_y;
                 int xx2 = child->m_x + child->m_width;
@@ -1370,10 +1401,10 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
             else
             {
                 if ((child->m_wxwindow == (GtkWidget*) NULL) &&
-                    (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))
+                    (child->m_x <= x) &&
+                    (child->m_y <= y) &&
+                    (child->m_x+child->m_width  >= x) &&
+                    (child->m_y+child->m_height >= y))
                 {
                     win = child;
                     event.m_x -= child->m_x;
@@ -1381,7 +1412,6 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
                     break;
                 }
             }
-            node = node->Next();
         }
     }