Mercurial > dwindows
comparison os2/dw.c @ 199:b955228477b3
Removed the window parameter to dw_timer_connect() it was no needed.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 20 Jan 2003 20:21:06 +0000 |
parents | b023d363fc09 |
children | e0beea487e8f |
comparison
equal
deleted
inserted
replaced
198:11b5da6196c2 | 199:b955228477b3 |
---|---|
3035 { | 3035 { |
3036 QMSG qmsg; | 3036 QMSG qmsg; |
3037 | 3037 |
3038 _dwtid = dw_thread_id(); | 3038 _dwtid = dw_thread_id(); |
3039 | 3039 |
3040 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0)) | 3040 while(WinGetMsg(dwhab, &qmsg, 0, 0, 0)) |
3041 { | |
3042 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) | |
3043 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); | |
3041 WinDispatchMsg(dwhab, &qmsg); | 3044 WinDispatchMsg(dwhab, &qmsg); |
3045 } | |
3042 | 3046 |
3043 WinDestroyMsgQueue(dwhmq); | 3047 WinDestroyMsgQueue(dwhmq); |
3044 WinTerminate(dwhab); | 3048 WinTerminate(dwhab); |
3045 } | 3049 } |
3046 | 3050 |
3057 while(((clock() - start) / (CLOCKS_PER_SEC/1000)) <= milliseconds) | 3061 while(((clock() - start) / (CLOCKS_PER_SEC/1000)) <= milliseconds) |
3058 { | 3062 { |
3059 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE)) | 3063 if(WinPeekMsg(dwhab, &qmsg, 0, 0, 0, PM_NOREMOVE)) |
3060 { | 3064 { |
3061 WinGetMsg(dwhab, &qmsg, 0, 0, 0); | 3065 WinGetMsg(dwhab, &qmsg, 0, 0, 0); |
3066 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) | |
3067 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); | |
3062 WinDispatchMsg(dwhab, &qmsg); | 3068 WinDispatchMsg(dwhab, &qmsg); |
3063 } | 3069 } |
3064 else | 3070 else |
3065 DosSleep(1); | 3071 DosSleep(1); |
3066 } | 3072 } |
3121 QMSG qmsg; | 3127 QMSG qmsg; |
3122 void *tmp; | 3128 void *tmp; |
3123 | 3129 |
3124 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0)) | 3130 while (WinGetMsg(dwhab, &qmsg, 0, 0, 0)) |
3125 { | 3131 { |
3132 if(qmsg.msg == WM_TIMER && qmsg.hwnd == NULLHANDLE) | |
3133 _run_event(qmsg.hwnd, qmsg.msg, qmsg.mp1, qmsg.mp2); | |
3126 WinDispatchMsg(dwhab, &qmsg); | 3134 WinDispatchMsg(dwhab, &qmsg); |
3127 if(dialog->done) | 3135 if(dialog->done) |
3128 break; | 3136 break; |
3129 } | 3137 } |
3130 dw_event_close(&dialog->eve); | 3138 dw_event_close(&dialog->eve); |
7636 } | 7644 } |
7637 | 7645 |
7638 /* | 7646 /* |
7639 * Add a callback to a timer event. | 7647 * Add a callback to a timer event. |
7640 * Parameters: | 7648 * Parameters: |
7641 * window: Window handle which owns this timer. | |
7642 * interval: Milliseconds to delay between calls. | 7649 * interval: Milliseconds to delay between calls. |
7643 * sigfunc: The pointer to the function to be used as the callback. | 7650 * sigfunc: The pointer to the function to be used as the callback. |
7644 * data: User data to be passed to the handler function. | 7651 * data: User data to be passed to the handler function. |
7645 * Returns: | 7652 * Returns: |
7646 * Timer ID for use with dw_timer_disconnect(), 0 on error. | 7653 * Timer ID for use with dw_timer_disconnect(), 0 on error. |
7647 */ | 7654 */ |
7648 int API dw_timer_connect(HWND window, int interval, void *sigfunc, void *data) | 7655 int API dw_timer_connect(int interval, void *sigfunc, void *data) |
7649 { | 7656 { |
7650 static int timerid = 0; | 7657 if(sigfunc) |
7651 | 7658 { |
7652 if(window && sigfunc) | 7659 int timerid = WinStartTimer(dwhab, NULLHANDLE, timerid, interval); |
7653 { | 7660 |
7654 timerid++; | 7661 if(timerid) |
7655 | 7662 { |
7656 if(timerid >= TID_USERMAX) | 7663 _new_signal(WM_TIMER, NULLHANDLE, timerid, sigfunc, data); |
7657 timerid = 1; | 7664 return timerid; |
7658 | 7665 } |
7659 _new_signal(WM_TIMER, window, timerid, sigfunc, data); | |
7660 return WinStartTimer(dwhab, window, timerid, interval); | |
7661 } | 7666 } |
7662 return 0; | 7667 return 0; |
7663 } | 7668 } |
7664 | 7669 |
7665 /* | 7670 /* |
7673 | 7678 |
7674 /* 0 is an invalid timer ID */ | 7679 /* 0 is an invalid timer ID */ |
7675 if(!id) | 7680 if(!id) |
7676 return; | 7681 return; |
7677 | 7682 |
7683 WinStopTimer(dwhab, NULLHANDLE, id); | |
7684 | |
7678 while(tmp) | 7685 while(tmp) |
7679 { | 7686 { |
7680 if(tmp->id == id) | 7687 if(tmp->id == id) |
7681 { | 7688 { |
7682 WinStopTimer(dwhab, tmp->window, id); | |
7683 if(prev) | 7689 if(prev) |
7684 { | 7690 { |
7685 prev->next = tmp->next; | 7691 prev->next = tmp->next; |
7686 free(tmp); | 7692 free(tmp); |
7687 tmp = prev->next; | 7693 tmp = prev->next; |