X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Faxwin3_src%2Flibaxwin3.so_src%2Fwm.c;h=f1de00b72cdfe46148448a1589bfb6fbf61f01b4;hb=e3aca1210498cec4f1cb4d9337aeb774990194a0;hp=99b9a1b63b74b267ae8c7848bf4e67d936469e70;hpb=edb8fa42cff3758a25e985f4fdd7119b6206ce0a;p=tpg%2Facess2.git diff --git a/Usermode/Applications/axwin3_src/libaxwin3.so_src/wm.c b/Usermode/Applications/axwin3_src/libaxwin3.so_src/wm.c index 99b9a1b6..f1de00b7 100644 --- a/Usermode/Applications/axwin3_src/libaxwin3.so_src/wm.c +++ b/Usermode/Applications/axwin3_src/libaxwin3.so_src/wm.c @@ -54,6 +54,20 @@ tWindow *AxWin3_int_GetWindowFromID(uint32_t ServerID) return block->Windows[ServerID]; } +void AxWin3_int_DelWindowByID(uint32_t ServerID) +{ + int orig_id = ServerID; + tWindowBlock *block = &gAxWin3_WindowList; + while(block && ServerID > WINDOWS_PER_ALLOC) { + block = block->Next; + ServerID -= WINDOWS_PER_ALLOC; + } + if( !block || !block->Windows[ServerID] ) + _SysDebug("AxWin3_int_DelWindowByID - Id %i out of range", orig_id); + else + block->Windows[ServerID] = NULL; +} + tWindow *AxWin3_int_AllocateWindowInfo(int DataBytes, int *WinID) { int idx, newWinID; @@ -208,6 +222,7 @@ int AxWin3_int_DefaultMessageHandler(tWindow *Win, int ID, size_t Len, const voi case WNDMSG_DESTROY: _SysDebug("TODO: Check that WNDMSG_DESTROY was from us calling _DestroyWindow"); // TODO: Finalise cleanup of window, this will be the last message sent to this window + AxWin3_int_DelWindowByID(Win->ServerID); return 1; default: return 0; @@ -310,9 +325,7 @@ void *AxWin3_WaitMessage(tHWND Window, int MessageID, size_t *Length) void AxWin3_SendIPC(tHWND Window, int Message, size_t Length, const void *Data) { - tAxWin_IPCMessage *msg; - - msg = AxWin3_int_AllocateIPCMessage(Window, Message, IPCMSG_FLAG_RENDERER, Length); + tAxWin_IPCMessage *msg = AxWin3_int_AllocateIPCMessage(Window, Message, IPCMSG_FLAG_RENDERER, Length); memcpy(msg->Data, Data, Length); AxWin3_int_SendIPCMessage(msg); free(msg);