[PATCH] desktop-shell: prevent tilebar going under panel

Inzamam inzamam.15 at cse.mrt.ac.lk
Sun Oct 21 10:23:44 UTC 2018


From: inzamam <inzamam.15 at cse.mrt.ac.lk>

---
 desktop-shell/shell.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 9a447159..306ef088 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -1582,6 +1582,23 @@ struct weston_resize_grab {
 	int32_t width, height;
 };
 
+static void
+constraint_resize(int *height,
+				  struct weston_pointer *pointer,
+				  struct shell_surface *shsurf)
+{
+	int pWidth,pHeight;
+	struct weston_surface *surface =
+			weston_desktop_surface_get_surface(shsurf->desktop_surface);
+	get_output_panel_size(shsurf->shell, surface->output, &pWidth, &pHeight);
+
+	wl_fixed_t panel_height_fixed = wl_fixed_from_int(pHeight);
+
+	if (pointer->y < panel_height_fixed){
+		*height = *height-(wl_fixed_to_int(panel_height_fixed-pointer->y));
+	}
+}
+
 static void
 resize_grab_motion(struct weston_pointer_grab *grab,
 		   const struct timespec *time,
@@ -1620,6 +1637,10 @@ resize_grab_motion(struct weston_pointer_grab *grab,
 		height += wl_fixed_to_int(to_y - from_y);
 	}
 
+	if (shsurf->shell->panel_position == WESTON_DESKTOP_SHELL_PANEL_POSITION_TOP &&
+		WL_SHELL_SURFACE_RESIZE_TOP)
+		constraint_resize(&height, pointer, shsurf);
+
 	max_size = weston_desktop_surface_get_max_size(shsurf->desktop_surface);
 	min_size = weston_desktop_surface_get_min_size(shsurf->desktop_surface);
 
-- 
2.17.1



More information about the wayland-devel mailing list