Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. debian tray doesn't close Qmenu properly

debian tray doesn't close Qmenu properly

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 3 Posters 2.3k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Paul Busovikov
    wrote on last edited by
    #1

    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 area

    I 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

    kshegunovK 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Which version of Debian is it ? Are you using the Qt version that comes with the distribution ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      P 1 Reply Last reply
      0
      • P Paul Busovikov

        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 area

        I 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

        kshegunovK Offline
        kshegunovK Offline
        kshegunov
        Moderators
        wrote on last edited by
        #3

        (... continues from @SGaist's ...)
        Which window manager and desktop environment?

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          Which version of Debian is it ? Are you using the Qt version that comes with the distribution ?

          P Offline
          P Offline
          Paul Busovikov
          wrote on last edited by
          #4

          @SGaist debian 8 gnome shell 3.14
          project is duilt on sandbox debian 7 with Qt 5.8

          1 Reply Last reply
          0
          • P Offline
            P Offline
            Paul Busovikov
            wrote on last edited by
            #5

            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 click

            QEvent::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 icon

            To 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.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Are you using the same desktop environment with each distribution your tried ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              P 1 Reply Last reply
              0
              • SGaistS SGaist

                Are you using the same desktop environment with each distribution your tried ?

                P Offline
                P Offline
                Paul Busovikov
                wrote on last edited by
                #7

                @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;

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  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.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  P 1 Reply Last reply
                  1
                  • SGaistS SGaist

                    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.

                    P Offline
                    P Offline
                    Paul Busovikov
                    wrote on last edited by
                    #9

                    @SGaist also I checked it on debian 9 gnome 3.22.2 and there is same problem

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      Paul Busovikov
                      wrote on last edited by
                      #10

                      I have reported it to bugreprot.qt
                      https://bugreports.qt.io/browse/QTBUG-62329

                      1 Reply Last reply
                      1
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        Thanks for the link

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        1

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved