FBNeo icon indicating copy to clipboard operation
FBNeo copied to clipboard

sdl2 port fullscreen/window problem

Open MistyDreams opened this issue 2 years ago • 4 comments

Something broke in the sdl2 port alt+enter the image does not center. If the app is started with fullscreen and you press alt + enter the window is far too big as well. Screenshot from 2022-08-09 19-11-45 Screenshot from 2022-08-09 19-11-34 Screenshot from 2022-08-09 19-09-06 Screenshot from 2022-08-09 19-08-48

MistyDreams avatar Aug 09 '22 18:08 MistyDreams

Starting full screen and then pressing alt+enter does get too big window to fit on screen for me too, but starting windowed I can go fullscreen and back to windowed without issues.

What is your screen resolution? Maybe it will help see why it's not centered for you...

cjom avatar Aug 14 '22 17:08 cjom

The resolution is 1920 x 1080. I tried it on two machines same os (Linux Manjaro). It works properly on one (windowed mode) and the image doesn't center on the other like shown above. Tested with the latest freshly compiled sources on both machines. I tested RA in full screen and windowed modes that works properly on both machines.

ediit

done some more testing. if you maximize the window (windowed mode) then change to full screen it works (both in Xorg and Wayland) . Else it looks like the first screen shot when your maximized (shifted to the right in wayland).

The main difference with this issue on wayland and x11 and the machine that not playing nice is the x11 stretches the image instead of keeping the 4:3 aspect ratio. Can take a screenshot if you need one with Xorg.

MistyDreams avatar Aug 14 '22 18:08 MistyDreams

Since it is centered in mine, it's harder to debug... your machines are different, since one is centered and the other is not... ?

cjom avatar Aug 14 '22 20:08 cjom

One machine works properly the other doesnt.

on the one that doesnt xorg stretches the image when maximizing, in wayland is shifts to the right.

On this machine that isint working if you press the window maximize button then press alt + enter it works on both wayland and xorg. From a small window you get the issues mentioned before.

MistyDreams avatar Aug 14 '22 20:08 MistyDreams

Some more updates, the machine that works only works in xorg the same bug happens in wayland on that machine.

MistyDreams avatar Aug 15 '22 17:08 MistyDreams

Would you please test this? https://github.com/cjom/FBNeo/releases/tag/testing

You can either clone and compile or try to use one of the pre compiled binaries (x64 or arm7hf).

Tested with an orange Pi with same "symptoms" and my PC all seems OK.

Also tried to clean some redundant code and repetitive "if jumps", I'm confident did not brake SWITCHRES but could not test that.

cjom avatar Aug 17 '22 23:08 cjom

Managed to test this on both machines. I have left testing to xorg for now as wayland support is sketchy on sdl2 anyway. The machine that works is fine with fullscreen and windowed mode switching. The machine that's not working -fullscreen switches fine but windowed mode still stretches the image.

I think this is sdl2 itself but on both machines in fullscreen if you switch and move the window you need to click somewhere outside it so it displays properly. Fullsreen will switch for me now which is really good. I do appreciate you taking the time to look into this. both machines are also using sdl2 2.0.22

since this is only happening on one machine ill assume its an SDL2 issue I did try downgrading to 20.2.20 it was still the same.

ill need to get some other sdl2 app to test with that way you wont be wasting your time on a one machine bug that could be sdl2

MistyDreams avatar Aug 17 '22 23:08 MistyDreams

I also tried the opengl option (nVidSelect 1) that has issues on windows switch and fullscreen on both machines. It has extra problems but you can see it shifts to the right as well on changing to full screen.

MistyDreams avatar Aug 18 '22 00:08 MistyDreams

I think this is sdl2 itself but on both machines in fullscreen if you switch and move the window you need to click somewhere outside it so it displays properly.

Ubuntu does this in my PC too.

I'ts not clear to me the issue you still have... Starting in window mode image is good, and switching to full screen gets stretched?

Or starting with -fullscreen is OK and switching to window mode gets stretched? And when you say stretched is image out of proportions or image with correct proportions but with added black bars in both sides making the window stretched?

cjom avatar Aug 18 '22 00:08 cjom

Sorry for the confusion I will try clarify.

wayland = shifts to right from windowed to fullscreen.

Ill stick to xorg for here on the machine thats not working because the other machine is fine. window to fullscreen stretches the image when on fullscreen 16:9 no borders.

gnome-screenshot -d 10 & ./fbneo rygar (changed to fullsceen) Screenshot from 2022-08-18 02-05-06

when you start with -fullscreen this works fine it maintains the aspect ratio when switching

gnome-screenshot -d 10 & ./fbneo rygar -fullscreen Screenshot from 2022-08-18 02-11-10

MistyDreams avatar Aug 18 '22 00:08 MistyDreams

Could you test again? https://github.com/cjom/FBNeo/releases/tag/testing

Now it should know when in fullscreen when not, and set size / center position correctly in any case...

If possible to try also vertical games and games that can change to wide screen (sfiii) would be great.

cjom avatar Aug 19 '22 18:08 cjom

Hi just done some testing the is one bug I can see from -fullscreen is keeping a 3:4 aspect ratio for vertical games. The xorg path in wayland is centring now as well on both machines.

However the windowed to fullscreen is loosing is aspect ratio and is changing to 4:3 (for vertical games 3:4) when toggled to full screen on both machines starting from windowed mode. I Can take screen shots if needed mmpork shows it up well.

Now onto the machine thats not working. in Xorg path windowed mode still stretches when in fullscreen with 4:3 games windowed mode sets a 4:3 ratio with borders for the screen for vertical games

-fullscreen works as it should

in Wayland xorg path -fullscreen works like the other machine and so does windowed mode windowed to full screen works fine as well apart from changing it to vertical to 4:3 does this on both machines xorg and wayland

MistyDreams avatar Aug 19 '22 20:08 MistyDreams

here is the picture of the vertical issue. Screenshot from 2022-08-19 21-49-30 Screenshot from 2022-08-19 21-50-02

MistyDreams avatar Aug 19 '22 20:08 MistyDreams

I'm sorry, I'm a bit lost with what is not working, only understood that starting fbneo in window and switching to fullscreen makes image larger than what it should... but I have a hint about what is going on. Just need some minutes to compile...

cjom avatar Aug 19 '22 21:08 cjom

When you have the chance to test, just download again and let me know.

cjom avatar Aug 19 '22 21:08 cjom

Ive tested your changes compiled it myself good news is it all works.

The machine that is being picky in xorg is displaying different behavior on windowed mode toggle if you toggle to fullscreen then back to window the window is the size of the screen. Its fine on wayland though. You can minimize this anyway no idea why this machine acts differently before it was stretching the image. The xorg path is all good in Wayland xorg and xorg.

SDL_VIDEODRIVER=wayland actually has issues but its not the default path anyway and a problem for another day when it arrives. Thanks for taking the time to fix this!

MistyDreams avatar Aug 19 '22 21:08 MistyDreams

I made two commits before asking you to test, you probably did not compile the latest one. You should get a "normal" sized window.

Anyway, was fun and I learned a bit more. :)

I will prepare a pull request and this issue can be closed.

cjom avatar Aug 19 '22 21:08 cjom

just done a pull zero issue on Xorg job well done once again thanks for taking the time to look into this is really appreciated! Its really strange behavior same distro(different hardware) worked fine on one before and not the other. Ill close this since its been tested!

MistyDreams avatar Aug 19 '22 22:08 MistyDreams