From: Kristian Høgsberg Date: Fri, 6 May 2011 18:04:21 +0000 (-0400) Subject: compositor: Disable hw cursor if we're texturing the cursor X-Git-Tag: 0.85.0~476 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e4c40a4734b8bc3acdfc95e8efe002f36f65cd9e;p=platform%2Fupstream%2Fweston.git compositor: Disable hw cursor if we're texturing the cursor --- diff --git a/compositor/compositor-drm.c b/compositor/compositor-drm.c index eb452ab..f7ce0bf 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 37a9d66..b99edf0 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 0c4505c..d7bebed 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 22bb9a8..7a950df 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 93de793..3c5459d 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 {