commit 1536be8f233685ceff2688724c8063430b3c677a
parent 703957e6c9e49e2ef11485de05a3dba3972afb01
Author: dalem <lain@dalem.foo>
Date: Sun, 22 Feb 2026 21:08:39 +0100
Do not scale views with always_top flag
This change makes it so that if a view has the always_top property it is not scaled up/down while zooming
This avoids issues with panels being resized in hevel (unwanted behavior)
Diffstat:
4 files changed, 39 insertions(+), 21 deletions(-)
diff --git a/libswc/compositor.c b/libswc/compositor.c
@@ -755,14 +755,28 @@ render_zoomed_to_shm(struct screen *screen, float zoom)
}
/* maths zoom position and size */
- float zoomed_x = (geom->x - cx) * zoom + width / 2.0f;
- float zoomed_y = (geom->y - cy) * zoom + height / 2.0f;
- float zoomed_w = geom->width * zoom;
- float zoomed_h = geom->height * zoom;
+ float zoomed_x, zoomed_y, zoomed_w, zoomed_h;
+ float border_out, border_in, total_border;
- float border_out = view->border.outwidth * zoom;
- float border_in = view->border.inwidth * zoom;
- float total_border = border_out + border_in;
+ if (view->always_top) {
+ zoomed_x = geom->x - screen_x;
+ zoomed_y = geom->y - screen_y;
+ zoomed_w = geom->width;
+ zoomed_h = geom->height;
+
+ border_out = view->border.outwidth;
+ border_in = view->border.inwidth;
+ } else {
+ zoomed_x = (geom->x - cx) * zoom + width / 2.0f;
+ zoomed_y = (geom->y - cy) * zoom + height / 2.0f;
+ zoomed_w = geom->width * zoom;
+ zoomed_h = geom->height * zoom;
+
+ border_out = view->border.outwidth * zoom;
+ border_in = view->border.inwidth * zoom;
+ }
+
+ total_border = border_out + border_in;
if (zoomed_x + zoomed_w + total_border < 0 ||
zoomed_x - total_border >= (int32_t)width ||
@@ -834,12 +848,15 @@ render_zoomed_to_shm(struct screen *screen, float zoom)
src->map, src->pitch);
if (src_img) {
- pixman_transform_t transform;
- pixman_transform_init_identity(&transform);
- pixman_fixed_t scale = pixman_double_to_fixed(1.0 / zoom);
- pixman_transform_scale(&transform, NULL, scale, scale);
- pixman_image_set_transform(src_img, &transform);
- pixman_image_set_filter(src_img, PIXMAN_FILTER_BILINEAR, NULL, 0);
+ if (!view->always_top) {
+ pixman_transform_t transform;
+ pixman_transform_init_identity(&transform);
+ pixman_fixed_t scale = pixman_double_to_fixed(1.0 / zoom);
+ pixman_transform_scale(&transform, NULL, scale, scale);
+ pixman_image_set_transform(src_img, &transform);
+ pixman_image_set_filter(src_img, PIXMAN_FILTER_BILINEAR, NULL,
+ 0);
+ }
pixman_image_composite32(PIXMAN_OP_OVER, src_img, NULL, dst_img, 0,
0, 0, 0, (int32_t)zoomed_x,
@@ -1034,7 +1051,7 @@ raise_window(struct compositor_view *view)
if (!other->visible) {
continue;
}
-
+
if (other->always_top) {
insert_after = &other->link;
continue;
@@ -1294,7 +1311,7 @@ compositor_view_show(struct compositor_view *view)
view->visible = true;
view_update_screens(&view->base);
-
+
if (view->window) {
raise_window(view);
}
diff --git a/libswc/compositor.h b/libswc/compositor.h
@@ -64,7 +64,7 @@ struct compositor_view {
/* Whether or not the view is visible (mapped). */
bool visible;
-
+
/* Whether or not to make it always be on top of other windows */
bool always_top;
@@ -137,7 +137,9 @@ compositor_get_buffer(struct screen *screen);
struct wld_buffer *
compositor_render_to_shm(struct screen *screen);
-void raise_window(struct compositor_view *view);
-void raise_window_top(struct compositor_view *view);
+void
+raise_window(struct compositor_view *view);
+void
+raise_window_top(struct compositor_view *view);
#endif
diff --git a/libswc/panel.c b/libswc/panel.c
@@ -143,7 +143,7 @@ set_offset(struct wl_client *client, struct wl_resource *resource,
static void
set_y_offset(struct wl_client *client, struct wl_resource *resource,
- uint32_t offset)
+ uint32_t offset)
{
struct panel *panel = wl_resource_get_user_data(resource);
@@ -168,7 +168,7 @@ set_strut(struct wl_client *client, struct wl_resource *resource, uint32_t size,
static const struct swc_panel_interface panel_impl = {
.dock = dock,
.set_offset = set_offset,
- .set_y_offset = set_y_offset,
+ .set_y_offset = set_y_offset,
.set_strut = set_strut,
};
diff --git a/libswc/seat-ws.c b/libswc/seat-ws.c
@@ -311,7 +311,6 @@ initialize_wscons(struct seat *seat)
kbd_t encoding;
unsigned i;
-
if ((seat->mouse_fd =
launch_open_device("/dev/wsmouse", O_RDWR | O_NONBLOCK)) == -1) {
ERROR("Could not open mouse device\n");