// Code generated by wlturbo-scanner. DO NOT EDIT. // Protocol: viewporter // Source: viewporter.xml package viewporter import ( cross_wl_surface "github.com/bnema/wlturbo/protocol/core" "github.com/bnema/wlturbo/wl" ) // ERROR_VIEWPORT_EXISTS is the error viewport_exists value. const ERROR_VIEWPORT_EXISTS = 0 // ERROR_BAD_VALUE is the error bad_value value. const ERROR_BAD_VALUE = 0 // ERROR_BAD_SIZE is the error bad_size value. const ERROR_BAD_SIZE = 1 // ERROR_OUT_OF_BUFFER is the error out_of_buffer value. const ERROR_OUT_OF_BUFFER = 2 // ERROR_NO_SURFACE is the error no_surface value. const ERROR_NO_SURFACE = 3 // WpViewporterInterface is the protocol interface name. const WpViewporterInterface = "wp_viewporter" // WpViewporter is the generated binding for wp_viewporter version 1. type WpViewporter struct { wl.BaseProxy } // NewWpViewporter returns an unbound WpViewporter. func NewWpViewporter(ctx *wl.Context) *WpViewporter { obj := &WpViewporter{} obj.SetContext(ctx) ctx.Register(obj) return obj } // 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 (o *WpViewporter) Destroy() error { if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_viewporter.destroy", Destructor: true}); err != nil { return err } return nil } // 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. func (o *WpViewporter) GetViewport(surface *cross_wl_surface.Surface) (*WpViewport, error) { var arg1 wl.Object if surface != nil { arg1 = surface } child := &WpViewport{} child.SetContext(o.Context()) if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wp_viewporter.get_viewport", Child: child}, child, arg1); err != nil { return nil, err } return child, nil } // EventSignature returns the declared event argument types in wire order. func (o *WpViewporter) EventSignature(opcode uint16) (string, bool) { switch opcode { default: return "", false } } // Dispatch decodes one event on wp_viewporter and calls the registered handlers. func (o *WpViewporter) Dispatch(event *wl.Event) { switch event.Opcode { default: } } // WpViewportInterface is the protocol interface name. const WpViewportInterface = "wp_viewport" // WpViewport is the generated binding for wp_viewport version 1. type WpViewport struct { wl.BaseProxy } // NewWpViewport returns an unbound WpViewport. func NewWpViewport(ctx *wl.Context) *WpViewport { obj := &WpViewport{} obj.SetContext(ctx) ctx.Register(obj) return obj } // The associated wl_surface's crop and scale state is removed. The change is applied on the next wl_surface.commit. func (o *WpViewport) Destroy() error { if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 0, Name: "wp_viewport.destroy", Destructor: true}); err != nil { return err } return nil } // 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. func (o *WpViewport) SetSource(x wl.Fixed, y wl.Fixed, width wl.Fixed, height wl.Fixed) error { if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 1, Name: "wp_viewport.set_source"}, x, y, width, height); err != nil { return err } return nil } // 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. func (o *WpViewport) SetDestination(width int32, height int32) error { if err := o.Context().Request(wl.Request{Proxy: o, Opcode: 2, Name: "wp_viewport.set_destination"}, width, height); err != nil { return err } return nil } // EventSignature returns the declared event argument types in wire order. func (o *WpViewport) EventSignature(opcode uint16) (string, bool) { switch opcode { default: return "", false } } // Dispatch decodes one event on wp_viewport and calls the registered handlers. func (o *WpViewport) Dispatch(event *wl.Event) { switch event.Opcode { default: } }