Bug 466092

Summary: Context menu in firefox is one pixel too small and becomes scrollable
Product: [Plasma] kwin Reporter: Alessandro Astone <ales.astone>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: normal CC: bugseforuns
Priority: NOR    
Version First Reported In: 5.27.0   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Context menu scrollable

Description Alessandro Astone 2023-02-19 15:21:32 UTC
Created attachment 156496 [details]
Context menu scrollable

SUMMARY
In wayland, when right clicking firefox's titlebar with the cursor positioned at the very top pixel row of the screen, the context menu is 1 (maybe more?) pixel too small, causing it to be scrollable.
If this was the first time you open the context menu after launching firefox, it is instead only big enough for 3 entries.

STEPS TO REPRODUCE
1. Disable kwin's titlebar in firefox: Customize toolbar > untick 'Title bar'
2. Maximize firefox
3. Move cursor to the top edge of the screen
4. Right click

OBSERVED RESULT
[See attachment]
The last entry in the context menu is chopped off and a "scroll down" arrow is shown

EXPECTED RESULT
The context menu is made big enough to not need scrolling, just like it opens when the cursor is not exactly at the top screen edge

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Fedora 37 KDE
(available in About System)
KDE Plasma Version: 5.27.0
KDE Frameworks Version: 5.103
Qt Version: 5.15.8

ADDITIONAL INFORMATION
Display scaling, fractional or not, does not make a difference.
Comment 1 Patrick Silva 2023-02-19 16:44:18 UTC
Can reproduce on Arch Linux running Plasma 5.27.
Comment 2 Vlad Zahorodnii 2023-02-20 08:23:02 UTC
[ 721308.925]  -> xdg_wm_base@31.create_positioner(new id xdg_positioner@64)
[ 721308.929]  -> xdg_positioner@64.set_size(191, 114)
[ 721308.931]  -> xdg_positioner@64.set_anchor_rect(1310, 0, 1, 1)
[ 721308.933]  -> xdg_positioner@64.set_offset(-2, -2)
[ 721308.937]  -> xdg_positioner@64.set_anchor(8)
[ 721308.939]  -> xdg_positioner@64.set_gravity(8)
[ 721308.941]  -> xdg_positioner@64.set_constraint_adjustment(61)
[ 721308.943]  -> xdg_wm_base@31.get_xdg_surface(new id xdg_surface@82, wl_surface@71)
[ 721308.946]  -> xdg_surface@82.get_popup(new id xdg_popup@85, xdg_surface@49, xdg_positioner@64)
[ 721308.957]  -> xdg_positioner@64.destroy()
[ 721308.959]  -> wl_surface@71.commit()
[ 721316.492]  -> wl_compositor@44.create_region(new id wl_region@86)
[ 721316.512]  -> wl_surface@83.set_input_region(wl_region@86)
[ 721316.517]  -> wl_region@86.destroy()
[ 721316.581]  -> wl_compositor@44.create_region(new id wl_region@87)
[ 721316.588]  -> wl_region@87.add(0, 0, 1920, 1037)
[ 721316.592]  -> wl_surface@53.set_opaque_region(wl_region@87)
[ 721316.594]  -> wl_region@87.destroy()
[ 721316.608]  -> wl_surface@53.commit()
[ 721316.799] wl_display@1.delete_id(79)
[ 721316.807] wl_display@1.delete_id(64)
[ 721316.809] wl_display@1.delete_id(86)
[ 721316.811] xdg_popup@85.configure(1309, 0, 191, 113)

Firefox asks to show a popup with size (191, 114), but it also sets a strange offset (-2, -2), which makes the popup show 1 pixel offscreen. The flip constrainment adjustment fails to get the window in the work area, so kwin moves to the next specified constraint adjustment - resize. It resizes (takes off one pixel) the popup until it fits inside the work area.

Not a kwin bug, please report this issue to firefox developers.