1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
From dc6c25e8f1a7a3845fa7d14b9dfbd22deb9dd6ef Mon Sep 17 00:00:00 2001
From: jordi <jordi@cb4bfb15-1111-0410-82e2-95233c8f1c7e>
Date: Fri, 20 Mar 2009 08:06:32 +0000
Subject: [PATCH 1/3] I had to change the return valud of MainView's scroll-event handler, since Gtk+ expects a gboolean that tells whether to propagate the event. Since we didn't return any value, depending on the compilation flags the mouse wheel didn't work at all.
This closes #118.
git-svn-id: svn://svn.emma-soft.com/epdfview@329 cb4bfb15-1111-0410-82e2-95233c8f1c7e
---
trunk/src/gtk/MainView.cxx | 21 ++++++++++++++-------
trunk/src/gtk/PageView.cxx | 7 -------
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/trunk/src/gtk/MainView.cxx b/trunk/src/gtk/MainView.cxx
index b983bff..4a52cd3 100644
--- a/trunk/src/gtk/MainView.cxx
+++ b/trunk/src/gtk/MainView.cxx
@@ -77,7 +77,7 @@ static void main_window_zoom_in_cb (GtkWidget *, gpointer);
static void main_window_zoom_out_cb (GtkWidget *, gpointer);
static void main_window_zoom_width_cb (GtkToggleAction *, gpointer);
static void main_window_set_page_mode (GtkRadioAction *, GtkRadioAction *, gpointer);
-static void main_window_page_scrolled_cb (GtkWidget *widget, GdkEventScroll *event, gpointer data);
+static gboolean main_window_page_scrolled_cb (GtkWidget *widget, GdkEventScroll *event, gpointer data);
#if defined (HAVE_CUPS)
static void main_window_print_cb (GtkWidget *, gpointer);
@@ -1479,18 +1479,25 @@ main_window_set_page_mode (GtkRadioAction *action, GtkRadioAction *current, gpoi
pter->setPageMode (mode);
}
-void
+gboolean
main_window_page_scrolled_cb (GtkWidget *widget, GdkEventScroll *event, gpointer data)
{
g_assert ( NULL != data && "The data parameter is NULL.");
MainPter *pter = (MainPter *)data;
// Only zoom when the CTRL-Button is down...
- if ( !(event->state & GDK_CONTROL_MASK) ) return;
- if ( event->direction == GDK_SCROLL_UP ) {
- pter->zoomInActivated ();
- } else if ( event->direction == GDK_SCROLL_DOWN ) {
- pter->zoomOutActivated ();
+ if ( GDK_CONTROL_MASK == (event->state & GDK_CONTROL_MASK) )
+ {
+ if ( event->direction == GDK_SCROLL_UP )
+ {
+ pter->zoomInActivated ();
+ }
+ else if ( event->direction == GDK_SCROLL_DOWN )
+ {
+ pter->zoomOutActivated ();
+ }
+ return TRUE;
}
+ return FALSE;
}
diff --git a/trunk/src/gtk/PageView.cxx b/trunk/src/gtk/PageView.cxx
index 0546561..adaa823 100644
--- a/trunk/src/gtk/PageView.cxx
+++ b/trunk/src/gtk/PageView.cxx
@@ -527,13 +527,6 @@ page_view_scrolled_cb (GtkWidget *widget, GdkEventScroll *event, gpointer data)
{
g_assert ( NULL != data && "The data parameter is NULL.");
- // don't scroll when the CRTL-Button is down, because then the page should
- // actually be zoomed and not scrolled. Zooming is handelt by the MainView
- // class.
- if ( event->state & GDK_CONTROL_MASK )
- {
- return FALSE;
- }
PagePter *pter = (PagePter *)data;
GtkAdjustment *adjustment =
gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (widget));
--
1.7.4
|