Bug 1414222 - Hide or show #titlebar according to -moz-gtk-csd-available and draw tilebar buttons, r=dao
authorMartin Stransky <stransky@redhat.com>
Fri, 03 Nov 2017 15:54:15 +0100
changeset 443761 08db22c1312e59004f6509858f7308cd9ca7a748
parent 443760 83df9f26ef47d0abc0955f9d0e46285c92557f07
child 443762 b7736e7e1d4fd6b650650959206f8db6d8997089
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs1414222
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1414222 - Hide or show #titlebar according to -moz-gtk-csd-available and draw tilebar buttons, r=dao Based on patches by Andrew Comminos [:acomminos] <andrew@comminos.com> MozReview-Commit-ID: EJtahgBcBrf
browser/themes/linux/browser.css
--- a/browser/themes/linux/browser.css
+++ b/browser/themes/linux/browser.css
@@ -702,8 +702,85 @@ html|span.ac-emphasize-text-url {
 .webextension-popup-stack {
   border-radius: inherit;
 }
 
 /* Prevent movement in the restore-tabs-button when it's clicked. */
 .restore-tabs-button:hover:active:not([disabled="true"]) {
   padding: 3px;
 }
+
+/* Hide the titlebar explicitly on versions of GTK+ where
+ * it's rendered by window manager. */
+@media (-moz-gtk-csd-available: 0) {
+  #titlebar {
+    display: none;
+  }
+}
+
+/* We draw to titlebar when Gkt+ CSD is available */
+@media (-moz-gtk-csd-available) {
+  :root[tabsintitlebar] > #titlebar:-moz-lwtheme {
+    visibility: hidden;
+  }
+  :root[tabsintitlebar] > #titlebar-content:-moz-lwtheme {
+    visibility: visible;
+  }
+
+  :root[tabsintitlebar][sizemode="normal"] > #titlebar {
+    -moz-appearance: -moz-window-titlebar;
+  }
+  :root[tabsintitlebar][sizemode="maximized"] > #titlebar {
+    -moz-appearance: -moz-window-titlebar-maximized;
+  }
+
+  /* The button box must appear on top of the navigator-toolbox in order for
+   * click and hover mouse events to work properly for the button in the restored
+   * window state. Otherwise, elements in the navigator-toolbox, like the menubar,
+   * can swallow those events.
+   */
+  #titlebar-buttonbox {
+    z-index: 1;
+  }
+
+  /* Render titlebar command buttons according to system config.
+   * Use full scale icons here as the Gtk+ does.
+   */
+  @media (-moz-gtk-csd-minimize-button) {
+    #titlebar-min {
+      list-style-image: url("moz-icon://stock/window-minimize-symbolic");
+      -moz-appearance: -moz-window-button-minimize;
+    }
+  }
+  @media (-moz-gtk-csd-minimize-button: 0) {
+    #titlebar-min {
+      display: none;
+    }
+  }
+
+  @media (-moz-gtk-csd-maximize-button) {
+    #titlebar-max {
+      list-style-image: url("moz-icon://stock/window-maximize-symbolic");
+      -moz-appearance: -moz-window-button-maximize;
+    }
+    :root[sizemode="maximized"] #titlebar-max {
+      list-style-image: url("moz-icon://stock/window-restore-symbolic");
+      -moz-appearance: -moz-window-button-restore;
+    }
+  }
+  @media (-moz-gtk-csd-maximize-button: 0) {
+    #titlebar-max {
+      display: none;
+    }
+  }
+
+  @media (-moz-gtk-csd-close-button) {
+    #titlebar-close {
+      list-style-image: url("moz-icon://stock/window-close-symbolic");
+      -moz-appearance: -moz-window-button-close;
+    }
+  }
+  @media (-moz-gtk-csd-close-button: 0) {
+    #titlebar-close {
+      display: none;
+    }
+  }
+}