Mercurial > dwindows
diff win/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 | 9834570c8761 |
children | 783a464afab2 |
line wrap: on
line diff
--- a/win/dw.c Tue Jan 03 15:59:00 2012 +0000 +++ b/win/dw.c Thu Jan 05 15:45:11 2012 +0000 @@ -109,6 +109,7 @@ HRESULT (WINAPI *_DwmIsCompositionEnabled)(BOOL *pfEnabled) = 0; BOOL _dw_composition = FALSE; COLORREF _dw_transparencykey = RGB(200,201,202); +HANDLE hdwm = 0; #endif /* @@ -419,7 +420,7 @@ /* Section for loading files of types besides BMP and ICO and return HBITMAP or HICON */ void *_dw_load_gpbitmap( char *filename ) { - int found_ext = 0,i, wclen = (strlen(filename) + 6) * sizeof(wchar_t); + int i, wclen = (strlen(filename) + 6) * sizeof(wchar_t); char *file = _alloca(strlen(filename) + 6); wchar_t *wfile = _alloca(wclen); void *image; @@ -3520,9 +3521,6 @@ #ifdef GDIPLUS struct GdiplusStartupInput si; #endif -#ifdef AEROGLASS - HANDLE hdwm; -#endif /* Setup the private data directory */ if(argc > 0 && argv[0]) @@ -3709,6 +3707,8 @@ return 0; } +static int _dw_main_running = FALSE; + /* * Runs a message loop for Dynamic Windows. */ @@ -3720,7 +3720,11 @@ /* Make sure any queued redraws are handled */ _dw_redraw(0, FALSE); - while(GetMessage(&msg, NULL, 0, 0)) + /* Set the running flag to TRUE */ + _dw_main_running = TRUE; + + /* Run the loop until the flag is unset... or error */ + while(_dw_main_running && GetMessage(&msg, NULL, 0, 0)) { if(msg.hwnd == NULL && msg.message == WM_TIMER) _wndproc(msg.hwnd, msg.message, msg.wParam, msg.lParam); @@ -3733,6 +3737,14 @@ } /* + * Causes running dw_main() to return. + */ +void API dw_main_quit(void) +{ + _dw_main_running = FALSE; +} + +/* * Runs a message loop for Dynamic Windows, for a period of milliseconds. * Parameters: * milliseconds: Number of milliseconds to run the loop for. @@ -10274,6 +10286,10 @@ void API dw_exit(int exitcode) { OleUninitialize(); +#ifdef AEROGLASS + /* Free any in use libraries */ + FreeLibrary(hdwm); +#endif exit(exitcode); }