You did some more changes as it had problems to set the window title. But the window title is important for the kindle window manager as it tells him to go to landscape mode.
Could you try to compile the original code and only make the changes to fix the color depth.
Code:
[root@kindle bin]# ./xmahjongg --name L:A_N:application_ID:com.xmahjongg_O:R_PC:N -B /mnt/us/extensions/xmahjongg/data/
xmahjongg: Cannot change window name on Kinde build