From 22914447019845ba3ba238e5814b59939e744f19 Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Mon, 10 Oct 2011 17:58:56 +0200 Subject: Imported nxagent-3.3.0-18.tar.gz Summary: Imported nxagent-3.3.0-18.tar.gz Keywords: Imported nxagent-3.3.0-18.tar.gz into Git repository --- nx-X11/programs/Xserver/hw/nxagent/CHANGELOG | 32 ++++++++++ nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 24 +++++++ nx-X11/programs/Xserver/hw/nxagent/Colormap.c | 17 ++++- nx-X11/programs/Xserver/hw/nxagent/Dialog.h | 2 +- nx-X11/programs/Xserver/hw/nxagent/Display.c | 15 +++++ nx-X11/programs/Xserver/hw/nxagent/GCOps.c | 87 ++++++++++++++++++++++++++ nx-X11/programs/Xserver/hw/nxagent/Rootless.c | 64 ++++++++++++++----- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 19 ++++-- 8 files changed, 237 insertions(+), 23 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/CHANGELOG b/nx-X11/programs/Xserver/hw/nxagent/CHANGELOG index 90f4949ee..1adbcb938 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/CHANGELOG +++ b/nx-X11/programs/Xserver/hw/nxagent/CHANGELOG @@ -1,5 +1,37 @@ ChangeLog: +nxagent-3.3.0-18 + +- The area to restore from the backing store is limited by the screen + size instead of the visible screen. + +nxagent-3.3.0-17 + +- Fixed TR12F02150. The agent could crash when copying text from VNC + viewer. Fixed by aborting the procedure in case the retrieved pro- + perty has not a valid format. + +nxagent-3.3.0-16 + +- Fixed TR07G02247. Don't try to call XSetWindowColormap() if the + window has no colormap, e.g. if its class is InputOnly. + +nxagent-3.3.0-15 + +- Fixed TR04G02210. Region is cut to the visible screen before re- + storing areas from the backing store. + +- Fixed TR07G02246. Box is shrinked if bounds can't stay in a short + signed integer. + +nxagent-3.3.0-14 + +- Fixed TR03G02206. waitpid() call was missing for the "Fonts replace- + ment" dialog type. + +- Fixed TR03G02195. Added a properties structure compatible with 32 + and 64 bit platform types. + nxagent-3.3.0-13 - Handle the window unmap immediately. Don't add it to the configure diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index a575cabe5..febfe708d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -680,6 +680,30 @@ void nxagentCollectPropertyEvent(int resource) return; } + + if (resultFormat != 8 && resultFormat != 16 && resultFormat != 32) + { + + #ifdef DEBUG + fprintf (stderr, "nxagentCollectPropertyEvent: WARNING! Invalid property " + "value.\n"); + #endif + + if (lastClientClientPtr != NULL) + { + nxagentSendSelectionNotify(None); + } + + lastClientWindowPtr = NULL; + lastClientStage = SelectionStageNone; + + if (pszReturnData != NULL) + { + XFree(pszReturnData); + } + + return; + } switch (lastClientStage) { diff --git a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c index 75758679f..fe0e567f6 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c @@ -291,9 +291,20 @@ void nxagentSetInstalledColormapWindows(ScreenPtr pScreen) pCmap = (ColormapPtr)LookupIDByType(pScreen->defColormap, RT_COLORMAP); - XSetWindowColormap(nxagentDisplay, - nxagentDefaultWindows[pScreen->myNum], - nxagentColormap(pCmap)); + if (pCmap != NULL) + { + XSetWindowColormap(nxagentDisplay, + nxagentDefaultWindows[pScreen->myNum], + nxagentColormap(pCmap)); + } + #ifdef WARNING + else + { + fprintf(stderr, "nxagentSetInstalledColormapWindows: WARNING! " + "Window at [%p] has no colormap with class [%d].\n", + pWin, pWin -> drawable.class); + } + #endif } #endif /* DUMB_WINDOW_MANAGERS */ } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Dialog.h b/nx-X11/programs/Xserver/hw/nxagent/Dialog.h index 135cd2df3..a28329457 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Dialog.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Dialog.h @@ -42,7 +42,7 @@ extern int nxagentKillDialogPid; extern int nxagentSuspendDialogPid; extern int nxagentRootlessDialogPid; extern int nxagentPulldownDialogPid; -extern int nxagentFontsReplacement; +extern int nxagentFontsReplacementDialogPid; extern int nxagentEnableRandRModeDialogPid; extern int nxagentDisableRandRModeDialogPid; extern int nxagentEnableDeferModePid; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index 9f257e508..8d72654e6 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -453,6 +453,21 @@ static void nxagentSigchldHandler(int signal) } } + if (pid == 0 && nxagentFontsReplacementDialogPid) + { + pid = waitpid(nxagentFontsReplacementDialogPid, &status, options); + + if (pid == -1 && errno == ECHILD) + { + #ifdef WARNING + fprintf(stderr, "nxagentSigchldHandler: Got ECHILD waiting for child %d (Fonts replacement).\n", + nxagentFontsReplacementDialogPid); + #endif + + pid = nxagentFontsReplacementDialogPid = 0; + } + } + if (pid == 0 && nxagentEnableRandRModeDialogPid) { pid = waitpid(nxagentEnableRandRModeDialogPid, &status, options); diff --git a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c index 83aa04f11..9afd6e392 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c @@ -594,6 +594,8 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, unsigned int format; unsigned long planeMask = 0xffffffff; + int oldDstxyValue; + RegionPtr pDstRegion; int skip = 0; @@ -605,6 +607,91 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, (void *) pDstDrawable, srcx, srcy, dstx, dsty, width, height); #endif + /* + * Here, before using fbDoCopy() called by fbCopyArea(), + * it should be provided that the cast in fbDoCopy() from + * int to short int would not cut off significative bits. + */ + + if (dstx + pDstDrawable->x + width > 32767) + { + #ifdef WARNING + fprintf(stderr, "nxagentCopyArea: x2 exceeding short int.\n"); + #endif + + width = 32767 - dstx - pDstDrawable->x; + + if (width <= 0) + { + #ifdef TEST + fprintf(stderr, "nxagentCopyArea: Returning null on x2 check.\n"); + #endif + + return NullRegion; + } + } + + if (dstx + pDstDrawable->x < -32768) + { + #ifdef WARNING + fprintf(stderr, "nxagentCopyArea: x1 exceeding short int.\n"); + #endif + + width += pDstDrawable->x + dstx + 32768; + srcx -= pDstDrawable->x + dstx + 32768; + dstx = -32768 - pDstDrawable->x; + + if (width <= 0) + { + #ifdef TEST + fprintf(stderr, "nxagentCopyArea: Returning null on x1 check.\n"); + #endif + + return NullRegion; + } + } + + oldDstxyValue = dsty; + + if (dsty + pDstDrawable->y + height > 32767) + { + #ifdef WARNING + fprintf(stderr, "nxagentCopyArea: y2 exceeding short int.\n"); + #endif + + height = 32767 - dsty - pDstDrawable->y; + + if (height <= 0) + { + #ifdef TEST + fprintf(stderr, "nxagentCopyArea: Returning null on y2 check.\n"); + #endif + + return NullRegion; + } + } + + if (dsty + pDstDrawable->y < -32768) + { + #ifdef WARNING + fprintf(stderr, "nxagentCopyArea: y1 exceeding short int.\n"); + #endif + + height += 32768 + pDstDrawable->y + dsty; + srcy -= 32768 + pDstDrawable->y + dsty; + dsty = -32768 - pDstDrawable->y; + + if (height <= 0) + { + #ifdef TEST + fprintf(stderr, "nxagentCopyArea: Returning null on y1 check.\n"); + #endif + + return NullRegion; + } + } + + if (nxagentGCTrap == 1 || nxagentShmTrap == 1) { if (pSrcDrawable -> type == DRAWABLE_PIXMAP && diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c index 79cb74efa..e192cd2c4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c @@ -60,6 +60,27 @@ typedef struct } nxagentWMHints; +/* + * This structure is compatible with 32 + * and 64 bit library interface. It has + * been copied from Xatomtype.h and it's + * a parameter of XChangeProperty(). + */ + +typedef struct +{ + unsigned long flags; + long input; + long initialState; + unsigned long iconPixmap; + unsigned long iconWindow; + long iconX; + long iconY; + unsigned long iconMask; + unsigned long windowGroup; +} +nxagentPropWMHints; + WindowPtr nxagentRootlessWindow = NULL; #define TOP_LEVEL_TABLE_UNIT 100 @@ -429,6 +450,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) Atom propertyX, typeX; char *output = NULL; nxagentWMHints wmHints; + nxagentPropWMHints propHints; Bool export = False; Bool freeMem = False; @@ -489,8 +511,22 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) wmHints.flags |= InputHint; wmHints.input = True; - output = (char*) &wmHints; - export = True; + /* + * Initialize the structure used in XChangeProperty(). + */ + + propHints.flags = wmHints.flags; + propHints.input = (wmHints.input == True ? 1 : 0); + propHints.initialState = wmHints.initial_state; + propHints.iconPixmap = wmHints.icon_pixmap; + propHints.iconWindow = wmHints.icon_window; + propHints.iconX = wmHints.icon_x; + propHints.iconY = wmHints.icon_y; + propHints.iconMask = wmHints.icon_mask; + propHints.windowGroup = wmHints.window_group; + + output = (char*) &propHints; + export = True; if ((wmHints.flags & IconPixmapHint) && (wmHints.icon_pixmap != None)) { @@ -504,17 +540,17 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) nxagentSynchronizeRegion((DrawablePtr) icon, NullRegion, NEVER_BREAK, NULL); } - wmHints.icon_pixmap = nxagentPixmap(icon); + propHints.iconPixmap = nxagentPixmap(icon); } else { - wmHints.flags &= ~IconPixmapHint; + propHints.flags &= ~IconPixmapHint; #ifdef WARNING fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon pixmap %x from hint " "exporting property %s type %s on window %p.\n", (unsigned int) wmHints.icon_pixmap, propertyS, typeS, - (void*)pWin); + (void *) pWin); #endif } } @@ -526,17 +562,17 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) if (icon) { - wmHints.icon_window = nxagentWindow(icon); + propHints.iconWindow = nxagentWindow(icon); } else { - wmHints.flags &= ~IconWindowHint; + propHints.flags &= ~IconWindowHint; #ifdef WARNING fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon window %x from hint " "exporting property %s type %s on window %p.\n", (unsigned int) wmHints.icon_window, propertyS, typeS, - (void*)pWin); + (void *) pWin); #endif } } @@ -548,17 +584,17 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) if (icon) { - wmHints.icon_mask = nxagentPixmap(icon); + propHints.iconMask = nxagentPixmap(icon); } else { - wmHints.flags &= ~IconMaskHint; + propHints.flags &= ~IconMaskHint; #ifdef WARNING fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up icon mask %x from hint " "exporting property %s type %s on window %p.\n", (unsigned int) wmHints.icon_mask, propertyS, typeS, - (void*)pWin); + (void *) pWin); #endif } } @@ -570,17 +606,17 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) if (window) { - wmHints.window_group = nxagentWindow(window); + propHints.windowGroup = nxagentWindow(window); } else { - wmHints.flags &= ~WindowGroupHint; + propHints.flags &= ~WindowGroupHint; #ifdef WARNING fprintf(stderr, "nxagentExportProperty: WARNING! Failed to look up window group %x from hint " "exporting property %s type %s on window %p.\n", (unsigned int) wmHints.window_group, propertyS, typeS, - (void*)pWin); + (void *) pWin); #endif } } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index fa08e05b0..f643cb98c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -3045,7 +3045,7 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height, #ifdef WARNING fprintf(stderr, "nxagentCorrectDepthShadow: WARNING! Visual not found. Using default visual.\n"); #endif - + pVisual = nxagentVisuals[nxagentDefaultVisualIndex].visual; } @@ -3472,10 +3472,10 @@ int nxagentRRSetScreenConfig(ScreenPtr pScreen, int width, int height) RRScreenSizePtr oldSizes; pScrPriv = rrGetScrPriv(pScreen); - + oldWidth = pScreen->width; oldHeight = pScreen->height; - + if (!pScrPriv) { return 1; @@ -3555,7 +3555,7 @@ int nxagentRRSetScreenConfig(ScreenPtr pScreen, int width, int height) } RREditConnectionInfo (pScreen); - + /* * Fix pointer bounds and location */ @@ -3693,7 +3693,8 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, return; } -void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, int yorg, WindowPtr pWin) +void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, + int yorg, WindowPtr pWin) { PixmapPtr pVirtualPixmap; RegionPtr clipRegion; @@ -3709,6 +3710,14 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, int BoxRec extents; miBSWindowPtr pBackingStore; + /* + * Limit the area to restore to the + * root window size. + */ + + REGION_INTERSECT(pWin -> pScreen, prgnRestore, prgnRestore, + &WindowTable[pWin -> drawable.pScreen -> myNum] -> winSize); + pBackingStore = (miBSWindowPtr) pWin -> backStorage; pVirtualPixmap = nxagentVirtualPixmap(pPixmap); -- cgit v1.2.3