mirror of
https://github.com/LukeSmithxyz/st.git
synced 2024-11-22 15:25:58 +01:00
Inline clipboard functions
No need to keep a function that only calls another function in the same file. Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
This commit is contained in:
parent
65976c1a29
commit
428f01969a
2 changed files with 19 additions and 33 deletions
2
win.h
2
win.h
|
@ -10,11 +10,9 @@ void drawregion(int, int, int, int);
|
|||
|
||||
void xbell(void);
|
||||
void xclipcopy(void);
|
||||
void xclippaste(void);
|
||||
void xhints(void);
|
||||
void xloadcols(void);
|
||||
int xsetcolorname(int, const char *);
|
||||
void xsettitle(char *);
|
||||
void xsetpointermotion(int);
|
||||
void xselpaste(void);
|
||||
void xsetsel(char *, Time);
|
||||
|
|
50
x.c
50
x.c
|
@ -210,19 +210,33 @@ static char *opt_title = NULL;
|
|||
void
|
||||
clipcopy(const Arg *dummy)
|
||||
{
|
||||
xclipcopy();
|
||||
Atom clipboard;
|
||||
|
||||
if (sel.clipboard != NULL)
|
||||
free(sel.clipboard);
|
||||
|
||||
if (sel.primary != NULL) {
|
||||
sel.clipboard = xstrdup(sel.primary);
|
||||
clipboard = XInternAtom(xw.dpy, "CLIPBOARD", 0);
|
||||
XSetSelectionOwner(xw.dpy, clipboard, xw.win, CurrentTime);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
clippaste(const Arg *dummy)
|
||||
{
|
||||
xclippaste();
|
||||
Atom clipboard;
|
||||
|
||||
clipboard = XInternAtom(xw.dpy, "CLIPBOARD", 0);
|
||||
XConvertSelection(xw.dpy, clipboard, xsel.xtarget, clipboard,
|
||||
xw.win, CurrentTime);
|
||||
}
|
||||
|
||||
void
|
||||
selpaste(const Arg *dummy)
|
||||
{
|
||||
xselpaste();
|
||||
XConvertSelection(xw.dpy, XA_PRIMARY, xsel.xtarget, XA_PRIMARY,
|
||||
xw.win, CurrentTime);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -518,36 +532,10 @@ selnotify(XEvent *e)
|
|||
XDeleteProperty(xw.dpy, xw.win, (int)property);
|
||||
}
|
||||
|
||||
void
|
||||
xselpaste(void)
|
||||
{
|
||||
XConvertSelection(xw.dpy, XA_PRIMARY, xsel.xtarget, XA_PRIMARY,
|
||||
xw.win, CurrentTime);
|
||||
}
|
||||
|
||||
void
|
||||
xclipcopy(void)
|
||||
{
|
||||
Atom clipboard;
|
||||
|
||||
if (sel.clipboard != NULL)
|
||||
free(sel.clipboard);
|
||||
|
||||
if (sel.primary != NULL) {
|
||||
sel.clipboard = xstrdup(sel.primary);
|
||||
clipboard = XInternAtom(xw.dpy, "CLIPBOARD", 0);
|
||||
XSetSelectionOwner(xw.dpy, clipboard, xw.win, CurrentTime);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xclippaste(void)
|
||||
{
|
||||
Atom clipboard;
|
||||
|
||||
clipboard = XInternAtom(xw.dpy, "CLIPBOARD", 0);
|
||||
XConvertSelection(xw.dpy, clipboard, xsel.xtarget, clipboard,
|
||||
xw.win, CurrentTime);
|
||||
clipcopy(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -634,7 +622,7 @@ brelease(XEvent *e)
|
|||
}
|
||||
|
||||
if (e->xbutton.button == Button2) {
|
||||
xselpaste();
|
||||
selpaste(NULL);
|
||||
} else if (e->xbutton.button == Button1) {
|
||||
if (sel.mode == SEL_READY) {
|
||||
getbuttoninfo(e);
|
||||
|
|
Loading…
Reference in a new issue