Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse off by height of title bar in main menu in windowed mode #650

Open
pirate486743186 opened this issue May 10, 2019 · 36 comments
Open
Labels

Comments

@pirate486743186
Copy link

In windowed mode, in the main menu. You need to position the mouse one line bellow the item you want to click. The tabed menus, are ok.

I find it strange that no one noticed this issue in the main menu. I don't see any relevant open issue.

I installed tsc_2.1.0+git20190323-alpha3_amd64.deb on ubuntu 18.04

@xet7
Copy link
Member

xet7 commented May 10, 2019

@pirate486743186

What Linux distro and window manager you have? I did not see any problem using Linux Mint 19.1 Mate 64bit.

Can you record animgif about that bug with https://github.com/phw/peek and attach that animgif directly to comment to this issue?

@pirate486743186
Copy link
Author

ubuntu 18.04 mate 64 bit
tried marco and compiz

mousebug

@Quintus
Copy link
Member

Quintus commented May 11, 2019

Hmmm. Does the TSC window overlap with any kind of task bar? @Skarfester had the problem that if the TSC window overlapped with the XFCE task bar, X.org reported wrong coordinates to the window that were off by exactly the height of the overlap with the task bar.

You can try a smaller TSC window (change the resolution in the Options menu) and restart TSC. Then check if the problem persists.

@pirate486743186
Copy link
Author

pirate486743186 commented May 11, 2019

Aha. Its the thickness of the window title.
control center > appearance > fonts
max out window title fonts

@xet7
Copy link
Member

xet7 commented May 11, 2019

@pirate486743186

At Ubuntu Mate you can change to other layout so there is only one bar:
https://ubuntu-mate.community/t/choosing-and-changing-panel-layouts-ubuntu-mate-18-04/16502

@Quintus
Copy link
Member

Quintus commented May 11, 2019

Aha. Its the thickness of the window title.

Ah I see. GNOME's CSDs play its role probably. I think it's possible for a programme to signal somehow that its window doesn't want CSDs, which maybe resolves the problem. We ought to do that in our code.

At Ubuntu Mate you can change to other layout so there is only one bar:

That's probably correct and maybe even works around the problem, but running TSC should not require people to change their window layout preferences (except for obvious things such as not choosing a resolution too high for their screen space as was the case with @Skarfester).

Looks to me like a bug in TSC's window handling that should be fixed.

@refi64
Copy link
Member

refi64 commented May 11, 2019

Hmm this feels vaguely familiar, I should try reproducing it....

(AFAIK CSDs don't really affect this; given that we're just using SFML's window APIs, decorations are still being drawn by the compositor here.)

@Quintus
Copy link
Member

Quintus commented May 11, 2019

(AFAIK CSDs don't really affect this; given that we're just using SFML's window APIs, decorations are still being drawn by the compositor here.)

Maybe then there's a mismatch in the reported height of the window and the Y coordinate reported by SFML for the mouse cursor? TSC mostly just processes the mouse cursor coordinates as they come in from SFML, with any in-game scaling applied.

@Quintus Quintus changed the title [bug]mouse off by a line in main menu in windowed mode Mouse off by height of title bar in main menu in windowed mode May 11, 2019
@sydneyjd
Copy link
Member

Hello,
I can reproduce this as well in Ubuntu 18.04. It did not show up in XFCE or LXDE though, Only MATE. It also appears to show up even with different Mate Themes.
And yes, it does appear to depend on the Window Title font(or whole window header, not 100% sure on that).

@pirate486743186
Copy link
Author

It must be the window header's height.

I think i've seen in an old bug, some one saying something about fixing the position of (0,0). Maybe the error happened there.

@Quintus
Copy link
Member

Quintus commented Sep 15, 2019

The problem probably occurs in the translation of SFML's reported coordinates to the game world. If that's true, other items in the game world that can be selected by mouse also suffer from that problem.

@sydneyjd Could you please:

  1. Make a screenshot of the problem with the main menu with debug mode enabled (CTRL+D). Debug mode shows the collision boxes.
  2. Check if the problem also occurs in the level editor when you try to select an element from a level (i.e. from the game world, not from the menu).

If my suspicion is true, then you should see the offset also in the level editor. As for the original problem, I think the main menu's entries should be implemented via CEGUI anyway rather than manually as it's currently the case. That doesn't fix the underlying issue with the coordinate mis-translation, though.

I cannot reproduce on i3. It's appearently something that only occurs with these "modern" window managers.

@sydneyjd
Copy link
Member

Sure,
Just as a note, I have not pulled and recompiled TSC since May.
So playing around, I do not experience the issue at 800x600, but if I go to 1024x768 the problem starts and gets much worse the higher you go with the resolution.
Yes, the offset does shown up when selecting elements in the level editor as well.
1024x768(Load Highlighted)
1024x768
1280x920(Options Highlighted)
1280x960

@Quintus
Copy link
Member

Quintus commented Nov 25, 2019

@refi64 Did you try reproducing this as you announced, and if so, what were the results? I don't see it on my system, and I'll have to setup something in a VM to try it out, so it'd be nice if you could take a look.

@refi64
Copy link
Member

refi64 commented Dec 19, 2019

Well this was probably an issue at some point, but I can't seem to reproduce at all anymore. Hopefully it was a dependency issue that just got fixed from an update...

@refi64 refi64 closed this as completed Dec 19, 2019
@sydneyjd
Copy link
Member

Interesting. I am still able to reproduce this in my Ubuntu 18.04 VM with LXDE using the 2.1.0-Beta1 package provided by Xet7. And I did delete my .cache/tsc and .config/tsc directories as well.

@xet7
Copy link
Member

xet7 commented Dec 23, 2019

Mouse positions do work exactly right on newest Linux Mint 64bit. I am unable to reproduce this.

I don't think TSC would be playable enough in VM, you could get VM environment related errors.

@xet7
Copy link
Member

xet7 commented Dec 23, 2019

I mean Linux Mint Mate 64bit when laptop display screenmode is 1440x900 60hz and TSC is at window 1024x768:

tscdebug

@xet7 xet7 reopened this Dec 23, 2019
@xet7
Copy link
Member

xet7 commented Dec 23, 2019

I will test this on LXDE without VM.

@sydneyjd
Copy link
Member

At 1024x768 it is not terrible, but it gets progressively worse the higher the resolution. Im not saying it is not fixed with newer software, I'm just saying that I can still reproduce it on my Ubuntu 18.04 VM, and I don't have any other mouse related issues in the VM. If we know it is fixed, and 18.04 is not a huge target for users, I don't see a problem with overlooking the issue, but that is up to everyone to decide. The game is actually decently playable in the VM, despite not having great hardware.

@xet7
Copy link
Member

xet7 commented Dec 23, 2019

18.04 is huge target, it's Ubuntu LTS release and Linux Mint uses it as base in newest Linux Mint release.

@sydneyjd
Copy link
Member

facepalm, I am using Mate. The Icon theme threw me off.

@xet7
Copy link
Member

xet7 commented Dec 23, 2019

Is that Ubuntu Mate ?

@xet7
Copy link
Member

xet7 commented Dec 23, 2019

18.04 64bit ?

@sydneyjd
Copy link
Member

Correct. Ubuntu Mate Version 18.04.3 LTS 64-Bit.

@xet7
Copy link
Member

xet7 commented Dec 23, 2019

I can not duplicate this on Ubuntu Mate 18.04 64bit and Lubuntu LXDE 18.04 64bit.

Here is Ubuntu Mate:
ubumate-tsc

@xet7 xet7 closed this as completed Dec 23, 2019
@refi64
Copy link
Member

refi64 commented Dec 23, 2019 via email

@sydneyjd
Copy link
Member

It would take me at least 4 days to upload the VM Disk Image (14GB). Let me whip up a fresh install and see if I can still reproduce it.

@Quintus
Copy link
Member

Quintus commented Dec 23, 2019

It would take me at least 4 days to upload the VM Disk Image (14GB).

Suggestion: Compress it with xz (there's probably lots of zero bytes in the VM image, it should compress well), burn it to a DVD, and mail it to refi (who's in the US, contrary to xet7 and me).

@xet7 xet7 reopened this Dec 23, 2019
@xet7
Copy link
Member

xet7 commented Dec 23, 2019

I did install Ubuntu Mate to VirtualBox VM and test this.

This "bug" happens because TSC window is too big to fit the screen.

Solution is to change TSC window resolution to be smaller, regenerate cache of images, and use that smaller resolution in TSC window. Then all is visible.

I don't know is there anything we could do to "fix" this.

@sydneyjd
Copy link
Member

I spun up two new Ubuntu 18.04 installs this afternoon to play with this. Xet7 is correct, if the window is too large for the actual screen resolution, it causes the issue to appear. I do not know how I did not notice that sooner.
Does that mean that this issue still does apply to other Linux Distros, or has it been remedied in newer software? We should probably make a release note of this if we leave it as is in release.
Thank you Xet7 for troubleshooting this!

@Quintus
Copy link
Member

Quintus commented Dec 24, 2019

This "bug" happens because TSC window is too big to fit the screen.

Interesting. In this regard this is similar to the problem with the docks. It appears that such unusual modifications of the available screen space confuse something in TSC or its dependencies.

I don't know is there anything we could do to "fix" this.

I actually suspect that we're looking at a bug in SFML. This needs further investigation (minimal reproducing example with just SFML). We're currently bound with the release work for 2.1.0, thus I think it's not something we should cater for now. It's an edge case anyway -- playing in full-screen mode does not exhibit this problem, does it?

We should probably make a release note of this if we leave it as is in release.

I agree. I'll write something up.

Thank you Xet7 for troubleshooting this!

Definitely, now we have something to work with. Thanks!

@Quintus
Copy link
Member

Quintus commented Dec 24, 2019

I actually suspect that we're looking at a bug in SFML.

Or in CEGUI. In which case we'd need a minimal reproducing example with just CEGUI.

@xet7
Copy link
Member

xet7 commented Dec 24, 2019

Some additional findings and details:

Having this bug requires:

  1. Having host OS that has desktop resolution of 1440x900 (well, I'm running Ubuntu Mate host and Ubuntu Mate quest).
  2. Running VirtualBox VM.
  3. Ubuntu Mate 18.04 with desktop resolution of 1360x768 or smaller.
  4. TSC in window mode, where TSC itself is 1024x786 plus above it TSC window titlebar, so it does not fit on screen.

There is now these workarounds for VirtualBox:

  1. Changing TSC to run on fullscreen. This works nicely with default 1024x786 resolution.
  2. Changing TSC window resolution to 640x480, so it fits on screen.
  3. Changing VirtualBox VM to display Ubuntu Mate at fullscreen, and Ubuntu Mate desktop resolution to 1440x900 so then TSC window fits nicely.
  4. Default Mate traditional desktop layout has top and bottom bars, so you could also change layout to Redmond to have only one bar, and change that bar to be at left, so you have full height for TSC window. It depends on available resolutions, for me this change was not enough in itself.

@xet7
Copy link
Member

xet7 commented Dec 24, 2019

@sydneyjd You don't need to mail DVD's etc, because here below is info how to duplicate this bug on any OS, without VirtualBox:

  1. Desktop and TSC resolution same 1440x900 (or whatever you have available), TSC running in window. At TSC Options, select resolution and click Apply. This way, TSC does not fit on screen, because it has title bar at top.
  2. To fix this, change TSC to run at fullscreen. All is visible.

On my laptop bare metal, TSC resolution 1024x786 does not work on fullscreen, display is distorted. To play TSC, I need to set both desktop and TSC resolution to be same, to play at fullscreen.

@xet7
Copy link
Member

xet7 commented Dec 24, 2019

Oops, I fixed to above comment, that Linux desktop resolution and TSC resolution needs to be same, and TSC running in window, to duplicate this bug. No VirtualBox necessary.

@xet7
Copy link
Member

xet7 commented Dec 24, 2019

Doh, duplicate bug I mean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants