diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-01-11 20:39:41 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-01-11 20:43:49 +0100 |
commit | 3a1fb0dfc8bb255ee2d46fb12ba850a6f41c50ea (patch) | |
tree | 1429bfde7463c771a861956d5bd9a51d3b21e95d | |
parent | 2b9389ae016c8048a16ba033f27ca5c256985e4d (diff) |
Add/remove window
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | src/compositor.c | 3 | ||||
-rw-r--r-- | src/main.c | 18 |
3 files changed, 21 insertions, 2 deletions
@@ -1,2 +1,2 @@ # Next Generation X Compositor -Low latency stutter free compositor +Low latency stutter-free X compositor 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); |