+int IPC_Msg_Ping(tIPC_Client *Client, tAxWin_IPCMessage *Msg)
+{
+ ASSERT(Msg->ID == IPCMSG_PING);
+
+ if( !(Msg->Flags & IPCMSG_FLAG_RETURN) ) return 0;
+
+ if( Msg->Size < 4 ) return -1;
+
+ tIPCMsg_ReturnInt *ret = (void*)Msg->Data;
+ Msg->ID = IPCMSG_PING;
+ Msg->Size = sizeof(*ret);
+ ret->Value = AXWIN_VERSION;
+ Client->IPCType->SendMessage(Client->Ident, sizeof(*Msg)+sizeof(*ret), Msg);
+ return 0;
+}
+
+int IPC_Msg_GetDisplayCount(tIPC_Client *Client, tAxWin_IPCMessage *Msg)
+{
+ tAxWin_IPCMessage *ret_hdr;
+ tIPCMsg_ReturnInt *ret;
+ char buf[sizeof(*ret_hdr)+sizeof(*ret)];
+
+ ASSERT(Msg->ID == IPCMSG_GETDISPLAYCOUNT);
+
+ if( !(Msg->Flags & IPCMSG_FLAG_RETURN) ) return 0;
+
+ ret_hdr = (void*)buf;
+ ret_hdr->ID = IPCMSG_GETDISPLAYCOUNT;
+ ret_hdr->Flags = 0;
+ ret_hdr->Window = -1;
+ ret_hdr->Size = sizeof(*ret);
+ ret = (void*)ret_hdr->Data;
+ ret->Value = 1; // HARD CODE - Current version only supports one display
+
+ Client->IPCType->SendMessage(Client->Ident, sizeof(buf), buf);
+ return 0;
+}
+
+int IPC_Msg_GetDisplayDims(tIPC_Client *Client, tAxWin_IPCMessage *Msg)
+{
+ tIPCMsg_GetDisplayDims *info;
+ tAxWin_IPCMessage *ret_hdr;
+ tIPCMsg_RetDisplayDims *ret;
+ char buf[sizeof(*ret_hdr)+sizeof(*ret)];
+
+ ASSERT(Msg->ID == IPCMSG_GETDISPLAYDIMS);
+
+ if( !(Msg->Flags & IPCMSG_FLAG_RETURN) ) return 0;
+
+ info = (void*)Msg->Data;
+
+ ret_hdr = (void*)buf;
+ ret_hdr->ID = IPCMSG_GETDISPLAYDIMS;
+ ret_hdr->Flags = 0;
+ ret_hdr->Window = -1;
+ ret_hdr->Size = sizeof(*ret);
+ ret = (void*)ret_hdr->Data;
+
+ // HARD CODE! Only one display supported
+ if( info->DisplayID == 0 )
+ {
+ ret->X = 0;
+ ret->Y = 0;
+ ret->W = giScreenWidth;
+ ret->H = giScreenHeight;
+ }
+ else
+ {
+ ret->X = 0; ret->Y = 0;
+ ret->W = 0; ret->H = 0;
+ }
+
+ Client->IPCType->SendMessage(Client->Ident, sizeof(buf), buf);
+ return 0;
+}
+
+int IPC_Msg_SendMsg(tIPC_Client *Client, tAxWin_IPCMessage *Msg)
+{
+ tIPCMsg_SendMsg *info = (void*)Msg->Data;
+ tWindow *src, *dest;
+
+ ASSERT(Msg->ID == IPCMSG_SENDMSG);
+
+ // - Sanity checks
+ if( Msg->Size < sizeof(tIPCMsg_SendMsg) )
+ return -1;
+ if( Msg->Size < sizeof(tIPCMsg_SendMsg) + info->Length )
+ return -1;
+
+ src = IPC_int_GetWindow(Client, Msg->Window);
+ if(!src) return 1;
+ dest = IPC_int_GetWindow(Client, info->Remote);
+ if(!dest) return 1;
+
+ WM_SendMessage(src, dest, info->ID, info->Length, info->Data);
+
+ return 0;
+}
+