discomfitor pushed a commit to branch master.
commit 74baabb0344e7d015531784640ca4d323b1608c4
Author: Mike Blumenkrantz <[email protected]>
Date: Wed Jun 12 07:40:43 2013 +0100
add drop handler "hidden" flag to block drops
---
src/bin/e_dnd.c | 73 ++++++++++++++++++++++++++-------------------------------
src/bin/e_dnd.h | 5 ++--
2 files changed, 36 insertions(+), 42 deletions(-)
diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c
index ccb472d..c8c06b0 100644
--- a/src/bin/e_dnd.c
+++ b/src/bin/e_dnd.c
@@ -69,6 +69,34 @@ static Eina_Stringshare **_e_dnd_types[] =
static Eina_Hash *_drop_handlers_responsives;
static Ecore_X_Atom _action;
+static void
+_e_drop_handler_active_check(E_Drop_Handler *h, const E_Drag *drag,
Eina_Stringshare *type)
+{
+ unsigned int i, j;
+
+ if (h->hidden) return;
+ for (i = 0; i < h->num_types; i++)
+ {
+ if (drag)
+ {
+ for (j = 0; j < drag->num_types; j++)
+ {
+ if (h->types[i] != drag->types[j]) continue;
+ h->active = 1;
+ h->active_type = eina_stringshare_ref(h->types[i]);
+ return;
+ }
+ }
+ else
+ {
+ if (h->types[i] != type) continue;
+ h->active = 1;
+ h->active_type = eina_stringshare_ref(h->types[i]);
+ return;
+ }
+ }
+}
+
/* externally accessible functions */
EINTERN int
@@ -254,24 +282,11 @@ e_drag_start(E_Drag *drag, int x, int y)
_active_handlers = eina_list_free(_active_handlers);
EINA_LIST_FOREACH(_drop_handlers, l, h)
{
- unsigned int i, j;
Eina_Bool active = h->active;
h->active = 0;
eina_stringshare_replace(&h->active_type, NULL);
- for (i = 0; i < h->num_types; i++)
- {
- for (j = 0; j < drag->num_types; j++)
- {
- if (h->types[i] == drag->types[j])
- {
- h->active = 1;
- h->active_type = eina_stringshare_ref(h->types[i]);
- break;
- }
- }
- if (h->active) break;
- }
+ _e_drop_handler_active_check(h, drag, NULL);
if (h->active != active)
{
if (h->active)
@@ -318,24 +333,11 @@ e_drag_xdnd_start(E_Drag *drag, int x, int y)
_active_handlers = eina_list_free(_active_handlers);
EINA_LIST_FOREACH(_drop_handlers, l, h)
{
- unsigned int i, j;
Eina_Bool active = h->active;
h->active = 0;
eina_stringshare_replace(&h->active_type, NULL);
- for (i = 0; i < h->num_types; i++)
- {
- for (j = 0; j < drag->num_types; j++)
- {
- if (h->types[i] == drag->types[j])
- {
- h->active = 1;
- h->active_type = eina_stringshare_ref(h->types[i]);
- break;
- }
- }
- if (h->active) break;
- }
+ _e_drop_handler_active_check(h, drag, NULL);
if (h->active != active)
{
if (h->active)
@@ -1175,7 +1177,6 @@ _e_dnd_cb_event_dnd_enter(void *data __UNUSED__, int type
__UNUSED__, void *even
E_Drop_Handler *h;
const char *id;
const Eina_List *l;
- unsigned int j;
int i;
id = e_util_winid_str_get(ev->win);
@@ -1197,17 +1198,9 @@ _e_dnd_cb_event_dnd_enter(void *data __UNUSED__, int
type __UNUSED__, void *even
_xdnd->type = t;
EINA_LIST_FOREACH(_drop_handlers, l, h)
{
- for (j = 0; j < h->num_types; j++)
- {
- if (h->types[j] == _xdnd->type)
- {
- h->active = 1;
- h->active_type = eina_stringshare_ref(_xdnd->type);
- _active_handlers = eina_list_append(_active_handlers,
h);
- break;
- }
- }
-
+ _e_drop_handler_active_check(h, NULL, _xdnd->type);
+ if (h->active)
+ _active_handlers = eina_list_append(_active_handlers, h);
h->entered = 0;
}
break;
diff --git a/src/bin/e_dnd.h b/src/bin/e_dnd.h
index f59bcb3..37614b6 100644
--- a/src/bin/e_dnd.h
+++ b/src/bin/e_dnd.h
@@ -69,9 +69,10 @@ struct _E_Drop_Handler
Evas_Object *base;
int x, y, w, h;
- unsigned char active : 1;
- unsigned char entered : 1;
const char *active_type;
+ Eina_Bool active : 1;
+ Eina_Bool entered : 1;
+ Eina_Bool hidden : 1;
unsigned int num_types;
Eina_Stringshare *types[];
};
--
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev