From 03190db824e1ec142ccf428863011da476d8b210 Mon Sep 17 00:00:00 2001 From: Kaj-Michael Lang Date: Thu, 8 May 2008 16:53:50 +0300 Subject: [PATCH] Map widget: - Add mouse tracking testing --- src/gtkmap.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/gtkmap.c b/src/gtkmap.c index 8316aa3..b745b5c 100644 --- a/src/gtkmap.c +++ b/src/gtkmap.c @@ -173,6 +173,12 @@ struct _GtkMapPriv guint draw_width; + gboolean button_down; + gint mouse_x; + gint mouse_y; + gdouble mouse_lat; + gdouble mouse_lon; + gboolean fast_render; guint key_zoom_new; @@ -399,6 +405,7 @@ priv->show_velvec=TRUE; priv->show_markers=TRUE; priv->show_location=TRUE; +priv->button_down=FALSE; priv->click_to_center=FALSE; priv->zoom_in_on_2button=FALSE; @@ -1576,6 +1583,18 @@ return FALSE; static gboolean gtk_map_motion_notify_cb(GtkWidget *widget, GdkEventMotion *event, gpointer data) { +GtkMap *map; +GtkMapPriv *priv; + +g_return_val_if_fail(GTK_IS_MAP(widget), FALSE); +map=GTK_MAP(widget); +priv=GTK_MAP_GET_PRIVATE(map); + +priv->mouse_x=(gint)event->x; +priv->mouse_y=(gint)event->y; +unit2latlon(x2unit((gint) (event->x+0.5)), y2unit((gint) (event->y+0.5)), priv->mouse_lat, priv->mouse_lon); + +g_debug("MOUSE: %d,%d (%f,%f)", priv->mouse_x, priv->mouse_y, priv->mouse_lat, priv->mouse_lon); return FALSE; } @@ -1592,6 +1611,7 @@ priv=GTK_MAP_GET_PRIVATE(map); switch (event->button) { case 1: + priv->button_down=TRUE; if (priv->click_to_center) { gtk_map_set_center(widget, x2unit((gint) (event->x+0.5)), y2unit((gint) (event->y+0.5))); return FALSE; @@ -1625,7 +1645,7 @@ priv=GTK_MAP_GET_PRIVATE(map); switch (event->button) { case 1: - + priv->button_down=FALSE; break; case 2: -- 2.39.5