mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 05:25:41 -05:00
cli: add interactive color picker
This commit is contained in:
792
core/internal/proto/wlr_layer_shell/layer_shell.go
Normal file
792
core/internal/proto/wlr_layer_shell/layer_shell.go
Normal file
@@ -0,0 +1,792 @@
|
||||
// Generated by go-wayland-scanner
|
||||
// https://github.com/yaslama/go-wayland/cmd/go-wayland-scanner
|
||||
// XML file : internal/proto/xml/wlr-layer-shell-unstable-v1.xml
|
||||
//
|
||||
// wlr_layer_shell_unstable_v1 Protocol Copyright:
|
||||
//
|
||||
// Copyright © 2017 Drew DeVault
|
||||
//
|
||||
// Permission to use, copy, modify, distribute, and sell this
|
||||
// software and its documentation for any purpose is hereby granted
|
||||
// without fee, provided that the above copyright notice appear in
|
||||
// all copies and that both that copyright notice and this permission
|
||||
// notice appear in supporting documentation, and that the name of
|
||||
// the copyright holders not be used in advertising or publicity
|
||||
// pertaining to distribution of the software without specific,
|
||||
// written prior permission. The copyright holders make no
|
||||
// representations about the suitability of this software for any
|
||||
// purpose. It is provided "as is" without express or implied
|
||||
// warranty.
|
||||
//
|
||||
// THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
// SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
// FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
// SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
// AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
// ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
// THIS SOFTWARE.
|
||||
|
||||
package wlr_layer_shell
|
||||
|
||||
import (
|
||||
"github.com/AvengeMedia/DankMaterialShell/core/pkg/go-wayland/wayland/client"
|
||||
xdg_shell "github.com/AvengeMedia/DankMaterialShell/core/pkg/go-wayland/wayland/stable/xdg-shell"
|
||||
)
|
||||
|
||||
// ZwlrLayerShellV1InterfaceName is the name of the interface as it appears in the [client.Registry].
|
||||
// It can be used to match the [client.RegistryGlobalEvent.Interface] in the
|
||||
// [Registry.SetGlobalHandler] and can be used in [Registry.Bind] if this applies.
|
||||
const ZwlrLayerShellV1InterfaceName = "zwlr_layer_shell_v1"
|
||||
|
||||
// ZwlrLayerShellV1 : create surfaces that are layers of the desktop
|
||||
//
|
||||
// Clients can use this interface to assign the surface_layer role to
|
||||
// wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
||||
// rendered with a defined z-depth respective to each other. They may also be
|
||||
// anchored to the edges and corners of a screen and specify input handling
|
||||
// semantics. This interface should be suitable for the implementation of
|
||||
// many desktop shell components, and a broad number of other applications
|
||||
// that interact with the desktop.
|
||||
type ZwlrLayerShellV1 struct {
|
||||
client.BaseProxy
|
||||
}
|
||||
|
||||
// NewZwlrLayerShellV1 : create surfaces that are layers of the desktop
|
||||
//
|
||||
// Clients can use this interface to assign the surface_layer role to
|
||||
// wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
||||
// rendered with a defined z-depth respective to each other. They may also be
|
||||
// anchored to the edges and corners of a screen and specify input handling
|
||||
// semantics. This interface should be suitable for the implementation of
|
||||
// many desktop shell components, and a broad number of other applications
|
||||
// that interact with the desktop.
|
||||
func NewZwlrLayerShellV1(ctx *client.Context) *ZwlrLayerShellV1 {
|
||||
zwlrLayerShellV1 := &ZwlrLayerShellV1{}
|
||||
ctx.Register(zwlrLayerShellV1)
|
||||
return zwlrLayerShellV1
|
||||
}
|
||||
|
||||
// GetLayerSurface : create a layer_surface from a surface
|
||||
//
|
||||
// Create a layer surface for an existing surface. This assigns the role of
|
||||
// layer_surface, or raises a protocol error if another role is already
|
||||
// assigned.
|
||||
//
|
||||
// Creating a layer surface from a wl_surface 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 layer_surface.configure call
|
||||
// must also be treated as errors.
|
||||
//
|
||||
// After creating a layer_surface object and setting it up, the client
|
||||
// must perform an initial commit without any buffer attached.
|
||||
// The compositor will reply with a layer_surface.configure event.
|
||||
// The client must acknowledge it and is then allowed to attach a buffer
|
||||
// to map the surface.
|
||||
//
|
||||
// You may pass NULL for output to allow the compositor to decide which
|
||||
// output to use. Generally this will be the one that the user most
|
||||
// recently interacted with.
|
||||
//
|
||||
// Clients can specify a namespace that defines the purpose of the layer
|
||||
// surface.
|
||||
//
|
||||
// layer: layer to add this surface to
|
||||
// namespace: namespace for the layer surface
|
||||
func (i *ZwlrLayerShellV1) GetLayerSurface(surface *client.Surface, output *client.Output, layer uint32, namespace string) (*ZwlrLayerSurfaceV1, error) {
|
||||
id := NewZwlrLayerSurfaceV1(i.Context())
|
||||
const opcode = 0
|
||||
namespaceLen := client.PaddedLen(len(namespace) + 1)
|
||||
_reqBufLen := 8 + 4 + 4 + 4 + 4 + (4 + namespaceLen)
|
||||
_reqBuf := make([]byte, _reqBufLen)
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], id.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], surface.ID())
|
||||
l += 4
|
||||
if output == nil {
|
||||
client.PutUint32(_reqBuf[l:l+4], 0)
|
||||
l += 4
|
||||
} else {
|
||||
client.PutUint32(_reqBuf[l:l+4], output.ID())
|
||||
l += 4
|
||||
}
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(layer))
|
||||
l += 4
|
||||
client.PutString(_reqBuf[l:l+(4+namespaceLen)], namespace)
|
||||
l += (4 + namespaceLen)
|
||||
err := i.Context().WriteMsg(_reqBuf, nil)
|
||||
return id, err
|
||||
}
|
||||
|
||||
// Destroy : destroy the layer_shell object
|
||||
//
|
||||
// This request indicates that the client will not use the layer_shell
|
||||
// object any more. Objects that have been created through this instance
|
||||
// are not affected.
|
||||
func (i *ZwlrLayerShellV1) Destroy() error {
|
||||
defer i.Context().Unregister(i)
|
||||
const opcode = 1
|
||||
const _reqBufLen = 8
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return err
|
||||
}
|
||||
|
||||
type ZwlrLayerShellV1Error uint32
|
||||
|
||||
// ZwlrLayerShellV1Error :
|
||||
const (
|
||||
// ZwlrLayerShellV1ErrorRole : wl_surface has another role
|
||||
ZwlrLayerShellV1ErrorRole ZwlrLayerShellV1Error = 0
|
||||
// ZwlrLayerShellV1ErrorInvalidLayer : layer value is invalid
|
||||
ZwlrLayerShellV1ErrorInvalidLayer ZwlrLayerShellV1Error = 1
|
||||
// ZwlrLayerShellV1ErrorAlreadyConstructed : wl_surface has a buffer attached or committed
|
||||
ZwlrLayerShellV1ErrorAlreadyConstructed ZwlrLayerShellV1Error = 2
|
||||
)
|
||||
|
||||
func (e ZwlrLayerShellV1Error) Name() string {
|
||||
switch e {
|
||||
case ZwlrLayerShellV1ErrorRole:
|
||||
return "role"
|
||||
case ZwlrLayerShellV1ErrorInvalidLayer:
|
||||
return "invalid_layer"
|
||||
case ZwlrLayerShellV1ErrorAlreadyConstructed:
|
||||
return "already_constructed"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (e ZwlrLayerShellV1Error) Value() string {
|
||||
switch e {
|
||||
case ZwlrLayerShellV1ErrorRole:
|
||||
return "0"
|
||||
case ZwlrLayerShellV1ErrorInvalidLayer:
|
||||
return "1"
|
||||
case ZwlrLayerShellV1ErrorAlreadyConstructed:
|
||||
return "2"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (e ZwlrLayerShellV1Error) String() string {
|
||||
return e.Name() + "=" + e.Value()
|
||||
}
|
||||
|
||||
type ZwlrLayerShellV1Layer uint32
|
||||
|
||||
// ZwlrLayerShellV1Layer : available layers for surfaces
|
||||
//
|
||||
// These values indicate which layers a surface can be rendered in. They
|
||||
// are ordered by z depth, bottom-most first. Traditional shell surfaces
|
||||
// will typically be rendered between the bottom and top layers.
|
||||
// Fullscreen shell surfaces are typically rendered at the top layer.
|
||||
// Multiple surfaces can share a single layer, and ordering within a
|
||||
// single layer is undefined.
|
||||
const (
|
||||
ZwlrLayerShellV1LayerBackground ZwlrLayerShellV1Layer = 0
|
||||
ZwlrLayerShellV1LayerBottom ZwlrLayerShellV1Layer = 1
|
||||
ZwlrLayerShellV1LayerTop ZwlrLayerShellV1Layer = 2
|
||||
ZwlrLayerShellV1LayerOverlay ZwlrLayerShellV1Layer = 3
|
||||
)
|
||||
|
||||
func (e ZwlrLayerShellV1Layer) Name() string {
|
||||
switch e {
|
||||
case ZwlrLayerShellV1LayerBackground:
|
||||
return "background"
|
||||
case ZwlrLayerShellV1LayerBottom:
|
||||
return "bottom"
|
||||
case ZwlrLayerShellV1LayerTop:
|
||||
return "top"
|
||||
case ZwlrLayerShellV1LayerOverlay:
|
||||
return "overlay"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (e ZwlrLayerShellV1Layer) Value() string {
|
||||
switch e {
|
||||
case ZwlrLayerShellV1LayerBackground:
|
||||
return "0"
|
||||
case ZwlrLayerShellV1LayerBottom:
|
||||
return "1"
|
||||
case ZwlrLayerShellV1LayerTop:
|
||||
return "2"
|
||||
case ZwlrLayerShellV1LayerOverlay:
|
||||
return "3"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (e ZwlrLayerShellV1Layer) String() string {
|
||||
return e.Name() + "=" + e.Value()
|
||||
}
|
||||
|
||||
// ZwlrLayerSurfaceV1InterfaceName is the name of the interface as it appears in the [client.Registry].
|
||||
// It can be used to match the [client.RegistryGlobalEvent.Interface] in the
|
||||
// [Registry.SetGlobalHandler] and can be used in [Registry.Bind] if this applies.
|
||||
const ZwlrLayerSurfaceV1InterfaceName = "zwlr_layer_surface_v1"
|
||||
|
||||
// ZwlrLayerSurfaceV1 : layer metadata interface
|
||||
//
|
||||
// An interface that may be implemented by a wl_surface, for surfaces that
|
||||
// are designed to be rendered as a layer of a stacked desktop-like
|
||||
// environment.
|
||||
//
|
||||
// Layer surface state (layer, size, anchor, exclusive zone,
|
||||
// margin, interactivity) is double-buffered, and will be applied at the
|
||||
// time wl_surface.commit of the corresponding wl_surface is called.
|
||||
//
|
||||
// Attaching a null buffer to a layer surface unmaps it.
|
||||
//
|
||||
// Unmapping a layer_surface means that the surface cannot be shown by the
|
||||
// compositor until it is explicitly mapped again. The layer_surface
|
||||
// returns to the state it had right after layer_shell.get_layer_surface.
|
||||
// The client can re-map the surface by performing a commit without any
|
||||
// buffer attached, waiting for a configure event and handling it as usual.
|
||||
type ZwlrLayerSurfaceV1 struct {
|
||||
client.BaseProxy
|
||||
configureHandler ZwlrLayerSurfaceV1ConfigureHandlerFunc
|
||||
closedHandler ZwlrLayerSurfaceV1ClosedHandlerFunc
|
||||
}
|
||||
|
||||
// NewZwlrLayerSurfaceV1 : layer metadata interface
|
||||
//
|
||||
// An interface that may be implemented by a wl_surface, for surfaces that
|
||||
// are designed to be rendered as a layer of a stacked desktop-like
|
||||
// environment.
|
||||
//
|
||||
// Layer surface state (layer, size, anchor, exclusive zone,
|
||||
// margin, interactivity) is double-buffered, and will be applied at the
|
||||
// time wl_surface.commit of the corresponding wl_surface is called.
|
||||
//
|
||||
// Attaching a null buffer to a layer surface unmaps it.
|
||||
//
|
||||
// Unmapping a layer_surface means that the surface cannot be shown by the
|
||||
// compositor until it is explicitly mapped again. The layer_surface
|
||||
// returns to the state it had right after layer_shell.get_layer_surface.
|
||||
// The client can re-map the surface by performing a commit without any
|
||||
// buffer attached, waiting for a configure event and handling it as usual.
|
||||
func NewZwlrLayerSurfaceV1(ctx *client.Context) *ZwlrLayerSurfaceV1 {
|
||||
zwlrLayerSurfaceV1 := &ZwlrLayerSurfaceV1{}
|
||||
ctx.Register(zwlrLayerSurfaceV1)
|
||||
return zwlrLayerSurfaceV1
|
||||
}
|
||||
|
||||
// SetSize : sets the size of the surface
|
||||
//
|
||||
// Sets the size of the surface in surface-local coordinates. The
|
||||
// compositor will display the surface centered with respect to its
|
||||
// anchors.
|
||||
//
|
||||
// If you pass 0 for either value, the compositor will assign it and
|
||||
// inform you of the assignment in the configure event. You must set your
|
||||
// anchor to opposite edges in the dimensions you omit; not doing so is a
|
||||
// protocol error. Both values are 0 by default.
|
||||
//
|
||||
// Size is double-buffered, see wl_surface.commit.
|
||||
func (i *ZwlrLayerSurfaceV1) SetSize(width, height uint32) error {
|
||||
const opcode = 0
|
||||
const _reqBufLen = 8 + 4 + 4
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(width))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(height))
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return err
|
||||
}
|
||||
|
||||
// SetAnchor : configures the anchor point of the surface
|
||||
//
|
||||
// Requests that the compositor anchor the surface to the specified edges
|
||||
// and corners. If two orthogonal edges are specified (e.g. 'top' and
|
||||
// 'left'), then the anchor point will be the intersection of the edges
|
||||
// (e.g. the top left corner of the output); otherwise the anchor point
|
||||
// will be centered on that edge, or in the center if none is specified.
|
||||
//
|
||||
// Anchor is double-buffered, see wl_surface.commit.
|
||||
func (i *ZwlrLayerSurfaceV1) SetAnchor(anchor uint32) error {
|
||||
const opcode = 1
|
||||
const _reqBufLen = 8 + 4
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(anchor))
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return err
|
||||
}
|
||||
|
||||
// SetExclusiveZone : configures the exclusive geometry of this surface
|
||||
//
|
||||
// Requests that the compositor avoids occluding an area with other
|
||||
// surfaces. The compositor's use of this information is
|
||||
// implementation-dependent - do not assume that this region will not
|
||||
// actually be occluded.
|
||||
//
|
||||
// A positive value is only meaningful if the surface is anchored to one
|
||||
// edge or an edge and both perpendicular edges. If the surface is not
|
||||
// anchored, anchored to only two perpendicular edges (a corner), anchored
|
||||
// to only two parallel edges or anchored to all edges, a positive value
|
||||
// will be treated the same as zero.
|
||||
//
|
||||
// A positive zone is the distance from the edge in surface-local
|
||||
// coordinates to consider exclusive.
|
||||
//
|
||||
// Surfaces that do not wish to have an exclusive zone may instead specify
|
||||
// how they should interact with surfaces that do. If set to zero, the
|
||||
// surface indicates that it would like to be moved to avoid occluding
|
||||
// surfaces with a positive exclusive zone. If set to -1, the surface
|
||||
// indicates that it would not like to be moved to accommodate for other
|
||||
// surfaces, and the compositor should extend it all the way to the edges
|
||||
// it is anchored to.
|
||||
//
|
||||
// For example, a panel might set its exclusive zone to 10, so that
|
||||
// maximized shell surfaces are not shown on top of it. A notification
|
||||
// might set its exclusive zone to 0, so that it is moved to avoid
|
||||
// occluding the panel, but shell surfaces are shown underneath it. A
|
||||
// wallpaper or lock screen might set their exclusive zone to -1, so that
|
||||
// they stretch below or over the panel.
|
||||
//
|
||||
// The default value is 0.
|
||||
//
|
||||
// Exclusive zone is double-buffered, see wl_surface.commit.
|
||||
func (i *ZwlrLayerSurfaceV1) SetExclusiveZone(zone int32) error {
|
||||
const opcode = 2
|
||||
const _reqBufLen = 8 + 4
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(zone))
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return err
|
||||
}
|
||||
|
||||
// SetMargin : sets a margin from the anchor point
|
||||
//
|
||||
// Requests that the surface be placed some distance away from the anchor
|
||||
// point on the output, in surface-local coordinates. Setting this value
|
||||
// for edges you are not anchored to has no effect.
|
||||
//
|
||||
// The exclusive zone includes the margin.
|
||||
//
|
||||
// Margin is double-buffered, see wl_surface.commit.
|
||||
func (i *ZwlrLayerSurfaceV1) SetMargin(top, right, bottom, left int32) error {
|
||||
const opcode = 3
|
||||
const _reqBufLen = 8 + 4 + 4 + 4 + 4
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(top))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(right))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(bottom))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(left))
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return err
|
||||
}
|
||||
|
||||
// SetKeyboardInteractivity : requests keyboard events
|
||||
//
|
||||
// Set how keyboard events are delivered to this surface. By default,
|
||||
// layer shell surfaces do not receive keyboard events; this request can
|
||||
// be used to change this.
|
||||
//
|
||||
// This setting is inherited by child surfaces set by the get_popup
|
||||
// request.
|
||||
//
|
||||
// Layer surfaces receive pointer, touch, and tablet events normally. If
|
||||
// you do not want to receive them, set the input region on your surface
|
||||
// to an empty region.
|
||||
//
|
||||
// Keyboard interactivity is double-buffered, see wl_surface.commit.
|
||||
func (i *ZwlrLayerSurfaceV1) SetKeyboardInteractivity(keyboardInteractivity uint32) error {
|
||||
const opcode = 4
|
||||
const _reqBufLen = 8 + 4
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(keyboardInteractivity))
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return err
|
||||
}
|
||||
|
||||
// GetPopup : assign this layer_surface as an xdg_popup parent
|
||||
//
|
||||
// This assigns an xdg_popup's parent to this layer_surface. This popup
|
||||
// should have been created via xdg_surface::get_popup with the parent set
|
||||
// to NULL, and this request must be invoked before committing the popup's
|
||||
// initial state.
|
||||
//
|
||||
// See the documentation of xdg_popup for more details about what an
|
||||
// xdg_popup is and how it is used.
|
||||
func (i *ZwlrLayerSurfaceV1) GetPopup(popup *xdg_shell.Popup) error {
|
||||
const opcode = 5
|
||||
const _reqBufLen = 8 + 4
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], popup.ID())
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return err
|
||||
}
|
||||
|
||||
// AckConfigure : ack a configure event
|
||||
//
|
||||
// When a configure event is received, if a client commits the
|
||||
// surface in response to the configure event, then the client
|
||||
// must make an ack_configure request sometime before the commit
|
||||
// request, passing along the serial of the configure event.
|
||||
//
|
||||
// If the client receives multiple configure events before it
|
||||
// can respond to one, it only has to ack the last configure event.
|
||||
//
|
||||
// A client is not required to commit immediately after sending
|
||||
// an ack_configure request - it may even ack_configure several times
|
||||
// before its next surface commit.
|
||||
//
|
||||
// A client may send multiple ack_configure requests before committing, but
|
||||
// only the last request sent before a commit indicates which configure
|
||||
// event the client really is responding to.
|
||||
//
|
||||
// serial: the serial from the configure event
|
||||
func (i *ZwlrLayerSurfaceV1) AckConfigure(serial uint32) error {
|
||||
const opcode = 6
|
||||
const _reqBufLen = 8 + 4
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(serial))
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return err
|
||||
}
|
||||
|
||||
// Destroy : destroy the layer_surface
|
||||
//
|
||||
// This request destroys the layer surface.
|
||||
func (i *ZwlrLayerSurfaceV1) Destroy() error {
|
||||
defer i.Context().Unregister(i)
|
||||
const opcode = 7
|
||||
const _reqBufLen = 8
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return err
|
||||
}
|
||||
|
||||
// SetLayer : change the layer of the surface
|
||||
//
|
||||
// Change the layer that the surface is rendered on.
|
||||
//
|
||||
// Layer is double-buffered, see wl_surface.commit.
|
||||
//
|
||||
// layer: layer to move this surface to
|
||||
func (i *ZwlrLayerSurfaceV1) SetLayer(layer uint32) error {
|
||||
const opcode = 8
|
||||
const _reqBufLen = 8 + 4
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(layer))
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return err
|
||||
}
|
||||
|
||||
// SetExclusiveEdge : set the edge the exclusive zone will be applied to
|
||||
//
|
||||
// Requests an edge for the exclusive zone to apply. The exclusive
|
||||
// edge will be automatically deduced from anchor points when possible,
|
||||
// but when the surface is anchored to a corner, it will be necessary
|
||||
// to set it explicitly to disambiguate, as it is not possible to deduce
|
||||
// which one of the two corner edges should be used.
|
||||
//
|
||||
// The edge must be one the surface is anchored to, otherwise the
|
||||
// invalid_exclusive_edge protocol error will be raised.
|
||||
func (i *ZwlrLayerSurfaceV1) SetExclusiveEdge(edge uint32) error {
|
||||
const opcode = 9
|
||||
const _reqBufLen = 8 + 4
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(edge))
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return err
|
||||
}
|
||||
|
||||
type ZwlrLayerSurfaceV1KeyboardInteractivity uint32
|
||||
|
||||
// ZwlrLayerSurfaceV1KeyboardInteractivity : types of keyboard interaction possible for a layer shell surface
|
||||
//
|
||||
// Types of keyboard interaction possible for layer shell surfaces. The
|
||||
// rationale for this is twofold: (1) some applications are not interested
|
||||
// in keyboard events and not allowing them to be focused can improve the
|
||||
// desktop experience; (2) some applications will want to take exclusive
|
||||
// keyboard focus.
|
||||
const (
|
||||
ZwlrLayerSurfaceV1KeyboardInteractivityNone ZwlrLayerSurfaceV1KeyboardInteractivity = 0
|
||||
ZwlrLayerSurfaceV1KeyboardInteractivityExclusive ZwlrLayerSurfaceV1KeyboardInteractivity = 1
|
||||
ZwlrLayerSurfaceV1KeyboardInteractivityOnDemand ZwlrLayerSurfaceV1KeyboardInteractivity = 2
|
||||
)
|
||||
|
||||
func (e ZwlrLayerSurfaceV1KeyboardInteractivity) Name() string {
|
||||
switch e {
|
||||
case ZwlrLayerSurfaceV1KeyboardInteractivityNone:
|
||||
return "none"
|
||||
case ZwlrLayerSurfaceV1KeyboardInteractivityExclusive:
|
||||
return "exclusive"
|
||||
case ZwlrLayerSurfaceV1KeyboardInteractivityOnDemand:
|
||||
return "on_demand"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (e ZwlrLayerSurfaceV1KeyboardInteractivity) Value() string {
|
||||
switch e {
|
||||
case ZwlrLayerSurfaceV1KeyboardInteractivityNone:
|
||||
return "0"
|
||||
case ZwlrLayerSurfaceV1KeyboardInteractivityExclusive:
|
||||
return "1"
|
||||
case ZwlrLayerSurfaceV1KeyboardInteractivityOnDemand:
|
||||
return "2"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (e ZwlrLayerSurfaceV1KeyboardInteractivity) String() string {
|
||||
return e.Name() + "=" + e.Value()
|
||||
}
|
||||
|
||||
type ZwlrLayerSurfaceV1Error uint32
|
||||
|
||||
// ZwlrLayerSurfaceV1Error :
|
||||
const (
|
||||
// ZwlrLayerSurfaceV1ErrorInvalidSurfaceState : provided surface state is invalid
|
||||
ZwlrLayerSurfaceV1ErrorInvalidSurfaceState ZwlrLayerSurfaceV1Error = 0
|
||||
// ZwlrLayerSurfaceV1ErrorInvalidSize : size is invalid
|
||||
ZwlrLayerSurfaceV1ErrorInvalidSize ZwlrLayerSurfaceV1Error = 1
|
||||
// ZwlrLayerSurfaceV1ErrorInvalidAnchor : anchor bitfield is invalid
|
||||
ZwlrLayerSurfaceV1ErrorInvalidAnchor ZwlrLayerSurfaceV1Error = 2
|
||||
// ZwlrLayerSurfaceV1ErrorInvalidKeyboardInteractivity : keyboard interactivity is invalid
|
||||
ZwlrLayerSurfaceV1ErrorInvalidKeyboardInteractivity ZwlrLayerSurfaceV1Error = 3
|
||||
// ZwlrLayerSurfaceV1ErrorInvalidExclusiveEdge : exclusive edge is invalid given the surface anchors
|
||||
ZwlrLayerSurfaceV1ErrorInvalidExclusiveEdge ZwlrLayerSurfaceV1Error = 4
|
||||
)
|
||||
|
||||
func (e ZwlrLayerSurfaceV1Error) Name() string {
|
||||
switch e {
|
||||
case ZwlrLayerSurfaceV1ErrorInvalidSurfaceState:
|
||||
return "invalid_surface_state"
|
||||
case ZwlrLayerSurfaceV1ErrorInvalidSize:
|
||||
return "invalid_size"
|
||||
case ZwlrLayerSurfaceV1ErrorInvalidAnchor:
|
||||
return "invalid_anchor"
|
||||
case ZwlrLayerSurfaceV1ErrorInvalidKeyboardInteractivity:
|
||||
return "invalid_keyboard_interactivity"
|
||||
case ZwlrLayerSurfaceV1ErrorInvalidExclusiveEdge:
|
||||
return "invalid_exclusive_edge"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (e ZwlrLayerSurfaceV1Error) Value() string {
|
||||
switch e {
|
||||
case ZwlrLayerSurfaceV1ErrorInvalidSurfaceState:
|
||||
return "0"
|
||||
case ZwlrLayerSurfaceV1ErrorInvalidSize:
|
||||
return "1"
|
||||
case ZwlrLayerSurfaceV1ErrorInvalidAnchor:
|
||||
return "2"
|
||||
case ZwlrLayerSurfaceV1ErrorInvalidKeyboardInteractivity:
|
||||
return "3"
|
||||
case ZwlrLayerSurfaceV1ErrorInvalidExclusiveEdge:
|
||||
return "4"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (e ZwlrLayerSurfaceV1Error) String() string {
|
||||
return e.Name() + "=" + e.Value()
|
||||
}
|
||||
|
||||
type ZwlrLayerSurfaceV1Anchor uint32
|
||||
|
||||
// ZwlrLayerSurfaceV1Anchor :
|
||||
const (
|
||||
// ZwlrLayerSurfaceV1AnchorTop : the top edge of the anchor rectangle
|
||||
ZwlrLayerSurfaceV1AnchorTop ZwlrLayerSurfaceV1Anchor = 1
|
||||
// ZwlrLayerSurfaceV1AnchorBottom : the bottom edge of the anchor rectangle
|
||||
ZwlrLayerSurfaceV1AnchorBottom ZwlrLayerSurfaceV1Anchor = 2
|
||||
// ZwlrLayerSurfaceV1AnchorLeft : the left edge of the anchor rectangle
|
||||
ZwlrLayerSurfaceV1AnchorLeft ZwlrLayerSurfaceV1Anchor = 4
|
||||
// ZwlrLayerSurfaceV1AnchorRight : the right edge of the anchor rectangle
|
||||
ZwlrLayerSurfaceV1AnchorRight ZwlrLayerSurfaceV1Anchor = 8
|
||||
)
|
||||
|
||||
func (e ZwlrLayerSurfaceV1Anchor) Name() string {
|
||||
switch e {
|
||||
case ZwlrLayerSurfaceV1AnchorTop:
|
||||
return "top"
|
||||
case ZwlrLayerSurfaceV1AnchorBottom:
|
||||
return "bottom"
|
||||
case ZwlrLayerSurfaceV1AnchorLeft:
|
||||
return "left"
|
||||
case ZwlrLayerSurfaceV1AnchorRight:
|
||||
return "right"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (e ZwlrLayerSurfaceV1Anchor) Value() string {
|
||||
switch e {
|
||||
case ZwlrLayerSurfaceV1AnchorTop:
|
||||
return "1"
|
||||
case ZwlrLayerSurfaceV1AnchorBottom:
|
||||
return "2"
|
||||
case ZwlrLayerSurfaceV1AnchorLeft:
|
||||
return "4"
|
||||
case ZwlrLayerSurfaceV1AnchorRight:
|
||||
return "8"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (e ZwlrLayerSurfaceV1Anchor) String() string {
|
||||
return e.Name() + "=" + e.Value()
|
||||
}
|
||||
|
||||
// ZwlrLayerSurfaceV1ConfigureEvent : suggest a surface change
|
||||
//
|
||||
// The configure event asks the client to resize its surface.
|
||||
//
|
||||
// Clients should arrange their surface for the new states, and then send
|
||||
// an ack_configure request with the serial sent in this configure event at
|
||||
// some point before committing the new surface.
|
||||
//
|
||||
// The client is free to dismiss all but the last configure event it
|
||||
// received.
|
||||
//
|
||||
// The width and height arguments specify the size of the window in
|
||||
// surface-local coordinates.
|
||||
//
|
||||
// The size is a hint, in the sense that the client is free to ignore it if
|
||||
// it doesn't resize, pick a smaller size (to satisfy aspect ratio or
|
||||
// resize in steps of NxM pixels). If the client picks a smaller size and
|
||||
// is anchored to two opposite anchors (e.g. 'top' and 'bottom'), the
|
||||
// surface will be centered on this axis.
|
||||
//
|
||||
// If the width or height arguments are zero, it means the client should
|
||||
// decide its own window dimension.
|
||||
type ZwlrLayerSurfaceV1ConfigureEvent struct {
|
||||
Serial uint32
|
||||
Width uint32
|
||||
Height uint32
|
||||
}
|
||||
type ZwlrLayerSurfaceV1ConfigureHandlerFunc func(ZwlrLayerSurfaceV1ConfigureEvent)
|
||||
|
||||
// SetConfigureHandler : sets handler for ZwlrLayerSurfaceV1ConfigureEvent
|
||||
func (i *ZwlrLayerSurfaceV1) SetConfigureHandler(f ZwlrLayerSurfaceV1ConfigureHandlerFunc) {
|
||||
i.configureHandler = f
|
||||
}
|
||||
|
||||
// ZwlrLayerSurfaceV1ClosedEvent : surface should be closed
|
||||
//
|
||||
// The closed event is sent by the compositor when the surface will no
|
||||
// longer be shown. The output may have been destroyed or the user may
|
||||
// have asked for it to be removed. Further changes to the surface will be
|
||||
// ignored. The client should destroy the resource after receiving this
|
||||
// event, and create a new surface if they so choose.
|
||||
type ZwlrLayerSurfaceV1ClosedEvent struct{}
|
||||
type ZwlrLayerSurfaceV1ClosedHandlerFunc func(ZwlrLayerSurfaceV1ClosedEvent)
|
||||
|
||||
// SetClosedHandler : sets handler for ZwlrLayerSurfaceV1ClosedEvent
|
||||
func (i *ZwlrLayerSurfaceV1) SetClosedHandler(f ZwlrLayerSurfaceV1ClosedHandlerFunc) {
|
||||
i.closedHandler = f
|
||||
}
|
||||
|
||||
func (i *ZwlrLayerSurfaceV1) Dispatch(opcode uint32, fd int, data []byte) {
|
||||
switch opcode {
|
||||
case 0:
|
||||
if i.configureHandler == nil {
|
||||
return
|
||||
}
|
||||
var e ZwlrLayerSurfaceV1ConfigureEvent
|
||||
l := 0
|
||||
e.Serial = client.Uint32(data[l : l+4])
|
||||
l += 4
|
||||
e.Width = client.Uint32(data[l : l+4])
|
||||
l += 4
|
||||
e.Height = client.Uint32(data[l : l+4])
|
||||
l += 4
|
||||
|
||||
i.configureHandler(e)
|
||||
case 1:
|
||||
if i.closedHandler == nil {
|
||||
return
|
||||
}
|
||||
var e ZwlrLayerSurfaceV1ClosedEvent
|
||||
|
||||
i.closedHandler(e)
|
||||
}
|
||||
}
|
||||
532
core/internal/proto/wlr_screencopy/screencopy.go
Normal file
532
core/internal/proto/wlr_screencopy/screencopy.go
Normal file
@@ -0,0 +1,532 @@
|
||||
// Generated by go-wayland-scanner
|
||||
// https://github.com/yaslama/go-wayland/cmd/go-wayland-scanner
|
||||
// XML file : internal/proto/xml/wlr-screencopy-unstable-v1.xml
|
||||
//
|
||||
// wlr_screencopy_unstable_v1 Protocol Copyright:
|
||||
//
|
||||
// Copyright © 2018 Simon Ser
|
||||
// Copyright © 2019 Andri Yngvason
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice (including the next
|
||||
// paragraph) shall be included in all copies or substantial portions of the
|
||||
// Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
package wlr_screencopy
|
||||
|
||||
import "github.com/AvengeMedia/DankMaterialShell/core/pkg/go-wayland/wayland/client"
|
||||
|
||||
// ZwlrScreencopyManagerV1InterfaceName is the name of the interface as it appears in the [client.Registry].
|
||||
// It can be used to match the [client.RegistryGlobalEvent.Interface] in the
|
||||
// [Registry.SetGlobalHandler] and can be used in [Registry.Bind] if this applies.
|
||||
const ZwlrScreencopyManagerV1InterfaceName = "zwlr_screencopy_manager_v1"
|
||||
|
||||
// ZwlrScreencopyManagerV1 : manager to inform clients and begin capturing
|
||||
//
|
||||
// This object is a manager which offers requests to start capturing from a
|
||||
// source.
|
||||
type ZwlrScreencopyManagerV1 struct {
|
||||
client.BaseProxy
|
||||
}
|
||||
|
||||
// NewZwlrScreencopyManagerV1 : manager to inform clients and begin capturing
|
||||
//
|
||||
// This object is a manager which offers requests to start capturing from a
|
||||
// source.
|
||||
func NewZwlrScreencopyManagerV1(ctx *client.Context) *ZwlrScreencopyManagerV1 {
|
||||
zwlrScreencopyManagerV1 := &ZwlrScreencopyManagerV1{}
|
||||
ctx.Register(zwlrScreencopyManagerV1)
|
||||
return zwlrScreencopyManagerV1
|
||||
}
|
||||
|
||||
// CaptureOutput : capture an output
|
||||
//
|
||||
// Capture the next frame of an entire output.
|
||||
//
|
||||
// overlayCursor: composite cursor onto the frame
|
||||
func (i *ZwlrScreencopyManagerV1) CaptureOutput(overlayCursor int32, output *client.Output) (*ZwlrScreencopyFrameV1, error) {
|
||||
frame := NewZwlrScreencopyFrameV1(i.Context())
|
||||
const opcode = 0
|
||||
const _reqBufLen = 8 + 4 + 4 + 4
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], frame.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(overlayCursor))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], output.ID())
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return frame, err
|
||||
}
|
||||
|
||||
// CaptureOutputRegion : capture an output's region
|
||||
//
|
||||
// Capture the next frame of an output's region.
|
||||
//
|
||||
// The region is given in output logical coordinates, see
|
||||
// xdg_output.logical_size. The region will be clipped to the output's
|
||||
// extents.
|
||||
//
|
||||
// overlayCursor: composite cursor onto the frame
|
||||
func (i *ZwlrScreencopyManagerV1) CaptureOutputRegion(overlayCursor int32, output *client.Output, x, y, width, height int32) (*ZwlrScreencopyFrameV1, error) {
|
||||
frame := NewZwlrScreencopyFrameV1(i.Context())
|
||||
const opcode = 1
|
||||
const _reqBufLen = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], frame.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(overlayCursor))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], output.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(x))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(y))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(width))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(height))
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return frame, err
|
||||
}
|
||||
|
||||
// Destroy : destroy the manager
|
||||
//
|
||||
// All objects created by the manager will still remain valid, until their
|
||||
// appropriate destroy request has been called.
|
||||
func (i *ZwlrScreencopyManagerV1) Destroy() error {
|
||||
defer i.Context().Unregister(i)
|
||||
const opcode = 2
|
||||
const _reqBufLen = 8
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return err
|
||||
}
|
||||
|
||||
// ZwlrScreencopyFrameV1InterfaceName is the name of the interface as it appears in the [client.Registry].
|
||||
// It can be used to match the [client.RegistryGlobalEvent.Interface] in the
|
||||
// [Registry.SetGlobalHandler] and can be used in [Registry.Bind] if this applies.
|
||||
const ZwlrScreencopyFrameV1InterfaceName = "zwlr_screencopy_frame_v1"
|
||||
|
||||
// ZwlrScreencopyFrameV1 : a frame ready for copy
|
||||
//
|
||||
// This object represents a single frame.
|
||||
//
|
||||
// When created, a series of buffer events will be sent, each representing a
|
||||
// supported buffer type. The "buffer_done" event is sent afterwards to
|
||||
// indicate that all supported buffer types have been enumerated. The client
|
||||
// will then be able to send a "copy" request. If the capture is successful,
|
||||
// the compositor will send a "flags" event followed by a "ready" event.
|
||||
//
|
||||
// For objects version 2 or lower, wl_shm buffers are always supported, ie.
|
||||
// the "buffer" event is guaranteed to be sent.
|
||||
//
|
||||
// If the capture failed, the "failed" event is sent. This can happen anytime
|
||||
// before the "ready" event.
|
||||
//
|
||||
// Once either a "ready" or a "failed" event is received, the client should
|
||||
// destroy the frame.
|
||||
type ZwlrScreencopyFrameV1 struct {
|
||||
client.BaseProxy
|
||||
bufferHandler ZwlrScreencopyFrameV1BufferHandlerFunc
|
||||
flagsHandler ZwlrScreencopyFrameV1FlagsHandlerFunc
|
||||
readyHandler ZwlrScreencopyFrameV1ReadyHandlerFunc
|
||||
failedHandler ZwlrScreencopyFrameV1FailedHandlerFunc
|
||||
damageHandler ZwlrScreencopyFrameV1DamageHandlerFunc
|
||||
linuxDmabufHandler ZwlrScreencopyFrameV1LinuxDmabufHandlerFunc
|
||||
bufferDoneHandler ZwlrScreencopyFrameV1BufferDoneHandlerFunc
|
||||
}
|
||||
|
||||
// NewZwlrScreencopyFrameV1 : a frame ready for copy
|
||||
//
|
||||
// This object represents a single frame.
|
||||
//
|
||||
// When created, a series of buffer events will be sent, each representing a
|
||||
// supported buffer type. The "buffer_done" event is sent afterwards to
|
||||
// indicate that all supported buffer types have been enumerated. The client
|
||||
// will then be able to send a "copy" request. If the capture is successful,
|
||||
// the compositor will send a "flags" event followed by a "ready" event.
|
||||
//
|
||||
// For objects version 2 or lower, wl_shm buffers are always supported, ie.
|
||||
// the "buffer" event is guaranteed to be sent.
|
||||
//
|
||||
// If the capture failed, the "failed" event is sent. This can happen anytime
|
||||
// before the "ready" event.
|
||||
//
|
||||
// Once either a "ready" or a "failed" event is received, the client should
|
||||
// destroy the frame.
|
||||
func NewZwlrScreencopyFrameV1(ctx *client.Context) *ZwlrScreencopyFrameV1 {
|
||||
zwlrScreencopyFrameV1 := &ZwlrScreencopyFrameV1{}
|
||||
ctx.Register(zwlrScreencopyFrameV1)
|
||||
return zwlrScreencopyFrameV1
|
||||
}
|
||||
|
||||
// Copy : copy the frame
|
||||
//
|
||||
// Copy the frame to the supplied buffer. The buffer must have the
|
||||
// correct size, see zwlr_screencopy_frame_v1.buffer and
|
||||
// zwlr_screencopy_frame_v1.linux_dmabuf. The buffer needs to have a
|
||||
// supported format.
|
||||
//
|
||||
// If the frame is successfully copied, "flags" and "ready" events are
|
||||
// sent. Otherwise, a "failed" event is sent.
|
||||
func (i *ZwlrScreencopyFrameV1) Copy(buffer *client.Buffer) error {
|
||||
const opcode = 0
|
||||
const _reqBufLen = 8 + 4
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], buffer.ID())
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return err
|
||||
}
|
||||
|
||||
// Destroy : delete this object, used or not
|
||||
//
|
||||
// Destroys the frame. This request can be sent at any time by the client.
|
||||
func (i *ZwlrScreencopyFrameV1) Destroy() error {
|
||||
defer i.Context().Unregister(i)
|
||||
const opcode = 1
|
||||
const _reqBufLen = 8
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return err
|
||||
}
|
||||
|
||||
// CopyWithDamage : copy the frame when it's damaged
|
||||
//
|
||||
// Same as copy, except it waits until there is damage to copy.
|
||||
func (i *ZwlrScreencopyFrameV1) CopyWithDamage(buffer *client.Buffer) error {
|
||||
const opcode = 2
|
||||
const _reqBufLen = 8 + 4
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], buffer.ID())
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return err
|
||||
}
|
||||
|
||||
type ZwlrScreencopyFrameV1Error uint32
|
||||
|
||||
// ZwlrScreencopyFrameV1Error :
|
||||
const (
|
||||
// ZwlrScreencopyFrameV1ErrorAlreadyUsed : the object has already been used to copy a wl_buffer
|
||||
ZwlrScreencopyFrameV1ErrorAlreadyUsed ZwlrScreencopyFrameV1Error = 0
|
||||
// ZwlrScreencopyFrameV1ErrorInvalidBuffer : buffer attributes are invalid
|
||||
ZwlrScreencopyFrameV1ErrorInvalidBuffer ZwlrScreencopyFrameV1Error = 1
|
||||
)
|
||||
|
||||
func (e ZwlrScreencopyFrameV1Error) Name() string {
|
||||
switch e {
|
||||
case ZwlrScreencopyFrameV1ErrorAlreadyUsed:
|
||||
return "already_used"
|
||||
case ZwlrScreencopyFrameV1ErrorInvalidBuffer:
|
||||
return "invalid_buffer"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (e ZwlrScreencopyFrameV1Error) Value() string {
|
||||
switch e {
|
||||
case ZwlrScreencopyFrameV1ErrorAlreadyUsed:
|
||||
return "0"
|
||||
case ZwlrScreencopyFrameV1ErrorInvalidBuffer:
|
||||
return "1"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (e ZwlrScreencopyFrameV1Error) String() string {
|
||||
return e.Name() + "=" + e.Value()
|
||||
}
|
||||
|
||||
type ZwlrScreencopyFrameV1Flags uint32
|
||||
|
||||
// ZwlrScreencopyFrameV1Flags :
|
||||
const (
|
||||
// ZwlrScreencopyFrameV1FlagsYInvert : contents are y-inverted
|
||||
ZwlrScreencopyFrameV1FlagsYInvert ZwlrScreencopyFrameV1Flags = 1
|
||||
)
|
||||
|
||||
func (e ZwlrScreencopyFrameV1Flags) Name() string {
|
||||
switch e {
|
||||
case ZwlrScreencopyFrameV1FlagsYInvert:
|
||||
return "y_invert"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (e ZwlrScreencopyFrameV1Flags) Value() string {
|
||||
switch e {
|
||||
case ZwlrScreencopyFrameV1FlagsYInvert:
|
||||
return "1"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (e ZwlrScreencopyFrameV1Flags) String() string {
|
||||
return e.Name() + "=" + e.Value()
|
||||
}
|
||||
|
||||
// ZwlrScreencopyFrameV1BufferEvent : wl_shm buffer information
|
||||
//
|
||||
// Provides information about wl_shm buffer parameters that need to be
|
||||
// used for this frame. This event is sent once after the frame is created
|
||||
// if wl_shm buffers are supported.
|
||||
type ZwlrScreencopyFrameV1BufferEvent struct {
|
||||
Format uint32
|
||||
Width uint32
|
||||
Height uint32
|
||||
Stride uint32
|
||||
}
|
||||
type ZwlrScreencopyFrameV1BufferHandlerFunc func(ZwlrScreencopyFrameV1BufferEvent)
|
||||
|
||||
// SetBufferHandler : sets handler for ZwlrScreencopyFrameV1BufferEvent
|
||||
func (i *ZwlrScreencopyFrameV1) SetBufferHandler(f ZwlrScreencopyFrameV1BufferHandlerFunc) {
|
||||
i.bufferHandler = f
|
||||
}
|
||||
|
||||
// ZwlrScreencopyFrameV1FlagsEvent : frame flags
|
||||
//
|
||||
// Provides flags about the frame. This event is sent once before the
|
||||
// "ready" event.
|
||||
type ZwlrScreencopyFrameV1FlagsEvent struct {
|
||||
Flags uint32
|
||||
}
|
||||
type ZwlrScreencopyFrameV1FlagsHandlerFunc func(ZwlrScreencopyFrameV1FlagsEvent)
|
||||
|
||||
// SetFlagsHandler : sets handler for ZwlrScreencopyFrameV1FlagsEvent
|
||||
func (i *ZwlrScreencopyFrameV1) SetFlagsHandler(f ZwlrScreencopyFrameV1FlagsHandlerFunc) {
|
||||
i.flagsHandler = f
|
||||
}
|
||||
|
||||
// ZwlrScreencopyFrameV1ReadyEvent : indicates frame is available for reading
|
||||
//
|
||||
// Called as soon as the frame is copied, indicating it is available
|
||||
// for reading. This event includes the time at which the presentation took place.
|
||||
//
|
||||
// The timestamp is expressed as tv_sec_hi, tv_sec_lo, tv_nsec triples,
|
||||
// each component being an unsigned 32-bit value. Whole seconds are in
|
||||
// tv_sec which is a 64-bit value combined from tv_sec_hi and tv_sec_lo,
|
||||
// and the additional fractional part in tv_nsec as nanoseconds. Hence,
|
||||
// for valid timestamps tv_nsec must be in [0, 999999999]. The seconds part
|
||||
// may have an arbitrary offset at start.
|
||||
//
|
||||
// After receiving this event, the client should destroy the object.
|
||||
type ZwlrScreencopyFrameV1ReadyEvent struct {
|
||||
TvSecHi uint32
|
||||
TvSecLo uint32
|
||||
TvNsec uint32
|
||||
}
|
||||
type ZwlrScreencopyFrameV1ReadyHandlerFunc func(ZwlrScreencopyFrameV1ReadyEvent)
|
||||
|
||||
// SetReadyHandler : sets handler for ZwlrScreencopyFrameV1ReadyEvent
|
||||
func (i *ZwlrScreencopyFrameV1) SetReadyHandler(f ZwlrScreencopyFrameV1ReadyHandlerFunc) {
|
||||
i.readyHandler = f
|
||||
}
|
||||
|
||||
// ZwlrScreencopyFrameV1FailedEvent : frame copy failed
|
||||
//
|
||||
// This event indicates that the attempted frame copy has failed.
|
||||
//
|
||||
// After receiving this event, the client should destroy the object.
|
||||
type ZwlrScreencopyFrameV1FailedEvent struct{}
|
||||
type ZwlrScreencopyFrameV1FailedHandlerFunc func(ZwlrScreencopyFrameV1FailedEvent)
|
||||
|
||||
// SetFailedHandler : sets handler for ZwlrScreencopyFrameV1FailedEvent
|
||||
func (i *ZwlrScreencopyFrameV1) SetFailedHandler(f ZwlrScreencopyFrameV1FailedHandlerFunc) {
|
||||
i.failedHandler = f
|
||||
}
|
||||
|
||||
// ZwlrScreencopyFrameV1DamageEvent : carries the coordinates of the damaged region
|
||||
//
|
||||
// This event is sent right before the ready event when copy_with_damage is
|
||||
// requested. It may be generated multiple times for each copy_with_damage
|
||||
// request.
|
||||
//
|
||||
// The arguments describe a box around an area that has changed since the
|
||||
// last copy request that was derived from the current screencopy manager
|
||||
// instance.
|
||||
//
|
||||
// The union of all regions received between the call to copy_with_damage
|
||||
// and a ready event is the total damage since the prior ready event.
|
||||
type ZwlrScreencopyFrameV1DamageEvent struct {
|
||||
X uint32
|
||||
Y uint32
|
||||
Width uint32
|
||||
Height uint32
|
||||
}
|
||||
type ZwlrScreencopyFrameV1DamageHandlerFunc func(ZwlrScreencopyFrameV1DamageEvent)
|
||||
|
||||
// SetDamageHandler : sets handler for ZwlrScreencopyFrameV1DamageEvent
|
||||
func (i *ZwlrScreencopyFrameV1) SetDamageHandler(f ZwlrScreencopyFrameV1DamageHandlerFunc) {
|
||||
i.damageHandler = f
|
||||
}
|
||||
|
||||
// ZwlrScreencopyFrameV1LinuxDmabufEvent : linux-dmabuf buffer information
|
||||
//
|
||||
// Provides information about linux-dmabuf buffer parameters that need to
|
||||
// be used for this frame. This event is sent once after the frame is
|
||||
// created if linux-dmabuf buffers are supported.
|
||||
type ZwlrScreencopyFrameV1LinuxDmabufEvent struct {
|
||||
Format uint32
|
||||
Width uint32
|
||||
Height uint32
|
||||
}
|
||||
type ZwlrScreencopyFrameV1LinuxDmabufHandlerFunc func(ZwlrScreencopyFrameV1LinuxDmabufEvent)
|
||||
|
||||
// SetLinuxDmabufHandler : sets handler for ZwlrScreencopyFrameV1LinuxDmabufEvent
|
||||
func (i *ZwlrScreencopyFrameV1) SetLinuxDmabufHandler(f ZwlrScreencopyFrameV1LinuxDmabufHandlerFunc) {
|
||||
i.linuxDmabufHandler = f
|
||||
}
|
||||
|
||||
// ZwlrScreencopyFrameV1BufferDoneEvent : all buffer types reported
|
||||
//
|
||||
// This event is sent once after all buffer events have been sent.
|
||||
//
|
||||
// The client should proceed to create a buffer of one of the supported
|
||||
// types, and send a "copy" request.
|
||||
type ZwlrScreencopyFrameV1BufferDoneEvent struct{}
|
||||
type ZwlrScreencopyFrameV1BufferDoneHandlerFunc func(ZwlrScreencopyFrameV1BufferDoneEvent)
|
||||
|
||||
// SetBufferDoneHandler : sets handler for ZwlrScreencopyFrameV1BufferDoneEvent
|
||||
func (i *ZwlrScreencopyFrameV1) SetBufferDoneHandler(f ZwlrScreencopyFrameV1BufferDoneHandlerFunc) {
|
||||
i.bufferDoneHandler = f
|
||||
}
|
||||
|
||||
func (i *ZwlrScreencopyFrameV1) Dispatch(opcode uint32, fd int, data []byte) {
|
||||
switch opcode {
|
||||
case 0:
|
||||
if i.bufferHandler == nil {
|
||||
return
|
||||
}
|
||||
var e ZwlrScreencopyFrameV1BufferEvent
|
||||
l := 0
|
||||
e.Format = client.Uint32(data[l : l+4])
|
||||
l += 4
|
||||
e.Width = client.Uint32(data[l : l+4])
|
||||
l += 4
|
||||
e.Height = client.Uint32(data[l : l+4])
|
||||
l += 4
|
||||
e.Stride = client.Uint32(data[l : l+4])
|
||||
l += 4
|
||||
|
||||
i.bufferHandler(e)
|
||||
case 1:
|
||||
if i.flagsHandler == nil {
|
||||
return
|
||||
}
|
||||
var e ZwlrScreencopyFrameV1FlagsEvent
|
||||
l := 0
|
||||
e.Flags = client.Uint32(data[l : l+4])
|
||||
l += 4
|
||||
|
||||
i.flagsHandler(e)
|
||||
case 2:
|
||||
if i.readyHandler == nil {
|
||||
return
|
||||
}
|
||||
var e ZwlrScreencopyFrameV1ReadyEvent
|
||||
l := 0
|
||||
e.TvSecHi = client.Uint32(data[l : l+4])
|
||||
l += 4
|
||||
e.TvSecLo = client.Uint32(data[l : l+4])
|
||||
l += 4
|
||||
e.TvNsec = client.Uint32(data[l : l+4])
|
||||
l += 4
|
||||
|
||||
i.readyHandler(e)
|
||||
case 3:
|
||||
if i.failedHandler == nil {
|
||||
return
|
||||
}
|
||||
var e ZwlrScreencopyFrameV1FailedEvent
|
||||
|
||||
i.failedHandler(e)
|
||||
case 4:
|
||||
if i.damageHandler == nil {
|
||||
return
|
||||
}
|
||||
var e ZwlrScreencopyFrameV1DamageEvent
|
||||
l := 0
|
||||
e.X = client.Uint32(data[l : l+4])
|
||||
l += 4
|
||||
e.Y = client.Uint32(data[l : l+4])
|
||||
l += 4
|
||||
e.Width = client.Uint32(data[l : l+4])
|
||||
l += 4
|
||||
e.Height = client.Uint32(data[l : l+4])
|
||||
l += 4
|
||||
|
||||
i.damageHandler(e)
|
||||
case 5:
|
||||
if i.linuxDmabufHandler == nil {
|
||||
return
|
||||
}
|
||||
var e ZwlrScreencopyFrameV1LinuxDmabufEvent
|
||||
l := 0
|
||||
e.Format = client.Uint32(data[l : l+4])
|
||||
l += 4
|
||||
e.Width = client.Uint32(data[l : l+4])
|
||||
l += 4
|
||||
e.Height = client.Uint32(data[l : l+4])
|
||||
l += 4
|
||||
|
||||
i.linuxDmabufHandler(e)
|
||||
case 6:
|
||||
if i.bufferDoneHandler == nil {
|
||||
return
|
||||
}
|
||||
var e ZwlrScreencopyFrameV1BufferDoneEvent
|
||||
|
||||
i.bufferDoneHandler(e)
|
||||
}
|
||||
}
|
||||
399
core/internal/proto/wp_viewporter/viewporter.go
Normal file
399
core/internal/proto/wp_viewporter/viewporter.go
Normal file
@@ -0,0 +1,399 @@
|
||||
// Generated by go-wayland-scanner
|
||||
// https://github.com/yaslama/go-wayland/cmd/go-wayland-scanner
|
||||
// XML file : /tmp/viewporter.xml
|
||||
//
|
||||
// viewporter Protocol Copyright:
|
||||
//
|
||||
// Copyright © 2013-2016 Collabora, Ltd.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
// to deal in the Software without restriction, including without limitation
|
||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
// and/or sell copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice (including the next
|
||||
// paragraph) shall be included in all copies or substantial portions of the
|
||||
// Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
package wp_viewporter
|
||||
|
||||
import "github.com/AvengeMedia/DankMaterialShell/core/pkg/go-wayland/wayland/client"
|
||||
|
||||
// WpViewporterInterfaceName is the name of the interface as it appears in the [client.Registry].
|
||||
// It can be used to match the [client.RegistryGlobalEvent.Interface] in the
|
||||
// [Registry.SetGlobalHandler] and can be used in [Registry.Bind] if this applies.
|
||||
const WpViewporterInterfaceName = "wp_viewporter"
|
||||
|
||||
// WpViewporter : surface cropping and scaling
|
||||
//
|
||||
// The global interface exposing surface cropping and scaling
|
||||
// capabilities is used to instantiate an interface extension for a
|
||||
// wl_surface object. This extended interface will then allow
|
||||
// cropping and scaling the surface contents, effectively
|
||||
// disconnecting the direct relationship between the buffer and the
|
||||
// surface size.
|
||||
type WpViewporter struct {
|
||||
client.BaseProxy
|
||||
}
|
||||
|
||||
// NewWpViewporter : surface cropping and scaling
|
||||
//
|
||||
// The global interface exposing surface cropping and scaling
|
||||
// capabilities is used to instantiate an interface extension for a
|
||||
// wl_surface object. This extended interface will then allow
|
||||
// cropping and scaling the surface contents, effectively
|
||||
// disconnecting the direct relationship between the buffer and the
|
||||
// surface size.
|
||||
func NewWpViewporter(ctx *client.Context) *WpViewporter {
|
||||
wpViewporter := &WpViewporter{}
|
||||
ctx.Register(wpViewporter)
|
||||
return wpViewporter
|
||||
}
|
||||
|
||||
// Destroy : unbind from the cropping and scaling interface
|
||||
//
|
||||
// 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.
|
||||
func (i *WpViewporter) Destroy() error {
|
||||
defer i.Context().Unregister(i)
|
||||
const opcode = 0
|
||||
const _reqBufLen = 8
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return err
|
||||
}
|
||||
|
||||
// GetViewport : extend surface interface for crop and scale
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// surface: the surface
|
||||
func (i *WpViewporter) GetViewport(surface *client.Surface) (*WpViewport, error) {
|
||||
id := NewWpViewport(i.Context())
|
||||
const opcode = 1
|
||||
const _reqBufLen = 8 + 4 + 4
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], id.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], surface.ID())
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return id, err
|
||||
}
|
||||
|
||||
type WpViewporterError uint32
|
||||
|
||||
// WpViewporterError :
|
||||
const (
|
||||
// WpViewporterErrorViewportExists : the surface already has a viewport object associated
|
||||
WpViewporterErrorViewportExists WpViewporterError = 0
|
||||
)
|
||||
|
||||
func (e WpViewporterError) Name() string {
|
||||
switch e {
|
||||
case WpViewporterErrorViewportExists:
|
||||
return "viewport_exists"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (e WpViewporterError) Value() string {
|
||||
switch e {
|
||||
case WpViewporterErrorViewportExists:
|
||||
return "0"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (e WpViewporterError) String() string {
|
||||
return e.Name() + "=" + e.Value()
|
||||
}
|
||||
|
||||
// WpViewportInterfaceName is the name of the interface as it appears in the [client.Registry].
|
||||
// It can be used to match the [client.RegistryGlobalEvent.Interface] in the
|
||||
// [Registry.SetGlobalHandler] and can be used in [Registry.Bind] if this applies.
|
||||
const WpViewportInterfaceName = "wp_viewport"
|
||||
|
||||
// WpViewport : crop and scale interface to a wl_surface
|
||||
//
|
||||
// An additional interface to a wl_surface object, which allows the
|
||||
// client to specify the cropping and scaling of the surface
|
||||
// contents.
|
||||
//
|
||||
// This interface works with two concepts: the source rectangle (src_x,
|
||||
// src_y, src_width, src_height), and the destination size (dst_width,
|
||||
// dst_height). The contents of the source rectangle are scaled to the
|
||||
// destination size, and content outside the source rectangle is ignored.
|
||||
// This state is double-buffered, see wl_surface.commit.
|
||||
//
|
||||
// The two parts of crop and scale state are independent: the source
|
||||
// rectangle, and the destination size. Initially both are unset, that
|
||||
// is, no scaling is applied. The whole of the current wl_buffer is
|
||||
// used as the source, and the surface size is as defined in
|
||||
// wl_surface.attach.
|
||||
//
|
||||
// If the destination size is set, it causes the surface size to become
|
||||
// dst_width, dst_height. The source (rectangle) is scaled to exactly
|
||||
// this size. This overrides whatever the attached wl_buffer size is,
|
||||
// unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
|
||||
// has no content and therefore no size. Otherwise, the size is always
|
||||
// at least 1x1 in surface local coordinates.
|
||||
//
|
||||
// If the source rectangle is set, it defines what area of the wl_buffer is
|
||||
// taken as the source. If the source rectangle is set and the destination
|
||||
// size is not set, then src_width and src_height must be integers, and the
|
||||
// surface size becomes the source rectangle size. This results in cropping
|
||||
// without scaling. If src_width or src_height are not integers and
|
||||
// destination size is not set, the bad_size protocol error is raised when
|
||||
// the surface state is applied.
|
||||
//
|
||||
// The coordinate transformations from buffer pixel coordinates up to
|
||||
// the surface-local coordinates happen in the following order:
|
||||
// 1. buffer_transform (wl_surface.set_buffer_transform)
|
||||
// 2. buffer_scale (wl_surface.set_buffer_scale)
|
||||
// 3. crop and scale (wp_viewport.set*)
|
||||
// This means, that the source rectangle coordinates of crop and scale
|
||||
// are given in the coordinates after the buffer transform and scale,
|
||||
// i.e. in the coordinates that would be the surface-local coordinates
|
||||
// if the crop and scale was not applied.
|
||||
//
|
||||
// If src_x or src_y are negative, the bad_value protocol error is raised.
|
||||
// Otherwise, if the source rectangle is partially or completely outside of
|
||||
// the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
|
||||
// when the surface state is applied. A NULL wl_buffer does not raise the
|
||||
// out_of_buffer error.
|
||||
//
|
||||
// If the wl_surface associated with the wp_viewport is destroyed,
|
||||
// all wp_viewport requests except 'destroy' raise the protocol error
|
||||
// no_surface.
|
||||
//
|
||||
// If the wp_viewport object is destroyed, the crop and scale
|
||||
// state is removed from the wl_surface. The change will be applied
|
||||
// on the next wl_surface.commit.
|
||||
type WpViewport struct {
|
||||
client.BaseProxy
|
||||
}
|
||||
|
||||
// NewWpViewport : crop and scale interface to a wl_surface
|
||||
//
|
||||
// An additional interface to a wl_surface object, which allows the
|
||||
// client to specify the cropping and scaling of the surface
|
||||
// contents.
|
||||
//
|
||||
// This interface works with two concepts: the source rectangle (src_x,
|
||||
// src_y, src_width, src_height), and the destination size (dst_width,
|
||||
// dst_height). The contents of the source rectangle are scaled to the
|
||||
// destination size, and content outside the source rectangle is ignored.
|
||||
// This state is double-buffered, see wl_surface.commit.
|
||||
//
|
||||
// The two parts of crop and scale state are independent: the source
|
||||
// rectangle, and the destination size. Initially both are unset, that
|
||||
// is, no scaling is applied. The whole of the current wl_buffer is
|
||||
// used as the source, and the surface size is as defined in
|
||||
// wl_surface.attach.
|
||||
//
|
||||
// If the destination size is set, it causes the surface size to become
|
||||
// dst_width, dst_height. The source (rectangle) is scaled to exactly
|
||||
// this size. This overrides whatever the attached wl_buffer size is,
|
||||
// unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
|
||||
// has no content and therefore no size. Otherwise, the size is always
|
||||
// at least 1x1 in surface local coordinates.
|
||||
//
|
||||
// If the source rectangle is set, it defines what area of the wl_buffer is
|
||||
// taken as the source. If the source rectangle is set and the destination
|
||||
// size is not set, then src_width and src_height must be integers, and the
|
||||
// surface size becomes the source rectangle size. This results in cropping
|
||||
// without scaling. If src_width or src_height are not integers and
|
||||
// destination size is not set, the bad_size protocol error is raised when
|
||||
// the surface state is applied.
|
||||
//
|
||||
// The coordinate transformations from buffer pixel coordinates up to
|
||||
// the surface-local coordinates happen in the following order:
|
||||
// 1. buffer_transform (wl_surface.set_buffer_transform)
|
||||
// 2. buffer_scale (wl_surface.set_buffer_scale)
|
||||
// 3. crop and scale (wp_viewport.set*)
|
||||
// This means, that the source rectangle coordinates of crop and scale
|
||||
// are given in the coordinates after the buffer transform and scale,
|
||||
// i.e. in the coordinates that would be the surface-local coordinates
|
||||
// if the crop and scale was not applied.
|
||||
//
|
||||
// If src_x or src_y are negative, the bad_value protocol error is raised.
|
||||
// Otherwise, if the source rectangle is partially or completely outside of
|
||||
// the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
|
||||
// when the surface state is applied. A NULL wl_buffer does not raise the
|
||||
// out_of_buffer error.
|
||||
//
|
||||
// If the wl_surface associated with the wp_viewport is destroyed,
|
||||
// all wp_viewport requests except 'destroy' raise the protocol error
|
||||
// no_surface.
|
||||
//
|
||||
// If the wp_viewport object is destroyed, the crop and scale
|
||||
// state is removed from the wl_surface. The change will be applied
|
||||
// on the next wl_surface.commit.
|
||||
func NewWpViewport(ctx *client.Context) *WpViewport {
|
||||
wpViewport := &WpViewport{}
|
||||
ctx.Register(wpViewport)
|
||||
return wpViewport
|
||||
}
|
||||
|
||||
// Destroy : remove scaling and cropping from the surface
|
||||
//
|
||||
// The associated wl_surface's crop and scale state is removed.
|
||||
// The change is applied on the next wl_surface.commit.
|
||||
func (i *WpViewport) Destroy() error {
|
||||
defer i.Context().Unregister(i)
|
||||
const opcode = 0
|
||||
const _reqBufLen = 8
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return err
|
||||
}
|
||||
|
||||
// SetSource : set the source rectangle for cropping
|
||||
//
|
||||
// Set the source rectangle of the associated wl_surface. See
|
||||
// wp_viewport for the description, and relation to the wl_buffer
|
||||
// size.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// The crop and scale state is double-buffered, see wl_surface.commit.
|
||||
//
|
||||
// x: source rectangle x
|
||||
// y: source rectangle y
|
||||
// width: source rectangle width
|
||||
// height: source rectangle height
|
||||
func (i *WpViewport) SetSource(x, y, width, height float64) error {
|
||||
const opcode = 1
|
||||
const _reqBufLen = 8 + 4 + 4 + 4 + 4
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
client.PutFixed(_reqBuf[l:l+4], x)
|
||||
l += 4
|
||||
client.PutFixed(_reqBuf[l:l+4], y)
|
||||
l += 4
|
||||
client.PutFixed(_reqBuf[l:l+4], width)
|
||||
l += 4
|
||||
client.PutFixed(_reqBuf[l:l+4], height)
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return err
|
||||
}
|
||||
|
||||
// SetDestination : set the surface size for scaling
|
||||
//
|
||||
// Set the destination size of the associated wl_surface. See
|
||||
// wp_viewport for the description, and relation to the wl_buffer
|
||||
// size.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// The crop and scale state is double-buffered, see wl_surface.commit.
|
||||
//
|
||||
// width: surface width
|
||||
// height: surface height
|
||||
func (i *WpViewport) SetDestination(width, height int32) error {
|
||||
const opcode = 2
|
||||
const _reqBufLen = 8 + 4 + 4
|
||||
var _reqBuf [_reqBufLen]byte
|
||||
l := 0
|
||||
client.PutUint32(_reqBuf[l:4], i.ID())
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(_reqBufLen<<16|opcode&0x0000ffff))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(width))
|
||||
l += 4
|
||||
client.PutUint32(_reqBuf[l:l+4], uint32(height))
|
||||
l += 4
|
||||
err := i.Context().WriteMsg(_reqBuf[:], nil)
|
||||
return err
|
||||
}
|
||||
|
||||
type WpViewportError uint32
|
||||
|
||||
// WpViewportError :
|
||||
const (
|
||||
// WpViewportErrorBadValue : negative or zero values in width or height
|
||||
WpViewportErrorBadValue WpViewportError = 0
|
||||
// WpViewportErrorBadSize : destination size is not integer
|
||||
WpViewportErrorBadSize WpViewportError = 1
|
||||
// WpViewportErrorOutOfBuffer : source rectangle extends outside of the content area
|
||||
WpViewportErrorOutOfBuffer WpViewportError = 2
|
||||
// WpViewportErrorNoSurface : the wl_surface was destroyed
|
||||
WpViewportErrorNoSurface WpViewportError = 3
|
||||
)
|
||||
|
||||
func (e WpViewportError) Name() string {
|
||||
switch e {
|
||||
case WpViewportErrorBadValue:
|
||||
return "bad_value"
|
||||
case WpViewportErrorBadSize:
|
||||
return "bad_size"
|
||||
case WpViewportErrorOutOfBuffer:
|
||||
return "out_of_buffer"
|
||||
case WpViewportErrorNoSurface:
|
||||
return "no_surface"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (e WpViewportError) Value() string {
|
||||
switch e {
|
||||
case WpViewportErrorBadValue:
|
||||
return "0"
|
||||
case WpViewportErrorBadSize:
|
||||
return "1"
|
||||
case WpViewportErrorOutOfBuffer:
|
||||
return "2"
|
||||
case WpViewportErrorNoSurface:
|
||||
return "3"
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
func (e WpViewportError) String() string {
|
||||
return e.Name() + "=" + e.Value()
|
||||
}
|
||||
407
core/internal/proto/xml/wlr-layer-shell-unstable-v1.xml
Normal file
407
core/internal/proto/xml/wlr-layer-shell-unstable-v1.xml
Normal file
@@ -0,0 +1,407 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="wlr_layer_shell_unstable_v1">
|
||||
<copyright>
|
||||
Copyright © 2017 Drew DeVault
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that copyright notice and this permission
|
||||
notice appear in supporting documentation, and that the name of
|
||||
the copyright holders not be used in advertising or publicity
|
||||
pertaining to distribution of the software without specific,
|
||||
written prior permission. The copyright holders make no
|
||||
representations about the suitability of this software for any
|
||||
purpose. It is provided "as is" without express or implied
|
||||
warranty.
|
||||
|
||||
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<interface name="zwlr_layer_shell_v1" version="5">
|
||||
<description summary="create surfaces that are layers of the desktop">
|
||||
Clients can use this interface to assign the surface_layer role to
|
||||
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
||||
rendered with a defined z-depth respective to each other. They may also be
|
||||
anchored to the edges and corners of a screen and specify input handling
|
||||
semantics. This interface should be suitable for the implementation of
|
||||
many desktop shell components, and a broad number of other applications
|
||||
that interact with the desktop.
|
||||
</description>
|
||||
|
||||
<request name="get_layer_surface">
|
||||
<description summary="create a layer_surface from a surface">
|
||||
Create a layer surface for an existing surface. This assigns the role of
|
||||
layer_surface, or raises a protocol error if another role is already
|
||||
assigned.
|
||||
|
||||
Creating a layer surface from a wl_surface 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 layer_surface.configure call
|
||||
must also be treated as errors.
|
||||
|
||||
After creating a layer_surface object and setting it up, the client
|
||||
must perform an initial commit without any buffer attached.
|
||||
The compositor will reply with a layer_surface.configure event.
|
||||
The client must acknowledge it and is then allowed to attach a buffer
|
||||
to map the surface.
|
||||
|
||||
You may pass NULL for output to allow the compositor to decide which
|
||||
output to use. Generally this will be the one that the user most
|
||||
recently interacted with.
|
||||
|
||||
Clients can specify a namespace that defines the purpose of the layer
|
||||
surface.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="zwlr_layer_surface_v1"/>
|
||||
<arg name="surface" type="object" interface="wl_surface"/>
|
||||
<arg name="output" type="object" interface="wl_output" allow-null="true"/>
|
||||
<arg name="layer" type="uint" enum="layer" summary="layer to add this surface to"/>
|
||||
<arg name="namespace" type="string" summary="namespace for the layer surface"/>
|
||||
</request>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="role" value="0" summary="wl_surface has another role"/>
|
||||
<entry name="invalid_layer" value="1" summary="layer value is invalid"/>
|
||||
<entry name="already_constructed" value="2" summary="wl_surface has a buffer attached or committed"/>
|
||||
</enum>
|
||||
|
||||
<enum name="layer">
|
||||
<description summary="available layers for surfaces">
|
||||
These values indicate which layers a surface can be rendered in. They
|
||||
are ordered by z depth, bottom-most first. Traditional shell surfaces
|
||||
will typically be rendered between the bottom and top layers.
|
||||
Fullscreen shell surfaces are typically rendered at the top layer.
|
||||
Multiple surfaces can share a single layer, and ordering within a
|
||||
single layer is undefined.
|
||||
</description>
|
||||
|
||||
<entry name="background" value="0"/>
|
||||
<entry name="bottom" value="1"/>
|
||||
<entry name="top" value="2"/>
|
||||
<entry name="overlay" value="3"/>
|
||||
</enum>
|
||||
|
||||
<!-- Version 3 additions -->
|
||||
|
||||
<request name="destroy" type="destructor" since="3">
|
||||
<description summary="destroy the layer_shell object">
|
||||
This request indicates that the client will not use the layer_shell
|
||||
object any more. Objects that have been created through this instance
|
||||
are not affected.
|
||||
</description>
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="zwlr_layer_surface_v1" version="5">
|
||||
<description summary="layer metadata interface">
|
||||
An interface that may be implemented by a wl_surface, for surfaces that
|
||||
are designed to be rendered as a layer of a stacked desktop-like
|
||||
environment.
|
||||
|
||||
Layer surface state (layer, size, anchor, exclusive zone,
|
||||
margin, interactivity) is double-buffered, and will be applied at the
|
||||
time wl_surface.commit of the corresponding wl_surface is called.
|
||||
|
||||
Attaching a null buffer to a layer surface unmaps it.
|
||||
|
||||
Unmapping a layer_surface means that the surface cannot be shown by the
|
||||
compositor until it is explicitly mapped again. The layer_surface
|
||||
returns to the state it had right after layer_shell.get_layer_surface.
|
||||
The client can re-map the surface by performing a commit without any
|
||||
buffer attached, waiting for a configure event and handling it as usual.
|
||||
</description>
|
||||
|
||||
<request name="set_size">
|
||||
<description summary="sets the size of the surface">
|
||||
Sets the size of the surface in surface-local coordinates. The
|
||||
compositor will display the surface centered with respect to its
|
||||
anchors.
|
||||
|
||||
If you pass 0 for either value, the compositor will assign it and
|
||||
inform you of the assignment in the configure event. You must set your
|
||||
anchor to opposite edges in the dimensions you omit; not doing so is a
|
||||
protocol error. Both values are 0 by default.
|
||||
|
||||
Size is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="width" type="uint"/>
|
||||
<arg name="height" type="uint"/>
|
||||
</request>
|
||||
|
||||
<request name="set_anchor">
|
||||
<description summary="configures the anchor point of the surface">
|
||||
Requests that the compositor anchor the surface to the specified edges
|
||||
and corners. If two orthogonal edges are specified (e.g. 'top' and
|
||||
'left'), then the anchor point will be the intersection of the edges
|
||||
(e.g. the top left corner of the output); otherwise the anchor point
|
||||
will be centered on that edge, or in the center if none is specified.
|
||||
|
||||
Anchor is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="anchor" type="uint" enum="anchor"/>
|
||||
</request>
|
||||
|
||||
<request name="set_exclusive_zone">
|
||||
<description summary="configures the exclusive geometry of this surface">
|
||||
Requests that the compositor avoids occluding an area with other
|
||||
surfaces. The compositor's use of this information is
|
||||
implementation-dependent - do not assume that this region will not
|
||||
actually be occluded.
|
||||
|
||||
A positive value is only meaningful if the surface is anchored to one
|
||||
edge or an edge and both perpendicular edges. If the surface is not
|
||||
anchored, anchored to only two perpendicular edges (a corner), anchored
|
||||
to only two parallel edges or anchored to all edges, a positive value
|
||||
will be treated the same as zero.
|
||||
|
||||
A positive zone is the distance from the edge in surface-local
|
||||
coordinates to consider exclusive.
|
||||
|
||||
Surfaces that do not wish to have an exclusive zone may instead specify
|
||||
how they should interact with surfaces that do. If set to zero, the
|
||||
surface indicates that it would like to be moved to avoid occluding
|
||||
surfaces with a positive exclusive zone. If set to -1, the surface
|
||||
indicates that it would not like to be moved to accommodate for other
|
||||
surfaces, and the compositor should extend it all the way to the edges
|
||||
it is anchored to.
|
||||
|
||||
For example, a panel might set its exclusive zone to 10, so that
|
||||
maximized shell surfaces are not shown on top of it. A notification
|
||||
might set its exclusive zone to 0, so that it is moved to avoid
|
||||
occluding the panel, but shell surfaces are shown underneath it. A
|
||||
wallpaper or lock screen might set their exclusive zone to -1, so that
|
||||
they stretch below or over the panel.
|
||||
|
||||
The default value is 0.
|
||||
|
||||
Exclusive zone is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="zone" type="int"/>
|
||||
</request>
|
||||
|
||||
<request name="set_margin">
|
||||
<description summary="sets a margin from the anchor point">
|
||||
Requests that the surface be placed some distance away from the anchor
|
||||
point on the output, in surface-local coordinates. Setting this value
|
||||
for edges you are not anchored to has no effect.
|
||||
|
||||
The exclusive zone includes the margin.
|
||||
|
||||
Margin is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="top" type="int"/>
|
||||
<arg name="right" type="int"/>
|
||||
<arg name="bottom" type="int"/>
|
||||
<arg name="left" type="int"/>
|
||||
</request>
|
||||
|
||||
<enum name="keyboard_interactivity">
|
||||
<description summary="types of keyboard interaction possible for a layer shell surface">
|
||||
Types of keyboard interaction possible for layer shell surfaces. The
|
||||
rationale for this is twofold: (1) some applications are not interested
|
||||
in keyboard events and not allowing them to be focused can improve the
|
||||
desktop experience; (2) some applications will want to take exclusive
|
||||
keyboard focus.
|
||||
</description>
|
||||
|
||||
<entry name="none" value="0">
|
||||
<description summary="no keyboard focus is possible">
|
||||
This value indicates that this surface is not interested in keyboard
|
||||
events and the compositor should never assign it the keyboard focus.
|
||||
|
||||
This is the default value, set for newly created layer shell surfaces.
|
||||
|
||||
This is useful for e.g. desktop widgets that display information or
|
||||
only have interaction with non-keyboard input devices.
|
||||
</description>
|
||||
</entry>
|
||||
<entry name="exclusive" value="1">
|
||||
<description summary="request exclusive keyboard focus">
|
||||
Request exclusive keyboard focus if this surface is above the shell surface layer.
|
||||
|
||||
For the top and overlay layers, the seat will always give
|
||||
exclusive keyboard focus to the top-most layer which has keyboard
|
||||
interactivity set to exclusive. If this layer contains multiple
|
||||
surfaces with keyboard interactivity set to exclusive, the compositor
|
||||
determines the one receiving keyboard events in an implementation-
|
||||
defined manner. In this case, no guarantee is made when this surface
|
||||
will receive keyboard focus (if ever).
|
||||
|
||||
For the bottom and background layers, the compositor is allowed to use
|
||||
normal focus semantics.
|
||||
|
||||
This setting is mainly intended for applications that need to ensure
|
||||
they receive all keyboard events, such as a lock screen or a password
|
||||
prompt.
|
||||
</description>
|
||||
</entry>
|
||||
<entry name="on_demand" value="2" since="4">
|
||||
<description summary="request regular keyboard focus semantics">
|
||||
This requests the compositor to allow this surface to be focused and
|
||||
unfocused by the user in an implementation-defined manner. The user
|
||||
should be able to unfocus this surface even regardless of the layer
|
||||
it is on.
|
||||
|
||||
Typically, the compositor will want to use its normal mechanism to
|
||||
manage keyboard focus between layer shell surfaces with this setting
|
||||
and regular toplevels on the desktop layer (e.g. click to focus).
|
||||
Nevertheless, it is possible for a compositor to require a special
|
||||
interaction to focus or unfocus layer shell surfaces (e.g. requiring
|
||||
a click even if focus follows the mouse normally, or providing a
|
||||
keybinding to switch focus between layers).
|
||||
|
||||
This setting is mainly intended for desktop shell components (e.g.
|
||||
panels) that allow keyboard interaction. Using this option can allow
|
||||
implementing a desktop shell that can be fully usable without the
|
||||
mouse.
|
||||
</description>
|
||||
</entry>
|
||||
</enum>
|
||||
|
||||
<request name="set_keyboard_interactivity">
|
||||
<description summary="requests keyboard events">
|
||||
Set how keyboard events are delivered to this surface. By default,
|
||||
layer shell surfaces do not receive keyboard events; this request can
|
||||
be used to change this.
|
||||
|
||||
This setting is inherited by child surfaces set by the get_popup
|
||||
request.
|
||||
|
||||
Layer surfaces receive pointer, touch, and tablet events normally. If
|
||||
you do not want to receive them, set the input region on your surface
|
||||
to an empty region.
|
||||
|
||||
Keyboard interactivity is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="keyboard_interactivity" type="uint" enum="keyboard_interactivity"/>
|
||||
</request>
|
||||
|
||||
<request name="get_popup">
|
||||
<description summary="assign this layer_surface as an xdg_popup parent">
|
||||
This assigns an xdg_popup's parent to this layer_surface. This popup
|
||||
should have been created via xdg_surface::get_popup with the parent set
|
||||
to NULL, and this request must be invoked before committing the popup's
|
||||
initial state.
|
||||
|
||||
See the documentation of xdg_popup for more details about what an
|
||||
xdg_popup is and how it is used.
|
||||
</description>
|
||||
<arg name="popup" type="object" interface="xdg_popup"/>
|
||||
</request>
|
||||
|
||||
<request name="ack_configure">
|
||||
<description summary="ack a configure event">
|
||||
When a configure event is received, if a client commits the
|
||||
surface in response to the configure event, then the client
|
||||
must make an ack_configure request sometime before the commit
|
||||
request, passing along the serial of the configure event.
|
||||
|
||||
If the client receives multiple configure events before it
|
||||
can respond to one, it only has to ack the last configure event.
|
||||
|
||||
A client is not required to commit immediately after sending
|
||||
an ack_configure request - it may even ack_configure several times
|
||||
before its next surface commit.
|
||||
|
||||
A client may send multiple ack_configure requests before committing, but
|
||||
only the last request sent before a commit indicates which configure
|
||||
event the client really is responding to.
|
||||
</description>
|
||||
<arg name="serial" type="uint" summary="the serial from the configure event"/>
|
||||
</request>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the layer_surface">
|
||||
This request destroys the layer surface.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<event name="configure">
|
||||
<description summary="suggest a surface change">
|
||||
The configure event asks the client to resize its surface.
|
||||
|
||||
Clients should arrange their surface for the new states, and then send
|
||||
an ack_configure request with the serial sent in this configure event at
|
||||
some point before committing the new surface.
|
||||
|
||||
The client is free to dismiss all but the last configure event it
|
||||
received.
|
||||
|
||||
The width and height arguments specify the size of the window in
|
||||
surface-local coordinates.
|
||||
|
||||
The size is a hint, in the sense that the client is free to ignore it if
|
||||
it doesn't resize, pick a smaller size (to satisfy aspect ratio or
|
||||
resize in steps of NxM pixels). If the client picks a smaller size and
|
||||
is anchored to two opposite anchors (e.g. 'top' and 'bottom'), the
|
||||
surface will be centered on this axis.
|
||||
|
||||
If the width or height arguments are zero, it means the client should
|
||||
decide its own window dimension.
|
||||
</description>
|
||||
<arg name="serial" type="uint"/>
|
||||
<arg name="width" type="uint"/>
|
||||
<arg name="height" type="uint"/>
|
||||
</event>
|
||||
|
||||
<event name="closed">
|
||||
<description summary="surface should be closed">
|
||||
The closed event is sent by the compositor when the surface will no
|
||||
longer be shown. The output may have been destroyed or the user may
|
||||
have asked for it to be removed. Further changes to the surface will be
|
||||
ignored. The client should destroy the resource after receiving this
|
||||
event, and create a new surface if they so choose.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="invalid_surface_state" value="0" summary="provided surface state is invalid"/>
|
||||
<entry name="invalid_size" value="1" summary="size is invalid"/>
|
||||
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
|
||||
<entry name="invalid_keyboard_interactivity" value="3" summary="keyboard interactivity is invalid"/>
|
||||
<entry name="invalid_exclusive_edge" value="4" summary="exclusive edge is invalid given the surface anchors"/>
|
||||
</enum>
|
||||
|
||||
<enum name="anchor" bitfield="true">
|
||||
<entry name="top" value="1" summary="the top edge of the anchor rectangle"/>
|
||||
<entry name="bottom" value="2" summary="the bottom edge of the anchor rectangle"/>
|
||||
<entry name="left" value="4" summary="the left edge of the anchor rectangle"/>
|
||||
<entry name="right" value="8" summary="the right edge of the anchor rectangle"/>
|
||||
</enum>
|
||||
|
||||
<!-- Version 2 additions -->
|
||||
|
||||
<request name="set_layer" since="2">
|
||||
<description summary="change the layer of the surface">
|
||||
Change the layer that the surface is rendered on.
|
||||
|
||||
Layer is double-buffered, see wl_surface.commit.
|
||||
</description>
|
||||
<arg name="layer" type="uint" enum="zwlr_layer_shell_v1.layer" summary="layer to move this surface to"/>
|
||||
</request>
|
||||
|
||||
<!-- Version 5 additions -->
|
||||
|
||||
<request name="set_exclusive_edge" since="5">
|
||||
<description summary="set the edge the exclusive zone will be applied to">
|
||||
Requests an edge for the exclusive zone to apply. The exclusive
|
||||
edge will be automatically deduced from anchor points when possible,
|
||||
but when the surface is anchored to a corner, it will be necessary
|
||||
to set it explicitly to disambiguate, as it is not possible to deduce
|
||||
which one of the two corner edges should be used.
|
||||
|
||||
The edge must be one the surface is anchored to, otherwise the
|
||||
invalid_exclusive_edge protocol error will be raised.
|
||||
</description>
|
||||
<arg name="edge" type="uint" enum="anchor"/>
|
||||
</request>
|
||||
</interface>
|
||||
</protocol>
|
||||
234
core/internal/proto/xml/wlr-screencopy-unstable-v1.xml
Normal file
234
core/internal/proto/xml/wlr-screencopy-unstable-v1.xml
Normal file
@@ -0,0 +1,234 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="wlr_screencopy_unstable_v1">
|
||||
<copyright>
|
||||
Copyright © 2018 Simon Ser
|
||||
Copyright © 2019 Andri Yngvason
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next
|
||||
paragraph) shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<description summary="screen content capturing on client buffers">
|
||||
This protocol allows clients to ask the compositor to copy part of the
|
||||
screen content to a client buffer.
|
||||
|
||||
Warning! The protocol described in this file is experimental and
|
||||
backward incompatible changes may be made. Backward compatible changes
|
||||
may be added together with the corresponding interface version bump.
|
||||
Backward incompatible changes are done by bumping the version number in
|
||||
the protocol and interface names and resetting the interface version.
|
||||
Once the protocol is to be declared stable, the 'z' prefix and the
|
||||
version number in the protocol and interface names are removed and the
|
||||
interface version number is reset.
|
||||
|
||||
Note! This protocol is deprecated and not intended for production use.
|
||||
The ext-image-copy-capture-v1 protocol should be used instead.
|
||||
</description>
|
||||
|
||||
<interface name="zwlr_screencopy_manager_v1" version="3">
|
||||
<description summary="manager to inform clients and begin capturing">
|
||||
This object is a manager which offers requests to start capturing from a
|
||||
source.
|
||||
</description>
|
||||
|
||||
<request name="capture_output">
|
||||
<description summary="capture an output">
|
||||
Capture the next frame of an entire output.
|
||||
</description>
|
||||
<arg name="frame" type="new_id" interface="zwlr_screencopy_frame_v1"/>
|
||||
<arg name="overlay_cursor" type="int"
|
||||
summary="composite cursor onto the frame"/>
|
||||
<arg name="output" type="object" interface="wl_output"/>
|
||||
</request>
|
||||
|
||||
<request name="capture_output_region">
|
||||
<description summary="capture an output's region">
|
||||
Capture the next frame of an output's region.
|
||||
|
||||
The region is given in output logical coordinates, see
|
||||
xdg_output.logical_size. The region will be clipped to the output's
|
||||
extents.
|
||||
</description>
|
||||
<arg name="frame" type="new_id" interface="zwlr_screencopy_frame_v1"/>
|
||||
<arg name="overlay_cursor" type="int"
|
||||
summary="composite cursor onto the frame"/>
|
||||
<arg name="output" type="object" interface="wl_output"/>
|
||||
<arg name="x" type="int"/>
|
||||
<arg name="y" type="int"/>
|
||||
<arg name="width" type="int"/>
|
||||
<arg name="height" type="int"/>
|
||||
</request>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the manager">
|
||||
All objects created by the manager will still remain valid, until their
|
||||
appropriate destroy request has been called.
|
||||
</description>
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="zwlr_screencopy_frame_v1" version="3">
|
||||
<description summary="a frame ready for copy">
|
||||
This object represents a single frame.
|
||||
|
||||
When created, a series of buffer events will be sent, each representing a
|
||||
supported buffer type. The "buffer_done" event is sent afterwards to
|
||||
indicate that all supported buffer types have been enumerated. The client
|
||||
will then be able to send a "copy" request. If the capture is successful,
|
||||
the compositor will send a "flags" event followed by a "ready" event.
|
||||
|
||||
For objects version 2 or lower, wl_shm buffers are always supported, ie.
|
||||
the "buffer" event is guaranteed to be sent.
|
||||
|
||||
If the capture failed, the "failed" event is sent. This can happen anytime
|
||||
before the "ready" event.
|
||||
|
||||
Once either a "ready" or a "failed" event is received, the client should
|
||||
destroy the frame.
|
||||
</description>
|
||||
|
||||
<event name="buffer">
|
||||
<description summary="wl_shm buffer information">
|
||||
Provides information about wl_shm buffer parameters that need to be
|
||||
used for this frame. This event is sent once after the frame is created
|
||||
if wl_shm buffers are supported.
|
||||
</description>
|
||||
<arg name="format" type="uint" enum="wl_shm.format" summary="buffer format"/>
|
||||
<arg name="width" type="uint" summary="buffer width"/>
|
||||
<arg name="height" type="uint" summary="buffer height"/>
|
||||
<arg name="stride" type="uint" summary="buffer stride"/>
|
||||
</event>
|
||||
|
||||
<request name="copy">
|
||||
<description summary="copy the frame">
|
||||
Copy the frame to the supplied buffer. The buffer must have the
|
||||
correct size, see zwlr_screencopy_frame_v1.buffer and
|
||||
zwlr_screencopy_frame_v1.linux_dmabuf. The buffer needs to have a
|
||||
supported format.
|
||||
|
||||
If the frame is successfully copied, "flags" and "ready" events are
|
||||
sent. Otherwise, a "failed" event is sent.
|
||||
</description>
|
||||
<arg name="buffer" type="object" interface="wl_buffer"/>
|
||||
</request>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="already_used" value="0"
|
||||
summary="the object has already been used to copy a wl_buffer"/>
|
||||
<entry name="invalid_buffer" value="1"
|
||||
summary="buffer attributes are invalid"/>
|
||||
</enum>
|
||||
|
||||
<enum name="flags" bitfield="true">
|
||||
<entry name="y_invert" value="1" summary="contents are y-inverted"/>
|
||||
</enum>
|
||||
|
||||
<event name="flags">
|
||||
<description summary="frame flags">
|
||||
Provides flags about the frame. This event is sent once before the
|
||||
"ready" event.
|
||||
</description>
|
||||
<arg name="flags" type="uint" enum="flags" summary="frame flags"/>
|
||||
</event>
|
||||
|
||||
<event name="ready">
|
||||
<description summary="indicates frame is available for reading">
|
||||
Called as soon as the frame is copied, indicating it is available
|
||||
for reading. This event includes the time at which the presentation took place.
|
||||
|
||||
The timestamp is expressed as tv_sec_hi, tv_sec_lo, tv_nsec triples,
|
||||
each component being an unsigned 32-bit value. Whole seconds are in
|
||||
tv_sec which is a 64-bit value combined from tv_sec_hi and tv_sec_lo,
|
||||
and the additional fractional part in tv_nsec as nanoseconds. Hence,
|
||||
for valid timestamps tv_nsec must be in [0, 999999999]. The seconds part
|
||||
may have an arbitrary offset at start.
|
||||
|
||||
After receiving this event, the client should destroy the object.
|
||||
</description>
|
||||
<arg name="tv_sec_hi" type="uint"
|
||||
summary="high 32 bits of the seconds part of the timestamp"/>
|
||||
<arg name="tv_sec_lo" type="uint"
|
||||
summary="low 32 bits of the seconds part of the timestamp"/>
|
||||
<arg name="tv_nsec" type="uint"
|
||||
summary="nanoseconds part of the timestamp"/>
|
||||
</event>
|
||||
|
||||
<event name="failed">
|
||||
<description summary="frame copy failed">
|
||||
This event indicates that the attempted frame copy has failed.
|
||||
|
||||
After receiving this event, the client should destroy the object.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="delete this object, used or not">
|
||||
Destroys the frame. This request can be sent at any time by the client.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<!-- Version 2 additions -->
|
||||
<request name="copy_with_damage" since="2">
|
||||
<description summary="copy the frame when it's damaged">
|
||||
Same as copy, except it waits until there is damage to copy.
|
||||
</description>
|
||||
<arg name="buffer" type="object" interface="wl_buffer"/>
|
||||
</request>
|
||||
|
||||
<event name="damage" since="2">
|
||||
<description summary="carries the coordinates of the damaged region">
|
||||
This event is sent right before the ready event when copy_with_damage is
|
||||
requested. It may be generated multiple times for each copy_with_damage
|
||||
request.
|
||||
|
||||
The arguments describe a box around an area that has changed since the
|
||||
last copy request that was derived from the current screencopy manager
|
||||
instance.
|
||||
|
||||
The union of all regions received between the call to copy_with_damage
|
||||
and a ready event is the total damage since the prior ready event.
|
||||
</description>
|
||||
<arg name="x" type="uint" summary="damaged x coordinates"/>
|
||||
<arg name="y" type="uint" summary="damaged y coordinates"/>
|
||||
<arg name="width" type="uint" summary="current width"/>
|
||||
<arg name="height" type="uint" summary="current height"/>
|
||||
</event>
|
||||
|
||||
<!-- Version 3 additions -->
|
||||
<event name="linux_dmabuf" since="3">
|
||||
<description summary="linux-dmabuf buffer information">
|
||||
Provides information about linux-dmabuf buffer parameters that need to
|
||||
be used for this frame. This event is sent once after the frame is
|
||||
created if linux-dmabuf buffers are supported.
|
||||
</description>
|
||||
<arg name="format" type="uint" summary="fourcc pixel format"/>
|
||||
<arg name="width" type="uint" summary="buffer width"/>
|
||||
<arg name="height" type="uint" summary="buffer height"/>
|
||||
</event>
|
||||
|
||||
<event name="buffer_done" since="3">
|
||||
<description summary="all buffer types reported">
|
||||
This event is sent once after all buffer events have been sent.
|
||||
|
||||
The client should proceed to create a buffer of one of the supported
|
||||
types, and send a "copy" request.
|
||||
</description>
|
||||
</event>
|
||||
</interface>
|
||||
</protocol>
|
||||
Reference in New Issue
Block a user