forked from enlightenment/enlightenment
apply formatting rules to e_comp_wl_data.c
This commit is contained in:
parent
bfd204be71
commit
9dd36ff01c
|
@ -97,13 +97,15 @@ data_source_notify_finish(E_Comp_Wl_Data_Source *source)
|
|||
|
||||
if (source->offer->in_ask &&
|
||||
wl_resource_get_version(source->resource) >=
|
||||
WL_DATA_SOURCE_ACTION_SINCE_VERSION) {
|
||||
WL_DATA_SOURCE_ACTION_SINCE_VERSION)
|
||||
{
|
||||
wl_data_source_send_action(source->resource,
|
||||
source->current_dnd_action);
|
||||
}
|
||||
|
||||
if (wl_resource_get_version(source->resource) >=
|
||||
WL_DATA_SOURCE_DND_FINISHED_SINCE_VERSION) {
|
||||
WL_DATA_SOURCE_DND_FINISHED_SINCE_VERSION)
|
||||
{
|
||||
wl_data_source_send_dnd_finished(source->resource);
|
||||
}
|
||||
|
||||
|
@ -117,10 +119,13 @@ data_offer_choose_action(E_Comp_Wl_Data_Offer *offer)
|
|||
uint32_t source_actions, offer_actions;
|
||||
|
||||
if (wl_resource_get_version(offer->resource) >=
|
||||
WL_DATA_OFFER_ACTION_SINCE_VERSION) {
|
||||
WL_DATA_OFFER_ACTION_SINCE_VERSION)
|
||||
{
|
||||
offer_actions = offer->dnd_actions;
|
||||
preferred_action = offer->preferred_dnd_action;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
offer_actions = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY;
|
||||
}
|
||||
|
||||
|
@ -181,7 +186,8 @@ data_offer_set_actions(struct wl_client *client,
|
|||
{
|
||||
E_Comp_Wl_Data_Offer *offer = wl_resource_get_user_data(resource);
|
||||
|
||||
if (dnd_actions & ~ALL_ACTIONS) {
|
||||
if (dnd_actions & ~ALL_ACTIONS)
|
||||
{
|
||||
wl_resource_post_error(offer->resource,
|
||||
WL_DATA_OFFER_ERROR_INVALID_ACTION_MASK,
|
||||
"invalid action mask %x", dnd_actions);
|
||||
|
@ -190,7 +196,8 @@ data_offer_set_actions(struct wl_client *client,
|
|||
|
||||
if (preferred_action &&
|
||||
(!(preferred_action & dnd_actions) ||
|
||||
__builtin_popcount(preferred_action) > 1)) {
|
||||
__builtin_popcount(preferred_action) > 1))
|
||||
{
|
||||
wl_resource_post_error(offer->resource,
|
||||
WL_DATA_OFFER_ERROR_INVALID_ACTION,
|
||||
"invalid action %x", preferred_action);
|
||||
|
@ -214,20 +221,23 @@ data_offer_finish(struct wl_client *client, struct wl_resource *resource)
|
|||
* if the negotiation is not at the right stage
|
||||
*/
|
||||
if ( //offer->source->seat ||
|
||||
!offer->source->accepted) {
|
||||
!offer->source->accepted)
|
||||
{
|
||||
wl_resource_post_error(offer->resource,
|
||||
WL_DATA_OFFER_ERROR_INVALID_FINISH,
|
||||
"premature finish request");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (offer->source->current_dnd_action) {
|
||||
switch (offer->source->current_dnd_action)
|
||||
{
|
||||
case WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE:
|
||||
case WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK:
|
||||
wl_resource_post_error(offer->resource,
|
||||
WL_DATA_OFFER_ERROR_INVALID_OFFER,
|
||||
"offer finished with an invalid action");
|
||||
return;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -254,11 +264,14 @@ _e_comp_wl_data_offer_cb_resource_destroy(struct wl_resource *resource)
|
|||
* we still want the version >=3 drag source to be happy.
|
||||
*/
|
||||
if (wl_resource_get_version(offer->resource) <
|
||||
WL_DATA_OFFER_ACTION_SINCE_VERSION) {
|
||||
WL_DATA_OFFER_ACTION_SINCE_VERSION)
|
||||
{
|
||||
data_source_notify_finish(offer->source);
|
||||
} else if (offer->source->resource &&
|
||||
}
|
||||
else if (offer->source->resource &&
|
||||
wl_resource_get_version(offer->source->resource) >=
|
||||
WL_DATA_SOURCE_DND_FINISHED_SINCE_VERSION) {
|
||||
WL_DATA_SOURCE_DND_FINISHED_SINCE_VERSION)
|
||||
{
|
||||
wl_data_source_send_cancelled(offer->source->resource);
|
||||
}
|
||||
|
||||
|
@ -320,14 +333,16 @@ data_source_set_actions(struct wl_client *client,
|
|||
E_Comp_Wl_Data_Source *source =
|
||||
wl_resource_get_user_data(resource);
|
||||
|
||||
if (source->actions_set) {
|
||||
if (source->actions_set)
|
||||
{
|
||||
wl_resource_post_error(source->resource,
|
||||
WL_DATA_SOURCE_ERROR_INVALID_ACTION_MASK,
|
||||
"cannot set actions more than once");
|
||||
return;
|
||||
}
|
||||
|
||||
if (dnd_actions & ~ALL_ACTIONS) {
|
||||
if (dnd_actions & ~ALL_ACTIONS)
|
||||
{
|
||||
wl_resource_post_error(source->resource,
|
||||
WL_DATA_SOURCE_ERROR_INVALID_ACTION_MASK,
|
||||
"invalid action mask %x", dnd_actions);
|
||||
|
@ -672,7 +687,8 @@ _e_comp_wl_data_device_cb_selection_set(struct wl_client *client EINA_UNUSED, st
|
|||
DBG("Data Device Selection Set");
|
||||
if (!source_resource) return;
|
||||
if (!(source = wl_resource_get_user_data(source_resource))) return;
|
||||
if (source->actions_set) {
|
||||
if (source->actions_set)
|
||||
{
|
||||
wl_resource_post_error(source_resource,
|
||||
WL_DATA_SOURCE_ERROR_INVALID_SOURCE,
|
||||
"cannot set drag-and-drop source as selection");
|
||||
|
@ -710,7 +726,6 @@ _e_comp_wl_data_manager_cb_device_get(struct wl_client *client, struct wl_resour
|
|||
|
||||
DBG("Data Manager Device Get");
|
||||
|
||||
|
||||
/* try to create the data device resource */
|
||||
res = wl_resource_create(client, &wl_data_device_interface, wl_resource_get_version(manager_resource), id);
|
||||
if (!res)
|
||||
|
@ -816,7 +831,6 @@ _e_comp_wl_clipboard_source_save(void *data EINA_UNUSED, Ecore_Fd_Handler *handl
|
|||
char *p;
|
||||
int len, size;
|
||||
|
||||
|
||||
if (!(source = (E_Comp_Wl_Clipboard_Source *)e_comp_wl->clipboard.source))
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
|
||||
|
@ -968,7 +982,6 @@ e_comp_wl_data_device_send_enter(E_Client *ec)
|
|||
if (wl_resource_get_version(offer_res) >= WL_DATA_OFFER_SOURCE_ACTIONS_SINCE_VERSION)
|
||||
wl_data_offer_send_source_actions(offer_res, drag_source->dnd_actions);
|
||||
}
|
||||
|
||||
}
|
||||
e_comp_wl->selection.target = ec;
|
||||
evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_DEL,
|
||||
|
@ -1258,3 +1271,4 @@ e_comp_wl_clipboard_source_unref(E_Comp_Wl_Clipboard_Source *source)
|
|||
wl_array_release(&source->contents);
|
||||
free(source);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue