]> git.mdlowis.com Git - proto/labwc.git/commitdiff
Strictly use handle_ prefix for signal handlers
authortokyo4j <hrak1529@gmail.com>
Thu, 26 Jun 2025 09:23:09 +0000 (18:23 +0900)
committerHiroaki Yamamoto <hrak1529@gmail.com>
Sat, 28 Jun 2025 10:36:29 +0000 (19:36 +0900)
include/labwc.h
src/input/cursor.c
src/input/keyboard.c
src/node.c
src/output-virtual.c
src/output.c
src/seat.c
src/server.c
src/ssd/ssd-part.c
src/tearing.c
src/xdg.c

index af4511402356b4b9c7ff3a46183a6096dfbae18d..2e031d499b83e1d54c01f0c7613775f3bb24ae8e 100644 (file)
@@ -87,7 +87,7 @@ struct keyboard {
        struct input base;
        struct wlr_keyboard *wlr_keyboard;
        bool is_virtual;
-       struct wl_listener modifier;
+       struct wl_listener modifiers;
        struct wl_listener key;
        /* key repeat for compositor keybinds */
        uint32_t keybind_repeat_keycode;
@@ -221,7 +221,7 @@ struct seat {
        struct wl_listener virtual_pointer_new;
 
        struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
-       struct wl_listener virtual_keyboard_new;
+       struct wl_listener new_virtual_keyboard;
 };
 
 struct lab_data_buffer;
@@ -590,7 +590,7 @@ void output_enable_adaptive_sync(struct output *output, bool enabled);
  */
 float output_max_scale(struct server *server);
 
-void new_tearing_hint(struct wl_listener *listener, void *data);
+void handle_tearing_new_object(struct wl_listener *listener, void *data);
 
 void server_init(struct server *server);
 void server_start(struct server *server);
index c9a224803a74453e88fbcb4f0beb81cc80274840..c5f9e4aed2763632446d591055dcaed859913158 100644 (file)
@@ -710,7 +710,7 @@ handle_constraint_commit(struct wl_listener *listener, void *data)
 }
 
 static void
-destroy_constraint(struct wl_listener *listener, void *data)
+handle_constraint_destroy(struct wl_listener *listener, void *data)
 {
        struct constraint *constraint = wl_container_of(listener, constraint,
                destroy);
@@ -741,7 +741,7 @@ create_constraint(struct wl_listener *listener, void *data)
 
        constraint->constraint = wlr_constraint;
        constraint->seat = &server->seat;
-       constraint->destroy.notify = destroy_constraint;
+       constraint->destroy.notify = handle_constraint_destroy;
        wl_signal_add(&wlr_constraint->events.destroy, &constraint->destroy);
 
        struct view *view = server->active_view;
index 42559f3b1b7c9ec998ed033e7ea1538a9ea25051..4c53b580da00a0891a138547ccef8a5c80fb770d 100644 (file)
@@ -6,6 +6,7 @@
 #include <wlr/backend/session.h>
 #include <wlr/interfaces/wlr_keyboard.h>
 #include "action.h"
+#include "common/macros.h"
 #include "common/three-state.h"
 #include "idle.h"
 #include "input/ime.h"
@@ -140,9 +141,9 @@ broadcast_modifiers_to_unfocused_clients(struct wlr_seat *seat,
 }
 
 static void
-keyboard_modifiers_notify(struct wl_listener *listener, void *data)
+handle_modifiers(struct wl_listener *listener, void *data)
 {
-       struct keyboard *keyboard = wl_container_of(listener, keyboard, modifier);
+       struct keyboard *keyboard = wl_container_of(listener, keyboard, modifiers);
        struct seat *seat = keyboard->base.seat;
        struct server *server = seat->server;
        struct wlr_keyboard *wlr_keyboard = keyboard->wlr_keyboard;
@@ -358,7 +359,7 @@ get_keyinfo(struct wlr_keyboard *wlr_keyboard, uint32_t evdev_keycode)
                &keyinfo.raw.syms);
 
        /*
-        * keyboard_key_notify() is called before keyboard_key_modifier(),
+        * handle_key() is called before handle_modifiers(),
         * so 'modifiers' refers to modifiers that were pressed before the
         * key event in hand. Consequently, we use is_modifier_key() to
         * find out if the key event being processed is a modifier.
@@ -632,7 +633,7 @@ keyboard_cancel_all_keybind_repeats(struct seat *seat)
 }
 
 static void
-keyboard_key_notify(struct wl_listener *listener, void *data)
+handle_key(struct wl_listener *listener, void *data)
 {
        /* This event is raised when a key is pressed or released. */
        struct keyboard *keyboard = wl_container_of(listener, keyboard, key);
@@ -822,12 +823,8 @@ keyboard_group_init(struct seat *seat)
 void
 keyboard_setup_handlers(struct keyboard *keyboard)
 {
-       struct wlr_keyboard *wlr_kb = keyboard->wlr_keyboard;
-
-       keyboard->key.notify = keyboard_key_notify;
-       wl_signal_add(&wlr_kb->events.key, &keyboard->key);
-       keyboard->modifier.notify = keyboard_modifiers_notify;
-       wl_signal_add(&wlr_kb->events.modifiers, &keyboard->modifier);
+       CONNECT_SIGNAL(keyboard->wlr_keyboard, keyboard, key);
+       CONNECT_SIGNAL(keyboard->wlr_keyboard, keyboard, modifiers);
 }
 
 void
index 328c0eb9d81c8813ae7e92578d5384e82f31786e..10d79a237aed032f1fd64c8a38bc35d35fa76ff7 100644 (file)
@@ -15,7 +15,7 @@ descriptor_destroy(struct node_descriptor *node_descriptor)
 }
 
 static void
-destroy_notify(struct wl_listener *listener, void *data)
+handle_node_destroy(struct wl_listener *listener, void *data)
 {
        struct node_descriptor *node_descriptor =
                wl_container_of(listener, node_descriptor, destroy);
@@ -29,7 +29,7 @@ node_descriptor_create(struct wlr_scene_node *scene_node,
        struct node_descriptor *node_descriptor = znew(*node_descriptor);
        node_descriptor->type = type;
        node_descriptor->data = data;
-       node_descriptor->destroy.notify = destroy_notify;
+       node_descriptor->destroy.notify = handle_node_destroy;
        wl_signal_add(&scene_node->events.destroy, &node_descriptor->destroy);
        scene_node->data = node_descriptor;
 }
index 79c83f1df2c3a31543657422e58080d9d27016c3..3853c9ef960e49a3d1743f6765895597b296477f 100644 (file)
@@ -45,7 +45,7 @@ output_virtual_add(struct server *server, const char *output_name,
         * and one time by the headless backend when it starts up and sends the
         * signal for all its configured outputs. Rather than keeping a global
         * server->headless.started state around that we could check here we just
-        * ignore duplicated new output calls in new_output_notify().
+        * ignore duplicated new output calls in handle_new_output().
         */
        wl_list_remove(&server->new_output.link);
 
@@ -62,7 +62,7 @@ output_virtual_add(struct server *server, const char *output_name,
                wlr_output_set_name(wlr_output, output_name);
        }
        if (store_wlr_output) {
-               /* Ensures that we can use the new wlr_output pointer within new_output_notify() */
+               /* Ensures that we can use the new wlr_output pointer within handle_new_output() */
                *store_wlr_output = wlr_output;
        }
 
index e72d14cf9190ba46a3be3f21529fa1e1be59ba91..17d801176c896e0b03056f157fb816a7d51bb6a5 100644 (file)
@@ -105,7 +105,7 @@ output_apply_gamma(struct output *output)
 }
 
 static void
-output_frame_notify(struct wl_listener *listener, void *data)
+handle_output_frame(struct wl_listener *listener, void *data)
 {
        /*
         * This function is called every time an output is ready to display a
@@ -128,7 +128,7 @@ output_frame_notify(struct wl_listener *listener, void *data)
                 * TODO: This is a short term fix for issue #1667,
                 *       a proper fix would require restructuring
                 *       the life cycle of scene outputs, e.g.
-                *       creating them on new_output_notify() only.
+                *       creating them on handle_new_output() only.
                 */
                wlr_log(WLR_INFO, "Failed to render new frame: no scene-output");
                return;
@@ -158,7 +158,7 @@ output_frame_notify(struct wl_listener *listener, void *data)
 }
 
 static void
-output_destroy_notify(struct wl_listener *listener, void *data)
+handle_output_destroy(struct wl_listener *listener, void *data)
 {
        struct output *output = wl_container_of(listener, output, destroy);
        struct seat *seat = &output->server->seat;
@@ -209,7 +209,7 @@ output_destroy_notify(struct wl_listener *listener, void *data)
 }
 
 static void
-output_request_state_notify(struct wl_listener *listener, void *data)
+handle_output_request_state(struct wl_listener *listener, void *data)
 {
        /* This ensures nested backends can be resized */
        struct output *output = wl_container_of(listener, output, request_state);
@@ -410,7 +410,7 @@ configure_new_output(struct server *server, struct output *output)
 }
 
 static void
-new_output_notify(struct wl_listener *listener, void *data)
+handle_new_output(struct wl_listener *listener, void *data)
 {
        /*
         * This event is raised by the backend when a new output (aka display
@@ -477,12 +477,12 @@ new_output_notify(struct wl_listener *listener, void *data)
 
        wl_list_insert(&server->outputs, &output->link);
 
-       output->destroy.notify = output_destroy_notify;
+       output->destroy.notify = handle_output_destroy;
        wl_signal_add(&wlr_output->events.destroy, &output->destroy);
-       output->frame.notify = output_frame_notify;
+       output->frame.notify = handle_output_frame;
        wl_signal_add(&wlr_output->events.frame, &output->frame);
 
-       output->request_state.notify = output_request_state_notify;
+       output->request_state.notify = handle_output_request_state;
        wl_signal_add(&wlr_output->events.request_state, &output->request_state);
 
        wl_list_init(&output->regions);
@@ -545,7 +545,7 @@ output_init(struct server *server)
        server->gamma_control_manager_v1 =
                wlr_gamma_control_manager_v1_create(server->wl_display);
 
-       server->new_output.notify = new_output_notify;
+       server->new_output.notify = handle_new_output;
        wl_signal_add(&server->backend->events.new_output, &server->new_output);
 
        /*
index 2ba7fc5c29b1b931998b3d6467e8368964da4622..0beaf487724ba16273dc673d4c9f1f224c9339ce 100644 (file)
@@ -8,6 +8,7 @@
 #include <wlr/types/wlr_pointer.h>
 #include <wlr/types/wlr_touch.h>
 #include <wlr/util/log.h>
+#include "common/macros.h"
 #include "common/mem.h"
 #include "input/ime.h"
 #include "input/tablet.h"
@@ -29,7 +30,7 @@ input_device_destroy(struct wl_listener *listener, void *data)
        if (input->wlr_input_device->type == WLR_INPUT_DEVICE_KEYBOARD) {
                struct keyboard *keyboard = (struct keyboard *)input;
                wl_list_remove(&keyboard->key.link);
-               wl_list_remove(&keyboard->modifier.link);
+               wl_list_remove(&keyboard->modifiers.link);
                keyboard_cancel_keybind_repeat(keyboard);
        }
        free(input);
@@ -456,7 +457,7 @@ seat_add_device(struct seat *seat, struct input *input)
 }
 
 static void
-new_input_notify(struct wl_listener *listener, void *data)
+handle_new_input(struct wl_listener *listener, void *data)
 {
        struct seat *seat = wl_container_of(listener, seat, new_input);
        struct wlr_input_device *device = data;
@@ -504,9 +505,9 @@ new_virtual_pointer(struct wl_listener *listener, void *data)
 }
 
 static void
-new_virtual_keyboard(struct wl_listener *listener, void *data)
+handle_new_virtual_keyboard(struct wl_listener *listener, void *data)
 {
-       struct seat *seat = wl_container_of(listener, seat, virtual_keyboard_new);
+       struct seat *seat = wl_container_of(listener, seat, new_virtual_keyboard);
        struct wlr_virtual_keyboard_v1 *virtual_keyboard = data;
        struct wlr_input_device *device = &virtual_keyboard->keyboard.base;
 
@@ -516,7 +517,7 @@ new_virtual_keyboard(struct wl_listener *listener, void *data)
 }
 
 static void
-focus_change_notify(struct wl_listener *listener, void *data)
+handle_focus_change(struct wl_listener *listener, void *data)
 {
        struct seat *seat = wl_container_of(listener, seat, focus_change);
        struct wlr_seat_keyboard_focus_change_event *event = data;
@@ -567,12 +568,9 @@ seat_init(struct server *server)
        wl_list_init(&seat->touch_points);
        wl_list_init(&seat->constraint_commit.link);
        wl_list_init(&seat->inputs);
-       seat->new_input.notify = new_input_notify;
-       wl_signal_add(&server->backend->events.new_input, &seat->new_input);
 
-       seat->focus_change.notify = focus_change_notify;
-       wl_signal_add(&seat->seat->keyboard_state.events.focus_change,
-               &seat->focus_change);
+       CONNECT_SIGNAL(server->backend, seat, new_input);
+       CONNECT_SIGNAL(&seat->seat->keyboard_state, seat, focus_change);
 
        seat->virtual_pointer = wlr_virtual_pointer_manager_v1_create(
                server->wl_display);
@@ -582,9 +580,7 @@ seat_init(struct server *server)
 
        seat->virtual_keyboard = wlr_virtual_keyboard_manager_v1_create(
                server->wl_display);
-       wl_signal_add(&seat->virtual_keyboard->events.new_virtual_keyboard,
-               &seat->virtual_keyboard_new);
-       seat->virtual_keyboard_new.notify = new_virtual_keyboard;
+       CONNECT_SIGNAL(seat->virtual_keyboard, seat, new_virtual_keyboard);
 
        seat->input_method_relay = input_method_relay_create(seat);
 
@@ -611,7 +607,7 @@ seat_finish(struct server *server)
        wl_list_remove(&seat->new_input.link);
        wl_list_remove(&seat->focus_change.link);
        wl_list_remove(&seat->virtual_pointer_new.link);
-       wl_list_remove(&seat->virtual_keyboard_new.link);
+       wl_list_remove(&seat->new_virtual_keyboard.link);
 
        struct input *input, *next;
        wl_list_for_each_safe(input, next, &seat->inputs, link) {
index 554398b8e688b2769ada676c1fbff76c1c0d7d39..f84011f52ee2f0eb85c4043afe3f61e7956b1d93 100644 (file)
@@ -568,7 +568,7 @@ server_init(struct server *server)
        /*
         * The order in which the scene-trees below are created determines the
         * z-order for nodes which cover the whole work-area.  For per-output
-        * scene-trees, see new_output_notify() in src/output.c
+        * scene-trees, see handle_new_output() in src/output.c
         *
         * | Type              | Scene Tree       | Per Output | Example
         * | ----------------- | ---------------- | ---------- | -------
@@ -711,7 +711,7 @@ server_init(struct server *server)
                &server->output_power_manager_set_mode);
 
        server->tearing_control = wlr_tearing_control_manager_v1_create(server->wl_display, 1);
-       server->tearing_new_object.notify = new_tearing_hint;
+       server->tearing_new_object.notify = handle_tearing_new_object;
        wl_signal_add(&server->tearing_control->events.new_object, &server->tearing_new_object);
 
        server->tablet_manager = wlr_tablet_v2_create(server->wl_display);
index 010d494af1487b3d67854a9bea2aa56b8ef2b0a5..1efc7cad0abb05f94cd30c1c84581db63a890314 100644 (file)
@@ -13,7 +13,7 @@
 
 /* Internal helpers */
 static void
-ssd_button_destroy_notify(struct wl_listener *listener, void *data)
+handle_button_node_destroy(struct wl_listener *listener, void *data)
 {
        struct ssd_button *button = wl_container_of(listener, button, destroy);
        wl_list_remove(&button->destroy.link);
@@ -32,7 +32,7 @@ ssd_button_descriptor_create(struct wlr_scene_node *node)
        struct ssd_button *button = znew(*button);
 
        /* Let it destroy automatically when the scene node destroys */
-       button->destroy.notify = ssd_button_destroy_notify;
+       button->destroy.notify = handle_button_node_destroy;
        wl_signal_add(&node->events.destroy, &button->destroy);
 
        /* And finally attach the ssd_button to a node descriptor */
index b4e86d608b36798fd4900d3c70aa06171614a00b..50b0611cb2365de21e98ae7cee68f66d044f78ca 100644 (file)
@@ -5,13 +5,13 @@
 #include "view.h"
 
 struct tearing_controller {
-               struct wlr_tearing_control_v1 *tearing_control;
-               struct wl_listener set_hint;
-               struct wl_listener destroy;
+       struct wlr_tearing_control_v1 *tearing_control;
+       struct wl_listener set_hint;
+       struct wl_listener destroy;
 };
 
 static void
-set_tearing_hint(struct wl_listener *listener, void *data)
+handle_controller_set_hint(struct wl_listener *listener, void *data)
 {
        struct tearing_controller *controller = wl_container_of(listener, controller, set_hint);
        struct view *view = view_from_wlr_surface(controller->tearing_control->surface);
@@ -28,7 +28,7 @@ set_tearing_hint(struct wl_listener *listener, void *data)
 }
 
 static void
-tearing_controller_destroy(struct wl_listener *listener, void *data)
+handle_controller_destroy(struct wl_listener *listener, void *data)
 {
        struct tearing_controller *controller = wl_container_of(listener, controller, destroy);
        wl_list_remove(&controller->set_hint.link);
@@ -37,7 +37,7 @@ tearing_controller_destroy(struct wl_listener *listener, void *data)
 }
 
 void
-new_tearing_hint(struct wl_listener *listener, void *data)
+handle_tearing_new_object(struct wl_listener *listener, void *data)
 {
        struct server *server = wl_container_of(listener, server, tearing_new_object);
        struct wlr_tearing_control_v1 *tearing_control = data;
@@ -51,9 +51,9 @@ new_tearing_hint(struct wl_listener *listener, void *data)
        struct tearing_controller *controller = znew(*controller);
        controller->tearing_control = tearing_control;
 
-       controller->set_hint.notify = set_tearing_hint;
+       controller->set_hint.notify = handle_controller_set_hint;
        wl_signal_add(&tearing_control->events.set_hint, &controller->set_hint);
 
-       controller->destroy.notify = tearing_controller_destroy;
+       controller->destroy.notify = handle_controller_destroy;
        wl_signal_add(&tearing_control->events.destroy, &controller->destroy);
 }
index db64c92c688adaca223c8ee70580bebaa23d19e1..a2fbf1b8cc15a8f839a4baf30412dfeefc8bd2d1 100644 (file)
--- a/src/xdg.c
+++ b/src/xdg.c
@@ -922,7 +922,7 @@ handle_xdg_activation_request(struct wl_listener *listener, void *data)
  *     to help the popups find their parent nodes
  */
 static void
-xdg_toplevel_new(struct wl_listener *listener, void *data)
+handle_new_xdg_toplevel(struct wl_listener *listener, void *data)
 {
        struct server *server =
                wl_container_of(listener, server, new_xdg_toplevel);
@@ -1063,7 +1063,7 @@ xdg_shell_init(struct server *server)
                exit(EXIT_FAILURE);
        }
 
-       server->new_xdg_toplevel.notify = xdg_toplevel_new;
+       server->new_xdg_toplevel.notify = handle_new_xdg_toplevel;
        wl_signal_add(&server->xdg_shell->events.new_toplevel, &server->new_xdg_toplevel);
 
        server->xdg_activation = wlr_xdg_activation_v1_create(server->wl_display);