extern void Input_HandleSelect(fd_set *set);
// --- IPC ---
extern void IPC_Init(void);
-extern void IPC_FillSelect(int *nfds, fd_set *set);
-extern void IPC_HandleSelect(fd_set *set);
+extern void IPC_FillSelect(int *nfds, fd_set *set, fd_set *err_set);
+extern void IPC_HandleSelect(fd_set *set, fd_set *err_set);
#endif
// === PROTOTYPES ===
void IPC_Init(void);
-void IPC_FillSelect(int *nfds, fd_set *set);
-void IPC_HandleSelect(fd_set *set);
+void IPC_FillSelect(int *nfds, fd_set *set, fd_set *err_set);
+void IPC_HandleSelect(fd_set *set, fd_set *err_set);
int IPC_Type_Datagram_GetSize(const void *Ident);
int IPC_Type_Datagram_Compare(const void *Ident1, const void *Ident2);
void IPC_Type_Datagram_Send(const void *Ident, size_t Length, const void *Data);
}
}
-void IPC_FillSelect(int *nfds, fd_set *set)
+void IPC_FillSelect(int *nfds, fd_set *set, fd_set *err_set)
{
_setfd(giNetworkFileHandle, nfds, set);
_setfd(giIPCPipeHandle, nfds, set);
for( int i = 0; i < giIPC_ClientCount; i ++ )
{
- if( gIPC_Clients[i] && gIPC_Clients[i]->IPCType == &gIPC_Type_IPCPipe )
+ if( gIPC_Clients[i] && gIPC_Clients[i]->IPCType == &gIPC_Type_IPCPipe ) {
_setfd( *(int*)(gIPC_Clients[i]->Ident), nfds, set );
+ _setfd( *(int*)(gIPC_Clients[i]->Ident), nfds, err_set );
+ }
}
}
-void IPC_HandleSelect(fd_set *set)
+void IPC_HandleSelect(fd_set *set, fd_set *err_set)
{
if( giNetworkFileHandle != -1 && FD_ISSET(giNetworkFileHandle, set) )
{
}
IPC_Handle( gIPC_Clients[i], len, (void*)staticBuf );
}
+ if( FD_ISSET(fd, err_set) )
+ {
+ // Client disconnected
+ IPC_int_DropClient(gIPC_Clients[i]);
+ _SysClose(fd);
+ }
}
}
for(;;)
{
fd_set fds;
+ fd_set efds;
int nfds = 0;
FD_ZERO(&fds);
+ FD_ZERO(&efds);
WM_Update();
Input_FillSelect(&nfds, &fds);
- IPC_FillSelect(&nfds, &fds);
+ IPC_FillSelect(&nfds, &fds, &efds);
nfds ++;
- if( _SysSelect(nfds, &fds, NULL, NULL, NULL, THREAD_EVENT_IPCMSG) == -1 ) {
+ if( _SysSelect(nfds, &fds, NULL, &efds, NULL, THREAD_EVENT_IPCMSG) == -1 ) {
_SysDebug("ERROR: select() returned -1");
return -1;
}
Input_HandleSelect(&fds);
- IPC_HandleSelect(&fds);
+ IPC_HandleSelect(&fds, &efds);
}
return 0;
}
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;
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?
free(Window->Title);
free(Window->RenderBuffer);
free(Window);
+ IPC_int_SetWindow(Window->Client, Window->ID, NULL);
}
tWindow *WM_GetWindowByID(tWindow *Requester, uint32_t ID)