Changeset View
Changeset View
Standalone View
Standalone View
3rdparty/ext_qt/set-has-border-in-full-screen-default.patch
- This file was added.
1 | From f377ab8da1acb279e5b23ab1d2ef4afabe5f481c Mon Sep 17 00:00:00 2001 | ||||
---|---|---|---|---|---|
2 | From: Friedemann Kleint <Friedemann.Kleint@qt.io> | ||||
3 | Date: Wed, 21 Nov 2018 09:06:50 +0100 | ||||
4 | Subject: [PATCH] Windows: Add a default setting for hasBorderInFullScreen | ||||
5 | | ||||
6 | The hasBorderInFullScreen only has an effect when set before | ||||
7 | the window is shown or switched to fullscreen. This is currently | ||||
8 | not possible in the QML case since the window is only accessible | ||||
9 | after all properties (including visibility) have been set. | ||||
10 | Add a function to set a default value. | ||||
11 | | ||||
12 | [ChangeLog][QtPlatformHeaders][QWindowsWindowFunctions] Add a default | ||||
13 | setting for hasBorderInFullScreen | ||||
14 | | ||||
15 | Task-number: QTBUG-47247 | ||||
16 | Task-number: QTBUG-71855 | ||||
17 | Change-Id: I3952e3f34bc4eb134cf1c5265b4489fc74112688 | ||||
18 | Reviewed-by: Andre de la Rocha <andre.rocha@qt.io> | ||||
19 | Reviewed-by: Andy Shaw <andy.shaw@qt.io> | ||||
20 | (cherry picked from commit 7264bf19dbc47b805bb7af5df584ce1aae081962) | ||||
21 | --- | ||||
22 | .../qwindowswindowfunctions.h | 9 +++++ | ||||
23 | .../qwindowswindowfunctions.qdoc | 33 +++++++++++++++++++ | ||||
24 | .../windows/qwindowsnativeinterface.cpp | 2 ++ | ||||
25 | .../platforms/windows/qwindowswindow.cpp | 8 ++++- | ||||
26 | .../platforms/windows/qwindowswindow.h | 2 ++ | ||||
27 | 5 files changed, 53 insertions(+), 1 deletion(-) | ||||
28 | | ||||
29 | diff --git a/src/platformheaders/windowsfunctions/qwindowswindowfunctions.h b/src/platformheaders/windowsfunctions/qwindowswindowfunctions.h | ||||
30 | index e51c2fde67..032dcafa6e 100644 | ||||
31 | --- a/src/platformheaders/windowsfunctions/qwindowswindowfunctions.h | ||||
32 | +++ b/src/platformheaders/windowsfunctions/qwindowswindowfunctions.h | ||||
33 | @@ -81,6 +81,15 @@ public: | ||||
34 | func(window, border); | ||||
35 | } | ||||
36 | | ||||
37 | + typedef void (*SetHasBorderInFullScreenDefault)(bool border); | ||||
38 | + static const QByteArray setHasBorderInFullScreenDefaultIdentifier() { return QByteArrayLiteral("WindowsSetHasBorderInFullScreenDefault"); } | ||||
39 | + static void setHasBorderInFullScreenDefault(bool border) | ||||
40 | + { | ||||
41 | + auto func = reinterpret_cast<SetHasBorderInFullScreenDefault>(QGuiApplication::platformFunction(setHasBorderInFullScreenDefaultIdentifier())); | ||||
42 | + if (func) | ||||
43 | + func(border); | ||||
44 | + } | ||||
45 | + | ||||
46 | typedef void (*SetWindowActivationBehaviorType)(WindowActivationBehavior); | ||||
47 | static const QByteArray setWindowActivationBehaviorIdentifier() { return QByteArrayLiteral("WindowsSetWindowActivationBehavior"); } | ||||
48 | | ||||
49 | diff --git a/src/platformheaders/windowsfunctions/qwindowswindowfunctions.qdoc b/src/platformheaders/windowsfunctions/qwindowswindowfunctions.qdoc | ||||
50 | index a52bbe061b..0c52cde753 100644 | ||||
51 | --- a/src/platformheaders/windowsfunctions/qwindowswindowfunctions.qdoc | ||||
52 | +++ b/src/platformheaders/windowsfunctions/qwindowswindowfunctions.qdoc | ||||
53 | @@ -93,7 +93,40 @@ | ||||
54 | is true then it will enable the WS_BORDER flag in full screen mode to enable other top level windows | ||||
55 | inside the application to appear on top when required. | ||||
56 | | ||||
57 | + \note The setting must be applied before showing the window or switching it | ||||
58 | + to full screen. For QML, setHasBorderInFullScreenDefault() can be used to | ||||
59 | + set a default value. | ||||
60 | + | ||||
61 | + See also \l [QtDoc] {Fullscreen OpenGL Based Windows} | ||||
62 | +*/ | ||||
63 | + | ||||
64 | +/*! | ||||
65 | + \typedef QWindowsWindowFunctions::SetHasBorderInFullScreenDefault | ||||
66 | + \since 5.13 | ||||
67 | + | ||||
68 | + This is the typedef for the function returned by QGuiApplication::platformFunction | ||||
69 | + when passed setHasBorderInFullScreenDefaultIdentifier. | ||||
70 | +*/ | ||||
71 | + | ||||
72 | +/*! | ||||
73 | + \fn QByteArray QWindowsWindowFunctions::setHasBorderInFullScreenDefaultIdentifier() | ||||
74 | + \since 5.13 | ||||
75 | + | ||||
76 | + This function returns the bytearray that can be used to query | ||||
77 | + QGuiApplication::platformFunction to retrieve the SetHasBorderInFullScreen function. | ||||
78 | +*/ | ||||
79 | + | ||||
80 | +/*! | ||||
81 | + \fn void QWindowsWindowFunctions::setHasBorderInFullScreenDefault(bool border) | ||||
82 | + \since 5.13 | ||||
83 | + | ||||
84 | + This is a convenience function that can be used directly instead of resolving | ||||
85 | + the function pointer. \a border will be relayed to the function retrieved by | ||||
86 | + QGuiApplication. When \a border is true, the WS_BORDER flag will be set | ||||
87 | + in full screen mode for all windows by default. | ||||
88 | + | ||||
89 | See also \l [QtDoc] {Fullscreen OpenGL Based Windows} | ||||
90 | + \sa setHasBorderInFullScreen() | ||||
91 | */ | ||||
92 | | ||||
93 | /*! | ||||
94 | diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp | ||||
95 | index 05d6ac9201..eeb1aa58a3 100644 | ||||
96 | --- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp | ||||
97 | +++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp | ||||
98 | @@ -293,6 +293,8 @@ QFunctionPointer QWindowsNativeInterface::platformFunction(const QByteArray &fun | ||||
99 | return QFunctionPointer(QWindowsWindow::setTouchWindowTouchTypeStatic); | ||||
100 | if (function == QWindowsWindowFunctions::setHasBorderInFullScreenIdentifier()) | ||||
101 | return QFunctionPointer(QWindowsWindow::setHasBorderInFullScreenStatic); | ||||
102 | + if (function == QWindowsWindowFunctions::setHasBorderInFullScreenDefaultIdentifier()) | ||||
103 | + return QFunctionPointer(QWindowsWindow::setHasBorderInFullScreenDefault); | ||||
104 | if (function == QWindowsWindowFunctions::setWindowActivationBehaviorIdentifier()) | ||||
105 | return QFunctionPointer(QWindowsNativeInterface::setWindowActivationBehavior); | ||||
106 | if (function == QWindowsWindowFunctions::isTabletModeIdentifier()) | ||||
107 | diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp | ||||
108 | index 910d8dd209..9705eb7293 100644 | ||||
109 | --- a/src/plugins/platforms/windows/qwindowswindow.cpp | ||||
110 | +++ b/src/plugins/platforms/windows/qwindowswindow.cpp | ||||
111 | @@ -1180,6 +1180,7 @@ QWindowCreationContext::QWindowCreationContext(const QWindow *w, | ||||
112 | | ||||
113 | const char *QWindowsWindow::embeddedNativeParentHandleProperty = "_q_embedded_native_parent_handle"; | ||||
114 | const char *QWindowsWindow::hasBorderInFullScreenProperty = "_q_has_border_in_fullscreen"; | ||||
115 | +bool QWindowsWindow::m_borderInFullScreenDefault = false; | ||||
116 | | ||||
117 | QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) : | ||||
118 | QWindowsBaseWindow(aWindow), | ||||
119 | @@ -1217,7 +1218,7 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) | ||||
120 | | ||||
121 | if (aWindow->isTopLevel()) | ||||
122 | setWindowIcon(aWindow->icon()); | ||||
123 | - if (aWindow->property(hasBorderInFullScreenProperty).toBool()) | ||||
124 | + if (m_borderInFullScreenDefault || aWindow->property(hasBorderInFullScreenProperty).toBool()) | ||||
125 | setFlag(HasBorderInFullScreen); | ||||
126 | clearFlag(WithinCreate); | ||||
127 | } | ||||
128 | @@ -2820,6 +2821,11 @@ void QWindowsWindow::setHasBorderInFullScreenStatic(QWindow *window, bool border | ||||
129 | window->setProperty(hasBorderInFullScreenProperty, QVariant(border)); | ||||
130 | } | ||||
131 | | ||||
132 | +void QWindowsWindow::setHasBorderInFullScreenDefault(bool border) | ||||
133 | +{ | ||||
134 | + m_borderInFullScreenDefault = border; | ||||
135 | +} | ||||
136 | + | ||||
137 | void QWindowsWindow::setHasBorderInFullScreen(bool border) | ||||
138 | { | ||||
139 | if (testFlag(HasBorderInFullScreen) == border) | ||||
140 | diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h | ||||
141 | index b9b398b67b..b07bd15d2a 100644 | ||||
142 | --- a/src/plugins/platforms/windows/qwindowswindow.h | ||||
143 | +++ b/src/plugins/platforms/windows/qwindowswindow.h | ||||
144 | @@ -341,6 +341,7 @@ public: | ||||
145 | static void setTouchWindowTouchTypeStatic(QWindow *window, QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes); | ||||
146 | void registerTouchWindow(QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes = QWindowsWindowFunctions::NormalTouch); | ||||
147 | static void setHasBorderInFullScreenStatic(QWindow *window, bool border); | ||||
148 | + static void setHasBorderInFullScreenDefault(bool border); | ||||
149 | void setHasBorderInFullScreen(bool border); | ||||
150 | static QString formatWindowTitle(const QString &title); | ||||
151 | | ||||
152 | @@ -386,6 +387,7 @@ private: | ||||
153 | // note: intentionally not using void * in order to avoid breaking x86 | ||||
154 | VkSurfaceKHR m_vkSurface = 0; | ||||
155 | #endif | ||||
156 | + static bool m_borderInFullScreenDefault; | ||||
157 | }; | ||||
158 | | ||||
159 | #ifndef QT_NO_DEBUG_STREAM | ||||
160 | -- | ||||
161 | 2.18.0.windows.1 | ||||
162 | |