OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/ozone/platform/dri/dri_window.h" |
| 6 |
| 7 #include "ui/events/event.h" |
| 8 #include "ui/events/platform/platform_event_source.h" |
| 9 #include "ui/ozone/public/cursor_factory_ozone.h" |
| 10 #include "ui/ozone/public/surface_factory_ozone.h" |
| 11 #include "ui/platform_window/platform_window_delegate.h" |
| 12 |
| 13 namespace ui { |
| 14 |
| 15 DriWindow::DriWindow(PlatformWindowDelegate* delegate, |
| 16 const gfx::Rect& bounds) |
| 17 : delegate_(delegate), bounds_(bounds) { |
| 18 widget_ = SurfaceFactoryOzone::GetInstance()->GetAcceleratedWidget(); |
| 19 delegate_->OnAcceleratedWidgetAvailable(widget_); |
| 20 PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); |
| 21 } |
| 22 |
| 23 DriWindow::~DriWindow() { |
| 24 PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); |
| 25 } |
| 26 |
| 27 void DriWindow::Show() {} |
| 28 |
| 29 void DriWindow::Hide() {} |
| 30 |
| 31 void DriWindow::Close() {} |
| 32 |
| 33 void DriWindow::SetBounds(const gfx::Rect& bounds) { |
| 34 bounds_ = bounds; |
| 35 delegate_->OnBoundsChanged(bounds); |
| 36 } |
| 37 |
| 38 gfx::Rect DriWindow::GetBounds() { |
| 39 return bounds_; |
| 40 } |
| 41 |
| 42 void DriWindow::SetCapture() {} |
| 43 |
| 44 void DriWindow::ReleaseCapture() {} |
| 45 |
| 46 void DriWindow::ToggleFullscreen() {} |
| 47 |
| 48 void DriWindow::Maximize() {} |
| 49 |
| 50 void DriWindow::Minimize() {} |
| 51 |
| 52 void DriWindow::Restore() {} |
| 53 |
| 54 bool DriWindow::CanDispatchEvent(const PlatformEvent& ne) { |
| 55 CHECK(ne); |
| 56 Event* event = static_cast<Event*>(ne); |
| 57 if (event->IsMouseEvent() || event->IsScrollEvent()) |
| 58 return ui::CursorFactoryOzone::GetInstance()->GetCursorWindow() == widget_; |
| 59 |
| 60 return true; |
| 61 } |
| 62 |
| 63 uint32_t DriWindow::DispatchEvent(const PlatformEvent& ne) { |
| 64 Event* event = static_cast<Event*>(ne); |
| 65 delegate_->DispatchEvent(event); |
| 66 return POST_DISPATCH_STOP_PROPAGATION; |
| 67 } |
| 68 |
| 69 } // namespace ui |
OLD | NEW |