clutter 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +9 -2
- data/lib/clutter.rb +19 -6
- data/lib/clutter/color.rb +33 -5
- data/sample/basic-actor.rb +0 -2
- data/sample/bin-layout.rb +0 -2
- data/sample/box-layout.rb +0 -2
- data/sample/canvas.rb +2 -4
- data/sample/constraints.rb +0 -2
- data/sample/drag-action.rb +0 -2
- data/sample/drop-action.rb +4 -6
- data/sample/easing-modes.rb +0 -2
- data/sample/flow-layout.rb +0 -2
- data/sample/grid-layout.rb +0 -2
- data/sample/image-content.rb +0 -2
- data/sample/pan-action.rb +0 -2
- data/sample/rounded-rectangle.rb +0 -2
- data/sample/scroll-actor.rb +0 -2
- data/test/run-test.rb +7 -3
- data/test/test-clutter-color.rb +42 -0
- metadata +11 -10
data/Rakefile
CHANGED
@@ -92,7 +92,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
|
|
92
92
|
:name => "json-glib",
|
93
93
|
:download_site => :gnome,
|
94
94
|
:label => "JSON-GLib",
|
95
|
-
:version => "0.
|
95
|
+
:version => "0.16.0",
|
96
96
|
:compression_method => "xz",
|
97
97
|
:windows => {
|
98
98
|
:configure_args => [
|
@@ -104,7 +104,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
|
|
104
104
|
:name => "clutter",
|
105
105
|
:download_site => :gnome,
|
106
106
|
:label => "Clutter",
|
107
|
-
:version => "1.14.
|
107
|
+
:version => "1.14.4",
|
108
108
|
:compression_method => "xz",
|
109
109
|
:windows => {
|
110
110
|
:configure_args => [
|
@@ -114,6 +114,13 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
|
|
114
114
|
},
|
115
115
|
}
|
116
116
|
]
|
117
|
+
package.cross_compiling do |spec|
|
118
|
+
if /mingw|mswin/ =~ spec.platform.to_s
|
119
|
+
spec.add_runtime_dependency("atk", "= #{package.version}")
|
120
|
+
spec.add_runtime_dependency("pango", "= #{package.version}")
|
121
|
+
spec.add_runtime_dependency("gdk_pixbuf2", "= #{package.version}")
|
122
|
+
end
|
123
|
+
end
|
117
124
|
end
|
118
125
|
package_task.define
|
119
126
|
|
data/lib/clutter.rb
CHANGED
@@ -34,11 +34,17 @@ module Clutter
|
|
34
34
|
LOG_DOMAIN = "Clutter"
|
35
35
|
GLib::Log.set_log_domain(LOG_DOMAIN)
|
36
36
|
|
37
|
-
@initialized = false
|
38
37
|
class << self
|
39
|
-
def
|
40
|
-
|
41
|
-
|
38
|
+
def const_missing(name)
|
39
|
+
init()
|
40
|
+
if const_defined?(name)
|
41
|
+
const_get(name)
|
42
|
+
else
|
43
|
+
super
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def init(argv=[])
|
42
48
|
loader = Loader.new(self, argv)
|
43
49
|
loader.load("Clutter")
|
44
50
|
require "clutter/actor"
|
@@ -50,6 +56,10 @@ module Clutter
|
|
50
56
|
require "clutter/point"
|
51
57
|
require "clutter/text"
|
52
58
|
require "clutter/threads"
|
59
|
+
class << self
|
60
|
+
remove_method(:init)
|
61
|
+
remove_method(:const_missing)
|
62
|
+
end
|
53
63
|
end
|
54
64
|
end
|
55
65
|
|
@@ -68,8 +78,11 @@ module Clutter
|
|
68
78
|
private
|
69
79
|
def pre_load(repository, namespace)
|
70
80
|
init = repository.find(namespace, "init")
|
71
|
-
|
72
|
-
|
81
|
+
arguments = [
|
82
|
+
1 + @init_arguments.size,
|
83
|
+
[$0] + @init_arguments,
|
84
|
+
]
|
85
|
+
error, argc, argv = init.invoke(arguments)
|
73
86
|
@init_arguments.replace(argv)
|
74
87
|
if error.to_i <= 0
|
75
88
|
raise InitError, "failed to initialize Clutter: #{error.name}"
|
data/lib/clutter/color.rb
CHANGED
@@ -16,13 +16,20 @@
|
|
16
16
|
|
17
17
|
module Clutter
|
18
18
|
class Color
|
19
|
+
private_class_method(:from_hls) if respond_to?(:from_hls)
|
20
|
+
private_class_method(:from_pixel) if respond_to?(:from_pixel)
|
21
|
+
private_class_method(:from_string) if respond_to?(:from_string)
|
22
|
+
|
19
23
|
class << self
|
20
24
|
def new(*args)
|
21
25
|
if [Symbol] == args.collect(&:class)
|
22
26
|
name = args[0]
|
23
27
|
get_static(name)
|
24
28
|
else
|
25
|
-
|
29
|
+
if args.empty?
|
30
|
+
args = [0, 0, 0, 1] unless private_method_defined?(:initialize_alloc)
|
31
|
+
end
|
32
|
+
super(*args)
|
26
33
|
end
|
27
34
|
end
|
28
35
|
|
@@ -39,15 +46,36 @@ module Clutter
|
|
39
46
|
end
|
40
47
|
|
41
48
|
def hlsa(hue, luminance, saturation, alpha)
|
42
|
-
|
43
|
-
|
49
|
+
if respond_to?(:from_hls, true)
|
50
|
+
color = from_hls(hue, luminance, saturation)
|
51
|
+
else
|
52
|
+
color = new
|
53
|
+
color.from_hls(hue, luminance, saturation)
|
54
|
+
end
|
44
55
|
color.alpha = alpha
|
45
56
|
color
|
46
57
|
end
|
47
58
|
|
48
59
|
def pixel(pixel)
|
49
|
-
|
50
|
-
|
60
|
+
if respond_to?(:from_pixel, true)
|
61
|
+
color = from_pixel(pixel)
|
62
|
+
else
|
63
|
+
color = new
|
64
|
+
color.from_pixel(pixel)
|
65
|
+
end
|
66
|
+
color
|
67
|
+
end
|
68
|
+
|
69
|
+
def parse(string)
|
70
|
+
if respond_to?(:from_string, true)
|
71
|
+
succeeded, color = from_string(string)
|
72
|
+
else
|
73
|
+
color = new
|
74
|
+
succeeded = color.from_string(string)
|
75
|
+
end
|
76
|
+
unless succeeded
|
77
|
+
raise ArgumentError, "invalid color string: <#{string}>"
|
78
|
+
end
|
51
79
|
color
|
52
80
|
end
|
53
81
|
end
|
data/sample/basic-actor.rb
CHANGED
data/sample/bin-layout.rb
CHANGED
data/sample/box-layout.rb
CHANGED
data/sample/canvas.rb
CHANGED
@@ -22,8 +22,6 @@
|
|
22
22
|
|
23
23
|
require "clutter"
|
24
24
|
|
25
|
-
Clutter.init
|
26
|
-
|
27
25
|
stage = Clutter::Stage.new
|
28
26
|
stage.title = "2D Clock"
|
29
27
|
stage.user_resizable = true
|
@@ -43,8 +41,8 @@ actor.add_constraint(Clutter::BindConstraint.new(stage, :size, 0))
|
|
43
41
|
idle_resize_id = nil
|
44
42
|
actor.signal_connect("allocation-changed") do |_actor, allocation, flags|
|
45
43
|
idle_resize_id ||= Clutter::Threads.add_timeout(1000) do
|
46
|
-
|
47
|
-
_actor.content.set_size(
|
44
|
+
width, height = _actor.size
|
45
|
+
_actor.content.set_size(width.ceil, height.ceil)
|
48
46
|
idle_resize_id = nil
|
49
47
|
GLib::Source::REMOVE
|
50
48
|
end
|
data/sample/constraints.rb
CHANGED
data/sample/drag-action.rb
CHANGED
data/sample/drop-action.rb
CHANGED
@@ -22,8 +22,6 @@
|
|
22
22
|
|
23
23
|
require "clutter"
|
24
24
|
|
25
|
-
Clutter.init
|
26
|
-
|
27
25
|
TARGET_SIZE = 200
|
28
26
|
HANDLE_SIZE = 128
|
29
27
|
|
@@ -73,11 +71,11 @@ add_drag_object = lambda do |target|
|
|
73
71
|
|
74
72
|
action = Clutter::DragAction.new
|
75
73
|
action.signal_connect("drag-begin") do |_action, _actor, event_x, event_y, modifiers|
|
76
|
-
|
74
|
+
x, y = _actor.position
|
77
75
|
handle = Clutter::Actor.new
|
78
76
|
handle.background_color = Clutter::Color.new(:sky_blue_dark)
|
79
77
|
handle.set_size(128, 128)
|
80
|
-
handle.set_position(event_x -
|
78
|
+
handle.set_position(event_x - x, event_y - y)
|
81
79
|
stage.add_child(handle)
|
82
80
|
|
83
81
|
_action.drag_handle = handle
|
@@ -138,14 +136,14 @@ add_drag_object = lambda do |target|
|
|
138
136
|
parent.remove_child(drag)
|
139
137
|
|
140
138
|
parent.save_easing_state do
|
141
|
-
parent.easing_mode :linear
|
139
|
+
parent.easing_mode = :linear
|
142
140
|
parent.opacity = 64
|
143
141
|
end
|
144
142
|
end
|
145
143
|
target.add_child(drag)
|
146
144
|
|
147
145
|
target.save_easing_state do
|
148
|
-
target.easing_mode :linear
|
146
|
+
target.easing_mode = :linear
|
149
147
|
target.opacity = 255
|
150
148
|
end
|
151
149
|
end
|
data/sample/easing-modes.rb
CHANGED
data/sample/flow-layout.rb
CHANGED
data/sample/grid-layout.rb
CHANGED
data/sample/image-content.rb
CHANGED
data/sample/pan-action.rb
CHANGED
data/sample/rounded-rectangle.rb
CHANGED
data/sample/scroll-actor.rb
CHANGED
data/test/run-test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
# Copyright (C) 2012 Ruby-GNOME2 Project Team
|
3
|
+
# Copyright (C) 2012-2013 Ruby-GNOME2 Project Team
|
4
4
|
#
|
5
5
|
# This library is free software; you can redistribute it and/or
|
6
6
|
# modify it under the terms of the GNU Lesser General Public
|
@@ -29,7 +29,7 @@ modules = [
|
|
29
29
|
[clutter_base, "clutter"],
|
30
30
|
]
|
31
31
|
modules.each do |target, module_name|
|
32
|
-
if system("which make > /dev/null")
|
32
|
+
if File.exist?("Makefile") and system("which make > /dev/null")
|
33
33
|
`make -C #{target.dump} > /dev/null` or exit(false)
|
34
34
|
end
|
35
35
|
$LOAD_PATH.unshift(File.join(target, "ext", module_name))
|
@@ -39,6 +39,8 @@ end
|
|
39
39
|
$LOAD_PATH.unshift(File.join(glib_base, "test"))
|
40
40
|
require "glib-test-init"
|
41
41
|
|
42
|
+
$VERBOSE = false # TODO: remove me
|
43
|
+
|
42
44
|
$LOAD_PATH.unshift(File.join(gobject_introspection_base, "test"))
|
43
45
|
require "gobject-introspection-test-utils"
|
44
46
|
|
@@ -47,4 +49,6 @@ require "clutter-test-utils"
|
|
47
49
|
|
48
50
|
require "clutter"
|
49
51
|
|
50
|
-
|
52
|
+
Clutter.init([])
|
53
|
+
|
54
|
+
exit Test::Unit::AutoRunner.run(true, clutter_base)
|
@@ -0,0 +1,42 @@
|
|
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
|
+
class ClutterColorTest < Test::Unit::TestCase
|
18
|
+
def test_rgb
|
19
|
+
assert_equal("#ff0000ff", Clutter::Color.rgb(255, 0, 0).to_s)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_rgba
|
23
|
+
assert_equal("#ff00007f", Clutter::Color.rgb(255, 0, 0, 127).to_s)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_hls
|
27
|
+
assert_equal("#20dfdfff", Clutter::Color.hls(180, 0.5, 0.75).to_s)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_hlsa
|
31
|
+
assert_equal("#20dfdf7f", Clutter::Color.hls(180, 0.5, 0.75, 127).to_s)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_pixel
|
35
|
+
assert_equal("#20dfdf7f", Clutter::Color.pixel(0x20dfdf7f).to_s)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_parse
|
39
|
+
assert_equal("#20dfdf7f",
|
40
|
+
Clutter::Color.parse("rgba(32, 223, 223, 0.5)").to_s)
|
41
|
+
end
|
42
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clutter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,40 +9,40 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cairo-gobject
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 2.0.
|
21
|
+
version: 2.0.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 2.0.
|
29
|
+
version: 2.0.1
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: gobject-introspection
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - '='
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: 2.0.
|
37
|
+
version: 2.0.1
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - '='
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 2.0.
|
45
|
+
version: 2.0.1
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: test-unit-notify
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- sample/scroll-actor.rb
|
94
94
|
- test/clutter-test-utils.rb
|
95
95
|
- test/run-test.rb
|
96
|
+
- test/test-clutter-color.rb
|
96
97
|
homepage: http://ruby-gnome2.sourceforge.jp/
|
97
98
|
licenses: []
|
98
99
|
post_install_message:
|