diff --git a/kcontrol/CMakeLists.txt b/kcontrol/CMakeLists.txt index ed080c38..95bf0741 100644 --- a/kcontrol/CMakeLists.txt +++ b/kcontrol/CMakeLists.txt @@ -20,8 +20,6 @@ if(X11_Xkb_FOUND) endif(X11_Xkb_FOUND) add_subdirectory( input ) -# TODO: make conditional? -add_subdirectory( touchpad ) add_subdirectory( access ) add_subdirectory( screensaver ) add_subdirectory( dateandtime ) diff --git a/kcontrol/touchpad/CMakeLists.txt b/kcontrol/touchpad/CMakeLists.txt deleted file mode 100644 index 7d61ba7b..00000000 --- a/kcontrol/touchpad/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -project(kcm-touchpad) - -set(TOUCHPAD_KCM_VERSION "1.1") - -add_subdirectory(src) -add_subdirectory(icon) diff --git a/kcontrol/touchpad/COPYING b/kcontrol/touchpad/COPYING deleted file mode 100644 index bd7680cc..00000000 --- a/kcontrol/touchpad/COPYING +++ /dev/null @@ -1,347 +0,0 @@ -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. - - - Copyright (C) 19yy - - 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. - - , 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. - diff --git a/kcontrol/touchpad/Messages.sh b/kcontrol/touchpad/Messages.sh deleted file mode 100644 index 9dd5eb02..00000000 --- a/kcontrol/touchpad/Messages.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -$EXTRACTRC `find src -path src/applet -prune -o \( -name \*.rc -o -name \*.ui -o -name \*.kcfg \) -print` >> rc.cpp -$XGETTEXT rc.cpp `find src -path src/applet -prune -o \( -name \*.cpp -o -name \*.h \) -print` -o $podir/kcm_touchpad.pot - -$XGETTEXT `find src/applet -name \*.qml -o -name \*.js` -o $podir/plasma_applet_touchpad.pot diff --git a/kcontrol/touchpad/README.md b/kcontrol/touchpad/README.md deleted file mode 100644 index 73ae4fd2..00000000 --- a/kcontrol/touchpad/README.md +++ /dev/null @@ -1,63 +0,0 @@ -Touchpad KCM -============ - -* KCModule -* Daemon - - Automatically enable/disable touchpad when typing and/or when mouse is plugged in - - Enable/disable touchpad with keyboard shortcuts -* Applet - - Shows touchpad's state - - Toggle touchpad with single click - -Dependencies ------------- - -* KDElibs 4 -* Xlib -* xcb -* xf86-input-synaptics (headers are required to build) - - -How to install --------------- - - $ mkdir build - $ cd build - $ cmake -DCMAKE_INSTALL_PREFIX="$(kde4-config --prefix)" .. - $ make - # make install - -### Packages - -* [Ubuntu][1] - - [Kubuntu Experimental PPA][2] -* [Arch Linux][3] - - [AUR (from git master)][4] - -Translations ------------- -Translations live in KDE's svn repository. -If they aren't shipped as part of KDE l10n packages, translations could be built and installed by adding -DTRANSLATIONS="lang1 lang2 ..." to cmake command line. -Language names are the same as in .desktop files. -.po files are fetched from svn repository automatically. -If downloading isn't possible, .po files could be placed in source directory under names "kcm_touchpad_lang1.po" and "plasma_applet_touchpad_lang1.po", where "lang1" is replaced with proper language name. - -Bugs ----- - -Bugs should be reported to [KDE Bugzilla, product: Touchpad KCM][5] - -Patches -------- -I'm always happy to accept patches at: - -* [KDE reviewboard][6], repository "kcm-touchpad". The repository contains a .reviewboardrc file. -* [GitHub with pull request][7]. - -[1]: http://packages.ubuntu.com/trusty/kde/kde-touchpad -[2]: https://code.launchpad.net/~rohangarg/+recipe/touchpad-daily -[3]: https://www.archlinux.org/packages/community/x86_64/kcm-touchpad/ -[4]: https://aur.archlinux.org/packages/kcm-touchpad-git/ -[5]: https://bugs.kde.org/enter_bug.cgi?product=Touchpad%20KCM -[6]: https://git.reviewboard.kde.org/ -[7]: https://github.com/sanya-m/kde-touchpad-config diff --git a/kcontrol/touchpad/icon/CMakeLists.txt b/kcontrol/touchpad/icon/CMakeLists.txt deleted file mode 100644 index 02e3c9ec..00000000 --- a/kcontrol/touchpad/icon/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -kde4_install_icons(${ICON_INSTALL_DIR}) diff --git a/kcontrol/touchpad/icon/hi128-devices-input-touchpad.png b/kcontrol/touchpad/icon/hi128-devices-input-touchpad.png deleted file mode 100644 index ffc3d870..00000000 Binary files a/kcontrol/touchpad/icon/hi128-devices-input-touchpad.png and /dev/null differ diff --git a/kcontrol/touchpad/icon/hi16-devices-input-touchpad.png b/kcontrol/touchpad/icon/hi16-devices-input-touchpad.png deleted file mode 100644 index 329422dd..00000000 Binary files a/kcontrol/touchpad/icon/hi16-devices-input-touchpad.png and /dev/null differ diff --git a/kcontrol/touchpad/icon/hi22-devices-input-touchpad.png b/kcontrol/touchpad/icon/hi22-devices-input-touchpad.png deleted file mode 100644 index 68276cef..00000000 Binary files a/kcontrol/touchpad/icon/hi22-devices-input-touchpad.png and /dev/null differ diff --git a/kcontrol/touchpad/icon/hi24-devices-input-touchpad.png b/kcontrol/touchpad/icon/hi24-devices-input-touchpad.png deleted file mode 100644 index 72bf9b36..00000000 Binary files a/kcontrol/touchpad/icon/hi24-devices-input-touchpad.png and /dev/null differ diff --git a/kcontrol/touchpad/icon/hi256-devices-input-touchpad.png b/kcontrol/touchpad/icon/hi256-devices-input-touchpad.png deleted file mode 100644 index 0e56a21e..00000000 Binary files a/kcontrol/touchpad/icon/hi256-devices-input-touchpad.png and /dev/null differ diff --git a/kcontrol/touchpad/icon/hi32-devices-input-touchpad.png b/kcontrol/touchpad/icon/hi32-devices-input-touchpad.png deleted file mode 100644 index 2e75e972..00000000 Binary files a/kcontrol/touchpad/icon/hi32-devices-input-touchpad.png and /dev/null differ diff --git a/kcontrol/touchpad/icon/hi48-devices-input-touchpad.png b/kcontrol/touchpad/icon/hi48-devices-input-touchpad.png deleted file mode 100644 index 3357a1c0..00000000 Binary files a/kcontrol/touchpad/icon/hi48-devices-input-touchpad.png and /dev/null differ diff --git a/kcontrol/touchpad/icon/hi64-devices-input-touchpad.png b/kcontrol/touchpad/icon/hi64-devices-input-touchpad.png deleted file mode 100644 index 65aa24af..00000000 Binary files a/kcontrol/touchpad/icon/hi64-devices-input-touchpad.png and /dev/null differ diff --git a/kcontrol/touchpad/icon/hi96-devices-input-touchpad.png b/kcontrol/touchpad/icon/hi96-devices-input-touchpad.png deleted file mode 100644 index b780218c..00000000 Binary files a/kcontrol/touchpad/icon/hi96-devices-input-touchpad.png and /dev/null differ diff --git a/kcontrol/touchpad/icon/hisc-devices-input-touchpad.svgz b/kcontrol/touchpad/icon/hisc-devices-input-touchpad.svgz deleted file mode 100644 index ad8bd228..00000000 Binary files a/kcontrol/touchpad/icon/hisc-devices-input-touchpad.svgz and /dev/null differ diff --git a/kcontrol/touchpad/icon/makeicons.sh b/kcontrol/touchpad/icon/makeicons.sh deleted file mode 100755 index 29a46e8c..00000000 --- a/kcontrol/touchpad/icon/makeicons.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -for size in 16 22 24 32 48 64 96 128 256; do -convert -background none hisc-devices-input-touchpad.svgz -resize "$size"x"$size" hi"$size"-devices-input-touchpad.png -done diff --git a/kcontrol/touchpad/src/CMakeLists.txt b/kcontrol/touchpad/src/CMakeLists.txt deleted file mode 100644 index 823462ad..00000000 --- a/kcontrol/touchpad/src/CMakeLists.txt +++ /dev/null @@ -1,81 +0,0 @@ -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/version.h.cmake - ${CMAKE_CURRENT_BINARY_DIR}/version.h -) - -SET(SRCS - plugins.cpp - touchpadbackend.cpp -) - -include(x11/x11.cmake) - -set(SRCS - ${SRCS} - kcm/customslider.cpp - kcm/sliderpair.cpp - kcm/testarea.cpp - kcm/testbutton.cpp - kcm/touchpadconfig.cpp - kcm/touchpadparametersbase.cpp - kcm/customconfigdialogmanager.cpp - kcm/pointermotion.ui - kcm/tap.ui - kcm/scroll.ui - kcm/sensitivity.ui - kcm/kded.ui - kcm/testarea.ui -) - -qt4_add_dbus_interfaces(SRCS ${CMAKE_CURRENT_BINARY_DIR}/org.kde.touchpad.xml) - -kde4_add_kcfg_files(SRCS kcm/touchpadparameters.kcfgc) - -qt4_generate_dbus_interface(kded/kded.h org.kde.touchpad.xml) - -SET(SRCS - ${SRCS} - kded/kded.cpp - kded/kdedactions.cpp -) - -kde4_add_kcfg_files(SRCS kded/kdedsettings.kcfgc) - -kde4_add_plugin(kded_touchpad - ${SRCS} - ${backend_SRCS} -) -target_link_libraries(kded_touchpad - ${backend_LIBS} - ${KDE4_KDEUI_LIBS} - ${KDE4_PLASMA_LIBS} - ${KDE4_KNOTIFYCONFIG_LIBS} -) - -add_subdirectory(applet) - -install(FILES kcm/kcm_touchpad.desktop - DESTINATION ${SERVICES_INSTALL_DIR} -) - -install(FILES kded/touchpaddaemon.kcfg - DESTINATION ${KCFG_INSTALL_DIR} -) -install(FILES kded/kded_touchpad.desktop - DESTINATION ${SERVICES_INSTALL_DIR}/kded - RENAME touchpad.desktop -) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.touchpad.xml - DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} -) -install(FILES kded/kcm_touchpad.notifyrc - DESTINATION ${DATA_INSTALL_DIR}/kcm_touchpad -) - -install(TARGETS kded_touchpad - DESTINATION ${PLUGIN_INSTALL_DIR} -) - -install(FILES kcm/touchpad.kcfg - DESTINATION ${KCFG_INSTALL_DIR} -) diff --git a/kcontrol/touchpad/src/applet/CMakeLists.txt b/kcontrol/touchpad/src/applet/CMakeLists.txt deleted file mode 100644 index f8ed2d5f..00000000 --- a/kcontrol/touchpad/src/applet/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -add_subdirectory(qml) - -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/dataengine.desktop" - "${CMAKE_CURRENT_BINARY_DIR}/plasma-dataengine-touchpad.desktop" -) - -set(Applet_SRCS - touchpadengine.cpp - touchpadservice.cpp -) - -qt4_generate_dbus_interface(../kded/kded.h org.kde.touchpad.xml) -qt4_add_dbus_interfaces(Applet_SRCS - ${CMAKE_CURRENT_BINARY_DIR}/org.kde.touchpad.xml -) -qt4_add_dbus_interfaces(Applet_SRCS - ${KDE4_DBUS_INTERFACES_DIR}/org.kde.kded.xml -) - -kde4_add_plugin(plasma_engine_touchpad ${Applet_SRCS}) -target_link_libraries(plasma_engine_touchpad - ${KDE4_PLASMA_LIBS} -) - -install(TARGETS plasma_engine_touchpad - DESTINATION ${PLUGIN_INSTALL_DIR} -) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plasma-dataengine-touchpad.desktop - DESTINATION ${SERVICES_INSTALL_DIR} -) -install(FILES touchpad.operations - DESTINATION ${DATA_INSTALL_DIR}/plasma/services -) -install(FILES touchpad.svg - DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/default/icons -) diff --git a/kcontrol/touchpad/src/applet/dataengine.desktop b/kcontrol/touchpad/src/applet/dataengine.desktop deleted file mode 100644 index e8ceff22..00000000 --- a/kcontrol/touchpad/src/applet/dataengine.desktop +++ /dev/null @@ -1,40 +0,0 @@ -[Desktop Entry] -Name=Touchpad DataEngine -Name[bs]=Pogon podataka za dodirnu površinu -Name[cs]=Datový stroj pro touchpad -Name[da]=Datamotor-motor -Name[de]=Touchpad-Datenquelle -Name[el]=Μηχανή δεδομένων επιφάνειας αφής -Name[es]=Motor de datos del panel táctil -Name[fi]=Kosketuslevyn tietomoottori -Name[fr]=Moteur de données du pavé tactile -Name[hu]=Érintőtábla adatmotor -Name[ko]=터치패드 데이터 엔진 -Name[lt]=Jutiklinio kilimėlio Duomenų variklis -Name[nl]=Gegevensengine voor touchpad -Name[pl]=Silnik danych gładzika -Name[pt]=Motor de Dados do Rato por Toque -Name[pt_BR]=Mecanismo de dados do touchpad -Name[ro]=Motor de date Zonă tactilă -Name[sk]=Touchpad DataEngine -Name[sl]=PodatkovniPogon za sledilno ploščico -Name[sv]=Datagränssnitt för tryckplatta -Name[tr]=Dokunmatik Yüzey Veri Motoru -Name[uk]=Рушій даних сенсорної панелі -Name[x-test]=xxTouchpad DataEnginexx -Icon=input-touchpad -Type=Service - -X-KDE-ServiceTypes=Plasma/DataEngine -X-KDE-Library=plasma_engine_touchpad -X-KDE-PluginInfo-Name=touchpad -X-KDE-PluginInfo-Category=System Information -X-KDE-PluginInfo-Author=Alexander Mezin -X-KDE-PluginInfo-Email=mezin.alexander@gmail.com -X-KDE-PluginInfo-Version=@TOUCHPAD_KCM_VERSION@ -X-KDE-PluginInfo-Website=https://projects.kde.org/projects/playground/utils/kcm-touchpad/ -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-EnabledByDefault=true - -X-Plasma-EngineName=touchpad diff --git a/kcontrol/touchpad/src/applet/qml/CMakeLists.txt b/kcontrol/touchpad/src/applet/qml/CMakeLists.txt deleted file mode 100644 index 3ab7bdd0..00000000 --- a/kcontrol/touchpad/src/applet/qml/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/metadata.desktop - ${CMAKE_CURRENT_BINARY_DIR}/metadata.desktop -) - -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/metadata.desktop - DESTINATION ${DATA_INSTALL_DIR}/plasma/plasmoids/touchpad -) - -install(DIRECTORY contents/ - DESTINATION ${DATA_INSTALL_DIR}/plasma/plasmoids/touchpad/contents -) - -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/metadata.desktop - DESTINATION ${SERVICES_INSTALL_DIR} - RENAME plasma-applet-touchpad.desktop -) diff --git a/kcontrol/touchpad/src/applet/qml/contents/ui/touchpad.qml b/kcontrol/touchpad/src/applet/qml/contents/ui/touchpad.qml deleted file mode 100644 index c800921b..00000000 --- a/kcontrol/touchpad/src/applet/qml/contents/ui/touchpad.qml +++ /dev/null @@ -1,140 +0,0 @@ -// -*- coding: iso-8859-1 -*- -/* - * Copyright 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2 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. - */ - -import QtQuick 1.1 -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.plasma.components 0.1 as PlasmaComponents -import org.kde.qtextracomponents 0.1 - -Item { - id: root - - Component.onCompleted: { - plasmoid.aspectRatioMode = Square - } - - PlasmaCore.DataSource { - id: dataSource - engine: "touchpad" - connectedSources: dataSource.sources - onNewData: { - if (data.enabled === null) { - return - } - - if (data.enabled) { - //Hide plasmoid from notification area after short delay - delayedStatusUpdate.restart() - } else { - plasmoid.status = ActiveStatus - } - - icon.elementId = data.enabled ? "touchpad_enabled" - : "touchpad_disabled" - - plasmoid.setAction("toggle", data.enabled ? i18n("Disable touchpad") - : i18n("Enable touchpad")) - } - } - - property bool hasTouchpad: typeof dataSource.data.touchpad != 'undefined' - property bool enabled: hasTouchpad ? dataSource.data.touchpad.enabled - : false - property bool mouse: hasTouchpad ? dataSource.data.touchpad.mousePluggedIn - : false - - Timer { - id: delayedStatusUpdate - interval: 1000 - running: true - onTriggered: { - if (!hasTouchpad) { - //Setting this in Component.onCompleted didn't work - plasmoid.status = PassiveStatus - return - } - - plasmoid.status = enabled ? PassiveStatus : ActiveStatus - } - } - - PlasmaCore.SvgItem { - id: icon - anchors.fill: parent - svg: PlasmaCore.Svg { - multipleImages: true - imagePath: "icons/touchpad" - } - } - - QIconItem { - anchors.fill: parent - visible: !hasTouchpad - icon: "dialog-warning" - } - - PlasmaCore.ToolTip { - target: root - mainText: { - if (!hasTouchpad) { - return i18n("No touchpad was found"); - } - - return enabled ? i18n("Touchpad is enabled") - : i18n("Touchpad is disabled") - } - image: { - if (!hasTouchpad) { - return "dialog-error" - } - - return enabled ? "input-touchpad" : "process-stop" - } - } - - MouseArea { - anchors.fill: parent - onClicked: action_toggle() - enabled: hasTouchpad - } - - function action_toggle() { - if (!mouse && enabled) { - confirmDialog.open() - return - } - execOp("toggle") - } - - function execOp(op) { - var service = dataSource.serviceForSource("touchpad") - service.startOperationCall(service.operationDescription(op)) - } - - PlasmaComponents.QueryDialog { - id: confirmDialog - visualParent: root - titleText: i18n("Touchpad") - titleIcon: "dialog-warning" - message: i18n("No mouse was detected.\nAre you sure you want to disable the touchpad?") - acceptButtonText: i18n("Disable") - onAccepted: execOp("disable") - } -} diff --git a/kcontrol/touchpad/src/applet/qml/metadata.desktop b/kcontrol/touchpad/src/applet/qml/metadata.desktop deleted file mode 100644 index 659e2a1e..00000000 --- a/kcontrol/touchpad/src/applet/qml/metadata.desktop +++ /dev/null @@ -1,89 +0,0 @@ -[Desktop Entry] -Comment=Shows current touchpad state -Comment[bs]=Prikazuje trenutno stanje dodirne površine -Comment[cs]=Zobrazí současný stav touchpadu -Comment[da]=Vis aktuel touchpad-tilstand -Comment[de]=Zeigt den aktuellen Status des Touchpads an -Comment[el]=Εμφανίζει την τρέχουσα κατάσταση της επιφάνειας αφής -Comment[es]=Muestra el estado actual del panel táctil -Comment[fi]=Näyttää kosketuslevyn nykyisen tilan -Comment[fr]=Affiche l'état courant du pavé tactile -Comment[hu]=Megjeleníti a jelenlegi érintőtábla állapotot -Comment[ko]=현재 터치패드 상태 표시 -Comment[lt]=Rodo dabartinę kilimėlio būsena -Comment[nl]=Huidige status van touchpad tonen -Comment[pl]=Pokazuje bieżący stan gładzika -Comment[pt]=Mostra o estado actual do rato por toque -Comment[pt_BR]=Mostra o estado atual do touchpad -Comment[ro]=Arată starea curentă a zonei tactile -Comment[sk]=Zobrazí aktuálny stav touchpadu -Comment[sl]=Prikazuje trenutno stanje sledilne ploščice -Comment[sv]=Visar tryckplattans aktuellt tillstånd -Comment[tr]=Geçerli dokunmatik yüzey durumunu gösterir -Comment[uk]=Показує поточний стан сенсорної панелі -Comment[x-test]=xxShows current touchpad statexx -Encoding=UTF-8 -Icon=input-touchpad -Keywords=Touchpad -Keywords[bs]=Dodirna površina -Keywords[cs]=Touchpad -Keywords[da]=Touchpad -Keywords[de]=Touchpad -Keywords[el]=Επιφάνεια αφής -Keywords[es]=Panel táctil -Keywords[fi]=Kosketuslevy -Keywords[fr]=Pavé tactile -Keywords[hu]=Érintőtábla -Keywords[ko]=터치패드 -Keywords[lt]=Jutiklinis kilimėlis -Keywords[nl]=Touchpad -Keywords[pl]=Gładzik -Keywords[pt]=Rato por Toque -Keywords[pt_BR]=Touchpad -Keywords[ro]=Zonă tactilă -Keywords[sk]=Touchpad -Keywords[sl]=Sledilna ploščica -Keywords[sv]=Tryckplatta -Keywords[tr]=Dokunmatik Yüzey -Keywords[uk]=Сенсорна панель -Keywords[x-test]=xxTouchpadxx -Name=Touchpad -Name[bs]=Dodirna površina -Name[cs]=Touchpad -Name[da]=Touchpad -Name[de]=Touchpad -Name[el]=Επιφάνεια αφής -Name[es]=Panel táctil -Name[fi]=Kosketuslevy -Name[fr]=Pavé tactile -Name[hu]=Érintőtábla -Name[ko]=터치패드 -Name[lt]=Jutiklinis kilimėlis -Name[nl]=Touchpad -Name[pl]=Gładzik -Name[pt]=Rato por Toque -Name[pt_BR]=Touchpad -Name[ro]=Zonă tactilă -Name[sk]=Touchpad -Name[sl]=Sledilna ploščica -Name[sv]=Tryckplatta -Name[tr]=Dokunmatik Yüzey -Name[uk]=Сенсорна панель -Name[x-test]=xxTouchpadxx -Type=Service -X-KDE-ParentApp= -X-KDE-PluginInfo-Author=Alexander Mezin -X-KDE-PluginInfo-Category=System Information -X-KDE-PluginInfo-Email=mezin.alexander@gmail.com -X-KDE-PluginInfo-EnabledByDefault=true -X-KDE-PluginInfo-License=GPL -X-KDE-PluginInfo-Name=touchpad -X-KDE-PluginInfo-Version=@TOUCHPAD_KCM_VERSION@ -X-KDE-PluginInfo-Website=https://projects.kde.org/projects/playground/utils/kcm-touchpad/ -X-KDE-ServiceTypes=Plasma/Applet -X-Plasma-API=declarativeappletscript -X-Plasma-ConfigPlugins=kcm_touchpad -X-Plasma-DefaultSize=32,32 -X-Plasma-MainScript=ui/touchpad.qml -X-Plasma-NotificationArea=true -X-Plasma-RemoteLocation= diff --git a/kcontrol/touchpad/src/applet/touchpad.operations b/kcontrol/touchpad/src/applet/touchpad.operations deleted file mode 100644 index 729877fb..00000000 --- a/kcontrol/touchpad/src/applet/touchpad.operations +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/kcontrol/touchpad/src/applet/touchpad.svg b/kcontrol/touchpad/src/applet/touchpad.svg deleted file mode 100644 index 8648ea88..00000000 --- a/kcontrol/touchpad/src/applet/touchpad.svg +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - touchpad_enabled - - - - - - touchpad_disabled - - - - - - diff --git a/kcontrol/touchpad/src/applet/touchpadengine.cpp b/kcontrol/touchpad/src/applet/touchpadengine.cpp deleted file mode 100644 index e861ee8a..00000000 --- a/kcontrol/touchpad/src/applet/touchpadengine.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -#include "touchpadengine.h" - -#include -#include - -#include "touchpadinterface.h" -#include "touchpadservice.h" -#include "kdedinterface.h" - -TouchpadEngine::TouchpadEngine(QObject *parent, const QVariantList &args) - : Plasma::DataEngine(parent, args), m_source("touchpad"), m_daemon(0) -{ -} - -void TouchpadEngine::init() -{ - OrgKdeKdedInterface kded(QLatin1String("org.kde.kded"), - QLatin1String("/kded"), - QDBusConnection::sessionBus()); - kded.loadModule("touchpad").waitForFinished(); - - m_daemon = new OrgKdeTouchpadInterface("org.kde.kded", "/modules/touchpad", - QDBusConnection::sessionBus(), this); - if (!m_daemon->isValid()) { - return; - } - - QDBusPendingReply check(m_daemon->workingTouchpadFound()); - check.waitForFinished(); - if (!check.isValid() || !check.value()) { - return; - } - - connect(m_daemon, SIGNAL(enabledChanged(bool)), SLOT(enabledChanged(bool))); - connect(m_daemon, SIGNAL(mousePluggedInChanged(bool)), - SLOT(mousePluggedInChanged(bool))); - - enabledChanged(m_daemon->isEnabled()); - mousePluggedInChanged(m_daemon->isMousePluggedIn()); -} - -void TouchpadEngine::mousePluggedInChanged(bool value) -{ - setData(m_source, "mousePluggedIn", value); -} - -void TouchpadEngine::enabledChanged(bool value) -{ - setData(m_source, "enabled", value); -} - -Plasma::Service *TouchpadEngine::serviceForSource(const QString &source) -{ - if (source == m_source) { - return new TouchpadService(m_daemon, source, this); - } - - return Plasma::DataEngine::serviceForSource(source); -} - -TouchpadEngine::~TouchpadEngine() -{ -} - -K_EXPORT_PLASMA_DATAENGINE(touchpad, TouchpadEngine) diff --git a/kcontrol/touchpad/src/applet/touchpadengine.h b/kcontrol/touchpad/src/applet/touchpadengine.h deleted file mode 100644 index bf7bd5f2..00000000 --- a/kcontrol/touchpad/src/applet/touchpadengine.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -#ifndef TOUCHPADENGINE_H -#define TOUCHPADENGINE_H - -#include - -class OrgKdeTouchpadInterface; - -class TouchpadEngine : public Plasma::DataEngine -{ - Q_OBJECT - -public: - TouchpadEngine(QObject *parent, const QVariantList &args); - ~TouchpadEngine(); - - Plasma::Service *serviceForSource(const QString &source); - -protected: - void init(); - -private Q_SLOTS: - void mousePluggedInChanged(bool); - void enabledChanged(bool); - -private: - QString m_source; - OrgKdeTouchpadInterface *m_daemon; -}; - -#endif // TOUCHPADENGINE_H diff --git a/kcontrol/touchpad/src/applet/touchpadservice.cpp b/kcontrol/touchpad/src/applet/touchpadservice.cpp deleted file mode 100644 index 4ff960df..00000000 --- a/kcontrol/touchpad/src/applet/touchpadservice.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -#include "touchpadservice.h" - -#include - -#include "touchpadinterface.h" - -TouchpadService::TouchpadService(OrgKdeTouchpadInterface *daemon, - const QString &destination, - QObject *parent) - : Plasma::Service(parent), m_daemon(daemon), m_destination(destination) -{ - setName("touchpad"); -} - -TouchpadService::~TouchpadService() -{ -} - -class TouchpadJob : public Plasma::ServiceJob -{ -public: - TouchpadJob(OrgKdeTouchpadInterface *daemon, - const QString &destination, const QString &operation, - const QMap ¶meters, QObject *parent = 0) - : Plasma::ServiceJob(destination, operation, parameters, parent), - m_daemon(daemon) - { - } - - void start() - { - if (m_daemon) { - QMetaObject::invokeMethod(m_daemon, operationName().toAscii()); - } - emitResult(); - } - -private: - OrgKdeTouchpadInterface *m_daemon; -}; - -Plasma::ServiceJob *TouchpadService::createJob(const QString &operation, - QMap ¶ms) -{ - return new TouchpadJob(m_daemon, m_destination, operation, params, this); -} diff --git a/kcontrol/touchpad/src/applet/touchpadservice.h b/kcontrol/touchpad/src/applet/touchpadservice.h deleted file mode 100644 index d561beb6..00000000 --- a/kcontrol/touchpad/src/applet/touchpadservice.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -#ifndef TOUCHPADSERVICE_H -#define TOUCHPADSERVICE_H - -#include - -class OrgKdeTouchpadInterface; - -class TouchpadService : public Plasma::Service -{ - Q_OBJECT -public: - TouchpadService(OrgKdeTouchpadInterface *daemon, const QString &destination, - QObject *parent = 0); - ~TouchpadService(); - -protected: - Plasma::ServiceJob *createJob(const QString &operation, - QMap ¶meters); - -private: - OrgKdeTouchpadInterface *m_daemon; - QString m_destination; -}; - -#endif // TOUCHPADSERVICE_H diff --git a/kcontrol/touchpad/src/kcm/customconfigdialogmanager.cpp b/kcontrol/touchpad/src/kcm/customconfigdialogmanager.cpp deleted file mode 100644 index 298cf414..00000000 --- a/kcontrol/touchpad/src/kcm/customconfigdialogmanager.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "customconfigdialogmanager.h" - -#include - -#include - -#include -#include -#include - -#include "customslider.h" - -CustomConfigDialogManager::CustomConfigDialogManager(QWidget *parent, - KCoreConfigSkeleton *conf, - const QStringList &supported) - : KConfigDialogManager(parent, conf), m_config(conf) -{ - static const QString kcfgPrefix("kcfg_"); - - Q_FOREACH(KConfigSkeletonItem *i, conf->items()) { - QString name(i->name()); - - QWidget *child = parent->findChild(kcfgPrefix + name); - if (!child) { - continue; - } - m_widgets[name] = child; - - if (!supported.contains(name)) { - child->setEnabled(false); - } - - KCoreConfigSkeleton::ItemEnum *asEnum = - dynamic_cast(i); - if (!asEnum) { - continue; - } - - QStringList choiceList; - Q_FOREACH(const KCoreConfigSkeleton::ItemEnum::Choice &c, - asEnum->choices()) - { - if (c.label.isEmpty()) { - choiceList.append(c.name); - } else { - choiceList.append(c.label); - } - } - - KComboBox *asComboBox = qobject_cast(child); - if (asComboBox) { - asComboBox->addItems(choiceList); - } - } -} - -CustomConfigDialogManager::~CustomConfigDialogManager() -{ -} - -QVariantHash CustomConfigDialogManager::currentWidgetProperties() const -{ - QVariantHash r; - for (QMap::ConstIterator i = m_widgets.begin(); - i != m_widgets.end(); ++i) - { - r[i.key()] = property(i.value()); - } - return r; -} - -void CustomConfigDialogManager::setWidgetProperties(const QVariantHash &p) -{ - for (QVariantHash::ConstIterator i = p.begin(); i != p.end(); ++i) { - QMap::ConstIterator j = m_widgets.find(i.key()); - if (j != m_widgets.end()) { - setProperty(j.value(), i.value()); - } - } -} - -static bool variantFuzzyCompare(const QVariant &a, const QVariant &b) -{ - if (a == b) { - return true; - } - - bool isDouble_a = false, isDouble_b = false; - float d_a = static_cast(a.toDouble(&isDouble_a)), - d_b = static_cast(b.toDouble(&isDouble_b)); - if (!isDouble_a || !isDouble_b) { - return false; - } - - return (qFuzzyIsNull(d_a) && qFuzzyIsNull(d_b)) || qFuzzyCompare(d_a, d_b); -} - -QVariant CustomConfigDialogManager::fixup(QWidget *widget, QVariant v) const -{ - bool isDouble = false; - double value = v.toDouble(&isDouble); - if (!isDouble) { - return v; - } - - QVariant decimals(widget->property("decimals")); - if (decimals.type() != QVariant::Int) { - CustomSlider *asSlider = qobject_cast(widget); - if (asSlider) { - return asSlider->fixup(value); - } - return value; - } - - double k = std::pow(10.0, decimals.toInt()); - return std::floor(value * k + 0.5) / k; //round -} - -bool CustomConfigDialogManager::compareWidgetProperties(const QVariantHash &p) const -{ - bool result = true; - for (QVariantHash::ConstIterator i = p.begin(); i != p.end(); ++i) { - QMap::ConstIterator j = m_widgets.find(i.key()); - if (j == m_widgets.end()) { - continue; - } - - QWidget *widget = j.value(); - QVariant widgetValue(fixup(widget, property(widget))); - QVariant fixed(fixup(widget, i.value())); - if (!variantFuzzyCompare(widgetValue, fixed)) { - result = false; - kDebug() << "Config mismatch:" - << widget->objectName() << widgetValue << fixed; - } - } - return result; -} - -bool CustomConfigDialogManager::hasChangedFuzzy() const -{ - for (QMap::ConstIterator i = m_widgets.begin(); - i != m_widgets.end(); ++i) - { - KConfigSkeletonItem *config = m_config->findItem(i.key()); - QWidget *widget = i.value(); - QVariant widgetValue(fixup(widget, property(widget))); - QVariant configValue(fixup(widget, config->property())); - if (!variantFuzzyCompare(widgetValue, configValue)) { - return true; - } - } - return false; -} diff --git a/kcontrol/touchpad/src/kcm/customconfigdialogmanager.h b/kcontrol/touchpad/src/kcm/customconfigdialogmanager.h deleted file mode 100644 index 7bb9403f..00000000 --- a/kcontrol/touchpad/src/kcm/customconfigdialogmanager.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef CUSTOMCONFIGDIALOGMANAGER_H -#define CUSTOMCONFIGDIALOGMANAGER_H - -#include -#include - -#include - -class CustomConfigDialogManager : public KConfigDialogManager -{ - Q_OBJECT -public: - CustomConfigDialogManager(QWidget *parent, - KCoreConfigSkeleton *config, - const QStringList &supported); - ~CustomConfigDialogManager(); - - QVariantHash currentWidgetProperties() const; - void setWidgetProperties(const QVariantHash &); - bool compareWidgetProperties(const QVariantHash &) const; - bool hasChangedFuzzy() const; - -private: - QVariant fixup(QWidget *widget, QVariant value) const; - - QMap m_widgets; - KCoreConfigSkeleton *m_config; -}; - -#endif // CUSTOMCONFIGDIALOGMANAGER_H diff --git a/kcontrol/touchpad/src/kcm/customslider.cpp b/kcontrol/touchpad/src/kcm/customslider.cpp deleted file mode 100644 index 4c188eb1..00000000 --- a/kcontrol/touchpad/src/kcm/customslider.cpp +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "customslider.h" - -#include - -#include - -CustomSlider::Interpolator::~Interpolator() -{ -} - -double CustomSlider::Interpolator::absolute(double relative, - double minimum, - double maximum) const -{ - return relative * (maximum - minimum) + minimum; -} - -double CustomSlider::Interpolator::relative(double absolute, - double minimum, - double maximum) const -{ - return (absolute - minimum) / (maximum - minimum); -} - -double CustomSlider::SqrtInterpolator::absolute( - double relative, double minimum, double maximum) const -{ - relative *= relative; - return Interpolator::absolute(relative, minimum, maximum); -} - -double CustomSlider::SqrtInterpolator::relative( - double absolute, double minimum, double maximum) const -{ - double value = Interpolator::relative(absolute, minimum, maximum); - return std::sqrt(value); -} - -const CustomSlider::Interpolator CustomSlider::lerp; - -CustomSlider::CustomSlider(QWidget *parent) : - QSlider(parent), m_min(0.0), m_max(1.0), m_interpolator(&lerp) -{ - setSingleStep(10); - setPageStep(100); - - updateValue(); - updateRange(size()); - - connect(this, SIGNAL(actionTriggered(int)), SLOT(updateValue())); -} - -void CustomSlider::resizeEvent(QResizeEvent *e) -{ - QSlider::resizeEvent(e); - updateRange(e->size()); -} - -const CustomSlider::Interpolator *CustomSlider::interpolator() const -{ - return m_interpolator; -} - -void CustomSlider::setInterpolator(const CustomSlider::Interpolator *v) -{ - m_interpolator = v; -} - -void CustomSlider::setDoubleMinimum(double v) -{ - m_min = v; -} - -double CustomSlider::doubleMinimum() const -{ - return m_min; -} - -void CustomSlider::setDoubleMaximum(double v) -{ - m_max = v; -} - -double CustomSlider::doubleMaximum() const -{ - return m_max; -} - -double CustomSlider::doubleValue() const -{ - return qBound(m_min, m_value, m_max); -} - -void CustomSlider::setDoubleValue(double v) -{ - if (m_value == v) { - return; - } - - m_value = v; - int oldIntValue = value(); - moveSlider(); - if (value() != oldIntValue) { - Q_EMIT valueChanged(doubleValue()); - } -} - -double CustomSlider::intToDouble(int v) const -{ - double relative = lerp.relative(v, minimum(), maximum()); - return m_interpolator->absolute(relative, m_min, m_max); -} - -void CustomSlider::updateValue() -{ - m_value = intToDouble(sliderPosition()); - Q_EMIT valueChanged(doubleValue()); -} - -double CustomSlider::fixup(double v) const -{ - return intToDouble(doubleToInt(v)); -} - -int CustomSlider::doubleToInt(double v) const -{ - double relative = m_interpolator->relative(v, m_min, m_max); - double absolute = lerp.absolute(relative, minimum(), maximum()); - return static_cast(std::floor(absolute + 0.5)); -} - -void CustomSlider::moveSlider() -{ - setValue(doubleToInt(doubleValue())); -} - -void CustomSlider::updateRange(const QSize &s) -{ - setRange(0, (orientation() == Qt::Horizontal) ? s.width() : s.height()); - moveSlider(); -} diff --git a/kcontrol/touchpad/src/kcm/customslider.h b/kcontrol/touchpad/src/kcm/customslider.h deleted file mode 100644 index 7dbcb132..00000000 --- a/kcontrol/touchpad/src/kcm/customslider.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef CUSTOMSLIDER_H -#define CUSTOMSLIDER_H - -#include - -class CustomSlider : public QSlider -{ - Q_OBJECT - - Q_PROPERTY(double minimum READ doubleMinimum WRITE setDoubleMinimum) - Q_PROPERTY(double maximum READ doubleMaximum WRITE setDoubleMaximum) - Q_PROPERTY(double value READ doubleValue WRITE setDoubleValue \ - NOTIFY valueChanged USER true) - -public: - explicit CustomSlider(QWidget *parent = 0); - - void setDoubleMinimum(double); - double doubleMinimum() const; - - void setDoubleMaximum(double); - double doubleMaximum() const; - - class Interpolator - { - public: - Interpolator() { } - virtual double absolute(double relative, - double minimum, double maximum) const; - virtual double relative(double absolute, - double minimum, double maximum) const; - - virtual ~Interpolator(); - }; - - class SqrtInterpolator : public Interpolator - { - public: - SqrtInterpolator() { } - double absolute(double relative, double minimum, double maximum) const; - double relative(double absolute, double minimum, double maximum) const; - }; - - const Interpolator *interpolator() const; - void setInterpolator(const Interpolator *); - - double doubleValue() const; - double fixup(double) const; - -public Q_SLOTS: - void setDoubleValue(double); - -Q_SIGNALS: - void valueChanged(double); - -protected: - virtual void resizeEvent(QResizeEvent *); - -private Q_SLOTS: - void updateValue(); - -private: - void updateRange(const QSize &); - void moveSlider(); - int doubleToInt(double) const; - double intToDouble(int) const; - - static const Interpolator lerp; - - double m_min, m_max, m_value; - const Interpolator *m_interpolator; -}; - -#endif // CUSTOMSLIDER_H diff --git a/kcontrol/touchpad/src/kcm/kcm_touchpad.desktop b/kcontrol/touchpad/src/kcm/kcm_touchpad.desktop deleted file mode 100644 index 05c90d88..00000000 --- a/kcontrol/touchpad/src/kcm/kcm_touchpad.desktop +++ /dev/null @@ -1,84 +0,0 @@ -[Desktop Entry] -Exec=kcmshell4 kcm_touchpad -Icon=input-touchpad -Type=Service -Categories=Qt;KDE;X-KDE-settings-hardware; -OnlyShowIn=KDE; - -X-KDE-ServiceTypes=KCModule,KCModuleInit -X-KDE-Init-Symbol=touchpad -X-KDE-Init-Phase=0 -X-KDE-Library=kded_touchpad -X-KDE-PluginKeyword=kcm -X-KDE-ParentApp=kcontrol -X-KDE-System-Settings-Parent-Category=input-devices - -Name=Touchpad -Name[bs]=Dodirna površina -Name[cs]=Touchpad -Name[da]=Touchpad -Name[de]=Touchpad -Name[el]=Επιφάνεια αφής -Name[es]=Panel táctil -Name[fi]=Kosketuslevy -Name[fr]=Pavé tactile -Name[hu]=Érintőtábla -Name[ko]=터치패드 -Name[lt]=Jutiklinis kilimėlis -Name[nl]=Touchpad -Name[pl]=Gładzik -Name[pt]=Rato por Toque -Name[pt_BR]=Touchpad -Name[ro]=Zonă tactilă -Name[sk]=Touchpad -Name[sl]=Sledilna ploščica -Name[sv]=Tryckplatta -Name[tr]=Dokunmatik Yüzey -Name[uk]=Сенсорна панель -Name[x-test]=xxTouchpadxx -Comment=Touchpad settings -Comment[bs]=Postavke dodirne površine -Comment[cs]=Nastavení touchpadu -Comment[da]=Touchpad-indstillinger -Comment[de]=Touchpadeinstellungen -Comment[el]=Ρυθμίσεις επιφάνειας αφής -Comment[es]=Preferencias del panel táctil -Comment[fi]=Kosketuslevyn asetukset -Comment[fr]=Configuration du pavé tactile -Comment[hu]=Érintőtábla beállítások -Comment[ko]=터치패드 설정 -Comment[lt]=Jutiklinio kilimėlio nustatymai -Comment[nl]=Instellingen van touchpad -Comment[pl]=Ustawienia gładzika -Comment[pt]=Configuração do rato por toque -Comment[pt_BR]=Configurações do touchpad -Comment[ro]=Configurări zonă tactilă -Comment[sk]=Nastavenia touchpadu -Comment[sl]=Nastavitve sledilne ploščice -Comment[sv]=Inställning av tryckplatta -Comment[tr]=Dokunmatik yüzey ayarları -Comment[uk]=Параметри сенсорної панелі -Comment[x-test]=xxTouchpad settingsxx -X-KDE-Keywords=Touchpad,Synaptics -X-KDE-Keywords[bs]=Dodirna površina,Synatics -X-KDE-Keywords[cs]=Touchpad,Synaptics -X-KDE-Keywords[da]=Touchpad,Synaptics -X-KDE-Keywords[de]=Touchpad,Synaptics -X-KDE-Keywords[el]=Επιφάνεια αφής,Synaptics -X-KDE-Keywords[es]=Panel táctil,Touchpad,Synaptics -X-KDE-Keywords[fi]=Touchpad,Synaptics,Kosketuslevy -X-KDE-Keywords[fr]=Pavé tactile,Synaptics -X-KDE-Keywords[hu]=Érintőtábla,Szinaptikusok -X-KDE-Keywords[ko]=Touchpad,Synaptics,터치패드 -X-KDE-Keywords[lt]=Jutiklinis kilimėlis,Synaptics -X-KDE-Keywords[nl]=Touchpad,Synaptics -X-KDE-Keywords[pl]=Gładzik,Synaptics -X-KDE-Keywords[pt]=Rato,Toque,Synaptics -X-KDE-Keywords[pt_BR]=Touchpad,Synaptics -X-KDE-Keywords[ro]=Touchpad,Synaptics,Zonă tactilă,Tactil -X-KDE-Keywords[sk]=Touchpad,Synaptics -X-KDE-Keywords[sl]=Sledilna ploščica,Synaptics -X-KDE-Keywords[sv]=Tryckplatta,Synaptics -X-KDE-Keywords[tr]=Dokunmatik Yüzey,Synaptics -X-KDE-Keywords[uk]=Touchpad,Synaptics,сенсорна,панель,тачпад,синаптикс -X-KDE-Keywords[x-test]=xxTouchpad,Synapticsxx diff --git a/kcontrol/touchpad/src/kcm/kded.ui b/kcontrol/touchpad/src/kcm/kded.ui deleted file mode 100644 index 31bd7aba..00000000 --- a/kcontrol/touchpad/src/kcm/kded.ui +++ /dev/null @@ -1,200 +0,0 @@ - - - KdedForm - - - - 0 - 0 - 486 - 351 - - - - Enable/Disable Touchpad - - - - - - - 0 - 0 - - - - - - - - 0 - 0 - - - - Configure - - - - - - - - - - - - Keyboard shortcuts: - - - configureShortcutsButton - - - - - - - - - - Disable touchpad when typing - - - true - - - true - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Timeout: - - - kcfg_KeyboardActivityTimeoutMs - - - - - - - If there was no keyboard activity for more than specified -number of milliseconds, touchpad will be enabled again - - - 0 - - - 10000 - - - 100 - - - ms - - - true - - - - - - - Disable click emulation and scrolling. -You will be still able to move pointer using touchpad and perform clicks with hardware buttons. - - - Disable taps and scrolling only - - - - - - - - - - Disable touchpad when mouse is plugged in - - - true - - - true - - - - - - Qt::AlignHCenter|Qt::AlignTop - - - - - Notifications: - - - configureNotificationsButton - - - - - - - Configure - - - - - - - - - - - - - - Some devices might be incorrectly treated as a mouse. -You can add them to this list so that they will be ignored when they're plugged in. - - - KEditListWidget::Add|KEditListWidget::Remove - - - Ignored devices: - - - - - - - - - - - KEditListWidget - QWidget -
keditlistwidget.h
-
- - KIntNumInput - QWidget -
knuminput.h
-
-
- - configureShortcutsButton - kcfg_DisableOnKeyboardActivity - kcfg_KeyboardActivityTimeoutMs - kcfg_OnlyDisableTapAndScrollOnKeyboardActivity - kcfg_DisableWhenMousePluggedIn - - - -
diff --git a/kcontrol/touchpad/src/kcm/pointermotion.ui b/kcontrol/touchpad/src/kcm/pointermotion.ui deleted file mode 100644 index f44f1bca..00000000 --- a/kcontrol/touchpad/src/kcm/pointermotion.ui +++ /dev/null @@ -1,310 +0,0 @@ - - - PointerMotionForm - - - - 0 - 0 - 400 - 407 - - - - Pointer Motion - - - - - - Speed - - - true - - - - - - Minimum: - - - kcfg_MinSpeed - - - - - - - Minimum pointer speed - - - Qt::Horizontal - - - QSlider::TicksBelow - - - - - - - Maximum: - - - kcfg_MaxSpeed - - - - - - - Maximum pointer speed - - - Qt::Horizontal - - - QSlider::TicksBelow - - - - - - - Acceleration: - - - kcfg_AccelFactor - - - - - - - Acceleration factor for normal pointer movements - - - Qt::Horizontal - - - QSlider::TicksBelow - - - - - - - - - - Pressure-Dependent Motion - - - true - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Minimum pressure: - - - kcfg_PressureMotionMinZ - - - - - - - Minimum factor: - - - kcfg_PressureMotionMinFactor - - - - - - - Maximum pressure: - - - kcfg_PressureMotionMaxZ - - - - - - - Maximum factor: - - - kcfg_PressureMotionMaxFactor - - - - - - - Finger pressure at which minimum pressure motion factor is applied - - - Qt::Horizontal - - - QSlider::TicksBelow - - - - - - - Finger pressure at which maximum pressure motion factor is applied - - - Qt::Horizontal - - - QSlider::TicksBelow - - - - - - - Lowest setting for pressure motion factor - - - x - - - true - - - - - - - Greatest setting for pressure motion factor - - - x - - - true - - - - - - - - - - Noise Cancellation - - - true - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Vertical: - - - kcfg_VertHysteresis - - - - - - - Horizontal: - - - kcfg_HorizHysteresis - - - - - - - The minimum vertical hardware distance required to generate motion events - - - 0 - - - 10 - - - units - - - true - - - - - - - The minimum horizontal hardware distance required to generate motion events - - - 0 - - - 10 - - - units - - - true - - - - - - - - - - - KDoubleNumInput - QWidget -
knuminput.h
-
- - KIntNumInput - QWidget -
knuminput.h
-
- - CustomSlider - QSlider -
kcm/customslider.h
-
-
- - kcfg_MinSpeed - kcfg_MaxSpeed - kcfg_AccelFactor - kcfg_PressureMotionMinZ - kcfg_PressureMotionMinFactor - kcfg_PressureMotionMaxZ - kcfg_PressureMotionMaxFactor - kcfg_VertHysteresis - kcfg_HorizHysteresis - - - -
diff --git a/kcontrol/touchpad/src/kcm/scroll.ui b/kcontrol/touchpad/src/kcm/scroll.ui deleted file mode 100644 index 5817bf05..00000000 --- a/kcontrol/touchpad/src/kcm/scroll.ui +++ /dev/null @@ -1,401 +0,0 @@ - - - ScrollForm - - - - 0 - 0 - 610 - 503 - - - - Scrolling - - - - - - QFormLayout::FieldsStayAtSizeHint - - - Qt::AlignHCenter|Qt::AlignTop - - - - - Edge scrolling: - - - kcfg_VertEdgeScroll - - - - - - - Enable vertical scrolling when dragging along the right edge - - - Vertical - - - - - - - Enable horizontal scrolling when dragging along the bottom edge - - - Horizontal - - - - - - - Enable vertical scrolling when dragging with two fingers anywhere on the touchpad - - - Vertical - - - - - - - Enable horizontal scrolling when dragging with two fingers anywhere on the touchpad - - - Horizontal - - - - - - - Reverse vertical scrolling - - - Vertical - - - - - - - Reverse horizontal scrolling - - - Horizontal - - - - - - - Two-finger scrolling: - - - kcfg_VertTwoFingerScroll - - - - - - - Reverse scrolling: - - - kcfg_InvertVertScroll - - - - - - - - - - 300 - 0 - - - - Scrolling Distance - - - true - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Vertical: - - - kcfg_VertScrollDelta - - - - - - - Move distance of the finger for a scroll event - - - 0.100000000000000 - - - mm - - - 1 - - - true - - - - - - - Horizontal: - - - kcfg_HorizScrollDelta - - - - - - - Move distance of the finger for a scroll event - - - 0.100000000000000 - - - mm - - - 1 - - - true - - - - - - - - - - Continue scrolling after the finger is released from the edge of the touchpad - - - Coasting - - - true - - - true - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Minimum speed: - - - kcfg_CoastingSpeed - - - - - - - Your finger needs to produce this many scrolls per second in order to start coasting - - - 1.000000000000000 - - - scrolls/sec - - - true - - - - - - - Deceleration: - - - kcfg_CoastingFriction - - - - - - - Number of scrolls/second² to decrease the coasting speed - - - 1.000000000000000 - - - scrolls/sec² - - - true - - - - - - - Corner coasting: - - - kcfg_CornerCoasting - - - - - - - Enable edge scrolling to continue while the finger stays in an edge corner - - - Enable - - - - - - - - - - Scrolling is engaged when a drag starts in the given trigger region. -Moving your finger in clockwise circles around the center of the touchpad -will scroll down and counter clockwise motion will scroll up - - - Circular Scrolling - - - true - - - true - - - - QFormLayout::ExpandingFieldsGrow - - - - - Trigger region: - - - kcfg_CircScrollTrigger - - - - - - - Trigger region on the touchpad to start circular scrolling - - - - - - - Angle: - - - kcfg_CircScrollDelta - - - - - - - - 0 - 0 - - - - Move angle (radians) of finger to generate a scroll event - - - ° - - - true - - - - - - - When used together with vertical scrolling, hitting the upper or lower right corner will seamlessly switch over from vertical to circular scrolling - - - true - - - - - - - - - - - KDoubleNumInput - QWidget -
knuminput.h
-
- - KComboBox - QComboBox -
kcombobox.h
-
-
- - kcfg_VertEdgeScroll - kcfg_HorizEdgeScroll - kcfg_VertTwoFingerScroll - kcfg_HorizTwoFingerScroll - kcfg_InvertVertScroll - kcfg_InvertHorizScroll - kcfg_VertScrollDelta - kcfg_HorizScrollDelta - kcfg_Coasting - kcfg_CoastingSpeed - kcfg_CoastingFriction - kcfg_CornerCoasting - kcfg_CircularScrolling - kcfg_CircScrollTrigger - kcfg_CircScrollDelta - - - -
diff --git a/kcontrol/touchpad/src/kcm/sensitivity.ui b/kcontrol/touchpad/src/kcm/sensitivity.ui deleted file mode 100644 index 253fad09..00000000 --- a/kcontrol/touchpad/src/kcm/sensitivity.ui +++ /dev/null @@ -1,153 +0,0 @@ - - - SensitivityForm - - - - 0 - 0 - 430 - 210 - - - - Sensitivity - - - - - - Sensitivity - - - true - - - - - - Pressure for detecting a touch: - - - kcfg_FingerHigh - - - - - - - Pressure for detecting a release: - - - kcfg_FingerLow - - - - - - - When finger pressure goes above this value, the driver counts it as a touch - - - Qt::Horizontal - - - QSlider::TicksBelow - - - - - - - When finger pressure drops below this value, the driver counts it as a release - - - Qt::Horizontal - - - QSlider::TicksBelow - - - - - - - - - - If palm detection should be enabled. Note that this also requires hardware/firmware support from the touchpad - - - Palm Detection - - - true - - - true - - - - - - Minimum width: - - - kcfg_PalmMinWidth - - - - - - - Minimum pressure: - - - kcfg_PalmMinZ - - - - - - - Minimum finger width at which touch is considered a palm - - - 1 - - - Qt::Horizontal - - - QSlider::TicksBelow - - - - - - - Minimum finger pressure at which touch is considered a palm - - - Qt::Horizontal - - - QSlider::TicksBelow - - - - - - - - - - kcfg_FingerHigh - kcfg_FingerLow - kcfg_PalmDetect - kcfg_PalmMinWidth - kcfg_PalmMinZ - - - - diff --git a/kcontrol/touchpad/src/kcm/sliderpair.cpp b/kcontrol/touchpad/src/kcm/sliderpair.cpp deleted file mode 100644 index 3b15fd4a..00000000 --- a/kcontrol/touchpad/src/kcm/sliderpair.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "sliderpair.h" - -#include - -SliderPair::SliderPair(QSlider *minSlider, QSlider *maxSlider, QObject *parent) - : QObject(parent), m_minSlider(minSlider), m_maxSlider(maxSlider) -{ - connect(m_minSlider, SIGNAL(valueChanged(int)), SLOT(adjustMaxSlider())); - connect(m_maxSlider, SIGNAL(valueChanged(int)), SLOT(adjustMinSlider())); -} - -void SliderPair::adjustMaxSlider() -{ - m_maxSlider->setValue(qMax(m_maxSlider->value(), m_minSlider->value())); -} - -void SliderPair::adjustMinSlider() -{ - m_minSlider->setValue(qMin(m_maxSlider->value(), m_minSlider->value())); -} diff --git a/kcontrol/touchpad/src/kcm/sliderpair.h b/kcontrol/touchpad/src/kcm/sliderpair.h deleted file mode 100644 index 6b9d69ed..00000000 --- a/kcontrol/touchpad/src/kcm/sliderpair.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef SLIDERPAIR_H -#define SLIDERPAIR_H - -#include - -class QSlider; - -class SliderPair : public QObject -{ - Q_OBJECT -public: - SliderPair(QSlider *minSlider, QSlider *maxSlider, QObject *parent = 0); - -private Q_SLOTS: - void adjustMinSlider(); - void adjustMaxSlider(); - -private: - QSlider *m_minSlider, *m_maxSlider; -}; - -#endif // SLIDERPAIR_H diff --git a/kcontrol/touchpad/src/kcm/tap.ui b/kcontrol/touchpad/src/kcm/tap.ui deleted file mode 100644 index 49181e26..00000000 --- a/kcontrol/touchpad/src/kcm/tap.ui +++ /dev/null @@ -1,511 +0,0 @@ - - - TapForm - - - - 0 - 0 - 516 - 531 - - - - Taps - - - - - - - - - 0 - 0 - - - - Mouse Click Emulation - - - true - - - - Qt::AlignHCenter|Qt::AlignTop - - - - - One finger: - - - kcfg_OneFingerTapButton - - - - - - - Which mouse button is reported on a non-corner one-finger tap - - - - - - - Two fingers: - - - kcfg_TwoFingerTapButton - - - - - - - Which mouse button is reported on a non-corner two-finger tap - - - - - - - Three fingers: - - - kcfg_ThreeFingerTapButton - - - - - - - Which mouse button is reported on a non-corner three-finger tap - - - - - - - - - - - - - - - 0 - 0 - - - - Corners - - - true - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Top left: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_LTCornerButton - - - - - - - Which mouse button is reported on a left top corner tap - - - - - - - Bottom left: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_LBCornerButton - - - - - - - Top right: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_RTCornerButton - - - - - - - Which mouse button is reported on a left bottom corner tap - - - - - - - Which mouse button is reported on a right top corner tap - - - - - - - Which mouse button is reported on a right bottom corner tap - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 30 - 20 - - - - - - - - Bottom right: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kcfg_RBCornerButton - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - - - - - - - This gesture is an alternative way of dragging. It is performed by tapping (touching and releasing the finger), then touching again and moving the finger on the touchpad - - - Tap-and-Drag Gesture - - - true - - - true - - - - - - If off, a tap-and-drag gesture ends when you release the finger. If on, the gesture is active until you tap a second time, or until timeout expires - - - Locked Drags - - - false - - - true - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Timeout: - - - kcfg_LockedDragTimeout - - - - - - - How long it takes (in milliseconds) for the "Locked Drags" mode to be automatically turned off after the finger is released from the touchpad - - - 0 - - - 1000 - - - 1000 - - - ms - - - true - - - - - - - - - - - - - - 300 - 0 - - - - Tap Detection - - - true - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - - - - Maximum time: - - - kcfg_MaxTapTime - - - - - - - - - - Maximum finger movement: - - - kcfg_MaxTapMove - - - - - - - - - - Maximum time for double tap: - - - kcfg_MaxDoubleTapTime - - - - - - - - - - Single tap timeout: - - - kcfg_SingleTapTimeout - - - - - - - Maximum time (in milliseconds) for detecting a tap - - - 0 - - - 1000 - - - 10 - - - ms - - - true - - - - - - - Maximum movement of the finger for detecting a tap - - - 0.100000000000000 - - - mm - - - 1 - - - true - - - - - - - Maximum time (in milliseconds) for detecting a double tap - - - 0 - - - 1000 - - - 10 - - - ms - - - true - - - - - - - Timeout after a tap to recognize it as a single tap - - - 0 - - - 1000 - - - 10 - - - ms - - - true - - - - - - - - - - - KDoubleNumInput - QWidget -
knuminput.h
-
- - KComboBox - QComboBox -
kcombobox.h
-
- - KIntNumInput - QWidget -
knuminput.h
-
-
- - kcfg_OneFingerTapButton - kcfg_TwoFingerTapButton - kcfg_ThreeFingerTapButton - kcfg_LTCornerButton - kcfg_RTCornerButton - kcfg_LBCornerButton - kcfg_RBCornerButton - kcfg_TapAndDragGesture - kcfg_LockedDrags - kcfg_LockedDragTimeout - kcfg_MaxTapTime - kcfg_MaxTapMove - kcfg_MaxDoubleTapTime - kcfg_SingleTapTimeout - - - -
diff --git a/kcontrol/touchpad/src/kcm/testarea.cpp b/kcontrol/touchpad/src/kcm/testarea.cpp deleted file mode 100644 index e700fec1..00000000 --- a/kcontrol/touchpad/src/kcm/testarea.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "testarea.h" - -#include -#include -#include -#include - -#include -#include -#include - -TestArea::TestArea(QWidget *parent) : QWidget(parent) -{ - m_ui.setupUi(this); - - QStandardItemModel *model = new QStandardItemModel(m_ui.listView); - m_ui.listView->setModel(model); - QScopedPointer item( - new QStandardItem(KIcon("folder"), i18n("Drag me"))); - model->appendRow(item.data()); - item.take(); - - QString wallpaper = Plasma::Theme::defaultTheme()->wallpaperPath(); - static const QString stylesheet("background-image: url(%1)"); - m_ui.scrollAreaWidgetContents->setStyleSheet(stylesheet.arg(wallpaper)); -} - -void TestArea::enterEvent(QEvent *e) -{ - Q_EMIT enter(); - QWidget::enterEvent(e); -} - -void TestArea::leaveEvent(QEvent *e) -{ - Q_EMIT leave(); - QWidget::leaveEvent(e); -} diff --git a/kcontrol/touchpad/src/kcm/testarea.h b/kcontrol/touchpad/src/kcm/testarea.h deleted file mode 100644 index 7c91c477..00000000 --- a/kcontrol/touchpad/src/kcm/testarea.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef TESTAREA_H -#define TESTAREA_H - -#include "ui_testarea.h" - -class TestArea : public QWidget -{ - Q_OBJECT -public: - explicit TestArea(QWidget *); - -Q_SIGNALS: - void enter(); - void leave(); - -protected: - void enterEvent(QEvent *); - void leaveEvent(QEvent *); - -private: - Ui::TestArea m_ui; -}; - -#endif // TESTAREA_H diff --git a/kcontrol/touchpad/src/kcm/testarea.ui b/kcontrol/touchpad/src/kcm/testarea.ui deleted file mode 100644 index 05b7cba6..00000000 --- a/kcontrol/touchpad/src/kcm/testarea.ui +++ /dev/null @@ -1,72 +0,0 @@ - - - TestArea - - - - 0 - 0 - 200 - 629 - - - - true - - - - - - Testing area - - - - - - Qt::NoFocus - - - Click me - - - - - - - Qt::NoFocus - - - - - 2000 - 2000 - - - - - - - - - Qt::NoFocus - - - QListView::IconMode - - - - - - - - - - - TestButton - QPushButton -
kcm/testbutton.h
-
-
- - -
diff --git a/kcontrol/touchpad/src/kcm/testbutton.cpp b/kcontrol/touchpad/src/kcm/testbutton.cpp deleted file mode 100644 index 561b4e18..00000000 --- a/kcontrol/touchpad/src/kcm/testbutton.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "testbutton.h" - -#include -#include - -#include - -TestButton::TestButton(QWidget *parent) - : QPushButton(parent), m_firstClick(true) -{ -} - -void TestButton::mousePressEvent(QMouseEvent *e) -{ - if (m_firstClick) { - m_originalText = text(); - m_firstClick = false; - } - - switch (e->button()) { - case Qt::LeftButton: - setText(i18nc("Mouse button", "Left button")); - break; - case Qt::RightButton: - setText(i18nc("Mouse button", "Right button")); - break; - case Qt::MiddleButton: - setText(i18nc("Mouse button", "Middle button")); - break; - default: - break; - } - - QTimer::singleShot(500, this, SLOT(resetText())); - - QPushButton::mousePressEvent(e); -} - -void TestButton::resetText() -{ - setText(m_originalText); -} diff --git a/kcontrol/touchpad/src/kcm/testbutton.h b/kcontrol/touchpad/src/kcm/testbutton.h deleted file mode 100644 index bef5af16..00000000 --- a/kcontrol/touchpad/src/kcm/testbutton.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef TESTBUTTON_H -#define TESTBUTTON_H - -#include - -class TestButton : public QPushButton -{ - Q_OBJECT - -public: - explicit TestButton(QWidget *); - -protected: - void mousePressEvent(QMouseEvent *); - -private Q_SLOTS: - void resetText(); - -private: - QString m_originalText; - bool m_firstClick; -}; - -#endif // TESTBUTTON_H diff --git a/kcontrol/touchpad/src/kcm/touchpad.kcfg b/kcontrol/touchpad/src/kcm/touchpad.kcfg deleted file mode 100644 index 2afe6429..00000000 --- a/kcontrol/touchpad/src/kcm/touchpad.kcfg +++ /dev/null @@ -1,312 +0,0 @@ - - - - - - - - OneFingerTap - TwoFingerTap - ThreeFingerTap - LTCorner - LBCorner - RTCorner - RBCorner - - - - - - - - - - - - - - - - - - systemDefaultEnum("OneFingerTapButton", LeftButton) - - - systemDefaultEnum("TwoFingerTapButton", RightButton) - - - systemDefaultEnum("ThreeFingerTapButton", MiddleButton) - - - systemDefaultEnum("LTCornerButton", NoButton) - - - systemDefaultEnum("LBCornerButton", NoButton) - - - systemDefaultEnum("RTCornerButton", NoButton) - - - systemDefaultEnum("RBCornerButton", NoButton) - - - - - systemDefault("VertEdgeScroll", true) - - - - - systemDefault("VertTwoFingerScroll", true) - - - - - systemDefault("HorizEdgeScroll", true) - - - - - systemDefault("HorizTwoFingerScroll", true) - - - - 0 - 255 - - systemDefault("MinSpeed", 0.0) - - - - 0 - 255 - - systemDefault("MaxSpeed", 255.0) - - - - 0 - 1 - - systemDefault("AccelFactor", 0.0) - - - - 0 - 100 - - systemDefault("HorizHysteresis", 0) - - - - 0 - 100 - - systemDefault("VertHysteresis", 0) - - - - - systemDefault("TapAndDragGesture", true) - - - - - systemDefault("LockedDrags", false) - - - - 0 - 30000 - - systemDefault("LockedDragTimeout", 5000) - - - - 0 - 10 - - systemDefault("VertScrollDelta", 1.0) - - - - - systemDefault("InvertVertScroll", false) - - - - 0 - 10 - - systemDefault("HorizScrollDelta", 1.0) - - - - - systemDefault("InvertHorizScroll", false) - - - - - systemDefault("CornerCoasting", false) - - - - 0.1 - 255 - - systemDefault("CoastingSpeed", 20.0) - - - - 0 - 255 - - systemDefault("CoastingFriction", 50.0) - - - - - systemDefault("Coasting", true) - - - - 0 - 255 - - systemDefault("FingerHigh", 30) - - - - 0 - 255 - - systemDefault("FingerLow", 25) - - - - - systemDefault("PalmDetect", false) - - - - 0 - 255 - - systemDefault("PalmMinZ", 200) - - - - 0 - 15 - - systemDefault("PalmMinWidth", 10) - - - - 0 - 1000 - - systemDefault("MaxTapTime", 180) - - - - 0 - 1000 - - systemDefault("MaxDoubleTapTime", 180) - - - - 0 - 1000 - - systemDefault("SingleTapTimeout", 180) - - - - 0 - 20 - - systemDefault("MaxTapMove", 2.0) - - - - 1 - 255 - - systemDefault("PressureMotionMinZ", 30) - - - - 1 - 255 - - systemDefault("PressureMotionMaxZ", 160) - - - - 0 - 10 - - systemDefault("PressureMotionMinFactor", 1.0) - - - - 0 - 10 - - systemDefault("PressureMotionMaxFactor", 1.0) - - - - - systemDefault("CircularScrolling", false) - - - - - systemDefault("CircScrollDelta", 10.0) - - 0 - 45 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - systemDefaultEnum("CircScrollTrigger", AllEdges) - - - - diff --git a/kcontrol/touchpad/src/kcm/touchpadconfig.cpp b/kcontrol/touchpad/src/kcm/touchpadconfig.cpp deleted file mode 100644 index 9d8e22b5..00000000 --- a/kcontrol/touchpad/src/kcm/touchpadconfig.cpp +++ /dev/null @@ -1,373 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "touchpadconfig.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "customslider.h" -#include "sliderpair.h" -#include "touchpadbackend.h" -#include "plugins.h" -#include "testarea.h" -#include "touchpadinterface.h" -#include "customconfigdialogmanager.h" -#include "kded/kdedactions.h" - -void touchpadApplySavedConfig() -{ - TouchpadBackend *backend = TouchpadBackend::implementation(); - if (!backend) { - return; - } - - TouchpadParameters config; - backend->applyConfig(config.values()); -} - -extern "C" -{ - KDE_EXPORT void kcminit_touchpad() - { - TouchpadParameters::setSystemDefaults(); - touchpadApplySavedConfig(); - } -} - -static void copyHelpFromBuddy(QObject *root) -{ - QLabel *asLabel = qobject_cast(root); - if (asLabel && asLabel->buddy()) { - if (asLabel->toolTip().isEmpty()) { - asLabel->setToolTip(asLabel->buddy()->toolTip()); - } - if (asLabel->statusTip().isEmpty()) { - asLabel->setStatusTip(asLabel->buddy()->statusTip()); - } - if (asLabel->whatsThis().isEmpty()) { - asLabel->setWhatsThis(asLabel->buddy()->whatsThis()); - } - } - Q_FOREACH(QObject *child, root->children()) { - copyHelpFromBuddy(child); - } -} - -template -QWidget *addTab(KTabWidget *tabs, T &form) -{ - QScrollArea *container = new QScrollArea(tabs); - container->setWidgetResizable(true); - container->setFrameStyle(QFrame::NoFrame); - container->setAlignment(Qt::AlignHCenter | Qt::AlignTop); - - QWidget *widget = new QWidget(container); - form.setupUi(widget); - copyHelpFromBuddy(widget); - widget->setContentsMargins(20, 20, 20, 20); - widget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); - - container->setWidget(widget); - tabs->addTab(container, widget->windowTitle()); - - return widget; -} - -TouchpadConfig::TouchpadConfig(QWidget *parent, const QVariantList &args) - : KCModule(TouchpadPluginFactory::componentData(), parent, args), - m_configOutOfSync(false) -{ - setAboutData(new KAboutData(*componentData().aboutData())); - - QGridLayout *layout = new QGridLayout(this); - QVBoxLayout *messageLayout = new QVBoxLayout(); - layout->addLayout(messageLayout, 0, 0, 1, 2); - - // Messages - - m_errorMessage = new KMessageWidget(this); - m_errorMessage->setMessageType(KMessageWidget::Error); - m_errorMessage->setVisible(false); - messageLayout->addWidget(m_errorMessage); - - m_configOutOfSyncMessage = new KMessageWidget(this); - m_configOutOfSyncMessage->setMessageType(KMessageWidget::Warning); - m_configOutOfSyncMessage->setText( - i18n("Active settings don't match saved settings.\n" - "You currently see saved settings.")); - m_configOutOfSyncMessage->setVisible(false); - messageLayout->addWidget(m_configOutOfSyncMessage); - - m_loadActiveConfiguration = new KAction(m_configOutOfSyncMessage); - m_loadActiveConfiguration->setText(i18n("Show active settings")); - connect(m_loadActiveConfiguration, SIGNAL(triggered()), - SLOT(loadActiveConfig())); - m_configOutOfSyncMessage->addAction(m_loadActiveConfiguration); - - layout->setColumnStretch(0, 3); - layout->setColumnStretch(1, 1); - - // Main UI - - m_tabs = new KTabWidget(this); - layout->addWidget(m_tabs, 1, 0, 1, 1); - - addTab(m_tabs, m_tapping); - addTab(m_tabs, m_scrolling); - addTab(m_tabs, m_pointerMotion); - addTab(m_tabs, m_sensitivity); - - static const CustomSlider::SqrtInterpolator interpolator; - m_pointerMotion.kcfg_MinSpeed->setInterpolator(&interpolator); - m_pointerMotion.kcfg_MaxSpeed->setInterpolator(&interpolator); - m_pointerMotion.kcfg_AccelFactor->setInterpolator(&interpolator); - - new SliderPair(m_pointerMotion.kcfg_MinSpeed, - m_pointerMotion.kcfg_MaxSpeed, this); - new SliderPair(m_sensitivity.kcfg_FingerLow, - m_sensitivity.kcfg_FingerHigh, this); - new SliderPair(m_pointerMotion.kcfg_PressureMotionMinZ, - m_pointerMotion.kcfg_PressureMotionMaxZ, this); - - m_backend = TouchpadBackend::implementation(); - - KConfigDialogManager::changedMap()->insert("CustomSlider", - SIGNAL(valueChanged(double))); - m_manager = new CustomConfigDialogManager(this, &m_config, - m_backend->supportedParameters()); - connect(m_manager, SIGNAL(widgetModified()), SLOT(checkChanges()), - Qt::QueuedConnection); - - // KDED settings - - m_kdedTab = addTab(m_tabs, m_kded); - m_daemonConfigManager = addConfig(&m_daemonSettings, m_kdedTab); - - KMessageWidget *kdedMessage = new KMessageWidget(m_kdedTab); - kdedMessage->setMessageType(KMessageWidget::Information); - kdedMessage->setCloseButtonVisible(false); - kdedMessage->setText( - i18n("These settings won't take effect in the testing area")); - qobject_cast(m_kdedTab->layout())-> - insertWidget(0, kdedMessage); - - connect(m_kded.configureNotificationsButton, SIGNAL(clicked()), - SLOT(showConfigureNotificationsDialog())); - m_shortcutsDialog.reset(new KShortcutsDialog(KShortcutsEditor::GlobalAction, - KShortcutsEditor::LetterShortcutsDisallowed)); - m_shortcutsDialog->addCollection(new TouchpadGlobalActions(this), - i18n("Enable/Disable Touchpad")); - connect(m_kded.configureShortcutsButton, SIGNAL(clicked()), - m_shortcutsDialog.data(), SLOT(show())); - - m_mouseCombo = new KComboBox(true, m_kded.kcfg_MouseBlacklist); - m_kded.kcfg_MouseBlacklist->setCustomEditor(m_mouseCombo); - connect(m_backend, SIGNAL(mousesChanged()), SLOT(updateMouseList())); - m_backend->watchForEvents(false); - updateMouseList(); - - m_daemon = new OrgKdeTouchpadInterface("org.kde.kded", "/modules/touchpad", - QDBusConnection::sessionBus(), this); - m_kdedTab->setEnabled(false); - QDBusPendingCallWatcher *watch; - watch = new QDBusPendingCallWatcher(m_daemon->workingTouchpadFound(), this); - connect(watch, SIGNAL(finished(QDBusPendingCallWatcher*)), - SLOT(gotReplyFromDaemon(QDBusPendingCallWatcher*))); - - // Testing area - - m_testArea = new TestArea(this); - layout->addWidget(m_testArea, 1, 1); - connect(m_testArea, SIGNAL(enter()), SLOT(beginTesting())); - connect(m_testArea, SIGNAL(leave()), SLOT(endTesting())); - connect(this, SIGNAL(changed(bool)), SLOT(onChanged())); - connect(m_tabs, SIGNAL(currentChanged(int)), SLOT(updateTestAreaEnabled())); - updateTestAreaEnabled(); -} - -void TouchpadConfig::gotReplyFromDaemon(QDBusPendingCallWatcher *watch) -{ - QDBusPendingReply reply = *watch; - if (reply.isValid() && reply.value()) { - m_kdedTab->setEnabled(true); - } - watch->deleteLater(); -} - -void TouchpadConfig::updateMouseList() -{ - QStringList mouses( - m_backend->listMouses(m_daemonSettings.mouseBlacklist())); - - for (int i = 0; i < m_mouseCombo->count(); ) { - if (!mouses.contains(m_mouseCombo->itemText(i))) { - m_mouseCombo->removeItem(i); - } else { - i++; - } - } - - Q_FOREACH (const QString &i, mouses) { - if (!m_mouseCombo->contains(i)) { - m_mouseCombo->addItem(i); - } - } -} - -QVariantHash TouchpadConfig::getActiveConfig() -{ - if (m_prevConfig) { - return *m_prevConfig; - } - - QVariantHash activeConfig; - if (!m_backend->getConfig(activeConfig)) { - m_errorMessage->setText(m_backend->errorString()); - QMetaObject::invokeMethod(m_errorMessage, "animatedShow", - Qt::QueuedConnection); - } - return activeConfig; -} - -void TouchpadConfig::loadActiveConfig() -{ - m_manager->setWidgetProperties(getActiveConfig()); - m_configOutOfSync = false; - m_configOutOfSyncMessage->animatedHide(); -} - -void TouchpadConfig::load() -{ - m_manager->updateWidgets(); - - KCModule::load(); - - m_configOutOfSync = !m_manager->compareWidgetProperties(getActiveConfig()); -} - -void TouchpadConfig::save() -{ - m_manager->updateSettings(); - - m_configOutOfSync = false; - m_configOutOfSyncMessage->animatedHide(); - - bool daemonSettingsChanged = m_daemonConfigManager->hasChanged(); - - KCModule::save(); - - if (m_backend->applyConfig(m_config.values())) { - m_errorMessage->animatedHide(); - } else { - m_errorMessage->setText(m_backend->errorString()); - m_errorMessage->animatedShow(); - } - - if (daemonSettingsChanged) { - m_daemon->reloadSettings(); - updateMouseList(); - } -} - -void TouchpadConfig::defaults() -{ - m_manager->updateWidgetsDefault(); - - KCModule::defaults(); -} - -void TouchpadConfig::checkChanges() -{ - unmanagedWidgetChangeState(m_manager->hasChangedFuzzy() - || m_configOutOfSync); - if (m_configOutOfSync) { - m_configOutOfSyncMessage->animatedShow(); - } else { - m_configOutOfSyncMessage->animatedHide(); - } -} - -void TouchpadConfig::hideEvent(QHideEvent *e) -{ - endTesting(); - KCModule::hideEvent(e); -} - -TouchpadConfig::~TouchpadConfig() -{ - endTesting(); -} - -void TouchpadConfig::onChanged() -{ - if (m_testArea->underMouse()) { - beginTesting(); - } -} - -void TouchpadConfig::beginTesting() -{ - if (!m_prevConfig) { - m_prevConfig.reset(new QVariantHash()); - m_backend->getConfig(*m_prevConfig.data()); - } - m_backend->applyConfig(m_manager->currentWidgetProperties()); -} - -void TouchpadConfig::endTesting() -{ - if (!m_prevConfig) { - return; - } - m_backend->applyConfig(*m_prevConfig.data()); - m_prevConfig.reset(); -} - -void TouchpadConfig::updateTestAreaEnabled() -{ - bool enable = true; - for (QWidget *i = m_kdedTab; i; i = i->parentWidget()) { - if (i == m_tabs->currentWidget()) { - enable = false; - break; - } - } - - m_testArea->setEnabled(enable); - m_testArea->setMouseTracking(enable); - if (!enable) { - endTesting(); - } -} - -void TouchpadConfig::showConfigureNotificationsDialog() -{ - KNotifyConfigWidget *widget = - KNotifyConfigWidget::configure(0, componentData().componentName()); - KDialog *dialog = qobject_cast(widget->topLevelWidget()); - connect(dialog, SIGNAL(finished()), dialog, SLOT(deleteLater())); -} diff --git a/kcontrol/touchpad/src/kcm/touchpadconfig.h b/kcontrol/touchpad/src/kcm/touchpadconfig.h deleted file mode 100644 index 3f847951..00000000 --- a/kcontrol/touchpad/src/kcm/touchpadconfig.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef TOUCHPADCONFIG_H -#define TOUCHPADCONFIG_H - -#include -#include -#include - -#include "touchpadparameters.h" -#include "testarea.h" -#include "kdedsettings.h" - -#include "ui_pointermotion.h" -#include "ui_tap.h" -#include "ui_scroll.h" -#include "ui_sensitivity.h" -#include "ui_kded.h" - -class TouchpadBackend; -class KMessageWidget; -class OrgKdeTouchpadInterface; -class CustomConfigDialogManager; -class KAction; -class KShortcutsDialog; -class KTabWidget; -class KComboBox; -class QDBusPendingCallWatcher; - -class TouchpadConfig : public KCModule -{ - Q_OBJECT - -public: - explicit TouchpadConfig(QWidget *parent, - const QVariantList &args = QVariantList()); - virtual ~TouchpadConfig(); - - virtual void load(); - virtual void save(); - virtual void defaults(); - -protected: - virtual void hideEvent(QHideEvent *); - -private Q_SLOTS: - void beginTesting(); - void endTesting(); - void onChanged(); - void checkChanges(); - void loadActiveConfig(); - void updateTestAreaEnabled(); - void updateMouseList(); - void showConfigureNotificationsDialog(); - void gotReplyFromDaemon(QDBusPendingCallWatcher *); - -private: - QVariantHash getActiveConfig(); - - TouchpadBackend *m_backend; - TouchpadParameters m_config; - - QScopedPointer m_prevConfig; - CustomConfigDialogManager *m_manager; - TouchpadDisablerSettings m_daemonSettings; - KConfigDialogManager *m_daemonConfigManager; - KMessageWidget *m_errorMessage, *m_configOutOfSyncMessage; - TestArea *m_testArea; - OrgKdeTouchpadInterface *m_daemon; - KAction *m_loadActiveConfiguration; - bool m_configOutOfSync; - QScopedPointer m_shortcutsDialog; - QWidget *m_kdedTab; - KTabWidget *m_tabs; - KComboBox *m_mouseCombo; - - Ui::PointerMotionForm m_pointerMotion; - Ui::TapForm m_tapping; - Ui::ScrollForm m_scrolling; - Ui::SensitivityForm m_sensitivity; - Ui::KdedForm m_kded; -}; - -#endif // TOUCHPADCONFIG_H diff --git a/kcontrol/touchpad/src/kcm/touchpadparameters.kcfgc b/kcontrol/touchpad/src/kcm/touchpadparameters.kcfgc deleted file mode 100644 index 1a229f78..00000000 --- a/kcontrol/touchpad/src/kcm/touchpadparameters.kcfgc +++ /dev/null @@ -1,9 +0,0 @@ -File=touchpad.kcfg -ClassName=TouchpadParameters -Mutators=true -MemberVariables=private -GlobalEnums=true -UseEnumTypes=true -Inherits=TouchpadParametersBase -IncludeFiles=\"kcm/touchpadparametersbase.h\" -SetUserTexts=true diff --git a/kcontrol/touchpad/src/kcm/touchpadparametersbase.cpp b/kcontrol/touchpad/src/kcm/touchpadparametersbase.cpp deleted file mode 100644 index b39f5937..00000000 --- a/kcontrol/touchpad/src/kcm/touchpadparametersbase.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "touchpadparametersbase.h" -#include "touchpadbackend.h" - -namespace -{ - -KConfigGroup &systemDefaults() -{ - static KSharedConfig::Ptr p(KSharedConfig::openConfig(".touchpaddefaults", - KConfig::SimpleConfig, - "tmp")); - static KConfigGroup group(p->group("parameters")); - return group; -} - -} - -TouchpadParametersBase::TouchpadParametersBase(const QString &configname, - QObject *parent) - : KCoreConfigSkeleton(configname, parent) -{ - if (!systemDefaults().exists()) { - setSystemDefaults(); - } -} - -QVariantHash TouchpadParametersBase::values() const -{ - QVariantHash r; - Q_FOREACH(const KConfigSkeletonItem *i, items()) { - r[i->name()] = i->property(); - } - return r; -} - -void TouchpadParametersBase::setValues(const QVariantHash &v) -{ - for (QVariantHash::ConstIterator i = v.begin(); i != v.end(); ++i) { - KConfigSkeletonItem *j = findItem(i.key()); - if (j) { - j->setProperty(i.value()); - } - } -} - -void TouchpadParametersBase::setSystemDefaults() -{ - TouchpadBackend *backend = TouchpadBackend::implementation(); - if (!backend) { - return; - } - QVariantHash v; - backend->getConfig(v); - - for (QVariantHash::ConstIterator i = v.begin(); i != v.end(); ++i) { - systemDefaults().writeEntry(i.key(), i.value()); - } - systemDefaults().sync(); -} - -QVariant TouchpadParametersBase::systemDefault(const QString &name, - const QVariant &hardcoded) -{ - return systemDefaults().readEntry(name, hardcoded); -} diff --git a/kcontrol/touchpad/src/kcm/touchpadparametersbase.h b/kcontrol/touchpad/src/kcm/touchpadparametersbase.h deleted file mode 100644 index c51a30e9..00000000 --- a/kcontrol/touchpad/src/kcm/touchpadparametersbase.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef TOUCHPADPARAMETERSBASE_H -#define TOUCHPADPARAMETERSBASE_H - -#include - -#include - -class TouchpadParametersBase : public KCoreConfigSkeleton -{ -public: - explicit TouchpadParametersBase(const QString &configname = QString(), - QObject *parent = 0); - - QVariantHash values() const; - void setValues(const QVariantHash &); - - static void setSystemDefaults(); - static QVariant systemDefault(const QString &name, - const QVariant &hardcoded = QVariant()); - template - static T systemDefault(const QString &name, const T &hardcoded = T()) - { - return qvariant_cast(systemDefault(name, QVariant(hardcoded))); - } - - template - static T systemDefaultEnum(const QString &name, const T &hardcoded = T()) - { - return static_cast(systemDefault(name, static_cast(hardcoded))); - } -}; - -#endif // TOUCHPADPARAMETERSBASE_H diff --git a/kcontrol/touchpad/src/kded/kcm_touchpad.notifyrc b/kcontrol/touchpad/src/kded/kcm_touchpad.notifyrc deleted file mode 100644 index cefbc481..00000000 --- a/kcontrol/touchpad/src/kded/kcm_touchpad.notifyrc +++ /dev/null @@ -1,148 +0,0 @@ -[Global] -Name=Touchpad -Name[bs]=Dodirna površina -Name[cs]=Touchpad -Name[da]=Touchpad -Name[de]=Touchpad -Name[el]=Επιφάνεια αφής -Name[es]=Panel táctil -Name[fi]=Kosketuslevy -Name[fr]=Pavé tactile -Name[hu]=Érintőtábla -Name[ko]=터치패드 -Name[lt]=Jutiklinis kilimėlis -Name[nl]=Touchpad -Name[pl]=Gładzik -Name[pt]=Rato por Toque -Name[pt_BR]=Touchpad -Name[ro]=Zonă tactilă -Name[sk]=Touchpad -Name[sl]=Sledilna ploščica -Name[sv]=Tryckplatta -Name[tr]=Dokunmatik Yüzey -Name[uk]=Сенсорна панель -Name[x-test]=xxTouchpadxx -IconName=input-touchpad -Comment=Touchpad -Comment[bs]=Dodirna površina -Comment[cs]=Touchpad -Comment[da]=Touchpad -Comment[de]=Touchpad -Comment[el]=Επιφάνεια αφής -Comment[es]=Panel táctil -Comment[fi]=Kosketuslevy -Comment[fr]=Pavé tactile -Comment[hu]=Érintőtábla -Comment[ko]=터치패드 -Comment[lt]=Jutiklinis kilimėlis -Comment[nl]=Touchpad -Comment[pl]=Gładzik -Comment[pt]=Rato por Toque -Comment[pt_BR]=Touchpad -Comment[ro]=Zonă tactilă -Comment[sk]=Touchpad -Comment[sl]=Sledilna ploščica -Comment[sv]=Tryckplatta -Comment[tr]=Dokunmatik Yüzey -Comment[uk]=Сенсорна панель -Comment[x-test]=xxTouchpadxx - -[Event/TouchpadDisabled] -Name=Touchpad was disabled -Name[bs]=Dodirna površina je isključena -Name[cs]=Touchpad byl zakázán -Name[da]=Touchpad blev deaktiveret -Name[de]=Das Touchpad wurde deaktiviert -Name[el]=Η επιφάνεια αφής απενεργοποιήθηκε -Name[es]=El panel táctil se ha desactivado -Name[fi]=Kosketuslevy poistettiin käytöstä -Name[fr]=Le pavé tactile a été désactivé -Name[hu]=Az érintőtábla le lett tiltva -Name[ko]=터치패드 비활성화됨 -Name[lt]=Jutiklinis kilimėlis išjungtas -Name[nl]=Touchpad was uitgeschakeld -Name[pl]=Gładzik został wyłączony -Name[pt]=O rato por toque foi desactivado -Name[pt_BR]=O touchpad foi desativado -Name[ro]=Zona tactilă a fost dezactivată -Name[sk]=Touchpad bol zakázaný -Name[sl]=Sledilna ploščica je bila onemogočena -Name[sv]=Tryckplattan stängdes av -Name[tr]=Dokunmatik yüzey devre dışı bırakıldı -Name[uk]=Сенсорну панель вимкнено -Name[x-test]=xxTouchpad was disabledxx -Comment=Touchpad was disabled because mouse is detected -Comment[bs]=Dodirna površina je isključena jer je miš prepoznat -Comment[cs]=Touchpad byl zakázán protože byla zjištěna myš -Comment[da]=Touchpad blev deaktiveret fordi musen blev detekteret -Comment[de]=Das Touchpad wurde deaktiviert, weil eine Maus erkannt wurde -Comment[el]=Η επιφάνειας αφής απενεργοποιήθηκε επειδή το ποντίκι ανιχνεύτηκε -Comment[es]=El panel táctil se ha desactivado porque se ha detectado un ratón -Comment[fi]=Kosketuslevy poistettiin käytöstä, koska havaittiin hiiri -Comment[fr]=Le pavé tactile a été désactivé car une souris a été détectée -Comment[hu]=Az érintőtábla le lett tiltva, mert érzékelhető egy egér -Comment[ko]=마우스가 감지되어 터치패드 비활성화됨 -Comment[lt]=Jutiklinis kilimėlis išjungtas, nes aptikta pelė -Comment[nl]=Touchpad was uitgeschakeld omdat er een muis is gedetecteerd -Comment[pl]=Gładzik został wyłączony, bo podłączono mysz -Comment[pt]=O rato por toque foi desactivado porque foi detectado um rato -Comment[pt_BR]=O touchpad foi desativado porque o mouse foi detectado -Comment[ro]=Zona tactilă a fost dezactivată deoarece s-a detectat un maus -Comment[sk]=Touchpad bol zakázaný, lebo bola zistená myš -Comment[sl]=Sledilna ploščica je bila onemogočena, ker je bila zaznana miška -Comment[sv]=Tryckplattan stängdes av eftersom en mus detekterades -Comment[tr]=Dokunmatik yüzey fare tespit edildiğinden devre dışı bırakıldı -Comment[uk]=Сенсорну панель вимкнено, оскільки виявлено мишу -Comment[x-test]=xxTouchpad was disabled because mouse is detectedxx -Sound=KDE-Sys-App-Positive.ogg -Action=Popup - -[Event/TouchpadEnabled] -Name=Touchpad was enabled -Name[bs]=Dodirna površina je uključena -Name[cs]=Touchpad byl povolen -Name[da]=Touchpad blev aktiveret -Name[de]=Das Touchpad wurde aktiviert -Name[el]=Η επιφάνεια αφής ενεργοποιήθηκε -Name[es]=El panel táctil se ha activado -Name[fi]=Kosketuslevy otettiin käyttöön -Name[fr]=Le pavé tactile a été activé -Name[hu]=Az érintőtábla engedélyezve lett -Name[ko]=터치패드 활성화됨 -Name[lt]=Jutiklinis kilimėlis įjungtas -Name[nl]=Touchpad was ingeschakeld -Name[pl]=Gładzik został włączony -Name[pt]=O rato por toque foi activado -Name[pt_BR]=O touchpad foi ativado -Name[ro]=Zona tactilă a fost activată -Name[sk]=Touchpad bol povolený -Name[sl]=Sledilna ploščica je bila omogočena -Name[sv]=Tryckplattan aktiverades -Name[tr]=Dokunmatik yüzey etkinleştirildi -Name[uk]=Сенсорну панель увімкнено -Name[x-test]=xxTouchpad was enabledxx -Comment=Touchpad was enabled because the mouse was unplugged -Comment[bs]=Dodirna površina je uključena jer je miš isključen -Comment[cs]=Touchpad byl povolen protože byla odpojena myš -Comment[da]=Touchpad blev aktiveret fordi musen blev frakoblet -Comment[de]=Das Touchpad wurde aktiviert, weil eine Maus abgezogen wurde -Comment[el]=Η επιφάνειας αφής ενεργοποιήθηκε επειδή το ποντίκι αποσυνδέθηκε -Comment[es]=El panel táctil se ha activado porque se ha desconectado el ratón -Comment[fi]=Kosketuslevy otettiin käyttöön, koska hiiri irrotettiin -Comment[fr]=Le pavé tactile a été activé car la souris a été débranchée -Comment[hu]=Az érintőtábla engedélyezve lett, mert az egér ki lett húzva -Comment[ko]=마우스가 연결 해제되어 터치패드 활성화됨 -Comment[lt]=Jutiklinis kilimėlis įjungtas, nes buvo atjungta pelė -Comment[nl]=Touchpad was ingeschakeld omdat er een muis is uitgetrokken -Comment[pl]=Gładzik został włączony, bo odłączono mysz -Comment[pt]=O rato por toque foi activado porque o rato foi desligado -Comment[pt_BR]=O touchpad foi ativado porque o mouse foi desconectado -Comment[ro]=Zona tactilă a fost activată deoarece mausul a fost deconectat -Comment[sk]=Touchpad bol povolený, pretože myš bola odpojená -Comment[sl]=Sledilna ploščica je bila omogočena, ker je bila miška odklopljena -Comment[sv]=Tryckplattan aktiverades eftersom en mus kopplades bort -Comment[tr]=Dokunmatik yüzey fare çıkarıldığından etkinleştirildi -Comment[uk]=Сенсорну панель увімкнено, оскільки мишу було від’єднано -Comment[x-test]=xxTouchpad was enabled because the mouse was unpluggedxx -Sound=KDE-Sys-App-Negative.ogg -Action=Sound diff --git a/kcontrol/touchpad/src/kded/kded.cpp b/kcontrol/touchpad/src/kded/kded.cpp deleted file mode 100644 index 3e217ae2..00000000 --- a/kcontrol/touchpad/src/kded/kded.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "kded.h" - -#include -#include - -#include "plugins.h" -#include "kdedactions.h" - -bool TouchpadDisabler::workingTouchpadFound() const -{ - return m_backend && !(m_backend->supportedParameters().isEmpty()); -} - -void TouchpadDisabler::serviceRegistered(const QString &service) -{ - if (!m_dependecies.removeWatchedService(service)) { - return; - } - - if (m_dependecies.watchedServices().isEmpty()) { - lateInit(); - } -} - -TouchpadDisabler::TouchpadDisabler(QObject *parent, const QVariantList &) - : KDEDModule(parent), m_backend(TouchpadBackend::implementation()), - m_enabled(true), m_keyboardActivity(false), m_mouse(false) -{ - if (!workingTouchpadFound()) { - return; - } - - m_dependecies.addWatchedService("org.kde.plasma-desktop"); - m_dependecies.addWatchedService("org.kde.kglobalaccel"); - connect(&m_dependecies, SIGNAL(serviceRegistered(QString)), - SLOT(serviceRegistered(QString))); - - connect(m_backend, SIGNAL(mousesChanged()), SLOT(mousePlugged())); - connect(m_backend, SIGNAL(keyboardActivityStarted()), - SLOT(keyboardActivityStarted())); - connect(m_backend, SIGNAL(keyboardActivityFinished()), - SLOT(keyboardActivityFinished())); - connect(m_backend, SIGNAL(touchpadStateChanged()), - SLOT(updateCurrentState())); - - connect(m_backend, SIGNAL(touchpadReset()), SLOT(handleReset())); - - m_keyboardActivityTimeout.setSingleShot(true); - connect(&m_keyboardActivityTimeout, SIGNAL(timeout()), - SLOT(timerElapsed())); - - updateCurrentState(); - reloadSettings(); - - m_dependecies.setWatchMode(QDBusServiceWatcher::WatchForRegistration); - m_dependecies.setConnection(QDBusConnection::sessionBus()); - Q_FOREACH (const QString &service, m_dependecies.watchedServices()) { - QDBusReply registered = QDBusConnection::sessionBus().interface() - ->isServiceRegistered(service); - if (!registered.isValid() || registered.value()) { - serviceRegistered(service); - } - } -} - -bool TouchpadDisabler::isEnabled() const -{ - return m_enabled; -} - -void TouchpadDisabler::updateCurrentState() -{ - bool newEnabled = m_backend->isTouchpadEnabled(); - if (newEnabled != m_enabled) { - m_enabled = newEnabled; - Q_EMIT enabledChanged(m_enabled); - } -} - -void TouchpadDisabler::toggle() -{ - m_backend->setTouchpadEnabled(!isEnabled()); -} - -void TouchpadDisabler::disable() -{ - m_backend->setTouchpadEnabled(false); -} - -void TouchpadDisabler::enable() -{ - m_backend->setTouchpadEnabled(true); -} - -void TouchpadDisabler::reloadSettings() -{ - m_settings.readConfig(); - m_keyboardActivityTimeout.setInterval( - m_settings.keyboardActivityTimeoutMs()); - - m_keyboardDisableState = - m_settings.onlyDisableTapAndScrollOnKeyboardActivity() ? - TouchpadBackend::TouchpadTapAndScrollDisabled : - TouchpadBackend::TouchpadFullyDisabled; - - mousePlugged(); - - m_backend->watchForEvents(m_settings.disableOnKeyboardActivity()); -} - -void TouchpadDisabler::keyboardActivityStarted() -{ - if (m_keyboardActivity || !m_settings.disableOnKeyboardActivity()) { - return; - } - - m_keyboardActivityTimeout.stop(); - m_keyboardActivity = true; - m_backend->setTouchpadOff(m_keyboardDisableState); -} - -void TouchpadDisabler::keyboardActivityFinished() -{ - if (!m_keyboardActivity) { - keyboardActivityStarted(); - } - m_keyboardActivityTimeout.start(); -} - -void TouchpadDisabler::timerElapsed() -{ - if (!m_keyboardActivity) { - return; - } - - m_keyboardActivity = false; - m_backend->setTouchpadOff(TouchpadBackend::TouchpadEnabled); -} - -void TouchpadDisabler::mousePlugged() -{ - if (!m_dependecies.watchedServices().isEmpty()) { - return; - } - - bool pluggedIn = isMousePluggedIn(); - Q_EMIT mousePluggedInChanged(pluggedIn); - - bool disable = pluggedIn && m_settings.disableWhenMousePluggedIn(); - if (m_mouse == disable) { - return; - } - m_mouse = disable; - - if (m_enabled == !disable) { - return; - } - - if (disable) { - showNotification("TouchpadDisabled", - i18n("Touchpad was disabled because a mouse was plugged in")); - } else { - showNotification("TouchpadEnabled", - i18n("Touchpad was enabled because the mouse was unplugged")); - } - - m_backend->setTouchpadEnabled(!disable); -} - -void TouchpadDisabler::showNotification(const QString &name, const QString &text) -{ - KNotification::event(name, text, QPixmap(), //Icon is specified in .notifyrc - 0, KNotification::CloseOnTimeout, - TouchpadPluginFactory::componentData()); -} - -bool TouchpadDisabler::isMousePluggedIn() const -{ - return !m_backend->listMouses(m_settings.mouseBlacklist()).isEmpty(); -} - -void TouchpadDisabler::lateInit() -{ - TouchpadGlobalActions *actions = new TouchpadGlobalActions(this); - connect(actions, SIGNAL(enableTriggered()), SLOT(enable())); - connect(actions, SIGNAL(disableTriggered()), SLOT(disable())); - connect(actions, SIGNAL(toggleTriggered()), SLOT(toggle())); - - updateCurrentState(); - mousePlugged(); -} - -void touchpadApplySavedConfig(); - -void TouchpadDisabler::handleReset() -{ - m_backend->setTouchpadEnabled(m_enabled); - touchpadApplySavedConfig(); -} diff --git a/kcontrol/touchpad/src/kded/kded.h b/kcontrol/touchpad/src/kded/kded.h deleted file mode 100644 index 89ef548a..00000000 --- a/kcontrol/touchpad/src/kded/kded.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef KDED_H -#define KDED_H - -#include -#include -#include - -#include - -#include "touchpadbackend.h" -#include "kdedsettings.h" - -class TouchpadDisabler : public KDEDModule -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "org.kde.touchpad") - -public: - TouchpadDisabler(QObject *, const QVariantList &); - -Q_SIGNALS: - Q_SCRIPTABLE void enabledChanged(bool); - Q_SCRIPTABLE void mousePluggedInChanged(bool); - -public Q_SLOTS: - Q_SCRIPTABLE Q_NOREPLY void reloadSettings(); - Q_SCRIPTABLE Q_NOREPLY void toggle(); - Q_SCRIPTABLE Q_NOREPLY void disable(); - Q_SCRIPTABLE Q_NOREPLY void enable(); - Q_SCRIPTABLE bool isEnabled() const; - Q_SCRIPTABLE bool workingTouchpadFound() const; - Q_SCRIPTABLE bool isMousePluggedIn() const; - -private Q_SLOTS: - void keyboardActivityStarted(); - void keyboardActivityFinished(); - void timerElapsed(); - void mousePlugged(); - void updateCurrentState(); - void serviceRegistered(const QString &); - void handleReset(); - -private: - void showNotification(const QString &name, const QString &text); - void lateInit(); - - TouchpadBackend *m_backend; - TouchpadDisablerSettings m_settings; - QTimer m_keyboardActivityTimeout; - QDBusServiceWatcher m_dependecies; - - TouchpadBackend::TouchpadOffState m_keyboardDisableState; - bool m_enabled, m_keyboardActivity, m_mouse; -}; - -#endif // KDED_H diff --git a/kcontrol/touchpad/src/kded/kded_touchpad.desktop b/kcontrol/touchpad/src/kded/kded_touchpad.desktop deleted file mode 100644 index f639a21b..00000000 --- a/kcontrol/touchpad/src/kded/kded_touchpad.desktop +++ /dev/null @@ -1,53 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=KDEDModule -X-KDE-Library=touchpad -X-KDE-DBus-ModuleName=touchpad -X-KDE-Kded-autoload=true -X-KDE-Kded-load-on-demand=true -Name=Touchpad -Name[bs]=Dodirna površina -Name[cs]=Touchpad -Name[da]=Touchpad -Name[de]=Touchpad -Name[el]=Επιφάνεια αφής -Name[es]=Panel táctil -Name[fi]=Kosketuslevy -Name[fr]=Pavé tactile -Name[hu]=Érintőtábla -Name[ko]=터치패드 -Name[lt]=Jutiklinis kilimėlis -Name[nl]=Touchpad -Name[pl]=Gładzik -Name[pt]=Rato por Toque -Name[pt_BR]=Touchpad -Name[ro]=Zonă tactilă -Name[sk]=Touchpad -Name[sl]=Sledilna ploščica -Name[sv]=Tryckplatta -Name[tr]=Dokunmatik Yüzey -Name[uk]=Сенсорна панель -Name[x-test]=xxTouchpadxx -Comment=Enables or disables touchpad -Comment[bs]=Uključuje ili isključuje dodirnu površinu -Comment[cs]=Povolí/zakáže touchpad -Comment[da]=Aktiverer eller deaktiverer touchpad -Comment[de]=Aktiviert oder deaktiviert das Touchpad -Comment[el]=Ενεργοποιεί ή απενεργοποιεί την επιφάνεια αφής -Comment[es]=Activa o desactiva el panel táctil -Comment[fi]=Ottaa kosketuslevyn käyttöön tai poistaa sen käytöstä -Comment[fr]=Active ou désactive le pavé tactile -Comment[hu]=Engedélyezi vagy letiltja az érintőtáblát -Comment[ko]=터치패드 활성/비활성 -Comment[lt]=Įjungia/išjungia jutiklinį kilimėlį -Comment[nl]=Schakelt het touchpad in of uit -Comment[pl]=Włącza lub wyłącza gładzik -Comment[pt]=Activa ou desactiva o rato por toque -Comment[pt_BR]=Ativa ou desativa o touchpad -Comment[ro]=Activează sau dezactivează zona tactilă -Comment[sk]=Povolí alebo zakáže touchpad -Comment[sl]=Omogoči ali onemogoči sledilno ploščico -Comment[sv]=Aktiverar eller stänger av tryckplatta -Comment[tr]=Dokunmatik yüzeyi etkinleştirir veya devre dışı bırakır -Comment[uk]=Вмикає або вимикає сенсорну панель -Comment[x-test]=xxEnables or disables touchpadxx diff --git a/kcontrol/touchpad/src/kded/kdedactions.cpp b/kcontrol/touchpad/src/kded/kdedactions.cpp deleted file mode 100644 index def99a52..00000000 --- a/kcontrol/touchpad/src/kded/kdedactions.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "kdedactions.h" - -#include -#include - -#include "plugins.h" - -TouchpadGlobalActions::TouchpadGlobalActions(QObject *parent) - : KActionCollection(parent) -{ - setComponentData(TouchpadPluginFactory::componentData()); - - KAction *enable = addAction("Enable Touchpad"); - enable->setText(i18n("Enable Touchpad")); - connect(enable, SIGNAL(triggered()), SIGNAL(enableTriggered())); - - KAction *disable = addAction("Disable Touchpad"); - disable->setText(i18n("Disable Touchpad")); - connect(disable, SIGNAL(triggered()), SIGNAL(disableTriggered())); - - KAction *toggle = addAction("Toggle Touchpad"); - toggle->setText(i18n("Toggle Touchpad")); - connect(toggle, SIGNAL(triggered()), SIGNAL(toggleTriggered())); - - Q_FOREACH (QAction *i, actions()) { - KAction *act = qobject_cast(i); - act->setGlobalShortcut(KShortcut()); - act->setShortcutConfigurable(true); - } -} diff --git a/kcontrol/touchpad/src/kded/kdedactions.h b/kcontrol/touchpad/src/kded/kdedactions.h deleted file mode 100644 index 200e4666..00000000 --- a/kcontrol/touchpad/src/kded/kdedactions.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef KDEDACTIONS_H -#define KDEDACTIONS_H - -#include - -class TouchpadGlobalActions : public KActionCollection -{ - Q_OBJECT -public: - explicit TouchpadGlobalActions(QObject *parent); - -Q_SIGNALS: - void enableTriggered(); - void disableTriggered(); - void toggleTriggered(); -}; - -#endif // KDEDACTIONS_H diff --git a/kcontrol/touchpad/src/kded/kdedsettings.kcfgc b/kcontrol/touchpad/src/kded/kdedsettings.kcfgc deleted file mode 100644 index c1737c65..00000000 --- a/kcontrol/touchpad/src/kded/kdedsettings.kcfgc +++ /dev/null @@ -1,5 +0,0 @@ -File=touchpaddaemon.kcfg -ClassName=TouchpadDisablerSettings -Mutators=true -MemberVariables=private -Inherits=KCoreConfigSkeleton diff --git a/kcontrol/touchpad/src/kded/touchpaddaemon.kcfg b/kcontrol/touchpad/src/kded/touchpaddaemon.kcfg deleted file mode 100644 index 477dfe8b..00000000 --- a/kcontrol/touchpad/src/kded/touchpaddaemon.kcfg +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - false - - - true - - - true - - - 0 - 10000 - 250 - - - TPPS/2 IBM TrackPoint,USB Trackpoint pointing device,DualPoint Stick,ThinkPad USB Keyboard with TrackPoint - - - diff --git a/kcontrol/touchpad/src/plugins.cpp b/kcontrol/touchpad/src/plugins.cpp deleted file mode 100644 index aabdff28..00000000 --- a/kcontrol/touchpad/src/plugins.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "plugins.h" - -#include -#include - -#include "kcm/touchpadconfig.h" -#include "kded/kded.h" -#include "version.h" - -namespace { - -KAboutData buildAboutData() -{ - KAboutData data("kcm_touchpad", - QByteArray(), - ki18n("Touchpad KCM"), - TOUCHPAD_KCM_VERSION, - ki18n("System Settings module, daemon and Plasma applet for managing your touchpad"), - KAboutData::License_GPL_V2, - ki18n("Copyright © 2013 Alexander Mezin"), - ki18n("This program incorporates work covered by this copyright notice:\n" - "Copyright © 2002-2005,2007 Peter Osterlund"), - "https://projects.kde.org/projects/playground/utils/kcm-touchpad/"); - - data.addAuthor(ki18n("Alexander Mezin"), - ki18n("Developer"), - "mezin.alexander@gmail.com"); - data.addCredit(ki18n("Thomas Pfeiffer"), ki18nc("Credits", "Usability, testing")); - data.addCredit(ki18n("Alex Fiestas"), ki18nc("Credits", "Helped a bit")); - data.addCredit(ki18n("Peter Osterlund"), ki18nc("Credits", "Developer of synclient")); - data.addCredit(ki18n("Vadim Zaytsev"), ki18nc("Credits", "Testing")); - data.addCredit(ki18n("Violetta Raspryagayeva"), ki18nc("Credits", "Testing")); - - return data; -} - -} - -K_PLUGIN_FACTORY_DEFINITION(TouchpadPluginFactory, - registerPlugin(); - registerPlugin("kcm");) -K_EXPORT_PLUGIN(TouchpadPluginFactory(buildAboutData())) diff --git a/kcontrol/touchpad/src/plugins.h b/kcontrol/touchpad/src/plugins.h deleted file mode 100644 index bc2f0f10..00000000 --- a/kcontrol/touchpad/src/plugins.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef PLUGINS_H -#define PLUGINS_H - -#include - -K_PLUGIN_FACTORY_DECLARATION(TouchpadPluginFactory) - -#endif // PLUGINS_H diff --git a/kcontrol/touchpad/src/touchpadbackend.cpp b/kcontrol/touchpad/src/touchpadbackend.cpp deleted file mode 100644 index 768a8906..00000000 --- a/kcontrol/touchpad/src/touchpadbackend.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "touchpadbackend.h" - -#include -#include - -#include "x11/xlibbackend.h" - -TouchpadBackend::TouchpadBackend(QObject *parent) : QObject(parent) -{ -} - -TouchpadBackend *TouchpadBackend::implementation() -{ - //There will be multiple backends later - static QThreadStorage > backend; - if (!backend.hasLocalData()) { - backend.setLocalData(QSharedPointer(new XlibBackend())); - } - return backend.localData().data(); -} diff --git a/kcontrol/touchpad/src/touchpadbackend.h b/kcontrol/touchpad/src/touchpadbackend.h deleted file mode 100644 index dad3f139..00000000 --- a/kcontrol/touchpad/src/touchpadbackend.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef TOUCHPADBACKEND_H -#define TOUCHPADBACKEND_H - -#include -#include - -#include - -class KDE_EXPORT TouchpadBackend : public QObject -{ - Q_OBJECT -public: - explicit TouchpadBackend(QObject *parent); - - static TouchpadBackend *implementation(); - - virtual bool applyConfig(const QVariantHash &) = 0; - virtual bool getConfig(QVariantHash &) = 0; - virtual const QStringList &supportedParameters() const = 0; - virtual const QString &errorString() const = 0; - - enum TouchpadOffState { - TouchpadEnabled, TouchpadTapAndScrollDisabled, TouchpadFullyDisabled - }; - virtual void setTouchpadOff(TouchpadOffState) = 0; - virtual TouchpadOffState getTouchpadOff() = 0; - - virtual bool isTouchpadEnabled() = 0; - virtual void setTouchpadEnabled(bool) = 0; - - virtual QStringList listMouses(const QStringList &blacklist) = 0; - - virtual void watchForEvents(bool keyboard) = 0; - -Q_SIGNALS: - void touchpadStateChanged(); - void mousesChanged(); - void touchpadReset(); - void keyboardActivityStarted(); - void keyboardActivityFinished(); -}; - -#endif // TOUCHPADBACKEND_H diff --git a/kcontrol/touchpad/src/version.h.cmake b/kcontrol/touchpad/src/version.h.cmake deleted file mode 100644 index 26244897..00000000 --- a/kcontrol/touchpad/src/version.h.cmake +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef VERSION_H -#define VERSION_H - -#define TOUCHPAD_KCM_VERSION "@TOUCHPAD_KCM_VERSION@" - -#endif // VERSION_H diff --git a/kcontrol/touchpad/src/x11/listdevices.cpp b/kcontrol/touchpad/src/x11/listdevices.cpp deleted file mode 100644 index ac664e51..00000000 --- a/kcontrol/touchpad/src/x11/listdevices.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * 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. - */ - -//Debug tool -//Must NOT be translated/localized - -#include - -#include -#include - -int main(void) -{ - Display *display = XOpenDisplay(0); - int nDevices = 0; - XDeviceInfo *devices = XListInputDevices(display, &nDevices); - for (int i = 0; i < nDevices; i++) { - const char *name = devices[i].name; - char *type = 0; - if (devices[i].type) { - type = XGetAtomName(display, devices[i].type); - } - const char *use; - switch (devices[i].use) { - case IsXPointer: use = "Pointer"; break; - case IsXKeyboard: use = "Keyboard"; break; - case IsXExtensionDevice: use = "Extension Device"; break; - case IsXExtensionPointer: use = "Extension Pointer"; break; - case IsXExtensionKeyboard: use = "Extension Keyboard"; break; - default: use = "Unknown"; - } - std::cout << "Name: " << name << " Type: " << (type ? type : "unknown") - << " Use: " << use << std::endl; - XFree(type); - } - XFreeDeviceList(devices); - XCloseDisplay(display); -} diff --git a/kcontrol/touchpad/src/x11/synclientproperties.c b/kcontrol/touchpad/src/x11/synclientproperties.c deleted file mode 100644 index 5fd1ed61..00000000 --- a/kcontrol/touchpad/src/x11/synclientproperties.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * 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. - */ - -/* -//krazy:excludeall=copyright - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright © 2002-2005,2007 Peter Osterlund - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of Red Hat - * not be used in advertising or publicity pertaining to distribution - * of the software without specific, written prior permission. Red - * Hat makes no representations about the suitability of this software - * for any purpose. It is provided "as is" without express or implied - * warranty. - * - * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Authors: - * Peter Osterlund (petero2@telia.com) - */ - -#include "synclientproperties.h" - -#include -#include -#include - -#define SYN_MAX_BUTTONS 12 - -const struct Parameter synapticsProperties[] = { - {"LeftEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_EDGES, 32, 0}, - {"RightEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_EDGES, 32, 1}, - {"TopEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_EDGES, 32, 2}, - {"BottomEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_EDGES, 32, 3}, - {"FingerLow", PT_INT, 0, 255, SYNAPTICS_PROP_FINGER, 32, 0}, - {"FingerHigh", PT_INT, 0, 255, SYNAPTICS_PROP_FINGER, 32, 1}, - {"MaxTapTime", PT_INT, 0, 1000, SYNAPTICS_PROP_TAP_TIME, 32, 0}, - {"MaxTapMove", PT_INT, 0, 2000, SYNAPTICS_PROP_TAP_MOVE, 32, 0}, - {"MaxDoubleTapTime", PT_INT, 0, 1000, SYNAPTICS_PROP_TAP_DURATIONS,32, 1}, - {"SingleTapTimeout", PT_INT, 0, 1000, SYNAPTICS_PROP_TAP_DURATIONS,32, 0}, - {"ClickTime", PT_INT, 0, 1000, SYNAPTICS_PROP_TAP_DURATIONS,32, 2}, - {"FastTaps", PT_BOOL, 0, 1, SYNAPTICS_PROP_TAP_FAST, 8, 0}, - {"EmulateMidButtonTime", PT_INT, 0, 1000, SYNAPTICS_PROP_MIDDLE_TIMEOUT,32, 0}, - {"EmulateTwoFingerMinZ", PT_INT, 0, 1000, SYNAPTICS_PROP_TWOFINGER_PRESSURE, 32, 0}, - {"EmulateTwoFingerMinW", PT_INT, 0, 15, SYNAPTICS_PROP_TWOFINGER_WIDTH, 32, 0}, - {"VertScrollDelta", PT_INT, -1000, 1000, SYNAPTICS_PROP_SCROLL_DISTANCE, 32, 0}, - {"HorizScrollDelta", PT_INT, -1000, 1000, SYNAPTICS_PROP_SCROLL_DISTANCE, 32, 1}, - {"VertEdgeScroll", PT_BOOL, 0, 1, SYNAPTICS_PROP_SCROLL_EDGE, 8, 0}, - {"HorizEdgeScroll", PT_BOOL, 0, 1, SYNAPTICS_PROP_SCROLL_EDGE, 8, 1}, - {"CornerCoasting", PT_BOOL, 0, 1, SYNAPTICS_PROP_SCROLL_EDGE, 8, 2}, - {"VertTwoFingerScroll", PT_BOOL, 0, 1, SYNAPTICS_PROP_SCROLL_TWOFINGER, 8, 0}, - {"HorizTwoFingerScroll", PT_BOOL, 0, 1, SYNAPTICS_PROP_SCROLL_TWOFINGER, 8, 1}, - {"MinSpeed", PT_DOUBLE, 0, 255.0, SYNAPTICS_PROP_SPEED, 0, /*float */ 0}, - {"MaxSpeed", PT_DOUBLE, 0, 255.0, SYNAPTICS_PROP_SPEED, 0, /*float */ 1}, - {"AccelFactor", PT_DOUBLE, 0, 1.0, SYNAPTICS_PROP_SPEED, 0, /*float */ 2}, - /*{"TouchpadOff", PT_INT, 0, 2, SYNAPTICS_PROP_OFF, 8, 0},*/ - {"LockedDrags", PT_BOOL, 0, 1, SYNAPTICS_PROP_LOCKED_DRAGS, 8, 0}, - {"LockedDragTimeout", PT_INT, 0, 30000, SYNAPTICS_PROP_LOCKED_DRAGS_TIMEOUT, 32, 0}, - {"RTCornerButton", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_TAP_ACTION, 8, 0}, - {"RBCornerButton", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_TAP_ACTION, 8, 1}, - {"LTCornerButton", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_TAP_ACTION, 8, 2}, - {"LBCornerButton", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_TAP_ACTION, 8, 3}, - {"OneFingerTapButton", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_TAP_ACTION, 8, 4}, - {"TwoFingerTapButton", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_TAP_ACTION, 8, 5}, - {"ThreeFingerTapButton", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_TAP_ACTION, 8, 6}, - {"ClickFinger1", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_CLICK_ACTION, 8, 0}, - {"ClickFinger2", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_CLICK_ACTION, 8, 1}, - {"ClickFinger3", PT_INT, 0, SYN_MAX_BUTTONS, SYNAPTICS_PROP_CLICK_ACTION, 8, 2}, - {"CircularScrolling", PT_BOOL, 0, 1, SYNAPTICS_PROP_CIRCULAR_SCROLLING, 8, 0}, - {"CircScrollDelta", PT_DOUBLE, .01, 3, SYNAPTICS_PROP_CIRCULAR_SCROLLING_DIST, 0 /* float */, 0}, - {"CircScrollTrigger", PT_INT, 0, 8, SYNAPTICS_PROP_CIRCULAR_SCROLLING_TRIGGER, 8, 0}, - {"PalmDetect", PT_BOOL, 0, 1, SYNAPTICS_PROP_PALM_DETECT, 8, 0}, - {"PalmMinWidth", PT_INT, 0, 15, SYNAPTICS_PROP_PALM_DIMENSIONS, 32, 0}, - {"PalmMinZ", PT_INT, 0, 255, SYNAPTICS_PROP_PALM_DIMENSIONS, 32, 1}, - {"CoastingSpeed", PT_DOUBLE, 0, 255, SYNAPTICS_PROP_COASTING_SPEED, 0 /* float*/, 0}, - {"CoastingFriction", PT_DOUBLE, 0, 255, SYNAPTICS_PROP_COASTING_SPEED, 0 /* float*/, 1}, - {"PressureMotionMinZ", PT_INT, 1, 255, SYNAPTICS_PROP_PRESSURE_MOTION, 32, 0}, - {"PressureMotionMaxZ", PT_INT, 1, 255, SYNAPTICS_PROP_PRESSURE_MOTION, 32, 1}, - {"PressureMotionMinFactor", PT_DOUBLE, 0, 10.0,SYNAPTICS_PROP_PRESSURE_MOTION_FACTOR, 0 /*float*/, 0}, - {"PressureMotionMaxFactor", PT_DOUBLE, 0, 10.0,SYNAPTICS_PROP_PRESSURE_MOTION_FACTOR, 0 /*float*/, 1}, - {"GrabEventDevice", PT_BOOL, 0, 1, SYNAPTICS_PROP_GRAB, 8, 0}, - {"TapAndDragGesture", PT_BOOL, 0, 1, SYNAPTICS_PROP_GESTURES, 8, 0}, - {"AreaLeftEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_AREA, 32, 0}, - {"AreaRightEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_AREA, 32, 1}, - {"AreaTopEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_AREA, 32, 2}, - {"AreaBottomEdge", PT_INT, 0, 10000, SYNAPTICS_PROP_AREA, 32, 3}, - {"HorizHysteresis", PT_INT, 0, 10000, SYNAPTICS_PROP_NOISE_CANCELLATION, 32, 0}, - {"VertHysteresis", PT_INT, 0, 10000, SYNAPTICS_PROP_NOISE_CANCELLATION, 32, 1}, - {"ClickPad", PT_BOOL, 0, 1, SYNAPTICS_PROP_CLICKPAD, 8, 0}, - {"RightButtonAreaLeft", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 0}, - {"RightButtonAreaRight", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 1}, - {"RightButtonAreaTop", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 2}, - {"RightButtonAreaBottom", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 3}, - {"MiddleButtonAreaLeft", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 4}, - {"MiddleButtonAreaRight", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 5}, - {"MiddleButtonAreaTop", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 6}, - {"MiddleButtonAreaBottom", PT_INT, INT_MIN, INT_MAX, SYNAPTICS_PROP_SOFTBUTTON_AREAS, 32, 7}, - { NULL, 0, 0, 0, 0, 0, 0 } -}; diff --git a/kcontrol/touchpad/src/x11/synclientproperties.h b/kcontrol/touchpad/src/x11/synclientproperties.h deleted file mode 100644 index 5b32b9fd..00000000 --- a/kcontrol/touchpad/src/x11/synclientproperties.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * 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. - */ - -/* -//krazy:excludeall=copyright - * This file incorporates work covered by the following copyright and - * permission notice: - * - * Copyright © 2002-2005,2007 Peter Osterlund - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of Red Hat - * not be used in advertising or publicity pertaining to distribution - * of the software without specific, written prior permission. Red - * Hat makes no representations about the suitability of this software - * for any purpose. It is provided "as is" without express or implied - * warranty. - * - * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Authors: - * Peter Osterlund (petero2@telia.com) - */ - -#ifndef SYNCLIENTPROPERTIES_H -#define SYNCLIENTPROPERTIES_H - -enum ParaType { - PT_INT, - PT_BOOL, - PT_DOUBLE -}; - -struct Parameter { - const char *name; /* Name of parameter */ - enum ParaType type; /* Type of parameter */ - double min_val; /* Minimum allowed value */ - double max_val; /* Maximum allowed value */ - const char *prop_name; /* Property name */ - int prop_format; /* Property format (0 for floats) */ - unsigned prop_offset; /* Offset inside property */ -}; - -extern const struct Parameter synapticsProperties[]; - -#endif diff --git a/kcontrol/touchpad/src/x11/x11.cmake b/kcontrol/touchpad/src/x11/x11.cmake deleted file mode 100644 index ae2b0bbc..00000000 --- a/kcontrol/touchpad/src/x11/x11.cmake +++ /dev/null @@ -1,48 +0,0 @@ -# // krazy:excludeall=copyright,license -find_package(X11 REQUIRED) -find_package(X11_XCB REQUIRED) -find_package(XCB REQUIRED) -find_package(PkgConfig REQUIRED) - -if(NOT X11_Xinput_FOUND) - message(FATAL_ERROR "Xinput not found") -endif() - -pkg_search_module(SYNAPTICS REQUIRED xorg-synaptics) -pkg_search_module(XORG REQUIRED xorg-server) - -include_directories(${XCB_INCLUDE_DIR} - ${X11_XCB_INCLUDE_DIR} - ${X11_Xinput_INCLUDE_PATH} - ${X11_X11_INCLUDE_PATH} - ${SYNAPTICS_INCLUDE_DIRS} - ${XORG_INCLUDE_DIRS} -) - -add_definitions(${X11_XCB_DEFINITIONS} ${XCB_DEFINITIONS}) - -SET(backend_SRCS - ${backend_SRCS} - ${CMAKE_CURRENT_SOURCE_DIR}/x11/synclientproperties.c - ${CMAKE_CURRENT_SOURCE_DIR}/x11/xcbatom.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/x11/xlibbackend.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/x11/xlibnotifications.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/x11/xrecordkeyboardmonitor.cpp -) - -SET(backend_LIBS - ${backend_LIBS} - ${XCB_LIBRARIES} - ${X11_X11_LIB} - ${X11_XCB_LIBRARIES} - ${X11_Xinput_LIB} -) - -add_executable(kcm-touchpad-list-devices ${CMAKE_CURRENT_SOURCE_DIR}/x11/listdevices.cpp) -target_link_libraries(kcm-touchpad-list-devices - ${X11_X11_LIB} - ${X11_Xinput_LIB} -) -install(TARGETS kcm-touchpad-list-devices - DESTINATION ${INSTALL_TARGETS_DEFAULT_ARGS} -) diff --git a/kcontrol/touchpad/src/x11/xcbatom.cpp b/kcontrol/touchpad/src/x11/xcbatom.cpp deleted file mode 100644 index 06f7f522..00000000 --- a/kcontrol/touchpad/src/x11/xcbatom.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "xcbatom.h" - -#include -#include - -XcbAtom::XcbAtom() : m_connection(0), m_reply(0), m_fetched(false) -{ -} - -XcbAtom::XcbAtom(xcb_connection_t *c, const char *name, bool onlyIfExists) - : m_reply(0), m_fetched(false) -{ - intern(c, name, onlyIfExists); -} - -void XcbAtom::intern(xcb_connection_t *c, const char *name, bool onlyIfExists) -{ - m_connection = c; - m_cookie = xcb_intern_atom(c, onlyIfExists, std::strlen(name), name); -} - -XcbAtom::~XcbAtom() -{ - std::free(m_reply); -} - -xcb_atom_t XcbAtom::atom() -{ - if (!m_fetched) { - m_fetched = true; - m_reply = xcb_intern_atom_reply(m_connection, m_cookie, 0); - } - if (m_reply) { - return m_reply->atom; - } else { - return 0; - } -} diff --git a/kcontrol/touchpad/src/x11/xcbatom.h b/kcontrol/touchpad/src/x11/xcbatom.h deleted file mode 100644 index 97905429..00000000 --- a/kcontrol/touchpad/src/x11/xcbatom.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef XCBATOM_H -#define XCBATOM_H - -#include - -class XcbAtom -{ -public: - XcbAtom(); - XcbAtom(xcb_connection_t *, const char *name, bool onlyIfExists = true); - ~XcbAtom(); - - void intern(xcb_connection_t *, const char *name, bool onlyIfExists = true); - xcb_atom_t atom(); - operator xcb_atom_t() { return atom(); } - -private: - XcbAtom(const XcbAtom &); - XcbAtom &operator =(const XcbAtom &); - - xcb_connection_t *m_connection; - xcb_intern_atom_cookie_t m_cookie; - xcb_intern_atom_reply_t *m_reply; - bool m_fetched; -}; - -#endif // XCBATOM_H diff --git a/kcontrol/touchpad/src/x11/xlibbackend.cpp b/kcontrol/touchpad/src/x11/xlibbackend.cpp deleted file mode 100644 index fa5b2625..00000000 --- a/kcontrol/touchpad/src/x11/xlibbackend.cpp +++ /dev/null @@ -1,705 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include -#include -#include - -#include -#include - -#include -#include - -//Includes are ordered this way because of #defines in Xorg's headers -#include "xrecordkeyboardmonitor.h" // krazy:exclude=includes -#include "xlibbackend.h" // krazy:exclude=includes -#include "xlibnotifications.h" // krazy:exclude=includes - -#include -#include -#include -#include - -#include -#include - -#include "synclientproperties.h" - -static void XDeleter(void *p) -{ - if (p) { - XFree(p); - } -} - -static void XIDeviceInfoDeleter(XIDeviceInfo *p) -{ - if (p) { - XIFreeDeviceInfo(p); - } -} - -void XlibBackend::XDisplayCleanup::cleanup(Display *p) -{ - if (p) { - XCloseDisplay(p); - } -} - -struct PropertyInfo -{ - Atom type; - int format; - QSharedPointer data; - unsigned long nitems; - - float *f; - int *i; - char *b; - - Display *display; - int device; - Atom prop; - - PropertyInfo() : - type(0), format(0), nitems(0), f(0), i(0), b(0), - display(0), device(0), prop(0) - { - } - - PropertyInfo(Display *display, int device, Atom prop, Atom floatType) - : type(0), format(0), nitems(0), f(0), i(0), b(0), - display(display), device(device), prop(prop) - { - unsigned char *dataPtr = 0; - unsigned long bytes_after; - XIGetProperty(display, device, prop, 0, 1000, False, - AnyPropertyType, &type, &format, &nitems, - &bytes_after, &dataPtr); - data = QSharedPointer(dataPtr, XDeleter); - - if (format == CHAR_BIT && type == XA_INTEGER) { - b = reinterpret_cast(dataPtr); - } - if (format == sizeof(int) * CHAR_BIT && - (type == XA_INTEGER || type == XA_CARDINAL)) - { - i = reinterpret_cast(dataPtr); - } - if (format == sizeof(float) * CHAR_BIT && - floatType && type == floatType) - { - f = reinterpret_cast(dataPtr); - } - } - - QVariant value(unsigned offset) const - { - QVariant v; - if (offset >= nitems) { - return v; - } - - if (b) { - v = QVariant(static_cast(b[offset])); - } - if (i) { - v = QVariant(i[offset]); - } - if (f) { - v = QVariant(f[offset]); - } - - return v; - } - - void set() - { - XIChangeProperty(display, device, prop, type, format, - XIPropModeReplace, data.data(), nitems); - } -}; - -XlibBackend::~XlibBackend() -{ -} - -XlibBackend::XlibBackend(QObject *parent) : - TouchpadBackend(parent), - m_display(XOpenDisplay(0)), m_connection(0), - m_resX(1), m_resY(1) -{ - if (m_display) { - m_connection = XGetXCBConnection(m_display.data()); - } - - if (!m_connection) { - m_errorString = i18n("Cannot connect to X server"); - return; - } - - m_floatType.intern(m_connection, "FLOAT"); - m_capsAtom.intern(m_connection, SYNAPTICS_PROP_CAPABILITIES); - m_enabledAtom.intern(m_connection, XI_PROP_ENABLED); - m_touchpadOffAtom.intern(m_connection, SYNAPTICS_PROP_OFF); - m_mouseAtom.intern(m_connection, XI_MOUSE); - m_keyboardAtom.intern(m_connection, XI_KEYBOARD); - XcbAtom resolutionAtom(m_connection, SYNAPTICS_PROP_RESOLUTION); - XcbAtom edgesAtom(m_connection, SYNAPTICS_PROP_EDGES); - - for (const Parameter *param = synapticsProperties; param->name; param++) { - QLatin1String name(param->prop_name); - - if (!m_atoms.contains(name)) { - m_atoms.insert(name, QSharedPointer( - new XcbAtom(m_connection, param->prop_name))); - } - } - - if (!m_capsAtom.atom()) { - m_errorString = - i18n("Synaptics driver is not installed (or is not used)"); - return; - } - - m_device = findTouchpad(); - if (m_device == XIAllDevices) { - m_errorString = i18n("No touchpad found"); - return; - } - - for (const Parameter *p = synapticsProperties; p->name; p++) { - if (getParameter(p).isValid()) { - m_supported.append(p->name); - } - } - - if (m_supported.isEmpty()) { - m_errorString = i18n("Cannot read any of touchpad's properties"); - return; - } - - m_toRadians.append("CircScrollDelta"); - - PropertyInfo edges(m_display.data(), m_device, edgesAtom, 0); - if (edges.i && edges.nitems == 4) { - int w = qAbs(edges.i[1] - edges.i[0]); - int h = qAbs(edges.i[3] - edges.i[2]); - m_resX = w / 90; - m_resY = h / 50; - kDebug() << "Width: " << w << " height: " << h; - kDebug() << "Approx. resX: " << m_resX << " resY: " << m_resY; - } - - PropertyInfo resolution(m_display.data(), m_device, resolutionAtom, 0); - if (resolution.i && resolution.nitems == 2 && - resolution.i[0] > 1 && resolution.i[1] > 1) - { - m_resY = qMin(static_cast(resolution.i[0]), - static_cast(INT_MAX)); - m_resX = qMin(static_cast(resolution.i[1]), - static_cast(INT_MAX)); - kDebug() << "Touchpad resolution: x: " << m_resX << " y: " << m_resY; - } - - m_scaleByResX.append("HorizScrollDelta"); - m_scaleByResY.append("VertScrollDelta"); - m_scaleByResX.append("MaxTapMove"); - m_scaleByResY.append("MaxTapMove"); - - m_resX = qMax(10, m_resX); - m_resY = qMax(10, m_resY); - kDebug() << "Final resolution x:" << m_resX << " y:" << m_resY; - m_negate["HorizScrollDelta"] = "InvertHorizScroll"; - m_negate["VertScrollDelta"] = "InvertVertScroll"; - m_supported.append(m_negate.values()); - m_supported.append("Coasting"); - - PropertyInfo caps(m_display.data(), m_device, m_capsAtom.atom(), 0); - if (!caps.b) { - m_errorString = i18n("Cannot read touchpad's capabilities"); - return; - } - - enum TouchpadCapabilitiy - { - TouchpadHasLeftButton, - TouchpadHasMiddleButton, - TouchpadHasRightButton, - TouchpadTwoFingerDetect, - TouchpadThreeFingerDetect, - TouchpadPressureDetect, - TouchpadPalmDetect, - TouchpadCapsCount - }; - - QVector cap(TouchpadCapsCount, false); - qCopy(caps.b, caps.b + qMin(cap.size(), static_cast(caps.nitems)), - cap.begin()); - - if (!cap[TouchpadTwoFingerDetect]) { - m_supported.removeAll("HorizTwoFingerScroll"); - m_supported.removeAll("VertTwoFingerScroll"); - m_supported.removeAll("TwoFingerTapButton"); - } - - if (!cap[TouchpadThreeFingerDetect]) { - m_supported.removeAll("ThreeFingerTapButton"); - } - - if (!cap[TouchpadPressureDetect]) { - m_supported.removeAll("FingerHigh"); - m_supported.removeAll("FingerLow"); - - m_supported.removeAll("PalmMinZ"); - m_supported.removeAll("PressureMotionMinZ"); - m_supported.removeAll("PressureMotionMinFactor"); - m_supported.removeAll("PressureMotionMaxZ"); - m_supported.removeAll("PressureMotionMaxFactor"); - m_supported.removeAll("EmulateTwoFingerMinZ"); - } - - if (!cap[TouchpadPalmDetect]) { - m_supported.removeAll("PalmDetect"); - m_supported.removeAll("PalmMinWidth"); - m_supported.removeAll("PalmMinZ"); - m_supported.removeAll("EmulateTwoFingerMinW"); - } - - for (QMap::Iterator i = m_negate.begin(); - i != m_negate.end(); ++i) - { - if (!m_supported.contains(i.key())) { - m_supported.removeAll(i.value()); - } - } -} - -int XlibBackend::findTouchpad() -{ - int nDevices = 0; - QSharedPointer deviceInfo( - XIQueryDevice(m_display.data(), XIAllDevices, &nDevices), - XIDeviceInfoDeleter); - - for (XIDeviceInfo *info = deviceInfo.data(); - info < deviceInfo.data() + nDevices; info++) - { - int nProperties = 0; - QSharedPointer properties( - XIListProperties(m_display.data(), info->deviceid, - &nProperties), XDeleter); - - if (std::count(properties.data(), properties.data() + nProperties, - m_capsAtom.atom())) - { - return info->deviceid; - } - } - - return XIAllDevices; -} - -static const Parameter *findParameter(const QString &name) -{ - for (const Parameter *par = synapticsProperties; par->name; par++) { - if (name == par->name) { - return par; - } - } - return 0; -} - -double XlibBackend::getPropertyScale(const QString &name) const -{ - if (m_scaleByResX.contains(name) && m_scaleByResY.contains(name)) { - return std::sqrt(static_cast(m_resX) * m_resX - + static_cast(m_resY) * m_resY); - } else if (m_scaleByResX.contains(name)) { - return m_resX; - } else if (m_scaleByResY.contains(name)) { - return m_resY; - } else if (m_toRadians.contains(name)) { - return M_PI_4 / 45.0; - } - return 1.0; -} - -static QVariant negateVariant(const QVariant &value) -{ - if (value.type() == QVariant::Double) { - return QVariant(-value.toDouble()); - } else if (value.type() == QVariant::Int) { - return QVariant(-value.toInt()); - } - return value; -} - -bool XlibBackend::applyConfig(const QVariantHash &p) -{ - if (m_supported.isEmpty()) { - return false; - } - - m_props.clear(); - - bool error = false; - Q_FOREACH(const QString &name, m_supported) { - QVariantHash::ConstIterator i = p.find(name); - if (i == p.end()) { - continue; - } - const Parameter *par = findParameter(name); - if (par) { - QVariant value(i.value()); - - double k = getPropertyScale(name); - if (k != 1.0) { - bool ok = false; - value = QVariant(value.toDouble(&ok) * k); - if (!ok) { - error = true; - continue; - } - } - - if (m_negate.contains(name)) { - QVariantHash::ConstIterator i = p.find(m_negate[name]); - if (i != p.end() && i.value().toBool()) { - value = negateVariant(value); - } - } - - if (name == "CoastingSpeed") { - QVariantHash::ConstIterator coastingEnabled = p.find("Coasting"); - if (coastingEnabled != p.end() && - !coastingEnabled.value().toBool()) - { - value = QVariant(0); - } - } - - if (!setParameter(par, value)) { - error = true; - } - } - } - - flush(); - - if (error) { - m_errorString = i18n("Cannot apply touchpad configuration"); - } - return !error; -} - -void XlibBackend::flush() -{ - Q_FOREACH(const QLatin1String &name, m_changed) { - m_props[name].set(); - } - m_changed.clear(); - - XFlush(m_display.data()); -} - -bool XlibBackend::getConfig(QVariantHash &p) -{ - if (m_supported.isEmpty()) { - return false; - } - - m_props.clear(); - - bool error = false; - Q_FOREACH(const QString &name, m_supported) { - const Parameter *par = findParameter(name); - if (!par) { - continue; - } - - QVariant value(getParameter(par)); - if (!value.isValid()) { - error = true; - continue; - } - - double k = getPropertyScale(name); - if (k != 1.0) { - bool ok = false; - value = QVariant(value.toDouble(&ok) / k); - if (!ok) { - error = true; - continue; - } - } - - if (m_negate.contains(name)) { - bool negative = value.toDouble() < 0.0; - p[m_negate[name]] = QVariant(negative); - if (negative) { - value = negateVariant(value); - } - } - - if (name == "CoastingSpeed") { - bool coasting = value.toDouble() != 0.0; - p["Coasting"] = QVariant(coasting); - if (!coasting) { - continue; - } - } - - p[name] = value; - } - - if (error) { - m_errorString = i18n("Cannot read touchpad configuration"); - } - return !error; -} - -QVariant XlibBackend::getParameter(const Parameter *par) -{ - PropertyInfo *p = getDevProperty(QLatin1String(par->prop_name)); - if (!p || par->prop_offset >= p->nitems) { - return QVariant(); - } - - return p->value(par->prop_offset); -} - -PropertyInfo *XlibBackend::getDevProperty(const QLatin1String &propName) -{ - if (m_props.contains(propName)) { - return &m_props[propName]; - } - - if (!m_atoms.contains(propName) || !m_atoms[propName]) { - return 0; - } - - xcb_atom_t prop = m_atoms[propName]->atom(); - if (!prop) { - return 0; - } - - PropertyInfo p(m_display.data(), m_device, prop, m_floatType.atom()); - if (!p.b && !p.f && !p.i) { - return 0; - } - return &m_props.insert(propName, p).value(); -} - -bool XlibBackend::setParameter(const Parameter *par, const QVariant &value) -{ - QLatin1String propName(par->prop_name); - PropertyInfo *p = getDevProperty(propName); - if (!p || par->prop_offset >= p->nitems) { - return false; - } - - QVariant converted(value); - QVariant::Type convType = QVariant::Int; - if (p->f) { - convType = QVariant::Double; - } else if (value.type() == QVariant::Double) { - converted = QVariant(qRound(static_cast(value.toDouble()))); - } - - if (!converted.convert(convType)) { - return false; - } - - if (converted == p->value(par->prop_offset)) { - return true; - } - - if (p->b) { - p->b[par->prop_offset] = static_cast(converted.toInt()); - } else if (p->i) { - p->i[par->prop_offset] = converted.toInt(); - } else if (p->f) { - p->f[par->prop_offset] = converted.toDouble(); - } - - m_changed.insert(propName); - return true; -} - -void XlibBackend::setTouchpadEnabled(bool enable) -{ - PropertyInfo enabled(m_display.data(), m_device, m_enabledAtom.atom(), 0); - if (enabled.b && *(enabled.b) != enable) { - *(enabled.b) = enable; - enabled.set(); - } - - flush(); -} - -void XlibBackend::setTouchpadOff(TouchpadBackend::TouchpadOffState state) -{ - int touchpadOff = 0; - switch (state) { - case TouchpadEnabled: - touchpadOff = 0; - break; - case TouchpadFullyDisabled: - touchpadOff = 1; - break; - case TouchpadTapAndScrollDisabled: - touchpadOff = 2; - break; - default: - kError() << "Unknown TouchpadOffState" << state; - return; - } - - PropertyInfo off(m_display.data(), m_device, m_touchpadOffAtom.atom(), 0); - if (off.b && *(off.b) != touchpadOff) { - *(off.b) = touchpadOff; - off.set(); - } - - flush(); -} - -bool XlibBackend::isTouchpadEnabled() -{ - PropertyInfo enabled(m_display.data(), m_device, m_enabledAtom.atom(), 0); - return enabled.value(0).toBool(); -} - -TouchpadBackend::TouchpadOffState XlibBackend::getTouchpadOff() -{ - PropertyInfo off(m_display.data(), m_device, m_touchpadOffAtom.atom(), 0); - switch (off.value(0).toInt()) { - case 0: - return TouchpadEnabled; - case 1: - return TouchpadFullyDisabled; - case 2: - return TouchpadTapAndScrollDisabled; - default: - kError() << "Unknown TouchpadOff value" << off.value(0).toInt(); - return TouchpadFullyDisabled; - } -} - -void XlibBackend::touchpadDetached() -{ - kWarning() << "Touchpad detached"; - m_device = XIAllDevices; -} - -void XlibBackend::devicePlugged(int device) -{ - if (m_device == XIAllDevices) { - m_device = findTouchpad(); - if (m_device != XIAllDevices) { - kWarning() << "Touchpad reset"; - m_notifications.reset(); - watchForEvents(m_keyboard); - Q_EMIT touchpadReset(); - } - } - if (device != m_device) { - Q_EMIT mousesChanged(); - } -} - -void XlibBackend::propertyChanged(xcb_atom_t prop) -{ - if (prop == m_touchpadOffAtom.atom() || - prop == m_enabledAtom.atom()) - { - Q_EMIT touchpadStateChanged(); - } -} - -struct DeviceListDeleter -{ - static void cleanup(XDeviceInfo *p) - { - if (p) { - XFreeDeviceList(p); - } - } -}; - -QStringList XlibBackend::listMouses(const QStringList &blacklist) -{ - int nDevices = 0; - QScopedPointer - info(XListInputDevices(m_display.data(), &nDevices)); - QStringList list; - for (XDeviceInfo *i = info.data(); i != info.data() + nDevices; i++) { - if (i->id == static_cast(m_device)) { - continue; - } - if (i->use != IsXExtensionPointer && i->use != IsXPointer) { - continue; - } - //type = KEYBOARD && use = Pointer means usb receiver for both keyboard - //and mouse - if (i->type != m_mouseAtom.atom() && i->type != m_keyboardAtom.atom()) { - continue; - } - QString name(i->name); - if (blacklist.contains(name, Qt::CaseInsensitive)) { - continue; - } - PropertyInfo enabled(m_display.data(), i->id, m_enabledAtom.atom(), 0); - if (enabled.value(0) == false) { - continue; - } - list.append(name); - } - - return list; -} - -void XlibBackend::watchForEvents(bool keyboard) -{ - if (!m_notifications) { - m_notifications.reset(new XlibNotifications(m_display.data(), m_device)); - connect(m_notifications.data(), SIGNAL(devicePlugged(int)), - SLOT(devicePlugged(int))); - connect(m_notifications.data(), SIGNAL(touchpadDetached()), - SLOT(touchpadDetached())); - connect(m_notifications.data(), SIGNAL(propertyChanged(xcb_atom_t)), - SLOT(propertyChanged(xcb_atom_t))); - } - - if (keyboard == !m_keyboard.isNull()) { - return; - } - - if (!keyboard) { - m_keyboard.reset(); - return; - } - - m_keyboard.reset(new XRecordKeyboardMonitor(m_display.data())); - connect(m_keyboard.data(), SIGNAL(keyboardActivityStarted()), - SIGNAL(keyboardActivityStarted())); - connect(m_keyboard.data(), SIGNAL(keyboardActivityFinished()), - SIGNAL(keyboardActivityFinished())); -} diff --git a/kcontrol/touchpad/src/x11/xlibbackend.h b/kcontrol/touchpad/src/x11/xlibbackend.h deleted file mode 100644 index 9d553b60..00000000 --- a/kcontrol/touchpad/src/x11/xlibbackend.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef XLIBBACKEND_H -#define XLIBBACKEND_H - -#include -#include -#include -#include -#include -#include -#include - -#include "touchpadbackend.h" - -#include - -#include "xcbatom.h" - -class XlibNotifications; -class XRecordKeyboardMonitor; - -class XlibBackend : public TouchpadBackend -{ - Q_OBJECT - -public: - explicit XlibBackend(QObject *parent = 0); - ~XlibBackend(); - - bool applyConfig(const QVariantHash &); - bool getConfig(QVariantHash &); - const QStringList &supportedParameters() const { return m_supported; } - const QString &errorString() const { return m_errorString; } - - void setTouchpadOff(TouchpadOffState); - TouchpadOffState getTouchpadOff(); - - void setTouchpadEnabled(bool); - bool isTouchpadEnabled(); - - void watchForEvents(bool keyboard); - - QStringList listMouses(const QStringList &blacklist); - -private slots: - void propertyChanged(xcb_atom_t); - void touchpadDetached(); - void devicePlugged(int); - -private: - struct PropertyInfo *getDevProperty(const QLatin1String &propName); - bool setParameter(const struct Parameter *, const QVariant &); - QVariant getParameter(const struct Parameter *); - void flush(); - double getPropertyScale(const QString &name) const; - - struct XDisplayCleanup { - static void cleanup(Display *); - }; - - QScopedPointer m_display; - xcb_connection_t *m_connection; - - XcbAtom m_floatType, m_capsAtom, m_enabledAtom, m_touchpadOffAtom, - m_mouseAtom, m_keyboardAtom; - - int findTouchpad(); - int m_device; - - QMap > m_atoms; - QMap m_props; - QSet m_changed; - QStringList m_supported; - QString m_errorString; - int m_resX, m_resY; - QStringList m_scaleByResX, m_scaleByResY, m_toRadians; - QMap m_negate; - QScopedPointer m_notifications; - QScopedPointer m_keyboard; -}; - -#endif // XLIBBACKEND_H diff --git a/kcontrol/touchpad/src/x11/xlibnotifications.cpp b/kcontrol/touchpad/src/x11/xlibnotifications.cpp deleted file mode 100644 index e9ebca7c..00000000 --- a/kcontrol/touchpad/src/x11/xlibnotifications.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "xlibnotifications.h" - -#include - -#include -#include -#include -#include -#include - -XlibNotifications::XlibNotifications(Display *display, int device) - : m_display(display), m_device(device) -{ - m_connection = XGetXCBConnection(display); - - m_notifier = new QSocketNotifier(xcb_get_file_descriptor(m_connection), - QSocketNotifier::Read, this); - - xcb_query_extension_cookie_t inputExtCookie = - xcb_query_extension(m_connection, std::strlen(INAME), INAME); - QScopedPointer - inputExt(xcb_query_extension_reply(m_connection, inputExtCookie, 0)); - if (!inputExt) { - return; - } - m_inputOpcode = inputExt->major_opcode; - - const xcb_setup_t *setup = xcb_get_setup(m_connection); - xcb_screen_iterator_t iter = xcb_setup_roots_iterator(setup); - xcb_screen_t *screen = iter.data; - - m_inputWindow = xcb_generate_id(m_connection); - xcb_create_window(m_connection, 0, m_inputWindow, screen->root, 0, 0, 1, 1, - 0, XCB_WINDOW_CLASS_INPUT_ONLY, 0, 0, 0); - xcb_flush(m_connection); - - XIEventMask masks[2]; - - unsigned char touchpadMask[] = { 0, 0, 0, 0 }; - masks[0].deviceid = device; - masks[0].mask = touchpadMask; - masks[0].mask_len = sizeof(touchpadMask); - XISetMask(touchpadMask, XI_PropertyEvent); - - unsigned char allMask[] = { 0, 0, 0, 0 }; - masks[1].deviceid = XIAllDevices; - masks[1].mask = allMask; - masks[1].mask_len = sizeof(allMask); - XISetMask(allMask, XI_HierarchyChanged); - - XISelectEvents(display, XDefaultRootWindow(display), masks, - sizeof(masks) / sizeof(XIEventMask)); - XFlush(display); - - connect(m_notifier, SIGNAL(activated(int)), SLOT(processEvents())); - m_notifier->setEnabled(true); -} - -void XlibNotifications::processEvents() -{ - while (XPending(m_display)) { - XEvent event; - XNextEvent(m_display, &event); - processEvent(&event); - } -} - -struct XEventDataDeleter -{ - XEventDataDeleter(Display *display, XGenericEventCookie *cookie) - : m_display(display), m_cookie(cookie) - { - XGetEventData(m_display, m_cookie); - } - - ~XEventDataDeleter() - { - if (m_cookie->data) { - XFreeEventData(m_display, m_cookie); - } - } - - Display *m_display; - XGenericEventCookie *m_cookie; -}; - -void XlibNotifications::processEvent(XEvent *event) -{ - if (event->xcookie.type != GenericEvent) { - return; - } - if (event->xcookie.extension != m_inputOpcode) { - return; - } - - if (event->xcookie.evtype == XI_PropertyEvent) { - XEventDataDeleter helper(m_display, &event->xcookie); - if (!event->xcookie.data) { - return; - } - - XIPropertyEvent *propEvent = - reinterpret_cast(event->xcookie.data); - Q_EMIT propertyChanged(propEvent->property); - } else if (event->xcookie.evtype == XI_HierarchyChanged) { - XEventDataDeleter helper(m_display, &event->xcookie); - if (!event->xcookie.data) { - return; - } - - XIHierarchyEvent *hierarchyEvent = - reinterpret_cast(event->xcookie.data); - for (uint16_t i = 0; i < hierarchyEvent->num_info; i++) { - if (hierarchyEvent->info[i].deviceid == m_device) { - if (hierarchyEvent->info[i].flags & XISlaveRemoved) { - Q_EMIT touchpadDetached(); - return; - } - } - if (hierarchyEvent->info[i].use != XISlavePointer) { - continue; - } - if (hierarchyEvent->info[i].flags & - (XIDeviceEnabled | XIDeviceDisabled)) - { - Q_EMIT devicePlugged(hierarchyEvent->info[i].deviceid); - } - } - } -} - -XlibNotifications::~XlibNotifications() -{ - xcb_destroy_window(m_connection, m_inputWindow); - xcb_flush(m_connection); -} - -#include "moc_xlibnotifications.cpp" diff --git a/kcontrol/touchpad/src/x11/xlibnotifications.h b/kcontrol/touchpad/src/x11/xlibnotifications.h deleted file mode 100644 index a989260f..00000000 --- a/kcontrol/touchpad/src/x11/xlibnotifications.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef XLIBNOTIFICATIONS_H -#define XLIBNOTIFICATIONS_H - -#include -#include -#include - -#include - -class XlibNotifications : public QObject -{ - Q_OBJECT -public: - XlibNotifications(Display *display, int device); - ~XlibNotifications(); - -Q_SIGNALS: - void propertyChanged(xcb_atom_t); - void devicePlugged(int); - void touchpadDetached(); - -private Q_SLOTS: - void processEvents(); - -private: - void processEvent(XEvent *); - - Display *m_display; - xcb_connection_t *m_connection; - QSocketNotifier *m_notifier; - xcb_window_t m_inputWindow; - uint8_t m_inputOpcode; - int m_device; -}; - -#endif // XLIBNOTIFICATIONS_H diff --git a/kcontrol/touchpad/src/x11/xrecordkeyboardmonitor.cpp b/kcontrol/touchpad/src/x11/xrecordkeyboardmonitor.cpp deleted file mode 100644 index 1dceee21..00000000 --- a/kcontrol/touchpad/src/x11/xrecordkeyboardmonitor.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "xrecordkeyboardmonitor.h" - -#include -#include - -#include - -#include -#include - -XRecordKeyboardMonitor::XRecordKeyboardMonitor(Display *display) - : m_connection(xcb_connect(XDisplayString(display), 0)), - m_modifiersPressed(0), m_keysPressed(0) -{ - if (!m_connection) { - return; - } - - xcb_get_modifier_mapping_cookie_t modmapCookie = - xcb_get_modifier_mapping(m_connection); - - m_context = xcb_generate_id(m_connection); - xcb_record_range_t range; - memset(&range, 0, sizeof(range)); - range.device_events.first = XCB_KEY_PRESS; - range.device_events.last = XCB_KEY_RELEASE; - xcb_record_client_spec_t cs = XCB_RECORD_CS_ALL_CLIENTS; - xcb_record_create_context(m_connection, m_context, 0, 1, 1, &cs, &range); - xcb_flush(m_connection); - - QScopedPointer - modmap(xcb_get_modifier_mapping_reply(m_connection, modmapCookie, 0)); - if (!modmap) { - return; - } - - int nModifiers = xcb_get_modifier_mapping_keycodes_length(modmap.data()); - xcb_keycode_t *modifiers = xcb_get_modifier_mapping_keycodes(modmap.data()); - m_modifier.fill(false, std::numeric_limits::max() + 1); - for (xcb_keycode_t *i = modifiers; i < modifiers + nModifiers; i++) { - m_modifier[*i] = true; - } - m_ignore.fill(false, std::numeric_limits::max() + 1); - for (xcb_keycode_t *i = modifiers; - i < modifiers + modmap->keycodes_per_modifier; i++) - { - m_ignore[*i] = true; - } - m_pressed.fill(false, std::numeric_limits::max() + 1); - - m_cookie = xcb_record_enable_context(m_connection, m_context); - xcb_flush(m_connection); - - m_notifier = new QSocketNotifier(xcb_get_file_descriptor(m_connection), - QSocketNotifier::Read, this); - connect(m_notifier, SIGNAL(activated(int)), SLOT(processNextReply())); - m_notifier->setEnabled(true); -} - -XRecordKeyboardMonitor::~XRecordKeyboardMonitor() -{ - if (!m_connection) { - return; - } - - xcb_record_disable_context(m_connection, m_context); - xcb_record_free_context(m_connection, m_context); - xcb_disconnect(m_connection); -} - -void XRecordKeyboardMonitor::processNextReply() -{ - xcb_generic_event_t *event; - while ((event = xcb_poll_for_event(m_connection))) { - std::free(event); - } - - void *reply = 0; - while (xcb_poll_for_reply(m_connection, m_cookie.sequence, &reply, 0)) { - if (!reply) { - continue; - } - - QScopedPointer - data(reinterpret_cast(reply)); - process(data.data()); - } -} - -void XRecordKeyboardMonitor::process(xcb_record_enable_context_reply_t *reply) -{ - bool prevActivity = activity(); - - xcb_key_press_event_t *events = reinterpret_cast - (xcb_record_enable_context_data(reply)); - int nEvents = xcb_record_enable_context_data_length(reply) / - sizeof(xcb_key_press_event_t); - bool wasActivity = prevActivity; - for (xcb_key_press_event_t *e = events; e < events + nEvents; e++) { - if (e->response_type != XCB_KEY_PRESS && - e->response_type != XCB_KEY_RELEASE) - { - continue; - } - - if (m_ignore[e->detail]) { - continue; - } - - bool pressed = (e->response_type == XCB_KEY_PRESS); - if (m_pressed[e->detail] == pressed) { - continue; - } - m_pressed[e->detail] = pressed; - - int &counter = m_modifier[e->detail] ? m_modifiersPressed : - m_keysPressed; - if (pressed) { - counter++; - } else { - counter--; - } - - wasActivity = wasActivity || activity(); - } - - if (!prevActivity && activity()) { - Q_EMIT keyboardActivityStarted(); - } else if (!activity() && wasActivity) { - Q_EMIT keyboardActivityFinished(); - } -} diff --git a/kcontrol/touchpad/src/x11/xrecordkeyboardmonitor.h b/kcontrol/touchpad/src/x11/xrecordkeyboardmonitor.h deleted file mode 100644 index 7632b587..00000000 --- a/kcontrol/touchpad/src/x11/xrecordkeyboardmonitor.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2013 Alexander Mezin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef XRECORDKEYBOARDMONITOR_H -#define XRECORDKEYBOARDMONITOR_H - -#include -#include -#include - -#include -#include - -class XRecordKeyboardMonitor : public QObject -{ - Q_OBJECT - -public: - XRecordKeyboardMonitor(Display *display); - ~XRecordKeyboardMonitor(); - -Q_SIGNALS: - void keyboardActivityStarted(); - void keyboardActivityFinished(); - -private Q_SLOTS: - void processNextReply(); - -private: - void process(xcb_record_enable_context_reply_t *reply); - bool activity() const { return m_keysPressed && !m_modifiersPressed; } - - QSocketNotifier *m_notifier; - xcb_connection_t *m_connection; - xcb_record_context_t m_context; - xcb_record_enable_context_cookie_t m_cookie; - - QVector m_modifier, m_ignore, m_pressed; - int m_modifiersPressed, m_keysPressed; -}; - -#endif // XRECORDKEYBOARDMONITOR_H