Flesh out a little more Xdnd code
authorxcomputerman <xcomputerman>
Sun, 24 Oct 2004 03:58:11 +0000 (03:58 +0000)
committerxcomputerman <xcomputerman@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sun, 24 Oct 2004 03:58:11 +0000 (03:58 +0000)
SVN revision: 12001

legacy/ecore/src/lib/ecore_x/ecore_x.c
legacy/ecore/src/lib/ecore_x/ecore_x_dnd.c
legacy/ecore/src/lib/ecore_x/ecore_x_selection.c

index ff11f89..2eada94 100644 (file)
@@ -400,7 +400,7 @@ ecore_x_init(const char *name)
    _ecore_x_atom_selection_prop_primary   = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_PRIMARY", False);
    _ecore_x_atom_selection_prop_secondary = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_SECONDARY", False);
    _ecore_x_atom_selection_prop_clipboard = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_CLIPBOARD", False);
-   _ecore_x_atom_selection_prop_xdnd      = XInternAtom(_ecore_x_disp, "_ECORE_SELECTION_XDND", False);
+   _ecore_x_atom_selection_prop_xdnd      = XInternAtom(_ecore_x_disp, "JXSelectionWindowProperty", False);
    _ecore_x_atom_selection_xdnd           = XInternAtom(_ecore_x_disp, "XdndSelection", False);
    _ecore_x_atom_xdnd_aware               = XInternAtom(_ecore_x_disp, "XdndAware", False);
    _ecore_x_atom_xdnd_type_list           = XInternAtom(_ecore_x_disp, "XdndTypeList", False);
index d89651a..d8bbf89 100644 (file)
@@ -203,7 +203,7 @@ _ecore_x_dnd_drag(int x, int y)
          xev.xclient.message_type = _ecore_x_atom_xdnd_position;
          xev.xclient.data.l[0] = _xdnd->source;
          xev.xclient.data.l[1] = 0; /* Reserved */
-         xev.xclient.data.l[2] = ((x << 16) & 0xffff0000) | (y * 0xffff);
+         xev.xclient.data.l[2] = ((x << 16) & 0xffff0000) | (y & 0xffff);
          xev.xclient.data.l[3] = CurrentTime; /* Version 1 */
          xev.xclient.data.l[4] = _xdnd->action; /* Version 2, Needs to be pre-set */
          XSendEvent(_ecore_x_disp, win, False, 0, &xev);
@@ -241,4 +241,26 @@ _ecore_x_dnd_drag(int x, int y)
    _xdnd->dest = win;
 }
 
+void 
+_ecore_x_dnd_send_finished(void)
+{
+   XEvent   xev;
+
+   xev.xany.type = ClientMessage;
+   xev.xany.display = _ecore_x_disp;
+   xev.xclient.window = _xdnd->source;
+   xev.xclient.message_type = _ecore_x_atom_xdnd_finished;
+   xev.xclient.format = 32;
+
+   xev.xclient.data.l[0] = _xdnd->dest;
+   memset(xev.xclient.data.l + 1, 0, sizeof(long) * 3);
+   XSendEvent(_ecore_x_disp, _xdnd->source, False, 0, &xev);
+}
+
+int
+_ecore_x_dnd_own_selection(void)
+{
+   return (!XSetSelectionOwner(_ecore_x_disp, _ecore_x_atom_selection_xdnd,
+                               _xdnd->source, CurrentTime));
+}
 
index 7c113f5..587d8ff 100644 (file)
@@ -325,6 +325,8 @@ _ecore_x_selection_request(Ecore_X_Window w, Ecore_X_Atom selection, char *targe
       prop = _ecore_x_atom_selection_prop_primary;
    else if (selection == _ecore_x_atom_selection_secondary)
       prop = _ecore_x_atom_selection_prop_secondary;
+   else if (selection == _ecore_x_atom_selection_xdnd)
+      prop = _ecore_x_atom_selection_prop_xdnd;
    else
       prop = _ecore_x_atom_selection_prop_clipboard;
 
@@ -523,3 +525,4 @@ static int _ecore_x_selection_converter_text(char *target, void *data, int size,
    }
 }
 
+