Commit Graph

25 Commits

Author SHA1 Message Date
Frediano Ziglio
8512940e53 fix format string for Visual Studio
The "z" size specifier is not supported by Visual Studio.
Cast to unsigned long and use "l" specifier as the type has
enough precision for this vector.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2017-07-24 17:18:23 +01:00
Frediano Ziglio
75a0033f42 Use simpler classes for mutex handling
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-09-01 15:50:14 +01:00
Sameeh Jubran
d81d8cdbde Encapsulating XPDM implementation
The Direct3D 9 API operates on either the Windows XP display driver
model (XPDM) or the Windows Vista display driver model (WDDM), depending
on the operating system installed.

This patch encapsulates the current XPDM interface implementation into
XPDMInterface class which inherits DisplayConfig class. This patch
makes it easier to introduce WDDM interface to Vdagent in future
patches.

Based on a patch by Sandy Stutsman <sstutsma@redhat.com>

Signed-off-by: Dmitry Fleytman <dfleytma@redhat.com>
Signed-off-by: Sameeh Jubran <sameeh@daynix.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-08-16 11:19:02 +01:00
Sameeh Jubran
714801261f 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@daynix.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2016-08-16 06:37:12 +01:00
Sandy Stutsman
259d6b5bdb Check for set-monitors-position capability from client.
If the client hasn't been updated to handle multi-monitor configurations
that are not multi-head, vd_agent won't issue the MONITORS_CONFIG driver
escape.

These changes will ensure that the new MONITORS_CONFIG escape in commit:
6023630562 will not break with an older
client.

This resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1248196
2015-08-06 12:01:45 +02:00
Sandy Stutsman
6023630562 Add monitors_config driver escape.
When a Windows guest uses the "Set Resolution" applet to change
resolutions and/or monitor positions, this escape sends the new monitor
configurations to the client via a new QXL driver escape.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1202419
2015-06-29 16:37:44 +02:00
Sandy Stutsman
7bac272308 Use (0,0) for Windows Primary monitors.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1174129.

Windows considers the monitor positioned at (0,0) to be primary. VDAgent
normalizes the monitor positions so that there are no negative
coordinates. If the normalized positions are passed to the Windows APIs,
the leftmost monitor will always be set to primary. We need to keep
track of the original primary monitor and its normalized position to be
able to adjust the coordinates that are passed to Windows.
2015-06-10 13:50:19 +03:00
Marc-André Lureau
fc1de85b49 Fix wrong size_t printf format
vdagent/desktop_layout.cpp:121:763: warning: format '%u' expects
argument of type 'unsigned int', but argument 8 has type
'std::vector<DisplayMode*>::size_type {aka long long unsigned int}'
[-Wformat=]
2013-07-17 20:49:19 +02:00
Marc-André Lureau
b52c9ddfa8 Fix wrong DWORD print fmt
format '%u' expects argument of type 'unsigned int', but argument 8 has type 'DWORD
2013-07-17 20:45:21 +02:00
Uri Lublin
08a23eb45b vdagent: protect against NULL entry in _displays
rhbz#958051

It may be that a _displays entry will be NULL.
I encountered it when running with multiple QXL devices, for one of
which the driver failed to load since it was "out of resources".

Iterations over _displays should handle that case.
We found four such iterations, and fixed them in this patch.
2013-05-12 12:43:25 +03:00
Marc-André Lureau
8628ca2e09 Try harder to enable monitors
0ba6e2936 was trying to fix CreateDC() failing when the monitor is
disabled, unfortunately, enabling monitor with an arbitrary resolution
may still fail (the previous resolution, or the current one).

This patch address the issue by first trying the current resolution, and
falling back to a well-known resolution. This causes a temporary client
resolution change (bad), which is immediately adjusted to the arbitrary
resolution.

We may want to improve agent->driver communication of arbitrary
resolution before the driver is loaded, perhaps using registry or via
the spice server. Any of these solution will unfortunately take some more
time which we are missing.

https://bugzilla.redhat.com/show_bug.cgi?id=922394

(seem to solve related bugs, like mouse offset, or flashing monitors)
2013-04-24 12:00:18 +03:00
Marc-André Lureau
0ba6e29363 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
2013-03-16 01:02:47 +01:00
Marc-André Lureau
04a28a35ed Fix remaining warnings 2012-07-25 11:27:22 +02:00
Marc-André Lureau
b4e9afc721 desktop_layout: fix incorrect total_width/height
When resizing desktop to best match, the agent fails to update
it's current mode width/height and then incorrectly report
different total_width/total_height than real screen dimensions,
then scaling input incorrectly results in mouse cursor offset.

https://bugzilla.redhat.com/show_bug.cgi?id=823019
2012-05-24 13:55:31 +02:00
Marc-André Lureau
3d45018086 Resize to arbitrary resolution
Use QXL_ESCAPE_SET_CUSTOM_DISPLAY to update custom mode,
and switch to it.
2012-05-24 13:55:31 +02:00
Christophe Fergeau
22dffb81ad mingw: fix signed/unsigned comparison warning
DWORD is an unsigned long, but it's assigned -1 in various places.
mingw warns when comparing a DWORD value against -1. This commit
casts the -1 to DWORD to avoid the warning.
2012-03-01 12:59:05 +01:00
Christophe Fergeau
fa68400fb4 mingw: pick min/max from the std:: namespace 2012-03-01 12:57:30 +01:00
Christophe Fergeau
df3fe9cb90 mingw: fix format string warnings
Most of them are caused by not using %lu to print a DWORD (which
is an unsigned long).
2012-02-23 19:03:25 +01:00
Arnon Gilboa
b127e5fdae vdagent: fix cursor position sync on multimon rhbz#757819
On any change of the display settings, driven by client message or guest user,
normalize all display positions to non-negative coordinates, and update total
width and height of the virtual desktop. The bug was due to wrong handling of
(non-primary) displays positioned on negative coordinates.

Primary monitor is always located (in windows) in (0,0). When a secondary
monitor is positioned above/to the left of the primary, it will have negative
coordinate. This can be the case when guest display settings are changed either
manually on the guest, or due to a message (auto-conf VD_AGENT_MONITORS_CONFIG)
from the client to the agent.

In VDAgent::handle_mouse_event(), mouse event is generated by scaling the
received (x,y, display_id) to normalized absolute coordinates (0..0xffff) on
the entire virtual desktop which contains all the displays. Keeping negative
display coordinates, as received from the client, was mistakenly handled and
generated wrong (sometimes even negative) coordinates.
2012-02-05 11:52:58 +02:00
Arnon Gilboa
c28d7f0274 vdagent: add casting 2011-07-24 18:08:03 +03:00
Arnon Gilboa
6b74ffb8eb vdagent: remove dependency on qxl driver (rhbz#683166)
-don't fail to start when no qxl driver installed
-if qxls found use them, otherwise just use enumerated non-mirror devices
-currently qxl/non-qxl multimon mix is not supported
2011-04-28 11:31:06 +03:00
Arnon Gilboa
32fd4e69a5 vdagent: use best match for resolution change
similar handling as linux agent
2010-12-14 17:40:38 +02:00
Arnon Gilboa
35d1b7c835 Revert "vdservice: don't start when no qxl device present"
This reverts commit 349e6a5bf8 which breaks vsdervice on Windows 7
2010-11-09 20:50:21 +02:00
Alon Levy
349e6a5bf8 vdservice: don't start when no qxl device present 2010-08-24 14:56:28 +03:00
Arnon Gilboa
5ee7b5b270 fresh start 2009-11-05 13:02:54 +02:00