From 6069f2da7c04ad5b24ade181b229d3d764a655f7 Mon Sep 17 00:00:00 2001 From: Martin Stransky Date: Fri, 3 Nov 2017 15:54:15 +0100 Subject: [PATCH] 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] MozReview-Commit-ID: EJtahgBcBrf --HG-- extra : rebase_source : 454b0a67139c680f37e5578a92d2bd383188aa6b --- browser/themes/linux/browser.css | 77 ++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/browser/themes/linux/browser.css b/browser/themes/linux/browser.css index 850427766364..00dab1ad6f49 100644 --- a/browser/themes/linux/browser.css +++ b/browser/themes/linux/browser.css @@ -707,3 +707,80 @@ html|span.ac-emphasize-text-url { .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; + } + } +}