~eliasnaur/gio

4 2

How to make a new backend

Details
Message ID
<CCNNV1H9W6T7.1HMRN72844NJ8@micro-pc>
DKIM signature
pass
Download raw message
Hello gio,

TLDR; is there a simple way to create a new backend for rendering the
gui and getting the input io on another device?

So I'm now obsessed with e-paper devices. I've got a pocketbook e-reader
and learned, that it runs linux on a arm processor and they have a C
library for accessing the events (show, hide, touch, key, ...) and for
drawing on the screen (line, rect, fill, crop, text, ...).

I've started some "gio inspired" immediate mode gui lib on top of this.
But when I implemented, with the help of gio src, some drawing
operations, a "event queue", layout, widget, flex, label, button, I
figured out, that it will be too complicated to implement every thing on
my own and maybe it will be better to port gio to pocketbook.

So like I've written, it runs linux on arm, but no x11 or wayland. With
the help of pocketbook's proprietary inkview lib (and some cgo), maybe
I can create some framebuffer api. 

Also the events are simple: SHOW (like the FrameEvent), HIDE (when the
app goes to background), INIT, POINTER with x,y position (and state UP,
DOWN, LONG, ...).

So just for my use case, It would be great if there were a "Driver"
interface, which I would implement and then everything from gio would
just magically work on my pocketbook :P
Details
Message ID
<CCPD5MNV8H0W.FOH0J8EMIDYZ@testmac>
In-Reply-To
<CCNNV1H9W6T7.1HMRN72844NJ8@micro-pc> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
On Thu Jul 8, 2021 at 11:45 CEST, Vladimír Magyar wrote:
> Hello gio,
>
> TLDR; is there a simple way to create a new backend for rendering the
> gui and getting the input io on another device?
>
> So I'm now obsessed with e-paper devices. I've got a pocketbook e-reader
> and learned, that it runs linux on a arm processor and they have a C
> library for accessing the events (show, hide, touch, key, ...) and for
> drawing on the screen (line, rect, fill, crop, text, ...).
>
> I've started some "gio inspired" immediate mode gui lib on top of this.
> But when I implemented, with the help of gio src, some drawing
> operations, a "event queue", layout, widget, flex, label, button, I
> figured out, that it will be too complicated to implement every thing on
> my own and maybe it will be better to port gio to pocketbook.
>
> So like I've written, it runs linux on arm, but no x11 or wayland. With
> the help of pocketbook's proprietary inkview lib (and some cgo), maybe
> I can create some framebuffer api. 
>
> Also the events are simple: SHOW (like the FrameEvent), HIDE (when the
> app goes to background), INIT, POINTER with x,y position (and state UP,
> DOWN, LONG, ...).
>

Have you seen the glfw example[0]? It demonstrates external window and
input to a Gio UI.

The problematic part is rendering if you device doesn't support OpenGL
or similar. However, you may be able to replace gpu.GPU with a custom
Gio ops parser. See [1] for how package gpu does it.

Elias

[0] https://git.sr.ht/~eliasnaur/gio-example/tree/main/item/glfw/main.go
[1] https://git.sr.ht/~eliasnaur/gio/tree/main/item/gpu/gpu.go#L867
Details
Message ID
<CCPI81VOI6WW.3QAPWQYY62XKL@micro-pc>
In-Reply-To
<CCPD5MNV8H0W.FOH0J8EMIDYZ@testmac> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
Thanks, I have a look at it.
Details
Message ID
<CD2Y5AYAUWSP.2T9LWA0CPIJY@micro-pc>
In-Reply-To
<CCPD5MNV8H0W.FOH0J8EMIDYZ@testmac> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
Ok, so for me to decode the ops, I need to use the ops.Reader, which is
in the "gioui.org/internal/ops" package. But I cannot import a internal
package:

	use of internal package gioui.org/internal/ops not allowed

Can I just make a local copy of it?
Details
Message ID
<CD2YEVJCCHZP.2FUZKXMKOZF3D@themachine>
In-Reply-To
<CD2Y5AYAUWSP.2T9LWA0CPIJY@micro-pc> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
On Mon Jul 26, 2021 at 10:59, Vladimír Magyar wrote:
> Ok, so for me to decode the ops, I need to use the ops.Reader, which is
> in the "gioui.org/internal/ops" package. But I cannot import a internal
> package:
>
> 	use of internal package gioui.org/internal/ops not allowed
>
> Can I just make a local copy of it?

That's one approach. Another is to develop your port in a local checkout
of Gio, for example in package gpu.

Elias
Reply to thread Export thread (mbox)