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/views/widget/desktop_aura/desktop_cursor_loader_updater_auralinux.h"
7 #include "ui/aura/window_event_dispatcher.h"
8 #include "ui/base/cursor/cursor_loader.h"
9 #include "ui/base/cursor/cursors_aura.h"
10 #include "ui/gfx/display.h"
15 // Cursors that we need to supply our own image resources for. This was
16 // generated from webcursor_gtk.cc; any cursor that either was NOTIMPLEMENTED()
17 // or already was implemented with a pixmap is on this list.
18 const int kImageCursorIds
[] = {
19 ui::kCursorNorthEastSouthWestResize
,
20 ui::kCursorNorthWestSouthEastResize
,
21 ui::kCursorVerticalText
,
23 ui::kCursorContextMenu
,
27 ui::kCursorNotAllowed
,
34 void LoadImageCursors(float device_scale_factor
, ui::CursorLoader
* loader
) {
37 for (size_t i
= 0; i
< arraysize(kImageCursorIds
); ++i
) {
38 bool success
= ui::GetCursorDataFor(
39 ui::CURSOR_SET_NORMAL
, // Not support custom cursor set.
45 loader
->LoadImageCursor(kImageCursorIds
[i
], resource_id
, point
);
51 DesktopCursorLoaderUpdaterAuraLinux::DesktopCursorLoaderUpdaterAuraLinux() {}
53 DesktopCursorLoaderUpdaterAuraLinux::~DesktopCursorLoaderUpdaterAuraLinux() {}
55 void DesktopCursorLoaderUpdaterAuraLinux::OnCreate(
56 float device_scale_factor
,
57 ui::CursorLoader
* loader
) {
58 LoadImageCursors(device_scale_factor
, loader
);
61 void DesktopCursorLoaderUpdaterAuraLinux::OnDisplayUpdated(
62 const gfx::Display
& display
,
63 ui::CursorLoader
* loader
) {
64 LoadImageCursors(display
.device_scale_factor(), loader
);
68 scoped_ptr
<DesktopCursorLoaderUpdater
> DesktopCursorLoaderUpdater::Create() {
69 return make_scoped_ptr(new DesktopCursorLoaderUpdaterAuraLinux
);