Skip to content

Commit 4f22df0

Browse files
author
徐扬斌
committed
wxGTK: Add private options to bring back traditional scrollbar(always visible).
GTK3 defaults to enable the 'overlay-scrolling' features, that is, only show scrollbar when the mouse/touching hover the scrollbar area. It is undesirable to many of our clients. Yet wxWidgets does NOT exposing any API for us to do the GTK customization. So we need to add our 'CMExtension' to workaround this problem. This MAY be a temporary solution. We may make a new patch in the future by introducing a new properly designed API to wxWidgets for this sort of native/per-platform customization.
1 parent 33c801b commit 4f22df0

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

include/wx/window.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@
4949
#define wxUSE_MENUS_NATIVE wxUSE_MENUS
5050
#endif // __WXUNIVERSAL__/!__WXUNIVERSAL__
5151

52+
#ifdef __WXGTK__
53+
namespace CMExtension {
54+
extern bool g_need_traditional_scrollbar;
55+
}
56+
#endif
57+
5258
// ----------------------------------------------------------------------------
5359
// forward declarations
5460
// ----------------------------------------------------------------------------

src/gtk/window.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ typedef guint KeySym;
7272
#define PANGO_VERSION_CHECK(a,b,c) 0
7373
#endif
7474

75+
namespace CMExtension {
76+
bool g_need_traditional_scrollbar = false;
77+
}
78+
7579
//-----------------------------------------------------------------------------
7680
// documentation on internals
7781
//-----------------------------------------------------------------------------
@@ -2764,6 +2768,9 @@ void wxWindowGTK::GTKCreateScrolledWindowWith(GtkWidget* view)
27642768
m_widget = gtk_scrolled_window_new( NULL, NULL );
27652769

27662770
GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget);
2771+
2772+
if (CMExtension::g_need_traditional_scrollbar)
2773+
g_object_set(scrolledWindow, "overlay-scrolling", false, NULL);
27672774

27682775
// There is a conflict with default bindings at GTK+
27692776
// level between scrolled windows and notebooks both of which want to use

0 commit comments

Comments
 (0)