Use -e for X window embedding
This commit is contained in:
parent
0b758e08f2
commit
c772d3c3f3
2
Makefile
2
Makefile
|
@ -1,4 +1,4 @@
|
||||||
VERSION := git-20161020
|
VERSION := git-20161030
|
||||||
|
|
||||||
PREFIX := /usr/local
|
PREFIX := /usr/local
|
||||||
MANPREFIX := $(PREFIX)/share/man
|
MANPREFIX := $(PREFIX)/share/man
|
||||||
|
|
18
options.c
18
options.c
|
@ -32,8 +32,8 @@ const options_t *options = (const options_t*) &_options;
|
||||||
|
|
||||||
void print_usage(void)
|
void print_usage(void)
|
||||||
{
|
{
|
||||||
printf("usage: sxiv [-abcfhioqrtvZ] [-G GAMMA] [-g GEOMETRY] [-n NUM] "
|
printf("usage: sxiv [-abcfhioqrtvZ] [-e WID] [-G GAMMA] [-g GEOMETRY] "
|
||||||
"[-N NAME] [-S DELAY] [-s MODE] [-z ZOOM] [-w WID] FILES...\n");
|
"[-N NAME] [-n NUM] [-S DELAY] [-s MODE] [-z ZOOM] FILES...\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_version(void)
|
void print_version(void)
|
||||||
|
@ -71,7 +71,7 @@ void parse_options(int argc, char **argv)
|
||||||
_options.thumb_mode = false;
|
_options.thumb_mode = false;
|
||||||
_options.clean_cache = 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) {
|
switch (opt) {
|
||||||
case '?':
|
case '?':
|
||||||
print_usage();
|
print_usage();
|
||||||
|
@ -85,6 +85,12 @@ void parse_options(int argc, char **argv)
|
||||||
case 'c':
|
case 'c':
|
||||||
_options.clean_cache = true;
|
_options.clean_cache = true;
|
||||||
break;
|
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':
|
case 'f':
|
||||||
_options.fullscreen = true;
|
_options.fullscreen = true;
|
||||||
break;
|
break;
|
||||||
|
@ -139,12 +145,6 @@ void parse_options(int argc, char **argv)
|
||||||
case 'v':
|
case 'v':
|
||||||
print_version();
|
print_version();
|
||||||
exit(EXIT_SUCCESS);
|
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':
|
case 'Z':
|
||||||
_options.scalemode = SCALE_ZOOM;
|
_options.scalemode = SCALE_ZOOM;
|
||||||
_options.zoom = 1.0;
|
_options.zoom = 1.0;
|
||||||
|
|
8
window.c
8
window.c
|
@ -133,7 +133,6 @@ void win_init(win_t *win)
|
||||||
win->bar.l.buf = emalloc(win->bar.l.size);
|
win->bar.l.buf = emalloc(win->bar.l.size);
|
||||||
win->bar.r.buf = emalloc(win->bar.r.size);
|
win->bar.r.buf = emalloc(win->bar.r.size);
|
||||||
win->bar.h = options->hide_bar ? 0 : barheight;
|
win->bar.h = options->hide_bar ? 0 : barheight;
|
||||||
win->embed = options->embed;
|
|
||||||
|
|
||||||
INIT_ATOM_(WM_DELETE_WINDOW);
|
INIT_ATOM_(WM_DELETE_WINDOW);
|
||||||
INIT_ATOM_(_NET_WM_NAME);
|
INIT_ATOM_(_NET_WM_NAME);
|
||||||
|
@ -149,6 +148,7 @@ void win_init(win_t *win)
|
||||||
void win_open(win_t *win)
|
void win_open(win_t *win)
|
||||||
{
|
{
|
||||||
int c, i, j, n;
|
int c, i, j, n;
|
||||||
|
long parent;
|
||||||
win_env_t *e;
|
win_env_t *e;
|
||||||
XClassHint classhint;
|
XClassHint classhint;
|
||||||
unsigned long *icon_data;
|
unsigned long *icon_data;
|
||||||
|
@ -160,6 +160,7 @@ void win_open(win_t *win)
|
||||||
Bool fullscreen = options->fullscreen && fs_support;
|
Bool fullscreen = options->fullscreen && fs_support;
|
||||||
|
|
||||||
e = &win->env;
|
e = &win->env;
|
||||||
|
parent = options->embed != 0 ? options->embed : RootWindow(e->dpy, e->scr);
|
||||||
|
|
||||||
sizehints.flags = PWinGravity;
|
sizehints.flags = PWinGravity;
|
||||||
sizehints.win_gravity = NorthWestGravity;
|
sizehints.win_gravity = NorthWestGravity;
|
||||||
|
@ -198,10 +199,7 @@ void win_open(win_t *win)
|
||||||
win->y = 0;
|
win->y = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(win->embed)) {
|
win->xwin = XCreateWindow(e->dpy, parent,
|
||||||
win->embed = RootWindow(e->dpy, e->scr);
|
|
||||||
}
|
|
||||||
win->xwin = XCreateWindow(e->dpy, win->embed,
|
|
||||||
win->x, win->y, win->w, win->h, 0,
|
win->x, win->y, win->w, win->h, 0,
|
||||||
e->depth, InputOutput, e->vis, 0, NULL);
|
e->depth, InputOutput, e->vis, 0, NULL);
|
||||||
if (win->xwin == None)
|
if (win->xwin == None)
|
||||||
|
|
Loading…
Reference in New Issue