From 4a7faa8bd0b8918900f442d097a6e946415d1ea7 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 10 Jan 2019 22:35:02 +0100 Subject: Window.c: move WM_STATE handling to separate function --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 36 +++++++++++++++-------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 82f4991c3..c404d0a46 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -1822,6 +1822,18 @@ Bool nxagentChangeWindowAttributes(WindowPtr pWin, unsigned long mask) return 1; } +void nxagentSetWMState(WindowPtr pWin, CARD32 desired) +{ + Atom prop = MakeAtom("WM_STATE", strlen("WM_STATE"), True); + nxagentWMStateRec wmState = {.state = desired, .icon = None}; + if (ChangeWindowProperty(pWin, prop, prop, 32, 0, 2, &wmState, 1) != Success) + { + #ifdef WARNING + fprintf(stderr, "%s: Changing WM_STATE failed.\n", __func__); + #endif + } +} + Bool nxagentRealizeWindow(WindowPtr pWin) { if (nxagentScreenTrap == 1) @@ -1843,14 +1855,7 @@ Bool nxagentRealizeWindow(WindowPtr pWin) /* add by dimbor */ if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin)) { - Atom prop = MakeAtom("WM_STATE", strlen("WM_STATE"), True); - nxagentWMStateRec wmState; - wmState.state = 1; /* NormalState */ - wmState.icon = None; - if (ChangeWindowProperty(pWin, prop, prop, 32, 0, 2, &wmState, 1) != Success) - { - fprintf(stderr, "nxagentRealizeWindow: Adding WM_STATE fail.\n"); - } + nxagentSetWMState(pWin, NormalState); } /* @@ -1878,7 +1883,7 @@ Bool nxagentRealizeWindow(WindowPtr pWin) #ifdef TEST if (nxagentOption(Rootless) && nxagentLastWindowDestroyed) { - fprintf(stderr, "nxagentRealizeWindow: Window realized. Stopped termination for rootless session.\n"); + fprintf(stderr, "%s: Window realized. Stopped termination for rootless session.\n", __func__); } #endif @@ -1899,14 +1904,11 @@ Bool nxagentUnrealizeWindow(WindowPtr pWin) /* add by dimbor */ if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin)) { - Atom prop = MakeAtom("WM_STATE", strlen("WM_STATE"), True); - nxagentWMStateRec wmState; - wmState.state = 3; /* WithdrawnState */ - wmState.icon = None; - if (ChangeWindowProperty(pWin, prop, prop, 32, 0, 2, &wmState, 1) != Success) - { - fprintf(stderr, "nxagentUnRealizeWindow: Changing WM_STATE failed.\n"); - } + /* + * The original _comment_ was WithdrawnState, while the _value_ + * was 3, which is IconicState. + */ + nxagentSetWMState(pWin, IconicState); } XUnmapWindow(nxagentDisplay, nxagentWindow(pWin)); -- cgit v1.2.3 From d175fd4c6d7872bf51c8509a678fecd84a14850a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 11 Jan 2019 00:59:55 +0100 Subject: Set default screen size to the whole screen in rootless mode This solves weird window (menu) placement and drawing behaviour on right/lowest 25% of the screen. Fixes ArcticaProject/nx-libs#757 (Part 1/2) --- nx-X11/programs/Xserver/hw/nxagent/Display.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index 448969d44..127874962 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -1356,7 +1356,7 @@ FIXME: Use of nxagentParentWindow is strongly deprecated. { if (!(nxagentUserGeometry.flag & WidthValue)) { - if (nxagentOption(Fullscreen)) + if (nxagentOption(Fullscreen) || nxagentOption(Rootless)) { nxagentChangeOption(RootWidth, DisplayWidth(nxagentDisplay, DefaultScreen(nxagentDisplay))); } @@ -1369,7 +1369,7 @@ FIXME: Use of nxagentParentWindow is strongly deprecated. if (!(nxagentUserGeometry.flag & HeightValue)) { - if (nxagentOption(Fullscreen)) + if (nxagentOption(Fullscreen) || nxagentOption(Rootless)) { nxagentChangeOption(RootHeight, DisplayHeight(nxagentDisplay, DefaultScreen(nxagentDisplay))); } -- cgit v1.2.3 From 6c0098a3e64683f79e5dbbf601ac18d840a88726 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 11 Jan 2019 21:58:50 +0100 Subject: Extensions.c: fix first resolution being ignored Minor fix: The loop always started at index 3, comparing against the value at index 2. So the resolution at index 1 (320x240) was never taken into account for anything. --- nx-X11/programs/Xserver/hw/nxagent/Extensions.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Extensions.c b/nx-X11/programs/Xserver/hw/nxagent/Extensions.c index d4f195bb4..363992225 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Extensions.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Extensions.c @@ -318,10 +318,10 @@ static int nxagentRandRInitSizes(ScreenPtr pScreen) * Compute default size. */ - w[0] = w[2]; - h[0] = h[2]; + w[0] = w[1]; + h[0] = h[1]; - for (i = 3; i < nSizes - 1; i++) + for (i = 2; i < nSizes - 1; i++) { if ((w[i] <= maxWidth * 3 / 4) && (h[i] <= maxHeight * 3 / 4) && -- cgit v1.2.3 From c4c39bc949549795c39ecbb24967256119c1f342 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 11 Jan 2019 22:39:34 +0100 Subject: Extensions.c: Cleanup nxagentRandRInitSizes() --- nx-X11/programs/Xserver/hw/nxagent/Extensions.c | 77 +++++++++++-------------- 1 file changed, 33 insertions(+), 44 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Extensions.c b/nx-X11/programs/Xserver/hw/nxagent/Extensions.c index 363992225..785724cea 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Extensions.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Extensions.c @@ -269,40 +269,30 @@ int nxagentRandRGetInfo(ScreenPtr pScreen, Rotation *pRotations) static int nxagentRandRInitSizes(ScreenPtr pScreen) { - RRScreenSizePtr pSize; + const int refresh_rate = 60; + RRScreenSizePtr pSize = NULL; - int width; - int height; - - int maxWidth; - int maxHeight; + /* + Index[0]: default size + Index[nsizes-1]: current size + Index[nsizes-2]: max size + */ -/* + /* 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; - - int mmWidth; - int mmHeight; - - /* - * Register all the supported sizes. The third - * parameter is the refresh rate. - */ - - maxWidth = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); - maxHeight = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); + int maxWidth = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); + int maxHeight = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); - nSizes = sizeof w / sizeof(int); + int nSizes = sizeof w / sizeof(int); /* * Add current and max sizes. @@ -321,7 +311,7 @@ static int nxagentRandRInitSizes(ScreenPtr pScreen) w[0] = w[1]; h[0] = h[1]; - for (i = 2; i < nSizes - 1; i++) + for (int i = 2; i < nSizes - 1; i++) { if ((w[i] <= maxWidth * 3 / 4) && (h[i] <= maxHeight * 3 / 4) && @@ -333,47 +323,46 @@ static int nxagentRandRInitSizes(ScreenPtr pScreen) } } - for (i = 0; i < nSizes; i++) + /* + * Register all the supported sizes at a fixed refresh rate. + */ + + for (int i = 0; i < nSizes; i++) { - width = w[i]; - height = h[i]; + int mmWidth, mmHeight; if (monitorResolution < 0) { - mmWidth = width * DisplayWidthMM(nxagentDisplay, DefaultScreen(nxagentDisplay)) / + mmWidth = w[i] * DisplayWidthMM(nxagentDisplay, DefaultScreen(nxagentDisplay)) / DisplayWidth(nxagentDisplay, DefaultScreen(nxagentDisplay)); - mmHeight = height * DisplayHeightMM(nxagentDisplay, DefaultScreen(nxagentDisplay)) / + mmHeight = h[i] * 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; - } - - if (mmHeight < 1) - { - mmHeight = 1; + mmWidth = (w[i] * 254 + monitorResolution * 5) / (monitorResolution * 10); + mmHeight = (h[i] * 254 + monitorResolution * 5) / (monitorResolution * 10); } - pSize = RRRegisterSize(pScreen, width, height, mmWidth, mmHeight); + pSize = RRRegisterSize(pScreen, w[i], h[i], mmWidth < 1 ? 1 : mmWidth, mmHeight < 1 ? 1 : mmHeight); if (pSize == NULL) { return 0; } - RRRegisterRate (pScreen, pSize, 60); + RRRegisterRate (pScreen, pSize, refresh_rate); } - RRSetCurrentConfig(pScreen, RR_Rotate_0, 60, pSize); + /* + * the last registered size should be the current size + */ + + if (pSize) + { + RRSetCurrentConfig(pScreen, RR_Rotate_0, refresh_rate, pSize); + } return 1; } -- cgit v1.2.3 From 8dea30751d5917482527489ca292714a7874f42c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 11 Jan 2019 23:25:39 +0100 Subject: Screen.c: move identical line out of both parts of an if clause --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index d8cf695a0..1af621570 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -1011,6 +1011,8 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, resetAgentPosition = True; } + nxagentChangeOption(BorderWidth, 0); + if (nxagentOption(Fullscreen)) { nxagentChangeOption(X, 0); @@ -1019,7 +1021,6 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, nxagentChangeOption(Width, WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay))); nxagentChangeOption(Height, HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay))); - nxagentChangeOption(BorderWidth, 0); if (nxagentReconnectTrap == False || nxagentResizeDesktopAtStartup) { @@ -1052,8 +1053,6 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, } else { - nxagentChangeOption(BorderWidth, 0); - if (nxagentReconnectTrap == False) { nxagentChangeOption(RootX, 0); -- cgit v1.2.3 From 43d3b655d4f158203b3e39025a3cafc314ba9ad7 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 13 Jan 2019 23:46:49 +0100 Subject: Screen.c: improve readability of size calculations ... by using some short named variables and the min() macro. No change in behaviour. --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 122 +++++++++++++--------------- 1 file changed, 57 insertions(+), 65 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 1af621570..cfe0fd9de 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -885,8 +885,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, #endif /* - * Forced geometry parameter - * to user geometry. + * Forced geometry parameter to user geometry. */ if (nxagentResizeDesktopAtStartup) @@ -903,32 +902,26 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, if (nxagentUserGeometry.flag & WidthValue) { - nxagentChangeOption(Width, nxagentUserGeometry.Width); - nxagentChangeOption(RootWidth, nxagentUserGeometry.Width); + int uw = nxagentUserGeometry.Width; - if (nxagentOption(SavedWidth) > nxagentUserGeometry.Width) - { - nxagentChangeOption(SavedWidth, nxagentUserGeometry.Width); - } + nxagentChangeOption(Width, uw); + nxagentChangeOption(RootWidth, uw); + nxagentChangeOption(SavedWidth, min(nxagentOption(SavedWidth), uw)); } if (nxagentUserGeometry.flag & HeightValue) { - nxagentChangeOption(Height, nxagentUserGeometry.Height); - nxagentChangeOption(RootHeight, nxagentUserGeometry.Height); + int uh = nxagentUserGeometry.Height; - if (nxagentOption(SavedHeight) > nxagentUserGeometry.Height) - { - nxagentChangeOption(SavedHeight, nxagentUserGeometry.Height); - } + nxagentChangeOption(Height, uh); + nxagentChangeOption(RootHeight, uh); + nxagentChangeOption(SavedHeight, min(nxagentOption(SavedHeight), uh)); } } /* - * This is first time the - * screen is initialized. - * Filling the geometry parameter - * from user geometry. + * This is first time the screen is initialized. + * Filling the geometry parameter from user geometry. */ if (nxagentReconnectTrap == False) @@ -971,10 +964,8 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, } /* - * Determine the size of the root window. - * It is the maximum size of the screen - * if we are either in rootless or in - * fullscreen mode. + * Determine the size of the root window. It is the maximum size of + * the screen if we are either in rootless or in fullscreen mode. */ if (nxagentOption(Rootless) == False && !nxagentWMIsRunning) @@ -1013,46 +1004,58 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, nxagentChangeOption(BorderWidth, 0); + /* get the screen size of the real X server once */ + int w = WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); + int h = HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)); + if (nxagentOption(Fullscreen)) { nxagentChangeOption(X, 0); nxagentChangeOption(Y, 0); - nxagentChangeOption(Width, WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay))); - nxagentChangeOption(Height, HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay))); - + nxagentChangeOption(Width, w); + nxagentChangeOption(Height, h); + /* first time screen initialization or resize during reconnect */ if (nxagentReconnectTrap == False || nxagentResizeDesktopAtStartup) { - nxagentChangeOption(RootWidth, WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay))); - nxagentChangeOption(RootHeight, HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay))); + nxagentChangeOption(RootWidth, w); + nxagentChangeOption(RootHeight, h); - if (nxagentOption(RootWidth) > WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay))) + if (nxagentOption(RootWidth) > w) { - nxagentChangeOption(SavedWidth, WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) * 3 / 4); + nxagentChangeOption(SavedWidth, w * 3 / 4); } else { nxagentChangeOption(SavedWidth, nxagentOption(RootWidth)); } - if (nxagentOption(RootHeight) > HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay))) + if (nxagentOption(RootHeight) > h) { - nxagentChangeOption(SavedHeight, HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) * 3 / 4); + nxagentChangeOption(SavedHeight, h * 3 / 4); } else { nxagentChangeOption(SavedHeight, nxagentOption(RootHeight)); } - } - nxagentChangeOption(RootX, ((WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) - - nxagentOption(RootWidth)) / 2)); - nxagentChangeOption(RootY, ((HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) - - nxagentOption(RootHeight)) / 2)); + nxagentChangeOption(RootX, 0); + nxagentChangeOption(RootY, 0); + } + else + { + /* center */ + nxagentChangeOption(RootX, (w - nxagentOption(RootWidth)) / 2); + nxagentChangeOption(RootY, (h - nxagentOption(RootHeight)) / 2); + } } else { + /* + * screen is initialized for the first time + */ + if (nxagentReconnectTrap == False) { nxagentChangeOption(RootX, 0); @@ -1063,53 +1066,44 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, } /* - * Be sure that the agent window won't be bigger + * Ensure that the agent window won't be bigger * than the root window. */ - if (nxagentOption(Width) > nxagentOption(RootWidth)) - { - nxagentChangeOption(Width, nxagentOption(RootWidth)); - } - - if (nxagentOption(Height) > nxagentOption(RootHeight)) - { - nxagentChangeOption(Height, nxagentOption(RootHeight)); - } + nxagentChangeOption(Width, min(nxagentOption(Width), nxagentOption(RootWidth))); + nxagentChangeOption(Height, min(nxagentOption(Height), nxagentOption(RootHeight))); /* * Be sure that the agent window won't be bigger * than the X server root window. */ - if (nxagentOption(Width) > WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay))) + if (nxagentOption(Width) > w) { - nxagentChangeOption(Width, WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) * 3 / 4); + nxagentChangeOption(Width, w * 3 / 4); } - if (nxagentOption(Height) > HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay))) + if (nxagentOption(Height) > h) { - nxagentChangeOption(Height, HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) * 3 / 4); + nxagentChangeOption(Height, h * 3 / 4); } /* - * Forcing the agent window geometry to be equal to - * the root window geometry the first time the - * screen is initialized if the geometry hasn't been - * esplicitly set in the option file and if - * the root window isn't bigger than the X server - * root window.. + * Forcing the agent window geometry to be equal to the root + * window geometry the first time the screen is initialized if the + * geometry hasn't been explicitly set in the option file and if + * the root window isn't bigger than the X server root window.. */ if (nxagentReconnectTrap == False) { - if ((nxagentOption(RootWidth) < WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay))) && + if ((nxagentOption(RootWidth) < w) && !(nxagentUserGeometry.flag & WidthValue)) { nxagentChangeOption(Width, nxagentOption(RootWidth)); } - if ((nxagentOption(RootHeight) < HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay))) && + if ((nxagentOption(RootHeight) < h) && !(nxagentUserGeometry.flag & HeightValue)) { nxagentChangeOption(Height, nxagentOption(RootHeight)); @@ -1118,11 +1112,9 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, if (resetAgentPosition) { - nxagentChangeOption(X, ((WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) - - nxagentOption(Width)) / 2)); - - nxagentChangeOption(Y, ((HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay)) - - nxagentOption(Height)) / 2)); + /* center */ + nxagentChangeOption(X, (w - nxagentOption(Width)) / 2); + nxagentChangeOption(Y, (h - nxagentOption(Height)) / 2); } nxagentChangeOption(SavedWidth, nxagentOption(RootWidth)); @@ -1131,8 +1123,8 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, if (nxagentOption(Rootless)) { - nxagentChangeOption(RootWidth, WidthOfScreen(DefaultScreenOfDisplay(nxagentDisplay))); - nxagentChangeOption(RootHeight, HeightOfScreen(DefaultScreenOfDisplay(nxagentDisplay))); + nxagentChangeOption(RootWidth, w); + nxagentChangeOption(RootHeight, h); } nxagentChangeOption(SavedRootWidth, nxagentOption(RootWidth)); -- cgit v1.2.3 From 3c92b5db9d3d90967410c4dc1d1f8a45554c724b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 13 Jan 2019 23:47:53 +0100 Subject: Screen.c: fix size calculation in rootless mode There's no need to reduce the size to 75% in rootless mode. We always want to have the full size then. Fixes ArcticaProject/nx-libs#757 (Part 2/2) --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index cfe0fd9de..bd0236ad4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -1080,12 +1080,26 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, if (nxagentOption(Width) > w) { - nxagentChangeOption(Width, w * 3 / 4); + if (nxagentOption(Rootless)) + { + nxagentChangeOption(Width, w); + } + else + { + nxagentChangeOption(Width, w * 3 / 4); + } } if (nxagentOption(Height) > h) { - nxagentChangeOption(Height, h * 3 / 4); + if (nxagentOption(Rootless)) + { + nxagentChangeOption(Height, h); + } + else + { + nxagentChangeOption(Height, h * 3 / 4); + } } /* -- cgit v1.2.3 From d16a5fbb19c072b667be76633bc3f23f12ca82ef Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sat, 12 Jan 2019 01:01:55 +0100 Subject: Screen.c: fix handling of fullscreen startup If nxagent is started in fullscreen mode take care the saved size (that is applied on exit of the fullscreen mode) will be configured correctly. Also respect a user provided -geometry option (had been ignored here previously). Fixes ArcticaProject/nx-libs#449 --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index bd0236ad4..19057dfe1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -1019,10 +1019,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, /* first time screen initialization or resize during reconnect */ if (nxagentReconnectTrap == False || nxagentResizeDesktopAtStartup) { - nxagentChangeOption(RootWidth, w); - nxagentChangeOption(RootHeight, h); - - if (nxagentOption(RootWidth) > w) + if (nxagentOption(RootWidth) >= w) { nxagentChangeOption(SavedWidth, w * 3 / 4); } @@ -1031,7 +1028,7 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, nxagentChangeOption(SavedWidth, nxagentOption(RootWidth)); } - if (nxagentOption(RootHeight) > h) + if (nxagentOption(RootHeight) >= h) { nxagentChangeOption(SavedHeight, h * 3 / 4); } @@ -1040,6 +1037,9 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, nxagentChangeOption(SavedHeight, nxagentOption(RootHeight)); } + nxagentChangeOption(RootWidth, w); + nxagentChangeOption(RootHeight, h); + nxagentChangeOption(RootX, 0); nxagentChangeOption(RootY, 0); } -- cgit v1.2.3