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

Unified Diff: ui/views/corewm/compound_event_filter.cc

Issue 11888003: Differentiate invisible cursor mode and disabled mouse events mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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/views/corewm/compound_event_filter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/corewm/compound_event_filter.cc
diff --git a/ui/views/corewm/compound_event_filter.cc b/ui/views/corewm/compound_event_filter.cc
index de3e4aa7341daeeed57984af5a4aa3493c978fad..54350bfecdc154b0633878767effa01934bccf02 100644
--- a/ui/views/corewm/compound_event_filter.cc
+++ b/ui/views/corewm/compound_event_filter.cc
@@ -169,22 +169,38 @@ void CompoundEventFilter::FilterTouchEvent(ui::TouchEvent* event) {
void CompoundEventFilter::SetCursorVisibilityOnEvent(aura::Window* target,
ui::Event* event,
bool show) {
- if (!(event->flags() & ui::EF_IS_SYNTHESIZED)) {
- aura::client::CursorClient* client =
- aura::client::GetCursorClient(target->GetRootWindow());
- if (client) {
- if (show && cursor_hidden_by_filter_) {
- cursor_hidden_by_filter_ = false;
- client->EnableMouseEvents();
- } else if (client->IsCursorVisible() && !show &&
- !cursor_hidden_by_filter_) {
- cursor_hidden_by_filter_ = true;
- client->DisableMouseEvents();
- }
- }
+ if (event->flags() & ui::EF_IS_SYNTHESIZED)
+ return;
+ aura::client::CursorClient* client =
+ aura::client::GetCursorClient(target->GetRootWindow());
+ if (!client)
+ return;
+
+ if (show && cursor_hidden_by_filter_) {
+ cursor_hidden_by_filter_ = false;
+ client->ShowCursor();
+ } else if (!show && !cursor_hidden_by_filter_) {
+ cursor_hidden_by_filter_ = true;
+ client->HideCursor();
}
}
+void CompoundEventFilter::SetMouseEventsEnableStateOnEvent(aura::Window* target,
+ ui::Event* event,
+ bool enable) {
+ if (event->flags() & ui::EF_IS_SYNTHESIZED)
+ return;
+ aura::client::CursorClient* client =
+ aura::client::GetCursorClient(target->GetRootWindow());
+ if (!client)
+ return;
+
+ if (enable)
+ client->EnableMouseEvents();
+ else
+ client->DisableMouseEvents();
+}
+
////////////////////////////////////////////////////////////////////////////////
// CompoundEventFilter, ui::EventHandler implementation:
@@ -214,6 +230,7 @@ void CompoundEventFilter::OnMouseEvent(ui::MouseEvent* event) {
event->type() == ui::ET_MOUSE_MOVED ||
event->type() == ui::ET_MOUSE_PRESSED ||
event->type() == ui::ET_MOUSEWHEEL) {
+ SetMouseEventsEnableStateOnEvent(window, event, true);
SetCursorVisibilityOnEvent(window, event, true);
UpdateCursor(window, event);
}
@@ -227,7 +244,7 @@ void CompoundEventFilter::OnScrollEvent(ui::ScrollEvent* event) {
void CompoundEventFilter::OnTouchEvent(ui::TouchEvent* event) {
FilterTouchEvent(event);
if (!event->handled() && event->type() == ui::ET_TOUCH_PRESSED) {
- SetCursorVisibilityOnEvent(
+ SetMouseEventsEnableStateOnEvent(
static_cast<aura::Window*>(event->target()), event, false);
}
}
« no previous file with comments | « ui/views/corewm/compound_event_filter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698