From 34d9db73c26ad24b1f8bf1e5a1949c407c9639ca Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 17 Dec 2016 19:59:32 +0300 Subject: - tabSRMM to share the kernel window list for chats & group chats; - button creation nuances moved to the core --- plugins/TabSRMM/src/buttonsbar.cpp | 60 ++++++++++++-------------------------- plugins/TabSRMM/src/mim.cpp | 10 +++---- plugins/TabSRMM/src/mim.h | 2 -- plugins/TabSRMM/src/msgs.cpp | 2 -- src/mir_app/src/srmm_toolbar.cpp | 12 +++++++- 5 files changed, 35 insertions(+), 51 deletions(-) diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 01a51ced63..4302a2cc05 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -161,53 +161,31 @@ void BB_InitDlgButtons(TWindowData *dat) dat->bbLSideWidth = dat->bbRSideWidth = 0; + Srmm_CreateToolbarIcons(hdlg, (dat->bType == SESSIONTYPE_IM) ? BBBF_ISIMBUTTON : BBBF_ISCHATBUTTON); + CustomButtonData *cbd; for (int i = 0; cbd = Srmm_GetNthButton(i); i++) { HWND hwndBtn = GetDlgItem(hdlg, cbd->m_dwButtonCID); - if (((dat->bType == SESSIONTYPE_IM && cbd->m_bIMButton) || (dat->bType == SESSIONTYPE_CHAT && cbd->m_bChatButton))) { - if (!cbd->m_bHidden) { - if (cbd->m_bRSided) - dat->bbRSideWidth += cbd->m_iButtonWidth + gap; - else - dat->bbLSideWidth += cbd->m_iButtonWidth + gap; - } - if (!cbd->m_bHidden && !cbd->m_bCanBeHidden) - dat->iButtonBarReallyNeeds += cbd->m_iButtonWidth + gap; + if (hwndBtn == NULL) + continue; - if (cbd->m_bSeparator) - continue; + if (!cbd->m_bHidden) { + if (cbd->m_bRSided) + dat->bbRSideWidth += cbd->m_iButtonWidth + gap; + else + dat->bbLSideWidth += cbd->m_iButtonWidth + gap; + } + if (!cbd->m_bHidden && !cbd->m_bCanBeHidden) + dat->iButtonBarReallyNeeds += cbd->m_iButtonWidth + gap; - if (hwndBtn == NULL) { - int x = cbd->m_bRSided ? rect.right - dat->bbRSideWidth + gap : 2 + dat->bbLSideWidth; - hwndBtn = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, x, splitterY, cbd->m_iButtonWidth, DPISCALEY_S(22), hdlg, (HMENU)cbd->m_dwButtonCID, g_hInst, NULL); - if (hwndBtn == NULL) - continue; - CustomizeButton(hwndBtn); - } + if (cbd->m_bSeparator) + continue; - SendMessage(hwndBtn, BUTTONSETASFLATBTN, TRUE, 0); - SendMessage(hwndBtn, BUTTONSETASTHEMEDBTN, CSkin::IsThemed(), 0); - if (cbd->m_hIcon) - SendMessage(hwndBtn, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIconByHandle(cbd->m_hIcon)); - if (cbd->m_pwszText) - SetWindowTextW(hwndBtn, cbd->m_pwszText); - if (cbd->m_pwszTooltip) - SendMessage(hwndBtn, BUTTONADDTOOLTIP, (WPARAM)TranslateW(cbd->m_pwszTooltip), BATF_UNICODE); - SendMessage(hwndBtn, BUTTONSETCONTAINER, (LPARAM)dat->pContainer, 0); - SendMessage(hwndBtn, BUTTONSETASTOOLBARBUTTON, TRUE, 0); - - if (cbd->m_dwArrowCID) - SendMessage(hwndBtn, BUTTONSETARROW, cbd->m_dwArrowCID, 0); - if (cbd->m_bPushButton) - SendMessage(hwndBtn, BUTTONSETASPUSHBTN, TRUE, 0); - - if (cbd->m_bDisabled) - EnableWindow(hwndBtn, 0); - if (cbd->m_bHidden) - ShowWindow(hwndBtn, SW_HIDE); - } - else if (hwndBtn) - DestroyWindow(hwndBtn); + CustomizeButton(hwndBtn); + + SendMessage(hwndBtn, BUTTONSETASTHEMEDBTN, CSkin::IsThemed(), 0); + SendMessage(hwndBtn, BUTTONSETCONTAINER, (LPARAM)dat->pContainer, 0); + SendMessage(hwndBtn, BUTTONSETASTOOLBARBUTTON, TRUE, 0); } } diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index b222fdc845..9fbb141250 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -56,27 +56,27 @@ bool CMimAPI::m_haveBufferedPaint = false; void CMimAPI::BroadcastMessage(UINT msg, WPARAM wParam, LPARAM lParam) { - WindowList_Broadcast(m_hMessageWindowList, msg, wParam, lParam); + WindowList_Broadcast(pci->hWindowList, msg, wParam, lParam); } void CMimAPI::BroadcastMessageAsync(UINT msg, WPARAM wParam, LPARAM lParam) { - WindowList_BroadcastAsync(m_hMessageWindowList, msg, wParam, lParam); + WindowList_BroadcastAsync(pci->hWindowList, msg, wParam, lParam); } HWND CMimAPI::FindWindow(MCONTACT h) const { - return WindowList_Find(m_hMessageWindowList, h); + return WindowList_Find(pci->hWindowList, h); } INT_PTR CMimAPI::AddWindow(HWND hWnd, MCONTACT h) { - return WindowList_Add(m_hMessageWindowList, hWnd, h); + return WindowList_Add(pci->hWindowList, hWnd, h); } INT_PTR CMimAPI::RemoveWindow(HWND hWnd) { - return WindowList_Remove(m_hMessageWindowList, hWnd); + return WindowList_Remove(pci->hWindowList, hWnd); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/TabSRMM/src/mim.h b/plugins/TabSRMM/src/mim.h index 8322326611..7c648e48d7 100644 --- a/plugins/TabSRMM/src/mim.h +++ b/plugins/TabSRMM/src/mim.h @@ -193,8 +193,6 @@ public: static int MessageEventAdded(WPARAM wParam, LPARAM lParam); public: - MWindowList m_hMessageWindowList; - // various function pointers static PDTTE m_pfnDrawThemeTextEx; static DEFICA m_pfnDwmExtendFrameIntoClientArea; diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index fb07d79f7d..a4127e960a 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -366,7 +366,6 @@ static INT_PTR TypingMessageCommand(WPARAM, LPARAM lParam) int SplitmsgShutdown(void) { - WindowList_Destroy(M.m_hMessageWindowList); WindowList_Destroy(PluginConfig.hUserPrefsWindowList); DestroyCursor(PluginConfig.hCurSplitNS); @@ -982,7 +981,6 @@ int LoadSendRecvMessageModule(void) Win7Taskbar->updateMetrics(); memset(&nen_options, 0, sizeof(nen_options)); - M.m_hMessageWindowList = WindowList_Create(); PluginConfig.hUserPrefsWindowList = WindowList_Create(); sendQueue = new SendQueue; Skin = new CSkin; diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp index 88f79dc544..aeff306fdf 100644 --- a/src/mir_app/src/srmm_toolbar.cpp +++ b/src/mir_app/src/srmm_toolbar.cpp @@ -327,7 +327,7 @@ MIR_APP_DLL(void) Srmm_CreateToolbarIcons(HWND hwndDlg, int flags) HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID); if ((flags & BBBF_ISIMBUTTON) && cbd->m_bIMButton || (flags & BBBF_ISCHATBUTTON) && cbd->m_bChatButton) { if (hwndButton == NULL) { - hwndButton = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, cbd->m_iButtonWidth, 22, hwndDlg, (HMENU)cbd->m_dwButtonCID, hInstance, NULL); + hwndButton = CreateWindowEx(0, L"MButtonClass", L"", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, cbd->m_iButtonWidth, DPISCALEX_S(22), hwndDlg, (HMENU)cbd->m_dwButtonCID, hInstance, NULL); if (hwndButton == NULL) // smth went wrong continue; } @@ -338,6 +338,16 @@ MIR_APP_DLL(void) Srmm_CreateToolbarIcons(HWND hwndDlg, int flags) SendMessage(hwndButton, BUTTONADDTOOLTIP, LPARAM(cbd->m_pwszTooltip), BATF_UNICODE); if (cbd->m_hIcon) SendMessage(hwndButton, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIconByHandle(cbd->m_hIcon)); + + if (cbd->m_dwArrowCID) + SendMessage(hwndButton, BUTTONSETARROW, cbd->m_dwArrowCID, 0); + if (cbd->m_bPushButton) + SendMessage(hwndButton, BUTTONSETASPUSHBTN, TRUE, 0); + + if (cbd->m_bDisabled) + EnableWindow(hwndButton, FALSE); + if (cbd->m_bHidden) + ShowWindow(hwndButton, SW_HIDE); } else if (hwndButton) DestroyWindow(hwndButton); -- cgit v1.2.3 From 9705b55d9b81bc6bcc475c4b2f7db9e33f89e037 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 18 Dec 2016 13:05:24 +0300 Subject: - two unused variables removed; - second splitter's position altered to place a smiley button correctly --- plugins/TabSRMM/src/TSButton.cpp | 17 +++++++---------- plugins/TabSRMM/src/buttonsbar.cpp | 3 +-- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/plugins/TabSRMM/src/TSButton.cpp b/plugins/TabSRMM/src/TSButton.cpp index 443039eba6..75d2897bfb 100644 --- a/plugins/TabSRMM/src/TSButton.cpp +++ b/plugins/TabSRMM/src/TSButton.cpp @@ -181,13 +181,12 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint) } else { if (ctl->pContainer && CSkin::m_skinEnabled) { - CSkinItem *item, *realItem = 0; + CSkinItem *item; if (ctl->bTitleButton) item = &SkinItems[ctl->stateId == PBS_NORMAL ? ID_EXTBKTITLEBUTTON : (ctl->stateId == PBS_HOT ? ID_EXTBKTITLEBUTTONMOUSEOVER : ID_EXTBKTITLEBUTTONPRESSED)]; - else { + else item = &SkinItems[(ctl->stateId == PBS_NORMAL || ctl->stateId == PBS_DISABLED) ? ID_EXTBKBUTTONSNPRESSED : (ctl->stateId == PBS_HOT ? ID_EXTBKBUTTONSMOUSEOVER : ID_EXTBKBUTTONSPRESSED)]; - realItem = item; - } + CSkin::SkinDrawBG(ctl->hwnd, ctl->pContainer->hwnd, ctl->pContainer, &rcClient, hdcMem); if (!item->IGNORED) { RECT rc1 = rcClient; @@ -211,7 +210,7 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint) else { CSkin::m_switchBarItem->setAlphaFormat(AC_SRC_ALPHA, state == PBS_NORMAL ? 140 : 240); if (state == PBS_PRESSED) { - RECT rc = rcClient; + RECT rc = rcClient; InflateRect(&rc, -1, -1); HBRUSH bBack = CreateSolidBrush(PluginConfig.m_tbBackgroundLow ? PluginConfig.m_tbBackgroundLow : GetSysColor(COLOR_3DDKSHADOW)); FillRect(hdcMem, &rc, bBack); @@ -229,9 +228,7 @@ static void PaintWorker(TSButtonCtrl *ctl, HDC hdcPaint) } } - /* - * render content - */ + // render content if (ctl->arrow) { rcContent.top += 2; rcContent.bottom -= 2; @@ -442,7 +439,7 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L bct->stateId = PBS_PRESSED; else if (LOWORD(lParam) > rc.right - 12) { if (GetDlgCtrlID(hwndDlg) == IDOK || bct->stateId != PBS_DISABLED) { - WORD w = (WORD)((INT_PTR)bct->arrow & 0x0000ffff); + WORD w = LOWORD((INT_PTR)bct->arrow); SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKELONG(w, BN_CLICKED), (LPARAM)hwndDlg); } } @@ -481,8 +478,8 @@ static LRESULT CALLBACK TSButtonWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_TIMER: // use a timer to check if they have did a mouseout if (wParam == BUTTON_POLLID) { RECT rc; - POINT pt; GetWindowRect(hwndDlg, &rc); + POINT pt; GetCursorPos(&pt); if (!PtInRect(&rc, pt)) { // mouse must be gone, trigger mouse leave PostMessage(hwndDlg, WM_MOUSELEAVE, 0, 0L); diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 4302a2cc05..1f3e24fde9 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -91,7 +91,7 @@ static int CB_InitDefaultButtons(WPARAM, LPARAM) bbd.bbbFlags = BBBF_ISCHATBUTTON | BBBF_ISDUMMYBUTTON; bbd.dwButtonID = 1; bbd.pszModuleName = "tb_splitter"; - bbd.dwDefPos = 31; + bbd.dwDefPos = 35; bbd.hIcon = 0; bbd.pwszTooltip = 0; Srmm_AddButton(&bbd); @@ -157,7 +157,6 @@ void BB_InitDlgButtons(TWindowData *dat) RECT rect; GetClientRect(hdlg, &rect); - int splitterY = ptSplitter.y - DPISCALEY_S(1); dat->bbLSideWidth = dat->bbRSideWidth = 0; -- cgit v1.2.3 From fe1d2e6fd5d77885e3efe0339e03b2fec7002b0b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 18 Dec 2016 13:30:36 +0300 Subject: fix for strange post-effects of dnd in CCtrlTreeView --- include/m_gui.h | 1 + src/mir_app/src/srmm_toolbar.cpp | 4 ++-- src/mir_core/src/ui_utils.cpp | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/m_gui.h b/include/m_gui.h index f38764d05c..b9f0fdc84e 100644 --- a/include/m_gui.h +++ b/include/m_gui.h @@ -1154,6 +1154,7 @@ public: CCallback OnEndLabelEdit; CCallback OnGetDispInfo; CCallback OnGetInfoTip; + CCallback OnItemChanged; CCallback OnItemExpanded; CCallback OnItemExpanding; CCallback OnKeyDown; diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp index aeff306fdf..9fcdfaecfc 100644 --- a/src/mir_app/src/srmm_toolbar.cpp +++ b/src/mir_app/src/srmm_toolbar.cpp @@ -579,7 +579,7 @@ public: m_toolBar.SetFlags(MTREE_DND); // enable drag-n-drop m_toolBar.OnSelChanged = Callback(this, &CSrmmToolbarOptions::OnTreeSelChanged); m_toolBar.OnSelChanging = Callback(this, &CSrmmToolbarOptions::OnTreeSelChanging); - m_toolBar.OnChange = Callback(this, &CSrmmToolbarOptions::OnTreeChanged); + m_toolBar.OnItemChanged = Callback(this, &CSrmmToolbarOptions::OnTreeItemChanged); m_btnReset.OnClick = Callback(this, &CSrmmToolbarOptions::btnResetClicked); m_btnSeparator.OnClick = Callback(this, &CSrmmToolbarOptions::btnSeparatorClicked); @@ -734,7 +734,7 @@ public: m_btnHidden.Enable(); m_btnHidden.SetState(cbd->m_bCanBeHidden); } - void OnTreeChanged(void*) + void OnTreeItemChanged(void*) { int iNewState = !m_toolBar.GetCheckState(m_toolBar.GetSelection()); m_btnIM.Enable(iNewState); diff --git a/src/mir_core/src/ui_utils.cpp b/src/mir_core/src/ui_utils.cpp index 1ca3ee069a..1e4cec81b9 100644 --- a/src/mir_core/src/ui_utils.cpp +++ b/src/mir_core/src/ui_utils.cpp @@ -1754,7 +1754,7 @@ BOOL CCtrlTreeView::OnNotify(int, NMHDR *pnmh) if (evt.nmtvkey->wVKey == VK_SPACE) { if (m_bCheckBox) InvertCheck(GetSelection()); - OnChange(this); + OnItemChanged(&evt); NotifyChange(); } @@ -1773,7 +1773,7 @@ BOOL CCtrlTreeView::OnNotify(int, NMHDR *pnmh) InvertCheck(hti.hItem); else SelectItem(hti.hItem); - OnChange(this); + OnItemChanged(&evt); NotifyChange(); } } -- cgit v1.2.3 From 71bb9529a122f347b62dee2a20c81becc51b5ac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sun, 18 Dec 2016 17:57:20 +0100 Subject: Steam: Attempt to fix not loading contact statuses at login (addresses #646) (reverted from commit e0c07918e5644a6927b2408cc4f35a367f59344a) This was bad idea. It makes contacts online even when they aren't anymore. --- protocols/Steam/src/steam_contacts.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index 6e95c48805..39bd619363 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -173,10 +173,10 @@ void CSteamProto::UpdateContact(MCONTACT hContact, JSONNode *data) // status // NOTE: this here is wrong info, probably depending on publicity of steam profile, but we don't need this at all, we get status updates by polling - // NOTE: polling won't always give us info about all contacts (e.g. in case of quick disconnect and reconnect), so we try to use this anyway - node = json_get(data, "personastate"); - WORD status = SteamToMirandaStatus(json_as_int(node)); + /*node = json_get(data, "personastate"); + status = SteamToMirandaStatus(json_as_int(node)); SetContactStatus(hContact, status); + */ // client node = json_get(data, "personastateflags"); -- cgit v1.2.3 From 8b3c1e649624c2f270ade8d6f0fafd8b9cf3e493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sun, 18 Dec 2016 18:52:24 +0100 Subject: Facebook: Fix reaction icon urls (fixes #641) --- protocols/FacebookRM/src/entities.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/protocols/FacebookRM/src/entities.h b/protocols/FacebookRM/src/entities.h index 5274d9d2b2..0026606ca6 100644 --- a/protocols/FacebookRM/src/entities.h +++ b/protocols/FacebookRM/src/entities.h @@ -149,17 +149,17 @@ struct facebook_notification void setIcon(const std::string &iconUrl) { - if (iconUrl == "https://www.facebook.com/rsrc.php/v2/yj/r/6WffvhOaXGY.png") + if (iconUrl == "https://www.facebook.com/rsrc.php/v3/yj/r/6WffvhOaXGY.png") icon = "like"; - else if (iconUrl == "https://www.facebook.com/rsrc.php/v2/y1/r/RvGKklgAefT.png") + else if (iconUrl == "https://www.facebook.com/rsrc.php/v3/y1/r/RvGKklgAefT.png") icon = "love"; - else if (iconUrl == "https://www.facebook.com/rsrc.php/v2/yV/r/McJA2ZjdJmf.png") + else if (iconUrl == "https://www.facebook.com/rsrc.php/v3/yV/r/McJA2ZjdJmf.png") icon = "haha"; - else if (iconUrl == "https://www.facebook.com/rsrc.php/v2/yL/r/IfsimazVjj4.png") + else if (iconUrl == "https://www.facebook.com/rsrc.php/v3/yL/r/IfsimazVjj4.png") icon = "wow"; - else if (iconUrl == "https://www.facebook.com/rsrc.php/v2/yH/r/jOeSrGlcPLG.png") + else if (iconUrl == "https://www.facebook.com/rsrc.php/v3/yH/r/jOeSrGlcPLG.png") icon = "sad"; - else if (iconUrl == "https://www.facebook.com/rsrc.php/v2/yL/r/IfsimazVjj4.png") + else if (iconUrl == "https://www.facebook.com/rsrc.php/v3/y9/r/6K8v8Ju8kL2.png") icon = "angry"; else icon = NULL; -- cgit v1.2.3