tabbed

[archived] [fork] xembed tabbing program
git clone https://hhvn.uk/tabbed
git clone git://hhvn.uk/tabbed
Log | Files | Refs | README | LICENSE

self-embed.patch (1370B)


      1 diff --git a/tabbed.c b/tabbed.c
      2 index 8066028..dae4ddc 100644
      3 --- a/tabbed.c
      4 +++ b/tabbed.c
      5 @@ -168,6 +168,7 @@ static int cmd_append_pos;
      6  static char winid[64];
      7  static char **cmd;
      8  static char *wmname = "tabbed";
      9 +static char *selfembed = NULL;
     10  static const char *geometry;
     11  
     12  char *argv0;
     13 @@ -977,6 +978,7 @@ setup(void)
     14  {
     15  	int bitm, tx, ty, tw, th, dh, dw, isfixed;
     16  	XWMHints *wmh;
     17 +	Window parent;
     18  	XClassHint class_hint;
     19  	XSizeHints *size_hint;
     20  
     21 @@ -986,6 +988,8 @@ setup(void)
     22  	/* init screen */
     23  	screen = DefaultScreen(dpy);
     24  	root = RootWindow(dpy, screen);
     25 +	if (!(selfembed && (parent = strtol(selfembed, NULL, 0))))
     26 +		parent = root;
     27  	initfont(font);
     28  	bh = dc.h = dc.font.height + 2;
     29  
     30 @@ -1043,7 +1047,7 @@ setup(void)
     31  	                            DefaultDepth(dpy, screen));
     32  	dc.gc = XCreateGC(dpy, root, 0, 0);
     33  
     34 -	win = XCreateSimpleWindow(dpy, root, wx, wy, ww, wh, 0,
     35 +	win = XCreateSimpleWindow(dpy, parent, wx, wy, ww, wh, 0,
     36  	                          dc.norm[ColFG].pixel, dc.norm[ColBG].pixel);
     37  	XMapRaised(dpy, win);
     38  	XSelectInput(dpy, win, SubstructureNotifyMask | FocusChangeMask |
     39 @@ -1340,6 +1344,9 @@ main(int argc, char *argv[])
     40  		die("tabbed-"VERSION", © 2009-2016 tabbed engineers, "
     41  		    "see LICENSE for details.\n");
     42  		break;
     43 +	case 'e':
     44 +		selfembed = EARGF(usage());
     45 +		break;
     46  	default:
     47  		usage();
     48  		break;