Skip to content

x/exp/shiny: x11driver makes it impossible to implement screen.Buffer #14026

@jnjackins

Description

@jnjackins

I have a type (a graphical widget) that implements screen.Buffer, which I've been using happily with gldriver, under darwin. The documentation is here, and there is an example program sigint.ca/graphics/editor/example/multi if you are interested.

The widget is implemented as a type Editor which implements screen.Buffer, and is drawn to a shiny window as follows:

widget := editor.NewEditor(size, font, nil)
...
win.Upload(image.ZP, widget, widget.Bounds())

However, when I tested my code on linux recently, I quickly ran into a problem:

func (w *windowImpl) Upload(dp image.Point, src screen.Buffer, sr image.Rectangle) {
    src.(*bufferImpl).upload(w, xproto.Drawable(w.xw), w.xg, w.s.xsi.RootDepth, dp, sr)
}

Unlike gldriver, methods implemented by x11driver assume that any screen.Buffer, screen.Texture, etc. passed to them are the implementations provided by x11driver, and panic when they are not.

Is this restriction necessary? Should I rethink my strategy? Why provide an interface if it's not allowed to be implemented?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions