diff --git a/cleanup-code.sh b/cleanup-code.sh index 77677a3f..dd368f3d 100755 --- a/cleanup-code.sh +++ b/cleanup-code.sh @@ -167,6 +167,9 @@ tab2space() { # sed -i 's/\/checkAndGetMainWindowPtrOfControl/g' `grep '\' -rl include/ src/` # sed -i 's/\/checkAndGetMainWindowPtrOfMainWin/g' `grep '\' -rl include/ src/` -sed -i 's/\/GetDCInSecondarySurface/g' `grep '\' -rl include/ src/` +# sed -i 's/\/GetDCInSecondarySurface/g' `grep '\' -rl include/ src/` + +sed -i 's/\/checkAndGetMainWinIfMainWin/g' `grep '\' -rl include/ src/` +sed -i 's/\/checkAndGetMainWinIfWindow/g' `grep '\' -rl include/ src/` exit 0 diff --git a/src/gui/menu.c b/src/gui/menu.c index 96579d2f..3a74e597 100644 --- a/src/gui/menu.c +++ b/src/gui/menu.c @@ -1297,7 +1297,7 @@ HMENU GUIAPI SetMenu (HWND hwnd, HMENU hmnu) PMAINWIN pWin; HMENU hOld; - if (!(pWin = checkAndGetMainWindowPtrOfMainWin (hwnd))) return 0; + if (!(pWin = checkAndGetMainWinIfMainWin (hwnd))) return 0; hOld = pWin->hMenu; pWin->hMenu = hmnu; @@ -1317,7 +1317,7 @@ HMENU GUIAPI GetMenu (HWND hwnd) { PMAINWIN pWin; - if (!(pWin = checkAndGetMainWindowPtrOfMainWin (hwnd))) return 0; + if (!(pWin = checkAndGetMainWinIfMainWin (hwnd))) return 0; return pWin->hMenu; } @@ -1326,7 +1326,7 @@ HMENU GUIAPI GetSystemMenu (HWND hwnd, BOOL flag) { PMAINWIN pWin; - if (!(pWin = checkAndGetMainWindowPtrOfMainWin (hwnd))) return 0; + if (!(pWin = checkAndGetMainWinIfMainWin (hwnd))) return 0; return pWin->hSysMenu; } @@ -1561,7 +1561,7 @@ HMENU GUIAPI GetMenuBarItemRect (HWND hwnd, int pos, RECT* prc) int count; SIZE size; - if (!(pWin = checkAndGetMainWindowPtrOfMainWin (hwnd))) return 0; + if (!(pWin = checkAndGetMainWinIfMainWin (hwnd))) return 0; if (!pWin->hMenu) return 0; @@ -1607,7 +1607,7 @@ static BOOL mnuGetMenuBarRect (HWND hwnd, RECT* prc) PMAINWIN pWin; int h; - if (!(pWin = checkAndGetMainWindowPtrOfMainWin (hwnd))) return FALSE; + if (!(pWin = checkAndGetMainWinIfMainWin (hwnd))) return FALSE; prc->left = pWin->cl - pWin->left; @@ -1693,7 +1693,7 @@ int MenuBarHitTest (HWND hwnd, int mx, int my) int count; SIZE size; - if (!(pWin = checkAndGetMainWindowPtrOfMainWin (hwnd))) return -1; + if (!(pWin = checkAndGetMainWinIfMainWin (hwnd))) return -1; if (!pWin->hMenu) return -1; @@ -1811,7 +1811,7 @@ void GUIAPI DrawMenuBar (HWND hwnd) PMAINWIN pWin; HDC hdc; - if (!(pWin = checkAndGetMainWindowPtrOfMainWin (hwnd))) return; + if (!(pWin = checkAndGetMainWinIfMainWin (hwnd))) return; if (!pWin->hMenu) return; diff --git a/src/gui/window.c b/src/gui/window.c index ba46f94b..b2044ba7 100644 --- a/src/gui/window.c +++ b/src/gui/window.c @@ -2602,7 +2602,7 @@ static LRESULT DefaultSystemMsgHandler(PMAINWIN pWin, UINT message, ** MSG_IDLE, MSG_CARETBLINK: */ if (message == MSG_IDLE) { - if (pWin == checkAndGetMainWindowPtrOfControl (sg_repeat_msg.hwnd)) { + if (pWin == checkAndGetMainWinIfWindow (sg_repeat_msg.hwnd)) { SendNotifyMessage (sg_repeat_msg.hwnd, sg_repeat_msg.message, sg_repeat_msg.wParam, sg_repeat_msg.lParam); @@ -2877,13 +2877,13 @@ void GUIAPI ReleaseCapture (void) #if 0 /* deprecated code */ /* Since 5.0.0, moved to internals.h as inline functions */ -PMAINWIN checkAndGetMainWindowPtrOfMainWin (HWND hWnd) +PMAINWIN checkAndGetMainWinIfMainWin (HWND hWnd) { MG_CHECK_RET (MG_IS_NORMAL_MAIN_WINDOW(hWnd), NULL); return MG_GET_WINDOW_PTR (hWnd); } -PMAINWIN checkAndGetMainWindowPtrOfControl (HWND hWnd) +PMAINWIN checkAndGetMainWinIfWindow (HWND hWnd) { PMAINWIN pWin; @@ -3973,12 +3973,14 @@ BOOL GUIAPI DestroyVirtualWindow (HWND hVirtWnd) goto broken; } - /* make the window to be invalid for PeekMessageEx, PostMessage etc */ - pVirtWin->DataType = TYPE_WINTODEL; - /* kill all timers of this window */ KillTimer (hVirtWnd, 0); + ThrowAwayMessages (hVirtWnd); + + /* make the window to be invalid for PeekMessageEx, PostMessage etc */ + pVirtWin->DataType = TYPE_WINTODEL; + /* since 5.0.0: destroy local data map */ if (pVirtWin->mapLocalData) { __mg_map_destroy (pVirtWin->mapLocalData); @@ -3991,8 +3993,6 @@ BOOL GUIAPI DestroyVirtualWindow (HWND hVirtWnd) pVirtWin->pHosting = NULL; } - ThrowAwayMessages (hVirtWnd); - if (pVirtWin->spCaption) { FreeFixStr (pVirtWin->spCaption); pVirtWin->spCaption = NULL; @@ -4084,7 +4084,7 @@ int GUIAPI WaitMainWindowClose (HWND hWnd, void** returnval) { pthread_t th; - if (!(checkAndGetMainWindowPtrOfMainWin(hWnd))) + if (!(checkAndGetMainWinIfMainWin(hWnd))) return -1; th = GetMainWinThread (hWnd); @@ -4467,7 +4467,7 @@ BOOL GUIAPI DestroyMainWindow (HWND hWnd) PMAINWIN hosted; /* for hosted window list. */ PMSGQUEUE pMsgQueue; - if (!(pWin = checkAndGetMainWindowPtrOfMainWin (hWnd))) + if (!(pWin = checkAndGetMainWinIfMainWin (hWnd))) return FALSE; if (!(pMsgQueue = getMsgQueueIfWindowInThisThread (hWnd))) { @@ -4507,9 +4507,6 @@ BOOL GUIAPI DestroyMainWindow (HWND hWnd) if (SendMessage (hWnd, MSG_DESTROY, 0, 0)) return FALSE; - /* make the window to be invalid for PeekMessageEx, PostMessage etc */ - pWin->DataType = TYPE_WINTODEL; - /* destroy all controls of this window */ DestroyAllControls (hWnd); @@ -4532,6 +4529,9 @@ BOOL GUIAPI DestroyMainWindow (HWND hWnd) ThrowAwayMessages (hWnd); + /* make the window to be invalid for PeekMessageEx, PostMessage etc */ + pWin->DataType = TYPE_WINTODEL; + /* houhh 20081127, move these code to desktop.c .*/ #if 0 if ((pWin->dwExStyle & WS_EX_AUTOSECONDARYDC) && pWin->secondaryDC) { @@ -5131,7 +5131,7 @@ BOOL GUIAPI IsWindowVisible (HWND hWnd) PMAINWIN pMainWin; PCONTROL pCtrl; - if ((pMainWin = checkAndGetMainWindowPtrOfMainWin (hWnd))) { + if ((pMainWin = checkAndGetMainWinIfMainWin (hWnd))) { return pMainWin->dwStyle & WS_VISIBLE; } else if (IsControl (hWnd)) { @@ -5756,7 +5756,7 @@ HWND GUIAPI CreateWindowEx2 (const char* spClassName, PCONTROL pNewCtrl; RECT rcExpect; - if (!(pMainWin = checkAndGetMainWindowPtrOfControl (hParentWnd))) + if (!(pMainWin = checkAndGetMainWinIfWindow (hParentWnd))) return HWND_INVALID; #if 0 @@ -6405,7 +6405,7 @@ int GUIAPI GetIMETargetInfo (IME_TARGET_INFO *info) HICON GetWindowIcon (HWND hWnd) { PMAINWIN pWin; - if (!(pWin = checkAndGetMainWindowPtrOfMainWin (hWnd))) + if (!(pWin = checkAndGetMainWinIfMainWin (hWnd))) return 0; return pWin->hIcon; @@ -6416,7 +6416,7 @@ HICON SetWindowIcon (HWND hWnd, HICON hIcon, BOOL bRedraw) PMAINWIN pWin; HICON hOld; - if (!(pWin = checkAndGetMainWindowPtrOfMainWin (hWnd))) + if (!(pWin = checkAndGetMainWinIfMainWin (hWnd))) return 0; hOld = pWin->hIcon; @@ -7008,7 +7008,7 @@ BOOL GUIAPI SetMainWindowAlwaysTop (HWND hMainWnd, BOOL fSet) { PMAINWIN pMainWin; - if (!(pMainWin = checkAndGetMainWindowPtrOfMainWin (hMainWnd))) { + if (!(pMainWin = checkAndGetMainWinIfMainWin (hMainWnd))) { return FALSE; } @@ -7022,7 +7022,7 @@ BOOL GUIAPI SetMainWindowCompositing (HWND hMainWnd, int type, DWORD arg) PMAINWIN pMainWin; COMPOSITINGINFO info; - if (!(pMainWin = checkAndGetMainWindowPtrOfMainWin (hMainWnd))) { + if (!(pMainWin = checkAndGetMainWinIfMainWin (hMainWnd))) { return FALSE; } diff --git a/src/include/internals.h b/src/include/internals.h index e7607556..5b194328 100644 --- a/src/include/internals.h +++ b/src/include/internals.h @@ -226,7 +226,7 @@ struct _MSGQUEUE // moved from window structures since 5.0.0. pthread_mutex_t lock; // lock sem_t wait; // the semaphore for wait message - sem_t sync_msg; // the semaphore for sync message + //sem_t sync_msg; // the semaphore for sync message; deprecated #endif DWORD dwState; // message queue states @@ -692,14 +692,14 @@ extern pthread_mutex_t __mg_gdilock, __mg_mouselock; if (!(condition)) return /* check whether hWnd is a main window and return the pointer to it. */ -static inline PMAINWIN checkAndGetMainWindowPtrOfMainWin (HWND hWnd) +static inline PMAINWIN checkAndGetMainWinIfMainWin (HWND hWnd) { MG_CHECK_RET (MG_IS_NORMAL_MAIN_WINDOW (hWnd), NULL); return MG_GET_WINDOW_PTR (hWnd); } /* return main window contains a control. */ -static inline PMAINWIN checkAndGetMainWindowPtrOfControl (HWND hWnd) +static inline PMAINWIN checkAndGetMainWinIfWindow (HWND hWnd) { PMAINWIN pWin; @@ -709,6 +709,17 @@ static inline PMAINWIN checkAndGetMainWindowPtrOfControl (HWND hWnd) return pWin->pMainWin; } +/* return main window contains a control. */ +static inline PMAINWIN checkAndGetMainWindowIfControl (HWND hWnd) +{ + PMAINWIN pWin; + + MG_CHECK_RET (MG_IS_CONTROL_WINDOW(hWnd), NULL); + pWin = MG_GET_WINDOW_PTR (hWnd); + + return pWin->pMainWin; +} + /* get main window pointer of a window, including desktop window */ static inline PMAINWIN getMainWindowPtr (HWND hWnd) { diff --git a/src/kernel/desktop-comm.c b/src/kernel/desktop-comm.c index aac608bf..2c428b19 100644 --- a/src/kernel/desktop-comm.c +++ b/src/kernel/desktop-comm.c @@ -549,7 +549,7 @@ static void dskEnableWindow (PMAINWIN pWin, int flags) if (pWin->dwStyle & WS_DISABLED) { if (__mg_captured_wnd && - checkAndGetMainWindowPtrOfControl (__mg_captured_wnd) == pWin) + checkAndGetMainWinIfWindow (__mg_captured_wnd) == pWin) __mg_captured_wnd = 0; if (dskGetActiveWindow () == pWin) { @@ -944,7 +944,7 @@ static HWND DesktopSetCapture (HWND hwnd) HWND hTemp; _mgs_old_under_p = NULL; - _mgs_button_down_main_window = checkAndGetMainWindowPtrOfControl (hwnd); + _mgs_button_down_main_window = checkAndGetMainWinIfWindow (hwnd); _mgs_down_buttons = DOWN_BUTTON_NONE; hTemp = __mg_captured_wnd; @@ -1570,7 +1570,7 @@ static LRESULT WindowMessageHandler(UINT message, PMAINWIN pWin, LPARAM lParam) while (from > 0) { hwnd = nodes[from].hwnd; - if ((pWin = checkAndGetMainWindowPtrOfMainWin (hwnd)) && + if ((pWin = checkAndGetMainWinIfMainWin (hwnd)) && !(pWin->dwExStyle & WS_EX_CTRLASMAINWIN)) { break; } @@ -2150,7 +2150,7 @@ static int dskRegisterIMEWnd (HWND hwnd) if (__mg_ime_wnd != 0) return ERR_IME_TOOMUCHIMEWND; - if (!checkAndGetMainWindowPtrOfMainWin (hwnd)) + if (!checkAndGetMainWinIfMainWin (hwnd)) return ERR_INV_HWND; __mg_ime_wnd = hwnd; @@ -2546,7 +2546,7 @@ static LRESULT DesktopWinProc (HWND hWnd, UINT message, uCounter += (__mg_tick_counter - blink_counter) * 10; blink_counter = __mg_tick_counter; if (sg_hCaretWnd != 0 - && checkAndGetMainWindowPtrOfControl (sg_hCaretWnd) == + && checkAndGetMainWinIfWindow (sg_hCaretWnd) == dskGetActiveWindow() && uCounter >= sg_uCaretBTime) { PostMessage (sg_hCaretWnd, MSG_CARETBLINK, 0, 0); diff --git a/src/kernel/desktop-procs.c b/src/kernel/desktop-procs.c index b2aa2c32..9f760a7e 100644 --- a/src/kernel/desktop-procs.c +++ b/src/kernel/desktop-procs.c @@ -2525,7 +2525,7 @@ static void dskEnableWindow (PMAINWIN pWin, int flags) if (pWin->dwStyle & WS_DISABLED) { if (__mg_captured_wnd && - checkAndGetMainWindowPtrOfControl (__mg_captured_wnd) == pWin) + checkAndGetMainWinIfWindow (__mg_captured_wnd) == pWin) __mg_captured_wnd = 0; if (dskGetActiveWindow (NULL) == (HWND)pWin) { @@ -2730,7 +2730,7 @@ static HWND dskGetNextMainWindow (PMAINWIN pWin) hwnd = nodes[from].hwnd; if ((nodes[from].cli == __mg_client_id) && - (pWin = checkAndGetMainWindowPtrOfMainWin (hwnd)) && + (pWin = checkAndGetMainWinIfMainWin (hwnd)) && !(pWin->dwExStyle & WS_EX_CTRLASMAINWIN)) { break; } @@ -4073,7 +4073,7 @@ static int srvRegisterIMEWnd (HWND hwnd) if (__mg_ime_wnd != 0) return ERR_IME_TOOMUCHIMEWND; - if (!checkAndGetMainWindowPtrOfMainWin (hwnd)) + if (!checkAndGetMainWinIfMainWin (hwnd)) return ERR_INV_HWND; __mg_ime_wnd = hwnd; @@ -4246,7 +4246,7 @@ static void dskOnTimer (void) blink_counter = __mg_tick_counter; if (sg_hCaretWnd != 0 - && (HWND)checkAndGetMainWindowPtrOfControl (sg_hCaretWnd) + && (HWND)checkAndGetMainWinIfWindow (sg_hCaretWnd) == dskGetActiveWindow (NULL) && uCounter >= sg_uCaretBTime) { PostMessage (sg_hCaretWnd, MSG_CARETBLINK, 0, 0); diff --git a/src/kernel/message.c b/src/kernel/message.c index ff0abe13..986b693a 100644 --- a/src/kernel/message.c +++ b/src/kernel/message.c @@ -326,14 +326,29 @@ static BOOL std_idle_handler (MSGQUEUE* msg_queue, BOOL wait) BOOL mg_InitMsgQueue (PMSGQUEUE pMsgQueue, int iBufferLen) { + int ret; + memset (pMsgQueue, 0, sizeof(MSGQUEUE)); pMsgQueue->dwState = QS_EMPTY; #ifdef _MGHAVE_VIRTUAL_WINDOW - pthread_mutex_init (&pMsgQueue->lock, NULL); - sem_init (&pMsgQueue->wait, 0, 0); - sem_init (&pMsgQueue->sync_msg, 0, 0); + /* since 5.0.0, we use recursive lock */ + { + pthread_mutexattr_t my_attr; + + ret = pthread_mutexattr_init (&my_attr); + if (ret) return FALSE; + ret = pthread_mutexattr_settype (&my_attr, PTHREAD_MUTEX_RECURSIVE); + if (ret) return FALSE; + ret = pthread_mutex_init (&pMsgQueue->lock, &my_attr); + if (ret) return FALSE; + ret = pthread_mutexattr_destroy (&my_attr); + if (ret) return FALSE; + } + ret = sem_init (&pMsgQueue->wait, 0, 0); + if (ret) return FALSE; + //sem_init (&pMsgQueue->sync_msg, 0, 0); #endif if (iBufferLen <= 0) @@ -345,7 +360,7 @@ BOOL mg_InitMsgQueue (PMSGQUEUE pMsgQueue, int iBufferLen) #ifdef _MGHAVE_VIRTUAL_WINDOW pthread_mutex_destroy (&pMsgQueue->lock); sem_destroy (&pMsgQueue->wait); - sem_destroy (&pMsgQueue->sync_msg); + //sem_destroy (&pMsgQueue->sync_msg); return FALSE; #endif } @@ -397,7 +412,7 @@ void mg_DestroyMsgQueue (PMSGQUEUE pMsgQueue) #ifdef _MGHAVE_VIRTUAL_WINDOW pthread_mutex_destroy (&pMsgQueue->lock); sem_destroy (&pMsgQueue->wait); - sem_destroy (&pMsgQueue->sync_msg); + //sem_destroy (&pMsgQueue->sync_msg); #endif __mg_remove_timers_by_msg_queue (pMsgQueue); @@ -1448,7 +1463,10 @@ int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd) LOCK_MSGQ (pMsgQueue); - if (MG_IS_MAIN_WINDOW (hWnd)) + /* for virtual window and main window, use pMainWin to check whether we + are throwing a message for controls of a main window. + checkAndGetMainWindowIfControl returns NULL for non control */ + if (MG_IS_MAIN_VIRT_WINDOW (hWnd)) pMainWin = (PMAINWIN)hWnd; if (pMsgQueue->pFirstNotifyMsg) { @@ -1458,7 +1476,7 @@ int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd) pMsg = &pQMsg->Msg; if (pMsg->hwnd == hWnd || - checkAndGetMainWindowPtrOfControl (pMsg->hwnd) == pMainWin) { + checkAndGetMainWindowIfControl (pMsg->hwnd) == pMainWin) { pMsg->hwnd = HWND_INVALID; nCountN ++; } @@ -1479,17 +1497,14 @@ int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd) pMsg = &pSyncMsg->Msg; if (pMsg->hwnd == hWnd || - checkAndGetMainWindowPtrOfControl (pMsg->hwnd) == pMainWin) { + checkAndGetMainWindowIfControl (pMsg->hwnd) == pMainWin) { pMsg->hwnd = HWND_INVALID; nCountS ++; - /* - * notify the waiting thread and remove the node from - * msg queue - */ + // notify the waiting thread and remove the node from msg queue pSyncMsg->retval = ERR_MSG_CANCELED; if (pSyncPrev) { - pSyncPrev->pNext = pSyncMsg->pNext ? pSyncMsg->pNext : NULL; + pSyncPrev->pNext = pSyncMsg->pNext; } else { pSyncPrev = pSyncMsg; @@ -1507,7 +1522,8 @@ int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd) } } - _DBG_PRINTF ("%d sync messages thrown for window %p\n", nCountS, hWnd); + _DBG_PRINTF ("%d sync messages thrown for window %p, pMainWin (%p)\n", + nCountS, hWnd, pMainWin); #endif /* defined _MGHAVE_VIRTUAL_WINDOW */ readpos = pMsgQueue->readpos; @@ -1515,7 +1531,7 @@ int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd) pMsg = pMsgQueue->msg + readpos; if (pMsg->hwnd == hWnd || - checkAndGetMainWindowPtrOfControl (pMsg->hwnd) == pMainWin) { + checkAndGetMainWindowIfControl (pMsg->hwnd) == pMainWin) { pMsg->hwnd = HWND_INVALID; nCountP ++; } @@ -1531,7 +1547,7 @@ int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd) if (pMsgQueue->expired_timer_mask & (0x01UL << slot)) { HWND timer_wnd = pMsgQueue->timer_slots [slot]->hWnd; if (timer_wnd == hWnd || - checkAndGetMainWindowPtrOfControl (timer_wnd) == pMainWin) { + checkAndGetMainWindowIfControl (timer_wnd) == pMainWin) { pMsgQueue->expired_timer_mask &= ~(0x01UL << slot); } } @@ -1609,17 +1625,17 @@ LRESULT SendSyncMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) SyncMsg.sem_handle = &thinfo->sync_msg; } else { - /* this is not a GUI thread */ + /* this is not a message thread */ sem_init (&sync_msg, 0, 0); SyncMsg.sem_handle = &sync_msg; } -#else - //The following DispatchMessage will need this function is reentrant function, - //so we must use unique semaphore. +#else /* not defined _SYNC_NEED_REENTERABLE */ + /* For reentrantable implementation, we use a unique semaphore which is + created in the stack. */ thinfo = mg_GetMsgQueueForThisThread (FALSE); sem_init (&sync_msg, 0, 0); SyncMsg.sem_handle = &sync_msg; -#endif +#endif /* defined _SYNC_NEED_REENTERABLE */ /* queue the sync message. */ SyncMsg.Msg.hwnd = hWnd; @@ -1633,6 +1649,7 @@ LRESULT SendSyncMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) * SendSyncMessage to other thread, because other thread maybe wait * for SyncMsg for you.*/ if (thinfo) { +#if 0 /* deprecated code */ MSG msg; PMSGQUEUE pMsgQueue = thinfo; @@ -1644,8 +1661,8 @@ LRESULT SendSyncMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) msg.pSyncMsg = (pMsgQueue->pFirstSyncMsg); pMsgQueue->pFirstSyncMsg = pMsgQueue->pFirstSyncMsg->pNext; UNLOCK_MSGQ (pMsgQueue); - TranslateMessage(&msg); - DispatchMessage(&msg); + TranslateMessage (&msg); + DispatchMessage (&msg); } else { UNLOCK_MSGQ (pMsgQueue); @@ -1658,6 +1675,27 @@ LRESULT SendSyncMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) break; } } +#else /* deprecated code */ + /* tuned since 5.0.0 */ + MSG msg; + PMSGQUEUE msg_queue = thinfo; + + LOCK_MSGQ (msg_queue); + while (msg_queue->dwState & QS_SYNCMSG) { + if (msg_queue->pFirstSyncMsg) { + msg = msg_queue->pFirstSyncMsg->Msg; + msg.pSyncMsg = (msg_queue->pFirstSyncMsg); + msg_queue->pFirstSyncMsg = msg_queue->pFirstSyncMsg->pNext; + TranslateMessage (&msg); + DispatchMessage (&msg); + } + else { + msg_queue->dwState &= ~QS_SYNCMSG; + } + } + + UNLOCK_MSGQ (msg_queue); +#endif /* tuned code */ } LOCK_MSGQ (pMsgQueue);