Remove MAX, it is not useful for app. developers.

Signed-off-by: Sanjeev BA <eflelev8@gmail.com>

SVN revision: 68291
This commit is contained in:
Sanjeev BA 2012-02-23 02:52:07 +00:00 committed by Sanjeev BA
parent c373a26208
commit c4c2e2bdea
2 changed files with 28 additions and 24 deletions

View File

@ -324,7 +324,7 @@ static Cnp_Atom atoms[CNP_N_ATOMS] = {
},
};
static Cnp_Selection selections[ELM_SEL_TYPE_MAX] = {
static Cnp_Selection selections[ELM_SEL_TYPE_CLIPBOARD + 1] = {
ARRAYINIT(ELM_SEL_TYPE_PRIMARY) {
.debug = "Primary",
.ecore_sel = ECORE_X_SELECTION_PRIMARY,
@ -339,6 +339,11 @@ static Cnp_Selection selections[ELM_SEL_TYPE_MAX] = {
.clear = ecore_x_selection_secondary_clear,
.request = ecore_x_selection_secondary_request,
},
ARRAYINIT(ELM_SEL_TYPE_XDND) {
.debug = "XDnD",
.ecore_sel = ECORE_X_SELECTION_XDND,
.request = ecore_x_selection_xdnd_request,
},
ARRAYINIT(ELM_SEL_TYPE_CLIPBOARD) {
.debug = "Clipboard",
.ecore_sel = ECORE_X_SELECTION_CLIPBOARD,
@ -346,11 +351,6 @@ static Cnp_Selection selections[ELM_SEL_TYPE_MAX] = {
.clear = ecore_x_selection_clipboard_clear,
.request = ecore_x_selection_clipboard_request,
},
ARRAYINIT(ELM_SEL_TYPE_XDND) {
.debug = "XDnD",
.ecore_sel = ECORE_X_SELECTION_XDND,
.request = ecore_x_selection_xdnd_request,
},
};
/* Data for DND in progress */
@ -400,7 +400,7 @@ elm_cnp_selection_set(Elm_Sel_Type selection, Evas_Object *obj,
if (top) xwin = elm_win_xwindow_get(top);
else xwin = elm_win_xwindow_get(obj);
if ((!xwin) || (selection >= ELM_SEL_TYPE_MAX))
if ((!xwin) || (selection > ELM_SEL_TYPE_CLIPBOARD))
return EINA_FALSE;
if (!_elm_cnp_init_count) _elm_cnp_init();
if ((!selbuf) && (format != ELM_SEL_FORMAT_IMAGE))
@ -438,7 +438,7 @@ elm_cnp_selection_clear(Elm_Sel_Type selection, Evas_Object *obj)
#ifdef HAVE_ELEMENTARY_X
Cnp_Selection *sel;
if ((unsigned int)selection >= (unsigned int)ELM_SEL_TYPE_MAX)
if ((unsigned int)selection > (unsigned int)ELM_SEL_TYPE_CLIPBOARD)
return EINA_FALSE;
if (!_elm_cnp_init_count) _elm_cnp_init();
@ -470,7 +470,7 @@ elm_cnp_selection_get(Elm_Sel_Type selection, Elm_Sel_Format format,
Evas_Object *top;
Cnp_Selection *sel;
if (selection >= ELM_SEL_TYPE_MAX)
if (selection > ELM_SEL_TYPE_CLIPBOARD)
return EINA_FALSE;
if (!_elm_cnp_init_count) _elm_cnp_init();
@ -519,13 +519,13 @@ selection_clear(void *udata __UNUSED__, int type __UNUSED__, void *event)
Cnp_Selection *sel;
int i;
for (i = 0; i < ELM_SEL_TYPE_MAX; i++)
for (i = 0; i <= ELM_SEL_TYPE_CLIPBOARD; i++)
{
if (selections[i].ecore_sel == ev->selection) break;
}
cnp_debug("selection %d clear\n", i);
/* Not me... Don't care */
if (i == ELM_SEL_TYPE_MAX) return ECORE_CALLBACK_PASS_ON;
if (i > ELM_SEL_TYPE_CLIPBOARD) return ECORE_CALLBACK_PASS_ON;
sel = selections + i;
sel->active = EINA_FALSE;
@ -556,9 +556,6 @@ selection_notify(void *udata __UNUSED__, int type __UNUSED__, void *event)
cnp_debug("selection notify callback: %d\n",ev->selection);
switch (ev->selection)
{
case ECORE_X_SELECTION_CLIPBOARD:
sel = selections + ELM_SEL_TYPE_CLIPBOARD;
break;
case ECORE_X_SELECTION_PRIMARY:
sel = selections + ELM_SEL_TYPE_PRIMARY;
break;
@ -568,6 +565,9 @@ selection_notify(void *udata __UNUSED__, int type __UNUSED__, void *event)
case ECORE_X_SELECTION_XDND:
sel = selections + ELM_SEL_TYPE_XDND;
break;
case ECORE_X_SELECTION_CLIPBOARD:
sel = selections + ELM_SEL_TYPE_CLIPBOARD;
break;
default:
return ECORE_CALLBACK_PASS_ON;
}
@ -600,7 +600,7 @@ _get_selection_type(void *data, int size)
Cnp_Selection *sel = selections + *((int *)data);
if (sel->active &&
(sel->format >= ELM_SEL_FORMAT_TARGETS) &&
(sel->format < ELM_SEL_FORMAT_MAX))
(sel->format <= ELM_SEL_FORMAT_HTML))
return sel->format;
}
return ELM_SEL_FORMAT_NONE;

View File

@ -1,24 +1,30 @@
/**
* @addtogroup CopyPaste
* @defgroup CopyPaste
*
* Implement the copy and paste + clipboard functionality, in order to
* share data across application windows.
*
* Contains functions to select a portion of text, stick it to a clipboard
* and to paste the selection to an appropriate place.
*
*
*
* @{
*/
typedef struct _Elm_Selection_Data Elm_Selection_Data;
typedef Eina_Bool (*Elm_Drop_Cb)(void *d, Evas_Object *o, Elm_Selection_Data *data);
/**
* Types of X window selection property names.
* Defines the types of selection property names.
* Kindly refer to http://www.x.org/docs/X11/xlib.pdf
* for more details.
*/
typedef enum
{
ELM_SEL_TYPE_PRIMARY, //primary text selection
ELM_SEL_TYPE_SECONDARY,
ELM_SEL_TYPE_SECONDARY, // used when primary selection is in use.
ELM_SEL_TYPE_XDND, //drag and drop
ELM_SEL_TYPE_CLIPBOARD,
ELM_SEL_TYPE_MAX,
ELM_SEL_TYPE_CLIPBOARD, // highlighted text
} Elm_Sel_Type;
typedef enum
@ -37,8 +43,6 @@ typedef enum
ELM_SEL_FORMAT_VCARD = 0x08,
/** Raw HTML-like things for widgets that want that stuff (hello webkit!) */
ELM_SEL_FORMAT_HTML = 0x10,
ELM_SEL_FORMAT_MAX
} Elm_Sel_Format;
struct _Elm_Selection_Data