Bug 1457309 - [Gtk+/CSD] Reset toplevel window offset when it's at maximized/fulscreenstate, r?jhorak draft
authorMartin Stransky <stransky@redhat.com>
Fri, 27 Apr 2018 11:14:00 +0200
changeset 788990 2700101341f79f6da70203ce4d23378226c28a98
parent 788989 3d7957239068ec9f927e398ce62a6cdd871c2958
child 789022 2a6d4221f1ed67f01accc6e5112fe24816d46c3e
push id108124
push userstransky@redhat.com
push dateFri, 27 Apr 2018 09:14:38 +0000
reviewersjhorak
bugs1457309
milestone61.0a1
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))
@@ -6629,19 +6633,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