akiraux / Akira

Native Linux App for UI and UX Design built in Vala and GTK
GNU General Public License v3.0
5.24k stars 203 forks source link

Color picker not working under Wayland #598

Open madjesc opened 3 years ago

madjesc commented 3 years ago

Expected Behavior

When clicking in the global color picker, it should zoom in and let me choose a color. Like #432 gif

Current Behavior

The color picker circle does nothing and the cursor gets stuck Log:

(Akira:2): Gdk-CRITICAL **: 16:44:35.500: gdk_monitor_get_geometry: assertion 'GDK_IS_MONITOR (monitor)' failed

Possible Solution

  1. Use xdg portals
  2. Make the color picker only local <--- I will try to do this
  3. Delete the color picker

Steps to Reproduce (for bugs)

  1. Run akira under Wayland
  2. Click in the color picker
  3. Try to pick a color from the screen

Context

I was trying the app features and this happened

Your Environment (for bugs)

Alecaddd commented 3 years ago

Thanks for the report. I'm not currently using Wayland so I can't test this issue. If you have the means and time, it would be great if you could create PR for it, making sure that the fix keeps the color picker working under X11.

albfan commented 3 years ago

wayland do not have access to other windows (security first) so yes, using portals is the solution.

A wayland color picker can demonstrate how to do it correctly: https://github.com/emersion/grim

Alecaddd commented 3 years ago

@Mkefs any luck in figuring this out? Otherwise I can give it a try

madjesc commented 3 years ago

@Mkefs any luck in figuring this out? Otherwise I can give it a try

Mmm, I'm having some troubles with it, and also I have homework, so I don't have so much time. But I still working in it

bilelmoussaoui commented 3 years ago

Under wayland, the best shot I can think of using the portals. We can use libportal https://github.com/flatpak/libportal for that, it doesn't provide a vapi file, but we can easily write a wrapper for the pick_color method

See here for an example on how to do so: https://gitlab.gnome.org/bertob/nostalgia/-/blob/master/src/libportal.vapi#L3-26

albfan commented 3 years ago

From color-selection I guess it should be xdp_portal_pick_color

https://gitlab.gnome.org/World/gcolor3/-/merge_requests/141/diffs#e8072c54942d0460ac2a08e9cfacb2aebffbd712_1930_1753