[perl-Gtk3] Always convert GdkRectangle objects to and from Cairo::RectangleInt
- From: Torsten SchÃnfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Gtk3] Always convert GdkRectangle objects to and from Cairo::RectangleInt
- Date: Sun, 26 Aug 2012 18:10:11 +0000 (UTC)
commit e834a4139da6ffe604ab0f78f15f3b006e5c5e21
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date: Sun Aug 26 19:36:04 2012 +0200
Always convert GdkRectangle objects to and from Cairo::RectangleInt
This uses the boxed synonyms machinery recently added to Glib and
Glib::Object::Introspection to make GdkRectangle a synonym for
CairoRectangleInt.
NEWS | 1 +
lib/Gtk3.pm | 7 +++++++
t/signals.t | 22 ++++++++++++++++++++++
3 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index 54792ea..73addf8 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@
* Add overrides for some Gtk3::RadioMenuItem constructors.
* Add overrides for Gtk3::CssProvider.
* Add overrides for Gtk3::UIManager.
+* Always convert GdkRectangle objects to and from Cairo::RectangleInt.
Overview of changes in Gtk3 0.007 [2012-07-05]
==============================================
diff --git a/lib/Gtk3.pm b/lib/Gtk3.pm
index 3b71255..9691060 100644
--- a/lib/Gtk3.pm
+++ b/lib/Gtk3.pm
@@ -171,6 +171,9 @@ sub import {
version => $_PANGO_VERSION,
package => $_PANGO_PACKAGE);
+ Glib::Object::Introspection->_register_boxed_synonym (
+ "cairo", "RectangleInt", "gdk_rectangle_get_type");
+
my $init = 0;
my @unknown_args = ($class);
foreach (@_) {
@@ -1007,6 +1010,10 @@ Gtk2::Gdk::Keysyms{XYZ} >>, use C<< Gtk3::Gdk::KEY_XYZ >>.
the namespace "Pango" everywhere. It gets set up automatically when loading
L<Gtk3>.
+=item * The types Gtk2::Allocation and Gtk2::Gdk::Rectangle are now aliases for
+Cairo::RectangleInt, and as such they are represented as plain hashes with
+keys 'width', 'height', 'x' and 'y'.
+
=item * The Gtk3::Menu menu position callback passed to popup() does not
receive x and y parameters anymore.
diff --git a/t/signals.t b/t/signals.t
new file mode 100644
index 0000000..8b40b7e
--- /dev/null
+++ b/t/signals.t
@@ -0,0 +1,22 @@
+#!/usr/bin/env perl
+
+BEGIN { require './t/inc/setup.pl' };
+
+use strict;
+use warnings;
+
+plan tests => 3;
+
+# Gtk3::Widget.size-allocate
+{
+ my $window = Gtk3::Window->new;
+ my $alloc = {x => 10, y => 10, width => 100, height => 100};
+ my $data = [23, 42];
+ $window->signal_connect (size_allocate => sub {
+ my ($cb_window, $cb_alloc, $cb_data) = @_;
+ is ($cb_window, $window);
+ is_deeply ($cb_alloc, $alloc);
+ is_deeply ($cb_data, $data);
+ }, $data);
+ $window->signal_emit (size_allocate => $alloc);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]