Make source code more relocatable

Occasionally, I see complaints about the file organization of kwin,
which is fair enough.

This change makes the source code more relocatable by removing relative
paths from includes.

CMAKE_CURRENT_SOURCE_DIR was added to the interface include directories
of kwin library. This means that as long as you link against kwin target,
the real location of the source code of the library doesn't matter.

With autotests, things are not as convenient as with kwin target. Some
tests use cpp files from kwin core. If we move all source code in a src/
directory, they will need to be adjusted, but mostly only in build
scripts.
master
Vlad Zahorodnii 4 years ago
parent fb7f507d8e
commit 68c675d00d

@ -7,15 +7,16 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kwin_wayland_test.h"
#include "../../platform.h"
#include "../../pluginmanager.h"
#include "../../composite.h"
#include "../../effects.h"
#include "../../wayland_server.h"
#include "../../workspace.h"
#include "../../xcbutils.h"
#include "../../xwl/xwayland.h"
#include "../../inputmethod.h"
#include "composite.h"
#include "effects.h"
#include "inputmethod.h"
#include "platform.h"
#include "pluginmanager.h"
#include "wayland_server.h"
#include "workspace.h"
#include "xcbutils.h"
#include "xwl/xwayland.h"
#include <KPluginMetaData>

@ -9,7 +9,7 @@
#ifndef KWIN_WAYLAND_TEST_H
#define KWIN_WAYLAND_TEST_H
#include "../../main.h"
#include "main.h"
// Qt
#include <QtTest>

@ -13,7 +13,7 @@
#include "screens.h"
#include "wayland_server.h"
#include "workspace.h"
#include "../../xwl/databridge.h"
#include "xwl/databridge.h"
#include <KWaylandServer/datadevice_interface.h>

@ -2,6 +2,7 @@ include_directories(${Libinput_INCLUDE_DIRS})
add_library(LibInputTestObjects STATIC ../../libinput/device.cpp ../../libinput/events.cpp mock_libinput.cpp)
target_link_libraries(LibInputTestObjects Qt::Test Qt::Widgets Qt::DBus Qt::Gui KF5::ConfigCore)
target_include_directories(LibInputTestObjects PUBLIC ${CMAKE_SOURCE_DIR})
########################################################
# Test Devices

@ -8,8 +8,10 @@
*/
#include "mock_libinput.h"
#include "mock_udev.h"
#include "../../libinput/context.h"
#include "../../udev.h"
#include "libinput/context.h"
#include "udev.h"
#include <QtTest>
Q_LOGGING_CATEGORY(KWIN_CORE, "kwin_core", QtWarningMsg)

@ -7,7 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "mock_libinput.h"
#include "../../libinput/device.h"
#include "libinput/device.h"
#include <config-kwin.h>
#include <KSharedConfig>

@ -7,8 +7,9 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "mock_libinput.h"
#include "../../libinput/device.h"
#include "../../libinput/events.h"
#include "libinput/device.h"
#include "libinput/events.h"
#include <QtTest>

@ -7,8 +7,9 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "mock_libinput.h"
#include "../../libinput/device.h"
#include "../input_event.h"
#include "libinput/device.h"
#include "input_event.h"
#include <QtTest>

@ -7,8 +7,9 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "mock_libinput.h"
#include "../../libinput/device.h"
#include "../../libinput/events.h"
#include "libinput/device.h"
#include "libinput/events.h"
#include <QtTest>

@ -6,7 +6,8 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "../../udev.h"
#include "udev.h"
#include "mock_udev.h"
udev *udev::s_mockUdev = nullptr;

@ -7,8 +7,9 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "mock_libinput.h"
#include "../../libinput/device.h"
#include "../../libinput/events.h"
#include "libinput/device.h"
#include "libinput/events.h"
#include <QtTest>

@ -7,8 +7,9 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "mock_libinput.h"
#include "../../libinput/device.h"
#include "../../libinput/events.h"
#include "libinput/device.h"
#include "libinput/events.h"
#include <QtTest>

@ -7,8 +7,9 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "mock_libinput.h"
#include "../../libinput/device.h"
#include "../../libinput/events.h"
#include "libinput/device.h"
#include "libinput/events.h"
#include <QtTest>

@ -11,7 +11,8 @@
#include <QX11Info>
#include "../testutils.h"
#include "../../libkwineffects/kwinxrenderutils.h"
#include "kwinxrenderutils.h"
class BlendPictureTest : public QObject
{

@ -9,7 +9,7 @@
#ifndef KWIN_MOCK_SCREENS_H
#define KWIN_MOCK_SCREENS_H
#include "../screens.h"
#include "screens.h"
namespace KWin
{

@ -6,8 +6,9 @@
*/
#include "onscreennotificationtest.h"
#include "../onscreennotification.h"
#include "../input.h"
#include "onscreennotification.h"
#include "input.h"
#include <KSharedConfig>
#include <KConfigGroup>

@ -6,8 +6,8 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "../abstract_opengl_context_attribute_builder.h"
#include "../egl_context_attribute_builder.h"
#include "abstract_opengl_context_attribute_builder.h"
#include "egl_context_attribute_builder.h"
#include <QtTest>
#include <epoxy/egl.h>

@ -9,7 +9,7 @@
#ifndef KWIN_MOCK_TABBOX_CLIENT_H
#define KWIN_MOCK_TABBOX_CLIENT_H
#include "../../tabbox/tabboxhandler.h"
#include "tabbox/tabboxhandler.h"
#include <QIcon>
#include <QUuid>

@ -9,7 +9,7 @@
#ifndef KWIN_MOCK_TABBOX_HANDLER_H
#define KWIN_MOCK_TABBOX_HANDLER_H
#include "../../tabbox/tabboxhandler.h"
#include "tabbox/tabboxhandler.h"
namespace KWin
{
class MockTabBoxHandler : public TabBox::TabBoxHandler

@ -8,7 +8,7 @@
*/
// KWin
#include "../../tabbox/desktopchain.h"
#include "tabbox/desktopchain.h"
#include <QTest>

@ -6,7 +6,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "../../tabbox/tabboxconfig.h"
#include "tabbox/tabboxconfig.h"
#include <QtTest>
using namespace KWin;
using namespace KWin::TabBox;

@ -6,10 +6,10 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "../effectloader.h"
#include "../effects/effect_builtins.h"
#include "effectloader.h"
#include "effects/effect_builtins.h"
#include "mock_effectshandler.h"
#include "../scripting/scriptedeffect.h" // for mocking ScriptedEffect::create
#include "scripting/scriptedeffect.h" // for mocking ScriptedEffect::create
#include "testutils.h"
// KDE
#include <KConfig>

@ -8,8 +8,8 @@
*/
#include "testutils.h"
// KWin
#include "../client_machine.h"
#include "../xcbutils.h"
#include "client_machine.h"
#include "xcbutils.h"
// Qt
#include <QApplication>
#include <QtTest>

@ -6,7 +6,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "../gestures.h"
#include "gestures.h"
#include <QTest>
#include <QSignalSpy>

@ -6,9 +6,9 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "../effectloader.h"
#include "effectloader.h"
#include "mock_effectshandler.h"
#include "../scripting/scriptedeffect.h" // for mocking ScriptedEffect::create
#include "scripting/scriptedeffect.h" // for mocking ScriptedEffect::create
// KDE
#include <KConfig>
#include <KConfigGroup>

@ -7,17 +7,18 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
// kwin
#include "../atoms.h"
#include "../cursor.h"
#include "../input.h"
#include "../gestures.h"
#include "../main.h"
#include "../screenedge.h"
#include "../screens.h"
#include "../utils.h"
#include "../virtualdesktops.h"
#include "../xcbutils.h"
#include "../platform.h"
#include "atoms.h"
#include "cursor.h"
#include "input.h"
#include "gestures.h"
#include "main.h"
#include "screenedge.h"
#include "screens.h"
#include "utils.h"
#include "virtualdesktops.h"
#include "xcbutils.h"
#include "platform.h"
#include "mock_screens.h"
#include "mock_workspace.h"
#include "mock_x11client.h"

@ -6,13 +6,13 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "../effectloader.h"
#include "effectloader.h"
#include "mock_effectshandler.h"
#include "../scripting/scriptedeffect.h"
#include "scripting/scriptedeffect.h"
// for mocking
#include "../cursor.h"
#include "../input.h"
#include "../screenedge.h"
#include "cursor.h"
#include "input.h"
#include "screenedge.h"
// KDE
#include <KConfig>
#include <KConfigGroup>

@ -6,8 +6,8 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "../virtualdesktops.h"
#include "../input.h"
#include "input.h"
#include "virtualdesktops.h"
// KDE
#include <KConfigGroup>

@ -12,7 +12,7 @@
#include <QDBusPendingReply>
#include <QSignalSpy>
#include "../virtualkeyboard_dbus.h"
#include "virtualkeyboard_dbus.h"
using KWin::VirtualKeyboardDBus;

@ -8,7 +8,8 @@
*/
#include <kwineffects.h>
#include "../virtualdesktops.h"
#include "virtualdesktops.h"
#include <QVector2D>
#include <QGraphicsRotation>

@ -8,7 +8,7 @@
*/
#include "testutils.h"
// KWin
#include "../xcbutils.h"
#include "xcbutils.h"
// Qt
#include <QApplication>
#include <QtTest>

@ -8,7 +8,7 @@
*/
#include "testutils.h"
// KWin
#include "../xcbutils.h"
#include "xcbutils.h"
// Qt
#include <QApplication>
#include <QtTest>

@ -8,7 +8,7 @@
*/
#include "testutils.h"
// KWin
#include "../xcbutils.h"
#include "xcbutils.h"
// Qt
#include <QApplication>
#include <QtTest>

@ -6,7 +6,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "../xkb.h"
#include "xkb.h"
#include <QtTest>
#include <xkbcommon/xkbcommon-keysyms.h>

@ -13,17 +13,17 @@
// TODO: Make it compile also in testing environment
#ifndef KWIN_BUILD_TESTING
#include "../abstract_wayland_output.h"
#include "../main.h"
#include "../platform.h"
#include "../workspace.h"
#include "../abstract_client.h"
#include "../screens.h"
#include "abstract_wayland_output.h"
#include "main.h"
#include "platform.h"
#include "workspace.h"
#include "abstract_client.h"
#include "screens.h"
#endif
#include "../input_event.h"
#include "../logind.h"
#include "../udev.h"
#include "input_event.h"
#include "logind.h"
#include "udev.h"
#include "libinput_logging.h"
#include <QDBusMessage>

@ -9,10 +9,11 @@
#ifndef KWIN_LIBINPUT_CONNECTION_H
#define KWIN_LIBINPUT_CONNECTION_H
#include "../input.h"
#include "../keyboard_input.h"
#include <kwinglobals.h>
#include "input.h"
#include "keyboard_input.h"
#include <QObject>
#include <QPointer>
#include <QSize>

@ -9,8 +9,9 @@
#include "context.h"
#include "events.h"
#include "libinput_logging.h"
#include "../logind.h"
#include "../udev.h"
#include "logind.h"
#include "udev.h"
#include <fcntl.h>
#include <unistd.h>

@ -9,7 +9,7 @@
#ifndef KWIN_LIBINPUT_EVENTS_H
#define KWIN_LIBINPUT_EVENTS_H
#include "../input.h"
#include "input.h"
#include <libinput.h>

@ -8,10 +8,10 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "egl_dmabuf.h"
#include "drm_fourcc.h"
#include "kwineglext.h"
#include "../../../wayland_server.h"
#include "wayland_server.h"
#include <unistd.h>

@ -9,10 +9,10 @@
*/
#pragma once
#include "../../../linux_dmabuf.h"
#include "abstract_egl_backend.h"
#include "linux_dmabuf.h"
#include <QVector>
namespace KWin

@ -7,7 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "poller.h"
#include "../../wayland_server.h"
#include "wayland_server.h"
#include <KWayland/Client/idle.h>
#include <KWayland/Client/registry.h>

@ -7,7 +7,8 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "kglobalaccel_plugin.h"
#include "../../input.h"
#include "input.h"
#include <QDebug>

@ -10,8 +10,8 @@
#ifndef KWIN_OVERLAYWINDOW_X11_H
#define KWIN_OVERLAYWINDOW_X11_H
#include "../../../../overlaywindow.h"
#include "../../../../x11eventfilter.h"
#include "overlaywindow.h"
#include "x11eventfilter.h"
namespace KWin {
class KWIN_EXPORT OverlayWindowX11 : public OverlayWindow, public X11EventFilter {

@ -8,16 +8,17 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "integration.h"
#include "abstract_output.h"
#include "backingstore.h"
#include "eglplatformcontext.h"
#include "logging.h"
#include "offscreensurface.h"
#include "screen.h"
#include "window.h"
#include "../../main.h"
#include "../../platform.h"
#include "../../screens.h"
#include "abstract_output.h"
#include "main.h"
#include "platform.h"
#include "screens.h"
#include <QCoreApplication>
#include <QtConcurrentRun>

@ -7,7 +7,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "platformcursor.h"
#include "../../cursor.h"
#include "cursor.h"
namespace KWin
{

@ -5,7 +5,7 @@
*/
#include "windoweffects.h"
#include "effect_builtins.h"
#include "../../effects.h"
#include "effects.h"
#include <QGuiApplication>
#include <QWidget>

@ -11,9 +11,10 @@
#include "meta.h"
#include "scriptingutils.h"
#include "workspace_wrapper.h"
#include "../screens.h"
#include "../screenedge.h"
#include "scripting_logging.h"
#include "screens.h"
#include "screenedge.h"
// KDE
#include <KConfigGroup>
#include <kconfigloader.h>

@ -17,10 +17,11 @@
#include "screenedgeitem.h"
#include "scripting_model.h"
#include "scripting_logging.h"
#include "../x11client.h"
#include "../thumbnailitem.h"
#include "../options.h"
#include "../workspace.h"
#include "options.h"
#include "thumbnailitem.h"
#include "workspace.h"
#include "x11client.h"
// KDE
#include <KConfigGroup>
#include <KPackage/PackageLoader>

@ -9,13 +9,13 @@
*/
#include "workspace_wrapper.h"
#include "../x11client.h"
#include "../outline.h"
#include "../screens.h"
#include "../virtualdesktops.h"
#include "../workspace.h"
#include "x11client.h"
#include "outline.h"
#include "screens.h"
#include "virtualdesktops.h"
#include "workspace.h"
#ifdef KWIN_BUILD_ACTIVITIES
#include "../activities.h"
#include "activities.h"
#endif
#include <QDesktopWidget>

@ -8,6 +8,7 @@ endif()
set(screenedgeshowtest_SRCS screenedgeshowtest.cpp)
add_executable(screenedgeshowtest ${screenedgeshowtest_SRCS})
target_link_libraries(screenedgeshowtest Qt::Widgets Qt::X11Extras KF5::ConfigCore KF5::WindowSystem KF5::WaylandClient ${XCB_XCB_LIBRARY})
target_include_directories(screenedgeshowtest PRIVATE ${CMAKE_SOURCE_DIR})
set(libinputtest_SRCS
${KWin_SOURCE_DIR}/libinput/connection.cpp
@ -22,9 +23,11 @@ set(libinputtest_SRCS
add_executable(libinputtest ${libinputtest_SRCS})
add_definitions(-DKWIN_BUILD_TESTING)
target_link_libraries(libinputtest Qt::Core Qt::DBus Libinput::Libinput UDev::UDev KF5::ConfigCore KF5::GlobalAccel KF5::WindowSystem)
target_include_directories(libinputtest PRIVATE ${CMAKE_SOURCE_DIR})
add_executable(x11shadowreader x11shadowreader.cpp)
target_link_libraries(x11shadowreader XCB::XCB Qt::Widgets Qt::X11Extras KF5::ConfigCore KF5::WindowSystem)
target_include_directories(x11shadowreader PRIVATE ${CMAKE_SOURCE_DIR})
add_executable(pointerconstraints pointerconstraintstest.cpp)
add_definitions(-DDIR="${CMAKE_CURRENT_SOURCE_DIR}")

@ -3,10 +3,10 @@
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include "../input.h"
#include "../libinput/connection.h"
#include "../libinput/device.h"
#include "../logind.h"
#include "input.h"
#include "libinput/connection.h"
#include "libinput/device.h"
#include "logind.h"
#include <QCoreApplication>
#include <QLoggingCategory>

@ -3,6 +3,8 @@
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include "xcbutils.h"
#include <QApplication>
#include <QHBoxLayout>
#include <QMenu>
@ -15,7 +17,6 @@
#include <QWidget>
#include <QCheckBox>
#include <QX11Info>
#include "../xcbutils.h"
#include <KWindowSystem>

@ -3,7 +3,8 @@
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
#include "../xcbutils.h"
#include "xcbutils.h"
#include <QApplication>
#include <QDebug>
#include <QCommandLineParser>

Loading…
Cancel
Save