[Spice-commits] vdagent/desktop_layout.cpp

Frediano Ziglio fziglio at kemper.freedesktop.org
Tue Aug 16 05:39:43 UTC 2016


 vdagent/desktop_layout.cpp |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 714801261f19c12f1552dcc927af30d4653a5110
Author: Sameeh Jubran <sameeh at daynix.com>
Date:   Mon Aug 15 15:30:19 2016 +0300

    Update monitor state when it is detached
    
    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>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

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);


More information about the Spice-commits mailing list