Esempio n. 1
0
        private void SetCursor(MouseCursor cursor)
        {
            BufferObject bo = default(BufferObject);

            if (cursor == MouseCursor.Default)
            {
                bo = cursor_default;
            }
            else if (cursor == MouseCursor.Empty)
            {
                bo = cursor_empty;
            }
            else
            {
                if (cursor_custom != BufferObject.Zero)
                {
                    cursor_custom.Dispose();
                }
                cursor_custom = CreateCursor(window.BufferManager, cursor);
                bo            = cursor_custom;
            }

            // If we failed to create a proper cursor, try falling back
            // to the empty cursor. We do not want to crash here!
            if (bo == BufferObject.Zero)
            {
                bo = cursor_empty;
            }

            if (bo != BufferObject.Zero)
            {
                Drm.SetCursor(window.FD, window.DisplayDevice.Id,
                              bo.Handle, bo.Width, bo.Height, cursor.X, cursor.Y);
            }
        }