simplify mouse wheel signal handler
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39128 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1780,29 +1780,25 @@ gtk_window_motion_notify_callback( GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// "mouse_wheel_event"
|
// "scroll_event", (mouse wheel event)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_window_wheel_callback (GtkWidget * widget,
|
window_scroll_event(GtkWidget*, GdkEventScroll* gdk_event, wxWindow* win)
|
||||||
GdkEventScroll * gdk_event,
|
|
||||||
wxWindowGTK * win)
|
|
||||||
{
|
{
|
||||||
DEBUG_MAIN_THREAD
|
DEBUG_MAIN_THREAD
|
||||||
|
|
||||||
if (g_isIdle)
|
if (g_isIdle)
|
||||||
wxapp_install_idle_handler();
|
wxapp_install_idle_handler();
|
||||||
|
|
||||||
wxEventType event_type = wxEVT_NULL;
|
if (gdk_event->direction != GDK_SCROLL_UP &&
|
||||||
if (gdk_event->direction == GDK_SCROLL_UP)
|
gdk_event->direction != GDK_SCROLL_DOWN)
|
||||||
event_type = wxEVT_MOUSEWHEEL;
|
{
|
||||||
else if (gdk_event->direction == GDK_SCROLL_DOWN)
|
return false;
|
||||||
event_type = wxEVT_MOUSEWHEEL;
|
}
|
||||||
else
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
wxMouseEvent event( event_type );
|
wxMouseEvent event(wxEVT_MOUSEWHEEL);
|
||||||
// Can't use InitMouse macro because scroll events don't have button
|
// Can't use InitMouse macro because scroll events don't have button
|
||||||
event.SetTimestamp( gdk_event->time );
|
event.SetTimestamp( gdk_event->time );
|
||||||
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
event.m_shiftDown = (gdk_event->state & GDK_SHIFT_MASK);
|
||||||
@@ -1827,13 +1823,7 @@ gtk_window_wheel_callback (GtkWidget * widget,
|
|||||||
event.SetId( win->GetId() );
|
event.SetId( win->GetId() );
|
||||||
event.SetTimestamp( gdk_event->time );
|
event.SetTimestamp( gdk_event->time );
|
||||||
|
|
||||||
if (win->GetEventHandler()->ProcessEvent( event ))
|
return win->GetEventHandler()->ProcessEvent(event);
|
||||||
{
|
|
||||||
g_signal_stop_emission_by_name (widget, "scroll_event");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2878,7 +2868,7 @@ void wxWindowGTK::ConnectWidget( GtkWidget *widget )
|
|||||||
g_signal_connect (widget, "motion_notify_event",
|
g_signal_connect (widget, "motion_notify_event",
|
||||||
G_CALLBACK (gtk_window_motion_notify_callback), this);
|
G_CALLBACK (gtk_window_motion_notify_callback), this);
|
||||||
g_signal_connect (widget, "scroll_event",
|
g_signal_connect (widget, "scroll_event",
|
||||||
G_CALLBACK (gtk_window_wheel_callback), this);
|
G_CALLBACK (window_scroll_event), this);
|
||||||
g_signal_connect (widget, "popup_menu",
|
g_signal_connect (widget, "popup_menu",
|
||||||
G_CALLBACK (wxgtk_window_popup_menu_callback), this);
|
G_CALLBACK (wxgtk_window_popup_menu_callback), this);
|
||||||
g_signal_connect (widget, "enter_notify_event",
|
g_signal_connect (widget, "enter_notify_event",
|
||||||
|
Reference in New Issue
Block a user