From a1c79c5313b00b8cdffb359a5f7164cabe01f81c Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Thu, 30 Nov 2017 11:50:39 -0500 Subject: [PATCH] Some of the work is done on getting the window title thing working --- 4ed.cpp | 11 ++++++++++- 4ed.h | 2 ++ 4ed_api_implementation.cpp | 3 +-- 4ed_system.h | 4 ---- platform_mac/mac_4ed.cpp | 10 +++++----- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/4ed.cpp b/4ed.cpp index 48fa2ff3..b9b76cfd 100644 --- a/4ed.cpp +++ b/4ed.cpp @@ -193,7 +193,11 @@ struct Command_Data{ System_Functions *system; Live_Views *live_set; - i32 screen_width, screen_height; + i32 screen_width; + i32 screen_height; + + Application_Step_Result *step_result; + Key_Event_Data key; }; @@ -1423,6 +1427,8 @@ App_Init_Sig(app_init){ cmd->system = system; cmd->live_set = &models->live_set; + cmd->step_result = &app_result; + cmd->screen_width = target->width; cmd->screen_height = target->height; @@ -1704,11 +1710,14 @@ App_Step_Sig(app_step){ cmd->system = system; cmd->live_set = &models->live_set; + cmd->step_result = &app_result; + cmd->screen_width = target->width; cmd->screen_height = target->height; cmd->key = null_key_event_data; + // NOTE(allen): First frame initialization if (input->first_step){ // Open command line files. char space[512]; diff --git a/4ed.h b/4ed.h index 952ce91f..5a8a2b54 100644 --- a/4ed.h +++ b/4ed.h @@ -94,6 +94,8 @@ struct Application_Step_Result{ b32 trying_to_kill; b32 perform_kill; b32 animating; + b32 has_new_title; + char *title_string; }; struct Application_Step_Input{ diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index 4c98570c..9c1f092d 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -2833,8 +2833,7 @@ DOC_PARAM(title, A null terminated string indicating the new title for the 4code DOC(Sets 4coder's window title to the specified title string.) */{ Command_Data *cmd = (Command_Data*)app->cmd_context; - System_Functions *system = cmd->system; - system->set_title(title); + } // BOTTOM diff --git a/4ed_system.h b/4ed_system.h index 0b11b762..98ff53a3 100644 --- a/4ed_system.h +++ b/4ed_system.h @@ -212,9 +212,6 @@ typedef Sys_Is_Fullscreen_Sig(System_Is_Fullscreen); #define Sys_Send_Exit_Signal_Sig(name) void name() typedef Sys_Send_Exit_Signal_Sig(System_Send_Exit_Signal); -#define Sys_Set_Title_Sig(n,t) void n(char *t) -typedef Sys_Set_Title_Sig(System_Set_Title, title); - // debug #define Sys_Log_Sig(name) void name(char *message, u32 length) typedef Sys_Log_Sig(System_Log); @@ -277,7 +274,6 @@ struct System_Functions{ System_Set_Fullscreen *set_fullscreen; System_Is_Fullscreen *is_fullscreen; System_Send_Exit_Signal *send_exit_signal; - System_Set_Title *set_title; // debug: 1 System_Log *log; diff --git a/platform_mac/mac_4ed.cpp b/platform_mac/mac_4ed.cpp index 1c12b693..b9182cee 100644 --- a/platform_mac/mac_4ed.cpp +++ b/platform_mac/mac_4ed.cpp @@ -191,11 +191,6 @@ Sys_Send_Exit_Signal_Sig(system_send_exit_signal){ osxvars.keep_running = false; } -internal -Sys_Set_Title_Sig(system_set_title, title){ - osx_change_title(title); -} - #include "4ed_coroutine_functions.cpp" #include "4ed_system_shared.cpp" @@ -642,6 +637,11 @@ osx_step(void){ osxvars.keep_running = true; } + // NOTE(allen): Switch to New Title + if (result.has_new_title){ + osx_change_title(result.title_string); + } + // NOTE(allen): Switch to New Cursor osx_show_cursor(0, result.mouse_cursor_type);