This source file includes following definitions.
- LoadImageCursors
- OnCreate
- OnDisplayUpdated
- Create
#include "ui/views/widget/desktop_aura/desktop_cursor_loader_updater_auralinux.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/base/cursor/cursor_loader.h"
#include "ui/base/cursor/cursors_aura.h"
#include "ui/gfx/display.h"
namespace views {
namespace {
const int kImageCursorIds[] = {
ui::kCursorNorthEastSouthWestResize,
ui::kCursorNorthWestSouthEastResize,
ui::kCursorVerticalText,
ui::kCursorCell,
ui::kCursorContextMenu,
ui::kCursorAlias,
ui::kCursorNoDrop,
ui::kCursorCopy,
ui::kCursorNotAllowed,
ui::kCursorZoomIn,
ui::kCursorZoomOut,
ui::kCursorGrab,
ui::kCursorGrabbing,
};
void LoadImageCursors(float device_scale_factor, ui::CursorLoader* loader) {
int resource_id;
gfx::Point point;
for (size_t i = 0; i < arraysize(kImageCursorIds); ++i) {
bool success = ui::GetCursorDataFor(
ui::CURSOR_SET_NORMAL,
kImageCursorIds[i],
device_scale_factor,
&resource_id,
&point);
DCHECK(success);
loader->LoadImageCursor(kImageCursorIds[i], resource_id, point);
}
}
}
DesktopCursorLoaderUpdaterAuraLinux::DesktopCursorLoaderUpdaterAuraLinux() {}
DesktopCursorLoaderUpdaterAuraLinux::~DesktopCursorLoaderUpdaterAuraLinux() {}
void DesktopCursorLoaderUpdaterAuraLinux::OnCreate(
float device_scale_factor,
ui::CursorLoader* loader) {
LoadImageCursors(device_scale_factor, loader);
}
void DesktopCursorLoaderUpdaterAuraLinux::OnDisplayUpdated(
const gfx::Display& display,
ui::CursorLoader* loader) {
LoadImageCursors(display.device_scale_factor(), loader);
}
scoped_ptr<DesktopCursorLoaderUpdater> DesktopCursorLoaderUpdater::Create() {
return scoped_ptr<DesktopCursorLoaderUpdater>(
new DesktopCursorLoaderUpdaterAuraLinux).Pass();
}
}