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

Proposed by Cody Russell
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) Approve
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.
Revision history for this message
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
Revision history for this message
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.

Revision history for this message
Cody Russell (bratsche) wrote :

Fixed in rev 4211.

4211. By Cody Russell

Invert the y axis when dragging.

Revision history for this message
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
=== modified file 'libview/ev-view.c'
--- libview/ev-view.c 2010-11-17 21:58:16 +0000
+++ libview/ev-view.c 2010-11-30 15:13:11 +0000
@@ -5065,6 +5065,24 @@
5065 ev_view_handle_cursor_over_xy (view, x, y);5065 ev_view_handle_cursor_over_xy (view, x, y);
5066}5066}
50675067
5068void
5069ev_view_drag (EvView *view,
5070 gdouble x,
5071 gdouble y)
5072{
5073 gdouble value;
5074
5075 value = gtk_adjustment_get_value (view->vadjustment);
5076 value = CLAMP (value + y, 0,
5077 gtk_adjustment_get_upper (view->vadjustment) - gtk_adjustment_get_page_size (view->vadjustment));
5078 gtk_adjustment_set_value (view->vadjustment, value);
5079
5080 value = gtk_adjustment_get_value (view->hadjustment);
5081 value = CLAMP (value + x, 0,
5082 gtk_adjustment_get_upper (view->hadjustment) - gtk_adjustment_get_page_size (view->hadjustment));
5083 gtk_adjustment_set_value (view->hadjustment, value);
5084}
5085
5068static void5086static void
5069ev_view_document_changed_cb (EvDocumentModel *model,5087ev_view_document_changed_cb (EvDocumentModel *model,
5070 GParamSpec *pspec,5088 GParamSpec *pspec,
50715089
=== modified file 'libview/ev-view.h'
--- libview/ev-view.h 2010-11-17 21:58:16 +0000
+++ libview/ev-view.h 2010-11-30 15:13:11 +0000
@@ -105,6 +105,11 @@
105 gint page,105 gint page,
106 GdkRectangle *page_area,106 GdkRectangle *page_area,
107 GtkBorder *border);107 GtkBorder *border);
108
109void ev_view_drag (EvView *view,
110 gdouble x,
111 gdouble y);
112
108/* Annotations */113/* Annotations */
109void ev_view_focus_annotation (EvView *view,114void ev_view_focus_annotation (EvView *view,
110 EvMapping *annot_mapping);115 EvMapping *annot_mapping);
111116
=== modified file 'shell/ev-window.c'
--- shell/ev-window.c 2010-11-29 17:44:15 +0000
+++ shell/ev-window.c 2010-11-30 15:13:11 +0000
@@ -5520,6 +5520,16 @@
5520 break;5520 break;
5521 }5521 }
55225522
5523 case GRIP_GESTURE_DRAG: {
5524 GripEventGestureDrag *drag = (GripEventGestureDrag *)event;
5525
5526 if (drag->fingers == 1) {
5527 ev_view_drag (EV_VIEW (priv->view),
5528 (gdouble)drag->delta_x,
5529 (gdouble)-drag->delta_y);
5530 }
5531 }
5532
5523 default:5533 default:
5524 break;5534 break;
5525 }5535 }
@@ -5551,6 +5561,13 @@
5551 ev_gesture_callback,5561 ev_gesture_callback,
5552 NULL, NULL);5562 NULL, NULL);
55535563
5564 grip_gesture_manager_register_window (manager,
5565 window,
5566 GRIP_GESTURE_DRAG,
5567 1,
5568 ev_gesture_callback,
5569 NULL, NULL);
5570
5554 grip_gesture_manager_register_window (manager,5571 grip_gesture_manager_register_window (manager,
5555 window,5572 window,
5556 GRIP_GESTURE_ROTATE,5573 GRIP_GESTURE_ROTATE,

Subscribers

People subscribed via source and target branches