mirror of
https://gitlab.com/virt-viewer/virt-viewer.git
synced 2025-03-28 22:50:10 +03:00
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.
This commit is contained in:
parent
e0c6718c3f
commit
ab603d8e25
@ -378,7 +378,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);
|
||||
|
||||
|
@ -605,6 +605,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.
|
||||
@ -613,9 +614,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;
|
||||
|
@ -63,7 +63,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
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user