]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/window.cpp
updated license info: Remstar gace permission to change it to wxWindows License with...
[wxWidgets.git] / src / gtk / window.cpp
index 14a770ef1058810523b2c25932a70be046af39d2..a461e3b7e889eb862560e142e1ea9d34c47e4649 100644 (file)
@@ -251,16 +251,6 @@ static bool g_activeFrameLostFocus = FALSE;
 // yet, defer setting the focus to idle time.
 wxWindowGTK *g_delayedFocus = (wxWindowGTK*) NULL;
 
-// When GTK+ focus_in/out signal is being processed, we shouldn't do
-// any focus changes
-static bool gs_inFocusSignalHandler = false;
-
-struct InFocusHandlerLock
-{
-    InFocusHandlerLock() { gs_inFocusSignalHandler = true; }
-    ~InFocusHandlerLock() { gs_inFocusSignalHandler = false; }
-};
-
 // if we detect that the app has got/lost the focus, we set this variable to
 // either TRUE or FALSE and an activate event will be sent during the next
 // OnIdle() call and it is reset to -1: this value means that we shouldn't
@@ -1973,8 +1963,6 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget,
                                           GdkEvent *WXUNUSED(event),
                                           wxWindow *win )
 {
-    InFocusHandlerLock flock;
-
     DEBUG_MAIN_THREAD
 
     if (g_isIdle)
@@ -2069,8 +2057,6 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget,
 static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEventFocus *gdk_event, wxWindowGTK *win )
 {
     DEBUG_MAIN_THREAD
-    
-    InFocusHandlerLock flock;
 
     if (g_isIdle)
         wxapp_install_idle_handler();
@@ -3622,14 +3608,6 @@ void wxWindowGTK::SetFocus()
         return;
     }
 
-    if (gs_inFocusSignalHandler)
-    {
-        wxLogTrace(TRACE_FOCUS,
-                   _T("in focus handler, delaying SetFocus(%p)"), this);
-        g_delayedFocus = this;
-        return;
-    }
-
     if (m_wxwindow)
     {
         if (!GTK_WIDGET_HAS_FOCUS (m_wxwindow))
@@ -4252,6 +4230,9 @@ void wxWindowGTK::ApplyWidgetStyle(bool forceStyle)
         DoApplyWidgetStyle(style);
         gtk_rc_style_unref(style);
     }
+
+    // Style change may affect GTK+'s size calculation:
+    InvalidateBestSize();
 }
 
 void wxWindowGTK::DoApplyWidgetStyle(GtkRcStyle *style)
@@ -4323,10 +4304,10 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y )
 
     bool is_waiting = true;
 
-    gtk_signal_connect( GTK_OBJECT(menu->m_menu),
-                        "hide",
-                        GTK_SIGNAL_FUNC(gtk_pop_hide_callback),
-                        (gpointer)&is_waiting );
+    gulong handler = gtk_signal_connect( GTK_OBJECT(menu->m_menu),
+                                         "hide",
+                                         GTK_SIGNAL_FUNC(gtk_pop_hide_callback),
+                                         (gpointer)&is_waiting );
 
     wxPoint pos;
     gpointer userdata;
@@ -4363,6 +4344,8 @@ bool wxWindowGTK::DoPopupMenu( wxMenu *menu, int x, int y )
         gtk_main_iteration();
     }
 
+    gtk_signal_disconnect(GTK_OBJECT(menu->m_menu), handler);
+
     return true;
 }