Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-65598

QScreen::orientationChanged fired for only one screen in multi-screen setup (wrong xcb event monitored?)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.9.3
    • Fix Version/s: None
    • Component/s: QPA: X11/XCB
    • Labels:
      None
    • Commits:
      ee19e15ef7d4c7caeeec56b0a75ddf90c4650119

      Description

      Sample code: 

      #include <QGuiApplication>
      #include <QScreen>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
           QGuiApplication a(argc, argv);
           qDebug() << "Number of screens:" << QGuiApplication::screens().size();
           qDebug() << "Primary screen:" << QGuiApplication::primaryScreen()->name();
           foreach (QScreen *screen, QGuiApplication::screens()) {
               auto name = screen->name();
               qDebug() << "Monitoring screen: " << name;
               screen->setOrientationUpdateMask(Qt::LandscapeOrientation |
                                                Qt::PortraitOrientation |
                                                Qt::InvertedLandscapeOrientation |
                                                Qt::InvertedPortraitOrientation);
               QObject::connect(screen, &QScreen::orientationChanged,
                                [=] (const Qt::ScreenOrientation &newScreenRotation) {
                   qDebug() << "Orientation changed for screen" << name << ":" << newScreenRotation;
               });
           }
      
           return a.exec();
      }
      

      Build, run, and then rotate each screen e.g. with

      $ xrandr --output DVI-D-0 --rotate inverted
      

      Events are fired only for one of the screens (usually primary?)

      Seems to be caused by relying on RRScreenChangeNotify (xcb_randr_screen_change_notify_event_t) in qxcbscreen to monitor rotation changes, which is not mutliscreen-friendly: https://bugs.freedesktop.org/show_bug.cgi?id=104495

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            avolkov Alexander Volkov
            Reporter:
            jazzvoid@gmail.com Valeriy Malov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes