From 4c20ee63f0c17102213c5c6bb058b7bb9d0ad141 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Thu, 16 Feb 2006 09:00:45 +0000 Subject: [PATCH] Use g_signal_connect_after for GTK+ native controls and wxTopLevelWindow focus events and the normal _connect for custom controls. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37620 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/toplevel.cpp | 14 +++++++------- src/gtk/window.cpp | 26 ++++++++++++++++++-------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 5e8b65ab9b..fa07bb1c9b 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -120,7 +120,7 @@ static gboolean gtk_frame_urgency_timer_callback( wxTopLevelWindowGTK *win ) //----------------------------------------------------------------------------- extern "C" { -static gint gtk_frame_focus_in_callback( GtkWidget *widget, +static gboolean gtk_frame_focus_in_callback( GtkWidget *widget, GdkEvent *WXUNUSED(event), wxTopLevelWindowGTK *win ) { @@ -173,7 +173,7 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget, event.SetEventObject(g_activeFrame); g_activeFrame->GetEventHandler()->ProcessEvent(event); - return false; + return FALSE; } } @@ -182,7 +182,7 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget, //----------------------------------------------------------------------------- extern "C" { -static gint gtk_frame_focus_out_callback( GtkWidget *widget, +static gboolean gtk_frame_focus_out_callback( GtkWidget *widget, GdkEventFocus *WXUNUSED(gdk_event), wxTopLevelWindowGTK *win ) { @@ -208,7 +208,7 @@ static gint gtk_frame_focus_out_callback( GtkWidget *widget, g_activeFrame = NULL; } - return false; + return FALSE; } } @@ -217,7 +217,7 @@ static gint gtk_frame_focus_out_callback( GtkWidget *widget, //----------------------------------------------------------------------------- extern "C" { -static gint gtk_frame_focus_callback( GtkWidget *widget, GtkDirectionType WXUNUSED(d), wxWindow *WXUNUSED(win) ) +static gboolean gtk_frame_focus_callback( GtkWidget *widget, GtkDirectionType WXUNUSED(d), wxWindow *WXUNUSED(win) ) { if (g_isIdle) wxapp_install_idle_handler(); @@ -619,9 +619,9 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent, G_CALLBACK (gtk_frame_focus_callback), this); // activation - g_signal_connect (m_widget, "focus_in_event", + g_signal_connect_after (m_widget, "focus_in_event", G_CALLBACK (gtk_frame_focus_in_callback), this); - g_signal_connect (m_widget, "focus_out_event", + g_signal_connect_after (m_widget, "focus_out_event", G_CALLBACK (gtk_frame_focus_out_callback), this); // decorations diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 0138ad5c26..ae4e00120e 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1877,15 +1877,15 @@ static gboolean gtk_window_focus_in_callback( GtkWidget *widget, (void)DoSendFocusEvents(win); - ret = TRUE; + ret = true; } // Disable default focus handling for custom windows // since the default GTK+ handler issues a repaint if (win->m_wxwindow) - g_signal_stop_emission_by_name (widget, "focus_in_event"); + return ret; - return ret; + return false; } } @@ -1943,15 +1943,15 @@ static gboolean gtk_window_focus_out_callback( GtkWidget *widget, (void)win->GetEventHandler()->ProcessEvent( event ); - ret = TRUE; + ret = true; } // Disable default focus handling for custom windows // since the default GTK+ handler issues a repaint if (win->m_wxwindow) - g_signal_stop_emission_by_name (widget, "focus_out_event"); + return ret; - return ret; + return false; } } @@ -2748,10 +2748,20 @@ void wxWindowGTK::PostCreation() if (m_focusWidget == NULL) m_focusWidget = m_widget; - g_signal_connect (m_focusWidget, "focus_in_event", + if (m_wxwindow) + { + g_signal_connect (m_focusWidget, "focus_in_event", + G_CALLBACK (gtk_window_focus_in_callback), this); + g_signal_connect (m_focusWidget, "focus_out_event", + G_CALLBACK (gtk_window_focus_out_callback), this); + } + else + { + g_signal_connect_after (m_focusWidget, "focus_in_event", G_CALLBACK (gtk_window_focus_in_callback), this); - g_signal_connect_after (m_focusWidget, "focus_out_event", + g_signal_connect_after (m_focusWidget, "focus_out_event", G_CALLBACK (gtk_window_focus_out_callback), this); + } } // connect to the various key and mouse handlers -- 2.45.2