diff options
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Window.c')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Window.c | 429 |
1 files changed, 254 insertions, 175 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index e23c8392a..25735afe9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -63,6 +63,7 @@ #include "Composite.h" #include "Events.h" #include "Utils.h" +#include "Image.h" #include <nx/NX.h> #include "compext/Compext.h" @@ -167,7 +168,7 @@ nxagentWMStateRec; */ #ifdef TEST -static Bool nxagentCheckWindowIntegrity(WindowPtr pWin); +static _X_UNUSED Bool nxagentCheckWindowIntegrity(WindowPtr pWin); #endif WindowPtr nxagentGetWindowFromID(Window id) @@ -266,7 +267,7 @@ Bool nxagentCreateWindow(WindowPtr pWin) attributes.backing_store = NotUseful; #ifdef TEST - fprintf(stderr, "nxagentCreateWindow: Backing store on window at [%p] is [%d].\n", + fprintf(stderr, "%s: Backing store on window at [%p] is [%d].\n", __func__, (void*)pWin, attributes.backing_store); #endif @@ -333,16 +334,16 @@ Bool nxagentCreateWindow(WindowPtr pWin) */ #ifdef TEST - fprintf(stderr, "nxagentCreateWindow: Going to create new window.\n"); + fprintf(stderr, "%s: Going to create new window.\n", __func__); #endif #ifdef TEST - fprintf(stderr, "nxagentCreateWindow: Creating %swindow at %p current event mask = %lX mask & CWEventMask = %ld " - "event_mask = %lX\n", - nxagentWindowTopLevel(pWin) ? "toplevel " : "", (void*)pWin, pWin -> eventMask, + fprintf(stderr, "%s: Creating %swindow at [%p][0x%x] current event mask [%X] mask & CWEventMask [%ld] " + "event_mask [%lX]\n", __func__, + nxagentWindowTopLevel(pWin) ? "toplevel " : "", (void*)pWin, pWin->drawable.id, pWin -> eventMask, mask & CWEventMask, attributes.event_mask); - fprintf(stderr, "nxagentCreateWindow: position [%d,%d] size [%d,%d] depth [%d] border [%d] class [%d].\n", + fprintf(stderr, "%s: position [%d,%d] size [%d,%d] depth [%d] border [%d] class [%d].\n", __func__, pWin->origin.x - wBorderWidth(pWin), pWin->origin.y - wBorderWidth(pWin), pWin->drawable.width, pWin->drawable.height, pWin->drawable.depth, pWin->borderWidth, pWin->drawable.class); @@ -350,17 +351,16 @@ Bool nxagentCreateWindow(WindowPtr pWin) nxagentWindowPriv(pWin)->window = XCreateWindow(nxagentDisplay, nxagentWindowParent(pWin), - pWin->origin.x - - wBorderWidth(pWin), - pWin->origin.y - - wBorderWidth(pWin), + pWin->origin.x - wBorderWidth(pWin), + pWin->origin.y - wBorderWidth(pWin), pWin->drawable.width, pWin->drawable.height, pWin->borderWidth, pWin->drawable.depth, pWin->drawable.class, visual, - mask, &attributes); + mask, + &attributes); nxagentWindowPriv(pWin) -> isMapped = 0; nxagentWindowPriv(pWin) -> isRedirected = 0; @@ -393,18 +393,18 @@ Bool nxagentCreateWindow(WindowPtr pWin) { fprintf(stderr, "NXAGENT_WINDOW_ID: %s_WINDOW,WID:[0x%x],INT:[0x%x]\n", (pWin->drawable.id == pWin->drawable.pScreen->root->drawable.id) ? "ROOT" : "PRIVATE", - nxagentWindowPriv(pWin)->window, pWin->drawable.id); + nxagentWindow(pWin), pWin->drawable.id); } #ifdef DEBUG { char *winname = NULL; - if (-1 != asprintf(&winname, "%s %s[0x%lx]", nxagentWindowName, + if (-1 != asprintf(&winname, "%s %s[0x%x]", nxagentWindowName, (pWin->drawable.id == pWin->drawable.pScreen->root->drawable.id) ? "Root" : "Private", pWin->drawable.id)) { - Xutf8SetWMProperties(nxagentDisplay, nxagentWindowPriv(pWin)->window, + Xutf8SetWMProperties(nxagentDisplay, nxagentWindow(pWin), winname, winname, NULL , 0 , NULL, NULL, NULL); SAFE_free(winname); } @@ -412,8 +412,7 @@ Bool nxagentCreateWindow(WindowPtr pWin) #endif #ifdef TEST - fprintf(stderr, "%s: Created new window with id [0x%x].\n", __func__, - nxagentWindowPriv(pWin)->window); + fprintf(stderr, "%s: Created new remote window with id [0x%x].\n", __func__, nxagentWindow(pWin)); #endif /* @@ -426,7 +425,7 @@ Bool nxagentCreateWindow(WindowPtr pWin) XlibAtom prop = nxagentMakeAtom("WM_PROTOCOLS", strlen("WM_PROTOCOLS"), True); XlibAtom atom = nxagentMakeAtom("WM_DELETE_WINDOW", strlen("WM_DELETE_WINDOW"), True); - XSetWMProtocols(nxagentDisplay, nxagentWindowPriv(pWin)->window, &atom, 1); + XSetWMProtocols(nxagentDisplay, nxagentWindow(pWin), &atom, 1); nxagentAddPropertyToList(prop, pWin); @@ -447,12 +446,12 @@ Bool nxagentCreateWindow(WindowPtr pWin) if (ChangeWindowProperty(pWin, prop, XA_WINDOW, 32, PropModeReplace, 1, nxagentWindowPriv(pWin), 1) != Success) { - fprintf(stderr, "nxagentCreateWindow: Adding NX_REAL_WINDOW failed.\n"); + fprintf(stderr, "%s: Adding NX_REAL_WINDOW failed.\n", __func__); } #ifdef DEBUG else { - fprintf(stderr, "nxagentCreateWindow: Added NX_REAL_WINDOW for Window ID [%x].\n", nxagentWindowPriv(pWin)->window); + fprintf(stderr, "%s: Added NX_REAL_WINDOW for Window ID [0x%x].\n", __func__, nxagentWindow(pWin)); } #endif } @@ -503,7 +502,7 @@ void nxagentSetVersionProperty(WindowPtr pWin) #ifdef DEBUG else { - fprintf(stderr, "%s: Added property [%s], value [%s] for root window [%x].\n", __func__, name, NX_VERSION_CURRENT_STRING, pWin); + fprintf(stderr, "%s: Added property [%s], value [%s] for root window [%p].\n", __func__, name, NX_VERSION_CURRENT_STRING, (void *)pWin); } #endif } @@ -544,6 +543,11 @@ Bool nxagentDestroyWindow(WindowPtr pWin) return 1; } + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + nxagentClearClipboard(NULL, pWin); for (int j = 0; j < nxagentExposeQueue.length; j++) @@ -601,7 +605,7 @@ Bool nxagentDestroyWindow(WindowPtr pWin) nxagentSynchronization.pDrawable = NULL; #ifdef TEST - fprintf(stderr, "nxagentDestroyWindow: Synchronization drawable [%p] removed from resources.\n", + fprintf(stderr, "%s: Synchronization drawable [%p] removed from resources.\n", __func__, (void *) pWin); #endif } @@ -632,7 +636,7 @@ Bool nxagentDestroyWindow(WindowPtr pWin) !nxagentLastWindowDestroyed && nxagentSomeWindowsAreMapped() == False) { #ifdef TEST - fprintf(stderr, "nxagentDestroyWindow: Last mapped window as been destroyed.\n"); + fprintf(stderr, "%s: Last mapped window as been destroyed.\n", __func__); #endif nxagentLastWindowDestroyed = True; @@ -664,8 +668,8 @@ Bool nxagentPositionWindow(WindowPtr pWin, int x, int y) } #ifdef TEST - fprintf(stderr, "nxagentPositionWindow: Changing position of window [%p][%ld] to [%d,%d].\n", - (void *) pWin, nxagentWindow(pWin), x, y); + fprintf(stderr, "%s: Changing position of window [%p][0x%x] remote [0x%x] to [%d,%d].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin), x, y); #endif nxagentAddConfiguredWindow(pWin, CWSibling | CWX | CWY | CWWidth | @@ -681,6 +685,11 @@ void nxagentRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib) return; } + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + nxagentAddConfiguredWindow(pWin, CW_RootlessRestack); } @@ -1074,7 +1083,7 @@ void nxagentMoveViewport(ScreenPtr pScreen, int hShift, int vShift) */ #ifdef DEBUG - fprintf(stderr, "nxagentMoveViewport: RootX[%i] RootY[%i], hShift[%i] vShift[%i].\n", + fprintf(stderr, "%s: RootX[%i] RootY[%i], hShift[%i] vShift[%i].\n", __func__, nxagentOption(RootX), nxagentOption(RootY), hShift, vShift); #endif @@ -1146,12 +1155,12 @@ void nxagentMoveViewport(ScreenPtr pScreen, int hShift, int vShift) if (doMove) { #ifdef TEST - fprintf(stderr, "nxagentMoveViewport: New viewport geometry: (%d, %d)-" - "(%d, %d)\n", -nxagentOption(RootX), -nxagentOption(RootY), + fprintf(stderr, "%s: New viewport geometry: (%d, %d)-" + "(%d, %d)\n", __func__, -nxagentOption(RootX), -nxagentOption(RootY), -nxagentOption(RootX) + nxagentOption(Width), -nxagentOption(RootY) + nxagentOption(Height)); - fprintf(stderr, "nxagentMoveViewport: Root geometry x=[%d] y=[%d]\n", + fprintf(stderr, "%s: Root geometry x=[%d] y=[%d]\n", __func__, pScreen->root -> drawable.x, pScreen->root -> drawable.y ); #endif @@ -1183,7 +1192,7 @@ void nxagentMoveViewport(ScreenPtr pScreen, int hShift, int vShift) } #ifdef DEBUG - fprintf(stderr, "nxagentMoveViewport: hRect p1[%i, %i] - p2[%i, %i].\n", hRect.x1, hRect.y1, hRect.x2, hRect.y2); + fprintf(stderr, "%s: hRect p1[%i, %i] - p2[%i, %i].\n", __func__, hRect.x1, hRect.y1, hRect.x2, hRect.y2); #endif BoxRec vRect = {.x1 = -newX, .y1 = -newY}; @@ -1201,7 +1210,7 @@ void nxagentMoveViewport(ScreenPtr pScreen, int hShift, int vShift) } #ifdef DEBUG - fprintf(stderr, "nxagentMoveViewport: vRect p1[%i, %i] - p2[%i, %i].\n", vRect.x1, vRect.y1, vRect.x2, vRect.y2); + fprintf(stderr, "%s: vRect p1[%i, %i] - p2[%i, %i].\n", __func__, vRect.x1, vRect.y1, vRect.x2, vRect.y2); #endif if (oldX != newX && hRect.x1 != hRect.x2 && hRect.y1 != hRect.y2) @@ -1233,18 +1242,19 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) { unsigned int valuemask; XWindowChanges values; - int offX = nxagentWindowPriv(pWin)->x - pWin->origin.x; - int offY = nxagentWindowPriv(pWin)->y - pWin->origin.y; if (nxagentScreenTrap) { #ifdef TEST - fprintf(stderr, "nxagentConfigureWindow: WARNING: Called with the screen trap set.\n"); + fprintf(stderr, "%s: WARNING: Called with the screen trap set.\n", __func__); #endif return; } + int offX = nxagentWindowPriv(pWin)->x - pWin->origin.x; + int offY = nxagentWindowPriv(pWin)->y - pWin->origin.y; + if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin)) { @@ -1259,8 +1269,8 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) } #ifdef TEST - fprintf(stderr, "nxagentConfigureWindow: Called with window [%p][%ld] and mask [%x].\n", - (void *) pWin, nxagentWindow(pWin), mask); + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x] and mask [%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin), mask); #endif nxagentMoveCorruptedRegion(pWin, mask); @@ -1311,8 +1321,8 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) if (valuemask) { #ifdef TEST - fprintf(stderr, "nxagentConfigureWindow: Going to configure window [%p][%ld] with mask [%x].\n", - (void *) pWin, nxagentWindow(pWin), valuemask); + fprintf(stderr, "%s: Going to configure window [%p][0x%x] remote [0x%x] with mask [%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin), valuemask); #endif if (pWin->bitGravity == StaticGravity && @@ -1320,8 +1330,8 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) ((mask & CWWidth) || (mask & CWHeight))) { #ifdef TEST - fprintf(stderr, "nxagentConfigureWindow: Window has StaticGravity. Going to translate Expose events by offset [%d, %d].\n", - offX, offY); + fprintf(stderr, "%s: Window has StaticGravity. Going to translate Expose events by offset [%d, %d].\n", + __func__, offX, offY); #endif nxagentAddStaticResizedWindow(pWin, XNextRequest(nxagentDisplay), offX, offY); @@ -1363,8 +1373,8 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) values.stack_mode = Above; #ifdef TEST - fprintf(stderr, "nxagentConfigureWindow: Going to configure top sibling [%ld] " - "with mask [%x] and parent [%ld].\n", nxagentWindow(pSib), + fprintf(stderr, "%s: Going to configure top sibling [0x%x] " + "with mask [%x] and parent [0x%x].\n", __func__, nxagentWindow(pSib), valuemask, nxagentWindowParent(pWin)); #endif @@ -1387,8 +1397,8 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) values.sibling = nxagentWindowSiblingAbove(pSib); #ifdef TEST - fprintf(stderr, "nxagentConfigureWindow: Going to configure other sibling [%ld] " - "with mask [%x] and parent [%ld] below [%ld].\n", nxagentWindow(pSib), + fprintf(stderr, "%s: Going to configure other sibling [0x%x] " + "with mask [%x] and parent [0x%x] below [0x%lx].\n", __func__, nxagentWindow(pSib), valuemask, nxagentWindowParent(pWin), nxagentWindowSiblingAbove(pSib)); #endif @@ -1401,9 +1411,9 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) #ifdef TEST { - Window root_return; - Window parent_return; - Window *children_return = NULL; + XlibWindow root_return; + XlibWindow parent_return; + XlibWindow *children_return = NULL; unsigned int nchildren_return; Status result = XQueryTree(nxagentDisplay, DefaultRootWindow(nxagentDisplay), @@ -1411,7 +1421,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) if (result) { - fprintf(stderr, "nxagentConfigureWindow: Children of the root: "); + fprintf(stderr, "%s: Children of the root: ", __func__); while(nchildren_return > 0) { pSib = nxagentWindowPtr(children_return[--nchildren_return]); @@ -1424,7 +1434,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) } else { - fprintf(stderr, "nxagentConfigureWindow: Failed QueryTree request.\n "); + fprintf(stderr, "%s: Failed QueryTree request.\n", __func__); } SAFE_XFree(children_return); @@ -1447,7 +1457,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) * values.stack_mode = Above; * * #ifdef TEST - * fprintf(stderr, "nxagentConfigureWindow: Going to configure splash window [%ld].\n", + * fprintf(stderr, "%s: Going to configure splash window [0x%x].\n", __func__, * nxagentSplashWindow); * #endif * @@ -1463,8 +1473,8 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) if (!pWin -> prevSib) { #ifdef TEST - fprintf(stderr, "nxagentConfigureWindow: Raising window [%p][%ld].\n", - (void *) pWin, nxagentWindow(pWin)); + fprintf(stderr, "%s: Raising window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif XRaiseWindow(nxagentDisplay, nxagentWindow(pWin)); @@ -1472,8 +1482,8 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) else if (!pWin -> nextSib) { #ifdef TEST - fprintf(stderr, "nxagentConfigureWindow: Lowering window [%p][%ld].\n", - (void *) pWin, nxagentWindow(pWin)); + fprintf(stderr, "%sw: Lowering window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif XLowerWindow(nxagentDisplay, nxagentWindow(pWin)); @@ -1483,8 +1493,8 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) XlibWindow windowList[2]; #ifdef TEST - fprintf(stderr, "nxagentConfigureWindow: Putting window [%p][%ld] in the middle.\n", - (void *) pWin, nxagentWindow(pWin)); + fprintf(stderr, "%s: Putting window [%p][0x%x] remote [0x%x] in the middle.\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif windowList[0] = nxagentWindow(pWin->prevSib); @@ -1528,9 +1538,9 @@ void nxagentReparentWindow(WindowPtr pWin, WindowPtr pOldParent) } #ifdef TEST - fprintf(stderr, "nxagentReparentWindow: window at %p [%lx] previous parent at %p [%lx].\n", - (void*)pWin, nxagentWindow(pWin), - (void*)pOldParent, nxagentWindow(pOldParent)); + fprintf(stderr, "%s: window at [%p][0x%x] remote [0x%x] previous parent at [%p][0x%x] remote [0x%x].\n", __func__, + (void*)pWin, pWin->drawable.id, nxagentWindow(pWin), + (void*)pOldParent, pOldParent->drawable.id, nxagentWindow(pOldParent)); #endif XReparentWindow(nxagentDisplay, nxagentWindow(pWin), @@ -1554,8 +1564,8 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) XSetWindowAttributes attributes; #ifdef TEST - fprintf(stderr, "nxagentChangeWindowAttributes: Changing attributes for window at [%p] with mask [%lu].\n", - (void *) pWin, mask); + fprintf(stderr, "%s: Changing attributes for window at [%p][0x%x] remote [0x%x] with mask [%lu].\n", __func__, + (void*)pWin, pWin->drawable.id, nxagentWindow(pWin), mask); #endif if (nxagentScreenTrap) @@ -1605,8 +1615,8 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) nxagentWindowPriv(pWin -> parent) -> hasTransparentChildren = 1; #ifdef DEBUG - fprintf(stderr, "nxagentChangeWindowAttributes: WARNING! Window at [%p] got the " - "hasTransparentChildren flag.\n", (void *) pWin); + fprintf(stderr, "%s: WARNING! Window at [%p] got the " + "hasTransparentChildren flag.\n", __func__, (void *) pWin); #endif } @@ -1629,8 +1639,8 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) if (nxagentDrawableStatus((DrawablePtr) pWin -> background.pixmap) == NotSynchronized) { #ifdef TEST - fprintf(stderr, "nxagentChangeWindowAttributes: The window at [%p] has the background at [%p] " - "not synchronized.\n", (void *) pWin, (void *) pWin -> background.pixmap); + fprintf(stderr, "%s: The window at [%p] has the background at [%p] " + "not synchronized.\n", __func__, (void *) pWin, (void *) pWin -> background.pixmap); #endif if (nxagentIsCorruptedBackground(pWin -> background.pixmap) == 0) @@ -1719,8 +1729,8 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) attributes.backing_store = pWin -> backingStore; #ifdef TEST - fprintf(stderr, "nxagentChangeWindowAttributes: Changing backing store value to %d" - " for window at %p.\n", pWin -> backingStore, (void*)pWin); + fprintf(stderr, "%s: Changing backing store value to %d for window at %p.\n", + __func__, pWin -> backingStore, (void*)pWin); #endif } @@ -1792,8 +1802,8 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) else { #ifdef WARNING - fprintf(stderr, "nxagentChangeWindowAttributes: WARNING! Bad colormap " - "[%lu] for window at [%p].\n", wColormap(pWin), (void *) pWin); + fprintf(stderr, "%s: WARNING! Bad colormap [%lu] for window at [%p].\n", + __func__, wColormap(pWin), (void *) pWin); #endif mask &= ~CWColormap; @@ -1860,11 +1870,19 @@ void nxagentSetWMState(WindowPtr pWin, CARD32 desired) * exposure events for underlying windows; this is taken care of by * DIX. DIX does, however, call PaintWindowBackground() and * PaintWindowBorder() to perform some of these. --+ */ + */ Bool nxagentRealizeWindow(WindowPtr pWin) { + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + if (nxagentScreenTrap) { + #ifdef DEBUG + fprintf(stderr, "%s: doing nothing because of nxagentScreenTrap\n", __func__); + #endif return True; } @@ -1904,12 +1922,20 @@ Bool nxagentRealizeWindow(WindowPtr pWin) nxagentLastWindowDestroyed = False; + #ifdef DEBUG + fprintf(stderr, "%s: leaving...\n", __func__); + #endif return True; } /* See nxagentRealizeWindow for a description */ Bool nxagentUnrealizeWindow(WindowPtr pWin) { + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + if (nxagentScreenTrap) { return True; @@ -1932,6 +1958,11 @@ Bool nxagentUnrealizeWindow(WindowPtr pWin) void nxagentFrameBufferPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) { + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + if (pWin->backgroundState == BackgroundPixmap) { pWin->background.pixmap = nxagentVirtualPixmap(pWin->background.pixmap); @@ -1972,6 +2003,11 @@ void nxagentFrameBufferPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) { + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + if (pWin -> realized) { BoxPtr pBox = RegionRects(pRegion); @@ -1989,8 +2025,8 @@ void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) #ifdef TEST else { - fprintf(stderr, "nxagentPaintWindowBackground: Saving the operation with window " - "at [%p] not realized.\n", (void *) pWin); + fprintf(stderr, "%s: Saving the operation with window at [%p] not realized.\n", + __func__, (void *) pWin); } #endif @@ -2008,6 +2044,11 @@ void nxagentPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) void nxagentPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) { + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + /* * The framebuffer operations don't take care of clipping to the * actual area of the framebuffer so we need to clip ourselves. @@ -2048,6 +2089,11 @@ void nxagentPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) */ void nxagentCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion) { + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + fbCopyWindow(pWin, oldOrigin, oldRegion); } @@ -2062,6 +2108,11 @@ void nxagentCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion) */ void nxagentClipNotify(WindowPtr pWin, int dx, int dy) { + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + /* * nxagentConfigureWindow(pWin, CWStackMode); */ @@ -2092,8 +2143,13 @@ void nxagentClipNotify(WindowPtr pWin, int dx, int dy) */ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_exposed) { + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + /* - * The problem: we want to synthetize the expose events internally, so + * The problem: we want to synthesize the expose events internally, so * that we reduce the time between a window operation and the corresp- * onding graphical output, but at the same time we need to take care * of the remote exposures, as we need to handle those cases where our @@ -2133,7 +2189,7 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo if (!nxagentExposeArrayIsInitialized) { #ifdef TEST - fprintf(stderr, "nxagentWindowExposures: Initializing expose queue.\n"); + fprintf(stderr, "%s: Initializing expose queue.\n", __func__); #endif for (int i = 0; i < EXPOSED_SIZE; i++) @@ -2201,8 +2257,8 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo nxagentExposeQueue.exposures[index].remoteRegion, &temp); #ifdef TEST - fprintf(stderr, "nxagentWindowExposures: Added region to remoteRegion for window [%ld] to position [%d].\n", - nxagentWindow(pWin), nxagentExposeQueue.length); + fprintf(stderr, "%s: Added region to remoteRegion for window [%p][0x%x] remote [0x%x] to queue pos [%d].\n", __func__, + (void *)pWin, pWin->drawable.id, nxagentWindow(pWin), nxagentExposeQueue.length); #endif } else @@ -2211,8 +2267,8 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo nxagentExposeQueue.exposures[index].localRegion, &temp); #ifdef TEST - fprintf(stderr, "nxagentWindowExposures: Added region to localRegion for window [%ld] to position [%d].\n", - nxagentWindow(pWin), nxagentExposeQueue.length); + fprintf(stderr, "%s: Added region to localRegion for window [%p][0x%x] remote [0x%x] to queue pos [%d].\n", __func__, + (void *)pWin, pWin->drawable.id, nxagentWindow(pWin), nxagentExposeQueue.length); #endif } @@ -2221,7 +2277,7 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo nxagentExposeQueue.exposures[index].serial = nxagentExposeSerial; #ifdef TEST - fprintf(stderr, "nxagentWindowExposures: Added region to queue with serial [%d].\n", nxagentExposeSerial); + fprintf(stderr, "%s: Added region to queue with serial [%d].\n", __func__, nxagentExposeSerial); #endif /* @@ -2246,7 +2302,7 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo RegionUninit(&temp); #ifdef TEST - fprintf(stderr, "nxagentWindowExposures: WARNING! Reached maximum size of collect exposures vector.\n"); + fprintf(stderr, "%s: WARNING! Reached maximum size of collect exposures vector.\n", __func__); #endif if ((pRgn != NULL && RegionNotEmpty(pRgn) != 0) || @@ -2320,8 +2376,8 @@ void nxagentShapeWindow(WindowPtr pWin) } #ifdef DEBUG - fprintf(stderr, "nxagentShapeWindow: Window at [%p][%ld].\n", - (void *) pWin, nxagentWindow(pWin)); + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif /* @@ -2332,13 +2388,13 @@ void nxagentShapeWindow(WindowPtr pWin) wBoundingShape(pWin))) { #ifdef DEBUG - fprintf(stderr, "nxagentShapeWindow: Bounding shape differs.\n"); + fprintf(stderr, "%s: Bounding shape differs.\n", __func__); #endif if (wBoundingShape(pWin)) { #ifdef DEBUG - fprintf(stderr, "nxagentShapeWindow: wBounding shape has [%ld] rects.\n", + fprintf(stderr, "%s: wBounding shape has [%d] rects.\n", __func__, RegionNumRects(wBoundingShape(pWin))); #endif @@ -2372,7 +2428,7 @@ void nxagentShapeWindow(WindowPtr pWin) else { #ifdef DEBUG - fprintf(stderr, "nxagentShapeWindow: wBounding shape does not exist. Removing the shape.\n"); + fprintf(stderr, "%s: wBounding shape does not exist. Removing the shape.\n", __func__); #endif RegionEmpty(nxagentWindowPriv(pWin)->boundingShape); @@ -2385,13 +2441,13 @@ void nxagentShapeWindow(WindowPtr pWin) if (!nxagentRegionEqual(nxagentWindowPriv(pWin)->clipShape, wClipShape(pWin))) { #ifdef DEBUG - fprintf(stderr, "nxagentShapeWindow: Clip shape differs.\n"); + fprintf(stderr, "%s: Clip shape differs.\n", __func__); #endif if (wClipShape(pWin)) { #ifdef DEBUG - fprintf(stderr, "nxagentShapeWindow: wClip shape has [%ld] rects.\n", + fprintf(stderr, "%s: wClip shape has [%d] rects.\n", __func__, RegionNumRects(wClipShape(pWin))); #endif @@ -2425,7 +2481,7 @@ void nxagentShapeWindow(WindowPtr pWin) else { #ifdef DEBUG - fprintf(stderr, "nxagentShapeWindow: wClip shape does not exist. Removing the shape.\n"); + fprintf(stderr, "%s: wClip shape does not exist. Removing the shape.\n", __func__); #endif RegionEmpty(nxagentWindowPriv(pWin)->clipShape); @@ -2439,6 +2495,11 @@ void nxagentShapeWindow(WindowPtr pWin) static int nxagentForceExposure(WindowPtr pWin, void * ptr) { + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + if (pWin -> drawable.class != InputOnly) { WindowPtr pRoot = pWin->drawable.pScreen->root; @@ -2506,7 +2567,7 @@ void nxagentMapDefaultWindows(void) */ #ifdef TEST - fprintf(stderr, "nxagentMapDefaultWindows: Showing the splash window.\n"); + fprintf(stderr, "%s: Showing the splash window.\n", __func__); #endif nxagentShowSplashWindow(nxagentDefaultWindows[pScreen->myNum]); @@ -2522,7 +2583,7 @@ void nxagentMapDefaultWindows(void) if (!nxagentOption(Shadow) || !nxagentWMIsRunning) { #ifdef TEST - fprintf(stderr, "nxagentMapDefaultWindows: Mapping default window id [%ld].\n", + fprintf(stderr, "%s: Mapping default window id [0x%x].\n", __func__, nxagentDefaultWindows[pScreen->myNum]); #endif @@ -2568,7 +2629,7 @@ void nxagentMapDefaultWindows(void) if (nxagentIconWindow != None) { #ifdef TEST - fprintf(stderr, "nxagentMapDefaultWindows: Mapping icon window id [%ld].\n", + fprintf(stderr, "%s: Mapping icon window id [0x%x].\n", __func__, nxagentIconWindow); #endif @@ -2586,7 +2647,7 @@ void nxagentMapDefaultWindows(void) } #ifdef TEST - fprintf(stderr, "nxagentMapDefaultWindows: Completed mapping of default windows.\n"); + fprintf(stderr, "%s: Completed mapping of default windows.\n", __func__); #endif } @@ -2595,7 +2656,7 @@ Bool nxagentDisconnectAllWindows(void) Bool succeeded = True; #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_WINDOW_DEBUG) - fprintf(stderr, "nxagentDisconnectAllWindows\n"); + fprintf(stderr, "%s\n", __func__); #endif for (int i = 0; i < screenInfo.numScreens; i++) @@ -2605,7 +2666,7 @@ Bool nxagentDisconnectAllWindows(void) } #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG - fprintf(stderr, "nxagentDisconnectAllWindows: all windows disconnected\n"); + fprintf(stderr, "%s: all windows disconnected\n", __func__); #endif return succeeded; @@ -2635,8 +2696,8 @@ void nxagentDisconnectWindow(void * p0, XID x1, void * p2) #endif #ifdef NXAGENT_RECONNECT_CURSOR_DEBUG - fprintf(stderr, "nxagentDisconnectWindow: window %p - disconnecting cursor %p ID %lx\n", - pWin, pCursor, nxagentCursor(pCursor, pScreen)); + fprintf(stderr, "%s: window [%p] - disconnecting cursor [%p][0x%x]\n", __func__, + (void *)pWin, (void *))pCursor, nxagentCursor(pCursor, pScreen)); #endif nxagentDisconnectCursor(pCursor, (XID)0, pBool); @@ -2644,8 +2705,8 @@ void nxagentDisconnectWindow(void * p0, XID x1, void * p2) if (!*pBool) { #ifdef WARNING - fprintf(stderr, "nxagentDisconnectWindow: WARNING failed disconnection of cursor at [%p]" - " for window at [%p]: ignoring it.\n", (void*)pCursor, (void*)pWin); + fprintf(stderr, "%s: WARNING failed disconnection of cursor at [%p]" + " for window at [%p]: ignoring it.\n", __func__, (void*)pCursor, (void*)pWin); #endif *pBool = True; @@ -2654,8 +2715,8 @@ void nxagentDisconnectWindow(void * p0, XID x1, void * p2) #ifdef NXAGENT_RECONNECT_CURSOR_DEBUG else if (pCursor) { - fprintf(stderr, "nxagentDisconnectWindow: window %p - cursor %p already disconnected\n", - pWin, pCursor); + fprintf(stderr, "%s: window [%p] - cursor [%p] already disconnected\n", __func__, + (void *)pWin, (void *)pCursor); } #endif @@ -2665,12 +2726,12 @@ void nxagentDisconnectWindow(void * p0, XID x1, void * p2) if (DeleteProperty(pWin, prop) != Success) { - fprintf(stderr, "nxagentDisconnectWindow: Deleting NX_REAL_WINDOW failed.\n"); + fprintf(stderr, "%s: Deleting NX_REAL_WINDOW failed.\n", __func__); } #ifdef DEBUG else { - fprintf(stderr, "nxagentDisconnectWindow: Deleting NX_REAL_WINDOW from Window ID [%x].\n", nxagentWindowPriv(pWin)->window); + fprintf(stderr, "%s: Deleting NX_REAL_WINDOW from Window ID [%x].\n", __func__, nxagentWindow(pWin)); } #endif } @@ -2691,13 +2752,13 @@ Bool nxagentReconnectAllWindows(void *p0) */ #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_WINDOW_DEBUG) - fprintf(stderr, "nxagentReconnectAllWindows\n"); + fprintf(stderr, "%s\n", __func__); #endif if (screenInfo.screens[0]->root -> backgroundState == BackgroundPixmap && screenInfo.screens[0]->root -> background.pixmap == NULL) { - FatalError("nxagentReconnectAllWindows: correct the FIXME\n"); + FatalError("%s: correct the FIXME\n", __func__); } if (nxagentOption(Fullscreen)) @@ -2709,7 +2770,7 @@ Bool nxagentReconnectAllWindows(void *p0) if (!nxagentLoopOverWindows(nxagentReconnectWindow)) { #ifdef WARNING - fprintf(stderr, "nxagentReconnectAllWindows: couldn't recreate windows\n"); + fprintf(stderr, "%s: couldn't recreate windows\n", __func__); #endif return False; @@ -2717,13 +2778,13 @@ Bool nxagentReconnectAllWindows(void *p0) #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG XSync(nxagentDisplay, 0); - fprintf(stderr, "nxagentReconnectAllWindows: all windows recreated\n"); + fprintf(stderr, "%s: all windows recreated\n", __func__); #endif if (!nxagentLoopOverWindows(nxagentReconfigureWindow)) { #ifdef WARNING - fprintf(stderr, "nxagentReconnectAllWindows: couldn't reconfigure windows\n"); + fprintf(stderr, "%s: couldn't reconfigure windows\n", __func__); #endif return False; @@ -2752,13 +2813,13 @@ Bool nxagentReconnectAllWindows(void *p0) #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG XSync(nxagentDisplay, 0); - fprintf(stderr, "nxagentReconnectAllWindows: All windows reconfigured.\n"); + fprintf(stderr, "%s: All windows reconfigured.\n", __func__); #endif if (!nxagentInitClipboard(screenInfo.screens[0]->root)) { #ifdef WARNING - fprintf(stderr, "nxagentReconnectAllWindows: WARNING! Couldn't initialize the clipboard.\n"); + fprintf(stderr, "%s: WARNING! Couldn't initialize the clipboard.\n", __func__); #endif return False; @@ -2766,7 +2827,7 @@ Bool nxagentReconnectAllWindows(void *p0) #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG XSync(nxagentDisplay, 0); - fprintf(stderr, "nxagentReconnectAllWindows: Clipboard initialized.\n"); + fprintf(stderr, "%s: Clipboard initialized.\n", __func__); #endif #ifdef VIEWPORT_FRAME @@ -2801,20 +2862,20 @@ Bool nxagentSetWindowCursors(void *p0) */ #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_WINDOW_DEBUG) - fprintf(stderr, "nxagentSetWindowCursors: Going to loop over the windows.\n"); + fprintf(stderr, "%s Going to loop over the windows.\n", __func__); #endif if (!nxagentLoopOverWindows(nxagentReconfigureWindowCursor)) { #ifdef WARNING - fprintf(stderr, "nxagentSetWindowCursors: WARNING! Couldn't configure all windows' cursors.\n"); + fprintf(stderr, "%s WARNING! Couldn't configure all windows' cursors.\n", __func__); #endif return False; } #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG - fprintf(stderr, "nxagentSetWindowCursors: All cursors configured.\n"); + fprintf(stderr, "%s All cursors configured.\n", __func__); #endif nxagentReDisplayCurrentCursor(); @@ -2867,9 +2928,12 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer } #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG - fprintf(stderr, "nxagentReconnectWindow: %p - ID %lx\n", pWin, nxagentWindow(pWin)); + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif + /* FIXME: this is largely identical to nxagentCreateWindow */ + if (pWin->drawable.class == InputOnly) { mask = CWEventMask; @@ -2879,8 +2943,6 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer { mask = CWEventMask | CWBackingStore; - attributes.backing_store = NotUseful; - if (pWin->optional) { mask |= CWBackingPlanes | CWBackingPixel; @@ -2888,6 +2950,13 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer attributes.backing_pixel = pWin->optional->backingPixel; } + attributes.backing_store = NotUseful; + + #ifdef TEST + fprintf(stderr, "%s: Backing store on window at [%p] is [%d].\n", __func__, + (void*)pWin, attributes.backing_store); + #endif + /* FIXME: Do we need to set save unders attribute here? */ @@ -2913,7 +2982,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer attributes.colormap = nxagentDefaultVisualColormap(visual); } } - else + else /* FIXME? nxagentCreateWindow has >if (pWin->optional)< here */ { visual = CopyFromParent; } @@ -2940,10 +3009,10 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer #endif #ifdef TEST - fprintf(stderr, "nxagentReconnectWindow: Going to create new window.\n"); - fprintf(stderr, "nxagentReconnectWindow: Recreating %swindow at %p current event mask = %lX mask & CWEventMask = %ld " - "event_mask = %lX\n", - nxagentWindowTopLevel(pWin) ? "toplevel " : "", (void*)pWin, pWin -> eventMask, + fprintf(stderr, "%s: Going to create new remote window.\n", __func__); + fprintf(stderr, "%s: Recreating %swindow at [%p][0x%x] current event mask [%X] mask & CWEventMask [%ld] " + "event_mask [%lX]\n", __func__, + nxagentWindowTopLevel(pWin) ? "toplevel " : "", (void*)pWin, pWin->drawable.id, pWin -> eventMask, mask & CWEventMask, attributes.event_mask); #endif @@ -2952,7 +3021,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer * server for windows. The NXWin minimize the windows moving * them out of the screen area, this behaviour can cause * problem when a rootless session is disconnected and an - * apps is minimized. It will be solved with new Xorg + * app is minimized. It will be solved with new Xorg * version of the NXWin server. */ @@ -2971,37 +3040,35 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer } } - nxagentWindow(pWin) = XCreateWindow(nxagentDisplay, - nxagentWindowParent(pWin), - pWin->origin.x - - wBorderWidth(pWin), - pWin->origin.y - - wBorderWidth(pWin), - pWin->drawable.width, - pWin->drawable.height, - pWin->borderWidth, - pWin->drawable.depth, - pWin->drawable.class, - visual, - mask, - &attributes); + nxagentWindowPriv(pWin)->window = XCreateWindow(nxagentDisplay, + nxagentWindowParent(pWin), + pWin->origin.x - wBorderWidth(pWin), + pWin->origin.y - wBorderWidth(pWin), + pWin->drawable.width, + pWin->drawable.height, + pWin->borderWidth, + pWin->drawable.depth, + pWin->drawable.class, + visual, + mask, + &attributes); if (nxagentReportPrivateWindowIds) { fprintf(stderr, "NXAGENT_WINDOW_ID: %s_WINDOW,WID:[0x%x],INT:[0x%x]\n", (pWin->drawable.id == pWin->drawable.pScreen->root->drawable.id) ? "ROOT" : "PRIVATE", - nxagentWindowPriv(pWin)->window, pWin->drawable.id); + nxagentWindow(pWin), pWin->drawable.id); } #ifdef DEBUG { char *winname = NULL; - if (-1 != asprintf(&winname, "%s %s[0x%lx]", nxagentWindowName, + if (-1 != asprintf(&winname, "%s %s[0x%x]", nxagentWindowName, (pWin->drawable.id == pWin->drawable.pScreen->root->drawable.id) ? "Root" : "Private", pWin->drawable.id)) { - Xutf8SetWMProperties(nxagentDisplay, nxagentWindowPriv(pWin)->window, + Xutf8SetWMProperties(nxagentDisplay, nxagentWindow(pWin), winname, winname, NULL , 0 , NULL, NULL, NULL); SAFE_free(winname); } @@ -3009,8 +3076,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer #endif #ifdef TEST - fprintf(stderr, "nxagentReconnectWindow: Created new window with id [0x%x].\n", - nxagentWindowPriv(pWin)->window); + fprintf(stderr, "%s: Recreated new remote window with id [0x%x].\n", __func__, nxagentWindow(pWin)); #endif /* @@ -3060,7 +3126,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer type == XA_WM_SIZE_HINTS) { #ifdef TEST - fprintf(stderr, "nxagentReconnectWindow: setting WMSizeHints on window %p [%lx - %lx].\n", + fprintf(stderr, "%s: setting WMSizeHints on window %p [0x%x - 0x%x].\n", __func__, (void*)pWin, pWin -> drawable.id, nxagentWindow(pWin)); #endif @@ -3103,7 +3169,7 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer else { #ifdef WARNING - fprintf(stderr, "nxagentReconnectWindow: Failed to get property WM_NORMAL_HINTS on window %p\n", + fprintf(stderr, "%s: Failed to get property WM_NORMAL_HINTS on window [%p]\n", __func__, (void*)pWin); #endif } @@ -3129,12 +3195,12 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer if (ChangeWindowProperty(pWin, prop, XA_WINDOW, 32, PropModeReplace, 1, nxagentWindowPriv(pWin), 1) != Success) { - fprintf(stderr, "nxagentReconnectWindow: Updating NX_REAL_WINDOW failed.\n"); + fprintf(stderr, "%s: Updating NX_REAL_WINDOW failed.\n", __func__); } #ifdef DEBUG else { - fprintf(stderr, "nxagentReconnectWindow: Updated NX_REAL_WINDOW for Window ID [%x].\n", nxagentWindowPriv(pWin)->window); + fprintf(stderr, "%s: Updated NX_REAL_WINDOW for Window ID [%x].\n", __func__, nxagentWindow(pWin)); } #endif } @@ -3164,20 +3230,19 @@ static void nxagentReconfigureWindowCursor(void * param0, XID param1, void * dat } #ifdef DEBUG - fprintf(stderr, "nxagentReconfigureWindowCursor: %p - ID %lx geometry (%d,%d,%d,%d) " - "cursor %p - ID %lx\n", - pWin, nxagentWindow(pWin), + fprintf(stderr, "%s: [%p][0x%x] geometry [%d,%d,%d,%d] cursor [%p][0x%x]\n", __func__, + (void *)pWin, nxagentWindow(pWin), pWin -> drawable.x, pWin -> drawable.y, pWin -> drawable.width, pWin -> drawable.height, - pCursor, nxagentCursor(pCursor, pScreen)); + (void *)pCursor, nxagentCursor(pCursor, pScreen)); #endif if (nxagentCursor(pCursor, pScreen) == None) { #ifdef NXAGENT_RECONNECT_WINDOW_DEBUG - fprintf(stderr, "nxagentReconfigureWindowCursor: reconnecting valid cursor %lx\n", + fprintf(stderr, "%s: reconnecting valid cursor [%p]\n", __func__, (void*)pCursor); #endif @@ -3186,8 +3251,8 @@ static void nxagentReconfigureWindowCursor(void * param0, XID param1, void * dat if (!*pBool) { #ifdef WARNING - fprintf(stderr, "nxagentReconfigureWindowCursor: WARNING " - "failed reconnection of cursor at [%p] for window at [%p]: ignoring it.\n", + fprintf(stderr, "%s: WARNING " + "failed reconnection of cursor at [%p] for window at [%p]: ignoring it.\n", __func__, (void*)pCursor, (void*)pWin); #endif @@ -3207,7 +3272,8 @@ static void nxagentReconfigureWindow(void * param0, XID param1, void * data_buff unsigned long mask = 0; #ifdef DEBUG - fprintf(stderr, "nxagentReconfigureWindow: pWin %p - ID %lx\n", pWin, nxagentWindow(pWin)); + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); #endif if (pWin -> drawable.class == InputOnly) @@ -3289,7 +3355,7 @@ Bool nxagentCheckIllegalRootMonitoring(WindowPtr pWin, Mask mask) } #ifdef TEST -Bool nxagentCheckWindowIntegrity(WindowPtr pWin) +static _X_UNUSED Bool nxagentCheckWindowIntegrity(WindowPtr pWin) { Bool integrity = True; @@ -3304,7 +3370,7 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin) char *data = calloc(1, length); if (data == NULL) { - FatalError("nxagentCheckWindowIntegrity: Failed to allocate a buffer of size %d.\n", length); + FatalError("%s: Failed to allocate a buffer of size [%d].\n", __func__, length); } unsigned long plane_mask = AllPlanes; @@ -3339,19 +3405,19 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin) #endif #ifdef WARNING - fprintf(stderr, "nxagentCheckWindowIntegrity: Window %p width %d, height %d, has been realized " - "but the data buffer still differs.\n", (void*) pWin, width, height); - fprintf(stderr, "nxagentCheckWindowIntegrity: bytes_per_line = %d byte pad %d format %d.\n", + fprintf(stderr, "%s: Window [%p] geometry [%d,%d], has been realized " + "but the data buffer still differs.\n", __func__, (void*) pWin, width, height); + fprintf(stderr, "%s: bytes_per_line = [%d] byte pad [%d] format [%d].\n", __func__, image -> bytes_per_line, nxagentImagePad(width, height, 0, depth), image->format); - fprintf(stderr, "nxagentCheckWindowIntegrity: image is corrupted!!\n"); + fprintf(stderr, "%s: image is corrupted!!\n", __func__); #endif } else { #ifdef WARNING - fprintf(stderr, "nxagentCheckWindowIntegrity: Window %p has been realized " - "now remote and framebuffer data are synchronized.\n", (void*) pWin); + fprintf(stderr, "%s: Window [%p] has been realized " + "now remote and framebuffer data are synchronized.\n", __func__ ,(void*) pWin); #endif } @@ -3365,7 +3431,7 @@ Bool nxagentCheckWindowIntegrity(WindowPtr pWin) else { #ifdef WARNING - fprintf(stderr, "nxagentCheckWindowIntegrity: ignored window %p with geometry (%d,%d).\n", + fprintf(stderr, "%s: ignored window [%p] with geometry [%d,%d].\n", __func__, (void*) pWin, width, height); #endif } @@ -3470,8 +3536,8 @@ void nxagentFlushConfigureWindow(void) }; #ifdef DEBUG - fprintf(stderr, "nxagentFlushConfigureWindow: Sending synch ConfigureWindow for " - "index [%d] serial [%d].\n", i, nxagentExposeQueue.exposures[i].serial); + fprintf(stderr, "%s: Sending synch ConfigureWindow for " + "index [%d] serial [%d].\n", __func__, i, nxagentExposeQueue.exposures[i].serial); #endif XConfigureWindow(nxagentDisplay, nxagentConfiguredSynchroWindow, @@ -3517,9 +3583,12 @@ void nxagentPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind) */ void nxagentAddConfiguredWindow(WindowPtr pWin, unsigned int valuemask) { - unsigned int mask; + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x] with mask [%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin), valuemask); + #endif - mask = valuemask & (CWSibling | CWX | CWY | CWWidth | CWHeight | + unsigned int mask = valuemask & (CWSibling | CWX | CWY | CWWidth | CWHeight | CWBorderWidth | CWStackMode | CW_Map | CW_Update | CW_Shape); valuemask &= ~(CWSibling | CWX | CWY | CWWidth | CWHeight | CWBorderWidth | CWStackMode); @@ -3594,6 +3663,11 @@ void nxagentDeleteConfiguredWindow(WindowPtr pWin) { ConfiguredWindowStruct *index, *previous, *tmp; + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + index = nxagentConfiguredWindowList; while (index) @@ -3646,6 +3720,11 @@ void nxagentAddStaticResizedWindow(WindowPtr pWin, unsigned long sequence, int o { StaticResizedWindowStruct *tmp = nxagentStaticResizedWindowList; + #ifdef DEBUG + fprintf(stderr, "%s: Called with window [%p][0x%x] remote [0x%x].\n", __func__, + (void *) pWin, pWin->drawable.id, nxagentWindow(pWin)); + #endif + nxagentStaticResizedWindowList = malloc(sizeof(StaticResizedWindowStruct)); if (!nxagentStaticResizedWindowList) { @@ -3750,13 +3829,13 @@ void nxagentEmptyBackingStoreRegion(void * param0, XID param1, void * data_buffe RegionEmpty(&pBackingStore->SavedRegion); #ifdef TEST - fprintf(stderr, "nxagentEmptyBackingStoreRegion: Emptying saved region for window at [%p].\n", (void*) pWin); + fprintf(stderr, "%s: Emptying saved region for window at [%p].\n", __func__, (void*) pWin); #endif if (pBackingStore -> pBackingPixmap != NULL) { #ifdef TEST - fprintf(stderr, "nxagentEmptyBackingStoreRegion: Emptying corrupted region for drawable at [%p].\n", + fprintf(stderr, "%s: Emptying corrupted region for drawable at [%p].\n", __func__, (void*) pBackingStore -> pBackingPixmap); #endif @@ -3770,7 +3849,7 @@ void nxagentEmptyAllBackingStoreRegions(void) if (nxagentLoopOverWindows(nxagentEmptyBackingStoreRegion) == 0) { #ifdef WARNING - fprintf(stderr, "nxagentEmptyAllSavedRegions: Failed to empty backing store saved regions.\n"); + fprintf(stderr, "%s: Failed to empty backing store saved regions.\n", __func__); #endif } } @@ -3790,7 +3869,7 @@ int nxagentAddItemBSPixmapList(unsigned long id, PixmapPtr pPixmap, WindowPtr pW if (nxagentBSPixmapList[i] == NULL) { - FatalError("nxagentAddItemBSPixmapList: Failed to allocate memory for nxagentBSPixmapList.\n"); + FatalError("%s: Failed to allocate memory for nxagentBSPixmapList.\n", __func__); } nxagentBSPixmapList[i] -> storingPixmapId = id; @@ -3800,7 +3879,7 @@ int nxagentAddItemBSPixmapList(unsigned long id, PixmapPtr pPixmap, WindowPtr pW nxagentBSPixmapList[i] -> backingStoreY = bsy; #ifdef TEST - fprintf(stderr, "nxagentAddItemBSPixmapList: Added Pixmap with id [%lu] to nxagentBSPixmapList.\n", id); + fprintf(stderr, "%s: Added Pixmap with id [%lu] to nxagentBSPixmapList.\n", __func__, id); #endif return 1; @@ -3814,7 +3893,7 @@ int nxagentAddItemBSPixmapList(unsigned long id, PixmapPtr pPixmap, WindowPtr pW nxagentBSPixmapList[i] -> backingStoreY = bsy; #ifdef TEST - fprintf(stderr, "nxagentAddItemBSPixmapList: Updated existing item for id [%lu].\n", id); + fprintf(stderr, "%s: Updated existing item for id [%lu].\n", __func__, id); #endif return 1; @@ -3822,7 +3901,7 @@ int nxagentAddItemBSPixmapList(unsigned long id, PixmapPtr pPixmap, WindowPtr pW } #ifdef TEST - fprintf(stderr, "nxagentAddItemBSPixmapList: WARNING! List item full.\n"); + fprintf(stderr, "%s: WARNING! List item full.\n", __func__); #endif return 0; @@ -3858,7 +3937,7 @@ int nxagentRemoveItemBSPixmapList(unsigned long pixmapId) } #ifdef TEST - fprintf(stderr, "nxagentRemoveItemBSPixmapList: Removed Pixmap with id [%lu] from list.\n", + fprintf(stderr, "%s: Removed Pixmap with id [%lu] from list.\n", __func__, pixmapId); #endif @@ -3867,7 +3946,7 @@ int nxagentRemoveItemBSPixmapList(unsigned long pixmapId) } #ifdef TEST - fprintf(stderr, "nxagentRemoveItemBSPixmapList: WARNING! Can't remove item [%lu]: item not found.\n", + fprintf(stderr, "%s: WARNING! Can't remove item [%lu]: item not found.\n", __func__, pixmapId); #endif |