OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ozone/platform/dri/dri_window.h" | 5 #include "ui/ozone/platform/dri/dri_window.h" |
6 | 6 |
7 #include "ui/events/event.h" | 7 #include "ui/events/event.h" |
8 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 8 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
9 #include "ui/events/platform/platform_event_source.h" | 9 #include "ui/events/platform/platform_event_source.h" |
| 10 #include "ui/ozone/platform/dri/dri_cursor.h" |
10 #include "ui/ozone/platform/dri/dri_window_delegate.h" | 11 #include "ui/ozone/platform/dri/dri_window_delegate.h" |
11 #include "ui/ozone/platform/dri/dri_window_manager.h" | 12 #include "ui/ozone/platform/dri/dri_window_manager.h" |
12 #include "ui/ozone/public/cursor_factory_ozone.h" | 13 #include "ui/ozone/public/cursor_factory_ozone.h" |
13 #include "ui/platform_window/platform_window_delegate.h" | 14 #include "ui/platform_window/platform_window_delegate.h" |
14 | 15 |
15 namespace ui { | 16 namespace ui { |
16 | 17 |
17 DriWindow::DriWindow(PlatformWindowDelegate* delegate, | 18 DriWindow::DriWindow(PlatformWindowDelegate* delegate, |
18 const gfx::Rect& bounds, | 19 const gfx::Rect& bounds, |
19 scoped_ptr<DriWindowDelegate> dri_window_delegate, | 20 scoped_ptr<DriWindowDelegate> dri_window_delegate, |
20 EventFactoryEvdev* event_factory, | 21 EventFactoryEvdev* event_factory, |
21 DriWindowManager* window_manager) | 22 DriWindowManager* window_manager, |
| 23 DriCursor* cursor) |
22 : delegate_(delegate), | 24 : delegate_(delegate), |
23 bounds_(bounds), | 25 bounds_(bounds), |
24 widget_(dri_window_delegate->GetAcceleratedWidget()), | 26 widget_(dri_window_delegate->GetAcceleratedWidget()), |
25 dri_window_delegate_(dri_window_delegate.get()), | 27 dri_window_delegate_(dri_window_delegate.get()), |
26 event_factory_(event_factory), | 28 event_factory_(event_factory), |
27 window_manager_(window_manager) { | 29 window_manager_(window_manager), |
| 30 cursor_(cursor) { |
28 window_manager_->AddWindowDelegate(widget_, dri_window_delegate.Pass()); | 31 window_manager_->AddWindowDelegate(widget_, dri_window_delegate.Pass()); |
29 } | 32 } |
30 | 33 |
31 DriWindow::~DriWindow() { | 34 DriWindow::~DriWindow() { |
32 PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); | 35 PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); |
33 dri_window_delegate_->Shutdown(); | 36 dri_window_delegate_->Shutdown(); |
34 window_manager_->RemoveWindowDelegate(widget_); | 37 window_manager_->RemoveWindowDelegate(widget_); |
35 } | 38 } |
36 | 39 |
37 void DriWindow::Initialize() { | 40 void DriWindow::Initialize() { |
(...skipping 25 matching lines...) Expand all Loading... |
63 | 66 |
64 void DriWindow::ToggleFullscreen() {} | 67 void DriWindow::ToggleFullscreen() {} |
65 | 68 |
66 void DriWindow::Maximize() {} | 69 void DriWindow::Maximize() {} |
67 | 70 |
68 void DriWindow::Minimize() {} | 71 void DriWindow::Minimize() {} |
69 | 72 |
70 void DriWindow::Restore() {} | 73 void DriWindow::Restore() {} |
71 | 74 |
72 void DriWindow::SetCursor(PlatformCursor cursor) { | 75 void DriWindow::SetCursor(PlatformCursor cursor) { |
73 ui::CursorFactoryOzone::GetInstance()->SetCursor(widget_, cursor); | 76 cursor_->SetCursor(widget_, cursor); |
74 } | 77 } |
75 | 78 |
76 void DriWindow::MoveCursorTo(const gfx::Point& location) { | 79 void DriWindow::MoveCursorTo(const gfx::Point& location) { |
77 event_factory_->WarpCursorTo(widget_, location); | 80 event_factory_->WarpCursorTo(widget_, location); |
78 } | 81 } |
79 | 82 |
80 bool DriWindow::CanDispatchEvent(const PlatformEvent& ne) { | 83 bool DriWindow::CanDispatchEvent(const PlatformEvent& ne) { |
81 DCHECK(ne); | 84 DCHECK(ne); |
82 Event* event = static_cast<Event*>(ne); | 85 Event* event = static_cast<Event*>(ne); |
83 if (event->IsMouseEvent() || event->IsScrollEvent()) | 86 if (event->IsMouseEvent() || event->IsScrollEvent()) |
84 return ui::CursorFactoryOzone::GetInstance()->GetCursorWindow() == widget_; | 87 return cursor_->GetCursorWindow() == widget_; |
85 | 88 |
86 return true; | 89 return true; |
87 } | 90 } |
88 | 91 |
89 uint32_t DriWindow::DispatchEvent(const PlatformEvent& ne) { | 92 uint32_t DriWindow::DispatchEvent(const PlatformEvent& ne) { |
90 Event* event = static_cast<Event*>(ne); | 93 Event* event = static_cast<Event*>(ne); |
91 delegate_->DispatchEvent(event); | 94 delegate_->DispatchEvent(event); |
92 return POST_DISPATCH_STOP_PROPAGATION; | 95 return POST_DISPATCH_STOP_PROPAGATION; |
93 } | 96 } |
94 | 97 |
95 } // namespace ui | 98 } // namespace ui |
OLD | NEW |