[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gambas-user] A commit to make color picker show color under the mouse again


On Sat, 2 Mar 2024 at 20:06, Bruce Steers <bsteers4@xxxxxxxxx> wrote:

>
>
> On Fri, 1 Mar 2024 at 22:58, Benoît Minisini <
> benoit.minisini@xxxxxxxxxxxxxxxx> wrote:
>
>> Le 01/03/2024 à 21:29, Bruce Steers a écrit :
>> >
>> >
>> > On Fri, 1 Mar 2024 at 14:54, Bruce Steers <bsteers4@xxxxxxxxx
>> > <mailto:bsteers4@xxxxxxxxx>> wrote:
>> >
>> >
>> >
>> >     On Fri, 1 Mar 2024 at 14:21, Benoît Minisini
>> >     <benoit.minisini@xxxxxxxxxxxxxxxx
>> >     <mailto:benoit.minisini@xxxxxxxxxxxxxxxx>> wrote:
>> >
>> >         Le 01/03/2024 à 13:45, Bruce Steers a écrit :
>> >          >
>> >          > Somebody mentioned that color picker no longer displays the
>> >         color under
>> >          > the cursor when moving the mouse around now.
>> >          >
>> >          > So is this any good to ya Ben?  i'll merge request if yes.
>> >          >
>> >          >
>> >
>> https://gitlab.com/bsteers4/gambas/-/commit/d3cc23da0aca4ab4d1471abaad96269688e6c354
>> <
>> https://gitlab.com/bsteers4/gambas/-/commit/d3cc23da0aca4ab4d1471abaad96269688e6c354>
>> <
>> https://gitlab.com/bsteers4/gambas/-/commit/d3cc23da0aca4ab4d1471abaad96269688e6c354
>> <
>> https://gitlab.com/bsteers4/gambas/-/commit/d3cc23da0aca4ab4d1471abaad96269688e6c354
>> >>
>> >          >
>> >          > it just makes gb.form color picker show the color when using
>> >         color
>> >          > picker again.
>> >          >
>> >          > Or did you remove that feature for a good reason?  (or a
>> >         horrible
>> >          > reason, like wayland)
>> >
>> >         That's wayland. All Gambas code specific to X11 will slowly
>> >         disappear...
>> >
>> >         Now the color picker is based on the desktop portal by default.
>> >
>> >         --
>> >         Benoît Minisini.
>> >
>> >
>> >     Yes I understand portal is now being used, but using the portals
>> >     Screenshot.PickColor() directly breaks the color view when picking
>> >     in ColorChooser
>> >
>> >     I'm just using the portals Screenshot.Screenshot() method instead of
>> >     Screenshot.PickColor() so it is still good for wayland yes?
>> >
>> >
>> > Correction
>> > I'm actually using Desktop.Screenshot() instead of Desktop.PickColor()
>> > so use of portal or not is as you have coded it in Desktop.class
>> >
>> > I just got an ubuntu with wayland up and running to test some
>> things.......
>> > good lord , desktop portal Screenshot and PickColor really suck in how
>> > limited they are and the lack of options, was it designed by micro$oft
>> > or something?
>> >
>> > it does not actually seem to take a screenshot, it just opens a dialog
>> > to take a screenshot.  even with interactive: False it still demands
>> > interaction ! , all the interaction setting changes is having
>> > interaction to change the screenshot parameters before grabbing the
>> image.
>>
>> It's the Gnome portal. The KDE portal is better. Each desktop has to
>> provide a desktop portal implementation, and of course all that are
>> different.
>>
>> So you are mainly right, it sucks.
>>
>> >
>> > That sucks as i have also used similar code in my programs to get pixel
>> > color at mouse position to this.
>> >    $hZoom = Desktop.Screenshot(Mouse.ScreenX, Mouse.ScreenY, 1, 1)
>> >    $iColor = $hZoom.Image[0, 0]
>> >
>> > Setting Desktop.UsePortal = False just throws an error in wayland now
>> if
>> > you try to use screenshot or pickcolor.
>> >
>> > God I hate wayland
>> > So i guess using something like Desktop.Screenshot(Mouse.ScreenX,
>> > Mouse.ScreenY, 1, 1) on wayland will still open the screenshot dialog
>> > and demand your interaction , then after closing the dialog the full
>> > screen image is copied to the required size and returned.
>> >
>> > If this kind of thing is what's also going to happen with all x11
>> > specific code just to also support wayland then it kinda sucks.
>> > wayland is making gambas worse :(
>> >
>> >
>> > Sorry , I'm ranting :(
>> > Respects
>> >
>> > BruceS
>> >
>>
>> If you want to pick a color, use Desktop.PickColor(), as there is a
>> specific method for that in the desktop portal.
>>
>> Regards,
>>
>> --
>> Benoît Minisini.
>>
>
> Yes i know that.
> What i want is to be able to detect the screen color at the mouse position
> so i can display it while moving.
> Desktop.PickColor() does not do this. it grabs the mouse and only reports
> the color once you click.
>
> Desktop.Screenshot() is no good for it on wayland as it opens a screenshot
> dialog so can't be used in mousemove event.
>
> Sigh
>
> I'll have a play and see if maybe there is a way.
>

Well i think it's not possible with wayland but then again it is not
actually needed with wayland or if using the desktop portal PickColor
method.
The portal PickColor method shows a magnifying glass with the cursor that
shows the color as you move.
So currently it only does not show the color if using x11.

I just submitted a merge that uses the old Grab and
Desktop.Screenshot(Mouse.ScreenX, Mouse.ScreenY, 1, 1).Image[0, 0] method
of showing the color in the panColor area as you move but only if you are
using x11 as currently you have it set to use portal if wayland but not if
x11.


So until you make x11 use portal too then this is a fix :)
I've tested it using x and wayland and all is good :)

https://gitlab.com/gambas/gambas/-/merge_requests/337

Respects
BruceS