Commit e01b9177 authored by Reinhard Tartler's avatar Reinhard Tartler

Imported nxagent-3.5.0-5.tar.gz

Summary: Imported nxagent-3.5.0-5.tar.gz Keywords: Imported nxagent-3.5.0-5.tar.gz into Git repository
parent 39b738a6
......@@ -135,6 +135,8 @@ char *nxagentKeyboard = NULL;
Bool nxagentOnce = True;
int nxagentRemoteMajor = -1;
static void nxagentParseOptionString(char*);
/*
......@@ -1578,6 +1580,8 @@ N/A
nxagentAlphaCompat = 0;
}
nxagentRemoteMajor = remoteMajor;
if (nxagentPackMethod == -1)
{
nxagentPackMethod = packMethod;
......
......@@ -81,4 +81,6 @@ void nxagentSetCoalescence(void);
extern int nxagentUserDefinedFontPath;
extern int nxagentRemoteMajor;
#endif /* __Args_H__ */
ChangeLog:
nxagent-3.5.0-5
- The NX agent failed to resize its own window to fit the desktop size
in shadow sessions. TR07I02561 is now fixed also in shadow mode.
nxagent-3.5.0-4
- Fixed TR07I02530. Solved a buffer overflow occurring when the '-fp'
option value exceeds 1024 characters.
- Extended list of the available screen geometries.
nxagent-3.5.0-3
- Fixed TR08I02572. Upgraded RandR extension to version 1.2.
- Fixed TR07I02561. The NX agent failed to resize its own window to
fit the desktop size.
nxagent-3.5.0-2
- Fixed TR0502449. Initialized font server path even if font server
......
......@@ -293,31 +293,7 @@ void nxagentRecolorCursor(ScreenPtr pScreen, CursorPtr pCursor,
Bool nxagentSetCursorPosition(ScreenPtr pScreen, int x, int y,
Bool generateEvent)
{
/*
* Don't warp the cursor if the requesting client
* is the server client itself or a shadow agent.
*/
if (requestingClient != NULL &&
requestingClient != serverClient &&
nxagentClientHint(requestingClient) != NXAGENT_SHADOW)
{
int i;
#ifdef TEST
fprintf(stderr, "nxagentSetCursorPosition: Moving the cursor at position [%d,%d].\n",
x, y);
#endif
for (i = 0; i < nxagentNumScreens; i++)
{
XWarpPointer(nxagentDisplay, nxagentDefaultWindows[i],
nxagentDefaultWindows[pScreen->myNum],
0, 0, 0, 0, x, y);
}
}
return True;
return 1;
}
void nxagentReconnectCursor(pointer p0, XID x1, pointer p2)
......
......@@ -2406,6 +2406,8 @@ Bool nxagentReconnectDisplay(void *p0)
nxagentPackQuality = -1;
nxagentSplitThreshold = -1;
nxagentRemoteMajor = -1;
nxagentInstallSignalHandlers();
nxagentInstallDisplayHandlers();
......
......@@ -591,8 +591,8 @@ void nxagentSwitchResizeMode(ScreenPtr pScreen)
nxagentLaunchDialog(DIALOG_ENABLE_DESKTOP_RESIZE_MODE);
nxagentRRSetScreenConfig(pScreen, nxagentOption(Width),
nxagentOption(Height));
nxagentChangeScreenConfig(0, nxagentOption(Width), nxagentOption(Height),
0, 0);
if (nxagentOption(ClientOs) == ClientOsWinnt)
{
......@@ -3461,8 +3461,8 @@ int nxagentHandleConfigureNotify(XEvent* X)
nxagentOption(Width), nxagentOption(Height));
#endif
nxagentRRSetScreenConfig(screenInfo.screens[DefaultScreen(nxagentDisplay)],
nxagentOption(Width), nxagentOption(Height));
nxagentChangeScreenConfig(0, nxagentOption(Width),
nxagentOption(Height), 0, 0);
}
}
......
......@@ -22,11 +22,19 @@
#include "Agent.h"
#include "Display.h"
#include "Screen.h"
#include "Options.h"
#include "Extensions.h"
#include "Windows.h"
void GlxExtensionInit(void);
void GlxWrapInitVisuals(void *procPtr);
static int nxagentRandRScreenSetSize(ScreenPtr pScreen, CARD16 width,
CARD16 height, CARD32 mmWidth,
CARD32 mmHeight);
static int nxagentRandRInitSizes(ScreenPtr pScreen);
#ifdef __DARWIN__
void DarwinHandleGUI(int argc, char *argv[])
......@@ -75,6 +83,8 @@ void nxagentInitRandRExtension(ScreenPtr pScreen)
fprintf(stderr, "Warning: Failed to initialize the RandR extension.\n");
}
nxagentRandRInitSizes(pScreen);
/*
* RRScreenInit sets these pointers to NULL,
* so requiring the server to set up its own
......@@ -84,12 +94,31 @@ void nxagentInitRandRExtension(ScreenPtr pScreen)
pRandRScrPriv = rrGetScrPriv(pScreen);
pRandRScrPriv -> rrGetInfo = nxagentRandRGetInfo;
#if RANDR_12_INTERFACE
pRandRScrPriv -> rrScreenSetSize = nxagentRandRScreenSetSize;
#endif
#if RANDR_10_INTERFACE
pRandRScrPriv -> rrSetConfig = nxagentRandRSetConfig;
#endif
}
int nxagentRandRGetInfo(ScreenPtr pScreen, Rotation *pRotations)
{
/*
* Rotation is not supported.
*/
*pRotations = RR_Rotate_0;
return 1;
}
static int nxagentRandRInitSizes(ScreenPtr pScreen)
{
RRScreenSizePtr pSize;
rrScrPrivPtr pRandRScrPriv = rrGetScrPriv(pScreen);
int width;
int height;
......@@ -97,8 +126,16 @@ int nxagentRandRGetInfo(ScreenPtr pScreen, Rotation *pRotations)
int maxWidth;
int maxHeight;
int w[] = {0, 160, 320, 640, 800, 1024, 0, 0};
int h[] = {0, 120, 240, 480, 600, 768, 0, 0};
/*
int w[] = {0, 160, 320, 640, 800, 1024, 1152, 1280, 1280, 1280, 1280, 1280,
1280, 1360, 1440, 1600, 1600, 1680, 1920, 1920, 0, 0};
int h[] = {0, 120, 240, 480, 600, 768, 864, 600, 720, 800, 854, 960,
1024, 768, 900, 900, 1200, 1050, 1080, 1200, 0, 0};
*/
int w[] = {0, 320, 640, 640, 800, 800, 1024, 1024, 1152, 1280, 1280, 1280, 1360,
1440, 1600, 1600, 1680, 1920, 1920, 0, 0};
int h[] = {0, 240, 360, 480, 480, 600, 600, 768, 864, 720, 800, 1024, 768,
900, 900, 1200, 1050, 1080, 1200, 0, 0};
int i;
int nSizes;
......@@ -107,12 +144,6 @@ int nxagentRandRGetInfo(ScreenPtr pScreen, Rotation *pRotations)
int mmHeight;
/*
* Rotation is not supported.
*/
*pRotations = RR_Rotate_0;
/*
* Register all the supported sizes. The third
* parameter is the refresh rate.
*/
......@@ -185,13 +216,106 @@ int nxagentRandRGetInfo(ScreenPtr pScreen, Rotation *pRotations)
return 1;
}
#if RANDR_10_INTERFACE
int nxagentRandRSetConfig(ScreenPtr pScreen, Rotation rotation,
int rate, RRScreenSizePtr pSize)
{
int r;
rrScrPrivPtr pRandRScrPriv;
UpdateCurrentTime();
/*
* Whatever size is OK for us.
*/
return nxagentResizeScreen(pScreen, pSize -> width, pSize -> height,
r = nxagentResizeScreen(pScreen, pSize -> width, pSize -> height,
pSize -> mmWidth, pSize -> mmHeight);
nxagentMoveViewport(pScreen, 0, 0);
return r;
}
#endif
#if RANDR_12_INTERFACE
void nxagentRandRSetWindowsSize(int width, int height)
{
if (width == 0)
{
if (nxagentOption(Fullscreen) == 1)
{
width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
}
else
{
width = nxagentOption(Width);
}
}
if (height == 0)
{
if (nxagentOption(Fullscreen) == 1)
{
height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
}
else
{
height = nxagentOption(Height);
}
}
XResizeWindow(nxagentDisplay, nxagentDefaultWindows[0], width, height);
if (nxagentOption(Rootless) == 0)
{
XMoveResizeWindow(nxagentDisplay, nxagentInputWindows[0], 0, 0, width,
height);
}
}
int nxagentRandRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height,
CARD32 mmWidth, CARD32 mmHeight)
{
int result;
rrScrPrivPtr pRandRScrPriv;
UpdateCurrentTime();
if (nxagentOption(DesktopResize) == 1 &&
(nxagentOption(Fullscreen) == 1 ||
width > WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) ||
height > HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay))))
{
if (nxagentOption(ClientOs) != ClientOsWinnt
/*&& nxagentOption(ClientOs) != ClientNXPlayer*/)
{
nxagentChangeOption(DesktopResize, 0);
}
}
if (nxagentOption(DesktopResize) == 1 && nxagentOption(Fullscreen) == 0 &&
nxagentOption(AllScreens) == 0)
{
nxagentChangeOption(Width, width);
nxagentChangeOption(Height, height);
}
result = nxagentResizeScreen(pScreen, width, height, mmWidth, mmHeight);
if (result == 1 && nxagentOption(DesktopResize) == 1 &&
nxagentOption(Fullscreen) == 0 && nxagentOption(AllScreens) == 0)
{
nxagentRandRSetWindowsSize(width, height);
nxagentSetWMNormalHints(pScreen -> myNum);
}
nxagentMoveViewport(pScreen, 0, 0);
return result;
}
#endif
......@@ -7,8 +7,7 @@ SRCS1 = os2Stub.c
OBJS1 = os2Stub.o
#endif
SRCS = NXrandr.c \
NXwindow.c \
SRCS = NXwindow.c \
NXevents.c \
NXproperty.c \
NXdixfonts.c \
......@@ -70,8 +69,7 @@ SRCS = NXrandr.c \
miinitext.c \
$(SRCS1)
OBJS = NXrandr.o \
NXwindow.o \
OBJS = NXwindow.o \
NXevents.o \
NXproperty.o \
NXdixfonts.o \
......@@ -206,6 +204,8 @@ DEFINES = -g $(OS_DEFINES) $(EXT_DEFINES) $(UPG_DEFINES) \
-DNXAGENT_SPLASH \
-DNXAGENT_ARTSD \
-UNX_DEBUG_INPUT \
-DRANDR_10_INTERFACE \
-DRANDR_12_INTERFACE \
-UPANORAMIX \
-UDEBUG_TREE
......
......@@ -128,6 +128,10 @@ void OsVendorEndRedirectErrorFFunction();
* new X server tree.
*/
static void nxagentGrabServerCallback(CallbackListPtr *callbacks, pointer data,
pointer args);
#ifdef NXAGENT_UPGRADE
void ddxInitGlobals(void)
......@@ -209,6 +213,11 @@ void InitOutput(ScreenInfo *screenInfo, int argc, char *argv[])
NXUnsetLibraryPath(1);
if (serverGeneration == 1)
{
AddCallback(&ServerGrabCallback, nxagentGrabServerCallback, NULL);
}
if (nxagentUserDefinedFontPath == 0)
{
#ifdef TEST
......@@ -479,6 +488,17 @@ void OsVendorEndRedirectErrorFFunction()
int SelectWaitTime = 10000; /* usec */
#endif
ServerGrabInfoRec nxagentGrabServerInfo;
static void nxagentGrabServerCallback(CallbackListPtr *callbacks, pointer data,
pointer args)
{
ServerGrabInfoRec *grab = (ServerGrabInfoRec*)args;
nxagentGrabServerInfo.client = grab->client;
nxagentGrabServerInfo.grabstate = grab->grabstate;
}
#ifdef DPMSExtension
void DPMSSet(int level)
......
......@@ -37,4 +37,6 @@ extern int nxagentDoFullGeneration;
extern int nxagentBackingStore;
extern int nxagentSaveUnder;
extern ServerGrabInfoRec nxagentGrabServerInfo;
#endif /* __Init_H__ */
......@@ -598,7 +598,8 @@ Bool nxagentReconnectSession(void)
if (nxagentResizeDesktopAtStartup || nxagentOption(Rootless) == True)
{
nxagentRRSetScreenConfig(nxagentDefaultScreen, nxagentOption(RootWidth), nxagentOption(RootHeight));
nxagentChangeScreenConfig(0, nxagentOption(RootWidth),
nxagentOption(RootHeight), 0, 0);
nxagentResizeDesktopAtStartup = False;
}
......
......@@ -2120,8 +2120,8 @@ static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable)
if (anyMarked)
(*pScreen->ValidateTree)(pWin, NullWindow, VTOther);
}
if (pWin->backStorage &&
if (pWin->backStorage && pOldClip &&
((pWin->backingStore == Always) || WasViewable))
{
if (!WasViewable)
......@@ -2266,6 +2266,52 @@ FIXME: We should try to restore the previously
nxagentChangeOption(ViewportYSpan, nxagentOption(Height) - nxagentOption(RootHeight));
/*
* Change agent window size and size hints.
*/
if ((nxagentOption(Fullscreen) == 0 && nxagentOption(AllScreens) == 0))
{
sizeHints.flags = PPosition | PMinSize | PMaxSize;
sizeHints.x = nxagentOption(X);
sizeHints.y = nxagentOption(Y);
sizeHints.min_width = MIN_NXAGENT_WIDTH;
sizeHints.min_height = MIN_NXAGENT_HEIGHT;
sizeHints.width = width;
sizeHints.height = height;
if (nxagentOption(DesktopResize) == 1)
{
sizeHints.max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
sizeHints.max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay));
}
else
{
sizeHints.max_width = nxagentOption(RootWidth);
sizeHints.max_height = nxagentOption(RootHeight);
}
if (nxagentUserGeometry.flag & XValue || nxagentUserGeometry.flag & YValue)
{
sizeHints.flags |= USPosition;
}
if (nxagentUserGeometry.flag & WidthValue || nxagentUserGeometry.flag & HeightValue)
{
sizeHints.flags |= USSize;
}
XSetWMNormalHints(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], &sizeHints);
XResizeWindow(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], width, height);
if (nxagentOption(Rootless) == 0)
{
XResizeWindow(nxagentDisplay, nxagentInputWindows[pScreen -> myNum], width, height);
}
}
/*
* Set properties for the agent root window.
*/
......@@ -2654,9 +2700,12 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin)
nxagentShadowCreateMainWindow(pScreen, pWin, nxagentShadowWidth, nxagentShadowHeight);
nxagentShadowSetWindowsSize();
if (nxagentRemoteMajor <= 3)
{
nxagentShadowSetWindowsSize();
nxagentSetWMNormalHints(0);
nxagentSetWMNormalHints(0);
}
XMapWindow(nxagentDisplay, nxagentDefaultWindows[0]);
......@@ -3453,118 +3502,123 @@ Bool nxagentReconnectScreen(void *p0)
return True;
}
int nxagentRRSetScreenConfig(ScreenPtr pScreen, int width, int height)
{
rrScrPrivPtr pScrPriv;
RRScreenSizePtr pSize;
Rotation rotation;
int rate;
short oldWidth, oldHeight;
int mmWidth, mmHeight;
int oldSize;
RRScreenSizePtr oldSizes;
RRModePtr nxagentRRCustomMode = NULL;
pScrPriv = rrGetScrPriv(pScreen);
int nxagentChangeScreenConfig(int screen, int width, int height, int mmWidth, int mmHeight)
{
ScreenPtr pScreen;
rrScrPrivPtr pScrPriv;
RROutputPtr output;
RRCrtcPtr crtc;
RRModePtr mode;
xRRModeInfo modeInfo;
char name[100];
int r, c, m;
int refresh = 60;
int doNotify = 1;
if (WindowTable[screen] == NULL)
{
return 0;
}
oldWidth = pScreen->width;
oldHeight = pScreen->height;
UpdateCurrentTime();
if (!pScrPriv)
{
return 1;
}
if (nxagentGrabServerInfo.grabstate == SERVER_GRABBED)
{
/*
* If any client grabbed the server it won't expect that screen
* configuration changes until it releases the grab. That could
* get an X error because available modes are chanded meanwhile.
*/
if (!RRGetInfo (pScreen))
{
return 1;
}
#ifdef TEST
fprintf(stderr, "nxagentChangeScreenConfig: Cancel with grabbed server.\n");
#endif
rotation = RR_Rotate_0;
return 0;
}
rate = 0;
pScreen = WindowTable[screen] -> drawable.pScreen;
mmWidth = (width * 254 + monitorResolution * 5) / (monitorResolution * 10);
#ifdef TEST
fprintf(stderr, "nxagentChangeScreenConfig: Changing config to %dx%d.\n", width, height);
#endif
if (mmWidth < 1)
{
mmWidth = 1;
}
r = nxagentResizeScreen(pScreen, width, height, mmWidth, mmHeight);
mmHeight = (height * 254 + monitorResolution * 5) / (monitorResolution * 10);
if (r != 0)
{
pScrPriv = rrGetScrPriv(pScreen);
if (mmHeight < 1)
if (pScrPriv)
{
mmHeight = 1;
}
pSize = xalloc(sizeof(RRScreenSize));
pSize -> width = width;
pSize -> height = height;
pSize -> mmWidth = mmWidth;
pSize -> mmHeight = mmHeight;
output = RRFirstOutput(pScreen);
/*
* call out to ddx routine to effect the change
*/
if (!(*pScrPriv->rrSetConfig) (pScreen, rotation, rate,
pSize))
{
/*
* unknown DDX failure.
*/
if (output && output -> crtc)
{
crtc = output -> crtc;
xfree(pSize);
for (c = 0; c < pScrPriv -> numCrtcs; c++)
{
RRCrtcSet(pScrPriv -> crtcs[c], NULL, 0, 0, RR_Rotate_0, 0, NULL);
}
return 1;
}
memset(&modeInfo, '\0', sizeof(modeInfo));
sprintf(name, "%dx%d", width, height);
/*
* TellChanged uses this privates.
*/
modeInfo.width = width;
modeInfo.height = height;
modeInfo.hTotal = width;
modeInfo.vTotal = height;
modeInfo.dotClock = ((CARD32) width * (CARD32) height *
(CARD32) refresh);
modeInfo.nameLength = strlen(name);
oldSize = pScrPriv->size;
oldSizes = pScrPriv->pSizes;
if (nxagentRRCustomMode != NULL)
{
RROutputDeleteUserMode(output, nxagentRRCustomMode);
FreeResource(nxagentRRCustomMode -> mode.id, 0);
pScrPriv->size = 0;
pScrPriv->pSizes = pSize;
if (crtc != NULL && crtc -> mode == nxagentRRCustomMode)
{
RRCrtcSet(crtc, NULL, 0, 0, RR_Rotate_0, 0, NULL);
}
/*
* Deliver ScreenChangeNotify events whenever
* the configuration is updated
*/
#ifdef TEST
fprintf(stderr, "nxagentChangeScreenConfig: "
"Going to destroy mode %p with refcnt %d.\n",
nxagentRRCustomMode, nxagentRRCustomMode->refcnt);
#endif
WalkTree (pScreen, TellChanged, (pointer) pScreen);
RRModeDestroy(nxagentRRCustomMode);
}
/*
* Deliver ConfigureNotify events when root changes
* pixel size
*/
nxagentRRCustomMode = RRModeGet(&modeInfo, name);
if (oldWidth != pScreen->width || oldHeight != pScreen->height)
{
RRSendConfigNotify (pScreen);
}
RROutputAddUserMode(output, nxagentRRCustomMode);
RREditConnectionInfo (pScreen);
RRCrtcSet(crtc, nxagentRRCustomMode, 0, 0, RR_Rotate_0, 1, &output);
/*
* Fix pointer bounds and location
*/
RROutputChanged(output, 1);
ScreenRestructured (pScreen);
doNotify = 0;
}
/*
* Restore old privates.
*/
pScrPriv -> lastSetTime = currentTime;
pScrPriv->pSizes = oldSizes;
pScrPriv->size = oldSize;
pScrPriv->changed = 1;
pScrPriv->configChanged = 1;
}
xfree(pSize);
if (doNotify
)
{
RRScreenSizeNotify(pScreen);
}
}
return 0;
return r;
}
void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, WindowPtr pWin)
......
......@@ -100,7 +100,7 @@ Bool nxagentMagicPixelZone(int x, int y);
Bool nxagentResizeScreen(ScreenPtr pScreen, int width, int height,
int mmWidth, int mmHeight);
int nxagentRRSetScreenConfig(ScreenPtr pScreen, int width, int height);
int nxagentChangeScreenConfig(int screen, int width, int height, int mmWidth, int mmHeight);
extern Bool nxagentReconnectScreen(void *p0);
......
......@@ -899,8 +899,8 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
{
if (nxagentOption(Shadow) == 0)
{
nxagentRRSetScreenConfig(pScreen, WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)),
HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)));
nxagentChangeScreenConfig(0, WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)),
HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)), 0, 0);
}
else
{
......@@ -953,7 +953,8 @@ void nxagentSwitchAllScreens(ScreenPtr pScreen, Bool switchOn)
if (nxagentOption(Shadow) == 0)
{
nxagentRRSetScreenConfig(pScreen, nxagentOption(RootWidth), nxagentOption(RootHeight));
nxagentChangeScreenConfig(0, nxagentOption(RootWidth),
nxagentOption(RootHeight), 0, 0);
}
}
......
......@@ -148,7 +148,8 @@ static const char *_NXGetFontPath(const char *path)
_NXGetFontPathError:
strcpy(_NXFontPath, path);
strncpy(_NXFontPath, path, 1023);
_NXFontPath[1023] = '\0';
#ifdef NX_TRANS_TEST
fprintf(stderr, "_NXGetFontPath: Using default font path [%s].\n", _NXFontPath);
......
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