mirror of
https://github.com/swaywm/sway.git
synced 2025-11-22 06:59:48 -05:00
Implement pointer-constraints-unstable-v1
This commit is contained in:
parent
5cb3d4769c
commit
cedde21c96
8 changed files with 262 additions and 25 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#define _SWAY_INPUT_CURSOR_H
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <wlr/types/wlr_pointer_constraints_v1.h>
|
||||
#include <wlr/types/wlr_surface.h>
|
||||
#include "sway/input/seat.h"
|
||||
|
||||
|
|
@ -26,6 +27,9 @@ struct sway_cursor {
|
|||
struct wlr_surface *image_surface;
|
||||
int hotspot_x, hotspot_y;
|
||||
|
||||
struct wlr_pointer_constraint_v1 *active_constraint;
|
||||
pixman_region32_t confine; // invalid if active_constraint == NULL
|
||||
|
||||
struct wl_listener motion;
|
||||
struct wl_listener motion_absolute;
|
||||
struct wl_listener button;
|
||||
|
|
@ -43,6 +47,8 @@ struct sway_cursor {
|
|||
|
||||
struct wl_listener request_set_cursor;
|
||||
|
||||
struct wl_listener constraint_commit;
|
||||
|
||||
struct wl_event_source *hide_source;
|
||||
bool hidden;
|
||||
|
||||
|
|
@ -75,7 +81,8 @@ int cursor_get_timeout(struct sway_cursor *cursor);
|
|||
* Like cursor_rebase, but also allows focus to change when the cursor enters a
|
||||
* new container.
|
||||
*/
|
||||
void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec);
|
||||
void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec,
|
||||
struct sway_node *node, struct wlr_surface *surface, double sx, double sy);
|
||||
|
||||
void dispatch_cursor_button(struct sway_cursor *cursor,
|
||||
struct wlr_input_device *device, uint32_t time_msec, uint32_t button,
|
||||
|
|
@ -97,6 +104,10 @@ void cursor_warp_to_container(struct sway_cursor *cursor,
|
|||
void cursor_warp_to_workspace(struct sway_cursor *cursor,
|
||||
struct sway_workspace *workspace);
|
||||
|
||||
|
||||
void sway_cursor_constrain(struct sway_cursor *cursor,
|
||||
struct wlr_pointer_constraint_v1 *constraint);
|
||||
|
||||
uint32_t get_mouse_bindsym(const char *name, char **error);
|
||||
|
||||
uint32_t get_mouse_bindcode(const char *name, char **error);
|
||||
|
|
|
|||
|
|
@ -84,6 +84,12 @@ struct sway_seat {
|
|||
struct wl_list link; // input_manager::seats
|
||||
};
|
||||
|
||||
struct sway_pointer_constraint {
|
||||
struct wlr_pointer_constraint_v1 *constraint;
|
||||
|
||||
struct wl_listener destroy;
|
||||
};
|
||||
|
||||
struct sway_seat *seat_create(const char *seat_name);
|
||||
|
||||
void seat_destroy(struct sway_seat *seat);
|
||||
|
|
|
|||
|
|
@ -61,6 +61,9 @@ struct sway_server {
|
|||
|
||||
struct wlr_presentation *presentation;
|
||||
|
||||
struct wlr_pointer_constraints_v1 *pointer_constraints;
|
||||
struct wl_listener pointer_constraint;
|
||||
|
||||
size_t txn_timeout_ms;
|
||||
list_t *transactions;
|
||||
list_t *dirty_nodes;
|
||||
|
|
@ -86,5 +89,6 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data);
|
|||
#endif
|
||||
void handle_server_decoration(struct wl_listener *listener, void *data);
|
||||
void handle_xdg_decoration(struct wl_listener *listener, void *data);
|
||||
void handle_pointer_constraint(struct wl_listener *listener, void *data);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue