Diff of /trunk/src/osm-gps-map.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 114 by harbaum, Wed Sep 16 20:04:38 2009 UTC revision 121 by harbaum, Sun Sep 20 19:26:29 2009 UTC
# Line 149  struct _OsmGpsMapPrivate Line 149  struct _OsmGpsMapPrivate
149      int drag_start_mouse_y;      int drag_start_mouse_y;
150      int drag_start_map_x;      int drag_start_map_x;
151      int drag_start_map_y;      int drag_start_map_y;
152        guint drag_expose;
153    
154      //for customizing the redering of the gps track      //for customizing the redering of the gps track
155      int ui_gps_track_width;      int ui_gps_track_width;
# Line 1546  osm_gps_map_dispose (GObject *object) Line 1547  osm_gps_map_dispose (GObject *object)
1547      if (priv->idle_map_redraw != 0)      if (priv->idle_map_redraw != 0)
1548          g_source_remove (priv->idle_map_redraw);          g_source_remove (priv->idle_map_redraw);
1549    
1550        if (priv->drag_expose != 0)
1551            g_source_remove (priv->drag_expose);
1552    
1553      g_free(priv->gps);      g_free(priv->gps);
1554    
1555  #ifdef ENABLE_OSD  #ifdef ENABLE_OSD
# Line 1889  osm_gps_map_button_release (GtkWidget *w Line 1893  osm_gps_map_button_release (GtkWidget *w
1893          priv->osd->check(priv->osd, FALSE, event->x, event->y);          priv->osd->check(priv->osd, FALSE, event->x, event->y);
1894  #endif  #endif
1895    
   
1896  #ifdef DRAG_DEBUG  #ifdef DRAG_DEBUG
1897      printf("dragging done\n");      printf("dragging done\n");
1898  #endif  #endif
# Line 1903  static gboolean Line 1906  static gboolean
1906  osm_gps_map_expose (GtkWidget *widget, GdkEventExpose  *event);  osm_gps_map_expose (GtkWidget *widget, GdkEventExpose  *event);
1907    
1908  static gboolean  static gboolean
1909    osm_gps_map_map_expose (GtkWidget *widget)
1910    {
1911        OsmGpsMapPrivate *priv = OSM_GPS_MAP(widget)->priv;
1912    
1913        priv->drag_expose = 0;
1914        osm_gps_map_expose (widget, NULL);
1915        return FALSE;
1916    }
1917    
1918    static gboolean
1919  osm_gps_map_motion_notify (GtkWidget *widget, GdkEventMotion  *event)  osm_gps_map_motion_notify (GtkWidget *widget, GdkEventMotion  *event)
1920  {  {
1921      int x, y;      int x, y;
# Line 1925  osm_gps_map_motion_notify (GtkWidget *wi Line 1938  osm_gps_map_motion_notify (GtkWidget *wi
1938      if (priv->drag_counter < 0)      if (priv->drag_counter < 0)
1939          return FALSE;          return FALSE;
1940    
1941      priv->drag_counter++;      /* not yet dragged far enough? */
1942        if(!priv->drag_counter &&
1943      // we havent dragged more than 6 pixels         ( (x - priv->drag_start_mouse_x) * (x - priv->drag_start_mouse_x) +
1944      if (priv->drag_counter < 6)           (y - priv->drag_start_mouse_y) * (y - priv->drag_start_mouse_y) <
1945             10*10))
1946          return FALSE;          return FALSE;
1947    
1948  #ifdef OSM_GPS_MAP_REFRESH      priv->drag_counter++;
     /* reduce update frequency on maemo to keep screen update fluid */  
     static guint32 last_time = 0;  
   
     if(event->time - last_time < (1000/OSM_GPS_MAP_REFRESH)) return FALSE;  
     last_time = event->time;  
 #endif  
1949    
1950      priv->dragging = TRUE;      priv->dragging = TRUE;
1951    
# Line 1947  osm_gps_map_motion_notify (GtkWidget *wi Line 1955  osm_gps_map_motion_notify (GtkWidget *wi
1955      priv->drag_mouse_dx = x - priv->drag_start_mouse_x;      priv->drag_mouse_dx = x - priv->drag_start_mouse_x;
1956      priv->drag_mouse_dy = y - priv->drag_start_mouse_y;      priv->drag_mouse_dy = y - priv->drag_start_mouse_y;
1957    
1958      osm_gps_map_expose (widget, NULL);      /* instead of redrawing directly just add an idle function */
1959        if (!priv->drag_expose)
1960            priv->drag_expose =
1961                g_idle_add ((GSourceFunc)osm_gps_map_map_expose, widget);
1962    
1963      return FALSE;      return FALSE;
1964  }  }

Legend:
Removed from v.114  
changed lines
  Added in v.121