4#include <qarkui/window.h>
7#include <qarkui/qarkuiutils.h>
9#include <window_manager/oh_window.h>
10#include <window_manager/oh_window_comm.h>
18QRect makeQRectFromWindowManagerRect(
const ::WindowManager_Rect &wmRect)
21 QPoint(wmRect.posX, wmRect.posY),
22 QSize(wmRect.width, wmRect.height));
29 ::WindowManager_WindowProperties windowProperties;
30 auto errorCode = ::OH_WindowManager_GetWindowProperties(
31 static_cast<std::int32_t>(jsWindowId.value()),
34 if (errorCode != ::OK)
37 return makeQOhosOptional(
39 .windowRect = makeQRectFromWindowManagerRect(windowProperties.windowRect),
40 .drawableRect = makeQRectFromWindowManagerRect(windowProperties.drawableRect),
41 .id = JsWindowId(windowProperties.id),
42 .displayId = makeQOhosOptional(QOhosDisplayInfo::JsDisplayId(windowProperties.displayId)),
55 const auto windowShownErrorCode = callArkUi(
56 Q_OHOS_NAMED_FUNC(::OH_WindowManager_IsWindowShown),
57 static_cast<std::int32_t>(m_jsWindowId.value()), &result);
58 if (windowShownErrorCode == ::WindowManager_ErrorCode::WINDOW_MANAGER_ERRORCODE_INVALID_PARAM)
59 qOhosReportFatalErrorAndAbort(
"%s: error: %d", Q_FUNC_INFO, windowShownErrorCode);
60 return windowShownErrorCode == ::WindowManager_ErrorCode::OK
67 if (QtOhos::JsWindowsTracker::isWindowClosing(m_jsWindow.Value()))
69 return m_jsWindow.call<QNapi::Boolean>(
"isFocused").Value();
79 return m_jsWindow.Value();
JsWindowRef(JsWindowId windowId, QNapi::Object jsWindow)
bool isWindowShown() const
std::enable_if_t< qohosplugincore_h_detail::isQOhosOptional< QOhosInvokeResult< Func, T > >, QOhosInvokeResult< Func, T > > andThen(Func &&func) const
QOhosOptional< WindowProperties > tryGetWindowProperties(JsWindowId jsWindowId)
Combined button and popup list for selecting options.
QOhosOptional< void > makeEmptyQOhosOptional()