From 9e23d20f8fced11b911b94869918e7a21937235d Mon Sep 17 00:00:00 2001 From: l10n daemon script Date: Mon, 31 Oct 2016 12:00:16 +0000 Subject: [PATCH 1/4] SVN_SILENT made messages (.desktop file) - always resolve ours In case of conflict in i18n, keep the version of the branch "ours" To resolve a particular conflict, "git checkout --ours path/to/file.desktop" --- effects/resize/resize_config.desktop | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/effects/resize/resize_config.desktop b/effects/resize/resize_config.desktop index 687d23c65f..7b6badcb8a 100644 --- a/effects/resize/resize_config.desktop +++ b/effects/resize/resize_config.desktop @@ -49,7 +49,7 @@ Name[mr]=चौकट आकार बदल Name[nb]=Endre størrelse på vinduet Name[nds]=Finstergrött ännern Name[nl]=Afmeting venster aanpassen -Name[nn]=Endra storleik på vindauget +Name[nn]=Skaler vindauge Name[pa]=ਵਿੰਡੋ ਮੁੜ-ਆਕਾਰ Name[pl]=Zmiana rozmiaru okien Name[pt]=Dimensionar a Janela From 55a0afca97ccfd6b0c3ff3b1516aff36e97c9c89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 31 Oct 2016 15:50:14 +0100 Subject: [PATCH 2/4] [autotest] Add test case for window caption need to be simplified The test illustrates that special characters like a line break are not removed from the window caption, which results in a line break added in the window decoration. Test case uses a title from a web page triggering it in Firefox. CCBUG: 323798 --- autotests/integration/CMakeLists.txt | 1 + autotests/integration/shell_client_test.cpp | 18 +++ autotests/integration/x11_client_test.cpp | 131 ++++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 autotests/integration/x11_client_test.cpp diff --git a/autotests/integration/CMakeLists.txt b/autotests/integration/CMakeLists.txt index 75d88c9317..cd86c04971 100644 --- a/autotests/integration/CMakeLists.txt +++ b/autotests/integration/CMakeLists.txt @@ -52,6 +52,7 @@ if (XCB_ICCCM_FOUND) integrationTest(NAME testX11DesktopWindow SRCS desktop_window_x11_test.cpp LIBS XCB::ICCCM) integrationTest(NAME testXwaylandInput SRCS xwayland_input_test.cpp LIBS XCB::ICCCM) integrationTest(NAME testWindowRules SRCS window_rules_test.cpp LIBS XCB::ICCCM) + integrationTest(NAME testX11Client SRCS x11_client_test.cpp LIBS XCB::ICCCM) if (KWIN_BUILD_ACTIVITIES) integrationTest(NAME testActivities SRCS activities_test.cpp LIBS XCB::ICCCM) diff --git a/autotests/integration/shell_client_test.cpp b/autotests/integration/shell_client_test.cpp index 4453cfdfac..c6740d2ace 100644 --- a/autotests/integration/shell_client_test.cpp +++ b/autotests/integration/shell_client_test.cpp @@ -60,6 +60,7 @@ private Q_SLOTS: void testMaximizedToFullscreen(); void testWindowOpensLargerThanScreen_data(); void testWindowOpensLargerThanScreen(); + void testCaptionSimplified(); }; void TestShellClient::initTestCase() @@ -544,5 +545,22 @@ void TestShellClient::testWindowOpensLargerThanScreen() QVERIFY(sizeChangeRequestedSpy.wait()); } +void TestShellClient::testCaptionSimplified() +{ + // this test verifies that caption is properly trimmed + // see BUG 323798 comment #12 + QScopedPointer surface(Test::createSurface()); + // only done for xdg-shell as ShellSurface misses the setter + QScopedPointer shellSurface(qobject_cast(Test::createShellSurface(Test::ShellSurfaceType::XdgShellV5, surface.data()))); + const QString origTitle = QString::fromUtf8(QByteArrayLiteral("Was tun, wenn Schüler Autismus haben?\342\200\250\342\200\250\342\200\250 – Marlies Hübner - Mozilla Firefox")); + shellSurface->setTitle(origTitle); + auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); + QVERIFY(c); + QEXPECT_FAIL("", "BUG 323798", Continue); + QVERIFY(c->caption() != origTitle); + QEXPECT_FAIL("", "BUG 323798", Continue); + QCOMPARE(c->caption(), origTitle.simplified()); +} + WAYLANDTEST_MAIN(TestShellClient) #include "shell_client_test.moc" diff --git a/autotests/integration/x11_client_test.cpp b/autotests/integration/x11_client_test.cpp new file mode 100644 index 0000000000..0ca060ca7e --- /dev/null +++ b/autotests/integration/x11_client_test.cpp @@ -0,0 +1,131 @@ +/******************************************************************** +KWin - the KDE window manager +This file is part of the KDE project. + +Copyright (C) 2016 Martin Gräßlin + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*********************************************************************/ +#include "kwin_wayland_test.h" +#include "composite.h" +#include "effects.h" +#include "effectloader.h" +#include "cursor.h" +#include "platform.h" +#include "scene_qpainter.h" +#include "shell_client.h" +#include "wayland_server.h" +#include "workspace.h" + +#include +#include + +using namespace KWin; +static const QString s_socketName = QStringLiteral("wayland_test_x11_client-0"); + +class X11ClientTest : public QObject +{ +Q_OBJECT +private Q_SLOTS: + void initTestCase(); + void init(); + void cleanup(); + + void testCaptionSimplified(); +}; + +void X11ClientTest::initTestCase() +{ + qRegisterMetaType(); + QSignalSpy workspaceCreatedSpy(kwinApp(), &Application::workspaceCreated); + QVERIFY(workspaceCreatedSpy.isValid()); + kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024)); + QVERIFY(waylandServer()->init(s_socketName.toLocal8Bit())); + + kwinApp()->start(); + QVERIFY(workspaceCreatedSpy.wait()); + QVERIFY(Compositor::self()); +} + +void X11ClientTest::init() +{ +} + +void X11ClientTest::cleanup() +{ +} + +struct XcbConnectionDeleter +{ + static inline void cleanup(xcb_connection_t *pointer) + { + xcb_disconnect(pointer); + } +}; + + +void X11ClientTest::testCaptionSimplified() +{ + // this test verifies that caption is properly trimmed + // see BUG 323798 comment #12 + QSignalSpy windowAddedSpy(effects, &EffectsHandler::windowAdded); + QVERIFY(windowAddedSpy.isValid()); + + // create an xcb window + QScopedPointer c(xcb_connect(nullptr, nullptr)); + QVERIFY(!xcb_connection_has_error(c.data())); + const QRect windowGeometry(0, 0, 100, 200); + xcb_window_t w = xcb_generate_id(c.data()); + xcb_create_window(c.data(), XCB_COPY_FROM_PARENT, w, rootWindow(), + windowGeometry.x(), + windowGeometry.y(), + windowGeometry.width(), + windowGeometry.height(), + 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, 0, nullptr); + xcb_size_hints_t hints; + memset(&hints, 0, sizeof(hints)); + xcb_icccm_size_hints_set_position(&hints, 1, windowGeometry.x(), windowGeometry.y()); + xcb_icccm_size_hints_set_size(&hints, 1, windowGeometry.width(), windowGeometry.height()); + xcb_icccm_set_wm_normal_hints(c.data(), w, &hints); + NETWinInfo winInfo(c.data(), w, rootWindow(), NET::Properties(), NET::Properties2()); + const QByteArray origTitle = QByteArrayLiteral("Was tun, wenn Schüler Autismus haben?\342\200\250\342\200\250\342\200\250 – Marlies Hübner - Mozilla Firefox"); + winInfo.setName(origTitle.constData()); + xcb_map_window(c.data(), w); + xcb_flush(c.data()); + + // we should get a client for it + QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); + QVERIFY(windowCreatedSpy.isValid()); + QVERIFY(windowCreatedSpy.wait()); + Client *client = windowCreatedSpy.first().first().value(); + QVERIFY(client); + QCOMPARE(client->window(), w); + QEXPECT_FAIL("", "BUG 323798", Continue); + QVERIFY(client->caption() != QString::fromUtf8(origTitle)); + QEXPECT_FAIL("", "BUG 323798", Continue); + QCOMPARE(client->caption(), QString::fromUtf8(origTitle).simplified()); + + // and destroy the window again + xcb_unmap_window(c.data(), w); + xcb_flush(c.data()); + + QSignalSpy windowClosedSpy(client, &Client::windowClosed); + QVERIFY(windowClosedSpy.isValid()); + QVERIFY(windowClosedSpy.wait()); + xcb_destroy_window(c.data(), w); + c.reset(); +} + +WAYLANDTEST_MAIN(X11ClientTest) +#include "x11_client_test.moc" From 241d8bfa27018490b0353fa724544a55ba3895b2 Mon Sep 17 00:00:00 2001 From: Jonathan Riddell Date: Tue, 1 Nov 2016 11:35:59 +0000 Subject: [PATCH 3/4] Update version number for 5.8.3 GIT_SILENT --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b0ba3ce89..8f43cd81a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ project(KWIN) -set(PROJECT_VERSION "5.8.2") +set(PROJECT_VERSION "5.8.3") set(PROJECT_VERSION_MAJOR 5) cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) From 3a179f32af51301d831891ce507714deb2fca952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 2 Nov 2016 11:28:54 +0100 Subject: [PATCH 4/4] [autotests] Add test case for snap to auto-hiding panel Workspace::adjustClientPosition incorrectly snaps against an auto hidden panel as the test shows. CCBUG: 365892 --- .../integration/move_resize_window_test.cpp | 112 ++++++++++++++++-- 1 file changed, 105 insertions(+), 7 deletions(-) diff --git a/autotests/integration/move_resize_window_test.cpp b/autotests/integration/move_resize_window_test.cpp index e090dde134..7bedad9948 100644 --- a/autotests/integration/move_resize_window_test.cpp +++ b/autotests/integration/move_resize_window_test.cpp @@ -19,6 +19,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************/ #include "kwin_wayland_test.h" +#include "atoms.h" #include "platform.h" #include "abstract_client.h" #include "cursor.h" @@ -69,6 +70,8 @@ private Q_SLOTS: void testPlasmaShellSurfaceMovable_data(); void testPlasmaShellSurfaceMovable(); void testNetMove(); + void testAdjustClientGeometryOfAutohidingX11Panel_data(); + void testAdjustClientGeometryOfAutohidingX11Panel(); private: KWayland::Client::ConnectionThread *m_connection = nullptr; @@ -509,17 +512,18 @@ void MoveResizeWindowTest::testPlasmaShellSurfaceMovable() QVERIFY(Test::waitForWindowDestroyed(c)); } +struct XcbConnectionDeleter +{ + static inline void cleanup(xcb_connection_t *pointer) + { + xcb_disconnect(pointer); + } +}; + void MoveResizeWindowTest::testNetMove() { // this test verifies that a move request for an X11 window through NET API works // create an xcb window - struct XcbConnectionDeleter - { - static inline void cleanup(xcb_connection_t *pointer) - { - xcb_disconnect(pointer); - } - }; QScopedPointer c(xcb_connect(nullptr, nullptr)); QVERIFY(!xcb_connection_has_error(c.data())); @@ -590,6 +594,100 @@ void MoveResizeWindowTest::testNetMove() QVERIFY(windowClosedSpy.wait()); } +void MoveResizeWindowTest::testAdjustClientGeometryOfAutohidingX11Panel_data() +{ + QTest::addColumn("panelGeometry"); + QTest::addColumn("targetPoint"); + QTest::addColumn("expectedAdjustedPoint"); + QTest::addColumn("hideLocation"); + + QTest::newRow("top") << QRect(0, 0, 100, 20) << QPoint(50, 25) << QPoint(50, 20) << 0u; + QTest::newRow("bottom") << QRect(0, 1024-20, 100, 20) << QPoint(50, 1024 - 25 - 50) << QPoint(50, 1024 - 20 - 50) << 2u; + QTest::newRow("left") << QRect(0, 0, 20, 100) << QPoint(25, 50) << QPoint(20, 50) << 3u; + QTest::newRow("right") << QRect(1280 - 20, 0, 20, 100) << QPoint(1280 - 25 - 100, 50) << QPoint(1280 - 20 - 100, 50) << 1u; +} + +void MoveResizeWindowTest::testAdjustClientGeometryOfAutohidingX11Panel() +{ + // this test verifies that auto hiding panels are ignored when adjusting client geometry + // see BUG 365892 + + // first create our panel + QScopedPointer c(xcb_connect(nullptr, nullptr)); + QVERIFY(!xcb_connection_has_error(c.data())); + + xcb_window_t w = xcb_generate_id(c.data()); + QFETCH(QRect, panelGeometry); + xcb_create_window(c.data(), XCB_COPY_FROM_PARENT, w, rootWindow(), + panelGeometry.x(), panelGeometry.y(), panelGeometry.width(), panelGeometry.height(), + 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, 0, nullptr); + xcb_size_hints_t hints; + memset(&hints, 0, sizeof(hints)); + xcb_icccm_size_hints_set_position(&hints, 1, panelGeometry.x(), panelGeometry.y()); + xcb_icccm_size_hints_set_size(&hints, 1, panelGeometry.width(), panelGeometry.height()); + xcb_icccm_set_wm_normal_hints(c.data(), w, &hints); + NETWinInfo winInfo(c.data(), w, rootWindow(), NET::WMWindowType, NET::Properties2()); + winInfo.setWindowType(NET::Dock); + xcb_map_window(c.data(), w); + xcb_flush(c.data()); + + QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded); + QVERIFY(windowCreatedSpy.isValid()); + QVERIFY(windowCreatedSpy.wait()); + Client *panel = windowCreatedSpy.first().first().value(); + QVERIFY(panel); + QCOMPARE(panel->window(), w); + QCOMPARE(panel->geometry(), panelGeometry); + QVERIFY(panel->isDock()); + + // let's create a window + using namespace KWayland::Client; + QScopedPointer surface(Test::createSurface()); + QVERIFY(!surface.isNull()); + + QScopedPointer shellSurface(Test::createShellSurface(surface.data())); + QVERIFY(!shellSurface.isNull()); + auto testWindow = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue); + + QVERIFY(testWindow); + QVERIFY(testWindow->isMovable()); + // panel is not yet hidden, we should snap against it + QFETCH(QPoint, targetPoint); + QTEST(Workspace::self()->adjustClientPosition(testWindow, targetPoint, false), "expectedAdjustedPoint"); + + // now let's hide the panel + QSignalSpy panelHiddenSpy(panel, &AbstractClient::windowHidden); + QVERIFY(panelHiddenSpy.isValid()); + QFETCH(quint32, hideLocation); + xcb_change_property(c.data(), XCB_PROP_MODE_REPLACE, w, atoms->kde_screen_edge_show, XCB_ATOM_CARDINAL, 32, 1, &hideLocation); + xcb_flush(c.data()); + QVERIFY(panelHiddenSpy.wait()); + + // now try to snap again + QEXPECT_FAIL("", "BUG 365892", Continue); + QCOMPARE(Workspace::self()->adjustClientPosition(testWindow, targetPoint, false), targetPoint); + + // and destroy the panel again + xcb_unmap_window(c.data(), w); + xcb_destroy_window(c.data(), w); + xcb_flush(c.data()); + c.reset(); + + QSignalSpy panelClosedSpy(panel, &Client::windowClosed); + QVERIFY(panelClosedSpy.isValid()); + QVERIFY(panelClosedSpy.wait()); + + // snap once more + QCOMPARE(Workspace::self()->adjustClientPosition(testWindow, targetPoint, false), targetPoint); + + // and close + QSignalSpy windowClosedSpy(testWindow, &ShellClient::windowClosed); + QVERIFY(windowClosedSpy.isValid()); + shellSurface.reset(); + surface.reset(); + QVERIFY(windowClosedSpy.wait()); +} + } WAYLANDTEST_MAIN(KWin::MoveResizeWindowTest)