clutter-gtk 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -1
- data/lib/clutter-gtk.rb +19 -6
- data/sample/events.rb +0 -2
- data/sample/multistage.rb +0 -98
- data/sample/test-actor.rb +0 -2
- data/sample/test-scroll.rb +0 -2
- data/sample/test.rb +0 -2
- data/sample/window-test.rb +0 -2
- data/sample/window-test2.rb +0 -2
- metadata +10 -10
data/Rakefile
CHANGED
data/lib/clutter-gtk.rb
CHANGED
@@ -28,14 +28,24 @@ module ClutterGtk
|
|
28
28
|
LOG_DOMAIN = "Clutter-Gtk"
|
29
29
|
GLib::Log.set_log_domain(LOG_DOMAIN)
|
30
30
|
|
31
|
-
@initialized = false
|
32
31
|
class << self
|
33
|
-
def
|
34
|
-
|
35
|
-
|
32
|
+
def const_missing(name)
|
33
|
+
init()
|
34
|
+
if const_defined?(name)
|
35
|
+
const_get(name)
|
36
|
+
else
|
37
|
+
super
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def init(argv=[])
|
36
42
|
loader = Loader.new(self, argv)
|
37
43
|
loader.load("GtkClutter")
|
38
44
|
Clutter.init(argv)
|
45
|
+
class << self
|
46
|
+
remove_method(:init)
|
47
|
+
remove_method(:const_missing)
|
48
|
+
end
|
39
49
|
end
|
40
50
|
end
|
41
51
|
|
@@ -51,8 +61,11 @@ module ClutterGtk
|
|
51
61
|
private
|
52
62
|
def pre_load(repository, namespace)
|
53
63
|
init = repository.find(namespace, "init")
|
54
|
-
|
55
|
-
|
64
|
+
arguments = [
|
65
|
+
1 + @init_arguments.size,
|
66
|
+
[$0] + @init_arguments,
|
67
|
+
]
|
68
|
+
error, argc, argv = init.invoke(arguments)
|
56
69
|
@init_arguments.replace(argv)
|
57
70
|
if error.to_i <= 0
|
58
71
|
raise InitError, "failed to initialize Clutter: #{error.name}"
|
data/sample/events.rb
CHANGED
data/sample/multistage.rb
CHANGED
@@ -23,8 +23,6 @@
|
|
23
23
|
require "clutter-gtk"
|
24
24
|
require "gdk_pixbuf2"
|
25
25
|
|
26
|
-
ClutterGtk.init
|
27
|
-
|
28
26
|
window = Gtk::Window.new
|
29
27
|
window.set_default_size(600, 400)
|
30
28
|
window.title = "Multiple GtkClutterEmbed"
|
@@ -78,99 +76,3 @@ end
|
|
78
76
|
window.show_all
|
79
77
|
|
80
78
|
Gtk.main
|
81
|
-
|
82
|
-
__END__
|
83
|
-
#include <gtk/gtk.h>
|
84
|
-
#include <clutter/clutter.h>
|
85
|
-
|
86
|
-
#include <clutter-gtk/clutter-gtk.h>
|
87
|
-
|
88
|
-
static void
|
89
|
-
on_stage2_allocation_changed (ClutterActor *stage_2,
|
90
|
-
const ClutterActorBox *allocation,
|
91
|
-
ClutterAllocationFlags flags,
|
92
|
-
ClutterActor *texture_2)
|
93
|
-
{
|
94
|
-
clutter_actor_set_position (texture_2,
|
95
|
-
(allocation->x2 - allocation->x1) / 2,
|
96
|
-
(allocation->y2 - allocation->y1) / 2);
|
97
|
-
}
|
98
|
-
|
99
|
-
int
|
100
|
-
main (int argc, char *argv[])
|
101
|
-
{
|
102
|
-
ClutterActor *stage0, *stage1, *stage2, *tex1, *tex2;
|
103
|
-
GtkWidget *window, *clutter0, *clutter1, *clutter2;
|
104
|
-
GtkWidget *notebook, *vbox;
|
105
|
-
ClutterColor col0 = { 0xdd, 0xff, 0xdd, 0xff };
|
106
|
-
ClutterColor col1 = { 0xff, 0xff, 0xff, 0xff };
|
107
|
-
ClutterColor col2 = { 0, 0, 0, 0xff };
|
108
|
-
|
109
|
-
if (gtk_clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
|
110
|
-
g_error ("Unable to initialize GtkClutter");
|
111
|
-
|
112
|
-
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
113
|
-
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
114
|
-
gtk_window_set_title (GTK_WINDOW (window), "Multiple GtkClutterEmbed");
|
115
|
-
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
|
116
|
-
|
117
|
-
notebook = gtk_notebook_new ();
|
118
|
-
gtk_container_add (GTK_CONTAINER (window), notebook);
|
119
|
-
|
120
|
-
clutter0 = gtk_clutter_embed_new ();
|
121
|
-
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), clutter0,
|
122
|
-
gtk_label_new ("One stage"));
|
123
|
-
stage0 = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter0));
|
124
|
-
clutter_actor_set_background_color (stage0, &col0);
|
125
|
-
|
126
|
-
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
127
|
-
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), vbox,
|
128
|
-
gtk_label_new ("Two stages"));
|
129
|
-
|
130
|
-
clutter1 = gtk_clutter_embed_new ();
|
131
|
-
gtk_widget_set_size_request (clutter1, 320, 240);
|
132
|
-
stage1 = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter1));
|
133
|
-
clutter_actor_set_background_color (stage1, &col1);
|
134
|
-
tex1 = gtk_clutter_texture_new ();
|
135
|
-
gtk_clutter_texture_set_from_stock (GTK_CLUTTER_TEXTURE (tex1),
|
136
|
-
clutter1,
|
137
|
-
GTK_STOCK_DIALOG_INFO,
|
138
|
-
GTK_ICON_SIZE_DIALOG,
|
139
|
-
NULL);
|
140
|
-
clutter_actor_set_anchor_point (tex1,
|
141
|
-
clutter_actor_get_width (tex1) / 2,
|
142
|
-
clutter_actor_get_height (tex1) / 2);
|
143
|
-
clutter_actor_set_position (tex1, 160, 120);
|
144
|
-
clutter_actor_add_child (stage1, tex1);
|
145
|
-
clutter_actor_show (tex1);
|
146
|
-
|
147
|
-
gtk_container_add (GTK_CONTAINER (vbox), clutter1);
|
148
|
-
|
149
|
-
clutter2 = gtk_clutter_embed_new ();
|
150
|
-
gtk_widget_set_size_request (clutter2, 320, 120);
|
151
|
-
stage2 = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter2));
|
152
|
-
clutter_actor_set_background_color (stage2, &col2);
|
153
|
-
tex2 = gtk_clutter_texture_new ();
|
154
|
-
gtk_clutter_texture_set_from_icon_name (GTK_CLUTTER_TEXTURE (tex2),
|
155
|
-
clutter1,
|
156
|
-
"user-info",
|
157
|
-
GTK_ICON_SIZE_BUTTON,
|
158
|
-
NULL);
|
159
|
-
clutter_actor_set_anchor_point (tex2,
|
160
|
-
clutter_actor_get_width (tex2) / 2,
|
161
|
-
clutter_actor_get_height (tex2) / 2);
|
162
|
-
clutter_actor_set_position (tex2, 160, 60);
|
163
|
-
clutter_actor_add_child (stage2, tex2);
|
164
|
-
|
165
|
-
gtk_container_add (GTK_CONTAINER (vbox), clutter2);
|
166
|
-
|
167
|
-
g_signal_connect (stage2, "allocation-changed",
|
168
|
-
G_CALLBACK (on_stage2_allocation_changed),
|
169
|
-
tex2);
|
170
|
-
|
171
|
-
gtk_widget_show_all (window);
|
172
|
-
|
173
|
-
gtk_main();
|
174
|
-
|
175
|
-
return 0;
|
176
|
-
}
|
data/sample/test-actor.rb
CHANGED
data/sample/test-scroll.rb
CHANGED
data/sample/test.rb
CHANGED
data/sample/window-test.rb
CHANGED
data/sample/window-test2.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clutter-gtk
|
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: clutter
|
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: gtk3
|
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
|