桌面环境

This commit is contained in:
2026-04-26 00:43:06 +08:00
parent 3e9c8ead23
commit 87d9e31385
19 changed files with 1586 additions and 220 deletions

View File

@@ -2,7 +2,7 @@
## Goal
- Add a minimal user-space desktop environment entrypoint.
- Provide a simple window manager demo (`uwm`) with focus, dragging, and rendering in framebuffer.
- Provide a usable user-space window manager (`uwm`) with focus, dragging, resize, taskbar, and launcher.
- Expose mouse snapshot data to user-space through a dedicated syscall.
## Implementation
@@ -11,28 +11,36 @@
- 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()`.
- 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`.
- New user app:
- Added `cleonos/c/apps/uwm_main.c`.
- Features:
- Desktop background rendering.
- Bottom taskbar with window buttons.
- Start launcher menu for built-in demo windows.
- Multiple windows with z-order.
- Title bar with close, minimize, topmost, and resize controls.
- Active window focus + border highlight.
- Drag by title bar (left mouse).
- Keyboard fallback controls (`Tab`, `W/A/S/D`, `Q/Esc`).
- Keyboard fallback controls (`Tab`, `1/2/3`, `W/A/S/D`, `M`, `X`, `T`, `+/-`, `Q`).
- 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:
- Added optional absolute pointer device by default:
- 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:
- `-usb -device usb-tablet`
- New CMake option:
- `CLEONOS_QEMU_ENABLE_USB_TABLET=ON` (default).
- `CLEONOS_QEMU_ENABLE_USB_TABLET=OFF` (default).
- Set it to `ON` only after USB HID tablet support is available.
## Acceptance Criteria
- `uwm` can be started from user shell.
- Framebuffer window demo draws multiple windows and supports dragging.
- UWM draws multiple windows, taskbar, and launcher, and supports dragging, minimize/restore, topmost, close, and resize.
- Mouse state is retrievable from user-space via syscall `107`.
- `make run`/`make debug` use USB tablet by default for smoother pointer interaction.
- `make run`/`make debug` use the PS/2 mouse path by default so the existing kernel mouse driver receives movement and buttons.
## Build Targets
- `make userapps`
@@ -45,8 +53,8 @@
## Debug Notes
- If `uwm` reports framebuffer unavailable:
- verify `FB_INFO` syscall is enabled and framebuffer bpp is `32`.
- If pointer behavior is relative/jumpy:
- keep `CLEONOS_QEMU_ENABLE_USB_TABLET=ON`.
- for manual QEMU invocation, include `-usb -device usb-tablet`.
- 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.
- If mouse syscall returns `ready=0`:
- check boot log for PS/2 mouse init status under `[INFO][MOUSE]`.