Merge lp:~bratsche/oif/evince-move-gestures-into-view into lp:~oif-team/oif/evince-gestures-trunk

Proposed by Cody Russell
Status: Merged
Merged at revision: 4212
Proposed branch: lp:~bratsche/oif/evince-move-gestures-into-view
Merge into: lp:~oif-team/oif/evince-gestures-trunk
Diff against target: 580 lines (+237/-164)
6 files modified
configure.ac (+4/-2)
libview/ev-view-private.h (+8/-0)
libview/ev-view.c (+222/-2)
libview/ev-view.h (+1/-1)
previewer/ev-previewer-window.c (+1/-1)
shell/ev-window.c (+1/-158)
To merge this branch: bzr merge lp:~bratsche/oif/evince-move-gestures-into-view
Reviewer Review Type Date Requested Status
Stephen M. Webb (community) Approve
Review via email: mp+45429@code.launchpad.net

This proposal supersedes a proposal from 2010-12-10.

Description of the change

This branch requires the following first:

https://code.launchpad.net/~bratsche/libgrip/event-routing/+merge/43378

This moves the gesture logic out of EvWindow and into EvView, as well as simply updating evince to work with the libgrip changes in the other merge request.

To post a comment you must log in.
Revision history for this message
Stephen M. Webb (bregma) wrote :

Please use symbolic constants for threshold values (eg. "drag->velocity_y >= 1.0", "rotate->angle >= 1.0", etc) to (a) make the code more self-documenting and (2) make it easier to find the values to tweak later during the tweak phase.

Other than that, this code looks good. I am unable to build it at the moment to do run-time evaluation.

review: Needs Fixing
4213. By Cody Russell

Set some #define constants for velocity and angle.

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

Cool, thanks. Added some #define constants for drag velocity and rotate angle.

Revision history for this message
Stephen M. Webb (bregma) wrote :

That looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configure.ac'
--- configure.ac 2010-11-23 14:39:57 +0000
+++ configure.ac 2011-01-07 16:47:27 +0000
@@ -154,6 +154,8 @@
154GNOME_ICON_THEME_REQUIRED=2.17.1154GNOME_ICON_THEME_REQUIRED=2.17.1
155LIBXML_REQUIRED=2.5.0155LIBXML_REQUIRED=2.5.0
156156
157GRIP_REQUIRED=0.1
158
157dnl Check dependencies159dnl Check dependencies
158160
159# LIB_CFLAGS for helpers and generic widgets. (libdocument, cut-and-paste)161# LIB_CFLAGS for helpers and generic widgets. (libdocument, cut-and-paste)
@@ -165,7 +167,7 @@
165167
166168
167PKG_CHECK_MODULES(LIBDOCUMENT, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED)169PKG_CHECK_MODULES(LIBDOCUMENT, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED)
168PKG_CHECK_MODULES(LIBVIEW, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gail$GAIL_API_VERSION >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)170PKG_CHECK_MODULES(LIBVIEW, libgrip-0.1 >= $GRIP_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gail$GAIL_API_VERSION >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
169PKG_CHECK_MODULES(BACKEND, cairo >= $CAIRO_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED)171PKG_CHECK_MODULES(BACKEND, cairo >= $CAIRO_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED)
170PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)172PKG_CHECK_MODULES(FRONTEND_CORE, gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gthread-2.0 gio-2.0 >= $GLIB_REQUIRED)
171173
@@ -193,7 +195,7 @@
193 ;;195 ;;
194esac196esac
195197
196PKG_CHECK_MODULES([SHELL_CORE],[libxml-2.0 >= $LIBXML_REQUIRED libgrip-0.1 >= 0.1 gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gthread-2.0 $SHELL_PLATFORM_PKGS])198PKG_CHECK_MODULES([SHELL_CORE],[libxml-2.0 >= $LIBXML_REQUIRED libgrip-0.1 >= $GRIP_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gio-2.0 >= $GLIB_REQUIRED gthread-2.0 $SHELL_PLATFORM_PKGS])
197199
198# *********200# *********
199# SM client201# SM client
200202
=== modified file 'libview/ev-view-private.h'
--- libview/ev-view-private.h 2010-09-15 15:05:36 +0000
+++ libview/ev-view-private.h 2011-01-07 16:47:27 +0000
@@ -193,6 +193,14 @@
193193
194 /* Accessibility */194 /* Accessibility */
195 gboolean a11y_enabled;195 gboolean a11y_enabled;
196
197 /* Gesture state */
198 gboolean enable_gestures;
199 gdouble drag_start_x;
200 gdouble drag_start_y;
201 gdouble pinch_start_x;
202 gdouble pinch_start_y;
203 gdouble pinch_start_radius;
196};204};
197205
198struct _EvViewClass {206struct _EvViewClass {
199207
=== modified file 'libview/ev-view.c'
--- libview/ev-view.c 2010-11-30 05:18:17 +0000
+++ libview/ev-view.c 2011-01-07 16:47:27 +0000
@@ -28,6 +28,8 @@
28#include <gtk/gtk.h>28#include <gtk/gtk.h>
29#include <gdk/gdkkeysyms.h>29#include <gdk/gdkkeysyms.h>
3030
31#include <libgrip/gripgesturemanager.h>
32
31#include "ev-mapping-list.h"33#include "ev-mapping-list.h"
32#include "ev-document-forms.h"34#include "ev-document-forms.h"
33#include "ev-document-images.h"35#include "ev-document-images.h"
@@ -50,6 +52,11 @@
50#define EV_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EV_TYPE_VIEW, EvViewClass))52#define EV_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EV_TYPE_VIEW, EvViewClass))
5153
52enum {54enum {
55 PROP_0,
56 PROP_ENABLE_GESTURES
57};
58
59enum {
53 SIGNAL_BINDING_ACTIVATED,60 SIGNAL_BINDING_ACTIVATED,
54 SIGNAL_HANDLE_LINK,61 SIGNAL_HANDLE_LINK,
55 SIGNAL_EXTERNAL_LINK,62 SIGNAL_EXTERNAL_LINK,
@@ -77,6 +84,9 @@
77#define ZOOM_IN_FACTOR 1.284#define ZOOM_IN_FACTOR 1.2
78#define ZOOM_OUT_FACTOR (1.0/ZOOM_IN_FACTOR)85#define ZOOM_OUT_FACTOR (1.0/ZOOM_IN_FACTOR)
7986
87#define GESTURE_DRAG_VELOCITY 1.0
88#define GESTURE_ROTATE_ANGLE 1.0
89
80#define SCROLL_TIME 15090#define SCROLL_TIME 150
8191
82/*** Scrolling ***/92/*** Scrolling ***/
@@ -142,6 +152,14 @@
142static void hide_annotation_windows (EvView *view,152static void hide_annotation_windows (EvView *view,
143 gint page);153 gint page);
144/*** GtkWidget implementation ***/154/*** GtkWidget implementation ***/
155static void ev_view_get_property (GObject *object,
156 guint prop_id,
157 GValue *value,
158 GParamSpec *param_spec);
159static void ev_view_set_property (GObject *object,
160 guint prop_id,
161 const GValue *value,
162 GParamSpec *param_spec);
145static void ev_view_size_request_continuous_dual_page (EvView *view,163static void ev_view_size_request_continuous_dual_page (EvView *view,
146 GtkRequisition *requisition);164 GtkRequisition *requisition);
147static void ev_view_size_request_continuous (EvView *view,165static void ev_view_size_request_continuous (EvView *view,
@@ -279,6 +297,12 @@
279 gpointer data);297 gpointer data);
280static void ev_view_update_primary_selection (EvView *ev_view);298static void ev_view_update_primary_selection (EvView *ev_view);
281299
300/*** Gestures ***/
301static void ev_gesture_callback (GtkWidget *widget,
302 GripTimeType time_type,
303 GripGestureEvent *event,
304 gpointer user_data);
305
282G_DEFINE_TYPE (EvView, ev_view, GTK_TYPE_LAYOUT)306G_DEFINE_TYPE (EvView, ev_view, GTK_TYPE_LAYOUT)
283307
284/* HeightToPage cache */308/* HeightToPage cache */
@@ -2976,6 +3000,114 @@
2976 return FALSE;3000 return FALSE;
2977}3001}
29783002
3003/*** Gesture implementation ***/
3004static void
3005ev_gesture_callback (GtkWidget *widget,
3006 GripTimeType time_type,
3007 GripGestureEvent *event,
3008 gpointer user_data)
3009{
3010 EvView *view = EV_VIEW (widget);
3011
3012 if (time_type == GRIP_TIME_START) {
3013 switch (event->type) {
3014 case GRIP_GESTURE_DRAG: {
3015 GripEventGestureDrag *drag = (GripEventGestureDrag *)event;
3016
3017 view->drag_start_x = drag->position_x;
3018 view->drag_start_y = drag->position_y;
3019
3020 break;
3021 }
3022
3023 case GRIP_GESTURE_PINCH: {
3024 GripEventGesturePinch *pinch = (GripEventGesturePinch *)event;
3025
3026 view->pinch_start_x = pinch->focus_x;
3027 view->pinch_start_y = pinch->focus_y;
3028 view->pinch_start_radius = pinch->radius;
3029 break;
3030 }
3031
3032 default:
3033 break;
3034 }
3035 } else if (time_type == GRIP_TIME_END) {
3036 switch (event->type) {
3037 case GRIP_GESTURE_DRAG: {
3038 GripEventGestureDrag *drag = (GripEventGestureDrag *)event;
3039
3040 if (drag->velocity_y >= GESTURE_DRAG_VELOCITY &&
3041 drag->position_y > view->drag_start_y) {
3042 ev_view_previous_page (view);
3043 } else if (drag->velocity_y <= -GESTURE_DRAG_VELOCITY &&
3044 drag->position_y < view->drag_start_y) {
3045 ev_view_next_page (view);
3046 } else if (drag->velocity_x >= GESTURE_DRAG_VELOCITY &&
3047 drag->position_x > view->drag_start_x) {
3048 ev_view_previous_page (view);
3049 } else if (drag->velocity_x <= -GESTURE_DRAG_VELOCITY &&
3050 drag->position_x < view->drag_start_x) {
3051 ev_view_next_page (view);
3052 }
3053
3054 break;
3055 }
3056
3057 case GRIP_GESTURE_ROTATE: {
3058 GripEventGestureRotate *rotate = (GripEventGestureRotate *)event;
3059 gint rotation = ev_document_model_get_rotation (view->model);
3060
3061 if (rotate->angle >= GESTURE_ROTATE_ANGLE) {
3062 ev_document_model_set_rotation (view->model,
3063 rotation + 90);
3064 } else if (rotate->angle <= -GESTURE_ROTATE_ANGLE) {
3065 ev_document_model_set_rotation (view->model,
3066 rotation - 90);
3067 }
3068
3069 break;
3070 }
3071
3072 default:
3073 break;
3074 }
3075 } else {
3076 switch (event->type) {
3077 case GRIP_GESTURE_PINCH: {
3078 GripEventGesturePinch *pinch = (GripEventGesturePinch *)event;
3079 gdouble increment = pinch->radius_delta * 0.01;
3080
3081 if (increment < 0.0) increment = -increment;
3082 increment += 1.0;
3083
3084 if (pinch->radius_delta < 0.0) {
3085 ev_document_model_set_sizing_mode (view->model, EV_SIZING_FREE);
3086 ev_view_zoom_out_smooth (view, (1.0 / increment));
3087 } else if (pinch->radius_delta > 0.0) {
3088 ev_document_model_set_sizing_mode (view->model, EV_SIZING_FREE);
3089 ev_view_zoom_in_smooth (view, increment);
3090 }
3091
3092 break;
3093 }
3094
3095 case GRIP_GESTURE_DRAG: {
3096 GripEventGestureDrag *drag = (GripEventGestureDrag *)event;
3097
3098 if (drag->fingers == 1) {
3099 ev_view_drag (view,
3100 (gdouble)-drag->delta_x,
3101 (gdouble)-drag->delta_y);
3102 }
3103 }
3104
3105 default:
3106 break;
3107 }
3108 }
3109}
3110
2979/*** GtkWidget implementation ***/3111/*** GtkWidget implementation ***/
29803112
2981static void3113static void
@@ -4622,6 +4754,80 @@
4622}4754}
46234755
4624static void4756static void
4757ev_view_get_property (GObject *object,
4758 guint prop_id,
4759 GValue *value,
4760 GParamSpec *param_spec)
4761{
4762 EvView *view = EV_VIEW (object);
4763
4764 switch (prop_id) {
4765 case PROP_ENABLE_GESTURES:
4766 g_value_set_boolean (value, view->enable_gestures);
4767 break;
4768
4769 default:
4770 G_OBJECT_WARN_INVALID_PROPERTY_ID (object,
4771 prop_id,
4772 param_spec);
4773 }
4774}
4775
4776static void
4777ev_view_set_property (GObject *object,
4778 guint prop_id,
4779 const GValue *value,
4780 GParamSpec *param_spec)
4781{
4782 EvView *view = EV_VIEW (object);
4783 GtkWidget *widget;
4784 GripGestureManager *manager;
4785
4786 switch (prop_id) {
4787 case PROP_ENABLE_GESTURES:
4788 view->enable_gestures = g_value_get_boolean (value);
4789
4790 widget = GTK_WIDGET (view);
4791 manager = grip_gesture_manager_get ();
4792
4793 grip_gesture_manager_register_window (manager,
4794 widget,
4795 GRIP_GESTURE_PINCH,
4796 2,
4797 ev_gesture_callback,
4798 NULL, NULL);
4799
4800 grip_gesture_manager_register_window (manager,
4801 widget,
4802 GRIP_GESTURE_DRAG,
4803 2,
4804 ev_gesture_callback,
4805 NULL, NULL);
4806
4807 grip_gesture_manager_register_window (manager,
4808 widget,
4809 GRIP_GESTURE_DRAG,
4810 1,
4811 ev_gesture_callback,
4812 NULL, NULL);
4813
4814 grip_gesture_manager_register_window (manager,
4815 widget,
4816 GRIP_GESTURE_ROTATE,
4817 2,
4818 ev_gesture_callback,
4819 NULL, NULL);
4820
4821 break;
4822
4823 default:
4824 G_OBJECT_WARN_INVALID_PROPERTY_ID (object,
4825 prop_id,
4826 param_spec);
4827 }
4828}
4829
4830static void
4625ev_view_class_init (EvViewClass *class)4831ev_view_class_init (EvViewClass *class)
4626{4832{
4627 GObjectClass *object_class = G_OBJECT_CLASS (class);4833 GObjectClass *object_class = G_OBJECT_CLASS (class);
@@ -4631,6 +4837,8 @@
4631 GtkBindingSet *binding_set;4837 GtkBindingSet *binding_set;
46324838
4633 object_class->finalize = ev_view_finalize;4839 object_class->finalize = ev_view_finalize;
4840 object_class->get_property = ev_view_get_property;
4841 object_class->set_property = ev_view_set_property;
46344842
4635 widget_class->expose_event = ev_view_expose_event;4843 widget_class->expose_event = ev_view_expose_event;
4636 widget_class->button_press_event = ev_view_button_press_event;4844 widget_class->button_press_event = ev_view_button_press_event;
@@ -4724,6 +4932,15 @@
4724 G_TYPE_NONE, 0,4932 G_TYPE_NONE, 0,
4725 G_TYPE_NONE);4933 G_TYPE_NONE);
47264934
4935 g_object_class_install_property (object_class,
4936 PROP_ENABLE_GESTURES,
4937 g_param_spec_boolean ("enable-gestures",
4938 "Enable gestures",
4939 "Whether to enable gestures",
4940 FALSE,
4941 G_PARAM_WRITABLE |
4942 G_PARAM_CONSTRUCT_ONLY));
4943
4727 binding_set = gtk_binding_set_by_class (class);4944 binding_set = gtk_binding_set_by_class (class);
47284945
4729 add_scroll_binding_keypad (binding_set, GDK_Left, 0, GTK_SCROLL_STEP_BACKWARD, TRUE);4946 add_scroll_binding_keypad (binding_set, GDK_Left, 0, GTK_SCROLL_STEP_BACKWARD, TRUE);
@@ -4775,6 +4992,7 @@
4775 gtk_layout_set_vadjustment (GTK_LAYOUT (view), NULL);4992 gtk_layout_set_vadjustment (GTK_LAYOUT (view), NULL);
4776}4993}
47774994
4995
4778/*** Callbacks ***/4996/*** Callbacks ***/
47794997
4780static void4998static void
@@ -4911,11 +5129,13 @@
4911}5129}
49125130
4913GtkWidget*5131GtkWidget*
4914ev_view_new (void)5132ev_view_new (gboolean enable_gestures)
4915{5133{
4916 GtkWidget *view;5134 GtkWidget *view;
49175135
4918 view = g_object_new (EV_TYPE_VIEW, NULL);5136 view = g_object_new (EV_TYPE_VIEW,
5137 "enable-gestures", enable_gestures,
5138 NULL);
49195139
4920 return view;5140 return view;
4921}5141}
49225142
=== modified file 'libview/ev-view.h'
--- libview/ev-view.h 2010-11-30 05:18:17 +0000
+++ libview/ev-view.h 2011-01-07 16:47:27 +0000
@@ -46,7 +46,7 @@
4646
47GType ev_view_get_type (void) G_GNUC_CONST;47GType ev_view_get_type (void) G_GNUC_CONST;
4848
49GtkWidget* ev_view_new (void);49GtkWidget* ev_view_new (gboolean enable_gestures);
50void ev_view_set_model (EvView *view,50void ev_view_set_model (EvView *view,
51 EvDocumentModel *model);51 EvDocumentModel *model);
52void ev_view_set_loading (EvView *view,52void ev_view_set_loading (EvView *view,
5353
=== modified file 'previewer/ev-previewer-window.c'
--- previewer/ev-previewer-window.c 2010-07-26 13:34:18 +0000
+++ previewer/ev-previewer-window.c 2011-01-07 16:47:27 +0000
@@ -607,7 +607,7 @@
607 GTK_POLICY_AUTOMATIC,607 GTK_POLICY_AUTOMATIC,
608 GTK_POLICY_AUTOMATIC);608 GTK_POLICY_AUTOMATIC);
609609
610 window->view = EV_VIEW (ev_view_new ());610 window->view = EV_VIEW (ev_view_new (FALSE));
611 g_signal_connect_object (window->view, "focus_in_event",611 g_signal_connect_object (window->view, "focus_in_event",
612 G_CALLBACK (view_focus_changed),612 G_CALLBACK (view_focus_changed),
613 window, 0);613 window, 0);
614614
=== modified file 'shell/ev-window.c'
--- shell/ev-window.c 2010-12-07 08:43:18 +0000
+++ shell/ev-window.c 2011-01-07 16:47:27 +0000
@@ -41,8 +41,6 @@
41#include <gio/gio.h>41#include <gio/gio.h>
42#include <gtk/gtk.h>42#include <gtk/gtk.h>
4343
44#include <libgrip/gripgesturemanager.h>
45
46#include "egg-editable-toolbar.h"44#include "egg-editable-toolbar.h"
47#include "egg-toolbar-editor.h"45#include "egg-toolbar-editor.h"
48#include "egg-toolbars-model.h"46#include "egg-toolbars-model.h"
@@ -218,13 +216,6 @@
218 guint dbus_object_id;216 guint dbus_object_id;
219 gchar *dbus_object_path;217 gchar *dbus_object_path;
220#endif218#endif
221
222 gdouble drag_start_x;
223 gdouble drag_start_y;
224
225 gdouble pinch_start_x;
226 gdouble pinch_start_y;
227 gdouble pinch_start_radius;
228};219};
229220
230#define EV_WINDOW_GET_PRIVATE(object) \221#define EV_WINDOW_GET_PRIVATE(object) \
@@ -5433,151 +5424,6 @@
5433}5424}
54345425
5435static void5426static void
5436ev_gesture_callback (GtkWindow *window,
5437 GripTimeType time_type,
5438 GripGestureEvent *event,
5439 gpointer user_data)
5440{
5441 EvWindowPrivate *priv = EV_WINDOW (window)->priv;
5442
5443 if (time_type == GRIP_TIME_START) {
5444 switch (event->type) {
5445 case GRIP_GESTURE_DRAG: {
5446 GripEventGestureDrag *drag = (GripEventGestureDrag *)event;
5447
5448 priv->drag_start_x = drag->position_x;
5449 priv->drag_start_y = drag->position_y;
5450
5451 break;
5452 }
5453
5454 case GRIP_GESTURE_PINCH: {
5455 GripEventGesturePinch *pinch = (GripEventGesturePinch *)event;
5456
5457 priv->pinch_start_x = pinch->focus_x;
5458 priv->pinch_start_y = pinch->focus_y;
5459 priv->pinch_start_radius = pinch->radius;
5460 break;
5461 }
5462
5463 default:
5464 break;
5465 }
5466 } else if (time_type == GRIP_TIME_END) {
5467 switch (event->type) {
5468 case GRIP_GESTURE_DRAG: {
5469 GripEventGestureDrag *drag = (GripEventGestureDrag *)event;
5470
5471 if (drag->velocity_y >= 1.0 &&
5472 drag->position_y > priv->drag_start_y) {
5473 ev_window_cmd_go_previous_page (NULL, EV_WINDOW (window));
5474 } else if (drag->velocity_y <= -1.0 &&
5475 drag->position_y < priv->drag_start_y) {
5476 ev_window_cmd_go_next_page (NULL, EV_WINDOW (window));
5477 } else if (drag->velocity_x >= 1.0 &&
5478 drag->position_x > priv->drag_start_x) {
5479 ev_window_cmd_go_previous_page (NULL, EV_WINDOW (window));
5480 } else if (drag->velocity_x <= -1.0 &&
5481 drag->position_x < priv->drag_start_x) {
5482 ev_window_cmd_go_next_page (NULL, EV_WINDOW (window));
5483 }
5484
5485 break;
5486 }
5487
5488 case GRIP_GESTURE_ROTATE: {
5489 GripEventGestureRotate *rotate = (GripEventGestureRotate *)event;
5490
5491 if (rotate->angle >= 1.0) {
5492 ev_window_cmd_edit_rotate_right (NULL, EV_WINDOW (window));
5493 } else if (rotate->angle <= -1.0) {
5494 ev_window_cmd_edit_rotate_left (NULL, EV_WINDOW (window));
5495 }
5496
5497 break;
5498 }
5499
5500 default:
5501 break;
5502 }
5503 } else {
5504 switch (event->type) {
5505 case GRIP_GESTURE_PINCH: {
5506 GripEventGesturePinch *pinch = (GripEventGesturePinch *)event;
5507 gdouble increment = pinch->radius_delta * 0.01;
5508
5509 if (increment < 0.0) increment = -increment;
5510 increment += 1.0;
5511
5512 if (pinch->radius_delta < 0.0) {
5513 ev_document_model_set_sizing_mode (priv->model, EV_SIZING_FREE);
5514 ev_view_zoom_out_smooth (EV_VIEW (priv->view), (1.0 / increment));
5515 } else if (pinch->radius_delta > 0.0) {
5516 ev_document_model_set_sizing_mode (priv->model, EV_SIZING_FREE);
5517 ev_view_zoom_in_smooth (EV_VIEW (priv->view), increment);
5518 }
5519
5520 break;
5521 }
5522
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
5533 default:
5534 break;
5535 }
5536 }
5537}
5538
5539static void
5540on_window_mapped (GtkWidget *widget)
5541{
5542 GtkWindow *window;
5543 GripGestureManager *manager;
5544
5545 window = GTK_WINDOW (widget);
5546
5547 if (ev_application_get_gestures_enabled (EV_APP)) {
5548 manager = grip_gesture_manager_get ();
5549
5550 grip_gesture_manager_register_window (manager,
5551 window,
5552 GRIP_GESTURE_PINCH,
5553 2,
5554 ev_gesture_callback,
5555 NULL, NULL);
5556
5557 grip_gesture_manager_register_window (manager,
5558 window,
5559 GRIP_GESTURE_DRAG,
5560 2,
5561 ev_gesture_callback,
5562 NULL, NULL);
5563
5564 grip_gesture_manager_register_window (manager,
5565 window,
5566 GRIP_GESTURE_DRAG,
5567 1,
5568 ev_gesture_callback,
5569 NULL, NULL);
5570
5571 grip_gesture_manager_register_window (manager,
5572 window,
5573 GRIP_GESTURE_ROTATE,
5574 2,
5575 ev_gesture_callback,
5576 NULL, NULL);
5577 }
5578}
5579
5580static void
5581ev_window_class_init (EvWindowClass *ev_window_class)5427ev_window_class_init (EvWindowClass *ev_window_class)
5582{5428{
5583 GObjectClass *g_object_class = G_OBJECT_CLASS (ev_window_class);5429 GObjectClass *g_object_class = G_OBJECT_CLASS (ev_window_class);
@@ -6914,9 +6760,6 @@
6914 g_signal_connect (ev_window, "window_state_event",6760 g_signal_connect (ev_window, "window_state_event",
6915 G_CALLBACK (window_state_event_cb), NULL);6761 G_CALLBACK (window_state_event_cb), NULL);
69166762
6917 g_signal_connect (ev_window, "show",
6918 G_CALLBACK (on_window_mapped), NULL);
6919
6920 ev_window->priv = EV_WINDOW_GET_PRIVATE (ev_window);6763 ev_window->priv = EV_WINDOW_GET_PRIVATE (ev_window);
69216764
6922#ifdef ENABLE_DBUS6765#ifdef ENABLE_DBUS
@@ -7142,7 +6985,7 @@
7142 ev_window->priv->view_box);6985 ev_window->priv->view_box);
7143 gtk_widget_show (ev_window->priv->view_box);6986 gtk_widget_show (ev_window->priv->view_box);
71446987
7145 ev_window->priv->view = ev_view_new ();6988 ev_window->priv->view = ev_view_new (ev_application_get_gestures_enabled (EV_APP));
7146 ev_view_set_page_cache_size (EV_VIEW (ev_window->priv->view), PAGE_CACHE_SIZE);6989 ev_view_set_page_cache_size (EV_VIEW (ev_window->priv->view), PAGE_CACHE_SIZE);
7147 ev_view_set_model (EV_VIEW (ev_window->priv->view), ev_window->priv->model);6990 ev_view_set_model (EV_VIEW (ev_window->priv->view), ev_window->priv->model);
71486991

Subscribers

People subscribed via source and target branches