Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Side by Side Diff: ui/ozone/platform/dri/ozone_platform_gbm.cc

Issue 778503002: XKB implementation of Ozone key layout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@x430194-layout
Patch Set: fix boneheaded license paste Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/ozone/platform/dri/ozone_platform_dri.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ozone_platform_gbm.h" 5 #include "ui/ozone/platform/dri/ozone_platform_gbm.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <gbm.h> 8 #include <gbm.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 10
11 #include "base/at_exit.h" 11 #include "base/at_exit.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" 14 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h"
15 #include "ui/events/ozone/device/device_manager.h" 15 #include "ui/events/ozone/device/device_manager.h"
16 #include "ui/events/ozone/evdev/event_factory_evdev.h" 16 #include "ui/events/ozone/evdev/event_factory_evdev.h"
17 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" 17 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h"
18 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h"
19 #include "ui/ozone/platform/dri/display_manager.h" 18 #include "ui/ozone/platform/dri/display_manager.h"
20 #include "ui/ozone/platform/dri/dri_cursor.h" 19 #include "ui/ozone/platform/dri/dri_cursor.h"
21 #include "ui/ozone/platform/dri/dri_gpu_platform_support.h" 20 #include "ui/ozone/platform/dri/dri_gpu_platform_support.h"
22 #include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h" 21 #include "ui/ozone/platform/dri/dri_gpu_platform_support_host.h"
23 #include "ui/ozone/platform/dri/dri_window.h" 22 #include "ui/ozone/platform/dri/dri_window.h"
24 #include "ui/ozone/platform/dri/dri_window_delegate_manager.h" 23 #include "ui/ozone/platform/dri/dri_window_delegate_manager.h"
25 #include "ui/ozone/platform/dri/dri_window_manager.h" 24 #include "ui/ozone/platform/dri/dri_window_manager.h"
26 #include "ui/ozone/platform/dri/dri_wrapper.h" 25 #include "ui/ozone/platform/dri/dri_wrapper.h"
27 #include "ui/ozone/platform/dri/gbm_buffer.h" 26 #include "ui/ozone/platform/dri/gbm_buffer.h"
28 #include "ui/ozone/platform/dri/gbm_surface.h" 27 #include "ui/ozone/platform/dri/gbm_surface.h"
29 #include "ui/ozone/platform/dri/gbm_surface_factory.h" 28 #include "ui/ozone/platform/dri/gbm_surface_factory.h"
30 #include "ui/ozone/platform/dri/native_display_delegate_dri.h" 29 #include "ui/ozone/platform/dri/native_display_delegate_dri.h"
31 #include "ui/ozone/platform/dri/native_display_delegate_proxy.h" 30 #include "ui/ozone/platform/dri/native_display_delegate_proxy.h"
32 #include "ui/ozone/platform/dri/scanout_buffer.h" 31 #include "ui/ozone/platform/dri/scanout_buffer.h"
33 #include "ui/ozone/platform/dri/screen_manager.h" 32 #include "ui/ozone/platform/dri/screen_manager.h"
34 #include "ui/ozone/public/cursor_factory_ozone.h" 33 #include "ui/ozone/public/cursor_factory_ozone.h"
35 #include "ui/ozone/public/gpu_platform_support.h" 34 #include "ui/ozone/public/gpu_platform_support.h"
36 #include "ui/ozone/public/gpu_platform_support_host.h" 35 #include "ui/ozone/public/gpu_platform_support_host.h"
37 #include "ui/ozone/public/ozone_platform.h" 36 #include "ui/ozone/public/ozone_platform.h"
38 #include "ui/ozone/public/ozone_switches.h" 37 #include "ui/ozone/public/ozone_switches.h"
39 38
39 #if defined(USE_XKBCOMMON)
40 #include "ui/events/ozone/layout/xkb/xkb_evdev_codes.h"
41 #include "ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h"
42 #else
43 #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h"
44 #endif
45
40 namespace ui { 46 namespace ui {
41 47
42 namespace { 48 namespace {
43 49
44 const char kDefaultGraphicsCardPath[] = "/dev/dri/card0"; 50 const char kDefaultGraphicsCardPath[] = "/dev/dri/card0";
45 51
46 class GbmBufferGenerator : public ScanoutBufferGenerator { 52 class GbmBufferGenerator : public ScanoutBufferGenerator {
47 public: 53 public:
48 GbmBufferGenerator(DriWrapper* dri) 54 GbmBufferGenerator(DriWrapper* dri)
49 : dri_(dri), 55 : dri_(dri),
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 void InitializeUI() override { 127 void InitializeUI() override {
122 display_manager_.reset(new DisplayManager()); 128 display_manager_.reset(new DisplayManager());
123 // Needed since the browser process creates the accelerated widgets and that 129 // Needed since the browser process creates the accelerated widgets and that
124 // happens through SFO. 130 // happens through SFO.
125 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); 131 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_));
126 device_manager_ = CreateDeviceManager(); 132 device_manager_ = CreateDeviceManager();
127 gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost()); 133 gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost());
128 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); 134 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone);
129 window_manager_.reset( 135 window_manager_.reset(
130 new DriWindowManager(gpu_platform_support_host_.get())); 136 new DriWindowManager(gpu_platform_support_host_.get()));
137 #if defined(USE_XKBCOMMON)
138 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(make_scoped_ptr(
139 new XkbKeyboardLayoutEngine(xkb_evdev_code_converter_)));
140 #else
131 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( 141 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(
132 make_scoped_ptr(new StubKeyboardLayoutEngine())); 142 make_scoped_ptr(new StubKeyboardLayoutEngine()));
143 #endif
133 event_factory_ozone_.reset(new EventFactoryEvdev( 144 event_factory_ozone_.reset(new EventFactoryEvdev(
134 window_manager_->cursor(), device_manager_.get(), 145 window_manager_->cursor(), device_manager_.get(),
135 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine())); 146 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine()));
136 } 147 }
137 148
138 void InitializeGPU() override { 149 void InitializeGPU() override {
139 dri_.reset(new DriWrapper(kDefaultGraphicsCardPath)); 150 dri_.reset(new DriWrapper(kDefaultGraphicsCardPath));
140 dri_->Initialize(); 151 dri_->Initialize();
141 buffer_generator_.reset(new GbmBufferGenerator(dri_.get())); 152 buffer_generator_.reset(new GbmBufferGenerator(dri_.get()));
142 screen_manager_.reset( 153 screen_manager_.reset(
(...skipping 25 matching lines...) Expand all
168 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; 179 scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
169 180
170 scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_; 181 scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_;
171 scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_; 182 scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_;
172 183
173 scoped_ptr<DriWindowDelegateManager> window_delegate_manager_; 184 scoped_ptr<DriWindowDelegateManager> window_delegate_manager_;
174 // Browser side object only. 185 // Browser side object only.
175 scoped_ptr<DriWindowManager> window_manager_; 186 scoped_ptr<DriWindowManager> window_manager_;
176 scoped_ptr<DisplayManager> display_manager_; 187 scoped_ptr<DisplayManager> display_manager_;
177 188
189 #if defined(USE_XKBCOMMON)
190 XkbEvdevCodes xkb_evdev_code_converter_;
191 #endif
192
178 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); 193 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm);
179 }; 194 };
180 195
181 } // namespace 196 } // namespace
182 197
183 OzonePlatform* CreateOzonePlatformGbm() { 198 OzonePlatform* CreateOzonePlatformGbm() {
184 CommandLine* cmd = CommandLine::ForCurrentProcess(); 199 CommandLine* cmd = CommandLine::ForCurrentProcess();
185 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); 200 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless));
186 } 201 }
187 202
188 } // namespace ui 203 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/ozone_platform_dri.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698