mirror of
https://github.com/Leonmmcoset/cleonos.git
synced 2026-04-27 13:44:01 +00:00
桌面环境
This commit is contained in:
@@ -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]`.
|
||||
|
||||
@@ -83,7 +83,7 @@ u64 cleonos_syscall(u64 id, u64 arg0, u64 arg1, u64 arg2);
|
||||
- `/proc/<pid>`:指定 PID 快照文本
|
||||
- `/proc` 为只读;写入类 syscall 不支持。
|
||||
|
||||
## 4. Syscall 列表(0~113)
|
||||
## 4. Syscall 列表(0~115)
|
||||
|
||||
### 0 `CLEONOS_SYSCALL_LOG_WRITE`
|
||||
|
||||
@@ -870,6 +870,23 @@ u64 cleonos_syscall(u64 id, u64 arg0, u64 arg1, u64 arg2);
|
||||
- `arg0`: `u64 window_id`
|
||||
- 返回:成功 `1`,失败 `0`
|
||||
- 说明:将目标窗口置为焦点并提升到顶层 z-order。
|
||||
|
||||
### 114 `CLEONOS_SYSCALL_WM_SET_FLAGS`
|
||||
|
||||
- 参数:
|
||||
- `arg0`: `u64 window_id`
|
||||
- `arg1`: `u64 flags`
|
||||
- 返回:成功 `1`,失败 `0`
|
||||
- 说明:
|
||||
- 设置窗口协议标志;当前支持 `CLEONOS_WM_FLAG_TOPMOST`(`bit0`),置位后窗口保持在普通窗口之上。
|
||||
|
||||
### 115 `CLEONOS_SYSCALL_WM_RESIZE`
|
||||
|
||||
- 参数:
|
||||
- `arg0`: `const struct { u64 window_id; u64 width; u64 height; } *req`
|
||||
- 返回:成功 `1`,失败 `0`
|
||||
- 说明:
|
||||
- 调整窗口尺寸并保持 `window_id` 不变;调整后用户态应重新 `WM_PRESENT` 一次提交新尺寸内容。
|
||||
|
||||
## 5. 用户态封装函数
|
||||
|
||||
@@ -919,7 +936,7 @@ u64 cleonos_syscall(u64 id, u64 arg0, u64 arg1, u64 arg2);
|
||||
|
||||
## 7. Wine 兼容说明
|
||||
|
||||
- `wine/cleonos_wine_lib/runner.py` 当前已覆盖到 `0..113`(含 `DL_*`、`FB_*`、`KERNEL_VERSION`、`DISK_*`、`NET_*`、`MOUSE_STATE`、`WM_*`)。
|
||||
- `wine/cleonos_wine_lib/runner.py` 当前已覆盖到 `0..115`(含 `DL_*`、`FB_*`、`KERNEL_VERSION`、`DISK_*`、`NET_*`、`MOUSE_STATE`、`WM_*`)。
|
||||
- `DL_*`(`77..79`)在 Wine 中为“可运行兼容”实现:
|
||||
- `DL_OPEN`:加载 guest ELF 到当前 Unicorn 地址空间,返回稳定 `handle`,并做引用计数。
|
||||
- `DL_SYM`:解析 ELF `SYMTAB/DYNSYM` 并返回 guest 可调用地址。
|
||||
@@ -938,7 +955,7 @@ u64 cleonos_syscall(u64 id, u64 arg0, u64 arg1, u64 arg2);
|
||||
- `DISK_READ_SECTOR`/`DISK_WRITE_SECTOR`(`93..94`)在 Wine 中已实现为 512B 原始扇区读写(host 文件后端)。
|
||||
- 网络 syscall(`95..106`)在 Wine 当前为兼容占位实现(统一返回 `0`);即 Wine 运行模式下不会提供真实网络收发。
|
||||
- `MOUSE_STATE`(`107`)在 Wine 中为基础兼容实现:可返回指针数据结构;未启用窗口鼠标事件时 `ready` 可能为 `0`。
|
||||
- `WM_*`(`108..113`)在 Wine 当前为兼容占位实现(统一返回 `0`);不会创建真实窗口服务。
|
||||
- `WM_*`(`108..115`)在 Wine 当前为兼容占位实现(统一返回 `0`);不会创建真实窗口服务。
|
||||
- Wine 在运行时崩溃场景下会生成与内核一致格式的“信号编码退出状态”,可通过 `WAITPID` 读取。
|
||||
- Wine 当前音频 syscall 为占位实现:`AUDIO_AVAILABLE=0`,`AUDIO_PLAY_TONE=0`,`AUDIO_STOP=1`。
|
||||
- Wine 版本号策略固定为 `85.0.0-wine`(历史兼容号;不会随 syscall 扩展继续增长)。
|
||||
|
||||
Reference in New Issue
Block a user