mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-16 06:59:44 -05:00
bug: fix view centering
This commit is contained in:
parent
11c1b811db
commit
19784360f1
8 changed files with 62 additions and 44 deletions
|
|
@ -343,3 +343,20 @@ void wlr_output_layout_add_auto(struct wlr_output_layout *layout,
|
|||
l_output->state->auto_configured = true;
|
||||
wlr_output_layout_reconfigure(layout);
|
||||
}
|
||||
|
||||
struct wlr_output *wlr_output_layout_get_center_output(
|
||||
struct wlr_output_layout *layout) {
|
||||
if (wl_list_empty(&layout->outputs)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct wlr_box *extents = wlr_output_layout_get_box(layout, NULL);
|
||||
double center_x = extents->width / 2 + extents->x;
|
||||
double center_y = extents->height / 2 + extents->y;
|
||||
|
||||
double dest_x = 0, dest_y = 0;
|
||||
wlr_output_layout_closest_point(layout, NULL, center_x, center_y,
|
||||
&dest_x, &dest_y);
|
||||
|
||||
return wlr_output_layout_output_at(layout, dest_x, dest_y);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -802,10 +802,7 @@ static void xdg_surface_ack_configure(struct wl_client *client,
|
|||
break;
|
||||
}
|
||||
|
||||
if (!surface->configured) {
|
||||
surface->configured = true;
|
||||
wl_signal_emit(&surface->client->shell->events.new_surface, surface);
|
||||
}
|
||||
surface->configured = true;
|
||||
|
||||
wl_signal_emit(&surface->events.ack_configure, surface);
|
||||
|
||||
|
|
@ -1055,6 +1052,11 @@ static void handle_wlr_surface_committed(struct wl_listener *listener,
|
|||
break;
|
||||
}
|
||||
|
||||
if (surface->configured && !surface->added) {
|
||||
surface->added = true;
|
||||
wl_signal_emit(&surface->client->shell->events.new_surface, surface);
|
||||
}
|
||||
|
||||
wl_signal_emit(&surface->events.commit, surface);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue