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

submenu shows up far from parent on Wayland #24230

Closed
lilydjwg opened this issue Mar 22, 2022 · 26 comments
Closed

submenu shows up far from parent on Wayland #24230

lilydjwg opened this issue Mar 22, 2022 · 26 comments

Comments

@lilydjwg
Copy link

Steps to reproduce

  1. maximize telegram
  2. right click on the message input
  3. choose to change text format

Expected behaviour

The submenu is shown near the parent entry.

Actual behaviour

See screenshot:

screenshot-2022-03-22_12:42:18

PS: I tried with the static binary from official site, the menu even doesn't pop up. If it were not maximized, and moved near the bottom of screen instead, this issue would also occur.

Operating system

Arch Linux, wayfire

Version of Telegram Desktop

3.6.1

Installation source

Other (unofficial) source

Logs

No response

@lilydjwg lilydjwg added the bug label Mar 22, 2022
@Aokromes
Copy link
Collaborator

plz try downloading official version from https://desktop.telegram.org

@lilydjwg
Copy link
Author

lilydjwg commented Mar 22, 2022

Did you read my report? I tried; it was worse.

To be precise,with the official build, you need to move the window very close to screen bottom, and resize the window relatively large to make this issue significant.

@ilya-fedin
Copy link
Contributor

Would be nice to get some help with this. I don't understand how to make menus work as expected on Wayland since there's no way to get window position.

@lilydjwg
Copy link
Author

I don't understand how to make menus work as expected on Wayland since there's no way to get window position.

I don't know about Qt, but in Wayland protocol, you specify the position of a popup relative to its parent, and in case of reaching edges, what should be done (sliding or flipping etc), via the xdg_positioner interface. GTK 3 has similar APIs to position a popup.

@ilya-fedin
Copy link
Contributor

Qt doesn't have such APIs, it has pre-defined xdg-positioner flags for all windows of type Qt::Popup (what menus are). We need xdg_positioner::set_offset I guess in order to set shadow extents, but we have no access to that API.

@lilydjwg
Copy link
Author

Sad 😢

@github-actions
Copy link

Hey there!

This issue was inactive for a long time and will be automatically closed in 30 days if there isn't any further activity. We therefore assume that the user has lost interest or resolved the problem on their own.

Don't worry though; if this is an error, let us know with a comment and we'll be happy to reopen the issue.

Thanks!

@github-actions github-actions bot added the stale label Sep 19, 2022
@lilydjwg
Copy link
Author

No, I'm still interested this issue to be resolved. Inactivity only means that nothing could be done currently but the problem doesn't disappear on its own.

There should be some way to keep inactive issues open if stalebot is enabled.

@ilya-fedin
Copy link
Contributor

but the problem doesn't disappear on its own.

Are you sure? My experience tells they do. Can you re-check?

@lilydjwg
Copy link
Author

I just tried version 4.1.1 official build, it still misaligns, not as high as the above screenshot though.

@ilya-fedin
Copy link
Contributor

Can you check 4.2.0? It uses newer Qt

@lilydjwg
Copy link
Author

It got updated again? I'll update and see soon.

@lilydjwg
Copy link
Author

Same with 4.2.0:

图片

I have another build with Arch's Qt6 and it has exactly the same issue too.

@ilya-fedin
Copy link
Contributor

This seems to be the best thing Qt can do with its design...

@lilydjwg
Copy link
Author

lilydjwg commented Sep 19, 2022

I just notice that there is a warning message from Qt:

qt.qpa.wayland: setGrabPopup called with a parent, QtWaylandClient::QWaylandXdgSurface(0x7f70967fcf60) which does not match the current topmost grabbing popup, QtWaylandClient::QWaylandXdgSurface(0x7f704a3f23a0) According to the xdg-shell protocol, this is not allowed. The wayland QPA plugin is currently handling it by setting the parent to the topmost grabbing popup. Note, however, that this may cause positioning errors and popups closing unxpectedly because xdg-shell mandate that child popups close before parents

I don't know what it means but it may help?

@ilya-fedin
Copy link
Contributor

This is about some Wayland's weird thing with strict hierarchy that tdesktop can't obviously follow due to being a cross-platform application, it seems Qt does a good job here by guessing and automatically changing the parents

@Aokromes
Copy link
Collaborator

No, I'm still interested this issue to be resolved. Inactivity only means that nothing could be done currently but the problem doesn't disappear on its own.

There should be some way to keep inactive issues open if stalebot is enabled.

slatebot helps us to find fixes issues witch their issues aren't linked on fix and closed on fix time.

@ilya-fedin
Copy link
Contributor

ilya-fedin commented Sep 19, 2022

Or which are fixed on their own due to reporter's environment changes or third-party libraries changes

@ilya-fedin
Copy link
Contributor

This issue is now a part of #25126

@lilydjwg
Copy link
Author

Things get worse with 4.2 with context menus on messages affected: they may appear high above the click position when the message is too below, but when I hover below the menu, items on the menu actually get highlighted, i.e. when I click empty space below the menu, trying to dismiss the menu, an item is activated instead.

The highlighted item issue has been around but this time, the menu shifts above, leaving a lot of space to accidentally trigger it.

Tested on both official build and a build with Qt6.

@ilya-fedin
Copy link
Contributor

It's due to reactions I guess, the top-left point of the menu window is where the reaction bubble (way upper than the cursor), so it becomes new bottom(-right) point. I have no idea how to fix that.

@jeanas
Copy link

jeanas commented Feb 27, 2023

In case it helps anyone, we saw weird things like this in the Frescobaldi (frescobaldi/frescobaldi#1462) and it was caused by submenus not being owned by their parent menu.

(NB I'm a random lurker, I just stumbled upon this issue while searching the net for the warning message.)

@jeanas
Copy link

jeanas commented Feb 27, 2023

@ilya-fedin
Copy link
Contributor

I don't believe the problem is in the parents in tdesktop case, but you're free to prove that

@ilya-fedin
Copy link
Contributor

QTBUG-87303 just got a follow-up commit that changes constraint strategy on Wayland, so this can become unreproducible in Qt 6.5.0-beta4

@lilydjwg
Copy link
Author

It's fixed in Qt 6.5, thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants