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

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

revision 67 by harbaum, Thu Aug 20 07:09:29 2009 UTC revision 68 by harbaum, Thu Aug 20 09:54:10 2009 UTC
# Line 2343  osm_gps_map_button_release (GtkWidget *w Line 2343  osm_gps_map_button_release (GtkWidget *w
2343  }  }
2344    
2345  static gboolean  static gboolean
2346    osm_gps_map_expose (GtkWidget *widget, GdkEventExpose  *event);
2347    
2348    static gboolean
2349  osm_gps_map_motion_notify (GtkWidget *widget, GdkEventMotion  *event)  osm_gps_map_motion_notify (GtkWidget *widget, GdkEventMotion  *event)
2350  {  {
2351      int x, y;      int x, y;
# Line 2371  osm_gps_map_motion_notify (GtkWidget *wi Line 2374  osm_gps_map_motion_notify (GtkWidget *wi
2374      if (priv->drag_counter < 6)      if (priv->drag_counter < 6)
2375          return FALSE;          return FALSE;
2376    
2377    #ifdef USE_MAEMO
2378        /* reduce update frequency on maemo to keep screen update fluid */
2379        static guint32 last_time = 0;
2380    
2381        if(event->time - last_time < 100) return FALSE;
2382        last_time = event->time;
2383    #endif
2384    
2385      priv->dragging = TRUE;      priv->dragging = TRUE;
2386    
2387      if (priv->map_auto_center)      if (priv->map_auto_center)
# Line 2389  osm_gps_map_motion_notify (GtkWidget *wi Line 2400  osm_gps_map_motion_notify (GtkWidget *wi
2400                                     -priv->drag_mouse_dy);                                     -priv->drag_mouse_dy);
2401  #endif  #endif
2402    
2403        osm_gps_map_expose (widget, NULL);
2404    
2405    
2406        return FALSE;
2407    }
2408    
2409    static gboolean
2410    osm_gps_map_configure (GtkWidget *widget, GdkEventConfigure *event)
2411    {
2412        OsmGpsMapPrivate *priv = OSM_GPS_MAP_PRIVATE(widget);
2413    
2414        /* create pixmap */
2415        if (priv->pixmap)
2416            g_object_unref (priv->pixmap);
2417    
2418        priv->pixmap = gdk_pixmap_new (
2419                                       widget->window,
2420                                       widget->allocation.width + EXTRA_BORDER * 2,
2421                                       widget->allocation.height + EXTRA_BORDER * 2,
2422                                       -1);
2423    
2424        /* and gc, used for clipping (I think......) */
2425        if(priv->gc_map)
2426            g_object_unref(priv->gc_map);
2427    
2428        priv->gc_map = gdk_gc_new(priv->pixmap);
2429    
2430        osm_gps_map_map_redraw(OSM_GPS_MAP(widget));
2431    
2432        return FALSE;
2433    }
2434    
2435    static gboolean
2436    osm_gps_map_expose (GtkWidget *widget, GdkEventExpose  *event)
2437    {
2438        OsmGpsMapPrivate *priv = OSM_GPS_MAP_PRIVATE(widget);
2439    
2440      gdk_draw_drawable (      gdk_draw_drawable (
2441                         widget->window,                         widget->window,
2442                         widget->style->fg_gc[GTK_WIDGET_STATE (widget)],                         widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
2443                         priv->pixmap,                         priv->pixmap,
2444                         0,0,                         0,0,
2445                         priv->drag_mouse_dx - EXTRA_BORDER, priv->drag_mouse_dy - EXTRA_BORDER,                         priv->drag_mouse_dx - EXTRA_BORDER,
2446                           priv->drag_mouse_dy - EXTRA_BORDER,
2447                         -1,-1);                         -1,-1);
2448    
2449      //Paint white outside of the map if dragging. Its less      //Paint white outside of the map if dragging. Its less
# Line 2438  osm_gps_map_motion_notify (GtkWidget *wi Line 2487  osm_gps_map_motion_notify (GtkWidget *wi
2487                              widget->allocation.width,                              widget->allocation.width,
2488                              -priv->drag_mouse_dy - EXTRA_BORDER);                              -priv->drag_mouse_dy - EXTRA_BORDER);
2489      }      }
2490    #if 0
2491      return FALSE;      if(!priv->dragging)
2492  }          gdk_draw_drawable (
   
 static gboolean  
 osm_gps_map_configure (GtkWidget *widget, GdkEventConfigure *event)  
 {  
     OsmGpsMapPrivate *priv = OSM_GPS_MAP_PRIVATE(widget);  
   
     /* create pixmap */  
     if (priv->pixmap)  
         g_object_unref (priv->pixmap);  
   
     priv->pixmap = gdk_pixmap_new (  
                                    widget->window,  
                                    widget->allocation.width + EXTRA_BORDER * 2,  
                                    widget->allocation.height + EXTRA_BORDER * 2,  
                                    -1);  
   
     /* and gc, used for clipping (I think......) */  
     if(priv->gc_map)  
         g_object_unref(priv->gc_map);  
   
     priv->gc_map = gdk_gc_new(priv->pixmap);  
   
     osm_gps_map_map_redraw(OSM_GPS_MAP(widget));  
   
     return FALSE;  
 }  
   
 static gboolean  
 osm_gps_map_expose (GtkWidget *widget, GdkEventExpose  *event)  
 {  
     OsmGpsMapPrivate *priv = OSM_GPS_MAP_PRIVATE(widget);  
   
     gdk_draw_drawable (  
2493                         widget->window,                         widget->window,
2494                         widget->style->fg_gc[GTK_WIDGET_STATE (widget)],                         widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
2495                         priv->pixmap,                         priv->pixmap,
# Line 2481  osm_gps_map_expose (GtkWidget *widget, G Line 2497  osm_gps_map_expose (GtkWidget *widget, G
2497                         event->area.y + EXTRA_BORDER,                         event->area.y + EXTRA_BORDER,
2498                         event->area.x, event->area.y,                         event->area.x, event->area.y,
2499                         event->area.width, event->area.height);                         event->area.width, event->area.height);
2500    #endif
2501      return FALSE;      return FALSE;
2502  }  }
2503    

Legend:
Removed from v.67  
changed lines
  Added in v.68