Skip to content

Commit

Permalink
Remove Time argument from xsetsel
Browse files Browse the repository at this point in the history
This is an X type and should be internal to x.c.

The selcopy() function was a single line and only used in one place, so
it was inlined to reduce LOC.

Signed-off-by: Devin J. Pohly <[email protected]>
  • Loading branch information
djpohly committed Feb 26, 2018
1 parent 323d38d commit 3bb900c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion st.c
Original file line number Diff line number Diff line change
Expand Up @@ -1747,7 +1747,7 @@ strhandle(void)

dec = base64dec(strescseq.args[2]);
if (dec) {
xsetsel(dec, CurrentTime);
xsetsel(dec);
xclipcopy();
} else {
fprintf(stderr, "erresc: invalid base64\n");
Expand Down
2 changes: 1 addition & 1 deletion win.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ int xsetcolorname(int, const char *);
void xsettitle(char *);
int xsetcursor(int);
void xsetpointermotion(int);
void xsetsel(char *, Time);
void xsetsel(char *);
18 changes: 9 additions & 9 deletions x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -440,12 +440,6 @@ bpress(XEvent *e)
}
}

void
selcopy(Time t)
{
xsetsel(getsel(), t);
}

void
propnotify(XEvent *e)
{
Expand Down Expand Up @@ -620,7 +614,7 @@ selrequest(XEvent *e)
}

void
xsetsel(char *str, Time t)
setsel(char *str, Time t)
{
free(sel.primary);
sel.primary = str;
Expand All @@ -630,6 +624,12 @@ xsetsel(char *str, Time t)
selclear_(NULL);
}

void
xsetsel(char *str)
{
setsel(str, CurrentTime);
}

void
brelease(XEvent *e)
{
Expand All @@ -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;
Expand Down

0 comments on commit 3bb900c

Please sign in to comment.