backend/drm: make listener names more idiomatic

Use the "<object>_<event>" notation for listeners, use
"handle_<listener>" for handlers.
master
Simon Ser 4 years ago
parent b9460ab724
commit c5f239f411
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

@ -45,8 +45,8 @@ static void backend_destroy(struct wlr_backend *backend) {
wl_list_remove(&drm->display_destroy.link); wl_list_remove(&drm->display_destroy.link);
wl_list_remove(&drm->session_destroy.link); wl_list_remove(&drm->session_destroy.link);
wl_list_remove(&drm->session_signal.link); wl_list_remove(&drm->session_active.link);
wl_list_remove(&drm->drm_invalidated.link); wl_list_remove(&drm->dev_change.link);
finish_drm_resources(drm); finish_drm_resources(drm);
finish_drm_renderer(&drm->renderer); finish_drm_renderer(&drm->renderer);
@ -84,9 +84,9 @@ bool wlr_backend_is_drm(struct wlr_backend *b) {
return b->impl == &backend_impl; return b->impl == &backend_impl;
} }
static void session_signal(struct wl_listener *listener, void *data) { static void handle_session_active(struct wl_listener *listener, void *data) {
struct wlr_drm_backend *drm = struct wlr_drm_backend *drm =
wl_container_of(listener, drm, session_signal); wl_container_of(listener, drm, session_active);
struct wlr_session *session = drm->session; struct wlr_session *session = drm->session;
if (session->active) { if (session->active) {
@ -106,9 +106,8 @@ static void session_signal(struct wl_listener *listener, void *data) {
} }
} }
static void drm_invalidated(struct wl_listener *listener, void *data) { static void handle_dev_change(struct wl_listener *listener, void *data) {
struct wlr_drm_backend *drm = struct wlr_drm_backend *drm = wl_container_of(listener, drm, dev_change);
wl_container_of(listener, drm, drm_invalidated);
wlr_log(WLR_DEBUG, "%s invalidated", drm->name); wlr_log(WLR_DEBUG, "%s invalidated", drm->name);
@ -156,8 +155,8 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
drm->parent = get_drm_backend_from_backend(parent); drm->parent = get_drm_backend_from_backend(parent);
} }
drm->drm_invalidated.notify = drm_invalidated; drm->dev_change.notify = handle_dev_change;
wl_signal_add(&dev->events.change, &drm->drm_invalidated); wl_signal_add(&dev->events.change, &drm->dev_change);
drm->display = display; drm->display = display;
struct wl_event_loop *event_loop = wl_display_get_event_loop(display); struct wl_event_loop *event_loop = wl_display_get_event_loop(display);
@ -169,8 +168,8 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
goto error_fd; goto error_fd;
} }
drm->session_signal.notify = session_signal; drm->session_active.notify = handle_session_active;
wl_signal_add(&session->events.active, &drm->session_signal); wl_signal_add(&session->events.active, &drm->session_active);
if (!check_drm_features(drm)) { if (!check_drm_features(drm)) {
goto error_event; goto error_event;
@ -194,7 +193,7 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
return &drm->backend; return &drm->backend;
error_event: error_event:
wl_list_remove(&drm->session_signal.link); wl_list_remove(&drm->session_active.link);
wl_event_source_remove(drm->drm_event); wl_event_source_remove(drm->drm_event);
error_fd: error_fd:
wlr_session_close_file(drm->session, dev); wlr_session_close_file(drm->session, dev);

@ -85,8 +85,8 @@ struct wlr_drm_backend {
struct wl_listener display_destroy; struct wl_listener display_destroy;
struct wl_listener session_destroy; struct wl_listener session_destroy;
struct wl_listener session_signal; struct wl_listener session_active;
struct wl_listener drm_invalidated; struct wl_listener dev_change;
struct wl_list outputs; struct wl_list outputs;

Loading…
Cancel
Save