[perl-Gtk3] Make Gtk3::Gdk::Window::new construct the mask automatically
- From: Torsten SchÃnfeld <tsch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Gtk3] Make Gtk3::Gdk::Window::new construct the mask automatically
- Date: Sat, 18 Feb 2012 21:32:48 +0000 (UTC)
commit 3d159b2f244c71637d5c77fc6ef888c7d5b63ac2
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date: Sat Feb 18 22:26:38 2012 +0100
Make Gtk3::Gdk::Window::new construct the mask automatically
If none is provided, infer the mask from the hash ref.
NEWS | 4 ++++
lib/Gtk3.pm | 20 ++++++++++++++++++++
t/overrides.t | 27 ++++++++++++++++++++++++++-
3 files changed, 50 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 068fcb5..2a2f085 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,9 @@
{{$NEXT}}
+* Make Gtk3::[HV]Box::new provide default arg values.
+* Make Gtk3::Gdk::Window::new construct the mask automatically if none is
+ given.
+
Overview of changes in Gtk3 0.003 [2012-01-14]
==============================================
diff --git a/lib/Gtk3.pm b/lib/Gtk3.pm
index 754ec75..ec41813 100644
--- a/lib/Gtk3.pm
+++ b/lib/Gtk3.pm
@@ -269,6 +269,26 @@ sub Gtk3::Window::new {
$_GTK_BASENAME, 'Window', 'new', $class, $type);
}
+# Gdk
+
+sub Gtk3::Gdk::Window::new {
+ my ($class, $parent, $attr, $attr_mask) = @_;
+ if (not defined $attr_mask) {
+ $attr_mask = Gtk3::Gdk::WindowAttributesType->new ([]);
+ if (exists $attr->{title}) { $attr_mask |= 'GDK_WA_TITLE' };
+ if (exists $attr->{x}) { $attr_mask |= 'GDK_WA_X' };
+ if (exists $attr->{y}) { $attr_mask |= 'GDK_WA_Y' };
+ if (exists $attr->{cursor}) { $attr_mask |= 'GDK_WA_CURSOR' };
+ if (exists $attr->{visual}) { $attr_mask |= 'GDK_WA_VISUAL' };
+ if (exists $attr->{wmclass_name} && exists $attr->{wmclass_class}) { $attr_mask |= 'GDK_WA_WMCLASS' };
+ if (exists $attr->{override_redirect}) { $attr_mask |= 'GDK_WA_NOREDIR' };
+ if (exists $attr->{type_hint}) { $attr_mask |= 'GDK_WA_TYPE_HINT' };
+ }
+ return Glib::Object::Introspection->invoke (
+ $_GDK_BASENAME, 'Window', 'new',
+ $class, $parent, $attr, $attr_mask);
+}
+
# - Helpers ----------------------------------------------------------------- #
sub _common_tree_model_new {
diff --git a/t/overrides.t b/t/overrides.t
index 03b5f73..b922256 100644
--- a/t/overrides.t
+++ b/t/overrides.t
@@ -5,7 +5,7 @@ BEGIN { require './t/inc/setup.pl' };
use strict;
use warnings;
-plan tests => 48;
+plan tests => 51;
# Gtk3::CHECK_VERSION and check_version
{
@@ -180,3 +180,28 @@ SKIP: {
is_deeply ([Gtk3::Window::list_toplevels ()], [$window1, $window2]);
is (scalar Gtk3::Window::list_toplevels (), $window2);
}
+
+# Gtk3::Gdk::Window::new
+SKIP: {
+ my $window = Gtk3::Gdk::Window->new (undef, {
+ window_type => 'toplevel',
+ });
+ isa_ok ($window, 'Gtk3::Gdk::Window');
+
+ # FIXME: https://bugzilla.gnome.org/show_bug.cgi?id=670369
+ skip 'window attr type annotation missing', 2;
+
+ $window = Gtk3::Gdk::Window->new (undef, {
+ window_type => 'toplevel',
+ width => 100, height => 50,
+ x => 100, y => 50,
+ }, [qw/x y/]);
+ isa_ok ($window, 'Gtk3::Gdk::Window');
+
+ $window = Gtk3::Gdk::Window->new (undef, {
+ window_type => 'toplevel',
+ width => 100, height => 50,
+ x => 100, y => 50,
+ });
+ isa_ok ($window, 'Gtk3::Gdk::Window');
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]