diff options
Diffstat (limited to 'include')
83 files changed, 963 insertions, 49 deletions
diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h index 416507ea..fe279917 100644 --- a/include/backend/drm/drm.h +++ b/include/backend/drm/drm.h @@ -119,6 +119,7 @@ struct wlr_drm_connector { struct wlr_output output; enum wlr_drm_connector_state state; + struct wlr_output_mode *desired_mode; uint32_t id; struct wlr_drm_crtc *crtc; @@ -143,9 +144,5 @@ void restore_drm_outputs(struct wlr_drm_backend *drm); void scan_drm_connectors(struct wlr_drm_backend *state); int handle_drm_event(int fd, uint32_t mask, void *data); void enable_drm_connector(struct wlr_output *output, bool enable); -/** - * Add mode to the list of available modes - */ -bool wlr_drm_connector_add_mode(struct wlr_output *output, const drmModeModeInfo *mode); #endif diff --git a/include/render/gles2.h b/include/render/gles2.h index 8b036f80..f649f3e2 100644 --- a/include/render/gles2.h +++ b/include/render/gles2.h @@ -88,7 +88,7 @@ const struct wlr_gles2_pixel_format *get_gles2_format_from_wl( enum wl_shm_format fmt); const enum wl_shm_format *get_gles2_formats(size_t *len); -struct wlr_gles2_texture *get_gles2_texture_in_context( +struct wlr_gles2_texture *gles2_get_texture( struct wlr_texture *wlr_texture); void push_gles2_marker(const char *file, const char *func); diff --git a/include/rootston/cursor.h b/include/rootston/cursor.h index f7410dec..2c687a39 100644 --- a/include/rootston/cursor.h +++ b/include/rootston/cursor.h @@ -80,4 +80,7 @@ void roots_cursor_handle_tool_tip(struct roots_cursor *cursor, void roots_cursor_handle_request_set_cursor(struct roots_cursor *cursor, struct wlr_seat_pointer_request_set_cursor_event *event); +void roots_cursor_update_position(struct roots_cursor *cursor, + uint32_t time); + #endif diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h index d9add26a..3496fb43 100644 --- a/include/rootston/desktop.h +++ b/include/rootston/desktop.h @@ -4,26 +4,24 @@ #include <wayland-server.h> #include <wlr/config.h> #include <wlr/types/wlr_compositor.h> +#include <wlr/types/wlr_gamma_control_v1.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> -#include <wlr/types/wlr_linux_dmabuf.h> #include <wlr/types/wlr_list.h> #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" @@ -45,14 +43,15 @@ struct roots_desktop { struct wlr_xdg_shell_v6 *xdg_shell_v6; struct wlr_xdg_shell *xdg_shell; struct wlr_gamma_control_manager *gamma_control_manager; + struct wlr_gamma_control_manager_v1 *gamma_control_manager_v1; 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; struct wlr_input_inhibit_manager *input_inhibit; - struct wlr_linux_dmabuf *linux_dmabuf; struct wlr_layer_shell *layer_shell; struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard; struct wlr_screencopy_manager_v1 *screencopy; @@ -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/input.h b/include/rootston/input.h index ef46fab2..2cdb13e6 100644 --- a/include/rootston/input.h +++ b/include/rootston/input.h @@ -32,4 +32,6 @@ struct roots_seat *input_get_seat(struct roots_input *input, char *name); struct roots_seat *input_last_active_seat(struct roots_input *input); +void input_update_cursor_focus(struct roots_input *input); + #endif diff --git a/include/rootston/view.h b/include/rootston/view.h index 4e3859d5..14448fc6 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> @@ -38,6 +39,8 @@ struct roots_xdg_surface_v6 { uint32_t pending_move_resize_configure_serial; }; +struct roots_xdg_toplevel_decoration; + struct roots_xdg_surface { struct roots_view *view; @@ -53,6 +56,8 @@ struct roots_xdg_surface { struct wl_listener surface_commit; uint32_t pending_move_resize_configure_serial; + + struct roots_xdg_toplevel_decoration *xdg_toplevel_decoration; }; struct roots_xwayland_surface { @@ -190,6 +195,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/types/wlr_xdg_shell.h b/include/types/wlr_xdg_shell.h index 7a17d286..93fdc670 100644 --- a/include/types/wlr_xdg_shell.h +++ b/include/types/wlr_xdg_shell.h @@ -19,7 +19,8 @@ struct wlr_xdg_surface *create_xdg_surface( uint32_t id); void unmap_xdg_surface(struct wlr_xdg_surface *surface); void destroy_xdg_surface(struct wlr_xdg_surface *surface); -void handle_xdg_surface_committed(struct wlr_surface *wlr_surface); +void handle_xdg_surface_commit(struct wlr_surface *wlr_surface); +void handle_xdg_surface_precommit(struct wlr_surface *wlr_surface); void create_xdg_positioner(struct wlr_xdg_client *client, uint32_t id); struct wlr_xdg_positioner_resource *get_xdg_positioner_from_resource( diff --git a/include/types/wlr_xdg_shell_v6.h b/include/types/wlr_xdg_shell_v6.h index 030c10e4..59fca667 100644 --- a/include/types/wlr_xdg_shell_v6.h +++ b/include/types/wlr_xdg_shell_v6.h @@ -19,7 +19,8 @@ struct wlr_xdg_surface_v6 *create_xdg_surface_v6( uint32_t id); void unmap_xdg_surface_v6(struct wlr_xdg_surface_v6 *surface); void destroy_xdg_surface_v6(struct wlr_xdg_surface_v6 *surface); -void handle_xdg_surface_v6_committed(struct wlr_surface *wlr_surface); +void handle_xdg_surface_v6_commit(struct wlr_surface *wlr_surface); +void handle_xdg_surface_v6_precommit(struct wlr_surface *wlr_surface); void create_xdg_positioner_v6(struct wlr_xdg_client_v6 *client, uint32_t id); struct wlr_xdg_positioner_v6_resource *get_xdg_positioner_v6_from_resource( diff --git a/include/wlr/backend.h b/include/wlr/backend.h index f40f5353..39d072e2 100644 --- a/include/wlr/backend.h +++ b/include/wlr/backend.h @@ -1,3 +1,11 @@ +/* + * 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_BACKEND_H #define WLR_BACKEND_H diff --git a/include/wlr/backend/drm.h b/include/wlr/backend/drm.h index 7f41ca15..5d47647d 100644 --- a/include/wlr/backend/drm.h +++ b/include/wlr/backend/drm.h @@ -1,3 +1,11 @@ +/* + * 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_BACKEND_DRM_H #define WLR_BACKEND_DRM_H @@ -20,6 +28,12 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display, bool wlr_backend_is_drm(struct wlr_backend *backend); bool wlr_output_is_drm(struct wlr_output *output); +/** + * Add mode to the list of available modes + */ +typedef struct _drmModeModeInfo drmModeModeInfo; +bool wlr_drm_connector_add_mode(struct wlr_output *output, const drmModeModeInfo *mode); + struct wlr_session *wlr_drm_backend_get_session(struct wlr_backend *backend); #endif diff --git a/include/wlr/backend/headless.h b/include/wlr/backend/headless.h index 02c7cd11..eab102e2 100644 --- a/include/wlr/backend/headless.h +++ b/include/wlr/backend/headless.h @@ -1,3 +1,11 @@ +/* + * 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_BACKEND_HEADLESS_H #define WLR_BACKEND_HEADLESS_H diff --git a/include/wlr/backend/interface.h b/include/wlr/backend/interface.h index 42b39a16..f3dee69b 100644 --- a/include/wlr/backend/interface.h +++ b/include/wlr/backend/interface.h @@ -1,3 +1,11 @@ +/* + * 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_BACKEND_INTERFACE_H #define WLR_BACKEND_INTERFACE_H diff --git a/include/wlr/backend/libinput.h b/include/wlr/backend/libinput.h index 92d31415..1a2ab294 100644 --- a/include/wlr/backend/libinput.h +++ b/include/wlr/backend/libinput.h @@ -1,3 +1,11 @@ +/* + * 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_BACKEND_LIBINPUT_H #define WLR_BACKEND_LIBINPUT_H diff --git a/include/wlr/backend/meson.build b/include/wlr/backend/meson.build new file mode 100644 index 00000000..e005b854 --- /dev/null +++ b/include/wlr/backend/meson.build @@ -0,0 +1,16 @@ +install_headers( + 'drm.h', + 'headless.h', + 'interface.h', + 'libinput.h', + 'multi.h', + 'session.h', + 'wayland.h', + subdir: 'wlr/backend', +) + +if conf_data.get('WLR_HAS_X11_BACKEND', false) + install_headers('x11.h', subdir: 'wlr/backend') +endif + +subdir('session') diff --git a/include/wlr/backend/multi.h b/include/wlr/backend/multi.h index 1e04dba4..7137b075 100644 --- a/include/wlr/backend/multi.h +++ b/include/wlr/backend/multi.h @@ -1,3 +1,11 @@ +/* + * 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_BACKEND_MULTI_H #define WLR_BACKEND_MULTI_H diff --git a/include/wlr/backend/session.h b/include/wlr/backend/session.h index 1cf41939..7b26f34c 100644 --- a/include/wlr/backend/session.h +++ b/include/wlr/backend/session.h @@ -39,6 +39,10 @@ struct wlr_session { struct wl_list devices; struct wl_listener display_destroy; + + struct { + struct wl_signal destroy; + } events; }; /* diff --git a/include/wlr/backend/session/interface.h b/include/wlr/backend/session/interface.h index b35ed71d..5ccf9c8a 100644 --- a/include/wlr/backend/session/interface.h +++ b/include/wlr/backend/session/interface.h @@ -1,3 +1,11 @@ +/* + * 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_BACKEND_SESSION_INTERFACE_H #define WLR_BACKEND_SESSION_INTERFACE_H diff --git a/include/wlr/backend/session/meson.build b/include/wlr/backend/session/meson.build new file mode 100644 index 00000000..21b5a96b --- /dev/null +++ b/include/wlr/backend/session/meson.build @@ -0,0 +1 @@ +install_headers('interface.h', subdir: 'wlr/backend/session') diff --git a/include/wlr/config.h.in b/include/wlr/config.h.in new file mode 100644 index 00000000..750ad3b7 --- /dev/null +++ b/include/wlr/config.h.in @@ -0,0 +1,19 @@ +#ifndef WLR_CONFIG_H +#define WLR_CONFIG_H + +#mesondefine WLR_HAS_LIBCAP + +#mesondefine WLR_HAS_SYSTEMD +#mesondefine WLR_HAS_ELOGIND + +#mesondefine WLR_HAS_X11_BACKEND + +#mesondefine WLR_HAS_XWAYLAND + +#mesondefine WLR_HAS_XCB_ERRORS +#mesondefine WLR_HAS_XCB_ICCCM +#mesondefine WLR_HAS_XCB_XKB + +#mesondefine WLR_HAS_POSIX_FALLOCATE + +#endif diff --git a/include/wlr/interfaces/meson.build b/include/wlr/interfaces/meson.build new file mode 100644 index 00000000..207896b5 --- /dev/null +++ b/include/wlr/interfaces/meson.build @@ -0,0 +1,10 @@ +install_headers( + 'wlr_input_device.h', + 'wlr_keyboard.h', + 'wlr_output.h', + 'wlr_pointer.h', + 'wlr_tablet_pad.h', + 'wlr_tablet_tool.h', + 'wlr_touch.h', + subdir: 'wlr/interfaces', +) diff --git a/include/wlr/interfaces/wlr_input_device.h b/include/wlr/interfaces/wlr_input_device.h index a5c513b7..05248bf6 100644 --- a/include/wlr/interfaces/wlr_input_device.h +++ b/include/wlr/interfaces/wlr_input_device.h @@ -1,3 +1,11 @@ +/* + * 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_INTERFACES_WLR_INPUT_DEVICE_H #define WLR_INTERFACES_WLR_INPUT_DEVICE_H diff --git a/include/wlr/interfaces/wlr_keyboard.h b/include/wlr/interfaces/wlr_keyboard.h index c9a13fd7..5d537827 100644 --- a/include/wlr/interfaces/wlr_keyboard.h +++ b/include/wlr/interfaces/wlr_keyboard.h @@ -1,3 +1,11 @@ +/* + * 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_INTERFACES_WLR_KEYBOARD_H #define WLR_INTERFACES_WLR_KEYBOARD_H diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index 8f87408a..4860a5b6 100644 --- a/include/wlr/interfaces/wlr_output.h +++ b/include/wlr/interfaces/wlr_output.h @@ -1,3 +1,11 @@ +/* + * 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_INTERFACES_WLR_OUTPUT_H #define WLR_INTERFACES_WLR_OUTPUT_H @@ -20,7 +28,7 @@ struct wlr_output_impl { void (*destroy)(struct wlr_output *output); bool (*make_current)(struct wlr_output *output, int *buffer_age); bool (*swap_buffers)(struct wlr_output *output, pixman_region32_t *damage); - void (*set_gamma)(struct wlr_output *output, + bool (*set_gamma)(struct wlr_output *output, uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b); uint32_t (*get_gamma_size)(struct wlr_output *output); bool (*export_dmabuf)(struct wlr_output *output, diff --git a/include/wlr/interfaces/wlr_pointer.h b/include/wlr/interfaces/wlr_pointer.h index f0cf9081..fd3ab102 100644 --- a/include/wlr/interfaces/wlr_pointer.h +++ b/include/wlr/interfaces/wlr_pointer.h @@ -1,3 +1,11 @@ +/* + * 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_INTERFACES_WLR_POINTER_H #define WLR_INTERFACES_WLR_POINTER_H diff --git a/include/wlr/interfaces/wlr_tablet_pad.h b/include/wlr/interfaces/wlr_tablet_pad.h index 5ec1e3eb..86bbe9c3 100644 --- a/include/wlr/interfaces/wlr_tablet_pad.h +++ b/include/wlr/interfaces/wlr_tablet_pad.h @@ -1,3 +1,11 @@ +/* + * 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_INTERFACES_WLR_TABLET_PAD_H #define WLR_INTERFACES_WLR_TABLET_PAD_H diff --git a/include/wlr/interfaces/wlr_tablet_tool.h b/include/wlr/interfaces/wlr_tablet_tool.h index 12b2e32e..9cfc3ca0 100644 --- a/include/wlr/interfaces/wlr_tablet_tool.h +++ b/include/wlr/interfaces/wlr_tablet_tool.h @@ -1,3 +1,11 @@ +/* + * 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_INTERFACES_WLR_TABLET_TOOL_H #define WLR_INTERFACES_WLR_TABLET_TOOL_H diff --git a/include/wlr/interfaces/wlr_touch.h b/include/wlr/interfaces/wlr_touch.h index 63bac6b8..cc426332 100644 --- a/include/wlr/interfaces/wlr_touch.h +++ b/include/wlr/interfaces/wlr_touch.h @@ -1,3 +1,11 @@ +/* + * 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_INTERFACES_WLR_TOUCH_H #define WLR_INTERFACES_WLR_TOUCH_H diff --git a/include/wlr/meson.build b/include/wlr/meson.build index 6259c311..43b5aec9 100644 --- a/include/wlr/meson.build +++ b/include/wlr/meson.build @@ -4,11 +4,23 @@ version_data.set_quoted('WLR_VERSION_STR', meson.project_version()) version_data.set('WLR_VERSION_MAJOR', version_array[0]) version_data.set('WLR_VERSION_MINOR', version_array[1]) version_data.set('WLR_VERSION_MICRO', version_array[2]) -version_data.set('WLR_VERSION_NUM', '(WLR_VERSION_MAJOR << 16) | (WLR_VERSION_MINOR << 8) | WLR_VERSION_MICRO') version_data.set('WLR_VERSION_API_CURRENT', so_version[0]) version_data.set('WLR_VERSION_API_REVISION', so_version[1]) version_data.set('WLR_VERSION_API_AGE', so_version[2]) -wlr_inc_dest = join_paths(get_option('includedir'), 'wlr') -configure_file(output: 'config.h', install_dir: wlr_inc_dest, configuration: conf_data) -configure_file(output: 'version.h', install_dir: wlr_inc_dest, configuration: version_data) +install_headers( + configure_file(input: 'config.h.in', output: 'config.h',configuration: conf_data), + configure_file(input: 'version.h.in', output: 'version.h', configuration: version_data), + 'backend.h', + 'xcursor.h', + subdir: 'wlr' +) +if conf_data.get('WLR_HAS_XWAYLAND', false) + install_headers('xwayland.h', subdir: 'wlr') +endif + +subdir('backend') +subdir('interfaces') +subdir('render') +subdir('types') +subdir('util') diff --git a/include/wlr/render/dmabuf.h b/include/wlr/render/dmabuf.h index 78f8c2eb..33c3a129 100644 --- a/include/wlr/render/dmabuf.h +++ b/include/wlr/render/dmabuf.h @@ -1,3 +1,11 @@ +/* + * 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_RENDER_DMABUF_H #define WLR_RENDER_DMABUF_H diff --git a/include/wlr/render/egl.h b/include/wlr/render/egl.h index 6b887f4f..c42b0325 100644 --- a/include/wlr/render/egl.h +++ b/include/wlr/render/egl.h @@ -1,3 +1,11 @@ +/* + * 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_RENDER_EGL_H #define WLR_RENDER_EGL_H diff --git a/include/wlr/render/gles2.h b/include/wlr/render/gles2.h index 866c6658..fca11ab8 100644 --- a/include/wlr/render/gles2.h +++ b/include/wlr/render/gles2.h @@ -1,3 +1,11 @@ +/* + * 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_RENDER_GLES2_H #define WLR_RENDER_GLES2_H diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h index f4565ad5..63f4265c 100644 --- a/include/wlr/render/interface.h +++ b/include/wlr/render/interface.h @@ -1,3 +1,11 @@ +/* + * 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_RENDER_INTERFACE_H #define WLR_RENDER_INTERFACE_H diff --git a/include/wlr/render/meson.build b/include/wlr/render/meson.build new file mode 100644 index 00000000..05127bb7 --- /dev/null +++ b/include/wlr/render/meson.build @@ -0,0 +1,9 @@ +install_headers( + 'dmabuf.h', + 'egl.h', + 'gles2.h', + 'interface.h', + 'wlr_renderer.h', + 'wlr_texture.h', + subdir: 'wlr/render' +) diff --git a/include/wlr/render/wlr_renderer.h b/include/wlr/render/wlr_renderer.h index 0650bf1b..9c031b7f 100644 --- a/include/wlr/render/wlr_renderer.h +++ b/include/wlr/render/wlr_renderer.h @@ -1,3 +1,11 @@ +/* + * 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_RENDER_WLR_RENDERER_H #define WLR_RENDER_WLR_RENDERER_H diff --git a/include/wlr/render/wlr_texture.h b/include/wlr/render/wlr_texture.h index 9370fa25..dbfabfee 100644 --- a/include/wlr/render/wlr_texture.h +++ b/include/wlr/render/wlr_texture.h @@ -1,3 +1,11 @@ +/* + * 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_RENDER_WLR_TEXTURE_H #define WLR_RENDER_WLR_TEXTURE_H diff --git a/include/wlr/types/meson.build b/include/wlr/types/meson.build new file mode 100644 index 00000000..8c81cb0e --- /dev/null +++ b/include/wlr/types/meson.build @@ -0,0 +1,42 @@ +install_headers( + 'wlr_box.h', + 'wlr_buffer.h', + 'wlr_compositor.h', + 'wlr_cursor.h', + 'wlr_data_device.h', + 'wlr_export_dmabuf_v1.h', + 'wlr_gamma_control.h', + 'wlr_gamma_control_v1.h', + 'wlr_idle.h', + 'wlr_idle_inhibit_v1.h', + 'wlr_input_device.h', + 'wlr_input_inhibitor.h', + 'wlr_keyboard.h', + 'wlr_layer_shell.h', + 'wlr_linux_dmabuf_v1.h', + 'wlr_list.h', + 'wlr_matrix.h', + 'wlr_output.h', + 'wlr_output_damage.h', + 'wlr_output_layout.h', + 'wlr_pointer.h', + 'wlr_primary_selection.h', + 'wlr_region.h', + 'wlr_screencopy_v1.h', + 'wlr_screenshooter.h', + 'wlr_seat.h', + 'wlr_server_decoration.h', + 'wlr_surface.h', + 'wlr_tablet_pad.h', + 'wlr_tablet_tool.h', + 'wlr_tablet_v2.h', + 'wlr_touch.h', + 'wlr_virtual_keyboard_v1.h', + 'wlr_wl_shell.h', + 'wlr_xcursor_manager.h', + 'wlr_xdg_decoration_v1.h', + 'wlr_xdg_output.h', + 'wlr_xdg_shell.h', + 'wlr_xdg_shell_v6.h', + subdir: 'wlr/types', +) diff --git a/include/wlr/types/wlr_box.h b/include/wlr/types/wlr_box.h index 0e586a18..11a53b56 100644 --- a/include/wlr/types/wlr_box.h +++ b/include/wlr/types/wlr_box.h @@ -1,3 +1,11 @@ +/* + * 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_BOX_H #define WLR_TYPES_WLR_BOX_H diff --git a/include/wlr/types/wlr_buffer.h b/include/wlr/types/wlr_buffer.h index eabc8b51..0c987b17 100644 --- a/include/wlr/types/wlr_buffer.h +++ b/include/wlr/types/wlr_buffer.h @@ -1,3 +1,11 @@ +/* + * 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_BUFFER_H #define WLR_TYPES_WLR_BUFFER_H diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h index 0d79b0bb..1772e54b 100644 --- a/include/wlr/types/wlr_compositor.h +++ b/include/wlr/types/wlr_compositor.h @@ -1,3 +1,11 @@ +/* + * 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_COMPOSITOR_H #define WLR_TYPES_WLR_COMPOSITOR_H diff --git a/include/wlr/types/wlr_cursor.h b/include/wlr/types/wlr_cursor.h index 998c6f0d..ba582be9 100644 --- a/include/wlr/types/wlr_cursor.h +++ b/include/wlr/types/wlr_cursor.h @@ -1,3 +1,11 @@ +/* + * 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_CURSOR_H #define WLR_TYPES_WLR_CURSOR_H diff --git a/include/wlr/types/wlr_data_device.h b/include/wlr/types/wlr_data_device.h index 8b7b374c..c45e8d1c 100644 --- a/include/wlr/types/wlr_data_device.h +++ b/include/wlr/types/wlr_data_device.h @@ -1,3 +1,11 @@ +/* + * 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_DATA_DEVICE_H #define WLR_TYPES_WLR_DATA_DEVICE_H @@ -85,8 +93,6 @@ struct wlr_drag_icon { bool is_pointer; int32_t touch_id; - int32_t sx, sy; - struct { struct wl_signal map; struct wl_signal unmap; diff --git a/include/wlr/types/wlr_export_dmabuf_v1.h b/include/wlr/types/wlr_export_dmabuf_v1.h index a094b3de..56767540 100644 --- a/include/wlr/types/wlr_export_dmabuf_v1.h +++ b/include/wlr/types/wlr_export_dmabuf_v1.h @@ -1,3 +1,11 @@ +/* + * 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_EXPORT_DMABUF_V1_H #define WLR_TYPES_WLR_EXPORT_DMABUF_V1_H diff --git a/include/wlr/types/wlr_gamma_control.h b/include/wlr/types/wlr_gamma_control.h index f195c8ef..912a413c 100644 --- a/include/wlr/types/wlr_gamma_control.h +++ b/include/wlr/types/wlr_gamma_control.h @@ -1,3 +1,11 @@ +/* + * 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_GAMMA_CONTROL_H #define WLR_TYPES_WLR_GAMMA_CONTROL_H @@ -9,6 +17,10 @@ struct wlr_gamma_control_manager { struct wl_listener display_destroy; + struct { + struct wl_signal destroy; + } events; + void *data; }; diff --git a/include/wlr/types/wlr_gamma_control_v1.h b/include/wlr/types/wlr_gamma_control_v1.h new file mode 100644 index 00000000..f186aa81 --- /dev/null +++ b/include/wlr/types/wlr_gamma_control_v1.h @@ -0,0 +1,35 @@ +#ifndef WLR_TYPES_WLR_GAMMA_CONTROL_V1_H +#define WLR_TYPES_WLR_GAMMA_CONTROL_V1_H + +#include <wayland-server.h> + +struct wlr_gamma_control_manager_v1 { + struct wl_global *global; + struct wl_list resources; + struct wl_list controls; // wlr_gamma_control_v1::link + + struct wl_listener display_destroy; + + struct { + struct wl_signal destroy; + } events; + + void *data; +}; + +struct wlr_gamma_control_v1 { + struct wl_resource *resource; + struct wlr_output *output; + struct wl_list link; + + struct wl_listener output_destroy_listener; + + void *data; +}; + +struct wlr_gamma_control_manager_v1 *wlr_gamma_control_manager_v1_create( + struct wl_display *display); +void wlr_gamma_control_manager_v1_destroy( + struct wlr_gamma_control_manager_v1 *manager); + +#endif diff --git a/include/wlr/types/wlr_idle.h b/include/wlr/types/wlr_idle.h index 53fc6b98..d8c81a60 100644 --- a/include/wlr/types/wlr_idle.h +++ b/include/wlr/types/wlr_idle.h @@ -1,3 +1,11 @@ +/* + * 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_IDLE_H #define WLR_TYPES_WLR_IDLE_H @@ -22,6 +30,7 @@ struct wlr_idle { struct wl_listener display_destroy; struct { struct wl_signal activity_notify; + struct wl_signal destroy; } events; void *data; diff --git a/include/wlr/types/wlr_idle_inhibit_v1.h b/include/wlr/types/wlr_idle_inhibit_v1.h index 011abbe5..2093eafe 100644 --- a/include/wlr/types/wlr_idle_inhibit_v1.h +++ b/include/wlr/types/wlr_idle_inhibit_v1.h @@ -1,3 +1,11 @@ +/* + * 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_IDLE_INHIBIT_V1_H #define WLR_TYPES_WLR_IDLE_INHIBIT_V1_H @@ -19,11 +27,12 @@ struct wlr_idle_inhibit_manager_v1 { struct wl_list resources; // wl_resource_get_link struct wl_list inhibitors; // wlr_idle_inhibit_inhibitor_v1::link struct wl_global *global; - + struct wl_listener display_destroy; struct { struct wl_signal new_inhibitor; + struct wl_signal destroy; } events; void *data; diff --git a/include/wlr/types/wlr_input_device.h b/include/wlr/types/wlr_input_device.h index cce15d90..ab0aecb6 100644 --- a/include/wlr/types/wlr_input_device.h +++ b/include/wlr/types/wlr_input_device.h @@ -1,3 +1,11 @@ +/* + * 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_INPUT_DEVICE_H #define WLR_TYPES_WLR_INPUT_DEVICE_H diff --git a/include/wlr/types/wlr_input_inhibitor.h b/include/wlr/types/wlr_input_inhibitor.h index 2f333f3b..f3187540 100644 --- a/include/wlr/types/wlr_input_inhibitor.h +++ b/include/wlr/types/wlr_input_inhibitor.h @@ -1,3 +1,11 @@ +/* + * 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_INPUT_INHIBITOR_H #define WLR_TYPES_INPUT_INHIBITOR_H #include <wayland-server.h> @@ -12,6 +20,7 @@ struct wlr_input_inhibit_manager { struct { struct wl_signal activate; // struct wlr_input_inhibit_manager * struct wl_signal deactivate; // struct wlr_input_inhibit_manager * + struct wl_signal destroy; } events; void *data; diff --git a/include/wlr/types/wlr_keyboard.h b/include/wlr/types/wlr_keyboard.h index 67d4e5be..3e207523 100644 --- a/include/wlr/types/wlr_keyboard.h +++ b/include/wlr/types/wlr_keyboard.h @@ -1,3 +1,11 @@ +/* + * 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_KEYBOARD_H #define WLR_TYPES_WLR_KEYBOARD_H diff --git a/include/wlr/types/wlr_layer_shell.h b/include/wlr/types/wlr_layer_shell.h index 2848a115..c7ddd180 100644 --- a/include/wlr/types/wlr_layer_shell.h +++ b/include/wlr/types/wlr_layer_shell.h @@ -1,3 +1,11 @@ +/* + * 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_LAYER_SHELL_H #define WLR_TYPES_WLR_LAYER_SHELL_H #include <stdbool.h> @@ -31,6 +39,7 @@ struct wlr_layer_shell { // Note: the output may be NULL. In this case, it is your // responsibility to assign an output before returning. struct wl_signal new_surface; + struct wl_signal destroy; } events; void *data; diff --git a/include/wlr/types/wlr_linux_dmabuf.h b/include/wlr/types/wlr_linux_dmabuf_v1.h index 4a03170c..f21b0b3a 100644 --- a/include/wlr/types/wlr_linux_dmabuf.h +++ b/include/wlr/types/wlr_linux_dmabuf_v1.h @@ -1,3 +1,11 @@ +/* + * 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_LINUX_DMABUF_H #define WLR_TYPES_WLR_LINUX_DMABUF_H @@ -5,7 +13,7 @@ #include <wayland-server-protocol.h> #include <wlr/render/dmabuf.h> -struct wlr_dmabuf_buffer { +struct wlr_dmabuf_v1_buffer { struct wlr_renderer *renderer; struct wl_resource *buffer_resource; struct wl_resource *params_resource; @@ -17,24 +25,24 @@ struct wlr_dmabuf_buffer { * Returns true if the given resource was created via the linux-dmabuf * buffer protocol, false otherwise */ -bool wlr_dmabuf_resource_is_buffer(struct wl_resource *buffer_resource); +bool wlr_dmabuf_v1_resource_is_buffer(struct wl_resource *buffer_resource); /** * Returns the wlr_dmabuf_buffer if the given resource was created * via the linux-dmabuf buffer protocol */ -struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_buffer_resource( +struct wlr_dmabuf_v1_buffer *wlr_dmabuf_v1_buffer_from_buffer_resource( struct wl_resource *buffer_resource); /** * Returns the wlr_dmabuf_buffer if the given resource was created * via the linux-dmabuf params protocol */ -struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_params_resource( +struct wlr_dmabuf_v1_buffer *wlr_dmabuf_v1_buffer_from_params_resource( struct wl_resource *params_resource); /* the protocol interface */ -struct wlr_linux_dmabuf { +struct wlr_linux_dmabuf_v1 { struct wl_global *global; struct wlr_renderer *renderer; struct wl_list resources; @@ -50,18 +58,18 @@ struct wlr_linux_dmabuf { /** * Create linux-dmabuf interface */ -struct wlr_linux_dmabuf *wlr_linux_dmabuf_create(struct wl_display *display, +struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create(struct wl_display *display, struct wlr_renderer *renderer); /** * Destroy the linux-dmabuf interface */ -void wlr_linux_dmabuf_destroy(struct wlr_linux_dmabuf *linux_dmabuf); +void wlr_linux_dmabuf_v1_destroy(struct wlr_linux_dmabuf_v1 *linux_dmabuf); /** * Returns the wlr_linux_dmabuf if the given resource was created * via the linux_dmabuf protocol */ -struct wlr_linux_dmabuf *wlr_linux_dmabuf_from_resource( +struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_from_resource( struct wl_resource *resource); #endif diff --git a/include/wlr/types/wlr_list.h b/include/wlr/types/wlr_list.h index 23bf53b7..60f388f9 100644 --- a/include/wlr/types/wlr_list.h +++ b/include/wlr/types/wlr_list.h @@ -1,3 +1,11 @@ +/* + * 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_LIST_H #define WLR_TYPES_WLR_LIST_H diff --git a/include/wlr/types/wlr_matrix.h b/include/wlr/types/wlr_matrix.h index 02111db8..a3961c35 100644 --- a/include/wlr/types/wlr_matrix.h +++ b/include/wlr/types/wlr_matrix.h @@ -1,20 +1,57 @@ +/* + * This is a stable interface of wlroots. Future changes will be limited to: + * + * - New functions + * - New struct members + * - New enum members + * + * Note that wlroots does not make an ABI compatibility promise - in the future, + * the layout and size of structs used by wlroots may change, requiring code + * depending on this header to be recompiled (but not edited). + * + * Breaking changes are announced by email and follow a 1-year deprecation + * schedule. Send an email to ~sircmpwn/wlroots-announce+subscribe@lists.sr.ht + * to receive these announcements. + */ + #ifndef WLR_TYPES_WLR_MATRIX_H #define WLR_TYPES_WLR_MATRIX_H #include <wayland-server.h> #include <wlr/types/wlr_box.h> +/** Writes the identity matrix into mat */ void wlr_matrix_identity(float mat[static 9]); + +/** mat ← a × b */ void wlr_matrix_multiply(float mat[static 9], const float a[static 9], const float b[static 9]); + void wlr_matrix_transpose(float mat[static 9], const float a[static 9]); + +/** Writes a 2D translation matrix to mat of magnitude (x, y) */ void wlr_matrix_translate(float mat[static 9], float x, float y); + +/** Writes a 2D scale matrix to mat of magnitude (x, y) */ void wlr_matrix_scale(float mat[static 9], float x, float y); + +/** Writes a 2D rotation matrix to mat at an angle of rad radians */ void wlr_matrix_rotate(float mat[static 9], float rad); + +/** Writes a transformation matrix which applies the specified + * wl_output_transform to mat */ void wlr_matrix_transform(float mat[static 9], enum wl_output_transform transform); + +/** Writes a 2D orthographic projection matrix to mat of (width, height) with a + * specified wl_output_transform*/ void wlr_matrix_projection(float mat[static 9], int width, int height, enum wl_output_transform transform); + +/** Shortcut for the various matrix operations involved in projecting the + * specified wlr_box onto a given orthographic projection with a given + * rotation. The result is written to mat, which can be applied to each + * coordinate of the box to get a new coordinate from [-1,1]. */ void wlr_matrix_project_box(float mat[static 9], const struct wlr_box *box, enum wl_output_transform transform, float rotation, const float projection[static 9]); diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 5084eb5a..3a9f3c41 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -1,3 +1,11 @@ +/* + * 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_OUTPUT_H #define WLR_TYPES_WLR_OUTPUT_H @@ -6,7 +14,7 @@ #include <time.h> #include <wayland-server.h> #include <wayland-util.h> -#include <wlr/types/wlr_linux_dmabuf.h> +#include <wlr/render/dmabuf.h> struct wlr_output_mode { uint32_t flags; // enum wl_output_mode @@ -166,9 +174,19 @@ bool wlr_output_swap_buffers(struct wlr_output *output, struct timespec *when, * it is a no-op. */ void wlr_output_schedule_frame(struct wlr_output *output); -void wlr_output_set_gamma(struct wlr_output *output, - uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b); +/** + * Returns the maximum length of each gamma ramp, or 0 if unsupported. + */ uint32_t wlr_output_get_gamma_size(struct wlr_output *output); +/** + * Sets the gamma table for this output. `r`, `g` and `b` are gamma ramps for + * red, green and blue. `size` is the length of the ramps and must not exceed + * the value returned by `wlr_output_get_gamma_size`. + * + * Providing zero-sized ramps resets the gamma table. + */ +bool wlr_output_set_gamma(struct wlr_output *output, + uint32_t size, uint16_t *r, uint16_t *g, uint16_t *b); bool wlr_output_export_dmabuf(struct wlr_output *output, struct wlr_dmabuf_attributes *attribs); void wlr_output_set_fullscreen_surface(struct wlr_output *output, diff --git a/include/wlr/types/wlr_output_damage.h b/include/wlr/types/wlr_output_damage.h index a4333c1a..d614e6d6 100644 --- a/include/wlr/types/wlr_output_damage.h +++ b/include/wlr/types/wlr_output_damage.h @@ -1,3 +1,11 @@ +/* + * 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_OUTPUT_DAMAGE_H #define WLR_TYPES_WLR_OUTPUT_DAMAGE_H diff --git a/include/wlr/types/wlr_output_layout.h b/include/wlr/types/wlr_output_layout.h index 759c8ccf..cc9d2328 100644 --- a/include/wlr/types/wlr_output_layout.h +++ b/include/wlr/types/wlr_output_layout.h @@ -1,3 +1,11 @@ +/* + * 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_OUTPUT_LAYOUT_H #define WLR_TYPES_WLR_OUTPUT_LAYOUT_H @@ -118,5 +126,8 @@ enum wlr_direction { struct wlr_output *wlr_output_layout_adjacent_output( struct wlr_output_layout *layout, enum wlr_direction direction, struct wlr_output *reference, double ref_lx, double ref_ly); +struct wlr_output *wlr_output_layout_farthest_output( + struct wlr_output_layout *layout, enum wlr_direction direction, + struct wlr_output *reference, double ref_lx, double ref_ly); #endif diff --git a/include/wlr/types/wlr_pointer.h b/include/wlr/types/wlr_pointer.h index 48c89151..7dc643ae 100644 --- a/include/wlr/types/wlr_pointer.h +++ b/include/wlr/types/wlr_pointer.h @@ -1,3 +1,11 @@ +/* + * 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_POINTER_H #define WLR_TYPES_WLR_POINTER_H diff --git a/include/wlr/types/wlr_primary_selection.h b/include/wlr/types/wlr_primary_selection.h index 78f23ad6..f33f6368 100644 --- a/include/wlr/types/wlr_primary_selection.h +++ b/include/wlr/types/wlr_primary_selection.h @@ -1,3 +1,11 @@ +/* + * 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_PRIMARY_SELECTION_H #define WLR_TYPES_WLR_PRIMARY_SELECTION_H @@ -9,6 +17,10 @@ struct wlr_primary_selection_device_manager { struct wl_listener display_destroy; + struct { + struct wl_signal destroy; + } events; + void *data; }; diff --git a/include/wlr/types/wlr_region.h b/include/wlr/types/wlr_region.h index be2f8b84..3c4a0532 100644 --- a/include/wlr/types/wlr_region.h +++ b/include/wlr/types/wlr_region.h @@ -1,3 +1,11 @@ +/* + * 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_REGION_H #define WLR_TYPES_WLR_REGION_H diff --git a/include/wlr/types/wlr_screencopy_v1.h b/include/wlr/types/wlr_screencopy_v1.h index 892687aa..aba32a45 100644 --- a/include/wlr/types/wlr_screencopy_v1.h +++ b/include/wlr/types/wlr_screencopy_v1.h @@ -1,7 +1,16 @@ +/* + * 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_SCREENCOPY_V1_H #define WLR_TYPES_WLR_SCREENCOPY_V1_H #include <wayland-server.h> +#include <wlr/types/wlr_box.h> struct wlr_screencopy_manager_v1 { struct wl_global *global; @@ -10,6 +19,10 @@ struct wlr_screencopy_manager_v1 { struct wl_listener display_destroy; + struct { + struct wl_signal destroy; + } events; + void *data; }; diff --git a/include/wlr/types/wlr_screenshooter.h b/include/wlr/types/wlr_screenshooter.h index 916c8942..b7b87b39 100644 --- a/include/wlr/types/wlr_screenshooter.h +++ b/include/wlr/types/wlr_screenshooter.h @@ -1,3 +1,11 @@ +/* + * 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_SCREENSHOOTER_H #define WLR_TYPES_WLR_SCREENSHOOTER_H @@ -9,6 +17,10 @@ struct wlr_screenshooter { struct wl_listener display_destroy; + struct { + struct wl_signal destroy; + } events; + void *data; }; diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index 92d0a233..b3c02cf2 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -1,3 +1,11 @@ +/* + * 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_SEAT_H #define WLR_TYPES_WLR_SEAT_H diff --git a/include/wlr/types/wlr_server_decoration.h b/include/wlr/types/wlr_server_decoration.h index 23387968..ff8d1369 100644 --- a/include/wlr/types/wlr_server_decoration.h +++ b/include/wlr/types/wlr_server_decoration.h @@ -1,3 +1,11 @@ +/* + * 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_SERVER_DECORATION_H #define WLR_TYPES_WLR_SERVER_DECORATION_H @@ -37,6 +45,7 @@ struct wlr_server_decoration_manager { struct { struct wl_signal new_decoration; + struct wl_signal destroy; } events; void *data; diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index 0e3b5ff4..063f9e26 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -1,3 +1,11 @@ +/* + * 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_SURFACE_H #define WLR_TYPES_WLR_SURFACE_H @@ -39,6 +47,7 @@ struct wlr_surface_state { struct wlr_surface_role { const char *name; void (*commit)(struct wlr_surface *surface); + void (*precommit)(struct wlr_surface *surface); }; struct wlr_surface { diff --git a/include/wlr/types/wlr_tablet_pad.h b/include/wlr/types/wlr_tablet_pad.h index 23ac464d..d9bb284f 100644 --- a/include/wlr/types/wlr_tablet_pad.h +++ b/include/wlr/types/wlr_tablet_pad.h @@ -1,3 +1,11 @@ +/* + * 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_TABLET_PAD_H #define WLR_TYPES_WLR_TABLET_PAD_H diff --git a/include/wlr/types/wlr_tablet_tool.h b/include/wlr/types/wlr_tablet_tool.h index bfa2e1f7..cb516ed9 100644 --- a/include/wlr/types/wlr_tablet_tool.h +++ b/include/wlr/types/wlr_tablet_tool.h @@ -1,3 +1,11 @@ +/* + * 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_TABLET_TOOL_H #define WLR_TYPES_TABLET_TOOL_H diff --git a/include/wlr/types/wlr_tablet_v2.h b/include/wlr/types/wlr_tablet_v2.h index e2a39392..d6fd646d 100644 --- a/include/wlr/types/wlr_tablet_v2.h +++ b/include/wlr/types/wlr_tablet_v2.h @@ -1,3 +1,11 @@ +/* + * 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_TABLET_V2_H #define WLR_TYPES_WLR_TABLET_V2_H @@ -37,6 +45,10 @@ struct wlr_tablet_manager_v2 { struct wl_listener display_destroy; + struct { + struct wl_signal destroy; + } events; + void *data; }; diff --git a/include/wlr/types/wlr_touch.h b/include/wlr/types/wlr_touch.h index 70070f84..99316ae0 100644 --- a/include/wlr/types/wlr_touch.h +++ b/include/wlr/types/wlr_touch.h @@ -1,3 +1,11 @@ +/* + * 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_TOUCH_H #define WLR_TYPES_WLR_TOUCH_H diff --git a/include/wlr/types/wlr_virtual_keyboard_v1.h b/include/wlr/types/wlr_virtual_keyboard_v1.h index 1236ae24..e75ed8ec 100644 --- a/include/wlr/types/wlr_virtual_keyboard_v1.h +++ b/include/wlr/types/wlr_virtual_keyboard_v1.h @@ -1,3 +1,11 @@ +/* + * 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_VIRTUAL_KEYBOARD_V1_H #define WLR_TYPES_WLR_VIRTUAL_KEYBOARD_V1_H @@ -14,6 +22,7 @@ struct wlr_virtual_keyboard_manager_v1 { struct { struct wl_signal new_virtual_keyboard; // struct wlr_virtual_keyboard_v1* + struct wl_signal destroy; } events; }; diff --git a/include/wlr/types/wlr_wl_shell.h b/include/wlr/types/wlr_wl_shell.h index c4cc1999..dffbb4d7 100644 --- a/include/wlr/types/wlr_wl_shell.h +++ b/include/wlr/types/wlr_wl_shell.h @@ -1,3 +1,11 @@ +/* + * 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_WL_SHELL_H #define WLR_TYPES_WLR_WL_SHELL_H @@ -16,6 +24,7 @@ struct wlr_wl_shell { struct { struct wl_signal new_surface; + struct wl_signal destroy; } events; void *data; diff --git a/include/wlr/types/wlr_xcursor_manager.h b/include/wlr/types/wlr_xcursor_manager.h index c7fa83be..285006bf 100644 --- a/include/wlr/types/wlr_xcursor_manager.h +++ b/include/wlr/types/wlr_xcursor_manager.h @@ -1,3 +1,11 @@ +/* + * 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_XCURSOR_MANAGER_H #define WLR_TYPES_WLR_XCURSOR_MANAGER_H 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..ba1ad84b --- /dev/null +++ b/include/wlr/types/wlr_xdg_decoration_v1.h @@ -0,0 +1,69 @@ +#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 * + struct wl_signal destroy; + } 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_output.h b/include/wlr/types/wlr_xdg_output.h index 81566ab9..60611307 100644 --- a/include/wlr/types/wlr_xdg_output.h +++ b/include/wlr/types/wlr_xdg_output.h @@ -1,3 +1,11 @@ +/* + * 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_XDG_OUTPUT_H #define WLR_TYPES_WLR_XDG_OUTPUT_H #include <wayland-server.h> @@ -26,6 +34,10 @@ struct wlr_xdg_output_manager { struct wl_listener layout_add; struct wl_listener layout_change; struct wl_listener layout_destroy; + + struct { + struct wl_signal destroy; + } events; }; struct wlr_xdg_output_manager *wlr_xdg_output_manager_create( diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h index 9c0e6adc..1bca9ef3 100644 --- a/include/wlr/types/wlr_xdg_shell.h +++ b/include/wlr/types/wlr_xdg_shell.h @@ -1,3 +1,11 @@ +/* + * 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_XDG_SHELL_H #define WLR_TYPES_WLR_XDG_SHELL_H #include <wlr/types/wlr_box.h> @@ -21,6 +29,7 @@ struct wlr_xdg_shell { * surface will be ready to be managed on the `map` event. */ struct wl_signal new_surface; + struct wl_signal destroy; } events; void *data; @@ -119,10 +128,13 @@ struct wlr_xdg_toplevel { struct wl_signal request_resize; struct wl_signal request_show_window_menu; struct wl_signal set_parent; + struct wl_signal set_title; + struct wl_signal set_app_id; } events; }; struct wlr_xdg_surface_configure { + struct wlr_xdg_surface *surface; struct wl_list link; // wlr_xdg_surface::configure_list uint32_t serial; @@ -186,6 +198,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; @@ -224,6 +240,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); @@ -283,13 +301,6 @@ uint32_t wlr_xdg_toplevel_set_tiled(struct wlr_xdg_surface *surface, void wlr_xdg_surface_send_close(struct wlr_xdg_surface *surface); /** - * Compute the popup position in its parent's surface-local coordinate system. - * This aborts if called for popups whose parent is not an xdg_surface. - */ -void wlr_xdg_surface_popup_get_position(struct wlr_xdg_surface *surface, - double *popup_sx, double *popup_sy); - -/** * Get the geometry for this positioner based on the anchor rect, gravity, and * size of this positioner. */ @@ -350,7 +361,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 @@ -358,7 +370,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 diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h index 2e1b6f11..a69e488f 100644 --- a/include/wlr/types/wlr_xdg_shell_v6.h +++ b/include/wlr/types/wlr_xdg_shell_v6.h @@ -1,3 +1,11 @@ +/* + * 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_XDG_SHELL_V6_H #define WLR_TYPES_WLR_XDG_SHELL_V6_H @@ -22,6 +30,7 @@ struct wlr_xdg_shell_v6 { * surface will be ready to be managed on the `map` event. */ struct wl_signal new_surface; + struct wl_signal destroy; } events; void *data; @@ -127,6 +136,8 @@ struct wlr_xdg_toplevel_v6 { struct wl_signal request_resize; struct wl_signal request_show_window_menu; struct wl_signal set_parent; + struct wl_signal set_title; + struct wl_signal set_app_id; } events; }; diff --git a/include/wlr/util/edges.h b/include/wlr/util/edges.h index 53268323..bf1eb1e7 100644 --- a/include/wlr/util/edges.h +++ b/include/wlr/util/edges.h @@ -1,3 +1,19 @@ +/* + * This is a stable interface of wlroots. Future changes will be limited to: + * + * - New functions + * - New struct members + * - New enum members + * + * Note that wlroots does not make an ABI compatibility promise - in the future, + * the layout and size of structs used by wlroots may change, requiring code + * depending on this header to be recompiled (but not edited). + * + * Breaking changes are announced by email and follow a 1-year deprecation + * schedule. Send an email to ~sircmpwn/wlroots-announce+subscribe@lists.sr.ht + * to receive these announcements. + */ + #ifndef WLR_UTIL_EDGES_H #define WLR_UTIL_EDGES_H diff --git a/include/wlr/util/log.h b/include/wlr/util/log.h index 098a020d..2c441180 100644 --- a/include/wlr/util/log.h +++ b/include/wlr/util/log.h @@ -1,3 +1,19 @@ +/* + * This is a stable interface of wlroots. Future changes will be limited to: + * + * - New functions + * - New struct members + * - New enum members + * + * Note that wlroots does not make an ABI compatibility promise - in the future, + * the layout and size of structs used by wlroots may change, requiring code + * depending on this header to be recompiled (but not edited). + * + * Breaking changes are announced by email and follow a 1-year deprecation + * schedule. Send an email to ~sircmpwn/wlroots-announce+subscribe@lists.sr.ht + * to receive these announcements. + */ + #ifndef WLR_UTIL_LOG_H #define WLR_UTIL_LOG_H @@ -19,8 +35,13 @@ typedef void (*wlr_log_func_t)(enum wlr_log_importance importance, // Will log all messages less than or equal to `verbosity` // If `callback` is NULL, wlr will use its default logger. +// The function can be called multiple times to update the verbosity or +// callback function. void wlr_log_init(enum wlr_log_importance verbosity, wlr_log_func_t callback); +// Returns the log verbosity provided to wlr_log_init +enum wlr_log_importance wlr_log_get_verbosity(void); + #ifdef __GNUC__ #define _WLR_ATTRIB_PRINTF(start, end) __attribute__((format(printf, start, end))) #else diff --git a/include/wlr/util/meson.build b/include/wlr/util/meson.build new file mode 100644 index 00000000..ee72cbd6 --- /dev/null +++ b/include/wlr/util/meson.build @@ -0,0 +1,6 @@ +install_headers( + 'edges.h', + 'log.h', + 'region.h', + subdir: 'wlr/util', +) diff --git a/include/wlr/util/region.h b/include/wlr/util/region.h index c0fe6063..32387bfb 100644 --- a/include/wlr/util/region.h +++ b/include/wlr/util/region.h @@ -1,6 +1,21 @@ +/* + * This is a stable interface of wlroots. Future changes will be limited to: + * + * - New functions + * - New struct members + * - New enum members + * + * Note that wlroots does not make an ABI compatibility promise - in the future, + * the layout and size of structs used by wlroots may change, requiring code + * depending on this header to be recompiled (but not edited). + * + * Breaking changes are announced by email and follow a 1-year deprecation + * schedule. Send an email to ~sircmpwn/wlroots-announce+subscribe@lists.sr.ht + * to receive these announcements. + */ + #ifndef WLR_UTIL_REGION_H #define WLR_UTIL_REGION_H - #include <pixman.h> #include <wayland-server.h> diff --git a/include/wlr/version.h.in b/include/wlr/version.h.in new file mode 100644 index 00000000..cdc0fd75 --- /dev/null +++ b/include/wlr/version.h.in @@ -0,0 +1,16 @@ +#ifndef WLR_VERSION_H +#define WLR_VERSION_H + +#mesondefine WLR_VERSION_STR + +#mesondefine WLR_VERSION_MAJOR +#mesondefine WLR_VERSION_MINOR +#mesondefine WLR_VERSION_MICRO + +#define WLR_VERSION_NUM ((WLR_VERSION_MAJOR << 16) | (WLR_VERSION_MINOR << 8) | WLR_VERSION_MICRO) + +#mesondefine WLR_VERSION_API_CURRENT +#mesondefine WLR_VERSION_API_REVISION +#mesondefine WLR_VERSION_API_AGE + +#endif diff --git a/include/wlr/xcursor.h b/include/wlr/xcursor.h index d97469f8..39874f39 100644 --- a/include/wlr/xcursor.h +++ b/include/wlr/xcursor.h @@ -24,8 +24,19 @@ */ /* - * This is adapted from wayland-cursor, but with the wl_shm client stuff removed - * so we can use it on the compositor, too. + * This is a stable interface of wlroots. Future changes will be limited to: + * + * - New functions + * - New struct members + * - New enum members + * + * Note that wlroots does not make an ABI compatibility promise - in the future, + * the layout and size of structs used by wlroots may change, requiring code + * depending on this header to be recompiled (but not edited). + * + * Breaking changes are announced by email and follow a 1-year deprecation + * schedule. Send an email to ~sircmpwn/wlroots-announce+subscribe@lists.sr.ht + * to receive these announcements. */ #ifndef WLR_XCURSOR_H diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h index 7471bbc6..eb5d6985 100644 --- a/include/wlr/xwayland.h +++ b/include/wlr/xwayland.h @@ -1,3 +1,11 @@ +/* + * 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_XWAYLAND_H #define WLR_XWAYLAND_H @@ -108,6 +116,7 @@ struct wlr_xwayland_surface { char *title; char *class; char *instance; + char *role; pid_t pid; bool has_utf8_title; @@ -130,6 +139,7 @@ struct wlr_xwayland_surface { struct wl_event_source *ping_timer; // _NET_WM_STATE + bool modal; bool fullscreen; bool maximized_vert, maximized_horz; @@ -142,14 +152,18 @@ struct wlr_xwayland_surface { struct wl_signal request_resize; struct wl_signal request_maximize; struct wl_signal request_fullscreen; + struct wl_signal request_activate; struct wl_signal map; struct wl_signal unmap; struct wl_signal set_title; struct wl_signal set_class; + struct wl_signal set_role; struct wl_signal set_parent; struct wl_signal set_pid; struct wl_signal set_window_type; + struct wl_signal set_hints; + struct wl_signal set_override_redirect; struct wl_signal ping_timeout; } events; @@ -174,6 +188,14 @@ struct wlr_xwayland_resize_event { uint32_t edges; }; +/** Create an Xwayland server. + * + * The server supports a lazy mode in which Xwayland is only started when a + * client tries to connect. + * + * Note: wlr_xwayland will setup a global SIGUSR1 handler on the compositor + * process. + */ struct wlr_xwayland *wlr_xwayland_create(struct wl_display *wl_display, struct wlr_compositor *compositor, bool lazy); @@ -200,9 +222,6 @@ void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland_surface *surface, void wlr_xwayland_set_seat(struct wlr_xwayland *xwayland, struct wlr_seat *seat); -bool wlr_xwayland_surface_is_unmanaged( - const struct wlr_xwayland_surface *surface); - bool wlr_surface_is_xwayland_surface(struct wlr_surface *surface); struct wlr_xwayland_surface *wlr_xwayland_surface_from_wlr_surface( @@ -210,4 +229,29 @@ struct wlr_xwayland_surface *wlr_xwayland_surface_from_wlr_surface( void wlr_xwayland_surface_ping(struct wlr_xwayland_surface *surface); +/** Metric to guess if an OR window should "receive" focus + * + * In the pure X setups, window managers usually straight up ignore override + * redirect windows, and never touch them. (we have to handle them for mapping) + * + * When such a window wants to receive keyboard input (e.g. rofi/dzen) it will + * use mechanics we don't support (sniffing/grabbing input). + * [Sadly this is unrelated to xwayland-keyboard-grab] + * + * To still support these windows, while keeping general OR semantics as is, we + * need to hand a subset of windows focus. + * The dirty truth is, we need to hand focus to any Xwayland window, though + * pretending this window has focus makes it easier to handle unmap. + * + * This function provides a handy metric based on the window type to guess if + * the OR window wants focus. + * It's probably not perfect, nor exactly intended but works in practice. + * + * Returns: true if the window should receive focus + * false if it should be ignored + */ +bool wlr_xwayland_or_surface_wants_focus( + const struct wlr_xwayland_surface *surface); + + #endif diff --git a/include/xwayland/xwm.h b/include/xwayland/xwm.h index 08d37736..3536bbc8 100644 --- a/include/xwayland/xwm.h +++ b/include/xwayland/xwm.h @@ -25,6 +25,7 @@ enum atom_name { WM_HINTS, WM_NORMAL_HINTS, WM_SIZE_HINTS, + WM_WINDOW_ROLE, MOTIF_WM_HINTS, UTF8_STRING, WM_S0, @@ -40,6 +41,7 @@ enum atom_name { _NET_WM_MOVERESIZE, _NET_WM_NAME, _NET_SUPPORTING_WM_CHECK, + _NET_WM_STATE_MODAL, _NET_WM_STATE_FULLSCREEN, _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_MAXIMIZED_HORZ, |