comparison 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
comparison
equal deleted inserted replaced
1527:9bab702bd6c1 1528:5facb5380944
107 #ifdef AEROGLASS 107 #ifdef AEROGLASS
108 HRESULT (WINAPI *_DwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS *pMarInset) = 0; 108 HRESULT (WINAPI *_DwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS *pMarInset) = 0;
109 HRESULT (WINAPI *_DwmIsCompositionEnabled)(BOOL *pfEnabled) = 0; 109 HRESULT (WINAPI *_DwmIsCompositionEnabled)(BOOL *pfEnabled) = 0;
110 BOOL _dw_composition = FALSE; 110 BOOL _dw_composition = FALSE;
111 COLORREF _dw_transparencykey = RGB(200,201,202); 111 COLORREF _dw_transparencykey = RGB(200,201,202);
112 HANDLE hdwm = 0;
112 #endif 113 #endif
113 114
114 /* 115 /*
115 * MinGW Is missing a bunch of definitions 116 * MinGW Is missing a bunch of definitions
116 * so #define them here... 117 * so #define them here...
417 }; 418 };
418 419
419 /* Section for loading files of types besides BMP and ICO and return HBITMAP or HICON */ 420 /* Section for loading files of types besides BMP and ICO and return HBITMAP or HICON */
420 void *_dw_load_gpbitmap( char *filename ) 421 void *_dw_load_gpbitmap( char *filename )
421 { 422 {
422 int found_ext = 0,i, wclen = (strlen(filename) + 6) * sizeof(wchar_t); 423 int i, wclen = (strlen(filename) + 6) * sizeof(wchar_t);
423 char *file = _alloca(strlen(filename) + 6); 424 char *file = _alloca(strlen(filename) + 6);
424 wchar_t *wfile = _alloca(wclen); 425 wchar_t *wfile = _alloca(wclen);
425 void *image; 426 void *image;
426 427
427 /* Try various extentions */ 428 /* Try various extentions */
3518 INITCOMMONCONTROLSEX icc; 3519 INITCOMMONCONTROLSEX icc;
3519 char *alttmpdir; 3520 char *alttmpdir;
3520 #ifdef GDIPLUS 3521 #ifdef GDIPLUS
3521 struct GdiplusStartupInput si; 3522 struct GdiplusStartupInput si;
3522 #endif 3523 #endif
3523 #ifdef AEROGLASS
3524 HANDLE hdwm;
3525 #endif
3526 3524
3527 /* Setup the private data directory */ 3525 /* Setup the private data directory */
3528 if(argc > 0 && argv[0]) 3526 if(argc > 0 && argv[0])
3529 { 3527 {
3530 char *pos = strrchr(argv[0], '\\'); 3528 char *pos = strrchr(argv[0], '\\');
3707 3705
3708 #endif 3706 #endif
3709 return 0; 3707 return 0;
3710 } 3708 }
3711 3709
3710 static int _dw_main_running = FALSE;
3711
3712 /* 3712 /*
3713 * Runs a message loop for Dynamic Windows. 3713 * Runs a message loop for Dynamic Windows.
3714 */ 3714 */
3715 void API dw_main(void) 3715 void API dw_main(void)
3716 { 3716 {
3718 3718
3719 _dwtid = dw_thread_id(); 3719 _dwtid = dw_thread_id();
3720 /* Make sure any queued redraws are handled */ 3720 /* Make sure any queued redraws are handled */
3721 _dw_redraw(0, FALSE); 3721 _dw_redraw(0, FALSE);
3722 3722
3723 while(GetMessage(&msg, NULL, 0, 0)) 3723 /* Set the running flag to TRUE */
3724 _dw_main_running = TRUE;
3725
3726 /* Run the loop until the flag is unset... or error */
3727 while(_dw_main_running && GetMessage(&msg, NULL, 0, 0))
3724 { 3728 {
3725 if(msg.hwnd == NULL && msg.message == WM_TIMER) 3729 if(msg.hwnd == NULL && msg.message == WM_TIMER)
3726 _wndproc(msg.hwnd, msg.message, msg.wParam, msg.lParam); 3730 _wndproc(msg.hwnd, msg.message, msg.wParam, msg.lParam);
3727 else 3731 else
3728 { 3732 {
3729 TranslateMessage(&msg); 3733 TranslateMessage(&msg);
3730 DispatchMessage(&msg); 3734 DispatchMessage(&msg);
3731 } 3735 }
3732 } 3736 }
3737 }
3738
3739 /*
3740 * Causes running dw_main() to return.
3741 */
3742 void API dw_main_quit(void)
3743 {
3744 _dw_main_running = FALSE;
3733 } 3745 }
3734 3746
3735 /* 3747 /*
3736 * Runs a message loop for Dynamic Windows, for a period of milliseconds. 3748 * Runs a message loop for Dynamic Windows, for a period of milliseconds.
3737 * Parameters: 3749 * Parameters:
10272 * exitcode: Exit code reported to the operating system. 10284 * exitcode: Exit code reported to the operating system.
10273 */ 10285 */
10274 void API dw_exit(int exitcode) 10286 void API dw_exit(int exitcode)
10275 { 10287 {
10276 OleUninitialize(); 10288 OleUninitialize();
10289 #ifdef AEROGLASS
10290 /* Free any in use libraries */
10291 FreeLibrary(hdwm);
10292 #endif
10277 exit(exitcode); 10293 exit(exitcode);
10278 } 10294 }
10279 10295
10280 /* 10296 /*
10281 * Creates a splitbar window (widget) with given parameters. 10297 * Creates a splitbar window (widget) with given parameters.