| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/widget/desktop_aura/desktop_window_tree_host_win.h" | 5 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "third_party/skia/include/core/SkPath.h" | 8 #include "third_party/skia/include/core/SkPath.h" |
| 9 #include "third_party/skia/include/core/SkRegion.h" | 9 #include "third_party/skia/include/core/SkRegion.h" |
| 10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
| 11 #include "ui/aura/client/cursor_client.h" | 11 #include "ui/aura/client/cursor_client.h" |
| 12 #include "ui/aura/client/focus_client.h" | 12 #include "ui/aura/client/focus_client.h" |
| 13 #include "ui/aura/window_event_dispatcher.h" | 13 #include "ui/aura/window_event_dispatcher.h" |
| 14 #include "ui/aura/window_property.h" | 14 #include "ui/base/class_property.h" |
| 15 #include "ui/base/cursor/cursor_loader_win.h" | 15 #include "ui/base/cursor/cursor_loader_win.h" |
| 16 #include "ui/base/ime/input_method.h" | 16 #include "ui/base/ime/input_method.h" |
| 17 #include "ui/base/win/shell.h" | 17 #include "ui/base/win/shell.h" |
| 18 #include "ui/compositor/compositor_constants.h" | 18 #include "ui/compositor/compositor_constants.h" |
| 19 #include "ui/compositor/paint_context.h" | 19 #include "ui/compositor/paint_context.h" |
| 20 #include "ui/display/win/dpi.h" | 20 #include "ui/display/win/dpi.h" |
| 21 #include "ui/display/win/screen_win.h" | 21 #include "ui/display/win/screen_win.h" |
| 22 #include "ui/gfx/geometry/insets.h" | 22 #include "ui/gfx/geometry/insets.h" |
| 23 #include "ui/gfx/geometry/vector2d.h" | 23 #include "ui/gfx/geometry/vector2d.h" |
| 24 #include "ui/gfx/native_widget_types.h" | 24 #include "ui/gfx/native_widget_types.h" |
| 25 #include "ui/gfx/path.h" | 25 #include "ui/gfx/path.h" |
| 26 #include "ui/gfx/path_win.h" | 26 #include "ui/gfx/path_win.h" |
| 27 #include "ui/views/corewm/tooltip_win.h" | 27 #include "ui/views/corewm/tooltip_win.h" |
| 28 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h" | 28 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h" |
| 29 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" | 29 #include "ui/views/widget/desktop_aura/desktop_native_cursor_manager.h" |
| 30 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 30 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 31 #include "ui/views/widget/root_view.h" | 31 #include "ui/views/widget/root_view.h" |
| 32 #include "ui/views/widget/widget_delegate.h" | 32 #include "ui/views/widget/widget_delegate.h" |
| 33 #include "ui/views/widget/widget_hwnd_utils.h" | 33 #include "ui/views/widget/widget_hwnd_utils.h" |
| 34 #include "ui/views/win/fullscreen_handler.h" | 34 #include "ui/views/win/fullscreen_handler.h" |
| 35 #include "ui/views/win/hwnd_message_handler.h" | 35 #include "ui/views/win/hwnd_message_handler.h" |
| 36 #include "ui/views/win/hwnd_util.h" | 36 #include "ui/views/win/hwnd_util.h" |
| 37 #include "ui/views/window/native_frame_view.h" | 37 #include "ui/views/window/native_frame_view.h" |
| 38 #include "ui/wm/core/compound_event_filter.h" | 38 #include "ui/wm/core/compound_event_filter.h" |
| 39 #include "ui/wm/core/window_animations.h" | 39 #include "ui/wm/core/window_animations.h" |
| 40 #include "ui/wm/public/scoped_tooltip_disabler.h" | 40 #include "ui/wm/public/scoped_tooltip_disabler.h" |
| 41 | 41 |
| 42 DECLARE_WINDOW_PROPERTY_TYPE(views::DesktopWindowTreeHostWin*); | 42 DECLARE_UI_CLASS_PROPERTY_TYPE(views::DesktopWindowTreeHostWin*); |
| 43 | 43 |
| 44 namespace views { | 44 namespace views { |
| 45 | 45 |
| 46 namespace { | 46 namespace { |
| 47 | 47 |
| 48 gfx::Size GetExpandedWindowSize(DWORD window_style, gfx::Size size) { | 48 gfx::Size GetExpandedWindowSize(DWORD window_style, gfx::Size size) { |
| 49 if (!(window_style & WS_EX_COMPOSITED) || !ui::win::IsAeroGlassEnabled()) | 49 if (!(window_style & WS_EX_COMPOSITED) || !ui::win::IsAeroGlassEnabled()) |
| 50 return size; | 50 return size; |
| 51 | 51 |
| 52 // Some AMD drivers can't display windows that are less than 64x64 pixels, | 52 // Some AMD drivers can't display windows that are less than 64x64 pixels, |
| 53 // so expand them to be at least that size. http://crbug.com/286609 | 53 // so expand them to be at least that size. http://crbug.com/286609 |
| 54 gfx::Size expanded(std::max(size.width(), 64), std::max(size.height(), 64)); | 54 gfx::Size expanded(std::max(size.width(), 64), std::max(size.height(), 64)); |
| 55 return expanded; | 55 return expanded; |
| 56 } | 56 } |
| 57 | 57 |
| 58 void InsetBottomRight(gfx::Rect* rect, const gfx::Vector2d& vector) { | 58 void InsetBottomRight(gfx::Rect* rect, const gfx::Vector2d& vector) { |
| 59 rect->Inset(0, 0, vector.x(), vector.y()); | 59 rect->Inset(0, 0, vector.x(), vector.y()); |
| 60 } | 60 } |
| 61 | 61 |
| 62 } // namespace | 62 } // namespace |
| 63 | 63 |
| 64 DEFINE_WINDOW_PROPERTY_KEY(aura::Window*, kContentWindowForRootWindow, NULL); | 64 DEFINE_UI_CLASS_PROPERTY_KEY(aura::Window*, kContentWindowForRootWindow, NULL); |
| 65 | 65 |
| 66 // Identifies the DesktopWindowTreeHostWin associated with the | 66 // Identifies the DesktopWindowTreeHostWin associated with the |
| 67 // WindowEventDispatcher. | 67 // WindowEventDispatcher. |
| 68 DEFINE_WINDOW_PROPERTY_KEY(DesktopWindowTreeHostWin*, kDesktopWindowTreeHostKey, | 68 DEFINE_UI_CLASS_PROPERTY_KEY(DesktopWindowTreeHostWin*, |
| 69 NULL); | 69 kDesktopWindowTreeHostKey, |
| 70 NULL); |
| 70 | 71 |
| 71 //////////////////////////////////////////////////////////////////////////////// | 72 //////////////////////////////////////////////////////////////////////////////// |
| 72 // DesktopWindowTreeHostWin, public: | 73 // DesktopWindowTreeHostWin, public: |
| 73 | 74 |
| 74 bool DesktopWindowTreeHostWin::is_cursor_visible_ = true; | 75 bool DesktopWindowTreeHostWin::is_cursor_visible_ = true; |
| 75 | 76 |
| 76 DesktopWindowTreeHostWin::DesktopWindowTreeHostWin( | 77 DesktopWindowTreeHostWin::DesktopWindowTreeHostWin( |
| 77 internal::NativeWidgetDelegate* native_widget_delegate, | 78 internal::NativeWidgetDelegate* native_widget_delegate, |
| 78 DesktopNativeWidgetAura* desktop_native_widget_aura) | 79 DesktopNativeWidgetAura* desktop_native_widget_aura) |
| 79 : message_handler_(new HWNDMessageHandler(this)), | 80 : message_handler_(new HWNDMessageHandler(this)), |
| (...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 | 992 |
| 992 // static | 993 // static |
| 993 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( | 994 DesktopWindowTreeHost* DesktopWindowTreeHost::Create( |
| 994 internal::NativeWidgetDelegate* native_widget_delegate, | 995 internal::NativeWidgetDelegate* native_widget_delegate, |
| 995 DesktopNativeWidgetAura* desktop_native_widget_aura) { | 996 DesktopNativeWidgetAura* desktop_native_widget_aura) { |
| 996 return new DesktopWindowTreeHostWin(native_widget_delegate, | 997 return new DesktopWindowTreeHostWin(native_widget_delegate, |
| 997 desktop_native_widget_aura); | 998 desktop_native_widget_aura); |
| 998 } | 999 } |
| 999 | 1000 |
| 1000 } // namespace views | 1001 } // namespace views |
| OLD | NEW |