UI Killing now works

master
Allen Webster 2019-11-06 18:09:16 -08:00
parent 9bfcdc66a8
commit 0bae74aa48
2 changed files with 39 additions and 6 deletions

View File

@ -1664,6 +1664,18 @@ view_set_mark(Application_Links *app, View_ID view_id, Buffer_Seek seek)
return(result); return(result);
} }
api(custom) function b32
view_quit_ui(Application_Links *app, View_ID view_id){
Models *models = (Models*)app->cmd_context;
View *view = imp_get_view(models, view_id);
b32 result = false;
if (view != 0){
view_quit_ui(app->tctx, models, view);
result = true;
}
return(result);
}
api(custom) function b32 api(custom) function b32
view_set_buffer(Application_Links *app, View_ID view_id, Buffer_ID buffer_id, Set_Buffer_Flag flags) view_set_buffer(Application_Links *app, View_ID view_id, Buffer_ID buffer_id, Set_Buffer_Flag flags)
{ {
@ -1676,8 +1688,7 @@ view_set_buffer(Application_Links *app, View_ID view_id, Buffer_ID buffer_id, Se
if (file != view->file){ if (file != view->file){
view_set_file(app->tctx, models, view, file); view_set_file(app->tctx, models, view, file);
if (!(flags & SetBuffer_KeepOriginalGUI)){ if (!(flags & SetBuffer_KeepOriginalGUI)){
//view_quit_ui(models, view); view_quit_ui(app->tctx, models, view);
// TODO(allen): back to base context
} }
} }
result = true; result = true;

View File

@ -594,9 +594,9 @@ view_check_co_exited(Models *models, View *view){
if (view->co == 0){ if (view->co == 0){
b32 result = view_close(models, view); b32 result = view_close(models, view);
// TODO(allen): Here it looks like the final view has // TODO(allen): Here it looks like the final view has
// closed exited from it's event handler. We should probably // exited from it's event handler. We should probably
// have a failsafe restarter for the event handler when this // have a failsafe restarter for the event handler when
// happens. // this happens.
Assert(result); Assert(result);
} }
} }
@ -619,10 +619,10 @@ co_full_abort(Thread_Context *tctx, Models *models, View *view){
co = co_run(tctx, models, co, &in, &view->co_out); co = co_run(tctx, models, co, &in, &view->co_out);
} }
if (co != 0){ if (co != 0){
#define M "SERIOUS ERROR: full stack abort did not complete"
Application_Links app = {}; Application_Links app = {};
app.tctx = tctx; app.tctx = tctx;
app.cmd_context = models; app.cmd_context = models;
#define M "SERIOUS ERROR: full stack abort did not complete"
print_message(&app, string_u8_litexpr(M)); print_message(&app, string_u8_litexpr(M));
#undef M #undef M
} }
@ -708,6 +708,28 @@ co_send_core_event(Thread_Context *tctx, Models *models, Core_Code code){
//////////////////////////////// ////////////////////////////////
function void
view_quit_ui(Thread_Context *tctx, Models *models, View *view){
for (u32 j = 0;; j += 1){
if (j == 100){
Application_Links app = {};
app.tctx = tctx;
app.cmd_context = models;
#define M "SERIOUS ERROR: view quit ui did not complete"
print_message(&app, string_u8_litexpr(M));
#undef M
break;
}
View_Context_Node *ctx = view->ctx;
if (ctx->next == 0){
break;
}
co_single_abort(tctx, models, view);
}
}
////////////////////////////////
internal b32 internal b32
file_is_viewed(Layout *layout, Editing_File *file){ file_is_viewed(Layout *layout, Editing_File *file){
b32 is_viewed = false; b32 is_viewed = false;