aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-01-11 21:25:59 +0100
committerdec05eba <dec05eba@protonmail.com>2024-01-11 21:25:59 +0100
commitefee05461adf85f9d2730a008c757387364deb54 (patch)
treec65ea1074666e4810517dba648fcfbc385873d8f
parente2eb57312e31eb553e676bc8d554ec89437147f6 (diff)
2ms leway
-rw-r--r--src/compositor.c2
-rw-r--r--src/main.c16
2 files changed, 16 insertions, 2 deletions
diff --git a/src/compositor.c b/src/compositor.c
index 92a7029..ee6c986 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -129,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.001;
+ const double delayed_update = time_limit - frame_duration - 0.002;
//fprintf(stderr, "delayed update: %f\n", delayed_update);
if(delayed_update > 0.0)
usleep(delayed_update * 1000000.0);
diff --git a/src/main.c b/src/main.c
index bd552b2..7763a4b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -108,7 +108,8 @@ int main(int argc, char **argv) {
fatal_if(is_compositor_running(dpy), "another compositor is already running");
const Window root_window = DefaultRootWindow(dpy);
- XSelectInput(dpy, root_window, SubstructureNotifyMask);
+ //XCompositeRedirectSubwindows(dpy, root_window, CompositeRedirectManual);
+ XSelectInput(dpy, root_window, ExposureMask | StructureNotifyMask | SubstructureNotifyMask | PropertyChangeMask);
GLXFBConfig *fb_config;
XVisualInfo *xvisual_info;
@@ -168,6 +169,8 @@ int main(int argc, char **argv) {
for(;;) {
while(XPending(dpy)) {
XNextEvent(dpy, &xev);
+ //if(xev.type != 22)
+ // fprintf(stderr, "event: %d\n", xev.type);
switch(xev.type) {
case CreateNotify: {
// TODO:
@@ -187,11 +190,22 @@ int main(int argc, char **argv) {
ngxc_compositor_remove_window(&compositor, xev.xunmap.window);
break;
}
+ case ReparentNotify: {
+ if(xev.xreparent.parent == root_window)
+ ngxc_compositor_add_window(&compositor, xev.xreparent.window);
+ else
+ ngxc_compositor_remove_window(&compositor, xev.xreparent.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);
break;
}
+ case CirculateNotify: {
+ fprintf(stderr, "circulate!\n");
+ break;
+ }
default:
break;
}