return 0;
}
+static int
+drm_output_set_cursor(struct weston_output *output_base,
+ struct weston_input_device *eid);
+
+static void
+weston_output_set_cursor(struct weston_output *output,
+ struct weston_input_device *device,
+ pixman_region32_t *overlap)
+{
+ pixman_region32_t cursor_region;
+ int prior_was_hardware;
+
+ if (device->sprite == NULL)
+ return;
+
+ pixman_region32_init(&cursor_region);
+ pixman_region32_intersect(&cursor_region,
+ &device->sprite->transform.boundingbox,
+ &output->region);
+
+ if (!pixman_region32_not_empty(&cursor_region)) {
+ drm_output_set_cursor(output, NULL);
+ goto out;
+ }
+
+ prior_was_hardware = device->hw_cursor;
+ if (pixman_region32_not_empty(overlap) ||
+ drm_output_set_cursor(output, device) < 0) {
+ if (prior_was_hardware) {
+ weston_surface_damage(device->sprite);
+ drm_output_set_cursor(output, NULL);
+ }
+ device->hw_cursor = 0;
+ } else {
+ if (!prior_was_hardware)
+ weston_surface_damage_below(device->sprite);
+ pixman_region32_fini(&device->sprite->damage);
+ pixman_region32_init(&device->sprite->damage);
+ device->hw_cursor = 1;
+ }
+
+out:
+ pixman_region32_fini(&cursor_region);
+}
+
static void
drm_assign_planes(struct weston_output *output)
{
struct weston_compositor *ec = output->compositor;
struct weston_surface *es;
pixman_region32_t overlap, surface_overlap;
+ struct weston_input_device *device;
/*
* Find a surface for each sprite in the output using some heuristics:
pixman_region32_intersect(&surface_overlap, &overlap,
&es->transform.boundingbox);
- if (!drm_output_prepare_overlay_surface(output, es,
- &surface_overlap)) {
+ device = (struct weston_input_device *) ec->input_device;
+ if (es == device->sprite) {
+ weston_output_set_cursor(output, device,
+ &surface_overlap);
+
+ if (!device->hw_cursor)
+ pixman_region32_union(&overlap, &overlap,
+ &es->transform.boundingbox);
+ } else if (!drm_output_prepare_overlay_surface(output, es,
+ &surface_overlap)) {
pixman_region32_fini(&es->damage);
pixman_region32_init(&es->damage);
} else {
output->pending_fs_surf_fb_id = 0;
output->base.repaint = drm_output_repaint;
- output->base.set_hardware_cursor = drm_output_set_cursor;
output->base.destroy = drm_output_destroy;
output->base.assign_planes = drm_assign_planes;
return;
}
-static int
-wayland_output_set_cursor(struct weston_output *output_base,
- struct weston_input_device *input)
-{
- return -1;
-}
-
static void
wayland_output_destroy(struct weston_output *output_base)
{
wl_shell_surface_set_toplevel(output->parent.shell_surface);
output->base.repaint = wayland_output_repaint;
- output->base.set_hardware_cursor = wayland_output_set_cursor;
output->base.destroy = wayland_output_destroy;
output->base.assign_planes = NULL;
return 1;
}
-static int
-x11_output_set_cursor(struct weston_output *output_base,
- struct weston_input_device *input)
-{
- return -1;
-}
-
static void
x11_output_destroy(struct weston_output *output_base)
{
wl_event_loop_add_timer(loop, finish_frame_handler, output);
output->base.repaint = x11_output_repaint;
- output->base.set_hardware_cursor = x11_output_set_cursor;
output->base.destroy = x11_output_destroy;
output->base.assign_planes = NULL;
}
}
-static void
+WL_EXPORT void
weston_surface_damage_below(struct weston_surface *surface)
{
struct weston_surface *below;
}
}
-static void
-weston_output_set_cursor(struct weston_output *output,
- struct wl_input_device *dev)
-{
- struct weston_input_device *device =
- (struct weston_input_device *) dev;
- pixman_region32_t cursor_region;
- int prior_was_hardware;
-
- if (device->sprite == NULL)
- return;
-
- pixman_region32_init(&cursor_region);
- pixman_region32_intersect(&cursor_region,
- &device->sprite->transform.boundingbox,
- &output->region);
-
- if (!pixman_region32_not_empty(&cursor_region)) {
- output->set_hardware_cursor(output, NULL);
- goto out;
- }
-
- prior_was_hardware = device->hw_cursor;
- if (device->sprite->overlapped ||
- output->set_hardware_cursor(output, device) < 0) {
- if (prior_was_hardware) {
- weston_surface_damage(device->sprite);
- output->set_hardware_cursor(output, NULL);
- }
- device->hw_cursor = 0;
- } else {
- if (!prior_was_hardware)
- weston_surface_damage_below(device->sprite);
- pixman_region32_fini(&device->sprite->damage);
- pixman_region32_init(&device->sprite->damage);
- device->hw_cursor = 1;
- }
-
-out:
- pixman_region32_fini(&cursor_region);
-}
-
struct weston_frame_callback {
struct wl_resource resource;
struct wl_list link;
*/
output->assign_planes(output);
- weston_output_set_cursor(output, ec->input_device);
-
wl_list_for_each(es, &ec->surface_list, link) {
pixman_region32_subtract(&es->damage, &es->damage, &opaque);
pixman_region32_union(&new_damage, &new_damage, &es->damage);
struct wl_list mode_list;
void (*repaint)(struct weston_output *output);
- int (*set_hardware_cursor)(struct weston_output *output,
- struct weston_input_device *input);
void (*destroy)(struct weston_output *output);
void (*assign_planes)(struct weston_output *output);
};
weston_surface_damage(struct weston_surface *surface);
void
+weston_surface_damage_below(struct weston_surface *surface);
+
+void
weston_buffer_post_release(struct wl_buffer *buffer);
uint32_t