]> git.saurik.com Git - wxWidgets.git/commitdiff
Only set focus to widget automatically if left down
authorRobert Roebling <robert@roebling.de>
Thu, 26 Apr 2007 18:45:16 +0000 (18:45 +0000)
committerRobert Roebling <robert@roebling.de>
Thu, 26 Apr 2007 18:45:16 +0000 (18:45 +0000)
    event was not handled (as per wxMSW).

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

src/gtk/window.cpp

index 902dc0517e954875541c8e05fad9ae69e0c66eda..098372578a8b20d85eb473e3b7e54167983eb641 100644 (file)
@@ -1579,6 +1579,12 @@ gtk_window_button_press_callback( GtkWidget *widget,
     if ( ret )
         return TRUE;
 
+    if ((event_type == wxEVT_LEFT_DOWN) && !win->IsOfStandardClass() && 
+        (g_focusWindow != win) && win->CanAcceptFocus())
+    {
+        gtk_widget_grab_focus( win->m_wxwindow );
+    }
+
     if (event_type == wxEVT_RIGHT_DOWN)
     {
         // generate a "context menu" event: this is similar to right mouse
@@ -2076,9 +2082,6 @@ gtk_scrollbar_button_release_event(GtkRange* range, GdkEventButton*, wxWindow* w
 // "realize" from m_widget
 //-----------------------------------------------------------------------------
 
-/* We cannot set colours and fonts before the widget has
-   been realized, so we do this directly after realization. */
-
 static void
 gtk_window_realized_callback( GtkWidget *m_widget, wxWindow *win )
 {
@@ -2091,6 +2094,16 @@ gtk_window_realized_callback( GtkWidget *m_widget, wxWindow *win )
                                           pizza->bin_window );
     }
 
+    // We cannot set colours and fonts before the widget
+    // been realized, so we do this directly after realization
+    // or otherwise in idle time
+
+    if (win->m_needsStyleChange)
+    {
+        win->SetBackgroundStyle(win->GetBackgroundStyle());
+        win->m_needsStyleChange = false;
+    }
+
     wxWindowCreateEvent event( win );
     event.SetEventObject( win );
     win->GTKProcessEvent( event );