initial import

This commit is contained in:
Ivailo Monev 2014-11-13 19:30:51 +02:00
commit a7fd791926
5665 changed files with 827277 additions and 0 deletions

5
.krazy Normal file
View file

@ -0,0 +1,5 @@
#kcheckpass is mostly C, so let's not check there.
IGNORESUBS kcheckpass
#no code in these
IGNORESUBS cursors

360
CMakeLists.txt Normal file
View file

@ -0,0 +1,360 @@
project(KDEBASE_WORKSPACE)
# set_package_properties appeared in cmake 2.8.6
# TODO: Remove when kdelibs >= 4.10 will be required
cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR)
# Used e.g. in KDE4WorkspaceConfig.cmake, Alex
set(KDE4WORKSPACE_VERSION_MAJOR 4)
set(KDE4WORKSPACE_VERSION_MINOR 11)
set(KDE4WORKSPACE_VERSION_PATCH 14)
set(KDE4WORKSPACE_VERSION ${KDE4WORKSPACE_VERSION_MAJOR}.${KDE4WORKSPACE_VERSION_MINOR}.${KDE4WORKSPACE_VERSION_PATCH} )
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH} )
#search packages used by KDE
set(QT_MIN_VERSION "4.8.0")
find_package(KDE4 4.9.4 REQUIRED)
include(KDE4Defaults)
option(WITH_XINERAMA "Xinerama support for multi-headed X displays" ON)
find_package(Strigi)
set_package_properties(Strigi PROPERTIES DESCRIPTION "Desktop indexing and search support"
URL "http://strigi.sourceforge.net"
TYPE REQUIRED
)
find_package(ZLIB)
set_package_properties(ZLIB PROPERTIES DESCRIPTION "Support for gzip compressed files and data streams"
URL "http://www.zlib.net"
TYPE REQUIRED
)
find_package(KActivities 6.0.0 CONFIG)
set_package_properties(KActivities PROPERTIES DESCRIPTION "Interface library for the activity manager"
URL "https://projects.kde.org/kactivities"
TYPE REQUIRED
)
find_package(DBusMenuQt 0.6.0)
set_package_properties(DBusMenuQt PROPERTIES DESCRIPTION "Support for notification area menus via the DBusMenu protocol"
URL "https://launchpad.net/libdbusmenu-qt"
TYPE REQUIRED
)
find_package(QImageBlitz)
set_package_properties(QImageBlitz PROPERTIES DESCRIPTION "An image effects library"
URL "http://sourceforge.net/projects/qimageblitz"
TYPE REQUIRED
)
find_package(KDeclarative QUIET CONFIG)
set_package_properties(KDeclarative PROPERTIES DESCRIPTION "KDE Declarative (QML) support from kdelibs"
URL "http://www.kde.org"
TYPE REQUIRED
PURPOSE "Required for building ksmserver"
)
macro_optional_find_package(OpenGL)
set_package_properties(OpenGL PROPERTIES DESCRIPTION "The OpenGL libraries"
URL "http://www.opengl.org"
TYPE OPTIONAL
)
macro_optional_find_package(OpenGLES)
set_package_properties(OpenGLES PROPERTIES DESCRIPTION "The OpenGLES libraries"
URL "http://www.khronos.org/opengles"
TYPE OPTIONAL
)
macro_optional_find_package(UDev)
set_package_properties(UDev PROPERTIES DESCRIPTION "The UDev Libraries"
TYPE OPTIONAL
PURPOSE "Allows support for UPower backend in PowerDevil - STRONGLY RECOMMENDED"
)
macro_optional_find_package(Wayland)
set_package_properties(Wayland PROPERTIES DESCRIPTION "The Wayland Client and Server libraries"
URL "http://wayland.freedesktop.org"
TYPE OPTIONAL
PURPOSE "Required for building KWin with Wayland support"
)
if(Q_WS_X11)
find_package(XCB REQUIRED)
set_package_properties(XCB PROPERTIES DESCRIPTION "X protocol C-language Binding"
URL "http://xcb.freedesktop.org"
TYPE REQUIRED
)
find_package(X11_XCB)
set_package_properties(X11_XCB PROPERTIES DESCRIPTION "XCB X11 protocol client library"
TYPE REQUIRED
)
find_package(X11 REQUIRED)
set_package_properties(X11 PROPERTIES DESCRIPTION "X11 libraries"
URL "http://www.x.org"
TYPE REQUIRED
)
add_feature_info("Automated testing of X clients" X11_XTest_FOUND
"The X11 Testing Resource extension library is useful for automated testing of X clients")
add_feature_info("libXau" X11_Xau_FOUND "The X11 Authorization Protocol library may be used by KDM")
add_feature_info("LibXdmcp" X11_Xdmcp_FOUND "The X Display Manager Control Protocol library may be used by KDM")
if(NOT X11_Xkbfile_FOUND)
message(FATAL_ERROR "The X11 keyboard layout library was not found. Required for building keyboard modules.")
endif()
if(NOT X11_Xcomposite_FOUND)
message(FATAL_ERROR "The X11 composite library was not found. Required for building the plasma tray and notifications widgets.")
endif()
if(NOT X11_Xdamage_FOUND)
message(FATAL_ERROR "The X11 damaged region extension library was not found. Required for compositing support in KWin.")
endif()
if(NOT X11_Xrender_FOUND)
message(FATAL_ERROR " The X Rendering Extension client library was not found. Required for XRender Compositing backend in KWin.")
endif()
if(NOT X11_Xfixes_FOUND)
message(FATAL_ERROR "The X11 miscellaneous 'fixes' extension library was not found. Required for XRender Compositing backend in KWin.")
endif()
if(NOT X11_Xrandr_FOUND)
message(FATAL_ERROR "The X11 RandR extension library was not found. Required for Multi Screen Support.")
endif()
if(NOT OPENGL_FOUND AND NOT OPENGLES_FOUND)
message(FATAL_ERROR "Either OpenGL or OpenGL ES 2.0 are required for Compositing support in KWin.")
endif()
if(NOT X11_Xcursor_FOUND)
message(FATAL_ERROR "The X11 cursor management library was not found. Required for desktop effects support in KWin.")
endif()
endif(Q_WS_X11)
macro_optional_find_package(GLIB2 2.0)
set_package_properties(GLIB2 PROPERTIES DESCRIPTION "Low-level core library for data structure handling, portability wrappers, etc."
URL "http://www.gtk.org"
TYPE OPTIONAL
PURPOSE "Needed to build the kxkb keyboard map control program and provide XMMS support in the Now Playing Plasma data engine"
)
macro_optional_find_package(Fontconfig)
set_package_properties(Fontconfig PROPERTIES DESCRIPTION "Font access configuration library"
URL "http://www.freedesktop.org/wiki/Software/fontconfig"
TYPE OPTIONAL
PURPOSE "Needed to build font configuration and installation tools"
)
#### Python support ( plasma scriptengines ) ####
macro_optional_find_package(PythonLibrary)
set_package_properties(PythonLibrary PROPERTIES DESCRIPTION "Python scripting language"
URL "http://python.org"
TYPE OPTIONAL
PURPOSE "Needed to build plasma scriptengine for python."
)
macro_optional_find_package(Soprano 2.7.56)
set_package_properties(Soprano PROPERTIES DESCRIPTION "Semantic Desktop Storing"
URL "http://soprano.sourceforge.net"
TYPE OPTIONAL
PURPOSE "Required to build Nepomuk features."
)
macro_optional_find_package(NepomukCore QUIET CONFIG)
set_package_properties(NepomukCore PROPERTIES DESCRIPTION "Nepomuk Core Library"
URL "https://projects.kde.org/nepomuk-core"
TYPE OPTIONAL
PURPOSE "Required to build Nepomuk features."
)
macro_optional_find_package(Boost 1.34.0 MODULE)
set_package_properties(Boost PROPERTIES DESCRIPTION "Boost C++ Libraries"
URL "http://www.boost.org"
TYPE OPTIONAL
PURPOSE "Required to build certain Plasma DataEngines (Akonadi, RSS, Calendar)"
)
macro_optional_find_package(Akonadi QUIET CONFIG)
set_package_properties(Akonadi PROPERTIES DESCRIPTION "An extensible cross-desktop storage service for PIM data"
URL "http://pim.kde.org/akonadi"
TYPE OPTIONAL
PURPOSE "Required to build certain Plasma DataEngines (Akonadi, Calendar)"
)
macro_optional_find_package(KdepimLibs 4.10.68 QUIET CONFIG)
set_package_properties(KdepimLibs PROPERTIES DESCRIPTION "The KDEPIM libraries"
URL "http://pim.kde.org"
TYPE OPTIONAL
PURPOSE "Required to build certain Plasma DataEngines (Akonadi, Calendar)"
)
macro_optional_find_package(QJSON)
set_package_properties(QJSON PROPERTIES DESCRIPTION "Library to manage JSON objects with Qt"
URL "http://qjson.sourceforge.net/"
TYPE OPTIONAL
PURPOSE "Required to build Chrome/Chromium support for Plasma Bookmarks Runners"
)
include(ConfigureChecks.cmake)
if(NOT WIN32)
configure_file(config-unix.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-unix.h )
configure_file(config-X11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-X11.h )
if(NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr")
set(EXPORT_XCURSOR_PATH "XCURSOR_PATH=${CMAKE_INSTALL_PREFIX}/share/icons:$XCURSOR_PATH\":~/.icons:/usr/share/icons:/usr/share/pixmaps:/usr/X11R6/lib/X11/icons\"; export XCURSOR_PATH")
endif(NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr")
configure_file(startkde.cmake ${CMAKE_CURRENT_BINARY_DIR}/startkde @ONLY)
endif(NOT WIN32)
configure_file(config-workspace.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-workspace.h )
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} -DHAVE_CONFIG_H=1)
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${KACTIVITIES_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/libs)
add_definitions(-DDISABLE_NEPOMUK_LEGACY)
# libs
add_subdirectory(cmake)
add_subdirectory(libs)
# system settings (kcontrol replacement)
if(${KDE_PLATFORM_PROFILE} STREQUAL "Desktop")
macro_optional_add_subdirectory( systemsettings )
endif(${KDE_PLATFORM_PROFILE} STREQUAL "Desktop")
# core apps
if(NOT WIN32)
macro_optional_add_subdirectory( kcheckpass )
macro_optional_add_subdirectory( kwin )
macro_optional_add_subdirectory( ksmserver )
find_package(JPEG REQUIRED)
find_package(PNG REQUIRED)
macro_optional_add_subdirectory( ksplash )
macro_optional_add_subdirectory( powerdevil )
macro_optional_add_subdirectory( qguiplatformplugin_kde )
if (NOT CMAKE_SYSTEM_NAME MATCHES Darwin)
macro_optional_add_subdirectory( ksysguard )
endif (NOT CMAKE_SYSTEM_NAME MATCHES Darwin)
endif(NOT WIN32)
if(${KDE_PLATFORM_PROFILE} STREQUAL "Desktop")
macro_optional_add_subdirectory(kcontrol)
macro_optional_add_subdirectory(klipper)
macro_optional_add_subdirectory(kmenuedit)
macro_optional_add_subdirectory(krunner)
macro_optional_add_subdirectory(solid-actions-kcm)
macro_optional_add_subdirectory(kstartupconfig)
macro_optional_add_subdirectory(freespacenotifier)
macro_optional_add_subdirectory(kscreensaver)
macro_optional_add_subdirectory(kinfocenter)
# data
macro_optional_add_subdirectory(doc)
if (Q_WS_X11)
macro_optional_add_subdirectory(ktouchpadenabler)
endif (Q_WS_X11)
if(NOT WIN32)
macro_optional_add_subdirectory(kcminit)
macro_optional_add_subdirectory(khotkeys)
macro_optional_add_subdirectory(kwrited)
macro_optional_add_subdirectory(ksystraycmd)
macro_optional_add_subdirectory(appmenu)
endif(NOT WIN32)
if(X11_Xau_FOUND AND X11_Xdmcp_FOUND)
macro_optional_add_subdirectory( kdm )
else(X11_Xau_FOUND AND X11_Xdmcp_FOUND)
message(STATUS "Xau lib or Xdmcp lib was missing. kdm will not compile")
endif(X11_Xau_FOUND AND X11_Xdmcp_FOUND)
endif(${KDE_PLATFORM_PROFILE} STREQUAL "Desktop")
if(NOT WIN32)
# data
macro_optional_add_subdirectory(cursors)
endif(NOT WIN32)
macro_optional_add_subdirectory(plasma)
macro_optional_add_subdirectory(statusnotifierwatcher)
macro_optional_add_subdirectory(kstyles)
########### install files ###############
if(NOT WIN32)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/startkde DESTINATION ${BIN_INSTALL_DIR})
endif(NOT WIN32)
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
# make the libraries installed from kdebase/workspace available to other projects
# by creating and installing a KDE4WorkspaceConfig.cmake file, which will
# be searched and found by kdelibs/cmake/modules/FindKDE4Workspace.cmake. Alex
# now create the KDE4WorkspaceConfig.cmake file, which will be loaded by
# kdelibs/cmake/modules/FindKDE4Workspace.cmake and which has to contain all information
# about the libraries installed from kdebase/workspace/libs/ anybody would like to have. Alex
# we need the absolute directories where stuff will be installed too
# but since the variables which contain the destinations can be relative
# or absolute paths, we need this macro to make them all absoulte, Alex
macro(MAKE_INSTALL_PATH_ABSOLUTE out in)
if (IS_ABSOLUTE "${in}") # IS_ABSOLUTE is new since cmake 2.4.8
set(${out} "${in}")
else (IS_ABSOLUTE "${in}")
set(${out} "\${KDE4WORKSPACE_INSTALL_DIR}/${in}")
endif (IS_ABSOLUTE "${in}")
endmacro(MAKE_INSTALL_PATH_ABSOLUTE out in)
make_install_path_absolute(KDE4WORKSPACE_LIB_DIR ${LIB_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_LIBEXEC_DIR ${LIBEXEC_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_INCLUDE_DIR ${INCLUDE_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_BIN_DIR ${BIN_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_SBIN_DIR ${SBIN_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_DATA_DIR ${DATA_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_HTML_DIR ${HTML_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_CONFIG_DIR ${CONFIG_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_ICON_DIR ${ICON_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_KCFG_DIR ${KCFG_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_LOCALE_DIR ${LOCALE_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_MIME_DIR ${MIME_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_SOUND_DIR ${SOUND_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_TEMPLATES_DIR ${TEMPLATES_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_WALLPAPER_DIR ${WALLPAPER_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_KCONF_UPDATE_DIR ${KCONF_UPDATE_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_AUTOSTART_DIR ${AUTOSTART_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_XDG_APPS_DIR ${XDG_APPS_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_XDG_DIRECTORY_DIR ${XDG_DIRECTORY_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_SYSCONF_DIR ${SYSCONF_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_MAN_DIR ${MAN_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_INFO_DIR ${INFO_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_DBUS_INTERFACES_DIR ${DBUS_INTERFACES_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_DBUS_SERVICES_DIR ${DBUS_SERVICES_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_SERVICES_DIR ${SERVICES_INSTALL_DIR})
make_install_path_absolute(KDE4WORKSPACE_SERVICETYPES_DIR ${SERVICETYPES_INSTALL_DIR})
set(KDE4WORKSPACE_TARGET_PREFIX KDE4Workspace__)
configure_file(KDE4WorkspaceConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/KDE4WorkspaceConfig.cmake" @ONLY)
# this file will be installed too and will be used by cmake when searching for the Config.cmake file to check the version of kdepimlibs, Alex
macro_write_basic_cmake_version_file(${CMAKE_CURRENT_BINARY_DIR}/KDE4WorkspaceConfigVersion.cmake
${KDE4WORKSPACE_VERSION_MAJOR} ${KDE4WORKSPACE_VERSION_MINOR} ${KDE4WORKSPACE_VERSION_PATCH})
set(_KDE4WorkspaceConfig_INSTALL_DIR ${LIB_INSTALL_DIR}/KDE4Workspace/cmake)
# places where find_package() looks for FooConfig.cmake files:
# CMake >= 2.6.0 looks in lib/Foo*/cmake/, CMake >= 2.6.3 also looks in
# lib/cmake/Foo*/, which packagers prefer. So they can set the KDE4_USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR
# option to have kdepimlibs install its Config file there. Alex
if(KDE4_USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR)
set(_KDE4WorkspaceConfig_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/KDE4Workspace)
endif(KDE4_USE_COMMON_CMAKE_PACKAGE_CONFIG_DIR)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/KDE4WorkspaceConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/KDE4WorkspaceConfigVersion.cmake
DESTINATION ${_KDE4WorkspaceConfig_INSTALL_DIR})
install(EXPORT kdeworkspaceLibraryTargets
NAMESPACE ${KDE4WORKSPACE_TARGET_PREFIX}
DESTINATION ${_KDE4WorkspaceConfig_INSTALL_DIR}
FILE KDE4WorkspaceLibraryTargets.cmake )

346
COPYING Normal file
View file

@ -0,0 +1,346 @@
NOTE! The GPL below is copyrighted by the Free Software Foundation, but
the instance of code that it refers to (the kde programs) are copyrighted
by the authors who actually wrote it.
---------------------------------------------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

397
COPYING.DOC Normal file
View file

@ -0,0 +1,397 @@
GNU Free Documentation License
Version 1.2, November 2002
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
0. PREAMBLE
The purpose of this License is to make a manual, textbook, or other
functional and useful document "free" in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
This License is a kind of "copyleft", which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
1. APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The "Document", below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as "you". You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
A "Modified Version" of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
A "Secondary Section" is a named appendix or a front-matter section of
the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall subject
(or to related matters) and contains nothing that could fall directly
within that overall subject. (Thus, if the Document is in part a
textbook of mathematics, a Secondary Section may not explain any
mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
The "Invariant Sections" are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
The "Cover Texts" are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
A "Transparent" copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not "Transparent" is called "Opaque".
Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, LaTeX input format, SGML
or XML using a publicly available DTD, and standard-conforming simple
HTML, PostScript or PDF designed for human modification. Examples of
transparent image formats include PNG, XCF and JPG. Opaque formats
include proprietary formats that can be read and edited only by
proprietary word processors, SGML or XML for which the DTD and/or
processing tools are not generally available, and the
machine-generated HTML, PostScript or PDF produced by some word
processors for output purposes only.
The "Title Page" means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, "Title Page" means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
A section "Entitled XYZ" means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as "Acknowledgements",
"Dedications", "Endorsements", or "History".) To "Preserve the Title"
of such a section when you modify the Document means that it remains a
section "Entitled XYZ" according to this definition.
The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
3. COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
B. List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
C. State on the Title page the name of the publisher of the
Modified Version, as the publisher.
D. Preserve all the copyright notices of the Document.
E. Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
F. Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
G. Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.
H. Include an unaltered copy of this License.
I. Preserve the section Entitled "History", Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section Entitled "History" in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
J. Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the "History" section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
K. For any section Entitled "Acknowledgements" or "Dedications",
Preserve the Title of the section, and preserve in the section all
the substance and tone of each of the contributor acknowledgements
and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
M. Delete any section Entitled "Endorsements". Such a section
may not be included in the Modified Version.
N. Do not retitle any existing section to be Entitled "Endorsements"
or to conflict in title with any Invariant Section.
O. Preserve any Warranty Disclaimers.
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
You may add a section Entitled "Endorsements", provided it contains
nothing but endorsements of your Modified Version by various
parties--for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled "History"
in the various original documents, forming one section Entitled
"History"; likewise combine any sections Entitled "Acknowledgements",
and any sections Entitled "Dedications". You must delete all sections
Entitled "Endorsements".
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an "aggregate" if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation's users beyond what the individual works permit.
When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document's Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
8. TRANSLATION
Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
If a section in the Document is Entitled "Acknowledgements",
"Dedications", or "History", the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document except
as expressly provided for under this License. Any other attempt to
copy, modify, sublicense or distribute the Document 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.
10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation 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. See
http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License "or any later version" applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation.
ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
Copyright (c) YEAR YOUR NAME.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the "with...Texts." line with this:
with the Invariant Sections being LIST THEIR TITLES, with the
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.

510
COPYING.LIB Normal file
View file

@ -0,0 +1,510 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the 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.
GNU LESSER GENERAL PUBLIC LICENSE
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 a brief 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 St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or
your school, if any, to sign a "copyright disclaimer" for the library,
if necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James
Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

13
CTestConfig.cmake Normal file
View file

@ -0,0 +1,13 @@
## This file should be placed in the root directory of your project.
## Then modify the CMakeLists.txt file in the root directory of your
## project to incorporate the testing dashboard.
## # The following are required to uses Dart and the Cdash dashboard
## ENABLE_TESTING()
## INCLUDE(CTest)
set(CTEST_PROJECT_NAME "kdebase-workspace")
set(CTEST_NIGHTLY_START_TIME "20:00:00 CET")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "my.cdash.org")
set(CTEST_DROP_LOCATION "/submit.php?project=kdebase-workspace")
set(CTEST_DROP_SITE_CDASH TRUE)

102
ConfigureChecks.cmake Normal file
View file

@ -0,0 +1,102 @@
include(UnixAuth)
set_package_properties(PAM PROPERTIES DESCRIPTION "PAM Libraries"
URL "https://www.kernel.org/pub/linux/libs/pam/"
TYPE OPTIONAL
PURPOSE "Required for screen unlocking and optionally used by the KDM log in manager"
)
include(CheckTypeSize)
include(FindPkgConfig)
macro_optional_find_package(XKB) # kxkb, kdm
if (PAM_FOUND)
set(KDE4_COMMON_PAM_SERVICE "kde" CACHE STRING "The PAM service to use unless overridden for a particular app.")
macro(define_pam_service APP)
string(TOUPPER ${APP}_PAM_SERVICE var)
set(cvar KDE4_${var})
set(${cvar} "${KDE4_COMMON_PAM_SERVICE}" CACHE STRING "The PAM service for ${APP}.")
mark_as_advanced(${cvar})
set(${var} "\"${${cvar}}\"")
endmacro(define_pam_service)
macro(install_pam_service APP)
string(TOUPPER KDE4_${APP}_PAM_SERVICE cvar)
install(CODE "
set(DESTDIR_VALUE \"\$ENV{DESTDIR}\")
if (NOT DESTDIR_VALUE)
exec_program(\"${KDEBASE_WORKSPACE_SOURCE_DIR}/mkpamserv\" ARGS ${${cvar}} RETURN_VALUE ret)
if (NOT ret)
exec_program(\"${KDEBASE_WORKSPACE_SOURCE_DIR}/mkpamserv\" ARGS -P ${${cvar}}-np)
endif (NOT ret)
endif (NOT DESTDIR_VALUE)
")
endmacro(install_pam_service)
define_pam_service(KDM)
define_pam_service(kscreensaver)
else (PAM_FOUND)
macro(install_pam_service APP)
endmacro(install_pam_service)
endif (PAM_FOUND)
find_program(some_x_program NAMES iceauth xrdb xterm)
if (NOT some_x_program)
set(some_x_program /usr/bin/xrdb)
message("Warning: Could not determine X binary directory. Assuming /usr/bin.")
endif (NOT some_x_program)
get_filename_component(proto_xbindir "${some_x_program}" PATH)
get_filename_component(XBINDIR "${proto_xbindir}" ABSOLUTE)
get_filename_component(xrootdir "${XBINDIR}" PATH)
set(XLIBDIR "${xrootdir}/lib/X11")
check_function_exists(getpassphrase HAVE_GETPASSPHRASE)
check_function_exists(vsyslog HAVE_VSYSLOG)
check_function_exists(statvfs HAVE_STATVFS)
check_include_files(limits.h HAVE_LIMITS_H)
check_include_files(sys/time.h HAVE_SYS_TIME_H) # ksmserver, ksplashml, sftp
check_include_files(stdint.h HAVE_STDINT_H) # kcontrol/kfontinst
check_include_files("sys/stat.h;sys/vfs.h" HAVE_SYS_VFS_H) # statvfs for plasma/solid
check_include_files("sys/stat.h;sys/statvfs.h" HAVE_SYS_STATVFS_H) # statvfs for plasma/solid
check_include_files(sys/param.h HAVE_SYS_PARAM_H)
check_include_files("sys/param.h;sys/mount.h" HAVE_SYS_MOUNT_H)
check_include_files("sys/types.h;sys/statfs.h" HAVE_SYS_STATFS_H)
check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(malloc.h HAVE_MALLOC_H)
check_function_exists(statfs HAVE_STATFS)
macro_bool_to_01(FONTCONFIG_FOUND HAVE_FONTCONFIG) # kcontrol/{fonts,kfontinst}
macro_bool_to_01(FREETYPE_FOUND HAVE_FREETYPE) # kcontrol/fonts
macro_bool_to_01(OPENGL_FOUND HAVE_OPENGL) # kwin
macro_bool_to_01(X11_XShm_FOUND HAVE_XSHM) # kwin, ksplash
macro_bool_to_01(X11_XTest_FOUND HAVE_XTEST) # khotkeys, kxkb, kdm
macro_bool_to_01(X11_Xcomposite_FOUND HAVE_XCOMPOSITE) # kicker, kwin
macro_bool_to_01(X11_Xcursor_FOUND HAVE_XCURSOR) # many uses
macro_bool_to_01(X11_Xdamage_FOUND HAVE_XDAMAGE) # kwin
macro_bool_to_01(X11_Xfixes_FOUND HAVE_XFIXES) # klipper, kicker, kwin
if(WITH_XINERAMA)
macro_bool_to_01(X11_Xinerama_FOUND HAVE_XINERAMA)
else(WITH_XINERAMA)
set(HAVE_XINERAMA 0)
endif(WITH_XINERAMA)
macro_bool_to_01(X11_Xrandr_FOUND HAVE_XRANDR) # kwin
macro_bool_to_01(X11_Xrender_FOUND HAVE_XRENDER) # kcontrol/style, kicker
macro_bool_to_01(X11_xf86misc_FOUND HAVE_XF86MISC) # kdesktop and kcontrol/lock
macro_bool_to_01(X11_dpms_FOUND HAVE_DPMS) # kdesktop
macro_bool_to_01(X11_XSync_FOUND HAVE_XSYNC) # kwin
set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
check_type_size("struct ucred" STRUCT_UCRED) # kio_fonts
check_function_exists(getpeereid HAVE_GETPEEREID) # kdesu
check_function_exists(setpriority HAVE_SETPRIORITY) # kscreenlocker
set(CMAKE_REQUIRED_INCLUDES ${X11_Xrandr_INCLUDE_PATH}/Xrandr.h)
set(CMAKE_REQUIRED_LIBRARIES ${X11_Xrandr_LIB})
check_function_exists(XRRGetScreenSizeRange XRANDR_1_2_FOUND)
macro_bool_to_01(XRANDR_1_2_FOUND HAS_RANDR_1_2)
check_function_exists(XRRGetScreenResourcesCurrent XRANDR_1_3_FOUND)
macro_bool_to_01(XRANDR_1_3_FOUND HAS_RANDR_1_3)

View file

@ -0,0 +1,70 @@
# KDE4WorkspaceConfig.cmake is generated by CMake from kdebase/workspace/KDE4WorkspaceConfig.cmake.in
# Do we have a version number for kdebase/workspace ? Alex
set(KDE4WORKSPACE_VERSION_MAJOR @KDE4WORKSPACE_VERSION_MAJOR@)
set(KDE4WORKSPACE_VERSION_MINOR @KDE4WORKSPACE_VERSION_MINOR@)
set(KDE4WORKSPACE_VERSION_PATCH @KDE4WORKSPACE_VERSION_PATCH@)
set(KDE4WORKSPACE_VERSION "${KDE4WORKSPACE_VERSION_MAJOR}.${KDE4WORKSPACE_VERSION_MINOR}.${KDE4WORKSPACE_VERSION_PATCH}")
# set the directories
if(NOT KDE4WORKSPACE_INSTALL_DIR)
set(KDE4WORKSPACE_INSTALL_DIR "@CMAKE_INSTALL_PREFIX@")
endif(NOT KDE4WORKSPACE_INSTALL_DIR)
set(KDE4WORKSPACE_LIB_DIR "@KDE4WORKSPACE_LIB_DIR@")
set(KDE4WORKSPACE_LIBEXEC_DIR "@KDE4WORKSPACE_LIBEXEC_DIR@")
set(KDE4WORKSPACE_INCLUDE_DIR "@KDE4WORKSPACE_INCLUDE_DIR@")
set(KDE4WORKSPACE_BIN_DIR "@KDE4WORKSPACE_BIN_DIR@")
set(KDE4WORKSPACE_SBIN_DIR "@KDE4WORKSPACE_SBIN_DIR@")
set(KDE4WORKSPACE_DATA_DIR "@KDE4WORKSPACE_DATA_DIR@")
set(KDE4WORKSPACE_HTML_DIR "@KDE4WORKSPACE_HTML_DIR@")
set(KDE4WORKSPACE_CONFIG_DIR "@KDE4WORKSPACE_CONFIG_DIR@")
set(KDE4WORKSPACE_ICON_DIR "@KDE4WORKSPACE_ICON_DIR@")
set(KDE4WORKSPACE_KCFG_DIR "@KDE4WORKSPACE_KCFG_DIR@")
set(KDE4WORKSPACE_LOCALE_DIR "@KDE4WORKSPACE_LOCALE_DIR@")
set(KDE4WORKSPACE_MIME_DIR "@KDE4WORKSPACE_MIME_DIR@")
set(KDE4WORKSPACE_SOUND_DIR "@KDE4WORKSPACE_SOUND_DIR@")
set(KDE4WORKSPACE_TEMPLATES_DIR "@KDE4WORKSPACE_TEMPLATES_DIR@")
set(KDE4WORKSPACE_WALLPAPER_DIR "@KDE4WORKSPACE_WALLPAPER_DIR@")
set(KDE4WORKSPACE_KCONF_UPDATE_DIR "@KDE4WORKSPACE_KCONF_UPDATE_DIR@")
set(KDE4WORKSPACE_AUTOSTART_DIR "@KDE4WORKSPACE_AUTOSTART_DIR@")
set(KDE4WORKSPACE_XDG_APPS_DIR "@KDE4WORKSPACE_XDG_APPS_DIR@")
set(KDE4WORKSPACE_XDG_DIRECTORY_DIR "@KDE4WORKSPACE_XDG_DIRECTORY_DIR@")
set(KDE4WORKSPACE_SYSCONF_DIR "@KDE4WORKSPACE_SYSCONF_DIR@")
set(KDE4WORKSPACE_MAN_DIR "@KDE4WORKSPACE_MAN_DIR@")
set(KDE4WORKSPACE_INFO_DIR "@KDE4WORKSPACE_INFO_DIR@")
set(KDE4WORKSPACE_DBUS_INTERFACES_DIR "@KDE4WORKSPACE_DBUS_INTERFACES_DIR@")
set(KDE4WORKSPACE_DBUS_SERVICES_DIR "@KDE4WORKSPACE_DBUS_SERVICES_DIR@")
set(KDE4WORKSPACE_SERVICES_DIR "@KDE4WORKSPACE_SERVICES_DIR@")
set(KDE4WORKSPACE_SERVICETYPES_DIR "@KDE4WORKSPACE_SERVICETYPES_DIR@")
# the exports file exports
set(KDE4WORKSPACE_TARGET_PREFIX @KDE4WORKSPACE_TARGET_PREFIX@)
# Make sure to load the exported targets only once
# For the rest of this script it doesn't matter that much
if(NOT TARGET @KDE4WORKSPACE_TARGET_PREFIX@plasmaclock)
get_filename_component(_currentDir "${CMAKE_CURRENT_LIST_FILE}" PATH)
include("${_currentDir}/KDE4WorkspaceLibraryTargets.cmake")
endif(NOT TARGET @KDE4WORKSPACE_TARGET_PREFIX@plasmaclock)
macro(_KDE4WORKSPACE_Set_Lib_Vars _prefix _lib)
set(KDE4WORKSPACE_${_prefix}_LIBRARY ${KDE4WORKSPACE_TARGET_PREFIX}${_lib})
set(KDE4WORKSPACE_${_prefix}_LIBS ${KDE4WORKSPACE_TARGET_PREFIX}${_lib})
endmacro(_KDE4WORKSPACE_Set_Lib_Vars)
_kde4workspace_set_lib_vars( TASKMANAGER taskmanager)
_kde4workspace_set_lib_vars( KWORKSPACE kworkspace)
_kde4workspace_set_lib_vars( PROCESSUI processui)
_kde4workspace_set_lib_vars( LSOFUI lsofui)
_kde4workspace_set_lib_vars( PLASMACLOCK plasmaclock)
_kde4workspace_set_lib_vars( NEPOMUKQUERYCLIENT nepomukqueryclient)
_kde4workspace_set_lib_vars( NEPOMUKQUERY nepomukquery)
_kde4workspace_set_lib_vars( KSCREENSAVER kscreensaver)
_kde4workspace_set_lib_vars( WEATHERION weather_ion)
_kde4workspace_set_lib_vars( KWINEFFECTS kwineffects)
_kde4workspace_set_lib_vars( KDECORATIONS kdecorations)
_kde4workspace_set_lib_vars( KSGRD ksgrd)
_kde4workspace_set_lib_vars( KEPHAL kephal)

51
Mainpage.dox Normal file
View file

@ -0,0 +1,51 @@
/** @mainpage The KDE Workspace
This is where the components that are only used when KDE is providing
a complete desktop environment live.
Of particular importance are <a href="kwin/html/index.html">KWin</a>, the
KDE window manager, and <a href="plasma/html/index.html">Plasma</a>, which
provides the workspace interface.
If you are developing Plasma plugins (Plasmoids), you are probably interested
in the <a href="libs/plasma/html/index.html">libplasma documentation</a>.
Other components that reside here are:
- KCheckPass, a simple program for checking whether a password is correct
- KCMInit, which allows KDE control modules to do initialization at the
start of a KDE session, for example setting the keyboard repeat rate
- KDM, the login manager for KDE
- KHotKeys, a daemon that allows actions to be performed when certain
combinations of keys are pressed
- Klipper, the KDE clipboard manager
- KMenuEdit, the manager for the desktop menu (the K menu)
- KRunner, which provides the launch ("run command") dialog, screensaver
activation and screen locking and control of application startup notification
- KScreenSaver, which provides pretty screensavers and is launched by
KRunner
- KSMServer, the KDE session manager
- KSplash, the KDE splashscreen program
- KStartupConfig, which allows configuration files to be used in startkde
without linking to KDE libraries
- KTip, that little window that pops up when you start KDE with the Tip of
the Day
- SystemSettings, the KDE configuration program
- <a href="../solid/html/index.html">Various Solid components</a> useful in a
KDE session
- StartKDE, the script that starts a KDE session
- Some wallpapers, and a basic K menu setup
@warning The applications and libraries in Workspace are only required to work
with X11. They will not be used on Windows or MacOS, or in other desktop
environments (such as GNOME). Applications should not depend on Workspace
unless they are a desktop component, such as a screensaver or a plasmoid.
@licenses
@gpl
*/
// DOXYGEN_SET_PROJECT_NAME = Workspace
// vim:ts=4:sw=4:expandtab:filetype=doxygen

1
README Normal file
View file

@ -0,0 +1 @@
KDE Workspace consisting of what is the desktop. The applications and libraries included aren't required to be portable and probably will only work with X11. On other desktops such as OS X and Windows, users wouldn't run these applications, but use the native ones instead. The typical application shouldn't have dependencies in workspace unless they are a component such as a screen-saver or panel applet.

72
README.pam Normal file
View file

@ -0,0 +1,72 @@
KDE can be configured to support the PAM ("Pluggable Authentication
Modules") system for password checking by the display manager kdm and
by the screen saver kscreensaver (for unlocking the display).
PAM is a flexible application-transparent configurable user-authentication
system found on FreeBSD, Solaris, and Linux (and maybe other unixes).
Information about PAM may be found on its homepage
http://www.kernel.org/pub/linux/libs/pam/
(Despite the location, this information is NOT Linux-specific.)
Known Solaris Issues:
--------------------
For compiling PAM support on Solaris, PAM_MESSAGE_CONST must NOT
be defined. This should now be handled automatically by the
configure script.
Using PAM
---------
By default, PAM is automatically used, if it is found. Use
./configure --without-pam to disable it.
If PAM is found, KDE usually uses the PAM service "kde". You may
override it for all KDE programs by using --with-pam=<service> and/or
individually by using --with-<prog>-pam=<service>, where <prog> is
one of kdm, kcp and kss (for kdm, kcheckpass and kscreensaver).
"make install" will attempt to create suitable service definitions; either
by putting files into /etc/pam.d/ or by adding text to /etc/pam.conf. The
services are just copies of the "login" service.
You may want to edit these definitions to meet your needs.
There are also two example service definitions in this directory -
kde.pamd and kscreensaver.pamd - but don't just copy them!
If the services are misconfigured, you will NOT be able to login via KDM
and/or unlock a locked screen!
If there is ever any doubt about which PAM service a program was
compiled with, it can be determined by examining the PAM-generated
entries in the system log associated with kdm logins or kscreensaver
authentication failures.
PAM configuration files have four types of entries for each service:
type used by kdm used by kscreensaver
---- ----------- --------------------
auth x x
account x
password x
session x
There may be more than one entry of each type. Check existing PAM
configuration files and PAM documentation on your system for guidance as
to what entries to make. If you call a PAM service that is not
configured, the default action of PAM is likely to be denial of service.
Note: kdm implements PAM "session" support, which is not implemented in
certain PAM-aware xdm's that it may be replacing (e.g., the Red Hat
Linux 5.x xdm did not implement it). This may be configured to carry out
actions when a user opens or closes an kdm session, if a suitable PAM
module is available (e.g., mount and unmount user-specific filesystems).
Note 2: Screensavers typically only authenticate a user to allow her to
continue working. They may also renew tokens etc., where supported.
See the Linux PAM Administrators guide, which is part of the PAM
distribution, for more details.

37
appmenu/CMakeLists.txt Normal file
View file

@ -0,0 +1,37 @@
include_directories(
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
)
include_directories(${DBUSMENUQT_INCLUDE_DIR})
set(kded_appmenu_SRCS
appmenu.cpp
menuimporter.cpp
appmenu_dbus.cpp
menubutton.cpp
menuwidget.cpp
menubar.cpp
topmenubar.cpp
glowbar.cpp
verticalmenu.cpp
shadows.cpp
)
qt4_add_dbus_adaptor(kded_appmenu_SRCS com.canonical.AppMenu.Registrar.xml
menuimporter.h MenuImporter menuimporteradaptor MenuImporterAdaptor)
qt4_add_dbus_adaptor(kded_appmenu_SRCS org.kde.kded.appmenu.xml
appmenu_dbus.h AppmenuDBus appmenuadaptor AppmenuAdaptor)
kde4_add_plugin(kded_appmenu ${kded_appmenu_SRCS})
target_link_libraries(kded_appmenu ${KDE4_KIO_LIBS} ${X11_LIBRARIES} ${DBUSMENUQT_LIBRARIES} ${KDE4_PLASMA_LIBS})
install(TARGETS kded_appmenu DESTINATION ${PLUGIN_INSTALL_DIR} )
########### install files ###############
install( FILES appmenu.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded )
install( FILES com.canonical.AppMenu.Registrar.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} )
install( FILES org.kde.kded.appmenu.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} )

399
appmenu/appmenu.cpp Normal file
View file

@ -0,0 +1,399 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#include "appmenu.h"
#include "kdbusimporter.h"
#include "menuimporteradaptor.h"
#include "appmenuadaptor.h"
#include "appmenu_dbus.h"
#include "topmenubar.h"
#include "verticalmenu.h"
#include <QDBusInterface>
#include <QDBusReply>
#include <QDBusPendingCallWatcher>
#include <QMenu>
#include <QApplication>
#include <QDesktopWidget>
#include <KDebug>
#include <KWindowSystem>
#include <KWindowInfo>
#include <KConfig>
#include <KConfigGroup>
#include <kpluginfactory.h>
#include <kpluginloader.h>
#include <netwm.h>
K_PLUGIN_FACTORY(AppMenuFactory,
registerPlugin<AppMenuModule>();
)
K_EXPORT_PLUGIN(AppMenuFactory("appmenu"))
AppMenuModule::AppMenuModule(QObject* parent, const QList<QVariant>&)
: KDEDModule(parent),
m_parent(parent),
m_menuImporter(0),
m_appmenuDBus(new AppmenuDBus(parent)),
m_menubar(0),
m_menu(0),
m_screenTimer(new QTimer(this)),
m_waitingAction(0),
m_currentScreen(-1)
{
reconfigure();
m_appmenuDBus->connectToBus();
m_currentScreen = currentScreen();
connect(m_appmenuDBus, SIGNAL(appShowMenu(int, int, WId)), SLOT(slotShowMenu(int, int, WId)));
connect(m_appmenuDBus, SIGNAL(moduleReconfigure()), SLOT(reconfigure()));
// transfer our signals to dbus
connect(this, SIGNAL(showRequest(qulonglong)), m_appmenuDBus, SIGNAL(showRequest(qulonglong)));
connect(this, SIGNAL(menuAvailable(qulonglong)), m_appmenuDBus, SIGNAL(menuAvailable(qulonglong)));
connect(this, SIGNAL(clearMenus()), m_appmenuDBus, SIGNAL(clearMenus()));
connect(this, SIGNAL(menuHidden(qulonglong)), m_appmenuDBus, SIGNAL(menuHidden(qulonglong)));
connect(this, SIGNAL(WindowRegistered(qulonglong, const QString&, const QDBusObjectPath&)),
m_appmenuDBus, SIGNAL(WindowRegistered(qulonglong, const QString&, const QDBusObjectPath&)));
connect(this, SIGNAL(WindowUnregistered(qulonglong)), m_appmenuDBus, SIGNAL(WindowUnregistered(qulonglong)));
}
AppMenuModule::~AppMenuModule()
{
emit clearMenus();
hideMenubar();
if (m_menubar) {
delete m_menubar;
}
delete m_menuImporter;
delete m_appmenuDBus;
}
void AppMenuModule::slotShowMenu(int x, int y, WId id)
{
static KDBusMenuImporter *importer = 0;
if (!m_menuImporter) {
return;
}
// If menu visible, hide it
if (m_menu && m_menu->isVisible()) {
m_menu->hide();
return;
}
//dbus call by user (for khotkey shortcut)
if (x == -1 || y == -1) {
// We do not know kwin button position, so tell kwin to show menu
emit showRequest(KWindowSystem::self()->activeWindow());
return;
}
importer = getImporter(id);
if (!importer) {
return;
}
QMenu *menu = importer->menu();
// Window do not have menu
if (!menu) {
return;
}
m_menu = new VerticalMenu();
m_menu->setParentWid(id);
// Populate menu
foreach (QAction *action, menu->actions()) {
m_menu->addAction(action);
}
m_menu->popup(QPoint(x, y));
// Activate waiting action if exist
if (m_waitingAction) {
m_menu->setActiveAction(m_waitingAction);
m_waitingAction = 0;
}
connect(m_menu, SIGNAL(aboutToHide()), this, SLOT(slotAboutToHide()));
}
void AppMenuModule::slotAboutToHide()
{
if (m_menu) {
emit menuHidden(m_menu->parentWid());
m_menu->deleteLater();
m_menu = 0;
}
}
// New window registered
void AppMenuModule::slotWindowRegistered(WId id, const QString& service, const QDBusObjectPath& path)
{
KDBusMenuImporter* importer = m_importers.take(id);
if (importer) {
delete importer;
}
// Application already active so check if we need create menubar
if ( m_menuStyle == "TopMenuBar" && id == KWindowSystem::self()->activeWindow()) {
slotActiveWindowChanged(id);
} else if (m_menuStyle == "ButtonVertical") {
KWindowInfo info = KWindowSystem::windowInfo(id, 0, NET::WM2WindowClass);
// Tell Kwin menu is available
emit menuAvailable(id);
// FIXME: https://bugs.kde.org/show_bug.cgi?id=317926
if (info.windowClassName() != "kmix") {
getImporter(id);
}
}
// Send a signal on bus for others dbus interface registrars
emit WindowRegistered(id, service, path);
}
// Window unregistered
void AppMenuModule::slotWindowUnregistered(WId id)
{
KDBusMenuImporter* importer = m_importers.take(id);
// Send a signal on bus for others dbus interface registrars
emit WindowUnregistered(id);
if (importer) {
delete importer;
}
if (m_menubar && m_menubar->parentWid() == id) {
hideMenubar();
}
}
// Keyboard activation requested, transmit it to menu
void AppMenuModule::slotActionActivationRequested(QAction* a)
{
// If we have a topmenubar, activate action
if (m_menubar) {
m_menubar->setActiveAction(a);
m_menubar->show();
} else { // else send request to kwin or others dbus interface registrars
m_waitingAction = a;
emit showRequest(KWindowSystem::self()->activeWindow());
}
}
// Current window change, update menubar
// See comments in slotWindowRegistered() for why we get importers here
void AppMenuModule::slotActiveWindowChanged(WId id)
{
KWindowInfo info = KWindowSystem::windowInfo(id, NET::WMWindowType);
unsigned long mask = NET::AllTypesMask;
m_currentScreen = currentScreen();
if (id == 0) {// Ignore root window
return;
} else if (info.windowType(mask) & NET::Dock) { // Hide immediatly menubar for docks (krunner)
hideMenubar();
return;
}
if (!m_menuImporter->serviceExist(id)) { // No menu exist, check for another menu for application
WId recursiveId = m_menuImporter->recursiveMenuId(id);
if (recursiveId) {
id = recursiveId;
}
}
KDBusMenuImporter *importer = getImporter(id);
if (!importer) {
hideMenubar();
return;
}
QMenu *menu = importer->menu();
if(menu) {
showMenuBar(menu);
m_menubar->setParentWid(id);
} else {
hideMenubar();
}
}
void AppMenuModule::slotShowCurrentWindowMenu()
{
slotActiveWindowChanged(KWindowSystem::self()->activeWindow());
}
void AppMenuModule::slotCurrentScreenChanged()
{
if (m_currentScreen != currentScreen()) {
if (m_menubar) {
m_menubar->setParentWid(0);
}
slotActiveWindowChanged(KWindowSystem::self()->activeWindow());
}
}
void AppMenuModule::slotBarNeedResize()
{
if (m_menubar) {
m_menubar->updateSize();
m_menubar->move(centeredMenubarPos());
}
}
// reload settings
void AppMenuModule::reconfigure()
{
KConfig config( "kdeglobals", KConfig::FullConfig );
KConfigGroup configGroup = config.group("Appmenu Style");
m_menuStyle = configGroup.readEntry("Style", "InApplication");
m_waitingAction = 0;
// hide menubar if exist
hideMenubar();
if (m_menubar) {
delete m_menubar;
m_menubar = 0;
}
slotAboutToHide(); // hide vertical menu if exist
// Disconnect all options specifics signals
disconnect(KWindowSystem::self(), SIGNAL(activeWindowChanged(WId)), this, SLOT(slotActiveWindowChanged(WId)));
disconnect(KWindowSystem::self(), SIGNAL(workAreaChanged()), this, SLOT(slotShowCurrentWindowMenu()));
disconnect(m_screenTimer, SIGNAL(timeout()), this, SLOT(slotCurrentScreenChanged()));
m_screenTimer->stop();
// Tell kwin to clean its titlebar
emit clearMenus();
if (m_menuStyle == "InApplication") {
if (m_menuImporter) {
delete m_menuImporter;
m_menuImporter = 0;
}
return;
}
// Setup a menu importer if needed
if (!m_menuImporter) {
m_menuImporter = new MenuImporter(m_parent);
connect(m_menuImporter, SIGNAL(WindowRegistered(WId, const QString&, const QDBusObjectPath&)),
SLOT(slotWindowRegistered(WId, const QString&, const QDBusObjectPath&)));
connect(m_menuImporter, SIGNAL(WindowUnregistered(WId)),
SLOT(slotWindowUnregistered(WId)));
m_menuImporter->connectToBus();
}
if( m_menuStyle == "ButtonVertical" ) {
foreach(WId id, m_menuImporter->ids()) {
emit menuAvailable(id);
}
}
// Setup top menubar if needed
if (m_menuStyle == "TopMenuBar") {
m_menubar = new TopMenuBar();
connect(KWindowSystem::self(), SIGNAL(activeWindowChanged(WId)), this, SLOT(slotActiveWindowChanged(WId)));
connect(KWindowSystem::self(), SIGNAL(workAreaChanged()), this, SLOT(slotShowCurrentWindowMenu()));
connect(m_screenTimer, SIGNAL(timeout()), this, SLOT(slotCurrentScreenChanged()));
connect(m_menubar, SIGNAL(needResize()), SLOT(slotBarNeedResize()));
m_screenTimer->start(1000);
slotShowCurrentWindowMenu();
}
}
KDBusMenuImporter* AppMenuModule::getImporter(WId id)
{
KDBusMenuImporter* importer = 0;
if (m_importers.contains(id)) { // importer already exist
importer = m_importers.value(id);
} else if (m_menuImporter->serviceExist(id)) { // get importer
importer = new KDBusMenuImporter(id, m_menuImporter->serviceForWindow(id), &m_icons,
m_menuImporter->pathForWindow(id), this);
if (importer) {
QMetaObject::invokeMethod(importer, "updateMenu", Qt::DirectConnection);
connect(importer, SIGNAL(actionActivationRequested(QAction*)),
SLOT(slotActionActivationRequested(QAction*)));
m_importers.insert(id, importer);
}
}
return importer;
}
void AppMenuModule::showMenuBar(QMenu *menu)
{
if (!menu) {
return;
}
m_menubar->setMenu(menu);
if (menu->actions().length()) {
m_menubar->enableMouseTracking();
}
}
void AppMenuModule::hideMenubar()
{
if (!m_menubar) {
return;
}
m_menubar->enableMouseTracking(false);
if (m_menubar->isVisible()) {
m_menubar->hide();
}
}
int AppMenuModule::currentScreen()
{
KWindowInfo info = KWindowSystem::windowInfo(KWindowSystem::self()->activeWindow(),
NET::WMGeometry);
int x = info.geometry().x();
int y = info.geometry().y();
QDesktopWidget *desktop = QApplication::desktop();
return desktop->screenNumber(QPoint(x,y));
}
QPoint AppMenuModule::centeredMenubarPos()
{
QDesktopWidget *desktop = QApplication::desktop();
m_currentScreen = currentScreen();
QRect screen = desktop->availableGeometry(m_currentScreen);
int x = screen.center().x() - m_menubar->sizeHint().width()/2;
return QPoint(x, screen.topLeft().y());
}
#include "appmenu.moc"

96
appmenu/appmenu.desktop Normal file
View file

@ -0,0 +1,96 @@
[Desktop Entry]
Type=Service
Name=Application menus daemon
Name[bs]=Demon za aplikacijske menije
Name[ca]=Dimoni de menús d'aplicació
Name[ca@valencia]=Dimoni de menús d'aplicació
Name[cs]=Démon nabídky aplikací
Name[da]=Dæmon til programmenuer
Name[de]=Dienst für Anwendungsmenüs
Name[el]=Δαίμων για τα μενού των εφαρμογών
Name[en_GB]=Application menus daemon
Name[es]=Demonio de menús de aplicación
Name[et]=Rakenduste menüü deemon
Name[eu]=Aplikazio-menuen daimona
Name[fi]=Sovellusvalikkopalvelu
Name[fr]=Démon de menus des applications
Name[gl]=Daemon de menús do programa
Name[he]=תהליך רקע של תפריט היישומים
Name[hu]=Alkalmazás menük démon
Name[ia]=Demone de menus de application
Name[it]=Demone dei menu delle applicazioni
Name[kk]=Қолданба мәзірінің қызметі
Name[ko]=
Name[lt]=Programos meniu tarnyba
Name[mr]=
Name[nb]=Daemon for programmenyer
Name[nds]=Programmmenü-Dämoon
Name[nl]=Daemon voor menu van toepassingen
Name[pa]=
Name[pl]=Demon menu programów
Name[pt]=Servidor dos menus da aplicação
Name[pt_BR]=Servidor dos menus do aplicativo
Name[ro]=Demon pentru meniurile aplicațiilor
Name[ru]=Фоновая служба меню приложений
Name[sk]=Démon ponúk aplikácie
Name[sl]=Ozadnji program za programske menije
Name[sr]=Демон програмских менија
Name[sr@ijekavian]=Демон програмских менија
Name[sr@ijekavianlatin]=Demon programskih menija
Name[sr@latin]=Demon programskih menija
Name[sv]=Demon för programmenyer
Name[tr]=Uygulama menü araçları
Name[uk]=Фонова служба меню програм
Name[x-test]=xxApplication menus daemonxx
Name[zh_CN]=
Name[zh_TW]=
Comment=Transfers application's menu to the desktop
Comment[bs]=Prebacuje aplikacijski meni na radnu površinu
Comment[ca]=Transfereix els menús d'aplicació a l'escriptori
Comment[ca@valencia]=Transfereix els menús d'aplicació a l'escriptori
Comment[cs]=Přesouvá nabídku aplikací na plochu
Comment[da]=Overfører programmets menu til skrivebordet
Comment[de]=Überträgt Anwendungsmenüs auf die Arbeitsfläche
Comment[el]=Μεταφέρει το μενού της εφαρμογής στην επιφάνεια εργασίας
Comment[en_GB]=Transfers application's menu to the desktop
Comment[es]=Transfiere el menú de aplicaciones al escritorio
Comment[et]=Rakenduste menüü paigutamine töölauale
Comment[eu]=Aplikazioen menua mahaigainera transferitzen du
Comment[fi]=Siirtää sovelluksen valikon työpöydälle
Comment[fr]=Transfère le menu des applications sur le bureau
Comment[gl]=Transfire o menú do programa ao escritorio
Comment[he]=מעביר את התפריטים של היישום אל שולחן העבודה
Comment[hu]=Átviszi az alkalmazás menüjét az asztalra
Comment[ia]=Il transfere menu de applicationes al scriptorio
Comment[it]=Trasferisce al desktop i menu delle applicazioni
Comment[kk]=Қолданбаның мәзірін үстел бетіне тапсыру
Comment[ko]=
Comment[lt]=Perkelia programos meniu į darbastalį
Comment[mr]=
Comment[nb]=Overfører programmets meny til skrivebordet
Comment[nds]=Dat Programmmenü na den Schriefdisch överdregen
Comment[nl]=Brengt het menu van de toepassing over naar het bureaublad
Comment[pa]=
Comment[pl]=Przenosi menu aplikacji na pulpit
Comment[pt]=Transfere o menu da aplicação para o ecrã
Comment[pt_BR]=Transfere o menu do aplicativo para a área de trabalho
Comment[ro]=Transferă meniul aplicațiilor către birou
Comment[ru]=Перемещает меню приложения на рабочий стол
Comment[sk]=Presunúť ponuky aplikácie na plochu
Comment[sl]=Prenese programski meni na namizje
Comment[sr]=Пребацује меније програма на површ
Comment[sr@ijekavian]=Пребацује меније програма на површ
Comment[sr@ijekavianlatin]=Prebacuje menije programa na površ
Comment[sr@latin]=Prebacuje menije programa na površ
Comment[sv]=Överför programmets meny till skrivbordet
Comment[tr]=Uygulamanın menüsünü masaüstüne aktarır
Comment[uk]=Передає меню програм на стільницю
Comment[x-test]=xxTransfers application's menu to the desktopxx
Comment[zh_CN]=
Comment[zh_TW]=
X-KDE-ServiceTypes=KDEDModule
X-KDE-Library=appmenu
X-KDE-DBus-ModuleName=appmenu
X-KDE-Kded-autoload=true
X-KDE-Kded-load-on-demand=false

154
appmenu/appmenu.h Normal file
View file

@ -0,0 +1,154 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#ifndef APPMENUMODULE_H
#define APPMENUMODULE_H
#include <kdedmodule.h>
#include "menuimporter.h"
#include "gtkicons.h"
class QDBusPendingCallWatcher;
class KDBusMenuImporter;
class AppmenuDBus;
class TopMenuBar;
class VerticalMenu;
class AppMenuModule : public KDEDModule,
protected QDBusContext
{
Q_OBJECT
public:
AppMenuModule(QObject* parent, const QList<QVariant>& list);
virtual ~AppMenuModule();
Q_SIGNALS:
/**
* We do not know where is menu decoration button, so tell kwin to show menu
*/
void showRequest(qulonglong);
/**
* This signal is emitted whenever application menu becomes available
*/
void menuAvailable(qulonglong);
/**
* This signal is emitted whenever menus are unavailables
*/
void clearMenus();
/**
* This signal is emitted whenever popup menu/menubar is hidden
* Useful for decorations to know if menu button should be release
*/
void menuHidden(qulonglong);
/**
* This signal is emitted whenever a window register to appmenu
*/
void WindowRegistered(qulonglong wid, const QString& service, const QDBusObjectPath&);
/**
* This signal is emitted whenever a window unregister from appmenu
*/
void WindowUnregistered(qulonglong wid);
private Q_SLOTS:
/**
* Show menu at QPoint(x,y) for id
* if x or y == -1, show in application window
*/
void slotShowMenu(int x, int y, WId);
/**
* Send menuHidden signal over bus when menu is about to hide
*/
void slotAboutToHide();
/**
* New window registered to appmenu
* Emit WindowRegistered signal over bus
*/
void slotWindowRegistered(WId id, const QString& service, const QDBusObjectPath& path);
/**
* Window unregistered from appmenu
* Emit WindowUnregistered signal over bus
*/
void slotWindowUnregistered(WId id);
/**
* Open a action in current menu
*/
void slotActionActivationRequested(QAction* a);
/**
* Active window changed, show menubar for id
*/
void slotActiveWindowChanged(WId id);
/**
* Update menubar with current window menu
*/
void slotShowCurrentWindowMenu();
/**
* Current screen changed, update menubar
*/
void slotCurrentScreenChanged();
/**
* Resize menubar
*/
void slotBarNeedResize();
/**
* Reconfigure module
*/
void reconfigure();
private:
/**
* return an importer for window id
*/
KDBusMenuImporter* getImporter(WId id);
/**
* Show menubar and update it with menu
*/
void showMenuBar(QMenu *menu);
/**
* Hide menubar
*/
void hideMenubar();
/**
* Return current screen
*/
int currentScreen();
/**
* Return position of menubar for being centered on screen
*/
QPoint centeredMenubarPos();
QObject* m_parent;
MenuImporter* m_menuImporter;
AppmenuDBus* m_appmenuDBus;
QHash<WId, KDBusMenuImporter*> m_importers;
GtkIcons m_icons;
QString m_menuStyle;
TopMenuBar* m_menubar;
VerticalMenu* m_menu;
QTimer* m_screenTimer;
QAction *m_waitingAction;
int m_currentScreen;
};
#endif

69
appmenu/appmenu_dbus.cpp Normal file
View file

@ -0,0 +1,69 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#include "appmenu_dbus.h"
#include "kdbusimporter.h"
#include "appmenuadaptor.h"
#include <QApplication>
#include <QDBusMessage>
#include <QDBusObjectPath>
#include <QDBusServiceWatcher>
static const char* DBUS_SERVICE = "org.kde.kded";
static const char* DBUS_OBJECT_PATH = "/modules/appmenu";
AppmenuDBus::AppmenuDBus(QObject* parent)
: QObject(parent)
{
}
AppmenuDBus::~AppmenuDBus()
{
}
bool AppmenuDBus::connectToBus(const QString& service, const QString& path)
{
m_service = service.isEmpty() ? DBUS_SERVICE : service;
QString newPath = path.isEmpty() ? DBUS_OBJECT_PATH : path;
if (!QDBusConnection::sessionBus().registerService(m_service)) {
return false;
}
new AppmenuAdaptor(this);
QDBusConnection::sessionBus().registerObject(newPath, this);
return true;
}
void AppmenuDBus::showMenu(int x, int y, WId id)
{
emit appShowMenu(x, y, id);
}
void AppmenuDBus::reconfigure()
{
emit moduleReconfigure();
}

100
appmenu/appmenu_dbus.h Normal file
View file

@ -0,0 +1,100 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#ifndef APPMENU_DBUS_H
#define APPMENU_DBUS_H
// Qt
#include <QDBusContext>
#include <QDBusObjectPath>
#include <QObject>
#include <QDebug>
#include <qwindowdefs.h>
class KDBusMenuImporter;
class AppmenuDBus : public QObject, protected QDBusContext
{
Q_OBJECT
public:
AppmenuDBus(QObject*);
~AppmenuDBus();
bool connectToBus(const QString& service = QString(), const QString& path = QString());
/**
* DBus method showing menu at QPoint(x,y) for id
* if x or y == -1, show in application window
*/
void showMenu(int x, int y, WId id);
/**
* DBus method reconfiguring kded module
*/
void reconfigure();
Q_SIGNALS:
/**
* This signal is emitted on showMenu() request
*/
void appShowMenu(int x, int y, WId id);
/**
* This signal is emitted on reconfigure() request
*/
void moduleReconfigure();
// Dbus signals
/**
* This signal is emitted whenever kded want to show menu
* We do not know where is menu decoration button, so tell kwin to show menu
*/
void showRequest(qulonglong);
/**
* This signal is emitted whenever application menu becomes available
*/
void menuAvailable(qulonglong);
/**
* This signal is emitted whenever menus are unavailables
*/
void clearMenus();
/**
* This signal is emitted whenever popup menu/menubar is hidden
* Useful for decorations to know if menu button should be release
*/
void menuHidden(qulonglong);
/**
* This signal is emitted whenever a window register to appmenu
*/
void WindowRegistered(qulonglong wid, const QString& service, const QDBusObjectPath&);
/**
* This signal is emitted whenever a window unregister from appmenu
*/
void WindowUnregistered(qulonglong wid);
private:
QString m_service;
};
#endif // APPMENU_DBUS_H

View file

@ -0,0 +1,56 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node xmlns:dox="http://www.ayatana.org/dbus/dox.dtd">
<dox:d><![CDATA[
@mainpage
 
An interface to register menus that are associated with a window in an application.  The
main interface is docuemented here: @ref com::canonical::AppMenu::Registrar.
    
The actual menus are transported using the dbusmenu protocol which is available
here: @ref com::canonical::dbusmenu.
]]></dox:d>
<interface name="com.canonical.AppMenu.Registrar" xmlns:dox="http://www.ayatana.org/dbus/dox.dtd">
<dox:d>
An interface to register a menu from an application's window to be displayed in another
window.  This manages that association between XWindow Window IDs and the dbus
address and object that provides the menu using the dbusmenu dbus interface.
</dox:d>
<method name="RegisterWindow">
<dox:d><![CDATA[
Associates a dbusmenu with a window
     
/note this method assumes that the connection from the caller is the DBus connection
to use for the object.  Applications that use multiple DBus connections will need to
ensure this method is called with the same connection that implmenets the object.
]]></dox:d>
<arg name="windowId" type="u" direction="in">
<dox:d>The XWindow ID of the window</dox:d>
</arg>
<arg name="menuObjectPath" type="o" direction="in">
<dox:d>The object on the dbus interface implementing the dbusmenu interface</dox:d>
</arg>
</method>
<method name="UnregisterWindow">
<dox:d>
A method to allow removing a window from the database. Windows will also be removed
when the client drops off DBus so this is not required. It is polite though. And
important for testing.
</dox:d>
<arg name="windowId" type="u" direction="in">
<dox:d>The XWindow ID of the window</dox:d>
</arg>
</method>
<method name="GetMenuForWindow">
<dox:d>Gets the registered menu for a given window ID.</dox:d>
<arg name="windowId" type="u" direction="in">
<dox:d>The XWindow ID of the window to get</dox:d>
</arg>
<arg name="service" type="s" direction="out">
<dox:d>The address of the connection on DBus (e.g. :1.23 or org.example.service)</dox:d>
</arg>
<arg name="menuObjectPath" type="o" direction="out">
<dox:d>The path to the object which implements the com.canonical.dbusmenu interface.</dox:d>
</arg>
</method>
</interface>
</node>

109
appmenu/glowbar.cpp Normal file
View file

@ -0,0 +1,109 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#include "glowbar.h"
#include <X11/extensions/shape.h>
#include <fixx11h.h>
#include <Plasma/Svg>
#include <KWindowSystem>
#include <KDebug>
#include <QTimer>
#include <QDebug>
#include <QPainter>
#include <QX11Info>
GlowBar::GlowBar()
: QWidget(0),
m_svg(new Plasma::Svg(this))
{
m_svg->setImagePath("widgets/glowbar");
setWindowFlags(Qt::Tool | Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint);
setAttribute(Qt::WA_TranslucentBackground);
setAutoFillBackground(false);
KWindowSystem::setType(winId(), NET::Dock);
QPalette pal = palette();
pal.setColor(backgroundRole(), Qt::transparent);
setPalette(pal);
setInputMask();
}
GlowBar::~GlowBar()
{
}
void GlowBar::paintEvent(QPaintEvent*)
{
QPixmap l, r, c;
QPoint pixmapPosition(0, 0);
m_buffer.fill(QColor(0, 0, 0, int(qreal(255)*0.3)));
QPainter p(&m_buffer);
p.setCompositionMode(QPainter::CompositionMode_SourceIn);
l = m_svg->pixmap("bottomleft");
r = m_svg->pixmap("bottomright");
c = m_svg->pixmap("bottom");
p.drawPixmap(pixmapPosition, l);
p.drawTiledPixmap(QRect(l.width(), pixmapPosition.y(), width() - l.width() - r.width(), c.height()), c);
p.drawPixmap(QPoint(width() - r.width(), pixmapPosition.y()), r);
p.end();
p.begin(this);
p.drawPixmap(QPoint(0, 0), m_buffer);
}
void GlowBar::setPixmap(const QPoint pos, uint width)
{
QRect zone = QRect(pos, QSize(width, 10));
setGeometry(zone);
m_buffer = QPixmap(zone.size());
}
void GlowBar::setInputMask()
{
// Create an empty input mask to achieve click-through effect
// Thanks to MacSlow for this!
Pixmap mask;
mask = XCreatePixmap(QX11Info::display(),
winId(),
1, /* width */
1, /* height */
1 /* depth */);
XShapeCombineMask(QX11Info::display(),
winId(),
ShapeInput,
0, /* x-offset */
0, /* y-offset */
mask,
ShapeSet);
XFreePixmap(QX11Info::display(), mask);
}
#include "glowbar.moc"

51
appmenu/glowbar.h Normal file
View file

@ -0,0 +1,51 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#ifndef GLOWBAR__H
#define GLOWBAR__H
#include <QWidget>
namespace Plasma
{
class Svg;
}
class GlowBar : public QWidget
{
Q_OBJECT
public:
GlowBar();
~GlowBar();
void paintEvent(QPaintEvent*);
void setPixmap(const QPoint pos, uint width);
private:
void setInputMask();
Plasma::Svg *m_svg;
QPixmap m_buffer;
};
#endif

146
appmenu/gtkicons.h Normal file
View file

@ -0,0 +1,146 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#ifndef GTKICONS_H
#define GTKICONS_H
#include <QtCore/QMap>
class GtkIcons : public QMap<QString, QString>
{
public:
GtkIcons( void ) : QMap<QString, QString> ()
{
insert(QString("gnome-fs-directory"), QString("folder.png"));
insert(QString("gnome-fs-regular.png"), QString("application-x-zerosize.png"));
insert(QString("gtk-about"), QString("help-about.png"));
insert(QString("gtk-add"), QString("list-add.png"));
insert(QString("gtk-apply"), QString("dialog-ok-apply.png ok-apply.png apply.png"));
insert(QString("gtk-bold"), QString("format-text-bold.png"));
insert(QString("gtk-cancel"), QString("dialog-cancel.png cancel.png"));
insert(QString("gtk-cdrom"), QString("media-optical.png"));
insert(QString("gtk-clear"), QString("edit-clear.png"));
insert(QString("gtk-close"), QString("window-close.png"));
insert(QString("gtk-color-picker"), QString("color-picker.png"));
insert(QString("gtk-connect"), QString("network-connect.png"));
insert(QString("gtk-convert"), QString("document-export.png"));
insert(QString("gtk-copy"), QString("edit-copy.png"));
insert(QString("gtk-cut"), QString("edit-cut.png"));
insert(QString("gtk-delete"), QString("edit-delete.png"));
insert(QString("gtk-dialog-authentication"), QString("dialog-password.png document-encrypt.png object-locked.png"));
insert(QString("gtk-dialog-error"), QString("dialog-error.png"));
insert(QString("gtk-dialog-info"), QString("dialog-information.png"));
insert(QString("gtk-dialog-question"), QString("dialog-information.png"));
insert(QString("gtk-dialog-warning"), QString("dialog-warning.png"));
insert(QString("gtk-directory"), QString("folder.png"));
insert(QString("gtk-disconnect"), QString("network-disconnect.png"));
insert(QString("gtk-dnd"), QString("application-x-zerosize.png"));
insert(QString("gtk-dnd-multiple"), QString("document-multiple.png"));
insert(QString("gtk-edit"), QString("document-properties.png"));
insert(QString("gtk-execute"), QString("fork.png"));
insert(QString("gtk-file"), QString("application-x-zerosize.png"));
insert(QString("gtk-find"), QString("edit-find.png"));
insert(QString("gtk-find-and-replace"), QString("edit-find-replace.png"));
insert(QString("gtk-floppy"), QString("media-floppy.png"));
insert(QString("gtk-fullscreen"), QString("view-fullscreen.png"));
insert(QString("gtk-goto-bottom"), QString("go-bottom.png"));
insert(QString("gtk-goto-first"), QString("go-first.png"));
insert(QString("gtk-goto-last"), QString("go-last.png"));
insert(QString("gtk-goto-top"), QString("go-top.png"));
insert(QString("gtk-go-back"), QString("go-previous.png"));
insert(QString("gtk-go-back-ltr"), QString("go-previous.png"));
insert(QString("gtk-go-back-rtl"), QString("go-next.png"));
insert(QString("gtk-go-down"), QString("go-down.png"));
insert(QString("gtk-go-forward"), QString("go-next.png"));
insert(QString("gtk-go-forward-ltr"), QString("go-next.png"));
insert(QString("gtk-go-forward-rtl"), QString("go-previous.png"));
insert(QString("gtk-go-up"), QString("go-up.png"));
insert(QString("gtk-harddisk"), QString("drive-harddisk.png"));
insert(QString("gtk-help"), QString("help-contents.png"));
insert(QString("gtk-home"), QString("go-home.png"));
insert(QString("gtk-indent"), QString("format-indent-more.png"));
insert(QString("gtk-index"), QString("help-contents.png"));
insert(QString("gtk-info"), QString("help-about.png"));
insert(QString("gtk-italic"), QString("format-text-italic.png"));
insert(QString("gtk-jump-to"), QString("go-jump.png"));
insert(QString("gtk-justify-center"), QString("format-justify-center.png"));
insert(QString("gtk-justify-fill"), QString("format-justify-fill.png"));
insert(QString("gtk-justify-left"), QString("format-justify-left.png"));
insert(QString("gtk-justify-right"), QString("format-justify-right.png"));
insert(QString("gtk-leave-fullscreen"), QString("view-restore.png"));
insert(QString("gtk-media-forward"), QString("media-seek-forward.png"));
insert(QString("gtk-media-next"), QString("media-skip-forward.png"));
insert(QString("gtk-media-pause"), QString("media-playback-pause.png"));
insert(QString("gtk-media-play"), QString("media-playback-start.png"));
insert(QString("gtk-media-previous"), QString("media-skip-backward.png"));
insert(QString("gtk-media-record"), QString("media-record.png"));
insert(QString("gtk-media-rewind"), QString("media-seek-backward.png"));
insert(QString("gtk-media-stop"), QString("media-playback-stop.png"));
insert(QString("gtk-missing-image"), QString("unknown.png"));
insert(QString("gtk-network"), QString("network-server.png"));
insert(QString("gtk-new"), QString("document-new.png"));
insert(QString("gtk-no"), QString("edit-delete.png"));
insert(QString("gtk-ok"), QString("dialog-ok.png ok.png"));
insert(QString("gtk-open"), QString("document-open.png"));
insert(QString("gtk-paste"), QString("edit-paste.png"));
insert(QString("gtk-preferences"), QString("configure.png"));
insert(QString("gtk-print"), QString("document-print.png"));
insert(QString("gtk-print-preview"), QString("document-print-preview.png"));
insert(QString("gtk-properties"), QString("document-properties.png"));
insert(QString("gtk-quit"), QString("application-exit.png"));
insert(QString("gtk-redo"), QString("edit-redo.png"));
insert(QString("gtk-refresh"), QString("view-refresh.png"));
insert(QString("gtk-remove"), QString("edit-delete.png"));
insert(QString("gtk-revert-to-saved"), QString("document-revert.png"));
insert(QString("gtk-save"), QString("document-save.png"));
insert(QString("gtk-save-as"), QString("document-save-as.png"));
insert(QString("gtk-select-all"), QString("edit-select-all.png"));
insert(QString("gtk-select-color"), QString("color-picker.png"));
insert(QString("gtk-select-font"), QString("preferences-desktop-font.png"));
insert(QString("gtk-sort-ascending"), QString("view-sort-ascending.png"));
insert(QString("gtk-sort-descending"), QString("view-sort-descending.png"));
insert(QString("gtk-spell-check"), QString("tools-check-spelling.png"));
insert(QString("gtk-stop"), QString("process-stop.png"));
insert(QString("gtk-strikethrough"), QString("format-text-strikethrough.png"));
insert(QString("gtk-undelete"), QString("edit-undo.png"));
insert(QString("gtk-underline"), QString("format-text-underline.png"));
insert(QString("gtk-undo"), QString("edit-undo.png"));
insert(QString("gtk-unindent"), QString("format-indent-less.png"));
insert(QString("gtk-yes"), QString("dialog-ok.png ok.png"));
insert(QString("gtk-zoom-100"), QString("zoom-original.png"));
insert(QString("gtk-zoom-fit"), QString("zoom-fit-best.png"));
insert(QString("gtk-zoom-in"), QString("zoom-in.png"));
insert(QString("gtk-zoom-out"), QString("zoom-out.png"));
insert(QString("stock_edit-bookmark"), QString("bookmarks-organize.png"));
insert(QString("gimp-edit"), QString("edit.png"));
insert(QString("gimp-info"), QString("dialog-information.png"));
insert(QString("gimp-reset"), QString("reload.png"));
insert(QString("gimp-warning"), QString("dialog-warning.png"));
insert(QString("gimp-tool-options"), QString("tool.png"));
insert(QString("gimp-images"), QString("image.png"));
}
};
#endif // GTKICONS_H

75
appmenu/kdbusimporter.h Normal file
View file

@ -0,0 +1,75 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#ifndef KDBUSMENUIMPORTER_H
#define KDBUSMENUIMPORTER_H
#include "gtkicons.h"
#include <KIcon>
#include <KIconLoader>
#include <QDBusArgument>
#include <dbusmenuimporter.h>
class KDBusMenuImporter : public DBusMenuImporter
{
public:
KDBusMenuImporter(WId wid, const QString &service, GtkIcons *icons, const QString &path, QObject *parent)
: DBusMenuImporter(service, path, parent)
, m_service(service)
, m_path(path)
, m_WId(wid)
{
m_icons = icons;
}
QString service() const { return m_service; }
QString path() const { return m_path; }
WId wid() const { return m_WId; }
protected:
virtual QIcon iconForName(const QString &name)
{
KIcon icon;
if(m_icons->contains(name)){
icon = KIcon(m_icons->value(name));
}
else if(!KIconLoader::global()->iconPath(name, 1, true ).isNull()){
icon = KIcon(name);
}
return icon;
}
private:
GtkIcons *m_icons;
QString m_service;
QString m_path;
WId m_WId;
};
#endif //KDBUSMENUIMPORTER_H

166
appmenu/menubar.cpp Normal file
View file

@ -0,0 +1,166 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#include "menubar.h"
#include "shadows.h"
#include <QGraphicsLinearLayout>
#include <QPainter>
#include <QMenu>
#include <QDesktopWidget>
#include <QGraphicsDropShadowEffect>
#include <KWindowSystem>
#include <Plasma/FrameSvg>
#include <Plasma/Theme>
#include <Plasma/WindowEffects>
#include <KApplication>
MenuBar::MenuBar()
: QGraphicsView(),
m_hideTimer(new QTimer(this)),
m_background(new Plasma::FrameSvg(this)),
m_shadows(new Shadows(this)),
m_scene(new QGraphicsScene(this)),
m_container(new MenuWidget(this))
{
qreal left, top, right, bottom;
//Setup the window properties
setWindowFlags(Qt::Tool|Qt::X11BypassWindowManagerHint|Qt::WindowStaysOnTopHint);
setAttribute(Qt::WA_TranslucentBackground);
KWindowSystem::setType(winId(), NET::Dock);
setFrameStyle(QFrame::NoFrame);
viewport()->setAutoFillBackground(false);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
//Setup the widgets
m_background->setImagePath("widgets/tooltip");
m_background->setEnabledBorders(Plasma::FrameSvg::BottomBorder|Plasma::FrameSvg::LeftBorder|Plasma::FrameSvg::RightBorder);
m_container->initLayout();
m_scene->addItem(m_container);
setScene(m_scene);
m_background->getMargins(left, top, right, bottom);
m_container->layout()->setContentsMargins(left, top, right, bottom);
resize(sizeHint());
connect(m_container, SIGNAL(aboutToHide()), this, SLOT(slotAboutToHide()));
connect(m_container, SIGNAL(needResize()), this, SIGNAL(needResize()));
connect(m_hideTimer, SIGNAL(timeout()), this, SLOT(slotAboutToHide()));
connect(KWindowSystem::self(), SIGNAL(compositingChanged(bool)), this, SLOT(slotCompositingChanged(bool)));
}
MenuBar::~MenuBar()
{
}
QSize MenuBar::sizeHint() const
{
QSizeF size = m_container->minimumSize();
return QSize(size.width(), size.height() - m_container->contentBottomMargin());
}
void MenuBar::show()
{
// Add shadow for better readability
if (! Plasma::WindowEffects::isEffectAvailable(Plasma::WindowEffects::BlurBehind)) {
QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect();
shadow->setBlurRadius(5);
shadow->setOffset(QPointF(1, 1));
shadow->setColor(Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor));
setGraphicsEffect(shadow);
} else {
setGraphicsEffect(0);
}
m_hideTimer->start(1000);
QGraphicsView::show();
}
void MenuBar::hide()
{
emit aboutToHide();
m_hideTimer->stop();
QGraphicsView::hide();
}
void MenuBar::slotAboutToHide()
{
if (m_container->aMenuIsVisible()) { // MenuBar::m_hideTimer
m_hideTimer->stop(); // menu is visible, menubar will be hidden by another aboutToHide() signal
}
else if (!cursorInMenuBar()) { //MenuWidget::AboutToHide signal
hide();
} else if (!m_hideTimer->isActive()){ //use click on menubar button while a popup was shown
m_hideTimer->start(1000);
}
}
void MenuBar::slotCompositingChanged(bool)
{
updateMask();
}
bool MenuBar::cursorInMenuBar()
{
return QRect(pos(), size()).contains(QCursor::pos());
}
void MenuBar::drawBackground(QPainter *painter, const QRectF &/*rectF*/)
{
painter->save();
painter->setCompositionMode(QPainter::CompositionMode_Source);
m_background->paintFrame(painter);
painter->restore();
}
void MenuBar::resizeEvent(QResizeEvent*)
{
m_background->resizeFrame(size());
m_scene->setSceneRect(0, 0, width(), height());
updateMask();
}
void MenuBar::updateMask()
{
// Enable the mask only when compositing is disabled;
// As this operation is quite slow, it would be nice to find some
// way to workaround it for no-compositing users.
if (KWindowSystem::compositingActive()) {
clearMask();
Plasma::WindowEffects::overrideShadow(winId(), true);
Plasma::WindowEffects::enableBlurBehind(winId(), true, m_background->mask());
m_shadows->addWindow(this, Plasma::FrameSvg::BottomBorder|Plasma::FrameSvg::LeftBorder|Plasma::FrameSvg::RightBorder);
} else {
setMask(m_background->mask());
}
}

87
appmenu/menubar.h Normal file
View file

@ -0,0 +1,87 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#ifndef MENUBAR__H
#define MENUBAR__H
#include "menuwidget.h"
#include <QGraphicsView>
class QMenu;
class Shadows;
namespace Plasma
{
class FrameSvg;
}
class MenuBar : public QGraphicsView
{
Q_OBJECT
public:
MenuBar();
~MenuBar();
/**
* Set root menu
*/
void setMenu(QMenu *menu) { m_container->setMenu(menu); }
/**
* Auto open menu items on mouse over
*/
void autoOpen() { m_container->autoOpen(); }
/**
* Set action as active menubar action
*/
void setActiveAction(QAction *action) { m_container->setActiveAction(action); }
virtual QSize sizeHint() const;
virtual void show();
virtual void hide();
private Q_SLOTS:
void slotAboutToHide();
void slotCompositingChanged(bool);
Q_SIGNALS:
void needResize();
void aboutToHide();
protected:
/**
* Return true if cursor in menubar
*/
virtual bool cursorInMenuBar();
virtual void drawBackground(QPainter* painter, const QRectF &rectF);
virtual void resizeEvent(QResizeEvent* event);
private:
void updateMask();
QTimer* m_hideTimer;
Plasma::FrameSvg* m_background;
Shadows *m_shadows;
QGraphicsScene* m_scene;
MenuWidget* m_container;
};
#endif

85
appmenu/menubutton.cpp Normal file
View file

@ -0,0 +1,85 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#include "menubutton.h"
#include <QAction>
#include <QMenu>
#include <QGraphicsDropShadowEffect>
#include <Plasma/Theme>
MenuButton::MenuButton(QGraphicsWidget *parent):
Plasma::ToolButton(parent),
m_enterEvent(false),
m_menu(0)
{
QGraphicsDropShadowEffect* shadow = new QGraphicsDropShadowEffect();
shadow->setBlurRadius(5);
shadow->setOffset(QPointF(1, 1));
shadow->setColor(Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor));
setGraphicsEffect(shadow);
}
void MenuButton::setHovered(bool hovered)
{
if (hovered) {
hoverEnterEvent(0);
} else {
hoverLeaveEvent(0);
}
}
QSizeF MenuButton::sizeHint(Qt::SizeHint which, const QSizeF& constraint) const
{
QSizeF sh = Plasma::ToolButton::sizeHint(which, constraint);
if (which == Qt::MinimumSize || which == Qt::PreferredSize) {
sh.setHeight(nativeWidget()->fontMetrics().height() + bottomMargin());
}
return sh;
}
qreal MenuButton::bottomMargin() const
{
qreal left, right, top, bottom;
getContentsMargins(&left, &right, &top, &bottom);
return bottom;
}
void MenuButton::hoverEnterEvent(QGraphicsSceneHoverEvent *e)
{
m_enterEvent = true;
Plasma::ToolButton::hoverEnterEvent(e);
}
void MenuButton::hoverLeaveEvent(QGraphicsSceneHoverEvent *e)
{
if (m_enterEvent) {
m_enterEvent = false;
Plasma::ToolButton::hoverLeaveEvent(e);
}
}
#include "menubutton.moc"

54
appmenu/menubutton.h Normal file
View file

@ -0,0 +1,54 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#ifndef MENUBUTTON__H
#define MENUBUTTON__H
#include <Plasma/ToolButton>
#include <QToolButton>
class QMenu;
class MenuButton : public Plasma::ToolButton
{
Q_OBJECT
public:
MenuButton(QGraphicsWidget *parent);
void setHovered(bool hovered);
QSizeF sizeHint(Qt::SizeHint which, const QSizeF& constraint) const;
qreal bottomMargin() const;
void setMenu(QMenu *menu) { m_menu = menu; }
QMenu* menu() { return m_menu; }
protected:
void hoverEnterEvent(QGraphicsSceneHoverEvent *);
void hoverLeaveEvent(QGraphicsSceneHoverEvent *);
private:
bool m_enterEvent;
QMenu *m_menu;
};
#endif

224
appmenu/menuimporter.cpp Normal file
View file

@ -0,0 +1,224 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#include "menuimporter.h"
#include "menuimporteradaptor.h"
#include <QApplication>
#include <QDBusMessage>
#include <QDBusObjectPath>
#include <QDBusServiceWatcher>
#include <KDebug>
#include <KWindowSystem>
#include <KWindowInfo>
static const char* DBUS_SERVICE = "com.canonical.AppMenu.Registrar";
static const char* DBUS_OBJECT_PATH = "/com/canonical/AppMenu/Registrar";
// Marshalling code for DBusMenuLayoutItem
QDBusArgument &operator<<(QDBusArgument &argument, const DBusMenuLayoutItem &obj)
{
argument.beginStructure();
argument << obj.id << obj.properties;
argument.beginArray(qMetaTypeId<QDBusVariant>());
Q_FOREACH(const DBusMenuLayoutItem& child, obj.children) {
argument << QDBusVariant(QVariant::fromValue<DBusMenuLayoutItem>(child));
}
argument.endArray();
argument.endStructure();
return argument;
}
const QDBusArgument &operator>>(const QDBusArgument &argument, DBusMenuLayoutItem &obj)
{
argument.beginStructure();
argument >> obj.id >> obj.properties;
argument.beginArray();
while (!argument.atEnd()) {
QDBusVariant dbusVariant;
argument >> dbusVariant;
QDBusArgument childArgument = dbusVariant.variant().value<QDBusArgument>();
DBusMenuLayoutItem child;
childArgument >> child;
obj.children.append(child);
}
argument.endArray();
argument.endStructure();
return argument;
}
MenuImporter::MenuImporter(QObject* parent)
: QObject(parent)
, m_serviceWatcher(new QDBusServiceWatcher(this))
{
qDBusRegisterMetaType<DBusMenuLayoutItem>();
m_serviceWatcher->setConnection(QDBusConnection::sessionBus());
m_serviceWatcher->setWatchMode(QDBusServiceWatcher::WatchForUnregistration);
connect(m_serviceWatcher, SIGNAL(serviceUnregistered(const QString&)), SLOT(slotServiceUnregistered(const QString&)));
QDBusConnection::sessionBus().connect("", "", "com.canonical.dbusmenu", "LayoutUpdated",
this, SLOT(slotLayoutUpdated(uint,int)));
}
MenuImporter::~MenuImporter()
{
QDBusConnection::sessionBus().unregisterService(DBUS_SERVICE);
QDBusConnection::sessionBus().disconnect("", "", "com.canonical.dbusmenu", "LayoutUpdated",
this, SLOT(slotLayoutUpdated(uint,int)));
}
bool MenuImporter::connectToBus()
{
if (!QDBusConnection::sessionBus().registerService(DBUS_SERVICE)) {
return false;
}
new MenuImporterAdaptor(this);
QDBusConnection::sessionBus().registerObject(DBUS_OBJECT_PATH, this);
return true;
}
WId MenuImporter::recursiveMenuId(WId id)
{
KWindowInfo info = KWindowSystem::windowInfo(id, 0, NET::WM2WindowClass);
QString classClass = info.windowClassClass();
WId classId = 0;
// First look at transient windows
WId tid = KWindowSystem::transientFor(id);
while (tid) {
if (serviceExist(tid)) {
classId = tid;
break;
}
tid = KWindowSystem::transientFor(tid);
}
if (classId == 0) {
// Look at friends windows
QHashIterator<WId, QString> i(m_windowClasses);
while (i.hasNext()) {
i.next();
if (i.value() == classClass) {
classId = i.key();
}
}
}
return classId;
}
void MenuImporter::RegisterWindow(WId id, const QDBusObjectPath& path)
{
KWindowInfo info = KWindowSystem::windowInfo(id, NET::WMWindowType);
unsigned long mask = NET::AllTypesMask;
// Menu can try to register, right click in gimp for exemple
if (info.windowType(mask) & (NET::Menu|NET::DropdownMenu||NET::PopupMenu)) {
return;
}
if (path.path().isEmpty()) //prevent bad dbusmenu usage
return;
QString service = message().service();
info = KWindowSystem::windowInfo(id, 0, NET::WM2WindowClass);
QString classClass = info.windowClassClass();
m_windowClasses.insert(id, classClass);
m_menuServices.insert(id, service);
m_menuPaths.insert(id, path);
if (! m_serviceWatcher->watchedServices().contains(service)) {
m_serviceWatcher->addWatchedService(service);
}
emit WindowRegistered(id, service, path);
}
void MenuImporter::UnregisterWindow(WId id)
{
m_menuServices.remove(id);
m_menuPaths.remove(id);
m_windowClasses.remove(id);
emit WindowUnregistered(id);
}
QString MenuImporter::GetMenuForWindow(WId id, QDBusObjectPath& path)
{
path = m_menuPaths.value(id);
return m_menuServices.value(id);
}
void MenuImporter::slotServiceUnregistered(const QString& service)
{
WId id = m_menuServices.key(service);
m_menuServices.remove(id);
m_menuPaths.remove(id);
m_windowClasses.remove(id);
emit WindowUnregistered(id);
m_serviceWatcher->removeWatchedService(service);
}
void MenuImporter::slotLayoutUpdated(uint /*revision*/, int parentId)
{
// Fake unity-panel-service weird behavior of calling aboutToShow on
// startup. This is necessary for Firefox menubar to work correctly at
// startup.
// See: https://bugs.launchpad.net/plasma-idget-menubar/+bug/878165
if (parentId == 0) { //root menu
fakeUnityAboutToShow();
}
}
void MenuImporter::fakeUnityAboutToShow()
{
QDBusInterface iface(message().service(), message().path(), "com.canonical.dbusmenu");
QDBusPendingCall call = iface.asyncCall("GetLayout", 0, 1, QStringList());
QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(call, this);
watcher->setProperty("service", message().service());
watcher->setProperty("path", message().path());
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
SLOT(finishFakeUnityAboutToShow(QDBusPendingCallWatcher*)));
}
void MenuImporter::finishFakeUnityAboutToShow(QDBusPendingCallWatcher* watcher)
{
QDBusPendingReply<uint, DBusMenuLayoutItem> reply = *watcher;
if (reply.isError()) {
kWarning() << "Call to GetLayout failed:" << reply.error().message();
return;
}
QString service = watcher->property("service").toString();
QString path = watcher->property("path").toString();
DBusMenuLayoutItem root = reply.argumentAt<1>();
QDBusInterface iface(service, path, "com.canonical.dbusmenu");
Q_FOREACH(const DBusMenuLayoutItem& dbusMenuItem, root.children) {
iface.asyncCall("AboutToShow", dbusMenuItem.id);
}
}

98
appmenu/menuimporter.h Normal file
View file

@ -0,0 +1,98 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#ifndef MENUIMPORTER_H
#define MENUIMPORTER_H
// Qt
#include <QDBusContext>
#include <QDBusObjectPath>
#include <QObject>
#include <QWidget> // For WId
class QDBusObjectPath;
class QDBusPendingCallWatcher;
class QDBusServiceWatcher;
class QMenu;
/**
* Represents an item with its children. GetLayout() returns a
* DBusMenuLayoutItemList.
*/
struct DBusMenuLayoutItem
{
int id;
QVariantMap properties;
QList<DBusMenuLayoutItem> children;
};
Q_DECLARE_METATYPE(DBusMenuLayoutItem)
class MenuImporter : public QObject, protected QDBusContext
{
Q_OBJECT
public:
MenuImporter(QObject*);
~MenuImporter();
bool connectToBus();
bool serviceExist(WId id) { return m_menuServices.contains(id); }
QString serviceForWindow(WId id) { return m_menuServices.value(id); }
bool pathExist(WId id) { return m_menuPaths.contains(id); }
QString pathForWindow(WId id) { return m_menuPaths.value(id).path(); }
QList<WId> ids() { return m_menuServices.keys(); }
/**
* Return id of first transient/friend window with a menu available
*/
WId recursiveMenuId(WId id);
Q_SIGNALS:
void WindowRegistered(WId id, const QString& service, const QDBusObjectPath&);
void WindowUnregistered(WId id);
public Q_SLOTS:
Q_NOREPLY void RegisterWindow(WId id, const QDBusObjectPath& path);
Q_NOREPLY void UnregisterWindow(WId id);
QString GetMenuForWindow(WId id, QDBusObjectPath& path);
private Q_SLOTS:
void slotServiceUnregistered(const QString& service);
void slotLayoutUpdated(uint revision, int parentId);
void finishFakeUnityAboutToShow(QDBusPendingCallWatcher*);
private:
QDBusServiceWatcher* m_serviceWatcher;
QHash<WId, QString> m_menuServices;
QHash<WId, QDBusObjectPath> m_menuPaths;
QHash<WId, QString> m_windowClasses;
void fakeUnityAboutToShow();
};
#endif /* MENUIMPORTER_H */

387
appmenu/menuwidget.cpp Normal file
View file

@ -0,0 +1,387 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#include "menuwidget.h"
#include <QMenu>
#include <QDesktopWidget>
#include <QGraphicsView>
#include <QGraphicsLinearLayout>
#include <KWindowSystem>
#include <KDebug>
#include <KApplication>
MenuWidget::MenuWidget(QGraphicsView *view) :
QGraphicsWidget(),
m_mouseTimer(new QTimer(this)),
m_actionTimer(new QTimer(this)),
m_view(view),
m_layout(new QGraphicsLinearLayout(this)),
m_currentButton(0),
m_contentBottomMargin(0),
m_mousePosition(-1, -1),
m_visibleMenu(0),
m_menu(0)
{
connect(m_actionTimer, SIGNAL(timeout()), SLOT(slotUpdateActions()));
connect(m_mouseTimer, SIGNAL(timeout()), SLOT(slotCheckActiveItem()));
}
MenuWidget::~MenuWidget()
{
while (!m_buttons.isEmpty()) {
delete m_buttons.front();
m_buttons.pop_front();
}
}
void MenuWidget::setMenu(QMenu *menu)
{
if (m_menu) {
disconnect(m_menu, SIGNAL(destroyed()), this, SLOT(slotMenuDestroyed()));
m_menu->removeEventFilter(this);
}
if (menu) {
if (m_mouseTimer->isActive()) {
m_mouseTimer->stop();
}
m_visibleMenu = 0;
m_menu = menu;
connect(m_menu, SIGNAL(destroyed()), SLOT(slotMenuDestroyed()), Qt::UniqueConnection);
m_menu->installEventFilter(this);
slotUpdateActions();
}
}
void MenuWidget::initLayout()
{
MenuButton* button = 0;
if (!m_menu) {
return;
}
foreach (QAction* action, m_menu->actions())
{
button = createButton(action);
if (button) {
m_layout->addItem(button);
button->setMenu(action->menu());
m_buttons << button;
}
}
//Assume all buttons have same margins
if (button) {
m_contentBottomMargin = button->bottomMargin();
}
}
bool MenuWidget::eventFilter(QObject* object, QEvent* event)
{
bool filtered;
if (object == m_menu) {
filtered = menuEventFilter(event);
} else {
filtered = subMenuEventFilter(static_cast<QMenu*>(object), event);
}
return filtered ? true : QGraphicsWidget::eventFilter(object, event);
}
bool MenuWidget::menuEventFilter(QEvent* event)
{
switch (event->type()) {
case QEvent::ActionAdded:
case QEvent::ActionRemoved:
case QEvent::ActionChanged:
// Try to limit layout updates
m_actionTimer->start(500);
break;
default:
break;
}
return false;
}
bool MenuWidget::subMenuEventFilter(QObject* object, QEvent* event)
{
QMenu *menu = static_cast<QMenu*>(object);
if (event->type() == QEvent::KeyPress) {
menu->removeEventFilter(this);
QApplication::sendEvent(menu, event);
menu->installEventFilter(this);
if (!event->isAccepted()) {
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
switch (keyEvent->key()) {
case Qt::Key_Left:
showLeftRightMenu(false);
break;
case Qt::Key_Right:
showLeftRightMenu(true);
break;
case Qt::Key_Escape:
menu->hide();
break;
default:
break;
}
}
return true;
}
return false;
}
void MenuWidget::slotMenuDestroyed()
{
m_menu = 0;
m_visibleMenu = 0;
m_currentButton = 0;
}
void MenuWidget::slotCheckActiveItem()
{
MenuButton* buttonBelow = 0;
QPoint pos = m_view->mapFromGlobal(QCursor::pos());
QGraphicsItem* item = m_view->itemAt(pos);
if (pos == m_mousePosition) {
return;
} else {
m_mousePosition = pos;
}
if (item) {
buttonBelow = qobject_cast<MenuButton*>(item->toGraphicsObject());
}
if (!buttonBelow) {
return;
}
if (buttonBelow != m_currentButton) {
if (m_currentButton && m_currentButton->nativeWidget()) {
m_currentButton->nativeWidget()->setDown(false);
m_currentButton->setHovered(false);
}
m_currentButton = buttonBelow;
if (m_currentButton->nativeWidget()) {
m_currentButton->nativeWidget()->setDown(true);
}
m_visibleMenu = showMenu();
}
}
void MenuWidget::slotMenuAboutToHide()
{
if (m_currentButton && m_currentButton->nativeWidget()) {
m_currentButton->nativeWidget()->setDown(false);
}
if (m_mouseTimer->isActive()) {
m_mouseTimer->stop();
}
m_visibleMenu = 0;
emit aboutToHide();
}
void MenuWidget::slotButtonClicked()
{
m_currentButton = qobject_cast<MenuButton*>(sender());
if (m_currentButton && m_currentButton->nativeWidget()) {
m_currentButton->nativeWidget()->setDown(true);
}
m_visibleMenu = showMenu();
// Start auto navigation after click
if (!m_mouseTimer->isActive())
m_mouseTimer->start(100);
}
void MenuWidget::slotUpdateActions()
{
if (m_visibleMenu) {
return; // Later
}
m_actionTimer->stop();
m_currentButton = 0;
foreach (MenuButton *button, m_buttons) {
disconnect(button, SIGNAL(clicked()), this, SLOT(slotButtonClicked()));
m_layout->removeItem(button);
button->hide();
m_buttons.removeOne(button);
delete button;
}
initLayout();
// Menu may be empty on application startup
// slotUpdateActions will be called later by eventFilter()
if (m_menu && m_menu->actions().length()) {
emit needResize();
}
}
void MenuWidget::setActiveAction(QAction *action)
{
if (!m_menu) {
return;
}
m_currentButton = m_buttons.first();
if (action) {
QMenu *menu;
int i = 0;
foreach (MenuButton *button, m_buttons) {
menu = m_menu->actions()[i]->menu();
if (menu && menu == action->menu()) {
m_currentButton = button;
break;
}
if (++i >= m_menu->actions().length()) {
break;
}
}
}
m_currentButton->nativeWidget()->animateClick();
}
void MenuWidget::hide()
{
if (m_mouseTimer->isActive()) {
m_mouseTimer->stop();
}
QGraphicsWidget::hide();
}
MenuButton* MenuWidget::createButton(QAction *action)
{
if( action->isSeparator() || !action->menu() || !action->isVisible()) {
return 0;
}
action->setShortcut(QKeySequence());
MenuButton *button = new MenuButton(this);
button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Minimum);
button->setText(action->text());
connect(button, SIGNAL(clicked()), SLOT(slotButtonClicked()));
return button;
}
QMenu* MenuWidget::showMenu()
{
QMenu *menu = 0;
if (m_visibleMenu) {
disconnect(m_visibleMenu, SIGNAL(aboutToHide()), this, SLOT(slotMenuAboutToHide()));
m_visibleMenu->hide();
}
if (m_currentButton && m_menu) {
menu = m_currentButton->menu();
}
// Last chance to get menu
// Some applications like Firefox have empties menus on layout updates
// They should populate this menu later but in fact, they use another object
// So, we check here directly the button name, may fail with menubar with buttons with same name (test apps)
if (menu && menu->actions().length() == 0) {
foreach (QAction *action, m_menu->actions()) {
if (action->text() == m_currentButton->text()) {
menu = action->menu();
break;
}
}
}
if (menu) {
QPoint globalPos = m_view->mapToGlobal(QPoint(0,0));
QPointF parentPos = m_currentButton->mapFromParent(QPoint(0,0));
QRect screen = KApplication::desktop()->screenGeometry();
int x = globalPos.x() - parentPos.x();
int y = globalPos.y() + m_currentButton->size().height() - parentPos.y();
menu->popup(QPoint(x, y));
// Fix offscreen menu
if (menu->size().height() + y > screen.height() + screen.y()) {
y = globalPos.y() - parentPos.y() - menu->size().height();
if (menu->size().width() + x > screen.width() + screen.x())
x = screen.width() + screen.x() - menu->size().width();
else if (menu->size().width() + x < screen.x())
x = screen.x();
menu->move(x, y);
}
connect(menu, SIGNAL(aboutToHide()), this, SLOT(slotMenuAboutToHide()));
installEventFilterForAll(menu, this);
}
return menu;
}
void MenuWidget::showLeftRightMenu(bool next)
{
if (!m_currentButton) {
return;
}
int index = m_buttons.indexOf(m_currentButton);
if (index == -1) {
kWarning() << "Couldn't find button!";
return;
}
if (next) {
index = (index + 1) % m_buttons.count();
} else {
index = (index == 0 ? m_buttons.count() : index) - 1;
}
if (m_currentButton && m_currentButton->nativeWidget()) {
m_currentButton->nativeWidget()->setDown(false);
}
m_currentButton = m_buttons.at(index);
if (m_currentButton && m_currentButton->nativeWidget()) {
m_currentButton->nativeWidget()->setDown(true);
}
m_visibleMenu = showMenu();
}
void MenuWidget::installEventFilterForAll(QMenu *menu, QObject *object)
{
if (!menu) {
return;
}
menu->installEventFilter(this);
foreach (QAction *action, menu->actions()) {
if (action->menu())
installEventFilterForAll(action->menu(), object);
}
}
#include "menuwidget.moc"

143
appmenu/menuwidget.h Normal file
View file

@ -0,0 +1,143 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#ifndef MENUWIDGET__H
#define MENUWIDGET__H
#include "menubutton.h"
#include <QGraphicsWidget>
#include <QTimer>
class QGraphicsLinearLayout;
class QGraphicsView;
class MenuWidget : public QGraphicsWidget
{
Q_OBJECT
public:
MenuWidget(QGraphicsView *view = 0);
~MenuWidget();
/**
* Set root menu
*/
void setMenu(QMenu *menu);
/**
* Init layout with root menu
*/
void initLayout();
/**
* True if a menu is visible in menuwidget
*/
bool aMenuIsVisible() { return m_visibleMenu; }
/**
* Activate action, or first action if null
*/
void setActiveAction(QAction *action);
/**
* Auto open menu items on mouse over
*/
void autoOpen() { m_mouseTimer->start(100); }
/**
* Return content bottom margin
*/
qreal contentBottomMargin() { return m_contentBottomMargin; }
void hide();
protected:
/**
* Use to get keyboard events
*/
virtual bool eventFilter(QObject*, QEvent*);
/**
* Filter events on main menu
*/
bool menuEventFilter(QEvent* event);
/**
* Filter events on submenus
*/
bool subMenuEventFilter(QObject* object, QEvent* event);
private Q_SLOTS:
/**
* Clean menu if destroyed
*/
void slotMenuDestroyed();
/**
* Check hovered item and active it
*/
void slotCheckActiveItem();
/**
* A menu is hidding
*/
void slotMenuAboutToHide();
/**
* Menubar button clicked
*/
void slotButtonClicked();
/**
* Update pending actions
*/
void slotUpdateActions();
Q_SIGNALS:
void needResize();
void aboutToHide();
private:
/**
* Return a button based on action
*/
MenuButton* createButton(QAction *action);
/**
* Show current button menu
* return showed menu
*/
QMenu* showMenu();
/**
* Show next menu if next, otherwise previous
*/
void showLeftRightMenu(bool next);
/**
* Install event filter for menu and it submenus
*/
void installEventFilterForAll(QMenu *menu, QObject *object);
//Follow mouse position
QTimer *m_mouseTimer;
//Update actions
QTimer *m_actionTimer;
QGraphicsView *m_view;
QGraphicsLinearLayout *m_layout;
QList<MenuButton*> m_buttons;
MenuButton *m_currentButton;
qreal m_contentBottomMargin;
QPoint m_mousePosition;
QMenu *m_visibleMenu;
QMenu *m_menu;
};
#endif //MENUWIDGET__H

View file

@ -0,0 +1,31 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.kded">
<method name="showMenu">
<arg name="x" type="i" direction="in"/>
<arg name="y" type="i" direction="in"/>
<arg name="WId" type="t" direction="in"/>
</method>
<method name="reconfigure">
</method>
<signal name="showRequest">
<arg name="WId" type="t"/>
</signal>
<signal name="menuAvailable">
<arg name="WId" type="t"/>
</signal>
<signal name="clearMenus">
</signal>
<signal name="menuHidden">
<arg name="WId" type="t"/>
</signal>
<signal name="WindowRegistered">
<arg name="windowId" type="t" direction="out"/>
<arg name="service" type="s" direction="out"/>
<arg name="menuObjectPath" type="o" direction="out"/>
</signal>
<signal name="WindowUnregistered">
<arg name="windowId" type="t" direction="out"/>
</signal>
</interface>
</node>

381
appmenu/shadows.cpp Normal file
View file

@ -0,0 +1,381 @@
/*
* Copyright 2011 by Aaron Seigo <aseigo@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License version 2,
* or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "shadows.h"
#include <QWidget>
#include <QPainter>
#ifdef Q_WS_X11
#include <QX11Info>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <fixx11h.h>
#endif
#include <kdebug.h>
#include <kglobal.h>
class Shadows::Private
{
public:
Private(Shadows *shadows)
: q(shadows),
m_managePixmaps(false)
{
}
~Private()
{
clearPixmaps();
}
void clearPixmaps();
void setupPixmaps();
void initPixmap(const QString &element);
QPixmap initEmptyPixmap(const QSize &size);
void updateShadow(const QWidget *window, Plasma::FrameSvg::EnabledBorders);
void clearShadow(const QWidget *window);
void updateShadows();
void windowDestroyed(QObject *deletedObject);
void setupData(Plasma::FrameSvg::EnabledBorders enabledBorders);
Shadows *q;
QList<QPixmap> m_shadowPixmaps;
QPixmap m_emptyCornerPix;
QPixmap m_emptyCornerLeftPix;
QPixmap m_emptyCornerTopPix;
QPixmap m_emptyCornerRightPix;
QPixmap m_emptyCornerBottomPix;
QPixmap m_emptyVerticalPix;
QPixmap m_emptyHorizontalPix;
QHash<Plasma::FrameSvg::EnabledBorders, QVector<unsigned long> > data;
QHash<const QWidget *, Plasma::FrameSvg::EnabledBorders> m_windows;
bool m_managePixmaps;
};
class ShadowsSingleton
{
public:
ShadowsSingleton()
{
}
Shadows self;
};
K_GLOBAL_STATIC(ShadowsSingleton, privateShadowsSelf)
Shadows::Shadows(QObject *parent, const QString &prefix)
: Plasma::Svg(parent),
d(new Private(this))
{
setImagePath(prefix);
connect(this, SIGNAL(repaintNeeded()), this, SLOT(updateShadows()));
}
Shadows *Shadows::self()
{
return &privateShadowsSelf->self;
}
void Shadows::addWindow(const QWidget *window, Plasma::FrameSvg::EnabledBorders enabledBorders)
{
if (!window || !window->isWindow()) {
return;
}
d->m_windows[window] = enabledBorders;
d->updateShadow(window, enabledBorders);
connect(window, SIGNAL(destroyed(QObject*)),
this, SLOT(windowDestroyed(QObject*)), Qt::UniqueConnection);
}
void Shadows::removeWindow(const QWidget *window)
{
if (!d->m_windows.contains(window)) {
return;
}
d->m_windows.remove(window);
disconnect(window, 0, this, 0);
d->clearShadow(window);
if (d->m_windows.isEmpty()) {
d->clearPixmaps();
}
}
void Shadows::Private::windowDestroyed(QObject *deletedObject)
{
m_windows.remove(static_cast<QWidget *>(deletedObject));
if (m_windows.isEmpty()) {
clearPixmaps();
}
}
void Shadows::Private::updateShadows()
{
setupPixmaps();
QHash<const QWidget *, Plasma::FrameSvg::EnabledBorders>::const_iterator i;
for (i = m_windows.constBegin(); i != m_windows.constEnd(); ++i) {
updateShadow(i.key(), i.value());
}
}
void Shadows::Private::initPixmap(const QString &element)
{
#ifdef Q_WS_X11
QPixmap pix = q->pixmap(element);
if (!pix.isNull() && pix.handle() == 0) {
Pixmap xPix = XCreatePixmap(QX11Info::display(), QX11Info::appRootWindow(), pix.width(), pix.height(), 32);
QPixmap tempPix = QPixmap::fromX11Pixmap(xPix, QPixmap::ExplicitlyShared);
tempPix.fill(Qt::transparent);
QPainter p(&tempPix);
p.drawPixmap(QPoint(0, 0), pix);
m_shadowPixmaps << tempPix;
m_managePixmaps = true;
} else {
m_shadowPixmaps << pix;
}
#endif
}
QPixmap Shadows::Private::initEmptyPixmap(const QSize &size)
{
Pixmap emptyXPix = XCreatePixmap(QX11Info::display(), QX11Info::appRootWindow(), size.width(), size.height(), 32);
QPixmap tempEmptyPix = QPixmap::fromX11Pixmap(emptyXPix, QPixmap::ExplicitlyShared);
tempEmptyPix.fill(Qt::transparent);
return tempEmptyPix;
}
void Shadows::Private::setupPixmaps()
{
clearPixmaps();
initPixmap("shadow-top");
initPixmap("shadow-topright");
initPixmap("shadow-right");
initPixmap("shadow-bottomright");
initPixmap("shadow-bottom");
initPixmap("shadow-bottomleft");
initPixmap("shadow-left");
initPixmap("shadow-topleft");
m_emptyCornerPix = initEmptyPixmap(QSize(1,1));
m_emptyCornerLeftPix = initEmptyPixmap(QSize(q->elementSize("shadow-topleft").width(), 1));
m_emptyCornerTopPix = initEmptyPixmap(QSize(1, q->elementSize("shadow-topleft").height()));
m_emptyCornerRightPix = initEmptyPixmap(QSize(q->elementSize("shadow-bottomright").width(), 1));
m_emptyCornerBottomPix = initEmptyPixmap(QSize(1, q->elementSize("shadow-bottomright").height()));
m_emptyVerticalPix = initEmptyPixmap(QSize(1, q->elementSize("shadow-left").height()));
m_emptyHorizontalPix = initEmptyPixmap(QSize(q->elementSize("shadow-top").width(), 1));
}
void Shadows::Private::setupData(Plasma::FrameSvg::EnabledBorders enabledBorders)
{
#ifdef Q_WS_X11
//shadow-top
if (enabledBorders & Plasma::FrameSvg::TopBorder) {
data[enabledBorders] << m_shadowPixmaps[0].handle();
} else {
data[enabledBorders] << m_emptyHorizontalPix.handle();
}
//shadow-topright
if (enabledBorders & Plasma::FrameSvg::TopBorder &&
enabledBorders & Plasma::FrameSvg::RightBorder) {
data[enabledBorders] << m_shadowPixmaps[1].handle();
} else if (enabledBorders & Plasma::FrameSvg::TopBorder) {
data[enabledBorders] << m_emptyCornerTopPix.handle();
} else if (enabledBorders & Plasma::FrameSvg::RightBorder) {
data[enabledBorders] << m_emptyCornerRightPix.handle();
} else {
data[enabledBorders] << m_emptyCornerPix.handle();
}
//shadow-right
if (enabledBorders & Plasma::FrameSvg::RightBorder) {
data[enabledBorders] << m_shadowPixmaps[2].handle();
} else {
data[enabledBorders] << m_emptyVerticalPix.handle();
}
//shadow-bottomright
if (enabledBorders & Plasma::FrameSvg::BottomBorder &&
enabledBorders & Plasma::FrameSvg::RightBorder) {
data[enabledBorders] << m_shadowPixmaps[3].handle();
} else if (enabledBorders & Plasma::FrameSvg::BottomBorder) {
data[enabledBorders] << m_emptyCornerBottomPix.handle();
} else if (enabledBorders & Plasma::FrameSvg::RightBorder) {
data[enabledBorders] << m_emptyCornerRightPix.handle();
} else {
data[enabledBorders] << m_emptyCornerPix.handle();
}
//shadow-bottom
if (enabledBorders & Plasma::FrameSvg::BottomBorder) {
data[enabledBorders] << m_shadowPixmaps[4].handle();
} else {
data[enabledBorders] << m_emptyHorizontalPix.handle();
}
//shadow-bottomleft
if (enabledBorders & Plasma::FrameSvg::BottomBorder &&
enabledBorders & Plasma::FrameSvg::LeftBorder) {
data[enabledBorders] << m_shadowPixmaps[5].handle();
} else if (enabledBorders & Plasma::FrameSvg::BottomBorder) {
data[enabledBorders] << m_emptyCornerBottomPix.handle();
} else if (enabledBorders & Plasma::FrameSvg::LeftBorder) {
data[enabledBorders] << m_emptyCornerLeftPix.handle();
} else {
data[enabledBorders] << m_emptyCornerPix.handle();
}
//shadow-left
if (enabledBorders & Plasma::FrameSvg::LeftBorder) {
data[enabledBorders] << m_shadowPixmaps[6].handle();
} else {
data[enabledBorders] << m_emptyVerticalPix.handle();
}
//shadow-topleft
if (enabledBorders & Plasma::FrameSvg::TopBorder &&
enabledBorders & Plasma::FrameSvg::LeftBorder) {
data[enabledBorders] << m_shadowPixmaps[7].handle();
} else if (enabledBorders & Plasma::FrameSvg::TopBorder) {
data[enabledBorders] << m_emptyCornerTopPix.handle();
} else if (enabledBorders & Plasma::FrameSvg::LeftBorder) {
data[enabledBorders] << m_emptyCornerLeftPix.handle();
} else {
data[enabledBorders] << m_emptyCornerPix.handle();
}
#endif
int left, top, right, bottom = 0;
QSize marginHint;
if (enabledBorders & Plasma::FrameSvg::TopBorder) {
marginHint = q->elementSize("shadow-hint-top-margin");
if (marginHint.isValid()) {
top = marginHint.height();
} else {
top = m_shadowPixmaps[0].height(); // top
}
} else {
top = 1;
}
if (enabledBorders & Plasma::FrameSvg::RightBorder) {
marginHint = q->elementSize("shadow-hint-right-margin");
if (marginHint.isValid()) {
right = marginHint.width();
} else {
right = m_shadowPixmaps[2].width(); // right
}
} else {
right = 1;
}
if (enabledBorders & Plasma::FrameSvg::BottomBorder) {
marginHint = q->elementSize("shadow-hint-bottom-margin");
if (marginHint.isValid()) {
bottom = marginHint.height();
} else {
bottom = m_shadowPixmaps[4].height(); // bottom
}
} else {
bottom = 1;
}
if (enabledBorders & Plasma::FrameSvg::LeftBorder) {
marginHint = q->elementSize("shadow-hint-left-margin");
if (marginHint.isValid()) {
left = marginHint.width();
} else {
left = m_shadowPixmaps[6].width(); // left
}
} else {
left = 1;
}
data[enabledBorders] << top << right << bottom << left;
}
void Shadows::Private::clearPixmaps()
{
#ifdef Q_WS_X11
if (m_managePixmaps) {
foreach (const QPixmap &pixmap, m_shadowPixmaps) {
XFreePixmap(QX11Info::display(), pixmap.handle());
}
XFreePixmap(QX11Info::display(), m_emptyCornerPix.handle());
XFreePixmap(QX11Info::display(), m_emptyCornerBottomPix.handle());
XFreePixmap(QX11Info::display(), m_emptyCornerLeftPix.handle());
XFreePixmap(QX11Info::display(), m_emptyCornerRightPix.handle());
XFreePixmap(QX11Info::display(), m_emptyCornerTopPix.handle());
XFreePixmap(QX11Info::display(), m_emptyVerticalPix.handle());
XFreePixmap(QX11Info::display(), m_emptyHorizontalPix.handle());
m_managePixmaps = false;
}
#endif
m_shadowPixmaps.clear();
data.clear();
}
void Shadows::Private::updateShadow(const QWidget *window, Plasma::FrameSvg::EnabledBorders enabledBorders)
{
#ifdef Q_WS_X11
if (m_shadowPixmaps.isEmpty()) {
setupPixmaps();
}
if (!data.contains(enabledBorders)) {
setupData(enabledBorders);
}
Display *dpy = QX11Info::display();
Atom atom = XInternAtom(dpy, "_KDE_NET_WM_SHADOW", False);
//kDebug() << "going to set the shadow of" << winId() << "to" << data;
XChangeProperty(dpy, window->winId(), atom, XA_CARDINAL, 32, PropModeReplace,
reinterpret_cast<const unsigned char *>(data[enabledBorders].constData()), data[enabledBorders].size());
#endif
}
void Shadows::Private::clearShadow(const QWidget *window)
{
#ifdef Q_WS_X11
Display *dpy = QX11Info::display();
Atom atom = XInternAtom(dpy, "_KDE_NET_WM_SHADOW", False);
XDeleteProperty(dpy, window->winId(), atom);
#endif
}
bool Shadows::enabled() const
{
return hasElement("shadow-left");
}
#include "shadows.moc"

51
appmenu/shadows.h Normal file
View file

@ -0,0 +1,51 @@
/*
* Copyright 2011 by Aaron Seigo <aseigo@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License version 2,
* or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SHADOWS_H
#define SHADOWS_H
#include <QSet>
#include "plasma/framesvg.h"
#include "plasma/svg.h"
class Shadows : public Plasma::Svg
{
Q_OBJECT
public:
explicit Shadows(QObject *parent = 0, const QString &prefix = "widgets/panel-background");
static Shadows *self();
void addWindow(const QWidget *window, Plasma::FrameSvg::EnabledBorders enabledBorders = Plasma::FrameSvg::AllBorders);
void removeWindow(const QWidget *window);
bool enabled() const;
private:
class Private;
Private * const d;
Q_PRIVATE_SLOT(d, void updateShadows())
Q_PRIVATE_SLOT(d, void windowDestroyed(QObject *deletedObject))
};
#endif

176
appmenu/topmenubar.cpp Normal file
View file

@ -0,0 +1,176 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#include "topmenubar.h"
#include "glowbar.h"
//KDE
#include <Plasma/Svg>
#include <KWindowSystem>
// Qt
#include <QMenu>
#include <QTimer>
#include <QDebug>
#include <QApplication>
#include <QPropertyAnimation>
#include <QDesktopWidget>
TopMenuBar::TopMenuBar()
: MenuBar(),
m_prevCursorPos(-1, -1),
m_mouseTracker(new QTimer(this)),
m_hideGlowTimer(new QTimer(this)),
m_glowBar(new GlowBar())
{
connect(this, SIGNAL(aboutToHide()), this, SLOT(slotAboutToHide()));
connect(m_mouseTracker, SIGNAL(timeout()), this, SLOT(slotMouseTracker()));
connect(m_hideGlowTimer, SIGNAL(timeout()), this, SLOT(slotHideGlowBar()));
}
TopMenuBar::~TopMenuBar()
{
delete m_mouseTracker;
delete m_hideGlowTimer;
hideGlowBar();
delete m_glowBar;
}
void TopMenuBar::enableMouseTracking(bool enable)
{
if (enable) {
if (!cursorInMenuBar()) {
showGlowBar();
}
m_mouseTracker->start(250);
} else {
hideGlowBar();
m_mouseTracker->stop();
}
}
void TopMenuBar::updateSize()
{
// Enable mouse tracking on resize if needed
if (!m_mouseTracker->isActive() && !cursorInMenuBar()) {
enableMouseTracking();
}
resize(sizeHint());
}
void TopMenuBar::move(QPoint p)
{
MenuBar::move(p);
if (m_glowBar) {
m_glowBar->move(p);
m_glowBar->setPixmap(triggerRect().topLeft(), triggerRect().width());
}
}
bool TopMenuBar::cursorInMenuBar()
{
if (m_mouseTracker->isActive()) {
return triggerRect().contains(QCursor::pos());
} else {
return MenuBar::cursorInMenuBar();
}
}
void TopMenuBar::slotAboutToHide()
{
enableMouseTracking();
}
void TopMenuBar::slotMouseTracker()
{
QPoint cursorPos = QCursor::pos();
// reset timer
if (cursorPos != m_prevCursorPos && m_hideGlowTimer->isActive()) {
m_hideGlowTimer->stop();
m_hideGlowTimer->start(10000);
}
if (cursorInMenuBar()) { // show menubar
m_mouseTracker->stop();
hideGlowBar();
show();
} else if(cursorPos != m_prevCursorPos) { // change glowbar opacity
qreal opacity = glowBarOpacity();
QPropertyAnimation *anim = new QPropertyAnimation(m_glowBar, "windowOpacity");
anim->setStartValue(m_glowBar->windowOpacity());
anim->setEndValue(opacity);
anim->setDuration(200);
anim->start(QAbstractAnimation::DeleteWhenStopped);
// Show menubar if auto hidden
if (!m_glowBar->isVisible()) {
m_glowBar->show();
}
}
m_prevCursorPos = cursorPos;
}
void TopMenuBar::slotHideGlowBar()
{
if (m_prevCursorPos == QCursor::pos()) {
hideGlowBar();
} else {
m_hideGlowTimer->start(10000);
}
}
void TopMenuBar::showGlowBar()
{
if (m_glowBar) {
m_hideGlowTimer->start(10000);
m_glowBar->setWindowOpacity(glowBarOpacity());
m_glowBar->show();
}
}
void TopMenuBar::hideGlowBar()
{
if (m_glowBar) {
m_glowBar->hide();
}
}
qreal TopMenuBar::glowBarOpacity()
{
QPoint cursorPos = QCursor::pos();
QDesktopWidget *desktop = QApplication::desktop();
int screen = desktop->screenNumber(cursorPos);
QRect desktopRect = desktop->availableGeometry(screen);
return 1.0 - ((cursorPos.y() - desktopRect.y())/qreal(desktopRect.height())*2.0);
}
QRect TopMenuBar::triggerRect()
{
QPoint triggerPoint = QPoint(x(), y());
QSize triggerSize = QSize(sizeHint().width(), 5);
return QRect(triggerPoint, triggerSize);
}
#include "topmenubar.moc"

81
appmenu/topmenubar.h Normal file
View file

@ -0,0 +1,81 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#ifndef TOPMENUBAR__H
#define TOPMENUBAR__H
#include "menubar.h"
class QTimer;
class GlowBar;
class TopMenuBar : public MenuBar
{
Q_OBJECT
public:
TopMenuBar();
~TopMenuBar();
/**
* Start mouse tracking (hide/show on mouse event)
*/
void enableMouseTracking(bool enable = true);
/**
* Set menubar parent window id
*/
void setParentWid(WId id) { m_wid = id; }
/**
* Get menubar parent window id
*/
WId parentWid() { return m_wid; }
/**
* resize menu bar to feet content
*/
void updateSize();
/**
* Move menubar and glow bar at position
*/
void move(QPoint p);
protected:
bool cursorInMenuBar();
private Q_SLOTS:
void slotAboutToHide();
void slotMouseTracker();
void slotHideGlowBar();
private:
void showGlowBar();
void hideGlowBar();
qreal glowBarOpacity();
QRect triggerRect();
WId m_wid;
QPoint m_prevCursorPos;
QTimer* m_mouseTracker;
QTimer* m_hideGlowTimer;
GlowBar* m_glowBar;
};
#endif

79
appmenu/verticalmenu.cpp Normal file
View file

@ -0,0 +1,79 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#include "verticalmenu.h"
#include <QCoreApplication>
#include <QKeyEvent>
#include <QEvent>
#include <QMenu>
#include <QMouseEvent>
VerticalMenu::VerticalMenu(QWidget* parent) : QMenu(parent)
{
}
VerticalMenu::~VerticalMenu()
{
}
QMenu *VerticalMenu::leafMenu()
{
QMenu *leaf = this;
while (true) {
QAction *act = leaf->activeAction();
if (act && act->menu() && act->menu()->isVisible()) {
leaf = act->menu();
continue;
}
return leaf == this ? 0 : leaf;
}
return 0; // make gcc happy
}
void VerticalMenu::paintEvent(QPaintEvent *pe)
{
QMenu::paintEvent(pe);
if (QWidget::mouseGrabber() == this)
return;
if (QWidget::mouseGrabber())
QWidget::mouseGrabber()->releaseMouse();
grabMouse();
grabKeyboard();
}
#define FORWARD(_EVENT_, _TYPE_) \
void VerticalMenu::_EVENT_##Event(Q##_TYPE_##Event *e) \
{ \
if (QMenu *leaf = leafMenu()) \
QCoreApplication::sendEvent(leaf, e); \
else \
QMenu::_EVENT_##Event(e); \
} \
FORWARD(keyPress, Key)
FORWARD(keyRelease, Key)
#include "verticalmenu.moc"

56
appmenu/verticalmenu.h Normal file
View file

@ -0,0 +1,56 @@
/*
This file is part of the KDE project.
Copyright (c) 2011 Lionel Chauvin <megabigbug@yahoo.fr>
Copyright (c) 2011,2012 Cédric Bellegarde <gnumdk@gmail.com>
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 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.
*/
#ifndef VERTICALMENU_H
#define VERTICALMENU_H
#include <QMenu>
class VerticalMenu : public QMenu
{
Q_OBJECT
public:
VerticalMenu(QWidget * parent = 0);
~VerticalMenu();
/**
* Set menu parent window id
*/
void setParentWid(WId id) { m_wid = id; }
/**
* Get menu parent window id
*/
WId parentWid() { return m_wid; }
protected:
void keyPressEvent(QKeyEvent*);
void keyReleaseEvent(QKeyEvent*);
void paintEvent(QPaintEvent*);
private:
QMenu *leafMenu();
private:
WId m_wid;
};
#endif //VERTICALMENU_H

3
cmake/CMakeLists.txt Normal file
View file

@ -0,0 +1,3 @@
add_subdirectory(modules)

View file

@ -0,0 +1,17 @@
# install the cmake files
# don't glob for the files, since we don't want to
# install e.g. FindLibKNotification-1.cmake
set(cmakeFiles FindCkConnector.cmake
FindDBus.cmake
FindLibXKlavier.cmake
FindOpenGLES.cmake
FindPAM.cmake
FindSensors.cmake
PkgConfigGetVar.cmake
UnixAuth.cmake )
set(module_install_dir ${DATA_INSTALL_DIR}/cmake/modules )
install( FILES ${cmakeFiles} DESTINATION ${module_install_dir} )

View file

@ -0,0 +1,22 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -0,0 +1,59 @@
# - Try to find the ConsoleKit connector library (libck-connector)
# Once done this will define
#
# CKCONNECTOR_FOUND - system has the CK Connector
# CKCONNECTOR_INCLUDE_DIR - the CK Connector include directory
# CKCONNECTOR_LIBRARIES - the libraries needed to use CK Connector
# Copyright (c) 2008, Kevin Kofler, <kevin.kofler@chello.at>
# modeled after FindLibArt.cmake:
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (CKCONNECTOR_INCLUDE_DIR AND CKCONNECTOR_LIBRARIES)
# in cache already
SET(CKCONNECTOR_FOUND TRUE)
else (CKCONNECTOR_INCLUDE_DIR AND CKCONNECTOR_LIBRARIES)
IF (NOT WIN32)
FIND_PACKAGE(PkgConfig)
IF (PKG_CONFIG_FOUND)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
pkg_check_modules(_CKCONNECTOR_PC QUIET ck-connector)
ENDIF (PKG_CONFIG_FOUND)
ENDIF (NOT WIN32)
FIND_PATH(CKCONNECTOR_INCLUDE_DIR ck-connector.h
${_CKCONNECTOR_PC_INCLUDE_DIRS}
)
FIND_LIBRARY(CKCONNECTOR_LIBRARIES NAMES ck-connector
PATHS
${_CKCONNECTOR_PC_LIBDIR}
)
if (CKCONNECTOR_INCLUDE_DIR AND CKCONNECTOR_LIBRARIES)
set(CKCONNECTOR_FOUND TRUE)
endif (CKCONNECTOR_INCLUDE_DIR AND CKCONNECTOR_LIBRARIES)
if (CKCONNECTOR_FOUND)
if (NOT CkConnector_FIND_QUIETLY)
message(STATUS "Found ck-connector: ${CKCONNECTOR_LIBRARIES}")
endif (NOT CkConnector_FIND_QUIETLY)
else (CKCONNECTOR_FOUND)
if (CkConnector_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find ck-connector")
endif (CkConnector_FIND_REQUIRED)
endif (CKCONNECTOR_FOUND)
MARK_AS_ADVANCED(CKCONNECTOR_INCLUDE_DIR CKCONNECTOR_LIBRARIES)
endif (CKCONNECTOR_INCLUDE_DIR AND CKCONNECTOR_LIBRARIES)

View file

@ -0,0 +1,72 @@
# - Try to find the low-level D-Bus library
# Once done this will define
#
# DBUS_FOUND - system has D-Bus
# DBUS_INCLUDE_DIR - the D-Bus include directory
# DBUS_ARCH_INCLUDE_DIR - the D-Bus architecture-specific include directory
# DBUS_LIBRARIES - the libraries needed to use D-Bus
# Copyright (c) 2008, Kevin Kofler, <kevin.kofler@chello.at>
# modeled after FindLibArt.cmake:
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
# in cache already
SET(DBUS_FOUND TRUE)
else (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
IF (NOT WIN32)
FIND_PACKAGE(PkgConfig)
IF (PKG_CONFIG_FOUND)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
pkg_check_modules(_DBUS_PC QUIET dbus-1)
ENDIF (PKG_CONFIG_FOUND)
ENDIF (NOT WIN32)
FIND_PATH(DBUS_INCLUDE_DIR dbus/dbus.h
${_DBUS_PC_INCLUDE_DIRS}
/usr/include
/usr/include/dbus-1.0
/usr/local/include
)
FIND_PATH(DBUS_ARCH_INCLUDE_DIR dbus/dbus-arch-deps.h
${_DBUS_PC_INCLUDE_DIRS}
/usr/lib${LIB_SUFFIX}/include
/usr/lib${LIB_SUFFIX}/dbus-1.0/include
/usr/lib64/include
/usr/lib64/dbus-1.0/include
/usr/lib/include
/usr/lib/dbus-1.0/include
)
FIND_LIBRARY(DBUS_LIBRARIES NAMES dbus-1 dbus
PATHS
${_DBUS_PC_LIBDIR}
)
if (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
set(DBUS_FOUND TRUE)
endif (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
if (DBUS_FOUND)
if (NOT DBus_FIND_QUIETLY)
message(STATUS "Found D-Bus: ${DBUS_LIBRARIES}")
endif (NOT DBus_FIND_QUIETLY)
else (DBUS_FOUND)
if (DBus_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find D-Bus")
endif (DBus_FIND_REQUIRED)
endif (DBUS_FOUND)
MARK_AS_ADVANCED(DBUS_INCLUDE_DIR DBUS_ARCH_INCLUDE_DIR DBUS_LIBRARIES)
endif (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)

View file

@ -0,0 +1,29 @@
# - Try to find LibXKlavier
# Once done this will define
#
# LIBXKLAVIER_FOUND - system has LibXKlavier
# LIBXKLAVIER_LDFLAGS - the libraries needed to use LibXKlavier
# LIBXKLAVIER_CFLAGS - Compiler switches required for using LibXKlavier
# LIBXKLAVIER_VERSION - Version of LibXKlavier
if (LIBXKLAVIER_CFLAGS AND LIBXKLAVIER_LDFLAGS)
# in cache already
SET(LIBXKLAVIER_FOUND TRUE)
else (LIBXKLAVIER_CFLAGS AND LIBXKLAVIER_LDFLAGS)
IF (NOT WIN32)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
INCLUDE(UsePkgConfig)
pkg_check_modules(LIBXKLAVIER libxklavier>=3.0)
ENDIF (NOT WIN32)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXKlavier DEFAULT_MSG LIBXKLAVIER_CFLAGS LIBXKLAVIER_LDFLAGS)
MARK_AS_ADVANCED(LIBXKLAVIER_CFLAGS LIBXKLAVIER_LDFLAGS LIBXKLAVIER_VERSION)
endif (LIBXKLAVIER_CFLAGS AND LIBXKLAVIER_LDFLAGS)

View file

@ -0,0 +1,52 @@
# - Try to find OpenGLES
# Once done this will define
#
# OPENGLES_FOUND - system has OpenGLES and EGL
# OPENGL_EGL_FOUND - system has EGL
# OPENGLES_INCLUDE_DIR - the GLES include directory
# OPENGLES_LIBRARY - the GLES library
# OPENGLES_EGL_INCLUDE_DIR - the EGL include directory
# OPENGLES_EGL_LIBRARY - the EGL library
# OPENGLES_LIBRARIES - all libraries needed for OpenGLES
# OPENGLES_INCLUDES - all includes needed for OpenGLES
FIND_PATH(OPENGLES_INCLUDE_DIR GLES2/gl2.h
/usr/openwin/share/include
/opt/graphics/OpenGL/include /usr/X11R6/include
/usr/include
)
FIND_LIBRARY(OPENGLES_LIBRARY
NAMES GLESv2
PATHS /opt/graphics/OpenGL/lib
/usr/openwin/lib
/usr/shlib /usr/X11R6/lib
/usr/lib
)
FIND_PATH(OPENGLES_EGL_INCLUDE_DIR EGL/egl.h
/usr/openwin/share/include
/opt/graphics/OpenGL/include /usr/X11R6/include
/usr/include
)
FIND_LIBRARY(OPENGLES_EGL_LIBRARY
NAMES EGL
PATHS /usr/shlib /usr/X11R6/lib
/usr/lib
)
SET(OPENGL_EGL_FOUND "NO")
IF(OPENGLES_EGL_LIBRARY AND OPENGLES_EGL_INCLUDE_DIR)
SET(OPENGL_EGL_FOUND "YES")
ENDIF()
SET(OPENGLES_FOUND "NO")
IF(OPENGLES_LIBRARY AND OPENGLES_INCLUDE_DIR AND
OPENGLES_EGL_LIBRARY AND OPENGLES_EGL_INCLUDE_DIR)
SET(OPENGLES_LIBRARIES ${OPENGLES_LIBRARY} ${OPENGLES_LIBRARIES}
${OPENGLES_EGL_LIBRARY})
SET(OPENGLES_INCLUDES ${OPENGLES_INCLUDE_DIR} ${OPENGLES_EGL_INCLUDE_DIR})
SET(OPENGLES_FOUND "YES")
ENDIF()

View file

@ -0,0 +1,74 @@
# - Try to find the PAM libraries
# Once done this will define
#
# PAM_FOUND - system has pam
# PAM_INCLUDE_DIR - the pam include directory
# PAM_LIBRARIES - libpam library
if (PAM_INCLUDE_DIR AND PAM_LIBRARY)
# Already in cache, be silent
set(PAM_FIND_QUIETLY TRUE)
endif (PAM_INCLUDE_DIR AND PAM_LIBRARY)
find_path(PAM_INCLUDE_DIR NAMES security/pam_appl.h pam/pam_appl.h)
find_library(PAM_LIBRARY pam)
find_library(DL_LIBRARY dl)
if (PAM_INCLUDE_DIR AND PAM_LIBRARY)
set(PAM_FOUND TRUE)
if (DL_LIBRARY)
set(PAM_LIBRARIES ${PAM_LIBRARY} ${DL_LIBRARY})
else (DL_LIBRARY)
set(PAM_LIBRARIES ${PAM_LIBRARY})
endif (DL_LIBRARY)
if (EXISTS ${PAM_INCLUDE_DIR}/pam/pam_appl.h)
# darwin claims to be something special
set(HAVE_PAM_PAM_APPL_H 1)
endif (EXISTS ${PAM_INCLUDE_DIR}/pam/pam_appl.h)
if (NOT DEFINED PAM_MESSAGE_CONST)
include(CheckCXXSourceCompiles)
# XXX does this work with plain c?
check_cxx_source_compiles("
#if ${HAVE_PAM_PAM_APPL_H}+0
# include <pam/pam_appl.h>
#else
# include <security/pam_appl.h>
#endif
static int PAM_conv(
int num_msg,
const struct pam_message **msg, /* this is the culprit */
struct pam_response **resp,
void *ctx)
{
return 0;
}
int main(void)
{
struct pam_conv PAM_conversation = {
&PAM_conv, /* this bombs out if the above does not match */
0
};
return 0;
}
" PAM_MESSAGE_CONST)
endif (NOT DEFINED PAM_MESSAGE_CONST)
set(PAM_MESSAGE_CONST ${PAM_MESSAGE_CONST} CACHE BOOL "PAM expects a conversation function with const pam_message")
endif (PAM_INCLUDE_DIR AND PAM_LIBRARY)
if (PAM_FOUND)
if (NOT PAM_FIND_QUIETLY)
message(STATUS "Found PAM: ${PAM_LIBRARIES}")
endif (NOT PAM_FIND_QUIETLY)
else (PAM_FOUND)
if (PAM_FIND_REQUIRED)
message(FATAL_ERROR "PAM was not found")
endif(PAM_FIND_REQUIRED)
endif (PAM_FOUND)
mark_as_advanced(PAM_INCLUDE_DIR PAM_LIBRARY DL_LIBRARY PAM_MESSAGE_CONST)

View file

@ -0,0 +1,29 @@
# - Try to find the pciutils directory library
# Once done this will define
#
# PCIUTILS_FOUND - system has PCIUtils
# PCIUTILS_INCLUDE_DIR - the PCIUTILS include directory
# PCIUTILS_LIBRARIES - The libraries needed to use PCIUtils
if(PCIUTILS_INCLUDE_DIR AND PCIUTILS_LIBRARIES)
set(PCIUTILS_FIND_QUIETLY TRUE)
endif(PCIUTILS_INCLUDE_DIR AND PCIUTILS_LIBRARIES)
FIND_PATH(PCIUTILS_INCLUDE_DIR pci/pci.h)
FIND_LIBRARY(PCIUTILS_LIBRARY NAMES pci)
if(PCIUTILS_LIBRARY)
FIND_LIBRARY(RESOLV_LIBRARY NAMES resolv)
if(RESOLV_LIBRARY)
set(PCIUTILS_LIBRARIES ${PCIUTILS_LIBRARY} ${RESOLV_LIBRARY})
else(RESOLV_LIBRARY)
set(PCIUTILS_LIBRARIES ${PCIUTILS_LIBRARY})
endif(RESOLV_LIBRARY)
endif(PCIUTILS_LIBRARY)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCIUTILS DEFAULT_MSG PCIUTILS_LIBRARIES PCIUTILS_INCLUDE_DIR)
MARK_AS_ADVANCED(PCIUTILS_INCLUDE_DIR PCIUTILS_LIBRARIES)

View file

@ -0,0 +1,36 @@
# Find QJSON - JSON handling library for Qt
#
# This module defines
# QJSON_FOUND - whether the qsjon library was found
# QJSON_LIBRARIES - the qjson library
# QJSON_INCLUDE_DIR - the include path of the qjson library
#
# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@FreeBSD.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
# QJSON v0.7.2+ provides a QJSONConfig.cmake, which should be used if found.
find_package(QJSON QUIET NO_MODULE)
if (QJSON_FOUND)
set(REQUIRED_LIBS QJSON_CONFIG)
else (QJSON_FOUND)
find_package(PkgConfig)
pkg_check_modules(PC_QJSON QJson>=0.5)
find_library(QJSON_LIBRARIES
NAMES qjson
HINTS ${PC_QJSON_LIBDIR} ${PC_QJSON_LIBRARY_DIRS}
)
find_path(QJSON_INCLUDE_DIR
NAMES qjson/parser.h
HINTS ${PC_QJSON_INCLUDEDIR} ${PC_QJSON_INCLUDE_DIRS}
)
set(REQUIRED_LIBS QJSON_LIBRARIES QJSON_INCLUDE_DIR)
endif (QJSON_FOUND)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(QJSON DEFAULT_MSG ${REQUIRED_LIBS})

View file

@ -0,0 +1,52 @@
# - Try to find libqalculate
# Input variables
#
# QALCULATE_MIN_VERSION - minimal version of libqalculate
# QALCULATE_FIND_REQUIRED - fail if can't find libqalculate
#
# Once done this will define
#
# QALCULATE_FOUND - system has libqalculate
# QALCULATE_CFLAGS - libqalculate cflags
# QALCULATE_LIBRARIES - libqalculate libraries
#
# Copyright (c) 2007, Vladimir Kuznetsov, <ks.vladimir@gmail.com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if(QALCULATE_CFLAGS AND QALCULATE_LIBRARIES)
# in cache already
set(QALCULATE_FOUND TRUE)
else(QALCULATE_CFLAGS AND QALCULATE_LIBRARIES)
if(NOT WIN32)
include(UsePkgConfig)
if(QALCULATE_MIN_VERSION)
exec_program(${PKGCONFIG_EXECUTABLE} ARGS libqalculate --atleast-version=${QALCULATE_MIN_VERSION} RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull)
else(QALCULATE_MIN_VERSION)
exec_program(${PKGCONFIG_EXECUTABLE} ARGS libqalculate --exists RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull)
endif(QALCULATE_MIN_VERSION)
if(_return_VALUE STREQUAL "0")
exec_program(${PKGCONFIG_EXECUTABLE} ARGS libqalculate --libs OUTPUT_VARIABLE QALCULATE_LIBRARIES)
exec_program(${PKGCONFIG_EXECUTABLE} ARGS cln --libs OUTPUT_VARIABLE CLN_LIBRARIES)
exec_program(${PKGCONFIG_EXECUTABLE} ARGS libqalculate --cflags OUTPUT_VARIABLE QALCULATE_CFLAGS)
set(QALCULATE_FOUND TRUE)
endif(_return_VALUE STREQUAL "0")
else(NOT WIN32)
# XXX: currently no libqalculate on windows
set(QALCULATE_FOUND FALSE)
endif(NOT WIN32)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qalculate DEFAULT_MSG QALCULATE_LIBRARIES )
mark_as_advanced(QALCULATE_CFLAGS QALCULATE_LIBRARIES)
endif(QALCULATE_CFLAGS AND QALCULATE_LIBRARIES)

View file

@ -0,0 +1,20 @@
# - Try to find the raw1394 directory library
# Once done this will define
#
# RAW1394_FOUND - system has RAW1394
# RAW1394_INCLUDE_DIR - the RAW1394 include directory
# RAW1394_LIBRARIES - The libraries needed to use FAM
if(RAW1394_INCLUDE_DIR AND RAW1394_LIBRARIES)
set(RAW1394_FIND_QUIETLY TRUE)
endif(RAW1394_INCLUDE_DIR AND RAW1394_LIBRARIES)
FIND_PATH(RAW1394_INCLUDE_DIR libraw1394/raw1394.h)
FIND_LIBRARY(RAW1394_LIBRARIES NAMES raw1394 )
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(RAW1394 DEFAULT_MSG RAW1394_LIBRARIES RAW1394_INCLUDE_DIR)
MARK_AS_ADVANCED(RAW1394_INCLUDE_DIR RAW1394_LIBRARIES)

View file

@ -0,0 +1,16 @@
# - Try to find the sensors directory library
# Once done this will define
#
# SENSORS_FOUND - system has SENSORS
# SENSORS_INCLUDE_DIR - the SENSORS include directory
# SENSORS_LIBRARIES - The libraries needed to use SENSORS
FIND_PATH(SENSORS_INCLUDE_DIR sensors/sensors.h)
FIND_LIBRARY(SENSORS_LIBRARIES NAMES sensors)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sensors DEFAULT_MSG SENSORS_INCLUDE_DIR SENSORS_LIBRARIES )
MARK_AS_ADVANCED(SENSORS_INCLUDE_DIR SENSORS_LIBRARIES)

View file

@ -0,0 +1,19 @@
# - Try to find UDev
# Once done this will define
#
# UDEV_FOUND - system has UDev
# UDEV_INCLUDE_DIR - the libudev include directory
# UDEV_LIBS - The libudev libraries
# Copyright (c) 2010, Rafael Fernández López, <ereslibre@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
find_path(UDEV_INCLUDE_DIR libudev.h)
find_library(UDEV_LIBS udev)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(UDev DEFAULT_MSG UDEV_INCLUDE_DIR UDEV_LIBS)
mark_as_advanced(UDEV_INCLUDE_DIR UDEV_LIBS)

View file

@ -0,0 +1,62 @@
# Try to find Wayland on a Unix system
#
# This will define:
#
# WAYLAND_FOUND - True if Wayland is found
# WAYLAND_LIBRARIES - Link these to use Wayland
# WAYLAND_INCLUDE_DIR - Include directory for Wayland
# WAYLAND_DEFINITIONS - Compiler flags for using Wayland
#
# In addition the following more fine grained variables will be defined:
#
# WAYLAND_CLIENT_FOUND WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES
# WAYLAND_SERVER_FOUND WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES
# WAYLAND_EGL_FOUND WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES
#
# Copyright (c) 2013 Martin Gräßlin <mgraesslin@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
IF (NOT WIN32)
IF (WAYLAND_INCLUDE_DIR AND WAYLAND_LIBRARIES)
# In the cache already
SET(WAYLAND_FIND_QUIETLY TRUE)
ENDIF ()
# Use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(PKG_WAYLAND QUIET wayland-client wayland-server wayland-egl)
SET(WAYLAND_DEFINITIONS ${PKG_WAYLAND_CFLAGS})
FIND_PATH(WAYLAND_CLIENT_INCLUDE_DIR NAMES wayland-client.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
FIND_PATH(WAYLAND_SERVER_INCLUDE_DIR NAMES wayland-server.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
FIND_PATH(WAYLAND_EGL_INCLUDE_DIR NAMES wayland-egl.h HINTS ${PKG_WAYLAND_INCLUDE_DIRS})
FIND_LIBRARY(WAYLAND_CLIENT_LIBRARIES NAMES wayland-client HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
FIND_LIBRARY(WAYLAND_SERVER_LIBRARIES NAMES wayland-server HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
FIND_LIBRARY(WAYLAND_EGL_LIBRARIES NAMES wayland-egl HINTS ${PKG_WAYLAND_LIBRARY_DIRS})
set(WAYLAND_INCLUDE_DIR ${WAYLAND_CLIENT_INCLUDE_DIR} ${WAYLAND_SERVER_INCLUDE_DIR} ${WAYLAND_EGL_INCLUDE_DIR})
set(WAYLAND_LIBRARIES ${WAYLAND_CLIENT_LIBRARIES} ${WAYLAND_SERVER_LIBRARIES} ${WAYLAND_EGL_LIBRARIES})
list(REMOVE_DUPLICATES WAYLAND_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_CLIENT DEFAULT_MSG WAYLAND_CLIENT_LIBRARIES WAYLAND_CLIENT_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_SERVER DEFAULT_MSG WAYLAND_SERVER_LIBRARIES WAYLAND_SERVER_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND_EGL DEFAULT_MSG WAYLAND_EGL_LIBRARIES WAYLAND_EGL_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WAYLAND DEFAULT_MSG WAYLAND_LIBRARIES WAYLAND_INCLUDE_DIR)
MARK_AS_ADVANCED(
WAYLAND_INCLUDE_DIR WAYLAND_LIBRARIES
WAYLAND_CLIENT_INCLUDE_DIR WAYLAND_CLIENT_LIBRARIES
WAYLAND_SERVER_INCLUDE_DIR WAYLAND_SERVER_LIBRARIES
WAYLAND_EGL_INCLUDE_DIR WAYLAND_EGL_LIBRARIES
)
ENDIF ()

View file

@ -0,0 +1,31 @@
# - Try to find libX11-xcb
# Once done this will define
#
# X11_XCB_FOUND - system has libX11-xcb
# X11_XCB_LIBRARIES - Link these to use libX11-xcb
# X11_XCB_INCLUDE_DIR - the libX11-xcb include dir
# X11_XCB_DEFINITIONS - compiler switches required for using libX11-xcb
# Copyright (c) 2012 Fredrik Höglund <fredrik@kde.org>
# Copyright (c) 2008 Helio Chissini de Castro, <helio@kde.org>
# Copyright (c) 2007 Matthias Kretz, <kretz@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
IF (NOT WIN32)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(PKG_X11_XCB QUIET x11-xcb)
SET(X11_XCB_DEFINITIONS ${PKG_X11_XCB_CFLAGS})
FIND_PATH(X11_XCB_INCLUDE_DIR NAMES X11/Xlib-xcb.h HINTS ${PKG_X11_XCB_INCLUDE_DIRS})
FIND_LIBRARY(X11_XCB_LIBRARIES NAMES X11-xcb HINTS ${PKG_X11_XCB_LIBRARY_DIRS})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(X11_XCB DEFAULT_MSG X11_XCB_LIBRARIES X11_XCB_INCLUDE_DIR)
MARK_AS_ADVANCED(X11_XCB_INCLUDE_DIR X11_XCB_LIBRARIES)
ENDIF (NOT WIN32)

123
cmake/modules/FindXCB.cmake Normal file
View file

@ -0,0 +1,123 @@
# Try to find XCB on a Unix system
#
# This will define:
#
# XCB_FOUND - True if xcb is available
# XCB_LIBRARIES - Link these to use xcb
# XCB_INCLUDE_DIR - Include directory for xcb
# XCB_DEFINITIONS - Compiler flags for using xcb
#
# In addition the following more fine grained variables will be defined:
#
# XCB_XCB_FOUND XCB_XCB_INCLUDE_DIR XCB_XCB_LIBRARIES
# XCB_COMPOSITE_FOUND XCB_COMPOSITE_INCLUDE_DIR XCB_COMPOSITE_LIBRARIES
# XCB_DAMAGE_FOUND XCB_DAMAGE_INCLUDE_DIR XCB_DAMAGE_LIBRARIES
# XCB_XFIXES_FOUND XCB_XFIXES_INCLUDE_DIR XCB_XFIXES_LIBRARIES
# XCB_RENDER_FOUND XCB_RENDER_INCLUDE_DIR XCB_RENDER_LIBRARIES
# XCB_RANDR_FOUND XCB_RANDR_INCLUDE_DIR XCB_RANDR_LIBRARIES
# XCB_SHAPE_FOUND XCB_SHAPE_INCLUDE_DIR XCB_SHAPE_LIBRARIES
# XCB_SHM_FOUND XCB_SHM_INCLUDE_DIR XCB_SHM_LIBRARIES
# XCB_SYNC_FOUND XCB_SYNC_INCLUDE_DIR XCB_SYNC_LIBRARIES
# XCB_IMAGE_FOUND XCB_IMAGE_INCLUDE_DIR XCB_IMAGE_LIBRARIES
# XCB_RENDERUTIL_FOUND XCB_RENDERUTIL_INCLUDE_DIR XCB_RENDERUTIL_LIBRARIES
# XCB_KEYSYMS_FOUND XCB_KEYSYMS_INCLUDE_DIR XCB_KEYSYMS_LIBRARIES
# XCB_XTEST_FOUND XCB_XTEST_INCLUDE_DIR XCB_XTEST_LIBRARIES
#
# Copyright (c) 2012 Fredrik Höglund <fredrik@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
IF (NOT WIN32)
IF (XCB_INCLUDE_DIR AND XCB_LIBRARIES)
# In the cache already
SET(XCB_FIND_QUIETLY TRUE)
ENDIF (XCB_INCLUDE_DIR AND XCB_LIBRARIES)
# Use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(PKG_XCB QUIET xcb xcb-util xcb-composite xcb-xfixes xcb-damage xcb-render xcb-randr
xcb-shape xcb-dri2 xcb-glx xcb-shm xcb-xv xcb-sync
xcb-xtest xcb-icccm xcb-ewmh xcb-image xcb-renderutil xcb-keysyms)
SET(XCB_DEFINITIONS ${PKG_XCB_CFLAGS})
FIND_PATH(XCB_XCB_INCLUDE_DIR NAMES xcb/xcb.h HINTS ${PKG_XCB_INCLUDE_DIRS})
FIND_PATH(XCB_COMPOSITE_INCLUDE_DIR NAMES xcb/composite.h HINTS ${PKG_XCB_INCLUDE_DIRS})
FIND_PATH(XCB_XFIXES_INCLUDE_DIR NAMES xcb/xfixes.h HINTS ${PKG_XCB_INCLUDE_DIRS})
FIND_PATH(XCB_DAMAGE_INCLUDE_DIR NAMES xcb/damage.h HINTS ${PKG_XCB_INCLUDE_DIRS})
FIND_PATH(XCB_RENDER_INCLUDE_DIR NAMES xcb/render.h HINTS ${PKG_XCB_INCLUDE_DIRS})
FIND_PATH(XCB_RANDR_INCLUDE_DIR NAMES xcb/randr.h HINTS ${PKG_XCB_INCLUDE_DIRS})
FIND_PATH(XCB_SHAPE_INCLUDE_DIR NAMES xcb/shape.h HINTS ${PKG_XCB_INCLUDE_DIRS})
FIND_PATH(XCB_SHM_INCLUDE_DIR NAMES xcb/shm.h HINTS ${PKG_XCB_INCLUDE_DIRS})
FIND_PATH(XCB_SYNC_INCLUDE_DIR NAMES xcb/sync.h HINTS ${PKG_XCB_INCLUDE_DIRS})
FIND_PATH(XCB_IMAGE_INCLUDE_DIR NAMES xcb/xcb_image.h HINTS ${PKG_XCB_INCLUDE_DIRS})
FIND_PATH(XCB_RENDERUTIL_INCLUDE_DIR NAMES xcb/xcb_renderutil.h HINTS ${PKG_XCB_INCLUDE_DIRS})
FIND_PATH(XCB_KEYSYMS_INCLUDE_DIR NAMES xcb/xcb_keysyms.h HINTS ${PKG_XCB_INCLUDE_DIRS})
FIND_PATH(XCB_XTEST_INCLUDE_DIR NAMES xcb/xtest.h HINTS ${PKG_XCB_INCLUDE_DIRS})
FIND_LIBRARY(XCB_XCB_LIBRARIES NAMES xcb HINTS ${PKG_XCB_LIBRARY_DIRS})
FIND_LIBRARY(XCB_COMPOSITE_LIBRARIES NAMES xcb-composite HINTS ${PKG_XCB_LIBRARY_DIRS})
FIND_LIBRARY(XCB_DAMAGE_LIBRARIES NAMES xcb-damage HINTS ${PKG_XCB_LIBRARY_DIRS})
FIND_LIBRARY(XCB_XFIXES_LIBRARIES NAMES xcb-xfixes HINTS ${PKG_XCB_LIBRARY_DIRS})
FIND_LIBRARY(XCB_RENDER_LIBRARIES NAMES xcb-render HINTS ${PKG_XCB_LIBRARY_DIRS})
FIND_LIBRARY(XCB_RANDR_LIBRARIES NAMES xcb-randr HINTS ${PKG_XCB_LIBRARY_DIRS})
FIND_LIBRARY(XCB_SHAPE_LIBRARIES NAMES xcb-shape HINTS ${PKG_XCB_LIBRARY_DIRS})
FIND_LIBRARY(XCB_SHM_LIBRARIES NAMES xcb-shm HINTS ${PKG_XCB_LIBRARY_DIRS})
FIND_LIBRARY(XCB_SYNC_LIBRARIES NAMES xcb-sync HINTS ${PKG_XCB_LIBRARY_DIRS})
FIND_LIBRARY(XCB_IMAGE_LIBRARIES NAMES xcb-image HINTS ${PKG_XCB_LIBRARY_DIRS})
FIND_LIBRARY(XCB_RENDERUTIL_LIBRARIES NAMES xcb-render-util HINTS ${PKG_XCB_LIBRARY_DIRS})
FIND_LIBRARY(XCB_KEYSYMS_LIBRARIES NAMES xcb-keysyms HINTS ${PKG_XCB_LIBRARY_DIRS})
FIND_LIBRARY(XCB_XTEST_LIBRARIES NAMES xcb-xtest HINTS ${PKG_XCB_LIBRARY_DIRS})
set(XCB_INCLUDE_DIR ${XCB_XCB_INCLUDE_DIR} ${XCB_COMPOSITE_INCLUDE_DIR} ${XCB_XFIXES_INCLUDE_DIR}
${XCB_DAMAGE_INCLUDE_DIR} ${XCB_RENDER_INCLUDE_DIR} ${XCB_RANDR_INCLUDE_DIR}
${XCB_SHAPE_INCLUDE_DIR} ${XCB_SHM_INCLUDE_DIR} ${XCB_SYNC_INCLUDE_DIR}
${XCB_IMAGE_INCLUDE_DIR} ${XCB_RENDERUTIL_INCLUDE_DIR} ${XCB_KEYSYMS_INCLUDE_DIR}
${XCB_XTEST_INCLUDE_DIR})
set(XCB_LIBRARIES ${XCB_XCB_LIBRARIES} ${XCB_COMPOSITE_LIBRARIES} ${XCB_XFIXES_LIBRARIES}
${XCB_DAMAGE_LIBRARIES} ${XCB_RENDER_LIBRARIES} ${XCB_RANDR_LIBRARIES}
${XCB_SHAPE_LIBRARIES} ${XCB_SHM_LIBRARIES} ${XCB_SYNC_LIBRARIES}
${XCB_IMAGE_LIBRARIES} ${XCB_RENDERUTIL_LIBRARIES} ${XCB_KEYSYMS_LIBRARIES}
${XCB_XTEST_LIBRARIES})
list(REMOVE_DUPLICATES XCB_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_XCB DEFAULT_MSG XCB_XCB_LIBRARIES XCB_XCB_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_COMPOSITE DEFAULT_MSG XCB_COMPOSITE_LIBRARIES XCB_COMPOSITE_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_DAMAGE DEFAULT_MSG XCB_DAMAGE_LIBRARIES XCB_DAMAGE_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_XFIXES DEFAULT_MSG XCB_XFIXES_LIBRARIES XCB_XFIXES_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_RENDER DEFAULT_MSG XCB_RENDER_LIBRARIES XCB_RENDER_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_RANDR DEFAULT_MSG XCB_RANDR_LIBRARIES XCB_RANDR_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_SHAPE DEFAULT_MSG XCB_SHAPE_LIBRARIES XCB_SHAPE_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_SHM DEFAULT_MSG XCB_SHM_LIBRARIES XCB_SHM_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_SYNC DEFAULT_MSG XCB_SYNC_LIBRARIES XCB_SYNC_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_IMAGE DEFAULT_MSG XCB_IMAGE_LIBRARIES XCB_IMAGE_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_RENDERUTIL DEFAULT_MSG XCB_RENDERUTIL_LIBRARIES XCB_RENDERUTIL_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_KEYSYMS DEFAULT_MSG XCB_KEYSYMS_LIBRARIES XCB_KEYSYMS_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB_XTEST DEFAULT_MSG XCB_XTEST_LIBRARIES XCB_XTEST_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(XCB DEFAULT_MSG XCB_LIBRARIES XCB_INCLUDE_DIR)
MARK_AS_ADVANCED(
XCB_INCLUDE_DIR XCB_LIBRARIES
XCB_XCB_INCLUDE_DIR XCB_XCB_LIBRARIES
XCB_COMPOSITE_INCLUDE_DIR XCB_COMPOSITE_LIBRARIES
XCB_DAMAGE_INCLUDE_DIR XCB_DAMAGE_LIBRARIES
XCB_XFIXES_INCLUDE_DIR XCB_XFIXES_LIBRARIES
XCB_RENDER_INCLUDE_DIR XCB_RENDER_LIBRARIES
XCB_RANDR_INCLUDE_DIR XCB_RANDR_LIBRARIES
XCB_SHAPE_INCLUDE_DIR XCB_SHAPE_LIBRARIES
XCB_SHM_INCLUDE_DIR XCB_SHM_LIBRARIES
XCB_SYNC_INCLUDE_DIR XCB_SYNC_LIBRARIES
XCB_IMAGE_INCLUDE_DIR XCB_IMAGE_LIBRARIES
XCB_RENDERUTIL_INCLUDE_DIR XCB_RENDERUTIL_LIBRARIES
XCB_KEYSYMS_INCLUDE_DIR XCB_KEYSYMS_LIBRARIES
XCB_XTEST_INCLUDE_DIR XCB_XTEST_LIBRARIES
)
ENDIF (NOT WIN32)

View file

@ -0,0 +1,32 @@
include(UsePkgConfig)
MACRO(PKGCONFIG_GETVAR _package _var _output_variable)
SET(${_output_variable})
# if pkg-config has been found
IF(PKGCONFIG_EXECUTABLE)
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --exists RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _pkgconfigDevNull )
# and if the package of interest also exists for pkg-config, then get the information
IF(NOT _return_VALUE)
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable ${_var} OUTPUT_VARIABLE ${_output_variable} )
ENDIF(NOT _return_VALUE)
ENDIF(PKGCONFIG_EXECUTABLE)
ENDMACRO(PKGCONFIG_GETVAR _package _var _output_variable)
macro(dbus_add_activation_service _sources)
#PKGCONFIG_GETVAR(dbus-1 session_bus_services_dir _install_dir)
foreach (_i ${_sources})
get_filename_component(_service_file ${_i} ABSOLUTE)
string(REGEX REPLACE "\\.service.*$" ".service" _output_file ${_i})
set(_target ${CMAKE_CURRENT_BINARY_DIR}/${_output_file})
configure_file(${_service_file} ${_target})
install(FILES ${_target} DESTINATION ${DBUS_SERVICES_INSTALL_DIR} )
#install(FILES ${_target} DESTINATION ${_install_dir})
endforeach (_i ${ARGN})
endmacro(dbus_add_activation_service _sources)

View file

@ -0,0 +1,55 @@
macro_optional_find_package(PAM)
include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckIncludeFiles)
set(UNIXAUTH_LIBRARIES)
set(UNIXAUTH_INCLUDE_DIRS)
set(SHADOW_LIBRARIES)
check_function_exists(getspnam found_getspnam)
if (found_getspnam)
set(HAVE_GETSPNAM 1)
else (found_getspnam)
macro_push_required_vars()
set(CMAKE_REQUIRED_LIBRARIES -lshadow)
check_function_exists(getspnam found_getspnam_shadow)
if (found_getspnam_shadow)
set(HAVE_GETSPNAM 1)
set(SHADOW_LIBRARIES shadow)
check_function_exists(pw_encrypt HAVE_PW_ENCRYPT) # ancient Linux shadow
else (found_getspnam_shadow)
set(CMAKE_REQUIRED_LIBRARIES -lgen) # UnixWare
check_function_exists(getspnam found_getspnam_gen)
if (found_getspnam_gen)
set(HAVE_GETSPNAM 1)
set(SHADOW_LIBRARIES gen)
endif (found_getspnam_gen)
endif (found_getspnam_shadow)
macro_pop_required_vars()
endif (found_getspnam)
set(CRYPT_LIBRARIES)
check_library_exists(crypt crypt "" HAVE_CRYPT)
if (HAVE_CRYPT)
set(CRYPT_LIBRARIES crypt)
check_include_files(crypt.h HAVE_CRYPT_H)
endif (HAVE_CRYPT)
if (PAM_FOUND)
set(HAVE_PAM 1)
set(UNIXAUTH_LIBRARIES ${PAM_LIBRARIES})
set(UNIXAUTH_INCLUDE_DIRS ${PAM_INCLUDE_DIR})
else (PAM_FOUND)
if (HAVE_GETSPNAM)
set(UNIXAUTH_LIBRARIES ${SHADOW_LIBRARIES})
endif (HAVE_GETSPNAM)
if (NOT HAVE_PW_ENCRYPT)
set(UNIXAUTH_LIBRARIES ${UNIXAUTH_LIBRARIES} ${CRYPT_LIBRARIES})
endif (NOT HAVE_PW_ENCRYPT)
endif (PAM_FOUND)

41
config-X11.h.cmake Normal file
View file

@ -0,0 +1,41 @@
/* Define if you have the XRandR extension */
#cmakedefine HAVE_XRANDR 1
/* Define if you have the XDamage extension */
#cmakedefine HAVE_XDAMAGE 1
/* Define if you have the XKB extension */
#cmakedefine HAVE_XKB 1
/* Define if you have the Xinerama extension */
#cmakedefine HAVE_XINERAMA 1
/* Define if you have the XSHM (MIT SHM) extension */
#cmakedefine HAVE_XSHM 1
/* Define if you have the XComposite extension */
#cmakedefine HAVE_XCOMPOSITE 1
/* Define to 1 if you have Xcursor */
#cmakedefine HAVE_XCURSOR 1
/* Define if you have the xf86misc extension */
#cmakedefine HAVE_XF86MISC 1
/* Define if you have the XFixes extension */
#cmakedefine HAVE_XFIXES 1
/* Define if you have the XTest extension */
#cmakedefine HAVE_XTEST 1
/* Define if your system has XRender support */
#cmakedefine HAVE_XRENDER 1
/* Define if you have OpenGL */
#cmakedefine HAVE_OPENGL 1
/* Define if you have the XSync extension */
#cmakedefine HAVE_XSYNC 1
/* Define if you have XRandR 1.3 */
#cmakedefine HAS_RANDR_1_3 1

35
config-unix.h.cmake Normal file
View file

@ -0,0 +1,35 @@
/* Defines if you have PAM (Pluggable Authentication Modules) */
#cmakedefine HAVE_PAM 1
/* Define if your PAM headers are in pam/ instead of security/ */
#cmakedefine HAVE_PAM_PAM_APPL_H 1
/* Define if your PAM expects a conversation function with const pam_message (Solaris) */
#cmakedefine PAM_MESSAGE_CONST 1
/* The PAM service to be used by kdm */
#cmakedefine KDM_PAM_SERVICE ${KDM_PAM_SERVICE}
/* The PAM service to be used by kscreensaver */
#cmakedefine KSCREENSAVER_PAM_SERVICE ${KSCREENSAVER_PAM_SERVICE}
/* Defines if your system has the getspnam function */
#cmakedefine HAVE_GETSPNAM 1
/* Defines if your system has the crypt function */
#cmakedefine HAVE_CRYPT 1
/* Define to 1 if you have the <crypt.h> header file. */
#cmakedefine HAVE_CRYPT_H 1
/* Define to 1 if you have the `pw_encrypt' function. */
#cmakedefine HAVE_PW_ENCRYPT 1
/* Define to 1 if you have the `getpassphrase' function. */
#cmakedefine HAVE_GETPASSPHRASE 1
/* Define to 1 if you have the `vsyslog' function. */
#cmakedefine HAVE_VSYSLOG 1
/* Define to 1 if you have the <limits.h> header file. */
#cmakedefine HAVE_LIMITS_H 1

159
config-workspace.h.cmake Normal file
View file

@ -0,0 +1,159 @@
/* config-workspace.h. Generated by cmake from config-workspace.h.cmake */
#cmakedefine HAVE_QIMAGEBLITZ
/* Define if you have DPMS support */
#cmakedefine HAVE_DPMS 1
/* Define if you have the DPMSCapable prototype in <X11/extensions/dpms.h> */
#cmakedefine HAVE_DPMSCAPABLE_PROTO 1
/* Define if you have the DPMSInfo prototype in <X11/extensions/dpms.h> */
#cmakedefine HAVE_DPMSINFO_PROTO 1
/* Defines if your system has the libfontconfig library */
#cmakedefine HAVE_FONTCONFIG 1
/* Defines if your system has the freetype library */
#cmakedefine HAVE_FREETYPE 1
/* Define if you have gethostname */
#cmakedefine HAVE_GETHOSTNAME 1
/* Define if you have the gethostname prototype */
#cmakedefine HAVE_GETHOSTNAME_PROTO 1
/* Define to 1 if you have the `getpeereid' function. */
#cmakedefine HAVE_GETPEEREID 1
/* Defines if you have Solaris' libkstat */
/* #undef HAVE_KSTAT */
/* Define if you have long long as datatype */
#cmakedefine HAVE_LONG_LONG 1
/* Define to 1 if you have the `nice' function. */
#cmakedefine HAVE_NICE 1
/* Define to 1 if you have the <sasl.h> header file. */
#cmakedefine HAVE_SASL_H 1
/* Define to 1 if you have the <sasl/sasl.h> header file. */
#cmakedefine HAVE_SASL_SASL_H 1
/* Define to 1 if you have the `setpriority' function. */
#cmakedefine HAVE_SETPRIORITY 1
/* Define to 1 if you have the `sigaction' function. */
#cmakedefine HAVE_SIGACTION 1
/* Define to 1 if you have the `sigset' function. */
#cmakedefine HAVE_SIGSET 1
/* Define to 1 if you have statvfs */
#cmakedefine HAVE_STATVFS 1
/* Define to 1 if you have the <string.h> header file. */
#cmakedefine HAVE_STRING_H 1
/* Define if you have the struct ucred */
#cmakedefine HAVE_STRUCT_UCRED 1
/* Define to 1 if you have the <sys/loadavg.h> header file. */
#cmakedefine HAVE_SYS_LOADAVG_H 1
/* Define to 1 if you have the <sys/mount.h> header file. */
#cmakedefine HAVE_SYS_MOUNT_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
#cmakedefine HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/statfs.h> header file. */
#cmakedefine HAVE_SYS_STATFS_H 1
/* Define to 1 if you have the <sys/statvfs.h> header file. */
#cmakedefine HAVE_SYS_STATVFS_H 1
/* Define to 1 if you have statfs(). */
#cmakedefine HAVE_STATFS 1
/* Define to 1 if you have the <sys/select.h> header file. */
#cmakedefine HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/socket.h> header file. */
#cmakedefine HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#cmakedefine HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#cmakedefine HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/vfs.h> header file. */
#cmakedefine HAVE_SYS_VFS_H 1
/* Define to 1 if you have the <sys/wait.h> header file. */
#cmakedefine HAVE_SYS_WAIT_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#cmakedefine HAVE_STDINT_H 1
/* Define to 1 if you have the <malloc.h> header file. */
#cmakedefine HAVE_MALLOC_H 1
/* Define if you have unsetenv */
#cmakedefine HAVE_UNSETENV 1
/* Define if you have the unsetenv prototype */
#cmakedefine HAVE_UNSETENV_PROTO 1
/* Define if you have usleep */
#cmakedefine HAVE_USLEEP 1
/* Define if you have the usleep prototype */
#cmakedefine HAVE_USLEEP_PROTO 1
/* Define to 1 if you have the `vsnprintf' function. */
#cmakedefine HAVE_VSNPRINTF 1
/* Define to 1 if you have the Wayland libraries. */
#cmakedefine WAYLAND_FOUND 1
/* KDE's default home directory */
#cmakedefine KDE_DEFAULT_HOME "${KDE_DEFAULT_HOME}"
/* KDE's binaries directory */
#define KDE_BINDIR "${BIN_INSTALL_DIR}"
/* KDE's configuration directory */
#define KDE_CONFDIR "${CONFIG_INSTALL_DIR}"
/* KDE's static data directory */
#define KDE_DATADIR "${DATA_INSTALL_DIR}"
/* Define where your java executable is */
#undef PATH_JAVA
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#cmakedefine TIME_WITH_SYS_TIME 1
/* X binaries directory */
#cmakedefine XBINDIR "${XBINDIR}"
/* X libraries directory */
#cmakedefine XLIBDIR "${XLIBDIR}"
/* Number of bits in a file offset, on hosts where this is settable. */
#define _FILE_OFFSET_BITS 64
/*
* On HP-UX, the declaration of vsnprintf() is needed every time !
*/
/* type to use in place of socklen_t if not defined */
#define kde_socklen_t socklen_t
#define WORKSPACE_VERSION_STRING "${KDE4WORKSPACE_VERSION}"

13
cursors/CMakeLists.txt Normal file
View file

@ -0,0 +1,13 @@
set(cursors_folders
Oxygen_Black
Oxygen_Blue
Oxygen_White
Oxygen_Yellow
Oxygen_Zion
KDE_Classic
)
foreach(theme ${cursors_folders})
install(DIRECTORY ${theme} DESTINATION ${ICON_INSTALL_DIR})
endforeach(theme)

View file

@ -0,0 +1 @@
half-busy

View file

@ -0,0 +1 @@
size_ver

View file

@ -0,0 +1 @@
half-busy

View file

@ -0,0 +1 @@
half-busy

View file

@ -0,0 +1 @@
closedhand

View file

@ -0,0 +1 @@
help

View file

@ -0,0 +1 @@
closedhand

View file

@ -0,0 +1 @@
pointing_hand

Binary file not shown.

View file

@ -0,0 +1 @@
fleur

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1 @@
split_v

Binary file not shown.

View file

@ -0,0 +1 @@
forbidden

Binary file not shown.

View file

@ -0,0 +1 @@
help

View file

@ -0,0 +1 @@
closedhand

View file

@ -0,0 +1 @@
forbidden

View file

@ -0,0 +1 @@
closedhand

View file

@ -0,0 +1 @@
size_hor

View file

@ -0,0 +1 @@
pointing_hand

View file

@ -0,0 +1 @@
closedhand

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1 @@
half-busy

Binary file not shown.

View file

@ -0,0 +1 @@
closedhand

View file

@ -0,0 +1 @@
size_ver

View file

@ -0,0 +1 @@
forbidden

Binary file not shown.

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