Reply: Why the app freezed at SDL_HideWindow while calling SDL_DetroyWindow or SDL_CreateRenderer with SDL_RENDERER_ACCERLATED?

There is one thing I need clarify, while using SDL_CreateWindow to create an
independent window, the SDL_CreateRenderer with SDL_RENDERER_ACCERLATED
won’t hang on.

So the problem might be how to make SDL2.0 works with Qt Window?

Joy

-----Original-----
Sender: Joy Woo [mailto:@_Joy_Woo]
Time: 2013/7/10 20:30
Receiver: 'sdl at lists.libsdl.org
Topic: Why the app freezed at SDL_HideWindow while calling SDL_DetroyWindow
or SDL_CreateRenderer with SDL_RENDERER_ACCERLATED?

Dear all, please help.

I met two confusing situations while using SDL2.0 in Qt5.1.0 to build a
media player under vmware virtual machine (ubuntu12.04 on x86 32 laptop).

  1. SDL_CreateRenderer(pt_sdl_window, -1, SDL_RENDERER_ACCELERATED) hangs on
    infinitely.

pt_sdl_window points to a SDL window created by SDL_CreateWindowFrom from a
QWidget placed on QMainWindow.

I built a debug version of SDL2.0 to check out why the application stopped,
then came across that it’s the code inside function X11_HideWindow blocked,
the code is as below(SDL_x11window.c):

if (X11_IsWindowMapped(_this, window)) {
    XUnmapWindow(display, data->xwindow);
    /* Blocking wait for "UnmapNotify" event */
    XIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow);
    XFlush(display);
}

It’s very obviously after calling the XUnmapWindow, no UnmapNotify event
received, so that the code infinitely blocked…

Further, I found the documentation of XUnmapWindow as below:

The XUnmapWindow() function unmaps the specified window and causes the X
server to generate an UnmapNotify event. If the specified window is already
unmapped, XUnmapWindow() has no effect. Normal exposure processing on
formerly obscured windows is performed. Any child window will no longer be
visible until another map call is made on the parent. In other words, the
subwindows are still mapped but are not visible until the parent is mapped.
Unmapping a window will generate Expose events on windows that were formerly
obscured by it.

The apparent reason would be that the X server wasn’t generate any
UnmapNotify event at all after calling XUnmapWindow.

  1. SDL_DetroyWindow(pt_sdl_window) hangs on.

The reason was absolutely the same as the above one. They hanged on at the
same place.

Why does this happen? Any suggestions on that?

Thanks a million! By the way, the SDL2.0 documentation is so …you know.