better handling different window state, support fullscreen mode

This commit is contained in:
DanyLE
2024-04-03 00:48:59 +02:00
parent 1ae9cd000a
commit bca498f387
5 changed files with 123 additions and 95 deletions

View File

@@ -54,18 +54,16 @@ static void process_cursor_move(struct diyac_server *server, uint32_t time)
{
struct diyac_view *toplevel = server->grabbed_view;
/* Move the grabbed toplevel to the new position. */
if (toplevel->state == DIYAC_VIEW_FULL_SCREEN)
if (toplevel->state.fullscreen)
{
return;
}
if (toplevel->state == DIYAC_VIEW_MAXIMIZE)
if (toplevel->state.maximized)
{
// cancel maximize state
wlr_xdg_toplevel_set_maximized(toplevel->xdg_toplevel, false);
toplevel->requested.maximized = false;
// move the windows to cursor
server->grab_x = toplevel->original.width * server->grab_x / toplevel->output->usable_area.width;
}
toplevel->requested = DIYAC_VIEW_NORMAL;
toplevel->original.y = server->seat.cursor->y - server->grab_y;
toplevel->original.x = server->seat.cursor->x - server->grab_x;
@@ -90,6 +88,10 @@ static void process_cursor_resize(struct diyac_server *server, uint32_t time)
* size, then commit any movement that was prepared.
*/
struct diyac_view *toplevel = server->grabbed_view;
if(toplevel->state.fullscreen)
{
return;
}
double border_x = server->seat.cursor->x - server->grab_x;
double border_y = server->seat.cursor->y - server->grab_y;
int new_left = server->grab_geobox.x;
@@ -138,7 +140,7 @@ static void process_cursor_resize(struct diyac_server *server, uint32_t time)
int new_height = new_bottom - new_top;
toplevel->original.width = new_width;
toplevel->original.height = new_height;
toplevel->requested = DIYAC_VIEW_NORMAL;
toplevel->requested.maximized = false;
diyac_view_update_geometry(toplevel, false);
/*
wlr_scene_node_set_position(&toplevel->scene_tree->node,