Skip to content

Commit

Permalink
wxGTK: Add private options to bring back traditional scrollbar(always…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
徐扬斌 committed May 6, 2024
1 parent 33c801b commit 4f22df0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/wx/window.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
#define wxUSE_MENUS_NATIVE wxUSE_MENUS
#endif // __WXUNIVERSAL__/!__WXUNIVERSAL__

#ifdef __WXGTK__
namespace CMExtension {
extern bool g_need_traditional_scrollbar;
}
#endif

// ----------------------------------------------------------------------------
// forward declarations
// ----------------------------------------------------------------------------
Expand Down
7 changes: 7 additions & 0 deletions src/gtk/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ typedef guint KeySym;
#define PANGO_VERSION_CHECK(a,b,c) 0
#endif

namespace CMExtension {
bool g_need_traditional_scrollbar = false;
}

//-----------------------------------------------------------------------------
// documentation on internals
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -2764,6 +2768,9 @@ void wxWindowGTK::GTKCreateScrolledWindowWith(GtkWidget* view)
m_widget = gtk_scrolled_window_new( NULL, NULL );

GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget);

if (CMExtension::g_need_traditional_scrollbar)
g_object_set(scrolledWindow, "overlay-scrolling", false, NULL);

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

0 comments on commit 4f22df0

Please sign in to comment.