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

Windows disappear when changing monitors using xrandr

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.3.2
    • None
    • Debian 8 with xinit and the i3 window manager

    Description

      I have two monitors, and I have two scripts that uses xrandr to switch back and forth between the two monitors.

      monitor-layout-gamemode.sh
      #!/usr/bin/env bash
      
      xrandr \
          --output "DVI-D-0" --mode "1920x1080" --rate "144.00" --primary \
          --output "DP-1" --off \
          --output "HDMI-0" --off
      
      monitor-layout-default.sh
      #!/usr/bin/env bash
      
      xrandr \
          --output "DP-1" --mode "3840x2160" --rate "60" --primary \
          --output "HDMI-0" --off \
          --output "DVI-D-0" --off
      

      I also have two applications that uses Qt 5, namely Viber and TeamSpeak 3.

      Whenever I use one of my scripts to change the monitor layout, both these applications disappear. Their processes are still running, but their windows and system tray icons disappear.

      I also have an application that uses Qt 4 (Spotify), and that application does not disappear when I change the monitor layout. In other words, it looks like this bug only affects Qt 5, and not Qt 4.

      The console output from TeamSpeak 3 when I change the monitor layout looks like this:

      requestSystemTrayWindowDock failed.
      requestSystemTrayWindowDock failed.
      requestSystemTrayWindowDock failed.
      requestSystemTrayWindowDock failed.
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x1e90b60, name = "QSystemTrayIconSysWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      requestSystemTrayWindowDock failed.
      requestSystemTrayWindowDock failed.
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      QBackingStore::flush() called for  QWidgetWindow(0x2014140, name = "MainWindowClassWindow")  which does not have a handle. 
      

      And it keeps outputting the same last line about 50 times per second until I kill the application. The Viber executable produces no text output.

      Workaround

      I can split my xrandr command into two commands, one where the new monitor is enabled and one where all other monitors are disabled:

      monitor-layout-gamemode.sh
      #!/usr/bin/env bash
      
      xrandr \
          --output "DVI-D-0" --mode "1920x1080" --rate "144.00" --primary
      
      xrandr \
          --output "DP-1" --off \
          --output "HDMI-0" --off
      

      Now the Qt 5 windows no longer die and disappear, but they are curiously moved to my first workspace, rather than staying in their original positions like all my other windows do.

      How to reproduce

      1. Prepare 2 monitors
      2. Enable one of the monitors, and disable the other one
      3. Start some Qt 5 applications
      4. Switch monitors in a single xrandr command, for example:
        xrandr --output DP-1 --off --output DVI-D-0 --mode 1920x1080
      5. The Qt 5 windows should now have disappeared

      Environment details

      $ uname -a
      Linux bonus-debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt9-3~deb8u1 (2015-04-24) x86_64 GNU/Linux
      
      $ lsb_release -a
      LSB Version:	core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch:core-4.1-amd64:core-4.1-noarch
      Distributor ID:	Debian
      Description:	Debian GNU/Linux 8.0 (jessie)
      Release:	8.0
      Codename:	jessie
      
      $ dpkg -l | grep i3 | grep "window manager"
      ii  i3                                                          4.8-2                               amd64        metapackage (i3 window manager, screen locker, menu, statusbar)
      ii  i3-wm                                                       4.8-2                               amd64        improved dynamic tiling window manager
      
      $ dpkg -l | grep -i libqt
      ii  libqt4-dbus:amd64                                           4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 D-Bus module
      ii  libqt4-dbus:i386                                            4:4.8.6+git64-g5dc8b2b+dfsg-3       i386         Qt 4 D-Bus module
      ii  libqt4-declarative:amd64                                    4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 Declarative module
      ii  libqt4-designer:amd64                                       4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 designer module
      ii  libqt4-dev                                                  4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 development files
      ii  libqt4-dev-bin                                              4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 development programs
      ii  libqt4-help:amd64                                           4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 help module
      ii  libqt4-network:amd64                                        4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 network module
      ii  libqt4-network:i386                                         4:4.8.6+git64-g5dc8b2b+dfsg-3       i386         Qt 4 network module
      ii  libqt4-opengl:amd64                                         4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 OpenGL module
      ii  libqt4-opengl:i386                                          4:4.8.6+git64-g5dc8b2b+dfsg-3       i386         Qt 4 OpenGL module
      ii  libqt4-opengl-dev                                           4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 OpenGL library development files
      ii  libqt4-qt3support:amd64                                     4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 3 compatibility library for Qt 4
      ii  libqt4-script:amd64                                         4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 script module
      ii  libqt4-scripttools:amd64                                    4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 script tools module
      ii  libqt4-sql:amd64                                            4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 SQL module
      ii  libqt4-sql-mysql:amd64                                      4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 MySQL database driver
      ii  libqt4-sql-sqlite:amd64                                     4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 SQLite 3 database driver
      ii  libqt4-svg:amd64                                            4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 SVG module
      ii  libqt4-test:amd64                                           4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 test module
      ii  libqt4-xml:amd64                                            4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 XML module
      ii  libqt4-xml:i386                                             4:4.8.6+git64-g5dc8b2b+dfsg-3       i386         Qt 4 XML module
      ii  libqt4-xmlpatterns:amd64                                    4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 XML patterns module
      ii  libqt4-xmlpatterns:i386                                     4:4.8.6+git64-g5dc8b2b+dfsg-3       i386         Qt 4 XML patterns module
      ii  libqt5core5a:amd64                                          5.3.2+dfsg-4+b1                     amd64        Qt 5 core module
      ii  libqt5dbus5:amd64                                           5.3.2+dfsg-4+b1                     amd64        Qt 5 D-Bus module
      ii  libqt5gui5:amd64                                            5.3.2+dfsg-4+b1                     amd64        Qt 5 GUI module
      ii  libqt5network5:amd64                                        5.3.2+dfsg-4+b1                     amd64        Qt 5 network module
      ii  libqt5printsupport5:amd64                                   5.3.2+dfsg-4+b1                     amd64        Qt 5 print support module
      ii  libqt5test5:amd64                                           5.3.2+dfsg-4+b1                     amd64        Qt 5 test module
      ii  libqt5widgets5:amd64                                        5.3.2+dfsg-4+b1                     amd64        Qt 5 widgets module
      ii  libqtassistantclient4:amd64                                 4.6.3-6                             amd64        Qt Assistant client library (runtime)
      ii  libqtcore4:amd64                                            4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 core module
      ii  libqtcore4:i386                                             4:4.8.6+git64-g5dc8b2b+dfsg-3       i386         Qt 4 core module
      ii  libqtdbus4:amd64                                            4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 D-Bus module library
      ii  libqtdbus4:i386                                             4:4.8.6+git64-g5dc8b2b+dfsg-3       i386         Qt 4 D-Bus module library
      ii  libqtgui4:amd64                                             4:4.8.6+git64-g5dc8b2b+dfsg-3       amd64        Qt 4 GUI module
      ii  libqtgui4:i386                                              4:4.8.6+git64-g5dc8b2b+dfsg-3       i386         Qt 4 GUI module
      ii  libqtwebkit-dev                                             2.3.4.dfsg-3                        amd64        Web content engine library for Qt - development files
      ii  libqtwebkit4:amd64                                          2.3.4.dfsg-3                        amd64        Web content engine library for Qt
      ii  libqtwebkit4:i386                                           2.3.4.dfsg-3                        i386         Web content engine library for Qt
      

      Attachments

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

        Activity

          People

            srutledg Shawn Rutledge
            Hubro Tomas Sandven
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes