aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-09-21 19:54:59 -0400
committerGitHub <noreply@github.com>2017-09-21 19:54:59 -0400
commitf296cc7dbad4855810e53e67de63daf8976a1795 (patch)
treed42c678034e82d78c2f5f92fda73ee208a4c1b8e /include
parentec1e6fe568816e573896264726da2a9c1ff784c9 (diff)
parentd558745633e83b47e08f362f44164f3965dac2f7 (diff)
Merge pull request #149 from acrisci/feature/wlr-seat-pointer
wlr-seat pointer events
Diffstat (limited to 'include')
-rw-r--r--include/wlr/types/wlr_cursor.h2
-rw-r--r--include/wlr/types/wlr_seat.h50
2 files changed, 50 insertions, 2 deletions
diff --git a/include/wlr/types/wlr_cursor.h b/include/wlr/types/wlr_cursor.h
index 5fc0ec76..88390e0d 100644
--- a/include/wlr/types/wlr_cursor.h
+++ b/include/wlr/types/wlr_cursor.h
@@ -11,7 +11,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_seat.h b/include/wlr/types/wlr_seat.h
index 69f17b1e..4b433ccb 100644
--- a/include/wlr/types/wlr_seat.h
+++ b/include/wlr/types/wlr_seat.h
@@ -1,5 +1,7 @@
#ifndef _WLR_TYPES_SEAT_H
#define _WLR_TYPES_SEAT_H
+#include <wlr/types/wlr_surface.h>
+#include <wlr/types/wlr_input_device.h>
#include <wayland-server.h>
/**
@@ -19,13 +21,25 @@ 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 {
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 {
struct wl_signal client_bound;
struct wl_signal client_unbound;
@@ -54,11 +68,45 @@ 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.
+ */
+void wlr_seat_pointer_send_button(struct wlr_seat *wlr_seat, uint32_t time,
+ uint32_t button, uint32_t state);
+
#endif