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

DisplayServer: Context menu wrong offset in code editor with single-window mode off #47217

Closed
jmb462 opened this issue Mar 21, 2021 · 8 comments · Fixed by #52280
Closed

DisplayServer: Context menu wrong offset in code editor with single-window mode off #47217

jmb462 opened this issue Mar 21, 2021 · 8 comments · Fixed by #52280

Comments

@jmb462
Copy link
Contributor

jmb462 commented Mar 21, 2021

Godot version:
4.0 master branch 07f076f

OS/device including version:
Windows 10
Ubuntu 20.04.2 LTS

Issue description:
In code editor, the context menu that pops on right mouse click doesn't appear at the cursor position.

It's not only an esthetic issue because the mouse is already on the first item when it pops so this item can be chosen by mistake on just releasing the right mouse button.

That doesn't occurs with context menu in scene tree or file tree.

Doesn't seem to be linked to other issues where popup are far away from normal position until window is resized.

Edit : Only occurs with Single Window mode activated.

What happens :

pop1

What is expected :

pop2

I've investigate on this issue and it seems that the mouse coordinates used for Popup creation are correct.
I've try to replace the current contextmenu with a basic popup with one item only (without icon or shortcut) and the problem is the same.

Steps to reproduce:

Right click on code editor.
Popup offset is wrong.

Minimal reproduction project:
Any project with a script in editor.

@Calinou Calinou added this to the 4.0 milestone Mar 21, 2021
@Calinou Calinou changed the title Context menu wrong offset in code editor DisplayServer: Context menu wrong offset in code editor Mar 21, 2021
@Calinou
Copy link
Member

Calinou commented Mar 21, 2021

Can you reproduce this after enabling single-window mode in the Editor Settings then restarting the editor?

@jmb462
Copy link
Contributor Author

jmb462 commented Mar 21, 2021

No, with single windows mode, the popup is at the right place.

@jmb462 jmb462 changed the title DisplayServer: Context menu wrong offset in code editor DisplayServer: Context menu wrong offset in code editor with single-window mode off Mar 21, 2021
@jmb462
Copy link
Contributor Author

jmb462 commented Mar 22, 2021

In not single-windowed mode, the menu pops up at the global screen coordinates without taking into account the fact that the editor window may not be at 0,0.

I've got my windows tasks bar at the left of my screen, and it's why I get the bad offset in x coordinate.
The title bar of the editor seems to be responsible of the y bad offset.

When the editor is not maximized, and the editor windows is moved into the screen, the bad offset clearly show that it's linked to editor window position in the screen.

bad offset

In that case, we need to add the editor window offset to the popup offset to correct the issue.
Can't figure where it could be in the source code.

@DarioDaF
Copy link

Reproduced also in full screen straight from opening on Godot Engine v4.0.dev.custom_build.364ea7f28 (current master at time of writing)
image
But it happens only on first open of the window at fullscreen (if I resize the windows it never happens again)

Computer W10 x64 on screen with 125% scale 1080p (and second monitor on the left at 100%), cannot reproduce with only one screen.

@KoBeWi
Copy link
Member

KoBeWi commented Aug 31, 2021

Looks like duplicate of #45740 (except the Linux part) Nevermind...

@jmb462
Copy link
Contributor Author

jmb462 commented Aug 31, 2021

@KoBeWi Not really I think.
The bug in #45740 comes at startup only and disappear when resizing windows.

This offset bug in the present issue only depends on window position and do not disappear on resize.

Maybe they are related. But I don't think it's a duplicate.

@Anutrix
Copy link
Contributor

Anutrix commented Oct 16, 2021

Just a note which might be unrelated: Faced this issue on first compile on Windows 11 with latest master @c2a616f.
However the click offset was weird and context menu were almost impossible to click with mouse. The menu appeared at the center of screen.
But it got fixed after first restart. Can't reproduce anymore.

@jmb462
Copy link
Contributor Author

jmb462 commented Oct 17, 2021

@Anutrix Seems that you experimented #45740 issue rather than this one I think.
This one is permanent.

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

Successfully merging a pull request may close this issue.

5 participants