Commit a6d4e601 by Corentin Wallez

X11Window::resize wait for the window to be resized before returning

This will help address a bug in glReadPixels performed after a resize. BUG=angleproject:1050 Change-Id: Ie204dec229582ec0e990c6f7fa22cfd44048d46e Reviewed-on: https://chromium-review.googlesource.com/286250Reviewed-by: 's avatarKenneth Russell <kbr@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent bb6a5f93
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
#include "x11/X11Window.h" #include "x11/X11Window.h"
#include "system_utils.h"
#include "Timer.h"
namespace { namespace {
Bool WaitForMapNotify(Display *dpy, XEvent *event, XPointer window) Bool WaitForMapNotify(Display *dpy, XEvent *event, XPointer window)
...@@ -289,6 +292,19 @@ bool X11Window::resize(int width, int height) ...@@ -289,6 +292,19 @@ bool X11Window::resize(int width, int height)
{ {
XResizeWindow(mDisplay, mWindow, width, height); XResizeWindow(mDisplay, mWindow, width, height);
XFlush(mDisplay); XFlush(mDisplay);
Timer* timer = CreateTimer();
timer->start();
// Wait until the window as actually been resized so that the code calling resize
// can assume the window has been resized.
const double kResizeWaitDelay = 0.2;
while (mHeight != height && mWidth != width && timer->getElapsedTime() < kResizeWaitDelay)
{
messageLoop();
angle::Sleep(10);
}
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment