Merge pull request #15 from CLeonOS/codex/style-autofix-24935645521-1

style: auto-format C/C++ sources with clang-format
This commit is contained in:
LeonMMcoset
2026-04-26 00:47:39 +08:00
committed by GitHub
5 changed files with 48 additions and 50 deletions

View File

@@ -16,7 +16,7 @@ static int ush_cmd_help(void) {
ush_writeln(" bmpview <file.bmp> [cols]"); ush_writeln(" bmpview <file.bmp> [cols]");
ush_writeln(" qrcode [--ecc <L|M|Q|H>] <text>"); ush_writeln(" qrcode [--ecc <L|M|Q|H>] <text>");
ush_writeln(" vim [file] (vim-like editor: normal/insert/:w/:q/:wq)"); 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 <file.wav> [steps] [ticks] / wavplay --stop"); ush_writeln(" wavplay <file.wav> [steps] [ticks] / wavplay --stop");
ush_writeln(" fastfetch [--plain]"); ush_writeln(" fastfetch [--plain]");
ush_writeln(" doom [wad_path] (framebuffer bootstrap renderer)"); ush_writeln(" doom [wad_path] (framebuffer bootstrap renderer)");

View File

@@ -1,10 +1,8 @@
#include "uwm.h" #include "uwm.h"
static int ush_uwm_hit_close(const ush_uwm_window *win, int x, int y) { 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 && return (win != (const ush_uwm_window *)0 && x >= win->w - USH_UWM_CONTROL_W && y >= 0 && y < USH_UWM_TITLE_H) ? 1
y < USH_UWM_TITLE_H) : 0;
? 1
: 0;
} }
static int ush_uwm_hit_minimize(const ush_uwm_window *win, int x, int y) { 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) { 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 && return (win != (const ush_uwm_window *)0 && x >= win->w - USH_UWM_RESIZE_GRIP && y >= win->h - USH_UWM_RESIZE_GRIP)
y >= win->h - USH_UWM_RESIZE_GRIP)
? 1 ? 1
: 0; : 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++) { for (i = 0; i < (int)USH_UWM_APP_COUNT; i++) {
ush_uwm_window *app = &sess->windows[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) { if (app->alive != 0 && app->minimized == 0 && sess->active_window == i) {
ush_uwm_minimize_window(sess, i); ush_uwm_minimize_window(sess, i);
} else { } else {

View File

@@ -1,8 +1,8 @@
#include "uwm.h" #include "uwm.h"
#define UWM_GLYPH7(r0, r1, r2, r3, r4, r5, r6) \ #define UWM_GLYPH7(r0, r1, r2, r3, r4, r5, r6) \
(((u64)(r0) << 30U) | ((u64)(r1) << 25U) | ((u64)(r2) << 20U) | ((u64)(r3) << 15U) | \ (((u64)(r0) << 30U) | ((u64)(r1) << 25U) | ((u64)(r2) << 20U) | ((u64)(r3) << 15U) | ((u64)(r4) << 10U) | \
((u64)(r4) << 10U) | ((u64)(r5) << 5U) | (u64)(r6)) ((u64)(r5) << 5U) | (u64)(r6))
#define UWM_COLOR_WHITE 0x00FFFFFFU #define UWM_COLOR_WHITE 0x00FFFFFFU
#define UWM_COLOR_WIN_BLUE 0x000078D7U #define UWM_COLOR_WIN_BLUE 0x000078D7U

View File

@@ -60,11 +60,11 @@ typedef struct cleonos_mouse_state {
#define CLEONOS_WM_EVENT_FOCUS_GAINED 1ULL #define CLEONOS_WM_EVENT_FOCUS_GAINED 1ULL
#define CLEONOS_WM_EVENT_FOCUS_LOST 2ULL #define CLEONOS_WM_EVENT_FOCUS_LOST 2ULL
#define CLEONOS_WM_EVENT_KEY 3ULL #define CLEONOS_WM_EVENT_KEY 3ULL
#define CLEONOS_WM_EVENT_MOUSE_MOVE 4ULL #define CLEONOS_WM_EVENT_MOUSE_MOVE 4ULL
#define CLEONOS_WM_EVENT_MOUSE_BUTTON 5ULL #define CLEONOS_WM_EVENT_MOUSE_BUTTON 5ULL
#define CLEONOS_WM_FLAG_TOPMOST 0x1ULL #define CLEONOS_WM_FLAG_TOPMOST 0x1ULL
typedef struct cleonos_wm_event { typedef struct cleonos_wm_event {
u64 type; u64 type;
@@ -90,17 +90,17 @@ typedef struct cleonos_wm_present_req {
u64 src_pitch_bytes; u64 src_pitch_bytes;
} cleonos_wm_present_req; } cleonos_wm_present_req;
typedef struct cleonos_wm_move_req { typedef struct cleonos_wm_move_req {
u64 window_id; u64 window_id;
u64 x; u64 x;
u64 y; u64 y;
} cleonos_wm_move_req; } cleonos_wm_move_req;
typedef struct cleonos_wm_resize_req { typedef struct cleonos_wm_resize_req {
u64 window_id; u64 window_id;
u64 width; u64 width;
u64 height; u64 height;
} cleonos_wm_resize_req; } cleonos_wm_resize_req;
typedef struct cleonos_fb_blit_req { typedef struct cleonos_fb_blit_req {
u64 pixels_ptr; u64 pixels_ptr;
@@ -258,11 +258,11 @@ typedef struct cleonos_net_tcp_recv_req {
#define CLEONOS_SYSCALL_WM_CREATE 108ULL #define CLEONOS_SYSCALL_WM_CREATE 108ULL
#define CLEONOS_SYSCALL_WM_DESTROY 109ULL #define CLEONOS_SYSCALL_WM_DESTROY 109ULL
#define CLEONOS_SYSCALL_WM_PRESENT 110ULL #define CLEONOS_SYSCALL_WM_PRESENT 110ULL
#define CLEONOS_SYSCALL_WM_POLL_EVENT 111ULL #define CLEONOS_SYSCALL_WM_POLL_EVENT 111ULL
#define CLEONOS_SYSCALL_WM_MOVE 112ULL #define CLEONOS_SYSCALL_WM_MOVE 112ULL
#define CLEONOS_SYSCALL_WM_SET_FOCUS 113ULL #define CLEONOS_SYSCALL_WM_SET_FOCUS 113ULL
#define CLEONOS_SYSCALL_WM_SET_FLAGS 114ULL #define CLEONOS_SYSCALL_WM_SET_FLAGS 114ULL
#define CLEONOS_SYSCALL_WM_RESIZE 115ULL #define CLEONOS_SYSCALL_WM_RESIZE 115ULL
u64 cleonos_syscall(u64 id, u64 arg0, u64 arg1, u64 arg2); u64 cleonos_syscall(u64 id, u64 arg0, u64 arg1, u64 arg2);
u64 cleonos_sys_log_write(const char *message, u64 length); 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_create(const cleonos_wm_create_req *req);
u64 cleonos_sys_wm_destroy(u64 window_id); u64 cleonos_sys_wm_destroy(u64 window_id);
u64 cleonos_sys_wm_present(const cleonos_wm_present_req *req); 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_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_move(const cleonos_wm_move_req *req);
u64 cleonos_sys_wm_set_focus(u64 window_id); u64 cleonos_sys_wm_set_focus(u64 window_id);
u64 cleonos_sys_wm_set_flags(u64 window_id, u64 flags); u64 cleonos_sys_wm_set_flags(u64 window_id, u64 flags);
u64 cleonos_sys_wm_resize(const cleonos_wm_resize_req *req); u64 cleonos_sys_wm_resize(const cleonos_wm_resize_req *req);
#endif #endif

View File

@@ -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); return cleonos_syscall(CLEONOS_SYSCALL_WM_MOVE, (u64)req, 0ULL, 0ULL);
} }
u64 cleonos_sys_wm_set_focus(u64 window_id) { u64 cleonos_sys_wm_set_focus(u64 window_id) {
return cleonos_syscall(CLEONOS_SYSCALL_WM_SET_FOCUS, window_id, 0ULL, 0ULL); return cleonos_syscall(CLEONOS_SYSCALL_WM_SET_FOCUS, window_id, 0ULL, 0ULL);
} }
u64 cleonos_sys_wm_set_flags(u64 window_id, u64 flags) { u64 cleonos_sys_wm_set_flags(u64 window_id, u64 flags) {
return cleonos_syscall(CLEONOS_SYSCALL_WM_SET_FLAGS, window_id, flags, 0ULL); return cleonos_syscall(CLEONOS_SYSCALL_WM_SET_FLAGS, window_id, flags, 0ULL);
} }
u64 cleonos_sys_wm_resize(const cleonos_wm_resize_req *req) { u64 cleonos_sys_wm_resize(const cleonos_wm_resize_req *req) {
return cleonos_syscall(CLEONOS_SYSCALL_WM_RESIZE, (u64)req, 0ULL, 0ULL); return cleonos_syscall(CLEONOS_SYSCALL_WM_RESIZE, (u64)req, 0ULL, 0ULL);
} }