Changeset 10104
- Timestamp:
- May 16, 2003, 12:59:28 PM (22 years ago)
- Location:
- trunk/src/user32
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/user32/oslibmsg.cpp ¶
r10012 r10104 1 /* $Id: oslibmsg.cpp,v 1.6 8 2003-04-11 14:22:05sandervl Exp $ */1 /* $Id: oslibmsg.cpp,v 1.69 2003-05-16 10:59:26 sandervl Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 324 324 { 325 325 filtermin = TranslateWinMsg(uMsgFilterMin, TRUE); 326 filtermax = TranslateWinMsg(uMsgFilterMax, FALSE); 327 if(filtermin > filtermax) { 328 ULONG tmp = filtermin; 329 filtermin = filtermax; 330 filtermax = filtermin; 331 } 332 do { 333 eaten = FALSE; 334 rc = WinGetMsg(teb->o.odin.hab, &os2msg, 0, filtermin, filtermax); 335 if (os2msg.msg == WM_TIMER) 336 eaten = TIMER_HandleTimer(&os2msg); 337 if (os2msg.msg == WM_QUIT && ((ULONG)os2msg.mp2 != 0) ) { 338 // Don't return FALSE when the window list sends us 339 // a WM_QUIT message, improper killing can lead to 340 // application crashes. 341 // In the WM_QUIT handler in pmwindow we send a WM_CLOSE 342 // in this case. When the app calls PostQuitMessage (mp2 == 0), 343 // then we handle it the normal way 344 rc = 1; 345 } 346 } 347 while (eaten); 326 filtermax = TranslateWinMsg(uMsgFilterMax, FALSE); 327 if(filtermin > filtermax) { 328 ULONG tmp = filtermin; 329 filtermin = filtermax; 330 filtermax = filtermin; 331 } 332 rc = WinGetMsg(teb->o.odin.hab, &os2msg, 0, filtermin, filtermax); 333 if (os2msg.msg == WM_QUIT && ((ULONG)os2msg.mp2 != 0) ) { 334 // Don't return FALSE when the window list sends us 335 // a WM_QUIT message, improper killing can lead to 336 // application crashes. 337 // In the WM_QUIT handler in pmwindow we send a WM_CLOSE 338 // in this case. When the app calls PostQuitMessage (mp2 == 0), 339 // then we handle it the normal way 340 rc = 1; 341 } 348 342 } 349 343 if(OS2ToWinMsgTranslate((PVOID)teb, &os2msg, pMsg, isUnicode, MSG_REMOVE) == FALSE) { … … 483 477 if(ulPMFilter) { 484 478 do { 485 eaten = FALSE;486 487 479 rc = WinPeekMsg(teb->o.odin.hab, &os2msg, hwndOS2, ulPMFilter, ulPMFilter, 488 480 (fRemove & PM_REMOVE_W) ? PM_REMOVE : PM_NOREMOVE); … … 492 484 rc = 0; 493 485 } 494 if (rc && (fRemove & PM_REMOVE_W) && os2msg.msg == WM_TIMER) {495 eaten = TIMER_HandleTimer(&os2msg);496 }497 486 } 498 while ( eaten &&rc);487 while (rc); 499 488 } 500 489 if(rc) { … … 504 493 } 505 494 else { 506 do { 507 eaten = FALSE; 508 509 rc = WinPeekMsg(teb->o.odin.hab, &os2msg, hwndOS2, 0, 0, (fRemove & PM_REMOVE_W) ? PM_REMOVE : PM_NOREMOVE); 510 511 if (rc && (fRemove & PM_REMOVE_W) && os2msg.msg == WM_TIMER) { 512 eaten = TIMER_HandleTimer(&os2msg); 513 } 514 } 515 while (eaten && rc); 495 rc = WinPeekMsg(teb->o.odin.hab, &os2msg, hwndOS2, 0, 0, (fRemove & PM_REMOVE_W) ? PM_REMOVE : PM_NOREMOVE); 516 496 } 517 497 if(rc == FALSE) { -
TabularUnified trunk/src/user32/oslibmsgtranslate.cpp ¶
r10017 r10104 1 /* $Id: oslibmsgtranslate.cpp,v 1.1 09 2003-04-11 17:26:11sandervl Exp $ */1 /* $Id: oslibmsgtranslate.cpp,v 1.110 2003-05-16 10:59:27 sandervl Exp $ */ 2 2 /* 3 3 * Window message translation functions for OS/2 … … 929 929 // { 930 930 BOOL sys; 931 ULONG id ;932 933 if (TIMER_GetTimerInfo(os2Msg->hwnd,(ULONG)os2Msg->mp1,&sys,&id ))931 ULONG id, proc; 932 933 if (TIMER_GetTimerInfo(os2Msg->hwnd,(ULONG)os2Msg->mp1,&sys,&id, &proc)) 934 934 { 935 935 winMsg->wParam = (WPARAM)id; 936 winMsg->lParam = (LPARAM)proc; 936 937 winMsg->message= (sys) ? WINWM_SYSTIMER : WINWM_TIMER; 937 938 break; -
TabularUnified trunk/src/user32/timer.cpp ¶
r10102 r10104 1 /* $Id: timer.cpp,v 1.1 5 2003-05-16 09:21:00sandervl Exp $ */1 /* $Id: timer.cpp,v 1.16 2003-05-16 10:59:27 sandervl Exp $ */ 2 2 3 3 /* … … 32 32 #endif 33 33 34 #define WM_TIMER_W 0x011335 #define WM_SYSTIMER_W 0x011836 typedef VOID (CALLBACK *TIMERPROC)(HWND hwnd, UINT msg, UINT id, DWORD dwTime);37 38 34 typedef struct tagTIMER 39 35 { … … 68 64 } 69 65 70 BOOL TIMER_GetTimerInfo(HWND PMhwnd,ULONG PMid,PBOOL sys,PULONG id )66 BOOL TIMER_GetTimerInfo(HWND PMhwnd,ULONG PMid,PBOOL sys,PULONG id, PULONG proc) 71 67 { 72 68 int i; 73 69 TIMER *pTimer; 74 70 71 EnterCriticalSection (); 75 72 for (i = 0, pTimer = TimersArray; i < NB_TIMERS; i++, pTimer++) 76 73 if (pTimer->inUse && (pTimer->PMhwnd == PMhwnd) && (pTimer->PMid == PMid)) 77 74 break; 75 LeaveCriticalSection(); 78 76 79 77 if (i == NB_TIMERS) /* no matching timer found */ … … 82 80 *sys = pTimer->inUse == TIMER::SystemTimer; 83 81 *id = pTimer->id; 82 *proc = (ULONG)pTimer->proc; 84 83 85 84 return TRUE; 86 85 } 86 87 /*********************************************************************** 88 * TIMER_IsTimerValid 89 */ 90 BOOL TIMER_IsTimerValid( HWND hwnd, UINT id, ULONG proc ) 91 { 92 int i; 93 TIMER *pTimer; 94 BOOL ret = FALSE; 95 96 EnterCriticalSection (); 97 98 for (i = 0, pTimer = TimersArray; i < NB_TIMERS; i++, pTimer++) 99 if ((pTimer->hwnd == hwnd) && (pTimer->id == id) && (pTimer->proc == (TIMERPROC)proc)) 100 { 101 ret = TRUE; 102 break; 103 } 104 105 LeaveCriticalSection(); 106 return ret; 107 } 108 87 109 88 110 BOOL TIMER_HandleTimer (PQMSG pMsg) … … 93 115 ULONG PMid = (ULONG)(pMsg->mp1); 94 116 117 EnterCriticalSection (); 95 118 for (i = 0, pTimer = TimersArray; i < NB_TIMERS; i++, pTimer++) 96 119 if (pTimer->inUse && (pTimer->PMhwnd == PMhwnd) && (pTimer->PMid == PMid)) 97 120 break; 121 LeaveCriticalSection(); 98 122 99 123 if (i == NB_TIMERS) /* no matching timer found */ -
TabularUnified trunk/src/user32/timer.h ¶
r2469 r10104 1 /* $Id: timer.h,v 1. 5 2000-01-18 20:08:14sandervl Exp $ */1 /* $Id: timer.h,v 1.6 2003-05-16 10:59:28 sandervl Exp $ */ 2 2 /* 3 3 * public timer functions … … 14 14 15 15 #ifndef INCL_TIMERWIN32 16 extern BOOL TIMER_GetTimerInfo(HWND PMhwnd,ULONG PMid,PBOOL sys,PULONG id );16 extern BOOL TIMER_GetTimerInfo(HWND PMhwnd,ULONG PMid,PBOOL sys,PULONG id, PULONG proc); 17 17 extern BOOL TIMER_HandleTimer (PQMSG pMsg); 18 18 #endif 19 extern BOOL TIMER_IsTimerValid( HWND hwnd, UINT id, ULONG proc ); 19 20 extern VOID TIMER_KillTimerFromWindow(HWND hwnd); 20 21 -
TabularUnified trunk/src/user32/windowmsg.cpp ¶
r9928 r10104 1 /* $Id: windowmsg.cpp,v 1.4 1 2003-03-20 09:15:31sandervl Exp $ */1 /* $Id: windowmsg.cpp,v 1.42 2003-05-16 10:59:28 sandervl Exp $ */ 2 2 /* 3 3 * Win32 window message APIs for OS/2 … … 32 32 #include "oslibmsg.h" 33 33 #include "hook.h" 34 #define INCL_TIMERWIN32 35 #include "timer.h" 34 36 35 37 #define DBG_LOCALLOG DBG_windowmsg … … 44 46 { 45 47 dprintf2(("DispatchMessageA %x %x %x %x %x", msg->hwnd, msg->message, msg->wParam, msg->lParam, msg->time)); 48 49 /* Process timer messages */ 50 if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER)) 51 { 52 if (msg->lParam) 53 { 54 /* HOOK_CallHooks32A( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */ 55 56 /* before calling window proc, verify whether timer is still valid; 57 there's a slim chance that the application kills the timer 58 between GetMessage and DispatchMessage API calls */ 59 if (!TIMER_IsTimerValid(msg->hwnd, (UINT) msg->wParam, msg->lParam)) 60 return 0; /* invalid winproc */ 61 62 return CallWindowProcA( (WNDPROC)msg->lParam, msg->hwnd, 63 msg->message, msg->wParam, GetTickCount() ); 64 } 65 } 66 46 67 return OSLibWinDispatchMsg((MSG *)msg); 47 68 } … … 51 72 { 52 73 dprintf2(("DispatchMessageW %x %x %x %x %x", msg->hwnd, msg->message, msg->wParam, msg->lParam, msg->time)); 74 75 /* Process timer messages */ 76 if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER)) 77 { 78 if (msg->lParam) 79 { 80 /* HOOK_CallHooks32A( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */ 81 82 /* before calling window proc, verify whether timer is still valid; 83 there's a slim chance that the application kills the timer 84 between GetMessage and DispatchMessage API calls */ 85 if (!TIMER_IsTimerValid(msg->hwnd, (UINT) msg->wParam, msg->lParam)) 86 return 0; /* invalid winproc */ 87 88 return CallWindowProcA( (WNDPROC)msg->lParam, msg->hwnd, 89 msg->message, msg->wParam, GetTickCount() ); 90 } 91 } 53 92 return OSLibWinDispatchMsg((MSG *)msg, TRUE); 54 93 }
Note:
See TracChangeset
for help on using the changeset viewer.