Skip to content

Commit 9cfcc37

Browse files
author
lafricain79
committed
fix: use GDK_SELECTION_PRIMARY instead of GDK_SELECTION_CLIPBOARD for dictionary lookup on double-click
When double-clicking a word to look it up in the dictionary, Xiphos was reading GDK_SELECTION_CLIPBOARD, which is filled asynchronously by the WebKit COPY command. This caused a timing issue where the previous word was looked up instead of the newly selected one. The fix reads GDK_SELECTION_PRIMARY instead, which X11 fills automatically and synchronously when the user double-clicks a word, making it immediately available for the dictionary lookup. The now-redundant WebKit COPY block (#ifdef USE_WEBKIT2 ... #endif) has also been removed as it is no longer needed for this functionality. Fixes #1212
1 parent d4243f6 commit 9cfcc37

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/webkit/wk-html.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,7 @@ static gboolean button_release_handler(GtkWidget *widget, GdkEventButton *event)
6767
if (event->type == GDK_BUTTON_RELEASE && db_click) {
6868
XI_message((" button 1 = %s", "double click!\n"));
6969

70-
#ifdef USE_WEBKIT2
71-
webkit_web_view_execute_editing_command(WEBKIT_WEB_VIEW(widget),
72-
WEBKIT_EDITING_COMMAND_COPY);
73-
#else
74-
if (webkit_web_view_has_selection(WEBKIT_WEB_VIEW(widget))) {
75-
webkit_web_view_copy_clipboard(WEBKIT_WEB_VIEW(widget));
76-
}
77-
#endif
78-
GtkClipboard *clipboard = gtk_widget_get_clipboard(widget, GDK_SELECTION_CLIPBOARD);
70+
GtkClipboard *clipboard = gtk_widget_get_clipboard(widget, GDK_SELECTION_PRIMARY);
7971
gtk_clipboard_request_text(clipboard, gui_get_clipboard_text_for_lookup, NULL);
8072
}
8173

0 commit comments

Comments
 (0)