Reduce nesting in processWindowScreenChangedEvent()
Replace if-block with early return on null QWindow. Pick-to: 6.6 Task-number: QTBUG-116232 Change-Id: Iaf402edfd9b03734b64fdf707834fa92c827a1dc Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
f5b4a18b56
commit
198eaaf523
@ -2579,28 +2579,30 @@ void QGuiApplicationPrivate::processWindowStateChangedEvent(QWindowSystemInterfa
|
|||||||
|
|
||||||
void QGuiApplicationPrivate::processWindowScreenChangedEvent(QWindowSystemInterfacePrivate::WindowScreenChangedEvent *wse)
|
void QGuiApplicationPrivate::processWindowScreenChangedEvent(QWindowSystemInterfacePrivate::WindowScreenChangedEvent *wse)
|
||||||
{
|
{
|
||||||
if (QWindow *window = wse->window.data()) {
|
QWindow *window = wse->window.data();
|
||||||
if (window->screen() == wse->screen.data())
|
if (!window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (QWindow *topLevelWindow = window->d_func()->topLevelWindow(QWindow::ExcludeTransients)) {
|
if (window->screen() == wse->screen.data())
|
||||||
if (QScreen *screen = wse->screen.data())
|
return;
|
||||||
topLevelWindow->d_func()->setTopLevelScreen(screen, false /* recreate */);
|
|
||||||
else // Fall back to default behavior, and try to find some appropriate screen
|
|
||||||
topLevelWindow->setScreen(nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// We may have changed scaling; trigger resize event if needed,
|
if (QWindow *topLevelWindow = window->d_func()->topLevelWindow(QWindow::ExcludeTransients)) {
|
||||||
// except on Windows, where we send resize events during WM_DPICHANGED
|
if (QScreen *screen = wse->screen.data())
|
||||||
// event handling. FIXME: unify DPI change handling across all platforms.
|
topLevelWindow->d_func()->setTopLevelScreen(screen, false /* recreate */);
|
||||||
#ifndef Q_OS_WIN
|
else // Fall back to default behavior, and try to find some appropriate screen
|
||||||
if (window->handle()) {
|
topLevelWindow->setScreen(nullptr);
|
||||||
QWindowSystemInterfacePrivate::GeometryChangeEvent gce(window, QHighDpi::fromNativePixels(window->handle()->geometry(), window));
|
|
||||||
processGeometryChangeEvent(&gce);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
QWindowPrivate::get(window)->updateDevicePixelRatio();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We may have changed scaling; trigger resize event if needed,
|
||||||
|
// except on Windows, where we send resize events during WM_DPICHANGED
|
||||||
|
// event handling. FIXME: unify DPI change handling across all platforms.
|
||||||
|
#ifndef Q_OS_WIN
|
||||||
|
if (window->handle()) {
|
||||||
|
QWindowSystemInterfacePrivate::GeometryChangeEvent gce(window, QHighDpi::fromNativePixels(window->handle()->geometry(), window));
|
||||||
|
processGeometryChangeEvent(&gce);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
QWindowPrivate::get(window)->updateDevicePixelRatio();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QGuiApplicationPrivate::processWindowDevicePixelRatioChangedEvent(QWindowSystemInterfacePrivate::WindowDevicePixelRatioChangedEvent *wde)
|
void QGuiApplicationPrivate::processWindowDevicePixelRatioChangedEvent(QWindowSystemInterfacePrivate::WindowDevicePixelRatioChangedEvent *wde)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user