2026-04-25 17:53:47 +08:00
|
|
|
# Stage 30 - User-Space Window Manager (UWM) + Mouse Syscall
|
|
|
|
|
|
|
|
|
|
## Goal
|
|
|
|
|
- Add a minimal user-space desktop environment entrypoint.
|
2026-04-26 00:43:06 +08:00
|
|
|
- Provide a usable user-space window manager (`uwm`) with focus, dragging, resize, taskbar, and launcher.
|
2026-04-25 17:53:47 +08:00
|
|
|
- Expose mouse snapshot data to user-space through a dedicated syscall.
|
|
|
|
|
|
|
|
|
|
## Implementation
|
|
|
|
|
- New syscall:
|
|
|
|
|
- Added `MOUSE_STATE` (`id=107`) in kernel/user syscall headers.
|
|
|
|
|
- Kernel side (`clks/kernel/runtime/syscall.c`) now exports mouse snapshot:
|
|
|
|
|
- fields: `x`, `y`, `buttons`, `packet_count`, `ready`.
|
|
|
|
|
- User wrapper added: `cleonos_sys_mouse_state()`.
|
2026-04-26 00:43:06 +08:00
|
|
|
- Window protocol update:
|
|
|
|
|
- Added `WM_SET_FLAGS` (`id=114`) for `CLEONOS_WM_FLAG_TOPMOST`.
|
|
|
|
|
- Added `WM_RESIZE` (`id=115`) so resize keeps the same `window_id`.
|
2026-04-25 17:53:47 +08:00
|
|
|
- New user app:
|
|
|
|
|
- Added `cleonos/c/apps/uwm_main.c`.
|
|
|
|
|
- Features:
|
2026-04-26 00:43:06 +08:00
|
|
|
- Bottom taskbar with window buttons.
|
|
|
|
|
- Start launcher menu for built-in demo windows.
|
2026-04-25 17:53:47 +08:00
|
|
|
- Multiple windows with z-order.
|
2026-04-26 00:43:06 +08:00
|
|
|
- Title bar with close, minimize, topmost, and resize controls.
|
2026-04-25 17:53:47 +08:00
|
|
|
- Active window focus + border highlight.
|
|
|
|
|
- Drag by title bar (left mouse).
|
2026-04-26 00:43:06 +08:00
|
|
|
- Keyboard fallback controls (`Tab`, `1/2/3`, `W/A/S/D`, `M`, `X`, `T`, `+/-`, `Q`).
|
2026-04-25 17:53:47 +08:00
|
|
|
- Build integration:
|
|
|
|
|
- Added `uwm` into shell command app set in `cleonos/CMakeLists.txt`.
|
|
|
|
|
- Updated shell help text and standalone `help` app output.
|
|
|
|
|
- QEMU run/debug update:
|
2026-04-26 00:43:06 +08:00
|
|
|
- QEMU now keeps the default PS/2 mouse path enabled for `make run`/`make debug`.
|
|
|
|
|
- USB tablet is optional and disabled by default because the kernel currently has a PS/2 mouse driver, not a USB HID tablet driver.
|
|
|
|
|
- Optional absolute pointer device:
|
2026-04-25 17:53:47 +08:00
|
|
|
- `-usb -device usb-tablet`
|
|
|
|
|
- New CMake option:
|
2026-04-26 00:43:06 +08:00
|
|
|
- `CLEONOS_QEMU_ENABLE_USB_TABLET=OFF` (default).
|
|
|
|
|
- Set it to `ON` only after USB HID tablet support is available.
|
2026-04-25 17:53:47 +08:00
|
|
|
|
|
|
|
|
## Acceptance Criteria
|
|
|
|
|
- `uwm` can be started from user shell.
|
2026-04-26 00:43:06 +08:00
|
|
|
- UWM draws multiple windows, taskbar, and launcher, and supports dragging, minimize/restore, topmost, close, and resize.
|
2026-04-25 17:53:47 +08:00
|
|
|
- Mouse state is retrievable from user-space via syscall `107`.
|
2026-04-26 00:43:06 +08:00
|
|
|
- `make run`/`make debug` use the PS/2 mouse path by default so the existing kernel mouse driver receives movement and buttons.
|
2026-04-25 17:53:47 +08:00
|
|
|
|
|
|
|
|
## Build Targets
|
|
|
|
|
- `make userapps`
|
|
|
|
|
- `make iso`
|
|
|
|
|
- `make run`
|
|
|
|
|
|
|
|
|
|
## QEMU Command
|
|
|
|
|
- `make run`
|
|
|
|
|
|
|
|
|
|
## Debug Notes
|
|
|
|
|
- If `uwm` reports framebuffer unavailable:
|
|
|
|
|
- verify `FB_INFO` syscall is enabled and framebuffer bpp is `32`.
|
2026-04-26 00:43:06 +08:00
|
|
|
- If the UWM cursor does not move under QEMU:
|
|
|
|
|
- keep `CLEONOS_QEMU_ENABLE_USB_TABLET=OFF`.
|
|
|
|
|
- for manual QEMU invocation, do not include `-usb -device usb-tablet` until USB HID support exists.
|
2026-04-25 17:53:47 +08:00
|
|
|
- If mouse syscall returns `ready=0`:
|
|
|
|
|
- check boot log for PS/2 mouse init status under `[INFO][MOUSE]`.
|