summaryrefslogtreecommitdiffstats
path: root/window.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-02-01 16:40:37 +0100
committerBert <ber.t@gmx.com>2011-02-01 16:40:37 +0100
commitf2ceac2f8ab04f91672a9cb168dfdf69dab02b3c (patch)
tree4a405c366a9775afe359ad04e0bfd2718264480f /window.c
parent8fb3110ebb1f4ac46729ceac906e21674368d93d (diff)
downloadnsxiv-f2ceac2f8ab04f91672a9cb168dfdf69dab02b3c.tar.zst
New option: -F, fixed/floating window
Diffstat (limited to 'window.c')
-rw-r--r--window.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/window.c b/window.c
index 3904fe8..a7a1121 100644
--- a/window.c
+++ b/window.c
@@ -33,7 +33,8 @@ static GC bgc;
void win_open(win_t *win) {
win_env_t *e;
- XClassHint *classhint;
+ XClassHint classhint;
+ XSizeHints sizehints;
XColor bgcol;
int gmask;
@@ -99,11 +100,17 @@ void win_open(win_t *win) {
win_set_title(win, "sxiv");
- if ((classhint = XAllocClassHint())) {
- classhint->res_name = "sxiv";
- classhint->res_class = "sxiv";
- XSetClassHint(e->dpy, win->xwin, classhint);
- XFree(classhint);
+ classhint.res_name = "sxiv";
+ classhint.res_class = "sxiv";
+ XSetClassHint(e->dpy, win->xwin, &classhint);
+
+ if (options->fixed) {
+ sizehints.flags = PMinSize | PMaxSize;
+ sizehints.min_width = win->w;
+ sizehints.max_width = win->w;
+ sizehints.min_height = win->h;
+ sizehints.max_height = win->h;
+ XSetWMNormalHints(e->dpy, win->xwin, &sizehints);
}
XMapWindow(e->dpy, win->xwin);