Krolyxon
Commit 47d107e

Branches

Refs →

nsxiv47d107e

React to ConfigureNotify

Author
Bert
Date
2011-01-17 19:50 +0100
Parent
15603c2
Commit
47d107edb5069176265852fac96ea0eedbec8d34

+24 −2

3 files changed

  1. M events.c +4 −0
  2. M window.c +16 −0
  3. M window.h +4 −2
M events.c View
@@ -30,6 +30,10 @@ void on_expose(app_t *app, XEvent *ev) {
3030 }
3131
3232 void on_configurenotify(app_t *app, XEvent *ev) {
33+ if (app == NULL || ev == NULL)
34+ return;
35+
36+ win_configure(&app->win, &ev->xconfigure);
3337 }
3438
3539 void on_keypress(app_t *app, XEvent *ev) {
M window.c View
@@ -84,3 +84,19 @@ void win_close(win_t *win) {
8484 XFreeGC(dpy, gc);
8585 XCloseDisplay(dpy);
8686 }
87+
88+int win_configure(win_t *win, XConfigureEvent *cev) {
89+ int changed;
90+
91+ if (win == NULL)
92+ return 0;
93+
94+ changed = win->x != cev->x || win->y != cev->y ||
95+ win->w != cev->width || win->h != cev->height;
96+ win->x = cev->x;
97+ win->y = cev->y;
98+ win->w = cev->width;
99+ win->h = cev->height;
100+ win->bw = cev->border_width;
101+ return changed;
102+}
M window.h View
@@ -33,7 +33,9 @@ typedef struct win_s {
3333 int fullscreen;
3434 } win_t;
3535
36−void win_open(win_t *win);
37−void win_close(win_t *win);
36+void win_open(win_t*);
37+void win_close(win_t*);
38+
39+int win_configure(win_t*, XConfigureEvent*);
3840
3941 #endif /* WINDOW_H */