From 65aaaa950c793e9408a42d352db919d487ef2a2f Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Tue, 24 Mar 2015 02:53:25 +0000 Subject: * multiple WINE bug fixes over IsDialogMessage(), bug rep: https://bugs.winehq.org/show_bug.cgi?id=38276 git-svn-id: http://svn.miranda-ng.org/main/trunk@12489 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TipperYM/src/message_pump.cpp | 173 ++++++++++++++++------------------ 1 file changed, 79 insertions(+), 94 deletions(-) (limited to 'plugins/TipperYM') diff --git a/plugins/TipperYM/src/message_pump.cpp b/plugins/TipperYM/src/message_pump.cpp index 598d9fb69b..6a17dd0aba 100644 --- a/plugins/TipperYM/src/message_pump.cpp +++ b/plugins/TipperYM/src/message_pump.cpp @@ -102,114 +102,99 @@ bool NeedWaitForContent(CLCINFOTIPEX *clcitex) unsigned int CALLBACK MessagePumpThread(void *param) { - HWND hwndTip = 0; - CLCINFOTIPEX *clcitex = 0; - + HWND hwndTip = NULL; + CLCINFOTIPEX *clcitex = NULL; MSG hwndMsg = {0}; - while (GetMessage(&hwndMsg, 0, 0, 0) > 0 && !Miranda_Terminated()) - { - if (!IsDialogMessage(hwndMsg.hwnd, &hwndMsg)) - { - switch (hwndMsg.message) - { - case MUM_CREATEPOPUP: - { - if (!clcitex) - { - if (hwndMsg.lParam) clcitex = (CLCINFOTIPEX *)hwndMsg.lParam; - else break; - } - - if (!NeedWaitForContent(clcitex)) - { - if (hwndTip) MyDestroyWindow(hwndTip); - hwndTip = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, NULL, WS_POPUP, 0, 0, 0, 0, 0, 0, hInst, (LPVOID)clcitex); - if (clcitex) - { - mir_free(clcitex); - clcitex = 0; - } - - bStatusMsgReady = false; - bAvatarReady = false; - } + while (GetMessage(&hwndMsg, NULL, 0, 0) > 0 && !Miranda_Terminated()) { + if (hwndMsg.hwnd != NULL && IsDialogMessage(hwndMsg.hwnd, &hwndMsg)) /* Wine fix. */ + continue; + switch (hwndMsg.message) { + case MUM_CREATEPOPUP: + if (!clcitex) { + if (hwndMsg.lParam) + clcitex = (CLCINFOTIPEX*)hwndMsg.lParam; + else break; - } - case MUM_DELETEPOPUP: - { - if (hwndTip) { - MyDestroyWindow(hwndTip); - hwndTip = 0; - } + } - if (clcitex) { - mir_free(clcitex); - clcitex = 0; - } + if (!NeedWaitForContent(clcitex)) { + if (hwndTip) + MyDestroyWindow(hwndTip); + hwndTip = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, NULL, WS_POPUP, 0, 0, 0, 0, 0, 0, hInst, (LPVOID)clcitex); - bStatusMsgReady = false; - bAvatarReady = false; - break; + if (clcitex) { + mir_free(clcitex); + clcitex = NULL; } - case MUM_GOTSTATUS: - { - MCONTACT hContact = (MCONTACT)hwndMsg.wParam; - TCHAR *swzMsg = (TCHAR *)hwndMsg.lParam; - if (opt.bWaitForContent && bStatusMsgReady == false && clcitex && clcitex->hItem == (HANDLE)hContact) { - if (WaitForContentTimerID) { - KillTimer(0, WaitForContentTimerID); - WaitForContentTimerID = 0; - } + bStatusMsgReady = false; + bAvatarReady = false; + } + break; + case MUM_DELETEPOPUP: + if (hwndTip) { + MyDestroyWindow(hwndTip); + hwndTip = 0; + } - if (swzMsg) { - db_set_ts((MCONTACT)clcitex->hItem, MODULE, "TempStatusMsg", swzMsg); - mir_free(swzMsg); - } + if (clcitex) { + mir_free(clcitex); + clcitex = NULL; + } - bStatusMsgReady = true; - PostMPMessage(MUM_CREATEPOPUP, 0, 0); + bStatusMsgReady = false; + bAvatarReady = false; + break; + case MUM_GOTSTATUS: + { + MCONTACT hContact = (MCONTACT)hwndMsg.wParam; + TCHAR *swzMsg = (TCHAR *)hwndMsg.lParam; + + if (opt.bWaitForContent && bStatusMsgReady == false && clcitex && clcitex->hItem == (HANDLE)hContact) { + if (WaitForContentTimerID) { + KillTimer(0, WaitForContentTimerID); + WaitForContentTimerID = 0; } - else if (!opt.bWaitForContent && hwndTip) - SendMessage(hwndTip, PUM_SETSTATUSTEXT, hContact, (LPARAM)swzMsg); - else if (swzMsg) + + if (swzMsg) { + db_set_ts((MCONTACT)clcitex->hItem, MODULE, "TempStatusMsg", swzMsg); mir_free(swzMsg); + } - break; - } - case MUM_GOTXSTATUS: - { - if (hwndTip && !opt.bWaitForContent) - SendMessage(hwndTip, PUM_SHOWXSTATUS, hwndMsg.wParam, 0); - break; + bStatusMsgReady = true; + PostMPMessage(MUM_CREATEPOPUP, 0, 0); } - case MUM_GOTAVATAR: - { - MCONTACT hContact = (MCONTACT)hwndMsg.wParam; - if (opt.bWaitForContent && bAvatarReady == false && clcitex && clcitex->hItem == (HANDLE)hContact) - { - if (WaitForContentTimerID) - { - KillTimer(0, WaitForContentTimerID); - WaitForContentTimerID = 0; - } - - bAvatarReady = true; - PostMPMessage(MUM_CREATEPOPUP, 0, 0); + else if (!opt.bWaitForContent && hwndTip) + SendMessage(hwndTip, PUM_SETSTATUSTEXT, hContact, (LPARAM)swzMsg); + else if (swzMsg) + mir_free(swzMsg); + } + break; + case MUM_GOTXSTATUS: + if (hwndTip && !opt.bWaitForContent) + SendMessage(hwndTip, PUM_SHOWXSTATUS, hwndMsg.wParam, 0); + break; + case MUM_GOTAVATAR: + { + MCONTACT hContact = (MCONTACT)hwndMsg.wParam; + if (opt.bWaitForContent && bAvatarReady == false && clcitex && clcitex->hItem == (HANDLE)hContact) { + if (WaitForContentTimerID) { + KillTimer(0, WaitForContentTimerID); + WaitForContentTimerID = 0; } - else if (!opt.bWaitForContent && hwndTip) - SendMessage(hwndTip, PUM_SETAVATAR, hwndMsg.wParam, 0); - break; - } - default: - { - TranslateMessage(&hwndMsg); - DispatchMessage(&hwndMsg); - break; + bAvatarReady = true; + PostMPMessage(MUM_CREATEPOPUP, 0, 0); } + else if (!opt.bWaitForContent && hwndTip) + SendMessage(hwndTip, PUM_SETAVATAR, hwndMsg.wParam, 0); } + break; + default: + TranslateMessage(&hwndMsg); + DispatchMessage(&hwndMsg); + break; } } @@ -250,7 +235,7 @@ INT_PTR ShowTip(WPARAM wParam, LPARAM lParam) { CLCINFOTIP *clcit = (CLCINFOTIP *)lParam; HWND clist = (HWND)CallService(MS_CLUI_GETHWNDTREE, 0, 0); - + if (clcit->isGroup) return 0; // no group tips (since they're pretty useless) if (clcit->isTreeFocused == 0 && opt.bShowNoFocus == false && clist == WindowFromPoint(clcit->ptCursor)) return 0; if (clcit->ptCursor.x == pt.x && clcit->ptCursor.y == pt.y) return 0; @@ -317,8 +302,8 @@ INT_PTR HideTip(WPARAM wParam, LPARAM lParam) int HideTipHook(WPARAM wParam, LPARAM lParam) { - HideTip(wParam, lParam); - return 0; + HideTip(wParam, lParam); + return 0; } int ProtoAck(WPARAM wParam, LPARAM lParam) -- cgit v1.2.3