summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <freddy77@gmail.com>2020-05-22 20:16:41 +0100
committerFrediano Ziglio <freddy77@gmail.com>2020-07-03 16:51:02 +0100
commitab6a4a0e18fffdeb9791c64b730de0552cf898b7 (patch)
tree0f64c649b30f0b652379706868a5bf68233b2791
parent645aadd34d42299d29dbe47882fe795184c75905 (diff)
Move set_display_depth from VDAgent to DesktopLayout
The function only change DesktopLayout. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Acked-by: Julien Ropé <jrope@redhat.com>
-rw-r--r--vdagent/desktop_layout.cpp17
-rw-r--r--vdagent/desktop_layout.h1
-rw-r--r--vdagent/vdagent.cpp22
3 files changed, 19 insertions, 21 deletions
diff --git a/vdagent/desktop_layout.cpp b/vdagent/desktop_layout.cpp
index bc2a9c7..1b4c706 100644
--- a/vdagent/desktop_layout.cpp
+++ b/vdagent/desktop_layout.cpp
@@ -299,3 +299,20 @@ bool DesktopLayout::init_dev_mode(LPCTSTR dev_name, DEVMODE* dev_mode, DisplayMo
mode->_height = dev_mode->dmPelsHeight;
return true;
}
+
+void DesktopLayout::set_display_depth(uint32_t depth)
+{
+ bool changed = false;
+
+ // setting depth for all the monitors, including unattached ones
+ for (DisplayMode* mode : _displays) {
+ if (mode) {
+ mode->set_depth(depth);
+ changed = true;
+ }
+ }
+
+ if (changed) {
+ set_displays();
+ }
+}
diff --git a/vdagent/desktop_layout.h b/vdagent/desktop_layout.h
index 690b34f..4434fa6 100644
--- a/vdagent/desktop_layout.h
+++ b/vdagent/desktop_layout.h
@@ -75,6 +75,7 @@ public:
DWORD get_total_width() { return _total_width;}
DWORD get_total_height() { return _total_height;}
void set_position_configurable(bool flag);
+ void set_display_depth(uint32_t depth);
private:
void clean_displays();
void normalize_displays_pos();
diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index da8b219..4d73676 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -113,7 +113,6 @@ private:
bool init_vio_serial();
void close_vio_serial();
bool send_input();
- void set_display_depth(uint32_t depth);
void load_display_setting();
bool send_announce_capabilities(bool request);
void cleanup_in_msg();
@@ -791,25 +790,6 @@ HGLOBAL VDAgent::utf8_alloc(LPCSTR data, int size)
return handle;
}
-void VDAgent::set_display_depth(uint32_t depth)
-{
- size_t display_count;
-
- display_count = _desktop_layout->get_display_count();
-
- // setting depth for all the monitors, including unattached ones
- for (uint32_t i = 0; i < display_count; i++) {
- DisplayMode* mode = _desktop_layout->get_display(i);
- if (mode) {
- mode->set_depth(depth);
- }
- }
-
- if (display_count) {
- _desktop_layout->set_displays();
- }
-}
-
void VDAgent::load_display_setting()
{
_display_setting.load();
@@ -911,7 +891,7 @@ bool VDAgent::handle_display_config(const VDAgentDisplayConfig* display_config,
_display_setting.set(disp_setting_opts);
if (display_config->flags & VD_AGENT_DISPLAY_CONFIG_FLAG_SET_COLOR_DEPTH) {
- set_display_depth(display_config->depth);
+ _desktop_layout->set_display_depth(display_config->depth);
}
msg_size = VD_MESSAGE_HEADER_SIZE + sizeof(VDAgentReply);