Very first call to RenderPresent does nothing (X11, OpenGL)

Hello list,

I’m seeing, a somewhat undesired behavior in SDL 1.3 (HG) using the X11
video/OpenGL renderer. I’m not sure if it’s my system or not, I would
appreciate if somebody could give this test program a run.

What I expect: Red screen after the first SDL_Delay call.

What I get: Black screen after the first SDL_Delay call, red screen
after the second one.

If this is a known issue, and there’s a known work-around (i.e. if
renderers are not to be used this way anyway), I propose atleast adding
it to the 1.2 compatibility layer into UpdateRects.

#include “SDL.h”

int main(int argc, char* argv[])
{
SDL_Window* window;
SDL_Renderer* renderer;

    if (SDL_Init(SDL_INIT_VIDEO) < 0) return -1;

    window = SDL_CreateWindow("Empty Red Window",
                    SDL_WINDOWPOS_CENTERED, 
                    SDL_WINDOWPOS_CENTERED,
                    512, 512,
                    SDL_WINDOW_SHOWN);

    renderer = SDL_CreateRenderer(window, -1, 0);

/* Select red color and 'clear' with it */
    SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
    SDL_RenderClear(renderer);

/* Update screen for the first time and wait */ 
    SDL_RenderPresent(renderer);
    SDL_Delay(5000);

    /* Update screen second time and wait some more */
    SDL_RenderPresent(renderer);
SDL_Delay(5000);

    SDL_Quit();
    return 0;

}

Cc:
OpenGL)

Hello list,

I’m seeing, a somewhat undesired behavior in SDL 1.3 (HG) using the
X11 video/OpenGL renderer. I’m not sure if it’s my system or not, I
would appreciate if somebody could give this test program a run.

What I expect: Red screen after the first SDL_Delay call.

What I get: Black screen after the first SDL_Delay call, red screen
after the second one.

I get red screen with the first SDL_RenderPresent() call.

My system is FreeBSD 8.1, xorg-7.5, OpenGL libs from Nvidia with the
Nvidia GPU driver.

What’s your system?

I’m on Linux 2.6.31-i686, xorg-server-1.9.4, OpenGL libs from non-free
Nvidia driver (260.19.29).

Not sure how to correlate our xorg versions tho :confused: Questioning it lead
me to this SDL-less test (which produces same results for me):

/* gcc -o glxswap glxswap.c -lX11 -lGL */

#include <stdio.h>
#include <stdlib.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <GL/gl.h>
#include <GL/glx.h>

Display *dpy;
Window root;
GLint att[] = { GLX_RGBA, GLX_DEPTH_SIZE, 24,
GLX_DOUBLEBUFFER, None }; XVisualInfo *vi;
Colormap cmap;
XSetWindowAttributes swa;
Window win;
GLXContext glc;
XWindowAttributes gwa;
XEvent xev;

int main(int argc, char *argv[]) {
dpy = XOpenDisplay(NULL);
root = DefaultRootWindow(dpy);
vi = glXChooseVisual(dpy, 0, att);

cmap = XCreateColormap(dpy, root, vi->visual, AllocNone);
swa.colormap = cmap;
swa.event_mask = ExposureMask | KeyPressMask;
win = XCreateWindow(dpy, root, 0, 0, 
	600, 600, 0, vi->depth, InputOutput, vi->visual,
CWColormap | CWEventMask, &swa);

XMapWindow(dpy, win);
XStoreName(dpy, win, "glX red window");

glc = glXCreateContext(dpy, vi, NULL, GL_TRUE);
glXMakeCurrent(dpy, win, glc);

XGetWindowAttributes(dpy, win, &gwa);
glViewport(0, 0, gwa.width, gwa.height);

/* Fill with red */
glClearColor(1.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);

/* while(1) {
	XNextEvent(dpy, &xev);
	if(xev.type == Expose) break;
} */

/* First one */
glXSwapBuffers(dpy, win);
printf("See any red?\n"); 
sleep(1);

/* Second one */
glXSwapBuffers(dpy, win); 
sleep(1);

glXMakeCurrent(dpy, None, NULL);
glXDestroyContext(dpy, glc);
XDestroyWindow(dpy, win);
XCloseDisplay(dpy);
return 0;

}

I’m now not sure if that’s a bug in glx or desired behavior. If it’s a
bug I’ll take it to xorg.On Tue, 25 Oct 2011 20:02:31 -0700 (PDT) Unga wrote:

----- Original Message -----

From: Driedfruit <@Driedfruit>
To: sdl at lists.libsdl.org
Sent: Tuesday, October 25, 2011 10:57 AM
Subject: [SDL] Very first call to RenderPresent does nothing (X11,

Best regards
Unga


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

It’s me again.

I think I’ve found the problem. I’m still not sure how wide-spread it
is (considering Unga’s report). It seems you are not supposed to call
glXMakeCurrent until the desired window had actually appeared on
screen. Waiting for Expose event seems to do the trick.

I don’t see any good places in SDL to hack that in, but I tried a
very-very-very dirty approach and it worked (SDL_ShowWindow and while(1)
{ wait for Expose; } at the very end of X11_CreateWindow).

Here’s a new test program. Toggle the #if 0 to see the difference on
your system if any.

/* gcc -o glxswap glxswap.c -lX11 -lGL */
#include <stdio.h>
#include <stdlib.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <GL/gl.h>
#include <GL/glx.h>

Display *dpy;
Window root;
GLint att[] = { GLX_RGBA, GLX_DEPTH_SIZE, 24,
GLX_DOUBLEBUFFER, None }; XVisualInfo *vi;
Colormap cmap;
XSetWindowAttributes swa;
Window win;
GLXContext glc;
XWindowAttributes gwa;
XEvent xev;

int main(int argc, char *argv[]) {
dpy = XOpenDisplay(NULL);
root = DefaultRootWindow(dpy);
vi = glXChooseVisual(dpy, 0, att);

cmap = XCreateColormap(dpy, root, vi->visual, AllocNone);
swa.colormap = cmap;
swa.event_mask = StructureNotifyMask | ExposureMask;
win = XCreateWindow(dpy, root, 0, 0, 
	600, 600, 0, vi->depth, InputOutput, vi->visual,
CWColormap | CWEventMask, &swa); XStoreName(dpy, win, "glX red
window");

XMapWindow(dpy, win);
glc = glXCreateContext(dpy, vi, NULL, GL_TRUE);

#if 0
/* Wait for an event before calling glXMakeCurrent */
while(1) {
XNextEvent(dpy, &xev);
if(xev.type == Expose) break;
}
#endif

glXMakeCurrent(dpy, win, glc);

XGetWindowAttributes(dpy, win, &gwa);
glViewport(0, 0, gwa.width, gwa.height);

/* Fill with red */
glClearColor(1.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);

/* First one */
glXSwapBuffers(dpy, win);
printf("See any red?\n"); 
sleep(1);

/* Second one */
glXSwapBuffers(dpy, win); 
sleep(1);

glXMakeCurrent(dpy, None, NULL);
glXDestroyContext(dpy, glc);
XDestroyWindow(dpy, win);
XCloseDisplay(dpy);
return 0;

}On Wed, 26 Oct 2011 01:23:57 +0400 Driedfruit <@Driedfruit> wrote:

On Tue, 25 Oct 2011 20:02:31 -0700 (PDT) Unga wrote:

----- Original Message -----

From: Driedfruit <@Driedfruit>
To: sdl at lists.libsdl.org
Cc:
Sent: Tuesday, October 25, 2011 10:57 AM
Subject: [SDL] Very first call to RenderPresent does nothing (X11,
OpenGL)

Hello list,

I’m seeing, a somewhat undesired behavior in SDL 1.3 (HG) using
the X11 video/OpenGL renderer. I’m not sure if it’s my system or
not, I would appreciate if somebody could give this test program
a run.

What I expect: Red screen after the first SDL_Delay call.

What I get: Black screen after the first SDL_Delay call, red
screen after the second one.

I get red screen with the first SDL_RenderPresent() call.

My system is FreeBSD 8.1, xorg-7.5, OpenGL libs from Nvidia with the
Nvidia GPU driver.

What’s your system?

I’m on Linux 2.6.31-i686, xorg-server-1.9.4, OpenGL libs from non-free
Nvidia driver (260.19.29).

Not sure how to correlate our xorg versions tho :confused: Questioning it lead
me to this SDL-less test (which produces same results for me):

Cc:

Hello list,

I’m seeing, a somewhat undesired behavior in SDL 1.3 (HG) using the X11
video/OpenGL renderer. I’m not sure if it’s my system or not, I would
appreciate if somebody could give this test program a run.

What I expect: Red screen after the first SDL_Delay call.

What I get: Black screen after the first SDL_Delay call, red screen
after the second one.

I get red screen with the first SDL_RenderPresent() call.

My system is FreeBSD 8.1, xorg-7.5, OpenGL libs from Nvidia with the Nvidia GPU driver.

What’s your system?

Best regards
Unga

----- Original Message -----
From: Driedfruit
To: sdl at lists.libsdl.org
Sent: Tuesday, October 25, 2011 10:57 AM
Subject: [SDL] Very first call to RenderPresent does nothing (X11, OpenGL)

Hello again, list.

I’ve verified that a race condition does indeed exist. If you’re not
seeing it - you’re being (un)lucky.

so technically SwapBuffers (at least the way you’re using it)
is in the gl stream but MakeCurrent is in the X stream, and the two
are asynchronous
so you’d need some ordering op between the two

Currently in SDL 1.3, no sync whatsoever is happening. The classic glX
approach is to wait for MapNotify after the XMapWindow/XMapRised calls.
My current patch:

— a/src/video/x11/SDL_x11window.c Mon Oct 24 23:18:53 2011
-0400 +++ b/src/video/x11/SDL_x11window.c Wed Oct 26 17:42:10
2011 +0400 @@ -778,6 +778,10 @@
XFlush(display);
}

+static Bool WaitForNotify(Display *d, XEvent *e, char *arg) {

  • return (e->type == MapNotify) && (e->xmap.window == (Window)arg);
    +}+
    void
    X11_ShowWindow(_THIS, SDL_Window * window)
    {
    @@ -785,6 +789,14 @@
    Display *display = data->videodata->display;

    XMapRaised(display, data->xwindow);

+#if SDL_VIDEO_OPENGL_GLX

  • if (window->flags & SDL_WINDOW_OPENGL) {
  •    XEvent e;
    
  •    XIfEvent(display, &e, WaitForNotify, (char*)data->xwindow);
    
  • }
    +#endif
  • XFlush(display);
    }

This requires SDL_WINDOW_OPENGL to be set, obviously. There are
probably other places (Fullscreen toggle?) that need similar blocking.

On Wed, 26 Oct 2011 03:10:12 +0400 Driedfruit <@Driedfruit> wrote:

On Wed, 26 Oct 2011 01:23:57 +0400 Driedfruit <@Driedfruit> wrote:

It’s me again.

I think I’ve found the problem. I’m still not sure how wide-spread it
is (considering Unga’s report). It seems you are not supposed to call
glXMakeCurrent until the desired window had actually appeared on
screen. Waiting for Expose event seems to do the trick.

I don’t see any good places in SDL to hack that in, but I tried a
very-very-very dirty approach and it worked (SDL_ShowWindow and
while(1) { wait for Expose; } at the very end of X11_CreateWindow).

Here’s a new test program. Toggle the #if 0 to see the difference on
your system if any.

Hello list.

This too was already reported, as
http://bugzilla.libsdl.org/show_bug.cgi?id=1246 , and again, the patch
proposed there is cleaner then mine. I’ve tested it and it does fix the
problem. Additionally, I also use a tiling WM, and the issue described
in the bug indeed is fixed with this too. (I was thinking of making
additional report for the tiling WM problem, and it turns out they are
one and the same).

Sorry for all the redundancy in my “reports”. I’ll search bugzilla more
next time.On Wed, 26 Oct 2011 17:49:08 +0400 Driedfruit <@Driedfruit> wrote:

Hello again, list.

I’ve verified that a race condition does indeed exist. If you’re not
seeing it - you’re being (un)lucky.

so technically SwapBuffers (at least the way you’re using it)
is in the gl stream but MakeCurrent is in the X stream, and the two
are asynchronous
so you’d need some ordering op between the two

Currently in SDL 1.3, no sync whatsoever is happening. The classic glX
approach is to wait for MapNotify after the XMapWindow/XMapRised
calls. My current patch:

— a/src/video/x11/SDL_x11window.c Mon Oct 24 23:18:53 2011
-0400 +++ b/src/video/x11/SDL_x11window.c Wed Oct 26 17:42:10
2011 +0400 @@ -778,6 +778,10 @@
XFlush(display);
}

+static Bool WaitForNotify(Display *d, XEvent *e, char *arg) {

  • return (e->type == MapNotify) && (e->xmap.window == (Window)arg);
    +}

void
X11_ShowWindow(_THIS, SDL_Window * window)
{
@@ -785,6 +789,14 @@
Display *display = data->videodata->display;

 XMapRaised(display, data->xwindow);

+#if SDL_VIDEO_OPENGL_GLX

  • if (window->flags & SDL_WINDOW_OPENGL) {
  •    XEvent e;
    
  •    XIfEvent(display, &e, WaitForNotify, (char*)data->xwindow);
    
  • }
    +#endif
  • XFlush(display);
    }

This requires SDL_WINDOW_OPENGL to be set, obviously. There are
probably other places (Fullscreen toggle?) that need similar blocking.

On Wed, 26 Oct 2011 03:10:12 +0400 Driedfruit <@Driedfruit> wrote:

On Wed, 26 Oct 2011 01:23:57 +0400 Driedfruit <@Driedfruit> wrote:

It’s me again.

I think I’ve found the problem. I’m still not sure how wide-spread
it is (considering Unga’s report). It seems you are not supposed to
call glXMakeCurrent until the desired window had actually appeared
on screen. Waiting for Expose event seems to do the trick.

I don’t see any good places in SDL to hack that in, but I tried a
very-very-very dirty approach and it worked (SDL_ShowWindow and
while(1) { wait for Expose; } at the very end of X11_CreateWindow).

Here’s a new test program. Toggle the #if 0 to see the difference on
your system if any.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Hello list!

Some time ago, I wrestled with an annoying issue of X / SDL threads
racing for opengl context.

http://lists.libsdl.org/pipermail/sdl-libsdl.org/2011-October/082598.html

The test case program is still giving the incorrect result for me.

I have found and tested a patch, that
a) fixes that problem
b) fixes ANOTHER bug, making SDL windows behave correctly in tiling
WMs.

http://bugzilla.libsdl.org/show_bug.cgi?id=1246

Unfortunately, Sam rejected that patch, because it was marked as SDL
1.2.

Let me assure you, it is more than relevant for SDL2 ! Please don’t let
this slip.

Test case:

#include “SDL.h”

int main(int argc, char* argv[])
{
SDL_Window* window;
SDL_Renderer* renderer;

    if (SDL_Init(SDL_INIT_VIDEO) < 0) return -1;

    window = SDL_CreateWindow("Empty Red Window",
                    SDL_WINDOWPOS_CENTERED, 
                    SDL_WINDOWPOS_CENTERED,
                    512, 512,
                    SDL_WINDOW_SHOWN);

    renderer = SDL_CreateRenderer(window, -1, 0);

/* Select red color and 'clear' with it */
    SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
    SDL_RenderClear(renderer);

/* Update screen for the first time and wait */ 
    SDL_RenderPresent(renderer);
    SDL_Delay(5000);

    /* Update screen second time and wait some more */
    SDL_RenderPresent(renderer);
SDL_Delay(5000);

    SDL_Quit();
    return 0;

}–
driedfruit

I’ve updated the patch to latest hg, but strangely it no longer fixes
the issue. Ugh, sorry! I’ll investigate further and report back.On Wed, 20 Jun 2012 11:42:42 -0400 Sam Lantinga wrote:

That patch doesn’t apply to SDL 2. Do you have a version that does?


driedfruit

I just reviewed the patch (http://bugzilla.libsdl.org/show_bug.cgi?id=1246) and
I believe it is correct.On Mon, Jun 18, 2012 at 8:27 PM, Driedfruit wrote:

Hello list!

Some time ago, I wrestled with an annoying issue of X / SDL threads
racing for opengl context.

http://lists.libsdl.org/pipermail/sdl-libsdl.org/2011-October/082598.html

The test case program is still giving the incorrect result for me.

I have found and tested a patch, that
a) fixes that problem
b) fixes ANOTHER bug, making SDL windows behave correctly in tiling
WMs.

http://bugzilla.libsdl.org/show_bug.cgi?id=1246

Unfortunately, Sam rejected that patch, because it was marked as SDL
1.2.

Let me assure you, it is more than relevant for SDL2 ! Please don’t let
this slip.

Test case:

#include “SDL.h”

int main(int argc, char* argv[])
{
SDL_Window* window;
SDL_Renderer* renderer;

   if (SDL_Init(SDL_INIT_VIDEO) < 0) return -1;

   window = SDL_CreateWindow("Empty Red Window",
                   SDL_WINDOWPOS_CENTERED,
                   SDL_WINDOWPOS_CENTERED,
                   512, 512,
                   SDL_WINDOW_SHOWN);

   renderer = SDL_CreateRenderer(window, -1, 0);

   /* Select red color and 'clear' with it */
   SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
   SDL_RenderClear(renderer);

   /* Update screen for the first time and wait */
   SDL_RenderPresent(renderer);
   SDL_Delay(5000);

   /* Update screen second time and wait some more */
   SDL_RenderPresent(renderer);
   SDL_Delay(5000);

   SDL_Quit();
   return 0;

}


driedfruit


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

That patch doesn’t apply to SDL 2. Do you have a version that does?

Thanks!On Mon, Jun 18, 2012 at 9:27 PM, Driedfruit wrote:

Hello list!

Some time ago, I wrestled with an annoying issue of X / SDL threads
racing for opengl context.

http://lists.libsdl.org/pipermail/sdl-libsdl.org/2011-October/082598.html

The test case program is still giving the incorrect result for me.

I have found and tested a patch, that
a) fixes that problem
b) fixes ANOTHER bug, making SDL windows behave correctly in tiling
WMs.

http://bugzilla.libsdl.org/show_bug.cgi?id=1246

Unfortunately, Sam rejected that patch, because it was marked as SDL
1.2.

Let me assure you, it is more than relevant for SDL2 ! Please don’t let
this slip.

Test case:

#include “SDL.h”

int main(int argc, char* argv[])
{
SDL_Window* window;
SDL_Renderer* renderer;

   if (SDL_Init(SDL_INIT_VIDEO) < 0) return -1;

   window = SDL_CreateWindow("Empty Red Window",
                   SDL_WINDOWPOS_CENTERED,
                   SDL_WINDOWPOS_CENTERED,
                   512, 512,
                   SDL_WINDOW_SHOWN);

   renderer = SDL_CreateRenderer(window, -1, 0);

   /* Select red color and 'clear' with it */
   SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
   SDL_RenderClear(renderer);

   /* Update screen for the first time and wait */
   SDL_RenderPresent(renderer);
   SDL_Delay(5000);

   /* Update screen second time and wait some more */
   SDL_RenderPresent(renderer);
   SDL_Delay(5000);

   SDL_Quit();
   return 0;

}


driedfruit


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Ok, it appears those two issues are not related after all.

Sorry for the confusion. We have 2 separate problems, one of which is
with tiling WMs, which patch in

http://bugzilla.libsdl.org/show_bug.cgi?id=1246

nicely fixes. I’ve uploaded a newer version there.

Meanwhile, the race condition problem remains. Not sure what to do
about that one, but I’ll keep looking.On Wed, 20 Jun 2012 03:43:19 +0400 Driedfruit <@Driedfruit> wrote:

I’ve updated the patch to latest hg, but strangely it no longer fixes
the issue. Ugh, sorry! I’ll investigate further and report back.

On Wed, 20 Jun 2012 11:42:42 -0400 Sam Lantinga wrote:

That patch doesn’t apply to SDL 2. Do you have a version that does?


driedfruit


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


driedfruit

Patrick, you are right. Thanks a lot! My test program finally shows
correct result. However, as the Expose event is only sent after the
window is Raised/Mapped, so patching CreateWindow proved futile and I
had to patch ShowWindow once again.

This makes me a little bit uneasy, but here’s what I ended up with:

diff -r eadb3790009f src/video/x11/SDL_x11window.c
— a/src/video/x11/SDL_x11window.c Thu Jun 21 14:01:47 2012
-0300
+++ b/src/video/x11/SDL_x11window.c Wed Jun 20 15:07:03 2012 +0400
@@ -765,6 +765,10 @@
XFlush(display);
}

+static Bool isExposeEvent(Display *dpy, XEvent *ev, XPointer win)
+{

  • return ev->type == Expose && ev->xexpose.window == ((Window)win);
    +}
    static Bool isMapNotify(Display *dpy, XEvent *ev, XPointer win)
    {
    return ev->type == MapNotify && ev->xmap.window == ((Window)win);
    @@ -786,6 +790,13 @@
    • We use XIfEvent because XWindowEvent takes a mask rather than a type,
    • and XCheckTypedWindowEvent doesn’t block */
      XIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow);+
      +#if SDL_VIDEO_OPENGL_GLX
  • if (window->flags & SDL_WINDOW_OPENGL) {
  •    XIfEvent(display, &event, &isExposeEvent, (XPointer)&data->xwindow);
    
  • }
    +#endif
  • XFlush(display);
    }

On Thu, 21 Jun 2012 09:28:43 -0500 Patrick Baggett <baggett.patrick at gmail.com> wrote:

Driedfruit,

I recall reading about GLX somewhere that drawing before the first
Expose event may or may not show up. You, too, found this out
http://lists.libsdl.org/pipermail/sdl-libsdl.org/2011-October/082602.html.
I bet the solution to your problem is to patch
SDL_x11window.c:X11_CreateWindow() to use XIfEvent() with a function
like:

static Bool isExposeEvent(Display *dpy, XEvent *ev, XPointer win) {

return ev->type == Expose && ev->xexpose.window ==

((Window)win);

}

If you have time to try it, I’d like to see what the results are.

Patrick


driedfruit

Patch applied to SDL 2.0

Thanks!On Tue, Jun 19, 2012 at 9:41 PM, Driedfruit wrote:

Ok, it appears those two issues are not related after all.

Sorry for the confusion. We have 2 separate problems, one of which is
with tiling WMs, which patch in

http://bugzilla.libsdl.org/show_bug.cgi?id=1246

nicely fixes. I’ve uploaded a newer version there.

Meanwhile, the race condition problem remains. Not sure what to do
about that one, but I’ll keep looking.

On Wed, 20 Jun 2012 03:43:19 +0400 Driedfruit wrote:

I’ve updated the patch to latest hg, but strangely it no longer fixes
the issue. Ugh, sorry! I’ll investigate further and report back.

On Wed, 20 Jun 2012 11:42:42 -0400 Sam Lantinga <@slouken> wrote:

That patch doesn’t apply to SDL 2. Do you have a version that does?


driedfruit


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


driedfruit


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Driedfruit,

I recall reading about GLX somewhere that drawing before the first Expose
event may or may not show up. You, too, found this out
http://lists.libsdl.org/pipermail/sdl-libsdl.org/2011-October/082602.html.
I bet the solution to your problem is to patch
SDL_x11window.c:X11_CreateWindow() to use XIfEvent() with a function like:

static Bool isExposeEvent(Display *dpy, XEvent *ev, XPointer win) {

return ev->type == Expose && ev->xexpose.window == *((Window*)win);

}

If you have time to try it, I’d like to see what the results are.

PatrickOn Tue, Jun 19, 2012 at 8:41 PM, Driedfruit wrote:

Ok, it appears those two issues are not related after all.

Sorry for the confusion. We have 2 separate problems, one of which is
with tiling WMs, which patch in

http://bugzilla.libsdl.org/show_bug.cgi?id=1246

nicely fixes. I’ve uploaded a newer version there.

Meanwhile, the race condition problem remains. Not sure what to do
about that one, but I’ll keep looking.

On Wed, 20 Jun 2012 03:43:19 +0400 Driedfruit wrote:

I’ve updated the patch to latest hg, but strangely it no longer fixes
the issue. Ugh, sorry! I’ll investigate further and report back.

On Wed, 20 Jun 2012 11:42:42 -0400 Sam Lantinga wrote:

That patch doesn’t apply to SDL 2. Do you have a version that does?


driedfruit


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


driedfruit


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Sorry to bother, but it looks like there’s one more related issue.

http://bugzilla.libsdl.org/show_bug.cgi?id=1526

Thanks to psychon for explaination.> you should use XWithdrawWindow() instead of XUnmapWindow()

(the former also sends a synthetic unmap notify to the root
window, needed for ICCCM compliance and to make this work if you
window isnt visible currently)

On Thu, 21 Jun 2012 09:58:45 -0400 Sam Lantinga wrote:

Patch applied to SDL 2.0

Thanks!

On Tue, Jun 19, 2012 at 9:41 PM, Driedfruit <@Driedfruit> wrote:


driedfruit