It seems that GTK menus do set the override_redirect flag on their windows, so I’m not sure if it can be avoided for this kind of windows.
As a temporary fix, I’m adding the override_redirect flag in createWindow when the window is created with alwaysontop and windowIsTemporary (in the old version , it was set for all windows with ‘isAlwaysOnTop’):
swa.override_redirect = (getComponent()->isAlwaysOnTop() && (styleFlags & windowIsTemporary)) ? True : False;
swa.event_mask = getAllEventsMask();
windowH = XCreateWindow (display, parentToAddTo != 0 ? parentToAddTo : root,
0, 0, 1, 1,
0, depth, InputOutput, visual,
CWBorderPixel | CWColormap | CWBackPixmap | CWEventMask | CWOverrideRedirect /* CHANGED */,
It seems to works fine for both menus and tooltip windows, except when sub-menus are involved, in which case the focus seems to go back and forth between the menu and the main window.