Sync wdata structure with upstream

This commit is contained in:
Ivan Baravy 2023-07-19 23:23:19 +01:00
parent d6081382bc
commit b2147f8b89
18 changed files with 68 additions and 34 deletions

31
shell.c
View File

@ -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 <index>\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 },

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

21
umka.h
View File

@ -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");