From bf8c4b13f1ff5458e126ef7fc2524045499ebfc8 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Fri, 11 Apr 2008 16:03:49 +0300 Subject: [PATCH] Use middle button on desktops to pan when clicking on map edges with middle button. --- src/map.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/map.c b/src/map.c index c1f4a65..fc505e0 100644 --- a/src/map.c +++ b/src/map.c @@ -1451,25 +1451,29 @@ map_cb_button_press(GtkWidget *widget, GdkEventButton *event) _cmenu_position_x = event->x + 0.5; _cmenu_position_y = event->y + 0.5; +/* Handle map panning using clicks, use thumb on tablets and middle button on non-tablets */ #if defined(WITH_HILDON_NEW) if (hildon_helper_event_button_is_finger(event)) { g_debug("Thumb down"); - +#else +if (event->button==2) { +#endif + gint pns=0, pew=0; if (event->xx>(_screen_width_pixels-MAP_THUMB_MARGIN)) - map_pan(PAN_UNITS, 0); + pns=-PAN_UNITS; + else if (event->x>(_screen_width_pixels-MAP_THUMB_MARGIN)) + pns=PAN_UNITS; if (event->yy>(_screen_height_pixels-MAP_THUMB_MARGIN)) - map_pan(0, PAN_UNITS); + pew=-PAN_UNITS; + else if (event->y>(_screen_height_pixels-MAP_THUMB_MARGIN)) + pew=PAN_UNITS; - return FALSE; + if (pns!=0 || pew!=0) { + map_pan(pns, pew); + return FALSE; + } } -#endif switch (event->button) { case 1: -- 2.39.5