summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorJuan Pablo Ugarte <juanpablougarte@gmail.com>2016-05-13 19:07:43 -0300
committerJuan Pablo Ugarte <juanpablougarte@gmail.com>2016-05-13 19:07:43 -0300
commit7b0aa0166486e5c85973960ebb54f31790754ffc (patch)
treef9c85f49f29e8b6009dc1b09b979008af0a28fa5 /plugins
parent4c1bf931a5a23bf75f279a35ab5ccabb728a3959 (diff)
downloadglade-7b0aa0166486e5c85973960ebb54f31790754ffc.tar.gz
Fixed bug #765885 "client side decoration, no space to add header bar"
Diffstat (limited to 'plugins')
-rw-r--r--plugins/gtk+/glade-gtk-window.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/plugins/gtk+/glade-gtk-window.c b/plugins/gtk+/glade-gtk-window.c
index 9d57c5a1..86ca162e 100644
--- a/plugins/gtk+/glade-gtk-window.c
+++ b/plugins/gtk+/glade-gtk-window.c
@@ -45,6 +45,16 @@ glade_gtk_window_parse_finished (GladeProject * project, GObject * object)
"use-csd", gtk_window_get_titlebar(GTK_WINDOW (object)) != NULL);
}
+static void
+glade_gtk_window_ensure_titlebar_placeholder (GObject *window)
+{
+ GtkWidget *placeholder = glade_placeholder_new ();
+
+ gtk_window_set_titlebar (GTK_WINDOW (window), placeholder);
+
+ gtk_widget_hide (placeholder);
+}
+
void
glade_gtk_window_post_create (GladeWidgetAdaptor * adaptor,
GObject * object, GladeCreateReason reason)
@@ -52,10 +62,17 @@ glade_gtk_window_post_create (GladeWidgetAdaptor * adaptor,
GladeWidget *parent = glade_widget_get_from_gobject (object);
GladeProject *project = glade_widget_get_project (parent);
- /* Avoid obnoxious window decorations comming up exposing close buttons
- * which actually close glade itself.
+ /* Add a placeholder as the titlebar widget and hide it.
+ *
+ * This way we avoid client side decorations in the workspace in non WM backends
+ * like wayland.
+ *
+ * We do not use gtk_window_set_decorated (FALSE) because we need to be able to show
+ * the decoration if the user enables CSD.
+ *
+ * See Bug 765885 - "client side decoration, no space to add header bar"
*/
- gtk_window_set_decorated (GTK_WINDOW (object), FALSE);
+ glade_gtk_window_ensure_titlebar_placeholder (object);
if (reason == GLADE_CREATE_LOAD)
{
@@ -240,25 +257,23 @@ glade_gtk_window_set_property (GladeWidgetAdaptor * adaptor,
}
else if (!strcmp (id, "use-csd"))
{
+ GtkWidget *titlebar = gtk_window_get_titlebar (GTK_WINDOW (object));
+
if (g_value_get_boolean (value))
{
- GtkWidget *titlebar;
-
- titlebar = gtk_window_get_titlebar (GTK_WINDOW (object));
- if (!titlebar)
- {
- titlebar = glade_placeholder_new ();
- gtk_window_set_titlebar (GTK_WINDOW (object), titlebar);
- }
g_object_set_data (G_OBJECT (titlebar), "special-child-type", "titlebar");
+ /* make sure the titlebar widget is visible */
+ gtk_widget_show (titlebar);
+
glade_widget_property_set_sensitive (gwidget, "title", FALSE, CSD_DISABLED_MESSAGE);
glade_widget_property_set_sensitive (gwidget, "decorated", FALSE, CSD_DISABLED_MESSAGE);
glade_widget_property_set_sensitive (gwidget, "hide-titlebar-when-maximized", FALSE, CSD_DISABLED_MESSAGE);
}
else
{
- gtk_window_set_titlebar (GTK_WINDOW (object), NULL);
+ /* Set a hidden placeholder as the titlebar */
+ glade_gtk_window_ensure_titlebar_placeholder (object);
glade_widget_property_set_sensitive (gwidget, "title", TRUE, NULL);
glade_widget_property_set_sensitive (gwidget, "decorated", TRUE, NULL);