protected override void Initialize() { _xkbContext = XkbCommon.xkb_context_new(); if (_xkbContext == null) { throw new OpenWindowException("Failed to create xkbcommon context."); } LogDebug("Connecting to display..."); _wlDisplay = WlDisplay.Connect(); if (_wlDisplay.IsNull) { var error = WaylandClient.wl_display_get_error(null); throw new OpenWindowException($"Failed to connect to Wayland display ({error})."); } _wlDisplay.SetListener(DisplayErrorCallback, null); LogDebug("Connected to display."); WaylandBindings.Load(); XdgShellBindings.Load(); XdgDecorationUnstableV1Bindings.Load(); ViewporterBindings.Load(); _wlRegistry = _wlDisplay.GetRegistry(); if (_wlRegistry.IsNull) { throw new OpenWindowException("Failed to get Wayland registry."); } LogDebug("Got registry."); _wlRegistry.SetListener(RegistryGlobalCallback, RegistryGlobalRemoveCallback); LogDebug("Initiating first display roundtrip."); _wlDisplay.Roundtrip(); LogDebug("Initiating second display roundtrip."); _wlDisplay.Roundtrip(); if (_wlCompositor.IsNull) { throw new OpenWindowException("Server did not advertise a compositor."); } if (_xdgWmBase.IsNull) { if (_wlShellAvailable) { LogError("Server did not advertise xdg_wm_base, but it advertised a wl_shell. wl_shell is deprecated and not supported by OpenWindow."); } throw new OpenWindowException("Server did not advertise xdg_wm_base."); } }
public void OnGlobalRemove(WlRegistry eventSender, uint name) { _globals.Remove(name); }
public void OnGlobal(WlRegistry eventSender, uint name, string @interface, uint version) { _globals[name] = new GlobalInfo(name, @interface, version); }
public RegistryHandler(WlRegistry registry) { _registry = registry; }