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