Re: [PATCH] Update monitor state when it is detached

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> 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@xxxxxxxxxx>
> ---
>  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@xxxxxxxxxx>

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]