Mercurial > dwindows
comparison os2/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 | 65861fedc4b4 |
children | 783a464afab2 |
comparison
equal
deleted
inserted
replaced
1527:9bab702bd6c1 | 1528:5facb5380944 |
---|---|
4013 if(!DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"PMMERGE", &pmmerge)) | 4013 if(!DosLoadModule((PSZ)objnamebuf, sizeof(objnamebuf), (PSZ)"PMMERGE", &pmmerge)) |
4014 DosQueryProcAddr(pmmerge, 5469, NULL, (PFN*)&_WinQueryDesktopWorkArea); | 4014 DosQueryProcAddr(pmmerge, 5469, NULL, (PFN*)&_WinQueryDesktopWorkArea); |
4015 return rc; | 4015 return rc; |
4016 } | 4016 } |
4017 | 4017 |
4018 static int _dw_main_running = FALSE; | |
4019 | |
4018 /* | 4020 /* |
4019 * Runs a message loop for Dynamic Windows. | 4021 * Runs a message loop for Dynamic Windows. |
4020 */ | 4022 */ |
4021 void API dw_main(void) | 4023 void API dw_main(void) |
4022 { | 4024 { |
4024 | 4026 |
4025 _dwtid = dw_thread_id(); | 4027 _dwtid = dw_thread_id(); |
4026 /* Make sure any queued redraws are handled */ | 4028 /* Make sure any queued redraws are handled */ |
4027 _dw_redraw(0, FALSE); | 4029 _dw_redraw(0, FALSE); |
4028 | 4030 |
4029 while(WinGetMsg(dwhab, &qmsg, 0, 0, 0)) | 4031 /* Set the running flag to TRUE */ |
4032 _dw_main_running = TRUE; | |
4033 | |
4034 /* Run the loop until the flag is unset... or error */ | |
4035 while(_dw_main_running && WinGetMsg(dwhab, &qmsg, 0, 0, 0)) | |
4030 { | 4036 { |
4031 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) | 4037 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) |
4032 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); | 4038 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); |
4033 WinDispatchMsg(dwhab, &qmsg); | 4039 WinDispatchMsg(dwhab, &qmsg); |
4034 } | 4040 } |
4035 | 4041 } |
4036 WinDestroyMsgQueue(dwhmq); | 4042 |
4037 WinTerminate(dwhab); | 4043 /* |
4044 * Causes running dw_main() to return. | |
4045 */ | |
4046 void API dw_main_quit(void) | |
4047 { | |
4048 _dw_main_running = FALSE; | |
4038 } | 4049 } |
4039 | 4050 |
4040 /* | 4051 /* |
4041 * Runs a message loop for Dynamic Windows, for a period of milliseconds. | 4052 * Runs a message loop for Dynamic Windows, for a period of milliseconds. |
4042 * Parameters: | 4053 * Parameters: |
10519 * try to free memory that could possibly be | 10530 * try to free memory that could possibly be |
10520 * free()'d by the runtime already. | 10531 * free()'d by the runtime already. |
10521 */ | 10532 */ |
10522 Root = NULL; | 10533 Root = NULL; |
10523 | 10534 |
10535 /* Destroy the main message queue and anchor block */ | |
10536 WinDestroyMsgQueue(dwhmq); | |
10537 WinTerminate(dwhab); | |
10538 | |
10539 /* Free any in use modules */ | |
10524 DosFreeModule(wpconfig); | 10540 DosFreeModule(wpconfig); |
10541 DosFreeModule(pmprintf); | |
10542 DosFreeModule(pmmerge); | |
10543 | |
10544 /* And finally exit */ | |
10525 exit(exitcode); | 10545 exit(exitcode); |
10526 } | 10546 } |
10527 | 10547 |
10528 /* | 10548 /* |
10529 * Creates a splitbar window (widget) with given parameters. | 10549 * Creates a splitbar window (widget) with given parameters. |