Xinqi Bao's Git
projects
/
st.git
/ commitdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
patch
|
inline
| side by side (parent:
4736edd
)
add -w option to embed st. (thx nodus cursorius)
author
Aurélien Aptel <
[email protected]
>
Wed, 8 Jun 2011 19:35:58 +0000
(21:35 +0200)
committer
Aurélien Aptel <
[email protected]
>
Wed, 8 Jun 2011 19:35:58 +0000
(21:35 +0200)
st.1
patch
|
blob
|
history
st.c
patch
|
blob
|
history
diff --git
a/st.1
b/st.1
index
69cfe86
..
b6c119f
100644
(file)
--- a/
st.1
+++ b/
st.1
@@
-7,6
+7,8
@@
st \- simple terminal
.IR class ]
.RB [ \-t
.IR title ]
.IR class ]
.RB [ \-t
.IR title ]
+.RB [ \-w
+.IR windowid ]
.RB [ \-v ]
.RB [ \-e
.IR command ...]
.RB [ \-v ]
.RB [ \-e
.IR command ...]
@@
-21,6
+23,10
@@
defines the window title (default 'st').
.BI \-c " class"
defines the window class (default $TERM).
.TP
.BI \-c " class"
defines the window class (default $TERM).
.TP
+.BI \-w " windowid"
+embeds st within the window identified by
+.I windowid
+.TP
.B \-v
prints version information to stderr, then exits.
.TP
.B \-v
prints version information to stderr, then exits.
.TP
diff --git
a/st.c
b/st.c
index
6ba5c4c
..
b331ead
100644
(file)
--- a/
st.c
+++ b/
st.c
@@
-35,7
+35,7
@@
#define USAGE \
"st-" VERSION ", (c) 2010-2011 st engineers\n" \
#define USAGE \
"st-" VERSION ", (c) 2010-2011 st engineers\n" \
- "usage: st [-t title] [-c class] [-v] [-e command...]\n"
+ "usage: st [-t title] [-c class] [-
w windowid] [-
v] [-e command...]\n"
/* Arbitrary sizes */
#define ESC_TITLE_SIZ 256
/* Arbitrary sizes */
#define ESC_TITLE_SIZ 256
@@
-260,6
+260,7
@@
static pid_t pid;
static Selection sel;
static char **opt_cmd = NULL;
static char *opt_title = NULL;
static Selection sel;
static char **opt_cmd = NULL;
static char *opt_title = NULL;
+static char *opt_embed = NULL;
static char *opt_class = NULL;
int
static char *opt_class = NULL;
int
@@
-1606,6
+1607,7
@@
void
xinit(void) {
XSetWindowAttributes attrs;
Cursor cursor;
xinit(void) {
XSetWindowAttributes attrs;
Cursor cursor;
+ Window parent;
if(!(xw.dpy = XOpenDisplay(NULL)))
die("Can't open display\n");
if(!(xw.dpy = XOpenDisplay(NULL)))
die("Can't open display\n");
@@
-1636,7
+1638,8
@@
xinit(void) {
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
attrs.colormap = xw.cmap;
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
attrs.colormap = xw.cmap;
- xw.win = XCreateWindow(xw.dpy, XRootWindow(xw.dpy, xw.scr), 0, 0,
+ parent = opt_embed ? strtol(opt_embed, NULL, 0) : XRootWindow(xw.dpy, xw.scr);
+ xw.win = XCreateWindow(xw.dpy, parent, 0, 0,
xw.w, xw.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
XDefaultVisual(xw.dpy, xw.scr),
CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask
xw.w, xw.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
XDefaultVisual(xw.dpy, xw.scr),
CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask
@@
-1943,6
+1946,9
@@
main(int argc, char *argv[]) {
case 'c':
if(++i < argc) opt_class = argv[i];
break;
case 'c':
if(++i < argc) opt_class = argv[i];
break;
+ case 'w':
+ if(++i < argc) opt_embed = argv[i];
+ break;
case 'e':
/* eat every remaining arguments */
if(++i < argc) opt_cmd = &argv[i];
case 'e':
/* eat every remaining arguments */
if(++i < argc) opt_cmd = &argv[i];