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

Reimplement xinerama via randr in nxagent (not libNX_Xinerama). (Fixes ArcticaProject/nx-libs#23).

No more xinerama faking, just use existing xrandr extension and initalize it properly. Xinerama then works automatically. Fixes ArcticaProject/nx-libs#23
parent 2d776b14
......@@ -568,6 +568,10 @@ void nxagentSwitchResizeMode(ScreenPtr pScreen)
{
XSizeHints sizeHints;
#ifdef DEBUG
fprintf(stderr, "nxagentSwitchResizeMode called.\n");
#endif
int desktopResize = nxagentOption(DesktopResize);
nxagentChangeOption(DesktopResize, !desktopResize);
......@@ -3366,7 +3370,9 @@ int nxagentHandleConfigureNotify(XEvent* X)
if (nxagentOption(DesktopResize) == 1)
{
if (nxagentOption(Width) != X -> xconfigure.width ||
nxagentOption(Height) != X -> xconfigure.height)
nxagentOption(Height) != X -> xconfigure.height ||
nxagentOption(X) != X -> xconfigure.x ||
nxagentOption(Y) != X -> xconfigure.y)
{
Bool newEvents = False;
......@@ -3423,11 +3429,16 @@ int nxagentHandleConfigureNotify(XEvent* X)
nxagentMoveViewport(pScreen, 0, 0);
/* if in shadowing mode or if neither size nor position have
changed we do not need to adjust RandR */
/* FIXME: Comment makes no sense */
if (nxagentOption(Shadow) == 1 ||
(nxagentOption(Width) == nxagentOption(RootWidth) &&
nxagentOption(Height) == nxagentOption(RootHeight)))
nxagentOption(Height) == nxagentOption(RootHeight) &&
nxagentOption(X) == nxagentOption(RootX) &&
nxagentOption(Y) == nxagentOption(RootY)))
{
doRandR = 0;
doRandR = False;
}
nxagentChangeOption(Width, X -> xconfigure.width);
......@@ -3472,6 +3483,25 @@ int nxagentHandleConfigureNotify(XEvent* X)
return 1;
}
else
{
if (X -> xconfigure.window == DefaultRootWindow(nxagentDisplay))
{
#ifdef TEST
fprintf(stderr, "nxagentHandleConfigureNotify: remote root window has changed: %d,%d %dx%d\n", X -> xconfigure.x, X -> xconfigure.y, X -> xconfigure.width, X -> xconfigure.height);
#endif
nxagentChangeOption(RootX, X -> xconfigure.x);
nxagentChangeOption(RootY, X -> xconfigure.y);
nxagentChangeOption(RootWidth, X -> xconfigure.width);
nxagentChangeOption(RootHeight, X -> xconfigure.height);
nxagentChangeScreenConfig(0, nxagentOption(Width),
nxagentOption(Height), 0, 0);
return 1;
}
}
}
return 0;
......@@ -4416,6 +4446,10 @@ int nxagentHandleRRScreenChangeNotify(XEvent *X)
{
XRRScreenChangeNotifyEvent *Xr;
#ifdef DEBUG
fprintf(stderr, "nxagentHandleRRScreenChangeNotify called.\n");
#endif
Xr = (XRRScreenChangeNotifyEvent *) X;
nxagentResizeScreen(screenInfo.screens[DefaultScreen(nxagentDisplay)], Xr -> width, Xr -> height,
......@@ -4504,6 +4538,10 @@ int nxagentWaitEvents(Display *dpy, struct timeval *tm)
{
XEvent ev;
#ifdef DEBUG
fprintf(stderr, "nxagentWaitEvents called.\n");
#endif
NXFlushDisplay(dpy, NXFlushLink);
/*
......
......@@ -35,6 +35,11 @@ static int nxagentRandRScreenSetSize(ScreenPtr pScreen, CARD16 width,
static int nxagentRandRInitSizes(ScreenPtr pScreen);
static Bool nxagentRandRCrtcSet (ScreenPtr pScreen, RRCrtcPtr crtc,
RRModePtr mode, int x, int y,
Rotation rotation, int numOutputs,
RROutputPtr *outputs);
#ifdef __DARWIN__
void DarwinHandleGUI(int argc, char *argv[])
......@@ -83,6 +88,8 @@ void nxagentInitRandRExtension(ScreenPtr pScreen)
fprintf(stderr, "Warning: Failed to initialize the RandR extension.\n");
}
/* FIXME: do we need this at all with the new rand/xinerama stuff? */
nxagentRandRInitSizes(pScreen);
/*
......@@ -97,6 +104,7 @@ void nxagentInitRandRExtension(ScreenPtr pScreen)
#if RANDR_12_INTERFACE
pRandRScrPriv -> rrScreenSetSize = nxagentRandRScreenSetSize;
pRandRScrPriv -> rrCrtcSet = nxagentRandRCrtcSet;
#endif
#if RANDR_10_INTERFACE
......@@ -104,6 +112,34 @@ void nxagentInitRandRExtension(ScreenPtr pScreen)
#endif
}
void
RRResetProc (ExtensionEntry *extEntry)
{
fprintf(stderr, "RANDR going down - NX version\n");
}
#if RANDR_12_INTERFACE
/*
* Request that the Crtc be reconfigured
*/
static Bool
nxagentRandRCrtcSet (ScreenPtr pScreen,
RRCrtcPtr crtc,
RRModePtr mode,
int x,
int y,
Rotation rotation,
int numOutputs,
RROutputPtr *outputs)
{
return RRCrtcNotify(crtc, mode, x, y, rotation, numOutputs, outputs);
}
#endif
int nxagentRandRGetInfo(ScreenPtr pScreen, Rotation *pRotations)
{
/*
......
......@@ -154,6 +154,8 @@ void nxagentInitOptions()
nxagentOptions.CopyBufferSize = COPY_UNLIMITED;
nxagentOptions.ImageRateLimit = 0;
nxagentOptions.Xinerama = 0;
}
/*
......
......@@ -388,6 +388,17 @@ typedef struct _AgentOptions
int NoRootlessExit;
/*
* Store if the user wants Xinerama. There's a variable called
* noPanoramiXExtension in os/utils.c but we cannot rely on that
* because RandR and Panoramix change its value when trying to
* initialize. So we use this variable to save the user preference
* provided by the -/+xinerama parameter before initalizing those
* extensions.
*/
int Xinerama;
} AgentOptionsRec;
typedef AgentOptionsRec *AgentOptionsPtr;
......
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