evince for touchscreen



Please find in attachment a patch that makes evince alot better on
touchscreens. On regular screens you can use the middle mouse button to
drag the page, but on touchscreens there is no such button. Scrolling
trough the scrollbars is a real pain. As a solution i made a toolbar
button that enables you to drag the page with the left mouse button.

The patch was made on ubuntu 10.04 version of evince.

-Yves

diff -r evince-2.30.1/data/evince-toolbar.xml evince-2.30.1-grabdrag/data/evince-toolbar.xml
11a12
>     <toolitem name="ViewGrabdrag"/>
diff -r evince-2.30.1/data/evince-ui.xml evince-2.30.1-grabdrag/data/evince-ui.xml
62a63
>       <placeholder name="LaunchpadItems" />
76a78
>     <menuitem name="ViewGrabdrag" action="ViewGrabdrag"/>
diff -r evince-2.30.1/libview/ev-view.c evince-2.30.1-grabdrag/libview/ev-view.c
3269a3270,3277
> 	int pressed_button = event->button;
> 	if( view->grabdrag ){
> 		if( pressed_button == 1 ){
> 			pressed_button = 2;
> 		}
> 	}
> 
> 	
3271c3279
< 	view->pressed_button = event->button;
---
> 	view->pressed_button = pressed_button;
3277c3285
< 	switch (event->button) {
---
> 	switch (pressed_button) {
4328a4337,4338
> 
> 	view->grabdrag = FALSE;
5746a5757,5760
> void
> ev_view_set_grabdrag( EvView* view, gboolean enable ){
> 	view->grabdrag = enable;
> }
diff -r evince-2.30.1/libview/ev-view.h evince-2.30.1-grabdrag/libview/ev-view.h
103a104,106
> void           ev_view_set_grabdrag       (EvView *view,
>                                            gboolean enable);
> 
diff -r evince-2.30.1/libview/ev-view-private.h evince-2.30.1-grabdrag/libview/ev-view-private.h
181a182,183
> 
> 	int grabdrag;
diff -r evince-2.30.1/shell/ev-window.c evince-2.30.1-grabdrag/shell/ev-window.c
432a435
> 	ev_window_set_action_sensitive (ev_window, "ViewGrabdrag", has_pages);
1133a1137
> 	gboolean grabdrag;
1143a1148,1150
> 	if (ev_metadata_get_boolean (window->priv->metadata, "grabdrag", &grabdrag)){
> 		ev_view_set_grabdrag (EV_VIEW (window->priv->view), grabdrag);
> 	}
3986a3994,4013
> ev_window_cmd_view_grabdrag (GtkAction *action, EvWindow *ev_window)
> {
> 	gboolean grabdrag = FALSE;
> 	if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
> 		grabdrag = TRUE;
> 	}else{
> 		grabdrag = FALSE;
> 	}
> 	ev_view_set_grabdrag (EV_VIEW (ev_window->priv->view), grabdrag);
> }
> 
> static void
5215a5243,5245
> 	{ "ViewGrabdrag", EV_STOCK_VISIBLE, N_("_Grab drag"), NULL, NULL,
> 	  G_CALLBACK (ev_window_cmd_view_grabdrag) },
> 
diff -r evince-2.30.1/data/evince-toolbar.xml evince-2.30.1-grabdrag/data/evince-toolbar.xml
11a12
>     <toolitem name="ViewGrabdrag"/>
diff -r evince-2.30.1/data/evince-ui.xml evince-2.30.1-grabdrag/data/evince-ui.xml
62a63
>       <placeholder name="LaunchpadItems" />
76a78
>     <menuitem name="ViewGrabdrag" action="ViewGrabdrag"/>
diff -r evince-2.30.1/libview/ev-view.c evince-2.30.1-grabdrag/libview/ev-view.c
3269a3270,3277
> 	int pressed_button = event->button;
> 	if( view->grabdrag ){
> 		if( pressed_button == 1 ){
> 			pressed_button = 2;
> 		}
> 	}
> 
> 	
3271c3279
< 	view->pressed_button = event->button;
---
> 	view->pressed_button = pressed_button;
3277c3285
< 	switch (event->button) {
---
> 	switch (pressed_button) {
4328a4337,4338
> 
> 	view->grabdrag = FALSE;
5746a5757,5760
> void
> ev_view_set_grabdrag( EvView* view, gboolean enable ){
> 	view->grabdrag = enable;
> }
diff -r evince-2.30.1/libview/ev-view.h evince-2.30.1-grabdrag/libview/ev-view.h
103a104,106
> void           ev_view_set_grabdrag       (EvView *view,
>                                            gboolean enable);
> 
diff -r evince-2.30.1/libview/ev-view-private.h evince-2.30.1-grabdrag/libview/ev-view-private.h
181a182,183
> 
> 	int grabdrag;
diff -r evince-2.30.1/shell/ev-window.c evince-2.30.1-grabdrag/shell/ev-window.c
432a435
> 	ev_window_set_action_sensitive (ev_window, "ViewGrabdrag", has_pages);
1133a1137
> 	gboolean grabdrag;
1143a1148,1150
> 	if (ev_metadata_get_boolean (window->priv->metadata, "grabdrag", &grabdrag)){
> 		ev_view_set_grabdrag (EV_VIEW (window->priv->view), grabdrag);
> 	}
3986a3994,4013
> ev_window_cmd_view_grabdrag (GtkAction *action, EvWindow *ev_window)
> {
> 	gboolean grabdrag = FALSE;
> 	if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
> 		grabdrag = TRUE;
> 	}else{
> 		grabdrag = FALSE;
> 	}
> 	ev_view_set_grabdrag (EV_VIEW (ev_window->priv->view), grabdrag);
> }
> 
> static void
5215a5243,5245
> 	{ "ViewGrabdrag", EV_STOCK_VISIBLE, N_("_Grab drag"), NULL, NULL,
> 	  G_CALLBACK (ev_window_cmd_view_grabdrag) },
> 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]