private ZxdgPopupV6Implementation managedImplementation;         // Store managed copy of implementation so delegates are not GC'd

        public ZxdgPopupV6Implementation InitializeImplementation()
        {
            ZxdgPopupV6Implementation impl = new ZxdgPopupV6Implementation();

            impl.destroy = this.Destroy;
            impl.grab    = this.Grab;
            return(impl);
        }
 public ZxdgPopupV6(IntPtr clientPtr, Int32 version, UInt32 id, IntPtr otherResource, bool addToClient = true)
 {
     this.client           = Display.GetClient(clientPtr);
     this.resource         = Resource.Create(clientPtr, XdgShellUnstableV6Interfaces.zxdgPopupV6Interface.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);
     }
 }