xcb: cleanup QXcbWindow::relayFocusToModalWindow()

- recursion is not needed for walking up the parent chain;
- use camel-case, modal_window -> modalWindow;

Change-Id: I4b7697f2388fd16f11be67ba475bd63ad249d89e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Gatis Paeglis 2017-03-13 16:40:55 +01:00
parent 4f324d4655
commit c75e3f70b4

View File

@ -918,19 +918,17 @@ void QXcbWindow::hide()
}
}
static QWindow *tlWindow(QWindow *window)
{
if (window && window->parent())
return tlWindow(window->parent());
return window;
}
bool QXcbWindow::relayFocusToModalWindow() const
{
QWindow *w = tlWindow(static_cast<QWindowPrivate *>(QObjectPrivate::get(window()))->eventReceiver());
QWindow *modal_window = 0;
if (QGuiApplicationPrivate::instance()->isWindowBlocked(w,&modal_window) && modal_window != w) {
modal_window->requestActivate();
QWindow *w = static_cast<QWindowPrivate *>(QObjectPrivate::get(window()))->eventReceiver();
// get top-level window
while (w && w->parent())
w = w->parent();
QWindow *modalWindow = 0;
const bool blocked = QGuiApplicationPrivate::instance()->isWindowBlocked(w, &modalWindow);
if (blocked && modalWindow != w) {
modalWindow->requestActivate();
connection()->flush();
return true;
}