Commit graph

17320 commits

Author SHA1 Message Date
Frederik Gladhorn
26b4b6580c Remove unused variable
Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23829
2019-09-10 14:27:44 +02:00
Vlad Zagorodniy
9ea29e3891 [autotests] Stabilize pointer input test 2019-09-10 15:09:03 +03:00
Vlad Zagorodniy
bc7f41bdbf Add context object to screenScaleChanged connection
Currently internal window test fails because several internal clients
outlive tests where each one of them was created. Given that the scene
doesn't specify the context object when it creates screenScaleChanged
connection, we may call windowGeometryShapeChanged on a deleted scene
object.

ASAN output:

    =================================================================
    ==23416==ERROR: AddressSanitizer: heap-use-after-free on address 0x60800005ffe0 at pc 0x7fdfb0451c26 bp 0x7fffc32fefb0 sp 0x7fffc32fefa8
    READ of size 8 at 0x60800005ffe0 thread T0
        #0 0x7fdfb0451c25 in QHash<KWin::Toplevel*, KWin::Scene::Window*>::findNode(KWin::Toplevel* const&, unsigned int*) const /usr/include/qt5/QtCore/qhash.h:933
        #1 0x7fdfb044c1eb in QHash<KWin::Toplevel*, KWin::Scene::Window*>::contains(KWin::Toplevel* const&) const /usr/include/qt5/QtCore/qhash.h:908
        #2 0x7fdfb04369c1 in KWin::Scene::windowGeometryShapeChanged(KWin::Toplevel*) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/scene.cpp:440
        #3 0x7fdfb045c017 in void std::__invoke_impl<void, void (KWin::Scene::*&)(KWin::Toplevel*), KWin::Scene*&, KWin::Toplevel*&>(std::__invoke_memfun_deref, void (KWin::Scene::*&)(KWin::Toplevel*), KWin::Scene*&, KWin::Toplevel*&) /usr/include/c++/9/bits/invoke.h:73
        #4 0x7fdfb045ba9c in std::__invoke_result<void (KWin::Scene::*&)(KWin::Toplevel*), KWin::Scene*&, KWin::Toplevel*&>::type std::__invoke<void (KWin::Scene::*&)(KWin::Toplevel*), KWin::Scene*&, KWin::Toplevel*&>(void (KWin::Scene::*&)(KWin::Toplevel*), KWin::Scene*&, KWin::Toplevel*&) /usr/include/c++/9/bits/invoke.h:95
        #5 0x7fdfb045bc84 in void std::_Bind<void (KWin::Scene::*(KWin::Scene*, KWin::Toplevel*))(KWin::Toplevel*)>::__call<void, , 0ul, 1ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul>) /usr/include/c++/9/functional:400
        #6 0x7fdfb045b7c0 in void std::_Bind<void (KWin::Scene::*(KWin::Scene*, KWin::Toplevel*))(KWin::Toplevel*)>::operator()<, void>() /usr/include/c++/9/functional:484
        #7 0x7fdfb045b3c2 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, std::_Bind<void (KWin::Scene::*(KWin::Scene*, KWin::Toplevel*))(KWin::Toplevel*)> >::call(std::_Bind<void (KWin::Scene::*(KWin::Scene*, KWin::Toplevel*))(KWin::Toplevel*)>&, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:146
        #8 0x7fdfb045abd4 in void QtPrivate::Functor<std::_Bind<void (KWin::Scene::*(KWin::Scene*, KWin::Toplevel*))(KWin::Toplevel*)>, 0>::call<QtPrivate::List<>, void>(std::_Bind<void (KWin::Scene::*(KWin::Scene*, KWin::Toplevel*))(KWin::Toplevel*)>&, void*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:256
        #9 0x7fdfb045a5b6 in QtPrivate::QFunctorSlotObject<std::_Bind<void (KWin::Scene::*(KWin::Scene*, KWin::Toplevel*))(KWin::Toplevel*)>, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) /usr/include/qt5/QtCore/qobjectdefs_impl.h:439
        #10 0x7fdfa5794137 in QMetaObject::activate(QObject*, int, int, void**) (/usr/lib64/libQt5Core.so.5+0x2b3137)
        #11 0x7fdfafeea2ca in KWin::Toplevel::screenScaleChanged() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/kwin_autogen/EWIEGA46WW/moc_toplevel.cpp:834
        #12 0x7fdfb0425712 in KWin::Toplevel::checkScreen() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/toplevel.cpp:538
        #13 0x7fdfafee3221 in KWin::Toplevel::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/kwin_autogen/EWIEGA46WW/moc_toplevel.cpp:371
        #14 0x7fdfa5793fd7 in QMetaObject::activate(QObject*, int, int, void**) (/usr/lib64/libQt5Core.so.5+0x2b2fd7)
        #15 0x7fdfafedefca in KWin::Screens::changed() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/kwin_autogen/EWIEGA46WW/moc_screens.cpp:276
        #16 0x7fdf9a199281 in operator() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/plugins/platforms/virtual/screens_virtual.cpp:45
        #17 0x7fdf9a199c7b in call /usr/include/qt5/QtCore/qobjectdefs_impl.h:146
        #18 0x7fdf9a199b50 in call<QtPrivate::List<bool>, void> /usr/include/qt5/QtCore/qobjectdefs_impl.h:256
        #19 0x7fdf9a199afc in impl /usr/include/qt5/QtCore/qobjectdefs_impl.h:439
        #20 0x7fdfa5794137 in QMetaObject::activate(QObject*, int, int, void**) (/usr/lib64/libQt5Core.so.5+0x2b3137)
        #21 0x7fdf9a17a37b in KWin::VirtualBackend::virtualOutputsSet(bool) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/plugins/platforms/virtual/KWinWaylandVirtualBackend_autogen/EWIEGA46WW/moc_virtual_backend.cpp:177
        #22 0x7fdf9a18c476 in KWin::VirtualBackend::setVirtualOutputs(int, QVector<QRect>, QVector<int>) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/plugins/platforms/virtual/virtual_backend.cpp:141
        #23 0x7fdf9a1794e2 in KWin::VirtualBackend::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/plugins/platforms/virtual/KWinWaylandVirtualBackend_autogen/EWIEGA46WW/moc_virtual_backend.cpp:94
        #24 0x7fdfa577794a in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (/usr/lib64/libQt5Core.so.5+0x29694a)
        #25 0x7fdfa57790d1 in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) (/usr/lib64/libQt5Core.so.5+0x2980d1)
        #26 0x45a3e0 in QMetaObject::invokeMethod(QObject*, char const*, Qt::ConnectionType, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) /usr/include/qt5/QtCore/qobjectdefs.h:444
        #27 0x44bf37 in KWin::InternalWindowTest::testScale() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/internal_window.cpp:693
        #28 0x4562ec in KWin::InternalWindowTest::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/autotests/integration/testInternalWindow_autogen/include/internal_window.moc:169
        #29 0x7fdfa577794a in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (/usr/lib64/libQt5Core.so.5+0x29694a)
        #30 0x7fdfaf047962  (/usr/lib64/libQt5Test.so.5+0x19962)
        #31 0x7fdfaf048352  (/usr/lib64/libQt5Test.so.5+0x1a352)
        #32 0x7fdfaf048910  (/usr/lib64/libQt5Test.so.5+0x1a910)
        #33 0x7fdfaf048cda in QTest::qRun() (/usr/lib64/libQt5Test.so.5+0x1acda)
        #34 0x7fdfaf048edb in QTest::qExec(QObject*, int, char**) (/usr/lib64/libQt5Test.so.5+0x1aedb)
        #35 0x455d7b in main /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/internal_window.cpp:807
        #36 0x7fdfa5002bca in __libc_start_main (/lib64/libc.so.6+0x26bca)
        #37 0x415029 in _start (/home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/bin/testInternalWindow+0x415029)

    0x60800005ffe0 is located 64 bytes inside of 96-byte region [0x60800005ffa0,0x608000060000)
    freed by thread T0 here:
        #0 0x7fdfb2042595 in operator delete(void*, unsigned long) (/usr/lib64/libasan.so.5+0x10d595)
        #1 0x7fdf98774c4e in KWin::SceneQPainter::~SceneQPainter() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/plugins/scenes/qpainter/scene_qpainter.cpp:70
        #2 0x7fdfb03fef41 in KWin::Compositor::stop() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/composite.cpp:451
        #3 0x7fdfb03fffe6 in KWin::Compositor::reinitialize() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/composite.cpp:527
        #4 0x7fdfb03ffe2f in KWin::Compositor::configChanged() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/composite.cpp:517
        #5 0x7fdfaffaf481 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (KWin::Compositor::*)()>::call(void (KWin::Compositor::*)(), KWin::Compositor*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:152
        #6 0x7fdfaffa4deb in void QtPrivate::FunctionPointer<void (KWin::Compositor::*)()>::call<QtPrivate::List<>, void>(void (KWin::Compositor::*)(), KWin::Compositor*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:185
        #7 0x7fdfaff9c765 in QtPrivate::QSlotObject<void (KWin::Compositor::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) /usr/include/qt5/QtCore/qobjectdefs_impl.h:414
        #8 0x7fdfa5794137 in QMetaObject::activate(QObject*, int, int, void**) (/usr/lib64/libQt5Core.so.5+0x2b3137)
        #9 0x7fdfafed441e in KWin::Options::configChanged() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/kwin_autogen/EWIEGA46WW/moc_options.cpp:1790
        #10 0x7fdfb02584c6 in KWin::Options::updateSettings() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/options.cpp:772
        #11 0x7fdfaff461db in KWin::Workspace::slotReconfigure() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/workspace.cpp:897
        #12 0x446f67 in KWin::InternalWindowTest::testModifierClickUnrestrictedMove() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/internal_window.cpp:620
        #13 0x45624d in KWin::InternalWindowTest::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/autotests/integration/testInternalWindow_autogen/include/internal_window.moc:166
        #14 0x7fdfa577794a in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (/usr/lib64/libQt5Core.so.5+0x29694a)
        #15 0x7fdfaf047962  (/usr/lib64/libQt5Test.so.5+0x19962)
        #16 0x7fdfaf048352  (/usr/lib64/libQt5Test.so.5+0x1a352)

    previously allocated by thread T0 here:
        #0 0x7fdfb204110f in operator new(unsigned long) (/usr/lib64/libasan.so.5+0x10c10f)
        #1 0x7fdf98774992 in KWin::SceneQPainter::createScene(QObject*) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/plugins/scenes/qpainter/scene_qpainter.cpp:58
        #2 0x7fdf9878db95 in KWin::QPainterFactory::create(QObject*) const /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/plugins/scenes/qpainter/scene_qpainter.cpp:870
        #3 0x7fdfb03f9488 in KWin::Compositor::setupStart() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/composite.cpp:238
        #4 0x7fdfb0404ca4 in KWin::WaylandCompositor::start() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/composite.cpp:862
        #5 0x7fdfaffaf481 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (KWin::Compositor::*)()>::call(void (KWin::Compositor::*)(), KWin::Compositor*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:152
        #6 0x7fdfaffa4deb in void QtPrivate::FunctionPointer<void (KWin::Compositor::*)()>::call<QtPrivate::List<>, void>(void (KWin::Compositor::*)(), KWin::Compositor*, void**) /usr/include/qt5/QtCore/qobjectdefs_impl.h:185
        #7 0x7fdfaff9c765 in QtPrivate::QSlotObject<void (KWin::Compositor::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) /usr/include/qt5/QtCore/qobjectdefs_impl.h:414
        #8 0x7fdfa57a0df1  (/usr/lib64/libQt5Core.so.5+0x2bfdf1)

    SUMMARY: AddressSanitizer: heap-use-after-free /usr/include/qt5/QtCore/qhash.h:933 in QHash<KWin::Toplevel*, KWin::Scene::Window*>::findNode(KWin::Toplevel* const&, unsigned int*) const
    Shadow bytes around the buggy address:
      0x0c1080003fa0: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa
      0x0c1080003fb0: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa
      0x0c1080003fc0: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa
      0x0c1080003fd0: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa
      0x0c1080003fe0: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fa
    =>0x0c1080003ff0: fa fa fa fa fd fd fd fd fd fd fd fd[fd]fd fd fd
      0x0c1080004000: fa fa fa fa fd fd fd fd fd fd fd fd fd fd fd fd
      0x0c1080004010: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 05 fa
      0x0c1080004020: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 00
      0x0c1080004030: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 04
      0x0c1080004040: fa fa fa fa 00 00 00 00 00 00 00 00 00 00 00 01
    Shadow byte legend (one shadow byte represents 8 application bytes):
      Addressable:           00
      Partially addressable: 01 02 03 04 05 06 07
      Heap left redzone:       fa
      Freed heap region:       fd
      Stack left redzone:      f1
      Stack mid redzone:       f2
      Stack right redzone:     f3
      Stack after return:      f5
      Stack use after scope:   f8
      Global redzone:          f9
      Global init order:       f6
      Poisoned by user:        f7
      Container overflow:      fc
      Array cookie:            ac
      Intra object redzone:    bb
      ASan internal:           fe
      Left alloca redzone:     ca
      Right alloca redzone:    cb
      Shadow gap:              cc
    ==23416==ABORTING
    (EE) failed to read Wayland events: Connection reset by peer
2019-09-10 14:51:08 +03:00
Jonathan Riddell
46c76aecc9 Update version number for 5.12.9
GIT_SILENT
2019-09-10 11:19:14 +01:00
Vlad Zagorodniy
45c93c6cae Destroy ShellClient before Workspace is gone
Summary:
Managing lifetime of objects during tear down is a bit clunky in KWin
mostly because the wayland server outlives the workspace.

3f4e733468 tried to tackle one aspect of this problem, but the proposed
solution is good only in short term. If a ShellClient wants to discard
force temporarily rules, it needs to access RuleBook, whose lifetime is
bounded to the workspace, no matter what happens. Otherwise, the force
temporarily rule will be applied again on the next startup.

It's worth to mention that there was another attempt to address this
problem, see commit 826b9742e9. It was reverted because some internal
clients may need to destroy Wayland resources during tear down.

This change takes another approach. In order to ensure that ShellClient
can access RuleBook during tear down, we manually destroy Wayland clients
in destructor of the Workspace class. Something is done already for X11
clients.

Reviewers: #kwin

Subscribers: romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22986
2019-09-10 11:07:31 +03:00
l10n daemon script
9525d71099 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"
2019-09-10 05:01:51 +02:00
Björn Feber
663d139638 [kcmkwin/options] Improve the look of the KWin options KCM UIs
Summary:
Apply the KDE HIG, use form layouts, make desktop files consistent and make the KCMs look better.
{F7323519}
{F7330485}
{F7330486}
{F7302318}
{F7302319}

Test Plan: Open the {nav Window Behavior} KCMs. All options should still work

Reviewers: #kwin, #plasma, #vdg, ngraham, zzag

Reviewed By: #kwin, #plasma, #vdg, ngraham, zzag

Subscribers: ngraham, davidedmundson, zzag, #vdg, #plasma, kwin, #kwin

Tags: #kwin

Maniphest Tasks: T10273

Differential Revision: https://phabricator.kde.org/D23615
2019-09-09 21:45:51 +02:00
Laurent Montel
42326f6ded GIT_SILENT: QLatin1Literal->QLatin1String 2019-09-08 21:18:29 +02:00
Björn Feber
37700113b2 Make KWin action menu consistent with task manager, use action verbs for configure items and add more icons
Summary: {F7329676}

Test Plan: Open the context menu for a window (Alt+F3).

Reviewers: #kwin, #vdg, ndavis, davidedmundson

Reviewed By: #kwin, #vdg, ndavis, davidedmundson

Subscribers: davidedmundson, ndavis, #vdg, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23779
2019-09-08 10:47:08 +02:00
Nate Graham
0f17d9ebf2 [kcmkwin/kwineffects] Use new Kirigami ListSectionHeader component
Summary:
This allows all the section headers to always have the same look and feel and be
adjusted in just one place.

Depends on D23049

Test Plan: {F7181776}

Reviewers: #vdg, kwin, GB_2, #kwin

Reviewed By: #vdg, GB_2

Tags: #kwin

Maniphest Tasks: T10384

Differential Revision: https://phabricator.kde.org/D23055
2019-09-07 20:31:51 -06:00
Vlad Zagorodniy
4d4d9990dd [effects/wobblywindows] Draw clients below opaque wobbly windows
Summary:
Given that wobbly windows effect takes optimized render path, it needs
to clear the clip region of about to be transformed opaque window.

BUG: 411092
FIXED-IN: 5.17.0

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23774
2019-09-07 23:50:12 +03:00
Vlad Zagorodniy
a035401b55 Use XCB wherever possible
Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23756
2019-09-07 19:54:45 +03:00
Vlad Zagorodniy
86b2b70458 [effects/wobblywindows] Remove traits of an open/close animation
Summary:
Wobbly Windows effect is capable of animating a window when it's shown
or hidden. However, this feature has been hidden since it was added.
One needs to know how the effect works in order to enable these animations.

Therefore there's no good reason to keep these two animations because
practically no one uses them and they only add maintenance burden.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23763
2019-09-07 13:21:38 +03:00
Vlad Zagorodniy
44aff0a087 [tabbox] Delete unused X11 includes
Test Plan: Compiles.

Reviewers: #kwin, apol

Reviewed By: apol

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23752
2019-09-07 12:45:28 +03:00
Vlad Zagorodniy
f2623c6c27 [kcmkwin/options] Delete unused X11 includes
Test Plan: Compiles.

Reviewers: #kwin, apol

Reviewed By: apol

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23751
2019-09-07 12:44:49 +03:00
Vlad Zagorodniy
96ac6a506b Drop redundant Compositor::hasScene()
Summary:
Compositor::hasScene() is redundant. Depending on use case, it can be
replaced by checking either m_state or Compositor::scene().

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23744
2019-09-07 10:19:04 +03:00
Vlad Zagorodniy
7f9dc8625b Remove pointless destructors
Summary:
Neither WaylandCompositor nor X11Compositor have at least one smart
pointer field that points to an incomplete class type, so the destructors
are kind of useless.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23747
2019-09-07 10:18:40 +03:00
Vlad Zagorodniy
062303244a [wayland] Don't update margins in ShellClient::finishInit
Summary:
It doesn't make sense to update window margins in finishInit because no
buffer is attached yet at that moment.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23743
2019-09-07 10:17:26 +03:00
Vlad Zagorodniy
630006e6f7 Delete unused includes
We don't use assert().
2019-09-06 16:07:55 +03:00
Roman Gilg
df3c1de848 [platforms/drm] Rework enablement and dpms switching
Summary:
This patch further refines output management.

We go now through AbstractWaylandOutput virtual functions to enable and
disable outputs.

Dpms changes and enablement switches use separate code paths at start in the
Drm backend code since they are similar but not the directly same. Common code
is shared though, functions are renamed accordingly.

Asserts have been put in place to better understand and check the control
flow. A seemingly unnecessary call to DrmOutput::pageFlipped on reactivation
after Vt switch has been removed to allow for that.

In future patches we need to look additionally at the legacy mode switching
code path which was and is still not working and better handling of the
current monitor Dpms state. For example a monitor being switched off is not
properly acted on and the workspace still expanded.

Test Plan:
With one and two monitors:
* Dpms off/on
* Vt switches
* Screen disable/enable

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Maniphest Tasks: T11459

Differential Revision: https://phabricator.kde.org/D23600
2019-09-05 17:36:21 +02:00
Roman Gilg
b3e7664d2c Replace Wayland/XDG outputs checks with enablement checks
Summary:
Make it more explicit what the relation is between Wayland and XDG objects
existing and enablement:

The ouput is enabled if and only if Wayland and XDG output objects exist.

We can simplify the code by replacing checks on the outputs with checking
the current enablement value.

Test Plan: Wayland nested and virtual backends.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23553
2019-09-05 17:29:08 +02:00
Roman Gilg
f7ff62e2e2 Lift output enablement into Platform
Summary:
This lifts the enablement code for outputs from the DRM backend to Platform
allowing other Wayland backends in the future to use this interface as well.

To do that we also create some helper functions on Platform level and have to
spill some KWayland classes into AbstractOutput what motivates a further split
of Platform into a Wayland child class like for AbstractOutput.

Test Plan: Disabled and enabled an output in DRM session.

Reviewers: #kwin

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23545
2019-09-05 17:22:44 +02:00
Roman Gilg
732610bd8f [platforms/drm] Early platform and outputs teardown
Summary:
Since we now use in the backends the OutputDeviceInterface for output data
all access must be complete before the Wayland server goes down. For that
introduce a new function to prepare shutdown in the backends.

While at it also remove the output deletion, since they get deleted through
Qt's object system leading to crashes on double free.

Test Plan: Shutdown works without seg faults in the Drm backend.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, kwin

Tags: #kwin

Maniphest Tasks: T11459

Differential Revision: https://phabricator.kde.org/D23602
2019-09-05 17:00:40 +02:00
Aleix Pol
5ed98f79e8 Fix warning text message 2019-09-05 16:47:13 +02:00
Vlad Zagorodniy
17cbe5bcbb Prevent deleting non-existing support properties on the root window
Summary: Less likely to happen but still we need to handle this case.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23611
2019-09-05 10:57:55 +03:00
Vlad Zagorodniy
76e57ab5d0 Make checkForOverlayWindow X11Compositor only
Summary: Overlay windows is an X11 thing.

Test Plan: Compiles.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23608
2019-09-05 10:54:30 +03:00
Vlad Zagorodniy
5cb1a71889 Reconfigure effects only once on config change
Summary: Compositor::reinitialize() already reconfigures effects.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23607
2019-09-05 10:50:25 +03:00
Vlad Zagorodniy
d690d913fb Don't schedule repaint until Compositor is On
Summary: scheduleRepaint() and addRepaintFull() do nothing when m_state is not State::On.

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23590
2019-09-05 10:44:02 +03:00
Vlad Zagorodniy
2963c9ca56 Quick tile only resizeable clients
Summary:
Maximized clients weren't considered as resizeable when quick tiling was
added. Therefore, a special case was added in Client::setQuickTileMode().
However, that special case didn't take into account that a fullscreen
client can be also maximized. Clearly, we don't want users quick tile
fullscreen clients.

BUG: 411028
FIXED-IN: 5.17.0

Test Plan: No longer able to quick tile maximized fullscreen window of Konsole.

Reviewers: #kwin

Subscribers: romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23604
2019-09-05 10:37:39 +03:00
Vlad Zagorodniy
e8f8033dc8 Expose internal id to declarative scripts
Summary:
A declarative script may need to access internal id in order to
create an instance of WindowThumbnailItem.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23671
2019-09-02 15:14:24 +03:00
David Edmundson
4e9ee32895 Remove unused forward declare 2019-09-01 16:40:08 +01:00
David Edmundson
76645f3c1b Fix orientation sensor DBus
Summary:
Firstly, it was completely broken, no-one called registerObject.

Secondly deleting the adaptor doesn't really make sense, you'd still
leave the object valid, only have it broken. Docs of
QDBusAbstractAdaptor do say not to ever delete it manually.

Thirdly we don't need Q_CLASSINFO setting the DBus interface on the
exported item when we use an adaptor.

Test Plan:
Manually added some setEnabled/disabled
Could now see the path

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23610
2019-09-01 16:15:25 +01:00
Vlad Zagorodniy
2f010926d5 Fix -Wsign-compare 2019-09-01 00:42:59 +03:00
Vlad Zagorodniy
a55ea51092 Delete commented Xlib code 2019-08-31 22:22:17 +03:00
Vlad Zagorodniy
8f0471d4ec Uncomment assert
Both Client::releaseWindow and Client::destroyClient reset frame window.
So, it's safe to assert frameId() back again.
2019-08-31 22:12:44 +03:00
Vlad Zagorodniy
b99d7923e1 Delete a leftover after old scripting api 2019-08-31 22:06:26 +03:00
Vlad Zagorodniy
7a3722b4f5 Switch to Q_ASSERT
Summary:
Switch to Q_ASSERT in order to make code a bit more consistent. We have
places where both assert and Q_ASSERT are used next to each other. Also,
distributions like Ubuntu don't strip away assert(), let's hope that
things are a bit different with Q_ASSERT.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: romangg, davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23605
2019-08-31 20:07:05 +03:00
Vlad Zagorodniy
9102e41e71 Traverse the stacking order backwards when switching between windows
Summary:
In order to pick the next client to activate we traverse the stacking
order from bottom to top and assign to each client a score. The client
with the best score will be activated next. Function that assigns score
bases its decisions purely on geometry. This may backfire if there are
couple maximized or fullscreen clients on the screen - we'll activate
the bottom-most client.

This change toggles direction we traverse the stacking order. If there
are several clients with an identical score, then prefer the top-most
client, the one that the user most likely sees at the moment.

BUG: 411356
FIXED-IN: 5.17.0

Test Plan: New tests pass.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23521
2019-08-31 13:47:15 +03:00
Vlad Zagorodniy
d2bbd2a124 [x11] Fix crash during tear down
Summary:
Any call made to a virtual method in constructor/destructor of a base
class won't go to a derived class because the base class may access
uninitialized or destroyed resources.

For example, let's consider the following two classes

    class Base {
    public:
        Base() { foo()->bar(); }
        virtual ~Base() { foo()->bar(); }

        virtual Foo* foo() const { return nullptr; }
    };

    class Derived : public Base {
    public:
        Derived() : mFoo(new Foo) {}
        ~Derived() override { delete mFoo; }

        Foo* foo() const override { return mFoo; }

    private:
        Foo* mFoo;
    };

When an instance of Derived class is created, constructors will run in
the following order:

    Base()
    Derived()

It's not safe to dispatch foo() method call to Derived class because
constructor of Derived hasn't initialized yet mFoo.

Same story with destructors, they'll run in the following order:

    ~Derived()
    ~Base()

It's not safe to dispatch foo() method call in the destructor of Base
class to Derived class because mFoo was deleted.

So, what does that weird C++ behavior has something to do with KWin? Well,
recently Compositor class was split into two classes - WaylandCompositor,
and X11Compositor. Some functionality from X11 doesn't make sense on
Wayland. Therefore methods that implement that stuff were "purified," i.e.
they became pure virtual methods. Unfortunately, when Compositor tears
down it may call pure virtual methods on itself. Given that those calls
cannot be dispatched to X11Compositor or WaylandCompositor, the only
choice that C++ runtime has is to throw an exception.

The fix for this very delicate problem is very simple - do not call virtual
methods from constructors and the destructor. Avoid doing that if you can!

This change moves Compositor::updateClientCompositeBlocking to X11Compositor
so it longer has to be a virtual method. Also, it kind of doesn't make sense
to keep it in base Compositor class because compositing can be blocked only
on X11.

BUG: 411049

Test Plan: KWin no longer crashes when running kwin_x11 --replace command.

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: anthonyfieroni, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23098
2019-08-31 13:31:36 +03:00
l10n daemon script
125d3e90e1 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"
2019-08-31 05:30:20 +02:00
Vlad Zagorodniy
70d3a2d2a4 Fix doxygen comment style 2019-08-30 23:31:42 +03:00
l10n daemon script
082baf6662 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"
2019-08-30 05:26:49 +02:00
Roman Gilg
e8fada8a36 Get name and refresh rate from output device
Summary:
We can simplify the AbstractWaylandOutput code some more by getting name and
refresh rate of an output from the always available output device object.

Test Plan: Tested with DRM, Wayland nested and virtual backends.

Reviewers: #kwin

Subscribers: davidedmundson, apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23546
2019-08-29 16:04:09 +02:00
Roman Gilg
836f88495b [platforms/x11/windowed] Fix output scale access before output device creation 2019-08-28 22:27:22 +02:00
Vlad Zagorodniy
6d792de74b [wayland] Allow debugging kwin with lldb
Summary: LLDB is a debugger originating from the LLVM project.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23544
2019-08-28 22:43:33 +03:00
Roman Gilg
3e2000bba6 Remove unused function declaration 2019-08-28 19:41:36 +02:00
Vlad Zagorodniy
ffd4a3b390 [plugins/aurorae] Fix indentation in Decoration::updateBuffer
CCMAIL: kde@davidedmundson.co.uk
2019-08-28 19:39:31 +03:00
David Edmundson
af56a0ca0e [Aurorae] Remove effective triple buffering
Summary:
KWin blits contents into a QImage raster buffer. Because of this we
don't need our underlying GL surface to be double buffered as it
effectively makes the whole thing tripple buffered.

Test Plan: Ran Aurorae, looked the same, should save some memory

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23331
2019-08-28 17:34:56 +01:00
David Edmundson
c67d81aeb9 [Aurorae] Don't delay initial blit.
Summary:
Aurorae has a timer between request update and updating the contents.
This makes some sense.

However on initial creation we want to snap the contents immediately as
otherwise we may be out by a frame between a new window being mapped and
the window decoration being rendered.

Test Plan:
Ran with Auroae
Windows opened immediately seemed to have a deco straight away

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: zzag, romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23332
2019-08-28 17:34:56 +01:00
Roman Gilg
f2c5f85cae Assure wayland output interface creation path
Summary:
The Wayland and XDG output interfaces are created or destroyed when the
output is en- or disabled. This follows a clear path of dependencies and
we should not check if this is indeed the case but instead assert on it.

Test Plan: Nested Wayland and Drm sessions.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23540
2019-08-28 18:33:00 +02:00