drfrag666 / gzdoom

GZDoom adds an OpenGL renderer to the ZDoom source port.
http://gzdoom.drdteam.org
GNU General Public License v3.0
74 stars 16 forks source link

Mouse doesn't work properly in menus with scaled fullscreen resolution #13

Closed NickZ closed 4 years ago

NickZ commented 4 years ago

When using fullscreen and the resolution of LZDoom is set to something other than the desktop resolution, the mouse will still behave as if it's using the desktop resolution and as a result the mouse cursor position and the actual mouse position will be very different.

drfrag666 commented 4 years ago

For me it works well on windows with both scaling and video mode change. Which OS? Linux? LZDoom has the same ancient ZDoom code and i only ported some fixes. Sometimes there are problems but that's nothing new. My linux machine is very old and slow so i did only limited testing but i haven't received any reports and the code in this version is the same as in older ones.

NickZ commented 4 years ago

Yes, this occurs on Linux; it's pretty consistent across all the machines that I've tried.

I found that VMs with 3d hardware acceleration (like virtualbox) is decent enough to test this on Linux, too

drfrag666 commented 4 years ago

I've been testing it and for me it works well, position never was very accurate and you had to click close (same as on windows). Which resolutions are you using?

NickZ commented 4 years ago

I am using 848x480, but I am able to reproduce on basically all of them. I am building from source on both ubuntu 19.10 and 18.04 from the current branch, g3.3mgw. I've tested in both software and opengl.

drfrag666 commented 4 years ago

But which scale mode (vid_scalemode) are you using?

NickZ commented 4 years ago

I'm using the defaults for scaling, 0, i.e. Scaled (Nearest), but it's happening on every scale mode. I'm testing this on a 1080p desktop, btw.

drfrag666 commented 4 years ago

Same scale mode here on a 1400 4:3 panel. What about the windows version? Native or wine.

NickZ commented 4 years ago

I'm testing in a Windows VM, the mouse seems to work fine there, in either fullscreen or borderless.

drfrag666 commented 4 years ago

What about linux with vid_renderer 0 and vid_glswfb 0?

NickZ commented 4 years ago

Ah hah, vid_glswfb 0 fixed the issue; of course, the colors look all gross now.

drfrag666 commented 4 years ago

Strange, you were using vid_renderer 1 before right?

NickZ commented 4 years ago

I used both 0 and 1 (software and opengl), I was having the same issue.

drfrag666 commented 4 years ago

I've noticed that you're using a letterboxed mode and not a native resolution, why? The function void ScaleWithAspect (int &w, int &h, int Width, int Height) performs the adjustment only for standard aspect ratios and then there's a correction for letterboxed modes in OpenGLSWFrameBuffer and OpenGLFrameBuffer but it doesn't work well. It's the commit "Fix mouse position being wrong when vid_scalemode is active". I've managed to reproduce the issue on windows but i don't know how i could fix it, that old code was added by dpJudas and it's no longer maintained upstream. Have you tried those LB modes with vid_glswfb 0?

NickZ commented 4 years ago

I'm not using the letterboxed mode? I've never tried to test it with letterboxing turned on.

drfrag666 commented 4 years ago

Do you mean 848x480 is supported by your graphics driver? That's not an standard resolution and it's not adjusted. For me it doesn't work propery for LB modes on windows. I can only test software on linux as i'm on an old laptop with GL 1.3 support. Which other resolutions are you using? Edit: letterboxed modes have LB next to them.

NickZ commented 4 years ago

It happens on non-letterboxed resolutions as well. It happens on 720p, and other higher resolutions supported by my graphics card.

Also, do you have a raspberry pi? If not, would you like one?

drfrag666 commented 4 years ago

And you say it doesn't happen with vid_glswfb 0? The code is the same minus the adjustment for LB somewhere else. What are the exact resolutions? (to know the aspect ratio) I'm a poor guy and i can't afford one so no thanks. Performance in my master branch on my old ibm laptop is very poor and i dunno why. Current branch is 3x faster. Could you try it on the Pi with SoftPoly? (it's the default vid_preferbackend but change vid_rendermode to 1 and set swtruecolor true here)

NickZ commented 4 years ago

I meant I can send you one, you live in spain, right? I know a supplier there and can get one very cheap to send you. Hit me up on Discord, I messaged you.

drfrag666 commented 4 years ago

Yeah i live in Granada, that would be great. You mean you sent me a message on Discord? I uninstalled the app becouse the phone was full. Now i can't join with the same account.

NickZ commented 4 years ago

Gotcha, I think the easiest thing to do would be for you to just add this item here to an Amazon wishlist, then I can just get it for you, can you do that? https://www.amazon.es/LABISTS-Raspberry-Interruptor-Disipadores-Ventilador/dp/B07YYZBQYP

drfrag666 commented 4 years ago

Thanks, i don't use Amazon but i've managed to restore the password for my Discord account.

NickZ commented 4 years ago

Cool, I'm NickZ on discord

drfrag666 commented 4 years ago

The ScaleCoordsFromWindow function is overriden and the adjustment wasn't performed. I've pushed a commit to fix this but i can't test it since i can only run SDLFB on my old laptop. In theory it should work. https://github.com/drfrag666/gzdoom/commit/d8d72f5d75dd444ec7966af72b1595fc673eb4e7 https://github.com/drfrag666/gzdoom/commit/dde31dcac4222f459019b29700879149716e6c2c

drfrag666 commented 4 years ago

In the end i declined the offer, i still use CRTs and i wouldn't have taken full advantage of it anyway. Since now there's no feedback i'm closing this as fixed.