aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
Diffstat (limited to 'st.c')
-rw-r--r--st.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/st.c b/st.c
index 6ba5c4c..b331ead 100644
--- a/st.c
+++ b/st.c
@@ -35,7 +35,7 @@
35 35
36#define USAGE \ 36#define USAGE \
37 "st-" VERSION ", (c) 2010-2011 st engineers\n" \ 37 "st-" VERSION ", (c) 2010-2011 st engineers\n" \
38 "usage: st [-t title] [-c class] [-v] [-e command...]\n" 38 "usage: st [-t title] [-c class] [-w windowid] [-v] [-e command...]\n"
39 39
40/* Arbitrary sizes */ 40/* Arbitrary sizes */
41#define ESC_TITLE_SIZ 256 41#define ESC_TITLE_SIZ 256
@@ -260,6 +260,7 @@ static pid_t pid;
260static Selection sel; 260static Selection sel;
261static char **opt_cmd = NULL; 261static char **opt_cmd = NULL;
262static char *opt_title = NULL; 262static char *opt_title = NULL;
263static char *opt_embed = NULL;
263static char *opt_class = NULL; 264static char *opt_class = NULL;
264 265
265int 266int
@@ -1606,6 +1607,7 @@ void
1606xinit(void) { 1607xinit(void) {
1607 XSetWindowAttributes attrs; 1608 XSetWindowAttributes attrs;
1608 Cursor cursor; 1609 Cursor cursor;
1610 Window parent;
1609 1611
1610 if(!(xw.dpy = XOpenDisplay(NULL))) 1612 if(!(xw.dpy = XOpenDisplay(NULL)))
1611 die("Can't open display\n"); 1613 die("Can't open display\n");
@@ -1636,7 +1638,8 @@ xinit(void) {
1636 | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask; 1638 | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
1637 attrs.colormap = xw.cmap; 1639 attrs.colormap = xw.cmap;
1638 1640
1639 xw.win = XCreateWindow(xw.dpy, XRootWindow(xw.dpy, xw.scr), 0, 0, 1641 parent = opt_embed ? strtol(opt_embed, NULL, 0) : XRootWindow(xw.dpy, xw.scr);
1642 xw.win = XCreateWindow(xw.dpy, parent, 0, 0,
1640 xw.w, xw.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput, 1643 xw.w, xw.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
1641 XDefaultVisual(xw.dpy, xw.scr), 1644 XDefaultVisual(xw.dpy, xw.scr),
1642 CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask 1645 CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask
@@ -1943,6 +1946,9 @@ main(int argc, char *argv[]) {
1943 case 'c': 1946 case 'c':
1944 if(++i < argc) opt_class = argv[i]; 1947 if(++i < argc) opt_class = argv[i];
1945 break; 1948 break;
1949 case 'w':
1950 if(++i < argc) opt_embed = argv[i];
1951 break;
1946 case 'e': 1952 case 'e':
1947 /* eat every remaining arguments */ 1953 /* eat every remaining arguments */
1948 if(++i < argc) opt_cmd = &argv[i]; 1954 if(++i < argc) opt_cmd = &argv[i];