Bug 1319764 - Ensure Gtk window unmap workaround is actually used. r=karlt, a=jcristau
authorJamie Nicol <jnicol@mozilla.com>
Fri, 13 Jan 2017 14:23:29 +0000
changeset 353679 d73abe84cc5132e5f9d06204505fb1c6055c2051
parent 353678 64c904cb97764d74dfc4c2ad805cb7fc9155b3a3
child 353680 811c33f3350790b66f9803de91107823bf30756f
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt, jcristau
bugs1319764, 1225044
milestone52.0a2
Bug 1319764 - Ensure Gtk window unmap workaround is actually used. r=karlt, a=jcristau 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
@@ -2409,17 +2409,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) {
@@ -4220,17 +4222,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
@@ -462,17 +462,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();