Krolyxon
Commit 0b758e0

Branches

Refs →

nsxiv0b758e0

added support for XEMBED into other windows (ie tabbed) with -w

Author
shuall
Date
2016-10-28 22:09 -0400
Parent
878d970
Commit
0b758e08f2bca283eb930ede8165bfa26e6cacea

+16 −3

4 files changed

  1. M options.c +9 −2
  2. M options.h +1 −0
  3. M window.c +5 −1
  4. M window.h +1 −0
M options.c View
@@ -33,7 +33,7 @@ const options_t *options = (const options_t*) &_options;
3333 void print_usage(void)
3434 {
3535 printf("usage: sxiv [-abcfhioqrtvZ] [-G GAMMA] [-g GEOMETRY] [-n NUM] "
36− "[-N NAME] [-S DELAY] [-s MODE] [-z ZOOM] FILES...\n");
36+ "[-N NAME] [-S DELAY] [-s MODE] [-z ZOOM] [-w WID] FILES...\n");
3737 }
3838
3939 void print_version(void)
@@ -62,6 +62,7 @@ void parse_options(int argc, char **argv)
6262 _options.slideshow = 0;
6363
6464 _options.fullscreen = false;
65+ _options.embed = 0;
6566 _options.hide_bar = false;
6667 _options.geometry = NULL;
6768 _options.res_name = NULL;
@@ -70,7 +71,7 @@ void parse_options(int argc, char **argv)
7071 _options.thumb_mode = false;
7172 _options.clean_cache = false;
7273
73− while ((opt = getopt(argc, argv, "abcfG:g:hin:N:oqrS:s:tvZz:")) != -1) {
74+ while ((opt = getopt(argc, argv, "abcfG:g:hin:N:oqrS:s:tvw:Zz:")) != -1) {
7475 switch (opt) {
7576 case '?':
7677 print_usage();
@@ -138,6 +139,12 @@ void parse_options(int argc, char **argv)
138139 case 'v':
139140 print_version();
140141 exit(EXIT_SUCCESS);
142+ case 'w':
143+ n = strtol(optarg, &end, 0);
144+ if (*end != '\0')
145+ error(EXIT_FAILURE, 0, "Invalid argument for option -w: %s", optarg);
146+ _options.embed = n;
147+ break;
141148 case 'Z':
142149 _options.scalemode = SCALE_ZOOM;
143150 _options.zoom = 1.0;
M options.h View
@@ -41,6 +41,7 @@ typedef struct {
4141 /* window: */
4242 bool fullscreen;
4343 bool hide_bar;
44+ long embed;
4445 char *geometry;
4546 char *res_name;
4647
M window.c View
@@ -133,6 +133,7 @@ void win_init(win_t *win)
133133 win->bar.l.buf = emalloc(win->bar.l.size);
134134 win->bar.r.buf = emalloc(win->bar.r.size);
135135 win->bar.h = options->hide_bar ? 0 : barheight;
136+ win->embed = options->embed;
136137
137138 INIT_ATOM_(WM_DELETE_WINDOW);
138139 INIT_ATOM_(_NET_WM_NAME);
@@ -197,7 +198,10 @@ void win_open(win_t *win)
197198 win->y = 0;
198199 }
199200
200− win->xwin = XCreateWindow(e->dpy, RootWindow(e->dpy, e->scr),
201+ if (!(win->embed)) {
202+ win->embed = RootWindow(e->dpy, e->scr);
203+ }
204+ win->xwin = XCreateWindow(e->dpy, win->embed,
201205 win->x, win->y, win->w, win->h, 0,
202206 e->depth, InputOutput, e->vis, 0, NULL);
203207 if (win->xwin == None)
M window.h View
@@ -71,6 +71,7 @@ typedef struct {
7171 unsigned int bw;
7272
7373 bool fullscreen;
74+ long embed;
7475
7576 struct {
7677 int w;