diff options
| author | Berke Güzel <wenekar1@gmail.com> | 2026-10-11 23:51:43 +0300 |
|---|---|---|
| committer | Berke Güzel <wenekar1@gmail.com> | 2026-10-11 23:51:43 +0300 |
| commit | e813252e685d761235ad45e170d97c9375f51958 (patch) | |
| tree | e57bae545c0eb22aac4119a890b8344ee7cd09d2 /src/wayland/popup.c | |
| parent | 608b49052178ea74f593c925cdeedf352aa1c357 (diff) | |
| parent | 6eac0a5f2c552728efca420b1129fae7d4fea773 (diff) | |
Merge branch 'backend-selection' into main
- Implement runtime backend selection (Wayland, X11, Cocoa)
- Add native X11 backend with clipboard, keyboard, mouse, and placement
- Integrate multi-backend integration tests running under Weston and Xwayland
- Retain zero-hole struct packing, branchless ALU/LUT primitives, and paced event loop
Diffstat (limited to 'src/wayland/popup.c')
| -rw-r--r-- | src/wayland/popup.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/wayland/popup.c b/src/wayland/popup.c index e809a43..f0ef305 100644 --- a/src/wayland/popup.c +++ b/src/wayland/popup.c @@ -32,7 +32,7 @@ static bool popup_spec_valid(const struct yasl_popup_spec *spec) spec->content_offset.y + spec->content_size.y <= spec->size.y; } -static bool popup_apply_spec(struct yasl_surface *w, const struct yasl_popup_spec *spec) +static bool popup_apply_spec(struct wayland_surface *w, const struct yasl_popup_spec *spec) { uint32_t scale = w->parent->scale_120; struct yasl_vector2i logical = { @@ -69,7 +69,7 @@ static bool popup_apply_spec(struct yasl_surface *w, const struct yasl_popup_spe return true; } -static void popup_set_geometry(struct yasl_surface *w) +static void popup_set_geometry(struct wayland_surface *w) { uint32_t scale = w->scale_120; int gx = yasl_scale_to_logical(w->content.x, scale); @@ -85,10 +85,10 @@ static void popup_set_geometry(struct yasl_surface *w) xdg_surface_set_window_geometry(w->xdg_surface, gx, gy, gw, gh); } -static struct xdg_positioner *popup_positioner(struct yasl_surface *w, +static struct xdg_positioner *popup_positioner(struct wayland_surface *w, const struct yasl_popup_spec *spec) { - struct yasl_surface *parent = w->parent; + struct wayland_surface *parent = w->parent; struct xdg_positioner *pos = xdg_wm_base_create_positioner(w->conn->wm_base); if (!pos) return NULL; @@ -119,23 +119,24 @@ static struct xdg_positioner *popup_positioner(struct yasl_surface *w, return pos; } -struct yasl_surface *yasl_surface_create_popup(struct yasl_surface *parent, +struct wayland_surface *wayland_surface_create_popup(struct wayland_surface *parent, const struct yasl_popup_spec *spec) { - struct yasl_display *c = parent ? parent->conn : NULL; + struct wayland_display *c = parent ? parent->conn : NULL; struct seat *seat = c ? conn_active_seat(c) : NULL; if (!c || c->lost || parent->closed || !parent->xdg_surface || !seat || !seat->input_serial || !popup_spec_valid(spec)) return NULL; - struct yasl_surface *w = calloc(1, sizeof(*w)); + struct wayland_surface *w = calloc(1, sizeof(*w)); if (!w) return NULL; + w->base.display = &c->base; w->conn = c; w->conn_next = c->surfaces; c->surfaces = w; w->parent = parent; - yasl_surface_set_callbacks(w, NULL, NULL); + wayland_surface_set_callbacks(w, NULL, NULL); w->clock.refresh_ns = parent->clock.refresh_ns; w->surface = wl_compositor_create_surface(c->compositor); @@ -162,11 +163,11 @@ struct yasl_surface *yasl_surface_create_popup(struct yasl_surface *parent, return w; err: - yasl_surface_destroy(w); + wayland_surface_destroy(w); return NULL; } -bool yasl_surface_popup_reposition(struct yasl_surface *w, const struct yasl_popup_spec *spec) +bool wayland_surface_popup_reposition(struct wayland_surface *w, const struct yasl_popup_spec *spec) { if (!w || !w->popup || w->closed || !w->conn || w->conn->lost || !popup_spec_valid(spec) || @@ -188,6 +189,6 @@ bool yasl_surface_popup_reposition(struct yasl_surface *w, const struct yasl_pop static uint32_t token; xdg_popup_reposition(w->popup, pos, ++token); xdg_positioner_destroy(pos); - yasl_surface_schedule_redraw(w); + wayland_surface_schedule_redraw(w); return true; } |
