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

Unified Diff: ui/aura/shared/compound_event_filter.cc

Issue 10919135: Move ash specific cursor code to CursorManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 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/aura/root_window_host_win.cc ('k') | ui/aura/shared/compound_event_filter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/shared/compound_event_filter.cc
diff --git a/ui/aura/shared/compound_event_filter.cc b/ui/aura/shared/compound_event_filter.cc
index 6ddda9bd5dedc889042e06d5313b0352ad0b6367..7e14cf70f9233014688f8b5f7f34c7cf7a960be4 100644
--- a/ui/aura/shared/compound_event_filter.cc
+++ b/ui/aura/shared/compound_event_filter.cc
@@ -6,6 +6,7 @@
#include "ui/aura/client/activation_client.h"
#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"
@@ -86,9 +87,17 @@ size_t CompoundEventFilter::GetFilterCount() const {
// CompoundEventFilter, private:
void CompoundEventFilter::UpdateCursor(Window* target, ui::MouseEvent* event) {
- client::CursorClient* client =
- client::GetCursorClient(target->GetRootWindow());
- if (client) {
+ // 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();
+ client::DragDropClient* drag_drop_client =
+ client::GetDragDropClient(root_window);
+ if (drag_drop_client && drag_drop_client->IsDragDropInProgress())
+ return;
+
+ client::CursorClient* cursor_client =
+ client::GetCursorClient(root_window);
+ if (cursor_client) {
gfx::NativeCursor cursor = target->GetCursor(event->location());
if (event->flags() & ui::EF_IS_NON_CLIENT) {
int window_component =
@@ -96,7 +105,9 @@ void CompoundEventFilter::UpdateCursor(Window* target, ui::MouseEvent* event) {
cursor = CursorForWindowComponent(window_component);
}
- client->SetCursor(cursor);
+ cursor_client->SetCursor(cursor);
+ cursor_client->SetDeviceScaleFactor(
+ root_window->AsRootWindowHostDelegate()->GetDeviceScaleFactor());
}
}
@@ -181,7 +192,11 @@ ui::EventResult CompoundEventFilter::OnMouseEvent(ui::MouseEvent* event) {
// It should also update the cursor for clicking and wheels for ChromeOS boot.
// When ChromeOS is booted, it hides the mouse cursor but immediate mouse
// operation will show the cursor.
- if (event->type() == ui::ET_MOUSE_MOVED ||
+ // We also update the cursor for mouse enter in case a mouse cursor is sent to
+ // outside of the root window and moved back for some reasons (e.g. running on
+ // on Desktop for testing, or a bug in pointer barrier).
+ if (event->type() == ui::ET_MOUSE_ENTERED ||
+ event->type() == ui::ET_MOUSE_MOVED ||
event->type() == ui::ET_MOUSE_PRESSED ||
event->type() == ui::ET_MOUSEWHEEL) {
SetCursorVisibilityOnEvent(window, event, true);
« no previous file with comments | « ui/aura/root_window_host_win.cc ('k') | ui/aura/shared/compound_event_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698