guillaumechereau / goxel

Goxel: Free and Open Source 3D Voxel Editor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

ernierasta opened this issue · 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.

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.

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

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.

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?

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

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).

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