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

[wayland] client side decorations broken when QT_SCALE_FACTOR != 1

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.13.0 Alpha 1
    • 5.12.0
    • QPA: Wayland
    • None
    • Arch Linux with qt5-base, qt5-wayland, weston, wayland, gnome-shell installed (+dependencies) and Intel integrated HD Graphics 5300 graphics card running at 1920x1080. Compiled via qmake -> make using g++ 8.2.1 20181127 and Qt 5.12.0.
    • Linux/Wayland
    • d0063d0972b29e9a2d4bdff837e3d4c23ac2e6cc (qt/qtwayland/dev)

    Description

      Setting QT_SCALE_FACTOR environment variable to a value other than 1 breaks the client side decorations under Wayland.

      The content of the widget seems to scale correctly, but the decorations don't, leading to the content "spilling" out of the decorations frame.

      With QT_SCALE_FACTOR=1, the decorations behave as expected:

      This was tested with Qt 5.12.0 on Arch Linux in a fairly clean environment under Weston, as well as under (Wayland) Gnome-Shell with -platform wayland flag.

      The source code [main.cpp] used for testing (also attached):

      #include <Qt>
      #include <QApplication>
      #include <QLabel>
      
      int main(int argc, char **argv)
      {
          QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
          
          QApplication app (argc, argv);
          QLabel label ("weston --scale=1\nQT_SCALE_FACTOR=2");
          label.setWindowTitle("qt_wayland_test");
          
          label.setStyleSheet("border: 1px solid red;");
          
          label.show();
          label.resize(300,200);
          return app.exec();
      }
      

      Project file (also attached):

      TEMPLATE = app
      TARGET = wayland_qt_csd_scale
      QT = core widgets
      SOURCES += main.cpp
      

      Compile and run with:

      cd /path/to/download/folder
      qmake
      make
      WAYLAND_DEBUG=1 QT_SCALE_FACTOR=2 ./wayland_qt_csd_scale -platform wayland
      

      Wayland debug log:

      $ WAYLAND_DEBUG=1 QT_SCALE_FACTOR=2 ./wayland_qt_csd_scale -platform wayland
      
      [2351403.103]  -> wl_display@1.get_registry(new id wl_registry@2)
      [2351403.157]  -> wl_display@1.sync(new id wl_callback@3)
      [2351403.287] wl_display@1.delete_id(3)
      [2351403.313] wl_registry@2.global(1, "wl_drm", 2)
      [2351403.348] wl_registry@2.global(2, "wl_compositor", 4)
      [2351403.369]  -> wl_registry@2.bind(2, "wl_compositor", 3, new id [unknown]@4)
      [2351403.406] wl_registry@2.global(3, "wl_shm", 1)
      [2351403.434]  -> wl_registry@2.bind(3, "wl_shm", 1, new id [unknown]@5)
      [2351403.468] wl_registry@2.global(4, "wl_output", 2)
      [2351403.496]  -> wl_registry@2.bind(4, "wl_output", 2, new id [unknown]@6)
      [2351403.532]  -> wl_display@1.sync(new id wl_callback@7)
      [2351403.549] wl_registry@2.global(5, "zxdg_output_manager_v1", 1)
      [2351403.576]  -> wl_registry@2.bind(5, "zxdg_output_manager_v1", 1, new id [unknown]@8)
      [2351403.612]  -> zxdg_output_manager_v1@8.get_xdg_output(new id zxdg_output_v1@9, wl_output@6)
      [2351403.634]  -> wl_display@1.sync(new id wl_callback@10)
      [2351403.651] wl_registry@2.global(6, "wl_data_device_manager", 3)
      [2351403.678]  -> wl_registry@2.bind(6, "wl_data_device_manager", 1, new id [unknown]@11)
      [2351403.710] wl_registry@2.global(7, "gtk_primary_selection_device_manager", 1)
      [2351403.735] wl_registry@2.global(8, "wl_subcompositor", 1)
      [2351403.756]  -> wl_registry@2.bind(8, "wl_subcompositor", 1, new id [unknown]@12)
      [2351403.786] wl_registry@2.global(9, "xdg_wm_base", 1)
      [2351403.821] wl_registry@2.global(10, "zxdg_shell_v6", 1)
      [2351403.839] wl_registry@2.global(11, "wl_shell", 1)
      [2351403.856] wl_registry@2.global(12, "gtk_shell1", 2)
      [2351403.879] wl_registry@2.global(13, "zwp_pointer_gestures_v1", 1)
      [2351403.906] wl_registry@2.global(14, "zwp_tablet_manager_v2", 1)
      [2351403.932] wl_registry@2.global(15, "wl_seat", 5)
      [2351403.955]  -> wl_registry@2.bind(15, "wl_seat", 4, new id [unknown]@13)
      [2351403.990]  -> wl_data_device_manager@11.get_data_device(new id wl_data_device@14, wl_seat@13)
      [2351404.014] wl_registry@2.global(16, "zwp_relative_pointer_manager_v1", 1)
      [2351404.041] wl_registry@2.global(17, "zwp_pointer_constraints_v1", 1)
      [2351404.068] wl_registry@2.global(18, "zxdg_exporter_v1", 1)
      [2351404.094] wl_registry@2.global(19, "zxdg_importer_v1", 1)
      [2351404.117] wl_registry@2.global(20, "zwp_linux_dmabuf_v1", 3)
      [2351404.138] wl_registry@2.global(21, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
      [2351404.162] wl_registry@2.global(22, "zwp_text_input_manager_v3", 1)
      [2351404.181] wl_registry@2.global(23, "gtk_text_input_manager", 1)
      [2351404.203] wl_callback@3.done(9627)
      [2351404.307] wl_display@1.delete_id(7)
      [2351404.320] wl_display@1.delete_id(10)
      [2351404.331] wl_shm@5.format(0)
      [2351404.346] wl_shm@5.format(1)
      [2351404.360] wl_output@6.geometry(0, 0, 260, 140, 0, "CMN", "0x1137", 0)
      [2351404.414] wl_output@6.mode(3, 1920, 1080, 60001)
      [2351404.441] wl_output@6.scale(1)
      [2351404.450] wl_output@6.done()
      [2351404.461] wl_callback@7.done(9627)
      [2351404.472] zxdg_output_v1@9.logical_position(0, 0)
      [2351404.489] zxdg_output_v1@9.logical_size(1920, 1080)
      [2351404.503] zxdg_output_v1@9.done()
      [2351404.515] wl_callback@10.done(9627)
      [2351404.527] wl_seat@13.capabilities(7)
      [2351404.547]  -> wl_seat@13.get_keyboard(new id wl_keyboard@10)
      [2351404.564]  -> wl_seat@13.get_pointer(new id wl_pointer@7)
      [2351404.582]  -> wl_compositor@4.create_surface(new id wl_surface@3)
      [2351404.598]  -> wl_seat@13.get_touch(new id wl_touch@15)
      [2351404.620] wl_seat@13.name("seat0")
      QSocketNotifier: Can only be used with threads started with QThread
      Using Wayland-EGL
      [2351416.434]  -> wl_display@1.get_registry(new id wl_registry@16)
      [2351416.462]  -> wl_display@1.sync(new id wl_callback@17)
      [2351416.593] wl_display@1.delete_id(17)
      [2351416.606] wl_registry@16.global(1, "wl_drm", 2)
      [2351416.640]  -> wl_registry@16.bind(1, "wl_drm", 2, new id [unknown]@18)
      [2351416.676] wl_registry@16.global(2, "wl_compositor", 4)
      [2351416.701] wl_registry@16.global(3, "wl_shm", 1)
      [2351416.719] wl_registry@16.global(4, "wl_output", 2)
      [2351416.745] wl_registry@16.global(5, "zxdg_output_manager_v1", 1)
      [2351416.770] wl_registry@16.global(6, "wl_data_device_manager", 3)
      [2351416.797] wl_registry@16.global(7, "gtk_primary_selection_device_manager", 1)
      [2351416.817] wl_registry@16.global(8, "wl_subcompositor", 1)
      [2351416.841] wl_registry@16.global(9, "xdg_wm_base", 1)
      [2351416.870] wl_registry@16.global(10, "zxdg_shell_v6", 1)
      [2351416.897] wl_registry@16.global(11, "wl_shell", 1)
      [2351416.922] wl_registry@16.global(12, "gtk_shell1", 2)
      [2351416.947] wl_registry@16.global(13, "zwp_pointer_gestures_v1", 1)
      [2351416.972] wl_registry@16.global(14, "zwp_tablet_manager_v2", 1)
      [2351416.997] wl_registry@16.global(15, "wl_seat", 5)
      [2351417.024] wl_registry@16.global(16, "zwp_relative_pointer_manager_v1", 1)
      [2351417.047] wl_registry@16.global(17, "zwp_pointer_constraints_v1", 1)
      [2351417.071] wl_registry@16.global(18, "zxdg_exporter_v1", 1)
      [2351417.092] wl_registry@16.global(19, "zxdg_importer_v1", 1)
      [2351417.114] wl_registry@16.global(20, "zwp_linux_dmabuf_v1", 3)
      [2351417.152]  -> wl_registry@16.bind(20, "zwp_linux_dmabuf_v1", 3, new id [unknown]@19)
      [2351417.189] wl_registry@16.global(21, "zwp_keyboard_shortcuts_inhibit_manager_v1", 1)
      [2351417.214] wl_registry@16.global(22, "zwp_text_input_manager_v3", 1)
      [2351417.236] wl_registry@16.global(23, "gtk_text_input_manager", 1)
      [2351417.257] wl_callback@17.done(9627)
      [2351417.269]  -> wl_display@1.sync(new id wl_callback@17)
      [2351417.384] wl_display@1.delete_id(17)
      [2351417.396] wl_drm@18.device("/dev/dri/card0")
      [2351417.464]  -> wl_drm@18.authenticate(10)
      [2351417.476] wl_drm@18.format(808669761)
      [2351417.489] wl_drm@18.format(808669784)
      [2351417.503] wl_drm@18.format(875713089)
      [2351417.515] wl_drm@18.format(875713112)
      [2351417.531] wl_drm@18.format(909199186)
      [2351417.542] wl_drm@18.format(961959257)
      [2351417.552] wl_drm@18.format(825316697)
      [2351417.560] wl_drm@18.format(842093913)
      [2351417.575] wl_drm@18.format(909202777)
      [2351417.590] wl_drm@18.format(875713881)
      [2351417.600] wl_drm@18.format(842094158)
      [2351417.614] wl_drm@18.format(909203022)
      [2351417.626] wl_drm@18.format(1448695129)
      [2351417.637] wl_drm@18.capabilities(1)
      [2351417.651] zwp_linux_dmabuf_v1@19.format(875713089)
      [2351417.662] zwp_linux_dmabuf_v1@19.modifier(875713089, 0, 0)
      [2351417.691] zwp_linux_dmabuf_v1@19.modifier(875713089, 16777216, 1)
      [2351417.712] zwp_linux_dmabuf_v1@19.modifier(875713089, 16777216, 2)
      [2351417.736] zwp_linux_dmabuf_v1@19.format(875713112)
      [2351417.747] zwp_linux_dmabuf_v1@19.modifier(875713112, 0, 0)
      [2351417.775] zwp_linux_dmabuf_v1@19.modifier(875713112, 16777216, 1)
      [2351417.801] zwp_linux_dmabuf_v1@19.modifier(875713112, 16777216, 2)
      [2351417.827] zwp_linux_dmabuf_v1@19.format(808669761)
      [2351417.842] zwp_linux_dmabuf_v1@19.modifier(808669761, 0, 0)
      [2351417.868] zwp_linux_dmabuf_v1@19.modifier(808669761, 16777216, 1)
      [2351417.891] zwp_linux_dmabuf_v1@19.modifier(808669761, 16777216, 2)
      [2351417.920] zwp_linux_dmabuf_v1@19.format(909199186)
      [2351417.931] zwp_linux_dmabuf_v1@19.modifier(909199186, 0, 0)
      [2351417.959] zwp_linux_dmabuf_v1@19.modifier(909199186, 16777216, 1)
      [2351417.981] zwp_linux_dmabuf_v1@19.modifier(909199186, 16777216, 2)
      [2351418.005] wl_callback@17.done(9627)
      [2351418.018]  -> wl_display@1.sync(new id wl_callback@17)
      [2351418.111] wl_display@1.delete_id(17)
      [2351418.127] wl_drm@18.authenticated()
      [2351418.134] wl_callback@17.done(9627)
      [2351427.266]  -> wl_compositor@4.create_surface(new id wl_surface@17)
      [2351454.116]  -> wl_shm@5.create_pool(new id wl_shm_pool@20, fd 11, 4096)
      [2351454.416]  -> wl_shm_pool@20.resize(12288)
      [2351457.613]  -> wl_shm_pool@20.resize(28672)
      [2351457.656]  -> wl_shm_pool@20.resize(61440)
      [2351457.720]  -> wl_shm_pool@20.resize(126976)
      [2351457.807]  -> wl_shm_pool@20.resize(258048)
      [2351458.057]  -> wl_shm_pool@20.resize(520192)
      [2351461.709]  -> wl_shm_pool@20.resize(1044480)
      [2351469.961]  -> wl_shm_pool@20.resize(2093056)
      [2351510.075]  -> wl_shm_pool@20.create_buffer(new id wl_buffer@21, 1409024, 32, 32, 128, 0)
      [2351510.115]  -> wl_pointer@7.set_cursor(0, wl_surface@3, 3, 3)
      [2351510.167]  -> wl_surface@3.attach(wl_buffer@21, 0, 0)
      [2351510.198]  -> wl_surface@3.set_buffer_scale(2)
      [2351510.214]  -> wl_surface@3.damage(0, 0, 16, 16)
      [2351510.251]  -> wl_surface@3.commit()
      [2351511.217]  -> wl_registry@2.bind(9, "xdg_wm_base", 1, new id [unknown]@22)
      Using the 'xdg-shell' shell integration
      [2351511.259]  -> xdg_wm_base@22.get_xdg_surface(new id xdg_surface@23, wl_surface@17)
      [2351511.286]  -> xdg_surface@23.get_toplevel(new id xdg_toplevel@24)
      [2351511.304]  -> xdg_toplevel@24.set_title("qt_wayland_test")
      [2351511.320]  -> xdg_toplevel@24.set_app_id("wayland_qt_csd_scale")
      [2351511.337]  -> wl_surface@17.set_buffer_scale(1)
      [2351511.913]  -> wl_surface@17.set_buffer_transform(0)
      [2351511.933]  -> wl_surface@17.commit()
      [2351511.945] wl_keyboard@10.keymap(1, fd 8, 53717)
      [2351522.840] wl_keyboard@10.repeat_info(33, 500)
      [2351530.569] xdg_toplevel@24.configure(0, 0, array)
      [2351530.630] xdg_surface@23.configure(9629)
      [2351530.673]  -> xdg_surface@23.set_window_geometry(0, 0, 150, 108)
      [2351530.711]  -> xdg_surface@23.ack_configure(9629)
      [2351530.837]  -> wl_shm@5.create_pool(new id wl_shm_pool@25, fd 11, 262136)
      [2351530.876]  -> wl_shm_pool@25.create_buffer(new id wl_buffer@26, 0, 302, 217, 1208, 0)
      [2351536.901]  -> wl_surface@17.damage(0, 0, 150, 15)
      [2351536.973]  -> wl_surface@17.damage(151, 0, 1, 15)
      [2351536.995]  -> wl_surface@17.damage(0, 15, 1, 93)
      [2351537.026]  -> wl_surface@17.damage(151, 15, 1, 93)
      [2351537.053]  -> wl_surface@17.damage(0, 123, 150, 1)
      [2351537.160]  -> wl_surface@17.frame(new id wl_callback@27)
      [2351537.182]  -> wl_surface@17.attach(wl_buffer@26, 0, 0)
      [2351537.206]  -> wl_surface@17.damage(3, 30, 296, 184)
      [2351537.238]  -> wl_surface@17.commit()
      [2351545.159] wl_surface@17.enter(wl_output@6)
      [2351545.195] wl_buffer@26.release()
      [2351582.852] xdg_toplevel@24.configure(150, 108, array)
      [2351582.899] xdg_surface@23.configure(9631)
      [2351582.941] wl_keyboard@10.modifiers(9633, 0, 0, 0, 0)
      [2351582.971] wl_keyboard@10.enter(9633, wl_surface@17, array)
      [2351583.002] wl_data_device@14.data_offer(new id wl_data_offer@1805814672)
      [2351583.026] wl_data_offer@4278190080.offer("UTF8_STRING")
      [2351583.042] wl_data_offer@4278190080.offer("COMPOUND_TEXT")
      [2351583.055] wl_data_offer@4278190080.offer("TEXT")
      [2351583.070] wl_data_offer@4278190080.offer("STRING")
      [2351583.086] wl_data_offer@4278190080.offer("text/plain;charset=utf-8")
      [2351583.103] wl_data_offer@4278190080.offer("text/plain")
      [2351583.119] wl_data_offer@4278190080.offer("SAVE_TARGETS")
      [2351583.136] wl_data_device@14.selection(wl_data_offer@4278190080)
      [2351583.188]  -> wl_display@1.sync(new id wl_callback@28)
      [2351583.224]  -> xdg_surface@23.set_window_geometry(0, 0, 74, 54)
      [2351583.278]  -> xdg_surface@23.ack_configure(9631)
      [2351583.397]  -> wl_shm_pool@25.destroy()
      [2351583.426]  -> wl_buffer@26.destroy()
      [2351583.524]  -> wl_shm@5.create_pool(new id wl_shm_pool@29, fd 11, 65400)
      [2351583.554]  -> wl_shm_pool@29.create_buffer(new id wl_buffer@30, 0, 150, 109, 600, 0)
      [2351584.273]  -> wl_surface@17.damage(0, 0, 74, 15)
      [2351584.330]  -> wl_surface@17.damage(75, 0, 1, 15)
      [2351584.357]  -> wl_surface@17.damage(0, 15, 1, 39)
      [2351584.384]  -> wl_surface@17.damage(75, 15, 1, 39)
      [2351584.409]  -> wl_surface@17.damage(0, 69, 74, 1)
      [2351584.483]  -> wl_surface@17.frame(new id wl_callback@31)
      [2351584.500]  -> wl_surface@17.attach(wl_buffer@30, 0, 0)
      [2351584.529]  -> wl_surface@17.damage(3, 30, 144, 76)
      [2351584.562]  -> wl_surface@17.commit()
      [2351585.393] wl_display@1.delete_id(28)
      [2351585.420] wl_display@1.delete_id(25)
      [2351585.431] wl_display@1.delete_id(26)
      [2351585.440] wl_callback@28.done(9633)
      [2351585.465] wl_buffer@30.release()
      [2351600.425] wl_display@1.delete_id(31)
      [2351600.525] wl_display@1.delete_id(27)
      [2351600.539] wl_callback@31.done(29805802)
      [2355662.142] wl_keyboard@10.key(9634, 29809856, 56, 1)
      [2355662.308] wl_keyboard@10.modifiers(9635, 262152, 0, 0, 0)
      [2355662.405] xdg_toplevel@24.close()
      [2355662.500]  -> wl_display@1.sync(new id wl_callback@27)
      [2355662.530]  -> xdg_toplevel@24.destroy()
      [2355662.544]  -> xdg_surface@23.destroy()
      [2355662.565]  -> wl_surface@17.destroy()
      [2355662.639] xdg_wm_base@22.ping(29809858)
      [2355662.663]  -> xdg_wm_base@22.pong(29809858)
      [2355662.685] wl_keyboard@10.key(9636, 29809862, 62, 0)
      [2355662.960]  -> wl_shm_pool@29.destroy()
      [2355663.012]  -> wl_buffer@30.destroy()
      [2355677.230]  -> xdg_wm_base@22.destroy()
      [2355678.108]  -> zwp_linux_dmabuf_v1@19.destroy()
      [2355678.143]  -> wl_pointer@7.release()
      [2355678.275]  -> wl_keyboard@10.release()
      [2355678.295]  -> wl_touch@15.release()
      [2355678.308]  -> zxdg_output_v1@9.destroy()
      [2355678.366]  -> wl_buffer@21.destroy()
      [2355678.457]  -> wl_shm_pool@20.destroy()
      

      Attachments

        1. main.cpp
          0.4 kB
        2. wayland_qt_csd_scale.pro
          0.1 kB
        3. wayland-qt-csd-scale-1.jpg
          wayland-qt-csd-scale-1.jpg
          211 kB
        4. wayland-qt-csd-scale-2.jpg
          wayland-qt-csd-scale-2.jpg
          207 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            johanhelsing Johan Helsing
            martin_furman Martin Furman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes