gdk3 1.2.4 → 1.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
4
4
  * Copyright (C) 2002,2003 Ruby-GNOME2 Project Team
5
5
  * Copyright (C) 1998-2000 Yukihiro Matsumoto,
6
6
  * Daisuke Kanda,
@@ -30,13 +30,13 @@
30
30
  static VALUE
31
31
  rg_initialize(VALUE self, VALUE red, VALUE green, VALUE blue)
32
32
  {
33
- GdkColor c;
34
- c.pixel = 0;
35
- c.red = NUM2INT(red);
36
- c.green = NUM2INT(green);
37
- c.blue = NUM2INT(blue);
33
+ GdkColor color;
34
+ color.pixel = 0;
35
+ color.red = NUM2INT(red);
36
+ color.green = NUM2INT(green);
37
+ color.blue = NUM2INT(blue);
38
38
 
39
- G_INITIALIZE(self, &c);
39
+ G_INITIALIZE(self, g_boxed_copy(GDK_TYPE_COLOR, &color));
40
40
 
41
41
  return Qnil;
42
42
  }
@@ -53,8 +53,9 @@ gdk_geometry_get_type(void)
53
53
  static VALUE
54
54
  rg_initialize(VALUE self)
55
55
  {
56
- GdkGeometry g;
57
- G_INITIALIZE(self, &g);
56
+ GdkGeometry geometry;
57
+ memset(&geometry, 0, sizeof(GdkGeometry));
58
+ G_INITIALIZE(self, g_boxed_copy(GDK_TYPE_GEOMETRY, &geometry));
58
59
  return Qnil;
59
60
  }
60
61
 
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
4
4
  * Copyright (C) 2002,2003 Masao Mutoh
5
5
  * Copyright (C) 1998-2000 Yukihiro Matsumoto,
6
6
  * Daisuke Kanda,
@@ -30,14 +30,14 @@
30
30
  static VALUE
31
31
  rg_initialize(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height)
32
32
  {
33
- GdkRectangle new;
33
+ GdkRectangle rectangle;
34
34
 
35
- new.x = NUM2INT(x);
36
- new.y = NUM2INT(y);
37
- new.width = NUM2INT(width);
38
- new.height = NUM2INT(height);
35
+ rectangle.x = NUM2INT(x);
36
+ rectangle.y = NUM2INT(y);
37
+ rectangle.width = NUM2INT(width);
38
+ rectangle.height = NUM2INT(height);
39
39
 
40
- G_INITIALIZE(self, &new);
40
+ G_INITIALIZE(self, g_boxed_copy(GDK_TYPE_RECTANGLE, &rectangle));
41
41
  return Qnil;
42
42
  }
43
43
 
@@ -35,14 +35,14 @@ rg_s_parse(G_GNUC_UNUSED VALUE self, VALUE spec)
35
35
  static VALUE
36
36
  rg_initialize(VALUE self, VALUE red, VALUE green, VALUE blue, VALUE alpha)
37
37
  {
38
- GdkRGBA color;
38
+ GdkRGBA rgba;
39
39
 
40
- color.red = NUM2DBL(red);
41
- color.green = NUM2DBL(green);
42
- color.blue = NUM2DBL(blue);
43
- color.alpha = NUM2DBL(alpha);
40
+ rgba.red = NUM2DBL(red);
41
+ rgba.green = NUM2DBL(green);
42
+ rgba.blue = NUM2DBL(blue);
43
+ rgba.alpha = NUM2DBL(alpha);
44
44
 
45
- G_INITIALIZE(self, &color);
45
+ G_INITIALIZE(self, g_boxed_copy(GDK_TYPE_RGBA, &rgba));
46
46
 
47
47
  return Qnil;
48
48
  }
@@ -102,11 +102,11 @@ rg_set_alpha(VALUE self, VALUE alpha)
102
102
  static VALUE
103
103
  rg_to_a(VALUE self)
104
104
  {
105
- GdkRGBA *color = _SELF(self);
106
- return rb_ary_new3(4, DBL2NUM(color->red),
107
- DBL2NUM(color->green),
108
- DBL2NUM(color->blue),
109
- DBL2NUM(color->alpha));
105
+ GdkRGBA *rgba = _SELF(self);
106
+ return rb_ary_new3(4, DBL2NUM(rgba->red),
107
+ DBL2NUM(rgba->green),
108
+ DBL2NUM(rgba->blue),
109
+ DBL2NUM(rgba->alpha));
110
110
  }
111
111
 
112
112
  static VALUE
@@ -1019,9 +1019,8 @@ Init_gdk_window(VALUE mGdk)
1019
1019
  RG_DEF_METHOD(drag_protocol, 0);
1020
1020
 
1021
1021
  G_DEF_CLASS(GDK_TYPE_WINDOW_TYPE, "Type", RG_TARGET_NAMESPACE);
1022
- /* TODO
1023
- G_DEF_CLASS(GDK_TYPE_WINDOW_CLASS, "Class", RG_TARGET_NAMESPACE);
1024
- */
1022
+ G_DEF_CLASS(GDK_TYPE_WINDOW_WINDOW_CLASS, "WindowClass",
1023
+ RG_TARGET_NAMESPACE);
1025
1024
  G_DEF_CLASS(GDK_TYPE_WINDOW_HINTS, "Hints", RG_TARGET_NAMESPACE);
1026
1025
  G_DEF_CLASS(GDK_TYPE_GRAVITY, "Gravity", RG_TARGET_NAMESPACE);
1027
1026
  G_DEF_CLASS(GDK_TYPE_WINDOW_EDGE, "Edge", RG_TARGET_NAMESPACE);
@@ -51,12 +51,12 @@ static VALUE
51
51
  rg_initialize(VALUE self, VALUE width, VALUE height, VALUE wclass,
52
52
  VALUE window_type)
53
53
  {
54
- GdkWindowAttr w;
55
- w.width = NUM2INT(width);
56
- w.height = NUM2INT(height);
57
- w.wclass = RVAL2GDKWINDOWWINDOWCLASS(wclass);
58
- w.window_type = RVAL2GDKWINDOWTYPE(window_type);
59
- G_INITIALIZE(self, &w);
54
+ GdkWindowAttr attribute;
55
+ attribute.width = NUM2INT(width);
56
+ attribute.height = NUM2INT(height);
57
+ attribute.wclass = RVAL2GDKWINDOWWINDOWCLASS(wclass);
58
+ attribute.window_type = RVAL2GDKWINDOWTYPE(window_type);
59
+ G_INITIALIZE(self, g_boxed_copy(GDK_TYPE_WINDOW_ATTR, &attribute));
60
60
  return Qnil;
61
61
  }
62
62
 
@@ -132,6 +132,7 @@ module Gdk
132
132
  define_deprecated_flags :ModifierType
133
133
  define_deprecated_enums :Type
134
134
  define_deprecated_enums :TypeHint, 'TYPE_HINT'
135
+ define_deprecated_enums :WindowClass
135
136
  define_deprecated_flags :WMDecoration, 'DECOR'
136
137
  define_deprecated_flags :WMFunction, 'FUNC'
137
138
  define_deprecated_method :clear, :warn => "Don't use this method."
@@ -0,0 +1,21 @@
1
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ require "test-unit"
18
+ require "test/unit/notify"
19
+
20
+ module GdkTestUtils
21
+ end
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..")
20
+ ruby_gnome2_base = File.expand_path(ruby_gnome2_base)
21
+
22
+ glib_base = File.join(ruby_gnome2_base, "glib2")
23
+ atk_base = File.join(ruby_gnome2_base, "atk")
24
+ pango_base = File.join(ruby_gnome2_base, "pango")
25
+ gdk_pixbuf_base = File.join(ruby_gnome2_base, "gdk_pixbuf2")
26
+ gdk3_base = File.join(ruby_gnome2_base, "gdk3")
27
+
28
+ [[glib_base, "glib2"],
29
+ [atk_base, "atk"],
30
+ [pango_base, "pango"],
31
+ [gdk_pixbuf_base, "gdk_pixbuf2"],
32
+ [gdk3_base, "gdk3"]].each do |target, module_name|
33
+ if system("which make > /dev/null")
34
+ `make -C #{target.dump} > /dev/null` or exit(false)
35
+ end
36
+ $LOAD_PATH.unshift(File.join(target, "ext", module_name))
37
+ $LOAD_PATH.unshift(File.join(target, "lib"))
38
+ end
39
+
40
+ $LOAD_PATH.unshift(File.join(glib_base, "test"))
41
+ require "glib-test-init"
42
+
43
+ $LOAD_PATH.unshift(File.join(gdk3_base, "test"))
44
+ require "gdk-test-utils"
45
+
46
+ require "gdk3"
47
+
48
+ exit Test::Unit::AutoRunner.run(true)
@@ -0,0 +1,24 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ class TestGdkColor < Test::Unit::TestCase
20
+ def test_to_s
21
+ color = Gdk::Color.new(0xffff, 0x1234, 0xabcd)
22
+ assert_equal("#ffff1234abcd", color.to_s)
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ class TestGdkGeometry < Test::Unit::TestCase
20
+ def test_min_width
21
+ geometry = Gdk::Geometry.new
22
+ assert_equal(0, geometry.min_width)
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ class TestGdkRectangle < Test::Unit::TestCase
20
+ def test_width
21
+ rectangle = Gdk::Rectangle.new(0, 10, 20, 30)
22
+ assert_equal(20, rectangle.width)
23
+ end
24
+ end
@@ -0,0 +1,24 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ class TestGdkRGBA < Test::Unit::TestCase
20
+ def test_to_s
21
+ rgba = Gdk::RGBA.new(0.1, 0.2, 0.3, 0.5)
22
+ assert_equal("rgba(26,51,77,0.5)", rgba.to_s)
23
+ end
24
+ end
@@ -0,0 +1,32 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2013 Ruby-GNOME2 Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+
19
+ class TestGdkWindowAttr < Test::Unit::TestCase
20
+ include GdkTestUtils
21
+
22
+ def test_initialize
23
+ attrs = Gdk::WindowAttr.new(100, 100, :input_only, :temp)
24
+ assert_equal([
25
+ 100,
26
+ 100,
27
+ Gdk::Window::WindowClass::INPUT_ONLY,
28
+ Gdk::Window::Type::TEMP,
29
+ ],
30
+ [attrs.width, attrs.height, attrs.wclass, attrs.window_type])
31
+ end
32
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gdk3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-24 00:00:00.000000000 Z
12
+ date: 2013-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: atk
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.2.4
21
+ version: 1.2.5
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: 1.2.4
29
+ version: 1.2.5
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: pango
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
- version: 1.2.4
37
+ version: 1.2.5
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
- version: 1.2.4
45
+ version: 1.2.5
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: gdk_pixbuf2
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
- version: 1.2.4
53
+ version: 1.2.5
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
- version: 1.2.4
61
+ version: 1.2.5
62
62
  description: Ruby/GDK3 is a Ruby binding of GDK-3.x.
63
63
  email: ruby-gnome2-devel-en@lists.sourceforge.net
64
64
  executables: []
@@ -109,6 +109,13 @@ files:
109
109
  - ext/gdk3/rbgdkwindowattr.c
110
110
  - ext/gdk3/rbgdkx11.c
111
111
  - ext/gdk3/rbgdkx11x11window.c
112
+ - test/gdk-test-utils.rb
113
+ - test/run-test.rb
114
+ - test/test-gdk-color.rb
115
+ - test/test-gdk-geometry.rb
116
+ - test/test-gdk-rectangle.rb
117
+ - test/test-gdk-rgba.rb
118
+ - test/test-gdk-window-attr.rb
112
119
  homepage: http://ruby-gnome2.sourceforge.jp/
113
120
  licenses: []
114
121
  post_install_message: This library is experimental.