aboutsummaryrefslogtreecommitdiffstats
path: root/window.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-01-20 21:44:34 +0100
committerBert <ber.t@gmx.com>2011-01-20 21:44:34 +0100
commit029e1208b91250f4bd91ecc2015d051294fb9d3f (patch)
treec746d1a81e7babb17283d2326bdd2dea310eb4ed /window.c
parent08018427c61435de9cd8dca1d1cc9bb69ca2fd74 (diff)
downloadnsxiv-029e1208b91250f4bd91ecc2015d051294fb9d3f.tar.zst
No more expose handling
Diffstat (limited to 'window.c')
-rw-r--r--window.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/window.c b/window.c
index 846117c..9feb369 100644
--- a/window.c
+++ b/window.c
@@ -28,8 +28,7 @@ void win_open(win_t *win) {
win_env_t *e;
XClassHint *classhint;
XColor bgcol;
- XSetWindowAttributes attr;
- unsigned long mask;
+ XGCValues gcval;
if (!win)
return;
@@ -58,19 +57,19 @@ void win_open(win_t *win) {
win->x = (e->scrw - win->w) / 2;
win->y = (e->scrh - win->h) / 2;
- attr.backing_store = NotUseful;
- attr.background_pixel = bgcol.pixel;
- attr.save_under = False;
- mask = CWBackingStore | CWBackPixel | CWSaveUnder;
-
win->xwin = XCreateWindow(e->dpy, RootWindow(e->dpy, e->scr),
win->x, win->y, win->w, win->h, 0,
- e->depth, InputOutput, e->vis, mask, &attr);
+ e->depth, InputOutput, e->vis, 0, None);
if (win->xwin == None)
DIE("could not create window");
XSelectInput(e->dpy, win->xwin,
- StructureNotifyMask | ExposureMask | KeyPressMask);
+ StructureNotifyMask | KeyPressMask);
+
+ win->pm = 0;
+
+ gcval.foreground = bgcol.pixel;
+ win->bgc = XCreateGC(e->dpy, win->xwin, GCForeground, &gcval);
win_set_title(win, "sxiv");
@@ -124,5 +123,17 @@ void win_clear(win_t *win) {
if (!win)
return;
+ if (win->pm)
+ XFreePixmap(win->env.dpy, win->pm);
+ win->pm = XCreatePixmap(win->env.dpy, win->xwin, win->w, win->h,
+ win->env.depth);
+ XFillRectangle(win->env.dpy, win->pm, win->bgc, 0, 0, win->w, win->h);
+}
+
+void win_draw(win_t *win) {
+ if (!win)
+ return;
+
+ XSetWindowBackgroundPixmap(win->env.dpy, win->xwin, win->pm);
XClearWindow(win->env.dpy, win->xwin);
}