diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/rootston/desktop.h | 2 | ||||
-rw-r--r-- | include/rootston/view.h | 19 | ||||
-rw-r--r-- | include/wlr/types/meson.build | 1 | ||||
-rw-r--r-- | include/wlr/types/wlr_foreign_toplevel_management_v1.h | 120 |
4 files changed, 142 insertions, 0 deletions
diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h index cd85e794..b1fcaca0 100644 --- a/include/rootston/desktop.h +++ b/include/rootston/desktop.h @@ -4,6 +4,7 @@ #include <wayland-server.h> #include <wlr/config.h> #include <wlr/types/wlr_compositor.h> +#include <wlr/types/wlr_foreign_toplevel_management_v1.h> #include <wlr/types/wlr_gamma_control_v1.h> #include <wlr/types/wlr_gamma_control.h> #include <wlr/types/wlr_idle_inhibit_v1.h> @@ -63,6 +64,7 @@ struct roots_desktop { struct wlr_tablet_manager_v2 *tablet_v2; struct wlr_pointer_constraints_v1 *pointer_constraints; struct wlr_presentation *presentation; + struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager_v1; struct wl_listener new_output; struct wl_listener layout_change; diff --git a/include/rootston/view.h b/include/rootston/view.h index e67aaf36..b1feb5ce 100644 --- a/include/rootston/view.h +++ b/include/rootston/view.h @@ -3,6 +3,7 @@ #include <stdbool.h> #include <wlr/config.h> #include <wlr/types/wlr_box.h> +#include <wlr/types/wlr_foreign_toplevel_management_v1.h> #include <wlr/types/wlr_surface.h> #include <wlr/types/wlr_xdg_decoration_v1.h> #include <wlr/types/wlr_xdg_shell_v6.h> @@ -18,6 +19,8 @@ struct roots_wl_shell_surface { struct wl_listener request_maximize; struct wl_listener request_fullscreen; struct wl_listener set_state; + struct wl_listener set_title; + struct wl_listener set_class; struct wl_listener surface_commit; }; @@ -33,6 +36,8 @@ struct roots_xdg_surface_v6 { struct wl_listener request_resize; struct wl_listener request_maximize; struct wl_listener request_fullscreen; + struct wl_listener set_title; + struct wl_listener set_app_id; struct wl_listener surface_commit; @@ -52,6 +57,9 @@ struct roots_xdg_surface { struct wl_listener request_resize; struct wl_listener request_maximize; struct wl_listener request_fullscreen; + struct wl_listener set_title; + struct wl_listener set_app_id; + struct wl_listener surface_commit; @@ -71,6 +79,8 @@ struct roots_xwayland_surface { struct wl_listener request_fullscreen; struct wl_listener map; struct wl_listener unmap; + struct wl_listener set_title; + struct wl_listener set_class; struct wl_listener surface_commit; }; @@ -132,6 +142,11 @@ struct roots_view { struct wlr_surface *wlr_surface; struct wl_list children; // roots_view_child::link + struct wlr_foreign_toplevel_handle_v1 *toplevel_handle; + struct wl_listener toplevel_handle_request_maximize; + struct wl_listener toplevel_handle_request_activate; + struct wl_listener toplevel_handle_request_close; + struct wl_listener new_subsurface; struct { @@ -218,6 +233,10 @@ bool view_center(struct roots_view *view); void view_setup(struct roots_view *view); void view_teardown(struct roots_view *view); +void view_set_title(struct roots_view *view, const char *title); +void view_set_app_id(struct roots_view *view, const char *app_id); +void view_create_foreign_toplevel_handle(struct roots_view *view); + void view_get_deco_box(const struct roots_view *view, struct wlr_box *box); enum roots_deco_part { diff --git a/include/wlr/types/meson.build b/include/wlr/types/meson.build index 72debcf3..e2ce86e3 100644 --- a/include/wlr/types/meson.build +++ b/include/wlr/types/meson.build @@ -5,6 +5,7 @@ install_headers( 'wlr_cursor.h', 'wlr_data_device.h', 'wlr_export_dmabuf_v1.h', + 'wlr_foreign_toplevel_management_v1.h', 'wlr_gamma_control_v1.h', 'wlr_gamma_control.h', 'wlr_gtk_primary_selection.h', diff --git a/include/wlr/types/wlr_foreign_toplevel_management_v1.h b/include/wlr/types/wlr_foreign_toplevel_management_v1.h new file mode 100644 index 00000000..75ae0e64 --- /dev/null +++ b/include/wlr/types/wlr_foreign_toplevel_management_v1.h @@ -0,0 +1,120 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + +#ifndef WLR_TYPES_WLR_FOREIGN_TOPLEVEL_MANAGEMENT_V1_H +#define WLR_TYPES_WLR_FOREIGN_TOPLEVEL_MANAGEMENT_V1_H + +#include <wayland-server.h> +#include <wlr/types/wlr_output.h> + +struct wlr_foreign_toplevel_manager_v1 { + struct wl_event_loop *event_loop; + struct wl_global *global; + struct wl_list resources; + struct wl_list toplevels; // wlr_foreign_toplevel_handle_v1::link + + struct wl_listener display_destroy; + + struct { + struct wl_signal destroy; + } events; + + void *data; +}; + +enum wlr_foreign_toplevel_handle_v1_state { + WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MAXIMIZED = 1, + WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MINIMIZED = 2, + WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_ACTIVATED = 4, +}; + +struct wlr_foreign_toplevel_handle_v1_output { + struct wl_list link; // wlr_foreign_toplevel_handle_v1::outputs + struct wl_listener output_destroy; + struct wlr_output *output; + + struct wlr_foreign_toplevel_handle_v1 *toplevel; +}; + +struct wlr_foreign_toplevel_handle_v1 { + struct wlr_foreign_toplevel_manager_v1 *manager; + struct wl_list resources; + struct wl_list link; + struct wl_event_source *idle_source; + + char *title; + char *app_id; + struct wl_list outputs; // wlr_foreign_toplevel_v1_output + uint32_t state; // wlr_foreign_toplevel_v1_state + + struct { + // wlr_foreign_toplevel_handle_v1_maximized_event + struct wl_signal request_maximize; + //wlr_foreign_toplevel_handle_v1_minimized_event + struct wl_signal request_minimize; + //wlr_foreign_toplevel_handle_v1_activated_event + struct wl_signal request_activate; + struct wl_signal request_close; + + //wlr_foreign_toplevel_handle_v1_set_rectangle_event + struct wl_signal set_rectangle; + struct wl_signal destroy; + } events; + + void *data; +}; + +struct wlr_foreign_toplevel_handle_v1_maximized_event { + struct wlr_foreign_toplevel_handle_v1 *toplevel; + bool maximized; +}; + +struct wlr_foreign_toplevel_handle_v1_minimized_event { + struct wlr_foreign_toplevel_handle_v1 *toplevel; + bool minimized; +}; + +struct wlr_foreign_toplevel_handle_v1_activated_event { + struct wlr_foreign_toplevel_handle_v1 *toplevel; + struct wlr_seat *seat; +}; + +struct wlr_foreign_toplevel_handle_v1_set_rectangle_event { + struct wlr_foreign_toplevel_handle_v1 *toplevel; + struct wlr_surface *surface; + int32_t x, y, width, height; +}; + +struct wlr_foreign_toplevel_manager_v1 *wlr_foreign_toplevel_manager_v1_create( + struct wl_display *display); +void wlr_foreign_toplevel_manager_v1_destroy( + struct wlr_foreign_toplevel_manager_v1 *manager); + +struct wlr_foreign_toplevel_handle_v1 *wlr_foreign_toplevel_handle_v1_create( + struct wlr_foreign_toplevel_manager_v1 *manager); +void wlr_foreign_toplevel_handle_v1_destroy( + struct wlr_foreign_toplevel_handle_v1 *toplevel); + +void wlr_foreign_toplevel_handle_v1_set_title( + struct wlr_foreign_toplevel_handle_v1 *toplevel, const char *title); +void wlr_foreign_toplevel_handle_v1_set_app_id( + struct wlr_foreign_toplevel_handle_v1 *toplevel, const char *app_id); + +void wlr_foreign_toplevel_handle_v1_output_enter( + struct wlr_foreign_toplevel_handle_v1 *toplevel, struct wlr_output *output); +void wlr_foreign_toplevel_handle_v1_output_leave( + struct wlr_foreign_toplevel_handle_v1 *toplevel, struct wlr_output *output); + +void wlr_foreign_toplevel_handle_v1_set_maximized( + struct wlr_foreign_toplevel_handle_v1 *toplevel, bool maximized); +void wlr_foreign_toplevel_handle_v1_set_minimized( + struct wlr_foreign_toplevel_handle_v1 *toplevel, bool minimized); +void wlr_foreign_toplevel_handle_v1_set_activated( + struct wlr_foreign_toplevel_handle_v1 *toplevel, bool activated); + +#endif |