kwin/CMakeLists.txt

602 lines
16 KiB
Text
Raw Normal View History

project(KWIN)
set(PROJECT_VERSION "5.4.90")
set(PROJECT_VERSION_MAJOR 5)
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
2015-02-18 09:04:06 +00:00
set(QT_MIN_VERSION "5.4.0")
set(KF5_MIN_VERSION "5.12.0")
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH} )
find_package(ECM 0.0.11 REQUIRED NO_MODULE)
include(FeatureSummary)
include(WriteBasicConfigVersionFile)
include(GenerateExportHeader)
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
Concurrent
Core
DBus
Quick
QuickWidgets
Script
UiTools
Widgets
X11Extras
)
find_package(Qt5Test ${QT_MIN_VERSION} CONFIG QUIET)
set_package_properties(Qt5Test PROPERTIES
PURPOSE "Required for tests"
TYPE OPTIONAL
)
add_feature_info("Qt5Test" Qt5Test_FOUND "Required for building tests")
if (NOT Qt5Test_FOUND)
set(BUILD_TESTING OFF CACHE BOOL "Build the testing tree.")
endif()
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDECompilerSettings)
include(ECMInstallIcons)
include(ECMOptionalAddSubdirectory)
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0 -DQT_USE_QSTRINGBUILDER)
# require at least gcc 4.8
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.8")
message(SEND_ERROR "Version ${CMAKE_CXX_COMPILER_VERSION} of the ${CMAKE_CXX_COMPILER_ID} C++ compiler is not supported. Please use version 4.8 or later.")
endif()
endif()
find_package(Qt5Multimedia QUIET)
set_package_properties(Qt5Multimedia PROPERTIES
PURPOSE "Runtime-only dependency for effect video playback"
TYPE RUNTIME
)
# required frameworks by Core
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Config
ConfigWidgets
CoreAddons
Crash
GlobalAccel
I18n
Init
Notifications
Package
Plasma
WidgetsAddons
WindowSystem
2015-03-19 00:15:22 +00:00
IconThemes
)
# required frameworks by config modules
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Completion
Declarative
KCMUtils
KIO
NewStuff
Service
XmlGui
)
find_package(Threads)
set_package_properties(Threads PROPERTIES
PURPOSE "Needed for VirtualTerminal support in KWin Wayland"
TYPE REQUIRED
)
# optional frameworks
find_package(KF5Activities ${KF5_MIN_VERSION} CONFIG)
set_package_properties(KF5Activities PROPERTIES
PURPOSE "Enable building of KWin with kactivities support"
TYPE OPTIONAL
)
add_feature_info("KF5Activities" KF5Activities_FOUND "Enable building of KWin with kactivities support")
find_package(KF5DocTools ${KF5_MIN_VERSION} CONFIG)
set_package_properties(KF5DocTools PROPERTIES
PURPOSE "Enable building documentation"
TYPE OPTIONAL
)
add_feature_info("KF5DocTools" KF5DocTools_FOUND "Enable building documentation")
find_package(KDecoration2 CONFIG REQUIRED)
find_package(KF5Wayland CONFIG REQUIRED)
set_package_properties(KF5Wayland PROPERTIES
TYPE REQUIRED
)
find_package(KScreenLocker CONFIG REQUIRED)
set_package_properties(KScreenLocker PROPERTIES
TYPE REQUIRED
PURPOSE "For screenlocker integration in kwin_wayland")
find_package(EGL)
set_package_properties(EGL PROPERTIES
2014-02-10 16:34:09 +00:00
TYPE RUNTIME
PURPOSE "Required to build KWin with EGL support"
)
2014-02-10 16:34:09 +00:00
find_package(epoxy)
set_package_properties(epoxy PROPERTIES DESCRIPTION "libepoxy"
URL "http://github.com/anholt/libepoxy"
TYPE REQUIRED
PURPOSE "OpenGL dispatch library"
)
find_package(Wayland 1.2 REQUIRED COMPONENTS Egl Cursor)
set_package_properties(Wayland PROPERTIES
TYPE REQUIRED
PURPOSE "Required for building KWin with Wayland support"
)
find_package(XKB 0.4.1)
set_package_properties(XKB PROPERTIES
TYPE REQUIRED
PURPOSE "Required for building KWin with Wayland support"
)
find_package(Libinput 0.10)
set_package_properties(Libinput PROPERTIES TYPE OPTIONAL PURPOSE "Required for input handling on Wayland.")
find_package(UDev)
set_package_properties(UDev PROPERTIES URL "http://www.freedesktop.org/software/systemd/libudev/"
DESCRIPTION "Linux device library."
TYPE OPTIONAL
PURPOSE "Required for input handling on Wayland."
)
set(HAVE_INPUT FALSE)
if (Libinput_FOUND AND UDEV_FOUND)
set(HAVE_INPUT TRUE)
endif()
find_package(Libdrm)
set_package_properties(Libdrm PROPERTIES TYPE OPTIONAL PURPOSE "Required for drm output on Wayland.")
set(HAVE_DRM FALSE)
if(Libdrm_FOUND AND UDEV_FOUND)
set(HAVE_DRM TRUE)
endif()
find_package(gbm)
set_package_properties(gbm PROPERTIES TYPE OPTIONAL PURPOSE "Required for egl ouput of drm backend.")
set(HAVE_GBM FALSE)
if(HAVE_DRM AND gbm_FOUND)
set(HAVE_GBM TRUE)
endif()
find_package(libhybris)
set_package_properties(libhybris PROPERTIES TYPE OPTIONAL PURPOSE "Required for libhybris backend")
set(HAVE_LIBHYBRIS ${libhybris_FOUND})
find_package(X11)
set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries"
URL "http://www.x.org"
TYPE REQUIRED
)
# All the required XCB components
find_package(XCB 1.10
REQUIRED COMPONENTS
XCB
XFIXES
DAMAGE
COMPOSITE
SHAPE
SYNC
RENDER
RANDR
KEYSYMS
IMAGE
SHM
2014-09-18 15:09:16 +00:00
GLX
CURSOR
OPTIONAL_COMPONENTS
ICCCM
)
set_package_properties(XCB PROPERTIES TYPE REQUIRED)
# and the optional XCB dependencies
if (XCB_ICCCM_VERSION VERSION_LESS "0.4")
set(XCB_ICCCM_FOUND FALSE)
endif()
add_feature_info("XCB-ICCCM" XCB_ICCCM_FOUND "Required for building test applications for KWin")
find_package(X11_XCB)
set_package_properties(X11_XCB PROPERTIES
PURPOSE "Required for building X11 windowed backend of kwin_wayland"
TYPE OPTIONAL)
# dependencies for QPA plugin
find_package(Qt5PlatformSupport REQUIRED)
find_package(Freetype REQUIRED)
set_package_properties(Freetype PROPERTIES DESCRIPTION "A font rendering engine"
URL "http://www.freetype.org"
TYPE REQUIRED
PURPOSE "Needed for KWin's QPA plugin."
)
find_package(Fontconfig REQUIRED)
set_package_properties(Fontconfig PROPERTIES DESCRIPTION "Font access configuration library"
URL "http://www.freedesktop.org/wiki/Software/fontconfig"
TYPE REQUIRED
PURPOSE "Needed for KWin's QPA plugin."
)
########### configure tests ###############
include(CMakeDependentOption)
option(KWIN_BUILD_DECORATIONS "Enable building of KWin decorations." ON)
option(KWIN_BUILD_KCMS "Enable building of KWin configuration modules." ON)
option(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON)
option(KWIN_BUILD_XRENDER_COMPOSITING "Enable building of KWin with XRender Compositing support" ON)
cmake_dependent_option(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" ON "KF5Activities_FOUND" OFF)
option(KWIN_BUILD_COVERAGE "Build KWin with gcov support" OFF)
if(KWIN_BUILD_COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov")
endif()
# Binary name of KWin
set(KWIN_NAME "kwin")
Rename KWin binary to kwin_x11 This servers two purposes. 1. it makes KWin/5 co-installable with KWin/4 as now binary and all libraries etc. are renamed or installed to a different location. 2. In future we need a dedicated X11 and Wayland main function anyway. Thus it makes most sense to rename to kwin_x11 directly instead of first renaming to kwin5. The reason why we need to have dedicated main functions is that kwin needs to check early whether X11 is working or Wayland is working. Right now the first thing kwin does is trying to connect to the XServer. This happens before the QApplication is constructed and before command line args are processed. On Wayland we won't want to test whether we can connect to the XServer. As it's too early to check whether we are starting kwin for X11 or Wayland the most convenient way is to have dedicated binaries - thus a rename is needed. Just renaming kwin for wayland is also not a good idea as in future the "main" kwin will be for wayland not for X11. Another case for the dedicated binaries is the Application class, which right now first tries to claim the X11 Window Manager Selection. Again on Wayland even with XWayland we won't need that. KWin will be the window manager for XWayland if KWin is the Wayland compositor. There is no need to even try to support anything else. Most likely it will even be KWin to start the XWayland server, so we can be sure that there is no other WM running and thus no need to claim the selection and abort if it fails. REVIEW: 118266
2014-06-10 10:05:54 +00:00
set(KWIN_INTERNAL_NAME_X11 "kwin_x11")
set(KWIN_INTERNAL_NAME_WAYLAND "kwin_wayland")
set(KWIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
# KWIN_HAVE_XRENDER_COMPOSITING - whether XRender-based compositing support is available: may be disabled
if( KWIN_BUILD_XRENDER_COMPOSITING )
set( KWIN_HAVE_XRENDER_COMPOSITING 1 )
2013-02-25 10:14:56 +00:00
endif()
include_directories(${XKB_INCLUDE_DIR})
2014-10-24 19:58:59 +00:00
include_directories(${epoxy_INCLUDE_DIR})
set(HAVE_EPOXY_GLX ${epoxy_HAS_GLX})
2014-10-24 19:58:59 +00:00
# for things that are also used by kwin libraries
configure_file(libkwineffects/kwinconfig.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/libkwineffects/kwinconfig.h )
# for kwin internal things
set(HAVE_X11_XCB ${X11_XCB_FOUND})
include(CheckIncludeFiles)
check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(malloc.h HAVE_MALLOC_H)
configure_file(config-kwin.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kwin.h )
########### global ###############
set(kwin_effects_dbus_xml ${CMAKE_CURRENT_SOURCE_DIR}/org.kde.kwin.Effects.xml)
include_directories(BEFORE
${CMAKE_CURRENT_BINARY_DIR}/libkwineffects
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/libkwineffects
${CMAKE_CURRENT_SOURCE_DIR}/effects
${CMAKE_CURRENT_SOURCE_DIR}/tabbox
)
add_subdirectory( libkwineffects )
add_subdirectory( killer )
if(KWIN_BUILD_KCMS)
add_subdirectory( kcmkwin )
2013-02-25 10:14:56 +00:00
endif()
if( KWIN_BUILD_DECORATIONS )
add_subdirectory( clients )
2013-02-25 10:14:56 +00:00
endif()
add_subdirectory( data )
add_subdirectory( effects )
add_subdirectory( scripts )
add_subdirectory( tabbox )
add_subdirectory(scripting)
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=1212)
########### next target ###############
set(kwin_KDEINIT_SRCS
workspace.cpp
dbusinterface.cpp
abstract_client.cpp
client.cpp
Improved resolving whether a window is on local machine Most windows use the hostname in WM_CLIENT_MACHINE, but there are windows using the FQDN (for example libreoffice). So instead of "foo" it is "foo.local.net" or similar. The logic so far has been unable to properly determine whether windows with FQDN are on the local system. In order to solve this problem the handling is split out into an own class which stores the information of hostname and whether it is a local machine. This is to not query multiple times. To determine whether the Client is on the local system getaddrinfo is used for the own hostname and the FQDN provided in WM_CLIENT_MACHINE. If one of the queried names matches, we know that it is on the local machine. The old logic to compare the hostname is still used and getaddrinfo is only a fallback in case hostname does not match. The problem with getaddrinfo is, that it accesses the network and by that could block. To circumvent this problem the calls are moved into threads by using QtConcurrent::run. Obviously this brings disadvantages. When trying to resolve whether a Client is on the local machine and a FQDN is used, the information is initially wrong. The new ClientMachine class emits a signal when the information that the system is local becomes available, but for some things this is just too late: * window rules are already gathered * Session Management has already taken place In both cases this is an acceptable loss. For window rules it just needs a proper matching of the machine in case of localhost (remote hosts are not affected). And the case of session management is very academic as it is unlikely that a restoring session contains remote windows. BUG: 308391 FIXED-IN: 4.11 REVIEW: 108235
2013-01-07 07:07:27 +00:00
client_machine.cpp
cursor.cpp
tabgroup.cpp
focuschain.cpp
globalshortcuts.cpp
input.cpp
netinfo.cpp
placement.cpp
atoms.cpp
utils.cpp
layers.cpp
main.cpp
options.cpp
outline.cpp
events.cpp
killwindow.cpp
geometrytip.cpp
screens.cpp
screens_xrandr.cpp
shadow.cpp
sm.cpp
group.cpp
manage.cpp
overlaywindow.cpp
activation.cpp
useractions.cpp
geometry.cpp
rules.cpp
composite.cpp
toplevel.cpp
unmanaged.cpp
scene.cpp
scene_xrender.cpp
scene_opengl.cpp
scene_qpainter.cpp
thumbnailitem.cpp
lanczosfilter.cpp
deleted.cpp
effects.cpp
effectloader.cpp
compositingprefs.cpp
virtualdesktops.cpp
xcbutils.cpp
x11eventfilter.cpp
logind.cpp
screenedge.cpp
scripting/scripting.cpp
scripting/workspace_wrapper.cpp
scripting/meta.cpp
scripting/scriptedeffect.cpp
scripting/scriptingutils.cpp
scripting/timer.cpp
scripting/scripting_model.cpp
scripting/dbuscall.cpp
scripting/screenedgeitem.cpp
scripting/scripting_logging.cpp
decorations/decoratedclient.cpp
decorations/decorationbridge.cpp
decorations/decorationpalette.cpp
decorations/settings.cpp
decorations/decorationrenderer.cpp
decorations/decorations_logging.cpp
abstract_egl_backend.cpp
eglonxbackend.cpp
abstract_backend.cpp
virtual_terminal.cpp
shell_client.cpp
wayland_server.cpp
wayland_cursor_theme.cpp
)
if(HAVE_EPOXY_GLX)
set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} glxbackend.cpp)
endif()
if(KWIN_BUILD_TABBOX)
set(
kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
tabbox/tabbox.cpp
tabbox/clientmodel.cpp
tabbox/desktopchain.cpp
tabbox/desktopmodel.cpp
tabbox/switcheritem.cpp
tabbox/tabboxconfig.cpp
tabbox/tabboxhandler.cpp
tabbox/tabbox_logging.cpp
)
2013-02-25 10:14:56 +00:00
endif()
if(KWIN_BUILD_ACTIVITIES)
set(
kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
activities.cpp
)
endif()
if(UDEV_FOUND)
set(kwin_KDEINIT_SRCS
${kwin_KDEINIT_SRCS}
udev.cpp
)
endif()
if(HAVE_INPUT)
set(kwin_KDEINIT_SRCS
${kwin_KDEINIT_SRCS}
libinput/context.cpp
libinput/connection.cpp
libinput/events.cpp
libinput/libinput_logging.cpp
)
endif()
kconfig_add_kcfg_files(kwin_KDEINIT_SRCS settings.kcfgc)
qt5_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.KWin.xml dbusinterface.h KWin::DBusInterface )
qt5_add_dbus_adaptor( kwin_KDEINIT_SRCS org.kde.kwin.Compositing.xml dbusinterface.h KWin::CompositorDBusInterface )
qt5_add_dbus_adaptor( kwin_KDEINIT_SRCS ${kwin_effects_dbus_xml} effects.h KWin::EffectsHandlerImpl )
qt5_add_dbus_interface( kwin_KDEINIT_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/org.freedesktop.ScreenSaver.xml screenlocker_interface)
qt5_add_resources( kwin_KDEINIT_SRCS resources.qrc )
2015-02-19 13:38:09 +00:00
ki18n_wrap_ui(kwin_KDEINIT_SRCS
shortcutdialog.ui
)
########### target link libraries ###############
set(kwin_OWN_LIBS
kwineffects
kwinxrenderutils
kwin4_effect_builtins
)
set(kwin_QT_LIBS
Qt5::Concurrent
Qt5::DBus
Qt5::Quick
Qt5::Script
Qt5::X11Extras
)
set(kwin_KDE_LIBS
2013-12-11 20:41:47 +00:00
KF5::ConfigCore
KF5::CoreAddons
KF5::ConfigWidgets
2013-12-11 20:41:47 +00:00
KF5::Crash
2013-12-09 08:33:58 +00:00
KF5::GlobalAccel
KF5::GlobalAccelPrivate
2013-12-11 20:41:47 +00:00
KF5::I18n
KF5::Notifications
KF5::Package
KF5::Plasma
2013-12-11 20:41:47 +00:00
KF5::WindowSystem
KDecoration2::KDecoration
KDecoration2::KDecoration2Private
PW::KScreenLocker
)
set(kwin_XLIB_LIBS
${X11_X11_LIB}
${X11_ICE_LIB}
${X11_SM_LIB}
)
set(kwin_XCB_LIBS
XCB::XCB
XCB::XFIXES
XCB::DAMAGE
XCB::COMPOSITE
XCB::SHAPE
XCB::SYNC
XCB::RENDER
XCB::RANDR
XCB::KEYSYMS
XCB::SHM
2014-09-18 15:09:16 +00:00
XCB::GLX
XCB::CURSOR
)
set(kwin_WAYLAND_LIBS
XKB::XKB
KF5::WaylandClient
KF5::WaylandServer
Wayland::Cursor
${CMAKE_THREAD_LIBS_INIT}
)
if(KWIN_BUILD_ACTIVITIES)
set(kwin_KDE_LIBS ${kwin_KDE_LIBS} KF5::Activities)
2013-02-25 10:14:56 +00:00
endif()
set(kwinLibs
${kwin_OWN_LIBS}
${kwin_QT_LIBS}
${kwin_KDE_LIBS}
${kwin_XLIB_LIBS}
${kwin_XCB_LIBS}
${kwin_WAYLAND_LIBS}
)
if(UDEV_FOUND)
set(kwinLibs ${kwinLibs} ${UDEV_LIBS})
endif()
if(HAVE_INPUT)
set(kwinLibs ${kwinLibs} Libinput::Libinput)
endif()
add_library(kwin SHARED ${kwin_KDEINIT_SRCS})
set_target_properties(kwin PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
target_link_libraries(kwin ${kwinLibs})
generate_export_header(kwin EXPORT_FILE_NAME kwin_export.h)
target_link_libraries(kwin kwinglutils ${epoxy_LIBRARY})
# -ldl used by OpenGL code
find_library(DL_LIBRARY dl)
if (DL_LIBRARY)
target_link_libraries(kwin ${DL_LIBRARY})
2013-02-25 10:14:56 +00:00
endif()
kf5_add_kdeinit_executable(kwin_x11 main_x11.cpp)
target_link_libraries(kdeinit_kwin_x11 kwin)
install(TARGETS kwin ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP )
install(TARGETS kdeinit_kwin_x11 ${INSTALL_TARGETS_DEFAULT_ARGS} )
install(TARGETS kwin_x11 ${INSTALL_TARGETS_DEFAULT_ARGS} )
add_executable(kwin_wayland main_wayland.cpp)
target_link_libraries(kwin_wayland kwin)
install(TARGETS kwin_wayland ${INSTALL_TARGETS_DEFAULT_ARGS} )
add_subdirectory(backends)
add_subdirectory(plugins)
########### install files ###############
install( FILES kwin.kcfg DESTINATION ${KCFG_INSTALL_DIR} RENAME ${KWIN_NAME}.kcfg )
install( FILES kwin.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR} RENAME ${KWIN_NAME}.notifyrc)
2014-03-07 13:46:11 +00:00
install(
FILES
org.kde.KWin.xml
org.kde.kwin.Compositing.xml
org.kde.kwin.Effects.xml
DESTINATION
${KDE_INSTALL_DBUSINTERFACEDIR}
2014-03-07 13:46:11 +00:00
)
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/kwin_export.h DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel)
# Install the KWin/Script service type
install( FILES scripting/kwinscript.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} )
2014-05-22 14:38:07 +00:00
ecm_install_icons(
ICONS
16-apps-kwin.png
32-apps-kwin.png
48-apps-kwin.png
sc-apps-kwin.svgz
DESTINATION
${ICON_INSTALL_DIR}
THEME
hicolor
2014-05-22 14:38:07 +00:00
)
add_subdirectory(qml)
add_subdirectory(autotests)
add_subdirectory(tests)
if (KF5DocTools_FOUND)
add_subdirectory(doc)
endif()
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
include(ECMPackageConfigHelpers)
set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KWinDBusInterface")
ecm_configure_package_config_file(KWinDBusInterfaceConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/KWinDBusInterfaceConfig.cmake"
PATH_VARS KDE_INSTALL_DBUSINTERFACEDIR
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/KWinDBusInterfaceConfig.cmake
DESTINATION ${CMAKECONFIG_INSTALL_DIR})