positioner rootston cleanup and bugfix

This commit is contained in:
Tony Crisci 2018-03-28 12:46:41 -04:00
parent e2c4e1ef54
commit c5cd805098

View file

@ -97,19 +97,16 @@ static void popup_constraint_offset(struct roots_xdg_popup_v6 *popup,
*offset_x = *offset_y = 0; *offset_x = *offset_y = 0;
double popup_ox = popup_lx - output_box->x;
double popup_oy = popup_ly - output_box->y;
if (popup_lx < output_box->x) { if (popup_lx < output_box->x) {
*offset_x = output_box->x - popup_lx; *offset_x = output_box->x - popup_lx;
} else if (popup_lx + popup_width > output_box->x + output_box->width) { } else if (popup_lx + popup_width > output_box->x + output_box->width) {
*offset_x = popup_width - (output_box->width - popup_ox); *offset_x = output_box->x + output_box->width - (popup_lx + popup_width);
} }
if (popup_ly < output_box->y) { if (popup_ly < output_box->y) {
*offset_y = output_box->y - popup_ly; *offset_y = output_box->y - popup_ly;
} else if (popup_ly + popup_height > output_box->y + output_box->height) { } else if (popup_ly + popup_height > output_box->y + output_box->height) {
*offset_y = popup_height - (output_box->height - popup_oy); *offset_y = output_box->y + output_box->height - (popup_ly + popup_height);
} }
} }
@ -163,6 +160,7 @@ static bool popup_unconstrain_slide(struct roots_xdg_popup_v6 *popup) {
if (offset_x) { if (offset_x) {
popup->wlr_popup->geometry.x += offset_x; popup->wlr_popup->geometry.x += offset_x;
} }
if (offset_y) { if (offset_y) {
popup->wlr_popup->geometry.y += offset_y; popup->wlr_popup->geometry.y += offset_y;
} }