Chromium Code Reviews| Index: ui/aura/root_window_host_linux.cc |
| diff --git a/ui/aura/root_window_host_linux.cc b/ui/aura/root_window_host_linux.cc |
| index 57f6394bfef26de22d21c9eb358a00656ce8303b..dcbc0bfb7b87ccbe37d112dfd8208fa4a7a34f2c 100644 |
| --- a/ui/aura/root_window_host_linux.cc |
| +++ b/ui/aura/root_window_host_linux.cc |
| @@ -152,9 +152,11 @@ int CursorShapeFromNative(gfx::NativeCursor native_cursor) { |
| case aura::kCursorZoomOut: |
| case aura::kCursorGrab: |
| case aura::kCursorGrabbing: |
| - case aura::kCursorCustom: |
| // TODO(jamescook): Need cursors for these. crbug.com/111650 |
| return XC_left_ptr; |
| + case aura::kCursorCustom: |
| + NOTREACHED(); |
| + return XC_left_ptr; |
| } |
| NOTREACHED(); |
| return XC_left_ptr; |
| @@ -273,6 +275,7 @@ RootWindowHostLinux::RootWindowHostLinux(const gfx::Rect& bounds) |
| xwindow_(0), |
| x_root_window_(DefaultRootWindow(xdisplay_)), |
| current_cursor_(aura::kCursorNull), |
| + custom_cursor_(0), |
| cursor_shown_(true), |
| bounds_(bounds) { |
| XSetWindowAttributes swa; |
| @@ -550,6 +553,16 @@ void RootWindowHostLinux::SetCursor(gfx::NativeCursor cursor) { |
| SetCursorInternal(cursor); |
| } |
| +void RootWindowHostLinux::SetCustomCursor(const gfx::PlatformCursor& cursor) { |
| + if (custom_cursor_) |
| + ui::UnrefCustomXCursor(custom_cursor_); |
|
Daniel Erat
2012/02/24 21:04:36
put this in the d'tor too
sadrul
2012/02/24 22:48:49
Ah, good catch. Done.
|
| + custom_cursor_ = cursor; |
| + if (custom_cursor_) |
| + ui::RefCustomXCursor(custom_cursor_); |
| + if (cursor_shown_) |
| + XDefineCursor(xdisplay_, xwindow_, cursor); |
|
Daniel Erat
2012/02/24 21:04:36
i think that you need to make ShowCursor() handle
sadrul
2012/02/24 22:48:49
Very nice. Done!
One exception: I am not CHECK()i
Daniel Erat
2012/02/24 23:19:31
Hmm, I see. Will the current unsetting/unref-ing
sadrul
2012/02/25 00:02:30
I have changed the code in SetCursor to unset cust
Daniel Erat
2012/02/25 00:38:56
So just to make sure that I understand correctly,
|
| +} |
| + |
| void RootWindowHostLinux::ShowCursor(bool show) { |
| if (show == cursor_shown_) |
| return; |
| @@ -647,6 +660,10 @@ void RootWindowHostLinux::SetCursorInternal(gfx::NativeCursor cursor) { |
| invisible_cursor_ : |
| ui::GetXCursor(CursorShapeFromNative(cursor)); |
| XDefineCursor(xdisplay_, xwindow_, xcursor); |
| + if (custom_cursor_) { |
| + ui::UnrefCustomXCursor(custom_cursor_); |
| + custom_cursor_ = 0; |
| + } |
| } |
| // static |