Colour picker issue.

Post

Posted
Rating:
#1 (In Topic #1190)
Avatar
Guru
cogier is in the usergroup ‘Guru’
If, for example, you want to change the colour of a Form's background and select the 'Free' option and then use the picker to select a colour on the screen, it always used to show a magnified view of the screen in the area marked in red below. Since Gambas 3.19 this is not working for me. I also notice that if you create a program using the ColorChooser the same issue is repeated. Is this just me, or do others have this issue?

<IMG src="https://www.cogier.com/gambas/ColourPicker.png"> </IMG>
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’
Benoit changed the color picker to use desktop portal

And changed the code.

Here is the code from FColorChooser in gb.form …

Code (gambas)

  1. Public Sub txtHexa_Click()
  2.  
  3.   Dim iColor As Integer
  4.  
  5.   Component.Load("gb.desktop")
  6.  
  7.   iColor = Desktop.PickColor()
  8.   If iColor <> Color.Default Then
  9.     SetColor(iColor)
  10.     RaiseActivate
  11.  
  12.   ' hTimer.Stop
  13.   ' $hZoom = Null
  14.   ' panColor.Refresh
  15.  
  16.   ' panGrab.Mouse = Mouse.Cross
  17.   ' 'panGrab.Cursor = New Cursor(txtHexa.Picture, 0, txtHexa.Picture.H - 1)
  18.   ' panGrab.Show
  19.   ' panGrab_MouseMove
  20.   ' panGrab.Grab
  21.   ' $hZoom = Null
  22.   ' panColor.Refresh 'SetColor(hPict.Image[0, 0])
  23.   ' panGrab.Hide
  24.  
  25.  

As you can see the desktop portal method is not as involved.
the commented out old code uses grab and stuff to monitor the mouse movement.

the Desktop.PickColor does not.
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Guru
cogier is in the usergroup ‘Guru’
Benoit changed the color picker to use desktop portal

I'm not sure I understand what the 'desktop portal' means. How do I pick the specific pixel I want and what is the point of an empty box?
Online now: No Back to the top

Post

Posted
Rating:
#4
Guru
BruceSteers is in the usergroup ‘Guru’
 Desktop portal Is a DBus interface  supposed to be the next xdg-utils thing.

And I agree, it not as good like that,  Maybe ask Ben to put it back as it was.

I'm pretty sure portal ScreenShot does not work on all systems (Fedora iirc)
Online now: No Back to the top

Post

Posted
Rating:
#5
Guru
BruceSteers is in the usergroup ‘Guru’
I've fixed it here…
gb.form ColorChooser shows color for color picker again. (d3cc23da) · Commits · Bruce Steers / gambas · GitLab

I do not know if Benoit removed the feature for a reason (possibly it does not work on wayland)

I messaged the M/L pointing to that commit, maybe Ben will add it or do it his own way or not do it because of wayland?
Only time will tell…..
Online now: No Back to the top

Post

Posted
Rating:
#6
Avatar
Guru
cogier is in the usergroup ‘Guru’
Thanks for that. We will see what happens...
Online now: No Back to the top

Post

Posted
Rating:
#7
Guru
BruceSteers is in the usergroup ‘Guru’
Looks like a no.
because of how crap wayland is.

Screenshot and PickColor from desktop portal do not work the same,
they have very few options and demand interaction.

like the screenshot method that with x11 can get any bit of the screen , with portal all it does is open a screenshot dialog.
then Ben has worked around it by copying part of the image after grabbing the whole screen.

Code (gambas)

  1.  
  2.  
  3.   Dim hScreenshot As Image
  4.  
  5.   If Desktop.Platform <> "x11" Then
  6.     hScreenshot = DesktopPortal.Screenshot()
  7.     If Width <= 0 Then Width = Desktop.Width - X
  8.     If Height <= 0 Then Height = Desktop.Height - Y
  9.     Return hScreenshot.Copy(X, Y, Width, Height).Picture
  10.  
  11.   Try Return Super.Screenshot(X, Y, Width, Height)
  12.  
  13.  
  14.  

so basically the color being seen as you move the mouse in ColorChooser.class has been ruined by wayland because each call to Desktop.Screenshot to get the pixels will now open the screenshot dialog :(

It will still work on x11 but Benoit says any x11 specific code in gb.desktop will slowly disappear and use desktop portal instead!

God I hate wayland, it sucks so very badly that now it's even making gambas worse.
Damn that's sucky , really really sucky
Online now: No Back to the top

Post

Posted
Rating:
#8
Guru
BruceSteers is in the usergroup ‘Guru’
Right so i tried another merge request.
ColorChooser, re-enable seeing the color under the pointer when picking color with x11. (!337) · Merge requests · Gambas / gambas · GitLab

This one uses the method to show the color in the color box only if using x11 as currently gb.desktop is set to use desktop.portal ONLY if on wayland.

The desktop portal PickColor method shows a nice little magnifying glass for the cursor that displays the color as you move.

So currently if using wayland you CAN see the color in the cursor but if using x there is nothing :(

So if Ben accepts this then it will work again for X11 systems.
Or if he changes x11 to use portal then we'll have the magnifying glass for a cursor showing color anyway.
Online now: No Back to the top

Post

Posted
Rating:
#9
Guru
BruceSteers is in the usergroup ‘Guru’
Does not look like Ben wants to make this change.
He's not commented on the merge request.  (i just gave him a nudge)

If you want your gambas to do it and you compile then you could replace this file in your branch's /comp/src/gb.form/.src/Color folder and recompile.
comp/src/gb.form/.src/Color/FColorChooser.class · 10d24da31489d07a97055b3d5e189c0e30b77d61 · Gambas / gambas · GitLab
Online now: No Back to the top
1 guest and 0 members have just viewed this.