summaryrefslogtreecommitdiff
path: root/src/common/events.c
diff options
context:
space:
mode:
authorBerke Güzel <berke.guzel@gdh.digital>2026-10-14 09:38:31 +0300
committerBerke Güzel <berke.guzel@gdh.digital>2026-10-14 09:38:31 +0300
commit5ef6ca21ab9e1cf4f69254234d190a634b777d52 (patch)
tree974d3797a6d9487e54a811e224bf78a3f52dda85 /src/common/events.c
parent563b23a33726289387193b85d90fb569631ee05f (diff)
Remove deprecated Cocoa OpenGL and private compatibility APIs
Diffstat (limited to 'src/common/events.c')
-rw-r--r--src/common/events.c56
1 files changed, 4 insertions, 52 deletions
diff --git a/src/common/events.c b/src/common/events.c
index ba78d77..9245050 100644
--- a/src/common/events.c
+++ b/src/common/events.c
@@ -228,46 +228,18 @@ bool yasl_private_display_post(struct yasl_private_display *d, const struct yasl
return true;
}
-static bool poll_event(struct yasl_private_display *d, uint64_t queue_id, struct yasl_private_event *event)
+bool yasl_private_display_poll_event(struct yasl_private_display *d, struct yasl_private_event *event)
{
if (!d || !d->events || !event) return false;
struct yasl_private_event_state *state = d->events;
yasl_private_mutex_lock(&state->mutex);
- struct event_node *discarded = NULL;
- struct event_node **entry = &state->head;
- struct event_node *previous = NULL;
- if (queue_id) {
- /* The input-only migration adapter uses legacy callbacks for lifecycle.
- * Retaining those notifications would keep dispatch permanently ready.
- * Mixing this adapter with display polling is deliberately unsupported. */
- while (*entry) {
- struct event_node *candidate = *entry;
- if (candidate->event.type < YASL_PRIVATE_EVENT_KEY ||
- candidate->event.type > YASL_PRIVATE_EVENT_INPUT_RESET) {
- *entry = candidate->next;
- if (state->tail == candidate) state->tail = previous;
- candidate->next = discarded;
- discarded = candidate;
- } else {
- previous = candidate;
- entry = &candidate->next;
- }
- }
- entry = &state->head;
- previous = NULL;
- while (*entry && (*entry)->queue_id != queue_id) {
- previous = *entry;
- entry = &(*entry)->next;
- }
- }
- struct event_node *node = *entry;
+ struct event_node *node = state->head;
if (!node) {
yasl_private_mutex_unlock(&state->mutex);
- dispose_list(discarded);
return false;
}
- *entry = node->next;
- if (state->tail == node) state->tail = previous;
+ state->head = node->next;
+ if (state->tail == node) state->tail = NULL;
node->next = NULL;
if (node->event.surface_id)
node->event.surface = yasl_private_events_find(d, node->event.surface_id);
@@ -276,20 +248,9 @@ static bool poll_event(struct yasl_private_display *d, uint64_t queue_id, struct
*event = node->event;
yasl_private_mutex_unlock(&state->mutex);
dispose(last);
- dispose_list(discarded);
return true;
}
-bool yasl_private_display_poll_event(struct yasl_private_display *d, struct yasl_private_event *event)
-{
- return poll_event(d, 0, event);
-}
-
-bool yasl_private_events_poll_surface(struct yasl_surface *s, struct yasl_private_event *event)
-{
- return s && s->id ? poll_event(s->display, s->id, event) : false;
-}
-
uint64_t yasl_private_events_request_id(struct yasl_private_display *d)
{
if (!d->events || d->events->request == UINT64_MAX) { errno = EOVERFLOW; return 0; }
@@ -310,14 +271,12 @@ void yasl_private_surface_notify_configure(struct yasl_surface *s, struct yasl_p
.resize = {.geometry = geometry, .scale_changed = previous_scale != geometry.scale_120}};
yasl_private_events_push(s->display, s, &event);
if (s->display) yasl_private_surface_request_frame(s);
- if (s->callbacks.configure) s->callbacks.configure(s, geometry, s->ud);
}
void yasl_private_surface_notify_close(struct yasl_surface *s)
{
struct yasl_private_event event = {.type = YASL_PRIVATE_EVENT_WINDOW_CLOSE, .surface = s};
yasl_private_events_push(s->display, s, &event);
- if (s->callbacks.close) s->callbacks.close(s, s->ud);
}
void yasl_private_surface_notify_state(struct yasl_surface *s, uint32_t flags)
@@ -325,21 +284,18 @@ void yasl_private_surface_notify_state(struct yasl_surface *s, uint32_t flags)
s->state = flags;
struct yasl_private_event event = {.type = YASL_PRIVATE_EVENT_WINDOW_STATE, .surface = s, .state.flags = flags};
yasl_private_events_push(s->display, s, &event);
- if (s->callbacks.state) s->callbacks.state(s, flags, s->ud);
}
void yasl_private_surface_notify_drag(struct yasl_surface *s, enum yasl_private_drag_event action, struct yasl_private_vector2i pos)
{
struct yasl_private_event event = {.type = YASL_PRIVATE_EVENT_DRAG, .surface = s, .drag = {action, pos}};
yasl_private_events_push(s->display, s, &event);
- if (s->callbacks.drag) s->callbacks.drag(s, action, pos, s->ud);
}
void yasl_private_surface_notify_drop(struct yasl_surface *s, enum yasl_private_drop_event action, struct yasl_private_vector2i pos)
{
struct yasl_private_event event = {.type = YASL_PRIVATE_EVENT_DROP_HOVER, .surface = s, .drop = {action, pos}};
yasl_private_events_push(s->display, s, &event);
- if (s->callbacks.drop) s->callbacks.drop(s, action, pos, s->ud);
}
void yasl_private_surface_notify_composition(struct yasl_surface *s, const char *text, int begin, int end)
@@ -367,8 +323,4 @@ void yasl_private_display_notify_event(struct yasl_private_display *d, enum yasl
{
struct yasl_private_event event = {.type = type};
yasl_private_events_push(d, NULL, &event);
- void (*callback)(void *) = type == YASL_PRIVATE_EVENT_DISPLAY_QUIT ? d->callbacks.quit
- : type == YASL_PRIVATE_EVENT_DISPLAY_REOPEN ? d->callbacks.reopen
- : type == YASL_PRIVATE_EVENT_DISPLAY_LOST ? d->callbacks.lost : NULL;
- if (callback) callback(d->callback_ud);
}