1 # Double-click initiates text selection
3 # Copyright (C) 2006 - 2007 Nokia Corporation.
4 # This file is distributed under the terms of GNU LGPL license, either version 2
5 # of the License, or (at your option) any later version.
7 diff -ru gtkhtml-3.24.4/gtkhtml/gtkhtml.c gtkhtml-3.24.4/gtkhtml/gtkhtml.c
8 diff -ru gtkhtml-3.24.4/gtkhtml/gtkhtml.c gtkhtml-3.24.4/gtkhtml/gtkhtml.c
9 diff -ru gtkhtml-3.24.4/gtkhtml/gtkhtml.c gtkhtml-3.24.4/gtkhtml/gtkhtml.c
10 diff -ru gtkhtml-3.24.4/gtkhtml/gtkhtml.c gtkhtml-3.24.4/gtkhtml/gtkhtml.c
11 --- gtkhtml-3.24.4/gtkhtml/gtkhtml.c 2007-02-16 15:40:30.000000000 +0200
12 --- gtkhtml-3.24.4/gtkhtml/gtkhtml.c 2007-02-16 15:40:30.000000000 +0200
13 --- gtkhtml-3.24.4/gtkhtml/gtkhtml.c 2007-02-16 15:40:30.000000000 +0200
14 --- gtkhtml-3.24.4/gtkhtml/gtkhtml.c 2007-02-16 15:40:30.000000000 +0200
15 +++ gtkhtml-3.24.4/gtkhtml/gtkhtml.c 2007-02-16 15:56:22.000000000 +0200
16 +++ gtkhtml-3.24.4/gtkhtml/gtkhtml.c 2007-02-16 15:56:22.000000000 +0200
17 +++ gtkhtml-3.24.4/gtkhtml/gtkhtml.c 2007-02-16 15:56:22.000000000 +0200
18 +++ gtkhtml-3.24.4/gtkhtml/gtkhtml.c 2007-02-16 15:56:22.000000000 +0200
20 /* Interval for scrolling during selection. */
21 #define SCROLL_TIMEOUT_INTERVAL 10
23 +/* Mouse move threshold for doubleclick check */
24 +#define MOUSE_DBLCLK_THRESHOLD 10
28 clueflow_style_to_paragraph_style (HTMLClueFlowStyle style, HTMLListType item_type)
29 @@ -1673,6 +1676,18 @@
31 gdk_window_get_pointer (GTK_LAYOUT (widget)->bin_window, &x, &y, NULL);
33 + /* If there is only a small motion from the origin and simple
34 + doubleclick is active, abort the motion, otherwise clear simple_dblclick flag */
35 + if (GTK_HTML (widget)->simple_dblclick) {
36 + GtkHTML *html = GTK_HTML (widget);
38 + if (abs(x - html->selection_x1) <= MOUSE_DBLCLK_THRESHOLD &&
39 + abs(y - html->selection_y1) <= MOUSE_DBLCLK_THRESHOLD)
42 + html->simple_dblclick = FALSE;
45 if (!mouse_change_pos (widget, window, x, y, event->state))
48 @@ -1897,6 +1912,10 @@
49 html->in_selection_drag = TRUE;
50 html->panning = FALSE;
51 html->in_selection = TRUE;
52 + /* Check for simple double click, for selecting a word */
53 + html->simple_dblclick = TRUE;
54 + html->selection_x1 = x;
55 + html->selection_y1 = y;
57 else if (event->type == GDK_3BUTTON_PRESS) {
58 /*html->in_selection_drag = FALSE;
61 engine = html->engine;
63 - if (html->in_selection) {
64 + /* If it is a simple doubleclick don't allow the selection */
65 + if (html->in_selection && !html->simple_dblclick) {
66 html_engine_update_selection_active_state (html->engine, html->priv->event_time);
67 if (html->in_selection_drag)
68 html_engine_select_region (engine, html->selection_x1, html->selection_y1,
69 @@ -1961,6 +1981,12 @@
70 html_text_set_link_visited (HTML_TEXT(focus_object), focus_object_offset, html->engine, TRUE);
74 + /* If it was a simple doubleclick select a word */
75 + if (html->simple_dblclick) {
76 + html->simple_dblclick = FALSE;
77 + gtk_html_select_word(html);
81 html->in_selection = FALSE;
82 diff -ru gtkhtml-3.24.4/gtkhtml/gtkhtml.h gtkhtml-3.24.4/gtkhtml/gtkhtml.h
83 diff -ru gtkhtml-3.24.4/gtkhtml/gtkhtml.h gtkhtml-3.24.4/gtkhtml/gtkhtml.h
84 diff -ru gtkhtml-3.24.4/gtkhtml/gtkhtml.h gtkhtml-3.24.4/gtkhtml/gtkhtml.h
85 diff -ru gtkhtml-3.24.4/gtkhtml/gtkhtml.h gtkhtml-3.24.4/gtkhtml/gtkhtml.h
86 --- gtkhtml-3.24.4/gtkhtml/gtkhtml.h 2007-02-16 15:40:30.000000000 +0200
87 --- gtkhtml-3.24.4/gtkhtml/gtkhtml.h 2007-02-16 15:40:30.000000000 +0200
88 --- gtkhtml-3.24.4/gtkhtml/gtkhtml.h 2007-02-16 15:40:30.000000000 +0200
89 --- gtkhtml-3.24.4/gtkhtml/gtkhtml.h 2007-02-16 15:40:30.000000000 +0200
90 +++ gtkhtml-3.24.4/gtkhtml/gtkhtml.h 2007-02-16 15:56:22.000000000 +0200
91 +++ gtkhtml-3.24.4/gtkhtml/gtkhtml.h 2007-02-16 15:56:22.000000000 +0200
92 +++ gtkhtml-3.24.4/gtkhtml/gtkhtml.h 2007-02-16 15:56:22.000000000 +0200
93 +++ gtkhtml-3.24.4/gtkhtml/gtkhtml.h 2007-02-16 15:56:22.000000000 +0200
97 guint allow_selection : 1;
99 + /* Dbl-clk variables */
101 + guint simple_dblclick : 1;
103 guint hadj_connection;
104 guint vadj_connection;