OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/wayland/ozone_platform_wayland.h" | 5 #include "ui/ozone/platform/wayland/ozone_platform_wayland.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "ui/base/ui_features.h" |
8 #include "ui/display/fake_display_delegate.h" | 9 #include "ui/display/fake_display_delegate.h" |
| 10 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" |
9 #include "ui/ozone/common/stub_overlay_manager.h" | 11 #include "ui/ozone/common/stub_overlay_manager.h" |
10 #include "ui/ozone/platform/wayland/wayland_connection.h" | 12 #include "ui/ozone/platform/wayland/wayland_connection.h" |
11 #include "ui/ozone/platform/wayland/wayland_surface_factory.h" | 13 #include "ui/ozone/platform/wayland/wayland_surface_factory.h" |
12 #include "ui/ozone/platform/wayland/wayland_window.h" | 14 #include "ui/ozone/platform/wayland/wayland_window.h" |
13 #include "ui/ozone/public/cursor_factory_ozone.h" | 15 #include "ui/ozone/public/cursor_factory_ozone.h" |
14 #include "ui/ozone/public/gpu_platform_support_host.h" | 16 #include "ui/ozone/public/gpu_platform_support_host.h" |
15 #include "ui/ozone/public/input_controller.h" | 17 #include "ui/ozone/public/input_controller.h" |
16 #include "ui/ozone/public/ozone_platform.h" | 18 #include "ui/ozone/public/ozone_platform.h" |
17 #include "ui/ozone/public/system_input_injector.h" | 19 #include "ui/ozone/public/system_input_injector.h" |
18 | 20 |
| 21 #if BUILDFLAG(USE_XKBCOMMON) |
| 22 #include "ui/events/ozone/layout/xkb/xkb_evdev_codes.h" |
| 23 #include "ui/ozone/platform/wayland/wayland_xkb_keyboard_layout_engine.h" |
| 24 #else |
| 25 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" |
| 26 #endif |
| 27 |
19 namespace ui { | 28 namespace ui { |
20 | 29 |
21 namespace { | 30 namespace { |
22 | 31 |
23 class OzonePlatformWayland : public OzonePlatform { | 32 class OzonePlatformWayland : public OzonePlatform { |
24 public: | 33 public: |
25 OzonePlatformWayland() {} | 34 OzonePlatformWayland() {} |
26 ~OzonePlatformWayland() override {} | 35 ~OzonePlatformWayland() override {} |
27 | 36 |
28 // OzonePlatform | 37 // OzonePlatform |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 void InitializeUI() override { | 77 void InitializeUI() override { |
69 InitParams default_params; | 78 InitParams default_params; |
70 InitializeUI(default_params); | 79 InitializeUI(default_params); |
71 } | 80 } |
72 | 81 |
73 void InitializeUI(const InitParams& args) override { | 82 void InitializeUI(const InitParams& args) override { |
74 connection_.reset(new WaylandConnection); | 83 connection_.reset(new WaylandConnection); |
75 if (!connection_->Initialize()) | 84 if (!connection_->Initialize()) |
76 LOG(FATAL) << "Failed to initialize Wayland platform"; | 85 LOG(FATAL) << "Failed to initialize Wayland platform"; |
77 | 86 |
| 87 #if BUILDFLAG(USE_XKBCOMMON) |
| 88 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( |
| 89 base::MakeUnique<WaylandXkbKeyboardLayoutEngine>( |
| 90 xkb_evdev_code_converter_)); |
| 91 #else |
| 92 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( |
| 93 base::MakeUnique<StubKeyboardLayoutEngine>()); |
| 94 #endif |
| 95 |
78 cursor_factory_.reset(new CursorFactoryOzone); | 96 cursor_factory_.reset(new CursorFactoryOzone); |
79 overlay_manager_.reset(new StubOverlayManager); | 97 overlay_manager_.reset(new StubOverlayManager); |
80 input_controller_ = CreateStubInputController(); | 98 input_controller_ = CreateStubInputController(); |
81 surface_factory_.reset(new WaylandSurfaceFactory(connection_.get())); | 99 surface_factory_.reset(new WaylandSurfaceFactory(connection_.get())); |
82 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | 100 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
83 } | 101 } |
84 | 102 |
85 void InitializeGPU() override { | 103 void InitializeGPU() override { |
86 InitParams default_params; | 104 InitParams default_params; |
87 InitializeGPU(default_params); | 105 InitializeGPU(default_params); |
(...skipping 16 matching lines...) Expand all Loading... |
104 } | 122 } |
105 | 123 |
106 private: | 124 private: |
107 std::unique_ptr<WaylandConnection> connection_; | 125 std::unique_ptr<WaylandConnection> connection_; |
108 std::unique_ptr<WaylandSurfaceFactory> surface_factory_; | 126 std::unique_ptr<WaylandSurfaceFactory> surface_factory_; |
109 std::unique_ptr<CursorFactoryOzone> cursor_factory_; | 127 std::unique_ptr<CursorFactoryOzone> cursor_factory_; |
110 std::unique_ptr<StubOverlayManager> overlay_manager_; | 128 std::unique_ptr<StubOverlayManager> overlay_manager_; |
111 std::unique_ptr<InputController> input_controller_; | 129 std::unique_ptr<InputController> input_controller_; |
112 std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; | 130 std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; |
113 | 131 |
| 132 #if BUILDFLAG(USE_XKBCOMMON) |
| 133 XkbEvdevCodes xkb_evdev_code_converter_; |
| 134 #endif |
| 135 |
114 DISALLOW_COPY_AND_ASSIGN(OzonePlatformWayland); | 136 DISALLOW_COPY_AND_ASSIGN(OzonePlatformWayland); |
115 }; | 137 }; |
116 | 138 |
117 } // namespace | 139 } // namespace |
118 | 140 |
119 OzonePlatform* CreateOzonePlatformWayland() { | 141 OzonePlatform* CreateOzonePlatformWayland() { |
120 return new OzonePlatformWayland; | 142 return new OzonePlatformWayland; |
121 } | 143 } |
122 | 144 |
123 } // namespace ui | 145 } // namespace ui |
OLD | NEW |