Implement pointer constraints v1 protocol

This commit is contained in:
Las 2018-04-19 18:11:08 +02:00
parent 8e32c4a1fb
commit 020edf5b49
7 changed files with 116 additions and 17 deletions

View file

@ -1,6 +1,7 @@
#ifndef _SWAY_INPUT_CURSOR_H
#define _SWAY_INPUT_CURSOR_H
#include <stdint.h>
#include <wlr/types/wlr_pointer_constraints_v1.h>
#include "sway/input/seat.h"
struct sway_cursor {
@ -8,6 +9,9 @@ struct sway_cursor {
struct wlr_cursor *cursor;
struct wlr_xcursor_manager *xcursor_manager;
struct wlr_box *mapped_box;
bool locked;
struct wl_client *image_client;
struct wl_listener motion;
@ -33,4 +37,15 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time);
void dispatch_cursor_button(struct sway_cursor *cursor, uint32_t time_msec,
uint32_t button, enum wlr_button_state state);
void cursor_handle_constraint_inactive(
struct wl_listener *listener,
struct wlr_pointer_constraint_v1 *constraint);
void cursor_handle_constraint_active(
struct wl_listener *listener,
struct wlr_pointer_constraint_v1_activation *activation);
void cursor_handle_request_constraint(struct wl_listener *listener,
struct wlr_pointer_constraint_v1 *constraint);
#endif

View file

@ -7,6 +7,7 @@
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_layer_shell.h>
#include <wlr/types/wlr_pointer_constraints_v1.h>
#include <wlr/types/wlr_xdg_shell_v6.h>
#include <wlr/render/wlr_renderer.h>
// TODO WLR: make Xwayland optional
@ -39,6 +40,11 @@ struct sway_server {
struct wlr_wl_shell *wl_shell;
struct wl_listener wl_shell_surface;
struct wlr_pointer_constraints_v1 *pointer_constraints;
struct wl_listener constraint_active;
struct wl_listener constraint_inactive;
struct wl_listener request_constraint;
};
struct sway_server server;

View file

@ -168,6 +168,8 @@ void view_close(struct sway_view *view);
void view_damage(struct sway_view *view, bool whole);
void view_get_layout_box(struct sway_view *view, struct wlr_box *box);
void view_for_each_surface(struct sway_view *view,
wlr_surface_iterator_func_t iterator, void *user_data);