server: Support for closing the desktop window.
If a thread is owning the desktop window, when all other users of the
desktop have exited, signal the owner to close the desktop (with a 1
second delay).
diff --git a/server/window.c b/server/window.c
index 812ecee..8b7af20 100644
--- a/server/window.c
+++ b/server/window.c
@@ -351,6 +351,21 @@
free( win );
}
+/* get the process owning the top window of a given desktop */
+struct process *get_top_window_owner( struct desktop *desktop )
+{
+ struct window *win = desktop->top_window;
+ if (!win || !win->thread) return NULL;
+ return win->thread->process;
+}
+
+/* attempt to close the desktop window when the last process using it is gone */
+void close_desktop_window( struct desktop *desktop )
+{
+ struct window *win = desktop->top_window;
+ if (win && win->thread) post_message( win->handle, WM_SYSCOMMAND, SC_CLOSE, 0 );
+}
+
/* create a new window structure (note: the window is not linked in the window tree) */
static struct window *create_window( struct window *parent, struct window *owner,
atom_t atom, void *instance )