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

Side by Side Diff: components/mus/ws/display_manager.cc

Issue 1465803003: mus: Let clients set the cursor of their window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Do it the other way + explicit checks that it is a mouse pointer. Created 5 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 | « components/mus/ws/display_manager.h ('k') | components/mus/ws/event_dispatcher.h » ('j') | 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 "components/mus/ws/display_manager.h" 5 #include "components/mus/ws/display_manager.h"
6 6
7 #include "base/numerics/safe_conversions.h" 7 #include "base/numerics/safe_conversions.h"
8 #include "cc/output/compositor_frame.h" 8 #include "cc/output/compositor_frame.h"
9 #include "cc/output/delegated_frame_data.h" 9 #include "cc/output/delegated_frame_data.h"
10 #include "cc/quads/render_pass.h" 10 #include "cc/quads/render_pass.h"
(...skipping 11 matching lines...) Expand all
22 #include "components/mus/ws/window_coordinate_conversions.h" 22 #include "components/mus/ws/window_coordinate_conversions.h"
23 #include "mojo/application/public/cpp/application_connection.h" 23 #include "mojo/application/public/cpp/application_connection.h"
24 #include "mojo/application/public/cpp/application_impl.h" 24 #include "mojo/application/public/cpp/application_impl.h"
25 #include "mojo/converters/geometry/geometry_type_converters.h" 25 #include "mojo/converters/geometry/geometry_type_converters.h"
26 #include "mojo/converters/input_events/input_events_type_converters.h" 26 #include "mojo/converters/input_events/input_events_type_converters.h"
27 #include "mojo/converters/input_events/mojo_extended_key_event_data.h" 27 #include "mojo/converters/input_events/mojo_extended_key_event_data.h"
28 #include "mojo/converters/surfaces/surfaces_type_converters.h" 28 #include "mojo/converters/surfaces/surfaces_type_converters.h"
29 #include "mojo/converters/surfaces/surfaces_utils.h" 29 #include "mojo/converters/surfaces/surfaces_utils.h"
30 #include "mojo/converters/transform/transform_type_converters.h" 30 #include "mojo/converters/transform/transform_type_converters.h"
31 #include "third_party/skia/include/core/SkXfermode.h" 31 #include "third_party/skia/include/core/SkXfermode.h"
32 #include "ui/base/cursor/cursor_loader.h"
32 #include "ui/events/event.h" 33 #include "ui/events/event.h"
33 #include "ui/events/event_utils.h" 34 #include "ui/events/event_utils.h"
34 #include "ui/gfx/display.h" 35 #include "ui/gfx/display.h"
35 #include "ui/platform_window/platform_ime_controller.h" 36 #include "ui/platform_window/platform_ime_controller.h"
36 #include "ui/platform_window/platform_window.h" 37 #include "ui/platform_window/platform_window.h"
37 38
38 #if defined(OS_WIN) 39 #if defined(OS_WIN)
39 #include "ui/platform_window/win/win_window.h" 40 #include "ui/platform_window/win/win_window.h"
40 #elif defined(USE_X11) 41 #elif defined(USE_X11)
41 #include "ui/platform_window/x11/x11_window.h" 42 #include "ui/platform_window/x11/x11_window.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 DefaultDisplayManager::DefaultDisplayManager( 164 DefaultDisplayManager::DefaultDisplayManager(
164 mojo::ApplicationImpl* app_impl, 165 mojo::ApplicationImpl* app_impl,
165 const scoped_refptr<GpuState>& gpu_state, 166 const scoped_refptr<GpuState>& gpu_state,
166 const scoped_refptr<SurfacesState>& surfaces_state) 167 const scoped_refptr<SurfacesState>& surfaces_state)
167 : app_impl_(app_impl), 168 : app_impl_(app_impl),
168 gpu_state_(gpu_state), 169 gpu_state_(gpu_state),
169 surfaces_state_(surfaces_state), 170 surfaces_state_(surfaces_state),
170 delegate_(nullptr), 171 delegate_(nullptr),
171 draw_timer_(false, false), 172 draw_timer_(false, false),
172 frame_pending_(false), 173 frame_pending_(false),
174 #if !defined(OS_ANDROID)
175 cursor_loader_(ui::CursorLoader::Create()),
176 #endif
173 weak_factory_(this) { 177 weak_factory_(this) {
174 metrics_.size_in_pixels = mojo::Size::New(); 178 metrics_.size_in_pixels = mojo::Size::New();
175 metrics_.size_in_pixels->width = 1024; 179 metrics_.size_in_pixels->width = 1024;
176 metrics_.size_in_pixels->height = 768; 180 metrics_.size_in_pixels->height = 768;
177 } 181 }
178 182
179 void DefaultDisplayManager::Init(DisplayManagerDelegate* delegate) { 183 void DefaultDisplayManager::Init(DisplayManagerDelegate* delegate) {
180 delegate_ = delegate; 184 delegate_ = delegate;
181 185
182 gfx::Rect bounds(metrics_.size_in_pixels.To<gfx::Size>()); 186 gfx::Rect bounds(metrics_.size_in_pixels.To<gfx::Size>());
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 223 }
220 224
221 void DefaultDisplayManager::SetViewportSize(const gfx::Size& size) { 225 void DefaultDisplayManager::SetViewportSize(const gfx::Size& size) {
222 platform_window_->SetBounds(gfx::Rect(size)); 226 platform_window_->SetBounds(gfx::Rect(size));
223 } 227 }
224 228
225 void DefaultDisplayManager::SetTitle(const base::string16& title) { 229 void DefaultDisplayManager::SetTitle(const base::string16& title) {
226 platform_window_->SetTitle(title); 230 platform_window_->SetTitle(title);
227 } 231 }
228 232
233 void DefaultDisplayManager::SetCursorById(int32_t cursor_id) {
234 #if !defined(OS_ANDROID)
235 // TODO(erg): This still isn't sufficient, and will only use native cursors
236 // that chrome would use, not custom image cursors. For that, we should
237 // delegate to the window manager to load images from resource packs.
238 //
239 // We probably also need to deal with different DPIs.
240 ui::Cursor cursor(cursor_id);
241 cursor_loader_->SetPlatformCursor(&cursor);
242 platform_window_->SetCursor(cursor.platform());
243 #endif
244 }
245
229 const mojom::ViewportMetrics& DefaultDisplayManager::GetViewportMetrics() { 246 const mojom::ViewportMetrics& DefaultDisplayManager::GetViewportMetrics() {
230 return metrics_; 247 return metrics_;
231 } 248 }
232 249
233 void DefaultDisplayManager::UpdateTextInputState( 250 void DefaultDisplayManager::UpdateTextInputState(
234 const ui::TextInputState& state) { 251 const ui::TextInputState& state) {
235 ui::PlatformImeController* ime = platform_window_->GetPlatformImeController(); 252 ui::PlatformImeController* ime = platform_window_->GetPlatformImeController();
236 if (ime) 253 if (ime)
237 ime->UpdateTextInputState(state); 254 ime->UpdateTextInputState(state);
238 } 255 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 416
400 void DefaultDisplayManager::OnAcceleratedWidgetDestroyed() { 417 void DefaultDisplayManager::OnAcceleratedWidgetDestroyed() {
401 NOTREACHED(); 418 NOTREACHED();
402 } 419 }
403 420
404 void DefaultDisplayManager::OnActivationChanged(bool active) {} 421 void DefaultDisplayManager::OnActivationChanged(bool active) {}
405 422
406 } // namespace ws 423 } // namespace ws
407 424
408 } // namespace mus 425 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/display_manager.h ('k') | components/mus/ws/event_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698