commit 1536be8

dalem  ·  2026-02-22 20:08:39 +0000 UTC
parent 703957e
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)
4 files changed,  +39, -21
+32, -15
 1@@ -755,14 +755,28 @@ render_zoomed_to_shm(struct screen *screen, float zoom)
 2 		}
 3 
 4 		/* maths     zoom position and size */
 5-		float zoomed_x = (geom->x - cx) * zoom + width / 2.0f;
 6-		float zoomed_y = (geom->y - cy) * zoom + height / 2.0f;
 7-		float zoomed_w = geom->width * zoom;
 8-		float zoomed_h = geom->height * zoom;
 9+		float zoomed_x, zoomed_y, zoomed_w, zoomed_h;
10+		float border_out, border_in, total_border;
11 
12-		float border_out = view->border.outwidth * zoom;
13-		float border_in = view->border.inwidth * zoom;
14-		float total_border = border_out + border_in;
15+		if (view->always_top) {
16+			zoomed_x = geom->x - screen_x;
17+			zoomed_y = geom->y - screen_y;
18+			zoomed_w = geom->width;
19+			zoomed_h = geom->height;
20+
21+			border_out = view->border.outwidth;
22+			border_in = view->border.inwidth;
23+		} else {
24+			zoomed_x = (geom->x - cx) * zoom + width / 2.0f;
25+			zoomed_y = (geom->y - cy) * zoom + height / 2.0f;
26+			zoomed_w = geom->width * zoom;
27+			zoomed_h = geom->height * zoom;
28+
29+			border_out = view->border.outwidth * zoom;
30+			border_in = view->border.inwidth * zoom;
31+		}
32+
33+		total_border = border_out + border_in;
34 
35 		if (zoomed_x + zoomed_w + total_border < 0 ||
36 		    zoomed_x - total_border >= (int32_t)width ||
37@@ -834,12 +848,15 @@ render_zoomed_to_shm(struct screen *screen, float zoom)
38 		    src->map, src->pitch);
39 
40 		if (src_img) {
41-			pixman_transform_t transform;
42-			pixman_transform_init_identity(&transform);
43-			pixman_fixed_t scale = pixman_double_to_fixed(1.0 / zoom);
44-			pixman_transform_scale(&transform, NULL, scale, scale);
45-			pixman_image_set_transform(src_img, &transform);
46-			pixman_image_set_filter(src_img, PIXMAN_FILTER_BILINEAR, NULL, 0);
47+			if (!view->always_top) {
48+				pixman_transform_t transform;
49+				pixman_transform_init_identity(&transform);
50+				pixman_fixed_t scale = pixman_double_to_fixed(1.0 / zoom);
51+				pixman_transform_scale(&transform, NULL, scale, scale);
52+				pixman_image_set_transform(src_img, &transform);
53+				pixman_image_set_filter(src_img, PIXMAN_FILTER_BILINEAR, NULL,
54+				                        0);
55+			}
56 
57 			pixman_image_composite32(PIXMAN_OP_OVER, src_img, NULL, dst_img, 0,
58 			                         0, 0, 0, (int32_t)zoomed_x,
59@@ -1034,7 +1051,7 @@ raise_window(struct compositor_view *view)
60 		if (!other->visible) {
61 			continue;
62 		}
63-		
64+
65 		if (other->always_top) {
66 			insert_after = &other->link;
67 			continue;
68@@ -1294,7 +1311,7 @@ compositor_view_show(struct compositor_view *view)
69 
70 	view->visible = true;
71 	view_update_screens(&view->base);
72-	
73+
74 	if (view->window) {
75 		raise_window(view);
76 	}
+5, -3
 1@@ -64,7 +64,7 @@ struct compositor_view {
 2 
 3 	/* Whether or not the view is visible (mapped). */
 4 	bool visible;
 5-	
 6+
 7 	/* Whether or not to make it always be on top of other windows */
 8 	bool always_top;
 9 
10@@ -137,7 +137,9 @@ compositor_get_buffer(struct screen *screen);
11 struct wld_buffer *
12 compositor_render_to_shm(struct screen *screen);
13 
14-void raise_window(struct compositor_view *view);
15-void raise_window_top(struct compositor_view *view);
16+void
17+raise_window(struct compositor_view *view);
18+void
19+raise_window_top(struct compositor_view *view);
20 
21 #endif
+2, -2
 1@@ -143,7 +143,7 @@ set_offset(struct wl_client *client, struct wl_resource *resource,
 2 
 3 static void
 4 set_y_offset(struct wl_client *client, struct wl_resource *resource,
 5-           uint32_t offset)
 6+             uint32_t offset)
 7 {
 8 	struct panel *panel = wl_resource_get_user_data(resource);
 9 
10@@ -168,7 +168,7 @@ set_strut(struct wl_client *client, struct wl_resource *resource, uint32_t size,
11 static const struct swc_panel_interface panel_impl = {
12     .dock = dock,
13     .set_offset = set_offset,
14-		.set_y_offset = set_y_offset,
15+    .set_y_offset = set_y_offset,
16     .set_strut = set_strut,
17 };
18 
+0, -1
1@@ -311,7 +311,6 @@ initialize_wscons(struct seat *seat)
2 	kbd_t encoding;
3 	unsigned i;
4 
5-
6 	if ((seat->mouse_fd =
7 	         launch_open_device("/dev/wsmouse", O_RDWR | O_NONBLOCK)) == -1) {
8 		ERROR("Could not open mouse device\n");