refactor + add request set selection handles

This commit is contained in:
DanyLE
2024-04-01 23:51:48 +02:00
parent 0d84bd388c
commit 68b1890d61
5 changed files with 47 additions and 22 deletions

17
xdg.c
View File

@@ -55,8 +55,15 @@ static void begin_interactive(struct diyac_view *toplevel,
static void xdg_toplevel_map(struct wl_listener *listener, void *data)
{
/* Called when the surface is mapped, or ready to display on-screen. */
struct diyac_view *toplevel = wl_container_of(listener, toplevel, map);
/*
wlr_xdg_toplevel_set_wm_capabilities(toplevel->xdg_toplevel,
WLR_XDG_TOPLEVEL_WM_CAPABILITIES_MAXIMIZE |
WLR_XDG_TOPLEVEL_WM_CAPABILITIES_MINIMIZE);
//WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN
*/
wlr_xdg_surface_get_geometry(toplevel->xdg_toplevel->base, &toplevel->original);
wlr_scene_node_set_enabled(&toplevel->scene_tree->node, true);
toplevel->mapped = true;
@@ -157,13 +164,6 @@ static void xdg_toplevel_request_fullscreen(struct wl_listener *listener, void *
{
struct diyac_view *toplevel =
wl_container_of(listener, toplevel, request_fullscreen);
wlr_log(WLR_INFO, "Cursor state %d", toplevel->server->seat.cursor_mode);
if (toplevel->server->seat.cursor_mode != DIYAC_CURSOR_PASSTHROUGH)
{
wlr_log(WLR_INFO, "The view is under move/resize, disable fullcreen event");
wlr_xdg_toplevel_set_fullscreen(toplevel->xdg_toplevel, false);
return;
}
if (!toplevel->mapped)
{
wlr_xdg_toplevel_set_fullscreen(toplevel->xdg_toplevel, false);
@@ -175,7 +175,6 @@ static void xdg_toplevel_request_fullscreen(struct wl_listener *listener, void *
diyac_reset_cursor_mode(toplevel->server);
wlr_xdg_toplevel_set_fullscreen(toplevel->xdg_toplevel, false);
/*
if (toplevel->state == DIYAC_VIEW_FULL_SCREEN)
{
toplevel->state = DIYAC_VIEW_NORMAL;
@@ -386,7 +385,7 @@ void diyac_new_xdg_surface(struct wl_listener *listener, void *data)
wlr_log(WLR_INFO, "diyac_new_xdg_surface: Creating new application windows");
wlr_xdg_surface_ping(xdg_surface);
/* Allocate a diyac_view for this surface */
struct diyac_view *toplevel = calloc(1, sizeof(*toplevel));
struct diyac_view *toplevel = calloc(1, sizeof(*toplevel));
toplevel->state = DIYAC_VIEW_NORMAL;
toplevel->server = server;
toplevel->xdg_toplevel = xdg_surface->toplevel;