Use -e for X window embedding

This commit is contained in:
Bert Münnich 2016-10-30 19:10:25 +01:00
parent 0b758e08f2
commit c772d3c3f3
4 changed files with 13 additions and 16 deletions

View File

@ -1,4 +1,4 @@
VERSION := git-20161020
VERSION := git-20161030
PREFIX := /usr/local
MANPREFIX := $(PREFIX)/share/man

View File

@ -32,8 +32,8 @@ 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] [-w WID] FILES...\n");
printf("usage: sxiv [-abcfhioqrtvZ] [-e WID] [-G GAMMA] [-g GEOMETRY] "
"[-N NAME] [-n NUM] [-S DELAY] [-s MODE] [-z ZOOM] FILES...\n");
}
void print_version(void)
@ -71,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:tvw:Zz:")) != -1) {
while ((opt = getopt(argc, argv, "abce:fG:g:hin:N:oqrS:s:tvZz:")) != -1) {
switch (opt) {
case '?':
print_usage();
@ -85,6 +85,12 @@ void parse_options(int argc, char **argv)
case 'c':
_options.clean_cache = true;
break;
case 'e':
n = strtol(optarg, &end, 0);
if (*end != '\0')
error(EXIT_FAILURE, 0, "Invalid argument for option -e: %s", optarg);
_options.embed = n;
break;
case 'f':
_options.fullscreen = true;
break;
@ -139,12 +145,6 @@ 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;

View File

@ -133,7 +133,6 @@ 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);
@ -149,6 +148,7 @@ void win_init(win_t *win)
void win_open(win_t *win)
{
int c, i, j, n;
long parent;
win_env_t *e;
XClassHint classhint;
unsigned long *icon_data;
@ -160,6 +160,7 @@ void win_open(win_t *win)
Bool fullscreen = options->fullscreen && fs_support;
e = &win->env;
parent = options->embed != 0 ? options->embed : RootWindow(e->dpy, e->scr);
sizehints.flags = PWinGravity;
sizehints.win_gravity = NorthWestGravity;
@ -198,10 +199,7 @@ void win_open(win_t *win)
win->y = 0;
}
if (!(win->embed)) {
win->embed = RootWindow(e->dpy, e->scr);
}
win->xwin = XCreateWindow(e->dpy, win->embed,
win->xwin = XCreateWindow(e->dpy, parent,
win->x, win->y, win->w, win->h, 0,
e->depth, InputOutput, e->vis, 0, NULL);
if (win->xwin == None)

View File

@ -71,7 +71,6 @@ typedef struct {
unsigned int bw;
bool fullscreen;
long embed;
struct {
int w;