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
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
-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
-G GAMMA Set image gamma to GAMMA (-32..32)
-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)
{
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");
}
@ -58,7 +58,6 @@ void parse_options(int argc, char **argv)
_options.gamma = 0;
_options.slideshow = 0;
_options.fixed_win = false;
_options.fullscreen = false;
_options.hide_bar = false;
_options.geometry = NULL;
@ -68,7 +67,7 @@ void parse_options(int argc, char **argv)
_options.thumb_mode = 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) {
case '?':
print_usage();
@ -79,9 +78,6 @@ void parse_options(int argc, char **argv)
case 'c':
_options.clean_cache = true;
break;
case 'F':
_options.fixed_win = true;
break;
case 'f':
_options.fullscreen = true;
break;

View file

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

6
sxiv.1
View file

@ -3,7 +3,7 @@
sxiv \- Simple X Image Viewer
.SH SYNOPSIS
.B sxiv
.RB [ \-bcFfhioqrtvZ ]
.RB [ \-bcfhioqrtvZ ]
.RB [ \-G
.IR GAMMA ]
.RB [ \-g
@ -40,10 +40,6 @@ Do not show info bar on bottom of window.
.B \-c
Remove all orphaned cache files from the thumbnail cache directory and exit.
.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
Start in fullscreen mode.
.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.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_(_NET_WM_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));
}
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)
{
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 };
Pixmap none;
int gmask;
XSizeHints sizehints;
if (win == NULL)
return;
e = &win->env;
sizehints.flags = PWinGravity;
sizehints.win_gravity = NorthWestGravity;
/* determine window offsets, width & height */
if (options->geometry == NULL)
gmask = 0;
@ -233,31 +211,29 @@ void win_open(win_t *win)
gmask = XParseGeometry(options->geometry, &win->x, &win->y,
&win->w, &win->h);
if ((gmask & WidthValue) != 0)
win->sizehints.flags |= USSize;
sizehints.flags |= USSize;
else
win->w = WIN_WIDTH;
if ((gmask & HeightValue) != 0)
win->sizehints.flags |= USSize;
sizehints.flags |= USSize;
else
win->h = WIN_HEIGHT;
if ((gmask & XValue) != 0) {
if ((gmask & XNegative) != 0) {
win->x += e->scrw - win->w;
win->sizehints.win_gravity = NorthEastGravity;
sizehints.win_gravity = NorthEastGravity;
}
win->sizehints.flags |= USPosition;
sizehints.flags |= USPosition;
} else {
win->x = (e->scrw - win->w) / 2;
}
if ((gmask & YValue) != 0) {
if ((gmask & YNegative) != 0) {
win->y += e->scrh - win->h;
if (win->sizehints.win_gravity == NorthEastGravity)
win->sizehints.win_gravity = SouthEastGravity;
else
win->sizehints.win_gravity = SouthWestGravity;
sizehints.win_gravity = sizehints.win_gravity == NorthEastGravity
? SouthEastGravity : SouthWestGravity;
}
win->sizehints.flags |= USPosition;
sizehints.flags |= USPosition;
} else {
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);
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_update_sizehints(win);
XMapWindow(e->dpy, win->xwin);
XFlush(e->dpy);

View file

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