diff --git a/autotests/integration/CMakeLists.txt b/autotests/integration/CMakeLists.txt --- a/autotests/integration/CMakeLists.txt +++ b/autotests/integration/CMakeLists.txt @@ -1,6 +1,6 @@ add_subdirectory(helper) -add_library(KWinIntegrationTestFramework STATIC kwin_wayland_test.cpp test_helpers.cpp ${kwin_XWAYLAND_SRCS}) +add_library(KWinIntegrationTestFramework STATIC kwin_wayland_test.cpp test_helpers.cpp generic_scene_opengl_test.cpp ${kwin_XWAYLAND_SRCS}) target_link_libraries(KWinIntegrationTestFramework kwin Qt5::Test) function(integrationTest) @@ -36,9 +36,9 @@ integrationTest(WAYLAND_ONLY NAME testXdgShellClient SRCS xdgshellclient_test.cpp) integrationTest(WAYLAND_ONLY NAME testDontCrashNoBorder SRCS dont_crash_no_border.cpp) integrationTest(NAME testXwaylandSelections SRCS xwayland_selections_test.cpp) -integrationTest(WAYLAND_ONLY NAME testSceneOpenGL SRCS scene_opengl_test.cpp generic_scene_opengl_test.cpp) +integrationTest(WAYLAND_ONLY NAME testSceneOpenGL SRCS scene_opengl_test.cpp ) integrationTest(WAYLAND_ONLY NAME testSceneOpenGLShadow SRCS scene_opengl_shadow_test.cpp) -integrationTest(WAYLAND_ONLY NAME testSceneOpenGLES SRCS scene_opengl_es_test.cpp generic_scene_opengl_test.cpp) +integrationTest(WAYLAND_ONLY NAME testSceneOpenGLES SRCS scene_opengl_es_test.cpp ) integrationTest(WAYLAND_ONLY NAME testNoXdgRuntimeDir SRCS no_xdg_runtime_dir_test.cpp) integrationTest(WAYLAND_ONLY NAME testScreenChanges SRCS screen_changes_test.cpp) integrationTest(NAME testModiferOnlyShortcut SRCS modifier_only_shortcut_test.cpp) @@ -57,7 +57,7 @@ integrationTest(WAYLAND_ONLY NAME testDontCrashCursorPhysicalSizeEmpty SRCS dont_crash_cursor_physical_size_empty.cpp) integrationTest(WAYLAND_ONLY NAME testDontCrashReinitializeCompositor SRCS dont_crash_reinitialize_compositor.cpp) integrationTest(WAYLAND_ONLY NAME testNoGlobalShortcuts SRCS no_global_shortcuts_test.cpp) -integrationTest(WAYLAND_ONLY NAME testBufferSizeChange SRCS buffer_size_change_test.cpp generic_scene_opengl_test.cpp) +integrationTest(WAYLAND_ONLY NAME testBufferSizeChange SRCS buffer_size_change_test.cpp ) integrationTest(WAYLAND_ONLY NAME testPlacement SRCS placement_test.cpp) integrationTest(WAYLAND_ONLY NAME testActivation SRCS activation_test.cpp) diff --git a/autotests/libinput/CMakeLists.txt b/autotests/libinput/CMakeLists.txt --- a/autotests/libinput/CMakeLists.txt +++ b/autotests/libinput/CMakeLists.txt @@ -1,99 +1,71 @@ include_directories(${Libinput_INCLUDE_DIRS}) include_directories(${UDEV_INCLUDE_DIR}) + +add_library(LibInputTestObjects OBJECT ../../libinput/device.cpp ../../libinput/events.cpp mock_libinput.cpp) +target_link_libraries(LibInputTestObjects Qt5::Test Qt5::Widgets Qt5::DBus Qt5::Gui KF5::ConfigCore) + ######################################################## # Test Devices ######################################################## -set(testLibinputDevice_SRCS device_test.cpp mock_libinput.cpp ../../libinput/device.cpp ) -add_executable(testLibinputDevice ${testLibinputDevice_SRCS}) -target_link_libraries(testLibinputDevice Qt5::Test Qt5::DBus Qt5::Gui KF5::ConfigCore) +add_executable(testLibinputDevice device_test.cpp) +target_link_libraries(testLibinputDevice Qt5::Test Qt5::DBus Qt5::Gui KF5::ConfigCore LibInputTestObjects) add_test(NAME kwin-testLibinputDevice COMMAND testLibinputDevice) ecm_mark_as_test(testLibinputDevice) ######################################################## # Test Key Event ######################################################## -set(testLibinputKeyEvent_SRCS - ../../libinput/device.cpp - ../../libinput/events.cpp - key_event_test.cpp - mock_libinput.cpp -) -add_executable(testLibinputKeyEvent ${testLibinputKeyEvent_SRCS}) -target_link_libraries(testLibinputKeyEvent Qt5::Test Qt5::DBus Qt5::Widgets KF5::ConfigCore) +add_executable(testLibinputKeyEvent key_event_test.cpp) +target_link_libraries(testLibinputKeyEvent Qt5::Test Qt5::DBus Qt5::Widgets KF5::ConfigCore LibInputTestObjects) add_test(NAME kwin-testLibinputKeyEvent COMMAND testLibinputKeyEvent) ecm_mark_as_test(testLibinputKeyEvent) ######################################################## # Test Pointer Event ######################################################## -set(testLibinputPointerEvent_SRCS - ../../libinput/device.cpp - ../../libinput/events.cpp - mock_libinput.cpp - pointer_event_test.cpp -) -add_executable(testLibinputPointerEvent ${testLibinputPointerEvent_SRCS}) -target_link_libraries(testLibinputPointerEvent Qt5::Test Qt5::DBus Qt5::Widgets KF5::ConfigCore) +add_executable(testLibinputPointerEvent pointer_event_test.cpp) +target_link_libraries(testLibinputPointerEvent Qt5::Test Qt5::DBus Qt5::Widgets KF5::ConfigCore LibInputTestObjects) add_test(NAME kwin-testLibinputPointerEvent COMMAND testLibinputPointerEvent) ecm_mark_as_test(testLibinputPointerEvent) ######################################################## # Test Touch Event ######################################################## -set(testLibinputTouchEvent_SRCS - ../../libinput/device.cpp - ../../libinput/events.cpp - mock_libinput.cpp - touch_event_test.cpp -) -add_executable(testLibinputTouchEvent ${testLibinputTouchEvent_SRCS}) -target_link_libraries(testLibinputTouchEvent Qt5::Test Qt5::DBus Qt5::Widgets KF5::ConfigCore) +add_executable(testLibinputTouchEvent touch_event_test.cpp) +target_link_libraries(testLibinputTouchEvent Qt5::Test Qt5::DBus Qt5::Widgets KF5::ConfigCore LibInputTestObjects) add_test(NAME kwin-testLibinputTouchEvent COMMAND testLibinputTouchEvent) ecm_mark_as_test(testLibinputTouchEvent) ######################################################## # Test Gesture Event ######################################################## -set(testLibinputGestureEvent_SRCS - ../../libinput/device.cpp - ../../libinput/events.cpp - gesture_event_test.cpp - mock_libinput.cpp -) -add_executable(testLibinputGestureEvent ${testLibinputGestureEvent_SRCS}) -target_link_libraries(testLibinputGestureEvent Qt5::Test Qt5::DBus Qt5::Widgets KF5::ConfigCore) +add_executable(testLibinputGestureEvent gesture_event_test.cpp) +target_link_libraries(testLibinputGestureEvent Qt5::Test Qt5::DBus Qt5::Widgets KF5::ConfigCore LibInputTestObjects) add_test(NAME kwin-testLibinputGestureEvent COMMAND testLibinputGestureEvent) ecm_mark_as_test(testLibinputGestureEvent) ######################################################## # Test Switch Event ######################################################## -set(testLibinputSwitchEvent_SRCS - ../../libinput/device.cpp - ../../libinput/events.cpp - mock_libinput.cpp - switch_event_test.cpp -) -add_executable(testLibinputSwitchEvent ${testLibinputSwitchEvent_SRCS}) -target_link_libraries(testLibinputSwitchEvent Qt5::Test Qt5::DBus Qt5::Widgets KF5::ConfigCore) +add_executable(testLibinputSwitchEvent switch_event_test.cpp) +target_link_libraries(testLibinputSwitchEvent Qt5::Test Qt5::DBus Qt5::Widgets KF5::ConfigCore LibInputTestObjects) add_test(NAME kwin-testLibinputSwitchEvent COMMAND testLibinputSwitchEvent) ecm_mark_as_test(testLibinputSwitchEvent) ######################################################## # Test Context ######################################################## set(testLibinputContext_SRCS ../../libinput/context.cpp - ../../libinput/device.cpp - ../../libinput/events.cpp ../../libinput/libinput_logging.cpp ../../logind.cpp context_test.cpp - mock_libinput.cpp mock_udev.cpp ) add_executable(testLibinputContext ${testLibinputContext_SRCS}) target_link_libraries(testLibinputContext + LibInputTestObjects + Qt5::DBus Qt5::Test Qt5::Widgets @@ -107,8 +79,7 @@ ######################################################## # Test Input Events ######################################################## -set(testInputEvents_SRCS input_event_test.cpp mock_libinput.cpp ../../libinput/device.cpp ../../input_event.cpp) -add_executable(testInputEvents ${testInputEvents_SRCS}) -target_link_libraries(testInputEvents Qt5::Test Qt5::DBus Qt5::Gui Qt5::Widgets KF5::ConfigCore) +add_executable(testInputEvents input_event_test.cpp ../../input_event.cpp) +target_link_libraries(testInputEvents Qt5::Test Qt5::DBus Qt5::Gui Qt5::Widgets KF5::ConfigCore LibInputTestObjects) add_test(NAME kwin-testInputEvents COMMAND testInputEvents) ecm_mark_as_test(testInputEvents) diff --git a/kcmkwin/kwinoptions/main.cpp b/kcmkwin/kwinoptions/main.cpp --- a/kcmkwin/kwinoptions/main.cpp +++ b/kcmkwin/kwinoptions/main.cpp @@ -235,4 +235,3 @@ ) #include "main.moc" -#include "moc_main.cpp" diff --git a/kcmkwin/kwinrules/CMakeLists.txt b/kcmkwin/kwinrules/CMakeLists.txt --- a/kcmkwin/kwinrules/CMakeLists.txt +++ b/kcmkwin/kwinrules/CMakeLists.txt @@ -1,19 +1,27 @@ # KI18N Translation Domain for this library add_definitions(-DTRANSLATION_DOMAIN=\"kcmkwinrules\") add_definitions(-DKCMRULES) -########### next target ############### include_directories(../../) -set(kwinrules_MOC_HDRS yesnobox.h ../../cursor.h ../../plugins/platforms/x11/standalone/x11cursor.h) -qt5_wrap_cpp(kwinrules_MOC_SRCS ${kwinrules_MOC_HDRS}) -set(kwinrules_SRCS ../../rulebooksettings.cpp ruleswidget.cpp ruleslist.cpp kwinsrc.cpp detectwidget.cpp main.cpp ${kwinrules_MOC_SRCS}) +set(kwinrules_SRCS ../../rulebooksettings.cpp + ../../cursor.cpp + ../../plugins/platforms/x11/standalone/x11cursor.cpp + ../../rules.cpp + ../../placement.cpp + ../../utils.cpp + yesnobox.cpp + ruleswidget.cpp + ruleslist.cpp + kwinsrc.cpp + detectwidget.cpp + ) ki18n_wrap_ui(kwinrules_SRCS ruleslist.ui detectwidget.ui editshortcut.ui ruleswidgetbase.ui) kconfig_add_kcfg_files(kwinrules_SRCS ../../rulesettings.kcfgc) kconfig_add_kcfg_files(kwinrules_SRCS ../../rulebooksettingsbase.kcfgc) -add_executable(kwin_rules_dialog ${kwinrules_SRCS}) +add_library(KWinRulesObjects OBJECT ${kwinrules_SRCS}) set(kwin_kcm_rules_XCB_LIBS XCB::CURSOR @@ -36,19 +44,14 @@ if (KWIN_BUILD_ACTIVITIES) set(kcm_libs ${kcm_libs} KF5::Activities) endif() +target_link_libraries(KWinRulesObjects ${kcm_libs} ${kwin_kcm_rules_XCB_LIBS}) -target_link_libraries(kwin_rules_dialog ${kcm_libs} ${kwin_kcm_rules_XCB_LIBS}) - +add_executable(kwin_rules_dialog main.cpp) +target_link_libraries(kwin_rules_dialog KWinRulesObjects) install(TARGETS kwin_rules_dialog DESTINATION ${LIBEXEC_INSTALL_DIR}) -########### next target ############### - -set(kcm_kwinrules_PART_SRCS kcm.cpp ${kwinrules_SRCS}) - -add_library(kcm_kwinrules MODULE ${kcm_kwinrules_PART_SRCS}) - -target_link_libraries(kcm_kwinrules ${kcm_libs} ${kwin_kcm_rules_XCB_LIBS}) - +add_library(kcm_kwinrules MODULE kcm.cpp) +target_link_libraries(kcm_kwinrules KWinRulesObjects) install(TARGETS kcm_kwinrules DESTINATION ${PLUGIN_INSTALL_DIR}) ########### install files ############### diff --git a/kcmkwin/kwinrules/kwinsrc.cpp b/kcmkwin/kwinrules/kwinsrc.cpp --- a/kcmkwin/kwinrules/kwinsrc.cpp +++ b/kcmkwin/kwinrules/kwinsrc.cpp @@ -16,15 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -// Include some code from kwin core in order to avoid -// double implementation. - -#include "../../cursor.cpp" -#include "../../plugins/platforms/x11/standalone/x11cursor.cpp" -#include "../../rules.cpp" -#include "../../placement.cpp" -#include "../../options.cpp" -#include "../../utils.cpp" +#include KWin::InputRedirection *KWin::InputRedirection::s_self = nullptr; diff --git a/kcmkwin/kwinrules/yesnobox.h b/kcmkwin/kwinrules/yesnobox.h --- a/kcmkwin/kwinrules/yesnobox.h +++ b/kcmkwin/kwinrules/yesnobox.h @@ -28,18 +28,7 @@ class YesNoBox : public QWidget { Q_OBJECT public: - explicit YesNoBox( QWidget *parent ) : QWidget(parent) - { - QHBoxLayout *l = new QHBoxLayout(this); - l->setContentsMargins(0, 0, 0, 0); - l->addWidget(yes = new QRadioButton(i18n("Yes"), this)); - l->addWidget(no = new QRadioButton(i18n("No"), this)); - l->addStretch(100); - no->setChecked(true); - connect(yes, SIGNAL(clicked(bool)), this, SIGNAL(clicked(bool))); - connect(yes, SIGNAL(toggled(bool)), this, SIGNAL(toggled(bool))); - connect(no, SIGNAL(clicked(bool)), this, SLOT(noClicked(bool))); - } + explicit YesNoBox( QWidget *parent ); bool isChecked() { return yes->isChecked(); } public Q_SLOTS: void setChecked(bool b) { yes->setChecked(b); } diff --git a/plugins/kdecorations/aurorae/themes/plastik/code/plastikplugin.cpp b/plugins/kdecorations/aurorae/themes/plastik/code/plastikplugin.cpp --- a/plugins/kdecorations/aurorae/themes/plastik/code/plastikplugin.cpp +++ b/plugins/kdecorations/aurorae/themes/plastik/code/plastikplugin.cpp @@ -29,5 +29,3 @@ engine->addImageProvider(QLatin1String("plastik"), new KWin::PlastikButtonProvider()); QQmlExtensionPlugin::initializeEngine(engine, uri); } - -#include "moc_plastikplugin.cpp" diff --git a/utils.h b/utils.h --- a/utils.h +++ b/utils.h @@ -194,8 +194,10 @@ explicit Process(QObject *parent = nullptr); ~Process() override; +#ifndef KCMRULES protected: void setupChildProcess() override; +#endif }; } // namespace diff --git a/utils.cpp b/utils.cpp --- a/utils.cpp +++ b/utils.cpp @@ -77,6 +77,13 @@ #endif +Process::Process(QObject *parent) + : QProcess(parent) +{ +} + +Process::~Process() = default; + #ifndef KCMRULES void updateXTime() { @@ -135,13 +142,6 @@ xcb_ungrab_keyboard(connection(), XCB_TIME_CURRENT_TIME); } -Process::Process(QObject *parent) - : QProcess(parent) -{ -} - -Process::~Process() = default; - void Process::setupChildProcess() { sigset_t userSiganls;