debian tray doesn't close Qmenu properly
-
There is odd behavior in debian when I close context menu by clicking on desktop but not with Esc key
I expect menu will open next time I click right button on tray, but it only hides notification areaI made logs to catch all possible mouse activities and disovered that this code in qsystemtrayicon_x11.cpp does not emit QSystemTrayIcon::Context in case when popup was hiden by clicking on desktop
void QSystemTrayIconSys::mousePressEvent(QMouseEvent *ev) { QPoint globalPos = ev->globalPos(); #ifndef QT_NO_CONTEXTMENU if (ev->button() == Qt::RightButton && q->contextMenu()) q->contextMenu()->popup(globalPos); #else Q_UNUSED(globalPos) #endif // QT_NO_CONTEXTMENU if (QBalloonTip::isBalloonVisible()) { emit q->messageClicked(); QBalloonTip::hideBalloon(); } if (ev->button() == Qt::LeftButton) emit q->activated(QSystemTrayIcon::Trigger); else if (ev->button() == Qt::RightButton) emit q->activated(QSystemTrayIcon::Context); else if (ev->button() == Qt::MidButton) emit q->activated(QSystemTrayIcon::MiddleClick); }
there is no problem in any other desktop environments unless it is gnome shell ( in my case 3.14 ) with notification area
-
Hi,
Which version of Debian is it ? Are you using the Qt version that comes with the distribution ?
-
(... continues from @SGaist's ...)
Which window manager and desktop environment? -
Continuing investigation
I made watcher to check events from QSystemTrayIconSys and as I can see the Tray does not produce any when I click right button second time.
So it works half the time as I said early.
I have to note that it doesn't produce a bunch of events as it happens in other distros, only 3 at one clickQEvent::Type(MouseMove) QEvent::Type(MouseButtonPress) QEvent::Type(ContextMenu)
Next time I click tray none of them appear in my log
I checked how this code works on Mint ( or whatever except debian ) and there are a huge number of events whenever I click or just hover the area of tray iconTo get a pointer on QSystemTrayIconSys and set up filter on it
#include <QtWidgets/private/qsystemtrayicon_p.h> class MyTray : public QSystemTrayIcon { MyTray(){} public: QSystemTrayIconPrivate* d() { return reinterpret_cast<QSystemTrayIconPrivate *>(qGetPtrHelper(d_ptr)); } }; inline QSystemTrayIconPrivate* p_tray_ptr(QSystemTrayIcon* t) { return static_cast<MyTray*>(t)->d(); }
QSystemTrayIconPrivate* trr = p_tray_ptr( trayIcon ); if ( trr ) { QSystemTrayIconSys * s = trr->sys; if ( s ) reinterpret_cast<QWidget*>(s)->installEventFilter( this ); }
and the filter itself
bool Window::eventFilter(QObject *watched, QEvent *event) { if ( watched != reinterpret_cast<QWidget*>(p_tray_ptr( trayIcon )->sys) ) return false; qDebug() << event->type(); return false; }
So the question is what blocks those operation above tray in debian.
-
Are you using the same desktop environment with each distribution your tried ?
-
@SGaist said in debian tray doesn't close Qmenu properly:
Are you using the same desktop environment with each distribution your tried ?
Nope. Mint - MATE; Astra - Fly DE; debian - gnome;
-
Then it starts to get pretty hard to find whether it's a Gnome specific bug or a Debian + Gnome specific bug or a xcb backend problem.
-
I have reported it to bugreprot.qt
https://bugreports.qt.io/browse/QTBUG-62329 -
Thanks for the link