summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Reveman <davidr@novell.com>2008-10-19 08:55:27 -0400
committerDavid Reveman <davidr@novell.com>2008-10-30 03:37:52 -0400
commite6d24e28de3e6cae24506abc066a2125ab8e384c (patch)
treed99b279663f60fab85bd619c89b0ab10472e8c2c
parent1b8d6ee4994f1937c09c1eaa69a6f80ee023c87e (diff)
Handle top-level window changes properly in DND mode.
-rw-r--r--hw/dmx/dmx.h1
-rw-r--r--hw/dmx/dmxdnd.c35
-rw-r--r--hw/dmx/dmxscrinit.c5
3 files changed, 39 insertions, 2 deletions
diff --git a/hw/dmx/dmx.h b/hw/dmx/dmx.h
index 35bb5f3e8..2ad559fa3 100644
--- a/hw/dmx/dmx.h
+++ b/hw/dmx/dmx.h
@@ -218,6 +218,7 @@ typedef struct _DMXScreenInfo {
Window scrnWin; /**< "Screen" window on backend display */
int scrnWidth; /**< Width of "screen" */
int scrnHeight; /**< Height of "screen" */
+ int scrnEventMask;
/** Default drawables for "screen" */
Drawable scrnDefDrawables[MAXFORMATS];
diff --git a/hw/dmx/dmxdnd.c b/hw/dmx/dmxdnd.c
index 1fef24fa3..ee96c510c 100644
--- a/hw/dmx/dmxdnd.c
+++ b/hw/dmx/dmxdnd.c
@@ -487,6 +487,10 @@ dmxBEDnDUpdatePosition (ScreenPtr pScreen,
{
Window root = DefaultRootWindow (dmxScreen->beDisplay);
+ XSelectInput (dmxScreen->beDisplay, root,
+ dmxScreen->scrnEventMask |
+ StructureNotifyMask | SubstructureNotifyMask);
+
dmxScreen->queryTree = xcb_query_tree (dmxScreen->connection,
root);
dmxAddRequest (&dmxScreen->request,
@@ -514,6 +518,11 @@ dmxBEDnDHideProxyWindow (ScreenPtr pScreen)
UnmapWindow (pProxyWin, FALSE);
+ if (dmxScreen->dndChildren || dmxScreen->queryTree.sequence)
+ XSelectInput (dmxScreen->beDisplay,
+ DefaultRootWindow (dmxScreen->beDisplay),
+ dmxScreen->scrnEventMask);
+
if (dmxScreen->dndChildren)
{
xfree (dmxScreen->dndChildren);
@@ -1274,9 +1283,33 @@ Bool
dmxScreenEventCheckDnD (ScreenPtr pScreen,
xcb_generic_event_t *event)
{
- DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ xcb_map_notify_event_t *xmap = (xcb_map_notify_event_t *) event;
switch (event->response_type & ~0x80) {
+ case XCB_MAP_NOTIFY:
+ if (xmap->window == dmxScreen->rootWin)
+ return FALSE;
+
+ /* fall-through */
+ case XCB_UNMAP_NOTIFY:
+ case XCB_CONFIGURE_NOTIFY:
+ if (xmap->event != DefaultRootWindow (dmxScreen->beDisplay))
+ return FALSE;
+
+ if (dmxScreen->dndChildren)
+ {
+ xfree (dmxScreen->dndChildren);
+
+ dmxScreen->dndChildren = NULL;
+ dmxScreen->dndNChildren = 0;
+ }
+
+ dmxScreen->queryTree.sequence = 0;
+
+ if (dmxScreen->dndStatus)
+ dmxBEDnDUpdatePosition (pScreen, dmxScreen->dndX, dmxScreen->dndY);
+ break;
case XCB_CLIENT_MESSAGE: {
xcb_client_message_event_t *xclient =
(xcb_client_message_event_t *) event;
diff --git a/hw/dmx/dmxscrinit.c b/hw/dmx/dmxscrinit.c
index 2b3523825..d189dc58e 100644
--- a/hw/dmx/dmxscrinit.c
+++ b/hw/dmx/dmxscrinit.c
@@ -1033,6 +1033,8 @@ Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[])
dmxScreen->request.head = NULL;
dmxScreen->request.tail = &dmxScreen->request.head;
+ dmxScreen->scrnEventMask = 0;
+
dmxScreen->rootEventMask = ExposureMask | StructureNotifyMask |
SubstructureRedirectMask;
@@ -1153,9 +1155,10 @@ Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[])
if (!dmxScreen->scrnWin && dmxScreen->beDisplay)
{
dmxScreen->scrnWin = DefaultRootWindow (dmxScreen->beDisplay);
+ dmxScreen->scrnEventMask |= StructureNotifyMask;
XSelectInput (dmxScreen->beDisplay,
dmxScreen->scrnWin,
- StructureNotifyMask);
+ dmxScreen->scrnEventMask);
}
#ifdef MITSHM