summaryrefslogtreecommitdiff
path: root/csd__clean-headerbar.patch
blob: 09612d4ab68e5319938512c4dbe52f35b6e5f0da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Index: b/gtk/gtkheaderbar.c
===================================================================
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -300,6 +300,27 @@ _gtk_header_bar_update_window_buttons (G
 
   priv->titlebar_icon = NULL;
 
+  gboolean csd_cleaned_headerbar = (!gtk_style_context_has_class (gtk_widget_get_style_context (toplevel), "csd") &&
+                                    !gtk_style_context_has_class (gtk_widget_get_style_context (toplevel), "solid-csd"));
+  if (csd_cleaned_headerbar)
+    {
+      if (priv->label_box != NULL)
+        {
+          priv->label_box = NULL;
+          priv->title_label = NULL;
+          priv->subtitle_label = NULL;
+        }
+      static gboolean style_added = FALSE;
+      if (!style_added)
+        {
+          style_added = TRUE;
+          GtkCssProvider *provider = gtk_css_provider_new ();
+          gtk_css_provider_load_from_data (provider,
+            "headerbar, .titlebar { border-radius: 0; border-top: 0; box-shadow: none; }", -1, NULL);
+          gtk_style_context_add_provider_for_screen (gtk_widget_get_screen (widget),
+            GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+        }
+    }
   if (!priv->shows_wm_decorations)
     return;
 
@@ -327,6 +348,8 @@ _gtk_header_bar_update_window_buttons (G
                           gtk_window_get_transient_for (window) == NULL &&
                           gtk_window_get_type_hint (window) == GDK_WINDOW_TYPE_HINT_NORMAL);
 
+  if (csd_cleaned_headerbar)
+      layout_desc = strstr (layout_desc, "menu") ? g_strdup ("menu") : g_strdup ("");
   tokens = g_strsplit (layout_desc, ":", 2);
   if (tokens)
     {
@@ -391,9 +414,9 @@ _gtk_header_bar_update_window_buttons (G
                     atk_object_set_name (accessible, _("Application menu"));
 
                   priv->titlebar_icon = image;
-                  if (!_gtk_header_bar_update_window_icon (bar, window))
+                  if (csd_cleaned_headerbar || !_gtk_header_bar_update_window_icon (bar, window))
                     gtk_image_set_from_icon_name (GTK_IMAGE (priv->titlebar_icon),
-                                                  "application-x-executable-symbolic", GTK_ICON_SIZE_MENU);
+                                                  "pan-down-symbolic", GTK_ICON_SIZE_MENU);
                 }
               else if (strcmp (t[j], "minimize") == 0 &&
                        is_sovereign_window)
@@ -1361,6 +1384,7 @@ gtk_header_bar_set_subtitle (GtkHeaderBa
   gtk_widget_set_visible (priv->subtitle_sizing_label, priv->has_subtitle || (priv->subtitle && priv->subtitle[0]));
 
   g_object_notify_by_pspec (G_OBJECT (bar), header_bar_props[PROP_SUBTITLE]);
+  g_object_notify_by_pspec (G_OBJECT (bar), header_bar_props[PROP_TITLE]);
 }
 
 /**
Index: b/gtk/gtkwindow.c
===================================================================
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -4174,6 +4174,8 @@ on_titlebar_title_notify (GtkHeaderBar *
   const gchar *title;
 
   title = gtk_header_bar_get_title (titlebar);
+  if (gtk_header_bar_get_subtitle (titlebar))
+    title = g_strconcat (title, " — ", gtk_header_bar_get_subtitle (titlebar), NULL);
   gtk_window_set_title_internal (self, title, FALSE);
 }
 
@@ -9366,6 +9368,7 @@ static void
 gtk_window_do_popup (GtkWindow      *window,
                      GdkEventButton *event)
 {
+  if (!window->priv->client_decorated) return;
   if (!gdk_window_show_window_menu (_gtk_widget_get_window (GTK_WIDGET (window)),
                                     (GdkEvent *) event))
     gtk_window_do_popup_fallback (window, event);
bgstack15