Commit fc05e5e0 authored by Reinhard Tartler's avatar Reinhard Tartler

Imported nxagent-3.3.0-13.tar.gz

Summary: Imported nxagent-3.3.0-13.tar.gz Keywords: Imported nxagent-3.3.0-13.tar.gz into Git repository
parent 1a74e032
ChangeLog: ChangeLog:
nxagent-3.3.0-13
- Handle the window unmap immediately. Don't add it to the configure
queue.
nxagent-3.3.0-12
- Fixed TR03G02200. Timestamps could be in the future in KeyRelease
events sent to the X clients.
- Added debug logging of input devices state Logging can be enabled
or disabled via the Ctrl+Alt+x shortcut. State info is dumped every
5 seconds.
- Added Ctrl+Alt+y shortcut used to deactivate input devices grab for
debug purposes.
nxagent-3.3.0-11
- Changed the message logging the screen size changes, in order to
show the fullscreen state.
- Handle the window unmapping in the nxagentConfigureWindow queue.
nxagent-3.3.0-10 nxagent-3.3.0-10
- Fixed TR12F02146. Compare the drawable and the bitmap data before - Fixed TR12F02146. Compare the drawable and the bitmap data before
......
...@@ -803,6 +803,11 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate) ...@@ -803,6 +803,11 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
nxagentLastEventTime = GetTimeInMillis(); nxagentLastEventTime = GetTimeInMillis();
if (x.u.keyButtonPointer.time > nxagentLastEventTime)
{
x.u.keyButtonPointer.time = nxagentLastEventTime;
}
if (!(nxagentCheckSpecialKeystroke(&X.xkey, &result))) if (!(nxagentCheckSpecialKeystroke(&X.xkey, &result)))
{ {
mieqEnqueue(&x); mieqEnqueue(&x);
...@@ -4022,4 +4027,180 @@ void nxagentGuessDumpInputInfo(ClientPtr client, Atom property, char *data) ...@@ -4022,4 +4027,180 @@ void nxagentGuessDumpInputInfo(ClientPtr client, Atom property, char *data)
} }
} }
void nxagentDeactivateInputDevicesGrabs()
{
fprintf(stderr, "Info: Deactivating input devices grabs.\n");
if (inputInfo.pointer -> grab)
{
(*inputInfo.pointer -> DeactivateGrab)(inputInfo.pointer);
}
if (inputInfo.keyboard -> grab)
{
(*inputInfo.keyboard -> DeactivateGrab)(inputInfo.keyboard);
}
}
static const char *nxagentGrabStateToString(int state)
{
switch (state)
{
case 0:
return "NOT_GRABBED";
case 1:
return "THAWED";
case 2:
return "THAWED_BOTH";
case 3:
return "FREEZE_NEXT_EVENT";
case 4:
return "FREEZE_BOTH_NEXT_EVENT";
case 5:
return "FROZEN_NO_EVENT";
case 6:
return "FROZEN_WITH_EVENT";
case 7:
return "THAW_OTHERS";
default:
return "unknown state";
}
}
void nxagentDumpInputDevicesState(void)
{
int i, k;
int mask = 1;
CARD8 val;
DeviceIntPtr dev;
GrabPtr grab;
WindowPtr pWin = NULL;
fprintf(stderr, "\n*** Dump input devices state: BEGIN ***"
"\nKeys down:");
dev = inputInfo.keyboard;
for (i = 0; i < DOWN_LENGTH; i++)
{
val = dev -> key -> down[i];
if (val != 0)
{
for (k = 0; k < 8; k++)
{
if (val & (mask << k))
{
fprintf(stderr, "\n\t[%d] [%s]", i * 8 + k,
XKeysymToString(XKeycodeToKeysym(nxagentDisplay, i * 8 + k, 0)));
}
}
}
}
fprintf(stderr, "\nKeyboard device state: \n\tdevice [%p]\n\tlast grab time [%lu]"
"\n\tfrozen [%s]\n\tstate [%s]\n\tother [%p]\n\tevent count [%d]"
"\n\tfrom passive grab [%s]\n\tactivating key [%d]", dev,
dev -> grabTime.milliseconds, dev -> sync.frozen ? "Yes": "No",
nxagentGrabStateToString(dev -> sync.state),
dev -> sync.other, dev -> sync.evcount,
dev -> fromPassiveGrab ? "Yes" : "No",
dev -> activatingKey);
grab = dev -> grab;
if (grab)
{
fprintf(stderr, "\nKeyboard grab state: \n\twindow pointer [%p]"
"\n\towner events flag [%s]\n\tgrab mode [%s]",
grab -> window, grab -> ownerEvents ? "True" : "False",
grab -> keyboardMode ? "asynchronous" : "synchronous");
/*
* Passive grabs.
*/
pWin = grab -> window;
grab = wPassiveGrabs(pWin);
while (grab)
{
fprintf(stderr, "\nPassive grab state: \n\tdevice [%p]\n\towner events flag [%s]"
"\n\tpointer grab mode [%s]\n\tkeyboard grab mode [%s]\n\tevent type [%d]"
"\n\tmodifiers [%x]\n\tbutton/key [%u]\n\tevent mask [%lx]",
grab -> device, grab -> ownerEvents ? "True" : "False",
grab -> pointerMode ? "asynchronous" : "synchronous",
grab -> keyboardMode ? "asynchronous" : "synchronous",
grab -> type, grab -> modifiersDetail.exact,
grab -> detail.exact, grab -> eventMask);
grab = grab -> next;
}
}
fprintf(stderr, "\nButtons down:");
dev = inputInfo.pointer;
for (i = 0; i < DOWN_LENGTH; i++)
{
val = dev -> button -> down[i];
if (val != 0)
{
for (k = 0; k < 8; k++)
{
if (val & (mask << k))
{
fprintf(stderr, "\n\t[%d]", i * 8 + k);
}
}
}
}
fprintf(stderr, "\nPointer device state: \n\tdevice [%p]\n\tlast grab time [%lu]"
"\n\tfrozen [%s]\n\tstate [%s]\n\tother [%p]\n\tevent count [%d]"
"\n\tfrom passive grab [%s]\n\tactivating button [%d]", dev,
dev -> grabTime.milliseconds, dev -> sync.frozen ? "Yes" : "No",
nxagentGrabStateToString(dev -> sync.state),
dev -> sync.other, dev -> sync.evcount,
dev -> fromPassiveGrab ? "Yes" : "No",
dev -> activatingKey);
grab = dev -> grab;
if (grab)
{
fprintf(stderr, "\nPointer grab state: \n\twindow pointer [%p]"
"\n\towner events flag [%s]\n\tgrab mode [%s]",
grab -> window, grab -> ownerEvents ? "True" : "False",
grab -> pointerMode ? "asynchronous" : "synchronous");
if (grab -> window != pWin)
{
/*
* Passive grabs.
*/
grab = wPassiveGrabs(grab -> window);
while (grab)
{
fprintf(stderr, "\nPassive grab state: \n\tdevice [%p]\n\towner events flag [%s]"
"\n\tpointer grab mode [%s]\n\tkeyboard grab mode [%s]\n\tevent type [%d]"
"\n\tmodifiers [%x]\n\tbutton/key [%u]\n\tevent mask [%lx]",
grab -> device, grab -> ownerEvents ? "True" : "False",
grab -> pointerMode ? "asynchronous" : "synchronous",
grab -> keyboardMode ? "asynchronous" : "synchronous",
grab -> type, grab -> modifiersDetail.exact,
grab -> detail.exact, grab -> eventMask);
grab = grab -> next;
}
}
}
fprintf(stderr, "\n*** Dump input devices state: FINISH ***\n");
}
#endif #endif
...@@ -105,6 +105,13 @@ ...@@ -105,6 +105,13 @@
#define MINIMUM_DISPLAY_BUFFER 512 #define MINIMUM_DISPLAY_BUFFER 512
#ifdef NX_DEBUG_INPUT
extern int nxagentDebugInputDevices;
extern unsigned long nxagentLastInputDevicesDumpTime;
extern void nxagentDumpInputDevicesState(void);
#endif
/* /*
* Used in the handling of the X desktop * Used in the handling of the X desktop
* manager protocol. * manager protocol.
...@@ -186,6 +193,18 @@ void nxagentBlockHandler(pointer data, struct timeval **timeout, pointer mask) ...@@ -186,6 +193,18 @@ void nxagentBlockHandler(pointer data, struct timeval **timeout, pointer mask)
now = GetTimeInMillis(); now = GetTimeInMillis();
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInputDevices == 1 &&
now - nxagentLastInputDevicesDumpTime > 5000)
{
nxagentLastInputDevicesDumpTime = now;
nxagentDumpInputDevicesState();
}
#endif
if (nxagentNeedConnectionChange() == 1) if (nxagentNeedConnectionChange() == 1)
{ {
#ifdef TEST #ifdef TEST
...@@ -540,6 +559,8 @@ void nxagentBlockHandler(pointer data, struct timeval **timeout, pointer mask) ...@@ -540,6 +559,8 @@ void nxagentBlockHandler(pointer data, struct timeval **timeout, pointer mask)
#endif #endif
nxagentPrintGeometry();
#ifdef BLOCKS #ifdef BLOCKS
fprintf(stderr, "[End block]\n"); fprintf(stderr, "[End block]\n");
#endif #endif
...@@ -820,6 +841,8 @@ FIXME: Must queue multiple writes and handle ...@@ -820,6 +841,8 @@ FIXME: Must queue multiple writes and handle
#endif #endif
nxagentPrintGeometry();
#ifdef BLOCKS #ifdef BLOCKS
fprintf(stderr, "[End block]\n"); fprintf(stderr, "[End block]\n");
#endif #endif
......
...@@ -31,6 +31,12 @@ ...@@ -31,6 +31,12 @@
extern Bool nxagentWMIsRunning; extern Bool nxagentWMIsRunning;
extern Bool nxagentIpaq; extern Bool nxagentIpaq;
#ifdef NX_DEBUG_INPUT
int nxagentDebugInputDevices = 0;
unsigned long nxagentLastInputDevicesDumpTime = 0;
extern void nxagentDeactivateInputDevicesGrabs();
#endif
/* /*
* Set here the required log level. * Set here the required log level.
*/ */
...@@ -209,6 +215,53 @@ int nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result) ...@@ -209,6 +215,53 @@ int nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result)
} }
#endif #endif
#ifdef NX_DEBUG_INPUT
case XK_X:
case XK_x:
{
/*
* Used to test the input devices state.
*/
if (X -> type == KeyPress)
{
if (nxagentDebugInputDevices == 0)
{
fprintf(stderr, "Info: Turning input devices debug ON.\n");
nxagentDebugInputDevices = 1;
}
else
{
fprintf(stderr, "Info: Turning input devices debug OFF.\n");
nxagentDebugInputDevices = 0;
nxagentLastInputDevicesDumpTime = 0;
}
}
return 1;
}
case XK_Y:
case XK_y:
{
/*
* Used to deactivate input devices grab.
*/
if (X -> type == KeyPress)
{
nxagentDeactivateInputDevicesGrabs();
}
return 1;
}
#endif
} }
} }
......
...@@ -39,6 +39,11 @@ AgentOptionsRec nxagentOptionsBackup; ...@@ -39,6 +39,11 @@ AgentOptionsRec nxagentOptionsBackup;
AgentOptionsPtr nxagentOptionsPtr = &nxagentOptions; AgentOptionsPtr nxagentOptionsPtr = &nxagentOptions;
/* /*
* If this is set, print the geometry in the block handler.
*/
unsigned int nxagentPrintGeometryFlags = 0;
/*
* This must be called at startup to initialize * This must be called at startup to initialize
* the options repository to the default values. * the options repository to the default values.
*/ */
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#define UNDEFINED -1 #define UNDEFINED -1
#define COPY_UNLIMITED -1 #define COPY_UNLIMITED -1
extern unsigned int nxagentPrintGeometryFlags;
typedef enum _BackingStoreMode typedef enum _BackingStoreMode
{ {
BackingStoreUndefined = -1, BackingStoreUndefined = -1,
......
...@@ -257,7 +257,11 @@ TODO: This should be reset only when ...@@ -257,7 +257,11 @@ TODO: This should be reset only when
if ((dispatchException & DE_TERMINATE) == 0) if ((dispatchException & DE_TERMINATE) == 0)
{ {
#ifdef NX_DEBUG_INPUT
fprintf(stderr, "Session: Session suspended at '%s' timestamp [%lu].\n", GetTimeAsString(), GetTimeInMillis());
#else
fprintf(stderr, "Session: Session suspended at '%s'.\n", GetTimeAsString()); fprintf(stderr, "Session: Session suspended at '%s'.\n", GetTimeAsString());
#endif
} }
nxagentResetDisplayHandlers(); nxagentResetDisplayHandlers();
...@@ -609,7 +613,11 @@ Bool nxagentReconnectSession(void) ...@@ -609,7 +613,11 @@ Bool nxagentReconnectSession(void)
goto nxagentReconnectError; goto nxagentReconnectError;
} }
#ifdef NX_DEBUG_INPUT
fprintf(stderr, "Session: Session resumed at '%s' timestamp [%lu].\n", GetTimeAsString(), GetTimeInMillis());
#else
fprintf(stderr, "Session: Session resumed at '%s'.\n", GetTimeAsString()); fprintf(stderr, "Session: Session resumed at '%s'.\n", GetTimeAsString());
#endif
nxagentRemoveSplashWindow(NULL); nxagentRemoveSplashWindow(NULL);
......
...@@ -2373,8 +2373,7 @@ FIXME: We should try to restore the previously ...@@ -2373,8 +2373,7 @@ FIXME: We should try to restore the previously
nxagentPrintAgentGeometry("After Resize Screen", "nxagentResizeScreen:"); nxagentPrintAgentGeometry("After Resize Screen", "nxagentResizeScreen:");
#endif #endif
fprintf(stderr, "Info: Screen [%d] resized to geometry [%dx%d].\n", nxagentSetPrintGeometry(pScreen -> myNum);
pScreen -> myNum, width, height);
return 1; return 1;
...@@ -3903,6 +3902,24 @@ void nxagentShadowAdaptToRatio(void) ...@@ -3903,6 +3902,24 @@ void nxagentShadowAdaptToRatio(void)
REGION_UNINIT(pScreen, &region); REGION_UNINIT(pScreen, &region);
} }
void nxagentPrintGeometry()
{
int i;
for (i = 0; i < screenInfo.numScreens; i++)
{
if (nxagentPrintGeometryFlags && (1 << i))
{
fprintf(stderr, "Info: Screen [%d] resized to geometry [%dx%d] "
"fullscreen [%d].\n", i, screenInfo.screens[i] -> width,
screenInfo.screens[i] -> height,
nxagentOption(Fullscreen));
}
}
nxagentPrintGeometryFlags = 0;
}
#ifdef DUMP #ifdef DUMP
void nxagentShowPixmap(PixmapPtr pPixmap, int x, int y, int width, int height) void nxagentShowPixmap(PixmapPtr pPixmap, int x, int y, int width, int height)
......
...@@ -36,6 +36,9 @@ is" without express or implied warranty. ...@@ -36,6 +36,9 @@ is" without express or implied warranty.
#define MIN_NXAGENT_HEIGHT 60 #define MIN_NXAGENT_HEIGHT 60
#define NXAGENT_FRAME_WIDTH 2000 #define NXAGENT_FRAME_WIDTH 2000
#define nxagentSetPrintGeometry(screen) \
nxagentPrintGeometryFlags = (1 << (screen));
extern int nxagentClients; extern int nxagentClients;
extern int nxagentAutoDisconnectTimeout; extern int nxagentAutoDisconnectTimeout;
......
...@@ -908,6 +908,8 @@ void nxagentSwitchFullscreen(ScreenPtr pScreen, Bool switchOn) ...@@ -908,6 +908,8 @@ void nxagentSwitchFullscreen(ScreenPtr pScreen, Bool switchOn)
XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0, XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0,
nxagentOption(Width), nxagentOption(Height)); nxagentOption(Width), nxagentOption(Height));
nxagentSetPrintGeometry(pScreen -> myNum);
} }
#ifdef VIEWPORT_FRAME #ifdef VIEWPORT_FRAME
......
...@@ -515,7 +515,11 @@ Dispatch(void) ...@@ -515,7 +515,11 @@ Dispatch(void)
if (serverGeneration > nxagentMaxAllowedResets) if (serverGeneration > nxagentMaxAllowedResets)
{ {
#ifdef NX_DEBUG_INPUT
fprintf(stderr, "Session: Session started at '%s' timestamp [%lu].\n", GetTimeAsString(), GetTimeInMillis());
#else
fprintf(stderr, "Session: Session started at '%s'.\n", GetTimeAsString()); fprintf(stderr, "Session: Session started at '%s'.\n", GetTimeAsString());
#endif
nxagentSessionState = SESSION_UP; nxagentSessionState = SESSION_UP;
} }
......
...@@ -515,7 +515,11 @@ Dispatch(void) ...@@ -515,7 +515,11 @@ Dispatch(void)
if (serverGeneration > nxagentMaxAllowedResets) if (serverGeneration > nxagentMaxAllowedResets)
{ {
#ifdef NX_DEBUG_INPUT
fprintf(stderr, "Session: Session started at '%s' timestamp [%lu].\n", GetTimeAsString(), GetTimeInMillis());
#else
fprintf(stderr, "Session: Session started at '%s'.\n", GetTimeAsString()); fprintf(stderr, "Session: Session started at '%s'.\n", GetTimeAsString());
#endif
nxagentSessionState = SESSION_UP; nxagentSessionState = SESSION_UP;
} }
......
...@@ -191,6 +191,7 @@ xEvent *xeviexE; ...@@ -191,6 +191,7 @@ xEvent *xeviexE;
#ifdef NX_DEBUG_INPUT #ifdef NX_DEBUG_INPUT
extern int nxagentDebugInput; extern int nxagentDebugInput;
extern int nxagentDebugInputDevices;
#endif #endif
extern Display *nxagentDisplay; extern Display *nxagentDisplay;
...@@ -1865,6 +1866,12 @@ DeliverEventsToWindow(register WindowPtr pWin, xEvent *pEvents, int count, ...@@ -1865,6 +1866,12 @@ DeliverEventsToWindow(register WindowPtr pWin, xEvent *pEvents, int count,
tempGrab.pointerMode = GrabModeAsync; tempGrab.pointerMode = GrabModeAsync;
tempGrab.confineTo = NullWindow; tempGrab.confineTo = NullWindow;
tempGrab.cursor = NullCursor; tempGrab.cursor = NullCursor;
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "DeliverEventsToWindow: Activating passive grab on pointer.\n");
}
#endif
(*inputInfo.pointer->ActivateGrab)(inputInfo.pointer, &tempGrab, (*inputInfo.pointer->ActivateGrab)(inputInfo.pointer, &tempGrab,
currentTime, TRUE); currentTime, TRUE);
} }
...@@ -2735,6 +2742,13 @@ CheckPassiveGrabsOnWindow( ...@@ -2735,6 +2742,13 @@ CheckPassiveGrabsOnWindow(
tempGrab.modifiersDetail.exact&(~0x1f00); tempGrab.modifiersDetail.exact&(~0x1f00);
} }
#endif #endif
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "CheckPassiveGrabsOnWindow: Activating passive grab on %s.\n",
device == inputInfo.keyboard ? "keyboard" : "pointer");
}
#endif
(*device->ActivateGrab)(device, grab, currentTime, TRUE); (*device->ActivateGrab)(device, grab, currentTime, TRUE);
FixUpEventFromWindow(xE, grab->window, None, TRUE); FixUpEventFromWindow(xE, grab->window, None, TRUE);
...@@ -3093,7 +3107,17 @@ drawable.id:0; ...@@ -3093,7 +3107,17 @@ drawable.id:0;
else else
DeliverFocusedEvent(keybd, xE, sprite.win, count); DeliverFocusedEvent(keybd, xE, sprite.win, count);
if (deactivateGrab) if (deactivateGrab)
#ifdef NX_DEBUG_INPUT
{
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcessKeyboardEvent: Deactivating grab on keyboard.\n");
}
#endif
(*keybd->DeactivateGrab)(keybd); (*keybd->DeactivateGrab)(keybd);
#ifdef NX_DEBUG_INPUT
}
#endif
} }
#ifdef XKB #ifdef XKB
...@@ -3320,7 +3344,17 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count ...@@ -3320,7 +3344,17 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
mouse, count); mouse, count);
#endif #endif
if (deactivateGrab) if (deactivateGrab)
#ifdef NX_DEBUG_INPUT
{
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcessPointerEvent: Deactivating grab on pointer.\n");
}
#endif
(*mouse->DeactivateGrab)(mouse); (*mouse->DeactivateGrab)(mouse);
#ifdef NX_DEBUG_INPUT
}
#endif
} }
#define AtMostOneClient \ #define AtMostOneClient \
...@@ -4041,6 +4075,12 @@ ProcGrabPointer(ClientPtr client) ...@@ -4041,6 +4075,12 @@ ProcGrabPointer(ClientPtr client)
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
if (!pWin) if (!pWin)
return BadWindow; return BadWindow;
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcGrabPointer: pWin [%p] client [%d].\n", pWin, client -> index);
}
#endif
if (stuff->confineTo == None) if (stuff->confineTo == None)
confineTo = NullWindow; confineTo = NullWindow;
else else
...@@ -4100,6 +4140,12 @@ ProcGrabPointer(ClientPtr client) ...@@ -4100,6 +4140,12 @@ ProcGrabPointer(ClientPtr client)
tempGrab.keyboardMode = stuff->keyboardMode; tempGrab.keyboardMode = stuff->keyboardMode;
tempGrab.pointerMode = stuff->pointerMode; tempGrab.pointerMode = stuff->pointerMode;
tempGrab.device = device; tempGrab.device = device;
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcGrabPointer: Activating active grab on pointer.\n");
}
#endif
(*device->ActivateGrab)(device, &tempGrab, time, FALSE); (*device->ActivateGrab)(device, &tempGrab, time, FALSE);
if (oldCursor) if (oldCursor)
FreeCursor (oldCursor, (Cursor)0); FreeCursor (oldCursor, (Cursor)0);
...@@ -4163,6 +4209,12 @@ ProcUngrabPointer(ClientPtr client) ...@@ -4163,6 +4209,12 @@ ProcUngrabPointer(ClientPtr client)
TimeStamp time; TimeStamp time;
REQUEST(xResourceReq); REQUEST(xResourceReq);
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcUngrabPointer: client [%d].\n", client -> index);
}
#endif
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
UpdateCurrentTime(); UpdateCurrentTime();
grab = device->grab; grab = device->grab;
...@@ -4170,7 +4222,25 @@ ProcUngrabPointer(ClientPtr client) ...@@ -4170,7 +4222,25 @@ ProcUngrabPointer(ClientPtr client)
if ((CompareTimeStamps(time, currentTime) != LATER) && if ((CompareTimeStamps(time, currentTime) != LATER) &&
(CompareTimeStamps(time, device->grabTime) != EARLIER) && (CompareTimeStamps(time, device->grabTime) != EARLIER) &&
(grab) && SameClient(grab, client)) (grab) && SameClient(grab, client))
#ifdef NX_DEBUG_INPUT
{
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcUngrabPointer: Deactivating grab on pointer.\n");
}
#endif
(*device->DeactivateGrab)(device); (*device->DeactivateGrab)(device);
#ifdef NX_DEBUG_INPUT
}
else
{
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcUngrabPointer: current time [%lu] request time [%lu] grab time [%lu].\n",
currentTime.milliseconds, time.milliseconds, device->grabTime.milliseconds);
}
}
#endif
return Success; return Success;
} }
...@@ -4225,6 +4295,12 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev, ...@@ -4225,6 +4295,12 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev,
tempGrab.pointerMode = other_mode; tempGrab.pointerMode = other_mode;
tempGrab.eventMask = mask; tempGrab.eventMask = mask;
tempGrab.device = dev; tempGrab.device = dev;
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "GrabDevice: Activating active grab on keyboard.\n");
}
#endif
(*dev->ActivateGrab)(dev, &tempGrab, time, FALSE); (*dev->ActivateGrab)(dev, &tempGrab, time, FALSE);
*status = GrabSuccess; *status = GrabSuccess;
} }
...@@ -4238,6 +4314,12 @@ ProcGrabKeyboard(ClientPtr client) ...@@ -4238,6 +4314,12 @@ ProcGrabKeyboard(ClientPtr client)
REQUEST(xGrabKeyboardReq); REQUEST(xGrabKeyboardReq);
int result; int result;
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcGrabKeyboard: client [%d].\n", client -> index);
}
#endif
REQUEST_SIZE_MATCH(xGrabKeyboardReq); REQUEST_SIZE_MATCH(xGrabKeyboardReq);
#ifdef XCSECURITY #ifdef XCSECURITY
if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE)) if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE))
...@@ -4268,6 +4350,12 @@ ProcUngrabKeyboard(ClientPtr client) ...@@ -4268,6 +4350,12 @@ ProcUngrabKeyboard(ClientPtr client)
TimeStamp time; TimeStamp time;
REQUEST(xResourceReq); REQUEST(xResourceReq);
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcUngrabKeyboard: client [%d].\n", client -> index);
}
#endif
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
UpdateCurrentTime(); UpdateCurrentTime();
grab = device->grab; grab = device->grab;
...@@ -4275,7 +4363,25 @@ ProcUngrabKeyboard(ClientPtr client) ...@@ -4275,7 +4363,25 @@ ProcUngrabKeyboard(ClientPtr client)
if ((CompareTimeStamps(time, currentTime) != LATER) && if ((CompareTimeStamps(time, currentTime) != LATER) &&
(CompareTimeStamps(time, device->grabTime) != EARLIER) && (CompareTimeStamps(time, device->grabTime) != EARLIER) &&
(grab) && SameClient(grab, client)) (grab) && SameClient(grab, client))
#ifdef NX_DEBUG_INPUT
{
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcUngrabKeyboard: Deactivating grab on keyboard.\n");
}
#endif
(*device->DeactivateGrab)(device); (*device->DeactivateGrab)(device);
#ifdef NX_DEBUG_INPUT
}
else
{
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcUngrabKeyboard: current time [%lu] request time [%lu] grab time [%lu].\n",
currentTime.milliseconds, time.milliseconds, device->grabTime.milliseconds);
}
}
#endif
return Success; return Success;
} }
......
...@@ -191,6 +191,7 @@ xEvent *xeviexE; ...@@ -191,6 +191,7 @@ xEvent *xeviexE;
#ifdef NX_DEBUG_INPUT #ifdef NX_DEBUG_INPUT
extern int nxagentDebugInput; extern int nxagentDebugInput;
extern int nxagentDebugInputDevices;
#endif #endif
extern Display *nxagentDisplay; extern Display *nxagentDisplay;
...@@ -1865,6 +1866,12 @@ DeliverEventsToWindow(register WindowPtr pWin, xEvent *pEvents, int count, ...@@ -1865,6 +1866,12 @@ DeliverEventsToWindow(register WindowPtr pWin, xEvent *pEvents, int count,
tempGrab.pointerMode = GrabModeAsync; tempGrab.pointerMode = GrabModeAsync;
tempGrab.confineTo = NullWindow; tempGrab.confineTo = NullWindow;
tempGrab.cursor = NullCursor; tempGrab.cursor = NullCursor;
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "DeliverEventsToWindow: Activating passive grab on pointer.\n");
}
#endif
(*inputInfo.pointer->ActivateGrab)(inputInfo.pointer, &tempGrab, (*inputInfo.pointer->ActivateGrab)(inputInfo.pointer, &tempGrab,
currentTime, TRUE); currentTime, TRUE);
} }
...@@ -2735,6 +2742,13 @@ CheckPassiveGrabsOnWindow( ...@@ -2735,6 +2742,13 @@ CheckPassiveGrabsOnWindow(
tempGrab.modifiersDetail.exact&(~0x1f00); tempGrab.modifiersDetail.exact&(~0x1f00);
} }
#endif #endif
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "CheckPassiveGrabsOnWindow: Activating passive grab on %s.\n",
device == inputInfo.keyboard ? "keyboard" : "pointer");
}
#endif
(*device->ActivateGrab)(device, grab, currentTime, TRUE); (*device->ActivateGrab)(device, grab, currentTime, TRUE);
FixUpEventFromWindow(xE, grab->window, None, TRUE); FixUpEventFromWindow(xE, grab->window, None, TRUE);
...@@ -3093,7 +3107,17 @@ drawable.id:0; ...@@ -3093,7 +3107,17 @@ drawable.id:0;
else else
DeliverFocusedEvent(keybd, xE, sprite.win, count); DeliverFocusedEvent(keybd, xE, sprite.win, count);
if (deactivateGrab) if (deactivateGrab)
#ifdef NX_DEBUG_INPUT
{
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcessKeyboardEvent: Deactivating grab on keyboard.\n");
}
#endif
(*keybd->DeactivateGrab)(keybd); (*keybd->DeactivateGrab)(keybd);
#ifdef NX_DEBUG_INPUT
}
#endif
} }
#ifdef XKB #ifdef XKB
...@@ -3320,7 +3344,17 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count ...@@ -3320,7 +3344,17 @@ ProcessPointerEvent (register xEvent *xE, register DeviceIntPtr mouse, int count
mouse, count); mouse, count);
#endif #endif
if (deactivateGrab) if (deactivateGrab)
#ifdef NX_DEBUG_INPUT
{
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcessPointerEvent: Deactivating grab on pointer.\n");
}
#endif
(*mouse->DeactivateGrab)(mouse); (*mouse->DeactivateGrab)(mouse);
#ifdef NX_DEBUG_INPUT
}
#endif
} }
#define AtMostOneClient \ #define AtMostOneClient \
...@@ -4041,6 +4075,12 @@ ProcGrabPointer(ClientPtr client) ...@@ -4041,6 +4075,12 @@ ProcGrabPointer(ClientPtr client)
pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess); pWin = SecurityLookupWindow(stuff->grabWindow, client, SecurityReadAccess);
if (!pWin) if (!pWin)
return BadWindow; return BadWindow;
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcGrabPointer: pWin [%p] client [%d].\n", pWin, client -> index);
}
#endif
if (stuff->confineTo == None) if (stuff->confineTo == None)
confineTo = NullWindow; confineTo = NullWindow;
else else
...@@ -4100,6 +4140,12 @@ ProcGrabPointer(ClientPtr client) ...@@ -4100,6 +4140,12 @@ ProcGrabPointer(ClientPtr client)
tempGrab.keyboardMode = stuff->keyboardMode; tempGrab.keyboardMode = stuff->keyboardMode;
tempGrab.pointerMode = stuff->pointerMode; tempGrab.pointerMode = stuff->pointerMode;
tempGrab.device = device; tempGrab.device = device;
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcGrabPointer: Activating active grab on pointer.\n");
}
#endif
(*device->ActivateGrab)(device, &tempGrab, time, FALSE); (*device->ActivateGrab)(device, &tempGrab, time, FALSE);
if (oldCursor) if (oldCursor)
FreeCursor (oldCursor, (Cursor)0); FreeCursor (oldCursor, (Cursor)0);
...@@ -4163,6 +4209,12 @@ ProcUngrabPointer(ClientPtr client) ...@@ -4163,6 +4209,12 @@ ProcUngrabPointer(ClientPtr client)
TimeStamp time; TimeStamp time;
REQUEST(xResourceReq); REQUEST(xResourceReq);
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcUngrabPointer: client [%d].\n", client -> index);
}
#endif
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
UpdateCurrentTime(); UpdateCurrentTime();
grab = device->grab; grab = device->grab;
...@@ -4170,7 +4222,25 @@ ProcUngrabPointer(ClientPtr client) ...@@ -4170,7 +4222,25 @@ ProcUngrabPointer(ClientPtr client)
if ((CompareTimeStamps(time, currentTime) != LATER) && if ((CompareTimeStamps(time, currentTime) != LATER) &&
(CompareTimeStamps(time, device->grabTime) != EARLIER) && (CompareTimeStamps(time, device->grabTime) != EARLIER) &&
(grab) && SameClient(grab, client)) (grab) && SameClient(grab, client))
#ifdef NX_DEBUG_INPUT
{
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcUngrabPointer: Deactivating grab on pointer.\n");
}
#endif
(*device->DeactivateGrab)(device); (*device->DeactivateGrab)(device);
#ifdef NX_DEBUG_INPUT
}
else
{
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcUngrabPointer: current time [%lu] request time [%lu] grab time [%lu].\n",
currentTime.milliseconds, time.milliseconds, device->grabTime.milliseconds);
}
}
#endif
return Success; return Success;
} }
...@@ -4225,6 +4295,12 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev, ...@@ -4225,6 +4295,12 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev,
tempGrab.pointerMode = other_mode; tempGrab.pointerMode = other_mode;
tempGrab.eventMask = mask; tempGrab.eventMask = mask;
tempGrab.device = dev; tempGrab.device = dev;
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "GrabDevice: Activating active grab on keyboard.\n");
}
#endif
(*dev->ActivateGrab)(dev, &tempGrab, time, FALSE); (*dev->ActivateGrab)(dev, &tempGrab, time, FALSE);
*status = GrabSuccess; *status = GrabSuccess;
} }
...@@ -4238,6 +4314,12 @@ ProcGrabKeyboard(ClientPtr client) ...@@ -4238,6 +4314,12 @@ ProcGrabKeyboard(ClientPtr client)
REQUEST(xGrabKeyboardReq); REQUEST(xGrabKeyboardReq);
int result; int result;
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcGrabKeyboard: client [%d].\n", client -> index);
}
#endif
REQUEST_SIZE_MATCH(xGrabKeyboardReq); REQUEST_SIZE_MATCH(xGrabKeyboardReq);
#ifdef XCSECURITY #ifdef XCSECURITY
if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE)) if (!SecurityCheckDeviceAccess(client, inputInfo.keyboard, TRUE))
...@@ -4268,6 +4350,12 @@ ProcUngrabKeyboard(ClientPtr client) ...@@ -4268,6 +4350,12 @@ ProcUngrabKeyboard(ClientPtr client)
TimeStamp time; TimeStamp time;
REQUEST(xResourceReq); REQUEST(xResourceReq);
#ifdef NX_DEBUG_INPUT
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcUngrabKeyboard: client [%d].\n", client -> index);
}
#endif
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
UpdateCurrentTime(); UpdateCurrentTime();
grab = device->grab; grab = device->grab;
...@@ -4275,7 +4363,25 @@ ProcUngrabKeyboard(ClientPtr client) ...@@ -4275,7 +4363,25 @@ ProcUngrabKeyboard(ClientPtr client)
if ((CompareTimeStamps(time, currentTime) != LATER) && if ((CompareTimeStamps(time, currentTime) != LATER) &&
(CompareTimeStamps(time, device->grabTime) != EARLIER) && (CompareTimeStamps(time, device->grabTime) != EARLIER) &&
(grab) && SameClient(grab, client)) (grab) && SameClient(grab, client))
#ifdef NX_DEBUG_INPUT
{
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcUngrabKeyboard: Deactivating grab on keyboard.\n");
}
#endif
(*device->DeactivateGrab)(device); (*device->DeactivateGrab)(device);
#ifdef NX_DEBUG_INPUT
}
else
{
if (nxagentDebugInputDevices == 1)
{
fprintf(stderr, "ProcUngrabKeyboard: current time [%lu] request time [%lu] grab time [%lu].\n",
currentTime.milliseconds, time.milliseconds, device->grabTime.milliseconds);
}
}
#endif
return Success; return Success;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment