{
E_Comp_Wl_Data_Source *sel_source;
struct wl_resource *offer_res, *data_device_res, *focus = NULL;
- struct wl_client *source_client = NULL, *sel_client = NULL, *cbhm_client = NULL;
+ struct wl_client *source_client = NULL, *sel_client = NULL, *cbhm_client = NULL, *secondary_selection_client = NULL;
sel_source = (E_Comp_Wl_Data_Source*)e_comp_wl->selection.data_source;
sel_client = wl_resource_get_client(sel_source->resource);
if (e_comp_wl->selection.cbhm)
cbhm_client = wl_resource_get_client(e_comp_wl->selection.cbhm);
+ if (e_comp_wl->selection.secondary)
+ secondary_selection_client = wl_resource_get_client(e_comp_wl->selection.secondary);
if ((sel_source) &&
(sel_client == source_client) &&
if (e_comp_wl->kbd.enabled)
focus = e_comp_wl->kbd.focus;
- //if source is from cbhm_client do not crate data offer for cbhm
+ //if source is from cbhm_client do not create data offer for cbhm
if ((cbhm_client) && (source_client != cbhm_client))
{
data_device_res =
data_device_res);
wl_data_device_send_selection(data_device_res, offer_res);
}
+
+ if (secondary_selection_client)
+ {
+ if (secondary_selection_client != source_client)
+ {
+ data_device_res = e_comp_wl_data_find_for_client(secondary_selection_client);
+ if ((data_device_res) && (source))
+ {
+ offer_res =
+ _e_comp_wl_data_device_data_offer_create(source, data_device_res);
+ wl_data_device_send_selection(data_device_res, offer_res);
+ }
+ }
+ }
}
else
{
if (e_comp_wl->selection.cbhm == surface->base.surface)
e_comp_wl->selection.cbhm = NULL;
+ if (e_comp_wl->selection.secondary == surface->base.surface)
+ e_comp_wl->selection.secondary = NULL;
+
if (surface->base.viewport_transform)
{
e_client_transform_core_remove(surface->ec, surface->base.viewport_transform);
}
E_FREE_FUNC(_kvm_del_hook, e_client_hook_del);
E_FREE(_kvm_service);
+
+ e_comp_wl->selection.secondary = NULL;
}
static void
EINTERN Eina_Bool
e_service_kvm_secondary_selection_set(E_Client *ec, Eina_Bool set)
{
+ E_Comp_Wl_Client_Data *cdata;
EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(_kvm_service, EINA_FALSE);
ELOGF("KVM", "secondary selection set requested!, set:%d", ec, set);
- //TODO: set as secondary selection
+ cdata = e_client_cdata_get(ec);
+ if (set)
+ {
+ if (!cdata) return EINA_FALSE;
+ e_comp_wl->selection.secondary = cdata->surface;
+ }
+ else
+ {
+ if (!cdata || e_comp_wl->selection.secondary == cdata->surface)
+ e_comp_wl->selection.secondary = NULL;
+ else
+ return EINA_FALSE;
+ }
return EINA_TRUE;
}