diff --git a/CMakeLists.txt b/CMakeLists.txt index 765893418..0401110aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,769 +1,769 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR) project(KWin) set(PROJECT_VERSION "5.18.80") set(PROJECT_VERSION_MAJOR 5) set(QT_MIN_VERSION "5.12.0") -set(KF5_MIN_VERSION "5.66.0") +set(KF5_MIN_VERSION "5.68.0") set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH}) find_package(ECM 5.38 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 Sensors 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 NO_POLICY_SCOPE) include(KDEClangFormat) include(ECMInstallIcons) include(ECMOptionalAddSubdirectory) add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0 -DQT_USE_QSTRINGBUILDER -DQT_NO_URL_CAST_FROM_STRING) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) 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 IconThemes IdleTime Notifications Package Plasma Wayland WidgetsAddons WindowSystem ) # required frameworks by config modules find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Completion Declarative KCMUtils KIO NewStuff Service TextWidgets 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(KF5Kirigami2 ${KF5_MIN_VERSION} CONFIG) set_package_properties(KF5Kirigami2 PROPERTIES DESCRIPTION "A QtQuick based components set" PURPOSE "Required at runtime for Virtual desktop KCM and the virtual keyboard" TYPE RUNTIME ) find_package(KDecoration2 5.18.0 CONFIG REQUIRED) find_package(KScreenLocker CONFIG REQUIRED) set_package_properties(KScreenLocker PROPERTIES TYPE REQUIRED PURPOSE "For screenlocker integration in kwin_wayland" ) find_package(Breeze 5.9.0 CONFIG) set_package_properties(Breeze PROPERTIES TYPE OPTIONAL PURPOSE "For setting the default window decoration plugin" ) if (${Breeze_FOUND}) if (${BREEZE_WITH_KDECORATION}) set(HAVE_BREEZE_DECO true) else() set(HAVE_BREEZE_DECO FALSE) endif() else() set(HAVE_BREEZE_DECO FALSE) endif() add_feature_info("Breeze-Decoration" HAVE_BREEZE_DECO "Default decoration plugin Breeze") find_package(EGL) set_package_properties(EGL PROPERTIES TYPE RUNTIME PURPOSE "Required to build KWin with EGL support" ) find_package(epoxy) set_package_properties(epoxy PROPERTIES DESCRIPTION "libepoxy" URL "https://github.com/anholt/libepoxy" TYPE REQUIRED PURPOSE "OpenGL dispatch library" ) set(HAVE_DL_LIBRARY FALSE) if (epoxy_HAS_GLX) find_library(DL_LIBRARY dl) if (DL_LIBRARY) set(HAVE_DL_LIBRARY TRUE) endif() endif() find_package(Wayland 1.2 REQUIRED COMPONENTS Cursor OPTIONAL_COMPONENTS Egl) set_package_properties(Wayland PROPERTIES TYPE REQUIRED PURPOSE "Required for building KWin with Wayland support" ) add_feature_info("Wayland::EGL" Wayland_Egl_FOUND "Enable building of Wayland backend and QPA with EGL support.") set(HAVE_WAYLAND_EGL FALSE) if (Wayland_Egl_FOUND) set(HAVE_WAYLAND_EGL TRUE) endif() find_package(XKB 0.7.0) set_package_properties(XKB PROPERTIES TYPE REQUIRED PURPOSE "Required for building KWin with Wayland support" ) find_package(Libinput 1.9) set_package_properties(Libinput PROPERTIES TYPE REQUIRED PURPOSE "Required for input handling on Wayland.") find_package(UDev) set_package_properties(UDev PROPERTIES URL "https://www.freedesktop.org/wiki/Software/systemd/" DESCRIPTION "Linux device library." TYPE REQUIRED PURPOSE "Required for input handling on Wayland." ) find_package(Libdrm 2.4.62) set_package_properties(Libdrm PROPERTIES TYPE OPTIONAL PURPOSE "Required for drm output on Wayland.") set(HAVE_DRM FALSE) if (Libdrm_FOUND) set(HAVE_DRM TRUE) endif() find_package(gbm) set_package_properties(gbm PROPERTIES TYPE OPTIONAL PURPOSE "Required for egl output of drm backend.") set(HAVE_GBM FALSE) if (HAVE_DRM AND gbm_FOUND) set(HAVE_GBM TRUE) endif() option(KWIN_BUILD_EGL_STREAM_BACKEND "Enable building of EGLStream based DRM backend" ON) if (HAVE_DRM AND KWIN_BUILD_EGL_STREAM_BACKEND) set(HAVE_EGL_STREAMS 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 "https://www.x.org" TYPE REQUIRED ) add_feature_info("XInput" X11_Xinput_FOUND "Required for poll-free mouse cursor updates") set(HAVE_X11_XINPUT ${X11_Xinput_FOUND}) # All the required XCB components find_package(XCB 1.10 REQUIRED COMPONENTS COMPOSITE CURSOR DAMAGE GLX ICCCM IMAGE KEYSYMS RANDR RENDER SHAPE SHM SYNC XCB XFIXES ) 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(Qt5FontDatabaseSupport REQUIRED) find_package(Qt5ThemeSupport REQUIRED) find_package(Qt5EventDispatcherSupport REQUIRED) find_package(Freetype REQUIRED) set_package_properties(Freetype PROPERTIES DESCRIPTION "A font rendering engine" URL "https://www.freetype.org" TYPE REQUIRED PURPOSE "Needed for KWin's QPA plugin." ) find_package(Fontconfig REQUIRED) set_package_properties(Fontconfig PROPERTIES TYPE REQUIRED PURPOSE "Needed for KWin's QPA plugin." ) find_package(Xwayland) set_package_properties(Xwayland PROPERTIES URL "https://x.org" DESCRIPTION "Xwayland X server" TYPE RUNTIME PURPOSE "Needed for running kwin_wayland" ) find_package(Libcap) set_package_properties(Libcap PROPERTIES TYPE OPTIONAL PURPOSE "Needed for running kwin_wayland with real-time scheduling policy" ) set(HAVE_LIBCAP ${Libcap_FOUND}) find_package(hwdata) set_package_properties(hwdata PROPERTIES TYPE RUNTIME PURPOSE "Runtime-only dependency needed for mapping monitor hardware vendor IDs to full names" URL "https://github.com/vcrhonek/hwdata" ) include(ECMQMLModules) ecm_find_qmlmodule(QtQuick 2.3) ecm_find_qmlmodule(QtQuick.Controls 1.2) ecm_find_qmlmodule(QtQuick.Layouts 1.3) ecm_find_qmlmodule(QtQuick.VirtualKeyboard 2.1) ecm_find_qmlmodule(QtQuick.Window 2.1) ecm_find_qmlmodule(QtMultimedia 5.0) ecm_find_qmlmodule(org.kde.kquickcontrolsaddons 2.0) ecm_find_qmlmodule(org.kde.plasma.core 2.0) ecm_find_qmlmodule(org.kde.plasma.components 2.0) ########### 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) # Binary name of KWin set(KWIN_NAME "kwin") set(KWIN_INTERNAL_NAME_X11 "kwin_x11") set(KWIN_INTERNAL_NAME_WAYLAND "kwin_wayland") # 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) endif() include_directories(${XKB_INCLUDE_DIR}) include_directories(${epoxy_INCLUDE_DIR}) set(HAVE_EPOXY_GLX ${epoxy_HAS_GLX}) # 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(CheckIncludeFile) include(CheckIncludeFiles) include(CheckSymbolExists) check_include_files(unistd.h HAVE_UNISTD_H) check_include_files(malloc.h HAVE_MALLOC_H) check_include_file("sys/prctl.h" HAVE_SYS_PRCTL_H) check_symbol_exists(PR_SET_DUMPABLE "sys/prctl.h" HAVE_PR_SET_DUMPABLE) check_symbol_exists(PR_SET_PDEATHSIG "sys/prctl.h" HAVE_PR_SET_PDEATHSIG) check_include_file("sys/procctl.h" HAVE_SYS_PROCCTL_H) check_symbol_exists(PROC_TRACE_CTL "sys/procctl.h" HAVE_PROC_TRACE_CTL) if (HAVE_PR_SET_DUMPABLE OR HAVE_PROC_TRACE_CTL) set(CAN_DISABLE_PTRACE TRUE) endif() add_feature_info("prctl/procctl tracing control" CAN_DISABLE_PTRACE "Required for disallowing ptrace on kwin_wayland process") check_include_file("sys/sysmacros.h" HAVE_SYS_SYSMACROS_H) check_include_file("linux/vt.h" HAVE_LINUX_VT_H) add_feature_info("linux/vt.h" HAVE_LINUX_VT_H "Required for virtual terminal support under wayland") check_include_file("linux/fb.h" HAVE_LINUX_FB_H) add_feature_info("linux/fb.h" HAVE_LINUX_FB_H "Required for the fbdev backend") check_symbol_exists(SCHED_RESET_ON_FORK "sched.h" HAVE_SCHED_RESET_ON_FORK) add_feature_info("SCHED_RESET_ON_FORK" HAVE_SCHED_RESET_ON_FORK "Required for running kwin_wayland with real-time scheduling") 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 ${CMAKE_CURRENT_SOURCE_DIR}/platformsupport ) add_subdirectory(libkwineffects) if (KWIN_BUILD_KCMS) add_subdirectory(kcmkwin) endif() add_subdirectory(data) add_subdirectory(effects) add_subdirectory(scripts) add_subdirectory(tabbox) add_subdirectory(scripting) add_subdirectory(helpers) ########### next target ############### set(kwin_SRCS abstract_client.cpp abstract_opengl_context_attribute_builder.cpp abstract_output.cpp abstract_wayland_output.cpp activation.cpp appmenu.cpp atoms.cpp client_machine.cpp colorcorrection/clockskewnotifier.cpp colorcorrection/clockskewnotifierengine.cpp colorcorrection/colorcorrectdbusinterface.cpp colorcorrection/manager.cpp colorcorrection/suncalc.cpp composite.cpp cursor.cpp dbusinterface.cpp debug_console.cpp decorations/decoratedclient.cpp decorations/decorationbridge.cpp decorations/decorationpalette.cpp decorations/decorationrenderer.cpp decorations/decorations_logging.cpp decorations/settings.cpp deleted.cpp effectloader.cpp effects.cpp egl_context_attribute_builder.cpp events.cpp focuschain.cpp geometrytip.cpp gestures.cpp globalshortcuts.cpp group.cpp idle_inhibition.cpp input.cpp input_event.cpp input_event_spy.cpp internal_client.cpp keyboard_input.cpp keyboard_layout.cpp keyboard_layout_switching.cpp keyboard_repeat.cpp killwindow.cpp layers.cpp libinput/connection.cpp libinput/context.cpp libinput/device.cpp libinput/events.cpp libinput/libinput_logging.cpp linux_dmabuf.cpp logind.cpp main.cpp modifier_only_shortcuts.cpp moving_client_x11_filter.cpp netinfo.cpp onscreennotification.cpp options.cpp osd.cpp outline.cpp outputscreens.cpp overlaywindow.cpp placement.cpp platform.cpp pointer_input.cpp popup_input_filter.cpp rootinfo_filter.cpp rules.cpp rulebooksettings.cpp scene.cpp screenedge.cpp screenlockerwatcher.cpp screens.cpp scripting/dbuscall.cpp scripting/meta.cpp scripting/screenedgeitem.cpp scripting/scriptedeffect.cpp scripting/scripting.cpp scripting/scripting_logging.cpp scripting/scripting_model.cpp scripting/scriptingutils.cpp scripting/timer.cpp scripting/workspace_wrapper.cpp shadow.cpp sm.cpp thumbnailitem.cpp toplevel.cpp touch_hide_cursor_spy.cpp tablet_input.cpp touch_input.cpp udev.cpp unmanaged.cpp useractions.cpp utils.cpp virtualdesktops.cpp virtualdesktopsdbustypes.cpp virtualkeyboard.cpp virtualkeyboard_dbus.cpp was_user_interaction_x11_filter.cpp wayland_cursor_theme.cpp wayland_server.cpp window_property_notify_x11_filter.cpp workspace.cpp x11client.cpp x11eventfilter.cpp xcbutils.cpp xdgshellclient.cpp xkb.cpp xwl/xwayland_interface.cpp ) if (CMAKE_SYSTEM_NAME MATCHES "Linux") set(kwin_SRCS ${kwin_SRCS} colorcorrection/clockskewnotifierengine_linux.cpp ) endif() include(ECMQtDeclareLoggingCategory) ecm_qt_declare_logging_category(kwin_SRCS HEADER colorcorrect_logging.h IDENTIFIER KWIN_COLORCORRECTION CATEGORY_NAME kwin_colorcorrection DEFAULT_SEVERITY Critical ) if (KWIN_BUILD_TABBOX) include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS}) set(kwin_SRCS ${kwin_SRCS} tabbox/clientmodel.cpp tabbox/desktopchain.cpp tabbox/desktopmodel.cpp tabbox/switcheritem.cpp tabbox/tabbox.cpp tabbox/tabbox_logging.cpp tabbox/tabboxconfig.cpp tabbox/tabboxhandler.cpp tabbox/x11_filter.cpp ) endif() if (KWIN_BUILD_ACTIVITIES) set(kwin_SRCS ${kwin_SRCS} activities.cpp ) endif() if (HAVE_LINUX_VT_H) set(kwin_SRCS ${kwin_SRCS} virtual_terminal.cpp ) endif() kconfig_add_kcfg_files(kwin_SRCS settings.kcfgc) kconfig_add_kcfg_files(kwin_SRCS colorcorrection/colorcorrect_settings.kcfgc) kconfig_add_kcfg_files(kwin_SRCS rulesettings.kcfgc) kconfig_add_kcfg_files(kwin_SRCS rulebooksettingsbase.kcfgc) qt5_add_dbus_adaptor(kwin_SRCS org.kde.KWin.xml dbusinterface.h KWin::DBusInterface) qt5_add_dbus_adaptor(kwin_SRCS org.kde.kwin.Compositing.xml dbusinterface.h KWin::CompositorDBusInterface) qt5_add_dbus_adaptor(kwin_SRCS org.kde.kwin.ColorCorrect.xml colorcorrection/colorcorrectdbusinterface.h KWin::ColorCorrect::ColorCorrectDBusInterface) qt5_add_dbus_adaptor(kwin_SRCS ${kwin_effects_dbus_xml} effects.h KWin::EffectsHandlerImpl) qt5_add_dbus_adaptor(kwin_SRCS org.kde.KWin.VirtualDesktopManager.xml dbusinterface.h KWin::VirtualDesktopManagerDBusInterface) qt5_add_dbus_adaptor(kwin_SRCS org.kde.KWin.Session.xml sm.h KWin::SessionManager) qt5_add_dbus_interface(kwin_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/kf5_org.freedesktop.ScreenSaver.xml screenlocker_interface) qt5_add_dbus_interface(kwin_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/org.kde.screensaver.xml kscreenlocker_interface) qt5_add_dbus_interface(kwin_SRCS org.kde.kappmenu.xml appmenu_interface) ki18n_wrap_ui(kwin_SRCS debug_console.ui shortcutdialog.ui ) ########### target link libraries ############### set(kwin_OWN_LIBS kwineffects kwin4_effect_builtins ) set(kwin_QT_LIBS Qt5::Concurrent Qt5::DBus Qt5::Quick Qt5::Script Qt5::Sensors ) set(kwin_KDE_LIBS KF5::ConfigCore KF5::ConfigWidgets KF5::CoreAddons KF5::GlobalAccel KF5::GlobalAccelPrivate KF5::I18n KF5::Notifications KF5::Package KF5::Plasma KF5::QuickAddons KF5::WindowSystem KDecoration2::KDecoration KDecoration2::KDecoration2Private PW::KScreenLocker ) set(kwin_XLIB_LIBS ${X11_ICE_LIB} ${X11_SM_LIB} ${X11_X11_LIB} ) set(kwin_XCB_LIBS XCB::COMPOSITE XCB::DAMAGE XCB::GLX XCB::ICCCM XCB::KEYSYMS XCB::RANDR XCB::RENDER XCB::SHAPE XCB::SHM XCB::SYNC XCB::XCB XCB::XFIXES ) set(kwin_WAYLAND_LIBS KF5::WaylandClient KF5::WaylandServer Wayland::Cursor XKB::XKB ${CMAKE_THREAD_LIBS_INIT} ) if (KWIN_BUILD_ACTIVITIES) set(kwin_KDE_LIBS ${kwin_KDE_LIBS} KF5::Activities) endif() set(kwinLibs ${kwin_OWN_LIBS} ${kwin_QT_LIBS} ${kwin_KDE_LIBS} ${kwin_XLIB_LIBS} ${kwin_XCB_LIBS} ${kwin_WAYLAND_LIBS} ${UDEV_LIBS} Libinput::Libinput ) add_library(kwin SHARED ${kwin_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}) add_executable(kwin_x11 main_x11.cpp) target_link_libraries(kwin_x11 kwin KF5::Crash Qt5::X11Extras) install(TARGETS kwin ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP) install(TARGETS kwin_x11 ${INSTALL_TARGETS_DEFAULT_ARGS}) set(kwin_XWAYLAND_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/xwl/clipboard.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xwl/databridge.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xwl/dnd.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xwl/drag.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xwl/drag_wl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xwl/drag_x.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xwl/selection.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xwl/selection_source.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xwl/transfer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xwl/xwayland.cpp ) include(ECMQtDeclareLoggingCategory) ecm_qt_declare_logging_category(kwin_XWAYLAND_SRCS HEADER xwayland_logging.h IDENTIFIER KWIN_XWL CATEGORY_NAME kwin_xwl DEFAULT_SEVERITY Critical ) set(kwin_WAYLAND_SRCS main_wayland.cpp tabletmodemanager.cpp ) add_executable(kwin_wayland ${kwin_WAYLAND_SRCS} ${kwin_XWAYLAND_SRCS}) target_link_libraries(kwin_wayland kwin KF5::Crash) if (HAVE_LIBCAP) target_link_libraries(kwin_wayland ${Libcap_LIBRARIES}) endif() install(TARGETS kwin_wayland ${INSTALL_TARGETS_DEFAULT_ARGS}) if (HAVE_LIBCAP) install( CODE "execute_process( COMMAND ${SETCAP_EXECUTABLE} CAP_SYS_NICE=+ep \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_BINDIR}/kwin_wayland)" ) endif() add_subdirectory(platformsupport) add_subdirectory(plugins) ########### install files ############### install(FILES kwin.kcfg DESTINATION ${KCFG_INSTALL_DIR} RENAME ${KWIN_NAME}.kcfg) install(FILES colorcorrection/colorcorrect_settings.kcfg DESTINATION ${KCFG_INSTALL_DIR} RENAME ${KWIN_NAME}_colorcorrect.kcfg) install(FILES kwin.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR} RENAME ${KWIN_NAME}.notifyrc) install( FILES org.kde.KWin.VirtualDesktopManager.xml org.kde.KWin.xml org.kde.kwin.ColorCorrect.xml org.kde.kwin.Compositing.xml org.kde.kwin.Effects.xml DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR} ) 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}) add_subdirectory(qml) if (BUILD_TESTING) add_subdirectory(autotests) add_subdirectory(tests) endif() if (KF5DocTools_FOUND) add_subdirectory(doc) endif() add_subdirectory(kconf_update) # add clang-format target for all our real source files file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h) kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) include(CMakePackageConfigHelpers) set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/KWinDBusInterface") 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}) diff --git a/kcmkwin/kwinoptions/actions.ui b/kcmkwin/kwinoptions/actions.ui index 9a183320a..a525bb7f7 100644 --- a/kcmkwin/kwinoptions/actions.ui +++ b/kcmkwin/kwinoptions/actions.ui @@ -1,539 +1,539 @@ KWinActionsConfigForm 0 0 600 500 Inactive Inner Window Actions Qt::AlignHCenter|Qt::AlignTop &Left click: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - coWin1 + kcfg_CommandWindow1 - + In this row you can customize left click behavior when clicking into an inactive inner window ('inner' means: not titlebar, not frame). Activate, raise and pass click Activate and pass click Activate Activate and raise &Middle click: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - coWin2 + kcfg_CommandWindow2 - + In this row you can customize middle click behavior when clicking into an inactive inner window ('inner' means: not titlebar, not frame). Activate, raise and pass click Activate and pass click Activate Activate and raise &Right click: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - coWin3 + kcfg_CommandWindow3 - + In this row you can customize right click behavior when clicking into an inactive inner window ('inner' means: not titlebar, not frame). Activate, raise and pass click Activate and pass click Activate Activate and raise Mouse &wheel: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - coWinWheel + kcfg_CommandWindowWheel - + In this row you can customize behavior when scrolling into an inactive inner window ('inner' means: not titlebar, not frame). Scroll Activate and scroll Activate, raise and scroll Inner Window, Titlebar and Frame Actions Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter Mo&difier key: - coAllKey + kcfg_CommandAllKey - + Here you select whether holding the Meta key or Alt key will allow you to perform the following actions. Alt Meta 0 0 24 0 + Qt::AlignCenter L&eft click: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - coAll1 + kcfg_CommandAll1 - + In this row you can customize left click behavior when clicking into the titlebar or the frame. Move Activate, raise and move Toggle raise and lower Resize Raise Lower Minimize Decrease opacity Increase opacity Do nothing Middle &click: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - coAll2 + kcfg_CommandAll2 - + In this row you can customize middle click behavior when clicking into the titlebar or the frame. Move Activate, raise and move Toggle raise and lower Resize Raise Lower Minimize Decrease opacity Increase opacity Do nothing Right clic&k: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - coAll3 + kcfg_CommandAll3 - + In this row you can customize right click behavior when clicking into the titlebar or the frame. Move Activate, raise and move Toggle raise and lower Resize Raise Lower Minimize Decrease opacity Increase opacity Do nothing Mo&use wheel: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - coAllW + kcfg_CommandAllWheel - + Here you can customize KDE's behavior when scrolling with the mouse wheel in a window while pressing the modifier key. Raise/lower Shade/unshade Maximize/restore Keep above/below Move to previous/next desktop Change opacity Do nothing Qt::Vertical 0 0 KComboBox QComboBox
kcombobox.h
diff --git a/kcmkwin/kwinoptions/kwinoptions_settings.kcfg b/kcmkwin/kwinoptions/kwinoptions_settings.kcfg index 8a3a124aa..5ad052b04 100644 --- a/kcmkwin/kwinoptions/kwinoptions_settings.kcfg +++ b/kcmkwin/kwinoptions/kwinoptions_settings.kcfg @@ -1,62 +1,322 @@ false 10 0 100 10 0 100 0 0 100 false false 250 0 0 true + + Maximize + + + + + + + + + + + + + + + Maximize + + + + + + + + + MaximizeVerticalOnly + + + + + + + + + MaximizeVerticalOnly + + + + + + + + + + + + + Raise + + + + + + + + + + + + + + Nothing + + + + + + + + + + + + + + OperationsMenu + + + + + + + + + + + + + + Nothing + + + + + + + + + + + + + ActivateAndRaise + + + + + + + + + + + + + + + + + Nothing + + + + + + + + + + + + + + + + + OperationsMenu + + + + + + + + + + + + + + + + + ActivateRaisePassClick + + + + + + + + + + ActivatePassClick + + + + + + + + + + ActivatePassClick + + + + + + + + + + Scroll + + + + + + + + + Alt + + + + + + + + Move + + + + + + + + + + + + + + + + ToggleRaiseAndLower + + + + + + + + + + + + + + + + Resize + + + + + + + + + + + + + + + + Nothing + + + + + + + + + + + diff --git a/kcmkwin/kwinoptions/main.cpp b/kcmkwin/kwinoptions/main.cpp index 9c0b317e4..d056e5a62 100644 --- a/kcmkwin/kwinoptions/main.cpp +++ b/kcmkwin/kwinoptions/main.cpp @@ -1,253 +1,244 @@ /* * * Copyright (c) 2001 Waldo Bastian * * 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "main.h" #include //Added by qt3to4: #include #include #include #include #include #include #include #include "mouse.h" #include "windows.h" K_PLUGIN_FACTORY_DECLARATION(KWinOptionsFactory) class KFocusConfigStandalone : public KFocusConfig { Q_OBJECT public: KFocusConfigStandalone(QWidget* parent, const QVariantList &) : KFocusConfig(true, new KConfig("kwinrc"), parent) {} }; class KMovingConfigStandalone : public KMovingConfig { Q_OBJECT public: KMovingConfigStandalone(QWidget* parent, const QVariantList &) : KMovingConfig(true, parent) {} }; class KAdvancedConfigStandalone : public KAdvancedConfig { Q_OBJECT public: KAdvancedConfigStandalone(QWidget* parent, const QVariantList &) : KAdvancedConfig(true, parent) {} }; KWinOptions::KWinOptions(QWidget *parent, const QVariantList &) : KCModule(parent) { mConfig = new KConfig("kwinrc"); QVBoxLayout *layout = new QVBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); tab = new QTabWidget(this); layout->addWidget(tab); mFocus = new KFocusConfig(false, mConfig, this); mFocus->setObjectName(QLatin1String("KWin Focus Config")); tab->addTab(mFocus, i18n("&Focus")); connect(mFocus, qOverload(&KCModule::changed), this, qOverload(&KCModule::changed)); - mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, this); + mTitleBarActions = new KTitleBarActionsConfig(false, this); mTitleBarActions->setObjectName(QLatin1String("KWin TitleBar Actions")); tab->addTab(mTitleBarActions, i18n("Titlebar A&ctions")); connect(mTitleBarActions, qOverload(&KCModule::changed), this, qOverload(&KCModule::changed)); + connect(mTitleBarActions, qOverload(&KCModule::defaulted), this, qOverload(&KCModule::defaulted)); - mWindowActions = new KWindowActionsConfig(false, mConfig, this); + mWindowActions = new KWindowActionsConfig(false, this); mWindowActions->setObjectName(QLatin1String("KWin Window Actions")); tab->addTab(mWindowActions, i18n("W&indow Actions")); connect(mWindowActions, qOverload(&KCModule::changed), this, qOverload(&KCModule::changed)); + connect(mWindowActions, qOverload(&KCModule::defaulted), this, qOverload(&KCModule::defaulted)); mMoving = new KMovingConfig(false, this); mMoving->setObjectName(QLatin1String("KWin Moving")); tab->addTab(mMoving, i18n("Mo&vement")); connect(mMoving, qOverload(&KCModule::changed), this, qOverload(&KCModule::changed)); connect(mMoving, qOverload(&KCModule::defaulted), this, qOverload(&KCModule::defaulted)); mAdvanced = new KAdvancedConfig(false, this); mAdvanced->setObjectName(QLatin1String("KWin Advanced")); tab->addTab(mAdvanced, i18n("Adva&nced")); connect(mAdvanced, qOverload(&KCModule::changed), this, qOverload(&KCModule::changed)); connect(mAdvanced, qOverload(&KCModule::defaulted), this, qOverload(&KCModule::defaulted)); KAboutData *about = new KAboutData(QStringLiteral("kcmkwinoptions"), i18n("Window Behavior Configuration Module"), QString(), QString(), KAboutLicense::GPL, i18n("(c) 1997 - 2002 KWin and KControl Authors")); about->addAuthor(i18n("Matthias Ettrich"), QString(), "ettrich@kde.org"); about->addAuthor(i18n("Waldo Bastian"), QString(), "bastian@kde.org"); about->addAuthor(i18n("Cristian Tibirna"), QString(), "tibirna@kde.org"); about->addAuthor(i18n("Matthias Kalle Dalheimer"), QString(), "kalle@kde.org"); about->addAuthor(i18n("Daniel Molkentin"), QString(), "molkentin@kde.org"); about->addAuthor(i18n("Wynn Wilkes"), QString(), "wynnw@caldera.com"); about->addAuthor(i18n("Pat Dowler"), QString(), "dowler@pt1B1106.FSH.UVic.CA"); about->addAuthor(i18n("Bernd Wuebben"), QString(), "wuebben@kde.org"); about->addAuthor(i18n("Matthias Hoelzer-Kluepfel"), QString(), "hoelzer@kde.org"); setAboutData(about); } KWinOptions::~KWinOptions() { delete mConfig; } void KWinOptions::load() { mConfig->reparseConfiguration(); mFocus->load(); mTitleBarActions->load(); mWindowActions->load(); mMoving->load(); mAdvanced->load(); emit KCModule::changed(false); } void KWinOptions::save() { mFocus->save(); mTitleBarActions->save(); mWindowActions->save(); mMoving->save(); mAdvanced->save(); emit KCModule::changed(false); // Send signal to kwin mConfig->sync(); // Send signal to all kwin instances QDBusMessage message = QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); QDBusConnection::sessionBus().send(message); - - } void KWinOptions::defaults() { mFocus->defaults(); mTitleBarActions->defaults(); mWindowActions->defaults(); mMoving->defaults(); mAdvanced->defaults(); } QString KWinOptions::quickHelp() const { return i18n("

Window Behavior

Here you can customize the way windows behave when being" " moved, resized or clicked on. You can also specify a focus policy as well as a placement" " policy for new windows.

" "

Please note that this configuration will not take effect if you do not use" " KWin as your window manager. If you do use a different window manager, please refer to its documentation" " for how to customize window behavior.

"); } -void KWinOptions::moduleChanged(bool state) -{ - emit KCModule::changed(state); -} - KActionsOptions::KActionsOptions(QWidget *parent, const QVariantList &) : KCModule(parent) { mConfig = new KConfig("kwinrc"); QVBoxLayout *layout = new QVBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); tab = new QTabWidget(this); layout->addWidget(tab); - mTitleBarActions = new KTitleBarActionsConfig(false, mConfig, this); + mTitleBarActions = new KTitleBarActionsConfig(false, this); mTitleBarActions->setObjectName(QLatin1String("KWin TitleBar Actions")); tab->addTab(mTitleBarActions, i18n("&Titlebar Actions")); connect(mTitleBarActions, qOverload(&KCModule::changed), this, qOverload(&KCModule::changed)); + connect(mTitleBarActions, qOverload(&KCModule::defaulted), this, qOverload(&KCModule::defaulted)); - mWindowActions = new KWindowActionsConfig(false, mConfig, this); + mWindowActions = new KWindowActionsConfig(false, this); mWindowActions->setObjectName(QLatin1String("KWin Window Actions")); tab->addTab(mWindowActions, i18n("Window Actio&ns")); connect(mWindowActions, qOverload(&KCModule::changed), this, qOverload(&KCModule::changed)); + connect(mWindowActions, qOverload(&KCModule::defaulted), this, qOverload(&KCModule::defaulted)); } KActionsOptions::~KActionsOptions() { delete mConfig; } void KActionsOptions::load() { mTitleBarActions->load(); mWindowActions->load(); - emit KCModule::changed(false); } - void KActionsOptions::save() { mTitleBarActions->save(); mWindowActions->save(); emit KCModule::changed(false); // Send signal to kwin mConfig->sync(); // Send signal to all kwin instances QDBusMessage message = QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); QDBusConnection::sessionBus().send(message); - } - void KActionsOptions::defaults() { mTitleBarActions->defaults(); mWindowActions->defaults(); - - emit defaulted(true); } void KActionsOptions::moduleChanged(bool state) { emit KCModule::changed(state); } K_PLUGIN_FACTORY_DEFINITION(KWinOptionsFactory, registerPlugin("kwinactions"); registerPlugin("kwinfocus"); registerPlugin("kwinmoving"); registerPlugin("kwinadvanced"); registerPlugin("kwinoptions"); ) #include "main.moc" #include "moc_main.cpp" diff --git a/kcmkwin/kwinoptions/main.h b/kcmkwin/kwinoptions/main.h index 903cd720c..50a8bcd8a 100644 --- a/kcmkwin/kwinoptions/main.h +++ b/kcmkwin/kwinoptions/main.h @@ -1,99 +1,93 @@ /* * main.h * * Copyright (c) 2001 Waldo Bastian * * Requires the Qt widget libraries, available at no cost at * https://www.qt.io/ * * 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __MAIN_H__ #define __MAIN_H__ #include #include class KConfig; class KFocusConfig; class KTitleBarActionsConfig; class KWindowActionsConfig; class KAdvancedConfig; class KMovingConfig; class KWinOptions : public KCModule { Q_OBJECT public: KWinOptions(QWidget *parent, const QVariantList &args); ~KWinOptions() override; void load() override; void save() override; void defaults() override; QString quickHelp() const override; - -protected Q_SLOTS: - - void moduleChanged(bool state); - - private: QTabWidget *tab; KFocusConfig *mFocus; KTitleBarActionsConfig *mTitleBarActions; KWindowActionsConfig *mWindowActions; KMovingConfig *mMoving; KAdvancedConfig *mAdvanced; KConfig *mConfig; }; class KActionsOptions : public KCModule { Q_OBJECT public: KActionsOptions(QWidget *parent, const QVariantList &args); ~KActionsOptions() override; void load() override; void save() override; void defaults() override; protected Q_SLOTS: void moduleChanged(bool state); private: QTabWidget *tab; KTitleBarActionsConfig *mTitleBarActions; KWindowActionsConfig *mWindowActions; KConfig *mConfig; }; #endif diff --git a/kcmkwin/kwinoptions/mouse.cpp b/kcmkwin/kwinoptions/mouse.cpp index 10626f88b..8be4dc6ff 100644 --- a/kcmkwin/kwinoptions/mouse.cpp +++ b/kcmkwin/kwinoptions/mouse.cpp @@ -1,562 +1,223 @@ /* * * Copyright (c) 1998 Matthias Ettrich * * 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mouse.h" #include #include #include #include #include #include #include #include #include #include -#include -#include #include #include #include #include #include +#include "kwinoptions_settings.h" + namespace { -char const * const cnf_Max[] = { - "MaximizeButtonLeftClickCommand", - "MaximizeButtonMiddleClickCommand", - "MaximizeButtonRightClickCommand", -}; - -char const * const tbl_Max[] = { - "Maximize", - "Maximize (vertical only)", - "Maximize (horizontal only)", - "" -}; - QPixmap maxButtonPixmaps[3]; void createMaxButtonPixmaps() { - char const * maxButtonXpms[][3 + 13] = { + char const *maxButtonXpms[][3 + 13] = { { nullptr, nullptr, nullptr, "...............", ".......#.......", "......###......", ".....#####.....", "..#....#....#..", ".##....#....##.", "###############", ".##....#....##.", "..#....#....#..", ".....#####.....", "......###......", ".......#.......", "..............." }, { nullptr, nullptr, nullptr, "...............", ".......#.......", "......###......", ".....#####.....", ".......#.......", ".......#.......", ".......#.......", ".......#.......", ".......#.......", ".....#####.....", "......###......", ".......#.......", "..............." }, { nullptr, nullptr, nullptr, "...............", "...............", "...............", "...............", "..#.........#..", ".##.........##.", "###############", ".##.........##.", "..#.........#..", "...............", "...............", "...............", "..............." }, }; QByteArray baseColor(". c " + KColorScheme(QPalette::Active, KColorScheme::View).background().color().name().toLatin1()); QByteArray textColor("# c " + KColorScheme(QPalette::Active, KColorScheme::View).foreground().color().name().toLatin1()); for (int t = 0; t < 3; ++t) { maxButtonXpms[t][0] = "15 13 2 1"; maxButtonXpms[t][1] = baseColor.constData(); maxButtonXpms[t][2] = textColor.constData(); maxButtonPixmaps[t] = QPixmap(maxButtonXpms[t]); maxButtonPixmaps[t].setMask(maxButtonPixmaps[t].createHeuristicMask()); } } } // namespace KWinMouseConfigForm::KWinMouseConfigForm(QWidget *parent) : QWidget(parent) { setupUi(parent); } KWinActionsConfigForm::KWinActionsConfigForm(QWidget *parent) : QWidget(parent) { setupUi(parent); } void KTitleBarActionsConfig::paletteChanged() { createMaxButtonPixmaps(); for (int i=0; i<3; ++i) { - m_ui->leftClickMaximizeButton->setItemIcon(i, maxButtonPixmaps[i]); - m_ui->middleClickMaximizeButton->setItemIcon(i, maxButtonPixmaps[i]); - m_ui->rightClickMaximizeButton->setItemIcon(i, maxButtonPixmaps[i]); + m_ui->kcfg_MaximizeButtonLeftClickCommand->setItemIcon(i, maxButtonPixmaps[i]); + m_ui->kcfg_MaximizeButtonMiddleClickCommand->setItemIcon(i, maxButtonPixmaps[i]); + m_ui->kcfg_MaximizeButtonRightClickCommand->setItemIcon(i, maxButtonPixmaps[i]); } } -KTitleBarActionsConfig::KTitleBarActionsConfig(bool _standAlone, KConfig *_config, QWidget * parent) - : KCModule(parent), config(_config), standAlone(_standAlone) +KTitleBarActionsConfig::KTitleBarActionsConfig(bool _standAlone, QWidget *parent) + : KCModule(parent), standAlone(_standAlone) , m_ui(new KWinMouseConfigForm(this)) { + addConfig(KWinOptionsSettings::self(), this); + // create the items for the maximize button actions createMaxButtonPixmaps(); for (int i=0; i<3; ++i) { - m_ui->leftClickMaximizeButton->addItem(maxButtonPixmaps[i], QString()); - m_ui->middleClickMaximizeButton->addItem(maxButtonPixmaps[i], QString()); - m_ui->rightClickMaximizeButton->addItem(maxButtonPixmaps[i], QString()); + m_ui->kcfg_MaximizeButtonLeftClickCommand->addItem(maxButtonPixmaps[i], QString()); + m_ui->kcfg_MaximizeButtonMiddleClickCommand->addItem(maxButtonPixmaps[i], QString()); + m_ui->kcfg_MaximizeButtonRightClickCommand->addItem(maxButtonPixmaps[i], QString()); } - createMaximizeButtonTooltips(m_ui->leftClickMaximizeButton); - createMaximizeButtonTooltips(m_ui->middleClickMaximizeButton); - createMaximizeButtonTooltips(m_ui->rightClickMaximizeButton); - - connect(m_ui->coTiDbl, SIGNAL(activated(int)), SLOT(changed())); - connect(m_ui->coTiAct1, SIGNAL(activated(int)), SLOT(changed())); - connect(m_ui->coTiAct2, SIGNAL(activated(int)), SLOT(changed())); - connect(m_ui->coTiAct3, SIGNAL(activated(int)), SLOT(changed())); - connect(m_ui->coTiAct4, SIGNAL(activated(int)), SLOT(changed())); - connect(m_ui->coTiInAct1, SIGNAL(activated(int)), SLOT(changed())); - connect(m_ui->coTiInAct2, SIGNAL(activated(int)), SLOT(changed())); - connect(m_ui->coTiInAct3, SIGNAL(activated(int)), SLOT(changed())); - connect(m_ui->leftClickMaximizeButton, SIGNAL(activated(int)), SLOT(changed())); - connect(m_ui->middleClickMaximizeButton, SIGNAL(activated(int)), SLOT(changed())); - connect(m_ui->rightClickMaximizeButton, SIGNAL(activated(int)), SLOT(changed())); + createMaximizeButtonTooltips(m_ui->kcfg_MaximizeButtonLeftClickCommand); + createMaximizeButtonTooltips(m_ui->kcfg_MaximizeButtonMiddleClickCommand); + createMaximizeButtonTooltips(m_ui->kcfg_MaximizeButtonRightClickCommand); load(); } -KTitleBarActionsConfig::~KTitleBarActionsConfig() -{ - if (standAlone) - delete config; -} - void KTitleBarActionsConfig::createMaximizeButtonTooltips(KComboBox *combo) { combo->setItemData(0, i18n("Maximize"), Qt::ToolTipRole); combo->setItemData(1, i18n("Maximize (vertical only)"), Qt::ToolTipRole); combo->setItemData(2, i18n("Maximize (horizontal only)"), Qt::ToolTipRole); } -// do NOT change the texts below, they are written to config file -// and are not shown in the GUI -// they have to match the order of items in GUI elements though -const char* const tbl_TiDbl[] = { - "Maximize", - "Maximize (vertical only)", - "Maximize (horizontal only)", - "Minimize", - "Shade", - "Lower", - "Close", - "OnAllDesktops", - "Nothing", - "" -}; - -const char* const tbl_TiAc[] = { - "Raise", - "Lower", - "Toggle raise and lower", - "Minimize", - "Shade", - "Close", - "Operations menu", - "Nothing", - "" -}; - -const char* const tbl_TiInAc[] = { - "Activate and raise", - "Activate and lower", - "Activate", - "Raise", - "Lower", - "Toggle raise and lower", - "Minimize", - "Shade", - "Close", - "Operations menu", - "Nothing", - "" -}; - -const char* const tbl_Win[] = { - "Activate, raise and pass click", - "Activate and pass click", - "Activate", - "Activate and raise", - "" -}; - -const char* const tbl_WinWheel[] = { - "Scroll", - "Activate and scroll", - "Activate, raise and scroll", - "" -}; - -const char* const tbl_AllKey[] = { - "Alt", - "Meta", - "" -}; - -const char* const tbl_All[] = { - "Move", - "Activate, raise and move", - "Toggle raise and lower", - "Resize", - "Raise", - "Lower", - "Minimize", - "Decrease Opacity", - "Increase Opacity", - "Nothing", - "" -}; - -const char* const tbl_TiWAc[] = { - "Raise/Lower", - "Shade/Unshade", - "Maximize/Restore", - "Above/Below", - "Previous/Next Desktop", - "Change Opacity", - "Nothing", - "" -}; - -const char* const tbl_AllW[] = { - "Raise/Lower", - "Shade/Unshade", - "Maximize/Restore", - "Above/Below", - "Previous/Next Desktop", - "Change Opacity", - "Nothing", - "" -}; - -static const char* tbl_num_lookup(const char* const arr[], int pos) -{ - for (int i = 0; - arr[ i ][ 0 ] != '\0' && pos >= 0; - ++i) { - if (pos == 0) - return arr[ i ]; - --pos; - } - abort(); // should never happen this way -} - -static int tbl_txt_lookup(const char* const arr[], const char* txt) -{ - int pos = 0; - for (int i = 0; - arr[ i ][ 0 ] != '\0'; - ++i) { - if (qstricmp(txt, arr[ i ]) == 0) - return pos; - ++pos; - } - return 0; -} - -void KTitleBarActionsConfig::setComboText(KComboBox* combo, const char*txt) -{ - if (combo == m_ui->coTiDbl) - combo->setCurrentIndex(tbl_txt_lookup(tbl_TiDbl, txt)); - else if (combo == m_ui->coTiAct1 || combo == m_ui->coTiAct2 || combo == m_ui->coTiAct3) - combo->setCurrentIndex(tbl_txt_lookup(tbl_TiAc, txt)); - else if (combo == m_ui->coTiInAct1 || combo == m_ui->coTiInAct2 || combo == m_ui->coTiInAct3) - combo->setCurrentIndex(tbl_txt_lookup(tbl_TiInAc, txt)); - else if (combo == m_ui->coTiAct4) - combo->setCurrentIndex(tbl_txt_lookup(tbl_TiWAc, txt)); - else if (combo == m_ui->leftClickMaximizeButton || - combo == m_ui->middleClickMaximizeButton || - combo == m_ui->rightClickMaximizeButton) { - combo->setCurrentIndex(tbl_txt_lookup(tbl_Max, txt)); - } else - abort(); -} - -const char* KTitleBarActionsConfig::functionTiDbl(int i) -{ - return tbl_num_lookup(tbl_TiDbl, i); -} - -const char* KTitleBarActionsConfig::functionTiAc(int i) -{ - return tbl_num_lookup(tbl_TiAc, i); -} - -const char* KTitleBarActionsConfig::functionTiInAc(int i) -{ - return tbl_num_lookup(tbl_TiInAc, i); -} - -const char* KTitleBarActionsConfig::functionTiWAc(int i) -{ - return tbl_num_lookup(tbl_TiWAc, i); -} - -const char* KTitleBarActionsConfig::functionMax(int i) -{ - return tbl_num_lookup(tbl_Max, i); -} - void KTitleBarActionsConfig::showEvent(QShowEvent *ev) { if (!standAlone) { // Workaround KCModule::showEvent() calling load(), see bug 163817 QWidget::showEvent(ev); return; } KCModule::showEvent(ev); } void KTitleBarActionsConfig::changeEvent(QEvent *ev) { if (ev->type() == QEvent::PaletteChange) { paletteChanged(); } ev->accept(); } - -void KTitleBarActionsConfig::load() -{ - KConfigGroup windowsConfig(config, "Windows"); - setComboText(m_ui->coTiDbl, windowsConfig.readEntry("TitlebarDoubleClickCommand", "Maximize").toLatin1()); - setComboText(m_ui->leftClickMaximizeButton, windowsConfig.readEntry(cnf_Max[0], tbl_Max[0]).toLatin1()); - setComboText(m_ui->middleClickMaximizeButton, windowsConfig.readEntry(cnf_Max[1], tbl_Max[1]).toLatin1()); - setComboText(m_ui->rightClickMaximizeButton, windowsConfig.readEntry(cnf_Max[2], tbl_Max[2]).toLatin1()); - - KConfigGroup cg(config, "MouseBindings"); - setComboText(m_ui->coTiAct1, cg.readEntry("CommandActiveTitlebar1", "Raise").toLatin1()); - setComboText(m_ui->coTiAct2, cg.readEntry("CommandActiveTitlebar2", "Nothing").toLatin1()); - setComboText(m_ui->coTiAct3, cg.readEntry("CommandActiveTitlebar3", "Operations menu").toLatin1()); - setComboText(m_ui->coTiAct4, cg.readEntry("CommandTitlebarWheel", "Nothing").toLatin1()); - setComboText(m_ui->coTiInAct1, cg.readEntry("CommandInactiveTitlebar1", "Activate and raise").toLatin1()); - setComboText(m_ui->coTiInAct2, cg.readEntry("CommandInactiveTitlebar2", "Nothing").toLatin1()); - setComboText(m_ui->coTiInAct3, cg.readEntry("CommandInactiveTitlebar3", "Operations menu").toLatin1()); -} - void KTitleBarActionsConfig::save() { - KConfigGroup windowsConfig(config, "Windows"); - windowsConfig.writeEntry("TitlebarDoubleClickCommand", functionTiDbl(m_ui->coTiDbl->currentIndex())); - windowsConfig.writeEntry(cnf_Max[0], functionMax(m_ui->leftClickMaximizeButton->currentIndex())); - windowsConfig.writeEntry(cnf_Max[1], functionMax(m_ui->middleClickMaximizeButton->currentIndex())); - windowsConfig.writeEntry(cnf_Max[2], functionMax(m_ui->rightClickMaximizeButton->currentIndex())); - - KConfigGroup cg(config, "MouseBindings"); - cg.writeEntry("CommandActiveTitlebar1", functionTiAc(m_ui->coTiAct1->currentIndex())); - cg.writeEntry("CommandActiveTitlebar2", functionTiAc(m_ui->coTiAct2->currentIndex())); - cg.writeEntry("CommandActiveTitlebar3", functionTiAc(m_ui->coTiAct3->currentIndex())); - cg.writeEntry("CommandInactiveTitlebar1", functionTiInAc(m_ui->coTiInAct1->currentIndex())); - cg.writeEntry("CommandTitlebarWheel", functionTiWAc(m_ui->coTiAct4->currentIndex())); - cg.writeEntry("CommandInactiveTitlebar2", functionTiInAc(m_ui->coTiInAct2->currentIndex())); - cg.writeEntry("CommandInactiveTitlebar3", functionTiInAc(m_ui->coTiInAct3->currentIndex())); + KCModule::save(); if (standAlone) { - config->sync(); // Send signal to all kwin instances QDBusMessage message = QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); QDBusConnection::sessionBus().send(message); - } } -void KTitleBarActionsConfig::defaults() -{ - setComboText(m_ui->coTiDbl, "Maximize"); - setComboText(m_ui->coTiAct1, "Raise"); - setComboText(m_ui->coTiAct2, "Nothing"); - setComboText(m_ui->coTiAct3, "Operations menu"); - setComboText(m_ui->coTiAct4, "Nothing"); - setComboText(m_ui->coTiInAct1, "Activate and raise"); - setComboText(m_ui->coTiInAct2, "Nothing"); - setComboText(m_ui->coTiInAct3, "Operations menu"); - setComboText(m_ui->leftClickMaximizeButton, tbl_Max[0]); - setComboText(m_ui->middleClickMaximizeButton, tbl_Max[1]); - setComboText(m_ui->rightClickMaximizeButton, tbl_Max[2]); -} - - -KWindowActionsConfig::KWindowActionsConfig(bool _standAlone, KConfig *_config, QWidget * parent) - : KCModule(parent), config(_config), standAlone(_standAlone) +KWindowActionsConfig::KWindowActionsConfig(bool _standAlone, QWidget *parent) + : KCModule(parent), standAlone(_standAlone) , m_ui(new KWinActionsConfigForm(this)) { - connect(m_ui->coWin1, SIGNAL(activated(int)), SLOT(changed())); - connect(m_ui->coWin2, SIGNAL(activated(int)), SLOT(changed())); - connect(m_ui->coWin3, SIGNAL(activated(int)), SLOT(changed())); - connect(m_ui->coWinWheel, SIGNAL(activated(int)), SLOT(changed())); - connect(m_ui->coAllKey, SIGNAL(activated(int)), SLOT(changed())); - connect(m_ui->coAll1, SIGNAL(activated(int)), SLOT(changed())); - connect(m_ui->coAll2, SIGNAL(activated(int)), SLOT(changed())); - connect(m_ui->coAll3, SIGNAL(activated(int)), SLOT(changed())); - connect(m_ui->coAllW, SIGNAL(activated(int)), SLOT(changed())); + addConfig(KWinOptionsSettings::self(), this); load(); } -KWindowActionsConfig::~KWindowActionsConfig() -{ - if (standAlone) - delete config; -} - -void KWindowActionsConfig::setComboText(KComboBox* combo, const char*txt) -{ - if (combo == m_ui->coWin1 || combo == m_ui->coWin2 || combo == m_ui->coWin3) - combo->setCurrentIndex(tbl_txt_lookup(tbl_Win, txt)); - else if (combo == m_ui->coWinWheel) - combo->setCurrentIndex(tbl_txt_lookup(tbl_WinWheel, txt)); - else if (combo == m_ui->coAllKey) - combo->setCurrentIndex(tbl_txt_lookup(tbl_AllKey, txt)); - else if (combo == m_ui->coAll1 || combo == m_ui->coAll2 || combo == m_ui->coAll3) - combo->setCurrentIndex(tbl_txt_lookup(tbl_All, txt)); - else if (combo == m_ui->coAllW) - combo->setCurrentIndex(tbl_txt_lookup(tbl_AllW, txt)); - else - abort(); -} - -const char* KWindowActionsConfig::functionWin(int i) -{ - return tbl_num_lookup(tbl_Win, i); -} - -const char* KWindowActionsConfig::functionWinWheel(int i) -{ - return tbl_num_lookup(tbl_WinWheel, i); -} - -const char* KWindowActionsConfig::functionAllKey(int i) -{ - return tbl_num_lookup(tbl_AllKey, i); -} - -const char* KWindowActionsConfig::functionAll(int i) -{ - return tbl_num_lookup(tbl_All, i); -} - -const char* KWindowActionsConfig::functionAllW(int i) -{ - return tbl_num_lookup(tbl_AllW, i); -} - void KWindowActionsConfig::showEvent(QShowEvent *ev) { if (!standAlone) { QWidget::showEvent(ev); return; } KCModule::showEvent(ev); } -void KWindowActionsConfig::load() -{ - KConfigGroup cg(config, "MouseBindings"); - setComboText(m_ui->coWin1, cg.readEntry("CommandWindow1", "Activate, raise and pass click").toLatin1()); - setComboText(m_ui->coWin2, cg.readEntry("CommandWindow2", "Activate and pass click").toLatin1()); - setComboText(m_ui->coWin3, cg.readEntry("CommandWindow3", "Activate and pass click").toLatin1()); - setComboText(m_ui->coWinWheel, cg.readEntry("CommandWindowWheel", "Scroll").toLatin1()); - setComboText(m_ui->coAllKey, cg.readEntry("CommandAllKey", "Alt").toLatin1()); - setComboText(m_ui->coAll1, cg.readEntry("CommandAll1", "Move").toLatin1()); - setComboText(m_ui->coAll2, cg.readEntry("CommandAll2", "Toggle raise and lower").toLatin1()); - setComboText(m_ui->coAll3, cg.readEntry("CommandAll3", "Resize").toLatin1()); - setComboText(m_ui->coAllW, cg.readEntry("CommandAllWheel", "Nothing").toLatin1()); -} - void KWindowActionsConfig::save() { - KConfigGroup cg(config, "MouseBindings"); - cg.writeEntry("CommandWindow1", functionWin(m_ui->coWin1->currentIndex())); - cg.writeEntry("CommandWindow2", functionWin(m_ui->coWin2->currentIndex())); - cg.writeEntry("CommandWindow3", functionWin(m_ui->coWin3->currentIndex())); - cg.writeEntry("CommandWindowWheel", functionWinWheel(m_ui->coWinWheel->currentIndex())); - cg.writeEntry("CommandAllKey", functionAllKey(m_ui->coAllKey->currentIndex())); - cg.writeEntry("CommandAll1", functionAll(m_ui->coAll1->currentIndex())); - cg.writeEntry("CommandAll2", functionAll(m_ui->coAll2->currentIndex())); - cg.writeEntry("CommandAll3", functionAll(m_ui->coAll3->currentIndex())); - cg.writeEntry("CommandAllWheel", functionAllW(m_ui->coAllW->currentIndex())); + KCModule::save(); if (standAlone) { - config->sync(); // Send signal to all kwin instances QDBusMessage message = QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig"); QDBusConnection::sessionBus().send(message); } } - -void KWindowActionsConfig::defaults() -{ - setComboText(m_ui->coWin1, "Activate, raise and pass click"); - setComboText(m_ui->coWin2, "Activate and pass click"); - setComboText(m_ui->coWin3, "Activate and pass click"); - setComboText(m_ui->coWinWheel, "Scroll"); - setComboText(m_ui->coAllKey, "Alt"); - setComboText(m_ui->coAll1, "Move"); - setComboText(m_ui->coAll2, "Toggle raise and lower"); - setComboText(m_ui->coAll3, "Resize"); - setComboText(m_ui->coAllW, "Nothing"); -} diff --git a/kcmkwin/kwinoptions/mouse.h b/kcmkwin/kwinoptions/mouse.h index 1dee6eb34..cbb5f4352 100644 --- a/kcmkwin/kwinoptions/mouse.h +++ b/kcmkwin/kwinoptions/mouse.h @@ -1,132 +1,96 @@ /* * mouse.h * * Copyright (c) 1998 Matthias Ettrich * * * 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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __KKWMMOUSECONFIG_H__ #define __KKWMMOUSECONFIG_H__ class KConfig; #include #include #include #include "ui_actions.h" #include "ui_mouse.h" class KWinMouseConfigForm : public QWidget, public Ui::KWinMouseConfigForm { Q_OBJECT public: explicit KWinMouseConfigForm(QWidget* parent); }; class KWinActionsConfigForm : public QWidget, public Ui::KWinActionsConfigForm { Q_OBJECT public: explicit KWinActionsConfigForm(QWidget* parent); }; class KTitleBarActionsConfig : public KCModule { Q_OBJECT public: - KTitleBarActionsConfig(bool _standAlone, KConfig *_config, QWidget *parent); - ~KTitleBarActionsConfig() override; + KTitleBarActionsConfig(bool _standAlone, QWidget *parent); - void load() override; void save() override; - void defaults() override; protected: void showEvent(QShowEvent *ev) override; void changeEvent(QEvent *ev) override; -public Q_SLOTS: - void changed() { - emit KCModule::changed(true); - } - private: - - KConfig *config; bool standAlone; KWinMouseConfigForm *m_ui; - const char* functionTiDbl(int); - const char* functionTiAc(int); - const char* functionTiWAc(int); - const char* functionTiInAc(int); - const char* functionMax(int); - - void setComboText(KComboBox* combo, const char* text); void createMaximizeButtonTooltips(KComboBox* combo); - const char* fixup(const char* s); private Q_SLOTS: void paletteChanged(); }; class KWindowActionsConfig : public KCModule { Q_OBJECT public: - KWindowActionsConfig(bool _standAlone, KConfig *_config, QWidget *parent); - ~KWindowActionsConfig() override; + KWindowActionsConfig(bool _standAlone, QWidget *parent); - void load() override; void save() override; - void defaults() override; protected: void showEvent(QShowEvent *ev) override; -public Q_SLOTS: - void changed() { - emit KCModule::changed(true); - } - private: - KConfig *config; bool standAlone; KWinActionsConfigForm *m_ui; - - const char* functionWin(int); - const char* functionWinWheel(int); - const char* functionAllKey(int); - const char* functionAll(int); - const char* functionAllW(int); - - void setComboText(KComboBox* combo, const char* text); - const char* fixup(const char* s); }; #endif diff --git a/kcmkwin/kwinoptions/mouse.ui b/kcmkwin/kwinoptions/mouse.ui index 4de09409b..c600d313a 100644 --- a/kcmkwin/kwinoptions/mouse.ui +++ b/kcmkwin/kwinoptions/mouse.ui @@ -1,713 +1,713 @@ KWinMouseConfigForm 0 0 600 500 Titlebar Actions Qt::AlignHCenter|Qt::AlignTop &Double-click: - coTiDbl + kcfg_TitlebarDoubleClickCommand - + Behavior on <em>double</em> click into the titlebar. Maximize Maximize (vertical only) Maximize (horizontal only) Minimize Shade Lower Close Show on all desktops Do nothing Mouse &wheel: - coTiAct4 + kcfg_CommandTitlebarWheel - + Behavior on <em>mouse wheel</em> scroll over the titlebar. Raise/lower Shade/unshade Maximize/restore Keep above/below Move to previous/next desktop Change opacity Do nothing Titlebar and Frame Actions Qt::AlignCenter Qt::Horizontal 0 0 Active Qt::AlignCenter &Left click: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - coTiAct1 + kcfg_CommandActiveTitlebar1 Inactive Qt::AlignCenter &Middle click: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - coTiAct2 + kcfg_CommandActiveTitlebar2 &Right click: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - coTiAct3 + kcfg_CommandActiveTitlebar3 - + 0 0 Behavior on <em>left</em> click into the titlebar or frame of an <em>active</em> window. Raise Lower Toggle raise and lower Minimize Shade Close Show actions menu Do nothing - + Behavior on <em>left</em> click into the titlebar or frame of an <em>inactive</em> window. Activate and raise Activate and lower Activate Raise Lower Toggle raise and lower Minimize Shade Close Show actions menu Do nothing - + 0 0 Behavior on <em>left</em> click into the titlebar or frame of an <em>active</em> window. Raise Lower Toggle raise and lower Minimize Shade Close Show actions menu Do nothing - + Behavior on <em>left</em> click into the titlebar or frame of an <em>inactive</em> window. Activate and raise Activate and lower Activate Raise Lower Toggle raise and lower Minimize Shade Close Show actions menu Do nothing - + 0 0 Behavior on <em>left</em> click into the titlebar or frame of an <em>active</em> window. Raise Lower Toggle raise and lower Minimize Shade Close Show actions menu Do nothing - + Behavior on <em>left</em> click into the titlebar or frame of an <em>inactive</em> window. Activate and raise Activate and lower Activate Raise Lower Toggle raise and lower Minimize Shade Close Show actions menu Do nothing Qt::Horizontal 0 0 Maximize Button Actions Qt::AlignHCenter|Qt::AlignTop Behavior on <em>left</em> click onto the maximize button. L&eft click: - leftClickMaximizeButton + kcfg_MaximizeButtonLeftClickCommand - + 0 0 Behavior on <em>left</em> click onto the maximize button. Behavior on <em>middle</em> click onto the maximize button. Middle c&lick: - middleClickMaximizeButton + kcfg_MaximizeButtonMiddleClickCommand - + 0 0 Behavior on <em>middle</em> click onto the maximize button. Behavior on <em>right</em> click onto the maximize button. Right clic&k: - rightClickMaximizeButton + kcfg_MaximizeButtonRightClickCommand - + 0 0 Behavior on <em>right</em> click onto the maximize button. Qt::Vertical 0 0 KComboBox QComboBox
kcombobox.h
- coTiDbl - coTiAct4 - coTiAct1 - coTiInAct1 - coTiAct2 - coTiInAct2 - coTiAct3 - coTiInAct3 - leftClickMaximizeButton - middleClickMaximizeButton - rightClickMaximizeButton + kcfg_TitlebarDoubleClickCommand + kcfg_CommandTitlebarWheel + kcfg_CommandActiveTitlebar1 + kcfg_CommandInactiveTitlebar1 + kcfg_CommandActiveTitlebar2 + kcfg_CommandInactiveTitlebar2 + kcfg_CommandActiveTitlebar3 + kcfg_CommandInactiveTitlebar3 + kcfg_MaximizeButtonLeftClickCommand + kcfg_MaximizeButtonMiddleClickCommand + kcfg_MaximizeButtonRightClickCommand