Merge lp:~bregma/evince/ubuntu-natty into lp:~ubuntu-desktop/evince/ubuntu
- ubuntu-natty
- Merge into ubuntu
Proposed by
Stephen M. Webb
Status: | Rejected |
---|---|
Rejected by: | Sebastien Bacher |
Proposed branch: | lp:~bregma/evince/ubuntu-natty |
Merge into: | lp:~ubuntu-desktop/evince/ubuntu |
Diff against target: |
678 lines (+636/-0) 5 files modified
debian/changelog (+6/-0) debian/control.in (+1/-0) debian/patches/07_utouch-gestures.patch (+627/-0) debian/patches/series (+1/-0) debian/rules (+1/-0) |
To merge this branch: | bzr merge lp:~bregma/evince/ubuntu-natty |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Desktop | Pending | ||
Review via email: mp+54568@code.launchpad.net |
Commit message
Description of the change
Adds uTouch multi-touch gesture handling via libgrip.
This is targetted at natty release.
To post a comment you must log in.
lp:~bregma/evince/ubuntu-natty
updated
- 116. By Stephen M. Webb
-
Added multi-touch gesture support through libgrip.
Unmerged revisions
- 116. By Stephen M. Webb
-
Added multi-touch gesture support through libgrip.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'debian/changelog' | |||
2 | --- debian/changelog 2011-03-22 18:38:58 +0000 | |||
3 | +++ debian/changelog 2011-03-23 21:23:34 +0000 | |||
4 | @@ -1,3 +1,9 @@ | |||
5 | 1 | evince (2.32.0-0ubuntu13) UNRELEASED; urgency=low | ||
6 | 2 | |||
7 | 3 | * Added multi-touch gesture support through libgrip (LP: #741242). | ||
8 | 4 | |||
9 | 5 | -- Stephen M. Webb <stephen.webb@canonical.com> Mon, 21 Mar 2011 17:28:15 -0400 | ||
10 | 6 | |||
11 | 1 | evince (2.32.0-0ubuntu12) natty; urgency=low | 7 | evince (2.32.0-0ubuntu12) natty; urgency=low |
12 | 2 | 8 | ||
13 | 3 | * debian/rules: update the translation template in the correct directory | 9 | * debian/rules: update the translation template in the correct directory |
14 | 4 | 10 | ||
15 | === modified file 'debian/control.in' | |||
16 | --- debian/control.in 2011-01-07 16:38:17 +0000 | |||
17 | +++ debian/control.in 2011-03-23 21:23:34 +0000 | |||
18 | @@ -17,6 +17,7 @@ | |||
19 | 17 | libcairo2-dev (>= 1.9.10), | 17 | libcairo2-dev (>= 1.9.10), |
20 | 18 | libgtk2.0-dev (>= 2.21.5), | 18 | libgtk2.0-dev (>= 2.21.5), |
21 | 19 | libglib2.0-dev (>= 2.25.11), | 19 | libglib2.0-dev (>= 2.25.11), |
22 | 20 | libgrip-0.1-dev (>= 0.1.1), | ||
23 | 20 | libgail-dev (>= 2.21.5), | 21 | libgail-dev (>= 2.21.5), |
24 | 21 | libgnome-keyring-dev (>= 2.22.0), | 22 | libgnome-keyring-dev (>= 2.22.0), |
25 | 22 | gnome-icon-theme (>= 2.17.1), | 23 | gnome-icon-theme (>= 2.17.1), |
26 | 23 | 24 | ||
27 | === added file 'debian/patches/07_utouch-gestures.patch' | |||
28 | --- debian/patches/07_utouch-gestures.patch 1970-01-01 00:00:00 +0000 | |||
29 | +++ debian/patches/07_utouch-gestures.patch 2011-03-23 21:23:34 +0000 | |||
30 | @@ -0,0 +1,627 @@ | |||
31 | 1 | --- a/configure.ac | ||
32 | 2 | +++ b/configure.ac | ||
33 | 3 | @@ -335,6 +335,17 @@ | ||
34 | 4 | AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL],false) | ||
35 | 5 | fi | ||
36 | 6 | |||
37 | 7 | +# **************** | ||
38 | 8 | +# uTouch (optional) | ||
39 | 9 | +# **************** | ||
40 | 10 | +GRIP_REQUIRED=0.1.0 | ||
41 | 11 | + | ||
42 | 12 | +AC_ARG_WITH([libgrip], AC_HELP_STRING([--with-libgrip], [enable libgrip support])) | ||
43 | 13 | +AS_IF([test "x$with_libgrip" = "xyes"],[ | ||
44 | 14 | + PKG_CHECK_MODULES([LIBGRIP], [libgrip-0.1 >= $GRIP_REQUIRED], | ||
45 | 15 | + [AC_DEFINE(HAVE_LIBGRIP, 1, [libgrip support])]) | ||
46 | 16 | +]) | ||
47 | 17 | + | ||
48 | 18 | dnl Debug mode | ||
49 | 19 | |||
50 | 20 | AC_ARG_ENABLE([debug], | ||
51 | 21 | @@ -359,8 +370,8 @@ | ||
52 | 22 | AC_SUBST(LIBDOCUMENT_CFLAGS) | ||
53 | 23 | AC_SUBST(LIBDOCUMENT_LIBS) | ||
54 | 24 | |||
55 | 25 | -LIBVIEW_CFLAGS="$LIBVIEW_CFLAGS $GTKUNIXPRINT_CFLAGS $DEBUG_FLAGS" | ||
56 | 26 | -LIBVIEW_LIBS="$LIBVIEW_LIBS $GTKUNIXPRINT_LIBS -lm" | ||
57 | 27 | +LIBVIEW_CFLAGS="$LIBVIEW_CFLAGS $GTKUNIXPRINT_CFLAGS $LIBGRIP_CFLAGS $DEBUG_FLAGS" | ||
58 | 28 | +LIBVIEW_LIBS="$LIBVIEW_LIBS $GTKUNIXPRINT_LIBS $LIBGRIP_LIBS -lm" | ||
59 | 29 | AC_SUBST(LIBVIEW_CFLAGS) | ||
60 | 30 | AC_SUBST(LIBVIEW_LIBS) | ||
61 | 31 | |||
62 | 32 | --- a/libview/ev-view-private.h | ||
63 | 33 | +++ b/libview/ev-view-private.h | ||
64 | 34 | @@ -193,6 +193,16 @@ | ||
65 | 35 | |||
66 | 36 | /* Accessibility */ | ||
67 | 37 | gboolean a11y_enabled; | ||
68 | 38 | + | ||
69 | 39 | +#ifdef HAVE_LIBGRIP | ||
70 | 40 | + /* Gesture state */ | ||
71 | 41 | + gboolean enable_gestures; | ||
72 | 42 | + gdouble drag_start_x; | ||
73 | 43 | + gdouble drag_start_y; | ||
74 | 44 | + gdouble pinch_start_x; | ||
75 | 45 | + gdouble pinch_start_y; | ||
76 | 46 | + gdouble pinch_start_radius; | ||
77 | 47 | +#endif | ||
78 | 48 | }; | ||
79 | 49 | |||
80 | 50 | struct _EvViewClass { | ||
81 | 51 | --- a/libview/ev-view.c | ||
82 | 52 | +++ b/libview/ev-view.c | ||
83 | 53 | @@ -28,6 +28,10 @@ | ||
84 | 54 | #include <gtk/gtk.h> | ||
85 | 55 | #include <gdk/gdkkeysyms.h> | ||
86 | 56 | |||
87 | 57 | +#ifdef HAVE_LIBGRIP | ||
88 | 58 | +#include <libgrip/gripgesturemanager.h> | ||
89 | 59 | +#endif | ||
90 | 60 | + | ||
91 | 61 | #include "ev-mapping-list.h" | ||
92 | 62 | #include "ev-document-forms.h" | ||
93 | 63 | #include "ev-document-images.h" | ||
94 | 64 | @@ -48,6 +52,13 @@ | ||
95 | 65 | #define EV_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EV_TYPE_VIEW)) | ||
96 | 66 | #define EV_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EV_TYPE_VIEW, EvViewClass)) | ||
97 | 67 | |||
98 | 68 | +#ifdef HAVE_LIBGRIP | ||
99 | 69 | +enum { | ||
100 | 70 | + PROP_0, | ||
101 | 71 | + PROP_ENABLE_GESTURES | ||
102 | 72 | +}; | ||
103 | 73 | +#endif | ||
104 | 74 | + | ||
105 | 75 | enum { | ||
106 | 76 | SIGNAL_BINDING_ACTIVATED, | ||
107 | 77 | SIGNAL_HANDLE_LINK, | ||
108 | 78 | @@ -75,6 +86,11 @@ | ||
109 | 79 | #define ZOOM_IN_FACTOR 1.2 | ||
110 | 80 | #define ZOOM_OUT_FACTOR (1.0/ZOOM_IN_FACTOR) | ||
111 | 81 | |||
112 | 82 | +#ifdef HAVE_LIBGRIP | ||
113 | 83 | +#define GESTURE_DRAG_VELOCITY 1.0 | ||
114 | 84 | +#define GESTURE_ROTATE_ANGLE 1.0 | ||
115 | 85 | +#endif | ||
116 | 86 | + | ||
117 | 87 | #define SCROLL_TIME 150 | ||
118 | 88 | |||
119 | 89 | /*** Scrolling ***/ | ||
120 | 90 | @@ -140,6 +156,16 @@ | ||
121 | 91 | static void hide_annotation_windows (EvView *view, | ||
122 | 92 | gint page); | ||
123 | 93 | /*** GtkWidget implementation ***/ | ||
124 | 94 | +#ifdef HAVE_LIBGRIP | ||
125 | 95 | +static void ev_view_get_property (GObject *object, | ||
126 | 96 | + guint prop_id, | ||
127 | 97 | + GValue *value, | ||
128 | 98 | + GParamSpec *param_spec); | ||
129 | 99 | +static void ev_view_set_property (GObject *object, | ||
130 | 100 | + guint prop_id, | ||
131 | 101 | + const GValue *value, | ||
132 | 102 | + GParamSpec *param_spec); | ||
133 | 103 | +#endif | ||
134 | 104 | static void ev_view_size_request_continuous_dual_page (EvView *view, | ||
135 | 105 | GtkRequisition *requisition); | ||
136 | 106 | static void ev_view_size_request_continuous (EvView *view, | ||
137 | 107 | @@ -277,6 +303,14 @@ | ||
138 | 108 | gpointer data); | ||
139 | 109 | static void ev_view_update_primary_selection (EvView *ev_view); | ||
140 | 110 | |||
141 | 111 | +/*** Gestures ***/ | ||
142 | 112 | +#ifdef HAVE_LIBGRIP | ||
143 | 113 | +static void ev_gesture_callback (GtkWidget *widget, | ||
144 | 114 | + GripTimeType time_type, | ||
145 | 115 | + GripGestureEvent *event, | ||
146 | 116 | + gpointer user_data); | ||
147 | 117 | +#endif | ||
148 | 118 | + | ||
149 | 119 | G_DEFINE_TYPE (EvView, ev_view, GTK_TYPE_LAYOUT) | ||
150 | 120 | |||
151 | 121 | /* HeightToPage cache */ | ||
152 | 122 | @@ -2942,6 +2976,116 @@ | ||
153 | 123 | return FALSE; | ||
154 | 124 | } | ||
155 | 125 | |||
156 | 126 | +#ifdef HAVE_LIBGRIP | ||
157 | 127 | +/*** Gesture implementation ***/ | ||
158 | 128 | +static void | ||
159 | 129 | +ev_gesture_callback (GtkWidget *widget, | ||
160 | 130 | + GripTimeType time_type, | ||
161 | 131 | + GripGestureEvent *event, | ||
162 | 132 | + gpointer user_data) | ||
163 | 133 | +{ | ||
164 | 134 | + EvView *view = EV_VIEW (widget); | ||
165 | 135 | + | ||
166 | 136 | + if (time_type == GRIP_TIME_START) { | ||
167 | 137 | + switch (event->type) { | ||
168 | 138 | + case GRIP_GESTURE_DRAG: { | ||
169 | 139 | + GripEventGestureDrag *drag = (GripEventGestureDrag *)event; | ||
170 | 140 | + | ||
171 | 141 | + view->drag_start_x = drag->position_x; | ||
172 | 142 | + view->drag_start_y = drag->position_y; | ||
173 | 143 | + | ||
174 | 144 | + break; | ||
175 | 145 | + } | ||
176 | 146 | + | ||
177 | 147 | + case GRIP_GESTURE_PINCH: { | ||
178 | 148 | + GripEventGesturePinch *pinch = (GripEventGesturePinch *)event; | ||
179 | 149 | + | ||
180 | 150 | + view->pinch_start_x = pinch->focus_x; | ||
181 | 151 | + view->pinch_start_y = pinch->focus_y; | ||
182 | 152 | + view->pinch_start_radius = pinch->radius; | ||
183 | 153 | + break; | ||
184 | 154 | + } | ||
185 | 155 | + | ||
186 | 156 | + default: | ||
187 | 157 | + break; | ||
188 | 158 | + } | ||
189 | 159 | + } else if (time_type == GRIP_TIME_END) { | ||
190 | 160 | + switch (event->type) { | ||
191 | 161 | + case GRIP_GESTURE_DRAG: { | ||
192 | 162 | + GripEventGestureDrag *drag = (GripEventGestureDrag *)event; | ||
193 | 163 | + | ||
194 | 164 | + if (drag->velocity_y >= GESTURE_DRAG_VELOCITY && | ||
195 | 165 | + drag->position_y > view->drag_start_y) { | ||
196 | 166 | + ev_view_previous_page (view); | ||
197 | 167 | + } else if (drag->velocity_y <= -GESTURE_DRAG_VELOCITY && | ||
198 | 168 | + drag->position_y < view->drag_start_y) { | ||
199 | 169 | + ev_view_next_page (view); | ||
200 | 170 | + } else if (drag->velocity_x >= GESTURE_DRAG_VELOCITY && | ||
201 | 171 | + drag->position_x > view->drag_start_x) { | ||
202 | 172 | + ev_view_previous_page (view); | ||
203 | 173 | + } else if (drag->velocity_x <= -GESTURE_DRAG_VELOCITY && | ||
204 | 174 | + drag->position_x < view->drag_start_x) { | ||
205 | 175 | + ev_view_next_page (view); | ||
206 | 176 | + } | ||
207 | 177 | + | ||
208 | 178 | + break; | ||
209 | 179 | + } | ||
210 | 180 | + | ||
211 | 181 | + case GRIP_GESTURE_ROTATE: { | ||
212 | 182 | + GripEventGestureRotate *rotate = (GripEventGestureRotate *)event; | ||
213 | 183 | + gint rotation = ev_document_model_get_rotation (view->model); | ||
214 | 184 | + | ||
215 | 185 | + if (rotate->angle >= GESTURE_ROTATE_ANGLE) { | ||
216 | 186 | + ev_document_model_set_rotation (view->model, | ||
217 | 187 | + rotation + 90); | ||
218 | 188 | + } else if (rotate->angle <= -GESTURE_ROTATE_ANGLE) { | ||
219 | 189 | + ev_document_model_set_rotation (view->model, | ||
220 | 190 | + rotation - 90); | ||
221 | 191 | + } | ||
222 | 192 | + | ||
223 | 193 | + break; | ||
224 | 194 | + } | ||
225 | 195 | + | ||
226 | 196 | + default: | ||
227 | 197 | + break; | ||
228 | 198 | + } | ||
229 | 199 | + } else { | ||
230 | 200 | + switch (event->type) { | ||
231 | 201 | + case GRIP_GESTURE_PINCH: { | ||
232 | 202 | + GripEventGesturePinch *pinch = (GripEventGesturePinch *)event; | ||
233 | 203 | + gdouble increment = pinch->radius_delta * 0.01; | ||
234 | 204 | + | ||
235 | 205 | + if (increment < 0.0) increment = -increment; | ||
236 | 206 | + increment += 1.0; | ||
237 | 207 | + | ||
238 | 208 | + if (pinch->radius_delta < 0.0) { | ||
239 | 209 | + ev_document_model_set_sizing_mode (view->model, EV_SIZING_FREE); | ||
240 | 210 | + ev_view_zoom_out_smooth (view, (1.0 / increment)); | ||
241 | 211 | + } else if (pinch->radius_delta > 0.0) { | ||
242 | 212 | + ev_document_model_set_sizing_mode (view->model, EV_SIZING_FREE); | ||
243 | 213 | + ev_view_zoom_in_smooth (view, increment); | ||
244 | 214 | + } | ||
245 | 215 | + | ||
246 | 216 | + break; | ||
247 | 217 | + } | ||
248 | 218 | + | ||
249 | 219 | + case GRIP_GESTURE_DRAG: { | ||
250 | 220 | + GripEventGestureDrag *drag = (GripEventGestureDrag *)event; | ||
251 | 221 | + | ||
252 | 222 | + if (drag->fingers == 1) { | ||
253 | 223 | + ev_view_drag (view, | ||
254 | 224 | + (gdouble)-drag->delta_x, | ||
255 | 225 | + (gdouble)-drag->delta_y); | ||
256 | 226 | + } | ||
257 | 227 | + } | ||
258 | 228 | + | ||
259 | 229 | + default: | ||
260 | 230 | + break; | ||
261 | 231 | + } | ||
262 | 232 | + } | ||
263 | 233 | +} | ||
264 | 234 | +#endif | ||
265 | 235 | + | ||
266 | 236 | /*** GtkWidget implementation ***/ | ||
267 | 237 | |||
268 | 238 | static void | ||
269 | 239 | @@ -4586,6 +4730,82 @@ | ||
270 | 240 | return GTK_WIDGET_CLASS (ev_view_parent_class)->get_accessible (widget); | ||
271 | 241 | } | ||
272 | 242 | |||
273 | 243 | +#ifdef HAVE_LIBGRIP | ||
274 | 244 | +static void | ||
275 | 245 | +ev_view_get_property (GObject *object, | ||
276 | 246 | + guint prop_id, | ||
277 | 247 | + GValue *value, | ||
278 | 248 | + GParamSpec *param_spec) | ||
279 | 249 | +{ | ||
280 | 250 | + EvView *view = EV_VIEW (object); | ||
281 | 251 | + | ||
282 | 252 | + switch (prop_id) { | ||
283 | 253 | + case PROP_ENABLE_GESTURES: | ||
284 | 254 | + g_value_set_boolean (value, view->enable_gestures); | ||
285 | 255 | + break; | ||
286 | 256 | + | ||
287 | 257 | + default: | ||
288 | 258 | + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, | ||
289 | 259 | + prop_id, | ||
290 | 260 | + param_spec); | ||
291 | 261 | + } | ||
292 | 262 | +} | ||
293 | 263 | + | ||
294 | 264 | +static void | ||
295 | 265 | +ev_view_set_property (GObject *object, | ||
296 | 266 | + guint prop_id, | ||
297 | 267 | + const GValue *value, | ||
298 | 268 | + GParamSpec *param_spec) | ||
299 | 269 | +{ | ||
300 | 270 | + EvView *view = EV_VIEW (object); | ||
301 | 271 | + GtkWidget *widget; | ||
302 | 272 | + GripGestureManager *manager; | ||
303 | 273 | + | ||
304 | 274 | + switch (prop_id) { | ||
305 | 275 | + case PROP_ENABLE_GESTURES: | ||
306 | 276 | + view->enable_gestures = g_value_get_boolean (value); | ||
307 | 277 | + | ||
308 | 278 | + widget = GTK_WIDGET (view); | ||
309 | 279 | + manager = grip_gesture_manager_get (); | ||
310 | 280 | + | ||
311 | 281 | + grip_gesture_manager_register_window (manager, | ||
312 | 282 | + widget, | ||
313 | 283 | + GRIP_GESTURE_PINCH, | ||
314 | 284 | + 2, | ||
315 | 285 | + ev_gesture_callback, | ||
316 | 286 | + NULL, NULL); | ||
317 | 287 | + | ||
318 | 288 | + grip_gesture_manager_register_window (manager, | ||
319 | 289 | + widget, | ||
320 | 290 | + GRIP_GESTURE_DRAG, | ||
321 | 291 | + 2, | ||
322 | 292 | + ev_gesture_callback, | ||
323 | 293 | + NULL, NULL); | ||
324 | 294 | + | ||
325 | 295 | + grip_gesture_manager_register_window (manager, | ||
326 | 296 | + widget, | ||
327 | 297 | + GRIP_GESTURE_DRAG, | ||
328 | 298 | + 1, | ||
329 | 299 | + ev_gesture_callback, | ||
330 | 300 | + NULL, NULL); | ||
331 | 301 | + | ||
332 | 302 | + grip_gesture_manager_register_window (manager, | ||
333 | 303 | + widget, | ||
334 | 304 | + GRIP_GESTURE_ROTATE, | ||
335 | 305 | + 2, | ||
336 | 306 | + ev_gesture_callback, | ||
337 | 307 | + NULL, NULL); | ||
338 | 308 | + | ||
339 | 309 | + break; | ||
340 | 310 | + | ||
341 | 311 | + default: | ||
342 | 312 | + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, | ||
343 | 313 | + prop_id, | ||
344 | 314 | + param_spec); | ||
345 | 315 | + } | ||
346 | 316 | +} | ||
347 | 317 | +#endif | ||
348 | 318 | + | ||
349 | 319 | static void | ||
350 | 320 | ev_view_class_init (EvViewClass *class) | ||
351 | 321 | { | ||
352 | 322 | @@ -4596,6 +4816,10 @@ | ||
353 | 323 | GtkBindingSet *binding_set; | ||
354 | 324 | |||
355 | 325 | object_class->finalize = ev_view_finalize; | ||
356 | 326 | +#ifdef HAVE_LIBGRIP | ||
357 | 327 | + object_class->get_property = ev_view_get_property; | ||
358 | 328 | + object_class->set_property = ev_view_set_property; | ||
359 | 329 | +#endif | ||
360 | 330 | |||
361 | 331 | widget_class->expose_event = ev_view_expose_event; | ||
362 | 332 | widget_class->button_press_event = ev_view_button_press_event; | ||
363 | 333 | @@ -4681,6 +4905,17 @@ | ||
364 | 334 | G_TYPE_NONE, 1, | ||
365 | 335 | EV_TYPE_ANNOTATION); | ||
366 | 336 | |||
367 | 337 | +#ifdef HAVE_LIBGRIP | ||
368 | 338 | + g_object_class_install_property (object_class, | ||
369 | 339 | + PROP_ENABLE_GESTURES, | ||
370 | 340 | + g_param_spec_boolean ("enable-gestures", | ||
371 | 341 | + "Enable gestures", | ||
372 | 342 | + "Whether to enable gestures", | ||
373 | 343 | + FALSE, | ||
374 | 344 | + G_PARAM_WRITABLE | | ||
375 | 345 | + G_PARAM_CONSTRUCT_ONLY)); | ||
376 | 346 | +#endif | ||
377 | 347 | + | ||
378 | 348 | binding_set = gtk_binding_set_by_class (class); | ||
379 | 349 | |||
380 | 350 | add_scroll_binding_keypad (binding_set, GDK_Left, 0, GTK_SCROLL_STEP_BACKWARD, TRUE); | ||
381 | 351 | @@ -4732,6 +4967,7 @@ | ||
382 | 352 | gtk_layout_set_vadjustment (GTK_LAYOUT (view), NULL); | ||
383 | 353 | } | ||
384 | 354 | |||
385 | 355 | + | ||
386 | 356 | /*** Callbacks ***/ | ||
387 | 357 | |||
388 | 358 | static void | ||
389 | 359 | @@ -4867,8 +5103,21 @@ | ||
390 | 360 | view_update_range_and_current_page (view); | ||
391 | 361 | } | ||
392 | 362 | |||
393 | 363 | +#ifdef HAVE_LIBGRIP | ||
394 | 364 | +GtkWidget* | ||
395 | 365 | +ev_view_new (gboolean enable_gestures) | ||
396 | 366 | +{ | ||
397 | 367 | + GtkWidget *view; | ||
398 | 368 | + | ||
399 | 369 | + view = g_object_new (EV_TYPE_VIEW, | ||
400 | 370 | + "enable-gestures", enable_gestures, | ||
401 | 371 | + NULL); | ||
402 | 372 | + | ||
403 | 373 | + return view; | ||
404 | 374 | +} | ||
405 | 375 | +#else | ||
406 | 376 | GtkWidget* | ||
407 | 377 | -ev_view_new (void) | ||
408 | 378 | +ev_view_new () | ||
409 | 379 | { | ||
410 | 380 | GtkWidget *view; | ||
411 | 381 | |||
412 | 382 | @@ -4876,6 +5125,7 @@ | ||
413 | 383 | |||
414 | 384 | return view; | ||
415 | 385 | } | ||
416 | 386 | +#endif | ||
417 | 387 | |||
418 | 388 | static void | ||
419 | 389 | setup_caches (EvView *view) | ||
420 | 390 | @@ -5022,6 +5272,26 @@ | ||
421 | 391 | ev_view_handle_cursor_over_xy (view, x, y); | ||
422 | 392 | } | ||
423 | 393 | |||
424 | 394 | +#ifdef HAVE_LIBGRIP | ||
425 | 395 | +void | ||
426 | 396 | +ev_view_drag (EvView *view, | ||
427 | 397 | + gdouble x, | ||
428 | 398 | + gdouble y) | ||
429 | 399 | +{ | ||
430 | 400 | + gdouble value; | ||
431 | 401 | + | ||
432 | 402 | + value = gtk_adjustment_get_value (view->vadjustment); | ||
433 | 403 | + value = CLAMP (value + y, 0, | ||
434 | 404 | + gtk_adjustment_get_upper (view->vadjustment) - gtk_adjustment_get_page_size (view->vadjustment)); | ||
435 | 405 | + gtk_adjustment_set_value (view->vadjustment, value); | ||
436 | 406 | + | ||
437 | 407 | + value = gtk_adjustment_get_value (view->hadjustment); | ||
438 | 408 | + value = CLAMP (value + x, 0, | ||
439 | 409 | + gtk_adjustment_get_upper (view->hadjustment) - gtk_adjustment_get_page_size (view->hadjustment)); | ||
440 | 410 | + gtk_adjustment_set_value (view->hadjustment, value); | ||
441 | 411 | +} | ||
442 | 412 | +#endif | ||
443 | 413 | + | ||
444 | 414 | static void | ||
445 | 415 | ev_view_document_changed_cb (EvDocumentModel *model, | ||
446 | 416 | GParamSpec *pspec, | ||
447 | 417 | @@ -5253,14 +5523,51 @@ | ||
448 | 418 | return view->scale * ZOOM_OUT_FACTOR >= ev_document_model_get_min_scale (view->model); | ||
449 | 419 | } | ||
450 | 420 | |||
451 | 421 | +#ifdef HAVE_LIBGRIP | ||
452 | 422 | +void | ||
453 | 423 | +ev_view_zoom_in_smooth (EvView *view, float factor) | ||
454 | 424 | +{ | ||
455 | 425 | + gdouble scale; | ||
456 | 426 | + | ||
457 | 427 | + g_return_if_fail (view->sizing_mode == EV_SIZING_FREE); | ||
458 | 428 | + | ||
459 | 429 | + view->pending_scroll = SCROLL_TO_CENTER; | ||
460 | 430 | + scale = ev_document_model_get_scale (view->model) * factor; | ||
461 | 431 | + ev_document_model_set_scale (view->model, scale); | ||
462 | 432 | +} | ||
463 | 433 | + | ||
464 | 434 | void | ||
465 | 435 | ev_view_zoom_in (EvView *view) | ||
466 | 436 | { | ||
467 | 437 | + ev_view_zoom_in_smooth (view, ZOOM_IN_FACTOR); | ||
468 | 438 | +} | ||
469 | 439 | + | ||
470 | 440 | +void | ||
471 | 441 | +ev_view_zoom_out_smooth (EvView *view, float factor) | ||
472 | 442 | +{ | ||
473 | 443 | gdouble scale; | ||
474 | 444 | |||
475 | 445 | g_return_if_fail (view->sizing_mode == EV_SIZING_FREE); | ||
476 | 446 | |||
477 | 447 | view->pending_scroll = SCROLL_TO_CENTER; | ||
478 | 448 | + scale = ev_document_model_get_scale (view->model) * factor; | ||
479 | 449 | + ev_document_model_set_scale (view->model, scale); | ||
480 | 450 | +} | ||
481 | 451 | + | ||
482 | 452 | +void | ||
483 | 453 | +ev_view_zoom_out (EvView *view) | ||
484 | 454 | +{ | ||
485 | 455 | + ev_view_zoom_out_smooth (view, ZOOM_OUT_FACTOR); | ||
486 | 456 | +} | ||
487 | 457 | +#else | ||
488 | 458 | +void | ||
489 | 459 | +ev_view_zoom_in (EvView *view) | ||
490 | 460 | +{ | ||
491 | 461 | + gdouble scale; | ||
492 | 462 | + | ||
493 | 463 | + g_return_if_fail (view->sizing_mode == EV_SIZING_FREE); | ||
494 | 464 | + | ||
495 | 465 | + view->pending_scroll = SCROLL_TO_CENTER; | ||
496 | 466 | scale = ev_document_model_get_scale (view->model) * ZOOM_IN_FACTOR; | ||
497 | 467 | ev_document_model_set_scale (view->model, scale); | ||
498 | 468 | } | ||
499 | 469 | @@ -5276,6 +5583,7 @@ | ||
500 | 470 | scale = ev_document_model_get_scale (view->model) * ZOOM_OUT_FACTOR; | ||
501 | 471 | ev_document_model_set_scale (view->model, scale); | ||
502 | 472 | } | ||
503 | 473 | +#endif | ||
504 | 474 | |||
505 | 475 | static double | ||
506 | 476 | zoom_for_size_fit_width (gdouble doc_width, | ||
507 | 477 | --- a/libview/ev-view.h | ||
508 | 478 | +++ b/libview/ev-view.h | ||
509 | 479 | @@ -46,7 +46,11 @@ | ||
510 | 480 | |||
511 | 481 | GType ev_view_get_type (void) G_GNUC_CONST; | ||
512 | 482 | |||
513 | 483 | +#ifdef HAVE_LIBGRIP | ||
514 | 484 | +GtkWidget* ev_view_new (gboolean enable_gestures); | ||
515 | 485 | +#else | ||
516 | 486 | GtkWidget* ev_view_new (void); | ||
517 | 487 | +#endif | ||
518 | 488 | void ev_view_set_model (EvView *view, | ||
519 | 489 | EvDocumentModel *model); | ||
520 | 490 | void ev_view_set_loading (EvView *view, | ||
521 | 491 | @@ -65,8 +69,14 @@ | ||
522 | 492 | /* Page size */ | ||
523 | 493 | gboolean ev_view_can_zoom_in (EvView *view); | ||
524 | 494 | void ev_view_zoom_in (EvView *view); | ||
525 | 495 | +#ifdef HAVE_LIBGRIP | ||
526 | 496 | +void ev_view_zoom_in_smooth (EvView *view, float factor); | ||
527 | 497 | +#endif | ||
528 | 498 | gboolean ev_view_can_zoom_out (EvView *view); | ||
529 | 499 | void ev_view_zoom_out (EvView *view); | ||
530 | 500 | +#ifdef HAVE_LIBGRIP | ||
531 | 501 | +void ev_view_zoom_out_smooth (EvView *view, float factor); | ||
532 | 502 | +#endif | ||
533 | 503 | |||
534 | 504 | /* Find */ | ||
535 | 505 | void ev_view_find_next (EvView *view); | ||
536 | 506 | @@ -103,6 +113,13 @@ | ||
537 | 507 | gint page, | ||
538 | 508 | GdkRectangle *page_area, | ||
539 | 509 | GtkBorder *border); | ||
540 | 510 | + | ||
541 | 511 | +#ifdef HAVE_LIBGRIP | ||
542 | 512 | +void ev_view_drag (EvView *view, | ||
543 | 513 | + gdouble x, | ||
544 | 514 | + gdouble y); | ||
545 | 515 | +#endif | ||
546 | 516 | + | ||
547 | 517 | /* Annotations */ | ||
548 | 518 | void ev_view_focus_annotation (EvView *view, | ||
549 | 519 | EvMapping *annot_mapping); | ||
550 | 520 | --- a/previewer/ev-previewer-window.c | ||
551 | 521 | +++ b/previewer/ev-previewer-window.c | ||
552 | 522 | @@ -607,7 +607,11 @@ | ||
553 | 523 | GTK_POLICY_AUTOMATIC, | ||
554 | 524 | GTK_POLICY_AUTOMATIC); | ||
555 | 525 | |||
556 | 526 | +#ifdef HAVE_LIBGRIP | ||
557 | 527 | + window->view = EV_VIEW (ev_view_new (FALSE)); | ||
558 | 528 | +#else | ||
559 | 529 | window->view = EV_VIEW (ev_view_new ()); | ||
560 | 530 | +#endif | ||
561 | 531 | g_signal_connect_object (window->view, "focus_in_event", | ||
562 | 532 | G_CALLBACK (view_focus_changed), | ||
563 | 533 | window, 0); | ||
564 | 534 | --- a/shell/ev-application.c | ||
565 | 535 | +++ b/shell/ev-application.c | ||
566 | 536 | @@ -72,6 +72,10 @@ | ||
567 | 537 | |||
568 | 538 | gchar *filechooser_open_uri; | ||
569 | 539 | gchar *filechooser_save_uri; | ||
570 | 540 | + | ||
571 | 541 | +#ifdef HAVE_LIBGRIP | ||
572 | 542 | + gboolean gestures_enabled; | ||
573 | 543 | +#endif | ||
574 | 544 | }; | ||
575 | 545 | |||
576 | 546 | struct _EvApplicationClass { | ||
577 | 547 | @@ -126,6 +130,20 @@ | ||
578 | 548 | return instance; | ||
579 | 549 | } | ||
580 | 550 | |||
581 | 551 | +#ifdef HAVE_LIBGRIP | ||
582 | 552 | +gboolean | ||
583 | 553 | +ev_application_get_gestures_enabled (EvApplication *application) | ||
584 | 554 | +{ | ||
585 | 555 | + return application->gestures_enabled; | ||
586 | 556 | +} | ||
587 | 557 | + | ||
588 | 558 | +void | ||
589 | 559 | +ev_application_set_gestures_enabled (EvApplication *application, gboolean enabled) | ||
590 | 560 | +{ | ||
591 | 561 | + application->gestures_enabled = enabled; | ||
592 | 562 | +} | ||
593 | 563 | +#endif | ||
594 | 564 | + | ||
595 | 565 | /* Session */ | ||
596 | 566 | gboolean | ||
597 | 567 | ev_application_load_session (EvApplication *application) | ||
598 | 568 | --- a/shell/ev-application.h | ||
599 | 569 | +++ b/shell/ev-application.h | ||
600 | 570 | @@ -81,6 +81,10 @@ | ||
601 | 571 | const gchar *ev_application_get_dot_dir (EvApplication *application, | ||
602 | 572 | gboolean create); | ||
603 | 573 | const gchar *ev_application_get_data_dir (EvApplication *application); | ||
604 | 574 | +#ifdef HAVE_LIBGRIP | ||
605 | 575 | +gboolean ev_application_get_gestures_enabled (EvApplication *application); | ||
606 | 576 | +void ev_application_set_gestures_enabled (EvApplication *application, gboolean enabled); | ||
607 | 577 | +#endif | ||
608 | 578 | |||
609 | 579 | G_END_DECLS | ||
610 | 580 | |||
611 | 581 | --- a/shell/ev-window.c | ||
612 | 582 | +++ b/shell/ev-window.c | ||
613 | 583 | @@ -6950,7 +6950,11 @@ | ||
614 | 584 | ev_window->priv->view_box); | ||
615 | 585 | gtk_widget_show (ev_window->priv->view_box); | ||
616 | 586 | |||
617 | 587 | +#ifdef HAVE_LIBGRIP | ||
618 | 588 | + ev_window->priv->view = ev_view_new (ev_application_get_gestures_enabled (EV_APP)); | ||
619 | 589 | +#else | ||
620 | 590 | ev_window->priv->view = ev_view_new (); | ||
621 | 591 | +#endif | ||
622 | 592 | ev_view_set_page_cache_size (EV_VIEW (ev_window->priv->view), PAGE_CACHE_SIZE); | ||
623 | 593 | ev_view_set_model (EV_VIEW (ev_window->priv->view), ev_window->priv->model); | ||
624 | 594 | |||
625 | 595 | --- a/shell/main.c | ||
626 | 596 | +++ b/shell/main.c | ||
627 | 597 | @@ -58,7 +58,9 @@ | ||
628 | 598 | static gboolean unlink_temp_file = FALSE; | ||
629 | 599 | static gchar *print_settings; | ||
630 | 600 | static const char **file_arguments = NULL; | ||
631 | 601 | - | ||
632 | 602 | +#ifdef HAVE_LIBGRIP | ||
633 | 603 | +static gboolean disable_gestures = FALSE; | ||
634 | 604 | +#endif | ||
635 | 605 | |||
636 | 606 | static gboolean | ||
637 | 607 | option_version_cb (const gchar *option_name, | ||
638 | 608 | @@ -82,6 +84,9 @@ | ||
639 | 609 | { "find", 'l', 0, G_OPTION_ARG_STRING, &ev_find_string, N_("The word or phrase to find in the document"), N_("STRING")}, | ||
640 | 610 | { "unlink-tempfile", 'u', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &unlink_temp_file, NULL, NULL }, | ||
641 | 611 | { "print-settings", 't', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_FILENAME, &print_settings, NULL, NULL }, | ||
642 | 612 | +#ifdef HAVE_LIBGRIP | ||
643 | 613 | + { "disable-gestures", 'g', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &disable_gestures, NULL, NULL }, | ||
644 | 614 | +#endif | ||
645 | 615 | { "version", 0, G_OPTION_FLAG_NO_ARG | G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_CALLBACK, option_version_cb, NULL, NULL }, | ||
646 | 616 | { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &file_arguments, NULL, N_("[FILEā¦]") }, | ||
647 | 617 | { NULL } | ||
648 | 618 | @@ -312,6 +317,9 @@ | ||
649 | 619 | #endif /* WITH_SMCLIENT && GDK_WINDOWING_X11 */ | ||
650 | 620 | |||
651 | 621 | ev_application_load_session (EV_APP); | ||
652 | 622 | +#ifdef HAVE_LIBGRIP | ||
653 | 623 | + ev_application_set_gestures_enabled (EV_APP, !disable_gestures); | ||
654 | 624 | +#endif | ||
655 | 625 | load_files (file_arguments); | ||
656 | 626 | |||
657 | 627 | /* Change directory so we don't prevent unmounting in case the initial cwd | ||
658 | 0 | 628 | ||
659 | === modified file 'debian/patches/series' | |||
660 | --- debian/patches/series 2011-02-04 17:14:42 +0000 | |||
661 | +++ debian/patches/series 2011-03-23 21:23:34 +0000 | |||
662 | @@ -4,3 +4,4 @@ | |||
663 | 4 | 04_gold.patch | 4 | 04_gold.patch |
664 | 5 | 05_library-path.patch | 5 | 05_library-path.patch |
665 | 6 | 06_new_poppler_api_update.patch | 6 | 06_new_poppler_api_update.patch |
666 | 7 | 07_utouch-gestures.patch | ||
667 | 7 | 8 | ||
668 | === modified file 'debian/rules' | |||
669 | --- debian/rules 2011-03-22 18:38:58 +0000 | |||
670 | +++ debian/rules 2011-03-23 21:23:34 +0000 | |||
671 | @@ -24,6 +24,7 @@ | |||
672 | 24 | --enable-pixbuf \ | 24 | --enable-pixbuf \ |
673 | 25 | --enable-comics \ | 25 | --enable-comics \ |
674 | 26 | --enable-impress \ | 26 | --enable-impress \ |
675 | 27 | --with-libgrip \ | ||
676 | 27 | --enable-introspection=yes | 28 | --enable-introspection=yes |
677 | 28 | 29 | ||
678 | 29 | DEB_DH_MAKESHLIBS_ARGS += --exclude=libevince-properties-page.so | 30 | DEB_DH_MAKESHLIBS_ARGS += --exclude=libevince-properties-page.so |