Allow reusing wxGTK window enter/leave callback

Refactor the existing callbacks to make it possible to call them from
other places than src/gtk/window.cpp.

No real changes yet.
This commit is contained in:
Vadim Zeitlin 2024-02-19 00:22:52 +01:00
parent 9205da74db
commit e88e16a964
2 changed files with 43 additions and 8 deletions

View file

@ -94,6 +94,17 @@ template<typename T> void InitMouseEvent(wxWindowGTK *win,
// contain the mouse pointer. // contain the mouse pointer.
bool SetWindowUnderMouse(wxWindowGTK* win); bool SetWindowUnderMouse(wxWindowGTK* win);
// Implementation of enter/leave window callbacks.
gboolean
WindowEnterCallback(GtkWidget* widget,
GdkEventCrossing* event,
wxWindowGTK* win);
gboolean
WindowLeaveCallback(GtkWidget* widget,
GdkEventCrossing* event,
wxWindowGTK* win);
} // namespace wxGTKImpl } // namespace wxGTKImpl
#endif // _GTK_PRIVATE_EVENT_H_ #endif // _GTK_PRIVATE_EVENT_H_

View file

@ -2246,12 +2246,14 @@ wx_window_focus_callback(GtkWidget *widget,
return FALSE; return FALSE;
} }
} // extern "C"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// "enter_notify_event" // "enter_notify_event"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static gboolean gboolean
gtk_window_enter_callback( GtkWidget* widget, wxGTKImpl::WindowEnterCallback(GtkWidget* widget,
GdkEventCrossing* gdk_event, GdkEventCrossing* gdk_event,
wxWindowGTK* win) wxWindowGTK* win)
{ {
@ -2297,12 +2299,24 @@ gtk_window_enter_callback( GtkWidget* widget,
return win->GTKProcessEvent(event); return win->GTKProcessEvent(event);
} }
extern "C" {
static gboolean
gtk_window_enter_callback( GtkWidget* widget,
GdkEventCrossing *gdk_event,
wxWindowGTK *win )
{
return wxGTKImpl::WindowEnterCallback(widget, gdk_event, win);
}
} // extern "C"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// "leave_notify_event" // "leave_notify_event"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static gboolean gboolean
gtk_window_leave_callback( GtkWidget* widget, wxGTKImpl::WindowLeaveCallback(GtkWidget* widget,
GdkEventCrossing* gdk_event, GdkEventCrossing* gdk_event,
wxWindowGTK* win) wxWindowGTK* win)
{ {
@ -2331,6 +2345,16 @@ gtk_window_leave_callback( GtkWidget* widget,
return win->GTKProcessEvent(event); return win->GTKProcessEvent(event);
} }
extern "C" {
static gboolean
gtk_window_leave_callback( GtkWidget* widget,
GdkEventCrossing *gdk_event,
wxWindowGTK *win )
{
return wxGTKImpl::WindowLeaveCallback(widget, gdk_event, win);
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// "value_changed" from scrollbar // "value_changed" from scrollbar
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------