fix: untrack ALL upstream KWin source — only recipe.toml + README.md retained
git rm all tracked files under local/recipes/kde/kwin/ except recipe.toml and README.md. Added to .gitignore: local/recipes/kde/kwin/* with exclusions for recipe.toml and README.md. Zero tracked kwin_wayland_wrapper references in Red Bear source tree.
This commit is contained in:
@@ -1,86 +0,0 @@
|
||||
---
|
||||
---
|
||||
# SPDX-FileCopyrightText: 2019 Christoph Cullmann <cullmann@kde.org>
|
||||
# SPDX-FileCopyrightText: 2019 Gernot Gebhard <gebhard@absint.com>
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
---
|
||||
Language: JavaScript
|
||||
DisableFormat: true
|
||||
---
|
||||
|
||||
# Style for C++
|
||||
Language: Cpp
|
||||
Standard: c++20
|
||||
|
||||
# base is WebKit coding style: https://webkit.org/code-style-guidelines/
|
||||
# below are only things set that diverge from this style!
|
||||
BasedOnStyle: WebKit
|
||||
|
||||
# 4 spaces indent
|
||||
TabWidth: 4
|
||||
|
||||
# No line limit
|
||||
ColumnLimit: 0
|
||||
|
||||
# sort includes inside line separated groups
|
||||
SortIncludes: true
|
||||
|
||||
# Braces are usually attached, but not after functions or class declarations.
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
AfterClass: true
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: true
|
||||
AfterUnion: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
|
||||
# CrlInstruction *a;
|
||||
PointerAlignment: Right
|
||||
|
||||
# horizontally aligns arguments after an open bracket.
|
||||
AlignAfterOpenBracket: Align
|
||||
|
||||
# don't move all parameters to new line
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
|
||||
# no single line functions
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
|
||||
# In case we have an if statement with multiple lines the operator should be at the beginning of the line
|
||||
# but we do not want to break assignments
|
||||
BreakBeforeBinaryOperators: NonAssignment
|
||||
|
||||
# format C++11 braced lists like function calls
|
||||
Cpp11BracedListStyle: true
|
||||
|
||||
# do not put a space before C++11 braced lists
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
|
||||
# no namespace indentation to keep indent level low
|
||||
NamespaceIndentation: None
|
||||
|
||||
# we use template< without space.
|
||||
SpaceAfterTemplateKeyword: false
|
||||
|
||||
# Always break after template declaration
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
|
||||
# macros for which the opening brace stays attached.
|
||||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE , wl_resource_for_each, wl_resource_for_each_safe ]
|
||||
|
||||
# keep lambda formatting multi-line if not empty
|
||||
AllowShortLambdasOnASingleLine: Empty
|
||||
|
||||
# We do not want clang-format to put all arguments on a new line
|
||||
AllowAllArgumentsOnNextLine: false
|
||||
|
||||
# Indent lambdas to the start of the line, not to the start of the lambda
|
||||
LambdaBodyIndentation: OuterScope
|
||||
@@ -1,28 +0,0 @@
|
||||
# Ignore the following files
|
||||
.vscode
|
||||
*~
|
||||
*.[oa]
|
||||
*.diff
|
||||
*.kate-swp
|
||||
*.kdev4
|
||||
.kdev_include_paths
|
||||
*.kdevelop.pcs
|
||||
*.moc
|
||||
*.moc.cpp
|
||||
*.orig
|
||||
*.user
|
||||
.*.swp
|
||||
.swp.*
|
||||
Doxyfile
|
||||
Makefile
|
||||
avail
|
||||
random_seed
|
||||
/build*/
|
||||
CMakeLists.txt.user*
|
||||
*.unc-backup*
|
||||
/compile_commands.json
|
||||
.clangd
|
||||
.idea
|
||||
/cmake-build*
|
||||
.cache
|
||||
.directory
|
||||
@@ -1,14 +0,0 @@
|
||||
# SPDX-FileCopyrightText: None
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
include:
|
||||
- project: sysadmin/ci-utilities
|
||||
file:
|
||||
- /gitlab-templates/linux-qt6.yml
|
||||
- /gitlab-templates/freebsd-qt6.yml
|
||||
|
||||
suse_tumbleweed_qt68_reduced_featureset:
|
||||
extends: suse_tumbleweed_qt68
|
||||
script:
|
||||
- git config --global --add safe.directory $CI_PROJECT_DIR
|
||||
- python3 -u ci-utilities/run-ci-build.py --project $CI_PROJECT_NAME --branch $CI_COMMIT_REF_NAME --platform Linux --extra-cmake-args="-DKWIN_BUILD_KCMS=OFF -DKWIN_BUILD_SCREENLOCKER=OFF -DKWIN_BUILD_TABBOX=OFF -DKWIN_BUILD_ACTIVITIES=OFF -DKWIN_BUILD_RUNNERS=OFF -DKWIN_BUILD_NOTIFICATIONS=OFF -DKWIN_BUILD_GLOBALSHORTCUTS=OFF -DKWIN_BUILD_X11=OFF -DKWIN_BUILD_EIS=OFF" --skip-publishing
|
||||
@@ -1,49 +0,0 @@
|
||||
# SPDX-FileCopyrightText: None
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
Dependencies:
|
||||
- 'on': ['@all']
|
||||
'require':
|
||||
'frameworks/breeze-icons': '@latest-kf6'
|
||||
'frameworks/extra-cmake-modules': '@latest-kf6'
|
||||
'frameworks/kcmutils': '@latest-kf6'
|
||||
'frameworks/kconfig': '@latest-kf6'
|
||||
'frameworks/kconfigwidgets': '@latest-kf6'
|
||||
'frameworks/kcoreaddons': '@latest-kf6'
|
||||
'frameworks/kcrash': '@latest-kf6'
|
||||
'frameworks/kdeclarative': '@latest-kf6'
|
||||
'frameworks/kdoctools': '@latest-kf6'
|
||||
'frameworks/kglobalaccel': '@latest-kf6'
|
||||
'frameworks/ki18n': '@latest-kf6'
|
||||
'frameworks/kidletime': '@latest-kf6'
|
||||
'frameworks/knewstuff': '@latest-kf6'
|
||||
'frameworks/knotifications': '@latest-kf6'
|
||||
'frameworks/kpackage': '@latest-kf6'
|
||||
'frameworks/kservice': '@latest-kf6'
|
||||
'frameworks/ksvg': '@latest-kf6'
|
||||
'frameworks/kwidgetsaddons': '@latest-kf6'
|
||||
'frameworks/kwindowsystem': '@latest-kf6'
|
||||
'frameworks/kxmlgui': '@latest-kf6'
|
||||
'libraries/libqaccessibilityclient': '@latest-kf6'
|
||||
'libraries/plasma-wayland-protocols': '@latest-kf6'
|
||||
'plasma/breeze': '@same'
|
||||
'plasma/plasma-activities': '@same'
|
||||
'plasma/kdecoration': '@same'
|
||||
'plasma/kglobalacceld': '@same'
|
||||
'plasma/kpipewire': '@same'
|
||||
'plasma/kscreenlocker': '@same'
|
||||
'plasma/kwayland': '@same'
|
||||
'third-party/wayland': '@latest'
|
||||
'third-party/wayland-protocols': '@latest'
|
||||
|
||||
RuntimeDependencies:
|
||||
- 'on': ['@all']
|
||||
'require':
|
||||
'frameworks/kirigami': '@latest-kf6'
|
||||
'plasma/libplasma': '@same'
|
||||
'plasma/plasma-workspace': '@same' # kscreenlocker needs it
|
||||
|
||||
Options:
|
||||
ctest-arguments: '--repeat until-pass:5'
|
||||
use-ccache: True
|
||||
require-passing-tests-on: ['Linux']
|
||||
@@ -1,546 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
set(PROJECT_VERSION "6.3.4") # Handled by release scripts
|
||||
project(KWin VERSION ${PROJECT_VERSION})
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
set(PROJECT_DEP_VERSION "6.3.4")
|
||||
set(QT_MIN_VERSION "6.7.0")
|
||||
set(KF6_MIN_VERSION "6.10.0")
|
||||
set(KDE_COMPILERSETTINGS_LEVEL "5.82")
|
||||
|
||||
find_package(ECM ${KF6_MIN_VERSION} REQUIRED NO_MODULE)
|
||||
|
||||
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH})
|
||||
|
||||
include(CMakeDependentOption)
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(FeatureSummary)
|
||||
include(WriteBasicConfigVersionFile)
|
||||
include(GenerateExportHeader)
|
||||
include(CheckCXXSourceCompiles)
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(CheckIncludeFile)
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckSymbolExists)
|
||||
|
||||
include(KDEInstallDirs)
|
||||
include(KDECMakeSettings)
|
||||
include(KDECompilerSettings NO_POLICY_SCOPE)
|
||||
include(KDEClangFormat)
|
||||
include(KDEGitCommitHooks)
|
||||
|
||||
include(ECMFindQmlModule)
|
||||
include(ECMInstallIcons)
|
||||
include(ECMOptionalAddSubdirectory)
|
||||
include(ECMConfiguredInstall)
|
||||
include(ECMQtDeclareLoggingCategory)
|
||||
include(ECMSetupQtPluginMacroNames)
|
||||
include(ECMSetupVersion)
|
||||
include(ECMQmlModule)
|
||||
include(ECMGenerateQmlTypes)
|
||||
include(ECMDeprecationSettings)
|
||||
|
||||
option(KWIN_BUILD_DECORATIONS "Enable building of KWin decorations." ON)
|
||||
option(KWIN_BUILD_KCMS "Enable building of KWin configuration modules." ON)
|
||||
option(KWIN_BUILD_NOTIFICATIONS "Enable building of KWin with knotifications support" ON)
|
||||
option(KWIN_BUILD_SCREENLOCKER "Enable building of KWin lockscreen functionality" ON)
|
||||
option(KWIN_BUILD_TABBOX "Enable building of KWin Tabbox functionality" ON)
|
||||
option(KWIN_BUILD_X11 "Enable building X11 common code and Xwayland support" ON)
|
||||
option(KWIN_BUILD_X11_BACKEND "Enable building kwin_x11" ON)
|
||||
option(KWIN_BUILD_GLOBALSHORTCUTS "Enable building of KWin with global shortcuts support" ON)
|
||||
option(KWIN_BUILD_RUNNERS "Enable building of KWin with krunner support" ON)
|
||||
|
||||
find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
|
||||
Concurrent
|
||||
Core
|
||||
Core5Compat
|
||||
DBus
|
||||
Quick
|
||||
UiTools
|
||||
WaylandClient
|
||||
Widgets
|
||||
Sensors
|
||||
Svg
|
||||
)
|
||||
|
||||
find_package(Qt6Test ${QT_MIN_VERSION} CONFIG QUIET)
|
||||
set_package_properties(Qt6Test PROPERTIES
|
||||
PURPOSE "Required for tests"
|
||||
TYPE OPTIONAL
|
||||
)
|
||||
add_feature_info("Qt6Test" Qt6Test_FOUND "Required for building tests")
|
||||
if (NOT Qt6Test_FOUND)
|
||||
set(BUILD_TESTING OFF CACHE BOOL "Build the testing tree.")
|
||||
endif()
|
||||
|
||||
if (BUILD_TESTING)
|
||||
find_package(KPipeWire)
|
||||
endif()
|
||||
|
||||
# required frameworks by Core
|
||||
find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS
|
||||
Auth
|
||||
ColorScheme
|
||||
Config
|
||||
ConfigWidgets
|
||||
CoreAddons
|
||||
Crash
|
||||
DBusAddons
|
||||
GlobalAccel
|
||||
GuiAddons
|
||||
I18n
|
||||
IdleTime
|
||||
Package
|
||||
Service
|
||||
Svg
|
||||
WidgetsAddons
|
||||
WindowSystem
|
||||
)
|
||||
# required frameworks by config modules
|
||||
if(KWIN_BUILD_KCMS)
|
||||
find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS
|
||||
Declarative
|
||||
KCMUtils
|
||||
NewStuff
|
||||
Service
|
||||
XmlGui
|
||||
)
|
||||
endif()
|
||||
|
||||
if(KWIN_BUILD_TABBOX AND KWIN_BUILD_KCMS)
|
||||
find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS
|
||||
WidgetsAddons
|
||||
)
|
||||
endif()
|
||||
|
||||
find_package(Threads)
|
||||
set_package_properties(Threads PROPERTIES
|
||||
PURPOSE "Needed for VirtualTerminal support in KWin Wayland"
|
||||
TYPE REQUIRED
|
||||
)
|
||||
|
||||
find_package(KWayland ${PROJECT_DEP_VERSION} CONFIG)
|
||||
set_package_properties(KWayland PROPERTIES
|
||||
PURPOSE "Required to build wayland platform plugin and tests"
|
||||
TYPE REQUIRED
|
||||
)
|
||||
|
||||
# optional frameworks
|
||||
find_package(PlasmaActivities ${PROJECT_DEP_VERSION} CONFIG)
|
||||
set_package_properties(PlasmaActivities PROPERTIES
|
||||
PURPOSE "Enable building of KWin with kactivities support"
|
||||
TYPE OPTIONAL
|
||||
)
|
||||
add_feature_info("PlasmaActivities" PlasmaActivities_FOUND "Enable building of KWin with kactivities support")
|
||||
|
||||
find_package(KF6DocTools ${KF6_MIN_VERSION} CONFIG)
|
||||
set_package_properties(KF6DocTools PROPERTIES
|
||||
PURPOSE "Enable building documentation"
|
||||
TYPE OPTIONAL
|
||||
)
|
||||
add_feature_info("KF6DocTools" KF6DocTools_FOUND "Enable building documentation")
|
||||
|
||||
find_package(KF6Kirigami ${KF6_MIN_VERSION} CONFIG)
|
||||
set_package_properties(KF6Kirigami PROPERTIES
|
||||
DESCRIPTION "A QtQuick based components set"
|
||||
PURPOSE "Required at runtime for several QML effects"
|
||||
TYPE RUNTIME
|
||||
)
|
||||
find_package(Plasma ${PROJECT_DEP_VERSION} CONFIG)
|
||||
set_package_properties(Plasma PROPERTIES
|
||||
DESCRIPTION "A QtQuick based components set"
|
||||
PURPOSE "Required at runtime for several QML effects"
|
||||
TYPE RUNTIME
|
||||
)
|
||||
|
||||
find_package(KDecoration3 ${PROJECT_DEP_VERSION} CONFIG REQUIRED)
|
||||
|
||||
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 REQUIRED
|
||||
PURPOSE "Required to build KWin with EGL support"
|
||||
)
|
||||
|
||||
find_package(epoxy 1.3)
|
||||
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.22)
|
||||
set_package_properties(Wayland PROPERTIES
|
||||
TYPE REQUIRED
|
||||
PURPOSE "Required for building KWin with Wayland support"
|
||||
)
|
||||
if (Wayland_VERSION VERSION_GREATER_EQUAL 1.23)
|
||||
set(HAVE_WL_DISPLAY_SET_DEFAULT_MAX_BUFFER_SIZE 1)
|
||||
else()
|
||||
set(HAVE_WL_DISPLAY_SET_DEFAULT_MAX_BUFFER_SIZE 0)
|
||||
endif()
|
||||
if (Wayland_VERSION VERSION_GREATER_EQUAL 1.23.90)
|
||||
set(HAVE_WL_FIXES 1)
|
||||
else()
|
||||
set(HAVE_WL_FIXES 0)
|
||||
endif()
|
||||
|
||||
find_package(WaylandProtocols 1.38)
|
||||
set_package_properties(WaylandProtocols PROPERTIES
|
||||
TYPE REQUIRED
|
||||
PURPOSE "Collection of Wayland protocols that add functionality not available in the Wayland core protocol"
|
||||
URL "https://gitlab.freedesktop.org/wayland/wayland-protocols/"
|
||||
)
|
||||
|
||||
find_package(PlasmaWaylandProtocols 1.14.0 CONFIG)
|
||||
set_package_properties(PlasmaWaylandProtocols PROPERTIES
|
||||
TYPE REQUIRED
|
||||
PURPOSE "Collection of Plasma-specific Wayland protocols"
|
||||
URL "https://invent.kde.org/libraries/plasma-wayland-protocols/"
|
||||
)
|
||||
|
||||
find_package(XKB 0.7.0)
|
||||
set_package_properties(XKB PROPERTIES
|
||||
TYPE REQUIRED
|
||||
PURPOSE "Required for building KWin with Wayland support"
|
||||
)
|
||||
if (XKB_VERSION VERSION_GREATER_EQUAL 1.5.0)
|
||||
set(HAVE_XKBCOMMON_NO_SECURE_GETENV 1)
|
||||
else()
|
||||
set(HAVE_XKBCOMMON_NO_SECURE_GETENV 0)
|
||||
endif()
|
||||
|
||||
find_package(Canberra REQUIRED)
|
||||
|
||||
if (KWIN_BUILD_X11)
|
||||
pkg_check_modules(XKBX11 IMPORTED_TARGET xkbcommon-x11 REQUIRED)
|
||||
add_feature_info(XKBX11 XKBX11_FOUND "Required for handling keyboard events in X11 backend")
|
||||
|
||||
# All the required XCB components
|
||||
find_package(XCB 1.10 REQUIRED COMPONENTS
|
||||
COMPOSITE
|
||||
CURSOR
|
||||
DAMAGE
|
||||
DRI3
|
||||
GLX
|
||||
ICCCM
|
||||
IMAGE
|
||||
KEYSYMS
|
||||
PRESENT
|
||||
RANDR
|
||||
RENDER
|
||||
SHAPE
|
||||
SHM
|
||||
SYNC
|
||||
XCB
|
||||
XFIXES
|
||||
XKB
|
||||
XINERAMA
|
||||
XINPUT
|
||||
)
|
||||
set_package_properties(XCB PROPERTIES TYPE REQUIRED)
|
||||
|
||||
find_package(X11_XCB)
|
||||
set_package_properties(X11_XCB PROPERTIES
|
||||
PURPOSE "Required for building X11 windowed backend of kwin_wayland"
|
||||
TYPE OPTIONAL
|
||||
)
|
||||
|
||||
find_package(Xwayland 23.1.0)
|
||||
set_package_properties(Xwayland PROPERTIES
|
||||
URL "https://x.org"
|
||||
DESCRIPTION "Xwayland X server"
|
||||
TYPE RUNTIME
|
||||
PURPOSE "Needed for running kwin_wayland"
|
||||
)
|
||||
set(HAVE_XWAYLAND_ENABLE_EI_PORTAL ${Xwayland_HAVE_ENABLE_EI_PORTAL})
|
||||
|
||||
set(HAVE_GLX ${epoxy_HAS_GLX})
|
||||
get_target_property(QT_DISABLED_FEATURES Qt6::Gui QT_DISABLED_PUBLIC_FEATURES)
|
||||
if("xcb_glx_plugin" IN_LIST QT_DISABLED_FEATURES)
|
||||
message(STATUS "Disable GLX because Qt6::Gui was built without xcb_glx_plugin")
|
||||
set(HAVE_GLX false)
|
||||
endif()
|
||||
|
||||
# for kwin internal things
|
||||
set(HAVE_X11_XCB ${X11_XCB_FOUND})
|
||||
|
||||
find_package(X11)
|
||||
set_package_properties(X11 PROPERTIES
|
||||
DESCRIPTION "X11 libraries"
|
||||
URL "https://www.x.org"
|
||||
TYPE REQUIRED
|
||||
)
|
||||
|
||||
# Scripts to run on XWayland startup
|
||||
set(XWAYLAND_SESSION_SCRIPTS "/etc/xdg/Xwayland-session.d")
|
||||
|
||||
else()
|
||||
set(KWIN_BUILD_X11_BACKEND OFF CACHE BOOL "Enable building kwin_x11" FORCE)
|
||||
endif()
|
||||
|
||||
find_package(Libinput 1.26)
|
||||
set_package_properties(Libinput PROPERTIES TYPE REQUIRED PURPOSE "Required for input handling on Wayland.")
|
||||
if (Libinput_VERSION VERSION_GREATER_EQUAL 1.27)
|
||||
set(HAVE_LIBINPUT_INPUT_AREA 1)
|
||||
else()
|
||||
set(HAVE_LIBINPUT_INPUT_AREA 0)
|
||||
endif()
|
||||
|
||||
find_package(Libeis-1.0)
|
||||
set_package_properties(Libeis PROPERTIES TYPE OPTIONAL PURPOSE "Required for emulated input handling.")
|
||||
|
||||
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.116)
|
||||
set_package_properties(Libdrm PROPERTIES TYPE REQUIRED PURPOSE "Required for drm output on Wayland.")
|
||||
|
||||
find_package(gbm)
|
||||
set_package_properties(gbm PROPERTIES TYPE REQUIRED PURPOSE "Required for egl output of drm backend.")
|
||||
if (gbm_VERSION VERSION_GREATER_EQUAL 21.1)
|
||||
set(HAVE_GBM_BO_GET_FD_FOR_PLANE 1)
|
||||
else()
|
||||
set(HAVE_GBM_BO_GET_FD_FOR_PLANE 0)
|
||||
endif()
|
||||
if (gbm_VERSION VERSION_GREATER_EQUAL 21.3)
|
||||
set(HAVE_GBM_BO_CREATE_WITH_MODIFIERS2 1)
|
||||
else()
|
||||
set(HAVE_GBM_BO_CREATE_WITH_MODIFIERS2 0)
|
||||
endif()
|
||||
|
||||
pkg_check_modules(Libxcvt IMPORTED_TARGET libxcvt>=0.1.1 REQUIRED)
|
||||
add_feature_info(Libxcvt Libxcvt_FOUND "Required for generating modes in the drm backend")
|
||||
|
||||
add_feature_info("XInput" X11_Xi_FOUND "Required for poll-free mouse cursor updates")
|
||||
set(HAVE_X11_XINPUT ${X11_Xinput_FOUND})
|
||||
|
||||
find_package(lcms2)
|
||||
set_package_properties(lcms2 PROPERTIES
|
||||
DESCRIPTION "Small-footprint color management engine"
|
||||
URL "http://www.littlecms.com"
|
||||
TYPE REQUIRED
|
||||
PURPOSE "Required for the color management system"
|
||||
)
|
||||
|
||||
find_package(Freetype)
|
||||
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)
|
||||
set_package_properties(Fontconfig PROPERTIES
|
||||
TYPE REQUIRED
|
||||
PURPOSE "Needed for KWin's QPA plugin."
|
||||
)
|
||||
|
||||
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"
|
||||
)
|
||||
|
||||
find_package(QAccessibilityClient6 CONFIG)
|
||||
set_package_properties(QAccessibilityClient6 PROPERTIES
|
||||
URL "https://commits.kde.org/libqaccessibilityclient"
|
||||
DESCRIPTION "KDE client-side accessibility library"
|
||||
TYPE OPTIONAL
|
||||
PURPOSE "Required to enable accessibility features"
|
||||
)
|
||||
set(HAVE_ACCESSIBILITY ${QAccessibilityClient6_FOUND})
|
||||
|
||||
pkg_check_modules(libsystemd IMPORTED_TARGET libsystemd)
|
||||
add_feature_info(libsystemd libsystemd_FOUND "Required for setting up the service watchdog")
|
||||
|
||||
if(KWIN_BUILD_GLOBALSHORTCUTS)
|
||||
find_package(KGlobalAccelD REQUIRED)
|
||||
endif()
|
||||
|
||||
pkg_check_modules(libdisplayinfo REQUIRED IMPORTED_TARGET libdisplay-info>=0.2.0)
|
||||
add_feature_info(libdisplayinfo libdisplayinfo_FOUND "EDID and DisplayID library: https://gitlab.freedesktop.org/emersion/libdisplay-info")
|
||||
|
||||
pkg_check_modules(PipeWire IMPORTED_TARGET libpipewire-0.3>=1.0.9)
|
||||
add_feature_info(PipeWire PipeWire_FOUND "Required for Wayland screencasting")
|
||||
|
||||
if (KWIN_BUILD_NOTIFICATIONS)
|
||||
find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS Notifications)
|
||||
endif()
|
||||
|
||||
if (KWIN_BUILD_SCREENLOCKER)
|
||||
find_package(KScreenLocker CONFIG)
|
||||
set_package_properties(KScreenLocker PROPERTIES
|
||||
TYPE REQUIRED
|
||||
PURPOSE "For screenlocker integration in kwin_wayland"
|
||||
)
|
||||
endif()
|
||||
|
||||
ecm_find_qmlmodule(QtQuick 2.3)
|
||||
ecm_find_qmlmodule(QtQuick.Controls 2.15)
|
||||
ecm_find_qmlmodule(QtQuick.Layouts 1.3)
|
||||
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)
|
||||
|
||||
cmake_dependent_option(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" ON "PlasmaActivities_FOUND" OFF)
|
||||
cmake_dependent_option(KWIN_BUILD_EIS "Enable building KWin with libeis support" ON "Libeis-1.0_FOUND" OFF)
|
||||
|
||||
include_directories(BEFORE
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src/wayland
|
||||
${CMAKE_CURRENT_BINARY_DIR}/src
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
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")
|
||||
|
||||
# clang < 16 does not support ranges and compiling KWin will fail in the middle of the build.
|
||||
# clang 14 is still the default clang version on KDE Neon and Clazy is build with it
|
||||
check_cxx_source_compiles("
|
||||
#include <ranges>
|
||||
#include <vector>
|
||||
|
||||
int main() {
|
||||
std::vector<int> numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
||||
auto even_numbers = numbers | std::views::filter([](int n) { return n % 2 == 0; });
|
||||
auto squared_numbers = even_numbers | std::views::transform([](int n) { return n * n; });
|
||||
return 0;
|
||||
}
|
||||
" HAS_RANGES_SUPPORT)
|
||||
if(NOT HAS_RANGES_SUPPORT)
|
||||
message(FATAL_ERROR "Compiler does not support C++20 ranges")
|
||||
endif()
|
||||
|
||||
check_cxx_source_compiles("
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main() {
|
||||
const int size = 10;
|
||||
int fd = memfd_create(\"test\", MFD_CLOEXEC | MFD_ALLOW_SEALING);
|
||||
ftruncate(fd, size);
|
||||
fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_WRITE | F_SEAL_SEAL);
|
||||
mmap(nullptr, size, PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
return 0;
|
||||
}" HAVE_MEMFD)
|
||||
|
||||
check_cxx_compiler_flag(-Wno-unused-parameter COMPILER_UNUSED_PARAMETER_SUPPORTED)
|
||||
if (COMPILER_UNUSED_PARAMETER_SUPPORTED)
|
||||
add_compile_options(-Wno-unused-parameter)
|
||||
endif()
|
||||
|
||||
add_definitions(
|
||||
-DQT_NO_KEYWORDS
|
||||
-DQT_USE_QSTRINGBUILDER
|
||||
-DQT_NO_URL_CAST_FROM_STRING
|
||||
-DQT_NO_CAST_TO_ASCII
|
||||
-DQT_NO_FOREACH
|
||||
|
||||
# Prevent EGL headers from including platform headers, in particular Xlib.h.
|
||||
-DMESA_EGL_NO_X11_HEADERS
|
||||
-DEGL_NO_X11
|
||||
-DEGL_NO_PLATFORM_SPECIFIC_TYPES
|
||||
)
|
||||
|
||||
ecm_set_disabled_deprecation_versions(QT 5.15
|
||||
KF 6.9.0
|
||||
)
|
||||
|
||||
ecm_setup_qtplugin_macro_names(
|
||||
JSON_ARG2
|
||||
"KWIN_EFFECT_FACTORY"
|
||||
JSON_ARG3
|
||||
"KWIN_EFFECT_FACTORY_ENABLED"
|
||||
"KWIN_EFFECT_FACTORY_SUPPORTED"
|
||||
JSON_ARG4
|
||||
"KWIN_EFFECT_FACTORY_SUPPORTED_ENABLED"
|
||||
CONFIG_CODE_VARIABLE
|
||||
PACKAGE_SETUP_KWINEFFECTS_AUTOMOC_VARIABLES
|
||||
)
|
||||
|
||||
if (KF6DocTools_FOUND)
|
||||
add_subdirectory(doc)
|
||||
kdoctools_install(po)
|
||||
endif()
|
||||
|
||||
add_subdirectory(data)
|
||||
add_subdirectory(kconf_update)
|
||||
add_subdirectory(src)
|
||||
|
||||
if (BUILD_TESTING)
|
||||
add_subdirectory(autotests)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
# 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})
|
||||
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
|
||||
|
||||
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||
|
||||
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/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})
|
||||
|
||||
ecm_install_configured_files(INPUT plasma-kwin_wayland.service.in @ONLY
|
||||
DESTINATION ${KDE_INSTALL_SYSTEMDUSERUNITDIR})
|
||||
if (KWIN_BUILD_X11_BACKEND)
|
||||
ecm_install_configured_files(INPUT plasma-kwin_x11.service.in @ONLY
|
||||
DESTINATION ${KDE_INSTALL_SYSTEMDUSERUNITDIR})
|
||||
endif()
|
||||
|
||||
|
||||
ki18n_install(po)
|
||||
@@ -1,138 +0,0 @@
|
||||
# Contributing to KWin
|
||||
|
||||
## Chatting
|
||||
|
||||
Come on by and ask about anything you run into when hacking on KWin!
|
||||
|
||||
KWin's Matrix room on our instance is located here: https://matrix.to/#/#kwin:kde.org.
|
||||
You can grab an Matrix account at https://webchat.kde.org/ if you don't already have one from us or another provider.
|
||||
|
||||
The Matrix room is bridged to `#kde-kwin` on Libera, allowing IRC users to access it.
|
||||
|
||||
## What Needs Doing
|
||||
|
||||
There's a large amount of bugs open for KWin on our [Bugzilla instance](https://bugs.kde.org/describecomponents.cgi?product=kwin).
|
||||
|
||||
## Where Stuff Is
|
||||
|
||||
Everything codewise for KWin itself is located in the `src` directory.
|
||||
|
||||
### Settings Pages / KCMs
|
||||
|
||||
All the settings pages for KWin found in System Settings are located in `src/kcmkwin`.
|
||||
|
||||
### Default Decorations
|
||||
|
||||
The Breeze decorations theme is not located in the KWin repository, and is in fact part of the [Breeze repository here](https://invent.kde.org/plasma/breeze), in `kdecoration`.
|
||||
|
||||
### Tab Switcher
|
||||
|
||||
The default visual appearance of the tab switcher is located in `src/tabbox/switchers`.
|
||||
|
||||
Other window switchers usually shipped by default are located in [Plasma Addons](https://invent.kde.org/plasma/kdeplasma-addons), located in the `kwin/windowswitchers` directory.
|
||||
|
||||
### Window Management
|
||||
|
||||
Most window management stuff (layouting, movement, properties, communication between client<->server) is defined in files ending with `client`, such as `x11client.cpp` and `xdgshellclient.cpp`.
|
||||
|
||||
### Window Effects
|
||||
|
||||
Window effects are located in `src/plugins`, one effect plugin per folder. Folder `src/plugins/private` contains the plugin (`org.kde.kwin.private.effects`) that exposes layouting properties and `WindowHeap.qml` for QML effects. Not everything here is an effect as exposed in the configuration UI, such as the colour picker in `src/plugins/colorpicker`.
|
||||
|
||||
Of note, the Effects QML engine is shared with the Scripting components (see `src/scripting`).
|
||||
|
||||
### Scripting API
|
||||
|
||||
Many objects in KWin are exposed directly to the scripting API; scriptable properties are marked with Q_PROPERTY and functions that scripts can invoke on them.
|
||||
|
||||
Other scripting stuff is located in `src/scripting`.
|
||||
|
||||
## Conventions
|
||||
|
||||
### Coding Conventions
|
||||
|
||||
KWin's coding conventions are located [here](doc/coding-conventions.md).
|
||||
|
||||
KWin additionally follows [KDE's Frameworks Coding Style](https://community.kde.org/Policies/Frameworks_Coding_Style).
|
||||
|
||||
### Commits
|
||||
|
||||
We usually use this convention for commits in KWin:
|
||||
|
||||
```
|
||||
component/subcomponent: Do a thing
|
||||
|
||||
This is a body of the commit message,
|
||||
elaborating on why we're doing thing.
|
||||
```
|
||||
|
||||
While this isn't a hard rule, it's appreciated for easy scanning of commits by their messages.
|
||||
|
||||
## Contributing
|
||||
|
||||
KWin uses KDE's GitLab instance for submitting code.
|
||||
|
||||
You can read about the [KDE workflow here](https://community.kde.org/Infrastructure/GitLab).
|
||||
|
||||
## Running KWin From Source
|
||||
|
||||
KWin uses CMake like most KDE projects, so you can build it like this:
|
||||
|
||||
```bash
|
||||
mkdir _build
|
||||
cd _build
|
||||
cmake ..
|
||||
make
|
||||
```
|
||||
|
||||
People hacking on much KDE software may want to set up [kdesrc-build](https://invent.kde.org/sdk/kdesrc-build).
|
||||
|
||||
Once built, you can either install it over your system KWin (not recommended) or run it from the build directory directly.
|
||||
|
||||
Running it from your build directory looks like this:
|
||||
```bash
|
||||
# from the root of your build directory
|
||||
|
||||
source prefix.sh
|
||||
cd bin
|
||||
|
||||
# for wayland, starts nested session: with console
|
||||
|
||||
env QT_PLUGIN_PATH="$(pwd)":"$QT_PLUGIN_PATH" dbus-run-session ./kwin_wayland --xwayland konsole
|
||||
|
||||
# or for x11, replaces current kwin instance:
|
||||
|
||||
env QT_PLUGIN_PATH="$(pwd)":"$QT_PLUGIN_PATH" ./kwin_x11 --replace
|
||||
|
||||
```
|
||||
|
||||
QT_PLUGIN_PATH tells Qt to load KWin's plugins from the build directory, and not from your system KWin.
|
||||
|
||||
The dbus-run-session is needed to prevent the nested KWin instance from conflicting with your session KWin instance when exporting objects onto the bus, or with stuff like global shortcuts.
|
||||
|
||||
If you need to run a whole Wayland plasma session, you should install a development session by first building [plasma-workspace](https://invent.kde.org/plasma/plasma-workspace) and executing the `login-sessions/install-sessions.sh` in the build directory. This can be done using kdesrc-build.
|
||||
|
||||
```bash
|
||||
kdesrc-build plasma-workspace
|
||||
# assuming the root directory for kdesrc-build is ~/kde
|
||||
bash ~/kde/build/plasma-workspace/login-sessions/install-sessions.sh
|
||||
```
|
||||
Then you can select the develop session in the sddm login screen.
|
||||
|
||||
You can look up the current boot kwin log via `journalctl --user-unit plasma-kwin_wayland --boot 0`.
|
||||
|
||||
## Using A Debugger
|
||||
|
||||
Trying to attach a debugger to a running KWin instance from within itself will likely be the last thing you do in the session, as KWin will freeze until you resume it from your debugger, which you need KWin to interact with.
|
||||
|
||||
Instead, either attach a debugger to a nested KWin instance or debug over SSH.
|
||||
|
||||
## Tests
|
||||
|
||||
KWin has a series of unit tests and integration tests that ensure everything is running as expected.
|
||||
|
||||
If you're adding substantial new code, it's expected that you'll write tests for it to ensure that it's working as expected.
|
||||
|
||||
If you're fixing a bug, it's appreciated, but not expected, that you add a test case for the bug you fix.
|
||||
|
||||
You can read more about [KWin's testing infrastructure here](doc/TESTING.md).
|
||||
@@ -1,10 +0,0 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
set(KWIN_INTERFACE "@PACKAGE_KDE_INSTALL_DBUSINTERFACEDIR@/org.kde.KWin.xml")
|
||||
set(KWIN_COMPOSITING_INTERFACE "@PACKAGE_KDE_INSTALL_DBUSINTERFACEDIR@/org.kde.kwin.Compositing.xml")
|
||||
set(KWIN_EFFECTS_INTERFACE "@PACKAGE_KDE_INSTALL_DBUSINTERFACEDIR@/org.kde.kwin.Effects.xml")
|
||||
set(KWIN_VIRTUALKEYBOARD_INTERFACE "@PACKAGE_KDE_INSTALL_DBUSINTERFACEDIR@/org.kde.kwin.VirtualKeyboard.xml")
|
||||
set(KWIN_TABLETMODE_INTERFACE "@PACKAGE_KDE_INSTALL_DBUSINTERFACEDIR@/org.kde.KWin.TabletModeManager.xml")
|
||||
set(KWIN_INPUTDEVICE_INTERFACE "@PACKAGE_KDE_INSTALL_DBUSINTERFACEDIR@/org.kde.kwin.InputDevice.xml")
|
||||
set(KWIN_NIGHTLIGHT_INTERFACE "@PACKAGE_KDE_INSTALL_DBUSINTERFACEDIR@/org.kde.KWin.NightLight.xml")
|
||||
set(KWIN_WAYLAND_BIN_PATH "@CMAKE_INSTALL_FULL_BINDIR@/kwin_wayland")
|
||||
@@ -1,26 +0,0 @@
|
||||
Copyright (c) <year> <owner>. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,121 +0,0 @@
|
||||
Creative Commons Legal Code
|
||||
|
||||
CC0 1.0 Universal
|
||||
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||
HEREUNDER.
|
||||
|
||||
Statement of Purpose
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer
|
||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||
authorship and/or a database (each, a "Work").
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for
|
||||
the purpose of contributing to a commons of creative, cultural and
|
||||
scientific works ("Commons") that the public can reliably and without fear
|
||||
of later claims of infringement build upon, modify, incorporate in other
|
||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||
and for any purposes, including without limitation commercial purposes.
|
||||
These owners may contribute to the Commons to promote the ideal of a free
|
||||
culture and the further production of creative, cultural and scientific
|
||||
works, or to gain reputation or greater distribution for their Work in
|
||||
part through the use and efforts of others.
|
||||
|
||||
For these and/or other purposes and motivations, and without any
|
||||
expectation of additional consideration or compensation, the person
|
||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||
|
||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||
protected by copyright and related or neighboring rights ("Copyright and
|
||||
Related Rights"). Copyright and Related Rights include, but are not
|
||||
limited to, the following:
|
||||
|
||||
i. the right to reproduce, adapt, distribute, perform, display,
|
||||
communicate, and translate a Work;
|
||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||
iii. publicity and privacy rights pertaining to a person's image or
|
||||
likeness depicted in a Work;
|
||||
iv. rights protecting against unfair competition in regards to a Work,
|
||||
subject to the limitations in paragraph 4(a), below;
|
||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||
in a Work;
|
||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||
European Parliament and of the Council of 11 March 1996 on the legal
|
||||
protection of databases, and under any national implementation
|
||||
thereof, including any amended or successor version of such
|
||||
directive); and
|
||||
vii. other similar, equivalent or corresponding rights throughout the
|
||||
world based on applicable law or treaty, and any national
|
||||
implementations thereof.
|
||||
|
||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||
of action, whether now known or unknown (including existing as well as
|
||||
future claims and causes of action), in the Work (i) in all territories
|
||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||
treaty (including future time extensions), (iii) in any current or future
|
||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||
including without limitation commercial, advertising or promotional
|
||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||
member of the public at large and to the detriment of Affirmer's heirs and
|
||||
successors, fully intending that such Waiver shall not be subject to
|
||||
revocation, rescission, cancellation, termination, or any other legal or
|
||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||
as contemplated by Affirmer's express Statement of Purpose.
|
||||
|
||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||
be judged legally invalid or ineffective under applicable law, then the
|
||||
Waiver shall be preserved to the maximum extent permitted taking into
|
||||
account Affirmer's express Statement of Purpose. In addition, to the
|
||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||
maximum duration provided by applicable law or treaty (including future
|
||||
time extensions), (iii) in any current or future medium and for any number
|
||||
of copies, and (iv) for any purpose whatsoever, including without
|
||||
limitation commercial, advertising or promotional purposes (the
|
||||
"License"). The License shall be deemed effective as of the date CC0 was
|
||||
applied by Affirmer to the Work. Should any part of the License for any
|
||||
reason be judged legally invalid or ineffective under applicable law, such
|
||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||
of the License, and in such case Affirmer hereby affirms that he or she
|
||||
will not (i) exercise any of his or her remaining Copyright and Related
|
||||
Rights in the Work or (ii) assert any associated claims and causes of
|
||||
action with respect to the Work, in either case contrary to Affirmer's
|
||||
express Statement of Purpose.
|
||||
|
||||
4. Limitations and Disclaimers.
|
||||
|
||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||
surrendered, licensed or otherwise affected by this document.
|
||||
b. Affirmer offers the Work as-is and makes no representations or
|
||||
warranties of any kind concerning the Work, express, implied,
|
||||
statutory or otherwise, including without limitation warranties of
|
||||
title, merchantability, fitness for a particular purpose, non
|
||||
infringement, or the absence of latent or other defects, accuracy, or
|
||||
the present or absence of errors, whether or not discoverable, all to
|
||||
the greatest extent permissible under applicable law.
|
||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||
that may apply to the Work or any use thereof, including without
|
||||
limitation any person's Copyright and Related Rights in the Work.
|
||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||
consents, permissions or other rights required for any use of the
|
||||
Work.
|
||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||
party to this document and has no duty or obligation with respect to
|
||||
this CC0 or use of the Work.
|
||||
@@ -1,319 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share
|
||||
and change it. By contrast, the GNU General Public License is intended to
|
||||
guarantee your freedom to share and change free software--to make sure the
|
||||
software is free for all its users. This General Public License applies to
|
||||
most of the Free Software Foundation's software and to any other program whose
|
||||
authors commit to using it. (Some other Free Software Foundation software
|
||||
is covered by the GNU Lesser General Public License instead.) You can apply
|
||||
it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our
|
||||
General Public Licenses are designed to make sure that you have the freedom
|
||||
to distribute copies of free software (and charge for this service if you
|
||||
wish), that you receive source code or can get it if you want it, that you
|
||||
can change the software or use pieces of it in new free programs; and that
|
||||
you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to
|
||||
deny you these rights or to ask you to surrender the rights. These restrictions
|
||||
translate to certain responsibilities for you if you distribute copies of
|
||||
the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or
|
||||
for a fee, you must give the recipients all the rights that you have. You
|
||||
must make sure that they, too, receive or can get the source code. And you
|
||||
must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and (2)
|
||||
offer you this license which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain that
|
||||
everyone understands that there is no warranty for this free software. If
|
||||
the software is modified by someone else and passed on, we want its recipients
|
||||
to know that what they have is not the original, so that any problems introduced
|
||||
by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We
|
||||
wish to avoid the danger that redistributors of a free program will individually
|
||||
obtain patent licenses, in effect making the program proprietary. To prevent
|
||||
this, we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains a notice
|
||||
placed by the copyright holder saying it may be distributed under the terms
|
||||
of this General Public License. The "Program", below, refers to any such program
|
||||
or work, and a "work based on the Program" means either the Program or any
|
||||
derivative work under copyright law: that is to say, a work containing the
|
||||
Program or a portion of it, either verbatim or with modifications and/or translated
|
||||
into another language. (Hereinafter, translation is included without limitation
|
||||
in the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not covered
|
||||
by this License; they are outside its scope. The act of running the Program
|
||||
is not restricted, and the output from the Program is covered only if its
|
||||
contents constitute a work based on the Program (independent of having been
|
||||
made by running the Program). Whether that is true depends on what the Program
|
||||
does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's source code
|
||||
as you receive it, in any medium, provided that you conspicuously and appropriately
|
||||
publish on each copy an appropriate copyright notice and disclaimer of warranty;
|
||||
keep intact all the notices that refer to this License and to the absence
|
||||
of any warranty; and give any other recipients of the Program a copy of this
|
||||
License along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you
|
||||
may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion of it,
|
||||
thus forming a work based on the Program, and copy and distribute such modifications
|
||||
or work under the terms of Section 1 above, provided that you also meet all
|
||||
of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices stating that
|
||||
you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in whole or
|
||||
in part contains or is derived from the Program or any part thereof, to be
|
||||
licensed as a whole at no charge to all third parties under the terms of this
|
||||
License.
|
||||
|
||||
c) If the modified program normally reads commands interactively when run,
|
||||
you must cause it, when started running for such interactive use in the most
|
||||
ordinary way, to print or display an announcement including an appropriate
|
||||
copyright notice and a notice that there is no warranty (or else, saying that
|
||||
you provide a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this License.
|
||||
(Exception: if the Program itself is interactive but does not normally print
|
||||
such an announcement, your work based on the Program is not required to print
|
||||
an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable
|
||||
sections of that work are not derived from the Program, and can be reasonably
|
||||
considered independent and separate works in themselves, then this License,
|
||||
and its terms, do not apply to those sections when you distribute them as
|
||||
separate works. But when you distribute the same sections as part of a whole
|
||||
which is a work based on the Program, the distribution of the whole must be
|
||||
on the terms of this License, whose permissions for other licensees extend
|
||||
to the entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your
|
||||
rights to work written entirely by you; rather, the intent is to exercise
|
||||
the right to control the distribution of derivative or collective works based
|
||||
on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program with
|
||||
the Program (or with a work based on the Program) on a volume of a storage
|
||||
or distribution medium does not bring the other work under the scope of this
|
||||
License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it, under Section
|
||||
2) in object code or executable form under the terms of Sections 1 and 2 above
|
||||
provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable source code,
|
||||
which must be distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three years, to give
|
||||
any third party, for a charge no more than your cost of physically performing
|
||||
source distribution, a complete machine-readable copy of the corresponding
|
||||
source code, to be distributed under the terms of Sections 1 and 2 above on
|
||||
a medium customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer to distribute
|
||||
corresponding source code. (This alternative is allowed only for noncommercial
|
||||
distribution and only if you received the program in object code or executable
|
||||
form with such an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for making
|
||||
modifications to it. For an executable work, complete source code means all
|
||||
the source code for all modules it contains, plus any associated interface
|
||||
definition files, plus the scripts used to control compilation and installation
|
||||
of the executable. However, as a special exception, the source code distributed
|
||||
need not include anything that is normally distributed (in either source or
|
||||
binary form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component itself
|
||||
accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering access to
|
||||
copy from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place counts as distribution of the source code,
|
||||
even though third parties are not compelled to copy the source along with
|
||||
the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program except
|
||||
as expressly provided under this License. Any attempt otherwise to copy, modify,
|
||||
sublicense or distribute the Program is void, and will automatically terminate
|
||||
your rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses terminated
|
||||
so long as such parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not signed
|
||||
it. However, nothing else grants you permission to modify or distribute the
|
||||
Program or its derivative works. These actions are prohibited by law if you
|
||||
do not accept this License. Therefore, by modifying or distributing the Program
|
||||
(or any work based on the Program), you indicate your acceptance of this License
|
||||
to do so, and all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the Program),
|
||||
the recipient automatically receives a license from the original licensor
|
||||
to copy, distribute or modify the Program subject to these terms and conditions.
|
||||
You may not impose any further restrictions on the recipients' exercise of
|
||||
the rights granted herein. You are not responsible for enforcing compliance
|
||||
by third parties to this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent infringement
|
||||
or for any other reason (not limited to patent issues), conditions are imposed
|
||||
on you (whether by court order, agreement or otherwise) that contradict the
|
||||
conditions of this License, they do not excuse you from the conditions of
|
||||
this License. If you cannot distribute so as to satisfy simultaneously your
|
||||
obligations under this License and any other pertinent obligations, then as
|
||||
a consequence you may not distribute the Program at all. For example, if a
|
||||
patent license would not permit royalty-free redistribution of the Program
|
||||
by all those who receive copies directly or indirectly through you, then the
|
||||
only way you could satisfy both it and this License would be to refrain entirely
|
||||
from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply and
|
||||
the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents
|
||||
or other property right claims or to contest validity of any such claims;
|
||||
this section has the sole purpose of protecting the integrity of the free
|
||||
software distribution system, which is implemented by public license practices.
|
||||
Many people have made generous contributions to the wide range of software
|
||||
distributed through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing to
|
||||
distribute software through any other system and a licensee cannot impose
|
||||
that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a
|
||||
consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in certain
|
||||
countries either by patents or by copyrighted interfaces, the original copyright
|
||||
holder who places the Program under this License may add an explicit geographical
|
||||
distribution limitation excluding those countries, so that distribution is
|
||||
permitted only in or among countries not thus excluded. In such case, this
|
||||
License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions of
|
||||
the General Public License from time to time. Such new versions will be similar
|
||||
in spirit to the present version, but may differ in detail to address new
|
||||
problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies
|
||||
a version number of this License which applies to it and "any later version",
|
||||
you have the option of following the terms and conditions either of that version
|
||||
or of any later version published by the Free Software Foundation. If the
|
||||
Program does not specify a version number of this License, you may choose
|
||||
any version ever published by the Free Software Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free programs
|
||||
whose distribution conditions are different, write to the author to ask for
|
||||
permission. For software which is copyrighted by the Free Software Foundation,
|
||||
write to the Free Software Foundation; we sometimes make exceptions for this.
|
||||
Our decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing and reuse
|
||||
of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
|
||||
THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
|
||||
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
|
||||
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
|
||||
OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
|
||||
OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
|
||||
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
|
||||
OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH
|
||||
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible
|
||||
use to the public, the best way to achieve this is to make it free software
|
||||
which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach
|
||||
them to the start of each source file to most effectively convey the exclusion
|
||||
of warranty; and each file should have at least the "copyright" line and a
|
||||
pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and an idea of what it does.>
|
||||
|
||||
Copyright (C)< yyyy> <name of author>
|
||||
|
||||
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.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this when
|
||||
it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
|
||||
with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software,
|
||||
and you are welcome to redistribute it under certain conditions; type `show
|
||||
c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may be
|
||||
called something other than `show w' and `show c'; they could even be mouse-clicks
|
||||
or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary. Here
|
||||
is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision'
|
||||
(which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon >, 1 April 1989 Ty Coon, President of Vice This General
|
||||
Public License does not permit incorporating your program into proprietary
|
||||
programs. If your program is a subroutine library, you may consider it more
|
||||
useful to permit linking proprietary applications with the library. If this
|
||||
is what you want to do, use the GNU Lesser General Public License instead
|
||||
of this License.
|
||||
@@ -1,319 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share
|
||||
and change it. By contrast, the GNU General Public License is intended to
|
||||
guarantee your freedom to share and change free software--to make sure the
|
||||
software is free for all its users. This General Public License applies to
|
||||
most of the Free Software Foundation's software and to any other program whose
|
||||
authors commit to using it. (Some other Free Software Foundation software
|
||||
is covered by the GNU Lesser General Public License instead.) You can apply
|
||||
it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our
|
||||
General Public Licenses are designed to make sure that you have the freedom
|
||||
to distribute copies of free software (and charge for this service if you
|
||||
wish), that you receive source code or can get it if you want it, that you
|
||||
can change the software or use pieces of it in new free programs; and that
|
||||
you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to
|
||||
deny you these rights or to ask you to surrender the rights. These restrictions
|
||||
translate to certain responsibilities for you if you distribute copies of
|
||||
the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or
|
||||
for a fee, you must give the recipients all the rights that you have. You
|
||||
must make sure that they, too, receive or can get the source code. And you
|
||||
must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and (2)
|
||||
offer you this license which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain that
|
||||
everyone understands that there is no warranty for this free software. If
|
||||
the software is modified by someone else and passed on, we want its recipients
|
||||
to know that what they have is not the original, so that any problems introduced
|
||||
by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We
|
||||
wish to avoid the danger that redistributors of a free program will individually
|
||||
obtain patent licenses, in effect making the program proprietary. To prevent
|
||||
this, we have made it clear that any patent must be licensed for everyone's
|
||||
free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains a notice
|
||||
placed by the copyright holder saying it may be distributed under the terms
|
||||
of this General Public License. The "Program", below, refers to any such program
|
||||
or work, and a "work based on the Program" means either the Program or any
|
||||
derivative work under copyright law: that is to say, a work containing the
|
||||
Program or a portion of it, either verbatim or with modifications and/or translated
|
||||
into another language. (Hereinafter, translation is included without limitation
|
||||
in the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not covered
|
||||
by this License; they are outside its scope. The act of running the Program
|
||||
is not restricted, and the output from the Program is covered only if its
|
||||
contents constitute a work based on the Program (independent of having been
|
||||
made by running the Program). Whether that is true depends on what the Program
|
||||
does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's source code
|
||||
as you receive it, in any medium, provided that you conspicuously and appropriately
|
||||
publish on each copy an appropriate copyright notice and disclaimer of warranty;
|
||||
keep intact all the notices that refer to this License and to the absence
|
||||
of any warranty; and give any other recipients of the Program a copy of this
|
||||
License along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you
|
||||
may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion of it,
|
||||
thus forming a work based on the Program, and copy and distribute such modifications
|
||||
or work under the terms of Section 1 above, provided that you also meet all
|
||||
of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices stating that
|
||||
you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in whole or
|
||||
in part contains or is derived from the Program or any part thereof, to be
|
||||
licensed as a whole at no charge to all third parties under the terms of this
|
||||
License.
|
||||
|
||||
c) If the modified program normally reads commands interactively when run,
|
||||
you must cause it, when started running for such interactive use in the most
|
||||
ordinary way, to print or display an announcement including an appropriate
|
||||
copyright notice and a notice that there is no warranty (or else, saying that
|
||||
you provide a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this License.
|
||||
(Exception: if the Program itself is interactive but does not normally print
|
||||
such an announcement, your work based on the Program is not required to print
|
||||
an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable
|
||||
sections of that work are not derived from the Program, and can be reasonably
|
||||
considered independent and separate works in themselves, then this License,
|
||||
and its terms, do not apply to those sections when you distribute them as
|
||||
separate works. But when you distribute the same sections as part of a whole
|
||||
which is a work based on the Program, the distribution of the whole must be
|
||||
on the terms of this License, whose permissions for other licensees extend
|
||||
to the entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your
|
||||
rights to work written entirely by you; rather, the intent is to exercise
|
||||
the right to control the distribution of derivative or collective works based
|
||||
on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program with
|
||||
the Program (or with a work based on the Program) on a volume of a storage
|
||||
or distribution medium does not bring the other work under the scope of this
|
||||
License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it, under Section
|
||||
2) in object code or executable form under the terms of Sections 1 and 2 above
|
||||
provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable source code,
|
||||
which must be distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three years, to give
|
||||
any third party, for a charge no more than your cost of physically performing
|
||||
source distribution, a complete machine-readable copy of the corresponding
|
||||
source code, to be distributed under the terms of Sections 1 and 2 above on
|
||||
a medium customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer to distribute
|
||||
corresponding source code. (This alternative is allowed only for noncommercial
|
||||
distribution and only if you received the program in object code or executable
|
||||
form with such an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for making
|
||||
modifications to it. For an executable work, complete source code means all
|
||||
the source code for all modules it contains, plus any associated interface
|
||||
definition files, plus the scripts used to control compilation and installation
|
||||
of the executable. However, as a special exception, the source code distributed
|
||||
need not include anything that is normally distributed (in either source or
|
||||
binary form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component itself
|
||||
accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering access to
|
||||
copy from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place counts as distribution of the source code,
|
||||
even though third parties are not compelled to copy the source along with
|
||||
the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program except
|
||||
as expressly provided under this License. Any attempt otherwise to copy, modify,
|
||||
sublicense or distribute the Program is void, and will automatically terminate
|
||||
your rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses terminated
|
||||
so long as such parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not signed
|
||||
it. However, nothing else grants you permission to modify or distribute the
|
||||
Program or its derivative works. These actions are prohibited by law if you
|
||||
do not accept this License. Therefore, by modifying or distributing the Program
|
||||
(or any work based on the Program), you indicate your acceptance of this License
|
||||
to do so, and all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the Program),
|
||||
the recipient automatically receives a license from the original licensor
|
||||
to copy, distribute or modify the Program subject to these terms and conditions.
|
||||
You may not impose any further restrictions on the recipients' exercise of
|
||||
the rights granted herein. You are not responsible for enforcing compliance
|
||||
by third parties to this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent infringement
|
||||
or for any other reason (not limited to patent issues), conditions are imposed
|
||||
on you (whether by court order, agreement or otherwise) that contradict the
|
||||
conditions of this License, they do not excuse you from the conditions of
|
||||
this License. If you cannot distribute so as to satisfy simultaneously your
|
||||
obligations under this License and any other pertinent obligations, then as
|
||||
a consequence you may not distribute the Program at all. For example, if a
|
||||
patent license would not permit royalty-free redistribution of the Program
|
||||
by all those who receive copies directly or indirectly through you, then the
|
||||
only way you could satisfy both it and this License would be to refrain entirely
|
||||
from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply and
|
||||
the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents
|
||||
or other property right claims or to contest validity of any such claims;
|
||||
this section has the sole purpose of protecting the integrity of the free
|
||||
software distribution system, which is implemented by public license practices.
|
||||
Many people have made generous contributions to the wide range of software
|
||||
distributed through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing to
|
||||
distribute software through any other system and a licensee cannot impose
|
||||
that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a
|
||||
consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in certain
|
||||
countries either by patents or by copyrighted interfaces, the original copyright
|
||||
holder who places the Program under this License may add an explicit geographical
|
||||
distribution limitation excluding those countries, so that distribution is
|
||||
permitted only in or among countries not thus excluded. In such case, this
|
||||
License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions of
|
||||
the General Public License from time to time. Such new versions will be similar
|
||||
in spirit to the present version, but may differ in detail to address new
|
||||
problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies
|
||||
a version number of this License which applies to it and "any later version",
|
||||
you have the option of following the terms and conditions either of that version
|
||||
or of any later version published by the Free Software Foundation. If the
|
||||
Program does not specify a version number of this License, you may choose
|
||||
any version ever published by the Free Software Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free programs
|
||||
whose distribution conditions are different, write to the author to ask for
|
||||
permission. For software which is copyrighted by the Free Software Foundation,
|
||||
write to the Free Software Foundation; we sometimes make exceptions for this.
|
||||
Our decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing and reuse
|
||||
of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
|
||||
THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
|
||||
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
|
||||
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
|
||||
OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
|
||||
OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
|
||||
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
|
||||
OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH
|
||||
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible
|
||||
use to the public, the best way to achieve this is to make it free software
|
||||
which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach
|
||||
them to the start of each source file to most effectively convey the exclusion
|
||||
of warranty; and each file should have at least the "copyright" line and a
|
||||
pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and an idea of what it does.>
|
||||
|
||||
Copyright (C) <yyyy> <name of author>
|
||||
|
||||
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.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this when
|
||||
it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
|
||||
with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software,
|
||||
and you are welcome to redistribute it under certain conditions; type `show
|
||||
c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may be
|
||||
called something other than `show w' and `show c'; they could even be mouse-clicks
|
||||
or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary. Here
|
||||
is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision'
|
||||
(which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice This General
|
||||
Public License does not permit incorporating your program into proprietary
|
||||
programs. If your program is a subroutine library, you may consider it more
|
||||
useful to permit linking proprietary applications with the library. If this
|
||||
is what you want to do, use the GNU Lesser General Public License instead
|
||||
of this License.
|
||||
@@ -1,625 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for software and
|
||||
other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed to take
|
||||
away your freedom to share and change the works. By contrast, the GNU General
|
||||
Public License is intended to guarantee your freedom to share and change all
|
||||
versions of a program--to make sure it remains free software for all its users.
|
||||
We, the Free Software Foundation, use the GNU General Public License for most
|
||||
of our software; it applies also to any other work released this way by its
|
||||
authors. You can apply it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our
|
||||
General Public Licenses are designed to make sure that you have the freedom
|
||||
to distribute copies of free software (and charge for them if you wish), that
|
||||
you receive source code or can get it if you want it, that you can change
|
||||
the software or use pieces of it in new free programs, and that you know you
|
||||
can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you these rights
|
||||
or asking you to surrender the rights. Therefore, you have certain responsibilities
|
||||
if you distribute copies of the software, or if you modify it: responsibilities
|
||||
to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or
|
||||
for a fee, you must pass on to the recipients the same freedoms that you received.
|
||||
You must make sure that they, too, receive or can get the source code. And
|
||||
you must show them these terms so they know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps: (1) assert
|
||||
copyright on the software, and (2) offer you this License giving you legal
|
||||
permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains that
|
||||
there is no warranty for this free software. For both users' and authors'
|
||||
sake, the GPL requires that modified versions be marked as changed, so that
|
||||
their problems will not be attributed erroneously to authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run modified
|
||||
versions of the software inside them, although the manufacturer can do so.
|
||||
This is fundamentally incompatible with the aim of protecting users' freedom
|
||||
to change the software. The systematic pattern of such abuse occurs in the
|
||||
area of products for individuals to use, which is precisely where it is most
|
||||
unacceptable. Therefore, we have designed this version of the GPL to prohibit
|
||||
the practice for those products. If such problems arise substantially in other
|
||||
domains, we stand ready to extend this provision to those domains in future
|
||||
versions of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents. States
|
||||
should not allow patents to restrict development and use of software on general-purpose
|
||||
computers, but in those that do, we wish to avoid the special danger that
|
||||
patents applied to a free program could make it effectively proprietary. To
|
||||
prevent this, the GPL assures that patents cannot be used to render the program
|
||||
non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of works,
|
||||
such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this License.
|
||||
Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals
|
||||
or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work in
|
||||
a fashion requiring copyright permission, other than the making of an exact
|
||||
copy. The resulting work is called a "modified version" of the earlier work
|
||||
or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based on the
|
||||
Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without permission,
|
||||
would make you directly or secondarily liable for infringement under applicable
|
||||
copyright law, except executing it on a computer or modifying a private copy.
|
||||
Propagation includes copying, distribution (with or without modification),
|
||||
making available to the public, and in some countries other activities as
|
||||
well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other parties
|
||||
to make or receive copies. Mere interaction with a user through a computer
|
||||
network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices" to the
|
||||
extent that it includes a convenient and prominently visible feature that
|
||||
(1) displays an appropriate copyright notice, and (2) tells the user that
|
||||
there is no warranty for the work (except to the extent that warranties are
|
||||
provided), that licensees may convey the work under this License, and how
|
||||
to view a copy of this License. If the interface presents a list of user commands
|
||||
or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work for making
|
||||
modifications to it. "Object code" means any non-source form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official standard
|
||||
defined by a recognized standards body, or, in the case of interfaces specified
|
||||
for a particular programming language, one that is widely used among developers
|
||||
working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other than
|
||||
the work as a whole, that (a) is included in the normal form of packaging
|
||||
a Major Component, but which is not part of that Major Component, and (b)
|
||||
serves only to enable use of the work with that Major Component, or to implement
|
||||
a Standard Interface for which an implementation is available to the public
|
||||
in source code form. A "Major Component", in this context, means a major essential
|
||||
component (kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to produce
|
||||
the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all the source
|
||||
code needed to generate, install, and (for an executable work) run the object
|
||||
code and to modify the work, including scripts to control those activities.
|
||||
However, it does not include the work's System Libraries, or general-purpose
|
||||
tools or generally available free programs which are used unmodified in performing
|
||||
those activities but which are not part of the work. For example, Corresponding
|
||||
Source includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically linked
|
||||
subprograms that the work is specifically designed to require, such as by
|
||||
intimate data communication or control flow between those subprograms and
|
||||
other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate
|
||||
automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of copyright
|
||||
on the Program, and are irrevocable provided the stated conditions are met.
|
||||
This License explicitly affirms your unlimited permission to run the unmodified
|
||||
Program. The output from running a covered work is covered by this License
|
||||
only if the output, given its content, constitutes a covered work. This License
|
||||
acknowledges your rights of fair use or other equivalent, as provided by copyright
|
||||
law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey, without
|
||||
conditions so long as your license otherwise remains in force. You may convey
|
||||
covered works to others for the sole purpose of having them make modifications
|
||||
exclusively for you, or provide you with facilities for running those works,
|
||||
provided that you comply with the terms of this License in conveying all material
|
||||
for which you do not control copyright. Those thus making or running the covered
|
||||
works for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of your copyrighted
|
||||
material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions
|
||||
stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological measure
|
||||
under any applicable law fulfilling obligations under article 11 of the WIPO
|
||||
copyright treaty adopted on 20 December 1996, or similar laws prohibiting
|
||||
or restricting circumvention of such measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention
|
||||
of technological measures to the extent such circumvention is effected by
|
||||
exercising rights under this License with respect to the covered work, and
|
||||
you disclaim any intention to limit operation or modification of the work
|
||||
as a means of enforcing, against the work's users, your or third parties'
|
||||
legal rights to forbid circumvention of technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you receive
|
||||
it, in any medium, provided that you conspicuously and appropriately publish
|
||||
on each copy an appropriate copyright notice; keep intact all notices stating
|
||||
that this License and any non-permissive terms added in accord with section
|
||||
7 apply to the code; keep intact all notices of the absence of any warranty;
|
||||
and give all recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey, and you
|
||||
may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to produce
|
||||
it from the Program, in the form of source code under the terms of section
|
||||
4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified it, and
|
||||
giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is released under
|
||||
this License and any conditions added under section 7. This requirement modifies
|
||||
the requirement in section 4 to "keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this License to anyone
|
||||
who comes into possession of a copy. This License will therefore apply, along
|
||||
with any applicable section 7 additional terms, to the whole of the work,
|
||||
and all its parts, regardless of how they are packaged. This License gives
|
||||
no permission to license the work in any other way, but it does not invalidate
|
||||
such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display Appropriate
|
||||
Legal Notices; however, if the Program has interactive interfaces that do
|
||||
not display Appropriate Legal Notices, your work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent works,
|
||||
which are not by their nature extensions of the covered work, and which are
|
||||
not combined with it such as to form a larger program, in or on a volume of
|
||||
a storage or distribution medium, is called an "aggregate" if the compilation
|
||||
and its resulting copyright are not used to limit the access or legal rights
|
||||
of the compilation's users beyond what the individual works permit. Inclusion
|
||||
of a covered work in an aggregate does not cause this License to apply to
|
||||
the other parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms of sections
|
||||
4 and 5, provided that you also convey the machine-readable Corresponding
|
||||
Source under the terms of this License, in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product (including
|
||||
a physical distribution medium), accompanied by the Corresponding Source fixed
|
||||
on a durable physical medium customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product (including
|
||||
a physical distribution medium), accompanied by a written offer, valid for
|
||||
at least three years and valid for as long as you offer spare parts or customer
|
||||
support for that product model, to give anyone who possesses the object code
|
||||
either (1) a copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical medium customarily
|
||||
used for software interchange, for a price no more than your reasonable cost
|
||||
of physically performing this conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the written
|
||||
offer to provide the Corresponding Source. This alternative is allowed only
|
||||
occasionally and noncommercially, and only if you received the object code
|
||||
with such an offer, in accord with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated place (gratis
|
||||
or for a charge), and offer equivalent access to the Corresponding Source
|
||||
in the same way through the same place at no further charge. You need not
|
||||
require recipients to copy the Corresponding Source along with the object
|
||||
code. If the place to copy the object code is a network server, the Corresponding
|
||||
Source may be on a different server (operated by you or a third party) that
|
||||
supports equivalent copying facilities, provided you maintain clear directions
|
||||
next to the object code saying where to find the Corresponding Source. Regardless
|
||||
of what server hosts the Corresponding Source, you remain obligated to ensure
|
||||
that it is available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided you inform
|
||||
other peers where the object code and Corresponding Source of the work are
|
||||
being offered to the general public at no charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded from
|
||||
the Corresponding Source as a System Library, need not be included in conveying
|
||||
the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any tangible
|
||||
personal property which is normally used for personal, family, or household
|
||||
purposes, or (2) anything designed or sold for incorporation into a dwelling.
|
||||
In determining whether a product is a consumer product, doubtful cases shall
|
||||
be resolved in favor of coverage. For a particular product received by a particular
|
||||
user, "normally used" refers to a typical or common use of that class of product,
|
||||
regardless of the status of the particular user or of the way in which the
|
||||
particular user actually uses, or expects or is expected to use, the product.
|
||||
A product is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent the
|
||||
only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods, procedures,
|
||||
authorization keys, or other information required to install and execute modified
|
||||
versions of a covered work in that User Product from a modified version of
|
||||
its Corresponding Source. The information must suffice to ensure that the
|
||||
continued functioning of the modified object code is in no case prevented
|
||||
or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically
|
||||
for use in, a User Product, and the conveying occurs as part of a transaction
|
||||
in which the right of possession and use of the User Product is transferred
|
||||
to the recipient in perpetuity or for a fixed term (regardless of how the
|
||||
transaction is characterized), the Corresponding Source conveyed under this
|
||||
section must be accompanied by the Installation Information. But this requirement
|
||||
does not apply if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has been installed
|
||||
in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement
|
||||
to continue to provide support service, warranty, or updates for a work that
|
||||
has been modified or installed by the recipient, or for the User Product in
|
||||
which it has been modified or installed. Access to a network may be denied
|
||||
when the modification itself materially and adversely affects the operation
|
||||
of the network or violates the rules and protocols for communication across
|
||||
the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord
|
||||
with this section must be in a format that is publicly documented (and with
|
||||
an implementation available to the public in source code form), and must require
|
||||
no special password or key for unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this License
|
||||
by making exceptions from one or more of its conditions. Additional permissions
|
||||
that are applicable to the entire Program shall be treated as though they
|
||||
were included in this License, to the extent that they are valid under applicable
|
||||
law. If additional permissions apply only to part of the Program, that part
|
||||
may be used separately under those permissions, but the entire Program remains
|
||||
governed by this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option remove any
|
||||
additional permissions from that copy, or from any part of it. (Additional
|
||||
permissions may be written to require their own removal in certain cases when
|
||||
you modify the work.) You may place additional permissions on material, added
|
||||
by you to a covered work, for which you have or can give appropriate copyright
|
||||
permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add
|
||||
to a covered work, you may (if authorized by the copyright holders of that
|
||||
material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the terms of
|
||||
sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or author
|
||||
attributions in that material or in the Appropriate Legal Notices displayed
|
||||
by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or requiring
|
||||
that modified versions of such material be marked in reasonable ways as different
|
||||
from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or authors
|
||||
of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some trade names,
|
||||
trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that material by
|
||||
anyone who conveys the material (or modified versions of it) with contractual
|
||||
assumptions of liability to the recipient, for any liability that these contractual
|
||||
assumptions directly impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further restrictions"
|
||||
within the meaning of section 10. If the Program as you received it, or any
|
||||
part of it, contains a notice stating that it is governed by this License
|
||||
along with a term that is a further restriction, you may remove that term.
|
||||
If a license document contains a further restriction but permits relicensing
|
||||
or conveying under this License, you may add to a covered work material governed
|
||||
by the terms of that license document, provided that the further restriction
|
||||
does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place,
|
||||
in the relevant source files, a statement of the additional terms that apply
|
||||
to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form
|
||||
of a separately written license, or stated as exceptions; the above requirements
|
||||
apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly provided
|
||||
under this License. Any attempt otherwise to propagate or modify it is void,
|
||||
and will automatically terminate your rights under this License (including
|
||||
any patent licenses granted under the third paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license from
|
||||
a particular copyright holder is reinstated (a) provisionally, unless and
|
||||
until the copyright holder explicitly and finally terminates your license,
|
||||
and (b) permanently, if the copyright holder fails to notify you of the violation
|
||||
by some reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently
|
||||
if the copyright holder notifies you of the violation by some reasonable means,
|
||||
this is the first time you have received notice of violation of this License
|
||||
(for any work) from that copyright holder, and you cure the violation prior
|
||||
to 30 days after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses
|
||||
of parties who have received copies or rights from you under this License.
|
||||
If your rights have been terminated and not permanently reinstated, you do
|
||||
not qualify to receive new licenses for the same material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or run a copy
|
||||
of the Program. Ancillary propagation of a covered work occurring solely as
|
||||
a consequence of using peer-to-peer transmission to receive a copy likewise
|
||||
does not require acceptance. However, nothing other than this License grants
|
||||
you permission to propagate or modify any covered work. These actions infringe
|
||||
copyright if you do not accept this License. Therefore, by modifying or propagating
|
||||
a covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically receives
|
||||
a license from the original licensors, to run, modify and propagate that work,
|
||||
subject to this License. You are not responsible for enforcing compliance
|
||||
by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an organization,
|
||||
or substantially all assets of one, or subdividing an organization, or merging
|
||||
organizations. If propagation of a covered work results from an entity transaction,
|
||||
each party to that transaction who receives a copy of the work also receives
|
||||
whatever licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the Corresponding
|
||||
Source of the work from the predecessor in interest, if the predecessor has
|
||||
it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights
|
||||
granted or affirmed under this License. For example, you may not impose a
|
||||
license fee, royalty, or other charge for exercise of rights granted under
|
||||
this License, and you may not initiate litigation (including a cross-claim
|
||||
or counterclaim in a lawsuit) alleging that any patent claim is infringed
|
||||
by making, using, selling, offering for sale, or importing the Program or
|
||||
any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this License
|
||||
of the Program or a work on which the Program is based. The work thus licensed
|
||||
is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims owned or controlled
|
||||
by the contributor, whether already acquired or hereafter acquired, that would
|
||||
be infringed by some manner, permitted by this License, of making, using,
|
||||
or selling its contributor version, but do not include claims that would be
|
||||
infringed only as a consequence of further modification of the contributor
|
||||
version. For purposes of this definition, "control" includes the right to
|
||||
grant patent sublicenses in a manner consistent with the requirements of this
|
||||
License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent
|
||||
license under the contributor's essential patent claims, to make, use, sell,
|
||||
offer for sale, import and otherwise run, modify and propagate the contents
|
||||
of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express agreement
|
||||
or commitment, however denominated, not to enforce a patent (such as an express
|
||||
permission to practice a patent or covenant not to sue for patent infringement).
|
||||
To "grant" such a patent license to a party means to make such an agreement
|
||||
or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the
|
||||
Corresponding Source of the work is not available for anyone to copy, free
|
||||
of charge and under the terms of this License, through a publicly available
|
||||
network server or other readily accessible means, then you must either (1)
|
||||
cause the Corresponding Source to be so available, or (2) arrange to deprive
|
||||
yourself of the benefit of the patent license for this particular work, or
|
||||
(3) arrange, in a manner consistent with the requirements of this License,
|
||||
to extend the patent license to downstream recipients. "Knowingly relying"
|
||||
means you have actual knowledge that, but for the patent license, your conveying
|
||||
the covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that country
|
||||
that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement,
|
||||
you convey, or propagate by procuring conveyance of, a covered work, and grant
|
||||
a patent license to some of the parties receiving the covered work authorizing
|
||||
them to use, propagate, modify or convey a specific copy of the covered work,
|
||||
then the patent license you grant is automatically extended to all recipients
|
||||
of the covered work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within the scope
|
||||
of its coverage, prohibits the exercise of, or is conditioned on the non-exercise
|
||||
of one or more of the rights that are specifically granted under this License.
|
||||
You may not convey a covered work if you are a party to an arrangement with
|
||||
a third party that is in the business of distributing software, under which
|
||||
you make payment to the third party based on the extent of your activity of
|
||||
conveying the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory patent
|
||||
license (a) in connection with copies of the covered work conveyed by you
|
||||
(or copies made from those copies), or (b) primarily for and in connection
|
||||
with specific products or compilations that contain the covered work, unless
|
||||
you entered into that arrangement, or that patent license was granted, prior
|
||||
to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied
|
||||
license or other defenses to infringement that may otherwise be available
|
||||
to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or otherwise)
|
||||
that contradict the conditions of this License, they do not excuse you from
|
||||
the conditions of this License. If you cannot convey a covered work so as
|
||||
to satisfy simultaneously your obligations under this License and any other
|
||||
pertinent obligations, then as a consequence you may not convey it at all.
|
||||
For example, if you agree to terms that obligate you to collect a royalty
|
||||
for further conveying from those to whom you convey the Program, the only
|
||||
way you could satisfy both those terms and this License would be to refrain
|
||||
entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have permission to
|
||||
link or combine any covered work with a work licensed under version 3 of the
|
||||
GNU Affero General Public License into a single combined work, and to convey
|
||||
the resulting work. The terms of this License will continue to apply to the
|
||||
part which is the covered work, but the special requirements of the GNU Affero
|
||||
General Public License, section 13, concerning interaction through a network
|
||||
will apply to the combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of the
|
||||
GNU General Public License from time to time. Such new versions will be similar
|
||||
in spirit to the present version, but may differ in detail to address new
|
||||
problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies
|
||||
that a certain numbered version of the GNU General Public License "or any
|
||||
later version" applies to it, you have the option of following the terms and
|
||||
conditions either of that numbered version or of any later version published
|
||||
by the Free Software Foundation. If the Program does not specify a version
|
||||
number of the GNU General Public License, you may choose any version ever
|
||||
published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of
|
||||
the GNU General Public License can be used, that proxy's public statement
|
||||
of acceptance of a version permanently authorizes you to choose that version
|
||||
for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However,
|
||||
no additional obligations are imposed on any author or copyright holder as
|
||||
a result of your choosing to follow a later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
|
||||
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM
|
||||
PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
|
||||
CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
|
||||
ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM
|
||||
AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
|
||||
INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO
|
||||
USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
|
||||
INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE
|
||||
PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
|
||||
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot
|
||||
be given local legal effect according to their terms, reviewing courts shall
|
||||
apply local law that most closely approximates an absolute waiver of all civil
|
||||
liability in connection with the Program, unless a warranty or assumption
|
||||
of liability accompanies a copy of the Program in return for a fee. END OF
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible
|
||||
use to the public, the best way to achieve this is to make it free software
|
||||
which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach
|
||||
them to the start of each source file to most effectively state the exclusion
|
||||
of warranty; and each file should have at least the "copyright" line and a
|
||||
pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short notice like
|
||||
this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
|
||||
This is free software, and you are welcome to redistribute it under certain
|
||||
conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands might
|
||||
be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary. For
|
||||
more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General Public
|
||||
License instead of this License. But first, please read <https://www.gnu.org/
|
||||
licenses /why-not-lgpl.html>.
|
||||
@@ -1,625 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for software and
|
||||
other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed to take
|
||||
away your freedom to share and change the works. By contrast, the GNU General
|
||||
Public License is intended to guarantee your freedom to share and change all
|
||||
versions of a program--to make sure it remains free software for all its users.
|
||||
We, the Free Software Foundation, use the GNU General Public License for most
|
||||
of our software; it applies also to any other work released this way by its
|
||||
authors. You can apply it to your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our
|
||||
General Public Licenses are designed to make sure that you have the freedom
|
||||
to distribute copies of free software (and charge for them if you wish), that
|
||||
you receive source code or can get it if you want it, that you can change
|
||||
the software or use pieces of it in new free programs, and that you know you
|
||||
can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you these rights
|
||||
or asking you to surrender the rights. Therefore, you have certain responsibilities
|
||||
if you distribute copies of the software, or if you modify it: responsibilities
|
||||
to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or
|
||||
for a fee, you must pass on to the recipients the same freedoms that you received.
|
||||
You must make sure that they, too, receive or can get the source code. And
|
||||
you must show them these terms so they know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps: (1) assert
|
||||
copyright on the software, and (2) offer you this License giving you legal
|
||||
permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains that
|
||||
there is no warranty for this free software. For both users' and authors'
|
||||
sake, the GPL requires that modified versions be marked as changed, so that
|
||||
their problems will not be attributed erroneously to authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run modified
|
||||
versions of the software inside them, although the manufacturer can do so.
|
||||
This is fundamentally incompatible with the aim of protecting users' freedom
|
||||
to change the software. The systematic pattern of such abuse occurs in the
|
||||
area of products for individuals to use, which is precisely where it is most
|
||||
unacceptable. Therefore, we have designed this version of the GPL to prohibit
|
||||
the practice for those products. If such problems arise substantially in other
|
||||
domains, we stand ready to extend this provision to those domains in future
|
||||
versions of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents. States
|
||||
should not allow patents to restrict development and use of software on general-purpose
|
||||
computers, but in those that do, we wish to avoid the special danger that
|
||||
patents applied to a free program could make it effectively proprietary. To
|
||||
prevent this, the GPL assures that patents cannot be used to render the program
|
||||
non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of works,
|
||||
such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this License.
|
||||
Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals
|
||||
or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work in
|
||||
a fashion requiring copyright permission, other than the making of an exact
|
||||
copy. The resulting work is called a "modified version" of the earlier work
|
||||
or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based on the
|
||||
Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without permission,
|
||||
would make you directly or secondarily liable for infringement under applicable
|
||||
copyright law, except executing it on a computer or modifying a private copy.
|
||||
Propagation includes copying, distribution (with or without modification),
|
||||
making available to the public, and in some countries other activities as
|
||||
well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other parties
|
||||
to make or receive copies. Mere interaction with a user through a computer
|
||||
network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices" to the
|
||||
extent that it includes a convenient and prominently visible feature that
|
||||
(1) displays an appropriate copyright notice, and (2) tells the user that
|
||||
there is no warranty for the work (except to the extent that warranties are
|
||||
provided), that licensees may convey the work under this License, and how
|
||||
to view a copy of this License. If the interface presents a list of user commands
|
||||
or options, such as a menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work for making
|
||||
modifications to it. "Object code" means any non-source form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official standard
|
||||
defined by a recognized standards body, or, in the case of interfaces specified
|
||||
for a particular programming language, one that is widely used among developers
|
||||
working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other than
|
||||
the work as a whole, that (a) is included in the normal form of packaging
|
||||
a Major Component, but which is not part of that Major Component, and (b)
|
||||
serves only to enable use of the work with that Major Component, or to implement
|
||||
a Standard Interface for which an implementation is available to the public
|
||||
in source code form. A "Major Component", in this context, means a major essential
|
||||
component (kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to produce
|
||||
the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all the source
|
||||
code needed to generate, install, and (for an executable work) run the object
|
||||
code and to modify the work, including scripts to control those activities.
|
||||
However, it does not include the work's System Libraries, or general-purpose
|
||||
tools or generally available free programs which are used unmodified in performing
|
||||
those activities but which are not part of the work. For example, Corresponding
|
||||
Source includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically linked
|
||||
subprograms that the work is specifically designed to require, such as by
|
||||
intimate data communication or control flow between those subprograms and
|
||||
other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users can regenerate
|
||||
automatically from other parts of the Corresponding Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of copyright
|
||||
on the Program, and are irrevocable provided the stated conditions are met.
|
||||
This License explicitly affirms your unlimited permission to run the unmodified
|
||||
Program. The output from running a covered work is covered by this License
|
||||
only if the output, given its content, constitutes a covered work. This License
|
||||
acknowledges your rights of fair use or other equivalent, as provided by copyright
|
||||
law.
|
||||
|
||||
You may make, run and propagate covered works that you do not convey, without
|
||||
conditions so long as your license otherwise remains in force. You may convey
|
||||
covered works to others for the sole purpose of having them make modifications
|
||||
exclusively for you, or provide you with facilities for running those works,
|
||||
provided that you comply with the terms of this License in conveying all material
|
||||
for which you do not control copyright. Those thus making or running the covered
|
||||
works for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of your copyrighted
|
||||
material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under the conditions
|
||||
stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological measure
|
||||
under any applicable law fulfilling obligations under article 11 of the WIPO
|
||||
copyright treaty adopted on 20 December 1996, or similar laws prohibiting
|
||||
or restricting circumvention of such measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid circumvention
|
||||
of technological measures to the extent such circumvention is effected by
|
||||
exercising rights under this License with respect to the covered work, and
|
||||
you disclaim any intention to limit operation or modification of the work
|
||||
as a means of enforcing, against the work's users, your or third parties'
|
||||
legal rights to forbid circumvention of technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you receive
|
||||
it, in any medium, provided that you conspicuously and appropriately publish
|
||||
on each copy an appropriate copyright notice; keep intact all notices stating
|
||||
that this License and any non-permissive terms added in accord with section
|
||||
7 apply to the code; keep intact all notices of the absence of any warranty;
|
||||
and give all recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey, and you
|
||||
may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to produce
|
||||
it from the Program, in the form of source code under the terms of section
|
||||
4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified it, and
|
||||
giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is released under
|
||||
this License and any conditions added under section 7. This requirement modifies
|
||||
the requirement in section 4 to "keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this License to anyone
|
||||
who comes into possession of a copy. This License will therefore apply, along
|
||||
with any applicable section 7 additional terms, to the whole of the work,
|
||||
and all its parts, regardless of how they are packaged. This License gives
|
||||
no permission to license the work in any other way, but it does not invalidate
|
||||
such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display Appropriate
|
||||
Legal Notices; however, if the Program has interactive interfaces that do
|
||||
not display Appropriate Legal Notices, your work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent works,
|
||||
which are not by their nature extensions of the covered work, and which are
|
||||
not combined with it such as to form a larger program, in or on a volume of
|
||||
a storage or distribution medium, is called an "aggregate" if the compilation
|
||||
and its resulting copyright are not used to limit the access or legal rights
|
||||
of the compilation's users beyond what the individual works permit. Inclusion
|
||||
of a covered work in an aggregate does not cause this License to apply to
|
||||
the other parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms of sections
|
||||
4 and 5, provided that you also convey the machine-readable Corresponding
|
||||
Source under the terms of this License, in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product (including
|
||||
a physical distribution medium), accompanied by the Corresponding Source fixed
|
||||
on a durable physical medium customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product (including
|
||||
a physical distribution medium), accompanied by a written offer, valid for
|
||||
at least three years and valid for as long as you offer spare parts or customer
|
||||
support for that product model, to give anyone who possesses the object code
|
||||
either (1) a copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical medium customarily
|
||||
used for software interchange, for a price no more than your reasonable cost
|
||||
of physically performing this conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the written
|
||||
offer to provide the Corresponding Source. This alternative is allowed only
|
||||
occasionally and noncommercially, and only if you received the object code
|
||||
with such an offer, in accord with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated place (gratis
|
||||
or for a charge), and offer equivalent access to the Corresponding Source
|
||||
in the same way through the same place at no further charge. You need not
|
||||
require recipients to copy the Corresponding Source along with the object
|
||||
code. If the place to copy the object code is a network server, the Corresponding
|
||||
Source may be on a different server (operated by you or a third party) that
|
||||
supports equivalent copying facilities, provided you maintain clear directions
|
||||
next to the object code saying where to find the Corresponding Source. Regardless
|
||||
of what server hosts the Corresponding Source, you remain obligated to ensure
|
||||
that it is available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided you inform
|
||||
other peers where the object code and Corresponding Source of the work are
|
||||
being offered to the general public at no charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded from
|
||||
the Corresponding Source as a System Library, need not be included in conveying
|
||||
the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any tangible
|
||||
personal property which is normally used for personal, family, or household
|
||||
purposes, or (2) anything designed or sold for incorporation into a dwelling.
|
||||
In determining whether a product is a consumer product, doubtful cases shall
|
||||
be resolved in favor of coverage. For a particular product received by a particular
|
||||
user, "normally used" refers to a typical or common use of that class of product,
|
||||
regardless of the status of the particular user or of the way in which the
|
||||
particular user actually uses, or expects or is expected to use, the product.
|
||||
A product is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent the
|
||||
only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods, procedures,
|
||||
authorization keys, or other information required to install and execute modified
|
||||
versions of a covered work in that User Product from a modified version of
|
||||
its Corresponding Source. The information must suffice to ensure that the
|
||||
continued functioning of the modified object code is in no case prevented
|
||||
or interfered with solely because modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or specifically
|
||||
for use in, a User Product, and the conveying occurs as part of a transaction
|
||||
in which the right of possession and use of the User Product is transferred
|
||||
to the recipient in perpetuity or for a fixed term (regardless of how the
|
||||
transaction is characterized), the Corresponding Source conveyed under this
|
||||
section must be accompanied by the Installation Information. But this requirement
|
||||
does not apply if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has been installed
|
||||
in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a requirement
|
||||
to continue to provide support service, warranty, or updates for a work that
|
||||
has been modified or installed by the recipient, or for the User Product in
|
||||
which it has been modified or installed. Access to a network may be denied
|
||||
when the modification itself materially and adversely affects the operation
|
||||
of the network or violates the rules and protocols for communication across
|
||||
the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided, in accord
|
||||
with this section must be in a format that is publicly documented (and with
|
||||
an implementation available to the public in source code form), and must require
|
||||
no special password or key for unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this License
|
||||
by making exceptions from one or more of its conditions. Additional permissions
|
||||
that are applicable to the entire Program shall be treated as though they
|
||||
were included in this License, to the extent that they are valid under applicable
|
||||
law. If additional permissions apply only to part of the Program, that part
|
||||
may be used separately under those permissions, but the entire Program remains
|
||||
governed by this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option remove any
|
||||
additional permissions from that copy, or from any part of it. (Additional
|
||||
permissions may be written to require their own removal in certain cases when
|
||||
you modify the work.) You may place additional permissions on material, added
|
||||
by you to a covered work, for which you have or can give appropriate copyright
|
||||
permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you add
|
||||
to a covered work, you may (if authorized by the copyright holders of that
|
||||
material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the terms of
|
||||
sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or author
|
||||
attributions in that material or in the Appropriate Legal Notices displayed
|
||||
by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or requiring
|
||||
that modified versions of such material be marked in reasonable ways as different
|
||||
from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or authors
|
||||
of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some trade names,
|
||||
trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that material by
|
||||
anyone who conveys the material (or modified versions of it) with contractual
|
||||
assumptions of liability to the recipient, for any liability that these contractual
|
||||
assumptions directly impose on those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further restrictions"
|
||||
within the meaning of section 10. If the Program as you received it, or any
|
||||
part of it, contains a notice stating that it is governed by this License
|
||||
along with a term that is a further restriction, you may remove that term.
|
||||
If a license document contains a further restriction but permits relicensing
|
||||
or conveying under this License, you may add to a covered work material governed
|
||||
by the terms of that license document, provided that the further restriction
|
||||
does not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you must place,
|
||||
in the relevant source files, a statement of the additional terms that apply
|
||||
to those files, or a notice indicating where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the form
|
||||
of a separately written license, or stated as exceptions; the above requirements
|
||||
apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly provided
|
||||
under this License. Any attempt otherwise to propagate or modify it is void,
|
||||
and will automatically terminate your rights under this License (including
|
||||
any patent licenses granted under the third paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your license from
|
||||
a particular copyright holder is reinstated (a) provisionally, unless and
|
||||
until the copyright holder explicitly and finally terminates your license,
|
||||
and (b) permanently, if the copyright holder fails to notify you of the violation
|
||||
by some reasonable means prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is reinstated permanently
|
||||
if the copyright holder notifies you of the violation by some reasonable means,
|
||||
this is the first time you have received notice of violation of this License
|
||||
(for any work) from that copyright holder, and you cure the violation prior
|
||||
to 30 days after your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the licenses
|
||||
of parties who have received copies or rights from you under this License.
|
||||
If your rights have been terminated and not permanently reinstated, you do
|
||||
not qualify to receive new licenses for the same material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or run a copy
|
||||
of the Program. Ancillary propagation of a covered work occurring solely as
|
||||
a consequence of using peer-to-peer transmission to receive a copy likewise
|
||||
does not require acceptance. However, nothing other than this License grants
|
||||
you permission to propagate or modify any covered work. These actions infringe
|
||||
copyright if you do not accept this License. Therefore, by modifying or propagating
|
||||
a covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically receives
|
||||
a license from the original licensors, to run, modify and propagate that work,
|
||||
subject to this License. You are not responsible for enforcing compliance
|
||||
by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an organization,
|
||||
or substantially all assets of one, or subdividing an organization, or merging
|
||||
organizations. If propagation of a covered work results from an entity transaction,
|
||||
each party to that transaction who receives a copy of the work also receives
|
||||
whatever licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the Corresponding
|
||||
Source of the work from the predecessor in interest, if the predecessor has
|
||||
it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the rights
|
||||
granted or affirmed under this License. For example, you may not impose a
|
||||
license fee, royalty, or other charge for exercise of rights granted under
|
||||
this License, and you may not initiate litigation (including a cross-claim
|
||||
or counterclaim in a lawsuit) alleging that any patent claim is infringed
|
||||
by making, using, selling, offering for sale, or importing the Program or
|
||||
any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this License
|
||||
of the Program or a work on which the Program is based. The work thus licensed
|
||||
is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims owned or controlled
|
||||
by the contributor, whether already acquired or hereafter acquired, that would
|
||||
be infringed by some manner, permitted by this License, of making, using,
|
||||
or selling its contributor version, but do not include claims that would be
|
||||
infringed only as a consequence of further modification of the contributor
|
||||
version. For purposes of this definition, "control" includes the right to
|
||||
grant patent sublicenses in a manner consistent with the requirements of this
|
||||
License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent
|
||||
license under the contributor's essential patent claims, to make, use, sell,
|
||||
offer for sale, import and otherwise run, modify and propagate the contents
|
||||
of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express agreement
|
||||
or commitment, however denominated, not to enforce a patent (such as an express
|
||||
permission to practice a patent or covenant not to sue for patent infringement).
|
||||
To "grant" such a patent license to a party means to make such an agreement
|
||||
or commitment not to enforce a patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license, and the
|
||||
Corresponding Source of the work is not available for anyone to copy, free
|
||||
of charge and under the terms of this License, through a publicly available
|
||||
network server or other readily accessible means, then you must either (1)
|
||||
cause the Corresponding Source to be so available, or (2) arrange to deprive
|
||||
yourself of the benefit of the patent license for this particular work, or
|
||||
(3) arrange, in a manner consistent with the requirements of this License,
|
||||
to extend the patent license to downstream recipients. "Knowingly relying"
|
||||
means you have actual knowledge that, but for the patent license, your conveying
|
||||
the covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that country
|
||||
that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or arrangement,
|
||||
you convey, or propagate by procuring conveyance of, a covered work, and grant
|
||||
a patent license to some of the parties receiving the covered work authorizing
|
||||
them to use, propagate, modify or convey a specific copy of the covered work,
|
||||
then the patent license you grant is automatically extended to all recipients
|
||||
of the covered work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within the scope
|
||||
of its coverage, prohibits the exercise of, or is conditioned on the non-exercise
|
||||
of one or more of the rights that are specifically granted under this License.
|
||||
You may not convey a covered work if you are a party to an arrangement with
|
||||
a third party that is in the business of distributing software, under which
|
||||
you make payment to the third party based on the extent of your activity of
|
||||
conveying the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory patent
|
||||
license (a) in connection with copies of the covered work conveyed by you
|
||||
(or copies made from those copies), or (b) primarily for and in connection
|
||||
with specific products or compilations that contain the covered work, unless
|
||||
you entered into that arrangement, or that patent license was granted, prior
|
||||
to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting any implied
|
||||
license or other defenses to infringement that may otherwise be available
|
||||
to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or otherwise)
|
||||
that contradict the conditions of this License, they do not excuse you from
|
||||
the conditions of this License. If you cannot convey a covered work so as
|
||||
to satisfy simultaneously your obligations under this License and any other
|
||||
pertinent obligations, then as a consequence you may not convey it at all.
|
||||
For example, if you agree to terms that obligate you to collect a royalty
|
||||
for further conveying from those to whom you convey the Program, the only
|
||||
way you could satisfy both those terms and this License would be to refrain
|
||||
entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have permission to
|
||||
link or combine any covered work with a work licensed under version 3 of the
|
||||
GNU Affero General Public License into a single combined work, and to convey
|
||||
the resulting work. The terms of this License will continue to apply to the
|
||||
part which is the covered work, but the special requirements of the GNU Affero
|
||||
General Public License, section 13, concerning interaction through a network
|
||||
will apply to the combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of the
|
||||
GNU General Public License from time to time. Such new versions will be similar
|
||||
in spirit to the present version, but may differ in detail to address new
|
||||
problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program specifies
|
||||
that a certain numbered version of the GNU General Public License "or any
|
||||
later version" applies to it, you have the option of following the terms and
|
||||
conditions either of that numbered version or of any later version published
|
||||
by the Free Software Foundation. If the Program does not specify a version
|
||||
number of the GNU General Public License, you may choose any version ever
|
||||
published by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future versions of
|
||||
the GNU General Public License can be used, that proxy's public statement
|
||||
of acceptance of a version permanently authorizes you to choose that version
|
||||
for the Program.
|
||||
|
||||
Later license versions may give you additional or different permissions. However,
|
||||
no additional obligations are imposed on any author or copyright holder as
|
||||
a result of your choosing to follow a later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
|
||||
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM
|
||||
PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
|
||||
CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
|
||||
ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM
|
||||
AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
|
||||
INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO
|
||||
USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
|
||||
INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE
|
||||
PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
|
||||
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided above cannot
|
||||
be given local legal effect according to their terms, reviewing courts shall
|
||||
apply local law that most closely approximates an absolute waiver of all civil
|
||||
liability in connection with the Program, unless a warranty or assumption
|
||||
of liability accompanies a copy of the Program in return for a fee. END OF
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest possible
|
||||
use to the public, the best way to achieve this is to make it free software
|
||||
which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to attach
|
||||
them to the start of each source file to most effectively state the exclusion
|
||||
of warranty; and each file should have at least the "copyright" line and a
|
||||
pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
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 3 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, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short notice like
|
||||
this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
|
||||
This is free software, and you are welcome to redistribute it under certain
|
||||
conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands might
|
||||
be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary. For
|
||||
more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General Public
|
||||
License instead of this License. But first, please read <https://www.gnu.org/
|
||||
licenses /why-not-lgpl.html>.
|
||||
@@ -1,446 +0,0 @@
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is numbered 2 because
|
||||
it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share
|
||||
and change it. By contrast, the GNU General Public Licenses are intended to
|
||||
guarantee your freedom to share and change free software--to make sure the
|
||||
software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some specially
|
||||
designated Free Software Foundation software, and to any other libraries whose
|
||||
authors decide to use it. You can use it for your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our
|
||||
General Public Licenses are designed to make sure that you have the freedom
|
||||
to distribute copies of free software (and charge for this service if you
|
||||
wish), that you receive source code or can get it if you want it, that you
|
||||
can change the software or use pieces of it in new free programs; and that
|
||||
you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to
|
||||
deny you these rights or to ask you to surrender the rights. These restrictions
|
||||
translate to certain responsibilities for you if you distribute copies of
|
||||
the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis or for
|
||||
a fee, you must give the recipients all the rights that we gave you. You must
|
||||
make sure that they, too, receive or can get the source code. If you link
|
||||
a program with the library, you must provide complete object files to the
|
||||
recipients so that they can relink them with the library, after making changes
|
||||
to the library and recompiling it. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright the library,
|
||||
and (2) offer you this license which gives you legal permission to copy, distribute
|
||||
and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain that everyone
|
||||
understands that there is no warranty for this free library. If the library
|
||||
is modified by someone else and passed on, we want its recipients to know
|
||||
that what they have is not the original version, so that any problems introduced
|
||||
by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We
|
||||
wish to avoid the danger that companies distributing free software will individually
|
||||
obtain patent licenses, thus in effect transforming the program into proprietary
|
||||
software. To prevent this, we have made it clear that any patent must be licensed
|
||||
for everyone's free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary GNU
|
||||
General Public License, which was designed for utility programs. This license,
|
||||
the GNU Library General Public License, applies to certain designated libraries.
|
||||
This license is quite different from the ordinary one; be sure to read it
|
||||
in full, and don't assume that anything in it is the same as in the ordinary
|
||||
license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that they
|
||||
blur the distinction we usually make between modifying or adding to a program
|
||||
and simply using it. Linking a program with a library, without changing the
|
||||
library, is in some sense simply using the library, and is analogous to running
|
||||
a utility program or application program. However, in a textual and legal
|
||||
sense, the linked executable is a combined work, a derivative of the original
|
||||
library, and the ordinary General Public License treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General Public License
|
||||
for libraries did not effectively promote software sharing, because most developers
|
||||
did not use the libraries. We concluded that weaker conditions might promote
|
||||
sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the users
|
||||
of those programs of all benefit from the free status of the libraries themselves.
|
||||
This Library General Public License is intended to permit developers of non-free
|
||||
programs to use free libraries, while preserving your freedom as a user of
|
||||
such programs to change the free libraries that are incorporated in them.
|
||||
(We have not seen how to achieve this as regards changes in header files,
|
||||
but we have achieved it as regards changes in the actual functions of the
|
||||
Library.) The hope is that this will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow. Pay close attention to the difference between a "work based on the
|
||||
library" and a "work that uses the library". The former contains code derived
|
||||
from the library, while the latter only works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary General
|
||||
Public License rather than by this special one.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which contains a
|
||||
notice placed by the copyright holder or other authorized party saying it
|
||||
may be distributed under the terms of this Library General Public License
|
||||
(also called "this License"). Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data prepared
|
||||
so as to be conveniently linked with application programs (which use some
|
||||
of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work which has
|
||||
been distributed under these terms. A "work based on the Library" means either
|
||||
the Library or any derivative work under copyright law: that is to say, a
|
||||
work containing the Library or a portion of it, either verbatim or with modifications
|
||||
and/or translated straightforwardly into another language. (Hereinafter, translation
|
||||
is included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for making modifications
|
||||
to it. For a library, complete source code means all the source code for all
|
||||
modules it contains, plus any associated interface definition files, plus
|
||||
the scripts used to control compilation and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not covered
|
||||
by this License; they are outside its scope. The act of running a program
|
||||
using the Library is not restricted, and output from such a program is covered
|
||||
only if its contents constitute a work based on the Library (independent of
|
||||
the use of the Library in a tool for writing it). Whether that is true depends
|
||||
on what the Library does and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's complete source
|
||||
code as you receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice and disclaimer
|
||||
of warranty; keep intact all the notices that refer to this License and to
|
||||
the absence of any warranty; and distribute a copy of this License along with
|
||||
the Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you
|
||||
may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion of it,
|
||||
thus forming a work based on the Library, and copy and distribute such modifications
|
||||
or work under the terms of Section 1 above, provided that you also meet all
|
||||
of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices stating that
|
||||
you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no charge to all
|
||||
third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a table of
|
||||
data to be supplied by an application program that uses the facility, other
|
||||
than as an argument passed when the facility is invoked, then you must make
|
||||
a good faith effort to ensure that, in the event an application does not supply
|
||||
such function or table, the facility still operates, and performs whatever
|
||||
part of its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has a purpose
|
||||
that is entirely well-defined independent of the application. Therefore, Subsection
|
||||
2d requires that any application-supplied function or table used by this function
|
||||
must be optional: if the application does not supply it, the square root function
|
||||
must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable
|
||||
sections of that work are not derived from the Library, and can be reasonably
|
||||
considered independent and separate works in themselves, then this License,
|
||||
and its terms, do not apply to those sections when you distribute them as
|
||||
separate works. But when you distribute the same sections as part of a whole
|
||||
which is a work based on the Library, the distribution of the whole must be
|
||||
on the terms of this License, whose permissions for other licensees extend
|
||||
to the entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your
|
||||
rights to work written entirely by you; rather, the intent is to exercise
|
||||
the right to control the distribution of derivative or collective works based
|
||||
on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library with
|
||||
the Library (or with a work based on the Library) on a volume of a storage
|
||||
or distribution medium does not bring the other work under the scope of this
|
||||
License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public License
|
||||
instead of this License to a given copy of the Library. To do this, you must
|
||||
alter all the notices that refer to this License, so that they refer to the
|
||||
ordinary GNU General Public License, version 2, instead of to this License.
|
||||
(If a newer version than version 2 of the ordinary GNU General Public License
|
||||
has appeared, then you can specify that version instead if you wish.) Do not
|
||||
make any other change in these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for that copy,
|
||||
so the ordinary GNU General Public License applies to all subsequent copies
|
||||
and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of the Library
|
||||
into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or derivative of
|
||||
it, under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you accompany it with the complete corresponding
|
||||
machine-readable source code, which must be distributed under the terms of
|
||||
Sections 1 and 2 above on a medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy from a designated
|
||||
place, then offering equivalent access to copy the source code from the same
|
||||
place satisfies the requirement to distribute the source code, even though
|
||||
third parties are not compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the Library, but
|
||||
is designed to work with the Library by being compiled or linked with it,
|
||||
is called a "work that uses the Library". Such a work, in isolation, is not
|
||||
a derivative work of the Library, and therefore falls outside the scope of
|
||||
this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library creates an
|
||||
executable that is a derivative of the Library (because it contains portions
|
||||
of the Library), rather than a "work that uses the library". The executable
|
||||
is therefore covered by this License. Section 6 states terms for distribution
|
||||
of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file that
|
||||
is part of the Library, the object code for the work may be a derivative work
|
||||
of the Library even though the source code is not. Whether this is true is
|
||||
especially significant if the work can be linked without the Library, or if
|
||||
the work is itself a library. The threshold for this to be true is not precisely
|
||||
defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data structure layouts
|
||||
and accessors, and small macros and small inline functions (ten lines or less
|
||||
in length), then the use of the object file is unrestricted, regardless of
|
||||
whether it is legally a derivative work. (Executables containing this object
|
||||
code plus portions of the Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may distribute
|
||||
the object code for the work under the terms of Section 6. Any executables
|
||||
containing that work also fall under Section 6, whether or not they are linked
|
||||
directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or link a "work
|
||||
that uses the Library" with the Library to produce a work containing portions
|
||||
of the Library, and distribute that work under terms of your choice, provided
|
||||
that the terms permit modification of the work for the customer's own use
|
||||
and reverse engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the Library
|
||||
is used in it and that the Library and its use are covered by this License.
|
||||
You must supply a copy of this License. If the work during execution displays
|
||||
copyright notices, you must include the copyright notice for the Library among
|
||||
them, as well as a reference directing the user to the copy of this License.
|
||||
Also, you must do one of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding machine-readable source
|
||||
code for the Library including whatever changes were used in the work (which
|
||||
must be distributed under Sections 1 and 2 above); and, if the work is an
|
||||
executable linked with the Library, with the complete machine-readable "work
|
||||
that uses the Library", as object code and/or source code, so that the user
|
||||
can modify the Library and then relink to produce a modified executable containing
|
||||
the modified Library. (It is understood that the user who changes the contents
|
||||
of definitions files in the Library will not necessarily be able to recompile
|
||||
the application to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at least three years,
|
||||
to give the same user the materials specified in Subsection 6a, above, for
|
||||
a charge no more than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy from a designated
|
||||
place, offer equivalent access to copy the above specified materials from
|
||||
the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these materials or
|
||||
that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the Library" must
|
||||
include any data and utility programs needed for reproducing the executable
|
||||
from it. However, as a special exception, the source code distributed need
|
||||
not include anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the operating
|
||||
system on which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license restrictions of
|
||||
other proprietary libraries that do not normally accompany the operating system.
|
||||
Such a contradiction means you cannot use both them and the Library together
|
||||
in an executable that you distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the Library side-by-side
|
||||
in a single library together with other library facilities not covered by
|
||||
this License, and distribute such a combined library, provided that the separate
|
||||
distribution of the work based on the Library and of the other library facilities
|
||||
is otherwise permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based on the
|
||||
Library, uncombined with any other library facilities. This must be distributed
|
||||
under the terms of the Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact that part of
|
||||
it is a work based on the Library, and explaining where to find the accompanying
|
||||
uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute the Library
|
||||
except as expressly provided under this License. Any attempt otherwise to
|
||||
copy, modify, sublicense, link with, or distribute the Library is void, and
|
||||
will automatically terminate your rights under this License. However, parties
|
||||
who have received copies, or rights, from you under this License will not
|
||||
have their licenses terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not signed
|
||||
it. However, nothing else grants you permission to modify or distribute the
|
||||
Library or its derivative works. These actions are prohibited by law if you
|
||||
do not accept this License. Therefore, by modifying or distributing the Library
|
||||
(or any work based on the Library), you indicate your acceptance of this License
|
||||
to do so, and all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the Library),
|
||||
the recipient automatically receives a license from the original licensor
|
||||
to copy, distribute, link with or modify the Library subject to these terms
|
||||
and conditions. You may not impose any further restrictions on the recipients'
|
||||
exercise of the rights granted herein. You are not responsible for enforcing
|
||||
compliance by third parties to this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent infringement
|
||||
or for any other reason (not limited to patent issues), conditions are imposed
|
||||
on you (whether by court order, agreement or otherwise) that contradict the
|
||||
conditions of this License, they do not excuse you from the conditions of
|
||||
this License. If you cannot distribute so as to satisfy simultaneously your
|
||||
obligations under this License and any other pertinent obligations, then as
|
||||
a consequence you may not distribute the Library at all. For example, if a
|
||||
patent license would not permit royalty-free redistribution of the Library
|
||||
by all those who receive copies directly or indirectly through you, then the
|
||||
only way you could satisfy both it and this License would be to refrain entirely
|
||||
from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents
|
||||
or other property right claims or to contest validity of any such claims;
|
||||
this section has the sole purpose of protecting the integrity of the free
|
||||
software distribution system which is implemented by public license practices.
|
||||
Many people have made generous contributions to the wide range of software
|
||||
distributed through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing to
|
||||
distribute software through any other system and a licensee cannot impose
|
||||
that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a
|
||||
consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in certain
|
||||
countries either by patents or by copyrighted interfaces, the original copyright
|
||||
holder who places the Library under this License may add an explicit geographical
|
||||
distribution limitation excluding those countries, so that distribution is
|
||||
permitted only in or among countries not thus excluded. In such case, this
|
||||
License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new versions of
|
||||
the Library General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to address
|
||||
new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library specifies
|
||||
a version number of this License which applies to it and "any later version",
|
||||
you have the option of following the terms and conditions either of that version
|
||||
or of any later version published by the Free Software Foundation. If the
|
||||
Library does not specify a license version number, you may choose any version
|
||||
ever published by the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free programs
|
||||
whose distribution conditions are incompatible with these, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free Software
|
||||
Foundation, write to the Free Software Foundation; we sometimes make exceptions
|
||||
for this. Our decision will be guided by the two goals of preserving the free
|
||||
status of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
|
||||
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
|
||||
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY
|
||||
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
|
||||
OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
|
||||
THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
|
||||
OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
|
||||
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
|
||||
OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
|
||||
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest possible
|
||||
use to the public, we recommend making it free software that everyone can
|
||||
redistribute and change. You can do so by permitting redistribution under
|
||||
these terms (or, alternatively, under the terms of the ordinary General Public
|
||||
License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is safest
|
||||
to attach them to the start of each source file to most effectively convey
|
||||
the exclusion of warranty; and each file should have at least the "copyright"
|
||||
line and a pointer to where the full notice is found.
|
||||
|
||||
one line to give the library's name and an idea of what it does.
|
||||
|
||||
Copyright (C) year name of author
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Library General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This library 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 Library General Public License for more
|
||||
details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school,
|
||||
if any, to sign a "copyright disclaimer" for the library, if necessary. Here
|
||||
is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in
|
||||
|
||||
the library `Frob' (a library for tweaking knobs) written
|
||||
|
||||
by James Random Hacker.
|
||||
|
||||
signature of Ty Coon, 1 April 1990
|
||||
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
@@ -1,446 +0,0 @@
|
||||
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the library GPL. It is numbered 2 because
|
||||
it goes with version 2 of the ordinary GPL.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share
|
||||
and change it. By contrast, the GNU General Public Licenses are intended to
|
||||
guarantee your freedom to share and change free software--to make sure the
|
||||
software is free for all its users.
|
||||
|
||||
This license, the Library General Public License, applies to some specially
|
||||
designated Free Software Foundation software, and to any other libraries whose
|
||||
authors decide to use it. You can use it for your libraries, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not price. Our
|
||||
General Public Licenses are designed to make sure that you have the freedom
|
||||
to distribute copies of free software (and charge for this service if you
|
||||
wish), that you receive source code or can get it if you want it, that you
|
||||
can change the software or use pieces of it in new free programs; and that
|
||||
you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid anyone to
|
||||
deny you these rights or to ask you to surrender the rights. These restrictions
|
||||
translate to certain responsibilities for you if you distribute copies of
|
||||
the library, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis or for
|
||||
a fee, you must give the recipients all the rights that we gave you. You must
|
||||
make sure that they, too, receive or can get the source code. If you link
|
||||
a program with the library, you must provide complete object files to the
|
||||
recipients so that they can relink them with the library, after making changes
|
||||
to the library and recompiling it. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Our method of protecting your rights has two steps: (1) copyright the library,
|
||||
and (2) offer you this license which gives you legal permission to copy, distribute
|
||||
and/or modify the library.
|
||||
|
||||
Also, for each distributor's protection, we want to make certain that everyone
|
||||
understands that there is no warranty for this free library. If the library
|
||||
is modified by someone else and passed on, we want its recipients to know
|
||||
that what they have is not the original version, so that any problems introduced
|
||||
by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We
|
||||
wish to avoid the danger that companies distributing free software will individually
|
||||
obtain patent licenses, thus in effect transforming the program into proprietary
|
||||
software. To prevent this, we have made it clear that any patent must be licensed
|
||||
for everyone's free use or not licensed at all.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary GNU
|
||||
General Public License, which was designed for utility programs. This license,
|
||||
the GNU Library General Public License, applies to certain designated libraries.
|
||||
This license is quite different from the ordinary one; be sure to read it
|
||||
in full, and don't assume that anything in it is the same as in the ordinary
|
||||
license.
|
||||
|
||||
The reason we have a separate public license for some libraries is that they
|
||||
blur the distinction we usually make between modifying or adding to a program
|
||||
and simply using it. Linking a program with a library, without changing the
|
||||
library, is in some sense simply using the library, and is analogous to running
|
||||
a utility program or application program. However, in a textual and legal
|
||||
sense, the linked executable is a combined work, a derivative of the original
|
||||
library, and the ordinary General Public License treats it as such.
|
||||
|
||||
Because of this blurred distinction, using the ordinary General Public License
|
||||
for libraries did not effectively promote software sharing, because most developers
|
||||
did not use the libraries. We concluded that weaker conditions might promote
|
||||
sharing better.
|
||||
|
||||
However, unrestricted linking of non-free programs would deprive the users
|
||||
of those programs of all benefit from the free status of the libraries themselves.
|
||||
This Library General Public License is intended to permit developers of non-free
|
||||
programs to use free libraries, while preserving your freedom as a user of
|
||||
such programs to change the free libraries that are incorporated in them.
|
||||
(We have not seen how to achieve this as regards changes in header files,
|
||||
but we have achieved it as regards changes in the actual functions of the
|
||||
Library.) The hope is that this will lead to faster development of free libraries.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow. Pay close attention to the difference between a "work based on the
|
||||
library" and a "work that uses the library". The former contains code derived
|
||||
from the library, while the latter only works together with the library.
|
||||
|
||||
Note that it is possible for a library to be covered by the ordinary General
|
||||
Public License rather than by this special one.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library which contains a
|
||||
notice placed by the copyright holder or other authorized party saying it
|
||||
may be distributed under the terms of this Library General Public License
|
||||
(also called "this License"). Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data prepared
|
||||
so as to be conveniently linked with application programs (which use some
|
||||
of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work which has
|
||||
been distributed under these terms. A "work based on the Library" means either
|
||||
the Library or any derivative work under copyright law: that is to say, a
|
||||
work containing the Library or a portion of it, either verbatim or with modifications
|
||||
and/or translated straightforwardly into another language. (Hereinafter, translation
|
||||
is included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for making modifications
|
||||
to it. For a library, complete source code means all the source code for all
|
||||
modules it contains, plus any associated interface definition files, plus
|
||||
the scripts used to control compilation and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not covered
|
||||
by this License; they are outside its scope. The act of running a program
|
||||
using the Library is not restricted, and output from such a program is covered
|
||||
only if its contents constitute a work based on the Library (independent of
|
||||
the use of the Library in a tool for writing it). Whether that is true depends
|
||||
on what the Library does and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's complete source
|
||||
code as you receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice and disclaimer
|
||||
of warranty; keep intact all the notices that refer to this License and to
|
||||
the absence of any warranty; and distribute a copy of this License along with
|
||||
the Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you
|
||||
may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion of it,
|
||||
thus forming a work based on the Library, and copy and distribute such modifications
|
||||
or work under the terms of Section 1 above, provided that you also meet all
|
||||
of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices stating that
|
||||
you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no charge to all
|
||||
third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a table of
|
||||
data to be supplied by an application program that uses the facility, other
|
||||
than as an argument passed when the facility is invoked, then you must make
|
||||
a good faith effort to ensure that, in the event an application does not supply
|
||||
such function or table, the facility still operates, and performs whatever
|
||||
part of its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has a purpose
|
||||
that is entirely well-defined independent of the application. Therefore, Subsection
|
||||
2d requires that any application-supplied function or table used by this function
|
||||
must be optional: if the application does not supply it, the square root function
|
||||
must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable
|
||||
sections of that work are not derived from the Library, and can be reasonably
|
||||
considered independent and separate works in themselves, then this License,
|
||||
and its terms, do not apply to those sections when you distribute them as
|
||||
separate works. But when you distribute the same sections as part of a whole
|
||||
which is a work based on the Library, the distribution of the whole must be
|
||||
on the terms of this License, whose permissions for other licensees extend
|
||||
to the entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your
|
||||
rights to work written entirely by you; rather, the intent is to exercise
|
||||
the right to control the distribution of derivative or collective works based
|
||||
on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library with
|
||||
the Library (or with a work based on the Library) on a volume of a storage
|
||||
or distribution medium does not bring the other work under the scope of this
|
||||
License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public License
|
||||
instead of this License to a given copy of the Library. To do this, you must
|
||||
alter all the notices that refer to this License, so that they refer to the
|
||||
ordinary GNU General Public License, version 2, instead of to this License.
|
||||
(If a newer version than version 2 of the ordinary GNU General Public License
|
||||
has appeared, then you can specify that version instead if you wish.) Do not
|
||||
make any other change in these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for that copy,
|
||||
so the ordinary GNU General Public License applies to all subsequent copies
|
||||
and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of the Library
|
||||
into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or derivative of
|
||||
it, under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you accompany it with the complete corresponding
|
||||
machine-readable source code, which must be distributed under the terms of
|
||||
Sections 1 and 2 above on a medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy from a designated
|
||||
place, then offering equivalent access to copy the source code from the same
|
||||
place satisfies the requirement to distribute the source code, even though
|
||||
third parties are not compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the Library, but
|
||||
is designed to work with the Library by being compiled or linked with it,
|
||||
is called a "work that uses the Library". Such a work, in isolation, is not
|
||||
a derivative work of the Library, and therefore falls outside the scope of
|
||||
this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library creates an
|
||||
executable that is a derivative of the Library (because it contains portions
|
||||
of the Library), rather than a "work that uses the library". The executable
|
||||
is therefore covered by this License. Section 6 states terms for distribution
|
||||
of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file that
|
||||
is part of the Library, the object code for the work may be a derivative work
|
||||
of the Library even though the source code is not. Whether this is true is
|
||||
especially significant if the work can be linked without the Library, or if
|
||||
the work is itself a library. The threshold for this to be true is not precisely
|
||||
defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data structure layouts
|
||||
and accessors, and small macros and small inline functions (ten lines or less
|
||||
in length), then the use of the object file is unrestricted, regardless of
|
||||
whether it is legally a derivative work. (Executables containing this object
|
||||
code plus portions of the Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may distribute
|
||||
the object code for the work under the terms of Section 6. Any executables
|
||||
containing that work also fall under Section 6, whether or not they are linked
|
||||
directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also compile or link a "work
|
||||
that uses the Library" with the Library to produce a work containing portions
|
||||
of the Library, and distribute that work under terms of your choice, provided
|
||||
that the terms permit modification of the work for the customer's own use
|
||||
and reverse engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the Library
|
||||
is used in it and that the Library and its use are covered by this License.
|
||||
You must supply a copy of this License. If the work during execution displays
|
||||
copyright notices, you must include the copyright notice for the Library among
|
||||
them, as well as a reference directing the user to the copy of this License.
|
||||
Also, you must do one of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding machine-readable source
|
||||
code for the Library including whatever changes were used in the work (which
|
||||
must be distributed under Sections 1 and 2 above); and, if the work is an
|
||||
executable linked with the Library, with the complete machine-readable "work
|
||||
that uses the Library", as object code and/or source code, so that the user
|
||||
can modify the Library and then relink to produce a modified executable containing
|
||||
the modified Library. (It is understood that the user who changes the contents
|
||||
of definitions files in the Library will not necessarily be able to recompile
|
||||
the application to use the modified definitions.)
|
||||
|
||||
b) Accompany the work with a written offer, valid for at least three years,
|
||||
to give the same user the materials specified in Subsection 6a, above, for
|
||||
a charge no more than the cost of performing this distribution.
|
||||
|
||||
c) If distribution of the work is made by offering access to copy from a designated
|
||||
place, offer equivalent access to copy the above specified materials from
|
||||
the same place.
|
||||
|
||||
d) Verify that the user has already received a copy of these materials or
|
||||
that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the Library" must
|
||||
include any data and utility programs needed for reproducing the executable
|
||||
from it. However, as a special exception, the source code distributed need
|
||||
not include anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the operating
|
||||
system on which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license restrictions of
|
||||
other proprietary libraries that do not normally accompany the operating system.
|
||||
Such a contradiction means you cannot use both them and the Library together
|
||||
in an executable that you distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the Library side-by-side
|
||||
in a single library together with other library facilities not covered by
|
||||
this License, and distribute such a combined library, provided that the separate
|
||||
distribution of the work based on the Library and of the other library facilities
|
||||
is otherwise permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based on the
|
||||
Library, uncombined with any other library facilities. This must be distributed
|
||||
under the terms of the Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact that part of
|
||||
it is a work based on the Library, and explaining where to find the accompanying
|
||||
uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute the Library
|
||||
except as expressly provided under this License. Any attempt otherwise to
|
||||
copy, modify, sublicense, link with, or distribute the Library is void, and
|
||||
will automatically terminate your rights under this License. However, parties
|
||||
who have received copies, or rights, from you under this License will not
|
||||
have their licenses terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not signed
|
||||
it. However, nothing else grants you permission to modify or distribute the
|
||||
Library or its derivative works. These actions are prohibited by law if you
|
||||
do not accept this License. Therefore, by modifying or distributing the Library
|
||||
(or any work based on the Library), you indicate your acceptance of this License
|
||||
to do so, and all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the Library),
|
||||
the recipient automatically receives a license from the original licensor
|
||||
to copy, distribute, link with or modify the Library subject to these terms
|
||||
and conditions. You may not impose any further restrictions on the recipients'
|
||||
exercise of the rights granted herein. You are not responsible for enforcing
|
||||
compliance by third parties to this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent infringement
|
||||
or for any other reason (not limited to patent issues), conditions are imposed
|
||||
on you (whether by court order, agreement or otherwise) that contradict the
|
||||
conditions of this License, they do not excuse you from the conditions of
|
||||
this License. If you cannot distribute so as to satisfy simultaneously your
|
||||
obligations under this License and any other pertinent obligations, then as
|
||||
a consequence you may not distribute the Library at all. For example, if a
|
||||
patent license would not permit royalty-free redistribution of the Library
|
||||
by all those who receive copies directly or indirectly through you, then the
|
||||
only way you could satisfy both it and this License would be to refrain entirely
|
||||
from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents
|
||||
or other property right claims or to contest validity of any such claims;
|
||||
this section has the sole purpose of protecting the integrity of the free
|
||||
software distribution system which is implemented by public license practices.
|
||||
Many people have made generous contributions to the wide range of software
|
||||
distributed through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing to
|
||||
distribute software through any other system and a licensee cannot impose
|
||||
that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a
|
||||
consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in certain
|
||||
countries either by patents or by copyrighted interfaces, the original copyright
|
||||
holder who places the Library under this License may add an explicit geographical
|
||||
distribution limitation excluding those countries, so that distribution is
|
||||
permitted only in or among countries not thus excluded. In such case, this
|
||||
License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new versions of
|
||||
the Library General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to address
|
||||
new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library specifies
|
||||
a version number of this License which applies to it and "any later version",
|
||||
you have the option of following the terms and conditions either of that version
|
||||
or of any later version published by the Free Software Foundation. If the
|
||||
Library does not specify a license version number, you may choose any version
|
||||
ever published by the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free programs
|
||||
whose distribution conditions are incompatible with these, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free Software
|
||||
Foundation, write to the Free Software Foundation; we sometimes make exceptions
|
||||
for this. Our decision will be guided by the two goals of preserving the free
|
||||
status of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
|
||||
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
|
||||
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY
|
||||
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
|
||||
OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
|
||||
THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
|
||||
OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
|
||||
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
|
||||
OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
|
||||
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest possible
|
||||
use to the public, we recommend making it free software that everyone can
|
||||
redistribute and change. You can do so by permitting redistribution under
|
||||
these terms (or, alternatively, under the terms of the ordinary General Public
|
||||
License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is safest
|
||||
to attach them to the start of each source file to most effectively convey
|
||||
the exclusion of warranty; and each file should have at least the "copyright"
|
||||
line and a pointer to where the full notice is found.
|
||||
|
||||
one line to give the library's name and an idea of what it does.
|
||||
|
||||
Copyright (C) year name of author
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Library General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This library 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 Library General Public License for more
|
||||
details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school,
|
||||
if any, to sign a "copyright disclaimer" for the library, if necessary. Here
|
||||
is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in
|
||||
|
||||
the library `Frob' (a library for tweaking knobs) written
|
||||
|
||||
by James Random Hacker.
|
||||
|
||||
signature of Ty Coon, 1 April 1990
|
||||
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
@@ -1,467 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts as the
|
||||
successor of the GNU Library Public License, version 2, hence the version
|
||||
number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share
|
||||
and change it. By contrast, the GNU General Public Licenses are intended to
|
||||
guarantee your freedom to share and change free software--to make sure the
|
||||
software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some specially
|
||||
designated software packages--typically libraries--of the Free Software Foundation
|
||||
and other authors who decide to use it. You can use it too, but we suggest
|
||||
you first think carefully about whether this license or the ordinary General
|
||||
Public License is the better strategy to use in any particular case, based
|
||||
on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use, not price.
|
||||
Our General Public Licenses are designed to make sure that you have the freedom
|
||||
to distribute copies of free software (and charge for this service if you
|
||||
wish); that you receive source code or can get it if you want it; that you
|
||||
can change the software and use pieces of it in new free programs; and that
|
||||
you are informed that you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid distributors
|
||||
to deny you these rights or to ask you to surrender these rights. These restrictions
|
||||
translate to certain responsibilities for you if you distribute copies of
|
||||
the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis or for
|
||||
a fee, you must give the recipients all the rights that we gave you. You must
|
||||
make sure that they, too, receive or can get the source code. If you link
|
||||
other code with the library, you must provide complete object files to the
|
||||
recipients, so that they can relink them with the library after making changes
|
||||
to the library and recompiling it. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the library,
|
||||
and (2) we offer you this license, which gives you legal permission to copy,
|
||||
distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that there is no
|
||||
warranty for the free library. Also, if the library is modified by someone
|
||||
else and passed on, the recipients should know that what they have is not
|
||||
the original version, so that the original author's reputation will not be
|
||||
affected by problems that might be introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of any free
|
||||
program. We wish to make sure that a company cannot effectively restrict the
|
||||
users of a free program by obtaining a restrictive license from a patent holder.
|
||||
Therefore, we insist that any patent license obtained for a version of the
|
||||
library must be consistent with the full freedom of use specified in this
|
||||
license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary GNU
|
||||
General Public License. This license, the GNU Lesser General Public License,
|
||||
applies to certain designated libraries, and is quite different from the ordinary
|
||||
General Public License. We use this license for certain libraries in order
|
||||
to permit linking those libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using a shared
|
||||
library, the combination of the two is legally speaking a combined work, a
|
||||
derivative of the original library. The ordinary General Public License therefore
|
||||
permits such linking only if the entire combination fits its criteria of freedom.
|
||||
The Lesser General Public License permits more lax criteria for linking other
|
||||
code with the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it does Less
|
||||
to protect the user's freedom than the ordinary General Public License. It
|
||||
also provides other free software developers Less of an advantage over competing
|
||||
non-free programs. These disadvantages are the reason we use the ordinary
|
||||
General Public License for many libraries. However, the Lesser license provides
|
||||
advantages in certain special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to encourage the
|
||||
widest possible use of a certain library, so that it becomes a de-facto standard.
|
||||
To achieve this, non-free programs must be allowed to use the library. A more
|
||||
frequent case is that a free library does the same job as widely used non-free
|
||||
libraries. In this case, there is little to gain by limiting the free library
|
||||
to free software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free programs
|
||||
enables a greater number of people to use a large body of free software. For
|
||||
example, permission to use the GNU C Library in non-free programs enables
|
||||
many more people to use the whole GNU operating system, as well as its variant,
|
||||
the GNU/Linux operating system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the users'
|
||||
freedom, it does ensure that the user of a program that is linked with the
|
||||
Library has the freedom and the wherewithal to run that program using a modified
|
||||
version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification
|
||||
follow. Pay close attention to the difference between a "work based on the
|
||||
library" and a "work that uses the library". The former contains code derived
|
||||
from the library, whereas the latter must be combined with the library in
|
||||
order to run.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other program
|
||||
which contains a notice placed by the copyright holder or other authorized
|
||||
party saying it may be distributed under the terms of this Lesser General
|
||||
Public License (also called "this License"). Each licensee is addressed as
|
||||
"you".
|
||||
|
||||
A "library" means a collection of software functions and/or data prepared
|
||||
so as to be conveniently linked with application programs (which use some
|
||||
of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work which has
|
||||
been distributed under these terms. A "work based on the Library" means either
|
||||
the Library or any derivative work under copyright law: that is to say, a
|
||||
work containing the Library or a portion of it, either verbatim or with modifications
|
||||
and/or translated straightforwardly into another language. (Hereinafter, translation
|
||||
is included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for making modifications
|
||||
to it. For a library, complete source code means all the source code for all
|
||||
modules it contains, plus any associated interface definition files, plus
|
||||
the scripts used to control compilation and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not covered
|
||||
by this License; they are outside its scope. The act of running a program
|
||||
using the Library is not restricted, and output from such a program is covered
|
||||
only if its contents constitute a work based on the Library (independent of
|
||||
the use of the Library in a tool for writing it). Whether that is true depends
|
||||
on what the Library does and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's complete source
|
||||
code as you receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice and disclaimer
|
||||
of warranty; keep intact all the notices that refer to this License and to
|
||||
the absence of any warranty; and distribute a copy of this License along with
|
||||
the Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you
|
||||
may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion of it,
|
||||
thus forming a work based on the Library, and copy and distribute such modifications
|
||||
or work under the terms of Section 1 above, provided that you also meet all
|
||||
of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices stating that
|
||||
you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no charge to all
|
||||
third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a table of
|
||||
data to be supplied by an application program that uses the facility, other
|
||||
than as an argument passed when the facility is invoked, then you must make
|
||||
a good faith effort to ensure that, in the event an application does not supply
|
||||
such function or table, the facility still operates, and performs whatever
|
||||
part of its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has a purpose
|
||||
that is entirely well-defined independent of the application. Therefore, Subsection
|
||||
2d requires that any application-supplied function or table used by this function
|
||||
must be optional: if the application does not supply it, the square root function
|
||||
must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable
|
||||
sections of that work are not derived from the Library, and can be reasonably
|
||||
considered independent and separate works in themselves, then this License,
|
||||
and its terms, do not apply to those sections when you distribute them as
|
||||
separate works. But when you distribute the same sections as part of a whole
|
||||
which is a work based on the Library, the distribution of the whole must be
|
||||
on the terms of this License, whose permissions for other licensees extend
|
||||
to the entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your
|
||||
rights to work written entirely by you; rather, the intent is to exercise
|
||||
the right to control the distribution of derivative or collective works based
|
||||
on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library with
|
||||
the Library (or with a work based on the Library) on a volume of a storage
|
||||
or distribution medium does not bring the other work under the scope of this
|
||||
License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public License
|
||||
instead of this License to a given copy of the Library. To do this, you must
|
||||
alter all the notices that refer to this License, so that they refer to the
|
||||
ordinary GNU General Public License, version 2, instead of to this License.
|
||||
(If a newer version than version 2 of the ordinary GNU General Public License
|
||||
has appeared, then you can specify that version instead if you wish.) Do not
|
||||
make any other change in these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for that copy,
|
||||
so the ordinary GNU General Public License applies to all subsequent copies
|
||||
and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of the Library
|
||||
into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or derivative of
|
||||
it, under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you accompany it with the complete corresponding
|
||||
machine-readable source code, which must be distributed under the terms of
|
||||
Sections 1 and 2 above on a medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy from a designated
|
||||
place, then offering equivalent access to copy the source code from the same
|
||||
place satisfies the requirement to distribute the source code, even though
|
||||
third parties are not compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the Library, but
|
||||
is designed to work with the Library by being compiled or linked with it,
|
||||
is called a "work that uses the Library". Such a work, in isolation, is not
|
||||
a derivative work of the Library, and therefore falls outside the scope of
|
||||
this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library creates an
|
||||
executable that is a derivative of the Library (because it contains portions
|
||||
of the Library), rather than a "work that uses the library". The executable
|
||||
is therefore covered by this License. Section 6 states terms for distribution
|
||||
of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file that
|
||||
is part of the Library, the object code for the work may be a derivative work
|
||||
of the Library even though the source code is not. Whether this is true is
|
||||
especially significant if the work can be linked without the Library, or if
|
||||
the work is itself a library. The threshold for this to be true is not precisely
|
||||
defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data structure layouts
|
||||
and accessors, and small macros and small inline functions (ten lines or less
|
||||
in length), then the use of the object file is unrestricted, regardless of
|
||||
whether it is legally a derivative work. (Executables containing this object
|
||||
code plus portions of the Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may distribute
|
||||
the object code for the work under the terms of Section 6. Any executables
|
||||
containing that work also fall under Section 6, whether or not they are linked
|
||||
directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or link a "work
|
||||
that uses the Library" with the Library to produce a work containing portions
|
||||
of the Library, and distribute that work under terms of your choice, provided
|
||||
that the terms permit modification of the work for the customer's own use
|
||||
and reverse engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the Library
|
||||
is used in it and that the Library and its use are covered by this License.
|
||||
You must supply a copy of this License. If the work during execution displays
|
||||
copyright notices, you must include the copyright notice for the Library among
|
||||
them, as well as a reference directing the user to the copy of this License.
|
||||
Also, you must do one of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding machine-readable source
|
||||
code for the Library including whatever changes were used in the work (which
|
||||
must be distributed under Sections 1 and 2 above); and, if the work is an
|
||||
executable linked with the Library, with the complete machine-readable "work
|
||||
that uses the Library", as object code and/or source code, so that the user
|
||||
can modify the Library and then relink to produce a modified executable containing
|
||||
the modified Library. (It is understood that the user who changes the contents
|
||||
of definitions files in the Library will not necessarily be able to recompile
|
||||
the application to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the Library. A
|
||||
suitable mechanism is one that (1) uses at run time a copy of the library
|
||||
already present on the user's computer system, rather than copying library
|
||||
functions into the executable, and (2) will operate properly with a modified
|
||||
version of the library, if the user installs one, as long as the modified
|
||||
version is interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at least three years,
|
||||
to give the same user the materials specified in Subsection 6a, above, for
|
||||
a charge no more than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy from a designated
|
||||
place, offer equivalent access to copy the above specified materials from
|
||||
the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these materials or
|
||||
that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the Library" must
|
||||
include any data and utility programs needed for reproducing the executable
|
||||
from it. However, as a special exception, the materials to be distributed
|
||||
need not include anything that is normally distributed (in either source or
|
||||
binary form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component itself
|
||||
accompanies the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license restrictions of
|
||||
other proprietary libraries that do not normally accompany the operating system.
|
||||
Such a contradiction means you cannot use both them and the Library together
|
||||
in an executable that you distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the Library side-by-side
|
||||
in a single library together with other library facilities not covered by
|
||||
this License, and distribute such a combined library, provided that the separate
|
||||
distribution of the work based on the Library and of the other library facilities
|
||||
is otherwise permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based on the
|
||||
Library, uncombined with any other library facilities. This must be distributed
|
||||
under the terms of the Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact that part of
|
||||
it is a work based on the Library, and explaining where to find the accompanying
|
||||
uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute the Library
|
||||
except as expressly provided under this License. Any attempt otherwise to
|
||||
copy, modify, sublicense, link with, or distribute the Library is void, and
|
||||
will automatically terminate your rights under this License. However, parties
|
||||
who have received copies, or rights, from you under this License will not
|
||||
have their licenses terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not signed
|
||||
it. However, nothing else grants you permission to modify or distribute the
|
||||
Library or its derivative works. These actions are prohibited by law if you
|
||||
do not accept this License. Therefore, by modifying or distributing the Library
|
||||
(or any work based on the Library), you indicate your acceptance of this License
|
||||
to do so, and all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the Library),
|
||||
the recipient automatically receives a license from the original licensor
|
||||
to copy, distribute, link with or modify the Library subject to these terms
|
||||
and conditions. You may not impose any further restrictions on the recipients'
|
||||
exercise of the rights granted herein. You are not responsible for enforcing
|
||||
compliance by third parties with this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent infringement
|
||||
or for any other reason (not limited to patent issues), conditions are imposed
|
||||
on you (whether by court order, agreement or otherwise) that contradict the
|
||||
conditions of this License, they do not excuse you from the conditions of
|
||||
this License. If you cannot distribute so as to satisfy simultaneously your
|
||||
obligations under this License and any other pertinent obligations, then as
|
||||
a consequence you may not distribute the Library at all. For example, if a
|
||||
patent license would not permit royalty-free redistribution of the Library
|
||||
by all those who receive copies directly or indirectly through you, then the
|
||||
only way you could satisfy both it and this License would be to refrain entirely
|
||||
from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents
|
||||
or other property right claims or to contest validity of any such claims;
|
||||
this section has the sole purpose of protecting the integrity of the free
|
||||
software distribution system which is implemented by public license practices.
|
||||
Many people have made generous contributions to the wide range of software
|
||||
distributed through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing to
|
||||
distribute software through any other system and a licensee cannot impose
|
||||
that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a
|
||||
consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in certain
|
||||
countries either by patents or by copyrighted interfaces, the original copyright
|
||||
holder who places the Library under this License may add an explicit geographical
|
||||
distribution limitation excluding those countries, so that distribution is
|
||||
permitted only in or among countries not thus excluded. In such case, this
|
||||
License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new versions of
|
||||
the Lesser General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to address
|
||||
new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library specifies
|
||||
a version number of this License which applies to it and "any later version",
|
||||
you have the option of following the terms and conditions either of that version
|
||||
or of any later version published by the Free Software Foundation. If the
|
||||
Library does not specify a license version number, you may choose any version
|
||||
ever published by the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free programs
|
||||
whose distribution conditions are incompatible with these, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free Software
|
||||
Foundation, write to the Free Software Foundation; we sometimes make exceptions
|
||||
for this. Our decision will be guided by the two goals of preserving the free
|
||||
status of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
|
||||
THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
|
||||
STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY
|
||||
"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
|
||||
OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
|
||||
THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
|
||||
OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA
|
||||
OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES
|
||||
OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH
|
||||
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest possible
|
||||
use to the public, we recommend making it free software that everyone can
|
||||
redistribute and change. You can do so by permitting redistribution under
|
||||
these terms (or, alternatively, under the terms of the ordinary General Public
|
||||
License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is safest
|
||||
to attach them to the start of each source file to most effectively convey
|
||||
the exclusion of warranty; and each file should have at least the "copyright"
|
||||
line and a pointer to where the full notice is found.
|
||||
|
||||
< one line to give the library's name and an idea of what it does. >
|
||||
|
||||
Copyright (C) < year > < name of author >
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 2.1 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This library 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 Lesser General Public License for more
|
||||
details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this library; if not, write to the Free Software Foundation, Inc., 51
|
||||
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information
|
||||
on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school,
|
||||
if any, to sign a "copyright disclaimer" for the library, if necessary. Here
|
||||
is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in
|
||||
|
||||
the library `Frob' (a library for tweaking knobs) written
|
||||
|
||||
by James Random Hacker.
|
||||
|
||||
< signature of Ty Coon > , 1 April 1990
|
||||
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
@@ -1,175 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
one line to give the library's name and an idea of what it does.
|
||||
Copyright (C) year name of author
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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 Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in
|
||||
the library `Frob' (a library for tweaking knobs) written
|
||||
by James Random Hacker.
|
||||
|
||||
signature of Ty Coon, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
That's all there is to it!
|
||||
@@ -1,163 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates the terms
|
||||
and conditions of version 3 of the GNU General Public License, supplemented
|
||||
by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser General
|
||||
Public License, and the "GNU GPL" refers to version 3 of the GNU General Public
|
||||
License.
|
||||
|
||||
|
||||
|
||||
"The Library" refers to a covered work governed by this License, other than
|
||||
an Application or a Combined Work as defined below.
|
||||
|
||||
|
||||
|
||||
An "Application" is any work that makes use of an interface provided by the
|
||||
Library, but which is not otherwise based on the Library. Defining a subclass
|
||||
of a class defined by the Library is deemed a mode of using an interface provided
|
||||
by the Library.
|
||||
|
||||
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an Application
|
||||
with the Library. The particular version of the Library with which the Combined
|
||||
Work was made is also called the "Linked Version".
|
||||
|
||||
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the Corresponding
|
||||
Source for the Combined Work, excluding any source code for portions of the
|
||||
Combined Work that, considered in isolation, are based on the Application,
|
||||
and not on the Linked Version.
|
||||
|
||||
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the object
|
||||
code and/or source code for the Application, including any data and utility
|
||||
programs needed for reproducing the Combined Work from the Application, but
|
||||
excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License without
|
||||
being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a facility
|
||||
refers to a function or data to be supplied by an Application that uses the
|
||||
facility (other than as an argument passed when the facility is invoked),
|
||||
then you may convey a copy of the modified version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to ensure
|
||||
that, in the event an Application does not supply the function or data, the
|
||||
facility still operates, and performs whatever part of its purpose remains
|
||||
meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of this License
|
||||
applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from a header
|
||||
file that is part of the Library. You may convey such object code under terms
|
||||
of your choice, provided that, if the incorporated material is not limited
|
||||
to numerical parameters, data structure layouts and accessors, or small macros,
|
||||
inline functions and templates (ten or fewer lines in length), you do both
|
||||
of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the Library
|
||||
is used in it and that the Library and its use are covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that, taken together,
|
||||
effectively do not restrict modification of the portions of the Library contained
|
||||
in the Combined Work and reverse engineering for debugging such modifications,
|
||||
if you also do each of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that the Library
|
||||
is used in it and that the Library and its use are covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during execution, include
|
||||
the copyright notice for the Library among these notices, as well as a reference
|
||||
directing the user to the copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this License,
|
||||
and the Corresponding Application Code in a form suitable for, and under terms
|
||||
that permit, the user to recombine or relink the Application with a modified
|
||||
version of the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the Library. A
|
||||
suitable mechanism is one that (a) uses at run time a copy of the Library
|
||||
already present on the user's computer system, and (b) will operate properly
|
||||
with a modified version of the Library that is interface-compatible with the
|
||||
Linked Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise be required
|
||||
to provide such information under section 6 of the GNU GPL, and only to the
|
||||
extent that such information is necessary to install and execute a modified
|
||||
version of the Combined Work produced by recombining or relinking the Application
|
||||
with a modified version of the Linked Version. (If you use option 4d0, the
|
||||
Installation Information must accompany the Minimal Corresponding Source and
|
||||
Corresponding Application Code. If you use option 4d1, you must provide the
|
||||
Installation Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the Library side
|
||||
by side in a single library together with other library facilities that are
|
||||
not Applications and are not covered by this License, and convey such a combined
|
||||
library under terms of your choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based on the
|
||||
Library, uncombined with any other library facilities, conveyed under the
|
||||
terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it is a work
|
||||
based on the Library, and explaining where to find the accompanying uncombined
|
||||
form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of the
|
||||
GNU Lesser General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to address
|
||||
new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library as you
|
||||
received it specifies that a certain numbered version of the GNU Lesser General
|
||||
Public License "or any later version" applies to it, you have the option of
|
||||
following the terms and conditions either of that published version or of
|
||||
any later version published by the Free Software Foundation. If the Library
|
||||
as you received it does not specify a version number of the GNU Lesser General
|
||||
Public License, you may choose any version of the GNU Lesser General Public
|
||||
License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide whether
|
||||
future versions of the GNU Lesser General Public License shall apply, that
|
||||
proxy's public statement of acceptance of any version is permanent authorization
|
||||
for you to choose that version for the Library.
|
||||
@@ -1,12 +0,0 @@
|
||||
This library 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 3 of
|
||||
the license or (at your option) at any later version that is
|
||||
accepted by the membership of KDE e.V. (or its successor
|
||||
approved by the membership of KDE e.V.), which shall act as a
|
||||
proxy as defined in Section 14 of version 3 of the license.
|
||||
|
||||
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.
|
||||
@@ -1,12 +0,0 @@
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 3 of the license or (at your option) any later version
|
||||
that is accepted by the membership of KDE e.V. (or its successor
|
||||
approved by the membership of KDE e.V.), which shall act as a
|
||||
proxy as defined in Section 6 of version 3 of the license.
|
||||
|
||||
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.
|
||||
@@ -1,19 +0,0 @@
|
||||
MIT License Copyright (c) <year> <copyright holders>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next
|
||||
paragraph) shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
||||
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
||||
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -1,19 +0,0 @@
|
||||
/** @mainpage KWin
|
||||
|
||||
KWin is the KDE window manager.
|
||||
|
||||
@authors
|
||||
Matthias Ettrich \<ettrich@kde.org\><br>
|
||||
Lubos Lunak \<l.lunak@kde.org\>
|
||||
|
||||
@maintainers
|
||||
Lubos Lunak \<l.lunak@kde.org\>
|
||||
|
||||
@licenses
|
||||
@gpl
|
||||
|
||||
|
||||
*/
|
||||
|
||||
// DOXYGEN_SET_PROJECT_NAME = KWin
|
||||
// vim:ts=4:sw=4:expandtab:filetype=doxygen
|
||||
@@ -1,258 +0,0 @@
|
||||
add_definitions(-DKWIN_UNIT_TEST)
|
||||
remove_definitions(-DQT_USE_QSTRINGBUILDER)
|
||||
add_subdirectory(effect)
|
||||
add_subdirectory(integration)
|
||||
add_subdirectory(libinput)
|
||||
add_subdirectory(wayland)
|
||||
# drm autotests are broken on FreeBSD for yet unknown reasons
|
||||
# As the test isn't doing anything platform specific, only run it on Linux
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
add_subdirectory(drm)
|
||||
endif()
|
||||
|
||||
########################################################
|
||||
# Test WindowPaintData
|
||||
########################################################
|
||||
set(testWindowPaintData_SRCS test_window_paint_data.cpp)
|
||||
add_executable(testWindowPaintData ${testWindowPaintData_SRCS})
|
||||
target_link_libraries(testWindowPaintData kwin Qt::Widgets Qt::Test )
|
||||
add_test(NAME kwin-testWindowPaintData COMMAND testWindowPaintData)
|
||||
ecm_mark_as_test(testWindowPaintData)
|
||||
|
||||
########################################################
|
||||
# Test VirtualDesktopManager
|
||||
########################################################
|
||||
set(testVirtualDesktops_SRCS
|
||||
../src/virtualdesktops.cpp
|
||||
test_virtual_desktops.cpp
|
||||
)
|
||||
add_executable(testVirtualDesktops ${testVirtualDesktops_SRCS})
|
||||
|
||||
target_link_libraries(testVirtualDesktops
|
||||
kwin
|
||||
|
||||
Qt::Test
|
||||
Qt::Widgets
|
||||
|
||||
KF6::ConfigCore
|
||||
KF6::GlobalAccel
|
||||
KF6::I18n
|
||||
KF6::WindowSystem
|
||||
)
|
||||
add_test(NAME kwin-testVirtualDesktops COMMAND testVirtualDesktops)
|
||||
ecm_mark_as_test(testVirtualDesktops)
|
||||
|
||||
########################################################
|
||||
# Test ClientMachine
|
||||
########################################################
|
||||
if(KWIN_BUILD_X11)
|
||||
set(testClientMachine_SRCS
|
||||
../src/client_machine.cpp
|
||||
test_client_machine.cpp
|
||||
xcb_scaling_mock.cpp
|
||||
)
|
||||
add_executable(testClientMachine ${testClientMachine_SRCS})
|
||||
set_target_properties(testClientMachine PROPERTIES COMPILE_DEFINITIONS "NO_NONE_WINDOW")
|
||||
|
||||
target_link_libraries(testClientMachine
|
||||
Qt::Concurrent
|
||||
Qt::GuiPrivate
|
||||
Qt::Test
|
||||
Qt::Widgets
|
||||
|
||||
KF6::ConfigCore
|
||||
KF6::WindowSystem
|
||||
|
||||
XCB::XCB
|
||||
XCB::XFIXES
|
||||
|
||||
${X11_X11_LIB} # to make jenkins happy
|
||||
)
|
||||
add_test(NAME kwin-testClientMachine COMMAND testClientMachine)
|
||||
ecm_mark_as_test(testClientMachine)
|
||||
|
||||
########################################################
|
||||
# Test XcbWrapper
|
||||
########################################################
|
||||
add_executable(testXcbWrapper test_xcb_wrapper.cpp xcb_scaling_mock.cpp)
|
||||
|
||||
target_link_libraries(testXcbWrapper
|
||||
Qt::GuiPrivate
|
||||
Qt::Test
|
||||
Qt::Widgets
|
||||
|
||||
KF6::ConfigCore
|
||||
KF6::WindowSystem
|
||||
|
||||
XCB::XCB
|
||||
)
|
||||
add_test(NAME kwin-testXcbWrapper COMMAND testXcbWrapper)
|
||||
ecm_mark_as_test(testXcbWrapper)
|
||||
|
||||
add_executable(testXcbSizeHints test_xcb_size_hints.cpp xcb_scaling_mock.cpp)
|
||||
set_target_properties(testXcbSizeHints PROPERTIES COMPILE_DEFINITIONS "NO_NONE_WINDOW")
|
||||
target_link_libraries(testXcbSizeHints
|
||||
Qt::GuiPrivate
|
||||
Qt::Test
|
||||
Qt::Widgets
|
||||
|
||||
KF6::ConfigCore
|
||||
KF6::WindowSystem
|
||||
|
||||
XCB::ICCCM
|
||||
XCB::XCB
|
||||
)
|
||||
add_test(NAME kwin-testXcbSizeHints COMMAND testXcbSizeHints)
|
||||
ecm_mark_as_test(testXcbSizeHints)
|
||||
|
||||
########################################################
|
||||
# Test XcbWindow
|
||||
########################################################
|
||||
add_executable(testXcbWindow test_xcb_window.cpp xcb_scaling_mock.cpp)
|
||||
|
||||
target_link_libraries(testXcbWindow
|
||||
Qt::GuiPrivate
|
||||
Qt::Test
|
||||
Qt::Widgets
|
||||
|
||||
KF6::ConfigCore
|
||||
KF6::WindowSystem
|
||||
|
||||
XCB::XCB
|
||||
)
|
||||
add_test(NAME kwin-testXcbWindow COMMAND testXcbWindow)
|
||||
ecm_mark_as_test(testXcbWindow)
|
||||
|
||||
########################################################
|
||||
# Test X11 TimestampUpdate
|
||||
########################################################
|
||||
add_executable(testX11TimestampUpdate test_x11_timestamp_update.cpp)
|
||||
target_link_libraries(testX11TimestampUpdate
|
||||
KF6::CoreAddons
|
||||
Qt::Test
|
||||
Qt::GuiPrivate
|
||||
kwin
|
||||
)
|
||||
add_test(NAME kwin-testX11TimestampUpdate COMMAND testX11TimestampUpdate)
|
||||
ecm_mark_as_test(testX11TimestampUpdate)
|
||||
endif()
|
||||
|
||||
########################################################
|
||||
# Test OnScreenNotification
|
||||
########################################################
|
||||
set(testOnScreenNotification_SRCS
|
||||
../src/input_event_spy.cpp
|
||||
../src/onscreennotification.cpp
|
||||
onscreennotificationtest.cpp
|
||||
)
|
||||
add_executable(testOnScreenNotification ${testOnScreenNotification_SRCS})
|
||||
|
||||
target_link_libraries(testOnScreenNotification
|
||||
Qt::DBus
|
||||
Qt::Quick
|
||||
Qt::Test
|
||||
Qt::Widgets # QAction include
|
||||
|
||||
KF6::ConfigCore
|
||||
)
|
||||
|
||||
add_test(NAME kwin-testOnScreenNotification COMMAND testOnScreenNotification)
|
||||
ecm_mark_as_test(testOnScreenNotification)
|
||||
|
||||
########################################################
|
||||
# Test Gestures
|
||||
########################################################
|
||||
set(testGestures_SRCS
|
||||
../src/gestures.cpp
|
||||
test_gestures.cpp
|
||||
)
|
||||
add_executable(testGestures ${testGestures_SRCS})
|
||||
|
||||
target_link_libraries(testGestures
|
||||
Qt::Test
|
||||
Qt::Widgets
|
||||
)
|
||||
|
||||
add_test(NAME kwin-testGestures COMMAND testGestures)
|
||||
ecm_mark_as_test(testGestures)
|
||||
|
||||
set(testOpenGLContextAttributeBuilder_SRCS
|
||||
../src/opengl/abstract_opengl_context_attribute_builder.cpp
|
||||
../src/opengl/egl_context_attribute_builder.cpp
|
||||
opengl_context_attribute_builder_test.cpp
|
||||
)
|
||||
|
||||
if (HAVE_GLX)
|
||||
set(testOpenGLContextAttributeBuilder_SRCS ${testOpenGLContextAttributeBuilder_SRCS} ../src/backends/x11/standalone/x11_standalone_glx_context_attribute_builder.cpp)
|
||||
endif()
|
||||
add_executable(testOpenGLContextAttributeBuilder ${testOpenGLContextAttributeBuilder_SRCS})
|
||||
target_link_libraries(testOpenGLContextAttributeBuilder epoxy::epoxy Qt::Test)
|
||||
add_test(NAME kwin-testOpenGLContextAttributeBuilder COMMAND testOpenGLContextAttributeBuilder)
|
||||
ecm_mark_as_test(testOpenGLContextAttributeBuilder)
|
||||
|
||||
set(testXkb_SRCS
|
||||
../src/xkb.cpp
|
||||
test_xkb.cpp
|
||||
)
|
||||
qt_add_dbus_interface(testXkb_SRCS ${CMAKE_SOURCE_DIR}/src/org.freedesktop.DBus.Properties.xml dbusproperties_interface)
|
||||
add_executable(testXkb ${testXkb_SRCS})
|
||||
target_link_libraries(testXkb
|
||||
kwin
|
||||
|
||||
Qt::Gui
|
||||
Qt::GuiPrivate
|
||||
Qt::Test
|
||||
Qt::Widgets
|
||||
|
||||
KF6::ConfigCore
|
||||
KF6::WindowSystem
|
||||
|
||||
XKB::XKB
|
||||
)
|
||||
add_test(NAME kwin-testXkb COMMAND testXkb)
|
||||
ecm_mark_as_test(testXkb)
|
||||
|
||||
########################################################
|
||||
# Test FTrace
|
||||
########################################################
|
||||
add_executable(testFtrace test_ftrace.cpp)
|
||||
target_link_libraries(testFtrace
|
||||
Qt::Test
|
||||
kwin
|
||||
)
|
||||
add_test(NAME kwin-testFtrace COMMAND testFtrace)
|
||||
ecm_mark_as_test(testFtrace)
|
||||
|
||||
########################################################
|
||||
# Test KWin Utils
|
||||
########################################################
|
||||
add_executable(testUtils test_utils.cpp)
|
||||
target_link_libraries(testUtils
|
||||
Qt::Test
|
||||
kwin
|
||||
)
|
||||
add_test(NAME kwin-testUtils COMMAND testUtils)
|
||||
ecm_mark_as_test(testUtils)
|
||||
|
||||
########################################################
|
||||
# Test OutputTransform
|
||||
########################################################
|
||||
add_executable(testOutputTransform output_transform_test.cpp)
|
||||
target_link_libraries(testOutputTransform
|
||||
Qt::Test
|
||||
kwin
|
||||
)
|
||||
add_test(NAME kwin-testOutputTransform COMMAND testOutputTransform)
|
||||
ecm_mark_as_test(testOutputTransform)
|
||||
|
||||
########################################################
|
||||
# Test Colorspace
|
||||
########################################################
|
||||
add_executable(testColorspaces test_colorspaces.cpp)
|
||||
target_link_libraries(testColorspaces
|
||||
Qt::Test
|
||||
kwin
|
||||
lcms2::lcms2
|
||||
)
|
||||
add_test(NAME kwin-testColorspaces COMMAND testColorspaces)
|
||||
ecm_mark_as_test(testColorspaces)
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,59 +0,0 @@
|
||||
set(mockDRM_SRCS
|
||||
mock_drm.cpp
|
||||
../../src/backends/drm/drm_abstract_output.cpp
|
||||
../../src/backends/drm/drm_backend.cpp
|
||||
../../src/backends/drm/drm_blob.cpp
|
||||
../../src/backends/drm/drm_buffer.cpp
|
||||
../../src/backends/drm/drm_colorop.cpp
|
||||
../../src/backends/drm/drm_commit.cpp
|
||||
../../src/backends/drm/drm_commit_thread.cpp
|
||||
../../src/backends/drm/drm_connector.cpp
|
||||
../../src/backends/drm/drm_crtc.cpp
|
||||
../../src/backends/drm/drm_egl_backend.cpp
|
||||
../../src/backends/drm/drm_egl_layer.cpp
|
||||
../../src/backends/drm/drm_egl_layer_surface.cpp
|
||||
../../src/backends/drm/drm_gpu.cpp
|
||||
../../src/backends/drm/drm_layer.cpp
|
||||
../../src/backends/drm/drm_logging.cpp
|
||||
../../src/backends/drm/drm_object.cpp
|
||||
../../src/backends/drm/drm_output.cpp
|
||||
../../src/backends/drm/drm_pipeline.cpp
|
||||
../../src/backends/drm/drm_pipeline_legacy.cpp
|
||||
../../src/backends/drm/drm_plane.cpp
|
||||
../../src/backends/drm/drm_property.cpp
|
||||
../../src/backends/drm/drm_qpainter_backend.cpp
|
||||
../../src/backends/drm/drm_qpainter_layer.cpp
|
||||
../../src/backends/drm/drm_virtual_egl_layer.cpp
|
||||
../../src/backends/drm/drm_virtual_output.cpp
|
||||
)
|
||||
|
||||
include_directories(${Libdrm_INCLUDE_DIRS})
|
||||
|
||||
add_library(LibDrmTest STATIC ${mockDRM_SRCS})
|
||||
target_link_libraries(LibDrmTest
|
||||
Qt::Gui
|
||||
Qt::Widgets
|
||||
KF6::ConfigCore
|
||||
KF6::WindowSystem
|
||||
KF6::CoreAddons
|
||||
KF6::I18n
|
||||
PkgConfig::Libxcvt
|
||||
gbm::gbm
|
||||
Libdrm::Libdrm
|
||||
kwin
|
||||
)
|
||||
target_include_directories(LibDrmTest
|
||||
PUBLIC
|
||||
../../src
|
||||
../../src/platformsupport/scenes/opengl
|
||||
../../src/platformsupport/scenes/qpainter
|
||||
../../src/backends/drm/
|
||||
)
|
||||
|
||||
########################################################
|
||||
# Tests
|
||||
########################################################
|
||||
add_executable(testDrm drmTest.cpp)
|
||||
target_link_libraries(testDrm LibDrmTest Qt::Test)
|
||||
add_test(NAME kwin-testDrm COMMAND testDrm)
|
||||
ecm_mark_as_test(testDrm)
|
||||
@@ -1,427 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2022 Xaver Hugl <xaver.hugl@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include <QSignalSpy>
|
||||
#include <QSize>
|
||||
#include <QTest>
|
||||
|
||||
#include "mock_drm.h"
|
||||
|
||||
#include "core/outputlayer.h"
|
||||
#include "core/session.h"
|
||||
#include "drm_backend.h"
|
||||
#include "drm_connector.h"
|
||||
#include "drm_crtc.h"
|
||||
#include "drm_egl_backend.h"
|
||||
#include "drm_gpu.h"
|
||||
#include "drm_output.h"
|
||||
#include "drm_pipeline.h"
|
||||
#include "drm_plane.h"
|
||||
#include "drm_pointer.h"
|
||||
#include "platformsupport/scenes/qpainter/qpainterbackend.h"
|
||||
|
||||
#include <drm_fourcc.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/utsname.h>
|
||||
|
||||
using namespace KWin;
|
||||
|
||||
static std::unique_ptr<MockGpu> findPrimaryDevice(int crtcCount)
|
||||
{
|
||||
const int deviceCount = drmGetDevices2(0, nullptr, 0);
|
||||
if (deviceCount <= 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QList<drmDevice *> devices(deviceCount);
|
||||
if (drmGetDevices2(0, devices.data(), devices.size()) < 0) {
|
||||
return nullptr;
|
||||
}
|
||||
auto deviceCleanup = qScopeGuard([&devices]() {
|
||||
drmFreeDevices(devices.data(), devices.size());
|
||||
});
|
||||
|
||||
for (drmDevice *device : std::as_const(devices)) {
|
||||
if (device->available_nodes & (1 << DRM_NODE_PRIMARY)) {
|
||||
int fd = open(device->nodes[DRM_NODE_PRIMARY], O_RDWR | O_CLOEXEC);
|
||||
if (fd != -1) {
|
||||
return std::make_unique<MockGpu>(fd, device->nodes[DRM_NODE_PRIMARY], crtcCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
class DrmTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void testAmsDetection();
|
||||
void testOutputDetection();
|
||||
void testZeroModesHandling();
|
||||
void testModeGeneration_data();
|
||||
void testModeGeneration();
|
||||
void testConnectorLifetime();
|
||||
void testModeset_data();
|
||||
void testModeset();
|
||||
void testVrrChange();
|
||||
};
|
||||
|
||||
static void verifyCleanup(MockGpu *mockGpu)
|
||||
{
|
||||
QVERIFY(mockGpu->drmConnectors.isEmpty());
|
||||
QVERIFY(mockGpu->drmEncoders.isEmpty());
|
||||
QVERIFY(mockGpu->drmCrtcs.isEmpty());
|
||||
QVERIFY(mockGpu->drmPlanes.isEmpty());
|
||||
QVERIFY(mockGpu->drmPlaneRes.isEmpty());
|
||||
QVERIFY(mockGpu->fbs.isEmpty());
|
||||
QVERIFY(mockGpu->drmProps.isEmpty());
|
||||
QVERIFY(mockGpu->drmObjectProperties.isEmpty());
|
||||
QVERIFY(mockGpu->drmPropertyBlobs.isEmpty());
|
||||
}
|
||||
|
||||
void DrmTest::testAmsDetection()
|
||||
{
|
||||
const auto session = Session::create(Session::Type::Noop);
|
||||
const auto backend = std::make_unique<DrmBackend>(session.get());
|
||||
|
||||
// gpu without planes should use legacy mode
|
||||
{
|
||||
const auto mockGpu = findPrimaryDevice(0);
|
||||
auto gpu = std::make_unique<DrmGpu>(backend.get(), mockGpu->fd, DrmDevice::open(mockGpu->devNode));
|
||||
QVERIFY(!gpu->atomicModeSetting());
|
||||
}
|
||||
|
||||
// gpu with planes should use AMS
|
||||
{
|
||||
const auto mockGpu = findPrimaryDevice(0);
|
||||
mockGpu->planes << std::make_shared<MockPlane>(mockGpu.get(), PlaneType::Primary, 0);
|
||||
auto gpu = std::make_unique<DrmGpu>(backend.get(), mockGpu->fd, DrmDevice::open(mockGpu->devNode));
|
||||
gpu = std::make_unique<DrmGpu>(backend.get(), mockGpu->fd, DrmDevice::open(mockGpu->devNode));
|
||||
QVERIFY(gpu->atomicModeSetting());
|
||||
}
|
||||
|
||||
// but not if the kernel doesn't allow it
|
||||
{
|
||||
const auto mockGpu = findPrimaryDevice(0);
|
||||
mockGpu->deviceCaps[MOCKDRM_DEVICE_CAP_ATOMIC] = 0;
|
||||
auto gpu = std::make_unique<DrmGpu>(backend.get(), mockGpu->fd, DrmDevice::open(mockGpu->devNode));
|
||||
QVERIFY(!gpu->atomicModeSetting());
|
||||
gpu.reset();
|
||||
verifyCleanup(mockGpu.get());
|
||||
}
|
||||
}
|
||||
|
||||
void DrmTest::testOutputDetection()
|
||||
{
|
||||
const auto mockGpu = findPrimaryDevice(5);
|
||||
|
||||
const auto one = std::make_shared<MockConnector>(mockGpu.get());
|
||||
const auto two = std::make_shared<MockConnector>(mockGpu.get());
|
||||
const auto vr = std::make_shared<MockConnector>(mockGpu.get(), true);
|
||||
mockGpu->connectors.push_back(one);
|
||||
mockGpu->connectors.push_back(two);
|
||||
mockGpu->connectors.push_back(vr);
|
||||
|
||||
const auto session = Session::create(Session::Type::Noop);
|
||||
const auto backend = std::make_unique<DrmBackend>(session.get());
|
||||
const auto renderBackend = backend->createQPainterBackend();
|
||||
auto gpu = std::make_unique<DrmGpu>(backend.get(), mockGpu->fd, DrmDevice::open(mockGpu->devNode));
|
||||
QVERIFY(gpu->updateOutputs());
|
||||
|
||||
// 3 outputs should be detected, one of them non-desktop
|
||||
const auto outputs = gpu->drmOutputs();
|
||||
QCOMPARE(outputs.size(), 3);
|
||||
const auto vrOutput = std::find_if(outputs.begin(), outputs.end(), [](const auto &output) {
|
||||
return output->isNonDesktop();
|
||||
});
|
||||
QVERIFY(vrOutput != outputs.end());
|
||||
QVERIFY(static_cast<DrmOutput *>(*vrOutput)->connector()->id() == vr->id);
|
||||
|
||||
// test hotunplugging
|
||||
mockGpu->connectors.removeOne(one);
|
||||
QVERIFY(gpu->updateOutputs());
|
||||
QCOMPARE(gpu->drmOutputs().size(), 2);
|
||||
|
||||
// test hotplugging
|
||||
mockGpu->connectors.push_back(one);
|
||||
QVERIFY(gpu->updateOutputs());
|
||||
QCOMPARE(gpu->drmOutputs().size(), 3);
|
||||
|
||||
// connector state changing to disconnected should count as a hotunplug
|
||||
one->connection = DRM_MODE_DISCONNECTED;
|
||||
QVERIFY(gpu->updateOutputs());
|
||||
QCOMPARE(gpu->drmOutputs().size(), 2);
|
||||
|
||||
// don't crash if all connectors are disconnected
|
||||
two->connection = DRM_MODE_DISCONNECTED;
|
||||
vr->connection = DRM_MODE_DISCONNECTED;
|
||||
QVERIFY(gpu->updateOutputs());
|
||||
QVERIFY(gpu->drmOutputs().empty());
|
||||
|
||||
gpu.reset();
|
||||
verifyCleanup(mockGpu.get());
|
||||
}
|
||||
|
||||
void DrmTest::testZeroModesHandling()
|
||||
{
|
||||
const auto mockGpu = findPrimaryDevice(5);
|
||||
|
||||
const auto conn = std::make_shared<MockConnector>(mockGpu.get());
|
||||
mockGpu->connectors.push_back(conn);
|
||||
|
||||
const auto session = Session::create(Session::Type::Noop);
|
||||
const auto backend = std::make_unique<DrmBackend>(session.get());
|
||||
const auto renderBackend = backend->createQPainterBackend();
|
||||
auto gpu = std::make_unique<DrmGpu>(backend.get(), mockGpu->fd, DrmDevice::open(mockGpu->devNode));
|
||||
|
||||
// connector with zero modes should be ignored
|
||||
conn->modes.clear();
|
||||
QVERIFY(gpu->updateOutputs());
|
||||
QVERIFY(gpu->drmOutputs().empty());
|
||||
|
||||
// once it has modes, it should be detected
|
||||
conn->addMode(1920, 1080, 60);
|
||||
QVERIFY(gpu->updateOutputs());
|
||||
QCOMPARE(gpu->drmOutputs().size(), 1);
|
||||
|
||||
// if an update says it has no modes anymore but it's still connected, ignore that
|
||||
conn->modes.clear();
|
||||
QVERIFY(gpu->updateOutputs());
|
||||
QCOMPARE(gpu->drmOutputs().size(), 1);
|
||||
QVERIFY(!gpu->drmOutputs().constFirst()->modes().empty());
|
||||
|
||||
gpu.reset();
|
||||
verifyCleanup(mockGpu.get());
|
||||
}
|
||||
|
||||
void DrmTest::testModeGeneration_data()
|
||||
{
|
||||
QTest::addColumn<QSize>("nativeMode");
|
||||
QTest::addColumn<QList<QSize>>("expectedModes");
|
||||
|
||||
QTest::newRow("2160p") << QSize(3840, 2160) << QList<QSize>{
|
||||
QSize(1600, 1200),
|
||||
QSize(1280, 1024),
|
||||
QSize(1024, 768),
|
||||
QSize(2560, 1600),
|
||||
QSize(1920, 1200),
|
||||
QSize(1280, 800),
|
||||
QSize(3840, 2160),
|
||||
QSize(3200, 1800),
|
||||
QSize(2880, 1620),
|
||||
QSize(2560, 1440),
|
||||
QSize(1920, 1080),
|
||||
QSize(1600, 900),
|
||||
QSize(1368, 768),
|
||||
QSize(1280, 720),
|
||||
};
|
||||
QTest::newRow("1440p") << QSize(2560, 1440) << QList<QSize>{
|
||||
QSize(1600, 1200),
|
||||
QSize(1280, 1024),
|
||||
QSize(1024, 768),
|
||||
QSize(1920, 1200),
|
||||
QSize(1280, 800),
|
||||
QSize(2560, 1440),
|
||||
QSize(1920, 1080),
|
||||
QSize(1600, 900),
|
||||
QSize(1368, 768),
|
||||
QSize(1280, 720),
|
||||
};
|
||||
QTest::newRow("1080p") << QSize(1920, 1080) << QList<QSize>{
|
||||
QSize(1280, 1024),
|
||||
QSize(1024, 768),
|
||||
QSize(1280, 800),
|
||||
QSize(1920, 1080),
|
||||
QSize(1600, 900),
|
||||
QSize(1368, 768),
|
||||
QSize(1280, 720),
|
||||
};
|
||||
|
||||
QTest::newRow("2160p 21:9") << QSize(5120, 2160) << QList<QSize>{
|
||||
QSize(5120, 2160),
|
||||
QSize(1600, 1200),
|
||||
QSize(1280, 1024),
|
||||
QSize(1024, 768),
|
||||
QSize(2560, 1600),
|
||||
QSize(1920, 1200),
|
||||
QSize(1280, 800),
|
||||
QSize(3840, 2160),
|
||||
QSize(3200, 1800),
|
||||
QSize(2880, 1620),
|
||||
QSize(2560, 1440),
|
||||
QSize(1920, 1080),
|
||||
QSize(1600, 900),
|
||||
QSize(1368, 768),
|
||||
QSize(1280, 720),
|
||||
};
|
||||
QTest::newRow("1440p 21:9") << QSize(3440, 1440) << QList<QSize>{
|
||||
QSize(3440, 1440),
|
||||
QSize(1600, 1200),
|
||||
QSize(1280, 1024),
|
||||
QSize(1024, 768),
|
||||
QSize(1920, 1200),
|
||||
QSize(1280, 800),
|
||||
QSize(2560, 1440),
|
||||
QSize(1920, 1080),
|
||||
QSize(1600, 900),
|
||||
QSize(1368, 768),
|
||||
QSize(1280, 720),
|
||||
};
|
||||
QTest::newRow("1080p 21:9") << QSize(2560, 1080) << QList<QSize>{
|
||||
QSize(2560, 1080),
|
||||
QSize(1280, 1024),
|
||||
QSize(1024, 768),
|
||||
QSize(1280, 800),
|
||||
QSize(1920, 1080),
|
||||
QSize(1600, 900),
|
||||
QSize(1368, 768),
|
||||
QSize(1280, 720),
|
||||
};
|
||||
}
|
||||
|
||||
void DrmTest::testModeGeneration()
|
||||
{
|
||||
const auto mockGpu = findPrimaryDevice(5);
|
||||
|
||||
const auto conn = std::make_shared<MockConnector>(mockGpu.get());
|
||||
mockGpu->connectors.push_back(conn);
|
||||
|
||||
const auto session = Session::create(Session::Type::Noop);
|
||||
const auto backend = std::make_unique<DrmBackend>(session.get());
|
||||
const auto renderBackend = backend->createQPainterBackend();
|
||||
auto gpu = std::make_unique<DrmGpu>(backend.get(), mockGpu->fd, DrmDevice::open(mockGpu->devNode));
|
||||
|
||||
QFETCH(QSize, nativeMode);
|
||||
QFETCH(QList<QSize>, expectedModes);
|
||||
|
||||
conn->modes.clear();
|
||||
conn->addMode(nativeMode.width(), nativeMode.height(), 60);
|
||||
QVERIFY(gpu->updateOutputs());
|
||||
QCOMPARE(gpu->drmOutputs().size(), 1);
|
||||
// no mode generation without the scaling property
|
||||
QCOMPARE(gpu->drmOutputs().front()->modes().size(), 1);
|
||||
|
||||
mockGpu->connectors.removeAll(conn);
|
||||
QVERIFY(gpu->updateOutputs());
|
||||
|
||||
conn->props.emplace_back(conn.get(), QStringLiteral("scaling mode"), 0, DRM_MODE_PROP_ENUM, QList<QByteArray>{"None", "Full", "Center", "Full aspect"});
|
||||
mockGpu->connectors.push_back(conn);
|
||||
QVERIFY(gpu->updateOutputs());
|
||||
|
||||
DrmOutput *const output = gpu->drmOutputs().front();
|
||||
QCOMPARE(output->modes().size(), expectedModes.size());
|
||||
for (const auto &mode : output->modes()) {
|
||||
QVERIFY(expectedModes.contains(mode->size()));
|
||||
QVERIFY(mode->size().width() <= nativeMode.width());
|
||||
QVERIFY(mode->size().height() <= nativeMode.height());
|
||||
QVERIFY(mode->refreshRate() <= 60000);
|
||||
}
|
||||
|
||||
gpu.reset();
|
||||
verifyCleanup(mockGpu.get());
|
||||
}
|
||||
|
||||
void DrmTest::testConnectorLifetime()
|
||||
{
|
||||
// don't crash if output lifetime is extended beyond the connector
|
||||
const auto mockGpu = findPrimaryDevice(5);
|
||||
|
||||
const auto conn = std::make_shared<MockConnector>(mockGpu.get());
|
||||
mockGpu->connectors.push_back(conn);
|
||||
|
||||
const auto session = Session::create(Session::Type::Noop);
|
||||
const auto backend = std::make_unique<DrmBackend>(session.get());
|
||||
const auto renderBackend = backend->createQPainterBackend();
|
||||
auto gpu = std::make_unique<DrmGpu>(backend.get(), mockGpu->fd, DrmDevice::open(mockGpu->devNode));
|
||||
|
||||
QVERIFY(gpu->updateOutputs());
|
||||
QCOMPARE(gpu->drmOutputs().size(), 1);
|
||||
|
||||
DrmOutput *const output = gpu->drmOutputs().front();
|
||||
|
||||
output->ref();
|
||||
mockGpu->connectors.clear();
|
||||
QVERIFY(gpu->updateOutputs());
|
||||
output->unref();
|
||||
|
||||
gpu.reset();
|
||||
verifyCleanup(mockGpu.get());
|
||||
}
|
||||
|
||||
void DrmTest::testModeset_data()
|
||||
{
|
||||
QTest::addColumn<int>("AMS");
|
||||
// TODO to uncomment this, implement page flip callbacks
|
||||
// QTest::newRow("disabled") << 0;
|
||||
QTest::newRow("enabled") << 1;
|
||||
}
|
||||
|
||||
void DrmTest::testModeset()
|
||||
{
|
||||
// to reenable, make this part of an integration test, so that kwinApp() isn't nullptr
|
||||
QSKIP("this test needs output pipelines to be enabled by default, which is no longer the case");
|
||||
// test if doing a modeset would succeed
|
||||
QFETCH(int, AMS);
|
||||
const auto mockGpu = findPrimaryDevice(5);
|
||||
mockGpu->deviceCaps[MOCKDRM_DEVICE_CAP_ATOMIC] = AMS;
|
||||
|
||||
const auto conn = std::make_shared<MockConnector>(mockGpu.get());
|
||||
mockGpu->connectors.push_back(conn);
|
||||
|
||||
const auto session = Session::create(Session::Type::Noop);
|
||||
const auto backend = std::make_unique<DrmBackend>(session.get());
|
||||
const auto renderBackend = backend->createQPainterBackend();
|
||||
auto gpu = std::make_unique<DrmGpu>(backend.get(), mockGpu->fd, DrmDevice::open(mockGpu->devNode));
|
||||
|
||||
QVERIFY(gpu->updateOutputs());
|
||||
QCOMPARE(gpu->drmOutputs().size(), 1);
|
||||
const auto output = gpu->drmOutputs().front();
|
||||
const auto layer = renderBackend->primaryLayer(output);
|
||||
layer->beginFrame();
|
||||
output->renderLoop()->prepareNewFrame();
|
||||
output->renderLoop()->beginPaint();
|
||||
const auto frame = std::make_shared<OutputFrame>(output->renderLoop(), std::chrono::nanoseconds(1'000'000'000'000 / output->refreshRate()));
|
||||
layer->endFrame(infiniteRegion(), infiniteRegion(), frame.get());
|
||||
QVERIFY(output->present(frame));
|
||||
|
||||
gpu.reset();
|
||||
verifyCleanup(mockGpu.get());
|
||||
}
|
||||
|
||||
void DrmTest::testVrrChange()
|
||||
{
|
||||
const auto mockGpu = findPrimaryDevice(5);
|
||||
mockGpu->deviceCaps[MOCKDRM_DEVICE_CAP_ATOMIC] = 1;
|
||||
|
||||
const auto conn = std::make_shared<MockConnector>(mockGpu.get());
|
||||
conn->setVrrCapable(false);
|
||||
mockGpu->connectors.push_back(conn);
|
||||
|
||||
const auto session = Session::create(Session::Type::Noop);
|
||||
const auto backend = std::make_unique<DrmBackend>(session.get());
|
||||
const auto renderBackend = backend->createQPainterBackend();
|
||||
auto gpu = std::make_unique<DrmGpu>(backend.get(), mockGpu->fd, DrmDevice::open(mockGpu->devNode));
|
||||
|
||||
QVERIFY(gpu->updateOutputs());
|
||||
const auto output = gpu->drmOutputs().front();
|
||||
QVERIFY(!(output->capabilities() & Output::Capability::Vrr));
|
||||
|
||||
QSignalSpy capsChanged(output, &Output::capabilitiesChanged);
|
||||
|
||||
conn->setVrrCapable(true);
|
||||
QVERIFY(gpu->updateOutputs());
|
||||
QCOMPARE(gpu->drmOutputs().front(), output);
|
||||
QCOMPARE(capsChanged.count(), 1);
|
||||
QVERIFY(output->capabilities() & Output::Capability::Vrr);
|
||||
}
|
||||
|
||||
QTEST_GUILESS_MAIN(DrmTest)
|
||||
#include "drmTest.moc"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,195 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2022 Xaver Hugl <xaver.hugl@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <xf86drm.h>
|
||||
#include <xf86drmMode.h>
|
||||
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QRect>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
class MockGpu;
|
||||
class MockFb;
|
||||
class MockCrtc;
|
||||
class MockEncoder;
|
||||
class MockObject;
|
||||
class MockPlane;
|
||||
|
||||
class MockProperty {
|
||||
public:
|
||||
MockProperty(MockObject *obj, QString name, uint64_t initialValue, uint32_t flags, QList<QByteArray> enums = {});
|
||||
~MockProperty() = default;
|
||||
|
||||
MockObject *obj;
|
||||
uint32_t id;
|
||||
uint32_t flags;
|
||||
QString name;
|
||||
uint64_t value;
|
||||
QList<QByteArray> enums;
|
||||
};
|
||||
|
||||
class MockPropertyBlob {
|
||||
public:
|
||||
MockPropertyBlob(MockGpu *gpu, const void *data, size_t size);
|
||||
~MockPropertyBlob();
|
||||
|
||||
MockGpu *gpu;
|
||||
uint32_t id;
|
||||
void *data;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
class MockObject {
|
||||
public:
|
||||
MockObject(MockGpu *gpu);
|
||||
virtual ~MockObject();
|
||||
|
||||
uint64_t getProp(const QString &propName) const;
|
||||
void setProp(const QString &propName, uint64_t value);
|
||||
|
||||
uint32_t getPropId(const QString &propName) const;
|
||||
|
||||
uint32_t id;
|
||||
QList<MockProperty> props;
|
||||
MockGpu *gpu;
|
||||
};
|
||||
|
||||
class MockConnector : public MockObject {
|
||||
public:
|
||||
MockConnector(MockGpu *gpu, bool nonDesktop = false);
|
||||
MockConnector(const MockConnector &obj) = default;
|
||||
~MockConnector() = default;
|
||||
|
||||
void addMode(uint32_t width, uint32_t height, float refreshRate, bool preferred = false);
|
||||
void setVrrCapable(bool cap);
|
||||
|
||||
drmModeConnection connection;
|
||||
uint32_t type;
|
||||
std::shared_ptr<MockEncoder> encoder;
|
||||
QList<drmModeModeInfo> modes;
|
||||
};
|
||||
|
||||
class MockEncoder : public MockObject {
|
||||
public:
|
||||
MockEncoder(MockGpu *gpu, uint32_t possible_crtcs);
|
||||
MockEncoder(const MockEncoder &obj) = default;
|
||||
~MockEncoder() = default;
|
||||
|
||||
MockCrtc *crtc = nullptr;
|
||||
uint32_t possible_crtcs;
|
||||
uint32_t possible_clones = 0;
|
||||
};
|
||||
|
||||
class MockCrtc : public MockObject {
|
||||
public:
|
||||
MockCrtc(MockGpu *gpu, const std::shared_ptr<MockPlane> &legacyPlane, int pipeIndex, int gamma_size = 255);
|
||||
MockCrtc(const MockCrtc &obj) = default;
|
||||
~MockCrtc() = default;
|
||||
|
||||
int pipeIndex;
|
||||
int gamma_size;
|
||||
drmModeModeInfo mode;
|
||||
bool modeValid = true;
|
||||
MockFb *currentFb = nullptr;
|
||||
MockFb *nextFb = nullptr;
|
||||
QRect cursorRect;
|
||||
std::shared_ptr<MockPlane> legacyPlane;
|
||||
};
|
||||
|
||||
enum class PlaneType {
|
||||
Primary = 0,
|
||||
Overlay,
|
||||
Cursor
|
||||
};
|
||||
|
||||
class MockPlane : public MockObject {
|
||||
public:
|
||||
MockPlane(MockGpu *gpu, PlaneType type, int crtcIndex);
|
||||
MockPlane(const MockPlane &obj) = default;
|
||||
~MockPlane() = default;
|
||||
|
||||
MockFb *currentFb = nullptr;
|
||||
MockFb *nextFb = nullptr;
|
||||
int possibleCrtcs;
|
||||
PlaneType type;
|
||||
};
|
||||
|
||||
class MockFb {
|
||||
public:
|
||||
MockFb(MockGpu *gpu, uint32_t width, uint32_t height);
|
||||
~MockFb();
|
||||
|
||||
uint32_t id;
|
||||
uint32_t width, height;
|
||||
MockGpu *gpu;
|
||||
};
|
||||
|
||||
struct Prop {
|
||||
uint32_t obj;
|
||||
uint32_t prop;
|
||||
uint64_t value;
|
||||
};
|
||||
|
||||
struct _drmModeAtomicReq {
|
||||
bool legacyEmulation = false;
|
||||
QList<Prop> props;
|
||||
};
|
||||
|
||||
#define MOCKDRM_DEVICE_CAP_ATOMIC 0xFF
|
||||
|
||||
class MockGpu {
|
||||
public:
|
||||
MockGpu(int fd, const QString &devNode, int numCrtcs, int gammaSize = 255);
|
||||
~MockGpu();
|
||||
|
||||
MockConnector *findConnector(uint32_t id) const;
|
||||
MockCrtc *findCrtc(uint32_t id) const;
|
||||
MockPlane *findPlane(uint32_t id) const;
|
||||
MockPropertyBlob *getBlob(uint32_t id) const;
|
||||
|
||||
void flipPage(uint32_t crtcId);
|
||||
|
||||
int fd;
|
||||
QString devNode;
|
||||
QByteArray name = QByteArrayLiteral("mock");
|
||||
QMap<uint32_t, uint64_t> clientCaps;
|
||||
QMap<uint32_t, uint64_t> deviceCaps;
|
||||
|
||||
uint32_t idCounter = 1;
|
||||
QList<MockObject *> objects;
|
||||
|
||||
QList<std::shared_ptr<MockConnector>> connectors;
|
||||
QList<drmModeConnectorPtr> drmConnectors;
|
||||
|
||||
QList<std::shared_ptr<MockEncoder>> encoders;
|
||||
QList<drmModeEncoderPtr> drmEncoders;
|
||||
|
||||
QList<std::shared_ptr<MockCrtc>> crtcs;
|
||||
QList<drmModeCrtcPtr> drmCrtcs;
|
||||
|
||||
QList<std::shared_ptr<MockPlane>> planes;
|
||||
QList<drmModePlanePtr> drmPlanes;
|
||||
|
||||
QList<MockFb *> fbs;
|
||||
std::vector<std::unique_ptr<MockPropertyBlob>> propertyBlobs;
|
||||
|
||||
QList<drmModeResPtr> resPtrs;
|
||||
QList<drmModePropertyPtr> drmProps;
|
||||
QList<drmModePropertyBlobPtr> drmPropertyBlobs;
|
||||
QList<drmModeObjectPropertiesPtr> drmObjectProperties;
|
||||
QList<drmModePlaneResPtr> drmPlaneRes;
|
||||
std::mutex m_mutex;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
include(ECMMarkAsTest)
|
||||
|
||||
macro(KWINEFFECTS_UNIT_TESTS)
|
||||
foreach(_testname ${ARGN})
|
||||
add_executable(${_testname} ${_testname}.cpp)
|
||||
add_test(NAME kwineffects-${_testname} COMMAND ${_testname})
|
||||
target_link_libraries(${_testname} Qt::Test kwin)
|
||||
ecm_mark_as_test(${_testname})
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
kwineffects_unit_tests(
|
||||
windowquadlisttest
|
||||
timelinetest
|
||||
)
|
||||
|
||||
add_executable(kwinglplatformtest kwinglplatformtest.cpp ../../src/opengl/glplatform.cpp ../../src/utils/version.cpp)
|
||||
add_test(NAME kwineffects-kwinglplatformtest COMMAND kwinglplatformtest)
|
||||
target_link_libraries(kwinglplatformtest Qt::Test Qt::Gui KF6::ConfigCore)
|
||||
ecm_mark_as_test(kwinglplatformtest)
|
||||
@@ -1,17 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=Broadcom VideoCore 3D
|
||||
Renderer=V3D 4.2
|
||||
Version=2.1 Mesa 19.1
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=false
|
||||
TextureNPOT=false
|
||||
Mesa=true
|
||||
V3D=true
|
||||
GLVersion=2,1
|
||||
MesaVersion=19,1
|
||||
DriverVersion=19,1
|
||||
Driver=21
|
||||
ChipClass=7000
|
||||
Compositor=4
|
||||
@@ -1,17 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=Broadcom VideoCore IV
|
||||
Renderer=VC4 V3D 2.1
|
||||
Version=2.1 Mesa 19.1
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=false
|
||||
TextureNPOT=false
|
||||
Mesa=true
|
||||
VC4=true
|
||||
GLVersion=2,1
|
||||
MesaVersion=19,1
|
||||
DriverVersion=19,1
|
||||
Driver=20
|
||||
ChipClass=6000
|
||||
Compositor=4
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=ATI Technologies Inc.
|
||||
Renderer=AMD Radeon HD 7700M Series
|
||||
Version=3.1.13399 Compatibility Profile Context FireGL 15.201.1151
|
||||
ShadingLanguageVersion=4.40
|
||||
|
||||
[Settings]
|
||||
LooseBinding=false
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Catalyst=true
|
||||
Radeon=true
|
||||
GLVersion=3,1,13399
|
||||
GLSLVersion=4,40
|
||||
DriverVersion=15,201,1151
|
||||
Driver=9
|
||||
ChipClass=999
|
||||
Compositor=1
|
||||
@@ -1,21 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=X.Org
|
||||
Renderer=Gallium 0.4 on AMD BONAIRE (DRM 2.43.0, LLVM 3.8.0)
|
||||
Version=3.0 Mesa 11.2.2
|
||||
ShadingLanguageVersion=1.30
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Gallium=true
|
||||
Radeon=true
|
||||
GLVersion=3,0
|
||||
GLSLVersion=1,30
|
||||
MesaVersion=11,2,2
|
||||
GalliumVersion=0,4
|
||||
DriverVersion=11,2,2
|
||||
Driver=16
|
||||
ChipClass=10
|
||||
Compositor=1
|
||||
@@ -1,22 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=X.Org
|
||||
Renderer=Gallium 0.4 on AMD CAYMAN (DRM 2.43.0, LLVM 3.8.0)
|
||||
Version=OpenGL ES 3.0 Mesa 11.2.2
|
||||
ShadingLanguageVersion=OpenGL ES GLSL ES 3.00
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Gallium=true
|
||||
Radeon=true
|
||||
GLVersion=3,0
|
||||
GLSLVersion=3,0
|
||||
GLES=true
|
||||
MesaVersion=11,2,2
|
||||
GalliumVersion=0,4
|
||||
DriverVersion=11,2,2
|
||||
Driver=5
|
||||
ChipClass=8
|
||||
Compositor=1
|
||||
@@ -1,21 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=X.Org
|
||||
Renderer=Gallium 0.4 on AMD HAWAII (DRM 2.43.0, LLVM 3.7.1)
|
||||
Version=3.0 Mesa 11.1.2
|
||||
ShadingLanguageVersion=1.30
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Gallium=true
|
||||
Radeon=true
|
||||
GLVersion=3,0
|
||||
GLSLVersion=1,30
|
||||
MesaVersion=11,1,2
|
||||
GalliumVersion=0,4
|
||||
DriverVersion=11,1,2
|
||||
Driver=16
|
||||
ChipClass=10
|
||||
Compositor=1
|
||||
@@ -1,21 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=X.Org
|
||||
Renderer=AMD NAVI10 (DRM 3.36.0, 5.5.1-arch1-1, LLVM 9.0.1)
|
||||
Version=4.5 (Core Profile) Mesa 19.3.3
|
||||
ShadingLanguageVersion=4.50
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Gallium=true
|
||||
Radeon=true
|
||||
GLVersion=4,5
|
||||
GLSLVersion=4,50
|
||||
MesaVersion=19,3,3
|
||||
GalliumVersion=0,4
|
||||
DriverVersion=19,3,3
|
||||
Driver=16
|
||||
ChipClass=14
|
||||
Compositor=1
|
||||
@@ -1,21 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=X.Org
|
||||
Renderer=AMD Radeon R9 200 Series (HAWAII DRM 3.26.0 4.18.9-92.current LLVM 6.0.1)
|
||||
Version=4.5 Mesa 18.1.6
|
||||
ShadingLanguageVersion=4.50
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Gallium=true
|
||||
Radeon=true
|
||||
GLVersion=4,5
|
||||
GLSLVersion=4,50
|
||||
MesaVersion=18,1,6
|
||||
GalliumVersion=0,4
|
||||
DriverVersion=18,1,6
|
||||
Driver=16
|
||||
ChipClass=10
|
||||
Compositor=1
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=X.Org
|
||||
Renderer=AMD Radeon (TM) RX 480 Graphics (POLARIS10 / DRM 3.23.0 / 4.15.0-rc1-g516fb7f2e73d, LLVM 6.0.0)
|
||||
Version=4.5 (Core Profile) Mesa 17.4.0-devel (git-b6b4b2c6d8)
|
||||
ShadingLanguageVersion=4.50
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Gallium=true
|
||||
Radeon=true
|
||||
GLVersion=4,5
|
||||
GLSLVersion=4,50
|
||||
MesaVersion=17,4,0
|
||||
GalliumVersion=0,4
|
||||
DriverVersion=17,4,0
|
||||
Driver=16
|
||||
ChipClass=12
|
||||
Compositor=1
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=X.Org
|
||||
Renderer=Radeon RX 550 Series (POLARIS12, DRM 3.25.0, 4.17.0-rc6-GTW1+, LLVM 6.0.0)
|
||||
Version=3.1 Mesa 18.1.0
|
||||
ShadingLanguageVersion=1.40
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Gallium=true
|
||||
Radeon=true
|
||||
GLVersion=3,1
|
||||
GLSLVersion=1,40
|
||||
MesaVersion=18,1,0
|
||||
GalliumVersion=0,4
|
||||
DriverVersion=18,1,0
|
||||
Driver=16
|
||||
ChipClass=12
|
||||
Compositor=1
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=AMD
|
||||
Renderer=AMD Radeon RX 5700 XT (NAVI10, DRM 3.40.0, 5.10.9-arch1-1, LLVM 11.0.1)
|
||||
Version=4.6 (Compatibility Profile) Mesa 20.3.3
|
||||
ShadingLanguageVersion=4.60
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Gallium=true
|
||||
Radeon=true
|
||||
GLVersion=4,6
|
||||
GLSLVersion=4,60
|
||||
MesaVersion=20,3,3
|
||||
GalliumVersion=0,4
|
||||
DriverVersion=20,3,3
|
||||
Driver=16
|
||||
ChipClass=14
|
||||
Compositor=1
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=X.Org
|
||||
Renderer=Radeon RX 580 Series (POLARIS10, DRM 3.27.0, 4.19.10-arch1-1-ARCH, LLVM 7.0.0)
|
||||
Version=4.5 (Compatibility Profile) Mesa 18.3.1
|
||||
ShadingLanguageVersion=4.50
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Gallium=true
|
||||
Radeon=true
|
||||
GLVersion=4,5
|
||||
GLSLVersion=4,50
|
||||
MesaVersion=18,3,1
|
||||
GalliumVersion=0,4
|
||||
DriverVersion=18,3,1
|
||||
Driver=16
|
||||
ChipClass=12
|
||||
Compositor=1
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=X.Org
|
||||
Renderer=Radeon RX Vega (VEGA10, DRM 3.25.0, 4.17.0-trunk-amd64, LLVM 6.0.0)
|
||||
Version=4.5 (Core Profile) Mesa 18.1.2
|
||||
ShadingLanguageVersion=4.50
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Gallium=true
|
||||
Radeon=true
|
||||
GLVersion=4,5
|
||||
GLSLVersion=4,50
|
||||
MesaVersion=18,1,2
|
||||
GalliumVersion=0,4
|
||||
DriverVersion=18,1,2
|
||||
Driver=16
|
||||
ChipClass=13
|
||||
Compositor=1
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=X.Org
|
||||
Renderer=Radeon RX Vega (VEGA10 / DRM 3.23.0 / 4.16.16-300.fc28.x86_64, LLVM 6.0.0)
|
||||
Version=4.5 (Core Profile) Mesa 18.0.5
|
||||
ShadingLanguageVersion=4.50
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Gallium=true
|
||||
Radeon=true
|
||||
GLVersion=4,5
|
||||
GLSLVersion=4,50
|
||||
MesaVersion=18,0,5
|
||||
GalliumVersion=0,4
|
||||
DriverVersion=18,0,5
|
||||
Driver=16
|
||||
ChipClass=13
|
||||
Compositor=1
|
||||
@@ -1,21 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=X.Org
|
||||
Renderer=Gallium 0.4 on AMD REDWOOD (DRM 2.43.0 / 4.6.4-1-ARCH, LLVM 3.8.0)
|
||||
Version=3.0 Mesa 12.0.1
|
||||
ShadingLanguageVersion=1.30
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Gallium=true
|
||||
Radeon=true
|
||||
GLVersion=3,0
|
||||
GLSLVersion=1,30
|
||||
MesaVersion=12,0,1
|
||||
GalliumVersion=0,4
|
||||
DriverVersion=12,0,1
|
||||
Driver=5
|
||||
ChipClass=7
|
||||
Compositor=1
|
||||
@@ -1,21 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=X.Org
|
||||
Renderer=Gallium 0.4 on AMD TONGA (DRM 3.2.0 / 4.7.0-0-MANJARO, LLVM 3.8.0)
|
||||
Version=4.1 (Core Profile) Mesa 12.0.1
|
||||
ShadingLanguageVersion=4.10
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Gallium=true
|
||||
Radeon=true
|
||||
GLVersion=4,1
|
||||
GLSLVersion=4,10
|
||||
MesaVersion=12,0,1
|
||||
GalliumVersion=0,4
|
||||
DriverVersion=12,0,1
|
||||
Driver=16
|
||||
ChipClass=11
|
||||
Compositor=1
|
||||
@@ -1,19 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=Intel Open Source Technology Center
|
||||
Renderer=Mesa DRI Intel(R) HD Graphics 5500 (Broadwell GT2)
|
||||
Version=3.3 (Core Profile) Mesa 11.2.2
|
||||
ShadingLanguageVersion=3.30
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Intel=true
|
||||
GLVersion=3,3
|
||||
GLSLVersion=3,30
|
||||
MesaVersion=11,2,2
|
||||
DriverVersion=11,2,2
|
||||
Driver=7
|
||||
ChipClass=2999
|
||||
Compositor=1
|
||||
@@ -1,19 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=Intel Open Source Technology Center
|
||||
Renderer=Mesa DRI Intel(R) Haswell Mobile
|
||||
Version=3.3 (Core Profile) Mesa 11.2.2
|
||||
ShadingLanguageVersion=3.30
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Intel=true
|
||||
GLVersion=3,3
|
||||
GLSLVersion=3,30
|
||||
MesaVersion=11,2,2
|
||||
DriverVersion=11,2,2
|
||||
Driver=7
|
||||
ChipClass=2005
|
||||
Compositor=1
|
||||
@@ -1,20 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=Intel Open Source Technology Center
|
||||
Renderer=Mesa DRI Intel(R) Ivybridge Desktop
|
||||
Version=3.0 Mesa 11.1.0 (git-525f3c2)
|
||||
ShadingLanguageVersion=1.30
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Intel=true
|
||||
GLVersion=3,0
|
||||
GLSLVersion=1,30
|
||||
MesaVersion=11,1,0
|
||||
DriverVersion=11,1,0
|
||||
Driver=7
|
||||
ChipClass=2004
|
||||
Compositor=1
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=Intel Open Source Technology Center
|
||||
Renderer=Mesa DRI Intel(R) Ivybridge Desktop
|
||||
Version=3.3 (Core Profile) Mesa 11.2.2
|
||||
ShadingLanguageVersion=3.30
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Intel=true
|
||||
GLVersion=3,3
|
||||
GLSLVersion=3,30
|
||||
MesaVersion=11,2,2
|
||||
DriverVersion=11,2,2
|
||||
Driver=7
|
||||
ChipClass=2004
|
||||
Compositor=1
|
||||
@@ -1,19 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=Intel Open Source Technology Center
|
||||
Renderer=Mesa DRI Intel(R) Ivybridge Mobile
|
||||
Version=3.3 (Core Profile) Mesa 12.0.1
|
||||
ShadingLanguageVersion=3.30
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Intel=true
|
||||
GLVersion=3,3
|
||||
GLSLVersion=3,30
|
||||
MesaVersion=12,0,1
|
||||
DriverVersion=12,0,1
|
||||
Driver=7
|
||||
ChipClass=2004
|
||||
Compositor=1
|
||||
@@ -1,19 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=Intel
|
||||
Renderer=Mesa Intel(R) UHD Graphics 620 (KBL GT2)
|
||||
Version=4.6 (Compatibility Profile) Mesa 20.3.2
|
||||
ShadingLanguageVersion=4.60
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Intel=true
|
||||
GLVersion=4,6
|
||||
GLSLVersion=4,60
|
||||
MesaVersion=20,3,2
|
||||
DriverVersion=20,3,2
|
||||
Driver=7
|
||||
ChipClass=2012
|
||||
Compositor=1
|
||||
@@ -1,19 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=Intel Open Source Technology Center
|
||||
Renderer=Mesa DRI Intel(R) Sandybridge Mobile
|
||||
Version=3.3 (Core Profile) Mesa 12.0.1
|
||||
ShadingLanguageVersion=3.30
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Intel=true
|
||||
GLVersion=3,3
|
||||
GLSLVersion=3,30
|
||||
MesaVersion=12,0,1
|
||||
DriverVersion=12,0,1
|
||||
Driver=7
|
||||
ChipClass=2003
|
||||
Compositor=1
|
||||
@@ -1,19 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=Intel Open Source Technology Center
|
||||
Renderer=Mesa DRI Intel(R) HD Graphics 520 (Skylake GT2)
|
||||
Version=3.0 Mesa 11.2.0
|
||||
ShadingLanguageVersion=1.30
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Intel=true
|
||||
GLVersion=3,0
|
||||
GLSLVersion=1,30
|
||||
MesaVersion=11,2,0
|
||||
DriverVersion=11,2,0
|
||||
Driver=7
|
||||
ChipClass=2999
|
||||
Compositor=1
|
||||
@@ -1,19 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=Mali (Lima)
|
||||
Renderer=Mali 400 (Lima)
|
||||
Version=3.0 Mesa 19.1
|
||||
ShadingLanguageVersion=1.30
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Lima=true
|
||||
GLVersion=3,0
|
||||
GLSLVersion=1,30
|
||||
MesaVersion=19,1
|
||||
DriverVersion=19,1
|
||||
Driver=19
|
||||
ChipClass=5000
|
||||
Compositor=1
|
||||
@@ -1,22 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=Mesa/X.org
|
||||
Renderer=llvmpipe (LLVM 10.0.1, 256 bits)
|
||||
Version=3.1 Mesa 20.2.1
|
||||
ShadingLanguageVersion=1.40
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Gallium=true
|
||||
SoftwareEmulation=true
|
||||
GLVersion=3,1
|
||||
GLSLVersion=1,40
|
||||
MesaVersion=20,2,1
|
||||
GalliumVersion=0,4
|
||||
DriverVersion=20,2,1
|
||||
Driver=12
|
||||
ChipClass=99999
|
||||
Compositor=1
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=VMware, Inc.
|
||||
Renderer=Gallium 0.4 on llvmpipe (LLVM 3.8, 256 bits)
|
||||
Version=3.0 Mesa 11.2.0
|
||||
ShadingLanguageVersion=1.30
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Gallium=true
|
||||
SoftwareEmulation=true
|
||||
GLVersion=3,0
|
||||
GLSLVersion=1,30
|
||||
MesaVersion=11,2,0
|
||||
GalliumVersion=0,4
|
||||
DriverVersion=11,2,0
|
||||
Driver=12
|
||||
ChipClass=99999
|
||||
Compositor=1
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=VMware, Inc.
|
||||
Renderer=llvmpipe (LLVM 5.0, 256 bits)
|
||||
Version=3.0 Mesa 17.2.6
|
||||
ShadingLanguageVersion=1.30
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Gallium=true
|
||||
SoftwareEmulation=true
|
||||
GLVersion=3,0
|
||||
GLSLVersion=1,30
|
||||
MesaVersion=17,2,6
|
||||
GalliumVersion=0,4
|
||||
DriverVersion=17,2,6
|
||||
Driver=12
|
||||
ChipClass=99999
|
||||
Compositor=1
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=NVIDIA Corporation
|
||||
Renderer=GeForce GTX 560/PCIe/SSE2
|
||||
Version=4.5.0 NVIDIA 361.28
|
||||
ShadingLanguageVersion=4.50 NVIDIA
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Nvidia=true
|
||||
PreferBufferSubData=true
|
||||
GLVersion=4,5
|
||||
GLSLVersion=4,50
|
||||
DriverVersion=361,28
|
||||
Driver=8
|
||||
ChipClass=1005
|
||||
Compositor=1
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=NVIDIA Corporation
|
||||
Renderer=GeForce GTX 660/PCIe/SSE2
|
||||
Version=3.1.0 NVIDIA 367.27
|
||||
ShadingLanguageVersion=1.40 NVIDIA via Cg compiler
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Nvidia=true
|
||||
PreferBufferSubData=true
|
||||
GLVersion=3,1
|
||||
GLSLVersion=1,40
|
||||
DriverVersion=367,27
|
||||
Driver=8
|
||||
ChipClass=1999
|
||||
Compositor=1
|
||||
@@ -1,18 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=NVIDIA Corporation
|
||||
Renderer=GeForce GTX 950/PCIe/SSE2
|
||||
Version=4.5.0 NVIDIA 364.19
|
||||
ShadingLanguageVersion=4.50 NVIDIA
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Nvidia=true
|
||||
PreferBufferSubData=true
|
||||
GLVersion=4,5
|
||||
GLSLVersion=4,50
|
||||
DriverVersion=364,19
|
||||
Driver=8
|
||||
ChipClass=1999
|
||||
Compositor=1
|
||||
@@ -1,18 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=NVIDIA Corporation
|
||||
Renderer=GeForce GTX 970/PCIe/SSE2
|
||||
Version=3.1.0 NVIDIA 367.35
|
||||
ShadingLanguageVersion=1.40 NVIDIA via Cg compiler
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Nvidia=true
|
||||
PreferBufferSubData=true
|
||||
GLVersion=3,1
|
||||
GLSLVersion=1,40
|
||||
DriverVersion=367,35
|
||||
Driver=8
|
||||
ChipClass=1999
|
||||
Compositor=1
|
||||
@@ -1,18 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=NVIDIA Corporation
|
||||
Renderer=GeForce GTX 970M/PCIe/SSE2
|
||||
Version=3.1.0 NVIDIA 364.12
|
||||
ShadingLanguageVersion=1.40 NVIDIA via Cg compiler
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Nvidia=true
|
||||
PreferBufferSubData=true
|
||||
GLVersion=3,1
|
||||
GLSLVersion=1,40
|
||||
DriverVersion=364,12
|
||||
Driver=8
|
||||
ChipClass=1999
|
||||
Compositor=1
|
||||
@@ -1,18 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=NVIDIA Corporation
|
||||
Renderer=GeForce GTX 980/PCIe/SSE2
|
||||
Version=3.1.0 NVIDIA 364.19
|
||||
ShadingLanguageVersion=1.40 NVIDIA via Cg compiler
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Nvidia=true
|
||||
PreferBufferSubData=true
|
||||
GLVersion=3,1
|
||||
GLSLVersion=1,40
|
||||
DriverVersion=364,19
|
||||
Driver=8
|
||||
ChipClass=1999
|
||||
Compositor=1
|
||||
@@ -1,19 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=Panfrost
|
||||
Renderer=Mali T860 (Panfrost)
|
||||
Version=3.0 Mesa 19.1
|
||||
ShadingLanguageVersion=1.30
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Panfrost=true
|
||||
GLVersion=3,0
|
||||
GLSLVersion=1,30
|
||||
MesaVersion=19,1
|
||||
DriverVersion=19,1
|
||||
Driver=18
|
||||
ChipClass=4001
|
||||
Compositor=1
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=Qualcomm
|
||||
Renderer=Adreno (TM) 330
|
||||
Version=OpenGL ES 2.0 (OpenGL ES 3.0 V@104.0 AU@ (GIT@Id3510ff6dc))
|
||||
ShadingLanguageVersion=OpenGL ES GLSL ES 3.00
|
||||
|
||||
[Settings]
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
GLVersion=2,0
|
||||
GLSLVersion=3,0
|
||||
GLES=true
|
||||
Adreno=true
|
||||
Driver=15
|
||||
ChipClass=3002
|
||||
Compositor=1
|
||||
@@ -1,22 +0,0 @@
|
||||
[Driver]
|
||||
Vendor=Red Hat
|
||||
Renderer=virgl
|
||||
Version=3.1 Mesa 19.0.8
|
||||
ShadingLanguageVersion=1.40
|
||||
|
||||
[Settings]
|
||||
LooseBinding=true
|
||||
GLSL=true
|
||||
TextureNPOT=true
|
||||
Mesa=true
|
||||
Gallium=true
|
||||
Virgl=true
|
||||
VirtualMachine=true
|
||||
GLVersion=3,1
|
||||
GLSLVersion=1,40
|
||||
MesaVersion=19,0,8
|
||||
GalliumVersion=0,4
|
||||
DriverVersion=19,0,8
|
||||
Driver=17
|
||||
ChipClass=99999
|
||||
Compositor=1
|
||||
@@ -1,215 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "opengl/glplatform.h"
|
||||
#include <QTest>
|
||||
|
||||
#include <KConfig>
|
||||
#include <KConfigGroup>
|
||||
|
||||
Q_DECLARE_METATYPE(KWin::Driver)
|
||||
Q_DECLARE_METATYPE(KWin::ChipClass)
|
||||
|
||||
using namespace KWin;
|
||||
|
||||
class GLPlatformTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void testDriverToString_data();
|
||||
void testDriverToString();
|
||||
void testChipClassToString_data();
|
||||
void testChipClassToString();
|
||||
void testDetect_data();
|
||||
void testDetect();
|
||||
};
|
||||
|
||||
void GLPlatformTest::testDriverToString_data()
|
||||
{
|
||||
QTest::addColumn<Driver>("driver");
|
||||
QTest::addColumn<QString>("expected");
|
||||
|
||||
QTest::newRow("R100") << Driver_R100 << QStringLiteral("Radeon");
|
||||
QTest::newRow("R200") << Driver_R200 << QStringLiteral("R200");
|
||||
QTest::newRow("R300C") << Driver_R300C << QStringLiteral("R300C");
|
||||
QTest::newRow("R300G") << Driver_R300G << QStringLiteral("R300G");
|
||||
QTest::newRow("R600C") << Driver_R600C << QStringLiteral("R600C");
|
||||
QTest::newRow("R600G") << Driver_R600G << QStringLiteral("R600G");
|
||||
QTest::newRow("RadeonSI") << Driver_RadeonSI << QStringLiteral("RadeonSI");
|
||||
QTest::newRow("Nouveau") << Driver_Nouveau << QStringLiteral("Nouveau");
|
||||
QTest::newRow("Intel") << Driver_Intel << QStringLiteral("Intel");
|
||||
QTest::newRow("NVidia") << Driver_NVidia << QStringLiteral("NVIDIA");
|
||||
QTest::newRow("Catalyst") << Driver_Catalyst << QStringLiteral("Catalyst");
|
||||
QTest::newRow("Swrast") << Driver_Swrast << QStringLiteral("Software rasterizer");
|
||||
QTest::newRow("Softpipe") << Driver_Softpipe << QStringLiteral("softpipe");
|
||||
QTest::newRow("Llvmpipe") << Driver_Llvmpipe << QStringLiteral("LLVMpipe");
|
||||
QTest::newRow("VirtualBox") << Driver_VirtualBox << QStringLiteral("VirtualBox (Chromium)");
|
||||
QTest::newRow("VMware") << Driver_VMware << QStringLiteral("VMware (SVGA3D)");
|
||||
QTest::newRow("Qualcomm") << Driver_Qualcomm << QStringLiteral("Qualcomm");
|
||||
QTest::newRow("Virgl") << Driver_Virgl << QStringLiteral("Virgl (virtio-gpu, Qemu/KVM guest)");
|
||||
QTest::newRow("Panfrost") << Driver_Panfrost << QStringLiteral("Panfrost");
|
||||
QTest::newRow("Lima") << Driver_Lima << QStringLiteral("Mali (Lima)");
|
||||
QTest::newRow("VC4") << Driver_VC4 << QStringLiteral("VideoCore IV");
|
||||
QTest::newRow("V3D") << Driver_V3D << QStringLiteral("VideoCore 3D");
|
||||
QTest::newRow("Unknown") << Driver_Unknown << QStringLiteral("Unknown");
|
||||
}
|
||||
|
||||
void GLPlatformTest::testDriverToString()
|
||||
{
|
||||
QFETCH(Driver, driver);
|
||||
QTEST(GLPlatform::driverToString(driver), "expected");
|
||||
}
|
||||
|
||||
void GLPlatformTest::testChipClassToString_data()
|
||||
{
|
||||
QTest::addColumn<ChipClass>("chipClass");
|
||||
QTest::addColumn<QString>("expected");
|
||||
|
||||
QTest::newRow("R100") << R100 << QStringLiteral("R100");
|
||||
QTest::newRow("R200") << R200 << QStringLiteral("R200");
|
||||
QTest::newRow("R300") << R300 << QStringLiteral("R300");
|
||||
QTest::newRow("R400") << R400 << QStringLiteral("R400");
|
||||
QTest::newRow("R500") << R500 << QStringLiteral("R500");
|
||||
QTest::newRow("R600") << R600 << QStringLiteral("R600");
|
||||
QTest::newRow("R700") << R700 << QStringLiteral("R700");
|
||||
QTest::newRow("Evergreen") << Evergreen << QStringLiteral("EVERGREEN");
|
||||
QTest::newRow("NorthernIslands") << NorthernIslands << QStringLiteral("Northern Islands");
|
||||
QTest::newRow("SouthernIslands") << SouthernIslands << QStringLiteral("Southern Islands");
|
||||
QTest::newRow("SeaIslands") << SeaIslands << QStringLiteral("Sea Islands");
|
||||
QTest::newRow("VolcanicIslands") << VolcanicIslands << QStringLiteral("Volcanic Islands");
|
||||
QTest::newRow("Arctic Islands") << ArcticIslands << QStringLiteral("Arctic Islands");
|
||||
QTest::newRow("Vega") << Vega << QStringLiteral("Vega");
|
||||
QTest::newRow("UnknownRadeon") << UnknownRadeon << QStringLiteral("Unknown");
|
||||
QTest::newRow("NV10") << NV10 << QStringLiteral("NV10");
|
||||
QTest::newRow("NV20") << NV20 << QStringLiteral("NV20");
|
||||
QTest::newRow("NV30") << NV30 << QStringLiteral("NV30");
|
||||
QTest::newRow("NV40") << NV40 << QStringLiteral("NV40/G70");
|
||||
QTest::newRow("G80") << G80 << QStringLiteral("G80/G90");
|
||||
QTest::newRow("GF100") << GF100 << QStringLiteral("GF100");
|
||||
QTest::newRow("UnknownNVidia") << UnknownNVidia << QStringLiteral("Unknown");
|
||||
QTest::newRow("I8XX") << I8XX << QStringLiteral("i830/i835");
|
||||
QTest::newRow("I915") << I915 << QStringLiteral("i915/i945");
|
||||
QTest::newRow("I965") << I965 << QStringLiteral("i965");
|
||||
QTest::newRow("SandyBridge") << SandyBridge << QStringLiteral("SandyBridge");
|
||||
QTest::newRow("IvyBridge") << IvyBridge << QStringLiteral("IvyBridge");
|
||||
QTest::newRow("Haswell") << Haswell << QStringLiteral("Haswell");
|
||||
QTest::newRow("UnknownIntel") << UnknownIntel << QStringLiteral("Unknown");
|
||||
QTest::newRow("Adreno1XX") << Adreno1XX << QStringLiteral("Adreno 1xx series");
|
||||
QTest::newRow("Adreno2XX") << Adreno2XX << QStringLiteral("Adreno 2xx series");
|
||||
QTest::newRow("Adreno3XX") << Adreno3XX << QStringLiteral("Adreno 3xx series");
|
||||
QTest::newRow("Adreno4XX") << Adreno4XX << QStringLiteral("Adreno 4xx series");
|
||||
QTest::newRow("Adreno5XX") << Adreno5XX << QStringLiteral("Adreno 5xx series");
|
||||
QTest::newRow("UnknownAdreno") << UnknownAdreno << QStringLiteral("Unknown");
|
||||
QTest::newRow("MaliT7XX") << MaliT7XX << QStringLiteral("Mali T7xx series");
|
||||
QTest::newRow("MaliT8XX") << MaliT8XX << QStringLiteral("Mali T8xx series");
|
||||
QTest::newRow("MaliGXX") << MaliGXX << QStringLiteral("Mali Gxx series");
|
||||
QTest::newRow("UnknownPanfrost") << UnknownPanfrost << QStringLiteral("Unknown");
|
||||
QTest::newRow("Mali400") << Mali400 << QStringLiteral("Mali 400 series");
|
||||
QTest::newRow("Mali450") << Mali450 << QStringLiteral("Mali 450 series");
|
||||
QTest::newRow("Mali470") << Mali470 << QStringLiteral("Mali 470 series");
|
||||
QTest::newRow("UnknownLima") << UnknownLima << QStringLiteral("Unknown");
|
||||
QTest::newRow("VC4_2_1") << VC4_2_1 << QStringLiteral("VideoCore IV");
|
||||
QTest::newRow("UnknownVideoCore4") << UnknownVideoCore4 << QStringLiteral("Unknown");
|
||||
QTest::newRow("V3D_4_2") << V3D_4_2 << QStringLiteral("VideoCore 3D");
|
||||
QTest::newRow("UnknownVideoCore3D") << UnknownVideoCore3D << QStringLiteral("Unknown");
|
||||
QTest::newRow("UnknownChipClass") << UnknownChipClass << QStringLiteral("Unknown");
|
||||
}
|
||||
|
||||
void GLPlatformTest::testChipClassToString()
|
||||
{
|
||||
QFETCH(ChipClass, chipClass);
|
||||
QTEST(GLPlatform::chipClassToString(chipClass), "expected");
|
||||
}
|
||||
|
||||
void GLPlatformTest::testDetect_data()
|
||||
{
|
||||
QTest::addColumn<QString>("configFile");
|
||||
|
||||
QDir dir(QFINDTESTDATA("data/glplatform"));
|
||||
const QStringList entries = dir.entryList(QDir::NoDotAndDotDot | QDir::Files);
|
||||
|
||||
for (const QString &file : entries) {
|
||||
QTest::newRow(file.toUtf8().constData()) << dir.absoluteFilePath(file);
|
||||
}
|
||||
}
|
||||
|
||||
static Version readVersion(const KConfigGroup &group, const char *entry)
|
||||
{
|
||||
const QStringList parts = group.readEntry(entry, QString()).split(',');
|
||||
if (parts.count() < 2) {
|
||||
return Version();
|
||||
}
|
||||
QList<qint64> versionParts;
|
||||
for (int i = 0; i < parts.count(); ++i) {
|
||||
bool ok = false;
|
||||
const auto value = parts.at(i).toLongLong(&ok);
|
||||
if (ok) {
|
||||
versionParts << value;
|
||||
} else {
|
||||
versionParts << 0;
|
||||
}
|
||||
}
|
||||
while (versionParts.count() < 3) {
|
||||
versionParts << 0;
|
||||
}
|
||||
return Version(versionParts.at(0), versionParts.at(1), versionParts.at(2));
|
||||
}
|
||||
|
||||
void GLPlatformTest::testDetect()
|
||||
{
|
||||
QFETCH(QString, configFile);
|
||||
KConfig config(configFile);
|
||||
const KConfigGroup driverGroup = config.group(QStringLiteral("Driver"));
|
||||
|
||||
const auto version = driverGroup.readEntry("Version").toUtf8();
|
||||
const auto glslVersion = driverGroup.readEntry("ShadingLanguageVersion").toUtf8();
|
||||
const auto renderer = driverGroup.readEntry("Renderer").toUtf8();
|
||||
const auto vendor = driverGroup.readEntry("Vendor").toUtf8();
|
||||
GLPlatform gl(EglPlatformInterface, version, glslVersion, renderer, vendor);
|
||||
QCOMPARE(gl.platformInterface(), EglPlatformInterface);
|
||||
|
||||
const KConfigGroup settingsGroup = config.group(QStringLiteral("Settings"));
|
||||
|
||||
QCOMPARE(gl.isLooseBinding(), settingsGroup.readEntry("LooseBinding", false));
|
||||
|
||||
QCOMPARE(gl.glVersion(), readVersion(settingsGroup, "GLVersion"));
|
||||
QCOMPARE(gl.glslVersion(), readVersion(settingsGroup, "GLSLVersion"));
|
||||
QCOMPARE(gl.mesaVersion(), readVersion(settingsGroup, "MesaVersion"));
|
||||
QEXPECT_FAIL("amd-catalyst-radeonhd-7700M-3.1.13399", "Detects GL version instead of driver version", Continue);
|
||||
QCOMPARE(gl.driverVersion(), readVersion(settingsGroup, "DriverVersion"));
|
||||
|
||||
QCOMPARE(gl.driver(), Driver(settingsGroup.readEntry("Driver", int(Driver_Unknown))));
|
||||
QCOMPARE(gl.chipClass(), ChipClass(settingsGroup.readEntry("ChipClass", int(UnknownChipClass))));
|
||||
|
||||
QCOMPARE(gl.isMesaDriver(), settingsGroup.readEntry("Mesa", false));
|
||||
QCOMPARE(gl.isRadeon(), settingsGroup.readEntry("Radeon", false));
|
||||
QCOMPARE(gl.isNvidia(), settingsGroup.readEntry("Nvidia", false));
|
||||
QCOMPARE(gl.isIntel(), settingsGroup.readEntry("Intel", false));
|
||||
QCOMPARE(gl.isVirtualBox(), settingsGroup.readEntry("VirtualBox", false));
|
||||
QCOMPARE(gl.isVMware(), settingsGroup.readEntry("VMware", false));
|
||||
QCOMPARE(gl.isAdreno(), settingsGroup.readEntry("Adreno", false));
|
||||
QCOMPARE(gl.isPanfrost(), settingsGroup.readEntry("Panfrost", false));
|
||||
QCOMPARE(gl.isLima(), settingsGroup.readEntry("Lima", false));
|
||||
QCOMPARE(gl.isVideoCore4(), settingsGroup.readEntry("VC4", false));
|
||||
QCOMPARE(gl.isVideoCore3D(), settingsGroup.readEntry("V3D", false));
|
||||
QCOMPARE(gl.isVirgl(), settingsGroup.readEntry("Virgl", false));
|
||||
|
||||
QCOMPARE(gl.isVirtualMachine(), settingsGroup.readEntry("VirtualMachine", false));
|
||||
|
||||
QCOMPARE(gl.glVersionString(), version);
|
||||
QCOMPARE(gl.glRendererString(), renderer);
|
||||
QCOMPARE(gl.glVendorString(), vendor);
|
||||
QCOMPARE(gl.glShadingLanguageVersionString(), glslVersion);
|
||||
|
||||
QCOMPARE(gl.isLooseBinding(), settingsGroup.readEntry("LooseBinding", false));
|
||||
QCOMPARE(gl.recommendedCompositor(), CompositingType(settingsGroup.readEntry("Compositor", int(NoCompositing))));
|
||||
QCOMPARE(gl.preferBufferSubData(), settingsGroup.readEntry("PreferBufferSubData", false));
|
||||
}
|
||||
|
||||
QTEST_GUILESS_MAIN(GLPlatformTest)
|
||||
#include "kwinglplatformtest.moc"
|
||||
@@ -1,415 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2018 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "effect/timeline.h"
|
||||
|
||||
#include <QTest>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
// FIXME: Delete it in the future.
|
||||
Q_DECLARE_METATYPE(std::chrono::milliseconds)
|
||||
|
||||
class TimeLineTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void testUpdateForward();
|
||||
void testUpdateBackward();
|
||||
void testUpdateFinished();
|
||||
void testToggleDirection();
|
||||
void testReset();
|
||||
void testSetElapsed_data();
|
||||
void testSetElapsed();
|
||||
void testSetDuration();
|
||||
void testSetDurationRetargeting();
|
||||
void testSetDurationRetargetingSmallDuration();
|
||||
void testRunning();
|
||||
void testStrictRedirectSourceMode_data();
|
||||
void testStrictRedirectSourceMode();
|
||||
void testRelaxedRedirectSourceMode_data();
|
||||
void testRelaxedRedirectSourceMode();
|
||||
void testStrictRedirectTargetMode_data();
|
||||
void testStrictRedirectTargetMode();
|
||||
void testRelaxedRedirectTargetMode_data();
|
||||
void testRelaxedRedirectTargetMode();
|
||||
};
|
||||
|
||||
void TimeLineTest::testUpdateForward()
|
||||
{
|
||||
KWin::TimeLine timeLine(1000ms, KWin::TimeLine::Forward);
|
||||
timeLine.setEasingCurve(QEasingCurve::Linear);
|
||||
|
||||
// 0/1000
|
||||
timeLine.advance(0ms);
|
||||
QCOMPARE(timeLine.value(), 0.0);
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
// 100/1000
|
||||
timeLine.advance(100ms);
|
||||
QCOMPARE(timeLine.value(), 0.1);
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
// 400/1000
|
||||
timeLine.advance(400ms);
|
||||
QCOMPARE(timeLine.value(), 0.4);
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
// 900/1000
|
||||
timeLine.advance(900ms);
|
||||
QCOMPARE(timeLine.value(), 0.9);
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
// 1000/1000
|
||||
timeLine.advance(3000ms);
|
||||
QCOMPARE(timeLine.value(), 1.0);
|
||||
QVERIFY(timeLine.done());
|
||||
}
|
||||
|
||||
void TimeLineTest::testUpdateBackward()
|
||||
{
|
||||
KWin::TimeLine timeLine(1000ms, KWin::TimeLine::Backward);
|
||||
timeLine.setEasingCurve(QEasingCurve::Linear);
|
||||
|
||||
// 0/1000
|
||||
timeLine.advance(0ms);
|
||||
QCOMPARE(timeLine.value(), 1.0);
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
// 100/1000
|
||||
timeLine.advance(100ms);
|
||||
QCOMPARE(timeLine.value(), 0.9);
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
// 400/1000
|
||||
timeLine.advance(400ms);
|
||||
QCOMPARE(timeLine.value(), 0.6);
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
// 900/1000
|
||||
timeLine.advance(900ms);
|
||||
QCOMPARE(timeLine.value(), 0.1);
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
// 1000/1000
|
||||
timeLine.advance(3000ms);
|
||||
QCOMPARE(timeLine.value(), 0.0);
|
||||
QVERIFY(timeLine.done());
|
||||
}
|
||||
|
||||
void TimeLineTest::testUpdateFinished()
|
||||
{
|
||||
KWin::TimeLine timeLine(1000ms, KWin::TimeLine::Forward);
|
||||
timeLine.advance(0ms);
|
||||
timeLine.setEasingCurve(QEasingCurve::Linear);
|
||||
|
||||
timeLine.advance(1000ms);
|
||||
QCOMPARE(timeLine.value(), 1.0);
|
||||
QVERIFY(timeLine.done());
|
||||
|
||||
timeLine.advance(1042ms);
|
||||
QCOMPARE(timeLine.value(), 1.0);
|
||||
QVERIFY(timeLine.done());
|
||||
}
|
||||
|
||||
void TimeLineTest::testToggleDirection()
|
||||
{
|
||||
KWin::TimeLine timeLine(1000ms, KWin::TimeLine::Forward);
|
||||
timeLine.setEasingCurve(QEasingCurve::Linear);
|
||||
|
||||
timeLine.advance(0ms);
|
||||
QCOMPARE(timeLine.value(), 0.0);
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
timeLine.advance(600ms);
|
||||
QCOMPARE(timeLine.value(), 0.6);
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
timeLine.toggleDirection();
|
||||
QCOMPARE(timeLine.value(), 0.6);
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
timeLine.advance(800ms);
|
||||
QCOMPARE(timeLine.value(), 0.4);
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
timeLine.advance(3000ms);
|
||||
QCOMPARE(timeLine.value(), 0.0);
|
||||
QVERIFY(timeLine.done());
|
||||
}
|
||||
|
||||
void TimeLineTest::testReset()
|
||||
{
|
||||
KWin::TimeLine timeLine(1000ms, KWin::TimeLine::Forward);
|
||||
timeLine.setEasingCurve(QEasingCurve::Linear);
|
||||
timeLine.advance(0ms);
|
||||
|
||||
timeLine.advance(1000ms);
|
||||
QCOMPARE(timeLine.value(), 1.0);
|
||||
QVERIFY(timeLine.done());
|
||||
|
||||
timeLine.reset();
|
||||
QCOMPARE(timeLine.value(), 0.0);
|
||||
QVERIFY(!timeLine.done());
|
||||
}
|
||||
|
||||
void TimeLineTest::testSetElapsed_data()
|
||||
{
|
||||
QTest::addColumn<std::chrono::milliseconds>("duration");
|
||||
QTest::addColumn<std::chrono::milliseconds>("elapsed");
|
||||
QTest::addColumn<std::chrono::milliseconds>("expectedElapsed");
|
||||
QTest::addColumn<bool>("expectedDone");
|
||||
QTest::addColumn<bool>("initiallyDone");
|
||||
|
||||
QTest::newRow("Less than duration, not finished") << 1000ms << 300ms << 300ms << false << false;
|
||||
QTest::newRow("Less than duration, finished") << 1000ms << 300ms << 300ms << false << true;
|
||||
QTest::newRow("Greater than duration, not finished") << 1000ms << 3000ms << 1000ms << true << false;
|
||||
QTest::newRow("Greater than duration, finished") << 1000ms << 3000ms << 1000ms << true << true;
|
||||
QTest::newRow("Equal to duration, not finished") << 1000ms << 1000ms << 1000ms << true << false;
|
||||
QTest::newRow("Equal to duration, finished") << 1000ms << 1000ms << 1000ms << true << true;
|
||||
}
|
||||
|
||||
void TimeLineTest::testSetElapsed()
|
||||
{
|
||||
QFETCH(std::chrono::milliseconds, duration);
|
||||
QFETCH(std::chrono::milliseconds, elapsed);
|
||||
QFETCH(std::chrono::milliseconds, expectedElapsed);
|
||||
QFETCH(bool, expectedDone);
|
||||
QFETCH(bool, initiallyDone);
|
||||
|
||||
KWin::TimeLine timeLine(duration, KWin::TimeLine::Forward);
|
||||
timeLine.setEasingCurve(QEasingCurve::Linear);
|
||||
timeLine.advance(0ms);
|
||||
|
||||
if (initiallyDone) {
|
||||
timeLine.advance(duration);
|
||||
QVERIFY(timeLine.done());
|
||||
}
|
||||
|
||||
timeLine.setElapsed(elapsed);
|
||||
QCOMPARE(timeLine.elapsed(), expectedElapsed);
|
||||
QCOMPARE(timeLine.done(), expectedDone);
|
||||
}
|
||||
|
||||
void TimeLineTest::testSetDuration()
|
||||
{
|
||||
KWin::TimeLine timeLine(1000ms, KWin::TimeLine::Forward);
|
||||
timeLine.setEasingCurve(QEasingCurve::Linear);
|
||||
|
||||
QCOMPARE(timeLine.duration(), 1000ms);
|
||||
|
||||
timeLine.setDuration(3000ms);
|
||||
QCOMPARE(timeLine.duration(), 3000ms);
|
||||
}
|
||||
|
||||
void TimeLineTest::testSetDurationRetargeting()
|
||||
{
|
||||
KWin::TimeLine timeLine(1000ms, KWin::TimeLine::Forward);
|
||||
timeLine.setEasingCurve(QEasingCurve::Linear);
|
||||
timeLine.advance(0ms);
|
||||
|
||||
timeLine.advance(500ms);
|
||||
QCOMPARE(timeLine.value(), 0.5);
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
timeLine.setDuration(3000ms);
|
||||
QCOMPARE(timeLine.value(), 0.5);
|
||||
QVERIFY(!timeLine.done());
|
||||
}
|
||||
|
||||
void TimeLineTest::testSetDurationRetargetingSmallDuration()
|
||||
{
|
||||
KWin::TimeLine timeLine(1000ms, KWin::TimeLine::Forward);
|
||||
timeLine.setEasingCurve(QEasingCurve::Linear);
|
||||
timeLine.advance(0ms);
|
||||
|
||||
timeLine.advance(999ms);
|
||||
QCOMPARE(timeLine.value(), 0.999);
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
timeLine.setDuration(3ms);
|
||||
QCOMPARE(timeLine.value(), 1.0);
|
||||
QVERIFY(timeLine.done());
|
||||
}
|
||||
|
||||
void TimeLineTest::testRunning()
|
||||
{
|
||||
KWin::TimeLine timeLine(1000ms, KWin::TimeLine::Forward);
|
||||
timeLine.setEasingCurve(QEasingCurve::Linear);
|
||||
timeLine.advance(0ms);
|
||||
|
||||
QVERIFY(!timeLine.running());
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
timeLine.advance(100ms);
|
||||
QVERIFY(timeLine.running());
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
timeLine.advance(1000ms);
|
||||
QVERIFY(!timeLine.running());
|
||||
QVERIFY(timeLine.done());
|
||||
}
|
||||
|
||||
void TimeLineTest::testStrictRedirectSourceMode_data()
|
||||
{
|
||||
QTest::addColumn<KWin::TimeLine::Direction>("initialDirection");
|
||||
QTest::addColumn<qreal>("initialValue");
|
||||
QTest::addColumn<KWin::TimeLine::Direction>("finalDirection");
|
||||
QTest::addColumn<qreal>("finalValue");
|
||||
|
||||
QTest::newRow("forward -> backward") << KWin::TimeLine::Forward << 0.0 << KWin::TimeLine::Backward << 0.0;
|
||||
QTest::newRow("backward -> forward") << KWin::TimeLine::Backward << 1.0 << KWin::TimeLine::Forward << 1.0;
|
||||
}
|
||||
|
||||
void TimeLineTest::testStrictRedirectSourceMode()
|
||||
{
|
||||
QFETCH(KWin::TimeLine::Direction, initialDirection);
|
||||
KWin::TimeLine timeLine(1000ms, initialDirection);
|
||||
timeLine.setEasingCurve(QEasingCurve::Linear);
|
||||
timeLine.setSourceRedirectMode(KWin::TimeLine::RedirectMode::Strict);
|
||||
|
||||
QTEST(timeLine.direction(), "initialDirection");
|
||||
QTEST(timeLine.value(), "initialValue");
|
||||
QCOMPARE(timeLine.sourceRedirectMode(), KWin::TimeLine::RedirectMode::Strict);
|
||||
QVERIFY(!timeLine.running());
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
QFETCH(KWin::TimeLine::Direction, finalDirection);
|
||||
timeLine.setDirection(finalDirection);
|
||||
|
||||
QTEST(timeLine.direction(), "finalDirection");
|
||||
QTEST(timeLine.value(), "finalValue");
|
||||
QCOMPARE(timeLine.sourceRedirectMode(), KWin::TimeLine::RedirectMode::Strict);
|
||||
QVERIFY(!timeLine.running());
|
||||
QVERIFY(timeLine.done());
|
||||
}
|
||||
|
||||
void TimeLineTest::testRelaxedRedirectSourceMode_data()
|
||||
{
|
||||
QTest::addColumn<KWin::TimeLine::Direction>("initialDirection");
|
||||
QTest::addColumn<qreal>("initialValue");
|
||||
QTest::addColumn<KWin::TimeLine::Direction>("finalDirection");
|
||||
QTest::addColumn<qreal>("finalValue");
|
||||
|
||||
QTest::newRow("forward -> backward") << KWin::TimeLine::Forward << 0.0 << KWin::TimeLine::Backward << 1.0;
|
||||
QTest::newRow("backward -> forward") << KWin::TimeLine::Backward << 1.0 << KWin::TimeLine::Forward << 0.0;
|
||||
}
|
||||
|
||||
void TimeLineTest::testRelaxedRedirectSourceMode()
|
||||
{
|
||||
QFETCH(KWin::TimeLine::Direction, initialDirection);
|
||||
KWin::TimeLine timeLine(1000ms, initialDirection);
|
||||
timeLine.setEasingCurve(QEasingCurve::Linear);
|
||||
timeLine.setSourceRedirectMode(KWin::TimeLine::RedirectMode::Relaxed);
|
||||
|
||||
QTEST(timeLine.direction(), "initialDirection");
|
||||
QTEST(timeLine.value(), "initialValue");
|
||||
QCOMPARE(timeLine.sourceRedirectMode(), KWin::TimeLine::RedirectMode::Relaxed);
|
||||
QVERIFY(!timeLine.running());
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
QFETCH(KWin::TimeLine::Direction, finalDirection);
|
||||
timeLine.setDirection(finalDirection);
|
||||
|
||||
QTEST(timeLine.direction(), "finalDirection");
|
||||
QTEST(timeLine.value(), "finalValue");
|
||||
QCOMPARE(timeLine.sourceRedirectMode(), KWin::TimeLine::RedirectMode::Relaxed);
|
||||
QVERIFY(!timeLine.running());
|
||||
QVERIFY(!timeLine.done());
|
||||
}
|
||||
|
||||
void TimeLineTest::testStrictRedirectTargetMode_data()
|
||||
{
|
||||
QTest::addColumn<KWin::TimeLine::Direction>("initialDirection");
|
||||
QTest::addColumn<qreal>("initialValue");
|
||||
QTest::addColumn<KWin::TimeLine::Direction>("finalDirection");
|
||||
QTest::addColumn<qreal>("finalValue");
|
||||
|
||||
QTest::newRow("forward -> backward") << KWin::TimeLine::Forward << 0.0 << KWin::TimeLine::Backward << 1.0;
|
||||
QTest::newRow("backward -> forward") << KWin::TimeLine::Backward << 1.0 << KWin::TimeLine::Forward << 0.0;
|
||||
}
|
||||
|
||||
void TimeLineTest::testStrictRedirectTargetMode()
|
||||
{
|
||||
QFETCH(KWin::TimeLine::Direction, initialDirection);
|
||||
KWin::TimeLine timeLine(1000ms, initialDirection);
|
||||
timeLine.setEasingCurve(QEasingCurve::Linear);
|
||||
timeLine.setTargetRedirectMode(KWin::TimeLine::RedirectMode::Strict);
|
||||
timeLine.advance(0ms);
|
||||
|
||||
QTEST(timeLine.direction(), "initialDirection");
|
||||
QTEST(timeLine.value(), "initialValue");
|
||||
QCOMPARE(timeLine.targetRedirectMode(), KWin::TimeLine::RedirectMode::Strict);
|
||||
QVERIFY(!timeLine.running());
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
timeLine.advance(1000ms);
|
||||
QTEST(timeLine.value(), "finalValue");
|
||||
QVERIFY(!timeLine.running());
|
||||
QVERIFY(timeLine.done());
|
||||
|
||||
QFETCH(KWin::TimeLine::Direction, finalDirection);
|
||||
timeLine.setDirection(finalDirection);
|
||||
|
||||
QTEST(timeLine.direction(), "finalDirection");
|
||||
QTEST(timeLine.value(), "finalValue");
|
||||
QVERIFY(!timeLine.running());
|
||||
QVERIFY(timeLine.done());
|
||||
}
|
||||
|
||||
void TimeLineTest::testRelaxedRedirectTargetMode_data()
|
||||
{
|
||||
QTest::addColumn<KWin::TimeLine::Direction>("initialDirection");
|
||||
QTest::addColumn<qreal>("initialValue");
|
||||
QTest::addColumn<KWin::TimeLine::Direction>("finalDirection");
|
||||
QTest::addColumn<qreal>("finalValue");
|
||||
|
||||
QTest::newRow("forward -> backward") << KWin::TimeLine::Forward << 0.0 << KWin::TimeLine::Backward << 1.0;
|
||||
QTest::newRow("backward -> forward") << KWin::TimeLine::Backward << 1.0 << KWin::TimeLine::Forward << 0.0;
|
||||
}
|
||||
|
||||
void TimeLineTest::testRelaxedRedirectTargetMode()
|
||||
{
|
||||
QFETCH(KWin::TimeLine::Direction, initialDirection);
|
||||
KWin::TimeLine timeLine(1000ms, initialDirection);
|
||||
timeLine.setEasingCurve(QEasingCurve::Linear);
|
||||
timeLine.setTargetRedirectMode(KWin::TimeLine::RedirectMode::Relaxed);
|
||||
timeLine.advance(0ms);
|
||||
|
||||
QTEST(timeLine.direction(), "initialDirection");
|
||||
QTEST(timeLine.value(), "initialValue");
|
||||
QCOMPARE(timeLine.targetRedirectMode(), KWin::TimeLine::RedirectMode::Relaxed);
|
||||
QVERIFY(!timeLine.running());
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
timeLine.advance(1000ms);
|
||||
QTEST(timeLine.value(), "finalValue");
|
||||
QVERIFY(!timeLine.running());
|
||||
QVERIFY(timeLine.done());
|
||||
|
||||
QFETCH(KWin::TimeLine::Direction, finalDirection);
|
||||
timeLine.setDirection(finalDirection);
|
||||
timeLine.advance(1000ms);
|
||||
|
||||
QTEST(timeLine.direction(), "finalDirection");
|
||||
QTEST(timeLine.value(), "finalValue");
|
||||
QVERIFY(!timeLine.running());
|
||||
QVERIFY(!timeLine.done());
|
||||
|
||||
timeLine.advance(2000ms);
|
||||
QTEST(timeLine.direction(), "finalDirection");
|
||||
QTEST(timeLine.value(), "initialValue");
|
||||
QVERIFY(!timeLine.running());
|
||||
QVERIFY(timeLine.done());
|
||||
}
|
||||
|
||||
QTEST_MAIN(TimeLineTest)
|
||||
|
||||
#include "timelinetest.moc"
|
||||
@@ -1,214 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "scene/itemgeometry.h"
|
||||
#include <QTest>
|
||||
|
||||
Q_DECLARE_METATYPE(KWin::WindowQuadList)
|
||||
|
||||
class WindowQuadListTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void testMakeGrid_data();
|
||||
void testMakeGrid();
|
||||
void testMakeRegularGrid_data();
|
||||
void testMakeRegularGrid();
|
||||
|
||||
private:
|
||||
KWin::WindowQuad makeQuad(const QRectF &rect);
|
||||
};
|
||||
|
||||
KWin::WindowQuad WindowQuadListTest::makeQuad(const QRectF &r)
|
||||
{
|
||||
KWin::WindowQuad quad;
|
||||
quad[0] = KWin::WindowVertex(r.x(), r.y(), r.x(), r.y());
|
||||
quad[1] = KWin::WindowVertex(r.x() + r.width(), r.y(), r.x() + r.width(), r.y());
|
||||
quad[2] = KWin::WindowVertex(r.x() + r.width(), r.y() + r.height(), r.x() + r.width(), r.y() + r.height());
|
||||
quad[3] = KWin::WindowVertex(r.x(), r.y() + r.height(), r.x(), r.y() + r.height());
|
||||
return quad;
|
||||
}
|
||||
|
||||
void WindowQuadListTest::testMakeGrid_data()
|
||||
{
|
||||
QTest::addColumn<KWin::WindowQuadList>("orig");
|
||||
QTest::addColumn<int>("quadSize");
|
||||
QTest::addColumn<int>("expectedCount");
|
||||
QTest::addColumn<KWin::WindowQuadList>("expected");
|
||||
|
||||
KWin::WindowQuadList orig;
|
||||
KWin::WindowQuadList expected;
|
||||
|
||||
QTest::newRow("empty") << orig << 10 << 0 << expected;
|
||||
|
||||
orig.append(makeQuad(QRectF(0, 0, 10, 10)));
|
||||
expected.append(makeQuad(QRectF(0, 0, 10, 10)));
|
||||
QTest::newRow("quadSizeTooLarge") << orig << 10 << 1 << expected;
|
||||
|
||||
expected.clear();
|
||||
expected.append(makeQuad(QRectF(0, 0, 5, 5)));
|
||||
expected.append(makeQuad(QRectF(0, 5, 5, 5)));
|
||||
expected.append(makeQuad(QRectF(5, 0, 5, 5)));
|
||||
expected.append(makeQuad(QRectF(5, 5, 5, 5)));
|
||||
QTest::newRow("regularGrid") << orig << 5 << 4 << expected;
|
||||
|
||||
expected.clear();
|
||||
expected.append(makeQuad(QRectF(0, 0, 9, 9)));
|
||||
expected.append(makeQuad(QRectF(0, 9, 9, 1)));
|
||||
expected.append(makeQuad(QRectF(9, 0, 1, 9)));
|
||||
expected.append(makeQuad(QRectF(9, 9, 1, 1)));
|
||||
QTest::newRow("irregularGrid") << orig << 9 << 4 << expected;
|
||||
|
||||
orig.append(makeQuad(QRectF(0, 10, 4, 3)));
|
||||
expected.clear();
|
||||
expected.append(makeQuad(QRectF(0, 0, 4, 4)));
|
||||
expected.append(makeQuad(QRectF(0, 4, 4, 4)));
|
||||
expected.append(makeQuad(QRectF(0, 8, 4, 2)));
|
||||
expected.append(makeQuad(QRectF(0, 10, 4, 2)));
|
||||
expected.append(makeQuad(QRectF(0, 12, 4, 1)));
|
||||
expected.append(makeQuad(QRectF(4, 0, 4, 4)));
|
||||
expected.append(makeQuad(QRectF(4, 4, 4, 4)));
|
||||
expected.append(makeQuad(QRectF(4, 8, 4, 2)));
|
||||
expected.append(makeQuad(QRectF(8, 0, 2, 4)));
|
||||
expected.append(makeQuad(QRectF(8, 4, 2, 4)));
|
||||
expected.append(makeQuad(QRectF(8, 8, 2, 2)));
|
||||
QTest::newRow("irregularGrid2") << orig << 4 << 11 << expected;
|
||||
}
|
||||
|
||||
void WindowQuadListTest::testMakeGrid()
|
||||
{
|
||||
QFETCH(KWin::WindowQuadList, orig);
|
||||
QFETCH(int, quadSize);
|
||||
QFETCH(int, expectedCount);
|
||||
KWin::WindowQuadList actual = orig.makeGrid(quadSize);
|
||||
QCOMPARE(actual.count(), expectedCount);
|
||||
|
||||
QFETCH(KWin::WindowQuadList, expected);
|
||||
for (auto it = actual.constBegin(); it != actual.constEnd(); ++it) {
|
||||
bool found = false;
|
||||
const KWin::WindowQuad &actualQuad = (*it);
|
||||
for (auto it2 = expected.constBegin(); it2 != expected.constEnd(); ++it2) {
|
||||
const KWin::WindowQuad &expectedQuad = (*it2);
|
||||
auto vertexTest = [actualQuad, expectedQuad](int index) {
|
||||
const KWin::WindowVertex &actualVertex = actualQuad[index];
|
||||
const KWin::WindowVertex &expectedVertex = expectedQuad[index];
|
||||
if (actualVertex.x() != expectedVertex.x()) {
|
||||
return false;
|
||||
}
|
||||
if (actualVertex.y() != expectedVertex.y()) {
|
||||
return false;
|
||||
}
|
||||
if (!qFuzzyIsNull(actualVertex.u() - expectedVertex.u())) {
|
||||
return false;
|
||||
}
|
||||
if (!qFuzzyIsNull(actualVertex.v() - expectedVertex.v())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
found = vertexTest(0) && vertexTest(1) && vertexTest(2) && vertexTest(3);
|
||||
if (found) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
QVERIFY2(found, qPrintable(QStringLiteral("%0, %1 / %2, %3").arg(QString::number(actualQuad.left()), QString::number(actualQuad.top()), QString::number(actualQuad.right()), QString::number(actualQuad.bottom()))));
|
||||
}
|
||||
}
|
||||
|
||||
void WindowQuadListTest::testMakeRegularGrid_data()
|
||||
{
|
||||
QTest::addColumn<KWin::WindowQuadList>("orig");
|
||||
QTest::addColumn<int>("xSubdivisions");
|
||||
QTest::addColumn<int>("ySubdivisions");
|
||||
QTest::addColumn<int>("expectedCount");
|
||||
QTest::addColumn<KWin::WindowQuadList>("expected");
|
||||
|
||||
KWin::WindowQuadList orig;
|
||||
KWin::WindowQuadList expected;
|
||||
|
||||
QTest::newRow("empty") << orig << 1 << 1 << 0 << expected;
|
||||
|
||||
orig.append(makeQuad(QRectF(0, 0, 10, 10)));
|
||||
expected.append(makeQuad(QRectF(0, 0, 10, 10)));
|
||||
QTest::newRow("noSplit") << orig << 1 << 1 << 1 << expected;
|
||||
|
||||
expected.clear();
|
||||
expected.append(makeQuad(QRectF(0, 0, 5, 10)));
|
||||
expected.append(makeQuad(QRectF(5, 0, 5, 10)));
|
||||
QTest::newRow("xSplit") << orig << 2 << 1 << 2 << expected;
|
||||
|
||||
expected.clear();
|
||||
expected.append(makeQuad(QRectF(0, 0, 10, 5)));
|
||||
expected.append(makeQuad(QRectF(0, 5, 10, 5)));
|
||||
QTest::newRow("ySplit") << orig << 1 << 2 << 2 << expected;
|
||||
|
||||
expected.clear();
|
||||
expected.append(makeQuad(QRectF(0, 0, 5, 5)));
|
||||
expected.append(makeQuad(QRectF(5, 0, 5, 5)));
|
||||
expected.append(makeQuad(QRectF(0, 5, 5, 5)));
|
||||
expected.append(makeQuad(QRectF(5, 5, 5, 5)));
|
||||
QTest::newRow("xySplit") << orig << 2 << 2 << 4 << expected;
|
||||
|
||||
orig.append(makeQuad(QRectF(0, 10, 4, 2)));
|
||||
expected.clear();
|
||||
expected.append(makeQuad(QRectF(0, 0, 5, 3)));
|
||||
expected.append(makeQuad(QRectF(5, 0, 5, 3)));
|
||||
expected.append(makeQuad(QRectF(0, 3, 5, 3)));
|
||||
expected.append(makeQuad(QRectF(5, 3, 5, 3)));
|
||||
expected.append(makeQuad(QRectF(0, 6, 5, 3)));
|
||||
expected.append(makeQuad(QRectF(5, 6, 5, 3)));
|
||||
expected.append(makeQuad(QRectF(0, 9, 5, 1)));
|
||||
expected.append(makeQuad(QRectF(0, 10, 4, 2)));
|
||||
expected.append(makeQuad(QRectF(5, 9, 5, 1)));
|
||||
QTest::newRow("multipleQuads") << orig << 2 << 4 << 9 << expected;
|
||||
}
|
||||
|
||||
void WindowQuadListTest::testMakeRegularGrid()
|
||||
{
|
||||
QFETCH(KWin::WindowQuadList, orig);
|
||||
QFETCH(int, xSubdivisions);
|
||||
QFETCH(int, ySubdivisions);
|
||||
QFETCH(int, expectedCount);
|
||||
KWin::WindowQuadList actual = orig.makeRegularGrid(xSubdivisions, ySubdivisions);
|
||||
QCOMPARE(actual.count(), expectedCount);
|
||||
|
||||
QFETCH(KWin::WindowQuadList, expected);
|
||||
for (auto it = actual.constBegin(); it != actual.constEnd(); ++it) {
|
||||
bool found = false;
|
||||
const KWin::WindowQuad &actualQuad = (*it);
|
||||
for (auto it2 = expected.constBegin(); it2 != expected.constEnd(); ++it2) {
|
||||
const KWin::WindowQuad &expectedQuad = (*it2);
|
||||
auto vertexTest = [actualQuad, expectedQuad](int index) {
|
||||
const KWin::WindowVertex &actualVertex = actualQuad[index];
|
||||
const KWin::WindowVertex &expectedVertex = expectedQuad[index];
|
||||
if (actualVertex.x() != expectedVertex.x()) {
|
||||
return false;
|
||||
}
|
||||
if (actualVertex.y() != expectedVertex.y()) {
|
||||
return false;
|
||||
}
|
||||
if (!qFuzzyIsNull(actualVertex.u() - expectedVertex.u())) {
|
||||
return false;
|
||||
}
|
||||
if (!qFuzzyIsNull(actualVertex.v() - expectedVertex.v())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
found = vertexTest(0) && vertexTest(1) && vertexTest(2) && vertexTest(3);
|
||||
if (found) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
QVERIFY2(found, qPrintable(QStringLiteral("%0, %1 / %2, %3").arg(QString::number(actualQuad.left()), QString::number(actualQuad.top()), QString::number(actualQuad.right()), QString::number(actualQuad.bottom()))));
|
||||
}
|
||||
}
|
||||
|
||||
QTEST_MAIN(WindowQuadListTest)
|
||||
|
||||
#include "windowquadlisttest.moc"
|
||||
@@ -1,184 +0,0 @@
|
||||
add_subdirectory(helper)
|
||||
|
||||
add_library(KWinIntegrationTestFramework STATIC)
|
||||
|
||||
if (Qt6_VERSION VERSION_GREATER_EQUAL "6.8.0")
|
||||
set(private_code_option "PRIVATE_CODE")
|
||||
endif()
|
||||
qt6_generate_wayland_protocol_client_sources(KWinIntegrationTestFramework
|
||||
${private_code_option}
|
||||
NO_INCLUDE_CORE_ONLY
|
||||
FILES
|
||||
${WaylandProtocols_DATADIR}/unstable/input-method/input-method-unstable-v1.xml
|
||||
)
|
||||
qt6_generate_wayland_protocol_client_sources(KWinIntegrationTestFramework
|
||||
${private_code_option}
|
||||
FILES
|
||||
${CMAKE_SOURCE_DIR}/src/wayland/protocols/wlr-layer-shell-unstable-v1.xml
|
||||
${PROJECT_SOURCE_DIR}/src/wayland/protocols/color-management-v1.xml
|
||||
${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml
|
||||
${WaylandProtocols_DATADIR}/staging/cursor-shape/cursor-shape-v1.xml
|
||||
${WaylandProtocols_DATADIR}/staging/fractional-scale/fractional-scale-v1.xml
|
||||
${WaylandProtocols_DATADIR}/staging/security-context/security-context-v1.xml
|
||||
${WaylandProtocols_DATADIR}/staging/xdg-dialog/xdg-dialog-v1.xml
|
||||
${WaylandProtocols_DATADIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml
|
||||
${WaylandProtocols_DATADIR}/unstable/tablet/tablet-unstable-v2.xml
|
||||
${WaylandProtocols_DATADIR}/unstable/text-input/text-input-unstable-v3.xml
|
||||
${WaylandProtocols_DATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
|
||||
|
||||
${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-output-device-v2.xml
|
||||
${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-output-management-v2.xml
|
||||
${PLASMA_WAYLAND_PROTOCOLS_DIR}/kde-screen-edge-v1.xml
|
||||
${PLASMA_WAYLAND_PROTOCOLS_DIR}/zkde-screencast-unstable-v1.xml
|
||||
${PLASMA_WAYLAND_PROTOCOLS_DIR}/fake-input.xml
|
||||
)
|
||||
target_sources(KWinIntegrationTestFramework PRIVATE
|
||||
generic_scene_opengl_test.cpp
|
||||
kwin_wayland_test.cpp
|
||||
test_helpers.cpp
|
||||
)
|
||||
target_link_libraries(KWinIntegrationTestFramework
|
||||
PUBLIC
|
||||
Qt::Test
|
||||
Qt::Concurrent
|
||||
Plasma::KWaylandClient
|
||||
Wayland::Client
|
||||
Libdrm::Libdrm
|
||||
kwin
|
||||
|
||||
PRIVATE
|
||||
# Static plugins
|
||||
KWinQpaPlugin
|
||||
KF6WindowSystemKWinPlugin
|
||||
KF6IdleTimeKWinPlugin
|
||||
)
|
||||
if(KWIN_BUILD_X11)
|
||||
target_link_libraries(KWinIntegrationTestFramework PRIVATE KWinXwaylandServerModule)
|
||||
endif()
|
||||
if(TARGET KF6GlobalAccelKWinPlugin)
|
||||
target_link_libraries(KWinIntegrationTestFramework PUBLIC KF6GlobalAccelKWinPlugin)
|
||||
endif()
|
||||
|
||||
if(TARGET PW::KScreenLocker)
|
||||
target_link_libraries(KWinIntegrationTestFramework PUBLIC PW::KScreenLocker)
|
||||
endif()
|
||||
|
||||
function(integrationTest)
|
||||
set(optionArgs BUILTIN_EFFECTS)
|
||||
set(oneValueArgs NAME)
|
||||
set(multiValueArgs SRCS LIBS)
|
||||
cmake_parse_arguments(ARGS "${optionArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
if (NOT KWIN_BUILD_X11 AND ARGS_LIBS MATCHES XCB::)
|
||||
return()
|
||||
endif()
|
||||
add_executable(${ARGS_NAME} ${ARGS_SRCS})
|
||||
target_link_libraries(${ARGS_NAME} KWinIntegrationTestFramework Qt::Test ${ARGS_LIBS})
|
||||
if(${ARGS_BUILTIN_EFFECTS})
|
||||
kcoreaddons_target_static_plugins(${ARGS_NAME} NAMESPACE "kwin/effects/plugins")
|
||||
endif()
|
||||
add_test(NAME kwin-${ARGS_NAME} COMMAND dbus-run-session ${CMAKE_BINARY_DIR}/bin/${ARGS_NAME})
|
||||
endfunction()
|
||||
if(KWIN_BUILD_X11)
|
||||
integrationTest(NAME testDontCrashGlxgears SRCS dont_crash_glxgears.cpp LIBS KF6::I18n KDecoration3::KDecoration)
|
||||
endif()
|
||||
if (KWIN_BUILD_SCREENLOCKER)
|
||||
integrationTest(NAME testLockScreen SRCS lockscreen.cpp LIBS KF6::GlobalAccel)
|
||||
endif()
|
||||
integrationTest(NAME testBounceKeys SRCS bounce_keys_test.cpp)
|
||||
integrationTest(NAME testButtonRebind SRCS buttonrebind_test.cpp)
|
||||
integrationTest(NAME testDecorationInput SRCS decoration_input_test.cpp LIBS KDecoration3::KDecoration KDecoration3::KDecoration3Private)
|
||||
integrationTest(NAME testInternalWindow SRCS internal_window.cpp)
|
||||
integrationTest(NAME testTouchInput SRCS touch_input_test.cpp)
|
||||
integrationTest(NAME testInputStackingOrder SRCS input_stacking_order.cpp)
|
||||
integrationTest(NAME testPointerInput SRCS pointer_input.cpp LIBS Libdrm::Libdrm XCB::ICCCM)
|
||||
integrationTest(NAME testPlatformCursor SRCS platformcursor.cpp)
|
||||
integrationTest(NAME testDontCrashCancelAnimation SRCS dont_crash_cancel_animation.cpp LIBS KDecoration3::KDecoration)
|
||||
integrationTest(NAME testTransientPlacement SRCS transient_placement.cpp)
|
||||
integrationTest(NAME testDebugConsole SRCS debug_console_test.cpp)
|
||||
integrationTest(NAME testPlasmaSurface SRCS plasma_surface_test.cpp)
|
||||
integrationTest(NAME testMaximized SRCS maximize_test.cpp LIBS KDecoration3::KDecoration KF6::Package)
|
||||
integrationTest(NAME testXdgShellWindow SRCS xdgshellwindow_test.cpp LIBS KDecoration3::KDecoration)
|
||||
integrationTest(NAME testSceneOpenGL SRCS scene_opengl_test.cpp )
|
||||
integrationTest(NAME testSceneOpenGLES SRCS scene_opengl_es_test.cpp )
|
||||
integrationTest(NAME testScreenChanges SRCS screen_changes_test.cpp)
|
||||
if (KWIN_BUILD_TABBOX)
|
||||
integrationTest(NAME testTabBox SRCS tabbox_test.cpp)
|
||||
endif()
|
||||
integrationTest(NAME testWindowSelection SRCS window_selection_test.cpp)
|
||||
integrationTest(NAME testPointerConstraints SRCS pointer_constraints_test.cpp)
|
||||
integrationTest(NAME testKeyboardLayout SRCS keyboard_layout_test.cpp LIBS KF6::GlobalAccel XKB::XKB)
|
||||
integrationTest(NAME testKeymapCreationFailure SRCS keymap_creation_failure_test.cpp LIBS KF6::GlobalAccel)
|
||||
integrationTest(NAME testShowingDesktop SRCS showing_desktop_test.cpp)
|
||||
integrationTest(NAME testDontCrashUseractionsMenu SRCS dont_crash_useractions_menu.cpp LIBS KF6::I18n)
|
||||
integrationTest(NAME testLayerShellV1Window SRCS layershellv1window_test.cpp)
|
||||
integrationTest(NAME testVirtualDesktop SRCS virtual_desktop_test.cpp)
|
||||
integrationTest(NAME testXdgShellWindowRules SRCS xdgshellwindow_rules_test.cpp)
|
||||
integrationTest(NAME testIdleInhibition SRCS idle_inhibition_test.cpp)
|
||||
integrationTest(NAME testDontCrashReinitializeCompositor SRCS dont_crash_reinitialize_compositor.cpp BUILTIN_EFFECTS)
|
||||
integrationTest(NAME testNoGlobalShortcuts SRCS no_global_shortcuts_test.cpp LIBS KF6::GlobalAccel)
|
||||
integrationTest(NAME testPlacement SRCS placement_test.cpp)
|
||||
integrationTest(NAME testActivation SRCS activation_test.cpp LIBS XCB::ICCCM)
|
||||
integrationTest(NAME testInputMethod SRCS inputmethod_test.cpp LIBS XKB::XKB)
|
||||
integrationTest(NAME testScreens SRCS screens_test.cpp)
|
||||
integrationTest(NAME testScreenEdges SRCS screenedges_test.cpp LIBS XCB::ICCCM)
|
||||
integrationTest(NAME testOutputChanges SRCS outputchanges_test.cpp LIBS XCB::ICCCM Qt::Sensors)
|
||||
integrationTest(NAME testTiles SRCS tiles_test.cpp)
|
||||
integrationTest(NAME testFractionalScaling SRCS fractional_scaling_test.cpp)
|
||||
integrationTest(NAME testMoveResize SRCS move_resize_window_test.cpp LIBS XCB::ICCCM)
|
||||
integrationTest(NAME testStruts SRCS struts_test.cpp LIBS XCB::ICCCM KDecoration3::KDecoration)
|
||||
integrationTest(NAME testShade SRCS shade_test.cpp LIBS XCB::ICCCM KDecoration3::KDecoration)
|
||||
integrationTest(NAME testDontCrashAuroraeDestroyDeco SRCS dont_crash_aurorae_destroy_deco.cpp LIBS XCB::ICCCM KDecoration3::KDecoration)
|
||||
integrationTest(NAME testPlasmaWindow SRCS plasmawindow_test.cpp LIBS XCB::ICCCM)
|
||||
integrationTest(NAME testX11DesktopWindow SRCS desktop_window_x11_test.cpp LIBS XCB::ICCCM)
|
||||
integrationTest(NAME testXwaylandInput SRCS xwayland_input_test.cpp LIBS XCB::ICCCM)
|
||||
integrationTest(NAME testWindowRules SRCS window_rules_test.cpp LIBS XCB::ICCCM)
|
||||
integrationTest(NAME testX11Window SRCS x11_window_test.cpp LIBS XCB::ICCCM)
|
||||
integrationTest(NAME testQuickTiling SRCS quick_tiling_test.cpp LIBS XCB::ICCCM KDecoration3::KDecoration)
|
||||
integrationTest(NAME testStackingOrder SRCS stacking_order_test.cpp LIBS XCB::ICCCM)
|
||||
integrationTest(NAME testDbusInterface SRCS dbus_interface_test.cpp LIBS XCB::ICCCM)
|
||||
integrationTest(NAME testXwaylandServerCrash SRCS xwaylandserver_crash_test.cpp LIBS XCB::ICCCM)
|
||||
integrationTest(NAME testXwaylandServerRestart SRCS xwaylandserver_restart_test.cpp LIBS XCB::ICCCM)
|
||||
integrationTest(NAME testFakeInput SRCS fakeinput_test.cpp)
|
||||
integrationTest(NAME testSecurityContext SRCS security_context_test.cpp)
|
||||
integrationTest(NAME testStickyKeys SRCS sticky_keys_test.cpp)
|
||||
integrationTest(NAME testWorkspace SRCS workspace_test.cpp)
|
||||
integrationTest(NAME testMouseActions SRCS mouseactions_test.cpp LIBS)
|
||||
integrationTest(NAME testColorManagement SRCS test_colormanagement.cpp)
|
||||
integrationTest(NAME testKeyboardInput SRCS keyboard_input_test.cpp)
|
||||
|
||||
if(KWIN_BUILD_X11)
|
||||
integrationTest(NAME testDontCrashEmptyDeco SRCS dont_crash_empty_deco.cpp LIBS KDecoration3::KDecoration)
|
||||
integrationTest(NAME testXwaylandSelections SRCS xwayland_selections_test.cpp)
|
||||
integrationTest(NAME testXinerama SRCS xinerama_test.cpp)
|
||||
integrationTest(NAME testX11KeyRead SRCS x11keyread.cpp LIBS XCB::XINPUT)
|
||||
endif()
|
||||
|
||||
qt_add_dbus_interfaces(DBUS_SRCS ${CMAKE_BINARY_DIR}/src/org.kde.kwin.VirtualKeyboard.xml)
|
||||
integrationTest(NAME testVirtualKeyboardDBus SRCS test_virtualkeyboard_dbus.cpp ${DBUS_SRCS})
|
||||
|
||||
if (KWIN_BUILD_GLOBALSHORTCUTS)
|
||||
integrationTest(NAME testGlobalShortcuts SRCS globalshortcuts_test.cpp LIBS XCB::ICCCM KF6::GlobalAccel KF6::I18n XKB::XKB)
|
||||
integrationTest(NAME testKWinBindings SRCS kwinbindings_test.cpp LIBS KF6::I18n)
|
||||
endif()
|
||||
if (TARGET K::KPipeWire)
|
||||
integrationTest(NAME testScreencasting SRCS screencasting_test.cpp LIBS K::KPipeWire)
|
||||
endif()
|
||||
|
||||
if (KWIN_BUILD_ACTIVITIES)
|
||||
integrationTest(NAME testActivities SRCS activities_test.cpp LIBS XCB::ICCCM Plasma::Activities)
|
||||
endif()
|
||||
|
||||
if (KWIN_BUILD_EIS)
|
||||
pkg_check_modules(PKG_libei REQUIRED IMPORTED_TARGET libei-1.0)
|
||||
integrationTest(NAME testInputCapture SRCS input_capture_test.cpp LIBS PkgConfig::PKG_libei)
|
||||
if (PKG_libei_VERSION VERSION_GREATER_EQUAL "1.4.0")
|
||||
target_compile_definitions(testInputCapture PRIVATE -DHAVE_EI_EVENT_SYNC=1)
|
||||
else()
|
||||
target_compile_definitions(testInputCapture PRIVATE -DHAVE_EI_EVENT_SYNC=0)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
add_subdirectory(scripting)
|
||||
add_subdirectory(effects)
|
||||
add_subdirectory(fakes)
|
||||
@@ -1,600 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "core/output.h"
|
||||
#include "pointer_input.h"
|
||||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
#include "x11window.h"
|
||||
|
||||
#include <KWayland/Client/surface.h>
|
||||
#include <netwm.h>
|
||||
#include <xcb/xcb_icccm.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_activation-0");
|
||||
|
||||
class ActivationTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void testSwitchToWindowToLeft();
|
||||
void testSwitchToWindowToRight();
|
||||
void testSwitchToWindowAbove();
|
||||
void testSwitchToWindowBelow();
|
||||
void testSwitchToWindowMaximized();
|
||||
void testSwitchToWindowFullScreen();
|
||||
void testActiveFullscreen();
|
||||
|
||||
private:
|
||||
void stackScreensHorizontally();
|
||||
void stackScreensVertically();
|
||||
};
|
||||
|
||||
void ActivationTest::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<Window *>();
|
||||
|
||||
QVERIFY(waylandServer()->init(s_socketName));
|
||||
Test::setOutputConfig({
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
});
|
||||
|
||||
kwinApp()->start();
|
||||
const auto outputs = workspace()->outputs();
|
||||
QCOMPARE(outputs.count(), 2);
|
||||
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
|
||||
}
|
||||
|
||||
void ActivationTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
|
||||
workspace()->setActiveOutput(QPoint(640, 512));
|
||||
input()->pointer()->warp(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void ActivationTest::cleanup()
|
||||
{
|
||||
Test::destroyWaylandConnection();
|
||||
|
||||
stackScreensHorizontally();
|
||||
}
|
||||
|
||||
void ActivationTest::testSwitchToWindowToLeft()
|
||||
{
|
||||
// This test verifies that "Switch to Window to the Left" shortcut works.
|
||||
|
||||
// Prepare the test environment.
|
||||
stackScreensHorizontally();
|
||||
|
||||
// Create several windows on the left screen.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface1(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.get()));
|
||||
Window *window1 = Test::renderAndWaitForShown(surface1.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window1);
|
||||
QVERIFY(window1->isActive());
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface2(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface2(Test::createXdgToplevelSurface(surface2.get()));
|
||||
Window *window2 = Test::renderAndWaitForShown(surface2.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window2);
|
||||
QVERIFY(window2->isActive());
|
||||
|
||||
window1->move(QPoint(300, 200));
|
||||
window2->move(QPoint(500, 200));
|
||||
|
||||
// Create several windows on the right screen.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface3(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface3(Test::createXdgToplevelSurface(surface3.get()));
|
||||
Window *window3 = Test::renderAndWaitForShown(surface3.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window3);
|
||||
QVERIFY(window3->isActive());
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface4(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface4(Test::createXdgToplevelSurface(surface4.get()));
|
||||
Window *window4 = Test::renderAndWaitForShown(surface4.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window4);
|
||||
QVERIFY(window4->isActive());
|
||||
|
||||
window3->move(QPoint(1380, 200));
|
||||
window4->move(QPoint(1580, 200));
|
||||
|
||||
// Switch to window to the left.
|
||||
workspace()->switchWindow(Workspace::DirectionWest);
|
||||
QVERIFY(window3->isActive());
|
||||
|
||||
// Switch to window to the left.
|
||||
workspace()->switchWindow(Workspace::DirectionWest);
|
||||
QVERIFY(window2->isActive());
|
||||
|
||||
// Switch to window to the left.
|
||||
workspace()->switchWindow(Workspace::DirectionWest);
|
||||
QVERIFY(window1->isActive());
|
||||
|
||||
// Switch to window to the left.
|
||||
workspace()->switchWindow(Workspace::DirectionWest);
|
||||
QVERIFY(window4->isActive());
|
||||
|
||||
// Destroy all windows.
|
||||
shellSurface1.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window1));
|
||||
shellSurface2.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window2));
|
||||
shellSurface3.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window3));
|
||||
shellSurface4.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window4));
|
||||
}
|
||||
|
||||
void ActivationTest::testSwitchToWindowToRight()
|
||||
{
|
||||
// This test verifies that "Switch to Window to the Right" shortcut works.
|
||||
|
||||
// Prepare the test environment.
|
||||
stackScreensHorizontally();
|
||||
|
||||
// Create several windows on the left screen.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface1(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.get()));
|
||||
Window *window1 = Test::renderAndWaitForShown(surface1.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window1);
|
||||
QVERIFY(window1->isActive());
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface2(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface2(Test::createXdgToplevelSurface(surface2.get()));
|
||||
Window *window2 = Test::renderAndWaitForShown(surface2.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window2);
|
||||
QVERIFY(window2->isActive());
|
||||
|
||||
window1->move(QPoint(300, 200));
|
||||
window2->move(QPoint(500, 200));
|
||||
|
||||
// Create several windows on the right screen.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface3(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface3(Test::createXdgToplevelSurface(surface3.get()));
|
||||
Window *window3 = Test::renderAndWaitForShown(surface3.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window3);
|
||||
QVERIFY(window3->isActive());
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface4(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface4(Test::createXdgToplevelSurface(surface4.get()));
|
||||
Window *window4 = Test::renderAndWaitForShown(surface4.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window4);
|
||||
QVERIFY(window4->isActive());
|
||||
|
||||
window3->move(QPoint(1380, 200));
|
||||
window4->move(QPoint(1580, 200));
|
||||
|
||||
// Switch to window to the right.
|
||||
workspace()->switchWindow(Workspace::DirectionEast);
|
||||
QVERIFY(window1->isActive());
|
||||
|
||||
// Switch to window to the right.
|
||||
workspace()->switchWindow(Workspace::DirectionEast);
|
||||
QVERIFY(window2->isActive());
|
||||
|
||||
// Switch to window to the right.
|
||||
workspace()->switchWindow(Workspace::DirectionEast);
|
||||
QVERIFY(window3->isActive());
|
||||
|
||||
// Switch to window to the right.
|
||||
workspace()->switchWindow(Workspace::DirectionEast);
|
||||
QVERIFY(window4->isActive());
|
||||
|
||||
// Destroy all windows.
|
||||
shellSurface1.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window1));
|
||||
shellSurface2.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window2));
|
||||
shellSurface3.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window3));
|
||||
shellSurface4.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window4));
|
||||
}
|
||||
|
||||
void ActivationTest::testSwitchToWindowAbove()
|
||||
{
|
||||
// This test verifies that "Switch to Window Above" shortcut works.
|
||||
|
||||
// Prepare the test environment.
|
||||
stackScreensVertically();
|
||||
|
||||
// Create several windows on the top screen.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface1(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.get()));
|
||||
Window *window1 = Test::renderAndWaitForShown(surface1.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window1);
|
||||
QVERIFY(window1->isActive());
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface2(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface2(Test::createXdgToplevelSurface(surface2.get()));
|
||||
Window *window2 = Test::renderAndWaitForShown(surface2.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window2);
|
||||
QVERIFY(window2->isActive());
|
||||
|
||||
window1->move(QPoint(200, 300));
|
||||
window2->move(QPoint(200, 500));
|
||||
|
||||
// Create several windows on the bottom screen.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface3(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface3(Test::createXdgToplevelSurface(surface3.get()));
|
||||
Window *window3 = Test::renderAndWaitForShown(surface3.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window3);
|
||||
QVERIFY(window3->isActive());
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface4(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface4(Test::createXdgToplevelSurface(surface4.get()));
|
||||
Window *window4 = Test::renderAndWaitForShown(surface4.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window4);
|
||||
QVERIFY(window4->isActive());
|
||||
|
||||
window3->move(QPoint(200, 1224));
|
||||
window4->move(QPoint(200, 1424));
|
||||
|
||||
// Switch to window above.
|
||||
workspace()->switchWindow(Workspace::DirectionNorth);
|
||||
QVERIFY(window3->isActive());
|
||||
|
||||
// Switch to window above.
|
||||
workspace()->switchWindow(Workspace::DirectionNorth);
|
||||
QVERIFY(window2->isActive());
|
||||
|
||||
// Switch to window above.
|
||||
workspace()->switchWindow(Workspace::DirectionNorth);
|
||||
QVERIFY(window1->isActive());
|
||||
|
||||
// Switch to window above.
|
||||
workspace()->switchWindow(Workspace::DirectionNorth);
|
||||
QVERIFY(window4->isActive());
|
||||
|
||||
// Destroy all windows.
|
||||
shellSurface1.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window1));
|
||||
shellSurface2.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window2));
|
||||
shellSurface3.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window3));
|
||||
shellSurface4.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window4));
|
||||
}
|
||||
|
||||
void ActivationTest::testSwitchToWindowBelow()
|
||||
{
|
||||
// This test verifies that "Switch to Window Bottom" shortcut works.
|
||||
|
||||
// Prepare the test environment.
|
||||
stackScreensVertically();
|
||||
|
||||
// Create several windows on the top screen.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface1(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.get()));
|
||||
Window *window1 = Test::renderAndWaitForShown(surface1.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window1);
|
||||
QVERIFY(window1->isActive());
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface2(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface2(Test::createXdgToplevelSurface(surface2.get()));
|
||||
Window *window2 = Test::renderAndWaitForShown(surface2.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window2);
|
||||
QVERIFY(window2->isActive());
|
||||
|
||||
window1->move(QPoint(200, 300));
|
||||
window2->move(QPoint(200, 500));
|
||||
|
||||
// Create several windows on the bottom screen.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface3(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface3(Test::createXdgToplevelSurface(surface3.get()));
|
||||
Window *window3 = Test::renderAndWaitForShown(surface3.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window3);
|
||||
QVERIFY(window3->isActive());
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface4(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface4(Test::createXdgToplevelSurface(surface4.get()));
|
||||
Window *window4 = Test::renderAndWaitForShown(surface4.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window4);
|
||||
QVERIFY(window4->isActive());
|
||||
|
||||
window3->move(QPoint(200, 1224));
|
||||
window4->move(QPoint(200, 1424));
|
||||
|
||||
// Switch to window below.
|
||||
workspace()->switchWindow(Workspace::DirectionSouth);
|
||||
QVERIFY(window1->isActive());
|
||||
|
||||
// Switch to window below.
|
||||
workspace()->switchWindow(Workspace::DirectionSouth);
|
||||
QVERIFY(window2->isActive());
|
||||
|
||||
// Switch to window below.
|
||||
workspace()->switchWindow(Workspace::DirectionSouth);
|
||||
QVERIFY(window3->isActive());
|
||||
|
||||
// Switch to window below.
|
||||
workspace()->switchWindow(Workspace::DirectionSouth);
|
||||
QVERIFY(window4->isActive());
|
||||
|
||||
// Destroy all windows.
|
||||
shellSurface1.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window1));
|
||||
shellSurface2.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window2));
|
||||
shellSurface3.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window3));
|
||||
shellSurface4.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window4));
|
||||
}
|
||||
|
||||
void ActivationTest::testSwitchToWindowMaximized()
|
||||
{
|
||||
// This test verifies that we switch to the top-most maximized window, i.e.
|
||||
// the one that user sees at the moment. See bug 411356.
|
||||
|
||||
// Prepare the test environment.
|
||||
stackScreensHorizontally();
|
||||
|
||||
// Create several maximized windows on the left screen.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface1(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.get()));
|
||||
QSignalSpy toplevelConfigureRequestedSpy1(shellSurface1.get(), &Test::XdgToplevel::configureRequested);
|
||||
QSignalSpy surfaceConfigureRequestedSpy1(shellSurface1->xdgSurface(), &Test::XdgSurface::configureRequested);
|
||||
Window *window1 = Test::renderAndWaitForShown(surface1.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window1);
|
||||
QVERIFY(window1->isActive());
|
||||
QVERIFY(surfaceConfigureRequestedSpy1.wait()); // Wait for the configure event with the activated state.
|
||||
workspace()->slotWindowMaximize();
|
||||
QVERIFY(surfaceConfigureRequestedSpy1.wait());
|
||||
QSignalSpy frameGeometryChangedSpy1(window1, &Window::frameGeometryChanged);
|
||||
shellSurface1->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy1.last().at(0).value<quint32>());
|
||||
Test::render(surface1.get(), toplevelConfigureRequestedSpy1.last().at(0).toSize(), Qt::red);
|
||||
QVERIFY(frameGeometryChangedSpy1.wait());
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface2(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface2(Test::createXdgToplevelSurface(surface2.get()));
|
||||
QSignalSpy toplevelConfigureRequestedSpy2(shellSurface2.get(), &Test::XdgToplevel::configureRequested);
|
||||
QSignalSpy surfaceConfigureRequestedSpy2(shellSurface2->xdgSurface(), &Test::XdgSurface::configureRequested);
|
||||
Window *window2 = Test::renderAndWaitForShown(surface2.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window2);
|
||||
QVERIFY(window2->isActive());
|
||||
QVERIFY(surfaceConfigureRequestedSpy2.wait()); // Wait for the configure event with the activated state.
|
||||
workspace()->slotWindowMaximize();
|
||||
QVERIFY(surfaceConfigureRequestedSpy2.wait());
|
||||
QSignalSpy frameGeometryChangedSpy2(window2, &Window::frameGeometryChanged);
|
||||
shellSurface2->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy2.last().at(0).value<quint32>());
|
||||
Test::render(surface2.get(), toplevelConfigureRequestedSpy2.last().at(0).toSize(), Qt::red);
|
||||
QVERIFY(frameGeometryChangedSpy2.wait());
|
||||
|
||||
const QList<Window *> stackingOrder = workspace()->stackingOrder();
|
||||
QVERIFY(stackingOrder.indexOf(window1) < stackingOrder.indexOf(window2));
|
||||
QCOMPARE(window1->maximizeMode(), MaximizeFull);
|
||||
QCOMPARE(window2->maximizeMode(), MaximizeFull);
|
||||
|
||||
// Create several windows on the right screen.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface3(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface3(Test::createXdgToplevelSurface(surface3.get()));
|
||||
Window *window3 = Test::renderAndWaitForShown(surface3.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window3);
|
||||
QVERIFY(window3->isActive());
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface4(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface4(Test::createXdgToplevelSurface(surface4.get()));
|
||||
Window *window4 = Test::renderAndWaitForShown(surface4.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window4);
|
||||
QVERIFY(window4->isActive());
|
||||
|
||||
window3->move(QPoint(1380, 200));
|
||||
window4->move(QPoint(1580, 200));
|
||||
|
||||
// Switch to window to the left.
|
||||
workspace()->switchWindow(Workspace::DirectionWest);
|
||||
QVERIFY(window3->isActive());
|
||||
|
||||
// Switch to window to the left.
|
||||
workspace()->switchWindow(Workspace::DirectionWest);
|
||||
QVERIFY(window2->isActive());
|
||||
|
||||
// Switch to window to the left.
|
||||
workspace()->switchWindow(Workspace::DirectionWest);
|
||||
QVERIFY(window4->isActive());
|
||||
|
||||
// Destroy all windows.
|
||||
shellSurface1.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window1));
|
||||
shellSurface2.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window2));
|
||||
shellSurface3.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window3));
|
||||
shellSurface4.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window4));
|
||||
}
|
||||
|
||||
void ActivationTest::testSwitchToWindowFullScreen()
|
||||
{
|
||||
// This test verifies that we switch to the top-most fullscreen window, i.e.
|
||||
// the one that user sees at the moment. See bug 411356.
|
||||
|
||||
// Prepare the test environment.
|
||||
stackScreensVertically();
|
||||
|
||||
// Create several maximized windows on the top screen.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface1(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.get()));
|
||||
QSignalSpy toplevelConfigureRequestedSpy1(shellSurface1.get(), &Test::XdgToplevel::configureRequested);
|
||||
QSignalSpy surfaceConfigureRequestedSpy1(shellSurface1->xdgSurface(), &Test::XdgSurface::configureRequested);
|
||||
Window *window1 = Test::renderAndWaitForShown(surface1.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window1);
|
||||
QVERIFY(window1->isActive());
|
||||
QVERIFY(surfaceConfigureRequestedSpy1.wait()); // Wait for the configure event with the activated state.
|
||||
workspace()->slotWindowFullScreen();
|
||||
QVERIFY(surfaceConfigureRequestedSpy1.wait());
|
||||
QSignalSpy frameGeometryChangedSpy1(window1, &Window::frameGeometryChanged);
|
||||
shellSurface1->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy1.last().at(0).value<quint32>());
|
||||
Test::render(surface1.get(), toplevelConfigureRequestedSpy1.last().at(0).toSize(), Qt::red);
|
||||
QVERIFY(frameGeometryChangedSpy1.wait());
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface2(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface2(Test::createXdgToplevelSurface(surface2.get()));
|
||||
QSignalSpy toplevelConfigureRequestedSpy2(shellSurface2.get(), &Test::XdgToplevel::configureRequested);
|
||||
QSignalSpy surfaceConfigureRequestedSpy2(shellSurface2->xdgSurface(), &Test::XdgSurface::configureRequested);
|
||||
Window *window2 = Test::renderAndWaitForShown(surface2.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window2);
|
||||
QVERIFY(window2->isActive());
|
||||
QVERIFY(surfaceConfigureRequestedSpy2.wait()); // Wait for the configure event with the activated state.
|
||||
workspace()->slotWindowFullScreen();
|
||||
QVERIFY(surfaceConfigureRequestedSpy2.wait());
|
||||
QSignalSpy frameGeometryChangedSpy2(window2, &Window::frameGeometryChanged);
|
||||
shellSurface2->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy2.last().at(0).value<quint32>());
|
||||
Test::render(surface2.get(), toplevelConfigureRequestedSpy2.last().at(0).toSize(), Qt::red);
|
||||
QVERIFY(frameGeometryChangedSpy2.wait());
|
||||
|
||||
const QList<Window *> stackingOrder = workspace()->stackingOrder();
|
||||
QVERIFY(stackingOrder.indexOf(window1) < stackingOrder.indexOf(window2));
|
||||
QVERIFY(window1->isFullScreen());
|
||||
QVERIFY(window2->isFullScreen());
|
||||
|
||||
// Create several windows on the bottom screen.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface3(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface3(Test::createXdgToplevelSurface(surface3.get()));
|
||||
Window *window3 = Test::renderAndWaitForShown(surface3.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window3);
|
||||
QVERIFY(window3->isActive());
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface4(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface4(Test::createXdgToplevelSurface(surface4.get()));
|
||||
Window *window4 = Test::renderAndWaitForShown(surface4.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window4);
|
||||
QVERIFY(window4->isActive());
|
||||
|
||||
window3->move(QPoint(200, 1224));
|
||||
window4->move(QPoint(200, 1424));
|
||||
|
||||
// Switch to window above.
|
||||
workspace()->switchWindow(Workspace::DirectionNorth);
|
||||
QVERIFY(window3->isActive());
|
||||
|
||||
// Switch to window above.
|
||||
workspace()->switchWindow(Workspace::DirectionNorth);
|
||||
QVERIFY(window2->isActive());
|
||||
|
||||
// Switch to window above.
|
||||
workspace()->switchWindow(Workspace::DirectionNorth);
|
||||
QVERIFY(window4->isActive());
|
||||
|
||||
// Destroy all windows.
|
||||
shellSurface1.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window1));
|
||||
shellSurface2.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window2));
|
||||
shellSurface3.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window3));
|
||||
shellSurface4.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window4));
|
||||
}
|
||||
|
||||
void ActivationTest::stackScreensHorizontally()
|
||||
{
|
||||
// Process pending wl_output bind requests before destroying all outputs.
|
||||
QTest::qWait(1);
|
||||
|
||||
const QList<QRect> screenGeometries{
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
};
|
||||
Test::setOutputConfig(screenGeometries);
|
||||
}
|
||||
|
||||
void ActivationTest::stackScreensVertically()
|
||||
{
|
||||
// Process pending wl_output bind requests before destroying all outputs.
|
||||
QTest::qWait(1);
|
||||
|
||||
const QList<QRect> screenGeometries{
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(0, 1024, 1280, 1024),
|
||||
};
|
||||
Test::setOutputConfig(screenGeometries);
|
||||
}
|
||||
|
||||
static X11Window *createX11Window(xcb_connection_t *connection, const QRect &geometry, std::function<void(xcb_window_t)> setup = {})
|
||||
{
|
||||
xcb_window_t windowId = xcb_generate_id(connection);
|
||||
xcb_create_window(connection, XCB_COPY_FROM_PARENT, windowId, rootWindow(),
|
||||
geometry.x(),
|
||||
geometry.y(),
|
||||
geometry.width(),
|
||||
geometry.height(),
|
||||
0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, 0, nullptr);
|
||||
|
||||
xcb_size_hints_t hints;
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
xcb_icccm_size_hints_set_position(&hints, 1, geometry.x(), geometry.y());
|
||||
xcb_icccm_size_hints_set_size(&hints, 1, geometry.width(), geometry.height());
|
||||
xcb_icccm_set_wm_normal_hints(connection, windowId, &hints);
|
||||
|
||||
if (setup) {
|
||||
setup(windowId);
|
||||
}
|
||||
|
||||
xcb_map_window(connection, windowId);
|
||||
xcb_flush(connection);
|
||||
|
||||
QSignalSpy windowCreatedSpy(workspace(), &Workspace::windowAdded);
|
||||
if (!windowCreatedSpy.wait()) {
|
||||
return nullptr;
|
||||
}
|
||||
return windowCreatedSpy.last().first().value<X11Window *>();
|
||||
}
|
||||
|
||||
void ActivationTest::testActiveFullscreen()
|
||||
{
|
||||
// Tests that an active X11 fullscreen window gets removed from the active layer
|
||||
// when activating a Wayland window, even if there's a pending activation request
|
||||
// for the X11 window
|
||||
Test::setOutputConfig({QRect(0, 0, 1280, 1024)});
|
||||
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
X11Window *x11Window = createX11Window(c.get(), QRect(0, 0, 100, 200));
|
||||
|
||||
// make it fullscreen
|
||||
x11Window->setFullScreen(true);
|
||||
QVERIFY(x11Window->isFullScreen());
|
||||
QCOMPARE(x11Window->layer(), Layer::ActiveLayer);
|
||||
|
||||
// now, activate it again
|
||||
workspace()->activateWindow(x11Window);
|
||||
|
||||
// now, create and activate a Wayland window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
|
||||
auto waylandWindow = Test::renderAndWaitForShown(surface.get(), QSize(500, 300), Qt::blue);
|
||||
QVERIFY(waylandWindow);
|
||||
|
||||
// the Wayland window should become active
|
||||
// and the X11 window should not be in the active layer anymore
|
||||
QSignalSpy stackingOrder(workspace(), &Workspace::stackingOrderChanged);
|
||||
workspace()->activateWindow(waylandWindow);
|
||||
QCOMPARE(workspace()->activeWindow(), waylandWindow);
|
||||
QCOMPARE(x11Window->layer(), Layer::NormalLayer);
|
||||
}
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(KWin::ActivationTest)
|
||||
#include "activation_test.moc"
|
||||
@@ -1,136 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "activities.h"
|
||||
#include "core/output.h"
|
||||
#include "pointer_input.h"
|
||||
#include "utils/xcbutils.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
#include "x11window.h"
|
||||
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusMessage>
|
||||
#include <QDBusPendingCall>
|
||||
|
||||
#include <netwm.h>
|
||||
#include <xcb/xcb_icccm.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_kwin_activities-0");
|
||||
|
||||
class ActivitiesTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
void testSetOnActivitiesValidates();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
void ActivitiesTest::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::Window *>();
|
||||
QVERIFY(waylandServer()->init(s_socketName));
|
||||
Test::setOutputConfig({
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
});
|
||||
|
||||
kwinApp()->setUseKActivities(true);
|
||||
kwinApp()->start();
|
||||
const auto outputs = workspace()->outputs();
|
||||
QCOMPARE(outputs.count(), 2);
|
||||
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
|
||||
setenv("QT_QPA_PLATFORM", "wayland", true);
|
||||
}
|
||||
|
||||
void ActivitiesTest::cleanupTestCase()
|
||||
{
|
||||
// terminate any still running kactivitymanagerd
|
||||
QDBusConnection::sessionBus().asyncCall(QDBusMessage::createMethodCall(
|
||||
QStringLiteral("org.kde.ActivityManager"),
|
||||
QStringLiteral("/ActivityManager"),
|
||||
QStringLiteral("org.qtproject.Qt.QCoreApplication"),
|
||||
QStringLiteral("quit")));
|
||||
}
|
||||
|
||||
void ActivitiesTest::init()
|
||||
{
|
||||
workspace()->setActiveOutput(QPoint(640, 512));
|
||||
input()->pointer()->warp(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void ActivitiesTest::cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
void ActivitiesTest::testSetOnActivitiesValidates()
|
||||
{
|
||||
// this test verifies that windows can't be placed on activities that don't exist
|
||||
// create an xcb window
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
const QRect windowGeometry(0, 0, 100, 200);
|
||||
|
||||
auto cookie = xcb_create_window_checked(c.get(), 0, windowId, rootWindow(),
|
||||
windowGeometry.x(),
|
||||
windowGeometry.y(),
|
||||
windowGeometry.width(),
|
||||
windowGeometry.height(),
|
||||
0, XCB_WINDOW_CLASS_INPUT_OUTPUT, 0, 0, nullptr);
|
||||
QVERIFY(!xcb_request_check(c.get(), cookie));
|
||||
xcb_size_hints_t hints;
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
xcb_icccm_size_hints_set_position(&hints, 1, windowGeometry.x(), windowGeometry.y());
|
||||
xcb_icccm_size_hints_set_size(&hints, 1, windowGeometry.width(), windowGeometry.height());
|
||||
xcb_icccm_set_wm_normal_hints(c.get(), windowId, &hints);
|
||||
xcb_map_window(c.get(), windowId);
|
||||
xcb_flush(c.get());
|
||||
|
||||
// we should get a window for it
|
||||
QSignalSpy windowCreatedSpy(workspace(), &Workspace::windowAdded);
|
||||
QVERIFY(windowCreatedSpy.wait());
|
||||
X11Window *window = windowCreatedSpy.first().first().value<X11Window *>();
|
||||
QVERIFY(window);
|
||||
QCOMPARE(window->window(), windowId);
|
||||
QVERIFY(window->isDecorated());
|
||||
|
||||
// verify the test machine doesn't have the following activities used
|
||||
QVERIFY(!Workspace::self()->activities()->all().contains(QStringLiteral("foo")));
|
||||
QVERIFY(!Workspace::self()->activities()->all().contains(QStringLiteral("bar")));
|
||||
|
||||
window->setOnActivities(QStringList{QStringLiteral("foo"), QStringLiteral("bar")});
|
||||
QVERIFY(!window->activities().contains(QLatin1String("foo")));
|
||||
QVERIFY(!window->activities().contains(QLatin1String("bar")));
|
||||
|
||||
// and destroy the window again
|
||||
xcb_unmap_window(c.get(), windowId);
|
||||
xcb_destroy_window(c.get(), windowId);
|
||||
xcb_flush(c.get());
|
||||
c.reset();
|
||||
|
||||
QSignalSpy windowClosedSpy(window, &X11Window::closed);
|
||||
QVERIFY(windowClosedSpy.wait());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(KWin::ActivitiesTest)
|
||||
#include "activities_test.moc"
|
||||
@@ -1,125 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
SPDX-FileCopyrightText: 2023 Nicolas Fella <nicolas.fella@gmx.de>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "keyboard_input.h"
|
||||
#include "pluginmanager.h"
|
||||
#include "pointer_input.h"
|
||||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include <KWayland/Client/keyboard.h>
|
||||
#include <KWayland/Client/seat.h>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_kwin_bounce_keys-0");
|
||||
|
||||
class BounceKeysTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
void testBounce();
|
||||
};
|
||||
|
||||
void BounceKeysTest::initTestCase()
|
||||
{
|
||||
KConfig kaccessConfig("kaccessrc");
|
||||
kaccessConfig.group(QStringLiteral("Keyboard")).writeEntry("BounceKeys", true);
|
||||
kaccessConfig.group(QStringLiteral("Keyboard")).writeEntry("BounceKeysDelay", 200);
|
||||
kaccessConfig.sync();
|
||||
|
||||
qRegisterMetaType<KWin::Window *>();
|
||||
QVERIFY(waylandServer()->init(s_socketName));
|
||||
Test::setOutputConfig({
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
});
|
||||
|
||||
qputenv("XKB_DEFAULT_RULES", "evdev");
|
||||
|
||||
kwinApp()->start();
|
||||
}
|
||||
|
||||
void BounceKeysTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat));
|
||||
QVERIFY(Test::waitForWaylandKeyboard());
|
||||
}
|
||||
|
||||
void BounceKeysTest::cleanup()
|
||||
{
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void BounceKeysTest::testBounce()
|
||||
{
|
||||
std::unique_ptr<KWayland::Client::Keyboard> keyboard(Test::waylandSeat()->createKeyboard());
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
||||
QVERIFY(surface != nullptr);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
|
||||
QVERIFY(shellSurface != nullptr);
|
||||
Window *waylandWindow = Test::renderAndWaitForShown(surface.get(), QSize(10, 10), Qt::blue);
|
||||
QVERIFY(waylandWindow);
|
||||
|
||||
QVERIFY(keyboard);
|
||||
QSignalSpy enteredSpy(keyboard.get(), &KWayland::Client::Keyboard::entered);
|
||||
QVERIFY(enteredSpy.wait());
|
||||
|
||||
QSignalSpy keySpy(keyboard.get(), &KWayland::Client::Keyboard::keyChanged);
|
||||
QVERIFY(keySpy.isValid());
|
||||
|
||||
quint32 timestamp = 0;
|
||||
|
||||
// Press a key, verify that it goes through
|
||||
Test::keyboardKeyPressed(KEY_A, timestamp);
|
||||
QVERIFY(keySpy.wait());
|
||||
QCOMPARE(keySpy.first()[0], KEY_A);
|
||||
QCOMPARE(keySpy.first()[1].value<KWayland::Client::Keyboard::KeyState>(), KWayland::Client::Keyboard::KeyState::Pressed);
|
||||
keySpy.clear();
|
||||
|
||||
Test::keyboardKeyReleased(KEY_A, timestamp++);
|
||||
QVERIFY(keySpy.wait());
|
||||
QCOMPARE(keySpy.first()[0], KEY_A);
|
||||
QCOMPARE(keySpy.first()[1].value<KWayland::Client::Keyboard::KeyState>(), KWayland::Client::Keyboard::KeyState::Released);
|
||||
keySpy.clear();
|
||||
|
||||
// Press it again within the bounce interval, verify that it does *not* go through
|
||||
timestamp += 100;
|
||||
Test::keyboardKeyPressed(KEY_A, timestamp);
|
||||
QVERIFY(!keySpy.wait(100));
|
||||
keySpy.clear();
|
||||
|
||||
// Press it again after the bouce interval, verify that it does go through
|
||||
timestamp += 1000;
|
||||
Test::keyboardKeyPressed(KEY_A, timestamp);
|
||||
QVERIFY(keySpy.wait());
|
||||
QCOMPARE(keySpy.first()[0], KEY_A);
|
||||
QCOMPARE(keySpy.first()[1].value<KWayland::Client::Keyboard::KeyState>(), KWayland::Client::Keyboard::KeyState::Pressed);
|
||||
keySpy.clear();
|
||||
|
||||
Test::keyboardKeyReleased(KEY_A, timestamp++);
|
||||
QVERIFY(keySpy.wait());
|
||||
QCOMPARE(keySpy.first()[0], KEY_A);
|
||||
QCOMPARE(keySpy.first()[1].value<KWayland::Client::Keyboard::KeyState>(), KWayland::Client::Keyboard::KeyState::Released);
|
||||
keySpy.clear();
|
||||
}
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(KWin::BounceKeysTest)
|
||||
#include "bounce_keys_test.moc"
|
||||
@@ -1,371 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2024 Aleix Pol Gonzalez <aleixpol@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "pluginmanager.h"
|
||||
#include "pointer_input.h"
|
||||
#include "tablet_input.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include <KWayland/Client/keyboard.h>
|
||||
#include <KWayland/Client/pointer.h>
|
||||
#include <KWayland/Client/seat.h>
|
||||
#include <linux/input-event-codes.h>
|
||||
|
||||
using namespace KWin;
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_kwin_buttonrebind-0");
|
||||
static const QString s_pluginName = QStringLiteral("buttonsrebind");
|
||||
|
||||
class TestButtonRebind : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void init();
|
||||
void cleanup();
|
||||
void initTestCase();
|
||||
|
||||
void testKey_data();
|
||||
void testKey();
|
||||
|
||||
void testMouse_data();
|
||||
void testMouse();
|
||||
|
||||
void testMouseKeyboardMod_data();
|
||||
void testMouseKeyboardMod();
|
||||
|
||||
void testDisabled();
|
||||
|
||||
// NOTE: Mouse buttons are not tested because those are used in the other tests
|
||||
void testBindingTabletPad();
|
||||
void testBindingTabletTool();
|
||||
|
||||
void testMouseTabletCursorSync();
|
||||
|
||||
private:
|
||||
quint32 timestamp = 1;
|
||||
};
|
||||
|
||||
void TestButtonRebind::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat));
|
||||
QVERIFY(Test::waitForWaylandPointer());
|
||||
}
|
||||
|
||||
void TestButtonRebind::cleanup()
|
||||
{
|
||||
Test::destroyWaylandConnection();
|
||||
QVERIFY(QFile::remove(QStandardPaths::locate(QStandardPaths::ConfigLocation, QStringLiteral("kcminputrc"))));
|
||||
}
|
||||
|
||||
void TestButtonRebind::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::Window *>();
|
||||
QVERIFY(waylandServer()->init(s_socketName));
|
||||
Test::setOutputConfig({
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
});
|
||||
kwinApp()->start();
|
||||
}
|
||||
|
||||
void TestButtonRebind::testKey_data()
|
||||
{
|
||||
QTest::addColumn<QKeySequence>("boundKeys");
|
||||
QTest::addColumn<QList<quint32>>("expectedKeys");
|
||||
|
||||
QTest::newRow("single key") << QKeySequence(Qt::Key_A) << QList<quint32>{KEY_A};
|
||||
QTest::newRow("single modifier") << QKeySequence(Qt::Key_Control) << QList<quint32>{KEY_LEFTCTRL};
|
||||
QTest::newRow("single modifier plus key") << QKeySequence(Qt::ControlModifier | Qt::Key_N) << QList<quint32>{KEY_LEFTCTRL, KEY_N};
|
||||
QTest::newRow("multiple modifiers plus key") << QKeySequence(Qt::ControlModifier | Qt::MetaModifier | Qt::Key_Y) << QList<quint32>{KEY_LEFTCTRL, KEY_LEFTMETA, KEY_Y};
|
||||
QTest::newRow("delete") << QKeySequence(Qt::Key_Delete) << QList<quint32>{KEY_DELETE};
|
||||
QTest::newRow("keypad delete") << QKeySequence(Qt::KeypadModifier | Qt::Key_Delete) << QList<quint32>{KEY_KPDOT};
|
||||
QTest::newRow("keypad enter") << QKeySequence(Qt::KeypadModifier | Qt::Key_Enter) << QList<quint32>{KEY_KPENTER};
|
||||
QTest::newRow("exclamation mark") << QKeySequence(Qt::Key_Exclam) << QList<quint32>{KEY_LEFTSHIFT, KEY_1};
|
||||
}
|
||||
|
||||
void TestButtonRebind::testKey()
|
||||
{
|
||||
KConfigGroup buttonGroup = KSharedConfig::openConfig(QStringLiteral("kcminputrc"))->group(QStringLiteral("ButtonRebinds")).group(QStringLiteral("Mouse"));
|
||||
QFETCH(QKeySequence, boundKeys);
|
||||
buttonGroup.writeEntry("ExtraButton7", QStringList{"Key", boundKeys.toString(QKeySequence::PortableText)}, KConfig::Notify);
|
||||
buttonGroup.sync();
|
||||
|
||||
kwinApp()->pluginManager()->unloadPlugin(s_pluginName);
|
||||
kwinApp()->pluginManager()->loadPlugin(s_pluginName);
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
|
||||
std::unique_ptr<KWayland::Client::Keyboard> keyboard(Test::waylandSeat()->createKeyboard());
|
||||
QSignalSpy enteredSpy(keyboard.get(), &KWayland::Client::Keyboard::entered);
|
||||
QSignalSpy keyChangedSpy(keyboard.get(), &KWayland::Client::Keyboard::keyChanged);
|
||||
QVERIFY(enteredSpy.wait());
|
||||
|
||||
// 0x119 is Qt::ExtraButton7
|
||||
Test::pointerButtonPressed(0x119, timestamp++);
|
||||
|
||||
QVERIFY(keyChangedSpy.wait());
|
||||
QFETCH(QList<quint32>, expectedKeys);
|
||||
QCOMPARE(keyChangedSpy.count(), expectedKeys.count());
|
||||
for (int i = 0; i < keyChangedSpy.count(); i++) {
|
||||
QCOMPARE(keyChangedSpy.at(i).at(0).value<quint32>(), expectedKeys.at(i));
|
||||
QCOMPARE(keyChangedSpy.at(i).at(1).value<KWayland::Client::Keyboard::KeyState>(), KWayland::Client::Keyboard::KeyState::Pressed);
|
||||
}
|
||||
Test::pointerButtonReleased(0x119, timestamp++);
|
||||
}
|
||||
|
||||
void TestButtonRebind::testMouse_data()
|
||||
{
|
||||
QTest::addColumn<int>("mouseButton");
|
||||
|
||||
QTest::newRow("left button") << BTN_LEFT;
|
||||
QTest::newRow("middle button") << BTN_MIDDLE;
|
||||
QTest::newRow("right button") << BTN_RIGHT;
|
||||
}
|
||||
|
||||
void TestButtonRebind::testMouse()
|
||||
{
|
||||
KConfigGroup buttonGroup = KSharedConfig::openConfig(QStringLiteral("kcminputrc"))->group(QStringLiteral("ButtonRebinds")).group(QStringLiteral("Mouse"));
|
||||
QFETCH(int, mouseButton);
|
||||
buttonGroup.writeEntry("ExtraButton7", QStringList{"MouseButton", QString::number(mouseButton)}, KConfig::Notify);
|
||||
buttonGroup.sync();
|
||||
|
||||
kwinApp()->pluginManager()->unloadPlugin(s_pluginName);
|
||||
kwinApp()->pluginManager()->loadPlugin(s_pluginName);
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
|
||||
std::unique_ptr<KWayland::Client::Pointer> pointer(Test::waylandSeat()->createPointer());
|
||||
QSignalSpy enteredSpy(pointer.get(), &KWayland::Client::Pointer::entered);
|
||||
QSignalSpy buttonChangedSpy(pointer.get(), &KWayland::Client::Pointer::buttonStateChanged);
|
||||
|
||||
const QRectF startGeometry = window->frameGeometry();
|
||||
input()->pointer()->warp(startGeometry.center());
|
||||
|
||||
QVERIFY(enteredSpy.wait());
|
||||
|
||||
// 0x119 is Qt::ExtraButton7
|
||||
Test::pointerButtonPressed(0x119, timestamp++);
|
||||
|
||||
QVERIFY(buttonChangedSpy.wait());
|
||||
|
||||
QCOMPARE(buttonChangedSpy.count(), 1);
|
||||
Q_ASSERT(buttonChangedSpy.at(0).at(2).value<qint32>() == mouseButton);
|
||||
QCOMPARE(buttonChangedSpy.at(0).at(2).value<qint32>(), mouseButton);
|
||||
|
||||
Test::pointerButtonReleased(0x119, timestamp++);
|
||||
}
|
||||
|
||||
void TestButtonRebind::testMouseKeyboardMod_data()
|
||||
{
|
||||
QTest::addColumn<Qt::KeyboardModifiers>("modifiers");
|
||||
QTest::addColumn<QList<quint32>>("expectedKeys");
|
||||
|
||||
QTest::newRow("single ctrl") << Qt::KeyboardModifiers(Qt::ControlModifier) << QList<quint32>{KEY_LEFTCTRL};
|
||||
QTest::newRow("single alt") << Qt::KeyboardModifiers(Qt::AltModifier) << QList<quint32>{KEY_LEFTALT};
|
||||
QTest::newRow("single shift") << Qt::KeyboardModifiers(Qt::ShiftModifier) << QList<quint32>{KEY_LEFTSHIFT};
|
||||
|
||||
// We have to test Meta with another key, because it will most likely trigger KWin to do some window operation.
|
||||
QTest::newRow("meta + alt") << Qt::KeyboardModifiers(Qt::MetaModifier | Qt::AltModifier) << QList<quint32>{KEY_LEFTALT, KEY_LEFTMETA};
|
||||
|
||||
QTest::newRow("ctrl + alt + shift + meta") << Qt::KeyboardModifiers(Qt::ControlModifier | Qt::AltModifier | Qt::ShiftModifier | Qt::MetaModifier) << QList<quint32>{KEY_LEFTSHIFT, KEY_LEFTCTRL, KEY_LEFTALT, KEY_LEFTMETA};
|
||||
}
|
||||
|
||||
void TestButtonRebind::testMouseKeyboardMod()
|
||||
{
|
||||
QFETCH(Qt::KeyboardModifiers, modifiers);
|
||||
|
||||
KConfigGroup buttonGroup = KSharedConfig::openConfig(QStringLiteral("kcminputrc"))->group(QStringLiteral("ButtonRebinds")).group(QStringLiteral("TabletTool")).group(QStringLiteral("Virtual Tablet Tool 1"));
|
||||
buttonGroup.writeEntry(QString::number(BTN_STYLUS), QStringList{"MouseButton", QString::number(BTN_LEFT), QString::number(modifiers.toInt())}, KConfig::Notify);
|
||||
buttonGroup.sync();
|
||||
|
||||
kwinApp()->pluginManager()->unloadPlugin(s_pluginName);
|
||||
kwinApp()->pluginManager()->loadPlugin(s_pluginName);
|
||||
|
||||
std::unique_ptr<KWayland::Client::Keyboard> keyboard(Test::waylandSeat()->createKeyboard());
|
||||
QSignalSpy keyboardEnteredSpy(keyboard.get(), &KWayland::Client::Keyboard::entered);
|
||||
QSignalSpy keyboardKeyChangedSpy(keyboard.get(), &KWayland::Client::Keyboard::keyChanged);
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(keyboardEnteredSpy.wait());
|
||||
|
||||
std::unique_ptr<KWayland::Client::Pointer> pointer(Test::waylandSeat()->createPointer());
|
||||
QSignalSpy pointerEnteredSpy(pointer.get(), &KWayland::Client::Pointer::entered);
|
||||
QSignalSpy pointerButtonChangedSpy(pointer.get(), &KWayland::Client::Pointer::buttonStateChanged);
|
||||
|
||||
const QRectF startGeometry = window->frameGeometry();
|
||||
|
||||
input()->pointer()->warp(startGeometry.center());
|
||||
QVERIFY(pointerEnteredSpy.wait());
|
||||
|
||||
// Send the tablet button event so it can be processed by the filter
|
||||
Test::tabletToolButtonPressed(BTN_STYLUS, timestamp++);
|
||||
|
||||
// The keyboard modifier is sent first
|
||||
QVERIFY(keyboardKeyChangedSpy.wait());
|
||||
|
||||
QFETCH(QList<quint32>, expectedKeys);
|
||||
QCOMPARE(keyboardKeyChangedSpy.count(), expectedKeys.count());
|
||||
for (int i = 0; i < keyboardKeyChangedSpy.count(); i++) {
|
||||
QCOMPARE(keyboardKeyChangedSpy.at(i).at(0).value<quint32>(), expectedKeys.at(i));
|
||||
QCOMPARE(keyboardKeyChangedSpy.at(i).at(1).value<KWayland::Client::Keyboard::KeyState>(), KWayland::Client::Keyboard::KeyState::Pressed);
|
||||
}
|
||||
|
||||
// Then the mouse button is
|
||||
QCOMPARE(pointerButtonChangedSpy.count(), 1);
|
||||
QCOMPARE(pointerButtonChangedSpy.at(0).at(2).value<qint32>(), BTN_LEFT);
|
||||
|
||||
Test::tabletToolButtonReleased(BTN_STYLUS, timestamp++);
|
||||
}
|
||||
|
||||
void TestButtonRebind::testDisabled()
|
||||
{
|
||||
KConfigGroup buttonGroup = KSharedConfig::openConfig(QStringLiteral("kcminputrc"))->group(QStringLiteral("ButtonRebinds")).group(QStringLiteral("Mouse"));
|
||||
buttonGroup.writeEntry("ExtraButton7", QStringList{"Disabled"}, KConfig::Notify);
|
||||
buttonGroup.sync();
|
||||
|
||||
kwinApp()->pluginManager()->unloadPlugin(s_pluginName);
|
||||
kwinApp()->pluginManager()->loadPlugin(s_pluginName);
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
|
||||
std::unique_ptr<KWayland::Client::Pointer> pointer(Test::waylandSeat()->createPointer());
|
||||
QSignalSpy enteredSpy(pointer.get(), &KWayland::Client::Pointer::entered);
|
||||
QSignalSpy buttonChangedSpy(pointer.get(), &KWayland::Client::Pointer::buttonStateChanged);
|
||||
|
||||
const QRectF startGeometry = window->frameGeometry();
|
||||
input()->pointer()->warp(startGeometry.center());
|
||||
|
||||
QVERIFY(enteredSpy.wait());
|
||||
|
||||
// 0x119 is Qt::ExtraButton7
|
||||
Test::pointerButtonPressed(0x119, timestamp++);
|
||||
|
||||
// Qt::ExtraButton7 should not have been emitted if this button is disabled
|
||||
QVERIFY(!buttonChangedSpy.wait(std::chrono::milliseconds(100)));
|
||||
QCOMPARE(buttonChangedSpy.count(), 0);
|
||||
|
||||
Test::pointerButtonReleased(0x119, timestamp++);
|
||||
}
|
||||
|
||||
void TestButtonRebind::testBindingTabletPad()
|
||||
{
|
||||
const QKeySequence sequence(Qt::Key_A);
|
||||
|
||||
KConfigGroup buttonGroup = KSharedConfig::openConfig(QStringLiteral("kcminputrc"))->group(QStringLiteral("ButtonRebinds")).group(QStringLiteral("Tablet")).group(QStringLiteral("Virtual Tablet Pad 1"));
|
||||
buttonGroup.writeEntry("1", QStringList{"Key", sequence.toString(QKeySequence::PortableText)}, KConfig::Notify);
|
||||
buttonGroup.sync();
|
||||
|
||||
kwinApp()->pluginManager()->unloadPlugin(s_pluginName);
|
||||
kwinApp()->pluginManager()->loadPlugin(s_pluginName);
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
|
||||
std::unique_ptr<KWayland::Client::Keyboard> keyboard(Test::waylandSeat()->createKeyboard());
|
||||
QSignalSpy enteredSpy(keyboard.get(), &KWayland::Client::Keyboard::entered);
|
||||
QSignalSpy keyChangedSpy(keyboard.get(), &KWayland::Client::Keyboard::keyChanged);
|
||||
QVERIFY(enteredSpy.wait());
|
||||
|
||||
Test::tabletPadButtonPressed(1, timestamp++);
|
||||
|
||||
QVERIFY(keyChangedSpy.wait());
|
||||
QCOMPARE(keyChangedSpy.count(), 1);
|
||||
QCOMPARE(keyChangedSpy.at(0).at(0), KEY_A);
|
||||
|
||||
Test::tabletPadButtonReleased(1, timestamp++);
|
||||
}
|
||||
|
||||
void TestButtonRebind::testBindingTabletTool()
|
||||
{
|
||||
const QKeySequence sequence(Qt::Key_A);
|
||||
|
||||
KConfigGroup buttonGroup = KSharedConfig::openConfig(QStringLiteral("kcminputrc"))->group(QStringLiteral("ButtonRebinds")).group(QStringLiteral("TabletTool")).group(QStringLiteral("Virtual Tablet Tool 1"));
|
||||
buttonGroup.writeEntry(QString::number(BTN_STYLUS), QStringList{"Key", sequence.toString(QKeySequence::PortableText)}, KConfig::Notify);
|
||||
buttonGroup.sync();
|
||||
|
||||
kwinApp()->pluginManager()->unloadPlugin(s_pluginName);
|
||||
kwinApp()->pluginManager()->loadPlugin(s_pluginName);
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
|
||||
std::unique_ptr<KWayland::Client::Keyboard> keyboard(Test::waylandSeat()->createKeyboard());
|
||||
QSignalSpy enteredSpy(keyboard.get(), &KWayland::Client::Keyboard::entered);
|
||||
QSignalSpy keyChangedSpy(keyboard.get(), &KWayland::Client::Keyboard::keyChanged);
|
||||
QVERIFY(enteredSpy.wait());
|
||||
|
||||
const QRectF startGeometry = window->frameGeometry();
|
||||
Test::tabletToolProximityEvent(startGeometry.center(), 1.0, 0, 0, 0, 0, false, false, timestamp++);
|
||||
|
||||
Test::tabletToolButtonPressed(BTN_STYLUS, timestamp++);
|
||||
|
||||
QVERIFY(keyChangedSpy.wait());
|
||||
QCOMPARE(keyChangedSpy.count(), 1);
|
||||
QCOMPARE(keyChangedSpy.at(0).at(0), KEY_A);
|
||||
|
||||
Test::tabletToolButtonReleased(BTN_STYLUS, timestamp++);
|
||||
}
|
||||
|
||||
void TestButtonRebind::testMouseTabletCursorSync()
|
||||
{
|
||||
KConfigGroup buttonGroup = KSharedConfig::openConfig(QStringLiteral("kcminputrc"))->group(QStringLiteral("ButtonRebinds")).group(QStringLiteral("TabletTool")).group(QStringLiteral("Virtual Tablet Tool 1"));
|
||||
buttonGroup.writeEntry(QString::number(BTN_STYLUS), QStringList{"MouseButton", QString::number(BTN_LEFT)}, KConfig::Notify);
|
||||
buttonGroup.sync();
|
||||
|
||||
kwinApp()->pluginManager()->unloadPlugin(s_pluginName);
|
||||
kwinApp()->pluginManager()->loadPlugin(s_pluginName);
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
|
||||
std::unique_ptr<KWayland::Client::Pointer> pointer(Test::waylandSeat()->createPointer());
|
||||
QSignalSpy enteredSpy(pointer.get(), &KWayland::Client::Pointer::entered);
|
||||
QSignalSpy buttonChangedSpy(pointer.get(), &KWayland::Client::Pointer::buttonStateChanged);
|
||||
|
||||
const QRectF startGeometry = window->frameGeometry();
|
||||
|
||||
// Move the mouse cursor to (25, 25)
|
||||
input()->pointer()->warp(startGeometry.topLeft() + QPointF{25.f, 25.5f});
|
||||
QVERIFY(enteredSpy.wait());
|
||||
|
||||
// Move the tablet cursor to (10,10)
|
||||
Test::tabletToolProximityEvent(startGeometry.topLeft() + QPointF{10.f, 10.f}, 1.0, 0, 0, 0, 0, false, false, timestamp++);
|
||||
|
||||
// Verify they are not starting in the same place
|
||||
QVERIFY(input()->pointer()->pos() != input()->tablet()->position());
|
||||
|
||||
// Send the tablet button event so it can be processed by the filter
|
||||
Test::tabletToolButtonPressed(BTN_STYLUS, timestamp++);
|
||||
|
||||
QVERIFY(buttonChangedSpy.wait());
|
||||
QCOMPARE(buttonChangedSpy.count(), 1);
|
||||
QCOMPARE(buttonChangedSpy.at(0).at(2).value<qint32>(), BTN_LEFT);
|
||||
|
||||
Test::tabletToolButtonReleased(BTN_STYLUS, timestamp++);
|
||||
|
||||
// Verify that by using the mouse button binding, the mouse cursor was moved to the tablet cursor position
|
||||
QVERIFY(input()->pointer()->pos() == input()->tablet()->position());
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(TestButtonRebind)
|
||||
#include "buttonrebind_test.moc"
|
||||
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
effects.windowAdded.connect(function(w) {
|
||||
w.fadeAnimation = effect.animate(w, Effect.Opacity, 100, 1.0, 0.0);
|
||||
});
|
||||
effect.animationEnded.connect(function(w) {
|
||||
cancel(w.fadeAnimation);
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Name=An example application
|
||||
Icon=kwin
|
||||
@@ -1,14 +0,0 @@
|
||||
[$Version]
|
||||
update_info=kwinrules.upd:replace-placement-string-to-enum,kwinrules.upd:use-virtual-desktop-ids
|
||||
|
||||
[General]
|
||||
count=1
|
||||
rules=ad6fd81c-6dea-46e6-a652-dbffe0aeb7d7
|
||||
|
||||
[ad6fd81c-6dea-46e6-a652-dbffe0aeb7d7]
|
||||
Description=force maximize everything
|
||||
maximizehoriz=true
|
||||
maximizehorizrule=2
|
||||
maximizevert=true
|
||||
maximizevertrule=2
|
||||
types=1
|
||||
@@ -1,17 +0,0 @@
|
||||
[1]
|
||||
Description=Window settings for kpat
|
||||
clientmachine=localhost
|
||||
clientmachinematch=0
|
||||
maximizevert=true
|
||||
maximizevertrule=3
|
||||
title=KPatience
|
||||
titlematch=0
|
||||
types=1
|
||||
windowrole=mainwindow
|
||||
windowrolematch=1
|
||||
wmclass=kpat
|
||||
wmclasscomplete=false
|
||||
wmclassmatch=1
|
||||
|
||||
[General]
|
||||
count=1
|
||||
@@ -1,379 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2018 Martin Flöser <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
*/
|
||||
#include "config-kwin.h"
|
||||
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "atoms.h"
|
||||
#include "rules.h"
|
||||
#include "virtualdesktops.h"
|
||||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
#include "x11window.h"
|
||||
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
#include <QDBusArgument>
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusMessage>
|
||||
#include <QDBusPendingReply>
|
||||
#include <QUuid>
|
||||
|
||||
#include <netwm.h>
|
||||
#include <xcb/xcb_icccm.h>
|
||||
|
||||
using namespace KWin;
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_kwin_dbus_interface-0");
|
||||
|
||||
const QString s_destination{QStringLiteral("org.kde.KWin")};
|
||||
const QString s_path{QStringLiteral("/KWin")};
|
||||
const QString s_interface{QStringLiteral("org.kde.KWin")};
|
||||
|
||||
class TestDbusInterface : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void testGetWindowInfoInvalidUuid();
|
||||
void testGetWindowInfoXdgShellClient();
|
||||
void testGetWindowInfoX11Client();
|
||||
};
|
||||
|
||||
void TestDbusInterface::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::Window *>();
|
||||
|
||||
QVERIFY(waylandServer()->init(s_socketName));
|
||||
Test::setOutputConfig({
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
});
|
||||
|
||||
kwinApp()->start();
|
||||
VirtualDesktopManager::self()->setCount(4);
|
||||
}
|
||||
|
||||
void TestDbusInterface::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
}
|
||||
|
||||
void TestDbusInterface::cleanup()
|
||||
{
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
QDBusPendingCall getWindowInfo(const QUuid &uuid)
|
||||
{
|
||||
auto msg = QDBusMessage::createMethodCall(s_destination, s_path, s_interface, QStringLiteral("getWindowInfo"));
|
||||
msg.setArguments({uuid.toString()});
|
||||
return QDBusConnection::sessionBus().asyncCall(msg);
|
||||
}
|
||||
}
|
||||
|
||||
void TestDbusInterface::testGetWindowInfoInvalidUuid()
|
||||
{
|
||||
QDBusPendingReply<QVariantMap> reply{getWindowInfo(QUuid::createUuid())};
|
||||
reply.waitForFinished();
|
||||
QVERIFY(reply.isValid());
|
||||
QVERIFY(!reply.isError());
|
||||
const auto windowData = reply.value();
|
||||
QVERIFY(windowData.empty());
|
||||
}
|
||||
|
||||
void TestDbusInterface::testGetWindowInfoXdgShellClient()
|
||||
{
|
||||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
|
||||
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
||||
shellSurface->set_title(QStringLiteral("Test window"));
|
||||
|
||||
// now let's render
|
||||
Test::render(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(windowAddedSpy.isEmpty());
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
auto window = windowAddedSpy.first().first().value<Window *>();
|
||||
QVERIFY(window);
|
||||
|
||||
const QVariantMap expectedData = {
|
||||
{QStringLiteral("type"), int(NET::Normal)},
|
||||
{QStringLiteral("x"), window->x()},
|
||||
{QStringLiteral("y"), window->y()},
|
||||
{QStringLiteral("width"), window->width()},
|
||||
{QStringLiteral("height"), window->height()},
|
||||
{QStringLiteral("desktops"), window->desktopIds()},
|
||||
{QStringLiteral("minimized"), false},
|
||||
{QStringLiteral("shaded"), false},
|
||||
{QStringLiteral("fullscreen"), false},
|
||||
{QStringLiteral("keepAbove"), false},
|
||||
{QStringLiteral("keepBelow"), false},
|
||||
{QStringLiteral("skipTaskbar"), false},
|
||||
{QStringLiteral("skipPager"), false},
|
||||
{QStringLiteral("skipSwitcher"), false},
|
||||
{QStringLiteral("maximizeHorizontal"), false},
|
||||
{QStringLiteral("maximizeVertical"), false},
|
||||
{QStringLiteral("noBorder"), false},
|
||||
{QStringLiteral("clientMachine"), QString()},
|
||||
{QStringLiteral("localhost"), true},
|
||||
{QStringLiteral("role"), QString()},
|
||||
{QStringLiteral("resourceName"), QStringLiteral("testDbusInterface")},
|
||||
{QStringLiteral("resourceClass"), QStringLiteral("org.kde.foo")},
|
||||
{QStringLiteral("desktopFile"), QStringLiteral("org.kde.foo")},
|
||||
{QStringLiteral("caption"), QStringLiteral("Test window")},
|
||||
#if KWIN_BUILD_ACTIVITIES
|
||||
{QStringLiteral("activities"), QStringList()},
|
||||
#endif
|
||||
{QStringLiteral("layer"), NormalLayer},
|
||||
};
|
||||
|
||||
// let's get the window info
|
||||
QDBusPendingReply<QVariantMap> reply{getWindowInfo(window->internalId())};
|
||||
reply.waitForFinished();
|
||||
QVERIFY(reply.isValid());
|
||||
QVERIFY(!reply.isError());
|
||||
auto windowData = reply.value();
|
||||
windowData.remove(QStringLiteral("uuid"));
|
||||
QCOMPARE(windowData, expectedData);
|
||||
|
||||
auto verifyProperty = [window](const QString &name) {
|
||||
QDBusPendingReply<QVariantMap> reply{getWindowInfo(window->internalId())};
|
||||
reply.waitForFinished();
|
||||
return reply.value().value(name).toBool();
|
||||
};
|
||||
|
||||
QVERIFY(!window->isMinimized());
|
||||
window->setMinimized(true);
|
||||
QVERIFY(window->isMinimized());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("minimized")), true);
|
||||
|
||||
QVERIFY(!window->keepAbove());
|
||||
window->setKeepAbove(true);
|
||||
QVERIFY(window->keepAbove());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("keepAbove")), true);
|
||||
|
||||
QVERIFY(!window->keepBelow());
|
||||
window->setKeepBelow(true);
|
||||
QVERIFY(window->keepBelow());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("keepBelow")), true);
|
||||
|
||||
QVERIFY(!window->skipTaskbar());
|
||||
window->setSkipTaskbar(true);
|
||||
QVERIFY(window->skipTaskbar());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("skipTaskbar")), true);
|
||||
|
||||
QVERIFY(!window->skipPager());
|
||||
window->setSkipPager(true);
|
||||
QVERIFY(window->skipPager());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("skipPager")), true);
|
||||
|
||||
QVERIFY(!window->skipSwitcher());
|
||||
window->setSkipSwitcher(true);
|
||||
QVERIFY(window->skipSwitcher());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("skipSwitcher")), true);
|
||||
|
||||
// not testing shaded as that's X11
|
||||
// not testing fullscreen, maximizeHorizontal, maximizeVertical and noBorder as those require window geometry changes
|
||||
|
||||
const QList<VirtualDesktop *> desktops = VirtualDesktopManager::self()->desktops();
|
||||
QCOMPARE(window->desktops(), QList<VirtualDesktop *>{desktops[0]});
|
||||
workspace()->sendWindowToDesktops(window, {desktops[1]}, false);
|
||||
QCOMPARE(window->desktops(), QList<VirtualDesktop *>{desktops[1]});
|
||||
reply = getWindowInfo(window->internalId());
|
||||
reply.waitForFinished();
|
||||
QCOMPARE(reply.value().value(QStringLiteral("desktops")).toStringList(), window->desktopIds());
|
||||
|
||||
window->move(QPoint(10, 20));
|
||||
reply = getWindowInfo(window->internalId());
|
||||
reply.waitForFinished();
|
||||
QCOMPARE(reply.value().value(QStringLiteral("x")).toInt(), window->x());
|
||||
QCOMPARE(reply.value().value(QStringLiteral("y")).toInt(), window->y());
|
||||
// not testing width, height as that would require window geometry change
|
||||
|
||||
// finally close window
|
||||
const auto id = window->internalId();
|
||||
QSignalSpy windowClosedSpy(window, &Window::closed);
|
||||
shellSurface.reset();
|
||||
surface.reset();
|
||||
QVERIFY(windowClosedSpy.wait());
|
||||
QCOMPARE(windowClosedSpy.count(), 1);
|
||||
|
||||
reply = getWindowInfo(id);
|
||||
reply.waitForFinished();
|
||||
QVERIFY(reply.value().empty());
|
||||
}
|
||||
|
||||
void TestDbusInterface::testGetWindowInfoX11Client()
|
||||
{
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
const QRect windowGeometry(0, 0, 600, 400);
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
xcb_create_window(c.get(), XCB_COPY_FROM_PARENT, windowId, rootWindow(),
|
||||
windowGeometry.x(),
|
||||
windowGeometry.y(),
|
||||
windowGeometry.width(),
|
||||
windowGeometry.height(),
|
||||
0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, 0, nullptr);
|
||||
xcb_size_hints_t hints;
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
xcb_icccm_size_hints_set_position(&hints, 1, windowGeometry.x(), windowGeometry.y());
|
||||
xcb_icccm_size_hints_set_size(&hints, 1, windowGeometry.width(), windowGeometry.height());
|
||||
xcb_icccm_set_wm_normal_hints(c.get(), windowId, &hints);
|
||||
xcb_icccm_set_wm_class(c.get(), windowId, 7, "foo\0bar");
|
||||
NETWinInfo winInfo(c.get(), windowId, rootWindow(), NET::Properties(), NET::Properties2());
|
||||
winInfo.setName("Some caption");
|
||||
winInfo.setDesktopFileName("org.kde.foo");
|
||||
xcb_map_window(c.get(), windowId);
|
||||
xcb_flush(c.get());
|
||||
|
||||
// we should get a window for it
|
||||
QSignalSpy windowCreatedSpy(workspace(), &Workspace::windowAdded);
|
||||
QVERIFY(windowCreatedSpy.wait());
|
||||
X11Window *window = windowCreatedSpy.first().first().value<X11Window *>();
|
||||
QVERIFY(window);
|
||||
QCOMPARE(window->window(), windowId);
|
||||
QCOMPARE(window->clientSize(), windowGeometry.size());
|
||||
|
||||
const QVariantMap expectedData = {
|
||||
{QStringLiteral("type"), NET::Normal},
|
||||
{QStringLiteral("x"), window->x()},
|
||||
{QStringLiteral("y"), window->y()},
|
||||
{QStringLiteral("width"), window->width()},
|
||||
{QStringLiteral("height"), window->height()},
|
||||
{QStringLiteral("desktops"), window->desktopIds()},
|
||||
{QStringLiteral("minimized"), false},
|
||||
{QStringLiteral("shaded"), false},
|
||||
{QStringLiteral("fullscreen"), false},
|
||||
{QStringLiteral("keepAbove"), false},
|
||||
{QStringLiteral("keepBelow"), false},
|
||||
{QStringLiteral("skipTaskbar"), false},
|
||||
{QStringLiteral("skipPager"), false},
|
||||
{QStringLiteral("skipSwitcher"), false},
|
||||
{QStringLiteral("maximizeHorizontal"), false},
|
||||
{QStringLiteral("maximizeVertical"), false},
|
||||
{QStringLiteral("noBorder"), false},
|
||||
{QStringLiteral("role"), QString()},
|
||||
{QStringLiteral("resourceName"), QStringLiteral("foo")},
|
||||
{QStringLiteral("resourceClass"), QStringLiteral("bar")},
|
||||
{QStringLiteral("desktopFile"), QStringLiteral("org.kde.foo")},
|
||||
{QStringLiteral("caption"), QStringLiteral("Some caption")},
|
||||
#if KWIN_BUILD_ACTIVITIES
|
||||
{QStringLiteral("activities"), QStringList()},
|
||||
#endif
|
||||
{QStringLiteral("layer"), NormalLayer},
|
||||
};
|
||||
|
||||
// let's get the window info
|
||||
QDBusPendingReply<QVariantMap> reply{getWindowInfo(window->internalId())};
|
||||
reply.waitForFinished();
|
||||
QVERIFY(reply.isValid());
|
||||
QVERIFY(!reply.isError());
|
||||
auto windowData = reply.value();
|
||||
// not testing clientmachine as that is system dependent due to that also not testing localhost
|
||||
windowData.remove(QStringLiteral("clientMachine"));
|
||||
windowData.remove(QStringLiteral("localhost"));
|
||||
windowData.remove(QStringLiteral("uuid"));
|
||||
QCOMPARE(windowData, expectedData);
|
||||
|
||||
auto verifyProperty = [window](const QString &name) {
|
||||
QDBusPendingReply<QVariantMap> reply{getWindowInfo(window->internalId())};
|
||||
reply.waitForFinished();
|
||||
return reply.value().value(name).toBool();
|
||||
};
|
||||
|
||||
QVERIFY(!window->isMinimized());
|
||||
window->setMinimized(true);
|
||||
QVERIFY(window->isMinimized());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("minimized")), true);
|
||||
|
||||
QVERIFY(!window->keepAbove());
|
||||
window->setKeepAbove(true);
|
||||
QVERIFY(window->keepAbove());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("keepAbove")), true);
|
||||
|
||||
QVERIFY(!window->keepBelow());
|
||||
window->setKeepBelow(true);
|
||||
QVERIFY(window->keepBelow());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("keepBelow")), true);
|
||||
|
||||
QVERIFY(!window->skipTaskbar());
|
||||
window->setSkipTaskbar(true);
|
||||
QVERIFY(window->skipTaskbar());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("skipTaskbar")), true);
|
||||
|
||||
QVERIFY(!window->skipPager());
|
||||
window->setSkipPager(true);
|
||||
QVERIFY(window->skipPager());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("skipPager")), true);
|
||||
|
||||
QVERIFY(!window->skipSwitcher());
|
||||
window->setSkipSwitcher(true);
|
||||
QVERIFY(window->skipSwitcher());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("skipSwitcher")), true);
|
||||
|
||||
QVERIFY(!window->isShade());
|
||||
window->setShade(ShadeNormal);
|
||||
QVERIFY(window->isShade());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("shaded")), true);
|
||||
window->setShade(ShadeNone);
|
||||
QVERIFY(!window->isShade());
|
||||
|
||||
QVERIFY(!window->noBorder());
|
||||
window->setNoBorder(true);
|
||||
QVERIFY(window->noBorder());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("noBorder")), true);
|
||||
window->setNoBorder(false);
|
||||
QVERIFY(!window->noBorder());
|
||||
|
||||
QVERIFY(!window->isFullScreen());
|
||||
window->setFullScreen(true);
|
||||
QVERIFY(window->isFullScreen());
|
||||
QVERIFY(window->clientSize() != windowGeometry.size());
|
||||
QCOMPARE(verifyProperty(QStringLiteral("fullscreen")), true);
|
||||
reply = getWindowInfo(window->internalId());
|
||||
reply.waitForFinished();
|
||||
QCOMPARE(reply.value().value(QStringLiteral("width")).toInt(), window->width());
|
||||
QCOMPARE(reply.value().value(QStringLiteral("height")).toInt(), window->height());
|
||||
window->setFullScreen(false);
|
||||
QVERIFY(!window->isFullScreen());
|
||||
|
||||
// maximize
|
||||
window->setMaximize(true, false);
|
||||
QCOMPARE(verifyProperty(QStringLiteral("maximizeVertical")), true);
|
||||
QCOMPARE(verifyProperty(QStringLiteral("maximizeHorizontal")), false);
|
||||
window->setMaximize(false, true);
|
||||
QCOMPARE(verifyProperty(QStringLiteral("maximizeVertical")), false);
|
||||
QCOMPARE(verifyProperty(QStringLiteral("maximizeHorizontal")), true);
|
||||
|
||||
const auto id = window->internalId();
|
||||
// destroy the window
|
||||
xcb_unmap_window(c.get(), windowId);
|
||||
xcb_flush(c.get());
|
||||
|
||||
QSignalSpy windowClosedSpy(window, &X11Window::closed);
|
||||
QVERIFY(windowClosedSpy.wait());
|
||||
xcb_destroy_window(c.get(), windowId);
|
||||
c.reset();
|
||||
|
||||
reply = getWindowInfo(id);
|
||||
reply.waitForFinished();
|
||||
QVERIFY(reply.value().empty());
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(TestDbusInterface)
|
||||
#include "dbus_interface_test.moc"
|
||||
@@ -1,502 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "core/output.h"
|
||||
#include "debug_console.h"
|
||||
#include "internalwindow.h"
|
||||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#if KWIN_BUILD_X11
|
||||
#include "utils/xcbutils.h"
|
||||
#endif
|
||||
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
#include <QPainter>
|
||||
#include <QRasterWindow>
|
||||
#include <QSignalSpy>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_kwin_debug_console-0");
|
||||
|
||||
class DebugConsoleTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void cleanup();
|
||||
void topLevelTest_data();
|
||||
void topLevelTest();
|
||||
#if KWIN_BUILD_X11
|
||||
void testX11Window();
|
||||
void testX11Unmanaged();
|
||||
#endif
|
||||
void testWaylandClient();
|
||||
void testInternalWindow();
|
||||
void testClosingDebugConsole();
|
||||
};
|
||||
|
||||
void DebugConsoleTest::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::Window *>();
|
||||
qRegisterMetaType<KWin::InternalWindow *>();
|
||||
QVERIFY(waylandServer()->init(s_socketName));
|
||||
Test::setOutputConfig({
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
});
|
||||
|
||||
kwinApp()->start();
|
||||
const auto outputs = workspace()->outputs();
|
||||
QCOMPARE(outputs.count(), 2);
|
||||
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
|
||||
setenv("QT_QPA_PLATFORM", "wayland", true);
|
||||
}
|
||||
|
||||
void DebugConsoleTest::cleanup()
|
||||
{
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void DebugConsoleTest::topLevelTest_data()
|
||||
{
|
||||
QTest::addColumn<int>("row");
|
||||
QTest::addColumn<int>("column");
|
||||
QTest::addColumn<bool>("expectedValid");
|
||||
|
||||
// this tests various combinations of row/column on the top level whether they are valid
|
||||
// valid are rows 0-4 with column 0, everything else is invalid
|
||||
QTest::newRow("0/0") << 0 << 0 << true;
|
||||
QTest::newRow("0/1") << 0 << 1 << false;
|
||||
QTest::newRow("0/3") << 0 << 3 << false;
|
||||
QTest::newRow("1/0") << 1 << 0 << true;
|
||||
QTest::newRow("1/1") << 1 << 1 << false;
|
||||
QTest::newRow("1/3") << 1 << 3 << false;
|
||||
QTest::newRow("2/0") << 2 << 0 << true;
|
||||
QTest::newRow("3/0") << 3 << 0 << true;
|
||||
QTest::newRow("4/0") << 4 << 0 << false;
|
||||
QTest::newRow("100/0") << 4 << 0 << false;
|
||||
}
|
||||
|
||||
void DebugConsoleTest::topLevelTest()
|
||||
{
|
||||
DebugConsoleModel model;
|
||||
QCOMPARE(model.rowCount(QModelIndex()), 4);
|
||||
QCOMPARE(model.columnCount(QModelIndex()), 2);
|
||||
QFETCH(int, row);
|
||||
QFETCH(int, column);
|
||||
const QModelIndex index = model.index(row, column, QModelIndex());
|
||||
QTEST(index.isValid(), "expectedValid");
|
||||
if (index.isValid()) {
|
||||
QVERIFY(!model.parent(index).isValid());
|
||||
QVERIFY(model.data(index, Qt::DisplayRole).isValid());
|
||||
QCOMPARE(model.data(index, Qt::DisplayRole).userType(), int(QMetaType::QString));
|
||||
for (int i = Qt::DecorationRole; i <= Qt::UserRole; i++) {
|
||||
QVERIFY(!model.data(index, i).isValid());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if KWIN_BUILD_X11
|
||||
void DebugConsoleTest::testX11Window()
|
||||
{
|
||||
DebugConsoleModel model;
|
||||
QModelIndex x11TopLevelIndex = model.index(0, 0, QModelIndex());
|
||||
QVERIFY(x11TopLevelIndex.isValid());
|
||||
// we don't have any windows yet
|
||||
QCOMPARE(model.rowCount(x11TopLevelIndex), 0);
|
||||
QVERIFY(!model.hasChildren(x11TopLevelIndex));
|
||||
// child index must be invalid
|
||||
QVERIFY(!model.index(0, 0, x11TopLevelIndex).isValid());
|
||||
QVERIFY(!model.index(0, 1, x11TopLevelIndex).isValid());
|
||||
QVERIFY(!model.index(0, 2, x11TopLevelIndex).isValid());
|
||||
QVERIFY(!model.index(1, 0, x11TopLevelIndex).isValid());
|
||||
|
||||
// start glxgears, to get a window, which should be added to the model
|
||||
QSignalSpy rowsInsertedSpy(&model, &QAbstractItemModel::rowsInserted);
|
||||
|
||||
QProcess glxgears;
|
||||
glxgears.setProgram(QStringLiteral("glxgears"));
|
||||
glxgears.start();
|
||||
QVERIFY(glxgears.waitForStarted());
|
||||
|
||||
QVERIFY(rowsInsertedSpy.wait());
|
||||
QCOMPARE(rowsInsertedSpy.count(), 1);
|
||||
QVERIFY(model.hasChildren(x11TopLevelIndex));
|
||||
QCOMPARE(model.rowCount(x11TopLevelIndex), 1);
|
||||
QCOMPARE(rowsInsertedSpy.first().at(0).value<QModelIndex>(), x11TopLevelIndex);
|
||||
QCOMPARE(rowsInsertedSpy.first().at(1).value<int>(), 0);
|
||||
QCOMPARE(rowsInsertedSpy.first().at(2).value<int>(), 0);
|
||||
|
||||
QModelIndex windowIndex = model.index(0, 0, x11TopLevelIndex);
|
||||
QVERIFY(windowIndex.isValid());
|
||||
QCOMPARE(model.parent(windowIndex), x11TopLevelIndex);
|
||||
QVERIFY(model.hasChildren(windowIndex));
|
||||
QVERIFY(model.rowCount(windowIndex) != 0);
|
||||
QCOMPARE(model.columnCount(windowIndex), 2);
|
||||
// other indexes are still invalid
|
||||
QVERIFY(!model.index(0, 1, x11TopLevelIndex).isValid());
|
||||
QVERIFY(!model.index(0, 2, x11TopLevelIndex).isValid());
|
||||
QVERIFY(!model.index(1, 0, x11TopLevelIndex).isValid());
|
||||
|
||||
// the windowIndex has children and those are properties
|
||||
for (int i = 0; i < model.rowCount(windowIndex); i++) {
|
||||
const QModelIndex propNameIndex = model.index(i, 0, windowIndex);
|
||||
QVERIFY(propNameIndex.isValid());
|
||||
QCOMPARE(model.parent(propNameIndex), windowIndex);
|
||||
QVERIFY(!model.hasChildren(propNameIndex));
|
||||
QVERIFY(!model.index(0, 0, propNameIndex).isValid());
|
||||
QVERIFY(model.data(propNameIndex, Qt::DisplayRole).isValid());
|
||||
QCOMPARE(model.data(propNameIndex, Qt::DisplayRole).userType(), int(QMetaType::QString));
|
||||
|
||||
// and the value
|
||||
const QModelIndex propValueIndex = model.index(i, 1, windowIndex);
|
||||
QVERIFY(propValueIndex.isValid());
|
||||
QCOMPARE(model.parent(propValueIndex), windowIndex);
|
||||
QVERIFY(!model.index(0, 0, propValueIndex).isValid());
|
||||
QVERIFY(!model.hasChildren(propValueIndex));
|
||||
// TODO: how to test whether the values actually work?
|
||||
|
||||
// and on third column we should not get an index any more
|
||||
QVERIFY(!model.index(i, 2, windowIndex).isValid());
|
||||
}
|
||||
// row after count should be invalid
|
||||
QVERIFY(!model.index(model.rowCount(windowIndex), 0, windowIndex).isValid());
|
||||
|
||||
// creating a second model should be initialized directly with the X11 child
|
||||
DebugConsoleModel model2;
|
||||
QVERIFY(model2.hasChildren(model2.index(0, 0, QModelIndex())));
|
||||
|
||||
// now close the window again, it should be removed from the model
|
||||
QSignalSpy rowsRemovedSpy(&model, &QAbstractItemModel::rowsRemoved);
|
||||
|
||||
glxgears.terminate();
|
||||
QVERIFY(glxgears.waitForFinished());
|
||||
|
||||
QVERIFY(rowsRemovedSpy.wait());
|
||||
QCOMPARE(rowsRemovedSpy.count(), 1);
|
||||
QCOMPARE(rowsRemovedSpy.first().first().value<QModelIndex>(), x11TopLevelIndex);
|
||||
QCOMPARE(rowsRemovedSpy.first().at(1).value<int>(), 0);
|
||||
QCOMPARE(rowsRemovedSpy.first().at(2).value<int>(), 0);
|
||||
|
||||
// the child should be gone again
|
||||
QVERIFY(!model.hasChildren(x11TopLevelIndex));
|
||||
QVERIFY(!model2.hasChildren(model2.index(0, 0, QModelIndex())));
|
||||
}
|
||||
|
||||
void DebugConsoleTest::testX11Unmanaged()
|
||||
{
|
||||
DebugConsoleModel model;
|
||||
QModelIndex unmanagedTopLevelIndex = model.index(1, 0, QModelIndex());
|
||||
QVERIFY(unmanagedTopLevelIndex.isValid());
|
||||
// we don't have any windows yet
|
||||
QCOMPARE(model.rowCount(unmanagedTopLevelIndex), 0);
|
||||
QVERIFY(!model.hasChildren(unmanagedTopLevelIndex));
|
||||
// child index must be invalid
|
||||
QVERIFY(!model.index(0, 0, unmanagedTopLevelIndex).isValid());
|
||||
QVERIFY(!model.index(0, 1, unmanagedTopLevelIndex).isValid());
|
||||
QVERIFY(!model.index(0, 2, unmanagedTopLevelIndex).isValid());
|
||||
QVERIFY(!model.index(1, 0, unmanagedTopLevelIndex).isValid());
|
||||
|
||||
// we need to create an unmanaged window
|
||||
QSignalSpy rowsInsertedSpy(&model, &QAbstractItemModel::rowsInserted);
|
||||
|
||||
// let's create an override redirect window
|
||||
const uint32_t values[] = {true};
|
||||
Xcb::Window window(QRect(0, 0, 10, 10), XCB_CW_OVERRIDE_REDIRECT, values);
|
||||
window.map();
|
||||
|
||||
QVERIFY(rowsInsertedSpy.wait());
|
||||
QCOMPARE(rowsInsertedSpy.count(), 1);
|
||||
QVERIFY(model.hasChildren(unmanagedTopLevelIndex));
|
||||
QCOMPARE(model.rowCount(unmanagedTopLevelIndex), 1);
|
||||
QCOMPARE(rowsInsertedSpy.first().at(0).value<QModelIndex>(), unmanagedTopLevelIndex);
|
||||
QCOMPARE(rowsInsertedSpy.first().at(1).value<int>(), 0);
|
||||
QCOMPARE(rowsInsertedSpy.first().at(2).value<int>(), 0);
|
||||
|
||||
QModelIndex windowIndex = model.index(0, 0, unmanagedTopLevelIndex);
|
||||
QVERIFY(windowIndex.isValid());
|
||||
QCOMPARE(model.parent(windowIndex), unmanagedTopLevelIndex);
|
||||
QVERIFY(model.hasChildren(windowIndex));
|
||||
QVERIFY(model.rowCount(windowIndex) != 0);
|
||||
QCOMPARE(model.columnCount(windowIndex), 2);
|
||||
// other indexes are still invalid
|
||||
QVERIFY(!model.index(0, 1, unmanagedTopLevelIndex).isValid());
|
||||
QVERIFY(!model.index(0, 2, unmanagedTopLevelIndex).isValid());
|
||||
QVERIFY(!model.index(1, 0, unmanagedTopLevelIndex).isValid());
|
||||
|
||||
QCOMPARE(model.data(windowIndex, Qt::DisplayRole).toString(), QStringLiteral("0x%1").arg(static_cast<xcb_window_t>(window), 0, 16));
|
||||
|
||||
// the windowIndex has children and those are properties
|
||||
for (int i = 0; i < model.rowCount(windowIndex); i++) {
|
||||
const QModelIndex propNameIndex = model.index(i, 0, windowIndex);
|
||||
QVERIFY(propNameIndex.isValid());
|
||||
QCOMPARE(model.parent(propNameIndex), windowIndex);
|
||||
QVERIFY(!model.hasChildren(propNameIndex));
|
||||
QVERIFY(!model.index(0, 0, propNameIndex).isValid());
|
||||
QVERIFY(model.data(propNameIndex, Qt::DisplayRole).isValid());
|
||||
QCOMPARE(model.data(propNameIndex, Qt::DisplayRole).userType(), int(QMetaType::QString));
|
||||
|
||||
// and the value
|
||||
const QModelIndex propValueIndex = model.index(i, 1, windowIndex);
|
||||
QVERIFY(propValueIndex.isValid());
|
||||
QCOMPARE(model.parent(propValueIndex), windowIndex);
|
||||
QVERIFY(!model.index(0, 0, propValueIndex).isValid());
|
||||
QVERIFY(!model.hasChildren(propValueIndex));
|
||||
// TODO: how to test whether the values actually work?
|
||||
|
||||
// and on third column we should not get an index any more
|
||||
QVERIFY(!model.index(i, 2, windowIndex).isValid());
|
||||
}
|
||||
// row after count should be invalid
|
||||
QVERIFY(!model.index(model.rowCount(windowIndex), 0, windowIndex).isValid());
|
||||
|
||||
// creating a second model should be initialized directly with the X11 child
|
||||
DebugConsoleModel model2;
|
||||
QVERIFY(model2.hasChildren(model2.index(1, 0, QModelIndex())));
|
||||
|
||||
// now close the window again, it should be removed from the model
|
||||
QSignalSpy rowsRemovedSpy(&model, &QAbstractItemModel::rowsRemoved);
|
||||
|
||||
window.unmap();
|
||||
|
||||
QVERIFY(rowsRemovedSpy.wait());
|
||||
QCOMPARE(rowsRemovedSpy.count(), 1);
|
||||
QCOMPARE(rowsRemovedSpy.first().first().value<QModelIndex>(), unmanagedTopLevelIndex);
|
||||
QCOMPARE(rowsRemovedSpy.first().at(1).value<int>(), 0);
|
||||
QCOMPARE(rowsRemovedSpy.first().at(2).value<int>(), 0);
|
||||
|
||||
// the child should be gone again
|
||||
QVERIFY(!model.hasChildren(unmanagedTopLevelIndex));
|
||||
QVERIFY(!model2.hasChildren(model2.index(1, 0, QModelIndex())));
|
||||
}
|
||||
#endif
|
||||
|
||||
void DebugConsoleTest::testWaylandClient()
|
||||
{
|
||||
DebugConsoleModel model;
|
||||
QModelIndex waylandTopLevelIndex = model.index(2, 0, QModelIndex());
|
||||
QVERIFY(waylandTopLevelIndex.isValid());
|
||||
|
||||
// we don't have any windows yet
|
||||
QCOMPARE(model.rowCount(waylandTopLevelIndex), 0);
|
||||
QVERIFY(!model.hasChildren(waylandTopLevelIndex));
|
||||
// child index must be invalid
|
||||
QVERIFY(!model.index(0, 0, waylandTopLevelIndex).isValid());
|
||||
QVERIFY(!model.index(0, 1, waylandTopLevelIndex).isValid());
|
||||
QVERIFY(!model.index(0, 2, waylandTopLevelIndex).isValid());
|
||||
QVERIFY(!model.index(1, 0, waylandTopLevelIndex).isValid());
|
||||
|
||||
// we need to create a wayland window
|
||||
QSignalSpy rowsInsertedSpy(&model, &QAbstractItemModel::rowsInserted);
|
||||
|
||||
// create our connection
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
|
||||
// create the Surface and ShellSurface
|
||||
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
||||
QVERIFY(surface->isValid());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
|
||||
QVERIFY(shellSurface != nullptr);
|
||||
Test::render(surface.get(), QSize(10, 10), Qt::red);
|
||||
|
||||
// now we have the window, it should be added to our model
|
||||
QVERIFY(rowsInsertedSpy.wait());
|
||||
QCOMPARE(rowsInsertedSpy.count(), 1);
|
||||
|
||||
QVERIFY(model.hasChildren(waylandTopLevelIndex));
|
||||
QCOMPARE(model.rowCount(waylandTopLevelIndex), 1);
|
||||
QCOMPARE(rowsInsertedSpy.first().at(0).value<QModelIndex>(), waylandTopLevelIndex);
|
||||
QCOMPARE(rowsInsertedSpy.first().at(1).value<int>(), 0);
|
||||
QCOMPARE(rowsInsertedSpy.first().at(2).value<int>(), 0);
|
||||
|
||||
QModelIndex windowIndex = model.index(0, 0, waylandTopLevelIndex);
|
||||
QVERIFY(windowIndex.isValid());
|
||||
QCOMPARE(model.parent(windowIndex), waylandTopLevelIndex);
|
||||
QVERIFY(model.hasChildren(windowIndex));
|
||||
QVERIFY(model.rowCount(windowIndex) != 0);
|
||||
QCOMPARE(model.columnCount(windowIndex), 2);
|
||||
// other indexes are still invalid
|
||||
QVERIFY(!model.index(0, 1, waylandTopLevelIndex).isValid());
|
||||
QVERIFY(!model.index(0, 2, waylandTopLevelIndex).isValid());
|
||||
QVERIFY(!model.index(1, 0, waylandTopLevelIndex).isValid());
|
||||
|
||||
// the windowIndex has children and those are properties
|
||||
for (int i = 0; i < model.rowCount(windowIndex); i++) {
|
||||
const QModelIndex propNameIndex = model.index(i, 0, windowIndex);
|
||||
QVERIFY(propNameIndex.isValid());
|
||||
QCOMPARE(model.parent(propNameIndex), windowIndex);
|
||||
QVERIFY(!model.hasChildren(propNameIndex));
|
||||
QVERIFY(!model.index(0, 0, propNameIndex).isValid());
|
||||
QVERIFY(model.data(propNameIndex, Qt::DisplayRole).isValid());
|
||||
QCOMPARE(model.data(propNameIndex, Qt::DisplayRole).userType(), int(QMetaType::QString));
|
||||
|
||||
// and the value
|
||||
const QModelIndex propValueIndex = model.index(i, 1, windowIndex);
|
||||
QVERIFY(propValueIndex.isValid());
|
||||
QCOMPARE(model.parent(propValueIndex), windowIndex);
|
||||
QVERIFY(!model.index(0, 0, propValueIndex).isValid());
|
||||
QVERIFY(!model.hasChildren(propValueIndex));
|
||||
// TODO: how to test whether the values actually work?
|
||||
|
||||
// and on third column we should not get an index any more
|
||||
QVERIFY(!model.index(i, 2, windowIndex).isValid());
|
||||
}
|
||||
// row after count should be invalid
|
||||
QVERIFY(!model.index(model.rowCount(windowIndex), 0, windowIndex).isValid());
|
||||
|
||||
// creating a second model should be initialized directly with the X11 child
|
||||
DebugConsoleModel model2;
|
||||
QVERIFY(model2.hasChildren(model2.index(2, 0, QModelIndex())));
|
||||
|
||||
// now close the window again, it should be removed from the model
|
||||
QSignalSpy rowsRemovedSpy(&model, &QAbstractItemModel::rowsRemoved);
|
||||
|
||||
surface->attachBuffer(KWayland::Client::Buffer::Ptr());
|
||||
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
||||
QVERIFY(rowsRemovedSpy.wait());
|
||||
|
||||
QCOMPARE(rowsRemovedSpy.count(), 1);
|
||||
QCOMPARE(rowsRemovedSpy.first().first().value<QModelIndex>(), waylandTopLevelIndex);
|
||||
QCOMPARE(rowsRemovedSpy.first().at(1).value<int>(), 0);
|
||||
QCOMPARE(rowsRemovedSpy.first().at(2).value<int>(), 0);
|
||||
|
||||
// the child should be gone again
|
||||
QVERIFY(!model.hasChildren(waylandTopLevelIndex));
|
||||
QVERIFY(!model2.hasChildren(model2.index(2, 0, QModelIndex())));
|
||||
}
|
||||
|
||||
class HelperWindow : public QRasterWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HelperWindow()
|
||||
: QRasterWindow(nullptr)
|
||||
{
|
||||
}
|
||||
~HelperWindow() override = default;
|
||||
|
||||
Q_SIGNALS:
|
||||
void entered();
|
||||
void left();
|
||||
void mouseMoved(const QPoint &global);
|
||||
void mousePressed();
|
||||
void mouseReleased();
|
||||
void wheel();
|
||||
void keyPressed();
|
||||
void keyReleased();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override
|
||||
{
|
||||
QPainter p(this);
|
||||
p.fillRect(0, 0, width(), height(), Qt::red);
|
||||
}
|
||||
};
|
||||
|
||||
void DebugConsoleTest::testInternalWindow()
|
||||
{
|
||||
DebugConsoleModel model;
|
||||
QModelIndex internalTopLevelIndex = model.index(3, 0, QModelIndex());
|
||||
QVERIFY(internalTopLevelIndex.isValid());
|
||||
|
||||
// there might already be some internal windows, so we cannot reliable test whether there are children
|
||||
// given that we just test whether adding a window works.
|
||||
|
||||
QSignalSpy rowsInsertedSpy(&model, &QAbstractItemModel::rowsInserted);
|
||||
|
||||
std::unique_ptr<HelperWindow> w(new HelperWindow);
|
||||
w->setGeometry(0, 0, 100, 100);
|
||||
w->show();
|
||||
|
||||
QTRY_COMPARE(rowsInsertedSpy.count(), 1);
|
||||
QCOMPARE(rowsInsertedSpy.first().first().value<QModelIndex>(), internalTopLevelIndex);
|
||||
|
||||
QModelIndex windowIndex = model.index(rowsInsertedSpy.first().last().toInt(), 0, internalTopLevelIndex);
|
||||
QVERIFY(windowIndex.isValid());
|
||||
QCOMPARE(model.parent(windowIndex), internalTopLevelIndex);
|
||||
QVERIFY(model.hasChildren(windowIndex));
|
||||
QVERIFY(model.rowCount(windowIndex) != 0);
|
||||
QCOMPARE(model.columnCount(windowIndex), 2);
|
||||
// other indexes are still invalid
|
||||
QVERIFY(!model.index(rowsInsertedSpy.first().last().toInt(), 1, internalTopLevelIndex).isValid());
|
||||
QVERIFY(!model.index(rowsInsertedSpy.first().last().toInt(), 2, internalTopLevelIndex).isValid());
|
||||
QVERIFY(!model.index(rowsInsertedSpy.first().last().toInt() + 1, 0, internalTopLevelIndex).isValid());
|
||||
|
||||
// the wayland shell client top level should not have gained this window
|
||||
QVERIFY(!model.hasChildren(model.index(2, 0, QModelIndex())));
|
||||
|
||||
// the windowIndex has children and those are properties
|
||||
for (int i = 0; i < model.rowCount(windowIndex); i++) {
|
||||
const QModelIndex propNameIndex = model.index(i, 0, windowIndex);
|
||||
QVERIFY(propNameIndex.isValid());
|
||||
QCOMPARE(model.parent(propNameIndex), windowIndex);
|
||||
QVERIFY(!model.hasChildren(propNameIndex));
|
||||
QVERIFY(!model.index(0, 0, propNameIndex).isValid());
|
||||
QVERIFY(model.data(propNameIndex, Qt::DisplayRole).isValid());
|
||||
QCOMPARE(model.data(propNameIndex, Qt::DisplayRole).userType(), int(QMetaType::QString));
|
||||
|
||||
// and the value
|
||||
const QModelIndex propValueIndex = model.index(i, 1, windowIndex);
|
||||
QVERIFY(propValueIndex.isValid());
|
||||
QCOMPARE(model.parent(propValueIndex), windowIndex);
|
||||
QVERIFY(!model.index(0, 0, propValueIndex).isValid());
|
||||
QVERIFY(!model.hasChildren(propValueIndex));
|
||||
// TODO: how to test whether the values actually work?
|
||||
|
||||
// and on third column we should not get an index any more
|
||||
QVERIFY(!model.index(i, 2, windowIndex).isValid());
|
||||
}
|
||||
// row after count should be invalid
|
||||
QVERIFY(!model.index(model.rowCount(windowIndex), 0, windowIndex).isValid());
|
||||
|
||||
// now close the window again, it should be removed from the model
|
||||
QSignalSpy rowsRemovedSpy(&model, &QAbstractItemModel::rowsRemoved);
|
||||
|
||||
w->hide();
|
||||
w.reset();
|
||||
|
||||
QTRY_COMPARE(rowsRemovedSpy.count(), 1);
|
||||
QCOMPARE(rowsRemovedSpy.first().first().value<QModelIndex>(), internalTopLevelIndex);
|
||||
}
|
||||
|
||||
void DebugConsoleTest::testClosingDebugConsole()
|
||||
{
|
||||
// this test verifies that the DebugConsole gets destroyed when closing the window
|
||||
// BUG: 369858
|
||||
|
||||
DebugConsole *console = new DebugConsole;
|
||||
QSignalSpy destroyedSpy(console, &QObject::destroyed);
|
||||
|
||||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
console->show();
|
||||
QCOMPARE(console->windowHandle()->isVisible(), true);
|
||||
QTRY_COMPARE(windowAddedSpy.count(), 1);
|
||||
InternalWindow *window = windowAddedSpy.first().first().value<InternalWindow *>();
|
||||
QVERIFY(window->isInternal());
|
||||
QCOMPARE(window->handle(), console->windowHandle());
|
||||
QVERIFY(window->isDecorated());
|
||||
QCOMPARE(window->isMinimizable(), false);
|
||||
window->closeWindow();
|
||||
QVERIFY(destroyedSpy.wait());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(KWin::DebugConsoleTest)
|
||||
#include "debug_console_test.moc"
|
||||
@@ -1,774 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "core/output.h"
|
||||
#include "cursor.h"
|
||||
#include "internalwindow.h"
|
||||
#include "pointer_input.h"
|
||||
#include "touch_input.h"
|
||||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include "decorations/decoratedwindow.h"
|
||||
#include "decorations/decorationbridge.h"
|
||||
#include "decorations/settings.h"
|
||||
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/keyboard.h>
|
||||
#include <KWayland/Client/pointer.h>
|
||||
#include <KWayland/Client/seat.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
#include <KDecoration3/Decoration>
|
||||
#include <KDecoration3/DecorationSettings>
|
||||
|
||||
#include <QSignalSpy>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
Q_DECLARE_METATYPE(Qt::WindowFrameSection)
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_kwin_decoration_input-0");
|
||||
|
||||
class DecorationInputTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
void testAxis_data();
|
||||
void testAxis();
|
||||
void testDoubleClickOnAllDesktops();
|
||||
void testDoubleClickClose();
|
||||
void testDoubleTap();
|
||||
void testHover();
|
||||
void testPressToMove_data();
|
||||
void testPressToMove();
|
||||
void testTapToMove_data();
|
||||
void testTapToMove();
|
||||
void testResizeOutsideWindow_data();
|
||||
void testResizeOutsideWindow();
|
||||
void testModifierClickUnrestrictedMove_data();
|
||||
void testModifierClickUnrestrictedMove();
|
||||
void testModifierScrollOpacity_data();
|
||||
void testModifierScrollOpacity();
|
||||
void testTouchEvents();
|
||||
void testTooltipDoesntEatKeyEvents();
|
||||
|
||||
private:
|
||||
std::tuple<Window *, std::unique_ptr<KWayland::Client::Surface>, std::unique_ptr<Test::XdgToplevel>, std::unique_ptr<Test::XdgToplevelDecorationV1>> showWindow();
|
||||
};
|
||||
|
||||
#define MOTION(target) Test::pointerMotion(target, timestamp++)
|
||||
|
||||
#define PRESS Test::pointerButtonPressed(BTN_LEFT, timestamp++)
|
||||
|
||||
#define RELEASE Test::pointerButtonReleased(BTN_LEFT, timestamp++)
|
||||
|
||||
std::tuple<Window *, std::unique_ptr<KWayland::Client::Surface>, std::unique_ptr<Test::XdgToplevel>, std::unique_ptr<Test::XdgToplevelDecorationV1>> DecorationInputTest::showWindow()
|
||||
{
|
||||
#define VERIFY(statement) \
|
||||
if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__)) \
|
||||
return {nullptr, nullptr, nullptr, nullptr};
|
||||
#define COMPARE(actual, expected) \
|
||||
if (!QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__)) \
|
||||
return {nullptr, nullptr, nullptr, nullptr};
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface{Test::createSurface()};
|
||||
VERIFY(surface.get());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get(), Test::CreationSetup::CreateOnly);
|
||||
VERIFY(shellSurface.get());
|
||||
std::unique_ptr<Test::XdgToplevelDecorationV1> decoration = Test::createXdgToplevelDecorationV1(shellSurface.get());
|
||||
VERIFY(decoration.get());
|
||||
|
||||
QSignalSpy decorationConfigureRequestedSpy(decoration.get(), &Test::XdgToplevelDecorationV1::configureRequested);
|
||||
QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
|
||||
|
||||
decoration->set_mode(Test::XdgToplevelDecorationV1::mode_server_side);
|
||||
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
||||
VERIFY(surfaceConfigureRequestedSpy.wait());
|
||||
COMPARE(decorationConfigureRequestedSpy.last().at(0).value<Test::XdgToplevelDecorationV1::mode>(), Test::XdgToplevelDecorationV1::mode_server_side);
|
||||
|
||||
// let's render
|
||||
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
|
||||
auto window = Test::renderAndWaitForShown(surface.get(), QSize(500, 50), Qt::blue);
|
||||
VERIFY(window);
|
||||
COMPARE(workspace()->activeWindow(), window);
|
||||
|
||||
#undef VERIFY
|
||||
#undef COMPARE
|
||||
|
||||
return {window, std::move(surface), std::move(shellSurface), std::move(decoration)};
|
||||
}
|
||||
|
||||
void DecorationInputTest::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::Window *>();
|
||||
qRegisterMetaType<KWin::InternalWindow *>();
|
||||
QVERIFY(waylandServer()->init(s_socketName));
|
||||
Test::setOutputConfig({
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
});
|
||||
|
||||
// change some options
|
||||
KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
config->group(QStringLiteral("MouseBindings")).writeEntry("CommandTitlebarWheel", QStringLiteral("above/below"));
|
||||
config->group(QStringLiteral("Windows")).writeEntry("TitlebarDoubleClickCommand", QStringLiteral("OnAllDesktops"));
|
||||
config->group(QStringLiteral("Desktops")).writeEntry("Number", 2);
|
||||
config->sync();
|
||||
|
||||
kwinApp()->setConfig(config);
|
||||
|
||||
kwinApp()->start();
|
||||
const auto outputs = workspace()->outputs();
|
||||
QCOMPARE(outputs.count(), 2);
|
||||
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
|
||||
setenv("QT_QPA_PLATFORM", "wayland", true);
|
||||
}
|
||||
|
||||
void DecorationInputTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::Seat | Test::AdditionalWaylandInterface::XdgDecorationV1));
|
||||
QVERIFY(Test::waitForWaylandPointer());
|
||||
|
||||
workspace()->setActiveOutput(QPoint(640, 512));
|
||||
input()->pointer()->warp(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void DecorationInputTest::cleanup()
|
||||
{
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void DecorationInputTest::testAxis_data()
|
||||
{
|
||||
QTest::addColumn<QPoint>("decoPoint");
|
||||
QTest::addColumn<Qt::WindowFrameSection>("expectedSection");
|
||||
|
||||
QTest::newRow("topLeft") << QPoint(0, 0) << Qt::TopLeftSection;
|
||||
QTest::newRow("top") << QPoint(250, 0) << Qt::TopSection;
|
||||
QTest::newRow("topRight") << QPoint(499, 0) << Qt::TopRightSection;
|
||||
}
|
||||
|
||||
void DecorationInputTest::testAxis()
|
||||
{
|
||||
static constexpr double oneTick = 15;
|
||||
|
||||
const auto [window, surface, shellSurface, decoration] = showWindow();
|
||||
QVERIFY(window);
|
||||
QVERIFY(window->isDecorated());
|
||||
QVERIFY(!window->noBorder());
|
||||
QCOMPARE(window->titlebarPosition(), Qt::TopEdge);
|
||||
QVERIFY(!window->keepAbove());
|
||||
QVERIFY(!window->keepBelow());
|
||||
|
||||
quint32 timestamp = 1;
|
||||
MOTION(QPoint(window->frameGeometry().center().x(), window->frameMargins().top() / 2.0));
|
||||
QVERIFY(input()->pointer()->decoration());
|
||||
QCOMPARE(input()->pointer()->decoration()->decoration()->sectionUnderMouse(), Qt::TitleBarArea);
|
||||
|
||||
// TODO: mouse wheel direction looks wrong to me
|
||||
// simulate wheel
|
||||
Test::pointerAxisVertical(oneTick, timestamp++);
|
||||
QVERIFY(window->keepBelow());
|
||||
QVERIFY(!window->keepAbove());
|
||||
Test::pointerAxisVertical(-oneTick, timestamp++);
|
||||
QVERIFY(!window->keepBelow());
|
||||
QVERIFY(!window->keepAbove());
|
||||
Test::pointerAxisVertical(-oneTick, timestamp++);
|
||||
QVERIFY(!window->keepBelow());
|
||||
QVERIFY(window->keepAbove());
|
||||
|
||||
// test top most deco pixel, BUG: 362860
|
||||
window->move(QPoint(0, 0));
|
||||
QFETCH(QPoint, decoPoint);
|
||||
MOTION(decoPoint);
|
||||
QVERIFY(input()->pointer()->decoration());
|
||||
QCOMPARE(input()->pointer()->decoration()->window(), window);
|
||||
QTEST(input()->pointer()->decoration()->decoration()->sectionUnderMouse(), "expectedSection");
|
||||
Test::pointerAxisVertical(oneTick, timestamp++);
|
||||
QVERIFY(!window->keepBelow());
|
||||
QVERIFY(!window->keepAbove());
|
||||
}
|
||||
|
||||
void KWin::DecorationInputTest::testDoubleClickOnAllDesktops()
|
||||
{
|
||||
KConfigGroup group = kwinApp()->config()->group(QStringLiteral("Windows"));
|
||||
group.writeEntry("TitlebarDoubleClickCommand", QStringLiteral("OnAllDesktops"));
|
||||
group.sync();
|
||||
workspace()->slotReconfigure();
|
||||
|
||||
const auto [window, surface, shellSurface, decoration] = showWindow();
|
||||
QVERIFY(window);
|
||||
QVERIFY(window->isDecorated());
|
||||
QVERIFY(!window->noBorder());
|
||||
QVERIFY(!window->isOnAllDesktops());
|
||||
quint32 timestamp = 1;
|
||||
MOTION(QPoint(window->frameGeometry().center().x(), window->frameMargins().top() / 2.0));
|
||||
|
||||
// double click
|
||||
PRESS;
|
||||
RELEASE;
|
||||
PRESS;
|
||||
RELEASE;
|
||||
QVERIFY(window->isOnAllDesktops());
|
||||
// double click again
|
||||
PRESS;
|
||||
RELEASE;
|
||||
QVERIFY(window->isOnAllDesktops());
|
||||
PRESS;
|
||||
RELEASE;
|
||||
QVERIFY(!window->isOnAllDesktops());
|
||||
}
|
||||
|
||||
void DecorationInputTest::testDoubleClickClose()
|
||||
{
|
||||
// this test verifies that no crash occurs when double click is configured to close action
|
||||
KConfigGroup group = kwinApp()->config()->group(QStringLiteral("Windows"));
|
||||
group.writeEntry("TitlebarDoubleClickCommand", QStringLiteral("Close"));
|
||||
group.sync();
|
||||
workspace()->slotReconfigure();
|
||||
|
||||
auto [window, surface, shellSurface, decoration] = showWindow();
|
||||
QVERIFY(window);
|
||||
QVERIFY(window->isDecorated());
|
||||
quint32 timestamp = 1;
|
||||
MOTION(QPoint(window->frameGeometry().center().x(), window->frameMargins().top() / 2.0));
|
||||
|
||||
connect(shellSurface.get(), &Test::XdgToplevel::closeRequested, this, [&surface = surface]() {
|
||||
surface.reset();
|
||||
});
|
||||
|
||||
// double click
|
||||
QSignalSpy closedSpy(window, &Window::closed);
|
||||
window->ref();
|
||||
PRESS;
|
||||
RELEASE;
|
||||
PRESS;
|
||||
QVERIFY(closedSpy.wait());
|
||||
RELEASE;
|
||||
|
||||
QVERIFY(window->isDeleted());
|
||||
window->unref();
|
||||
}
|
||||
|
||||
void KWin::DecorationInputTest::testDoubleTap()
|
||||
{
|
||||
KConfigGroup group = kwinApp()->config()->group(QStringLiteral("Windows"));
|
||||
group.writeEntry("TitlebarDoubleClickCommand", QStringLiteral("OnAllDesktops"));
|
||||
group.sync();
|
||||
workspace()->slotReconfigure();
|
||||
|
||||
const auto [window, surface, shellSurface, decoration] = showWindow();
|
||||
QVERIFY(window);
|
||||
QVERIFY(window->isDecorated());
|
||||
QVERIFY(!window->noBorder());
|
||||
QVERIFY(!window->isOnAllDesktops());
|
||||
quint32 timestamp = 1;
|
||||
const QPoint tapPoint(window->frameGeometry().center().x(), window->frameMargins().top() / 2.0);
|
||||
|
||||
// double tap
|
||||
Test::touchDown(0, tapPoint, timestamp++);
|
||||
Test::touchUp(0, timestamp++);
|
||||
Test::touchDown(0, tapPoint, timestamp++);
|
||||
Test::touchUp(0, timestamp++);
|
||||
QVERIFY(window->isOnAllDesktops());
|
||||
// double tap again
|
||||
Test::touchDown(0, tapPoint, timestamp++);
|
||||
Test::touchUp(0, timestamp++);
|
||||
QVERIFY(window->isOnAllDesktops());
|
||||
Test::touchDown(0, tapPoint, timestamp++);
|
||||
Test::touchUp(0, timestamp++);
|
||||
QVERIFY(!window->isOnAllDesktops());
|
||||
}
|
||||
|
||||
void DecorationInputTest::testHover()
|
||||
{
|
||||
const auto [window, surface, shellSurface, decoration] = showWindow();
|
||||
QVERIFY(window);
|
||||
QVERIFY(window->isDecorated());
|
||||
QVERIFY(!window->noBorder());
|
||||
|
||||
// our left border is moved out of the visible area, so move the window to a better place
|
||||
window->move(QPoint(20, 0));
|
||||
|
||||
quint32 timestamp = 1;
|
||||
MOTION(QPoint(window->frameGeometry().center().x(), window->frameMargins().top() / 2.0));
|
||||
QCOMPARE(window->cursor(), CursorShape(Qt::ArrowCursor));
|
||||
|
||||
// There is a mismatch of the cursor key positions between windows
|
||||
// with and without borders (with borders one can move inside a bit and still
|
||||
// be on an edge, without not). We should make this consistent in KWin's core.
|
||||
//
|
||||
// TODO: Test input position with different border sizes.
|
||||
// TODO: We should test with the fake decoration to have a fixed test environment.
|
||||
const bool hasBorders = Workspace::self()->decorationBridge()->settings()->borderSize() != KDecoration3::BorderSize::None;
|
||||
auto deviation = [hasBorders] {
|
||||
return hasBorders ? -1 : 0;
|
||||
};
|
||||
|
||||
MOTION(QPoint(window->frameGeometry().x(), 0));
|
||||
QCOMPARE(window->cursor(), CursorShape(KWin::ExtendedCursor::SizeNorthWest));
|
||||
MOTION(QPoint(window->frameGeometry().x() + window->frameGeometry().width() / 2, 0));
|
||||
QCOMPARE(window->cursor(), CursorShape(KWin::ExtendedCursor::SizeNorth));
|
||||
MOTION(QPoint(window->frameGeometry().x() + window->frameGeometry().width() - 1, 0));
|
||||
QCOMPARE(window->cursor(), CursorShape(KWin::ExtendedCursor::SizeNorthEast));
|
||||
MOTION(QPoint(window->frameGeometry().x() + window->frameGeometry().width() + deviation(), window->height() / 2));
|
||||
QCOMPARE(window->cursor(), CursorShape(KWin::ExtendedCursor::SizeEast));
|
||||
MOTION(QPoint(window->frameGeometry().x() + window->frameGeometry().width() + deviation(), window->height() - 1));
|
||||
QCOMPARE(window->cursor(), CursorShape(KWin::ExtendedCursor::SizeSouthEast));
|
||||
MOTION(QPoint(window->frameGeometry().x() + window->frameGeometry().width() / 2, window->height() + deviation()));
|
||||
QCOMPARE(window->cursor(), CursorShape(KWin::ExtendedCursor::SizeSouth));
|
||||
MOTION(QPoint(window->frameGeometry().x(), window->height() + deviation()));
|
||||
QCOMPARE(window->cursor(), CursorShape(KWin::ExtendedCursor::SizeSouthWest));
|
||||
MOTION(QPoint(window->frameGeometry().x() - 1, window->height() / 2));
|
||||
QCOMPARE(window->cursor(), CursorShape(KWin::ExtendedCursor::SizeWest));
|
||||
|
||||
MOTION(window->frameGeometry().center());
|
||||
QEXPECT_FAIL("", "Cursor not set back on leave", Continue);
|
||||
QCOMPARE(window->cursor(), CursorShape(Qt::ArrowCursor));
|
||||
}
|
||||
|
||||
void DecorationInputTest::testPressToMove_data()
|
||||
{
|
||||
QTest::addColumn<QPoint>("offset");
|
||||
QTest::addColumn<QPoint>("offset2");
|
||||
QTest::addColumn<QPoint>("offset3");
|
||||
|
||||
QTest::newRow("To right") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0);
|
||||
QTest::newRow("To left") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0);
|
||||
QTest::newRow("To bottom") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30);
|
||||
QTest::newRow("To top") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30);
|
||||
}
|
||||
|
||||
void DecorationInputTest::testPressToMove()
|
||||
{
|
||||
const auto [window, surface, shellSurface, decoration] = showWindow();
|
||||
QVERIFY(window);
|
||||
QVERIFY(window->isDecorated());
|
||||
QVERIFY(!window->noBorder());
|
||||
window->move(workspace()->activeOutput()->geometry().center() - QPoint(window->width() / 2, window->height() / 2));
|
||||
QSignalSpy interactiveMoveResizeStartedSpy(window, &Window::interactiveMoveResizeStarted);
|
||||
QSignalSpy interactiveMoveResizeFinishedSpy(window, &Window::interactiveMoveResizeFinished);
|
||||
|
||||
quint32 timestamp = 1;
|
||||
MOTION(QPoint(window->frameGeometry().center().x(), window->y() + window->frameMargins().top() / 2.0));
|
||||
QCOMPARE(window->cursor(), CursorShape(Qt::ArrowCursor));
|
||||
|
||||
PRESS;
|
||||
QVERIFY(!window->isInteractiveMove());
|
||||
QFETCH(QPoint, offset);
|
||||
MOTION(QPoint(window->frameGeometry().center().x(), window->y() + window->frameMargins().top() / 2.0) + offset);
|
||||
const QPointF oldPos = window->pos();
|
||||
QVERIFY(window->isInteractiveMove());
|
||||
QCOMPARE(interactiveMoveResizeStartedSpy.count(), 1);
|
||||
|
||||
RELEASE;
|
||||
QTRY_VERIFY(!window->isInteractiveMove());
|
||||
QCOMPARE(interactiveMoveResizeFinishedSpy.count(), 1);
|
||||
QEXPECT_FAIL("", "Just trigger move doesn't move the window", Continue);
|
||||
QCOMPARE(window->pos(), oldPos + offset);
|
||||
|
||||
// again
|
||||
PRESS;
|
||||
QVERIFY(!window->isInteractiveMove());
|
||||
QFETCH(QPoint, offset2);
|
||||
MOTION(QPoint(window->frameGeometry().center().x(), window->y() + window->frameMargins().top() / 2.0) + offset2);
|
||||
QVERIFY(window->isInteractiveMove());
|
||||
QCOMPARE(interactiveMoveResizeStartedSpy.count(), 2);
|
||||
QFETCH(QPoint, offset3);
|
||||
MOTION(QPoint(window->frameGeometry().center().x(), window->y() + window->frameMargins().top() / 2.0) + offset3);
|
||||
|
||||
RELEASE;
|
||||
QTRY_VERIFY(!window->isInteractiveMove());
|
||||
QCOMPARE(interactiveMoveResizeFinishedSpy.count(), 2);
|
||||
// TODO: the offset should also be included
|
||||
QCOMPARE(window->pos(), oldPos + offset2 + offset3);
|
||||
}
|
||||
|
||||
void DecorationInputTest::testTapToMove_data()
|
||||
{
|
||||
QTest::addColumn<QPoint>("offset");
|
||||
QTest::addColumn<QPoint>("offset2");
|
||||
QTest::addColumn<QPoint>("offset3");
|
||||
|
||||
QTest::newRow("To right") << QPoint(10, 0) << QPoint(20, 0) << QPoint(30, 0);
|
||||
QTest::newRow("To left") << QPoint(-10, 0) << QPoint(-20, 0) << QPoint(-30, 0);
|
||||
QTest::newRow("To bottom") << QPoint(0, 10) << QPoint(0, 20) << QPoint(0, 30);
|
||||
QTest::newRow("To top") << QPoint(0, -10) << QPoint(0, -20) << QPoint(0, -30);
|
||||
}
|
||||
|
||||
void DecorationInputTest::testTapToMove()
|
||||
{
|
||||
const auto [window, surface, shellSurface, decoration] = showWindow();
|
||||
QVERIFY(window);
|
||||
QVERIFY(window->isDecorated());
|
||||
QVERIFY(!window->noBorder());
|
||||
window->move(workspace()->activeOutput()->geometry().center() - QPoint(window->width() / 2, window->height() / 2));
|
||||
QSignalSpy interactiveMoveResizeStartedSpy(window, &Window::interactiveMoveResizeStarted);
|
||||
QSignalSpy interactiveMoveResizeFinishedSpy(window, &Window::interactiveMoveResizeFinished);
|
||||
|
||||
quint32 timestamp = 1;
|
||||
QPoint p = QPoint(window->frameGeometry().center().x(), window->y() + window->frameMargins().top() / 2.0);
|
||||
|
||||
Test::touchDown(0, p, timestamp++);
|
||||
QVERIFY(!window->isInteractiveMove());
|
||||
QFETCH(QPoint, offset);
|
||||
QCOMPARE(input()->touch()->decorationPressId(), 0);
|
||||
Test::touchMotion(0, p + offset, timestamp++);
|
||||
const QPointF oldPos = window->pos();
|
||||
QVERIFY(window->isInteractiveMove());
|
||||
QCOMPARE(interactiveMoveResizeStartedSpy.count(), 1);
|
||||
|
||||
Test::touchUp(0, timestamp++);
|
||||
QTRY_VERIFY(!window->isInteractiveMove());
|
||||
QCOMPARE(interactiveMoveResizeFinishedSpy.count(), 1);
|
||||
QEXPECT_FAIL("", "Just trigger move doesn't move the window", Continue);
|
||||
QCOMPARE(window->pos(), oldPos + offset);
|
||||
|
||||
// again
|
||||
Test::touchDown(1, p + offset, timestamp++);
|
||||
QCOMPARE(input()->touch()->decorationPressId(), 1);
|
||||
QVERIFY(!window->isInteractiveMove());
|
||||
QFETCH(QPoint, offset2);
|
||||
Test::touchMotion(1, QPoint(window->frameGeometry().center().x(), window->y() + window->frameMargins().top() / 2.0) + offset2, timestamp++);
|
||||
QVERIFY(window->isInteractiveMove());
|
||||
QCOMPARE(interactiveMoveResizeStartedSpy.count(), 2);
|
||||
QFETCH(QPoint, offset3);
|
||||
Test::touchMotion(1, QPoint(window->frameGeometry().center().x(), window->y() + window->frameMargins().top() / 2.0) + offset3, timestamp++);
|
||||
|
||||
Test::touchUp(1, timestamp++);
|
||||
QTRY_VERIFY(!window->isInteractiveMove());
|
||||
QCOMPARE(interactiveMoveResizeFinishedSpy.count(), 2);
|
||||
// TODO: the offset should also be included
|
||||
QCOMPARE(window->pos(), oldPos + offset2 + offset3);
|
||||
}
|
||||
|
||||
void DecorationInputTest::testResizeOutsideWindow_data()
|
||||
{
|
||||
QTest::addColumn<Qt::Edge>("edge");
|
||||
QTest::addColumn<Qt::CursorShape>("expectedCursor");
|
||||
|
||||
QTest::newRow("left") << Qt::LeftEdge << Qt::SizeHorCursor;
|
||||
QTest::newRow("right") << Qt::RightEdge << Qt::SizeHorCursor;
|
||||
QTest::newRow("bottom") << Qt::BottomEdge << Qt::SizeVerCursor;
|
||||
}
|
||||
|
||||
void DecorationInputTest::testResizeOutsideWindow()
|
||||
{
|
||||
// this test verifies that one can resize the window outside the decoration with NoSideBorder
|
||||
|
||||
// first adjust config
|
||||
kwinApp()->config()->group(QStringLiteral("org.kde.kdecoration2")).writeEntry("BorderSize", QStringLiteral("None"));
|
||||
kwinApp()->config()->sync();
|
||||
workspace()->slotReconfigure();
|
||||
|
||||
// now create window
|
||||
const auto [window, surface, shellSurface, decoration] = showWindow();
|
||||
QVERIFY(window);
|
||||
QVERIFY(window->isDecorated());
|
||||
QVERIFY(!window->noBorder());
|
||||
window->move(workspace()->activeOutput()->geometry().center() - QPoint(window->width() / 2, window->height() / 2));
|
||||
QSignalSpy interactiveMoveResizeStartedSpy(window, &Window::interactiveMoveResizeStarted);
|
||||
|
||||
// go to border
|
||||
quint32 timestamp = 1;
|
||||
QFETCH(Qt::Edge, edge);
|
||||
switch (edge) {
|
||||
case Qt::LeftEdge:
|
||||
MOTION(QPoint(window->frameGeometry().x() - 1, window->frameGeometry().center().y()));
|
||||
break;
|
||||
case Qt::RightEdge:
|
||||
MOTION(QPoint(window->frameGeometry().x() + window->frameGeometry().width() + 1, window->frameGeometry().center().y()));
|
||||
break;
|
||||
case Qt::BottomEdge:
|
||||
MOTION(QPoint(window->frameGeometry().center().x(), window->frameGeometry().y() + window->frameGeometry().height() + 1));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
QVERIFY(!exclusiveContains(window->frameGeometry(), KWin::Cursors::self()->mouse()->pos()));
|
||||
|
||||
// pressing should trigger resize
|
||||
PRESS;
|
||||
QVERIFY(!window->isInteractiveResize());
|
||||
QVERIFY(interactiveMoveResizeStartedSpy.wait());
|
||||
QVERIFY(window->isInteractiveResize());
|
||||
|
||||
RELEASE;
|
||||
QVERIFY(!window->isInteractiveResize());
|
||||
}
|
||||
|
||||
void DecorationInputTest::testModifierClickUnrestrictedMove_data()
|
||||
{
|
||||
QTest::addColumn<int>("modifierKey");
|
||||
QTest::addColumn<int>("mouseButton");
|
||||
QTest::addColumn<QString>("modKey");
|
||||
QTest::addColumn<bool>("capsLock");
|
||||
|
||||
const QString alt = QStringLiteral("Alt");
|
||||
const QString meta = QStringLiteral("Meta");
|
||||
|
||||
QTest::newRow("Left Alt + Left Click") << KEY_LEFTALT << BTN_LEFT << alt << false;
|
||||
QTest::newRow("Left Alt + Right Click") << KEY_LEFTALT << BTN_RIGHT << alt << false;
|
||||
QTest::newRow("Left Alt + Middle Click") << KEY_LEFTALT << BTN_MIDDLE << alt << false;
|
||||
QTest::newRow("Right Alt + Left Click") << KEY_RIGHTALT << BTN_LEFT << alt << false;
|
||||
QTest::newRow("Right Alt + Right Click") << KEY_RIGHTALT << BTN_RIGHT << alt << false;
|
||||
QTest::newRow("Right Alt + Middle Click") << KEY_RIGHTALT << BTN_MIDDLE << alt << false;
|
||||
// now everything with meta
|
||||
QTest::newRow("Left Meta + Left Click") << KEY_LEFTMETA << BTN_LEFT << meta << false;
|
||||
QTest::newRow("Left Meta + Right Click") << KEY_LEFTMETA << BTN_RIGHT << meta << false;
|
||||
QTest::newRow("Left Meta + Middle Click") << KEY_LEFTMETA << BTN_MIDDLE << meta << false;
|
||||
QTest::newRow("Right Meta + Left Click") << KEY_RIGHTMETA << BTN_LEFT << meta << false;
|
||||
QTest::newRow("Right Meta + Right Click") << KEY_RIGHTMETA << BTN_RIGHT << meta << false;
|
||||
QTest::newRow("Right Meta + Middle Click") << KEY_RIGHTMETA << BTN_MIDDLE << meta << false;
|
||||
|
||||
// and with capslock
|
||||
QTest::newRow("Left Alt + Left Click/CapsLock") << KEY_LEFTALT << BTN_LEFT << alt << true;
|
||||
QTest::newRow("Left Alt + Right Click/CapsLock") << KEY_LEFTALT << BTN_RIGHT << alt << true;
|
||||
QTest::newRow("Left Alt + Middle Click/CapsLock") << KEY_LEFTALT << BTN_MIDDLE << alt << true;
|
||||
QTest::newRow("Right Alt + Left Click/CapsLock") << KEY_RIGHTALT << BTN_LEFT << alt << true;
|
||||
QTest::newRow("Right Alt + Right Click/CapsLock") << KEY_RIGHTALT << BTN_RIGHT << alt << true;
|
||||
QTest::newRow("Right Alt + Middle Click/CapsLock") << KEY_RIGHTALT << BTN_MIDDLE << alt << true;
|
||||
// now everything with meta
|
||||
QTest::newRow("Left Meta + Left Click/CapsLock") << KEY_LEFTMETA << BTN_LEFT << meta << true;
|
||||
QTest::newRow("Left Meta + Right Click/CapsLock") << KEY_LEFTMETA << BTN_RIGHT << meta << true;
|
||||
QTest::newRow("Left Meta + Middle Click/CapsLock") << KEY_LEFTMETA << BTN_MIDDLE << meta << true;
|
||||
QTest::newRow("Right Meta + Left Click/CapsLock") << KEY_RIGHTMETA << BTN_LEFT << meta << true;
|
||||
QTest::newRow("Right Meta + Right Click/CapsLock") << KEY_RIGHTMETA << BTN_RIGHT << meta << true;
|
||||
QTest::newRow("Right Meta + Middle Click/CapsLock") << KEY_RIGHTMETA << BTN_MIDDLE << meta << true;
|
||||
}
|
||||
|
||||
void DecorationInputTest::testModifierClickUnrestrictedMove()
|
||||
{
|
||||
// this test ensures that Alt+mouse button press triggers unrestricted move
|
||||
|
||||
// first modify the config for this run
|
||||
QFETCH(QString, modKey);
|
||||
KConfigGroup group = kwinApp()->config()->group(QStringLiteral("MouseBindings"));
|
||||
group.writeEntry("CommandAllKey", modKey);
|
||||
group.writeEntry("CommandAll1", "Move");
|
||||
group.writeEntry("CommandAll2", "Move");
|
||||
group.writeEntry("CommandAll3", "Move");
|
||||
group.sync();
|
||||
workspace()->slotReconfigure();
|
||||
QCOMPARE(options->commandAllModifier(), modKey == QStringLiteral("Alt") ? Qt::AltModifier : Qt::MetaModifier);
|
||||
QCOMPARE(options->commandAll1(), Options::MouseUnrestrictedMove);
|
||||
QCOMPARE(options->commandAll2(), Options::MouseUnrestrictedMove);
|
||||
QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove);
|
||||
|
||||
// create a window
|
||||
const auto [window, surface, shellSurface, decoration] = showWindow();
|
||||
QVERIFY(window);
|
||||
QVERIFY(window->isDecorated());
|
||||
QVERIFY(!window->noBorder());
|
||||
window->move(workspace()->activeOutput()->geometry().center() - QPoint(window->width() / 2, window->height() / 2));
|
||||
// move cursor on window
|
||||
input()->pointer()->warp(QPoint(window->frameGeometry().center().x(), window->y() + window->frameMargins().top() / 2.0));
|
||||
|
||||
// simulate modifier+click
|
||||
quint32 timestamp = 1;
|
||||
QFETCH(bool, capsLock);
|
||||
if (capsLock) {
|
||||
Test::keyboardKeyPressed(KEY_CAPSLOCK, timestamp++);
|
||||
}
|
||||
QFETCH(int, modifierKey);
|
||||
QFETCH(int, mouseButton);
|
||||
Test::keyboardKeyPressed(modifierKey, timestamp++);
|
||||
QVERIFY(!window->isInteractiveMove());
|
||||
Test::pointerButtonPressed(mouseButton, timestamp++);
|
||||
QVERIFY(window->isInteractiveMove());
|
||||
// release modifier should not change it
|
||||
Test::keyboardKeyReleased(modifierKey, timestamp++);
|
||||
QVERIFY(window->isInteractiveMove());
|
||||
// but releasing the key should end move/resize
|
||||
Test::pointerButtonReleased(mouseButton, timestamp++);
|
||||
QVERIFY(!window->isInteractiveMove());
|
||||
if (capsLock) {
|
||||
Test::keyboardKeyReleased(KEY_CAPSLOCK, timestamp++);
|
||||
}
|
||||
}
|
||||
|
||||
void DecorationInputTest::testModifierScrollOpacity_data()
|
||||
{
|
||||
QTest::addColumn<int>("modifierKey");
|
||||
QTest::addColumn<QString>("modKey");
|
||||
QTest::addColumn<bool>("capsLock");
|
||||
|
||||
const QString alt = QStringLiteral("Alt");
|
||||
const QString meta = QStringLiteral("Meta");
|
||||
|
||||
QTest::newRow("Left Alt") << KEY_LEFTALT << alt << false;
|
||||
QTest::newRow("Right Alt") << KEY_RIGHTALT << alt << false;
|
||||
QTest::newRow("Left Meta") << KEY_LEFTMETA << meta << false;
|
||||
QTest::newRow("Right Meta") << KEY_RIGHTMETA << meta << false;
|
||||
QTest::newRow("Left Alt/CapsLock") << KEY_LEFTALT << alt << true;
|
||||
QTest::newRow("Right Alt/CapsLock") << KEY_RIGHTALT << alt << true;
|
||||
QTest::newRow("Left Meta/CapsLock") << KEY_LEFTMETA << meta << true;
|
||||
QTest::newRow("Right Meta/CapsLock") << KEY_RIGHTMETA << meta << true;
|
||||
}
|
||||
|
||||
void DecorationInputTest::testModifierScrollOpacity()
|
||||
{
|
||||
// this test verifies that mod+wheel performs a window operation
|
||||
|
||||
// first modify the config for this run
|
||||
QFETCH(QString, modKey);
|
||||
KConfigGroup group = kwinApp()->config()->group(QStringLiteral("MouseBindings"));
|
||||
group.writeEntry("CommandAllKey", modKey);
|
||||
group.writeEntry("CommandAllWheel", "change opacity");
|
||||
group.sync();
|
||||
workspace()->slotReconfigure();
|
||||
|
||||
const auto [window, surface, shellSurface, decoration] = showWindow();
|
||||
QVERIFY(window);
|
||||
QVERIFY(window->isDecorated());
|
||||
QVERIFY(!window->noBorder());
|
||||
window->move(workspace()->activeOutput()->geometry().center() - QPoint(window->width() / 2, window->height() / 2));
|
||||
// move cursor on window
|
||||
input()->pointer()->warp(QPoint(window->frameGeometry().center().x(), window->y() + window->frameMargins().top() / 2.0));
|
||||
// set the opacity to 0.5
|
||||
window->setOpacity(0.5);
|
||||
QCOMPARE(window->opacity(), 0.5);
|
||||
|
||||
// simulate modifier+wheel
|
||||
quint32 timestamp = 1;
|
||||
QFETCH(bool, capsLock);
|
||||
if (capsLock) {
|
||||
Test::keyboardKeyPressed(KEY_CAPSLOCK, timestamp++);
|
||||
}
|
||||
QFETCH(int, modifierKey);
|
||||
Test::keyboardKeyPressed(modifierKey, timestamp++);
|
||||
Test::pointerAxisVertical(-5, timestamp++);
|
||||
QCOMPARE(window->opacity(), 0.6);
|
||||
Test::pointerAxisVertical(5, timestamp++);
|
||||
QCOMPARE(window->opacity(), 0.5);
|
||||
Test::keyboardKeyReleased(modifierKey, timestamp++);
|
||||
if (capsLock) {
|
||||
Test::keyboardKeyReleased(KEY_CAPSLOCK, timestamp++);
|
||||
}
|
||||
}
|
||||
|
||||
class EventHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
EventHelper()
|
||||
: QObject()
|
||||
{
|
||||
}
|
||||
~EventHelper() override = default;
|
||||
|
||||
bool eventFilter(QObject *watched, QEvent *event) override
|
||||
{
|
||||
if (event->type() == QEvent::HoverMove) {
|
||||
Q_EMIT hoverMove();
|
||||
} else if (event->type() == QEvent::HoverLeave) {
|
||||
Q_EMIT hoverLeave();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Q_SIGNALS:
|
||||
void hoverMove();
|
||||
void hoverLeave();
|
||||
};
|
||||
|
||||
void DecorationInputTest::testTouchEvents()
|
||||
{
|
||||
// this test verifies that the decoration gets a hover leave event on touch release
|
||||
// see BUG 386231
|
||||
const auto [window, surface, shellSurface, decoration] = showWindow();
|
||||
QVERIFY(window);
|
||||
QVERIFY(window->isDecorated());
|
||||
QVERIFY(!window->noBorder());
|
||||
|
||||
EventHelper helper;
|
||||
window->decoration()->installEventFilter(&helper);
|
||||
QSignalSpy hoverMoveSpy(&helper, &EventHelper::hoverMove);
|
||||
QSignalSpy hoverLeaveSpy(&helper, &EventHelper::hoverLeave);
|
||||
|
||||
quint32 timestamp = 1;
|
||||
const QPoint tapPoint(window->frameGeometry().center().x(), window->frameMargins().top() / 2.0);
|
||||
|
||||
QVERIFY(!input()->touch()->decoration());
|
||||
Test::touchDown(0, tapPoint, timestamp++);
|
||||
QVERIFY(input()->touch()->decoration());
|
||||
QCOMPARE(input()->touch()->decoration()->decoration(), window->decoration());
|
||||
QCOMPARE(hoverMoveSpy.count(), 1);
|
||||
QCOMPARE(hoverLeaveSpy.count(), 0);
|
||||
Test::touchUp(0, timestamp++);
|
||||
QCOMPARE(hoverMoveSpy.count(), 1);
|
||||
QCOMPARE(hoverLeaveSpy.count(), 1);
|
||||
|
||||
QCOMPARE(window->isInteractiveMove(), false);
|
||||
|
||||
// let's check that a hover motion is sent if the pointer is on deco, when touch release
|
||||
input()->pointer()->warp(tapPoint);
|
||||
QCOMPARE(hoverMoveSpy.count(), 2);
|
||||
Test::touchDown(0, tapPoint, timestamp++);
|
||||
QCOMPARE(hoverMoveSpy.count(), 3);
|
||||
QCOMPARE(hoverLeaveSpy.count(), 1);
|
||||
Test::touchUp(0, timestamp++);
|
||||
QCOMPARE(hoverMoveSpy.count(), 3);
|
||||
QCOMPARE(hoverLeaveSpy.count(), 2);
|
||||
}
|
||||
|
||||
void DecorationInputTest::testTooltipDoesntEatKeyEvents()
|
||||
{
|
||||
// this test verifies that a tooltip on the decoration does not steal key events
|
||||
// BUG: 393253
|
||||
|
||||
// first create a keyboard
|
||||
auto keyboard = Test::waylandSeat()->createKeyboard(Test::waylandSeat());
|
||||
QVERIFY(keyboard);
|
||||
QSignalSpy enteredSpy(keyboard, &KWayland::Client::Keyboard::entered);
|
||||
|
||||
const auto [window, surface, shellSurface, decoration] = showWindow();
|
||||
QVERIFY(window);
|
||||
QVERIFY(window->isDecorated());
|
||||
QVERIFY(!window->noBorder());
|
||||
QVERIFY(enteredSpy.wait());
|
||||
|
||||
QSignalSpy keyEvent(keyboard, &KWayland::Client::Keyboard::keyChanged);
|
||||
QVERIFY(keyEvent.isValid());
|
||||
|
||||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
window->decoratedWindow()->requestShowToolTip(QStringLiteral("test"));
|
||||
// now we should get an internal window
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
InternalWindow *internal = windowAddedSpy.first().first().value<InternalWindow *>();
|
||||
QVERIFY(internal->isInternal());
|
||||
QVERIFY(internal->handle()->flags().testFlag(Qt::ToolTip));
|
||||
|
||||
// now send a key
|
||||
quint32 timestamp = 0;
|
||||
Test::keyboardKeyPressed(KEY_A, timestamp++);
|
||||
QVERIFY(keyEvent.wait());
|
||||
Test::keyboardKeyReleased(KEY_A, timestamp++);
|
||||
QVERIFY(keyEvent.wait());
|
||||
|
||||
window->decoratedWindow()->requestHideToolTip();
|
||||
Test::waitForWindowClosed(internal);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(KWin::DecorationInputTest)
|
||||
#include "decoration_input_test.moc"
|
||||
@@ -1,151 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "core/output.h"
|
||||
#include "pointer_input.h"
|
||||
#include "utils/xcbutils.h"
|
||||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
#include "x11window.h"
|
||||
|
||||
#include <netwm.h>
|
||||
#include <xcb/xcb_icccm.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_kwin_x11_desktop_window-0");
|
||||
|
||||
class X11DesktopWindowTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
void testDesktopWindow();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
void X11DesktopWindowTest::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::Window *>();
|
||||
QVERIFY(waylandServer()->init(s_socketName));
|
||||
Test::setOutputConfig({
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
});
|
||||
|
||||
kwinApp()->start();
|
||||
const auto outputs = workspace()->outputs();
|
||||
QCOMPARE(outputs.count(), 2);
|
||||
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
|
||||
setenv("QT_QPA_PLATFORM", "wayland", true);
|
||||
}
|
||||
|
||||
void X11DesktopWindowTest::init()
|
||||
{
|
||||
workspace()->setActiveOutput(QPoint(640, 512));
|
||||
input()->pointer()->warp(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void X11DesktopWindowTest::cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
void X11DesktopWindowTest::testDesktopWindow()
|
||||
{
|
||||
// this test creates a desktop window with an RGBA visual and verifies that it's only considered
|
||||
// as an RGB (opaque) window in KWin
|
||||
|
||||
// create an xcb window
|
||||
Test::XcbConnectionPtr c = Test::createX11Connection();
|
||||
QVERIFY(!xcb_connection_has_error(c.get()));
|
||||
|
||||
xcb_window_t windowId = xcb_generate_id(c.get());
|
||||
const QRect windowGeometry(0, 0, 1280, 1024);
|
||||
|
||||
// helper to find the visual
|
||||
auto findDepth = [&c]() -> xcb_visualid_t {
|
||||
// find a visual with 32 depth
|
||||
const xcb_setup_t *setup = xcb_get_setup(c.get());
|
||||
|
||||
for (auto screen = xcb_setup_roots_iterator(setup); screen.rem; xcb_screen_next(&screen)) {
|
||||
for (auto depth = xcb_screen_allowed_depths_iterator(screen.data); depth.rem; xcb_depth_next(&depth)) {
|
||||
if (depth.data->depth != 32) {
|
||||
continue;
|
||||
}
|
||||
const int len = xcb_depth_visuals_length(depth.data);
|
||||
const xcb_visualtype_t *visuals = xcb_depth_visuals(depth.data);
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
return visuals[0].visual_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
auto visualId = findDepth();
|
||||
auto colormapId = xcb_generate_id(c.get());
|
||||
auto cmCookie = xcb_create_colormap_checked(c.get(), XCB_COLORMAP_ALLOC_NONE, colormapId, rootWindow(), visualId);
|
||||
QVERIFY(!xcb_request_check(c.get(), cmCookie));
|
||||
|
||||
const uint32_t values[] = {XCB_PIXMAP_NONE, Xcb::defaultScreen()->black_pixel, colormapId};
|
||||
auto cookie = xcb_create_window_checked(c.get(), 32, windowId, rootWindow(),
|
||||
windowGeometry.x(),
|
||||
windowGeometry.y(),
|
||||
windowGeometry.width(),
|
||||
windowGeometry.height(),
|
||||
0, XCB_WINDOW_CLASS_INPUT_OUTPUT, visualId, XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_COLORMAP, values);
|
||||
QVERIFY(!xcb_request_check(c.get(), cookie));
|
||||
xcb_size_hints_t hints;
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
xcb_icccm_size_hints_set_position(&hints, 1, windowGeometry.x(), windowGeometry.y());
|
||||
xcb_icccm_size_hints_set_size(&hints, 1, windowGeometry.width(), windowGeometry.height());
|
||||
xcb_icccm_set_wm_normal_hints(c.get(), windowId, &hints);
|
||||
NETWinInfo info(c.get(), windowId, rootWindow(), NET::WMAllProperties, NET::WM2AllProperties);
|
||||
info.setWindowType(NET::Desktop);
|
||||
xcb_map_window(c.get(), windowId);
|
||||
xcb_flush(c.get());
|
||||
|
||||
// verify through a geometry request that it's depth 32
|
||||
Xcb::WindowGeometry geo(windowId);
|
||||
QCOMPARE(geo->depth, uint8_t(32));
|
||||
|
||||
// we should get a window for it
|
||||
QSignalSpy windowCreatedSpy(workspace(), &Workspace::windowAdded);
|
||||
QVERIFY(windowCreatedSpy.wait());
|
||||
X11Window *window = windowCreatedSpy.first().first().value<X11Window *>();
|
||||
QVERIFY(window);
|
||||
QCOMPARE(window->window(), windowId);
|
||||
QVERIFY(!window->isDecorated());
|
||||
QCOMPARE(window->windowType(), WindowType::Desktop);
|
||||
QCOMPARE(window->frameGeometry(), windowGeometry);
|
||||
QVERIFY(window->isDesktop());
|
||||
QCOMPARE(window->depth(), 24);
|
||||
QVERIFY(!window->hasAlpha());
|
||||
|
||||
// and destroy the window again
|
||||
xcb_unmap_window(c.get(), windowId);
|
||||
xcb_destroy_window(c.get(), windowId);
|
||||
xcb_flush(c.get());
|
||||
c.reset();
|
||||
|
||||
QSignalSpy windowClosedSpy(window, &X11Window::closed);
|
||||
QVERIFY(windowClosedSpy.wait());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(KWin::X11DesktopWindowTest)
|
||||
#include "desktop_window_x11_test.moc"
|
||||
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "core/output.h"
|
||||
#include "pointer_input.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
#include "x11window.h"
|
||||
|
||||
#include <KDecoration3/Decoration>
|
||||
|
||||
#include <QQuickItem>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_kwin_dont_crash_aurorae_destroy_deco-0");
|
||||
|
||||
class DontCrashAuroraeDestroyDecoTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void testBorderlessMaximizedWindows();
|
||||
};
|
||||
|
||||
void DontCrashAuroraeDestroyDecoTest::initTestCase()
|
||||
{
|
||||
if (!Test::renderNodeAvailable()) {
|
||||
QSKIP("no render node available");
|
||||
return;
|
||||
}
|
||||
qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
|
||||
qRegisterMetaType<KWin::Window *>();
|
||||
QVERIFY(waylandServer()->init(s_socketName));
|
||||
Test::setOutputConfig({
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
});
|
||||
|
||||
KSharedConfig::Ptr config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
config->group(QStringLiteral("org.kde.kdecoration2")).writeEntry("library", "org.kde.kwin.aurorae");
|
||||
config->sync();
|
||||
kwinApp()->setConfig(config);
|
||||
|
||||
// this test needs to enforce OpenGL compositing to get into the crashy condition
|
||||
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
|
||||
kwinApp()->start();
|
||||
const auto outputs = workspace()->outputs();
|
||||
QCOMPARE(outputs.count(), 2);
|
||||
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
|
||||
setenv("QT_QPA_PLATFORM", "wayland", true);
|
||||
}
|
||||
|
||||
void DontCrashAuroraeDestroyDecoTest::init()
|
||||
{
|
||||
workspace()->setActiveOutput(QPoint(640, 512));
|
||||
input()->pointer()->warp(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void DontCrashAuroraeDestroyDecoTest::testBorderlessMaximizedWindows()
|
||||
{
|
||||
// this test verifies that Aurorae doesn't crash when clicking the maximize button
|
||||
// with kwin config option BorderlessMaximizedWindows
|
||||
// see BUG 362772
|
||||
|
||||
// first adjust the config
|
||||
KConfigGroup group = kwinApp()->config()->group(QStringLiteral("Windows"));
|
||||
group.writeEntry("BorderlessMaximizedWindows", true);
|
||||
group.sync();
|
||||
workspace()->slotReconfigure();
|
||||
QCOMPARE(options->borderlessMaximizedWindows(), true);
|
||||
|
||||
// create an xcb window
|
||||
Test::XcbConnectionPtr connection = Test::createX11Connection();
|
||||
auto c = connection.get();
|
||||
QVERIFY(!xcb_connection_has_error(c));
|
||||
|
||||
xcb_window_t windowId = xcb_generate_id(c);
|
||||
xcb_create_window(c, XCB_COPY_FROM_PARENT, windowId, rootWindow(), 0, 0, 100, 200, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, 0, nullptr);
|
||||
xcb_map_window(c, windowId);
|
||||
xcb_flush(c);
|
||||
|
||||
// we should get a window for it
|
||||
QSignalSpy windowCreatedSpy(workspace(), &Workspace::windowAdded);
|
||||
QVERIFY(windowCreatedSpy.wait());
|
||||
X11Window *window = windowCreatedSpy.first().first().value<X11Window *>();
|
||||
QVERIFY(window);
|
||||
QCOMPARE(window->window(), windowId);
|
||||
QVERIFY(window->isDecorated());
|
||||
QCOMPARE(window->maximizeMode(), MaximizeRestore);
|
||||
QCOMPARE(window->noBorder(), false);
|
||||
// verify that the deco is Aurorae
|
||||
QCOMPARE(qstrcmp(window->decoration()->metaObject()->className(), "Aurorae::Decoration"), 0);
|
||||
// find the maximize button
|
||||
QQuickItem *item = window->decoration()->property("item").value<QQuickItem *>()->findChild<QQuickItem *>("maximizeButton");
|
||||
QVERIFY(item);
|
||||
const QPointF scenePoint = item->mapToScene(QPoint(0, 0));
|
||||
|
||||
// mark the window as ready for painting, otherwise it doesn't get input events
|
||||
QMetaObject::invokeMethod(window, "setReadyForPainting");
|
||||
QVERIFY(window->readyForPainting());
|
||||
|
||||
// simulate click on maximize button
|
||||
QSignalSpy maximizedStateChangedSpy(window, &Window::maximizedChanged);
|
||||
quint32 timestamp = 1;
|
||||
Test::pointerMotion(window->frameGeometry().topLeft() + scenePoint.toPoint(), timestamp++);
|
||||
Test::pointerButtonPressed(BTN_LEFT, timestamp++);
|
||||
Test::pointerButtonReleased(BTN_LEFT, timestamp++);
|
||||
QVERIFY(maximizedStateChangedSpy.wait());
|
||||
QCOMPARE(window->maximizeMode(), MaximizeFull);
|
||||
QCOMPARE(window->noBorder(), true);
|
||||
|
||||
// and destroy the window again
|
||||
xcb_unmap_window(c, windowId);
|
||||
xcb_destroy_window(c, windowId);
|
||||
xcb_flush(c);
|
||||
|
||||
QSignalSpy windowClosedSpy(window, &X11Window::closed);
|
||||
QVERIFY(windowClosedSpy.wait());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(KWin::DontCrashAuroraeDestroyDecoTest)
|
||||
#include "dont_crash_aurorae_destroy_deco.moc"
|
||||
@@ -1,111 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "compositor.h"
|
||||
#include "effect/effecthandler.h"
|
||||
#include "effect/effectloader.h"
|
||||
#include "scripting/scriptedeffect.h"
|
||||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
#if KWIN_BUILD_X11
|
||||
#include "x11window.h"
|
||||
#endif
|
||||
|
||||
#include <KDecoration3/Decoration>
|
||||
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
#include <QSignalSpy>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_kwin_dont_crash_cancel_animation-0");
|
||||
|
||||
class DontCrashCancelAnimationFromAnimationEndedTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
void testScript();
|
||||
};
|
||||
|
||||
void DontCrashCancelAnimationFromAnimationEndedTest::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::Window *>();
|
||||
QVERIFY(waylandServer()->init(s_socketName));
|
||||
Test::setOutputConfig({
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
});
|
||||
kwinApp()->start();
|
||||
QVERIFY(Compositor::self());
|
||||
QVERIFY(effects);
|
||||
}
|
||||
|
||||
void DontCrashCancelAnimationFromAnimationEndedTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
}
|
||||
|
||||
void DontCrashCancelAnimationFromAnimationEndedTest::cleanup()
|
||||
{
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void DontCrashCancelAnimationFromAnimationEndedTest::testScript()
|
||||
{
|
||||
// load a scripted effect which deletes animation data
|
||||
ScriptedEffect *effect = ScriptedEffect::create(QStringLiteral("crashy"), QFINDTESTDATA("data/anim-data-delete-effect/effect.js"), 10, QString());
|
||||
QVERIFY(effect);
|
||||
|
||||
const auto children = effects->children();
|
||||
for (auto it = children.begin(); it != children.end(); ++it) {
|
||||
if (qstrcmp((*it)->metaObject()->className(), "KWin::EffectLoader") != 0) {
|
||||
continue;
|
||||
}
|
||||
QVERIFY(QMetaObject::invokeMethod(*it, "effectLoaded", Q_ARG(KWin::Effect *, effect), Q_ARG(QString, QStringLiteral("crashy"))));
|
||||
break;
|
||||
}
|
||||
QVERIFY(effects->isEffectLoaded(QStringLiteral("crashy")));
|
||||
|
||||
// create a window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface{Test::createSurface()};
|
||||
QVERIFY(surface);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
// let's render
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window);
|
||||
QCOMPARE(workspace()->activeWindow(), window);
|
||||
|
||||
// make sure we animate
|
||||
QTest::qWait(200);
|
||||
|
||||
// wait for the window to be passed to Deleted
|
||||
QSignalSpy windowDeletedSpy(window, &Window::closed);
|
||||
|
||||
surface.reset();
|
||||
|
||||
QVERIFY(windowDeletedSpy.wait());
|
||||
// make sure we animate
|
||||
QTest::qWait(200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(KWin::DontCrashCancelAnimationFromAnimationEndedTest)
|
||||
#include "dont_crash_cancel_animation.moc"
|
||||
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "core/output.h"
|
||||
#include "pointer_input.h"
|
||||
#include "wayland_server.h"
|
||||
#include "workspace.h"
|
||||
#include "x11window.h"
|
||||
|
||||
#include <KDecoration3/Decoration>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_kwin_dont_crash_empty_decoration-0");
|
||||
|
||||
class DontCrashEmptyDecorationTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void testBug361551();
|
||||
};
|
||||
|
||||
void DontCrashEmptyDecorationTest::initTestCase()
|
||||
{
|
||||
if (!Test::renderNodeAvailable()) {
|
||||
QSKIP("no render node available");
|
||||
return;
|
||||
}
|
||||
qRegisterMetaType<KWin::Window *>();
|
||||
QVERIFY(waylandServer()->init(s_socketName));
|
||||
Test::setOutputConfig({
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
});
|
||||
|
||||
// this test needs to enforce OpenGL compositing to get into the crashy condition
|
||||
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
|
||||
kwinApp()->start();
|
||||
const auto outputs = workspace()->outputs();
|
||||
QCOMPARE(outputs.count(), 2);
|
||||
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
|
||||
setenv("QT_QPA_PLATFORM", "wayland", true);
|
||||
}
|
||||
|
||||
void DontCrashEmptyDecorationTest::init()
|
||||
{
|
||||
workspace()->setActiveOutput(QPoint(640, 512));
|
||||
input()->pointer()->warp(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void DontCrashEmptyDecorationTest::testBug361551()
|
||||
{
|
||||
// this test verifies that resizing an X11 window to an invalid size does not result in crash on unmap
|
||||
// when the DecorationRenderer gets copied to the Deleted
|
||||
// there a repaint is scheduled and the resulting texture is invalid if the window size is invalid
|
||||
|
||||
// create an xcb window
|
||||
Test::XcbConnectionPtr connection = Test::createX11Connection();
|
||||
auto c = connection.get();
|
||||
|
||||
QVERIFY(c);
|
||||
QVERIFY(!xcb_connection_has_error(c));
|
||||
|
||||
xcb_window_t windowId = xcb_generate_id(c);
|
||||
xcb_create_window(c, XCB_COPY_FROM_PARENT, windowId, rootWindow(), 0, 0, 10, 10, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, 0, nullptr);
|
||||
xcb_map_window(c, windowId);
|
||||
xcb_flush(c);
|
||||
|
||||
// we should get a window for it
|
||||
QSignalSpy windowCreatedSpy(workspace(), &Workspace::windowAdded);
|
||||
QVERIFY(windowCreatedSpy.wait());
|
||||
X11Window *window = windowCreatedSpy.first().first().value<X11Window *>();
|
||||
QVERIFY(window);
|
||||
QCOMPARE(window->window(), windowId);
|
||||
QVERIFY(window->isDecorated());
|
||||
|
||||
// let's set a stupid geometry
|
||||
window->moveResize({0, 0, 0, 0});
|
||||
QCOMPARE(window->frameGeometry(), QRect(0, 0, 0, 0));
|
||||
|
||||
// and destroy the window again
|
||||
xcb_unmap_window(c, windowId);
|
||||
xcb_destroy_window(c, windowId);
|
||||
xcb_flush(c);
|
||||
|
||||
QSignalSpy windowClosedSpy(window, &X11Window::closed);
|
||||
QVERIFY(windowClosedSpy.wait());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(KWin::DontCrashEmptyDecorationTest)
|
||||
#include "dont_crash_empty_deco.moc"
|
||||
@@ -1,93 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
#include "x11window.h"
|
||||
|
||||
#include <KDecoration3/Decoration>
|
||||
|
||||
#include <QSignalSpy>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_kwin_dont_crash_glxgears-0");
|
||||
|
||||
class DontCrashGlxgearsTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void testGlxgears();
|
||||
};
|
||||
|
||||
void DontCrashGlxgearsTest::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::Window *>();
|
||||
QVERIFY(waylandServer()->init(s_socketName));
|
||||
Test::setOutputConfig({
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
});
|
||||
kwinApp()->start();
|
||||
}
|
||||
|
||||
void DontCrashGlxgearsTest::testGlxgears()
|
||||
{
|
||||
// closing a glxgears window through Aurorae themes used to crash KWin
|
||||
// Let's make sure that doesn't happen anymore
|
||||
|
||||
QSignalSpy windowAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
|
||||
QProcess glxgears;
|
||||
glxgears.setProgram(QStringLiteral("glxgears"));
|
||||
glxgears.start();
|
||||
QVERIFY(glxgears.waitForStarted());
|
||||
|
||||
QVERIFY(windowAddedSpy.wait());
|
||||
QCOMPARE(windowAddedSpy.count(), 1);
|
||||
QCOMPARE(workspace()->windows().count(), 1);
|
||||
Window *glxgearsWindow = workspace()->windows().first();
|
||||
QVERIFY(glxgearsWindow->isDecorated());
|
||||
QSignalSpy closedSpy(glxgearsWindow, &X11Window::closed);
|
||||
KDecoration3::Decoration *decoration = glxgearsWindow->decoration();
|
||||
QVERIFY(decoration);
|
||||
|
||||
// send a mouse event to the position of the close button
|
||||
// TODO: position is dependent on the decoration in use. We should use a static target instead, a fake deco for autotests.
|
||||
QPointF pos = decoration->rect().topRight() + QPointF(-decoration->borderTop() / 2, decoration->borderTop() / 2);
|
||||
QHoverEvent event(QEvent::HoverMove, pos, pos);
|
||||
QCoreApplication::instance()->sendEvent(decoration, &event);
|
||||
// mouse press
|
||||
QMouseEvent mousePressevent(QEvent::MouseButtonPress, pos, pos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
|
||||
mousePressevent.setAccepted(false);
|
||||
QCoreApplication::sendEvent(decoration, &mousePressevent);
|
||||
QVERIFY(mousePressevent.isAccepted());
|
||||
// mouse Release
|
||||
QMouseEvent mouseReleaseEvent(QEvent::MouseButtonRelease, pos, pos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
|
||||
mouseReleaseEvent.setAccepted(false);
|
||||
QCoreApplication::sendEvent(decoration, &mouseReleaseEvent);
|
||||
QVERIFY(mouseReleaseEvent.isAccepted());
|
||||
|
||||
QVERIFY(closedSpy.wait());
|
||||
QCOMPARE(closedSpy.count(), 1);
|
||||
xcb_flush(connection());
|
||||
|
||||
if (glxgears.state() == QProcess::Running) {
|
||||
QVERIFY(glxgears.waitForFinished());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(KWin::DontCrashGlxgearsTest)
|
||||
#include "dont_crash_glxgears.moc"
|
||||
@@ -1,139 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2018 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "compositor.h"
|
||||
#include "core/output.h"
|
||||
#include "effect/effecthandler.h"
|
||||
#include "effect/effectloader.h"
|
||||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_kwin_dont_crash_reinitialize_compositor-0");
|
||||
|
||||
class DontCrashReinitializeCompositorTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void testReinitializeCompositor_data();
|
||||
void testReinitializeCompositor();
|
||||
};
|
||||
|
||||
void DontCrashReinitializeCompositorTest::initTestCase()
|
||||
{
|
||||
if (!Test::renderNodeAvailable()) {
|
||||
QSKIP("no render node available");
|
||||
return;
|
||||
}
|
||||
qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
|
||||
|
||||
qRegisterMetaType<KWin::Window *>();
|
||||
QVERIFY(waylandServer()->init(s_socketName));
|
||||
Test::setOutputConfig({
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
});
|
||||
|
||||
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
KConfigGroup plugins(config, QStringLiteral("Plugins"));
|
||||
const auto builtinNames = EffectLoader().listOfKnownEffects();
|
||||
for (const QString &name : builtinNames) {
|
||||
plugins.writeEntry(name + QStringLiteral("Enabled"), false);
|
||||
}
|
||||
config->sync();
|
||||
kwinApp()->setConfig(config);
|
||||
|
||||
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
|
||||
qputenv("KWIN_EFFECTS_FORCE_ANIMATIONS", QByteArrayLiteral("1"));
|
||||
|
||||
kwinApp()->start();
|
||||
const auto outputs = workspace()->outputs();
|
||||
QCOMPARE(outputs.count(), 2);
|
||||
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
|
||||
}
|
||||
|
||||
void DontCrashReinitializeCompositorTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
}
|
||||
|
||||
void DontCrashReinitializeCompositorTest::cleanup()
|
||||
{
|
||||
// Unload all effects.
|
||||
effects->unloadAllEffects();
|
||||
QVERIFY(effects->loadedEffects().isEmpty());
|
||||
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void DontCrashReinitializeCompositorTest::testReinitializeCompositor_data()
|
||||
{
|
||||
QTest::addColumn<QString>("effectName");
|
||||
|
||||
QTest::newRow("Fade") << QStringLiteral("fade");
|
||||
QTest::newRow("Glide") << QStringLiteral("glide");
|
||||
QTest::newRow("Scale") << QStringLiteral("scale");
|
||||
}
|
||||
|
||||
void DontCrashReinitializeCompositorTest::testReinitializeCompositor()
|
||||
{
|
||||
// This test verifies that KWin doesn't crash when the compositor settings
|
||||
// have been changed while a scripted effect animates the disappearing of
|
||||
// a window.
|
||||
|
||||
// Create the test window.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
||||
QVERIFY(surface != nullptr);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
|
||||
QVERIFY(shellSurface != nullptr);
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window);
|
||||
|
||||
// Make sure that only the test effect is loaded.
|
||||
QFETCH(QString, effectName);
|
||||
QVERIFY(effects->loadEffect(effectName));
|
||||
QCOMPARE(effects->loadedEffects().count(), 1);
|
||||
QCOMPARE(effects->loadedEffects().first(), effectName);
|
||||
Effect *effect = effects->findEffect(effectName);
|
||||
QVERIFY(effect);
|
||||
QVERIFY(!effect->isActive());
|
||||
|
||||
// Close the test window.
|
||||
QSignalSpy windowClosedSpy(window, &Window::closed);
|
||||
shellSurface.reset();
|
||||
surface.reset();
|
||||
QVERIFY(windowClosedSpy.wait());
|
||||
|
||||
// The test effect should start animating the test window. Is there a better
|
||||
// way to verify that the test effect actually animates the test window?
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Re-initialize the compositor, effects will be destroyed and created again.
|
||||
Compositor::self()->reinitialize();
|
||||
|
||||
// By this time, KWin should still be alive.
|
||||
}
|
||||
|
||||
} // namespace KWin
|
||||
|
||||
WAYLANDTEST_MAIN(KWin::DontCrashReinitializeCompositorTest)
|
||||
#include "dont_crash_reinitialize_compositor.moc"
|
||||
@@ -1,100 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2017 Martin Flöser <mgraesslin@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "core/output.h"
|
||||
#include "pointer_input.h"
|
||||
#include "useractions.h"
|
||||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/keyboard.h>
|
||||
#include <KWayland/Client/pointer.h>
|
||||
#include <KWayland/Client/seat.h>
|
||||
#include <KWayland/Client/shm_pool.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
#include <KWayland/Client/touch.h>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
using namespace KWin;
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_kwin_dont_crash_useractions_menu-0");
|
||||
|
||||
class TestDontCrashUseractionsMenu : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void testShowHideShowUseractionsMenu();
|
||||
};
|
||||
|
||||
void TestDontCrashUseractionsMenu::initTestCase()
|
||||
{
|
||||
qRegisterMetaType<KWin::Window *>();
|
||||
QVERIFY(waylandServer()->init(s_socketName));
|
||||
Test::setOutputConfig({
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
});
|
||||
|
||||
// force style to breeze as that's the one which triggered the crash
|
||||
QVERIFY(kwinApp()->setStyle(QStringLiteral("breeze")));
|
||||
|
||||
kwinApp()->start();
|
||||
const auto outputs = workspace()->outputs();
|
||||
QCOMPARE(outputs.count(), 2);
|
||||
QCOMPARE(outputs[0]->geometry(), QRect(0, 0, 1280, 1024));
|
||||
QCOMPARE(outputs[1]->geometry(), QRect(1280, 0, 1280, 1024));
|
||||
}
|
||||
|
||||
void TestDontCrashUseractionsMenu::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
|
||||
workspace()->setActiveOutput(QPoint(640, 512));
|
||||
KWin::input()->pointer()->warp(QPoint(640, 512));
|
||||
}
|
||||
|
||||
void TestDontCrashUseractionsMenu::cleanup()
|
||||
{
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void TestDontCrashUseractionsMenu::testShowHideShowUseractionsMenu()
|
||||
{
|
||||
// this test creates the condition of BUG 382063
|
||||
std::unique_ptr<KWayland::Client::Surface> surface1(Test::createSurface());
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface1(Test::createXdgToplevelSurface(surface1.get()));
|
||||
auto window = Test::renderAndWaitForShown(surface1.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window);
|
||||
|
||||
workspace()->showWindowMenu(QRect(), window);
|
||||
auto userActionsMenu = workspace()->userActionsMenu();
|
||||
QTRY_VERIFY(userActionsMenu->isShown());
|
||||
QVERIFY(userActionsMenu->hasWindow());
|
||||
|
||||
Test::keyboardKeyPressed(KEY_ESC, 0);
|
||||
Test::keyboardKeyReleased(KEY_ESC, 1);
|
||||
QTRY_VERIFY(!userActionsMenu->isShown());
|
||||
QVERIFY(!userActionsMenu->hasWindow());
|
||||
|
||||
// and show again, this triggers BUG 382063
|
||||
workspace()->showWindowMenu(QRect(), window);
|
||||
QTRY_VERIFY(userActionsMenu->isShown());
|
||||
QVERIFY(userActionsMenu->hasWindow());
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(TestDontCrashUseractionsMenu)
|
||||
#include "dont_crash_useractions_menu.moc"
|
||||
@@ -1,9 +0,0 @@
|
||||
integrationTest(NAME testTranslucency SRCS translucency_test.cpp LIBS XCB::ICCCM BUILTIN_EFFECTS)
|
||||
integrationTest(NAME testSlidingPopups SRCS slidingpopups_test.cpp LIBS XCB::ICCCM BUILTIN_EFFECTS)
|
||||
integrationTest(NAME testShadeWobblyWindows SRCS wobbly_shade_test.cpp LIBS XCB::ICCCM BUILTIN_EFFECTS)
|
||||
integrationTest(NAME testScriptedEffects SRCS scripted_effects_test.cpp LIBS KF6::GlobalAccel BUILTIN_EFFECTS)
|
||||
integrationTest(NAME testToplevelOpenCloseAnimation SRCS toplevel_open_close_animation_test.cpp BUILTIN_EFFECTS)
|
||||
integrationTest(NAME testPopupOpenCloseAnimation SRCS popup_open_close_animation_test.cpp LIBS KF6::I18n KDecoration3::KDecoration3Private BUILTIN_EFFECTS)
|
||||
integrationTest(NAME testDesktopSwitchingAnimation SRCS desktop_switching_animation_test.cpp BUILTIN_EFFECTS)
|
||||
integrationTest(NAME testMinimizeAnimation SRCS minimize_animation_test.cpp BUILTIN_EFFECTS)
|
||||
integrationTest(NAME testMaximizeAnimation SRCS maximize_animation_test.cpp BUILTIN_EFFECTS)
|
||||
-139
@@ -1,139 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "effect/effecthandler.h"
|
||||
#include "effect/effectloader.h"
|
||||
#include "virtualdesktops.h"
|
||||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
using namespace KWin;
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_effects_desktop_switching_animation-0");
|
||||
|
||||
class DesktopSwitchingAnimationTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void testSwitchDesktops_data();
|
||||
void testSwitchDesktops();
|
||||
};
|
||||
|
||||
void DesktopSwitchingAnimationTest::initTestCase()
|
||||
{
|
||||
if (!Test::renderNodeAvailable()) {
|
||||
QSKIP("no render node available");
|
||||
return;
|
||||
}
|
||||
qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
|
||||
|
||||
qRegisterMetaType<KWin::Window *>();
|
||||
QVERIFY(waylandServer()->init(s_socketName));
|
||||
Test::setOutputConfig({
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
});
|
||||
|
||||
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
KConfigGroup plugins(config, QStringLiteral("Plugins"));
|
||||
const auto builtinNames = EffectLoader().listOfKnownEffects();
|
||||
for (const QString &name : builtinNames) {
|
||||
plugins.writeEntry(name + QStringLiteral("Enabled"), false);
|
||||
}
|
||||
config->sync();
|
||||
kwinApp()->setConfig(config);
|
||||
|
||||
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
|
||||
qputenv("KWIN_EFFECTS_FORCE_ANIMATIONS", QByteArrayLiteral("1"));
|
||||
|
||||
kwinApp()->start();
|
||||
}
|
||||
|
||||
void DesktopSwitchingAnimationTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
}
|
||||
|
||||
void DesktopSwitchingAnimationTest::cleanup()
|
||||
{
|
||||
QVERIFY(effects);
|
||||
effects->unloadAllEffects();
|
||||
QVERIFY(effects->loadedEffects().isEmpty());
|
||||
|
||||
VirtualDesktopManager::self()->setCount(1);
|
||||
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void DesktopSwitchingAnimationTest::testSwitchDesktops_data()
|
||||
{
|
||||
QTest::addColumn<QString>("effectName");
|
||||
|
||||
QTest::newRow("Fade Desktop") << QStringLiteral("fadedesktop");
|
||||
QTest::newRow("Slide") << QStringLiteral("slide");
|
||||
}
|
||||
|
||||
void DesktopSwitchingAnimationTest::testSwitchDesktops()
|
||||
{
|
||||
// This test verifies that virtual desktop switching animation effects actually
|
||||
// try to animate switching between desktops.
|
||||
|
||||
// We need at least 2 virtual desktops for the test.
|
||||
VirtualDesktopManager::self()->setCount(2);
|
||||
QCOMPARE(VirtualDesktopManager::self()->current(), 1u);
|
||||
QCOMPARE(VirtualDesktopManager::self()->count(), 2u);
|
||||
|
||||
// The Fade Desktop effect will do nothing if there are no windows to fade,
|
||||
// so we have to create a dummy test window.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
||||
QVERIFY(surface != nullptr);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
|
||||
QVERIFY(shellSurface != nullptr);
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window);
|
||||
QCOMPARE(window->desktops().count(), 1);
|
||||
QCOMPARE(window->desktops().first(), VirtualDesktopManager::self()->desktops().first());
|
||||
|
||||
// Load effect that will be tested.
|
||||
QFETCH(QString, effectName);
|
||||
QVERIFY(effects);
|
||||
QVERIFY(effects->loadEffect(effectName));
|
||||
QCOMPARE(effects->loadedEffects().count(), 1);
|
||||
QCOMPARE(effects->loadedEffects().first(), effectName);
|
||||
Effect *effect = effects->findEffect(effectName);
|
||||
QVERIFY(effect);
|
||||
QVERIFY(!effect->isActive());
|
||||
|
||||
// Switch to the second virtual desktop.
|
||||
VirtualDesktopManager::self()->setCurrent(2u);
|
||||
QCOMPARE(VirtualDesktopManager::self()->current(), 2u);
|
||||
QVERIFY(effect->isActive());
|
||||
QCOMPARE(effects->activeFullScreenEffect(), effect);
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
QTRY_COMPARE(effects->activeFullScreenEffect(), nullptr);
|
||||
|
||||
// Destroy the test window.
|
||||
surface.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window));
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(DesktopSwitchingAnimationTest)
|
||||
#include "desktop_switching_animation_test.moc"
|
||||
@@ -1,182 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "compositor.h"
|
||||
#include "effect/effecthandler.h"
|
||||
#include "effect/effectloader.h"
|
||||
#include "scene/workspacescene.h"
|
||||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
using namespace KWin;
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_effects_maximize_animation-0");
|
||||
|
||||
class MaximizeAnimationTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void testMaximizeRestore();
|
||||
};
|
||||
|
||||
void MaximizeAnimationTest::initTestCase()
|
||||
{
|
||||
if (!Test::renderNodeAvailable()) {
|
||||
QSKIP("no render node available");
|
||||
return;
|
||||
}
|
||||
qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
|
||||
|
||||
qRegisterMetaType<KWin::Window *>();
|
||||
QVERIFY(waylandServer()->init(s_socketName));
|
||||
Test::setOutputConfig({
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
});
|
||||
|
||||
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
KConfigGroup plugins(config, QStringLiteral("Plugins"));
|
||||
const auto builtinNames = EffectLoader().listOfKnownEffects();
|
||||
for (const QString &name : builtinNames) {
|
||||
plugins.writeEntry(name + QStringLiteral("Enabled"), false);
|
||||
}
|
||||
config->sync();
|
||||
kwinApp()->setConfig(config);
|
||||
|
||||
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
|
||||
qputenv("KWIN_EFFECTS_FORCE_ANIMATIONS", QByteArrayLiteral("1"));
|
||||
|
||||
kwinApp()->start();
|
||||
}
|
||||
|
||||
void MaximizeAnimationTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
}
|
||||
|
||||
void MaximizeAnimationTest::cleanup()
|
||||
{
|
||||
QVERIFY(effects);
|
||||
effects->unloadAllEffects();
|
||||
QVERIFY(effects->loadedEffects().isEmpty());
|
||||
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void MaximizeAnimationTest::testMaximizeRestore()
|
||||
{
|
||||
// This test verifies that the maximize effect animates a window
|
||||
// when it's maximized or restored.
|
||||
|
||||
// Create the test window.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
||||
QVERIFY(surface != nullptr);
|
||||
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get(), Test::CreationSetup::CreateOnly));
|
||||
|
||||
// Wait for the initial configure event.
|
||||
Test::XdgToplevel::States states;
|
||||
QSignalSpy toplevelConfigureRequestedSpy(shellSurface.get(), &Test::XdgToplevel::configureRequested);
|
||||
QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
|
||||
|
||||
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
||||
|
||||
QVERIFY(surfaceConfigureRequestedSpy.wait());
|
||||
QCOMPARE(surfaceConfigureRequestedSpy.count(), 1);
|
||||
QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value<QSize>(), QSize(0, 0));
|
||||
states = toplevelConfigureRequestedSpy.last().at(1).value<Test::XdgToplevel::States>();
|
||||
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Activated));
|
||||
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Maximized));
|
||||
|
||||
// Draw contents of the surface.
|
||||
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window);
|
||||
QVERIFY(window->isActive());
|
||||
QCOMPARE(window->maximizeMode(), MaximizeMode::MaximizeRestore);
|
||||
|
||||
// We should receive a configure event when the window becomes active.
|
||||
QVERIFY(surfaceConfigureRequestedSpy.wait());
|
||||
QCOMPARE(surfaceConfigureRequestedSpy.count(), 2);
|
||||
states = toplevelConfigureRequestedSpy.last().at(1).value<Test::XdgToplevel::States>();
|
||||
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
||||
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Maximized));
|
||||
|
||||
// Load effect that will be tested.
|
||||
const QString effectName = QStringLiteral("maximize");
|
||||
QVERIFY(effects);
|
||||
QVERIFY(effects->loadEffect(effectName));
|
||||
QCOMPARE(effects->loadedEffects().count(), 1);
|
||||
QCOMPARE(effects->loadedEffects().first(), effectName);
|
||||
Effect *effect = effects->findEffect(effectName);
|
||||
QVERIFY(effect);
|
||||
QVERIFY(!effect->isActive());
|
||||
|
||||
// Maximize the window.
|
||||
QSignalSpy frameGeometryChangedSpy(window, &Window::frameGeometryChanged);
|
||||
QSignalSpy maximizeChangedSpy(window, &Window::maximizedChanged);
|
||||
|
||||
workspace()->slotWindowMaximize();
|
||||
QVERIFY(surfaceConfigureRequestedSpy.wait());
|
||||
QCOMPARE(surfaceConfigureRequestedSpy.count(), 3);
|
||||
QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value<QSize>(), QSize(1280, 1024));
|
||||
states = toplevelConfigureRequestedSpy.last().at(1).value<Test::XdgToplevel::States>();
|
||||
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
||||
QVERIFY(states.testFlag(Test::XdgToplevel::State::Maximized));
|
||||
|
||||
// Draw contents of the maximized window.
|
||||
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
|
||||
Test::render(surface.get(), QSize(1280, 1024), Qt::red);
|
||||
QVERIFY(frameGeometryChangedSpy.wait());
|
||||
QCOMPARE(frameGeometryChangedSpy.count(), 1);
|
||||
QCOMPARE(maximizeChangedSpy.count(), 1);
|
||||
QCOMPARE(window->maximizeMode(), MaximizeMode::MaximizeFull);
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Restore the window.
|
||||
workspace()->slotWindowMaximize();
|
||||
QVERIFY(surfaceConfigureRequestedSpy.wait());
|
||||
QCOMPARE(surfaceConfigureRequestedSpy.count(), 4);
|
||||
QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value<QSize>(), QSize(100, 50));
|
||||
states = toplevelConfigureRequestedSpy.last().at(1).value<Test::XdgToplevel::States>();
|
||||
QVERIFY(states.testFlag(Test::XdgToplevel::State::Activated));
|
||||
QVERIFY(!states.testFlag(Test::XdgToplevel::State::Maximized));
|
||||
|
||||
// Draw contents of the restored window.
|
||||
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
|
||||
Test::render(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(frameGeometryChangedSpy.wait());
|
||||
QCOMPARE(frameGeometryChangedSpy.count(), 2);
|
||||
QCOMPARE(maximizeChangedSpy.count(), 2);
|
||||
QCOMPARE(window->maximizeMode(), MaximizeMode::MaximizeRestore);
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Destroy the test window.
|
||||
surface.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window));
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(MaximizeAnimationTest)
|
||||
#include "maximize_animation_test.moc"
|
||||
@@ -1,166 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "effect/effecthandler.h"
|
||||
#include "effect/effectloader.h"
|
||||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include <KWayland/Client/plasmawindowmanagement.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
using namespace KWin;
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_effects_minimize_animation-0");
|
||||
|
||||
class MinimizeAnimationTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void testMinimizeUnminimize_data();
|
||||
void testMinimizeUnminimize();
|
||||
};
|
||||
|
||||
void MinimizeAnimationTest::initTestCase()
|
||||
{
|
||||
if (!Test::renderNodeAvailable()) {
|
||||
QSKIP("no render node available");
|
||||
return;
|
||||
}
|
||||
qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
|
||||
|
||||
qRegisterMetaType<KWin::Window *>();
|
||||
QVERIFY(waylandServer()->init(s_socketName));
|
||||
Test::setOutputConfig({
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
});
|
||||
|
||||
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
KConfigGroup plugins(config, QStringLiteral("Plugins"));
|
||||
const auto builtinNames = EffectLoader().listOfKnownEffects();
|
||||
for (const QString &name : builtinNames) {
|
||||
plugins.writeEntry(name + QStringLiteral("Enabled"), false);
|
||||
}
|
||||
config->sync();
|
||||
kwinApp()->setConfig(config);
|
||||
|
||||
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
|
||||
qputenv("KWIN_EFFECTS_FORCE_ANIMATIONS", QByteArrayLiteral("1"));
|
||||
|
||||
kwinApp()->start();
|
||||
}
|
||||
|
||||
void MinimizeAnimationTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::LayerShellV1 | Test::AdditionalWaylandInterface::WindowManagement));
|
||||
}
|
||||
|
||||
void MinimizeAnimationTest::cleanup()
|
||||
{
|
||||
QVERIFY(effects);
|
||||
effects->unloadAllEffects();
|
||||
QVERIFY(effects->loadedEffects().isEmpty());
|
||||
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void MinimizeAnimationTest::testMinimizeUnminimize_data()
|
||||
{
|
||||
QTest::addColumn<QString>("effectName");
|
||||
|
||||
QTest::newRow("Magic Lamp") << QStringLiteral("magiclamp");
|
||||
QTest::newRow("Squash") << QStringLiteral("squash");
|
||||
}
|
||||
|
||||
void MinimizeAnimationTest::testMinimizeUnminimize()
|
||||
{
|
||||
// This test verifies that a minimize effect tries to animate a window
|
||||
// when it's minimized or unminimized.
|
||||
|
||||
|
||||
// Create a panel at the top of the screen.
|
||||
const QRect panelRect = QRect(0, 0, 1280, 36);
|
||||
std::unique_ptr<KWayland::Client::Surface> panelSurface{Test::createSurface()};
|
||||
std::unique_ptr<Test::LayerSurfaceV1> panelShellSurface{Test::createLayerSurfaceV1(panelSurface.get(), QStringLiteral("dock"))};
|
||||
panelShellSurface->set_size(panelRect.width(), panelRect.height());
|
||||
panelShellSurface->set_exclusive_zone(panelRect.height());
|
||||
panelShellSurface->set_anchor(Test::LayerSurfaceV1::anchor_top);
|
||||
panelSurface->commit(KWayland::Client::Surface::CommitFlag::None);
|
||||
|
||||
QSignalSpy panelConfigureRequestedSpy(panelShellSurface.get(), &Test::LayerSurfaceV1::configureRequested);
|
||||
QVERIFY(panelConfigureRequestedSpy.wait());
|
||||
Window *panel = Test::renderAndWaitForShown(panelSurface.get(), panelConfigureRequestedSpy.last().at(1).toSize(), Qt::blue);
|
||||
QVERIFY(panel);
|
||||
QVERIFY(panel->isDock());
|
||||
QCOMPARE(panel->frameGeometry(), panelRect);
|
||||
|
||||
// Create the test window.
|
||||
QSignalSpy plasmaWindowCreatedSpy(Test::waylandWindowManagement(), &KWayland::Client::PlasmaWindowManagement::windowCreated);
|
||||
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
||||
QVERIFY(surface != nullptr);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
|
||||
QVERIFY(shellSurface != nullptr);
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::red);
|
||||
QVERIFY(window);
|
||||
QVERIFY(plasmaWindowCreatedSpy.wait());
|
||||
QCOMPARE(plasmaWindowCreatedSpy.count(), 1);
|
||||
|
||||
// We have to set the minimized geometry because the squash effect needs it,
|
||||
// otherwise it won't start animation.
|
||||
auto plasmaWindow = plasmaWindowCreatedSpy.last().first().value<KWayland::Client::PlasmaWindow *>();
|
||||
QVERIFY(plasmaWindow);
|
||||
const QRect iconRect = QRect(0, 0, 42, 36);
|
||||
plasmaWindow->setMinimizedGeometry(panelSurface.get(), iconRect);
|
||||
Test::flushWaylandConnection();
|
||||
QTRY_COMPARE(window->iconGeometry(), iconRect.translated(panel->frameGeometry().topLeft().toPoint()));
|
||||
|
||||
// Load effect that will be tested.
|
||||
QFETCH(QString, effectName);
|
||||
QVERIFY(effects);
|
||||
QVERIFY(effects->loadEffect(effectName));
|
||||
QCOMPARE(effects->loadedEffects().count(), 1);
|
||||
QCOMPARE(effects->loadedEffects().first(), effectName);
|
||||
Effect *effect = effects->findEffect(effectName);
|
||||
QVERIFY(effect);
|
||||
QVERIFY(!effect->isActive());
|
||||
|
||||
// Start the minimize animation.
|
||||
window->setMinimized(true);
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Start the unminimize animation.
|
||||
window->setMinimized(false);
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Destroy the panel.
|
||||
panelSurface.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(panel));
|
||||
|
||||
// Destroy the test window.
|
||||
surface.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window));
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(MinimizeAnimationTest)
|
||||
#include "minimize_animation_test.moc"
|
||||
-247
@@ -1,247 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2019 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "effect/effecthandler.h"
|
||||
#include "effect/effectloader.h"
|
||||
#include "internalwindow.h"
|
||||
#include "useractions.h"
|
||||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include "decorations/decoratedwindow.h"
|
||||
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
#include <linux/input.h>
|
||||
|
||||
using namespace KWin;
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_effects_popup_open_close_animation-0");
|
||||
|
||||
class PopupOpenCloseAnimationTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void testAnimatePopups();
|
||||
void testAnimateUserActionsPopup();
|
||||
void testAnimateDecorationTooltips();
|
||||
};
|
||||
|
||||
void PopupOpenCloseAnimationTest::initTestCase()
|
||||
{
|
||||
qputenv("XDG_DATA_DIRS", QCoreApplication::applicationDirPath().toUtf8());
|
||||
|
||||
qRegisterMetaType<KWin::Window *>();
|
||||
qRegisterMetaType<KWin::InternalWindow *>();
|
||||
QVERIFY(waylandServer()->init(s_socketName));
|
||||
Test::setOutputConfig({
|
||||
QRect(0, 0, 1280, 1024),
|
||||
QRect(1280, 0, 1280, 1024),
|
||||
});
|
||||
|
||||
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
KConfigGroup plugins(config, QStringLiteral("Plugins"));
|
||||
const auto builtinNames = EffectLoader().listOfKnownEffects();
|
||||
for (const QString &name : builtinNames) {
|
||||
plugins.writeEntry(name + QStringLiteral("Enabled"), false);
|
||||
}
|
||||
config->sync();
|
||||
kwinApp()->setConfig(config);
|
||||
|
||||
qputenv("KWIN_EFFECTS_FORCE_ANIMATIONS", QByteArrayLiteral("1"));
|
||||
|
||||
kwinApp()->start();
|
||||
}
|
||||
|
||||
void PopupOpenCloseAnimationTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection(Test::AdditionalWaylandInterface::XdgDecorationV1));
|
||||
}
|
||||
|
||||
void PopupOpenCloseAnimationTest::cleanup()
|
||||
{
|
||||
QVERIFY(effects);
|
||||
effects->unloadAllEffects();
|
||||
QVERIFY(effects->loadedEffects().isEmpty());
|
||||
|
||||
Test::destroyWaylandConnection();
|
||||
}
|
||||
|
||||
void PopupOpenCloseAnimationTest::testAnimatePopups()
|
||||
{
|
||||
// This test verifies that popup open/close animation effects try
|
||||
// to animate popups(e.g. popup menus, tooltips, etc).
|
||||
|
||||
// Create the main window.
|
||||
std::unique_ptr<KWayland::Client::Surface> mainWindowSurface(Test::createSurface());
|
||||
QVERIFY(mainWindowSurface != nullptr);
|
||||
std::unique_ptr<Test::XdgToplevel> mainWindowShellSurface(Test::createXdgToplevelSurface(mainWindowSurface.get()));
|
||||
QVERIFY(mainWindowShellSurface != nullptr);
|
||||
Window *mainWindow = Test::renderAndWaitForShown(mainWindowSurface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(mainWindow);
|
||||
|
||||
// Load effect that will be tested.
|
||||
const QString effectName = QStringLiteral("fadingpopups");
|
||||
QVERIFY(effects->loadEffect(effectName));
|
||||
QCOMPARE(effects->loadedEffects().count(), 1);
|
||||
QCOMPARE(effects->loadedEffects().first(), effectName);
|
||||
Effect *effect = effects->findEffect(effectName);
|
||||
QVERIFY(effect);
|
||||
QVERIFY(!effect->isActive());
|
||||
|
||||
// Create a popup, it should be animated.
|
||||
std::unique_ptr<KWayland::Client::Surface> popupSurface(Test::createSurface());
|
||||
QVERIFY(popupSurface != nullptr);
|
||||
std::unique_ptr<Test::XdgPositioner> positioner(Test::createXdgPositioner());
|
||||
positioner->set_size(20, 20);
|
||||
positioner->set_anchor_rect(0, 0, 10, 10);
|
||||
positioner->set_gravity(Test::XdgPositioner::gravity_bottom_right);
|
||||
positioner->set_anchor(Test::XdgPositioner::anchor_bottom_left);
|
||||
std::unique_ptr<Test::XdgPopup> popupShellSurface(Test::createXdgPopupSurface(popupSurface.get(), mainWindowShellSurface->xdgSurface(), positioner.get()));
|
||||
QVERIFY(popupShellSurface != nullptr);
|
||||
Window *popup = Test::renderAndWaitForShown(popupSurface.get(), QSize(20, 20), Qt::red);
|
||||
QVERIFY(popup);
|
||||
QVERIFY(popup->isPopupWindow());
|
||||
QCOMPARE(popup->transientFor(), mainWindow);
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Destroy the popup, it should not be animated.
|
||||
QSignalSpy popupClosedSpy(popup, &Window::closed);
|
||||
popupShellSurface.reset();
|
||||
popupSurface.reset();
|
||||
QVERIFY(popupClosedSpy.wait());
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Destroy the main window.
|
||||
mainWindowSurface.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(mainWindow));
|
||||
}
|
||||
|
||||
void PopupOpenCloseAnimationTest::testAnimateUserActionsPopup()
|
||||
{
|
||||
// This test verifies that popup open/close animation effects try
|
||||
// to animate the user actions popup.
|
||||
|
||||
// Create the test window.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
||||
QVERIFY(surface != nullptr);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
|
||||
QVERIFY(shellSurface != nullptr);
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window);
|
||||
|
||||
// Load effect that will be tested.
|
||||
const QString effectName = QStringLiteral("fadingpopups");
|
||||
QVERIFY(effects->loadEffect(effectName));
|
||||
QCOMPARE(effects->loadedEffects().count(), 1);
|
||||
QCOMPARE(effects->loadedEffects().first(), effectName);
|
||||
Effect *effect = effects->findEffect(effectName);
|
||||
QVERIFY(effect);
|
||||
QVERIFY(!effect->isActive());
|
||||
|
||||
// Show the user actions popup.
|
||||
workspace()->showWindowMenu(QRect(), window);
|
||||
auto userActionsMenu = workspace()->userActionsMenu();
|
||||
QTRY_VERIFY(userActionsMenu->isShown());
|
||||
QVERIFY(userActionsMenu->hasWindow());
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Close the user actions popup.
|
||||
Test::keyboardKeyPressed(KEY_ESC, 0);
|
||||
Test::keyboardKeyReleased(KEY_ESC, 1);
|
||||
QTRY_VERIFY(!userActionsMenu->isShown());
|
||||
QVERIFY(!userActionsMenu->hasWindow());
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Destroy the test window.
|
||||
surface.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window));
|
||||
}
|
||||
|
||||
void PopupOpenCloseAnimationTest::testAnimateDecorationTooltips()
|
||||
{
|
||||
// This test verifies that popup open/close animation effects try
|
||||
// to animate decoration tooltips.
|
||||
|
||||
// Create the test window.
|
||||
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
||||
QVERIFY(surface != nullptr);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get(), Test::CreationSetup::CreateOnly));
|
||||
QVERIFY(shellSurface != nullptr);
|
||||
std::unique_ptr<Test::XdgToplevelDecorationV1> deco(Test::createXdgToplevelDecorationV1(shellSurface.get()));
|
||||
QVERIFY(deco != nullptr);
|
||||
|
||||
QSignalSpy surfaceConfigureRequestedSpy(shellSurface->xdgSurface(), &Test::XdgSurface::configureRequested);
|
||||
deco->set_mode(Test::XdgToplevelDecorationV1::mode_server_side);
|
||||
surface->commit(KWayland::Client::Surface::CommitFlag::None);
|
||||
QVERIFY(surfaceConfigureRequestedSpy.wait());
|
||||
|
||||
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window);
|
||||
QVERIFY(window->isDecorated());
|
||||
|
||||
// Load effect that will be tested.
|
||||
const QString effectName = QStringLiteral("fadingpopups");
|
||||
QVERIFY(effects->loadEffect(effectName));
|
||||
QCOMPARE(effects->loadedEffects().count(), 1);
|
||||
QCOMPARE(effects->loadedEffects().first(), effectName);
|
||||
Effect *effect = effects->findEffect(effectName);
|
||||
QVERIFY(effect);
|
||||
QVERIFY(!effect->isActive());
|
||||
|
||||
// Show a decoration tooltip.
|
||||
QSignalSpy tooltipAddedSpy(workspace(), &Workspace::windowAdded);
|
||||
window->decoratedWindow()->requestShowToolTip(QStringLiteral("KWin rocks!"));
|
||||
QVERIFY(tooltipAddedSpy.wait());
|
||||
InternalWindow *tooltip = tooltipAddedSpy.first().first().value<InternalWindow *>();
|
||||
QVERIFY(tooltip->isInternal());
|
||||
QVERIFY(tooltip->isPopupWindow());
|
||||
QVERIFY(tooltip->handle()->flags().testFlag(Qt::ToolTip));
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Hide the decoration tooltip.
|
||||
QSignalSpy tooltipClosedSpy(tooltip, &InternalWindow::closed);
|
||||
window->decoratedWindow()->requestHideToolTip();
|
||||
QVERIFY(tooltipClosedSpy.wait());
|
||||
QVERIFY(effect->isActive());
|
||||
|
||||
// Eventually, the animation will be complete.
|
||||
QTRY_VERIFY(!effect->isActive());
|
||||
|
||||
// Destroy the test window.
|
||||
surface.reset();
|
||||
QVERIFY(Test::waitForWindowClosed(window));
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(PopupOpenCloseAnimationTest)
|
||||
#include "popup_open_close_animation_test.moc"
|
||||
@@ -1,748 +0,0 @@
|
||||
/*
|
||||
KWin - the KDE window manager
|
||||
This file is part of the KDE project.
|
||||
|
||||
SPDX-FileCopyrightText: 2018 David Edmundson <davidedmundson@kde.org>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#include "kwin_wayland_test.h"
|
||||
|
||||
#include "effect/anidata_p.h"
|
||||
#include "effect/effecthandler.h"
|
||||
#include "effect/effectloader.h"
|
||||
#include "scripting/scriptedeffect.h"
|
||||
#include "virtualdesktops.h"
|
||||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
|
||||
#include <KConfigGroup>
|
||||
#include <KGlobalAccel>
|
||||
#include <KWayland/Client/compositor.h>
|
||||
#include <KWayland/Client/connection_thread.h>
|
||||
#include <KWayland/Client/registry.h>
|
||||
#include <KWayland/Client/slide.h>
|
||||
#include <KWayland/Client/surface.h>
|
||||
|
||||
#include <QJSEngine>
|
||||
#include <QJSValue>
|
||||
|
||||
using namespace KWin;
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
static const QString s_socketName = QStringLiteral("wayland_test_effects_scripts-0");
|
||||
|
||||
class ScriptedEffectsTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
void testEffectsHandler();
|
||||
void testEffectsContext();
|
||||
void testShortcuts();
|
||||
void testAnimations_data();
|
||||
void testAnimations();
|
||||
void testScreenEdge();
|
||||
void testScreenEdgeTouch();
|
||||
void testFullScreenEffect_data();
|
||||
void testFullScreenEffect();
|
||||
void testKeepAlive_data();
|
||||
void testKeepAlive();
|
||||
void testGrab();
|
||||
void testGrabAlreadyGrabbedWindow();
|
||||
void testGrabAlreadyGrabbedWindowForced();
|
||||
void testUngrab();
|
||||
void testRedirect_data();
|
||||
void testRedirect();
|
||||
void testComplete();
|
||||
|
||||
private:
|
||||
ScriptedEffect *loadEffect(const QString &name);
|
||||
};
|
||||
|
||||
class ScriptedEffectWithDebugSpy : public KWin::ScriptedEffect
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ScriptedEffectWithDebugSpy();
|
||||
bool load(const QString &name);
|
||||
using AnimationEffect::AniMap;
|
||||
using AnimationEffect::state;
|
||||
Q_INVOKABLE void sendTestResponse(const QString &out); // proxies triggers out from the tests
|
||||
QList<QAction *> actions(); // returns any QActions owned by the ScriptEngine
|
||||
Q_SIGNALS:
|
||||
void testOutput(const QString &data);
|
||||
};
|
||||
|
||||
void ScriptedEffectWithDebugSpy::sendTestResponse(const QString &out)
|
||||
{
|
||||
Q_EMIT testOutput(out);
|
||||
}
|
||||
|
||||
QList<QAction *> ScriptedEffectWithDebugSpy::actions()
|
||||
{
|
||||
return findChildren<QAction *>(QString(), Qt::FindDirectChildrenOnly);
|
||||
}
|
||||
|
||||
ScriptedEffectWithDebugSpy::ScriptedEffectWithDebugSpy()
|
||||
: ScriptedEffect()
|
||||
{
|
||||
}
|
||||
|
||||
bool ScriptedEffectWithDebugSpy::load(const QString &name)
|
||||
{
|
||||
auto selfContext = engine()->newQObject(this);
|
||||
QJSEngine::setObjectOwnership(this, QJSEngine::CppOwnership);
|
||||
const QString path = QFINDTESTDATA("./scripts/" + name + ".js");
|
||||
engine()->globalObject().setProperty("sendTestResponse", selfContext.property("sendTestResponse"));
|
||||
if (!init(name, path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// inject our newly created effect to be registered with the EffectsHandler::loaded_effects
|
||||
// this is private API so some horrible code is used to find the internal effectloader
|
||||
// and register ourselves
|
||||
auto children = effects->children();
|
||||
for (auto it = children.begin(); it != children.end(); ++it) {
|
||||
if (qstrcmp((*it)->metaObject()->className(), "KWin::EffectLoader") != 0) {
|
||||
continue;
|
||||
}
|
||||
QMetaObject::invokeMethod(*it, "effectLoaded", Q_ARG(KWin::Effect *, this), Q_ARG(QString, name));
|
||||
break;
|
||||
}
|
||||
|
||||
return effects->isEffectLoaded(name);
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::initTestCase()
|
||||
{
|
||||
if (!Test::renderNodeAvailable()) {
|
||||
QSKIP("no render node available");
|
||||
return;
|
||||
}
|
||||
qRegisterMetaType<KWin::Window *>();
|
||||
qRegisterMetaType<KWin::Effect *>();
|
||||
QVERIFY(waylandServer()->init(s_socketName));
|
||||
Test::setOutputConfig({QRect(0, 0, 1280, 1024)});
|
||||
|
||||
// disable all effects - we don't want to have it interact with the rendering
|
||||
auto config = KSharedConfig::openConfig(QString(), KConfig::SimpleConfig);
|
||||
KConfigGroup plugins(config, QStringLiteral("Plugins"));
|
||||
const auto builtinNames = EffectLoader().listOfKnownEffects();
|
||||
for (QString name : builtinNames) {
|
||||
plugins.writeEntry(name + QStringLiteral("Enabled"), false);
|
||||
}
|
||||
|
||||
config->sync();
|
||||
kwinApp()->setConfig(config);
|
||||
|
||||
qputenv("KWIN_COMPOSE", QByteArrayLiteral("O2"));
|
||||
qputenv("KWIN_EFFECTS_FORCE_ANIMATIONS", "1");
|
||||
kwinApp()->start();
|
||||
|
||||
KWin::VirtualDesktopManager::self()->setCount(2);
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::init()
|
||||
{
|
||||
QVERIFY(Test::setupWaylandConnection());
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::cleanup()
|
||||
{
|
||||
Test::destroyWaylandConnection();
|
||||
|
||||
effects->unloadAllEffects();
|
||||
QVERIFY(effects->loadedEffects().isEmpty());
|
||||
|
||||
KWin::VirtualDesktopManager::self()->setCurrent(1);
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testEffectsHandler()
|
||||
{
|
||||
// this triggers and tests some of the signals in EffectHandler, which is exposed to JS as context property "effects"
|
||||
auto *effect = new ScriptedEffectWithDebugSpy; // cleaned up in ::clean
|
||||
QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
auto waitFor = [&effectOutputSpy](const QString &expected) {
|
||||
QVERIFY(effectOutputSpy.count() > 0 || effectOutputSpy.wait());
|
||||
QCOMPARE(effectOutputSpy.first().first(), expected);
|
||||
effectOutputSpy.removeFirst();
|
||||
};
|
||||
QVERIFY(effect->load("effectsHandler"));
|
||||
|
||||
// trigger windowAdded signal
|
||||
|
||||
// create a window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
shellSurface->set_title("WindowA");
|
||||
auto *c = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(c);
|
||||
QCOMPARE(workspace()->activeWindow(), c);
|
||||
|
||||
waitFor("windowAdded - WindowA");
|
||||
waitFor("stackingOrder - 1 WindowA");
|
||||
|
||||
// windowMinimsed
|
||||
c->setMinimized(true);
|
||||
waitFor("windowMinimized - WindowA");
|
||||
|
||||
c->setMinimized(false);
|
||||
waitFor("windowUnminimized - WindowA");
|
||||
|
||||
surface.reset();
|
||||
waitFor("windowClosed - WindowA");
|
||||
|
||||
// desktop management
|
||||
KWin::VirtualDesktopManager::self()->setCurrent(2);
|
||||
waitFor("desktopChanged - 1 2");
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testEffectsContext()
|
||||
{
|
||||
// this tests misc non-objects exposed to the script engine: animationTime, displaySize, use of external enums
|
||||
|
||||
auto *effect = new ScriptedEffectWithDebugSpy; // cleaned up in ::clean
|
||||
QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(effect->load("effectContext"));
|
||||
QCOMPARE(effectOutputSpy[0].first(), "1280x1024");
|
||||
QCOMPARE(effectOutputSpy[1].first(), "100");
|
||||
QCOMPARE(effectOutputSpy[2].first(), "2");
|
||||
QCOMPARE(effectOutputSpy[3].first(), "0");
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testShortcuts()
|
||||
{
|
||||
#if !KWIN_BUILD_GLOBALSHORTCUTS
|
||||
QSKIP("Can't test shortcuts without shortcuts");
|
||||
return;
|
||||
#endif
|
||||
|
||||
// this tests method registerShortcut
|
||||
auto *effect = new ScriptedEffectWithDebugSpy; // cleaned up in ::clean
|
||||
QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(effect->load("shortcutsTest"));
|
||||
QCOMPARE(effect->actions().count(), 1);
|
||||
auto action = effect->actions()[0];
|
||||
QCOMPARE(action->objectName(), "testShortcut");
|
||||
QCOMPARE(action->text(), "Test Shortcut");
|
||||
QCOMPARE(KGlobalAccel::self()->shortcut(action).first(), QKeySequence("Meta+Shift+Y"));
|
||||
action->trigger();
|
||||
QCOMPARE(effectOutputSpy[0].first(), "shortcutTriggered");
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testAnimations_data()
|
||||
{
|
||||
QTest::addColumn<QString>("file");
|
||||
QTest::addColumn<int>("animationCount");
|
||||
|
||||
QTest::newRow("single") << "animationTest" << 1;
|
||||
QTest::newRow("multi") << "animationTestMulti" << 2;
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testAnimations()
|
||||
{
|
||||
// this tests animate/set/cancel
|
||||
// methods take either an int or an array, as forced in the data above
|
||||
// also splits animate vs effects.animate(..)
|
||||
|
||||
QFETCH(QString, file);
|
||||
QFETCH(int, animationCount);
|
||||
|
||||
auto *effect = new ScriptedEffectWithDebugSpy;
|
||||
QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(effect->load(file));
|
||||
|
||||
// animated after window added connect
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
shellSurface->set_title("Window 1");
|
||||
auto *c = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(c);
|
||||
QCOMPARE(workspace()->activeWindow(), c);
|
||||
|
||||
{
|
||||
const auto &state = effect->state();
|
||||
QCOMPARE(state.size(), 1);
|
||||
QVERIFY(state.contains(c->effectWindow()));
|
||||
const auto &animationsForWindow = state.at(c->effectWindow()).first;
|
||||
QCOMPARE(animationsForWindow.size(), animationCount);
|
||||
QCOMPARE(animationsForWindow[0].timeLine.duration(), 100ms);
|
||||
QCOMPARE(animationsForWindow[0].to, FPx2(1.4));
|
||||
QCOMPARE(animationsForWindow[0].attribute, AnimationEffect::Scale);
|
||||
QCOMPARE(animationsForWindow[0].timeLine.easingCurve().type(), QEasingCurve::OutCubic);
|
||||
QCOMPARE(animationsForWindow[0].terminationFlags,
|
||||
AnimationEffect::TerminateAtSource | AnimationEffect::TerminateAtTarget);
|
||||
|
||||
if (animationCount == 2) {
|
||||
QCOMPARE(animationsForWindow[1].timeLine.duration(), 100ms);
|
||||
QCOMPARE(animationsForWindow[1].to, FPx2(0.0));
|
||||
QCOMPARE(animationsForWindow[1].attribute, AnimationEffect::Opacity);
|
||||
QCOMPARE(animationsForWindow[1].terminationFlags,
|
||||
AnimationEffect::TerminateAtSource | AnimationEffect::TerminateAtTarget);
|
||||
}
|
||||
}
|
||||
QCOMPARE(effectOutputSpy[0].first(), "true");
|
||||
|
||||
// window state changes, scale should be retargetted
|
||||
|
||||
c->setMinimized(true);
|
||||
{
|
||||
const auto &state = effect->state();
|
||||
QCOMPARE(state.size(), 1);
|
||||
const auto &animationsForWindow = state.at(c->effectWindow()).first;
|
||||
QCOMPARE(animationsForWindow.size(), animationCount);
|
||||
QCOMPARE(animationsForWindow[0].timeLine.duration(), 200ms);
|
||||
QCOMPARE(animationsForWindow[0].to, FPx2(1.5));
|
||||
QCOMPARE(animationsForWindow[0].attribute, AnimationEffect::Scale);
|
||||
QCOMPARE(animationsForWindow[0].terminationFlags,
|
||||
AnimationEffect::TerminateAtSource | AnimationEffect::TerminateAtTarget);
|
||||
if (animationCount == 2) {
|
||||
QCOMPARE(animationsForWindow[1].timeLine.duration(), 200ms);
|
||||
QCOMPARE(animationsForWindow[1].to, FPx2(1.5));
|
||||
QCOMPARE(animationsForWindow[1].attribute, AnimationEffect::Opacity);
|
||||
QCOMPARE(animationsForWindow[1].terminationFlags,
|
||||
AnimationEffect::TerminateAtSource | AnimationEffect::TerminateAtTarget);
|
||||
}
|
||||
}
|
||||
c->setMinimized(false);
|
||||
{
|
||||
const auto &state = effect->state();
|
||||
QCOMPARE(state.size(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testScreenEdge()
|
||||
{
|
||||
// this test checks registerScreenEdge functions
|
||||
auto *effect = new ScriptedEffectWithDebugSpy; // cleaned up in ::clean
|
||||
QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(effect->load("screenEdgeTest"));
|
||||
effect->borderActivated(KWin::ElectricTopRight);
|
||||
QCOMPARE(effectOutputSpy.count(), 1);
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testScreenEdgeTouch()
|
||||
{
|
||||
// this test checks registerTouchScreenEdge functions
|
||||
auto *effect = new ScriptedEffectWithDebugSpy; // cleaned up in ::clean
|
||||
QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(effect->load("screenEdgeTouchTest"));
|
||||
effect->actions()[0]->trigger();
|
||||
QCOMPARE(effectOutputSpy.count(), 1);
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testFullScreenEffect_data()
|
||||
{
|
||||
QTest::addColumn<QString>("file");
|
||||
|
||||
QTest::newRow("single") << "fullScreenEffectTest";
|
||||
QTest::newRow("multi") << "fullScreenEffectTestMulti";
|
||||
QTest::newRow("global") << "fullScreenEffectTestGlobal";
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testFullScreenEffect()
|
||||
{
|
||||
QFETCH(QString, file);
|
||||
|
||||
auto *effectMain = new ScriptedEffectWithDebugSpy; // cleaned up in ::clean
|
||||
QSignalSpy effectOutputSpy(effectMain, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QSignalSpy fullScreenEffectActiveSpy(effects, &EffectsHandler::hasActiveFullScreenEffectChanged);
|
||||
QSignalSpy isActiveFullScreenEffectSpy(effectMain, &ScriptedEffect::isActiveFullScreenEffectChanged);
|
||||
|
||||
QVERIFY(effectMain->load(file));
|
||||
|
||||
// load any random effect from another test to confirm fullscreen effect state is correctly
|
||||
// shown as being someone else
|
||||
auto effectOther = new ScriptedEffectWithDebugSpy();
|
||||
QVERIFY(effectOther->load("screenEdgeTouchTest"));
|
||||
QSignalSpy isActiveFullScreenEffectSpyOther(effectOther, &ScriptedEffect::isActiveFullScreenEffectChanged);
|
||||
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
shellSurface->set_title("Window 1");
|
||||
auto *c = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(c);
|
||||
QCOMPARE(workspace()->activeWindow(), c);
|
||||
|
||||
QCOMPARE(effects->hasActiveFullScreenEffect(), false);
|
||||
QCOMPARE(effectMain->isActiveFullScreenEffect(), false);
|
||||
|
||||
// trigger animation
|
||||
KWin::VirtualDesktopManager::self()->setCurrent(2);
|
||||
|
||||
QCOMPARE(effects->activeFullScreenEffect(), effectMain);
|
||||
QCOMPARE(effects->hasActiveFullScreenEffect(), true);
|
||||
QCOMPARE(fullScreenEffectActiveSpy.count(), 1);
|
||||
|
||||
QCOMPARE(effectMain->isActiveFullScreenEffect(), true);
|
||||
QCOMPARE(isActiveFullScreenEffectSpy.count(), 1);
|
||||
|
||||
QCOMPARE(effectOther->isActiveFullScreenEffect(), false);
|
||||
QCOMPARE(isActiveFullScreenEffectSpyOther.count(), 0);
|
||||
|
||||
// after 500ms trigger another full screen animation
|
||||
QTest::qWait(500);
|
||||
KWin::VirtualDesktopManager::self()->setCurrent(1);
|
||||
QCOMPARE(effects->activeFullScreenEffect(), effectMain);
|
||||
|
||||
// after 1000ms (+a safety margin for time based tests) we should still be the active full screen effect
|
||||
// despite first animation expiring
|
||||
QTest::qWait(500 + 100);
|
||||
QCOMPARE(effects->activeFullScreenEffect(), effectMain);
|
||||
|
||||
// after 1500ms (+a safetey margin) we should have no full screen effect
|
||||
QTest::qWait(500 + 100);
|
||||
QCOMPARE(effects->activeFullScreenEffect(), nullptr);
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testKeepAlive_data()
|
||||
{
|
||||
QTest::addColumn<QString>("file");
|
||||
QTest::addColumn<bool>("keepAlive");
|
||||
|
||||
QTest::newRow("keep") << "keepAliveTest" << true;
|
||||
QTest::newRow("don't keep") << "keepAliveTestDontKeep" << false;
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testKeepAlive()
|
||||
{
|
||||
// this test checks whether closed windows are kept alive
|
||||
// when keepAlive property is set to true(false)
|
||||
|
||||
QFETCH(QString, file);
|
||||
QFETCH(bool, keepAlive);
|
||||
|
||||
auto *effect = new ScriptedEffectWithDebugSpy;
|
||||
QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(effect->load(file));
|
||||
|
||||
// create a window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
auto *c = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(c);
|
||||
QCOMPARE(workspace()->activeWindow(), c);
|
||||
|
||||
// no active animations at the beginning
|
||||
QCOMPARE(effect->state().size(), 0);
|
||||
|
||||
// trigger windowClosed signal
|
||||
QSignalSpy deletedRemovedSpy(workspace(), &Workspace::deletedRemoved);
|
||||
surface.reset();
|
||||
QVERIFY(effectOutputSpy.count() == 1 || effectOutputSpy.wait());
|
||||
|
||||
if (keepAlive) {
|
||||
QCOMPARE(effect->state().size(), 1);
|
||||
QCOMPARE(deletedRemovedSpy.count(), 0);
|
||||
|
||||
QTest::qWait(500);
|
||||
QCOMPARE(effect->state().size(), 1);
|
||||
QCOMPARE(deletedRemovedSpy.count(), 0);
|
||||
|
||||
QTest::qWait(500 + 100); // 100ms is extra safety margin
|
||||
QCOMPARE(deletedRemovedSpy.count(), 1);
|
||||
QCOMPARE(effect->state().size(), 0);
|
||||
} else {
|
||||
// the test effect doesn't keep the window alive, so it should be
|
||||
// removed immediately
|
||||
QVERIFY(deletedRemovedSpy.count() == 1 || deletedRemovedSpy.wait(100)); // 100ms is less than duration of the animation
|
||||
QCOMPARE(effect->state().size(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testGrab()
|
||||
{
|
||||
// this test verifies that scripted effects can grab windows that are
|
||||
// not already grabbed
|
||||
|
||||
// load the test effect
|
||||
auto effect = new ScriptedEffectWithDebugSpy;
|
||||
QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(effect->load(QStringLiteral("grabTest")));
|
||||
|
||||
// create test window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window);
|
||||
QCOMPARE(workspace()->activeWindow(), window);
|
||||
|
||||
// the test effect should grab the test window successfully
|
||||
QCOMPARE(effectOutputSpy.count(), 1);
|
||||
QCOMPARE(effectOutputSpy.first().first(), QStringLiteral("ok"));
|
||||
QCOMPARE(window->effectWindow()->data(WindowAddedGrabRole).value<void *>(), effect);
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testGrabAlreadyGrabbedWindow()
|
||||
{
|
||||
// this test verifies that scripted effects cannot grab already grabbed
|
||||
// windows (unless force is set to true of course)
|
||||
|
||||
// load effect that will hold the window grab
|
||||
auto owner = new ScriptedEffectWithDebugSpy;
|
||||
QSignalSpy ownerOutputSpy(owner, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(owner->load(QStringLiteral("grabAlreadyGrabbedWindowTest_owner")));
|
||||
|
||||
// load effect that will try to grab already grabbed window
|
||||
auto grabber = new ScriptedEffectWithDebugSpy;
|
||||
QSignalSpy grabberOutputSpy(grabber, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(grabber->load(QStringLiteral("grabAlreadyGrabbedWindowTest_grabber")));
|
||||
|
||||
// create test window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window);
|
||||
QCOMPARE(workspace()->activeWindow(), window);
|
||||
|
||||
// effect that initially held the grab should still hold the grab
|
||||
QCOMPARE(ownerOutputSpy.count(), 1);
|
||||
QCOMPARE(ownerOutputSpy.first().first(), QStringLiteral("ok"));
|
||||
QCOMPARE(window->effectWindow()->data(WindowAddedGrabRole).value<void *>(), owner);
|
||||
|
||||
// effect that tried to grab already grabbed window should fail miserably
|
||||
QCOMPARE(grabberOutputSpy.count(), 1);
|
||||
QCOMPARE(grabberOutputSpy.first().first(), QStringLiteral("fail"));
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testGrabAlreadyGrabbedWindowForced()
|
||||
{
|
||||
// this test verifies that scripted effects can steal window grabs when
|
||||
// they forcefully try to grab windows
|
||||
|
||||
// load effect that initially will be holding the window grab
|
||||
auto owner = new ScriptedEffectWithDebugSpy;
|
||||
QSignalSpy ownerOutputSpy(owner, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(owner->load(QStringLiteral("grabAlreadyGrabbedWindowForcedTest_owner")));
|
||||
|
||||
// load effect that will try to steal the window grab
|
||||
auto thief = new ScriptedEffectWithDebugSpy;
|
||||
QSignalSpy thiefOutputSpy(thief, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(thief->load(QStringLiteral("grabAlreadyGrabbedWindowForcedTest_thief")));
|
||||
|
||||
// create test window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window);
|
||||
QCOMPARE(workspace()->activeWindow(), window);
|
||||
|
||||
// verify that the owner in fact held the grab
|
||||
QCOMPARE(ownerOutputSpy.count(), 1);
|
||||
QCOMPARE(ownerOutputSpy.first().first(), QStringLiteral("ok"));
|
||||
|
||||
// effect that grabbed the test window forcefully should now hold the grab
|
||||
QCOMPARE(thiefOutputSpy.count(), 1);
|
||||
QCOMPARE(thiefOutputSpy.first().first(), QStringLiteral("ok"));
|
||||
QCOMPARE(window->effectWindow()->data(WindowAddedGrabRole).value<void *>(), thief);
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testUngrab()
|
||||
{
|
||||
// this test verifies that scripted effects can ungrab windows that they
|
||||
// are previously grabbed
|
||||
|
||||
// load the test effect
|
||||
auto effect = new ScriptedEffectWithDebugSpy;
|
||||
QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
QVERIFY(effect->load(QStringLiteral("ungrabTest")));
|
||||
|
||||
// create test window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window);
|
||||
QCOMPARE(workspace()->activeWindow(), window);
|
||||
|
||||
// the test effect should grab the test window successfully
|
||||
QCOMPARE(effectOutputSpy.count(), 1);
|
||||
QCOMPARE(effectOutputSpy.first().first(), QStringLiteral("ok"));
|
||||
QCOMPARE(window->effectWindow()->data(WindowAddedGrabRole).value<void *>(), effect);
|
||||
|
||||
// when the test effect sees that a window was minimized, it will try to ungrab it
|
||||
effectOutputSpy.clear();
|
||||
window->setMinimized(true);
|
||||
|
||||
QCOMPARE(effectOutputSpy.count(), 1);
|
||||
QCOMPARE(effectOutputSpy.first().first(), QStringLiteral("ok"));
|
||||
QCOMPARE(window->effectWindow()->data(WindowAddedGrabRole).value<void *>(), nullptr);
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testRedirect_data()
|
||||
{
|
||||
QTest::addColumn<QString>("file");
|
||||
QTest::addColumn<bool>("shouldTerminate");
|
||||
QTest::newRow("animate/DontTerminateAtSource") << "redirectAnimateDontTerminateTest" << false;
|
||||
QTest::newRow("animate/TerminateAtSource") << "redirectAnimateTerminateTest" << true;
|
||||
QTest::newRow("set/DontTerminate") << "redirectSetDontTerminateTest" << false;
|
||||
QTest::newRow("set/Terminate") << "redirectSetTerminateTest" << true;
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testRedirect()
|
||||
{
|
||||
// this test verifies that redirect() works
|
||||
|
||||
// load the test effect
|
||||
auto effect = new ScriptedEffectWithDebugSpy;
|
||||
QFETCH(QString, file);
|
||||
QVERIFY(effect->load(file));
|
||||
|
||||
// create test window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window);
|
||||
QCOMPARE(workspace()->activeWindow(), window);
|
||||
|
||||
auto around = [](std::chrono::milliseconds elapsed,
|
||||
std::chrono::milliseconds pivot,
|
||||
std::chrono::milliseconds margin) {
|
||||
return std::abs(elapsed.count() - pivot.count()) < margin.count();
|
||||
};
|
||||
|
||||
// initially, the test animation is at the source position
|
||||
|
||||
{
|
||||
const auto &state = effect->state();
|
||||
QCOMPARE(state.size(), 1);
|
||||
QVERIFY(state.contains(window->effectWindow()));
|
||||
const auto &animations = state.at(window->effectWindow()).first;
|
||||
QCOMPARE(animations.size(), 1);
|
||||
QCOMPARE(animations[0].timeLine.direction(), TimeLine::Forward);
|
||||
QVERIFY(around(animations[0].timeLine.elapsed(), 0ms, 50ms));
|
||||
}
|
||||
|
||||
// minimize the test window after 250ms, when the test effect sees that
|
||||
// a window was minimized, it will try to reverse animation for it
|
||||
QTest::qWait(250);
|
||||
|
||||
QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
|
||||
window->setMinimized(true);
|
||||
|
||||
QCOMPARE(effectOutputSpy.count(), 1);
|
||||
QCOMPARE(effectOutputSpy.first().first(), QStringLiteral("ok"));
|
||||
|
||||
{
|
||||
const auto &state = effect->state();
|
||||
QCOMPARE(state.size(), 1);
|
||||
QVERIFY(state.contains(window->effectWindow()));
|
||||
const auto &animations = state.at(window->effectWindow()).first;
|
||||
QCOMPARE(animations.size(), 1);
|
||||
QCOMPARE(animations[0].timeLine.direction(), TimeLine::Backward);
|
||||
QVERIFY(around(animations[0].timeLine.elapsed(), 1000ms - 250ms, 50ms));
|
||||
}
|
||||
|
||||
// wait for the animation to reach the start position, 100ms is an extra
|
||||
// safety margin
|
||||
QTest::qWait(250 + 100);
|
||||
|
||||
QFETCH(bool, shouldTerminate);
|
||||
if (shouldTerminate) {
|
||||
const auto &state = effect->state();
|
||||
QCOMPARE(state.size(), 0);
|
||||
} else {
|
||||
const auto &state = effect->state();
|
||||
QCOMPARE(state.size(), 1);
|
||||
QVERIFY(state.contains(window->effectWindow()));
|
||||
const auto &animations = state.at(window->effectWindow()).first;
|
||||
QCOMPARE(animations.size(), 1);
|
||||
QCOMPARE(animations[0].timeLine.direction(), TimeLine::Backward);
|
||||
QCOMPARE(animations[0].timeLine.elapsed(), 1000ms);
|
||||
QCOMPARE(animations[0].timeLine.value(), 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptedEffectsTest::testComplete()
|
||||
{
|
||||
// this test verifies that complete works
|
||||
|
||||
// load the test effect
|
||||
auto effect = new ScriptedEffectWithDebugSpy;
|
||||
QVERIFY(effect->load(QStringLiteral("completeTest")));
|
||||
|
||||
// create test window
|
||||
std::unique_ptr<KWayland::Client::Surface> surface = Test::createSurface();
|
||||
QVERIFY(surface);
|
||||
std::unique_ptr<Test::XdgToplevel> shellSurface = Test::createXdgToplevelSurface(surface.get());
|
||||
QVERIFY(shellSurface);
|
||||
Window *window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
||||
QVERIFY(window);
|
||||
QCOMPARE(workspace()->activeWindow(), window);
|
||||
|
||||
auto around = [](std::chrono::milliseconds elapsed,
|
||||
std::chrono::milliseconds pivot,
|
||||
std::chrono::milliseconds margin) {
|
||||
return std::abs(elapsed.count() - pivot.count()) < margin.count();
|
||||
};
|
||||
|
||||
// initially, the test animation should be at the start position
|
||||
{
|
||||
const auto &state = effect->state();
|
||||
QCOMPARE(state.size(), 1);
|
||||
QVERIFY(state.contains(window->effectWindow()));
|
||||
const auto &animations = state.at(window->effectWindow()).first;
|
||||
QCOMPARE(animations.size(), 1);
|
||||
QVERIFY(around(animations[0].timeLine.elapsed(), 0ms, 50ms));
|
||||
QVERIFY(!animations[0].timeLine.done());
|
||||
}
|
||||
|
||||
// wait for 250ms
|
||||
QTest::qWait(250);
|
||||
|
||||
{
|
||||
const auto &state = effect->state();
|
||||
QCOMPARE(state.size(), 1);
|
||||
QVERIFY(state.contains(window->effectWindow()));
|
||||
const auto &animations = state.at(window->effectWindow()).first;
|
||||
QCOMPARE(animations.size(), 1);
|
||||
QVERIFY(around(animations[0].timeLine.elapsed(), 250ms, 50ms));
|
||||
QVERIFY(!animations[0].timeLine.done());
|
||||
}
|
||||
|
||||
// minimize the test window, when the test effect sees that a window was
|
||||
// minimized, it will try to complete animation for it
|
||||
QSignalSpy effectOutputSpy(effect, &ScriptedEffectWithDebugSpy::testOutput);
|
||||
|
||||
window->setMinimized(true);
|
||||
|
||||
QCOMPARE(effectOutputSpy.count(), 1);
|
||||
QCOMPARE(effectOutputSpy.first().first(), QStringLiteral("ok"));
|
||||
|
||||
{
|
||||
const auto &state = effect->state();
|
||||
QCOMPARE(state.size(), 1);
|
||||
QVERIFY(state.contains(window->effectWindow()));
|
||||
const auto &animations = state.at(window->effectWindow()).first;
|
||||
QCOMPARE(animations.size(), 1);
|
||||
QCOMPARE(animations[0].timeLine.elapsed(), 1000ms);
|
||||
QVERIFY(animations[0].timeLine.done());
|
||||
}
|
||||
}
|
||||
|
||||
WAYLANDTEST_MAIN(ScriptedEffectsTest)
|
||||
#include "scripted_effects_test.moc"
|
||||
@@ -1,12 +0,0 @@
|
||||
effects.windowAdded.connect(function(w) {
|
||||
w.anim1 = effect.animate(w, Effect.Scale, 100, 1.4, 0.2, 0, QEasingCurve.OutCubic);
|
||||
sendTestResponse(typeof(w.anim1) == "number");
|
||||
|
||||
w.minimizedChanged.connect(() => {
|
||||
if (w.minimized) {
|
||||
retarget(w.anim1, 1.5, 200);
|
||||
} else {
|
||||
cancel(w.anim1);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,24 +0,0 @@
|
||||
effects.windowAdded.connect(function(w) {
|
||||
w.anim1 = animate({
|
||||
window: w,
|
||||
duration: 100,
|
||||
animations: [{
|
||||
type: Effect.Scale,
|
||||
to: 1.4,
|
||||
curve: QEasingCurve.OutCubic
|
||||
}, {
|
||||
type: Effect.Opacity,
|
||||
curve: QEasingCurve.OutCubic,
|
||||
to: 0.0
|
||||
}]
|
||||
});
|
||||
sendTestResponse(typeof(w.anim1) == "object" && Array.isArray(w.anim1));
|
||||
|
||||
w.minimizedChanged.connect(() => {
|
||||
if (w.minimized) {
|
||||
retarget(w.anim1, 1.5, 200);
|
||||
} else {
|
||||
cancel(w.anim1);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,22 +0,0 @@
|
||||
effects.windowAdded.connect(function (window) {
|
||||
window.animation = set({
|
||||
window: window,
|
||||
curve: QEasingCurve.Linear,
|
||||
duration: animationTime(1000),
|
||||
type: Effect.Opacity,
|
||||
from: 0,
|
||||
to: 1,
|
||||
keepAlive: false
|
||||
});
|
||||
|
||||
window.minimizedChanged.connect(() => {
|
||||
if (!window.minimized) {
|
||||
return;
|
||||
}
|
||||
if (complete(window.animation)) {
|
||||
sendTestResponse('ok');
|
||||
} else {
|
||||
sendTestResponse('fail');
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,6 +0,0 @@
|
||||
sendTestResponse(displayWidth() + "x" + displayHeight());
|
||||
sendTestResponse(animationTime(100));
|
||||
|
||||
//test enums for Effect / QEasingCurve
|
||||
sendTestResponse(Effect.Saturation)
|
||||
sendTestResponse(QEasingCurve.Linear)
|
||||
@@ -1,18 +0,0 @@
|
||||
effects.windowAdded.connect(function(window) {
|
||||
sendTestResponse("windowAdded - " + window.caption);
|
||||
sendTestResponse("stackingOrder - " + effects.stackingOrder.length + " " + effects.stackingOrder[0].caption);
|
||||
|
||||
window.minimizedChanged.connect(() => {
|
||||
if (window.minimized) {
|
||||
sendTestResponse("windowMinimized - " + window.caption);
|
||||
} else {
|
||||
sendTestResponse("windowUnminimized - " + window.caption);
|
||||
}
|
||||
});
|
||||
});
|
||||
effects.windowClosed.connect(function(window) {
|
||||
sendTestResponse("windowClosed - " + window.caption);
|
||||
});
|
||||
effects.desktopChanged.connect(function(old, current) {
|
||||
sendTestResponse("desktopChanged - " + old.x11DesktopNumber + " " + current.x11DesktopNumber);
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user