# Unexpected UnmapNotify event

**URL:** <https://discourse.libsdl.org/t/unexpected-unmapnotify-event/19798>\
**Category:** SDL Development\
**Created:** [July 29, 2013, 7:00pm UTC](https://discourse.libsdl.org/t/unexpected-unmapnotify-event/19798 "2013-07-29T19:00:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mogumbo](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/mogumbo/32/704_2.png) [@mogumbo](https://discourse.libsdl.org/u/mogumbo)\
**Post date:** [July 29, 2013, 7:00pm UTC](https://discourse.libsdl.org/t/unexpected-unmapnotify-event/19798/1 "2013-07-29T19:00:32Z")

</div>

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](http://www.reallyslick.com)

---

<div class="post-metadata">

**Author:** ![mogumbo](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/mogumbo/32/704_2.png) [@mogumbo](https://discourse.libsdl.org/u/mogumbo)\
**Post date:** [July 29, 2013, 10:58pm UTC](https://discourse.libsdl.org/t/unexpected-unmapnotify-event/19798/2 "2013-07-29T22:58:30Z")

</div>

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

> **[Really Slick - Indie game dev and classic 3D screensavers](http://www.reallyslick.com)**
>
> The indie game Retrobooster is on its way. It's an old-school 2D shooter with 3D graphics, explosions, monsters, fast flying, and more explosions. As evil aliens attempt to lay waste to the galaxy, fight your way through dozens of worlds with an...

On Mon, Jul 29, 2013 at 12:28 PM, John wrote:

> 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:
> 
> > ## 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](http://www.reallyslick.com)
> > 
> > * * *
> > 
> > SDL mailing list  
> > SDL at [lists.libsdl.org](http://lists.libsdl.org)  
> > [http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org](http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)

---

<div class="post-metadata">

**Author:** ![Gabriel\_Jacobo](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/gabriel_jacobo/32/1968_2.png) [@Gabriel\_Jacobo](https://discourse.libsdl.org/u/Gabriel_Jacobo)\
**Post date:** [July 29, 2013, 11:31pm UTC](https://discourse.libsdl.org/t/unexpected-unmapnotify-event/19798/3 "2013-07-29T23:31:05Z")

</div>

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

2013/7/29 Terry Welsh \> 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](http://www.reallyslick.com)
> 
> On Mon, Jul 29, 2013 at 12:28 PM, John wrote:
> 
> > 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:
> > 
> > > ## 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](http://www.reallyslick.com)
> > > 
> > > * * *
> > > 
> > > SDL mailing list  
> > > SDL at [lists.libsdl.org](http://lists.libsdl.org)  
> > > [http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org](http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)
> 
> * * *
> 
> SDL mailing list  
> SDL at [lists.libsdl.org](http://lists.libsdl.org)  
> [http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org](http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)

–  
Gabriel.

---

<div class="post-metadata">

**Author:** ![mogumbo](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/mogumbo/32/704_2.png) [@mogumbo](https://discourse.libsdl.org/u/mogumbo)\
**Post date:** [July 30, 2013, 8:28pm UTC](https://discourse.libsdl.org/t/unexpected-unmapnotify-event/19798/4 "2013-07-30T20:28:15Z")

</div>

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

> **[Really Slick - Indie game dev and classic 3D screensavers](http://www.reallyslick.com)**
>
> The indie game Retrobooster is on its way. It's an old-school 2D shooter with 3D graphics, explosions, monsters, fast flying, and more explosions. As evil aliens attempt to lay waste to the galaxy, fight your way through dozens of worlds with an...

> So it’s failing to use XRandr while it’s actually available?

---

<div class="post-metadata">

**Author:** ![Gabriel\_Jacobo](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/gabriel_jacobo/32/1968_2.png) [@Gabriel\_Jacobo](https://discourse.libsdl.org/u/Gabriel_Jacobo)\
**Post date:** [July 30, 2013, 11:16pm UTC](https://discourse.libsdl.org/t/unexpected-unmapnotify-event/19798/5 "2013-07-30T23:16:04Z")

</div>

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 \> 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](http://www.reallyslick.com)
> 
> > So it’s failing to use XRandr while it’s actually available?
> 
> * * *
> 
> SDL mailing list  
> SDL at [lists.libsdl.org](http://lists.libsdl.org)  
> [http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org](http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org)

–  
Gabriel.

---

<div class="post-metadata">

**Author:** ![mogumbo](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/mogumbo/32/704_2.png) [@mogumbo](https://discourse.libsdl.org/u/mogumbo)\
**Post date:** [July 31, 2013, 3:48am UTC](https://discourse.libsdl.org/t/unexpected-unmapnotify-event/19798/6 "2013-07-31T03:48:06Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![mogumbo](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/mogumbo/32/704_2.png) [@mogumbo](https://discourse.libsdl.org/u/mogumbo)\
**Post date:** [August 12, 2013, 11:03pm UTC](https://discourse.libsdl.org/t/unexpected-unmapnotify-event/19798/7 "2013-08-12T23:03:11Z")

</div>

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

> **[Really Slick - Indie game dev and classic 3D screensavers](http://www.reallyslick.com)**
>
> The indie game Retrobooster is on its way. It's an old-school 2D shooter with 3D graphics, explosions, monsters, fast flying, and more explosions. As evil aliens attempt to lay waste to the galaxy, fight your way through dozens of worlds with an...

On Tue, Jul 30, 2013 at 8:48 PM, Terry Welsh \<@Terry\_Welsh\> wrote:

> > 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)

---

<div class="post-metadata">

**Author:** ![Gabriel\_Jacobo](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/gabriel_jacobo/32/1968_2.png) [@Gabriel\_Jacobo](https://discourse.libsdl.org/u/Gabriel_Jacobo)\
**Post date:** [August 12, 2013, 11:37pm UTC](https://discourse.libsdl.org/t/unexpected-unmapnotify-event/19798/8 "2013-08-12T23:37:09Z")

</div>

2013/8/12 Terry Welsh

> 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

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.

---

<div class="post-metadata">

**Author:** ![mogumbo](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/mogumbo/32/704_2.png) [@mogumbo](https://discourse.libsdl.org/u/mogumbo)\
**Post date:** [August 13, 2013, 1:16am UTC](https://discourse.libsdl.org/t/unexpected-unmapnotify-event/19798/9 "2013-08-13T01:16:57Z")

</div>

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

Thanks Gabriel. That was quite the mystery. Now it’s just a packaging issue 😛

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
