Exit when compton loses the _NET_WM_CM_Sn selection

Again, this behaviour is required by ICCCM.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2015-10-24 12:42:16 +02:00 committed by Yuxuan Shui
parent f8ea3e8668
commit 1125389910
1 changed files with 13 additions and 0 deletions

View File

@ -4352,6 +4352,16 @@ ev_screen_change_notify(session_t *ps,
}
}
inline static void
ev_selection_clear(session_t *ps,
XSelectionClearEvent __attribute__((unused)) *ev) {
// The only selection we own is the _NET_WM_CM_Sn selection.
// If we lose that one, we should exit.
fprintf(stderr, "Another composite manager started and "
"took the _NET_WM_CM_Sn selection.\n");
exit(1);
}
#if defined(DEBUG_EVENTS) || defined(DEBUG_RESTACK)
/**
* Get a window's name from window ID.
@ -4444,6 +4454,9 @@ ev_handle(session_t *ps, XEvent *ev) {
case PropertyNotify:
ev_property_notify(ps, (XPropertyEvent *)ev);
break;
case SelectionClear:
ev_selection_clear(ps, (XSelectionClearEvent *)ev);
break;
default:
if (ps->shape_exists && ev->type == ps->shape_event) {
ev_shape_notify(ps, (XShapeEvent *) ev);