Bug 480240

Summary: Use of QMenu widgets result in `layershellqt: Cannot attach popup of unknown type`
Product: [Frameworks and Libraries] layer-shell-qt Reporter: Grigory <txgk>
Component: generalAssignee: Aleix Pol <aleixpol>
Status: REPORTED ---    
Severity: normal CC: demi, nicolas.fella, txgk
Priority: NOR Keywords: qt6
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Screenshot of fullscreen menu

Description Grigory 2024-01-23 18:45:46 UTC
Created attachment 165165 [details]
Screenshot of fullscreen menu

SUMMARY

When using layer-shell-qt in application which uses QMenu widgets, warning "layershellqt: Cannot attach popup of unknown type" is written on menu activation. I assume it occurs in QWaylandLayerSurface::attachPopup(QtWaylandClient::QWaylandShellSurface *popup) method.

The bad thing about it is that menus break, actually. Without layer-shell-qt they work perfectly fine and only when I call LayerShellQt::Shell::useLayerShell() they go fullscreen and hard to navigate.

STEPS TO REPRODUCE

1. Integrate layer-shell-qt into project
2. Create any QMenu

OBSERVED RESULT

Menu goes fullscreen.

EXPECTED RESULT

Menu stays normal, as in Qt without layer-shell-qt enabled.

SOFTWARE/OS VERSIONS
Linux: 6.6.11 
Qt Version: 6.6.0

ADDITIONAL INFORMATION

Screenshot of fullscreen menu attached.
Comment 1 Grigory 2024-01-23 18:50:39 UTC
Example code:

https://codeberg.org/stolick/stolick

You don't have to edit anything, I committed problematic code in master branch.
Comment 2 Nicolas Fella 2024-03-08 11:39:02 UTC
Are you building with clang? This sounds like https://bugs.kde.org/show_bug.cgi?id=479679
Comment 3 Grigory 2024-03-08 12:20:29 UTC
(In reply to Nicolas Fella from comment #2)
> Are you building with clang? This sounds like
> https://bugs.kde.org/show_bug.cgi?id=479679

Hi, Nicolas! Thank you for a reply :)

I just tried to build with clang like that:

export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
cmake -B build
cmake --build build

CMake said that it's using clang and it built successfully but the bug persists. I still get "layershellqt: Cannot attach popup of unknown type" message and QMenu objects continue to go fullscreen. In case you want to test this code with my example and layer-shell-qt module enabled you have to build against https://codeberg.org/stolick/stolick/commit/5c70e291d4ee4a07b2bfb388a3fce2f926994c13 commit (named "use broken layer-shell-qt for a while").

Best regards, Grigory.
Comment 4 Demi Marie Obenour 2024-12-01 18:16:30 UTC
(In reply to Grigory from comment #3)
> (In reply to Nicolas Fella from comment #2)
> > Are you building with clang? This sounds like
> > https://bugs.kde.org/show_bug.cgi?id=479679
> 
> Hi, Nicolas! Thank you for a reply :)
> 
> I just tried to build with clang like that:
> 
> export CC=/usr/bin/clang
> export CXX=/usr/bin/clang++
> cmake -B build
> cmake --build build
> 
> CMake said that it's using clang and it built successfully but the bug
> persists.

Does your clang use libc++ or libstdc++?  The former will trip this bug.