Files
Dave Friedel f7043ab9c7 Major production merge: GTK support, context menus, and dispatcher fixes
Core Infrastructure:
- Add Dispatching folder with LinuxDispatcher, LinuxDispatcherProvider, LinuxDispatcherTimer
- Add Native folder with P/Invoke wrappers (GTK, GLib, GDK, Cairo, WebKit)
- Add GTK host window system with GtkHostWindow and GtkSkiaSurfaceWidget
- Update LinuxApplication with GTK mode, theme handling, and icon support
- Fix duplicate LinuxDispatcher in LinuxMauiContext

Handlers:
- Add GtkWebViewManager and GtkWebViewPlatformView for GTK WebView
- Add FlexLayoutHandler and GestureManager
- Update multiple handlers with ToViewHandler fix and missing mappers
- Add MauiHandlerExtensions with ToViewHandler extension method

Views:
- Add SkiaContextMenu with hover, keyboard, and dark theme support
- Add LinuxDialogService with context menu management
- Add SkiaFlexLayout for flex container support
- Update SkiaShell with RefreshTheme, MauiShell, ContentRenderer
- Update SkiaWebView with SetMainWindow, ProcessGtkEvents
- Update SkiaImage with LoadFromBitmap method

Services:
- Add AppInfoService, ConnectivityService, DeviceDisplayService, DeviceInfoService
- Add GtkHostService, GtkContextMenuService, MauiIconGenerator

Window:
- Add CursorType enum and GtkHostWindow
- Update X11Window with SetIcon, SetCursor methods

Build: SUCCESS (0 errors)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 11:19:58 -05:00

133 lines
3.4 KiB
C#

using System;
using System.Runtime.InteropServices;
namespace Microsoft.Maui.Platform.Linux.Native;
internal static class GdkNative
{
[Flags]
public enum GdkEventMask
{
ExposureMask = 2,
PointerMotionMask = 4,
PointerMotionHintMask = 8,
ButtonMotionMask = 0x10,
Button1MotionMask = 0x20,
Button2MotionMask = 0x40,
Button3MotionMask = 0x80,
ButtonPressMask = 0x100,
ButtonReleaseMask = 0x200,
KeyPressMask = 0x400,
KeyReleaseMask = 0x800,
EnterNotifyMask = 0x1000,
LeaveNotifyMask = 0x2000,
FocusChangeMask = 0x4000,
StructureMask = 0x8000,
PropertyChangeMask = 0x10000,
VisibilityNotifyMask = 0x20000,
ProximityInMask = 0x40000,
ProximityOutMask = 0x80000,
SubstructureMask = 0x100000,
ScrollMask = 0x200000,
TouchMask = 0x400000,
SmoothScrollMask = 0x800000,
AllEventsMask = 0xFFFFFE
}
public enum GdkScrollDirection
{
Up,
Down,
Left,
Right,
Smooth
}
public struct GdkEventButton
{
public int Type;
public IntPtr Window;
public sbyte SendEvent;
public uint Time;
public double X;
public double Y;
public IntPtr Axes;
public uint State;
public uint Button;
public IntPtr Device;
public double XRoot;
public double YRoot;
}
public struct GdkEventMotion
{
public int Type;
public IntPtr Window;
public sbyte SendEvent;
public uint Time;
public double X;
public double Y;
public IntPtr Axes;
public uint State;
public short IsHint;
public IntPtr Device;
public double XRoot;
public double YRoot;
}
public struct GdkEventKey
{
public int Type;
public IntPtr Window;
public sbyte SendEvent;
public uint Time;
public uint State;
public uint Keyval;
public int Length;
public IntPtr String;
public ushort HardwareKeycode;
public byte Group;
public uint IsModifier;
}
public struct GdkEventScroll
{
public int Type;
public IntPtr Window;
public sbyte SendEvent;
public uint Time;
public double X;
public double Y;
public uint State;
public GdkScrollDirection Direction;
public IntPtr Device;
public double XRoot;
public double YRoot;
public double DeltaX;
public double DeltaY;
}
private const string Lib = "libgdk-3.so.0";
[DllImport("libgdk-3.so.0")]
public static extern IntPtr gdk_display_get_default();
[DllImport("libgdk-3.so.0")]
public static extern IntPtr gdk_display_get_name(IntPtr display);
[DllImport("libgdk-3.so.0")]
public static extern IntPtr gdk_screen_get_default();
[DllImport("libgdk-3.so.0")]
public static extern int gdk_screen_get_width(IntPtr screen);
[DllImport("libgdk-3.so.0")]
public static extern int gdk_screen_get_height(IntPtr screen);
[DllImport("libgdk-3.so.0")]
public static extern void gdk_window_invalidate_rect(IntPtr window, IntPtr rect, bool invalidateChildren);
[DllImport("libgdk-3.so.0")]
public static extern uint gdk_keyval_to_unicode(uint keyval);
}