diff options
Diffstat (limited to 'include/wlr')
40 files changed, 375 insertions, 86 deletions
diff --git a/include/wlr/backend.h b/include/wlr/backend.h index f92857eb..6c11152f 100644 --- a/include/wlr/backend.h +++ b/include/wlr/backend.h @@ -1,5 +1,5 @@ -#ifndef _WLR_BACKEND_H -#define _WLR_BACKEND_H +#ifndef WLR_BACKEND_H +#define WLR_BACKEND_H #include <wayland-server.h> #include <wlr/backend/session.h> diff --git a/include/wlr/backend/interface.h b/include/wlr/backend/interface.h index b0814da5..ea41400a 100644 --- a/include/wlr/backend/interface.h +++ b/include/wlr/backend/interface.h @@ -1,5 +1,5 @@ -#ifndef _WLR_BACKEND_INTERFACE_H -#define _WLR_BACKEND_INTERFACE_H +#ifndef WLR_BACKEND_INTERFACE_H +#define WLR_BACKEND_INTERFACE_H #include <stdbool.h> #include <wlr/backend.h> diff --git a/include/wlr/backend/multi.h b/include/wlr/backend/multi.h index 3fcaaf1e..5559f2c1 100644 --- a/include/wlr/backend/multi.h +++ b/include/wlr/backend/multi.h @@ -1,5 +1,5 @@ -#ifndef _WLR_BACKEND_MULTI_H -#define _WLR_BACKEND_MULTI_H +#ifndef WLR_BACKEND_MULTI_H +#define WLR_BACKEND_MULTI_H #include <wlr/backend.h> #include <wlr/backend/session.h> diff --git a/include/wlr/backend/session.h b/include/wlr/backend/session.h index 04e701b0..52cf13b7 100644 --- a/include/wlr/backend/session.h +++ b/include/wlr/backend/session.h @@ -1,5 +1,5 @@ -#ifndef WLR_SESSION_H -#define WLR_SESSION_H +#ifndef WLR_BACKEND_SESSION_H +#define WLR_BACKEND_SESSION_H #include <stdbool.h> #include <wayland-server.h> diff --git a/include/wlr/backend/session/interface.h b/include/wlr/backend/session/interface.h index 1a029c54..b35ed71d 100644 --- a/include/wlr/backend/session/interface.h +++ b/include/wlr/backend/session/interface.h @@ -1,5 +1,5 @@ -#ifndef WLR_SESSION_INTERFACE_H -#define WLR_SESSION_INTERFACE_H +#ifndef WLR_BACKEND_SESSION_INTERFACE_H +#define WLR_BACKEND_SESSION_INTERFACE_H #include <wlr/backend/session.h> diff --git a/include/wlr/interfaces/wlr_data_source.h b/include/wlr/interfaces/wlr_data_source.h index 221c8007..821bdea0 100644 --- a/include/wlr/interfaces/wlr_data_source.h +++ b/include/wlr/interfaces/wlr_data_source.h @@ -1,5 +1,6 @@ -#ifndef _WLR_INTERFACES_DATA_SOURCE_H -#define _WLR_INTERFACES_DATA_SOURCE_H +#ifndef WLR_INTERFACES_WLR_DATA_SOURCE_H +#define WLR_INTERFACES_WLR_DATA_SOURCE_H + #include <wlr/types/wlr_data_source.h> struct wlr_data_source_impl { diff --git a/include/wlr/interfaces/wlr_input_device.h b/include/wlr/interfaces/wlr_input_device.h index b236a24a..2a681ff8 100644 --- a/include/wlr/interfaces/wlr_input_device.h +++ b/include/wlr/interfaces/wlr_input_device.h @@ -1,5 +1,6 @@ -#ifndef _WLR_INTERFACES_INPUT_DEVICE_H -#define _WLR_INTERFACES_INPUT_DEVICE_H +#ifndef WLR_INTERFACES_WLR_INPUT_DEVICE_H +#define WLR_INTERFACES_WLR_INPUT_DEVICE_H + #include <wlr/types/wlr_input_device.h> struct wlr_input_device_impl { diff --git a/include/wlr/interfaces/wlr_keyboard.h b/include/wlr/interfaces/wlr_keyboard.h index 779b302f..4958e2b8 100644 --- a/include/wlr/interfaces/wlr_keyboard.h +++ b/include/wlr/interfaces/wlr_keyboard.h @@ -1,5 +1,6 @@ -#ifndef _WLR_INTERFACE_KEYBOARD_H -#define _WLR_INTERFACE_KEYBOARD_H +#ifndef WLR_INTERFACES_WLR_KEYBOARD_H +#define WLR_INTERFACES_WLR_KEYBOARD_H + #include <wlr/types/wlr_keyboard.h> #include <stdint.h> diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index a95fe588..7ed19ed9 100644 --- a/include/wlr/interfaces/wlr_output.h +++ b/include/wlr/interfaces/wlr_output.h @@ -1,5 +1,6 @@ -#ifndef _WLR_INTERFACE_OUTPUT_H -#define _WLR_INTERFACE_OUTPUT_H +#ifndef WLR_INTERFACES_WLR_OUTPUT_H +#define WLR_INTERFACES_WLR_OUTPUT_H + #include <wlr/types/wlr_output.h> #include <stdbool.h> diff --git a/include/wlr/interfaces/wlr_pointer.h b/include/wlr/interfaces/wlr_pointer.h index 8d4bf703..af677b97 100644 --- a/include/wlr/interfaces/wlr_pointer.h +++ b/include/wlr/interfaces/wlr_pointer.h @@ -1,5 +1,6 @@ -#ifndef _WLR_INTERFACES_POINTER_H -#define _WLR_INTERFACES_POINTER_H +#ifndef WLR_INTERFACES_WLR_POINTER_H +#define WLR_INTERFACES_WLR_POINTER_H + #include <wlr/types/wlr_pointer.h> struct wlr_pointer_impl { diff --git a/include/wlr/interfaces/wlr_tablet_pad.h b/include/wlr/interfaces/wlr_tablet_pad.h index 81af3c3f..5ec1e3eb 100644 --- a/include/wlr/interfaces/wlr_tablet_pad.h +++ b/include/wlr/interfaces/wlr_tablet_pad.h @@ -1,5 +1,6 @@ -#ifndef _WLR_INTERFACES_TABLET_PAD_H -#define _WLR_INTERFACES_TABLET_PAD_H +#ifndef WLR_INTERFACES_WLR_TABLET_PAD_H +#define WLR_INTERFACES_WLR_TABLET_PAD_H + #include <wlr/types/wlr_tablet_pad.h> struct wlr_tablet_pad_impl { diff --git a/include/wlr/interfaces/wlr_tablet_tool.h b/include/wlr/interfaces/wlr_tablet_tool.h index 43a24fd0..347a0003 100644 --- a/include/wlr/interfaces/wlr_tablet_tool.h +++ b/include/wlr/interfaces/wlr_tablet_tool.h @@ -1,5 +1,6 @@ -#ifndef _WLR_INTERFACES_TABLET_TOOL_H -#define _WLR_INTERFACES_TABLET_TOOL_H +#ifndef WLR_INTERFACES_WLR_TABLET_TOOL_H +#define WLR_INTERFACES_WLR_TABLET_TOOL_H + #include <wlr/types/wlr_tablet_tool.h> struct wlr_tablet_tool_impl { diff --git a/include/wlr/interfaces/wlr_touch.h b/include/wlr/interfaces/wlr_touch.h index b5fcef18..63bac6b8 100644 --- a/include/wlr/interfaces/wlr_touch.h +++ b/include/wlr/interfaces/wlr_touch.h @@ -1,5 +1,6 @@ -#ifndef _WLR_INTERFACES_TOUCH_H -#define _WLR_INTERFACES_TOUCH_H +#ifndef WLR_INTERFACES_WLR_TOUCH_H +#define WLR_INTERFACES_WLR_TOUCH_H + #include <wlr/types/wlr_touch.h> struct wlr_touch_impl { diff --git a/include/wlr/render.h b/include/wlr/render.h index b7924928..325f8c01 100644 --- a/include/wlr/render.h +++ b/include/wlr/render.h @@ -1,5 +1,6 @@ -#ifndef _WLR_RENDER_H -#define _WLR_RENDER_H +#ifndef WLR_RENDER_H +#define WLR_RENDER_H + #include <stdint.h> #include <wayland-server-protocol.h> #include <wlr/types/wlr_output.h> diff --git a/include/wlr/render/gles2.h b/include/wlr/render/gles2.h index 4a944eb7..25e760d5 100644 --- a/include/wlr/render/gles2.h +++ b/include/wlr/render/gles2.h @@ -1,5 +1,6 @@ -#ifndef _WLR_GLES2_RENDERER_H -#define _WLR_GLES2_RENDERER_H +#ifndef WLR_RENDER_GLES2_H +#define WLR_RENDER_GLES2_H + #include <wlr/render.h> #include <wlr/backend.h> diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h index c00e0701..e3ba0414 100644 --- a/include/wlr/render/interface.h +++ b/include/wlr/render/interface.h @@ -1,5 +1,6 @@ -#ifndef _WLR_RENDER_INTERFACE_H -#define _WLR_RENDER_INTERFACE_H +#ifndef WLR_RENDER_INTERFACE_H +#define WLR_RENDER_INTERFACE_H + #include <wayland-server-protocol.h> #include <stdbool.h> #include <wlr/render.h> diff --git a/include/wlr/render/matrix.h b/include/wlr/render/matrix.h index 789f7341..177af4b3 100644 --- a/include/wlr/render/matrix.h +++ b/include/wlr/render/matrix.h @@ -1,5 +1,5 @@ -#ifndef _WLR_RENDER_MATRIX_H -#define _WLR_RENDER_MATRIX_H +#ifndef WLR_RENDER_MATRIX_H +#define WLR_RENDER_MATRIX_H #include <stdint.h> diff --git a/include/wlr/types/wlr_box.h b/include/wlr/types/wlr_box.h index e2b1ab4e..5b8b00c9 100644 --- a/include/wlr/types/wlr_box.h +++ b/include/wlr/types/wlr_box.h @@ -1,5 +1,6 @@ -#ifndef _WLR_TYPES_GEOMETRY_H -#define _WLR_TYPES_GEOMETRY_H +#ifndef WLR_TYPES_WLR_BOX_H +#define WLR_TYPES_WLR_BOX_H + #include <stdbool.h> struct wlr_box { diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h index 58a93760..b2f5a972 100644 --- a/include/wlr/types/wlr_compositor.h +++ b/include/wlr/types/wlr_compositor.h @@ -1,5 +1,6 @@ -#ifndef _EXAMPLE_COMPOSITOR_H -#define _EXAMPLE_COMPOSITOR_H +#ifndef WLR_TYPES_WLR_COMPOSITOR_H +#define WLR_TYPES_WLR_COMPOSITOR_H + #include <wayland-server.h> #include <wlr/render.h> @@ -22,4 +23,5 @@ struct wlr_compositor *wlr_compositor_create(struct wl_display *display, struct wlr_surface; void wl_compositor_surface_destroyed(struct wlr_compositor *wlr_compositor, struct wlr_surface *surface); + #endif diff --git a/include/wlr/types/wlr_cursor.h b/include/wlr/types/wlr_cursor.h index 5fc0ec76..e8c13b1d 100644 --- a/include/wlr/types/wlr_cursor.h +++ b/include/wlr/types/wlr_cursor.h @@ -1,5 +1,6 @@ -#ifndef _WLR_TYPES_CURSOR_H -#define _WLR_TYPES_CURSOR_H +#ifndef WLR_TYPES_WLR_CURSOR_H +#define WLR_TYPES_WLR_CURSOR_H + #include <wayland-server.h> #include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output_layout.h> @@ -11,7 +12,7 @@ struct wlr_cursor_state; struct wlr_cursor { struct wlr_cursor_state *state; - int x, y; + double x, y; struct { struct wl_signal motion; diff --git a/include/wlr/types/wlr_data_device_manager.h b/include/wlr/types/wlr_data_device_manager.h index d7ae46c8..500f8acd 100644 --- a/include/wlr/types/wlr_data_device_manager.h +++ b/include/wlr/types/wlr_data_device_manager.h @@ -1,5 +1,5 @@ -#ifndef _WLR_TYPES_DATA_DEVICE_MANAGER_H -#define _WLR_TYPES_DATA_DEVICE_MANAGER_H +#ifndef WLR_TYPES_WLR_DATA_DEVICE_MANAGER_H +#define WLR_TYPES_WLR_DATA_DEVICE_MANAGER_H #include <wayland-server.h> diff --git a/include/wlr/types/wlr_data_source.h b/include/wlr/types/wlr_data_source.h index 63b0fe2a..19834cb6 100644 --- a/include/wlr/types/wlr_data_source.h +++ b/include/wlr/types/wlr_data_source.h @@ -1,5 +1,5 @@ -#ifndef _WLR_TYPES_DATA_SOURCE_H -#define _WLR_TYPES_DATA_SOURCE_H +#ifndef WLR_TYPES_WLR_DATA_SOURCE_H +#define WLR_TYPES_WLR_DATA_SOURCE_H #include <wayland-server.h> #include <wlr/util/list.h> diff --git a/include/wlr/types/wlr_gamma_control.h b/include/wlr/types/wlr_gamma_control.h index 259c6474..96c9f545 100644 --- a/include/wlr/types/wlr_gamma_control.h +++ b/include/wlr/types/wlr_gamma_control.h @@ -1,5 +1,6 @@ -#ifndef _WLR_GAMMA_CONTROL_H -#define _WLR_GAMMA_CONTROL_H +#ifndef WLR_TYPES_WLR_GAMMA_CONTROL_H +#define WLR_TYPES_WLR_GAMMA_CONTROL_H + #include <wayland-server.h> struct wlr_gamma_control_manager { diff --git a/include/wlr/types/wlr_input_device.h b/include/wlr/types/wlr_input_device.h index 5a41ce9d..50b0fb88 100644 --- a/include/wlr/types/wlr_input_device.h +++ b/include/wlr/types/wlr_input_device.h @@ -1,5 +1,5 @@ -#ifndef _WLR_TYPES_INPUT_H -#define _WLR_TYPES_INPUT_H +#ifndef WLR_TYPES_WLR_INPUT_DEVICE_H +#define WLR_TYPES_WLR_INPUT_DEVICE_H enum wlr_button_state { WLR_BUTTON_RELEASED, diff --git a/include/wlr/types/wlr_keyboard.h b/include/wlr/types/wlr_keyboard.h index ce7d6659..3f5d0d0c 100644 --- a/include/wlr/types/wlr_keyboard.h +++ b/include/wlr/types/wlr_keyboard.h @@ -1,5 +1,6 @@ -#ifndef _WLR_TYPES_KEYBOARD_H -#define _WLR_TYPES_KEYBOARD_H +#ifndef WLR_TYPES_WLR_KEYBOARD_H +#define WLR_TYPES_WLR_KEYBOARD_H + #include <wayland-server.h> #include <stdint.h> diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index b70bd19e..3208acac 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -1,5 +1,6 @@ -#ifndef _WLR_TYPES_OUTPUT_H -#define _WLR_TYPES_OUTPUT_H +#ifndef WLR_TYPES_WLR_OUTPUT_H +#define WLR_TYPES_WLR_OUTPUT_H + #include <wayland-server.h> #include <wlr/util/list.h> #include <stdbool.h> diff --git a/include/wlr/types/wlr_output_layout.h b/include/wlr/types/wlr_output_layout.h index 1f4a96d5..fe09106f 100644 --- a/include/wlr/types/wlr_output_layout.h +++ b/include/wlr/types/wlr_output_layout.h @@ -1,5 +1,6 @@ -#ifndef _WLR_TYPES_OUTPUT_LAYOUT_H -#define _WLR_TYPES_OUTPUT_LAYOUT_H +#ifndef WLR_TYPES_WLR_OUTPUT_LAYOUT_H +#define WLR_TYPES_WLR_OUTPUT_LAYOUT_H + #include <wlr/types/wlr_output.h> #include <wayland-util.h> #include <stdbool.h> diff --git a/include/wlr/types/wlr_pointer.h b/include/wlr/types/wlr_pointer.h index 9153963a..a59d8817 100644 --- a/include/wlr/types/wlr_pointer.h +++ b/include/wlr/types/wlr_pointer.h @@ -1,5 +1,6 @@ -#ifndef _WLR_TYPES_POINTER_H -#define _WLR_TYPES_POINTER_H +#ifndef WLR_TYPES_WLR_POINTER_H +#define WLR_TYPES_WLR_POINTER_H + #include <wlr/types/wlr_input_device.h> #include <wayland-server.h> #include <stdint.h> diff --git a/include/wlr/types/wlr_region.h b/include/wlr/types/wlr_region.h index 9a64ac13..6d59ee5e 100644 --- a/include/wlr/types/wlr_region.h +++ b/include/wlr/types/wlr_region.h @@ -1,5 +1,5 @@ -#ifndef _WLR_TYPES_REGION_H -#define _WLR_TYPES_REGION_H +#ifndef WLR_TYPES_WLR_REGION_H +#define WLR_TYPES_WLR_REGION_H struct wl_resource; diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index 69f17b1e..0270ad4e 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -1,5 +1,8 @@ -#ifndef _WLR_TYPES_SEAT_H -#define _WLR_TYPES_SEAT_H +#ifndef WLR_TYPES_WLR_SEAT_H +#define WLR_TYPES_WLR_SEAT_H + +#include <wlr/types/wlr_surface.h> +#include <wlr/types/wlr_input_device.h> #include <wayland-server.h> /** @@ -19,13 +22,38 @@ struct wlr_seat_handle { struct wl_list link; }; +struct wlr_seat_pointer_state { + struct wlr_seat *wlr_seat; + struct wlr_seat_handle *focused_handle; + struct wlr_surface *focused_surface; + + struct wl_listener focus_surface_destroy_listener; + struct wl_listener focus_resource_destroy_listener; +}; + +struct wlr_seat_keyboard_state { + struct wlr_seat *wlr_seat; + struct wlr_seat_handle *focused_handle; + struct wlr_surface *focused_surface; + + int keymap_fd; + size_t keymap_size; + + struct wl_listener focus_surface_destroy_listener; + struct wl_listener focus_resource_destroy_listener; +}; + struct wlr_seat { struct wl_global *wl_global; + struct wl_display *display; struct wl_list handles; char *name; uint32_t capabilities; struct wlr_data_device *data_device; + struct wlr_seat_pointer_state pointer_state; + struct wlr_seat_keyboard_state keyboard_state; + struct { struct wl_signal client_bound; struct wl_signal client_unbound; @@ -54,11 +82,82 @@ struct wlr_seat_handle *wlr_seat_handle_for_client(struct wlr_seat *wlr_seat, * Updates the capabilities available on this seat. * Will automatically send them to all clients. */ -void wlr_seat_set_capabilities(struct wlr_seat *wlr_seat, uint32_t capabilities); +void wlr_seat_set_capabilities(struct wlr_seat *wlr_seat, + uint32_t capabilities); /** * Updates the name of this seat. * Will automatically send it to all clients. */ void wlr_seat_set_name(struct wlr_seat *wlr_seat, const char *name); +/** + * Whether or not the surface has pointer focus + */ +bool wlr_seat_pointer_surface_has_focus(struct wlr_seat *wlr_seat, + struct wlr_surface *surface); + +/** + * Send a pointer enter event to the given surface and consider it to be the + * focused surface for the pointer. This will send a leave event to the last + * surface that was entered. Coordinates for the enter event are surface-local. + */ +void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat, + struct wlr_surface *surface, double sx, double sy); + +/** + * Clear the focused surface for the pointer and leave all entered surfaces. + */ +void wlr_seat_pointer_clear_focus(struct wlr_seat *wlr_seat); + +/** + * Send a motion event to the surface with pointer focus. Coordinates for the + * motion event are surface-local. + */ +void wlr_seat_pointer_send_motion(struct wlr_seat *wlr_seat, uint32_t time, + double sx, double sy); + +/** + * Send a button event to the surface with pointer focus. Coordinates for the + * button event are surface-local. Returns the serial. + */ +uint32_t wlr_seat_pointer_send_button(struct wlr_seat *wlr_seat, uint32_t time, + uint32_t button, uint32_t state); + +void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time, + enum wlr_axis_orientation orientation, double value); + +/** + * Send a keyboard enter event to the given surface and consider it to be the + * focused surface for the keyboard. This will send a leave event to the last + * surface that was entered. Pass an array of currently pressed keys. + */ +void wlr_seat_keyboard_enter(struct wlr_seat *wlr_seat, + struct wlr_surface *surface, struct wl_array keys); + +/** + * Clear the focused surface for the keyboard and leave all entered surfaces. + */ +void wlr_seat_keyboard_clear_focus(struct wlr_seat *wlr_seat); + +/** + * Send a key event to the surface with keyboard focus. Returns the event + * serial. + */ +uint32_t wlr_seat_keyboard_send_key(struct wlr_seat *wlr_seat, uint32_t time, + uint32_t key, uint32_t state); + +/** + * Send the modifiers event to the surface with keyboard focus. Also sends the + * event to the surface with pointer focus. + */ +void wlr_seat_keyboard_send_modifiers(struct wlr_seat *wlr_seat, + uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, + uint32_t group); + +/** + * Set the keymap and send it to seat keyboard resources. + */ +void wlr_seat_keyboard_set_keymap(struct wlr_seat *wlr_seat, int keymap_fd, + size_t keymap_size); + #endif diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index f0765160..87d421e3 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -1,8 +1,10 @@ -#ifndef _WLR_TYPES_WLR_SURFACE_H -#define _WLR_TYPES_WLR_SURFACE_H +#ifndef WLR_TYPES_WLR_SURFACE_H +#define WLR_TYPES_WLR_SURFACE_H + #include <wayland-server.h> #include <pixman.h> #include <stdint.h> +#include <stdbool.h> struct wlr_frame_callback { struct wl_resource *resource; @@ -42,6 +44,7 @@ struct wlr_surface { struct { struct wl_signal commit; + struct wl_signal destroy; } signals; struct wl_list frame_callback_list; // wl_surface.frame @@ -69,4 +72,12 @@ void wlr_surface_get_matrix(struct wlr_surface *surface, const float (*projection)[16], const float (*transform)[16]); + +/** + * Set the lifetime role for this surface. Returns 0 on success or -1 if the + * role cannot be set. + */ +int wlr_surface_set_role(struct wlr_surface *surface, const char *role, + struct wl_resource *error_resource, uint32_t error_code); + #endif diff --git a/include/wlr/types/wlr_tablet_pad.h b/include/wlr/types/wlr_tablet_pad.h index 6c14c669..b747e6f1 100644 --- a/include/wlr/types/wlr_tablet_pad.h +++ b/include/wlr/types/wlr_tablet_pad.h @@ -1,5 +1,6 @@ -#ifndef _WLR_TYPES_TABLET_PAD_H -#define _WLR_TYPES_TABLET_PAD_H +#ifndef WLR_TYPES_WLR_TABLET_PAD_H +#define WLR_TYPES_WLR_TABLET_PAD_H + #include <wlr/types/wlr_input_device.h> #include <wayland-server.h> #include <stdint.h> diff --git a/include/wlr/types/wlr_tablet_tool.h b/include/wlr/types/wlr_tablet_tool.h index 9090828a..f04dfe15 100644 --- a/include/wlr/types/wlr_tablet_tool.h +++ b/include/wlr/types/wlr_tablet_tool.h @@ -1,5 +1,6 @@ -#ifndef _WLR_TYPES_TABLET_TOOL_H -#define _WLR_TYPES_TABLET_TOOL_H +#ifndef WLR_TYPES_TABLET_TOOL_H +#define WLR_TYPES_TABLET_TOOL_H + #include <wlr/types/wlr_input_device.h> #include <wayland-server.h> #include <stdint.h> diff --git a/include/wlr/types/wlr_touch.h b/include/wlr/types/wlr_touch.h index 1a27cad3..f1165c87 100644 --- a/include/wlr/types/wlr_touch.h +++ b/include/wlr/types/wlr_touch.h @@ -1,5 +1,6 @@ -#ifndef _WLR_TYPES_TOUCH_H -#define _WLR_TYPES_TOUCH_H +#ifndef WLR_TYPES_WLR_TOUCH_H +#define WLR_TYPES_WLR_TOUCH_H + #include <wayland-server.h> #include <stdint.h> diff --git a/include/wlr/types/wlr_wl_shell.h b/include/wlr/types/wlr_wl_shell.h index a085711b..1443bbf0 100644 --- a/include/wlr/types/wlr_wl_shell.h +++ b/include/wlr/types/wlr_wl_shell.h @@ -1,5 +1,6 @@ -#ifndef _WLR_WL_SHELL_H -#define _WLR_WL_SHELL_H +#ifndef WLR_TYPES_WLR_WL_SHELL_H +#define WLR_TYPES_WLR_WL_SHELL_H + #include <wayland-server.h> struct wlr_wl_shell { diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h index 41cf483a..cc52d9c7 100644 --- a/include/wlr/types/wlr_xdg_shell_v6.h +++ b/include/wlr/types/wlr_xdg_shell_v6.h @@ -1,24 +1,175 @@ -#ifndef _WLR_XDG_SHELL_V6_H -#define _WLR_XDG_SHELL_V6_H +#ifndef WLR_TYPES_WLR_XDG_SHELL_V6_H +#define WLR_TYPES_WLR_XDG_SHELL_V6_H + +#include <wlr/types/wlr_box.h> #include <wayland-server.h> struct wlr_xdg_shell_v6 { struct wl_global *wl_global; - struct wl_list wl_resources; - struct wl_list surfaces; + struct wl_list clients; + uint32_t ping_timeout; + + struct { + struct wl_signal new_surface; + } events; void *data; }; +struct wlr_xdg_client_v6 { + struct wlr_xdg_shell_v6 *shell; + struct wl_resource *resource; + struct wl_client *client; + struct wl_list surfaces; + + struct wl_list link; // wlr_xdg_shell_v6::clients + + uint32_t ping_serial; + struct wl_event_source *ping_timer; +}; + + +enum wlr_xdg_surface_v6_role { + WLR_XDG_SURFACE_V6_ROLE_NONE, + WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL, + WLR_XDG_SURFACE_V6_ROLE_POPUP, +}; + +struct wlr_xdg_toplevel_v6_state { + bool maximized; + bool fullscreen; + bool resizing; + bool activated; + + uint32_t width; + uint32_t height; + + uint32_t max_width; + uint32_t max_height; + + uint32_t min_width; + uint32_t min_height; +}; + +struct wlr_xdg_toplevel_v6 { + struct wl_resource *resource; + struct wlr_xdg_surface_v6 *base; + 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 current; +}; + +// TODO split up into toplevel and popup configure +struct wlr_xdg_surface_v6_configure { + struct wl_list link; // wlr_xdg_surface_v6::configure_list + uint32_t serial; + struct wlr_xdg_toplevel_v6_state state; +}; + struct wlr_xdg_surface_v6 { + struct wlr_xdg_client_v6 *client; struct wl_resource *resource; - struct wl_resource *surface; - struct wl_list link; + struct wlr_surface *surface; + struct wl_list link; // wlr_xdg_client_v6::surfaces + enum wlr_xdg_surface_v6_role role; + struct wlr_xdg_toplevel_v6 *toplevel_state; + + bool configured; + struct wl_event_source *configure_idle; + struct wl_list configure_list; + + char *title; + char *app_id; + + bool has_next_geometry; + struct wlr_box *next_geometry; + struct wlr_box *geometry; + + struct wl_listener surface_destroy_listener; + struct wl_listener surface_commit_listener; + + struct { + struct wl_signal commit; + struct wl_signal destroy; + struct wl_signal ack_configure; + struct wl_signal ping_timeout; + + struct wl_signal request_minimize; + struct wl_signal request_move; + struct wl_signal request_resize; + struct wl_signal request_show_window_menu; + } events; void *data; }; +struct wlr_xdg_toplevel_v6_move_event { + struct wl_client *client; + struct wlr_xdg_surface_v6 *surface; + struct wlr_seat_handle *seat_handle; + uint32_t serial; +}; + +struct wlr_xdg_toplevel_v6_resize_event { + struct wl_client *client; + struct wlr_xdg_surface_v6 *surface; + struct wlr_seat_handle *seat_handle; + uint32_t serial; + uint32_t edges; +}; + +struct wlr_xdg_toplevel_v6_show_window_menu_event { + struct wl_client *client; + struct wlr_xdg_surface_v6 *surface; + struct wlr_seat_handle *seat_handle; + uint32_t serial; + uint32_t x; + uint32_t y; +}; + struct wlr_xdg_shell_v6 *wlr_xdg_shell_v6_create(struct wl_display *display); void wlr_xdg_shell_v6_destroy(struct wlr_xdg_shell_v6 *xdg_shell); +/** + * Send a ping to the surface. If the surface does not respond in a reasonable + * amount of time, the ping_timeout event will be emitted. + */ +void wlr_xdg_surface_v6_ping(struct wlr_xdg_surface_v6 *surface); + +/** + * Request that this toplevel surface be the given size. + */ +void wlr_xdg_toplevel_v6_set_size(struct wlr_xdg_surface_v6 *surface, + uint32_t width, uint32_t height); + +/** + * Request that this toplevel surface show itself in an activated or deactivated + * state. + */ +void wlr_xdg_toplevel_v6_set_activated(struct wlr_xdg_surface_v6 *surface, + bool activated); + +/** + * Request that this toplevel surface consider itself maximized or not + * maximized. + */ +void wlr_xdg_toplevel_v6_set_maximized(struct wlr_xdg_surface_v6 *surface, + bool maximized); + +/** + * Request that this toplevel surface consider itself fullscreen or not + * fullscreen. + */ +void wlr_xdg_toplevel_v6_set_fullscreen(struct wlr_xdg_surface_v6 *surface, + bool fullscreen); + +/** + * Request that this toplevel surface consider itself to be resizing or not + * resizing. + */ +void wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface, + bool resizing); + #endif diff --git a/include/wlr/util/list.h b/include/wlr/util/list.h index 6e746ec4..02039d89 100644 --- a/include/wlr/util/list.h +++ b/include/wlr/util/list.h @@ -1,5 +1,5 @@ -#ifndef _WLR_UTIL_LIST_H -#define _WLR_UTIL_LIST_H +#ifndef WLR_UTIL_LIST_H +#define WLR_UTIL_LIST_H #include <stddef.h> diff --git a/include/wlr/util/log.h b/include/wlr/util/log.h index 2acaa2ed..3de2cacf 100644 --- a/include/wlr/util/log.h +++ b/include/wlr/util/log.h @@ -1,5 +1,6 @@ -#ifndef _WLR_UTIL_LOG_H -#define _WLR_UTIL_LOG_H +#ifndef WLR_UTIL_LOG_H +#define WLR_UTIL_LOG_H + #include <stdbool.h> #include <stdarg.h> #include <string.h> diff --git a/include/wlr/xcursor.h b/include/wlr/xcursor.h index ae07b4fa..c12d5405 100644 --- a/include/wlr/xcursor.h +++ b/include/wlr/xcursor.h @@ -27,8 +27,10 @@ * This is adapted from wayland-cursor, but with the wl_shm client stuff removed * so we can use it on the compositor, too. */ -#ifndef _WLR_XCURSOR_H -#define _WLR_XCURSOR_H + +#ifndef WLR_XCURSOR_H +#define WLR_XCURSOR_H + #include <stdint.h> struct wlr_xcursor_image { diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h index a0fb34ce..41b8042f 100644 --- a/include/wlr/xwayland.h +++ b/include/wlr/xwayland.h @@ -1,5 +1,6 @@ -#ifndef _WLR_XWAYLAND_H -#define _WLR_XWAYLAND_H +#ifndef WLR_XWAYLAND_H +#define WLR_XWAYLAND_H + #include <time.h> #include <stdbool.h> #include <wlr/types/wlr_compositor.h> |