Skip to content

Commit

Permalink
Exit when compton loses the _NET_WM_CM_Sn selection
Browse files Browse the repository at this point in the history
Again, this behaviour is required by ICCCM.

Signed-off-by: Uli Schlachter <psychon@znc.in>
  • Loading branch information
psychon authored and yshui committed Oct 8, 2016
1 parent 2653def commit 930a152
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/compton.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 930a152

Please sign in to comment.