mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-21 22:52:20 +00:00
layer-shell: introduce wlr_layer_surface_v1_get_exclusive_edge()
This commit is contained in:
parent
270e6f4ebb
commit
a0450d219f
@ -13,6 +13,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/types/wlr_compositor.h>
|
#include <wlr/types/wlr_compositor.h>
|
||||||
|
#include <wlr/util/edges.h>
|
||||||
#include "wlr-layer-shell-unstable-v1-protocol.h"
|
#include "wlr-layer-shell-unstable-v1-protocol.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -187,4 +188,11 @@ struct wlr_surface *wlr_layer_surface_v1_popup_surface_at(
|
|||||||
struct wlr_layer_surface_v1 *wlr_layer_surface_v1_from_resource(
|
struct wlr_layer_surface_v1 *wlr_layer_surface_v1_from_resource(
|
||||||
struct wl_resource *resource);
|
struct wl_resource *resource);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the edge the exclusive zone must be applied to.
|
||||||
|
*
|
||||||
|
* Returns WLR_EDGE_NONE if the exclusive zone is nonpositive or must not be applied.
|
||||||
|
*/
|
||||||
|
enum wlr_edges wlr_layer_surface_v1_get_exclusive_edge(struct wlr_layer_surface_v1 *surface);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -654,3 +654,33 @@ struct wlr_surface *wlr_layer_surface_v1_popup_surface_at(
|
|||||||
|
|
||||||
return NULL;
|
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…
Reference in New Issue
Block a user