diff --git a/src/df/gfx/df_views.c b/src/df/gfx/df_views.c index 00c0b26a7..cf8a3da67 100644 --- a/src/df/gfx/df_views.c +++ b/src/df/gfx/df_views.c @@ -847,6 +847,15 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW } } + // check if edit is still live and focus is on the same panel + if(ui_is_focus_active()) + { + ui_set_focus_editing(ewv->input_editing); + } + if(ewv->input_editing && !ui_is_focus_active()) + { + ui_unset_focus_editing(); + } ////////////////////////////// //- rjf: build ui // @@ -1538,6 +1547,7 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW if(edit_end) { ewv->input_editing = 0; + ui_unset_focus_editing(); } ////////////////////////////// @@ -2916,6 +2926,15 @@ DF_VIEW_UI_FUNCTION_DEF(Target) } } } + // check if edit is still live and focus is on the same panel + if(ui_is_focus_active()) + { + ui_set_focus_editing(tv->input_editing); + } + if(tv->input_editing && !ui_is_focus_active()) + { + ui_unset_focus_editing(); + } //- rjf: build Rng1S64 visible_row_range = {0}; @@ -3086,6 +3105,7 @@ DF_VIEW_UI_FUNCTION_DEF(Target) if(edit_end) { tv->input_editing = 0; + ui_unset_focus_editing(); } if(edit_submit) { @@ -3366,6 +3386,16 @@ DF_VIEW_UI_FUNCTION_DEF(FilePathMap) } } } + + // check if edit is still live and focus is on the same panel + if(ui_is_focus_active()) + { + ui_set_focus_editing(fpms->input_editing); + } + if(fpms->input_editing && !ui_is_focus_active()) + { + ui_unset_focus_editing(); + } //- rjf: build DF_Handle commit_map = df_handle_zero(); @@ -3576,6 +3606,7 @@ DF_VIEW_UI_FUNCTION_DEF(FilePathMap) if(edit_end) { fpms->input_editing = 0; + ui_unset_focus_editing(); } //- rjf: move down one row if submitted @@ -4154,6 +4185,16 @@ DF_VIEW_UI_FUNCTION_DEF(Modules) edit_submit = 1; } } + + // check if edit is still live and focus is on the same panel + if(ui_is_focus_active()) + { + ui_set_focus_editing(mv->txt_editing); + } + if(mv->txt_editing && !ui_is_focus_active()) + { + ui_unset_focus_editing(); + } //- rjf: build table DF_Entity *commit_module = &df_g_nil_entity; @@ -4311,6 +4352,7 @@ DF_VIEW_UI_FUNCTION_DEF(Modules) if(edit_end) { mv->txt_editing = 0; + ui_unset_focus_editing(); } //- rjf: selected num -> selected entity diff --git a/src/raddbg/raddbg.c b/src/raddbg/raddbg.c index b70ac1c9b..92e3ebb8d 100644 --- a/src/raddbg/raddbg.c +++ b/src/raddbg/raddbg.c @@ -157,7 +157,22 @@ update_and_render(OS_Handle repaint_window_handle, void *user_data) { next = event->next; DF_Window *ws = df_window_from_os_handle(event->window); - if(ws == 0) + + DF_CmdQueryRule query_rule = DF_CmdQueryRule_Null; + // check if focused panel has an active command query + { + DF_Panel *panel = ws->focused_panel; + if(!df_panel_is_nil(panel)) + { + DF_View *view = df_selected_view_from_panel(panel); + if(!df_view_is_nil(view)) + { + query_rule = view->cmd_spec->info.query_rule; + } + } + } + + if(ws == 0 || ui_is_focus_editing() || query_rule != DF_CmdQueryRule_Null) { continue; } diff --git a/src/ui/ui_core.c b/src/ui/ui_core.c index 7e9760de0..a94578c8e 100644 --- a/src/ui/ui_core.c +++ b/src/ui/ui_core.c @@ -1720,6 +1720,18 @@ ui_unset_focus_hot(void) ui_state->focus_hot_is_possible = 0; } +internal void +ui_set_focus_editing(B32 check) +{ + ui_state->focus_editing_is_set = check; +} + +internal void +ui_unset_focus_editing(void) +{ + ui_state->focus_editing_is_set = 0; +} + internal B32 ui_is_focus_active(void) { @@ -1762,6 +1774,13 @@ ui_is_focus_hot(void) return result; } +internal B32 +ui_is_focus_editing(void) +{ + B32 result = ui_state->focus_editing_is_set; + return result; +} + //- rjf: implicit auto-managed tree-based focus state internal B32 diff --git a/src/ui/ui_core.h b/src/ui/ui_core.h index 4e6426293..9788a26a7 100644 --- a/src/ui/ui_core.h +++ b/src/ui/ui_core.h @@ -417,6 +417,7 @@ struct UI_State B32 focus_hot_is_possible; B32 focus_active_is_set; B32 focus_active_is_possible; + B32 focus_editing_is_set; //- rjf: build phase stacks UI_StackDecls; @@ -562,8 +563,12 @@ internal void ui_set_focus_active(B32 check); internal void ui_unset_focus_active(void); internal void ui_set_focus_hot(B32 check); internal void ui_unset_focus_hot(void); +internal void ui_set_focus_editing(B32 check); +internal void ui_unset_focus_editing(void); internal B32 ui_is_focus_active(void); internal B32 ui_is_focus_hot(void); +internal B32 ui_is_focus_editing(void); + //- rjf: implicit auto-managed tree-based focus state internal B32 ui_is_key_auto_focus_active(UI_Key key);