updated on Tue Jan 10 08:08:34 UTC 2012
[aur-mirror.git] / gtk3-scroll / scroller.patch
blobb7b6eac15637572d616b9150052d4bb5c9cff492
1 *** gtknotebook.c 2011-05-01 17:26:36.000000000 +0200
2 --- /tmp/gtknotebook.c 2011-05-01 17:26:31.000000000 +0200
3 ***************
4 *** 340,345 ****
5 --- 340,347 ----
6 cairo_t *cr);
7 static gint gtk_notebook_button_press (GtkWidget *widget,
8 GdkEventButton *event);
9 + static gboolean gtk_notebook_scroll (GtkWidget *widget,
10 + GdkEventScroll *event);
11 static gint gtk_notebook_button_release (GtkWidget *widget,
12 GdkEventButton *event);
13 static gboolean gtk_notebook_popup_menu (GtkWidget *widget);
14 ***************
15 *** 659,664 ****
16 --- 661,667 ----
17 widget_class->drag_data_received = gtk_notebook_drag_data_received;
18 widget_class->drag_failed = gtk_notebook_drag_failed;
19 widget_class->compute_expand = gtk_notebook_compute_expand;
20 + widget_class->scroll_event = gtk_notebook_scroll;
22 container_class->add = gtk_notebook_add;
23 container_class->remove = gtk_notebook_remove;
24 ***************
25 *** 1857,1863 ****
26 attributes.event_mask = gtk_widget_get_events (widget);
27 attributes.event_mask |= (GDK_BUTTON_PRESS_MASK |
28 GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK |
29 ! GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
30 attributes_mask = GDK_WA_X | GDK_WA_Y;
32 priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
33 --- 1860,1866 ----
34 attributes.event_mask = gtk_widget_get_events (widget);
35 attributes.event_mask |= (GDK_BUTTON_PRESS_MASK |
36 GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK |
37 ! GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_SCROLL_MASK);
38 attributes_mask = GDK_WA_X | GDK_WA_Y;
40 priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
41 ***************
42 *** 2245,2250 ****
43 --- 2248,2297 ----
47 + static gboolean
48 + gtk_notebook_scroll (GtkWidget *widget,
49 + GdkEventScroll *event)
50 + {
51 + GtkNotebook *notebook = GTK_NOTEBOOK (widget);
52 + GtkNotebookPrivate *priv = notebook->priv;
53 + GtkWidget *child, *event_widget;
54 + gint i;
56 + if (!priv->cur_page)
57 + return FALSE;
59 + child = priv->cur_page->child;
60 + event_widget = gtk_get_event_widget ((GdkEvent *)event);
62 + /* ignore scroll events from the content of the page */
63 + if (!event_widget || gtk_widget_is_ancestor (event_widget, child) || event_widget == child)
64 + return FALSE;
66 + /* nor from the action area */
67 + for (i = 0; i < 2; i++)
68 + {
69 + if (event_widget == priv->action_widget[i] ||
70 + (priv->action_widget[i] &&
71 + gtk_widget_is_ancestor (event_widget, priv->action_widget[i])))
72 + return FALSE;
73 + }
75 + switch (event->direction)
76 + {
77 + case GDK_SCROLL_RIGHT:
78 + case GDK_SCROLL_DOWN:
79 + gtk_notebook_next_page (notebook);
80 + break;
81 + case GDK_SCROLL_LEFT:
82 + case GDK_SCROLL_UP:
83 + gtk_notebook_prev_page (notebook);
84 + break;
85 + }
87 + return TRUE;
88 + }
91 static void
92 gtk_notebook_get_preferred_width (GtkWidget *widget,
93 gint *minimum,