Use wlr_output_layout_output_at to get output for move to cursor

master
Thayne McCombs 5 years ago committed by Simon Ser
parent cfa403fc58
commit b20d52f71d

@ -766,19 +766,18 @@ static struct cmd_results *cmd_move_to_position_pointer(
double ly = cursor->y - container->height / 2; double ly = cursor->y - container->height / 2;
/* Correct target coordinates to be in bounds (on screen). */ /* Correct target coordinates to be in bounds (on screen). */
for (int i = 0; i < root->outputs->length; ++i) { struct wlr_output *output = wlr_output_layout_output_at(
struct wlr_box box; root->output_layout, cursor->x, cursor->y);
output_get_box(root->outputs->items[i], &box); if (output) {
if (wlr_box_contains_point(&box, cursor->x, cursor->y)) { struct wlr_box *box =
lx = fmax(lx, box.x); wlr_output_layout_get_box(root->output_layout, output);
ly = fmax(ly, box.y); lx = fmax(lx, box->x);
if (lx + container->width > box.x + box.width) { ly = fmax(ly, box->y);
lx = box.x + box.width - container->width; if (lx + container->width > box->x + box->width) {
} lx = box->x + box->width - container->width;
if (ly + container->height > box.y + box.height) { }
ly = box.y + box.height - container->height; if (ly + container->height > box->y + box->height) {
} ly = box->y + box->height - container->height;
break;
} }
} }

Loading…
Cancel
Save