question

MartinFleisz-4644 avatar image
0 Votes"
MartinFleisz-4644 asked RitaHan-MSFT commented

WM_SETTINGSCHANGED not sent when changing monitor layout

I have a strange problem with my Qt application in a multi-monitor environment. I already filed an issue with Qt here: https://bugreports.qt.io/browse/QTBUG-79442 and I think this is indeed an issue with Windows 10, rather than with Qt framework.

The problem is as follows:
When I change the layout of my monitors i.e. from [1][2] to [2][1] the application will receive the WM_SETTINGSCHANGED message with SPI_SETWORKAREA that the Qt framework relies upon in order to update the monitor layout information.
However when I set "Show taskbar on all displays" to OFF - the OS stops sending this window message when changing monitor layouts. I would assume that the message is still sent as the workarea still changes (the virtual coordinate space) - no matter if the taskbar is displayed on all monitors or just on the primary.

The documentation is not 100% clear under what situations WM_SETTINGSCHANGED is sent but from an application's point of view I'd expect it to be sent regardless of this taskbar settings when the monitor layout is changed.

In order to get this fixed it is essential to know whether this is behavior by design or an error in Windows 10.

Thanks for any help.

Martin

windows-api
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

RitaHan-MSFT avatar image
0 Votes"
RitaHan-MSFT answered RitaHan-MSFT commented

Hello @MartinFleisz-4644,

I can reproduce this issue using Win32 C++ application without Qt.

SPI_SETWORKAREA is used for setting the size of the work area. The work area is the portion of the screen not obscured by the system taskbar or by application desktop toolbars. So working area depends on the taskbar. When "Show taskbar on all displays" is OFF, taskbar only occupies part of screen of the primary display. This will not be changed when you rearrange display 1 and 2. So the SPI_SETWORKAREA is not sent seems expected.

If you want to monitor event of rearranging display from [1][2] to [2][3], you can use WM_DISPLAYCHANGE message.

Thank you!



If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @RitaHan-MSFT,

yes you are right. I guess this is because the primary screen (that possesses the taskbar) is always located at virtual screen coordinates 0/0 so its working area never changes - no matter how the layout of the other monitors might changes.
Thanks for clarification on this subject.

Cheers, Martin

0 Votes 0 ·

Glad it helps. :)

0 Votes 0 ·