OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/aura/desktop.h" | 5 #include "ui/aura/desktop.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 namespace aura { | 37 namespace aura { |
38 | 38 |
39 namespace { | 39 namespace { |
40 | 40 |
41 // Default bounds for the host window. | 41 // Default bounds for the host window. |
42 static const int kDefaultHostWindowX = 200; | 42 static const int kDefaultHostWindowX = 200; |
43 static const int kDefaultHostWindowY = 200; | 43 static const int kDefaultHostWindowY = 200; |
44 static const int kDefaultHostWindowWidth = 1280; | 44 static const int kDefaultHostWindowWidth = 1280; |
45 static const int kDefaultHostWindowHeight = 1024; | 45 static const int kDefaultHostWindowHeight = 1024; |
46 | 46 |
| 47 // Returns true if |target| has a non-client (frame) component at |location|, |
| 48 // in window coordinates. |
47 bool IsNonClientLocation(Window* target, const gfx::Point& location) { | 49 bool IsNonClientLocation(Window* target, const gfx::Point& location) { |
48 if (!target->delegate()) | 50 if (!target->delegate()) |
49 return false; | 51 return false; |
50 int hit_test_code = target->delegate()->GetNonClientComponent(location); | 52 int hit_test_code = target->delegate()->GetNonClientComponent(location); |
51 return hit_test_code != HTCLIENT && hit_test_code != HTNOWHERE; | 53 return hit_test_code != HTCLIENT && hit_test_code != HTNOWHERE; |
52 } | 54 } |
53 | 55 |
54 class DefaultStackingClient : public StackingClient { | 56 class DefaultStackingClient : public StackingClient { |
55 public: | 57 public: |
56 explicit DefaultStackingClient(Desktop* desktop) : desktop_(desktop) {} | 58 explicit DefaultStackingClient(Desktop* desktop) : desktop_(desktop) {} |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 mouse_pressed_handler_ = target; | 248 mouse_pressed_handler_ = target; |
247 break; | 249 break; |
248 case ui::ET_MOUSE_RELEASED: | 250 case ui::ET_MOUSE_RELEASED: |
249 mouse_pressed_handler_ = NULL; | 251 mouse_pressed_handler_ = NULL; |
250 break; | 252 break; |
251 default: | 253 default: |
252 break; | 254 break; |
253 } | 255 } |
254 if (target && target->delegate()) { | 256 if (target && target->delegate()) { |
255 int flags = event->flags(); | 257 int flags = event->flags(); |
256 if (IsNonClientLocation(target, event->location())) | 258 gfx::Point location_in_window = event->location(); |
| 259 Window::ConvertPointToWindow(this, target, &location_in_window); |
| 260 if (IsNonClientLocation(target, location_in_window)) |
257 flags |= ui::EF_IS_NON_CLIENT; | 261 flags |= ui::EF_IS_NON_CLIENT; |
258 MouseEvent translated_event(*event, this, target, event->type(), flags); | 262 MouseEvent translated_event(*event, this, target, event->type(), flags); |
259 return ProcessMouseEvent(target, &translated_event); | 263 return ProcessMouseEvent(target, &translated_event); |
260 } | 264 } |
261 return false; | 265 return false; |
262 } | 266 } |
263 | 267 |
264 bool Desktop::DispatchKeyEvent(KeyEvent* event) { | 268 bool Desktop::DispatchKeyEvent(KeyEvent* event) { |
265 #if !defined(NDEBUG) | 269 #if !defined(NDEBUG) |
266 // TODO(beng): replace this hack with global keyboard event handlers. | 270 // TODO(beng): replace this hack with global keyboard event handlers. |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { | 592 base::StringToInt(parts[1], &parsed_height) && parsed_height > 0) { |
589 bounds.set_size(gfx::Size(parsed_width, parsed_height)); | 593 bounds.set_size(gfx::Size(parsed_width, parsed_height)); |
590 } else if (use_fullscreen_host_window_) { | 594 } else if (use_fullscreen_host_window_) { |
591 bounds = gfx::Rect(DesktopHost::GetNativeDisplaySize()); | 595 bounds = gfx::Rect(DesktopHost::GetNativeDisplaySize()); |
592 } | 596 } |
593 | 597 |
594 return bounds; | 598 return bounds; |
595 } | 599 } |
596 | 600 |
597 } // namespace aura | 601 } // namespace aura |
OLD | NEW |