feat: allows fullscreen support
This commit is contained in:
67
xdg.c
67
xdg.c
@@ -79,10 +79,7 @@ static void xdg_toplevel_map(struct wl_listener *listener, void *data)
|
||||
toplevel->original.height = toplevel->output->usable_area.height;
|
||||
}
|
||||
diyac_view_update_geometry(toplevel, false);
|
||||
if (toplevel->state != DIYAC_VIEW_MINIMIZE)
|
||||
{
|
||||
diyac_focus_view(toplevel, false);
|
||||
}
|
||||
diyac_focus_view(toplevel, false);
|
||||
}
|
||||
|
||||
static void xdg_toplevel_unmap(struct wl_listener *listener, void *data)
|
||||
@@ -136,74 +133,41 @@ static void xdg_toplevel_request_maximize(
|
||||
|
||||
struct diyac_view *toplevel =
|
||||
wl_container_of(listener, toplevel, request_maximize);
|
||||
if (!toplevel->mapped)
|
||||
if(toplevel->xdg_toplevel->requested.maximized)
|
||||
{
|
||||
wlr_xdg_toplevel_set_maximized(toplevel->xdg_toplevel, false);
|
||||
// the view has not yet be mapped, don't maximize it
|
||||
wlr_log(WLR_INFO, "The view has not yet be mapped, ignore maximize request");
|
||||
return;
|
||||
toplevel->requested = DIYAC_VIEW_MAXIMIZE;
|
||||
}
|
||||
else if(toplevel->state == DIYAC_VIEW_MAXIMIZE)
|
||||
{
|
||||
toplevel->requested = DIYAC_VIEW_NORMAL;
|
||||
}
|
||||
wlr_log(WLR_INFO, "Request maximize");
|
||||
diyac_reset_cursor_mode(toplevel->server);
|
||||
if (toplevel->state == DIYAC_VIEW_MAXIMIZE)
|
||||
{
|
||||
toplevel->state = DIYAC_VIEW_NORMAL;
|
||||
wlr_xdg_toplevel_set_maximized(toplevel->xdg_toplevel, false);
|
||||
// restore its default geometry
|
||||
}
|
||||
else
|
||||
{
|
||||
wlr_xdg_toplevel_set_maximized(toplevel->xdg_toplevel, true);
|
||||
toplevel->state = DIYAC_VIEW_MAXIMIZE;
|
||||
}
|
||||
diyac_view_update_geometry(toplevel, false);
|
||||
// wlr_xdg_surface_schedule_configure(toplevel->xdg_toplevel->base);
|
||||
}
|
||||
|
||||
static void xdg_toplevel_request_fullscreen(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct diyac_view *toplevel =
|
||||
wl_container_of(listener, toplevel, request_fullscreen);
|
||||
if (!toplevel->mapped)
|
||||
if(toplevel->xdg_toplevel->requested.fullscreen)
|
||||
{
|
||||
wlr_xdg_toplevel_set_fullscreen(toplevel->xdg_toplevel, false);
|
||||
// the view has not yet be mapped, don't maximize it
|
||||
wlr_log(WLR_INFO, "The view has not yet be mapped, ignore fullscreen request");
|
||||
return;
|
||||
toplevel->requested = DIYAC_VIEW_FULL_SCREEN;
|
||||
}
|
||||
else if(toplevel->state == DIYAC_VIEW_FULL_SCREEN)
|
||||
{
|
||||
toplevel->requested = DIYAC_VIEW_NORMAL;
|
||||
}
|
||||
wlr_log(WLR_INFO, "Request fullscreen");
|
||||
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;
|
||||
wlr_xdg_toplevel_set_fullscreen(toplevel->xdg_toplevel, false);
|
||||
// restore its default geometry
|
||||
}
|
||||
else
|
||||
{
|
||||
toplevel->state = DIYAC_VIEW_FULL_SCREEN;
|
||||
}
|
||||
|
||||
*/
|
||||
// diyac_view_update_geometry(toplevel, false);
|
||||
diyac_view_update_geometry(toplevel, false);
|
||||
}
|
||||
|
||||
static void xdg_toplevel_request_minimize(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct diyac_view *toplevel =
|
||||
wl_container_of(listener, toplevel, request_minimize);
|
||||
if (toplevel->state == DIYAC_VIEW_MINIMIZE)
|
||||
{
|
||||
toplevel->state = DIYAC_VIEW_NORMAL;
|
||||
// restore its default geometry
|
||||
}
|
||||
else
|
||||
{
|
||||
toplevel->state = DIYAC_VIEW_MINIMIZE;
|
||||
}
|
||||
diyac_view_update_geometry(toplevel, false);
|
||||
wlr_xdg_surface_schedule_configure(toplevel->xdg_toplevel->base);
|
||||
}
|
||||
|
||||
static void xdg_toplevel_destroy(struct wl_listener *listener, void *data)
|
||||
@@ -387,6 +351,7 @@ void diyac_new_xdg_surface(struct wl_listener *listener, void *data)
|
||||
/* Allocate a diyac_view for this surface */
|
||||
struct diyac_view *toplevel = calloc(1, sizeof(*toplevel));
|
||||
toplevel->state = DIYAC_VIEW_NORMAL;
|
||||
toplevel->requested = DIYAC_VIEW_NORMAL;
|
||||
toplevel->server = server;
|
||||
toplevel->xdg_toplevel = xdg_surface->toplevel;
|
||||
toplevel->xdg_surface = xdg_surface;
|
||||
|
Reference in New Issue
Block a user