goxel icon indicating copy to clipboard operation
goxel copied to clipboard

Wrong cursor position in Linux - Wayland - Sway WM when scale is not 1.0

Open ernierasta opened this issue 1 year ago • 1 comments

Hi, I love Goxel, it is amazing and I am using to teach kids 3d printing.

As title says on Linux in Wayland using Sway WM when monitor scale is not 1 (tested with 1.5) there is problem with cursor position (cube is drawn to the left and higher then actual mouse cursor).

From what I understand from code it is the same problem as on apple, my wrong, primitive workaround is:

In src/main.c (around line 200):

//#ifndef __APPLE__ // As far as I can tell this is a bug in glfw on Mac.
//    xpos /= scales[0];
//    ypos /= scales[1];
//#endif
//

So if there is option to recognize we are running on Wayland (eventually Sway WM), it would be great to also avoid dividing positions.

Another way of "solving" a problem without auto-detecting environment would be to make it configurable via cmd options.

I had not tested it under other Wayland client, so I have no idea if this is general Wayland problem or it is specific to Sway WM.

ernierasta avatar Feb 09 '24 12:02 ernierasta

Thanks for the report. I'll try to find out a bit more about this issue. Goxel is probably not the first application to run into it.

guillaumechereau avatar Feb 09 '24 17:02 guillaumechereau

I can reproduce the bug both on sway and on GNOME wayland, both with 2x scaling

fgaz avatar Jul 07 '24 19:07 fgaz

Hello @fgaz, thanks for the report. I guess I'll add a command line option for now, but I would really like this to work out of the box in all case.

guillaumechereau avatar Jul 08 '24 04:07 guillaumechereau

OK I pushed a fix that I think should make it work on all platforms now. Can you try on the last commit and let me know if that works?

guillaumechereau avatar Jul 08 '24 06:07 guillaumechereau

The last commit fixed the issue on both environments! Thanks!

Do you plan to tag a new release soon? Otherwise I think I'll backport the patch to version 0.14.0 of the NixOS package

fgaz avatar Jul 08 '24 06:07 fgaz

Good to hear! I am planning to do a new release soon, maybe tonight even if I have time (and I don't find some last minute bugs).

guillaumechereau avatar Jul 08 '24 12:07 guillaumechereau

OK I just made a new release 0.15.0. You can check it out.

guillaumechereau avatar Jul 08 '24 15:07 guillaumechereau