wlroots-hyprland/include/wlr/types/wlr_layer_shell.h

108 lines
3.0 KiB
C
Raw Normal View History

2018-03-17 20:07:48 +01:00
#ifndef WLR_TYPES_WLR_LAYER_SHELL_H
#define WLR_TYPES_WLR_LAYER_SHELL_H
#include <stdbool.h>
#include <stdint.h>
#include <wayland-server.h>
#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_surface.h>
#include "wlr-layer-shell-unstable-v1-protocol.h"
2018-03-17 20:07:48 +01:00
2018-03-18 02:06:54 +01:00
/**
* wlr_layer_shell allows clients to arrange themselves in "layers" on the
* desktop in accordance with the wlr-layer-shell protocol. When a client is
* added, the new_surface signal will be raised and passed a reference to our
* wlr_layer_surface. At this time, the client will have configured the surface
* as it desires, including information like desired anchors and margins. The
* compositor should use this information to decide how to arrange the layer
* on-screen, then determine the dimensions of the layer and call
* wlr_layer_surface_configure. The client will then attach a buffer and commit
* the surface, at which point the wlr_layer_surface map signal is raised and
* the compositor should begin rendering the surface.
*/
2018-03-17 20:07:48 +01:00
struct wlr_layer_shell {
struct wl_global *wl_global;
struct wl_list clients;
struct wl_listener display_destroy;
struct {
struct wl_signal new_surface;
} events;
void *data;
};
struct wlr_layer_client {
struct wlr_layer_shell *shell;
struct wl_resource *resource;
struct wl_client *client;
struct wl_list surfaces;
struct wl_list link; // wlr_layer_shell::clients
};
struct wlr_layer_surface_state {
uint32_t anchor;
uint32_t exclusive_zone;
struct {
uint32_t top, right, bottom, left;
} margin;
2018-03-18 18:58:01 +01:00
bool keyboard_interactive;
2018-03-18 02:06:54 +01:00
uint32_t width, height;
};
struct wlr_layer_surface_configure {
struct wl_list link; // wlr_layer_surface::configure_list
uint32_t serial;
2018-03-18 00:11:14 +01:00
struct wlr_layer_surface_state state;
};
struct wlr_layer_surface {
struct wlr_surface *surface;
2018-03-20 04:11:37 +01:00
struct wlr_output *output;
struct wlr_layer_client *client;
struct wl_resource *resource;
struct wl_list link; // wlr_layer_client:surfaces
const char *namespace;
enum zwlr_layer_shell_v1_layer layer;
2018-03-24 23:00:01 +01:00
bool added, configured, mapped, closed;
uint32_t configure_serial;
struct wl_event_source *configure_idle;
uint32_t configure_next_serial;
struct wl_list configure_list;
2018-03-18 18:58:01 +01:00
struct wlr_layer_surface_state client_pending;
struct wlr_layer_surface_state server_pending;
struct wlr_layer_surface_state current;
struct wl_listener surface_destroy_listener;
struct {
struct wl_signal destroy;
struct wl_signal map;
struct wl_signal unmap;
} events;
void *data;
};
2018-03-17 20:07:48 +01:00
struct wlr_layer_shell *wlr_layer_shell_create(struct wl_display *display);
void wlr_layer_shell_destroy(struct wlr_layer_shell *layer_shell);
2018-03-18 02:06:54 +01:00
/**
* Notifies the layer surface to configure itself with this width/height. The
* layer_surface will signal its map event when the surface is ready to assume
* this size.
*/
void wlr_layer_surface_configure(struct wlr_layer_surface *surface,
uint32_t width, uint32_t height);
2018-03-24 23:00:01 +01:00
/**
* Unmaps this layer surface and notifies the client that it has been closed.
*/
void wlr_layer_surface_close(struct wlr_layer_surface *surface);
2018-03-17 20:07:48 +01:00
#endif