Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taskbar reimplementation loses position retention #3719

Open
nx5314 opened this issue Sep 19, 2024 · 10 comments
Open

Taskbar reimplementation loses position retention #3719

nx5314 opened this issue Sep 19, 2024 · 10 comments

Comments

@nx5314
Copy link

nx5314 commented Sep 19, 2024

The Windows 10 ExplorerPatcher reimplementation will, upon a restart of explorer.exe, always return the primary taskbar to the primary monitor regardless of whether it was moved to a different monitor. Tested with three displays.

Win11 build 22631.4169
EP buid 22621.3880.66.6

@milesprower2293
Copy link
Collaborator

did you wait for a couple of minutes after relocating the taskbar?

@nx5314
Copy link
Author

nx5314 commented Sep 19, 2024

yeah it doesn't seem to make a difference how long after it is

@pyrates999
Copy link

Is there a setting in EP Properties application, that you set where you change what monitor the taskbar will be on? Or did you just right click on it, untick lock the taskbar, move it, and then reticked lock the taskbar?

Does it do the same thing if you reboot?

@nx5314
Copy link
Author

nx5314 commented Sep 19, 2024

Yes, this is by dragging the taskbar to a new monitor, then locking taskbar again. Doesn't make a difference locked or unlocked, and a full reboot results in the same.

@valinet
Copy link
Owner

valinet commented Sep 19, 2024

I remember a talk about this back when I was enabling the disabled but still there Windows 10 taskbar back in the Windows 11 22000 days. It’s actually a bug/glitch that went on unresolved for so much time that people took it as a feature. I think I did something about it, reimplemented the bug or something, maybe the reimplemented taskbar needs that as well, although my memory is too vague now.

If I find the old thread where this is discussed, maybe it’s a good start for remembering what I actually did and see from there…

@milesprower2293
Copy link
Collaborator

milesprower2293 commented Sep 19, 2024

found those threads related to the 10 taskbar on different monitors:
#171 and #14

@4yx
Copy link

4yx commented Sep 21, 2024

Another thread related to this issue which may be helpful is #504, where the commit af20433 that provided a fix for a similar issue was first referenced.

From what I could find, the change was first introduced in prerelease 22000.348.40.0 on Dec 5, 2021.

The relevant code is still present on dllmain.c:

#pragma region "Remember primary taskbar positioning"
BOOL bTaskbarFirstTimePositioning = FALSE;
BOOL bTaskbarSet = FALSE;
BOOL explorer_SetRect(LPRECT lprc, int xLeft, int yTop, int xRight, int yBottom)
{
BOOL bIgnore = FALSE;
if (bTaskbarFirstTimePositioning)
{
bIgnore = bTaskbarSet;
}
else
{
bTaskbarFirstTimePositioning = TRUE;
bIgnore = (GetSystemMetrics(SM_CMONITORS) == 1);
bTaskbarSet = bIgnore;
}
if (bIgnore)
{
return SetRect(lprc, xLeft, yTop, xRight, yBottom);
}
if (xLeft)
{
return SetRect(lprc, xLeft, yTop, xRight, yBottom);
}
if (yTop)
{
return SetRect(lprc, xLeft, yTop, xRight, yBottom);
}
if (xRight != GetSystemMetrics(SM_CXSCREEN))
{
return SetRect(lprc, xLeft, yTop, xRight, yBottom);
}
if (yBottom != GetSystemMetrics(SM_CYSCREEN))
{
return SetRect(lprc, xLeft, yTop, xRight, yBottom);
}
bTaskbarSet = TRUE;
StuckRectsData srd;
DWORD pcbData = sizeof(StuckRectsData);
RegGetValueW(
HKEY_CURRENT_USER,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StuckRectsLegacy",
L"Settings",
REG_BINARY,
NULL,
&srd,
&pcbData);
if (pcbData != sizeof(StuckRectsData))
{
return SetRect(lprc, xLeft, yTop, xRight, yBottom);
}
if (srd.pvData[0] != sizeof(StuckRectsData))
{
return SetRect(lprc, xLeft, yTop, xRight, yBottom);
}
if (srd.pvData[1] != -2)
{
return SetRect(lprc, xLeft, yTop, xRight, yBottom);
}
HMONITOR hMonitor = MonitorFromRect(&(srd.rc), MONITOR_DEFAULTTOPRIMARY);
MONITORINFO mi;
ZeroMemory(&mi, sizeof(MONITORINFO));
mi.cbSize = sizeof(MONITORINFO);
if (!GetMonitorInfoW(hMonitor, &mi))
{
return SetRect(lprc, xLeft, yTop, xRight, yBottom);
}
if (lprc)
{
*lprc = mi.rcMonitor;
return TRUE;
}
return FALSE;
}
#pragma endregion

VnPatchIAT(hExplorer, "API-MS-WIN-NTUSER-RECTANGLE-L1-1-0.DLL", "SetRect", explorer_SetRect);

@milesprower2293
Copy link
Collaborator

milesprower2293 commented Sep 21, 2024

@nx5314 i can confirm that this issue is present with ep_taskbar on Windows 10

@Solithe
Copy link

Solithe commented Oct 4, 2024

Updated Windows to 24H2 and have the same issue now.

@fdutheil
Copy link

fdutheil commented Oct 9, 2024

Same issue here with same Win11/EP versions on 2 displays.
Restarting EP or reboot Win11 reset the primary taskbar to the primary monitor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants