comparison gtk/dw.c @ 1528:5facb5380944

Added dw_main_quit() function for exiting the dw_main() loop. Also some cleanups added to dw_exit() on OS/2 and Windows. Changed OS/2 to no longer destroy the message queue when leaving dw_main()... it should be done in dw_exit().
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 05 Jan 2012 15:45:11 +0000
parents ff78ae1d7429
children 282727422698
comparison
equal deleted inserted replaced
1527:9bab702bd6c1 1528:5facb5380944
2212 } 2212 }
2213 2213
2214 /* 2214 /*
2215 * Runs a message loop for Dynamic Windows. 2215 * Runs a message loop for Dynamic Windows.
2216 */ 2216 */
2217 void dw_main(void) 2217 void API dw_main(void)
2218 { 2218 {
2219 gdk_threads_enter(); 2219 gdk_threads_enter();
2220 _dw_thread = pthread_self(); 2220 _dw_thread = pthread_self();
2221 gtk_main(); 2221 gtk_main();
2222 _dw_thread = (pthread_t)-1; 2222 _dw_thread = (pthread_t)-1;
2223 gdk_threads_leave(); 2223 gdk_threads_leave();
2224 } 2224 }
2225 2225
2226 /* 2226 /*
2227 * Causes running dw_main() to return.
2228 */
2229 void API dw_main_quit(void)
2230 {
2231 gtk_main_quit();
2232 }
2233
2234 /*
2227 * Runs a message loop for Dynamic Windows, for a period of milliseconds. 2235 * Runs a message loop for Dynamic Windows, for a period of milliseconds.
2228 * Parameters: 2236 * Parameters:
2229 * milliseconds: Number of milliseconds to run the loop for. 2237 * milliseconds: Number of milliseconds to run the loop for.
2230 */ 2238 */
2231 void dw_main_sleep(int milliseconds) 2239 void API dw_main_sleep(int milliseconds)
2232 { 2240 {
2233 struct timeval tv, start; 2241 struct timeval tv, start;
2234 pthread_t curr = pthread_self(); 2242 pthread_t curr = pthread_self();
2235 2243
2236 gettimeofday(&start, NULL); 2244 gettimeofday(&start, NULL);
2276 } 2284 }
2277 2285
2278 /* 2286 /*
2279 * Processes a single message iteration and returns. 2287 * Processes a single message iteration and returns.
2280 */ 2288 */
2281 void dw_main_iteration(void) 2289 void API dw_main_iteration(void)
2282 { 2290 {
2283 pthread_t orig = _dw_thread; 2291 pthread_t orig = _dw_thread;
2284 pthread_t curr = pthread_self(); 2292 pthread_t curr = pthread_self();
2285 int _locked_by_me = FALSE; 2293 int _locked_by_me = FALSE;
2286 2294