Пример #1
0
        /// <summary>
        /// <p>
        /// Set the toplevel surface decoration mode. This informs the compositor
        /// that the client prefers the provided decoration mode.
        /// </p>
        /// <p>
        /// After requesting a decoration mode, the compositor will respond by
        /// emitting a xdg_surface.configure event. The client should then update
        /// its content, drawing it without decorations if the received mode is
        /// server-side decorations. The client must also acknowledge the configure
        /// when committing the new content (see xdg_surface.ack_configure).
        /// </p>
        /// <p>
        /// The compositor can decide not to use the client's mode and enforce a
        /// different mode instead.
        /// </p>
        /// <p>
        /// Clients whose decoration mode depend on the xdg_toplevel state may send
        /// a set_mode request in response to a xdg_surface.configure event and wait
        /// for the next xdg_surface.configure event to prevent unwanted state.
        /// Such clients are responsible for preventing configure loops and must
        /// make sure not to send multiple successive set_mode requests with the
        /// same decoration mode.
        /// </p>
        /// </summary>
        /// <param name="mode">the decoration mode</param>
        public static void zxdg_toplevel_decoration_v1_set_mode(zxdg_toplevel_decoration_v1 *pointer, zxdg_toplevel_decoration_v1_mode mode)
        {
            var args = stackalloc wl_argument[1];

            args[0] = (int)mode;
            WaylandClient.wl_proxy_marshal_array((wl_proxy *)pointer, 1, args);
        }
Пример #2
0
        /// <summary>
        /// <p>
        /// Set the destination size of the associated wl_surface. See
        /// wp_viewport for the description, and relation to the wl_buffer
        /// size.
        /// </p>
        /// <p>
        /// If width is -1 and height is -1, the destination size is unset
        /// instead. Any other pair of values for width and height that
        /// contains zero or negative values raises the bad_value protocol
        /// error.
        /// </p>
        /// <p>
        /// The crop and scale state is double-buffered state, and will be
        /// applied on the next wl_surface.commit.
        /// </p>
        /// </summary>
        /// <param name="width">surface width</param>
        /// <param name="height">surface height</param>
        public static void wp_viewport_set_destination(wp_viewport *pointer, int width, int height)
        {
            var args = stackalloc wl_argument[2];

            args[0] = width;
            args[1] = height;
            WaylandClient.wl_proxy_marshal_array((wl_proxy *)pointer, 2, args);
        }
Пример #3
0
        /// <summary>
        /// <p>
        /// Set the source rectangle of the associated wl_surface. See
        /// wp_viewport for the description, and relation to the wl_buffer
        /// size.
        /// </p>
        /// <p>
        /// If all of x, y, width and height are -1.0, the source rectangle is
        /// unset instead. Any other set of values where width or height are zero
        /// or negative, or x or y are negative, raise the bad_value protocol
        /// error.
        /// </p>
        /// <p>
        /// The crop and scale state is double-buffered state, and will be
        /// applied on the next wl_surface.commit.
        /// </p>
        /// </summary>
        /// <param name="x">source rectangle x</param>
        /// <param name="y">source rectangle y</param>
        /// <param name="width">source rectangle width</param>
        /// <param name="height">source rectangle height</param>
        public static void wp_viewport_set_source(wp_viewport *pointer, wl_fixed x, wl_fixed y, wl_fixed width, wl_fixed height)
        {
            var args = stackalloc wl_argument[4];

            args[0] = x;
            args[1] = y;
            args[2] = width;
            args[3] = height;
            WaylandClient.wl_proxy_marshal_array((wl_proxy *)pointer, 1, args);
        }
Пример #4
0
        /// <summary>
        /// <p>
        /// Instantiate an interface extension for the given wl_surface to
        /// crop and scale its content. If the given wl_surface already has
        /// a wp_viewport object associated, the viewport_exists
        /// protocol error is raised.
        /// </p>
        /// </summary>
        /// <param name="id">the new viewport interface id</param>
        /// <param name="surface">the surface</param>
        public static wp_viewport *wp_viewporter_get_viewport(wp_viewporter *pointer, wl_surface *surface)
        {
            var args = stackalloc wl_argument[2];

            args[0] = 0;
            args[1] = surface;
            var ptr = WaylandClient.wl_proxy_marshal_array_constructor((wl_proxy *)pointer, 1, args, wp_viewport.Interface);

            return((wp_viewport *)ptr);
        }
Пример #5
0
        /// <summary>
        /// <p>
        /// Create a new decoration object associated with the given toplevel.
        /// </p>
        /// <p>
        /// Creating an xdg_toplevel_decoration from an xdg_toplevel which has a
        /// buffer attached or committed is a client error, and any attempts by a
        /// client to attach or manipulate a buffer prior to the first
        /// xdg_toplevel_decoration.configure event must also be treated as
        /// errors.
        /// </p>
        /// </summary>
        public static zxdg_toplevel_decoration_v1 *zxdg_decoration_manager_v1_get_toplevel_decoration(zxdg_decoration_manager_v1 *pointer, xdg_toplevel *toplevel)
        {
            var args = stackalloc wl_argument[2];

            args[0] = 0;
            args[1] = toplevel;
            var ptr = WaylandClient.wl_proxy_marshal_array_constructor((wl_proxy *)pointer, 1, args, zxdg_toplevel_decoration_v1.Interface);

            return((zxdg_toplevel_decoration_v1 *)ptr);
        }
Пример #6
0
        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.");
            }
        }
Пример #7
0
 /// <summary>
 /// <p>
 /// Informs the server that the client will not be using this
 /// protocol object anymore. This does not affect any other objects,
 /// wp_viewport objects included.
 /// </p>
 /// </summary>
 public static void wp_viewporter_destroy(wp_viewporter *pointer)
 {
     WaylandClient.wl_proxy_marshal((wl_proxy *)pointer, 0);
 }
Пример #8
0
 /// <summary>
 /// <p>
 /// Destroy the decoration manager. This doesn't destroy objects created
 /// with the manager.
 /// </p>
 /// </summary>
 public static void zxdg_decoration_manager_v1_destroy(zxdg_decoration_manager_v1 *pointer)
 {
     WaylandClient.wl_proxy_marshal((wl_proxy *)pointer, 0);
 }
Пример #9
0
 /// <summary>
 /// Set the callbacks for the given <see cref="zxdg_toplevel_decoration_v1"/>.
 /// </summary>
 /// <param name="mode">the decoration mode</param>
 public static int zxdg_toplevel_decoration_v1_add_listener(zxdg_toplevel_decoration_v1 *iface, zxdg_toplevel_decoration_v1_listener *listener)
 {
     return(WaylandClient.wl_proxy_add_listener((wl_proxy *)iface, listener, null));
 }
Пример #10
0
 /// <summary>
 /// <p>
 /// Unset the toplevel surface decoration mode. This informs the compositor
 /// that the client doesn't prefer a particular decoration mode.
 /// </p>
 /// <p>
 /// This request has the same semantics as set_mode.
 /// </p>
 /// </summary>
 public static void zxdg_toplevel_decoration_v1_unset_mode(zxdg_toplevel_decoration_v1 *pointer)
 {
     WaylandClient.wl_proxy_marshal((wl_proxy *)pointer, 2);
 }