[cluttermm/cluttermm-1.2] Initial wrapping of ClutterInputDevice.



commit 2d2fbbbc57328d4b6b1465460ba238dd97a48883
Author: Chris Kühl <chrisk openismus com>
Date:   Sat Jan 22 14:39:30 2011 +0100

    Initial wrapping of ClutterInputDevice.
    
    * clutter/cluttermm.h: Added header file for new class.
    * clutter/src/input-device.[hg|ccg]: Initial wrapping of ClutterInputDevice.
    * clutter/src/clutter_signals.defs: Added properties for new class.
    * clutter/src/filelist.am: Added new classes to files_hg list.
    * codegen/extradefs/generate_extra_defs_clutter.cc: Added new class.
    * codegen/m4/convert_clutter.m4: Added enum conversion for Stage and
    InputDeviceType.

 ChangeLog                                        |   25 ++++++++-
 clutter/cluttermm.h                              |    3 +
 clutter/src/clutter_signals.defs                 |   58 ++++++++++++++++++++
 clutter/src/device-manager.ccg                   |   62 ++++++++++++++++++++++
 clutter/src/device-manager.hg                    |   53 ++++++++++++++++++
 clutter/src/filelist.am                          |    2 +
 clutter/src/input-device.ccg                     |   26 +++++++++
 clutter/src/input-device.hg                      |   53 ++++++++++++++++++
 codegen/extradefs/generate_extra_defs_clutter.cc |    3 +
 codegen/m4/convert_clutter.m4                    |   10 ++++
 10 files changed, 294 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b194ed7..24777d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2011-01-24  Chris Kühl  <chrisk openismus com>
+
+	Initial wrapping of ClutterDeviceManager.
+
+	* clutter/cluttermm.h: Added header file for new class.
+	* clutter/src/device-manager.[hg|ccg]: Initial wrapping of ClutterDeviceManager.
+	* clutter/src/clutter_signals.defs: Added properties for new class.
+	* clutter/src/filelist.am: Added new class to files_hg list.
+	* codegen/extradefs/generate_extra_defs_clutter.cc: Added new class.
+	* codegen/m4/convert_clutter.m4: Added DeviceManager & InputDevice conversions.
+
+2011-01-22  Chris Kühl  <chrisk openismus com>
+
+	Initial wrapping of ClutterInputDevice.
+
+	* clutter/cluttermm.h: Added header file for new class.
+	* clutter/src/input-device.[hg|ccg]: Initial wrapping of ClutterInputDevice.
+	* clutter/src/clutter_signals.defs: Added properties for new class.
+	* clutter/src/filelist.am: Added new classes to files_hg list.
+	* codegen/extradefs/generate_extra_defs_clutter.cc: Added new class.
+	* codegen/m4/convert_clutter.m4: Added enum conversion for Stage and
+	InputDeviceType.
+
 2011-01-21  Chris Kühl  <chrisk openismus com>
 
 	Sorted _EQUAL & _CONV_ENUM entries.
@@ -9,7 +32,7 @@
 	Initial wrapping of ClutterAnimator.
 
 	* clutter/cluttermm.h: Added header file for new class.
-	* clutter/src/animator.[hg|ccg]: Initial wrapping of ClutterFlowLayout.
+	* clutter/src/animator.[hg|ccg]: Initial wrapping of ClutterAnimator.
 	* clutter/src/clutter_signals.defs: Added properties for new class.
 	* clutter/src/filelist.am: Added new classes to files_hg list.
 	* codegen/extradefs/generate_extra_defs_clutter.cc: Added new class.
diff --git a/clutter/cluttermm.h b/clutter/cluttermm.h
index 4e83fef..e5cc6ac 100644
--- a/clutter/cluttermm.h
+++ b/clutter/cluttermm.h
@@ -57,6 +57,7 @@
 #include <cluttermm/actor.h>
 #include <cluttermm/alpha.h>
 #include <cluttermm/animation.h>
+#include <cluttermm/animator.h>
 #include <cluttermm/behaviour.h>
 #include <cluttermm/behaviour-depth.h>
 #include <cluttermm/behaviour-ellipse.h>
@@ -70,12 +71,14 @@
 #include <cluttermm/cairo-texture.h>
 #include <cluttermm/clone.h>
 #include <cluttermm/color.h>
+#include <cluttermm/device-manager.h>
 #include <cluttermm/event.h>
 #include <cluttermm/fixed-layout.h>
 #include <cluttermm/flow-layout.h>
 #include <cluttermm/frame-source.h>
 #include <cluttermm/group.h>
 #include <cluttermm/init.h>
+#include <cluttermm/input-device.h>
 #include <cluttermm/interval.h>
 #include <cluttermm/layout-manager.h>
 #include <cluttermm/layoutmeta.h>
diff --git a/clutter/src/clutter_signals.defs b/clutter/src/clutter_signals.defs
index 3dc9c8d..db284b7 100644
--- a/clutter/src/clutter_signals.defs
+++ b/clutter/src/clutter_signals.defs
@@ -2183,6 +2183,35 @@
   )
 )
 
+;; From ClutterDeviceManager
+
+(define-signal device-added
+  (of-object "ClutterDeviceManager")
+  (return-type "void")
+  (when "last")
+  (parameters
+    '("ClutterInputDevice*" "p0")
+  )
+)
+
+(define-signal device-removed
+  (of-object "ClutterDeviceManager")
+  (return-type "void")
+  (when "last")
+  (parameters
+    '("ClutterInputDevice*" "p0")
+  )
+)
+
+(define-property backend
+  (of-object "ClutterDeviceManager")
+  (prop-type "GParamObject")
+  (docs "The ClutterBackend of the device manager")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
 ;; From ClutterEvent
 
 ;; From FlowLayout
@@ -2667,6 +2696,35 @@
   (construct-only #f)
 )
 
+;; ClutterInputDevice
+
+(define-property id
+  (of-object "ClutterInputDevice")
+  (prop-type "GParamInt")
+  (docs "Unique identifier of the device")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property device-type
+  (of-object "ClutterInputDevice")
+  (prop-type "GParamEnum")
+  (docs "The type of the device")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property name
+  (of-object "ClutterInputDevice")
+  (prop-type "GParamString")
+  (docs "The name of the device")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
 ;; From ClutterInterval
 
 (define-property value-type
diff --git a/clutter/src/device-manager.ccg b/clutter/src/device-manager.ccg
new file mode 100644
index 0000000..9952272
--- /dev/null
+++ b/clutter/src/device-manager.ccg
@@ -0,0 +1,62 @@
+/* Copyright (C) 2011 The cluttermm Development Team
+ *
+ * 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; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <cluttermm/backend.h>
+#include <clutter/clutter.h>
+
+namespace Clutter
+{
+
+
+Glib::RefPtr<DeviceManager> DeviceManager::get_default()
+{
+  return Glib::wrap(clutter_device_manager_get_default());
+}
+
+std::vector<Glib::RefPtr<InputDevice> > DeviceManager::list_devices()
+{
+  GSList* deviceList = clutter_device_manager_list_devices(gobj());
+
+  const guint deviceCount = g_slist_length(deviceList);
+  std::vector<Glib::RefPtr<InputDevice> > deviceVec;
+  deviceVec.reserve(deviceCount);
+
+  for(GSList* deviceNode = deviceList; deviceNode->next; deviceNode = deviceList->next)
+  {
+    deviceVec.push_back(Glib::wrap(static_cast<ClutterInputDevice*>(deviceNode->data), true));
+  }
+
+  return deviceVec;
+}
+
+std::vector<Glib::RefPtr<const InputDevice> > DeviceManager::list_devices() const
+{
+  GSList* deviceList = clutter_device_manager_list_devices(const_cast<ClutterDeviceManager*>(gobj()));
+
+  const guint deviceCount = g_slist_length(deviceList);
+  std::vector<Glib::RefPtr<const InputDevice> > deviceVec;
+  deviceVec.reserve(deviceCount);
+
+  for(GSList* deviceNode = deviceList; deviceNode->next; deviceNode = deviceList->next)
+  {
+    deviceVec.push_back(Glib::wrap(static_cast<ClutterInputDevice*>(deviceNode->data), true));
+  }
+
+  return deviceVec;
+}
+
+} // namespace Clutter
diff --git a/clutter/src/device-manager.hg b/clutter/src/device-manager.hg
new file mode 100644
index 0000000..4b39e0b
--- /dev/null
+++ b/clutter/src/device-manager.hg
@@ -0,0 +1,53 @@
+/* Copyright (C) 2011 The cluttermm Development Team
+ *
+ * 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; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/object.h>
+#include <cluttermm/input-device.h>
+
+_DEFS(cluttermm,clutter)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Clutter
+{
+
+class Backend;
+
+class DeviceManager : public Glib::Object
+{
+  _CLASS_GOBJECT(DeviceManager, ClutterDeviceManager, CLUTTER_DEVICE_MANAGER, Glib::Object, GObject)
+
+protected:
+  _CTOR_DEFAULT()
+
+public:
+
+  Glib::RefPtr<DeviceManager> get_default();
+
+  _IGNORE(clutter_device_manager_peek_devices, clutter_device_manager_list_devices)
+  _WRAP_METHOD_DOCS_ONLY(clutter_device_manager_list_devices)
+  std::vector<Glib::RefPtr<InputDevice> >       list_devices();
+  std::vector<Glib::RefPtr<const InputDevice> > list_devices() const;
+
+  _WRAP_METHOD(Glib::RefPtr<InputDevice> get_device(int device_id), clutter_device_manager_get_device)
+  _WRAP_METHOD(Glib::RefPtr<InputDevice> get_core_device(InputDeviceType device_type), clutter_device_manager_get_core_device)
+
+  _IGNORE(clutter_get_input_device_for_id)
+
+  _WRAP_PROPERTY("backend", Glib::RefPtr<Backend>)
+};
+
+} // namespace Clutter
diff --git a/clutter/src/filelist.am b/clutter/src/filelist.am
index e796eb9..bf99b3d 100644
--- a/clutter/src/filelist.am
+++ b/clutter/src/filelist.am
@@ -31,10 +31,12 @@ files_hg =			\
 	clone.hg		\
 	color.hg		\
 	container.hg		\
+	device-manager.hg	\
 	effect.hg               \
 	fixed-layout.hg         \
 	flow-layout.hg          \
 	group.hg		\
+	input-device.hg		\
 	interval.hg		\
 	layoutmeta.hg		\
 	layout-manager.hg	\
diff --git a/clutter/src/input-device.ccg b/clutter/src/input-device.ccg
new file mode 100644
index 0000000..211e1c8
--- /dev/null
+++ b/clutter/src/input-device.ccg
@@ -0,0 +1,26 @@
+/* Copyright (C) 2011 The cluttermm Development Team
+ *
+ * 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; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <cluttermm/input-device.h>
+#include <cluttermm/stage.h>
+
+#include <clutter/clutter.h>
+
+namespace Clutter
+{
+
+} // namespace Clutter
diff --git a/clutter/src/input-device.hg b/clutter/src/input-device.hg
new file mode 100644
index 0000000..294579d
--- /dev/null
+++ b/clutter/src/input-device.hg
@@ -0,0 +1,53 @@
+/* Copyright (C) 2011 The cluttermm Development Team
+ *
+ * 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; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/object.h>
+
+_DEFS(cluttermm,clutter)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Clutter
+{
+
+_WRAP_ENUM(InputDeviceType, ClutterInputDeviceType)
+
+class Actor;
+class Stage;
+
+class InputDevice : public Glib::Object
+{
+  _CLASS_GOBJECT(InputDevice, ClutterInputDevice, CLUTTER_INPUT_DEVICE, Glib::Object, GObject)
+
+protected:
+  _CTOR_DEFAULT()
+
+public:
+
+  _WRAP_METHOD(int get_device_id() const, clutter_input_device_get_device_id)
+  _WRAP_METHOD(InputDeviceType get_device_type() const, clutter_input_device_get_device_type)
+  _WRAP_METHOD(Glib::ustring get_device_name() const, clutter_input_device_get_device_name)
+  _WRAP_METHOD(void get_device_coords(int &x, int &y) const, clutter_input_device_get_device_coords)
+  _WRAP_METHOD(Glib::RefPtr<Actor> get_pointer_actor() const, clutter_input_device_get_pointer_actor)
+  _WRAP_METHOD(Glib::RefPtr<Stage> get_pointer_stage() const, clutter_input_device_get_pointer_stage)
+  //_WRAP_METHOD(void update_from_event(const Event &event, bool update_stage), clutter_input_device_update_from_event)
+
+  _WRAP_PROPERTY("device-type", InputDeviceType)
+  _WRAP_PROPERTY("id", int)
+  _WRAP_PROPERTY("name", Glib::ustring)
+};
+
+} // namespace Clutter
diff --git a/codegen/extradefs/generate_extra_defs_clutter.cc b/codegen/extradefs/generate_extra_defs_clutter.cc
index 1e70177..fca0a0e 100644
--- a/codegen/extradefs/generate_extra_defs_clutter.cc
+++ b/codegen/extradefs/generate_extra_defs_clutter.cc
@@ -45,11 +45,14 @@ int main(int argc, char** argv)
     << get_defs(CLUTTER_TYPE_CLONE)
     << get_defs(CLUTTER_TYPE_COLOR)
     << get_defs(CLUTTER_TYPE_CONTAINER)
+    << get_defs(CLUTTER_TYPE_DEVICE_MANAGER)
+    << get_defs(CLUTTER_TYPE_EFFECT)
     << get_defs(CLUTTER_TYPE_EVENT)
     << get_defs(CLUTTER_TYPE_FIXED_LAYOUT)
     << get_defs(CLUTTER_TYPE_FLOW_LAYOUT)
     << get_defs(CLUTTER_TYPE_GROUP)
     << get_defs(CLUTTER_TYPE_INTERVAL)
+    << get_defs(CLUTTER_TYPE_INPUT_DEVICE)
 //    << get_defs(CLUTTER_TYPE_HBOX)
 //    << get_defs(CLUTTER_TYPE_LAYOUT)
     << get_defs(CLUTTER_TYPE_LAYOUT_MANAGER)
diff --git a/codegen/m4/convert_clutter.m4 b/codegen/m4/convert_clutter.m4
index a2fe2b7..c473dc3 100644
--- a/codegen/m4/convert_clutter.m4
+++ b/codegen/m4/convert_clutter.m4
@@ -35,6 +35,13 @@ _CONVERSION(`ClutterAnimator*',`Glib::RefPtr<const Animator>',`Glib::wrap($3)')
 _CONVERSION(`const Glib::RefPtr<Backend>&',`ClutterBackend*',__CONVERT_REFPTR_TO_P)
 _CONVERSION(`ClutterBackend*',`Glib::RefPtr<Backend>',`Glib::wrap($3)')
 
+_CONVERSION(`const Glib::RefPtr<InputDevice>&',`ClutterInputDevice*',__CONVERT_REFPTR_TO_P)
+_CONVERSION(`ClutterInputDevice*',`Glib::RefPtr<InputDevice>',`Glib::wrap($3)')
+_CONVERSION(`ClutterInputDevice*',`Glib::RefPtr<const InputDevice>',`Glib::wrap($3)')
+_CONVERSION(`ClutterInputDevice*',`const Glib::RefPtr<InputDevice>&', `Glib::wrap(($3),true)')
+
+_CONVERSION(`ClutterDeviceManager*',`Glib::RefPtr<DeviceManager>',`Glib::wrap($3)')
+
 _CONVERSION(`const Glib::RefPtr<Effect>&',`ClutterEffect*',__CONVERT_REFPTR_TO_P)
 _CONVERSION(`const Glib::RefPtr<const Effect>&',`ClutterEffect*',__CONVERT_CONST_REFPTR_TO_P)
 
@@ -74,6 +81,8 @@ _CONVERSION(`Color&',`ClutterColor*',`($3).gobj()')
 _CONVERSION(`const Color&',`const ClutterColor*',`($3).gobj()')
 _CONVERSION(`const Margin&',`const ClutterMargin*',`($3).gobj()')
 
+_CONVERSION(`ClutterStage*',`Glib::RefPtr<Stage>',`Glib::wrap($3)')
+
 _CONVERSION(`ClutterUnit&',`ClutterUnit*',`&($3)')
 _CONVERSION(`ClutterUnit*',`ClutterUnit&',`*($3)')
 _CONVERSION(`Knot&',`ClutterKnot*',`($3).gobj()')
@@ -125,6 +134,7 @@ _CONV_ENUM(Clutter,BinAlignment)
 _CONV_ENUM(Clutter,BoxAlignment)
 _CONV_ENUM(Clutter,FlowOrientation)
 _CONV_ENUM(Clutter,Gravity)
+_CONV_ENUM(Clutter,InputDeviceType)
 _CONV_ENUM(Clutter,Interpolation)
 _CONV_ENUM(Clutter,LayoutFlags)
 _CONV_ENUM(Clutter,PackType)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]