comparison win/dw.c @ 200:446dd8cea477

Removed window parameter on Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 20 Jan 2003 20:27:51 +0000
parents f3718165f0b2
children ae28c5f2fe0e
comparison
equal deleted inserted replaced
199:b955228477b3 200:446dd8cea477
2954 2954
2955 _dwtid = dw_thread_id(); 2955 _dwtid = dw_thread_id();
2956 2956
2957 while (GetMessage(&msg, NULL, 0, 0)) 2957 while (GetMessage(&msg, NULL, 0, 0))
2958 { 2958 {
2959 if(msg.hwnd == NULL && msg.message == WM_TIMER)
2960 _wndproc(msg.hwnd, msg.message, msg.wParam, msg.lParam);
2959 TranslateMessage(&msg); 2961 TranslateMessage(&msg);
2960 DispatchMessage(&msg); 2962 DispatchMessage(&msg);
2961 } 2963 }
2962 } 2964 }
2963 2965
2974 while(((clock() - start) / (CLOCKS_PER_SEC/1000)) <= milliseconds) 2976 while(((clock() - start) / (CLOCKS_PER_SEC/1000)) <= milliseconds)
2975 { 2977 {
2976 if(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) 2978 if(PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE))
2977 { 2979 {
2978 GetMessage(&msg, NULL, 0, 0); 2980 GetMessage(&msg, NULL, 0, 0);
2981 if(msg.hwnd == NULL && msg.message == WM_TIMER)
2982 _wndproc(msg.hwnd, msg.message, msg.wParam, msg.lParam);
2979 TranslateMessage(&msg); 2983 TranslateMessage(&msg);
2980 DispatchMessage(&msg); 2984 DispatchMessage(&msg);
2981 } 2985 }
2982 else 2986 else
2983 Sleep(1); 2987 Sleep(1);
3039 MSG msg; 3043 MSG msg;
3040 void *tmp; 3044 void *tmp;
3041 3045
3042 while (GetMessage(&msg,NULL,0,0)) 3046 while (GetMessage(&msg,NULL,0,0))
3043 { 3047 {
3048 if(msg.hwnd == NULL && msg.message == WM_TIMER)
3049 _wndproc(msg.hwnd, msg.message, msg.wParam, msg.lParam);
3044 TranslateMessage(&msg); 3050 TranslateMessage(&msg);
3045 DispatchMessage(&msg); 3051 DispatchMessage(&msg);
3046 if(dialog->done) 3052 if(dialog->done)
3047 break; 3053 break;
3048 } 3054 }
7387 * sigfunc: The pointer to the function to be used as the callback. 7393 * sigfunc: The pointer to the function to be used as the callback.
7388 * data: User data to be passed to the handler function. 7394 * data: User data to be passed to the handler function.
7389 * Returns: 7395 * Returns:
7390 * Timer ID for use with dw_timer_disconnect(), 0 on error. 7396 * Timer ID for use with dw_timer_disconnect(), 0 on error.
7391 */ 7397 */
7392 int API dw_timer_connect(HWND window, int interval, void *sigfunc, void *data) 7398 int API dw_timer_connect(int interval, void *sigfunc, void *data)
7393 { 7399 {
7394 static int timerid = 0; 7400 if(sigfunc)
7395 7401 {
7396 if(window && sigfunc) 7402 int timerid = SetTimer(NULL, 0, interval, NULL);
7397 { 7403
7398 timerid++; 7404 if(timerid)
7399 7405 {
7400 if(timerid < 1) 7406 _new_signal(WM_TIMER, NULL, timerid, sigfunc, data);
7401 timerid = 1; 7407 return timerid;
7402 7408 }
7403 _new_signal(WM_TIMER, window, timerid, sigfunc, data);
7404 return SetTimer(window, timerid, interval, NULL);
7405 } 7409 }
7406 return 0; 7410 return 0;
7407 } 7411 }
7408 7412
7409 /* 7413 /*
7417 7421
7418 /* 0 is an invalid timer ID */ 7422 /* 0 is an invalid timer ID */
7419 if(!id) 7423 if(!id)
7420 return; 7424 return;
7421 7425
7426 KillTimer(NULL, id);
7427
7422 while(tmp) 7428 while(tmp)
7423 { 7429 {
7424 if(tmp->id == id) 7430 if(tmp->id == id)
7425 { 7431 {
7426 KillTimer(tmp->window, id);
7427 if(prev) 7432 if(prev)
7428 { 7433 {
7429 prev->next = tmp->next; 7434 prev->next = tmp->next;
7430 free(tmp); 7435 free(tmp);
7431 tmp = prev->next; 7436 tmp = prev->next;