Bug 1319764 - Ensure Gtk window unmap workaround is actually used. r=karlt
authorJamie Nicol <jnicol@mozilla.com>
Fri, 13 Jan 2017 14:23:29 +0000
changeset 329586 ae5095f7a167bfa48648d44423833bb72cbceb3a
parent 329585 70db86990f0df9766d1eb582bd7668a1dd6983bb
child 329587 98cbc58cc6bc7bbdd6af853173b1c12b10ad47a1
push id31215
push userphilringnalda@gmail.com
push dateMon, 16 Jan 2017 21:02:38 +0000
treeherdermozilla-central@98cbc58cc6bc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs1319764, 1225044
milestone53.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 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();