summaryrefslogtreecommitdiffstats
path: root/chromium/ui/views/corewm/compound_event_filter.cc
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@digia.com>2014-03-18 13:16:26 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-03-20 15:55:39 +0100
commit3f0f86b0caed75241fa71c95a5d73bc0164348c5 (patch)
tree92b9fb00f2e9e90b0be2262093876d4f43b6cd13 /chromium/ui/views/corewm/compound_event_filter.cc
parente90d7c4b152c56919d963987e2503f9909a666d2 (diff)
Update to new stable branch 1750
This also includes an updated ninja and chromium dependencies needed on Windows. Change-Id: Icd597d80ed3fa4425933c9f1334c3c2e31291c42 Reviewed-by: Zoltan Arvai <zarvai@inf.u-szeged.hu> Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'chromium/ui/views/corewm/compound_event_filter.cc')
-rw-r--r--chromium/ui/views/corewm/compound_event_filter.cc40
1 files changed, 24 insertions, 16 deletions
diff --git a/chromium/ui/views/corewm/compound_event_filter.cc b/chromium/ui/views/corewm/compound_event_filter.cc
index 1d4387b162e..efeca5cad2a 100644
--- a/chromium/ui/views/corewm/compound_event_filter.cc
+++ b/chromium/ui/views/corewm/compound_event_filter.cc
@@ -10,8 +10,8 @@
#include "ui/aura/client/cursor_client.h"
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/env.h"
-#include "ui/aura/focus_manager.h"
#include "ui/aura/root_window.h"
+#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
#include "ui/aura/window_tracker.h"
#include "ui/base/hit_test.h"
@@ -23,6 +23,7 @@ namespace corewm {
namespace {
bool ShouldHideCursorOnKeyEvent(const ui::KeyEvent& event) {
+#if defined(OS_CHROMEOS)
// All alt and control key commands are ignored.
if (event.IsAltDown() || event.IsControlDown())
return false;
@@ -64,6 +65,21 @@ bool ShouldHideCursorOnKeyEvent(const ui::KeyEvent& event) {
return false;
return true;
+#else // !defined(OS_CHROMEOS)
+ return false;
+#endif // defined(OS_CHROMEOS)
+}
+
+// Returns true if the cursor should be hidden on touch events.
+bool ShouldHideCursorOnTouch() {
+#if defined(OS_CHROMEOS)
+ return true;
+#else
+ // Not necessary on windows as windows does it for us. If we do need this
+ // funcionality on linux (non-chromeos) we need to make sure
+ // CompoundEventFilter shows on the right root (it currently doesn't always).
+ return false;
+#endif
}
} // namespace
@@ -71,7 +87,7 @@ bool ShouldHideCursorOnKeyEvent(const ui::KeyEvent& event) {
////////////////////////////////////////////////////////////////////////////////
// CompoundEventFilter, public:
-CompoundEventFilter::CompoundEventFilter() : cursor_hidden_by_filter_(false) {
+CompoundEventFilter::CompoundEventFilter() {
}
CompoundEventFilter::~CompoundEventFilter() {
@@ -120,7 +136,7 @@ void CompoundEventFilter::UpdateCursor(aura::Window* target,
ui::MouseEvent* event) {
// If drag and drop is in progress, let the drag drop client set the cursor
// instead of setting the cursor here.
- aura::RootWindow* root_window = target->GetRootWindow();
+ aura::Window* root_window = target->GetRootWindow();
aura::client::DragDropClient* drag_drop_client =
aura::client::GetDragDropClient(root_window);
if (drag_drop_client && drag_drop_client->IsDragDropInProgress())
@@ -178,19 +194,10 @@ void CompoundEventFilter::SetCursorVisibilityOnEvent(aura::Window* target,
if (!client)
return;
- if (show && cursor_hidden_by_filter_) {
- cursor_hidden_by_filter_ = false;
+ if (show)
client->ShowCursor();
- } else if (!show && !cursor_hidden_by_filter_) {
- cursor_hidden_by_filter_ = true;
+ else
client->HideCursor();
- } else if (show && !client->IsCursorVisible() && !client->IsCursorLocked()) {
- // TODO(tdanderson): Remove this temporary logging once the issues related
- // to a disappearing mouse cursor on the Pixel login screen / Pixel
- // wakeup have been resolved. See crbug.com/275826.
- LOG(ERROR) << "Event of type " << event->type() << " did not show cursor."
- << " Mouse enabled state is " << client->IsMouseEventsEnabled();
- }
}
void CompoundEventFilter::SetMouseEventsEnableStateOnEvent(aura::Window* target,
@@ -251,8 +258,9 @@ void CompoundEventFilter::OnScrollEvent(ui::ScrollEvent* event) {
void CompoundEventFilter::OnTouchEvent(ui::TouchEvent* event) {
FilterTouchEvent(event);
- if (!event->handled() && event->type() == ui::ET_TOUCH_PRESSED &&
- !aura::Env::GetInstance()->is_mouse_button_down()) {
+ if (ShouldHideCursorOnTouch() && !event->handled() &&
+ event->type() == ui::ET_TOUCH_PRESSED &&
+ !aura::Env::GetInstance()->IsMouseButtonDown()) {
SetMouseEventsEnableStateOnEvent(
static_cast<aura::Window*>(event->target()), event, false);
}