From: David Pirotte <david@altosw.be>
To: guile-devel <guile-devel@gnu.org>
Subject: guile-clutter, clutter-devel: add custom bindings for ClutterPoint and ClutterSize
Date: Mon, 28 Apr 2014 16:20:21 -0300 [thread overview]
Message-ID: <20140428162021.2918b693@capac> (raw)
[-- 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
reply other threads:[~2014-04-28 19:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140428162021.2918b693@capac \
--to=david@altosw.be \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).