From c6482d24fff982d5e11636167c719766f8207d48 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 2 May 2015 21:53:25 +0200 Subject: 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 --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 46 ++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 4 deletions(-) (limited to 'nx-X11/programs/Xserver/hw/nxagent/Events.c') diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 9f7d6280f..03b14f0dc 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -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); @@ -3466,12 +3477,31 @@ int nxagentHandleConfigureNotify(XEvent* X) #endif nxagentChangeScreenConfig(0, nxagentOption(Width), - nxagentOption(Height), 0, 0); + nxagentOption(Height), 0, 0); } } 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); /* -- cgit v1.2.3