Merge lp:~bratsche/oif/evince-smooth-dragging into lp:~oif-team/oif/evince-gestures-trunk

Proposed by Cody Russell on 2010-11-30
Status: Merged
Merged at revision: 4210
Proposed branch: lp:~bratsche/oif/evince-smooth-dragging
Merge into: lp:~oif-team/oif/evince-gestures-trunk
Diff against target: 79 lines (+40/-0)
3 files modified
libview/ev-view.c (+18/-0)
libview/ev-view.h (+5/-0)
shell/ev-window.c (+17/-0)
To merge this branch: bzr merge lp:~bratsche/oif/evince-smooth-dragging
Reviewer Review Type Date Requested Status
Mohamed IKBEL Boulabiar (community) 2010-11-30 Approve on 2010-11-30
Review via email: mp+42207@code.launchpad.net

Description of the change

Currently supports 1-finger panning around the view. 2-fingers are used for flinging to the next/previous page, so 1-finger made sense to me.

To post a comment you must log in.
Mohamed IKBEL Boulabiar (boulabiar) wrote :

The patch works pretty nice, but when trying it, it looks like the movement are inverted.

Moving a document/paper by touch seems a better metaphor than moving the camera.
In okular it's like that, so what you think ?

review: Needs Information
Cody Russell (bratsche) wrote :

Yeah, you're right. I didn't notice so much using the Magic Trackpad, but if I were using a touchscreen this would feel very wrong. I'll fix it now.

Cody Russell (bratsche) wrote :

Fixed in rev 4211.

4211. By Cody Russell on 2010-11-30

Invert the y axis when dragging.

Mohamed IKBEL Boulabiar (boulabiar) wrote :

Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libview/ev-view.c'
2--- libview/ev-view.c 2010-11-17 21:58:16 +0000
3+++ libview/ev-view.c 2010-11-30 15:13:11 +0000
4@@ -5065,6 +5065,24 @@
5 ev_view_handle_cursor_over_xy (view, x, y);
6 }
7
8+void
9+ev_view_drag (EvView *view,
10+ gdouble x,
11+ gdouble y)
12+{
13+ gdouble value;
14+
15+ value = gtk_adjustment_get_value (view->vadjustment);
16+ value = CLAMP (value + y, 0,
17+ gtk_adjustment_get_upper (view->vadjustment) - gtk_adjustment_get_page_size (view->vadjustment));
18+ gtk_adjustment_set_value (view->vadjustment, value);
19+
20+ value = gtk_adjustment_get_value (view->hadjustment);
21+ value = CLAMP (value + x, 0,
22+ gtk_adjustment_get_upper (view->hadjustment) - gtk_adjustment_get_page_size (view->hadjustment));
23+ gtk_adjustment_set_value (view->hadjustment, value);
24+}
25+
26 static void
27 ev_view_document_changed_cb (EvDocumentModel *model,
28 GParamSpec *pspec,
29
30=== modified file 'libview/ev-view.h'
31--- libview/ev-view.h 2010-11-17 21:58:16 +0000
32+++ libview/ev-view.h 2010-11-30 15:13:11 +0000
33@@ -105,6 +105,11 @@
34 gint page,
35 GdkRectangle *page_area,
36 GtkBorder *border);
37+
38+void ev_view_drag (EvView *view,
39+ gdouble x,
40+ gdouble y);
41+
42 /* Annotations */
43 void ev_view_focus_annotation (EvView *view,
44 EvMapping *annot_mapping);
45
46=== modified file 'shell/ev-window.c'
47--- shell/ev-window.c 2010-11-29 17:44:15 +0000
48+++ shell/ev-window.c 2010-11-30 15:13:11 +0000
49@@ -5520,6 +5520,16 @@
50 break;
51 }
52
53+ case GRIP_GESTURE_DRAG: {
54+ GripEventGestureDrag *drag = (GripEventGestureDrag *)event;
55+
56+ if (drag->fingers == 1) {
57+ ev_view_drag (EV_VIEW (priv->view),
58+ (gdouble)drag->delta_x,
59+ (gdouble)-drag->delta_y);
60+ }
61+ }
62+
63 default:
64 break;
65 }
66@@ -5551,6 +5561,13 @@
67 ev_gesture_callback,
68 NULL, NULL);
69
70+ grip_gesture_manager_register_window (manager,
71+ window,
72+ GRIP_GESTURE_DRAG,
73+ 1,
74+ ev_gesture_callback,
75+ NULL, NULL);
76+
77 grip_gesture_manager_register_window (manager,
78 window,
79 GRIP_GESTURE_ROTATE,

Subscribers

People subscribed via source and target branches