fix debug engine incorrectly using visual run state to soft halt, when ctrl thread did not necessarily report it was running; was leading to 'phantom halts'; other small fixes, dead code elimination, and begin sketching out proper cross-window drag/drop

This commit is contained in:
Ryan Fleury
2024-09-16 17:09:41 -07:00
parent 3cf27169b6
commit 4b382777e9
9 changed files with 78 additions and 52 deletions
+6
View File
@@ -448,6 +448,12 @@ os_get_modifiers(void)
return 0;
}
internal B32
os_key_is_down(OS_Key key)
{
return 0;
}
internal Vec2F32
os_mouse_from_window(OS_Handle handle)
{
+2 -1
View File
@@ -173,7 +173,8 @@ internal Vec2F32 os_dim_from_monitor(OS_Handle monitor);
internal void os_send_wakeup_event(void);
internal OS_EventList os_get_events(Arena *arena, B32 wait);
internal OS_Modifiers os_get_modifiers(void);
internal OS_Modifiers os_get_modifiers(void);
internal B32 os_key_is_down(OS_Key key);
internal Vec2F32 os_mouse_from_window(OS_Handle window);
////////////////////////////////
+6
View File
@@ -197,6 +197,12 @@ os_get_modifiers(void)
return f;
}
internal B32
os_key_is_down(OS_Key key)
{
return 0;
}
internal Vec2F32
os_mouse_from_window(OS_Handle window)
{
+40 -25
View File
@@ -314,6 +314,9 @@ os_w32_vkey_from_os_key(OS_Key key)
vkey_table[OS_Key_Num7] = VK_NUMPAD7;
vkey_table[OS_Key_Num8] = VK_NUMPAD8;
vkey_table[OS_Key_Num9] = VK_NUMPAD9;
vkey_table[OS_Key_LeftMouseButton] = VK_LBUTTON;
vkey_table[OS_Key_MiddleMouseButton] = VK_MBUTTON;
vkey_table[OS_Key_RightMouseButton] = VK_RBUTTON;
}
result = vkey_table[key];
}
@@ -356,10 +359,10 @@ os_w32_wnd_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
case WM_SIZE:
case WM_PAINT:
{
{
PAINTSTRUCT ps = {0};
BeginPaint(hwnd, &ps);
update();
update();
EndPaint(hwnd, &ps);
}break;
@@ -533,27 +536,27 @@ os_w32_wnd_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
F32 new_dpi = (F32)(wParam & 0xffff);
window->dpi = new_dpi;
}break;
//- rjf: [file drop]
case WM_DROPFILES:
{
HDROP drop = (HDROP)wParam;
POINT drop_pt = {0};
DragQueryPoint(drop, &drop_pt);
ScreenToClient(window->hwnd, &drop_pt);
U64 num_files_dropped = DragQueryFile(drop, 0xffffffff, 0, 0);
OS_Event *event = os_w32_push_event(OS_EventKind_FileDrop, window);
event->pos = v2f32((F32)drop_pt.x, (F32)drop_pt.y);
for(U64 idx = 0; idx < num_files_dropped; idx += 1)
{
U64 name_size = DragQueryFile(drop, idx, 0, 0) + 1;
U8 *name_ptr = push_array(os_w32_event_arena, U8, name_size);
DragQueryFile(drop, idx, (char *)name_ptr, name_size);
str8_list_push(os_w32_event_arena, &event->strings, str8(name_ptr, name_size));
}
DragFinish(drop);
}break;
//- rjf: [file drop]
case WM_DROPFILES:
{
HDROP drop = (HDROP)wParam;
POINT drop_pt = {0};
DragQueryPoint(drop, &drop_pt);
ScreenToClient(window->hwnd, &drop_pt);
U64 num_files_dropped = DragQueryFile(drop, 0xffffffff, 0, 0);
OS_Event *event = os_w32_push_event(OS_EventKind_FileDrop, window);
event->pos = v2f32((F32)drop_pt.x, (F32)drop_pt.y);
for(U64 idx = 0; idx < num_files_dropped; idx += 1)
{
U64 name_size = DragQueryFile(drop, idx, 0, 0) + 1;
U8 *name_ptr = push_array(os_w32_event_arena, U8, name_size);
DragQueryFile(drop, idx, (char *)name_ptr, name_size);
str8_list_push(os_w32_event_arena, &event->strings, str8(name_ptr, name_size));
}
DragFinish(drop);
}break;
//- rjf: [custom border]
case WM_NCPAINT:
{
@@ -1027,8 +1030,8 @@ os_window_open(Vec2F32 resolution, OS_WindowFlags flags, String8 title)
(int)resolution.y,
0, 0,
os_w32_gfx_state->hInstance,
0);
DragAcceptFiles(hwnd, 1);
0);
DragAcceptFiles(hwnd, 1);
scratch_end(scratch);
}
@@ -1412,6 +1415,18 @@ os_get_modifiers(void)
return modifiers;
}
internal B32
os_key_is_down(OS_Key key)
{
B32 down = 0;
WPARAM vkey = os_w32_vkey_from_os_key(key);
if(GetKeyState(vkey) & 0x8000)
{
down = 1;
}
return down;
}
internal Vec2F32
os_mouse_from_window(OS_Handle handle)
{