Xinqi Bao's Git
projects
/
st.git
/ commitdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (from parent 1:
65976c1
)
Inline clipboard functions
author
Devin J. Pohly <
[email protected]
>
Tue, 17 Oct 2017 20:43:32 +0000
(15:43 -0500)
committer
Devin J. Pohly <
[email protected]
>
Mon, 26 Feb 2018 03:53:24 +0000
(21:53 -0600)
No need to keep a function that only calls another function in the same
file.
Signed-off-by: Devin J. Pohly <
[email protected]
>
win.h
patch
|
blob
|
history
x.c
patch
|
blob
|
history
diff --git
a/win.h
b/win.h
index
b7022ec
..
beb458d
100644
(file)
--- a/
win.h
+++ b/
win.h
@@
-10,11
+10,9
@@
void drawregion(int, int, int, int);
void xbell(void);
void xclipcopy(void);
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 xhints(void);
void xloadcols(void);
int xsetcolorname(int, const char *);
void xsettitle(char *);
void xsetpointermotion(int);
-void xselpaste(void);
void xsetsel(char *, Time);
void xsetsel(char *, Time);
diff --git
a/x.c
b/x.c
index
cb8c351
..
46356fe
100644
(file)
--- a/
x.c
+++ b/
x.c
@@
-210,19
+210,33
@@
static char *opt_title = NULL;
void
clipcopy(const Arg *dummy)
{
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)
{
}
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)
{
}
void
selpaste(const Arg *dummy)
{
- xselpaste();
+ XConvertSelection(xw.dpy, XA_PRIMARY, xsel.xtarget, XA_PRIMARY,
+ xw.win, CurrentTime);
}
void
}
void
@@
-518,36
+532,10
@@
selnotify(XEvent *e)
XDeleteProperty(xw.dpy, xw.win, (int)property);
}
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)
{
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
}
void
@@
-634,7
+622,7
@@
brelease(XEvent *e)
}
if (e->xbutton.button == Button2) {
}
if (e->xbutton.button == Button2) {
-
xselpaste(
);
+
selpaste(NULL
);
} else if (e->xbutton.button == Button1) {
if (sel.mode == SEL_READY) {
getbuttoninfo(e);
} else if (e->xbutton.button == Button1) {
if (sel.mode == SEL_READY) {
getbuttoninfo(e);