Blob Blame History Raw
From 57dce78348cbe93d53c1432ee224e27fdd726982 Mon Sep 17 00:00:00 2001
From: Paul Cornett <paulcor@users.noreply.github.com>
Date: Wed, 25 May 2016 09:39:50 -0700
Subject: [PATCH] Avoid blank menubar/toolbar when using wx[MT]B_DOCKABLE with
 GTK+ 3.20

A GTK+ bug involving GtkHandleBox somehow prevents drawing of its child
since 3.19.7.  Avoid this by disabling the docking functionality, which
is preferable to having the bar be blank.
See #17539

(cherry picked from commit 7e41ac405f4105a7703e37bffd8ab951159f5af0)
---
 src/gtk/menu.cpp    | 7 ++++++-
 src/gtk/toolbar.cpp | 7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp
index 3c5426d..5aa3caf 100644
--- a/src/gtk/menu.cpp
+++ b/src/gtk/menu.cpp
@@ -141,7 +141,12 @@ void wxMenuBar::Init(size_t n, wxMenu *menus[], const wxString titles[], long st
 
     m_menubar = gtk_menu_bar_new();
 
-    if (style & wxMB_DOCKABLE)
+    if ((style & wxMB_DOCKABLE)
+#ifdef __WXGTK3__
+        // using GtkHandleBox prevents menubar from drawing with GTK+ >= 3.19.7
+        && gtk_check_version(3,19,7)
+#endif
+        )
     {
         m_widget = gtk_handle_box_new();
         gtk_container_add(GTK_CONTAINER(m_widget), m_menubar);
diff --git a/src/gtk/toolbar.cpp b/src/gtk/toolbar.cpp
index 9416f83..addf63a 100644
--- a/src/gtk/toolbar.cpp
+++ b/src/gtk/toolbar.cpp
@@ -388,7 +388,12 @@ bool wxToolBar::Create( wxWindow *parent,
 #endif
     GtkSetStyle();
 
-    if (style & wxTB_DOCKABLE)
+    if ((style & wxTB_DOCKABLE)
+#ifdef __WXGTK3__
+        // using GtkHandleBox prevents toolbar from drawing with GTK+ >= 3.19.7
+        && gtk_check_version(3,19,7)
+#endif
+        )
     {
         m_widget = gtk_handle_box_new();