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;
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;
*/
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);
}
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);
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;
#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"
}
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;
&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.
}
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);
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
}
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);
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;
}
* 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);
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;
}
}
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
* 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;
}
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;
}
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);
}
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
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);
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);
/*
#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"
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);
}
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;
}
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;
}
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;
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);
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);
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) {
/*
* 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
* | ----------------- | ---------------- | ---------- | -------
&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);
/* 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);
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 */
#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);
}
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);
}
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;
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);
}
* 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);
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);