//////////////////////////////////////////////////////////// //~ Window types Struct(WND_W32_Window) { HWND hwnd; Atomic32 is_ready; /* Window state */ u16 previous_utf16_high_surrogate; /* User state */ Arena *cmds_arena; struct WND_W32_CmdNode *first_cmd; struct WND_W32_CmdNode *last_cmd; u64 frame_gen; b32 is_forced_top; b32 is_fullscreen; RECT fullscreen_restore_rect; /* Window -> User */ /* Reads outside of window thread must lock */ TicketMutex w2u_tm; Arena *w2u_inputs_arena; }; //////////////////////////////////////////////////////////// //~ Restore types #define WND_W32_RestoreMagic 0xc4b4842a Struct(WND_W32_RestorableData) { u32 magic; WINDOWPLACEMENT placement; DWORD style; DWORD ex_style; b32 is_forced_top; b32 is_fullscreen; RECT fullscreen_restore_rect; b32 has_focus; b32 is_snapped; RECT snapped_screen_rect; }; //////////////////////////////////////////////////////////// //~ Cmd types Struct(WND_W32_CmdNode) { WND_W32_CmdNode *next; WND_Cmd cmd; }; //////////////////////////////////////////////////////////// //~ State types #define WND_W32_WindowClassName L"pp_window_class" Struct(WND_W32_SharedState) { Btn vk_to_btn[256]; WNDCLASSEXW window_class; WND_W32_Window window; /* Single-window for now */ } extern WND_W32_shared_state; //////////////////////////////////////////////////////////// //~ Window helpers WND_W32_Window *WND_W32_WindowFromHandle(WND_Handle handle); //////////////////////////////////////////////////////////// //~ Initialization JobDecl(WND_W32_ProcessMessagesForever, EmptySig); //////////////////////////////////////////////////////////// //~ Message processing void WND_W32_PushInput(WND_W32_Window *window, Input input); LRESULT CALLBACK WND_W32_WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);