fix debug engine incorrectly using visual run state to soft halt, when ctrl thread did not necessarily report it was running; was leading to 'phantom halts'; other small fixes, dead code elimination, and begin sketching out proper cross-window drag/drop

This commit is contained in:
Ryan Fleury
2024-09-16 17:09:41 -07:00
parent 3cf27169b6
commit 4b382777e9
9 changed files with 78 additions and 52 deletions
+15
View File
@@ -424,6 +424,7 @@ ui_state_alloc(void)
Arena *arena = arena_alloc();
UI_State *ui = push_array(arena, UI_State, 1);
ui->arena = arena;
ui->external_key = ui_key_from_string(ui_key_zero(), str8_lit("###external_interaction_key###"));
ui->build_arenas[0] = arena_alloc();
ui->build_arenas[1] = arena_alloc();
ui->drag_state_arena = arena_alloc();
@@ -832,6 +833,19 @@ ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, U
}
}
//- rjf: detect external press & holds
for(EachEnumVal(UI_MouseButtonKind, k))
{
if(ui_key_match(ui_state->active_box_key[k], ui_key_zero()) && os_key_is_down(OS_Key_LeftMouseButton+k))
{
ui_state->active_box_key[k] = ui_state->external_key;
}
else if(ui_key_match(ui_state->active_box_key[k], ui_state->external_key) && !os_key_is_down(OS_Key_LeftMouseButton+k))
{
ui_state->active_box_key[k] = ui_key_zero();
}
}
//- rjf: fill build phase parameters
{
ui_state->events = events;
@@ -1435,6 +1449,7 @@ ui_end_build(void)
}
//- rjf: hover cursor
if(!ui_key_match(ui_state->active_box_key[UI_MouseButtonKind_Left], ui_state->external_key))
{
UI_Box *hot = ui_box_from_key(ui_state->hot_box_key);
UI_Box *active = ui_box_from_key(ui_state->active_box_key[UI_MouseButtonKind_Left]);
+3
View File
@@ -625,6 +625,9 @@ struct UI_State
//- rjf: main arena
Arena *arena;
//- rjf: fixed keys
UI_Key external_key;
//- rjf: build arenas
Arena *build_arenas[2];
U64 build_index;