Esempio n. 1
0
        public unsafe T Bind <T>(IBindFactory <T> factory, string iface, int?version) where T : WlProxy
        {
            var glob = GetGlobals().FirstOrDefault(g => g.Interface == iface);

            if (glob == null)
            {
                throw new NotSupportedException($"Unable to find {iface} in the registry");
            }

            version ??= factory.GetInterface()->Version;
            if (version > factory.GetInterface()->Version)
            {
                throw new ArgumentException($"Version {version} is not supported");
            }

            if (glob.Version < version)
            {
                throw new NotSupportedException(
                          $"Compositor doesn't support {version} of {iface}, only {glob.Version} is supported");
            }

            return(_registry.Bind(glob.Name, factory, version.Value));
        }
Esempio n. 2
0
 public T Bind <T>(uint name, IBindFactory <T> factory, int?version) where T : WlProxy
 {
     ref var iface = ref *factory.GetInterface();