[Spice-commits] 2 commits - vdagent/desktop_layout.cpp vdagent/vdagent.cpp

Marc-André Lureau elmarco at kemper.freedesktop.org
Sat Mar 16 10:31:37 PDT 2013


 vdagent/desktop_layout.cpp |    6 ++++++
 vdagent/vdagent.cpp        |    2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 0ba6e29363856b84fbefb9e4f59f8450e0e57789
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Sat Mar 16 00:56:18 2013 +0100

    Reattach monitors
    
    Teach vdagent to attach monitors. A monitor needs to be enabled before
    we can set the custom resolution. Fortunately, the client doesn't seem
    to have time to catch that, so things are smooth.
    
    This is require to allow the virt-viewer display menu to work properly
    and enable extra monitors: https://bugzilla.redhat.com/show_bug.cgi?id=919530

diff --git a/vdagent/desktop_layout.cpp b/vdagent/desktop_layout.cpp
index 7cb2f4b..bce9ac0 100644
--- a/vdagent/desktop_layout.cpp
+++ b/vdagent/desktop_layout.cpp
@@ -243,6 +243,7 @@ bool DesktopLayout::init_dev_mode(LPCTSTR dev_name, DEVMODE* dev_mode, DisplayMo
     DWORD best = -1;
     QXLEscapeSetCustomDisplay custom;
     HDC hdc = NULL;
+    LONG ret;
 
     ZeroMemory(dev_mode, sizeof(DEVMODE));
     dev_mode->dmSize = sizeof(DEVMODE);
@@ -252,6 +253,11 @@ bool DesktopLayout::init_dev_mode(LPCTSTR dev_name, DEVMODE* dev_mode, DisplayMo
         return true;
     }
 
+    // attach
+    EnumDisplaySettings(dev_name, ENUM_CURRENT_SETTINGS, dev_mode);
+    ret = ChangeDisplaySettingsEx(dev_name, dev_mode, NULL, CDS_UPDATEREGISTRY, NULL);
+    vd_printf("attach %d", ret);
+
     // Update custom resolution
     custom.xres = mode->_width;
     custom.yres = mode->_height;
commit 67c1bcf49367d1726033b298a8ab016b4e22cf23
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Sat Mar 16 00:55:15 2013 +0100

    Refresh monitor config only when needed
    
    Somehow wnd_proc()->get_display() may be reentered during ChangeDisplaySettings

diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index 6f2a49c..c56025d 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -579,6 +579,7 @@ bool VDAgent::handle_mon_config(VDAgentMonitorsConfig* mon_config, uint32_t port
     VDAgentReply* reply;
     size_t display_count;
 
+    _desktop_layout->get_displays();
     display_count = _desktop_layout->get_display_count();
     for (uint32_t i = 0; i < display_count; i++) {
         DisplayMode* mode = _desktop_layout->get_display(i);
@@ -1327,7 +1328,6 @@ LRESULT CALLBACK VDAgent::wnd_proc(HWND hwnd, UINT message, WPARAM wparam, LPARA
     switch (message) {
     case WM_DISPLAYCHANGE:
         vd_printf("Display change");
-        a->_desktop_layout->get_displays();
         break;
     case WM_TIMER:
         a->send_input();


More information about the Spice-commits mailing list