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

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: fix compile on windows 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
« no previous file with comments | « views/focus/accelerator_handler_touch.cc ('k') | views/touchui/touch_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/touchui/touch_factory.h
diff --git a/views/touchui/touch_factory.h b/views/touchui/touch_factory.h
index 04114be97d1491fd7d4bb1ead2ba4023412448ff..228812acb68b64b72c460af4d6d123cf9dca408c 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,40 @@ class TouchFactory {
// devices.
bool UngrabTouchDevices(Display* display);
+ // Update the root window to show (or hide) the cursor. Also indicate whether
+ // the timer should be started to automatically hide the cursor after a
+ // certain duration of inactivity (i.e. it is ignored if |show| is false).
+ void SetCursorVisible(bool show, bool start_timer);
+
+ // Whether the cursor is currently visible or not.
+ bool is_cursor_visible() {
+ return is_cursor_visible_;
+ }
+
private:
TouchFactory();
+ ~TouchFactory();
+
+ void HideCursorForInactivity() {
+ SetCursorVisible(false, 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 is_cursor_visible_;
+
+ // The cursor is hidden if it is idle for a certain amount time. This timer
+ // is used to keep track of the idleness.
+ base::OneShotTimer<TouchFactory> cursor_timer_;
+
+ // The invisible cursor.
+ Cursor invisible_cursor_;
+
// 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,
« no previous file with comments | « views/focus/accelerator_handler_touch.cc ('k') | views/touchui/touch_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698