diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-07-10 02:46:08 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-07-10 02:46:08 +0000 |
commit | 1edfe3fd473ebd336a8f9738d9199fd371245942 (patch) | |
tree | 0c0bd144ace4d31cf40a539dc93ac2cb9b3f4cbc /firmware/target/hosted/sdl/system-sdl.c | |
parent | 2f271ac54af1f481bd30b9d37240e52dc31c0c0e (diff) | |
download | rockbox-1edfe3fd473ebd336a8f9738d9199fd371245942.tar.gz rockbox-1edfe3fd473ebd336a8f9738d9199fd371245942.zip |
SDL enhancements:
- remove infinite loop after exit()
- make sure picture_surface is initialized, and free it
- split gui_message_loop() in 3 functions and change prototype
- some code is only used in simulator
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27366 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/hosted/sdl/system-sdl.c')
-rw-r--r-- | firmware/target/hosted/sdl/system-sdl.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/firmware/target/hosted/sdl/system-sdl.c b/firmware/target/hosted/sdl/system-sdl.c index ff4fe6570e..6937c373e3 100644 --- a/firmware/target/hosted/sdl/system-sdl.c +++ b/firmware/target/hosted/sdl/system-sdl.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <inttypes.h> | 26 | #include <inttypes.h> |
27 | #include "system.h" | 27 | #include "system.h" |
28 | #include "thread-sdl.h" | 28 | #include "thread-sdl.h" |
29 | #include "system-sdl.h" | ||
29 | #include "sim-ui-defines.h" | 30 | #include "sim-ui-defines.h" |
30 | #include "lcd-sdl.h" | 31 | #include "lcd-sdl.h" |
31 | #ifdef HAVE_LCD_BITMAP | 32 | #ifdef HAVE_LCD_BITMAP |
@@ -69,10 +70,6 @@ void sys_poweroff(void) | |||
69 | } | 70 | } |
70 | 71 | ||
71 | /* | 72 | /* |
72 | * Button read loop */ | ||
73 | bool gui_message_loop(void); | ||
74 | |||
75 | /* | ||
76 | * This thread will read the buttons in an interrupt like fashion, and | 73 | * This thread will read the buttons in an interrupt like fashion, and |
77 | * also initializes SDL_INIT_VIDEO and the surfaces | 74 | * also initializes SDL_INIT_VIDEO and the surfaces |
78 | * | 75 | * |
@@ -85,7 +82,7 @@ static int sdl_event_thread(void * param) | |||
85 | { | 82 | { |
86 | SDL_InitSubSystem(SDL_INIT_VIDEO); | 83 | SDL_InitSubSystem(SDL_INIT_VIDEO); |
87 | 84 | ||
88 | SDL_Surface *picture_surface; | 85 | SDL_Surface *picture_surface = NULL; |
89 | int width, height; | 86 | int width, height; |
90 | 87 | ||
91 | /* Try and load the background image. If it fails go without */ | 88 | /* Try and load the background image. If it fails go without */ |
@@ -134,7 +131,10 @@ static int sdl_event_thread(void * param) | |||
134 | 131 | ||
135 | /* | 132 | /* |
136 | * finally enter the button loop */ | 133 | * finally enter the button loop */ |
137 | while(gui_message_loop()); | 134 | gui_message_loop(); |
135 | |||
136 | if(picture_surface) | ||
137 | SDL_FreeSurface(picture_surface); | ||
138 | 138 | ||
139 | /* Order here is relevent to prevent deadlocks and use of destroyed | 139 | /* Order here is relevent to prevent deadlocks and use of destroyed |
140 | sync primitives by kernel threads */ | 140 | sync primitives by kernel threads */ |
@@ -151,7 +151,6 @@ void sim_do_exit(void) | |||
151 | 151 | ||
152 | SDL_Quit(); | 152 | SDL_Quit(); |
153 | exit(EXIT_SUCCESS); | 153 | exit(EXIT_SUCCESS); |
154 | while(1); | ||
155 | } | 154 | } |
156 | 155 | ||
157 | void system_init(void) | 156 | void system_init(void) |