diff --git a/cleanup-code.sh b/cleanup-code.sh index 103fa41a..32ba9c9b 100755 --- a/cleanup-code.sh +++ b/cleanup-code.sh @@ -161,7 +161,10 @@ tab2space() { #sed -i 's/\/gui_SetCtrlClassAddData/g' `grep '\' -rl include/ src/` #sed -i 's/\/gui_GetCtrlClassAddData/g' `grep '\' -rl include/ src/` -sed -i 's/\/get_effective_dc/g' `grep '\' -rl include/ src/` -sed -i 's/\/release_effective_dc/g' `grep '\' -rl include/ src/` +# sed -i 's/\/get_effective_dc/g' `grep '\' -rl include/ src/` +# sed -i 's/\/release_effective_dc/g' `grep '\' -rl include/ src/` + +sed -i 's/\/checkAndGetMainWindowPtrOfControl/g' `grep '\' -rl include/ src/` +sed -i 's/\/checkAndGetMainWindowPtrOfMainWin/g' `grep '\' -rl include/ src/` exit 0 diff --git a/src/gui/menu.c b/src/gui/menu.c index 56329fd9..96579d2f 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 = gui_CheckAndGetMainWindowPtr (hwnd))) return 0; + if (!(pWin = checkAndGetMainWindowPtrOfMainWin (hwnd))) return 0; hOld = pWin->hMenu; pWin->hMenu = hmnu; @@ -1317,7 +1317,7 @@ HMENU GUIAPI GetMenu (HWND hwnd) { PMAINWIN pWin; - if (!(pWin = gui_CheckAndGetMainWindowPtr (hwnd))) return 0; + if (!(pWin = checkAndGetMainWindowPtrOfMainWin (hwnd))) return 0; return pWin->hMenu; } @@ -1326,7 +1326,7 @@ HMENU GUIAPI GetSystemMenu (HWND hwnd, BOOL flag) { PMAINWIN pWin; - if (!(pWin = gui_CheckAndGetMainWindowPtr (hwnd))) return 0; + if (!(pWin = checkAndGetMainWindowPtrOfMainWin (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 = gui_CheckAndGetMainWindowPtr (hwnd))) return 0; + if (!(pWin = checkAndGetMainWindowPtrOfMainWin (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 = gui_CheckAndGetMainWindowPtr (hwnd))) return FALSE; + if (!(pWin = checkAndGetMainWindowPtrOfMainWin (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 = gui_CheckAndGetMainWindowPtr (hwnd))) return -1; + if (!(pWin = checkAndGetMainWindowPtrOfMainWin (hwnd))) return -1; if (!pWin->hMenu) return -1; @@ -1811,7 +1811,7 @@ void GUIAPI DrawMenuBar (HWND hwnd) PMAINWIN pWin; HDC hdc; - if (!(pWin = gui_CheckAndGetMainWindowPtr (hwnd))) return; + if (!(pWin = checkAndGetMainWindowPtrOfMainWin (hwnd))) return; if (!pWin->hMenu) return; diff --git a/src/kernel/desktop-comm.c b/src/kernel/desktop-comm.c index 9e8b5231..4d89fa5d 100644 --- a/src/kernel/desktop-comm.c +++ b/src/kernel/desktop-comm.c @@ -533,7 +533,7 @@ static void dskEnableWindow (PMAINWIN pWin, int flags) if (pWin->dwStyle & WS_DISABLED) { if (__mg_captured_wnd && - gui_GetMainWindowPtrOfControl (__mg_captured_wnd) == pWin) + checkAndGetMainWindowPtrOfControl (__mg_captured_wnd) == pWin) __mg_captured_wnd = 0; if (dskGetActiveWindow () == pWin) { @@ -928,7 +928,7 @@ static HWND DesktopSetCapture (HWND hwnd) HWND hTemp; _mgs_old_under_p = NULL; - _mgs_button_down_main_window = gui_GetMainWindowPtrOfControl (hwnd); + _mgs_button_down_main_window = checkAndGetMainWindowPtrOfControl (hwnd); _mgs_down_buttons = DOWN_BUTTON_NONE; hTemp = __mg_captured_wnd; @@ -1554,7 +1554,7 @@ static LRESULT WindowMessageHandler(UINT message, PMAINWIN pWin, LPARAM lParam) while (from) { hwnd = nodes[from].hwnd; - if ((pWin = gui_CheckAndGetMainWindowPtr (hwnd)) && + if ((pWin = checkAndGetMainWindowPtrOfMainWin (hwnd)) && !(pWin->dwExStyle & WS_EX_CTRLASMAINWIN)) { break; } @@ -2130,7 +2130,7 @@ static int dskRegisterIMEWnd (HWND hwnd) if (__mg_ime_wnd != 0) return ERR_IME_TOOMUCHIMEWND; - if (!gui_CheckAndGetMainWindowPtr (hwnd)) + if (!checkAndGetMainWindowPtrOfMainWin (hwnd)) return ERR_INV_HWND; __mg_ime_wnd = hwnd; @@ -2526,7 +2526,7 @@ static LRESULT DesktopWinProc (HWND hWnd, UINT message, uCounter += (__mg_tick_counter - blink_counter) * 10; blink_counter = __mg_tick_counter; if (sg_hCaretWnd != 0 - && gui_GetMainWindowPtrOfControl (sg_hCaretWnd) == + && checkAndGetMainWindowPtrOfControl (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 1f72317b..3d3313e8 100644 --- a/src/kernel/desktop-procs.c +++ b/src/kernel/desktop-procs.c @@ -2492,7 +2492,7 @@ static void dskEnableWindow (PMAINWIN pWin, int flags) if (pWin->dwStyle & WS_DISABLED) { if (__mg_captured_wnd && - gui_GetMainWindowPtrOfControl (__mg_captured_wnd) == pWin) + checkAndGetMainWindowPtrOfControl (__mg_captured_wnd) == pWin) __mg_captured_wnd = 0; if (dskGetActiveWindow (NULL) == (HWND)pWin) { @@ -2697,7 +2697,7 @@ static HWND dskGetNextMainWindow (PMAINWIN pWin) hwnd = nodes[from].hwnd; if ((nodes[from].cli == __mg_client_id) && - (pWin = gui_CheckAndGetMainWindowPtr (hwnd)) && + (pWin = checkAndGetMainWindowPtrOfMainWin (hwnd)) && !(pWin->dwExStyle & WS_EX_CTRLASMAINWIN)) { break; } @@ -4033,7 +4033,7 @@ static int srvRegisterIMEWnd (HWND hwnd) if (__mg_ime_wnd != 0) return ERR_IME_TOOMUCHIMEWND; - if (!gui_CheckAndGetMainWindowPtr (hwnd)) + if (!checkAndGetMainWindowPtrOfMainWin (hwnd)) return ERR_INV_HWND; __mg_ime_wnd = hwnd; @@ -4206,7 +4206,7 @@ static void dskOnTimer (void) blink_counter = __mg_tick_counter; if (sg_hCaretWnd != 0 - && (HWND)gui_GetMainWindowPtrOfControl (sg_hCaretWnd) + && (HWND)checkAndGetMainWindowPtrOfControl (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 02650aac..df0da709 100644 --- a/src/kernel/message.c +++ b/src/kernel/message.c @@ -1435,6 +1435,9 @@ LRESULT GUIAPI DispatchMessage (PMSG pMsg) return lRet; } +/* Throw away messages in the message queue for the specified window. + If the specified window is a main window, all messages sent + to the controls of the main window will be thrown away asw well. */ int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd) { PMAINWIN pMainWin = NULL; @@ -1458,7 +1461,7 @@ int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd) pMsg = &pQMsg->Msg; if (pMsg->hwnd == hWnd || - gui_GetMainWindowPtrOfControl (pMsg->hwnd) == pMainWin) { + checkAndGetMainWindowPtrOfControl (pMsg->hwnd) == pMainWin) { pMsg->hwnd = HWND_INVALID; nCountN ++; } @@ -1479,7 +1482,7 @@ int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd) pMsg = &pSyncMsg->Msg; if (pMsg->hwnd == hWnd || - gui_GetMainWindowPtrOfControl (pMsg->hwnd) == pMainWin) { + checkAndGetMainWindowPtrOfControl (pMsg->hwnd) == pMainWin) { pMsg->hwnd = HWND_INVALID; nCountS ++; @@ -1515,7 +1518,7 @@ int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd) pMsg = pMsgQueue->msg + readpos; if (pMsg->hwnd == hWnd || - gui_GetMainWindowPtrOfControl (pMsg->hwnd) == pMainWin) { + checkAndGetMainWindowPtrOfControl (pMsg->hwnd) == pMainWin) { pMsg->hwnd = HWND_INVALID; nCountP ++; } @@ -1531,7 +1534,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 || - gui_GetMainWindowPtrOfControl (timer_wnd) == pMainWin) { + checkAndGetMainWindowPtrOfControl (timer_wnd) == pMainWin) { pMsgQueue->expired_timer_mask &= ~(0x01UL << slot); } }