summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2014-06-19 19:15:37 +0200
committerMarc-André Lureau <marcandre.lureau@redhat.com>2014-06-19 19:15:39 +0200
commit6d1c038a8c8127206cfa17970a23ed6b3fe047cc (patch)
tree93261e339b3c1cf634d39f18c09929e82ce92cc8
parent8588daa1e0530fd6517fd0b8edb01018c7b77805 (diff)
Don't refresh displays config when updating
wnd_proc() is called during ChangeDisplaySettings(), when handling monitors config. However, calling get_displays() will overwrite the desired config. So, while updating from 1 to 4 enabled monitors, when the 2nd monitor config is enabled, the current config is read, and overwrite the rest of the config, so first time only 2nd monitor is enabled, second time, 3rd monitor etc. https://bugzilla.redhat.com/show_bug.cgi?id=1111144
-rw-r--r--vdagent/vdagent.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index 15216d9..aa44383 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -148,6 +148,7 @@ private:
bool _running;
bool _desktop_switch;
DesktopLayout* _desktop_layout;
+ bool _updating_display_config;
DisplaySetting _display_setting;
FileXfer _file_xfer;
HANDLE _vio_serial;
@@ -615,11 +616,14 @@ bool VDAgent::handle_mouse_event(VDAgentMouseState* state)
bool VDAgent::handle_mon_config(VDAgentMonitorsConfig* mon_config, uint32_t port)
{
+ VDAgent* a = _singleton;
VDIChunk* reply_chunk;
VDAgentMessage* reply_msg;
VDAgentReply* reply;
size_t display_count;
+ a->_updating_display_config = true;
+
display_count = _desktop_layout->get_display_count();
for (uint32_t i = 0; i < display_count; i++) {
DisplayMode* mode = _desktop_layout->get_display(i);
@@ -649,6 +653,10 @@ bool VDAgent::handle_mon_config(VDAgentMonitorsConfig* mon_config, uint32_t port
_desktop_layout->set_displays();
}
+ a->_updating_display_config = false;
+ /* refresh again, in case something else changed */
+ a->_desktop_layout->get_displays();
+
DWORD msg_size = VD_MESSAGE_HEADER_SIZE + sizeof(VDAgentReply);
reply_chunk = new_chunk(msg_size);
if (!reply_chunk) {
@@ -1439,7 +1447,8 @@ LRESULT CALLBACK VDAgent::wnd_proc(HWND hwnd, UINT message, WPARAM wparam, LPARA
vd_printf("Display change");
// the desktop layout needs to be updated for the mouse
// position to be scaled correctly
- a->_desktop_layout->get_displays();
+ if (!a->_updating_display_config)
+ a->_desktop_layout->get_displays();
break;
case WM_TIMER:
a->send_input();