[PATCH weston 2/4] input: Add a weston_pointer_output_center
Rob Bradford
robert.bradford at intel.com
Mon Jun 10 07:17:29 PDT 2013
From: Rob Bradford <rob at linux.intel.com>
Centre the pointer on a the provided output. This function provides the
basis of ensuring that the pointer starts on the output when we start to
constrain a seat to a given output.
---
src/compositor.h | 3 +++
src/input.c | 8 ++++++++
2 files changed, 11 insertions(+)
diff --git a/src/compositor.h b/src/compositor.h
index 22700b7..d2ca844 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -333,6 +333,9 @@ weston_pointer_start_grab(struct weston_pointer *pointer,
struct weston_pointer_grab *grab);
void
weston_pointer_end_grab(struct weston_pointer *pointer);
+void
+weston_pointer_output_center(struct weston_pointer *pointer,
+ struct weston_output *output);
struct weston_keyboard *
weston_keyboard_create(void);
diff --git a/src/input.c b/src/input.c
index d299d98..7c7aa95 100644
--- a/src/input.c
+++ b/src/input.c
@@ -473,6 +473,14 @@ weston_pointer_set_focus(struct weston_pointer *pointer,
}
WL_EXPORT void
+weston_pointer_output_center(struct weston_pointer *pointer,
+ struct weston_output *output)
+{
+ pointer->x = wl_fixed_from_int(output->x + output->width / 2);
+ pointer->y = wl_fixed_from_int(output->y + output->height / 2);
+}
+
+WL_EXPORT void
weston_keyboard_set_focus(struct weston_keyboard *keyboard,
struct weston_surface *surface)
{
--
1.8.1.4
More information about the wayland-devel
mailing list