aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/stardict-view.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/stardict-view.c b/src/stardict-view.c
index 056c240..610b20a 100644
--- a/src/stardict-view.c
+++ b/src/stardict-view.c
@@ -659,11 +659,17 @@ reset_hover_for_event (StardictView *self, guint state, int x, int y)
if ((state &= gtk_accelerator_get_default_mod_mask ()) != GDK_CONTROL_MASK)
return;
+ GdkWindow *window = gtk_widget_get_window (GTK_WIDGET (self));
+ if (x < 0
+ || y < 0
+ || x >= gdk_window_get_width (window)
+ || y >= gdk_window_get_height (window))
+ return;
+
g_weak_ref_set (&self->hover,
locate_word_at (self, x, y, &self->hover_begin, &self->hover_end));
gtk_widget_queue_draw (GTK_WIDGET (self));
- GdkWindow *window = gtk_widget_get_window (GTK_WIDGET (self));
GdkCursor *cursor = gdk_cursor_new_from_name
(gdk_window_get_display (window), "pointer");
gdk_window_set_cursor (window, cursor);