Title: [279821] trunk/Source/WebCore
Revision
279821
Author
commit-qu...@webkit.org
Date
2021-07-12 01:22:41 -0700 (Mon, 12 Jul 2021)

Log Message

[GTK4] Scrollbar click doesn't work as expected when native scrollbars are off
https://bugs.webkit.org/show_bug.cgi?id=226331

Patch by Alexander Mikhaylenko <al...@gnome.org> on 2021-07-12
Reviewed by Carlos Garcia Campos.

Make Adwaita scrollbar theme follow the GTK setting if possible.

* platform/adwaita/ScrollbarThemeAdwaita.cpp:
(WebCore::ScrollbarThemeAdwaita::handleMousePressEvent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (279820 => 279821)


--- trunk/Source/WebCore/ChangeLog	2021-07-12 07:53:37 UTC (rev 279820)
+++ trunk/Source/WebCore/ChangeLog	2021-07-12 08:22:41 UTC (rev 279821)
@@ -1,3 +1,15 @@
+2021-07-12  Alexander Mikhaylenko  <al...@gnome.org>
+
+        [GTK4] Scrollbar click doesn't work as expected when native scrollbars are off
+        https://bugs.webkit.org/show_bug.cgi?id=226331
+
+        Reviewed by Carlos Garcia Campos.
+
+        Make Adwaita scrollbar theme follow the GTK setting if possible.
+
+        * platform/adwaita/ScrollbarThemeAdwaita.cpp:
+        (WebCore::ScrollbarThemeAdwaita::handleMousePressEvent):
+
 2021-07-11  Chris Dumez  <cdu...@apple.com>
 
         :link and :visited pseudo-class selectors should not match <link> elements

Modified: trunk/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp (279820 => 279821)


--- trunk/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp	2021-07-12 07:53:37 UTC (rev 279820)
+++ trunk/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp	2021-07-12 08:22:41 UTC (rev 279821)
@@ -34,6 +34,10 @@
 #include "Scrollbar.h"
 #include "ThemeAdwaita.h"
 
+#if PLATFORM(GTK)
+#include <gtk/gtk.h>
+#endif
+
 namespace WebCore {
 
 static const unsigned scrollbarSize = 13;
@@ -233,13 +237,21 @@
 
 ScrollbarButtonPressAction ScrollbarThemeAdwaita::handleMousePressEvent(Scrollbar&, const PlatformMouseEvent& event, ScrollbarPart pressedPart)
 {
+    gboolean warpSlider = FALSE;
     switch (pressedPart) {
     case BackTrackPart:
     case ForwardTrackPart:
+#if PLATFORM(GTK)
+        g_object_get(gtk_settings_get_default(),
+            "gtk-primary-button-warps-slider",
+            &warpSlider, nullptr);
+#endif
         // The shift key or middle/right button reverses the sense.
         if (event.shiftKey() || event.button() != LeftButton)
-            return ScrollbarButtonPressAction::CenterOnThumb;
-        return ScrollbarButtonPressAction::Scroll;
+            warpSlider = !warpSlider;
+        return warpSlider ?
+            ScrollbarButtonPressAction::CenterOnThumb:
+            ScrollbarButtonPressAction::Scroll;
     case ThumbPart:
         if (event.button() != RightButton)
             return ScrollbarButtonPressAction::StartDrag;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to