Bug 1319764 - Ensure Gtk window unmap workaround is actually used. r?karlt draft
authorJamie Nicol <jnicol@mozilla.com>
Fri, 13 Jan 2017 14:23:29 +0000
changeset 461251 8f6c25dfd6bf98b7a48aab98b49bcd316d5ec9d9
parent 460618 91f5293e9a89056565493ed5073c3842b0ee9fdc
child 542264 e095fe7ce6969e13baf367251e178fb006e0fd4e
push id41616
push userbmo:jnicol@mozilla.com
push dateMon, 16 Jan 2017 08:47:27 +0000
reviewerskarlt
bugs1319764, 1225044
milestone53.0a1
Bug 1319764 - Ensure Gtk window unmap workaround is actually used. r?karlt We were miscounting the number of manual configure events which we needed to send gtk as the workaround for bug 1225044, causing it not to work in some cases. This is because configure events can come from more sources than were counting. Decrement mPendingConfigures only as far as zero, like configure_request_count in gtk_window_configure_event(). MozReview-Commit-ID: GxpR2Zozxor
widget/gtk/nsWindow.cpp
widget/gtk/nsWindow.h
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -2396,17 +2396,19 @@ nsWindow::OnConfigureEvent(GtkWidget *aW
     //   the client window.
     //
     //   Override-redirect windows are children of the root window so parent
     //   coordinates are root coordinates.
 
     LOG(("configure event [%p] %d %d %d %d\n", (void *)this,
          aEvent->x, aEvent->y, aEvent->width, aEvent->height));
 
-    mPendingConfigures--;
+    if (mPendingConfigures > 0) {
+        mPendingConfigures--;
+    }
 
     LayoutDeviceIntRect screenBounds = GetScreenBounds();
 
     if (mWindowType == eWindowType_toplevel || mWindowType == eWindowType_dialog) {
         // This check avoids unwanted rollup on spurious configure events from
         // Cygwin/X (bug 672103).
         if (mBounds.x != screenBounds.x ||
             mBounds.y != screenBounds.y) {
@@ -4207,17 +4209,17 @@ nsWindow::NativeShow(bool aAction)
                 event.window = mGdkWindow;
                 event.send_event = TRUE;
                 event.x = allocation.x;
                 event.y = allocation.y;
                 event.width = allocation.width;
                 event.height = allocation.height;
 
                 auto shellClass = GTK_WIDGET_GET_CLASS(mShell);
-                for (int i = 0; i < mPendingConfigures; i++) {
+                for (unsigned int i = 0; i < mPendingConfigures; i++) {
                     Unused << shellClass->configure_event(mShell, &event);
                 }
                 mPendingConfigures = 0;
             }
 
             gtk_widget_hide(mShell);
 
             ClearTransparencyBitmap(); // Release some resources
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -464,17 +464,17 @@ private:
     Window              mXWindow;
     Visual*             mXVisual;
     int                 mXDepth;
     mozilla::widget::WindowSurfaceProvider mSurfaceProvider;
 #endif
 
     // Upper bound on pending ConfigureNotify events to be dispatched to the
     // window. See bug 1225044.
-    int mPendingConfigures;
+    unsigned int mPendingConfigures;
 
 #ifdef ACCESSIBILITY
     RefPtr<mozilla::a11y::Accessible> mRootAccessible;
 
     /**
      * Request to create the accessible for this window if it is top level.
      */
     void                CreateRootAccessible();