From 77184b5f878c0be920786f089c2fedd1892caf00 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Thu, 10 Apr 2008 18:32:56 +0300 Subject: [PATCH] For tablets, add map panning using thumbs. --- src/map.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/map.c b/src/map.c index 3f5ec9d..6103601 100644 --- a/src/map.c +++ b/src/map.c @@ -64,6 +64,8 @@ #define DEBUG_MAP_TIME 1 +#define MAP_THUMB_MARGIN (20) + /* Initial size */ #define BUF_WIDTH_TILES (4) #define BUF_HEIGHT_TILES (3) @@ -225,6 +227,9 @@ g_signal_connect(G_OBJECT(map_widget), "scroll_event", G_CALLBACK(map_cb_scroll gtk_widget_add_events(map_widget, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK); +#ifdef WITH_HILDON +gtk_widget_set_extension_events(GTK_WIDGET(map_widget), GDK_EXTENSION_EVENTS_ALL); +#endif map_poi_init(map_widget); @@ -1427,11 +1432,30 @@ return FALSE; } static gboolean -map_cb_button_press(GtkWidget * widget, GdkEventButton * event) +map_cb_button_press(GtkWidget *widget, GdkEventButton *event) { _cmenu_position_x = event->x + 0.5; _cmenu_position_y = event->y + 0.5; +#if defined(WITH_HILDON_NEW) +if (hildon_helper_event_button_is_finger(event)) { + if (event->xx>(_screen_width_pixels-MAP_THUMB_MARGIN)) + map_pan(PAN_UNITS, 0); + + if (event->yy>(_screen_height_pixels-MAP_THUMB_MARGIN)) + map_pan(0, PAN_UNITS); + + return FALSE; +} +#endif + + switch (event->button) { case 1: if (event->type==GDK_2BUTTON_PRESS) { -- 2.39.5