Update geometry when enabling/disabling displays

_update_displays_geometry() must be called every time a display is
enabled/disabled, avoiding gaps (when a display is disabled) or overlaps
(when a display is enabled) between the monitors.

This is what happens when we have 3 displays enabled (each one
represented by: width x height + x position + y position) ...

  Display #0       Display #1         Display #2
 +---------+      +----------+       +---------+
 |         |      |          |       |         |
 |         |      |          |       |         |
 |         |      |          |       |         |
 |         |      |          |       |         |
 |         |      |          |       |         |
 |         |      |          |       |         |
 +---------+      +----------+       +---------+
(680x804+0+0)   (504x804+680+0)    (408x804+1184+0)

Whether the Display #1 is disable, a message will be sent down to the
vdagent, representing the new arrangement of the monitors:

  Display #0     Display #2
 +---------+     +---------+
 |         |     |         |
 |         |     |         |
 |         |     |         |
 |         |     |         |
 |         |     |         |
 |         |     |         |
 +---------+     +---------+
(680x804+0+0)  (408x804+1184+0)

However, taking a look on the x position, a gap can be identified as
Display #0 starts at position (0,0) and has 680 pixels of width. But
Display #1 only starts at position (1184, 0), leaving 504 pixels as a
gap. The proper message, however, should represent the following
arrangement ...

  Display #0       Display #2
 +---------+      +---------+
 |         |      |         |
 |         |      |         |
 |         |      |         |
 |         |      |         |
 |         |      |         |
 |         |      |         |
 +---------+      +---------+
(680x804+0+0)   (408x804+680+0)

... avoiding then gaps and overlaps.

Resolves: rhbz#1111425
https://bugzilla.redhat.com/show_bug.cgi?id=1111425
This commit is contained in:
Fabiano Fidêncio 2015-03-04 23:40:37 +01:00
parent 1e63a40014
commit 4de3379f34

View File

@ -2180,6 +2180,8 @@ menu_display_visible_toggled_cb(GtkCheckMenuItem *checkmenuitem,
gtk_check_menu_item_set_active(checkmenuitem, /* will be toggled again */ !visible);
reentering = FALSE;
virt_viewer_session_update_displays_geometry(virt_viewer_display_get_session(display));
}
static gint