From 1125389910f7134766686de68217578bed4f602b Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 24 Oct 2015 12:42:16 +0200 Subject: [PATCH] Exit when compton loses the _NET_WM_CM_Sn selection Again, this behaviour is required by ICCCM. Signed-off-by: Uli Schlachter --- src/compton.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/compton.c b/src/compton.c index 31eff5f3..8b4d7be1 100644 --- a/src/compton.c +++ b/src/compton.c @@ -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);