From c9c2324e4f13e66c75d886f94dbacac1e28b191f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 12 May 2025 17:25:26 +0300 Subject: fixes #5009 ("Pin to desktop" option doesn't work in all modern Windows) --- src/core/stdclist/res/resource.rc | 2 +- src/core/stdclist/src/cluiopts.cpp | 13 +- src/core/stdclist/src/resource.h | 1 - src/mir_app/mir_app.vcxproj | 1 - src/mir_app/mir_app.vcxproj.filters | 3 - src/mir_app/src/Docking.cpp | 363 ------------------------------------ src/mir_app/src/clc.h | 3 - src/mir_app/src/clistcore.cpp | 2 - src/mir_app/src/clistmod.cpp | 3 - src/mir_app/src/clui.cpp | 46 ++--- src/mir_app/src/mir_app.def | 1 - src/mir_app/src/mir_app64.def | 1 - 12 files changed, 17 insertions(+), 422 deletions(-) delete mode 100644 src/mir_app/src/Docking.cpp (limited to 'src') diff --git a/src/core/stdclist/res/resource.rc b/src/core/stdclist/res/resource.rc index ce968e2919..5e6578915c 100644 --- a/src/core/stdclist/res/resource.rc +++ b/src/core/stdclist/res/resource.rc @@ -79,7 +79,7 @@ BEGIN EDITTEXT IDC_TITLETEXT,63,100,72,12,ES_AUTOHSCROLL CONTROL "Show drop shadow (restart required)",IDC_DROPSHADOW, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,117,138,10 - CONTROL "Pin to desktop",IDC_ONDESKTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,131,128,10 + CONTROL "Hide contact list after it has been idle for",IDC_AUTOHIDE, "Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,141,18,162,10 EDITTEXT IDC_HIDETIME,151,32,30,12,ES_RIGHT | ES_NUMBER diff --git a/src/core/stdclist/src/cluiopts.cpp b/src/core/stdclist/src/cluiopts.cpp index 61d5baca69..46b341e853 100644 --- a/src/core/stdclist/src/cluiopts.cpp +++ b/src/core/stdclist/src/cluiopts.cpp @@ -48,7 +48,6 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L CheckDlgButton(hwndDlg, IDC_FADEINOUT, db_get_b(0, "CLUI", "FadeInOut", 0)); CheckDlgButton(hwndDlg, IDC_AUTOSIZE, db_get_b(0, "CLUI", "AutoSize", 0)); CheckDlgButton(hwndDlg, IDC_DROPSHADOW, g_plugin.getByte("WindowShadow", 0)); - CheckDlgButton(hwndDlg, IDC_ONDESKTOP, g_plugin.getByte("OnDesktop", 0)); CheckDlgButton(hwndDlg, IDC_DISABLEDOCKING, db_get_b(0, "CLUI", "DockToSides", 1)); SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETPOS, 0, db_get_b(0, "CLUI", "MaxSizeHeight", 75)); @@ -157,7 +156,6 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L Clist::iAlpha = SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0); Clist::iAutoAlpha = SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0); g_plugin.setByte("WindowShadow", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_DROPSHADOW)); - g_plugin.setByte("OnDesktop", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)); db_set_b(0, "CLUI", "DockToSides", (uint8_t)IsDlgButtonChecked(hwndDlg, IDC_DISABLEDOCKING)); Clist::bShowCaption = IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION); Clist::bShowMainMenu = IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU); @@ -186,15 +184,10 @@ static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SetWindowPlacement(g_clistApi.hwndContactList, &p); } else - SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE) & ~WS_EX_TOOLWINDOW | WS_EX_APPWINDOW); + SetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE, + GetWindowLongPtr(g_clistApi.hwndContactList, GWL_EXSTYLE) & ~WS_EX_TOOLWINDOW | WS_EX_APPWINDOW); - if (IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)) { - HWND hProgMan = FindWindow(L"Progman", nullptr); - if (hProgMan) - SetParent(g_clistApi.hwndContactList, hProgMan); - } - else - SetParent(g_clistApi.hwndContactList, nullptr); + SetParent(g_clistApi.hwndContactList, nullptr); if (IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)) { int style = GetWindowLongPtr(g_clistApi.hwndContactList, GWL_STYLE) | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX; diff --git a/src/core/stdclist/src/resource.h b/src/core/stdclist/src/resource.h index 6e4960668e..f925adfa1c 100644 --- a/src/core/stdclist/src/resource.h +++ b/src/core/stdclist/src/resource.h @@ -114,7 +114,6 @@ #define IDC_DROPSHADOW 1612 #define IDC_SHOWGRIP 1612 #define IDC_NOSCROLLBAR 1613 -#define IDC_ONDESKTOP 1657 #define IDC_DISABLEDOCKING 1658 #define IDC_WINCOLOUR 1659 #define IDC_MOVE_OFFLINE_BOTTOM 1662 diff --git a/src/mir_app/mir_app.vcxproj b/src/mir_app/mir_app.vcxproj index 8ba67cd5d1..b9afb141b1 100644 --- a/src/mir_app/mir_app.vcxproj +++ b/src/mir_app/mir_app.vcxproj @@ -68,7 +68,6 @@ false 4652;%(DisableSpecificWarnings) - diff --git a/src/mir_app/mir_app.vcxproj.filters b/src/mir_app/mir_app.vcxproj.filters index 554aeccc7d..8a0de1ff64 100644 --- a/src/mir_app/mir_app.vcxproj.filters +++ b/src/mir_app/mir_app.vcxproj.filters @@ -365,9 +365,6 @@ Source Files\Contact list - - Source Files\Contact list - Source Files\Plugins diff --git a/src/mir_app/src/Docking.cpp b/src/mir_app/src/Docking.cpp deleted file mode 100644 index 9012b09568..0000000000 --- a/src/mir_app/src/Docking.cpp +++ /dev/null @@ -1,363 +0,0 @@ -/* - -Miranda NG: the free IM client for Microsoft* Windows* - -Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org), -Copyright (c) 2000-12 Miranda IM project, -all portions of this codebase are copyrighted to the people -listed in contributors.txt. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "stdafx.h" -#include "clc.h" - -#define WM_DOCKCALLBACK (WM_USER+121) -#define EDGESENSITIVITY 3 - -#define DOCKED_NONE 0 -#define DOCKED_LEFT 1 -#define DOCKED_RIGHT 2 - -static int docked; -static POINT dockPos; - -static void Docking_GetMonitorRectFromPoint(LPPOINT pt, LPRECT rc) -{ - MONITORINFO monitorInfo; - HMONITOR hMonitor = MonitorFromPoint(*pt, MONITOR_DEFAULTTONEAREST); // always returns a valid value - monitorInfo.cbSize = sizeof(monitorInfo); - - if (GetMonitorInfo(hMonitor, &monitorInfo)) { - *rc = monitorInfo.rcMonitor; - return; - } - - // "generic" win95/NT support, also serves as failsafe - rc->left = 0; - rc->top = 0; - rc->bottom = GetSystemMetrics(SM_CYSCREEN); - rc->right = GetSystemMetrics(SM_CXSCREEN); -} - -static void Docking_RectToDock(LPRECT rc) -{ - rc->right += dockPos.x - rc->left; - rc->left = dockPos.x; - rc->bottom += dockPos.y - rc->top; - rc->top = dockPos.y; -} - -static void Docking_PosCommand(HWND hwnd, LPRECT rc, bool query) -{ - APPBARDATA abd = { 0 }; - - abd.cbSize = sizeof(abd); - abd.hWnd = hwnd; - abd.uEdge = docked == DOCKED_LEFT ? ABE_LEFT : ABE_RIGHT; - abd.rc = *rc; - SHAppBarMessage(query ? ABM_QUERYPOS : ABM_SETPOS, &abd); - *rc = abd.rc; -} - -static UINT_PTR Docking_Command(HWND hwnd, int cmd) -{ - APPBARDATA abd = { 0 }; - - abd.cbSize = sizeof(abd); - abd.hWnd = hwnd; - abd.uCallbackMessage = WM_DOCKCALLBACK; - return SHAppBarMessage(cmd, &abd); -} - -static void Docking_AdjustPosition(HWND hwnd, LPRECT rcDisplay, LPRECT rc, bool query, bool move) -{ - int cx = rc->right - rc->left; - - rc->top = rcDisplay->top; - rc->bottom = rcDisplay->bottom; - if (docked == DOCKED_LEFT) { - rc->right = rcDisplay->left + (rc->right - rc->left); - rc->left = rcDisplay->left; - } - else { - rc->left = rcDisplay->right - (rc->right - rc->left); - rc->right = rcDisplay->right; - } - Docking_PosCommand(hwnd, rc, true); - - if (docked == DOCKED_LEFT) - rc->right = rc->left + cx; - else - rc->left = rc->right - cx; - - if (!query) { - Docking_PosCommand(hwnd, rc, false); - dockPos = *(LPPOINT)rc; - } - - if (move) - MoveWindow(hwnd, rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top, TRUE); -} - -static void Docking_SetSize(HWND hwnd, LPRECT rc, bool query, bool move) -{ - RECT rcMonitor; - Docking_GetMonitorRectFromPoint( - docked == DOCKED_LEFT && !query ? (LPPOINT)&rc->right : (LPPOINT)rc, &rcMonitor); - Docking_AdjustPosition(hwnd, &rcMonitor, rc, query, move); -} - -static bool Docking_IsWindowVisible(HWND hwnd) -{ - LONG style = GetWindowLongPtr(hwnd, GWL_STYLE); - return style & WS_VISIBLE && !(style & WS_MINIMIZE); -} - -MIR_APP_DLL(BOOL) Clist_IsDocked() -{ - return docked; -} - -int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) -{ - static int draggingTitle; - MSG *msg = (MSG *)wParam; - - if (msg->message == WM_DESTROY) { - if (docked) { - db_set_b(0, "CList", "Docked", (uint8_t)docked); - db_set_dw(0, "CList", "DockX", (uint32_t)dockPos.x); - db_set_dw(0, "CList", "DockY", (uint32_t)dockPos.y); - } - else { - db_unset(0, "CList", "Docked"); - db_unset(0, "CList", "DockX"); - db_unset(0, "CList", "DockY"); - } - } - - if (!docked && msg->message != WM_CREATE && msg->message != WM_MOVING) - return 0; - - switch (msg->message) { - case WM_CREATE: - draggingTitle = 0; - docked = db_get_b(0, "CLUI", "DockToSides", 1) ? - (char)db_get_b(0, "CList", "Docked", 0) : 0; - dockPos.x = (int)db_get_dw(0, "CList", "DockX", 0); - dockPos.y = (int)db_get_dw(0, "CList", "DockY", 0); - break; - - case WM_ACTIVATE: - Docking_Command(msg->hwnd, ABM_ACTIVATE); - break; - - case WM_WINDOWPOSCHANGING: - { - LPWINDOWPOS wp = (LPWINDOWPOS)msg->lParam; - - bool vis = Docking_IsWindowVisible(msg->hwnd); - if (wp->flags & SWP_SHOWWINDOW) - vis = !IsIconic(msg->hwnd); - if (wp->flags & SWP_HIDEWINDOW) - vis = false; - - if (vis) { - if (!(wp->flags & (SWP_NOMOVE | SWP_NOSIZE))) { - bool addbar = Docking_Command(msg->hwnd, ABM_NEW) != 0; - - RECT rc = { 0 }; - GetWindowRect(msg->hwnd, &rc); - - int cx = rc.right - rc.left; - if (!(wp->flags & SWP_NOMOVE)) { rc.left = wp->x; rc.top = wp->y; } - - if (addbar) - Docking_RectToDock(&rc); - - if (!(wp->flags & SWP_NOSIZE)) { - rc.right = rc.left + wp->cx; - rc.bottom = rc.top + wp->cy; - addbar |= (cx != wp->cx); - } - - Docking_SetSize(msg->hwnd, &rc, !addbar, false); - - if (!(wp->flags & SWP_NOMOVE)) { wp->x = rc.left; wp->y = rc.top; } - if (!(wp->flags & SWP_NOSIZE)) wp->cy = rc.bottom - rc.top; - - *((LRESULT *)lParam) = TRUE; - return TRUE; - } - else { - if ((wp->flags & SWP_SHOWWINDOW) && Docking_Command(msg->hwnd, ABM_NEW)) { - RECT rc = { 0 }; - GetWindowRect(msg->hwnd, &rc); - Docking_RectToDock(&rc); - - Docking_SetSize(msg->hwnd, &rc, false, false); - - wp->x = rc.left; - wp->y = rc.top; - wp->cy = rc.bottom - rc.top; - wp->cx = rc.right - rc.left; - wp->flags &= ~(SWP_NOSIZE | SWP_NOMOVE); - } - } - } - } - break; - - case WM_WINDOWPOSCHANGED: - { - LPWINDOWPOS wp = (LPWINDOWPOS)msg->lParam; - bool vis = Docking_IsWindowVisible(msg->hwnd); - if (wp->flags & SWP_SHOWWINDOW) - vis = !IsIconic(msg->hwnd); - if (wp->flags & SWP_HIDEWINDOW) - vis = false; - - if (!vis) - Docking_Command(msg->hwnd, ABM_REMOVE); - else - Docking_Command(msg->hwnd, ABM_WINDOWPOSCHANGED); - } - break; - - case WM_DISPLAYCHANGE: - if (Docking_IsWindowVisible(msg->hwnd)) { - RECT rc = { 0 }; - GetWindowRect(msg->hwnd, &rc); - Docking_RectToDock(&rc); - Docking_SetSize(msg->hwnd, &rc, false, true); - } - break; - - case WM_MOVING: - if (!docked) { - RECT rcMonitor; - POINT ptCursor; - - // stop early - if (GetAsyncKeyState(VK_CONTROL) & 0x8000) - return 0; - - // GetMessagePos() is no good, position is always unsigned - // GetCursorPos(&ptCursor); - uint32_t pos = GetMessagePos(); - ptCursor.x = GET_X_LPARAM(pos); - ptCursor.y = GET_Y_LPARAM(pos); - Docking_GetMonitorRectFromPoint(&ptCursor, &rcMonitor); - - if (((ptCursor.x < rcMonitor.left + EDGESENSITIVITY) || - (ptCursor.x >= rcMonitor.right - EDGESENSITIVITY)) && - db_get_b(0, "CLUI", "DockToSides", 1)) { - docked = (ptCursor.x < rcMonitor.left + EDGESENSITIVITY) ? DOCKED_LEFT : DOCKED_RIGHT; - PostMessage(msg->hwnd, WM_LBUTTONUP, 0, MAKELPARAM(ptCursor.x, ptCursor.y)); - - Docking_Command(msg->hwnd, ABM_NEW); - Docking_AdjustPosition(msg->hwnd, &rcMonitor, (LPRECT)msg->lParam, false, true); - - *((LRESULT *)lParam) = TRUE; - return TRUE; - } - } - break; - - case WM_NCHITTEST: - switch (DefWindowProc(msg->hwnd, WM_NCHITTEST, msg->wParam, msg->lParam)) { - case HTSIZE: case HTTOP: case HTTOPLEFT: case HTTOPRIGHT: - case HTBOTTOM: case HTBOTTOMRIGHT: case HTBOTTOMLEFT: - *((LRESULT *)lParam) = HTCLIENT; - return TRUE; - - case HTLEFT: - if (docked == DOCKED_LEFT) { - *((LRESULT *)lParam) = HTCLIENT; - return TRUE; - } - break; - - case HTRIGHT: - if (docked == DOCKED_RIGHT) { - *((LRESULT *)lParam) = HTCLIENT; - return TRUE; - } - break; - } - break; - - case WM_SYSCOMMAND: - if ((msg->wParam & 0xFFF0) != SC_MOVE) - return 0; - - SetActiveWindow(msg->hwnd); - SetCapture(msg->hwnd); - draggingTitle = 1; - *((LRESULT *)lParam) = 0; - return 1; - - case WM_MOUSEMOVE: - if (draggingTitle) { - RECT rc; - POINT pt; - GetClientRect(msg->hwnd, &rc); - if ((docked == DOCKED_LEFT && (short)LOWORD(msg->lParam) > rc.right) || - (docked == DOCKED_RIGHT && (short)LOWORD(msg->lParam) < 0)) { - ReleaseCapture(); - draggingTitle = 0; - docked = 0; - GetCursorPos(&pt); - PostMessage(msg->hwnd, WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(pt.x, pt.y)); - SetWindowPos(msg->hwnd, nullptr, pt.x - rc.right / 2, - pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2, - db_get_dw(0, "CList", "Width", 0), - db_get_dw(0, "CList", "Height", 0), - SWP_NOZORDER); - Docking_Command(msg->hwnd, ABM_REMOVE); - } - return 1; - } - break; - - case WM_LBUTTONUP: - if (draggingTitle) { - ReleaseCapture(); - draggingTitle = 0; - } - break; - - case WM_DOCKCALLBACK: - switch (msg->wParam) { - case ABN_WINDOWARRANGE: - ShowWindow(msg->hwnd, msg->lParam ? SW_HIDE : SW_SHOW); - break; - - case ABN_POSCHANGED: - RECT rc = { 0 }; - GetWindowRect(msg->hwnd, &rc); - Docking_SetSize(msg->hwnd, &rc, false, true); - break; - } - return 1; - - case WM_DESTROY: - Docking_Command(msg->hwnd, ABM_REMOVE); - break; - } - return 0; -} diff --git a/src/mir_app/src/clc.h b/src/mir_app/src/clc.h index bd6ccd49c0..721f6b462b 100644 --- a/src/mir_app/src/clc.h +++ b/src/mir_app/src/clc.h @@ -167,9 +167,6 @@ int LoadCLUIModule(void); /* contact.c */ int fnSetHideOffline(int iValue); -/* docking.c */ -int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam); - // clistgroups.cpp struct CGroupInternal diff --git a/src/mir_app/src/clistcore.cpp b/src/mir_app/src/clistcore.cpp index ec2fea7923..22d1a35825 100644 --- a/src/mir_app/src/clistcore.cpp +++ b/src/mir_app/src/clistcore.cpp @@ -123,8 +123,6 @@ void InitClistCore() g_clistApi.pfnSetHideOffline = fnSetHideOffline; - g_clistApi.pfnDocking_ProcessWindowMessage = fnDocking_ProcessWindowMessage; - g_clistApi.pfnGetIconFromStatusMode = fnGetIconFromStatusMode; g_clistApi.pfnGetWindowVisibleState = fnGetWindowVisibleState; g_clistApi.pfnIconFromStatusMode = fnIconFromStatusMode; diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index dede1547b0..ef5d2611d3 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -284,9 +284,6 @@ int fnGetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) if (IsIconic(hWnd) || !IsWindowVisible(hWnd)) return GWVS_HIDDEN; - if (Clist_IsDocked()) - return GWVS_VISIBLE; - GetWindowRect(hWnd, &rcWin); SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, FALSE); diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index ea8280d428..707b8800cf 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -264,8 +264,6 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l m.message = msg; m.wParam = wParam; m.lParam = lParam; - if (g_clistApi.pfnDocking_ProcessWindowMessage((WPARAM)&m, (LPARAM)&result)) - return result; if (g_clistApi.pfnTrayIconProcessMessage((WPARAM)&m, (LPARAM)&result)) return result; @@ -332,12 +330,6 @@ int LoadCLUIModule(void) pos.left, pos.top, pos.right - pos.left, pos.bottom - pos.top, nullptr, nullptr, g_clistApi.hInst, nullptr); - if (db_get_b(0, "CList", "OnDesktop", 0)) { - HWND hProgMan = FindWindow(L"Progman", nullptr); - if (IsWindow(hProgMan)) - SetParent(g_clistApi.hwndContactList, hProgMan); - } - HookEvent(ME_LANGPACK_CHANGED, CluiLangpackChanged); CluiLangpackChanged(0, 0); @@ -547,18 +539,15 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (db_get_b(0, "CList", "DisableWorkingSet", 1)) SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1); } - // drop thru + __fallthrough; + case WM_MOVE: if (!IsIconic(hwnd)) { RECT rc; GetWindowRect(hwnd, &rc); - - //if docked, dont remember pos (except for width) - if (!Clist_IsDocked()) { - db_set_dw(0, "CList", "Height", (uint32_t)(rc.bottom - rc.top)); - db_set_dw(0, "CList", "x", (uint32_t)rc.left); - db_set_dw(0, "CList", "y", (uint32_t)rc.top); - } + db_set_dw(0, "CList", "Height", (uint32_t)(rc.bottom - rc.top)); + db_set_dw(0, "CList", "x", (uint32_t)rc.left); + db_set_dw(0, "CList", "y", (uint32_t)rc.top); db_set_dw(0, "CList", "Width", (uint32_t)(rc.right - rc.left)); } return FALSE; @@ -725,7 +714,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return 0; case WM_SETTINGCHANGE: - if (wParam == SPI_SETWORKAREA && (GetWindowLongPtr(hwnd, GWL_STYLE) & (WS_VISIBLE | WS_MINIMIZE)) == WS_VISIBLE && !Clist_IsDocked()) { + if (wParam == SPI_SETWORKAREA && (GetWindowLongPtr(hwnd, GWL_STYLE) & (WS_VISIBLE | WS_MINIMIZE)) == WS_VISIBLE) { RECT rc; GetWindowRect(hwnd, &rc); if (Utils_AssertInsideScreen(&rc) == 1) @@ -783,15 +772,10 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return Clist_MenuProcessHotkey(((NMKEY*)lParam)->nVKey); case CLN_LISTSIZECHANGE: - { - RECT rcWindow, rcTree, rcWorkArea; - int maxHeight, newHeight; + if (db_get_b(0, "CLUI", "AutoSize", 0)) { + int maxHeight = db_get_b(0, "CLUI", "MaxSizeHeight", 75); - if (!db_get_b(0, "CLUI", "AutoSize", 0)) - break; - if (Clist_IsDocked()) - break; - maxHeight = db_get_b(0, "CLUI", "MaxSizeHeight", 75); + RECT rcWindow, rcTree, rcWorkArea; GetWindowRect(hwnd, &rcWindow); GetWindowRect(g_clistApi.hwndContactTree, &rcTree); @@ -802,7 +786,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (GetMonitorInfo(hMon, &mi)) rcWorkArea = mi.rcWork; - newHeight = max(nmc->pt.y, LONG(9)) + 1 + (rcWindow.bottom - rcWindow.top) - (rcTree.bottom - rcTree.top); + int newHeight = max(nmc->pt.y, LONG(9)) + 1 + (rcWindow.bottom - rcWindow.top) - (rcTree.bottom - rcTree.top); if (newHeight > (rcWorkArea.bottom - rcWorkArea.top) * maxHeight / 100) newHeight = (rcWorkArea.bottom - rcWorkArea.top) * maxHeight / 100; if (db_get_b(0, "CLUI", "AutoSizeUpward", 0)) { @@ -1012,13 +996,9 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (!IsIconic(hwnd)) { RECT rc; GetWindowRect(hwnd, &rc); - - //if docked, dont remember pos (except for width) - if (!Clist_IsDocked()) { - db_set_dw(0, "CList", "Height", (uint32_t)(rc.bottom - rc.top)); - db_set_dw(0, "CList", "x", (uint32_t)rc.left); - db_set_dw(0, "CList", "y", (uint32_t)rc.top); - } + db_set_dw(0, "CList", "Height", (uint32_t)(rc.bottom - rc.top)); + db_set_dw(0, "CList", "x", (uint32_t)rc.left); + db_set_dw(0, "CList", "y", (uint32_t)rc.top); db_set_dw(0, "CList", "Width", (uint32_t)(rc.right - rc.left)); } diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index fe6aefe6cd..f5b4697d98 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -185,7 +185,6 @@ Window_SetIcon_IcoLib @265 Clist_Broadcast @266 NONAME Clist_BroadcastAsync @267 NONAME Clist_MenuProcessCommand @268 -Clist_IsDocked @269 Clist_MenuProcessHotkey @270 Clist_ContactChangeGroup @271 Clist_ContactCompare @272 diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 987822ddc2..bb13b5bd53 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -185,7 +185,6 @@ Window_SetIcon_IcoLib @265 Clist_Broadcast @266 NONAME Clist_BroadcastAsync @267 NONAME Clist_MenuProcessCommand @268 -Clist_IsDocked @269 Clist_MenuProcessHotkey @270 Clist_ContactChangeGroup @271 Clist_ContactCompare @272 -- cgit v1.2.3