public ZxdgToplevelV6(IntPtr clientPtr, Int32 version, UInt32 id, IntPtr otherResource, bool addToClient = true) { this.client = Display.GetClient(clientPtr); this.resource = Resource.Create(clientPtr, XdgShellUnstableV6Interfaces.zxdgToplevelV6Interface.ifaceNative, version, id); managedImplementation = this.InitializeImplementation(); this.deleteFunction = new DeleteFunction(this.Delete); this.implementation = Marshal.AllocHGlobal(Marshal.SizeOf(managedImplementation)); Marshal.StructureToPtr(managedImplementation, this.implementation, false); Resource.SetImplementation(resource, this.implementation, otherResource, this.deleteFunction); if (addToClient) { client.resources.Add(this); } }
private ZxdgToplevelV6Implementation managedImplementation; // Store managed copy of implementation so delegates are not GC'd public ZxdgToplevelV6Implementation InitializeImplementation() { ZxdgToplevelV6Implementation impl = new ZxdgToplevelV6Implementation(); impl.destroy = this.Destroy; impl.setParent = this.SetParent; impl.setTitle = this.SetTitle; impl.setAppId = this.SetAppId; impl.showWindowMenu = this.ShowWindowMenu; impl.move = this.Move; impl.resize = this.Resize; impl.setMaxSize = this.SetMaxSize; impl.setMinSize = this.SetMinSize; impl.setMaximized = this.SetMaximized; impl.unsetMaximized = this.UnsetMaximized; impl.setFullscreen = this.SetFullscreen; impl.unsetFullscreen = this.UnsetFullscreen; impl.setMinimized = this.SetMinimized; return(impl); }