mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-11 12:45:41 +00:00
* X11GraphicsMode.cs: Protect the mode queries with XLockDisplay()/XUnlockDisplay().
This commit is contained in:
parent
59f9746665
commit
c559de1956
|
@ -17,7 +17,8 @@ using OpenTK.Graphics;
|
||||||
namespace OpenTK.Platform.X11
|
namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
class X11GraphicsMode : IGraphicsMode
|
class X11GraphicsMode : IGraphicsMode
|
||||||
{ // Todo: Add custom visual selection algorithm, instead of ChooseFBConfig/ChooseVisual.
|
{
|
||||||
|
// Todo: Add custom visual selection algorithm, instead of ChooseFBConfig/ChooseVisual.
|
||||||
// It seems the Choose* methods do not take multisampling into account (at least on some
|
// It seems the Choose* methods do not take multisampling into account (at least on some
|
||||||
// drivers).
|
// drivers).
|
||||||
|
|
||||||
|
@ -159,13 +160,14 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
// Select a visual that matches the parameters set by the user.
|
// Select a visual that matches the parameters set by the user.
|
||||||
IntPtr display = API.DefaultDisplay;
|
IntPtr display = API.DefaultDisplay;
|
||||||
|
|
||||||
int screen = Functions.XDefaultScreen(display);
|
|
||||||
IntPtr root = Functions.XRootWindow(display, screen);
|
|
||||||
Debug.Print("Display: {0}, Screen: {1}, RootWindow: {2}", display, screen, root);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Functions.XLockDisplay(display);
|
||||||
|
|
||||||
|
int screen = Functions.XDefaultScreen(display);
|
||||||
|
IntPtr root = Functions.XRootWindow(display, screen);
|
||||||
|
Debug.Print("Display: {0}, Screen: {1}, RootWindow: {2}", display, screen, root);
|
||||||
|
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
Debug.Print("Getting FB config.");
|
Debug.Print("Getting FB config.");
|
||||||
|
@ -185,6 +187,10 @@ namespace OpenTK.Platform.X11
|
||||||
Debug.Print("Function glXChooseFBConfig not supported.");
|
Debug.Print("Function glXChooseFBConfig not supported.");
|
||||||
return IntPtr.Zero;
|
return IntPtr.Zero;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Functions.XUnlockDisplay(display);
|
||||||
|
}
|
||||||
|
|
||||||
return visual;
|
return visual;
|
||||||
}
|
}
|
||||||
|
@ -255,7 +261,15 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
Debug.Print("Falling back to glXChooseVisual.");
|
Debug.Print("Falling back to glXChooseVisual.");
|
||||||
IntPtr display = API.DefaultDisplay;
|
IntPtr display = API.DefaultDisplay;
|
||||||
return Glx.ChooseVisual(display, Functions.XDefaultScreen(display), visualAttributes.ToArray());
|
try
|
||||||
|
{
|
||||||
|
Functions.XLockDisplay(display);
|
||||||
|
return Glx.ChooseVisual(display, Functions.XDefaultScreen(display), visualAttributes.ToArray());
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Functions.XUnlockDisplay(display);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
Loading…
Reference in a new issue