forked from len0rd/rockbox
Fix FS#11280
SDL docs say SDL_PumpEvent (implicitely called by SDL_Poll/WaitEvent) may only be called from the thread that initializes the video subsystem, apparently because Windows requires that. So create an (or bring it back) SDL thread (with preemtive behavior) to read the event queue for buttons and initialize the video subsystem. I'd probably would have done that anyway because it enables an interrupt-like method to read them (no polling). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26113 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f4d6ef2292
commit
c4c7069a8a
3 changed files with 73 additions and 13 deletions
|
|
@ -85,20 +85,21 @@ bool remote_button_hold(void) {
|
|||
static void button_event(int key, bool pressed);
|
||||
extern bool debug_wps;
|
||||
extern bool mapping;
|
||||
static void gui_message_loop(void)
|
||||
|
||||
void gui_message_loop(void)
|
||||
{
|
||||
SDL_Event event;
|
||||
static int x,y,xybutton = 0;
|
||||
|
||||
if (SDL_PollEvent(&event))
|
||||
while (SDL_WaitEvent(&event))
|
||||
{
|
||||
sim_enter_irq_handler();
|
||||
switch(event.type)
|
||||
{
|
||||
case SDL_KEYDOWN:
|
||||
button_event(event.key.keysym.sym, true);
|
||||
break;
|
||||
case SDL_KEYUP:
|
||||
button_event(event.key.keysym.sym, false);
|
||||
button_event(event.key.keysym.sym, event.type == SDL_KEYDOWN);
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
switch ( event.button.button ) {
|
||||
#ifdef HAVE_SCROLLWHEEL
|
||||
|
|
@ -174,6 +175,7 @@ static void gui_message_loop(void)
|
|||
|
||||
case SDL_QUIT:
|
||||
{
|
||||
sim_exit_irq_handler();
|
||||
exit(EXIT_SUCCESS);
|
||||
break;
|
||||
}
|
||||
|
|
@ -181,6 +183,7 @@ static void gui_message_loop(void)
|
|||
/*printf("Unhandled event\n"); */
|
||||
break;
|
||||
}
|
||||
sim_exit_irq_handler();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1502,7 +1505,6 @@ int button_read_device(void)
|
|||
return BUTTON_NONE;
|
||||
else
|
||||
#endif
|
||||
gui_message_loop();
|
||||
|
||||
return btn;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue