aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Events.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Events.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Events.c603
1 files changed, 35 insertions, 568 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c
index b9da934d6..83665ff90 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Events.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c
@@ -1,6 +1,6 @@
/**************************************************************************/
/* */
-/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* Copyright (c) 2001, 2009 NoMachine, http://www.nomachine.com/. */
/* */
/* NXAGENT, NX protocol compression and NX extensions to this software */
/* are copyright of NoMachine. Redistribution and use of the present */
@@ -76,9 +76,7 @@
#include "input.h"
#endif
-#define Time XlibXID
#include "XKBlib.h"
-#undef Time
#define GC XlibGC
#define Font XlibFont
@@ -221,16 +219,6 @@ static void nxagentForwardRemoteExpose(void);
static int nxagentClipAndSendExpose(WindowPtr pWin, pointer ptr);
/*
- * This is from NXproperty.c.
- */
-
-int GetWindowProperty(WindowPtr pWin, Atom property, long longOffset,
- long longLength, Bool delete, Atom type,
- Atom *actualType, int *format, unsigned
- long *nItems, unsigned long *bytesAfter,
- unsigned char **propData);
-
-/*
* Associate a resource to a drawable and
* store the region affected by the split
* operation.
@@ -286,280 +274,6 @@ void ProcessInputEvents()
mieqProcessInputEvents();
}
-#ifdef DEBUG_TREE
-
-/*
- * Print ID and name of window.
- */
-
-void nxagentRemoteWindowID(Window window, Bool newline)
-{
-#ifdef NO_I18N
- char *winName;
-#else
- XTextProperty tp;
-#endif
-
- fprintf(stderr, "0x%lx", window);
-
- if (!window)
- {
- fprintf(stderr, " (none) ");
- }
- else
- {
- if (window == DefaultRootWindow(nxagentDisplay))
- {
- fprintf(stderr, " (the root window) ");
- }
-
-#ifdef NO_I18N
-
- if (!XFetchName(nxagentDisplay, window, &winName))
- {
- fprintf(stderr, " (has no name) ");
- }
- else if (winName)
- {
- fprintf(stderr, " \"%s\" ", winName);
- XFree(winName);
- }
-
-#else
-
- if (XGetWMName(nxagentDisplay, window, &tp) != 0)
- {
- fprintf(stderr, " (has no name) ");
- }
- else if (tp.nitems > 0)
- {
- int count = 0;
- int i, ret;
- char **list = NULL;
-
- fprintf(stderr, " \"");
-
- ret = XmbTextPropertyToTextList(nxagentDisplay, &tp, &list, &count);
-
- if ((ret == Success || ret > 0) && list != NULL)
- {
- for (i = 0; i < count; i++)
- {
- fprintf(stderr, "%s", list[i]);
- }
-
- XFreeStringList(list);
- }
- else
- {
- fprintf(stderr, "%s", tp.value);
- }
-
- fprintf(stderr, "\" ");
- }
-
-#endif
-
- else
- {
- fprintf(stderr, " (has no name) ");
- }
- }
-
- if (newline == TRUE)
- {
- fprintf(stderr, "\n");
- }
-
- return;
-}
-
-/*
- * Print info about remote window.
- */
-
-void nxagentRemoteWindowInfo(Window win, int indent, Bool newLine)
-{
- XWindowAttributes attributes;
- int i;
-
- if (XGetWindowAttributes(nxagentDisplay, win, &attributes) == 0)
- {
- return;
- }
-
- for (i = 0; i < indent; i++)
- {
- fprintf(stderr, " ");
- }
-
- fprintf(stderr, "x=%d y=%d width=%d height=%d class=%s map_state=%s "
- "override_redirect=%s\n", attributes.x, attributes.y,
- attributes.width, attributes.height, (attributes.class == 0) ?
- "InputOutput" : "InputOnly", (attributes.map_state == 0) ?
- "IsUnmapped" : (attributes.map_state == 1 ?
- "IsUnviewable" : "IsViewable"),
- (attributes.override_redirect == 0) ?
- "No" : "Yes" );
-
- if (newLine == TRUE)
- {
- fprintf(stderr, "\n");
- }
-}
-
-/*
- * Walk remote windows tree.
- */
-
-void nxagentRemoteWindowsTree(Window window, int level)
-{
- int i, j;
- Window rootWin, parentWin;
- unsigned int numChildren;
- Window *childList;
-
- if (!XQueryTree(nxagentDisplay, window, &rootWin, &parentWin, &childList,
- &numChildren))
- {
- fprintf(stderr, "nxagentRemoteWindowsTree - XQueryTree failed.\n");
-
- return;
- }
-
- if (level == 0)
- {
- fprintf(stderr, "\n");
-
- fprintf(stderr, " Root Window ID: ");
- nxagentRemoteWindowID(rootWin, TRUE);
-
- fprintf(stderr, " Parent window ID: ");
- nxagentRemoteWindowID(parentWin, TRUE);
- }
-
- if (level == 0 || numChildren > 0)
- {
- fprintf(stderr, " ");
-
- for (j = 0; j < level; j++)
- {
- fprintf(stderr, " ");
- }
-
- fprintf(stderr, "%d child%s%s\n", numChildren, (numChildren == 1) ? "" :
- "ren", (numChildren == 1) ? ":" : ".");
- }
-
- for (i = (int) numChildren - 1; i >= 0; i--)
- {
- fprintf(stderr, " ");
-
- for (j = 0; j < level; j++)
- {
- fprintf(stderr, " ");
- }
-
- nxagentRemoteWindowID(childList[i], TRUE);
-
- nxagentRemoteWindowInfo(childList[i], (level * 5) + 6, TRUE);
-
- nxagentRemoteWindowsTree(childList[i], level + 1);
- }
-
- if (childList)
- {
- XFree((char *) childList);
- }
-}
-
-/*
- * Print info about internal window.
- */
-
-void nxagentInternalWindowInfo(WindowPtr pWin, int indent, Bool newLine)
-{
- int i;
- int result;
- unsigned long ulReturnItems;
- unsigned long ulReturnBytesLeft;
- Atom atomReturnType;
- int iReturnFormat;
- unsigned char *pszReturnData = NULL;
-
- fprintf(stderr, "Window ID=[0x%lx] Remote ID=[0x%lx] ", pWin -> drawable.id,
- nxagentWindow(pWin));
-
- result = GetWindowProperty(pWin, MakeAtom("WM_NAME", 7, False) , 0,
- sizeof(CARD32), False, AnyPropertyType,
- &atomReturnType, &iReturnFormat,
- &ulReturnItems, &ulReturnBytesLeft,
- &pszReturnData);
-
- fprintf(stderr, "Name: ");
-
- if (result == Success && pszReturnData != NULL)
- {
- pszReturnData[ulReturnItems] = '\0';
-
- fprintf(stderr, "\"%s\"\n", (char *) pszReturnData);
- }
- else
- {
- fprintf(stderr, "%s\n", "( has no name )");
- }
-
- for (i = 0; i < indent; i++)
- {
- fprintf(stderr, " ");
- }
-
- fprintf(stderr, "x=%d y=%d width=%d height=%d class=%s map_state=%s "
- "override_redirect=%s", pWin -> drawable.x, pWin -> drawable.y,
- pWin -> drawable.width, pWin -> drawable.height,
- (pWin -> drawable.class == 0) ? "InputOutput" :
- "InputOnly", (pWin -> mapped == 0) ?
- "IsUnmapped" : (pWin -> mapped == 1 ?
- "IsUnviewable" : "IsViewable"),
- (pWin -> overrideRedirect == 0) ?
- "No" : "Yes");
-
- if (newLine == TRUE)
- {
- fprintf(stderr, "\n");
- }
-}
-
-/*
- * Walk internal windows tree.
- */
-
-void nxagentInternalWindowsTree(WindowPtr pWin, int indent)
-{
- WindowPtr pChild;
- int i;
-
- while (pWin)
- {
- pChild = pWin -> firstChild;
-
- for (i = 0; i < indent; i++)
- {
- fprintf(stderr, " ");
- }
-
- nxagentInternalWindowInfo(pWin, indent, TRUE);
-
- fprintf(stderr, "\n");
-
- nxagentInternalWindowsTree(pChild, indent + 4);
-
- pWin = pWin -> nextSib;
- }
-}
-
-#endif /* DEBUG_TREE */
-
void nxagentSwitchResizeMode(ScreenPtr pScreen)
{
XSizeHints sizeHints;
@@ -576,14 +290,8 @@ void nxagentSwitchResizeMode(ScreenPtr pScreen)
nxagentLaunchDialog(DIALOG_DISABLE_DESKTOP_RESIZE_MODE);
- if (nxagentOption(Fullscreen) == 0)
- {
- sizeHints.max_width = nxagentOption(RootWidth);
- sizeHints.max_height = nxagentOption(RootHeight);
-
- XSetWMNormalHints(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum],
- &sizeHints);
- }
+ sizeHints.max_width = nxagentOption(RootWidth);
+ sizeHints.max_height = nxagentOption(RootHeight);
}
else
{
@@ -591,8 +299,7 @@ void nxagentSwitchResizeMode(ScreenPtr pScreen)
nxagentLaunchDialog(DIALOG_ENABLE_DESKTOP_RESIZE_MODE);
- nxagentRRSetScreenConfig(pScreen, nxagentOption(Width),
- nxagentOption(Height));
+ nxagentRRSetScreenConfig(pScreen, nxagentOption(Width), nxagentOption(Height));
if (nxagentOption(ClientOs) == ClientOsWinnt)
{
@@ -601,10 +308,10 @@ void nxagentSwitchResizeMode(ScreenPtr pScreen)
sizeHints.max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
sizeHints.max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
-
- XSetWMNormalHints(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum],
- &sizeHints);
}
+
+ XSetWMNormalHints(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum],
+ &sizeHints);
}
void nxagentShadowSwitchResizeMode(ScreenPtr pScreen)
@@ -804,7 +511,6 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
Bool startKbd = False;
Bool closeSession = False;
Bool switchFullscreen = False;
- Bool switchAllScreens = False;
/*
* Last entered top level window.
@@ -949,22 +655,6 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
{
break;
}
-
- #ifdef DEBUG_TREE
-
- case doDebugTree:
- {
- fprintf(stderr, "\n ========== nxagentRemoteWindowsTree ==========\n");
- nxagentRemoteWindowsTree(nxagentWindow(WindowTable[0]), 0);
-
- fprintf(stderr, "\n========== nxagentInternalWindowsTree ==========\n");
- nxagentInternalWindowsTree(WindowTable[0], 0);
-
- break;
- }
-
- #endif /* DEBUG_TREE */
-
case doCloseSession:
{
closeSession = TRUE;
@@ -989,36 +679,6 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
break;
}
- case doSwitchAllScreens:
- {
- switchAllScreens = TRUE;
-
- break;
- }
- case doViewportMoveUp:
- {
- nxagentMoveViewport(pScreen, 0, -nxagentOption(Height));
-
- break;
- }
- case doViewportMoveDown:
- {
- nxagentMoveViewport(pScreen, 0, nxagentOption(Height));
-
- break;
- }
- case doViewportMoveLeft:
- {
- nxagentMoveViewport(pScreen, -nxagentOption(Width), 0);
-
- break;
- }
- case doViewportMoveRight:
- {
- nxagentMoveViewport(pScreen, nxagentOption(Width), 0);
-
- break;
- }
case doViewportUp:
{
nxagentMoveViewport(pScreen, 0, -nextinc(viewportInc));
@@ -1095,8 +755,6 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow) == 1 && result == doNothing)
{
- X.xkey.keycode = nxagentConvertKeycode(X.xkey.keycode);
-
NXShadowEvent(nxagentDisplay, X);
}
@@ -1105,27 +763,6 @@ void nxagentDispatchEvents(PredicateFuncPtr predicate)
case KeyRelease:
{
enum HandleEventResult result;
- int sendKey = 0;
-
-/*
-FIXME: If we don't flush the queue here, it could happen
- that the inputInfo structure will not be up to date
- when we perform the following check on down keys.
-*/
- ProcessInputEvents();
-
-/*
-FIXME: Don't enqueue the KeyRelease event if the key was
- not already pressed. This workaround avoids a fake
- KeyPress is enqueued by the XKEYBOARD extension.
- Another solution would be to let the events are
- enqueued and to remove the KeyPress afterwards.
-*/
- if (BitIsOn(inputInfo.keyboard -> key -> down,
- nxagentConvertKeycode(X.xkey.keycode)))
- {
- sendKey = 1;
- }
#ifdef TEST
fprintf(stderr, "nxagentDispatchEvents: Going to handle new KeyRelease event.\n");
@@ -1171,7 +808,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
x.u.keyButtonPointer.time = nxagentLastEventTime;
}
- if (!(nxagentCheckSpecialKeystroke(&X.xkey, &result)) && sendKey == 1)
+ if (!(nxagentCheckSpecialKeystroke(&X.xkey, &result)))
{
mieqEnqueue(&x);
@@ -1179,8 +816,6 @@ FIXME: Don't enqueue the KeyRelease event if the key was
if (nxagentOption(ViewOnly) == 0 && nxagentOption(Shadow))
{
- X.xkey.keycode = nxagentConvertKeycode(X.xkey.keycode);
-
NXShadowEvent(nxagentDisplay, X);
}
}
@@ -1244,7 +879,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
X.xbutton.subwindow == None))
{
x.u.u.type = ButtonPress;
- x.u.u.detail = inputInfo.pointer -> button -> map[nxagentReversePointerMap[X.xbutton.button - 1]];
+ x.u.u.detail = X.xbutton.button;
x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis();
if (nxagentOption(Rootless))
@@ -1317,7 +952,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
if (minimize != True)
{
x.u.u.type = ButtonRelease;
- x.u.u.detail = inputInfo.pointer -> button -> map[nxagentReversePointerMap[X.xbutton.button - 1]];
+ x.u.u.detail = X.xbutton.button;
x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis();
if (nxagentOption(Rootless))
@@ -1671,11 +1306,13 @@ FIXME: Don't enqueue the KeyRelease event if the key was
nxagentScreenTrap = 0;
}
- if (nxagentOption(Fullscreen) == 1 &&
- X.xcrossing.window == nxagentFullscreenWindow &&
- X.xcrossing.detail != NotifyInferior)
+ if (nxagentOption(Fullscreen))
{
- nxagentGrabPointerAndKeyboard(&X);
+ if (X.xcrossing.window == nxagentFullscreenWindow &&
+ X.xcrossing.detail != NotifyInferior)
+ {
+ nxagentGrabPointerAndKeyboard(&X);
+ }
}
if (X.xcrossing.detail != NotifyInferior)
@@ -1724,11 +1361,14 @@ FIXME: Don't enqueue the KeyRelease event if the key was
nxagentLastEnteredWindow = NULL;
}
- if (X.xcrossing.window == nxagentDefaultWindows[0] &&
- X.xcrossing.detail != NotifyInferior &&
- X.xcrossing.mode == NotifyNormal)
+ if (nxagentOption(Fullscreen))
{
- nxagentUngrabPointerAndKeyboard(&X);
+ if (X.xcrossing.window == nxagentFullscreenWindow &&
+ X.xcrossing.detail != NotifyInferior &&
+ X.xcrossing.mode == NotifyNormal)
+ {
+ nxagentUngrabPointerAndKeyboard(&X);
+ }
}
if (X.xcrossing.detail != NotifyInferior)
@@ -1982,8 +1622,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
}
if (nxagentUseNXTrans == 1 && nxagentOption(Rootless) == 0 &&
- nxagentOption(Nested) == 0 &&
- X.xmap.window != nxagentIconWindow)
+ nxagentOption(Nested) == 0 && X.xmap.window != nxagentIconWindow)
{
nxagentVisibility = VisibilityFullyObscured;
}
@@ -2022,17 +1661,14 @@ FIXME: Don't enqueue the KeyRelease event if the key was
}
}
- if (nxagentOption(AllScreens) == 1)
+ if (nxagentOption(Fullscreen) == 1)
{
if (X.xmap.window == nxagentIconWindow)
{
pScreen = nxagentScreen(X.xmap.window);
nxagentMaximizeToFullScreen(pScreen);
}
- }
- if (nxagentOption(Fullscreen) == 1)
- {
nxagentVisibility = VisibilityUnobscured;
nxagentVisibilityStop = False;
nxagentVisibilityTimeout = GetTimeInMillis() + 2000;
@@ -2042,17 +1678,10 @@ FIXME: Don't enqueue the KeyRelease event if the key was
}
case MappingNotify:
{
- XMappingEvent *mappingEvent = (XMappingEvent *) &X;
-
#ifdef DEBUG
fprintf(stderr, "nxagentDispatchEvents: WARNING! Going to handle new MappingNotify event.\n");
#endif
- if (mappingEvent -> request == MappingPointer)
- {
- nxagentInitPointerMap();
- }
-
break;
}
default:
@@ -2126,40 +1755,20 @@ FIXME: Don't enqueue the KeyRelease event if the key was
if (nxagentWMIsRunning)
{
- if (nxagentOption(AllScreens))
+ if (nxagentOption(Fullscreen))
{
nxagentMinimizeFromFullScreen(pScreen);
}
else
{
- XIconifyWindow(nxagentDisplay, nxagentDefaultWindows[0],
- DefaultScreen(nxagentDisplay));
+ XIconifyWindow(nxagentDisplay, nxagentDefaultWindows[0], DefaultScreen(nxagentDisplay));
}
}
}
if (switchFullscreen)
{
- if (nxagentOption(AllScreens) == 1 && nxagentOption(Fullscreen) == 1)
- {
- nxagentSwitchAllScreens(pScreen, 0);
- }
- else
- {
- nxagentSwitchFullscreen(pScreen, !nxagentOption(Fullscreen));
- }
- }
-
- if (switchAllScreens)
- {
- if (nxagentOption(AllScreens) == 0 && nxagentOption(Fullscreen) == 1)
- {
- nxagentSwitchFullscreen(pScreen, 0);
- }
- else
- {
- nxagentSwitchAllScreens(pScreen, !nxagentOption(AllScreens));
- }
+ nxagentSwitchFullscreen(pScreen, !nxagentOption(Fullscreen));
}
if (startKbd)
@@ -2312,16 +1921,8 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result)
return 1;
}
- if (X -> xkey.keycode == 66)
- {
- nxagentXkbState.Caps = (~nxagentXkbState.Caps & 1);
- }
- else if (X -> xkey.keycode == 77)
- {
- nxagentXkbState.Num = (~nxagentXkbState.Num & 1);
- }
-
nxagentLastEventTime = nxagentLastKeyPressTime = GetTimeInMillis();
+
x.u.u.type = KeyPress;
x.u.u.detail = nxagentConvertKeycode(X -> xkey.keycode);
@@ -2759,8 +2360,7 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result)
}
if (X -> xclient.window == (nxagentOption(Fullscreen) ?
- nxagentIconWindow : nxagentDefaultWindows[0]) ||
- nxagentWMIsRunning == 0)
+ nxagentIconWindow : nxagentDefaultWindows[0]))
{
*result = doCloseSession;
}
@@ -3357,7 +2957,7 @@ int nxagentHandleConfigureNotify(XEvent* X)
if (X -> xconfigure.window == nxagentDefaultWindows[pScreen -> myNum])
{
- if (nxagentOption(AllScreens) == 0)
+ if (nxagentOption(Fullscreen) == 0)
{
if (nxagentOption(DesktopResize) == 1)
{
@@ -3426,34 +3026,6 @@ int nxagentHandleConfigureNotify(XEvent* X)
doRandR = 0;
}
- nxagentChangeOption(Width, X -> xconfigure.width);
- nxagentChangeOption(Height, X -> xconfigure.height);
-
- XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0,
- X -> xconfigure.width, X -> xconfigure.height);
-
- if (nxagentOption(Fullscreen) == 0)
- {
- nxagentMoveViewport(pScreen, 0, 0);
- }
- else
- {
- nxagentChangeOption(RootX, (nxagentOption(Width) -
- nxagentOption(RootWidth)) / 2);
- nxagentChangeOption(RootY, (nxagentOption(Height) -
- nxagentOption(RootHeight)) / 2);
- nxagentChangeOption(ViewportXSpan, nxagentOption(Width) -
- nxagentOption(RootWidth));
- nxagentChangeOption(ViewportYSpan, nxagentOption(Height) -
- nxagentOption(RootHeight));
-
- nxagentUpdateViewportFrame(0, 0, nxagentOption(RootWidth),
- nxagentOption(RootHeight));
-
- XMoveWindow(nxagentDisplay, nxagentWindow(WindowTable[pScreen -> myNum]),
- nxagentOption(RootX), nxagentOption(RootY));
- }
-
if (doRandR)
{
#ifdef TEST
@@ -3475,6 +3047,8 @@ int nxagentHandleConfigureNotify(XEvent* X)
int nxagentHandleReparentNotify(XEvent* X)
{
+ ScreenPtr pScreen = nxagentScreen(X -> xreparent.window);
+
#ifdef TEST
fprintf(stderr, "nxagentHandleReparentNotify: Going to handle a new reparent event.\n");
#endif
@@ -3527,8 +3101,6 @@ int nxagentHandleReparentNotify(XEvent* X)
#ifdef WARNING
fprintf(stderr, "nxagentHandleReparentNotify: WARNING! Failed QueryTree request.\n");
#endif
-
- break;
}
if (result && children_return)
@@ -3581,95 +3153,6 @@ int nxagentHandleReparentNotify(XEvent* X)
return 1;
}
- else if (nxagentWMIsRunning == 1 && nxagentOption(Fullscreen) == 0 &&
- nxagentOption(WMBorderWidth) == -1)
- {
- XlibWindow w;
- XlibWindow rootReturn = 0;
- XlibWindow parentReturn = 0;
- XlibWindow junk;
- XlibWindow *childrenReturn = NULL;
- unsigned int nchildrenReturn = 0;
- Status result;
- XWindowAttributes attributes;
- int x, y;
- int xParent, yParent;
-
- /*
- * Calculate the absolute upper-left X e Y
- */
-
- if ((XGetWindowAttributes(nxagentDisplay, X -> xreparent.window,
- &attributes) == 0))
- {
- #ifdef WARNING
- fprintf(stderr, "nxagentHandleReparentNotify: WARNING! "
- "XGetWindowAttributes failed.\n");
- #endif
-
- return 1;
- }
-
- x = attributes.x;
- y = attributes.y;
-
- XTranslateCoordinates(nxagentDisplay, X -> xreparent.window,
- attributes.root, -attributes.border_width,
- -attributes.border_width, &x, &y, &junk);
-
- /*
- * Calculate the parent X and parent Y.
- */
-
- w = X -> xreparent.parent;
-
- if (w != DefaultRootWindow(nxagentDisplay))
- {
- do
- {
- result = XQueryTree(nxagentDisplay, w, &rootReturn, &parentReturn,
- &childrenReturn, &nchildrenReturn);
-
- if (parentReturn == rootReturn || parentReturn == 0 || result == 0)
- {
- break;
- }
-
- if (result == 1 && childrenReturn != NULL)
- {
- XFree(childrenReturn);
- }
-
- w = parentReturn;
- }
- while (True);
-
- /*
- * WM reparented. Find edge of the frame.
- */
-
- if (XGetWindowAttributes(nxagentDisplay, w, &attributes) == 0)
- {
- #ifdef WARNING
- fprintf(stderr, "nxagentHandleReparentNotify: WARNING! "
- "XGetWindowAttributes failed for parent window.\n");
- #endif
-
- return 1;
- }
-
- xParent = attributes.x;
- yParent = attributes.y;
-
- /*
- * Difference between Absolute X and Parent X gives thickness of side frame.
- * Difference between Absolute Y and Parent Y gives thickness of title bar.
- */
-
- nxagentChangeOption(WMBorderWidth, (x - xParent));
- nxagentChangeOption(WMTitleHeight, (y - yParent));
- }
- }
return 1;
}
@@ -3830,8 +3313,6 @@ void nxagentGrabPointerAndKeyboard(XEvent *X)
int resource;
- int result;
-
#ifdef TEST
fprintf(stderr, "nxagentGrabPointerAndKeyboard: Grabbing pointer and keyboard with event at [%p].\n",
(void *) X);
@@ -3850,22 +3331,8 @@ void nxagentGrabPointerAndKeyboard(XEvent *X)
fprintf(stderr, "nxagentGrabPointerAndKeyboard: Going to grab the keyboard in context [B1].\n");
#endif
- result = XGrabKeyboard(nxagentDisplay, nxagentFullscreenWindow,
- True, GrabModeAsync, GrabModeAsync, now);
-
- if (result != GrabSuccess)
- {
- return;
- }
-
- /*
- * The smart scheduler could be stopped while
- * waiting for the reply. In this case we need
- * to yield explicitly to avoid to be stuck in
- * the dispatch loop forever.
- */
-
- isItTimeToYield = 1;
+ XGrabKeyboard(nxagentDisplay, nxagentFullscreenWindow,
+ True, GrabModeAsync, GrabModeAsync, now);
#ifdef TEST
fprintf(stderr, "nxagentGrabPointerAndKeyboard: Going to grab the pointer in context [B2].\n");