Open dzintars opened 3 years ago
We position the menu using QCursor::pos()
, so there's likely nothing we can do here - it's up to Qt and Wayland to sort it out.
On the landscape (normal) display there is no such issue. But... when recording the portrait mode screen the image is turned by 270* which means... that "portrait mode" is not set/recognized correctly... this means, that context menu is also positioned incorectly. I will try to tinker with it a bit. I think i need somehow to override display size (wild guess).
KDEs Wayland Porting Guideline which was already linked in #5043 explicitly states that QCursor::pos() should not be used to position context menus. The provided alternative (see below) is to use the globalPos()
function on the QContextMenuEvent
instead.
void SomeWidget::contextMenuEvent(QContextMenuEvent* event)
{
auto menu = new QMenu(this);
// Wrong. It is unreliable
QAction* action = menu->exec(QCursor::pos());
// Good.
QAction* action = menu->exec(event->globalPos());
}
Improvements are being made on the Qt side: https://bugreports.qt.io/browse/QTBUG-99618
Just FYI for others coming to this issue, its not just for tiling WM's, I see this behaviour with default WM on Ubuntu 22.04 as well, note in the screenshot below the screenshot ends at the bottom of the actual screen, so the menu is getting clipped. I note that this only happens when I have scaling applied (eg. 200%), when I reset scaling back to 100%, the menu is displayed as expected.
Operating System Info
Other
Other OS
Fedora 34
OBS Studio Version
27.1.3
OBS Studio Version (Other)
No response
OBS Studio Log URL
https://obsproject.com/logs/dgMTPu_SLy5OCxVr
OBS Studio Crash Log URL
No response
Expected Behavior
As a user i want to see the context menu when adding new source on a Linux Wayland portrait mode display when OBS occupies full display.
Current Behavior
Dual display setup with the OBS opened on portrait mode display (full screen). Capturing primary ultra-wide screen. Fedora 34, Wayland, Sway. When clicked on + "Add Sources" the menu is not visible and goes somewhere outside of the viewport (below the viewport?). Desktop environment is configured and positioned correctly. I tried to illustrate current behavior. In a green border you can see that menu is displayed and positioned correctly, but only if there is "something" below it. Red and green is the same display, just in different layout scenarios. I can't check it on other environment, so it's hard to say is it a Wayland issue, desktop environments issue or other.
Steps to Reproduce
Anything else we should know?
Relevant config in Sway DE
output 'Dell Inc. DELL U2312HM 59DJP1AQFPQL' pos 2560 0 transform 270