From 72f1b1ca6f7936ecc5e80921d9dfe313f1f84465 Mon Sep 17 00:00:00 2001 From: Bert Münnich Date: Wed, 5 Feb 2014 09:58:36 +0100 Subject: Removed command line option -F --- Makefile | 2 +- README.md | 1 - options.c | 8 ++------ options.h | 1 - sxiv.1 | 6 +----- window.c | 53 +++++++++++++++++------------------------------------ window.h | 2 -- 7 files changed, 21 insertions(+), 52 deletions(-) diff --git a/Makefile b/Makefile index 6eba278..cea7b60 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION = git-20140204 +VERSION = git-20140205 PREFIX = /usr/local MANPREFIX = $(PREFIX)/share/man diff --git a/README.md b/README.md index 7a59538..e2d5e81 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/options.c b/options.c index bf993e3..47fe21a 100644 --- a/options.c +++ b/options.c @@ -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; diff --git a/options.h b/options.h index d91cca2..e3d81ca 100644 --- a/options.h +++ b/options.h @@ -38,7 +38,6 @@ typedef struct { int slideshow; /* window: */ - bool fixed_win; bool fullscreen; bool hide_bar; char *geometry; diff --git a/sxiv.1 b/sxiv.1 index dd4d2be..a14e1a7 100644 --- a/sxiv.1 +++ b/sxiv.1 @@ -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 diff --git a/window.c b/window.c index b8d5cf5..a1fe122 100644 --- a/window.c +++ b/window.c @@ -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); diff --git a/window.h b/window.h index 8324125..d274a93 100644 --- a/window.h +++ b/window.h @@ -65,8 +65,6 @@ typedef struct { unsigned int h; /* = win height - bar height */ unsigned int bw; - XSizeHints sizehints; - bool fullscreen; struct { -- cgit v1.2.3-54-g00ecf