Commit 935d1f64 authored by Alf Gaida's avatar Alf Gaida

Cherry-picking new upstream version 0.13.0.

* Bumped build dependency liblxqt0-dev to >= 0.13.0~
parent a693524c
debian/*.debhelper
debian/*.log
debian/*.substvars
debian/debhelper-build-stamp
debian/files
debian/lxqt-globalkeys/
debian/liblxqt-globalkeys0/
debian/liblxqt-globalkeys0-dev/
debian/liblxqt-globalkeys-ui0/
debian/liblxqt-globalkeys-ui0-dev/
debian/tmp
Upstream Authors:
LXQt team: http://lxqt.org
LXQt team: https://lxqt.org
Razor team: http://razor-qt.org
Copyright:
......
lxqt-globalkeys-0.12.0 / 2017-10-21
lxqt-globalkeys-0.13.0 / 2018-05-21
===================================
* Update lxqt-config-globalkeyshortcuts_es.desktop
* Spanish translation update
* Add shortcut for lockscreen
* CMake: Prevent in-source builds
* fixed razor-qt -> lxqt and http -> https
* Fixed some LXDE mentions
* Update zh_CN translation
* Triggering shortcuts with meta keys
* Register meta keys for shortcuts
* Daemon triggers on KeyRelease
* free the storage returned by XGetKeyboardMapping
* Drop Qt foreach.
* Avoid polluting the the x11 shortcut map.
* Handle CMake CMP0024
* cmake: Handle CMP0071
* Fixes wrong radio buttons when changing shortcuts
0.12.0 / 2017-10-21
===================
* Release 0.12.0: Update changelog
* Set patch version
* Don't export github templates
* fix deadlock - don't accept keyPress when processing dbus call (#56)
......
......@@ -11,7 +11,7 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(LXQTBT_MINIMUM_VERSION "0.4.0")
set(LXQTBT_MINIMUM_VERSION "0.5.0")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
......@@ -31,6 +31,7 @@ set(LXQT_GLOBALKEYS_PATCH_VERSION 0)
set(LXQT_GLOBALKEYS_VERSION ${LXQT_MAJOR_VERSION}.${LXQT_MINOR_VERSION}.${LXQT_GLOBALKEYS_PATCH_VERSION})
add_definitions("-DLXQT_GLOBALKEYS_VERSION=\"${LXQT_GLOBALKEYS_VERSION}\"")
include(LXQtPreventInSourceBuilds)
include(LXQtTranslate)
include(LXQtCreatePkgConfigFile)
include(LXQtCreatePortableHeaders)
......@@ -39,6 +40,8 @@ include(LXQtCompilerSettings NO_POLICY_SCOPE)
include(GNUInstallDirs) # Standard directories for installation
include(CMakePackageConfigHelpers)
add_definitions(-DQT_NO_FOREACH)
set(LXQT_GLOBALKEYS_LIBRARY_NAME lxqt-globalkeys)
set(LXQT_GLOBALKEYS_UI_LIBRARY_NAME lxqt-globalkeys-ui)
set(LXQT_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_DATAROOTDIR}/cmake")
......
......@@ -2,36 +2,64 @@
## Overview
This repository is providing tools to set global keyboard shortcuts in LXQt sessions, that is shortcuts which apply to the LXQt session as a whole and are not limited to distinct applications.
This repository is providing tools to set global keyboard shortcuts in LXQt
sessions, that is shortcuts which apply to the LXQt session as a whole and are
not limited to distinct applications.
The core components are two binaries `lxqt-globalkeysd` and `lxqt-config-globalkeyshortcuts`.
`lxqt-globalkeysd` is running in a daemon-like manner as so-called [LXQt Module](https://github.com/lxde/lxqt-session#lxqt-modules) and doing the actual work. GUI `lxqt-config-globalkeyshortcuts` is used to customize the shortcut settings.
The core components are two binaries `lxqt-globalkeysd` and
`lxqt-config-globalkeyshortcuts`. `lxqt-globalkeysd` is running in a daemon-like
manner as so-called [LXQt Module](https://github.com/lxqt/lxqt-session#lxqt-modules)
and doing the actual work. GUI `lxqt-config-globalkeyshortcuts` is used to
customize the shortcut settings.
## Installation
### Compiling source code
The only runtime dependencies is [liblxqt](https://github.com/lxde/liblxqt).
Additional build dependencies are CMake and optionally Git to pull latest VCS checkouts. The localization files were outsourced to repository [lxqt-l10n](https://github.com/lxde/lxqt-l10n) so the corresponding dependencies are needed, too. Please refer to this repository's `README.md` for further information.
The only runtime dependencies is [liblxqt](https://github.com/lxqt/liblxqt).
Additional build dependencies are CMake and optionally Git to pull latest VCS
checkouts. The localization files were outsourced to repository
[lxqt-l10n](https://github.com/lxqt/lxqt-l10n) so the corresponding dependencies
are needed, too. Please refer to this repository's `README.md` for further
information.
Code configuration is handled by CMake. CMake variable `CMAKE_INSTALL_PREFIX` has to be set to `/usr` on most operating systems, depending on the way library paths are dealt with on 64bit systems variables like `CMAKE_INSTALL_LIBDIR` may have to be set as well.
Code configuration is handled by CMake. CMake variable `CMAKE_INSTALL_PREFIX`
has to be set to `/usr` on most operating systems, depending on the way library
paths are dealt with on 64bit systems variables like `CMAKE_INSTALL_LIBDIR` may
have to be set as well.
To build run `make`, to install `make install` which accepts variable `DESTDIR` as usual.
To build run `make`, to install `make install` which accepts variable `DESTDIR`
as usual.
### Binary packages
Official binary packages are provided by all major Linux distributions like Arch Linux, Debian (as of Debian stretch only), Fedora and openSUSE. Just use your package manager to search for string `lxqt-globalkeys`.
Official binary packages are provided by all major Linux distributions like Arch
Linux, Debian (as of Debian stretch only), Fedora and openSUSE. Just use your
package manager to search for string `lxqt-globalkeys`.
## Configuration, Usage
### Caveat lxqt-globalkeys vs. window managers
Window managers can assign shortcuts as well and their scope may overlap with the one of lxqt-globalkeys in LXQt sessions.
This was e. g. affecting elderly configuration files `rc.xml` of Openbox which were assigning `Ctrl+Alt+D` to toggling the display of the desktop which lxqt-globalkeys tries to do as well. This resulted in a warning message "Global shortcut C+A+d+ cannot be registered", see https://github.com/lxde/lxqt/issues/1032.
As depicted in this issue [lxqt-notificationd](https://github.com/lxde/lxqt-notificationd) will show a warning when conflicts like this come up and users can thus decide whether they want to have the shortcut in question handled by the respective window manager or lxqt-globalkeys.
Window managers can assign shortcuts as well and their scope may overlap with
the one of lxqt-globalkeys in LXQt sessions. This was e. g. affecting elderly
configuration files `rc.xml` of Openbox which were assigning `Ctrl+Alt+D` to
toggling the display of the desktop which lxqt-globalkeys tries to do as well.
This resulted in a warning message "Global shortcut C+A+d+ cannot be registered",
see https://github.com/lxqt/lxqt/issues/1032. As depicted in this issue
[lxqt-notificationd](https://github.com/lxqt/lxqt-notificationd) will show a
warning when conflicts like this come up and users can thus decide whether they
want to have the shortcut in question handled by the respective window manager
or lxqt-globalkeys.
### lxqt-globalkeys
Daemon-like `lxqt-globalkeysd` can be adjusted from section "Basic Settings" in configuration dialogue [LXQt Session Settings](https://github.com/lxde/lxqt-session#overview) of [lxqt-session](https://github.com/lxde/lxqt-session).
Daemon-like `lxqt-globalkeysd` can be adjusted from section "Basic Settings" in
configuration dialogue [LXQt Session Settings](https://github.com/lxqt/lxqt-session#overview)
of [lxqt-session](https://github.com/lxqt/lxqt-session).
Configuration dialogue "Global Actions Manager" (binary `lxqt-config-globalkeyshortcuts`) which is used to customize shortcuts can be opened from the panel's main menu - Preferences - LXQt Settings - Shortcut Keys and is provided by the [Configuration Center](https://github.com/lxde/lxqt-config#configuration-center) of [lxqt-config](https://github.com/lxde/lxqt-config) as well.
Configuration dialogue "Global Actions Manager" (binary `lxqt-config-globalkeyshortcuts`)
which is used to customize shortcuts can be opened from the panel's main menu -
Preferences - LXQt Settings - Shortcut Keys and is provided by the
[Configuration Center](https://github.com/lxqt/lxqt-config#configuration-center)
of [lxqt-config](https://github.com/lxqt/lxqt-config) as well.
# Translations
Name[es]=Atajos Globales del Teclado
Name[es]=Atajos globales de teclado
......@@ -129,6 +129,12 @@ foreach(DBUS_INTERFACE ${${PROJECT_NAME}_DBUS_INTERFACES})
qt5_add_dbus_interface(${PROJECT_NAME}_DBUS_INTERFACE_FILES "${CMAKE_CURRENT_BINARY_DIR}/${DBUS_INTERFACE_FILENAME}" ${DBUS_INTERFACE_BASENAME})
endforeach()
set_property(SOURCE
${${PROJECT_NAME}_DBUS_INTERFACE_FILES}
${${PROJECT_NAME}_DBUS_ADAPTOR_FILES}
PROPERTY SKIP_AUTOGEN ON
)
qt5_add_resources(${PROJECT_NAME}_RESOURCE_FILES ${${PROJECT_NAME}_RESOURCES})
set(${PROJECT_NAME}_GENERATED_FILES
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
......@@ -10,6 +10,10 @@
@PACKAGE_INIT@
if (CMAKE_VERSION VERSION_LESS 3.0.2)
message(FATAL_ERROR \"@PROJECT_NAME@ requires at least CMake version 3.0.2\")
endif()
include(CMakeFindDependencyMacro)
set(LXQT_GLOBALKEYS_MAJOR_VERSION @LXQT_MAJOR_VERSION@)
......@@ -20,7 +24,9 @@ set(LXQT_GLOBALKEYS_VERSION @LXQT_VERSION@)
find_dependency(Qt5Widgets)
find_dependency(Qt5DBus)
if (CMAKE_VERSION VERSION_GREATER 2.8.12)
cmake_policy(SET CMP0024 OLD)
if (NOT TARGET @LXQT_GLOBALKEYS_LIBRARY_NAME@)
if (POLICY CMP0024)
cmake_policy(SET CMP0024 NEW)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/@LXQT_GLOBALKEYS_LIBRARY_NAME@-targets.cmake")
endif()
include("${CMAKE_CURRENT_LIST_DIR}/lxqt-globalkeys-targets.cmake")
......@@ -10,6 +10,10 @@
@PACKAGE_INIT@
if (CMAKE_VERSION VERSION_LESS 3.0.2)
message(FATAL_ERROR \"@PROJECT_NAME@ requires at least CMake version 3.0.2\")
endif()
include(CMakeFindDependencyMacro)
set(LXQT_GLOBALKEYS_UI_MAJOR_VERSION @LXQT_MAJOR_VERSION@)
......@@ -19,9 +23,11 @@ set(LXQT_GLOBALKEYS_UI_VERSION @LXQT_VERSION@)
find_dependency(Qt5Widgets)
find_dependency(Qt5DBus)
find_dependency(lxqt-globalkeys)
find_dependency(@LXQT_GLOBALKEYS_LIBRARY_NAME@)
if (CMAKE_VERSION VERSION_GREATER 2.8.12)
cmake_policy(SET CMP0024 OLD)
if (NOT TARGET @LXQT_GLOBALKEYS_UI_LIBRARY_NAME@)
if (POLICY CMP0024)
cmake_policy(SET CMP0024 NEW)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/@LXQT_GLOBALKEYS_UI_LIBRARY_NAME@-targets.cmake")
endif()
include("${CMAKE_CURRENT_LIST_DIR}/lxqt-globalkeys-ui-targets.cmake")
......@@ -100,6 +100,12 @@ endforeach()
qt5_add_resources(${PROJECT_NAME}_RESOURCE_FILES ${${PROJECT_NAME}_RESOURCES})
set_property(SOURCE
${${PROJECT_NAME}_DBUS_INTERFACE_FILES}
${${PROJECT_NAME}_DBUS_ADAPTOR_FILES}
PROPERTY SKIP_AUTOGEN ON
)
# Translations **********************************
lxqt_translate_ts(${PROJECT_NAME}_QM_FILES
UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS}
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......@@ -206,7 +206,7 @@ void DefaultModel::daemonAppeared()
beginInsertRows(QModelIndex(), 0, allIds.size() - 1);
foreach(qulonglong id, allIds)
for(qulonglong id : qAsConst(allIds))
{
mContent[id] = mActions->actionById(id).second;
mShortcuts[mContent[id].shortcut].insert(id);
......@@ -233,7 +233,7 @@ void DefaultModel::actionAdded(qulonglong id)
endInsertRows();
keys = mContent.keys();
foreach(qulonglong siblingId, mShortcuts[mContent[id].shortcut])
for(qulonglong siblingId : qAsConst(mShortcuts[mContent[id].shortcut]))
{
if (id != siblingId)
{
......@@ -272,12 +272,12 @@ void DefaultModel::actionModified(qulonglong id)
{
mShortcuts[result.second.shortcut].insert(id);
mShortcuts[mContent[id].shortcut].remove(id);
foreach(qulonglong siblingId, mShortcuts[mContent[id].shortcut])
for(qulonglong siblingId : qAsConst(mShortcuts[mContent[id].shortcut]))
{
int siblingRow = qBinaryFind(keys, siblingId) - keys.constBegin();
emit dataChanged(index(siblingRow, 1), index(siblingRow, 1));
}
foreach(qulonglong siblingId, mShortcuts[result.second.shortcut])
for(qulonglong siblingId : qAsConst(mShortcuts[result.second.shortcut]))
{
int siblingRow = qBinaryFind(keys, siblingId) - keys.constBegin();
emit dataChanged(index(siblingRow, 1), index(siblingRow, 1));
......@@ -325,7 +325,7 @@ void DefaultModel::actionRemoved(qulonglong id)
endRemoveRows();
foreach(qulonglong siblingId, mShortcuts[shortcut])
for(qulonglong siblingId : qAsConst(mShortcuts[shortcut]))
{
int siblingRow = qBinaryFind(keys, siblingId) - keys.constBegin();
emit dataChanged(index(siblingRow, 1), index(siblingRow, 1));
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......@@ -197,6 +197,14 @@ bool EditActionDialog::load(qulonglong id)
else
{
command_PTE->clear();
// To disable all radio boxes, once one has been selected, we need to turn exclusivity off temporarily
command_RB->setAutoExclusive(false);
dbus_method_RB->setAutoExclusive(false);
command_RB->setChecked(false);
dbus_method_RB->setChecked(false);
command_RB->setAutoExclusive(true);
dbus_method_RB->setAutoExclusive(true);
}
description_LE->setEnabled(canEdit);
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......@@ -155,7 +155,8 @@ void MainWindow::on_swap_PB_clicked()
void MainWindow::on_remove_PB_clicked()
{
foreach(const QModelIndex &rowIndex, mSelectionModel->selectedRows())
const auto rows = mSelectionModel->selectedRows();
for(const QModelIndex &rowIndex : rows)
mActions->removeAction(mDefaultModel->id(mSortFilterProxyModel->mapToSource(rowIndex)));
}
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
# Translations
Name[es]=Configuración de Atajos de LXQt
Comment[es]=Configure atajos globales del Escritorio de LXQt
GenericName[es]=Configuración de Atajos Globales de LXQt
Name[es]=Atajos de teclado
GenericName[es]=Configuración de los atajos de teclado
Comment[es]=Configurar los atajos de teclado en LXQt
# Translations
Name[zh_CN]=LXQt 快捷键配置
Name[zh_CN]=键盘快捷键配置
Comment[zh_CN]=配置 LXQt 桌面全局快捷键
GenericName[zh_CN]=LXQt 全局快捷键配置
......@@ -140,6 +140,12 @@ set(${PROJECT_NAME}_ALL_FILES
${${PROJECT_NAME}_GENERATED_FILES}
)
set_property(SOURCE
${${PROJECT_NAME}_DBUS_INTERFACE_FILES}
${${PROJECT_NAME}_DBUS_ADAPTOR_FILES}
PROPERTY SKIP_AUTOGEN ON
)
add_executable(${PROJECT_NAME} ${${PROJECT_NAME}_ALL_FILES})
target_link_libraries(${PROJECT_NAME} ${X11_LIBRARIES} lxqt Qt5::Widgets Qt5::DBus)
lxqt_enable_target_exceptions(${PROJECT_NAME} PRIVATE)
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXDE-Qt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
* LXQt - a lightweight, Qt based, desktop toolset
* https://lxqt.org
*
* Copyright: 2013 Razor team
* Authors:
......@@ -532,7 +532,8 @@ Core::Core(bool useSyslog, bool minLogLevelSet, int minLogLevel, const QStringLi
mAllowGrabBaseKeypad = settings.value(/* General/ */QStringLiteral("AllowGrabBaseKeypad"), mAllowGrabBaseKeypad).toBool();
mAllowGrabMiscKeypad = settings.value(/* General/ */QStringLiteral("AllowGrabMiscKeypad"), mAllowGrabMiscKeypad).toBool();
foreach(const QString &section, settings.childGroups())
const auto sections = settings.childGroups();
for(const QString &section : sections)
{
if (section != QLatin1String("General"))
{
......@@ -1120,7 +1121,7 @@ void Core::run()
Window rootWindow = DefaultRootWindow(mDisplay);
XSelectInput(mDisplay, rootWindow, KeyPressMask);
XSelectInput(mDisplay, rootWindow, KeyPressMask | KeyReleaseMask);
mInterClientCommunicationWindow = XCreateSimpleWindow(mDisplay, rootWindow, 0, 0, 1, 1, 0, 0, 0);
......@@ -1140,10 +1141,14 @@ void Core::run()
allModifiers.insert(ignoreLocks);
}
const QString metaLeft = XKeysymToString(XK_Super_L);
const QString metaRight = XKeysymToString(XK_Super_R);
char signal = 0;
if (write(mX11ResponsePipe[STDOUT_FILENO], &signal, sizeof(signal)) == sizeof(signal))
{
bool keyReleaseExpected = false;
XEvent event;
while (mX11EventLoopActive)
{
......@@ -1153,7 +1158,15 @@ void Core::run()
break;
}
if (event.type == KeyPress && mDataMutex.tryLock(0))
if ((event.type == KeyRelease) && !keyReleaseExpected)
{
// pop event from the x11 queue and do nothing
XNextEvent(mDisplay, &event);
continue;
}
keyReleaseExpected = false; // Close time window for accepting meta keys.
if (((event.type == KeyPress) || (event.type == KeyRelease)) && mDataMutex.tryLock(0))
{
std::unique_lock<QMutex> unlocker(mDataMutex, std::adopt_lock);
......@@ -1201,7 +1214,29 @@ void Core::run()
}
else
{
if (isModifier(keySym) || !isAllowed(keySym, event.xkey.state & allShifts))
if (isModifier(keySym))
{
if (event.type == KeyPress)
{
ignoreKey = true;
keyReleaseExpected = true;
}
else
{
// Only the meta keys are allowed.
if ((event.xkey.state & allShifts) == MetaMask)
{
shortcut = XKeysymToString(keySym);
event.xkey.state &= ~allShifts; // Modifier keys must not use shift states.
}
else
{
ignoreKey = true;
}
}
}
else if ((event.type == KeyRelease) || !isAllowed(keySym, event.xkey.state & allShifts))