When appmenu is too large to fit in and "»" button instead of overflowing.
There is a change to C++ backend -- button indexes -10 and lower mean a drop down menu which contains some suffix of menubar items -- -10 contains them all, -11 all without first one and so on.
The tricky part is to determine which items to hide -- current approach is to draw all at first and then iterate through them and hide ones too much on right (fixOverflow function). Property effectiveWidth calculates how much space we can use and is only correct when buttons are on right and should not be overlapped by the menu. (Should be resolved after D11071: [RFC] [Active Window Control] Allow global menu be left alligned with buttons on right.)
If the backend changes and hiding logic are considered sane, it might be worth porting to Global Menu applet (there the computation of available space would be much simplier).
This patch was only tested on top of D11071: [RFC] [Active Window Control] Allow global menu be left alligned with buttons on right.