mirror of
				https://github.com/Ryujinx/Opentk.git
				synced 2025-11-04 11:54:52 +00:00 
			
		
		
		
	Merge pull request #711 from copygirl/patch-1
Replace NativeWindow cursor_visible field with implementation's CursorVisible
This commit is contained in:
		
						commit
						f11b6ce6ad
					
				| 
						 | 
				
			
			@ -47,7 +47,6 @@ namespace OpenTK
 | 
			
		|||
        private readonly INativeWindow implementation;
 | 
			
		||||
 | 
			
		||||
        private bool events;
 | 
			
		||||
        private bool cursor_visible = true;
 | 
			
		||||
        private bool previous_cursor_visible = true;
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
| 
						 | 
				
			
			@ -476,10 +475,12 @@ namespace OpenTK
 | 
			
		|||
        /// </summary>
 | 
			
		||||
        public bool CursorVisible
 | 
			
		||||
        {
 | 
			
		||||
            get { return cursor_visible; }
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                return implementation.CursorVisible;
 | 
			
		||||
            }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                cursor_visible = value;
 | 
			
		||||
                implementation.CursorVisible = value;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1236,18 +1236,17 @@ namespace OpenTK.Platform.MacOS
 | 
			
		|||
 | 
			
		||||
        public override bool CursorVisible
 | 
			
		||||
        {
 | 
			
		||||
            get { return cursorVisible; }
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                return cursorVisible;
 | 
			
		||||
            }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (value && !cursorVisible)
 | 
			
		||||
                if (value != cursorVisible)
 | 
			
		||||
                {
 | 
			
		||||
                    SetCursorVisible(true);
 | 
			
		||||
                    SetCursorVisible(value);
 | 
			
		||||
                    cursorVisible = value;
 | 
			
		||||
                }
 | 
			
		||||
                else if (!value && cursorVisible)
 | 
			
		||||
                {
 | 
			
		||||
                    SetCursorVisible(false);
 | 
			
		||||
                }
 | 
			
		||||
                cursorVisible = value;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -935,7 +935,7 @@ namespace OpenTK.Platform.SDL2
 | 
			
		|||
            {
 | 
			
		||||
                lock (sync)
 | 
			
		||||
                {
 | 
			
		||||
                    if (Exists)
 | 
			
		||||
                    if (Exists && value != is_cursor_visible)
 | 
			
		||||
                    {
 | 
			
		||||
                        GrabCursor(!value);
 | 
			
		||||
                        is_cursor_visible = value;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1256,10 +1256,17 @@ namespace OpenTK.Platform.Windows
 | 
			
		|||
 | 
			
		||||
        public override bool CursorVisible
 | 
			
		||||
        {
 | 
			
		||||
            get { return cursor_visible_count >= 0; } // Not used
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                return cursor_visible_count >= 0;
 | 
			
		||||
            }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (value && cursor_visible_count < 0)
 | 
			
		||||
                if (value == CursorVisible)
 | 
			
		||||
                {
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                if (value)
 | 
			
		||||
                {
 | 
			
		||||
                    do
 | 
			
		||||
                    {
 | 
			
		||||
| 
						 | 
				
			
			@ -1269,7 +1276,7 @@ namespace OpenTK.Platform.Windows
 | 
			
		|||
 | 
			
		||||
                    UngrabCursor();
 | 
			
		||||
                }
 | 
			
		||||
                else if (!value && cursor_visible_count >= 0)
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    do
 | 
			
		||||
                    {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1684,12 +1684,19 @@ namespace OpenTK.Platform.X11
 | 
			
		|||
 | 
			
		||||
        public override bool CursorVisible
 | 
			
		||||
        {
 | 
			
		||||
            get { return cursor_visible; }
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                return cursor_visible;
 | 
			
		||||
            }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                if (value && !cursor_visible)
 | 
			
		||||
                if (value == cursor_visible)
 | 
			
		||||
                {
 | 
			
		||||
                    using (new XLock(window.Display))
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                using (new XLock(window.Display))
 | 
			
		||||
                {
 | 
			
		||||
                    if (value)
 | 
			
		||||
                    {
 | 
			
		||||
                        UngrabMouse();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1699,16 +1706,12 @@ namespace OpenTK.Platform.X11
 | 
			
		|||
                        // Note: if cursorHandle = IntPtr.Zero, this restores the default cursor
 | 
			
		||||
                        // (equivalent to calling XUndefineCursor)
 | 
			
		||||
                        Functions.XDefineCursor(window.Display, window.Handle, cursorHandle);
 | 
			
		||||
                        cursor_visible = true;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else if (!value && cursor_visible)
 | 
			
		||||
                {
 | 
			
		||||
                    using (new XLock(window.Display))
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        GrabMouse();
 | 
			
		||||
                        cursor_visible = false;
 | 
			
		||||
                    }
 | 
			
		||||
                    cursor_visible = value;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue