Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Only map/unmap if the window isn't already in the correct state.
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Sep 28, 2012
1 parent 9d1a86b commit 77b81c1
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/video/x11/SDL_x11window.c
Expand Up @@ -809,12 +809,14 @@ X11_ShowWindow(_THIS, SDL_Window * window)
Display *display = data->videodata->display;
XEvent event;

XMapRaised(display, data->xwindow);
/* Blocking wait for "MapNotify" event.
* We use XIfEvent because XWindowEvent takes a mask rather than a type,
* and XCheckTypedWindowEvent doesn't block */
XIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow);
XFlush(display);
if (!X11_IsWindowMapped(_this, window)) {
XMapRaised(display, data->xwindow);
/* Blocking wait for "MapNotify" event.
* We use XIfEvent because XWindowEvent takes a mask rather than a type,
* and XCheckTypedWindowEvent doesn't block */
XIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow);
XFlush(display);
}
}

void
Expand All @@ -824,10 +826,12 @@ X11_HideWindow(_THIS, SDL_Window * window)
Display *display = data->videodata->display;
XEvent event;

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

void
Expand Down

0 comments on commit 77b81c1

Please sign in to comment.