summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2011-12-27 22:01:08 -0500
committerKristian Høgsberg <krh@bitplanet.net>2012-03-27 09:32:00 -0400
commit2a8350155a8062c6f3ad98f17ed857c55c92d484 (patch)
tree69761e8ff83fa28cb12fd09f75fa57ab9328c0e1
parentaf6cea4fc0035c413733001ff2268741ff1dae5d (diff)
xwayland: wip, track XdndSelection
-rw-r--r--hw/xfree86/xwayland/xwayland.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/hw/xfree86/xwayland/xwayland.c b/hw/xfree86/xwayland/xwayland.c
index 05871137f..5d053aa08 100644
--- a/hw/xfree86/xwayland/xwayland.c
+++ b/hw/xfree86/xwayland/xwayland.c
@@ -40,6 +40,7 @@
#include <xf86Crtc.h>
#include <xf86Priv.h>
#include <os.h>
+#include <selection.h>
#include "xwayland.h"
#include "xwayland-private.h"
@@ -52,6 +53,7 @@
*/
static DevPrivateKeyRec xwl_screen_private_key;
+static Atom xdnd_atom;
static void
xserver_client(void *data, struct xserver *xserver, int fd)
@@ -176,6 +178,37 @@ xwl_screen_get(ScreenPtr screen)
return dixLookupPrivate(&screen->devPrivates, &xwl_screen_private_key);
}
+static void
+xwayland_selection_callback(CallbackListPtr *callbacks,
+ pointer data, pointer args)
+{
+ SelectionInfoRec *info = (SelectionInfoRec *) args;
+ struct xwl_screen *xwl_screen = data;
+ Selection *selection = info->selection;
+
+ switch (info->kind) {
+ case SelectionSetOwner:
+ ErrorF("set selection: atom %s (%d), window %d\n",
+ NameForAtom(selection->selection),
+ selection->selection, selection->window);
+
+ if (selection->selection == xdnd_atom) {
+ if (selection->window != None)
+ ErrorF("client %p starts dnd\n", info->client);
+ else
+ ErrorF("client %p stops dnd\n", info->client);
+ }
+ break;
+ case SelectionWindowDestroy:
+ ErrorF("selection window destroy\n");
+ break;
+ case SelectionClientClose:
+ ErrorF("selection client close\n");
+ break;
+ }
+}
+
+
struct xwl_screen *
xwl_screen_pre_init(ScrnInfoPtr scrninfo,
uint32_t flags, struct xwl_driver *driver)
@@ -189,6 +222,14 @@ xwl_screen_pre_init(ScrnInfoPtr scrninfo,
return NULL;
}
+ xdnd_atom = MakeAtom("XdndSelection", 13, 1);
+ ErrorF("xdnd_atom: %d\n", xdnd_atom);
+ if (!AddCallback(&SelectionCallback,
+ xwayland_selection_callback, xwl_screen)) {
+ free(xwl_screen);
+ return NULL;
+ }
+
list_init(&xwl_screen->input_device_list);
list_init(&xwl_screen->damage_window_list);
list_init(&xwl_screen->window_list);