boilerplate for wl_output

This commit is contained in:
Rakarake 2026-02-22 17:42:12 +01:00
parent de525136e7
commit e0776cf8e0

View file

@ -162,6 +162,40 @@ void egl_init_surface(struct client_state *state, struct surface *surface) {
} }
} }
static void wl_output_name(void *data, struct wl_output *wl_output, const char *name) {
printf("output name: %s\n", name);
}
static void wl_output_description(void *data, struct wl_output *wl_output, const char *description) {
}
static void wl_output_done(void *data, struct wl_output *wl_output) {
}
static void wl_output_geometry(
void *data, struct wl_output *wl_output,
int x,
int y,
int physical_width,
int physical_height,
int subpixel,
const char *make,
const char *model,
int transform
) {
}
static void wl_output_mode(void *data, struct wl_output *wl_output, unsigned int mode, int width, int height, int refresh) {
}
static void wl_output_scale(void *data, struct wl_output *wl_output, int factor) {
}
static const struct wl_output_listener wl_output_listener = {
.description = wl_output_description,
.done = wl_output_done,
.geometry = wl_output_geometry,
.mode = wl_output_mode,
.name = wl_output_name,
.scale = wl_output_scale,
};
static void wl_buffer_release(void *data, struct wl_buffer *wl_buffer) { static void wl_buffer_release(void *data, struct wl_buffer *wl_buffer) {
/* Sent by the compositor when it's no longer using this buffer */ /* Sent by the compositor when it's no longer using this buffer */
wl_buffer_destroy(wl_buffer); wl_buffer_destroy(wl_buffer);
@ -452,6 +486,7 @@ static void registry_handle_global(
if (strcmp(interface, wl_output_interface.name) == 0 && state->output_type == OUTPUT_LAYER) { if (strcmp(interface, wl_output_interface.name) == 0 && state->output_type == OUTPUT_LAYER) {
struct wl_output *wl_output = wl_registry_bind( struct wl_output *wl_output = wl_registry_bind(
registry, name, &wl_output_interface, 4); registry, name, &wl_output_interface, 4);
wl_output_add_listener(wl_output, &wl_output_listener, state);
layer_new(state, wl_output); layer_new(state, wl_output);
} }
} }