Skip to content

fix: display changes leave "ghost" taskbar area on main monitor - #5225

Open
bogenpirat wants to merge 1 commit into
valinet:masterfrom
bogenpirat:bugfix/ghost-area-after-hdr-switch
Open

bogenpirat wants to merge 1 commit into
valinet:masterfrom
bogenpirat:bugfix/ghost-area-after-hdr-switch

Conversation

@bogenpirat

Copy link
Copy Markdown

setup

  • windows 11, latest stable EP build, multi-monitor
  • main monitor & secondary monitor
  • EP task bar style set to Windows 10, "show taskbar on all displays" is off
  • task bar permanently moved from main monitor to secondary monitor

reproduce

the display configuration is changed, e.g. by turning HDR off/on on one of the screens, or changing the refresh rate(s)

symptoms

  • the change leaves an empty, taskbar-sized strip at the bottom of the primary monitor
  • window-snapping tools such as aquasnap will snap windows to the upper edge of the taskbar-sized strip, not to the bottom edge of the screen
  • drawing a select-box on the desktop clips at the upper edge of the taskbar-sized strip
  • right-clicking the area opens the desktop's context menu, but several hundred pixels shifted upwards

underlying issue, summarized by opus

Before applying a display change, the system sends message 0x344 to the taskman window (MSTaskSwWClass) to get predicted work areas for each monitor, then applies them with the change. No hidden window is involved; only the work areas are wrong. CTray::GuessStuckRectPlaceAndSizeAfterRecalc assumes the taskbar is on the primary monitor unless it's shown on all displays. That holds for the Windows 11 taskbar, but the Windows 10 taskbar can be moved, so the taskbar's space gets reserved on the wrong monitor. Nothing corrects it afterwards because the taskbar itself didn't change, so Explorer doesn't recompute the work areas.

description of the fix, work done by opus as well

Subclass MSTaskSwWClass and return 0 from 0x344 when the taskbar is on a non-primary monitor and no secondary taskbars exist. This is the same "no prediction" result CTray::FillInDisplayChangeData returns when an appbar occupies screen space. Other configurations keep the existing behavior.

@pyrates999

Copy link
Copy Markdown

was this done using ai?

@bogenpirat

Copy link
Copy Markdown
Author

yes, it was

@pyrates999

Copy link
Copy Markdown

you must understand the code you are submitting before submitting it.

@bogenpirat

Copy link
Copy Markdown
Author

is this general educational advice, or does the code have room for improvement in any specific places?

i'm an SWE by trade, but haven't worked much on windows internals as this project surely warrants. there's a fair chance that despite thinking i've got a reasonable grasp of what the fix does, i've missed something in the bigger picture.

@pyrates999

Copy link
Copy Markdown

we don't accept code that is generated by ai.

@bogenpirat

Copy link
Copy Markdown
Author

shame, but i understand. feel free to close this, then.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants