From a6603778643168e766e142b2e77040bdfac3d710 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 5 May 2019 16:14:26 +0200 Subject: NXevents.c: call upstream versions of (De)ActivatePointerGrab() --- nx-X11/programs/Xserver/dix/events.c | 13 +++++-- nx-X11/programs/Xserver/hw/nxagent/NXevents.c | 50 +++------------------------ 2 files changed, 15 insertions(+), 48 deletions(-) diff --git a/nx-X11/programs/Xserver/dix/events.c b/nx-X11/programs/Xserver/dix/events.c index 70224c3b8..fe18cba64 100644 --- a/nx-X11/programs/Xserver/dix/events.c +++ b/nx-X11/programs/Xserver/dix/events.c @@ -1216,10 +1216,14 @@ CheckGrabForSyncs(register DeviceIntPtr thisDev, Bool thisMode, Bool otherMode) ComputeFreezes(); } -#ifndef NXAGENT_SERVER void -ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab, +#ifdef NXAGENT_SERVER +xorg_ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab, + TimeStamp time, Bool autoGrab) +#else +ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab, TimeStamp time, Bool autoGrab) +#endif { WindowPtr oldWin = (mouse->grab) ? mouse->grab->window : sprite.win; @@ -1246,7 +1250,11 @@ ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab, } void +#ifdef NXAGENT_SERVER +xorg_DeactivatePointerGrab(register DeviceIntPtr mouse) +#else DeactivatePointerGrab(register DeviceIntPtr mouse) +#endif { register GrabPtr grab = mouse->grab; register DeviceIntPtr dev; @@ -1268,7 +1276,6 @@ DeactivatePointerGrab(register DeviceIntPtr mouse) FreeCursor(grab->cursor, (Cursor)0); ComputeFreezes(); } -#endif /* NXAGENT_SERVER */ void ActivateKeyboardGrab(register DeviceIntPtr keybd, GrabPtr grab, TimeStamp time, Bool passive) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c index 031e62431..377843407 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c @@ -161,28 +161,7 @@ void ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab, TimeStamp time, Bool autoGrab) { - WindowPtr oldWin = (mouse->grab) ? mouse->grab->window - : sprite.win; - - if (grab->confineTo) - { - if (grab->confineTo->drawable.pScreen != sprite.hotPhys.pScreen) - sprite.hotPhys.x = sprite.hotPhys.y = 0; - ConfineCursorToWindow(grab->confineTo, FALSE, TRUE); - } - DoEnterLeaveEvents(oldWin, grab->window, NotifyGrab); - mouse->valuator->motionHintWindow = NullWindow; - if (syncEvents.playingEvents) - mouse->grabTime = syncEvents.time; - else - mouse->grabTime = time; - if (grab->cursor) - grab->cursor->refcnt++; - mouse->activeGrab = *grab; - mouse->grab = &mouse->activeGrab; - mouse->fromPassiveGrab = autoGrab; - PostNewCursor(); - CheckGrabForSyncs(mouse,(Bool)grab->pointerMode, (Bool)grab->keyboardMode); + xorg_ActivatePointerGrab(mouse, grab, time, autoGrab); #ifdef NXAGENT_SERVER @@ -212,9 +191,8 @@ ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab, if (nxagentOption(Rootless) == 1) { /* - * FIXME: We should use the correct value - * for the cursor. Temporarily we set it - * to None. + * FIXME: We should use the correct value for the + * cursor. Temporarily we set it to None. */ int resource = nxagentWaitForResource(NXGetCollectGrabPointerResource, @@ -227,31 +205,13 @@ ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab, None, CurrentTime); } - #endif + #endif /* NXAGENT_SERVER */ } void DeactivatePointerGrab(register DeviceIntPtr mouse) { - register GrabPtr grab = mouse->grab; - register DeviceIntPtr dev; - - mouse->valuator->motionHintWindow = NullWindow; - mouse->grab = NullGrab; - mouse->sync.state = NOT_GRABBED; - mouse->fromPassiveGrab = FALSE; - for (dev = inputInfo.devices; dev; dev = dev->next) - { - if (dev->sync.other == grab) - dev->sync.other = NullGrab; - } - DoEnterLeaveEvents(grab->window, sprite.win, NotifyUngrab); - if (grab->confineTo) - ConfineCursorToWindow(ROOT, FALSE, FALSE); - PostNewCursor(); - if (grab->cursor) - FreeCursor(grab->cursor, (Cursor)0); - ComputeFreezes(); + xorg_DeactivatePointerGrab(mouse); #ifdef NXAGENT_SERVER -- cgit v1.2.3 From b64e1f60bb41d3fa36c9992c675d5d8977612191 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 22 May 2019 21:20:32 +0200 Subject: NXevents.c: call upstream version of ProcSendEvent() --- nx-X11/programs/Xserver/dix/events.c | 6 +- nx-X11/programs/Xserver/hw/nxagent/NXevents.c | 85 +-------------------------- 2 files changed, 7 insertions(+), 84 deletions(-) diff --git a/nx-X11/programs/Xserver/dix/events.c b/nx-X11/programs/Xserver/dix/events.c index fe18cba64..bcfa30936 100644 --- a/nx-X11/programs/Xserver/dix/events.c +++ b/nx-X11/programs/Xserver/dix/events.c @@ -3947,9 +3947,12 @@ CloseDownEvents(void) spriteTraceSize = 0; } -#ifndef NXAGENT_SERVER int +#ifdef NXAGENT_SERVER +xorg_ProcSendEvent(ClientPtr client) +#else ProcSendEvent(ClientPtr client) +#endif { WindowPtr pWin; WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */ @@ -4034,7 +4037,6 @@ ProcSendEvent(ClientPtr client) NullGrab, 0); return Success; } -#endif /* NXAGENT_SERVER */ int ProcUngrabKey(ClientPtr client) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c index 377843407..661eeae2b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c @@ -488,96 +488,17 @@ DefineInitialRootWindow(register WindowPtr win) int ProcSendEvent(ClientPtr client) { - WindowPtr pWin; - WindowPtr effectiveFocus = NullWindow; /* only set if dest==InputFocus */ +#ifdef NXAGENT_CLIPBOARD + REQUEST(xSendEventReq); REQUEST_SIZE_MATCH(xSendEventReq); - /* The client's event type must be a core event type or one defined by an - extension. */ - - -#ifdef NXAGENT_CLIPBOARD - if (stuff -> event.u.u.type == SelectionNotify) { if (nxagentSendNotify(&stuff->event) == 1) return Success; } #endif - - if ( ! ((stuff->event.u.u.type > X_Reply && - stuff->event.u.u.type < LASTEvent) || - (stuff->event.u.u.type >= EXTENSION_EVENT_BASE && - stuff->event.u.u.type < (unsigned)lastEvent))) - { - client->errorValue = stuff->event.u.u.type; - return BadValue; - } - if (stuff->event.u.u.type == ClientMessage && - stuff->event.u.u.detail != 8 && - stuff->event.u.u.detail != 16 && - stuff->event.u.u.detail != 32) - { - client->errorValue = stuff->event.u.u.detail; - return BadValue; - } - if (stuff->eventMask & ~AllEventMasks) - { - client->errorValue = stuff->eventMask; - return BadValue; - } - - if (stuff->destination == PointerWindow) - pWin = sprite.win; - else if (stuff->destination == InputFocus) - { - WindowPtr inputFocus = inputInfo.keyboard->focus->win; - - if (inputFocus == NoneWin) - return Success; - - /* If the input focus is PointerRootWin, send the event to where - the pointer is if possible, then perhaps propagate up to root. */ - if (inputFocus == PointerRootWin) - inputFocus = ROOT; - - if (IsParent(inputFocus, sprite.win)) - { - effectiveFocus = inputFocus; - pWin = sprite.win; - } - else - effectiveFocus = pWin = inputFocus; - } - else - pWin = SecurityLookupWindow(stuff->destination, client, - DixReadAccess); - if (!pWin) - return BadWindow; - if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue)) - { - client->errorValue = stuff->propagate; - return BadValue; - } - stuff->event.u.u.type |= 0x80; - if (stuff->propagate) - { - for (;pWin; pWin = pWin->parent) - { - if (DeliverEventsToWindow(pWin, &stuff->event, 1, stuff->eventMask, - NullGrab, 0)) - return Success; - if (pWin == effectiveFocus) - return Success; - stuff->eventMask &= ~wDontPropagateMask(pWin); - if (!stuff->eventMask) - break; - } - } - else - (void)DeliverEventsToWindow(pWin, &stuff->event, 1, stuff->eventMask, - NullGrab, 0); - return Success; + return xorg_ProcSendEvent(client); } -- cgit v1.2.3 From 4c5331afa863ef034dbd31e6afc81a14903ef16b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 22 May 2019 21:35:05 +0200 Subject: NXevents.c: call upstream DefineInitialRootWindow() --- nx-X11/programs/Xserver/dix/events.c | 6 +++-- nx-X11/programs/Xserver/hw/nxagent/NXevents.c | 35 +-------------------------- 2 files changed, 5 insertions(+), 36 deletions(-) diff --git a/nx-X11/programs/Xserver/dix/events.c b/nx-X11/programs/Xserver/dix/events.c index bcfa30936..6a8a4043e 100644 --- a/nx-X11/programs/Xserver/dix/events.c +++ b/nx-X11/programs/Xserver/dix/events.c @@ -2070,9 +2070,12 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff) } #endif -#ifndef NXAGENT_SERVER void +#ifdef NXAGENT_SERVER +xorg_DefineInitialRootWindow(register WindowPtr win) +#else DefineInitialRootWindow(register WindowPtr win) +#endif { register ScreenPtr pScreen = win->drawable.pScreen; @@ -2112,7 +2115,6 @@ DefineInitialRootWindow(register WindowPtr win) } #endif } -#endif /* NXAGENT_SERVER */ /* * This does not take any shortcuts, and even ignores its argument, since diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c index 661eeae2b..da4d71edb 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c @@ -436,41 +436,8 @@ void DefineInitialRootWindow(register WindowPtr win) { register ScreenPtr pScreen = win->drawable.pScreen; - sprite.hotPhys.pScreen = pScreen; - sprite.hotPhys.x = pScreen->width / 2; - sprite.hotPhys.y = pScreen->height / 2; - sprite.hot = sprite.hotPhys; - sprite.hotLimits.x2 = pScreen->width; - sprite.hotLimits.y2 = pScreen->height; - sprite.win = win; - sprite.current = wCursor (win); - sprite.current->refcnt++; - spriteTraceGood = 1; - ROOT = win; - (*pScreen->CursorLimits) ( - pScreen, sprite.current, &sprite.hotLimits, &sprite.physLimits); - sprite.confined = FALSE; - (*pScreen->ConstrainCursor) (pScreen, &sprite.physLimits); - (*pScreen->SetCursorPosition) (pScreen, sprite.hot.x, sprite.hot.y, FALSE); - (*pScreen->DisplayCursor) (pScreen, sprite.current); -#ifdef PANORAMIX - if(!noPanoramiXExtension) { - sprite.hotLimits.x1 = -panoramiXdataPtr[0].x; - sprite.hotLimits.y1 = -panoramiXdataPtr[0].y; - sprite.hotLimits.x2 = PanoramiXPixWidth - panoramiXdataPtr[0].x; - sprite.hotLimits.y2 = PanoramiXPixHeight - panoramiXdataPtr[0].y; - sprite.physLimits = sprite.hotLimits; - sprite.confineWin = NullWindow; -#ifdef SHAPE - sprite.hotShape = NullRegion; -#endif - sprite.screen = pScreen; - /* gotta UNINIT these someplace */ - RegionNull(&sprite.Reg1); - RegionNull(&sprite.Reg2); - } -#endif + xorg_DefineInitialRootWindow(win); #ifdef VIEWPORT_FRAME nxagentInitViewportFrame(pScreen, win); -- cgit v1.2.3 From 582618af8bbad1da7a40b41b7fcefce0fe096abd Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 22 May 2019 21:43:33 +0200 Subject: NXEvents.c: mark NX specific code --- nx-X11/programs/Xserver/hw/nxagent/NXevents.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c index da4d71edb..5baadde35 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c @@ -292,6 +292,7 @@ XYToWindow(int x, int y) spriteTraceGood = 1; /* root window still there */ +#ifdef NXAGENT_SERVER if (nxagentOption(Rootless)) { if (nxagentLastEnteredWindow == NULL) @@ -310,7 +311,9 @@ XYToWindow(int x, int y) { pWin = ROOT->firstChild; } - +#else + pWin = ROOT->firstChild; +#endif while (pWin) { if ((pWin->mapped) && -- cgit v1.2.3 From f887d428c4443c2df31e831e6b1a3eec23a03aeb Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 22 May 2019 21:56:39 +0200 Subject: NXevents.c: call upstream ProcAllocEvents() Our version only adds some commented code, so it is not really necessary. But it is cleaner to handle it that way. --- nx-X11/programs/Xserver/dix/events.c | 4 ++ nx-X11/programs/Xserver/hw/nxagent/NXevents.c | 73 ++++++++------------------- 2 files changed, 24 insertions(+), 53 deletions(-) diff --git a/nx-X11/programs/Xserver/dix/events.c b/nx-X11/programs/Xserver/dix/events.c index 6a8a4043e..c99e55a87 100644 --- a/nx-X11/programs/Xserver/dix/events.c +++ b/nx-X11/programs/Xserver/dix/events.c @@ -1436,7 +1436,11 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState) } int +#ifdef NXAGENT_SERVER +xorg_ProcAllowEvents(register ClientPtr client) +#else ProcAllowEvents(register ClientPtr client) +#endif { TimeStamp time; DeviceIntPtr mouse = inputInfo.pointer; diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c index 5baadde35..606b5e3b8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c @@ -230,59 +230,26 @@ DeactivatePointerGrab(register DeviceIntPtr mouse) #endif } -// int -// ProcAllowEvents(register ClientPtr client) -// { -// TimeStamp time; -// DeviceIntPtr mouse = inputInfo.pointer; -// DeviceIntPtr keybd = inputInfo.keyboard; -// REQUEST(xAllowEventsReq); -// -// REQUEST_SIZE_MATCH(xAllowEventsReq); -// time = ClientTimeToServerTime(stuff->time); -// switch (stuff->mode) -// { -// case ReplayPointer: -// AllowSome(client, time, mouse, NOT_GRABBED); -// break; -// case SyncPointer: -// AllowSome(client, time, mouse, FREEZE_NEXT_EVENT); -// break; -// case AsyncPointer: -// AllowSome(client, time, mouse, THAWED); -// break; -// case ReplayKeyboard: -// AllowSome(client, time, keybd, NOT_GRABBED); -// break; -// case SyncKeyboard: -// AllowSome(client, time, keybd, FREEZE_NEXT_EVENT); -// break; -// case AsyncKeyboard: -// AllowSome(client, time, keybd, THAWED); -// break; -// case SyncBoth: -// AllowSome(client, time, keybd, FREEZE_BOTH_NEXT_EVENT); -// break; -// case AsyncBoth: -// AllowSome(client, time, keybd, THAWED_BOTH); -// break; -// default: -// client->errorValue = stuff->mode; -// return BadValue; -// } -// -// /* -// * This is not necessary if we export grab to X as asynchronous. -// * -// * if (nxagentOption(Rootless) && stuff -> mode != ReplayKeyboard && -// * stuff -> mode != SyncKeyboard && stuff -> mode != AsyncKeyboard) -// * { -// * XAllowEvents(nxagentDisplay, stuff -> mode, CurrentTime); -// * } -// */ -// -// return Success; -// } +int +ProcAllowEvents(register ClientPtr client) +{ + int rc = xorg_ProcAllowEvents(client); + + if (rc != Success) + return rc; + + /* + * This is not necessary if we export grab to X as asynchronous. + * + * if (nxagentOption(Rootless) && stuff -> mode != ReplayKeyboard && + * stuff -> mode != SyncKeyboard && stuff -> mode != AsyncKeyboard) + * { + * XAllowEvents(nxagentDisplay, stuff -> mode, CurrentTime); + * } + */ + + return Success; +} static WindowPtr XYToWindow(int x, int y) -- cgit v1.2.3 From 6ed435e44765f83287dfe14129ba1d74bfcb9fde Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 28 Oct 2019 17:45:49 +0100 Subject: NXevents.c: use XYToWindow from dix add a callback to determine the starting window. --- nx-X11/programs/Xserver/dix/events.c | 15 +++++-- nx-X11/programs/Xserver/hw/nxagent/NXevents.c | 58 ++++----------------------- 2 files changed, 20 insertions(+), 53 deletions(-) diff --git a/nx-X11/programs/Xserver/dix/events.c b/nx-X11/programs/Xserver/dix/events.c index c99e55a87..b29688857 100644 --- a/nx-X11/programs/Xserver/dix/events.c +++ b/nx-X11/programs/Xserver/dix/events.c @@ -1914,7 +1914,17 @@ PointInBorderSize(WindowPtr pWin, int x, int y) return FALSE; } -#ifndef NXAGENT_SERVER +/* define XYWINDOWCALLBACK if your DDX provides this callback */ + +static WindowPtr GetXYStartWindow(WindowPtr pWin); + +#ifndef XYWINDOWCALLBACK +static WindowPtr GetXYStartWindow(WindowPtr pWin) +{ + return pWin; +} +#endif + static WindowPtr XYToWindow(int x, int y) { @@ -1922,7 +1932,7 @@ XYToWindow(int x, int y) BoxRec box; spriteTraceGood = 1; /* root window still there */ - pWin = ROOT->firstChild; + pWin = GetXYStartWindow(ROOT->firstChild); while (pWin) { if ((pWin->mapped) && @@ -1960,7 +1970,6 @@ XYToWindow(int x, int y) } return spriteTrace[spriteTraceGood-1]; } -#endif /* NXAGENT_SERVER */ #ifndef NXAGENT_SERVER static Bool diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c index 606b5e3b8..6754991c9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c @@ -135,6 +135,7 @@ of the copyright holder. #include +#define XYWINDOWCALLBACK #include "../../dix/events.c" #include "compext/Compext.h" @@ -251,15 +252,14 @@ ProcAllowEvents(register ClientPtr client) return Success; } +/* + * called from XYToWindow to determine where XYToWindow() should start + * going through the list. + */ + static WindowPtr -XYToWindow(int x, int y) +GetXYStartWindow(WindowPtr pWin) { - register WindowPtr pWin; - BoxRec box; - - spriteTraceGood = 1; /* root window still there */ - -#ifdef NXAGENT_SERVER if (nxagentOption(Rootless)) { if (nxagentLastEnteredWindow == NULL) @@ -274,49 +274,7 @@ XYToWindow(int x, int y) pWin = pWin->prevSib; } } - else - { - pWin = ROOT->firstChild; - } -#else - pWin = ROOT->firstChild; -#endif - while (pWin) - { - if ((pWin->mapped) && - (x >= pWin->drawable.x - wBorderWidth (pWin)) && - (x < pWin->drawable.x + (int)pWin->drawable.width + - wBorderWidth(pWin)) && - (y >= pWin->drawable.y - wBorderWidth (pWin)) && - (y < pWin->drawable.y + (int)pWin->drawable.height + - wBorderWidth (pWin)) -#ifdef SHAPE - /* When a window is shaped, a further check - * is made to see if the point is inside - * borderSize - */ - && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y)) - && (!wInputShape(pWin) || - RegionContainsPoint( - wInputShape(pWin), - x - pWin->drawable.x, - y - pWin->drawable.y, &box)) -#endif - ) - { - if (spriteTraceGood >= spriteTraceSize) - { - spriteTraceSize += 10; - spriteTrace = realloc( - spriteTrace, spriteTraceSize*sizeof(WindowPtr)); - } - spriteTrace[spriteTraceGood++] = pWin; - pWin = pWin->firstChild; - } - else - pWin = pWin->nextSib; - } - return spriteTrace[spriteTraceGood-1]; + return pWin; } static Bool -- cgit v1.2.3 From 283e4523a164a469ce8613d5facb563d597ced37 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 28 Oct 2019 19:58:38 +0100 Subject: NXevents.c: add some explanations from the original changelog --- nx-X11/programs/Xserver/hw/nxagent/NXevents.c | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c index 6754991c9..ed444e7a4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c @@ -191,6 +191,15 @@ ActivatePointerGrab(register DeviceIntPtr mouse, register GrabPtr grab, if (nxagentOption(Rootless) == 1) { + /* + * from nxagent-1.5.0-20 changelog: + * In rootless mode, grabs exported to X in + * ActivatePointerGrab() are always made asynchronous. The + * synchronous behaviour is implemented by the agent, so that + * requiring a further synchronous grab down to the real X + * server is of little use and potentially harmful. + */ + /* * FIXME: We should use the correct value for the * cursor. Temporarily we set it to None. @@ -216,6 +225,15 @@ DeactivatePointerGrab(register DeviceIntPtr mouse) #ifdef NXAGENT_SERVER + /* + * excerpt from nxagent-1.5.0-20 changelog: + * In DeactivatePointerGrab() function, mouse button state is set + * to up if the window entered by the pointer is the root window + * and the agent is in rootless mode. This change is needed + * because the subsequent KeyRelease event could be not received + * by the agent (for example if the focus had left the window), so + * that agent could be unable to update the mouse button state. + */ if (nxagentOption(Rootless) == 1) { XUngrabPointer(nxagentDisplay, CurrentTime); @@ -260,13 +278,27 @@ ProcAllowEvents(register ClientPtr client) static WindowPtr GetXYStartWindow(WindowPtr pWin) { + if (nxagentOption(Rootless)) { + /* + * explanation from the original changelog for nxagent-1.5.0-20: + * Modified function XYToWindow() in order to manage the case + * that mouse pointer is located on the title bar of a top level + * window in rootless mode. + */ + if (nxagentLastEnteredWindow == NULL) { return ROOT; } + /* + * explanation from the original changelog for nxagent-1.5.0-17: + * In rootless mode, now function XYToWindow() starts search from + * the last window originated an EnterNotify event. In this way, we + * can prevent shaded windows from getting mouse events. + */ pWin = ROOT->lastChild; while (pWin && pWin != ROOT->firstChild && pWin != nxagentLastEnteredWindow) -- cgit v1.2.3