diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/backend/headless.h | 2 | ||||
-rw-r--r-- | include/backend/libinput.h | 2 | ||||
-rw-r--r-- | include/backend/x11.h | 4 | ||||
-rw-r--r-- | include/rootston/desktop.h | 4 | ||||
-rw-r--r-- | include/rootston/seat.h | 9 | ||||
-rw-r--r-- | include/wlr/backend.h | 2 | ||||
-rw-r--r-- | include/wlr/types/wlr_compositor.h | 6 | ||||
-rw-r--r-- | include/wlr/types/wlr_cursor.h | 2 | ||||
-rw-r--r-- | include/wlr/types/wlr_input_inhibitor.h | 25 | ||||
-rw-r--r-- | include/wlr/types/wlr_output.h | 7 | ||||
-rw-r--r-- | include/wlr/types/wlr_output_layout.h | 7 | ||||
-rw-r--r-- | include/wlr/types/wlr_seat.h | 3 | ||||
-rw-r--r-- | include/wlr/types/wlr_surface.h | 22 | ||||
-rw-r--r-- | include/wlr/types/wlr_wl_shell.h | 10 | ||||
-rw-r--r-- | include/wlr/types/wlr_xdg_output.h | 32 | ||||
-rw-r--r-- | include/wlr/types/wlr_xdg_shell.h | 12 | ||||
-rw-r--r-- | include/wlr/types/wlr_xdg_shell_v6.h | 12 |
17 files changed, 132 insertions, 29 deletions
diff --git a/include/backend/headless.h b/include/backend/headless.h index e130bae1..add4c4e8 100644 --- a/include/backend/headless.h +++ b/include/backend/headless.h @@ -4,6 +4,8 @@ #include <wlr/backend/headless.h> #include <wlr/backend/interface.h> +#define HEADLESS_DEFAULT_REFRESH (60 * 1000) // 60 Hz + struct wlr_headless_backend { struct wlr_backend backend; struct wlr_egl egl; diff --git a/include/backend/libinput.h b/include/backend/libinput.h index f828c310..4eee7eb8 100644 --- a/include/backend/libinput.h +++ b/include/backend/libinput.h @@ -29,6 +29,8 @@ struct wlr_libinput_input_device { struct libinput_device *handle; }; +uint32_t usec_to_msec(uint64_t usec); + void wlr_libinput_event(struct wlr_libinput_backend *state, struct libinput_event *event); diff --git a/include/backend/x11.h b/include/backend/x11.h index 33c9a427..1c88cefc 100644 --- a/include/backend/x11.h +++ b/include/backend/x11.h @@ -12,6 +12,8 @@ #define XCB_EVENT_RESPONSE_TYPE_MASK 0x7f +#define X11_DEFAULT_REFRESH (60 * 1000) // 60 Hz + struct wlr_x11_backend; struct wlr_x11_output { @@ -79,6 +81,8 @@ const struct wlr_input_device_impl input_device_impl; bool x11_handle_input_event(struct wlr_x11_backend *x11, xcb_generic_event_t *event); +void x11_update_pointer_position(struct wlr_x11_output *output, + xcb_timestamp_t time); void x11_output_handle_configure_notify(struct wlr_x11_output *output, xcb_configure_notify_event_t *event); diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h index c1dcad56..f150147b 100644 --- a/include/rootston/desktop.h +++ b/include/rootston/desktop.h @@ -6,6 +6,7 @@ #include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_gamma_control.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> @@ -47,6 +48,7 @@ struct roots_desktop { 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; @@ -57,6 +59,8 @@ struct roots_desktop { struct wl_listener wl_shell_surface; struct wl_listener layer_shell_surface; struct wl_listener decoration_new; + struct wl_listener input_inhibit_activate; + struct wl_listener input_inhibit_deactivate; #ifdef WLR_HAS_XWAYLAND struct wlr_xwayland *xwayland; diff --git a/include/rootston/seat.h b/include/rootston/seat.h index 6f482723..d2ef90f3 100644 --- a/include/rootston/seat.h +++ b/include/rootston/seat.h @@ -19,6 +19,9 @@ struct roots_seat { // If the focused layer is set, views cannot receive keyboard focus struct wlr_layer_surface *focused_layer; + // If non-null, only this client can receive input events + struct wl_client *exclusive_client; + struct wl_list views; // roots_seat_view::link bool has_focus; @@ -125,4 +128,10 @@ void roots_drag_icon_update_position(struct roots_drag_icon *icon); void roots_drag_icon_damage_whole(struct roots_drag_icon *icon); +void roots_seat_set_exclusive_client(struct roots_seat *seat, + struct wl_client *client); + +bool roots_seat_allow_input(struct roots_seat *seat, + struct wl_resource *resource); + #endif diff --git a/include/wlr/backend.h b/include/wlr/backend.h index e3b14add..f5482e04 100644 --- a/include/wlr/backend.h +++ b/include/wlr/backend.h @@ -46,6 +46,4 @@ struct wlr_egl *wlr_backend_get_egl(struct wlr_backend *backend); */ struct wlr_renderer *wlr_backend_get_renderer(struct wlr_backend *backend); -uint32_t usec_to_msec(uint64_t usec); - #endif diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h index 11bfac71..922d7c0f 100644 --- a/include/wlr/types/wlr_compositor.h +++ b/include/wlr/types/wlr_compositor.h @@ -4,6 +4,8 @@ #include <wayland-server.h> #include <wlr/render/wlr_renderer.h> +struct wlr_surface; + struct wlr_compositor { struct wl_global *wl_global; struct wl_list wl_resources; @@ -22,4 +24,8 @@ void wlr_compositor_destroy(struct wlr_compositor *wlr_compositor); struct wlr_compositor *wlr_compositor_create(struct wl_display *display, struct wlr_renderer *renderer); +bool wlr_surface_is_subsurface(struct wlr_surface *surface); + +struct wlr_subsurface *wlr_subsurface_from_surface(struct wlr_surface *surface); + #endif diff --git a/include/wlr/types/wlr_cursor.h b/include/wlr/types/wlr_cursor.h index 0883f3ca..b764e6d2 100644 --- a/include/wlr/types/wlr_cursor.h +++ b/include/wlr/types/wlr_cursor.h @@ -54,6 +54,8 @@ struct wlr_cursor { struct wl_signal tablet_tool_tip; struct wl_signal tablet_tool_button; } events; + + void *data; }; struct wlr_cursor *wlr_cursor_create(); diff --git a/include/wlr/types/wlr_input_inhibitor.h b/include/wlr/types/wlr_input_inhibitor.h new file mode 100644 index 00000000..4416c18f --- /dev/null +++ b/include/wlr/types/wlr_input_inhibitor.h @@ -0,0 +1,25 @@ +#ifndef WLR_TYPES_INPUT_INHIBITOR_H +#define WLR_TYPES_INPUT_INHIBITOR_H +#include <wayland-server.h> + +struct wlr_input_inhibit_manager { + struct wl_global *wl_global; + struct wl_client *active_client; + struct wl_resource *active_inhibitor; + + struct wl_listener display_destroy; + + struct { + struct wl_signal activate; // struct wlr_input_inhibit_manager * + struct wl_signal deactivate; // struct wlr_input_inhibit_manager * + } events; + + void *data; +}; + +struct wlr_input_inhibit_manager *wlr_input_inhibit_manager_create( + struct wl_display *display); +void wlr_input_inhibit_manager_destroy( + struct wlr_input_inhibit_manager *manager); + +#endif diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index b838a737..cc03452d 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -112,8 +112,15 @@ struct wlr_surface; void wlr_output_enable(struct wlr_output *output, bool enable); void wlr_output_create_global(struct wlr_output *output); void wlr_output_destroy_global(struct wlr_output *output); +/** + * Sets the output mode. + */ bool wlr_output_set_mode(struct wlr_output *output, struct wlr_output_mode *mode); +/** + * Sets a custom mode on the output. If modes are available, they are preferred. + * Setting `refresh` to zero lets the backend pick a preferred value. + */ bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width, int32_t height, int32_t refresh); void wlr_output_set_transform(struct wlr_output *output, diff --git a/include/wlr/types/wlr_output_layout.h b/include/wlr/types/wlr_output_layout.h index 3c150fc0..ccb2cd61 100644 --- a/include/wlr/types/wlr_output_layout.h +++ b/include/wlr/types/wlr_output_layout.h @@ -17,6 +17,8 @@ struct wlr_output_layout { struct wl_signal change; struct wl_signal destroy; } events; + + void *data; }; struct wlr_output_layout_output_state; @@ -32,6 +34,11 @@ struct wlr_output_layout_output { } events; }; +/** + * Creates a wlr_output_layout, which can be used to describing outputs in + * physical space relative to one another, and perform various useful operations + * on that state. + */ struct wlr_output_layout *wlr_output_layout_create(); void wlr_output_layout_destroy(struct wlr_output_layout *layout); diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index 34105cf0..ff907f97 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -537,6 +537,7 @@ bool wlr_seat_touch_has_grab(struct wlr_seat *seat); */ bool wlr_seat_validate_grab_serial(struct wlr_seat *seat, uint32_t serial); -struct wlr_seat_client *wlr_seat_client_from_resource(struct wl_resource *resource); +struct wlr_seat_client *wlr_seat_client_from_resource( + struct wl_resource *resource); #endif diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index 4d03df73..380e5e03 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -122,20 +122,24 @@ void wlr_surface_make_subsurface(struct wlr_surface *surface, struct wlr_surface *parent, uint32_t id); /** - * Get the top of the subsurface tree for this surface. + * Get the root of the subsurface tree for this surface. */ -struct wlr_surface *wlr_surface_get_main_surface(struct wlr_surface *surface); +struct wlr_surface *wlr_surface_get_root_surface(struct wlr_surface *surface); /** - * Find a subsurface within this surface at the surface-local coordinates. - * Returns the surface and coordinates in the topmost surface coordinate system - * or NULL if no subsurface is found at that location. + * Check if the surface accepts input events at the given surface-local + * coordinates. Does not check the surface's subsurfaces. */ -struct wlr_subsurface *wlr_surface_subsurface_at(struct wlr_surface *surface, - double sx, double sy, double *sub_x, double *sub_y); +bool wlr_surface_point_accepts_input(struct wlr_surface *surface, + double sx, double sy); -bool wlr_surface_point_accepts_input( - struct wlr_surface *surface, double sx, double sy); +/** + * Find a surface in this surface's tree that accepts input events at the given + * surface-local coordinates. Returns the surface and coordinates in the leaf + * surface coordinate system or NULL if no surface is found at that location. + */ +struct wlr_surface *wlr_surface_surface_at(struct wlr_surface *surface, + double sx, double sy, double *sub_x, double *sub_y); void wlr_surface_send_enter(struct wlr_surface *surface, struct wlr_output *output); diff --git a/include/wlr/types/wlr_wl_shell.h b/include/wlr/types/wlr_wl_shell.h index 63b1a837..89e950c9 100644 --- a/include/wlr/types/wlr_wl_shell.h +++ b/include/wlr/types/wlr_wl_shell.h @@ -142,13 +142,13 @@ void wlr_wl_shell_surface_configure(struct wlr_wl_shell_surface *surface, enum wl_shell_surface_resize edges, int32_t width, int32_t height); /** - * Find a popup within this surface at the surface-local coordinates. Returns - * the popup and coordinates in the topmost surface coordinate system or NULL if - * no popup is found at that location. + * Find a surface within this wl-shell surface tree at the given surface-local + * coordinates. Returns the surface and coordinates in the leaf surface + * coordinate system or NULL if no surface is found at that location. */ -struct wlr_wl_shell_surface *wlr_wl_shell_surface_popup_at( +struct wlr_surface *wlr_wl_shell_surface_surface_at( struct wlr_wl_shell_surface *surface, double sx, double sy, - double *popup_sx, double *popup_sy); + double *sub_sx, double *sub_sy); bool wlr_surface_is_wl_shell_surface(struct wlr_surface *surface); diff --git a/include/wlr/types/wlr_xdg_output.h b/include/wlr/types/wlr_xdg_output.h new file mode 100644 index 00000000..27dad2b8 --- /dev/null +++ b/include/wlr/types/wlr_xdg_output.h @@ -0,0 +1,32 @@ +#ifndef WLR_TYPES_WLR_XDG_OUTPUT_H +#define WLR_TYPES_WLR_XDG_OUTPUT_H +#include <wayland-server.h> +#include <wlr/types/wlr_output_layout.h> + +struct wlr_xdg_output { + struct wl_list link; + struct wl_list resources; + + struct wlr_xdg_output_manager *manager; + struct wlr_output_layout_output *layout_output; + + struct wl_listener destroy; +}; + +struct wlr_xdg_output_manager { + struct wl_global *global; + + struct wlr_output_layout *layout; + + struct wl_list outputs; + + struct wl_listener layout_add; + struct wl_listener layout_change; + struct wl_listener layout_destroy; +}; + +struct wlr_xdg_output_manager *wlr_xdg_output_manager_create( + struct wl_display *display, struct wlr_output_layout *layout); +void wlr_xdg_output_manager_destroy(struct wlr_xdg_output_manager *manager); + +#endif diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h index b779017f..29b54dba 100644 --- a/include/wlr/types/wlr_xdg_shell.h +++ b/include/wlr/types/wlr_xdg_shell.h @@ -215,19 +215,19 @@ uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_surface *surface, void wlr_xdg_surface_send_close(struct wlr_xdg_surface *surface); /** - * Compute the popup position in surface-local coordinates. + * Compute the popup position in its parent's surface-local coordinate system. */ void wlr_xdg_surface_popup_get_position(struct wlr_xdg_surface *surface, double *popup_sx, double *popup_sy); /** - * Find a popup within this surface at the surface-local coordinates. Returns - * the popup and coordinates in the topmost surface coordinate system or NULL if - * no popup is found at that location. + * Find a surface within this xdg-surface tree at the given surface-local + * coordinates. Returns the surface and coordinates in the leaf surface + * coordinate system or NULL if no surface is found at that location. */ -struct wlr_xdg_surface *wlr_xdg_surface_popup_at( +struct wlr_surface *wlr_xdg_surface_surface_at( struct wlr_xdg_surface *surface, double sx, double sy, - double *popup_sx, double *popup_sy); + double *sub_x, double *sub_y); bool wlr_surface_is_xdg_surface(struct wlr_surface *surface); diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h index 04c1f324..b646f3fe 100644 --- a/include/wlr/types/wlr_xdg_shell_v6.h +++ b/include/wlr/types/wlr_xdg_shell_v6.h @@ -233,19 +233,19 @@ uint32_t wlr_xdg_toplevel_v6_set_resizing(struct wlr_xdg_surface_v6 *surface, void wlr_xdg_surface_v6_send_close(struct wlr_xdg_surface_v6 *surface); /** - * Compute the popup position in surface-local coordinates. + * Compute the popup position in its parent's surface-local coordinate system. */ void wlr_xdg_surface_v6_popup_get_position(struct wlr_xdg_surface_v6 *surface, double *popup_sx, double *popup_sy); /** - * Find a popup within this surface at the surface-local coordinates. Returns - * the popup and coordinates in the topmost surface coordinate system or NULL if - * no popup is found at that location. + * Find a surface within this xdg-surface tree at the given surface-local + * coordinates. Returns the surface and coordinates in the leaf surface + * coordinate system or NULL if no surface is found at that location. */ -struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6_popup_at( +struct wlr_surface *wlr_xdg_surface_v6_surface_at( struct wlr_xdg_surface_v6 *surface, double sx, double sy, - double *popup_sx, double *popup_sy); + double *sub_x, double *sub_y); /** * Get the geometry for this positioner based on the anchor rect, gravity, and |