Skip to content

Commit

Permalink
video: x11: Set XImage's byte_order field (fix #5081)
Browse files Browse the repository at this point in the history
If the X server's byte order is different from the client, things might
display in the wrong colour.

Apparently we can just set the byte_order field to the client's byte
order, and the X server will adjust everything automatically:
https://xorg.freedesktop.narkive.com/GbSD1aPq/ximage-s-byte-order-field
  • Loading branch information
sulix authored and slouken committed Dec 10, 2021
1 parent e7f84c2 commit 9da93d0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/video/x11/SDL_x11framebuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ X11_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format,
shmdt(shminfo->shmaddr);
} else {
/* Done! */
data->ximage->byte_order = (SDL_BYTEORDER == SDL_BIG_ENDIAN) ? MSBFirst : LSBFirst;
data->use_mitshm = SDL_TRUE;
*pixels = shminfo->shmaddr;
return 0;
Expand All @@ -135,6 +136,7 @@ X11_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format,
SDL_free(*pixels);
return SDL_SetError("Couldn't create XImage");
}
data->ximage->byte_order = (SDL_BYTEORDER == SDL_BIG_ENDIAN) ? MSBFirst : LSBFirst;
return 0;
}

Expand Down

0 comments on commit 9da93d0

Please sign in to comment.