Bug 1457309 - [Gtk+/CSD] Reset toplevel window offset when it's at maximized/fulscreenstate, r=jhorak
authorMartin Stransky <stransky@redhat.com>
Fri, 27 Apr 2018 11:14:00 +0200
changeset 415990 61ef0409797103377777cdd32f6c6d1b1470b748
parent 415989 0e1f60508407f11848916a8b881cad85da70b414
child 415991 5c04c625cfa622ae45a0fbf8dbf6943b470a9c87
push id63343
push userstransky@redhat.com
push dateFri, 27 Apr 2018 09:32:03 +0000
treeherderautoland@61ef04097971 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjhorak
bugs1457309
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1457309 - [Gtk+/CSD] Reset toplevel window offset when it's at maximized/fulscreenstate, r=jhorak MozReview-Commit-ID: DQTVuquMSXn
widget/gtk/nsWindow.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -3391,16 +3391,20 @@ nsWindow::OnWindowStateEvent(GtkWidget *
 
     if (mWidgetListener) {
       mWidgetListener->SizeModeChanged(mSizeState);
       if (aEvent->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) {
         mWidgetListener->FullscreenChanged(
           aEvent->new_window_state & GDK_WINDOW_STATE_FULLSCREEN);
       }
     }
+
+    if (mCSDSupportLevel == CSD_SUPPORT_CLIENT) {
+        UpdateClientOffsetForCSDWindow();
+    }
 }
 
 void
 nsWindow::ThemeChanged()
 {
     NotifyThemeChanged();
 
     if (!mGdkWindow || MOZ_UNLIKELY(mIsDestroyed))
@@ -6630,19 +6634,23 @@ nsWindow::ClearCachedResources()
  * It works only for CSD decorated GtkWindow.
  */
 void
 nsWindow::UpdateClientOffsetForCSDWindow()
 {
     // _NET_FRAME_EXTENTS is not set on client decorated windows,
     // so we need to read offset between mContainer and toplevel mShell
     // window.
-    GtkBorder decorationSize;
-    GetCSDDecorationSize(GTK_WINDOW(mShell), &decorationSize);
-    mClientOffset = nsIntPoint(decorationSize.left, decorationSize.top);
+    if (mSizeState == nsSizeMode_Normal) {
+        GtkBorder decorationSize;
+        GetCSDDecorationSize(GTK_WINDOW(mShell), &decorationSize);
+        mClientOffset = nsIntPoint(decorationSize.left, decorationSize.top);
+    } else {
+        mClientOffset = nsIntPoint(0, 0);
+    }
 
     // Send a WindowMoved notification. This ensures that TabParent
     // picks up the new client offset and sends it to the child process
     // if appropriate.
     NotifyWindowMoved(mBounds.x, mBounds.y);
 }
 
 nsresult