Commit b7169bdc authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

nxagent: make all traps Booleans

and use True/False instead of 1/0
parent 6d967988
......@@ -160,15 +160,15 @@ int nxagentSynchronizeDrawable(DrawablePtr pDrawable, int wait, unsigned int bre
* so that the image will be transferred in a single operation.
*/
nxagentFBTrap = 1;
nxagentFBTrap = True;
nxagentSplitTrap = 1;
nxagentSplitTrap = True;
int result = nxagentSynchronizeDrawableData(pDrawable, breakMask, owner);
nxagentSplitTrap = 0;
nxagentSplitTrap = False;
nxagentFBTrap = 0;
nxagentFBTrap = False;
if (wait == DO_WAIT && nxagentSplitResource(pDrawable) != NULL)
{
......@@ -495,11 +495,11 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
int saveTrap = nxagentGCTrap;
nxagentGCTrap = 0;
nxagentGCTrap = False;
nxagentFBTrap = 1;
nxagentFBTrap = True;
nxagentSplitTrap = 1;
nxagentSplitTrap = True;
pGC = nxagentGetGraphicContext(pDrawable);
......@@ -839,9 +839,9 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned
nxagentSynchronizeRegionStop:
nxagentSplitTrap = 0;
nxagentSplitTrap = False;
nxagentFBTrap = 0;
nxagentFBTrap = False;
nxagentGCTrap = saveTrap;
......@@ -2412,7 +2412,7 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable)
int saveTrap = nxagentGCTrap;
nxagentGCTrap = 1;
nxagentGCTrap = True;
if (nxagentDrawableStatus(pDrawable) == Synchronized)
{
......
......@@ -1142,17 +1142,17 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
{
if (X.xkey.keycode == nxagentCapsLockKeycode)
{
nxagentXkbCapsTrap = 1;
nxagentXkbCapsTrap = True;
}
else if (X.xkey.keycode == nxagentNumLockKeycode)
{
nxagentXkbNumTrap = 1;
nxagentXkbNumTrap = True;
}
nxagentInitXkbKeyboardState();
nxagentXkbCapsTrap = 0;
nxagentXkbNumTrap = 0;
nxagentXkbCapsTrap = False;
nxagentXkbNumTrap = False;
}
/* Calculate the time elapsed between this and the last event
......@@ -1712,11 +1712,11 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
Mask mask = CWX | CWY;
nxagentScreenTrap = 1;
nxagentScreenTrap = True;
ConfigureWindow(pWin, mask, (XID *) values, wClient(pWin));
nxagentScreenTrap = 0;
nxagentScreenTrap = False;
}
if (nxagentOption(Fullscreen) == 1 &&
......@@ -2006,11 +2006,11 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
((pWin = nxagentWindowPtr(X.xunmap.window)) != NULL &&
nxagentWindowTopLevel(pWin) == 1))
{
nxagentScreenTrap = 1;
nxagentScreenTrap = True;
UnmapWindow(pWin, False);
nxagentScreenTrap = 0;
nxagentScreenTrap = False;
}
}
......@@ -2037,11 +2037,11 @@ FIXME: Don't enqueue the KeyRelease event if the key was not already
((pWin = nxagentWindowPtr(X.xmap.window)) != NULL &&
nxagentWindowTopLevel(pWin) == 1))
{
nxagentScreenTrap = 1;
nxagentScreenTrap = True;
MapWindow(pWin, wClient(pWin));
nxagentScreenTrap = 0;
nxagentScreenTrap = False;
}
if (pWin != NULL)
......@@ -2262,17 +2262,17 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result)
{
if (X -> xkey.keycode == nxagentCapsLockKeycode)
{
nxagentXkbCapsTrap = 1;
nxagentXkbCapsTrap = True;
}
else if (X -> xkey.keycode == nxagentNumLockKeycode)
{
nxagentXkbNumTrap = 1;
nxagentXkbNumTrap = True;
}
nxagentInitXkbKeyboardState();
nxagentXkbCapsTrap = 0;
nxagentXkbNumTrap = 0;
nxagentXkbCapsTrap = False;
nxagentXkbNumTrap = False;
}
if (nxagentCheckSpecialKeystroke(&X -> xkey, result))
......@@ -2900,9 +2900,9 @@ int nxagentHandleXFixesSelectionNotify(XEvent *X)
* identify that situation during Callback processing we could
* get rid of the Trap...
*/
nxagentExternalClipboardEventTrap = 1;
nxagentExternalClipboardEventTrap = True;
CallCallbacks(&SelectionCallback, &info);
nxagentExternalClipboardEventTrap = 0;
nxagentExternalClipboardEventTrap = False;
}
}
return 1;
......@@ -3199,11 +3199,11 @@ int nxagentHandleConfigureNotify(XEvent* X)
* nxagentWindowPriv(pWinWindow)->height = X -> xconfigure.height;
*/
nxagentScreenTrap = 1;
nxagentScreenTrap = True;
ConfigureWindow(pWinWindow, mask, (XID *) values, wClient(pWinWindow));
nxagentScreenTrap = 0;
nxagentScreenTrap = False;
nxagentCheckWindowConfiguration((XConfigureEvent*)X);
......
......@@ -1264,7 +1264,7 @@ GCPtr nxagentGetScratchGC(unsigned depth, ScreenPtr pScreen)
int nxagentSaveGCTrap = nxagentGCTrap;
nxagentGCTrap = 0;
nxagentGCTrap = False;
GCPtr pGC = GetScratchGC(depth, pScreen);
......
......@@ -80,7 +80,7 @@ static int nxagentSaveGCTrap;
{ \
nxagentSaveGCTrap = nxagentGCTrap;\
\
nxagentGCTrap = 1; \
nxagentGCTrap = True; \
}
#define RESET_GC_TRAP() \
......
......@@ -64,7 +64,7 @@ static int __glXDispatch(ClientPtr client)
* dispatching a GLX operation.
*/
nxagentGlxTrap = 1;
nxagentGlxTrap = True;
#ifdef TEST
fprintf(stderr, "__glXDispatch: Going to dispatch GLX operation [%d] for client [%d].\n",
......@@ -73,7 +73,7 @@ static int __glXDispatch(ClientPtr client)
retval = xorg__glXDispatch(client);
nxagentGlxTrap = 0;
nxagentGlxTrap = False;
#ifdef TEST
fprintf(stderr, "__glXDispatch: Dispatched GLX operation [%d] for client [%d].\n",
......
......@@ -1766,11 +1766,11 @@ ProcRenderDispatch (ClientPtr client)
* operation to avoid reentrancy in GCOps.c.
*/
nxagentGCTrap = 1;
nxagentGCTrap = True;
int result = xorg_ProcRenderDispatch(client);
nxagentGCTrap = 0;
nxagentGCTrap = False;
return result;
}
......@@ -1793,11 +1793,11 @@ SProcRenderDispatch (ClientPtr client)
* operation to avoid reentrancy in GCOps.c.
*/
nxagentGCTrap = 1;
nxagentGCTrap = True;
int result = xorg_SProcRenderDispatch(client);
nxagentGCTrap = 0;
nxagentGCTrap = False;
return result;
}
......@@ -171,11 +171,11 @@ miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
{
/* Careful! This wrapper DEACTIVATES the trap! */
nxagentShmTrap = 0;
nxagentShmTrap = False;
xorg_miShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data);
nxagentShmTrap = 1;
nxagentShmTrap = True;
return;
}
......@@ -439,11 +439,11 @@ fbShmCreatePixmap (pScreen, width, height, depth, addr)
{
PixmapPtr result;
nxagentShmPixmapTrap = 1;
nxagentShmPixmapTrap = True;
result = nxagent_fbShmCreatePixmap(pScreen, width, height, depth, addr);
nxagentShmPixmapTrap = 0;
nxagentShmPixmapTrap = False;
return result;
}
......@@ -465,11 +465,11 @@ ProcShmDispatch (register ClientPtr client)
}
#endif
nxagentShmTrap = 1;
nxagentShmTrap = True;
result = xorg_ProcShmDispatch(client);
nxagentShmTrap = 0;
nxagentShmTrap = False;
return result;
}
......@@ -488,11 +488,11 @@ SProcShmDispatch (register ClientPtr client)
}
#endif
nxagentShmTrap = 1;
nxagentShmTrap = True;
result = xorg_SProcShmDispatch(client);
nxagentShmTrap = 0;
nxagentShmTrap = False;
return result;
}
......@@ -79,11 +79,11 @@ ProcXvDispatch(ClientPtr client)
stuff->data, client -> index);
#endif
nxagentXvTrap = 1;
nxagentXvTrap = True;
result = xorg_ProcXvDispatch(client);
nxagentXvTrap = 0;
nxagentXvTrap = False;
#ifdef TEST
fprintf(stderr, "ProcXvDispatch: Dispatched XVideo operation [%d] for client [%d].\n",
......@@ -108,11 +108,11 @@ SProcXvDispatch(ClientPtr client)
stuff->data, client -> index);
#endif
nxagentXvTrap = 1;
nxagentXvTrap = True;
result = xorg_SProcXvDispatch(client);
nxagentXvTrap = 0;
nxagentXvTrap = False;
#ifdef TEST
fprintf(stderr, "SProcXvDispatch: Dispatched XVideo operation [%d] for client [%d].\n",
......
......@@ -157,7 +157,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, int height,
* synchronized with the remote X Server.
*/
if (pPixmapPriv -> isShared == 1)
if (pPixmapPriv -> isShared)
{
BoxRec box = { .x1 = 0, .y1 = 0, .x2 = width, .y2 = height };
......@@ -773,11 +773,11 @@ void nxagentReconnectPixmap(void *p0, XID x1, void *p2)
return;
}
nxagentSplitTrap = 1;
nxagentSplitTrap = True;
*pBool = nxagentSynchronizeDrawableData((DrawablePtr) pPixmap, NEVER_BREAK, NULL);
nxagentSplitTrap = 0;
nxagentSplitTrap = False;
if (!*pBool)
{
......@@ -1095,13 +1095,13 @@ void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict,
int length = nxagentImageLength(width, height, format, 0, depth);
int saveTrap = nxagentGCTrap;
Bool saveTrap = nxagentGCTrap;
nxagentGCTrap = 0;
nxagentGCTrap = False;
nxagentSplitTrap = 1;
nxagentSplitTrap = True;
nxagentFBTrap = 1;
nxagentFBTrap = True;
char *data = malloc(length);
......@@ -1124,9 +1124,9 @@ void nxagentSynchronizeShmPixmap(DrawablePtr pDrawable, int xPict, int yPict,
nxagentGCTrap = saveTrap;
nxagentSplitTrap = 0;
nxagentSplitTrap = False;
nxagentFBTrap = 0;
nxagentFBTrap = False;
nxagentFreeScratchGC(pGC);
}
......
......@@ -340,7 +340,7 @@ void nxagentInitializeRecLossyLevel(void)
void nxagentInitReconnector(void)
{
nxagentReconnectTrap = 0;
nxagentReconnectTrap = False;
reconnectLossyLevel[DISPLAY_STEP] = malloc(sizeof(int));
reconnectLossyLevel[SCREEN_STEP] = malloc(sizeof(int));
......
......@@ -532,11 +532,11 @@ void nxagentRenderRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
* if the cursor was already encoded with the best quality.
*/
nxagentLosslessTrap = 1;
nxagentLosslessTrap = True;
nxagentSynchronizeDrawable(pPicture -> pDrawable, DO_WAIT, NEVER_BREAK, NULL);
nxagentLosslessTrap = 0;
nxagentLosslessTrap = False;
nxagentCursor(pCursor, pScreen) = XRenderCreateCursor(nxagentDisplay, nxagentPicture(pPicture), x, y);
}
......
......@@ -341,9 +341,9 @@ void nxagentRootlessRestack(unsigned long children[], unsigned int nchildren)
Mask mask = CWSibling | CWStackMode;
values[0] = pWin -> drawable.id;
ClientPtr pClient = wClient(toplevel[i]);
nxagentScreenTrap = 1;
nxagentScreenTrap = True;
ConfigureWindow(toplevel[i], mask, values, pClient);
nxagentScreenTrap = 0;
nxagentScreenTrap = False;
#ifdef TEST
fprintf(stderr, "%s: Restacked window [%p].\n", __func__, (void*) toplevel[i]);
......
......@@ -25,94 +25,84 @@
#include "Trap.h"
#include <nx-X11/Xdefs.h>
/*
* Set if we are dispatching a render
* extension request. Used to avoid
* Set if we are dispatching a render extension request. Used to avoid
* reentrancy in GC operations.
*/
int nxagentGCTrap = 0;
Bool nxagentGCTrap = False;
/*
* Set if we are enqueing an internal
* operation, CreateWindow and Reparent-
* Window. Used to remove any screen operation.
* Set if we are enqueing an internal operation, CreateWindow and
* Reparent- Window. Used to remove any screen operation.
*/
int nxagentScreenTrap = 0;
Bool nxagentScreenTrap = False;
/*
* Set if we are executing a GC operation
* only on the X side. Used to avoid
* reentrancy in FB layer.
* Set if we are executing a GC operation only on the X side. Used to
* avoid reentrancy in FB layer.
*/
int nxagentFBTrap = 0;
Bool nxagentFBTrap = False;
/*
* Set if we are dispatching a shared
* memory extension request.
* Set if we are dispatching a shared memory extension request.
*/
int nxagentShmTrap = 0;
Bool nxagentShmTrap = False;
/*
* Set if a shared pixmap operation is
* requested by the client.
* Set if a shared pixmap operation is requested by the client.
*/
int nxagentShmPixmapTrap = 0;
Bool nxagentShmPixmapTrap = False;
/*
* Set if we are dispatching a XVideo
* extension request.
* Set if we are dispatching a XVideo extension request.
*/
int nxagentXvTrap = 0;
Bool nxagentXvTrap = False;
/*
* Set if we are dispatching a GLX
* extension request.
* Set if we are dispatching a GLX extension request.
*/
int nxagentGlxTrap = 0;
Bool nxagentGlxTrap = False;
/*
* Set while we are resuming the session.
*/
int nxagentReconnectTrap = 0;
Bool nxagentReconnectTrap = False;
/*
* Set if we need to realize a drawable
* by using a lossless encoding.
* Set if we need to realize a drawable by using a lossless encoding.
*/
int nxagentLosslessTrap = 0;
Bool nxagentLosslessTrap = False;
/*
* Set to force the synchronization of
* a drawable.
* Set to force the synchronization of a drawable.
*/
int nxagentSplitTrap = 0;
Bool nxagentSplitTrap = False;
/*
* Set to avoid CapsLock synchronization
* problems when CapsLock is the first
* key to be pressed in the session.
* Set to avoid CapsLock synchronization problems when CapsLock is the
* first key to be pressed in the session.
*/
int nxagentXkbCapsTrap = 0;
Bool nxagentXkbCapsTrap = False;
/*
* Set to avoid NumLock synchronization
* problems when NumLock is the first
* key to be pressed in the session.
* Set to avoid NumLock synchronization problems when NumLock is the
* first key to be pressed in the session.
*/
int nxagentXkbNumTrap = 0;
Bool nxagentXkbNumTrap = False;
/*
* Set to indicate we are processing a clipboard event triggered by
......@@ -120,4 +110,4 @@ int nxagentXkbNumTrap = 0;
* would trigger another event by the real X server
*/
int nxagentExternalClipboardEventTrap = 0;
Bool nxagentExternalClipboardEventTrap = False;
......@@ -26,6 +26,14 @@
#ifndef __Traps_H__
#define __Traps_H__
#ifndef False
#define False 0
#endif
#ifndef True
#define True 1
#endif
/*
* Set if we are dispatching a render extension request. Used to avoid
* reentrancy in GC operations.
......
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