- DEBUG_MAIN_THREAD
-
- // don't need to install idle handler, its done from "event" signal
-
- if (win->m_imData)
- gtk_im_context_focus_out(win->m_imData->context);
-
- wxLogTrace( TRACE_FOCUS,
- _T("%s: focus out"), win->GetName().c_str() );
-
-
- wxWindowGTK *winFocus = wxFindFocusedChild(win);
- if ( winFocus )
- win = winFocus;
-
- g_focusWindow = (wxWindowGTK *)NULL;
-
-#ifdef HAVE_XIM
- if (win->m_ic)
- gdk_im_end();
-#endif
-
-#if wxUSE_CARET
- // caret needs to be informed about focus change
- wxCaret *caret = win->GetCaret();
- if ( caret )
- {
- caret->OnKillFocus();
- }
-#endif // wxUSE_CARET
-
- gboolean ret = FALSE;
-
- // don't send the window a kill focus event if it thinks that it doesn't
- // have focus already
- if ( win->m_hasFocus )
- {
- win->m_hasFocus = false;
-
- wxFocusEvent event( wxEVT_KILL_FOCUS, win->GetId() );
- event.SetEventObject( win );
-
- (void)win->GetEventHandler()->ProcessEvent( event );
-
- ret = TRUE;
- }
-
- // Disable default focus handling for custom windows
- // since the default GTK+ handler issues a repaint
- if (win->m_wxwindow)
- return ret;
-
- return FALSE;
-}
-
-//-----------------------------------------------------------------------------
-// "enter_notify_event"
-//-----------------------------------------------------------------------------
-
-static gboolean
-gtk_window_enter_callback( GtkWidget *widget,
- GdkEventCrossing *gdk_event,
- wxWindowGTK *win )
-{
- wxCOMMON_CALLBACK_PROLOGUE(gdk_event, win);
-
- // Event was emitted after a grab
- if (gdk_event->mode != GDK_CROSSING_NORMAL) return FALSE;
-
- int x = 0;
- int y = 0;
- GdkModifierType state = (GdkModifierType)0;
-
- gdk_window_get_pointer( widget->window, &x, &y, &state );
-
- wxMouseEvent event( wxEVT_ENTER_WINDOW );
- InitMouseEvent(win, event, gdk_event);
- wxPoint pt = win->GetClientAreaOrigin();
- event.m_x = x + pt.x;
- event.m_y = y + pt.y;
-
- if ( !g_captureWindow )
- {
- wxSetCursorEvent cevent( event.m_x, event.m_y );
- if (win->GetEventHandler()->ProcessEvent( cevent ))
- {
- // Rewrite cursor handling here (away from idle).
- }
- }
-
- if (win->GetEventHandler()->ProcessEvent( event ))
- {
- g_signal_stop_emission_by_name (widget, "enter_notify_event");
- return TRUE;
- }
-
- return FALSE;
-}
-
-//-----------------------------------------------------------------------------
-// "leave_notify_event"
-//-----------------------------------------------------------------------------
-
-static gboolean
-gtk_window_leave_callback( GtkWidget *widget,
- GdkEventCrossing *gdk_event,
- wxWindowGTK *win )
-{
- wxCOMMON_CALLBACK_PROLOGUE(gdk_event, win);