diff options
author | Julien Ropé <jrope@redhat.com> | 2020-10-12 09:56:33 +0200 |
---|---|---|
committer | Julien Ropé <jrope@redhat.com> | 2020-11-19 15:39:17 +0100 |
commit | 9750013f0edeac9b8751ee07b8daaa02974912fa (patch) | |
tree | ba4afceb0eb47e27e040cc76082c50a7349ff8ef | |
parent | 1d40f0e967c3d3404ba603e12964188115c5c887 (diff) |
Make the connector mappings available whatever the build options
Signed-off-by: Julien Ropé <jrope@redhat.com>
Acked-by: Jakub Janků <jjanku@redhat.com>
-rw-r--r-- | src/vdagent/display.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/src/vdagent/display.c b/src/vdagent/display.c index b341ab5..fc0e6dc 100644 --- a/src/vdagent/display.c +++ b/src/vdagent/display.c @@ -53,10 +53,8 @@ * The x11.c and x11-randr.c files contains the x11-specific functions. */ struct VDAgentDisplay { -#ifdef USE_GTK_FOR_MONITORS // association between SPICE display ID and expected connector name GHashTable *connector_mapping; -#endif struct vdagent_x11 *x11; UdscsConnection *vdagentd; int debug; @@ -281,9 +279,7 @@ VDAgentDisplay* vdagent_display_create(UdscsConnection *vdagentd, int debug, int } display->x11->vdagent_display = display; -#ifdef USE_GTK_FOR_MONITORS display->connector_mapping = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); -#endif display->x11_channel = g_io_channel_unix_new(vdagent_x11_get_fd(display->x11)); if (display->x11_channel == NULL) { @@ -319,9 +315,7 @@ void vdagent_display_destroy(VDAgentDisplay *display, int vdagentd_disconnected) return; } -#ifdef USE_GTK_FOR_MONITORS g_hash_table_destroy(display->connector_mapping); -#endif g_clear_pointer(&display->x11_channel, g_io_channel_unref); vdagent_x11_destroy(display->x11, vdagentd_disconnected); @@ -436,23 +430,19 @@ void vdagent_display_handle_graphics_device_info(VDAgentDisplay *display, uint8_ device_display_info->channel_id, device_display_info->monitor_id); } -#ifdef USE_GTK_FOR_MONITORS - if (GDK_IS_WAYLAND_DISPLAY(gdk_display_get_default())) { - // Get the expected connector name from hardware info. Store it with the SPICE display ID. - char expected_name[100]; - int ret = get_connector_name_for_device_info(device_display_info, expected_name, - sizeof(expected_name), decrement_id); - if (ret == 0) { - g_hash_table_insert(display->connector_mapping, - g_strdup(expected_name), - GUINT_TO_POINTER(device_display_info->channel_id + device_display_info->monitor_id)); - syslog(LOG_DEBUG, "Mapping connector %s to display #%d", expected_name, - (device_display_info->channel_id + device_display_info->monitor_id)); - } + // Get the expected connector name from hardware info. Store it with the SPICE display ID. + char expected_name[100]; + int ret = get_connector_name_for_device_info(device_display_info, expected_name, + sizeof(expected_name), decrement_id); + if (ret == 0) { + g_hash_table_insert(display->connector_mapping, + g_strdup(expected_name), + GUINT_TO_POINTER(device_display_info->channel_id + device_display_info->monitor_id)); + syslog(LOG_DEBUG, "Mapping connector %s to display #%d", expected_name, + (device_display_info->channel_id + device_display_info->monitor_id)); } - else - // under X11, use the X11 API -#endif + + // Also map the SPICE display ID to the corresponding X server object. vdagent_x11_handle_device_display_info(display->x11, device_display_info, decrement_id); device_display_info = (VDAgentDeviceDisplayInfo*) ((char*) device_display_info + |