This commit is contained in:
2026-04-25 20:14:28 +08:00
3 changed files with 92 additions and 93 deletions

View File

@@ -113,8 +113,7 @@ int ush_uwm_create_window(ush_uwm_window *win) {
int ush_uwm_present_window(const ush_uwm_window *win) {
cleonos_wm_present_req req;
if (win == (const ush_uwm_window *)0 || win->alive == 0 || win->id == 0ULL ||
win->pixels == (ush_uwm_u32 *)0) {
if (win == (const ush_uwm_window *)0 || win->alive == 0 || win->id == 0ULL || win->pixels == (ush_uwm_u32 *)0) {
return 0;
}

View File

@@ -50,49 +50,49 @@ typedef struct cleonos_fb_info {
u64 bpp;
} cleonos_fb_info;
typedef struct cleonos_mouse_state {
u64 x;
u64 y;
u64 buttons;
u64 packet_count;
u64 ready;
} cleonos_mouse_state;
#define CLEONOS_WM_EVENT_FOCUS_GAINED 1ULL
#define CLEONOS_WM_EVENT_FOCUS_LOST 2ULL
#define CLEONOS_WM_EVENT_KEY 3ULL
#define CLEONOS_WM_EVENT_MOUSE_MOVE 4ULL
#define CLEONOS_WM_EVENT_MOUSE_BUTTON 5ULL
typedef struct cleonos_wm_event {
u64 type;
u64 arg0;
u64 arg1;
u64 arg2;
u64 arg3;
} cleonos_wm_event;
typedef struct cleonos_wm_create_req {
u64 x;
u64 y;
u64 width;
u64 height;
u64 flags;
} cleonos_wm_create_req;
typedef struct cleonos_wm_present_req {
u64 window_id;
u64 pixels_ptr;
u64 src_width;
u64 src_height;
u64 src_pitch_bytes;
} cleonos_wm_present_req;
typedef struct cleonos_wm_move_req {
u64 window_id;
u64 x;
u64 y;
} cleonos_wm_move_req;
typedef struct cleonos_mouse_state {
u64 x;
u64 y;
u64 buttons;
u64 packet_count;
u64 ready;
} cleonos_mouse_state;
#define CLEONOS_WM_EVENT_FOCUS_GAINED 1ULL
#define CLEONOS_WM_EVENT_FOCUS_LOST 2ULL
#define CLEONOS_WM_EVENT_KEY 3ULL
#define CLEONOS_WM_EVENT_MOUSE_MOVE 4ULL
#define CLEONOS_WM_EVENT_MOUSE_BUTTON 5ULL
typedef struct cleonos_wm_event {
u64 type;
u64 arg0;
u64 arg1;
u64 arg2;
u64 arg3;
} cleonos_wm_event;
typedef struct cleonos_wm_create_req {
u64 x;
u64 y;
u64 width;
u64 height;
u64 flags;
} cleonos_wm_create_req;
typedef struct cleonos_wm_present_req {
u64 window_id;
u64 pixels_ptr;
u64 src_width;
u64 src_height;
u64 src_pitch_bytes;
} cleonos_wm_present_req;
typedef struct cleonos_wm_move_req {
u64 window_id;
u64 x;
u64 y;
} cleonos_wm_move_req;
typedef struct cleonos_fb_blit_req {
u64 pixels_ptr;
@@ -243,16 +243,16 @@ typedef struct cleonos_net_tcp_recv_req {
#define CLEONOS_SYSCALL_NET_GATEWAY 101ULL
#define CLEONOS_SYSCALL_NET_DNS_SERVER 102ULL
#define CLEONOS_SYSCALL_NET_TCP_CONNECT 103ULL
#define CLEONOS_SYSCALL_NET_TCP_SEND 104ULL
#define CLEONOS_SYSCALL_NET_TCP_RECV 105ULL
#define CLEONOS_SYSCALL_NET_TCP_CLOSE 106ULL
#define CLEONOS_SYSCALL_MOUSE_STATE 107ULL
#define CLEONOS_SYSCALL_WM_CREATE 108ULL
#define CLEONOS_SYSCALL_WM_DESTROY 109ULL
#define CLEONOS_SYSCALL_WM_PRESENT 110ULL
#define CLEONOS_SYSCALL_WM_POLL_EVENT 111ULL
#define CLEONOS_SYSCALL_WM_MOVE 112ULL
#define CLEONOS_SYSCALL_WM_SET_FOCUS 113ULL
#define CLEONOS_SYSCALL_NET_TCP_SEND 104ULL
#define CLEONOS_SYSCALL_NET_TCP_RECV 105ULL
#define CLEONOS_SYSCALL_NET_TCP_CLOSE 106ULL
#define CLEONOS_SYSCALL_MOUSE_STATE 107ULL
#define CLEONOS_SYSCALL_WM_CREATE 108ULL
#define CLEONOS_SYSCALL_WM_DESTROY 109ULL
#define CLEONOS_SYSCALL_WM_PRESENT 110ULL
#define CLEONOS_SYSCALL_WM_POLL_EVENT 111ULL
#define CLEONOS_SYSCALL_WM_MOVE 112ULL
#define CLEONOS_SYSCALL_WM_SET_FOCUS 113ULL
u64 cleonos_syscall(u64 id, u64 arg0, u64 arg1, u64 arg2);
u64 cleonos_sys_log_write(const char *message, u64 length);
@@ -360,14 +360,14 @@ u64 cleonos_sys_net_udp_send(const cleonos_net_udp_send_req *req);
u64 cleonos_sys_net_udp_recv(cleonos_net_udp_recv_req *req);
u64 cleonos_sys_net_tcp_connect(const cleonos_net_tcp_connect_req *req);
u64 cleonos_sys_net_tcp_send(const cleonos_net_tcp_send_req *req);
u64 cleonos_sys_net_tcp_recv(cleonos_net_tcp_recv_req *req);
u64 cleonos_sys_net_tcp_close(u64 poll_budget);
u64 cleonos_sys_mouse_state(cleonos_mouse_state *out_state);
u64 cleonos_sys_wm_create(const cleonos_wm_create_req *req);
u64 cleonos_sys_wm_destroy(u64 window_id);
u64 cleonos_sys_wm_present(const cleonos_wm_present_req *req);
u64 cleonos_sys_wm_poll_event(u64 window_id, cleonos_wm_event *out_event);
u64 cleonos_sys_wm_move(const cleonos_wm_move_req *req);
u64 cleonos_sys_wm_set_focus(u64 window_id);
#endif
u64 cleonos_sys_net_tcp_recv(cleonos_net_tcp_recv_req *req);
u64 cleonos_sys_net_tcp_close(u64 poll_budget);
u64 cleonos_sys_mouse_state(cleonos_mouse_state *out_state);
u64 cleonos_sys_wm_create(const cleonos_wm_create_req *req);
u64 cleonos_sys_wm_destroy(u64 window_id);
u64 cleonos_sys_wm_present(const cleonos_wm_present_req *req);
u64 cleonos_sys_wm_poll_event(u64 window_id, cleonos_wm_event *out_event);
u64 cleonos_sys_wm_move(const cleonos_wm_move_req *req);
u64 cleonos_sys_wm_set_focus(u64 window_id);
#endif

View File

@@ -460,30 +460,30 @@ u64 cleonos_sys_net_tcp_close(u64 poll_budget) {
return cleonos_syscall(CLEONOS_SYSCALL_NET_TCP_CLOSE, poll_budget, 0ULL, 0ULL);
}
u64 cleonos_sys_mouse_state(cleonos_mouse_state *out_state) {
return cleonos_syscall(CLEONOS_SYSCALL_MOUSE_STATE, (u64)out_state, 0ULL, 0ULL);
}
u64 cleonos_sys_wm_create(const cleonos_wm_create_req *req) {
return cleonos_syscall(CLEONOS_SYSCALL_WM_CREATE, (u64)req, 0ULL, 0ULL);
}
u64 cleonos_sys_wm_destroy(u64 window_id) {
return cleonos_syscall(CLEONOS_SYSCALL_WM_DESTROY, window_id, 0ULL, 0ULL);
}
u64 cleonos_sys_wm_present(const cleonos_wm_present_req *req) {
return cleonos_syscall(CLEONOS_SYSCALL_WM_PRESENT, (u64)req, 0ULL, 0ULL);
}
u64 cleonos_sys_wm_poll_event(u64 window_id, cleonos_wm_event *out_event) {
return cleonos_syscall(CLEONOS_SYSCALL_WM_POLL_EVENT, window_id, (u64)out_event, 0ULL);
}
u64 cleonos_sys_wm_move(const cleonos_wm_move_req *req) {
return cleonos_syscall(CLEONOS_SYSCALL_WM_MOVE, (u64)req, 0ULL, 0ULL);
}
u64 cleonos_sys_wm_set_focus(u64 window_id) {
return cleonos_syscall(CLEONOS_SYSCALL_WM_SET_FOCUS, window_id, 0ULL, 0ULL);
}
u64 cleonos_sys_mouse_state(cleonos_mouse_state *out_state) {
return cleonos_syscall(CLEONOS_SYSCALL_MOUSE_STATE, (u64)out_state, 0ULL, 0ULL);
}
u64 cleonos_sys_wm_create(const cleonos_wm_create_req *req) {
return cleonos_syscall(CLEONOS_SYSCALL_WM_CREATE, (u64)req, 0ULL, 0ULL);
}
u64 cleonos_sys_wm_destroy(u64 window_id) {
return cleonos_syscall(CLEONOS_SYSCALL_WM_DESTROY, window_id, 0ULL, 0ULL);
}
u64 cleonos_sys_wm_present(const cleonos_wm_present_req *req) {
return cleonos_syscall(CLEONOS_SYSCALL_WM_PRESENT, (u64)req, 0ULL, 0ULL);
}
u64 cleonos_sys_wm_poll_event(u64 window_id, cleonos_wm_event *out_event) {
return cleonos_syscall(CLEONOS_SYSCALL_WM_POLL_EVENT, window_id, (u64)out_event, 0ULL);
}
u64 cleonos_sys_wm_move(const cleonos_wm_move_req *req) {
return cleonos_syscall(CLEONOS_SYSCALL_WM_MOVE, (u64)req, 0ULL, 0ULL);
}
u64 cleonos_sys_wm_set_focus(u64 window_id) {
return cleonos_syscall(CLEONOS_SYSCALL_WM_SET_FOCUS, window_id, 0ULL, 0ULL);
}