Krolyxon
Commit 72f1b1c

Branches

Refs →

nsxiv72f1b1c

Removed command line option -F

Author
Bert Münnich
Date
2014-02-05 09:58 +0100
Parent
997c851
Commit
72f1b1ca6f7936ecc5e80921d9dfe313f1f84465

+21 −52

7 files changed

  1. M Makefile +1 −1
  2. M README.md +0 −1
  3. M options.c +2 −6
  4. M options.h +0 −1
  5. M sxiv.1 +1 −5
  6. M window.c +17 −36
  7. M window.h +0 −2
M Makefile View
@@ -1,4 +1,4 @@
1−VERSION = git-20140204
1+VERSION = git-20140205
22
33 PREFIX = /usr/local
44 MANPREFIX = $(PREFIX)/share/man
M README.md View
@@ -70,7 +70,6 @@ of small previews is displayed, making it easy to choose an image to open.
7070
7171 -b Do not show info bar on bottom of window
7272 -c Remove all orphaned cache files from thumbnail cache and exit
73− -F Use size-hints to make the window fixed/floating
7473 -f Start in fullscreen mode
7574 -G GAMMA Set image gamma to GAMMA (-32..32)
7675 -g GEOMETRY Set window position and size
M options.c View
@@ -33,7 +33,7 @@ const options_t *options = (const options_t*) &_options;
3333
3434 void print_usage(void)
3535 {
36− printf("usage: sxiv [-bcFfhioqrtvZ] [-G GAMMA] [-g GEOMETRY] [-n NUM] "
36+ printf("usage: sxiv [-bcfhioqrtvZ] [-G GAMMA] [-g GEOMETRY] [-n NUM] "
3737 "[-N NAME] [-S DELAY] [-s MODE] [-z ZOOM] FILES...\n");
3838 }
3939
@@ -58,7 +58,6 @@ void parse_options(int argc, char **argv)
5858 _options.gamma = 0;
5959 _options.slideshow = 0;
6060
61− _options.fixed_win = false;
6261 _options.fullscreen = false;
6362 _options.hide_bar = false;
6463 _options.geometry = NULL;
@@ -68,7 +67,7 @@ void parse_options(int argc, char **argv)
6867 _options.thumb_mode = false;
6968 _options.clean_cache = false;
7069
71− while ((opt = getopt(argc, argv, "bcFfG:g:hin:N:oqrS:s:tvZz:")) != -1) {
70+ while ((opt = getopt(argc, argv, "bcfG:g:hin:N:oqrS:s:tvZz:")) != -1) {
7271 switch (opt) {
7372 case '?':
7473 print_usage();
@@ -79,9 +78,6 @@ void parse_options(int argc, char **argv)
7978 case 'c':
8079 _options.clean_cache = true;
8180 break;
82− case 'F':
83− _options.fixed_win = true;
84− break;
8581 case 'f':
8682 _options.fullscreen = true;
8783 break;
M options.h View
@@ -38,7 +38,6 @@ typedef struct {
3838 int slideshow;
3939
4040 /* window: */
41− bool fixed_win;
4241 bool fullscreen;
4342 bool hide_bar;
4443 char *geometry;
M sxiv.1 View
@@ -3,7 +3,7 @@
33 sxiv \- Simple X Image Viewer
44 .SH SYNOPSIS
55 .B sxiv
6−.RB [ \-bcFfhioqrtvZ ]
6+.RB [ \-bcfhioqrtvZ ]
77 .RB [ \-G
88 .IR GAMMA ]
99 .RB [ \-g
@@ -40,10 +40,6 @@ Do not show info bar on bottom of window.
4040 .B \-c
4141 Remove all orphaned cache files from the thumbnail cache directory and exit.
4242 .TP
43−.B \-F
44−Make the window fixed/floating by setting the minimum and maximum width/height
45−size-hints to the window width/height.
46−.TP
4743 .B \-f
4844 Start in fullscreen mode.
4945 .TP
M window.c View
@@ -171,12 +171,6 @@ void win_init(win_t *win)
171171 win->bar.fgcol = win_alloc_color(win, BAR_FG_COLOR);
172172 win->bar.h = options->hide_bar ? 0 : barheight;
173173
174− win->sizehints.flags = PWinGravity;
175− win->sizehints.win_gravity = NorthWestGravity;
176− if (options->fixed_win)
177− /* actual min/max values set in win_update_sizehints() */
178− win->sizehints.flags |= PMinSize | PMaxSize;
179−
180174 INIT_ATOM_(WM_DELETE_WINDOW);
181175 INIT_ATOM_(_NET_WM_NAME);
182176 INIT_ATOM_(_NET_WM_ICON_NAME);
@@ -188,26 +182,6 @@ void win_init(win_t *win)
188182 win_check_wm_support(e->dpy, RootWindow(e->dpy, e->scr));
189183 }
190184
191−void win_update_sizehints(win_t *win)
192−{
193− if (win == NULL || win->xwin == None)
194− return;
195−
196− if ((win->sizehints.flags & USSize) != 0) {
197− win->sizehints.width = win->w;
198− win->sizehints.height = win->h + win->bar.h;
199− }
200− if ((win->sizehints.flags & USPosition) != 0) {
201− win->sizehints.x = win->x;
202− win->sizehints.y = win->y;
203− }
204− if (options->fixed_win) {
205− win->sizehints.min_width = win->sizehints.max_width = win->w;
206− win->sizehints.min_height = win->sizehints.max_height = win->h + win->bar.h;
207− }
208− XSetWMNormalHints(win->env.dpy, win->xwin, &win->sizehints);
209−}
210−
211185 void win_open(win_t *win)
212186 {
213187 int c, i, j, n;
@@ -220,12 +194,16 @@ void win_open(win_t *win)
220194 char none_data[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
221195 Pixmap none;
222196 int gmask;
197+ XSizeHints sizehints;
223198
224199 if (win == NULL)
225200 return;
226201
227202 e = &win->env;
228203
204+ sizehints.flags = PWinGravity;
205+ sizehints.win_gravity = NorthWestGravity;
206+
229207 /* determine window offsets, width & height */
230208 if (options->geometry == NULL)
231209 gmask = 0;
@@ -233,31 +211,29 @@ void win_open(win_t *win)
233211 gmask = XParseGeometry(options->geometry, &win->x, &win->y,
234212 &win->w, &win->h);
235213 if ((gmask & WidthValue) != 0)
236− win->sizehints.flags |= USSize;
214+ sizehints.flags |= USSize;
237215 else
238216 win->w = WIN_WIDTH;
239217 if ((gmask & HeightValue) != 0)
240− win->sizehints.flags |= USSize;
218+ sizehints.flags |= USSize;
241219 else
242220 win->h = WIN_HEIGHT;
243221 if ((gmask & XValue) != 0) {
244222 if ((gmask & XNegative) != 0) {
245223 win->x += e->scrw - win->w;
246− win->sizehints.win_gravity = NorthEastGravity;
224+ sizehints.win_gravity = NorthEastGravity;
247225 }
248− win->sizehints.flags |= USPosition;
226+ sizehints.flags |= USPosition;
249227 } else {
250228 win->x = (e->scrw - win->w) / 2;
251229 }
252230 if ((gmask & YValue) != 0) {
253231 if ((gmask & YNegative) != 0) {
254232 win->y += e->scrh - win->h;
255− if (win->sizehints.win_gravity == NorthEastGravity)
256− win->sizehints.win_gravity = SouthEastGravity;
257− else
258− win->sizehints.win_gravity = SouthWestGravity;
233+ sizehints.win_gravity = sizehints.win_gravity == NorthEastGravity
234+ ? SouthEastGravity : SouthWestGravity;
259235 }
260− win->sizehints.flags |= USPosition;
236+ sizehints.flags |= USPosition;
261237 } else {
262238 win->y = (e->scrh - win->h) / 2;
263239 }
@@ -316,8 +292,13 @@ void win_open(win_t *win)
316292
317293 XSetWMProtocols(e->dpy, win->xwin, &atoms[ATOM_WM_DELETE_WINDOW], 1);
318294
295+ sizehints.width = win->w;
296+ sizehints.height = win->h;
297+ sizehints.x = win->x;
298+ sizehints.y = win->y;
299+ XSetWMNormalHints(win->env.dpy, win->xwin, &sizehints);
300+
319301 win->h -= win->bar.h;
320− win_update_sizehints(win);
321302
322303 XMapWindow(e->dpy, win->xwin);
323304 XFlush(e->dpy);
M window.h View
@@ -65,8 +65,6 @@ typedef struct {
6565 unsigned int h; /* = win height - bar height */
6666 unsigned int bw;
6767
68− XSizeHints sizehints;
69−
7068 bool fullscreen;
7169
7270 struct {