LISTEN macro & xwayland resize fix

This commit is contained in:
2026-05-04 14:23:18 +07:00
parent 385ff13e7b
commit b7b0f4617f
3 changed files with 40 additions and 49 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
#define CURSOR_MOVE_BUTTON BTN_LEFT
#define CURSOR_RESIZE_BUTTON BTN_RIGHT
#define TOPLEVEL_BW 1
#define TOPLEVEL_BW 1
static const float focused_bc[4] = { 0.0, 0.0, 1.0, 1.0 };
static const float urgent_bc[4] = { 1.0, 0.0, 0.0, 1.0 };
+19 -17
View File
@@ -43,28 +43,30 @@ process_cursor_move(struct absinthe_server *server)
static void
apply_resize(struct absinthe_toplevel *toplevel, struct wlr_box *new_geometry)
{
int32_t min_width = toplevel->xdg->current.min_width;
int32_t min_height = toplevel->xdg->current.min_height;
if (toplevel->type == TOPLEVEL_XDG) {
int32_t min_width = toplevel->xdg->current.min_width;
int32_t min_height = toplevel->xdg->current.min_height;
int32_t max_width = toplevel->xdg->current.max_width;
int32_t max_height = toplevel->xdg->current.max_height;
int32_t max_width = toplevel->xdg->current.max_width;
int32_t max_height = toplevel->xdg->current.max_height;
if (max_width == 0)
max_width = 10000;
if (max_width == 0)
max_width = 10000;
if (max_height == 0)
max_height = 10000;
if (max_height == 0)
max_height = 10000;
if (!(new_geometry->width >= min_width &&
new_geometry->width <= max_width)) {
new_geometry->width = toplevel->geom.width;
new_geometry->x = toplevel->geom.x;
}
if (!(new_geometry->width >= min_width &&
new_geometry->width <= max_width)) {
new_geometry->width = toplevel->geom.width;
new_geometry->x = toplevel->geom.x;
}
if (!(new_geometry->height >= min_height &&
new_geometry->height <= max_height)) {
new_geometry->height = toplevel->geom.height;
new_geometry->y = toplevel->geom.y;
if (!(new_geometry->height >= min_height &&
new_geometry->height <= max_height)) {
new_geometry->height = toplevel->geom.height;
new_geometry->y = toplevel->geom.y;
}
}
toplevel_set_size(toplevel, new_geometry->width, new_geometry->height);
+20 -31
View File
@@ -82,31 +82,22 @@ new_xdg_toplevel(struct wl_listener *listener, void *data)
wlr_surface_set_preferred_buffer_scale(toplevel->xdg->base->surface, 1);
toplevel->commit.notify = toplevel_commit;
wl_signal_add(&xdg_toplevel->base->surface->events.commit,
&toplevel->commit);
toplevel->map.notify = toplevel_map;
wl_signal_add(&xdg_toplevel->base->surface->events.map, &toplevel->map);
toplevel->unmap.notify = toplevel_unmap;
wl_signal_add(&xdg_toplevel->base->surface->events.unmap,
&toplevel->unmap);
toplevel->destroy.notify = toplevel_destroy;
wl_signal_add(&xdg_toplevel->events.destroy, &toplevel->destroy);
toplevel->request_move.notify = toplevel_request_move;
wl_signal_add(&xdg_toplevel->events.request_move,
&toplevel->request_move);
toplevel->request_resize.notify = toplevel_request_resize;
wl_signal_add(&xdg_toplevel->events.request_resize,
&toplevel->request_resize);
toplevel->request_maximize.notify = toplevel_request_maximize;
wl_signal_add(&xdg_toplevel->events.request_maximize,
&toplevel->request_maximize);
toplevel->request_fullscreen.notify = toplevel_request_fullscreen;
wl_signal_add(&xdg_toplevel->events.request_fullscreen,
&toplevel->request_fullscreen);
LISTEN(toplevel->commit, toplevel_commit,
xdg_toplevel->base->surface->events.commit);
LISTEN(toplevel->map, toplevel_map,
xdg_toplevel->base->surface->events.map);
LISTEN(toplevel->unmap, toplevel_unmap,
xdg_toplevel->base->surface->events.unmap);
LISTEN(toplevel->destroy, toplevel_destroy,
xdg_toplevel->events.destroy);
LISTEN(toplevel->request_move, toplevel_request_move,
xdg_toplevel->events.request_move);
LISTEN(toplevel->request_resize, toplevel_request_resize,
xdg_toplevel->events.request_resize);
LISTEN(toplevel->request_maximize, toplevel_request_maximize,
xdg_toplevel->events.request_maximize);
LISTEN(toplevel->request_fullscreen, toplevel_request_fullscreen,
xdg_toplevel->events.request_fullscreen);
}
void
@@ -126,12 +117,10 @@ new_xdg_popup(struct wl_listener *listener, void *data)
xdg_popup->base->data = wlr_scene_xdg_surface_create(parent_tree,
xdg_popup->base);
popup->commit.notify = xdg_popup_commit;
wl_signal_add(&xdg_popup->base->surface->events.commit, &popup->commit);
popup->destroy.notify = xdg_popup_destroy;
wl_signal_add(&xdg_popup->base->surface->events.destroy,
&popup->destroy);
LISTEN(popup->commit, xdg_popup_commit,
xdg_popup->base->surface->events.commit);
LISTEN(popup->destroy, xdg_popup_destroy,
xdg_popup->base->surface->events.destroy);
}
void