Make ecore_x_selection a bit more generic, at least on event reporting.

SVN revision: 39633
This commit is contained in:
Gustavo Sverzut Barbieri 2009-03-22 18:19:17 +00:00
parent 338881b454
commit 354b23a12e
5 changed files with 24 additions and 19 deletions

View File

@ -156,7 +156,8 @@ typedef enum _Ecore_X_Selection {
ECORE_X_SELECTION_PRIMARY,
ECORE_X_SELECTION_SECONDARY,
ECORE_X_SELECTION_XDND,
ECORE_X_SELECTION_CLIPBOARD
ECORE_X_SELECTION_CLIPBOARD,
ECORE_X_SELECTION_OTHER
} Ecore_X_Selection;
typedef enum _Ecore_X_Event_Mode
@ -470,6 +471,7 @@ struct _Ecore_X_Event_Selection_Clear
{
Ecore_X_Window win;
Ecore_X_Selection selection;
Ecore_X_Atom atom;
Ecore_X_Time time;
};
@ -488,6 +490,7 @@ struct _Ecore_X_Event_Selection_Notify
Ecore_X_Window win;
Ecore_X_Time time;
Ecore_X_Selection selection;
Ecore_X_Atom atom;
char *target;
void *data;
};

View File

@ -25,6 +25,7 @@ AM_CPPFLAGS = \
-I$(top_builddir)/src/lib/ecore_txt \
-I$(top_builddir)/src/lib/ecore_x \
-I$(top_builddir)/src/lib/ecore_input \
@EVAS_CFLAGS@ \
@EINA_CFLAGS@
noinst_LTLIBRARIES = libecore_x_xcb.la

View File

@ -1291,9 +1291,8 @@ _ecore_x_event_handle_selection_clear(xcb_generic_event_t *event)
Ecore_X_Atom sel;
ev = (xcb_selection_clear_event_t *)event;
if (!(d = _ecore_x_selection_get(ev->selection)))
return;
if (ev->time > d->time)
d = _ecore_x_selection_get(ev->selection);
if (d && (ev->time > d->time))
{
_ecore_x_selection_set(XCB_NONE, NULL, 0,
ev->selection);
@ -1303,13 +1302,15 @@ _ecore_x_event_handle_selection_clear(xcb_generic_event_t *event)
e = malloc(sizeof(Ecore_X_Event_Selection_Clear));
e->win = ev->owner;
e->time = ev->time;
sel = ev->selection;
e->atom = sel = ev->selection;
if (sel == ECORE_X_ATOM_SELECTION_PRIMARY)
e->selection = ECORE_X_SELECTION_PRIMARY;
else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY)
e->selection = ECORE_X_SELECTION_SECONDARY;
else
else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD)
e->selection = ECORE_X_SELECTION_CLIPBOARD;
else
e->selection = ECORE_X_SELECTION_OTHER;
ecore_event_add(ECORE_X_EVENT_SELECTION_CLEAR, e, NULL, NULL);
}
@ -1411,6 +1412,7 @@ _ecore_x_event_handle_selection_notify(xcb_generic_event_t *event)
if (!e) return;
e->win = ev->requestor;
e->time = ev->time;
e->atom = selection;
e->target = _ecore_x_selection_target_get(ev->target);
if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
@ -1422,10 +1424,8 @@ _ecore_x_event_handle_selection_notify(xcb_generic_event_t *event)
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
e->selection = ECORE_X_SELECTION_CLIPBOARD;
else
{
free(e);
return;
}
e->selection = ECORE_X_SELECTION_OTHER;
e->data = _ecore_x_selection_parse(e->target, data, num_ret, format);
ecore_event_add(ECORE_X_EVENT_SELECTION_NOTIFY, e, _ecore_x_event_free_selection_notify, NULL);

View File

@ -25,6 +25,7 @@ AM_CPPFLAGS = \
-I$(top_builddir)/src/lib/ecore_txt \
-I$(top_builddir)/src/lib/ecore_x \
-I$(top_builddir)/src/lib/ecore_input \
@EVAS_CFLAGS@ \
@EINA_CFLAGS@
noinst_LTLIBRARIES = libecore_x_xlib.la

View File

@ -1204,9 +1204,8 @@ _ecore_x_event_handle_selection_clear(XEvent *xevent)
Ecore_X_Atom sel;
_ecore_x_last_event_mouse_move = 0;
if (!(d = _ecore_x_selection_get(xevent->xselectionclear.selection)))
return;
if (xevent->xselectionclear.time > d->time)
d = _ecore_x_selection_get(xevent->xselectionclear.selection);
if (d && (xevent->xselectionclear.time > d->time))
{
_ecore_x_selection_set(None, NULL, 0,
xevent->xselectionclear.selection);
@ -1216,13 +1215,15 @@ _ecore_x_event_handle_selection_clear(XEvent *xevent)
e = malloc(sizeof(Ecore_X_Event_Selection_Clear));
e->win = xevent->xselectionclear.window;
e->time = xevent->xselectionclear.time;
sel = xevent->xselectionclear.selection;
e->atom = sel = xevent->xselectionclear.selection;
if (sel == ECORE_X_ATOM_SELECTION_PRIMARY)
e->selection = ECORE_X_SELECTION_PRIMARY;
else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY)
e->selection = ECORE_X_SELECTION_SECONDARY;
else
else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD)
e->selection = ECORE_X_SELECTION_CLIPBOARD;
else
e->selection = ECORE_X_SELECTION_OTHER;
ecore_event_add(ECORE_X_EVENT_SELECTION_CLEAR, e, NULL, NULL);
}
@ -1315,6 +1316,7 @@ _ecore_x_event_handle_selection_notify(XEvent *xevent)
if (!e) return;
e->win = xevent->xselection.requestor;
e->time = xevent->xselection.time;
e->atom = selection;
e->target = _ecore_x_selection_target_get(xevent->xselection.target);
if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
@ -1326,10 +1328,8 @@ _ecore_x_event_handle_selection_notify(XEvent *xevent)
else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
e->selection = ECORE_X_SELECTION_CLIPBOARD;
else
{
free(e);
return;
}
e->selection = ECORE_X_SELECTION_OTHER;
e->data = _ecore_x_selection_parse(e->target, data, num_ret, format);
ecore_event_add(ECORE_X_EVENT_SELECTION_NOTIFY, e,