diff options
author | Jesse Luehrs <doy@tozt.net> | 2016-06-05 04:45:46 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2016-06-05 04:45:46 -0400 |
commit | 7f59d00de5bb1b329ce6d332056f8c55348740b0 (patch) | |
tree | 61cb493af73a42c4a5ea2d58515fb138371899c6 | |
parent | 799bb387606df24b6a267d7956b74a1c29611618 (diff) | |
download | runes-7f59d00de5bb1b329ce6d332056f8c55348740b0.tar.gz runes-7f59d00de5bb1b329ce6d332056f8c55348740b0.zip |
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)
-rw-r--r-- | src/window-xlib.c | 12 |
1 files changed, 12 insertions, 0 deletions
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); |