]> err.no Git - mapper/commitdiff
Use middle button on desktops to pan when clicking on map edges with middle button.
authorKaj-Michael Lang <milang@tal.org>
Fri, 11 Apr 2008 13:03:49 +0000 (16:03 +0300)
committerKaj-Michael Lang <milang@tal.org>
Fri, 11 Apr 2008 13:03:49 +0000 (16:03 +0300)
src/map.c

index c1f4a65e896cd457c85334b22ef660b48535a5cb..fc505e05c6b1dc01c462e02fe43f38a09a49a1f3 100644 (file)
--- 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->x<MAP_THUMB_MARGIN)
-               map_pan(-PAN_UNITS, 0);
-
-       if (event->x>(_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->y<MAP_THUMB_MARGIN)
-               map_pan(0, -PAN_UNITS);
-
-       if (event->y>(_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: