X-Git-Url: https://git.danieliu.xyz/?p=st.git;a=blobdiff_plain;f=x.c;h=a332ac9386272404aa3d563cfd11ed7740959484;hp=04e2e053b9f4a505c5fe2fa255d4ed6a9806cfce;hb=3bb900cd6c1c7a5364bd79bce63fdd8711bc878b;hpb=323d38da20c8a1d295ab1dbc0fc7ce947ef824e1 diff --git a/x.c b/x.c index 04e2e05..a332ac9 100644 --- a/x.c +++ b/x.c @@ -148,7 +148,7 @@ static void propnotify(XEvent *); static void selnotify(XEvent *); static void selclear_(XEvent *); static void selrequest(XEvent *); -static void selcopy(Time); +static void setsel(char *, Time); static void getbuttoninfo(XEvent *); static void mousereport(XEvent *); static char *kmap(KeySym, uint); @@ -440,12 +440,6 @@ bpress(XEvent *e) } } -void -selcopy(Time t) -{ - xsetsel(getsel(), t); -} - void propnotify(XEvent *e) { @@ -620,7 +614,7 @@ selrequest(XEvent *e) } void -xsetsel(char *str, Time t) +setsel(char *str, Time t) { free(sel.primary); sel.primary = str; @@ -630,6 +624,12 @@ xsetsel(char *str, Time t) selclear_(NULL); } +void +xsetsel(char *str) +{ + setsel(str, CurrentTime); +} + void brelease(XEvent *e) { @@ -643,7 +643,7 @@ brelease(XEvent *e) } else if (e->xbutton.button == Button1) { if (sel.mode == SEL_READY) { getbuttoninfo(e); - selcopy(e->xbutton.time); + setsel(getsel(), e->xbutton.time); } else selclear_(NULL); sel.mode = SEL_IDLE;