+void IPC_int_DropClient(tIPC_Client *Client)
+{
+ // Remove from client list
+ int pos;
+ if( !IPC_int_BSearchClients(Client, &pos) ) {
+ _SysDebug("IPC_int_DropClient: Can't find client %p", Client);
+ return ;
+ }
+
+ giIPC_ClientCount --;
+ memmove(&gIPC_Clients[pos], &gIPC_Clients[pos+1], (giIPC_ClientCount-pos)*sizeof(tIPC_Client*));
+
+ // Terminate client's windows
+ // - If there were active windows, show an error?
+ int nWindowsDestroyed = 0;
+ for(int i = 0; i < Client->nWindows; i ++)
+ {
+ if( Client->Windows[i] )
+ {
+ _SysDebug("Window %p:%i %p still exists", Client, i, Client->Windows[i]);
+ WM_DestroyWindow(Client->Windows[i]);
+ nWindowsDestroyed ++;
+ }
+ }
+ if( nWindowsDestroyed )
+ {
+ _SysDebug("TODO: Show notice that application exited without destroying windows");
+ }
+
+ // Free client structure
+ free(Client);
+ _SysDebug("Dropped client %p", Client);
+}
+