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
--- 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();