Contains information regarding a monitor's display resolution.
 public override sealed bool TryChangeResolution(DisplayDevice device, DisplayResolution resolution)
 {
     IntPtr num1 = QuartzDisplayDeviceDriver.HandleTo(device);
       IntPtr num2 = CG.DisplayCurrentMode(num1);
       if (!this.storedModes.ContainsKey(num1))
     this.storedModes.Add(num1, num2);
       CFArray cfArray = new CFArray(CG.DisplayAvailableModes(num1));
       for (int index = 0; index < cfArray.Count; ++index)
       {
     CFDictionary cfDictionary = new CFDictionary(cfArray[index]);
     int num3 = (int) cfDictionary.GetNumberValue("Width");
     int num4 = (int) cfDictionary.GetNumberValue("Height");
     int num5 = (int) cfDictionary.GetNumberValue("BitsPerPixel");
     double numberValue = cfDictionary.GetNumberValue("RefreshRate");
     if (num3 == resolution.Width && num4 == resolution.Height && (num5 == resolution.BitsPerPixel && Math.Abs(numberValue - (double) resolution.RefreshRate) < 1E-06))
     {
       if (!this.displaysCaptured.Contains(num1))
       {
     int num6 = (int) CG.DisplayCapture(num1);
       }
       CG.DisplaySwitchToMode(num1, cfArray[index]);
       return true;
     }
       }
       return false;
 }
示例#2
0
 public override sealed bool TryChangeResolution(DisplayDevice device, DisplayResolution resolution)
 {
     if (this.xrandr_supported)
     return this.ChangeResolutionXRandR(device, resolution);
       if (this.xf86_supported)
     return X11DisplayDevice.ChangeResolutionXF86(device, resolution);
       else
     return false;
 }
示例#3
0
        public DisplayDevice(DisplayResolution currentResolution, bool primary,
            IEnumerable<DisplayResolution> availableResolutions, Rectangle bounds)
            : this()
        {
#warning "Consolidate current resolution with bounds? Can they fall out of sync right now?"
            this.current_resolution = currentResolution;
            IsPrimary = primary;
            this.available_resolutions.AddRange(availableResolutions);
            this.bounds = bounds == Rectangle.Empty ? currentResolution.Bounds : bounds;
            Debug.Print("DisplayDevice {0} ({1}) supports {2} resolutions.",
                available_displays.Count, primary ? "primary" : "secondary", available_resolutions.Count);
        }
示例#4
0
        internal DisplayDevice(DisplayResolution currentResolution, bool primary,
            IEnumerable<DisplayResolution> availableResolutions, Rectangle bounds,
            object id)
            : this()
        {
#warning "Consolidate current resolution with bounds? Can they fall out of sync right now?"
            this.current_resolution = currentResolution;
            IsPrimary = primary;
            this.available_resolutions.AddRange(availableResolutions);
            this.bounds = bounds == Rectangle.Empty ? currentResolution.Bounds : bounds;
            this.Id = id;
        }
示例#5
0
 public override sealed bool TryChangeResolution(DisplayDevice device, DisplayResolution resolution)
 {
     DeviceMode lpDevMode = (DeviceMode) null;
       if (resolution != (DisplayResolution) null)
       {
     lpDevMode = new DeviceMode();
     lpDevMode.PelsWidth = resolution.Width;
     lpDevMode.PelsHeight = resolution.Height;
     lpDevMode.BitsPerPel = resolution.BitsPerPixel;
     lpDevMode.DisplayFrequency = (int) resolution.RefreshRate;
     lpDevMode.Fields = 6029312;
       }
       return 0 == Functions.ChangeDisplaySettingsEx((string) device.Id, lpDevMode, IntPtr.Zero, ChangeDisplaySettingsEnum.Fullscreen, IntPtr.Zero);
 }
示例#6
0
        internal DisplayDevice(DisplayResolution currentResolution, bool primary,
            IEnumerable<DisplayResolution> availableResolutions)
        {
            this.current_resolution = currentResolution;
            this.primary = primary;
            this.available_resolutions.AddRange(availableResolutions);

            Debug.Print("DisplayDevice {0} ({1}) supports {2} resolutions.",
                available_displays.Count, primary ? "primary" : "secondary", available_resolutions.Count);

            lock (display_lock)
            {
                available_displays.Add(this);
                if (primary)
                    primary_display = this;
            }
        }
示例#7
0
        /// <summary> Selects an available resolution that matches the specified parameters. </summary>
        /// <param name="width">The width of the requested resolution in pixels.</param>
        /// <param name="height">The height of the requested resolution in pixels.</param>
        /// <param name="bitsPerPixel">The bits per pixel of the requested resolution.</param>
        /// <param name="refreshRate">The refresh rate of the requested resolution in hertz.</param>
        /// <returns>The requested DisplayResolution or null if the parameters cannot be met.</returns>
        /// <remarks> <para>If a matching resolution is not found, this function will retry ignoring the specified refresh rate,
        /// bits per pixel and resolution, in this order. If a matching resolution still doesn't exist, this function will
        /// return the current resolution.</para>
        /// <para>A parameter set to 0 or negative numbers will not be used in the search (e.g. if refreshRate is 0,
        /// any refresh rate will be considered valid).</para>
        /// <para>This function allocates memory.</para> </remarks>
        public DisplayResolution SelectResolution(int width, int height, int bitsPerPixel, float refreshRate)
        {
            DisplayResolution resolution = FindResolution(width, height, bitsPerPixel, refreshRate);

            if (resolution == null)
            {
                resolution = FindResolution(width, height, bitsPerPixel, 0);
            }
            if (resolution == null)
            {
                resolution = FindResolution(width, height, 0, 0);
            }
            if (resolution == null)
            {
                return(current_resolution);
            }
            return(resolution);
        }
示例#8
0
        /// <summary>Determines whether the specified resolutions are equal.</summary>
        /// <param name="obj">The System.Object to check against.</param>
        /// <returns>True if the System.Object is an equal DisplayResolution; false otherwise.</returns>
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (this.GetType() == obj.GetType())
            {
                DisplayResolution res = (DisplayResolution)obj;
                return
                    (Width == res.Width &&
                     Height == res.Height &&
                     BitsPerPixel == res.BitsPerPixel &&
                     RefreshRate == res.RefreshRate);
            }

            return(false);
        }
示例#9
0
        /// <summary>Restores the original resolution of the DisplayDevice.</summary>
        /// <exception cref="Graphics.GraphicsModeException">Thrown if the original resolution could not be restored.</exception>
        public void RestoreResolution()
        {
            if (original_resolution != null)
            {
                //effect.FadeOut();

                if (implementation.TryRestoreResolution(this))
                {
                    current_resolution  = original_resolution;
                    original_resolution = null;
                }
                else
                {
                    throw new Graphics.GraphicsModeException(String.Format("Device {0}: Failed to restore resolution.", this));
                }
                //effect.FadeIn();
            }
        }
示例#10
0
        internal DisplayDevice(DisplayResolution currentResolution, bool primary,
                               IEnumerable <DisplayResolution> availableResolutions)
        {
            this.current_resolution = currentResolution;
            this.primary            = primary;
            this.available_resolutions.AddRange(availableResolutions);

            Debug.Print("DisplayDevice {0} ({1}) supports {2} resolutions.",
                        available_displays.Count, primary ? "primary" : "secondary", available_resolutions.Count);

            lock (display_lock)
            {
                available_displays.Add(this);
                if (primary)
                {
                    primary_display = this;
                }
            }
        }
示例#11
0
 public unsafe QuartzDisplayDeviceDriver()
 {
     lock (QuartzDisplayDeviceDriver.display_lock)
       {
     IntPtr[] local_0 = new IntPtr[20];
     int local_1;
     fixed (IntPtr* fixed_0 = local_0)
     {
       int temp_15 = (int) CG.GetActiveDisplayList(20, fixed_0, out local_1);
     }
     for (int local_3 = 0; local_3 < local_1; ++local_3)
     {
       IntPtr local_4 = local_0[local_3];
       bool local_5 = local_3 == 0;
       CG.DisplayPixelsWide(local_4);
       CG.DisplayPixelsHigh(local_4);
       CFArray local_7 = new CFArray(CG.DisplayAvailableModes(local_4));
       DisplayResolution local_8 = (DisplayResolution) null;
       List<DisplayResolution> local_9 = new List<DisplayResolution>();
       CFDictionary local_11 = new CFDictionary(CG.DisplayCurrentMode(local_4));
       for (int local_12 = 0; local_12 < local_7.Count; ++local_12)
       {
     CFDictionary local_13 = new CFDictionary(local_7[local_12]);
     int local_14 = (int) local_13.GetNumberValue("Width");
     int local_15 = (int) local_13.GetNumberValue("Height");
     int local_16 = (int) local_13.GetNumberValue("BitsPerPixel");
     double local_17 = local_13.GetNumberValue("RefreshRate");
     bool local_18 = local_11.Ref == local_13.Ref;
     DisplayResolution local_19 = new DisplayResolution(0, 0, local_14, local_15, local_16, (float) local_17);
     local_9.Add(local_19);
     if (local_18)
       local_8 = local_19;
       }
       HIRect local_20 = CG.DisplayBounds(local_4);
       Rectangle local_21 = new Rectangle((int) local_20.Origin.X, (int) local_20.Origin.Y, (int) local_20.Size.Width, (int) local_20.Size.Height);
       DisplayDevice local_22 = new DisplayDevice(local_8, local_5, (IEnumerable<DisplayResolution>) local_9, local_21, (object) local_4);
       this.AvailableDevices.Add(local_22);
       if (local_5)
     this.Primary = local_22;
     }
       }
 }
示例#12
0
 public void ChangeResolution(DisplayResolution resolution)
 {
     if (resolution == (DisplayResolution)null)
     {
         this.RestoreResolution();
     }
     if (resolution == this.current_resolution)
     {
         return;
     }
     if (!DisplayDevice.implementation.TryChangeResolution(this, resolution))
     {
         throw new GraphicsModeException(string.Format("Device {0}: Failed to change resolution to {1}.", (object)this, (object)resolution));
     }
     if (this.original_resolution == (DisplayResolution)null)
     {
         this.original_resolution = this.current_resolution;
     }
     this.current_resolution = resolution;
 }
示例#13
0
        public DisplayResolution SelectResolution(int width, int height, int bitsPerPixel, float refreshRate)
        {
            DisplayResolution resolution = this.FindResolution(width, height, bitsPerPixel, refreshRate);

            if (resolution == (DisplayResolution)null)
            {
                resolution = this.FindResolution(width, height, bitsPerPixel, 0.0f);
            }
            if (resolution == (DisplayResolution)null)
            {
                resolution = this.FindResolution(width, height, 0, 0.0f);
            }
            if (resolution == (DisplayResolution)null)
            {
                return(this.current_resolution);
            }
            else
            {
                return(resolution);
            }
        }
示例#14
0
 public void RefreshDisplayDevices()
 {
     lock (this.display_lock)
       {
     this.AvailableDevices.Clear();
     DisplayResolution local_1 = (DisplayResolution) null;
     List<DisplayResolution> local_2 = new List<DisplayResolution>();
     bool local_3 = false;
     int local_4 = 0;
     WindowsDisplayDevice local_6 = new WindowsDisplayDevice();
     WindowsDisplayDevice temp_10 = new WindowsDisplayDevice();
     while (Functions.EnumDisplayDevices((string) null, local_4++, local_6, 0))
     {
       if ((local_6.StateFlags & DisplayDeviceStateFlags.AttachedToDesktop) != DisplayDeviceStateFlags.None)
       {
     DeviceMode local_7 = new DeviceMode();
     if (Functions.EnumDisplaySettingsEx(((object) local_6.DeviceName).ToString(), DisplayModeSettingsEnum.CurrentSettings, local_7, 0) || Functions.EnumDisplaySettingsEx(((object) local_6.DeviceName).ToString(), DisplayModeSettingsEnum.RegistrySettings, local_7, 0))
     {
       local_1 = new DisplayResolution(local_7.Position.X, local_7.Position.Y, local_7.PelsWidth, local_7.PelsHeight, local_7.BitsPerPel, (float) local_7.DisplayFrequency);
       local_3 = (local_6.StateFlags & DisplayDeviceStateFlags.PrimaryDevice) != DisplayDeviceStateFlags.None;
     }
     local_2.Clear();
     int local_5_1 = 0;
     while (Functions.EnumDisplaySettings(((object) local_6.DeviceName).ToString(), local_5_1++, local_7))
     {
       DisplayResolution local_8 = new DisplayResolution(local_7.Position.X, local_7.Position.Y, local_7.PelsWidth, local_7.PelsHeight, local_7.BitsPerPel, (float) local_7.DisplayFrequency);
       local_2.Add(local_8);
     }
     DisplayDevice local_0 = new DisplayDevice(local_1, local_3, (IEnumerable<DisplayResolution>) local_2, local_1.Bounds, (object) local_6.DeviceName);
     this.AvailableDevices.Add(local_0);
     if (local_3)
       this.Primary = local_0;
       }
     }
       }
 }
示例#15
0
 public override bool TryChangeResolution(DisplayDevice device, DisplayResolution resolution)
 {
     unsafe
     {
         LinuxDisplay display = (LinuxDisplay)device.Id;
         ModeInfo* mode = GetModeInfo(display, resolution);
         int connector_id = display.pConnector->connector_id;
         if (mode != null)
         {
             return Drm.ModeSetCrtc(FD, display.Id, 0, 0, 0,
                 &connector_id, 1, mode) == 0;
         }
         return false;
     }
 }
示例#16
0
 unsafe static ModeInfo* GetModeInfo(LinuxDisplay display, DisplayResolution resolution)
 {
     for (int i = 0; i < display.pConnector->count_modes; i++)
     {
         ModeInfo* mode = display.pConnector->modes + i;
         if (mode != null &&
             mode->hdisplay == resolution.Width &&
             mode->vdisplay == resolution.Height)
         {
             return mode;
         }
     }
     return null;
 }
示例#17
0
        unsafe void AddDisplay(LinuxDisplay display)
        {
            DisplayResolution[] modes = new DisplayResolution[display.pConnector->count_modes];
            DisplayResolution current;
            GetModes(display, modes, out current);

            bool is_primary = AvailableDevices.Count == 0;
            DisplayDevice device = new DisplayDevice(current, is_primary,
                modes, GetBounds(current), display);

            if (is_primary)
            {
                Primary = device;
            }

            UpdateDisplayIndices(display, device);

            Debug.Print("[KMS] Added DisplayDevice {0}", device);
        }
示例#18
0
        System.Drawing.Rectangle GetBounds(DisplayResolution current)
        {
            // Note: since we are not running a display manager, we are free
            // to choose the display layout for multiple displays ourselves.
            // We choose the simplest layout: displays are laid out side-by-side
            // from left to right. Primary display is the first display we encounter.
            int x = AvailableDevices.Count == 0 ?
                0 : AvailableDevices[AvailableDevices.Count - 1].Bounds.Right;
            int y = 0;

            return new System.Drawing.Rectangle(
                x, y, current.Width, current.Height);
        }
示例#19
0
 private bool QueryXRandR(List<DisplayDevice> devices)
 {
     foreach (DisplayDevice key1 in devices)
       {
     int index1 = this.deviceToScreen[key1];
     IntPtr config_timestamp;
     Functions.XRRTimes(API.DefaultDisplay, index1, out config_timestamp);
     this.lastConfigUpdate.Add(config_timestamp);
     List<DisplayResolution> list = new List<DisplayResolution>();
     this.screenResolutionToIndex.Add(new Dictionary<DisplayResolution, int>());
     int[] availableDepths = X11DisplayDevice.FindAvailableDepths(index1);
     int size_index = 0;
     foreach (XRRScreenSize xrrScreenSize in X11DisplayDevice.FindAvailableResolutions(index1))
     {
       if (xrrScreenSize.Width != 0 && xrrScreenSize.Height != 0)
       {
     short[] numArray = Functions.XRRRates(API.DefaultDisplay, index1, size_index);
     foreach (short num in numArray)
     {
       if ((int) num != 0 || numArray.Length == 1)
       {
         foreach (int bitsPerPixel in availableDepths)
           list.Add(new DisplayResolution(0, 0, xrrScreenSize.Width, xrrScreenSize.Height, bitsPerPixel, (float) num));
       }
     }
     foreach (int bitsPerPixel in availableDepths)
     {
       DisplayResolution key2 = new DisplayResolution(0, 0, xrrScreenSize.Width, xrrScreenSize.Height, bitsPerPixel, 0.0f);
       if (!this.screenResolutionToIndex[index1].ContainsKey(key2))
         this.screenResolutionToIndex[index1].Add(key2, size_index);
     }
     ++size_index;
       }
     }
     float currentRefreshRate = X11DisplayDevice.FindCurrentRefreshRate(index1);
     int currentDepth = X11DisplayDevice.FindCurrentDepth(index1);
     ushort rotation;
     int index2 = (int) Functions.XRRConfigCurrentConfiguration(Functions.XRRGetScreenInfo(API.DefaultDisplay, Functions.XRootWindow(API.DefaultDisplay, index1)), out rotation);
     if (key1.Bounds == System.Drawing.Rectangle.Empty)
       key1.Bounds = new System.Drawing.Rectangle(0, 0, list[index2].Width, list[index2].Height);
     key1.BitsPerPixel = currentDepth;
     key1.RefreshRate = currentRefreshRate;
     key1.AvailableResolutions = (IList<DisplayResolution>) list;
     this.deviceToDefaultResolution.Add(key1, index2);
       }
       return true;
 }
示例#20
0
 public void ChangeResolution(DisplayResolution resolution)
 {
   if (resolution == (DisplayResolution) null)
     this.RestoreResolution();
   if (resolution == this.current_resolution)
     return;
   if (!DisplayDevice.implementation.TryChangeResolution(this, resolution))
     throw new GraphicsModeException(string.Format("Device {0}: Failed to change resolution to {1}.", (object) this, (object) resolution));
   if (this.original_resolution == (DisplayResolution) null)
     this.original_resolution = this.current_resolution;
   this.current_resolution = resolution;
 }
示例#21
0
        /// <summary>Restores the original resolution of the DisplayDevice.</summary>
        /// <exception cref="Graphics.GraphicsModeException">Thrown if the original resolution could not be restored.</exception>
        public void RestoreResolution()
        {
            if (original_resolution != null)
            {
                //effect.FadeOut();

                if (implementation.TryRestoreResolution(this))
                {
                    current_resolution = original_resolution;
                    original_resolution = null;
                }
                else throw new Graphics.GraphicsModeException(String.Format("Device {0}: Failed to restore resolution.", this));

                //effect.FadeIn();
            }
        }
示例#22
0
 private static bool ChangeResolutionXF86(DisplayDevice device, DisplayResolution resolution)
 {
     return false;
 }
示例#23
0
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="name">Application's name.</param>
        /// <param name="multithread">If set to <c>true</c> application is created with multiple threads.</param>
        /// <param name="fullscreen">If set to <c>true</c> application is created in fullscreen mode.</param>
        internal Application(string name, bool multithread, bool fullscreen)
        {
            // application set up
            this.Name = name;
            this.multithread = multithread;
            this.fullscreen = fullscreen;
            running = true;

            // create game window and set up defaults
            window = new GameWindow (960, 540, GraphicsMode.Default, name);
            window.WindowBorder = WindowBorder.Fixed;
            window.WindowState = fullscreen ? WindowState.Fullscreen : WindowState.Normal;
            resolution = DisplayDevice.Default.SelectResolution(window.Width, window.Height, DisplayDevice.Default.BitsPerPixel, DisplayDevice.Default.RefreshRate);
            window.VSync = fullscreen ? VSyncMode.On : VSyncMode.Off;

            // add application's event handlers to OpenTK window
            window.Load += OnLoad;
            window.Unload += OnUnload;

            // graphics set up

            // write into log file
            Platform.Log.Write ("Application created (name: " + name + ", multithread: " + multithread + ")", LogType.Information);
        }
示例#24
0
 public abstract bool TryChangeResolution(DisplayDevice device, DisplayResolution resolution);
示例#25
0
        /// <summary>Changes the resolution of the DisplayDevice.</summary>
        /// <param name="resolution">The resolution to set. <see cref="DisplayDevice.SelectResolution"/></param>
        /// <exception cref="Graphics.GraphicsModeException">Thrown if the requested resolution could not be set.</exception>
        /// <remarks>If the specified resolution is null, this function will restore the original DisplayResolution.</remarks>
        public void ChangeResolution(DisplayResolution resolution)
        {
            if (resolution == null)
                this.RestoreResolution();

            if (resolution == current_resolution)
                return;

            //effect.FadeOut();

            if (implementation.TryChangeResolution(this, resolution))
            {
                if (original_resolution == null)
                    original_resolution = current_resolution;
                current_resolution = resolution;
            }
            else throw new Graphics.GraphicsModeException(String.Format("Device {0}: Failed to change resolution to {1}.",
                    this, resolution));

            //effect.FadeIn();
        }
示例#26
0
        /// <summary>
        /// Enters fake full-screen mode. This method is thread-safe.
        /// </summary>
        /// <param name="resolution">The screen resolution to enter fake fullscreen mode in.</param>
        /// <returns>Whether the operation succeeded.</returns>
        public bool GoFakeFullScreen(DisplayResolution resolution)
        {
            bool succeeded = true;

            try
            {
                DisplayDevice.Default.ChangeResolution(resolution);
            }
            catch (GraphicsModeException)
            {
                succeeded = false;
            }

            if (!this.InFakeFullScreen && succeeded)
            {
                this.oldBorderStyle = this.FakeFullScreenForm.GetFormBorderStyle();
                this.FakeFullScreenForm.SetFormBorderStyle(System.Windows.Forms.FormBorderStyle.None);

                this.oldWindowState = this.FakeFullScreenForm.GetWindowState();
                this.FakeFullScreenForm.SetWindowState(System.Windows.Forms.FormWindowState.Maximized);

                this.FakeFullScreenForm.BringToFrontSafe();

                this.InFakeFullScreen = true;
            }

            return succeeded;
        }
示例#27
0
 internal DisplayDevice(DisplayResolution currentResolution, bool primary, IEnumerable<DisplayResolution> availableResolutions, Rectangle bounds, object id)
   : this()
 {
   this.current_resolution = currentResolution;
   this.IsPrimary = primary;
   this.available_resolutions.AddRange(availableResolutions);
   this.bounds = bounds == Rectangle.Empty ? currentResolution.Bounds : bounds;
   this.Id = id;
 }
示例#28
0
        unsafe static void GetModes(LinuxDisplay display, DisplayResolution[] modes, out DisplayResolution current)
        {
            int mode_count = display.pConnector->count_modes;
            Debug.Print("[KMS] Display supports {0} mode(s)", mode_count);
            for (int i = 0; i < mode_count; i++)
            {
                ModeInfo* mode = display.pConnector->modes + i;
                if (mode != null)
                {
                    Debug.Print("Mode {0}: {1}x{2} @{3}", i,
                        mode->hdisplay, mode->vdisplay, mode->vrefresh);
                    DisplayResolution res = GetDisplayResolution(mode);
                    modes[i] = res;
                }
            }

            if (display.pCrtc->mode_valid != 0)
            {
                ModeInfo cmode = display.pCrtc->mode;
                current = GetDisplayResolution(&cmode);
            }
            else
            {
                current = GetDisplayResolution(display.pConnector->modes);
            }
            Debug.Print("Current mode: {0}", current.ToString());
        }
示例#29
0
 public void RestoreResolution()
 {
   if (!(this.original_resolution != (DisplayResolution) null))
     return;
   if (!DisplayDevice.implementation.TryRestoreResolution(this))
     throw new GraphicsModeException(string.Format("Device {0}: Failed to restore resolution.", (object) this));
   this.current_resolution = this.original_resolution;
   this.original_resolution = (DisplayResolution) null;
 }
示例#30
0
 private bool ChangeResolutionXRandR(DisplayDevice device, DisplayResolution resolution)
 {
     using (new XLock(API.DefaultDisplay))
       {
     int screen_number = this.deviceToScreen[device];
     IntPtr draw = Functions.XRootWindow(API.DefaultDisplay, screen_number);
     IntPtr screenInfo = Functions.XRRGetScreenInfo(API.DefaultDisplay, draw);
     ushort rotation;
     int num = (int) Functions.XRRConfigCurrentConfiguration(screenInfo, out rotation);
     int size_index = !(resolution != (DisplayResolution) null) ? this.deviceToDefaultResolution[device] : this.screenResolutionToIndex[screen_number][new DisplayResolution(0, 0, resolution.Width, resolution.Height, resolution.BitsPerPixel, 0.0f)];
     short rate = resolution != (DisplayResolution) null ? (short) resolution.RefreshRate : (short) 0;
     return ((int) rate <= 0 ? Functions.XRRSetScreenConfig(API.DefaultDisplay, screenInfo, draw, size_index, rotation, IntPtr.Zero) : Functions.XRRSetScreenConfigAndRate(API.DefaultDisplay, screenInfo, draw, size_index, rotation, rate, IntPtr.Zero)) == 0;
       }
 }