summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhostNaN <GhostNaN@protonmail.com>2022-09-20 16:33:02 -0400
committerGhostNaN <GhostNaN@protonmail.com>2022-09-20 16:33:02 -0400
commita5a47502ca6d206a9bfff8468392ef11b2499cd8 (patch)
tree1864d40e12616cb60b69183a7f5acf0df1874920
parent18c2f4131cd1ac00aa35f82c0651af17af71fa76 (diff)
Replace xdg_output with wl_output v4
Just trying to keep up with swaybg and at least it gets rid of xdg_output. This also unintentionally breaks kwin support because kwin is still using wl_output v3. I also had some syntax cleanups queued so it might be a mess.
-rw-r--r--meson.build4
-rw-r--r--proto/xdg-output-unstable-v1.xml220
-rw-r--r--src/holder.c122
-rw-r--r--src/main.c97
4 files changed, 83 insertions, 360 deletions
diff --git a/meson.build b/meson.build
index 37ffbdb..7c6ed15 100644
--- a/meson.build
+++ b/meson.build
@@ -15,13 +15,11 @@ scanner_client_header=generator(scanner,output: '@BASENAME@-client-protocol.h',a
protocols_src=[
scanner_private_code.process('proto/wlr-layer-shell-unstable-v1.xml'),
- scanner_private_code.process('proto/xdg-output-unstable-v1.xml'),
scanner_private_code.process(wl_protocols.get_pkgconfig_variable('pkgdatadir')+'/stable/xdg-shell/xdg-shell.xml')
]
protocols_headers=[
- scanner_client_header.process('proto/wlr-layer-shell-unstable-v1.xml'),
- scanner_client_header.process('proto/xdg-output-unstable-v1.xml')
+ scanner_client_header.process('proto/wlr-layer-shell-unstable-v1.xml')
]
lib_protocols=static_library('protocols',protocols_src+protocols_headers,dependencies: wl_client)
diff --git a/proto/xdg-output-unstable-v1.xml b/proto/xdg-output-unstable-v1.xml
deleted file mode 100644
index 9a5b790..0000000
--- a/proto/xdg-output-unstable-v1.xml
+++ /dev/null
@@ -1,220 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<protocol name="xdg_output_unstable_v1">
-
- <copyright>
- Copyright © 2017 Red Hat Inc.
-
- Permission is hereby granted, free of charge, to any person obtaining a
- copy of this software and associated documentation files (the "Software"),
- to deal in the Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice (including the next
- paragraph) shall be included in all copies or substantial portions of the
- Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- DEALINGS IN THE SOFTWARE.
- </copyright>
-
- <description summary="Protocol to describe output regions">
- This protocol aims at describing outputs in a way which is more in line
- with the concept of an output on desktop oriented systems.
-
- Some information are more specific to the concept of an output for
- a desktop oriented system and may not make sense in other applications,
- such as IVI systems for example.
-
- Typically, the global compositor space on a desktop system is made of
- a contiguous or overlapping set of rectangular regions.
-
- Some of the information provided in this protocol might be identical
- to their counterparts already available from wl_output, in which case
- the information provided by this protocol should be preferred to their
- equivalent in wl_output. The goal is to move the desktop specific
- concepts (such as output location within the global compositor space,
- the connector name and types, etc.) out of the core wl_output protocol.
-
- Warning! The protocol described in this file is experimental and
- backward incompatible changes may be made. Backward compatible
- changes may be added together with the corresponding interface
- version bump.
- Backward incompatible changes are done by bumping the version
- number in the protocol and interface names and resetting the
- interface version. Once the protocol is to be declared stable,
- the 'z' prefix and the version number in the protocol and
- interface names are removed and the interface version number is
- reset.
- </description>
-
- <interface name="zxdg_output_manager_v1" version="3">
- <description summary="manage xdg_output objects">
- A global factory interface for xdg_output objects.
- </description>
-
- <request name="destroy" type="destructor">
- <description summary="destroy the xdg_output_manager object">
- Using this request a client can tell the server that it is not
- going to use the xdg_output_manager object anymore.
-
- Any objects already created through this instance are not affected.
- </description>
- </request>
-
- <request name="get_xdg_output">
- <description summary="create an xdg output from a wl_output">
- This creates a new xdg_output object for the given wl_output.
- </description>
- <arg name="id" type="new_id" interface="zxdg_output_v1"/>
- <arg name="output" type="object" interface="wl_output"/>
- </request>
- </interface>
-
- <interface name="zxdg_output_v1" version="3">
- <description summary="compositor logical output region">
- An xdg_output describes part of the compositor geometry.
-
- This typically corresponds to a monitor that displays part of the
- compositor space.
-
- For objects version 3 onwards, after all xdg_output properties have been
- sent (when the object is created and when properties are updated), a
- wl_output.done event is sent. This allows changes to the output
- properties to be seen as atomic, even if they happen via multiple events.
- </description>
-
- <request name="destroy" type="destructor">
- <description summary="destroy the xdg_output object">
- Using this request a client can tell the server that it is not
- going to use the xdg_output object anymore.
- </description>
- </request>
-
- <event name="logical_position">
- <description summary="position of the output within the global compositor space">
- The position event describes the location of the wl_output within
- the global compositor space.
-
- The logical_position event is sent after creating an xdg_output
- (see xdg_output_manager.get_xdg_output) and whenever the location
- of the output changes within the global compositor space.
- </description>
- <arg name="x" type="int"
- summary="x position within the global compositor space"/>
- <arg name="y" type="int"
- summary="y position within the global compositor space"/>
- </event>
-
- <event name="logical_size">
- <description summary="size of the output in the global compositor space">
- The logical_size event describes the size of the output in the
- global compositor space.
-
- For example, a surface without any buffer scale, transformation
- nor rotation set, with the size matching the logical_size will
- have the same size as the corresponding output when displayed.
-
- Most regular Wayland clients should not pay attention to the
- logical size and would rather rely on xdg_shell interfaces.
-
- Some clients such as Xwayland, however, need this to configure
- their surfaces in the global compositor space as the compositor
- may apply a different scale from what is advertised by the output
- scaling property (to achieve fractional scaling, for example).
-
- For example, for a wl_output mode 3840×2160 and a scale factor 2:
-
- - A compositor not scaling the surface buffers will advertise a
- logical size of 3840×2160,
-
- - A compositor automatically scaling the surface buffers will
- advertise a logical size of 1920×1080,
-
- - A compositor using a fractional scale of 1.5 will advertise a
- logical size of 2560×1440.
-
- For example, for a wl_output mode 1920×1080 and a 90 degree rotation,
- the compositor will advertise a logical size of 1080x1920.
-
- The logical_size event is sent after creating an xdg_output
- (see xdg_output_manager.get_xdg_output) and whenever the logical
- size of the output changes, either as a result of a change in the
- applied scale or because of a change in the corresponding output
- mode(see wl_output.mode) or transform (see wl_output.transform).
- </description>
- <arg name="width" type="int"
- summary="width in global compositor space"/>
- <arg name="height" type="int"
- summary="height in global compositor space"/>
- </event>
-
- <event name="done">
- <description summary="all information about the output have been sent">
- This event is sent after all other properties of an xdg_output
- have been sent.
-
- This allows changes to the xdg_output properties to be seen as
- atomic, even if they happen via multiple events.
-
- For objects version 3 onwards, this event is deprecated. Compositors
- are not required to send it anymore and must send wl_output.done
- instead.
- </description>
- </event>
-
- <!-- Version 2 additions -->
-
- <event name="name" since="2">
- <description summary="name of this output">
- Many compositors will assign names to their outputs, show them to the
- user, allow them to be configured by name, etc. The client may wish to
- know this name as well to offer the user similar behaviors.
-
- The naming convention is compositor defined, but limited to
- alphanumeric characters and dashes (-). Each name is unique among all
- wl_output globals, but if a wl_output global is destroyed the same name
- may be reused later. The names will also remain consistent across
- sessions with the same hardware and software configuration.
-
- Examples of names include 'HDMI-A-1', 'WL-1', 'X11-1', etc. However, do
- not assume that the name is a reflection of an underlying DRM
- connector, X11 connection, etc.
-
- The name event is sent after creating an xdg_output (see
- xdg_output_manager.get_xdg_output). This event is only sent once per
- xdg_output, and the name does not change over the lifetime of the
- wl_output global.
- </description>
- <arg name="name" type="string" summary="output name"/>
- </event>
-
- <event name="description" since="2">
- <description summary="human-readable description of this output">
- Many compositors can produce human-readable descriptions of their
- outputs. The client may wish to know this description as well, to
- communicate the user for various purposes.
-
- The description is a UTF-8 string with no convention defined for its
- contents. Examples might include 'Foocorp 11" Display' or 'Virtual X11
- output via :1'.
-
- The description event is sent after creating an xdg_output (see
- xdg_output_manager.get_xdg_output) and whenever the description
- changes. The description is optional, and may not be sent at all.
-
- For objects of version 2 and lower, this event is only sent once per
- xdg_output, and the description does not change over the lifetime of
- the wl_output global.
- </description>
- <arg name="description" type="string" summary="output description"/>
- </event>
-
- </interface>
-</protocol>
diff --git a/src/holder.c b/src/holder.c
index 88ecbb1..2c30e06 100644
--- a/src/holder.c
+++ b/src/holder.c
@@ -1,16 +1,15 @@
+#include <fcntl.h>
+#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <getopt.h>
-#include <unistd.h>
-#include <time.h>
-#include <sys/mman.h>
-#include <fcntl.h>
#include <stdbool.h>
+#include <sys/mman.h>
+#include <time.h>
+#include <unistd.h>
#include <wayland-client.h>
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
-#include "xdg-output-unstable-v1-client-protocol.h"
typedef unsigned int uint;
@@ -19,16 +18,13 @@ struct wl_state {
struct wl_compositor *compositor;
struct wl_shm *shm;
struct zwlr_layer_shell_v1 *layer_shell;
- struct zxdg_output_manager_v1 *xdg_output_manager;
struct wl_list outputs; // struct display_output::link
char* monitor; // User selected output
- int run_display;
};
struct display_output {
uint32_t wl_name;
struct wl_output *wl_output;
- struct zxdg_output_v1 *xdg_output;
char *name;
struct wl_state *state;
@@ -55,7 +51,7 @@ static void revive_mpvpaper() {
// Get the "real" cwd
char exe_dir[1024];
int cut_point = readlink("/proc/self/exe", exe_dir, sizeof(exe_dir));
- for(uint i=cut_point; i > 1; i--) {
+ for (uint i=cut_point; i > 1; i--) {
if (exe_dir[i] == '/') {
exe_dir[i+1] = '\0';
break;
@@ -147,7 +143,6 @@ static void destroy_display_output(struct display_output *output) {
if (output->surface != NULL) {
wl_surface_destroy(output->surface);
}
- zxdg_output_v1_destroy(output->xdg_output);
wl_output_destroy(output->wl_output);
free(output->name);
@@ -163,13 +158,12 @@ static void layer_surface_configure(void *data, struct zwlr_layer_surface_v1 *su
if (halt_info.stoplist)
check_stoplist();
- if (halt_info.auto_stop) {
+ if (halt_info.auto_stop)
create_surface_frame(output);
- }
}
static void layer_surface_closed(void *data, struct zwlr_layer_surface_v1 *surface) {
- (void) surface;
+ (void)surface;
destroy_display_output(data);
}
@@ -202,16 +196,15 @@ static void create_layer_surface(struct display_output *output) {
}
-static void xdg_output_handle_name(void *data,
- struct zxdg_output_v1 *xdg_output, const char *name) {
- (void) xdg_output;
+static void output_name(void *data, struct wl_output *wl_output, const char *name) {
+ (void)wl_output;
struct display_output *output = data;
output->name = strdup(name);
}
-static void xdg_output_handle_done(void *data, struct zxdg_output_v1 *xdg_output) {
- (void) xdg_output;
+static void output_done(void *data, struct wl_output *wl_output) {
+ (void)wl_output;
struct display_output *output = data;
@@ -225,17 +218,17 @@ static void xdg_output_handle_done(void *data, struct zxdg_output_v1 *xdg_output
}
}
-static const struct zxdg_output_v1_listener xdg_output_listener = {
- .logical_position = nop,
- .logical_size = nop,
- .name = xdg_output_handle_name,
- .description = nop,
- .done = xdg_output_handle_done,
+static const struct wl_output_listener output_listener = {
+ .geometry = nop,
+ .mode = nop,
+ .done = output_done,
+ .scale = nop,
+ .name = output_name,
+ .description = nop,
};
-static void handle_global(void *data, struct wl_registry *registry,
- uint32_t name, const char *interface, uint32_t version) {
- (void) version;
+static void handle_global(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version) {
+ (void)version;
struct wl_state *state = data;
if (strcmp(interface, wl_compositor_interface.name) == 0) {
@@ -248,26 +241,17 @@ static void handle_global(void *data, struct wl_registry *registry,
struct display_output *output = calloc(1, sizeof(struct display_output));
output->state = state;
output->wl_name = name;
- output->wl_output = wl_registry_bind(registry, name, &wl_output_interface, 3);
-
+ output->wl_output = wl_registry_bind(registry, name, &wl_output_interface, 4);
+ wl_output_add_listener(output->wl_output, &output_listener, output);
wl_list_insert(&state->outputs, &output->link);
- if (state->run_display) {
- output->xdg_output = zxdg_output_manager_v1_get_xdg_output(
- state->xdg_output_manager, output->wl_output);
- zxdg_output_v1_add_listener(output->xdg_output, &xdg_output_listener, output);
- }
} else if (strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) {
- state->layer_shell = wl_registry_bind(registry, name,
- &zwlr_layer_shell_v1_interface, 1);
- } else if (strcmp(interface, zxdg_output_manager_v1_interface.name) == 0) {
- state->xdg_output_manager = wl_registry_bind(registry, name,
- &zxdg_output_manager_v1_interface, 2);
+ state->layer_shell = wl_registry_bind(registry, name, &zwlr_layer_shell_v1_interface, 1);
}
}
static void handle_global_remove(void *data, struct wl_registry *registry, uint32_t name) {
- (void) registry;
+ (void)registry;
struct wl_state *state = data;
struct display_output *output, *tmp;
@@ -319,8 +303,7 @@ static void parse_command_line(int argc, char **argv, struct wl_state *state) {
{"slideshow", required_argument, NULL, 'n'},
{"layer", required_argument, NULL, 'l'},
{"mpv-options", required_argument, NULL, 'o'},
- {0, 0, 0, 0}
- };
+ {0, 0, 0, 0}};
const char *usage =
"Usage: mpvpaper-holder <mpvpaper options>\n"
@@ -333,29 +316,27 @@ static void parse_command_line(int argc, char **argv, struct wl_state *state) {
"And if the wallpaper needs to be seen when drawn\n"
"- Set with \"-s\" or \"--auto-stop\" mpvpaper option\n";
- if(argc > 2) {
- char opt;
- while((opt = getopt_long(argc, argv, "hvfpsn:l:o:Z:", long_options, NULL)) != -1) {
-
- switch (opt) {
- case 'h':
- fprintf(stdout, "%s", usage);
- exit(EXIT_SUCCESS);
- case 's':
- halt_info.auto_stop = 1;
- break;
- }
- }
- if(optind + 1 >= argc) {
- fprintf(stderr, "%s", usage);
- exit(EXIT_FAILURE);
+
+ char opt;
+ while ((opt = getopt_long(argc, argv, "hvfpsn:l:o:Z:", long_options, NULL)) != -1) {
+
+ switch (opt) {
+ case 'h':
+ fprintf(stdout, "%s", usage);
+ exit(EXIT_SUCCESS);
+ case 's':
+ halt_info.auto_stop = 1;
+ break;
}
- state->monitor = strdup(argv[optind]);
}
- else {
+
+ // Need at least a display and video
+ if (optind + 1 >= argc) {
fprintf(stderr, "%s", usage);
exit(EXIT_FAILURE);
}
+
+ state->monitor = strdup(argv[optind]);
}
int main(int argc, char **argv) {
@@ -367,11 +348,11 @@ int main(int argc, char **argv) {
// Copy argv
int argv_alloc_size = 0;
- for(int i=0; argv[i] != NULL; i++) {
+ for (int i=0; argv[i] != NULL; i++) {
argv_alloc_size += strlen(argv[i])+1;
}
halt_info.argv_copy = calloc(argv_alloc_size+1, sizeof(char));
- for(int i=0; i < argc; i++) {
+ for (int i=0; i < argc; i++) {
halt_info.argv_copy[i] = strdup(argv[i]);
}
@@ -383,32 +364,21 @@ int main(int argc, char **argv) {
struct wl_registry *registry = wl_display_get_registry(state.display);
wl_registry_add_listener(registry, &registry_listener, &state);
wl_display_roundtrip(state.display);
- if (state.compositor == NULL || state.layer_shell == NULL ||
- state.xdg_output_manager == NULL) {
-
+ if (state.compositor == NULL || state.layer_shell == NULL) {
return EXIT_FAILURE;
}
- struct display_output *output;
- wl_list_for_each(output, &state.outputs, link) {
- output->xdg_output = zxdg_output_manager_v1_get_xdg_output(
- state.xdg_output_manager, output->wl_output);
- zxdg_output_v1_add_listener(output->xdg_output,
- &xdg_output_listener, output);
- }
-
// Check outputs
wl_display_roundtrip(state.display);
if (wl_list_empty(&state.outputs)) {
return EXIT_FAILURE;
}
- state.run_display = 1;
while (wl_display_dispatch(state.display) != -1) {
// NOP
}
- struct display_output *tmp_output;
+ struct display_output *output, *tmp_output;
wl_list_for_each_safe(output, tmp_output, &state.outputs, link) {
destroy_display_output(output);
}
diff --git a/src/main.c b/src/main.c
index 6482fd8..147d285 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,20 +1,19 @@
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
+#include <poll.h>
+#include <pthread.h>
+#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <poll.h>
-#include <pthread.h>
#include <stdbool.h>
-#include <signal.h>
#include <time.h>
#include <unistd.h>
#include <wayland-client.h>
#include <wayland-egl.h>
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
-#include "xdg-output-unstable-v1-client-protocol.h"
#include <glad/glad.h>
#include <glad/glad_egl.h>
@@ -30,17 +29,14 @@ struct wl_state {
struct wl_display *display;
struct wl_compositor *compositor;
struct zwlr_layer_shell_v1 *layer_shell;
- struct zxdg_output_manager_v1 *xdg_output_manager;
struct wl_list outputs; // struct display_output::link
char *monitor; // User selected output
int surface_layer;
- bool run_display;
};
struct display_output {
uint32_t wl_name;
struct wl_output *wl_output;
- struct zxdg_output_v1 *xdg_output;
char *name;
char *identifier;
@@ -644,7 +640,6 @@ static void destroy_display_output(struct display_output *output) {
if (output->egl_window) {
wl_egl_window_destroy(output->egl_window);
}
- zxdg_output_v1_destroy(output->xdg_output);
wl_output_destroy(output->wl_output);
free(output->name);
@@ -722,35 +717,15 @@ static void create_layer_surface(struct display_output *output) {
wl_surface_commit(output->surface);
}
-static void xdg_output_handle_name(void *data, struct zxdg_output_v1 *xdg_output, const char *name) {
- (void)xdg_output;
+static void output_name(void *data, struct wl_output *wl_output, const char *name) {
+ (void)wl_output;
struct display_output *output = data;
output->name = strdup(name);
}
-static void xdg_output_handle_description(void *data, struct zxdg_output_v1 *xdg_output, const char *description) {
- (void)xdg_output;
-
- struct display_output *output = data;
-
- // wlroots currently sets the description to `make model serial (name)`
- // If this changes in the future, this will need to be modified.
- char *paren = strrchr(description, '(');
- if (paren) {
- size_t length = paren - description;
- output->identifier = calloc(length, sizeof(char));
- if (!output->identifier) {
- cflp_warning("Failed to allocate output identifier");
- return;
- }
- strncpy(output->identifier, description, length);
- output->identifier[length - 1] = '\0';
- }
-}
-
-static void xdg_output_handle_done(void *data, struct zxdg_output_v1 *xdg_output) {
- (void)xdg_output;
+static void output_done(void *data, struct wl_output *wl_output) {
+ (void)wl_output;
struct display_output *output = data;
@@ -767,24 +742,38 @@ static void xdg_output_handle_done(void *data, struct zxdg_output_v1 *xdg_output
}
}
-static const struct zxdg_output_v1_listener xdg_output_listener = {
- .logical_position = nop,
- .logical_size = nop,
- .name = xdg_output_handle_name,
- .description = xdg_output_handle_description,
- .done = xdg_output_handle_done,
-};
-
static void output_scale(void *data, struct wl_output *wl_output, int32_t scale) {
struct display_output *output = data;
output->scale = scale;
}
+static void output_description(void *data, struct wl_output *wl_output, const char *description) {
+ (void)wl_output;
+
+ struct display_output *output = data;
+
+ // wlroots currently sets the description to `make model serial (name)`
+ // If this changes in the future, this will need to be modified.
+ char *paren = strrchr(description, '(');
+ if (paren) {
+ size_t length = paren - description;
+ output->identifier = calloc(length, sizeof(char));
+ if (!output->identifier) {
+ cflp_warning("Failed to allocate output identifier");
+ return;
+ }
+ strncpy(output->identifier, description, length);
+ output->identifier[length - 1] = '\0';
+ }
+}
+
static const struct wl_output_listener output_listener = {
.geometry = nop,
- .mode = nop,
- .scale = output_scale,
- .done = nop,
+ .mode = nop,
+ .done = output_done,
+ .scale = output_scale,
+ .name = output_name,
+ .description = output_description,
};
static void handle_global(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version) {
@@ -798,19 +787,12 @@ static void handle_global(void *data, struct wl_registry *registry, uint32_t nam
output->scale = 1; // Default to no scaling
output->state = state;
output->wl_name = name;
- output->wl_output = wl_registry_bind(registry, name, &wl_output_interface, 3);
+ output->wl_output = wl_registry_bind(registry, name, &wl_output_interface, 4);
wl_output_add_listener(output->wl_output, &output_listener, output);
-
wl_list_insert(&state->outputs, &output->link);
- if (state->run_display) {
- output->xdg_output = zxdg_output_manager_v1_get_xdg_output(state->xdg_output_manager, output->wl_output);
- zxdg_output_v1_add_listener(output->xdg_output, &xdg_output_listener, output);
- }
} else if (strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) {
state->layer_shell = wl_registry_bind(registry, name, &zwlr_layer_shell_v1_interface, 1);
- } else if (strcmp(interface, zxdg_output_manager_v1_interface.name) == 0) {
- state->xdg_output_manager = wl_registry_bind(registry, name, &zxdg_output_manager_v1_interface, 2);
}
}
@@ -1054,17 +1036,11 @@ int main(int argc, char **argv) {
struct wl_registry *registry = wl_display_get_registry(state.display);
wl_registry_add_listener(registry, &registry_listener, &state);
wl_display_roundtrip(state.display);
- if (state.compositor == NULL || state.layer_shell == NULL || state.xdg_output_manager == NULL) {
+ if (state.compositor == NULL || state.layer_shell == NULL) {
cflp_error("Missing a required Wayland interface");
return EXIT_FAILURE;
}
- struct display_output *output;
- wl_list_for_each(output, &state.outputs, link) {
- output->xdg_output = zxdg_output_manager_v1_get_xdg_output(state.xdg_output_manager, output->wl_output);
- zxdg_output_v1_add_listener(output->xdg_output, &xdg_output_listener, output);
- }
-
// Check outputs
wl_display_roundtrip(state.display);
if (wl_list_empty(&state.outputs)) {
@@ -1072,8 +1048,6 @@ int main(int argc, char **argv) {
return EXIT_FAILURE;
}
- state.run_display = 1;
-
// Main Loop
while (true) {
if (wl_display_flush(state.display) == -1 && errno != EAGAIN)
@@ -1113,6 +1087,7 @@ int main(int argc, char **argv) {
mpv_render_context_update(mpv_glcontext);
// Draw frame for all outputs
+ struct display_output *output;
wl_list_for_each(output, &state.outputs, link) {
// Redraw immediately if not waiting for frame callback
if (output->frame_callback == NULL)
@@ -1123,7 +1098,7 @@ int main(int argc, char **argv) {
}
}
- struct display_output *tmp_output;
+ struct display_output *output, *tmp_output;
wl_list_for_each_safe(output, tmp_output, &state.outputs, link) {
destroy_display_output(output);
}