Skip to content

Support output IDs #368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/swaylock.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ struct swaylock_surface {
int32_t scale;
enum wl_output_subpixel subpixel;
char *output_name;
char *output_description;
struct wl_list link;
// Dimensions of last wl_buffer committed to background surface
int last_buffer_width, last_buffer_height;
Expand Down
5 changes: 3 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ static void handle_wl_output_name(void *data, struct wl_output *output,

static void handle_wl_output_description(void *data, struct wl_output *output,
const char *description) {
// Who cares
struct swaylock_surface *surface = data;
surface->output_description = strdup(description);
}

struct wl_output_listener _wl_output_listener = {
Expand Down Expand Up @@ -349,7 +350,7 @@ static cairo_surface_t *select_image(struct swaylock_state *state,
struct swaylock_image *image;
cairo_surface_t *default_image = NULL;
wl_list_for_each(image, &state->images, link) {
if (lenient_strcmp(image->output_name, surface->output_name) == 0) {
if (lenient_strcmp(image->output_name, surface->output_name) == 0 || strstr(surface->output_description, image->output_name) != 0) {
return image->cairo_surface;
} else if (!image->output_name) {
default_image = image->cairo_surface;
Expand Down