diff options
Diffstat (limited to 'backend')
-rw-r--r-- | backend/drm/atomic.c | 2 | ||||
-rw-r--r-- | backend/drm/backend.c | 36 | ||||
-rw-r--r-- | backend/drm/drm.c | 114 | ||||
-rw-r--r-- | backend/drm/properties.c | 12 | ||||
-rw-r--r-- | backend/drm/renderer.c | 36 | ||||
-rw-r--r-- | backend/libinput/backend.c | 32 | ||||
-rw-r--r-- | backend/libinput/events.c | 16 | ||||
-rw-r--r-- | backend/libinput/keyboard.c | 10 | ||||
-rw-r--r-- | backend/libinput/pointer.c | 2 | ||||
-rw-r--r-- | backend/libinput/tablet_pad.c | 2 | ||||
-rw-r--r-- | backend/libinput/tablet_tool.c | 2 | ||||
-rw-r--r-- | backend/libinput/touch.c | 2 | ||||
-rw-r--r-- | backend/multi/backend.c | 2 | ||||
-rw-r--r-- | backend/wayland/backend.c | 20 | ||||
-rw-r--r-- | backend/wayland/output.c | 38 | ||||
-rw-r--r-- | backend/wayland/registry.c | 2 | ||||
-rw-r--r-- | backend/wayland/wl_seat.c | 10 | ||||
-rw-r--r-- | backend/x11/backend.c | 28 | ||||
-rw-r--r-- | backend/x11/input_device.c | 8 | ||||
-rw-r--r-- | backend/x11/output.c | 4 |
20 files changed, 190 insertions, 188 deletions
diff --git a/backend/drm/atomic.c b/backend/drm/atomic.c index 29b5ccb1..acc56e65 100644 --- a/backend/drm/atomic.c +++ b/backend/drm/atomic.c @@ -237,7 +237,7 @@ static uint32_t atomic_crtc_get_gamma_size(struct wlr_drm_backend *drm, return legacy_iface.crtc_get_gamma_size(drm, crtc); } - if (!wlr_drm_get_prop(drm->fd, crtc->id, crtc->props.gamma_lut_size, + if (!get_drm_prop(drm->fd, crtc->id, crtc->props.gamma_lut_size, &gamma_lut_size)) { wlr_log(L_ERROR, "Unable to get gamma lut size"); return 0; diff --git a/backend/drm/backend.c b/backend/drm/backend.c index 66cb89d3..c14b99e3 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -15,20 +15,20 @@ #include "backend/drm/drm.h" #include "util/signal.h" -static bool wlr_drm_backend_start(struct wlr_backend *backend) { +static bool backend_start(struct wlr_backend *backend) { struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend; - wlr_drm_scan_connectors(drm); + scan_drm_connectors(drm); return true; } -static void wlr_drm_backend_destroy(struct wlr_backend *backend) { +static void backend_destroy(struct wlr_backend *backend) { if (!backend) { return; } struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend; - wlr_drm_restore_outputs(drm); + restore_drm_outputs(drm); struct wlr_drm_connector *conn, *next; wl_list_for_each_safe(conn, next, &drm->outputs, link) { @@ -41,23 +41,23 @@ static void wlr_drm_backend_destroy(struct wlr_backend *backend) { wl_list_remove(&drm->session_signal.link); wl_list_remove(&drm->drm_invalidated.link); - wlr_drm_resources_free(drm); - wlr_drm_renderer_finish(&drm->renderer); + finish_drm_resources(drm); + finish_drm_renderer(&drm->renderer); wlr_session_close_file(drm->session, drm->fd); wl_event_source_remove(drm->drm_event); free(drm); } -static struct wlr_renderer *wlr_drm_backend_get_renderer( +static struct wlr_renderer *backend_get_renderer( struct wlr_backend *backend) { struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend; return drm->renderer.wlr_rend; } static struct wlr_backend_impl backend_impl = { - .start = wlr_drm_backend_start, - .destroy = wlr_drm_backend_destroy, - .get_renderer = wlr_drm_backend_get_renderer, + .start = backend_start, + .destroy = backend_destroy, + .get_renderer = backend_get_renderer, }; bool wlr_backend_is_drm(struct wlr_backend *b) { @@ -71,14 +71,14 @@ static void session_signal(struct wl_listener *listener, void *data) { if (session->active) { wlr_log(L_INFO, "DRM fd resumed"); - wlr_drm_scan_connectors(drm); + scan_drm_connectors(drm); struct wlr_drm_connector *conn; wl_list_for_each(conn, &drm->outputs, link){ if (conn->output.enabled) { wlr_output_set_mode(&conn->output, conn->output.current_mode); } else { - wlr_drm_connector_enable(&conn->output, false); + enable_drm_connector(&conn->output, false); } if (!conn->crtc) { @@ -104,13 +104,13 @@ static void drm_invalidated(struct wl_listener *listener, void *data) { wlr_log(L_DEBUG, "%s invalidated", name); free(name); - wlr_drm_scan_connectors(drm); + scan_drm_connectors(drm); } static void handle_display_destroy(struct wl_listener *listener, void *data) { struct wlr_drm_backend *drm = wl_container_of(listener, drm, display_destroy); - wlr_drm_backend_destroy(&drm->backend); + backend_destroy(&drm->backend); } struct wlr_backend *wlr_drm_backend_create(struct wl_display *display, @@ -144,7 +144,7 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display, struct wl_event_loop *event_loop = wl_display_get_event_loop(display); drm->drm_event = wl_event_loop_add_fd(event_loop, drm->fd, - WL_EVENT_READABLE, wlr_drm_event, NULL); + WL_EVENT_READABLE, handle_drm_event, NULL); if (!drm->drm_event) { wlr_log(L_ERROR, "Failed to create DRM event source"); goto error_fd; @@ -153,15 +153,15 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display, drm->session_signal.notify = session_signal; wl_signal_add(&session->session_signal, &drm->session_signal); - if (!wlr_drm_check_features(drm)) { + if (!check_drm_features(drm)) { goto error_event; } - if (!wlr_drm_resources_init(drm)) { + if (!init_drm_resources(drm)) { goto error_event; } - if (!wlr_drm_renderer_init(drm, &drm->renderer)) { + if (!init_drm_renderer(drm, &drm->renderer)) { wlr_log(L_ERROR, "Failed to initialize renderer"); goto error_event; } diff --git a/backend/drm/drm.c b/backend/drm/drm.c index fcc435e6..dc512151 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -26,7 +26,7 @@ #include "backend/drm/util.h" #include "util/signal.h" -bool wlr_drm_check_features(struct wlr_drm_backend *drm) { +bool check_drm_features(struct wlr_drm_backend *drm) { if (drmSetClientCap(drm->fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1)) { wlr_log(L_ERROR, "DRM universal planes unsupported"); return false; @@ -87,8 +87,8 @@ static bool init_planes(struct wlr_drm_backend *drm) { p->possible_crtcs = plane->possible_crtcs; uint64_t type; - if (!wlr_drm_get_plane_props(drm->fd, p->id, &p->props) || - !wlr_drm_get_prop(drm->fd, p->id, p->props.type, &type)) { + if (!get_drm_plane_props(drm->fd, p->id, &p->props) || + !get_drm_prop(drm->fd, p->id, p->props.type, &type)) { drmModeFreePlane(plane); goto error_planes; } @@ -122,7 +122,7 @@ error_res: return false; } -bool wlr_drm_resources_init(struct wlr_drm_backend *drm) { +bool init_drm_resources(struct wlr_drm_backend *drm) { drmModeRes *res = drmModeGetResources(drm->fd); if (!res) { wlr_log_errno(L_ERROR, "Failed to get DRM resources"); @@ -142,7 +142,7 @@ bool wlr_drm_resources_init(struct wlr_drm_backend *drm) { struct wlr_drm_crtc *crtc = &drm->crtcs[i]; crtc->id = res->crtcs[i]; crtc->legacy_crtc = drmModeGetCrtc(drm->fd, crtc->id); - wlr_drm_get_crtc_props(drm->fd, crtc->id, &crtc->props); + get_drm_crtc_props(drm->fd, crtc->id, &crtc->props); } if (!init_planes(drm)) { @@ -160,7 +160,7 @@ error_res: return false; } -void wlr_drm_resources_free(struct wlr_drm_backend *drm) { +void finish_drm_resources(struct wlr_drm_backend *drm) { if (!drm) { return; } @@ -187,13 +187,13 @@ void wlr_drm_resources_free(struct wlr_drm_backend *drm) { free(drm->planes); } -static bool wlr_drm_connector_make_current(struct wlr_output *output, +static bool drm_connector_make_current(struct wlr_output *output, int *buffer_age) { struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; - return wlr_drm_surface_make_current(&conn->crtc->primary->surf, buffer_age); + return make_drm_surface_current(&conn->crtc->primary->surf, buffer_age); } -static bool wlr_drm_connector_swap_buffers(struct wlr_output *output, +static bool drm_connector_swap_buffers(struct wlr_output *output, pixman_region32_t *damage) { struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend; @@ -207,9 +207,9 @@ static bool wlr_drm_connector_swap_buffers(struct wlr_output *output, } struct wlr_drm_plane *plane = crtc->primary; - struct gbm_bo *bo = wlr_drm_surface_swap_buffers(&plane->surf, damage); + struct gbm_bo *bo = swap_drm_surface_buffers(&plane->surf, damage); if (drm->parent) { - bo = wlr_drm_surface_mgpu_copy(&plane->mgpu_surf, bo); + bo = copy_drm_surface_mgpu(&plane->mgpu_surf, bo); } uint32_t fb_id = get_fb_for_bo(bo); @@ -227,7 +227,7 @@ static bool wlr_drm_connector_swap_buffers(struct wlr_output *output, return true; } -static void wlr_drm_connector_set_gamma(struct wlr_output *output, +static void drm_connector_set_gamma(struct wlr_output *output, uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b) { struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend; @@ -242,7 +242,7 @@ static void wlr_drm_connector_set_gamma(struct wlr_output *output, } -static uint32_t wlr_drm_connector_get_gamma_size(struct wlr_output *output) { +static uint32_t drm_connector_get_gamma_size(struct wlr_output *output) { struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend; @@ -253,7 +253,7 @@ static uint32_t wlr_drm_connector_get_gamma_size(struct wlr_output *output) { return 0; } -void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn) { +static void drm_connector_start_renderer(struct wlr_drm_connector *conn) { if (conn->state != WLR_DRM_CONN_CONNECTED) { return; } @@ -265,7 +265,7 @@ void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn) { } struct wlr_drm_plane *plane = crtc->primary; - struct gbm_bo *bo = wlr_drm_surface_get_front( + struct gbm_bo *bo = get_drm_surface_front( drm->parent ? &plane->mgpu_surf : &plane->surf); uint32_t fb_id = get_fb_for_bo(bo); @@ -279,7 +279,7 @@ void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn) { } } -void wlr_drm_connector_enable(struct wlr_output *output, bool enable) { +void enable_drm_connector(struct wlr_output *output, bool enable) { struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; if (conn->state != WLR_DRM_CONN_CONNECTED) { return; @@ -292,7 +292,7 @@ void wlr_drm_connector_enable(struct wlr_output *output, bool enable) { } if (enable) { - wlr_drm_connector_start_renderer(conn); + drm_connector_start_renderer(conn); } wlr_output_update_enabled(&conn->output, enable); @@ -340,9 +340,9 @@ static void realloc_planes(struct wlr_drm_backend *drm, const uint32_t *crtc_in, if (*old != new) { changed_outputs[crtc_res[i]] = true; if (*old) { - wlr_drm_surface_finish(&(*old)->surf); + finish_drm_surface(&(*old)->surf); } - wlr_drm_surface_finish(&new->surf); + finish_drm_surface(&new->surf); *old = new; } } @@ -461,7 +461,9 @@ error_conn: return 0; } -static bool wlr_drm_connector_set_mode(struct wlr_output *output, +static void drm_connector_cleanup(struct wlr_drm_connector *conn); + +static bool drm_connector_set_mode(struct wlr_output *output, struct wlr_output_mode *mode) { struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend; @@ -513,28 +515,28 @@ static bool wlr_drm_connector_set_mode(struct wlr_output *output, continue; } - if (!wlr_drm_plane_surfaces_init(crtc->primary, drm, + if (!init_drm_plane_surfaces(crtc->primary, drm, mode->width, mode->height, GBM_FORMAT_XRGB8888)) { wlr_log(L_ERROR, "Failed to initialize renderer for plane"); goto error_conn; } - wlr_drm_connector_start_renderer(conn); + drm_connector_start_renderer(conn); } return true; error_conn: - wlr_drm_connector_cleanup(conn); + drm_connector_cleanup(conn); return false; } -static void wlr_drm_connector_transform(struct wlr_output *output, +static void drm_connector_transform(struct wlr_output *output, enum wl_output_transform transform) { output->transform = transform; } -static bool wlr_drm_connector_set_cursor(struct wlr_output *output, +static bool drm_connector_set_cursor(struct wlr_output *output, const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height, int32_t hotspot_x, int32_t hotspot_y, bool update_pixels) { struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; @@ -570,7 +572,7 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output, return false; } - if (!wlr_drm_surface_init(&plane->surf, renderer, w, h, + if (!init_drm_surface(&plane->surf, renderer, w, h, GBM_FORMAT_ARGB8888, 0)) { wlr_log(L_ERROR, "Cannot allocate cursor resources"); return false; @@ -629,7 +631,7 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output, return false; } - wlr_drm_surface_make_current(&plane->surf, NULL); + make_drm_surface_current(&plane->surf, NULL); struct wlr_renderer *rend = plane->surf.renderer->wlr_rend; @@ -648,7 +650,7 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output, wlr_renderer_read_pixels(rend, WL_SHM_FORMAT_ARGB8888, bo_stride, plane->surf.width, plane->surf.height, 0, 0, 0, 0, bo_data); - wlr_drm_surface_swap_buffers(&plane->surf, NULL); + swap_drm_surface_buffers(&plane->surf, NULL); wlr_texture_destroy(texture); gbm_bo_unmap(plane->cursor_bo, bo_data); @@ -666,7 +668,7 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output, return ok; } -static bool wlr_drm_connector_move_cursor(struct wlr_output *output, +static bool drm_connector_move_cursor(struct wlr_output *output, int x, int y) { struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; struct wlr_drm_backend *drm = (struct wlr_drm_backend *)output->backend; @@ -703,25 +705,25 @@ static bool wlr_drm_connector_move_cursor(struct wlr_output *output, return ok; } -static void wlr_drm_connector_destroy(struct wlr_output *output) { +static void drm_connector_destroy(struct wlr_output *output) { struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output; - wlr_drm_connector_cleanup(conn); + drm_connector_cleanup(conn); wl_event_source_remove(conn->retry_pageflip); wl_list_remove(&conn->link); free(conn); } -static struct wlr_output_impl output_impl = { - .enable = wlr_drm_connector_enable, - .set_mode = wlr_drm_connector_set_mode, - .transform = wlr_drm_connector_transform, - .set_cursor = wlr_drm_connector_set_cursor, - .move_cursor = wlr_drm_connector_move_cursor, - .destroy = wlr_drm_connector_destroy, - .make_current = wlr_drm_connector_make_current, - .swap_buffers = wlr_drm_connector_swap_buffers, - .set_gamma = wlr_drm_connector_set_gamma, - .get_gamma_size = wlr_drm_connector_get_gamma_size, +static const struct wlr_output_impl output_impl = { + .enable = enable_drm_connector, + .set_mode = drm_connector_set_mode, + .transform = drm_connector_transform, + .set_cursor = drm_connector_set_cursor, + .move_cursor = drm_connector_move_cursor, + .destroy = drm_connector_destroy, + .make_current = drm_connector_make_current, + .swap_buffers = drm_connector_swap_buffers, + .set_gamma = drm_connector_set_gamma, + .get_gamma_size = drm_connector_get_gamma_size, }; bool wlr_output_is_drm(struct wlr_output *output) { @@ -731,7 +733,7 @@ bool wlr_output_is_drm(struct wlr_output *output) { static int retry_pageflip(void *data) { struct wlr_drm_connector *conn = data; wlr_log(L_INFO, "%s: Retrying pageflip", conn->output.name); - wlr_drm_connector_start_renderer(conn); + drm_connector_start_renderer(conn); return 0; } @@ -744,7 +746,7 @@ static const int32_t subpixel_map[] = { [DRM_MODE_SUBPIXEL_NONE] = WL_OUTPUT_SUBPIXEL_NONE, }; -void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) { +void scan_drm_connectors(struct wlr_drm_backend *drm) { wlr_log(L_INFO, "Scanning DRM connectors"); drmModeRes *res = drmModeGetResources(drm->fd); @@ -834,10 +836,10 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) { wlr_conn->output.phys_width, wlr_conn->output.phys_height); wlr_conn->output.subpixel = subpixel_map[drm_conn->subpixel]; - wlr_drm_get_connector_props(drm->fd, wlr_conn->id, &wlr_conn->props); + get_drm_connector_props(drm->fd, wlr_conn->id, &wlr_conn->props); size_t edid_len = 0; - uint8_t *edid = wlr_drm_get_prop_blob(drm->fd, + uint8_t *edid = get_drm_prop_blob(drm->fd, wlr_conn->id, wlr_conn->props.edid, &edid_len); parse_edid(&wlr_conn->output, edid_len, edid); free(edid); @@ -874,7 +876,7 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) { wlr_log(L_INFO, "'%s' disconnected", wlr_conn->output.name); wlr_output_update_enabled(&wlr_conn->output, false); - wlr_drm_connector_cleanup(wlr_conn); + drm_connector_cleanup(wlr_conn); } drmModeFreeEncoder(curr_enc); @@ -892,7 +894,7 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) { } wlr_log(L_INFO, "'%s' disappeared", conn->output.name); - wlr_drm_connector_cleanup(conn); + drm_connector_cleanup(conn); drmModeFreeCrtc(conn->old_crtc); wl_event_source_remove(conn->retry_pageflip); @@ -911,9 +913,9 @@ static void page_flip_handler(int fd, unsigned seq, return; } - wlr_drm_surface_post(&conn->crtc->primary->surf); + post_drm_surface(&conn->crtc->primary->surf); if (drm->parent) { - wlr_drm_surface_post(&conn->crtc->primary->mgpu_surf); + post_drm_surface(&conn->crtc->primary->mgpu_surf); } if (drm->session->active) { @@ -921,7 +923,7 @@ static void page_flip_handler(int fd, unsigned seq, } } -int wlr_drm_event(int fd, uint32_t mask, void *data) { +int handle_drm_event(int fd, uint32_t mask, void *data) { drmEventContext event = { .version = DRM_EVENT_CONTEXT_VERSION, .page_flip_handler = page_flip_handler, @@ -931,7 +933,7 @@ int wlr_drm_event(int fd, uint32_t mask, void *data) { return 1; } -void wlr_drm_restore_outputs(struct wlr_drm_backend *drm) { +void restore_drm_outputs(struct wlr_drm_backend *drm) { uint64_t to_close = (1 << wl_list_length(&drm->outputs)) - 1; struct wlr_drm_connector *conn; @@ -944,7 +946,7 @@ void wlr_drm_restore_outputs(struct wlr_drm_backend *drm) { time_t timeout = time(NULL) + 5; while (to_close && time(NULL) < timeout) { - wlr_drm_event(drm->fd, 0, NULL); + handle_drm_event(drm->fd, 0, NULL); size_t i = 0; struct wlr_drm_connector *conn; wl_list_for_each(conn, &drm->outputs, link) { @@ -971,7 +973,7 @@ void wlr_drm_restore_outputs(struct wlr_drm_backend *drm) { } } -void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn) { +static void drm_connector_cleanup(struct wlr_drm_connector *conn) { if (!conn) { return; } @@ -985,8 +987,8 @@ void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn) { continue; } - wlr_drm_surface_finish(&crtc->planes[i]->surf); - wlr_drm_surface_finish(&crtc->planes[i]->mgpu_surf); + finish_drm_surface(&crtc->planes[i]->surf); + finish_drm_surface(&crtc->planes[i]->mgpu_surf); if (crtc->planes[i]->id == 0) { free(crtc->planes[i]); crtc->planes[i] = NULL; diff --git a/backend/drm/properties.c b/backend/drm/properties.c index 3d35beb5..c16d4b3a 100644 --- a/backend/drm/properties.c +++ b/backend/drm/properties.c @@ -87,22 +87,22 @@ static bool scan_properties(int fd, uint32_t id, uint32_t type, uint32_t *result return true; } -bool wlr_drm_get_connector_props(int fd, uint32_t id, union wlr_drm_connector_props *out) { +bool get_drm_connector_props(int fd, uint32_t id, union wlr_drm_connector_props *out) { return scan_properties(fd, id, DRM_MODE_OBJECT_CONNECTOR, out->props, connector_info, sizeof(connector_info) / sizeof(connector_info[0])); } -bool wlr_drm_get_crtc_props(int fd, uint32_t id, union wlr_drm_crtc_props *out) { +bool get_drm_crtc_props(int fd, uint32_t id, union wlr_drm_crtc_props *out) { return scan_properties(fd, id, DRM_MODE_OBJECT_CRTC, out->props, crtc_info, sizeof(crtc_info) / sizeof(crtc_info[0])); } -bool wlr_drm_get_plane_props(int fd, uint32_t id, union wlr_drm_plane_props *out) { +bool get_drm_plane_props(int fd, uint32_t id, union wlr_drm_plane_props *out) { return scan_properties(fd, id, DRM_MODE_OBJECT_PLANE, out->props, plane_info, sizeof(plane_info) / sizeof(plane_info[0])); } -bool wlr_drm_get_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret) { +bool get_drm_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret) { drmModeObjectProperties *props = drmModeObjectGetProperties(fd, obj, DRM_MODE_OBJECT_ANY); if (!props) { return false; @@ -122,9 +122,9 @@ bool wlr_drm_get_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret) { return found; } -void *wlr_drm_get_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len) { +void *get_drm_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len) { uint64_t blob_id; - if (!wlr_drm_get_prop(fd, obj, prop, &blob_id)) { + if (!get_drm_prop(fd, obj, prop, &blob_id)) { return NULL; } diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c index ea46a5e9..7e2b5174 100644 --- a/backend/drm/renderer.c +++ b/backend/drm/renderer.c @@ -18,7 +18,7 @@ #define DRM_FORMAT_MOD_LINEAR 0 #endif -bool wlr_drm_renderer_init(struct wlr_drm_backend *drm, +bool init_drm_renderer(struct wlr_drm_backend *drm, struct wlr_drm_renderer *renderer) { renderer->gbm = gbm_create_device(drm->fd); if (!renderer->gbm) { @@ -47,7 +47,7 @@ error_gbm: return false; } -void wlr_drm_renderer_finish(struct wlr_drm_renderer *renderer) { +void finish_drm_renderer(struct wlr_drm_renderer *renderer) { if (!renderer) { return; } @@ -57,7 +57,7 @@ void wlr_drm_renderer_finish(struct wlr_drm_renderer *renderer) { gbm_device_destroy(renderer->gbm); } -bool wlr_drm_surface_init(struct wlr_drm_surface *surf, +bool init_drm_surface(struct wlr_drm_surface *surf, struct wlr_drm_renderer *renderer, uint32_t width, uint32_t height, uint32_t format, uint32_t flags) { if (surf->width == width && surf->height == height) { @@ -103,7 +103,7 @@ error_zero: return false; } -void wlr_drm_surface_finish(struct wlr_drm_surface *surf) { +void finish_drm_surface(struct wlr_drm_surface *surf) { if (!surf || !surf->renderer) { return; } @@ -123,12 +123,12 @@ void wlr_drm_surface_finish(struct wlr_drm_surface *surf) { memset(surf, 0, sizeof(*surf)); } -bool wlr_drm_surface_make_current(struct wlr_drm_surface *surf, +bool make_drm_surface_current(struct wlr_drm_surface *surf, int *buffer_damage) { return wlr_egl_make_current(&surf->renderer->egl, surf->egl, buffer_damage); } -struct gbm_bo *wlr_drm_surface_swap_buffers(struct wlr_drm_surface *surf, +struct gbm_bo *swap_drm_surface_buffers(struct wlr_drm_surface *surf, pixman_region32_t *damage) { if (surf->front) { gbm_surface_release_buffer(surf->gbm, surf->front); @@ -141,20 +141,20 @@ struct gbm_bo *wlr_drm_surface_swap_buffers(struct wlr_drm_surface *surf, return surf->back; } -struct gbm_bo *wlr_drm_surface_get_front(struct wlr_drm_surface *surf) { +struct gbm_bo *get_drm_surface_front(struct wlr_drm_surface *surf) { if (surf->front) { return surf->front; } - wlr_drm_surface_make_current(surf, NULL); + make_drm_surface_current(surf, NULL); struct wlr_renderer *renderer = surf->renderer->wlr_rend; wlr_renderer_begin(renderer, surf->width, surf->height); wlr_renderer_clear(renderer, (float[]){ 0.0, 0.0, 0.0, 1.0 }); wlr_renderer_end(renderer); - return wlr_drm_surface_swap_buffers(surf, NULL); + return swap_drm_surface_buffers(surf, NULL); } -void wlr_drm_surface_post(struct wlr_drm_surface *surf) { +void post_drm_surface(struct wlr_drm_surface *surf) { if (surf->front) { gbm_surface_release_buffer(surf->gbm, surf->front); surf->front = NULL; @@ -208,9 +208,9 @@ static struct wlr_texture *get_tex_for_bo(struct wlr_drm_renderer *renderer, return tex->tex; } -struct gbm_bo *wlr_drm_surface_mgpu_copy(struct wlr_drm_surface *dest, +struct gbm_bo *copy_drm_surface_mgpu(struct wlr_drm_surface *dest, struct gbm_bo *src) { - wlr_drm_surface_make_current(dest, NULL); + make_drm_surface_current(dest, NULL); struct wlr_texture *tex = get_tex_for_bo(dest->renderer, src); assert(tex); @@ -224,25 +224,25 @@ struct gbm_bo *wlr_drm_surface_mgpu_copy(struct wlr_drm_surface *dest, wlr_render_texture_with_matrix(renderer, tex, mat, 1.0f); wlr_renderer_end(renderer); - return wlr_drm_surface_swap_buffers(dest, NULL); + return swap_drm_surface_buffers(dest, NULL); } -bool wlr_drm_plane_surfaces_init(struct wlr_drm_plane *plane, +bool init_drm_plane_surfaces(struct wlr_drm_plane *plane, struct wlr_drm_backend *drm, int32_t width, uint32_t height, uint32_t format) { if (!drm->parent) { - return wlr_drm_surface_init(&plane->surf, &drm->renderer, width, height, + return init_drm_surface(&plane->surf, &drm->renderer, width, height, format, GBM_BO_USE_SCANOUT); } - if (!wlr_drm_surface_init(&plane->surf, &drm->parent->renderer, + if (!init_drm_surface(&plane->surf, &drm->parent->renderer, width, height, format, GBM_BO_USE_LINEAR)) { return false; } - if (!wlr_drm_surface_init(&plane->mgpu_surf, &drm->renderer, + if (!init_drm_surface(&plane->mgpu_surf, &drm->renderer, width, height, format, GBM_BO_USE_SCANOUT)) { - wlr_drm_surface_finish(&plane->surf); + finish_drm_surface(&plane->surf); return false; } diff --git a/backend/libinput/backend.c b/backend/libinput/backend.c index ef33df0a..4fcd2fe4 100644 --- a/backend/libinput/backend.c +++ b/backend/libinput/backend.c @@ -7,23 +7,23 @@ #include "backend/libinput.h" #include "util/signal.h" -static int wlr_libinput_open_restricted(const char *path, +static int libinput_open_restricted(const char *path, int flags, void *_backend) { struct wlr_libinput_backend *backend = _backend; return wlr_session_open_file(backend->session, path); } -static void wlr_libinput_close_restricted(int fd, void *_backend) { +static void libinput_close_restricted(int fd, void *_backend) { struct wlr_libinput_backend *backend = _backend; wlr_session_close_file(backend->session, fd); } static const struct libinput_interface libinput_impl = { - .open_restricted = wlr_libinput_open_restricted, - .close_restricted = wlr_libinput_close_restricted + .open_restricted = libinput_open_restricted, + .close_restricted = libinput_close_restricted }; -static int wlr_libinput_readable(int fd, uint32_t mask, void *_backend) { +static int handle_libinput_readable(int fd, uint32_t mask, void *_backend) { struct wlr_libinput_backend *backend = _backend; if (libinput_dispatch(backend->libinput_context) != 0) { wlr_log(L_ERROR, "Failed to dispatch libinput"); @@ -32,18 +32,18 @@ static int wlr_libinput_readable(int fd, uint32_t mask, void *_backend) { } struct libinput_event *event; while ((event = libinput_get_event(backend->libinput_context))) { - wlr_libinput_event(backend, event); + handle_libinput_event(backend, event); libinput_event_destroy(event); } return 0; } -static void wlr_libinput_log(struct libinput *libinput_context, +static void log_libinput(struct libinput *libinput_context, enum libinput_log_priority priority, const char *fmt, va_list args) { _wlr_vlog(L_ERROR, fmt, args); } -static bool wlr_libinput_backend_start(struct wlr_backend *_backend) { +static bool backend_start(struct wlr_backend *_backend) { struct wlr_libinput_backend *backend = (struct wlr_libinput_backend *)_backend; wlr_log(L_DEBUG, "Initializing libinput"); @@ -62,7 +62,7 @@ static bool wlr_libinput_backend_start(struct wlr_backend *_backend) { } // TODO: More sophisticated logging - libinput_log_set_handler(backend->libinput_context, wlr_libinput_log); + libinput_log_set_handler(backend->libinput_context, log_libinput); libinput_log_set_priority(backend->libinput_context, LIBINPUT_LOG_PRIORITY_ERROR); int libinput_fd = libinput_get_fd(backend->libinput_context); @@ -73,7 +73,7 @@ static bool wlr_libinput_backend_start(struct wlr_backend *_backend) { } } if (!no_devs && backend->wlr_device_lists.length == 0) { - wlr_libinput_readable(libinput_fd, WL_EVENT_READABLE, backend); + handle_libinput_readable(libinput_fd, WL_EVENT_READABLE, backend); if (backend->wlr_device_lists.length == 0) { wlr_log(L_ERROR, "libinput initialization failed, no input devices"); wlr_log(L_ERROR, "Set WLR_LIBINPUT_NO_DEVICES=1 to suppress this check"); @@ -87,7 +87,7 @@ static bool wlr_libinput_backend_start(struct wlr_backend *_backend) { wl_event_source_remove(backend->input_event); } backend->input_event = wl_event_loop_add_fd(event_loop, libinput_fd, - WL_EVENT_READABLE, wlr_libinput_readable, backend); + WL_EVENT_READABLE, handle_libinput_readable, backend); if (!backend->input_event) { wlr_log(L_ERROR, "Failed to create input event on event loop"); return false; @@ -96,7 +96,7 @@ static bool wlr_libinput_backend_start(struct wlr_backend *_backend) { return true; } -static void wlr_libinput_backend_destroy(struct wlr_backend *wlr_backend) { +static void backend_destroy(struct wlr_backend *wlr_backend) { if (!wlr_backend) { return; } @@ -125,9 +125,9 @@ static void wlr_libinput_backend_destroy(struct wlr_backend *wlr_backend) { free(backend); } -static struct wlr_backend_impl backend_impl = { - .start = wlr_libinput_backend_start, - .destroy = wlr_libinput_backend_destroy +static const struct wlr_backend_impl backend_impl = { + .start = backend_start, + .destroy = backend_destroy, }; bool wlr_backend_is_libinput(struct wlr_backend *b) { @@ -153,7 +153,7 @@ static void session_signal(struct wl_listener *listener, void *data) { static void handle_display_destroy(struct wl_listener *listener, void *data) { struct wlr_libinput_backend *backend = wl_container_of(listener, backend, display_destroy); - wlr_libinput_backend_destroy(&backend->backend); + backend_destroy(&backend->backend); } struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display, diff --git a/backend/libinput/events.c b/backend/libinput/events.c index da7b2be4..ace21a89 100644 --- a/backend/libinput/events.c +++ b/backend/libinput/events.c @@ -24,7 +24,7 @@ struct wlr_input_device *get_appropriate_device( return NULL; } -static void wlr_libinput_device_destroy(struct wlr_input_device *_dev) { +static void input_device_destroy(struct wlr_input_device *_dev) { struct wlr_libinput_input_device *dev = (struct wlr_libinput_input_device *)_dev; libinput_device_unref(dev->handle); wl_list_remove(&dev->wlr_input_device.link); @@ -32,7 +32,7 @@ static void wlr_libinput_device_destroy(struct wlr_input_device *_dev) { } static const struct wlr_input_device_impl input_device_impl = { - .destroy = wlr_libinput_device_destroy + .destroy = input_device_destroy, }; static struct wlr_input_device *allocate_device( @@ -86,7 +86,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, if (!wlr_dev) { goto fail; } - wlr_dev->keyboard = wlr_libinput_keyboard_create(libinput_dev); + wlr_dev->keyboard = create_libinput_keyboard(libinput_dev); if (!wlr_dev->keyboard) { free(wlr_dev); goto fail; @@ -99,7 +99,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, if (!wlr_dev) { goto fail; } - wlr_dev->pointer = wlr_libinput_pointer_create(libinput_dev); + wlr_dev->pointer = create_libinput_pointer(libinput_dev); if (!wlr_dev->pointer) { free(wlr_dev); goto fail; @@ -112,7 +112,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, if (!wlr_dev) { goto fail; } - wlr_dev->touch = wlr_libinput_touch_create(libinput_dev); + wlr_dev->touch = create_libinput_touch(libinput_dev); if (!wlr_dev->touch) { free(wlr_dev); goto fail; @@ -125,7 +125,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, if (!wlr_dev) { goto fail; } - wlr_dev->tablet_tool = wlr_libinput_tablet_tool_create(libinput_dev); + wlr_dev->tablet_tool = create_libinput_tablet_tool(libinput_dev); if (!wlr_dev->tablet_tool) { free(wlr_dev); goto fail; @@ -138,7 +138,7 @@ static void handle_device_added(struct wlr_libinput_backend *backend, if (!wlr_dev) { goto fail; } - wlr_dev->tablet_pad = wlr_libinput_tablet_pad_create(libinput_dev); + wlr_dev->tablet_pad = create_libinput_tablet_pad(libinput_dev); if (!wlr_dev->tablet_pad) { free(wlr_dev); goto fail; @@ -192,7 +192,7 @@ static void handle_device_removed(struct wlr_libinput_backend *backend, free(wlr_devices); } -void wlr_libinput_event(struct wlr_libinput_backend *backend, +void handle_libinput_event(struct wlr_libinput_backend *backend, struct libinput_event *event) { assert(backend && event); struct libinput_device *libinput_dev = libinput_event_get_device(event); diff --git a/backend/libinput/keyboard.c b/backend/libinput/keyboard.c index b44bc892..d8dd8878 100644 --- a/backend/libinput/keyboard.c +++ b/backend/libinput/keyboard.c @@ -12,23 +12,23 @@ struct wlr_libinput_keyboard { struct libinput_device *libinput_dev; }; -static void wlr_libinput_keyboard_set_leds(struct wlr_keyboard *wlr_kb, uint32_t leds) { +static void keyboard_set_leds(struct wlr_keyboard *wlr_kb, uint32_t leds) { struct wlr_libinput_keyboard *wlr_libinput_kb = (struct wlr_libinput_keyboard *)wlr_kb; libinput_device_led_update(wlr_libinput_kb->libinput_dev, leds); } -static void wlr_libinput_keyboard_destroy(struct wlr_keyboard *wlr_kb) { +static void keyboard_destroy(struct wlr_keyboard *wlr_kb) { struct wlr_libinput_keyboard *wlr_libinput_kb = (struct wlr_libinput_keyboard *)wlr_kb; libinput_device_unref(wlr_libinput_kb->libinput_dev); } struct wlr_keyboard_impl impl = { - .destroy = wlr_libinput_keyboard_destroy, - .led_update = wlr_libinput_keyboard_set_leds + .destroy = keyboard_destroy, + .led_update = keyboard_set_leds }; -struct wlr_keyboard *wlr_libinput_keyboard_create( +struct wlr_keyboard *create_libinput_keyboard( struct libinput_device *libinput_dev) { assert(libinput_dev); struct wlr_libinput_keyboard *wlr_libinput_kb; diff --git a/backend/libinput/pointer.c b/backend/libinput/pointer.c index 9ccda634..9a39b66b 100644 --- a/backend/libinput/pointer.c +++ b/backend/libinput/pointer.c @@ -8,7 +8,7 @@ #include "backend/libinput.h" #include "util/signal.h" -struct wlr_pointer *wlr_libinput_pointer_create( +struct wlr_pointer *create_libinput_pointer( struct libinput_device *libinput_dev) { assert(libinput_dev); struct wlr_pointer *wlr_pointer = calloc(1, sizeof(struct wlr_pointer)); diff --git a/backend/libinput/tablet_pad.c b/backend/libinput/tablet_pad.c index f71e1efa..aa8b26d9 100644 --- a/backend/libinput/tablet_pad.c +++ b/backend/libinput/tablet_pad.c @@ -8,7 +8,7 @@ #include "backend/libinput.h" #include "util/signal.h" -struct wlr_tablet_pad *wlr_libinput_tablet_pad_create( +struct wlr_tablet_pad *create_libinput_tablet_pad( struct libinput_device *libinput_dev) { assert(libinput_dev); struct wlr_tablet_pad *wlr_tablet_pad = calloc(1, sizeof(struct wlr_tablet_pad)); diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c index 815c4daf..b0bcfff5 100644 --- a/backend/libinput/tablet_tool.c +++ b/backend/libinput/tablet_tool.c @@ -8,7 +8,7 @@ #include "backend/libinput.h" #include "util/signal.h" -struct wlr_tablet_tool *wlr_libinput_tablet_tool_create( +struct wlr_tablet_tool *create_libinput_tablet_tool( struct libinput_device *libinput_dev) { assert(libinput_dev); struct wlr_tablet_tool *wlr_tablet_tool = calloc(1, sizeof(struct wlr_tablet_tool)); diff --git a/backend/libinput/touch.c b/backend/libinput/touch.c index 419c11ea..d79b2a97 100644 --- a/backend/libinput/touch.c +++ b/backend/libinput/touch.c @@ -8,7 +8,7 @@ #include "backend/libinput.h" #include "util/signal.h" -struct wlr_touch *wlr_libinput_touch_create( +struct wlr_touch *create_libinput_touch( struct libinput_device *libinput_dev) { assert(libinput_dev); struct wlr_touch *wlr_touch = calloc(1, sizeof(struct wlr_touch)); diff --git a/backend/multi/backend.c b/backend/multi/backend.c index 50563892..b70d7003 100644 --- a/backend/multi/backend.c +++ b/backend/multi/backend.c @@ -1,10 +1,10 @@ #include <assert.h> #include <stdbool.h> #include <stdlib.h> +#include <wlr/backend/drm.h> #include <wlr/backend/interface.h> #include <wlr/backend/session.h> #include <wlr/util/log.h> -#include "backend/drm/drm.h" #include "backend/multi.h" #include "util/signal.h" diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c index 4bcb9360..03e56e22 100644 --- a/backend/wayland/backend.c +++ b/backend/wayland/backend.c @@ -39,11 +39,11 @@ static int dispatch_events(int fd, uint32_t mask, void *data) { * compositor and creates surfaces for each output, then registers globals on * the specified display. */ -static bool wlr_wl_backend_start(struct wlr_backend *_backend) { +static bool backend_start(struct wlr_backend *_backend) { struct wlr_wl_backend *backend = (struct wlr_wl_backend *)_backend; wlr_log(L_INFO, "Initializating wayland backend"); - wlr_wl_registry_poll(backend); + poll_wl_registry(backend); if (!backend->compositor || !backend->shell) { wlr_log_errno(L_ERROR, "Could not obtain retrieve required globals"); return false; @@ -65,7 +65,7 @@ static bool wlr_wl_backend_start(struct wlr_backend *_backend) { return true; } -static void wlr_wl_backend_destroy(struct wlr_backend *wlr_backend) { +static void backend_destroy(struct wlr_backend *wlr_backend) { struct wlr_wl_backend *backend = (struct wlr_wl_backend *)wlr_backend; if (backend == NULL) { return; @@ -110,23 +110,23 @@ static void wlr_wl_backend_destroy(struct wlr_backend *wlr_backend) { free(backend); } -static struct wlr_renderer *wlr_wl_backend_get_renderer( +static struct wlr_renderer *backend_get_renderer( struct wlr_backend *wlr_backend) { struct wlr_wl_backend *backend = (struct wlr_wl_backend *)wlr_backend; return backend->renderer; } static struct wlr_backend_impl backend_impl = { - .start = wlr_wl_backend_start, - .destroy = wlr_wl_backend_destroy, - .get_renderer = wlr_wl_backend_get_renderer, + .start = backend_start, + .destroy = backend_destroy, + .get_renderer = backend_get_renderer, }; bool wlr_backend_is_wl(struct wlr_backend *b) { return b->impl == &backend_impl; } -struct wlr_wl_backend_output *wlr_wl_output_for_surface( +struct wlr_wl_backend_output *get_wl_output_for_surface( struct wlr_wl_backend *backend, struct wl_surface *surface) { struct wlr_wl_backend_output *output; wl_list_for_each(output, &backend->outputs, link) { @@ -137,7 +137,7 @@ struct wlr_wl_backend_output *wlr_wl_output_for_surface( return NULL; } -void wlr_wl_output_layout_get_box(struct wlr_wl_backend *backend, +void get_wl_output_layout_box(struct wlr_wl_backend *backend, struct wlr_box *box) { int min_x = INT_MAX, min_y = INT_MAX; int max_x = INT_MIN, max_y = INT_MIN; @@ -172,7 +172,7 @@ void wlr_wl_output_layout_get_box(struct wlr_wl_backend *backend, static void handle_display_destroy(struct wl_listener *listener, void *data) { struct wlr_wl_backend *backend = wl_container_of(listener, backend, local_display_destroy); - wlr_wl_backend_destroy(&backend->backend); + backend_destroy(&backend->backend); } struct wlr_backend *wlr_wl_backend_create(struct wl_display *display, const char *remote) { diff --git a/backend/wayland/output.c b/backend/wayland/output.c index 9391f07f..a49070e8 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -32,7 +32,7 @@ static struct wl_callback_listener frame_listener = { .done = surface_frame_callback }; -static bool wlr_wl_output_set_custom_mode(struct wlr_output *_output, +static bool output_set_custom_mode(struct wlr_output *_output, int32_t width, int32_t height, int32_t refresh) { struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output; wl_egl_window_resize(output->egl_window, width, height, 0, 0); @@ -40,7 +40,7 @@ static bool wlr_wl_output_set_custom_mode(struct wlr_output *_output, return true; } -static bool wlr_wl_output_make_current(struct wlr_output *wlr_output, +static bool output_make_current(struct wlr_output *wlr_output, int *buffer_age) { struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)wlr_output; @@ -48,7 +48,7 @@ static bool wlr_wl_output_make_current(struct wlr_output *wlr_output, buffer_age); } -static bool wlr_wl_output_swap_buffers(struct wlr_output *wlr_output, +static bool output_swap_buffers(struct wlr_output *wlr_output, pixman_region32_t *damage) { struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)wlr_output; @@ -65,13 +65,13 @@ static bool wlr_wl_output_swap_buffers(struct wlr_output *wlr_output, damage); } -static void wlr_wl_output_transform(struct wlr_output *_output, +static void output_transform(struct wlr_output *_output, enum wl_output_transform transform) { struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output; output->wlr_output.transform = transform; } -static bool wlr_wl_output_set_cursor(struct wlr_output *_output, +static bool output_set_cursor(struct wlr_output *_output, const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height, int32_t hotspot_x, int32_t hotspot_y, bool update_pixels) { struct wlr_wl_backend_output *output = @@ -84,7 +84,7 @@ static bool wlr_wl_output_set_cursor(struct wlr_output *_output, if (!update_pixels) { // Update hotspot without changing cursor image - wlr_wl_output_update_cursor(output); + update_wl_output_cursor(output); return true; } if (!buf) { @@ -95,7 +95,7 @@ static bool wlr_wl_output_set_cursor(struct wlr_output *_output, output->cursor.surface = NULL; output->cursor.buf_size = 0; } - wlr_wl_output_update_cursor(output); + update_wl_output_cursor(output); return true; } @@ -153,11 +153,11 @@ static bool wlr_wl_output_set_cursor(struct wlr_output *_output, wl_surface_damage(output->cursor.surface, 0, 0, width, height); wl_surface_commit(output->cursor.surface); - wlr_wl_output_update_cursor(output); + update_wl_output_cursor(output); return true; } -static void wlr_wl_output_destroy(struct wlr_output *wlr_output) { +static void output_destroy(struct wlr_output *wlr_output) { struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)wlr_output; if (output == NULL) { @@ -192,7 +192,7 @@ static void wlr_wl_output_destroy(struct wlr_output *wlr_output) { free(output); } -void wlr_wl_output_update_cursor(struct wlr_wl_backend_output *output) { +void update_wl_output_cursor(struct wlr_wl_backend_output *output) { if (output->backend->pointer && output->enter_serial) { wl_pointer_set_cursor(output->backend->pointer, output->enter_serial, output->cursor.surface, output->cursor.hotspot_x, @@ -200,19 +200,19 @@ void wlr_wl_output_update_cursor(struct wlr_wl_backend_output *output) { } } -bool wlr_wl_output_move_cursor(struct wlr_output *_output, int x, int y) { +bool output_move_cursor(struct wlr_output *_output, int x, int y) { // TODO: only return true if x == current x and y == current y return true; } -static struct wlr_output_impl output_impl = { - .set_custom_mode = wlr_wl_output_set_custom_mode, - .transform = wlr_wl_output_transform, - .destroy = wlr_wl_output_destroy, - .make_current = wlr_wl_output_make_current, - .swap_buffers = wlr_wl_output_swap_buffers, - .set_cursor = wlr_wl_output_set_cursor, - .move_cursor = wlr_wl_output_move_cursor, +static const struct wlr_output_impl output_impl = { + .set_custom_mode = output_set_custom_mode, + .transform = output_transform, + .destroy = output_destroy, + .make_current = output_make_current, + .swap_buffers = output_swap_buffers, + .set_cursor = output_set_cursor, + .move_cursor = output_move_cursor, }; bool wlr_output_is_wl(struct wlr_output *wlr_output) { diff --git a/backend/wayland/registry.c b/backend/wayland/registry.c index 4aa39f09..0046df55 100644 --- a/backend/wayland/registry.c +++ b/backend/wayland/registry.c @@ -48,7 +48,7 @@ static const struct wl_registry_listener registry_listener = { .global_remove = registry_global_remove }; -void wlr_wl_registry_poll(struct wlr_wl_backend *backend) { +void poll_wl_registry(struct wlr_wl_backend *backend) { wl_registry_add_listener(backend->registry, ®istry_listener, backend); wl_display_dispatch(backend->remote_display); wl_display_roundtrip(backend->remote_display); diff --git a/backend/wayland/wl_seat.c b/backend/wayland/wl_seat.c index c6982fce..03f1c727 100644 --- a/backend/wayland/wl_seat.c +++ b/backend/wayland/wl_seat.c @@ -21,7 +21,7 @@ static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer, assert(dev && dev->pointer); struct wlr_wl_pointer *wlr_wl_pointer = (struct wlr_wl_pointer *)dev->pointer; struct wlr_wl_backend_output *output = - wlr_wl_output_for_surface(wlr_wl_dev->backend, surface); + get_wl_output_for_surface(wlr_wl_dev->backend, surface); if (!output) { // GNOME sends a pointer enter when the surface is being destroyed return; @@ -33,7 +33,7 @@ static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer, &wlr_wl_pointer->output_destroy_listener); wlr_wl_pointer->current_output = output; output->enter_serial = serial; - wlr_wl_output_update_cursor(output); + update_wl_output_cursor(output); } static void pointer_handle_leave(void *data, struct wl_pointer *wl_pointer, @@ -70,7 +70,7 @@ static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer, box.y /= wlr_output->scale; struct wlr_box layout_box; - wlr_wl_output_layout_get_box(wlr_wl_pointer->current_output->backend, + get_wl_output_layout_box(wlr_wl_pointer->current_output->backend, &layout_box); double ox = wlr_output->lx / (double)layout_box.width; @@ -235,7 +235,7 @@ static struct wlr_input_device *allocate_device(struct wlr_wl_backend *backend, return wlr_device; } -static void wlr_wl_pointer_handle_output_destroy(struct wl_listener *listener, +static void pointer_handle_output_destroy(struct wl_listener *listener, void *data) { struct wlr_wl_pointer *wlr_wl_pointer = wl_container_of(listener, wlr_wl_pointer, output_destroy_listener); @@ -256,7 +256,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat, return; } wlr_wl_pointer->output_destroy_listener.notify = - wlr_wl_pointer_handle_output_destroy; + pointer_handle_output_destroy; struct wlr_input_device *wlr_device; if (!(wlr_device = allocate_device(backend, WLR_INPUT_DEVICE_POINTER))) { diff --git a/backend/x11/backend.c b/backend/x11/backend.c index b4b0f154..4a615e67 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -22,7 +22,7 @@ #include "backend/x11.h" #include "util/signal.h" -struct wlr_x11_output *x11_output_from_window_id(struct wlr_x11_backend *x11, +struct wlr_x11_output *get_x11_output_from_window_id(struct wlr_x11_backend *x11, xcb_window_t window) { struct wlr_x11_output *output; wl_list_for_each(output, &x11->outputs, link) { @@ -33,7 +33,7 @@ struct wlr_x11_output *x11_output_from_window_id(struct wlr_x11_backend *x11, return NULL; } -void x11_output_layout_get_box(struct wlr_x11_backend *backend, +void get_x11_output_layout_box(struct wlr_x11_backend *backend, struct wlr_box *box) { int min_x = INT_MAX, min_y = INT_MAX; int max_x = INT_MIN, max_y = INT_MIN; @@ -67,13 +67,13 @@ void x11_output_layout_get_box(struct wlr_x11_backend *backend, static void handle_x11_event(struct wlr_x11_backend *x11, xcb_generic_event_t *event) { - x11_handle_input_event(x11, event); + handle_x11_input_event(x11, event); switch (event->response_type & XCB_EVENT_RESPONSE_TYPE_MASK) { case XCB_EXPOSE: { xcb_expose_event_t *ev = (xcb_expose_event_t *)event; struct wlr_x11_output *output = - x11_output_from_window_id(x11, ev->window); + get_x11_output_from_window_id(x11, ev->window); if (output != NULL) { wlr_output_update_needs_swap(&output->wlr_output); } @@ -83,9 +83,9 @@ static void handle_x11_event(struct wlr_x11_backend *x11, xcb_configure_notify_event_t *ev = (xcb_configure_notify_event_t *)event; struct wlr_x11_output *output = - x11_output_from_window_id(x11, ev->window); + get_x11_output_from_window_id(x11, ev->window); if (output != NULL) { - x11_output_handle_configure_notify(output, ev); + handle_x11_configure_notify(output, ev); } break; } @@ -93,7 +93,7 @@ static void handle_x11_event(struct wlr_x11_backend *x11, xcb_client_message_event_t *ev = (xcb_client_message_event_t *)event; if (ev->data.data32[0] == x11->atoms.wm_delete_window) { struct wlr_x11_output *output = - x11_output_from_window_id(x11, ev->window); + get_x11_output_from_window_id(x11, ev->window); if (output != NULL) { wlr_output_destroy(&output->wlr_output); } @@ -120,7 +120,7 @@ static int x11_event(int fd, uint32_t mask, void *data) { return 0; } -static bool wlr_x11_backend_start(struct wlr_backend *backend) { +static bool backend_start(struct wlr_backend *backend) { struct wlr_x11_backend *x11 = (struct wlr_x11_backend *)backend; x11->started = true; @@ -209,7 +209,7 @@ static bool wlr_x11_backend_start(struct wlr_backend *backend) { return true; } -static void wlr_x11_backend_destroy(struct wlr_backend *backend) { +static void backend_destroy(struct wlr_backend *backend) { if (!backend) { return; } @@ -250,16 +250,16 @@ static void wlr_x11_backend_destroy(struct wlr_backend *backend) { free(x11); } -static struct wlr_renderer *wlr_x11_backend_get_renderer( +static struct wlr_renderer *backend_get_renderer( struct wlr_backend *backend) { struct wlr_x11_backend *x11 = (struct wlr_x11_backend *)backend; return x11->renderer; } static const struct wlr_backend_impl backend_impl = { - .start = wlr_x11_backend_start, - .destroy = wlr_x11_backend_destroy, - .get_renderer = wlr_x11_backend_get_renderer, + .start = backend_start, + .destroy = backend_destroy, + .get_renderer = backend_get_renderer, }; bool wlr_backend_is_x11(struct wlr_backend *backend) { @@ -269,7 +269,7 @@ bool wlr_backend_is_x11(struct wlr_backend *backend) { static void handle_display_destroy(struct wl_listener *listener, void *data) { struct wlr_x11_backend *x11 = wl_container_of(listener, x11, display_destroy); - wlr_x11_backend_destroy(&x11->backend); + backend_destroy(&x11->backend); } struct wlr_backend *wlr_x11_backend_create(struct wl_display *display, diff --git a/backend/x11/input_device.c b/backend/x11/input_device.c index 4433568d..5de5b4c2 100644 --- a/backend/x11/input_device.c +++ b/backend/x11/input_device.c @@ -40,7 +40,7 @@ static void x11_handle_pointer_position(struct wlr_x11_output *output, box.y /= wlr_output->scale; struct wlr_box layout_box; - x11_output_layout_get_box(x11, &layout_box); + get_x11_output_layout_box(x11, &layout_box); double ox = wlr_output->lx / (double)layout_box.width; double oy = wlr_output->ly / (double)layout_box.height; @@ -56,7 +56,7 @@ static void x11_handle_pointer_position(struct wlr_x11_output *output, x11->time = time; } -void x11_handle_input_event(struct wlr_x11_backend *x11, +void handle_x11_input_event(struct wlr_x11_backend *x11, xcb_generic_event_t *event) { switch (event->response_type & XCB_EVENT_RESPONSE_TYPE_MASK) { case XCB_KEY_PRESS: @@ -116,7 +116,7 @@ void x11_handle_input_event(struct wlr_x11_backend *x11, xcb_motion_notify_event_t *ev = (xcb_motion_notify_event_t *)event; struct wlr_x11_output *output = - x11_output_from_window_id(x11, ev->event); + get_x11_output_from_window_id(x11, ev->event); if (output != NULL) { x11_handle_pointer_position(output, ev->event_x, ev->event_y, ev->time); } @@ -138,7 +138,7 @@ void x11_handle_input_event(struct wlr_x11_backend *x11, const struct wlr_input_device_impl input_device_impl = { 0 }; -void x11_update_pointer_position(struct wlr_x11_output *output, +void update_x11_pointer_position(struct wlr_x11_output *output, xcb_timestamp_t time) { struct wlr_x11_backend *x11 = output->x11; diff --git a/backend/x11/output.c b/backend/x11/output.c index 77b4fb07..1f61c5e9 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -164,13 +164,13 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) { return wlr_output; } -void x11_output_handle_configure_notify(struct wlr_x11_output *output, +void handle_x11_configure_notify(struct wlr_x11_output *output, xcb_configure_notify_event_t *ev) { wlr_output_update_custom_mode(&output->wlr_output, ev->width, ev->height, output->wlr_output.refresh); // Move the pointer to its new location - x11_update_pointer_position(output, output->x11->time); + update_x11_pointer_position(output, output->x11->time); } bool wlr_output_is_x11(struct wlr_output *wlr_output) { |