diff --git a/README.md b/README.md index 9a3e73b..fde889f 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ # swaylock swaylock is a screen locking utility for Wayland compositors. It is compatible -with any Wayland compositor which implements the following Wayland protocols: +with any Wayland compositor which implements one of the following Wayland +protocols: -- wlr-layer-shell + wlr-input-inhibitor, or ext-session-lock-v1 -- xdg-output +- ext-session-lock-v1, or +- wlr-layer-shell and wlr-input-inhibitor See the man page, `swaylock(1)`, for instructions on using swaylock. diff --git a/include/swaylock.h b/include/swaylock.h index 30f9117..b6daffc 100644 --- a/include/swaylock.h +++ b/include/swaylock.h @@ -88,7 +88,6 @@ struct swaylock_state { enum auth_state auth_state; int failed_attempts; bool run_display; - struct zxdg_output_manager_v1 *zxdg_output_manager; struct ext_session_lock_manager_v1 *ext_session_lock_manager_v1; struct ext_session_lock_v1 *ext_session_lock_v1; }; @@ -98,7 +97,6 @@ struct swaylock_surface { struct swaylock_state *state; struct wl_output *output; uint32_t output_global_name; - struct zxdg_output_v1 *xdg_output; struct wl_surface *surface; struct wl_surface *child; // surface made into subsurface struct wl_subsurface *subsurface; diff --git a/main.c b/main.c index 7f7bd6c..f289b5e 100644 --- a/main.c +++ b/main.c @@ -25,7 +25,6 @@ #include "swaylock.h" #include "wlr-input-inhibitor-unstable-v1-client-protocol.h" #include "wlr-layer-shell-unstable-v1-client-protocol.h" -#include "xdg-output-unstable-v1-client-protocol.h" #include "ext-session-lock-v1-client-protocol.h" static uint32_t parse_color(const char *color) { @@ -295,46 +294,24 @@ static void handle_wl_output_scale(void *data, struct wl_output *output, } } +static void handle_wl_output_name(void *data, struct wl_output *output, + const char *name) { + struct swaylock_surface *surface = data; + surface->output_name = strdup(name); +} + +static void handle_wl_output_description(void *data, struct wl_output *output, + const char *description) { + // Who cares +} + struct wl_output_listener _wl_output_listener = { .geometry = handle_wl_output_geometry, .mode = handle_wl_output_mode, .done = handle_wl_output_done, .scale = handle_wl_output_scale, -}; - -static void handle_xdg_output_logical_size(void *data, struct zxdg_output_v1 *output, - int width, int height) { - // Who cares -} - -static void handle_xdg_output_logical_position(void *data, - struct zxdg_output_v1 *output, int x, int y) { - // Who cares -} - -static void handle_xdg_output_name(void *data, struct zxdg_output_v1 *output, - const char *name) { - swaylock_log(LOG_DEBUG, "output name is %s", name); - struct swaylock_surface *surface = data; - surface->xdg_output = output; - surface->output_name = strdup(name); -} - -static void handle_xdg_output_description(void *data, struct zxdg_output_v1 *output, - const char *description) { - // Who cares -} - -static void handle_xdg_output_done(void *data, struct zxdg_output_v1 *output) { - // Who cares -} - -struct zxdg_output_v1_listener _xdg_output_listener = { - .logical_position = handle_xdg_output_logical_position, - .logical_size = handle_xdg_output_logical_size, - .done = handle_xdg_output_done, - .name = handle_xdg_output_name, - .description = handle_xdg_output_description, + .name = handle_wl_output_name, + .description = handle_wl_output_description, }; static void ext_session_lock_v1_handle_locked(void *data, struct ext_session_lock_v1 *lock) { @@ -377,15 +354,12 @@ static void handle_global(void *data, struct wl_registry *registry, } else if (strcmp(interface, zwlr_input_inhibit_manager_v1_interface.name) == 0) { state->input_inhibit_manager = wl_registry_bind( registry, name, &zwlr_input_inhibit_manager_v1_interface, 1); - } else if (strcmp(interface, zxdg_output_manager_v1_interface.name) == 0) { - state->zxdg_output_manager = wl_registry_bind( - registry, name, &zxdg_output_manager_v1_interface, 2); } else if (strcmp(interface, wl_output_interface.name) == 0) { struct swaylock_surface *surface = calloc(1, sizeof(struct swaylock_surface)); surface->state = state; surface->output = wl_registry_bind(registry, name, - &wl_output_interface, 3); + &wl_output_interface, 4); surface->output_global_name = name; wl_output_add_listener(surface->output, &_wl_output_listener, surface); wl_list_insert(&state->surfaces, &surface->link); @@ -1265,20 +1239,6 @@ int main(int argc, char **argv) { return 1; } - if (state.zxdg_output_manager) { - struct swaylock_surface *surface; - wl_list_for_each(surface, &state.surfaces, link) { - surface->xdg_output = zxdg_output_manager_v1_get_xdg_output( - state.zxdg_output_manager, surface->output); - zxdg_output_v1_add_listener( - surface->xdg_output, &_xdg_output_listener, surface); - } - wl_display_roundtrip(state.display); - } else { - swaylock_log(LOG_INFO, "Compositor does not support zxdg output " - "manager, images assigned to named outputs will not work"); - } - struct swaylock_surface *surface; wl_list_for_each(surface, &state.surfaces, link) { create_surface(surface); diff --git a/meson.build b/meson.build index 48c43fc..ff120c8 100644 --- a/meson.build +++ b/meson.build @@ -36,7 +36,7 @@ if is_freebsd add_project_arguments('-D_C11_SOURCE', language: 'c') endif -wayland_client = dependency('wayland-client') +wayland_client = dependency('wayland-client', version: '>=1.20.0') wayland_protos = dependency('wayland-protocols', version: '>=1.25', fallback: 'wayland-protocols') wayland_scanner = dependency('wayland-scanner', version: '>=1.15.0') xkbcommon = dependency('xkbcommon') @@ -81,7 +81,6 @@ client_protos_headers = [] client_protocols = [ [wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'], - [wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'], [wl_protocol_dir, 'staging/ext-session-lock/ext-session-lock-v1.xml'], ['wlr-layer-shell-unstable-v1.xml'], ['wlr-input-inhibitor-unstable-v1.xml'],