Drop xdg-output-unstable-v1

Closes: https://todo.sr.ht/~adnano/wmenu/2
This commit is contained in:
adnano 2022-12-02 12:00:26 -05:00
parent 38b4bae4bd
commit 272540c7fb
2 changed files with 4 additions and 25 deletions

28
main.c
View file

@ -21,7 +21,6 @@
#include "pango.h" #include "pango.h"
#include "pool-buffer.h" #include "pool-buffer.h"
#include "wlr-layer-shell-unstable-v1-client-protocol.h" #include "wlr-layer-shell-unstable-v1-client-protocol.h"
#include "xdg-output-unstable-v1-client-protocol.h"
struct menu_item { struct menu_item {
char *text; char *text;
@ -33,7 +32,6 @@ struct menu_item {
struct output { struct output {
struct menu_state *menu; struct menu_state *menu;
struct wl_output *output; struct wl_output *output;
struct zxdg_output_v1 *xdg_output;
int32_t scale; int32_t scale;
}; };
@ -47,7 +45,6 @@ struct menu_state {
struct wl_seat *seat; struct wl_seat *seat;
struct wl_keyboard *keyboard; struct wl_keyboard *keyboard;
struct zwlr_layer_shell_v1 *layer_shell; struct zwlr_layer_shell_v1 *layer_shell;
struct zxdg_output_manager_v1 *output_manager;
struct wl_surface *surface; struct wl_surface *surface;
struct zwlr_layer_surface_v1 *layer_surface; struct zwlr_layer_surface_v1 *layer_surface;
@ -448,8 +445,7 @@ static void output_scale(void *data, struct wl_output *wl_output, int32_t factor
output->scale = factor; output->scale = factor;
} }
static void output_name(void *data, struct zxdg_output_v1 *xdg_output, static void output_name(void *data, struct wl_output *wl_output, const char *name) {
const char *name) {
struct output *output = data; struct output *output = data;
struct menu_state *state = output->menu; struct menu_state *state = output->menu;
char *outname = state->output_name; char *outname = state->output_name;
@ -463,6 +459,8 @@ struct wl_output_listener output_listener = {
.mode = noop, .mode = noop,
.done = noop, .done = noop,
.scale = output_scale, .scale = output_scale,
.name = output_name,
.description = noop,
}; };
static void keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard, static void keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard,
@ -851,14 +849,6 @@ const struct wl_seat_listener seat_listener = {
.name = noop, .name = noop,
}; };
struct zxdg_output_v1_listener xdg_output_listener = {
.logical_position = noop,
.logical_size = noop,
.done = noop,
.name = output_name,
.description = noop,
};
static void handle_global(void *data, struct wl_registry *registry, static void handle_global(void *data, struct wl_registry *registry,
uint32_t name, const char *interface, uint32_t version) { uint32_t name, const char *interface, uint32_t version) {
struct menu_state *state = data; struct menu_state *state = data;
@ -874,23 +864,14 @@ static void handle_global(void *data, struct wl_registry *registry,
} else if (strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) { } else if (strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) {
state->layer_shell = wl_registry_bind(registry, name, state->layer_shell = wl_registry_bind(registry, name,
&zwlr_layer_shell_v1_interface, 1); &zwlr_layer_shell_v1_interface, 1);
} else if (strcmp(interface, zxdg_output_manager_v1_interface.name) == 0) {
state->output_manager = wl_registry_bind(registry, name,
&zxdg_output_manager_v1_interface, 3);
} else if (strcmp(interface, wl_output_interface.name) == 0) { } else if (strcmp(interface, wl_output_interface.name) == 0) {
struct output *output = calloc(1, sizeof(struct output)); struct output *output = calloc(1, sizeof(struct output));
output->output = wl_registry_bind(registry, name, output->output = wl_registry_bind(registry, name,
&wl_output_interface, 3); &wl_output_interface, 4);
output->menu = state; output->menu = state;
output->scale = 1; output->scale = 1;
wl_output_set_user_data(output->output, output); wl_output_set_user_data(output->output, output);
wl_output_add_listener(output->output, &output_listener, output); wl_output_add_listener(output->output, &output_listener, output);
if (state->output_manager != NULL) {
output->xdg_output = zxdg_output_manager_v1_get_xdg_output(
state->output_manager, output->output);
zxdg_output_v1_add_listener(output->xdg_output,
&xdg_output_listener, output);
}
} }
} }
@ -1038,7 +1019,6 @@ static void menu_init(struct menu_state *state) {
assert(state->compositor != NULL); assert(state->compositor != NULL);
assert(state->layer_shell != NULL); assert(state->layer_shell != NULL);
assert(state->shm != NULL); assert(state->shm != NULL);
assert(state->output_manager != NULL);
// Second roundtrip for xdg-output // Second roundtrip for xdg-output
wl_display_roundtrip(state->display); wl_display_roundtrip(state->display);

View file

@ -11,7 +11,6 @@ else
endif endif
protocols = [ protocols = [
[wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'],
[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'], [wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
['wlr-layer-shell-unstable-v1.xml'], ['wlr-layer-shell-unstable-v1.xml'],
] ]