[X2Go-Commits] [nx-libs] 31/429: Screen.c: simplify nxagentResizeScreen

git-admin at x2go.org git-admin at x2go.org
Mon Oct 18 09:36:02 CEST 2021


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch 3.6.x
in repository nx-libs.

commit 2ada71fba786be79a09b4ab657d8d46a5719ce5a
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Mon May 25 22:20:43 2020 +0200

    Screen.c: simplify nxagentResizeScreen
---
 nx-X11/programs/Xserver/hw/nxagent/Screen.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
index 18e5410a0..0c1c177d6 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
@@ -2310,26 +2310,25 @@ Bool nxagentResizeScreen(ScreenPtr pScreen, int width, int height,
   pScreen -> height = height;
 
   /*
-   * Compute screen dimensions if they aren't given.
+   * Compute screen dimensions if they aren't provided.
    */
 
   if (mmWidth == 0)
   {
     if (monitorResolution < 0)
     {
-      mmWidth  = width * DisplayWidthMM(nxagentDisplay, DefaultScreen(nxagentDisplay)) /
-                     DisplayWidth(nxagentDisplay, DefaultScreen(nxagentDisplay));
+      mmWidth = width * DisplayWidthMM(nxagentDisplay, DefaultScreen(nxagentDisplay)) /
+                    DisplayWidth(nxagentDisplay, DefaultScreen(nxagentDisplay));
     }
     else
     {
-      mmWidth  = (width * 254 + monitorResolution * 5) / (monitorResolution * 10);
+      mmWidth = (width * 254 + monitorResolution * 5) / (monitorResolution * 10);
     }
 
     if (mmWidth < 1)
     {
       mmWidth = 1;
     }
-
   }
 
   if (mmHeight == 0)
@@ -2348,7 +2347,6 @@ Bool nxagentResizeScreen(ScreenPtr pScreen, int width, int height,
     {
       mmHeight = 1;
     }
-
   }
 
   pScreen -> mmWidth = mmWidth;
@@ -2362,14 +2360,9 @@ Bool nxagentResizeScreen(ScreenPtr pScreen, int width, int height,
   PixmapPtr pPixmap = fbGetScreenPixmap(pScreen);
 
   char *fbBits = realloc(pPixmap -> devPrivate.ptr, PixmapBytePad(width, pScreen->rootDepth) *
-			    height * BitsPerPixel(pScreen->rootDepth) / 8);
+                             height * BitsPerPixel(pScreen->rootDepth) / 8);
   if (fbBits == NULL)
   {
-    pScreen -> width = oldWidth;
-    pScreen -> height = oldHeight;
-    pScreen -> mmWidth = oldMmWidth;
-    pScreen -> mmHeight = oldMmHeight;
-
     goto nxagentResizeScreenError;
   }
 
@@ -2481,6 +2474,14 @@ FIXME: We should try to restore the previously
   return 1;
 
 nxagentResizeScreenError:
+  #ifdef DEBUG
+  fprintf(stderr, "%s: nxagentResizeScreenError\n", __func__);
+  #endif
+
+  pScreen -> width = oldWidth;
+  pScreen -> height = oldHeight;
+  pScreen -> mmWidth = oldMmWidth;
+  pScreen -> mmHeight = oldMmHeight;
 
   return 0;
 }

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list