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

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

            impl.destroy           = this.Destroy;
            impl.getToplevel       = this.GetToplevel;
            impl.getPopup          = this.GetPopup;
            impl.setWindowGeometry = this.SetWindowGeometry;
            impl.ackConfigure      = this.AckConfigure;
            return(impl);
        }
 public ZxdgSurfaceV6(IntPtr clientPtr, Int32 version, UInt32 id, IntPtr otherResource, bool addToClient = true)
 {
     this.client           = Display.GetClient(clientPtr);
     this.resource         = Resource.Create(clientPtr, XdgShellUnstableV6Interfaces.zxdgSurfaceV6Interface.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);
     }
 }