The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
unexpected UnmapNotify event
Terry Welsh
Guest

I'm hunting a weird bug at the moment. When I compile an SDL app on
32-bit Linux and run it on 64-bit Linux, I receive an UnmapNotify
event when I go fullscreen. This causes the window to disappear (no
window icon remains either). The app is still running but the window
is gone. Behavior can vary a little depending on the desktop
environment. Has anyone seen anything remotely like this? I'm going to
dig back into it after lunch.
--
Terry Welsh
www.reallyslick.com
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
unexpected UnmapNotify event
Terry Welsh
Guest

Thanks for the reply, John. After more digging, I found this problem
has been dealt with to a large extent. SDL is trying to decide whether
or not to use legacy fullscreen support and incorrectly deciding to
use it. Fullscreen is such a mess in Linux, making the right decision
might be impossible so I can't blame SDL. Using

export SDL_VIDEO_X11_LEGACY_FULLSCREEN=0

solves the problem. Whatever final solution I pick, this env variable
will definitely be in the troubleshooting notes on my website.
--
Terry Welsh
www.reallyslick.com


On Mon, Jul 29, 2013 at 12:28 PM, John wrote:
Quote:
That's an X11/Xorg error I think. Run `ldd theapp` to see what shared libs
the app is linking to on the 64-bit machine, and compare to the versions it
finds on the 32-bit machine.

Consider static linking when deploying binaries across different targets
like that. You might try static linking just to see if the bug disappears,
and if so, the issue is probably shared lib compatibility.

-John



On 07/29/2013 03:00 PM, Terry Welsh wrote:
Quote:

I'm hunting a weird bug at the moment. When I compile an SDL app on
32-bit Linux and run it on 64-bit Linux, I receive an UnmapNotify
event when I go fullscreen. This causes the window to disappear (no
window icon remains either). The app is still running but the window
is gone. Behavior can vary a little depending on the desktop
environment. Has anyone seen anything remotely like this? I'm going to
dig back into it after lunch.
--
Terry Welsh
www.reallyslick.com
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
unexpected UnmapNotify event
gabomdq


Joined: 28 Jul 2011
Posts: 495
Location: Argentina
So it's failing to use XRandr while it's actually available?


2013/7/29 Terry Welsh
Quote:
Thanks for the reply, John. After more digging, I found this problem
has been dealt with to a large extent. SDL is trying to decide whether
or not to use legacy fullscreen support and incorrectly deciding to
use it. Fullscreen is such a mess in Linux, making the right decision
might be impossible so I can't blame SDL. Using

export SDL_VIDEO_X11_LEGACY_FULLSCREEN=0

solves the problem. Whatever final solution I pick, this env variable
will definitely be in the troubleshooting notes on my website.
--
Terry Welsh
www.reallyslick.com


On Mon, Jul 29, 2013 at 12:28 PM, John wrote:
Quote:
That's an X11/Xorg error I think. Run `ldd theapp` to see what shared libs
the app is linking to on the 64-bit machine, and compare to the versions it
finds on the 32-bit machine.

Consider static linking when deploying binaries across different targets
like that. You might try static linking just to see if the bug disappears,
and if so, the issue is probably shared lib compatibility.

-John



On 07/29/2013 03:00 PM, Terry Welsh wrote:
Quote:

I'm hunting a weird bug at the moment. When I compile an SDL app on
32-bit Linux and run it on 64-bit Linux, I receive an UnmapNotify
event when I go fullscreen. This causes the window to disappear (no
window icon remains either). The app is still running but the window
is gone. Behavior can vary a little depending on the desktop
environment. Has anyone seen anything remotely like this? I'm going to
dig back into it after lunch.
--
Terry Welsh
www.reallyslick.com
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




--
Gabriel.
unexpected UnmapNotify event
Terry Welsh
Guest

Hi Gabriel,
Perhaps. XRandr is on the computer I'm using, but I'm afraid I don't
know where the failure is really happening. I suspect it's somewhere
deep inside X because I don't know where else an unmap event could be
generated.

The most specific I can be is to point you to line 1162 in
SDL_x11window.c. This is where legacy is set to true because
displaydata->use_vidmode is true. If legacy does not get set to true
here, my app succesfully goes fullscreen.
--
Terry Welsh
www.reallyslick.com

Quote:

So it's failing to use XRandr while it's actually available?

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
unexpected UnmapNotify event
gabomdq


Joined: 28 Jul 2011
Posts: 495
Location: Argentina
The decision on whether use_vidmode is true or false is done in X11_InitModes in SDL_x11modes.c

You can define X11MODES_DEBUG at the top, and maybe trace a bit inside that function (regular printf statements work just fine for this), and try to see why if you have XRandr in your system, it's not getting picked up (lines 412-418)


2013/7/30 Terry Welsh
Quote:
Hi Gabriel,
Perhaps. XRandr is on the computer I'm using, but I'm afraid I don't
know where the failure is really happening. I suspect it's somewhere
deep inside X because I don't know where else an unmap event could be
generated.

The most specific I can be is to point you to line 1162 in
SDL_x11window.c. This is where legacy is set to true because
displaydata->use_vidmode is true. If legacy does not get set to true
here, my app succesfully goes fullscreen.
--
Terry Welsh
www.reallyslick.com

Quote:

So it's failing to use XRandr while it's actually available?

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




--
Gabriel.
unexpected UnmapNotify event
Terry Welsh
Guest

Quote:
The decision on whether use_vidmode is true or false is done
in X11_InitModes in SDL_x11modes.c

You can define X11MODES_DEBUG at the top, and maybe trace a bit inside that
function (regular printf statements work just fine for this), and try to
see why if you have XRandr in your system, it's not getting picked up
(lines 412-418)

Thanks. I won't have access to the computers I need for this for about
a week. I'll try to look at it again then. This is probably a rare
problem, but it would be nice to find a concrete solution to put into
SDL.
- Terry
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
unexpected UnmapNotify event
Terry Welsh
Guest

I got a bit further on this problem. Too bad the title of this thread
is probably completely off-topic now. If I compile SDL and my game on
32-bit Fedora and run on the same computer everything is fine. If I
run the same builds of my game and SDL on 64-bit Ubuntu, things break.
I've come to the following two code blocks in SDL_x11modes.c:

if (!SDL_X11_HAVE_XINERAMA) {
#ifdef X11MODES_DEBUG
printf("Xinerama support not available\n");
#endif
return SDL_FALSE;
}


if (!SDL_X11_HAVE_XRANDR) {
#ifdef X11MODES_DEBUG
printf("XRandR support not available\n");
#endif
return SDL_FALSE;
}


SDL_X11_HAVE_XINERAMA and SDL_X11_HAVE_XRANDR evaluate to true on my
32-bit computer and these blocks get skipped. They evaluate to false
on my 64-bit computer and both functions return false. Can someone
tell me where these are defined? They don't exist anywhere else in the
code.

I'm not sure why they evaluate to false because I have xrandr and
xinerama on the 64-bit computer. But it's a good thing that they do
because if I bypass these blocks SDL will crash on
XineramaQueryExtension() or XRRQueryVersion().

Anyway, this brings me back to this bit in SDL_x11window.c:

if ( displaydata->use_vidmode ) {
legacy = SDL_TRUE; /* the new stuff only works with XRandR. */
}

Counter to what the comment says, the new stuff works for me even
though SDL reports XRandR as unavailable. Setting legacy = true here
causes ugly fullscreen problems on 64-bit Ubuntu with both KDE and
Xfce. Although, the symptoms are different on each DE.

Compiling my game and SDL on the 64-bit computer, xinerama and xrandr
are found, so use_xvidmode remains 0, legacy remains false, and
fullscreen works properly. I'd really like to get the same result from
a 32-bit build.
--
Terry Welsh
www.reallyslick.com


On Tue, Jul 30, 2013 at 8:48 PM, Terry Welsh wrote:
Quote:
Quote:
The decision on whether use_vidmode is true or false is done
in X11_InitModes in SDL_x11modes.c

You can define X11MODES_DEBUG at the top, and maybe trace a bit inside that
function (regular printf statements work just fine for this), and try to
see why if you have XRandr in your system, it's not getting picked up
(lines 412-418)

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
unexpected UnmapNotify event
gabomdq


Joined: 28 Jul 2011
Posts: 495
Location: Argentina
2013/8/12 Terry Welsh
Quote:
I got a bit further on this problem. Too bad the title of this thread
is probably completely off-topic now. If I compile SDL and my game on
32-bit Fedora and run on the same computer everything is fine. If I
run the same builds of my game and SDL on 64-bit Ubuntu, things break.
I've come to the following two code blocks in SDL_x11modes.c:

    if (!SDL_X11_HAVE_XINERAMA) {
#ifdef X11MODES_DEBUG
        printf("Xinerama support not available\n");
#endif
        return SDL_FALSE;
    }


    if (!SDL_X11_HAVE_XRANDR) {
#ifdef X11MODES_DEBUG
        printf("XRandR support not available\n");
#endif
        return SDL_FALSE;
    }


SDL_X11_HAVE_XINERAMA and SDL_X11_HAVE_XRANDR evaluate to true on my
32-bit computer and these blocks get skipped. They evaluate to false
on my 64-bit computer and both functions return false. Can someone
tell me where these are defined? They don't exist anywhere else in the
code.



That's apparently defined in SDL_x11dyn.h and SDL_x11dyn.c in several places, the macro looks like...


#define SDL_X11_MODULE(modname) extern int SDL_X11_HAVE_##modname;

#define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1;

#define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 0;



And then SDL_x11sym.h ...


/* Xinerama support */
#if SDL_VIDEO_DRIVER_X11_XINERAMA
SDL_X11_MODULE(XINERAMA)
SDL_X11_SYM(Bool,XineramaIsActive,(Display *a),(a),return)
SDL_X11_SYM(Bool,XineramaQueryExtension,(Display *a,int *b,int *c),(a,b,c),return)
SDL_X11_SYM(Status,XineramaQueryVersion,(Display *a,int *b,int *c),(a,b,c),return)
SDL_X11_SYM(XineramaScreenInfo*,XineramaQueryScreens,(Display *a, int *b),(a,b),return)
#endif



So, I think that for SDL_X11_HAVE_XINERAMA to be defined as 1, SDL_X11_LoadSymbols needs to succeed, which means that you probably need to install the 32 bit versions of the X11 libraries. For example, in my Ubuntu 13.04 64 I have:


dpkg -S Xinerama
libxinerama-dev:amd64: /usr/share/man/man3/Xinerama.3.gz
libxinerama-dev:amd64: /usr/lib/x86_64-linux-gnu/libXinerama.so
libxinerama-dev:amd64: /usr/share/man/man3/XineramaQueryExtension.3.gz
libxinerama1:i386: /usr/lib/i386-linux-gnu/libXinerama.so.1.0.0
libxinerama-dev:amd64: /usr/share/man/man3/XineramaQueryVersion.3.gz
libxinerama1:i386: /usr/lib/i386-linux-gnu/libXinerama.so.1
libxinerama1:amd64: /usr/lib/x86_64-linux-gnu/libXinerama.so.1.0.0
libxinerama-dev:amd64: /usr/include/X11/extensions/Xinerama.h
libxinerama-dev:amd64: /usr/lib/x86_64-linux-gnu/libXinerama.a
libxinerama-dev:amd64: /usr/share/man/man3/XineramaQueryScreens.3.gz
libxinerama-dev:amd64: /usr/share/man/man3/XineramaIsActive.3.gz
libxinerama1:amd64: /usr/lib/x86_64-linux-gnu/libXinerama.so.1





Try with sudo apt-get install libxrandr2:i386 libxinerama1:i386




Quote:
I'm not sure why they evaluate to false because I have xrandr and
xinerama on the 64-bit computer. But it's a good thing that they do
because if I bypass these blocks SDL will crash on
XineramaQueryExtension() or XRRQueryVersion().

Anyway, this brings me back to this bit in SDL_x11window.c:

        if ( displaydata->use_vidmode ) {
            legacy = SDL_TRUE;  /* the new stuff only works with XRandR. */
        }

Counter to what the comment says, the new stuff works for me even
though SDL reports XRandR as unavailable. Setting legacy = true here
causes ugly fullscreen problems on 64-bit Ubuntu with both KDE and
Xfce. Although, the symptoms are different on each DE.





Yes, that legacy mode on SDL2 is unusable in my experience.
unexpected UnmapNotify event
Terry Welsh
Guest

Quote:
Try with sudo apt-get install libxrandr2:i386 libxinerama1:i386

Thanks Gabriel. That was quite the mystery. Now it's just a packaging issue Razz

I guess I falsely assumed that since the SDL 1.2 build of my game
worked, I already had all the right libraries. I think I'll also try
to add a warning when the game starts up if these libraries don't get
loaded.
- Terry
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org