summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2011-05-06 14:04:21 -0400
committerKristian Høgsberg <krh@bitplanet.net>2011-05-06 14:04:21 -0400
commite4c40a4734b8bc3acdfc95e8efe002f36f65cd9e (patch)
treee1a417e1df3f1086faf3660bccfcef4c2f8ec146
parent4d07a1c213d5b3396b9e140c139e9a6423400947 (diff)
compositor: Disable hw cursor if we're texturing the cursor
-rw-r--r--compositor/compositor-drm.c8
-rw-r--r--compositor/compositor-wayland.c2
-rw-r--r--compositor/compositor-x11.c2
-rw-r--r--compositor/compositor.c20
-rw-r--r--compositor/compositor.h3
5 files changed, 21 insertions, 14 deletions
diff --git a/compositor/compositor-drm.c b/compositor/compositor-drm.c
index eb452abd..f7ce0bf1 100644
--- a/compositor/compositor-drm.c
+++ b/compositor/compositor-drm.c
@@ -172,16 +172,20 @@ drm_output_prepare_scanout_surface(struct wlsc_output *output_base,
static int
drm_output_set_cursor(struct wlsc_output *output_base,
- struct wl_input_device *input)
+ struct wlsc_input_device *eid)
{
struct drm_output *output = (struct drm_output *) output_base;
struct drm_compositor *c =
(struct drm_compositor *) output->base.compositor;
- struct wlsc_input_device *eid = (struct wlsc_input_device *) input;
EGLint handle, stride;
int ret = -1;
pixman_region32_t cursor_region;
+ if (eid == NULL) {
+ drmModeSetCursor(c->drm.fd, output->crtc_id, 0, 0, 0);
+ return 0;
+ }
+
pixman_region32_init_rect(&cursor_region,
eid->sprite->x, eid->sprite->y,
eid->sprite->width, eid->sprite->height);
diff --git a/compositor/compositor-wayland.c b/compositor/compositor-wayland.c
index 37a9d66b..b99edf0b 100644
--- a/compositor/compositor-wayland.c
+++ b/compositor/compositor-wayland.c
@@ -204,7 +204,7 @@ wayland_output_prepare_scanout_surface(struct wlsc_output *output_base,
static int
wayland_output_set_cursor(struct wlsc_output *output_base,
- struct wl_input_device *input)
+ struct wlsc_input_device *input)
{
return -1;
}
diff --git a/compositor/compositor-x11.c b/compositor/compositor-x11.c
index 0c4505c4..d7bebed8 100644
--- a/compositor/compositor-x11.c
+++ b/compositor/compositor-x11.c
@@ -200,7 +200,7 @@ x11_output_prepare_scanout_surface(struct wlsc_output *output_base,
static int
x11_output_set_cursor(struct wlsc_output *output_base,
- struct wl_input_device *input)
+ struct wlsc_input_device *input)
{
return -1;
}
diff --git a/compositor/compositor.c b/compositor/compositor.c
index 22bb9a82..7a950df5 100644
--- a/compositor/compositor.c
+++ b/compositor/compositor.c
@@ -671,9 +671,8 @@ wlsc_output_repaint(struct wlsc_output *output)
{
struct wlsc_compositor *ec = output->compositor;
struct wlsc_surface *es;
- struct wlsc_input_device *eid;
+ struct wlsc_input_device *eid, *hw_cursor;
pixman_region32_t new_damage, total_damage;
- int using_hardware_cursor = 1;
output->prepare_render(output);
@@ -696,15 +695,18 @@ wlsc_output_repaint(struct wlsc_output *output)
&output->previous_damage_region);
pixman_region32_copy(&output->previous_damage_region, &new_damage);
- if (ec->focus)
- if (output->set_hardware_cursor(output, ec->input_device) < 0)
- using_hardware_cursor = 0;
- if (ec->fade.spring.current > 0.001)
- using_hardware_cursor = 0;
+ hw_cursor = NULL;
+ if (ec->focus && ec->fade.spring.current < 0.001) {
+ hw_cursor = (struct wlsc_input_device *) ec->input_device;
+ if (output->set_hardware_cursor(output, hw_cursor) < 0)
+ hw_cursor = NULL;
+ } else {
+ output->set_hardware_cursor(output, NULL);
+ }
es = container_of(ec->surface_list.next, struct wlsc_surface, link);
- if (es->visual == &ec->compositor.rgb_visual && using_hardware_cursor) {
+ if (es->visual == &ec->compositor.rgb_visual && hw_cursor) {
if (output->prepare_scanout_surface(output, es) == 0) {
/* We're drawing nothing now,
* draw the damaged regions later. */
@@ -742,7 +744,7 @@ wlsc_output_repaint(struct wlsc_output *output)
if (ec->focus)
wl_list_for_each(eid, &ec->input_device_list, link) {
if (&eid->input_device != ec->input_device ||
- !using_hardware_cursor)
+ eid != hw_cursor)
wlsc_surface_draw(eid->sprite, output,
&total_damage);
}
diff --git a/compositor/compositor.h b/compositor/compositor.h
index 93de7930..3c5459d3 100644
--- a/compositor/compositor.h
+++ b/compositor/compositor.h
@@ -51,6 +51,7 @@ struct wlsc_transform {
};
struct wlsc_surface;
+struct wlsc_input_device;
struct wlsc_output {
struct wl_object object;
@@ -69,7 +70,7 @@ struct wlsc_output {
int (*prepare_scanout_surface)(struct wlsc_output *output,
struct wlsc_surface *es);
int (*set_hardware_cursor)(struct wlsc_output *output,
- struct wl_input_device *input);
+ struct wlsc_input_device *input);
};
enum wlsc_pointer_type {