gdk3 1.2.0

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.
Files changed (44) hide show
  1. data/Rakefile +53 -0
  2. data/ext/gdk3/depend +11 -0
  3. data/ext/gdk3/extconf.rb +127 -0
  4. data/ext/gdk3/gdk3.def +12 -0
  5. data/ext/gdk3/init.c +35 -0
  6. data/ext/gdk3/rbgdk.c +540 -0
  7. data/ext/gdk3/rbgdk3.h +71 -0
  8. data/ext/gdk3/rbgdk3conversions.h +118 -0
  9. data/ext/gdk3/rbgdk3private.h +93 -0
  10. data/ext/gdk3/rbgdkatom.c +122 -0
  11. data/ext/gdk3/rbgdkcairo.c +95 -0
  12. data/ext/gdk3/rbgdkcolor.c +137 -0
  13. data/ext/gdk3/rbgdkconst.c +33 -0
  14. data/ext/gdk3/rbgdkcursor.c +99 -0
  15. data/ext/gdk3/rbgdkdevice.c +197 -0
  16. data/ext/gdk3/rbgdkdisplay.c +482 -0
  17. data/ext/gdk3/rbgdkdisplaymanager.c +55 -0
  18. data/ext/gdk3/rbgdkdragcontext.c +191 -0
  19. data/ext/gdk3/rbgdkdraw.c +520 -0
  20. data/ext/gdk3/rbgdkevent.c +926 -0
  21. data/ext/gdk3/rbgdkgeometry.c +252 -0
  22. data/ext/gdk3/rbgdkkeymap.c +151 -0
  23. data/ext/gdk3/rbgdkkeyval.c +108 -0
  24. data/ext/gdk3/rbgdkpango.c +197 -0
  25. data/ext/gdk3/rbgdkpangorenderer.c +144 -0
  26. data/ext/gdk3/rbgdkpixbuf.c +176 -0
  27. data/ext/gdk3/rbgdkproperty.c +305 -0
  28. data/ext/gdk3/rbgdkrectangle.c +140 -0
  29. data/ext/gdk3/rbgdkrgb.c +199 -0
  30. data/ext/gdk3/rbgdkrgba.c +142 -0
  31. data/ext/gdk3/rbgdkscreen.c +443 -0
  32. data/ext/gdk3/rbgdkselection.c +146 -0
  33. data/ext/gdk3/rbgdkthreads.c +77 -0
  34. data/ext/gdk3/rbgdktimecoord.c +133 -0
  35. data/ext/gdk3/rbgdkvisual.c +251 -0
  36. data/ext/gdk3/rbgdkwindow.c +1044 -0
  37. data/ext/gdk3/rbgdkwindowattr.c +191 -0
  38. data/ext/gdk3/rbgdkx11.c +102 -0
  39. data/ext/gdk3/rbgdkx11x11window.c +66 -0
  40. data/extconf.rb +49 -0
  41. data/lib/gdk3.rb +3 -0
  42. data/lib/gdk3/base.rb +50 -0
  43. data/lib/gdk3/deprecated.rb +152 -0
  44. metadata +156 -0
@@ -0,0 +1,191 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2003 Masao Mutoh
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
21
+
22
+ #include "rbgdk3private.h"
23
+
24
+ /*****************************************/
25
+ static GdkWindowAttr*
26
+ attr_copy(const GdkWindowAttr* win)
27
+ {
28
+ GdkWindowAttr* new_win;
29
+ g_return_val_if_fail (win != NULL, NULL);
30
+ new_win = g_new(GdkWindowAttr, 1);
31
+ *new_win = *win;
32
+ return new_win;
33
+ }
34
+
35
+ GType
36
+ gdk_windowattr_get_type(void)
37
+ {
38
+ static GType our_type = 0;
39
+ if (our_type == 0)
40
+ our_type = g_boxed_type_register_static ("GdkWindowAttr",
41
+ (GBoxedCopyFunc)attr_copy,
42
+ (GBoxedFreeFunc)g_free);
43
+ return our_type;
44
+ }
45
+ /*****************************************/
46
+
47
+ #define RG_TARGET_NAMESPACE cWindowAttr
48
+ #define _SELF(w) (RVAL2GDKWINDOWATTR(w))
49
+
50
+ static VALUE
51
+ rg_initialize(VALUE self, VALUE width, VALUE height, VALUE wclass,
52
+ VALUE window_type)
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);
60
+ return Qnil;
61
+ }
62
+
63
+ #define ATTR_STR(name)\
64
+ static VALUE \
65
+ attr_get_ ## name (VALUE self)\
66
+ {\
67
+ return CSTR2RVAL(_SELF(self)->name);\
68
+ }\
69
+ static VALUE \
70
+ attr_set_ ## name (VALUE self, VALUE val)\
71
+ {\
72
+ _SELF(self)->name = (gchar *)RVAL2CSTR(val);\
73
+ return self;\
74
+ }
75
+
76
+ #define ATTR_INT(name)\
77
+ static VALUE \
78
+ attr_get_ ## name (VALUE self)\
79
+ {\
80
+ return INT2NUM(_SELF(self)->name);\
81
+ }\
82
+ static VALUE \
83
+ attr_set_ ## name (VALUE self, VALUE val)\
84
+ {\
85
+ _SELF(self)->name = NUM2INT(val);\
86
+ return self;\
87
+ }
88
+
89
+ ATTR_STR(title);
90
+ ATTR_INT(event_mask);
91
+ ATTR_INT(x);
92
+ ATTR_INT(y);
93
+ ATTR_INT(width);
94
+ ATTR_INT(height);
95
+
96
+ static VALUE
97
+ rg_wclass(VALUE self)
98
+ {
99
+ return GDKWINDOWWINDOWCLASS2RVAL(_SELF(self)->wclass);
100
+ }
101
+ static VALUE
102
+ rg_set_wclass(VALUE self, VALUE val)
103
+ {
104
+ _SELF(self)->wclass = RVAL2GDKWINDOWWINDOWCLASS(val);
105
+ return self;
106
+ }
107
+
108
+ static VALUE
109
+ rg_visual(VALUE self)
110
+ {
111
+ return GOBJ2RVAL(_SELF(self)->visual);
112
+ }
113
+ static VALUE
114
+ rg_set_visual(VALUE self, VALUE val)
115
+ {
116
+ _SELF(self)->visual = RVAL2GDKVISUAL(val);
117
+ return self;
118
+ }
119
+
120
+ static VALUE
121
+ rg_window_type(VALUE self)
122
+ {
123
+ return GDKWINDOWTYPE2RVAL(_SELF(self)->window_type);
124
+ }
125
+ static VALUE
126
+ rg_set_window_type(VALUE self, VALUE val)
127
+ {
128
+ _SELF(self)->window_type = RVAL2GDKWINDOWTYPE(val);
129
+ return self;
130
+ }
131
+
132
+ static VALUE
133
+ rg_cursor(VALUE self)
134
+ {
135
+ return GDKCURSOR2RVAL(_SELF(self)->cursor);
136
+ }
137
+ static VALUE
138
+ rg_set_cursor(VALUE self, VALUE val)
139
+ {
140
+ _SELF(self)->cursor = RVAL2GDKCURSOR(val);
141
+ return self;
142
+ }
143
+
144
+ ATTR_STR(wmclass_name);
145
+ ATTR_STR(wmclass_class);
146
+
147
+ static VALUE
148
+ rg_override_redirect(VALUE self)
149
+ {
150
+ return CBOOL2RVAL(_SELF(self)->override_redirect);
151
+ }
152
+ static VALUE
153
+ rg_set_override_redirect(VALUE self, VALUE val)
154
+ {
155
+ _SELF(self)->override_redirect = RVAL2CBOOL(val);
156
+ return self;
157
+ }
158
+
159
+ void
160
+ Init_gdk_windowattr(VALUE mGdk)
161
+ {
162
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_WINDOW_ATTR, "WindowAttr", mGdk);
163
+
164
+ RG_DEF_METHOD(initialize, 4);
165
+ rbg_define_method(RG_TARGET_NAMESPACE, "title", attr_get_title, 0);
166
+ rbg_define_method(RG_TARGET_NAMESPACE, "set_title", attr_set_title, 1);
167
+ rbg_define_method(RG_TARGET_NAMESPACE, "event_mask", attr_get_event_mask, 0);
168
+ rbg_define_method(RG_TARGET_NAMESPACE, "set_event_mask", attr_set_event_mask, 1);
169
+ rbg_define_method(RG_TARGET_NAMESPACE, "x", attr_get_x, 0);
170
+ rbg_define_method(RG_TARGET_NAMESPACE, "set_x", attr_set_x, 1);
171
+ rbg_define_method(RG_TARGET_NAMESPACE, "y", attr_get_y, 0);
172
+ rbg_define_method(RG_TARGET_NAMESPACE, "set_y", attr_set_y, 1);
173
+ rbg_define_method(RG_TARGET_NAMESPACE, "width", attr_get_width, 0);
174
+ rbg_define_method(RG_TARGET_NAMESPACE, "set_width", attr_set_width, 1);
175
+ rbg_define_method(RG_TARGET_NAMESPACE, "height", attr_get_height, 0);
176
+ rbg_define_method(RG_TARGET_NAMESPACE, "set_height", attr_set_height, 1);
177
+ RG_DEF_METHOD(wclass, 0);
178
+ RG_DEF_METHOD(set_wclass, 1);
179
+ RG_DEF_METHOD(visual, 0);
180
+ RG_DEF_METHOD(set_visual, 1);
181
+ RG_DEF_METHOD(window_type, 0);
182
+ RG_DEF_METHOD(set_window_type, 1);
183
+ RG_DEF_METHOD(cursor, 0);
184
+ RG_DEF_METHOD(set_cursor, 1);
185
+ rbg_define_method(RG_TARGET_NAMESPACE, "wmclass_name", attr_get_wmclass_name, 0);
186
+ rbg_define_method(RG_TARGET_NAMESPACE, "set_wmclass_name", attr_set_wmclass_name, 1);
187
+ rbg_define_method(RG_TARGET_NAMESPACE, "wmclass_class", attr_get_wmclass_class, 0);
188
+ rbg_define_method(RG_TARGET_NAMESPACE, "set_wmclass_class", attr_set_wmclass_class, 1);
189
+ RG_DEF_METHOD(override_redirect, 0);
190
+ RG_DEF_METHOD(set_override_redirect, 1);
191
+ }
@@ -0,0 +1,102 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2005 Masao Mutoh
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
+ * MA 02110-1301 USA
20
+ */
21
+
22
+ #include "rbgdk3private.h"
23
+ #ifdef GDK_WINDOWING_X11
24
+
25
+ #define RG_TARGET_NAMESPACE mGdkX11
26
+
27
+ /* deprecated
28
+ static VALUE
29
+ rg_s_xid_table_lookup(int argc, VALUE *argv, VALUE self)
30
+ {
31
+ VALUE arg[2];
32
+ GdkPixmap* win = NULL;
33
+
34
+ rb_scan_args(argc, argv, "11", &arg[0], &arg[1]);
35
+
36
+ switch(argc)
37
+ {
38
+ case 1:
39
+ win = gdk_xid_table_lookup(NUM2UINT(arg[0]));
40
+ break;
41
+ case 2:
42
+ win = gdk_xid_table_lookup_for_display(RVAL2GOBJ(arg[0]), NUM2UINT(arg[1]));
43
+ break;
44
+ }
45
+ if (win == NULL)
46
+ return Qnil;
47
+ else {
48
+ return GOBJ2RVAL(win);
49
+ }
50
+ }
51
+ */
52
+
53
+ /* deprecated
54
+ static VALUE
55
+ rg_s_net_wm_supports_p(VALUE self, VALUE property)
56
+ {
57
+ return CBOOL2RVAL(gdk_net_wm_supports(RVAL2ATOM(property)));
58
+ }
59
+ */
60
+
61
+ static VALUE
62
+ rg_s_default_screen(G_GNUC_UNUSED VALUE self)
63
+ {
64
+ return INT2NUM(gdk_x11_get_default_screen());
65
+ }
66
+
67
+ static VALUE
68
+ rg_s_grab_server(G_GNUC_UNUSED VALUE self)
69
+ {
70
+ gdk_x11_grab_server();
71
+ return Qnil;
72
+ }
73
+
74
+ static VALUE
75
+ rg_s_ungrab_server(G_GNUC_UNUSED VALUE self)
76
+ {
77
+ gdk_x11_ungrab_server();
78
+ return Qnil;
79
+ }
80
+ #endif
81
+
82
+ void
83
+ Init_gdkx11(void)
84
+ {
85
+ #ifdef GDK_WINDOWING_X11
86
+ VALUE RG_TARGET_NAMESPACE = rb_define_module("GdkX11");
87
+
88
+ /* deprecated
89
+ RG_DEF_SMETHOD(xid_table_lookup, -1);
90
+ */
91
+ /* deprecated
92
+ RG_DEF_SMETHOD_P(net_wm_supports, 1);
93
+ */
94
+
95
+ RG_DEF_SMETHOD(default_screen, 0);
96
+ RG_DEF_SMETHOD(grab_server, 0);
97
+
98
+ RG_DEF_SMETHOD(ungrab_server, 0);
99
+
100
+ Init_gdkx11_x11window(RG_TARGET_NAMESPACE);
101
+ #endif
102
+ }
@@ -0,0 +1,66 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2012 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,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rbgdk3private.h"
22
+
23
+ #ifdef GDK_WINDOWING_X11
24
+ #define RG_TARGET_NAMESPACE cX11Window
25
+ #define _SELF(self) (RVAL2GDKX11WINDOW(self))
26
+
27
+ static VALUE
28
+ rg_xid(VALUE self)
29
+ {
30
+ return ULONG2NUM(gdk_x11_window_get_xid(_SELF(self)));
31
+ }
32
+
33
+ static VALUE
34
+ rg_move_to_current_desktop(VALUE self)
35
+ {
36
+ gdk_x11_window_move_to_current_desktop(_SELF(self));
37
+
38
+ return self;
39
+ }
40
+
41
+ static VALUE
42
+ rg_server_time(VALUE self)
43
+ {
44
+ return UINT2NUM(gdk_x11_get_server_time(_SELF(self)));
45
+ }
46
+
47
+ static VALUE
48
+ rg_set_user_time(VALUE self, VALUE time)
49
+ {
50
+ gdk_x11_window_set_user_time(_SELF(self), NUM2UINT(time));
51
+ return Qnil;
52
+ }
53
+ #endif
54
+
55
+ void
56
+ Init_gdkx11_x11window(VALUE mGdkX11)
57
+ {
58
+ #ifdef GDK_WINDOWING_X11
59
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_X11_WINDOW, "X11Window", mGdkX11);
60
+
61
+ RG_DEF_METHOD(xid, 0);
62
+ RG_DEF_METHOD(move_to_current_desktop, 0);
63
+ RG_DEF_METHOD(server_time, 0);
64
+ RG_DEF_METHOD(set_user_time, 1);
65
+ #endif
66
+ }
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'pathname'
4
+ require 'mkmf'
5
+ require 'rbconfig'
6
+ require 'fileutils'
7
+
8
+ package = "gdk3"
9
+
10
+ base_dir = Pathname(__FILE__).dirname.expand_path
11
+ ext_dir = base_dir + "ext" + package
12
+ mkmf_gnome2_dir = base_dir + 'lib'
13
+
14
+ ruby = File.join(RbConfig::CONFIG['bindir'],
15
+ RbConfig::CONFIG['ruby_install_name'] +
16
+ RbConfig::CONFIG["EXEEXT"])
17
+
18
+ build_dir = Pathname("ext") + package
19
+ FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist?
20
+ extconf_rb_path = ext_dir + "extconf.rb"
21
+ system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV) || exit(false)
22
+
23
+ create_makefile(package)
24
+ FileUtils.mv("Makefile", "Makefile.lib")
25
+
26
+ File.open("Makefile", "w") do |makefile|
27
+ makefile.puts(<<-EOM)
28
+ all:
29
+ (cd ext/#{package} && $(MAKE))
30
+ $(MAKE) -f Makefile.lib
31
+
32
+ install:
33
+ (cd ext/#{package} && $(MAKE) install)
34
+ $(MAKE) -f Makefile.lib install
35
+
36
+ site-install:
37
+ (cd ext/#{package} && $(MAKE) site-install)
38
+ $(MAKE) -f Makefile.lib site-install
39
+
40
+ clean:
41
+ (cd ext/#{package} && $(MAKE) clean)
42
+ $(MAKE) -f Makefile.lib clean
43
+
44
+ distclean:
45
+ (cd ext/#{package} && $(MAKE) distclean)
46
+ $(MAKE) -f Makefile.lib distclean
47
+ @rm -f Makefile.lib
48
+ EOM
49
+ end
@@ -0,0 +1,3 @@
1
+ require 'gdk3/base'
2
+ require 'gdk3/deprecated'
3
+
@@ -0,0 +1,50 @@
1
+ =begin
2
+ Copyright (c) 2006-2011 Ruby-GNOME2 Project Team
3
+ This program is licenced under the same licence as Ruby-GNOME2.
4
+ =end
5
+
6
+ require 'glib2'
7
+ require 'pango'
8
+ require 'gdk_pixbuf2'
9
+
10
+ base_dir = Pathname.new(__FILE__).dirname.dirname.dirname.expand_path
11
+ vendor_dir = base_dir + "vendor" + "local"
12
+ vendor_bin_dir = vendor_dir + "bin"
13
+ GLib.prepend_environment_path(vendor_bin_dir)
14
+ begin
15
+ major, minor, _ = RUBY_VERSION.split(/\./)
16
+ require "#{major}.#{minor}/gdk3.so"
17
+ rescue LoadError
18
+ require "gdk3.so"
19
+ end
20
+
21
+ module Gdk
22
+ LOG_DOMAIN = "Gdk"
23
+ end
24
+
25
+ if Gdk.cairo_available?
26
+ module Cairo
27
+ class Context
28
+ if method_defined?(:set_source_color)
29
+ alias_method :set_source_not_gdk_color, :set_source_color
30
+ def set_source_color(color)
31
+ if color.is_a?(Gdk::Color)
32
+ set_source_gdk_color(color)
33
+ else
34
+ set_source_not_gdk_color(color)
35
+ end
36
+ end
37
+ else
38
+ alias_method :set_source_color, :set_source_gdk_color
39
+ end
40
+
41
+ def source_color=(color)
42
+ set_source_color(color)
43
+ color
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ GLib::Log.set_log_domain(Gdk::LOG_DOMAIN)
50
+