improvement on xdg request handles

This commit is contained in:
DanyLE
2024-04-01 22:12:35 +02:00
parent 8945f8b345
commit 0d84bd388c
8 changed files with 83 additions and 46 deletions

27
diyac.c
View File

@ -4,6 +4,8 @@
#include <unistd.h>
#include <getopt.h>
#include <wlr/util/log.h>
#include <wlr/types/wlr_primary_selection_v1.h>
#include <wlr/types/wlr_fractional_scale_v1.h>
#include "output.h"
#include "xdg.h"
#include "cursor.h"
@ -84,6 +86,17 @@ int main(int argc, char *argv[])
wlr_compositor_create(server.wl_display, 5, server.renderer);
wlr_subcompositor_create(server.wl_display);
wlr_data_device_manager_create(server.wl_display);
/*
* Empirically, primary selection doesn't work with Gtk apps unless the
* device manager is one of the earliest globals to be advertised. All
* credit to Wayfire for discovering this, though their symptoms
* (crash) are not the same as ours (silently does nothing). When adding
* more globals above this line it would be as well to check that
* middle-button paste still works with any Gtk app of your choice
*
* https://wayfire.org/2020/08/04/Wayfire-0-5.html
*/
wlr_primary_selection_v1_device_manager_create(server.wl_display);
/* Creates an output layout, which a wlroots utility for working with an
* arrangement of screens in a physical layout. */
@ -103,25 +116,25 @@ int main(int argc, char *argv[])
*/
server.scene = wlr_scene_create();
server.scene_layout = wlr_scene_attach_output_layout(server.scene, server.output_layout);
/* Set up xdg-shell version 3. The xdg-shell is a Wayland protocol which is
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
* https://drewdevault.com/2018/07/29/Wayland-shells.html.
*/
wl_list_init(&server.views);
server.view_tree = wlr_scene_tree_create(&server.scene->tree);
server.xdg_popup_tree = wlr_scene_tree_create(&server.scene->tree);
server.xdg_shell = wlr_xdg_shell_create(server.wl_display, 3);
server.xdg_shell = wlr_xdg_shell_create(server.wl_display, 6);
server.new_xdg_surface.notify = diyac_new_xdg_surface;
wl_signal_add(&server.xdg_shell->events.new_surface,
&server.new_xdg_surface);
server.layer_shell = wlr_layer_shell_v1_create(server.wl_display,4);
server.layer_shell = wlr_layer_shell_v1_create(server.wl_display, 4);
server.new_layer_surface.notify = diyac_new_layer_surface;
wl_signal_add(&server.layer_shell->events.new_surface,
&server.new_layer_surface);
&server.new_layer_surface);
diyac_init_cursor_manager(&server);
/*