mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-10-14 12:59:41 -07:00
os -> wm; *_w32_ -> w32_*_, *_lnx_ -> lnx_*_
This commit is contained in:
1 parent
9a7782de47
commit
2f6d0f9aaa
52 files changed
+3086
-3115
No files matched your search
@@ -4,7 +4,7 @@
|
||||
//- GENERATED CODE
|
||||
|
||||
C_LINKAGE_BEGIN
|
||||
String8 os_g_key_display_string_table[143] =
|
||||
String8 wm_key_display_name_table[143] =
|
||||
{
|
||||
str8_lit_comp("Invalid Key"),
|
||||
str8_lit_comp("Escape"),
|
||||
@@ -151,7 +151,7 @@ str8_lit_comp("Middle Mouse Button"),
|
||||
str8_lit_comp("Right Mouse Button"),
|
||||
};
|
||||
|
||||
String8 os_g_key_cfg_string_table[143] =
|
||||
String8 wm_key_cfg_name_table[143] =
|
||||
{
|
||||
str8_lit_comp("null"),
|
||||
str8_lit_comp("esc"),
|
||||
|
||||
@@ -6,157 +6,157 @@
|
||||
#ifndef WINDOW_MANAGER_META_H
|
||||
#define WINDOW_MANAGER_META_H
|
||||
|
||||
typedef enum OS_Key
|
||||
typedef enum WM_Key
|
||||
{
|
||||
OS_Key_Null,
|
||||
OS_Key_Esc,
|
||||
OS_Key_F1,
|
||||
OS_Key_F2,
|
||||
OS_Key_F3,
|
||||
OS_Key_F4,
|
||||
OS_Key_F5,
|
||||
OS_Key_F6,
|
||||
OS_Key_F7,
|
||||
OS_Key_F8,
|
||||
OS_Key_F9,
|
||||
OS_Key_F10,
|
||||
OS_Key_F11,
|
||||
OS_Key_F12,
|
||||
OS_Key_F13,
|
||||
OS_Key_F14,
|
||||
OS_Key_F15,
|
||||
OS_Key_F16,
|
||||
OS_Key_F17,
|
||||
OS_Key_F18,
|
||||
OS_Key_F19,
|
||||
OS_Key_F20,
|
||||
OS_Key_F21,
|
||||
OS_Key_F22,
|
||||
OS_Key_F23,
|
||||
OS_Key_F24,
|
||||
OS_Key_Tick,
|
||||
OS_Key_0,
|
||||
OS_Key_1,
|
||||
OS_Key_2,
|
||||
OS_Key_3,
|
||||
OS_Key_4,
|
||||
OS_Key_5,
|
||||
OS_Key_6,
|
||||
OS_Key_7,
|
||||
OS_Key_8,
|
||||
OS_Key_9,
|
||||
OS_Key_Minus,
|
||||
OS_Key_Equal,
|
||||
OS_Key_Backspace,
|
||||
OS_Key_Tab,
|
||||
OS_Key_Q,
|
||||
OS_Key_W,
|
||||
OS_Key_E,
|
||||
OS_Key_R,
|
||||
OS_Key_T,
|
||||
OS_Key_Y,
|
||||
OS_Key_U,
|
||||
OS_Key_I,
|
||||
OS_Key_O,
|
||||
OS_Key_P,
|
||||
OS_Key_LeftBracket,
|
||||
OS_Key_RightBracket,
|
||||
OS_Key_BackSlash,
|
||||
OS_Key_CapsLock,
|
||||
OS_Key_A,
|
||||
OS_Key_S,
|
||||
OS_Key_D,
|
||||
OS_Key_F,
|
||||
OS_Key_G,
|
||||
OS_Key_H,
|
||||
OS_Key_J,
|
||||
OS_Key_K,
|
||||
OS_Key_L,
|
||||
OS_Key_Semicolon,
|
||||
OS_Key_Quote,
|
||||
OS_Key_Return,
|
||||
OS_Key_Shift,
|
||||
OS_Key_Z,
|
||||
OS_Key_X,
|
||||
OS_Key_C,
|
||||
OS_Key_V,
|
||||
OS_Key_B,
|
||||
OS_Key_N,
|
||||
OS_Key_M,
|
||||
OS_Key_Comma,
|
||||
OS_Key_Period,
|
||||
OS_Key_Slash,
|
||||
OS_Key_Ctrl,
|
||||
OS_Key_Alt,
|
||||
OS_Key_Space,
|
||||
OS_Key_Menu,
|
||||
OS_Key_ScrollLock,
|
||||
OS_Key_Pause,
|
||||
OS_Key_Insert,
|
||||
OS_Key_Home,
|
||||
OS_Key_PageUp,
|
||||
OS_Key_Delete,
|
||||
OS_Key_End,
|
||||
OS_Key_PageDown,
|
||||
OS_Key_Up,
|
||||
OS_Key_Left,
|
||||
OS_Key_Down,
|
||||
OS_Key_Right,
|
||||
OS_Key_Ex0,
|
||||
OS_Key_Ex1,
|
||||
OS_Key_Ex2,
|
||||
OS_Key_Ex3,
|
||||
OS_Key_Ex4,
|
||||
OS_Key_Ex5,
|
||||
OS_Key_Ex6,
|
||||
OS_Key_Ex7,
|
||||
OS_Key_Ex8,
|
||||
OS_Key_Ex9,
|
||||
OS_Key_Ex10,
|
||||
OS_Key_Ex11,
|
||||
OS_Key_Ex12,
|
||||
OS_Key_Ex13,
|
||||
OS_Key_Ex14,
|
||||
OS_Key_Ex15,
|
||||
OS_Key_Ex16,
|
||||
OS_Key_Ex17,
|
||||
OS_Key_Ex18,
|
||||
OS_Key_Ex19,
|
||||
OS_Key_Ex20,
|
||||
OS_Key_Ex21,
|
||||
OS_Key_Ex22,
|
||||
OS_Key_Ex23,
|
||||
OS_Key_Ex24,
|
||||
OS_Key_Ex25,
|
||||
OS_Key_Ex26,
|
||||
OS_Key_Ex27,
|
||||
OS_Key_Ex28,
|
||||
OS_Key_Ex29,
|
||||
OS_Key_NumLock,
|
||||
OS_Key_NumSlash,
|
||||
OS_Key_NumStar,
|
||||
OS_Key_NumMinus,
|
||||
OS_Key_NumPlus,
|
||||
OS_Key_NumPeriod,
|
||||
OS_Key_Num0,
|
||||
OS_Key_Num1,
|
||||
OS_Key_Num2,
|
||||
OS_Key_Num3,
|
||||
OS_Key_Num4,
|
||||
OS_Key_Num5,
|
||||
OS_Key_Num6,
|
||||
OS_Key_Num7,
|
||||
OS_Key_Num8,
|
||||
OS_Key_Num9,
|
||||
OS_Key_LeftMouseButton,
|
||||
OS_Key_MiddleMouseButton,
|
||||
OS_Key_RightMouseButton,
|
||||
OS_Key_COUNT,
|
||||
} OS_Key;
|
||||
WM_Key_Null,
|
||||
WM_Key_Esc,
|
||||
WM_Key_F1,
|
||||
WM_Key_F2,
|
||||
WM_Key_F3,
|
||||
WM_Key_F4,
|
||||
WM_Key_F5,
|
||||
WM_Key_F6,
|
||||
WM_Key_F7,
|
||||
WM_Key_F8,
|
||||
WM_Key_F9,
|
||||
WM_Key_F10,
|
||||
WM_Key_F11,
|
||||
WM_Key_F12,
|
||||
WM_Key_F13,
|
||||
WM_Key_F14,
|
||||
WM_Key_F15,
|
||||
WM_Key_F16,
|
||||
WM_Key_F17,
|
||||
WM_Key_F18,
|
||||
WM_Key_F19,
|
||||
WM_Key_F20,
|
||||
WM_Key_F21,
|
||||
WM_Key_F22,
|
||||
WM_Key_F23,
|
||||
WM_Key_F24,
|
||||
WM_Key_Tick,
|
||||
WM_Key_0,
|
||||
WM_Key_1,
|
||||
WM_Key_2,
|
||||
WM_Key_3,
|
||||
WM_Key_4,
|
||||
WM_Key_5,
|
||||
WM_Key_6,
|
||||
WM_Key_7,
|
||||
WM_Key_8,
|
||||
WM_Key_9,
|
||||
WM_Key_Minus,
|
||||
WM_Key_Equal,
|
||||
WM_Key_Backspace,
|
||||
WM_Key_Tab,
|
||||
WM_Key_Q,
|
||||
WM_Key_W,
|
||||
WM_Key_E,
|
||||
WM_Key_R,
|
||||
WM_Key_T,
|
||||
WM_Key_Y,
|
||||
WM_Key_U,
|
||||
WM_Key_I,
|
||||
WM_Key_O,
|
||||
WM_Key_P,
|
||||
WM_Key_LeftBracket,
|
||||
WM_Key_RightBracket,
|
||||
WM_Key_BackSlash,
|
||||
WM_Key_CapsLock,
|
||||
WM_Key_A,
|
||||
WM_Key_S,
|
||||
WM_Key_D,
|
||||
WM_Key_F,
|
||||
WM_Key_G,
|
||||
WM_Key_H,
|
||||
WM_Key_J,
|
||||
WM_Key_K,
|
||||
WM_Key_L,
|
||||
WM_Key_Semicolon,
|
||||
WM_Key_Quote,
|
||||
WM_Key_Return,
|
||||
WM_Key_Shift,
|
||||
WM_Key_Z,
|
||||
WM_Key_X,
|
||||
WM_Key_C,
|
||||
WM_Key_V,
|
||||
WM_Key_B,
|
||||
WM_Key_N,
|
||||
WM_Key_M,
|
||||
WM_Key_Comma,
|
||||
WM_Key_Period,
|
||||
WM_Key_Slash,
|
||||
WM_Key_Ctrl,
|
||||
WM_Key_Alt,
|
||||
WM_Key_Space,
|
||||
WM_Key_Menu,
|
||||
WM_Key_ScrollLock,
|
||||
WM_Key_Pause,
|
||||
WM_Key_Insert,
|
||||
WM_Key_Home,
|
||||
WM_Key_PageUp,
|
||||
WM_Key_Delete,
|
||||
WM_Key_End,
|
||||
WM_Key_PageDown,
|
||||
WM_Key_Up,
|
||||
WM_Key_Left,
|
||||
WM_Key_Down,
|
||||
WM_Key_Right,
|
||||
WM_Key_Ex0,
|
||||
WM_Key_Ex1,
|
||||
WM_Key_Ex2,
|
||||
WM_Key_Ex3,
|
||||
WM_Key_Ex4,
|
||||
WM_Key_Ex5,
|
||||
WM_Key_Ex6,
|
||||
WM_Key_Ex7,
|
||||
WM_Key_Ex8,
|
||||
WM_Key_Ex9,
|
||||
WM_Key_Ex10,
|
||||
WM_Key_Ex11,
|
||||
WM_Key_Ex12,
|
||||
WM_Key_Ex13,
|
||||
WM_Key_Ex14,
|
||||
WM_Key_Ex15,
|
||||
WM_Key_Ex16,
|
||||
WM_Key_Ex17,
|
||||
WM_Key_Ex18,
|
||||
WM_Key_Ex19,
|
||||
WM_Key_Ex20,
|
||||
WM_Key_Ex21,
|
||||
WM_Key_Ex22,
|
||||
WM_Key_Ex23,
|
||||
WM_Key_Ex24,
|
||||
WM_Key_Ex25,
|
||||
WM_Key_Ex26,
|
||||
WM_Key_Ex27,
|
||||
WM_Key_Ex28,
|
||||
WM_Key_Ex29,
|
||||
WM_Key_NumLock,
|
||||
WM_Key_NumSlash,
|
||||
WM_Key_NumStar,
|
||||
WM_Key_NumMinus,
|
||||
WM_Key_NumPlus,
|
||||
WM_Key_NumPeriod,
|
||||
WM_Key_Num0,
|
||||
WM_Key_Num1,
|
||||
WM_Key_Num2,
|
||||
WM_Key_Num3,
|
||||
WM_Key_Num4,
|
||||
WM_Key_Num5,
|
||||
WM_Key_Num6,
|
||||
WM_Key_Num7,
|
||||
WM_Key_Num8,
|
||||
WM_Key_Num9,
|
||||
WM_Key_LeftMouseButton,
|
||||
WM_Key_MiddleMouseButton,
|
||||
WM_Key_RightMouseButton,
|
||||
WM_Key_COUNT,
|
||||
} WM_Key;
|
||||
|
||||
C_LINKAGE_BEGIN
|
||||
extern String8 os_g_key_display_string_table[143];
|
||||
extern String8 os_g_key_cfg_string_table[143];
|
||||
extern String8 wm_key_display_name_table[143];
|
||||
extern String8 wm_key_cfg_name_table[143];
|
||||
|
||||
C_LINKAGE_END
|
||||
|
||||
|
||||
+140
-140
@@ -9,22 +9,22 @@
|
||||
////////////////////////////////
|
||||
//~ rjf: Handle Type Helpers
|
||||
|
||||
internal OS_Window
|
||||
os_window_zero(void)
|
||||
internal WM_Window
|
||||
wm_window_zero(void)
|
||||
{
|
||||
OS_Window result = {0};
|
||||
WM_Window result = {0};
|
||||
return result;
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_window_match(OS_Window a, OS_Window b)
|
||||
wm_window_match(WM_Window a, WM_Window b)
|
||||
{
|
||||
B32 result = MemoryMatchStruct(&a, &b);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_monitor_match(OS_Monitor a, OS_Monitor b)
|
||||
wm_monitor_match(WM_Monitor a, WM_Monitor b)
|
||||
{
|
||||
B32 result = MemoryMatchStruct(&a, &b);
|
||||
return result;
|
||||
@@ -34,46 +34,46 @@ os_monitor_match(OS_Monitor a, OS_Monitor b)
|
||||
//~ rjf: Event Functions (Helpers, Implemented Once)
|
||||
|
||||
internal String8
|
||||
os_string_from_event_kind(OS_EventKind kind)
|
||||
wm_string_from_event_kind(WM_EventKind kind)
|
||||
{
|
||||
String8 result = {0};
|
||||
switch(kind)
|
||||
{
|
||||
case OS_EventKind_Null:
|
||||
case OS_EventKind_COUNT:
|
||||
case WM_EventKind_Null:
|
||||
case WM_EventKind_COUNT:
|
||||
{}break;
|
||||
case OS_EventKind_Press: {result = str8_lit("Press");}break;
|
||||
case OS_EventKind_Release: {result = str8_lit("Release");}break;
|
||||
case OS_EventKind_MouseMove: {result = str8_lit("MouseMove");}break;
|
||||
case OS_EventKind_Text: {result = str8_lit("Text");}break;
|
||||
case OS_EventKind_Scroll: {result = str8_lit("Scroll");}break;
|
||||
case OS_EventKind_WindowLoseFocus: {result = str8_lit("WindowLoseFocus");}break;
|
||||
case OS_EventKind_WindowClose: {result = str8_lit("WindowClose");}break;
|
||||
case OS_EventKind_FileDrop: {result = str8_lit("FileDrop");}break;
|
||||
case OS_EventKind_Wakeup: {result = str8_lit("Wakeup");}break;
|
||||
case WM_EventKind_Press: {result = str8_lit("Press");}break;
|
||||
case WM_EventKind_Release: {result = str8_lit("Release");}break;
|
||||
case WM_EventKind_MouseMove: {result = str8_lit("MouseMove");}break;
|
||||
case WM_EventKind_Text: {result = str8_lit("Text");}break;
|
||||
case WM_EventKind_Scroll: {result = str8_lit("Scroll");}break;
|
||||
case WM_EventKind_WindowLoseFocus: {result = str8_lit("WindowLoseFocus");}break;
|
||||
case WM_EventKind_WindowClose: {result = str8_lit("WindowClose");}break;
|
||||
case WM_EventKind_FileDrop: {result = str8_lit("FileDrop");}break;
|
||||
case WM_EventKind_Wakeup: {result = str8_lit("Wakeup");}break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8List
|
||||
os_string_list_from_modifiers(Arena *arena, OS_Modifiers modifiers)
|
||||
wm_string_list_from_modifiers(Arena *arena, WM_Modifiers modifiers)
|
||||
{
|
||||
String8List result = {0};
|
||||
if(modifiers & OS_Modifier_Ctrl) { str8_list_push(arena, &result, str8_lit("Ctrl")); }
|
||||
if(modifiers & OS_Modifier_Shift) { str8_list_push(arena, &result, str8_lit("Shift")); }
|
||||
if(modifiers & OS_Modifier_Alt) { str8_list_push(arena, &result, str8_lit("Alt")); }
|
||||
if(modifiers & WM_Modifier_Ctrl) { str8_list_push(arena, &result, str8_lit("Ctrl")); }
|
||||
if(modifiers & WM_Modifier_Shift) { str8_list_push(arena, &result, str8_lit("Shift")); }
|
||||
if(modifiers & WM_Modifier_Alt) { str8_list_push(arena, &result, str8_lit("Alt")); }
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
os_string_from_modifiers_key(Arena *arena, OS_Modifiers modifiers, OS_Key key)
|
||||
wm_string_from_modifiers_key(Arena *arena, WM_Modifiers modifiers, WM_Key key)
|
||||
{
|
||||
String8 result = {0};
|
||||
if(key != OS_Key_Null)
|
||||
if(key != WM_Key_Null)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
String8List mods = os_string_list_from_modifiers(scratch.arena, modifiers);
|
||||
String8 key_string = os_g_key_display_string_table[key];
|
||||
String8List mods = wm_string_list_from_modifiers(scratch.arena, modifiers);
|
||||
String8 key_string = wm_key_display_name_table[key];
|
||||
str8_list_push(scratch.arena, &mods, key_string);
|
||||
StringJoin join = {0};
|
||||
join.sep = str8_lit(" + ");
|
||||
@@ -84,105 +84,105 @@ os_string_from_modifiers_key(Arena *arena, OS_Modifiers modifiers, OS_Key key)
|
||||
}
|
||||
|
||||
internal U32
|
||||
os_codepoint_from_modifiers_and_key(OS_Modifiers modifiers, OS_Key key)
|
||||
wm_codepoint_from_modifiers_and_key(WM_Modifiers modifiers, WM_Key key)
|
||||
{
|
||||
U32 result = 0;
|
||||
|
||||
// rjf: special-case map
|
||||
local_persist read_only struct {U32 character; OS_Key key; OS_Modifiers modifiers;} map[] =
|
||||
local_persist read_only struct {U32 character; WM_Key key; WM_Modifiers modifiers;} map[] =
|
||||
{
|
||||
{'!', OS_Key_1, OS_Modifier_Shift},
|
||||
{'@', OS_Key_2, OS_Modifier_Shift},
|
||||
{'#', OS_Key_3, OS_Modifier_Shift},
|
||||
{'$', OS_Key_4, OS_Modifier_Shift},
|
||||
{'%', OS_Key_5, OS_Modifier_Shift},
|
||||
{'^', OS_Key_6, OS_Modifier_Shift},
|
||||
{'&', OS_Key_7, OS_Modifier_Shift},
|
||||
{'*', OS_Key_8, OS_Modifier_Shift},
|
||||
{'(', OS_Key_9, OS_Modifier_Shift},
|
||||
{')', OS_Key_0, OS_Modifier_Shift},
|
||||
{'_', OS_Key_Minus, OS_Modifier_Shift},
|
||||
{'_', OS_Key_Minus, OS_Modifier_Shift},
|
||||
{'-', OS_Key_Minus, 0},
|
||||
{'=', OS_Key_Equal, 0},
|
||||
{'+', OS_Key_Equal, OS_Modifier_Shift},
|
||||
{'`', OS_Key_Tick, 0},
|
||||
{'~', OS_Key_Tick, OS_Modifier_Shift},
|
||||
{'[', OS_Key_LeftBracket, 0},
|
||||
{']', OS_Key_RightBracket, 0},
|
||||
{'{', OS_Key_LeftBracket, OS_Modifier_Shift},
|
||||
{'}', OS_Key_RightBracket, OS_Modifier_Shift},
|
||||
{'\\', OS_Key_BackSlash, 0},
|
||||
{'|', OS_Key_BackSlash, OS_Modifier_Shift},
|
||||
{';', OS_Key_Semicolon, 0},
|
||||
{':', OS_Key_Semicolon, OS_Modifier_Shift},
|
||||
{'\'', OS_Key_Quote, 0},
|
||||
{'"', OS_Key_Quote, OS_Modifier_Shift},
|
||||
{'.', OS_Key_Period, 0},
|
||||
{',', OS_Key_Comma, 0},
|
||||
{'<', OS_Key_Period, OS_Modifier_Shift},
|
||||
{'>', OS_Key_Comma, OS_Modifier_Shift},
|
||||
{'/', OS_Key_Slash, 0},
|
||||
{'?', OS_Key_Slash, OS_Modifier_Shift},
|
||||
{'a', OS_Key_A, 0},
|
||||
{'b', OS_Key_B, 0},
|
||||
{'c', OS_Key_C, 0},
|
||||
{'d', OS_Key_D, 0},
|
||||
{'e', OS_Key_E, 0},
|
||||
{'f', OS_Key_F, 0},
|
||||
{'g', OS_Key_G, 0},
|
||||
{'h', OS_Key_H, 0},
|
||||
{'i', OS_Key_I, 0},
|
||||
{'j', OS_Key_J, 0},
|
||||
{'k', OS_Key_K, 0},
|
||||
{'l', OS_Key_L, 0},
|
||||
{'m', OS_Key_M, 0},
|
||||
{'n', OS_Key_N, 0},
|
||||
{'o', OS_Key_O, 0},
|
||||
{'p', OS_Key_P, 0},
|
||||
{'q', OS_Key_Q, 0},
|
||||
{'r', OS_Key_R, 0},
|
||||
{'s', OS_Key_S, 0},
|
||||
{'t', OS_Key_T, 0},
|
||||
{'u', OS_Key_U, 0},
|
||||
{'v', OS_Key_V, 0},
|
||||
{'w', OS_Key_W, 0},
|
||||
{'x', OS_Key_X, 0},
|
||||
{'y', OS_Key_Y, 0},
|
||||
{'z', OS_Key_Z, 0},
|
||||
{'A', OS_Key_A, OS_Modifier_Shift},
|
||||
{'B', OS_Key_B, OS_Modifier_Shift},
|
||||
{'C', OS_Key_C, OS_Modifier_Shift},
|
||||
{'D', OS_Key_D, OS_Modifier_Shift},
|
||||
{'E', OS_Key_E, OS_Modifier_Shift},
|
||||
{'F', OS_Key_F, OS_Modifier_Shift},
|
||||
{'G', OS_Key_G, OS_Modifier_Shift},
|
||||
{'H', OS_Key_H, OS_Modifier_Shift},
|
||||
{'I', OS_Key_I, OS_Modifier_Shift},
|
||||
{'J', OS_Key_J, OS_Modifier_Shift},
|
||||
{'K', OS_Key_K, OS_Modifier_Shift},
|
||||
{'L', OS_Key_L, OS_Modifier_Shift},
|
||||
{'M', OS_Key_M, OS_Modifier_Shift},
|
||||
{'N', OS_Key_N, OS_Modifier_Shift},
|
||||
{'O', OS_Key_O, OS_Modifier_Shift},
|
||||
{'P', OS_Key_P, OS_Modifier_Shift},
|
||||
{'Q', OS_Key_Q, OS_Modifier_Shift},
|
||||
{'R', OS_Key_R, OS_Modifier_Shift},
|
||||
{'S', OS_Key_S, OS_Modifier_Shift},
|
||||
{'T', OS_Key_T, OS_Modifier_Shift},
|
||||
{'U', OS_Key_U, OS_Modifier_Shift},
|
||||
{'V', OS_Key_V, OS_Modifier_Shift},
|
||||
{'W', OS_Key_W, OS_Modifier_Shift},
|
||||
{'X', OS_Key_X, OS_Modifier_Shift},
|
||||
{'Y', OS_Key_Y, OS_Modifier_Shift},
|
||||
{'Z', OS_Key_Z, OS_Modifier_Shift},
|
||||
{' ', OS_Key_Space, 0},
|
||||
{'!', WM_Key_1, WM_Modifier_Shift},
|
||||
{'@', WM_Key_2, WM_Modifier_Shift},
|
||||
{'#', WM_Key_3, WM_Modifier_Shift},
|
||||
{'$', WM_Key_4, WM_Modifier_Shift},
|
||||
{'%', WM_Key_5, WM_Modifier_Shift},
|
||||
{'^', WM_Key_6, WM_Modifier_Shift},
|
||||
{'&', WM_Key_7, WM_Modifier_Shift},
|
||||
{'*', WM_Key_8, WM_Modifier_Shift},
|
||||
{'(', WM_Key_9, WM_Modifier_Shift},
|
||||
{')', WM_Key_0, WM_Modifier_Shift},
|
||||
{'_', WM_Key_Minus, WM_Modifier_Shift},
|
||||
{'_', WM_Key_Minus, WM_Modifier_Shift},
|
||||
{'-', WM_Key_Minus, 0},
|
||||
{'=', WM_Key_Equal, 0},
|
||||
{'+', WM_Key_Equal, WM_Modifier_Shift},
|
||||
{'`', WM_Key_Tick, 0},
|
||||
{'~', WM_Key_Tick, WM_Modifier_Shift},
|
||||
{'[', WM_Key_LeftBracket, 0},
|
||||
{']', WM_Key_RightBracket, 0},
|
||||
{'{', WM_Key_LeftBracket, WM_Modifier_Shift},
|
||||
{'}', WM_Key_RightBracket, WM_Modifier_Shift},
|
||||
{'\\', WM_Key_BackSlash, 0},
|
||||
{'|', WM_Key_BackSlash, WM_Modifier_Shift},
|
||||
{';', WM_Key_Semicolon, 0},
|
||||
{':', WM_Key_Semicolon, WM_Modifier_Shift},
|
||||
{'\'', WM_Key_Quote, 0},
|
||||
{'"', WM_Key_Quote, WM_Modifier_Shift},
|
||||
{'.', WM_Key_Period, 0},
|
||||
{',', WM_Key_Comma, 0},
|
||||
{'<', WM_Key_Period, WM_Modifier_Shift},
|
||||
{'>', WM_Key_Comma, WM_Modifier_Shift},
|
||||
{'/', WM_Key_Slash, 0},
|
||||
{'?', WM_Key_Slash, WM_Modifier_Shift},
|
||||
{'a', WM_Key_A, 0},
|
||||
{'b', WM_Key_B, 0},
|
||||
{'c', WM_Key_C, 0},
|
||||
{'d', WM_Key_D, 0},
|
||||
{'e', WM_Key_E, 0},
|
||||
{'f', WM_Key_F, 0},
|
||||
{'g', WM_Key_G, 0},
|
||||
{'h', WM_Key_H, 0},
|
||||
{'i', WM_Key_I, 0},
|
||||
{'j', WM_Key_J, 0},
|
||||
{'k', WM_Key_K, 0},
|
||||
{'l', WM_Key_L, 0},
|
||||
{'m', WM_Key_M, 0},
|
||||
{'n', WM_Key_N, 0},
|
||||
{'o', WM_Key_O, 0},
|
||||
{'p', WM_Key_P, 0},
|
||||
{'q', WM_Key_Q, 0},
|
||||
{'r', WM_Key_R, 0},
|
||||
{'s', WM_Key_S, 0},
|
||||
{'t', WM_Key_T, 0},
|
||||
{'u', WM_Key_U, 0},
|
||||
{'v', WM_Key_V, 0},
|
||||
{'w', WM_Key_W, 0},
|
||||
{'x', WM_Key_X, 0},
|
||||
{'y', WM_Key_Y, 0},
|
||||
{'z', WM_Key_Z, 0},
|
||||
{'A', WM_Key_A, WM_Modifier_Shift},
|
||||
{'B', WM_Key_B, WM_Modifier_Shift},
|
||||
{'C', WM_Key_C, WM_Modifier_Shift},
|
||||
{'D', WM_Key_D, WM_Modifier_Shift},
|
||||
{'E', WM_Key_E, WM_Modifier_Shift},
|
||||
{'F', WM_Key_F, WM_Modifier_Shift},
|
||||
{'G', WM_Key_G, WM_Modifier_Shift},
|
||||
{'H', WM_Key_H, WM_Modifier_Shift},
|
||||
{'I', WM_Key_I, WM_Modifier_Shift},
|
||||
{'J', WM_Key_J, WM_Modifier_Shift},
|
||||
{'K', WM_Key_K, WM_Modifier_Shift},
|
||||
{'L', WM_Key_L, WM_Modifier_Shift},
|
||||
{'M', WM_Key_M, WM_Modifier_Shift},
|
||||
{'N', WM_Key_N, WM_Modifier_Shift},
|
||||
{'O', WM_Key_O, WM_Modifier_Shift},
|
||||
{'P', WM_Key_P, WM_Modifier_Shift},
|
||||
{'Q', WM_Key_Q, WM_Modifier_Shift},
|
||||
{'R', WM_Key_R, WM_Modifier_Shift},
|
||||
{'S', WM_Key_S, WM_Modifier_Shift},
|
||||
{'T', WM_Key_T, WM_Modifier_Shift},
|
||||
{'U', WM_Key_U, WM_Modifier_Shift},
|
||||
{'V', WM_Key_V, WM_Modifier_Shift},
|
||||
{'W', WM_Key_W, WM_Modifier_Shift},
|
||||
{'X', WM_Key_X, WM_Modifier_Shift},
|
||||
{'Y', WM_Key_Y, WM_Modifier_Shift},
|
||||
{'Z', WM_Key_Z, WM_Modifier_Shift},
|
||||
{' ', WM_Key_Space, 0},
|
||||
};
|
||||
|
||||
// rjf: check numeric
|
||||
if(OS_Key_0 <= key && key <= OS_Key_9)
|
||||
if(WM_Key_0 <= key && key <= WM_Key_9)
|
||||
{
|
||||
result = '0' + (key - OS_Key_0);
|
||||
result = '0' + (key - WM_Key_0);
|
||||
}
|
||||
|
||||
// rjf: check special-case map
|
||||
@@ -199,23 +199,23 @@ os_codepoint_from_modifiers_and_key(OS_Modifiers modifiers, OS_Key key)
|
||||
}
|
||||
|
||||
internal void
|
||||
os_eat_event(OS_EventList *events, OS_Event *event)
|
||||
wm_eat_event(WM_EventList *events, WM_Event *event)
|
||||
{
|
||||
DLLRemove(events->first, events->last, event);
|
||||
events->count -= 1;
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_key_press(OS_EventList *events, OS_Window window, OS_Modifiers modifiers, OS_Key key)
|
||||
wm_key_press(WM_EventList *events, WM_Window window, WM_Modifiers modifiers, WM_Key key)
|
||||
{
|
||||
B32 result = 0;
|
||||
for(OS_Event *event = events->first; event != 0; event = event->next)
|
||||
for(WM_Event *event = events->first; event != 0; event = event->next)
|
||||
{
|
||||
if((os_window_match(event->window, window) || os_window_match(window, os_window_zero())) &&
|
||||
event->kind == OS_EventKind_Press && event->key == key && event->modifiers == modifiers)
|
||||
if((wm_window_match(event->window, window) || wm_window_match(window, wm_window_zero())) &&
|
||||
event->kind == WM_EventKind_Press && event->key == key && event->modifiers == modifiers)
|
||||
{
|
||||
result = 1;
|
||||
os_eat_event(events, event);
|
||||
wm_eat_event(events, event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -223,16 +223,16 @@ os_key_press(OS_EventList *events, OS_Window window, OS_Modifiers modifiers, OS_
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_key_release(OS_EventList *events, OS_Window window, OS_Modifiers modifiers, OS_Key key)
|
||||
wm_key_release(WM_EventList *events, WM_Window window, WM_Modifiers modifiers, WM_Key key)
|
||||
{
|
||||
B32 result = 0;
|
||||
for(OS_Event *event = events->first; event != 0; event = event->next)
|
||||
for(WM_Event *event = events->first; event != 0; event = event->next)
|
||||
{
|
||||
if((os_window_match(event->window, window) || os_window_match(window, os_window_zero())) &&
|
||||
event->kind == OS_EventKind_Release && event->key == key && event->modifiers == modifiers)
|
||||
if((wm_window_match(event->window, window) || wm_window_match(window, wm_window_zero())) &&
|
||||
event->kind == WM_EventKind_Release && event->key == key && event->modifiers == modifiers)
|
||||
{
|
||||
result = 1;
|
||||
os_eat_event(events, event);
|
||||
wm_eat_event(events, event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -240,29 +240,29 @@ os_key_release(OS_EventList *events, OS_Window window, OS_Modifiers modifiers, O
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_text(OS_EventList *events, OS_Window window, U32 character)
|
||||
wm_text(WM_EventList *events, WM_Window window, U32 character)
|
||||
{
|
||||
B32 result = 0;
|
||||
for(OS_Event *event = events->first; event != 0; event = event->next)
|
||||
for(WM_Event *event = events->first; event != 0; event = event->next)
|
||||
{
|
||||
if((os_window_match(event->window, window) || os_window_match(window, os_window_zero())) &&
|
||||
event->kind == OS_EventKind_Text && event->character == character)
|
||||
if((wm_window_match(event->window, window) || wm_window_match(window, wm_window_zero())) &&
|
||||
event->kind == WM_EventKind_Text && event->character == character)
|
||||
{
|
||||
result = 1;
|
||||
os_eat_event(events, event);
|
||||
wm_eat_event(events, event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal OS_EventList
|
||||
os_event_list_copy(Arena *arena, OS_EventList *src)
|
||||
internal WM_EventList
|
||||
wm_event_list_copy(Arena *arena, WM_EventList *src)
|
||||
{
|
||||
OS_EventList dst = {0};
|
||||
for(OS_Event *s = src->first; s != 0; s = s->next)
|
||||
WM_EventList dst = {0};
|
||||
for(WM_Event *s = src->first; s != 0; s = s->next)
|
||||
{
|
||||
OS_Event *d = push_array(arena, OS_Event, 1);
|
||||
WM_Event *d = push_array(arena, WM_Event, 1);
|
||||
MemoryCopyStruct(d, s);
|
||||
d->strings = str8_list_copy(arena, &s->strings);
|
||||
DLLPushBack(dst.first, dst.last, d);
|
||||
@@ -272,7 +272,7 @@ os_event_list_copy(Arena *arena, OS_EventList *src)
|
||||
}
|
||||
|
||||
internal void
|
||||
os_event_list_concat_in_place(OS_EventList *dst, OS_EventList *to_push)
|
||||
wm_event_list_concat_in_place(WM_EventList *dst, WM_EventList *to_push)
|
||||
{
|
||||
if(dst->last && to_push->first)
|
||||
{
|
||||
@@ -288,10 +288,10 @@ os_event_list_concat_in_place(OS_EventList *dst, OS_EventList *to_push)
|
||||
MemoryZeroStruct(to_push);
|
||||
}
|
||||
|
||||
internal OS_Event *
|
||||
os_event_list_push_new(Arena *arena, OS_EventList *evts, OS_EventKind kind)
|
||||
internal WM_Event *
|
||||
wm_event_list_push_new(Arena *arena, WM_EventList *evts, WM_EventKind kind)
|
||||
{
|
||||
OS_Event *evt = push_array(arena, OS_Event, 1);
|
||||
WM_Event *evt = push_array(arena, WM_Event, 1);
|
||||
DLLPushBack(evts->first, evts->last, evt);
|
||||
evts->count += 1;
|
||||
evt->timestamp_us = now_time_us();
|
||||
|
||||
+115
-115
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
#ifndef OS_GFX_H
|
||||
#define OS_GFX_H
|
||||
#ifndef WINDOW_MANAGER_H
|
||||
#define WINDOW_MANAGER_H
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Graphics System Info
|
||||
|
||||
typedef struct OS_GfxInfo OS_GfxInfo;
|
||||
struct OS_GfxInfo
|
||||
typedef struct WM_SystemInfo WM_SystemInfo;
|
||||
struct WM_SystemInfo
|
||||
{
|
||||
F32 double_click_time;
|
||||
F32 caret_blink_time;
|
||||
@@ -18,15 +18,15 @@ struct OS_GfxInfo
|
||||
////////////////////////////////
|
||||
//~ rjf: Window Types
|
||||
|
||||
typedef U32 OS_WindowFlags;
|
||||
typedef U32 WM_WindowFlags;
|
||||
enum
|
||||
{
|
||||
OS_WindowFlag_CustomBorder = (1<<0),
|
||||
OS_WindowFlag_UseDefaultPosition = (1<<1),
|
||||
WM_WindowFlag_CustomBorder = (1<<0),
|
||||
WM_WindowFlag_UseDefaultPosition = (1<<1),
|
||||
};
|
||||
|
||||
typedef struct OS_Window OS_Window;
|
||||
struct OS_Window
|
||||
typedef struct WM_Window WM_Window;
|
||||
struct WM_Window
|
||||
{
|
||||
U64 u64[1];
|
||||
};
|
||||
@@ -34,8 +34,8 @@ struct OS_Window
|
||||
////////////////////////////////
|
||||
//~ rjf: External Window Types
|
||||
|
||||
typedef struct OS_ExternalWindow OS_ExternalWindow;
|
||||
struct OS_ExternalWindow
|
||||
typedef struct WM_ExtWindow WM_ExtWindow;
|
||||
struct WM_ExtWindow
|
||||
{
|
||||
U64 u64[1];
|
||||
};
|
||||
@@ -43,36 +43,36 @@ struct OS_ExternalWindow
|
||||
////////////////////////////////
|
||||
//~ rjf: Monitor Types
|
||||
|
||||
typedef struct OS_Monitor OS_Monitor;
|
||||
struct OS_Monitor
|
||||
typedef struct WM_Monitor WM_Monitor;
|
||||
struct WM_Monitor
|
||||
{
|
||||
U64 u64[1];
|
||||
};
|
||||
|
||||
typedef struct OS_MonitorArray OS_MonitorArray;
|
||||
struct OS_MonitorArray
|
||||
typedef struct WM_MonitorArray WM_MonitorArray;
|
||||
struct WM_MonitorArray
|
||||
{
|
||||
OS_Monitor *v;
|
||||
WM_Monitor *v;
|
||||
U64 count;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Cursor Types
|
||||
|
||||
typedef enum OS_Cursor
|
||||
typedef enum WM_Cursor
|
||||
{
|
||||
OS_Cursor_Pointer,
|
||||
OS_Cursor_IBar,
|
||||
OS_Cursor_LeftRight,
|
||||
OS_Cursor_UpDown,
|
||||
OS_Cursor_DownRight,
|
||||
OS_Cursor_UpRight,
|
||||
OS_Cursor_UpDownLeftRight,
|
||||
OS_Cursor_HandPoint,
|
||||
OS_Cursor_Disabled,
|
||||
OS_Cursor_COUNT,
|
||||
WM_Cursor_Pointer,
|
||||
WM_Cursor_IBar,
|
||||
WM_Cursor_LeftRight,
|
||||
WM_Cursor_UpDown,
|
||||
WM_Cursor_DownRight,
|
||||
WM_Cursor_UpRight,
|
||||
WM_Cursor_UpDownLeftRight,
|
||||
WM_Cursor_HandPoint,
|
||||
WM_Cursor_Disabled,
|
||||
WM_Cursor_COUNT,
|
||||
}
|
||||
OS_Cursor;
|
||||
WM_Cursor;
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Generated Code
|
||||
@@ -82,40 +82,40 @@ OS_Cursor;
|
||||
////////////////////////////////
|
||||
//~ rjf: Event Types
|
||||
|
||||
typedef enum OS_EventKind
|
||||
typedef enum WM_EventKind
|
||||
{
|
||||
OS_EventKind_Null,
|
||||
OS_EventKind_Press,
|
||||
OS_EventKind_Release,
|
||||
OS_EventKind_MouseMove,
|
||||
OS_EventKind_Text,
|
||||
OS_EventKind_Scroll,
|
||||
OS_EventKind_WindowLoseFocus,
|
||||
OS_EventKind_WindowClose,
|
||||
OS_EventKind_FileDrop,
|
||||
OS_EventKind_Wakeup,
|
||||
OS_EventKind_COUNT
|
||||
WM_EventKind_Null,
|
||||
WM_EventKind_Press,
|
||||
WM_EventKind_Release,
|
||||
WM_EventKind_MouseMove,
|
||||
WM_EventKind_Text,
|
||||
WM_EventKind_Scroll,
|
||||
WM_EventKind_WindowLoseFocus,
|
||||
WM_EventKind_WindowClose,
|
||||
WM_EventKind_FileDrop,
|
||||
WM_EventKind_Wakeup,
|
||||
WM_EventKind_COUNT
|
||||
}
|
||||
OS_EventKind;
|
||||
WM_EventKind;
|
||||
|
||||
typedef U32 OS_Modifiers;
|
||||
typedef U32 WM_Modifiers;
|
||||
enum
|
||||
{
|
||||
OS_Modifier_Ctrl = (1<<0),
|
||||
OS_Modifier_Shift = (1<<1),
|
||||
OS_Modifier_Alt = (1<<2),
|
||||
WM_Modifier_Ctrl = (1<<0),
|
||||
WM_Modifier_Shift = (1<<1),
|
||||
WM_Modifier_Alt = (1<<2),
|
||||
};
|
||||
|
||||
typedef struct OS_Event OS_Event;
|
||||
struct OS_Event
|
||||
typedef struct WM_Event WM_Event;
|
||||
struct WM_Event
|
||||
{
|
||||
OS_Event *next;
|
||||
OS_Event *prev;
|
||||
WM_Event *next;
|
||||
WM_Event *prev;
|
||||
U64 timestamp_us;
|
||||
OS_Window window;
|
||||
OS_EventKind kind;
|
||||
OS_Modifiers modifiers;
|
||||
OS_Key key;
|
||||
WM_Window window;
|
||||
WM_EventKind kind;
|
||||
WM_Modifiers modifiers;
|
||||
WM_Key key;
|
||||
B32 is_repeat;
|
||||
B32 right_sided;
|
||||
U32 character;
|
||||
@@ -125,12 +125,12 @@ struct OS_Event
|
||||
String8List strings;
|
||||
};
|
||||
|
||||
typedef struct OS_EventList OS_EventList;
|
||||
struct OS_EventList
|
||||
typedef struct WM_EventList WM_EventList;
|
||||
struct WM_EventList
|
||||
{
|
||||
U64 count;
|
||||
OS_Event *first;
|
||||
OS_Event *last;
|
||||
WM_Event *first;
|
||||
WM_Event *last;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
@@ -141,106 +141,106 @@ internal B32 frame(void);
|
||||
////////////////////////////////
|
||||
//~ rjf: Handle Type Helpers
|
||||
|
||||
internal OS_Window os_window_zero(void);
|
||||
internal B32 os_window_match(OS_Window a, OS_Window b);
|
||||
internal B32 os_monitor_match(OS_Monitor a, OS_Monitor b);
|
||||
internal WM_Window wm_window_zero(void);
|
||||
internal B32 wm_window_match(WM_Window a, WM_Window b);
|
||||
internal B32 wm_monitor_match(WM_Monitor a, WM_Monitor b);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Event Functions (Helpers, Implemented Once)
|
||||
|
||||
internal String8 os_string_from_event_kind(OS_EventKind kind);
|
||||
internal String8List os_string_list_from_modifiers(Arena *arena, OS_Modifiers flags);
|
||||
internal String8 os_string_from_modifiers_key(Arena *arena, OS_Modifiers modifiers, OS_Key key);
|
||||
internal U32 os_codepoint_from_modifiers_and_key(OS_Modifiers flags, OS_Key key);
|
||||
internal void os_eat_event(OS_EventList *events, OS_Event *event);
|
||||
internal B32 os_key_press(OS_EventList *events, OS_Window window, OS_Modifiers modifiers, OS_Key key);
|
||||
internal B32 os_key_release(OS_EventList *events, OS_Window window, OS_Modifiers modifiers, OS_Key key);
|
||||
internal B32 os_text(OS_EventList *events, OS_Window window, U32 character);
|
||||
internal OS_EventList os_event_list_copy(Arena *arena, OS_EventList *src);
|
||||
internal void os_event_list_concat_in_place(OS_EventList *dst, OS_EventList *to_push);
|
||||
internal OS_Event *os_event_list_push_new(Arena *arena, OS_EventList *evts, OS_EventKind kind);
|
||||
internal String8 wm_string_from_event_kind(WM_EventKind kind);
|
||||
internal String8List wm_string_list_from_modifiers(Arena *arena, WM_Modifiers flags);
|
||||
internal String8 wm_string_from_modifiers_key(Arena *arena, WM_Modifiers modifiers, WM_Key key);
|
||||
internal U32 wm_codepoint_from_modifiers_and_key(WM_Modifiers flags, WM_Key key);
|
||||
internal void wm_eat_event(WM_EventList *events, WM_Event *event);
|
||||
internal B32 wm_key_press(WM_EventList *events, WM_Window window, WM_Modifiers modifiers, WM_Key key);
|
||||
internal B32 wm_key_release(WM_EventList *events, WM_Window window, WM_Modifiers modifiers, WM_Key key);
|
||||
internal B32 wm_text(WM_EventList *events, WM_Window window, U32 character);
|
||||
internal WM_EventList wm_event_list_copy(Arena *arena, WM_EventList *src);
|
||||
internal void wm_event_list_concat_in_place(WM_EventList *dst, WM_EventList *to_push);
|
||||
internal WM_Event *wm_event_list_push_new(Arena *arena, WM_EventList *evts, WM_EventKind kind);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Main Initialization API (Implemented Per-OS)
|
||||
|
||||
internal void os_gfx_init(void);
|
||||
internal void wm_init(void);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Graphics System Info (Implemented Per-OS)
|
||||
|
||||
internal OS_GfxInfo *os_get_gfx_info(void);
|
||||
internal WM_SystemInfo *wm_get_system_info(void);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Clipboards (Implemented Per-OS)
|
||||
|
||||
internal void os_set_clipboard_text(String8 string);
|
||||
internal String8 os_get_clipboard_text(Arena *arena);
|
||||
internal void wm_set_clipboard_text(String8 string);
|
||||
internal String8 wm_get_clipboard_text(Arena *arena);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Windows (Implemented Per-OS)
|
||||
|
||||
internal OS_Window os_window_open(Rng2F32 rect, OS_WindowFlags flags, String8 title);
|
||||
internal void os_window_close(OS_Window window);
|
||||
internal void os_window_set_title(OS_Window window, String8 title);
|
||||
internal void os_window_first_paint(OS_Window window);
|
||||
internal void os_window_focus(OS_Window window);
|
||||
internal B32 os_window_is_focused(OS_Window window);
|
||||
internal B32 os_window_is_fullscreen(OS_Window window);
|
||||
internal void os_window_set_fullscreen(OS_Window window, B32 fullscreen);
|
||||
internal B32 os_window_is_maximized(OS_Window window);
|
||||
internal void os_window_set_maximized(OS_Window window, B32 maximized);
|
||||
internal B32 os_window_is_minimized(OS_Window window);
|
||||
internal void os_window_set_minimized(OS_Window window, B32 minimized);
|
||||
internal void os_window_bring_to_front(OS_Window window);
|
||||
internal void os_window_set_monitor(OS_Window window, OS_Monitor monitor);
|
||||
internal void os_window_clear_custom_border_data(OS_Window handle);
|
||||
internal void os_window_push_custom_title_bar(OS_Window handle, F32 thickness);
|
||||
internal void os_window_push_custom_edges(OS_Window handle, F32 thickness);
|
||||
internal void os_window_push_custom_title_bar_client_area(OS_Window handle, Rng2F32 rect);
|
||||
internal Rng2F32 os_rect_from_window(OS_Window window);
|
||||
internal Rng2F32 os_client_rect_from_window(OS_Window window);
|
||||
internal F32 os_dpi_from_window(OS_Window window);
|
||||
internal WM_Window wm_window_open(Rng2F32 rect, WM_WindowFlags flags, String8 title);
|
||||
internal void wm_window_close(WM_Window window);
|
||||
internal void wm_window_set_title(WM_Window window, String8 title);
|
||||
internal void wm_window_first_paint(WM_Window window);
|
||||
internal void wm_window_focus(WM_Window window);
|
||||
internal B32 wm_window_is_focused(WM_Window window);
|
||||
internal B32 wm_window_is_fullscreen(WM_Window window);
|
||||
internal void wm_window_set_fullscreen(WM_Window window, B32 fullscreen);
|
||||
internal B32 wm_window_is_maximized(WM_Window window);
|
||||
internal void wm_window_set_maximized(WM_Window window, B32 maximized);
|
||||
internal B32 wm_window_is_minimized(WM_Window window);
|
||||
internal void wm_window_set_minimized(WM_Window window, B32 minimized);
|
||||
internal void wm_window_bring_to_front(WM_Window window);
|
||||
internal void wm_window_set_monitor(WM_Window window, WM_Monitor monitor);
|
||||
internal void wm_window_clear_custom_border_data(WM_Window handle);
|
||||
internal void wm_window_push_custom_title_bar(WM_Window handle, F32 thickness);
|
||||
internal void wm_window_push_custom_edges(WM_Window handle, F32 thickness);
|
||||
internal void wm_window_push_custom_title_bar_client_area(WM_Window handle, Rng2F32 rect);
|
||||
internal Rng2F32 wm_rect_from_window(WM_Window window);
|
||||
internal Rng2F32 wm_client_rect_from_window(WM_Window window);
|
||||
internal F32 wm_dpi_from_window(WM_Window window);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks External Windows (Implemented Per-OS)
|
||||
|
||||
internal OS_ExternalWindow os_focused_external_window(void);
|
||||
internal void os_focus_external_window(OS_ExternalWindow ext_window);
|
||||
internal WM_ExtWindow wm_focused_external_window(void);
|
||||
internal void wm_focus_external_window(WM_ExtWindow ext_window);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Monitors (Implemented Per-OS)
|
||||
|
||||
internal OS_MonitorArray os_push_monitors_array(Arena *arena);
|
||||
internal OS_Monitor os_primary_monitor(void);
|
||||
internal OS_Monitor os_monitor_from_window(OS_Window window);
|
||||
internal String8 os_name_from_monitor(Arena *arena, OS_Monitor monitor);
|
||||
internal Vec2F32 os_dim_from_monitor(OS_Monitor monitor);
|
||||
internal F32 os_dpi_from_monitor(OS_Monitor monitor);
|
||||
internal WM_MonitorArray wm_push_monitors_array(Arena *arena);
|
||||
internal WM_Monitor wm_primary_monitor(void);
|
||||
internal WM_Monitor wm_monitor_from_window(WM_Window window);
|
||||
internal String8 wm_name_from_monitor(Arena *arena, WM_Monitor monitor);
|
||||
internal Vec2F32 wm_dim_from_monitor(WM_Monitor monitor);
|
||||
internal F32 wm_dpi_from_monitor(WM_Monitor monitor);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Events (Implemented Per-OS)
|
||||
|
||||
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 B32 os_key_is_down(OS_Key key);
|
||||
internal Vec2F32 os_mouse_from_window(OS_Window window);
|
||||
internal void wm_send_wakeup_event(void);
|
||||
internal WM_EventList wm_get_events(Arena *arena, B32 wait);
|
||||
internal WM_Modifiers wm_get_modifiers(void);
|
||||
internal B32 wm_key_is_down(WM_Key key);
|
||||
internal Vec2F32 wm_mouse_from_window(WM_Window window);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Cursors (Implemented Per-OS)
|
||||
|
||||
internal void os_set_cursor(OS_Cursor cursor);
|
||||
internal void wm_set_cursor(WM_Cursor cursor);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Native User-Facing Graphical Messages (Implemented Per-OS)
|
||||
|
||||
internal void os_graphical_message(B32 error, String8 title, String8 message);
|
||||
internal String8 os_graphical_pick_file(Arena *arena, String8 initial_path);
|
||||
internal void wm_graphical_message(B32 error, String8 title, String8 message);
|
||||
internal String8 wm_graphical_pick_file(Arena *arena, String8 initial_path);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Shell Operations
|
||||
|
||||
internal void os_show_in_filesystem_ui(String8 path);
|
||||
internal void os_open_in_browser(String8 url);
|
||||
internal void wm_show_in_filesystem_ui(String8 path);
|
||||
internal void wm_open_in_browser(String8 url);
|
||||
|
||||
#endif // OS_GFX_H
|
||||
#endif // WINDOW_MANAGER_H
|
||||
@@ -5,7 +5,7 @@
|
||||
//~ rjf: Tables
|
||||
|
||||
@table(name, display_string, cfg_string)
|
||||
OS_KeyTable:
|
||||
WM_KeyTable:
|
||||
{
|
||||
{Null "Invalid Key" "null" }
|
||||
{Esc "Escape" "esc" }
|
||||
@@ -155,18 +155,18 @@ OS_KeyTable:
|
||||
////////////////////////////////
|
||||
//~ rjf: Generators
|
||||
|
||||
@enum OS_Key:
|
||||
@enum WM_Key:
|
||||
{
|
||||
@expand(OS_KeyTable a) `$(a.name)`,
|
||||
@expand(WM_KeyTable a) `$(a.name)`,
|
||||
COUNT,
|
||||
}
|
||||
|
||||
@data(String8) os_g_key_display_string_table:
|
||||
@data(String8) wm_key_display_name_table:
|
||||
{
|
||||
@expand(OS_KeyTable a) `str8_lit_comp("$(a.display_string)")`;
|
||||
@expand(WM_KeyTable a) `str8_lit_comp("$(a.display_string)")`;
|
||||
}
|
||||
|
||||
@data(String8) os_g_key_cfg_string_table:
|
||||
@data(String8) wm_key_cfg_name_table:
|
||||
{
|
||||
@expand(OS_KeyTable a) `str8_lit_comp("$(a.cfg_string)")`;
|
||||
@expand(WM_KeyTable a) `str8_lit_comp("$(a.cfg_string)")`;
|
||||
}
|
||||
@@ -2,17 +2,17 @@
|
||||
//~ rjf: @os_hooks Main Initialization API (Implemented Per-OS)
|
||||
|
||||
internal void
|
||||
os_gfx_init(void)
|
||||
wm_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Graphics System Info (Implemented Per-OS)
|
||||
|
||||
internal OS_GfxInfo *
|
||||
os_get_gfx_info(void)
|
||||
internal WM_SystemInfo *
|
||||
wm_get_system_info(void)
|
||||
{
|
||||
local_persist OS_GfxInfo g = {0};
|
||||
local_persist WM_SystemInfo g = {0};
|
||||
return &g;
|
||||
}
|
||||
|
||||
@@ -20,12 +20,12 @@ os_get_gfx_info(void)
|
||||
//~ rjf: @os_hooks Clipboards (Implemented Per-OS)
|
||||
|
||||
internal void
|
||||
os_set_clipboard_text(String8 string)
|
||||
wm_set_clipboard_text(String8 string)
|
||||
{
|
||||
}
|
||||
|
||||
internal String8
|
||||
os_get_clipboard_text(Arena *arena)
|
||||
wm_get_clipboard_text(Arena *arena)
|
||||
{
|
||||
return str8_zero();
|
||||
}
|
||||
@@ -33,118 +33,118 @@ os_get_clipboard_text(Arena *arena)
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Windows (Implemented Per-OS)
|
||||
|
||||
internal OS_Handle
|
||||
os_window_open(Rng2F32 rect, OS_WindowFlags flags, String8 title)
|
||||
internal WM_Window
|
||||
wm_window_open(Rng2F32 rect, WM_WindowFlags flags, String8 title)
|
||||
{
|
||||
OS_Handle handle = {1};
|
||||
WM_Window handle = {1};
|
||||
return handle;
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_close(OS_Handle window)
|
||||
wm_window_close(WM_Window window)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_set_title(OS_Handle window, String8 title)
|
||||
wm_window_set_title(WM_Window window, String8 title)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_first_paint(OS_Handle window)
|
||||
wm_window_first_paint(WM_Window window)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_focus(OS_Handle window)
|
||||
wm_window_focus(WM_Window window)
|
||||
{
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_window_is_focused(OS_Handle window)
|
||||
wm_window_is_focused(WM_Window window)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_window_is_fullscreen(OS_Handle window)
|
||||
wm_window_is_fullscreen(WM_Window window)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_set_fullscreen(OS_Handle window, B32 fullscreen)
|
||||
wm_window_set_fullscreen(WM_Window window, B32 fullscreen)
|
||||
{
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_window_is_maximized(OS_Handle window)
|
||||
wm_window_is_maximized(WM_Window window)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_set_maximized(OS_Handle window, B32 maximized)
|
||||
wm_window_set_maximized(WM_Window window, B32 maximized)
|
||||
{
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_window_is_minimized(OS_Handle window)
|
||||
wm_window_is_minimized(WM_Window window)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_set_minimized(OS_Handle window, B32 minimized)
|
||||
wm_window_set_minimized(WM_Window window, B32 minimized)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_bring_to_front(OS_Handle window)
|
||||
wm_window_bring_to_front(WM_Window window)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_set_monitor(OS_Handle window, OS_Handle monitor)
|
||||
wm_window_set_monitor(WM_Window window, WM_Monitor monitor)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_clear_custom_border_data(OS_Handle handle)
|
||||
wm_window_clear_custom_border_data(WM_Window handle)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_push_custom_title_bar(OS_Handle handle, F32 thickness)
|
||||
wm_window_push_custom_title_bar(WM_Window handle, F32 thickness)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_push_custom_edges(OS_Handle handle, F32 thickness)
|
||||
wm_window_push_custom_edges(WM_Window handle, F32 thickness)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_push_custom_title_bar_client_area(OS_Handle handle, Rng2F32 rect)
|
||||
wm_window_push_custom_title_bar_client_area(WM_Window handle, Rng2F32 rect)
|
||||
{
|
||||
}
|
||||
|
||||
internal Rng2F32
|
||||
os_rect_from_window(OS_Handle window)
|
||||
wm_rect_from_window(WM_Window window)
|
||||
{
|
||||
Rng2F32 rect = r2f32(v2f32(0, 0), v2f32(500, 500));
|
||||
return rect;
|
||||
}
|
||||
|
||||
internal Rng2F32
|
||||
os_client_rect_from_window(OS_Handle window)
|
||||
wm_client_rect_from_window(WM_Window window)
|
||||
{
|
||||
Rng2F32 rect = r2f32(v2f32(0, 0), v2f32(500, 500));
|
||||
return rect;
|
||||
}
|
||||
|
||||
internal F32
|
||||
os_dpi_from_window(OS_Handle window)
|
||||
wm_dpi_from_window(WM_Window window)
|
||||
{
|
||||
return 96.f;
|
||||
}
|
||||
@@ -152,59 +152,57 @@ os_dpi_from_window(OS_Handle window)
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks External Windows (Implemented Per-OS)
|
||||
|
||||
internal OS_Handle
|
||||
os_focused_external_window(void)
|
||||
internal WM_ExtWindow
|
||||
wm_focused_external_window(void)
|
||||
{
|
||||
OS_Handle result = {0};
|
||||
// TODO(rjf)
|
||||
WM_ExtWindow result = {0};
|
||||
return result;
|
||||
}
|
||||
|
||||
internal void
|
||||
os_focus_external_window(OS_Handle handle)
|
||||
wm_focus_external_window(WM_ExtWindow handle)
|
||||
{
|
||||
// TODO(rjf)
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Monitors (Implemented Per-OS)
|
||||
|
||||
internal OS_HandleArray
|
||||
os_push_monitors_array(Arena *arena)
|
||||
internal WM_MonitorArray
|
||||
wm_push_monitors_array(Arena *arena)
|
||||
{
|
||||
OS_HandleArray arr = {0};
|
||||
WM_MonitorArray arr = {0};
|
||||
return arr;
|
||||
}
|
||||
|
||||
internal OS_Handle
|
||||
os_primary_monitor(void)
|
||||
internal WM_Monitor
|
||||
wm_primary_monitor(void)
|
||||
{
|
||||
OS_Handle handle = {1};
|
||||
WM_Monitor handle = {1};
|
||||
return handle;
|
||||
}
|
||||
|
||||
internal OS_Handle
|
||||
os_monitor_from_window(OS_Handle window)
|
||||
internal WM_Monitor
|
||||
wm_monitor_from_window(WM_Window window)
|
||||
{
|
||||
OS_Handle handle = {1};
|
||||
WM_Monitor handle = {1};
|
||||
return handle;
|
||||
}
|
||||
|
||||
internal String8
|
||||
os_name_from_monitor(Arena *arena, OS_Handle monitor)
|
||||
wm_name_from_monitor(Arena *arena, WM_Monitor monitor)
|
||||
{
|
||||
return str8_zero();
|
||||
}
|
||||
|
||||
internal Vec2F32
|
||||
os_dim_from_monitor(OS_Handle monitor)
|
||||
wm_dim_from_monitor(WM_Monitor monitor)
|
||||
{
|
||||
Vec2F32 v = v2f32(1000, 1000);
|
||||
return v;
|
||||
}
|
||||
|
||||
internal F32
|
||||
os_dpi_from_monitor(OS_Handle monitor)
|
||||
wm_dpi_from_monitor(WM_Monitor monitor)
|
||||
{
|
||||
return 96.f;
|
||||
}
|
||||
@@ -213,32 +211,32 @@ os_dpi_from_monitor(OS_Handle monitor)
|
||||
//~ rjf: @os_hooks Events (Implemented Per-OS)
|
||||
|
||||
internal void
|
||||
os_send_wakeup_event(void)
|
||||
wm_send_wakeup_event(void)
|
||||
{
|
||||
}
|
||||
|
||||
internal OS_EventList
|
||||
os_get_events(Arena *arena, B32 wait)
|
||||
internal WM_EventList
|
||||
wm_get_events(Arena *arena, B32 wait)
|
||||
{
|
||||
OS_EventList evts = {0};
|
||||
WM_EventList evts = {0};
|
||||
return evts;
|
||||
}
|
||||
|
||||
internal OS_Modifiers
|
||||
os_get_modifiers(void)
|
||||
internal WM_Modifiers
|
||||
wm_get_modifiers(void)
|
||||
{
|
||||
OS_Modifiers f = 0;
|
||||
WM_Modifiers f = 0;
|
||||
return f;
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_key_is_down(OS_Key key)
|
||||
wm_key_is_down(WM_Key key)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal Vec2F32
|
||||
os_mouse_from_window(OS_Handle window)
|
||||
wm_mouse_from_window(WM_Window window)
|
||||
{
|
||||
return v2f32(0, 0);
|
||||
}
|
||||
@@ -247,7 +245,7 @@ os_mouse_from_window(OS_Handle window)
|
||||
//~ rjf: @os_hooks Cursors (Implemented Per-OS)
|
||||
|
||||
internal void
|
||||
os_set_cursor(OS_Cursor cursor)
|
||||
wm_set_cursor(WM_Cursor cursor)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -255,12 +253,12 @@ os_set_cursor(OS_Cursor cursor)
|
||||
//~ rjf: @os_hooks Native User-Facing Graphical Messages (Implemented Per-OS)
|
||||
|
||||
internal void
|
||||
os_graphical_message(B32 error, String8 title, String8 message)
|
||||
wm_graphical_message(B32 error, String8 title, String8 message)
|
||||
{
|
||||
}
|
||||
|
||||
internal String8
|
||||
os_graphical_pick_file(Arena *arena, String8 initial_path)
|
||||
wm_graphical_pick_file(Arena *arena, String8 initial_path)
|
||||
{
|
||||
return str8_zero();
|
||||
}
|
||||
@@ -269,11 +267,11 @@ os_graphical_pick_file(Arena *arena, String8 initial_path)
|
||||
//~ rjf: @os_hooks Shell Operations
|
||||
|
||||
internal void
|
||||
os_show_in_filesystem_ui(String8 path)
|
||||
wm_show_in_filesystem_ui(String8 path)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_open_in_browser(String8 url)
|
||||
wm_open_in_browser(String8 url)
|
||||
{
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (c) Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
#ifndef OS_GFX_STUB_H
|
||||
#define OS_GFX_STUB_H
|
||||
#ifndef WINDOW_MANAGER_STUB_H
|
||||
#define WINDOW_MANAGER_STUB_H
|
||||
|
||||
#endif // OS_GFX_STUB_H
|
||||
#endif // WINDOW_MANAGER_STUB_H
|
||||
Reference in new issue
Block a user