aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-09-12 04:00:26 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-09-12 04:00:26 +0200
commitae9952387a1006ad7ea52ffe2c2a411d12290be0 (patch)
treec41830700780303e68b7ebcc1059971d3a08d9e6 /src
parent27dcf87a642f6b5d63a1a4e5884d7a319a7601a2 (diff)
downloadtdv-ae9952387a1006ad7ea52ffe2c2a411d12290be0.tar.gz
tdv-ae9952387a1006ad7ea52ffe2c2a411d12290be0.tar.xz
tdv-ae9952387a1006ad7ea52ffe2c2a411d12290be0.zip
sdgui: don't highlight when cursor not on widget
Diffstat (limited to 'src')
-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);