public ShellSurface CreateShellSurface(SharedMemory sharedMemory, Shell shell) { IntPtr surfaceHandle = CompositorCreateSurface(Handle); ShellSurface surface = new ShellSurface(ShellGetShellSurface(shell.Handle, surfaceHandle), surfaceHandle, sharedMemory); Surfaces.Add(surface); return(surface); }
public ShellSurface(IntPtr handle, IntPtr surfaceHandle, SharedMemory sharedMemory) : base(surfaceHandle, sharedMemory) { ShellSurfaceHandle = handle; SurfaceType = SurfaceType.WaylandShell; _surfacePingListener = OnShellSurfacePing; _surfaceConfigureListener = OnShellSurfaceConfigure; _surfacePopupDoneListener = OnShellSurfacePopupDone; ShellSurfaceSetTopLevel(handle); ShellSurfaceAddListeners(handle, _surfacePingListener, _surfaceConfigureListener, _surfacePopupDoneListener); }
/// <summary> /// Handle the registry announcing something. /// </summary> /// <param name="data"></param> /// <param name="registry"></param> /// <param name="id"></param> /// <param name="interfaceName"></param> /// <param name="version"></param> void OnRegistryAnnounce(IntPtr data, IntPtr registry, uint id, string interfaceName, uint version) { if (interfaceName == "wl_compositor" && Compositor == null) { Compositor = new Compositor(RegistryBindCompositor(registry, id)); } else if (interfaceName == "wl_shell" && Shell == null) { Shell = new Shell(RegistryBindShell(registry, id)); } else if (interfaceName == "wl_shm" && SharedMemory == null) { SharedMemory = new SharedMemory(RegistryBindSharedMemory(registry, id)); } else if (interfaceName == "wl_seat" && Seat == null) { Seat = new Seat(RegistryBindSeat(registry, id)); } }
protected override void ReleaseWaylandObject() { if (SharedMemory != null) { SharedMemory.Dispose(); SharedMemory = null; } if (Shell != null) { Shell.Dispose(); Shell = null; } if (Seat != null) { Seat.Dispose(); Seat = null; } if (Compositor != null) { Compositor.Dispose(); Compositor = null; } }
/// <summary> /// Handle the registry removing something. /// </summary> /// <param name="data"></param> /// <param name="registry"></param> /// <param name="id"></param> void OnRegistryRemove(IntPtr data, IntPtr registry, uint id) { if (Compositor != null && registry == Compositor.Handle) { Compositor.Dispose(); Compositor = null; } if (SharedMemory != null && registry == SharedMemory.Handle) { SharedMemory.Dispose(); SharedMemory = null; } if (Shell != null && registry == Shell.Handle) { Shell.Dispose(); Shell = null; } if (Seat != null && registry == Seat.Handle) { Seat.Dispose(); Seat = null; } }
public Surface(IntPtr handle, SharedMemory sharedMemory) : base(handle) { _frameListener = OnFrameListener; _sharedMemory = sharedMemory; }