From a5658c2745ad24fcbd85d50a71261756e96b66a1 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Wed, 19 Mar 2008 00:06:07 +0200 Subject: [PATCH] Do a full redraw only if a drag did happen. --- src/map.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/map.c b/src/map.c index ec5066b..a39e8f0 100644 --- a/src/map.c +++ b/src/map.c @@ -108,6 +108,7 @@ static guint press[2] = { 0, 0 }; static guint release[2] = { 0, 0 }; static guint before[2] = { 0, 0 }; static guint map_drag_id = 0; +static gboolean map_dragged; /** VARIABLES FOR ACCESSING THE LOCATION/BOUNDS OF THE CURRENT MARK. */ static gint mark_x1; @@ -162,6 +163,8 @@ GtkWidget *map_widget; map_widget=gtk_drawing_area_new(); map_timer=g_timer_new(); +g_debug("World size: %u", WORLD_SIZE_UNITS); + #ifdef WITH_GL map_gl_config=gdk_gl_config_new_by_mode(GDK_GL_MODE_RGB | GDK_GL_MODE_DEPTH); if (map_gl_config) { @@ -934,8 +937,10 @@ gint xx, yy; guint unitx, unity, nunitx, nunity; guint cx, cy; -if (!(event->state & GDK_BUTTON1_MASK)) - return FALSE; +if (!(event->state & GDK_BUTTON1_MASK)) { + map_drag_id=0; + return TRUE; +} if (event->is_hint) { gdk_window_get_pointer(event->window, &xx, &yy, &state); @@ -956,6 +961,7 @@ nunity=y2unit((gint) (cy - (yy - before[1]))); map_center_unit(nunitx, nunity); +map_dragged=TRUE; g_debug("MAP PAN: %d %d %d %d (%d, %d)", cx, cy, xx, yy, nunitx, nunity); before[0] = xx; before[1] = yy; @@ -1344,7 +1350,7 @@ before[1] = press[1]; _center_mode=CENTER_MANUAL; if (map_drag_id!=0) g_signal_handler_disconnect(G_OBJECT(_map_widget), map_drag_id); - +map_dragged=FALSE; map_drag_id=g_signal_connect(G_OBJECT(_map_widget), "motion_notify_event", G_CALLBACK(map_follow_move_cb), NULL); } @@ -1368,7 +1374,8 @@ release[1]=0; before[0]=0; before[1]=0; map_drag_id=0; -map_force_redraw(); +if (map_dragged==TRUE) + map_force_redraw(); } /* Workaround hildon content menu problem */ @@ -1395,9 +1402,11 @@ case 1: map_set_zoom(_zoom-1); #endif map_data_needs_refresh=TRUE; + map_drag_stop(event->x, event->y); return FALSE; } if (event->type==GDK_3BUTTON_PRESS) { + map_drag_stop(event->x, event->y); return FALSE; } @@ -1446,7 +1455,7 @@ case 1: unit2latlon(ux, uy, lat, lon); if (map_poi_find_at_latlon(lat, lon, &poi_id)==TRUE) { - g_debug("POI: %d\n", poi_id); + g_debug("POI: %d", 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) { -- 2.39.5