summaryrefslogtreecommitdiff
path: root/src/x11/window.c
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-12 15:14:41 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-12 15:14:41 +0300
commit4145406fae437dce2f0af6e078e35566634f2c19 (patch)
tree689e3ab0e0033fc47be0b2d590b864692c936dcc /src/x11/window.c
parent5d1eaf3beffd3653fc4c26b0557c77026bbd6bfc (diff)
perf: unify platform-independent state, branchless queue masking and native handle caching
Diffstat (limited to 'src/x11/window.c')
-rw-r--r--src/x11/window.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/x11/window.c b/src/x11/window.c
index 271c128..12fc954 100644
--- a/src/x11/window.c
+++ b/src/x11/window.c
@@ -526,6 +526,8 @@ static bool resize(struct x11_surface *s, struct yasl_vector2i size)
s->image = image;
s->pixels = pixels;
s->size = size;
+ s->base.size = size;
+ s->base.scale_120 = YASL_SCALE_UNIT;
s->want_draw = true;
yasl_clock_note_resize(&s->clock, yasl_loop_now_ns() - start);
return true;
@@ -630,6 +632,9 @@ static struct yasl_surface *create_toplevel(struct yasl_display *base,
if (!resize(s, spec->size)) { free(s); return NULL; }
s->window = XCreateSimpleWindow(d->native, RootWindow(d->native, d->screen),
0, 0, (unsigned)spec->size.x, (unsigned)spec->size.y, 0, 0, 0);
+ s->base.native_handle = (void *)(uintptr_t)s->window;
+ s->base.size = s->size;
+ s->base.scale_120 = YASL_SCALE_UNIT;
s->gc = XCreateGC(d->native, s->window, 0, NULL);
XSelectInput(d->native, s->window, ExposureMask | StructureNotifyMask |
FocusChangeMask | KeyPressMask | KeyReleaseMask | PropertyChangeMask |
@@ -769,6 +774,9 @@ static struct yasl_surface *surface_create_popup(struct yasl_surface *parent_bas
surface_destroy(&s->base);
return NULL;
}
+ s->base.native_handle = (void *)(uintptr_t)s->window;
+ s->base.size = s->size;
+ s->base.scale_120 = YASL_SCALE_UNIT;
s->gc = XCreateGC(d->native, s->window, 0, NULL);
XSelectInput(d->native, s->window, ExposureMask | StructureNotifyMask |
FocusChangeMask | KeyPressMask | KeyReleaseMask | PropertyChangeMask |
@@ -1390,6 +1398,7 @@ static struct yasl_display *display_open(struct yasl_loop *loop,
d->base.callbacks = spec && spec->cbs ? *spec->cbs : (struct yasl_display_cbs){0};
d->native = XOpenDisplay(NULL);
if (!d->native) { free(d); errno = ENODEV; return NULL; }
+ d->base.native_handle = d->native;
d->screen = DefaultScreen(d->native);
int xi_event_base, xi_error_base;
int major = 2, minor = 0;