From 13543e13820812d2d51ef617dac55f0a3152d3eb Mon Sep 17 00:00:00 2001 From: DanyLE Date: Sat, 5 Jul 2025 19:07:57 +0200 Subject: [PATCH] add support for the following protocols: - wlr_xdg_output_v1 - wlr_screencopy_v1 - wlr_export_dmabuf_v1 - wlr_data_control_v1 - wlr_single_pixel_buffer_v1 minor feature: add option -v to increase the log level --- diyac.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/diyac.c b/diyac.c index 46af10a..95f0651 100644 --- a/diyac.c +++ b/diyac.c @@ -8,6 +8,11 @@ #include #include #include +#include +#include +#include +#include +#include #include "output.h" #include "xdg.h" #include "cursor.h" @@ -54,15 +59,20 @@ static int session_monitor(void *data) int main(int argc, char *argv[]) { - wlr_log_init(WLR_INFO, NULL); char *startup_cmd = NULL; int exit_with_session = 0; - + int log_level = WLR_ERROR; int c; - while ((c = getopt(argc, argv, "xh")) != -1) + while ((c = getopt(argc, argv, "xvh")) != -1) { switch (c) { + case 'v': + if(log_level < WLR_DEBUG) + { + log_level++; + } + break; case 'x': exit_with_session = 1; break; @@ -86,6 +96,7 @@ int main(int argc, char *argv[]) // the last argument is the startup command startup_cmd = argv[optind]; } + wlr_log_init(log_level, NULL); struct diyac_server server = {0}; /* The Wayland display is managed by libwayland. It handles accepting * clients from the Unix socket, manging Wayland globals, and so on. */ @@ -167,6 +178,11 @@ int main(int argc, char *argv[]) */ server.scene = wlr_scene_create(); server.scene_layout = wlr_scene_attach_output_layout(server.scene, server.output_layout); + wlr_xdg_output_manager_v1_create(server.wl_display,server.output_layout); + wlr_export_dmabuf_manager_v1_create(server.wl_display); + wlr_data_control_manager_v1_create(server.wl_display); + wlr_screencopy_manager_v1_create(server.wl_display); + wlr_single_pixel_buffer_manager_v1_create(server.wl_display); wlr_fractional_scale_manager_v1_create(server.wl_display,1); /* Set up xdg-shell version 6 The xdg-shell is a Wayland protocol which is * used for application windows. For more detail on shells, refer to @@ -263,7 +279,9 @@ int main(int argc, char *argv[]) { wl_event_source_remove(server.proc_mon); } - // TODO remove all event listeners + wl_list_remove(&server.new_xdg_toplevel.link); + wl_list_remove(&server.new_layer_surface.link); + wl_list_remove(&server.new_output.link); wl_display_destroy_clients(server.wl_display); // wlr_scene_node_destroy(&server.scene->tree.node); wlr_xcursor_manager_destroy(server.seat.cursor_mgr);