mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 09:01:46 +00:00
Added function for processing only pending events.
This commit is contained in:
parent
0e9e37bfc4
commit
e0c4d81e46
@ -135,11 +135,10 @@ size_t _glfwPlatformGetClipboardString(_GLFWwindow* window, char* data, size_t s
|
||||
_glfwLibrary.X11.selection.atom,
|
||||
_glfwLibrary.X11.selection.request,
|
||||
None, window->X11.handle, CurrentTime);
|
||||
XFlush(_glfwLibrary.X11.display);
|
||||
|
||||
// Process pending events until we get a SelectionNotify.
|
||||
while (!_glfwLibrary.X11.selection.converted)
|
||||
_glfwPlatformWaitEvents();
|
||||
// Process the resulting SelectionNotify event
|
||||
XSync(_glfwLibrary.X11.display, False);
|
||||
_glfwProcessPendingEvents();
|
||||
|
||||
// Successful?
|
||||
if (_glfwLibrary.X11.selection.converted == 1)
|
||||
|
@ -283,4 +283,7 @@ long _glfwKeySym2Unicode(KeySym keysym);
|
||||
// Clipboard handling
|
||||
Atom _glfwSelectionRequest(XSelectionRequestEvent *request);
|
||||
|
||||
// Event processing
|
||||
void _glfwProcessPendingEvents(void);
|
||||
|
||||
#endif // _platform_h_
|
||||
|
@ -1299,6 +1299,23 @@ 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 //////
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -1369,7 +1386,7 @@ int _glfwPlatformOpenWindow(_GLFWwindow* window,
|
||||
}
|
||||
|
||||
// Process the window map event and any other that may have arrived
|
||||
_glfwPlatformPollEvents();
|
||||
_glfwProcessPendingEvents();
|
||||
|
||||
// Retrieve and set initial cursor position
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user