diff --git a/src/os/gfx/linux/os_gfx_linux.c b/src/os/gfx/linux/os_gfx_linux.c index be83091f..c9fd1eba 100644 --- a/src/os/gfx/linux/os_gfx_linux.c +++ b/src/os/gfx/linux/os_gfx_linux.c @@ -136,6 +136,13 @@ os_window_close(OS_Handle handle) if(os_handle_match(handle, os_handle_zero())) {return;} } +internal void +os_window_set_title(OS_Handle window, String8 title) +{ + if(os_handle_match(handle, os_handle_zero())) {return;} + // TODO(rjf) +} + internal void os_window_first_paint(OS_Handle handle) { diff --git a/src/os/gfx/os_gfx.h b/src/os/gfx/os_gfx.h index edb4217b..028a0195 100644 --- a/src/os/gfx/os_gfx.h +++ b/src/os/gfx/os_gfx.h @@ -143,6 +143,7 @@ internal String8 os_get_clipboard_text(Arena *arena); internal OS_Handle os_window_open(Rng2F32 rect, OS_WindowFlags flags, String8 title); internal void os_window_close(OS_Handle window); +internal void os_window_set_title(OS_Handle window, String8 title); internal void os_window_first_paint(OS_Handle window); internal void os_window_focus(OS_Handle window); internal B32 os_window_is_focused(OS_Handle window); diff --git a/src/os/gfx/stub/os_gfx_stub.c b/src/os/gfx/stub/os_gfx_stub.c index 66b3f898..bb89d335 100644 --- a/src/os/gfx/stub/os_gfx_stub.c +++ b/src/os/gfx/stub/os_gfx_stub.c @@ -45,6 +45,11 @@ os_window_close(OS_Handle window) { } +internal void +os_window_set_title(OS_Handle window, String8 title) +{ +} + internal void os_window_first_paint(OS_Handle window) { diff --git a/src/os/gfx/win32/os_gfx_win32.c b/src/os/gfx/win32/os_gfx_win32.c index 4e8daab1..8d2698c6 100644 --- a/src/os/gfx/win32/os_gfx_win32.c +++ b/src/os/gfx/win32/os_gfx_win32.c @@ -1084,6 +1084,16 @@ os_window_close(OS_Handle handle) os_w32_window_release(window); } +internal void +os_window_set_title(OS_Handle handle, String8 title) +{ + Temp scratch = scratch_begin(0, 0); + OS_W32_Window *window = os_w32_window_from_handle(handle); + String16 title16 = str16_from_8(scratch.arena, title); + SetWindowTextW(window->hwnd, (WCHAR *)title16.str); + scratch_end(scratch); +} + internal void os_window_first_paint(OS_Handle window_handle) { diff --git a/src/raddbg/raddbg_core.c b/src/raddbg/raddbg_core.c index 8a4f4b7b..da0c7c05 100644 --- a/src/raddbg/raddbg_core.c +++ b/src/raddbg/raddbg_core.c @@ -5591,6 +5591,13 @@ rd_store_view_paramf(String8 key, char *fmt, ...) //////////////////////////////// //~ rjf: Window Functions +internal String8 +rd_push_window_title(Arena *arena) +{ + String8 result = push_str8f(arena, "%S - %s", str8_skip_last_slash(rd_state->project_path), BUILD_TITLE " (" BUILD_VERSION_STRING_LITERAL " " BUILD_RELEASE_PHASE_STRING_LITERAL ")"); + return result; +} + internal RD_Cfg * rd_window_from_cfg(RD_Cfg *cfg) { @@ -5684,7 +5691,7 @@ rd_window_state_from_cfg(RD_Cfg *cfg) ws->cfg_id = id; ws->arena = arena_alloc(); { - String8 title = str8_lit_comp(BUILD_TITLE_STRING_LITERAL); + String8 title = rd_push_window_title(scratch.arena); ws->os = os_window_open(r2f32p(pos.x, pos.y, pos.x+size.x, pos.y+size.y), (!has_pos*OS_WindowFlag_UseDefaultPosition)|OS_WindowFlag_CustomBorder, title); } ws->r = r_window_equip(ws->os); @@ -12605,6 +12612,16 @@ rd_frame(void) rd_cfg_release(recent_projects.last->v); } } + + //- rjf: update all window titles + if(file_is_okay) + { + String8 window_title = rd_push_window_title(scratch.arena); + for(RD_WindowState *ws = rd_state->first_window_state; ws != &rd_nil_window_state; ws = ws->order_next) + { + os_window_set_title(ws->os, window_title); + } + } }break; //- rjf: writing config changes diff --git a/src/raddbg/raddbg_core.h b/src/raddbg/raddbg_core.h index 8473fb43..e9c3ccc8 100644 --- a/src/raddbg/raddbg_core.h +++ b/src/raddbg/raddbg_core.h @@ -944,6 +944,7 @@ internal void rd_store_view_paramf(String8 key, char *fmt, ...); //////////////////////////////// //~ rjf: Window Functions +internal String8 rd_push_window_title(Arena *arena); internal RD_Cfg *rd_window_from_cfg(RD_Cfg *cfg); internal RD_WindowState *rd_window_state_from_cfg(RD_Cfg *cfg); internal RD_WindowState *rd_window_state_from_os_handle(OS_Handle os); diff --git a/src/raddbg/raddbg_main.c b/src/raddbg/raddbg_main.c index 0fdd7d8d..b13c6406 100644 --- a/src/raddbg/raddbg_main.c +++ b/src/raddbg/raddbg_main.c @@ -180,6 +180,7 @@ // `raddbg_auto_view_rule(DynamicArray, slice)`: declares an // auto-view-rule from source code, rather than from debugger // configuration. +// - The debugger now incorporates the loaded project in all window titles. // - Fixed an annoyance where the debugger would open a console window, even // for graphical programs, causing a flicker. // - Fixed substantial unnecessary memory usage with very large output logs.