[hackers] [sxiv] added support for XEMBED into other windows (ie tabbed) with -w || shuall

From: <git_AT_suckless.org>
Date: Sun, 30 Oct 2016 19:24:58 +0100 (CET)

commit 0b758e08f2bca283eb930ede8165bfa26e6cacea
Author: shuall <shualloret_AT_gmail.com>
AuthorDate: Fri Oct 28 22:09:26 2016 -0400
Commit: shuall <shualloret_AT_gmail.com>
CommitDate: Fri Oct 28 22:09:26 2016 -0400

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

diff --git a/options.c b/options.c
index f7aac23..d292768 100644
--- a/options.c
+++ b/options.c
_AT_@ -33,7 +33,7 @@ const options_t *options = (const options_t*) &_options;
 void print_usage(void)
 {
         printf("usage: sxiv [-abcfhioqrtvZ] [-G GAMMA] [-g GEOMETRY] [-n NUM] "
- "[-N NAME] [-S DELAY] [-s MODE] [-z ZOOM] FILES...\n");
+ "[-N NAME] [-S DELAY] [-s MODE] [-z ZOOM] [-w WID] FILES...\n");
 }
 
 void print_version(void)
_AT_@ -62,6 +62,7 @@ void parse_options(int argc, char **argv)
         _options.slideshow = 0;
 
         _options.fullscreen = false;
+ _options.embed = 0;
         _options.hide_bar = false;
         _options.geometry = NULL;
         _options.res_name = NULL;
_AT_@ -70,7 +71,7 @@ void parse_options(int argc, char **argv)
         _options.thumb_mode = false;
         _options.clean_cache = false;
 
- while ((opt = getopt(argc, argv, "abcfG:g:hin:N:oqrS:s:tvZz:")) != -1) {
+ while ((opt = getopt(argc, argv, "abcfG:g:hin:N:oqrS:s:tvw:Zz:")) != -1) {
                 switch (opt) {
                         case '?':
                                 print_usage();
_AT_@ -138,6 +139,12 @@ void parse_options(int argc, char **argv)
                         case 'v':
                                 print_version();
                                 exit(EXIT_SUCCESS);
+ case 'w':
+ n = strtol(optarg, &end, 0);
+ if (*end != '\0')
+ error(EXIT_FAILURE, 0, "Invalid argument for option -w: %s", optarg);
+ _options.embed = n;
+ break;
                         case 'Z':
                                 _options.scalemode = SCALE_ZOOM;
                                 _options.zoom = 1.0;
diff --git a/options.h b/options.h
index 25abf16..40c2506 100644
--- a/options.h
+++ b/options.h
_AT_@ -41,6 +41,7 @@ typedef struct {
         /* window: */
         bool fullscreen;
         bool hide_bar;
+ long embed;
         char *geometry;
         char *res_name;
 
diff --git a/window.c b/window.c
index ad08787..18f45b0 100644
--- a/window.c
+++ b/window.c
_AT_@ -133,6 +133,7 @@ void win_init(win_t *win)
         win->bar.l.buf = emalloc(win->bar.l.size);
         win->bar.r.buf = emalloc(win->bar.r.size);
         win->bar.h = options->hide_bar ? 0 : barheight;
+ win->embed = options->embed;
 
         INIT_ATOM_(WM_DELETE_WINDOW);
         INIT_ATOM_(_NET_WM_NAME);
_AT_@ -197,7 +198,10 @@ void win_open(win_t *win)
                 win->y = 0;
         }
 
- win->xwin = XCreateWindow(e->dpy, RootWindow(e->dpy, e->scr),
+ if (!(win->embed)) {
+ win->embed = RootWindow(e->dpy, e->scr);
+ }
+ win->xwin = XCreateWindow(e->dpy, win->embed,
                                   win->x, win->y, win->w, win->h, 0,
                                   e->depth, InputOutput, e->vis, 0, NULL);
         if (win->xwin == None)
diff --git a/window.h b/window.h
index f5f9df0..9aa5689 100644
--- a/window.h
+++ b/window.h
_AT_@ -71,6 +71,7 @@ typedef struct {
         unsigned int bw;
 
         bool fullscreen;
+ long embed;
 
         struct {
                 int w;
Received on Sun Oct 30 2016 - 19:24:58 CET

This archive was generated by hypermail 2.3.0 : Sun Oct 30 2016 - 19:36:20 CET