diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c index 8c494aa810..76ab17f0e9 100644 --- a/gdk/x11/gdkscreen-x11.c +++ b/gdk/x11/gdkscreen-x11.c @@ -771,7 +771,7 @@ init_randr13 (GdkScreen *screen) XRROutputInfo *output = XRRGetOutputInfo (dpy, resources, resources->outputs[i]); - if (resources->outputs[i] == primary_output) + if (primary_output != None && resources->outputs[i] == primary_output) { screen_x11->primary_monitor = i; } @@ -785,6 +785,12 @@ init_randr13 (GdkScreen *screen) continue; } + /* No RandR1.3+ available or no primary set, fall back to prefer LVDS as primary if present */ + if (g_ascii_strncasecmp (output->name, "LVDS", 4) == 0) + { + screen_x11->primary_monitor = i; + } + if (output->crtc) { GdkX11Monitor monitor;