diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 61d39ee983..ca72559ea2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -616,8 +616,8 @@ void nxagentSwitchResizeMode(ScreenPtr pScreen) NXSetExposeParameters(nxagentDisplay, 0, 0, 0); } - sizeHints.max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); - sizeHints.max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); + sizeHints.max_width = MAXSHORT; + sizeHints.max_height = MAXSHORT; XSetWMNormalHints(nxagentDisplay, nxagentDefaultWindows[pScreen->myNum], &sizeHints); @@ -657,8 +657,8 @@ void nxagentShadowSwitchResizeMode(ScreenPtr pScreen) screenInfo.screens[0]->root, screenInfo.screens[0]->root -> drawable.width, screenInfo.screens[0]->root -> drawable.height); - sizeHints.max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); - sizeHints.max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); + sizeHints.max_width = MAXSHORT; + sizeHints.max_height = MAXSHORT; fprintf(stderr,"Info: Enabled resize mode in shadow agent.\n"); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Extensions.c b/nx-X11/programs/Xserver/hw/nxagent/Extensions.c index 237e13fb6b..80ab01d13a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Extensions.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Extensions.c @@ -124,7 +124,8 @@ void nxagentInitRandRExtension(ScreenPtr pScreen) fprintf(stderr, "Warning: Failed to initialize the RandR extension.\n"); } - + /*RRGetInfo(pScreen, FALSE);*/ + /*RRScanOldConfig(pScreen, RR_Rotate_0);*/ /* FIXME: do we need this at all with the new rand/xinerama stuff? */ nxagentRandRInitSizes(pScreen); @@ -251,6 +252,12 @@ nxagentRandRCrtcSet (ScreenPtr pScreen, int numOutputs, RROutputPtr *outputs) { + if (crtc->gammaSize == 0) { + CARD16 gamma = 0; + RRCrtcGammaSetSize(crtc, 1); + RRCrtcGammaSet(crtc, &gamma, &gamma, &gamma); + RRCrtcGammaNotify(crtc); + } return RRCrtcNotify(crtc, mode, x, y, rotation, NULL, numOutputs, outputs); } #endif @@ -270,23 +277,18 @@ int nxagentRandRGetInfo(ScreenPtr pScreen, Rotation *pRotations) static int nxagentRandRInitSizes(ScreenPtr pScreen) { RRScreenSizePtr pSize; - int width; int height; int maxWidth; int maxHeight; -/* - 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}; -*/ + /* the second to last resolution is here to extend the maximum + screen size to 32767x32767 */ int w[] = {0, 320, 640, 640, 800, 800, 1024, 1024, 1152, 1280, 1280, 1280, 1360, - 1440, 1600, 1600, 1680, 1920, 1920, 0, 0}; + 1440, 1600, 1600, 1680, 1920, 1920, MAXSHORT, 0}; int h[] = {0, 240, 360, 480, 480, 600, 600, 768, 864, 720, 800, 1024, 768, - 900, 900, 1200, 1050, 1080, 1200, 0, 0}; + 900, 900, 1200, 1050, 1080, 1200, MAXSHORT, 0}; int i; int nSizes; @@ -311,9 +313,6 @@ static int nxagentRandRInitSizes(ScreenPtr pScreen) w[nSizes - 1] = pScreen -> width; h[nSizes - 1] = pScreen -> height; - w[nSizes - 2] = maxWidth; - h[nSizes - 2] = maxHeight; - /* * Compute default size. */ @@ -363,7 +362,7 @@ static int nxagentRandRInitSizes(ScreenPtr pScreen) } RRSetCurrentConfig(pScreen, RR_Rotate_0, 60, pSize); - + /* RRScreenSetSizeRange(pScreen, w[1], h[1], MAXSHORT, MAXSHORT);*/ return 1; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index d642f63b7d..981333ac39 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -1864,8 +1864,8 @@ N/A if (nxagentOption(DesktopResize) == 1 || nxagentOption(Fullscreen) == 1) { - sizeHints.max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); - sizeHints.max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); + sizeHints.max_width = MAXSHORT; + sizeHints.max_height = MAXSHORT; } else { @@ -2387,8 +2387,8 @@ FIXME: We should try to restore the previously if (nxagentOption(DesktopResize) == 1) { - sizeHints.max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); - sizeHints.max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); + sizeHints.max_width = MAXSHORT; + sizeHints.max_height = MAXSHORT; } else { @@ -3818,6 +3818,7 @@ int nxagentChangeScreenConfig(int screen, int width, int height, int mmWidth, in } #ifdef DEBUG + nxagentPrintAgentGeometry("Current geometry", "nxagentChangeScreenConfig:"); fprintf(stderr, "nxagentChangeScreenConfig: current geometry: %d,%d %dx%d\n", nxagentOption(X), nxagentOption(Y), nxagentOption(Width), nxagentOption(Height)); fprintf(stderr, "nxagentChangeScreenConfig: returning [%d]\n", r); #endif @@ -3834,7 +3835,7 @@ void nxagentDropOutput(RROutputPtr o) { for (int i = 0; i < c->numOutputs; i++) { if (c->outputs[i] == o) { #ifdef DEBUG - fprintf(stderr, "nxagentDropOutput: output [%s] is in use by crtc [%p], removing it from there\n", o->name, c); + fprintf(stderr, "nxagentDropOutput: output [%s] is in use by crtc [%p], removing it from there\n", o->name, (void *)c); #endif RRCrtcSet(c, NULL, 0, 0, RR_Rotate_0, 0, NULL); } @@ -4109,6 +4110,17 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) RROutputSetConnection(pScrPriv->outputs[i], RR_Connected); + /* calculate the size in mm based on the current dpi. If + nxagent is run with a different dpi than the real X server + the result will look wrong but it is mathematically correct. */ + /* RRRegisterSize(pScreen, bbx2-bbx1, bby2-bby1, + ((bbx2-bbx1) * 254 + monitorResolution * 5) / (monitorResolution * 10), + ((bby2-bby1) * 254 + monitorResolution * 5) / (monitorResolution * 10));*/ + + RROutputSetPhysicalSize(pScrPriv->outputs[i], + (new_w * 254 + monitorResolution * 5) / (monitorResolution * 10), + (new_h * 254 + monitorResolution * 5) / (monitorResolution * 10)); + memset(&modeInfo, '\0', sizeof(modeInfo)); #ifdef NXAGENT_RANDR_MODE_PREFIX @@ -4491,8 +4503,8 @@ void nxagentSetWMNormalHints(int screen) if (nxagentOption(DesktopResize) == 1) { - sizeHints.max_width = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); - sizeHints.max_height = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); + sizeHints.max_width = MAXSHORT; + sizeHints.max_height = MAXSHORT; } else {