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

Unified Diff: views/touchui/touch_factory.h

Issue 6242012: touch: Hide the X cursor when not in use. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplify Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: views/touchui/touch_factory.h
diff --git a/views/touchui/touch_factory.h b/views/touchui/touch_factory.h
index 04114be97d1491fd7d4bb1ead2ba4023412448ff..25b87f00116b05eb23f8e0f4c01348e20c4327b9 100644
--- a/views/touchui/touch_factory.h
+++ b/views/touchui/touch_factory.h
@@ -10,7 +10,9 @@
#include <vector>
#include "base/singleton.h"
+#include "base/timer.h"
+typedef unsigned long Cursor;
typedef unsigned long Window;
typedef struct _XDisplay Display;
@@ -38,12 +40,38 @@ class TouchFactory {
// devices.
bool UngrabTouchDevices(Display* display);
+ // Update the root window to show (or hide) the cursor.
+ void SetCursorVisibility(bool show);
sky 2011/01/26 16:17:00 SetCursorVisible.
sadrul 2011/01/26 17:57:11 Done.
+
+ // Whether the cursor is currently visible or not.
+ bool IsCursorVisible() {
sky 2011/01/26 16:17:00 Name of method should match field name and be unix
sadrul 2011/01/26 17:57:11 Cool. Done.
+ return !hiding_cursor_;
+ }
+
private:
TouchFactory();
+ ~TouchFactory();
+
+ void HideCursorForInactivity() {
+ SetCursorVisibility(false);
+ }
+
// Requirement for Signleton
friend struct DefaultSingletonTraits<TouchFactory>;
+ // The default cursor is hidden after startup, and when the mouse pointer is
+ // idle for a while. Once there is some event from a mouse device, the cursor
+ // is immediately displayed.
+ bool hiding_cursor_;
+
+ // The cursor is hidden if it is idle for a certain amount time. This timer
+ // is used to keep track of the idleness.
+ base::DelayTimer<TouchFactory> cursor_timer_;
+
+ // The invisible cursor.
+ Cursor invisible_;
sky 2011/01/26 16:17:00 invisible_ -> invisible_cursor_
sadrul 2011/01/26 17:57:11 Done.
+
// NOTE: To keep track of touch devices, we currently maintain a lookup table
// to quickly decide if a device is a touch device or not. We also maintain a
// list of the touch devices. Ideally, there will be only one touch device,

Powered by Google App Engine
This is Rietveld 408576698