summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2011-01-10 04:24:16 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2011-01-10 04:24:16 +0100
commitbd4ca0dd291280dd28ba3a94dce778b2f39ffb2b (patch)
tree478504ed4ea956ddf081308232bc25f3535a1065 /src
parenta3eaab63fff195610d61ddd6841d1b0257cf0596 (diff)
downloadlogdiag-bd4ca0dd291280dd28ba3a94dce778b2f39ffb2b.tar.gz
logdiag-bd4ca0dd291280dd28ba3a94dce778b2f39ffb2b.tar.xz
logdiag-bd4ca0dd291280dd28ba3a94dce778b2f39ffb2b.zip
Simulate motion events when needed.
Diffstat (limited to 'src')
-rw-r--r--src/ld-canvas.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/ld-canvas.c b/src/ld-canvas.c
index 1c48325..e41d014 100644
--- a/src/ld-canvas.c
+++ b/src/ld-canvas.c
@@ -9,6 +9,8 @@
*/
#include <math.h>
+#include <string.h>
+
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
@@ -187,6 +189,7 @@ static void diagram_disconnect_signals (LdCanvas *self);
static gdouble ld_canvas_get_base_unit_in_px (GtkWidget *self);
static gdouble ld_canvas_get_scale_in_px (LdCanvas *self);
+static void simulate_motion (LdCanvas *self);
static gboolean on_motion_notify (GtkWidget *widget, GdkEventMotion *event,
gpointer user_data);
static gboolean on_leave_notify (GtkWidget *widget, GdkEventCrossing *event,
@@ -799,10 +802,7 @@ ld_canvas_set_zoom (LdCanvas *self, gdouble zoom)
self->priv->zoom = clamped_zoom;
- /* TODO: Retrieve the position of the mouse and call
- * check_terminals() instead of just hiding the terminals.
- */
- hide_terminals (self);
+ simulate_motion (self);
update_adjustments (self);
gtk_widget_queue_draw (GTK_WIDGET (self));
@@ -1108,6 +1108,30 @@ queue_terminal_draw (LdCanvas *self, LdPoint *terminal)
queue_draw (self, &rect);
}
+static void
+simulate_motion (LdCanvas *self)
+{
+ GdkEventMotion event;
+ GtkWidget *widget;
+ gint x, y;
+ GdkModifierType state;
+
+ widget = GTK_WIDGET (self);
+
+ if (gdk_window_get_pointer (widget->window, &x, &y, &state)
+ != widget->window)
+ return;
+
+ memset (&event, 0, sizeof (event));
+ event.type = GDK_MOTION_NOTIFY;
+ event.window = widget->window;
+ event.x = x;
+ event.y = y;
+ event.state = state;
+
+ on_motion_notify (widget, &event, NULL);
+}
+
static gboolean
on_motion_notify (GtkWidget *widget, GdkEventMotion *event, gpointer user_data)
{