X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Faxwin3_src%2Flibaxwin3.so_src%2Fwm.c;h=8b13860645677b6fd6ae3d76ccc9dc1b861c1750;hb=e02f66c7125bf18f77c6c53587238cbd49da2c89;hp=a03aa9a8ac60cffea389cd46544d884b6025b4fb;hpb=d2e9501431148e85345cefe6315f0eace0dfd777;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 a03aa9a8..8b138606 100644 --- a/Usermode/Applications/axwin3_src/libaxwin3.so_src/wm.c +++ b/Usermode/Applications/axwin3_src/libaxwin3.so_src/wm.c @@ -54,7 +54,7 @@ tWindow *AxWin3_int_GetWindowFromID(uint32_t ServerID) tWindow *AxWin3_int_AllocateWindowInfo(int DataBytes, int *WinID) { int idx, newWinID; - tWindowBlock *block, *prev; + tWindowBlock *block, *prev = NULL; tWindow *ret; block = &gAxWin3_WindowList; @@ -188,14 +188,37 @@ void AxWin3_int_HandleMessage(tAxWin_IPCMessage *Msg) { case IPCMSG_SENDMSG: { tIPCMsg_SendMsg *info = (void*)Msg->Data; - if(Msg->Size < sizeof(*info)) return ; - if(Msg->Size < sizeof(*info) + info->Length) return ; - if(!dest || !dest->Handler) return ; + if(Msg->Size < sizeof(*info) || Msg->Size < sizeof(*info) + info->Length) { + _SysDebug("Message is undersized (%i < %i + %i)", + Msg->Size < sizeof(*info), info->Length); + return ; + } + if(!dest || !dest->Handler) { + _SysDebug("No handler for destination %p", dest); + return ; + } + _SysDebug("IPC Message 0x%x - %i bytes", info->ID, info->Length); dest->Handler(dest, info->ID, info->Length, info->Data); break; } + default: + _SysDebug("Unknow message ID %i", Msg->ID); + break; } } +void AxWin3_SetWindowTitle(tHWND Window, const char *Title) +{ + tAxWin_IPCMessage *msg; + int len = strlen(Title); + + msg = AxWin3_int_AllocateIPCMessage(Window, IPCMSG_SETWINTITLE, 0, len+1); + strcpy(msg->Data, Title); + + AxWin3_int_SendIPCMessage(msg); + + free(msg); +} + void AxWin3_SendMessage(tHWND Window, tHWND Destination, int Message, int Length, void *Data) { tAxWin_IPCMessage *msg; @@ -212,14 +235,38 @@ void AxWin3_SendMessage(tHWND Window, tHWND Destination, int Message, int Length free(msg); } +void AxWin3_FocusWindow(tHWND Window) +{ + tAxWin_IPCMessage *msg; + + msg = AxWin3_int_AllocateIPCMessage(Window, IPCMSG_FOCUSWINDOW, 0, 0); + + AxWin3_int_SendIPCMessage(msg); + free(msg); +} + void AxWin3_ShowWindow(tHWND Window, int bShow) { tAxWin_IPCMessage *msg; - tIPCMsg_ShowWindow *info; + tIPCMsg_Boolean *info; msg = AxWin3_int_AllocateIPCMessage(Window, IPCMSG_SHOWWINDOW, 0, sizeof(*info)); info = (void*)msg->Data; - info->bShow = !!bShow; + info->Value = !!bShow; + + AxWin3_int_SendIPCMessage(msg); + + free(msg); +} + +void AxWin3_DecorateWindow(tHWND Window, int bDecorate) +{ + tAxWin_IPCMessage *msg; + tIPCMsg_Boolean *info; + + msg = AxWin3_int_AllocateIPCMessage(Window, IPCMSG_DECORATEWINDOW, 0, sizeof(*info)); + info = (void*)msg->Data; + info->Value = !!bDecorate; AxWin3_int_SendIPCMessage(msg);