OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base/cursor/cursor_loader_x11.h" | 5 #include "ui/base/cursor/cursor_loader_x11.h" |
6 | 6 |
7 #include <float.h> | 7 #include <float.h> |
8 #include <X11/cursorfont.h> | 8 #include <X11/cursorfont.h> |
9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
10 | 10 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 DCHECK(cursor); | 277 DCHECK(cursor); |
278 | 278 |
279 if (*cursor == kCursorNone) { | 279 if (*cursor == kCursorNone) { |
280 cursor->SetPlatformCursor(invisible_cursor_.get()); | 280 cursor->SetPlatformCursor(invisible_cursor_.get()); |
281 return; | 281 return; |
282 } | 282 } |
283 | 283 |
284 if (*cursor == kCursorCustom) | 284 if (*cursor == kCursorCustom) |
285 return; | 285 return; |
286 | 286 |
| 287 cursor->set_device_scale_factor(scale()); |
287 cursor->SetPlatformCursor(CursorFromId(cursor->native_type())); | 288 cursor->SetPlatformCursor(CursorFromId(cursor->native_type())); |
288 } | 289 } |
289 | 290 |
290 const XcursorImage* CursorLoaderX11::GetXcursorImageForTest(int id) { | 291 const XcursorImage* CursorLoaderX11::GetXcursorImageForTest(int id) { |
291 return test::GetCachedXcursorImage(image_cursors_[id]->cursor); | 292 return test::GetCachedXcursorImage(image_cursors_[id]->cursor); |
292 } | 293 } |
293 | 294 |
294 bool CursorLoaderX11::IsImageCursor(gfx::NativeCursor native_cursor) { | 295 bool CursorLoaderX11::IsImageCursor(gfx::NativeCursor native_cursor) { |
295 int type = native_cursor.native_type(); | 296 int type = native_cursor.native_type(); |
296 return image_cursors_.count(type) || animated_cursors_.count(type); | 297 return image_cursors_.count(type) || animated_cursors_.count(type); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 } | 342 } |
342 | 343 |
343 // As a last resort, return a left pointer. | 344 // As a last resort, return a left pointer. |
344 cursor = XCreateFontCursor(display_, XC_left_ptr); | 345 cursor = XCreateFontCursor(display_, XC_left_ptr); |
345 DCHECK(cursor); | 346 DCHECK(cursor); |
346 font_cursors_[id] = cursor; | 347 font_cursors_[id] = cursor; |
347 return cursor; | 348 return cursor; |
348 } | 349 } |
349 | 350 |
350 } // namespace ui | 351 } // namespace ui |
OLD | NEW |