compositor: Disable hw cursor if we're texturing the cursor
This commit is contained in:
@@ -172,16 +172,20 @@ drm_output_prepare_scanout_surface(struct wlsc_output *output_base,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
drm_output_set_cursor(struct wlsc_output *output_base,
|
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_output *output = (struct drm_output *) output_base;
|
||||||
struct drm_compositor *c =
|
struct drm_compositor *c =
|
||||||
(struct drm_compositor *) output->base.compositor;
|
(struct drm_compositor *) output->base.compositor;
|
||||||
struct wlsc_input_device *eid = (struct wlsc_input_device *) input;
|
|
||||||
EGLint handle, stride;
|
EGLint handle, stride;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
pixman_region32_t cursor_region;
|
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,
|
pixman_region32_init_rect(&cursor_region,
|
||||||
eid->sprite->x, eid->sprite->y,
|
eid->sprite->x, eid->sprite->y,
|
||||||
eid->sprite->width, eid->sprite->height);
|
eid->sprite->width, eid->sprite->height);
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ wayland_output_prepare_scanout_surface(struct wlsc_output *output_base,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
wayland_output_set_cursor(struct wlsc_output *output_base,
|
wayland_output_set_cursor(struct wlsc_output *output_base,
|
||||||
struct wl_input_device *input)
|
struct wlsc_input_device *input)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ x11_output_prepare_scanout_surface(struct wlsc_output *output_base,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
x11_output_set_cursor(struct wlsc_output *output_base,
|
x11_output_set_cursor(struct wlsc_output *output_base,
|
||||||
struct wl_input_device *input)
|
struct wlsc_input_device *input)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-9
@@ -671,9 +671,8 @@ wlsc_output_repaint(struct wlsc_output *output)
|
|||||||
{
|
{
|
||||||
struct wlsc_compositor *ec = output->compositor;
|
struct wlsc_compositor *ec = output->compositor;
|
||||||
struct wlsc_surface *es;
|
struct wlsc_surface *es;
|
||||||
struct wlsc_input_device *eid;
|
struct wlsc_input_device *eid, *hw_cursor;
|
||||||
pixman_region32_t new_damage, total_damage;
|
pixman_region32_t new_damage, total_damage;
|
||||||
int using_hardware_cursor = 1;
|
|
||||||
|
|
||||||
output->prepare_render(output);
|
output->prepare_render(output);
|
||||||
|
|
||||||
@@ -696,15 +695,18 @@ wlsc_output_repaint(struct wlsc_output *output)
|
|||||||
&output->previous_damage_region);
|
&output->previous_damage_region);
|
||||||
pixman_region32_copy(&output->previous_damage_region, &new_damage);
|
pixman_region32_copy(&output->previous_damage_region, &new_damage);
|
||||||
|
|
||||||
if (ec->focus)
|
hw_cursor = NULL;
|
||||||
if (output->set_hardware_cursor(output, ec->input_device) < 0)
|
if (ec->focus && ec->fade.spring.current < 0.001) {
|
||||||
using_hardware_cursor = 0;
|
hw_cursor = (struct wlsc_input_device *) ec->input_device;
|
||||||
if (ec->fade.spring.current > 0.001)
|
if (output->set_hardware_cursor(output, hw_cursor) < 0)
|
||||||
using_hardware_cursor = 0;
|
hw_cursor = NULL;
|
||||||
|
} else {
|
||||||
|
output->set_hardware_cursor(output, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
es = container_of(ec->surface_list.next, struct wlsc_surface, link);
|
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) {
|
if (output->prepare_scanout_surface(output, es) == 0) {
|
||||||
/* We're drawing nothing now,
|
/* We're drawing nothing now,
|
||||||
* draw the damaged regions later. */
|
* draw the damaged regions later. */
|
||||||
@@ -742,7 +744,7 @@ wlsc_output_repaint(struct wlsc_output *output)
|
|||||||
if (ec->focus)
|
if (ec->focus)
|
||||||
wl_list_for_each(eid, &ec->input_device_list, link) {
|
wl_list_for_each(eid, &ec->input_device_list, link) {
|
||||||
if (&eid->input_device != ec->input_device ||
|
if (&eid->input_device != ec->input_device ||
|
||||||
!using_hardware_cursor)
|
eid != hw_cursor)
|
||||||
wlsc_surface_draw(eid->sprite, output,
|
wlsc_surface_draw(eid->sprite, output,
|
||||||
&total_damage);
|
&total_damage);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ struct wlsc_transform {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct wlsc_surface;
|
struct wlsc_surface;
|
||||||
|
struct wlsc_input_device;
|
||||||
|
|
||||||
struct wlsc_output {
|
struct wlsc_output {
|
||||||
struct wl_object object;
|
struct wl_object object;
|
||||||
@@ -69,7 +70,7 @@ struct wlsc_output {
|
|||||||
int (*prepare_scanout_surface)(struct wlsc_output *output,
|
int (*prepare_scanout_surface)(struct wlsc_output *output,
|
||||||
struct wlsc_surface *es);
|
struct wlsc_surface *es);
|
||||||
int (*set_hardware_cursor)(struct wlsc_output *output,
|
int (*set_hardware_cursor)(struct wlsc_output *output,
|
||||||
struct wl_input_device *input);
|
struct wlsc_input_device *input);
|
||||||
};
|
};
|
||||||
|
|
||||||
enum wlsc_pointer_type {
|
enum wlsc_pointer_type {
|
||||||
|
|||||||
Reference in New Issue
Block a user