From: Robert Roebling Date: Thu, 26 Apr 2007 18:45:16 +0000 (+0000) Subject: Only set focus to widget automatically if left down X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/8622e8cdcee99567862aa6bb332e656561ec0d0d Only set focus to widget automatically if left down event was not handled (as per wxMSW). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45674 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 902dc0517e..098372578a 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -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 );