mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-02 09:01:38 -05:00
Merge branch 'master' into cursor-scale
This commit is contained in:
commit
f8b43940b1
9 changed files with 76 additions and 43 deletions
|
|
@ -167,9 +167,22 @@ bool view_center(struct roots_view *view) {
|
|||
view_get_box(view, &box);
|
||||
|
||||
struct roots_desktop *desktop = view->desktop;
|
||||
struct roots_input *input = desktop->server->input;
|
||||
struct roots_seat *seat = NULL, *_seat;
|
||||
wl_list_for_each(_seat, &input->seats, link) {
|
||||
if (!seat || (seat->seat->last_event.tv_sec > _seat->seat->last_event.tv_sec &&
|
||||
seat->seat->last_event.tv_nsec > _seat->seat->last_event.tv_nsec)) {
|
||||
seat = _seat;
|
||||
}
|
||||
}
|
||||
if (!seat) {
|
||||
return false;
|
||||
}
|
||||
|
||||
struct wlr_output *output =
|
||||
wlr_output_layout_get_center_output(desktop->layout);
|
||||
wlr_output_layout_output_at(desktop->layout,
|
||||
seat->cursor->cursor->x,
|
||||
seat->cursor->cursor->y);
|
||||
if (!output) {
|
||||
// empty layout
|
||||
return false;
|
||||
|
|
@ -218,7 +231,7 @@ void view_teardown(struct roots_view *view) {
|
|||
|
||||
struct roots_view *view_at(struct roots_desktop *desktop, double lx, double ly,
|
||||
struct wlr_surface **surface, double *sx, double *sy) {
|
||||
for (int i = desktop->views->length - 1; i >= 0; --i) {
|
||||
for (ssize_t i = desktop->views->length - 1; i >= 0; --i) {
|
||||
struct roots_view *view = desktop->views->items[i];
|
||||
|
||||
if (view->type == ROOTS_WL_SHELL_VIEW &&
|
||||
|
|
@ -230,11 +243,12 @@ struct roots_view *view_at(struct roots_desktop *desktop, double lx, double ly,
|
|||
double view_sx = lx - view->x;
|
||||
double view_sy = ly - view->y;
|
||||
|
||||
struct wlr_surface_state *state = view->wlr_surface->current;
|
||||
struct wlr_box box = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = view->wlr_surface->current->buffer_width,
|
||||
.height = view->wlr_surface->current->buffer_height,
|
||||
.width = state->buffer_width / state->scale,
|
||||
.height = state->buffer_height / state->scale,
|
||||
};
|
||||
if (view->rotation != 0.0) {
|
||||
// Coordinates relative to the center of the view
|
||||
|
|
@ -248,7 +262,6 @@ struct roots_view *view_at(struct roots_desktop *desktop, double lx, double ly,
|
|||
}
|
||||
|
||||
if (view->type == ROOTS_XDG_SHELL_V6_VIEW) {
|
||||
// TODO: test if this works with rotated views
|
||||
double popup_sx, popup_sy;
|
||||
struct wlr_xdg_surface_v6 *popup =
|
||||
wlr_xdg_surface_v6_popup_at(view->xdg_surface_v6,
|
||||
|
|
@ -263,7 +276,6 @@ struct roots_view *view_at(struct roots_desktop *desktop, double lx, double ly,
|
|||
}
|
||||
|
||||
if (view->type == ROOTS_WL_SHELL_VIEW) {
|
||||
// TODO: test if this works with rotated views
|
||||
double popup_sx, popup_sy;
|
||||
struct wlr_wl_shell_surface *popup =
|
||||
wlr_wl_shell_surface_popup_at(view->wl_shell_surface,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue