Make ecore_x_selection a bit more generic, at least on event reporting.
authorbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 22 Mar 2009 18:19:17 +0000 (18:19 +0000)
committerbarbieri <barbieri@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 22 Mar 2009 18:19:17 +0000 (18:19 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@39633 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/ecore_x/Ecore_X.h
src/lib/ecore_x/xcb/Makefile.am
src/lib/ecore_x/xcb/ecore_xcb_events.c
src/lib/ecore_x/xlib/Makefile.am
src/lib/ecore_x/xlib/ecore_x_events.c

index b42f7af..b14ee12 100644 (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;
 };
index 3887d61..5e46fb2 100644 (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
index bf6799a..4e9632a 100644 (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);
index 1010258..e9cfbf3 100644 (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
index 70c35b5..01215e1 100644 (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,