Advance Wayland and KDE package bring-up

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-04-14 10:51:06 +01:00
parent 51f3c21121
commit cf12defd28
15214 changed files with 20594243 additions and 269 deletions
@@ -0,0 +1,5 @@
#clang-tidy
5e0a6105963d8fe2721aec9b6a43a565f338c978
# astyle
12e52f6208c18516b1dbe3c0c15ef5b1967ed40f
@@ -0,0 +1,29 @@
# Ignore the following files
*~
*.[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*
.cmake/
/.clang-format
/compile_commands.json
.clangd
.idea
.vscode
/cmake-build*
.cache
@@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org>
# SPDX-License-Identifier: CC0-1.0
include:
- project: sysadmin/ci-utilities
file:
- /gitlab-templates/linux-qt6.yml
- /gitlab-templates/android-qt6.yml
- /gitlab-templates/freebsd-qt6.yml
- /gitlab-templates/windows-qt6.yml
@@ -0,0 +1,13 @@
Dependencies:
- 'on': ['@all']
'require':
'frameworks/extra-cmake-modules': '@same'
- 'on': ['Linux/Qt6', 'FreeBSD/Qt6']
'require':
'libraries/plasma-wayland-protocols': '@latest-kf6'
'third-party/wayland': '@latest'
'third-party/wayland-protocols': '@latest'
Options:
test-before-installing: True
require-passing-tests-on: [ 'Linux', 'FreeBSD', 'Windows' ]
@@ -0,0 +1,138 @@
cmake_minimum_required(VERSION 3.16)
set(KF_VERSION "6.10.0") # handled by release scripts
project(KWindowSystem VERSION ${KF_VERSION})
# ECM setup
include(FeatureSummary)
find_package(ECM 6.10.0 NO_MODULE)
set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules")
feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDEGitCommitHooks)
include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMGenerateExportHeader)
include(CMakePackageConfigHelpers)
include(ECMSetupVersion)
include(ECMGenerateHeaders)
include(CMakeFindFrameworks)
include(ECMQtDeclareLoggingCategory)
include(ECMDeprecationSettings)
include(ECMAddQch)
include(ECMPoQmTools)
include(ECMGeneratePkgConfigFile)
include(ECMQmlModule)
set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].")
option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF)
add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)")
set(kwindowsystem_version_header "${CMAKE_CURRENT_BINARY_DIR}/src/kwindowsystem_version.h")
ecm_setup_version(PROJECT VARIABLE_PREFIX KWINDOWSYSTEM
VERSION_HEADER "${kwindowsystem_version_header}"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF6WindowSystemConfigVersion.cmake"
SOVERSION 6)
# Dependencies
set(REQUIRED_QT_VERSION 6.6.0)
find_package(Qt6Gui ${REQUIRED_QT_VERSION} CONFIG REQUIRED)
option(KWINDOWSYSTEM_QML "Build QML bindings" ON)
if (KWINDOWSYSTEM_QML)
find_package(Qt6Qml ${REQUIRED_QT_VERSION} CONFIG REQUIRED)
endif()
option(KWINDOWSYSTEM_X11 "Build X11 support" ON)
option(KWINDOWSYSTEM_WAYLAND "Build Wayland support" ON)
if (WIN32 OR APPLE OR ANDROID OR HAIKU)
set(KWINDOWSYSTEM_X11 OFF)
set(KWINDOWSYSTEM_WAYLAND OFF)
endif()
if (KWINDOWSYSTEM_X11)
find_package(X11 REQUIRED)
find_package(XCB COMPONENTS REQUIRED XCB KEYSYMS RES ICCCM)
endif()
if (KWINDOWSYSTEM_WAYLAND)
find_package(Qt6WaylandClient ${REQUIRED_QT_VERSION} CONFIG REQUIRED)
find_package(WaylandProtocols 1.21 REQUIRED)
find_package(PlasmaWaylandProtocols REQUIRED)
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_SEAL);
mmap(nullptr, size, PROT_WRITE, MAP_SHARED, fd, 0);
return 0;
}" HAVE_MEMFD)
endif()
set(KWINDOWSYSTEM_HAVE_X11 ${KWINDOWSYSTEM_X11})
# Subdirectories
#ecm_install_po_files_as_qm(poqm)
ecm_set_disabled_deprecation_versions(
QT 6.8.0
)
add_subdirectory(src)
if (BUILD_TESTING)
add_subdirectory(autotests)
add_subdirectory(tests)
endif()
# create a Config.cmake and a ConfigVersion.cmake file and install them
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF6WindowSystem")
if (BUILD_QCH)
ecm_install_qch_export(
TARGETS KF6WindowSystem_QCH
FILE KF6WindowSystemQchTargets.cmake
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
set(PACKAGE_INCLUDE_QCHTARGETS "include(\"\${CMAKE_CURRENT_LIST_DIR}/KF6WindowSystemQchTargets.cmake\")")
endif()
configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/KF6WindowSystemConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/KF6WindowSystemConfig.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KF6WindowSystemConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/KF6WindowSystemConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel )
install(EXPORT KF6WindowSystemTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF6WindowSystemTargets.cmake NAMESPACE KF6:: )
install(FILES ${kwindowsystem_version_header}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/KWindowSystem COMPONENT Devel )
if (NOT WIN32)
ecm_generate_pkgconfig_file(BASE_NAME KF6WindowSystem
INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF}/KWindowSystem
DEPS Qt6Gui
INSTALL)
endif()
include(ECMFeatureSummary)
ecm_feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
@@ -0,0 +1,17 @@
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(Qt6Gui @REQUIRED_QT_VERSION@)
if(@X11_FOUND@)
find_dependency(X11)
endif()
if(NOT @BUILD_SHARED_LIBS@)
if(@X11_FOUND@)
find_dependency(XCB)
endif()
endif()
include("${CMAKE_CURRENT_LIST_DIR}/KF6WindowSystemTargets.cmake")
@PACKAGE_INCLUDE_QCHTARGETS@
@@ -0,0 +1,121 @@
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.
@@ -0,0 +1,467 @@
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!
@@ -0,0 +1,468 @@
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!
@@ -0,0 +1,163 @@
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.
@@ -0,0 +1,12 @@
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.
@@ -0,0 +1,19 @@
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.
@@ -0,0 +1,16 @@
# KWindowSystem
Access to the windowing system
## Introduction
Convenience access to certain properties and features of the windowing system.
KWindowSystem provides information about the windowing system and allows interaction with
the windowing system. It provides an high level API which is windowing system independent and
has platform specific implementations. This API is inspired by X11 and thus not all functionality
is available on all windowing systems.
In addition to the high level API, this framework also provides several more low level classes
for interaction with the X Windowing System.
@@ -0,0 +1,59 @@
remove_definitions(-DQT_NO_CAST_FROM_BYTEARRAY)
remove_definitions(-DQT_NO_CAST_FROM_ASCII)
remove_definitions(-DQT_NO_CAST_TO_ASCII)
add_definitions(-DAUTOTEST_BUILD_DIR="${CMAKE_CURRENT_BINARY_DIR}")
include(ECMMarkAsTest)
include(ECMAddTests)
find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Test Widgets)
add_subdirectory(helper)
macro(KWINDOWSYSTEM_UNIT_TESTS)
foreach(_testname ${ARGN})
set(libs KF6::WindowSystem Qt6::Test Qt6::Widgets Qt6::GuiPrivate)
if (KWINDOWSYSTEM_X11)
list(APPEND libs XCB::XCB XCB::KEYSYMS XCB::ICCCM)
endif()
ecm_add_test(${_testname}.cpp LINK_LIBRARIES ${libs} NAME_PREFIX "kwindowsystem-" GUI)
endforeach(_testname)
endmacro(KWINDOWSYSTEM_UNIT_TESTS)
macro(KWINDOWSYSTEM_EXECUTABLE_TESTS)
foreach(_testname ${ARGN})
add_executable(${_testname} ${_testname}.cpp)
target_link_libraries(${_testname} KF6::WindowSystem Qt6::Test XCB::XCB Qt6::GuiPrivate)
ecm_mark_as_test(${_testname})
endforeach()
endmacro()
if(KWINDOWSYSTEM_X11)
include_directories(${CMAKE_SOURCE_DIR}/src/platforms/xcb)
kwindowsystem_unit_tests(
kmanagerselectiontest
kstartupinfo_unittest
kxmessages_unittest
kkeyserver_x11_unittest
)
kwindowsystem_unit_tests(
kwindoweffectstest
kwindowinfox11test
kwindowsystemx11test
kwindowsystem_threadtest
netrootinfotestwm
netwininfotestclient
netwininfotestwm
compositingenabled_test
)
kwindowsystem_executable_tests(
fixx11h_test
fixx11h_test2
dontcrashmapviewport
)
endif()
ecm_add_test(kwindowsystem_platform_wayland_test.cpp LINK_LIBRARIES KF6::WindowSystem Qt6::Test TEST_NAME kwindowsystemplatformwaylandtest NAME_PREFIX "kwindowsystem-" GUI)
@@ -0,0 +1,44 @@
/*
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include <KWindowSystem>
#include <QSignalSpy>
#include <QTest>
#include "kselectionowner.h"
#include "kx11extras.h"
class CompositingEnabledTest : public QObject
{
Q_OBJECT
private Q_SLOTS:
void testRecreatingNetEventFilter();
};
void CompositingEnabledTest::testRecreatingNetEventFilter()
{
// this test simulates the condition that the compositor gets enabled while the NetEventFilter gets recreated
QVERIFY(!KX11Extras::compositingActive());
// fake the compositor
QSignalSpy compositingChangedSpy(KX11Extras::self(), &KX11Extras::compositingChanged);
QVERIFY(compositingChangedSpy.isValid());
KSelectionOwner compositorSelection("_NET_WM_CM_S0");
QSignalSpy claimedSpy(&compositorSelection, &KSelectionOwner::claimedOwnership);
QVERIFY(claimedSpy.isValid());
compositorSelection.claim(true);
connect(&compositorSelection, &KSelectionOwner::claimedOwnership, [] {
// let's connect to a signal which will cause a re-creation of NetEventFilter
QSignalSpy workAreaChangedSpy(KX11Extras::self(), &KX11Extras::workAreaChanged);
QVERIFY(workAreaChangedSpy.isValid());
});
QVERIFY(claimedSpy.wait());
QTRY_VERIFY(KX11Extras::compositingActive());
QCOMPARE(compositingChangedSpy.count(), 1);
}
QTEST_MAIN(CompositingEnabledTest)
#include "compositingenabled_test.moc"
@@ -0,0 +1,21 @@
/*
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include <netwm.h>
#include <xcb/xcb.h>
int main(int, char **)
{
xcb_connection_t *c = xcb_connect(nullptr, nullptr);
Q_ASSERT(c);
Q_ASSERT(!xcb_connection_has_error(c));
NETRootInfo rootInfo(c, NET::CurrentDesktop);
rootInfo.currentDesktop(true);
rootInfo.currentDesktop(false);
xcb_disconnect(c);
return 0;
}
@@ -0,0 +1,24 @@
/* This file is part of the KDE libraries
SPDX-FileCopyrightText: 2009 David Faure <faure@kde.org>
SPDX-FileCopyrightText: 2009 Maciej Mrozowski <reavertm@poczta.fm>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
// From https://bugs.gentoo.org/show_bug.cgi?id=263823#c8
#include <X11/Xlib.h>
#include <fixx11h.h>
static Bool foo()
{
return True;
}
#include <X11/Xdefs.h>
int main(int, char **)
{
Bool b = foo();
return b;
}
@@ -0,0 +1,23 @@
/* This file is part of the KDE libraries
SPDX-FileCopyrightText: 2009 David Faure <faure@kde.org>
SPDX-FileCopyrightText: 2009 Maciej Mrozowski <reavertm@poczta.fm>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
// Test the case where Xdefs.h is first
#include <X11/Xdefs.h>
static Bool foo()
{
return 1; // Xdefs doesn't define True!
}
#include <X11/Xlib.h>
#include <fixx11h.h>
int main(int, char **)
{
Bool b = foo();
return b;
}
@@ -0,0 +1,4 @@
add_executable(kwindowsystem_platform_wayland_helper wayland_platform.cpp)
add_dependencies(kwindowsystem_platform_wayland_helper kwindowsystemplatformwaylandtest)
target_link_libraries(kwindowsystem_platform_wayland_helper KF6::WindowSystem)
ecm_mark_as_test(kwindowsystem_platform_wayland_helper)
@@ -0,0 +1,23 @@
/*
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include <KWindowSystem>
#include <QGuiApplication>
int main(int argc, char *argv[])
{
qputenv("QT_QPA_PLATFORM", "wayland");
QGuiApplication app(argc, argv);
if (KWindowSystem::platform() != KWindowSystem::Platform::Wayland) {
return 1;
}
if (!KWindowSystem::isPlatformWayland()) {
return 1;
}
if (KWindowSystem::isPlatformX11()) {
return 1;
}
return 0;
}
@@ -0,0 +1,173 @@
/* This file is part of the KDE libraries
SPDX-FileCopyrightText: 2017 David Faure <faure@kde.org>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include "kkeyserver.h"
#include <QTest>
#include <private/qtx11extras_p.h>
#include <X11/keysym.h>
#include <xcb/xcb_keysyms.h>
class KKeyServerTest : public QObject
{
Q_OBJECT
private Q_SLOTS:
void initTestCase()
{
m_keySymbols = xcb_key_symbols_alloc(QX11Info::connection());
// This makes me wonder why we have KKeyServer::modXShift :-)
QCOMPARE(XCB_MOD_MASK_SHIFT, xcb_mod_mask_t(KKeyServer::modXShift()));
}
void cleanupTestCase()
{
if (m_keySymbols) {
xcb_key_symbols_free(m_keySymbols);
}
}
void keyQtToSymX_data()
{
QTest::addColumn<int>("keyQt");
QTest::addColumn<uint>("modX");
QTest::addColumn<uint>("additionalState"); // set to XCB_MOD_MASK_SHIFT if shift would indeed be pressed for this shortcut
QTest::addColumn<int>("keySymX");
const uint numLock = KKeyServer::modXNumLock();
// clang-format off
// Before adding any testcase below, check what `kcmshell5 keys` records, to make sure it matches
QTest::newRow("a") << int(Qt::Key_A) << uint(0) << numLock << XK_A;
QTest::newRow("CTRL_F1") << QKeyCombination(Qt::ControlModifier|Qt::Key_F1).toCombined() << KKeyServer::modXCtrl() << numLock << XK_F1;
QTest::newRow("CTRL_1") << QKeyCombination(Qt::ControlModifier|Qt::Key_1).toCombined() << KKeyServer::modXCtrl() << numLock << XK_1;
QTest::newRow("CTRL_keypad_1") << QKeyCombination(Qt::ControlModifier|Qt::KeypadModifier|Qt::Key_1).toCombined() << KKeyServer::modXCtrl() << numLock << XK_KP_1;
QTest::newRow("CTRL_keypad_slash") << QKeyCombination(Qt::ControlModifier|Qt::KeypadModifier|Qt::Key_Slash).toCombined() << KKeyServer::modXCtrl() << numLock << XK_KP_Divide;
QTest::newRow("CTRL_SHIFT_keypad_end") << QKeyCombination(Qt::ControlModifier|Qt::ShiftModifier|Qt::KeypadModifier|Qt::Key_End).toCombined() << (KKeyServer::modXCtrl()|KKeyServer::modXShift()) << numLock << XK_KP_End;
QTest::newRow("CTRL_keypad_end_no_numlock") << QKeyCombination(Qt::ControlModifier|Qt::KeypadModifier|Qt::Key_End).toCombined() << (KKeyServer::modXCtrl()) << uint(0) << XK_KP_End;
QTest::newRow("CTRL_ampersand") << QKeyCombination(Qt::ControlModifier|Qt::Key_Ampersand).toCombined() << KKeyServer::modXCtrl() << uint(XCB_MOD_MASK_SHIFT|numLock) << XK_ampersand;
QTest::newRow("ALT_SHIFT_right") << QKeyCombination(Qt::AltModifier|Qt::ShiftModifier|Qt::Key_Right).toCombined() << (KKeyServer::modXAlt() | KKeyServer::modXShift()) << numLock << XK_Right;
QTest::newRow("CTRL_SHIFT_right") << QKeyCombination(Qt::ControlModifier|Qt::ShiftModifier|Qt::Key_Right).toCombined() << (KKeyServer::modXCtrl() | KKeyServer::modXShift()) << numLock << XK_Right;
QTest::newRow("META_SHIFT_print") << QKeyCombination(Qt::MetaModifier|Qt::ShiftModifier|Qt::Key_Print).toCombined() << (KKeyServer::modXMeta() | KKeyServer::modXShift()) << numLock << XK_Print;
QTest::newRow("ALT_Tab") << QKeyCombination(Qt::AltModifier|Qt::Key_Tab).toCombined() << (KKeyServer::modXAlt()) << numLock << XK_Tab;
QTest::newRow("ALT_Shift_Tab") << QKeyCombination(Qt::AltModifier|Qt::ShiftModifier|Qt::Key_Tab).toCombined() << (KKeyServer::modXAlt() | KKeyServer::modXShift()) << numLock << XK_Tab;
// clang-format on
}
void keyQtToSymX()
{
QFETCH(int, keyQt);
QFETCH(uint, modX);
QFETCH(int, keySymX);
int sym;
QVERIFY(KKeyServer::keyQtToSymX(keyQt, &sym));
QCOMPARE(QString::number(sym, 16), QString::number(keySymX, 16));
uint mod;
QVERIFY(KKeyServer::keyQtToModX(keyQt, &mod));
QCOMPARE(mod, modX);
}
void symXToKeyQt_data()
{
keyQtToSymX_data();
}
void symXToKeyQt()
{
QFETCH(int, keyQt);
QFETCH(uint, modX);
QFETCH(int, keySymX);
int keyCodeQt;
// qDebug() << "modX=" << modX << "keySymX=0x" << QString::number(keySymX, 16) << "keyQt=0x" << QString::number(keyQt, 16);
QVERIFY(KKeyServer::symXModXToKeyQt(keySymX, modX, &keyCodeQt));
QCOMPARE(keyCodeQt, keyQt);
}
void keyQtToSymXsCalculatorKey()
{
// Should return both XF86XK_Calculator and XF86XK_Calculater
QList<int> keyCodes = KKeyServer::keyQtToSymXs(Qt::Key_Calculator);
QVERIFY(keyCodes.size() == 2);
QVERIFY(keyCodes[0] != keyCodes[1]);
int keyCodeQt;
QVERIFY(KKeyServer::symXModXToKeyQt(keyCodes[0], 0, &keyCodeQt));
QCOMPARE(keyCodeQt, int(Qt::Key_Calculator));
QVERIFY(KKeyServer::symXModXToKeyQt(keyCodes[1], 0, &keyCodeQt));
QCOMPARE(keyCodeQt, int(Qt::Key_Calculator));
}
void keyQtToSymXs_data()
{
keyQtToSymX_data();
}
void keyQtToSymXs()
{
QFETCH(int, keyQt);
QFETCH(uint, modX);
QFETCH(int, keySymX);
QList<int> syms = KKeyServer::keyQtToSymXs(keyQt);
QVERIFY(syms.size() > 0);
QCOMPARE(QString::number(syms[0], 16), QString::number(keySymX, 16));
uint mod;
QVERIFY(KKeyServer::keyQtToModX(keyQt, &mod));
QCOMPARE(mod, modX);
}
void decodeXcbEvent_data()
{
keyQtToSymX_data();
}
void decodeXcbEvent()
{
QFETCH(int, keyQt);
QFETCH(uint, modX);
QFETCH(uint, additionalState);
QFETCH(int, keySymX);
xcb_keycode_t *keyCodes = xcb_key_symbols_get_keycode(m_keySymbols, keySymX);
QVERIFY(keyCodes);
const xcb_keycode_t keyCodeX = keyCodes[0];
QVERIFY(keyCodeX != XCB_NO_SYMBOL);
free(keyCodes);
xcb_key_press_event_t event{XCB_KEY_PRESS,
keyCodeX,
0,
0 /*time*/,
0 /*root*/,
0 /*event*/,
0 /*child*/,
0 /*root_x*/,
0 /*root_y*/,
0 /*event_x*/,
0 /*event_y*/,
uint16_t(modX | additionalState),
0 /*same_screen*/,
0 /*pad0*/};
int decodedKeyQt;
const bool ok = KKeyServer::xcbKeyPressEventToQt(&event, &decodedKeyQt);
QVERIFY(ok);
if (decodedKeyQt != keyQt) {
qDebug() << "given modX=" << modX << "keySymX=0x" << QString::number(keySymX, 16) << "I expected keyQt=0x" << QString::number(keyQt, 16)
<< QKeySequence(keyQt).toString() << "got" << QString::number(decodedKeyQt, 16) << QKeySequence(decodedKeyQt).toString();
}
QCOMPARE(decodedKeyQt, keyQt);
}
private:
xcb_key_symbols_t *m_keySymbols;
};
QTEST_MAIN(KKeyServerTest)
#include "kkeyserver_x11_unittest.moc"
@@ -0,0 +1,168 @@
/*
This file is part of the KDE Libraries
SPDX-FileCopyrightText: 2009 Lubos Lunak <l.lunak@kde.org>
SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "kmanagerselectiontest.h"
#include "cptr_p.h"
#include <QSignalSpy>
#include <kselectionowner.h>
#include <kselectionwatcher.h>
#include <private/qtx11extras_p.h>
#define SNAME "_KDE_KMANAGERSELECTIONTEST"
using namespace QTest;
void KManagerSelectionTest::xSync()
{
xcb_connection_t *c = QX11Info::connection();
const xcb_get_input_focus_cookie_t cookie = xcb_get_input_focus(c);
xcb_generic_error_t *error = nullptr;
UniqueCPointer<xcb_get_input_focus_reply_t> sync(xcb_get_input_focus_reply(c, cookie, &error));
if (error) {
free(error);
}
}
void KManagerSelectionTest::claim(KSelectionOwner *owner, bool force, bool forceKill)
{
QSignalSpy claimSpy(owner, &KSelectionOwner::claimedOwnership);
owner->claim(force, forceKill);
xSync();
QVERIFY(claimSpy.wait());
QCOMPARE(claimSpy.count(), 1);
}
void KManagerSelectionTest::testAcquireRelease()
{
// test that newOwner() is emitted when there is a new selection owner
KSelectionWatcher watcher(SNAME);
KSelectionOwner owner(SNAME);
QVERIFY(owner.ownerWindow() == XCB_WINDOW_NONE);
QVERIFY(watcher.owner() == XCB_WINDOW_NONE);
SigCheckWatcher sw(watcher);
SigCheckOwner so(owner);
claim(&owner);
QSignalSpy newOwnerSpy(&watcher, &KSelectionWatcher::newOwner);
QVERIFY(newOwnerSpy.wait());
QVERIFY(sw.newowner == true);
QVERIFY(sw.lostowner == false);
QVERIFY(so.lostownership == false);
}
void KManagerSelectionTest::testInitiallyOwned()
{
// test that lostOwner() is emitted when the selection is disowned
KSelectionOwner owner(SNAME);
SigCheckOwner so(owner);
claim(&owner);
KSelectionWatcher watcher(SNAME);
SigCheckWatcher sw(watcher);
owner.release();
QSignalSpy lostOwnerSpy(&watcher, &KSelectionWatcher::lostOwner);
QVERIFY(lostOwnerSpy.wait(2000));
QVERIFY(sw.newowner == false);
QVERIFY(sw.lostowner == true);
QVERIFY(so.lostownership == false);
}
void KManagerSelectionTest::testLostOwnership()
{
// test that lostOwnership() is emitted when something else forces taking the ownership
KSelectionOwner owner1(SNAME);
KSelectionOwner owner2(SNAME);
claim(&owner1);
QSignalSpy claimSpy(&owner2, &KSelectionOwner::failedToClaimOwnership);
owner2.claim(false);
claimSpy.wait();
QCOMPARE(claimSpy.count(), 1);
claim(&owner2, true, false);
QEXPECT_FAIL("", "selectionClear event is not sent to the same X client", Abort);
QSignalSpy lostOwnershipSpy(&owner1, &KSelectionOwner::lostOwnership);
QVERIFY(lostOwnershipSpy.wait());
QVERIFY(owner1.ownerWindow() == XCB_WINDOW_NONE);
QVERIFY(owner2.ownerWindow() != XCB_WINDOW_NONE);
}
void KManagerSelectionTest::testWatching()
{
// test that KSelectionWatcher reports changes properly
KSelectionWatcher watcher(SNAME);
KSelectionOwner owner1(SNAME);
KSelectionOwner owner2(SNAME);
SigCheckWatcher sw(watcher);
QSignalSpy newOwnerSpy(&watcher, &KSelectionWatcher::newOwner);
QVERIFY(newOwnerSpy.isValid());
claim(&owner1);
if (newOwnerSpy.isEmpty()) {
QVERIFY(newOwnerSpy.wait());
}
QCOMPARE(newOwnerSpy.count(), 1);
QVERIFY(sw.newowner == true);
QVERIFY(sw.lostowner == false);
sw.newowner = sw.lostowner = false;
newOwnerSpy.clear();
QVERIFY(newOwnerSpy.isEmpty());
claim(&owner2, true, false);
xSync();
if (newOwnerSpy.isEmpty()) {
QVERIFY(newOwnerSpy.wait());
}
QCOMPARE(newOwnerSpy.count(), 1);
QVERIFY(sw.newowner == true);
QVERIFY(sw.lostowner == false);
sw.newowner = sw.lostowner = false;
QSignalSpy lostOwnerSpy(&watcher, &KSelectionWatcher::lostOwner);
owner2.release();
xSync();
QVERIFY(lostOwnerSpy.wait());
QVERIFY(sw.newowner == false);
QVERIFY(sw.lostowner == true);
sw.newowner = sw.lostowner = false;
claim(&owner2);
QVERIFY(newOwnerSpy.wait(2000));
QVERIFY(sw.newowner == true);
QVERIFY(sw.lostowner == false);
}
SigCheckOwner::SigCheckOwner(const KSelectionOwner &owner)
: lostownership(false)
{
connect(&owner, &KSelectionOwner::lostOwnership, this, &SigCheckOwner::lostOwnership);
}
void SigCheckOwner::lostOwnership()
{
lostownership = true;
}
SigCheckWatcher::SigCheckWatcher(const KSelectionWatcher &watcher)
: newowner(false)
, lostowner(false)
{
connect(&watcher, &KSelectionWatcher::newOwner, this, &SigCheckWatcher::newOwner);
connect(&watcher, &KSelectionWatcher::lostOwner, this, &SigCheckWatcher::lostOwner);
}
void SigCheckWatcher::newOwner()
{
newowner = true;
}
void SigCheckWatcher::lostOwner()
{
lostowner = true;
}
QTEST_MAIN(KManagerSelectionTest)
#include "moc_kmanagerselectiontest.cpp"
@@ -0,0 +1,63 @@
/*
This file is part of the KDE Libraries
SPDX-FileCopyrightText: 2009 Lubos Lunak <l.lunak@kde.org>
SPDX-License-Identifier: LGPL-2.1-or-later
*/
#ifndef KMANAGERSELECTIONTESTTEST_H
#define KMANAGERSELECTIONTESTTEST_H
#include <QObject>
#include <QTest>
class KSelectionOwner;
class KManagerSelectionTest : public QObject
{
Q_OBJECT
public:
private Q_SLOTS:
void testAcquireRelease();
void testInitiallyOwned();
void testLostOwnership();
void testWatching();
private:
void claim(KSelectionOwner *owner, bool force = false, bool forceKill = true);
void xSync();
};
class KSelectionWatcher;
// For checking whether several signal have or have not been emitted,
// QSignalSpy::wait() is not powerful enough for that (it is still
// needed to do the event processing though). TODO: check if this is still true.
class SigCheckOwner : public QObject
{
Q_OBJECT
public:
SigCheckOwner(const KSelectionOwner &owner);
private Q_SLOTS:
void lostOwnership();
public:
bool lostownership;
};
class SigCheckWatcher : public QObject
{
Q_OBJECT
public:
SigCheckWatcher(const KSelectionWatcher &watcher);
private Q_SLOTS:
void newOwner();
void lostOwner();
public:
bool newowner;
bool lostowner;
};
#endif
@@ -0,0 +1,326 @@
/* This file is part of the KDE libraries
SPDX-FileCopyrightText: 2012, 2019 David Faure <faure@kde.org>
SPDX-FileCopyrightText: 2012 Kai Dombrowe <just89@gmx.de>
SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "netwm.h"
#include <QSignalSpy>
#include <QWidget>
#include <private/qtx11extras_p.h>
#include <kstartupinfo.h>
#include <qtest_widgets.h>
#include <xcb/xcb.h>
#include "cptr_p.h"
Q_DECLARE_METATYPE(KStartupInfoId)
Q_DECLARE_METATYPE(KStartupInfoData)
class KStartupInfo_UnitTest : public QObject
{
Q_OBJECT
public:
KStartupInfo_UnitTest()
: m_listener(KStartupInfo::CleanOnCantDetect, this)
, m_receivedCount(0)
{
qRegisterMetaType<KStartupInfoId>();
qRegisterMetaType<KStartupInfoData>();
connect(&m_listener, &KStartupInfo::gotNewStartup, this, &KStartupInfo_UnitTest::slotNewStartup);
}
protected Q_SLOTS:
void slotNewStartup(const KStartupInfoId &id, const KStartupInfoData &data)
{
++m_receivedCount;
m_receivedId = id;
m_receivedData = data;
Q_EMIT ready();
}
Q_SIGNALS:
void ready();
private Q_SLOTS:
void testStart();
void dontCrashCleanup_data();
void dontCrashCleanup();
void checkCleanOnCantDetectTest();
void checkStartupTest_data();
void checkStartupTest();
void createNewStartupIdTest();
void createNewStartupIdForTimestampTest();
private:
KStartupInfo m_listener;
int m_receivedCount;
KStartupInfoId m_receivedId;
KStartupInfoData m_receivedData;
};
void KStartupInfo_UnitTest::testStart()
{
KStartupInfoId id;
id.initId(KStartupInfo::createNewStartupId());
KStartupInfoData data;
const QString appId = "/dir with space/kstartupinfo_unittest.desktop";
data.setApplicationId(appId);
const QString iconPath = "/dir with space/kstartupinfo_unittest.png";
data.setIcon(iconPath);
const QString description = "A description";
data.setDescription(description);
const QString name = "A name";
data.setName(name);
const int pid = 12345;
data.addPid(pid);
const QString bin = "dir with space/kstartupinfo_unittest";
data.setBin(bin);
QSignalSpy removedSpy(&m_listener, &KStartupInfo::gotRemoveStartup);
QVERIFY(removedSpy.isValid());
KStartupInfo::sendStartup(id, data);
KStartupInfo::sendFinish(id, data);
QSignalSpy spy(this, &KStartupInfo_UnitTest::ready);
spy.wait(5000);
QCOMPARE(m_receivedCount, 1);
// qDebug() << m_receivedId.id(); // something like "$HOSTNAME;1342544979;490718;8602_TIME0"
QCOMPARE(m_receivedData.name(), name);
QCOMPARE(m_receivedData.description(), description);
QCOMPARE(m_receivedData.applicationId(), appId);
QCOMPARE(m_receivedData.icon(), iconPath);
QCOMPARE(m_receivedData.bin(), bin);
// qDebug() << m_receivedData.bin() << m_receivedData.name() << m_receivedData.description() << m_receivedData.icon() << m_receivedData.pids() <<
// m_receivedData.hostname() << m_receivedData.applicationId();
int waitTime = 0;
while (waitTime < 5000 && removedSpy.count() < 1) {
QTest::qWait(200);
waitTime += 200;
}
QCOMPARE(removedSpy.count(), 1);
}
static void doSync()
{
auto *c = QX11Info::connection();
const auto cookie = xcb_get_input_focus(c);
xcb_generic_error_t *error = nullptr;
UniqueCPointer<xcb_get_input_focus_reply_t> sync(xcb_get_input_focus_reply(c, cookie, &error));
if (error) {
free(error);
}
}
void KStartupInfo_UnitTest::dontCrashCleanup_data()
{
QTest::addColumn<bool>("silent");
QTest::addColumn<bool>("change");
QTest::addColumn<int>("countRemoveStartup");
QTest::newRow("normal") << false << false << 2;
QTest::newRow("silent") << true << false << 0;
QTest::newRow("uninited") << false << true << 0;
}
void KStartupInfo_UnitTest::dontCrashCleanup()
{
qputenv("KSTARTUPINFO_TIMEOUT", QByteArrayLiteral("1"));
KStartupInfoId id;
KStartupInfoId id2;
id.initId(QByteArrayLiteral("somefancyidwhichisrandom_kstartupinfo_unittest_0"));
id2.initId(QByteArrayLiteral("somefancyidwhichisrandom_kstartupinfo_unittest_1"));
KStartupInfoData data;
data.setApplicationId(QStringLiteral("/dir with space/kstartupinfo_unittest.desktop"));
data.setIcon(QStringLiteral("/dir with space/kstartupinfo_unittest.png"));
data.setDescription(QStringLiteral("A description"));
data.setName(QStringLiteral("A name"));
data.addPid(12345);
data.setBin(QStringLiteral("dir with space/kstartupinfo_unittest"));
QFETCH(bool, silent);
if (silent) {
data.setSilent(KStartupInfoData::Yes);
}
QSignalSpy spy(&m_listener, &KStartupInfo::gotRemoveStartup);
QFETCH(bool, change);
if (change) {
KStartupInfo::sendChange(id, data);
KStartupInfo::sendChange(id2, data);
} else {
KStartupInfo::sendStartup(id, data);
KStartupInfo::sendStartup(id2, data);
}
// let's do a roundtrip to the X server
doSync();
QFETCH(int, countRemoveStartup);
int waitTime = 1900;
QTest::qWait(1900);
while (waitTime <= 5000) {
QTest::qWait(200);
waitTime += 200;
if (spy.count() == countRemoveStartup) {
break;
}
}
QCOMPARE(spy.count(), countRemoveStartup);
}
void KStartupInfo_UnitTest::checkCleanOnCantDetectTest()
{
KStartupInfoId id;
KStartupInfoId id2;
id.initId(QByteArrayLiteral("somefancyidwhichisrandom_kstartupinfo_unittest_0"));
id2.initId(QByteArrayLiteral("somefancyidwhichisrandom_kstartupinfo_unittest_1"));
KStartupInfoData data;
data.setApplicationId(QStringLiteral("/dir with space/kstartupinfo_unittest.desktop"));
data.setIcon(QStringLiteral("/dir with space/kstartupinfo_unittest.png"));
data.setDescription(QStringLiteral("A description"));
data.setName(QStringLiteral("A name"));
data.setBin(QStringLiteral("dir with space/kstartupinfo_unittest"));
data.setWMClass(QByteArrayLiteral("0"));
xcb_connection_t *c = QX11Info::connection();
xcb_window_t window = xcb_generate_id(c);
uint32_t values[] = {XCB_EVENT_MASK_PROPERTY_CHANGE};
xcb_create_window(c,
XCB_COPY_FROM_PARENT,
window,
QX11Info::appRootWindow(),
0,
0,
100,
100,
0,
XCB_COPY_FROM_PARENT,
XCB_COPY_FROM_PARENT,
XCB_CW_EVENT_MASK,
values);
KStartupInfo::sendStartup(id, data);
KStartupInfo::sendStartup(id2, data);
int previousCount = m_receivedCount;
doSync();
QTest::qWait(10);
xcb_map_window(c, window);
xcb_flush(c);
QTest::qWait(10);
xcb_unmap_window(c, window);
xcb_flush(c);
QTest::qWait(100);
xcb_map_window(c, window);
xcb_flush(c);
QCOMPARE(m_receivedCount, previousCount + 2);
QCOMPARE(m_receivedId, id2);
}
void KStartupInfo_UnitTest::checkStartupTest_data()
{
QTest::addColumn<QByteArray>("wmClass");
QTest::addColumn<int>("pid");
QTest::newRow("wmClass") << QByteArrayLiteral("kstartupinfotest") << 0;
QTest::newRow("pid") << QByteArray() << 12345;
}
void KStartupInfo_UnitTest::checkStartupTest()
{
KStartupInfoId id;
KStartupInfoId id2;
id.initId(QByteArrayLiteral("somefancyidwhichisrandom_kstartupinfo_unittest_0"));
id2.initId(QByteArrayLiteral("somefancyidwhichisrandom_kstartupinfo_unittest_1"));
KStartupInfoData data;
data.setApplicationId(QStringLiteral("/dir with space/kstartupinfo_unittest.desktop"));
data.setIcon(QStringLiteral("/dir with space/kstartupinfo_unittest.png"));
data.setDescription(QStringLiteral("A description"));
data.setName(QStringLiteral("A name"));
data.setBin(QStringLiteral("dir with space/kstartupinfo_unittest"));
QFETCH(int, pid);
data.addPid(pid);
data.setHostname(QByteArrayLiteral("localhost"));
// important for this test: WMClass
QFETCH(QByteArray, wmClass);
data.setWMClass(wmClass);
xcb_connection_t *c = QX11Info::connection();
xcb_window_t window = xcb_generate_id(c);
uint32_t values[] = {XCB_EVENT_MASK_PROPERTY_CHANGE};
xcb_create_window(c,
XCB_COPY_FROM_PARENT,
window,
QX11Info::appRootWindow(),
0,
0,
100,
100,
0,
XCB_COPY_FROM_PARENT,
XCB_COPY_FROM_PARENT,
XCB_CW_EVENT_MASK,
values);
xcb_change_property(c,
XCB_PROP_MODE_REPLACE,
window,
XCB_ATOM_WM_CLASS,
XCB_ATOM_STRING,
8,
wmClass.length() * 2 + 1,
"kstartupinfotest\0kstartupinfotest");
xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, XCB_ATOM_WM_CLIENT_MACHINE, XCB_ATOM_STRING, 8, 9, "localhost");
NETWinInfo winInfo(QX11Info::connection(), window, QX11Info::appRootWindow(), NET::Properties(), NET::Properties2());
winInfo.setPid(pid);
KStartupInfo info(KStartupInfo::DisableKWinModule | KStartupInfo::AnnounceSilenceChanges, this);
KStartupInfo::sendStartup(id, data);
KStartupInfo::sendStartup(id2, data);
doSync();
QTest::qWait(100);
QCOMPARE(info.checkStartup(window), KStartupInfo::Match);
QCOMPARE(info.checkStartup(window), KStartupInfo::Match);
}
void KStartupInfo_UnitTest::createNewStartupIdTest()
{
const QByteArray &id = KStartupInfo::createNewStartupId();
QVERIFY(!id.isEmpty());
const int index = id.indexOf(QByteArrayLiteral("TIME"));
QVERIFY(index != -1);
const QByteArray time = id.mid(index + 4);
QVERIFY(time.toULongLong() != 0u);
}
void KStartupInfo_UnitTest::createNewStartupIdForTimestampTest()
{
const QByteArray &id = KStartupInfo::createNewStartupIdForTimestamp(5);
QVERIFY(!id.isEmpty());
const int index = id.indexOf(QByteArrayLiteral("TIME"));
QVERIFY(index != -1);
QCOMPARE(id.mid(index + 4).toULongLong(), 5u);
}
QTEST_MAIN(KStartupInfo_UnitTest)
#include "kstartupinfo_unittest.moc"
@@ -0,0 +1,285 @@
/*
SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include <QSignalSpy>
#include <private/qtx11extras_p.h>
#include <kselectionowner.h>
#include <kwindoweffects.h>
#include <kwindowsystem.h>
#include <kx11extras.h>
#include <netwm.h>
#include <qtest_widgets.h>
#include <xcb/xcb.h>
#include "cptr_p.h"
Q_DECLARE_METATYPE(KWindowEffects::SlideFromLocation)
Q_DECLARE_METATYPE(KWindowEffects::Effect)
class KWindowEffectsTest : public QObject
{
Q_OBJECT
private Q_SLOTS:
void initTestCase();
void testSlideWindow_data();
void testSlideWindow();
void testSlideWindowRemove();
void testBlur_data();
void testBlur();
void testBlurDisable();
void testEffectAvailable_data();
void testEffectAvailable();
private:
int32_t locationToValue(KWindowEffects::SlideFromLocation location) const;
void performSlideWindowTest(xcb_window_t window, int offset, KWindowEffects::SlideFromLocation location) const;
void performSlideWindowRemoveTest(xcb_window_t window);
void performWindowsOnPropertyTest(xcb_atom_t atom, const QList<WId> &windows);
void performAtomIsRemoveTest(xcb_window_t window, xcb_atom_t atom);
void getHelperAtom(const QByteArray &name, xcb_atom_t *atom) const;
xcb_atom_t m_slide;
xcb_atom_t m_thumbnails;
xcb_atom_t m_blur;
std::unique_ptr<QWindow> m_window;
std::unique_ptr<QWidget> m_widget;
};
void KWindowEffectsTest::initTestCase()
{
m_window.reset(new QWindow());
QVERIFY(m_window->winId() != XCB_WINDOW_NONE);
m_widget.reset(new QWidget());
m_widget->show();
QVERIFY(m_widget->effectiveWinId() != XCB_WINDOW_NONE);
getHelperAtom(QByteArrayLiteral("_KDE_SLIDE"), &m_slide);
getHelperAtom(QByteArrayLiteral("_KDE_WINDOW_PREVIEW"), &m_thumbnails);
getHelperAtom(QByteArrayLiteral("_KDE_NET_WM_BLUR_BEHIND_REGION"), &m_blur);
}
void KWindowEffectsTest::getHelperAtom(const QByteArray &name, xcb_atom_t *atom) const
{
xcb_connection_t *c = QX11Info::connection();
xcb_intern_atom_cookie_t atomCookie = xcb_intern_atom_unchecked(c, false, name.length(), name.constData());
UniqueCPointer<xcb_intern_atom_reply_t> reply(xcb_intern_atom_reply(c, atomCookie, nullptr));
QVERIFY(reply);
*atom = reply->atom;
}
void KWindowEffectsTest::testSlideWindow_data()
{
QTest::addColumn<int>("offset");
QTest::addColumn<KWindowEffects::SlideFromLocation>("location");
QTest::newRow("Left") << 10 << KWindowEffects::LeftEdge;
QTest::newRow("Right") << 20 << KWindowEffects::RightEdge;
QTest::newRow("Top") << 0 << KWindowEffects::TopEdge;
QTest::newRow("Bottom") << -1 << KWindowEffects::BottomEdge;
}
void KWindowEffectsTest::testSlideWindow()
{
QFETCH(int, offset);
QFETCH(KWindowEffects::SlideFromLocation, location);
KWindowEffects::slideWindow(m_window.get(), location, offset);
performSlideWindowTest(m_window->winId(), offset, location);
}
void KWindowEffectsTest::testSlideWindowRemove()
{
xcb_window_t window = m_window->winId();
// first install the atom
KWindowEffects::slideWindow(m_window.get(), KWindowEffects::TopEdge, 0);
performSlideWindowTest(window, 0, KWindowEffects::TopEdge);
// now delete it
KWindowEffects::slideWindow(m_window.get(), KWindowEffects::NoEdge, 0);
performSlideWindowRemoveTest(window);
}
void KWindowEffectsTest::performSlideWindowTest(xcb_window_t window, int offset, KWindowEffects::SlideFromLocation location) const
{
xcb_connection_t *c = QX11Info::connection();
xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(c, false, window, m_slide, m_slide, 0, 100);
UniqueCPointer<xcb_get_property_reply_t> reply(xcb_get_property_reply(c, cookie, nullptr));
QVERIFY(reply);
QCOMPARE(reply->format, uint8_t(32));
QCOMPARE(reply->value_len, uint32_t(2));
QCOMPARE(reply->type, m_slide);
int32_t *data = static_cast<int32_t *>(xcb_get_property_value(reply.get()));
QCOMPARE(data[0], offset);
QCOMPARE(data[1], locationToValue(location));
}
void KWindowEffectsTest::performSlideWindowRemoveTest(xcb_window_t window)
{
performAtomIsRemoveTest(window, m_slide);
}
void KWindowEffectsTest::performAtomIsRemoveTest(xcb_window_t window, xcb_atom_t atom)
{
xcb_connection_t *c = QX11Info::connection();
xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(c, false, window, atom, atom, 0, 100);
UniqueCPointer<xcb_get_property_reply_t> reply(xcb_get_property_reply(c, cookie, nullptr));
QVERIFY(reply);
QCOMPARE(reply->type, xcb_atom_t(XCB_ATOM_NONE));
}
int32_t KWindowEffectsTest::locationToValue(KWindowEffects::SlideFromLocation location) const
{
switch (location) {
case KWindowEffects::LeftEdge:
return 0;
case KWindowEffects::TopEdge:
return 1;
case KWindowEffects::RightEdge:
return 2;
case KWindowEffects::BottomEdge:
return 3;
default:
return -1;
}
}
void KWindowEffectsTest::performWindowsOnPropertyTest(xcb_atom_t atom, const QList<WId> &windows)
{
xcb_connection_t *c = QX11Info::connection();
xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(c, false, m_window->winId(), atom, atom, 0, 100);
UniqueCPointer<xcb_get_property_reply_t> reply(xcb_get_property_reply(c, cookie, nullptr));
QVERIFY(reply);
QCOMPARE(reply->type, atom);
QCOMPARE(reply->format, uint8_t(32));
QCOMPARE(reply->value_len, uint32_t(windows.size()));
int32_t *data = static_cast<int32_t *>(xcb_get_property_value(reply.get()));
for (int i = 0; i < windows.size(); ++i) {
QCOMPARE(data[i], int32_t(windows.at(i)));
}
}
void KWindowEffectsTest::testBlur_data()
{
QTest::addColumn<QRegion>("blur");
QRegion region(0, 0, 10, 10);
QTest::newRow("one rect") << region;
region = region.united(QRect(20, 20, 5, 5));
QTest::newRow("two rects") << region;
region = region.united(QRect(100, 100, 20, 20));
QTest::newRow("three rects") << region;
QTest::newRow("empty") << QRegion();
}
void KWindowEffectsTest::testBlur()
{
QFETCH(QRegion, blur);
KWindowEffects::enableBlurBehind(m_window.get(), true, blur);
xcb_connection_t *c = QX11Info::connection();
xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(c, false, m_window->winId(), m_blur, XCB_ATOM_CARDINAL, 0, 100);
UniqueCPointer<xcb_get_property_reply_t> reply(xcb_get_property_reply(c, cookie, nullptr));
QVERIFY(reply);
QCOMPARE(reply->type, xcb_atom_t(XCB_ATOM_CARDINAL));
QCOMPARE(reply->format, uint8_t(32));
QCOMPARE(reply->value_len, uint32_t(blur.rectCount() * 4));
uint32_t *data = static_cast<uint32_t *>(xcb_get_property_value(reply.get()));
int dataOffset = 0;
for (const QRect &rect : blur) {
QCOMPARE(data[dataOffset++], uint32_t(rect.x()));
QCOMPARE(data[dataOffset++], uint32_t(rect.y()));
QCOMPARE(data[dataOffset++], uint32_t(rect.width()));
QCOMPARE(data[dataOffset++], uint32_t(rect.height()));
}
}
void KWindowEffectsTest::testBlurDisable()
{
KWindowEffects::enableBlurBehind(m_window.get(), false);
performAtomIsRemoveTest(m_window->winId(), m_blur);
KWindowEffects::enableBlurBehind(m_window.get(), true);
// verify that it got added
xcb_connection_t *c = QX11Info::connection();
xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(c, false, m_window->winId(), m_blur, XCB_ATOM_CARDINAL, 0, 100);
UniqueCPointer<xcb_get_property_reply_t> reply(xcb_get_property_reply(c, cookie, nullptr));
QVERIFY(reply);
QCOMPARE(reply->type, xcb_atom_t(XCB_ATOM_CARDINAL));
// and disable
KWindowEffects::enableBlurBehind(m_window.get(), false);
performAtomIsRemoveTest(m_window->winId(), m_blur);
}
void KWindowEffectsTest::testEffectAvailable_data()
{
QTest::addColumn<KWindowEffects::Effect>("effect");
QTest::addColumn<QByteArray>("propertyName");
QTest::newRow("slide") << KWindowEffects::Slide << QByteArrayLiteral("_KDE_SLIDE");
QTest::newRow("BlurBehind") << KWindowEffects::BlurBehind << QByteArrayLiteral("_KDE_NET_WM_BLUR_BEHIND_REGION");
QTest::newRow("BackgroundContrast") << KWindowEffects::BackgroundContrast << QByteArrayLiteral("_KDE_NET_WM_BACKGROUND_CONTRAST_REGION");
}
void KWindowEffectsTest::testEffectAvailable()
{
NETRootInfo rootInfo(QX11Info::connection(), NET::Supported | NET::SupportingWMCheck);
if (qstrcmp(rootInfo.wmName(), "KWin") == 0) {
QSKIP("KWin running, we don't want to interact with the running system");
}
// this test verifies whether an effect is available
QFETCH(KWindowEffects::Effect, effect);
// without a compositing manager it's not available
// try-verify as there still might be the selection claimed from previous data run
QTRY_VERIFY(!KX11Extras::compositingActive());
QVERIFY(!KWindowEffects::isEffectAvailable(effect));
// fake the compositor
QSignalSpy compositingChangedSpy(KX11Extras::self(), &KX11Extras::compositingChanged);
QVERIFY(compositingChangedSpy.isValid());
KSelectionOwner compositorSelection("_NET_WM_CM_S0");
QSignalSpy claimedSpy(&compositorSelection, &KSelectionOwner::claimedOwnership);
QVERIFY(claimedSpy.isValid());
compositorSelection.claim(true);
QVERIFY(claimedSpy.wait());
QCOMPARE(compositingChangedSpy.count(), 1);
QCOMPARE(compositingChangedSpy.first().first().toBool(), true);
QVERIFY(KX11Extras::compositingActive());
// but not yet available
QVERIFY(!KWindowEffects::isEffectAvailable(effect));
// set the atom
QFETCH(QByteArray, propertyName);
xcb_connection_t *c = QX11Info::connection();
xcb_intern_atom_cookie_t atomCookie = xcb_intern_atom_unchecked(c, false, propertyName.length(), propertyName.constData());
UniqueCPointer<xcb_intern_atom_reply_t> atom(xcb_intern_atom_reply(c, atomCookie, nullptr));
QVERIFY(atom);
unsigned char dummy = 0;
xcb_change_property(c, XCB_PROP_MODE_REPLACE, QX11Info::appRootWindow(), atom->atom, atom->atom, 8, 1, &dummy);
xcb_flush(c);
// now the effect should be available
QVERIFY(KWindowEffects::isEffectAvailable(effect));
// delete the property again
xcb_delete_property(c, QX11Info::appRootWindow(), atom->atom);
xcb_flush(c);
// which means it's no longer available
QVERIFY(!KWindowEffects::isEffectAvailable(effect));
// remove compositing selection
compositorSelection.release();
QVERIFY(compositingChangedSpy.wait());
QCOMPARE(compositingChangedSpy.count(), 2);
QCOMPARE(compositingChangedSpy.last().first().toBool(), false);
QVERIFY(!KX11Extras::compositingActive());
}
QTEST_MAIN(KWindowEffectsTest)
#include "kwindoweffectstest.moc"
@@ -0,0 +1,700 @@
/*
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include "kwindowinfo.h"
#include "kwindowsystem.h"
#include "kx11extras.h"
#include "nettesthelper.h"
#include "netwm.h"
#include <QScreen>
#include <QSignalSpy>
#include <QSysInfo>
#include <private/qtx11extras_p.h>
#include <qtest_widgets.h>
#include <xcb/xcb_icccm.h>
#include <unistd.h>
Q_DECLARE_METATYPE(WId)
Q_DECLARE_METATYPE(NET::State)
Q_DECLARE_METATYPE(NET::States)
Q_DECLARE_METATYPE(NET::WindowType)
Q_DECLARE_METATYPE(NET::WindowTypeMask)
Q_DECLARE_METATYPE(NET::WindowTypes)
Q_DECLARE_METATYPE(NET::Properties)
Q_DECLARE_METATYPE(NET::Properties2)
class KWindowInfoX11Test : public QObject
{
Q_OBJECT
private Q_SLOTS:
void initTestCase();
void init();
void cleanup();
void testState_data();
void testState();
void testMinimized();
void testMappingState();
void testWindowType_data();
void testWindowType();
void testDesktop();
void testActivities();
void testWindowClass();
void testWindowRole();
void testClientMachine();
void testName();
void testTransientFor();
void testGroupLeader();
void testExtendedStrut();
void testGeometry();
void testDesktopFileName();
void testPid();
// actionSupported is not tested as it's too window manager specific
// we could write a test against KWin's behavior, but that would fail on
// build.kde.org as we use OpenBox there.
private:
void showWidget(QWidget *widget);
bool waitForWindow(QSignalSpy &spy, WId winId, NET::Properties property, NET::Properties2 properties2 = NET::Properties2()) const;
bool verifyMinimized(WId window) const;
std::unique_ptr<QWidget> window;
};
void KWindowInfoX11Test::initTestCase()
{
QCoreApplication::setAttribute(Qt::AA_ForceRasterWidgets);
qRegisterMetaType<NET::Properties>();
qRegisterMetaType<NET::Properties2>();
}
bool KWindowInfoX11Test::waitForWindow(QSignalSpy &spy, WId winId, NET::Properties property, NET::Properties2 property2) const
{
// we need to wait, window manager has to react and update the property.
bool foundOurWindow = false;
for (int i = 0; i < 10; ++i) {
spy.wait(50);
if (spy.isEmpty()) {
continue;
}
for (auto it = spy.constBegin(); it != spy.constEnd(); ++it) {
if (it->first().value<WId>() != winId) {
continue;
}
if (property != NET::Properties()) {
if (it->at(1).value<NET::Properties>() != property) {
continue;
}
}
if (property2 != NET::Properties2()) {
if (it->at(2).value<NET::Properties2>() != property2) {
continue;
}
}
foundOurWindow = true;
break;
}
if (foundOurWindow) {
break;
}
spy.clear();
}
return foundOurWindow;
}
bool KWindowInfoX11Test::verifyMinimized(WId window) const
{
KWindowInfo info(window, NET::WMState | NET::XAWMState);
return info.isMinimized();
}
void KWindowInfoX11Test::init()
{
// create the window and ensure it has been managed
window.reset(new QWidget());
showWidget(window.get());
}
void KWindowInfoX11Test::showWidget(QWidget *window)
{
qRegisterMetaType<WId>("WId");
QSignalSpy spy(KX11Extras::self(), &KX11Extras::windowAdded);
window->show();
bool foundOurWindow = false;
for (int i = 0; i < 50; ++i) {
spy.wait(50);
if (spy.isEmpty()) {
continue;
}
for (auto it = spy.constBegin(); it != spy.constEnd(); ++it) {
if (it->isEmpty()) {
continue;
}
if (it->first().value<WId>() == window->winId()) {
foundOurWindow = true;
break;
}
}
if (foundOurWindow) {
break;
}
spy.clear();
}
}
void KWindowInfoX11Test::cleanup()
{
// we hide the window and wait till it is gone so that we have a clean state in next test
if (window && window->isVisible()) {
WId id = window->winId();
QSignalSpy spy(KX11Extras::self(), &KX11Extras::windowRemoved);
window->hide();
bool foundOurWindow = false;
for (int i = 0; i < 50; ++i) {
spy.wait(50);
if (spy.isEmpty()) {
continue;
}
for (auto it = spy.constBegin(); it != spy.constEnd(); ++it) {
if (it->first().value<WId>() == id) {
foundOurWindow = true;
break;
}
}
if (foundOurWindow) {
break;
}
spy.clear();
}
}
window.reset();
}
void KWindowInfoX11Test::testState_data()
{
QTest::addColumn<NET::States>("state");
QTest::newRow("max") << NET::States(NET::Max);
QTest::newRow("maxHoriz") << NET::States(NET::MaxHoriz);
QTest::newRow("shaded") << NET::States(NET::Shaded);
QTest::newRow("skipTaskbar") << NET::States(NET::SkipTaskbar);
QTest::newRow("skipPager") << NET::States(NET::SkipPager);
QTest::newRow("keep above") << NET::States(NET::KeepAbove);
QTest::newRow("keep below") << NET::States(NET::KeepBelow);
QTest::newRow("fullscreen") << NET::States(NET::FullScreen);
NETRootInfo info(QX11Info::connection(), NET::Supported);
if (info.isSupported(NET::SkipSwitcher)) {
QTest::newRow("skipSwitcher") << NET::States(NET::SkipSwitcher);
}
// NOTE: modal, sticky and hidden cannot be tested with this variant
// demands attention is not tested as that's already part of the first run adjustments
}
void KWindowInfoX11Test::testState()
{
QFETCH(NET::States, state);
QX11Info::getTimestamp();
KWindowInfo info(window->winId(), NET::WMState);
QVERIFY(info.valid());
// all states except demands attention
for (int i = 0; i < 12; ++i) {
QVERIFY(!info.hasState(NET::States(1 << i)));
}
QSignalSpy spy(KX11Extras::self(), &KX11Extras::windowChanged);
QVERIFY(spy.isValid());
// now we have a clean window and can do fun stuff
KX11Extras::setState(window->winId(), state);
QVERIFY(waitForWindow(spy, window->winId(), NET::WMState));
KWindowInfo info3(window->winId(), NET::WMState);
QVERIFY(info3.valid());
QCOMPARE(int(info3.state()), int(state));
QVERIFY(info3.hasState(state));
}
// This struct is defined here to avoid a dependency on xcb-icccm
struct kde_wm_hints {
uint32_t flags;
uint32_t input;
int32_t initial_state;
xcb_pixmap_t icon_pixmap;
xcb_window_t icon_window;
int32_t icon_x;
int32_t icon_y;
xcb_pixmap_t icon_mask;
xcb_window_t window_group;
};
void KWindowInfoX11Test::testMinimized()
{
// should not be minimized, now
QVERIFY(!verifyMinimized(window->winId()));
window->showMinimized();
// TODO: improve by using signalspy?
QTest::qWait(100);
// should be minimized, now
QVERIFY(verifyMinimized(window->winId()));
// back to normal
window->showNormal();
// TODO: improve by using signalspy?
QTest::qWait(100);
// should no longer be minimized
QVERIFY(!verifyMinimized(window->winId()));
}
void KWindowInfoX11Test::testMappingState()
{
KWindowInfo info(window->winId(), NET::XAWMState);
QCOMPARE(info.mappingState(), NET::Visible);
window->showMinimized();
// TODO: improve by using signalspy?
QTest::qWait(100);
KWindowInfo info2(window->winId(), NET::XAWMState);
QCOMPARE(info2.mappingState(), NET::Iconic);
window->hide();
// TODO: improve by using signalspy?
QTest::qWait(100);
KWindowInfo info3(window->winId(), NET::XAWMState);
QCOMPARE(info3.mappingState(), NET::Withdrawn);
}
void KWindowInfoX11Test::testWindowType_data()
{
QTest::addColumn<NET::WindowTypeMask>("mask");
QTest::addColumn<NET::WindowType>("type");
QTest::addColumn<NET::WindowType>("expectedType");
// clang-format off
QTest::newRow("desktop") << NET::DesktopMask << NET::Desktop << NET::Desktop;
QTest::newRow("dock") << NET::DockMask << NET::Dock << NET::Dock;
QTest::newRow("toolbar") << NET::ToolbarMask << NET::Toolbar << NET::Toolbar;
QTest::newRow("menu") << NET::MenuMask << NET::Menu << NET::Menu;
QTest::newRow("dialog") << NET::DialogMask << NET::Dialog << NET::Dialog;
QTest::newRow("override") << NET::OverrideMask << NET::Override << NET::Override;
QTest::newRow("override as normal") << NET::NormalMask << NET::Override << NET::Normal;
QTest::newRow("topmenu") << NET::TopMenuMask << NET::TopMenu << NET::TopMenu;
QTest::newRow("topmenu as dock") << NET::DockMask << NET::TopMenu << NET::Dock;
QTest::newRow("utility") << NET::UtilityMask << NET::Utility << NET::Utility;
QTest::newRow("utility as dialog") << NET::DialogMask << NET::Utility << NET::Dialog;
QTest::newRow("splash") << NET::SplashMask << NET::Splash << NET::Splash;
QTest::newRow("splash as dock") << NET::DockMask << NET::Splash << NET::Dock;
QTest::newRow("dropdownmenu") << NET::DropdownMenuMask << NET::DropdownMenu << NET::DropdownMenu;
QTest::newRow("popupmenu") << NET::PopupMenuMask << NET::PopupMenu << NET::PopupMenu;
QTest::newRow("popupmenu as menu") << NET::MenuMask << NET::Menu << NET::Menu;
QTest::newRow("tooltip") << NET::TooltipMask << NET::Tooltip << NET::Tooltip;
QTest::newRow("notification") << NET::NotificationMask << NET::Notification << NET::Notification;
QTest::newRow("ComboBox") << NET::ComboBoxMask << NET::ComboBox << NET::ComboBox;
QTest::newRow("DNDIcon") << NET::DNDIconMask << NET::DNDIcon << NET::DNDIcon;
QTest::newRow("OnScreenDisplay") << NET::OnScreenDisplayMask << NET::OnScreenDisplay << NET::OnScreenDisplay;
QTest::newRow("CriticalNotification") << NET::CriticalNotificationMask << NET::CriticalNotification << NET::CriticalNotification;
QTest::newRow("AppletPopup") << NET::AppletPopupMask << NET::AppletPopup << NET::AppletPopup;
// incorrect masks
QTest::newRow("desktop-unknown") << NET::NormalMask << NET::Desktop << NET::Unknown;
QTest::newRow("dock-unknown") << NET::NormalMask << NET::Dock << NET::Unknown;
QTest::newRow("toolbar-unknown") << NET::NormalMask << NET::Toolbar << NET::Unknown;
QTest::newRow("menu-unknown") << NET::NormalMask << NET::Menu << NET::Unknown;
QTest::newRow("dialog-unknown") << NET::NormalMask << NET::Dialog << NET::Unknown;
QTest::newRow("override-unknown") << NET::DialogMask << NET::Override << NET::Unknown;
QTest::newRow("topmenu-unknown") << NET::NormalMask << NET::TopMenu << NET::Unknown;
QTest::newRow("utility-unknown") << NET::NormalMask << NET::Utility << NET::Unknown;
QTest::newRow("splash-unknown") << NET::NormalMask << NET::Splash << NET::Unknown;
QTest::newRow("dropdownmenu-unknown") << NET::NormalMask << NET::DropdownMenu << NET::Unknown;
QTest::newRow("popupmenu-unknown") << NET::NormalMask << NET::PopupMenu << NET::Unknown;
QTest::newRow("tooltip-unknown") << NET::NormalMask << NET::Tooltip << NET::Unknown;
QTest::newRow("notification-unknown") << NET::NormalMask << NET::Notification << NET::Unknown;
QTest::newRow("ComboBox-unknown") << NET::NormalMask << NET::ComboBox << NET::Unknown;
QTest::newRow("DNDIcon-unknown") << NET::NormalMask << NET::DNDIcon << NET::Unknown;
QTest::newRow("OnScreenDisplay-unknown") << NET::NormalMask << NET::OnScreenDisplay << NET::Unknown;
QTest::newRow("CriticalNotification-unknown") << NET::NormalMask << NET::CriticalNotification << NET::Unknown;
QTest::newRow("AppletPopup-unknown") << NET::NormalMask << NET::AppletPopup << NET::Unknown;
// clang-format on
}
void KWindowInfoX11Test::testWindowType()
{
KWindowInfo info(window->winId(), NET::WMWindowType);
QCOMPARE(info.windowType(NET::NormalMask), NET::Normal);
QFETCH(NET::WindowTypeMask, mask);
QFETCH(NET::WindowType, type);
QFETCH(NET::WindowType, expectedType);
KX11Extras::setType(window->winId(), type);
// setWindowType just changes an xproperty, so a roundtrip waiting for another property ensures we are updated
QX11Info::getTimestamp();
KWindowInfo info2(window->winId(), NET::WMWindowType);
QCOMPARE(info2.windowType(mask), expectedType);
}
void KWindowInfoX11Test::testDesktop()
{
if (KX11Extras::numberOfDesktops() < 2) {
QSKIP("We need at least two virtual desktops to perform proper virtual desktop testing");
}
KWindowInfo info(window->winId(), NET::WMDesktop);
QVERIFY(info.isOnCurrentDesktop());
QVERIFY(!info.onAllDesktops());
QCOMPARE(info.desktop(), KX11Extras::currentDesktop());
for (int i = 1; i < KX11Extras::numberOfDesktops(); i++) {
if (i == KX11Extras::currentDesktop()) {
QVERIFY(info.isOnDesktop(i));
} else {
QVERIFY(!info.isOnDesktop(i));
}
}
// set on all desktop
QSignalSpy spy(KX11Extras::self(), &KX11Extras::windowChanged);
QVERIFY(spy.isValid());
KX11Extras::setOnAllDesktops(window->winId(), true);
QVERIFY(waitForWindow(spy, window->winId(), NET::WMDesktop));
KWindowInfo info2(window->winId(), NET::WMDesktop);
QVERIFY(info2.isOnCurrentDesktop());
QVERIFY(info2.onAllDesktops());
QCOMPARE(info2.desktop(), int(NET::OnAllDesktops));
for (int i = 1; i < KX11Extras::numberOfDesktops(); i++) {
QVERIFY(info2.isOnDesktop(i));
}
const int desktop = (KX11Extras::currentDesktop() % KX11Extras::numberOfDesktops()) + 1;
spy.clear();
KX11Extras::setOnDesktop(window->winId(), desktop);
QX11Info::getTimestamp();
QVERIFY(waitForWindow(spy, window->winId(), NET::WMDesktop));
KWindowInfo info3(window->winId(), NET::WMDesktop);
QVERIFY(!info3.isOnCurrentDesktop());
QVERIFY(!info3.onAllDesktops());
QCOMPARE(info3.desktop(), desktop);
for (int i = 1; i < KX11Extras::numberOfDesktops(); i++) {
if (i == desktop) {
QVERIFY(info3.isOnDesktop(i));
} else {
QVERIFY(!info3.isOnDesktop(i));
}
}
}
void KWindowInfoX11Test::testActivities()
{
NETRootInfo rootInfo(QX11Info::connection(), NET::Supported | NET::SupportingWMCheck);
QSignalSpy spyReal(KX11Extras::self(), &KX11Extras::windowChanged);
QVERIFY(spyReal.isValid());
KWindowInfo info(window->winId(), NET::Properties(), NET::WM2Activities);
QVERIFY(info.valid());
QStringList startingActivities = info.activities();
// The window is either on a specific activity when created,
// or on all of them (aka startingActivities is empty or contains
// just one element)
QVERIFY(startingActivities.size() <= 1);
// Window on all activities
KX11Extras::self()->setOnActivities(window->winId(), QStringList());
QVERIFY(waitForWindow(spyReal, window->winId(), NET::Properties(), NET::WM2Activities));
KWindowInfo info2(window->winId(), NET::Properties(), NET::WM2Activities);
QVERIFY(info2.activities().size() == 0);
// Window on a specific activity
KX11Extras::self()->setOnActivities(window->winId(), QStringList() << "test-activity");
QVERIFY(waitForWindow(spyReal, window->winId(), NET::Properties(), NET::WM2Activities));
KWindowInfo info3(window->winId(), NET::Properties(), NET::WM2Activities);
QVERIFY(info3.activities().size() == 1);
QVERIFY(info3.activities()[0] == "test-activity");
// Window on two specific activities
KX11Extras::self()->setOnActivities(window->winId(), QStringList{"test-activity", "test-activity2"});
QVERIFY(waitForWindow(spyReal, window->winId(), NET::Properties(), NET::WM2Activities));
KWindowInfo info4(window->winId(), NET::Properties(), NET::WM2Activities);
QCOMPARE(info4.activities().size(), 2);
QVERIFY(info4.activities()[0] == "test-activity");
QVERIFY(info4.activities()[1] == "test-activity2");
// Window on the starting activity
KX11Extras::self()->setOnActivities(window->winId(), startingActivities);
QVERIFY(waitForWindow(spyReal, window->winId(), NET::Properties(), NET::WM2Activities));
KWindowInfo info5(window->winId(), NET::Properties(), NET::WM2Activities);
QVERIFY(info5.activities() == startingActivities);
}
void KWindowInfoX11Test::testWindowClass()
{
KWindowInfo info(window->winId(), NET::Properties(), NET::WM2WindowClass);
QCOMPARE(info.windowClassName(), QByteArrayLiteral("kwindowinfox11test"));
QCOMPARE(info.windowClassClass(), QByteArrayLiteral("kwindowinfox11test"));
// window class needs to be changed using xcb
xcb_change_property(QX11Info::connection(), XCB_PROP_MODE_REPLACE, window->winId(), XCB_ATOM_WM_CLASS, XCB_ATOM_STRING, 8, 7, "foo\0bar");
xcb_flush(QX11Info::connection());
// it's just a property change so we can easily refresh
QX11Info::getTimestamp();
KWindowInfo info2(window->winId(), NET::Properties(), NET::WM2WindowClass);
QCOMPARE(info2.windowClassName(), QByteArrayLiteral("foo"));
QCOMPARE(info2.windowClassClass(), QByteArrayLiteral("bar"));
}
void KWindowInfoX11Test::testWindowRole()
{
KWindowInfo info(window->winId(), NET::Properties(), NET::WM2WindowRole);
QVERIFY(info.windowRole().isNull());
// window role needs to be changed using xcb
KXUtils::Atom atom(QX11Info::connection(), QByteArrayLiteral("WM_WINDOW_ROLE"));
xcb_change_property(QX11Info::connection(), XCB_PROP_MODE_REPLACE, window->winId(), atom, XCB_ATOM_STRING, 8, 3, "bar");
xcb_flush(QX11Info::connection());
// it's just a property change so we can easily refresh
QX11Info::getTimestamp();
KWindowInfo info2(window->winId(), NET::Properties(), NET::WM2WindowRole);
QCOMPARE(info2.windowRole(), QByteArrayLiteral("bar"));
}
void KWindowInfoX11Test::testClientMachine()
{
const QByteArray oldHostName = QSysInfo::machineHostName().toLocal8Bit();
KWindowInfo info(window->winId(), NET::Properties(), NET::WM2ClientMachine);
QCOMPARE(info.clientMachine(), oldHostName);
// client machine needs to be set through xcb
const QByteArray newHostName = oldHostName + "2";
xcb_change_property(QX11Info::connection(),
XCB_PROP_MODE_REPLACE,
window->winId(),
XCB_ATOM_WM_CLIENT_MACHINE,
XCB_ATOM_STRING,
8,
newHostName.size(),
newHostName.data());
xcb_flush(QX11Info::connection());
// it's just a property change so we can easily refresh
QX11Info::getTimestamp();
KWindowInfo info2(window->winId(), NET::Properties(), NET::WM2ClientMachine);
QCOMPARE(info2.clientMachine(), newHostName);
}
void KWindowInfoX11Test::testName()
{
// clang-format off
KWindowInfo info(window->winId(), NET::WMName | NET::WMVisibleName | NET::WMIconName | NET::WMVisibleIconName | NET::WMState | NET::XAWMState);
QCOMPARE(info.name(), QStringLiteral("kwindowinfox11test"));
QCOMPARE(info.visibleName(), QStringLiteral("kwindowinfox11test"));
QCOMPARE(info.visibleNameWithState(), QStringLiteral("kwindowinfox11test"));
QCOMPARE(info.iconName(), QStringLiteral("kwindowinfox11test"));
QCOMPARE(info.visibleIconName(), QStringLiteral("kwindowinfox11test"));
QCOMPARE(info.visibleIconNameWithState(), QStringLiteral("kwindowinfox11test"));
window->showMinimized();
// TODO: improve by using signalspy?
QTest::qWait(100);
// should be minimized, now
QVERIFY(verifyMinimized(window->winId()));
// that should have changed the visible name
KWindowInfo info2(window->winId(), NET::WMName | NET::WMVisibleName | NET::WMIconName | NET::WMVisibleIconName | NET::WMState | NET::XAWMState);
QCOMPARE(info2.name(), QStringLiteral("kwindowinfox11test"));
QCOMPARE(info2.visibleName(), QStringLiteral("kwindowinfox11test"));
QCOMPARE(info2.visibleNameWithState(), QStringLiteral("(kwindowinfox11test)"));
QCOMPARE(info2.iconName(), QStringLiteral("kwindowinfox11test"));
QCOMPARE(info2.visibleIconName(), QStringLiteral("kwindowinfox11test"));
QCOMPARE(info2.visibleIconNameWithState(), QStringLiteral("(kwindowinfox11test)"));
NETRootInfo rootInfo(QX11Info::connection(), NET::Supported | NET::SupportingWMCheck);
if (qstrcmp(rootInfo.wmName(), "Openbox") == 0) {
QSKIP("setting name test fails on openbox");
}
// create a low level NETWinInfo to manipulate the name
NETWinInfo winInfo(QX11Info::connection(), window->winId(), QX11Info::appRootWindow(), NET::WMName, NET::Properties2());
winInfo.setName("foobar");
QX11Info::getTimestamp();
KWindowInfo info3(window->winId(), NET::WMName | NET::WMVisibleName | NET::WMIconName | NET::WMVisibleIconName | NET::WMState | NET::XAWMState);
QCOMPARE(info3.name(), QStringLiteral("foobar"));
QCOMPARE(info3.visibleName(), QStringLiteral("foobar"));
QCOMPARE(info3.visibleNameWithState(), QStringLiteral("(foobar)"));
QCOMPARE(info3.iconName(), QStringLiteral("foobar"));
QCOMPARE(info3.visibleIconName(), QStringLiteral("foobar"));
QCOMPARE(info3.visibleIconNameWithState(), QStringLiteral("(foobar)"));
// clang-format on
}
void KWindowInfoX11Test::testTransientFor()
{
KWindowInfo info(window->winId(), NET::Properties(), NET::WM2TransientFor);
QCOMPARE(info.transientFor(), WId(0));
// let's create a second window
std::unique_ptr<QWidget> window2(new QWidget());
window2->show();
QVERIFY(QTest::qWaitForWindowExposed(window2.get()));
// update the transient for of window1 to window2
const uint32_t id = window2->winId();
xcb_change_property(QX11Info::connection(), XCB_PROP_MODE_REPLACE, window->winId(), XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32, 1, &id);
xcb_flush(QX11Info::connection());
KWindowInfo info2(window->winId(), NET::Properties(), NET::WM2TransientFor);
QCOMPARE(info2.transientFor(), window2->winId());
}
void KWindowInfoX11Test::testGroupLeader()
{
// WM_CLIENT_LEADER is set by default
KWindowInfo info1(window->winId(), NET::Properties(), NET::WM2GroupLeader);
QVERIFY(info1.groupLeader() != XCB_WINDOW_NONE);
xcb_connection_t *connection = QX11Info::connection();
xcb_window_t rootWindow = QX11Info::appRootWindow();
xcb_window_t leader = xcb_generate_id(connection);
xcb_create_window(connection, XCB_COPY_FROM_PARENT, leader, rootWindow, 0, 0, 1, 1, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, 0, nullptr);
xcb_icccm_wm_hints_t hints = {};
hints.flags = XCB_ICCCM_WM_HINT_WINDOW_GROUP;
hints.window_group = leader;
xcb_icccm_set_wm_hints(connection, leader, &hints);
xcb_icccm_set_wm_hints(connection, window->winId(), &hints);
KWindowInfo info2(window->winId(), NET::Properties(), NET::WM2GroupLeader);
QCOMPARE(info2.groupLeader(), leader);
}
void KWindowInfoX11Test::testExtendedStrut()
{
KWindowInfo info(window->winId(), NET::Properties(), NET::WM2ExtendedStrut);
NETExtendedStrut strut = info.extendedStrut();
QCOMPARE(strut.bottom_end, 0);
QCOMPARE(strut.bottom_start, 0);
QCOMPARE(strut.bottom_width, 0);
QCOMPARE(strut.left_end, 0);
QCOMPARE(strut.left_start, 0);
QCOMPARE(strut.left_width, 0);
QCOMPARE(strut.right_end, 0);
QCOMPARE(strut.right_start, 0);
QCOMPARE(strut.right_width, 0);
QCOMPARE(strut.top_end, 0);
QCOMPARE(strut.top_start, 0);
QCOMPARE(strut.top_width, 0);
KX11Extras::setExtendedStrut(window->winId(), 10, 20, 30, 40, 5, 15, 25, 35, 2, 12, 22, 32);
// it's just an xprop, so one roundtrip is good enough
QX11Info::getTimestamp();
KWindowInfo info2(window->winId(), NET::Properties(), NET::WM2ExtendedStrut);
strut = info2.extendedStrut();
QCOMPARE(strut.bottom_end, 32);
QCOMPARE(strut.bottom_start, 22);
QCOMPARE(strut.bottom_width, 12);
QCOMPARE(strut.left_end, 30);
QCOMPARE(strut.left_start, 20);
QCOMPARE(strut.left_width, 10);
QCOMPARE(strut.right_end, 15);
QCOMPARE(strut.right_start, 5);
QCOMPARE(strut.right_width, 40);
QCOMPARE(strut.top_end, 2);
QCOMPARE(strut.top_start, 35);
QCOMPARE(strut.top_width, 25);
}
void KWindowInfoX11Test::testGeometry()
{
KWindowInfo info(window->winId(), NET::WMGeometry | NET::WMFrameExtents);
QCOMPARE(info.geometry().size(), window->geometry().size());
QCOMPARE(info.frameGeometry().size(), window->frameGeometry().size());
QSignalSpy spy(KX11Extras::self(), &KX11Extras::windowChanged);
QVERIFY(spy.isValid());
// this is tricky, KWin is smart and doesn't allow all geometries we pass in
// setting to center of screen should work, though
QRect geo(window->windowHandle()->screen()->geometry().center() - QPoint(window->width() / 2 - 5, window->height() / 2 - 5),
window->size() + QSize(10, 10));
window->setGeometry(geo);
waitForWindow(spy, window->winId(), NET::WMGeometry);
KWindowInfo info2(window->winId(), NET::WMGeometry | NET::WMFrameExtents);
QCOMPARE(info2.geometry(), window->geometry());
QCOMPARE(info2.geometry(), geo);
QCOMPARE(info2.frameGeometry(), window->frameGeometry());
}
void KWindowInfoX11Test::testDesktopFileName()
{
KWindowInfo info(window->winId(), NET::Properties(), NET::WM2DesktopFileName);
QVERIFY(info.valid());
#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 1)
QCOMPARE(info.desktopFileName(), "kwindowinfox11test");
#else
QCOMPARE(info.desktopFileName(), QString());
#endif
QSignalSpy spy(KX11Extras::self(), &KX11Extras::windowChanged);
QVERIFY(spy.isValid());
// create a NETWinInfo to set the desktop file name
NETWinInfo netInfo(QX11Info::connection(), window->winId(), QX11Info::appRootWindow(), NET::Properties(), NET::Properties2());
netInfo.setDesktopFileName("org.kde.foo");
xcb_flush(QX11Info::connection());
// it's just a property change so we can easily refresh
QX11Info::getTimestamp();
QTRY_COMPARE(spy.count(), 1);
QCOMPARE(spy.first().at(0).value<WId>(), window->winId());
QCOMPARE(spy.first().at(2).value<NET::Properties2>(), NET::Properties2(NET::WM2DesktopFileName));
KWindowInfo info2(window->winId(), NET::Properties(), NET::WM2DesktopFileName);
QVERIFY(info2.valid());
QCOMPARE(info2.desktopFileName(), QByteArrayLiteral("org.kde.foo"));
}
void KWindowInfoX11Test::testPid()
{
KWindowInfo info(window->winId(), NET::WMPid);
QVERIFY(info.valid());
QCOMPARE(info.pid(), getpid());
}
QTEST_MAIN(KWindowInfoX11Test)
#include "kwindowinfox11test.moc"
@@ -0,0 +1,90 @@
/*
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include <QFileSystemWatcher>
#include <QProcess>
#include <QSignalSpy>
#include <QStandardPaths>
#include <QTest>
class TestKWindowsystemPlatformWayland : public QObject
{
Q_OBJECT
private Q_SLOTS:
void initTestCase();
void cleanupTestCase();
void testWithHelper();
private:
std::unique_ptr<QProcess> m_westonProcess;
};
void TestKWindowsystemPlatformWayland::initTestCase()
{
const QString westonExec = QStandardPaths::findExecutable(QStringLiteral("weston"));
// start Weston
m_westonProcess.reset(new QProcess);
m_westonProcess->setProgram(westonExec);
m_westonProcess->setArguments(QStringList({QStringLiteral("--socket=kwindowsystem-platform-wayland-0"), QStringLiteral("--backend=headless-backend.so")}));
m_westonProcess->start();
if (!m_westonProcess->waitForStarted()) {
m_westonProcess.reset();
QSKIP("Weston could not be started");
}
// wait for the socket to appear
QTest::qWait(500);
QDir runtimeDir(qgetenv("XDG_RUNTIME_DIR"));
if (runtimeDir.exists(QStringLiteral("kwindowsystem-platform-wayland-0"))) {
// already there
return;
}
std::unique_ptr<QFileSystemWatcher> socketWatcher(new QFileSystemWatcher(QStringList({runtimeDir.absolutePath()})));
QSignalSpy socketSpy(socketWatcher.get(), &QFileSystemWatcher::directoryChanged);
QVERIFY(socketSpy.isValid());
// limit to max of 10 waits
for (int i = 0; i < 10; i++) {
QVERIFY(socketSpy.wait());
if (runtimeDir.exists(QStringLiteral("kwindowsystem-platform-wayland-0"))) {
return;
}
}
}
void TestKWindowsystemPlatformWayland::cleanupTestCase()
{
if (!m_westonProcess) {
return;
}
m_westonProcess->terminate();
QVERIFY(m_westonProcess->waitForFinished());
m_westonProcess.reset();
}
void TestKWindowsystemPlatformWayland::testWithHelper()
{
// This test starts a helper binary on platform wayland
// it executes the actual test and will return 0 on success, and an error value otherwise
QString processName = QFINDTESTDATA("kwindowsystem_platform_wayland_helper");
QVERIFY(!processName.isEmpty());
QProcess helper;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert(QStringLiteral("WAYLAND_DISPLAY"), QStringLiteral("kwindowsystem-platform-wayland-0"));
helper.setProgram(processName);
helper.setProcessEnvironment(env);
helper.start();
QVERIFY(helper.waitForFinished());
QCOMPARE(helper.exitCode(), 0);
}
QTEST_GUILESS_MAIN(TestKWindowsystemPlatformWayland)
#include "kwindowsystem_platform_wayland_test.moc"
@@ -0,0 +1,101 @@
/*
SPDX-FileCopyrightText: 2014 Aaron Seigo <aseigo@kde.org>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include "kwindowinfo.h"
#include "kwindowsystem.h"
#include "kx11extras.h"
#include "nettesthelper.h"
#include "netwm.h"
#include <QRunnable>
#include <QSignalSpy>
#include <QTest>
#include <QThread>
#include <QThreadPool>
class KWindowSystemThreadTest : public QObject
{
Q_OBJECT
private Q_SLOTS:
void initTestCase();
void testWindowAdded();
void testAccessFromThread();
private:
QWidget *m_widget;
};
class KWindowSystemCreator : public QRunnable
{
public:
void run() override
{
(void)KWindowSystem::self();
}
};
class WindowInfoLister : public QThread
{
public:
void run() override
{
// simulate some activity in another thread gathering window information
const QList<WId> windows = KX11Extras::stackingOrder();
for (auto wid : windows) {
KWindowInfo info(wid, NET::WMVisibleName);
if (info.valid()) {
m_names << info.visibleName();
}
}
}
QStringList m_names;
};
void KWindowSystemThreadTest::initTestCase()
{
m_widget = nullptr;
QRunnable *creator = new KWindowSystemCreator;
creator->setAutoDelete(true);
QThreadPool::globalInstance()->start(creator);
QVERIFY(QThreadPool::globalInstance()->waitForDone(5000));
}
void KWindowSystemThreadTest::testWindowAdded()
{
qRegisterMetaType<WId>("WId");
QSignalSpy spy(KX11Extras::self(), &KX11Extras::windowAdded);
m_widget = new QWidget;
m_widget->show();
QVERIFY(QTest::qWaitForWindowExposed(m_widget));
QVERIFY(spy.count() > 0);
bool hasWId = false;
for (auto it = spy.constBegin(); it != spy.constEnd(); ++it) {
if ((*it).isEmpty()) {
continue;
}
QCOMPARE((*it).count(), 1);
hasWId = (*it).at(0).toULongLong() == m_widget->winId();
if (hasWId) {
break;
}
}
QVERIFY(hasWId);
QVERIFY(KX11Extras::hasWId(m_widget->winId()));
}
void KWindowSystemThreadTest::testAccessFromThread()
{
WindowInfoLister listerThread;
listerThread.start();
QVERIFY(listerThread.wait(5000));
QVERIFY(!listerThread.m_names.isEmpty());
}
QTEST_MAIN(KWindowSystemThreadTest)
#include <kwindowsystem_threadtest.moc>
@@ -0,0 +1,350 @@
/*
SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "kwindowinfo.h"
#include "kwindowsystem.h"
#include "kx11extras.h"
#include "nettesthelper.h"
#include "netwm.h"
#include <QSignalSpy>
#include <QWidget>
#include <private/qtx11extras_p.h>
#include <qtest_widgets.h>
Q_DECLARE_METATYPE(WId)
Q_DECLARE_METATYPE(NET::Properties)
Q_DECLARE_METATYPE(NET::Properties2)
Q_DECLARE_METATYPE(const unsigned long *)
class KWindowSystemX11Test : public QObject
{
Q_OBJECT
private Q_SLOTS:
void initTestCase();
// needs to be first test, would fail if run after others (X11)
void testActiveWindowChanged();
void testWindowAdded();
void testWindowRemoved();
void testDesktopChanged();
void testNumberOfDesktopsChanged();
void testDesktopNamesChanged();
void testShowingDesktopChanged();
void testSetShowingDesktop();
void testWorkAreaChanged();
void testWindowTitleChanged();
void testMinimizeWindow();
void testPlatformX11();
};
void KWindowSystemX11Test::initTestCase()
{
QCoreApplication::setAttribute(Qt::AA_ForceRasterWidgets);
}
void KWindowSystemX11Test::testActiveWindowChanged()
{
qRegisterMetaType<WId>("WId");
QSignalSpy spy(KX11Extras::self(), &KX11Extras::activeWindowChanged);
std::unique_ptr<QWidget> widget(new QWidget);
widget->show();
QVERIFY(spy.wait());
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.first().at(0).toULongLong(), widget->winId());
QCOMPARE(KX11Extras::activeWindow(), widget->winId());
}
void KWindowSystemX11Test::testWindowAdded()
{
qRegisterMetaType<WId>("WId");
QSignalSpy spy(KX11Extras::self(), &KX11Extras::windowAdded);
QSignalSpy stackingOrderSpy(KX11Extras::self(), &KX11Extras::stackingOrderChanged);
std::unique_ptr<QWidget> widget(new QWidget);
widget->show();
QVERIFY(QTest::qWaitForWindowExposed(widget.get()));
QVERIFY(spy.count() > 0);
bool hasWId = false;
for (auto it = spy.constBegin(); it != spy.constEnd(); ++it) {
if ((*it).isEmpty()) {
continue;
}
QCOMPARE((*it).count(), 1);
hasWId = (*it).at(0).toULongLong() == widget->winId();
if (hasWId) {
break;
}
}
QVERIFY(hasWId);
QVERIFY(KX11Extras::hasWId(widget->winId()));
QVERIFY(!stackingOrderSpy.isEmpty());
}
void KWindowSystemX11Test::testWindowRemoved()
{
qRegisterMetaType<WId>("WId");
std::unique_ptr<QWidget> widget(new QWidget);
widget->show();
QVERIFY(QTest::qWaitForWindowExposed(widget.get()));
QVERIFY(KX11Extras::hasWId(widget->winId()));
QSignalSpy spy(KX11Extras::self(), &KX11Extras::windowRemoved);
widget->hide();
spy.wait(1000);
QCOMPARE(spy.first().at(0).toULongLong(), widget->winId());
QVERIFY(!KX11Extras::hasWId(widget->winId()));
}
void KWindowSystemX11Test::testDesktopChanged()
{
// This test requires a running NETWM-compliant window manager
if (KX11Extras::numberOfDesktops() == 1) {
QSKIP("At least two virtual desktops are required to test desktop changed");
}
const int current = KX11Extras::currentDesktop();
QSignalSpy spy(KX11Extras::self(), &KX11Extras::currentDesktopChanged);
int newDesktop = current + 1;
if (newDesktop > KX11Extras::numberOfDesktops()) {
newDesktop = 1;
}
KX11Extras::setCurrentDesktop(newDesktop);
QVERIFY(spy.wait());
QCOMPARE(KX11Extras::currentDesktop(), newDesktop);
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.first().at(0).toInt(), newDesktop);
spy.clear();
// setting to current desktop should not change anything
KX11Extras::setCurrentDesktop(newDesktop);
// set back for clean state
KX11Extras::setCurrentDesktop(current);
QVERIFY(spy.wait());
QCOMPARE(KX11Extras::currentDesktop(), current);
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.first().at(0).toInt(), current);
}
void KWindowSystemX11Test::testNumberOfDesktopsChanged()
{
// This test requires a running NETWM-compliant window manager
const int oldNumber = KX11Extras::numberOfDesktops();
QSignalSpy spy(KX11Extras::self(), &KX11Extras::numberOfDesktopsChanged);
// KWin has arbitrary max number of 20 desktops, so don't fail the test if we use +1
const int newNumber = oldNumber < 20 ? oldNumber + 1 : oldNumber - 1;
NETRootInfo info(QX11Info::connection(), NET::NumberOfDesktops, NET::Properties2());
info.setNumberOfDesktops(newNumber);
QVERIFY(spy.wait());
QCOMPARE(KX11Extras::numberOfDesktops(), newNumber);
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.first().at(0).toInt(), newNumber);
spy.clear();
// setting to same number should not change
info.setNumberOfDesktops(newNumber);
// set back for clean state
info.setNumberOfDesktops(oldNumber);
QVERIFY(spy.wait());
QCOMPARE(KX11Extras::numberOfDesktops(), oldNumber);
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.first().at(0).toInt(), oldNumber);
}
void KWindowSystemX11Test::testDesktopNamesChanged()
{
// This test requires a running NETWM-compliant window manager
const QString origName = KX11Extras::desktopName(KX11Extras::currentDesktop());
QSignalSpy spy(KX11Extras::self(), &KX11Extras::desktopNamesChanged);
const QString testName = QStringLiteral("testFooBar");
KX11Extras::setDesktopName(KX11Extras::currentDesktop(), testName);
QVERIFY(spy.wait());
QCOMPARE(KX11Extras::desktopName(KX11Extras::currentDesktop()), testName);
QCOMPARE(spy.count(), 1);
spy.clear();
QX11Info::setAppTime(QX11Info::getTimestamp());
// setting back to clean state
KX11Extras::setDesktopName(KX11Extras::currentDesktop(), origName);
QVERIFY(spy.wait());
QCOMPARE(KX11Extras::desktopName(KX11Extras::currentDesktop()), origName);
QCOMPARE(spy.count(), 1);
}
void KWindowSystemX11Test::testShowingDesktopChanged()
{
QX11Info::setAppTime(QX11Info::getTimestamp());
const bool showingDesktop = KWindowSystem::showingDesktop();
QSignalSpy spy(KWindowSystem::self(), &KWindowSystem::showingDesktopChanged);
NETRootInfo info(QX11Info::connection(), NET::Properties(), NET::WM2ShowingDesktop);
info.setShowingDesktop(!showingDesktop);
QVERIFY(spy.wait());
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.first().at(0).toBool(), !showingDesktop);
QCOMPARE(KWindowSystem::showingDesktop(), !showingDesktop);
spy.clear();
QX11Info::setAppTime(QX11Info::getTimestamp());
// setting again should not change
info.setShowingDesktop(!showingDesktop);
// setting back to clean state
info.setShowingDesktop(showingDesktop);
QVERIFY(spy.wait(100));
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.first().at(0).toBool(), showingDesktop);
QCOMPARE(KWindowSystem::showingDesktop(), showingDesktop);
}
void KWindowSystemX11Test::testSetShowingDesktop()
{
QSignalSpy spy(KWindowSystem::self(), &KWindowSystem::showingDesktopChanged);
const bool showingDesktop = KWindowSystem::showingDesktop();
// setting the same state shouldn't change it
QX11Info::setAppTime(QX11Info::getTimestamp());
KWindowSystem::setShowingDesktop(showingDesktop);
QCOMPARE(spy.wait(), false); // spy.wait() waits for 5s
QCOMPARE(KWindowSystem::showingDesktop(), showingDesktop);
spy.clear();
// set opposite state
QX11Info::setAppTime(QX11Info::getTimestamp());
KWindowSystem::setShowingDesktop(!showingDesktop);
QVERIFY(spy.wait());
QCOMPARE(KWindowSystem::showingDesktop(), !showingDesktop);
spy.clear();
// setting back to clean state
QX11Info::setAppTime(QX11Info::getTimestamp());
KWindowSystem::setShowingDesktop(showingDesktop);
QVERIFY(spy.wait());
QCOMPARE(KWindowSystem::showingDesktop(), showingDesktop);
spy.clear();
}
void KWindowSystemX11Test::testWorkAreaChanged()
{
// if there are multiple screens this test can fail as workarea is not multi screen aware
QSignalSpy spy(KX11Extras::self(), &KX11Extras::workAreaChanged);
QSignalSpy strutSpy(KX11Extras::self(), &KX11Extras::strutChanged);
QWidget widget;
widget.setGeometry(0, 0, 100, 10);
widget.show();
KX11Extras::setExtendedStrut(widget.winId(), 10, 0, 10, 0, 0, 0, 100, 0, 100, 0, 0, 0);
QVERIFY(spy.wait());
QVERIFY(!spy.isEmpty());
QVERIFY(!strutSpy.isEmpty());
}
void KWindowSystemX11Test::testWindowTitleChanged()
{
qRegisterMetaType<WId>("WId");
qRegisterMetaType<NET::Properties>("NET::Properties");
qRegisterMetaType<NET::Properties2>("NET::Properties2");
qRegisterMetaType<const unsigned long *>("const ulong*");
QWidget widget;
widget.setWindowTitle(QStringLiteral("foo"));
widget.show();
QVERIFY(QTest::qWaitForWindowExposed(&widget));
// wait till the window is mapped, etc.
QTest::qWait(200);
QSignalSpy propertiesChangedSpy(KX11Extras::self(), &KX11Extras::windowChanged);
QVERIFY(propertiesChangedSpy.isValid());
widget.setWindowTitle(QStringLiteral("bar"));
QX11Info::setAppTime(QX11Info::getTimestamp());
int counter = 0;
bool gotWMName = false;
while (propertiesChangedSpy.wait() && counter < 10) {
for (auto it = propertiesChangedSpy.constBegin(); it != propertiesChangedSpy.constEnd(); ++it) {
if ((*it).isEmpty()) {
continue;
}
if ((*it).at(0).toULongLong() == widget.winId()) {
NET::Properties props = (*it).at(1).value<NET::Properties>();
if (props.testFlag(NET::WMName)) {
gotWMName = true;
}
}
}
if (gotWMName) {
break;
}
propertiesChangedSpy.clear();
counter++;
}
QVERIFY(gotWMName);
// now let's verify the info in KWindowInfo
// we wait a little bit more as openbox is updating the visible name
QTest::qWait(500);
KWindowInfo info(widget.winId(), NET::WMName | NET::WMVisibleName | NET::WMVisibleIconName | NET::WMIconName, NET::Properties2());
QVERIFY(info.valid());
const QString expectedName = QStringLiteral("bar");
QCOMPARE(info.name(), expectedName);
QCOMPARE(info.visibleName(), expectedName);
QCOMPARE(info.visibleIconName(), expectedName);
QCOMPARE(info.iconName(), expectedName);
}
void KWindowSystemX11Test::testMinimizeWindow()
{
NETRootInfo rootInfo(QX11Info::connection(), NET::Supported | NET::SupportingWMCheck);
if (qstrcmp(rootInfo.wmName(), "Openbox") != 0 && qstrcmp(rootInfo.wmName(), "KWin") != 0) {
QSKIP("Test minimize window might not be supported on the used window manager.");
}
QWidget widget;
widget.show();
QVERIFY(QTest::qWaitForWindowExposed(&widget));
KWindowInfo info(widget.winId(), NET::WMState | NET::XAWMState);
QVERIFY(!info.isMinimized());
KX11Extras::minimizeWindow(widget.winId());
// create a roundtrip, updating minimized state is done by the window manager and wait a short time
QX11Info::setAppTime(QX11Info::getTimestamp());
QTest::qWait(200);
KWindowInfo info2(widget.winId(), NET::WMState | NET::XAWMState);
QVERIFY(info2.isMinimized());
KX11Extras::unminimizeWindow(widget.winId());
// create a roundtrip, updating minimized state is done by the window manager and wait a short time
QX11Info::setAppTime(QX11Info::getTimestamp());
QTest::qWait(200);
KWindowInfo info3(widget.winId(), NET::WMState | NET::XAWMState);
QVERIFY(!info3.isMinimized());
}
void KWindowSystemX11Test::testPlatformX11()
{
QCOMPARE(KWindowSystem::platform(), KWindowSystem::Platform::X11);
QCOMPARE(KWindowSystem::isPlatformX11(), true);
QCOMPARE(KWindowSystem::isPlatformWayland(), false);
}
QTEST_MAIN(KWindowSystemX11Test)
#include "kwindowsystemx11test.moc"
@@ -0,0 +1,94 @@
/* This file is part of the KDE libraries
SPDX-FileCopyrightText: 2012 David Faure <faure@kde.org>
SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include <QSignalSpy>
#include <private/qtx11extras_p.h>
#include <kxmessages.h>
#include <qtest_widgets.h>
class KXMessages_UnitTest : public QObject
{
Q_OBJECT
public:
enum BroadcastType {
BroadcastMessageObject,
BroadcastStaticConnection,
};
enum ReceiverType {
ReceiverTypeDefault,
ReceiverTypeConnection,
};
KXMessages_UnitTest()
: m_msgs()
{
}
private Q_SLOTS:
void testStart_data();
void testStart();
private:
KXMessages m_msgs;
};
Q_DECLARE_METATYPE(KXMessages_UnitTest::BroadcastType)
Q_DECLARE_METATYPE(KXMessages_UnitTest::ReceiverType)
void KXMessages_UnitTest::testStart_data()
{
QTest::addColumn<KXMessages_UnitTest::BroadcastType>("broadcastType");
QTest::addColumn<KXMessages_UnitTest::ReceiverType>("receiverType");
QTest::newRow("object") << BroadcastMessageObject << ReceiverTypeDefault;
QTest::newRow("connection") << BroadcastStaticConnection << ReceiverTypeDefault;
QTest::newRow("object/xcb") << BroadcastMessageObject << ReceiverTypeConnection;
QTest::newRow("connection/xcb") << BroadcastStaticConnection << ReceiverTypeConnection;
}
void KXMessages_UnitTest::testStart()
{
QFETCH(KXMessages_UnitTest::BroadcastType, broadcastType);
QFETCH(KXMessages_UnitTest::ReceiverType, receiverType);
const QByteArray type = "kxmessage_unittest";
std::unique_ptr<KXMessages> receiver;
switch (receiverType) {
case KXMessages_UnitTest::ReceiverTypeDefault:
receiver.reset(new KXMessages(type));
break;
case KXMessages_UnitTest::ReceiverTypeConnection:
receiver.reset(new KXMessages(QX11Info::connection(), QX11Info::appRootWindow(), type));
break;
default:
Q_UNREACHABLE();
break;
}
// Check that all message sizes work, i.e. no bug when exactly 20 or 40 bytes,
// despite the internal splitting.
QString message;
for (int i = 1; i < 50; ++i) {
QSignalSpy spy(receiver.get(), &KXMessages::gotMessage);
message += "a";
switch (broadcastType) {
case KXMessages_UnitTest::BroadcastMessageObject:
m_msgs.broadcastMessage(type, message);
break;
case KXMessages_UnitTest::BroadcastStaticConnection:
QVERIFY(KXMessages::broadcastMessageX(QX11Info::connection(), type.constData(), message, QX11Info::appScreen()));
break;
}
QVERIFY(spy.wait());
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.at(0).at(0).toString(), message);
}
}
QTEST_MAIN(KXMessages_UnitTest)
#include "kxmessages_unittest.moc"
@@ -0,0 +1,859 @@
/*
SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "nettesthelper.h"
#include <netwm.h>
#include <QProcess>
#include <QStandardPaths>
#include <qtest_widgets.h>
// system
#include <unistd.h>
using Property = UniqueCPointer<xcb_get_property_reply_t>;
Q_DECLARE_METATYPE(NET::Orientation)
Q_DECLARE_METATYPE(NET::DesktopLayoutCorner)
static const char *s_wmName = "netrootinfotest";
class NetRootInfoTestWM : public QObject
{
Q_OBJECT
private Q_SLOTS:
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
void testCtor();
void testSupported();
void testClientList();
void testClientListStacking();
void testNumberOfDesktops();
void testCurrentDesktop();
void testDesktopNames();
void testDesktopLayout_data();
void testDesktopLayout();
void testDesktopGeometry();
void testDesktopViewports();
void testShowingDesktop_data();
void testShowingDesktop();
void testWorkArea();
void testActiveWindow();
void testVirtualRoots();
void testDontCrashMapViewports();
private:
void waitForPropertyChange(NETRootInfo *info, xcb_atom_t atom, NET::Property prop, NET::Property2 prop2 = NET::Property2(0));
xcb_connection_t *connection()
{
return m_connection;
}
xcb_connection_t *m_connection;
QList<xcb_connection_t *> m_connections;
std::unique_ptr<QProcess> m_xvfb;
xcb_window_t m_supportWindow;
xcb_window_t m_rootWindow;
};
void NetRootInfoTestWM::cleanupTestCase()
{
while (!m_connections.isEmpty()) {
xcb_disconnect(m_connections.takeFirst());
}
}
void NetRootInfoTestWM::initTestCase()
{
}
void NetRootInfoTestWM::init()
{
// first reset just to be sure
m_connection = nullptr;
m_supportWindow = XCB_WINDOW_NONE;
// start Xvfb
const QString xfvbExec = QStandardPaths::findExecutable(QStringLiteral("Xvfb"));
QVERIFY(!xfvbExec.isEmpty());
m_xvfb.reset(new QProcess);
// use pipe to pass fd to Xvfb to get back the display id
int pipeFds[2];
QVERIFY(pipe(pipeFds) == 0);
m_xvfb->start(xfvbExec, QStringList{QStringLiteral("-displayfd"), QString::number(pipeFds[1])});
QVERIFY(m_xvfb->waitForStarted());
QCOMPARE(m_xvfb->state(), QProcess::Running);
// reads from pipe, closes write side
close(pipeFds[1]);
QFile readPipe;
QVERIFY(readPipe.open(pipeFds[0], QIODevice::ReadOnly, QFileDevice::AutoCloseHandle));
QByteArray displayNumber = readPipe.readLine();
readPipe.close();
displayNumber.prepend(QByteArray(":"));
displayNumber.remove(displayNumber.size() - 1, 1);
// create X connection
int screen = 0;
m_connection = xcb_connect(displayNumber.constData(), &screen);
QVERIFY(m_connection);
QVERIFY(!xcb_connection_has_error(m_connection));
m_rootWindow = KXUtils::rootWindow(m_connection, screen);
uint32_t values[] = {XCB_EVENT_MASK_PROPERTY_CHANGE};
xcb_change_window_attributes(m_connection, m_rootWindow, XCB_CW_EVENT_MASK, values);
// create support window
values[0] = true;
m_supportWindow = xcb_generate_id(m_connection);
xcb_create_window(m_connection,
XCB_COPY_FROM_PARENT,
m_supportWindow,
m_rootWindow,
0,
0,
1,
1,
0,
XCB_COPY_FROM_PARENT,
XCB_COPY_FROM_PARENT,
XCB_CW_OVERRIDE_REDIRECT,
values);
const uint32_t lowerValues[] = {XCB_STACK_MODE_BELOW};
// we need to do the lower window with a roundtrip, otherwise NETRootInfo is not functioning
UniqueCPointer<xcb_generic_error_t> error(
xcb_request_check(m_connection, xcb_configure_window_checked(m_connection, m_supportWindow, XCB_CONFIG_WINDOW_STACK_MODE, lowerValues)));
QVERIFY(!error);
}
void NetRootInfoTestWM::cleanup()
{
// destroy support window
xcb_destroy_window(connection(), m_supportWindow);
m_supportWindow = XCB_WINDOW_NONE;
// close connection
// delay till clenupTestCase as otherwise xcb reuses the same memory address
m_connections << connection();
// kill Xvfb
m_xvfb->terminate();
m_xvfb->waitForFinished();
m_xvfb.reset();
}
void NetRootInfoTestWM::waitForPropertyChange(NETRootInfo *info, xcb_atom_t atom, NET::Property prop, NET::Property2 prop2)
{
while (true) {
UniqueCPointer<xcb_generic_event_t> event(xcb_wait_for_event(connection()));
if (!event) {
break;
}
if ((event->response_type & ~0x80) != XCB_PROPERTY_NOTIFY) {
continue;
}
xcb_property_notify_event_t *pe = reinterpret_cast<xcb_property_notify_event_t *>(event.get());
if (pe->window != m_rootWindow) {
continue;
}
if (pe->atom != atom) {
continue;
}
NET::Properties dirty;
NET::Properties2 dirty2;
info->event(event.get(), &dirty, &dirty2);
if (prop != 0) {
QVERIFY(dirty & prop);
}
if (prop2 != 0) {
QVERIFY(dirty2 & prop2);
}
if (!prop) {
QCOMPARE(dirty, NET::Properties());
}
if (!prop2) {
QCOMPARE(dirty2, NET::Properties2());
}
break;
}
}
void NetRootInfoTestWM::testCtor()
{
QVERIFY(connection());
NETRootInfo
rootInfo(connection(), m_supportWindow, s_wmName, NET::WMAllProperties, NET::AllTypesMask, NET::States(~0u), NET::WM2AllProperties, NET::Actions(~0u));
QCOMPARE(rootInfo.xcbConnection(), connection());
QCOMPARE(rootInfo.rootWindow(), m_rootWindow);
QCOMPARE(rootInfo.supportWindow(), m_supportWindow);
QCOMPARE(rootInfo.wmName(), s_wmName);
QCOMPARE(rootInfo.supportedProperties(), NET::WMAllProperties);
QCOMPARE(rootInfo.supportedProperties2(), NET::WM2AllProperties);
QCOMPARE(rootInfo.supportedActions(), NET::Actions(~0u));
QCOMPARE(rootInfo.supportedStates(), NET::States(~0u));
QCOMPARE(rootInfo.supportedWindowTypes(), NET::AllTypesMask);
QCOMPARE(rootInfo.passedProperties(), NET::WMAllProperties);
QCOMPARE(rootInfo.passedProperties2(), NET::WM2AllProperties);
QCOMPARE(rootInfo.passedActions(), NET::Actions(~0u));
QCOMPARE(rootInfo.passedStates(), NET::States(~0u));
QCOMPARE(rootInfo.passedWindowTypes(), NET::AllTypesMask);
}
void NetRootInfoTestWM::testSupported()
{
KXUtils::Atom supported(connection(), QByteArrayLiteral("_NET_SUPPORTED"));
KXUtils::Atom wmCheck(connection(), QByteArrayLiteral("_NET_SUPPORTING_WM_CHECK"));
KXUtils::Atom wmName(connection(), QByteArrayLiteral("_NET_WM_NAME"));
KXUtils::Atom utf8String(connection(), QByteArrayLiteral("UTF8_STRING"));
QVERIFY(connection());
NETRootInfo
rootInfo(connection(), m_supportWindow, s_wmName, NET::WMAllProperties, NET::AllTypesMask, NET::States(~0u), NET::WM2AllProperties, NET::Actions(~0u));
int count = 0;
for (int i = 0; i < 34; ++i) {
if (i == 12) {
continue;
}
QVERIFY(rootInfo.isSupported(NET::Property(1 << i)));
count++;
}
for (int i = 0; i < 22; ++i) {
QVERIFY(rootInfo.isSupported(NET::Property2(1 << i)));
count++;
}
QVERIFY(rootInfo.isSupported(NET::WM2GTKShowWindowMenu));
count++;
for (int i = 0; i < 17; ++i) {
QVERIFY(rootInfo.isSupported(NET::WindowTypeMask(1 << i)));
count++;
}
for (int i = 0; i < 13; ++i) {
QVERIFY(rootInfo.isSupported(NET::State(1 << i)));
count++;
}
for (int i = 0; i < 10; ++i) {
QVERIFY(rootInfo.isSupported(NET::Action(1 << i)));
count++;
}
// NET::WMFrameExtents has two properties
count += 1;
// XAWState, WMGeometry, WM2TransientFor, WM2GroupLeader, WM2WindowClass, WM2WindowRole, WM2ClientMachine
count -= 7;
// WM2BlockCompositing has 3 properties
count += 2;
// Add _GTK_FRAME_EXTENTS
++count;
QVERIFY(supported != XCB_ATOM_NONE);
QVERIFY(utf8String != XCB_ATOM_NONE);
QVERIFY(wmCheck != XCB_ATOM_NONE);
QVERIFY(wmName != XCB_ATOM_NONE);
// we should have got some events
waitForPropertyChange(&rootInfo, supported, NET::Supported);
waitForPropertyChange(&rootInfo, wmCheck, NET::SupportingWMCheck);
// get the cookies of the things to check
xcb_get_property_cookie_t supportedCookie = xcb_get_property_unchecked(connection(), false, rootInfo.rootWindow(), supported, XCB_ATOM_ATOM, 0, 101);
xcb_get_property_cookie_t wmCheckRootCookie = xcb_get_property_unchecked(connection(), false, rootInfo.rootWindow(), wmCheck, XCB_ATOM_WINDOW, 0, 1);
xcb_get_property_cookie_t wmCheckSupportWinCookie = xcb_get_property_unchecked(connection(), false, m_supportWindow, wmCheck, XCB_ATOM_WINDOW, 0, 1);
xcb_get_property_cookie_t wmNameCookie = xcb_get_property_unchecked(connection(), false, m_supportWindow, wmName, utf8String, 0, 16);
Property supportedReply(xcb_get_property_reply(connection(), supportedCookie, nullptr));
QVERIFY(supportedReply);
QCOMPARE(supportedReply->format, uint8_t(32));
QCOMPARE(supportedReply->value_len, uint32_t(count));
// TODO: check that the correct atoms are set?
Property wmCheckRootReply(xcb_get_property_reply(connection(), wmCheckRootCookie, nullptr));
QVERIFY(wmCheckRootReply);
QCOMPARE(wmCheckRootReply->format, uint8_t(32));
QCOMPARE(wmCheckRootReply->value_len, uint32_t(1));
QCOMPARE(reinterpret_cast<xcb_window_t *>(xcb_get_property_value(wmCheckRootReply.get()))[0], m_supportWindow);
Property wmCheckSupportReply(xcb_get_property_reply(connection(), wmCheckSupportWinCookie, nullptr));
QVERIFY(wmCheckSupportReply);
QCOMPARE(wmCheckSupportReply->format, uint8_t(32));
QCOMPARE(wmCheckSupportReply->value_len, uint32_t(1));
QCOMPARE(reinterpret_cast<xcb_window_t *>(xcb_get_property_value(wmCheckSupportReply.get()))[0], m_supportWindow);
Property wmNameReply(xcb_get_property_reply(connection(), wmNameCookie, nullptr));
QVERIFY(wmNameReply);
QCOMPARE(wmNameReply->format, uint8_t(8));
QCOMPARE(wmNameReply->value_len, uint32_t(15));
QCOMPARE(reinterpret_cast<const char *>(xcb_get_property_value(wmNameReply.get())), s_wmName);
// disable some supported
rootInfo.setSupported(NET::WMFrameExtents, false);
rootInfo.setSupported(NET::WM2KDETemporaryRules, false);
rootInfo.setSupported(NET::ActionChangeDesktop, false);
rootInfo.setSupported(NET::FullScreen, false);
QVERIFY(rootInfo.isSupported(NET::ToolbarMask));
QVERIFY(rootInfo.isSupported(NET::OnScreenDisplayMask));
QVERIFY(rootInfo.isSupported(NET::DockMask));
rootInfo.setSupported(NET::ToolbarMask, false);
rootInfo.setSupported(NET::OnScreenDisplayMask, false);
QVERIFY(!rootInfo.isSupported(NET::WMFrameExtents));
QVERIFY(!rootInfo.isSupported(NET::WM2KDETemporaryRules));
QVERIFY(!rootInfo.isSupported(NET::ActionChangeDesktop));
QVERIFY(!rootInfo.isSupported(NET::FullScreen));
QVERIFY(!rootInfo.isSupported(NET::ToolbarMask));
QVERIFY(!rootInfo.isSupported(NET::OnScreenDisplayMask));
QVERIFY(rootInfo.isSupported(NET::DockMask));
// lets get supported again
supportedCookie = xcb_get_property_unchecked(connection(), false, rootInfo.rootWindow(), supported, XCB_ATOM_ATOM, 0, 90);
supportedReply.reset(xcb_get_property_reply(connection(), supportedCookie, nullptr));
QVERIFY(supportedReply);
QCOMPARE(supportedReply->format, uint8_t(32));
QCOMPARE(supportedReply->value_len, uint32_t(count - 7));
for (int i = 0; i < 5; ++i) {
// we should have got some events
waitForPropertyChange(&rootInfo, supported, NET::Supported);
waitForPropertyChange(&rootInfo, wmCheck, NET::SupportingWMCheck);
}
// turn something off, just to get another event
rootInfo.setSupported(NET::WM2BlockCompositing, false);
// lets get supported again
supportedCookie = xcb_get_property_unchecked(connection(), false, rootInfo.rootWindow(), supported, XCB_ATOM_ATOM, 0, 90);
supportedReply.reset(xcb_get_property_reply(connection(), supportedCookie, nullptr));
QVERIFY(supportedReply);
QCOMPARE(supportedReply->format, uint8_t(32));
QCOMPARE(supportedReply->value_len, uint32_t(count - 9));
NETRootInfo clientInfo(connection(), NET::Supported | NET::SupportingWMCheck);
waitForPropertyChange(&clientInfo, supported, NET::Supported);
waitForPropertyChange(&clientInfo, wmCheck, NET::SupportingWMCheck);
}
void NetRootInfoTestWM::testClientList()
{
KXUtils::Atom atom(connection(), QByteArrayLiteral("_NET_CLIENT_LIST"));
QVERIFY(connection());
NETRootInfo
rootInfo(connection(), m_supportWindow, s_wmName, NET::WMAllProperties, NET::AllTypesMask, NET::States(~0u), NET::WM2AllProperties, NET::Actions(~0u));
QCOMPARE(rootInfo.clientListCount(), 0);
QVERIFY(!rootInfo.clientList());
xcb_window_t windows[] = {xcb_generate_id(connection()),
xcb_generate_id(connection()),
xcb_generate_id(connection()),
xcb_generate_id(connection()),
xcb_generate_id(connection())};
rootInfo.setClientList(windows, 5);
QCOMPARE(rootInfo.clientListCount(), 5);
const xcb_window_t *otherWins = rootInfo.clientList();
for (int i = 0; i < 5; ++i) {
QCOMPARE(otherWins[i], windows[i]);
}
// compare with the X property
QVERIFY(atom != XCB_ATOM_NONE);
xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(connection(), false, rootInfo.rootWindow(), atom, XCB_ATOM_WINDOW, 0, 5);
Property reply(xcb_get_property_reply(connection(), cookie, nullptr));
QVERIFY(reply);
QCOMPARE(reply->format, uint8_t(32));
QCOMPARE(reply->value_len, uint32_t(5));
const xcb_window_t *propWins = reinterpret_cast<xcb_window_t *>(xcb_get_property_value(reply.get()));
for (int i = 0; i < 5; ++i) {
QCOMPARE(propWins[i], windows[i]);
}
// wait for our property
NETRootInfo clientInfo(connection(), NET::Supported | NET::SupportingWMCheck | NET::ClientList);
waitForPropertyChange(&clientInfo, atom, NET::ClientList);
QCOMPARE(clientInfo.clientListCount(), 5);
const xcb_window_t *otherWins2 = clientInfo.clientList();
for (int i = 0; i < 5; ++i) {
QCOMPARE(otherWins2[i], windows[i]);
}
}
void NetRootInfoTestWM::testClientListStacking()
{
KXUtils::Atom atom(connection(), QByteArrayLiteral("_NET_CLIENT_LIST_STACKING"));
QVERIFY(connection());
NETRootInfo
rootInfo(connection(), m_supportWindow, s_wmName, NET::WMAllProperties, NET::AllTypesMask, NET::States(~0u), NET::WM2AllProperties, NET::Actions(~0u));
QCOMPARE(rootInfo.clientListStackingCount(), 0);
QVERIFY(!rootInfo.clientListStacking());
xcb_window_t windows[] = {xcb_generate_id(connection()),
xcb_generate_id(connection()),
xcb_generate_id(connection()),
xcb_generate_id(connection()),
xcb_generate_id(connection())};
rootInfo.setClientListStacking(windows, 5);
QCOMPARE(rootInfo.clientListStackingCount(), 5);
const xcb_window_t *otherWins = rootInfo.clientListStacking();
for (int i = 0; i < 5; ++i) {
QCOMPARE(otherWins[i], windows[i]);
}
// compare with the X property
QVERIFY(atom != XCB_ATOM_NONE);
xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(connection(), false, rootInfo.rootWindow(), atom, XCB_ATOM_WINDOW, 0, 5);
Property reply(xcb_get_property_reply(connection(), cookie, nullptr));
QVERIFY(reply);
QCOMPARE(reply->format, uint8_t(32));
QCOMPARE(reply->value_len, uint32_t(5));
const xcb_window_t *propWins = reinterpret_cast<xcb_window_t *>(xcb_get_property_value(reply.get()));
for (int i = 0; i < 5; ++i) {
QCOMPARE(propWins[i], windows[i]);
}
// wait for our property
waitForPropertyChange(&rootInfo, atom, NET::ClientListStacking);
QCOMPARE(rootInfo.clientListStackingCount(), 5);
const xcb_window_t *otherWins2 = rootInfo.clientListStacking();
for (int i = 0; i < 5; ++i) {
QCOMPARE(otherWins2[i], windows[i]);
}
}
void NetRootInfoTestWM::testVirtualRoots()
{
KXUtils::Atom atom(connection(), QByteArrayLiteral("_NET_VIRTUAL_ROOTS"));
QVERIFY(connection());
NETRootInfo
rootInfo(connection(), m_supportWindow, s_wmName, NET::WMAllProperties, NET::AllTypesMask, NET::States(~0u), NET::WM2AllProperties, NET::Actions(~0u));
QCOMPARE(rootInfo.virtualRootsCount(), 0);
QVERIFY(!rootInfo.virtualRoots());
xcb_window_t windows[] = {xcb_generate_id(connection()),
xcb_generate_id(connection()),
xcb_generate_id(connection()),
xcb_generate_id(connection()),
xcb_generate_id(connection())};
rootInfo.setVirtualRoots(windows, 5);
QCOMPARE(rootInfo.virtualRootsCount(), 5);
const xcb_window_t *otherWins = rootInfo.virtualRoots();
for (int i = 0; i < 5; ++i) {
QCOMPARE(otherWins[i], windows[i]);
}
// compare with the X property
QVERIFY(atom != XCB_ATOM_NONE);
xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(connection(), false, rootInfo.rootWindow(), atom, XCB_ATOM_WINDOW, 0, 5);
Property reply(xcb_get_property_reply(connection(), cookie, nullptr));
QVERIFY(reply);
QCOMPARE(reply->format, uint8_t(32));
QCOMPARE(reply->value_len, uint32_t(5));
const xcb_window_t *propWins = reinterpret_cast<xcb_window_t *>(xcb_get_property_value(reply.get()));
for (int i = 0; i < 5; ++i) {
QCOMPARE(propWins[i], windows[i]);
}
// wait for our property - reported to a Client NETRootInfo
NETRootInfo clientInfo(connection(), NET::VirtualRoots);
waitForPropertyChange(&clientInfo, atom, NET::VirtualRoots);
QCOMPARE(rootInfo.virtualRootsCount(), 5);
const xcb_window_t *otherWins2 = rootInfo.virtualRoots();
for (int i = 0; i < 5; ++i) {
QCOMPARE(otherWins2[i], windows[i]);
}
}
void NetRootInfoTestWM::testNumberOfDesktops()
{
KXUtils::Atom atom(connection(), QByteArrayLiteral("_NET_NUMBER_OF_DESKTOPS"));
QVERIFY(connection());
NETRootInfo
rootInfo(connection(), m_supportWindow, s_wmName, NET::WMAllProperties, NET::AllTypesMask, NET::States(~0u), NET::WM2AllProperties, NET::Actions(~0u));
QCOMPARE(rootInfo.numberOfDesktops(), 1);
rootInfo.setNumberOfDesktops(4);
QCOMPARE(rootInfo.numberOfDesktops(), 4);
// compare with the X property
QVERIFY(atom != XCB_ATOM_NONE);
xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(connection(), false, rootInfo.rootWindow(), atom, XCB_ATOM_CARDINAL, 0, 1);
Property reply(xcb_get_property_reply(connection(), cookie, nullptr));
QVERIFY(reply);
QCOMPARE(reply->format, uint8_t(32));
QCOMPARE(reply->value_len, uint32_t(1));
QCOMPARE(reinterpret_cast<uint32_t *>(xcb_get_property_value(reply.get()))[0], uint32_t(4));
// wait for our property
waitForPropertyChange(&rootInfo, atom, NET::NumberOfDesktops);
QCOMPARE(rootInfo.numberOfDesktops(), 4);
}
void NetRootInfoTestWM::testCurrentDesktop()
{
KXUtils::Atom atom(connection(), QByteArrayLiteral("_NET_CURRENT_DESKTOP"));
// TODO: verify that current desktop cannot be higher than number of desktops
QVERIFY(connection());
NETRootInfo
rootInfo(connection(), m_supportWindow, s_wmName, NET::WMAllProperties, NET::AllTypesMask, NET::States(~0u), NET::WM2AllProperties, NET::Actions(~0u));
QCOMPARE(rootInfo.currentDesktop(), 1);
rootInfo.setCurrentDesktop(5);
QCOMPARE(rootInfo.currentDesktop(), 5);
// compare with the X property
QVERIFY(atom != XCB_ATOM_NONE);
xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(connection(), false, rootInfo.rootWindow(), atom, XCB_ATOM_CARDINAL, 0, 1);
Property reply(xcb_get_property_reply(connection(), cookie, nullptr));
QVERIFY(reply);
QCOMPARE(reply->format, uint8_t(32));
QCOMPARE(reply->value_len, uint32_t(1));
// note: API starts counting at 1, but property starts counting at 5, because of that subtracting one
QCOMPARE(reinterpret_cast<uint32_t *>(xcb_get_property_value(reply.get()))[0], uint32_t(5 - 1));
// wait for our property
waitForPropertyChange(&rootInfo, atom, NET::CurrentDesktop);
QCOMPARE(rootInfo.currentDesktop(), 5);
}
void NetRootInfoTestWM::testDesktopNames()
{
KXUtils::Atom atom(connection(), QByteArrayLiteral("_NET_DESKTOP_NAMES"));
KXUtils::Atom utf8String(connection(), QByteArrayLiteral("UTF8_STRING"));
QVERIFY(connection());
NETRootInfo
rootInfo(connection(), m_supportWindow, s_wmName, NET::WMAllProperties, NET::AllTypesMask, NET::States(~0u), NET::WM2AllProperties, NET::Actions(~0u));
QVERIFY(!rootInfo.desktopName(0));
QVERIFY(!rootInfo.desktopName(1));
QVERIFY(!rootInfo.desktopName(2));
rootInfo.setDesktopName(1, "foo");
rootInfo.setDesktopName(2, "bar");
rootInfo.setNumberOfDesktops(2);
QCOMPARE(rootInfo.desktopName(1), "foo");
QCOMPARE(rootInfo.desktopName(2), "bar");
// compare with the X property
QVERIFY(atom != XCB_ATOM_NONE);
QVERIFY(utf8String != XCB_ATOM_NONE);
xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(connection(), false, rootInfo.rootWindow(), atom, utf8String, 0, 10000);
Property reply(xcb_get_property_reply(connection(), cookie, nullptr));
QVERIFY(reply);
QCOMPARE(reply->format, uint8_t(8));
QCOMPARE(reply->value_len, uint32_t(8));
QCOMPARE(reinterpret_cast<const char *>(xcb_get_property_value(reply.get())), "foo\0bar");
// wait for our property
waitForPropertyChange(&rootInfo, atom, NET::DesktopNames);
QCOMPARE(rootInfo.desktopName(1), "foo");
QCOMPARE(rootInfo.desktopName(2), "bar");
// there should be two events
waitForPropertyChange(&rootInfo, atom, NET::DesktopNames);
QCOMPARE(rootInfo.desktopName(1), "foo");
QCOMPARE(rootInfo.desktopName(2), "bar");
}
void NetRootInfoTestWM::testActiveWindow()
{
KXUtils::Atom atom(connection(), QByteArrayLiteral("_NET_ACTIVE_WINDOW"));
QVERIFY(connection());
NETRootInfo
rootInfo(connection(), m_supportWindow, s_wmName, NET::WMAllProperties, NET::AllTypesMask, NET::States(~0u), NET::WM2AllProperties, NET::Actions(~0u));
QVERIFY(rootInfo.activeWindow() == XCB_WINDOW_NONE);
// rootinfo doesn't verify whether our window is a window, so we just generate an ID
xcb_window_t activeWindow = xcb_generate_id(connection());
rootInfo.setActiveWindow(activeWindow);
QCOMPARE(rootInfo.activeWindow(), activeWindow);
// compare with the X property
QVERIFY(atom != XCB_ATOM_NONE);
xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(connection(), false, rootInfo.rootWindow(), atom, XCB_ATOM_WINDOW, 0, 1);
Property reply(xcb_get_property_reply(connection(), cookie, nullptr));
QVERIFY(reply);
QCOMPARE(reply->format, uint8_t(32));
QCOMPARE(reply->value_len, uint32_t(1));
QCOMPARE(reinterpret_cast<xcb_window_t *>(xcb_get_property_value(reply.get()))[0], activeWindow);
// wait for our property
waitForPropertyChange(&rootInfo, atom, NET::ActiveWindow);
QCOMPARE(rootInfo.activeWindow(), activeWindow);
}
void NetRootInfoTestWM::testDesktopGeometry()
{
KXUtils::Atom atom(connection(), QByteArrayLiteral("_NET_DESKTOP_GEOMETRY"));
QVERIFY(connection());
NETRootInfo
rootInfo(connection(), m_supportWindow, s_wmName, NET::WMAllProperties, NET::AllTypesMask, NET::States(~0u), NET::WM2AllProperties, NET::Actions(~0u));
QCOMPARE(rootInfo.desktopGeometry().width, 0);
QCOMPARE(rootInfo.desktopGeometry().height, 0);
NETSize size;
size.width = 1000;
size.height = 800;
rootInfo.setDesktopGeometry(size);
QCOMPARE(rootInfo.desktopGeometry().width, size.width);
QCOMPARE(rootInfo.desktopGeometry().height, size.height);
// compare with the X property
QVERIFY(atom != XCB_ATOM_NONE);
xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(connection(), false, rootInfo.rootWindow(), atom, XCB_ATOM_CARDINAL, 0, 2);
Property reply(xcb_get_property_reply(connection(), cookie, nullptr));
QVERIFY(reply);
QCOMPARE(reply->format, uint8_t(32));
QCOMPARE(reply->value_len, uint32_t(2));
uint32_t *data = reinterpret_cast<uint32_t *>(xcb_get_property_value(reply.get()));
QCOMPARE(data[0], uint32_t(size.width));
QCOMPARE(data[1], uint32_t(size.height));
// wait for our property
waitForPropertyChange(&rootInfo, atom, NET::DesktopGeometry);
QCOMPARE(rootInfo.desktopGeometry().width, size.width);
QCOMPARE(rootInfo.desktopGeometry().height, size.height);
}
void NetRootInfoTestWM::testDesktopLayout_data()
{
QTest::addColumn<NET::Orientation>("orientation");
QTest::addColumn<QSize>("columnsRows");
QTest::addColumn<NET::DesktopLayoutCorner>("corner");
QTest::newRow("h/1/1/tl") << NET::OrientationHorizontal << QSize(1, 1) << NET::DesktopLayoutCornerTopLeft;
QTest::newRow("h/1/0/tr") << NET::OrientationHorizontal << QSize(1, 0) << NET::DesktopLayoutCornerTopRight;
QTest::newRow("h/0/1/bl") << NET::OrientationHorizontal << QSize(0, 1) << NET::DesktopLayoutCornerBottomLeft;
QTest::newRow("h/1/2/br") << NET::OrientationHorizontal << QSize(1, 2) << NET::DesktopLayoutCornerBottomRight;
QTest::newRow("v/3/2/tl") << NET::OrientationVertical << QSize(3, 2) << NET::DesktopLayoutCornerTopLeft;
QTest::newRow("v/5/4/tr") << NET::OrientationVertical << QSize(5, 4) << NET::DesktopLayoutCornerTopRight;
QTest::newRow("v/2/1/bl") << NET::OrientationVertical << QSize(2, 1) << NET::DesktopLayoutCornerBottomLeft;
QTest::newRow("v/3/2/br") << NET::OrientationVertical << QSize(3, 2) << NET::DesktopLayoutCornerBottomRight;
}
void NetRootInfoTestWM::testDesktopLayout()
{
KXUtils::Atom atom(connection(), QByteArrayLiteral("_NET_DESKTOP_LAYOUT"));
QVERIFY(connection());
NETRootInfo
rootInfo(connection(), m_supportWindow, s_wmName, NET::WMAllProperties, NET::AllTypesMask, NET::States(~0u), NET::WM2AllProperties, NET::Actions(~0u));
QFETCH(NET::Orientation, orientation);
QFETCH(QSize, columnsRows);
QFETCH(NET::DesktopLayoutCorner, corner);
rootInfo.setDesktopLayout(orientation, columnsRows.width(), columnsRows.height(), corner);
QCOMPARE(rootInfo.desktopLayoutOrientation(), orientation);
QCOMPARE(rootInfo.desktopLayoutColumnsRows(), columnsRows);
QCOMPARE(rootInfo.desktopLayoutCorner(), corner);
// compare with the X property
QVERIFY(atom != XCB_ATOM_NONE);
xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(connection(), false, rootInfo.rootWindow(), atom, XCB_ATOM_CARDINAL, 0, 4);
Property reply(xcb_get_property_reply(connection(), cookie, nullptr));
QVERIFY(reply);
QCOMPARE(reply->format, uint8_t(32));
QCOMPARE(reply->value_len, uint32_t(4));
uint32_t *data = reinterpret_cast<uint32_t *>(xcb_get_property_value(reply.get()));
QCOMPARE(data[0], uint32_t(orientation));
QCOMPARE(data[1], uint32_t(columnsRows.width()));
QCOMPARE(data[2], uint32_t(columnsRows.height()));
QCOMPARE(data[3], uint32_t(corner));
// wait for our property
waitForPropertyChange(&rootInfo, atom, NET::Property(0), NET::WM2DesktopLayout);
QCOMPARE(rootInfo.desktopLayoutOrientation(), orientation);
QCOMPARE(rootInfo.desktopLayoutColumnsRows(), columnsRows);
QCOMPARE(rootInfo.desktopLayoutCorner(), corner);
NETRootInfo info2(connection(), NET::WMAllProperties, NET::WM2AllProperties);
QCOMPARE(info2.desktopLayoutColumnsRows(), columnsRows);
}
void NetRootInfoTestWM::testDesktopViewports()
{
KXUtils::Atom atom(connection(), QByteArrayLiteral("_NET_DESKTOP_VIEWPORT"));
QVERIFY(connection());
NETRootInfo
rootInfo(connection(), m_supportWindow, s_wmName, NET::WMAllProperties, NET::AllTypesMask, NET::States(~0u), NET::WM2AllProperties, NET::Actions(~0u));
// we need to know the number of desktops, therefore setting it
rootInfo.setNumberOfDesktops(4);
NETPoint desktopOne;
desktopOne.x = 100;
desktopOne.y = 50;
NETPoint desktopTwo;
desktopTwo.x = 200;
desktopTwo.y = 100;
rootInfo.setDesktopViewport(1, desktopOne);
rootInfo.setDesktopViewport(2, desktopTwo);
const NETPoint compareZero = rootInfo.desktopViewport(0);
QCOMPARE(compareZero.x, 0);
QCOMPARE(compareZero.y, 0);
const NETPoint compareOne = rootInfo.desktopViewport(1);
QCOMPARE(compareOne.x, desktopOne.x);
QCOMPARE(compareOne.y, desktopOne.y);
const NETPoint compareTwo = rootInfo.desktopViewport(2);
QCOMPARE(compareTwo.x, desktopTwo.x);
QCOMPARE(compareTwo.y, desktopTwo.y);
const NETPoint compareThree = rootInfo.desktopViewport(3);
QCOMPARE(compareThree.x, 0);
QCOMPARE(compareThree.y, 0);
// compare with the X property
QVERIFY(atom != XCB_ATOM_NONE);
xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(connection(), false, rootInfo.rootWindow(), atom, XCB_ATOM_CARDINAL, 0, 8);
Property reply(xcb_get_property_reply(connection(), cookie, nullptr));
QVERIFY(reply);
QCOMPARE(reply->format, uint8_t(32));
QCOMPARE(reply->value_len, uint32_t(8));
uint32_t *data = reinterpret_cast<uint32_t *>(xcb_get_property_value(reply.get()));
QCOMPARE(data[0], uint32_t(desktopOne.x));
QCOMPARE(data[1], uint32_t(desktopOne.y));
QCOMPARE(data[2], uint32_t(desktopTwo.x));
QCOMPARE(data[3], uint32_t(desktopTwo.y));
QCOMPARE(data[4], uint32_t(0));
QCOMPARE(data[5], uint32_t(0));
QCOMPARE(data[6], uint32_t(0));
QCOMPARE(data[7], uint32_t(0));
// wait for our property - two events
waitForPropertyChange(&rootInfo, atom, NET::DesktopViewport);
waitForPropertyChange(&rootInfo, atom, NET::DesktopViewport);
const NETPoint compareOne2 = rootInfo.desktopViewport(1);
QCOMPARE(compareOne2.x, desktopOne.x);
QCOMPARE(compareOne2.y, desktopOne.y);
const NETPoint compareTwo2 = rootInfo.desktopViewport(2);
QCOMPARE(compareTwo2.x, desktopTwo.x);
QCOMPARE(compareTwo2.y, desktopTwo.y);
const NETPoint compareThree2 = rootInfo.desktopViewport(3);
QCOMPARE(compareThree2.x, 0);
QCOMPARE(compareThree2.y, 0);
}
void NetRootInfoTestWM::testShowingDesktop_data()
{
QTest::addColumn<bool>("set");
QTest::addColumn<uint32_t>("setValue");
QTest::newRow("true") << true << uint32_t(1);
QTest::newRow("false") << false << uint32_t(0);
}
void NetRootInfoTestWM::testShowingDesktop()
{
KXUtils::Atom atom(connection(), QByteArrayLiteral("_NET_SHOWING_DESKTOP"));
QVERIFY(connection());
NETRootInfo
rootInfo(connection(), m_supportWindow, s_wmName, NET::WMAllProperties, NET::AllTypesMask, NET::States(~0u), NET::WM2AllProperties, NET::Actions(~0u));
QFETCH(bool, set);
rootInfo.setShowingDesktop(set);
QCOMPARE(rootInfo.showingDesktop(), set);
// compare with the X property
QVERIFY(atom != XCB_ATOM_NONE);
xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(connection(), false, rootInfo.rootWindow(), atom, XCB_ATOM_CARDINAL, 0, 1);
Property reply(xcb_get_property_reply(connection(), cookie, nullptr));
QVERIFY(reply);
QCOMPARE(reply->format, uint8_t(32));
QCOMPARE(reply->value_len, uint32_t(1));
QTEST(reinterpret_cast<uint32_t *>(xcb_get_property_value(reply.get()))[0], "setValue");
// wait for our property
waitForPropertyChange(&rootInfo, atom, NET::Property(0), NET::WM2ShowingDesktop);
QCOMPARE(rootInfo.showingDesktop(), set);
}
void NetRootInfoTestWM::testWorkArea()
{
KXUtils::Atom atom(connection(), QByteArrayLiteral("_NET_WORKAREA"));
QVERIFY(connection());
NETRootInfo
rootInfo(connection(), m_supportWindow, s_wmName, NET::WMAllProperties, NET::AllTypesMask, NET::States(~0u), NET::WM2AllProperties, NET::Actions(~0u));
// we need to know the number of desktops, therefore setting it
rootInfo.setNumberOfDesktops(4);
NETRect desktopOne;
desktopOne.pos.x = 10;
desktopOne.pos.y = 5;
desktopOne.size.width = 1000;
desktopOne.size.height = 800;
NETRect desktopTwo;
desktopTwo.pos.x = 20;
desktopTwo.pos.y = 10;
desktopTwo.size.width = 800;
desktopTwo.size.height = 750;
rootInfo.setWorkArea(1, desktopOne);
rootInfo.setWorkArea(2, desktopTwo);
const NETRect compareZero = rootInfo.workArea(0);
QCOMPARE(compareZero.pos.x, 0);
QCOMPARE(compareZero.pos.y, 0);
QCOMPARE(compareZero.size.width, 0);
QCOMPARE(compareZero.size.height, 0);
const NETRect compareOne = rootInfo.workArea(1);
QCOMPARE(compareOne.pos.x, desktopOne.pos.x);
QCOMPARE(compareOne.pos.y, desktopOne.pos.y);
QCOMPARE(compareOne.size.width, desktopOne.size.width);
QCOMPARE(compareOne.size.height, desktopOne.size.height);
const NETRect compareTwo = rootInfo.workArea(2);
QCOMPARE(compareTwo.pos.x, desktopTwo.pos.x);
QCOMPARE(compareTwo.pos.y, desktopTwo.pos.y);
QCOMPARE(compareTwo.size.width, desktopTwo.size.width);
QCOMPARE(compareTwo.size.height, desktopTwo.size.height);
const NETRect compareThree = rootInfo.workArea(3);
QCOMPARE(compareThree.pos.x, 0);
QCOMPARE(compareThree.pos.y, 0);
QCOMPARE(compareThree.size.width, 0);
QCOMPARE(compareThree.size.height, 0);
// compare with the X property
QVERIFY(atom != XCB_ATOM_NONE);
xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(connection(), false, rootInfo.rootWindow(), atom, XCB_ATOM_CARDINAL, 0, 16);
Property reply(xcb_get_property_reply(connection(), cookie, nullptr));
QVERIFY(reply);
QCOMPARE(reply->format, uint8_t(32));
QCOMPARE(reply->value_len, uint32_t(16));
uint32_t *data = reinterpret_cast<uint32_t *>(xcb_get_property_value(reply.get()));
QCOMPARE(data[0], uint32_t(desktopOne.pos.x));
QCOMPARE(data[1], uint32_t(desktopOne.pos.y));
QCOMPARE(data[2], uint32_t(desktopOne.size.width));
QCOMPARE(data[3], uint32_t(desktopOne.size.height));
QCOMPARE(data[4], uint32_t(desktopTwo.pos.x));
QCOMPARE(data[5], uint32_t(desktopTwo.pos.y));
QCOMPARE(data[6], uint32_t(desktopTwo.size.width));
QCOMPARE(data[7], uint32_t(desktopTwo.size.height));
QCOMPARE(data[8], uint32_t(0));
QCOMPARE(data[9], uint32_t(0));
QCOMPARE(data[10], uint32_t(0));
QCOMPARE(data[11], uint32_t(0));
QCOMPARE(data[12], uint32_t(0));
QCOMPARE(data[13], uint32_t(0));
QCOMPARE(data[14], uint32_t(0));
QCOMPARE(data[15], uint32_t(0));
// wait for our property - two events
waitForPropertyChange(&rootInfo, atom, NET::WorkArea);
waitForPropertyChange(&rootInfo, atom, NET::WorkArea);
const NETRect compareOne2 = rootInfo.workArea(1);
QCOMPARE(compareOne2.pos.x, desktopOne.pos.x);
QCOMPARE(compareOne2.pos.y, desktopOne.pos.y);
QCOMPARE(compareOne2.size.width, desktopOne.size.width);
QCOMPARE(compareOne2.size.height, desktopOne.size.height);
const NETRect compareTwo2 = rootInfo.workArea(2);
QCOMPARE(compareTwo2.pos.x, desktopTwo.pos.x);
QCOMPARE(compareTwo2.pos.y, desktopTwo.pos.y);
QCOMPARE(compareTwo2.size.width, desktopTwo.size.width);
QCOMPARE(compareTwo2.size.height, desktopTwo.size.height);
const NETRect compareThree2 = rootInfo.workArea(3);
QCOMPARE(compareThree2.pos.x, 0);
QCOMPARE(compareThree2.pos.y, 0);
QCOMPARE(compareThree2.size.width, 0);
QCOMPARE(compareThree2.size.height, 0);
}
void NetRootInfoTestWM::testDontCrashMapViewports()
{
QProcess p;
const QString processName = QFINDTESTDATA("dontcrashmapviewport");
QVERIFY(!processName.isEmpty());
p.start(processName, QStringList());
QVERIFY(p.waitForFinished());
QCOMPARE(p.exitStatus(), QProcess::NormalExit);
QCOMPARE(p.exitCode(), 0);
}
QTEST_GUILESS_MAIN(NetRootInfoTestWM)
#include "netrootinfotestwm.moc"
@@ -0,0 +1,138 @@
/*
SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#ifndef NETTESTHELPER_H
#define NETTESTHELPER_H
#include <QByteArray>
#include <memory>
#include <xcb/xcb.h>
#include "cptr_p.h"
namespace KXUtils
{
/**
* @brief Small helper class to fetch an intern atom through XCB.
*
* This class allows to request an intern atom and delay the retrieval of the reply
* till it is needed. In case the reply is never retrieved the reply gets discarded
* in the dtor. So there is no need to keep track manually about which atoms have been
* retrieved.
*
* This class can be used as a drop-in replacement for everywhere where a xcb_atom_t is
* needed as it implements the cast operator. The first time this operator is invoked it
* will retrieve the reply. If the xcb request failed the value is @c XCB_ATOM_NONE, which
* can be used to check whether the returned value is valid.
*
* This class has two modes of operations: a direct one which performs the request directly
* during construction, and an indirect one which needs an explicit call to {@link fetch}.
*
* @code
* Atom direct(QX11Info::connection(), QByteArrayLiteral("myAtomName"));
* Atom indirect(QByteArrayLiteral("myAtomName"));
* indirect.setConnection(QX11Info::connection());
* indirect.fetch();
*
* if (direct == XCB_ATOM_NONE) {
* qWarning() << "Request failed";
* }
* if (indirect == XCB_ATOM_NONE) {
* qWarning() << "Request failed";
* }
* @endcode
*/
class Atom
{
public:
explicit Atom(const QByteArray &name)
: m_connection(nullptr)
, m_retrieved(false)
, m_atom(XCB_ATOM_NONE)
, m_name(name)
{
m_cookie.sequence = 0;
}
explicit Atom(xcb_connection_t *c, const QByteArray &name, bool onlyIfExists = false)
: m_connection(c)
, m_retrieved(false)
, m_cookie(xcb_intern_atom_unchecked(m_connection, onlyIfExists, name.length(), name.constData()))
, m_atom(XCB_ATOM_NONE)
, m_name(name)
{
}
Atom() Q_DECL_EQ_DELETE;
Atom(const Atom &) Q_DECL_EQ_DELETE;
~Atom()
{
if (!m_retrieved && m_cookie.sequence) {
xcb_discard_reply(m_connection, m_cookie.sequence);
}
}
void setConnection(xcb_connection_t *c)
{
m_connection = c;
}
void fetch(bool onlyIfExists = false)
{
if (!m_connection) {
// set connection first!
return;
}
if (m_retrieved || m_cookie.sequence) {
// already fetched, don't fetch again
return;
}
m_cookie = xcb_intern_atom_unchecked(m_connection, onlyIfExists, m_name.length(), m_name.constData());
}
operator xcb_atom_t() const
{
(const_cast<Atom *>(this))->getReply();
return m_atom;
}
const QByteArray &name() const
{
return m_name;
}
private:
void getReply()
{
if (m_retrieved || !m_cookie.sequence) {
return;
}
UniqueCPointer<xcb_intern_atom_reply_t> reply(xcb_intern_atom_reply(m_connection, m_cookie, nullptr));
if (reply) {
m_atom = reply->atom;
}
m_retrieved = true;
}
xcb_connection_t *m_connection;
bool m_retrieved;
xcb_intern_atom_cookie_t m_cookie;
xcb_atom_t m_atom;
QByteArray m_name;
};
inline xcb_window_t rootWindow(xcb_connection_t *c, int screen)
{
xcb_screen_iterator_t iter = xcb_setup_roots_iterator(xcb_get_setup(c));
for (xcb_screen_iterator_t it = xcb_setup_roots_iterator(xcb_get_setup(c)); it.rem; --screen, xcb_screen_next(&it)) {
if (screen == 0) {
return iter.data->root;
}
}
return XCB_WINDOW_NONE;
}
}
#endif
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,649 @@
/*
SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
SPDX-License-Identifier: LGPL-2.1-or-later
*/
#include "nettesthelper.h"
#include <netwm.h>
#include <QProcess>
#include <QStandardPaths>
#include <qtest_widgets.h>
// system
#include <unistd.h>
Q_DECLARE_METATYPE(NET::State)
Q_DECLARE_METATYPE(NET::States)
Q_DECLARE_METATYPE(NET::Actions)
using Property = UniqueCPointer<xcb_get_property_reply_t>;
// clang-format off
#define INFO NETWinInfo info(m_connection, m_testWindow, m_rootWindow, NET::WMAllProperties, NET::WM2AllProperties, NET::WindowManager);
#define ATOM(name) \
KXUtils::Atom atom(connection(), QByteArrayLiteral(#name));
#define UTF8 KXUtils::Atom utf8String(connection(), QByteArrayLiteral("UTF8_STRING"));
#define GETPROP(type, length, formatSize) \
xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(connection(), false, m_testWindow, \
atom, type, 0, length); \
Property reply(xcb_get_property_reply(connection(), cookie, nullptr)); \
QVERIFY(reply); \
QCOMPARE(reply->format, uint8_t(formatSize)); \
QCOMPARE(reply->value_len, uint32_t(length));
#define VERIFYDELETED(t) \
xcb_get_property_cookie_t cookieDeleted = xcb_get_property_unchecked(connection(), false, m_testWindow, \
atom, t, 0, 1); \
Property replyDeleted(xcb_get_property_reply(connection(), cookieDeleted, nullptr)); \
QVERIFY(replyDeleted); \
QVERIFY(replyDeleted->type == XCB_ATOM_NONE);
class NetWinInfoTestWM : public QObject
{
Q_OBJECT
private Q_SLOTS:
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
void testState_data();
void testState();
void testVisibleName();
void testVisibleIconName();
void testDesktop_data();
void testDesktop();
void testOpacity_data();
void testOpacity();
void testAllowedActions_data();
void testAllowedActions();
void testFrameExtents();
void testFrameExtentsKDE();
void testFrameOverlap();
void testFullscreenMonitors();
private:
bool hasAtomFlag(const xcb_atom_t *atoms, int atomsLenght, const QByteArray &actionName);
void testStrut(xcb_atom_t atom, NETStrut(NETWinInfo:: *getter)(void)const, void (NETWinInfo:: *setter)(NETStrut), NET::Property property, NET::Property2 property2 = NET::Property2(0));
void waitForPropertyChange(NETWinInfo *info, xcb_atom_t atom, NET::Property prop, NET::Property2 prop2 = NET::Property2(0));
xcb_connection_t *connection()
{
return m_connection;
}
xcb_connection_t *m_connection;
QList<xcb_connection_t*> m_connections;
std::unique_ptr<QProcess> m_xvfb;
xcb_window_t m_rootWindow;
xcb_window_t m_testWindow;
QByteArray m_displayNumber;
};
void NetWinInfoTestWM::initTestCase()
{
}
void NetWinInfoTestWM::cleanupTestCase()
{
// close connection
while (!m_connections.isEmpty()) {
xcb_disconnect(m_connections.takeFirst());
}
}
void NetWinInfoTestWM::init()
{
// first reset just to be sure
m_connection = nullptr;
m_rootWindow = XCB_WINDOW_NONE;
m_testWindow = XCB_WINDOW_NONE;
const QString xfvbExec = QStandardPaths::findExecutable(QStringLiteral("Xvfb"));
QVERIFY(!xfvbExec.isEmpty());
// start Xvfb
m_xvfb.reset(new QProcess);
// use pipe to pass fd to Xvfb to get back the display id
int pipeFds[2];
QVERIFY(pipe(pipeFds) == 0);
m_xvfb->start(QStringLiteral("Xvfb"), QStringList{ QStringLiteral("-displayfd"), QString::number(pipeFds[1]) });
QVERIFY(m_xvfb->waitForStarted());
QCOMPARE(m_xvfb->state(), QProcess::Running);
// reads from pipe, closes write side
close(pipeFds[1]);
QFile readPipe;
QVERIFY(readPipe.open(pipeFds[0], QIODevice::ReadOnly, QFileDevice::AutoCloseHandle));
QByteArray displayNumber = readPipe.readLine();
readPipe.close();
displayNumber.prepend(QByteArray(":"));
displayNumber.remove(displayNumber.size() -1, 1);
m_displayNumber = displayNumber;
// create X connection
int screen = 0;
m_connection = xcb_connect(displayNumber.constData(), &screen);
QVERIFY(m_connection);
QVERIFY(!xcb_connection_has_error(m_connection));
m_rootWindow = KXUtils::rootWindow(m_connection, screen);
// create test window
m_testWindow = xcb_generate_id(m_connection);
uint32_t values[] = {XCB_EVENT_MASK_PROPERTY_CHANGE};
xcb_create_window(m_connection, XCB_COPY_FROM_PARENT, m_testWindow,
m_rootWindow,
0, 0, 100, 100, 0, XCB_COPY_FROM_PARENT,
XCB_COPY_FROM_PARENT, XCB_CW_EVENT_MASK, values);
// and map it
xcb_map_window(m_connection, m_testWindow);
}
void NetWinInfoTestWM::cleanup()
{
// destroy test window
xcb_unmap_window(m_connection, m_testWindow);
xcb_destroy_window(m_connection, m_testWindow);
m_testWindow = XCB_WINDOW_NONE;
// delay till clenupTestCase as otherwise xcb reuses the same memory address
m_connections << connection();
// kill Xvfb
m_xvfb->terminate();
m_xvfb->waitForFinished();
}
void NetWinInfoTestWM::waitForPropertyChange(NETWinInfo *info, xcb_atom_t atom, NET::Property prop, NET::Property2 prop2)
{
while (true) {
UniqueCPointer<xcb_generic_event_t> event(xcb_wait_for_event(connection()));
if (!event) {
break;
}
if ((event->response_type & ~0x80) != XCB_PROPERTY_NOTIFY) {
continue;
}
xcb_property_notify_event_t *pe = reinterpret_cast<xcb_property_notify_event_t *>(event.get());
if (pe->window != m_testWindow) {
continue;
}
if (pe->atom != atom) {
continue;
}
NET::Properties dirty;
NET::Properties2 dirty2;
info->event(event.get(), &dirty, &dirty2);
if (prop != 0) {
QVERIFY(dirty & prop);
}
if (prop2 != 0) {
QVERIFY(dirty2 & prop2);
}
if (!prop) {
QCOMPARE(dirty, NET::Properties());
}
if (!prop2) {
QCOMPARE(dirty2, NET::Properties2());
}
break;
}
}
bool NetWinInfoTestWM::hasAtomFlag(const xcb_atom_t *atoms, int atomsLength, const QByteArray &actionName)
{
KXUtils::Atom atom(connection(), actionName);
if (atom == XCB_ATOM_NONE) {
qDebug() << "get atom failed";
return false;
}
for (int i = 0; i < atomsLength; ++i) {
if (atoms[i] == atom) {
return true;
}
}
return false;
}
void NetWinInfoTestWM::testAllowedActions_data()
{
QTest::addColumn<NET::Actions>("actions");
QTest::addColumn<QList<QByteArray> >("names");
const QByteArray move = QByteArrayLiteral("_NET_WM_ACTION_MOVE");
const QByteArray resize = QByteArrayLiteral("_NET_WM_ACTION_RESIZE");
const QByteArray minimize = QByteArrayLiteral("_NET_WM_ACTION_MINIMIZE");
const QByteArray shade = QByteArrayLiteral("_NET_WM_ACTION_SHADE");
const QByteArray stick = QByteArrayLiteral("_NET_WM_ACTION_STICK");
const QByteArray maxVert = QByteArrayLiteral("_NET_WM_ACTION_MAXIMIZE_VERT");
const QByteArray maxHoriz = QByteArrayLiteral("_NET_WM_ACTION_MAXIMIZE_HORZ");
const QByteArray fullscreen = QByteArrayLiteral("_NET_WM_ACTION_FULLSCREEN");
const QByteArray desktop = QByteArrayLiteral("_NET_WM_ACTION_CHANGE_DESKTOP");
const QByteArray close = QByteArrayLiteral("_NET_WM_ACTION_CLOSE");
QTest::newRow("move") << NET::Actions(NET::ActionMove) << (QList<QByteArray>() << move);
QTest::newRow("resize") << NET::Actions(NET::ActionResize) << (QList<QByteArray>() << resize);
QTest::newRow("minimize") << NET::Actions(NET::ActionMinimize) << (QList<QByteArray>() << minimize);
QTest::newRow("shade") << NET::Actions(NET::ActionShade) << (QList<QByteArray>() << shade);
QTest::newRow("stick") << NET::Actions(NET::ActionStick) << (QList<QByteArray>() << stick);
QTest::newRow("maxVert") << NET::Actions(NET::ActionMaxVert) << (QList<QByteArray>() << maxVert);
QTest::newRow("maxHoriz") << NET::Actions(NET::ActionMaxHoriz) << (QList<QByteArray>() << maxHoriz);
QTest::newRow("fullscreen") << NET::Actions(NET::ActionFullScreen) << (QList<QByteArray>() << fullscreen);
QTest::newRow("desktop") << NET::Actions(NET::ActionChangeDesktop) << (QList<QByteArray>() << desktop);
QTest::newRow("close") << NET::Actions(NET::ActionClose) << (QList<QByteArray>() << close);
QTest::newRow("none") << NET::Actions() << QList<QByteArray>();
QTest::newRow("all") << NET::Actions(NET::ActionMove |
NET::ActionResize |
NET::ActionMinimize |
NET::ActionShade |
NET::ActionStick |
NET::ActionMaxVert |
NET::ActionMaxHoriz |
NET::ActionFullScreen |
NET::ActionChangeDesktop |
NET::ActionClose)
<< (QList<QByteArray>() << move << resize << minimize << shade <<
stick << maxVert << maxHoriz <<
fullscreen << desktop << close);
}
void NetWinInfoTestWM::testAllowedActions()
{
QVERIFY(connection());
ATOM(_NET_WM_ALLOWED_ACTIONS)
INFO
QCOMPARE(info.allowedActions(), NET::Actions());
QFETCH(NET::Actions, actions);
info.setAllowedActions(actions);
QCOMPARE(info.allowedActions(), actions);
// compare with the X property
QFETCH(QList<QByteArray>, names);
QVERIFY(atom != XCB_ATOM_NONE);
GETPROP(XCB_ATOM_ATOM, names.size(), 32)
xcb_atom_t *atoms = reinterpret_cast<xcb_atom_t *>(xcb_get_property_value(reply.get()));
for (int i = 0; i < names.size(); ++i) {
QVERIFY(hasAtomFlag(atoms, names.size(), names.at(i)));
}
// and wait for our event
waitForPropertyChange(&info, atom, NET::Property(0), NET::WM2AllowedActions);
QCOMPARE(info.allowedActions(), actions);
}
void NetWinInfoTestWM::testDesktop_data()
{
QTest::addColumn<int>("desktop");
QTest::addColumn<uint32_t>("propertyDesktop");
QTest::newRow("1") << 1 << uint32_t(0);
QTest::newRow("4") << 4 << uint32_t(3);
QTest::newRow("on all") << int(NET::OnAllDesktops) << uint32_t(~0);
}
void NetWinInfoTestWM::testDesktop()
{
QVERIFY(connection());
ATOM(_NET_WM_DESKTOP)
INFO
QCOMPARE(info.desktop(), 0);
QFETCH(int, desktop);
info.setDesktop(desktop);
QCOMPARE(info.desktop(), desktop);
// compare with the X property
QVERIFY(atom != XCB_ATOM_NONE);
GETPROP(XCB_ATOM_CARDINAL, 1, 32)
QTEST(reinterpret_cast<uint32_t *>(xcb_get_property_value(reply.get()))[0], "propertyDesktop");
// and wait for our event
waitForPropertyChange(&info, atom, NET::WMDesktop);
QCOMPARE(info.desktop(), desktop);
// delete it
info.setDesktop(0);
QCOMPARE(info.desktop(), 0);
VERIFYDELETED(XCB_ATOM_CARDINAL)
// and wait for our event
waitForPropertyChange(&info, atom, NET::WMDesktop);
QCOMPARE(info.desktop(), 0);
}
void NetWinInfoTestWM::testStrut(xcb_atom_t atom, NETStrut(NETWinInfo:: *getter)(void)const, void (NETWinInfo:: *setter)(NETStrut), NET::Property property, NET::Property2 property2)
{
INFO
NETStrut extents = (info.*getter)();
QCOMPARE(extents.bottom, 0);
QCOMPARE(extents.left, 0);
QCOMPARE(extents.right, 0);
QCOMPARE(extents.top, 0);
NETStrut newExtents;
newExtents.bottom = 10;
newExtents.left = 20;
newExtents.right = 30;
newExtents.top = 40;
(info.*setter)(newExtents);
extents = (info.*getter)();
QCOMPARE(extents.bottom, newExtents.bottom);
QCOMPARE(extents.left, newExtents.left);
QCOMPARE(extents.right, newExtents.right);
QCOMPARE(extents.top, newExtents.top);
// compare with the X property
QVERIFY(atom != XCB_ATOM_NONE);
GETPROP(XCB_ATOM_CARDINAL, 4, 32)
uint32_t *data = reinterpret_cast<uint32_t *>(xcb_get_property_value(reply.get()));
QCOMPARE(data[0], uint32_t(newExtents.left));
QCOMPARE(data[1], uint32_t(newExtents.right));
QCOMPARE(data[2], uint32_t(newExtents.top));
QCOMPARE(data[3], uint32_t(newExtents.bottom));
// and wait for our event
waitForPropertyChange(&info, atom, property, property2);
extents = (info.*getter)();
QCOMPARE(extents.bottom, newExtents.bottom);
QCOMPARE(extents.left, newExtents.left);
QCOMPARE(extents.right, newExtents.right);
QCOMPARE(extents.top, newExtents.top);
}
void NetWinInfoTestWM::testFrameExtents()
{
QVERIFY(connection());
ATOM(_NET_FRAME_EXTENTS)
testStrut(atom, &NETWinInfo::frameExtents, &NETWinInfo::setFrameExtents, NET::WMFrameExtents);
}
void NetWinInfoTestWM::testFrameExtentsKDE()
{
// same as testFrameExtents just with a different atom name
QVERIFY(connection());
ATOM(_KDE_NET_WM_FRAME_STRUT)
testStrut(atom, &NETWinInfo::frameExtents, &NETWinInfo::setFrameExtents, NET::WMFrameExtents);
}
void NetWinInfoTestWM::testFrameOverlap()
{
QVERIFY(connection());
ATOM(_NET_WM_FRAME_OVERLAP)
testStrut(atom, &NETWinInfo::frameOverlap, &NETWinInfo::setFrameOverlap, NET::Property(0), NET::WM2FrameOverlap);
}
void NetWinInfoTestWM::testOpacity_data()
{
QTest::addColumn<uint32_t>("opacity");
QTest::newRow("0 %") << uint32_t(0);
QTest::newRow("50 %") << uint32_t(0x0000ffff);
QTest::newRow("100 %") << uint32_t(0xffffffff);
}
void NetWinInfoTestWM::testOpacity()
{
QVERIFY(connection());
ATOM(_NET_WM_WINDOW_OPACITY)
INFO
QCOMPARE(info.opacity(), static_cast<unsigned long>(0xffffffffU));
QFETCH(uint32_t, opacity);
info.setOpacity(opacity);
QCOMPARE(info.opacity(), static_cast<unsigned long>(opacity));
// compare with the X property
QVERIFY(atom != XCB_ATOM_NONE);
GETPROP(XCB_ATOM_CARDINAL, 1, 32)
QCOMPARE(reinterpret_cast<uint32_t *>(xcb_get_property_value(reply.get()))[0], opacity);
// and wait for our event
waitForPropertyChange(&info, atom, NET::Property(0), NET::WM2Opacity);
QCOMPARE(info.opacity(), static_cast<unsigned long>(opacity));
}
void NetWinInfoTestWM::testState_data()
{
QTest::addColumn<NET::States>("states");
QTest::addColumn<QList<QByteArray> >("names");
const QByteArray modal = QByteArrayLiteral("_NET_WM_STATE_MODAL");
const QByteArray sticky = QByteArrayLiteral("_NET_WM_STATE_STICKY");
const QByteArray maxVert = QByteArrayLiteral("_NET_WM_STATE_MAXIMIZED_VERT");
const QByteArray maxHoriz = QByteArrayLiteral("_NET_WM_STATE_MAXIMIZED_HORZ");
const QByteArray shaded = QByteArrayLiteral("_NET_WM_STATE_SHADED");
const QByteArray skipTaskbar = QByteArrayLiteral("_NET_WM_STATE_SKIP_TASKBAR");
const QByteArray skipSwitcher = QByteArrayLiteral("_KDE_NET_WM_STATE_SKIP_SWITCHER");
const QByteArray keepAbove = QByteArrayLiteral("_NET_WM_STATE_ABOVE");
const QByteArray staysOnTop = QByteArrayLiteral("_NET_WM_STATE_STAYS_ON_TOP");
const QByteArray skipPager = QByteArrayLiteral("_NET_WM_STATE_SKIP_PAGER");
const QByteArray hidden = QByteArrayLiteral("_NET_WM_STATE_HIDDEN");
const QByteArray fullScreen = QByteArrayLiteral("_NET_WM_STATE_FULLSCREEN");
const QByteArray keepBelow = QByteArrayLiteral("_NET_WM_STATE_BELOW");
const QByteArray demandsAttention = QByteArrayLiteral("_NET_WM_STATE_DEMANDS_ATTENTION");
const QByteArray focused = QByteArrayLiteral("_NET_WM_STATE_FOCUSED");
QTest::newRow("modal") << NET::States(NET::Modal) << (QList<QByteArray>() << modal);
QTest::newRow("sticky") << NET::States(NET::Sticky) << (QList<QByteArray>() << sticky);
QTest::newRow("maxVert") << NET::States(NET::MaxVert) << (QList<QByteArray>() << maxVert);
QTest::newRow("maxHoriz") << NET::States(NET::MaxHoriz) << (QList<QByteArray>() << maxHoriz);
QTest::newRow("shaded") << NET::States(NET::Shaded) << (QList<QByteArray>() << shaded);
QTest::newRow("skipTaskbar") << NET::States(NET::SkipTaskbar) << (QList<QByteArray>() << skipTaskbar);
QTest::newRow("keepAbove") << NET::States(NET::KeepAbove) << (QList<QByteArray>() << keepAbove << staysOnTop);
QTest::newRow("skipPager") << NET::States(NET::SkipPager) << (QList<QByteArray>() << skipPager);
QTest::newRow("hidden") << NET::States(NET::Hidden) << (QList<QByteArray>() << hidden);
QTest::newRow("fullScreen") << NET::States(NET::FullScreen) << (QList<QByteArray>() << fullScreen);
QTest::newRow("keepBelow") << NET::States(NET::KeepBelow) << (QList<QByteArray>() << keepBelow);
QTest::newRow("demandsAttention") << NET::States(NET::DemandsAttention) << (QList<QByteArray>() << demandsAttention);
QTest::newRow("skipSwitcher") << NET::States(NET::SkipSwitcher) << (QList<QByteArray>() << skipSwitcher);
QTest::newRow("focused") << NET::States(NET::Focused) << (QList<QByteArray>() << focused);
// TODO: it's possible to be keep above and below at the same time?!?
QTest::newRow("all") << NET::States(NET::Modal |
NET::Sticky |
NET::Max |
NET::Shaded |
NET::SkipTaskbar |
NET::SkipPager |
NET::KeepAbove |
NET::KeepBelow |
NET::Hidden |
NET::FullScreen |
NET::DemandsAttention |
NET::SkipSwitcher |
NET::Focused)
<< (QList<QByteArray>() << modal << sticky << maxVert << maxHoriz
<< shaded << skipTaskbar << keepAbove
<< skipPager << hidden << fullScreen
<< keepBelow << demandsAttention << staysOnTop << skipSwitcher << focused);
}
void NetWinInfoTestWM::testState()
{
QVERIFY(connection());
ATOM(_NET_WM_STATE)
INFO
QCOMPARE(info.state(), NET::States());
QFETCH(NET::States, states);
info.setState(states, NET::States());
QCOMPARE(info.state(), states);
// compare with the X property
QFETCH(QList<QByteArray>, names);
QVERIFY(atom != XCB_ATOM_NONE);
GETPROP(XCB_ATOM_ATOM, names.size(), 32)
xcb_atom_t *atoms = reinterpret_cast<xcb_atom_t *>(xcb_get_property_value(reply.get()));
for (int i = 0; i < names.size(); ++i) {
QVERIFY(hasAtomFlag(atoms, names.size(), names.at(i)));
}
// and wait for our event
waitForPropertyChange(&info, atom, NET::WMState);
QCOMPARE(info.state(), states);
}
void NetWinInfoTestWM::testVisibleIconName()
{
QVERIFY(connection());
ATOM(_NET_WM_VISIBLE_ICON_NAME)
UTF8
INFO
QVERIFY(!info.visibleIconName());
info.setVisibleIconName("foo");
QCOMPARE(info.visibleIconName(), "foo");
// compare with the X property
QVERIFY(atom != XCB_ATOM_NONE);
QVERIFY(utf8String != XCB_ATOM_NONE);
GETPROP(utf8String, 3, 8)
QCOMPARE(reinterpret_cast<const char *>(xcb_get_property_value(reply.get())), "foo");
// and wait for our event
waitForPropertyChange(&info, atom, NET::WMVisibleIconName);
QCOMPARE(info.visibleIconName(), "foo");
// delete the string
info.setVisibleIconName("");
QCOMPARE(info.visibleIconName(), "");
VERIFYDELETED(utf8String)
// and wait for our event
waitForPropertyChange(&info, atom, NET::WMVisibleIconName);
QVERIFY(!info.visibleIconName());
// set again, to ensure we don't leak on tear down
info.setVisibleIconName("bar");
xcb_flush(connection());
waitForPropertyChange(&info, atom, NET::WMVisibleIconName);
QCOMPARE(info.visibleIconName(), "bar");
}
void NetWinInfoTestWM::testVisibleName()
{
QVERIFY(connection());
ATOM(_NET_WM_VISIBLE_NAME)
UTF8
INFO
QVERIFY(!info.visibleName());
info.setVisibleName("foo");
QCOMPARE(info.visibleName(), "foo");
// compare with the X property
QVERIFY(atom != XCB_ATOM_NONE);
QVERIFY(utf8String != XCB_ATOM_NONE);
GETPROP(utf8String, 3, 8)
QCOMPARE(reinterpret_cast<const char *>(xcb_get_property_value(reply.get())), "foo");
// and wait for our event
waitForPropertyChange(&info, atom, NET::WMVisibleName);
QCOMPARE(info.visibleName(), "foo");
// delete the string
info.setVisibleName("");
QCOMPARE(info.visibleName(), "");
VERIFYDELETED(utf8String)
// and wait for our event
waitForPropertyChange(&info, atom, NET::WMVisibleName);
QVERIFY(!info.visibleName());
// set again, to ensure we don't leak on tear down
info.setVisibleName("bar");
xcb_flush(connection());
waitForPropertyChange(&info, atom, NET::WMVisibleName);
QCOMPARE(info.visibleName(), "bar");
}
class MockWinInfo : public NETWinInfo
{
public:
MockWinInfo(xcb_connection_t *connection, xcb_window_t window, xcb_window_t rootWindow)
: NETWinInfo(connection, window, rootWindow, NET::WMAllProperties, NET::WM2AllProperties, NET::WindowManager)
{
}
protected:
void changeFullscreenMonitors(NETFullscreenMonitors topology) override
{
setFullscreenMonitors(topology);
}
};
void NetWinInfoTestWM::testFullscreenMonitors()
{
// test case for BUG 391960
QVERIFY(connection());
const uint32_t maskValues[] = {
XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
XCB_EVENT_MASK_KEY_PRESS |
XCB_EVENT_MASK_PROPERTY_CHANGE |
XCB_EVENT_MASK_COLOR_MAP_CHANGE |
XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |
XCB_EVENT_MASK_FOCUS_CHANGE | // For NotifyDetailNone
XCB_EVENT_MASK_EXPOSURE
};
UniqueCPointer<xcb_generic_error_t> redirectCheck(xcb_request_check(connection(), xcb_change_window_attributes_checked(connection(),
m_rootWindow, XCB_CW_EVENT_MASK, maskValues)));
QVERIFY(!redirectCheck);
KXUtils::Atom atom(connection(), QByteArrayLiteral("_NET_WM_FULLSCREEN_MONITORS"));
// create client connection
auto clientConnection = xcb_connect(m_displayNumber.constData(), nullptr);
QVERIFY(clientConnection);
QVERIFY(!xcb_connection_has_error(clientConnection));
NETWinInfo clientInfo(clientConnection, m_testWindow, m_rootWindow, NET::WMAllProperties, NET::WM2AllProperties);
NETFullscreenMonitors topology;
topology.top = 1;
topology.bottom = 2;
topology.left = 3;
topology.right = 4;
clientInfo.setFullscreenMonitors(topology);
xcb_flush(clientConnection);
MockWinInfo info(connection(), m_testWindow, m_rootWindow);
while (true) {
UniqueCPointer<xcb_generic_event_t> event(xcb_wait_for_event(connection()));
if (!event) {
break;
}
if ((event->response_type & ~0x80) != XCB_CLIENT_MESSAGE) {
continue;
}
NET::Properties dirtyProtocols;
NET::Properties2 dirtyProtocols2;
QCOMPARE(info.fullscreenMonitors().isSet(), false);
info.event(event.get(), &dirtyProtocols, &dirtyProtocols2);
QCOMPARE(info.fullscreenMonitors().isSet(), true);
break;
}
xcb_flush(connection());
// now the property should be updated
waitForPropertyChange(&info, atom, NET::Property(0), NET::WM2FullscreenMonitors);
QCOMPARE(info.fullscreenMonitors().top, 1);
QCOMPARE(info.fullscreenMonitors().bottom, 2);
QCOMPARE(info.fullscreenMonitors().left, 3);
QCOMPARE(info.fullscreenMonitors().right, 4);
xcb_disconnect(clientConnection);
}
QTEST_GUILESS_MAIN(NetWinInfoTestWM)
#include "netwininfotestwm.moc"
@@ -0,0 +1,11 @@
### KApiDox Project-specific Overrides File
# Define this so that X11-specific classes are parsed by Doxygen
# and that deprecated API is not skipped
PREDEFINED += KWINDOWSYSTEM_HAVE_X11 \
"KWINDOWSYSTEM_ENABLE_DEPRECATED_SINCE(x, y)=1" \
"KWINDOWSYSTEM_BUILD_DEPRECATED_SINCE(x, y)=1" \
"KWINDOWSYSTEM_DEPRECATED_VERSION(x, y, t)=" \
"KWINDOWSYSTEM_DEPRECATED_VERSION_BELATED(x, y, xt, yt, t)=" \
"KWINDOWSYSTEM_ENUMERATOR_DEPRECATED_VERSION(x, y, t)=" \
"KWINDOWSYSTEM_ENUMERATOR_DEPRECATED_VERSION_BELATED(x, y, xt, yt, t)="
@@ -0,0 +1,279 @@
Application startup notification
Lubos Lunak <l.lunak@kde.org>
--------------------------------
--------------------------------
When a new application is started in KDE, together with it a startup
notification is sent, which is used to show a startup entry in taskbar,
the busy icon next to the cursor and put the window of the started app
on correct desktop.
This application startup notification ( ASN for short in the following
text ) usually works fine without problems, but some applications and
some special cases may need special handling.
Right now, this is only an internal KDE standard, but since a toolkit
support would improve the results a bit, I'll try to discuss this
on http://www.freedesktop.org .
Starting apps with ASN :
-------------------------
When an application is started from the K-Menu or the minicli, and from other
places, ASN is sent automatically for it, assuming a matching .desktop file
is found for the starting application. Application without a .desktop file
don't get ASN ( this may change, but it's unlikely as it creates too many
ASNs which will stay too long until a timeout ). For improving the quality
of ASN and reducing the number of ASNs that don't detect when the application
has started, some .desktop file entries may be helpful ( see below ).
If you want to start an application in your code, prefer using KRun or
KApplication::startServiceByXXX() calls. Classes like KProcess don't create
ASN, so if you need to use it, you have to send it manually ( only in case
ASN is useful in this case, it shouldn't be sent e.g. for system processes ).
.desktop files :
-----------------
These following .desktop file entries affect ASN :
X-KDE-StartupNotify=<bool>
- if true, this app/service will get app startup notify
- if false, this app/service will _not_ get app startup notify
- if not set
- if it's service, it will _not_ get app startup notify
- if it's app, it will get app startup notify, but
X-KDE-WMClass will be assumed to be "0" ( non-compliant )
X-KDE-WMClass=<string>
- if set, and it's different from "0" ( without quotes ), this
is the WMClass value for startup notification
- if it's "0" ( without quotes ), such app is considered non-compliant,
and the startup notification will stop
- either if its windows is correctly detected using the default
WMClass value ( the name of the binary )
- or if a window is mapped that is not recognized ( doesn't have
neither _KDE_STARTUP_ID nor _NET_WM_PID property /*CHECKME*/),
it's assumed this window belongs to the started app;
the start-on-desktop feature won't work then too
- if not set, it defaults to the binary name of the app ( ok for most apps,
including KDE ones )
- to get the WMCLASS value for any app, run 'xprop' and click on the app's
window, WMCLASS value for this app should be any of the strings listed
in the WM_CLASS property ( it's usually the same as the name of the
app's binary file, in such case it doesn't need to be explicitly set )
MapNotify=<bool>
- this key is obsolete
- true is equivalent to X-KDE-StartupNotify=true and no X-KDE-WMClass set
- false is equivalent to X-KDE-StartupNotify=true and X-KDE-WMClass=0
- many .desktop files in KDE ( especially in kdebase/kappfinder )
seem to have MapNotify=false even though it's not needed, this
needs to be checked and replaced by the needed X-KDE-* values,
often just X-KDE-StartupNotify=true should be enough
The best way to check if the entries are set correctly is to start
the application and switch to other desktop. If the startup notification
disappears and the application appears on the desktop on which it was
started, it's correct ( with X-KDE-WMClass=0, the start-on-desktop
feature may not work ).
Ideally, every .desktop file should have X-KDE-StartupNotify set to the correct
value, and for apps which need it also X-KDE-WMClass should be set. This
sometimes gives slightly better behavior than when these entries are not set.
The KStartupInfo classes :
--------------------------
In some cases, or if you are interested in getting the ASN information, you
have to use the KStartupInfo classes in kdelibs/kdecore.
Receiving the application startup notification information :
------------------------------------------------------------
Create an instance of class KStartupInfo and connect to its slots, they
will be emitted whenever a ASN info is received.
The clean_on_cantdetect argument to the constructor means whether all
ASN info for non-compliant apps should be removed when a window is mapped
which cannot be identified ( it's not possible to say if it belong to one
of the starting applications or not ). If the argument is true, it is
assumed that the window does belong to one of the starting applications,
and all ASN info for non-compliant apps must be removed, otherwise the ASN
info would timeout ( e.g. kdesktop sets it to true, otherwise the busy
icon would sometimes stay for too long, which is oftern annoying ).
On the other hand, KWin, which maps the first window of the starting apps
to the given virtual desktop, sets it to false, because there's no visual
representation and if a window for a starting non-compliant application is
detected later, it still will be successfully places on the correct virtual
desktop.
Note that the ASN info is often send in several messages, and the slots
will be therefore emitted several times, with the updated info ( e.g. the
binary name or PID is not know from the beginning ).
Sending the application startup notification information :
----------------------------------------------------------
Before an application is started, ASN info for it must be sent ( unless
it's done by classes like KRun ). See e.g. KRun sources for details.
During the starting of the application, the info may need some updating
( e.g. right after starting the app, the PID with hostname may be sent,
or a PID change when KUniqueApplication forks into background ).
When it's detected that the started process exited, it an ASN info
about the finished process should be sent. Since the application may
have forked into background, the finish info should include the PID
and hostname, and the notification will be stopped only if there's
no other PID for it. On the other hand, if you simply really need
to stop ASN, send only the identification ( KStartupInfo::sendFinish()
with only KStartupInfoId argument ).
Implementation details :
------------------------
The ASN info data is sent using X ClientMessages as text ( see below ),
this is mainly in hope also non-KDE people will start using it, and
they wouldn't be very happy with DCOP.
Before starting an application, and environment variable called
KDE_STARTUP_ENV is added to it's environment, and it's set to unique
identifier of its startup notification, or "0" for disabled ASN.
Ideally, the application should read it, and set a window property
called _KDE_STARTUP_ID ( type XA_STRING ) at least on its first mapped
toplevel window to this value. It should also unset it, so it doesn't get
propagated to other applications started from it. It should also
update the ASN info when necessary, e.g. when KUniqueApplication
forks into background, it sends the PID change. That's how compliant
applications should work, and this support for ASN should be provided
by toolkits. All KDE application should be compliant by now, since
kdelibs do all the necessary things. The KDE_STARTUP_ENV variable
is read and unset in KApplication constructor, and _KDE_STARTUP_ID
is set on every toplevel window in KApplication::setTopWidget().
However, majority of applications aren't compliant now, and even
if I succeed making this thing a standard ( part of NETWM_SPEC
or whatever ), there still will be old applications that won't behave
this way. Not unsetting KDE_STARTUP_ENV is not a big problem, since
the ASN for its value will usually timeout, and when the app starts
a new application, this ASN identification value will get reused without
problems. The other problem is detecting, which newly mapped windows
belong to which starting application. If a newly mapped window doesn't
have _KDE_STARTUP_ID property, the code tries to read its _NET_WM_PID
property, and if it's set, it tries to match it ( together with
WM_CLIENT_MACHINE ) with PIDs of all ASN infos. And if the window
doesn't have even the _NET_WM_PID property, WM_CLASS property is used
then. It's usually set to two strings, and at least one of them is
usually the binary name of the application, so it's converted
to lowercase and compared. For applications, where such comparison
would fail, the X-KDE-WMClass .desktop file entry should be set
to the correct WMClass value ( e.g. for XEmacs, the binary name
is 'xemacs', but WM_CLASS is 'emacs', 'Emacs', so its X-KDE-WMClass
in its .desktop file should be set to 'emacs' - the case doesn't
matter ).
The ASN identification string must be a unique string for every ASN.
In KStartupInfo class, it's created as 'hostname;tm.sec;tm.usec;pid',
tm being the current time. If the identification string is set to "0",
it means no ASN should be done ( e.g. for things like kio_uiserver,
which shouldn't get ASN ). Empty identification string means the same
like "0", except for the call to KStartupInfoId::initId(), where it means
to create a new one.
Format of the text messages :
-----------------------------
There are 3 types of messages :
- new: message
- this message announces that a new application is being started,
if there is not ASN info for this ASN identification, it should be
updated, otherwise it will be created
- the text of the message starts with 4 characters 'new:', followed
by the text entries ( see below )
- change: message
- this message is like new: message, but it's only for updating existing
ASN info, if there's no ASN info for the given identification, it won't
be created. This is used e.g. in KUniqueApplication when it forks
into background and sends info about the PID change - it should update
any existing ASN info, but mustn't create a new one, otherwise there
could appear ASN even for applications which shouldn't have ASN
- the text of the message starts with 4 characters 'change:', followed
by the text entries ( see below )
- remove: message
- this message is sent for stopping ASN with the given identification.
If the only item in the message is the identification string, the ASN
info should be removed. If there are also the PID and HOSTNAME entries
( see below ), the matching ASN info should be only removed if this
given PID is the only PID for it ( in this case, the identification
string may be omitted ).
- the text of the message starts with 4 characters 'remove:', followed
by
- only ID entry
- only ID, PID and HOSTNAME entries
- only PID and HOSTNAME entries
Text entries in the messages :
------------------------------
Every entry is of the form <name>=<value>. Value may be either a number
or a string. If the string contains spaces, it must be quoted ("), all
backslashes and quotes (") must be escaped by backslashes. If this ever
becomes more than an internal KDE standard, non-standard entry names should
start with an underscore.
Entries :
- ID - string
- the identification string of the startup notification
- it must be present in all messages except for the remove:
message with only PID and HOSTNAME
- BIN - string
- the binary name of the starting application
- usually used as a fallback value if WMCLASS is not present
- e.g. 'kcontrol'
- NAME - string
- the name of the starting application
- usually used only for displaying it when indicating that
the application is starting
- e.g. 'Control Center'
- ICON - string
- the icon for this startup notification
- it should be handled like the Icon= entry in .desktop files
- e.g. 'kcontrol'
- DESKTOP - number
- the virtual desktop on which the application should appear
- if the application's first window has _NET_WM_DESKTOP already
set when the window is mapped, it shouldn't be changed
- WMCLASS - string
- the WMCLASS value used for matching newly mapped windows
of non-compliant applications
- useful only if it's different from the binary
name of the application
- PID - number
- the PID of a process that belongs to this startup notification
- there may be several PIDs for one notification
- value 0 is also valid, meaning that there's a process
with unknown PID for this notification ( is used e.g.
by kfmclient when it sends a DCOP message to already running
konqueror instance to create a new window and exits immediately,
without adding the zero PID to the notification, process
that started kfmclient could detect it exited and would send
a remove: message for the notification with kfmclient's PID,
which would cause the notification to stop if there wasn't also
PID=0 for it
- HOSTNAME - string
- the hostname of the machine on which the application is being
started
- this is used together with the PID entry
--------------------
Well, I guess that's all. The KDE2.2 release will show if the users like it
or not ( it's quite good IMHO, even though there are probably some minor
details to fix or improve ). The only big thing remaining is to make also
non-KDE people agree on using something like this. My first attempt
https://listman.redhat.com/pipermail/xdg-list/2001-May/000083.html
didn't get much attention, but now that there's a working implementation,
I hope it will get better, when I try again sometime in the future.
Lubos Lunak <l.lunak@kde.org>
@@ -0,0 +1,25 @@
maintainer:
description: Access to the windowing system
tier: 1
type: integration
platforms:
- name: Linux
note: Only platform X11 is supported
- name: FreeBSD
note: Only platform X11 is supported
- name: macOS
note: Not all features supported
- name: Windows
note: Not all features supported
- name: Android
note: Porting aid, not functional
portingAid: false
deprecated: false
release: true
libraries:
- cmake: "KF6::WindowSystem"
cmakename: KF6WindowSystem
public_lib: true
group: Frameworks
subgroup: Tier 1
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,22 @@
# Safa Alfulaij <safa1996alfulaij@gmail.com>, 2014.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-06-28 15:38+0300\n"
"PO-Revision-Date: 2014-05-05 17:40+0300\n"
"Last-Translator: Safa Alfulaij <safa1996alfulaij@gmail.com>\n"
"Language-Team: Arabic <kde-i18n-doc@kde.org>\n"
"Language: ar\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
"X-Qt-Contexts: true\n"
#: kx11extras.cpp:994
#, qt-format
msgctxt "KWindowSystem|"
msgid "Desktop %1"
msgstr "سطح المكتب %1"
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,20 @@
# Enol P. <enolp@softastur.org>, 2023.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"PO-Revision-Date: 2023-05-01 23:47+0200\n"
"Last-Translator: Enol P. <enolp@softastur.org>\n"
"Language-Team: \n"
"Language: ast\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Qt-Contexts: true\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Lokalize 23.04.0\n"
#: kx11extras.cpp:994
#, qt-format
msgctxt "KWindowSystem|"
msgid "Desktop %1"
msgstr "Escritoriu %1"
@@ -0,0 +1,20 @@
# Xəyyam <xxmn77@gmail.com>, 2020.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"PO-Revision-Date: 2020-04-26 00:12+0400\n"
"Last-Translator: Xəyyam <xxmn77@gmail.com>\n"
"Language-Team: Azerbaijani <kde-i18n-doc@kde.org>\n"
"Language: az\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Qt-Contexts: true\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Lokalize 19.12.3\n"
#: kx11extras.cpp:994
#, qt-format
msgctxt "KWindowSystem|"
msgid "Desktop %1"
msgstr "Masaüstü %1"
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,26 @@
# Copyright (C) YEAR This_file_is_part_of_KDE
# This file is distributed under the same license as the PACKAGE package.
#
# Zlatko Popov <zlatkopopov@fsa-bg.org>, 2006, 2007, 2008, 2009.
# Yasen Pramatarov <yasen@lindeas.com>, 2009, 2010, 2011, 2012, 2013, 2021.
msgid ""
msgstr ""
"Project-Id-Version: kdelibs4\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2014-03-23 01:50+0000\n"
"PO-Revision-Date: 2021-01-06 17:38+0200\n"
"Last-Translator: Yasen Pramatarov <yasen@lindeas.com>\n"
"Language-Team: Bulgarian <dict@ludost.net>\n"
"Language: bg\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Lokalize 20.08.2\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Qt-Contexts: true\n"
#: kx11extras.cpp:994
#, qt-format
msgctxt "KWindowSystem|"
msgid "Desktop %1"
msgstr "Работен плот %1"
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,20 @@
msgid ""
msgstr ""
"Project-Id-Version: kde5\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2015-02-24 19:46+0100\n"
"Last-Translator: Samir Ribić <megaribi@epn.ba>\n"
"Language-Team: Bosnian\n"
"Language: bs\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Qt-Contexts: true\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
#: kx11extras.cpp:994
#, qt-format
msgctxt "KWindowSystem|"
msgid "Desktop %1"
msgstr "Površ %1"
@@ -0,0 +1,33 @@
# Translation of kwindowsystem6_qt.po to Catalan
# Copyright (C) 1998-2014 This_file_is_part_of_KDE
# This file is distributed under the license LGPL version 2.1 or
# version 3 or later versions approved by the membership of KDE e.V.
#
# Sebastià Pla i Sanz <sps@sastia.com>, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007.
# Antoni Bella Pérez <antonibella5@yahoo.com>, 2003, 2006, 2011, 2012, 2013.
# Albert Astals Cid <aacid@kde.org>, 2004, 2005, 2007.
# Josep M. Ferrer <txemaq@gmail.com>, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014.
# Robert Millan <rmh@aybabtu.com>, 2009.
# Orestes Mas <orestes@tsc.upc.edu>, 2010.
msgid ""
msgstr ""
"Project-Id-Version: kwindowsystem\n"
"Report-Msgid-Bugs-To: https://bugs.kde.org\n"
"POT-Creation-Date: 2014-03-23 01:50+0000\n"
"PO-Revision-Date: 2014-03-30 16:32+0200\n"
"Last-Translator: Josep M. Ferrer <txemaq@gmail.com>\n"
"Language-Team: Catalan <kde-i18n-ca@kde.org>\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Lokalize 1.4\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Accelerator-Marker: &\n"
"X-Qt-Contexts: true\n"
#: kx11extras.cpp:994
#, qt-format
msgctxt "KWindowSystem|"
msgid "Desktop %1"
msgstr "Escriptori %1"
@@ -0,0 +1,33 @@
# Translation of kwindowsystem6_qt.po to Catalan (Valencian)
# Copyright (C) 1998-2014 This_file_is_part_of_KDE
# This file is distributed under the license LGPL version 2.1 or
# version 3 or later versions approved by the membership of KDE e.V.
#
# Sebastià Pla i Sanz <sps@sastia.com>, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007.
# Antoni Bella Pérez <antonibella5@yahoo.com>, 2003, 2006, 2011, 2012, 2013.
# Albert Astals Cid <aacid@kde.org>, 2004, 2005, 2007.
# Josep M. Ferrer <txemaq@gmail.com>, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014.
# Robert Millan <rmh@aybabtu.com>, 2009.
# Orestes Mas <orestes@tsc.upc.edu>, 2010.
msgid ""
msgstr ""
"Project-Id-Version: kwindowsystem\n"
"Report-Msgid-Bugs-To: https://bugs.kde.org\n"
"POT-Creation-Date: 2014-03-23 01:50+0000\n"
"PO-Revision-Date: 2014-03-30 16:32+0200\n"
"Last-Translator: Josep M. Ferrer <txemaq@gmail.com>\n"
"Language-Team: Catalan <kde-i18n-ca@kde.org>\n"
"Language: ca@valencia\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Lokalize 1.4\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Accelerator-Marker: &\n"
"X-Qt-Contexts: true\n"
#: kx11extras.cpp:994
#, qt-format
msgctxt "KWindowSystem|"
msgid "Desktop %1"
msgstr "Escriptori %1"
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,29 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# Lukáš Tinkl <lukas@kde.org>, 2010, 2011, 2012.
# Vít Pelčák <vit@pelcak.org>, 2011, 2012, 2013, 2014, 2015.
# Tomáš Chvátal <tomas.chvatal@gmail.com>, 2012, 2013.
#
msgid ""
msgstr ""
"Project-Id-Version: kdelibs4\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2014-03-23 01:50+0000\n"
"PO-Revision-Date: 2014-04-02 13:20+0200\n"
"Last-Translator: Vít Pelčák <vit@pelcak.org>\n"
"Language-Team: American English <kde-i18n-doc@kde.org>\n"
"Language: cs\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
"X-Generator: Lokalize 1.5\n"
"X-Language: cs_CZ\n"
"X-Source-Language: en_US\n"
"X-Qt-Contexts: true\n"
#: kx11extras.cpp:994
#, qt-format
msgctxt "KWindowSystem|"
msgid "Desktop %1"
msgstr "Plocha %1"
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,34 @@
# translation of kwindowsystem6_qt.pot to Esperanto
# Esperantaj mesaĝoj por "kwindowsystem"
# Copyright (C) 1998,2002, 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
# Wolfram Diestel <wolfram@steloj.de>, 1998.
# Heiko Evermann <heiko@evermann.de>, 2002, 2003.
# Matthias Peick <matthias@peick.de>, 2004, 2005.
# Oliver Kellogg <olivermkellogg@gmail.com>,2007.
# Cindy McKee <cfmckee@gmail.com>, 2007, 2008.
# Axel Rousseau <axel@esperanto-jeunes.org>, 2009.
# Michael Moroni <michael.moroni@mailoo.org>, 2012.
#
# Minuskloj: ĉ ĝ ĵ ĥ ŝ ŭ Majuskloj: Ĉ Ĝ Ĵ Ĥ Ŝ Ŭ
#
msgid ""
msgstr ""
"Project-Id-Version: kwindowsystem\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2014-03-23 01:50+0000\n"
"PO-Revision-Date: 2023-03-29 20:54+0100\n"
"Last-Translator: Oliver Kellogg <olivermkellogg@gmail.com>\n"
"Language-Team: Esperanto <kde-i18n-eo@kde.org>\n"
"Language: eo\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Lokalize 1.4\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Qt-Contexts: true\n"
#: kx11extras.cpp:994
#, qt-format
msgctxt "KWindowSystem|"
msgid "Desktop %1"
msgstr "Labortablo %1"
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,22 @@
# GunChleoc <fios@foramnagaidhlig.net>, 2014.
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2015-11-04 15:14+0000\n"
"Last-Translator: Michael Bauer <fios@akerbeltz.org>\n"
"Language-Team: Fòram na Gàidhlig\n"
"Language: gd\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : "
"(n > 2 && n < 20) ? 2 : 3;\n"
"X-Generator: Poedit 1.8.4\n"
"X-Qt-Contexts: true\n"
#: kx11extras.cpp:994
#, qt-format
msgctxt "KWindowSystem|"
msgid "Desktop %1"
msgstr "Deasg %1"
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,671 @@
# Hausa translation for kdelibs strings.
# Copyright 2009 Adriaan de Groot, Mustapha Abubakar, Ibrahim Dasuna
# This file is distributed under the same license as the kdelibs package.
#
# Adriaan de Groot <groot@kde.org>, 2009.
msgid ""
msgstr ""
"Project-Id-Version: kdelibs4\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2014-03-23 01:50+0000\n"
"PO-Revision-Date: 2009-03-17 11:22+0100\n"
"Last-Translator: Adriaan de Groot <groot@kde.org>\n"
"Language-Team: Hausa <kde-i18n-doc@lists.kde.org>\n"
"Language: ha\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Lokalize 0.2\n"
"X-Qt-Contexts: true\n"
#: kx11extras.cpp:994
#, qt-format
msgctxt "KWindowSystem|"
msgid "Desktop %1"
msgstr ""
#, fuzzy
#~ msgctxt "KKeyServer|"
#~ msgid "Stop"
#~ msgstr "Tsaya"
#~ msgctxt "NAME OF TRANSLATORS"
#~ msgid "Your names"
#~ msgstr "Mustapha Abubakar,Adriaan de Groot,Ibrahim Dasuna"
#~ msgctxt "EMAIL OF TRANSLATORS"
#~ msgid "Your emails"
#~ msgstr ",groot@kde.org,"
#~ msgid "&About"
#~ msgstr "&Game da"
#~ msgid "A&uthor"
#~ msgstr "&Mawallafi"
#~ msgid "A&uthors"
#~ msgstr "&Mawallafa"
#~ msgid ""
#~ "Please use <a href=\"http://bugs.kde.org\">http://bugs.kde.org</a> to "
#~ "report bugs.\n"
#~ msgstr ""
#~ "Yi amfani da <a href=\"http://bugs.kde.org\">http://bugs.kde.org</a> "
#~ "domin sanar da matsaloli.\n"
#~ msgid "Please report bugs to <a href=\"mailto:%1\">%2</a>.\n"
#~ msgstr "Sanar da matsaloli ga <a href=\"mailto:%1\">%2</a>.\n"
#~ msgid "&Thanks To"
#~ msgstr "G&odiya ga"
#~ msgid "T&ranslation"
#~ msgstr "Ma&ffassara"
#~ msgid "&License Agreement"
#~ msgstr "Yarjejeniyar &lasisi"
#~ msgid "Author"
#~ msgstr "Mawallafi"
#~ msgid "Other Contributors:"
#~ msgstr "Sauran mataimaka:"
#~ msgid "About %1"
#~ msgstr "Bayani akan %1"
#~ msgid "&Language:"
#~ msgstr "&Yare:"
#~ msgid "am"
#~ msgstr "safe"
#~ msgid "pm"
#~ msgstr "yamma"
#~ msgid "Today"
#~ msgstr "Yau"
#~ msgid "Yesterday"
#~ msgstr "Jiya"
#~ msgid "KDE Daemon"
#~ msgstr "KDE Fatalwa"
#~ msgctxt "show help"
#~ msgid "&Help"
#~ msgstr "&Agaji"
#, fuzzy
#~ msgid "Create new document"
#~ msgstr "Rufe wannan -dokumen-"
#, fuzzy
#~ msgid "Save document"
#~ msgstr "&Rufe -dokumen-"
#~ msgid "&Close"
#~ msgstr "&Rufe"
#, fuzzy
#~ msgid "Close document"
#~ msgstr "&Rufe -dokumen-"
#, fuzzy
#~ msgid "Print document"
#~ msgstr "&Rufe -dokumen-"
#~ msgid "Configure &Notifications..."
#~ msgstr "Haɗawa &Sanerwa"
#~ msgid "&About %1"
#~ msgstr "&Bayani akan %1"
#~ msgid "About &KDE"
#~ msgstr "Bayani akan &KDE"
#~ msgid "License Agreement"
#~ msgstr "Yarjejeniyar lasisi"
#, fuzzy
#~ msgctxt "Action to send an email to a contributor"
#~ msgid "Email contributor"
#~ msgstr "Sauran mataimaka:"
#, fuzzy
#~ msgctxt "Action to send an email to a contributor"
#~ msgid ""
#~ "Email contributor\n"
#~ "%1"
#~ msgstr "Sauran mataimaka:"
#~ msgctxt "@item Contributor name in about dialog."
#~ msgid "%1"
#~ msgstr "%1"
#~ msgid "About KDE"
#~ msgstr "Bayani akan KDE"
#~ msgctxt "About KDE"
#~ msgid "&About"
#~ msgstr "&Game da"
#~ msgid "&Join KDE"
#~ msgstr "&Tarayya da KDE"
#~ msgid "&Support KDE"
#~ msgstr "&Temakama KDE"
#~ msgctxt "Email sender address"
#~ msgid "From:"
#~ msgstr "Daga:"
#~ msgid "Configure Email..."
#~ msgstr "Haɗawa wasikan lantarki"
#~ msgctxt "Email receiver address"
#~ msgid "To:"
#~ msgstr "Zuwa:"
#~ msgid "&Send"
#~ msgstr "&Aika"
#~ msgid "Send bug report."
#~ msgstr "Aika bayanin matsala."
#~ msgid "Send this bug report to %1."
#~ msgstr "Aika wannan bayanin matsala zuwa %1."
#~ msgid "OS:"
#~ msgstr "Tsarin budanarwa:"
#~ msgid "Compiler:"
#~ msgstr "Mehadawa:"
#~ msgid "Se&verity"
#~ msgstr "Mahimmanchi"
#~ msgid "Critical"
#~ msgstr "Tsanani"
#~ msgid "Grave"
#~ msgstr "Mantikar Tsanani"
#~ msgctxt "normal severity"
#~ msgid "Normal"
#~ msgstr "Matsala"
#~ msgid "Wishlist"
#~ msgstr "Abinda zan so"
#~ msgid "Translation"
#~ msgstr "Fassara"
#~ msgid "S&ubject: "
#~ msgstr "Abinda wasika yerkoni tsa"
#~ msgid "Configure"
#~ msgstr "Haɗawa"
#~ msgid "1"
#~ msgstr "1"
#~ msgid "6"
#~ msgstr "6"
#~ msgid "2"
#~ msgstr "2"
#~ msgid "9"
#~ msgstr "9"
#~ msgid "4"
#~ msgstr "4"
#~ msgid "16"
#~ msgstr "16"
#~ msgctxt "@action:button filter-yes"
#~ msgid "%1"
#~ msgstr "%1"
#~ msgctxt "@action:button filter-no"
#~ msgid "%1"
#~ msgstr "%1"
#~ msgctxt "@action:button filter-continue"
#~ msgid "%1"
#~ msgstr "%1"
#~ msgctxt "@action:button filter-cancel"
#~ msgid "%1"
#~ msgstr "%1"
#~ msgctxt "@action:button post-filter"
#~ msgid "."
#~ msgstr "."
#~ msgid "Question"
#~ msgstr "Tambaya"
#~ msgid "Information"
#~ msgstr "Bayani"
#~ msgid "Password:"
#~ msgstr "Harrufan sirri:"
#~ msgid "Username:"
#~ msgstr "Sunan shiga:"
#~ msgid "Action"
#~ msgstr "Aiki"
#~ msgid "Shortcut"
#~ msgstr "Gajeran hanya"
#~ msgid "Alternate"
#~ msgstr "Wata gajeran hanya"
#~ msgctxt "@item:intable Action name in shortcuts configuration"
#~ msgid "%1"
#~ msgstr "%1"
#~ msgid "Remove"
#~ msgstr "Cire"
#~ msgctxt "@action:button"
#~ msgid "Close"
#~ msgstr "Rufe"
#~ msgctxt "@action"
#~ msgid "Close"
#~ msgstr "Rufe"
#~ msgctxt "@action"
#~ msgid "Help"
#~ msgstr "Agaji"
#~ msgctxt "@action"
#~ msgid "Configure Notifications"
#~ msgstr "Haɗawa Sanerwa"
#~ msgctxt "@action"
#~ msgid "About KDE"
#~ msgstr "Bayani akan KDE"
#~ msgid "Default language:"
#~ msgstr "Yaren farko:"
#~ msgid "&Yes"
#~ msgstr "&Ee"
#~ msgid "Yes"
#~ msgstr "Ee"
#~ msgid "&No"
#~ msgstr "&A'a"
#~ msgid "No"
#~ msgstr "A'a"
#~ msgid "Close the current window or document"
#~ msgstr "Rufe wannan tagar"
#~ msgid "&Close Window"
#~ msgstr "&Rufe taga"
#~ msgid "Close the current window."
#~ msgstr "Rufe wannan tagar."
#~ msgid "&Close Document"
#~ msgstr "&Rufe -dokumen-"
#~ msgid "Close the current document."
#~ msgstr "Rufe wannan -dokumen-"
#, fuzzy
#~ msgctxt "@option today"
#~ msgid "Today"
#~ msgstr "Yau"
#, fuzzy
#~ msgctxt "@option yesterday"
#~ msgid "Yesterday"
#~ msgstr "Jiya"
#~ msgid "&Remove"
#~ msgstr "&Cire"
#~ msgid "&Help"
#~ msgstr "&Agaji"
#, fuzzy
#~ msgctxt "@title:menu"
#~ msgid "Toolbar Settings"
#~ msgstr "Tsarawa"
#, fuzzy
#~ msgctxt "Toolbar orientation"
#~ msgid "Orientation"
#~ msgstr "Fassara"
#~ msgid "&Settings"
#~ msgstr "&Tsarawa"
#~ msgid "Description:"
#~ msgstr "ƙwatan tawa:"
#~ msgid "Pause"
#~ msgstr "Dakata"
#~ msgid "Settings"
#~ msgstr "Tsarawa"
#~ msgid "Quit"
#~ msgstr "Kashi"
#~ msgid "Quit application..."
#~ msgstr "Rufewa -afelikashon-"
#~ msgid "?"
#~ msgstr "?"
#~ msgid "Author:"
#~ msgstr "Mawallafi:"
#~ msgid "GPL"
#~ msgstr "GPL"
#~ msgid "LGPL"
#~ msgstr "LGPL"
#~ msgid "BSD"
#~ msgstr "BSD"
#~ msgid "Language:"
#~ msgstr "Yare:"
#~ msgid "Configure Notifications"
#~ msgstr "Haɗawa Sanerwa"
#, fuzzy
#~ msgid "Apply Settings"
#~ msgstr "Tsarawa"
#~ msgid "Color for links"
#~ msgstr "Launin ma'isa"
#~ msgid "What color links should be that have not yet been clicked on"
#~ msgstr ""
#~ "Wani launi ma'isa kake so launin ma'isar ya kasance wanda ba a taɓa ba"
#~ msgid "Color for visited links"
#~ msgstr "Launin ma'isar da aka taɓa"
#~ msgid "What country"
#~ msgstr "Wacce ƙasa"
#~ msgid ""
#~ "Used to determine how to display numbers, currency and time/date, for "
#~ "example"
#~ msgstr "ƙasarce take zaɓar haruffa, lambobi da lokaci da take amfani dashi"
#~ msgid "Path to the autostart directory"
#~ msgstr "Hanyan jakar farawa da kai"
#, fuzzy
#~ msgctxt "Used only for plugins"
#~ msgid "About %1"
#~ msgstr "Bayani akan %1"
#, fuzzy
#~ msgctxt ""
#~ "referring to a filter on the modification and usage date of files/"
#~ "resources"
#~ msgid "Today"
#~ msgstr "Yau"
#, fuzzy
#~ msgctxt ""
#~ "referring to a filter on the modification and usage date of files/"
#~ "resources"
#~ msgid "Yesterday"
#~ msgstr "Jiya"
#, fuzzy
#~ msgid "Before"
#~ msgstr "&Mawallafi"
#, fuzzy
#~ msgctxt ""
#~ "@option:check An item in a list of resources that allows to query for "
#~ "more resources to put in the list"
#~ msgid "More..."
#~ msgstr "&Mawallafi"
#, fuzzy
#~ msgctxt "@option:check A filter on file type"
#~ msgid "Documents"
#~ msgstr "&Rufe -dokumen-"
#~ msgid "Start"
#~ msgstr "Tada"
#~ msgid "What time is it? Click to update."
#~ msgstr "Ƙarfe nawa? Denna don sabuntawa."
#, fuzzy
#~ msgctxt "@info/plain"
#~ msgid "today"
#~ msgstr "Yau"
#~ msgctxt "@item Author name in about dialog"
#~ msgid "%1"
#~ msgstr "%1"
#~ msgid "..."
#~ msgstr "..."
#, fuzzy
#~ msgid "description"
#~ msgstr "Tambaya"
#, fuzzy
#~ msgid "Autor Name"
#~ msgstr "Mawallafi"
#, fuzzy
#~ msgctxt "Indian National month 10 - LongNamePossessive"
#~ msgid "of Paush"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Indian National month 10 - ShortName"
#~ msgid "Pau"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Indian National month 10 - LongName"
#~ msgid "Paush"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic month 2 - ShortNamePossessive"
#~ msgid "of Pao"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic month 7 - ShortNamePossessive"
#~ msgid "of Par"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic month 8 - ShortNamePossessive"
#~ msgid "of Pam"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic month 9 - ShortNamePossessive"
#~ msgid "of Pas"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic month 10 - ShortNamePossessive"
#~ msgid "of Pan"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic month 2 - LongNamePossessive"
#~ msgid "of Paope"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic month 4 - LongNamePossessive"
#~ msgid "of Kiahk"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic month 8 - LongNamePossessive"
#~ msgid "of Parmoute"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic month 9 - LongNamePossessive"
#~ msgid "of Pashons"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic month 10 - LongNamePossessive"
#~ msgid "of Paone"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic month 2 - ShortName"
#~ msgid "Pao"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic month 6 - ShortName"
#~ msgid "Mes"
#~ msgstr "Ee"
#, fuzzy
#~ msgctxt "Coptic month 7 - ShortName"
#~ msgid "Par"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic month 8 - ShortName"
#~ msgid "Pam"
#~ msgstr "safe"
#, fuzzy
#~ msgctxt "Coptic month 9 - ShortName"
#~ msgid "Pas"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic month 10 - ShortName"
#~ msgid "Pan"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic month 2 - LongName"
#~ msgid "Paope"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic month 3 - LongName"
#~ msgid "Hathor"
#~ msgstr "Mawallafi"
#, fuzzy
#~ msgctxt "Coptic month 8 - LongName"
#~ msgid "Parmoute"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic month 9 - LongName"
#~ msgid "Pashons"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic month 10 - LongName"
#~ msgid "Paone"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic weekday 1 - ShortDayName"
#~ msgid "Pes"
#~ msgstr "Ee"
#, fuzzy
#~ msgctxt "Coptic weekday 2 - ShortDayName"
#~ msgid "Psh"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic weekday 6 - ShortDayName"
#~ msgid "Psa"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Coptic weekday 1 - LongDayName"
#~ msgid "Pesnau"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Ethiopian month 4 - ShortNamePossessive"
#~ msgid "of Tah"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Ethiopian month 13 - ShortNamePossessive"
#~ msgid "of Pag"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Ethiopian month 13 - LongNamePossessive"
#~ msgid "of Pagumen"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Ethiopian month 1 - ShortName"
#~ msgid "Mes"
#~ msgstr "Ee"
#, fuzzy
#~ msgctxt "Ethiopian month 11 - ShortName"
#~ msgid "Ham"
#~ msgstr "safe"
#, fuzzy
#~ msgctxt "Ethiopian month 13 - ShortName"
#~ msgid "Pag"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Ethiopian month 13 - LongName"
#~ msgid "Pagumen"
#~ msgstr "Dakata"
#, fuzzy
#~ msgctxt "Ethiopian weekday 4 - ShortDayName"
#~ msgid "Ham"
#~ msgstr "safe"
#, fuzzy
#~ msgctxt "Ethiopian weekday 4 - LongDayName"
#~ msgid "Hamus"
#~ msgstr "Dakata"
#, fuzzy
#~ msgid "Long Action"
#~ msgstr "Aiki"
#~ msgid "Path for the trash can"
#~ msgstr "Hanyan zubar da shara"
#~ msgid "Path to documents folder"
#~ msgstr "Hanyan jakar -dokumen-"
@@ -0,0 +1,39 @@
# translation of kdelibs4.po to hebrew
# Translation of kdelibs4.po to Hebrew
# translation of kdelibs4.po to
# KDE Hebrew Localization Project
#
# In addition to the copyright owners of the program
# which this translation accompanies, this translation is
# Copyright (C) 1998 Erez Nir <erez-n@actcom.co.il>
# Copyright (C) 1999-2003 Meni Livne <livne@kde.org>
#
# This translation is subject to the same Open Source
# license as the program which it accompanies.
#
# Diego Iastrubni <elcuco@kde.org>, 2003.
# Diego Iastrubni <elcuco@kde.org>, 2003, 2004.
# Diego Iastrubni <elcuco@kde.org>, 2005, 2006, 2007, 2008, 2009, 2012, 2014.
# Meni Livne <livne@kde.org>, 2007.
# tahmar1900 <tahmar1900@gmail.com>, 2008, 2009.
# Elkana Bardugo <ttv200@gmail.com>, 2016.
# Elkana Bardugo <ttv200@gmail.com>, 2017. #zanata
msgid ""
msgstr ""
"PO-Revision-Date: 2017-05-16 06:50-0400\n"
"Last-Translator: Copied by Zanata <copied-by-zanata@zanata.org>\n"
"Language-Team: Hebrew <kde-i18n-doc@kde.org>\n"
"Language: he\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Zanata 3.9.6\n"
"Plural-Forms: nplurals=4; plural=(n == 1) ? 0 : ((n == 2) ? 1 : ((n > 10 && "
"n % 10 == 0) ? 2 : 3));\n"
"X-Qt-Contexts: true\n"
#: kx11extras.cpp:994
#, qt-format
msgctxt "KWindowSystem|"
msgid "Desktop %1"
msgstr "שולחן עבודה %1"
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,34 @@
# Translation of kdelibs4 into Japanese.
# This file is distributed under the same license as the kdelibs package.
# Taiki Komoda <kom@kde.gr.jp>, 2002, 2004, 2006, 2010.
# Noboru Sinohara <shinobo@leo.bekkoame.ne.jp>, 2004.
# Toyohiro Asukai <toyohiro@ksmplus.com>, 2004.
# Kurose Shushi <md81@bird.email.ne.jp>, 2004.
# AWASHIRO Ikuya <ikuya@oooug.jp>, 2004.
# Shinichi Tsunoda <tsuno@ngy.1st.ne.jp>, 2005.
# Yukiko Bando <ybando@k6.dion.ne.jp>, 2006, 2007, 2008, 2009, 2010.
# Fumiaki Okushi <okushi@kde.gr.jp>, 2006, 2007, 2008, 2010, 2011.
#
msgid ""
msgstr ""
"Project-Id-Version: kdelibs4\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2014-03-23 01:50+0000\n"
"PO-Revision-Date: 2021-09-30 21:59+0900\n"
"Last-Translator: Ryunosuke Toda <toda.ryunosuke@gmail.com>\n"
"Language-Team: Japanese <kde-jp@kde.org>\n"
"Language: ja\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Accelerator-Marker: &\n"
"X-Text-Markup: qtrich\n"
"X-Generator: Poedit 3.0\n"
"X-Qt-Contexts: true\n"
#: kx11extras.cpp:994
#, qt-format
msgctxt "KWindowSystem|"
msgid "Desktop %1"
msgstr "デスクトップ %1"
@@ -0,0 +1,20 @@
msgid ""
msgstr ""
"Project-Id-Version: kwindowsystem5_qt\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: Temuri Doghonadze <temuri.doghonadze@gmail.com>\n"
"Language-Team: Georgian <kde-i18n-doc@kde.org>\n"
"Language: ka\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Qt-Contexts: true\n"
"X-Generator: Poedit 3.0.1\n"
#: kx11extras.cpp:994
#, qt-format
msgctxt "KWindowSystem|"
msgid "Desktop %1"
msgstr "სამუშაო მაგიდა %1"
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,26 @@
# Korean messages for kdelibs.
# Copyright (C) Free Software Foundation, Inc.
# Cho Sung Jae <cho.sungjae@gmail.com>, 2007.
# Shinjo Park <kde@peremen.name>, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2020.
#
msgid ""
msgstr ""
"Project-Id-Version: kdelibs4\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2014-03-23 01:50+0000\n"
"PO-Revision-Date: 2020-01-28 23:54+0100\n"
"Last-Translator: Shinjo Park <kde@peremen.name>\n"
"Language-Team: Korean <kde-kr@kde.org>\n"
"Language: ko\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Lokalize 19.04.3\n"
"X-Qt-Contexts: true\n"
#: kx11extras.cpp:994
#, qt-format
msgctxt "KWindowSystem|"
msgid "Desktop %1"
msgstr "바탕 화면 %1"
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,31 @@
# translation of kdelibs4.po to Lithuanian
# Ričardas Čepas <rch@richard.eu.org>, 2002-2004.
# Donatas Glodenis <dgvirtual@akl.lt>, 2004-2009.
# Gintautas Miselis <gintautas@miselis.lt>, 2008.
# Andrius Štikonas <andrius@stikonas.eu>, 2009.
# Tomas Straupis <tomasstraupis@gmail.com>, 2011.
# Remigijus Jarmalavičius <remigijus@jarmalavicius.lt>, 2011.
# Liudas Ališauskas <liudas.alisauskas@gmail.com>, 2011, 2012, 2013, 2014.
# Liudas Alisauskas <liudas@akmc.lt>, 2013.
msgid ""
msgstr ""
"Project-Id-Version: kdelibs4\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2014-03-23 01:50+0000\n"
"PO-Revision-Date: 2014-11-11 00:33+0200\n"
"Last-Translator: Liudas Ališauskas <liudas@aksioma.lt>\n"
"Language-Team: Lithuanian <kde-i18n-lt@kde.org>\n"
"Language: lt\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : n%10>=2 && (n%100<10 || n"
"%100>=20) ? 1 : n%10==0 || (n%100>10 && n%100<20) ? 2 : 3);\n"
"X-Generator: Lokalize 1.5\n"
"X-Qt-Contexts: true\n"
#: kx11extras.cpp:994
#, qt-format
msgctxt "KWindowSystem|"
msgid "Desktop %1"
msgstr "Darbalaukis %1"
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,33 @@
# Translation of kwindowsystem6_qt to Norwegian Bokmål
#
# Knut Yrvin <knut.yrvin@gmail.com>, 2002, 2003, 2004, 2005.
# Bjørn Steensrud <bjornst@skogkatt.homelinux.org>, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014.
# Eskild Hustvedt <zerodogg@skolelinux.no>, 2004, 2005.
# Gaute Hvoslef Kvalnes <gaute@verdsveven.com>, 2004, 2005.
# Axel Bojer <fri_programvare@bojer.no>, 2005, 2006.
# Nils Kristian Tomren <slx@nilsk.net>, 2005, 2007.
# Øyvind A. Holm <sunny@sunbase.org>, 2009.
msgid ""
msgstr ""
"Project-Id-Version: kdelibs4\n"
"Report-Msgid-Bugs-To: http://bugs.kde.org\n"
"POT-Creation-Date: 2014-02-28 03:44+0000\n"
"PO-Revision-Date: 2014-04-25 15:53+0200\n"
"Last-Translator: Bjørn Steensrud <bjornst@skogkatt.homelinux.org>\n"
"Language-Team: Norwegian Bokmål <l10n-no@lister.huftis.org>\n"
"Language: nb\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Lokalize 1.5\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Environment: kde\n"
"X-Accelerator-Marker: &\n"
"X-Text-Markup: qtrich\n"
"X-Qt-Contexts: true\n"
#: kx11extras.cpp:994
#, qt-format
msgctxt "KWindowSystem|"
msgid "Desktop %1"
msgstr "Skrivebord %1"
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More