From 79cc95b501c69d0e37f1f57fc2b41533c013ab05 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Sat, 28 Feb 2026 02:30:35 -0800 Subject: [PATCH] [digesting_libdecor] remove wl_surface listeners --- digesting_libdecor.c | 116 +++---------------------------------------- digesting_libdecor.h | 18 +------ 2 files changed, 10 insertions(+), 124 deletions(-) diff --git a/digesting_libdecor.c b/digesting_libdecor.c index c0bef08..50dac94 100755 --- a/digesting_libdecor.c +++ b/digesting_libdecor.c @@ -91,32 +91,6 @@ shm_format(void *user_data, struct wl_shm *wl_shm, uint32_t format){ const struct wl_shm_listener shm_listener = { shm_format }; -static void -cursor_surface_enter(void *data, struct wl_surface *wl_surface, struct wl_output *wl_output){ - struct seat *seat = data; - if (own_proxy(wl_output)) { - if (update_local_cursor(seat)){ - send_cursor(seat); - } - } -} - -static void -cursor_surface_leave(void *data, struct wl_surface *wl_surface, struct wl_output *wl_output){ - struct seat *seat = data; - - if (own_proxy(wl_output)){ - if (update_local_cursor(seat)){ - send_cursor(seat); - } - } -} - -static struct wl_surface_listener cursor_surface_listener = { - cursor_surface_enter, - cursor_surface_leave, -}; - static void pointer_enter(void *data, struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t surface_x, wl_fixed_t surface_y){ @@ -127,7 +101,6 @@ pointer_enter(void *data, struct wl_pointer *wl_pointer, uint32_t serial, if (is_own_surface || ctx.handle_cursor){ if (seat->cursor_surface == 0){ seat->cursor_surface = wl_compositor_create_surface(ctx.wl_compositor); - wl_surface_add_listener(seat->cursor_surface, &cursor_surface_listener, seat); } seat->pointer_x = wl_fixed_to_int(surface_x); seat->pointer_y = wl_fixed_to_int(surface_y); @@ -522,6 +495,7 @@ const struct wl_seat_listener seat_listener = { seat_name }; +#if 0 static void output_geometry(void *data, struct wl_output *wl_output, int32_t x, int32_t y, @@ -561,6 +535,7 @@ const struct wl_output_listener output_listener = { output_done, output_scale }; +#endif static void wl_registry_global(void *data, struct wl_registry *wl_registry, @@ -612,6 +587,7 @@ wl_registry_global(void *data, struct wl_registry *wl_registry, seat->wl_seat = wl_registry_bind(ctx.wl_registry, name, &wl_seat_interface, 3); wl_seat_add_listener(seat->wl_seat, &seat_listener, seat); } +#if 0 else if (strcmp(interface, "wl_output") == 0){ struct output *output; if (version < 2){ @@ -625,11 +601,13 @@ wl_registry_global(void *data, struct wl_registry *wl_registry, wl_proxy_set_tag((struct wl_proxy*)output->wl_output, &libdecor_gtk_proxy_tag); wl_output_add_listener(output->wl_output, &output_listener, output); } +#endif } static void wl_registry_global_remove(void *data, struct wl_registry *registry, uint32_t name){ +#if 0 struct output *output; wl_list_for_each(output, &ctx.output_list, link){ if (output->id == name){ @@ -653,6 +631,7 @@ wl_registry_global_remove(void *data, struct wl_registry *registry, break; } } +#endif } const struct wl_registry_listener wl_registry_listener = { @@ -847,7 +826,9 @@ int main(){ ctx.w = 640; ctx.h = 480; wl_list_init(&ctx.seat_list); +#if 0 wl_list_init(&ctx.output_list); +#endif } if (gtk_init_success){ @@ -1558,19 +1539,6 @@ cleanup(void){ } } - { - struct output *output, *output_tmp; - wl_list_for_each_safe(output, output_tmp, - &ctx.output_list, link) { - if (wl_output_get_version (output->wl_output) >= - WL_OUTPUT_RELEASE_SINCE_VERSION) - wl_output_release(output->wl_output); - else - wl_output_destroy(output->wl_output); - free(output); - } - } - if (ctx.wl_shm){ wl_shm_destroy(ctx.wl_shm); } @@ -2076,14 +2044,6 @@ free_border_component(struct border_component *border_component){ buffer_free(border_component->buffer); border_component->buffer = NULL; } - if (border_component->output_list.next != NULL) { - struct surface_output *surface_output, *surface_output_tmp; - wl_list_for_each_safe(surface_output, surface_output_tmp, - &border_component->output_list, link) { - wl_list_remove(&surface_output->link); - free(surface_output); - } - } } static void @@ -2128,9 +2088,6 @@ redraw_scale(struct border_component *cmpnt){ bool need_commit = false; if (cmpnt->wl_surface != 0){ - wl_list_for_each(surface_output, &cmpnt->output_list, link){ - scale = MAX(scale, surface_output->output->scale); - } if (scale != cmpnt->scale){ cmpnt->scale = scale; if ((ctx.decoration_type != DECORATION_TYPE_NONE) && @@ -2146,70 +2103,13 @@ redraw_scale(struct border_component *cmpnt){ } } -static void -surface_enter(void *data, struct wl_surface *wl_surface, struct wl_output *wl_output){ - if (own_proxy(wl_surface) && own_proxy(wl_output)){ - struct border_component *cmpnt = border_component_from_wl_surface(wl_surface); - if (cmpnt != 0){ - bool new_surface_output = false; - if (own_proxy(wl_output)){ - struct output *output = wl_output_get_user_data(wl_output); - if (output != 0){ - struct wl_list *list = &cmpnt->output_list; - struct surface_output *surface_output = calloc(1, sizeof *surface_output); - surface_output->output = output; - wl_list_insert(list, &surface_output->link); - new_surface_output = true; - } - } - - if (new_surface_output){ - redraw_scale(cmpnt); - } - } - } -} - -static void -surface_leave(void *data, struct wl_surface *wl_surface, struct wl_output *wl_output){ - if (own_proxy(wl_surface) && own_proxy(wl_output)){ - struct border_component *cmpnt = border_component_from_wl_surface(wl_surface); - if (cmpnt != 0){ - bool removed_surface_output = false; - { - struct wl_list *list = &cmpnt->output_list; - struct surface_output *surface_output; - wl_list_for_each(surface_output, list, link){ - if (surface_output->output->wl_output == wl_output){ - wl_list_remove(&surface_output->link); - free(surface_output); - removed_surface_output = true; - break; - } - } - } - - if (removed_surface_output){ - redraw_scale(cmpnt); - } - } - } -} - -static struct wl_surface_listener surface_listener = { - surface_enter, - surface_leave, -}; - static void ensure_component(struct border_component *cmpnt){ if (cmpnt->wl_surface == 0){ - wl_list_init(&cmpnt->output_list); cmpnt->scale = 1; cmpnt->wl_surface = wl_compositor_create_surface(ctx.wl_compositor); wl_proxy_set_tag((struct wl_proxy *)cmpnt->wl_surface, &libdecor_gtk_proxy_tag); cmpnt->wl_subsurface = wl_subcompositor_get_subsurface(ctx.wl_subcompositor, cmpnt->wl_surface, ctx.wl_surface); - wl_surface_add_listener(cmpnt->wl_surface, &surface_listener, 0); } } diff --git a/digesting_libdecor.h b/digesting_libdecor.h index 5a7d1ad..835429e 100644 --- a/digesting_libdecor.h +++ b/digesting_libdecor.h @@ -164,7 +164,6 @@ struct border_component { struct wl_subsurface *wl_subsurface; struct buffer *buffer; bool opaque; - struct wl_list output_list; int scale; struct wl_list child_components; /* border_component::link */ @@ -232,7 +231,8 @@ struct seat { struct wl_surface *pointer_focus; struct wl_surface *touch_focus; - int pointer_x, pointer_y; + int pointer_x; + int pointer_y; uint32_t touch_down_time_stamp; @@ -243,14 +243,6 @@ struct seat { struct wl_list link; }; -struct output { - struct wl_output *wl_output; - uint32_t id; - int scale; - - struct wl_list link; -}; - struct buffer { struct wl_buffer *wl_buffer; bool in_use; @@ -265,11 +257,6 @@ struct buffer { int buffer_height; }; -struct surface_output { - struct output *output; - struct wl_list link; -}; - enum titlebar_gesture { TITLEBAR_GESTURE_DOUBLE_CLICK, TITLEBAR_GESTURE_MIDDLE_CLICK, @@ -357,7 +344,6 @@ typedef struct Ctx{ struct zxdg_decoration_manager_v1 *decoration_manager; struct wl_list seat_list; - struct wl_list output_list; bool has_error;