From 99031a43a208b4606977edcf0095725a6027b72f Mon Sep 17 00:00:00 2001 From: Riku Salminen Date: Mon, 6 Aug 2012 21:24:53 +0300 Subject: [PATCH] X11: remove _glfwProcessPendingEvents Remove _glfwProcessPendingEvents, do not call event handlers from glfwCreateWindow. It is dangerous. Do not wait for MapNotify event in glfwCreateWindow under X11. --- src/x11_window.c | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/src/x11_window.c b/src/x11_window.c index cb0d5bcb..e90790f7 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -43,16 +43,6 @@ #define Button6 6 #define Button7 7 -//======================================================================== -// Checks whether the event is a MapNotify for the specified window -//======================================================================== - -static Bool isMapNotify(Display* d, XEvent* e, char* arg) -{ - return (e->type == MapNotify) && (e->xmap.window == (Window)arg); -} - - //======================================================================== // Translates an X Window key to internal coding //======================================================================== @@ -94,7 +84,6 @@ static int translateChar(XKeyEvent* event) static GLboolean createWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig) { - XEvent event; unsigned long wamask; XSetWindowAttributes wa; XVisualInfo* visual = _glfwGetContextVisual(window); @@ -243,8 +232,7 @@ static GLboolean createWindow(_GLFWwindow* window, // Make sure the window is mapped before proceeding XMapWindow(_glfwLibrary.X11.display, window->X11.handle); - XPeekIfEvent(_glfwLibrary.X11.display, &event, isMapNotify, - (char*) window->X11.handle); + XFlush(_glfwLibrary.X11.display); return GL_TRUE; } @@ -887,24 +875,6 @@ static void processSingleEvent(void) } } - -////////////////////////////////////////////////////////////////////////// -////// GLFW internal API ////// -////////////////////////////////////////////////////////////////////////// - -//======================================================================== -// Processes all pending events -//======================================================================== - -void _glfwProcessPendingEvents(void) -{ - int i, count = XPending(_glfwLibrary.X11.display); - - for (i = 0; i < count; i++) - processSingleEvent(); -} - - ////////////////////////////////////////////////////////////////////////// ////// GLFW platform API ////// ////////////////////////////////////////////////////////////////////////// @@ -942,9 +912,6 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, enterFullscreenMode(window); } - // Process the window map event and any other that may have arrived - _glfwProcessPendingEvents(); - // Retrieve and set initial cursor position { Window cursorWindow, cursorRoot;