diff options
author | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2011-11-07 20:16:55 +0400 |
---|---|---|
committer | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2011-11-07 20:16:55 +0400 |
commit | efa6a3733897de46e1737263d0c21658126e4926 (patch) | |
tree | 458e9dcbd550306c71fa01d0700f2c4d40560f3b | |
parent | 6d79d1060223b9ab7abf33e533eba751810358e0 (diff) |
Update GTK+ patches from the 2.24 branch
6 files changed, 22 insertions, 721 deletions
diff --git a/packages/gtk+.py b/packages/gtk+.py index fac35c3..10a9949 100644 --- a/packages/gtk+.py +++ b/packages/gtk+.py @@ -15,17 +15,32 @@ class GtkPackage (GnomePackage): self.sources.extend ([ # post-2.24.7 commits from 2.24 branch # gtkquartz: don't free the string returned by get_bundle_path() - 'patches/gtk/01-c040b03c2e32a773a4d9cf4019050c2f8a5b91ce.patch', + 'http://git.gnome.org/browse/gtk+/patch/?id=c040b03c2e32a773a4d9cf4019050c2f8a5b91ce', # gtkrc.key.mac: remove half the file, it was an accidential double paste - 'patches/gtk/02-79a92f99a9dbdc7b1a651b0e8665807bd89c6632.patch', + 'http://git.gnome.org/browse/gtk+/patch/?id=79a92f99a9dbdc7b1a651b0e8665807bd89c6632', # gtkrc.key.mac: add Command-cursor text navigation - 'patches/gtk/03-ccf12f7b406ecbd8f0c26b0e6dc86d4593144dab.patch', + 'http://git.gnome.org/browse/gtk+/patch/?id=ccf12f7b406ecbd8f0c26b0e6dc86d4593144dab', # gtkrc.key.mac: add '"' missing from last commit - 'patches/gtk/04-e81b6971d85c7a782269454311b022ce14787486.patch', + 'http://git.gnome.org/browse/gtk+/patch/?id=e81b6971d85c7a782269454311b022ce14787486', + # Bug 662633 - Scheduled transaction editor crashes with gtk+-2.24.7 + 'http://git.gnome.org/browse/gtk+/patch/?id=0a0fd5af99f2ae9b0f8cc6b943b98b7be43ed723', + # quartz: remove unused variable + 'http://git.gnome.org/browse/gtk+/patch/?id=0f7c96b61936dd4796a6b33a04be3ac76f6f96fc', + # quartz: Separate out screen_point conversion in function + 'http://git.gnome.org/browse/gtk+/patch/?id=cca1621e7117333ff6306b05e6508baab42e6210', + # quartz: Factor out toplevel from NSEvent code into function + 'http://git.gnome.org/browse/gtk+/patch/?id=d0e5025694697c5f3394c2e94a58b343a13dc8c6', + # quartz: Process motion events within windows bounds without window set + 'http://git.gnome.org/browse/gtk+/patch/?id=6725dee3aabc3335450657c5d40d54d6d217eeee', + # quartz: make test_resize () conform to coding style + 'http://git.gnome.org/browse/gtk+/patch/?id=ff75900b5308f074184e5ebc793f3567da61a978', + # quartz: make gdk_quartz_osx_version conform to coding style + 'http://git.gnome.org/browse/gtk+/patch/?id=5123ad079ea364a1083b579da92afc7415c0b8b7', + # quartz: handle recursive CFRunLoops + 'http://git.gnome.org/browse/gtk+/patch/?id=6f4a6b4936c78b34682547de323b2afaf4559be6', - # https://bugzilla.gnome.org/show_bug.cgi?id=516725 - # http://bugzilla-attachments.gnome.org/attachment.cgi?id=200174 - 'patches/gtk/gtk-smooth-scrolling.patch', + # smooth scrolling, https://bugzilla.gnome.org/show_bug.cgi?id=516725 + 'http://bugzilla-attachments.gnome.org/attachment.cgi?id=200174' ]) def prep (self): diff --git a/packages/patches/gtk/01-c040b03c2e32a773a4d9cf4019050c2f8a5b91ce.patch b/packages/patches/gtk/01-c040b03c2e32a773a4d9cf4019050c2f8a5b91ce.patch deleted file mode 100644 index b01d36c..0000000 --- a/packages/patches/gtk/01-c040b03c2e32a773a4d9cf4019050c2f8a5b91ce.patch +++ /dev/null @@ -1,114 +0,0 @@ -From c040b03c2e32a773a4d9cf4019050c2f8a5b91ce Mon Sep 17 00:00:00 2001 -From: Michael Natterer <mitch@gimp.org> -Date: Sat, 22 Oct 2011 21:08:32 +0000 -Subject: gtkquartz: don't free the string returned by get_bundle_path() - -It's statically allocated. ---- -diff --git a/gtk/gtkquartz.c b/gtk/gtkquartz.c -index b961752..4fdc915 100644 ---- a/gtk/gtkquartz.c -+++ b/gtk/gtkquartz.c -@@ -331,24 +331,28 @@ _gtk_quartz_set_selection_data_for_pasteboard (NSPasteboard *pasteboard, - * to test for that and remove the last element. - */ - --static gchar * --get_bundle_path () -+static const gchar * -+get_bundle_path (void) - { - static gchar *path = NULL; -+ - if (path == NULL) - { -- gchar *base; - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - gchar *resource_path = g_strdup ([[[NSBundle mainBundle] resourcePath] UTF8String]); -+ gchar *base; - [pool drain]; -+ - base = g_path_get_basename (resource_path); - if (strcmp (base, "bin") == 0) - path = g_path_get_dirname (resource_path); - else - path = strdup (resource_path); -+ - g_free (resource_path); - g_free (base); - } -+ - return path; - } - -@@ -356,12 +360,10 @@ const gchar * - _gtk_get_datadir (void) - { - static gchar *path = NULL; -+ - if (path == NULL) -- { -- gchar *resource_dir = get_bundle_path (); -- path = g_build_filename (resource_dir, "share", NULL); -- g_free (resource_dir); -- } -+ path = g_build_filename (get_bundle_path (), "share", NULL); -+ - return path; - } - -@@ -369,12 +371,10 @@ const gchar * - _gtk_get_libdir (void) - { - static gchar *path = NULL; -+ - if (path == NULL) -- { -- gchar *resource_dir = get_bundle_path (); -- path = g_build_filename (resource_dir, "lib", NULL); -- g_free (resource_dir); -- } -+ path = g_build_filename (get_bundle_path (), "lib", NULL); -+ - return path; - } - -@@ -382,12 +382,10 @@ const gchar * - _gtk_get_localedir (void) - { - static gchar *path = NULL; -+ - if (path == NULL) -- { -- gchar *resource_dir = get_bundle_path (); -- path = g_build_filename (resource_dir, "share", "locale", NULL); -- g_free (resource_dir); -- } -+ path = g_build_filename (get_bundle_path (), "share", "locale", NULL); -+ - return path; - } - -@@ -395,12 +393,10 @@ const gchar * - _gtk_get_sysconfdir (void) - { - static gchar *path = NULL; -+ - if (path == NULL) -- { -- gchar *resource_dir = get_bundle_path (); -- path = g_build_filename (resource_dir, "etc", NULL); -- g_free (resource_dir); -- } -+ path = g_build_filename (get_bundle_path (), "etc", NULL); -+ - return path; - } - -@@ -409,4 +405,3 @@ _gtk_get_data_prefix (void) - { - return get_bundle_path (); - } -- --- -cgit v0.9.0.2 diff --git a/packages/patches/gtk/02-79a92f99a9dbdc7b1a651b0e8665807bd89c6632.patch b/packages/patches/gtk/02-79a92f99a9dbdc7b1a651b0e8665807bd89c6632.patch deleted file mode 100644 index 596808b..0000000 --- a/packages/patches/gtk/02-79a92f99a9dbdc7b1a651b0e8665807bd89c6632.patch +++ /dev/null @@ -1,136 +0,0 @@ -From 79a92f99a9dbdc7b1a651b0e8665807bd89c6632 Mon Sep 17 00:00:00 2001 -From: Michael Natterer <mitch@lanedo.com> -Date: Tue, 25 Oct 2011 15:01:25 +0000 -Subject: gtkrc.key.mac: remove half the file, it was an accidential double paste - ---- -diff --git a/gtk/gtkrc.key.mac b/gtk/gtkrc.key.mac -index 5389ffe..e6ec0e8 100644 ---- a/gtk/gtkrc.key.mac -+++ b/gtk/gtkrc.key.mac -@@ -120,123 +120,3 @@ binding "gtk-mac-icon-view" - } - - class "GtkIconView" binding "gtk-mac-icon-view" --binding "gtk-mac-alt-arrows" --{ -- bind "<alt>Right" { "move-cursor" (words, 1, 0) } -- bind "<alt>KP_Right" { "move-cursor" (words, 1, 0) } -- bind "<alt>Left" { "move-cursor" (words, -1, 0) } -- bind "<alt>KP_Left" { "move-cursor" (words, -1, 0) } -- bind "<shift><alt>Right" { "move-cursor" (words, 1, 1) } -- bind "<shift><alt>KP_Right" { "move-cursor" (words, 1, 1) } -- bind "<shift><alt>Left" { "move-cursor" (words, -1, 1) } -- bind "<shift><alt>KP_Left" { "move-cursor" (words, -1, 1) } --} -- --class "GtkTextView" binding "gtk-mac-alt-arrows" --class "GtkLabel" binding "gtk-mac-alt-arrows" --class "GtkEntry" binding "gtk-mac-alt-arrows" -- -- --binding "gtk-mac-alt-delete" --{ -- bind "<alt>Delete" { "delete-from-cursor" (word-ends, 1) } -- bind "<alt>KP_Delete" { "delete-from-cursor" (word-ends, 1) } -- bind "<alt>BackSpace" { "delete-from-cursor" (word-ends, -1) } --} -- --class "GtkTextView" binding "gtk-mac-alt-delete" --class "GtkEntry" binding "gtk-mac-alt-delete" -- -- --binding "gtk-mac-cmd-c" --{ -- bind "<meta>x" { "cut-clipboard" () } -- bind "<meta>c" { "copy-clipboard" () } -- bind "<meta>v" { "paste-clipboard" () } -- unbind "<ctrl>x" -- unbind "<ctrl>c" -- unbind "<ctrl>v" --} -- --class "GtkTextView" binding "gtk-mac-cmd-c" --class "GtkEntry" binding "gtk-mac-cmd-c" -- -- --binding "gtk-mac-text-view" --{ -- bind "<shift><meta>a" { "select-all" (0) } -- bind "<meta>a" { "select-all" (1) } -- unbind "<shift><ctrl>a" -- unbind "<ctrl>a" --} -- --class "GtkTextView" binding "gtk-mac-text-view" -- -- --binding "gtk-mac-label" --{ -- bind "<meta>a" { -- "move-cursor" (paragraph-ends, -1, 0) -- "move-cursor" (paragraph-ends, 1, 1) -- } -- bind "<shift><meta>a" { "move-cursor" (paragraph-ends, 0, 0) } -- bind "<meta>c" { "copy-clipboard" () } -- unbind "<ctrl>a" -- unbind "<shift><ctrl>a" -- unbind "<ctrl>c" --} -- --class "GtkLabel" binding "gtk-mac-label" -- -- --binding "gtk-mac-entry" --{ -- bind "<meta>a" { -- "move-cursor" (buffer-ends, -1, 0) -- "move-cursor" (buffer-ends, 1, 1) -- } -- bind "<shift><meta>a" { "move-cursor" (visual-positions, 0, 0) } -- unbind "<ctrl>a" -- unbind "<shift><ctrl>a" --} -- --class "GtkEntry" binding "gtk-mac-entry" -- -- --binding "gtk-mac-file-chooser" --{ -- bind "<meta>v" { "location-popup-on-paste" () } -- unbind "<ctrl>v" -- -- bind "<meta><shift>G" { "location-popup" () } -- bind "<meta><shift>H" { "home-folder" () } -- bind "<meta>Up" { "up-folder" () } --} -- --class "GtkFileChooserDefault" binding "gtk-mac-file-chooser" -- -- --binding "gtk-mac-tree-view" --{ -- bind "<meta>a" { "select-all" () } -- bind "<shift><meta>a" { "unselect-all" () } -- bind "<meta>f" { "start-interactive-search" () } -- bind "<meta>F" { "start-interactive-search" () } -- unbind "<ctrl>a" -- unbind "<shift><ctrl>a" -- unbind "<ctrl>f" -- unbind "<ctrl>F" --} -- --class "GtkTreeView" binding "gtk-mac-tree-view" -- -- --binding "gtk-mac-icon-view" --{ -- bind "<meta>a" { "select-all" () } -- bind "<shift><meta>a" { "unselect-all" () } -- unbind "<ctrl>a" -- unbind "<shift><ctrl>a" --} -- --class "GtkIconView" binding "gtk-mac-icon-view" --- -cgit v0.9.0.2 diff --git a/packages/patches/gtk/03-ccf12f7b406ecbd8f0c26b0e6dc86d4593144dab.patch b/packages/patches/gtk/03-ccf12f7b406ecbd8f0c26b0e6dc86d4593144dab.patch deleted file mode 100644 index 36b2092..0000000 --- a/packages/patches/gtk/03-ccf12f7b406ecbd8f0c26b0e6dc86d4593144dab.patch +++ /dev/null @@ -1,56 +0,0 @@ -From ccf12f7b406ecbd8f0c26b0e6dc86d4593144dab Mon Sep 17 00:00:00 2001 -From: Michael Natterer <mitch@lanedo.com> -Date: Tue, 25 Oct 2011 20:19:11 +0000 -Subject: gtkrc.key.mac: add Command-cursor text navigation - -and some emacs-ish Control bindings that work in native widgets. -Patch from Michael Hutchinson. ---- -diff --git a/gtk/gtkrc.key.mac b/gtk/gtkrc.key.mac -index e6ec0e8..631e0dd 100644 ---- a/gtk/gtkrc.key.mac -+++ b/gtk/gtkrc.key.mac -@@ -83,6 +83,41 @@ binding "gtk-mac-entry" - class "GtkEntry" binding "gtk-mac-entry" - - -+binding "gtk-mac-cmd-arrows" -+{ -+ bind "<meta>Left" { "move-cursor" (paragraph-ends, -1, 0) } -+ bind "<meta>KP_Left" { "move-cursor" (paragraph-ends, -1, 0) } -+ bind "<shift><meta>Left" { "move-cursor" (paragraph-ends, -1, 1) } -+ bind "<shift><meta>KP_Left" { "move-cursor" (paragraph-ends, -1, 1) } -+ bind "<meta>Right" { "move-cursor" (paragraph-ends, 1, 0) } -+ bind "<meta>KP_Right" { "move-cursor" (paragraph-ends, 1, 0) } -+ bind "<shift><meta>Right" { "move-cursor" (paragraph-ends, 1, 1) } -+ bind "<shift><meta>KP_Right" { "move-cursor" (paragraph-ends, 1, 1) } -+} -+ -+class "GtkTextView" binding "gtk-mac-cmd-arrows" -+class "GtkLabel" binding "gtk-mac-cmd-arrows" -+class "GtkEntry" binding "gtk-mac-cmd-arrows" -+ -+ -+binding "gtk-mac-emacs-like" -+{ -+ bind "<ctrl>a" { "move-cursor" (paragraph-ends, -1, 0) } -+ bind "<shift><ctrl>a" { "move-cursor" (paragraph-ends, -1, 1) } -+ bind "<ctrl>e" { "move-cursor" (paragraph-ends, 1, 0) } -+ bind "<shift><ctrl>e" { "move-cursor" (paragraph-ends, 1, 1) } -+ -+ bind "<ctrl>b" { "move-cursor" (logical-positions, -1, 0) } -+ bind "<shift><ctrl>b" { "move-cursor" (logical-positions, -1, 1) } -+ bind "<ctrl>f" { "move-cursor" (logical-positions, 1, 0) } -+ bind "<shift><ctrl>f" { "move-cursor" (logical-positions, 1, 1) } -+} -+ -+class "GtkTextView" binding "gtk-mac-emacs-like" -+class "GtkLabel" binding "gtk-mac-emacs-like" -+class "GtkEntry" binding "gtk-mac-emacs-like -+ -+ - binding "gtk-mac-file-chooser" - { - bind "<meta>v" { "location-popup-on-paste" () } --- -cgit v0.9.0.2 diff --git a/packages/patches/gtk/04-e81b6971d85c7a782269454311b022ce14787486.patch b/packages/patches/gtk/04-e81b6971d85c7a782269454311b022ce14787486.patch deleted file mode 100644 index 130211e..0000000 --- a/packages/patches/gtk/04-e81b6971d85c7a782269454311b022ce14787486.patch +++ /dev/null @@ -1,21 +0,0 @@ -From e81b6971d85c7a782269454311b022ce14787486 Mon Sep 17 00:00:00 2001 -From: Michael Natterer <mitch@lanedo.com> -Date: Fri, 28 Oct 2011 08:19:24 +0000 -Subject: gtkrc.key.mac: add '"' missing from last commit - ---- -diff --git a/gtk/gtkrc.key.mac b/gtk/gtkrc.key.mac -index 631e0dd..980f3e4 100644 ---- a/gtk/gtkrc.key.mac -+++ b/gtk/gtkrc.key.mac -@@ -115,7 +115,7 @@ binding "gtk-mac-emacs-like" - - class "GtkTextView" binding "gtk-mac-emacs-like" - class "GtkLabel" binding "gtk-mac-emacs-like" --class "GtkEntry" binding "gtk-mac-emacs-like -+class "GtkEntry" binding "gtk-mac-emacs-like" - - - binding "gtk-mac-file-chooser" --- -cgit v0.9.0.2 diff --git a/packages/patches/gtk/gtk-smooth-scrolling.patch b/packages/patches/gtk/gtk-smooth-scrolling.patch deleted file mode 100644 index b634232..0000000 --- a/packages/patches/gtk/gtk-smooth-scrolling.patch +++ /dev/null @@ -1,387 +0,0 @@ -diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c -index 53833a0..0f8bba2 100644 ---- a/gdk/gdkevents.c -+++ b/gdk/gdkevents.c -@@ -392,6 +392,8 @@ gdk_event_new (GdkEventType type) - new_event->scroll.y = 0.; - new_event->scroll.x_root = 0.; - new_event->scroll.y_root = 0.; -+ new_event->scroll.delta_x = 0.; -+ new_event->scroll.delta_y = 0.; - break; - case GDK_ENTER_NOTIFY: - case GDK_LEAVE_NOTIFY: -@@ -845,6 +847,36 @@ gdk_event_get_root_coords (const GdkEvent *event, - return fetched; - } - -+gboolean -+gdk_event_get_scroll_deltas (const GdkEvent *event, -+ gdouble *delta_x, -+ gdouble *delta_y) -+{ -+ gboolean fetched = TRUE; -+ gdouble dx = 0.0; -+ gdouble dy = 0.0; -+ -+ switch (event->type) -+ { -+ case GDK_SCROLL: -+ fetched = event->scroll.has_deltas; -+ dx = event->scroll.delta_x; -+ dy = event->scroll.delta_y; -+ break; -+ default: -+ fetched = FALSE; -+ break; -+ } -+ -+ if (delta_x) -+ *delta_x = dx; -+ -+ if (delta_y) -+ *delta_y = dy; -+ -+ return fetched; -+} -+ - /** - * gdk_event_get_axis: - * @event: a #GdkEvent -diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h -index e6c516c..e0802eb 100644 ---- a/gdk/gdkevents.h -+++ b/gdk/gdkevents.h -@@ -337,6 +337,9 @@ struct _GdkEventScroll - GdkScrollDirection direction; - GdkDevice *device; - gdouble x_root, y_root; -+ gboolean has_deltas; -+ gdouble delta_x; -+ gdouble delta_y; - }; - - struct _GdkEventKey -@@ -537,6 +540,9 @@ gboolean gdk_event_get_coords (const GdkEvent *event, - gboolean gdk_event_get_root_coords (const GdkEvent *event, - gdouble *x_root, - gdouble *y_root); -+gboolean gdk_event_get_scroll_deltas (const GdkEvent *event, -+ gdouble *delta_x, -+ gdouble *delta_y); - gboolean gdk_event_get_axis (const GdkEvent *event, - GdkAxisUse axis_use, - gdouble *value); -diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c -index f058570..7327a23 100644 ---- a/gdk/gdkwindow.c -+++ b/gdk/gdkwindow.c -@@ -10794,6 +10794,9 @@ proxy_button_event (GdkEvent *source_event, - event->scroll.y_root = source_event->scroll.y_root; - event->scroll.state = state; - event->scroll.device = source_event->scroll.device; -+ event->scroll.has_deltas = source_event->scroll.has_deltas; -+ event->scroll.delta_x = source_event->scroll.delta_x; -+ event->scroll.delta_y = source_event->scroll.delta_y; - return TRUE; - - default: -diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c -index 4625070..71db965 100644 ---- a/gdk/quartz/gdkevents-quartz.c -+++ b/gdk/quartz/gdkevents-quartz.c -@@ -847,6 +847,9 @@ fill_scroll_event (GdkWindow *window, - gint y, - gint x_root, - gint y_root, -+ gboolean has_deltas, -+ gdouble delta_x, -+ gdouble delta_y, - GdkScrollDirection direction) - { - GdkWindowObject *private; -@@ -866,6 +869,9 @@ fill_scroll_event (GdkWindow *window, - event->scroll.state = get_keyboard_modifiers_from_ns_event (nsevent); - event->scroll.direction = direction; - event->scroll.device = _gdk_display->core_pointer; -+ event->scroll.has_deltas = has_deltas; -+ event->scroll.delta_x = delta_x; -+ event->scroll.delta_y = delta_y; - } - - static void -@@ -1261,28 +1267,59 @@ gdk_event_translate (GdkEvent *event, - - case NSScrollWheel: - { -- float dx = [nsevent deltaX]; -- float dy = [nsevent deltaY]; -- GdkScrollDirection direction; -- -- if (dy != 0) -- { -- if (dy < 0.0) -- direction = GDK_SCROLL_DOWN; -- else -- direction = GDK_SCROLL_UP; -+ GdkScrollDirection direction; -+ float dx; -+ float dy; - -- fill_scroll_event (window, event, nsevent, x, y, x_root, y_root, direction); -- } -+ if (gdk_quartz_osx_version() >= GDK_OSX_LION && -+ [nsevent hasPreciseScrollingDeltas]) -+ { -+ dx = [nsevent scrollingDeltaX]; -+ dy = [nsevent scrollingDeltaY]; - -- if (dx != 0) -- { -- if (dx < 0.0) -- direction = GDK_SCROLL_RIGHT; -+ if (fabs (dy) > fabs (dx)) -+ { -+ if (dy < 0.0) -+ direction = GDK_SCROLL_DOWN; -+ else -+ direction = GDK_SCROLL_UP; -+ } - else -- direction = GDK_SCROLL_LEFT; -+ { -+ if (dx < 0.0) -+ direction = GDK_SCROLL_RIGHT; -+ else -+ direction = GDK_SCROLL_LEFT; -+ } -+ -+ fill_scroll_event (window, event, nsevent, x, y, x_root, y_root, -+ TRUE, -dx, -dy, direction); -+ } -+ else -+ { -+ dx = [nsevent deltaX]; -+ dy = [nsevent deltaY]; -+ -+ if (dy != 0.0) -+ { -+ if (dy < 0.0) -+ direction = GDK_SCROLL_DOWN; -+ else -+ direction = GDK_SCROLL_UP; - -- fill_scroll_event (window, event, nsevent, x, y, x_root, y_root, direction); -+ fill_scroll_event (window, event, nsevent, x, y, x_root, y_root, -+ FALSE, 0.0, fabs (dy), direction); -+ } -+ else if (dx != 0.0) -+ { -+ if (dx < 0.0) -+ direction = GDK_SCROLL_RIGHT; -+ else -+ direction = GDK_SCROLL_LEFT; -+ -+ fill_scroll_event (window, event, nsevent, x, y, x_root, y_root, -+ FALSE, fabs (dx), 0.0, direction); -+ } - } - } - break; -diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c -index 3932976..ea434be 100644 ---- a/gtk/gtkrange.c -+++ b/gtk/gtkrange.c -@@ -2546,7 +2546,7 @@ gtk_range_button_release (GtkWidget *widget, - /** - * _gtk_range_get_wheel_delta: - * @range: a #GtkRange -- * @direction: A #GdkScrollDirection -+ * @event: A #GdkEventScroll - * - * Returns a good step value for the mouse wheel. - * -@@ -2555,27 +2555,52 @@ gtk_range_button_release (GtkWidget *widget, - * Since: 2.4 - **/ - gdouble --_gtk_range_get_wheel_delta (GtkRange *range, -- GdkScrollDirection direction) -+_gtk_range_get_wheel_delta (GtkRange *range, -+ GdkEventScroll *event) - { - GtkAdjustment *adj = range->adjustment; -+ gdouble dx, dy; - gdouble delta; - -- if (GTK_IS_SCROLLBAR (range)) -- delta = pow (adj->page_size, 2.0 / 3.0); -+ if (gdk_event_get_scroll_deltas ((GdkEvent *) event, &dx, &dy)) -+ { -+ GtkAllocation allocation; -+ -+ gtk_widget_get_allocation (GTK_WIDGET (range), &allocation); -+ -+ if (gtk_orientable_get_orientation (GTK_ORIENTABLE (range)) == GTK_ORIENTATION_HORIZONTAL) -+ { -+ if (GTK_IS_SCROLLBAR (range) && adj->page_size > 0) -+ delta = dx * adj->page_size / allocation.width; -+ else -+ delta = dx * (adj->upper - adj->lower) / allocation.width; -+ } -+ else -+ { -+ if (GTK_IS_SCROLLBAR (range) && adj->page_size > 0) -+ delta = dy * adj->page_size / allocation.height; -+ else -+ delta = dy * (adj->upper - adj->lower) / allocation.height; -+ } -+ } - else -- delta = adj->step_increment * 2; -- -- if (direction == GDK_SCROLL_UP || -- direction == GDK_SCROLL_LEFT) -- delta = - delta; -- -+ { -+ if (GTK_IS_SCROLLBAR (range)) -+ delta = pow (adj->page_size, 2.0 / 3.0); -+ else -+ delta = adj->step_increment * 2; -+ -+ if (event->direction == GDK_SCROLL_UP || -+ event->direction == GDK_SCROLL_LEFT) -+ delta = - delta; -+ } -+ - if (range->inverted) - delta = - delta; - - return delta; - } -- -+ - static gboolean - gtk_range_scroll_event (GtkWidget *widget, - GdkEventScroll *event) -@@ -2588,7 +2613,7 @@ gtk_range_scroll_event (GtkWidget *widget, - gdouble delta; - gboolean handled; - -- delta = _gtk_range_get_wheel_delta (range, event->direction); -+ delta = _gtk_range_get_wheel_delta (range, event); - - g_signal_emit (range, signals[CHANGE_VALUE], 0, - GTK_SCROLL_JUMP, adj->value + delta, -diff --git a/gtk/gtkrange.h b/gtk/gtkrange.h -index a708879..3131fbe 100644 ---- a/gtk/gtkrange.h -+++ b/gtk/gtkrange.h -@@ -199,8 +199,8 @@ gint gtk_range_get_round_digits (GtkRange *range - - - /* internal API */ --gdouble _gtk_range_get_wheel_delta (GtkRange *range, -- GdkScrollDirection direction); -+gdouble _gtk_range_get_wheel_delta (GtkRange *range, -+ GdkEventScroll *event); - - void _gtk_range_set_stop_values (GtkRange *range, - gdouble *values, -diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c -index 05389fa..999df18 100644 ---- a/gtk/gtkscrolledwindow.c -+++ b/gtk/gtkscrolledwindow.c -@@ -1568,31 +1568,77 @@ static gboolean - gtk_scrolled_window_scroll_event (GtkWidget *widget, - GdkEventScroll *event) - { -- GtkWidget *range; -+ GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget); -+ gboolean handled = FALSE; -+ gdouble delta_x; -+ gdouble delta_y; - - g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (widget), FALSE); - g_return_val_if_fail (event != NULL, FALSE); - -- if (event->direction == GDK_SCROLL_UP || event->direction == GDK_SCROLL_DOWN) -- range = GTK_SCROLLED_WINDOW (widget)->vscrollbar; -- else -- range = GTK_SCROLLED_WINDOW (widget)->hscrollbar; -+ if (gdk_event_get_scroll_deltas ((GdkEvent *) event, &delta_x, &delta_y)) -+ { -+ if (delta_x != 0.0 && scrolled_window->hscrollbar && -+ gtk_widget_get_visible (scrolled_window->hscrollbar)) -+ { -+ GtkAdjustment *adj; -+ gdouble new_value; -+ -+ adj = gtk_range_get_adjustment (GTK_RANGE (scrolled_window->hscrollbar)); -+ -+ new_value = CLAMP (gtk_adjustment_get_value (adj) + delta_x, -+ gtk_adjustment_get_lower (adj), -+ gtk_adjustment_get_upper (adj) - -+ gtk_adjustment_get_page_size (adj)); -+ -+ gtk_adjustment_set_value (adj, new_value); -+ -+ handled = TRUE; -+ } -+ -+ if (delta_y != 0.0 && scrolled_window->vscrollbar && -+ gtk_widget_get_visible (scrolled_window->vscrollbar)) -+ { -+ GtkAdjustment *adj; -+ gdouble new_value; -+ -+ adj = gtk_range_get_adjustment (GTK_RANGE (scrolled_window->vscrollbar)); -+ -+ new_value = CLAMP (gtk_adjustment_get_value (adj) + delta_y, -+ gtk_adjustment_get_lower (adj), -+ gtk_adjustment_get_upper (adj) - -+ gtk_adjustment_get_page_size (adj)); - -- if (range && gtk_widget_get_visible (range)) -+ gtk_adjustment_set_value (adj, new_value); -+ -+ handled = TRUE; -+ } -+ } -+ else - { -- GtkAdjustment *adj = GTK_RANGE (range)->adjustment; -- gdouble delta, new_value; -+ GtkWidget *range; - -- delta = _gtk_range_get_wheel_delta (GTK_RANGE (range), event->direction); -+ if (event->direction == GDK_SCROLL_UP || event->direction == GDK_SCROLL_DOWN) -+ range = scrolled_window->vscrollbar; -+ else -+ range = scrolled_window->hscrollbar; - -- new_value = CLAMP (adj->value + delta, adj->lower, adj->upper - adj->page_size); -- -- gtk_adjustment_set_value (adj, new_value); -+ if (range && gtk_widget_get_visible (range)) -+ { -+ GtkAdjustment *adj = GTK_RANGE (range)->adjustment; -+ gdouble delta, new_value; - -- return TRUE; -+ delta = _gtk_range_get_wheel_delta (GTK_RANGE (range), event); -+ -+ new_value = CLAMP (adj->value + delta, adj->lower, adj->upper - adj->page_size); -+ -+ gtk_adjustment_set_value (adj, new_value); -+ -+ handled = TRUE; -+ } - } - -- return FALSE; -+ return handled; - } - - static gboolean |