diff options
Diffstat (limited to 'nx-X11/programs')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Args.c | 8 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Extensions.c | 17 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Screen.c | 42 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 | 3 |
4 files changed, 64 insertions, 6 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c index 63433f4da..a51ad0c01 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Args.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c @@ -130,6 +130,8 @@ char nxagentDisplayName[NXAGENTDISPLAYNAMELENGTH]; Bool nxagentSynchronize = False; Bool nxagentRealWindowProp = False; +Bool nxagentAutoDPI = False; + char nxagentShadowDisplayName[NXAGENTSHADOWDISPLAYNAMELENGTH] = {0}; char nxagentWindowName[NXAGENTWINDOWNAMELENGTH]; @@ -743,6 +745,11 @@ int ddxProcessArgument(int argc, char *argv[], int i) return 1; } + if (!strcmp(argv[i], "-autodpi")) { + nxagentAutoDPI = True; + return 1; + } + /* * The original -noreset option, disabling * dispatchExceptionAtReset, is the default. @@ -2091,6 +2098,7 @@ void ddxUseMsg(void) ErrorF("-class string default visual class\n"); ErrorF("-depth int default depth\n"); ErrorF("-geometry WxH+X+Y window size and position\n"); + ErrorF("-autodpi detect real server's DPI and use that in the session\n"); ErrorF("-bw int window border width\n"); ErrorF("-name string window name\n"); ErrorF("-scrns int number of screens to generate\n"); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Extensions.c b/nx-X11/programs/Xserver/hw/nxagent/Extensions.c index 211af8ccf..05a4b4f13 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Extensions.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Extensions.c @@ -338,15 +338,26 @@ static int nxagentRandRInitSizes(ScreenPtr pScreen) width = w[i]; height = h[i]; - mmWidth = (width * 254 + monitorResolution * 5) / (monitorResolution * 10); + if (monitorResolution < 0) + { + mmWidth = width * DisplayWidthMM(nxagentDisplay, DefaultScreen(nxagentDisplay)) / + DisplayWidth(nxagentDisplay, DefaultScreen(nxagentDisplay)); + + mmHeight = height * DisplayHeightMM(nxagentDisplay, DefaultScreen(nxagentDisplay)) / + DisplayHeight(nxagentDisplay, DefaultScreen(nxagentDisplay)); + } + else + { + mmWidth = (width * 254 + monitorResolution * 5) / (monitorResolution * 10); + mmHeight = (height * 254 + monitorResolution * 5) / (monitorResolution * 10); + + } if (mmWidth < 1) { mmWidth = 1; } - mmHeight = (height * 254 + monitorResolution * 5) / (monitorResolution * 10); - if (mmHeight < 1) { mmHeight = 1; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 36da8b905..d4a083a1b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -210,6 +210,9 @@ void nxagentShadowAdaptDepth(unsigned int, unsigned int, unsigned int, char **); RegionRec nxagentShadowUpdateRegion; #define NXAGENT_DEFAULT_DPI 75 +#define NXAGENT_AUTO_DPI -1 + +extern Bool nxagentAutoDPI; /* * From randr/randr.c. This was originally static @@ -1327,10 +1330,14 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, rootDepth, (long unsigned int)defaultVisual); #endif - if (monitorResolution < 1) + if ((monitorResolution < 1) && (nxagentAutoDPI == False)) { monitorResolution = NXAGENT_DEFAULT_DPI; } + else if ((monitorResolution < 1) && (nxagentAutoDPI == True)) + { + monitorResolution = NXAGENT_AUTO_DPI; + } if (!fbScreenInit(pScreen, pFrameBufferBits, nxagentOption(RootWidth), nxagentOption(RootHeight), monitorResolution, monitorResolution, PixmapBytePad(nxagentOption(RootWidth), rootDepth), bitsPerPixel)) @@ -1474,6 +1481,17 @@ N/A * return FALSE; */ + if (monitorResolution < 0) + { + pScreen->mmWidth = nxagentOption(RootWidth) * DisplayWidthMM(nxagentDisplay, + DefaultScreen(nxagentDisplay)) / DisplayWidth(nxagentDisplay, + DefaultScreen(nxagentDisplay)); + + pScreen->mmHeight = nxagentOption(RootHeight) * DisplayHeightMM(nxagentDisplay, + DefaultScreen(nxagentDisplay)) / DisplayHeight(nxagentDisplay, + DefaultScreen(nxagentDisplay)); + } + pScreen->defColormap = (Colormap) FakeClientID(0); pScreen->minInstalledCmaps = MINCMAPS; pScreen->maxInstalledCmaps = MAXCMAPS; @@ -2294,22 +2312,40 @@ Bool nxagentResizeScreen(ScreenPtr pScreen, int width, int height, if (mmWidth == 0) { - mmWidth = (width * 254 + monitorResolution * 5) / (monitorResolution * 10); + if (monitorResolution < 0) + { + mmWidth = width * DisplayWidthMM(nxagentDisplay, DefaultScreen(nxagentDisplay)) / + DisplayWidth(nxagentDisplay, DefaultScreen(nxagentDisplay)); + } + else + { + mmWidth = (width * 254 + monitorResolution * 5) / (monitorResolution * 10); + } if (mmWidth < 1) { mmWidth = 1; } + } if (mmHeight == 0) { - mmHeight = (height * 254 + monitorResolution * 5) / (monitorResolution * 10); + if (monitorResolution < 0) + { + mmHeight = height * DisplayHeightMM(nxagentDisplay, DefaultScreen(nxagentDisplay)) / + DisplayHeight(nxagentDisplay, DefaultScreen(nxagentDisplay)); + } + else + { + mmHeight = (height * 254 + monitorResolution * 5) / (monitorResolution * 10); + } if (mmHeight < 1) { mmHeight = 1; } + } pScreen -> mmWidth = mmWidth; diff --git a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 index d6ed4d0fe..eb7307b77 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 +++ b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 @@ -393,6 +393,9 @@ auto-disconnect timeout in seconds (minimum allowed: 60) .B \-norootlessexit don't exit if there are no clients in rootless mode .TP 8 +.B \-autodpi +detect real server's DPI and set it in the agent session; the \fI-dpi <dpi>\fR cmdline option overrides \fI-autodpi\fR +.TP 8 .B \-nomagicpixel disable magic pixel support at session startup, can be re-enabled via nx/nx option on session resumption |