React to ConfigureNotify
This commit is contained in:
parent
15603c25cf
commit
47d107edb5
4
events.c
4
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) {
|
||||
|
16
window.c
16
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user