mozilla-bmo1399611-csd.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Wed, 03 Jan 2018 09:18:16 +0100
branchfirefox57
changeset 1013 a71985fab8e5
parent 1012 0c59a30173da
permissions -rw-r--r--
Bug 1069962 Tumbleweed: OpenSuse's Firefox version crashes when "cancel" pressed in "File Upload" dialogue, e.g. TYPO3, BUGZILLA
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1012
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     1
diff -up firefox-57.0b8/browser/app/profile/firefox.js.1399611 firefox-57.0b8/browser/app/profile/firefox.js
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     2
--- firefox-57.0b8/browser/app/profile/firefox.js.1399611	2017-10-16 12:11:45.364240654 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     3
+++ firefox-57.0b8/browser/app/profile/firefox.js	2017-10-16 12:28:03.860720910 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     4
@@ -457,11 +457,7 @@ pref("browser.tabs.loadBookmarksInBackgr
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     5
 pref("browser.tabs.loadBookmarksInTabs", false);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     6
 pref("browser.tabs.tabClipWidth", 140);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     7
 pref("browser.tabs.tabMinWidth", 76);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     8
-#ifdef UNIX_BUT_NOT_MAC
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     9
-pref("browser.tabs.drawInTitlebar", false);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    10
-#else
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    11
 pref("browser.tabs.drawInTitlebar", true);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    12
-#endif
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    13
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    14
 // Offer additional drag space to the user. The drag space
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    15
 // will only be shown if browser.tabs.drawInTitlebar is true.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    16
diff -up firefox-57.0b8/browser/base/content/browser-tabsintitlebar.js.1399611 firefox-57.0b8/browser/base/content/browser-tabsintitlebar.js
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    17
--- firefox-57.0b8/browser/base/content/browser-tabsintitlebar.js.1399611	2017-10-09 22:17:13.000000000 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    18
+++ firefox-57.0b8/browser/base/content/browser-tabsintitlebar.js	2017-10-16 12:11:45.364240654 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    19
@@ -14,6 +14,11 @@ var TabsInTitlebar = {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    20
     this._readPref();
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    21
     Services.prefs.addObserver(this._prefName, this);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    22
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    23
+    // Always disable on unsupported GTK versions.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    24
+    if (AppConstants.MOZ_WIDGET_TOOLKIT == "gtk3") {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    25
+      this.allowedBy("gtk", window.matchMedia("(-moz-gtk-csd-available)"));
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    26
+    }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    27
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    28
     // We need to update the appearance of the titlebar when the menu changes
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    29
     // from the active to the inactive state. We can't, however, rely on
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    30
     // DOMMenuBarInactive, because the menu fires this event and then removes
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    31
diff -up firefox-57.0b8/browser/base/moz.build.1399611 firefox-57.0b8/browser/base/moz.build
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    32
--- firefox-57.0b8/browser/base/moz.build.1399611	2017-09-29 18:16:45.000000000 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    33
+++ firefox-57.0b8/browser/base/moz.build	2017-10-16 12:11:45.364240654 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    34
@@ -57,7 +57,7 @@ DEFINES['APP_LICENSE_BLOCK'] = '%s/conte
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    35
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3', 'cocoa'):
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    36
     DEFINES['CONTEXT_COPY_IMAGE_CONTENTS'] = 1
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    37
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    38
-if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'):
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    39
+if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa', 'gtk3'):
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    40
     DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    41
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    42
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3'):
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    43
diff -up firefox-57.0b8/browser/themes/linux/browser.css.1399611 firefox-57.0b8/browser/themes/linux/browser.css
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    44
--- firefox-57.0b8/browser/themes/linux/browser.css.1399611	2017-10-05 06:17:37.000000000 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    45
+++ firefox-57.0b8/browser/themes/linux/browser.css	2017-10-16 12:11:45.365240651 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    46
@@ -556,7 +556,9 @@ html|span.ac-emphasize-text-url {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    47
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    48
 #nav-bar,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    49
 #toolbar-menubar:not([autohide="true"]):not(:-moz-lwtheme):-moz-system-metric(menubar-drag),
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    50
-#TabsToolbar:not(:-moz-lwtheme):-moz-system-metric(menubar-drag) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    51
+#TabsToolbar:not(:-moz-lwtheme):-moz-system-metric(menubar-drag),
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    52
+#main-window[tabsintitlebar] #toolbar-menubar:not([autohide="true"]),
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    53
+#main-window[tabsintitlebar] #TabsToolbar {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    54
   -moz-binding: url("chrome://browser/content/customizableui/toolbar.xml#toolbar-drag");
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    55
 }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    56
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    57
@@ -713,3 +715,85 @@ html|span.ac-emphasize-text-url {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    58
 .restore-tabs-button:hover:active:not([disabled="true"]) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    59
   padding: 3px;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    60
 }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    61
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    62
+@media not all and (-moz-gtk-csd-available) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    63
+  #main-window > #titlebar {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    64
+    /* We need to hide the titlebar explicitly on versions of GTK without CSD. */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    65
+    display: none;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    66
+  }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    67
+}
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    68
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    69
+/* Titlebar/CSD */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    70
+@media (-moz-gtk-csd-available) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    71
+  #main-window[tabsintitlebar][sizemode="normal"] > #titlebar {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    72
+    min-height: calc(var(--tab-min-height) + 12px);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    73
+  }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    74
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    75
+  #main-window[tabsintitlebar] #titlebar:-moz-lwtheme {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    76
+    visibility: hidden;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    77
+  }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    78
+  #main-window[tabsintitlebar] #titlebar-content:-moz-lwtheme {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    79
+    visibility: visible;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    80
+  }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    81
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    82
+  #main-window[tabsintitlebar][sizemode="normal"] > #titlebar {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    83
+    -moz-appearance: -moz-window-titlebar;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    84
+  }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    85
+  #main-window[tabsintitlebar][sizemode="maximized"] > #titlebar {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    86
+    -moz-appearance: -moz-window-titlebar-maximized;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    87
+  }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    88
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    89
+  /* The button box must appear on top of the navigator-toolbox in order for
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    90
+   * click and hover mouse events to work properly for the button in the restored
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    91
+   * window state. Otherwise, elements in the navigator-toolbox, like the menubar,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    92
+   * can swallow those events.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    93
+   */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    94
+  #titlebar-buttonbox {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    95
+    z-index: 1;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    96
+  }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    97
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    98
+  /* titlebar command buttons */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    99
+  /* Use full scale icons here as the Gtk+ does. */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   100
+  @media (-moz-gtk-csd-minimize-button) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   101
+    #titlebar-min {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   102
+      list-style-image: url("moz-icon://stock/window-minimize-symbolic");
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   103
+      -moz-appearance: -moz-window-button-minimize;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   104
+    }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   105
+  }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   106
+  @media not all and (-moz-gtk-csd-minimize-button) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   107
+    #titlebar-min {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   108
+      display: none;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   109
+    }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   110
+  }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   111
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   112
+  @media (-moz-gtk-csd-maximize-button) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   113
+    #titlebar-max {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   114
+      list-style-image: url("moz-icon://stock/window-maximize-symbolic");
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   115
+      -moz-appearance: -moz-window-button-maximize;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   116
+    }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   117
+    #main-window[sizemode="maximized"] #titlebar-max {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   118
+      list-style-image: url("moz-icon://stock/window-restore-symbolic");
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   119
+      -moz-appearance: -moz-window-button-restore;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   120
+    }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   121
+  }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   122
+  @media not all and (-moz-gtk-csd-maximize-button) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   123
+    #titlebar-max {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   124
+      display: none;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   125
+    }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   126
+    #main-window[sizemode="maximized"] #titlebar-max {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   127
+      display: none;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   128
+    }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   129
+  }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   130
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   131
+  @media (-moz-gtk-csd-close-button) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   132
+    #titlebar-close {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   133
+      list-style-image: url("moz-icon://stock/window-close-symbolic");
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   134
+      -moz-appearance: -moz-window-button-close;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   135
+    }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   136
+  }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   137
+  @media not all and (-moz-gtk-csd-close-button) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   138
+    #titlebar-close {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   139
+      display: none;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   140
+    }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   141
+  }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   142
+}
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   143
diff -up firefox-57.0b8/dom/base/nsGkAtomList.h.1399611 firefox-57.0b8/dom/base/nsGkAtomList.h
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   144
--- firefox-57.0b8/dom/base/nsGkAtomList.h.1399611	2017-09-15 06:15:41.000000000 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   145
+++ firefox-57.0b8/dom/base/nsGkAtomList.h	2017-10-16 12:11:45.365240651 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   146
@@ -2270,6 +2270,10 @@ GK_ATOM(touch_enabled, "touch-enabled")
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   147
 GK_ATOM(menubar_drag, "menubar-drag")
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   148
 GK_ATOM(swipe_animation_enabled, "swipe-animation-enabled")
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   149
 GK_ATOM(physical_home_button, "physical-home-button")
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   150
+GK_ATOM(gtk_csd_available, "gtk-csd-available")
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   151
+GK_ATOM(gtk_csd_minimize_button, "gtk-csd-minimize-button")
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   152
+GK_ATOM(gtk_csd_maximize_button, "gtk-csd-maximize-button")
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   153
+GK_ATOM(gtk_csd_close_button, "gtk-csd-close-button")
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   154
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   155
 // windows theme selector metrics
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   156
 GK_ATOM(windows_classic, "windows-classic")
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   157
@@ -2306,6 +2310,10 @@ GK_ATOM(_moz_device_orientation, "-moz-d
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   158
 GK_ATOM(_moz_is_resource_document, "-moz-is-resource-document")
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   159
 GK_ATOM(_moz_swipe_animation_enabled, "-moz-swipe-animation-enabled")
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   160
 GK_ATOM(_moz_physical_home_button, "-moz-physical-home-button")
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   161
+GK_ATOM(_moz_gtk_csd_available, "-moz-gtk-csd-available")
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   162
+GK_ATOM(_moz_gtk_csd_minimize_button, "-moz-gtk-csd-minimize-button")
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   163
+GK_ATOM(_moz_gtk_csd_maximize_button, "-moz-gtk-csd-maximize-button")
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   164
+GK_ATOM(_moz_gtk_csd_close_button, "-moz-gtk-csd-close-button")
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   165
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   166
 // application commands
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   167
 GK_ATOM(Back, "Back")
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   168
diff -up firefox-57.0b8/gfx/src/nsThemeConstants.h.1399611 firefox-57.0b8/gfx/src/nsThemeConstants.h
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   169
--- firefox-57.0b8/gfx/src/nsThemeConstants.h.1399611	2017-06-12 18:37:10.000000000 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   170
+++ firefox-57.0b8/gfx/src/nsThemeConstants.h	2017-10-16 12:11:45.365240651 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   171
@@ -299,6 +299,7 @@ enum ThemeWidgetType : uint8_t {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   172
   NS_THEME_MAC_SOURCE_LIST,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   173
   NS_THEME_MAC_SOURCE_LIST_SELECTION,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   174
   NS_THEME_MAC_ACTIVE_SOURCE_LIST_SELECTION,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   175
+  NS_THEME_GTK_WINDOW_DECORATION,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   176
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   177
   ThemeWidgetType_COUNT
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   178
 };
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   179
diff -up firefox-57.0b8/layout/style/nsCSSRuleProcessor.cpp.1399611 firefox-57.0b8/layout/style/nsCSSRuleProcessor.cpp
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   180
--- firefox-57.0b8/layout/style/nsCSSRuleProcessor.cpp.1399611	2017-08-02 14:27:54.000000000 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   181
+++ firefox-57.0b8/layout/style/nsCSSRuleProcessor.cpp	2017-10-16 12:11:45.365240651 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   182
@@ -1180,6 +1180,30 @@ nsCSSRuleProcessor::InitSystemMetrics()
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   183
     sSystemMetrics->AppendElement(nsGkAtoms::physical_home_button);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   184
   }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   185
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   186
+  rv = LookAndFeel::GetInt(LookAndFeel::eIntID_GTKCSDAvailable,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   187
+                           &metricResult);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   188
+  if (NS_SUCCEEDED(rv) && metricResult) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   189
+    sSystemMetrics->AppendElement(nsGkAtoms::gtk_csd_available);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   190
+  }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   191
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   192
+  rv = LookAndFeel::GetInt(LookAndFeel::eIntID_GTKCSDMinimizeButton,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   193
+                           &metricResult);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   194
+  if (NS_SUCCEEDED(rv) && metricResult) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   195
+    sSystemMetrics->AppendElement(nsGkAtoms::gtk_csd_minimize_button);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   196
+  }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   197
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   198
+  rv = LookAndFeel::GetInt(LookAndFeel::eIntID_GTKCSDMaximizeButton,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   199
+                           &metricResult);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   200
+  if (NS_SUCCEEDED(rv) && metricResult) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   201
+    sSystemMetrics->AppendElement(nsGkAtoms::gtk_csd_maximize_button);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   202
+  }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   203
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   204
+  rv = LookAndFeel::GetInt(LookAndFeel::eIntID_GTKCSDCloseButton,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   205
+                           &metricResult);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   206
+  if (NS_SUCCEEDED(rv) && metricResult) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   207
+    sSystemMetrics->AppendElement(nsGkAtoms::gtk_csd_close_button);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   208
+  }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   209
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   210
 #ifdef XP_WIN
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   211
   if (NS_SUCCEEDED(
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   212
         LookAndFeel::GetInt(LookAndFeel::eIntID_WindowsThemeIdentifier,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   213
diff -up firefox-57.0b8/layout/style/nsMediaFeatures.cpp.1399611 firefox-57.0b8/layout/style/nsMediaFeatures.cpp
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   214
--- firefox-57.0b8/layout/style/nsMediaFeatures.cpp.1399611	2017-09-15 06:15:42.000000000 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   215
+++ firefox-57.0b8/layout/style/nsMediaFeatures.cpp	2017-10-16 12:11:45.366240647 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   216
@@ -788,6 +788,42 @@ nsMediaFeatures::features[] = {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   217
     GetSystemMetric
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   218
   },
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   219
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   220
+  {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   221
+    &nsGkAtoms::_moz_gtk_csd_available,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   222
+    nsMediaFeature::eMinMaxNotAllowed,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   223
+    nsMediaFeature::eBoolInteger,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   224
+    nsMediaFeature::eNoRequirements,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   225
+    { &nsGkAtoms::gtk_csd_available },
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   226
+    GetSystemMetric
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   227
+  },
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   228
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   229
+  {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   230
+    &nsGkAtoms::_moz_gtk_csd_minimize_button,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   231
+    nsMediaFeature::eMinMaxNotAllowed,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   232
+    nsMediaFeature::eBoolInteger,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   233
+    nsMediaFeature::eNoRequirements,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   234
+    { &nsGkAtoms::gtk_csd_minimize_button },
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   235
+    GetSystemMetric
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   236
+  },
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   237
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   238
+  {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   239
+    &nsGkAtoms::_moz_gtk_csd_maximize_button,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   240
+    nsMediaFeature::eMinMaxNotAllowed,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   241
+    nsMediaFeature::eBoolInteger,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   242
+    nsMediaFeature::eNoRequirements,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   243
+    { &nsGkAtoms::gtk_csd_maximize_button },
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   244
+    GetSystemMetric
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   245
+  },
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   246
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   247
+  {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   248
+    &nsGkAtoms::_moz_gtk_csd_close_button,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   249
+    nsMediaFeature::eMinMaxNotAllowed,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   250
+    nsMediaFeature::eBoolInteger,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   251
+    nsMediaFeature::eNoRequirements,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   252
+    { &nsGkAtoms::gtk_csd_close_button },
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   253
+    GetSystemMetric
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   254
+  },
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   255
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   256
   // Internal -moz-is-glyph media feature: applies only inside SVG glyphs.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   257
   // Internal because it is really only useful in the user agent anyway
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   258
   //  and therefore not worth standardizing.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   259
diff -up firefox-57.0b8/modules/libpref/init/all.js.1399611 firefox-57.0b8/modules/libpref/init/all.js
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   260
--- firefox-57.0b8/modules/libpref/init/all.js.1399611	2017-10-12 18:12:09.000000000 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   261
+++ firefox-57.0b8/modules/libpref/init/all.js	2017-10-16 12:11:45.366240647 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   262
@@ -4911,6 +4911,7 @@ pref("gfx.apitrace.enabled",false);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   263
 pref("gfx.xrender.enabled",false);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   264
 pref("widget.chrome.allow-gtk-dark-theme", false);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   265
 pref("widget.content.allow-gtk-dark-theme", false);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   266
+pref("widget.allow-client-side-decoration", false);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   267
 #endif
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   268
 #endif
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   269
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   270
diff -up firefox-57.0b8/toolkit/modules/moz.build.1399611 firefox-57.0b8/toolkit/modules/moz.build
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   271
--- firefox-57.0b8/toolkit/modules/moz.build.1399611	2017-09-15 06:15:40.000000000 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   272
+++ firefox-57.0b8/toolkit/modules/moz.build	2017-10-16 12:11:45.366240647 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   273
@@ -259,7 +259,7 @@ EXTRA_JS_MODULES.sessionstore += [
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   274
 ]
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   275
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   276
 DEFINES['INSTALL_COMPACT_THEMES'] = 1
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   277
-if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'):
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   278
+if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa', 'gtk3'):
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   279
     DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   280
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   281
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3'):
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   282
diff -up firefox-57.0b8/widget/gtk/gtk3drawing.cpp.1399611 firefox-57.0b8/widget/gtk/gtk3drawing.cpp
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   283
--- firefox-57.0b8/widget/gtk/gtk3drawing.cpp.1399611	2017-09-15 06:15:40.000000000 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   284
+++ firefox-57.0b8/widget/gtk/gtk3drawing.cpp	2017-10-16 12:11:45.367240644 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   285
@@ -17,6 +17,7 @@
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   286
 #include "WidgetStyleCache.h"
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   287
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   288
 #include <math.h>
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   289
+#include <dlfcn.h>
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   290
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   291
 static gboolean checkbox_check_state;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   292
 static gboolean notebook_has_tab_gap;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   293
@@ -39,9 +40,25 @@ static gint
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   294
 moz_gtk_menu_item_paint(WidgetNodeType widget, cairo_t *cr, GdkRectangle* rect,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   295
                         GtkWidgetState* state, GtkTextDirection direction);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   296
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   297
+static void
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   298
+moz_gtk_add_style_margin(GtkStyleContext* style,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   299
+                         gint* left, gint* top, gint* right, gint* bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   300
+static void
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   301
+moz_gtk_add_style_border(GtkStyleContext* style,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   302
+                         gint* left, gint* top, gint* right, gint* bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   303
+static void
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   304
+moz_gtk_add_style_padding(GtkStyleContext* style,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   305
+                          gint* left, gint* top, gint* right, gint* bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   306
+static void moz_gtk_add_margin_border_padding(GtkStyleContext *style,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   307
+                                              gint* left, gint* top,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   308
+                                              gint* right, gint* bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   309
+static void moz_gtk_add_border_padding(GtkStyleContext *style,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   310
+                                       gint* left, gint* top,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   311
+                                       gint* right, gint* bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   312
 static GtkBorder
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   313
 GetMarginBorderPadding(GtkStyleContext* aStyle);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   314
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   315
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   316
 // GetStateFlagsFromGtkWidgetState() can be safely used for the specific
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   317
 // GtkWidgets that set both prelight and active flags.  For other widgets,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   318
 // either the GtkStateFlags or Gecko's GtkWidgetState need to be carefully
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   319
@@ -233,6 +250,43 @@ moz_gtk_splitter_get_metrics(gint orient
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   320
     return MOZ_GTK_SUCCESS;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   321
 }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   322
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   323
+void
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   324
+moz_gtk_get_window_border(gint* top, gint* right, gint* bottom, gint* left)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   325
+{
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   326
+  MOZ_ASSERT(gtk_check_version(3, 20, 0) == nullptr,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   327
+             "Window decorations are only supported on GTK 3.20+.");
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   328
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   329
+  GtkStyleContext* style = GetStyleContext(MOZ_GTK_WINDOW);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   330
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   331
+  *top = *right = *bottom = *left = 0;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   332
+  moz_gtk_add_border_padding(style, left, top, right, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   333
+  GtkBorder windowMargin;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   334
+  gtk_style_context_get_margin(style, GTK_STATE_FLAG_NORMAL, &windowMargin);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   335
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   336
+  style = GetStyleContext(MOZ_GTK_WINDOW_DECORATION);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   337
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   338
+  // Available on GTK 3.20+.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   339
+  static auto sGtkRenderBackgroundGetClip =
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   340
+    (void (*)(GtkStyleContext*, gdouble, gdouble, gdouble, gdouble, GdkRectangle*))
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   341
+    dlsym(RTLD_DEFAULT, "gtk_render_background_get_clip");
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   342
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   343
+  GdkRectangle shadowClip;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   344
+  sGtkRenderBackgroundGetClip(style, 0, 0, 0, 0, &shadowClip);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   345
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   346
+  // Transfer returned inset rectangle to GtkBorder
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   347
+  GtkBorder shadowBorder = {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   348
+      static_cast<gint16>(-shadowClip.x),                    // left
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   349
+      static_cast<gint16>(shadowClip.width + shadowClip.x),  // right
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   350
+      static_cast<gint16>(-shadowClip.y),                    // top
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   351
+      static_cast<gint16>(shadowClip.height + shadowClip.y), // bottom
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   352
+  };
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   353
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   354
+  *left += MAX(windowMargin.left, shadowBorder.left);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   355
+  *right += MAX(windowMargin.right, shadowBorder.right);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   356
+  *top += MAX(windowMargin.top, shadowBorder.top);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   357
+  *bottom += MAX(windowMargin.bottom, shadowBorder.bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   358
+}
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   359
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   360
 static gint
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   361
 moz_gtk_window_paint(cairo_t *cr, GdkRectangle* rect,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   362
                      GtkTextDirection direction)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   363
@@ -302,6 +356,24 @@ moz_gtk_button_paint(cairo_t *cr, GdkRec
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   364
 }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   365
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   366
 static gint
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   367
+moz_gtk_header_bar_button_paint(cairo_t *cr, GdkRectangle* rect,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   368
+                                GtkWidgetState* state,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   369
+                                GtkReliefStyle relief, GtkWidget* widget,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   370
+                                GtkTextDirection direction)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   371
+{
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   372
+    GtkBorder margin;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   373
+    GtkStyleContext* style = gtk_widget_get_style_context(widget);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   374
+    gtk_style_context_get_margin(style, GTK_STATE_FLAG_NORMAL, &margin);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   375
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   376
+    rect->x += margin.left;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   377
+    rect->y += margin.top;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   378
+    rect->width -= margin.left + margin.right;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   379
+    rect->height -= margin.top + margin.bottom;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   380
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   381
+    return moz_gtk_button_paint(cr, rect, state, relief, widget, direction);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   382
+}
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   383
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   384
+static gint
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   385
 moz_gtk_toggle_paint(cairo_t *cr, GdkRectangle* rect,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   386
                      GtkWidgetState* state,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   387
                      gboolean selected, gboolean inconsistent,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   388
@@ -1948,6 +2020,38 @@ moz_gtk_info_bar_paint(cairo_t *cr, GdkR
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   389
     return MOZ_GTK_SUCCESS;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   390
 }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   391
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   392
+static gint
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   393
+moz_gtk_header_bar_paint(WidgetNodeType widgetType,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   394
+                         cairo_t *cr, GdkRectangle* rect, GtkWidgetState* state)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   395
+{
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   396
+    GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   397
+    GtkStyleContext *style;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   398
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   399
+    style = GetStyleContext(widgetType, GTK_TEXT_DIR_LTR,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   400
+                            state_flags);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   401
+    InsetByMargin(rect, style);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   402
+    gtk_render_background(style, cr, rect->x, rect->y, rect->width,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   403
+                          rect->height);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   404
+    gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   405
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   406
+    return MOZ_GTK_SUCCESS;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   407
+}
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   408
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   409
+void
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   410
+moz_gtk_header_bar_paint(cairo_t *cr, GdkRectangle* rect)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   411
+{
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   412
+    static GtkWidgetState state;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   413
+    moz_gtk_header_bar_paint(MOZ_GTK_HEADER_BAR, cr, rect, &state);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   414
+}
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   415
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   416
+void
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   417
+moz_gtk_get_header_bar_border(gint* top, gint* right, gint* bottom, gint* left)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   418
+{
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   419
+    *left = *top = *right = *bottom = 0;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   420
+    moz_gtk_add_border_padding(GetStyleContext(MOZ_GTK_HEADER_BAR),
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   421
+                               left, top, right, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   422
+}
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   423
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   424
 static void
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   425
 moz_gtk_add_style_margin(GtkStyleContext* style,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   426
                          gint* left, gint* top, gint* right, gint* bottom)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   427
@@ -1999,6 +2103,14 @@ static void moz_gtk_add_margin_border_pa
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   428
     moz_gtk_add_style_padding(style, left, top, right, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   429
 }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   430
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   431
+static void moz_gtk_add_border_padding(GtkStyleContext *style,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   432
+                                       gint* left, gint* top,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   433
+                                       gint* right, gint* bottom)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   434
+{
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   435
+    moz_gtk_add_style_border(style, left, top, right, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   436
+    moz_gtk_add_style_padding(style, left, top, right, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   437
+}
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   438
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   439
 static GtkBorder
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   440
 GetMarginBorderPadding(GtkStyleContext* aStyle)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   441
 {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   442
@@ -2054,8 +2166,7 @@ moz_gtk_get_widget_border(WidgetNodeType
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   443
             // XXX: Subtract 1 pixel from the padding to account for the default
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   444
             // padding in forms.css. See bug 1187385.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   445
             *left = *top = *right = *bottom = -1;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   446
-            moz_gtk_add_style_padding(style, left, top, right, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   447
-            moz_gtk_add_style_border(style, left, top, right, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   448
+            moz_gtk_add_border_padding(style, left, top, right, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   449
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   450
             return MOZ_GTK_SUCCESS;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   451
         }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   452
@@ -2076,10 +2187,8 @@ moz_gtk_get_widget_border(WidgetNodeType
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   453
             *left = *top = *right = *bottom =
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   454
                 gtk_container_get_border_width(GTK_CONTAINER(
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   455
                                                GetWidget(MOZ_GTK_TREE_HEADER_CELL)));
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   456
-
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   457
             style = GetStyleContext(MOZ_GTK_TREE_HEADER_CELL);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   458
-            moz_gtk_add_style_border(style, left, top, right, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   459
-            moz_gtk_add_style_padding(style, left, top, right, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   460
+            moz_gtk_add_border_padding(style, left, top, right, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   461
             return MOZ_GTK_SUCCESS;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   462
         }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   463
     case MOZ_GTK_TREE_HEADER_SORTARROW:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   464
@@ -2105,8 +2214,7 @@ moz_gtk_get_widget_border(WidgetNodeType
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   465
                 gtk_container_get_border_width(GTK_CONTAINER(
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   466
                                                GetWidget(MOZ_GTK_COMBOBOX_BUTTON)));
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   467
             style = GetStyleContext(MOZ_GTK_COMBOBOX_BUTTON);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   468
-            moz_gtk_add_style_padding(style, left, top, right, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   469
-            moz_gtk_add_style_border(style, left, top, right, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   470
+            moz_gtk_add_border_padding(style, left, top, right, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   471
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   472
             /* If there is no separator, don't try to count its width. */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   473
             separator_width = 0;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   474
@@ -2160,10 +2268,8 @@ moz_gtk_get_widget_border(WidgetNodeType
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   475
             style = gtk_widget_get_style_context(w);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   476
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   477
             *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(w));
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   478
-            moz_gtk_add_style_border(style,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   479
-                                     left, top, right, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   480
-            moz_gtk_add_style_padding(style,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   481
-                                      left, top, right, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   482
+            moz_gtk_add_border_padding(style,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   483
+                                       left, top, right, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   484
             return MOZ_GTK_SUCCESS;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   485
         }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   486
     case MOZ_GTK_MENUPOPUP:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   487
@@ -2210,6 +2316,21 @@ moz_gtk_get_widget_border(WidgetNodeType
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   488
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   489
             return MOZ_GTK_SUCCESS;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   490
         }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   491
+    case MOZ_GTK_HEADER_BAR:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   492
+    case MOZ_GTK_HEADER_BAR_MAXIMIZED:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   493
+        {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   494
+            style = GetStyleContext(widget);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   495
+            moz_gtk_add_border_padding(style, left, top, right, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   496
+            return MOZ_GTK_SUCCESS;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   497
+        }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   498
+    case MOZ_GTK_HEADER_BAR_BUTTON_CLOSE:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   499
+    case MOZ_GTK_HEADER_BAR_BUTTON_MINIMIZE:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   500
+    case MOZ_GTK_HEADER_BAR_BUTTON_MAXIMIZE:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   501
+        {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   502
+            style = GetStyleContext(widget);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   503
+            moz_gtk_add_margin_border_padding(style, left, top, right, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   504
+            return MOZ_GTK_SUCCESS;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   505
+        }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   506
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   507
     /* These widgets have no borders, since they are not containers. */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   508
     case MOZ_GTK_CHECKBUTTON_LABEL:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   509
@@ -2646,6 +2767,36 @@ GetScrollbarMetrics(GtkOrientation aOrie
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   510
     return metrics;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   511
 }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   512
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   513
+void
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   514
+moz_gtk_window_decoration_paint(cairo_t *cr, GdkRectangle* rect)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   515
+{
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   516
+    gint top, right, bottom, left;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   517
+    moz_gtk_get_window_border(&top, &right, &bottom, &left);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   518
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   519
+    cairo_save(cr);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   520
+    cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   521
+    cairo_rectangle(cr, rect->x, rect->y, left, rect->height);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   522
+    cairo_fill(cr);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   523
+    cairo_rectangle(cr, rect->x+rect->width-right, rect->y, right, rect->height);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   524
+    cairo_fill(cr);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   525
+    cairo_rectangle(cr, rect->x, rect->y, rect->width, top);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   526
+    cairo_fill(cr);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   527
+    cairo_rectangle(cr, rect->x, rect->height-bottom, rect->width, bottom);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   528
+    cairo_fill(cr);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   529
+    cairo_restore(cr);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   530
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   531
+    GtkStyleContext* style = GetStyleContext(MOZ_GTK_WINDOW_DECORATION,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   532
+                                               GTK_TEXT_DIR_NONE);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   533
+    rect->x += left;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   534
+    rect->y += top;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   535
+    rect->width -= left + right;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   536
+    rect->height -= top + bottom;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   537
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   538
+    gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   539
+    gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   540
+}
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   541
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   542
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   543
 /* cairo_t *cr argument has to be a system-cairo. */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   544
 gint
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   545
 moz_gtk_widget_paint(WidgetNodeType widget, cairo_t *cr,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   546
@@ -2671,6 +2822,14 @@ moz_gtk_widget_paint(WidgetNodeType widg
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   547
                                     GetWidget(MOZ_GTK_BUTTON),
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   548
                                     direction);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   549
         break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   550
+    case MOZ_GTK_HEADER_BAR_BUTTON_CLOSE:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   551
+    case MOZ_GTK_HEADER_BAR_BUTTON_MINIMIZE:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   552
+    case MOZ_GTK_HEADER_BAR_BUTTON_MAXIMIZE:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   553
+        return moz_gtk_header_bar_button_paint(cr, rect, state,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   554
+                                               (GtkReliefStyle) flags,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   555
+                                               GetWidget(widget),
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   556
+                                               direction);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   557
+        break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   558
     case MOZ_GTK_CHECKBUTTON:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   559
     case MOZ_GTK_RADIOBUTTON:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   560
         return moz_gtk_toggle_paint(cr, rect, state,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   561
@@ -2877,6 +3036,10 @@ moz_gtk_widget_paint(WidgetNodeType widg
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   562
     case MOZ_GTK_INFO_BAR:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   563
         return moz_gtk_info_bar_paint(cr, rect, state);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   564
         break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   565
+    case MOZ_GTK_HEADER_BAR:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   566
+    case MOZ_GTK_HEADER_BAR_MAXIMIZED:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   567
+        return moz_gtk_header_bar_paint(widget, cr, rect, state);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   568
+        break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   569
     default:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   570
         g_warning("Unknown widget type: %d", widget);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   571
     }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   572
diff -up firefox-57.0b8/widget/gtk/gtkdrawing.h.1399611 firefox-57.0b8/widget/gtk/gtkdrawing.h
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   573
--- firefox-57.0b8/widget/gtk/gtkdrawing.h.1399611	2017-06-12 18:37:20.000000000 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   574
+++ firefox-57.0b8/widget/gtk/gtkdrawing.h	2017-10-16 12:11:45.367240644 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   575
@@ -268,8 +268,14 @@ typedef enum {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   576
   MOZ_GTK_SPLITTER_SEPARATOR_VERTICAL,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   577
   /* Paints the background of a window, dialog or page. */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   578
   MOZ_GTK_WINDOW,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   579
+  /* Used only as a container for MOZ_GTK_HEADER_BAR_MAXIMIZED. */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   580
+  MOZ_GTK_WINDOW_MAXIMIZED,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   581
   /* Window container for all widgets */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   582
   MOZ_GTK_WINDOW_CONTAINER,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   583
+  /* Window with the 'csd' style class. */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   584
+  MOZ_GTK_WINDOW_CSD,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   585
+  /* Client-side window decoration node. Available on GTK 3.20+. */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   586
+  MOZ_GTK_WINDOW_DECORATION,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   587
   /* Paints a GtkInfoBar, for notifications. */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   588
   MOZ_GTK_INFO_BAR,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   589
   /* Used for widget tree construction. */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   590
@@ -290,6 +296,14 @@ typedef enum {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   591
   MOZ_GTK_COMBOBOX_ENTRY_ARROW,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   592
   /* Used for scrolled window shell. */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   593
   MOZ_GTK_SCROLLED_WINDOW,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   594
+  /* Paints a GtkHeaderBar */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   595
+  MOZ_GTK_HEADER_BAR,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   596
+  /* Paints a GtkHeaderBar in maximized state */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   597
+  MOZ_GTK_HEADER_BAR_MAXIMIZED,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   598
+  /* Paints a GtkHeaderBar title buttons */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   599
+  MOZ_GTK_HEADER_BAR_BUTTON_CLOSE,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   600
+  MOZ_GTK_HEADER_BAR_BUTTON_MINIMIZE,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   601
+  MOZ_GTK_HEADER_BAR_BUTTON_MAXIMIZE,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   602
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   603
   MOZ_GTK_WIDGET_NODE_COUNT
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   604
 } WidgetNodeType;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   605
@@ -542,6 +556,32 @@ gint moz_gtk_get_menu_separator_height(g
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   606
  */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   607
 gint moz_gtk_splitter_get_metrics(gint orientation, gint* size);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   608
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   609
+#if (MOZ_WIDGET_GTK == 3)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   610
+/**
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   611
+ * Gets the margins to be used for window decorations, typically the extra space
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   612
+ * required to draw a drop shadow (obtained from gtk_render_background_get_clip).
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   613
+ * Only available on GTK 3.20+.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   614
+ */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   615
+void moz_gtk_get_window_border(gint* top, gint* right, gint* bottom, gint* left);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   616
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   617
+/**
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   618
+ * Draw window decorations, typically a shadow.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   619
+ * Only available on GTK 3.20+.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   620
+ */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   621
+void moz_gtk_window_decoration_paint(cairo_t *cr, GdkRectangle* rect);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   622
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   623
+/**
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   624
+ * Gets the border of window header bar, only available on GTK 3.20+.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   625
+ */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   626
+void moz_gtk_get_header_bar_border(gint* top, gint* right, gint* bottom, gint* left);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   627
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   628
+/**
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   629
+ * Draw window header bar, only available on GTK 3.20+.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   630
+ */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   631
+void moz_gtk_header_bar_paint(cairo_t *cr, GdkRectangle* rect);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   632
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   633
+#endif
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   634
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   635
 /**
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   636
  * Get the YTHICKNESS of a tab (notebook extension).
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   637
  */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   638
diff -up firefox-57.0b8/widget/gtk/mozgtk/mozgtk.c.1399611 firefox-57.0b8/widget/gtk/mozgtk/mozgtk.c
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   639
--- firefox-57.0b8/widget/gtk/mozgtk/mozgtk.c.1399611	2017-10-09 22:17:13.000000000 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   640
+++ firefox-57.0b8/widget/gtk/mozgtk/mozgtk.c	2017-10-16 12:11:45.367240644 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   641
@@ -580,6 +580,8 @@ STUB(gtk_style_context_set_state)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   642
 STUB(gtk_style_properties_lookup_property)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   643
 STUB(gtk_tree_view_column_get_button)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   644
 STUB(gtk_widget_get_preferred_size)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   645
+STUB(gtk_widget_get_preferred_width)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   646
+STUB(gtk_widget_get_preferred_height)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   647
 STUB(gtk_widget_get_state_flags)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   648
 STUB(gtk_widget_get_style_context)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   649
 STUB(gtk_widget_path_append_type)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   650
@@ -589,6 +591,10 @@ STUB(gtk_widget_path_iter_add_class)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   651
 STUB(gtk_widget_path_get_object_type)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   652
 STUB(gtk_widget_path_new)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   653
 STUB(gtk_widget_path_unref)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   654
+STUB(gtk_widget_set_margin_left)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   655
+STUB(gtk_widget_set_margin_right)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   656
+STUB(gtk_widget_set_margin_top)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   657
+STUB(gtk_widget_set_margin_bottom)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   658
 STUB(gtk_widget_set_visual)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   659
 STUB(gtk_app_chooser_dialog_new_for_content_type)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   660
 STUB(gtk_app_chooser_get_type)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   661
@@ -601,6 +607,7 @@ STUB(gtk_color_chooser_get_type)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   662
 STUB(gtk_color_chooser_set_rgba)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   663
 STUB(gtk_color_chooser_get_rgba)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   664
 STUB(gtk_color_chooser_set_use_alpha)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   665
+STUB(gtk_window_get_size)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   666
 #endif
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   667
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   668
 #ifdef GTK2_SYMBOLS
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   669
diff -up firefox-57.0b8/widget/gtk/nsLookAndFeel.cpp.1399611 firefox-57.0b8/widget/gtk/nsLookAndFeel.cpp
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   670
--- firefox-57.0b8/widget/gtk/nsLookAndFeel.cpp.1399611	2017-09-21 06:10:10.000000000 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   671
+++ firefox-57.0b8/widget/gtk/nsLookAndFeel.cpp	2017-10-16 12:11:45.367240644 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   672
@@ -642,6 +642,22 @@ nsLookAndFeel::GetIntImpl(IntID aID, int
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   673
     case eIntID_ContextMenuOffsetHorizontal:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   674
         aResult = 2;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   675
         break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   676
+    case eIntID_GTKCSDAvailable:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   677
+        EnsureInit();
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   678
+        aResult = sCSDAvailable;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   679
+        break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   680
+    case eIntID_GTKCSDMaximizeButton:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   681
+        EnsureInit();
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   682
+        aResult = sCSDMaximizeButton;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   683
+        break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   684
+    case eIntID_GTKCSDMinimizeButton:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   685
+        EnsureInit();
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   686
+        aResult = sCSDMinimizeButton;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   687
+        break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   688
+    case eIntID_GTKCSDCloseButton:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   689
+        EnsureInit();
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   690
+        aResult = sCSDCloseButton;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   691
+        break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   692
     default:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   693
         aResult = 0;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   694
         res     = NS_ERROR_FAILURE;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   695
@@ -1048,6 +1064,40 @@ nsLookAndFeel::EnsureInit()
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   696
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   697
     gtk_widget_destroy(window);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   698
     g_object_unref(labelWidget);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   699
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   700
+    // Require GTK 3.20 for client-side decoration support.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   701
+    // 3.20 exposes gtk_render_background_get_clip, which is required for
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   702
+    // calculating shadow metrics for decorated windows.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   703
+    sCSDAvailable = gtk_check_version(3, 20, 0) == nullptr;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   704
+    if (sCSDAvailable) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   705
+        sCSDAvailable =
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   706
+            mozilla::Preferences::GetBool("widget.allow-client-side-decoration",
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   707
+                                          false);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   708
+    }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   709
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   710
+    const gchar* decorationLayout = nullptr;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   711
+    if (gtk_check_version(3, 12, 0) == nullptr) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   712
+        static auto sGtkHeaderBarGetDecorationLayoutPtr =
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   713
+          (const gchar* (*)(GtkWidget*))
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   714
+          dlsym(RTLD_DEFAULT, "gtk_header_bar_get_decoration_layout");
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   715
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   716
+        GtkWidget* headerBar = GetWidget(MOZ_GTK_HEADER_BAR);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   717
+        decorationLayout = sGtkHeaderBarGetDecorationLayoutPtr(headerBar);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   718
+        if (!decorationLayout) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   719
+            g_object_get(settings, "gtk-decoration-layout", &decorationLayout,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   720
+                         nullptr);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   721
+        }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   722
+    }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   723
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   724
+    if (decorationLayout) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   725
+        sCSDCloseButton = (strstr(decorationLayout, "close") != nullptr);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   726
+        sCSDMaximizeButton = (strstr(decorationLayout, "maximize") != nullptr);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   727
+        sCSDMinimizeButton = (strstr(decorationLayout, "minimize") != nullptr);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   728
+    } else {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   729
+        sCSDCloseButton = true;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   730
+        sCSDMaximizeButton = true;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   731
+        sCSDMinimizeButton = true;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   732
+    }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   733
 }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   734
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   735
 // virtual
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   736
diff -up firefox-57.0b8/widget/gtk/nsLookAndFeel.h.1399611 firefox-57.0b8/widget/gtk/nsLookAndFeel.h
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   737
--- firefox-57.0b8/widget/gtk/nsLookAndFeel.h.1399611	2017-09-21 06:10:10.000000000 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   738
+++ firefox-57.0b8/widget/gtk/nsLookAndFeel.h	2017-10-16 12:11:45.367240644 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   739
@@ -32,6 +32,8 @@ public:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   740
     virtual char16_t GetPasswordCharacterImpl();
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   741
     virtual bool GetEchoPasswordImpl();
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   742
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   743
+    bool IsCSDAvailable() const { return sCSDAvailable; }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   744
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   745
 protected:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   746
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   747
     // Cached fonts
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   748
@@ -82,6 +84,10 @@ protected:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   749
     char16_t sInvisibleCharacter;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   750
     float   sCaretRatio;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   751
     bool    sMenuSupportsDrag;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   752
+    bool    sCSDAvailable;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   753
+    bool    sCSDMaximizeButton;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   754
+    bool    sCSDMinimizeButton;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   755
+    bool    sCSDCloseButton;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   756
     bool    mInitialized;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   757
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   758
     void EnsureInit();
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   759
diff -up firefox-57.0b8/widget/gtk/nsNativeThemeGTK.cpp.1399611 firefox-57.0b8/widget/gtk/nsNativeThemeGTK.cpp
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   760
--- firefox-57.0b8/widget/gtk/nsNativeThemeGTK.cpp.1399611	2017-09-19 06:18:28.000000000 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   761
+++ firefox-57.0b8/widget/gtk/nsNativeThemeGTK.cpp	2017-10-16 12:11:45.368240640 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   762
@@ -23,6 +23,7 @@
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   763
 #include "nsIDOMHTMLInputElement.h"
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   764
 #include "nsGkAtoms.h"
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   765
 #include "nsAttrValueInlines.h"
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   766
+#include "nsWindow.h"
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   767
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   768
 #include "mozilla/EventStates.h"
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   769
 #include "mozilla/Services.h"
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   770
@@ -703,6 +704,24 @@ nsNativeThemeGTK::GetGtkWidgetAndState(u
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   771
   case NS_THEME_GTK_INFO_BAR:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   772
     aGtkWidgetType = MOZ_GTK_INFO_BAR;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   773
     break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   774
+  case NS_THEME_WINDOW_TITLEBAR:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   775
+    aGtkWidgetType = MOZ_GTK_HEADER_BAR;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   776
+    break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   777
+  case NS_THEME_WINDOW_TITLEBAR_MAXIMIZED:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   778
+    aGtkWidgetType = MOZ_GTK_HEADER_BAR_MAXIMIZED;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   779
+    break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   780
+  case NS_THEME_WINDOW_BUTTON_CLOSE:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   781
+    aGtkWidgetType = MOZ_GTK_HEADER_BAR_BUTTON_CLOSE;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   782
+    break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   783
+  case NS_THEME_WINDOW_BUTTON_MINIMIZE:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   784
+    aGtkWidgetType = MOZ_GTK_HEADER_BAR_BUTTON_MINIMIZE;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   785
+    break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   786
+  case NS_THEME_WINDOW_BUTTON_MAXIMIZE:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   787
+    aGtkWidgetType = MOZ_GTK_HEADER_BAR_BUTTON_MAXIMIZE;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   788
+    break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   789
+  case NS_THEME_WINDOW_BUTTON_RESTORE:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   790
+    aGtkWidgetType = MOZ_GTK_HEADER_BAR_BUTTON_MAXIMIZE;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   791
+    break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   792
   default:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   793
     return false;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   794
   }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   795
@@ -1627,6 +1646,10 @@ nsNativeThemeGTK::GetMinimumWidgetSize(n
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   796
   case NS_THEME_MENULIST:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   797
   case NS_THEME_TOOLBARBUTTON:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   798
   case NS_THEME_TREEHEADERCELL:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   799
+  case NS_THEME_WINDOW_BUTTON_CLOSE:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   800
+  case NS_THEME_WINDOW_BUTTON_MINIMIZE:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   801
+  case NS_THEME_WINDOW_BUTTON_MAXIMIZE:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   802
+  case NS_THEME_WINDOW_BUTTON_RESTORE:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   803
     {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   804
       if (aWidgetType == NS_THEME_MENULIST) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   805
         // Include the arrow size.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   806
@@ -1892,9 +1915,21 @@ nsNativeThemeGTK::ThemeSupportsWidget(ns
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   807
   case NS_THEME_DIALOG:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   808
 #if (MOZ_WIDGET_GTK == 3)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   809
   case NS_THEME_GTK_INFO_BAR:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   810
+  case NS_THEME_GTK_WINDOW_DECORATION:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   811
 #endif
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   812
     return !IsWidgetStyled(aPresContext, aFrame, aWidgetType);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   813
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   814
+  case NS_THEME_WINDOW_BUTTON_CLOSE:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   815
+  case NS_THEME_WINDOW_BUTTON_MINIMIZE:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   816
+  case NS_THEME_WINDOW_BUTTON_MAXIMIZE:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   817
+  case NS_THEME_WINDOW_BUTTON_RESTORE:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   818
+  case NS_THEME_WINDOW_TITLEBAR:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   819
+  case NS_THEME_WINDOW_TITLEBAR_MAXIMIZED:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   820
+    // GtkHeaderBar is available on GTK 3.10+, which is used for styling
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   821
+    // title bars and title buttons.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   822
+    return gtk_check_version(3, 10, 0) == nullptr &&
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   823
+           !IsWidgetStyled(aPresContext, aFrame, aWidgetType);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   824
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   825
   case NS_THEME_MENULIST_BUTTON:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   826
     if (aFrame && aFrame->GetWritingMode().IsVertical()) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   827
       return false;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   828
@@ -1978,6 +2013,13 @@ nsNativeThemeGTK::GetWidgetTransparency(
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   829
 #else
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   830
     return eTransparent;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   831
 #endif
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   832
+  case NS_THEME_GTK_WINDOW_DECORATION:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   833
+  {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   834
+    nsWindow* window = static_cast<nsWindow*>(aFrame->GetNearestWidget());
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   835
+    if (window)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   836
+      return window->IsComposited() ? eTransparent : eOpaque;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   837
+    return eOpaque;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   838
+  }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   839
   }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   840
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   841
   return eUnknownTransparency;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   842
diff -up firefox-57.0b8/widget/gtk/nsWindow.cpp.1399611 firefox-57.0b8/widget/gtk/nsWindow.cpp
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   843
--- firefox-57.0b8/widget/gtk/nsWindow.cpp.1399611	2017-10-16 12:11:45.361240666 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   844
+++ firefox-57.0b8/widget/gtk/nsWindow.cpp	2017-10-16 12:11:45.369240636 +0200
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   845
@@ -85,6 +85,7 @@
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   846
 #include "nsIPropertyBag2.h"
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   847
 #include "GLContext.h"
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   848
 #include "gfx2DGlue.h"
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   849
+#include "nsLookAndFeel.h"
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   850
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   851
 #ifdef ACCESSIBILITY
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   852
 #include "mozilla/a11y/Accessible.h"
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   853
@@ -139,6 +140,8 @@ using namespace mozilla::widget;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   854
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   855
 #include "mozilla/layers/APZCTreeManager.h"
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   856
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   857
+#include "gtkdrawing.h"
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   858
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   859
 using namespace mozilla;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   860
 using namespace mozilla::gfx;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   861
 using namespace mozilla::widget;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   862
@@ -186,6 +189,8 @@ static gboolean expose_event_cb
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   863
 #else
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   864
 static gboolean expose_event_cb           (GtkWidget *widget,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   865
                                            cairo_t *rect);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   866
+static gboolean expose_event_decoration_draw_cb (GtkWidget *widget,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   867
+                                                cairo_t *cr);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   868
 #endif
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   869
 static gboolean configure_event_cb        (GtkWidget *widget,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   870
                                            GdkEventConfigure *event);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   871
@@ -231,7 +236,6 @@ static void     screen_composited_change
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   872
                                                   gpointer user_data);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   873
 static void     widget_composited_changed_cb     (GtkWidget* widget,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   874
                                                   gpointer user_data);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   875
-
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   876
 #if (MOZ_WIDGET_GTK == 3)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   877
 static void     scale_changed_cb          (GtkWidget* widget,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   878
                                            GParamSpec* aPSpec,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   879
@@ -440,6 +444,7 @@ nsWindow::nsWindow()
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   880
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   881
     mContainer           = nullptr;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   882
     mGdkWindow           = nullptr;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   883
+    mIsCSDEnabled        = false;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   884
     mShell               = nullptr;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   885
     mCompositorWidgetDelegate = nullptr;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   886
     mHasMappedToplevel   = false;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   887
@@ -481,6 +486,9 @@ nsWindow::nsWindow()
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   888
     mLastScrollEventTime = GDK_CURRENT_TIME;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   889
 #endif
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   890
     mPendingConfigures = 0;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   891
+    mDrawWindowDecoration = false;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   892
+    mDecorationSize = {0,0,0,0};
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   893
+    mCSDSupportLevel = CSD_SUPPORT_UNKNOWN;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   894
 }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   895
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   896
 nsWindow::~nsWindow()
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   897
@@ -1479,8 +1487,8 @@ LayoutDeviceIntRect
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   898
 nsWindow::GetScreenBounds()
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   899
 {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   900
     LayoutDeviceIntRect rect;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   901
-    if (mIsTopLevel && mContainer) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   902
-        // use the point including window decorations
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   903
+    if (mIsTopLevel && mContainer && !IsClientDecorated()) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   904
+        // use the point including default Gtk+ window decorations
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   905
         gint x, y;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   906
         gdk_window_get_root_origin(gtk_widget_get_window(GTK_WIDGET(mContainer)), &x, &y);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   907
         rect.MoveTo(GdkPointToDevicePixels({ x, y }));
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   908
@@ -1606,6 +1614,10 @@ nsWindow::SetCursor(nsCursor aCursor)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   909
                 return;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   910
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   911
             gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(mContainer)), newCursor);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   912
+            if (IsClientDecorated()) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   913
+                gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(mShell)),
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   914
+                                      newCursor);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   915
+            }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   916
         }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   917
     }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   918
 }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   919
@@ -1662,6 +1674,10 @@ nsWindow::SetCursor(imgIContainer* aCurs
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   920
     if (cursor) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   921
         if (mContainer) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   922
             gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(mContainer)), cursor);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   923
+            if (IsClientDecorated()) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   924
+                gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(mShell)),
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   925
+                                      cursor);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   926
+            }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   927
             rv = NS_OK;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   928
         }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   929
 #if (MOZ_WIDGET_GTK == 3)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   930
@@ -2176,6 +2192,12 @@ nsWindow::OnExposeEvent(cairo_t *cr)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   931
         return TRUE;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   932
     }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   933
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   934
+    // Clip upper part of the mContainer to get visible rounded corners
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   935
+    // of GtkHeaderBar which is renderd to mShell.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   936
+    if (mIsCSDEnabled) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   937
+        ApplyCSDClipping();
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   938
+    }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   939
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   940
     // If this widget uses OMTC...
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   941
     if (GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT ||
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   942
         GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_WR) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   943
@@ -2586,6 +2608,53 @@ nsWindow::OnMotionNotifyEvent(GdkEventMo
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   944
         }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   945
     }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   946
 #endif /* MOZ_X11 */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   947
+    // Client is decorated and we're getting the motion event for mShell
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   948
+    // window which draws the CSD decorations around mContainer.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   949
+    if (IsClientDecorated()) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   950
+        if (aEvent->window == gtk_widget_get_window(mShell)) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   951
+            GdkWindowEdge edge;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   952
+            LayoutDeviceIntPoint refPoint =
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   953
+                GdkEventCoordsToDevicePixels(aEvent->x, aEvent->y);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   954
+            if (CheckResizerEdge(refPoint, edge)) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   955
+                nsCursor cursor = eCursor_none;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   956
+                switch (edge) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   957
+                case GDK_WINDOW_EDGE_NORTH:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   958
+                    cursor = eCursor_n_resize;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   959
+                    break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   960
+                case GDK_WINDOW_EDGE_NORTH_WEST:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   961
+                    cursor = eCursor_nw_resize;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   962
+                    break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   963
+                case GDK_WINDOW_EDGE_NORTH_EAST:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   964
+                    cursor = eCursor_ne_resize;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   965
+                    break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   966
+                case GDK_WINDOW_EDGE_WEST:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   967
+                    cursor = eCursor_w_resize;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   968
+                    break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   969
+                case GDK_WINDOW_EDGE_EAST:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   970
+                    cursor = eCursor_e_resize;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   971
+                    break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   972
+                case GDK_WINDOW_EDGE_SOUTH:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   973
+                    cursor = eCursor_s_resize;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   974
+                    break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   975
+                case GDK_WINDOW_EDGE_SOUTH_WEST:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   976
+                    cursor = eCursor_sw_resize;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   977
+                    break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   978
+                case GDK_WINDOW_EDGE_SOUTH_EAST:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   979
+                    cursor = eCursor_se_resize;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   980
+                    break;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   981
+                }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   982
+                SetCursor(cursor);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   983
+                return;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   984
+            }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   985
+        }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   986
+        // We're not on resize handle - check if we need to reset cursor back.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   987
+        if (mCursor == eCursor_n_resize || mCursor == eCursor_nw_resize ||
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   988
+            mCursor == eCursor_ne_resize ||  mCursor == eCursor_w_resize ||
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   989
+            mCursor == eCursor_e_resize || mCursor == eCursor_s_resize ||
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   990
+            mCursor == eCursor_sw_resize || mCursor == eCursor_se_resize) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   991
+            SetCursor(eCursor_standard);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   992
+        }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   993
+    }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   994
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   995
     WidgetMouseEvent event(true, eMouseMove, this, WidgetMouseEvent::eReal);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   996
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   997
@@ -2756,6 +2825,20 @@ nsWindow::OnButtonPressEvent(GdkEventBut
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   998
     if (CheckForRollup(aEvent->x_root, aEvent->y_root, false, false))
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
   999
         return;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1000
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1001
+    if (IsClientDecorated() && aEvent->window == gtk_widget_get_window(mShell)) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1002
+        // Check to see if the event is within our window's resize region
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1003
+        GdkWindowEdge edge;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1004
+        LayoutDeviceIntPoint refPoint =
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1005
+            GdkEventCoordsToDevicePixels(aEvent->x, aEvent->y);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1006
+        if (CheckResizerEdge(refPoint, edge)) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1007
+            gdk_window_begin_resize_drag(gtk_widget_get_window(mShell),
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1008
+                                         edge, aEvent->button,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1009
+                                         aEvent->x_root, aEvent->y_root,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1010
+                                         aEvent->time);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1011
+            return;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1012
+        }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1013
+    }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1014
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1015
     gdouble pressure = 0;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1016
     gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1017
     mLastMotionPressure = pressure;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1018
@@ -3341,6 +3424,8 @@ nsWindow::OnWindowStateEvent(GtkWidget *
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1019
 #endif //ACCESSIBILITY
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1020
     }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1021
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1022
+    UpdateClientDecorations();
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1023
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1024
     if (mWidgetListener) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1025
       mWidgetListener->SizeModeChanged(mSizeState);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1026
       if (aEvent->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1027
@@ -3405,6 +3490,7 @@ nsWindow::OnCompositedChanged()
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1028
       presShell->ThemeChanged();
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1029
     }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1030
   }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1031
+  UpdateClientDecorations();
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1032
 }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1033
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1034
 void
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1035
@@ -3593,7 +3679,8 @@ nsWindow::Create(nsIWidget* aParent,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1036
     GtkWindow      *topLevelParent = nullptr;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1037
     nsWindow       *parentnsWindow = nullptr;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1038
     GtkWidget      *eventWidget = nullptr;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1039
-    bool            shellHasCSD = false;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1040
+    GtkWidget      *drawWidget = nullptr;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1041
+    bool            drawToContainer = false;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1042
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1043
     if (aParent) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1044
         parentnsWindow = static_cast<nsWindow*>(aParent);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1045
@@ -3640,29 +3727,47 @@ nsWindow::Create(nsIWidget* aParent,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1046
               GTK_WINDOW_TOPLEVEL : GTK_WINDOW_POPUP;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1047
         mShell = gtk_window_new(type);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1048
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1049
-        bool useAlphaVisual = (mWindowType == eWindowType_popup &&
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1050
-                               aInitData->mSupportTranslucency);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1051
+        bool useAlphaVisual = false;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1052
+#if (MOZ_WIDGET_GTK == 3)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1053
+        // When CSD is available we can emulate it for toplevel windows.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1054
+        // Content is rendered to mContainer and transparent decorations to mShell.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1055
+        if (GetCSDSupportLevel() != CSD_SUPPORT_NONE &&
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1056
+            mWindowType == eWindowType_toplevel) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1057
+            int32_t isCSDAvailable = false;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1058
+            nsresult rv = LookAndFeel::GetInt(LookAndFeel::eIntID_GTKCSDAvailable,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1059
+                                             &isCSDAvailable);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1060
+            if (NS_SUCCEEDED(rv)) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1061
+                mIsCSDEnabled = useAlphaVisual = isCSDAvailable;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1062
+            }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1063
+        } else
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1064
+#endif
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1065
+        if (mWindowType == eWindowType_popup) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1066
+            useAlphaVisual = aInitData->mSupportTranslucency;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1067
+        }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1068
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1069
         // mozilla.widget.use-argb-visuals is a hidden pref defaulting to false
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1070
         // to allow experimentation
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1071
         if (Preferences::GetBool("mozilla.widget.use-argb-visuals", false))
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1072
             useAlphaVisual = true;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1073
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1074
+        // An ARGB visual is only useful if we are on a compositing
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1075
+        // window manager.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1076
+        GdkScreen *screen = gtk_widget_get_screen(mShell);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1077
+        if (useAlphaVisual && !gdk_screen_is_composited(screen)) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1078
+            useAlphaVisual = false;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1079
+        }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1080
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1081
         // We need to select an ARGB visual here instead of in
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1082
         // SetTransparencyMode() because it has to be done before the
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1083
-        // widget is realized.  An ARGB visual is only useful if we
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1084
-        // are on a compositing window manager.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1085
+        // widget is realized.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1086
         if (useAlphaVisual) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1087
-            GdkScreen *screen = gtk_widget_get_screen(mShell);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1088
-            if (gdk_screen_is_composited(screen)) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1089
 #if (MOZ_WIDGET_GTK == 2)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1090
-                GdkColormap *colormap = gdk_screen_get_rgba_colormap(screen);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1091
-                gtk_widget_set_colormap(mShell, colormap);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1092
+            GdkColormap *colormap = gdk_screen_get_rgba_colormap(screen);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1093
+            gtk_widget_set_colormap(mShell, colormap);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1094
 #else
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1095
-                GdkVisual *visual = gdk_screen_get_rgba_visual(screen);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1096
-                gtk_widget_set_visual(mShell, visual);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1097
+            GdkVisual *visual = gdk_screen_get_rgba_visual(screen);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1098
+            gtk_widget_set_visual(mShell, visual);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1099
 #endif
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1100
-            }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1101
         }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1102
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1103
         // We only move a general managed toplevel window if someone has
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1104
@@ -3756,24 +3861,56 @@ nsWindow::Create(nsIWidget* aParent,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1105
         mContainer = MOZ_CONTAINER(container);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1106
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1107
 #if (MOZ_WIDGET_GTK == 3)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1108
-        // "csd" style is set when widget is realized so we need to call
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1109
-        // it explicitly now.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1110
-        gtk_widget_realize(mShell);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1111
-
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1112
-        // We can't draw directly to top-level window when client side
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1113
-        // decorations are enabled. We use container with GdkWindow instead.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1114
-        GtkStyleContext* style = gtk_widget_get_style_context(mShell);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1115
-        shellHasCSD = gtk_style_context_has_class(style, "csd");
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1116
-#endif
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1117
-        if (!shellHasCSD) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1118
-            // Use mShell's window for drawing and events.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1119
-            gtk_widget_set_has_window(container, FALSE);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1120
-            // Prevent GtkWindow from painting a background to flicker.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1121
-            gtk_widget_set_app_paintable(mShell, TRUE);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1122
-        }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1123
-        // Set up event widget
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1124
-        eventWidget = shellHasCSD ? container : mShell;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1125
+        /* There are tree possible situations here:
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1126
+         *
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1127
+         * 1) We're running on Gtk+ < 3.20 without any decorations. Content
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1128
+         *    is rendered to mShell window and we listen Gtk+ events on mShell.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1129
+         * 2) We're running on Gtk+ > 3.20 and window decorations are drawn
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1130
+         *    by default by Gtk+. Content is rendered to mContainer,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1131
+         *    we listen events on mContainer. mShell contains default Gtk+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1132
+         *    window decorations rendered by Gtk+.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1133
+         * 3) We're running on Gtk+ > 3.20 and both window decorations and
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1134
+         *    content is rendered by gecko. We emulate Gtk+ decoration rendering
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1135
+         *    to mShell and we need to listen Gtk events on both mShell
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1136
+         *    and mContainer.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1137
+         */
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1138
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1139
+        // When client side decorations are enabled (rendered by us or by Gtk+)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1140
+        // the decoration is rendered to mShell (toplevel) window and
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1141
+        // we draw our content to mContainer.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1142
+        if (mIsCSDEnabled) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1143
+            drawToContainer = true;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1144
+        } else {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1145
+            // mIsCSDEnabled can be disabled by preference so look at actual
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1146
+            // toplevel window style to to detect active "csd" style.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1147
+            // The "csd" style is set when widget is realized so we need to call
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1148
+            // it explicitly now.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1149
+            gtk_widget_realize(mShell);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1150
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1151
+            GtkStyleContext* style = gtk_widget_get_style_context(mShell);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1152
+            drawToContainer = gtk_style_context_has_class(style, "csd");
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1153
+        }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1154
+#endif
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1155
+        drawWidget = (drawToContainer) ? container : mShell;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1156
+        // When we draw decorations on our own we need to handle resize events
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1157
+        // because Gtk+ does not provide resizers for undecorated windows.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1158
+        // The CSD on mShell borders act as resize handlers
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1159
+        // so we need to listen there.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1160
+        eventWidget = (drawToContainer && !mIsCSDEnabled) ? container : mShell;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1161
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1162
         gtk_widget_add_events(eventWidget, kEvents);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1163
+        if (eventWidget != drawWidget) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1164
+            // CSD is rendered by us (not by Gtk+) so we also need to listen
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1165
+            // at mShell window for events.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1166
+            gtk_widget_add_events(drawWidget, kEvents);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1167
+        }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1168
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1169
+        // Prevent GtkWindow from painting a background to flicker.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1170
+        gtk_widget_set_app_paintable(drawWidget, TRUE);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1171
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1172
+        // gtk_container_add() realizes the child widget so we need to
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1173
+        // set it now.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1174
+        gtk_widget_set_has_window(container, drawToContainer);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1175
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1176
         gtk_container_add(GTK_CONTAINER(mShell), container);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1177
         gtk_widget_realize(container);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1178
@@ -3783,7 +3920,7 @@ nsWindow::Create(nsIWidget* aParent,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1179
         gtk_widget_grab_focus(container);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1180
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1181
         // the drawing window
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1182
-        mGdkWindow = gtk_widget_get_window(eventWidget);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1183
+        mGdkWindow = gtk_widget_get_window(drawWidget);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1184
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1185
         if (mWindowType == eWindowType_popup) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1186
             // gdk does not automatically set the cursor for "temporary"
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1187
@@ -3856,6 +3993,11 @@ nsWindow::Create(nsIWidget* aParent,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1188
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1189
     // label the drawing window with this object so we can find our way home
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1190
     g_object_set_data(G_OBJECT(mGdkWindow), "nsWindow", this);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1191
+    if (mIsCSDEnabled) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1192
+        // label the CSD window with this object so we can find our way home
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1193
+        g_object_set_data(G_OBJECT(gtk_widget_get_window(mShell)),
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1194
+                          "nsWindow", this);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1195
+    }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1196
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1197
     if (mContainer)
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1198
         g_object_set_data(G_OBJECT(mContainer), "nsWindow", this);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1199
@@ -3893,6 +4035,10 @@ nsWindow::Create(nsIWidget* aParent,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1200
         g_signal_connect_after(default_settings,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1201
                                "notify::gtk-font-name",
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1202
                                G_CALLBACK(theme_changed_cb), this);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1203
+        if (mIsCSDEnabled) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1204
+            g_signal_connect(G_OBJECT(mShell), "draw",
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1205
+                             G_CALLBACK(expose_event_decoration_draw_cb), nullptr);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1206
+        }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1207
     }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1208
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1209
     if (mContainer) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1210
@@ -3943,7 +4089,7 @@ nsWindow::Create(nsIWidget* aParent,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1211
                          G_CALLBACK(drag_data_received_event_cb), nullptr);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1212
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1213
         GtkWidget *widgets[] = { GTK_WIDGET(mContainer),
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1214
-                                 !shellHasCSD ? mShell : nullptr };
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1215
+                                 !drawToContainer ? mShell : nullptr };
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1216
         for (size_t i = 0; i < ArrayLength(widgets) && widgets[i]; ++i) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1217
             // Visibility events are sent to the owning widget of the relevant
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1218
             // window but do not propagate to parent widgets so connect on
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1219
@@ -3973,7 +4119,6 @@ nsWindow::Create(nsIWidget* aParent,
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1220
         // Don't let GTK mess with the shapes of our GdkWindows
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1221
         GTK_PRIVATE_SET_FLAG(eventWidget, GTK_HAS_SHAPE_MASK);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1222
 #endif
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1223
-
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1224
         // These events are sent to the owning widget of the relevant window
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1225
         // and propagate up to the first widget that handles the events, so we
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1226
         // need only connect on mShell, if it exists, to catch events on its
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1227
@@ -4110,6 +4255,12 @@ nsWindow::NativeResize()
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1228
          size.width, size.height));
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1229
 
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1230
     if (mIsTopLevel) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1231
+        // When we draw decorations add extra space to draw shadows
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1232
+        // around the main window.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1233
+        if (mDrawWindowDecoration) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1234
+            size.width += mDecorationSize.left + mDecorationSize.right;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1235
+            size.height += mDecorationSize.top + mDecorationSize.bottom;
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1236
+        }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1237
         gtk_window_resize(GTK_WINDOW(mShell), size.width, size.height);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1238
     }
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1239
     else if (mContainer) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1240
@@ -4166,6 +4317,11 @@ nsWindow::NativeMoveResize()
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1241
     if (mIsTopLevel) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1242
         // x and y give the position of the window manager frame top-left.
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1243
         gtk_window_move(GTK_WINDOW(mShell), topLeft.x, topLeft.y);
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1244
+
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1245
+        if (mDrawWindowDecoration) {
0c59a30173da several changes
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
  1246
+            size.width += mDecorationSize.left + mDecorationSize.right;