diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compositor.c | 3 | ||||
-rw-r--r-- | src/main.c | 18 |
2 files changed, 20 insertions, 1 deletions
diff --git a/src/compositor.c b/src/compositor.c index 4b622c0..92a7029 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -69,6 +69,7 @@ void ngxc_compositor_remove_window(ngxc_compositor *self, Window window) { for(int j = i + 1; j < self->num_windows; ++j) { self->windows[j - 1] = self->windows[j]; } + self->num_windows--; break; } } @@ -128,7 +129,7 @@ void ngxc_compositor_render(ngxc_compositor *self) { glFinish(); const double time_limit = 1.0f / 60.0f; // TODO: Get from randr - const double delayed_update = time_limit - frame_duration - 0.002; + const double delayed_update = time_limit - frame_duration - 0.001; //fprintf(stderr, "delayed update: %f\n", delayed_update); if(delayed_update > 0.0) usleep(delayed_update * 1000000.0); @@ -169,6 +169,24 @@ int main(int argc, char **argv) { while(XPending(dpy)) { XNextEvent(dpy, &xev); switch(xev.type) { + case CreateNotify: { + // TODO: + //ngxc_compositor_add_window(&compositor, xev.xcreatewindow.window); + break; + } + case DestroyNotify: { + // TODO: + //ngxc_compositor_remove_window(&compositor, xev.xdestroywindow.window); + break; + } + case MapNotify: { + ngxc_compositor_add_window(&compositor, xev.xmap.window); + break; + } + case UnmapNotify: { + ngxc_compositor_remove_window(&compositor, xev.xunmap.window); + break; + } case ConfigureNotify: { /* TODO: Instead of doing this potentially multiple times at once, only do this for the last configure notify event for each window */ ngxc_compositor_on_configure(&compositor, &xev.xconfigure); |