aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2018-03-28 19:00:49 -0400
committerTony Crisci <tony@dubstepdish.com>2018-03-28 19:00:49 -0400
commit8b967fc573b2a4d53c59a4cace75434c4b6c94db (patch)
tree19640baf4c14e03de6bc160a54cf7e34ac1532be
parentbf5ae85683963a03b9291dd7ab184ab97abc0fd4 (diff)
bug: dont slide over too far
-rw-r--r--types/wlr_xdg_shell_v6.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/types/wlr_xdg_shell_v6.c b/types/wlr_xdg_shell_v6.c
index aaacbf29..85ced7bd 100644
--- a/types/wlr_xdg_shell_v6.c
+++ b/types/wlr_xdg_shell_v6.c
@@ -1761,7 +1761,7 @@ static bool wlr_xdg_popup_v6_unconstrain_flip(struct wlr_xdg_popup_v6 *popup,
static bool wlr_xdg_popup_v6_unconstrain_slide(struct wlr_xdg_popup_v6 *popup,
struct wlr_box *toplevel_box) {
- int offset_x, offset_y;
+ int offset_x = 0, offset_y = 0;
wlr_xdg_popup_v6_box_constraints(popup, toplevel_box, &offset_x, &offset_y);
if (!offset_x && !offset_y) {
@@ -1784,6 +1784,17 @@ static bool wlr_xdg_popup_v6_unconstrain_slide(struct wlr_xdg_popup_v6 *popup,
popup->geometry.y += offset_y;
}
+ int toplevel_x = 0, toplevel_y = 0;
+ wlr_xdg_popup_v6_get_toplevel_coords(popup, popup->geometry.x,
+ popup->geometry.y, &toplevel_x, &toplevel_y);
+
+ if (slide_x && toplevel_x < toplevel_box->x) {
+ popup->geometry.x += toplevel_box->x - toplevel_x;
+ }
+ if (slide_y && toplevel_y < toplevel_box->y) {
+ popup->geometry.y += toplevel_box->y - toplevel_y;
+ }
+
wlr_xdg_popup_v6_box_constraints(popup, toplevel_box, &offset_x, &offset_y);
return !offset_x && !offset_y;