Beispiel #1
0
        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);
            }
        }
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         Debug.Print("[KMS] Destroying window {0}.", window.Handle);
         Drm.SetCursor(window.FD, window.DisplayDevice.Id, 0, 0, 0, 0, 0);
         window.Dispose();
         Gbm.DestroySurface(window.Handle);
     }
     else
     {
         Debug.Print("[KMS] {0} leaked. Did you forget to call Dispose()?", GetType().FullName);
     }
 }