Skip to content

feat(ohos): window ops bridge + status readback + test scaffolding - #73

Open
ddxwzc-boop wants to merge 8 commits into
Eulogizethesun:ohdevfrom
ddxwzc-boop:ohdev
Open

feat(ohos): window ops bridge + status readback + test scaffolding#73
ddxwzc-boop wants to merge 8 commits into
Eulogizethesun:ohdevfrom
ddxwzc-boop:ohdev

Conversation

@ddxwzc-boop

Copy link
Copy Markdown
  • tauri-runtime-wry: drain windowStatusChange queue, route by real OHOS windowId to tao apply_window_status (visible/fullscreen mirror backfill)
  • templates: declare ohos.permission.WINDOW_TOPMOST (desktop+mobile)
  • examples/api: new commands create_decorated_window / set_ime_position_test / create_transparent_ui_ability_window; build.rs + capabilities registered
  • TestRunner.svelte: Float sub-window manual test buttons (title/decoration flags/bg color/ime position), window-event watch; setOuterPosition demoted to smoke (moveWindowTo readback unreliable, per chore(deps): update dependency eslint-plugin-import to v2.19.1 tauri-apps/tauri#143)
  • docs: OHOS window legacy-issues / test-mapping / test-buttons + skill notes

另含 fix(review): 移除重复 #[cfg(desktop)] + 新增 G10 checklist (G10)

- lib.rs: create_borderless_window had two stacked #[cfg(desktop)] attributes
  (merge residual, harmless but redundant); collapsed to one.
- review-checklist.md: add G10 (OHOS no-op/degraded impls need observability),
  distilled from review finding F6 (drag_window main-window Ok(()) with no log).
- tauri-runtime-wry: drain windowStatusChange queue, route by real OHOS
  windowId to tao apply_window_status (visible/fullscreen mirror backfill)
- templates: declare ohos.permission.WINDOW_TOPMOST (desktop+mobile)
- examples/api: new commands create_decorated_window / set_ime_position_test /
  create_transparent_ui_ability_window; build.rs + capabilities registered
- TestRunner.svelte: Float sub-window manual test buttons (title/decoration
  flags/bg color/ime position), window-event watch; setOuterPosition demoted
  to smoke (moveWindowTo readback unreliable, per tauri-apps#143)
- docs: OHOS window legacy-issues / test-mapping / test-buttons + skill notes
@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown

Package Changes Through 068cdbe

There are 11 changes which include tauri with minor, @tauri-apps/api with minor, tauri-build with minor, tauri-macos-sign with patch, tauri-bundler with minor, @tauri-apps/cli with minor, tauri-cli with minor, tauri-runtime with minor, tauri-runtime-wry with minor, tauri-utils with minor, tauri-plugin with minor

Planned Package Versions

The following package releases are the planned based on the context of changes in this pull request.

package current next
@tauri-apps/api 2.10.1 2.11.0
tauri-utils 2.8.3 2.9.0
tauri-macos-sign 2.3.3 2.3.4
tauri-bundler 2.8.1 2.9.0
tauri-runtime 2.10.1 2.11.0
tauri-runtime-wry 2.10.1 2.11.0
tauri-codegen 2.5.5 2.5.6
tauri-macros 2.5.5 2.5.6
tauri-plugin 2.5.4 2.6.0
tauri-build 2.5.6 2.6.0
tauri 2.10.3 2.11.0
@tauri-apps/cli 2.10.1 2.11.0
tauri-cli 2.10.1 2.11.0

Add another change file through the GitHub UI by following this link.


Read about change files or the docs at github.com/jbolda/covector

@ddxwzc-boop ddxwzc-boop left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OHOS Code Review — tauri#73

🔴 🟡 🔵 ℹ️
0 0 1 1

Cross-repo group: window-ops bridge + status readback. The runtime-wry drain routing for windowStatusChange is correct and mirrors the proven drain_pending_window_closes bypass (real OHOS windowId, no reliance on tao's ZST WindowId). One cross-cutting note below. Inline comment attached.

Summary

  • 🔵 The drain matches w.window_id() == Some(ohos_win_id as i64). For a Float window whose creation failed (create_os_window(...).ok()window_id: None in tao), window_id() returns None while ohos_win_id() returns 0 — such a window never matches any drained status, so its visible/fullscreen mirror stays stale and its set_* ops silently route to the main window (id=0). Cross-references tao G6 (create_os_window failure should return Err, not construct a None-id Window).
  • ℹ️ New comments/docs are in Chinese (H7) — 274 added lines, but the bulk is the two doc/*.md files which are intentionally Chinese; code-comment portion is small. Note checklist-vs-idiom tension.

Positive

  • build.rs registers set_ime_position_test, create_decorated_window, and create_transparent_ui_ability_window in the commands list — this fixes the known build.rs missing-registration panic (where unregistered transparent-ui-ability/ime commands caused codegen→runtime panic). Good catch.

Comment thread crates/tauri-runtime-wry/src/lib.rs
Verify tao#20 set_min/max_inner_size 'four-value dispatch' fix:
setMinSize(1600×1200 px) + setMaxSize(2400×1800 px) on main window.
Before tao fix, setMaxSize would reset min to 0×0; after, both
constraints persist. hilog WindowManager tag shows setWindowLimits
four values both correct. Uses PhysicalSize to avoid LogicalSize
scale(≈2.0) exceeding screen and triggering appfreeze.
PR#73 review (crates/tauri-runtime-wry/src/lib.rs:4514): the windowStatusChange
drain's no-match branch was debug-only. Per the review, surface it at warn when a
real (non-zero) OHOS window id was queued but matched no live window — that is a
stale id (window destroyed between queue and drain) or a routing mismatch, worth
investigating. Keep id=0 (main window / failed-Float sentinel) at debug to avoid
noise.

A failed Float window (window_id=None, ohos_win_id()==0) never queues a status
(no real OHOS window), so it produces no drain event; the warn's presence thus
distinguishes 'stale id' from the silent 'failed Float window' case. The tao-side
G6 fix (create_os_window failure should return Err, not a None-id Window) is
filed against tao#20 and out of scope here.
…manual test, docs & openspec

Declare ohos.permission.LOCK_WINDOW_CURSOR in both ohos entry templates
(normal/system_grant, since API 22). Upgrade the TestRunner setCursorGrab
button from a no-throw smoke check to a real 5s lock/unlock test with
focus-loss auto-release guidance. Correct the window docs: the old
'platform limitation' verdict came from grepping only ArkTS .d.ts — the
LockCursor C API is NDK-only. Archive openspec p1/p2-cursor-grab design
docs. Review checklist: +C6 (verify NAPI i64 marshalling claims against
napi-ohos source, not stale repo comments); constraints doc: napi
Result<T,S> alias trap.
@ddxwzc-boop

Copy link
Copy Markdown
Author

Cursor grab enablement appended (bc4cec3)

Completes the cursor-grab feature on top of tao#20 + openharmony-ability#45:

  • Permission: declares ohos.permission.LOCK_WINDOW_CURSOR (normal/system_grant, API 22+) in both ohos entry templates — new projects get it out of the box. Device bm dump confirms system_grant on install.
  • Real manual test: TestRunner setCursorGrab(true) 5s (Lock to window) replaces the old no-throw smoke check — locks for 5s with expected-behavior guidance (cursor confined to window, focus-loss auto-release, unlock restores free movement).
  • Docs correction: the previous 'platform limitation' verdict came from grepping only ArkTS .d.tsOH_WindowManager_LockCursor/UnlockCursor is NDK-only (libnative_window_manager.so, oh_window.h). Both window docs updated; mapping table now shows the capability as implemented.
  • openspec: archives p1-cursor-grab / p2-cursor-grab design docs (proposal/specs/design/tasks) + plan file.
  • Review evolution: checklist +C6 (verify NAPI i64 marshalling claims against napi-ohos source, not stale repo comments — i64↔JS is number via napi_create_int64, the in-repo 'arrives as BigInt' comments are wrong); constraints doc gains the napi_ohos::Result<T,S> payload-generic alias trap.

Device-verified end-to-end on MateBook Pro (HarmonyOS 6.1.0.117): all three behaviors pass, hilog zero errors, idempotent-unlock fix re-verified.

On OHOS, a webview without explicit bounds must stay bounds-less so wry
marks it natural-layout in WebViewStyle (no width/height -> ArkTS "100%")
and it follows window resizes. The full-window fallback bounds made it
explicit-size, desyncing its page layout on resize (BuilderNode.update
does not notify ArkWeb to relayout).
- tauri-runtime: WindowEvent::AvoidAreaChanged variant with serializable
  AvoidAreaChangedPayload/AvoidAreaRect (camelCase), WindowDispatch::avoid_areas
- tauri-runtime-wry: WindowMessage::AvoidAreas main-thread query via tao ext
  trait; drain PENDING_AVOID_AREA_CHANGES (PENDING_WINDOW_STATUS-style
  side-channel, routed to the main window — tao ZST WindowId carries no
  identity) and dispatch RunEvent::WindowEvent + window listeners
- tauri: app-level WindowEvent variant + From conversion, manager emits
  tauri://avoid-area-changed, WebviewWindow::avoid_areas() public API
- examples/api: get_avoid_areas command (registered in generate_handler,
  build.rs command list and capabilities/run-app.json) + two manual test
  buttons (query + event watch) — device-verified: query returns 4 area
  types (zero rects on PC form, matching system updateAvoidAreas), 4
  events delivered end-to-end on new UIAbility window creation
- keep IME position result readback + capability verdict corrections
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant