diff options
| author | Aurélien Aptel <aurelien.aptel@gmail.com> | 2011-06-08 21:35:58 +0200 |
|---|---|---|
| committer | Aurélien Aptel <aurelien.aptel@gmail.com> | 2011-06-08 21:35:58 +0200 |
| commit | 3959a99293785e603270d8798fbe0cb2ba0ae0ee (patch) | |
| tree | e906e58aa8338ad307f318368fe6d602cc805240 /st.c | |
| parent | applied parts of "anonymous" cleanup patch. (diff) | |
| download | st-3959a99293785e603270d8798fbe0cb2ba0ae0ee.tar.gz st-3959a99293785e603270d8798fbe0cb2ba0ae0ee.zip | |
add -w option to embed st. (thx nodus cursorius)
Diffstat (limited to '')
| -rw-r--r-- | st.c | 10 |
1 files changed, 8 insertions, 2 deletions
| @@ -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; | |||
| 260 | static Selection sel; | 260 | static Selection sel; |
| 261 | static char **opt_cmd = NULL; | 261 | static char **opt_cmd = NULL; |
| 262 | static char *opt_title = NULL; | 262 | static char *opt_title = NULL; |
| 263 | static char *opt_embed = NULL; | ||
| 263 | static char *opt_class = NULL; | 264 | static char *opt_class = NULL; |
| 264 | 265 | ||
| 265 | int | 266 | int |
| @@ -1606,6 +1607,7 @@ void | |||
| 1606 | xinit(void) { | 1607 | xinit(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]; |
