Index: trunk/src_plugins/hid_gtk/gui-output-events.c =================================================================== --- trunk/src_plugins/hid_gtk/gui-output-events.c (revision 6718) +++ trunk/src_plugins/hid_gtk/gui-output-events.c (revision 6719) @@ -306,37 +306,6 @@ } - /* Mouse scroll wheel events - */ -gint ghid_port_window_mouse_scroll_cb(GtkWidget * widget, GdkEventScroll * ev, GHidPort * out) -{ - ModifierKeysState mk; - GdkModifierType state; - int button; - - state = (GdkModifierType) (ev->state); - mk = ghid_modifier_keys_state(&state); - - /* X11 gtk hard codes buttons 4, 5, 6, 7 as below in - * gtk+/gdk/x11/gdkevents-x11.c:1121, but quartz and windows have - * special mouse scroll events, so this may conflict with a mouse - * who has buttons 4 - 7 that aren't the scroll wheel? - */ - switch (ev->direction) { - case GDK_SCROLL_UP: button = PCB_MB_SCROLL_UP; break; - case GDK_SCROLL_DOWN: button = PCB_MB_SCROLL_DOWN; break; - case GDK_SCROLL_LEFT: button = PCB_MB_SCROLL_LEFT; break; - case GDK_SCROLL_RIGHT: button = PCB_MB_SCROLL_RIGHT; break; - default: return FALSE; - } - - ghid_wheel_zoom = 1; - hid_cfg_mouse_action(&ghid_mouse, button | mk); - ghid_wheel_zoom = 0; - - return TRUE; -} - void ghid_confchg_line_refraction(conf_native_t *cfg) { /* test if PCB struct doesn't exist at startup */ Index: trunk/src_plugins/hid_gtk/gui.h =================================================================== --- trunk/src_plugins/hid_gtk/gui.h (revision 6718) +++ trunk/src_plugins/hid_gtk/gui.h (revision 6719) @@ -222,7 +222,6 @@ gint ghid_port_window_enter_cb(GtkWidget * widget, GdkEventCrossing * ev, GHidPort * out); gint ghid_port_window_leave_cb(GtkWidget * widget, GdkEventCrossing * ev, GHidPort * out); gint ghid_port_window_motion_cb(GtkWidget * widget, GdkEventMotion * ev, GHidPort * out); -gint ghid_port_window_mouse_scroll_cb(GtkWidget * widget, GdkEventScroll * ev, GHidPort * out); gint ghid_port_drawing_area_configure_event_cb(GtkWidget * widget, GdkEventConfigure * ev, GHidPort * out); Index: trunk/src_plugins/lib_gtk_common/in_mouse.c =================================================================== --- trunk/src_plugins/lib_gtk_common/in_mouse.c (revision 6718) +++ trunk/src_plugins/lib_gtk_common/in_mouse.c (revision 6719) @@ -311,3 +311,33 @@ { run_get_location_loop(msg); } + +/* Mouse scroll wheel events */ +gint ghid_port_window_mouse_scroll_cb(GtkWidget *widget, GdkEventScroll *ev, void *out) +{ + ModifierKeysState mk; + GdkModifierType state; + int button; + + state = (GdkModifierType) (ev->state); + mk = ghid_modifier_keys_state(&state); + + /* X11 gtk hard codes buttons 4, 5, 6, 7 as below in + * gtk+/gdk/x11/gdkevents-x11.c:1121, but quartz and windows have + * special mouse scroll events, so this may conflict with a mouse + * who has buttons 4 - 7 that aren't the scroll wheel? + */ + switch (ev->direction) { + case GDK_SCROLL_UP: button = PCB_MB_SCROLL_UP; break; + case GDK_SCROLL_DOWN: button = PCB_MB_SCROLL_DOWN; break; + case GDK_SCROLL_LEFT: button = PCB_MB_SCROLL_LEFT; break; + case GDK_SCROLL_RIGHT: button = PCB_MB_SCROLL_RIGHT; break; + default: return FALSE; + } + + ghid_wheel_zoom = 1; + hid_cfg_mouse_action(&ghid_mouse, button | mk); + ghid_wheel_zoom = 0; + + return TRUE; +} Index: trunk/src_plugins/lib_gtk_common/in_mouse.h =================================================================== --- trunk/src_plugins/lib_gtk_common/in_mouse.h (revision 6718) +++ trunk/src_plugins/lib_gtk_common/in_mouse.h (revision 6719) @@ -1,6 +1,7 @@ #include "hid_cfg_input.h" -#include +#include +#include extern pcb_hid_cfg_mouse_t ghid_mouse; extern int ghid_wheel_zoom; @@ -17,3 +18,6 @@ void ghid_restore_cursor(void); void ghid_get_user_xy(const char *msg); + +gint ghid_port_window_mouse_scroll_cb(GtkWidget *widget, GdkEventScroll *ev, void *out); +