From: Kaj-Michael Lang Date: Tue, 22 Jan 2008 23:15:24 +0000 (+0200) Subject: Check for POI on button release. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3879d88658b210cd7b6e99cbf9f39ba5022333aa;p=mapper Check for POI on button release. --- diff --git a/src/map.c b/src/map.c index 0a37589..194e5e6 100644 --- a/src/map.c +++ b/src/map.c @@ -1280,10 +1280,6 @@ return FALSE; static gboolean map_cb_button_press(GtkWidget * widget, GdkEventButton * event) { -gdouble lat, lon; -guint poi_id; -gint ux, uy; - _cmenu_position_x = event->x + 0.5; _cmenu_position_y = event->y + 0.5; @@ -1302,16 +1298,7 @@ case 1: return FALSE; } - ux=x2unit(_cmenu_position_x); - uy=y2unit(_cmenu_position_y); - - unit2latlon(ux, uy, lat, lon); - if (map_poi_find_at_latlon(lat, lon, &poi_id)==TRUE) { - g_printf("POI: %d\n", poi_id); - g_idle_add_full(G_PRIORITY_HIGH_IDLE,(GSourceFunc)map_cb_show_poi_info_dialog, GINT_TO_POINTER(poi_id), NULL); - } else { - map_drag_start(event->x, event->y); - } + map_drag_start(event->x, event->y); return FALSE; break; case 2: @@ -1330,6 +1317,10 @@ return FALSE; static gboolean map_cb_button_release(GtkWidget *widget, GdkEventButton *event) { +gdouble lat, lon; +guint poi_id; +gint ux, uy; + g_printf("BtnRelease\n"); switch (event->button) { case 1: @@ -1348,12 +1339,20 @@ case 1: case MAP_MODE_SET_ROUTE_TO: break; default: - map_drag_stop(event->x, event->y); + ux=x2unit(_cmenu_position_x); + uy=y2unit(_cmenu_position_y); + + unit2latlon(ux, uy, lat, lon); + if (map_poi_find_at_latlon(lat, lon, &poi_id)==TRUE) { + g_printf("POI: %d\n", poi_id); + g_idle_add_full(G_PRIORITY_HIGH_IDLE,(GSourceFunc)map_cb_show_poi_info_dialog, GINT_TO_POINTER(poi_id), NULL); + } if (map_data_needs_refresh==TRUE) { map_data_needs_refresh=FALSE; map_render_data(); g_idle_add_full(G_PRIORITY_HIGH_IDLE,(GSourceFunc)map_update_location_from_center, NULL, NULL); } + map_drag_stop(event->x, event->y); break; } break;