From: johnmartin-oracle <55413843+johnmartin-oracle@users.noreply.github.com> Date: Fri, 28 Aug 2020 02:30:23 +0000 (-0400) Subject: Update Surface_X11.cxx X-Git-Tag: v1.11.90~97^2^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7ab92639848a6059e2b6b88499b008b9606f3af6;p=tigervnc.git Update Surface_X11.cxx Runtime sellection of ARGB XImage byte order --- 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;