Commit 43f06b32 authored by denniskempin's avatar denniskempin Committed by Commit bot

exo: Hide cursor for direct input

Exosphere renders its own cursor which does not get hidden by the
global logic to hide a cursor when using direct input mouse events.

This CL will make sure the cursor widget gets hidden or restored
depending whether direct input is used or not.

BUG=636458
TEST=use direct input in exo app. Cursor should be hidden.

Review-Url: https://codereview.chromium.org/2295513002
Cr-Commit-Position: refs/heads/master@{#415326}
parent 64fea5e2
...@@ -103,7 +103,7 @@ void Pointer::SetCursor(Surface* surface, const gfx::Point& hotspot) { ...@@ -103,7 +103,7 @@ void Pointer::SetCursor(Surface* surface, const gfx::Point& hotspot) {
surface_->window()->Show(); surface_->window()->Show();
// Show widget now that cursor has been defined. // Show widget now that cursor has been defined.
if (!widget_->IsVisible()) if (!widget_->IsVisible() && !is_direct_input_)
widget_->Show(); widget_->Show();
} }
...@@ -251,8 +251,11 @@ void Pointer::OnMouseEvent(ui::MouseEvent* event) { ...@@ -251,8 +251,11 @@ void Pointer::OnMouseEvent(ui::MouseEvent* event) {
break; break;
} }
if ((event->flags() & ui::EF_IS_SYNTHESIZED) == 0)
is_direct_input_ = (event->flags() & ui::EF_DIRECT_INPUT) != 0;
// Update cursor widget to reflect current focus and pointer location. // Update cursor widget to reflect current focus and pointer location.
if (focus_) { if (focus_ && !is_direct_input_) {
if (!widget_) if (!widget_)
CreatePointerWidget(); CreatePointerWidget();
...@@ -265,6 +268,8 @@ void Pointer::OnMouseEvent(ui::MouseEvent* event) { ...@@ -265,6 +268,8 @@ void Pointer::OnMouseEvent(ui::MouseEvent* event) {
} }
UpdateCursorScale(); UpdateCursorScale();
if (!widget_->IsVisible())
widget_->Show();
} else { } else {
if (widget_ && widget_->IsVisible()) if (widget_ && widget_->IsVisible())
widget_->Hide(); widget_->Hide();
......
...@@ -107,6 +107,9 @@ class Pointer : public ui::EventHandler, ...@@ -107,6 +107,9 @@ class Pointer : public ui::EventHandler,
// The current pointer force. // The current pointer force.
float force_; float force_;
// True if the pointer is controlled via direct input.
bool is_direct_input_ = false;
DISALLOW_COPY_AND_ASSIGN(Pointer); DISALLOW_COPY_AND_ASSIGN(Pointer);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment