godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.81k stars 20.14k forks source link

Popup menus are not positioned properly (Linux GNOME) #85008

Open limbonaut opened 10 months ago

limbonaut commented 10 months ago

Godot version

4.2-rc [ad72de508]

System information

Manjaro Linux, X11 (X.Org), Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Laptop GPU () - 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz (16 Threads)

Issue description

When created close to the screen's edge, popup menus are cut off intead of being properly positioned (GNOME 45, Manjaro Linux). This happens while Single Window Mode is disabled. Didn't test in other Linux Distro + DE combinations. I can reproduce it in 4.0.2 and 4.1.3.

menu-cutoff-1 menu-cutoff-2

Workarounds

a) Use Single Window Mode (enabled in Editor Settings). b) Use nvidia_drm.modeset=1 kernel option.

Steps to reproduce

  1. Build & run the latest Godot 4.2-rc on the GNOME v45 desktop.
  2. Right-click on a property in the Inspector close to the screen's edge.

Minimal reproduction project

N/A

Calinou commented 10 months ago

Try enabling Single Window Mode in the Editor Settings and see if this resolves the issue.

Also, can you reproduce this in 4.1.3?

limbonaut commented 10 months ago

@Calinou I use X.Org, didn't test with Wayland. Single Window Mode helps the issue, thanks, but we loose the floating windows functionality. It's a workaround if you don't need those. I'll add it into the OP.

limbonaut commented 10 months ago

@Calinou I can reproduce it in 4.0.2 and 4.1.3.

Sauermann commented 10 months ago

I am unable to replicate this problem on Debian X11 Xfce with v4.2.beta.custom_build [c455cb655] when using only Godot builtin nodes. Does this happen only for your BTPlayer node or also for standard nodes?

limbonaut commented 10 months ago

@Sauermann On builtin node properties too. Happens also on official builds version 4.1.3 and 4.0.2. It only breaks when Single Window Mode is disabled.

Calinou commented 9 months ago

I can't reproduce this on 4.2.beta da0b1eb12 (Fedora 39, KDE Plasma 5.27.9). Even if I resize the window to a tiny size (using KDE window overrides to disable Godot's minimum size) and spawn a context menu while the window is on the right edge of the screen, the context menu is positioned correctly:

image

limbonaut commented 9 months ago

I finally figured it out! So I found out that it only happens with Linux kernel 6.5 and 6.6 (Intel+NVIDIA laptop with X11) and is somehow related to simpledrm driver. I can't reproduce it on kernel 6.1. When this bug happens, I also have the following weird thing - when I run xrandr my output shows a ghost monitor device None-1-1:

> xrandr
Screen 0: minimum 8 x 8, current 3840 x 1080, maximum 32767 x 32767
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
HDMI-0 disconnected (normal left inverted right x axis y axis)
DP-4 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
   1920x1080    165.00*+
None-1-1 connected (normal left inverted right x axis y axis)
   1920x1080     60.00 +

To fix it, I added this kernel option to /etc/default/grub:

# /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="nvidia_drm.modeset=1"

Then I ran update-grub and rebooted. Enabling nvidia_drm.modeset disables simpledrm. Both ghost device and the popup menus in Godot stopped being an issue for me, at least for now.

Calinou commented 9 months ago

I doubt we can do about anything if there's no way to detect this "ghost" monitor from Godot. It's also a system configuration issue that will negatively affect other applications anyway, so it's better to fix it on your end.

limbonaut commented 9 months ago

Thing is, it doesn't affect other applications. GTK apps, Qt apps and their popup menus work as expected in these conditions. But I'm not saying it should be fixed. Likely, it is an issue with the nvidia drivers and/or kernel. I'm not sure how many nvidia users are actually affected by this. I only found a thread on Arch forums: https://bbs.archlinux.org/viewtopic.php?id=288009