ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / ui / aura / window_tree_host_ozone.cc
blob0b6df97bb1717ac05c277c5fc313570a4c2a2551
1 // Copyright 2013 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.
5 #include "ui/aura/window_tree_host_ozone.h"
7 #include "ui/aura/window_event_dispatcher.h"
8 #include "ui/ozone/public/ozone_platform.h"
9 #include "ui/platform_window/platform_window.h"
11 namespace aura {
13 WindowTreeHostOzone::WindowTreeHostOzone(const gfx::Rect& bounds)
14 : widget_(gfx::kNullAcceleratedWidget), current_cursor_(ui::kCursorNull) {
15 platform_window_ =
16 ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds);
19 WindowTreeHostOzone::~WindowTreeHostOzone() {
20 DestroyCompositor();
21 DestroyDispatcher();
24 ui::EventSource* WindowTreeHostOzone::GetEventSource() {
25 return this;
28 gfx::AcceleratedWidget WindowTreeHostOzone::GetAcceleratedWidget() {
29 return widget_;
32 void WindowTreeHostOzone::Show() {
33 platform_window_->Show();
36 void WindowTreeHostOzone::Hide() {
37 platform_window_->Hide();
40 gfx::Rect WindowTreeHostOzone::GetBounds() const {
41 return platform_window_->GetBounds();
44 void WindowTreeHostOzone::SetBounds(const gfx::Rect& bounds) {
45 platform_window_->SetBounds(bounds);
48 gfx::Point WindowTreeHostOzone::GetLocationOnNativeScreen() const {
49 return platform_window_->GetBounds().origin();
52 void WindowTreeHostOzone::SetCapture() {
53 platform_window_->SetCapture();
56 void WindowTreeHostOzone::ReleaseCapture() {
57 platform_window_->ReleaseCapture();
60 void WindowTreeHostOzone::SetCursorNative(gfx::NativeCursor cursor) {
61 if (cursor == current_cursor_)
62 return;
63 current_cursor_ = cursor;
64 platform_window_->SetCursor(cursor.platform());
67 void WindowTreeHostOzone::MoveCursorToNative(const gfx::Point& location) {
68 platform_window_->MoveCursorTo(location);
71 void WindowTreeHostOzone::OnCursorVisibilityChangedNative(bool show) {
74 void WindowTreeHostOzone::OnBoundsChanged(const gfx::Rect& new_bounds) {
75 // TOOD(spang): Should we determine which parts changed?
76 OnHostResized(new_bounds.size());
77 OnHostMoved(new_bounds.origin());
80 void WindowTreeHostOzone::OnDamageRect(const gfx::Rect& damaged_region) {
83 void WindowTreeHostOzone::DispatchEvent(ui::Event* event) {
84 SendEventToProcessor(event);
87 void WindowTreeHostOzone::OnCloseRequest() {
88 OnHostCloseRequested();
91 void WindowTreeHostOzone::OnClosed() {
94 void WindowTreeHostOzone::OnWindowStateChanged(
95 ui::PlatformWindowState new_state) {
98 void WindowTreeHostOzone::OnLostCapture() {
101 void WindowTreeHostOzone::OnAcceleratedWidgetAvailable(
102 gfx::AcceleratedWidget widget) {
103 widget_ = widget;
104 CreateCompositor(widget_);
107 void WindowTreeHostOzone::OnActivationChanged(bool active) {
110 ui::EventProcessor* WindowTreeHostOzone::GetEventProcessor() {
111 return dispatcher();
114 // static
115 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) {
116 return new WindowTreeHostOzone(bounds);
119 // static
120 gfx::Size WindowTreeHost::GetNativeScreenSize() {
121 NOTIMPLEMENTED();
122 return gfx::Size();
125 } // namespace aura