mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-18 06:59:44 -05:00
wl-shell: cleanup
This commit is contained in:
parent
1b2742d0b2
commit
f7e7f6271d
4 changed files with 98 additions and 106 deletions
|
|
@ -103,11 +103,11 @@ static void render_wl_shell_surface(struct wlr_wl_shell_surface *surface, struct
|
|||
if (is_child || surface->state != WLR_WL_SHELL_SURFACE_STATE_POPUP) {
|
||||
render_surface(surface->surface, desktop, wlr_output, when,
|
||||
lx, ly, rotation);
|
||||
struct wlr_wl_shell_surface *child;
|
||||
wl_list_for_each(child, &surface->children, child_link) {
|
||||
render_wl_shell_surface(child, desktop, wlr_output, when,
|
||||
lx + child->transient_state->x,
|
||||
ly + child->transient_state->y,
|
||||
struct wlr_wl_shell_surface *popup;
|
||||
wl_list_for_each(popup, &surface->popups, popup_link) {
|
||||
render_wl_shell_surface(popup, desktop, wlr_output, when,
|
||||
lx + popup->transient_state->x,
|
||||
ly + popup->transient_state->y,
|
||||
rotation, true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,40 +138,3 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
|
|||
roots_surface->view = view;
|
||||
list_add(desktop->views, view);
|
||||
}
|
||||
|
||||
struct wlr_wl_shell_surface *wlr_wl_shell_surface_popup_at(
|
||||
struct wlr_wl_shell_surface *surface, double sx, double sy,
|
||||
double *popup_sx, double *popup_sy) {
|
||||
struct wlr_wl_shell_surface *popup;
|
||||
wl_list_for_each(popup, &surface->children, child_link) {
|
||||
double _popup_sx = popup->transient_state->x;
|
||||
double _popup_sy = popup->transient_state->y;
|
||||
int popup_width =
|
||||
popup->surface->current->buffer_width;
|
||||
int popup_height =
|
||||
popup->surface->current->buffer_height;
|
||||
|
||||
struct wlr_wl_shell_surface *_popup =
|
||||
wlr_wl_shell_surface_popup_at(popup,
|
||||
popup->transient_state->x,
|
||||
popup->transient_state->y,
|
||||
popup_sx, popup_sy);
|
||||
if (_popup) {
|
||||
*popup_sx = sx + _popup_sx;
|
||||
*popup_sy = sy + _popup_sy;
|
||||
return _popup;
|
||||
}
|
||||
|
||||
if ((sx > _popup_sx && sx < _popup_sx + popup_width) &&
|
||||
(sy > _popup_sy && sy < _popup_sy + popup_height)) {
|
||||
if (pixman_region32_contains_point(&popup->surface->current->input,
|
||||
sx - _popup_sx, sy - _popup_sy, NULL)) {
|
||||
*popup_sx = _popup_sx;
|
||||
*popup_sy = _popup_sy;
|
||||
return popup;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue