diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/rootston/desktop.h | 5 | ||||
-rw-r--r-- | include/rootston/layers.h | 25 | ||||
-rw-r--r-- | include/rootston/output.h | 8 | ||||
-rw-r--r-- | include/rootston/view.h | 1 | ||||
-rw-r--r-- | include/wlr/render/egl.h | 1 | ||||
-rw-r--r-- | include/wlr/types/wlr_layer_shell.h | 100 | ||||
-rw-r--r-- | include/wlr/types/wlr_xdg_shell.h | 4 | ||||
-rw-r--r-- | include/wlr/types/wlr_xdg_shell_v6.h | 4 |
8 files changed, 143 insertions, 5 deletions
diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h index 5986c96f..5714aa0a 100644 --- a/include/rootston/desktop.h +++ b/include/rootston/desktop.h @@ -7,6 +7,7 @@ #include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_gamma_control.h> #include <wlr/types/wlr_idle.h> +#include <wlr/types/wlr_layer_shell.h> #include <wlr/types/wlr_linux_dmabuf.h> #include <wlr/types/wlr_list.h> #include <wlr/types/wlr_output_layout.h> @@ -48,12 +49,14 @@ struct roots_desktop { struct wlr_idle *idle; struct wlr_idle_inhibit_manager_v1 *idle_inhibit; struct wlr_linux_dmabuf *linux_dmabuf; + struct wlr_layer_shell *layer_shell; struct wl_listener new_output; struct wl_listener layout_change; struct wl_listener xdg_shell_v6_surface; struct wl_listener xdg_shell_surface; struct wl_listener wl_shell_surface; + struct wl_listener layer_shell_surface; struct wl_listener decoration_new; #ifdef WLR_HAS_XWAYLAND @@ -83,10 +86,12 @@ void view_update_size(struct roots_view *view, uint32_t width, uint32_t height); void view_initial_focus(struct roots_view *view); void view_map(struct roots_view *view, struct wlr_surface *surface); void view_unmap(struct roots_view *view); +void view_arrange_maximized(struct roots_view *view); void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data); void handle_xdg_shell_surface(struct wl_listener *listener, void *data); void handle_wl_shell_surface(struct wl_listener *listener, void *data); +void handle_layer_shell_surface(struct wl_listener *listener, void *data); void handle_xwayland_surface(struct wl_listener *listener, void *data); #endif diff --git a/include/rootston/layers.h b/include/rootston/layers.h new file mode 100644 index 00000000..35f5399e --- /dev/null +++ b/include/rootston/layers.h @@ -0,0 +1,25 @@ +#ifndef ROOTSTON_LAYERS_H +#define ROOTSTON_LAYERS_H +#include <stdbool.h> +#include <wlr/config.h> +#include <wlr/types/wlr_box.h> +#include <wlr/types/wlr_surface.h> +#include <wlr/types/wlr_layer_shell.h> + +struct roots_layer_surface { + struct wlr_layer_surface *layer_surface; + struct wl_list link; + + struct wl_listener destroy; + struct wl_listener map; + struct wl_listener unmap; + struct wl_listener surface_commit; + struct wl_listener output_destroy; + struct wl_listener output_mode; + struct wl_listener output_transform; + + bool configured; + struct wlr_box geo; +}; + +#endif diff --git a/include/rootston/output.h b/include/rootston/output.h index a852a204..e40ad776 100644 --- a/include/rootston/output.h +++ b/include/rootston/output.h @@ -4,6 +4,7 @@ #include <pixman.h> #include <time.h> #include <wayland-server.h> +#include <wlr/types/wlr_box.h> #include <wlr/types/wlr_output_damage.h> struct roots_desktop; @@ -14,10 +15,13 @@ struct roots_output { struct wl_list link; // roots_desktop:outputs struct roots_view *fullscreen_view; + struct wl_list layers[4]; // layer_surface::link struct timespec last_frame; struct wlr_output_damage *damage; + struct wlr_box usable_area; + struct wl_listener destroy; struct wl_listener damage_frame; struct wl_listener damage_destroy; @@ -35,5 +39,9 @@ void output_damage_from_view(struct roots_output *output, struct roots_view *view); void output_damage_whole_drag_icon(struct roots_output *output, struct roots_drag_icon *icon); +void output_damage_from_local_surface(struct roots_output *output, + struct wlr_surface *surface, double ox, double oy, float rotation); +void output_damage_whole_local_surface(struct roots_output *output, + struct wlr_surface *surface, double ox, double oy, float rotation); #endif diff --git a/include/rootston/view.h b/include/rootston/view.h index 1397a8d2..6e746e8c 100644 --- a/include/rootston/view.h +++ b/include/rootston/view.h @@ -1,6 +1,5 @@ #ifndef ROOTSTON_VIEW_H #define ROOTSTON_VIEW_H - #include <stdbool.h> #include <wlr/config.h> #include <wlr/types/wlr_box.h> diff --git a/include/wlr/render/egl.h b/include/wlr/render/egl.h index 9f4c0334..b5f2d67c 100644 --- a/include/wlr/render/egl.h +++ b/include/wlr/render/egl.h @@ -20,6 +20,7 @@ struct wlr_egl { bool swap_buffers_with_damage; bool dmabuf_import; bool dmabuf_import_modifiers; + bool bind_wayland_display; } egl_exts; struct wl_display *wl_display; diff --git a/include/wlr/types/wlr_layer_shell.h b/include/wlr/types/wlr_layer_shell.h new file mode 100644 index 00000000..8cc7782f --- /dev/null +++ b/include/wlr/types/wlr_layer_shell.h @@ -0,0 +1,100 @@ +#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" + +/** + * 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. + */ +struct wlr_layer_shell { + struct wl_global *wl_global; + struct wl_list client_resources; // wl_resource + + struct wl_listener display_destroy; + + struct { + struct wl_signal new_surface; + } events; + + void *data; +}; + +struct wlr_layer_surface_state { + uint32_t anchor; + int32_t exclusive_zone; + struct { + uint32_t top, right, bottom, left; + } margin; + bool keyboard_interactive; + uint32_t desired_width, desired_height; + uint32_t actual_width, actual_height; +}; + +struct wlr_layer_surface_configure { + struct wl_list link; // wlr_layer_surface::configure_list + uint32_t serial; + struct wlr_layer_surface_state state; +}; + +struct wlr_layer_surface { + struct wlr_surface *surface; + struct wlr_output *output; + struct wl_resource *resource; + struct wlr_layer_shell *shell; + + const char *namespace; + enum zwlr_layer_shell_v1_layer layer; + + 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; + + struct wlr_layer_surface_configure *acked_configure; + + 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; +}; + +struct wlr_layer_shell *wlr_layer_shell_create(struct wl_display *display); +void wlr_layer_shell_destroy(struct wlr_layer_shell *layer_shell); + +/** + * 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); + +/** + * Unmaps this layer surface and notifies the client that it has been closed. + */ +void wlr_layer_surface_close(struct wlr_layer_surface *surface); + +#endif diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h index a5cd3d54..9938f4b1 100644 --- a/include/wlr/types/wlr_xdg_shell.h +++ b/include/wlr/types/wlr_xdg_shell.h @@ -78,8 +78,8 @@ struct wlr_xdg_toplevel { struct wlr_xdg_surface *parent; bool added; - struct wlr_xdg_toplevel_state next; // client protocol requests - struct wlr_xdg_toplevel_state pending; // user configure requests + struct wlr_xdg_toplevel_state client_pending; + struct wlr_xdg_toplevel_state server_pending; struct wlr_xdg_toplevel_state current; char *title; diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h index c6820f01..0867b2f6 100644 --- a/include/wlr/types/wlr_xdg_shell_v6.h +++ b/include/wlr/types/wlr_xdg_shell_v6.h @@ -78,8 +78,8 @@ struct wlr_xdg_toplevel_v6 { struct wlr_xdg_surface_v6 *parent; bool added; - struct wlr_xdg_toplevel_v6_state next; // client protocol requests - struct wlr_xdg_toplevel_v6_state pending; // user configure requests + struct wlr_xdg_toplevel_v6_state client_pending; + struct wlr_xdg_toplevel_v6_state server_pending; struct wlr_xdg_toplevel_v6_state current; char *title; |