X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Faxwin3_src%2FWM%2Fwm.c;h=342f4104644ba66bf06795b5f77c52c051600ea4;hb=3ad4532bb952dbcb28a2b9fa72d7f1f87b5f8fd4;hp=4b28d11d5ce6f53e06545c3df6b14e7a49494cd6;hpb=608ec5aa6e1bd522777faa63323beaeaef928928;p=tpg%2Facess2.git diff --git a/Usermode/Applications/axwin3_src/WM/wm.c b/Usermode/Applications/axwin3_src/WM/wm.c index 4b28d11d..342f4104 100644 --- a/Usermode/Applications/axwin3_src/WM/wm.c +++ b/Usermode/Applications/axwin3_src/WM/wm.c @@ -12,11 +12,19 @@ #include #include #include +#include // === IMPORTS === +extern int Renderer_Menu_Init(void); +extern int Renderer_Widget_Init(void); +extern int Renderer_Background_Init(void); +extern int Renderer_Framebuffer_Init(void); +extern int Renderer_RichText_Init(void); + extern void IPC_SendWMMessage(tIPC_Client *Client, uint32_t Src, uint32_t Dst, int Msg, int Len, const void *Data); extern void IPC_SendReply(tIPC_Client *Client, uint32_t WinID, int MsgID, size_t Len, const void *Data); extern tWindow *IPC_int_GetWindow(tIPC_Client *Client, uint32_t ID); +extern void IPC_int_SetWindow(tIPC_Client *Client, uint32_t ID, tWindow *Window); // === GLOBALS === tWMRenderer *gpWM_Renderers; @@ -29,15 +37,40 @@ tWindow *gpWM_HilightedWindow; // === CODE === void WM_Initialise(void) { + // TODO: Autodetect these + Renderer_Menu_Init(); + Renderer_Widget_Init(); + Renderer_Background_Init(); + Renderer_Framebuffer_Init(); + Renderer_RichText_Init(); + WM_CreateWindow(NULL, NULL, 0, 0x0088FF, "Background"); gpWM_RootWindow->W = giScreenWidth; gpWM_RootWindow->H = giScreenHeight; gpWM_RootWindow->Flags = WINFLAG_SHOW|WINFLAG_NODECORATE; + + // TODO: Move these to config + uint32_t keys[4]; + keys[0] = KEYSYM_LEFTGUI; keys[1] = KEYSYM_r; + WM_Hotkey_Register(2, keys, "Interface>Run"); + keys[0] = KEYSYM_LEFTGUI; keys[1] = KEYSYM_t; + WM_Hotkey_Register(2, keys, "Interface>Terminal"); + keys[0] = KEYSYM_LEFTGUI; keys[1] = KEYSYM_e; + WM_Hotkey_Register(2, keys, "Interface>TextEdit"); } void WM_RegisterRenderer(tWMRenderer *Renderer) { - // TODO: Catch out duplicates + // Catch out duplicates + for(tWMRenderer *r = gpWM_Renderers; r; r = r->Next ) { + if( r == Renderer ) { + return ; + } + if( strcmp(r->Name, Renderer->Name) == 0 ) { + return ; + } + } + Renderer->Next = gpWM_Renderers; gpWM_Renderers = Renderer; } @@ -113,7 +146,8 @@ void WM_DestroyWindow(tWindow *Window) Window->Parent->LastChild = prev; } // - Full invalidate - WM_Invalidate(Window, 1); + WM_Invalidate(Window, 0); + Window->Parent->Flags &= ~WINFLAG_CLEAN; // Mark parent as unclean, forcing redraw // - Remove from inheritance tree? @@ -144,6 +178,7 @@ void WM_DestroyWindow(tWindow *Window) free(Window->Title); free(Window->RenderBuffer); free(Window); + IPC_int_SetWindow(Window->Client, Window->ID, NULL); } tWindow *WM_GetWindowByID(tWindow *Requester, uint32_t ID)