gdkscreen-x11: Enable RandR on VirtualBox

RandR 1.5 is enabled on VirtualBox guest of Fedora 25 but
XRROutputInfo->name is "default". If init_randr15() does not
return TRUE, the monitor size sets 0 because gdk_screen_get_width()
returns 0.

This problem causes GtkStatusIcon not to show the activate menu.

https://bugzilla.gnome.org/show_bug.cgi?id=771033
This commit is contained in:
Takao Fujiwara 2016-09-10 01:54:13 +09:00 committed by Matthias Clasen
parent 221caf19f7
commit f2ba6ca473

View File

@ -407,7 +407,6 @@ init_randr15 (GdkScreen *screen, gboolean *changed)
RROutput primary_output = None;
RROutput first_output = None;
int i;
gboolean randr12_compat = FALSE;
XRRMonitorInfo *rr_monitors;
int num_rr_monitors;
int old_primary;
@ -452,9 +451,6 @@ init_randr15 (GdkScreen *screen, gboolean *changed)
if (output_info == NULL)
continue;
/* Non RandR1.2+ X driver have output name "default" */
randr12_compat |= !g_strcmp0 (output_info->name, "default");
if (output_info->connection == RR_Disconnected)
{
XRRFreeOutputInfo (output_info);
@ -534,19 +530,6 @@ init_randr15 (GdkScreen *screen, gboolean *changed)
XRRFreeMonitors (rr_monitors);
XRRFreeScreenResources (resources);
/* non RandR 1.2+ X driver doesn't return any usable multihead data */
if (randr12_compat)
{
for (i = 0; i < x11_display->monitors->len; i++)
{
GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
if (monitor->remove)
gdk_display_monitor_removed (display, GDK_MONITOR (monitor));
}
g_ptr_array_remove_range (x11_display->monitors, 0, x11_display->monitors->len);
return FALSE;
}
for (i = x11_display->monitors->len - 1; i >= 0; i--)
{
GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
@ -609,7 +592,6 @@ init_randr13 (GdkScreen *screen, gboolean *changed)
RROutput primary_output = None;
RROutput first_output = None;
int i;
gboolean randr12_compat = FALSE;
int old_primary;
if (!x11_display->have_randr13)
@ -633,9 +615,6 @@ init_randr13 (GdkScreen *screen, gboolean *changed)
XRROutputInfo *output_info =
XRRGetOutputInfo (x11_screen->xdisplay, resources, output);
/* Non RandR1.2+ X driver have output name "default" */
randr12_compat |= !g_strcmp0 (output_info->name, "default");
if (output_info->connection == RR_Disconnected)
{
XRRFreeOutputInfo (output_info);
@ -716,17 +695,7 @@ init_randr13 (GdkScreen *screen, gboolean *changed)
XRRFreeScreenResources (resources);
if (randr12_compat)
{
for (i = 0; i < x11_display->monitors->len; i++)
{
GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
if (monitor->remove)
gdk_display_monitor_removed (display, GDK_MONITOR (monitor));
}
g_ptr_array_remove_range (x11_display->monitors, 0, x11_display->monitors->len);
return FALSE;
}
/* Which usable multihead data is not returned in non RandR 1.2+ X driver? */
for (i = x11_display->monitors->len - 1; i >= 0; i--)
{
@ -826,7 +795,7 @@ init_no_multihead (GdkScreen *screen, gboolean *changed)
gdk_screen_get_height (screen));
g_object_notify (G_OBJECT (monitor), "workarea");
gdk_monitor_set_physical_size (GDK_MONITOR (monitor),
gdk_screen_get_height_mm (screen),
gdk_screen_get_width_mm (screen),
gdk_screen_get_height_mm (screen));
gdk_monitor_set_scale_factor (GDK_MONITOR (monitor), x11_screen->window_scale);