[maemo-commits] [maemo-commits] r8205 - in projects/haf/trunk/hildon-libs: . hildon-widgets

From: mdk at stage.maemo.org mdk at stage.maemo.org
Date: Tue Nov 21 13:16:55 EET 2006
Author: mdk
Date: 2006-11-21 13:16:54 +0200 (Tue, 21 Nov 2006)
New Revision: 8205

Added:
   projects/haf/trunk/hildon-libs/hildon-widgets/hildon-finger.c
   projects/haf/trunk/hildon-libs/hildon-widgets/hildon-finger.h
Modified:
   projects/haf/trunk/hildon-libs/ChangeLog
   projects/haf/trunk/hildon-libs/hildon-widgets/Makefile.am
Log:
2006-11-21  Tomas Junnonen <tomas.junnonen at nokia.com>

	* hildon-widgets/Makefile.am:
	* hildon-widgets/hildon-finger.c:
	* hildon-widgets/hildon-finger.h: Finger events stuff.


Modified: projects/haf/trunk/hildon-libs/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-libs/ChangeLog	2006-11-21 11:09:50 UTC (rev 8204)
+++ projects/haf/trunk/hildon-libs/ChangeLog	2006-11-21 11:16:54 UTC (rev 8205)
@@ -1,3 +1,9 @@
+2006-11-21  Tomas Junnonen <tomas.junnonen at nokia.com>
+
+	* hildon-widgets/Makefile.am:
+	* hildon-widgets/hildon-finger.c:
+	* hildon-widgets/hildon-finger.h: Finger events stuff.
+
 2006-11-08  Michael Dominic Kostrzewa  <michael.kostrzewa at nokia.com> 
 
 	* hildon-widgets/hildon-libs.c:

Modified: projects/haf/trunk/hildon-libs/hildon-widgets/Makefile.am
===================================================================
--- projects/haf/trunk/hildon-libs/hildon-widgets/Makefile.am	2006-11-21 11:09:50 UTC (rev 8204)
+++ projects/haf/trunk/hildon-libs/hildon-widgets/Makefile.am	2006-11-21 11:16:54 UTC (rev 8205)
@@ -114,6 +114,8 @@
 	hildon-color-chooser-dialog.h \
 	hildon-color-chooser-button.c \
 	hildon-color-chooser-button.h \
+	hildon-finger.c \
+	hildon-finger.h \
 	$(hildonlibs_built_headers) \
 	$(hildonlibs_built_cfiles)
 
@@ -175,7 +177,8 @@
 	hildon-plugin-widget.h \
 	hildon-color-chooser.h \
 	hildon-color-chooser-dialog.h \
-	hildon-color-chooser-button.h
+	hildon-color-chooser-button.h \
+	hildon-finger.h
 
 headers_to_scan_for_enums = $(hildonwidgetsincludeinst_DATA)
  

Added: projects/haf/trunk/hildon-libs/hildon-widgets/hildon-finger.c
===================================================================
--- projects/haf/trunk/hildon-libs/hildon-widgets/hildon-finger.c	2006-11-21 11:09:50 UTC (rev 8204)
+++ projects/haf/trunk/hildon-libs/hildon-widgets/hildon-finger.c	2006-11-21 11:16:54 UTC (rev 8205)
@@ -0,0 +1,64 @@
+/*
+ * This file is part of hildon-libs
+ *
+ * Copyright (C) 2006 Nokia Corporation, all rights reserved.
+ *
+ * Contact: Michael Dominic Kostrzewa <michael.kostrzewa at nokia.com>
+ *  Author: Tomas Junnonen <tomas.junnonen at nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; version 2.1 of
+ * the License.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+/**
+ * SECTION:hildon-finger
+ * @short_description: Helper functions for finger functionality
+ *
+ */
+
+#include <gdk/gdk.h>
+#include "hildon-finger.h"
+
+#define HILDON_FINGER_BUTTON 8
+#define HILDON_FINGER_ALT_BUTTON 1
+#define HILDON_FINGER_ALT_MASK GDK_MOD4_MASK
+#define HILDON_FINGER_SIMULATE_BUTTON 2
+
+/**
+ * hildon_button_event_is_finger:
+ * 
+ * Check if the event is a finger event
+ **/
+gboolean hildon_button_event_is_finger (GdkEventButton *event)
+{
+  gdouble pressure;
+
+  if (gdk_event_get_axis ((GdkEvent*)event, GDK_AXIS_PRESSURE, &pressure) &&
+      pressure > HILDON_FINGER_PRESSURE_THRESHOLD)
+    return TRUE;
+
+  if (event->button == HILDON_FINGER_BUTTON)
+    return TRUE;
+
+  if (event->button == HILDON_FINGER_ALT_BUTTON &&
+      event->state & HILDON_FINGER_ALT_MASK)
+    return TRUE;
+
+  if (event->button == HILDON_FINGER_SIMULATE_BUTTON)
+    return TRUE;
+
+  return FALSE;
+}

Added: projects/haf/trunk/hildon-libs/hildon-widgets/hildon-finger.h
===================================================================
--- projects/haf/trunk/hildon-libs/hildon-widgets/hildon-finger.h	2006-11-21 11:09:50 UTC (rev 8204)
+++ projects/haf/trunk/hildon-libs/hildon-widgets/hildon-finger.h	2006-11-21 11:16:54 UTC (rev 8205)
@@ -0,0 +1,38 @@
+/*
+ * This file is part of hildon-libs
+ *
+ * Copyright (C) 2006 Nokia Corporation, all rights reserved.
+ *
+ * Contact: Michael Dominic Kostrzewa <michael.kostrzewa at nokia.com>
+ *  Author: Tomas Junnonen <tomas.junnonen at nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; version 2.1 of
+ * the License.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef __HILDON_FINGER_H__
+#define __HILDON_FINGER_H__
+
+#include <gdk/gdkevents.h>
+
+G_BEGIN_DECLS
+
+#define HILDON_FINGER_PRESSURE_THRESHOLD 0.4
+
+gboolean hildon_button_event_is_finger (GdkEventButton *event);
+
+G_END_DECLS
+#endif /* HILDON_FINGER_H */


More information about the maemo-commits mailing list