* guile-clutter, clutter-devel: add custom bindings for ClutterRect
@ 2014-05-01 20:09 David Pirotte
0 siblings, 0 replies; only message in thread
From: David Pirotte @ 2014-05-01 20:09 UTC (permalink / raw)
To: guile-devel
[-- Attachment #1: Type: text/plain, Size: 117 bytes --]
Hello,
guile-clutter
clutter-devel: add custom bindings for ClutterRect
Patch review solicited.
Thanks,
David
[-- Attachment #2: 0005-add-custom-bindings-for-ClutterRect.patch --]
[-- Type: text/x-patch, Size: 2552 bytes --]
From 511cf91f53708978dae0ceb93d2288c5b1389427 Mon Sep 17 00:00:00 2001
From: David PIROTTE <david@altosw.be>
Date: Thu, 1 May 2014 17:06:19 -0300
Subject: [PATCH 5/5] add custom bindings for ClutterRect
* 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 ClutterRect
---
clutter/gnome/gw/clutter-spec.scm | 7 +++++++
clutter/gnome/gw/clutter-support.c | 22 ++++++++++++++++++++++
clutter/gnome/gw/clutter-support.h | 3 +++
3 files changed, 32 insertions(+)
diff --git a/clutter/gnome/gw/clutter-spec.scm b/clutter/gnome/gw/clutter-spec.scm
index 436967e..cd8d3d3 100644
--- a/clutter/gnome/gw/clutter-spec.scm
+++ b/clutter/gnome/gw/clutter-spec.scm
@@ -170,6 +170,13 @@
;; unwrap
(list c-var " = scm_scm_to_clutter_size (" scm-var ");\n"))
+ (wrap-custom-boxed!
+ "ClutterRect" "CLUTTER_TYPE_RECT"
+ ;; wrap
+ (list scm-var " = " c-var " ? scm_clutter_rect_to_scm (" c-var ") : SCM_BOOL_F;\n")
+ ;; unwrap
+ (list c-var " = scm_scm_to_clutter_rect (" 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 ecba8f4..e166dfb 100644
--- a/clutter/gnome/gw/clutter-support.c
+++ b/clutter/gnome/gw/clutter-support.c
@@ -337,3 +337,25 @@ scm_scm_to_clutter_size (SCM scm)
return clutter_size_copy (&ret);
}
+
+SCM
+scm_clutter_rect_to_scm (ClutterRect *rect)
+{
+ return scm_list_4 (scm_from_double (rect->origin.x),
+ scm_from_double (rect->origin.y),
+ scm_from_double (rect->size.width),
+ scm_from_double (rect->size.height));
+}
+
+ClutterRect*
+scm_scm_to_clutter_rect (SCM scm)
+{
+ ClutterRect ret;
+
+ ret.origin.x = scm_to_double (scm_car (scm));
+ ret.origin.y = scm_to_double (scm_cadr (scm));
+ ret.size.width = scm_to_double (scm_caddr (scm));
+ ret.size.height = scm_to_double (scm_cadddr (scm));
+
+ return clutter_rect_copy (&ret);
+};
diff --git a/clutter/gnome/gw/clutter-support.h b/clutter/gnome/gw/clutter-support.h
index c42fe1a..388858d 100644
--- a/clutter/gnome/gw/clutter-support.h
+++ b/clutter/gnome/gw/clutter-support.h
@@ -67,3 +67,6 @@ ClutterPoint* scm_scm_to_clutter_point (SCM scm);
SCM scm_clutter_size_to_scm (ClutterSize *k);
ClutterSize* scm_scm_to_clutter_size (SCM scm);
+
+SCM scm_clutter_rect_to_scm (ClutterRect *rect);
+ClutterRect* scm_scm_to_clutter_rect (SCM scm);
--
1.9.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-05-01 20:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-01 20:09 guile-clutter, clutter-devel: add custom bindings for ClutterRect 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).