changeset: 204:6c311c25323e
tag: tip
user: Aurélien Aptel <aurelien.aptel_AT_gmail.com>
date: Wed Jun 08 21:35:58 2011 +0200
files: st.1 st.c
description:
add -w option to embed st. (thx nodus cursorius)
diff -r 1ab99c17a30c -r 6c311c25323e st.1
--- a/st.1 Wed Jun 08 20:26:00 2011 +0200
+++ b/st.1 Wed Jun 08 21:35:58 2011 +0200
@@ -7,6 +7,8 @@
.IR class ]
.RB [ \-t
.IR title ]
+.RB [ \-w
+.IR windowid ]
.RB [ \-v ]
.RB [ \-e
.IR command ...]
@@ -21,6 +23,10 @@
.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
diff -r 1ab99c17a30c -r 6c311c25323e st.c
--- a/st.c Wed Jun 08 20:26:00 2011 +0200
+++ b/st.c Wed Jun 08 21:35:58 2011 +0200
@@ -35,7 +35,7 @@
#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
@@ -260,6 +260,7 @@
static Selection sel;
static char **opt_cmd = NULL;
static char *opt_title = NULL;
+static char *opt_embed = NULL;
static char *opt_class = NULL;
int
@@ -1606,6 +1607,7 @@
xinit(void) {
XSetWindowAttributes attrs;
Cursor cursor;
+ Window parent;
if(!(xw.dpy = XOpenDisplay(NULL)))
die("Can't open display\n");
@@ -1636,7 +1638,8 @@
| 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
@@ -1943,6 +1946,9 @@
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];
Received on Wed Jun 08 2011 - 21:36:02 CEST
This archive was generated by hypermail 2.2.0 : Wed Jun 08 2011 - 21:48:05 CEST