diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-05-17 17:19:31 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-05-17 17:19:31 +0000 |
commit | c4c7069a8a0b4ffc5de8758c2aa154118449aa62 (patch) | |
tree | 9a330d88b3e3d40dbdcfbdddd0f85aa409a77cbf /firmware/target/hosted/sdl/button-sdl.c | |
parent | f4d6ef2292c6a2b482af106e7d73588f65845e94 (diff) | |
download | rockbox-c4c7069a8a0b4ffc5de8758c2aa154118449aa62.tar.gz rockbox-c4c7069a8a0b4ffc5de8758c2aa154118449aa62.zip |
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
Diffstat (limited to 'firmware/target/hosted/sdl/button-sdl.c')
-rw-r--r-- | firmware/target/hosted/sdl/button-sdl.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/firmware/target/hosted/sdl/button-sdl.c b/firmware/target/hosted/sdl/button-sdl.c index cfe08de1d2..e9fc03792c 100644 --- a/firmware/target/hosted/sdl/button-sdl.c +++ b/firmware/target/hosted/sdl/button-sdl.c | |||
@@ -85,20 +85,21 @@ bool remote_button_hold(void) { | |||
85 | static void button_event(int key, bool pressed); | 85 | static void button_event(int key, bool pressed); |
86 | extern bool debug_wps; | 86 | extern bool debug_wps; |
87 | extern bool mapping; | 87 | extern bool mapping; |
88 | static void gui_message_loop(void) | 88 | |
89 | void gui_message_loop(void) | ||
89 | { | 90 | { |
90 | SDL_Event event; | 91 | SDL_Event event; |
91 | static int x,y,xybutton = 0; | 92 | static int x,y,xybutton = 0; |
92 | 93 | ||
93 | if (SDL_PollEvent(&event)) | 94 | while (SDL_WaitEvent(&event)) |
94 | { | 95 | { |
96 | sim_enter_irq_handler(); | ||
95 | switch(event.type) | 97 | switch(event.type) |
96 | { | 98 | { |
97 | case SDL_KEYDOWN: | 99 | case SDL_KEYDOWN: |
98 | button_event(event.key.keysym.sym, true); | ||
99 | break; | ||
100 | case SDL_KEYUP: | 100 | case SDL_KEYUP: |
101 | button_event(event.key.keysym.sym, false); | 101 | button_event(event.key.keysym.sym, event.type == SDL_KEYDOWN); |
102 | break; | ||
102 | case SDL_MOUSEBUTTONDOWN: | 103 | case SDL_MOUSEBUTTONDOWN: |
103 | switch ( event.button.button ) { | 104 | switch ( event.button.button ) { |
104 | #ifdef HAVE_SCROLLWHEEL | 105 | #ifdef HAVE_SCROLLWHEEL |
@@ -174,6 +175,7 @@ static void gui_message_loop(void) | |||
174 | 175 | ||
175 | case SDL_QUIT: | 176 | case SDL_QUIT: |
176 | { | 177 | { |
178 | sim_exit_irq_handler(); | ||
177 | exit(EXIT_SUCCESS); | 179 | exit(EXIT_SUCCESS); |
178 | break; | 180 | break; |
179 | } | 181 | } |
@@ -181,6 +183,7 @@ static void gui_message_loop(void) | |||
181 | /*printf("Unhandled event\n"); */ | 183 | /*printf("Unhandled event\n"); */ |
182 | break; | 184 | break; |
183 | } | 185 | } |
186 | sim_exit_irq_handler(); | ||
184 | } | 187 | } |
185 | } | 188 | } |
186 | 189 | ||
@@ -1502,7 +1505,6 @@ int button_read_device(void) | |||
1502 | return BUTTON_NONE; | 1505 | return BUTTON_NONE; |
1503 | else | 1506 | else |
1504 | #endif | 1507 | #endif |
1505 | gui_message_loop(); | ||
1506 | 1508 | ||
1507 | return btn; | 1509 | return btn; |
1508 | } | 1510 | } |