~eliasnaur/gio-patches

gio: Change App background to Transparent v1 PROPOSED

Paulo Melo
Paulo Melo: 1
 Change App background to Transparent

 1 files changed, 1 insertions(+), 1 deletions(-)
#426936 apple.yml success
#426937 freebsd.yml success
#426938 linux.yml failed
#426939 openbsd.yml success
paulo melo
The background is now either transparent or black.

This was the approach suggested by Elias Naur. 
Another solution is to leave it as it was and change the gpu/gpu.go 
file at line 1004 by removing the opacity test and at line 1011 by removing the opaque()
Note, I just realized that it could also be a window option. So something like:

w := app.NewWindow(app.ClearColor(color.NRGBA{A: 0x00, R: 0x00, G:
0x00, B: 0x00}))

And potentially:

w := app.NewWindow(app.NoClear())
On Mon, Feb 15, 2021 at 8:23 PM paulo melo <paulo.durrer.melo@gmail.com> wrote:
paulo melo
Elias,

on my initial tests I’ve found the following using the default background as White.
I tryed to explicitly set the background to transparent and found that on the gpu.go file there was a lock to only accept opaque colors.

If we remove this opaque lock I’ve found that it works. Is there any special reason to have this lock? 

I believe that this solution should be the best. By default the background is White and if we want it to be another color or transparent we set it as needed.

Do you agree?
On 16 Feb 2021, at 08:56, Elias Naur <mail@eliasnaur.com> wrote:

On Mon Feb 15, 2021 at 21:06, Egon Elbre wrote:
Next
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~eliasnaur/gio-patches/patches/20282/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH gio] Change App background to Transparent Export this patch

Paulo Melo
---
 app/loop.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/loop.go b/app/loop.go
index cf00c41..0dadeac 100644
--- a/app/loop.go
+++ b/app/loop.go
@@ -86,7 +86,7 @@ func (l *renderLoop) renderLoop(ctx window.Context) error {
				l.refreshErr <- ctx.MakeCurrent()
			case frame := <-l.frames:
				ctx.Lock()
				g.Clear(color.NRGBA{A: 0xff, R: 0xff, G: 0xff, B: 0xff})
				g.Clear(color.NRGBA{A: 0x00, R: 0x00, G: 0x00, B: 0x00})
				g.Collect(frame.viewport, frame.ops)
				// Signal that we're done with the frame ops.
				l.ack <- struct{}{}
-- 
2.26.2
builds.sr.ht
gio/patches: FAILED in 22m57s

[Change App background to Transparent][0] from [Paulo Melo][1]

[0]: https://lists.sr.ht/~eliasnaur/gio-patches/patches/20282
[1]: mailto:paulo.durrer.melo@gmail.com

✓ #426936 SUCCESS gio/patches/apple.yml   https://builds.sr.ht/~eliasnaur/job/426936
✓ #426937 SUCCESS gio/patches/freebsd.yml https://builds.sr.ht/~eliasnaur/job/426937
✓ #426939 SUCCESS gio/patches/openbsd.yml https://builds.sr.ht/~eliasnaur/job/426939
✗ #426938 FAILED  gio/patches/linux.yml   https://builds.sr.ht/~eliasnaur/job/426938
Please change your commit message to include the package name, and use
lowercase

app: change clear color to transparent

Also add a sentence or two motivating the change and sign off the change.

On Mon Feb 15, 2021 at 16:47, Paulo Melo wrote:
One annoyance with this approach is that it requires mostly everyone
to add painting to white.

Wouldn't adding a `paint.Clear` operation be a nicer approach?
That way people can choose to override the clearing with whichever
color is suitable,
without having to change the default useful behavior.

On Mon, Feb 15, 2021 at 8:13 PM Paulo Melo <paulo.durrer.melo@gmail.com> wrote: