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
--- a/browser/themes/linux/browser.css
+++ b/browser/themes/linux/browser.css
@@ -704,8 +704,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;
+ }
+ }
+}