implement wl client cursor support...as clients

<zmike> super funny idea: for client cursors, what if we just implement them as an override client with no animations and then hide the canvas cursor while the client is visible?

this started as a joke and it worked mostly fine so I improved it and now it's shipping and whatdoidowithallthesebugs.jpg
This commit is contained in:
Mike Blumenkrantz 2015-02-06 18:28:11 -05:00
parent 8399ec5d6f
commit 903b9beaed
2 changed files with 31 additions and 1 deletions

View File

@ -199,6 +199,18 @@ _e_comp_wl_evas_cb_mouse_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob
if (!(ec = data)) return;
if (ec->cur_mouse_action) return;
/* FIXME? this is a hack to just reset the cursor whenever we mouse out. not sure if accurate */
{
Evas_Object *o;
ecore_evas_cursor_get(e_comp->ee, &o, NULL, NULL, NULL);
if (e_comp->pointer->o_ptr != o)
{
ecore_evas_cursor_unset(e_comp->ee);
ecore_evas_object_cursor_set(e_comp->ee, e_comp->pointer->o_ptr,
EVAS_LAYER_MAX, e_comp->pointer->hot.x, e_comp->pointer->hot.y);
}
}
if (e_object_is_del(E_OBJECT(ec))) return;
if (!ec->comp_data->surface) return;

View File

@ -27,12 +27,30 @@ _e_comp_wl_input_cb_resource_destroy(struct wl_client *client EINA_UNUSED, struc
}
static void
_e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource EINA_UNUSED, uint32_t serial EINA_UNUSED, struct wl_resource *surface_resource EINA_UNUSED, int32_t x EINA_UNUSED, int32_t y EINA_UNUSED)
_e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resource *resource EINA_UNUSED, uint32_t serial EINA_UNUSED, struct wl_resource *surface_resource, int32_t x, int32_t y)
{
E_Comp_Data *cdata;
pid_t pid;
E_Client *ec;
uint64_t sid;
/* get compositor data */
if (!(cdata = wl_resource_get_user_data(resource))) return;
wl_client_get_credentials(client, &pid, NULL, NULL);
sid = e_comp_wl_id_get(wl_resource_get_id(surface_resource), pid);
if (!(ec = e_pixmap_find_client(E_PIXMAP_TYPE_WL, sid)))
{
ec = e_client_new(NULL, e_pixmap_new(E_PIXMAP_TYPE_WL, sid), 1, 0);
ec->layer_block = ec->visible = ec->override = 1;
ec->new_client = 0;
ec->icccm.title = eina_stringshare_add("noshadow");
evas_object_pass_events_set(ec->frame, 1);
ec->client.w = ec->client.h = 1;
}
/* ignore cursor changes during resize/move I guess */
if (e_client_action_get()) return;
ecore_evas_cursor_unset(e_comp->ee);
ecore_evas_object_cursor_set(e_comp->ee, ec->frame, EVAS_LAYER_MAX, x, y);
}
static const struct wl_pointer_interface _e_pointer_interface =