Strictly use handle_ prefix for signal handlers

This commit is contained in:
tokyo4j 2025-06-26 18:23:09 +09:00 committed by Hiroaki Yamamoto
parent 6f70cd0d6e
commit 75bd188592
11 changed files with 49 additions and 56 deletions

View 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);

View 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;

View 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

View 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;
}

View 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;
}

View 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);
/*

View 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) {

View 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);

View 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 */

View 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);
}

View file

@ -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);