Removed command line option -F

This commit is contained in:
Bert Münnich 2014-02-05 09:58:36 +01:00
parent 997c8518c5
commit 72f1b1ca6f
7 changed files with 21 additions and 52 deletions

View File

@ -1,4 +1,4 @@
VERSION = git-20140204 VERSION = git-20140205
PREFIX = /usr/local PREFIX = /usr/local
MANPREFIX = $(PREFIX)/share/man MANPREFIX = $(PREFIX)/share/man

View File

@ -70,7 +70,6 @@ of small previews is displayed, making it easy to choose an image to open.
-b Do not show info bar on bottom of window -b Do not show info bar on bottom of window
-c Remove all orphaned cache files from thumbnail cache and exit -c Remove all orphaned cache files from thumbnail cache and exit
-F Use size-hints to make the window fixed/floating
-f Start in fullscreen mode -f Start in fullscreen mode
-G GAMMA Set image gamma to GAMMA (-32..32) -G GAMMA Set image gamma to GAMMA (-32..32)
-g GEOMETRY Set window position and size -g GEOMETRY Set window position and size

View File

@ -33,7 +33,7 @@ const options_t *options = (const options_t*) &_options;
void print_usage(void) void print_usage(void)
{ {
printf("usage: sxiv [-bcFfhioqrtvZ] [-G GAMMA] [-g GEOMETRY] [-n NUM] " printf("usage: sxiv [-bcfhioqrtvZ] [-G GAMMA] [-g GEOMETRY] [-n NUM] "
"[-N NAME] [-S DELAY] [-s MODE] [-z ZOOM] FILES...\n"); "[-N NAME] [-S DELAY] [-s MODE] [-z ZOOM] FILES...\n");
} }
@ -58,7 +58,6 @@ void parse_options(int argc, char **argv)
_options.gamma = 0; _options.gamma = 0;
_options.slideshow = 0; _options.slideshow = 0;
_options.fixed_win = false;
_options.fullscreen = false; _options.fullscreen = false;
_options.hide_bar = false; _options.hide_bar = false;
_options.geometry = NULL; _options.geometry = NULL;
@ -68,7 +67,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, "bcFfG:g:hin:N:oqrS:s:tvZz:")) != -1) { while ((opt = getopt(argc, argv, "bcfG:g:hin:N:oqrS:s:tvZz:")) != -1) {
switch (opt) { switch (opt) {
case '?': case '?':
print_usage(); print_usage();
@ -79,9 +78,6 @@ void parse_options(int argc, char **argv)
case 'c': case 'c':
_options.clean_cache = true; _options.clean_cache = true;
break; break;
case 'F':
_options.fixed_win = true;
break;
case 'f': case 'f':
_options.fullscreen = true; _options.fullscreen = true;
break; break;

View File

@ -38,7 +38,6 @@ typedef struct {
int slideshow; int slideshow;
/* window: */ /* window: */
bool fixed_win;
bool fullscreen; bool fullscreen;
bool hide_bar; bool hide_bar;
char *geometry; char *geometry;

6
sxiv.1
View File

@ -3,7 +3,7 @@
sxiv \- Simple X Image Viewer sxiv \- Simple X Image Viewer
.SH SYNOPSIS .SH SYNOPSIS
.B sxiv .B sxiv
.RB [ \-bcFfhioqrtvZ ] .RB [ \-bcfhioqrtvZ ]
.RB [ \-G .RB [ \-G
.IR GAMMA ] .IR GAMMA ]
.RB [ \-g .RB [ \-g
@ -40,10 +40,6 @@ Do not show info bar on bottom of window.
.B \-c .B \-c
Remove all orphaned cache files from the thumbnail cache directory and exit. Remove all orphaned cache files from the thumbnail cache directory and exit.
.TP .TP
.B \-F
Make the window fixed/floating by setting the minimum and maximum width/height
size-hints to the window width/height.
.TP
.B \-f .B \-f
Start in fullscreen mode. Start in fullscreen mode.
.TP .TP

View File

@ -171,12 +171,6 @@ void win_init(win_t *win)
win->bar.fgcol = win_alloc_color(win, BAR_FG_COLOR); win->bar.fgcol = win_alloc_color(win, BAR_FG_COLOR);
win->bar.h = options->hide_bar ? 0 : barheight; win->bar.h = options->hide_bar ? 0 : barheight;
win->sizehints.flags = PWinGravity;
win->sizehints.win_gravity = NorthWestGravity;
if (options->fixed_win)
/* actual min/max values set in win_update_sizehints() */
win->sizehints.flags |= PMinSize | PMaxSize;
INIT_ATOM_(WM_DELETE_WINDOW); INIT_ATOM_(WM_DELETE_WINDOW);
INIT_ATOM_(_NET_WM_NAME); INIT_ATOM_(_NET_WM_NAME);
INIT_ATOM_(_NET_WM_ICON_NAME); INIT_ATOM_(_NET_WM_ICON_NAME);
@ -188,26 +182,6 @@ void win_init(win_t *win)
win_check_wm_support(e->dpy, RootWindow(e->dpy, e->scr)); win_check_wm_support(e->dpy, RootWindow(e->dpy, e->scr));
} }
void win_update_sizehints(win_t *win)
{
if (win == NULL || win->xwin == None)
return;
if ((win->sizehints.flags & USSize) != 0) {
win->sizehints.width = win->w;
win->sizehints.height = win->h + win->bar.h;
}
if ((win->sizehints.flags & USPosition) != 0) {
win->sizehints.x = win->x;
win->sizehints.y = win->y;
}
if (options->fixed_win) {
win->sizehints.min_width = win->sizehints.max_width = win->w;
win->sizehints.min_height = win->sizehints.max_height = win->h + win->bar.h;
}
XSetWMNormalHints(win->env.dpy, win->xwin, &win->sizehints);
}
void win_open(win_t *win) void win_open(win_t *win)
{ {
int c, i, j, n; int c, i, j, n;
@ -220,12 +194,16 @@ void win_open(win_t *win)
char none_data[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; char none_data[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
Pixmap none; Pixmap none;
int gmask; int gmask;
XSizeHints sizehints;
if (win == NULL) if (win == NULL)
return; return;
e = &win->env; e = &win->env;
sizehints.flags = PWinGravity;
sizehints.win_gravity = NorthWestGravity;
/* determine window offsets, width & height */ /* determine window offsets, width & height */
if (options->geometry == NULL) if (options->geometry == NULL)
gmask = 0; gmask = 0;
@ -233,31 +211,29 @@ void win_open(win_t *win)
gmask = XParseGeometry(options->geometry, &win->x, &win->y, gmask = XParseGeometry(options->geometry, &win->x, &win->y,
&win->w, &win->h); &win->w, &win->h);
if ((gmask & WidthValue) != 0) if ((gmask & WidthValue) != 0)
win->sizehints.flags |= USSize; sizehints.flags |= USSize;
else else
win->w = WIN_WIDTH; win->w = WIN_WIDTH;
if ((gmask & HeightValue) != 0) if ((gmask & HeightValue) != 0)
win->sizehints.flags |= USSize; sizehints.flags |= USSize;
else else
win->h = WIN_HEIGHT; win->h = WIN_HEIGHT;
if ((gmask & XValue) != 0) { if ((gmask & XValue) != 0) {
if ((gmask & XNegative) != 0) { if ((gmask & XNegative) != 0) {
win->x += e->scrw - win->w; win->x += e->scrw - win->w;
win->sizehints.win_gravity = NorthEastGravity; sizehints.win_gravity = NorthEastGravity;
} }
win->sizehints.flags |= USPosition; sizehints.flags |= USPosition;
} else { } else {
win->x = (e->scrw - win->w) / 2; win->x = (e->scrw - win->w) / 2;
} }
if ((gmask & YValue) != 0) { if ((gmask & YValue) != 0) {
if ((gmask & YNegative) != 0) { if ((gmask & YNegative) != 0) {
win->y += e->scrh - win->h; win->y += e->scrh - win->h;
if (win->sizehints.win_gravity == NorthEastGravity) sizehints.win_gravity = sizehints.win_gravity == NorthEastGravity
win->sizehints.win_gravity = SouthEastGravity; ? SouthEastGravity : SouthWestGravity;
else
win->sizehints.win_gravity = SouthWestGravity;
} }
win->sizehints.flags |= USPosition; sizehints.flags |= USPosition;
} else { } else {
win->y = (e->scrh - win->h) / 2; win->y = (e->scrh - win->h) / 2;
} }
@ -316,8 +292,13 @@ void win_open(win_t *win)
XSetWMProtocols(e->dpy, win->xwin, &atoms[ATOM_WM_DELETE_WINDOW], 1); XSetWMProtocols(e->dpy, win->xwin, &atoms[ATOM_WM_DELETE_WINDOW], 1);
sizehints.width = win->w;
sizehints.height = win->h;
sizehints.x = win->x;
sizehints.y = win->y;
XSetWMNormalHints(win->env.dpy, win->xwin, &sizehints);
win->h -= win->bar.h; win->h -= win->bar.h;
win_update_sizehints(win);
XMapWindow(e->dpy, win->xwin); XMapWindow(e->dpy, win->xwin);
XFlush(e->dpy); XFlush(e->dpy);

View File

@ -65,8 +65,6 @@ typedef struct {
unsigned int h; /* = win height - bar height */ unsigned int h; /* = win height - bar height */
unsigned int bw; unsigned int bw;
XSizeHints sizehints;
bool fullscreen; bool fullscreen;
struct { struct {