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

Side by Side Diff: ui/aura/root_window_host_linux.cc

Issue 9463003: aura-x11: Add custom web cursor support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura/root_window_host_linux.h ('k') | ui/aura/root_window_host_win.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 (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/aura/root_window_host_linux.h" 5 #include "ui/aura/root_window_host_linux.h"
6 6
7 #include <X11/cursorfont.h> 7 #include <X11/cursorfont.h>
8 #include <X11/extensions/XInput2.h> 8 #include <X11/extensions/XInput2.h>
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 case aura::kCursorAlias: 145 case aura::kCursorAlias:
146 case aura::kCursorProgress: 146 case aura::kCursorProgress:
147 case aura::kCursorNoDrop: 147 case aura::kCursorNoDrop:
148 case aura::kCursorCopy: 148 case aura::kCursorCopy:
149 case aura::kCursorNone: 149 case aura::kCursorNone:
150 case aura::kCursorNotAllowed: 150 case aura::kCursorNotAllowed:
151 case aura::kCursorZoomIn: 151 case aura::kCursorZoomIn:
152 case aura::kCursorZoomOut: 152 case aura::kCursorZoomOut:
153 case aura::kCursorGrab: 153 case aura::kCursorGrab:
154 case aura::kCursorGrabbing: 154 case aura::kCursorGrabbing:
155 // TODO(jamescook): Need cursors for these. crbug.com/111650
156 return XC_left_ptr;
155 case aura::kCursorCustom: 157 case aura::kCursorCustom:
156 // TODO(jamescook): Need cursors for these. crbug.com/111650 158 NOTREACHED();
sadrul 2012/02/24 17:38:19 Too heavy-handed?
Daniel Erat 2012/02/24 18:05:47 No, this seems reasonable to me.
157 return XC_left_ptr; 159 return XC_left_ptr;
158 } 160 }
159 NOTREACHED(); 161 NOTREACHED();
160 return XC_left_ptr; 162 return XC_left_ptr;
161 } 163 }
162 164
163 // Coalesce all pending motion events that are at the top of the queue, and 165 // Coalesce all pending motion events that are at the top of the queue, and
164 // return the number eliminated, storing the last one in |last_event|. 166 // return the number eliminated, storing the last one in |last_event|.
165 int CoalescePendingXIMotionEvents(const XEvent* xev, XEvent* last_event) { 167 int CoalescePendingXIMotionEvents(const XEvent* xev, XEvent* last_event) {
166 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev->xcookie.data); 168 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev->xcookie.data);
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 current_cursor_ = cursor; 545 current_cursor_ = cursor;
544 546
545 // Custom web cursors are handled directly. 547 // Custom web cursors are handled directly.
546 if (cursor == kCursorCustom) 548 if (cursor == kCursorCustom)
547 return; 549 return;
548 550
549 if (cursor_shown_) 551 if (cursor_shown_)
550 SetCursorInternal(cursor); 552 SetCursorInternal(cursor);
551 } 553 }
552 554
555 void RootWindowHostLinux::SetCustomCursor(const gfx::PlatformCursor& cursor) {
556 if (cursor_shown_)
557 XDefineCursor(xdisplay_, xwindow_, cursor);
558 }
559
553 void RootWindowHostLinux::ShowCursor(bool show) { 560 void RootWindowHostLinux::ShowCursor(bool show) {
554 if (show == cursor_shown_) 561 if (show == cursor_shown_)
555 return; 562 return;
556 cursor_shown_ = show; 563 cursor_shown_ = show;
557 SetCursorInternal(show ? current_cursor_ : kCursorNone); 564 SetCursorInternal(show ? current_cursor_ : kCursorNone);
558 } 565 }
559 566
560 gfx::Point RootWindowHostLinux::QueryMouseLocation() { 567 gfx::Point RootWindowHostLinux::QueryMouseLocation() {
561 ::Window root_return, child_return; 568 ::Window root_return, child_return;
562 int root_x_return, root_y_return, win_x_return, win_y_return; 569 int root_x_return, root_y_return, win_x_return, win_y_return;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 return new RootWindowHostLinux(bounds); 661 return new RootWindowHostLinux(bounds);
655 } 662 }
656 663
657 // static 664 // static
658 gfx::Size RootWindowHost::GetNativeScreenSize() { 665 gfx::Size RootWindowHost::GetNativeScreenSize() {
659 ::Display* xdisplay = base::MessagePumpX::GetDefaultXDisplay(); 666 ::Display* xdisplay = base::MessagePumpX::GetDefaultXDisplay();
660 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); 667 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0));
661 } 668 }
662 669
663 } // namespace aura 670 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/root_window_host_linux.h ('k') | ui/aura/root_window_host_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698