smooth resize
This commit is contained in:
+22
-25
@@ -24,31 +24,7 @@ struct absinthe_toplevel *absinthe_toplevel_at(struct absinthe_server *server, d
|
||||
return tree->node.data;
|
||||
}
|
||||
|
||||
void absinthe_toplevel_set_position(struct absinthe_toplevel *toplevel, int32_t x, int32_t y)
|
||||
{
|
||||
wlr_scene_node_set_position(&toplevel->scene_tree->node, x, y);
|
||||
}
|
||||
|
||||
void absinthe_toplevel_set_size(struct absinthe_toplevel *toplevel, int32_t width, int32_t height)
|
||||
{
|
||||
if (width < 0 || height < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (width == toplevel->xdg_toplevel->current.width && height == toplevel->xdg_toplevel->current.height) {
|
||||
return;
|
||||
}
|
||||
|
||||
toplevel->geometry.width = width;
|
||||
toplevel->geometry.height = height;
|
||||
|
||||
int bw = ABSINTHE_BORDER_WIDTH;
|
||||
|
||||
wlr_xdg_toplevel_set_size(toplevel->xdg_toplevel, width, height);
|
||||
wlr_xdg_surface_schedule_configure(toplevel->xdg_toplevel->base);
|
||||
}
|
||||
|
||||
void absinthe_toplevel_update_border_geometry(struct absinthe_toplevel *toplevel)
|
||||
void absinthe_toplevel_update_borders_geometry(struct absinthe_toplevel *toplevel)
|
||||
{
|
||||
int bw = ABSINTHE_BORDER_WIDTH;
|
||||
|
||||
@@ -56,6 +32,7 @@ void absinthe_toplevel_update_border_geometry(struct absinthe_toplevel *toplevel
|
||||
return;
|
||||
}
|
||||
|
||||
wlr_scene_node_set_position(&toplevel->scene_tree->node, toplevel->geometry.x, toplevel->geometry.y);
|
||||
wlr_scene_node_set_position(&toplevel->scene_surface->node, bw, bw);
|
||||
|
||||
wlr_scene_rect_set_size(toplevel->border[0], toplevel->geometry.width - 2 * bw, bw);
|
||||
@@ -69,6 +46,26 @@ void absinthe_toplevel_update_border_geometry(struct absinthe_toplevel *toplevel
|
||||
wlr_scene_node_set_position(&toplevel->border[3]->node, toplevel->geometry.width - bw, 0);
|
||||
}
|
||||
|
||||
void absinthe_toplevel_set_position(struct absinthe_toplevel *toplevel, int32_t x, int32_t y)
|
||||
{
|
||||
wlr_scene_node_set_position(&toplevel->scene_tree->node, x, y);
|
||||
}
|
||||
|
||||
void absinthe_toplevel_set_size(struct absinthe_toplevel *toplevel, int32_t width, int32_t height)
|
||||
{
|
||||
int bw = ABSINTHE_BORDER_WIDTH;
|
||||
|
||||
if (width - 2 * bw < 0 || height - 2 * bw < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
toplevel->geometry.width = width;
|
||||
toplevel->geometry.height = height;
|
||||
|
||||
wlr_xdg_toplevel_set_size(toplevel->xdg_toplevel, width, height);
|
||||
wlr_xdg_surface_schedule_configure(toplevel->xdg_toplevel->base);
|
||||
}
|
||||
|
||||
void absinthe_toplevel_set_border_color(struct absinthe_toplevel *toplevel, const float color[4])
|
||||
{
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
|
||||
Reference in New Issue
Block a user