summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowswindow.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-03-13 10:50:41 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-03-13 12:04:11 +0000
commit43918feb4adbcd2e7035b5985309eefe2e2f28c6 (patch)
treeb2a323f609728d967cbd7dc90449b812c073dc50 /src/plugins/platforms/windows/qwindowswindow.cpp
parent910cc08f6b45241b80bdf50732fa9c1283499d49 (diff)
Windows QPA: Fix QWindowsWindowFunctions::SetHasBorderInFullScreen() to work in all cases
- Directly apply the flag in case the platform window exists and is in full screen. - Store as a dynamic property in case the platform window is not created yet. Amends 69839e55c13000ee9bf8d8e9d74b70096a92ae51. Task-number: QTBUG-41309 Task-number: QTBUG-66557 Change-Id: I162baecfae4d07a5d5b59c5401bdb605faa7ab68 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowswindow.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 159e1250d0..d639f27c1a 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1077,6 +1077,7 @@ QWindowCreationContext::QWindowCreationContext(const QWindow *w,
*/
const char *QWindowsWindow::embeddedNativeParentHandleProperty = "_q_embedded_native_parent_handle";
+const char *QWindowsWindow::hasBorderInFullScreenProperty = "_q_has_border_in_fullscreen";
QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) :
QWindowsBaseWindow(aWindow),
@@ -1115,6 +1116,8 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data)
if (aWindow->isTopLevel())
setWindowIcon(aWindow->icon());
+ if (aWindow->property(hasBorderInFullScreenProperty).toBool())
+ setFlag(HasBorderInFullScreen);
clearFlag(WithinCreate);
}
@@ -2662,15 +2665,26 @@ void QWindowsWindow::setHasBorderInFullScreenStatic(QWindow *window, bool border
if (QPlatformWindow *handle = window->handle())
static_cast<QWindowsWindow *>(handle)->setHasBorderInFullScreen(border);
else
- qWarning("%s invoked without window handle; call has no effect.", Q_FUNC_INFO);
+ window->setProperty(hasBorderInFullScreenProperty, QVariant(border));
}
void QWindowsWindow::setHasBorderInFullScreen(bool border)
{
+ if (testFlag(HasBorderInFullScreen) == border)
+ return;
if (border)
setFlag(HasBorderInFullScreen);
else
clearFlag(HasBorderInFullScreen);
+ // Directly apply the flag in case we are fullscreen.
+ if (m_windowState == Qt::WindowFullScreen) {
+ LONG_PTR style = GetWindowLongPtr(handle(), GWL_STYLE);
+ if (border)
+ style |= WS_BORDER;
+ else
+ style &= ~WS_BORDER;
+ SetWindowLongPtr(handle(), GWL_STYLE, style);
+ }
}
QString QWindowsWindow::formatWindowTitle(const QString &title)