1
0
mirror of https://codeberg.org/vyivel/dulcepan/ synced 2026-04-26 21:14:40 +03:00

output: store name

This commit is contained in:
Kirill Primak
2024-06-24 16:38:02 +03:00
parent 29c6ebf48c
commit 447f2a8e5b
4 changed files with 40 additions and 11 deletions

View File

@@ -32,8 +32,8 @@ static void layer_surface_handle_configure(void *data, struct zwlr_layer_surface
if (output->initialized) {
if (i_width != output->effective_width || i_height != output->effective_height) {
dp_log_fatal("Layer surface size has changed: %dx%d => %dx%d", output->effective_width,
output->effective_height, i_width, i_height);
dp_log_fatal("Output %s: layer surface size has changed: %dx%d => %dx%d", output->name,
output->effective_width, output->effective_height, i_width, i_height);
}
wl_surface_commit(output->main_surface);
@@ -61,7 +61,8 @@ static void layer_surface_handle_configure(void *data, struct zwlr_layer_surface
}
static void layer_surface_handle_closed(void *data, struct zwlr_layer_surface_v1 *layer_surface) {
dp_log_fatal("A layer surface was closed");
struct dp_output *output = data;
dp_log_fatal("Output %s: a layer surface was closed", output->name);
}
static const struct zwlr_layer_surface_v1_listener layer_surface_listener = {
@@ -104,7 +105,8 @@ static void frame_handle_ready(void *data, struct zwlr_screencopy_frame_v1 *fram
}
static void frame_handle_failed(void *data, struct zwlr_screencopy_frame_v1 *frame) {
dp_log_fatal("Failed to copy a frame");
struct dp_output *output = data;
dp_log_fatal("Output %s: failed to copy a frame", output->name);
}
static const struct zwlr_screencopy_frame_v1_listener frame_listener = {
@@ -130,8 +132,8 @@ static void output_handle_geometry(void *data, struct wl_output *wl_output, int3
if (output->has_geom) {
if (transform != output->transform) {
dp_log_fatal("Output transform has changed: %d (%#x) => %d (%#x)", output->transform,
output->transform, transform, transform);
dp_log_fatal("Output %s: transform has changed: %d (%#x) => %d (%#x)", output->name,
output->transform, output->transform, transform, transform);
}
}
@@ -144,8 +146,8 @@ static void output_handle_mode(void *data, struct wl_output *wl_output, uint32_t
if (output->has_geom) {
if (width != output->width || height != output->height) {
dp_log_fatal("Output mode has changed: %dx%d => %dx%d", output->width, output->height,
width, height);
dp_log_fatal("Output %s: mode has changed: %dx%d => %dx%d", output->name, output->width,
output->height, width, height);
}
}
@@ -160,6 +162,8 @@ static void output_handle_done(void *data, struct wl_output *wl_output) {
return;
}
assert(output->name != NULL);
if ((output->transform & WL_OUTPUT_TRANSFORM_90) != 0) {
output->transformed_width = output->height;
output->transformed_height = output->width;
@@ -222,11 +226,23 @@ static void output_handle_scale(void *data, struct wl_output *wl_output, int32_t
// Ignored
}
static void output_handle_name(void *data, struct wl_output *wl_output, const char *name) {
struct dp_output *output = data;
assert(output->name == NULL);
output->name = dp_strdup(name);
}
static void output_handle_description(void *data, struct wl_output *wl_output, const char *name) {
// Ignored
}
static const struct wl_output_listener output_listener = {
.geometry = output_handle_geometry,
.mode = output_handle_mode,
.done = output_handle_done,
.scale = output_handle_scale,
.name = output_handle_name,
.description = output_handle_description,
};
static void redraw(struct dp_output *output);
@@ -261,7 +277,7 @@ static void redraw(struct dp_output *output) {
}
}
if (buffer == NULL) {
dp_log_error("No free buffers in a swapchain\n");
dp_log_error("Output %s: no free buffers in a swapchain\n", output->name);
return;
}
buffer->used = true;
@@ -331,6 +347,8 @@ void dp_output_create(struct dp_state *state, uint32_t name, struct wl_output *w
void dp_output_destroy(struct dp_output *output) {
wl_output_release(output->wl_output);
free(output->name);
assert(output->frame == NULL);
wl_buffer_destroy(output->frame_buffer);
munmap(output->frame_data, output->frame_size);