From: Kaj-Michael Lang Date: Tue, 15 Apr 2008 09:54:44 +0000 (+0300) Subject: sigh, try to fix thumb scrolling and map popup-menu. Move thumb code to button up... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e0f1bda1b4649044c88622653f7f4ce7af77706;p=mapper sigh, try to fix thumb scrolling and map popup-menu. Move thumb code to button up event. --- diff --git a/src/map.c b/src/map.c index 6b95bdc..a1ceeb8 100644 --- a/src/map.c +++ b/src/map.c @@ -1450,31 +1450,6 @@ 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_X)) - pns=PAN_UNITS; - - if (event->yy>(_screen_height_pixels-MAP_THUMB_MARGIN_Y)) - pew=PAN_UNITS; - - if (pns!=0 || pew!=0) { - map_pan(pns, pew); - g_debug("MPAN: %d, %d", pns, pew); - return FALSE; - } -} - switch (event->button) { case 1: if (event->type==GDK_2BUTTON_PRESS) { @@ -1507,6 +1482,29 @@ break; return FALSE; } +static void +map_pan_click_check(gint x, gint y) +{ +gint pns=0, pew=0; + +if (x(_screen_width_pixels-MAP_THUMB_MARGIN_X)) + pns=PAN_UNITS; + +if (y(_screen_height_pixels-MAP_THUMB_MARGIN_Y)) + pew=PAN_UNITS; + +if (pns!=0 || pew!=0) { + map_pan(pns, pew); + g_debug("MPAN: %d, %d", pns, pew); + return TRUE; +} +return FALSE; +} + static gboolean map_cb_button_release(GtkWidget *widget, GdkEventButton *event) { @@ -1514,17 +1512,16 @@ gdouble lat, lon; guint poi_id; gint ux, uy; -#if defined(WITH_HILDON_NEW) -if (hildon_helper_event_button_is_finger(event)) { - g_debug("Thumb up"); - return FALSE; -} -#endif - switch (event->button) { case 1: - if (_center_mode>0) - set_action_activate("autocenter_none", TRUE); + +#if defined(WITH_HILDON_NEW) + if (hildon_helper_event_button_is_finger(event)) { + g_debug("Thumb down"); + if (map_pan_click_check(event->x, event->y)) + return FALSE; + } +#endif switch (map_mode) { case MAP_MODE_DRAW_TRACK: @@ -1550,14 +1547,18 @@ case 1: map_render_data(); g_idle_add_full(G_PRIORITY_HIGH_IDLE,(GSourceFunc)map_update_location_from_center, NULL, NULL); } + if (_center_mode>0) + set_action_activate("autocenter_none", TRUE); map_drag_stop(event->x, event->y); break; } break; case 2: - /* */ + map_pan_click_check(event->x, event->y); + return FALSE; break; case 3: + /* */ break; }