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

Unified Diff: ui/aura/desktop/desktop_root_window_event_filter.cc

Issue 10381063: Aura/ash split: Don't use X11 window borders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Now with windows/mac implementations Created 8 years, 7 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 | « no previous file | ui/aura/event.cc » ('j') | ui/aura/event.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..ee70c09bf6033a5d6bf8459c8e3be7cf957f917b 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.
Elliot Glaysher 2012/05/09 19:39:18 I think this is the next thing I'm going to do. Se
+ 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_->DispatchWindowDragMovement(component, event)) {
+ return true;
+ }
+
if (active != target) {
target->GetFocusManager()->SetFocusedWindow(
FindFocusableWindowFor(target), event);
« no previous file with comments | « no previous file | ui/aura/event.cc » ('j') | ui/aura/event.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698