aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-01-17 19:50:46 +0100
committerBert <ber.t@gmx.com>2011-01-17 19:50:46 +0100
commit47d107edb5069176265852fac96ea0eedbec8d34 (patch)
tree9205acc82ea7462444d3a304f248957fca149468
parent15603c25cf00a11dbdf238203858d9eab313120c (diff)
React to ConfigureNotify
-rw-r--r--events.c4
-rw-r--r--window.c16
-rw-r--r--window.h6
3 files changed, 24 insertions, 2 deletions
diff --git a/events.c b/events.c
index ccc5f2e..45a9474 100644
--- a/events.c
+++ b/events.c
@@ -30,6 +30,10 @@ void on_expose(app_t *app, XEvent *ev) {
}
void on_configurenotify(app_t *app, XEvent *ev) {
+ if (app == NULL || ev == NULL)
+ return;
+
+ win_configure(&app->win, &ev->xconfigure);
}
void on_keypress(app_t *app, XEvent *ev) {
diff --git a/window.c b/window.c
index f9852f9..b9a3440 100644
--- a/window.c
+++ b/window.c
@@ -84,3 +84,19 @@ void win_close(win_t *win) {
XFreeGC(dpy, gc);
XCloseDisplay(dpy);
}
+
+int win_configure(win_t *win, XConfigureEvent *cev) {
+ int changed;
+
+ if (win == NULL)
+ return 0;
+
+ changed = win->x != cev->x || win->y != cev->y ||
+ win->w != cev->width || win->h != cev->height;
+ win->x = cev->x;
+ win->y = cev->y;
+ win->w = cev->width;
+ win->h = cev->height;
+ win->bw = cev->border_width;
+ return changed;
+}
diff --git a/window.h b/window.h
index 31cd3da..5e00256 100644
--- a/window.h
+++ b/window.h
@@ -33,7 +33,9 @@ typedef struct win_s {
int fullscreen;
} win_t;
-void win_open(win_t *win);
-void win_close(win_t *win);
+void win_open(win_t*);
+void win_close(win_t*);
+
+int win_configure(win_t*, XConfigureEvent*);
#endif /* WINDOW_H */