[PATCH 3/3] compositor: create cursor in the middle of screen

Tiago Vignatti tiago.vignatti at intel.com
Fri Aug 19 05:06:22 PDT 2011


Although it's happening in the shared compositor code, only drm backend
benefits from this. Now it's prettier :)

Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
---
 compositor/compositor.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/compositor/compositor.c b/compositor/compositor.c
index b2342b4..6a7ee23 100644
--- a/compositor/compositor.c
+++ b/compositor/compositor.c
@@ -1597,6 +1597,8 @@ WL_EXPORT void
 wlsc_input_device_init(struct wlsc_input_device *device,
 		       struct wlsc_compositor *ec)
 {
+	int width, height;
+
 	wl_input_device_init(&device->input_device, &ec->compositor);
 
 	device->input_device.object.interface = &wl_input_device_interface;
@@ -1605,6 +1607,13 @@ wlsc_input_device_init(struct wlsc_input_device *device,
 	wl_display_add_object(ec->wl_display, &device->input_device.object);
 	wl_display_add_global(ec->wl_display, &device->input_device.object, NULL);
 
+	width = container_of(ec->output_list.prev, struct wlsc_output,
+	                     link)->current->width;
+	height = container_of(ec->output_list.prev, struct wlsc_output,
+	                      link)->current->height;
+	device->input_device.x = width / 2;
+	device->input_device.y = height / 2;
+
 	device->sprite = wlsc_surface_create(ec,
 					     device->input_device.x,
 					     device->input_device.y, 32, 32);
-- 
1.7.2.2



More information about the wayland-devel mailing list