Blame SOURCES/tigervnc-argb-runtime-ximage-byteorder-selection.patch

601a16
From 7ab92639848a6059e2b6b88499b008b9606f3af6 Mon Sep 17 00:00:00 2001
601a16
From: johnmartin-oracle <55413843+johnmartin-oracle@users.noreply.github.com>
601a16
Date: Thu, 27 Aug 2020 22:30:23 -0400
601a16
Subject: [PATCH] Update Surface_X11.cxx
601a16
601a16
Runtime sellection of ARGB  XImage byte order
601a16
---
601a16
 vncviewer/Surface_X11.cxx | 22 +++++++++++-----------
601a16
 1 file changed, 11 insertions(+), 11 deletions(-)
601a16
601a16
diff --git a/vncviewer/Surface_X11.cxx b/vncviewer/Surface_X11.cxx
601a16
index 6562634dc..8944c3f71 100644
601a16
--- a/vncviewer/Surface_X11.cxx
601a16
+++ b/vncviewer/Surface_X11.cxx
601a16
@@ -123,17 +123,17 @@ void Surface::alloc()
601a16
   // we find such a format
601a16
   templ.type = PictTypeDirect;
601a16
   templ.depth = 32;
601a16
-#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
601a16
-  templ.direct.alpha = 0;
601a16
-  templ.direct.red   = 8;
601a16
-  templ.direct.green = 16;
601a16
-  templ.direct.blue  = 24;
601a16
-#else
601a16
-  templ.direct.alpha = 24;
601a16
-  templ.direct.red   = 16;
601a16
-  templ.direct.green = 8;
601a16
-  templ.direct.blue  = 0;
601a16
-#endif
601a16
+  if (XImageByteOrder(fl_display) == MSBFirst) {
601a16
+    templ.direct.alpha = 0;
601a16
+    templ.direct.red   = 8;
601a16
+    templ.direct.green = 16;
601a16
+    templ.direct.blue  = 24;
601a16
+  } else {
601a16
+    templ.direct.alpha = 24;
601a16
+    templ.direct.red   = 16;
601a16
+    templ.direct.green = 8;
601a16
+    templ.direct.blue  = 0;
601a16
+  }
601a16
   templ.direct.alphaMask = 0xff;
601a16
   templ.direct.redMask = 0xff;
601a16
   templ.direct.greenMask = 0xff;