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
This commit is contained in:
Robert Roebling
2006-02-16 09:00:45 +00:00
parent f01bca89fd
commit 4c20ee63f0
2 changed files with 25 additions and 15 deletions

View File

@@ -120,7 +120,7 @@ static gboolean gtk_frame_urgency_timer_callback( wxTopLevelWindowGTK *win )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
extern "C" { extern "C" {
static gint gtk_frame_focus_in_callback( GtkWidget *widget, static gboolean gtk_frame_focus_in_callback( GtkWidget *widget,
GdkEvent *WXUNUSED(event), GdkEvent *WXUNUSED(event),
wxTopLevelWindowGTK *win ) wxTopLevelWindowGTK *win )
{ {
@@ -173,7 +173,7 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget,
event.SetEventObject(g_activeFrame); event.SetEventObject(g_activeFrame);
g_activeFrame->GetEventHandler()->ProcessEvent(event); g_activeFrame->GetEventHandler()->ProcessEvent(event);
return false; return FALSE;
} }
} }
@@ -182,7 +182,7 @@ static gint gtk_frame_focus_in_callback( GtkWidget *widget,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
extern "C" { extern "C" {
static gint gtk_frame_focus_out_callback( GtkWidget *widget, static gboolean gtk_frame_focus_out_callback( GtkWidget *widget,
GdkEventFocus *WXUNUSED(gdk_event), GdkEventFocus *WXUNUSED(gdk_event),
wxTopLevelWindowGTK *win ) wxTopLevelWindowGTK *win )
{ {
@@ -208,7 +208,7 @@ static gint gtk_frame_focus_out_callback( GtkWidget *widget,
g_activeFrame = NULL; g_activeFrame = NULL;
} }
return false; return FALSE;
} }
} }
@@ -217,7 +217,7 @@ static gint gtk_frame_focus_out_callback( GtkWidget *widget,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
extern "C" { 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) if (g_isIdle)
wxapp_install_idle_handler(); wxapp_install_idle_handler();
@@ -619,9 +619,9 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
G_CALLBACK (gtk_frame_focus_callback), this); G_CALLBACK (gtk_frame_focus_callback), this);
// activation // 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_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); G_CALLBACK (gtk_frame_focus_out_callback), this);
// decorations // decorations

View File

@@ -1877,15 +1877,15 @@ static gboolean gtk_window_focus_in_callback( GtkWidget *widget,
(void)DoSendFocusEvents(win); (void)DoSendFocusEvents(win);
ret = TRUE; ret = true;
} }
// Disable default focus handling for custom windows // Disable default focus handling for custom windows
// since the default GTK+ handler issues a repaint // since the default GTK+ handler issues a repaint
if (win->m_wxwindow) 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 ); (void)win->GetEventHandler()->ProcessEvent( event );
ret = TRUE; ret = true;
} }
// Disable default focus handling for custom windows // Disable default focus handling for custom windows
// since the default GTK+ handler issues a repaint // since the default GTK+ handler issues a repaint
if (win->m_wxwindow) if (win->m_wxwindow)
g_signal_stop_emission_by_name (widget, "focus_out_event");
return ret; return ret;
return false;
} }
} }
@@ -2748,11 +2748,21 @@ void wxWindowGTK::PostCreation()
if (m_focusWidget == NULL) if (m_focusWidget == NULL)
m_focusWidget = m_widget; m_focusWidget = m_widget;
if (m_wxwindow)
{
g_signal_connect (m_focusWidget, "focus_in_event", g_signal_connect (m_focusWidget, "focus_in_event",
G_CALLBACK (gtk_window_focus_in_callback), this); 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); G_CALLBACK (gtk_window_focus_out_callback), this);
} }
}
// connect to the various key and mouse handlers // connect to the various key and mouse handlers