2021-09-24 21:45:48 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2021-03-02 20:37:23 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2020 the sway authors
|
2021-03-03 20:51:19 +00:00
|
|
|
*
|
|
|
|
|
* This file is only needed in support of
|
2021-08-25 20:45:39 +01:00
|
|
|
* - unconstraining XDG popups
|
2021-03-02 20:37:23 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "labwc.h"
|
|
|
|
|
|
2022-02-11 23:12:45 +00:00
|
|
|
/* TODO: surely this ought to just move to xdg.c now??? */
|
2021-03-02 20:37:23 +00:00
|
|
|
static void
|
2022-02-11 23:12:45 +00:00
|
|
|
popup_unconstrain(struct view *view, struct wlr_xdg_popup *popup)
|
2021-03-02 20:37:23 +00:00
|
|
|
{
|
2021-03-02 20:51:32 +00:00
|
|
|
struct server *server = view->server;
|
2022-02-11 23:12:45 +00:00
|
|
|
struct wlr_box *popup_box = &popup->geometry;
|
2021-03-02 20:51:32 +00:00
|
|
|
struct wlr_output_layout *output_layout = server->output_layout;
|
|
|
|
|
struct wlr_output *wlr_output = wlr_output_layout_output_at(
|
|
|
|
|
output_layout, view->x + popup_box->x, view->y + popup_box->y);
|
|
|
|
|
struct wlr_box *output_box = wlr_output_layout_get_box(
|
|
|
|
|
output_layout, wlr_output);
|
|
|
|
|
|
|
|
|
|
struct wlr_box output_toplevel_box = {
|
|
|
|
|
.x = output_box->x - view->x,
|
|
|
|
|
.y = output_box->y - view->y,
|
|
|
|
|
.width = output_box->width,
|
|
|
|
|
.height = output_box->height,
|
|
|
|
|
};
|
2022-02-11 23:12:45 +00:00
|
|
|
wlr_xdg_popup_unconstrain_from_box(popup, &output_toplevel_box);
|
2021-03-02 20:51:32 +00:00
|
|
|
}
|
|
|
|
|
|
2021-03-02 20:37:23 +00:00
|
|
|
void
|
|
|
|
|
xdg_popup_create(struct view *view, struct wlr_xdg_popup *wlr_popup)
|
|
|
|
|
{
|
2022-02-11 23:12:45 +00:00
|
|
|
popup_unconstrain(view, wlr_popup);
|
2021-03-02 20:37:23 +00:00
|
|
|
}
|