Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qohosview.cpp
Go to the documentation of this file.
1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include <render/qohosview.h>
5
6#include <QtCore/private/qnapi_p.h>
7#include <QtCore/private/qohoscommon_p.h>
8#include <QtCore/qscopeguard.h>
9#include <QtGui/private/qguiapplication_p.h>
10#include <QtGui/private/qhighdpiscaling_p.h>
11#include <QtGui/private/qwindow_p.h>
12#include <QtGui/qbitmap.h>
13#include <QtGui/qpalette.h>
14#include <ace/xcomponent/native_interface_xcomponent.h>
15#include <arkui/native_type.h>
16#include <functional>
17#include <memory>
18#include <qarkui/window.h>
19#include <qohosdeviceinfo_p.h>
20#include <qohosinputmethodeventhandler.h>
21#include <qohosjsmain.h>
22#include <qohosplatformbackingstore.h>
23#include <qohosplatformintegration.h>
24#include <qohosplatformscreen.h>
25#include <qohosplatformwindow.h>
26#include <qohosutils.h>
27#include <qpa/qplatformscreen.h>
28#include <qpa/qplatformtheme.h>
29#include <qpa/qwindowsysteminterface.h>
30#include <render/qnativenode.h>
31#include <render/qohoswindowproxy.h>
32#include <render/qwindowproxyregistry.h>
33#include <string>
34#include <tuple>
35#include <utility>
36#include <vector>
37
39
41
42namespace
43{
44
50
56
58 Qt::WindowModality windowModality)
59{
60 using ModalityType = QOhosWindowProxy::ModalityType;
61
62 switch (windowModality) {
63 case Qt::WindowModality::NonModal:
65 case Qt::WindowModality::WindowModal:
66 return makeQOhosOptional(ModalityType::WINDOW_MODALITY);
67 case Qt::WindowModality::ApplicationModal:
68 return makeQOhosOptional(ModalityType::APPLICATION_MODALITY);
69 }
70
71 qOhosPrintfWarning(
72 "%s: got illegal Qt::WindowModality value (%d), using the default instead",
73 Q_FUNC_INFO, static_cast<int>(windowModality));
74
76}
77
78template<typename ...SignalParams>
79std::function<void(SignalParams...)> makeViewConditionalSignalEmitter(
80 QPointer<QOhosView> viewPtr, std::function<bool(QOhosView &)> predicate, void (QOhosView::*signalFuncPtr)(SignalParams ...))
81{
82 return [signalFuncPtr, viewPtr, predicate = std::move(predicate)](SignalParams ...args) {
83 if (viewPtr && predicate(*viewPtr))
84 Q_EMIT (*viewPtr.*signalFuncPtr)(args...);
85 };
86}
87
89{
90public:
92 using AvoidAreaType = QOhosWindowProxy::AvoidAreaType;
93
94 explicit AvoidAreaCache(std::function<AvoidArea(AvoidAreaType)> avoidAreasProvider);
95
96 void put(
97 AvoidAreaType avoidAreaType,
98 const AvoidArea &avoidArea);
99
101
102private:
103 std::function<AvoidArea(AvoidAreaType)> m_avoidAreasProvider;
104 QMap<AvoidAreaType, AvoidArea> m_store;
105};
106
107AvoidAreaCache::AvoidAreaCache(std::function<AvoidArea(AvoidAreaType)> avoidAreasProvider)
109 , m_store()
110{
111}
112
114 QOhosWindowProxy::AvoidAreaType avoidAreaType, const QOhosWindowProxy::AvoidArea &avoidArea)
115{
116 m_store[avoidAreaType] = avoidArea;
117}
118
120 QOhosWindowProxy::AvoidAreaType avoidAreaType)
121{
122 if (m_store.contains(avoidAreaType))
123 return m_store.value(avoidAreaType);
124
125 auto result = m_avoidAreasProvider(avoidAreaType);
126 m_store[avoidAreaType] = result;
127 return result;
128}
129
130void tryUpdateMaximumMarginsFromAvoidArea(QMargins &marginsToUpdate, const QOhosWindowProxy::AvoidArea &avoidArea)
131{
132 if (!avoidArea.visible)
133 return;
134
135 marginsToUpdate.setTop(qMax(marginsToUpdate.top(), avoidArea.topRect.height()));
136 marginsToUpdate.setLeft(qMax(marginsToUpdate.left(), avoidArea.leftRect.width()));
137 marginsToUpdate.setRight(qMax(marginsToUpdate.right(), avoidArea.rightRect.width()));
138 marginsToUpdate.setBottom(qMax(marginsToUpdate.bottom(), avoidArea.bottomRect.height()));
139}
140
142 const QPoint &geometryOrigin, const QRect &frameGeometry)
143{
144 int topFrameMargin = qAbs(frameGeometry.top() - geometryOrigin.y());
145 int sideAndBottomFrameMargin = qAbs(frameGeometry.left() - geometryOrigin.x());
146
147 return {
148 frameGeometry.width() - 2 * sideAndBottomFrameMargin,
149 frameGeometry.height() - topFrameMargin - sideAndBottomFrameMargin
150 };
151}
152
153QSize getQSizeGrownBy(const QSize &size, const QMargins &margins)
154{
155 // HACK
156 // when the minimum window size is set to 0, the system seems to treat it as “not set” and
157 // applies its own default values instead (width: 320vp, height: 72vp).
158 // Therefore, when the intention is to set the minimum size to 0,
159 // we set it to 1 instead to avoid the system default being applied.
160 return {
161 qMax(1, size.width() + margins.left() + margins.right()),
162 qMax(1, size.height() + margins.top() + margins.bottom())};
163}
164
166{
167 auto visibleWindows = QWindowProxyRegistry::instance().queryWindowsWithVisibleSystemWindow();
168 return !visibleWindows.empty()
169 ? visibleWindows.front()
170 : nullptr;
171}
172
174{
175 auto focusedWindows = QWindowProxyRegistry::instance().queryWindowsWithSystemWindowAndFocus();
176 return !focusedWindows.empty()
177 ? focusedWindows.front()
178 : nullptr;
179}
180
182{
183 auto *focusWindow = getFirstTopLevelWindowWithSystemFocusOrNull();
184 auto *firstTopLevelWindow = getFirstTopLevelWindowOrNull();
185
186 auto isValidSyntheticParent = [&](QWindow *w) {
187 return w != nullptr && w != qWindow && w->isVisible();
188 };
189
190 return isValidSyntheticParent(focusWindow)
191 ? focusWindow
192 : isValidSyntheticParent(firstTopLevelWindow)
193 ? firstTopLevelWindow
194 : nullptr;
195}
196
198{
199 using ViewType = QOhosView::ViewType;
200
201 auto *qWindow = platformWindow->window();
202 auto *parent = qWindow->parent();
203 auto *transientParent = qWindow->transientParent();
204
205 auto windowType = qWindow->type();
206
207 QWindow *subWindowTagValue = platformWindow->validSubWindowOfTagValueOrNull();
208
209 static QSet<Qt::WindowType> fallbackToSubWindowWindowTypes{
210 Qt::Popup,
211 Qt::ToolTip,
212 Qt::Dialog,
213 Qt::Tool,
214 };
215
216 bool taggedAsMainWindow = platformWindow->mainWindowTagValueOrFalse();
217 if (taggedAsMainWindow) {
218 return ViewTypeInfo {
219 .viewType = ViewType::MainWindow,
220 .optLogicalParent = nullptr,
221 };
222 }
223
224 bool taggedAsFloatWindow = platformWindow->floatWindowTagValueOrFalse();
225 if (taggedAsFloatWindow) {
226 return ViewTypeInfo {
227 .viewType = ViewType::FloatWindow,
228 .optLogicalParent = nullptr,
229 };
230 }
231
232 bool overrideAsSubWindow = subWindowTagValue != nullptr;
233 if (overrideAsSubWindow) {
234 return ViewTypeInfo {
235 .viewType = ViewType::SubWindow,
236 .optLogicalParent = subWindowTagValue,
237 };
238 }
239
240 if (parent != nullptr) {
241 return ViewTypeInfo {
242 .viewType = ViewType::EmbeddedWindow,
243 .optLogicalParent = parent,
244 };
245 }
246
247 if (transientParent != nullptr) {
248 return ViewTypeInfo {
249 .viewType = ViewType::SubWindow,
250 .optLogicalParent = transientParent,
251 };
252 }
253
254 auto *syntheticParent = syntheticParentForQWindowOrNull(platformWindow->window());
255
256 bool automaticOverrideActive =
257 fallbackToSubWindowWindowTypes.contains(windowType)
258 && syntheticParent != nullptr;
259 if (automaticOverrideActive) {
260 return ViewTypeInfo {
261 .viewType = ViewType::SubWindow,
262 .optLogicalParent = syntheticParent,
263 };
264 }
265
266 return ViewTypeInfo {
267 .viewType = ViewType::MainWindow,
268 .optLogicalParent = nullptr,
269 };
270}
271
272QBitmap getCursorBitmap(const QCursor &cursor)
273{
274 return cursor.bitmap();
275}
276
277QBitmap getCursorMask(const QCursor &cursor)
278{
279 return cursor.mask();
280}
281
282QImage createImageFromBitmapAndMask(const QBitmap &bitmap, const QBitmap &mask)
283{
284 const auto maskTransparentColor = QColor(Qt::color0).rgba();
285 const auto transparentColor = QColor(Qt::transparent).rgba();
286
287 QImage image = bitmap.toImage().convertToFormat(QImage::Format_RGBA8888);
288 QImage maskImage = mask.toImage().convertToFormat(QImage::Format_RGB32);
289
290 for (int row = 0; row < image.height(); ++row) {
291 auto *imageData = reinterpret_cast<QRgb *>(image.scanLine(row));
292 auto *maskData = reinterpret_cast<QRgb *>(maskImage.scanLine(row));
293 for (int col = 0; col < image.width(); ++col) {
294 if (maskData[col] == maskTransparentColor)
295 imageData[col] = transparentColor;
296 }
297 }
298
299 return image;
300}
301
303{
304 QBitmap cursorPixels(cursorSize);
305 cursorPixels.fill(Qt::transparent);
306 QBitmap cursorMask(cursorSize);
307 cursorMask.fill(Qt::color0);
308 return QCursor(cursorPixels, cursorMask);
309}
310
311ViewGeometryPersistencePolicy determineViewGeometryPersistencePolicy()
312{
313 using WindowGeometryPersistencePolicy = QOhosPlatformIntegration::WindowGeometryPersistencePolicy;
314
315 auto viewGeometryPersistencePolicy = ViewGeometryPersistencePolicy::Ignore;
316
318 switch (policy) {
319 case WindowGeometryPersistencePolicy::Disabled:
320 viewGeometryPersistencePolicy = ViewGeometryPersistencePolicy::Disabled;
321 break;
322 case WindowGeometryPersistencePolicy::Enabled:
323 viewGeometryPersistencePolicy = ViewGeometryPersistencePolicy::Enabled;
324 break;
325 case WindowGeometryPersistencePolicy::FollowSystemSetting:
326 viewGeometryPersistencePolicy = ViewGeometryPersistencePolicy::FollowSystemSetting;
327 break;
328 }
329
330 return viewGeometryPersistencePolicy;
331}
332
334{
335 using WindowGeometryPersistencePolicy = QOhosPlatformIntegration::WindowGeometryPersistencePolicy;
336
337 bool geometryPersistenceEnabled = false;
339 switch (policy) {
340 case WindowGeometryPersistencePolicy::Disabled:
341 windowProxy->setWindowRectAutoSave(false);
342 break;
343 case WindowGeometryPersistencePolicy::Enabled:
344 windowProxy->setWindowRectAutoSave(true);
345 geometryPersistenceEnabled = windowProxy->isWindowRectAutoSave();
346 break;
347 case WindowGeometryPersistencePolicy::FollowSystemSetting:
348 geometryPersistenceEnabled = windowProxy->isWindowRectAutoSave();
349 break;
350 }
351
352 return geometryPersistenceEnabled
355}
356
358 QWindow *logicalParent, QOhosWindowProxy &windowProxy)
359{
360 auto *screen = logicalParent->screen();
361 auto *ohosPlatformScreen = screen != nullptr
362 ? static_cast<QOhosPlatformScreen *>(screen->handle())
363 : nullptr;
364
365 return ohosPlatformScreen != nullptr
366 ? makeQOhosOptional(ohosPlatformScreen->displayInfo().id)
367 : windowProxy.tryGetMainWindowJsDisplayId();
368}
369
371{
372 if (window != nullptr) {
373 QWindowPrivate *windowPrivate = qt_window_private(window);
374 QPalette palette = windowPrivate->windowPalette();
375 QColor backgroundColor = palette.color(QPalette::Window);
376 return makeQOhosOptional(backgroundColor);
377 }
379}
380
381}
382
384{
385 auto optPostSurfaceDrawTask = std::exchange(m_optPostSurfaceDrawTask, {});
386 if (optPostSurfaceDrawTask)
387 optPostSurfaceDrawTask();
388}
389
390std::shared_ptr<QOhosWindowProxy> QOhosView::tryCreateWindowProxyIfNeeded(ViewType viewType, QWindow *optLogicalParent)
391{
392 QWindow *qWindow = m_ownerWindow;
393 QOhosPlatformWindow *window = QOhosPlatformWindow::fromQWindow(qWindow);
394
395 std::shared_ptr<QOhosWindowProxy> result;
396
397 switch (viewType) {
398 case ViewType::MainWindow:
399 {
400 // NOTE: treat windows automatically-created by the platform in a special way
402 if (useAutoStartedMainWindow) {
403 QOhosWindowProxy::ExistingMainWindowCreateInfo createInfo;
404 createInfo.qWindowRef = QtOhos::QObjectThreadSafeRef(qWindow);
405 createInfo.qAbilityInstanceId = QtOhos::evalInJsThread([](QtOhos::JsState &jsState) {
406 return jsState.defaultQAbilityPeer()->instanceId();
407 },
408 Q_FUNC_INFO);
409 result = QOhosWindowProxy::createForExistingMainWindow(createInfo);
410 m_geometryPersistencePolicy = determineViewGeometryPersistencePolicy();
411 } else {
412 QOhosWindowProxy::MainWindowCreateInfo createInfo;
413 createInfo.qWindowRef = QtOhos::QObjectThreadSafeRef(qWindow);
414 createInfo.windowId = window->internalWindowId();
415 createInfo.windowTitle = qWindow->title().toStdString();
416 createInfo.frameGeometry = window->lastRequestedWindowFrameGeometry();
417 createInfo.fullscreen = qWindow->windowState() == Qt::WindowFullScreen;
418 result = QOhosWindowProxy::createMainWindow(createInfo);
419 }
420
421 break;
422 }
423 case ViewType::SubWindow:
424 {
425 auto *targetWindowToBeSubWindowOf = optLogicalParent;
426
427 if (Q_UNLIKELY(targetWindowToBeSubWindowOf == nullptr))
428 qOhosReportFatalErrorAndAbort("Failed to determine valid parent of a SubWindow");
429
430 if (!targetWindowToBeSubWindowOf->isVisible()) {
431 auto *targetParentPlatformWindow = QOhosPlatformWindow::fromQWindowOrNull(targetWindowToBeSubWindowOf);
432 if (targetParentPlatformWindow != nullptr)
433 targetParentPlatformWindow->setVisible(true);
434 else
435 targetWindowToBeSubWindowOf->show();
436 }
437
438 auto *targetWindowToBeSubWindowOfView =
439 QOhosPlatformWindow::fromQWindow(targetWindowToBeSubWindowOf)->ownedViewOrNull();
440
441 const QOhosView *firstViewWithWindow = nullptr;
442 switch (targetWindowToBeSubWindowOfView->viewType()) {
443 case ViewType::MainWindow:
444 case ViewType::SubWindow:
445 case ViewType::FloatWindow:
446 firstViewWithWindow = targetWindowToBeSubWindowOfView;
447 break;
448 case ViewType::EmbeddedWindow:
449 firstViewWithWindow = ancestorViewWithWindowOrNull();
450 break;
451 }
452
453 if (firstViewWithWindow == nullptr)
454 qOhosReportFatalErrorAndAbort("Failed to determine valid parent for this window.");
455
456 auto parentWindowProxy = firstViewWithWindow->m_ohosWindowProxy;
457 if (Q_UNLIKELY(!parentWindowProxy)) {
458 qOhosReportFatalErrorAndAbort(
459 "parentWindowProxy is null but should not be. This is most likely a programming error");
460 }
461
462 QOhosWindowProxy::SubWindowCreateInfo createInfo;
463 createInfo.windowTitle = qWindow->title().toStdString();
464 createInfo.windowId = window->internalWindowId();
465 createInfo.qAbilityInstanceId = parentWindowProxy->qAbilityInstanceId();
466
468 createInfo.disableWindowFocusableBeforeLoadContentHack = window->windowFlags().testFlag(Qt::WindowDoesNotAcceptFocus);
469 createInfo.modal = qWindow->modality() != Qt::NonModal;
470 createInfo.windowRect = window->lastRequestedWindowFrameGeometry();
471 result = parentWindowProxy->createSubWindow(createInfo);
472
473 break;
474 }
475 case ViewType::EmbeddedWindow:
476 {
477 // NOTE - NativeNode is now always created during view instantiation
478 break;
479 }
480 case ViewType::FloatWindow:
481 {
482 QOhosWindowProxy::FloatWindowCreateInfo createInfo = {
483 .qWindowRef = QtOhos::QObjectThreadSafeRef(qWindow),
484 .internalWindowId = window->internalWindowId(),
485 };
486 result = QOhosWindowProxy::createFloatWindow(createInfo);
487 break;
488 }
489 default:
490 qOhosReportFatalErrorAndAbort("Unsupported view type: %d", viewType);
491
492 }
493
494 if (result != nullptr) {
495 auto viewPtr = QPointer<QOhosView>(this);
496 std::weak_ptr<QOhosWindowProxy> weakWindowProxy = result;
497 auto shouldEmitSignalPredicate = [weakWindowProxy](QOhosView &view) {
498 auto windowProxy = weakWindowProxy.lock();
499 return windowProxy != nullptr && windowProxy.get() == view.m_ohosWindowProxy.get();
500 };
501
502 result->setWindowCallbackReceiver(
503 std::make_unique<QOhosWindowProxy::WindowCallbacks>(
504 QOhosWindowProxy::WindowCallbacks {
505 .onWindowEvent = makeViewConditionalSignalEmitter(viewPtr, shouldEmitSignalPredicate, &QOhosView::windowEvent),
506 .onWindowStatusChange = makeViewConditionalSignalEmitter(viewPtr, shouldEmitSignalPredicate, &QOhosView::windowStatusChange),
507 .onWindowVisibilityChange = makeViewConditionalSignalEmitter(viewPtr, shouldEmitSignalPredicate, &QOhosView::windowVisibilityChange),
508 .onTouchOutside = makeViewConditionalSignalEmitter(viewPtr, shouldEmitSignalPredicate, &QOhosView::windowTouchOutside),
509 .onAvoidAreaChange = makeViewConditionalSignalEmitter(viewPtr, shouldEmitSignalPredicate, &QOhosView::avoidAreaChanged),
510 .onWindowRectChange = makeViewConditionalSignalEmitter(viewPtr, shouldEmitSignalPredicate, &QOhosView::windowRectChanged),
511 .onWindowRectChangeInGlobalDisplay = makeViewConditionalSignalEmitter(
512 viewPtr, shouldEmitSignalPredicate, &QOhosView::windowRectChangedInGlobalDisplay),
513 .onWindowDisplayIdChange = makeViewConditionalSignalEmitter(viewPtr, shouldEmitSignalPredicate, &QOhosView::windowDisplayIdChanged),
514 }));
515
516 result->setNonClientAreaMouseWindowCallbackReceiver(
517 this,
518 [viewPtr, shouldEmitSignalPredicate](std::vector<QOhosWindowProxy::NonClientAreaMouseEvent> &&batch) {
519 if (!viewPtr.isNull() && shouldEmitSignalPredicate(*viewPtr)) {
521 inputEventHandler->onNonClientAreaMouseEvents(viewPtr->m_ownerWindow, std::move(batch));
522 }
523 });
524
525 result->setNonClientAreaTouchWindowCallbackReceiver(
526 this,
527 [viewPtr, shouldEmitSignalPredicate](std::vector<QOhosWindowProxy::NonClientAreaTouchEvent> &&batch) {
528 if (!viewPtr.isNull() && shouldEmitSignalPredicate(*viewPtr)) {
530 inputEventHandler->onNonClientAreaTouchEvents(viewPtr->m_ownerWindow, std::move(batch));
531 }
532 });
533
534 if (result->qtIsMainWindow() && result->isFocused().value_or(false)) {
535 // HACK
536 // WINDOW_ACTIVE event should be handled by QOhosFloatingWindow after OHOS system event received.
537 // Until we cannot register this event properly, keep sending it manually here.
538 sendAsyncSyntheticWindowActiveEvent();
539 }
540 }
541
542 return result;
543}
544
545bool QOhosView::isWindowTransparencyRequested() const
546{
547 return m_ownerWindow->requestedFormat().hasAlpha();
548}
549
550QOhosView::QOhosView(QWindow *ownerWindow, QSharedPointer<QNativeNode> nativeNode, QOhosPropertiesProvider windowPropertyProvider)
551 : m_windowPropertiesProvider(windowPropertyProvider)
555 , m_updateData()
556 , m_updatePending(false)
558 , m_requireHandheldDeviceSupport(isHandheldDeviceType())
561{
562 auto avoidAreasProvider = std::make_shared<AvoidAreaCache>([this](AvoidAreaCache::AvoidAreaType avoidAreaType) {
563 return m_ohosWindowProxy != nullptr
564 ? m_ohosWindowProxy->getWindowAvoidArea(avoidAreaType)
565 : AvoidAreaCache::AvoidArea{};
566 });
567
568 connect(
569 this, &QOhosView::avoidAreaChanged,
570 this,
571 [avoidAreasProvider](QOhosWindowProxy::AvoidAreaType avoidAreaType, const QOhosWindowProxy::AvoidArea &avoidArea) {
572 avoidAreasProvider->put(avoidAreaType, avoidArea);
573 });
574
575 m_avoidAreasProvider = [avoidAreasProvider](QOhosWindowProxy::AvoidAreaType type) {
576 return avoidAreasProvider->getStoredOrRetrieveFromWindowProxy(type);
577 };
578
579 connect(
580 m_nativeNode.get(), &QNativeNode::surfaceStatusChanged,
581 this, [this](const QOhosOptional<QSize> &optSurfaceSize) {
582 Q_EMIT surfaceStatusChanged(optSurfaceSize);
583 });
584
585 connect(
588
589 m_nativeNode->setNodeAreaChangeHandler(
590 [this](auto nodeAreaChangeEvent) {
591 Q_EMIT nodeAreaChanged(nodeAreaChangeEvent);
592 });
593
594 m_nativeNode->setNodeVisibilityChangeHandler(
595 [this](bool visible) {
596 if (viewType() == QOhosView::ViewType::EmbeddedWindow)
597 Q_EMIT windowVisibilityChange(visible);
598 });
599
600 std::vector<std::shared_ptr<void>> writeCallbacks = {
601 m_windowPropertiesProvider.addPropertyWriteCallback<double, &QOhosPlatformWindow::windowCornerRadiusProperty>(
602 [this](double windowCornerRadius) {
603 setWindowCornerRadius(windowCornerRadius);
604 }),
605 m_windowPropertiesProvider.addPropertyWriteCallback<bool, &QOhosPlatformWindow::windowPrivacyModeSettingProperty>(
606 [this](bool windowPrivacyModeSetting) {
607 setPrivacyMode(windowPrivacyModeSetting);
608 }),
609 m_windowPropertiesProvider.addPropertyWriteCallback<QColor, &QOhosPlatformWindow::surfaceBackgroundColorProperty>(
610 [this](QColor surfaceBackgroundColor) {
611 setBackgroundColor(surfaceBackgroundColor);
612 }),
613 m_windowPropertiesProvider.addPropertyWriteCallback<bool, &QOhosPlatformWindow::windowKeepScreenOnProperty>(
614 [this](bool keepScreenOn) {
615 setWindowKeepScreenOn(keepScreenOn);
616 }),
617 m_windowPropertiesProvider.addPropertyWriteCallback<bool, &QOhosPlatformWindow::windowFixedSizeStateProperty>(
618 [this](bool fixedSizeStateEnabled) {
619 setFixedSizeStateEnabled(fixedSizeStateEnabled);
620 }),
621 m_windowPropertiesProvider.addPropertyWriteCallback<int, &QOhosPlatformWindow::windowBrightnessProperty>(
622 [this](int brightness) {
623 setBrightness(brightness);
624 }),
625 m_windowPropertiesProvider.addPropertyWriteCallback<int, &QOhosPlatformWindow::windowContrastProperty>(
626 [this](int contrast) {
627 setContrast(contrast);
628 }),
629 m_windowPropertiesProvider.addPropertyWriteCallback<int, &QOhosPlatformWindow::windowSaturationProperty>(
630 [this](int saturation) {
631 setSaturation(saturation);
632 }),
633 m_windowPropertiesProvider.addPropertyWriteCallback<bool, &QOhosPlatformWindow::windowDragResizableProperty>(
634 [this](bool dragResizable) {
635 setWindowDragResizable(dragResizable);
636 }),
637 };
638
639 m_windowPropertiesProviderCallbacksHandle = QtOhos::moveToSharedPtr(std::move(writeCallbacks));
640}
641
643{
644 // This call is necessary in order to avoid receiving callbacks
645 // from the underlying XComponent after we terminate the window.
646 // Not having this resulted in exceptions thrown from the system
647 // because QOhosNativeXComponent reffered to the window object that is null.
648 m_nativeNode.reset();
649}
650
651void QOhosView::setPosition(const QPoint &position)
652{
653 setSystemUpdateProperty(&SystemUpdateData::position, {position, {}});
654}
655
657 const QPoint &position, QOhosDisplayInfo::JsDisplayId jsDisplayId)
658{
659 setSystemUpdateProperty(&SystemUpdateData::position, {position, makeQOhosOptional(jsDisplayId)});
660 flushSystemPropertyUpdatesImmediate();
661}
662
663void QOhosView::setSize(const QSize &size)
664{
665 setSystemUpdateProperty(&SystemUpdateData::size, size);
666}
667
668void QOhosView::setSizeLimits(const QSize &minSize, const QSize &maxSize)
669{
670 setSystemUpdateProperty(&SystemUpdateData::sizeLimits, std::make_pair(minSize, maxSize));
671}
672
673void QOhosView::setTransparentBackground(bool transparent)
674{
675 setSystemUpdateProperty(&SystemUpdateData::backgroundTransparent, transparent);
676}
677
678void QOhosView::setFocusable(bool focusable)
679{
680 setSystemUpdateProperty(&SystemUpdateData::focusable, focusable);
681}
682
683void QOhosView::setBackgroundColor(const QColor &color)
684{
685 setSystemUpdateProperty(&SystemUpdateData::backgroundColor, color);
686}
687
688void QOhosView::setBrightness(int brightness)
689{
690 setSystemUpdateProperty(&SystemUpdateData::brightness, brightness);
691}
692
693void QOhosView::setContrast(int contrast)
694{
695 setSystemUpdateProperty(&SystemUpdateData::contrast, contrast);
696}
697
698void QOhosView::setSaturation(int saturation)
699{
700 setSystemUpdateProperty(&SystemUpdateData::saturation, saturation);
701}
702
703void QOhosView::setWindowKeepScreenOn(bool keepScreenOn)
704{
705 if (m_ohosWindowProxy != nullptr)
706 m_ohosWindowProxy->setWindowKeepScreenOn(keepScreenOn);
707}
708
709void QOhosView::setFixedSizeStateEnabled(bool enabled)
710{
711 if (viewType() != ViewType::MainWindow)
712 return;
713
715 qOhosPrintfWarning(
716 "%s: fixed size state is not supported while in HandheldDeviceFullScreen mode",
717 Q_FUNC_INFO);
718 return;
719 }
720
721 using SupportWindowMode = QOhosWindowProxy::SupportWindowMode;
722 const auto supportedWindowModes = enabled
723 ? std::set<SupportWindowMode>({SupportWindowMode::FLOATING})
724 : std::set<SupportWindowMode>({SupportWindowMode::FULL_SCREEN, SupportWindowMode::FLOATING, SupportWindowMode::SPLIT});
725
726 m_ohosWindowProxy->setSupportedWindowModes(supportedWindowModes);
727}
728
729void QOhosView::showWindow()
730{
731 auto *ohosPlatformWindow = static_cast<QOhosPlatformWindow *>(m_ownerWindow->handle());
732 m_ohosWindowProxy->showWindow(
733 QOhosWindowProxy::ShowWindowOptions{
734 .focusOnShow = ohosPlatformWindow->shouldShowWindowWithoutActivating()
735 ? makeQOhosOptional(false)
736 : makeEmptyQOhosOptional(),
737 });
738}
739
740void QOhosView::sendAsyncSyntheticWindowActiveEvent()
741{
742 QMetaObject::invokeMethod(
743 this,
744 [this]() {
745 QOhosWindowProxy::WindowEvent syntheticWindowActiveEvent = {
746 .type = QOhosWindowProxy::WindowEventType::WINDOW_ACTIVE,
747 };
748 Q_EMIT windowEvent(syntheticWindowActiveEvent);
749 },
750 Qt::QueuedConnection);
751}
752
753void QOhosView::setCursor(const QCursor &cursor)
754{
755 setSystemUpdateProperty(&SystemUpdateData::cursor, cursor);
756}
757
758void QOhosView::setModality(Qt::WindowModality modality)
759{
760 setSystemUpdateProperty(&SystemUpdateData::modality, modality);
761}
762
763void QOhosView::setTitle(const QString &title)
764{
765 setSystemUpdateProperty(&SystemUpdateData::title, title);
766}
767
769{
770 switch (viewType()) {
771 case ViewType::MainWindow:
772 showWindow();
773 break;
774 case ViewType::SubWindow:
775 m_ohosWindowProxy->raiseToAppTop();
776 break;
777 case ViewType::FloatWindow:
778 break;
779 case ViewType::EmbeddedWindow:
780 m_nativeNode->raise();
781 break;
782 }
783}
784
786{
787 if (m_ohosWindowProxy != nullptr && m_ownerWindow->isVisible())
788 showWindow();
789 else
790 m_nativeNode->lower();
791}
792
793void QOhosView::updateWindowSize(const QSize &size)
794{
795 if (m_ohosWindowProxy != nullptr)
796 m_ohosWindowProxy->setSize(size);
797 else
798 m_nativeNode->setSize(size);
799}
800
801void QOhosView::updateWindowPosition(const std::pair<QPoint, QOhosOptional<QOhosDisplayInfo::JsDisplayId>> &positionProp)
802{
803 QPoint position;
804 QOhosOptional<QOhosDisplayInfo::JsDisplayId> displayId;
805 std::tie(position, displayId) = positionProp;
806
807 if (m_ohosWindowProxy != nullptr) {
808 m_ohosWindowProxy->moveWindowToGlobalOrGlobalDisplay(position, displayId);
809 } else {
810 m_nativeNode->setPosition(position);
811 }
812}
813
814void QOhosView::updateWindowBackgroundTransparency(bool transparent)
815{
816 if (m_ohosWindowProxy != nullptr) {
817 auto opaqueSystemBackgroundRgb = QGuiApplicationPrivate::platformTheme()
818 ->palette(QPlatformTheme::SystemPalette)
819 ->window()
820 .color()
821 .rgb();
822 m_ohosWindowProxy->setWindowBackgroundColor(
823 transparent
824 ? QColor(Qt::transparent)
825 : tryGetBackgroundColorFromWindow(m_ownerWindow).value_or(
826 QColor(opaqueSystemBackgroundRgb)));
827 }
828}
829
830void QOhosView::updateWindowCursor(const QCursor &cursor)
831{
832 if (m_ohosWindowProxy == nullptr)
833 return;
834
835 if (cursor.shape() == Qt::BitmapCursor || cursor.shape() == Qt::BlankCursor) {
836 auto bitmapCursor =
837 cursor.shape() == Qt::BlankCursor
838 ? makeTransparentBitmapCursor({1, 1})
839 : cursor;
840
841 QImage bitmapCursorImage = bitmapCursor.pixmap().isNull()
842 ? createImageFromBitmapAndMask(getCursorBitmap(bitmapCursor), getCursorMask(bitmapCursor))
843 : bitmapCursor.pixmap().toImage();
844
845 m_ohosWindowProxy->setCustomCursor(bitmapCursorImage, bitmapCursor.hotSpot());
846 } else {
847 m_ohosWindowProxy->setPointerStyleSync(cursor);
848 }
849}
850
851void QOhosView::updateWindowFocusable(bool focusable)
852{
853 if (m_ohosWindowProxy != nullptr)
854 m_ohosWindowProxy->setWindowFocusable(focusable);
855 m_nativeNode->setFocusable(focusable);
856}
857
858void QOhosView::updateWindowBackgroundColor(const QColor &color)
859{
860 m_nativeNode->setBackgroundColor(color);
861}
862
863void QOhosView::updateWindowBrightness(int brightness)
864{
865 m_nativeNode->setBrightness(brightness);
866}
867
868void QOhosView::updateWindowContrast(int contrast)
869{
870 m_nativeNode->setContrast(contrast);
871}
872
873void QOhosView::updateWindowSaturation(int saturation)
874{
875 m_nativeNode->setSaturation(saturation);
876}
877
878void QOhosView::updateWindowTransparentForInput(bool transparentForInput)
879{
880 if (m_ohosWindowProxy != nullptr)
881 m_ohosWindowProxy->setWindowTouchable(!transparentForInput);
882 m_nativeNode->setTransparentForInput(transparentForInput);
883}
884
885void QOhosView::updateWindowSizeLimits(const std::pair<QSize, QSize> &sizeLimits)
886{
887 if (m_ohosWindowProxy != nullptr) {
888 auto windowMargins = QOhosPlatformWindow::fromQWindow(m_ownerWindow)->frameMargins();
889 m_ohosWindowProxy->setWindowLimits(
890 getQSizeGrownBy(sizeLimits.first, windowMargins),
891 getQSizeGrownBy(sizeLimits.second, windowMargins));
892 }
893}
894
895void QOhosView::updateWindowModality(Qt::WindowModality modality)
896{
897 if (m_ohosWindowProxy != nullptr) {
898 if (viewType() != ViewType::SubWindow) {
899 qCWarning(QtForOhos, "%s: Modality is supported only for sub-windows.", Q_FUNC_INFO);
900 return;
901 }
902 if (modality == Qt::WindowModality::ApplicationModal) {
903 qCWarning(
904 QtForOhos,
905 "%s: Qt::ApplicationModal policy is unsupported by the platform. The window will behave like Qt::WindowModal.",
906 Q_FUNC_INFO);
907 }
908
909 auto ohosModalityType = mapQtWindowModalityToOhosOrDefault(modality);
910 if (ohosModalityType.has_value())
911 m_ohosWindowProxy->setSubWindowModalEnabled(ohosModalityType.value());
912 else
913 m_ohosWindowProxy->setSubWindowModalDisabled();
914 }
915}
916
917void QOhosView::updateWindowTitle(const QString &title)
918{
919 if (m_ohosWindowProxy != nullptr)
920 m_ohosWindowProxy->setTitle(title);
921}
922
923void QOhosView::scheduleSystemUpdateIfNeeded()
924{
925 if (m_updatePending)
926 return;
927 m_updatePending = QMetaObject::invokeMethod(
928 this,
929 [this]() {
930 flushSystemPropertyUpdatesImmediate();
931 },
932 Qt::QueuedConnection);
933}
934
936{
937 return m_ownerWindow;
938}
939
941{
942 auto *platformWindow = QOhosPlatformWindow::fromQWindow(m_ownerWindow);
943
944 auto currentViewTypeInfo = determineViewTypeAndLogicalParent(platformWindow);
945 bool viewTypeChanged = viewType() != currentViewTypeInfo.viewType;
946
947 if (viewTypeChanged) {
948 auto qOhosWindowProxy = tryCreateWindowProxyIfNeeded(currentViewTypeInfo.viewType, currentViewTypeInfo.optLogicalParent);
949
950 if (qOhosWindowProxy != nullptr
951 && currentViewTypeInfo.viewType == ViewType::SubWindow) {
952 constexpr bool preventSubWindowClose = true;
953 qOhosWindowProxy->setSubWindowCloseHandler(
954 [this]() {
955 if (!m_ownerWindow.isNull()) {
956 qOhosPrintfDebug("onSubWindowCloseHandler: calling close()");
957 QOhosCloseEventContext::runWithCloseRootCauseSet(
958 QOhosCloseEventContext::CloseRootCause::SubWindowClose,
959 [&]() {
960 m_ownerWindow->close();
961 });
962 }
963 },
964 preventSubWindowClose);
965 }
966
967 if (qOhosWindowProxy != nullptr) {
968 m_nativeNode->setParent(qOhosWindowProxy->nodeXComponent());
969 m_nativeNode->fillToParent();
970 }
971
972 setOrResetWindowProxy(qOhosWindowProxy, currentViewTypeInfo.optLogicalParent);
973 } else {
974 syncWindowStateImmediate();
975 }
976
977 if (viewType() == ViewType::MainWindow) {
978 const auto windowStates = m_ownerWindow->windowStates();
979 if (windowStates.testFlag(Qt::WindowState::WindowFullScreen)) {
980 // A phone window created fullscreen still shows the system bars, so
981 // hide them explicitly. On 2-in-1/tablet the window is already
982 // immersive at creation; re-applying would only make it twitch.
983 if (!viewTypeChanged || QOhosDeviceInfo::isPhone())
985 } else if (windowStates.testFlag(Qt::WindowState::WindowMaximized)) {
987 } else if (QOhosDeviceInfo::isPhone()
988 && m_ownerWindow->flags().testFlag(Qt::ExpandedClientAreaHint)) {
989 applyPhoneWindowChrome();
990 }
991 } else if (viewType() == ViewType::SubWindow && m_ohosWindowProxy != nullptr) {
992 m_ohosWindowProxy->setFollowParentMultiScreenPolicy(true);
993 }
994
995 if (m_ohosWindowProxy != nullptr) {
997 showWindow();
998 }
999
1000 auto *surface = surfaceOrNull();
1001 if (surface != nullptr)
1003
1004 m_nativeNode->setVisibility(true);
1005}
1006
1007void QOhosView::applyPhoneWindowChrome()
1008{
1009 if (m_ohosWindowProxy == nullptr)
1010 return;
1011
1012 // Lay the window out under the system bars when fullscreen or when the
1013 // client area is expanded; only fullscreen also hides the bars.
1014 const bool fullScreen = m_ownerWindow->windowStates().testFlag(Qt::WindowFullScreen);
1015 const bool expanded = m_ownerWindow->flags().testFlag(Qt::ExpandedClientAreaHint);
1016 m_ohosWindowProxy->setWindowLayoutFullScreen(fullScreen || expanded);
1017 m_ohosWindowProxy->setWindowSystemBarEnable(
1018 fullScreen ? QStringList{}
1019 : QStringList{ QStringLiteral("status"), QStringLiteral("navigation") });
1020}
1021
1023{
1024 if (m_ohosWindowProxy == nullptr)
1025 return;
1026
1028 m_ohosWindowProxy->maximize(QOhosWindowProxy::MaximizePresentation::ENTER_IMMERSIVE);
1029 else
1030 applyPhoneWindowChrome();
1031}
1032
1034{
1035 if (m_ohosWindowProxy == nullptr)
1036 return;
1037
1039 m_ohosWindowProxy->recover();
1040 else
1041 applyPhoneWindowChrome();
1042}
1043
1045{
1046 if (m_ohosWindowProxy != nullptr)
1047 m_ohosWindowProxy->minimize();
1048}
1049
1051{
1052 if (m_ohosWindowProxy != nullptr) {
1053 if (QGuiApplicationPrivate::focus_window) {
1054 const auto *focusPlatformWindow = QOhosPlatformWindow::fromQWindow(QGuiApplicationPrivate::focus_window);
1055 const auto *focusView = focusPlatformWindow->ownedViewOrNull();
1056 if (focusView && focusView != this) {
1057 if (focusView->m_ohosWindowProxy) {
1058 focusView->m_ohosWindowProxy->shiftAppWindowFocus(*m_ohosWindowProxy);
1059 } else {
1060 // If the previously focused window is an EmbeddedWindow.
1061 sendAsyncSyntheticWindowActiveEvent();
1062 }
1063 }
1064 }
1065 } else {
1066 // for EmbeddedWindow
1067 sendAsyncSyntheticWindowActiveEvent();
1068 }
1069}
1070
1072{
1073 if (m_ohosWindowProxy != nullptr)
1074 m_ohosWindowProxy->maximize(QOhosWindowProxy::MaximizePresentation::EXIT_IMMERSIVE);
1075}
1076
1077std::unique_ptr<QOhosView> QOhosView::createForWindow(QOhosPlatformWindow *window, QOhosPropertiesProvider windowPropertiesProvider)
1078{
1079 auto *qWindow = window->window();
1080 QNativeNode::CreateInfo createInfo;
1081 createInfo.geometry = window->geometry();
1082 createInfo.window = qWindow;
1083 createInfo.backgroundColor = windowPropertiesProvider.tryGetProperty<QColor, &QOhosPlatformWindow::surfaceBackgroundColorProperty>();
1084 createInfo.renderFitPolicyHint =
1085 windowPropertiesProvider.tryGetProperty<QOhosPlatformWindow::NativeNodeRenderFitPolicy, &QOhosPlatformWindow::nativeNodeRenderFitPolicyHintProperty>();
1086
1087 QPlatformWindow *parentPlatformWindow = window->parent();
1088
1089 if (parentPlatformWindow != nullptr) {
1090 auto *parentPlatformWindow = static_cast<QOhosPlatformWindow *>(window->parent());
1091 auto *parentView = parentPlatformWindow->ownedViewOrNull();
1092 createInfo.optParent = parentView != nullptr
1093 ? makeQOhosOptional(parentView->m_nativeNode.get())
1095 }
1096
1097 auto nativeNode = QSharedPointer<QNativeNode>::create(createInfo);
1098 return std::make_unique<QOhosView>(qWindow, nativeNode, windowPropertiesProvider);
1099}
1100
1102{
1103 QOhosView::ViewGeometry result;
1104 if (m_ohosWindowProxy != nullptr) {
1105 auto windowProperties = m_ohosWindowProxy->getWindowProperties();
1106 result.frameGeometry = windowProperties.windowRect;
1107 // Translate relative coordinates of the window to absolute screen values
1108 result.geometry = windowProperties.drawableRect.translated(windowProperties.windowRect.topLeft());
1109 // HACK:
1110 // "result.geometry" might contain invalid size but (1) it will likely contain proper
1111 // top-left corner coords and (2) "result.frameGeometry" is also valid, so adjust the
1112 // invalidated size based on these two.
1113 result.geometry.setSize(
1114 evaluateGeometrySizeBasedOnFrameGeometry(result.geometry.topLeft(), result.frameGeometry));
1115 result.displayId = windowProperties.displayId;
1116 } else {
1117 result.frameGeometry = m_nativeNode->geometry().toRect();
1118 result.geometry = result.frameGeometry;
1119
1120 const auto *ancestorViewWithWindow = ancestorViewWithWindowOrNull();
1121 result.displayId = ancestorViewWithWindow != nullptr
1122 ? ancestorViewWithWindow->m_ohosWindowProxy->getWindowProperties().displayId
1124 }
1125
1126 return result;
1127}
1128
1129QMargins QOhosView::avoidAreaMargins(QOhosWindowProxy::AvoidAreaType type) const
1130{
1131 auto avoidArea = m_avoidAreasProvider(type);
1132 QMargins margins;
1133 tryUpdateMaximumMarginsFromAvoidArea(margins, avoidArea);
1134 return margins;
1135}
1136
1138{
1139 if (!m_ohosWindowProxy)
1140 return ViewType::EmbeddedWindow;
1141
1142 switch (m_ohosWindowProxy->windowProxyType()) {
1143 case WindowProxyType::FloatWindow:
1144 return ViewType::FloatWindow;
1145 case WindowProxyType::MainWindow:
1146 return ViewType::MainWindow;
1147 case WindowProxyType::SubWindow:
1148 return ViewType::SubWindow;
1149 }
1150
1151 qOhosReportFatalErrorAndAbort("Unrecognized WindowProxyType: %d", static_cast<int>(m_ohosWindowProxy->windowProxyType()));
1152}
1153
1155{
1156 auto *platformWindow = QOhosPlatformWindow::fromQWindow(m_ownerWindow);
1157 auto targetWindowGeometry = platformWindow->geometry().marginsAdded(platformWindow->frameMargins());
1158
1159 m_updateData.position.optPendingUpdateRequest = {targetWindowGeometry.topLeft(), {}};
1160 m_updateData.size.optPendingUpdateRequest = targetWindowGeometry.size();
1161 scheduleSystemUpdateIfNeeded();
1162}
1163
1165{
1166 switch (viewType()) {
1167 case ViewType::MainWindow:
1168 hideMainWindow();
1169 break;
1170 case ViewType::FloatWindow:
1171 case ViewType::SubWindow:
1172 {
1173 setOrResetWindowProxy(nullptr, nullptr);
1174 auto syntheticWindowHiddenEvent = QOhosWindowProxy::WindowEvent {
1175 .type = QOhosWindowProxy::WindowEventType::WINDOW_HIDDEN,
1176 };
1177 Q_EMIT windowEvent(syntheticWindowHiddenEvent);
1178 break;
1179 }
1180 case ViewType::EmbeddedWindow:
1181 Q_EMIT windowVisibilityChange(false);
1182 break;
1183 }
1184
1185 m_nativeNode->setVisibility(false);
1186}
1187
1189{
1190 setTransparentBackground(isWindowTransparencyRequested());
1191}
1192
1193void QOhosView::setWindowMask(const QOhosWindowProxy::WindowMask &mask)
1194{
1195 if (m_ohosWindowProxy != nullptr)
1196 m_ohosWindowProxy->setWindowMask(mask);
1197}
1198
1199QOhosSurface *QOhosView::surfaceOrNull() const
1200{
1201 return m_nativeNode->surfaceOrNull();
1202}
1203
1205{
1206 return m_nativeNode->windowId();
1207}
1208
1210{
1211 qCDebug(QtForOhos) << "view:" << this << "setParentOrReparent parentView:" << &parentView;
1212 m_nativeNode->setParent(*parentView.m_nativeNode);
1213 setOrResetWindowProxy(nullptr, parentView.ownerWindow());
1214}
1215
1217{
1218 if (viewType() != ViewType::EmbeddedWindow) {
1219 qCDebug(QtForOhos) << Q_FUNC_INFO << m_ownerWindow;
1220 return;
1221 }
1222
1223 m_nativeNode->detachFromParentIfPresent();
1224 m_optLogicalParent = nullptr;
1225
1226 if (m_ownerWindow->isVisible() && !m_ohosWindowProxy)
1228}
1229
1231{
1232 m_nativeNode->setVisibility(visible);
1233 m_lastMainWindowHideMethod = WindowHideMethod::NativeNodeVisibility;
1234}
1235
1236void QOhosView::hideMainWindow()
1237{
1238 if (m_ohosWindowProxy->tryHideAbility()) {
1239 m_lastMainWindowHideMethod = WindowHideMethod::HideAbility;
1240 return;
1241 }
1242
1243 if (QOhosPlatformWindow::isWindowBeingClosedOrDestroyed(m_ownerWindow)) {
1245 return;
1246 }
1247
1248 m_ohosWindowProxy->minimize();
1249 m_lastMainWindowHideMethod = WindowHideMethod::Minimize;
1250}
1251
1252void QOhosView::syncWindowStateImmediate(WindowStateSyncReason reason)
1253{
1254 if (viewType() == ViewType::EmbeddedWindow && m_optLogicalParent == nullptr)
1255 return;
1256
1257 std::vector<std::function<void()>> postSurfaceDrawTasks;
1258 auto updatePostSurfaceDrawTask = qScopeGuard([&]() {
1259 if (!postSurfaceDrawTasks.empty()) {
1260 m_optPostSurfaceDrawTask = [postSurfaceDrawTasks = std::move(postSurfaceDrawTasks)]() {
1261 for (const auto &task: postSurfaceDrawTasks)
1262 task();
1263 };
1264 }
1265 });
1266
1267 if (reason == WindowStateSyncReason::ViewTypeChanged && m_ohosWindowProxy
1268 && viewType() == ViewType::MainWindow) {
1269 postSurfaceDrawTasks.emplace_back(
1270 [weakWindowProxy = QtOhos::makeWeakPtr(m_ohosWindowProxy)]() {
1271 auto windowProxy = weakWindowProxy.lock();
1272 if (windowProxy)
1273 windowProxy->removeStartingWindow();
1274 });
1275 }
1276
1277 auto *platformWindow = QOhosPlatformWindow::fromQWindow(m_ownerWindow);
1278
1279 auto targetWindowLimitsToSet =
1280 viewType() == ViewType::EmbeddedWindow
1281 ? std::make_pair(m_ownerWindow->minimumSize(), m_ownerWindow->maximumSize())
1282 : std::make_pair(platformWindow->windowMinimumSize(), platformWindow->windowMaximumSize());
1283
1284 auto windowFlags = QOhosPlatformWindow::platformWindowFlagsForQWindow(m_ownerWindow);
1285 bool focusable = !windowFlags.testFlag(Qt::WindowDoesNotAcceptFocus);
1286
1287 auto submitSystemPropertyUpdate = [](auto &targetProperty, const auto &targetValue) {
1288 targetProperty.optPendingUpdateRequest = targetValue;
1289 };
1290
1291 auto submitOrResetSystemPropertyUpdate = [&submitSystemPropertyUpdate](
1292 auto &targetProperty,
1293 const auto &targetValue,
1294 WindowGeometryPersistenceState windowGeometryPersistenceState) {
1295 if (windowGeometryPersistenceState == WindowGeometryPersistenceState::Enabled)
1296 targetProperty.optPendingUpdateRequest.reset();
1297 else
1298 submitSystemPropertyUpdate(targetProperty, targetValue);
1299 };
1300
1301 submitSystemPropertyUpdate(m_updateData.title, m_ownerWindow->title());
1302
1303 auto windowGeometryPersistenceState =
1304 viewType() == ViewType::MainWindow
1305 && m_geometryPersistencePolicy != ViewGeometryPersistencePolicy::Ignore
1306 ? syncWindowGeometryPersistenceState(m_ohosWindowProxy.get())
1307 : WindowGeometryPersistenceState::Disabled;
1308
1309 auto currentRuntimeDeviceTypeAndMode = queryQOhosRuntimeDeviceAndMode();
1310 bool windowGeometrySyncEnabled = false;
1311 switch (currentRuntimeDeviceTypeAndMode) {
1314 windowGeometrySyncEnabled = true;
1315 break;
1316 case QOhosRuntimeDeviceTypeAndMode::HandheldDeviceFullScreen:
1317 windowGeometrySyncEnabled = viewType() != ViewType::MainWindow;
1318 break;
1319 }
1320
1321 QOhosOptional<QOhosDisplayInfo::JsDisplayId> targetDisplayId;
1322 switch (viewType()) {
1323 case ViewType::SubWindow:
1324 if (m_optLogicalParent == nullptr)
1325 qOhosReportFatalErrorAndAbort("%s: logical parent for a subwindow is null", Q_FUNC_INFO);
1326 targetDisplayId = tryGetSubWindowJsDisplayId(m_optLogicalParent, *m_ohosWindowProxy);
1327 break;
1328 case ViewType::MainWindow:
1329 {
1330 targetDisplayId = m_ohosWindowProxy->tryGetMainWindowJsDisplayId();
1331 break;
1332 }
1333 case ViewType::FloatWindow:
1334 case ViewType::EmbeddedWindow:
1335 break;
1336 }
1337
1338 auto targetGeometryToSet = platformWindow->lastRequestedWindowFrameGeometry();
1339
1340 if (windowGeometrySyncEnabled) {
1341 submitSystemPropertyUpdate(m_updateData.sizeLimits, targetWindowLimitsToSet);
1342 submitOrResetSystemPropertyUpdate(
1343 m_updateData.size, targetGeometryToSet.size(), windowGeometryPersistenceState);
1344
1345 if (!qt_window_private(m_ownerWindow)->positionAutomatic) {
1346 submitOrResetSystemPropertyUpdate(
1347 m_updateData.position,
1348 std::make_pair(targetGeometryToSet.topLeft(), targetDisplayId),
1349 windowGeometryPersistenceState);
1350 }
1351 }
1352
1353 submitSystemPropertyUpdate(m_updateData.backgroundTransparent, isWindowTransparencyRequested());
1354
1355 if (currentRuntimeDeviceTypeAndMode == QOhosRuntimeDeviceTypeAndMode::_2in1)
1356 submitSystemPropertyUpdate(m_updateData.focusable, focusable);
1357
1358 if (viewType() == ViewType::SubWindow)
1359 submitSystemPropertyUpdate(m_updateData.modality, m_ownerWindow->modality());
1360
1361 submitSystemPropertyUpdate(
1362 m_updateData.windowMinMaxCloseButtonsState,
1364 .maxButtonShown = windowFlags.testFlag(Qt::WindowMaximizeButtonHint),
1365 .minButtonShown = windowFlags.testFlag(Qt::WindowMinimizeButtonHint),
1366 .closeButtonShown = windowFlags.testFlag(Qt::WindowCloseButtonHint),
1367 });
1368
1369 submitSystemPropertyUpdate(
1370 m_updateData.windowStaysOnTop, windowFlags.testFlag(Qt::WindowStaysOnTopHint));
1371
1372 submitSystemPropertyUpdate(m_updateData.frameless, windowFlags.testFlag(Qt::FramelessWindowHint));
1373
1374 submitSystemPropertyUpdate(
1375 m_updateData.windowTransparentForInput, windowFlags.testFlag(Qt::WindowTransparentForInput));
1376
1377 flushSystemPropertyUpdatesImmediate();
1378
1379 bool disableWindowShadow = windowFlags.testFlag(Qt::WindowType::NoDropShadowWindowHint);
1380 if (disableWindowShadow)
1382
1383 if (!m_ownerWindow->mask().isNull() && m_ohosWindowProxy != nullptr) {
1384 m_ohosWindowProxy->setWindowMask(
1385 QOhosWindowProxy::WindowMask {
1386 .windowMaskRegion = m_ownerWindow->mask(),
1387 },
1388 makeQOhosOptional(targetGeometryToSet.size()));
1389 }
1390 const auto privacyModeSetting = m_windowPropertiesProvider
1391 .tryGetProperty<bool, &QOhosPlatformWindow::windowPrivacyModeSettingProperty>();
1392 if (privacyModeSetting.has_value())
1393 setPrivacyMode(privacyModeSetting.value());
1394
1395 const auto windowCornerRadius = m_windowPropertiesProvider
1396 .tryGetProperty<double, &QOhosPlatformWindow::windowCornerRadiusProperty>();
1397 if (windowCornerRadius.has_value())
1398 setWindowCornerRadius(windowCornerRadius.value());
1399
1400 const auto keepScreenOn = m_windowPropertiesProvider
1401 .tryGetProperty<bool, &QOhosPlatformWindow::windowKeepScreenOnProperty>();
1402 if (keepScreenOn.has_value())
1403 setWindowKeepScreenOn(keepScreenOn.value());
1404
1405 auto fixedSizeStateEnabled = m_windowPropertiesProvider
1406 .tryGetProperty<bool, &QOhosPlatformWindow::windowFixedSizeStateProperty>();
1407 if (fixedSizeStateEnabled.has_value())
1408 setFixedSizeStateEnabled(fixedSizeStateEnabled.value());
1409
1410 auto windowDragResizable = m_windowPropertiesProvider
1411 .tryGetProperty<bool, &QOhosPlatformWindow::windowDragResizableProperty>();
1412 if (windowDragResizable.has_value())
1413 setWindowDragResizable(windowDragResizable.value());
1414
1415 // NOTE - when position automatic is set we do not control window position
1416 // therefore no window callback about window position change will be sent
1417 // and the screen that given window belongs to needs to be synchronized
1418 bool shouldSynchronizeTargetDisplayIdWithQpa =
1419 qt_window_private(m_ownerWindow)->positionAutomatic
1420 && reason == WindowStateSyncReason::ViewTypeChanged
1421 && m_ohosWindowProxy != nullptr;
1422
1423 if (shouldSynchronizeTargetDisplayIdWithQpa) {
1424 auto optTargetDisplayId = m_ohosWindowProxy->getWindowProperties().displayId;
1425 if (optTargetDisplayId.has_value()) {
1426 QOhosDisplayInfo::JsDisplayId syntheticDisplayIdChangeEvent = optTargetDisplayId.value();
1427 Q_EMIT windowDisplayIdChanged(syntheticDisplayIdChangeEvent);
1428 }
1429 }
1430}
1431
1432void QOhosView::flushSystemPropertyUpdatesImmediate()
1433{
1434 static const auto systemDataPropertyUpdateFuncPairsTuple = makeSystemUpdateDataPropertyUpdateFuncPairsTuple();
1435
1436 QtOhos::tupleForEach(
1437 systemDataPropertyUpdateFuncPairsTuple,
1438 [&](const auto &updateDataMemberPtrUpdateFuncPair) {
1439 auto memberPtr = updateDataMemberPtrUpdateFuncPair.first;
1440 auto updateFuncPtr = updateDataMemberPtrUpdateFuncPair.second;
1441 auto &property = m_updateData.*memberPtr;
1442 auto optUpdateRequest = std::exchange(property.optPendingUpdateRequest, {});
1443 if (optUpdateRequest.has_value())
1444 (this->*updateFuncPtr)(optUpdateRequest.value());
1445 });
1446 m_updatePending = false;
1447}
1448
1449void QOhosView::addForeignWindowChild(QOhosForeignWindow *foreignWindow)
1450{
1451 m_nativeNode->addForeignWindowChild(foreignWindow);
1452}
1453
1455{
1456 auto *surface = m_nativeNode->surfaceOrNull();
1457 return surface != nullptr
1458 ? surface->surfaceResolution()
1460}
1461
1463{
1464 return m_ohosWindowProxy != nullptr
1465 ? m_ohosWindowProxy->getImmersiveModeEnabledState()
1466 : false;
1467}
1468
1470{
1471 if (viewType() == ViewType::SubWindow) {
1472 auto *screen = m_ownerWindow->screen();
1473 return screen != nullptr && m_ownerWindow->geometry().size() == screen->geometry().size();
1474 }
1475
1476 return false;
1477}
1478
1479void QOhosView::updateWindowMinMaxCloseButtonsState(const WindowMinMaxCloseButtonsState &state)
1480{
1481 if (m_ohosWindowProxy != nullptr) {
1482 m_ohosWindowProxy->setWindowTitleButtonVisible(
1483 state.maxButtonShown, state.minButtonShown, state.closeButtonShown);
1484 }
1485}
1486
1487void QOhosView::updateWindowStaysOnTop(bool staysOnTop)
1488{
1489 if (m_ohosWindowProxy != nullptr)
1490 m_ohosWindowProxy->setWindowTopmost(staysOnTop);
1491}
1492
1493void QOhosView::updateWindowFrameless(bool frameless)
1494{
1495 bool supportsFramelessWindow = viewType() == ViewType::MainWindow || viewType() == ViewType::SubWindow;
1496 if (m_ohosWindowProxy != nullptr && supportsFramelessWindow) {
1497 m_ohosWindowProxy->setWindowDecorVisible(!frameless);
1498 m_ohosWindowProxy->setWindowTitleMoveEnabled(!frameless);
1499 }
1500}
1501
1502void QOhosView::setWindowDragResizable(bool dragResizable)
1503{
1504 if (m_ohosWindowProxy != nullptr)
1505 m_ohosWindowProxy->enableDrag(dragResizable);
1506}
1507
1509{
1510 setSystemUpdateProperty(&SystemUpdateData::windowMinMaxCloseButtonsState, state);
1511}
1512
1513void QOhosView::setWindowStaysOnTop(bool staysOnTop)
1514{
1515 setSystemUpdateProperty(&SystemUpdateData::windowStaysOnTop, staysOnTop);
1516}
1517
1518void QOhosView::setFramelessWindow(bool frameless)
1519{
1520 setSystemUpdateProperty(&SystemUpdateData::frameless, frameless);
1521}
1522
1524{
1525 if (m_ohosWindowProxy != nullptr) {
1526 constexpr double windowShadowDisabledRadius = 0.0;
1527 m_ohosWindowProxy->setWindowShadowRadius(windowShadowDisabledRadius);
1528 }
1529}
1530
1531void QOhosView::setWindowCornerRadius(double radius)
1532{
1533 if (m_ohosWindowProxy != nullptr)
1534 m_ohosWindowProxy->setWindowCornerRadius(radius);
1535}
1536
1537void QOhosView::setWindowTransparentForInput(bool transparentForInput)
1538{
1539 setSystemUpdateProperty(&SystemUpdateData::windowTransparentForInput, transparentForInput);
1540}
1541
1543{
1544 if (m_ohosWindowProxy != nullptr)
1545 return m_ohosWindowProxy->startMoving();
1546 return false;
1547}
1548
1549void QOhosView::setPrivacyMode(bool privacyModeEnabled)
1550{
1551 if (m_ohosWindowProxy != nullptr)
1552 m_ohosWindowProxy->setWindowPrivacyMode(privacyModeEnabled);
1553}
1554
1556 const std::vector<QImage> &images, const QPointF &hotspot,
1557 const QMimeData &mimeData, QOhosConsumer<Qt::DropAction> dropActionConsumer)
1558{
1559 m_nativeNode->startDrag(images, hotspot, mimeData, std::move(dropActionConsumer));
1560}
1561
1563{
1564 const auto lastMainWindowHideMethod = std::exchange(m_lastMainWindowHideMethod, makeEmptyQOhosOptional());
1565 if (m_ohosWindowProxy == nullptr || !m_ohosWindowProxy->qtIsMainWindow())
1566 return;
1567
1568 if (!lastMainWindowHideMethod.has_value()) {
1569 m_ohosWindowProxy->restore();
1570 return;
1571 }
1572
1573 switch (lastMainWindowHideMethod.value()) {
1574 case WindowHideMethod::NativeNodeVisibility:
1575 case WindowHideMethod::Minimize:
1576 m_ohosWindowProxy->restore();
1577 break;
1578 case WindowHideMethod::HideAbility:
1579 m_ohosWindowProxy->showAbility();
1580 break;
1581 }
1582}
1583
1585 Qt::WindowStates previousWindowState, Qt::WindowStates currentWindowState)
1586{
1587 auto stateChange = previousWindowState ^ currentWindowState;
1588 if (stateChange.testFlag(Qt::WindowState::WindowMinimized) && !currentWindowState.testFlag(Qt::WindowState::WindowMinimized))
1590
1591 if (stateChange.testFlag(Qt::WindowState::WindowMaximized) && currentWindowState.testFlag(Qt::WindowState::WindowMaximized)) {
1592 maximize();
1593 return;
1594 }
1595
1596 if (stateChange.testFlag(Qt::WindowState::WindowFullScreen) && currentWindowState.testFlag(Qt::WindowState::WindowFullScreen)) {
1598 return;
1599 }
1600
1601 if (stateChange.testFlag(Qt::WindowState::WindowMinimized) && currentWindowState.testFlag(Qt::WindowState::WindowMinimized)) {
1602 minimize();
1603 return;
1604 }
1605
1606 if (!currentWindowState) {
1607 recover();
1608 return;
1609 }
1610}
1611
1613 Qt::WindowFlags previousWindowFlags, Qt::WindowFlags currentWindowFlags)
1614{
1615 const auto flagsChange = previousWindowFlags ^ currentWindowFlags;
1616
1617 bool minMaxCloseButtonStateChanged = (flagsChange & (Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint)) != 0;
1618 bool framelessChanged = (flagsChange & Qt::FramelessWindowHint) != 0;
1619
1620 if (minMaxCloseButtonStateChanged || framelessChanged) {
1622 .maxButtonShown = currentWindowFlags.testFlag(Qt::WindowMaximizeButtonHint),
1623 .minButtonShown = currentWindowFlags.testFlag(Qt::WindowMinimizeButtonHint),
1624 .closeButtonShown = currentWindowFlags.testFlag(Qt::WindowCloseButtonHint),
1625 });
1626 }
1627
1628 bool windowStaysOnTopChanged = (flagsChange & Qt::WindowStaysOnTopHint) != 0;
1629 if (windowStaysOnTopChanged)
1630 setWindowStaysOnTop(currentWindowFlags.testFlag(Qt::WindowStaysOnTopHint));
1631
1632 bool transparentForInputChanged = (flagsChange & Qt::WindowTransparentForInput) != 0;
1633 if (transparentForInputChanged)
1634 setWindowTransparentForInput(currentWindowFlags.testFlag(Qt::WindowTransparentForInput));
1635
1636 if (framelessChanged)
1637 setFramelessWindow(currentWindowFlags.testFlag(Qt::FramelessWindowHint));
1638
1639 bool focusableChanged = (flagsChange & Qt::WindowDoesNotAcceptFocus) != 0;
1640 if (focusableChanged) {
1641 bool windowAcceptsFocus = !currentWindowFlags.testFlag(Qt::WindowDoesNotAcceptFocus);
1642 setFocusable(windowAcceptsFocus);
1643 }
1644
1645 bool disableWindowShadowChanged = (flagsChange & Qt::NoDropShadowWindowHint) != 0;
1646 if (disableWindowShadowChanged && currentWindowFlags.testFlag(Qt::NoDropShadowWindowHint))
1648
1649 bool expandedClientAreaChanged = (flagsChange & Qt::ExpandedClientAreaHint) != 0;
1650 if (expandedClientAreaChanged && QOhosDeviceInfo::isPhone())
1651 applyPhoneWindowChrome();
1652}
1653
1654QArkUi::QQtEmbeddedWindowNode::NodeAreaInfo QOhosView::nodeAreaInfo() const
1655{
1656 return m_nativeNode->nodeAreaInfo();
1657}
1658
1665
1667{
1668 return !(*this == other);
1669}
1670
1671void QOhosView::setOrResetWindowProxy(std::shared_ptr<QOhosWindowProxy> windowProxy, QWindow *optLogicalParent)
1672{
1673 m_ohosWindowProxy.reset();
1674 m_ohosWindowProxy = windowProxy
1675 ? QtOhos::makeSharedPtrWithAttachedExtraData<QOhosWindowProxy>(
1676 windowProxy,
1677 QWindowProxyRegistry::instance().registerQWindowWithWindowProxy(ownerWindow(), *windowProxy))
1678 : nullptr;
1679 m_optLogicalParent = optLogicalParent;
1680 syncWindowStateImmediate(WindowStateSyncReason::ViewTypeChanged);
1681}
1682
1684{
1685 auto *platformWindow = m_optLogicalParent != nullptr
1686 ? QOhosPlatformWindow::fromQWindowOrNull(m_optLogicalParent)
1687 : nullptr;
1688
1689 return platformWindow != nullptr
1690 ? platformWindow->ownedViewOrNull()
1691 : nullptr;
1692}
1693
1694const QOhosView *QOhosView::ancestorViewWithWindowOrNull() const
1695{
1696 const QOhosView *parent = viewParentOrNull();
1697 while (parent != nullptr && !parent->m_ohosWindowProxy)
1698 parent = parent->viewParentOrNull();
1699
1700 return parent != nullptr && parent->m_ohosWindowProxy
1701 ? parent
1702 : nullptr;
1703}
1704
1706{
1707 return m_ohosWindowProxy ? m_ohosWindowProxy->snapshot() : QPixmap();
1708}
1709
1711{
1712 return m_nativeNode->nodeScreenGeometryPixels();
1713}
1714
1716{
1717 return m_nativeNode->nodeParentRelativeGeometryPixels();
1718}
1719
1720QT_END_NAMESPACE
void externalContentClickDetected()
static QOhosPlatformIntegration * instance()
static WindowGeometryPersistencePolicy getMainWindowGeometryPersistencePolicy()
QOhosInputMethodEventHandler * inputMethodEventHandler() const
bool mainWindowTagValueOrFalse() const
bool floatWindowTagValueOrFalse() const
DecorationPreset decorationPreset() const
void clearNativeWindowSurface()
void windowStatusChange(QOhosWindowProxy::WindowStatus windowStatus)
void setParentOrReparent(QOhosView &parentView)
void requestActivate()
void setCursor(const QCursor &cursor)
void handleWindowFlagsChange(Qt::WindowFlags previousWindowFlags, Qt::WindowFlags currentWindowFlags)
void addForeignWindowChild(QOhosForeignWindow *foreignWindow)
void handleWindowStateChange(Qt::WindowStates previousWindowState, Qt::WindowStates currentWindowState)
void restoreMainWindow()
void setFocusable(bool focusable)
QArkUi::QQtEmbeddedWindowNode::NodeAreaInfo nodeAreaInfo() const
QOhosSurface * surfaceOrNull() const
void windowVisibilityChange(bool visibility)
void setPositionOnScreenImmediate(const QPoint &position, QOhosDisplayInfo::JsDisplayId jsDisplayId)
void setTransparentBackground(bool transparent)
void setModality(Qt::WindowModality modality)
WId viewWindowId() const
bool isFullscreenImmersiveModeEnabled()
void setFramelessWindow(bool frameless)
QPixmap makeSnapshot() const
void setWindowShadowDisabled()
void setWindowTransparentForInput(bool transparentForInput)
void tryDetachFromEmbeddedParent()
ViewType viewType() const
QMargins avoidAreaMargins(QOhosWindowProxy::AvoidAreaType type) const
QWindow * ownerWindow() const
void handleSurfaceContentsUpdated()
void hide()
WindowStateSyncReason
Definition qohosview.h:89
QOhosOptional< QSize > surfaceResolution() const
void forceGeometryUpdate()
void externalContentInteractionDetected()
void setWindowMinMaxCloseButtonState(const WindowMinMaxCloseButtonsState &state)
void setWindowMask(const QOhosWindowProxy::WindowMask &windowMask)
void setSizeLimits(const QSize &minSize, const QSize &maxSize)
void windowTouchOutside()
void handlePaletteChange()
void lower()
void windowDisplayIdChanged(QOhosDisplayInfo::JsDisplayId)
void minimize()
void setNativeNodeVisibility(bool visible)
void setWindowStaysOnTop(bool staysOnTop)
void setFullScreen()
void maximize()
ViewGeometry viewGeometry() const
void setSize(const QSize &size)
void recover()
bool startMoving()
void setPosition(const QPoint &position)
QOhosView(QWindow *ownerWindow, QSharedPointer< QNativeNode > nativeNode, QOhosPropertiesProvider propertiesProvider)
bool isSubWindowCoveringFullScreen() const
void showImmediate()
QRect nodeParentRelativeGeometryPixels() const
void setTitle(const QString &title)
void startDrag(const std::vector< QImage > &images, const QPointF &hotspot, const QMimeData &mimeData, QOhosConsumer< Qt::DropAction > dropActionConsumer)
const QOhosView * viewParentOrNull() const
QRect nodeScreenGeometryPixels() const
void raise()
void setWindowRectAutoSave(bool enabed)
static std::shared_ptr< QOhosWindowProxy > createFloatWindow(const FloatWindowCreateInfo &createInfo)
QtOhos::enums::ohos::window::ModalityType ModalityType
QtOhos::enums::ohos::window::AvoidAreaType AvoidAreaType
QOhosWindowProxyExistingMainWindowCreateInfo ExistingMainWindowCreateInfo
static std::shared_ptr< QOhosWindowProxy > createForExistingMainWindow(const ExistingMainWindowCreateInfo &createInfo)
bool isWindowRectAutoSave() const
QOhosWindowProxySubWindowCreateInfo SubWindowCreateInfo
QtOhos::enums::ohos::window::WindowEventType WindowEventType
QOhosWindowProxyMainWindowCreateInfo MainWindowCreateInfo
QOhosWindowProxyFloatWindowCreateInfo FloatWindowCreateInfo
QtOhos::enums::ohos::bundle::bundleManager::SupportWindowMode SupportWindowMode
static std::shared_ptr< QOhosWindowProxy > createMainWindow(const MainWindowCreateInfo &createInfo)
QOhosWindowProxy::AvoidAreaType AvoidAreaType
Definition qohosview.cpp:92
AvoidAreaCache(std::function< AvoidArea(AvoidAreaType)> avoidAreasProvider)
AvoidArea getStoredOrRetrieveFromWindowProxy(AvoidAreaType avoidAreaType)
void put(AvoidAreaType avoidAreaType, const AvoidArea &avoidArea)
static QWindowProxyRegistry & instance()
Combined button and popup list for selecting options.
QOhosOptional< QOhosWindowProxy::ModalityType > mapQtWindowModalityToOhosOrDefault(Qt::WindowModality windowModality)
Definition qohosview.cpp:57
QSize evaluateGeometrySizeBasedOnFrameGeometry(const QPoint &geometryOrigin, const QRect &frameGeometry)
std::function< void(SignalParams...)> makeViewConditionalSignalEmitter(QPointer< QOhosView > viewPtr, std::function< bool(QOhosView &)> predicate, void(QOhosView::*signalFuncPtr)(SignalParams ...))
Definition qohosview.cpp:79
QOhosOptional< QColor > tryGetBackgroundColorFromWindow(QWindow *window)
QCursor makeTransparentBitmapCursor(QSize cursorSize)
QWindow * syntheticParentForQWindowOrNull(QWindow *qWindow)
QBitmap getCursorMask(const QCursor &cursor)
QSize getQSizeGrownBy(const QSize &size, const QMargins &margins)
void tryUpdateMaximumMarginsFromAvoidArea(QMargins &marginsToUpdate, const QOhosWindowProxy::AvoidArea &avoidArea)
QWindow * getFirstTopLevelWindowWithSystemFocusOrNull()
QWindow * getFirstTopLevelWindowOrNull()
QOhosOptional< QOhosDisplayInfo::JsDisplayId > tryGetSubWindowJsDisplayId(QWindow *logicalParent, QOhosWindowProxy &windowProxy)
QBitmap getCursorBitmap(const QCursor &cursor)
ViewGeometryPersistencePolicy determineViewGeometryPersistencePolicy()
ViewTypeInfo determineViewTypeAndLogicalParent(const QOhosPlatformWindow *platformWindow)
WindowGeometryPersistenceState syncWindowGeometryPersistenceState(QOhosWindowProxy *windowProxy)
QImage createImageFromBitmapAndMask(const QBitmap &bitmap, const QBitmap &mask)
bool acquireAndCleanPendingAutoStartedInstanceWindowFlag()
std::nullopt_t makeEmptyQOhosOptional()
bool isHandheldDeviceType()
QOhosRuntimeDeviceTypeAndMode queryQOhosRuntimeDeviceAndMode()
bool operator==(const WindowMinMaxCloseButtonsState &other) const
bool operator!=(const WindowMinMaxCloseButtonsState &other) const
QOhosView::ViewType viewType
Definition qohosview.cpp:47