egl/glx work; eliminate unneeded path normalization paths; do not assume os current path when normalizing paths; gl synchronous debug strings

This commit is contained in:
Ryan Fleury
2025-05-12 16:03:36 -07:00
parent fe3cac7ac3
commit a5b227a1c6
20 changed files with 230 additions and 205 deletions
+1 -1
View File
@@ -712,7 +712,7 @@ os_file_iter_begin(Arena *arena, String8 path, OS_FileIterFlags flags)
}
else
{
w32_iter->handle = FindFirstFileW((WCHAR*)path16.str, &w32_iter->find_data);
w32_iter->handle = FindFirstFileExW((WCHAR*)path16.str, FindExInfoBasic, &w32_iter->find_data, FindExSearchNameMatch, 0, FIND_FIRST_EX_LARGE_FETCH);
}
scratch_end(scratch);
return iter;
+12 -7
View File
@@ -1,11 +1,6 @@
// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
////////////////////////////////
//~ rjf: Prototypes (which seem to sometimes be missing)
int XLookupString(XKeyEvent *event_struct, char *buffer_return, int bytes_buffer, KeySym *keysym_return, XComposeStatus *status_in_out);
////////////////////////////////
//~ rjf: Helpers
@@ -41,6 +36,9 @@ os_gfx_init(void)
os_lnx_gfx_state->wm_sync_request_atom = XInternAtom(os_lnx_gfx_state->display, "_NET_WM_SYNC_REQUEST", 0);
os_lnx_gfx_state->wm_sync_request_counter_atom = XInternAtom(os_lnx_gfx_state->display, "_NET_WM_SYNC_REQUEST_COUNTER", 0);
//- rjf: open im
os_lnx_gfx_state->xim = XOpenIM(os_lnx_gfx_state->display, 0, 0, 0);
//- rjf: fill out gfx info
os_lnx_gfx_state->gfx_info.double_click_time = 0.5f;
os_lnx_gfx_state->gfx_info.caret_blink_time = 0.5f;
@@ -149,6 +147,13 @@ os_window_open(Rng2F32 rect, OS_WindowFlags flags, String8 title)
}
XChangeProperty(os_lnx_gfx_state->display, w->window, os_lnx_gfx_state->wm_sync_request_counter_atom, XA_CARDINAL, 32, PropModeReplace, (U8 *)&w->counter_xid, 1);
//- rjf: create xic
w->xic = XCreateIC(os_lnx_gfx_state->xim,
XNInputStyle, XIMPreeditNothing|XIMStatusNothing,
XNClientWindow, w->window,
XNFocusWindow, w->window,
NULL);
//- rjf: attach name
Temp scratch = scratch_begin(0, 0);
String8 title_copy = push_str8_copy(scratch.arena, title);
@@ -399,9 +404,10 @@ os_get_events(Arena *arena, B32 wait)
if(evt.xkey.state & Mod1Mask) { modifiers |= OS_Modifier_Alt; }
// rjf: map keycode -> keysym & codepoint
OS_LNX_Window *window = os_lnx_window_from_x11window(evt.xkey.window);
KeySym keysym = 0;
U8 text[256] = {0};
U64 text_size = XLookupString(&evt.xkey, (char *)text, sizeof(text), &keysym, 0);
U64 text_size = Xutf8LookupString(window->xic, &evt.xkey, (char *)text, sizeof(text), &keysym, 0);
// rjf: map keysym -> OS_Key
B32 is_right_sided = 0;
@@ -475,7 +481,6 @@ os_get_events(Arena *arena, B32 wait)
}
// rjf: push text event
OS_LNX_Window *window = os_lnx_window_from_x11window(evt.xkey.window);
if(evt.type == KeyPress && text_size != 0)
{
for(U64 off = 0; off < text_size;)
+2
View File
@@ -23,6 +23,7 @@ struct OS_LNX_Window
OS_LNX_Window *next;
OS_LNX_Window *prev;
Window window;
XIC xic;
XID counter_xid;
U64 counter_value;
};
@@ -35,6 +36,7 @@ struct OS_LNX_GfxState
{
Arena *arena;
Display *display;
XIM xim;
OS_LNX_Window *first_window;
OS_LNX_Window *last_window;
OS_LNX_Window *free_window;
+2
View File
@@ -95,6 +95,7 @@ os_w32_window_release(OS_W32_Window *window)
{
arena_release(window->paint_arena);
}
ReleaseDC(window->hwnd, window->hdc);
DestroyWindow(window->hwnd);
DLLRemove(os_w32_gfx_state->first_window, os_w32_gfx_state->last_window, window);
SLLStackPush(os_w32_gfx_state->free_window, window);
@@ -1056,6 +1057,7 @@ os_window_open(Rng2F32 rect, OS_WindowFlags flags, String8 title)
OS_W32_Window *window = os_w32_window_alloc();
{
window->hwnd = hwnd;
window->hdc = GetDC(hwnd);
if(w32_GetDpiForWindow_func != 0)
{
window->dpi = (F32)w32_GetDpiForWindow_func(hwnd);
+1
View File
@@ -38,6 +38,7 @@ struct OS_W32_Window
OS_W32_Window *next;
OS_W32_Window *prev;
HWND hwnd;
HDC hdc;
WINDOWPLACEMENT last_window_placement;
F32 dpi;
B32 first_paint_done;