aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md11
-rw-r--r--backend/drm/atomic.c2
-rw-r--r--backend/drm/backend.c36
-rw-r--r--backend/drm/drm.c114
-rw-r--r--backend/drm/properties.c12
-rw-r--r--backend/drm/renderer.c44
-rw-r--r--backend/headless/backend.c1
-rw-r--r--backend/headless/output.c6
-rw-r--r--backend/libinput/backend.c32
-rw-r--r--backend/libinput/events.c16
-rw-r--r--backend/libinput/keyboard.c10
-rw-r--r--backend/libinput/pointer.c2
-rw-r--r--backend/libinput/tablet_pad.c2
-rw-r--r--backend/libinput/tablet_tool.c2
-rw-r--r--backend/libinput/touch.c2
-rw-r--r--backend/multi/backend.c2
-rw-r--r--backend/wayland/backend.c21
-rw-r--r--backend/wayland/output.c40
-rw-r--r--backend/wayland/registry.c2
-rw-r--r--backend/wayland/wl_seat.c10
-rw-r--r--backend/x11/backend.c29
-rw-r--r--backend/x11/input_device.c8
-rw-r--r--backend/x11/output.c6
-rw-r--r--examples/layer-shell.c7
-rw-r--r--include/backend/drm/drm.h19
-rw-r--r--include/backend/drm/properties.h11
-rw-r--r--include/backend/drm/renderer.h20
-rw-r--r--include/backend/drm/util.h4
-rw-r--r--include/backend/libinput.h12
-rw-r--r--include/backend/wayland.h8
-rw-r--r--include/backend/x11.h12
-rw-r--r--include/render/gles2.h17
-rw-r--r--include/wlr/backend/drm.h2
-rw-r--r--include/wlr/render/egl.h2
-rw-r--r--include/wlr/render/interface.h6
-rw-r--r--include/wlr/render/wlr_renderer.h10
-rw-r--r--include/wlr/types/wlr_compositor.h4
-rw-r--r--include/wlr/types/wlr_layer_shell.h2
-rw-r--r--include/wlr/types/wlr_output_layout.h8
-rw-r--r--include/wlr/types/wlr_region.h3
-rw-r--r--include/wlr/types/wlr_surface.h4
-rw-r--r--include/xwayland/selection.h4
-rw-r--r--render/egl.c16
-rw-r--r--render/gles2/pixel_format.c7
-rw-r--r--render/gles2/renderer.c60
-rw-r--r--render/gles2/texture.c33
-rw-r--r--render/wlr_renderer.c5
-rw-r--r--types/wlr_compositor.c94
-rw-r--r--types/wlr_cursor.c34
-rw-r--r--types/wlr_data_device.c40
-rw-r--r--types/wlr_idle_inhibit_v1.c16
-rw-r--r--types/wlr_layer_shell.c39
-rw-r--r--types/wlr_output.c10
-rw-r--r--types/wlr_output_layout.c54
-rw-r--r--types/wlr_region.c17
-rw-r--r--types/wlr_seat.c4
-rw-r--r--types/wlr_surface.c127
-rw-r--r--types/wlr_wl_shell.c9
-rw-r--r--types/wlr_xdg_shell.c87
-rw-r--r--types/wlr_xdg_shell_v6.c88
-rw-r--r--util/log.c5
-rw-r--r--wlroots.syms37
-rw-r--r--xcursor/wlr_xcursor.c16
-rw-r--r--xwayland/selection/incoming.c8
-rw-r--r--xwayland/selection/outgoing.c2
-rw-r--r--xwayland/selection/selection.c8
-rw-r--r--xwayland/xwayland.c28
-rw-r--r--xwayland/xwm.c8
68 files changed, 733 insertions, 684 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index f01eb82c..fc5ccd9b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -93,7 +93,7 @@ not use GNU extensions.
### Brackets
-Brackets always go on the same line, including in functions.
+Brackets always go on the same line, including in functions.
Always include brackets for if/while/for, even if it's a single statement.
```c
void function() {
@@ -114,7 +114,7 @@ void function() {
Indentations are a single tab.
For long lines that need to be broken, the continuation line should be indented
-with an additional tab.
+with an additional tab.
If the line being broken is opening a new block (functions, if, while, etc.),
the continuation line should be indented with two tabs, so they can't be
misread as being part of the block.
@@ -139,9 +139,10 @@ breaking points so your code is easy to read.
### Names
-Function and type names should be prefixed with `wlr_submodule_` (e.g. `struct
-wlr_drm_plane`, `wlr_output_set_cursor`). For static functions and types local
-to a file, the names chosen aren't as important.
+Global function and type names should be prefixed with `wlr_submodule_` (e.g.
+`struct wlr_output`, `wlr_output_set_cursor`). For static functions and
+types local to a file, the names chosen aren't as important. Local function
+names shouldn't have a `wlr_` prefix.
For include guards, use the header's filename relative to include. Uppercase
all of the characters, and replace any invalid characters with an underscore.
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 f06de1ee..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) {
@@ -79,9 +79,7 @@ bool wlr_drm_surface_init(struct wlr_drm_surface *surf,
}
gbm_surface_destroy(surf->gbm);
}
- if (surf->egl) {
- eglDestroySurface(surf->renderer->egl.display, surf->egl);
- }
+ wlr_egl_destroy_surface(&surf->renderer->egl, surf->egl);
surf->gbm = gbm_surface_create(renderer->gbm, width, height,
format, GBM_BO_USE_RENDERING | flags);
@@ -105,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;
}
@@ -117,9 +115,7 @@ void wlr_drm_surface_finish(struct wlr_drm_surface *surf) {
gbm_surface_release_buffer(surf->gbm, surf->back);
}
- if (surf->egl) {
- eglDestroySurface(surf->renderer->egl.display, surf->egl);
- }
+ wlr_egl_destroy_surface(&surf->renderer->egl, surf->egl);
if (surf->gbm) {
gbm_surface_destroy(surf->gbm);
}
@@ -127,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);
@@ -145,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;
@@ -212,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);
@@ -228,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/headless/backend.c b/backend/headless/backend.c
index 81b01376..1d29e12a 100644
--- a/backend/headless/backend.c
+++ b/backend/headless/backend.c
@@ -54,6 +54,7 @@ static void backend_destroy(struct wlr_backend *wlr_backend) {
wlr_signal_emit_safe(&wlr_backend->events.destroy, backend);
+ wlr_renderer_destroy(backend->renderer);
wlr_egl_finish(&backend->egl);
free(backend);
}
diff --git a/backend/headless/output.c b/backend/headless/output.c
index 9c479cde..f71b4cdb 100644
--- a/backend/headless/output.c
+++ b/backend/headless/output.c
@@ -29,9 +29,7 @@ static bool output_set_custom_mode(struct wlr_output *wlr_output, int32_t width,
refresh = HEADLESS_DEFAULT_REFRESH;
}
- if (output->egl_surface) {
- eglDestroySurface(backend->egl.display, output->egl_surface);
- }
+ wlr_egl_destroy_surface(&backend->egl, output->egl_surface);
output->egl_surface = egl_create_surface(&backend->egl, width, height);
if (output->egl_surface == EGL_NO_SURFACE) {
@@ -73,7 +71,7 @@ static void output_destroy(struct wlr_output *wlr_output) {
wl_event_source_remove(output->frame_timer);
- eglDestroySurface(output->backend->egl.display, output->egl_surface);
+ wlr_egl_destroy_surface(&output->backend->egl, output->egl_surface);
free(output);
}
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..8ad5ba15 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;
@@ -88,6 +88,7 @@ static void wlr_wl_backend_destroy(struct wlr_backend *wlr_backend) {
free(backend->seat_name);
wl_event_source_remove(backend->remote_display_src);
+ wlr_renderer_destroy(backend->renderer);
wlr_egl_finish(&backend->egl);
if (backend->seat) {
wl_seat_destroy(backend->seat);
@@ -110,23 +111,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 +138,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 +173,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 c1fa638a..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) {
@@ -184,7 +184,7 @@ static void wlr_wl_output_destroy(struct wlr_output *wlr_output) {
wl_callback_destroy(output->frame_callback);
}
- eglDestroySurface(output->backend->egl.display, output->surface);
+ wlr_egl_destroy_surface(&output->backend->egl, output->egl_surface);
wl_egl_window_destroy(output->egl_window);
zxdg_toplevel_v6_destroy(output->xdg_toplevel);
zxdg_surface_v6_destroy(output->xdg_surface);
@@ -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, &registry_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..35d037b0 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;
}
@@ -239,6 +239,7 @@ static void wlr_x11_backend_destroy(struct wlr_backend *backend) {
}
wl_list_remove(&x11->display_destroy.link);
+ wlr_renderer_destroy(x11->renderer);
wlr_egl_finish(&x11->egl);
if (x11->cursor) {
@@ -250,16 +251,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 +270,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 df4ff043..1f61c5e9 100644
--- a/backend/x11/output.c
+++ b/backend/x11/output.c
@@ -61,7 +61,7 @@ static void output_destroy(struct wlr_output *wlr_output) {
wl_list_remove(&output->link);
wl_event_source_remove(output->frame_timer);
- eglDestroySurface(x11->egl.display, output->surf);
+ wlr_egl_destroy_surface(&x11->egl, output->surf);
xcb_destroy_window(x11->xcb_conn, output->win);
xcb_flush(x11->xcb_conn);
free(output);
@@ -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) {
diff --git a/examples/layer-shell.c b/examples/layer-shell.c
index d9deb7b0..ec25fe42 100644
--- a/examples/layer-shell.c
+++ b/examples/layer-shell.c
@@ -188,9 +188,8 @@ static void xdg_popup_configure(void *data, struct xdg_popup *xdg_popup,
}
}
-static void popup_destroy()
-{
- eglDestroySurface(egl.display, popup_egl_surface);
+static void popup_destroy() {
+ wlr_egl_destroy_surface(&egl, popup_egl_surface);
wl_egl_window_destroy(popup_egl_window);
xdg_popup_destroy(popup);
wl_surface_destroy(popup_wl_surface);
@@ -262,7 +261,7 @@ static void layer_surface_configure(void *data,
static void layer_surface_closed(void *data,
struct zwlr_layer_surface_v1 *surface) {
- eglDestroySurface(egl.display, egl_surface);
+ wlr_egl_destroy_surface(&egl, egl_surface);
wl_egl_window_destroy(egl_window);
zwlr_layer_surface_v1_destroy(surface);
wl_surface_destroy(wl_surface);
diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h
index cb10ad20..5d6ff231 100644
--- a/include/backend/drm/drm.h
+++ b/include/backend/drm/drm.h
@@ -136,17 +136,12 @@ struct wlr_drm_connector {
struct wl_list link;
};
-bool wlr_drm_check_features(struct wlr_drm_backend *drm);
-bool wlr_drm_resources_init(struct wlr_drm_backend *drm);
-void wlr_drm_resources_free(struct wlr_drm_backend *drm);
-void wlr_drm_restore_outputs(struct wlr_drm_backend *drm);
-void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn);
-void wlr_drm_scan_connectors(struct wlr_drm_backend *state);
-int wlr_drm_event(int fd, uint32_t mask, void *data);
-void wlr_drm_connector_enable(struct wlr_output *output, bool enable);
-
-void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn);
-
-struct wlr_session *wlr_drm_backend_get_session(struct wlr_backend *backend);
+bool check_drm_features(struct wlr_drm_backend *drm);
+bool init_drm_resources(struct wlr_drm_backend *drm);
+void finish_drm_resources(struct wlr_drm_backend *drm);
+void restore_drm_outputs(struct wlr_drm_backend *drm);
+void scan_drm_connectors(struct wlr_drm_backend *state);
+int handle_drm_event(int fd, uint32_t mask, void *data);
+void enable_drm_connector(struct wlr_output *output, bool enable);
#endif
diff --git a/include/backend/drm/properties.h b/include/backend/drm/properties.h
index 3cf8cc87..1b3b2241 100644
--- a/include/backend/drm/properties.h
+++ b/include/backend/drm/properties.h
@@ -59,11 +59,12 @@ union wlr_drm_plane_props {
uint32_t props[12];
};
-bool wlr_drm_get_connector_props(int fd, uint32_t id, union wlr_drm_connector_props *out);
-bool wlr_drm_get_crtc_props(int fd, uint32_t id, union wlr_drm_crtc_props *out);
-bool wlr_drm_get_plane_props(int fd, uint32_t id, union wlr_drm_plane_props *out);
+bool get_drm_connector_props(int fd, uint32_t id,
+ union wlr_drm_connector_props *out);
+bool get_drm_crtc_props(int fd, uint32_t id, union wlr_drm_crtc_props *out);
+bool get_drm_plane_props(int fd, uint32_t id, union wlr_drm_plane_props *out);
-bool wlr_drm_get_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret);
-void *wlr_drm_get_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len);
+bool get_drm_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret);
+void *get_drm_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len);
#endif
diff --git a/include/backend/drm/renderer.h b/include/backend/drm/renderer.h
index 73adfc27..5e15f3d5 100644
--- a/include/backend/drm/renderer.h
+++ b/include/backend/drm/renderer.h
@@ -31,25 +31,25 @@ struct wlr_drm_surface {
struct gbm_bo *back;
};
-bool wlr_drm_renderer_init(struct wlr_drm_backend *drm,
+bool init_drm_renderer(struct wlr_drm_backend *drm,
struct wlr_drm_renderer *renderer);
-void wlr_drm_renderer_finish(struct wlr_drm_renderer *renderer);
+void finish_drm_renderer(struct wlr_drm_renderer *renderer);
-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);
-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);
-void wlr_drm_surface_finish(struct wlr_drm_surface *surf);
-bool wlr_drm_surface_make_current(struct wlr_drm_surface *surf, int *buffer_age);
-struct gbm_bo *wlr_drm_surface_swap_buffers(struct wlr_drm_surface *surf,
+void finish_drm_surface(struct wlr_drm_surface *surf);
+bool make_drm_surface_current(struct wlr_drm_surface *surf, int *buffer_age);
+struct gbm_bo *swap_drm_surface_buffers(struct wlr_drm_surface *surf,
pixman_region32_t *damage);
-struct gbm_bo *wlr_drm_surface_get_front(struct wlr_drm_surface *surf);
-void wlr_drm_surface_post(struct wlr_drm_surface *surf);
-struct gbm_bo *wlr_drm_surface_mgpu_copy(struct wlr_drm_surface *dest,
+struct gbm_bo *get_drm_surface_front(struct wlr_drm_surface *surf);
+void post_drm_surface(struct wlr_drm_surface *surf);
+struct gbm_bo *copy_drm_surface_mgpu(struct wlr_drm_surface *dest,
struct gbm_bo *src);
#endif
diff --git a/include/backend/drm/util.h b/include/backend/drm/util.h
index 25da858f..0b55182b 100644
--- a/include/backend/drm/util.h
+++ b/include/backend/drm/util.h
@@ -9,7 +9,8 @@
// Calculates a more accurate refresh rate (mHz) than what mode itself provides
int32_t calculate_refresh_rate(drmModeModeInfo *mode);
// Populates the make/model/phys_{width,height} of output from the edid data
-void parse_edid(struct wlr_output *restrict output, size_t len, const uint8_t *data);
+void parse_edid(struct wlr_output *restrict output, size_t len,
+ const uint8_t *data);
// Returns the string representation of a DRM output type
const char *conn_get_name(uint32_t type_id);
// Returns the DRM framebuffer id for a gbm_bo
@@ -36,4 +37,5 @@ enum {
size_t match_obj(size_t num_objs, const uint32_t objs[static restrict num_objs],
size_t num_res, const uint32_t res[static restrict num_res],
uint32_t out[static restrict num_res]);
+
#endif
diff --git a/include/backend/libinput.h b/include/backend/libinput.h
index 4eee7eb8..f0928133 100644
--- a/include/backend/libinput.h
+++ b/include/backend/libinput.h
@@ -31,19 +31,19 @@ struct wlr_libinput_input_device {
uint32_t usec_to_msec(uint64_t usec);
-void wlr_libinput_event(struct wlr_libinput_backend *state,
+void handle_libinput_event(struct wlr_libinput_backend *state,
struct libinput_event *event);
struct wlr_input_device *get_appropriate_device(
enum wlr_input_device_type desired_type,
struct libinput_device *device);
-struct wlr_keyboard *wlr_libinput_keyboard_create(
+struct wlr_keyboard *create_libinput_keyboard(
struct libinput_device *device);
void handle_keyboard_key(struct libinput_event *event,
struct libinput_device *device);
-struct wlr_pointer *wlr_libinput_pointer_create(
+struct wlr_pointer *create_libinput_pointer(
struct libinput_device *device);
void handle_pointer_motion(struct libinput_event *event,
struct libinput_device *device);
@@ -54,7 +54,7 @@ void handle_pointer_button(struct libinput_event *event,
void handle_pointer_axis(struct libinput_event *event,
struct libinput_device *device);
-struct wlr_touch *wlr_libinput_touch_create(
+struct wlr_touch *create_libinput_touch(
struct libinput_device *device);
void handle_touch_down(struct libinput_event *event,
struct libinput_device *device);
@@ -65,7 +65,7 @@ void handle_touch_motion(struct libinput_event *event,
void handle_touch_cancel(struct libinput_event *event,
struct libinput_device *device);
-struct wlr_tablet_tool *wlr_libinput_tablet_tool_create(
+struct wlr_tablet_tool *create_libinput_tablet_tool(
struct libinput_device *device);
void handle_tablet_tool_axis(struct libinput_event *event,
struct libinput_device *device);
@@ -76,7 +76,7 @@ void handle_tablet_tool_tip(struct libinput_event *event,
void handle_tablet_tool_button(struct libinput_event *event,
struct libinput_device *device);
-struct wlr_tablet_pad *wlr_libinput_tablet_pad_create(
+struct wlr_tablet_pad *create_libinput_tablet_pad(
struct libinput_device *device);
void handle_tablet_pad_button(struct libinput_event *event,
struct libinput_device *device);
diff --git a/include/backend/wayland.h b/include/backend/wayland.h
index 00b6ae89..d1af954c 100644
--- a/include/backend/wayland.h
+++ b/include/backend/wayland.h
@@ -74,11 +74,11 @@ struct wlr_wl_pointer {
struct wl_listener output_destroy_listener;
};
-void wlr_wl_registry_poll(struct wlr_wl_backend *backend);
-void wlr_wl_output_update_cursor(struct wlr_wl_backend_output *output);
-struct wlr_wl_backend_output *wlr_wl_output_for_surface(
+void poll_wl_registry(struct wlr_wl_backend *backend);
+void update_wl_output_cursor(struct wlr_wl_backend_output *output);
+struct wlr_wl_backend_output *get_wl_output_for_surface(
struct wlr_wl_backend *backend, struct wl_surface *surface);
-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);
extern const struct wl_seat_listener seat_listener;
diff --git a/include/backend/x11.h b/include/backend/x11.h
index aa946912..6ab1cec6 100644
--- a/include/backend/x11.h
+++ b/include/backend/x11.h
@@ -72,19 +72,19 @@ struct wlr_x11_backend {
struct wl_listener display_destroy;
};
-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);
-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);
-const struct wlr_input_device_impl input_device_impl;
+extern const struct wlr_input_device_impl input_device_impl;
-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);
-void x11_update_pointer_position(struct wlr_x11_output *output,
+void update_x11_pointer_position(struct wlr_x11_output *output,
xcb_timestamp_t time);
-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 *event);
#endif
diff --git a/include/render/gles2.h b/include/render/gles2.h
index 792f1b40..99beff29 100644
--- a/include/render/gles2.h
+++ b/include/render/gles2.h
@@ -18,7 +18,7 @@
extern PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
-struct gles2_pixel_format {
+struct wlr_gles2_pixel_format {
uint32_t wl_format;
GLint gl_format, gl_type;
int depth, bpp;
@@ -68,15 +68,16 @@ struct wlr_gles2_texture {
};
};
-const struct gles2_pixel_format *gles2_format_from_wl(enum wl_shm_format fmt);
-const enum wl_shm_format *gles2_formats(size_t *len);
+const struct wlr_gles2_pixel_format *get_gles2_format_from_wl(
+ enum wl_shm_format fmt);
+const enum wl_shm_format *get_gles2_formats(size_t *len);
-struct wlr_gles2_texture *gles2_get_texture_in_context(
+struct wlr_gles2_texture *get_gles2_texture_in_context(
struct wlr_texture *wlr_texture);
-void gles2_push_marker(const char *file, const char *func);
-void gles2_pop_marker(void);
-#define GLES2_DEBUG_PUSH gles2_push_marker(wlr_strip_path(__FILE__), __func__)
-#define GLES2_DEBUG_POP gles2_pop_marker()
+void push_gles2_marker(const char *file, const char *func);
+void pop_gles2_marker(void);
+#define PUSH_GLES2_DEBUG push_gles2_marker(wlr_strip_path(__FILE__), __func__)
+#define POP_GLES2_DEBUG pop_gles2_marker()
#endif
diff --git a/include/wlr/backend/drm.h b/include/wlr/backend/drm.h
index 0c9e5c8b..14fafe10 100644
--- a/include/wlr/backend/drm.h
+++ b/include/wlr/backend/drm.h
@@ -19,4 +19,6 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
bool wlr_backend_is_drm(struct wlr_backend *backend);
bool wlr_output_is_drm(struct wlr_output *output);
+struct wlr_session *wlr_drm_backend_get_session(struct wlr_backend *backend);
+
#endif
diff --git a/include/wlr/render/egl.h b/include/wlr/render/egl.h
index 0b7f1dde..4d837138 100644
--- a/include/wlr/render/egl.h
+++ b/include/wlr/render/egl.h
@@ -98,4 +98,6 @@ bool wlr_egl_is_current(struct wlr_egl *egl);
bool wlr_egl_swap_buffers(struct wlr_egl *egl, EGLSurface surface,
pixman_region32_t *damage);
+bool wlr_egl_destroy_surface(struct wlr_egl *egl, EGLSurface surface);
+
#endif
diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h
index 9dbe7247..e7cdce0a 100644
--- a/include/wlr/render/interface.h
+++ b/include/wlr/render/interface.h
@@ -11,12 +11,6 @@
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/types/wlr_output.h>
-struct wlr_renderer_impl;
-
-struct wlr_renderer {
- const struct wlr_renderer_impl *impl;
-};
-
struct wlr_renderer_impl {
void (*begin)(struct wlr_renderer *renderer, uint32_t width,
uint32_t height);
diff --git a/include/wlr/render/wlr_renderer.h b/include/wlr/render/wlr_renderer.h
index eb365762..21f9c16c 100644
--- a/include/wlr/render/wlr_renderer.h
+++ b/include/wlr/render/wlr_renderer.h
@@ -6,9 +6,15 @@
#include <wlr/render/wlr_texture.h>
#include <wlr/types/wlr_box.h>
-struct wlr_output;
+struct wlr_renderer_impl;
-struct wlr_renderer;
+struct wlr_renderer {
+ const struct wlr_renderer_impl *impl;
+
+ struct {
+ struct wl_signal destroy;
+ } events;
+};
void wlr_renderer_begin(struct wlr_renderer *r, int width, int height);
void wlr_renderer_end(struct wlr_renderer *r);
diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h
index 816ff713..f6be0a74 100644
--- a/include/wlr/types/wlr_compositor.h
+++ b/include/wlr/types/wlr_compositor.h
@@ -9,13 +9,15 @@ struct wlr_surface;
struct wlr_subcompositor {
struct wl_global *wl_global;
struct wl_list wl_resources;
+ struct wl_list subsurface_resources;
};
struct wlr_compositor {
struct wl_global *wl_global;
struct wl_list wl_resources;
struct wlr_renderer *renderer;
- struct wl_list surfaces;
+ struct wl_list surface_resources;
+ struct wl_list region_resources;
struct wlr_subcompositor subcompositor;
diff --git a/include/wlr/types/wlr_layer_shell.h b/include/wlr/types/wlr_layer_shell.h
index 6040478d..22352906 100644
--- a/include/wlr/types/wlr_layer_shell.h
+++ b/include/wlr/types/wlr_layer_shell.h
@@ -61,7 +61,7 @@ struct wlr_layer_surface {
struct wlr_layer_shell *shell;
struct wl_list popups; // wlr_xdg_popup::link
- const char *namespace;
+ char *namespace;
enum zwlr_layer_shell_v1_layer layer;
bool added, configured, mapped, closed;
diff --git a/include/wlr/types/wlr_output_layout.h b/include/wlr/types/wlr_output_layout.h
index ccb2cd61..759c8ccf 100644
--- a/include/wlr/types/wlr_output_layout.h
+++ b/include/wlr/types/wlr_output_layout.h
@@ -105,10 +105,10 @@ struct wlr_output *wlr_output_layout_get_center_output(
struct wlr_output_layout *layout);
enum wlr_direction {
- WLR_DIRECTION_UP = 0,
- WLR_DIRECTION_DOWN = 1,
- WLR_DIRECTION_LEFT = 2,
- WLR_DIRECTION_RIGHT = 4,
+ WLR_DIRECTION_UP = 1,
+ WLR_DIRECTION_DOWN = 2,
+ WLR_DIRECTION_LEFT = 4,
+ WLR_DIRECTION_RIGHT = 8,
};
/**
diff --git a/include/wlr/types/wlr_region.h b/include/wlr/types/wlr_region.h
index ffacea72..a79ab61d 100644
--- a/include/wlr/types/wlr_region.h
+++ b/include/wlr/types/wlr_region.h
@@ -8,8 +8,7 @@ struct wl_resource;
/*
* Implements the given resource as region.
*/
-void wlr_region_create(struct wl_client *client, struct wl_resource *res,
- uint32_t id);
+struct wl_resource *wlr_region_create(struct wl_client *client, uint32_t id);
pixman_region32_t *wlr_region_from_resource(struct wl_resource *resource);
diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h
index 35d47926..5ff9996d 100644
--- a/include/wlr/types/wlr_surface.h
+++ b/include/wlr/types/wlr_surface.h
@@ -93,6 +93,8 @@ struct wlr_surface {
// wlr_subsurface::parent_pending_link
struct wl_list subsurface_pending_list;
+ struct wl_listener renderer_destroy;
+
void *data;
};
@@ -121,7 +123,7 @@ bool wlr_surface_has_buffer(struct wlr_surface *surface);
/**
* Create the subsurface implementation for this surface.
*/
-void wlr_surface_make_subsurface(struct wlr_surface *surface,
+struct wlr_subsurface *wlr_surface_make_subsurface(struct wlr_surface *surface,
struct wlr_surface *parent, uint32_t id);
/**
diff --git a/include/xwayland/selection.h b/include/xwayland/selection.h
index bb3a894d..fc910e46 100644
--- a/include/xwayland/selection.h
+++ b/include/xwayland/selection.h
@@ -60,8 +60,8 @@ void xwm_handle_selection_notify(struct wlr_xwm *xwm,
xcb_selection_notify_event_t *event);
int xwm_handle_xfixes_selection_notify(struct wlr_xwm *xwm,
xcb_xfixes_selection_notify_event_t *event);
-bool wlr_data_source_is_xwayland_data_source(struct wlr_data_source *wlr_source);
-bool wlr_primary_selection_source_is_xwayland_primary_selection_source(
+bool data_source_is_xwayland(struct wlr_data_source *wlr_source);
+bool primary_selection_source_is_xwayland(
struct wlr_primary_selection_source *wlr_source);
void xwm_seat_handle_start_drag(struct wlr_xwm *xwm, struct wlr_drag *drag);
diff --git a/render/egl.c b/render/egl.c
index b52682ea..433e554c 100644
--- a/render/egl.c
+++ b/render/egl.c
@@ -162,7 +162,7 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
wlr_log(L_INFO, "EGL vendor: %s", eglQueryString(egl->display, EGL_VENDOR));
if (!check_egl_ext(egl->exts_str, "EGL_KHR_image_base")) {
- wlr_log(L_ERROR, "Required egl extensions not supported");
+ wlr_log(L_ERROR, "Required EGL_KHR_image_base extension not supported");
goto error;
}
@@ -225,9 +225,10 @@ bool wlr_egl_destroy_image(struct wlr_egl *egl, EGLImage image) {
if (!eglDestroyImageKHR) {
return false;
}
-
- eglDestroyImageKHR(egl->display, image);
- return true;
+ if (!image) {
+ return true;
+ }
+ return eglDestroyImageKHR(egl->display, image);
}
EGLSurface wlr_egl_create_surface(struct wlr_egl *egl, void *window) {
@@ -499,3 +500,10 @@ int wlr_egl_get_dmabuf_modifiers(struct wlr_egl *egl,
}
return num;
}
+
+bool wlr_egl_destroy_surface(struct wlr_egl *egl, EGLSurface surface) {
+ if (!surface) {
+ return true;
+ }
+ return eglDestroySurface(egl->display, surface);
+}
diff --git a/render/gles2/pixel_format.c b/render/gles2/pixel_format.c
index 89ba762f..6f42e72e 100644
--- a/render/gles2/pixel_format.c
+++ b/render/gles2/pixel_format.c
@@ -6,7 +6,7 @@
* The wayland formats are little endian while the GL formats are big endian,
* so WL_SHM_FORMAT_ARGB8888 is actually compatible with GL_BGRA_EXT.
*/
-static const struct gles2_pixel_format formats[] = {
+static const struct wlr_gles2_pixel_format formats[] = {
{
.wl_format = WL_SHM_FORMAT_ARGB8888,
.depth = 32,
@@ -50,7 +50,8 @@ static const enum wl_shm_format wl_formats[] = {
// TODO: more pixel formats
-const struct gles2_pixel_format *gles2_format_from_wl(enum wl_shm_format fmt) {
+const struct wlr_gles2_pixel_format *get_gles2_format_from_wl(
+ enum wl_shm_format fmt) {
for (size_t i = 0; i < sizeof(formats) / sizeof(*formats); ++i) {
if (formats[i].wl_format == fmt) {
return &formats[i];
@@ -59,7 +60,7 @@ const struct gles2_pixel_format *gles2_format_from_wl(enum wl_shm_format fmt) {
return NULL;
}
-const enum wl_shm_format *gles2_formats(size_t *len) {
+const enum wl_shm_format *get_gles2_formats(size_t *len) {
*len = sizeof(wl_formats) / sizeof(wl_formats[0]);
return wl_formats;
}
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c
index 97401010..c10493c4 100644
--- a/render/gles2/renderer.c
+++ b/render/gles2/renderer.c
@@ -34,7 +34,7 @@ static void gles2_begin(struct wlr_renderer *wlr_renderer, uint32_t width,
struct wlr_gles2_renderer *renderer =
gles2_get_renderer_in_context(wlr_renderer);
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
glViewport(0, 0, width, height);
renderer->viewport_width = width;
@@ -47,7 +47,7 @@ static void gles2_begin(struct wlr_renderer *wlr_renderer, uint32_t width,
// XXX: maybe we should save output projection and remove some of the need
// for users to sling matricies themselves
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
}
static void gles2_end(struct wlr_renderer *wlr_renderer) {
@@ -59,10 +59,10 @@ static void gles2_clear(struct wlr_renderer *wlr_renderer,
const float color[static 4]) {
gles2_get_renderer_in_context(wlr_renderer);
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
glClearColor(color[0], color[1], color[2], color[3]);
glClear(GL_COLOR_BUFFER_BIT);
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
}
static void gles2_scissor(struct wlr_renderer *wlr_renderer,
@@ -70,7 +70,7 @@ static void gles2_scissor(struct wlr_renderer *wlr_renderer,
struct wlr_gles2_renderer *renderer =
gles2_get_renderer_in_context(wlr_renderer);
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
if (box != NULL) {
struct wlr_box gl_box;
wlr_box_transform(box, WL_OUTPUT_TRANSFORM_FLIPPED_180,
@@ -81,7 +81,7 @@ static void gles2_scissor(struct wlr_renderer *wlr_renderer,
} else {
glDisable(GL_SCISSOR_TEST);
}
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
}
static void draw_quad() {
@@ -116,7 +116,7 @@ static bool gles2_render_texture_with_matrix(struct wlr_renderer *wlr_renderer,
struct wlr_gles2_renderer *renderer =
gles2_get_renderer_in_context(wlr_renderer);
struct wlr_gles2_texture *texture =
- gles2_get_texture_in_context(wlr_texture);
+ get_gles2_texture_in_context(wlr_texture);
GLuint prog = 0;
GLenum target = 0;
@@ -139,7 +139,7 @@ static bool gles2_render_texture_with_matrix(struct wlr_renderer *wlr_renderer,
float transposition[9];
wlr_matrix_transpose(transposition, matrix);
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
GLuint tex_id = texture->type == WLR_GLES2_TEXTURE_GLTEX ?
texture->gl_tex : texture->image_tex;
@@ -157,7 +157,7 @@ static bool gles2_render_texture_with_matrix(struct wlr_renderer *wlr_renderer,
draw_quad();
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return true;
}
@@ -172,12 +172,12 @@ static void gles2_render_quad_with_matrix(struct wlr_renderer *wlr_renderer,
float transposition[9];
wlr_matrix_transpose(transposition, matrix);
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
glUseProgram(renderer->shaders.quad);
glUniformMatrix3fv(0, 1, GL_FALSE, transposition);
glUniform4f(1, color[0], color[1], color[2], color[3]);
draw_quad();
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
}
static void gles2_render_ellipse_with_matrix(struct wlr_renderer *wlr_renderer,
@@ -190,17 +190,17 @@ static void gles2_render_ellipse_with_matrix(struct wlr_renderer *wlr_renderer,
float transposition[9];
wlr_matrix_transpose(transposition, matrix);
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
glUseProgram(renderer->shaders.ellipse);
glUniformMatrix3fv(0, 1, GL_FALSE, transposition);
glUniform4f(1, color[0], color[1], color[2], color[3]);
draw_quad();
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
}
static const enum wl_shm_format *gles2_renderer_formats(
struct wlr_renderer *wlr_renderer, size_t *len) {
- return gles2_formats(len);
+ return get_gles2_formats(len);
}
static bool gles2_resource_is_wl_drm_buffer(struct wlr_renderer *wlr_renderer,
@@ -254,13 +254,13 @@ static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer,
uint32_t dst_y, void *data) {
gles2_get_renderer_in_context(wlr_renderer);
- const struct gles2_pixel_format *fmt = gles2_format_from_wl(wl_fmt);
+ const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
if (fmt == NULL) {
wlr_log(L_ERROR, "Cannot read pixels: unsupported pixel format");
return false;
}
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
// Make sure any pending drawing is finished before we try to read it
glFinish();
@@ -273,14 +273,14 @@ static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer,
fmt->gl_type, p + i * stride + dst_x * fmt->bpp / 8);
}
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return true;
}
static bool gles2_format_supported(struct wlr_renderer *wlr_renderer,
enum wl_shm_format wl_fmt) {
- return gles2_format_from_wl(wl_fmt) != NULL;
+ return get_gles2_format_from_wl(wl_fmt) != NULL;
}
static struct wlr_texture *gles2_texture_from_pixels(
@@ -309,13 +309,13 @@ static void gles2_destroy(struct wlr_renderer *wlr_renderer) {
wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL);
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
glDeleteProgram(renderer->shaders.quad);
glDeleteProgram(renderer->shaders.ellipse);
glDeleteProgram(renderer->shaders.tex_rgba);
glDeleteProgram(renderer->shaders.tex_rgbx);
glDeleteProgram(renderer->shaders.tex_ext);
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
if (glDebugMessageCallbackKHR) {
glDisable(GL_DEBUG_OUTPUT_KHR);
@@ -347,7 +347,7 @@ static const struct wlr_renderer_impl renderer_impl = {
.texture_from_dmabuf = gles2_texture_from_dmabuf,
};
-void gles2_push_marker(const char *file, const char *func) {
+void push_gles2_marker(const char *file, const char *func) {
if (!glPushDebugGroupKHR) {
return;
}
@@ -358,7 +358,7 @@ void gles2_push_marker(const char *file, const char *func) {
glPushDebugGroupKHR(GL_DEBUG_SOURCE_APPLICATION_KHR, 1, -1, str);
}
-void gles2_pop_marker(void) {
+void pop_gles2_marker(void) {
if (glPopDebugGroupKHR) {
glPopDebugGroupKHR();
}
@@ -385,7 +385,7 @@ static void gles2_log(GLenum src, GLenum type, GLuint id, GLenum severity,
}
static GLuint compile_shader(GLuint type, const GLchar *src) {
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
GLuint shader = glCreateShader(type);
glShaderSource(shader, 1, &src, NULL);
@@ -398,12 +398,12 @@ static GLuint compile_shader(GLuint type, const GLchar *src) {
shader = 0;
}
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return shader;
}
static GLuint link_program(const GLchar *vert_src, const GLchar *frag_src) {
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
GLuint vert = compile_shader(GL_VERTEX_SHADER, vert_src);
if (!vert) {
@@ -433,11 +433,11 @@ static GLuint link_program(const GLchar *vert_src, const GLchar *frag_src) {
goto error;
}
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return prog;
error:
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return 0;
}
@@ -481,7 +481,7 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) {
GL_DONT_CARE, 0, NULL, GL_FALSE);
}
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
renderer->shaders.quad = link_program(quad_vertex_src, quad_fragment_src);
if (!renderer->shaders.quad) {
@@ -510,7 +510,7 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) {
}
}
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return &renderer->wlr_renderer;
@@ -521,7 +521,7 @@ error:
glDeleteProgram(renderer->shaders.tex_rgbx);
glDeleteProgram(renderer->shaders.tex_ext);
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
if (glDebugMessageCallbackKHR) {
glDisable(GL_DEBUG_OUTPUT_KHR);
diff --git a/render/gles2/texture.c b/render/gles2/texture.c
index 45169daf..37424802 100644
--- a/render/gles2/texture.c
+++ b/render/gles2/texture.c
@@ -22,7 +22,7 @@ static struct wlr_gles2_texture *gles2_get_texture(
return (struct wlr_gles2_texture *)wlr_texture;
}
-struct wlr_gles2_texture *gles2_get_texture_in_context(
+struct wlr_gles2_texture *get_gles2_texture_in_context(
struct wlr_texture *wlr_texture) {
struct wlr_gles2_texture *texture = gles2_get_texture(wlr_texture);
assert(wlr_egl_is_current(texture->egl));
@@ -41,21 +41,21 @@ static bool gles2_texture_write_pixels(struct wlr_texture *wlr_texture,
uint32_t height, uint32_t src_x, uint32_t src_y, uint32_t dst_x,
uint32_t dst_y, const void *data) {
struct wlr_gles2_texture *texture =
- gles2_get_texture_in_context(wlr_texture);
+ get_gles2_texture_in_context(wlr_texture);
if (texture->type != WLR_GLES2_TEXTURE_GLTEX) {
wlr_log(L_ERROR, "Cannot write pixels to immutable texture");
return false;
}
- const struct gles2_pixel_format *fmt = gles2_format_from_wl(wl_fmt);
+ const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
if (fmt == NULL) {
wlr_log(L_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt);
return false;
}
// TODO: what if the unpack subimage extension isn't supported?
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
glBindTexture(GL_TEXTURE_2D, texture->gl_tex);
@@ -70,7 +70,7 @@ static bool gles2_texture_write_pixels(struct wlr_texture *wlr_texture,
glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0);
glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, 0);
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return true;
}
@@ -83,21 +83,18 @@ static void gles2_texture_destroy(struct wlr_texture *wlr_texture) {
wlr_egl_make_current(texture->egl, EGL_NO_SURFACE, NULL);
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
if (texture->image_tex) {
glDeleteTextures(1, &texture->image_tex);
}
- if (texture->image) {
- assert(eglDestroyImageKHR);
- wlr_egl_destroy_image(texture->egl, texture->image);
- }
+ wlr_egl_destroy_image(texture->egl, texture->image);
if (texture->type == WLR_GLES2_TEXTURE_GLTEX) {
glDeleteTextures(1, &texture->gl_tex);
}
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
free(texture);
}
@@ -113,7 +110,7 @@ struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl,
uint32_t height, const void *data) {
assert(wlr_egl_is_current(egl));
- const struct gles2_pixel_format *fmt = gles2_format_from_wl(wl_fmt);
+ const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
if (fmt == NULL) {
wlr_log(L_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt);
return NULL;
@@ -132,7 +129,7 @@ struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl,
texture->type = WLR_GLES2_TEXTURE_GLTEX;
texture->has_alpha = fmt->has_alpha;
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
glGenTextures(1, &texture->gl_tex);
glBindTexture(GL_TEXTURE_2D, texture->gl_tex);
@@ -142,7 +139,7 @@ struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl,
fmt->gl_format, fmt->gl_type, data);
glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0);
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return &texture->wlr_texture;
}
@@ -191,13 +188,13 @@ struct wlr_texture *wlr_gles2_texture_from_wl_drm(struct wlr_egl *egl,
return NULL;
}
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
glGenTextures(1, &texture->image_tex);
glBindTexture(target, texture->image_tex);
glEGLImageTargetTexture2DOES(target, texture->image);
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return &texture->wlr_texture;
}
@@ -236,12 +233,12 @@ struct wlr_texture *wlr_gles2_texture_from_dmabuf(struct wlr_egl *egl,
return NULL;
}
- GLES2_DEBUG_PUSH;
+ PUSH_GLES2_DEBUG;
glGenTextures(1, &texture->image_tex);
glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture->image_tex);
glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, texture->image);
- GLES2_DEBUG_POP;
+ POP_GLES2_DEBUG;
return &texture->wlr_texture;
}
diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c
index 700da05b..8d1bd9ce 100644
--- a/render/wlr_renderer.c
+++ b/render/wlr_renderer.c
@@ -5,6 +5,7 @@
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_matrix.h>
#include <wlr/util/log.h>
+#include "util/signal.h"
void wlr_renderer_init(struct wlr_renderer *renderer,
const struct wlr_renderer_impl *impl) {
@@ -18,9 +19,13 @@ void wlr_renderer_init(struct wlr_renderer *renderer,
assert(impl->format_supported);
assert(impl->texture_from_pixels);
renderer->impl = impl;
+
+ wl_signal_init(&renderer->events.destroy);
}
void wlr_renderer_destroy(struct wlr_renderer *r) {
+ wlr_signal_emit_safe(&r->events.destroy, r);
+
if (r && r->impl && r->impl->destroy) {
r->impl->destroy(r);
} else {
diff --git a/types/wlr_compositor.c b/types/wlr_compositor.c
index 2d9eec0f..103b1b61 100644
--- a/types/wlr_compositor.c
+++ b/types/wlr_compositor.c
@@ -20,6 +20,15 @@ struct wlr_subsurface *wlr_subsurface_from_surface(
return (struct wlr_subsurface *)surface->role_data;
}
+static const struct wl_subcompositor_interface subcompositor_impl;
+
+static struct wlr_subcompositor *subcompositor_from_resource(
+ struct wl_resource *resource) {
+ assert(wl_resource_instance_of(resource, &wl_subcompositor_interface,
+ &subcompositor_impl));
+ return wl_resource_get_user_data(resource);
+}
+
static void subcompositor_handle_destroy(struct wl_client *client,
struct wl_resource *resource) {
wl_resource_destroy(resource);
@@ -29,6 +38,8 @@ static void subcompositor_handle_get_subsurface(struct wl_client *client,
struct wl_resource *resource, uint32_t id,
struct wl_resource *surface_resource,
struct wl_resource *parent_resource) {
+ struct wlr_subcompositor *subcompositor =
+ subcompositor_from_resource(resource);
struct wlr_surface *surface = wlr_surface_from_resource(surface_resource);
struct wlr_surface *parent = wlr_surface_from_resource(parent_resource);
@@ -64,14 +75,25 @@ static void subcompositor_handle_get_subsurface(struct wl_client *client,
return;
}
- wlr_surface_make_subsurface(surface, parent, id);
+ struct wlr_subsurface *subsurface =
+ wlr_surface_make_subsurface(surface, parent, id);
+ if (subsurface == NULL) {
+ return;
+ }
+
+ wl_list_insert(&subcompositor->subsurface_resources,
+ wl_resource_get_link(subsurface->resource));
}
-static const struct wl_subcompositor_interface subcompositor_interface = {
+static const struct wl_subcompositor_interface subcompositor_impl = {
.destroy = subcompositor_handle_destroy,
.get_subsurface = subcompositor_handle_get_subsurface,
};
+static void subcompositor_resource_destroy(struct wl_resource *resource) {
+ wl_list_remove(wl_resource_get_link(resource));
+}
+
static void subcompositor_bind(struct wl_client *client, void *data,
uint32_t version, uint32_t id) {
struct wlr_subcompositor *subcompositor = data;
@@ -81,8 +103,8 @@ static void subcompositor_bind(struct wl_client *client, void *data,
wl_client_post_no_memory(client);
return;
}
- wl_resource_set_implementation(resource, &subcompositor_interface,
- subcompositor, NULL);
+ wl_resource_set_implementation(resource, &subcompositor_impl,
+ subcompositor, subcompositor_resource_destroy);
wl_list_insert(&subcompositor->wl_resources, wl_resource_get_link(resource));
}
@@ -95,23 +117,33 @@ static void subcompositor_init(struct wlr_subcompositor *subcompositor,
return;
}
wl_list_init(&subcompositor->wl_resources);
+ wl_list_init(&subcompositor->subsurface_resources);
}
static void subcompositor_finish(struct wlr_subcompositor *subcompositor) {
wl_global_destroy(subcompositor->wl_global);
+ struct wl_resource *resource, *tmp;
+ wl_resource_for_each_safe(resource, tmp,
+ &subcompositor->subsurface_resources) {
+ wl_resource_destroy(resource);
+ }
+ wl_resource_for_each_safe(resource, tmp, &subcompositor->wl_resources) {
+ wl_resource_destroy(resource);
+ }
}
-static const struct wl_compositor_interface wl_compositor_impl;
+static const struct wl_compositor_interface compositor_impl;
static struct wlr_compositor *compositor_from_resource(
struct wl_resource *resource) {
assert(wl_resource_instance_of(resource, &wl_compositor_interface,
- &wl_compositor_impl));
+ &compositor_impl));
return wl_resource_get_user_data(resource);
}
-static void destroy_surface_listener(struct wl_listener *listener, void *data) {
+static void compositor_handle_surface_destroy(struct wl_listener *listener,
+ void *data) {
wl_list_remove(wl_resource_get_link(data));
}
@@ -134,35 +166,36 @@ static void wl_compositor_create_surface(struct wl_client *client,
return;
}
surface->compositor_data = compositor;
- surface->compositor_listener.notify = &destroy_surface_listener;
+ surface->compositor_listener.notify = compositor_handle_surface_destroy;
wl_resource_add_destroy_listener(surface_resource,
&surface->compositor_listener);
- wl_list_insert(&compositor->surfaces,
+ wl_list_insert(&compositor->surface_resources,
wl_resource_get_link(surface_resource));
wlr_signal_emit_safe(&compositor->events.new_surface, surface);
}
static void wl_compositor_create_region(struct wl_client *client,
struct wl_resource *resource, uint32_t id) {
- wlr_region_create(client, resource, id);
+ struct wlr_compositor *compositor = compositor_from_resource(resource);
+
+ struct wl_resource *region_resource = wlr_region_create(client, id);
+ if (region_resource == NULL) {
+ wl_resource_post_no_memory(resource);
+ return;
+ }
+
+ wl_list_insert(&compositor->region_resources,
+ wl_resource_get_link(region_resource));
}
-static const struct wl_compositor_interface wl_compositor_impl = {
+static const struct wl_compositor_interface compositor_impl = {
.create_surface = wl_compositor_create_surface,
- .create_region = wl_compositor_create_region
+ .create_region = wl_compositor_create_region,
};
-static void wl_compositor_destroy(struct wl_resource *resource) {
- struct wlr_compositor *compositor = compositor_from_resource(resource);
- struct wl_resource *_resource = NULL;
- wl_resource_for_each(_resource, &compositor->wl_resources) {
- if (_resource == resource) {
- struct wl_list *link = wl_resource_get_link(_resource);
- wl_list_remove(link);
- break;
- }
- }
+static void compositor_resource_destroy(struct wl_resource *resource) {
+ wl_list_remove(wl_resource_get_link(resource));
}
static void wl_compositor_bind(struct wl_client *wl_client, void *data,
@@ -176,8 +209,8 @@ static void wl_compositor_bind(struct wl_client *wl_client, void *data,
wl_client_post_no_memory(wl_client);
return;
}
- wl_resource_set_implementation(resource, &wl_compositor_impl,
- compositor, wl_compositor_destroy);
+ wl_resource_set_implementation(resource, &compositor_impl,
+ compositor, compositor_resource_destroy);
wl_list_insert(&compositor->wl_resources, wl_resource_get_link(resource));
}
@@ -189,6 +222,16 @@ void wlr_compositor_destroy(struct wlr_compositor *compositor) {
subcompositor_finish(&compositor->subcompositor);
wl_list_remove(&compositor->display_destroy.link);
wl_global_destroy(compositor->wl_global);
+ struct wl_resource *resource, *tmp;
+ wl_resource_for_each_safe(resource, tmp, &compositor->surface_resources) {
+ wl_resource_destroy(resource);
+ }
+ wl_resource_for_each_safe(resource, tmp, &compositor->region_resources) {
+ wl_resource_destroy(resource);
+ }
+ wl_resource_for_each_safe(resource, tmp, &compositor->wl_resources) {
+ wl_resource_destroy(resource);
+ }
free(compositor);
}
@@ -218,7 +261,8 @@ struct wlr_compositor *wlr_compositor_create(struct wl_display *display,
compositor->renderer = renderer;
wl_list_init(&compositor->wl_resources);
- wl_list_init(&compositor->surfaces);
+ wl_list_init(&compositor->surface_resources);
+ wl_list_init(&compositor->region_resources);
wl_signal_init(&compositor->events.new_surface);
wl_signal_init(&compositor->events.destroy);
diff --git a/types/wlr_cursor.c b/types/wlr_cursor.c
index 5142513b..7f0e6c62 100644
--- a/types/wlr_cursor.c
+++ b/types/wlr_cursor.c
@@ -107,7 +107,7 @@ static void output_cursor_destroy(
free(output_cursor);
}
-static void wlr_cursor_detach_output_layout(struct wlr_cursor *cur) {
+static void cursor_detach_output_layout(struct wlr_cursor *cur) {
if (!cur->state->layout) {
return;
}
@@ -125,7 +125,7 @@ static void wlr_cursor_detach_output_layout(struct wlr_cursor *cur) {
cur->state->layout = NULL;
}
-static void wlr_cursor_device_destroy(struct wlr_cursor_device *c_device) {
+static void cursor_device_destroy(struct wlr_cursor_device *c_device) {
struct wlr_input_device *dev = c_device->device;
if (dev->type == WLR_INPUT_DEVICE_POINTER) {
wl_list_remove(&c_device->motion.link);
@@ -150,11 +150,11 @@ static void wlr_cursor_device_destroy(struct wlr_cursor_device *c_device) {
}
void wlr_cursor_destroy(struct wlr_cursor *cur) {
- wlr_cursor_detach_output_layout(cur);
+ cursor_detach_output_layout(cur);
struct wlr_cursor_device *device, *device_tmp = NULL;
wl_list_for_each_safe(device, device_tmp, &cur->state->devices, link) {
- wlr_cursor_device_destroy(device);
+ cursor_device_destroy(device);
}
free(cur->state);
@@ -174,7 +174,7 @@ static struct wlr_cursor_device *get_cursor_device(struct wlr_cursor *cur,
return ret;
}
-static void wlr_cursor_warp_unchecked(struct wlr_cursor *cur,
+static void cursor_warp_unchecked(struct wlr_cursor *cur,
double x, double y) {
assert(cur->state->layout);
@@ -241,12 +241,12 @@ bool wlr_cursor_warp(struct wlr_cursor *cur, struct wlr_input_device *dev,
if (mapping) {
if (wlr_box_contains_point(mapping, x, y)) {
- wlr_cursor_warp_unchecked(cur, x, y);
+ cursor_warp_unchecked(cur, x, y);
result = true;
}
} else if (wlr_output_layout_contains_point(cur->state->layout, NULL,
x, y)) {
- wlr_cursor_warp_unchecked(cur, x, y);
+ cursor_warp_unchecked(cur, x, y);
result = true;
}
@@ -262,10 +262,10 @@ void wlr_cursor_warp_absolute(struct wlr_cursor *cur,
mapping = wlr_output_layout_get_box(cur->state->layout, NULL);
}
- x = x > 0 ? mapping->width * x + mapping->x : cur->x;
- y = y > 0 ? mapping->height * y + mapping->y : cur->y;
+ x = x >= 0 ? mapping->width * x + mapping->x : cur->x;
+ y = y >= 0 ? mapping->height * y + mapping->y : cur->y;
- wlr_cursor_warp_unchecked(cur, x, y);
+ cursor_warp_unchecked(cur, x, y);
}
void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev,
@@ -295,7 +295,7 @@ void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev,
}
}
- wlr_cursor_warp_unchecked(cur, x, y);
+ cursor_warp_unchecked(cur, x, y);
}
void wlr_cursor_set_image(struct wlr_cursor *cur, const uint8_t *pixels,
@@ -414,7 +414,7 @@ static void handle_device_destroy(struct wl_listener *listener, void *data) {
wlr_cursor_detach_input_device(c_device->cursor, c_device->device);
}
-static struct wlr_cursor_device *wlr_cursor_device_create(
+static struct wlr_cursor_device *cursor_device_create(
struct wlr_cursor *cursor, struct wlr_input_device *device) {
struct wlr_cursor_device *c_device =
calloc(1, sizeof(struct wlr_cursor_device));
@@ -496,7 +496,7 @@ void wlr_cursor_attach_input_device(struct wlr_cursor *cur,
}
}
- wlr_cursor_device_create(cur, dev);
+ cursor_device_create(cur, dev);
}
void wlr_cursor_detach_input_device(struct wlr_cursor *cur,
@@ -504,7 +504,7 @@ void wlr_cursor_detach_input_device(struct wlr_cursor *cur,
struct wlr_cursor_device *c_device, *tmp = NULL;
wl_list_for_each_safe(c_device, tmp, &cur->state->devices, link) {
if (c_device->device == dev) {
- wlr_cursor_device_destroy(c_device);
+ cursor_device_destroy(c_device);
}
}
}
@@ -512,7 +512,7 @@ void wlr_cursor_detach_input_device(struct wlr_cursor *cur,
static void handle_layout_destroy(struct wl_listener *listener, void *data) {
struct wlr_cursor_state *state =
wl_container_of(listener, state, layout_destroy);
- wlr_cursor_detach_output_layout(state->cursor);
+ cursor_detach_output_layout(state->cursor);
}
static void handle_layout_output_destroy(struct wl_listener *listener,
@@ -567,13 +567,13 @@ static void handle_layout_change(struct wl_listener *listener, void *data) {
wlr_output_layout_closest_point(layout, NULL, state->cursor->x,
state->cursor->y, &x, &y);
- wlr_cursor_warp_unchecked(state->cursor, x, y);
+ cursor_warp_unchecked(state->cursor, x, y);
}
}
void wlr_cursor_attach_output_layout(struct wlr_cursor *cur,
struct wlr_output_layout *l) {
- wlr_cursor_detach_output_layout(cur);
+ cursor_detach_output_layout(cur);
if (l == NULL) {
return;
diff --git a/types/wlr_data_device.c b/types/wlr_data_device.c
index 13b1d08a..23e54809 100644
--- a/types/wlr_data_device.c
+++ b/types/wlr_data_device.c
@@ -219,7 +219,7 @@ static void handle_offer_source_destroyed(struct wl_listener *listener,
offer->source = NULL;
}
-static struct wlr_data_offer *wlr_data_source_send_offer(
+static struct wlr_data_offer *data_source_send_offer(
struct wlr_data_source *source,
struct wlr_seat_client *target) {
if (wl_list_empty(&target->data_devices)) {
@@ -268,7 +268,7 @@ void wlr_seat_client_send_selection(struct wlr_seat_client *seat_client) {
}
if (seat_client->seat->selection_source) {
- struct wlr_data_offer *offer = wlr_data_source_send_offer(
+ struct wlr_data_offer *offer = data_source_send_offer(
seat_client->seat->selection_source, seat_client);
if (offer == NULL) {
return;
@@ -375,7 +375,7 @@ static void handle_drag_seat_client_destroy(struct wl_listener *listener,
wl_list_remove(&drag->seat_client_destroy.link);
}
-static void wlr_drag_set_focus(struct wlr_drag *drag,
+static void drag_set_focus(struct wlr_drag *drag,
struct wlr_surface *surface, double sx, double sy) {
if (drag->focus == surface) {
return;
@@ -420,7 +420,7 @@ static void wlr_drag_set_focus(struct wlr_drag *drag,
struct wl_resource *offer_resource = NULL;
if (drag->source) {
drag->source->accepted = false;
- struct wlr_data_offer *offer = wlr_data_source_send_offer(drag->source,
+ struct wlr_data_offer *offer = data_source_send_offer(drag->source,
focus_client);
if (offer != NULL) {
data_offer_update_action(offer);
@@ -454,7 +454,7 @@ static void wlr_drag_set_focus(struct wlr_drag *drag,
wlr_signal_emit_safe(&drag->events.focus, drag);
}
-static void wlr_drag_end(struct wlr_drag *drag) {
+static void drag_end(struct wlr_drag *drag) {
if (!drag->cancelling) {
drag->cancelling = true;
if (drag->is_pointer_grab) {
@@ -468,7 +468,7 @@ static void wlr_drag_end(struct wlr_drag *drag) {
wl_list_remove(&drag->source_destroy.link);
}
- wlr_drag_set_focus(drag, NULL, 0, 0);
+ drag_set_focus(drag, NULL, 0, 0);
if (drag->icon) {
drag->icon->mapped = false;
@@ -484,7 +484,7 @@ static void wlr_drag_end(struct wlr_drag *drag) {
static void pointer_drag_enter(struct wlr_seat_pointer_grab *grab,
struct wlr_surface *surface, double sx, double sy) {
struct wlr_drag *drag = grab->data;
- wlr_drag_set_focus(drag, surface, sx, sy);
+ drag_set_focus(drag, surface, sx, sy);
}
static void pointer_drag_motion(struct wlr_seat_pointer_grab *grab,
@@ -540,7 +540,7 @@ static uint32_t pointer_drag_button(struct wlr_seat_pointer_grab *grab,
if (grab->seat->pointer_state.button_count == 0 &&
state == WL_POINTER_BUTTON_STATE_RELEASED) {
- wlr_drag_end(drag);
+ drag_end(drag);
}
return 0;
@@ -553,7 +553,7 @@ static void pointer_drag_axis(struct wlr_seat_pointer_grab *grab, uint32_t time,
static void pointer_drag_cancel(struct wlr_seat_pointer_grab *grab) {
struct wlr_drag *drag = grab->data;
- wlr_drag_end(drag);
+ drag_end(drag);
}
static const struct wlr_pointer_grab_interface
@@ -585,7 +585,7 @@ static void touch_drag_up(struct wlr_seat_touch_grab *grab, uint32_t time,
}
}
- wlr_drag_end(drag);
+ drag_end(drag);
}
static void touch_drag_motion(struct wlr_seat_touch_grab *grab, uint32_t time,
@@ -604,12 +604,12 @@ static void touch_drag_motion(struct wlr_seat_touch_grab *grab, uint32_t time,
static void touch_drag_enter(struct wlr_seat_touch_grab *grab, uint32_t time,
struct wlr_touch_point *point) {
struct wlr_drag *drag = grab->data;
- wlr_drag_set_focus(drag, point->focus_surface, point->sx, point->sy);
+ drag_set_focus(drag, point->focus_surface, point->sx, point->sy);
}
static void touch_drag_cancel(struct wlr_seat_touch_grab *grab) {
struct wlr_drag *drag = grab->data;
- wlr_drag_end(drag);
+ drag_end(drag);
}
static const struct wlr_touch_grab_interface
@@ -641,7 +641,7 @@ static void keyboard_drag_modifiers(struct wlr_seat_keyboard_grab *grab,
static void keyboard_drag_cancel(struct wlr_seat_keyboard_grab *grab) {
struct wlr_drag *drag = grab->data;
- wlr_drag_end(drag);
+ drag_end(drag);
}
static const struct wlr_keyboard_grab_interface
@@ -660,10 +660,10 @@ static void drag_handle_icon_destroy(struct wl_listener *listener, void *data) {
static void drag_handle_drag_source_destroy(struct wl_listener *listener,
void *data) {
struct wlr_drag *drag = wl_container_of(listener, drag, source_destroy);
- wlr_drag_end(drag);
+ drag_end(drag);
}
-static void wlr_drag_icon_destroy(struct wlr_drag_icon *icon) {
+static void drag_icon_destroy(struct wlr_drag_icon *icon) {
if (!icon) {
return;
}
@@ -679,7 +679,7 @@ static void handle_drag_icon_surface_destroy(struct wl_listener *listener,
void *data) {
struct wlr_drag_icon *icon =
wl_container_of(listener, icon, surface_destroy);
- wlr_drag_icon_destroy(icon);
+ drag_icon_destroy(icon);
}
static void handle_drag_icon_surface_commit(struct wlr_surface *surface,
@@ -694,10 +694,10 @@ static void handle_drag_icon_seat_client_destroy(struct wl_listener *listener,
struct wlr_drag_icon *icon =
wl_container_of(listener, icon, seat_client_destroy);
- wlr_drag_icon_destroy(icon);
+ drag_icon_destroy(icon);
}
-static struct wlr_drag_icon *wlr_drag_icon_create(
+static struct wlr_drag_icon *drag_icon_create(
struct wlr_surface *icon_surface, struct wlr_seat_client *client,
bool is_pointer, int32_t touch_id) {
struct wlr_drag_icon *icon = calloc(1, sizeof(struct wlr_drag_icon));
@@ -780,7 +780,7 @@ static bool seat_client_start_drag(struct wlr_seat_client *client,
if (icon_surface) {
int32_t touch_id = (point ? point->touch_id : 0);
struct wlr_drag_icon *icon =
- wlr_drag_icon_create(icon_surface, client, drag->is_pointer_grab,
+ drag_icon_create(icon_surface, client, drag->is_pointer_grab,
touch_id);
if (!icon) {
free(drag);
@@ -817,7 +817,7 @@ static bool seat_client_start_drag(struct wlr_seat_client *client,
} else {
assert(point);
wlr_seat_touch_start_grab(seat, &drag->touch_grab);
- wlr_drag_set_focus(drag, point->surface, point->sx, point->sy);
+ drag_set_focus(drag, point->surface, point->sx, point->sy);
}
seat->drag = drag; // TODO: unset this thing somewhere
diff --git a/types/wlr_idle_inhibit_v1.c b/types/wlr_idle_inhibit_v1.c
index 3a5fc810..a36992d5 100644
--- a/types/wlr_idle_inhibit_v1.c
+++ b/types/wlr_idle_inhibit_v1.c
@@ -8,9 +8,9 @@
#include "wayland-server.h"
#include "idle-inhibit-unstable-v1-protocol.h"
-static struct zwp_idle_inhibit_manager_v1_interface idle_inhibit_impl;
+static const struct zwp_idle_inhibit_manager_v1_interface idle_inhibit_impl;
-static struct zwp_idle_inhibitor_v1_interface idle_inhibitor_impl;
+static const struct zwp_idle_inhibitor_v1_interface idle_inhibitor_impl;
static struct wlr_idle_inhibit_manager_v1 *
wlr_idle_inhibit_manager_v1_from_resource(struct wl_resource *resource) {
@@ -50,11 +50,11 @@ static void idle_inhibitor_v1_handle_destroy(struct wl_client *client,
wl_resource_destroy(manager_resource);
}
-static struct zwp_idle_inhibitor_v1_interface idle_inhibitor_impl = {
+static const struct zwp_idle_inhibitor_v1_interface idle_inhibitor_impl = {
.destroy = idle_inhibitor_v1_handle_destroy,
};
-static void wlr_create_inhibitor(struct wl_client *client,
+static void manager_create_inhibitor(struct wl_client *client,
struct wl_resource *resource, uint32_t id,
struct wl_resource *surface_resource) {
struct wlr_surface *surface = wlr_surface_from_resource(surface_resource);
@@ -96,14 +96,14 @@ static void idle_inhibit_manager_v1_destroy(struct wl_resource *resource) {
wl_list_remove(wl_resource_get_link(resource));
}
-static void idle_inhibit_manager_v1_handle_destroy(struct wl_client *client,
+static void manager_destroy(struct wl_client *client,
struct wl_resource *manager_resource) {
wl_resource_destroy(manager_resource);
}
-static struct zwp_idle_inhibit_manager_v1_interface idle_inhibit_impl = {
- .destroy = idle_inhibit_manager_v1_handle_destroy,
- .create_inhibitor = wlr_create_inhibitor,
+static const struct zwp_idle_inhibit_manager_v1_interface idle_inhibit_impl = {
+ .destroy = manager_destroy,
+ .create_inhibitor = manager_create_inhibitor,
};
static void handle_display_destroy(struct wl_listener *listener, void *data) {
diff --git a/types/wlr_layer_shell.c b/types/wlr_layer_shell.c
index 61ab5c14..676ed06d 100644
--- a/types/wlr_layer_shell.c
+++ b/types/wlr_layer_shell.c
@@ -183,6 +183,7 @@ static void layer_surface_destroy(struct wlr_layer_surface *surface) {
wl_list_init(&surface->surface_destroy_listener.link);
wlr_surface_set_role_committed(surface->surface, NULL, NULL);
wl_list_remove(&surface->link);
+ free(surface->namespace);
free(surface);
}
@@ -194,7 +195,7 @@ static void layer_surface_resource_destroy(struct wl_resource *resource) {
}
}
-static bool wlr_layer_surface_state_changed(struct wlr_layer_surface *surface) {
+static bool layer_surface_state_changed(struct wlr_layer_surface *surface) {
struct wlr_layer_surface_state *state;
if (wl_list_empty(&surface->configure_list)) {
if (surface->acked_configure) {
@@ -219,7 +220,7 @@ void wlr_layer_surface_configure(struct wlr_layer_surface *surface,
uint32_t width, uint32_t height) {
surface->server_pending.actual_width = width;
surface->server_pending.actual_height = height;
- if (wlr_layer_surface_state_changed(surface)) {
+ if (layer_surface_state_changed(surface)) {
struct wl_display *display =
wl_client_get_display(wl_resource_get_client(surface->resource));
struct wlr_layer_surface_configure *configure =
@@ -248,7 +249,7 @@ void wlr_layer_surface_close(struct wlr_layer_surface *surface) {
zwlr_layer_surface_v1_send_closed(surface->resource);
}
-static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
+static void handle_surface_committed(struct wlr_surface *wlr_surface,
void *role_data) {
struct wlr_layer_surface *surface = role_data;
@@ -302,7 +303,7 @@ static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
}
}
-static void handle_wlr_surface_destroyed(struct wl_listener *listener,
+static void handle_surface_destroyed(struct wl_listener *listener,
void *data) {
struct wlr_layer_surface *layer_surface =
wl_container_of(listener, layer_surface, surface_destroy_listener);
@@ -336,22 +337,28 @@ static void layer_shell_handle_get_layer_surface(struct wl_client *wl_client,
if (output_resource) {
surface->output = wlr_output_from_resource(output_resource);
}
- surface->resource = wl_resource_create(wl_client,
- &zwlr_layer_surface_v1_interface,
- wl_resource_get_version(client_resource),
- id);
- surface->namespace = strdup(namespace);
surface->layer = layer;
- if (surface->resource == NULL || surface->namespace == NULL) {
- free(surface);
- wl_client_post_no_memory(wl_client);
- return;
- }
if (layer > ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY) {
+ free(surface);
wl_resource_post_error(surface->resource,
ZWLR_LAYER_SHELL_V1_ERROR_INVALID_LAYER,
"Invalid layer %d", layer);
+ return;
+ }
+ surface->namespace = strdup(namespace);
+ if (surface->namespace == NULL) {
free(surface);
+ wl_client_post_no_memory(wl_client);
+ return;
+ }
+ surface->resource = wl_resource_create(wl_client,
+ &zwlr_layer_surface_v1_interface,
+ wl_resource_get_version(client_resource),
+ id);
+ if (surface->resource == NULL) {
+ free(surface->namespace);
+ free(surface);
+ wl_client_post_no_memory(wl_client);
return;
}
@@ -361,13 +368,13 @@ static void layer_shell_handle_get_layer_surface(struct wl_client *wl_client,
wl_signal_init(&surface->events.destroy);
wl_signal_add(&surface->surface->events.destroy,
&surface->surface_destroy_listener);
- surface->surface_destroy_listener.notify = handle_wlr_surface_destroyed;
+ surface->surface_destroy_listener.notify = handle_surface_destroyed;
wl_signal_init(&surface->events.map);
wl_signal_init(&surface->events.unmap);
wl_signal_init(&surface->events.new_popup);
wlr_surface_set_role_committed(surface->surface,
- handle_wlr_surface_committed, surface);
+ handle_surface_committed, surface);
wlr_log(L_DEBUG, "new layer_surface %p (res %p)",
surface, surface->resource);
diff --git a/types/wlr_output.c b/types/wlr_output.c
index 9cb3b6de..a8361ead 100644
--- a/types/wlr_output.c
+++ b/types/wlr_output.c
@@ -48,7 +48,7 @@ static void wl_output_send_to_resource(struct wl_resource *resource) {
}
}
-static void wlr_output_send_current_mode_to_resource(
+static void output_send_current_mode_to_resource(
struct wl_resource *resource) {
struct wlr_output *output = wlr_output_from_resource(resource);
const uint32_t version = wl_resource_get_version(resource);
@@ -138,7 +138,7 @@ void wlr_output_update_enabled(struct wlr_output *output, bool enabled) {
wlr_signal_emit_safe(&output->events.enable, output);
}
-static void wlr_output_update_matrix(struct wlr_output *output) {
+static void output_update_matrix(struct wlr_output *output) {
wlr_matrix_projection(output->transform_matrix, output->width,
output->height, output->transform);
}
@@ -185,13 +185,13 @@ void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
output->width = width;
output->height = height;
- wlr_output_update_matrix(output);
+ output_update_matrix(output);
output->refresh = refresh;
struct wl_resource *resource;
wl_resource_for_each(resource, &output->wl_resources) {
- wlr_output_send_current_mode_to_resource(resource);
+ output_send_current_mode_to_resource(resource);
}
wlr_signal_emit_safe(&output->events.mode, output);
@@ -200,7 +200,7 @@ void wlr_output_update_custom_mode(struct wlr_output *output, int32_t width,
void wlr_output_set_transform(struct wlr_output *output,
enum wl_output_transform transform) {
output->impl->transform(output, transform);
- wlr_output_update_matrix(output);
+ output_update_matrix(output);
// TODO: only send geometry and done
struct wl_resource *resource;
diff --git a/types/wlr_output_layout.c b/types/wlr_output_layout.c
index 1a06f71e..38329a48 100644
--- a/types/wlr_output_layout.c
+++ b/types/wlr_output_layout.c
@@ -45,7 +45,7 @@ struct wlr_output_layout *wlr_output_layout_create() {
return layout;
}
-static void wlr_output_layout_output_destroy(
+static void output_layout_output_destroy(
struct wlr_output_layout_output *l_output) {
wlr_signal_emit_safe(&l_output->events.destroy, l_output);
wlr_output_destroy_global(l_output->output);
@@ -67,14 +67,14 @@ void wlr_output_layout_destroy(struct wlr_output_layout *layout) {
struct wlr_output_layout_output *l_output, *temp;
wl_list_for_each_safe(l_output, temp, &layout->outputs, link) {
- wlr_output_layout_output_destroy(l_output);
+ output_layout_output_destroy(l_output);
}
free(layout->state);
free(layout);
}
-static struct wlr_box *wlr_output_layout_output_get_box(
+static struct wlr_box *output_layout_output_get_box(
struct wlr_output_layout_output *l_output) {
l_output->state->_box.x = l_output->x;
l_output->state->_box.y = l_output->y;
@@ -92,7 +92,7 @@ static struct wlr_box *wlr_output_layout_output_get_box(
* Auto configured outputs are placed to the right of the north east corner of
* the rightmost output in the layout in a horizontal line.
*/
-static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) {
+static void output_layout_reconfigure(struct wlr_output_layout *layout) {
int max_x = INT_MIN;
int max_x_y = INT_MIN; // y value for the max_x output
@@ -104,7 +104,7 @@ static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) {
continue;
}
- struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
+ struct wlr_box *box = output_layout_output_get_box(l_output);
if (box->x + box->width > max_x) {
max_x = box->x + box->width;
max_x_y = box->y;
@@ -121,7 +121,7 @@ static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) {
if (!l_output->state->auto_configured) {
continue;
}
- struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
+ struct wlr_box *box = output_layout_output_get_box(l_output);
l_output->x = max_x;
l_output->y = max_x_y;
max_x += box->width;
@@ -137,30 +137,30 @@ static void wlr_output_layout_reconfigure(struct wlr_output_layout *layout) {
static void handle_output_mode(struct wl_listener *listener, void *data) {
struct wlr_output_layout_output_state *state =
wl_container_of(listener, state, mode);
- wlr_output_layout_reconfigure(state->layout);
+ output_layout_reconfigure(state->layout);
}
static void handle_output_scale(struct wl_listener *listener, void *data) {
struct wlr_output_layout_output_state *state =
wl_container_of(listener, state, scale);
- wlr_output_layout_reconfigure(state->layout);
+ output_layout_reconfigure(state->layout);
}
static void handle_output_transform(struct wl_listener *listener, void *data) {
struct wlr_output_layout_output_state *state =
wl_container_of(listener, state, transform);
- wlr_output_layout_reconfigure(state->layout);
+ output_layout_reconfigure(state->layout);
}
static void handle_output_destroy(struct wl_listener *listener, void *data) {
struct wlr_output_layout_output_state *state =
wl_container_of(listener, state, output_destroy);
struct wlr_output_layout *layout = state->layout;
- wlr_output_layout_output_destroy(state->l_output);
- wlr_output_layout_reconfigure(layout);
+ output_layout_output_destroy(state->l_output);
+ output_layout_reconfigure(layout);
}
-static struct wlr_output_layout_output *wlr_output_layout_output_create(
+static struct wlr_output_layout_output *output_layout_output_create(
struct wlr_output_layout *layout, struct wlr_output *output) {
struct wlr_output_layout_output *l_output =
calloc(1, sizeof(struct wlr_output_layout_output));
@@ -195,7 +195,7 @@ void wlr_output_layout_add(struct wlr_output_layout *layout,
struct wlr_output_layout_output *l_output =
wlr_output_layout_get(layout, output);
if (!l_output) {
- l_output = wlr_output_layout_output_create(layout, output);
+ l_output = output_layout_output_create(layout, output);
if (!l_output) {
wlr_log(L_ERROR, "Failed to create wlr_output_layout_output");
return;
@@ -204,7 +204,7 @@ void wlr_output_layout_add(struct wlr_output_layout *layout,
l_output->x = lx;
l_output->y = ly;
l_output->state->auto_configured = false;
- wlr_output_layout_reconfigure(layout);
+ output_layout_reconfigure(layout);
wlr_output_create_global(output);
wlr_signal_emit_safe(&layout->events.add, l_output);
}
@@ -225,7 +225,7 @@ bool wlr_output_layout_contains_point(struct wlr_output_layout *layout,
if (reference) {
struct wlr_output_layout_output *l_output =
wlr_output_layout_get(layout, reference);
- struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
+ struct wlr_box *box = output_layout_output_get_box(l_output);
return wlr_box_contains_point(box, lx, ly);
} else {
return !!wlr_output_layout_output_at(layout, lx, ly);
@@ -240,7 +240,7 @@ bool wlr_output_layout_intersects(struct wlr_output_layout *layout,
struct wlr_output_layout_output *l_output;
wl_list_for_each(l_output, &layout->outputs, link) {
struct wlr_box *output_box =
- wlr_output_layout_output_get_box(l_output);
+ output_layout_output_get_box(l_output);
if (wlr_box_intersection(output_box, target_lbox, &out_box)) {
return true;
}
@@ -253,7 +253,7 @@ bool wlr_output_layout_intersects(struct wlr_output_layout *layout,
return false;
}
- struct wlr_box *output_box = wlr_output_layout_output_get_box(l_output);
+ struct wlr_box *output_box = output_layout_output_get_box(l_output);
return wlr_box_intersection(output_box, target_lbox, &out_box);
}
}
@@ -262,7 +262,7 @@ struct wlr_output *wlr_output_layout_output_at(struct wlr_output_layout *layout,
double lx, double ly) {
struct wlr_output_layout_output *l_output;
wl_list_for_each(l_output, &layout->outputs, link) {
- struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
+ struct wlr_box *box = output_layout_output_get_box(l_output);
if (wlr_box_contains_point(box, lx, ly)) {
return l_output->output;
}
@@ -278,7 +278,7 @@ void wlr_output_layout_move(struct wlr_output_layout *layout,
l_output->x = lx;
l_output->y = ly;
l_output->state->auto_configured = false;
- wlr_output_layout_reconfigure(layout);
+ output_layout_reconfigure(layout);
} else {
wlr_log(L_ERROR, "output not found in this layout: %s", output->name);
}
@@ -289,8 +289,8 @@ void wlr_output_layout_remove(struct wlr_output_layout *layout,
struct wlr_output_layout_output *l_output =
wlr_output_layout_get(layout, output);
if (l_output) {
- wlr_output_layout_output_destroy(l_output);
- wlr_output_layout_reconfigure(layout);
+ output_layout_output_destroy(l_output);
+ output_layout_reconfigure(layout);
}
}
@@ -325,7 +325,7 @@ void wlr_output_layout_closest_point(struct wlr_output_layout *layout,
}
double output_x, output_y, output_distance;
- struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
+ struct wlr_box *box = output_layout_output_get_box(l_output);
wlr_box_closest_point(box, lx, ly, &output_x, &output_y);
// calculate squared distance suitable for comparison
@@ -359,7 +359,7 @@ struct wlr_box *wlr_output_layout_get_box(
l_output = wlr_output_layout_get(layout, reference);
if (l_output) {
- return wlr_output_layout_output_get_box(l_output);
+ return output_layout_output_get_box(l_output);
} else {
return NULL;
}
@@ -368,7 +368,7 @@ struct wlr_box *wlr_output_layout_get_box(
int min_x = INT_MAX, min_y = INT_MAX;
int max_x = INT_MIN, max_y = INT_MIN;
wl_list_for_each(l_output, &layout->outputs, link) {
- struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
+ struct wlr_box *box = output_layout_output_get_box(l_output);
if (box->x < min_x) {
min_x = box->x;
@@ -400,7 +400,7 @@ void wlr_output_layout_add_auto(struct wlr_output_layout *layout,
struct wlr_output_layout_output *l_output =
wlr_output_layout_get(layout, output);
if (!l_output) {
- l_output = wlr_output_layout_output_create(layout, output);
+ l_output = output_layout_output_create(layout, output);
if (!l_output) {
wlr_log(L_ERROR, "Failed to create wlr_output_layout_output");
return;
@@ -408,7 +408,7 @@ void wlr_output_layout_add_auto(struct wlr_output_layout *layout,
}
l_output->state->auto_configured = true;
- wlr_output_layout_reconfigure(layout);
+ output_layout_reconfigure(layout);
wlr_output_create_global(output);
wlr_signal_emit_safe(&layout->events.add, l_output);
}
@@ -445,7 +445,7 @@ struct wlr_output *wlr_output_layout_adjacent_output(
if (reference != NULL && reference == l_output->output) {
continue;
}
- struct wlr_box *box = wlr_output_layout_output_get_box(l_output);
+ struct wlr_box *box = output_layout_output_get_box(l_output);
bool match = false;
// test to make sure this output is in the given direction
diff --git a/types/wlr_region.c b/types/wlr_region.c
index 6309c1a9..860864c1 100644
--- a/types/wlr_region.c
+++ b/types/wlr_region.c
@@ -32,18 +32,19 @@ static const struct wl_region_interface region_impl = {
.subtract = region_subtract,
};
-static void destroy_region(struct wl_resource *resource) {
+static void region_handle_resource_destroy(struct wl_resource *resource) {
pixman_region32_t *reg = wlr_region_from_resource(resource);
pixman_region32_fini(reg);
free(reg);
+
+ // Set by wlr_compositor
+ wl_list_remove(wl_resource_get_link(resource));
}
-void wlr_region_create(struct wl_client *client, struct wl_resource *res,
- uint32_t id) {
+struct wl_resource *wlr_region_create(struct wl_client *client, uint32_t id) {
pixman_region32_t *region = calloc(1, sizeof(pixman_region32_t));
if (region == NULL) {
- wl_resource_post_no_memory(res);
- return;
+ return NULL;
}
pixman_region32_init(region);
@@ -52,11 +53,11 @@ void wlr_region_create(struct wl_client *client, struct wl_resource *res,
&wl_region_interface, 1, id);
if (region_resource == NULL) {
free(region);
- wl_resource_post_no_memory(res);
- return;
+ return NULL;
}
wl_resource_set_implementation(region_resource, &region_impl, region,
- destroy_region);
+ region_handle_resource_destroy);
+ return region_resource;
}
pixman_region32_t *wlr_region_from_resource(struct wl_resource *resource) {
diff --git a/types/wlr_seat.c b/types/wlr_seat.c
index 5e5de235..f77a492d 100644
--- a/types/wlr_seat.c
+++ b/types/wlr_seat.c
@@ -185,7 +185,7 @@ static void wl_seat_get_touch(struct wl_client *client,
wl_list_insert(&seat_client->touches, wl_resource_get_link(resource));
}
-static void wlr_seat_client_resource_destroy(struct wl_resource *seat_resource) {
+static void seat_client_resource_destroy(struct wl_resource *seat_resource) {
struct wlr_seat_client *client =
wlr_seat_client_from_resource(seat_resource);
wlr_signal_emit_safe(&client->events.destroy, client);
@@ -251,7 +251,7 @@ static void wl_seat_bind(struct wl_client *client, void *_wlr_seat,
wl_list_init(&seat_client->data_devices);
wl_list_init(&seat_client->primary_selection_devices);
wl_resource_set_implementation(seat_client->wl_resource, &wl_seat_impl,
- seat_client, wlr_seat_client_resource_destroy);
+ seat_client, seat_client_resource_destroy);
wl_list_insert(&wlr_seat->clients, &seat_client->link);
if (version >= WL_SEAT_NAME_SINCE_VERSION) {
wl_seat_send_name(seat_client->wl_resource, wlr_seat->name);
diff --git a/types/wlr_surface.c b/types/wlr_surface.c
index 9c0324a0..e228574a 100644
--- a/types/wlr_surface.c
+++ b/types/wlr_surface.c
@@ -11,7 +11,7 @@
#include <wlr/util/region.h>
#include "util/signal.h"
-static void wlr_surface_state_reset_buffer(struct wlr_surface_state *state) {
+static void surface_state_reset_buffer(struct wlr_surface_state *state) {
if (state->buffer) {
wl_list_remove(&state->buffer_destroy_listener.link);
state->buffer = NULL;
@@ -26,7 +26,7 @@ static void buffer_destroy(struct wl_listener *listener, void *data) {
state->buffer = NULL;
}
-static void wlr_surface_state_release_buffer(struct wlr_surface_state *state) {
+static void surface_state_release_buffer(struct wlr_surface_state *state) {
if (state->buffer) {
wl_resource_post_event(state->buffer, WL_BUFFER_RELEASE);
wl_list_remove(&state->buffer_destroy_listener.link);
@@ -34,7 +34,7 @@ static void wlr_surface_state_release_buffer(struct wlr_surface_state *state) {
}
}
-static void wlr_surface_state_set_buffer(struct wlr_surface_state *state,
+static void surface_state_set_buffer(struct wlr_surface_state *state,
struct wl_resource *buffer) {
state->buffer = buffer;
if (buffer) {
@@ -57,8 +57,8 @@ static void surface_attach(struct wl_client *client,
surface->pending->invalid |= WLR_SURFACE_INVALID_BUFFER;
surface->pending->sx = sx;
surface->pending->sy = sy;
- wlr_surface_state_reset_buffer(surface->pending);
- wlr_surface_state_set_buffer(surface->pending, buffer);
+ surface_state_reset_buffer(surface->pending);
+ surface_state_set_buffer(surface->pending, buffer);
}
static void surface_damage(struct wl_client *client,
@@ -143,7 +143,7 @@ static void surface_set_input_region(struct wl_client *client,
}
}
-static bool wlr_surface_update_size(struct wlr_surface *surface,
+static bool surface_update_size(struct wlr_surface *surface,
struct wlr_surface_state *state) {
if (!state->buffer) {
pixman_region32_union_rect(&state->surface_damage,
@@ -207,7 +207,7 @@ static bool wlr_surface_update_size(struct wlr_surface *surface,
/**
* Append pending state to current state and clear pending state.
*/
-static void wlr_surface_move_state(struct wlr_surface *surface,
+static void surface_move_state(struct wlr_surface *surface,
struct wlr_surface_state *next, struct wlr_surface_state *state) {
bool update_damage = false;
bool update_size = false;
@@ -224,15 +224,15 @@ static void wlr_surface_move_state(struct wlr_surface *surface,
update_size = true;
}
if ((next->invalid & WLR_SURFACE_INVALID_BUFFER)) {
- wlr_surface_state_release_buffer(state);
- wlr_surface_state_set_buffer(state, next->buffer);
- wlr_surface_state_reset_buffer(next);
+ surface_state_release_buffer(state);
+ surface_state_set_buffer(state, next->buffer);
+ surface_state_reset_buffer(next);
state->sx = next->sx;
state->sy = next->sy;
update_size = true;
}
if (update_size) {
- update_damage = wlr_surface_update_size(surface, state);
+ update_damage = surface_update_size(surface, state);
}
if ((next->invalid & WLR_SURFACE_INVALID_SURFACE_DAMAGE)) {
pixman_region32_intersect_rect(&next->surface_damage,
@@ -312,7 +312,7 @@ static void wlr_surface_move_state(struct wlr_surface *surface,
next->invalid = 0;
}
-static void wlr_surface_damage_subsurfaces(struct wlr_subsurface *subsurface) {
+static void surface_damage_subsurfaces(struct wlr_subsurface *subsurface) {
// XXX: This is probably the wrong way to do it, because this damage should
// come from the client, but weston doesn't do it correctly either and it
// seems to work ok. See the comment on weston_surface_damage for more info
@@ -327,11 +327,11 @@ static void wlr_surface_damage_subsurfaces(struct wlr_subsurface *subsurface) {
struct wlr_subsurface *child;
wl_list_for_each(child, &subsurface->surface->subsurfaces, parent_link) {
- wlr_surface_damage_subsurfaces(child);
+ surface_damage_subsurfaces(child);
}
}
-static void wlr_surface_apply_damage(struct wlr_surface *surface,
+static void surface_apply_damage(struct wlr_surface *surface,
bool invalid_buffer, bool reupload_buffer) {
struct wl_resource *resource = surface->current->buffer;
if (resource == NULL) {
@@ -392,17 +392,17 @@ static void wlr_surface_apply_damage(struct wlr_surface *surface,
}
}
- wlr_surface_state_release_buffer(surface->current);
+ surface_state_release_buffer(surface->current);
}
-static void wlr_surface_commit_pending(struct wlr_surface *surface) {
+static void surface_commit_pending(struct wlr_surface *surface) {
int32_t oldw = surface->current->buffer_width;
int32_t oldh = surface->current->buffer_height;
bool invalid_buffer = surface->pending->invalid & WLR_SURFACE_INVALID_BUFFER;
bool null_buffer_commit = invalid_buffer && surface->pending->buffer == NULL;
- wlr_surface_move_state(surface, surface->pending, surface->current);
+ surface_move_state(surface, surface->pending, surface->current);
if (null_buffer_commit) {
wlr_texture_destroy(surface->texture);
@@ -411,7 +411,7 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) {
bool reupload_buffer = oldw != surface->current->buffer_width ||
oldh != surface->current->buffer_height;
- wlr_surface_apply_damage(surface, invalid_buffer, reupload_buffer);
+ surface_apply_damage(surface, invalid_buffer, reupload_buffer);
// commit subsurface order
struct wlr_subsurface *subsurface;
@@ -422,7 +422,7 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) {
if (subsurface->reordered) {
// TODO: damage all the subsurfaces
- wlr_surface_damage_subsurfaces(subsurface);
+ surface_damage_subsurfaces(subsurface);
}
}
@@ -437,7 +437,7 @@ static void wlr_surface_commit_pending(struct wlr_surface *surface) {
pixman_region32_clear(&surface->current->buffer_damage);
}
-static bool wlr_subsurface_is_synchronized(struct wlr_subsurface *subsurface) {
+static bool subsurface_is_synchronized(struct wlr_subsurface *subsurface) {
while (1) {
if (subsurface->synchronized) {
return true;
@@ -459,43 +459,43 @@ static bool wlr_subsurface_is_synchronized(struct wlr_subsurface *subsurface) {
/**
* Recursive function to commit the effectively synchronized children.
*/
-static void wlr_subsurface_parent_commit(struct wlr_subsurface *subsurface,
+static void subsurface_parent_commit(struct wlr_subsurface *subsurface,
bool synchronized) {
struct wlr_surface *surface = subsurface->surface;
if (synchronized || subsurface->synchronized) {
if (subsurface->has_cache) {
- wlr_surface_move_state(surface, subsurface->cached, surface->pending);
- wlr_surface_commit_pending(surface);
+ surface_move_state(surface, subsurface->cached, surface->pending);
+ surface_commit_pending(surface);
subsurface->has_cache = false;
subsurface->cached->invalid = 0;
}
struct wlr_subsurface *tmp;
wl_list_for_each(tmp, &surface->subsurfaces, parent_link) {
- wlr_subsurface_parent_commit(tmp, true);
+ subsurface_parent_commit(tmp, true);
}
}
}
-static void wlr_subsurface_commit(struct wlr_subsurface *subsurface) {
+static void subsurface_commit(struct wlr_subsurface *subsurface) {
struct wlr_surface *surface = subsurface->surface;
- if (wlr_subsurface_is_synchronized(subsurface)) {
- wlr_surface_move_state(surface, surface->pending, subsurface->cached);
+ if (subsurface_is_synchronized(subsurface)) {
+ surface_move_state(surface, surface->pending, subsurface->cached);
subsurface->has_cache = true;
} else {
if (subsurface->has_cache) {
- wlr_surface_move_state(surface, subsurface->cached, surface->pending);
- wlr_surface_commit_pending(surface);
+ surface_move_state(surface, subsurface->cached, surface->pending);
+ surface_commit_pending(surface);
subsurface->has_cache = false;
} else {
- wlr_surface_commit_pending(surface);
+ surface_commit_pending(surface);
}
struct wlr_subsurface *tmp;
wl_list_for_each(tmp, &surface->subsurfaces, parent_link) {
- wlr_subsurface_parent_commit(tmp, false);
+ subsurface_parent_commit(tmp, false);
}
}
}
@@ -507,15 +507,15 @@ static void surface_commit(struct wl_client *client,
if (wlr_surface_is_subsurface(surface)) {
struct wlr_subsurface *subsurface =
wlr_subsurface_from_surface(surface);
- wlr_subsurface_commit(subsurface);
+ subsurface_commit(subsurface);
return;
}
- wlr_surface_commit_pending(surface);
+ surface_commit_pending(surface);
struct wlr_subsurface *tmp;
wl_list_for_each(tmp, &surface->subsurfaces, parent_link) {
- wlr_subsurface_parent_commit(tmp, false);
+ subsurface_parent_commit(tmp, false);
}
}
@@ -567,7 +567,7 @@ struct wlr_surface *wlr_surface_from_resource(struct wl_resource *resource) {
return wl_resource_get_user_data(resource);
}
-static struct wlr_surface_state *wlr_surface_state_create() {
+static struct wlr_surface_state *surface_state_create() {
struct wlr_surface_state *state =
calloc(1, sizeof(struct wlr_surface_state));
if (state == NULL) {
@@ -588,8 +588,8 @@ static struct wlr_surface_state *wlr_surface_state_create() {
return state;
}
-static void wlr_surface_state_destroy(struct wlr_surface_state *state) {
- wlr_surface_state_reset_buffer(state);
+static void surface_state_destroy(struct wlr_surface_state *state) {
+ surface_state_reset_buffer(state);
struct wlr_frame_callback *cb, *tmp;
wl_list_for_each_safe(cb, tmp, &state->frame_callback_list, link) {
wl_resource_destroy(cb->resource);
@@ -603,11 +603,11 @@ static void wlr_surface_state_destroy(struct wlr_surface_state *state) {
free(state);
}
-void wlr_subsurface_destroy(struct wlr_subsurface *subsurface) {
+static void subsurface_destroy(struct wlr_subsurface *subsurface) {
wlr_signal_emit_safe(&subsurface->events.destroy, subsurface);
wl_list_remove(&subsurface->surface_destroy.link);
- wlr_surface_state_destroy(subsurface->cached);
+ surface_state_destroy(subsurface->cached);
if (subsurface->parent) {
wl_list_remove(&subsurface->parent_link);
@@ -622,18 +622,25 @@ void wlr_subsurface_destroy(struct wlr_subsurface *subsurface) {
free(subsurface);
}
-static void destroy_surface(struct wl_resource *resource) {
+static void surface_handle_resource_destroy(struct wl_resource *resource) {
struct wlr_surface *surface = wlr_surface_from_resource(resource);
wlr_signal_emit_safe(&surface->events.destroy, surface);
wlr_texture_destroy(surface->texture);
- wlr_surface_state_destroy(surface->pending);
- wlr_surface_state_destroy(surface->current);
+ surface_state_destroy(surface->pending);
+ surface_state_destroy(surface->current);
free(surface);
}
+static void surface_handle_renderer_destroy(struct wl_listener *listener,
+ void *data) {
+ struct wlr_surface *surface =
+ wl_container_of(listener, surface, renderer_destroy);
+ wl_resource_destroy(surface->resource);
+}
+
struct wlr_surface *wlr_surface_create(struct wl_resource *res,
struct wlr_renderer *renderer) {
struct wlr_surface *surface = calloc(1, sizeof(struct wlr_surface));
@@ -645,8 +652,8 @@ struct wlr_surface *wlr_surface_create(struct wl_resource *res,
surface->renderer = renderer;
surface->resource = res;
- surface->current = wlr_surface_state_create();
- surface->pending = wlr_surface_state_create();
+ surface->current = surface_state_create();
+ surface->pending = surface_state_create();
wl_signal_init(&surface->events.commit);
wl_signal_init(&surface->events.destroy);
@@ -654,7 +661,11 @@ struct wlr_surface *wlr_surface_create(struct wl_resource *res,
wl_list_init(&surface->subsurfaces);
wl_list_init(&surface->subsurface_pending_list);
wl_resource_set_implementation(res, &surface_interface,
- surface, destroy_surface);
+ surface, surface_handle_resource_destroy);
+
+ wl_signal_add(&renderer->events.destroy, &surface->renderer_destroy);
+ surface->renderer_destroy.notify = surface_handle_renderer_destroy;
+
return surface;
}
@@ -696,11 +707,11 @@ static void subsurface_resource_destroy(struct wl_resource *resource) {
struct wlr_subsurface *subsurface = subsurface_from_resource(resource);
if (subsurface) {
- wlr_subsurface_destroy(subsurface);
+ subsurface_destroy(subsurface);
}
}
-static void subsurface_destroy(struct wl_client *client,
+static void subsurface_handle_destroy(struct wl_client *client,
struct wl_resource *resource) {
wl_resource_destroy(resource);
}
@@ -794,15 +805,15 @@ static void subsurface_set_desync(struct wl_client *client,
if (subsurface && subsurface->synchronized) {
subsurface->synchronized = false;
- if (!wlr_subsurface_is_synchronized(subsurface)) {
+ if (!subsurface_is_synchronized(subsurface)) {
// TODO: do a synchronized commit to flush the cache
- wlr_subsurface_parent_commit(subsurface, true);
+ subsurface_parent_commit(subsurface, true);
}
}
}
static const struct wl_subsurface_interface subsurface_implementation = {
- .destroy = subsurface_destroy,
+ .destroy = subsurface_handle_destroy,
.set_position = subsurface_set_position,
.place_above = subsurface_place_above,
.place_below = subsurface_place_below,
@@ -824,10 +835,10 @@ static void subsurface_handle_surface_destroy(struct wl_listener *listener,
void *data) {
struct wlr_subsurface *subsurface =
wl_container_of(listener, subsurface, surface_destroy);
- wlr_subsurface_destroy(subsurface);
+ subsurface_destroy(subsurface);
}
-void wlr_surface_make_subsurface(struct wlr_surface *surface,
+struct wlr_subsurface *wlr_surface_make_subsurface(struct wlr_surface *surface,
struct wlr_surface *parent, uint32_t id) {
struct wl_client *client = wl_resource_get_client(surface->resource);
@@ -835,13 +846,13 @@ void wlr_surface_make_subsurface(struct wlr_surface *surface,
calloc(1, sizeof(struct wlr_subsurface));
if (!subsurface) {
wl_client_post_no_memory(client);
- return;
+ return NULL;
}
- subsurface->cached = wlr_surface_state_create();
+ subsurface->cached = surface_state_create();
if (subsurface->cached == NULL) {
free(subsurface);
wl_client_post_no_memory(client);
- return;
+ return NULL;
}
subsurface->synchronized = true;
subsurface->surface = surface;
@@ -860,10 +871,10 @@ void wlr_surface_make_subsurface(struct wlr_surface *surface,
subsurface->resource =
wl_resource_create(client, &wl_subsurface_interface, 1, id);
if (subsurface->resource == NULL) {
- wlr_surface_state_destroy(subsurface->cached);
+ surface_state_destroy(subsurface->cached);
free(subsurface);
wl_client_post_no_memory(client);
- return;
+ return NULL;
}
wl_resource_set_implementation(subsurface->resource,
@@ -873,6 +884,8 @@ void wlr_surface_make_subsurface(struct wlr_surface *surface,
surface->role_data = subsurface;
wlr_signal_emit_safe(&parent->events.new_subsurface, subsurface);
+
+ return subsurface;
}
diff --git a/types/wlr_wl_shell.c b/types/wlr_wl_shell.c
index 5e4c24e7..6010869e 100644
--- a/types/wlr_wl_shell.c
+++ b/types/wlr_wl_shell.c
@@ -461,13 +461,13 @@ static void shell_surface_resource_destroy(struct wl_resource *resource) {
}
}
-static void handle_wlr_surface_destroyed(struct wl_listener *listener,
+static void shell_surface_handle_surface_destroy(struct wl_listener *listener,
void *data) {
struct wlr_wl_shell_surface *surface =
wl_container_of(listener, surface, surface_destroy_listener);
shell_surface_destroy(surface);
}
-static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
+static void handle_surface_committed(struct wlr_surface *wlr_surface,
void *role_data) {
struct wlr_wl_shell_surface *surface = role_data;
if (!surface->configured &&
@@ -556,9 +556,10 @@ static void shell_protocol_get_shell_surface(struct wl_client *client,
wl_signal_add(&wl_surface->surface->events.destroy,
&wl_surface->surface_destroy_listener);
- wl_surface->surface_destroy_listener.notify = handle_wlr_surface_destroyed;
+ wl_surface->surface_destroy_listener.notify =
+ shell_surface_handle_surface_destroy;
- wlr_surface_set_role_committed(surface, handle_wlr_surface_committed,
+ wlr_surface_set_role_committed(surface, handle_surface_committed,
wl_surface);
struct wl_display *display = wl_client_get_display(client);
diff --git a/types/wlr_xdg_shell.c b/types/wlr_xdg_shell.c
index 4c8c9983..fce2a1bb 100644
--- a/types/wlr_xdg_shell.c
+++ b/types/wlr_xdg_shell.c
@@ -122,7 +122,7 @@ static const struct wlr_keyboard_grab_interface xdg_keyboard_grab_impl = {
static void xdg_surface_destroy(struct wlr_xdg_surface *surface);
-static void wlr_xdg_popup_grab_handle_seat_destroy(
+static void xdg_popup_grab_handle_seat_destroy(
struct wl_listener *listener, void *data) {
struct wlr_xdg_popup_grab *xdg_grab =
wl_container_of(listener, xdg_grab, seat_destroy);
@@ -162,7 +162,7 @@ static struct wlr_xdg_popup_grab *xdg_shell_popup_grab_from_seat(
wl_list_insert(&shell->popup_grabs, &xdg_grab->link);
xdg_grab->seat = seat;
- xdg_grab->seat_destroy.notify = wlr_xdg_popup_grab_handle_seat_destroy;
+ xdg_grab->seat_destroy.notify = xdg_popup_grab_handle_seat_destroy;
wl_signal_add(&seat->events.destroy, &xdg_grab->seat_destroy);
return xdg_grab;
@@ -910,7 +910,7 @@ static void xdg_surface_handle_get_toplevel(struct wl_client *client,
xdg_toplevel_resource_destroy);
}
-static void wlr_xdg_toplevel_ack_configure(
+static void xdg_toplevel_ack_configure(
struct wlr_xdg_surface *surface,
struct wlr_xdg_surface_configure *configure) {
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
@@ -961,7 +961,7 @@ static void xdg_surface_handle_ack_configure(struct wl_client *client,
assert(0 && "not reached");
break;
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
- wlr_xdg_toplevel_ack_configure(surface, configure);
+ xdg_toplevel_ack_configure(surface, configure);
break;
case WLR_XDG_SURFACE_ROLE_POPUP:
break;
@@ -1013,7 +1013,7 @@ static const struct xdg_surface_interface xdg_surface_implementation = {
.set_window_geometry = xdg_surface_handle_set_window_geometry,
};
-static bool wlr_xdg_surface_toplevel_state_compare(
+static bool xdg_surface_toplevel_state_compare(
struct wlr_xdg_toplevel *state) {
struct {
struct wlr_xdg_toplevel_state state;
@@ -1063,7 +1063,7 @@ static bool wlr_xdg_surface_toplevel_state_compare(
return false;
}
-static void wlr_xdg_toplevel_send_configure(
+static void toplevel_send_configure(
struct wlr_xdg_surface *surface,
struct wlr_xdg_surface_configure *configure) {
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
@@ -1125,7 +1125,7 @@ error_out:
wl_resource_post_no_memory(surface->toplevel->resource);
}
-static void wlr_xdg_surface_send_configure(void *user_data) {
+static void surface_send_configure(void *user_data) {
struct wlr_xdg_surface *surface = user_data;
surface->configure_idle = NULL;
@@ -1145,7 +1145,7 @@ static void wlr_xdg_surface_send_configure(void *user_data) {
assert(0 && "not reached");
break;
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
- wlr_xdg_toplevel_send_configure(surface, configure);
+ toplevel_send_configure(surface, configure);
break;
case WLR_XDG_SURFACE_ROLE_POPUP:
xdg_popup_send_configure(surface->popup->resource,
@@ -1159,7 +1159,7 @@ static void wlr_xdg_surface_send_configure(void *user_data) {
xdg_surface_send_configure(surface->resource, configure->serial);
}
-static uint32_t wlr_xdg_surface_schedule_configure(
+static uint32_t xdg_surface_schedule_configure(
struct wlr_xdg_surface *surface) {
struct wl_display *display = wl_client_get_display(surface->client->client);
struct wl_event_loop *loop = wl_display_get_event_loop(display);
@@ -1171,7 +1171,7 @@ static uint32_t wlr_xdg_surface_schedule_configure(
break;
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
pending_same =
- wlr_xdg_surface_toplevel_state_compare(surface->toplevel);
+ xdg_surface_toplevel_state_compare(surface->toplevel);
break;
case WLR_XDG_SURFACE_ROLE_POPUP:
break;
@@ -1195,26 +1195,26 @@ static uint32_t wlr_xdg_surface_schedule_configure(
surface->configure_next_serial = wl_display_next_serial(display);
surface->configure_idle = wl_event_loop_add_idle(loop,
- wlr_xdg_surface_send_configure, surface);
+ surface_send_configure, surface);
return surface->configure_next_serial;
}
}
-static void handle_wlr_surface_destroyed(struct wl_listener *listener,
+static void xdg_surface_handle_surface_destroy(struct wl_listener *listener,
void *data) {
struct wlr_xdg_surface *xdg_surface =
wl_container_of(listener, xdg_surface, surface_destroy_listener);
xdg_surface_destroy(xdg_surface);
}
-static void wlr_xdg_surface_toplevel_committed(
+static void xdg_surface_toplevel_committed(
struct wlr_xdg_surface *surface) {
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
if (!surface->toplevel->added) {
// on the first commit, send a configure request to tell the client it
// is added
- wlr_xdg_surface_schedule_configure(surface);
+ xdg_surface_schedule_configure(surface);
surface->toplevel->added = true;
return;
}
@@ -1230,7 +1230,7 @@ static void wlr_xdg_surface_toplevel_committed(
surface->toplevel->client_pending.min_height;
}
-static void wlr_xdg_surface_popup_committed(
+static void xdg_surface_popup_committed(
struct wlr_xdg_surface *surface) {
assert(surface->role == WLR_XDG_SURFACE_ROLE_POPUP);
@@ -1242,12 +1242,12 @@ static void wlr_xdg_surface_popup_committed(
}
if (!surface->popup->committed) {
- wlr_xdg_surface_schedule_configure(surface);
+ xdg_surface_schedule_configure(surface);
surface->popup->committed = true;
}
}
-static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
+static void handle_surface_committed(struct wlr_surface *wlr_surface,
void *role_data) {
struct wlr_xdg_surface *surface = role_data;
@@ -1273,10 +1273,10 @@ static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
"xdg_surface must have a role");
break;
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
- wlr_xdg_surface_toplevel_committed(surface);
+ xdg_surface_toplevel_committed(surface);
break;
case WLR_XDG_SURFACE_ROLE_POPUP:
- wlr_xdg_surface_popup_committed(surface);
+ xdg_surface_popup_committed(surface);
break;
}
@@ -1350,10 +1350,11 @@ static void xdg_shell_handle_get_xdg_surface(struct wl_client *wl_client,
wl_signal_add(&surface->surface->events.destroy,
&surface->surface_destroy_listener);
- surface->surface_destroy_listener.notify = handle_wlr_surface_destroyed;
+ surface->surface_destroy_listener.notify =
+ xdg_surface_handle_surface_destroy;
wlr_surface_set_role_committed(surface->surface,
- handle_wlr_surface_committed, surface);
+ handle_surface_committed, surface);
wlr_log(L_DEBUG, "new xdg_surface %p (res %p)", surface, surface->resource);
wl_resource_set_implementation(surface->resource,
@@ -1394,7 +1395,7 @@ static const struct xdg_wm_base_interface xdg_shell_impl = {
.pong = xdg_shell_handle_pong,
};
-static void wlr_xdg_client_destroy(struct wl_resource *resource) {
+static void xdg_client_handle_resource_destroy(struct wl_resource *resource) {
struct wlr_xdg_client *client = xdg_client_from_resource(resource);
struct wlr_xdg_surface *surface, *tmp = NULL;
@@ -1410,7 +1411,7 @@ static void wlr_xdg_client_destroy(struct wl_resource *resource) {
free(client);
}
-static int wlr_xdg_client_ping_timeout(void *user_data) {
+static int xdg_client_ping_timeout(void *user_data) {
struct wlr_xdg_client *client = user_data;
struct wlr_xdg_surface *surface;
@@ -1447,13 +1448,13 @@ static void xdg_shell_bind(struct wl_client *wl_client, void *data,
client->shell = xdg_shell;
wl_resource_set_implementation(client->resource, &xdg_shell_impl, client,
- wlr_xdg_client_destroy);
+ xdg_client_handle_resource_destroy);
wl_list_insert(&xdg_shell->clients, &client->link);
struct wl_display *display = wl_client_get_display(client->client);
struct wl_event_loop *loop = wl_display_get_event_loop(display);
client->ping_timer = wl_event_loop_add_timer(loop,
- wlr_xdg_client_ping_timeout, client);
+ xdg_client_ping_timeout, client);
if (client->ping_timer == NULL) {
wl_client_post_no_memory(client->client);
}
@@ -1522,7 +1523,7 @@ uint32_t wlr_xdg_toplevel_set_size(struct wlr_xdg_surface *surface,
surface->toplevel->server_pending.width = width;
surface->toplevel->server_pending.height = height;
- return wlr_xdg_surface_schedule_configure(surface);
+ return xdg_surface_schedule_configure(surface);
}
uint32_t wlr_xdg_toplevel_set_activated(struct wlr_xdg_surface *surface,
@@ -1530,7 +1531,7 @@ uint32_t wlr_xdg_toplevel_set_activated(struct wlr_xdg_surface *surface,
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
surface->toplevel->server_pending.activated = activated;
- return wlr_xdg_surface_schedule_configure(surface);
+ return xdg_surface_schedule_configure(surface);
}
uint32_t wlr_xdg_toplevel_set_maximized(struct wlr_xdg_surface *surface,
@@ -1538,7 +1539,7 @@ uint32_t wlr_xdg_toplevel_set_maximized(struct wlr_xdg_surface *surface,
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
surface->toplevel->server_pending.maximized = maximized;
- return wlr_xdg_surface_schedule_configure(surface);
+ return xdg_surface_schedule_configure(surface);
}
uint32_t wlr_xdg_toplevel_set_fullscreen(struct wlr_xdg_surface *surface,
@@ -1546,7 +1547,7 @@ uint32_t wlr_xdg_toplevel_set_fullscreen(struct wlr_xdg_surface *surface,
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
surface->toplevel->server_pending.fullscreen = fullscreen;
- return wlr_xdg_surface_schedule_configure(surface);
+ return xdg_surface_schedule_configure(surface);
}
uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_surface *surface,
@@ -1554,7 +1555,7 @@ uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_surface *surface,
assert(surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL);
surface->toplevel->server_pending.resizing = resizing;
- return wlr_xdg_surface_schedule_configure(surface);
+ return xdg_surface_schedule_configure(surface);
}
void wlr_xdg_surface_send_close(struct wlr_xdg_surface *surface) {
@@ -1669,7 +1670,7 @@ void wlr_xdg_popup_get_toplevel_coords(struct wlr_xdg_popup *popup,
}
-static void wlr_xdg_popup_box_constraints(struct wlr_xdg_popup *popup,
+static void xdg_popup_box_constraints(struct wlr_xdg_popup *popup,
struct wlr_box *toplevel_sx_box, int *offset_x, int *offset_y) {
int popup_width = popup->geometry.width;
int popup_height = popup->geometry.height;
@@ -1697,10 +1698,10 @@ static void wlr_xdg_popup_box_constraints(struct wlr_xdg_popup *popup,
}
}
-static bool wlr_xdg_popup_unconstrain_flip(struct wlr_xdg_popup *popup,
+static bool xdg_popup_unconstrain_flip(struct wlr_xdg_popup *popup,
struct wlr_box *toplevel_sx_box) {
int offset_x = 0, offset_y = 0;
- wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
+ xdg_popup_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
if (!offset_x && !offset_y) {
@@ -1725,7 +1726,7 @@ static bool wlr_xdg_popup_unconstrain_flip(struct wlr_xdg_popup *popup,
popup->geometry =
wlr_xdg_positioner_get_geometry(&popup->positioner);
- wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
+ xdg_popup_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
if (!offset_x && !offset_y) {
@@ -1747,10 +1748,10 @@ static bool wlr_xdg_popup_unconstrain_flip(struct wlr_xdg_popup *popup,
return false;
}
-static bool wlr_xdg_popup_unconstrain_slide(struct wlr_xdg_popup *popup,
+static bool xdg_popup_unconstrain_slide(struct wlr_xdg_popup *popup,
struct wlr_box *toplevel_sx_box) {
int offset_x = 0, offset_y = 0;
- wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
+ xdg_popup_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
if (!offset_x && !offset_y) {
@@ -1784,16 +1785,16 @@ static bool wlr_xdg_popup_unconstrain_slide(struct wlr_xdg_popup *popup,
popup->geometry.y += toplevel_sx_box->y - toplevel_y;
}
- wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
+ xdg_popup_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
return !offset_x && !offset_y;
}
-static bool wlr_xdg_popup_unconstrain_resize(struct wlr_xdg_popup *popup,
+static bool xdg_popup_unconstrain_resize(struct wlr_xdg_popup *popup,
struct wlr_box *toplevel_sx_box) {
int offset_x, offset_y;
- wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
+ xdg_popup_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
if (!offset_x && !offset_y) {
@@ -1815,7 +1816,7 @@ static bool wlr_xdg_popup_unconstrain_resize(struct wlr_xdg_popup *popup,
popup->geometry.height -= offset_y;
}
- wlr_xdg_popup_box_constraints(popup, toplevel_sx_box,
+ xdg_popup_box_constraints(popup, toplevel_sx_box,
&offset_y, &offset_y);
return !offset_x && !offset_y;
@@ -1823,13 +1824,13 @@ static bool wlr_xdg_popup_unconstrain_resize(struct wlr_xdg_popup *popup,
void wlr_xdg_popup_unconstrain_from_box(struct wlr_xdg_popup *popup,
struct wlr_box *toplevel_sx_box) {
- if (wlr_xdg_popup_unconstrain_flip(popup, toplevel_sx_box)) {
+ if (xdg_popup_unconstrain_flip(popup, toplevel_sx_box)) {
return;
}
- if (wlr_xdg_popup_unconstrain_slide(popup, toplevel_sx_box)) {
+ if (xdg_popup_unconstrain_slide(popup, toplevel_sx_box)) {
return;
}
- if (wlr_xdg_popup_unconstrain_resize(popup, toplevel_sx_box)) {
+ if (xdg_popup_unconstrain_resize(popup, toplevel_sx_box)) {
return;
}
}
diff --git a/types/wlr_xdg_shell_v6.c b/types/wlr_xdg_shell_v6.c
index 2d0fbe29..8af6204f 100644
--- a/types/wlr_xdg_shell_v6.c
+++ b/types/wlr_xdg_shell_v6.c
@@ -132,7 +132,7 @@ static const struct wlr_keyboard_grab_interface xdg_keyboard_grab_impl = {
static void xdg_surface_destroy(struct wlr_xdg_surface_v6 *surface);
-static void wlr_xdg_popup_grab_handle_seat_destroy(
+static void xdg_popup_grab_handle_seat_destroy(
struct wl_listener *listener, void *data) {
struct wlr_xdg_popup_grab_v6 *xdg_grab =
wl_container_of(listener, xdg_grab, seat_destroy);
@@ -172,7 +172,7 @@ static struct wlr_xdg_popup_grab_v6 *xdg_shell_popup_grab_from_seat(
wl_list_insert(&shell->popup_grabs, &xdg_grab->link);
xdg_grab->seat = seat;
- xdg_grab->seat_destroy.notify = wlr_xdg_popup_grab_handle_seat_destroy;
+ xdg_grab->seat_destroy.notify = xdg_popup_grab_handle_seat_destroy;
wl_signal_add(&seat->events.destroy, &xdg_grab->seat_destroy);
return xdg_grab;
@@ -924,7 +924,7 @@ static void xdg_surface_handle_get_toplevel(struct wl_client *client,
xdg_toplevel_resource_destroy);
}
-static void wlr_xdg_toplevel_v6_ack_configure(
+static void xdg_toplevel_v6_ack_configure(
struct wlr_xdg_surface_v6 *surface,
struct wlr_xdg_surface_v6_configure *configure) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
@@ -975,7 +975,7 @@ static void xdg_surface_handle_ack_configure(struct wl_client *client,
assert(0 && "not reached");
break;
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
- wlr_xdg_toplevel_v6_ack_configure(surface, configure);
+ xdg_toplevel_v6_ack_configure(surface, configure);
break;
case WLR_XDG_SURFACE_V6_ROLE_POPUP:
break;
@@ -1027,7 +1027,7 @@ static const struct zxdg_surface_v6_interface zxdg_surface_v6_implementation = {
.set_window_geometry = xdg_surface_handle_set_window_geometry,
};
-static bool wlr_xdg_surface_v6_toplevel_state_compare(
+static bool xdg_surface_v6_toplevel_state_compare(
struct wlr_xdg_toplevel_v6 *state) {
struct {
struct wlr_xdg_toplevel_v6_state state;
@@ -1077,7 +1077,7 @@ static bool wlr_xdg_surface_v6_toplevel_state_compare(
return false;
}
-static void wlr_xdg_toplevel_v6_send_configure(
+static void xdg_toplevel_v6_send_configure(
struct wlr_xdg_surface_v6 *surface,
struct wlr_xdg_surface_v6_configure *configure) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
@@ -1143,7 +1143,7 @@ error_out:
wl_resource_post_no_memory(surface->toplevel->resource);
}
-static void wlr_xdg_surface_send_configure(void *user_data) {
+static void xdg_surface_send_configure(void *user_data) {
struct wlr_xdg_surface_v6 *surface = user_data;
surface->configure_idle = NULL;
@@ -1163,7 +1163,7 @@ static void wlr_xdg_surface_send_configure(void *user_data) {
assert(0 && "not reached");
break;
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
- wlr_xdg_toplevel_v6_send_configure(surface, configure);
+ xdg_toplevel_v6_send_configure(surface, configure);
break;
case WLR_XDG_SURFACE_V6_ROLE_POPUP:
zxdg_popup_v6_send_configure(surface->popup->resource,
@@ -1177,7 +1177,7 @@ static void wlr_xdg_surface_send_configure(void *user_data) {
zxdg_surface_v6_send_configure(surface->resource, configure->serial);
}
-static uint32_t wlr_xdg_surface_v6_schedule_configure(
+static uint32_t xdg_surface_v6_schedule_configure(
struct wlr_xdg_surface_v6 *surface) {
struct wl_display *display = wl_client_get_display(surface->client->client);
struct wl_event_loop *loop = wl_display_get_event_loop(display);
@@ -1189,7 +1189,7 @@ static uint32_t wlr_xdg_surface_v6_schedule_configure(
break;
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
pending_same =
- wlr_xdg_surface_v6_toplevel_state_compare(surface->toplevel);
+ xdg_surface_v6_toplevel_state_compare(surface->toplevel);
break;
case WLR_XDG_SURFACE_V6_ROLE_POPUP:
break;
@@ -1213,26 +1213,26 @@ static uint32_t wlr_xdg_surface_v6_schedule_configure(
surface->configure_next_serial = wl_display_next_serial(display);
surface->configure_idle = wl_event_loop_add_idle(loop,
- wlr_xdg_surface_send_configure, surface);
+ xdg_surface_send_configure, surface);
return surface->configure_next_serial;
}
}
-static void handle_wlr_surface_destroyed(struct wl_listener *listener,
+static void xdg_surface_handle_surface_destroy(struct wl_listener *listener,
void *data) {
struct wlr_xdg_surface_v6 *xdg_surface =
wl_container_of(listener, xdg_surface, surface_destroy_listener);
xdg_surface_destroy(xdg_surface);
}
-static void wlr_xdg_surface_v6_toplevel_committed(
+static void xdg_surface_v6_toplevel_committed(
struct wlr_xdg_surface_v6 *surface) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
if (!surface->toplevel->added) {
// on the first commit, send a configure request to tell the client it
// is added
- wlr_xdg_surface_v6_schedule_configure(surface);
+ xdg_surface_v6_schedule_configure(surface);
surface->toplevel->added = true;
return;
}
@@ -1248,17 +1248,17 @@ static void wlr_xdg_surface_v6_toplevel_committed(
surface->toplevel->client_pending.min_height;
}
-static void wlr_xdg_surface_v6_popup_committed(
+static void xdg_surface_v6_popup_committed(
struct wlr_xdg_surface_v6 *surface) {
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_POPUP);
if (!surface->popup->committed) {
- wlr_xdg_surface_v6_schedule_configure(surface);
+ xdg_surface_v6_schedule_configure(surface);
surface->popup->committed = true;
}
}
-static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
+static void handle_surface_committed(struct wlr_surface *wlr_surface,
void *role_data) {
struct wlr_xdg_surface_v6 *surface = role_data;
@@ -1284,10 +1284,10 @@ static void handle_wlr_surface_committed(struct wlr_surface *wlr_surface,
"xdg_surface must have a role");
break;
case WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL:
- wlr_xdg_surface_v6_toplevel_committed(surface);
+ xdg_surface_v6_toplevel_committed(surface);
break;
case WLR_XDG_SURFACE_V6_ROLE_POPUP:
- wlr_xdg_surface_v6_popup_committed(surface);
+ xdg_surface_v6_popup_committed(surface);
break;
}
@@ -1361,10 +1361,11 @@ static void xdg_shell_handle_get_xdg_surface(struct wl_client *wl_client,
wl_signal_add(&surface->surface->events.destroy,
&surface->surface_destroy_listener);
- surface->surface_destroy_listener.notify = handle_wlr_surface_destroyed;
+ surface->surface_destroy_listener.notify =
+ xdg_surface_handle_surface_destroy;
wlr_surface_set_role_committed(surface->surface,
- handle_wlr_surface_committed, surface);
+ handle_surface_committed, surface);
wlr_log(L_DEBUG, "new xdg_surface %p (res %p)", surface, surface->resource);
wl_resource_set_implementation(surface->resource,
@@ -1405,7 +1406,8 @@ static const struct zxdg_shell_v6_interface xdg_shell_impl = {
.pong = xdg_shell_handle_pong,
};
-static void wlr_xdg_client_v6_destroy(struct wl_resource *resource) {
+static void xdg_client_v6_handle_resource_destroy(
+ struct wl_resource *resource) {
struct wlr_xdg_client_v6 *client = xdg_client_from_resource(resource);
struct wlr_xdg_surface_v6 *surface, *tmp = NULL;
@@ -1421,7 +1423,7 @@ static void wlr_xdg_client_v6_destroy(struct wl_resource *resource) {
free(client);
}
-static int wlr_xdg_client_v6_ping_timeout(void *user_data) {
+static int xdg_client_v6_ping_timeout(void *user_data) {
struct wlr_xdg_client_v6 *client = user_data;
struct wlr_xdg_surface_v6 *surface;
@@ -1458,13 +1460,13 @@ static void xdg_shell_bind(struct wl_client *wl_client, void *data,
client->shell = xdg_shell;
wl_resource_set_implementation(client->resource, &xdg_shell_impl, client,
- wlr_xdg_client_v6_destroy);
+ xdg_client_v6_handle_resource_destroy);
wl_list_insert(&xdg_shell->clients, &client->link);
struct wl_display *display = wl_client_get_display(client->client);
struct wl_event_loop *loop = wl_display_get_event_loop(display);
client->ping_timer = wl_event_loop_add_timer(loop,
- wlr_xdg_client_v6_ping_timeout, client);
+ xdg_client_v6_ping_timeout, client);
if (client->ping_timer == NULL) {
wl_client_post_no_memory(client->client);
}
@@ -1533,7 +1535,7 @@ uint32_t wlr_xdg_toplevel_v6_set_size(struct wlr_xdg_surface_v6 *surface,
surface->toplevel->server_pending.width = width;
surface->toplevel->server_pending.height = height;
- return wlr_xdg_surface_v6_schedule_configure(surface);
+ return xdg_surface_v6_schedule_configure(surface);
}
uint32_t wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface,
@@ -1541,7 +1543,7 @@ uint32_t wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface,
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
surface->toplevel->server_pending.activated = activated;
- return wlr_xdg_surface_v6_schedule_configure(surface);
+ return xdg_surface_v6_schedule_configure(surface);
}
uint32_t wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface,
@@ -1549,7 +1551,7 @@ uint32_t wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface,
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
surface->toplevel->server_pending.maximized = maximized;
- return wlr_xdg_surface_v6_schedule_configure(surface);
+ return xdg_surface_v6_schedule_configure(surface);
}
uint32_t wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
@@ -1557,7 +1559,7 @@ uint32_t wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface,
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
surface->toplevel->server_pending.fullscreen = fullscreen;
- return wlr_xdg_surface_v6_schedule_configure(surface);
+ return xdg_surface_v6_schedule_configure(surface);
}
uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
@@ -1565,7 +1567,7 @@ uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface,
assert(surface->role == WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL);
surface->toplevel->server_pending.resizing = resizing;
- return wlr_xdg_surface_v6_schedule_configure(surface);
+ return xdg_surface_v6_schedule_configure(surface);
}
void wlr_xdg_surface_v6_send_close(struct wlr_xdg_surface_v6 *surface) {
@@ -1677,7 +1679,7 @@ void wlr_xdg_popup_v6_get_toplevel_coords(struct wlr_xdg_popup_v6 *popup,
}
-static void wlr_xdg_popup_v6_box_constraints(struct wlr_xdg_popup_v6 *popup,
+static void xdg_popup_v6_box_constraints(struct wlr_xdg_popup_v6 *popup,
struct wlr_box *toplevel_sx_box, int *offset_x, int *offset_y) {
int popup_width = popup->geometry.width;
int popup_height = popup->geometry.height;
@@ -1705,10 +1707,10 @@ static void wlr_xdg_popup_v6_box_constraints(struct wlr_xdg_popup_v6 *popup,
}
}
-static bool wlr_xdg_popup_v6_unconstrain_flip(struct wlr_xdg_popup_v6 *popup,
+static bool xdg_popup_v6_unconstrain_flip(struct wlr_xdg_popup_v6 *popup,
struct wlr_box *toplevel_sx_box) {
int offset_x = 0, offset_y = 0;
- wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
+ xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
if (!offset_x && !offset_y) {
@@ -1733,7 +1735,7 @@ static bool wlr_xdg_popup_v6_unconstrain_flip(struct wlr_xdg_popup_v6 *popup,
popup->geometry =
wlr_xdg_positioner_v6_get_geometry(&popup->positioner);
- wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
+ xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
if (!offset_x && !offset_y) {
@@ -1755,10 +1757,10 @@ static bool wlr_xdg_popup_v6_unconstrain_flip(struct wlr_xdg_popup_v6 *popup,
return false;
}
-static bool wlr_xdg_popup_v6_unconstrain_slide(struct wlr_xdg_popup_v6 *popup,
+static bool xdg_popup_v6_unconstrain_slide(struct wlr_xdg_popup_v6 *popup,
struct wlr_box *toplevel_sx_box) {
int offset_x = 0, offset_y = 0;
- wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
+ xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
if (!offset_x && !offset_y) {
@@ -1792,16 +1794,16 @@ static bool wlr_xdg_popup_v6_unconstrain_slide(struct wlr_xdg_popup_v6 *popup,
popup->geometry.y += toplevel_sx_box->y - toplevel_y;
}
- wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
+ xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
return !offset_x && !offset_y;
}
-static bool wlr_xdg_popup_v6_unconstrain_resize(struct wlr_xdg_popup_v6 *popup,
+static bool xdg_popup_v6_unconstrain_resize(struct wlr_xdg_popup_v6 *popup,
struct wlr_box *toplevel_sx_box) {
int offset_x, offset_y;
- wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
+ xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
&offset_x, &offset_y);
if (!offset_x && !offset_y) {
@@ -1823,7 +1825,7 @@ static bool wlr_xdg_popup_v6_unconstrain_resize(struct wlr_xdg_popup_v6 *popup,
popup->geometry.height -= offset_y;
}
- wlr_xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
+ xdg_popup_v6_box_constraints(popup, toplevel_sx_box,
&offset_y, &offset_y);
return !offset_x && !offset_y;
@@ -1831,13 +1833,13 @@ static bool wlr_xdg_popup_v6_unconstrain_resize(struct wlr_xdg_popup_v6 *popup,
void wlr_xdg_popup_v6_unconstrain_from_box(struct wlr_xdg_popup_v6 *popup,
struct wlr_box *toplevel_sx_box) {
- if (wlr_xdg_popup_v6_unconstrain_flip(popup, toplevel_sx_box)) {
+ if (xdg_popup_v6_unconstrain_flip(popup, toplevel_sx_box)) {
return;
}
- if (wlr_xdg_popup_v6_unconstrain_slide(popup, toplevel_sx_box)) {
+ if (xdg_popup_v6_unconstrain_slide(popup, toplevel_sx_box)) {
return;
}
- if (wlr_xdg_popup_v6_unconstrain_resize(popup, toplevel_sx_box)) {
+ if (xdg_popup_v6_unconstrain_resize(popup, toplevel_sx_box)) {
return;
}
}
diff --git a/util/log.c b/util/log.c
index 2adcae2d..328532f7 100644
--- a/util/log.c
+++ b/util/log.c
@@ -18,7 +18,8 @@ static const char *verbosity_colors[] = {
[L_DEBUG ] = "\x1B[1;30m",
};
-void wlr_log_stderr(log_importance_t verbosity, const char *fmt, va_list args) {
+static void log_stderr(log_importance_t verbosity, const char *fmt,
+ va_list args) {
if (verbosity > log_importance) {
return;
}
@@ -46,7 +47,7 @@ void wlr_log_stderr(log_importance_t verbosity, const char *fmt, va_list args) {
fprintf(stderr, "\n");
}
-static log_callback_t log_callback = wlr_log_stderr;
+static log_callback_t log_callback = log_stderr;
void wlr_log_init(log_importance_t verbosity, log_callback_t callback) {
if (verbosity < L_LAST) {
diff --git a/wlroots.syms b/wlroots.syms
index f7dc073f..804c352f 100644
--- a/wlroots.syms
+++ b/wlroots.syms
@@ -4,43 +4,6 @@ WLROOTS_0_0_0 {
_wlr_log;
_wlr_vlog;
local:
- wlr_drm_backend_get_session;
- wlr_drm_check_features;
- wlr_drm_connector_cleanup;
- wlr_drm_connector_start_renderer;
- wlr_drm_event;
- wlr_drm_get_connector_props;
- wlr_drm_get_crtc_props;
- wlr_drm_get_plane_props;
- wlr_drm_get_prop_blob;
- wlr_drm_get_prop;
- wlr_drm_plane_surfaces_init;
- wlr_drm_renderer_finish;
- wlr_drm_renderer_init;
- wlr_drm_resources_free;
- wlr_drm_resources_init;
- wlr_drm_restore_outputs;
- wlr_drm_scan_connectors;
- wlr_drm_surface_finish;
- wlr_drm_surface_get_front;
- wlr_drm_surface_init;
- wlr_drm_surface_make_current;
- wlr_drm_surface_mgpu_copy;
- wlr_drm_surface_post;
- wlr_drm_surface_swap_buffers;
- wlr_libinput_event;
- wlr_libinput_keyboard_create;
- wlr_libinput_pointer_create;
- wlr_libinput_tablet_pad_create;
- wlr_libinput_tablet_tool_create;
- wlr_libinput_touch_create;
- wlr_log_stderr;
wlr_signal_emit_safe;
- wlr_subsurface_destroy;
- wlr_wl_output_for_surface;
- wlr_wl_output_layout_get_box;
- wlr_wl_output_move_cursor;
- wlr_wl_output_update_cursor;
- wlr_wl_registry_poll;
*;
};
diff --git a/xcursor/wlr_xcursor.c b/xcursor/wlr_xcursor.c
index 7fcdbb6f..38c01efe 100644
--- a/xcursor/wlr_xcursor.c
+++ b/xcursor/wlr_xcursor.c
@@ -32,7 +32,7 @@
#include <wlr/xcursor.h>
#include "xcursor/xcursor.h"
-static void wlr_xcursor_destroy(struct wlr_xcursor *cursor) {
+static void xcursor_destroy(struct wlr_xcursor *cursor) {
for (size_t i = 0; i < cursor->image_count; i++) {
free(cursor->images[i]->buffer);
free(cursor->images[i]);
@@ -45,7 +45,7 @@ static void wlr_xcursor_destroy(struct wlr_xcursor *cursor) {
#include "xcursor/cursor_data.h"
-static struct wlr_xcursor *wlr_xcursor_create_from_data(
+static struct wlr_xcursor *xcursor_create_from_data(
struct cursor_metadata *metadata, struct wlr_xcursor_theme *theme) {
struct wlr_xcursor *cursor;
struct wlr_xcursor_image *image;
@@ -117,7 +117,7 @@ static void load_default_theme(struct wlr_xcursor_theme *theme) {
for (i = 0; i < theme->cursor_count; ++i) {
theme->cursors[i] =
- wlr_xcursor_create_from_data(&cursor_metadata[i], theme);
+ xcursor_create_from_data(&cursor_metadata[i], theme);
if (theme->cursors[i] == NULL) {
break;
@@ -126,7 +126,7 @@ static void load_default_theme(struct wlr_xcursor_theme *theme) {
theme->cursor_count = i;
}
-static struct wlr_xcursor *wlr_xcursor_create_from_xcursor_images(
+static struct wlr_xcursor *xcursor_create_from_xcursor_images(
XcursorImages *images, struct wlr_xcursor_theme *theme) {
struct wlr_xcursor *cursor;
struct wlr_xcursor_image *image;
@@ -193,7 +193,7 @@ static void load_callback(XcursorImages *images, void *data) {
return;
}
- cursor = wlr_xcursor_create_from_xcursor_images(images, theme);
+ cursor = xcursor_create_from_xcursor_images(images, theme);
if (cursor) {
theme->cursor_count++;
@@ -259,7 +259,7 @@ void wlr_xcursor_theme_destroy(struct wlr_xcursor_theme *theme) {
unsigned int i;
for (i = 0; i < theme->cursor_count; i++) {
- wlr_xcursor_destroy(theme->cursors[i]);
+ xcursor_destroy(theme->cursors[i]);
}
free(theme->name);
@@ -280,7 +280,7 @@ struct wlr_xcursor *wlr_xcursor_theme_get_cursor(struct wlr_xcursor_theme *theme
return NULL;
}
-static int wlr_xcursor_frame_and_duration(struct wlr_xcursor *cursor,
+static int xcursor_frame_and_duration(struct wlr_xcursor *cursor,
uint32_t time, uint32_t *duration) {
uint32_t t;
int i;
@@ -323,7 +323,7 @@ static int wlr_xcursor_frame_and_duration(struct wlr_xcursor *cursor,
}
int wlr_xcursor_frame(struct wlr_xcursor *_cursor, uint32_t time) {
- return wlr_xcursor_frame_and_duration(_cursor, time, NULL);
+ return xcursor_frame_and_duration(_cursor, time, NULL);
}
const char *wlr_xcursor_get_resize_name(enum wlr_edges edges) {
diff --git a/xwayland/selection/incoming.c b/xwayland/selection/incoming.c
index ab06f40d..1b596254 100644
--- a/xwayland/selection/incoming.c
+++ b/xwayland/selection/incoming.c
@@ -31,7 +31,7 @@ static int xwm_data_source_write(int fd, uint32_t mask, void *data) {
return 1;
}
- wlr_log(L_DEBUG, "wrote %ld (chunk size %ld) of %d bytes",
+ wlr_log(L_DEBUG, "wrote %zd (chunk size %zd) of %d bytes",
transfer->property_start + len,
len, xcb_get_property_value_length(transfer->property_reply));
@@ -182,14 +182,14 @@ struct x11_data_source {
static const struct wlr_data_source_impl data_source_impl;
-bool wlr_data_source_is_xwayland_data_source(
+bool data_source_is_xwayland(
struct wlr_data_source *wlr_source) {
return wlr_source->impl == &data_source_impl;
}
static struct x11_data_source *data_source_from_wlr_data_source(
struct wlr_data_source *wlr_source) {
- assert(wlr_data_source_is_xwayland_data_source(wlr_source));
+ assert(data_source_is_xwayland(wlr_source));
return (struct x11_data_source *)wlr_source;
}
@@ -225,7 +225,7 @@ struct x11_primary_selection_source {
static void primary_selection_source_cancel(
struct wlr_primary_selection_source *wlr_source);
-bool wlr_primary_selection_source_is_xwayland_primary_selection_source(
+bool primary_selection_source_is_xwayland(
struct wlr_primary_selection_source *wlr_source) {
return wlr_source->cancel == primary_selection_source_cancel;
}
diff --git a/xwayland/selection/outgoing.c b/xwayland/selection/outgoing.c
index b612b2fb..6d7565e3 100644
--- a/xwayland/selection/outgoing.c
+++ b/xwayland/selection/outgoing.c
@@ -96,7 +96,7 @@ static int xwm_data_source_read(int fd, uint32_t mask, void *data) {
goto error_out;
}
- wlr_log(L_DEBUG, "read %ld bytes (available %zu, mask 0x%x)", len,
+ wlr_log(L_DEBUG, "read %zd bytes (available %zu, mask 0x%x)", len,
available, mask);
transfer->source_data.size = current + len;
diff --git a/xwayland/selection/selection.c b/xwayland/selection/selection.c
index 39c47c45..6b57f7c3 100644
--- a/xwayland/selection/selection.c
+++ b/xwayland/selection/selection.c
@@ -223,13 +223,13 @@ void xwm_selection_finish(struct wlr_xwm *xwm) {
}
if (xwm->seat) {
if (xwm->seat->selection_source &&
- wlr_data_source_is_xwayland_data_source(
+ data_source_is_xwayland(
xwm->seat->selection_source)) {
wlr_seat_set_selection(xwm->seat, NULL,
wl_display_next_serial(xwm->xwayland->wl_display));
}
if (xwm->seat->primary_selection_source &&
- wlr_primary_selection_source_is_xwayland_primary_selection_source(
+ primary_selection_source_is_xwayland(
xwm->seat->primary_selection_source)) {
wlr_seat_set_primary_selection(xwm->seat, NULL,
wl_display_next_serial(xwm->xwayland->wl_display));
@@ -262,7 +262,7 @@ static void seat_handle_selection(struct wl_listener *listener,
wl_container_of(listener, xwm, seat_selection);
struct wlr_data_source *source = seat->selection_source;
- if (source != NULL && wlr_data_source_is_xwayland_data_source(source)) {
+ if (source != NULL && data_source_is_xwayland(source)) {
return;
}
@@ -277,7 +277,7 @@ static void seat_handle_primary_selection(struct wl_listener *listener,
struct wlr_primary_selection_source *source = seat->primary_selection_source;
if (source != NULL &&
- wlr_primary_selection_source_is_xwayland_primary_selection_source(
+ primary_selection_source_is_xwayland(
source)) {
return;
}
diff --git a/xwayland/xwayland.c b/xwayland/xwayland.c
index 04f4f6f9..f27de679 100644
--- a/xwayland/xwayland.c
+++ b/xwayland/xwayland.c
@@ -128,7 +128,7 @@ static void exec_xwayland(struct wlr_xwayland *wlr_xwayland) {
execvp("Xwayland", argv);
}
-static void wlr_xwayland_finish(struct wlr_xwayland *wlr_xwayland) {
+static void xwayland_finish(struct wlr_xwayland *wlr_xwayland) {
if (!wlr_xwayland || wlr_xwayland->display == -1) {
return;
}
@@ -165,7 +165,7 @@ static void wlr_xwayland_finish(struct wlr_xwayland *wlr_xwayland) {
*/
}
-static bool wlr_xwayland_start(struct wlr_xwayland *wlr_xwayland,
+static bool xwayland_start(struct wlr_xwayland *wlr_xwayland,
struct wl_display *wl_display, struct wlr_compositor *compositor);
static void handle_client_destroy(struct wl_listener *listener, void *data) {
@@ -176,11 +176,11 @@ static void handle_client_destroy(struct wl_listener *listener, void *data) {
wlr_xwayland->client = NULL;
wl_list_remove(&wlr_xwayland->client_destroy.link);
- wlr_xwayland_finish(wlr_xwayland);
+ xwayland_finish(wlr_xwayland);
if (time(NULL) - wlr_xwayland->server_start > 5) {
wlr_log(L_INFO, "Restarting Xwayland");
- wlr_xwayland_start(wlr_xwayland, wlr_xwayland->wl_display,
+ xwayland_start(wlr_xwayland, wlr_xwayland->wl_display,
wlr_xwayland->compositor);
}
}
@@ -217,7 +217,7 @@ static int xserver_handle_ready(int signal_number, void *data) {
wlr_xwayland->xwm = xwm_create(wlr_xwayland);
if (!wlr_xwayland->xwm) {
- wlr_xwayland_finish(wlr_xwayland);
+ xwayland_finish(wlr_xwayland);
return 1;
}
@@ -247,7 +247,7 @@ static int xserver_handle_ready(int signal_number, void *data) {
return 1; /* wayland event loop dispatcher's count */
}
-static bool wlr_xwayland_start(struct wlr_xwayland *wlr_xwayland,
+static bool xwayland_start(struct wlr_xwayland *wlr_xwayland,
struct wl_display *wl_display, struct wlr_compositor *compositor) {
memset(wlr_xwayland, 0, offsetof(struct wlr_xwayland, seat));
wlr_xwayland->wl_display = wl_display;
@@ -261,13 +261,13 @@ static bool wlr_xwayland_start(struct wlr_xwayland *wlr_xwayland,
wlr_xwayland->display = open_display_sockets(wlr_xwayland->x_fd);
if (wlr_xwayland->display < 0) {
- wlr_xwayland_finish(wlr_xwayland);
+ xwayland_finish(wlr_xwayland);
return false;
}
if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, wlr_xwayland->wl_fd) != 0 ||
socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, wlr_xwayland->wm_fd) != 0) {
wlr_log_errno(L_ERROR, "failed to create socketpair");
- wlr_xwayland_finish(wlr_xwayland);
+ xwayland_finish(wlr_xwayland);
return false;
}
@@ -275,7 +275,7 @@ static bool wlr_xwayland_start(struct wlr_xwayland *wlr_xwayland,
if (!(wlr_xwayland->client = wl_client_create(wl_display, wlr_xwayland->wl_fd[0]))) {
wlr_log_errno(L_ERROR, "wl_client_create failed");
- wlr_xwayland_finish(wlr_xwayland);
+ xwayland_finish(wlr_xwayland);
return false;
}
@@ -323,7 +323,7 @@ static bool wlr_xwayland_start(struct wlr_xwayland *wlr_xwayland,
}
if (wlr_xwayland->pid < 0) {
wlr_log_errno(L_ERROR, "fork failed");
- wlr_xwayland_finish(wlr_xwayland);
+ xwayland_finish(wlr_xwayland);
return false;
}
@@ -340,7 +340,7 @@ static bool wlr_xwayland_start(struct wlr_xwayland *wlr_xwayland,
void wlr_xwayland_destroy(struct wlr_xwayland *wlr_xwayland) {
wlr_xwayland_set_seat(wlr_xwayland, NULL);
- wlr_xwayland_finish(wlr_xwayland);
+ xwayland_finish(wlr_xwayland);
free(wlr_xwayland);
}
@@ -350,7 +350,7 @@ struct wlr_xwayland *wlr_xwayland_create(struct wl_display *wl_display,
wl_signal_init(&wlr_xwayland->events.new_surface);
wl_signal_init(&wlr_xwayland->events.ready);
- if (wlr_xwayland_start(wlr_xwayland, wl_display, compositor)) {
+ if (xwayland_start(wlr_xwayland, wl_display, compositor)) {
return wlr_xwayland;
}
free(wlr_xwayland);
@@ -380,7 +380,7 @@ void wlr_xwayland_set_cursor(struct wlr_xwayland *wlr_xwayland,
wlr_xwayland->cursor->hotspot_y = hotspot_y;
}
-static void wlr_xwayland_handle_seat_destroy(struct wl_listener *listener,
+static void xwayland_handle_seat_destroy(struct wl_listener *listener,
void *data) {
struct wlr_xwayland *xwayland =
wl_container_of(listener, xwayland, seat_destroy);
@@ -404,6 +404,6 @@ void wlr_xwayland_set_seat(struct wlr_xwayland *xwayland,
return;
}
- xwayland->seat_destroy.notify = wlr_xwayland_handle_seat_destroy;
+ xwayland->seat_destroy.notify = xwayland_handle_seat_destroy;
wl_signal_add(&seat->events.destroy, &xwayland->seat_destroy);
}
diff --git a/xwayland/xwm.c b/xwayland/xwm.c
index 599006ae..2e01da6f 100644
--- a/xwayland/xwm.c
+++ b/xwayland/xwm.c
@@ -278,7 +278,7 @@ static void xsurface_set_net_wm_state(struct wlr_xwayland_surface *xsurface) {
static void xsurface_unmap(struct wlr_xwayland_surface *surface);
-static void wlr_xwayland_surface_destroy(
+static void xwayland_surface_destroy(
struct wlr_xwayland_surface *xsurface) {
xsurface_unmap(xsurface);
@@ -708,7 +708,7 @@ static void xwm_handle_destroy_notify(struct wlr_xwm *xwm,
if (xsurface == NULL) {
return;
}
- wlr_xwayland_surface_destroy(xsurface);
+ xwayland_surface_destroy(xsurface);
}
static void xwm_handle_configure_request(struct wlr_xwm *xwm,
@@ -1304,10 +1304,10 @@ void xwm_destroy(struct wlr_xwm *xwm) {
#endif
struct wlr_xwayland_surface *xsurface, *tmp;
wl_list_for_each_safe(xsurface, tmp, &xwm->surfaces, link) {
- wlr_xwayland_surface_destroy(xsurface);
+ xwayland_surface_destroy(xsurface);
}
wl_list_for_each_safe(xsurface, tmp, &xwm->unpaired_surfaces, link) {
- wlr_xwayland_surface_destroy(xsurface);
+ xwayland_surface_destroy(xsurface);
}
wl_list_remove(&xwm->compositor_new_surface.link);
wl_list_remove(&xwm->compositor_destroy.link);