mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-01 22:58:38 -04:00
layer-shell: introduce wlr_layer_surface_v1_get_exclusive_edge()
This commit is contained in:
parent
270e6f4ebb
commit
a0450d219f
2 changed files with 38 additions and 0 deletions
|
|
@ -654,3 +654,33 @@ struct wlr_surface *wlr_layer_surface_v1_popup_surface_at(
|
|||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
enum wlr_edges wlr_layer_surface_v1_get_exclusive_edge(struct wlr_layer_surface_v1 *surface) {
|
||||
if (surface->current.exclusive_zone <= 0) {
|
||||
return WLR_EDGE_NONE;
|
||||
}
|
||||
uint32_t anchor = surface->current.anchor;
|
||||
if (surface->current.exclusive_edge != 0) {
|
||||
anchor = surface->current.exclusive_edge;
|
||||
}
|
||||
switch (anchor) {
|
||||
case ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP:
|
||||
case ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT |
|
||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP:
|
||||
return WLR_EDGE_TOP;
|
||||
case ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM:
|
||||
case ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT | ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT |
|
||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM:
|
||||
return WLR_EDGE_BOTTOM;
|
||||
case ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT:
|
||||
case ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM |
|
||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT:
|
||||
return WLR_EDGE_LEFT;
|
||||
case ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT:
|
||||
case ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP | ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM |
|
||||
ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT:
|
||||
return WLR_EDGE_RIGHT;
|
||||
default:
|
||||
return WLR_EDGE_NONE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue