unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* guile-clutter, clutter-devel: add custom bindings for ClutterPoint and ClutterSize
@ 2014-04-28 19:20 David Pirotte
  0 siblings, 0 replies; only message in thread
From: David Pirotte @ 2014-04-28 19:20 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 134 bytes --]

Hello,

	guile-clutter
	  clutter-devel: add custom bindings for ClutterPoint and ClutterSize

Patch review solicited.

Thanks,
David

[-- Attachment #2: 0004-add-custom-bindings-for-ClutterPoint-and-ClutterSize.patch --]
[-- Type: text/x-patch, Size: 4075 bytes --]

From fd2da7831c966034649392ebac00214a3660b4cf Mon Sep 17 00:00:00 2001
From: David PIROTTE <david@altosw.be>
Date: Mon, 28 Apr 2014 16:12:45 -0300
Subject: [PATCH 4/4] add custom bindings for ClutterPoint and ClutterSize

* clutter/gnome/gw/clutter-spec.scm:
* clutter/gnome/gw/clutter-support.h:
* clutter/gnome/gw/clutter-support.c: add custom bindings and support
  code for ClutterPoint and ClutterSize
---
 clutter/gnome/gw/clutter-spec.scm  | 16 ++++++++++++++-
 clutter/gnome/gw/clutter-support.c | 41 +++++++++++++++++++++++++++++++++++++-
 clutter/gnome/gw/clutter-support.h | 11 +++++++++-
 3 files changed, 65 insertions(+), 3 deletions(-)

diff --git a/clutter/gnome/gw/clutter-spec.scm b/clutter/gnome/gw/clutter-spec.scm
index b34cd3a..436967e 100644
--- a/clutter/gnome/gw/clutter-spec.scm
+++ b/clutter/gnome/gw/clutter-spec.scm
@@ -1,5 +1,5 @@
 ;; guile-gnome
-;; Copyright (C) 2008,2012 Free Software Foundation, Inc.
+;; Copyright (C) 2008,2012,2014 Free Software Foundation, Inc.
 
 ;; This program is free software; you can redistribute it and/or    
 ;; modify it under the terms of the GNU General Public License as   
@@ -156,6 +156,20 @@
    ;; unwrap
    (list c-var " = scm_scm_to_clutter_perspective (" scm-var ");\n"))
 
+  (wrap-custom-boxed!
+   "ClutterPoint" "CLUTTER_TYPE_POINT"
+   ;; wrap
+   (list scm-var " = " c-var " ? scm_clutter_point_to_scm (" c-var ") : SCM_BOOL_F;\n")
+   ;; unwrap
+   (list c-var " = scm_scm_to_clutter_point (" scm-var ");\n"))
+
+  (wrap-custom-boxed!
+   "ClutterSize" "CLUTTER_TYPE_SIZE"
+   ;; wrap
+   (list scm-var " = " c-var " ? scm_clutter_size_to_scm (" c-var ") : SCM_BOOL_F;\n")
+   ;; unwrap
+   (list c-var " = scm_scm_to_clutter_size (" scm-var ");\n"))
+
   (wrap-opaque-pointer! ws "ClutterInputDevice*")
 
   (wrap-opaque-pointer! ws "ClutterEventSequence*")
diff --git a/clutter/gnome/gw/clutter-support.c b/clutter/gnome/gw/clutter-support.c
index e895d1e..ecba8f4 100644
--- a/clutter/gnome/gw/clutter-support.c
+++ b/clutter/gnome/gw/clutter-support.c
@@ -1,5 +1,5 @@
 /* guile-gnome
- * Copyright (C) 2008 Free Software Foundation, Inc.
+ * Copyright (C) 2008,2012,2014 Free Software Foundation, Inc.
  *
  * clutter-support.c: Support routines for the clutter wrapper
  *
@@ -298,3 +298,42 @@ wrap_clutter_units_from_string (const gchar *str)
   clutter_units_from_string (&units, str);
   return clutter_units_copy (&units);
 }
+
+
+/* Since 1.12 */
+
+SCM
+scm_clutter_point_to_scm (ClutterPoint *c)
+{
+    return scm_list_2 (scm_from_double (c->x),
+                       scm_from_double (c->y));
+}
+
+ClutterPoint*
+scm_scm_to_clutter_point (SCM scm)
+{
+    ClutterPoint ret;
+
+    ret.x = scm_to_double (scm_car (scm));
+    ret.y = scm_to_double (scm_cadr (scm));
+
+    return clutter_point_copy (&ret);
+}
+
+SCM
+scm_clutter_size_to_scm (ClutterSize *c)
+{
+    return scm_list_2 (scm_from_double (c->width),
+                       scm_from_double (c->height));
+}
+
+ClutterSize*
+scm_scm_to_clutter_size (SCM scm)
+{
+    ClutterSize ret;
+
+    ret.width = scm_to_double (scm_car (scm));
+    ret.height = scm_to_double (scm_cadr (scm));
+
+    return clutter_size_copy (&ret);
+}
diff --git a/clutter/gnome/gw/clutter-support.h b/clutter/gnome/gw/clutter-support.h
index 2f2bb62..c42fe1a 100644
--- a/clutter/gnome/gw/clutter-support.h
+++ b/clutter/gnome/gw/clutter-support.h
@@ -1,5 +1,5 @@
 /* guile-gnome
- * Copyright (C) 2008 Free Software Foundation, Inc.
+ * Copyright (C) 2008,2012,2014 Free Software Foundation, Inc.
  *
  * clutter-support.h:
  *
@@ -58,3 +58,12 @@ ClutterUnits* wrap_clutter_units_from_em_for_font (const gchar *font_name, gfloa
 ClutterUnits* wrap_clutter_units_from_mm (gfloat mm);
 ClutterUnits* wrap_clutter_units_from_pt (gfloat pt);
 ClutterUnits* wrap_clutter_units_from_string (const gchar *str);
+
+
+/* Since 1.12 */
+
+SCM scm_clutter_point_to_scm (ClutterPoint *k);
+ClutterPoint* scm_scm_to_clutter_point (SCM scm);
+
+SCM scm_clutter_size_to_scm (ClutterSize *k);
+ClutterSize* scm_scm_to_clutter_size (SCM scm);
-- 
1.9.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-04-28 19:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-28 19:20 guile-clutter, clutter-devel: add custom bindings for ClutterPoint and ClutterSize David Pirotte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).