aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-08-02 09:33:10 -0400
committerGitHub <noreply@github.com>2018-08-02 09:33:10 -0400
commit5642c5cc8fd71103cb4805b1b9f1526311d544f8 (patch)
tree4a0be117fe52bc0266b00d4a0b2d211973b7484d /include
parenta3c33e93b80ffd3bd9f9c8dd9af9032ca578b726 (diff)
parent555721f7142e1e363c17820657fb1e2b004e7c54 (diff)
Merge pull request #1053 from emersion/xdg-decoration
Add xdg-decoration-unstable-v1 support
Diffstat (limited to 'include')
-rw-r--r--include/rootston/desktop.h13
-rw-r--r--include/rootston/view.h9
-rw-r--r--include/wlr/types/wlr_xdg_decoration_v1.h68
-rw-r--r--include/wlr/types/wlr_xdg_shell.h18
4 files changed, 100 insertions, 8 deletions
diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h
index 2d28fa10..51cf68db 100644
--- a/include/rootston/desktop.h
+++ b/include/rootston/desktop.h
@@ -5,6 +5,7 @@
#include <wlr/config.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_gamma_control.h>
+#include <wlr/types/wlr_idle_inhibit_v1.h>
#include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_input_inhibitor.h>
#include <wlr/types/wlr_layer_shell.h>
@@ -13,17 +14,14 @@
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_primary_selection.h>
+#include <wlr/types/wlr_screencopy_v1.h>
#include <wlr/types/wlr_screenshooter.h>
#include <wlr/types/wlr_virtual_keyboard_v1.h>
#include <wlr/types/wlr_wl_shell.h>
#include <wlr/types/wlr_xcursor_manager.h>
+#include <wlr/types/wlr_xdg_decoration_v1.h>
#include <wlr/types/wlr_xdg_shell_v6.h>
#include <wlr/types/wlr_xdg_shell.h>
-#include <wlr/types/wlr_list.h>
-#include <wlr/types/wlr_idle.h>
-#include <wlr/types/wlr_idle_inhibit_v1.h>
-#include <wlr/types/wlr_screencopy_v1.h>
-#include "rootston/view.h"
#include "rootston/config.h"
#include "rootston/output.h"
#include "rootston/view.h"
@@ -48,6 +46,7 @@ struct roots_desktop {
struct wlr_screenshooter *screenshooter;
struct wlr_export_dmabuf_manager_v1 *export_dmabuf_manager_v1;
struct wlr_server_decoration_manager *server_decoration_manager;
+ struct wlr_xdg_decoration_manager_v1 *xdg_decoration_manager;
struct wlr_primary_selection_device_manager *primary_selection_device_manager;
struct wlr_idle *idle;
struct wlr_idle_inhibit_manager_v1 *idle_inhibit;
@@ -64,7 +63,7 @@ struct roots_desktop {
struct wl_listener xdg_shell_surface;
struct wl_listener wl_shell_surface;
struct wl_listener layer_shell_surface;
- struct wl_listener decoration_new;
+ struct wl_listener xdg_toplevel_decoration;
struct wl_listener input_inhibit_activate;
struct wl_listener input_inhibit_deactivate;
struct wl_listener virtual_keyboard_new;
@@ -94,6 +93,7 @@ void view_apply_damage(struct roots_view *view);
void view_damage_whole(struct roots_view *view);
void view_update_position(struct roots_view *view, double x, double y);
void view_update_size(struct roots_view *view, uint32_t width, uint32_t height);
+void view_update_decorated(struct roots_view *view, bool decorated);
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);
@@ -101,6 +101,7 @@ 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_xdg_toplevel_decoration(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);
diff --git a/include/rootston/view.h b/include/rootston/view.h
index 4e3859d5..69cbc87c 100644
--- a/include/rootston/view.h
+++ b/include/rootston/view.h
@@ -4,6 +4,7 @@
#include <wlr/config.h>
#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_surface.h>
+#include <wlr/types/wlr_xdg_decoration_v1.h>
#include <wlr/types/wlr_xdg_shell_v6.h>
#include <wlr/types/wlr_xdg_shell.h>
@@ -190,6 +191,14 @@ struct roots_xdg_popup {
struct wl_listener new_popup;
};
+struct roots_xdg_toplevel_decoration {
+ struct wlr_xdg_toplevel_decoration_v1 *wlr_decoration;
+ struct roots_xdg_surface *surface;
+ struct wl_listener destroy;
+ struct wl_listener request_mode;
+ struct wl_listener surface_commit;
+};
+
void view_get_box(const struct roots_view *view, struct wlr_box *box);
void view_activate(struct roots_view *view, bool active);
void view_move(struct roots_view *view, double x, double y);
diff --git a/include/wlr/types/wlr_xdg_decoration_v1.h b/include/wlr/types/wlr_xdg_decoration_v1.h
new file mode 100644
index 00000000..10d3a1aa
--- /dev/null
+++ b/include/wlr/types/wlr_xdg_decoration_v1.h
@@ -0,0 +1,68 @@
+#ifndef WLR_TYPES_WLR_XDG_DECORATION_V1
+#define WLR_TYPES_WLR_XDG_DECORATION_V1
+
+#include <wayland-server.h>
+#include <wlr/types/wlr_xdg_shell.h>
+
+enum wlr_xdg_toplevel_decoration_v1_mode {
+ WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_NONE = 0,
+ WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE = 1,
+ WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE = 2,
+};
+
+struct wlr_xdg_decoration_manager_v1 {
+ struct wl_global *global;
+ struct wl_list resources;
+ struct wl_list decorations; // wlr_xdg_toplevel_decoration::link
+
+ struct wl_listener display_destroy;
+
+ struct {
+ struct wl_signal new_toplevel_decoration; // struct wlr_xdg_toplevel_decoration *
+ } events;
+
+ void *data;
+};
+
+struct wlr_xdg_toplevel_decoration_v1_configure {
+ struct wl_list link; // wlr_xdg_toplevel_decoration::configure_list
+ struct wlr_xdg_surface_configure *surface_configure;
+ enum wlr_xdg_toplevel_decoration_v1_mode mode;
+};
+
+struct wlr_xdg_toplevel_decoration_v1 {
+ struct wl_resource *resource;
+ struct wlr_xdg_surface *surface;
+ struct wlr_xdg_decoration_manager_v1 *manager;
+ struct wl_list link; // wlr_xdg_decoration_manager_v1::link
+
+ bool added;
+ enum wlr_xdg_toplevel_decoration_v1_mode current_mode;
+ enum wlr_xdg_toplevel_decoration_v1_mode client_pending_mode;
+ enum wlr_xdg_toplevel_decoration_v1_mode server_pending_mode;
+
+ struct wl_list configure_list; // wlr_xdg_toplevel_decoration_v1_configure::link
+
+ struct {
+ struct wl_signal destroy;
+ struct wl_signal request_mode;
+ } events;
+
+ struct wl_listener surface_destroy;
+ struct wl_listener surface_configure;
+ struct wl_listener surface_ack_configure;
+ struct wl_listener surface_commit;
+
+ void *data;
+};
+
+struct wlr_xdg_decoration_manager_v1 *
+ wlr_xdg_decoration_manager_v1_create(struct wl_display *display);
+void wlr_xdg_decoration_manager_v1_destroy(
+ struct wlr_xdg_decoration_manager_v1 *manager);
+
+uint32_t wlr_xdg_toplevel_decoration_v1_set_mode(
+ struct wlr_xdg_toplevel_decoration_v1 *decoration,
+ enum wlr_xdg_toplevel_decoration_v1_mode mode);
+
+#endif
diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h
index 98538e7f..a067c62e 100644
--- a/include/wlr/types/wlr_xdg_shell.h
+++ b/include/wlr/types/wlr_xdg_shell.h
@@ -133,6 +133,7 @@ struct wlr_xdg_toplevel {
};
struct wlr_xdg_surface_configure {
+ struct wlr_xdg_surface *surface;
struct wl_list link; // wlr_xdg_surface::configure_list
uint32_t serial;
@@ -196,6 +197,10 @@ struct wlr_xdg_surface {
* surface has been hidden or is about to be destroyed.
*/
struct wl_signal unmap;
+
+ // for protocol extensions
+ struct wl_signal configure; // wlr_xdg_surface_configure
+ struct wl_signal ack_configure; // wlr_xdg_surface_configure
} events;
void *data;
@@ -234,6 +239,8 @@ struct wlr_xdg_surface *wlr_xdg_surface_from_resource(
struct wl_resource *resource);
struct wlr_xdg_surface *wlr_xdg_surface_from_popup_resource(
struct wl_resource *resource);
+struct wlr_xdg_surface *wlr_xdg_surface_from_toplevel_resource(
+ struct wl_resource *resource);
struct wlr_box wlr_xdg_positioner_get_geometry(
struct wlr_xdg_positioner *positioner);
@@ -360,7 +367,8 @@ struct wlr_xdg_surface *wlr_xdg_surface_from_wlr_surface(
*
* The x and y value can be <0
*/
-void wlr_xdg_surface_get_geometry(struct wlr_xdg_surface *surface, struct wlr_box *box);
+void wlr_xdg_surface_get_geometry(struct wlr_xdg_surface *surface,
+ struct wlr_box *box);
/**
* Call `iterator` on each surface and popup in the xdg-surface tree, with the
@@ -368,7 +376,13 @@ void wlr_xdg_surface_get_geometry(struct wlr_xdg_surface *surface, struct wlr_bo
* from root to leaves (in rendering order).
*/
void wlr_xdg_surface_for_each_surface(struct wlr_xdg_surface *surface,
- wlr_surface_iterator_func_t iterator, void *user_data);
+ wlr_surface_iterator_func_t iterator, void *user_data);
+
+/**
+ * Schedule a surface configuration. This should only be called by protocols
+ * extending the shell.
+ */
+uint32_t wlr_xdg_surface_schedule_configure(struct wlr_xdg_surface *surface);
/**
* Call `iterator` on each popup in the xdg-surface tree, with the popup's