mirror of
https://github.com/brl/mutter.git
synced 2025-01-23 01:48:55 +00:00
sdl: Wakeup the event blocking immediately if necessary
It is expected that cogl_sdl_idle() will be called from the application immediately before blocking in SDL_WaitEvent. However, dispatching the onscreen events may cause more events to be queued. If that happens we need to make sure the blocking returns immediately. This patch makes it post the dummy event that the application chose in order to make that happen. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 9e34a1e8ce97b67ebb2889c622f2c9f1076b087d)
This commit is contained in:
parent
f8108751a5
commit
446dd70b91
@ -3,7 +3,7 @@
|
||||
*
|
||||
* An object oriented GL/GLES Abstraction/Utility Layer
|
||||
*
|
||||
* Copyright (C) 2012 Intel Corporation.
|
||||
* Copyright (C) 2012, 2013 Intel Corporation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -80,8 +80,27 @@ cogl_sdl_handle_event (CoglContext *context, SDL_Event *event)
|
||||
winsys->poll_dispatch (context, NULL, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
_cogl_sdl_push_wakeup_event (CoglContext *context)
|
||||
{
|
||||
SDL_Event wakeup_event;
|
||||
|
||||
wakeup_event.type = context->display->renderer->sdl_event_type;
|
||||
|
||||
SDL_PushEvent (&wakeup_event);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_sdl_idle (CoglContext *context)
|
||||
{
|
||||
_cogl_dispatch_onscreen_events (context);
|
||||
|
||||
/* It is expected that this will be called from the application
|
||||
* immediately before blocking in SDL_WaitEvent. However,
|
||||
* dispatching the onscreen events may cause more events to be
|
||||
* queued. If that happens we need to make sure the blocking returns
|
||||
* immediately. We'll post our dummy event to make sure that
|
||||
* happens */
|
||||
if (!COGL_TAILQ_EMPTY (&context->onscreen_events_queue))
|
||||
_cogl_sdl_push_wakeup_event (context);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user