diff --git a/cleonos/c/apps/help_main.c b/cleonos/c/apps/help_main.c index cd34334..30b83a2 100644 --- a/cleonos/c/apps/help_main.c +++ b/cleonos/c/apps/help_main.c @@ -16,7 +16,7 @@ static int ush_cmd_help(void) { ush_writeln(" bmpview [cols]"); ush_writeln(" qrcode [--ecc ] "); ush_writeln(" vim [file] (vim-like editor: normal/insert/:w/:q/:wq)"); - ush_writeln(" uwm (user-space window manager)"); + ush_writeln(" uwm (user-space window manager)"); ush_writeln(" wavplay [steps] [ticks] / wavplay --stop"); ush_writeln(" fastfetch [--plain]"); ush_writeln(" doom [wad_path] (framebuffer bootstrap renderer)"); diff --git a/cleonos/c/apps/uwm/uwm_events.c b/cleonos/c/apps/uwm/uwm_events.c index 53307e1..9502870 100644 --- a/cleonos/c/apps/uwm/uwm_events.c +++ b/cleonos/c/apps/uwm/uwm_events.c @@ -1,10 +1,8 @@ #include "uwm.h" static int ush_uwm_hit_close(const ush_uwm_window *win, int x, int y) { - return (win != (const ush_uwm_window *)0 && x >= win->w - USH_UWM_CONTROL_W && y >= 0 && - y < USH_UWM_TITLE_H) - ? 1 - : 0; + return (win != (const ush_uwm_window *)0 && x >= win->w - USH_UWM_CONTROL_W && y >= 0 && y < USH_UWM_TITLE_H) ? 1 + : 0; } static int ush_uwm_hit_minimize(const ush_uwm_window *win, int x, int y) { @@ -22,8 +20,7 @@ static int ush_uwm_hit_topmost(const ush_uwm_window *win, int x, int y) { } static int ush_uwm_hit_resize(const ush_uwm_window *win, int x, int y) { - return (win != (const ush_uwm_window *)0 && x >= win->w - USH_UWM_RESIZE_GRIP && - y >= win->h - USH_UWM_RESIZE_GRIP) + return (win != (const ush_uwm_window *)0 && x >= win->w - USH_UWM_RESIZE_GRIP && y >= win->h - USH_UWM_RESIZE_GRIP) ? 1 : 0; } @@ -152,7 +149,8 @@ static void ush_uwm_handle_taskbar_click(ush_uwm_session *sess, int local_x, int for (i = 0; i < (int)USH_UWM_APP_COUNT; i++) { ush_uwm_window *app = &sess->windows[i]; - if (local_x >= app_x && local_x < app_x + USH_UWM_TASKBAR_BUTTON_W && local_y >= 5 && local_y < taskbar->h - 5) { + if (local_x >= app_x && local_x < app_x + USH_UWM_TASKBAR_BUTTON_W && local_y >= 5 && + local_y < taskbar->h - 5) { if (app->alive != 0 && app->minimized == 0 && sess->active_window == i) { ush_uwm_minimize_window(sess, i); } else { diff --git a/cleonos/c/apps/uwm/uwm_window.c b/cleonos/c/apps/uwm/uwm_window.c index 33ad400..9f382d9 100644 --- a/cleonos/c/apps/uwm/uwm_window.c +++ b/cleonos/c/apps/uwm/uwm_window.c @@ -1,8 +1,8 @@ #include "uwm.h" -#define UWM_GLYPH7(r0, r1, r2, r3, r4, r5, r6) \ - (((u64)(r0) << 30U) | ((u64)(r1) << 25U) | ((u64)(r2) << 20U) | ((u64)(r3) << 15U) | \ - ((u64)(r4) << 10U) | ((u64)(r5) << 5U) | (u64)(r6)) +#define UWM_GLYPH7(r0, r1, r2, r3, r4, r5, r6) \ + (((u64)(r0) << 30U) | ((u64)(r1) << 25U) | ((u64)(r2) << 20U) | ((u64)(r3) << 15U) | ((u64)(r4) << 10U) | \ + ((u64)(r5) << 5U) | (u64)(r6)) #define UWM_COLOR_WHITE 0x00FFFFFFU #define UWM_COLOR_WIN_BLUE 0x000078D7U diff --git a/cleonos/c/include/cleonos_syscall.h b/cleonos/c/include/cleonos_syscall.h index 1ef742a..4581e72 100644 --- a/cleonos/c/include/cleonos_syscall.h +++ b/cleonos/c/include/cleonos_syscall.h @@ -60,11 +60,11 @@ typedef struct 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 - -#define CLEONOS_WM_FLAG_TOPMOST 0x1ULL +#define CLEONOS_WM_EVENT_KEY 3ULL +#define CLEONOS_WM_EVENT_MOUSE_MOVE 4ULL +#define CLEONOS_WM_EVENT_MOUSE_BUTTON 5ULL + +#define CLEONOS_WM_FLAG_TOPMOST 0x1ULL typedef struct cleonos_wm_event { u64 type; @@ -90,17 +90,17 @@ typedef struct cleonos_wm_present_req { 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_wm_resize_req { - u64 window_id; - u64 width; - u64 height; -} cleonos_wm_resize_req; +typedef struct cleonos_wm_move_req { + u64 window_id; + u64 x; + u64 y; +} cleonos_wm_move_req; + +typedef struct cleonos_wm_resize_req { + u64 window_id; + u64 width; + u64 height; +} cleonos_wm_resize_req; typedef struct cleonos_fb_blit_req { u64 pixels_ptr; @@ -258,11 +258,11 @@ typedef struct cleonos_net_tcp_recv_req { #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_WM_SET_FLAGS 114ULL -#define CLEONOS_SYSCALL_WM_RESIZE 115ULL +#define CLEONOS_SYSCALL_WM_POLL_EVENT 111ULL +#define CLEONOS_SYSCALL_WM_MOVE 112ULL +#define CLEONOS_SYSCALL_WM_SET_FOCUS 113ULL +#define CLEONOS_SYSCALL_WM_SET_FLAGS 114ULL +#define CLEONOS_SYSCALL_WM_RESIZE 115ULL u64 cleonos_syscall(u64 id, u64 arg0, u64 arg1, u64 arg2); u64 cleonos_sys_log_write(const char *message, u64 length); @@ -376,10 +376,10 @@ 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); -u64 cleonos_sys_wm_set_flags(u64 window_id, u64 flags); -u64 cleonos_sys_wm_resize(const cleonos_wm_resize_req *req); - -#endif +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); +u64 cleonos_sys_wm_set_flags(u64 window_id, u64 flags); +u64 cleonos_sys_wm_resize(const cleonos_wm_resize_req *req); + +#endif diff --git a/cleonos/c/src/syscall.c b/cleonos/c/src/syscall.c index 60e6a22..e326161 100644 --- a/cleonos/c/src/syscall.c +++ b/cleonos/c/src/syscall.c @@ -484,14 +484,14 @@ 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_wm_set_flags(u64 window_id, u64 flags) { - return cleonos_syscall(CLEONOS_SYSCALL_WM_SET_FLAGS, window_id, flags, 0ULL); -} - -u64 cleonos_sys_wm_resize(const cleonos_wm_resize_req *req) { - return cleonos_syscall(CLEONOS_SYSCALL_WM_RESIZE, (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_wm_set_flags(u64 window_id, u64 flags) { + return cleonos_syscall(CLEONOS_SYSCALL_WM_SET_FLAGS, window_id, flags, 0ULL); +} + +u64 cleonos_sys_wm_resize(const cleonos_wm_resize_req *req) { + return cleonos_syscall(CLEONOS_SYSCALL_WM_RESIZE, (u64)req, 0ULL, 0ULL); +}