diff --git a/src/Avalonia.FreeDesktop/DBusHelper.cs b/src/Avalonia.FreeDesktop/DBusHelper.cs index ef99838208..fac77521dc 100644 --- a/src/Avalonia.FreeDesktop/DBusHelper.cs +++ b/src/Avalonia.FreeDesktop/DBusHelper.cs @@ -6,7 +6,7 @@ using Tmds.DBus; namespace Avalonia.FreeDesktop { - public static class DBusHelper + internal static class DBusHelper { /// /// This class uses synchronous execution at DBus connection establishment stage diff --git a/src/Avalonia.FreeDesktop/DBusIme/X11DBusImeHelper.cs b/src/Avalonia.FreeDesktop/DBusIme/X11DBusImeHelper.cs index 86978c8b60..d8874b6fae 100644 --- a/src/Avalonia.FreeDesktop/DBusIme/X11DBusImeHelper.cs +++ b/src/Avalonia.FreeDesktop/DBusIme/X11DBusImeHelper.cs @@ -6,7 +6,7 @@ using Tmds.DBus; namespace Avalonia.FreeDesktop.DBusIme { - public class X11DBusImeHelper + internal class X11DBusImeHelper { private static readonly Dictionary> KnownMethods = new Dictionary> diff --git a/src/Avalonia.FreeDesktop/DBusMenuExporter.cs b/src/Avalonia.FreeDesktop/DBusMenuExporter.cs index 0e6bee5f24..cfbafc53e5 100644 --- a/src/Avalonia.FreeDesktop/DBusMenuExporter.cs +++ b/src/Avalonia.FreeDesktop/DBusMenuExporter.cs @@ -15,7 +15,7 @@ using Tmds.DBus; namespace Avalonia.FreeDesktop { - public class DBusMenuExporter + internal class DBusMenuExporter { public static ITopLevelNativeMenuExporter? TryCreateTopLevelNativeMenu(IntPtr xid) { diff --git a/src/Avalonia.FreeDesktop/IX11InputMethod.cs b/src/Avalonia.FreeDesktop/IX11InputMethod.cs index 9fa9c1809e..7274b58876 100644 --- a/src/Avalonia.FreeDesktop/IX11InputMethod.cs +++ b/src/Avalonia.FreeDesktop/IX11InputMethod.cs @@ -6,13 +6,13 @@ using Avalonia.Input.TextInput; namespace Avalonia.FreeDesktop { - public interface IX11InputMethodFactory + internal interface IX11InputMethodFactory { (ITextInputMethodImpl method, IX11InputMethodControl control) CreateClient(IntPtr xid); } #pragma warning disable CA1815 // Override equals and operator equals on value types - public struct X11InputMethodForwardedKey + internal struct X11InputMethodForwardedKey #pragma warning restore CA1815 // Override equals and operator equals on value types { public int KeyVal { get; set; } @@ -20,7 +20,7 @@ namespace Avalonia.FreeDesktop public RawKeyEventType Type { get; set; } } - public interface IX11InputMethodControl : IDisposable + internal interface IX11InputMethodControl : IDisposable { void SetWindowActive(bool active); bool IsEnabled { get; } diff --git a/src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoProvider.cs b/src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoProvider.cs index 4624a9c340..4aa6bed329 100644 --- a/src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoProvider.cs +++ b/src/Avalonia.FreeDesktop/LinuxMountedVolumeInfoProvider.cs @@ -5,7 +5,7 @@ using Avalonia.Controls.Platform; namespace Avalonia.FreeDesktop { - public class LinuxMountedVolumeInfoProvider : IMountedVolumeInfoProvider + internal class LinuxMountedVolumeInfoProvider : IMountedVolumeInfoProvider { public IDisposable Listen(ObservableCollection mountedDrives) { diff --git a/src/Avalonia.X11/Glx/Glx.cs b/src/Avalonia.X11/Glx/Glx.cs index 1a26d7d5f5..fceea3718c 100644 --- a/src/Avalonia.X11/Glx/Glx.cs +++ b/src/Avalonia.X11/Glx/Glx.cs @@ -10,7 +10,7 @@ using Avalonia.SourceGenerator; namespace Avalonia.X11.Glx { - unsafe partial class GlxInterface + internal unsafe partial class GlxInterface { private const string libGL = "libGL.so.1"; [GetProcAddress("glXMakeContextCurrent")] diff --git a/src/Avalonia.X11/Glx/GlxConsts.cs b/src/Avalonia.X11/Glx/GlxConsts.cs index 9d153a6ade..0d1383420d 100644 --- a/src/Avalonia.X11/Glx/GlxConsts.cs +++ b/src/Avalonia.X11/Glx/GlxConsts.cs @@ -4,7 +4,7 @@ #pragma warning disable 414 namespace Avalonia.X11.Glx { - class GlxConsts + internal class GlxConsts { public const int GLX_USE_GL = 1; public const int GLX_BUFFER_SIZE = 2; diff --git a/src/Avalonia.X11/Glx/GlxContext.cs b/src/Avalonia.X11/Glx/GlxContext.cs index 572e4a6077..b1cb330b00 100644 --- a/src/Avalonia.X11/Glx/GlxContext.cs +++ b/src/Avalonia.X11/Glx/GlxContext.cs @@ -7,7 +7,7 @@ using Avalonia.Reactive; namespace Avalonia.X11.Glx { - class GlxContext : IGlContext + internal class GlxContext : IGlContext { public IntPtr Handle { get; } public GlxInterface Glx { get; } @@ -46,8 +46,8 @@ namespace Avalonia.X11.Glx public GlInterface GlInterface { get; } public int SampleCount { get; } public int StencilSize { get; } - - class RestoreContext : IDisposable + + private class RestoreContext : IDisposable { private GlxInterface _glx; private IntPtr _defaultDisplay; diff --git a/src/Avalonia.X11/Glx/GlxDisplay.cs b/src/Avalonia.X11/Glx/GlxDisplay.cs index 9b8a8f0b5b..7749749eaa 100644 --- a/src/Avalonia.X11/Glx/GlxDisplay.cs +++ b/src/Avalonia.X11/Glx/GlxDisplay.cs @@ -6,7 +6,7 @@ using static Avalonia.X11.Glx.GlxConsts; namespace Avalonia.X11.Glx { - unsafe class GlxDisplay + internal unsafe class GlxDisplay { private readonly X11Info _x11; private readonly GlVersion[] _probeProfiles; @@ -106,7 +106,7 @@ namespace Avalonia.X11.Glx } } - IntPtr CreatePBuffer() + private IntPtr CreatePBuffer() { return Glx.CreatePbuffer(_x11.Display, _fbconfig, new[] { GLX_PBUFFER_WIDTH, 1, GLX_PBUFFER_HEIGHT, 1, 0 }); } @@ -116,8 +116,8 @@ namespace Avalonia.X11.Glx public GlxContext CreateContext(IGlContext share) => CreateContext(CreatePBuffer(), share, share.SampleCount, share.StencilSize, true); - - GlxContext CreateContext(IntPtr defaultXid, IGlContext share, + + private GlxContext CreateContext(IntPtr defaultXid, IGlContext share, int sampleCount, int stencilSize, bool ownsPBuffer) { var sharelist = ((GlxContext)share)?.Handle ?? IntPtr.Zero; diff --git a/src/Avalonia.X11/Glx/GlxGlPlatformSurface.cs b/src/Avalonia.X11/Glx/GlxGlPlatformSurface.cs index ebb1e18723..17c5909a39 100644 --- a/src/Avalonia.X11/Glx/GlxGlPlatformSurface.cs +++ b/src/Avalonia.X11/Glx/GlxGlPlatformSurface.cs @@ -6,7 +6,7 @@ using static Avalonia.OpenGL.GlConsts; namespace Avalonia.X11.Glx { - class GlxGlPlatformSurface: IGlPlatformSurface + internal class GlxGlPlatformSurface: IGlPlatformSurface { private readonly EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo _info; @@ -21,7 +21,7 @@ namespace Avalonia.X11.Glx return new RenderTarget((GlxContext)context, _info); } - class RenderTarget : IGlPlatformSurfaceRenderTarget + private class RenderTarget : IGlPlatformSurfaceRenderTarget { private readonly GlxContext _context; private readonly EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo _info; @@ -46,8 +46,8 @@ namespace Avalonia.X11.Glx return new Session(_context, _info, oldContext); } - - class Session : IGlPlatformSurfaceRenderingSession + + private class Session : IGlPlatformSurfaceRenderingSession { private readonly GlxContext _context; private readonly EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo _info; diff --git a/src/Avalonia.X11/Glx/GlxPlatformFeature.cs b/src/Avalonia.X11/Glx/GlxPlatformFeature.cs index bc50fa61aa..06766e0963 100644 --- a/src/Avalonia.X11/Glx/GlxPlatformFeature.cs +++ b/src/Avalonia.X11/Glx/GlxPlatformFeature.cs @@ -6,7 +6,7 @@ using Avalonia.Platform; namespace Avalonia.X11.Glx { - class GlxPlatformGraphics : IPlatformGraphics + internal class GlxPlatformGraphics : IPlatformGraphics { public GlxDisplay Display { get; private set; } public bool CanCreateContexts => true; diff --git a/src/Avalonia.X11/Keysyms.cs b/src/Avalonia.X11/Keysyms.cs index 651a06f574..970cf5ad4d 100644 --- a/src/Avalonia.X11/Keysyms.cs +++ b/src/Avalonia.X11/Keysyms.cs @@ -3,7 +3,7 @@ // ReSharper disable CommentTypo namespace Avalonia.X11 { - enum X11Key + internal enum X11Key { VoidSymbol = 0xffffff /* Void symbol */, BackSpace = 0xff08 /* Back space, back char */, diff --git a/src/Avalonia.X11/NativeDialogs/Gtk.cs b/src/Avalonia.X11/NativeDialogs/Gtk.cs index 4e56ae73cf..3f225dc6bc 100644 --- a/src/Avalonia.X11/NativeDialogs/Gtk.cs +++ b/src/Avalonia.X11/NativeDialogs/Gtk.cs @@ -7,8 +7,7 @@ using Avalonia.Platform.Interop; // ReSharper disable IdentifierTypo namespace Avalonia.X11.NativeDialogs { - - static unsafe class Glib + internal static unsafe class Glib { private const string GlibName = "libglib-2.0.so.0"; private const string GObjectName = "libgobject-2.0.so.0"; @@ -36,7 +35,7 @@ namespace Avalonia.X11.NativeDialogs IntPtr destroy); - class ConnectedSignal : IDisposable + private class ConnectedSignal : IDisposable { private readonly IntPtr _instance; private GCHandle _handle; @@ -75,7 +74,7 @@ namespace Avalonia.X11.NativeDialogs } - static bool TimeoutHandler(IntPtr data) + private static bool TimeoutHandler(IntPtr data) { var handle = GCHandle.FromIntPtr(data); var cb = (Func)handle.Target; @@ -95,7 +94,7 @@ namespace Avalonia.X11.NativeDialogs s_pinnedHandler = TimeoutHandler; } - static void AddTimeout(int priority, uint interval, Func callback) + private static void AddTimeout(int priority, uint interval, Func callback) { var handle = GCHandle.Alloc(callback); g_timeout_add_full(priority, interval, s_pinnedHandler, GCHandle.ToIntPtr(handle), IntPtr.Zero); @@ -123,13 +122,13 @@ namespace Avalonia.X11.NativeDialogs } [StructLayout(LayoutKind.Sequential)] - unsafe struct GSList + internal unsafe struct GSList { public readonly IntPtr Data; public readonly GSList* Next; } - enum GtkFileChooserAction + internal enum GtkFileChooserAction { Open, Save, @@ -137,7 +136,7 @@ namespace Avalonia.X11.NativeDialogs } // ReSharper disable UnusedMember.Global - enum GtkResponseType + internal enum GtkResponseType { Help = -11, Apply = -10, @@ -153,14 +152,14 @@ namespace Avalonia.X11.NativeDialogs } // ReSharper restore UnusedMember.Global - static unsafe class Gtk + internal static unsafe class Gtk { private static IntPtr s_display; private const string GdkName = "libgdk-3.so.0"; private const string GtkName = "libgtk-3.so.0"; [DllImport(GtkName)] - static extern void gtk_main_iteration(); + private static extern void gtk_main_iteration(); [DllImport(GtkName)] @@ -231,10 +230,10 @@ namespace Avalonia.X11.NativeDialogs public static extern void gtk_widget_hide(IntPtr gtkWidget); [DllImport(GtkName)] - static extern bool gtk_init_check(int argc, IntPtr argv); + private static extern bool gtk_init_check(int argc, IntPtr argv); [DllImport(GdkName)] - static extern IntPtr gdk_x11_window_foreign_new_for_display(IntPtr display, IntPtr xid); + private static extern IntPtr gdk_x11_window_foreign_new_for_display(IntPtr display, IntPtr xid); [DllImport(GdkName)] public static extern IntPtr gdk_x11_window_get_xid(IntPtr window); @@ -244,13 +243,13 @@ namespace Avalonia.X11.NativeDialogs public static extern IntPtr gtk_container_add(IntPtr container, IntPtr widget); [DllImport(GdkName)] - static extern IntPtr gdk_set_allowed_backends(Utf8Buffer backends); + private static extern IntPtr gdk_set_allowed_backends(Utf8Buffer backends); [DllImport(GdkName)] - static extern IntPtr gdk_display_get_default(); + private static extern IntPtr gdk_display_get_default(); [DllImport(GtkName)] - static extern IntPtr gtk_application_new(Utf8Buffer appId, int flags); + private static extern IntPtr gtk_application_new(Utf8Buffer appId, int flags); [DllImport(GdkName)] public static extern void gdk_window_set_transient_for(IntPtr window, IntPtr parent); diff --git a/src/Avalonia.X11/TransparencyHelper.cs b/src/Avalonia.X11/TransparencyHelper.cs index 2140b61b6f..5ca2d1d337 100644 --- a/src/Avalonia.X11/TransparencyHelper.cs +++ b/src/Avalonia.X11/TransparencyHelper.cs @@ -3,7 +3,7 @@ using Avalonia.Controls; namespace Avalonia.X11 { - class TransparencyHelper : IDisposable, X11Globals.IGlobalsSubscriber + internal class TransparencyHelper : IDisposable, X11Globals.IGlobalsSubscriber { private readonly X11Info _x11; private readonly IntPtr _window; diff --git a/src/Avalonia.X11/X11Clipboard.cs b/src/Avalonia.X11/X11Clipboard.cs index 2aa7797067..04d1aae194 100644 --- a/src/Avalonia.X11/X11Clipboard.cs +++ b/src/Avalonia.X11/X11Clipboard.cs @@ -9,7 +9,7 @@ using Avalonia.Input.Platform; using static Avalonia.X11.XLib; namespace Avalonia.X11 { - class X11Clipboard : IClipboard + internal class X11Clipboard : IClipboard { private readonly X11Info _x11; private IDataObject _storedDataObject; @@ -33,12 +33,12 @@ namespace Avalonia.X11 }.Where(a => a != IntPtr.Zero).ToArray(); } - bool IsStringAtom(IntPtr atom) + private bool IsStringAtom(IntPtr atom) { return _textAtoms.Contains(atom); } - - Encoding GetStringEncoding(IntPtr atom) + + private Encoding GetStringEncoding(IntPtr atom) { return (atom == _x11.Atoms.XA_STRING || atom == _x11.Atoms.OEMTEXT) @@ -213,7 +213,7 @@ namespace Avalonia.X11 } } - Task SendFormatRequest() + private Task SendFormatRequest() { if (_requestedFormatsTcs == null || _requestedFormatsTcs.Task.IsCompleted) _requestedFormatsTcs = new TaskCompletionSource(); @@ -222,7 +222,7 @@ namespace Avalonia.X11 return _requestedFormatsTcs.Task; } - Task SendDataRequest(IntPtr format) + private Task SendDataRequest(IntPtr format) { if (_requestedDataTcs == null || _requestedFormatsTcs.Task.IsCompleted) _requestedDataTcs = new TaskCompletionSource(); @@ -230,7 +230,7 @@ namespace Avalonia.X11 return _requestedDataTcs.Task; } - bool HasOwner => XGetSelectionOwner(_x11.Display, _x11.Atoms.CLIPBOARD) != IntPtr.Zero; + private bool HasOwner => XGetSelectionOwner(_x11.Display, _x11.Atoms.CLIPBOARD) != IntPtr.Zero; public async Task GetTextAsync() { @@ -252,7 +252,7 @@ namespace Avalonia.X11 return (string)await SendDataRequest(target); } - void StoreAtomsInClipboardManager(IntPtr[] atoms) + private void StoreAtomsInClipboardManager(IntPtr[] atoms) { if (_x11.Atoms.CLIPBOARD_MANAGER != IntPtr.Zero && _x11.Atoms.SAVE_TARGETS != IntPtr.Zero) { diff --git a/src/Avalonia.X11/X11CursorFactory.cs b/src/Avalonia.X11/X11CursorFactory.cs index 16de10e163..56fd2f14ef 100644 --- a/src/Avalonia.X11/X11CursorFactory.cs +++ b/src/Avalonia.X11/X11CursorFactory.cs @@ -12,7 +12,7 @@ using Avalonia.Utilities; namespace Avalonia.X11 { - partial class X11CursorFactory : ICursorFactory + internal partial class X11CursorFactory : ICursorFactory { private static readonly byte[] NullCursorData = new byte[] { 0 }; @@ -142,7 +142,7 @@ namespace Avalonia.X11 } } - class CursorImpl : ICursorImpl + internal class CursorImpl : ICursorImpl { public CursorImpl() { } public CursorImpl(IntPtr handle) => Handle = handle; diff --git a/src/Avalonia.X11/X11Enums.cs b/src/Avalonia.X11/X11Enums.cs index d97e1c42bb..9d671ae6d2 100644 --- a/src/Avalonia.X11/X11Enums.cs +++ b/src/Avalonia.X11/X11Enums.cs @@ -3,7 +3,7 @@ using System; namespace Avalonia.X11 { - public enum Status + internal enum Status { Success = 0, /* everything's okay */ BadRequest = 1, /* bad request code */ @@ -38,7 +38,7 @@ namespace Avalonia.X11 } [Flags] - public enum XEventMask : int + internal enum XEventMask : int { NoEventMask = 0, KeyPressMask = (1 << 0), @@ -69,7 +69,7 @@ namespace Avalonia.X11 } [Flags] - public enum XModifierMask + internal enum XModifierMask { ShiftMask = (1 << 0), LockMask = (1 << 1), @@ -89,7 +89,7 @@ namespace Avalonia.X11 } [Flags] - public enum XCreateWindowFlags + internal enum XCreateWindowFlags { CWBackPixmap = (1 << 0), CWBackPixel = (1 << 1), diff --git a/src/Avalonia.X11/X11Exception.cs b/src/Avalonia.X11/X11Exception.cs index 2ac5a31d9b..231ece497b 100644 --- a/src/Avalonia.X11/X11Exception.cs +++ b/src/Avalonia.X11/X11Exception.cs @@ -2,7 +2,7 @@ using System; namespace Avalonia.X11 { - public class X11Exception : Exception + internal class X11Exception : Exception { public X11Exception(string message) : base(message) { diff --git a/src/Avalonia.X11/X11Framebuffer.cs b/src/Avalonia.X11/X11Framebuffer.cs index a9fedff8b5..90e4b18571 100644 --- a/src/Avalonia.X11/X11Framebuffer.cs +++ b/src/Avalonia.X11/X11Framebuffer.cs @@ -5,7 +5,7 @@ using SkiaSharp; using static Avalonia.X11.XLib; namespace Avalonia.X11 { - class X11Framebuffer : ILockedFramebuffer + internal class X11Framebuffer : ILockedFramebuffer { private readonly IntPtr _display; private readonly IntPtr _xid; diff --git a/src/Avalonia.X11/X11FramebufferSurface.cs b/src/Avalonia.X11/X11FramebufferSurface.cs index 07c88b51a8..05885d1a25 100644 --- a/src/Avalonia.X11/X11FramebufferSurface.cs +++ b/src/Avalonia.X11/X11FramebufferSurface.cs @@ -4,7 +4,7 @@ using Avalonia.Platform; using static Avalonia.X11.XLib; namespace Avalonia.X11 { - public class X11FramebufferSurface : IFramebufferPlatformSurface + internal class X11FramebufferSurface : IFramebufferPlatformSurface { private readonly IntPtr _display; private readonly IntPtr _xid; diff --git a/src/Avalonia.X11/X11Globals.cs b/src/Avalonia.X11/X11Globals.cs index 39834a44b3..1ae0544724 100644 --- a/src/Avalonia.X11/X11Globals.cs +++ b/src/Avalonia.X11/X11Globals.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using static Avalonia.X11.XLib; namespace Avalonia.X11 { - unsafe class X11Globals + internal unsafe class X11Globals { private readonly AvaloniaX11Platform _plat; private readonly int _screenNumber; @@ -75,7 +75,7 @@ namespace Avalonia.X11 } } - IntPtr GetSupportingWmCheck(IntPtr window) + private IntPtr GetSupportingWmCheck(IntPtr window) { XGetWindowProperty(_x11.Display, _rootWindow, _x11.Atoms._NET_SUPPORTING_WM_CHECK, IntPtr.Zero, new IntPtr(IntPtr.Size), false, @@ -95,7 +95,7 @@ namespace Avalonia.X11 } } - void UpdateCompositingAtomOwner() + private void UpdateCompositingAtomOwner() { // This procedure is described in https://tronche.com/gui/x/icccm/sec-2.html#s-2.8 @@ -128,10 +128,10 @@ namespace Avalonia.X11 if(ev.type == XEventName.DestroyNotify) UpdateCompositingAtomOwner(); } - - void UpdateWmName() => WmName = GetWmName(); - string GetWmName() + private void UpdateWmName() => WmName = GetWmName(); + + private string GetWmName() { var wm = GetSupportingWmCheck(_rootWindow); if (wm == IntPtr.Zero || wm != GetSupportingWmCheck(wm)) diff --git a/src/Avalonia.X11/X11IconLoader.cs b/src/Avalonia.X11/X11IconLoader.cs index bf59d72c0f..51db815b31 100644 --- a/src/Avalonia.X11/X11IconLoader.cs +++ b/src/Avalonia.X11/X11IconLoader.cs @@ -7,9 +7,9 @@ using Avalonia.Platform; namespace Avalonia.X11 { - class X11IconLoader : IPlatformIconLoader + internal class X11IconLoader : IPlatformIconLoader { - static IWindowIconImpl LoadIcon(Bitmap bitmap) + private static IWindowIconImpl LoadIcon(Bitmap bitmap) { var rv = new X11IconData(bitmap); bitmap.Dispose(); @@ -28,8 +28,8 @@ namespace Avalonia.X11 return LoadIcon(ms); } } - - unsafe class X11IconData : IWindowIconImpl, IFramebufferPlatformSurface + + internal unsafe class X11IconData : IWindowIconImpl, IFramebufferPlatformSurface { private int _width; private int _height; diff --git a/src/Avalonia.X11/X11Info.cs b/src/Avalonia.X11/X11Info.cs index 72f3bf3137..17cd6b12c6 100644 --- a/src/Avalonia.X11/X11Info.cs +++ b/src/Avalonia.X11/X11Info.cs @@ -6,7 +6,7 @@ using static Avalonia.X11.XLib; // ReSharper disable UnusedAutoPropertyAccessor.Local namespace Avalonia.X11 { - unsafe class X11Info + internal unsafe class X11Info { public IntPtr Display { get; } public IntPtr DeferredDisplay { get; } diff --git a/src/Avalonia.X11/X11KeyTransform.cs b/src/Avalonia.X11/X11KeyTransform.cs index 59f1da564c..6732a0f448 100644 --- a/src/Avalonia.X11/X11KeyTransform.cs +++ b/src/Avalonia.X11/X11KeyTransform.cs @@ -4,7 +4,7 @@ using Avalonia.Input; namespace Avalonia.X11 { - static class X11KeyTransform + internal static class X11KeyTransform { private static readonly Dictionary KeyDic = new Dictionary { diff --git a/src/Avalonia.X11/X11NativeControlHost.cs b/src/Avalonia.X11/X11NativeControlHost.cs index 6c4eb81c84..e8710580eb 100644 --- a/src/Avalonia.X11/X11NativeControlHost.cs +++ b/src/Avalonia.X11/X11NativeControlHost.cs @@ -6,7 +6,7 @@ using static Avalonia.X11.XLib; namespace Avalonia.X11 { // TODO: Actually implement XEmbed instead of simply using XReparentWindow - class X11NativeControlHost : INativeControlHostImpl + internal class X11NativeControlHost : INativeControlHostImpl { private readonly AvaloniaX11Platform _platform; public X11Window Window { get; } @@ -57,7 +57,7 @@ namespace Avalonia.X11 public bool IsCompatibleWith(IPlatformHandle handle) => handle.HandleDescriptor == "XID"; - class DumbWindow : INativeControlHostDestroyableControlHandle + private class DumbWindow : INativeControlHostDestroyableControlHandle { private readonly IntPtr _display; @@ -96,8 +96,8 @@ namespace Avalonia.X11 } } } - - class Attachment : INativeControlHostControlTopLevelAttachment + + private class Attachment : INativeControlHostControlTopLevelAttachment { private readonly IntPtr _display; private readonly IntPtr _orphanedWindow; @@ -129,7 +129,7 @@ namespace Avalonia.X11 _attachedTo = null; } - void CheckDisposed() + private void CheckDisposed() { if (_child == null) throw new ObjectDisposedException("X11 INativeControlHostControlTopLevelAttachment"); diff --git a/src/Avalonia.X11/X11Platform.cs b/src/Avalonia.X11/X11Platform.cs index c5ae327c2f..170c6ce6b3 100644 --- a/src/Avalonia.X11/X11Platform.cs +++ b/src/Avalonia.X11/X11Platform.cs @@ -20,7 +20,7 @@ using static Avalonia.X11.XLib; namespace Avalonia.X11 { - class AvaloniaX11Platform : IWindowingPlatform + internal class AvaloniaX11Platform : IWindowingPlatform { private Lazy _keyboardDevice = new Lazy(() => new KeyboardDevice()); public KeyboardDevice KeyboardDevice => _keyboardDevice.Value; @@ -35,7 +35,7 @@ namespace Avalonia.X11 public IntPtr OrphanedWindow { get; private set; } public X11Globals Globals { get; private set; } [DllImport("libc")] - static extern void setlocale(int type, string s); + private static extern void setlocale(int type, string s); public void Initialize(X11PlatformOptions options) { Options = options; @@ -138,7 +138,7 @@ namespace Avalonia.X11 throw new NotSupportedException(); } - static bool EnableIme(X11PlatformOptions options) + private static bool EnableIme(X11PlatformOptions options) { // Disable if explicitly asked by user var avaloniaImModule = Environment.GetEnvironmentVariable("AVALONIA_IM_MODULE"); @@ -160,7 +160,7 @@ namespace Avalonia.X11 return isCjkLocale; } - static bool ShouldUseXim() + private static bool ShouldUseXim() { // Check if we are forbidden from using IME if (Environment.GetEnvironmentVariable("AVALONIA_IM_MODULE") == "none" diff --git a/src/Avalonia.X11/X11PlatformThreading.cs b/src/Avalonia.X11/X11PlatformThreading.cs index d724cd2aed..1946642de3 100644 --- a/src/Avalonia.X11/X11PlatformThreading.cs +++ b/src/Avalonia.X11/X11PlatformThreading.cs @@ -9,7 +9,7 @@ using static Avalonia.X11.XLib; namespace Avalonia.X11 { - unsafe class X11PlatformThreading : IPlatformThreadingInterface + internal unsafe class X11PlatformThreading : IPlatformThreadingInterface { private readonly AvaloniaX11Platform _platform; private readonly IntPtr _display; @@ -19,7 +19,7 @@ namespace Avalonia.X11 private Thread _mainThread; [StructLayout(LayoutKind.Explicit)] - struct epoll_data + private struct epoll_data { [FieldOffset(0)] public IntPtr ptr; @@ -36,30 +36,30 @@ namespace Avalonia.X11 private const int O_NONBLOCK = 2048; [StructLayout(LayoutKind.Sequential)] - struct epoll_event + private struct epoll_event { public uint events; public epoll_data data; } [DllImport("libc")] - extern static int epoll_create1(int size); + private extern static int epoll_create1(int size); [DllImport("libc")] - extern static int epoll_ctl(int epfd, int op, int fd, ref epoll_event __event); + private extern static int epoll_ctl(int epfd, int op, int fd, ref epoll_event __event); [DllImport("libc")] - extern static int epoll_wait(int epfd, epoll_event* events, int maxevents, int timeout); + private extern static int epoll_wait(int epfd, epoll_event* events, int maxevents, int timeout); [DllImport("libc")] - extern static int pipe2(int* fds, int flags); + private extern static int pipe2(int* fds, int flags); [DllImport("libc")] - extern static IntPtr write(int fd, void* buf, IntPtr count); + private extern static IntPtr write(int fd, void* buf, IntPtr count); [DllImport("libc")] - extern static IntPtr read(int fd, void* buf, IntPtr count); - - enum EventCodes + private extern static IntPtr read(int fd, void* buf, IntPtr count); + + private enum EventCodes { X11 = 1, Signal =2 @@ -72,7 +72,7 @@ namespace Avalonia.X11 private int _epoll; private Stopwatch _clock = Stopwatch.StartNew(); - class X11Timer : IDisposable + private class X11Timer : IDisposable { private readonly X11PlatformThreading _parent; @@ -104,7 +104,7 @@ namespace Avalonia.X11 } } - List _timers = new List(); + private List _timers = new List(); public X11PlatformThreading(AvaloniaX11Platform platform) { @@ -139,12 +139,12 @@ namespace Avalonia.X11 throw new X11Exception("Unable to attach signal pipe to epoll"); } - int TimerComparer(X11Timer t1, X11Timer t2) + private int TimerComparer(X11Timer t1, X11Timer t2) { return t2.Priority - t1.Priority; } - void CheckSignaled() + private void CheckSignaled() { int buf = 0; while (read(_sigread, &buf, new IntPtr(4)).ToInt64() > 0) @@ -164,7 +164,7 @@ namespace Avalonia.X11 Signaled?.Invoke(prio); } - unsafe void HandleX11(CancellationToken cancellationToken) + private unsafe void HandleX11(CancellationToken cancellationToken) { while (XPending(_display) != 0) { diff --git a/src/Avalonia.X11/X11Screens.cs b/src/Avalonia.X11/X11Screens.cs index 87899b11ed..6c7283952d 100644 --- a/src/Avalonia.X11/X11Screens.cs +++ b/src/Avalonia.X11/X11Screens.cs @@ -8,7 +8,7 @@ using static Avalonia.X11.XLib; namespace Avalonia.X11 { - class X11Screens : IScreenImpl + internal class X11Screens : IScreenImpl { private IX11Screens _impl; @@ -17,7 +17,7 @@ namespace Avalonia.X11 _impl = impl; } - static unsafe X11Screen[] UpdateWorkArea(X11Info info, X11Screen[] screens) + private static unsafe X11Screen[] UpdateWorkArea(X11Info info, X11Screen[] screens) { var rect = default(PixelRect); foreach (var s in screens) @@ -58,14 +58,14 @@ namespace Avalonia.X11 XFree(prop); return screens; } - - class Randr15ScreensImpl : IX11Screens + + private class Randr15ScreensImpl : IX11Screens { private readonly X11ScreensUserSettings _settings; private X11Screen[] _cache; private X11Info _x11; private IntPtr _window; - const int EDIDStructureLength = 32; // Length of a EDID-Block-Length(128 bytes), XRRGetOutputProperty multiplies offset and length by 4 + private const int EDIDStructureLength = 32; // Length of a EDID-Block-Length(128 bytes), XRRGetOutputProperty multiplies offset and length by 4 public Randr15ScreensImpl(AvaloniaX11Platform platform, X11ScreensUserSettings settings) { @@ -160,7 +160,7 @@ namespace Avalonia.X11 } } - class FallbackScreensImpl : IX11Screens + private class FallbackScreensImpl : IX11Screens { public FallbackScreensImpl(X11Info info, X11ScreensUserSettings settings) { @@ -220,17 +220,17 @@ namespace Avalonia.X11 _impl.Screens.Select(s => new Screen(s.Scaling, s.Bounds, s.WorkingArea, s.IsPrimary)).ToArray(); } - interface IX11Screens + internal interface IX11Screens { X11Screen[] Screens { get; } } - class X11ScreensUserSettings + internal class X11ScreensUserSettings { public double GlobalScaleFactor { get; set; } = 1; public Dictionary NamedScaleFactors { get; set; } - static double? TryParse(string s) + private static double? TryParse(string s) { if (s == null) return null; @@ -276,7 +276,7 @@ namespace Avalonia.X11 } } - class X11Screen + internal class X11Screen { private const int FullHDWidth = 1920; private const int FullHDHeight = 1080; diff --git a/src/Avalonia.X11/X11Structs.cs b/src/Avalonia.X11/X11Structs.cs index 26515762b4..18f860a1a8 100644 --- a/src/Avalonia.X11/X11Structs.cs +++ b/src/Avalonia.X11/X11Structs.cs @@ -1751,8 +1751,7 @@ namespace Avalonia.X11 { { public IntPtr client_data; public XIMProc callback; - [NonSerialized] - GCHandle gch; + [NonSerialized] private GCHandle gch; public XIMCallback (IntPtr clientData, XIMProc proc) { @@ -1769,7 +1768,7 @@ namespace Avalonia.X11 { [StructLayout(LayoutKind.Sequential)] #pragma warning disable CA1815 // Override equals and operator equals on value types - public unsafe struct XImage + internal unsafe struct XImage #pragma warning restore CA1815 // Override equals and operator equals on value types { public int width, height; /* size of image */ @@ -1896,8 +1895,8 @@ namespace Avalonia.X11 { public const string XNSpotLocation = "spotLocation"; public const string XNFontSet = "fontSet"; } - - unsafe struct XRRMonitorInfo { + + internal unsafe struct XRRMonitorInfo { public IntPtr Name; public int Primary; public int Automatic; diff --git a/src/Avalonia.X11/X11Window.Ime.cs b/src/Avalonia.X11/X11Window.Ime.cs index e6066c7964..26ead5e6b8 100644 --- a/src/Avalonia.X11/X11Window.Ime.cs +++ b/src/Avalonia.X11/X11Window.Ime.cs @@ -11,7 +11,7 @@ using static Avalonia.X11.XLib; namespace Avalonia.X11 { - partial class X11Window + internal partial class X11Window { private ITextInputMethodImpl _ime; private IX11InputMethodControl _imeControl; @@ -20,7 +20,7 @@ namespace Avalonia.X11 private Queue<(RawKeyEventArgs args, XEvent xev, int keyval, int keycode)> _imeQueue = new Queue<(RawKeyEventArgs args, XEvent xev, int keyVal, int keyCode)>(); - unsafe void CreateIC() + private unsafe void CreateIC() { if (_x11.HasXim) { @@ -65,8 +65,8 @@ namespace Avalonia.X11 new IntPtr((int)(XIMProperties.XIMPreeditNothing | XIMProperties.XIMStatusNothing)), XNames.XNClientWindow, _handle, XNames.XNFocusWindow, _handle, IntPtr.Zero); } - - void InitializeIme() + + private void InitializeIme() { var ime = AvaloniaLocator.Current.GetService()?.CreateClient(_handle); if (ime == null && _x11.HasXim) @@ -89,9 +89,9 @@ namespace Avalonia.X11 } } - void UpdateImePosition() => _imeControl?.UpdateWindowInfo(Position, RenderScaling); + private void UpdateImePosition() => _imeControl?.UpdateWindowInfo(Position, RenderScaling); - void HandleKeyEvent(ref XEvent ev) + private void HandleKeyEvent(ref XEvent ev) { var index = ev.KeyEvent.state.HasAllFlags(XModifierMask.ShiftMask); @@ -117,7 +117,7 @@ namespace Avalonia.X11 ScheduleKeyInput(args, ref ev, (int)key, ev.KeyEvent.keycode); } - void TriggerClassicTextInputEvent(ref XEvent ev) + private void TriggerClassicTextInputEvent(ref XEvent ev) { var text = TranslateEventToString(ref ev); if (text != null) @@ -128,8 +128,8 @@ namespace Avalonia.X11 private const int ImeBufferSize = 64 * 1024; [ThreadStatic] private static IntPtr ImeBuffer; - - unsafe string TranslateEventToString(ref XEvent ev) + + private unsafe string TranslateEventToString(ref XEvent ev) { if (ImeBuffer == IntPtr.Zero) ImeBuffer = Marshal.AllocHGlobal(ImeBufferSize); @@ -158,9 +158,9 @@ namespace Avalonia.X11 return text; } - - - void ScheduleKeyInput(RawKeyEventArgs args, ref XEvent xev, int keyval, int keycode) + + + private void ScheduleKeyInput(RawKeyEventArgs args, ref XEvent xev, int keyval, int keycode) { _x11.LastActivityTimestamp = xev.ButtonEvent.time; @@ -170,8 +170,8 @@ namespace Avalonia.X11 ScheduleInput(args); } - - bool FilterIme(RawKeyEventArgs args, XEvent xev, int keyval, int keycode) + + private bool FilterIme(RawKeyEventArgs args, XEvent xev, int keyval, int keycode) { if (_ime == null) return false; @@ -182,7 +182,7 @@ namespace Avalonia.X11 return true; } - async void ProcessNextImeEvent() + private async void ProcessNextImeEvent() { if(_processingIme) return; @@ -203,7 +203,7 @@ namespace Avalonia.X11 } // This class is used to attach the text value of the key to an asynchronously dispatched KeyDown event - class RawKeyEventArgsWithText : RawKeyEventArgs + private class RawKeyEventArgsWithText : RawKeyEventArgs { public RawKeyEventArgsWithText(IKeyboardDevice device, ulong timestamp, IInputRoot root, RawKeyEventType type, Key key, RawInputModifiers modifiers, string text) : diff --git a/src/Avalonia.X11/X11Window.Xim.cs b/src/Avalonia.X11/X11Window.Xim.cs index 8446d35cc6..cc5ecad09f 100644 --- a/src/Avalonia.X11/X11Window.Xim.cs +++ b/src/Avalonia.X11/X11Window.Xim.cs @@ -8,9 +8,9 @@ using Avalonia.Threading; using static Avalonia.X11.XLib; namespace Avalonia.X11 { - partial class X11Window + internal partial class X11Window { - class XimInputMethod : ITextInputMethodImpl, IX11InputMethodControl + private class XimInputMethod : ITextInputMethodImpl, IX11InputMethodControl { private readonly X11Window _parent; private bool _windowActive, _imeActive; diff --git a/src/Avalonia.X11/X11Window.cs b/src/Avalonia.X11/X11Window.cs index c78ef2350e..9f09212814 100644 --- a/src/Avalonia.X11/X11Window.cs +++ b/src/Avalonia.X11/X11Window.cs @@ -27,7 +27,7 @@ using static Avalonia.X11.XLib; // ReSharper disable StringLiteralTypo namespace Avalonia.X11 { - unsafe partial class X11Window : IWindowImpl, IPopupImpl, IXI2Client + internal unsafe partial class X11Window : IWindowImpl, IPopupImpl, IXI2Client { private readonly AvaloniaX11Platform _platform; private readonly bool _popup; @@ -59,7 +59,7 @@ namespace Avalonia.X11 private bool _useRenderWindow = false; private bool _usePositioningFlags = false; - enum XSyncState + private enum XSyncState { None, WaitConfigure, @@ -219,7 +219,7 @@ namespace Avalonia.X11 }); } - class SurfaceInfo : EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo + private class SurfaceInfo : EglGlPlatformSurface.IEglWindowGlPlatformSurfaceInfo { private readonly X11Window _window; private readonly IntPtr _display; @@ -249,7 +249,7 @@ namespace Avalonia.X11 public double Scaling => _window.RenderScaling; } - void UpdateMotifHints() + private void UpdateMotifHints() { var functions = MotifFunctions.Move | MotifFunctions.Close | MotifFunctions.Resize | MotifFunctions.Minimize | MotifFunctions.Maximize; @@ -278,7 +278,7 @@ namespace Avalonia.X11 PropertyMode.Replace, ref hints, 5); } - void UpdateSizeHints(PixelSize? preResize) + private void UpdateSizeHints(PixelSize? preResize) { var min = _minMaxSize.minSize; var max = _minMaxSize.maxSize; @@ -386,7 +386,7 @@ namespace Avalonia.X11 public IRenderer CreateRenderer(IRenderRoot root) => new CompositingRenderer(root, _platform.Compositor, () => Surfaces); - void OnEvent(ref XEvent ev) + private void OnEvent(ref XEvent ev) { if (ev.type == XEventName.MapNotify) { @@ -668,7 +668,7 @@ namespace Avalonia.X11 } - static RawInputModifiers TranslateModifiers(XModifierMask state) + private static RawInputModifiers TranslateModifiers(XModifierMask state) { var rv = default(RawInputModifiers); if (state.HasAllFlags(XModifierMask.Button1Mask)) @@ -704,13 +704,13 @@ namespace Avalonia.X11 private double _scaling = 1; - void ScheduleInput(RawInputEventArgs args, ref XEvent xev) + private void ScheduleInput(RawInputEventArgs args, ref XEvent xev) { _x11.LastActivityTimestamp = xev.ButtonEvent.time; ScheduleInput(args); } - void DispatchInput(RawInputEventArgs args) + private void DispatchInput(RawInputEventArgs args) { Input?.Invoke(args); if (!args.Handled && args is RawKeyEventArgsWithText text && !string.IsNullOrEmpty(text.Text)) @@ -746,8 +746,8 @@ namespace Avalonia.X11 _rawEventGrouper.HandleEvent(args); } - - void MouseEvent(RawPointerEventType type, ref XEvent ev, XModifierMask mods) + + private void MouseEvent(RawPointerEventType type, ref XEvent ev, XModifierMask mods) { var mev = new RawPointerEventArgs( _mouse, (ulong)ev.ButtonEvent.time.ToInt64(), _inputRoot, @@ -755,7 +755,7 @@ namespace Avalonia.X11 ScheduleInput(mev, ref ev); } - void EnqueuePaint() + private void EnqueuePaint() { if (!_triggeredExpose) { @@ -767,8 +767,8 @@ namespace Avalonia.X11 }, DispatcherPriority.Render); } } - - void DoPaint() + + private void DoPaint() { Paint?.Invoke(new Rect()); if (_xSyncCounter != IntPtr.Zero && _xSyncState == XSyncState.WaitPaint) @@ -819,8 +819,8 @@ namespace Avalonia.X11 return null; } - - void Cleanup() + + private void Cleanup() { if (_rawEventGrouper != null) { @@ -871,7 +871,7 @@ namespace Avalonia.X11 } } - bool ActivateTransientChildIfNeeded() + private bool ActivateTransientChildIfNeeded() { if (_disabled) { @@ -923,9 +923,9 @@ namespace Avalonia.X11 Resize(size, true, PlatformResizeReason.Layout); } - PixelSize ToPixelSize(Size size) => new PixelSize((int)(size.Width * RenderScaling), (int)(size.Height * RenderScaling)); - - void Resize(Size clientSize, bool force, PlatformResizeReason reason) + private PixelSize ToPixelSize(Size size) => new PixelSize((int)(size.Width * RenderScaling), (int)(size.Height * RenderScaling)); + + private void Resize(Size clientSize, bool force, PlatformResizeReason reason) { if (!force && clientSize == ClientSize) return; @@ -1020,7 +1020,7 @@ namespace Avalonia.X11 .OrderByDescending(x => x.Width + x.Height).FirstOrDefault(); - void SendNetWMMessage(IntPtr message_type, IntPtr l0, + private void SendNetWMMessage(IntPtr message_type, IntPtr l0, IntPtr? l1 = null, IntPtr? l2 = null, IntPtr? l3 = null, IntPtr? l4 = null) { var xev = new XEvent @@ -1044,7 +1044,7 @@ namespace Avalonia.X11 } - void BeginMoveResize(NetWmMoveResize side, PointerPressedEventArgs e) + private void BeginMoveResize(NetWmMoveResize side, PointerPressedEventArgs e) { var pos = GetCursorPos(_x11); XUngrabPointer(_x11.Display, new IntPtr(0)); @@ -1184,7 +1184,7 @@ namespace Avalonia.X11 ChangeWMAtoms(!value, _x11.Atoms._NET_WM_STATE_SKIP_TASKBAR); } - void ChangeWMAtoms(bool enable, params IntPtr[] atoms) + private void ChangeWMAtoms(bool enable, params IntPtr[] atoms) { if (atoms.Length != 1 && atoms.Length != 2) throw new ArgumentException(); diff --git a/src/Avalonia.X11/XError.cs b/src/Avalonia.X11/XError.cs index 2cc8f63c96..fbe9c34686 100644 --- a/src/Avalonia.X11/XError.cs +++ b/src/Avalonia.X11/XError.cs @@ -2,11 +2,12 @@ using System; namespace Avalonia.X11 { - static class XError + internal static class XError { private static readonly XErrorHandler s_errorHandlerDelegate = Handler; public static XErrorEvent LastError; - static int Handler(IntPtr display, ref XErrorEvent error) + + private static int Handler(IntPtr display, ref XErrorEvent error) { LastError = error; return 0; diff --git a/src/Avalonia.X11/XI2Manager.cs b/src/Avalonia.X11/XI2Manager.cs index 7bf1df41b6..f66616f2aa 100644 --- a/src/Avalonia.X11/XI2Manager.cs +++ b/src/Avalonia.X11/XI2Manager.cs @@ -7,7 +7,7 @@ using static Avalonia.X11.XLib; namespace Avalonia.X11 { - unsafe class XI2Manager + internal unsafe class XI2Manager { private static readonly XiEventType[] DefaultEventTypes = new XiEventType[] { @@ -30,7 +30,7 @@ namespace Avalonia.X11 private bool _multitouch; private Dictionary _clients = new Dictionary(); - class DeviceInfo + private class DeviceInfo { public int Id { get; } public XIValuatorClassInfo[] Valuators { get; private set; } @@ -67,7 +67,7 @@ namespace Avalonia.X11 } } - class PointerDeviceInfo : DeviceInfo + private class PointerDeviceInfo : DeviceInfo { public PointerDeviceInfo(XIDeviceInfo info) : base(info) { @@ -197,7 +197,7 @@ namespace Avalonia.X11 } } - void OnEnterLeaveEvent(IXI2Client client, ref XIEnterLeaveEvent ev) + private void OnEnterLeaveEvent(IXI2Client client, ref XIEnterLeaveEvent ev) { if (ev.evtype == XiEventType.XI_Leave) { @@ -215,7 +215,7 @@ namespace Avalonia.X11 } } - void OnDeviceEvent(IXI2Client client, ParsedDeviceEvent ev) + private void OnDeviceEvent(IXI2Client client, ParsedDeviceEvent ev) { if (ev.Type == XiEventType.XI_TouchBegin || ev.Type == XiEventType.XI_TouchUpdate @@ -304,7 +304,7 @@ namespace Avalonia.X11 } } - unsafe class ParsedDeviceEvent + internal unsafe class ParsedDeviceEvent { public XiEventType Type { get; } public RawInputModifiers Modifiers { get; } @@ -367,8 +367,8 @@ namespace Avalonia.X11 Emulated = ev->flags.HasAllFlags(XiDeviceEventFlags.XIPointerEmulated); } } - - interface IXI2Client + + internal interface IXI2Client { IInputRoot InputRoot { get; } void ScheduleXI2Input(RawInputEventArgs args); diff --git a/src/Avalonia.X11/XIStructs.cs b/src/Avalonia.X11/XIStructs.cs index f4581a99ba..9a1ed01764 100644 --- a/src/Avalonia.X11/XIStructs.cs +++ b/src/Avalonia.X11/XIStructs.cs @@ -10,7 +10,7 @@ using Atom = System.IntPtr; namespace Avalonia.X11 { [StructLayout(LayoutKind.Sequential)] - struct XIAddMasterInfo + internal struct XIAddMasterInfo { public int Type; public IntPtr Name; @@ -19,7 +19,7 @@ namespace Avalonia.X11 } [StructLayout(LayoutKind.Sequential)] - struct XIRemoveMasterInfo + internal struct XIRemoveMasterInfo { public int Type; public int Deviceid; @@ -29,7 +29,7 @@ namespace Avalonia.X11 }; [StructLayout(LayoutKind.Sequential)] - struct XIAttachSlaveInfo + internal struct XIAttachSlaveInfo { public int Type; public int Deviceid; @@ -37,14 +37,14 @@ namespace Avalonia.X11 }; [StructLayout(LayoutKind.Sequential)] - struct XIDetachSlaveInfo + internal struct XIDetachSlaveInfo { public int Type; public int Deviceid; }; [StructLayout(LayoutKind.Explicit)] - struct XIAnyHierarchyChangeInfo + internal struct XIAnyHierarchyChangeInfo { [FieldOffset(0)] public int type; /* must be first element */ @@ -59,7 +59,7 @@ namespace Avalonia.X11 }; [StructLayout(LayoutKind.Sequential)] - struct XIModifierState + internal struct XIModifierState { public int Base; public int Latched; @@ -68,14 +68,14 @@ namespace Avalonia.X11 }; [StructLayout(LayoutKind.Sequential)] - unsafe struct XIButtonState + internal unsafe struct XIButtonState { public int MaskLen; public byte* Mask; }; [StructLayout(LayoutKind.Sequential)] - unsafe struct XIValuatorState + internal unsafe struct XIValuatorState { public int MaskLen; public byte* Mask; @@ -83,7 +83,7 @@ namespace Avalonia.X11 }; [StructLayout(LayoutKind.Sequential)] - unsafe struct XIEventMask + internal unsafe struct XIEventMask { public int Deviceid; public int MaskLen; @@ -91,14 +91,14 @@ namespace Avalonia.X11 }; [StructLayout(LayoutKind.Sequential)] - struct XIAnyClassInfo + internal struct XIAnyClassInfo { public XiDeviceClass Type; public int Sourceid; }; [StructLayout(LayoutKind.Sequential)] - unsafe struct XIButtonClassInfo + internal unsafe struct XIButtonClassInfo { public int Type; public int Sourceid; @@ -108,7 +108,7 @@ namespace Avalonia.X11 }; [StructLayout(LayoutKind.Sequential)] - unsafe struct XIKeyClassInfo + internal unsafe struct XIKeyClassInfo { public int Type; public int Sourceid; @@ -117,7 +117,7 @@ namespace Avalonia.X11 }; [StructLayout(LayoutKind.Sequential)] - struct XIValuatorClassInfo + internal struct XIValuatorClassInfo { public int Type; public int Sourceid; @@ -132,7 +132,7 @@ namespace Avalonia.X11 /* new in XI 2.1 */ [StructLayout(LayoutKind.Sequential)] - struct XIScrollClassInfo + internal struct XIScrollClassInfo { public int Type; public int Sourceid; @@ -142,14 +142,14 @@ namespace Avalonia.X11 public int Flags; }; - enum XiScrollType + internal enum XiScrollType { Vertical = 1, Horizontal = 2 } [StructLayout(LayoutKind.Sequential)] - struct XITouchClassInfo + internal struct XITouchClassInfo { public int Type; public int Sourceid; @@ -158,7 +158,7 @@ namespace Avalonia.X11 }; [StructLayout(LayoutKind.Sequential)] - unsafe struct XIDeviceInfo + internal unsafe struct XIDeviceInfo { public int Deviceid; public IntPtr Name; @@ -169,7 +169,7 @@ namespace Avalonia.X11 public XIAnyClassInfo** Classes; } - enum XiDeviceType + internal enum XiDeviceType { XIMasterPointer = 1, XIMasterKeyboard = 2, @@ -178,13 +178,13 @@ namespace Avalonia.X11 XIFloatingSlave = 5 } - enum XiPredefinedDeviceId : int + internal enum XiPredefinedDeviceId : int { XIAllDevices = 0, XIAllMasterDevices = 1 } - enum XiDeviceClass + internal enum XiDeviceClass { XIKeyClass = 0, XIButtonClass = 1, @@ -194,7 +194,7 @@ namespace Avalonia.X11 } [StructLayout(LayoutKind.Sequential)] - unsafe struct XIDeviceChangedEvent + internal unsafe struct XIDeviceChangedEvent { public int Type; /* GenericEvent */ public UIntPtr Serial; /* # of last request processed by server */ @@ -211,7 +211,7 @@ namespace Avalonia.X11 } [StructLayout(LayoutKind.Sequential)] - struct XIDeviceEvent + internal struct XIDeviceEvent { public XEventName type; /* GenericEvent */ public UIntPtr serial; /* # of last request processed by server */ @@ -238,7 +238,7 @@ namespace Avalonia.X11 } [StructLayout(LayoutKind.Sequential)] - unsafe struct XIEnterLeaveEvent + internal unsafe struct XIEnterLeaveEvent { public XEventName type; /* GenericEvent */ public UIntPtr serial; /* # of last request processed by server */ @@ -266,14 +266,14 @@ namespace Avalonia.X11 } [Flags] - public enum XiDeviceEventFlags : int + internal enum XiDeviceEventFlags : int { None = 0, XIPointerEmulated = (1 << 16) } [StructLayout(LayoutKind.Sequential)] - unsafe struct XIEvent + internal unsafe struct XIEvent { public int type; /* GenericEvent */ public UIntPtr serial; /* # of last request processed by server */ @@ -284,7 +284,7 @@ namespace Avalonia.X11 public IntPtr time; } - enum XiEventType + internal enum XiEventType { XI_DeviceChanged = 1, XI_KeyPress = 2, @@ -315,7 +315,7 @@ namespace Avalonia.X11 XI_LASTEVENT = XI_BarrierLeave, } - enum XiEnterLeaveDetail + internal enum XiEnterLeaveDetail { XINotifyAncestor = 0, XINotifyVirtual = 1, diff --git a/src/Avalonia.X11/XLib.cs b/src/Avalonia.X11/XLib.cs index 753d5f530c..7a43cd378b 100644 --- a/src/Avalonia.X11/XLib.cs +++ b/src/Avalonia.X11/XLib.cs @@ -16,11 +16,11 @@ namespace Avalonia.X11 { internal unsafe static class XLib { - const string libX11 = "libX11.so.6"; - const string libX11Randr = "libXrandr.so.2"; - const string libX11Ext = "libXext.so.6"; - const string libXInput = "libXi.so.6"; - const string libXCursor = "libXcursor.so.1"; + private const string libX11 = "libX11.so.6"; + private const string libX11Randr = "libXrandr.so.2"; + private const string libX11Ext = "libXext.so.6"; + private const string libXInput = "libXi.so.6"; + private const string libXCursor = "libXcursor.so.1"; [DllImport(libX11)] public static extern IntPtr XOpenDisplay(IntPtr display); diff --git a/src/Shared/RawEventGrouping.cs b/src/Shared/RawEventGrouping.cs index 966744888c..c4772db820 100644 --- a/src/Shared/RawEventGrouping.cs +++ b/src/Shared/RawEventGrouping.cs @@ -17,8 +17,8 @@ internal class RawEventGrouper : IDisposable private readonly Action _eventCallback; private readonly Queue _inputQueue = new(); private readonly Action _dispatchFromQueue; - readonly Dictionary _lastTouchPoints = new(); - RawInputEventArgs? _lastEvent; + private readonly Dictionary _lastTouchPoints = new(); + private RawInputEventArgs? _lastEvent; public RawEventGrouper(Action eventCallback) {