[Spice-commits] 3 commits - vdagent/desktop_layout.cpp vdagent/desktop_layout.h vdagent/vdagent.cpp
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jul 3 15:52:07 UTC 2020
vdagent/desktop_layout.cpp | 28 +++++++++++++++++++++-------
vdagent/desktop_layout.h | 1 +
vdagent/vdagent.cpp | 22 +---------------------
3 files changed, 23 insertions(+), 28 deletions(-)
New commits:
commit 6fea9f59a760cbc1655de0d11a8abfa6567ae951
Author: Frediano Ziglio <freddy77 at gmail.com>
Date: Fri May 22 20:17:41 2020 +0100
desktop_layout: Update container iteration syntax
Signed-off-by: Frediano Ziglio <freddy77 at gmail.com>
Acked-by: Julien Ropé <jrope at redhat.com>
diff --git a/vdagent/desktop_layout.cpp b/vdagent/desktop_layout.cpp
index 1b4c706..07074da 100644
--- a/vdagent/desktop_layout.cpp
+++ b/vdagent/desktop_layout.cpp
@@ -188,15 +188,12 @@ void DesktopLayout::set_position_configurable(bool flag)
// the virtual desktop. Caller is responsible to lock() & unlock().
void DesktopLayout::normalize_displays_pos()
{
- Displays::iterator iter;
- DisplayMode* mode;
LONG min_x = 0;
LONG min_y = 0;
LONG max_x = 0;
LONG max_y = 0;
- for (iter = _displays.begin(); iter != _displays.end(); iter++) {
- mode = *iter;
+ for (DisplayMode *mode : _displays) {
if (mode && mode->_attached) {
min_x = min(min_x, mode->_pos_x);
min_y = min(min_y, mode->_pos_y);
@@ -205,8 +202,7 @@ void DesktopLayout::normalize_displays_pos()
}
}
if (min_x || min_y) {
- for (iter = _displays.begin(); iter != _displays.end(); iter++) {
- mode = *iter;
+ for (DisplayMode *mode : _displays) {
if (mode) {
mode->move_pos(-min_x, -min_y);
}
commit ab6a4a0e18fffdeb9791c64b730de0552cf898b7
Author: Frediano Ziglio <freddy77 at gmail.com>
Date: Fri May 22 20:16:41 2020 +0100
Move set_display_depth from VDAgent to DesktopLayout
The function only change DesktopLayout.
Signed-off-by: Frediano Ziglio <freddy77 at gmail.com>
Acked-by: Julien Ropé <jrope at redhat.com>
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);
commit 645aadd34d42299d29dbe47882fe795184c75905
Author: Frediano Ziglio <freddy77 at gmail.com>
Date: Mon Jun 15 12:59:59 2020 +0100
Minor style update
Signed-off-by: Frediano Ziglio <freddy77 at gmail.com>
Acked-by: Julien Ropé <jrope at redhat.com>
diff --git a/vdagent/desktop_layout.cpp b/vdagent/desktop_layout.cpp
index 59ebe1d..bc2a9c7 100644
--- a/vdagent/desktop_layout.cpp
+++ b/vdagent/desktop_layout.cpp
@@ -179,7 +179,8 @@ void DesktopLayout::set_displays()
}
}
-void DesktopLayout::set_position_configurable(bool flag) {
+void DesktopLayout::set_position_configurable(bool flag)
+{
_display_config->set_monitors_config(flag);
}
More information about the Spice-commits
mailing list