From 5ef6ca21ab9e1cf4f69254234d190a634b777d52 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Wed, 14 Oct 2026 09:38:31 +0300 Subject: Remove deprecated Cocoa OpenGL and private compatibility APIs --- src/platform/x11/window.c | 135 +++++++++++++++------------------------------- 1 file changed, 42 insertions(+), 93 deletions(-) (limited to 'src/platform/x11') diff --git a/src/platform/x11/window.c b/src/platform/x11/window.c index ef13afe..43e2109 100644 --- a/src/platform/x11/window.c +++ b/src/platform/x11/window.c @@ -1384,8 +1384,8 @@ static bool popup_spec_valid(const struct x11_surface *parent, const struct yasl_private_popup_spec *spec) { if (!parent || !spec) return false; - if (spec->positioner_explicit && (spec->anchor_edges > 8 || spec->gravity > 8 || - (spec->constraints & ~63u))) return false; + if (spec->anchor_edges > 8 || spec->gravity > 8 || + (spec->constraints & ~63u)) return false; int parent_cx = parent->is_popup ? parent->content_offset.x : 0; int parent_cy = parent->is_popup ? parent->content_offset.y : 0; int64_t x = (int64_t)spec->anchor.x - parent_cx; @@ -1494,22 +1494,10 @@ static void popup_calculate_position(struct x11_display *d, struct yasl_private_vector2i size = spec->size; int anchor_x, anchor_y, root_x, root_y; - if (spec->positioner_explicit) { - popup_anchor_point(spec, &anchor_x, &anchor_y); - anchor_x += parent_rx - parent_cx; - anchor_y += parent_ry - parent_cy; - popup_position_at(spec, anchor_x, anchor_y, spec->gravity, size, &root_x, &root_y); - } else { - anchor_x = parent_rx + (spec->anchor.x - parent_cx); - anchor_y = parent_ry + (spec->anchor.y - parent_cy); - if (spec->beside) { - root_x = anchor_x + spec->anchor.width - spec->content_offset.x; - root_y = anchor_y - spec->content_offset.y; - } else { - root_x = anchor_x - spec->content_offset.x; - root_y = anchor_y + spec->anchor.height - spec->content_offset.y; - } - } + popup_anchor_point(spec, &anchor_x, &anchor_y); + anchor_x += parent_rx - parent_cx; + anchor_y += parent_ry - parent_cy; + popup_position_at(spec, anchor_x, anchor_y, spec->gravity, size, &root_x, &root_y); int mon_x = 0, mon_y = 0; int mon_w = d->native ? DisplayWidth(d->native, d->screen) : 1920; @@ -1535,60 +1523,44 @@ static void popup_calculate_position(struct x11_display *d, } #endif - if (spec->positioner_explicit) { - if (spec->constraints & X11_CONSTRAINT_FLIP_X) { - int flip_x, flip_y; - /* Reflect the selected anchor edge across the anchor rectangle center. */ - int anchor_origin_x = parent_rx - parent_cx + spec->anchor.x; - int flipped_anchor_x = 2 * anchor_origin_x + spec->anchor.width - anchor_x; - popup_position_at(spec, flipped_anchor_x, anchor_y, popup_flip_x(spec->gravity), size, &flip_x, &flip_y); - if (popup_overflow(flip_x, size.x, mon_x, mon_x + mon_w) < - popup_overflow(root_x, size.x, mon_x, mon_x + mon_w)) root_x = flip_x; - } - if (spec->constraints & X11_CONSTRAINT_FLIP_Y) { - int flip_x, flip_y; - int anchor_origin_y = parent_ry - parent_cy + spec->anchor.y; - int flipped_anchor_y = 2 * anchor_origin_y + spec->anchor.height - anchor_y; - popup_position_at(spec, anchor_x, flipped_anchor_y, popup_flip_y(spec->gravity), size, &flip_x, &flip_y); - if (popup_overflow(flip_y, size.y, mon_y, mon_y + mon_h) < - popup_overflow(root_y, size.y, mon_y, mon_y + mon_h)) root_y = flip_y; - } - if (spec->constraints & X11_CONSTRAINT_SLIDE_X) { - if (root_x < mon_x) root_x = mon_x; - if (root_x + size.x > mon_x + mon_w) root_x = mon_x + mon_w - size.x; - } - if (spec->constraints & X11_CONSTRAINT_SLIDE_Y) { - if (root_y < mon_y) root_y = mon_y; - if (root_y + size.y > mon_y + mon_h) root_y = mon_y + mon_h - size.y; - } - if ((spec->constraints & X11_CONSTRAINT_RESIZE_X) && - popup_overflow(root_x, size.x, mon_x, mon_x + mon_w)) { - if (root_x >= mon_x + mon_w) root_x = mon_x + mon_w - 1; - if (root_x < mon_x) { size.x -= mon_x - root_x; root_x = mon_x; } - if (root_x + size.x > mon_x + mon_w) size.x = mon_x + mon_w - root_x; - if (size.x < 1) size.x = 1; - } - if ((spec->constraints & X11_CONSTRAINT_RESIZE_Y) && - popup_overflow(root_y, size.y, mon_y, mon_y + mon_h)) { - if (root_y >= mon_y + mon_h) root_y = mon_y + mon_h - 1; - if (root_y < mon_y) { size.y -= mon_y - root_y; root_y = mon_y; } - if (root_y + size.y > mon_y + mon_h) size.y = mon_y + mon_h - root_y; - if (size.y < 1) size.y = 1; - } - } else { - if (spec->beside) { - if (root_x + size.x > mon_x + mon_w) { - int flipped_x = anchor_x - size.x + spec->content_offset.x; - if (flipped_x >= mon_x) root_x = flipped_x; - } - } else if (root_y + size.y > mon_y + mon_h) { - int flipped_y = anchor_y - size.y + spec->content_offset.y; - if (flipped_y >= mon_y) root_y = flipped_y; - } - if (root_x + size.x > mon_x + mon_w) root_x = mon_x + mon_w - size.x; + if (spec->constraints & X11_CONSTRAINT_FLIP_X) { + int flip_x, flip_y; + /* Reflect the selected anchor edge across the anchor rectangle center. */ + int anchor_origin_x = parent_rx - parent_cx + spec->anchor.x; + int flipped_anchor_x = 2 * anchor_origin_x + spec->anchor.width - anchor_x; + popup_position_at(spec, flipped_anchor_x, anchor_y, popup_flip_x(spec->gravity), size, &flip_x, &flip_y); + if (popup_overflow(flip_x, size.x, mon_x, mon_x + mon_w) < + popup_overflow(root_x, size.x, mon_x, mon_x + mon_w)) root_x = flip_x; + } + if (spec->constraints & X11_CONSTRAINT_FLIP_Y) { + int flip_x, flip_y; + int anchor_origin_y = parent_ry - parent_cy + spec->anchor.y; + int flipped_anchor_y = 2 * anchor_origin_y + spec->anchor.height - anchor_y; + popup_position_at(spec, anchor_x, flipped_anchor_y, popup_flip_y(spec->gravity), size, &flip_x, &flip_y); + if (popup_overflow(flip_y, size.y, mon_y, mon_y + mon_h) < + popup_overflow(root_y, size.y, mon_y, mon_y + mon_h)) root_y = flip_y; + } + if (spec->constraints & X11_CONSTRAINT_SLIDE_X) { if (root_x < mon_x) root_x = mon_x; - if (root_y + size.y > mon_y + mon_h) root_y = mon_y + mon_h - size.y; + if (root_x + size.x > mon_x + mon_w) root_x = mon_x + mon_w - size.x; + } + if (spec->constraints & X11_CONSTRAINT_SLIDE_Y) { if (root_y < mon_y) root_y = mon_y; + if (root_y + size.y > mon_y + mon_h) root_y = mon_y + mon_h - size.y; + } + if ((spec->constraints & X11_CONSTRAINT_RESIZE_X) && + popup_overflow(root_x, size.x, mon_x, mon_x + mon_w)) { + if (root_x >= mon_x + mon_w) root_x = mon_x + mon_w - 1; + if (root_x < mon_x) { size.x -= mon_x - root_x; root_x = mon_x; } + if (root_x + size.x > mon_x + mon_w) size.x = mon_x + mon_w - root_x; + if (size.x < 1) size.x = 1; + } + if ((spec->constraints & X11_CONSTRAINT_RESIZE_Y) && + popup_overflow(root_y, size.y, mon_y, mon_y + mon_h)) { + if (root_y >= mon_y + mon_h) root_y = mon_y + mon_h - 1; + if (root_y < mon_y) { size.y -= mon_y - root_y; root_y = mon_y; } + if (root_y + size.y > mon_y + mon_h) size.y = mon_y + mon_h - root_y; + if (size.y < 1) size.y = 1; } *out_x = root_x; @@ -2434,7 +2406,6 @@ static struct yasl_private_display *display_open(struct yasl_private_loop *loop, struct x11_display *d = calloc(1, sizeof(*d)); if (!d) return NULL; d->base.ops = &yasl_private_x11_backend; - d->base.callbacks = spec && spec->cbs ? *spec->cbs : (struct yasl_private_display_cbs){0}; d->native = XOpenDisplay(NULL); if (!d->native) { free(d); errno = ENODEV; return NULL; } XSetErrorHandler(yasl_private_x11_error_handler); @@ -2590,11 +2561,6 @@ static bool copy_text(struct yasl_private_display *base, enum yasl_private_selec return true; } -static void copy(struct yasl_private_display *base, enum yasl_private_selection sel, const char *text) -{ - (void)copy_text(base, sel, text); -} - static bool request_paste(struct yasl_private_display *base, enum yasl_private_selection sel, struct yasl_surface *target, uint64_t id) { @@ -2646,20 +2612,6 @@ static bool request_paste(struct yasl_private_display *base, enum yasl_private_s } } -static void paste(struct yasl_private_display *base, enum yasl_private_selection sel, - struct yasl_surface *target) -{ - (void)request_paste(base, sel, target, 0); -} - -static bool input_poll(struct yasl_surface *base, struct yasl_private_event *event) -{ - struct x11_surface *s = (struct x11_surface *)base; - if (s->destroyed) return false; - if (base->display->events) return yasl_private_events_poll_surface(base, event); - return input_queue_pop(&s->input, event); -} - static struct input_queue *surface_input_queue(struct yasl_surface *base) { return &((struct x11_surface *)base)->input; @@ -3077,8 +3029,6 @@ const struct yasl_private_backend_ops yasl_private_x11_backend = { .display_dispatch_timeout = dispatch_timeout, .display_flush = flush, .display_modifiers = mods, - .display_copy = copy, - .display_paste = paste, .display_copy_text = copy_text, .display_request_paste = request_paste, .display_drag_start = drag_start, @@ -3097,7 +3047,6 @@ const struct yasl_private_backend_ops yasl_private_x11_backend = { .surface_set_title = set_title, .surface_schedule_redraw = schedule_redraw, .surface_present = present, - .surface_poll_event = input_poll, .surface_geometry = geometry, .surface_timing = timing, .surface_frame_time_ns = frame_time, -- cgit v1.2.3