| Index: ui/aura/desktop/desktop_root_window_event_filter.cc
|
| diff --git a/ui/aura/desktop/desktop_root_window_event_filter.cc b/ui/aura/desktop/desktop_root_window_event_filter.cc
|
| index a1d4bf641e614755d1b2446bd0d3d2bf34dacc78..74dcab48c08ecf875dd9b2e3eb1bfdf41d01e275 100644
|
| --- a/ui/aura/desktop/desktop_root_window_event_filter.cc
|
| +++ b/ui/aura/desktop/desktop_root_window_event_filter.cc
|
| @@ -10,6 +10,8 @@
|
| #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/base/hit_test.h"
|
| #include "ui/base/ime/input_method.h"
|
| #include "ui/base/ime/input_method_factory.h"
|
|
|
| @@ -23,6 +25,30 @@ aura::Window* FindFocusableWindowFor(aura::Window* window) {
|
| return window;
|
| }
|
|
|
| +// static
|
| +gfx::NativeCursor CursorForWindowComponent(int window_component) {
|
| + switch (window_component) {
|
| + case HTBOTTOM:
|
| + return ui::kCursorSouthResize;
|
| + case HTBOTTOMLEFT:
|
| + return ui::kCursorSouthWestResize;
|
| + case HTBOTTOMRIGHT:
|
| + return ui::kCursorSouthEastResize;
|
| + case HTLEFT:
|
| + return ui::kCursorWestResize;
|
| + case HTRIGHT:
|
| + return ui::kCursorEastResize;
|
| + case HTTOP:
|
| + return ui::kCursorNorthResize;
|
| + case HTTOPLEFT:
|
| + return ui::kCursorNorthWestResize;
|
| + case HTTOPRIGHT:
|
| + return ui::kCursorNorthEastResize;
|
| + default:
|
| + return ui::kCursorNull;
|
| + }
|
| +}
|
| +
|
| } // namespace
|
|
|
| DesktopRootWindowEventFilter::DesktopRootWindowEventFilter(
|
| @@ -59,11 +85,34 @@ bool DesktopRootWindowEventFilter::PreHandleKeyEvent(Window* target,
|
| bool DesktopRootWindowEventFilter::PreHandleMouseEvent(
|
| Window* target,
|
| MouseEvent* event) {
|
| + // TODO(erg): It would be nice to merge as much as possible with
|
| + // ash::RootWindowEventFilter. I'm starting to get at the point where I feel
|
| + // like I'm copypasting the entire file.
|
| + if (event->type() == ui::ET_MOUSE_MOVED ||
|
| + event->type() == ui::ET_MOUSE_PRESSED ||
|
| + event->type() == ui::ET_MOUSEWHEEL) {
|
| + gfx::NativeCursor cursor = target->GetCursor(event->location());
|
| + if (event->flags() & ui::EF_IS_NON_CLIENT) {
|
| + int window_component =
|
| + target->delegate()->GetNonClientComponent(event->location());
|
| + cursor = CursorForWindowComponent(window_component);
|
| + }
|
| +
|
| + root_window_->SetCursor(cursor);
|
| + }
|
| +
|
| if (event->type() == ui::ET_MOUSE_PRESSED) {
|
| // Get the active window?
|
| Window* active = aura::client::GetActivationClient(
|
| root_window_)->GetActiveWindow();
|
|
|
| + int component =
|
| + target->delegate()->GetNonClientComponent(event->location());
|
| + if (component != HTCLIENT &&
|
| + root_window_->DispatchHostWindowDragMovement(component, event)) {
|
| + return true;
|
| + }
|
| +
|
| if (active != target) {
|
| target->GetFocusManager()->SetFocusedWindow(
|
| FindFocusableWindowFor(target), event);
|
|
|