aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Ava/Ui/Backend/BackendSurface.cs
diff options
context:
space:
mode:
authorEmmanuel Hansen <emmausssss@gmail.com>2022-09-19 18:05:26 +0000
committerGitHub <noreply@github.com>2022-09-19 15:05:26 -0300
commit6f0395538b8e8af3bba7536b44780d57e51e8697 (patch)
tree4d3f4f620dd287fc1ca38ea9ea722b6e022301dd /Ryujinx.Ava/Ui/Backend/BackendSurface.cs
parentb9f1ff3c7748c6a2665e76d17e86c3b7228f44fe (diff)
Avalonia - Use embedded window for avalonia (#3674)1.1.274
* wip * use embedded window * fix race condition on opengl Windows * fix glx issues on prime nvidia * fix mouse support win32 * clean up * addressed review * addressed review * fix warnings * fix sotware keyboard dialog * Update Ryujinx.Ava/Ui/Applet/SwkbdAppletDialog.axaml.cs Co-authored-by: gdkchan <gab.dark.100@gmail.com> * remove double semi Co-authored-by: gdkchan <gab.dark.100@gmail.com>
Diffstat (limited to 'Ryujinx.Ava/Ui/Backend/BackendSurface.cs')
-rw-r--r--Ryujinx.Ava/Ui/Backend/BackendSurface.cs76
1 files changed, 0 insertions, 76 deletions
diff --git a/Ryujinx.Ava/Ui/Backend/BackendSurface.cs b/Ryujinx.Ava/Ui/Backend/BackendSurface.cs
deleted file mode 100644
index 423fe038..00000000
--- a/Ryujinx.Ava/Ui/Backend/BackendSurface.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using Avalonia;
-using System;
-using System.Runtime.InteropServices;
-using static Ryujinx.Ava.Ui.Backend.Interop;
-
-namespace Ryujinx.Ava.Ui.Backend
-{
- public abstract class BackendSurface : IDisposable
- {
- protected IntPtr Display => _display;
-
- private IntPtr _display = IntPtr.Zero;
-
- [DllImport("libX11.so.6")]
- public static extern IntPtr XOpenDisplay(IntPtr display);
-
- [DllImport("libX11.so.6")]
- public static extern int XCloseDisplay(IntPtr display);
-
- private PixelSize _currentSize;
- public IntPtr Handle { get; protected set; }
-
- public bool IsDisposed { get; private set; }
-
- public BackendSurface(IntPtr handle)
- {
- Handle = handle;
-
- if (OperatingSystem.IsLinux())
- {
- _display = XOpenDisplay(IntPtr.Zero);
- }
- }
-
- public PixelSize Size
- {
- get
- {
- PixelSize size = new PixelSize();
- if (OperatingSystem.IsWindows())
- {
- GetClientRect(Handle, out var rect);
- size = new PixelSize(rect.right, rect.bottom);
- }
- else if (OperatingSystem.IsLinux())
- {
- XWindowAttributes attributes = new XWindowAttributes();
- XGetWindowAttributes(Display, Handle, ref attributes);
-
- size = new PixelSize(attributes.width, attributes.height);
- }
-
- _currentSize = size;
-
- return size;
- }
- }
-
- public PixelSize CurrentSize => _currentSize;
-
- public virtual void Dispose()
- {
- if (IsDisposed)
- {
- throw new ObjectDisposedException(nameof(BackendSurface));
- }
-
- IsDisposed = true;
-
- if (_display != IntPtr.Zero)
- {
- XCloseDisplay(_display);
- }
- }
- }
-} \ No newline at end of file