From b2147f8b894494208cae6b3415c1a8012ca8c67c Mon Sep 17 00:00:00 2001 From: Ivan Baravy Date: Wed, 19 Jul 2023 23:23:19 +0100 Subject: [PATCH] Sync wdata structure with upstream --- shell.c | 31 +++++++++++++++++----- test/016_#f01_#draw_all.ref.log | 7 ++--- test/016_#f01_#draw_all.t | 1 + test/066_#f01_#draw_#draw16bit_all.ref.log | 7 ++--- test/066_#f01_#draw_#draw16bit_all.t | 1 + test/067_#f01_#draw_#draw24bit_all.ref.log | 7 ++--- test/067_#f01_#draw_#draw24bit_all.t | 1 + test/{t068 => d068}/ref.log | 0 test/{t068 => d068}/run.us | 2 +- test/{t068 => d068}/tags.txt | 0 test/{t068 => d068}/timeout.txt | 0 test/t016/ref.log | 7 ++--- test/t016/run.us | 1 + test/t066/ref.log | 7 ++--- test/t066/run.us | 1 + test/t067/ref.log | 7 ++--- test/t067/run.us | 1 + umka.h | 21 +++++++++------ 18 files changed, 68 insertions(+), 34 deletions(-) rename test/{t068 => d068}/ref.log (100%) rename test/{t068 => d068}/run.us (89%) rename test/{t068 => d068}/tags.txt (100%) rename test/{t068 => d068}/timeout.txt (100%) diff --git a/shell.c b/shell.c index 61a8ecd..837d4b4 100644 --- a/shell.c +++ b/shell.c @@ -701,12 +701,14 @@ cmd_wait_for_os_idle(struct shell_ctx *ctx, int argc, char **argv) { static uint32_t umka_wait_for_window_test(void) { appdata_t *app; + wdata_t *wdata; __asm__ __volatile__ __inline__ ("":"=b"(app)::); const char *wnd_title = (const char *)app->wait_param; for (size_t i = 0; i < 256; i++) { app = kos_slot_base + i; - if (app->state != KOS_TSTATE_FREE && app->wnd_caption - && !strcmp(app->wnd_caption, wnd_title)) { + wdata = kos_window_data + i; + if (app->state != KOS_TSTATE_FREE && wdata->caption + && !strcmp(wdata->caption, wnd_title)) { return 1; } } @@ -1120,6 +1122,25 @@ cmd_dump_win_map(struct shell_ctx *ctx, int argc, char **argv) { } } +static void +cmd_dump_wdata(struct shell_ctx *ctx, int argc, char **argv) { + (void)ctx; + const char *usage = \ + "usage: dump_wdata \n" + " index index into wdata array to dump\n"; + if (argc < 2) { + fputs(usage, ctx->fout); + return; + } + int idx = strtol(argv[1], NULL, 0); + wdata_t *w = kos_window_data + idx; + + fprintf(ctx->fout, "captionEncoding: %u\n", w->caption_encoding); + fprintf(ctx->fout, "caption: %s\n", w->caption); + fprintf(ctx->fout, "clientbox (ltwh): %u %u %u %u\n", w->clientbox.left, + w->clientbox.top, w->clientbox.width, w->clientbox.height); +} + static void cmd_dump_appdata(struct shell_ctx *ctx, int argc, char **argv) { (void)ctx; @@ -1163,12 +1184,7 @@ cmd_dump_appdata(struct shell_ctx *ctx, int argc, char **argv) { fprintf(ctx->fout, "wnd_number: %" PRIu8 "\n", a->wnd_number); fprintf(ctx->fout, "terminate_protection: %u\n", a->terminate_protection); fprintf(ctx->fout, "keyboard_mode: %u\n", a->keyboard_mode); - fprintf(ctx->fout, "captionEncoding: %u\n", a->captionEncoding); fprintf(ctx->fout, "exec_params: %s\n", a->exec_params); - fprintf(ctx->fout, "wnd_caption: %s\n", a->wnd_caption); - fprintf(ctx->fout, "wnd_clientbox (ltwh): %u %u %u %u\n", a->wnd_clientbox.left, - a->wnd_clientbox.top, a->wnd_clientbox.width, - a->wnd_clientbox.height); fprintf(ctx->fout, "priority: %u\n", a->priority); fprintf(ctx->fout, "in_schedule: prev"); @@ -4197,6 +4213,7 @@ func_table_t cmd_cmds[] = { { "draw_window", cmd_draw_window }, { "dump_appdata", cmd_dump_appdata }, { "dump_key_buff", cmd_dump_key_buff }, + { "dump_wdata", cmd_dump_wdata }, { "dump_win_pos", cmd_dump_win_pos }, { "dump_win_stack", cmd_dump_win_stack }, { "dump_win_map", cmd_dump_win_map }, diff --git a/test/016_#f01_#draw_all.ref.log b/test/016_#f01_#draw_all.ref.log index e040b4e..0d38183 100644 --- a/test/016_#f01_#draw_all.ref.log +++ b/test/016_#f01_#draw_all.ref.log @@ -64,12 +64,13 @@ state: 0x0 wnd_number: 2 terminate_protection: 1 keyboard_mode: 0 -captionEncoding: 0 exec_params: (null) -wnd_caption: -wnd_clientbox (ltwh): 5 24 291 172 priority: 0 in_schedule: prev (2), next (2) +/> dump_wdata 2 +captionEncoding: 0 +caption: +clientbox (ltwh): 5 24 291 172 /> /> process_info -1 cpu_usage: 0 diff --git a/test/016_#f01_#draw_all.t b/test/016_#f01_#draw_all.t index 5221e9a..8e4577a 100644 --- a/test/016_#f01_#draw_all.t +++ b/test/016_#f01_#draw_all.t @@ -33,6 +33,7 @@ set_window_colors 0 0 0 0 0 0 0 0 0 0 dump_win_stack 2 dump_win_pos 2 dump_appdata 2 +dump_wdata 2 process_info -1 get_skin_height diff --git a/test/066_#f01_#draw_#draw16bit_all.ref.log b/test/066_#f01_#draw_#draw16bit_all.ref.log index 31dfa3c..7020459 100644 --- a/test/066_#f01_#draw_#draw16bit_all.ref.log +++ b/test/066_#f01_#draw_#draw16bit_all.ref.log @@ -65,12 +65,13 @@ state: 0x0 wnd_number: 2 terminate_protection: 1 keyboard_mode: 0 -captionEncoding: 0 exec_params: (null) -wnd_caption: -wnd_clientbox (ltwh): 5 24 291 172 priority: 0 in_schedule: prev (2), next (2) +/> dump_wdata 2 +captionEncoding: 0 +caption: +clientbox (ltwh): 5 24 291 172 /> /> process_info -1 cpu_usage: 0 diff --git a/test/066_#f01_#draw_#draw16bit_all.t b/test/066_#f01_#draw_#draw16bit_all.t index 2700974..8fe282a 100644 --- a/test/066_#f01_#draw_#draw16bit_all.t +++ b/test/066_#f01_#draw_#draw16bit_all.t @@ -34,6 +34,7 @@ set_window_colors 0 0 0 0 0 0 0 0 0 0 dump_win_stack 2 dump_win_pos 2 dump_appdata 2 +dump_wdata 2 process_info -1 get_skin_height diff --git a/test/067_#f01_#draw_#draw24bit_all.ref.log b/test/067_#f01_#draw_#draw24bit_all.ref.log index fff6f33..2fdbe09 100644 --- a/test/067_#f01_#draw_#draw24bit_all.ref.log +++ b/test/067_#f01_#draw_#draw24bit_all.ref.log @@ -65,12 +65,13 @@ state: 0x0 wnd_number: 2 terminate_protection: 1 keyboard_mode: 0 -captionEncoding: 0 exec_params: (null) -wnd_caption: -wnd_clientbox (ltwh): 5 24 291 172 priority: 0 in_schedule: prev (2), next (2) +/> dump_wdata 2 +captionEncoding: 0 +caption: +clientbox (ltwh): 5 24 291 172 /> /> process_info -1 cpu_usage: 0 diff --git a/test/067_#f01_#draw_#draw24bit_all.t b/test/067_#f01_#draw_#draw24bit_all.t index a42c101..db6ed11 100644 --- a/test/067_#f01_#draw_#draw24bit_all.t +++ b/test/067_#f01_#draw_#draw24bit_all.t @@ -34,6 +34,7 @@ set_window_colors 0 0 0 0 0 0 0 0 0 0 dump_win_stack 2 dump_win_pos 2 dump_appdata 2 +dump_wdata 2 process_info -1 get_skin_height diff --git a/test/t068/ref.log b/test/d068/ref.log similarity index 100% rename from test/t068/ref.log rename to test/d068/ref.log diff --git a/test/t068/run.us b/test/d068/run.us similarity index 89% rename from test/t068/run.us rename to test/d068/run.us index 4c048e7..a4eba92 100644 --- a/test/t068/run.us +++ b/test/d068/run.us @@ -1,5 +1,5 @@ umka_boot -ramdisk_init ../img/kolibri.raw +ramdisk_init ../../img/kolibri.raw kos_sys_misc_init_heap kos_sys_misc_load_file /sys/fill.cur diff --git a/test/t068/tags.txt b/test/d068/tags.txt similarity index 100% rename from test/t068/tags.txt rename to test/d068/tags.txt diff --git a/test/t068/timeout.txt b/test/d068/timeout.txt similarity index 100% rename from test/t068/timeout.txt rename to test/d068/timeout.txt diff --git a/test/t016/ref.log b/test/t016/ref.log index 0178a96..dc6adbb 100644 --- a/test/t016/ref.log +++ b/test/t016/ref.log @@ -64,12 +64,13 @@ state: 0x0 wnd_number: 2 terminate_protection: 1 keyboard_mode: 0 -captionEncoding: 0 exec_params: (null) -wnd_caption: -wnd_clientbox (ltwh): 5 24 291 172 priority: 0 in_schedule: prev (2), next (2) +/> dump_wdata 2 +captionEncoding: 0 +caption: +clientbox (ltwh): 5 24 291 172 /> /> process_info -1 cpu_usage: 0 diff --git a/test/t016/run.us b/test/t016/run.us index 1e7f71f..7eb110a 100644 --- a/test/t016/run.us +++ b/test/t016/run.us @@ -33,6 +33,7 @@ set_window_colors 0 0 0 0 0 0 0 0 0 0 dump_win_stack 2 dump_win_pos 2 dump_appdata 2 +dump_wdata 2 process_info -1 get_skin_height diff --git a/test/t066/ref.log b/test/t066/ref.log index cf3b061..92c6089 100644 --- a/test/t066/ref.log +++ b/test/t066/ref.log @@ -65,12 +65,13 @@ state: 0x0 wnd_number: 2 terminate_protection: 1 keyboard_mode: 0 -captionEncoding: 0 exec_params: (null) -wnd_caption: -wnd_clientbox (ltwh): 5 24 291 172 priority: 0 in_schedule: prev (2), next (2) +/> dump_wdata 2 +captionEncoding: 0 +caption: +clientbox (ltwh): 5 24 291 172 /> /> process_info -1 cpu_usage: 0 diff --git a/test/t066/run.us b/test/t066/run.us index 157ac4b..3609f73 100644 --- a/test/t066/run.us +++ b/test/t066/run.us @@ -34,6 +34,7 @@ set_window_colors 0 0 0 0 0 0 0 0 0 0 dump_win_stack 2 dump_win_pos 2 dump_appdata 2 +dump_wdata 2 process_info -1 get_skin_height diff --git a/test/t067/ref.log b/test/t067/ref.log index 6d4aae1..4c8e14e 100644 --- a/test/t067/ref.log +++ b/test/t067/ref.log @@ -65,12 +65,13 @@ state: 0x0 wnd_number: 2 terminate_protection: 1 keyboard_mode: 0 -captionEncoding: 0 exec_params: (null) -wnd_caption: -wnd_clientbox (ltwh): 5 24 291 172 priority: 0 in_schedule: prev (2), next (2) +/> dump_wdata 2 +captionEncoding: 0 +caption: +clientbox (ltwh): 5 24 291 172 /> /> process_info -1 cpu_usage: 0 diff --git a/test/t067/run.us b/test/t067/run.us index c0ce8d0..4eed103 100644 --- a/test/t067/run.us +++ b/test/t067/run.us @@ -34,6 +34,7 @@ set_window_colors 0 0 0 0 0 0 0 0 0 0 dump_win_stack 2 dump_win_pos 2 dump_appdata 2 +dump_wdata 2 process_info -1 get_skin_height diff --git a/umka.h b/umka.h index 1e42863..8bdfa14 100644 --- a/umka.h +++ b/umka.h @@ -182,9 +182,15 @@ typedef struct { uint8_t fl_wstate; uint8_t fl_wdrawn; uint8_t fl_redraw; + box_t clientbox; + uint8_t *shape; + uint32_t shape_scale; + char *caption; + uint8_t caption_encoding; + uint8_t pad[3]; } __attribute__((packed)) wdata_t; -static_assert(sizeof(wdata_t) == 0x20, "must be 0x20 bytes long"); +static_assert(sizeof(wdata_t) == 0x40, "must be 0x40 bytes long"); typedef struct { uint32_t frame; @@ -926,8 +932,8 @@ typedef struct { uint8_t state; // +124 uint8_t wnd_number; // +125 uint8_t pad2[2]; // +126 - uint8_t *wnd_shape; // +128 - uint32_t wnd_shape_scale; // +132 + uint32_t pad3; // +128 + uint32_t pad4; // +132 uint32_t mem_start; // +136 uint32_t counter_sum; // +140 box_t saved_box; // +144 @@ -937,18 +943,17 @@ typedef struct { uint32_t debugger_slot; // +172 uint32_t terminate_protection; // +176 uint8_t keyboard_mode; // +180 - uint8_t captionEncoding; // +181 - uint8_t pad3[2]; // +182 + uint8_t pad5[3]; // +181 char *exec_params; // +184 void *dbg_event_mem; // +188 dbg_regs_t dbg_regs; // +192 - char *wnd_caption; // +212 - box_t wnd_clientbox; // +216 + uint32_t pad6; // +212 + uint32_t pad7[4]; // +216 uint32_t priority; // +232 lhead_t in_schedule; // +236 uint32_t counter_add; // +244 uint32_t cpu_usage; // +248 - uint32_t pad4; // +252 + uint32_t pad8; // +252 } appdata_t; static_assert(sizeof(appdata_t) == 256, "must be 0x100 bytes long");