Index: uspace/srv/hid/display/seat.c
===================================================================
--- uspace/srv/hid/display/seat.c	(revision 2e6394e9b57983df5807f35868516f9bf997dc35)
+++ uspace/srv/hid/display/seat.c	(revision 4055fe6398e8d99d55d7ffceea4e0262d7f27b22)
@@ -104,4 +104,7 @@
 		ds_window_bring_to_top(wnd);
 	}
+
+	/* When focus changes, popup window should be closed */
+	ds_seat_set_popup(seat, NULL);
 }
 
@@ -113,4 +116,13 @@
 void ds_seat_set_popup(ds_seat_t *seat, ds_window_t *wnd)
 {
+	if (wnd == seat->popup)
+		return;
+
+	if (seat->popup != NULL) {
+		/* Window is no longer the popup window, send close request */
+		ds_client_post_close_event(seat->popup->client,
+		    seat->popup);
+	}
+
 	seat->popup = wnd;
 }
@@ -139,5 +151,5 @@
 
 	if (seat->popup == wnd)
-		seat->popup = NULL;
+		ds_seat_set_popup(seat, NULL);
 }
 
@@ -427,9 +439,12 @@
 
 	wnd = ds_display_window_by_pos(seat->display, &seat->pntpos);
-	/*
-	 * Deliver event to popup window, unless the pointer is over
-	 * it (in which case it will be delivered to that window
-	 * below, anyway.
-	 */
+
+	/* Click outside popup window */
+	if (event->type == POS_PRESS && wnd != seat->popup) {
+		/* Close popup window */
+		ds_seat_set_popup(seat, NULL);
+	}
+
+	/* Deliver event to popup window. */
 	if (seat->popup != NULL) {
 		rc = ds_window_post_pos_event(seat->popup, event);
