private void RefreshDisplayDevices() { using (new XLock(API.DefaultDisplay)) { var devices = new List <DisplayDevice>(); xinerama_supported = false; try { xinerama_supported = QueryXinerama(devices); } catch { Debug.Print("Xinerama query failed."); } if (!xinerama_supported) { // We assume that devices are equivalent to the number of available screens. // Note: this won't work correctly in the case of distinct X servers. for (var i = 0; i < API.ScreenCount; i++) { var dev = new DisplayDevice(); dev.IsPrimary = i == Functions.XDefaultScreen(API.DefaultDisplay); devices.Add(dev); deviceToScreen.Add(dev, i); } } try { xrandr_supported = QueryXRandR(devices); } catch { } if (!xrandr_supported) { Debug.Print("XRandR query failed, falling back to XF86."); try { xf86_supported = QueryXF86(devices); } catch { } if (!xf86_supported) { Debug.Print("XF86 query failed, no DisplayDevice support available."); } } AvailableDevices.Clear(); AvailableDevices.AddRange(devices); Primary = FindDefaultDevice(devices); } }