Added gtkhtml,libhildonhelp and maemopad
[oespirit1] / gtkhtml / gtkhtml_120_text_selection.diff
1 # Double-click initiates text selection
2 #
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.
6 #
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
19 @@ -193,6 +193,9 @@
20  /* Interval for scrolling during selection.  */
21  #define SCROLL_TIMEOUT_INTERVAL 10
22  
23 +/* Mouse move threshold for doubleclick check */
24 +#define MOUSE_DBLCLK_THRESHOLD 10
25 +
26  \f
27  GtkHTMLParagraphStyle
28  clueflow_style_to_paragraph_style (HTMLClueFlowStyle style, HTMLListType item_type)
29 @@ -1673,6 +1676,18 @@
30  
31         gdk_window_get_pointer (GTK_LAYOUT (widget)->bin_window, &x, &y, NULL);
32  
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);
37 +           
38 +           if (abs(x - html->selection_x1) <= MOUSE_DBLCLK_THRESHOLD && 
39 +               abs(y - html->selection_y1) <= MOUSE_DBLCLK_THRESHOLD)
40 +               return TRUE;
41 +               
42 +           html->simple_dblclick = FALSE;
43 +       }
44 +       
45         if (!mouse_change_pos (widget, window, x, y, event->state))
46                 return FALSE;
47  
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;
56                 }
57                 else if (event->type == GDK_3BUTTON_PRESS) {
58                         /*html->in_selection_drag = FALSE;
59 @@ -1935,7 +1954,8 @@
60  
61         engine =  html->engine;
62  
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);
71                         }   
72                 }
73 +               
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);
78 +               }
79         }
80  
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
94 @@ -68,6 +68,10 @@
95  
96         guint debug : 1;
97         guint allow_selection : 1;
98 +       
99 +       /* Dbl-clk variables */
100 +       
101 +       guint simple_dblclick : 1;
102  
103         guint hadj_connection;
104         guint vadj_connection;