Commit 2bc5d161e6820d459f00ac687ed99830a731cb74

Fixed qt_x11_wait_for_window_manager

When we wait for the window to be shown by looking for ReparentNotify,
MapNotify, etc events in the event queue, we should check if those events come
for the right window, otherwise we might exit too early if there are event for
an other window in the queue.

Reviewed-by: Leonardo Sobral Cunha
  
358358 if (!w->testAttribute(Qt::WA_WState_Created))
359359 return;
360360
361 WId winid = w->internalWinId();
362
361363 // first deliver events that are already in the local queue
362364 QApplication::sendPostedEvents();
363365
381381 switch (state) {
382382 case Initial:
383383 case Reparented:
384 if (ev.type == MapNotify)
384 if (ev.type == MapNotify && ev.xany.window == winid)
385385 state = Mapped;
386386 break;
387387 case Mapped:
388 if (ev.type == Expose)
388 if (ev.type == Expose && ev.xany.window == winid)
389389 return;
390390 break;
391391 }
392392 } else {
393393 switch (state) {
394394 case Initial:
395 if (ev.type == ReparentNotify)
395 if (ev.type == ReparentNotify && ev.xany.window == winid)
396396 state = Reparented;
397397 break;
398398 case Reparented:
399 if (ev.type == MapNotify)
399 if (ev.type == MapNotify && ev.xany.window == winid)
400400 state = Mapped;
401401 break;
402402 case Mapped:
403 if (ev.type == Expose)
403 if (ev.type == Expose && ev.xany.window == winid)
404404 return;
405405 break;
406406 }