From 7f59d00de5bb1b329ce6d332056f8c55348740b0 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 5 Jun 2016 04:45:46 -0400 Subject: manually send selection clear events when starting a new selection this happens automatically if we're taking over the selection from external windows, but doesn't happen if we're just taking the selection over from another window that we share a display connection with (like other runesc windows) --- src/window-xlib.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/window-xlib.c b/src/window-xlib.c index 57e81aa..f656e03 100644 --- a/src/window-xlib.c +++ b/src/window-xlib.c @@ -719,9 +719,21 @@ static void runes_window_start_selection_loc( RunesWindow *w = t->w; struct vt100_loc *start = &t->display->selection_start; struct vt100_loc *end = &t->display->selection_end; + Window old_owner; *start = *end = *loc; + old_owner = XGetSelectionOwner(w->wb->dpy, XA_PRIMARY); + if (old_owner != w->w) { + XEvent e; + + e.xselectionclear.type = SelectionClear; + e.xselectionclear.window = old_owner; + e.xselectionclear.selection = XA_PRIMARY; + e.xselectionclear.time = CurrentTime; + + XSendEvent(w->wb->dpy, old_owner, False, NoEventMask, &e); + } XSetSelectionOwner(w->wb->dpy, XA_PRIMARY, w->w, time); t->display->has_selection = (XGetSelectionOwner(w->wb->dpy, XA_PRIMARY) == w->w); -- cgit v1.2.3