=== modified file 'com.canonical.Unity.gschema.xml'
--- com.canonical.Unity.gschema.xml 2016-03-18 01:47:08 +0000
+++ com.canonical.Unity.gschema.xml 2016-05-30 18:06:05 +0000
@@ -81,6 +81,18 @@
integrated menus are enabled), otherwise they will be shown only when
the mouse cursor is over the relative mouse area.
+
+ [
+ 'XF86KbdBrightnessUp',
+ 'XF86KbdBrightnessDown',
+ 'XF86MonBrightnessUp',
+ 'XF86MonBrightnessDown',
+ 'XF86AudioRaiseVolume',
+ 'XF86AudioLowerVolume'
+ ]
+ List of keycodes that should be processed even if auto-repated.
+ These keycodes are processed even if they are auto-repeated.
+
=== modified file 'unity-shared/GnomeKeyGrabber.cpp'
--- unity-shared/GnomeKeyGrabber.cpp 2016-04-26 09:53:16 +0000
+++ unity-shared/GnomeKeyGrabber.cpp 2016-05-30 18:06:05 +0000
@@ -59,6 +59,12 @@
)";
}
+namespace
+{
+const std::string SETTINGS_NAME = "com.canonical.Unity";
+const std::string WHITELIST_KEY = "whitelist-repeated-keys";
+}
+
namespace testing
{
std::string const DBUS_NAME = "com.canonical.Unity.Test.GnomeKeyGrabber";
@@ -67,11 +73,18 @@
GnomeGrabber::Impl::Impl(bool test_mode)
: screen_(screen)
, shell_server_(test_mode ? testing::DBUS_NAME : shell::DBUS_NAME)
+ , settings_(g_settings_new(SETTINGS_NAME.c_str()))
, current_action_id_(0)
{
shell_server_.AddObjects(shell::INTROSPECTION_XML, shell::DBUS_OBJECT_PATH);
shell_object_ = shell_server_.GetObject(shell::DBUS_INTERFACE);
shell_object_->SetMethodsCallsHandlerFull(sigc::mem_fun(this, &Impl::OnShellMethodCall));
+
+ whitelist_changed_signal_.Connect(settings_, "changed::" + WHITELIST_KEY, [this] (GSettings*, gchar*) {
+ UpdateWhitelist();
+ });
+
+ UpdateWhitelist();
}
GnomeGrabber::Impl::~Impl()
@@ -232,7 +245,8 @@
{
action.setState(CompAction::StateInitKey);
action.setInitiate([this, action_id](CompAction* action, CompAction::State state, CompOption::Vector& options) {
- if (!CompOption::getBoolOptionNamed(options, "is_repeated"))
+ bool is_whitelisted = std::find(whitelist_.begin(), whitelist_.end(), action->keyToString()) != whitelist_.end();
+ if (is_whitelisted || !CompOption::getBoolOptionNamed(options, "is_repeated"))
{
LOG_DEBUG(logger) << "pressed \"" << action->keyToString() << "\"";
ActivateDBusAction(*action, action_id, 0, CompOption::getIntOptionNamed(options, "time"));
@@ -326,6 +340,16 @@
return keycode == 0 || modHandler->keycodeToModifiers(keycode) != 0;
}
+void GnomeGrabber::Impl::UpdateWhitelist()
+{
+ std::shared_ptr whitelist(g_settings_get_strv(settings_, WHITELIST_KEY.c_str()), g_strfreev);
+ auto whitelist_raw = whitelist.get();
+
+ whitelist_.clear();
+ for (int i = 0; whitelist_raw[i]; ++i)
+ whitelist_.push_back(whitelist_raw[i]);
+}
+
// Public implementation
GnomeGrabber::GnomeGrabber()
=== modified file 'unity-shared/GnomeKeyGrabberImpl.h'
--- unity-shared/GnomeKeyGrabberImpl.h 2015-12-13 10:35:58 +0000
+++ unity-shared/GnomeKeyGrabberImpl.h 2016-05-30 18:06:05 +0000
@@ -28,6 +28,7 @@
#include
#include
#include
+#include
namespace unity
{
@@ -55,11 +56,17 @@
bool IsActionPostponed(CompAction const& action) const;
+ void UpdateWhitelist();
+
CompScreen* screen_;
glib::DBusServer shell_server_;
glib::DBusObject::Ptr shell_object_;
+ glib::Object settings_;
+ glib::Signal whitelist_changed_signal_;
+ std::list whitelist_;
+
uint32_t current_action_id_;
std::vector actions_ids_;
std::vector actions_customers_;