Fix the default background color reported for toplevel windows with GTK3

See #18811
This commit is contained in:
Paul Cornett 2020-07-06 23:13:33 -07:00
parent f259f4152b
commit 687267b9db
2 changed files with 11 additions and 0 deletions

View File

@ -74,6 +74,7 @@ public:
virtual void SetLabel(const wxString& label) wxOVERRIDE { SetTitle( label ); }
virtual wxString GetLabel() const wxOVERRIDE { return GetTitle(); }
virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE;
virtual bool SetTransparent(wxByte alpha) wxOVERRIDE;
virtual bool CanSetTransparent() wxOVERRIDE;

View File

@ -35,6 +35,7 @@
#include "wx/gtk/private.h"
#include "wx/gtk/private/gtk3-compat.h"
#include "wx/gtk/private/stylecontext.h"
#include "wx/gtk/private/win_gtk.h"
#ifdef GDK_WINDOWING_X11
@ -1815,3 +1816,12 @@ bool wxTopLevelWindowGTK::CanSetTransparent()
"Composite", &opcode, &event, &error);
#endif
}
wxVisualAttributes wxTopLevelWindowGTK::GetDefaultAttributes() const
{
wxVisualAttributes attrs(GetClassDefaultAttributes());
#ifdef __WXGTK3__
wxGtkStyleContext().AddWindow().Bg(attrs.colBg);
#endif
return attrs;
}