diff --git a/4coder_API/app_functions.h b/4coder_API/app_functions.h index 77ef14d3..efbe8b72 100644 --- a/4coder_API/app_functions.h +++ b/4coder_API/app_functions.h @@ -62,6 +62,7 @@ struct Application_Links; #define SET_THEME_COLORS_SIG(n) void n(Application_Links *app, Theme_Color *colors, int32_t count) #define GET_THEME_COLORS_SIG(n) void n(Application_Links *app, Theme_Color *colors, int32_t count) #define DIRECTORY_GET_HOT_SIG(n) int32_t n(Application_Links *app, char *out, int32_t capacity) +#define DIRECTORY_SET_HOT_SIG(n) bool32 n(Application_Links *app, char *str, int32_t len) #define GET_FILE_LIST_SIG(n) File_List n(Application_Links *app, char *dir, int32_t len) #define FREE_FILE_LIST_SIG(n) void n(Application_Links *app, File_List list) #define SET_GUI_UP_DOWN_KEYS_SIG(n) void n(Application_Links *app, Key_Code up_key, Key_Modifier up_key_modifier, Key_Code down_key, Key_Modifier down_key_modifier) @@ -138,6 +139,7 @@ typedef BUFFER_GET_FONT_SIG(Buffer_Get_Font_Function); typedef SET_THEME_COLORS_SIG(Set_Theme_Colors_Function); typedef GET_THEME_COLORS_SIG(Get_Theme_Colors_Function); typedef DIRECTORY_GET_HOT_SIG(Directory_Get_Hot_Function); +typedef DIRECTORY_SET_HOT_SIG(Directory_Set_Hot_Function); typedef GET_FILE_LIST_SIG(Get_File_List_Function); typedef FREE_FILE_LIST_SIG(Free_File_List_Function); typedef SET_GUI_UP_DOWN_KEYS_SIG(Set_GUI_Up_Down_Keys_Function); @@ -216,6 +218,7 @@ Buffer_Get_Font_Function *buffer_get_font; Set_Theme_Colors_Function *set_theme_colors; Get_Theme_Colors_Function *get_theme_colors; Directory_Get_Hot_Function *directory_get_hot; +Directory_Set_Hot_Function *directory_set_hot; Get_File_List_Function *get_file_list; Free_File_List_Function *free_file_list; Set_GUI_Up_Down_Keys_Function *set_gui_up_down_keys; @@ -293,6 +296,7 @@ Buffer_Get_Font_Function *buffer_get_font_; Set_Theme_Colors_Function *set_theme_colors_; Get_Theme_Colors_Function *get_theme_colors_; Directory_Get_Hot_Function *directory_get_hot_; +Directory_Set_Hot_Function *directory_set_hot_; Get_File_List_Function *get_file_list_; Free_File_List_Function *free_file_list_; Set_GUI_Up_Down_Keys_Function *set_gui_up_down_keys_; @@ -378,6 +382,7 @@ app_links->buffer_get_font_ = Buffer_Get_Font;\ app_links->set_theme_colors_ = Set_Theme_Colors;\ app_links->get_theme_colors_ = Get_Theme_Colors;\ app_links->directory_get_hot_ = Directory_Get_Hot;\ +app_links->directory_set_hot_ = Directory_Set_Hot;\ app_links->get_file_list_ = Get_File_List;\ app_links->free_file_list_ = Free_File_List;\ app_links->set_gui_up_down_keys_ = Set_GUI_Up_Down_Keys;\ @@ -455,6 +460,7 @@ static inline bool32 buffer_get_font(Application_Links *app, Buffer_Summary *buf static inline void set_theme_colors(Application_Links *app, Theme_Color *colors, int32_t count){(app->set_theme_colors(app, colors, count));} static inline void get_theme_colors(Application_Links *app, Theme_Color *colors, int32_t count){(app->get_theme_colors(app, colors, count));} static inline int32_t directory_get_hot(Application_Links *app, char *out, int32_t capacity){return(app->directory_get_hot(app, out, capacity));} +static inline bool32 directory_set_hot(Application_Links *app, char *str, int32_t len){return(app->directory_set_hot(app, str, len));} static inline File_List get_file_list(Application_Links *app, char *dir, int32_t len){return(app->get_file_list(app, dir, len));} static inline void free_file_list(Application_Links *app, File_List list){(app->free_file_list(app, list));} static inline void set_gui_up_down_keys(Application_Links *app, Key_Code up_key, Key_Modifier up_key_modifier, Key_Code down_key, Key_Modifier down_key_modifier){(app->set_gui_up_down_keys(app, up_key, up_key_modifier, down_key, down_key_modifier));} @@ -532,6 +538,7 @@ static inline bool32 buffer_get_font(Application_Links *app, Buffer_Summary *buf static inline void set_theme_colors(Application_Links *app, Theme_Color *colors, int32_t count){(app->set_theme_colors_(app, colors, count));} static inline void get_theme_colors(Application_Links *app, Theme_Color *colors, int32_t count){(app->get_theme_colors_(app, colors, count));} static inline int32_t directory_get_hot(Application_Links *app, char *out, int32_t capacity){return(app->directory_get_hot_(app, out, capacity));} +static inline bool32 directory_set_hot(Application_Links *app, char *str, int32_t len){return(app->directory_set_hot_(app, str, len));} static inline File_List get_file_list(Application_Links *app, char *dir, int32_t len){return(app->get_file_list_(app, dir, len));} static inline void free_file_list(Application_Links *app, File_List list){(app->free_file_list_(app, list));} static inline void set_gui_up_down_keys(Application_Links *app, Key_Code up_key, Key_Modifier up_key_modifier, Key_Code down_key, Key_Modifier down_key_modifier){(app->set_gui_up_down_keys_(app, up_key, up_key_modifier, down_key, down_key_modifier));} diff --git a/4coder_default_bindings.cpp b/4coder_default_bindings.cpp index 7ebc67b9..c0453c4e 100644 --- a/4coder_default_bindings.cpp +++ b/4coder_default_bindings.cpp @@ -27,6 +27,7 @@ default_keys(Bind_Helper *context){ bind(context, 'k', MDFR_CTRL, interactive_kill_buffer); bind(context, 'i', MDFR_CTRL, interactive_switch_buffer); bind(context, 'w', MDFR_CTRL, save_as); + bind(context, 'h', MDFR_CTRL, project_go_to_root_directory); bind(context, 'c', MDFR_ALT, open_color_tweaker); bind(context, 'd', MDFR_ALT, open_debug); @@ -132,7 +133,7 @@ default_keys(Bind_Helper *context){ bind(context, key_mouse_right, MDFR_NONE, click_set_mark); // NOTE(allen|a4.0.11): You can now bind left and right mouse - // button releases. Modifiers do work so control+click shift+click + // button releases. Modifiers do work so control+release shift+release // etc can now have special meanings. bind(context, key_mouse_left_release, MDFR_NONE, click_set_mark); diff --git a/4coder_default_framework.h b/4coder_default_framework.h index 014ce5f1..c1aa331d 100644 --- a/4coder_default_framework.h +++ b/4coder_default_framework.h @@ -294,6 +294,8 @@ struct Project{ bool32 close_all_files_when_project_opens; bool32 open_recursively; + + bool32 loaded; }; static Project null_project = {0}; diff --git a/4coder_project_commands.cpp b/4coder_project_commands.cpp index 7b2a6c7c..3876b581 100644 --- a/4coder_project_commands.cpp +++ b/4coder_project_commands.cpp @@ -187,70 +187,70 @@ CUSTOM_COMMAND_SIG(close_all_code){ } static void -load_project_from_file(Application_Links *app, Partition *part, FILE *file, String project_dir){ +load_project_from_config_data(Application_Links *app, Partition *part, char *config_data, int32_t config_data_size, String project_dir){ Temp_Memory temp = begin_temp_memory(part); - char *mem = 0; - int32_t size = 0; - bool32 file_read_success = file_handle_dump(part, file, &mem, &size); - if (file_read_success){ - Cpp_Token_Array array; - array.count = 0; - array.max_count = (1 << 20)/sizeof(Cpp_Token); - array.tokens = push_array(&global_part, Cpp_Token, array.max_count); + char *mem = config_data; + int32_t size = config_data_size; + + Cpp_Token_Array array; + array.count = 0; + array.max_count = (1 << 20)/sizeof(Cpp_Token); + array.tokens = push_array(part, Cpp_Token, array.max_count); + + Cpp_Keyword_Table kw_table = {0}; + Cpp_Keyword_Table pp_table = {0}; + lexer_keywords_default_init(part, &kw_table, &pp_table); + + Cpp_Lex_Data S = cpp_lex_data_init(false, kw_table, pp_table); + Cpp_Lex_Result result = cpp_lex_step(&S, mem, size+1, HAS_NULL_TERM, &array, NO_OUT_LIMIT); + + if (result == LexResult_Finished){ + // Clear out current project + if (current_project.close_all_code_when_this_project_closes){ + exec_command(app, close_all_code); + } + current_project = null_project; + current_project.loaded = true; - Cpp_Keyword_Table kw_table = {0}; - Cpp_Keyword_Table pp_table = {0}; - lexer_keywords_default_init(part, &kw_table, &pp_table); + // Set new project directory + { + current_project.dir = current_project.dir_space; + String str = make_fixed_width_string(current_project.dir_space); + copy(&str, project_dir); + terminate_with_null(&str); + current_project.dir_len = str.size; + } - Cpp_Lex_Data S = cpp_lex_data_init(false, kw_table, pp_table); - Cpp_Lex_Result result = cpp_lex_step(&S, mem, size+1, HAS_NULL_TERM, &array, NO_OUT_LIMIT); - - if (result == LexResult_Finished){ - // Clear out current project - if (current_project.close_all_code_when_this_project_closes){ - exec_command(app, close_all_code); - } - current_project = null_project; - - // Set new project directory - { - current_project.dir = current_project.dir_space; - String str = make_fixed_width_string(current_project.dir_space); - copy(&str, project_dir); - terminate_with_null(&str); - current_project.dir_len = str.size; - } - - // Read the settings from project.4coder - for (int32_t i = 0; i < array.count; ++i){ - Config_Line config_line = read_config_line(array, &i); - if (config_line.read_success){ - Config_Item item = get_config_item(config_line, mem, array); - - { - char str_space[512]; - String str = make_fixed_width_string(str_space); - if (config_string_var(item, "extensions", 0, &str)){ - if (str.size < sizeof(current_project.extension_list.extension_space)){ - set_extensions(¤t_project.extension_list, str); - print_message(app, str.str, str.size); - print_message(app, "\n", 1); - } - else{ - print_message(app, literal("STRING TOO LONG!\n")); - } + // Read the settings from project.4coder + for (int32_t i = 0; i < array.count; ++i){ + Config_Line config_line = read_config_line(array, &i); + if (config_line.read_success){ + Config_Item item = get_config_item(config_line, mem, array); + + { + char str_space[512]; + String str = make_fixed_width_string(str_space); + if (config_string_var(item, "extensions", 0, &str)){ + if (str.size < sizeof(current_project.extension_list.extension_space)){ + set_extensions(¤t_project.extension_list, str); + print_message(app, str.str, str.size); + print_message(app, "\n", 1); + } + else{ + print_message(app, literal("STRING TOO LONG!\n")); } } - - { - bool32 open_recursively = false; - if (config_bool_var(item, "open_recursively", 0, &open_recursively)){ - current_project.open_recursively = open_recursively; - } + } + + { + bool32 open_recursively = false; + if (config_bool_var(item, "open_recursively", 0, &open_recursively)){ + current_project.open_recursively = open_recursively; } - - { + } + + { #if defined(_WIN32) #define FKEY_COMMAND "fkey_command_win" #elif defined(__linux__) @@ -258,121 +258,120 @@ load_project_from_file(Application_Links *app, Partition *part, FILE *file, Stri #else #error no project configuration names for this platform #endif - - int32_t index = 0; - Config_Array_Reader array_reader = {0}; - if (config_array_var(item, FKEY_COMMAND, &index, &array_reader)){ - if (index >= 1 && index <= 16){ - Config_Item array_item = {0}; - int32_t item_index = 0; + + int32_t index = 0; + Config_Array_Reader array_reader = {0}; + if (config_array_var(item, FKEY_COMMAND, &index, &array_reader)){ + if (index >= 1 && index <= 16){ + Config_Item array_item = {0}; + int32_t item_index = 0; + + char space[256]; + String msg = make_fixed_width_string(space); + append(&msg, FKEY_COMMAND"["); + append_int_to_str(&msg, index); + append(&msg, "] = {"); + + for (config_array_next_item(&array_reader, &array_item); + config_array_good(&array_reader); + config_array_next_item(&array_reader, &array_item)){ - char space[256]; - String msg = make_fixed_width_string(space); - append(&msg, FKEY_COMMAND"["); - append_int_to_str(&msg, index); - append(&msg, "] = {"); - - for (config_array_next_item(&array_reader, &array_item); - config_array_good(&array_reader); - config_array_next_item(&array_reader, &array_item)){ - - if (item_index >= 4){ - break; - } - - append(&msg, "["); - append_int_to_str(&msg, item_index); - append(&msg, "] = "); - - bool32 read_string = false; - bool32 read_bool = false; - - char *dest_str = 0; - int32_t dest_str_size = 0; - - bool32 *dest_bool = 0; - - switch (item_index){ - case 0: - { - dest_str = current_project.fkey_commands[index-1].command; - dest_str_size = sizeof(current_project.fkey_commands[index-1].command); - read_string = true; - }break; - - case 1: - { - dest_str = current_project.fkey_commands[index-1].out; - dest_str_size = sizeof(current_project.fkey_commands[index-1].out); - read_string = true; - }break; - - case 2: - { - dest_bool = ¤t_project.fkey_commands[index-1].use_build_panel; - read_bool = true; - }break; - - case 3: - { - dest_bool = ¤t_project.fkey_commands[index-1].save_dirty_buffers; - read_bool = true; - }break; - } - - if (read_string){ - if (config_int_var(array_item, 0, 0, 0)){ - append(&msg, "NULL, "); - dest_str[0] = 0; - } - - char str_space[512]; - String str = make_fixed_width_string(str_space); - if (config_string_var(array_item, 0, 0, &str)){ - if (str.size < dest_str_size){ - interpret_escaped_string(dest_str, str); - append(&msg, dest_str); - append(&msg, ", "); - } - else{ - append(&msg, "STRING TOO LONG!, "); - } - } - } - - if (read_bool){ - if (config_bool_var(array_item, 0, 0, dest_bool)){ - if (*dest_bool){ - append(&msg, "true, "); - } - else{ - append(&msg, "false, "); - } - } - } - - item_index++; + if (item_index >= 4){ + break; } - append(&msg, "}\n"); - print_message(app, msg.str, msg.size); + append(&msg, "["); + append_int_to_str(&msg, item_index); + append(&msg, "] = "); + + bool32 read_string = false; + bool32 read_bool = false; + + char *dest_str = 0; + int32_t dest_str_size = 0; + + bool32 *dest_bool = 0; + + switch (item_index){ + case 0: + { + dest_str = current_project.fkey_commands[index-1].command; + dest_str_size = sizeof(current_project.fkey_commands[index-1].command); + read_string = true; + }break; + + case 1: + { + dest_str = current_project.fkey_commands[index-1].out; + dest_str_size = sizeof(current_project.fkey_commands[index-1].out); + read_string = true; + }break; + + case 2: + { + dest_bool = ¤t_project.fkey_commands[index-1].use_build_panel; + read_bool = true; + }break; + + case 3: + { + dest_bool = ¤t_project.fkey_commands[index-1].save_dirty_buffers; + read_bool = true; + }break; + } + + if (read_string){ + if (config_int_var(array_item, 0, 0, 0)){ + append(&msg, "NULL, "); + dest_str[0] = 0; + } + + char str_space[512]; + String str = make_fixed_width_string(str_space); + if (config_string_var(array_item, 0, 0, &str)){ + if (str.size < dest_str_size){ + interpret_escaped_string(dest_str, str); + append(&msg, dest_str); + append(&msg, ", "); + } + else{ + append(&msg, "STRING TOO LONG!, "); + } + } + } + + if (read_bool){ + if (config_bool_var(array_item, 0, 0, dest_bool)){ + if (*dest_bool){ + append(&msg, "true, "); + } + else{ + append(&msg, "false, "); + } + } + } + + item_index++; } + + append(&msg, "}\n"); + print_message(app, msg.str, msg.size); } } } } - - if (current_project.close_all_files_when_project_opens){ - close_all_files_with_extension(app, &global_part, 0, 0); - } - - // Open all project files - if (current_project.open_recursively){ - open_all_code_recursive(app, project_dir); - } - else{ - open_all_code(app, project_dir); - } + } + + if (current_project.close_all_files_when_project_opens){ + close_all_files_with_extension(app, part, 0, 0); + } + + // Open all project files + if (current_project.open_recursively){ + open_all_code_recursive(app, project_dir); + } + else{ + open_all_code(app, project_dir); } } @@ -382,6 +381,8 @@ load_project_from_file(Application_Links *app, Partition *part, FILE *file, Stri CUSTOM_COMMAND_SIG(load_project){ Partition *part = &global_part; + Temp_Memory temp = begin_temp_memory(part); + char project_file_space[512]; String project_name = make_fixed_width_string(project_file_space); project_name.size = directory_get_hot(app, project_name.str, project_name.memory_size); @@ -390,7 +391,6 @@ CUSTOM_COMMAND_SIG(load_project){ } if (project_name.size != 0){ - bool32 load_failed = false; for(;;){ int32_t original_size = project_name.size; @@ -401,8 +401,15 @@ CUSTOM_COMMAND_SIG(load_project){ if (file){ project_name.size = original_size; terminate_with_null(&project_name); - load_project_from_file(app, part, file, project_name); + + char *mem = 0; + int32_t size = 0; + bool32 file_read_success = file_handle_dump(part, file, &mem, &size); fclose(file); + + if (file_read_success){ + load_project_from_config_data(app, part, mem, size, project_name); + } break; } else{ @@ -434,6 +441,8 @@ CUSTOM_COMMAND_SIG(load_project){ else{ print_message(app, literal("Failed trying to get project file name")); } + + end_temp_memory(temp); } static void @@ -514,6 +523,12 @@ CUSTOM_COMMAND_SIG(project_fkey_command){ } } +CUSTOM_COMMAND_SIG(project_go_to_root_directory){ + if (current_project.loaded){ + directory_set_hot(app, current_project.dir, current_project.dir_len); + } +} + #endif // BOTTOM diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index 01ed74db..92ffaa82 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -2364,13 +2364,8 @@ Directory_Get_Hot(Application_Links *app, char *out, int32_t capacity) DOC_PARAM(out, This parameter provides a character buffer that receives the 4coder 'hot directory'.) DOC_PARAM(capacity, This parameter specifies the maximum size to be output to the out buffer.) DOC_RETURN(This call returns the size of the string written into the buffer.) -DOC( -4coder has a concept of a 'hot directory' which is the directory most recently -accessed in the GUI. Whenever the GUI is opened it shows the hot directory. - -In the future this will be deprecated and eliminated in favor of more flexible -directories controlled on the custom side. -) +DOC(4coder has a concept of a 'hot directory' which is the directory most recently accessed in the GUI. Whenever the GUI is opened it shows the hot directory. In the future this will be deprecated and eliminated in favor of more flexible directories controlled on the custom side.) +DOC_SEE(directory_set_hot) */{ Command_Data *cmd = (Command_Data*)app->cmd_context; Hot_Directory *hot = &cmd->models->hot_directory; @@ -2384,6 +2379,25 @@ directories controlled on the custom side. return(hot->string.size); } +API_EXPORT bool32 +Directory_Set_Hot(Application_Links *app, char *str, int32_t len) +/* +DOC_PARAM(str, The new value of the hot directory. This does not need to be a null terminated string.) +DOC_PARAM(len, The length of str in bytes.) +DOC_RETURN(Returns non-zero on success.) +DOC(4coder has a concept of a 'hot directory' which is the directory most recently accessed in the GUI. Whenever the GUI is opened it shows the hot directory. In the future this will be deprecated and eliminated in favor of more flexible directories controlled on the custom side.) +DOC_SEE(directory_get_hot) +*/{ + Command_Data *cmd = (Command_Data*)app->cmd_context; + Hot_Directory *hot = &cmd->models->hot_directory; + b32 success = false; + if (len < hot->string.memory_size){ + hot_directory_set(cmd->system, hot, make_string(str, len)); + success = true; + } + return(success); +} + API_EXPORT File_List Get_File_List(Application_Links *app, char *dir, int32_t len) /* diff --git a/site/source_material/binding_list.txt b/site/source_material/binding_list.txt index 08f4b12c..2af700ed 100644 --- a/site/source_material/binding_list.txt +++ b/site/source_material/binding_list.txt @@ -19,6 +19,8 @@ The following bindings apply in all situations. \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Open file dialogue in other panel \END_ITEM \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Kill buffer dialogue \END_ITEM \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Switch open buffer dialogue \END_ITEM + \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE 'Save As' - save file into new name \END_ITEM + \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Set hot directory to projet root directory \END_ITEM \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Open color and font selection GUI \END_ITEM \BEGIN_ITEM \BEGIN_STYLE{code} \END_STYLE Open a debug information GUI \END_ITEM diff --git a/win32_4ed.cpp b/win32_4ed.cpp index f99a7598..c4f5711d 100644 --- a/win32_4ed.cpp +++ b/win32_4ed.cpp @@ -1792,7 +1792,7 @@ Win32Callback(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ memcpy(data[*count].modifiers, control_keys, control_keys_size); ++(*count); - win32vars.got_useful_event = 1; + win32vars.got_useful_event = true; } } }break; @@ -1838,7 +1838,7 @@ Win32Callback(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ memcpy(data[*count].modifiers, control_keys, control_keys_size); ++(*count); - win32vars.got_useful_event = 1; + win32vars.got_useful_event = true; }break; case WM_MOUSEMOVE: @@ -1850,13 +1850,13 @@ Win32Callback(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ win32vars.input_chunk.pers.mouse_x = new_x; win32vars.input_chunk.pers.mouse_y = new_y; - win32vars.got_useful_event = 1; + win32vars.got_useful_event = true; } }break; case WM_MOUSEWHEEL: { - win32vars.got_useful_event = 1; + win32vars.got_useful_event = true; i32 rotation = GET_WHEEL_DELTA_WPARAM(wParam); if (rotation > 0){ win32vars.input_chunk.trans.mouse_wheel = 1; @@ -1868,28 +1868,28 @@ Win32Callback(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ case WM_LBUTTONDOWN: { - win32vars.got_useful_event = 1; + win32vars.got_useful_event = true; win32vars.input_chunk.trans.mouse_l_press = 1; win32vars.input_chunk.pers.mouse_l = 1; }break; case WM_RBUTTONDOWN: { - win32vars.got_useful_event = 1; + win32vars.got_useful_event = true; win32vars.input_chunk.trans.mouse_r_press = 1; win32vars.input_chunk.pers.mouse_r = 1; }break; case WM_LBUTTONUP: { - win32vars.got_useful_event = 1; + win32vars.got_useful_event = true; win32vars.input_chunk.trans.mouse_l_release = 1; win32vars.input_chunk.pers.mouse_l = 0; }break; case WM_RBUTTONUP: { - win32vars.got_useful_event = 1; + win32vars.got_useful_event = true; win32vars.input_chunk.trans.mouse_r_release = 1; win32vars.input_chunk.pers.mouse_r = 0; }break; @@ -1897,7 +1897,7 @@ Win32Callback(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ case WM_KILLFOCUS: case WM_SETFOCUS: { - win32vars.got_useful_event = 1; + win32vars.got_useful_event = true; win32vars.input_chunk.pers.mouse_l = 0; win32vars.input_chunk.pers.mouse_r = 0; @@ -1909,7 +1909,7 @@ Win32Callback(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ case WM_SIZE: { - win32vars.got_useful_event = 1; + win32vars.got_useful_event = true; i32 new_width = LOWORD(lParam); i32 new_height = HIWORD(lParam); @@ -1918,7 +1918,7 @@ Win32Callback(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ case WM_DISPLAYCHANGE: { - win32vars.got_useful_event = 1; + win32vars.got_useful_event = true; LONG_PTR style = GetWindowLongPtr(hwnd, GWL_STYLE); if (!(style & WS_OVERLAPPEDWINDOW)){ @@ -1936,7 +1936,7 @@ Win32Callback(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ case WM_PAINT: { - win32vars.got_useful_event = 1; + win32vars.got_useful_event = true; PAINTSTRUCT ps; HDC hdc = BeginPaint(hwnd, &ps); Win32RedrawScreen(hdc); @@ -1946,13 +1946,13 @@ Win32Callback(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ case WM_CLOSE: case WM_DESTROY: { - win32vars.got_useful_event = 1; + win32vars.got_useful_event = true; win32vars.input_chunk.trans.trying_to_kill = 1; }break; case WM_4coder_ANIMATE: { - win32vars.got_useful_event = 1; + win32vars.got_useful_event = true; }break; case WM_CANCELMODE: