mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
record & restore target window on runs
This commit is contained in:
@@ -327,6 +327,23 @@ os_dpi_from_window(OS_Handle handle)
|
||||
return 96.f;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks External Windows (Implemented Per-OS)
|
||||
|
||||
internal OS_Handle
|
||||
os_focused_external_window(void)
|
||||
{
|
||||
OS_Handle result = {0};
|
||||
// TODO(rjf)
|
||||
return result;
|
||||
}
|
||||
|
||||
internal void
|
||||
os_focus_external_window(OS_Handle handle)
|
||||
{
|
||||
// TODO(rjf)
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Monitors (Implemented Per-OS)
|
||||
|
||||
|
||||
@@ -163,6 +163,12 @@ internal Rng2F32 os_rect_from_window(OS_Handle window);
|
||||
internal Rng2F32 os_client_rect_from_window(OS_Handle window);
|
||||
internal F32 os_dpi_from_window(OS_Handle window);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks External Windows (Implemented Per-OS)
|
||||
|
||||
internal OS_Handle os_focused_external_window(void);
|
||||
internal void os_focus_external_window(OS_Handle handle);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Monitors (Implemented Per-OS)
|
||||
|
||||
|
||||
@@ -149,6 +149,23 @@ os_dpi_from_window(OS_Handle window)
|
||||
return 96.f;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks External Windows (Implemented Per-OS)
|
||||
|
||||
internal OS_Handle
|
||||
os_focused_external_window(void)
|
||||
{
|
||||
OS_Handle result = {0};
|
||||
// TODO(rjf)
|
||||
return result;
|
||||
}
|
||||
|
||||
internal void
|
||||
os_focus_external_window(OS_Handle handle)
|
||||
{
|
||||
// TODO(rjf)
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Monitors (Implemented Per-OS)
|
||||
|
||||
|
||||
@@ -1367,6 +1367,25 @@ os_dpi_from_window(OS_Handle handle)
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks External Windows (Implemented Per-OS)
|
||||
|
||||
internal OS_Handle
|
||||
os_focused_external_window(void)
|
||||
{
|
||||
HWND hwnd = GetForegroundWindow();
|
||||
OS_Handle result = {(U64)hwnd};
|
||||
return result;
|
||||
}
|
||||
|
||||
internal void
|
||||
os_focus_external_window(OS_Handle handle)
|
||||
{
|
||||
HWND hwnd = (HWND)handle.u64[0];
|
||||
SetForegroundWindow(hwnd);
|
||||
SetFocus(hwnd);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Monitors (Implemented Per-OS)
|
||||
|
||||
|
||||
+10
-2
@@ -999,7 +999,11 @@ rb_thread_entry_point(void *p)
|
||||
for(RB_FileNode *n = input_files.first; n != 0; n = n->next)
|
||||
{
|
||||
RB_File *f = n->v;
|
||||
str8_list_pushf(arena, &output_blobs, "// %S (%S)\n\n", deterministic ? str8_skip_last_slash(f->path) : f->path, f->format ? rb_file_format_display_name_table[f->format] : str8_lit("Unsupported format"));
|
||||
if(lane_idx() == 0)
|
||||
{
|
||||
str8_list_pushf(arena, &output_blobs, "// %S (%S)\n\n", deterministic ? str8_skip_last_slash(f->path) : f->path, f->format ? rb_file_format_display_name_table[f->format] : str8_lit("Unsupported format"));
|
||||
}
|
||||
lane_sync();
|
||||
|
||||
//- rjf: unpack file parses
|
||||
Arch arch = Arch_Null;
|
||||
@@ -1105,7 +1109,11 @@ rb_thread_entry_point(void *p)
|
||||
//- rjf: dump file extension info
|
||||
if(f->format_flags & RB_FileFormatFlag_HasDWARF)
|
||||
{
|
||||
str8_list_pushf(arena, &output_blobs, "// %S (%S) (DWARF)\n\n", deterministic ? str8_skip_last_slash(f->path) : f->path, f->format ? rb_file_format_display_name_table[f->format] : str8_lit("Unsupported format"));
|
||||
if(lane_idx() == 0)
|
||||
{
|
||||
str8_list_pushf(arena, &output_blobs, "// %S (%S) (DWARF)\n\n", deterministic ? str8_skip_last_slash(f->path) : f->path, f->format ? rb_file_format_display_name_table[f->format] : str8_lit("Unsupported format"));
|
||||
}
|
||||
lane_sync();
|
||||
{
|
||||
String8List dump = dw_dump_list_from_sections(arena, &dw, arch, dw_dump_subset_flags);
|
||||
if(lane_idx() == 0)
|
||||
|
||||
@@ -12807,6 +12807,12 @@ rd_frame(void)
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: run -> refocus pre-stop focused window
|
||||
if(kind == RD_CmdKind_Run)
|
||||
{
|
||||
os_focus_external_window(rd_state->prestop_focused_window);
|
||||
}
|
||||
|
||||
// rjf: run -> no active targets, no processes, but we only have one target? -> just launch it, then select it
|
||||
if((kind == RD_CmdKind_Run ||
|
||||
kind == RD_CmdKind_StepInto ||
|
||||
@@ -17071,6 +17077,7 @@ rd_frame(void)
|
||||
}
|
||||
if(ws != &rd_nil_window_state)
|
||||
{
|
||||
rd_state->prestop_focused_window = os_focused_external_window();
|
||||
os_window_set_minimized(ws->os, 0);
|
||||
os_window_bring_to_front(ws->os);
|
||||
os_window_focus(ws->os);
|
||||
|
||||
@@ -705,6 +705,9 @@ struct RD_State
|
||||
B32 bind_change_active;
|
||||
RD_CfgID bind_change_binding_id;
|
||||
String8 bind_change_cmd_name;
|
||||
|
||||
// rjf: pre-stop focused window
|
||||
OS_Handle prestop_focused_window;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user