diff options
author | Pavel Grunt <pgrunt@redhat.com> | 2016-03-08 08:55:19 +0100 |
---|---|---|
committer | Pavel Grunt <pgrunt@redhat.com> | 2016-08-30 14:48:32 +0200 |
commit | 6ff311c69963c498c57a528fdd1055594816fb8d (patch) | |
tree | baef0ed38ae0c7fd78b80be655bb0f85b5130c10 | |
parent | 3c4eaf89ea66bd3d628aa713caed43cdfdf59dda (diff) |
virt_viewer_parse_monitor_mappings: Add parameter for client monitors
Drop dependency on gdk. it allows to write tests not depending
on the client's configuration.
(cherry picked from commit ab603d8e25ac83c805745f6ad5a90bd413cd09ac)
-rw-r--r-- | src/virt-viewer-app.c | 2 | ||||
-rw-r--r-- | src/virt-viewer-util.c | 4 | ||||
-rw-r--r-- | src/virt-viewer-util.h | 3 |
3 files changed, 5 insertions, 4 deletions
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c index 855828e..838fac9 100644 --- a/src/virt-viewer-app.c +++ b/src/virt-viewer-app.c @@ -387,7 +387,7 @@ virt_viewer_app_get_monitor_mapping_for_section(VirtViewerApp *self, const gchar g_warning("Error reading monitor assignments for %s: %s", section, error->message); g_clear_error(&error); } else { - mapping = virt_viewer_parse_monitor_mappings(mappings, nmappings); + mapping = virt_viewer_parse_monitor_mappings(mappings, nmappings, get_n_client_monitors()); } g_strfreev(mappings); diff --git a/src/virt-viewer-util.c b/src/virt-viewer-util.c index 28fc042..5527605 100644 --- a/src/virt-viewer-util.c +++ b/src/virt-viewer-util.c @@ -647,6 +647,7 @@ virt_viewer_shift_monitors_to_origin(GHashTable *displays) * virt_viewer_parse_monitor_mappings: * @mappings: (array zero-terminated=1) values for the "monitor-mapping" key * @nmappings: the size of @mappings + * @nmonitors: the count of client's monitors * * Parses and validates monitor mappings values to return a hash table * containing the mapping from guest display ids to client monitors ids. @@ -655,9 +656,8 @@ virt_viewer_shift_monitors_to_origin(GHashTable *displays) * ids to client monitor ids or %NULL if the mapping is invalid. */ GHashTable* -virt_viewer_parse_monitor_mappings(gchar **mappings, const gsize nmappings) +virt_viewer_parse_monitor_mappings(gchar **mappings, const gsize nmappings, const gint nmonitors) { - const gint nmonitors = gdk_screen_get_n_monitors(gdk_screen_get_default()); GHashTable *displaymap = g_hash_table_new(g_direct_hash, g_direct_equal); GHashTable *monitormap = g_hash_table_new(g_direct_hash, g_direct_equal); gint i, max_display_id = 0; diff --git a/src/virt-viewer-util.h b/src/virt-viewer-util.h index 2d36d73..0b33d99 100644 --- a/src/virt-viewer-util.h +++ b/src/virt-viewer-util.h @@ -62,7 +62,8 @@ void virt_viewer_shift_monitors_to_origin(GHashTable *displays); /* monitor mapping */ GHashTable* virt_viewer_parse_monitor_mappings(gchar **mappings, - const gsize nmappings); + const gsize nmappings, + const gint nmonitors); #endif /* |