Xinqi Bao's Git
projects
/
st.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
Unhighlight selection when selection is owner by other window
[st.git]
/
st.c
diff --git
a/st.c
b/st.c
index
8e31a73
..
bf3993a
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-311,6
+311,7
@@
static void brelease(XEvent *);
static void bpress(XEvent *);
static void bmotion(XEvent *);
static void selnotify(XEvent *);
static void bpress(XEvent *);
static void bmotion(XEvent *);
static void selnotify(XEvent *);
+static void selclear(XEvent *);
static void selrequest(XEvent *);
static void selinit(void);
static void selrequest(XEvent *);
static void selinit(void);
@@
-336,6
+337,7
@@
static void (*handler[LASTEvent])(XEvent *) = {
[MotionNotify] = bmotion,
[ButtonPress] = bpress,
[ButtonRelease] = brelease,
[MotionNotify] = bmotion,
[ButtonPress] = bpress,
[ButtonRelease] = brelease,
+ [SelectionClear] = selclear,
[SelectionNotify] = selnotify,
[SelectionRequest] = selrequest,
};
[SelectionNotify] = selnotify,
[SelectionRequest] = selrequest,
};
@@
-612,6
+614,13
@@
selpaste() {
XConvertSelection(xw.dpy, XA_PRIMARY, sel.xtarget, XA_PRIMARY, xw.win, CurrentTime);
}
XConvertSelection(xw.dpy, XA_PRIMARY, sel.xtarget, XA_PRIMARY, xw.win, CurrentTime);
}
+void selclear(XEvent *e) {
+ if(sel.bx == -1)
+ return;
+ sel.bx = -1;
+ tsetdirt(sel.b.y, sel.e.y);
+}
+
void
selrequest(XEvent *e) {
XSelectionRequestEvent *xsre;
void
selrequest(XEvent *e) {
XSelectionRequestEvent *xsre;