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

Unified Diff: chrome/common/gtk_util.cc

Issue 155194: linux: port Jankometer (Closed)
Patch Set: ok Created 11 years, 5 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 | « chrome/common/gtk_util.h ('k') | chrome/common/temp_scaffolding_stubs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/gtk_util.cc
diff --git a/chrome/common/gtk_util.cc b/chrome/common/gtk_util.cc
index c126cacd4469688599c63aec94e9920038679b73..e985bf676cb93fba9bdd96232016606bb7aef0ef 100644
--- a/chrome/common/gtk_util.cc
+++ b/chrome/common/gtk_util.cc
@@ -61,6 +61,79 @@ WindowOpenDisposition DispositionFromEventFlags(guint event_flags) {
return false /*event.IsAltDown()*/ ? SAVE_TO_DISK : CURRENT_TAB;
}
+guint32 GetGdkEventTime(GdkEvent* event) {
+ // The order of these entries in the switch statement match the GDK enum.
+ switch (event->type) {
+ case GDK_NOTHING:
+ case GDK_DELETE:
+ case GDK_DESTROY:
+ case GDK_EXPOSE:
+ return 0;
+
+ case GDK_MOTION_NOTIFY:
+ return reinterpret_cast<GdkEventMotion*>(event)->time;
+
+ case GDK_BUTTON_PRESS:
+ case GDK_2BUTTON_PRESS:
+ case GDK_3BUTTON_PRESS:
+ case GDK_BUTTON_RELEASE:
+ return reinterpret_cast<GdkEventButton*>(event)->time;
+
+ case GDK_KEY_PRESS:
+ case GDK_KEY_RELEASE:
+ return reinterpret_cast<GdkEventKey*>(event)->time;
+
+ case GDK_ENTER_NOTIFY:
+ case GDK_LEAVE_NOTIFY:
+ return reinterpret_cast<GdkEventCrossing*>(event)->time;
+
+ case GDK_FOCUS_CHANGE:
+ case GDK_CONFIGURE:
+ case GDK_MAP:
+ case GDK_UNMAP:
+ return 0;
+
+ case GDK_PROPERTY_NOTIFY:
+ return reinterpret_cast<GdkEventProperty*>(event)->time;
+
+ case GDK_SELECTION_CLEAR:
+ case GDK_SELECTION_REQUEST:
+ case GDK_SELECTION_NOTIFY:
+ return reinterpret_cast<GdkEventSelection*>(event)->time;
+
+ case GDK_PROXIMITY_IN:
+ case GDK_PROXIMITY_OUT:
+ return reinterpret_cast<GdkEventProximity*>(event)->time;
+
+ case GDK_DRAG_ENTER:
+ case GDK_DRAG_LEAVE:
+ case GDK_DRAG_MOTION:
+ case GDK_DRAG_STATUS:
+ case GDK_DROP_START:
+ case GDK_DROP_FINISHED:
+ return reinterpret_cast<GdkEventDND*>(event)->time;
+
+ case GDK_CLIENT_EVENT:
+ case GDK_VISIBILITY_NOTIFY:
+ case GDK_NO_EXPOSE:
+ return 0;
+
+ case GDK_SCROLL:
+ return reinterpret_cast<GdkEventScroll*>(event)->time;
+
+ case GDK_WINDOW_STATE:
+ case GDK_SETTING:
+ return 0;
+
+ case GDK_OWNER_CHANGE:
+ return reinterpret_cast<GdkEventOwnerChange*>(event)->time;
+
+ case GDK_GRAB_BROKEN:
+ default:
+ return 0;
+ }
+}
+
} // namespace event_utils
namespace gtk_util {
« no previous file with comments | « chrome/common/gtk_util.h ('k') | chrome/common/temp_scaffolding_stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698