Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: ui/events/x/device_data_manager_x11.cc

Issue 313913004: Block internal PlatformEvents before they are dispatched in touchview. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix updating cursor on enter notify. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/x/device_data_manager_x11.h ('k') | ui/events/x/events_x.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/x/device_data_manager_x11.cc
diff --git a/ui/events/x/device_data_manager_x11.cc b/ui/events/x/device_data_manager_x11.cc
index d78d423991d1e2778d817943b0575df978620b57..3f61ce9c503c6a050a63d8363416cb11bc0eda71 100644
--- a/ui/events/x/device_data_manager_x11.cc
+++ b/ui/events/x/device_data_manager_x11.cc
@@ -13,6 +13,7 @@
#include "base/sys_info.h"
#include "ui/events/event_constants.h"
#include "ui/events/event_switches.h"
+#include "ui/events/event_utils.h"
#include "ui/events/x/device_list_cache_x.h"
#include "ui/events/x/touch_factory_x11.h"
#include "ui/gfx/display.h"
@@ -124,6 +125,7 @@ DeviceDataManagerX11* DeviceDataManagerX11::GetInstance() {
DeviceDataManagerX11::DeviceDataManagerX11()
: xi_opcode_(-1),
+ blocked_keyboard_(false),
atom_cache_(gfx::GetXDisplay(), kCachedAtoms),
button_map_count_(0) {
CHECK(gfx::GetXDisplay());
@@ -667,4 +669,44 @@ bool DeviceDataManagerX11::TouchEventNeedsCalibrate(int touch_device_id) const {
return false;
}
+void DeviceDataManagerX11::DisableKeyboard(
+ scoped_ptr<std::set<KeyboardCode> > excepted_keys) {
+ DCHECK(!blocked_keyboard_);
+ DCHECK(!blocked_keyboard_allowed_keys_.get());
+ blocked_keyboard_ = true;
+ blocked_keyboard_allowed_keys_ = excepted_keys.Pass();
+}
+
+void DeviceDataManagerX11::EnableKeyboard() {
+ DCHECK(blocked_keyboard_);
+ blocked_keyboard_ = false;
+ blocked_keyboard_allowed_keys_.reset();
+}
+
+void DeviceDataManagerX11::DisableDevice(unsigned int deviceid) {
+ blocked_devices_.set(deviceid, true);
+}
+
+void DeviceDataManagerX11::EnableDevice(unsigned int deviceid) {
+ blocked_devices_.set(deviceid, false);
+}
+
+bool DeviceDataManagerX11::IsEventBlocked(
+ const base::NativeEvent& native_event) {
+ switch (native_event->type) {
+ case KeyPress:
+ case KeyRelease:
+ return blocked_keyboard_ && (!blocked_keyboard_allowed_keys_ ||
+ blocked_keyboard_allowed_keys_->find(
+ KeyboardCodeFromNative(native_event)) ==
+ blocked_keyboard_allowed_keys_->end());
+ case GenericEvent:
+ return blocked_devices_.test(
+ static_cast<XIDeviceEvent*>(native_event->xcookie.data)->sourceid);
+ default:
+ break;
+ }
+ return false;
+}
+
} // namespace ui
« no previous file with comments | « ui/events/x/device_data_manager_x11.h ('k') | ui/events/x/events_x.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698