[Spice-devel] [PATCH] Update monitor state when it is detached
Frediano Ziglio
fziglio at redhat.com
Mon Aug 15 13:23:26 UTC 2016
>
> The monitor detached state is being set but not updated, in order to update
> it
> we should call ChangeDisplaySettingsEx after setting the appropriate
> flags along with width and height that are set to 0.
>
> Signed-off-by: Sameeh Jubran <sameeh at daynix.com>
> ---
> vdagent/desktop_layout.cpp | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/vdagent/desktop_layout.cpp b/vdagent/desktop_layout.cpp
> index a7666ca..c0632cc 100644
> --- a/vdagent/desktop_layout.cpp
> +++ b/vdagent/desktop_layout.cpp
> @@ -279,7 +279,10 @@ bool DesktopLayout::init_dev_mode(LPCTSTR dev_name,
> DEVMODE* dev_mode, DisplayMo
> if (!mode || !mode->_attached) {
> //Detach monitor
> dev_mode->dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_POSITION;
> - return true;
> + dev_mode->dmPelsWidth = 0;
> + dev_mode->dmPelsHeight = 0;
> + ret = ChangeDisplaySettingsEx(dev_name, dev_mode, NULL,
> CDS_UPDATEREGISTRY, NULL);
> + return (ret == DISP_CHANGE_SUCCESSFUL);
> }
>
> hdc = CreateDC(dev_name, NULL, NULL, NULL);
Looks fine. What's is odd is that DM_POSITION is set but dev_mode->dmPosition
is not set but I think Windows will ignore it as width/height are zeroes.
I assume you tested and it's working with all supported Windows versions so
Acked-by: Frediano Ziglio <fziglio at redhat.com>
Frediano
More information about the Spice-devel
mailing list