Browse Source

[X11] Use 24-bit visuals so GL drawing works on nVidia cards

pull/2011/head
Nikita Tsukanov 8 years ago
parent
commit
80950d0eb1
  1. 2
      src/Avalonia.X11/X11Framebuffer.cs
  2. 3
      src/Avalonia.X11/X11Info.cs
  3. 16
      src/Avalonia.X11/X11Window.cs

2
src/Avalonia.X11/X11Framebuffer.cs

@ -34,7 +34,7 @@ namespace Avalonia.X11
image.bitmap_unit = bitsPerPixel;
image.bitmap_bit_order = 0;// LSBFirst;
image.bitmap_pad = bitsPerPixel;
image.depth = 32;
image.depth = 24;
image.bytes_per_line = RowBytes - Width * 4;
image.bits_per_pixel = bitsPerPixel;
XLockDisplay(_display);

3
src/Avalonia.X11/X11Info.cs

@ -14,7 +14,6 @@ namespace Avalonia.X11
public IntPtr BlackPixel { get; }
public IntPtr RootWindow { get; }
public IntPtr DefaultRootWindow { get; }
public XVisualInfo MatchedVisual { get; }
public X11Atoms Atoms { get; }
public IntPtr LastActivityTimestamp { get; set; }
@ -28,8 +27,6 @@ namespace Avalonia.X11
RootWindow = XRootWindow(display, DefaultScreen);
DefaultRootWindow = XDefaultRootWindow(display);
Atoms = new X11Atoms(display);
XMatchVisualInfo(display, DefaultScreen, 32, 4, out var info);
MatchedVisual = info;
}
}
}

16
src/Avalonia.X11/X11Window.cs

@ -44,15 +44,11 @@ namespace Avalonia.X11
XSetWindowAttributes attr = new XSetWindowAttributes();
var valueMask = default(SetWindowValuemask);
/*
_handle = XCreateSimpleWindow(_x11.Display, _x11.DefaultRootWindow, 10, 10, 100, 100, 0, IntPtr.Zero,
IntPtr.Zero);*/
var vinfo = _x11.MatchedVisual;
attr.colormap = XCreateColormap(_x11.Display, _x11.RootWindow, vinfo.visual, 0);
attr.backing_store = 2;
attr.backing_store = 1;
attr.bit_gravity = Gravity.NorthWestGravity;
attr.win_gravity = Gravity.NorthWestGravity;
valueMask |= SetWindowValuemask.ColorMap | SetWindowValuemask.BackPixel | SetWindowValuemask.BorderPixel
valueMask |= SetWindowValuemask.BackPixel | SetWindowValuemask.BorderPixel
| SetWindowValuemask.BackPixmap | SetWindowValuemask.BackingStore
| SetWindowValuemask.BitGravity | SetWindowValuemask.WinGravity;
@ -63,8 +59,8 @@ namespace Avalonia.X11
}
_handle = XCreateWindow(_x11.Display, _x11.RootWindow, 10, 10, 300, 200, 0,
(int)vinfo.depth,
(int)CreateWindowArgs.InputOutput, vinfo.visual,
24,
(int)CreateWindowArgs.InputOutput, IntPtr.Zero,
new UIntPtr((uint)valueMask), ref attr);
@ -278,7 +274,7 @@ namespace Avalonia.X11
rv |= InputModifiers.Windows;
return rv;
}
static Stopwatch St = Stopwatch.StartNew();
private bool _systemDecorations = true;
private bool _canResize = true;

Loading…
Cancel
Save