gdk3 2.2.0 → 2.2.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.
- checksums.yaml +4 -4
- data/Rakefile +18 -4
- data/lib/gdk3/atom.rb +26 -0
- data/lib/gdk3/cairo.rb +60 -0
- data/lib/gdk3/color.rb +27 -0
- data/lib/gdk3/deprecated.rb +14 -16
- data/lib/gdk3/event.rb +38 -0
- data/lib/gdk3/loader.rb +266 -0
- data/lib/gdk3/rectangle.rb +38 -0
- data/lib/gdk3/rgba.rb +32 -0
- data/lib/gdk3/window-attr.rb +28 -0
- data/lib/gdk3/window.rb +21 -0
- data/lib/gdk3.rb +61 -2
- data/test/run-test.rb +15 -6
- data/test/test-gdk-cairo.rb +41 -0
- data/test/test-gdk-event-type.rb +25 -0
- data/test/test-gdk-event.rb +47 -49
- data/test/test-gdk-keyval.rb +21 -0
- data/test/test-gdk-pixbuf.rb +49 -0
- data/test/test-gdk-rectangle.rb +35 -4
- data/test/test-gdk-rgba.rb +6 -1
- data/test/test-gdk-window-attr.rb +1 -1
- metadata +23 -51
- data/ext/gdk3/depend +0 -11
- data/ext/gdk3/extconf.rb +0 -130
- data/ext/gdk3/gdk3.def +0 -12
- data/ext/gdk3/init.c +0 -35
- data/ext/gdk3/rbgdk.c +0 -491
- data/ext/gdk3/rbgdk3.h +0 -73
- data/ext/gdk3/rbgdk3conversions.h +0 -121
- data/ext/gdk3/rbgdk3private.h +0 -85
- data/ext/gdk3/rbgdkatom.c +0 -122
- data/ext/gdk3/rbgdkcairo.c +0 -91
- data/ext/gdk3/rbgdkcolor.c +0 -137
- data/ext/gdk3/rbgdkconst.c +0 -33
- data/ext/gdk3/rbgdkcursor.c +0 -92
- data/ext/gdk3/rbgdkdevice.c +0 -253
- data/ext/gdk3/rbgdkdevicemanager.c +0 -39
- data/ext/gdk3/rbgdkdisplay.c +0 -434
- data/ext/gdk3/rbgdkdisplaymanager.c +0 -55
- data/ext/gdk3/rbgdkdragcontext.c +0 -191
- data/ext/gdk3/rbgdkevent.c +0 -1173
- data/ext/gdk3/rbgdkgeometry.c +0 -253
- data/ext/gdk3/rbgdkkeymap.c +0 -151
- data/ext/gdk3/rbgdkkeyval.c +0 -108
- data/ext/gdk3/rbgdkpango.c +0 -197
- data/ext/gdk3/rbgdkpangorenderer.c +0 -144
- data/ext/gdk3/rbgdkpixbuf.c +0 -176
- data/ext/gdk3/rbgdkproperty.c +0 -305
- data/ext/gdk3/rbgdkrectangle.c +0 -140
- data/ext/gdk3/rbgdkrgb.c +0 -199
- data/ext/gdk3/rbgdkrgba.c +0 -142
- data/ext/gdk3/rbgdkscreen.c +0 -443
- data/ext/gdk3/rbgdkselection.c +0 -146
- data/ext/gdk3/rbgdkthreads.c +0 -77
- data/ext/gdk3/rbgdktimecoord.c +0 -133
- data/ext/gdk3/rbgdkvisual.c +0 -251
- data/ext/gdk3/rbgdkwindow.c +0 -1069
- data/ext/gdk3/rbgdkwindowattr.c +0 -191
- data/ext/gdk3/rbgdkx11.c +0 -102
- data/ext/gdk3/rbgdkx11x11window.c +0 -66
- data/extconf.rb +0 -49
- data/lib/gdk3/base.rb +0 -59
@@ -1,144 +0,0 @@
|
|
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
|
-
/* deprecated
|
23
|
-
#include "rbgdk3private.h"
|
24
|
-
|
25
|
-
#define RG_TARGET_NAMESPACE cPangoRenderer
|
26
|
-
#define _SELF(s) (RVAL2GDKPANGORENDERER(s))
|
27
|
-
|
28
|
-
static VALUE
|
29
|
-
rg_initialize(int argc, VALUE *argv, VALUE self)
|
30
|
-
{
|
31
|
-
VALUE screen;
|
32
|
-
GdkScreen* gscreen;
|
33
|
-
|
34
|
-
rb_scan_args(argc, argv, "01", &screen);
|
35
|
-
|
36
|
-
if (NIL_P(screen)){
|
37
|
-
gscreen = gdk_screen_get_default();
|
38
|
-
} else {
|
39
|
-
gscreen = RVAL2GDKSCREEN(screen);
|
40
|
-
}
|
41
|
-
|
42
|
-
G_INITIALIZE(self, gdk_pango_renderer_new(gscreen));
|
43
|
-
|
44
|
-
return Qnil;
|
45
|
-
}
|
46
|
-
|
47
|
-
static VALUE
|
48
|
-
rg_s_get_default(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
49
|
-
{
|
50
|
-
VALUE screen;
|
51
|
-
GdkScreen* gscreen;
|
52
|
-
|
53
|
-
rb_scan_args(argc, argv, "01", &screen);
|
54
|
-
|
55
|
-
if (NIL_P(screen)){
|
56
|
-
gscreen = gdk_screen_get_default();
|
57
|
-
} else {
|
58
|
-
gscreen = RVAL2GDKSCREEN(screen);
|
59
|
-
}
|
60
|
-
return GOBJ2RVAL(gdk_pango_renderer_get_default(gscreen));
|
61
|
-
}
|
62
|
-
|
63
|
-
static VALUE
|
64
|
-
rg_s_default(G_GNUC_UNUSED VALUE self)
|
65
|
-
{
|
66
|
-
GdkScreen* gscreen = gdk_screen_get_default();
|
67
|
-
return GOBJ2RVAL(gdk_pango_renderer_get_default(gscreen));
|
68
|
-
}
|
69
|
-
|
70
|
-
static VALUE
|
71
|
-
rg_set_drawable(VALUE self, VALUE drawable)
|
72
|
-
{
|
73
|
-
gdk_pango_renderer_set_drawable(_SELF(self),
|
74
|
-
RVAL2GDKDRAWABLE(drawable));
|
75
|
-
return self;
|
76
|
-
}
|
77
|
-
|
78
|
-
static VALUE
|
79
|
-
rg_set_gc(VALUE self, VALUE gc)
|
80
|
-
{
|
81
|
-
gdk_pango_renderer_set_gc(_SELF(self),
|
82
|
-
NIL_P(gc) ? NULL : RVAL2GDKGC(gc));
|
83
|
-
return self;
|
84
|
-
}
|
85
|
-
|
86
|
-
#ifdef HAVE_PANGO_RENDER_PART_GET_TYPE
|
87
|
-
static VALUE
|
88
|
-
rg_set_stipple(VALUE self, VALUE part, VALUE stipple)
|
89
|
-
{
|
90
|
-
gdk_pango_renderer_set_stipple(_SELF(self), RVAL2PANGORENDERPART(part),
|
91
|
-
NIL_P(stipple) ? NULL : RVAL2GDKBITMAP(stipple));
|
92
|
-
|
93
|
-
return self;
|
94
|
-
}
|
95
|
-
#else
|
96
|
-
static VALUE
|
97
|
-
prenderer_set_stipple(G_GNUC_UNUSED VALUE self,
|
98
|
-
G_GNUC_UNUSED VALUE part,
|
99
|
-
G_GNUC_UNUSED VALUE stipple)
|
100
|
-
{
|
101
|
-
rb_warning("Gdk::PangoRender#set_tipple is not supported (Require pango-1.8.1 or later");
|
102
|
-
|
103
|
-
return self;
|
104
|
-
}
|
105
|
-
#endif
|
106
|
-
|
107
|
-
#ifdef HAVE_PANGO_RENDER_PART_GET_TYPE
|
108
|
-
static VALUE
|
109
|
-
rg_set_override_color(VALUE self, VALUE part, VALUE color)
|
110
|
-
{
|
111
|
-
gdk_pango_renderer_set_override_color(_SELF(self),
|
112
|
-
RVAL2PANGORENDERPART(part),
|
113
|
-
RVAL2GDKCOLOR(color));
|
114
|
-
|
115
|
-
return self;
|
116
|
-
}
|
117
|
-
#else
|
118
|
-
static VALUE
|
119
|
-
prenderer_set_override_color(G_GNUC_UNUSED VALUE self,
|
120
|
-
G_GNUC_UNUSED VALUE part,
|
121
|
-
G_GNUC_UNUSED VALUE color)
|
122
|
-
{
|
123
|
-
rb_warning("Gdk::PangoRender#set_override_color is not supported (Require pango-1.8.1 or later");
|
124
|
-
|
125
|
-
return self;
|
126
|
-
}
|
127
|
-
#endif
|
128
|
-
|
129
|
-
void
|
130
|
-
Init_gdk_pangorenderer(VALUE mGdk)
|
131
|
-
{
|
132
|
-
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_PANGO_RENDERER, "PangoRenderer", mGdk);
|
133
|
-
|
134
|
-
RG_DEF_METHOD(initialize, -1);
|
135
|
-
RG_DEF_METHOD(set_drawable, 1);
|
136
|
-
RG_DEF_METHOD(set_gc, 1);
|
137
|
-
RG_DEF_METHOD(set_stipple, 2);
|
138
|
-
RG_DEF_METHOD(set_override_color, 2);
|
139
|
-
|
140
|
-
RG_DEF_SMETHOD(get_default, -1);
|
141
|
-
RG_DEF_SMETHOD(default, 0);
|
142
|
-
}
|
143
|
-
*/
|
144
|
-
|
data/ext/gdk3/rbgdkpixbuf.c
DELETED
@@ -1,176 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
-
* Copyright (C) 2002,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
|
-
#define RG_TARGET_NAMESPACE cPixbuf
|
25
|
-
#define _SELF(s) RVAL2GDKPIXBUF(s)
|
26
|
-
|
27
|
-
/* deprecated
|
28
|
-
static VALUE
|
29
|
-
rg_render_threshold_alpha(VALUE self, VALUE bitmap, VALUE src_x, VALUE src_y, VALUE dest_x, VALUE dest_y, VALUE width, VALUE height, VALUE alpha_threshold)
|
30
|
-
{
|
31
|
-
gdk_pixbuf_render_threshold_alpha(_SELF(self), RVAL2GDKBITMAP(bitmap),
|
32
|
-
NUM2INT(src_x), NUM2INT(src_y),
|
33
|
-
NUM2INT(dest_x), NUM2INT(dest_y),
|
34
|
-
NUM2INT(width), NUM2INT(height),
|
35
|
-
NUM2INT(alpha_threshold));
|
36
|
-
return self;
|
37
|
-
}
|
38
|
-
|
39
|
-
static VALUE
|
40
|
-
rg_render_to_drawable(int argc, VALUE *argv, VALUE self)
|
41
|
-
{
|
42
|
-
VALUE gc, src_x, src_y, dest_x, dest_y, width, height,
|
43
|
-
dither, x_dither, y_dither;
|
44
|
-
|
45
|
-
rb_warn("Gdk::Pixbuf#render_to_drawable is obsolete. Use Gdk::Drawable#draw_pixbuf instead.");
|
46
|
-
|
47
|
-
rb_scan_args(argc, argv, "73", &gc, &src_x, &src_y, &dest_x, &dest_y,
|
48
|
-
&width, &height, &dither, &x_dither, &y_dither);
|
49
|
-
|
50
|
-
if (NIL_P(gc))
|
51
|
-
rb_raise(rb_eArgError, "arguments 1 must be non nil");
|
52
|
-
if (NIL_P(src_x))
|
53
|
-
rb_raise(rb_eArgError, "arguments 2 must be non nil");
|
54
|
-
if (NIL_P(src_y))
|
55
|
-
rb_raise(rb_eArgError, "arguments 3 must be non nil");
|
56
|
-
if (NIL_P(dest_x))
|
57
|
-
rb_raise(rb_eArgError, "arguments 4 must be non nil");
|
58
|
-
if (NIL_P(dest_y))
|
59
|
-
rb_raise(rb_eArgError, "arguments 5 must be non nil");
|
60
|
-
if (NIL_P(width))
|
61
|
-
rb_raise(rb_eArgError, "arguments 6 must be non nil");
|
62
|
-
if (NIL_P(height))
|
63
|
-
rb_raise(rb_eArgError, "arguments 7 must be non nil");
|
64
|
-
|
65
|
-
gdk_pixbuf_render_to_drawable(_SELF(self),
|
66
|
-
RVAL2GDKDRAWABLE(self),
|
67
|
-
RVAL2GDKGC(gc),
|
68
|
-
NUM2INT(src_x), NUM2INT(src_y),
|
69
|
-
NUM2INT(dest_x), NUM2INT(dest_y),
|
70
|
-
NUM2INT(width), NUM2INT(height),
|
71
|
-
NIL_P(dither) ? GDK_RGB_DITHER_NONE : RVAL2GDKRGBDITHER(dither),
|
72
|
-
NIL_P(x_dither) ? 0 : NUM2INT(x_dither),
|
73
|
-
NIL_P(y_dither) ? 0 : NUM2INT(y_dither));
|
74
|
-
return self;
|
75
|
-
}
|
76
|
-
|
77
|
-
static VALUE
|
78
|
-
rg_render_pixmap_and_mask(int argc, VALUE *argv, VALUE self)
|
79
|
-
{
|
80
|
-
VALUE colormap_or_alpha, alpha;
|
81
|
-
GdkPixmap *pixmap;
|
82
|
-
GdkBitmap *mask;
|
83
|
-
|
84
|
-
rb_scan_args(argc, argv, "11", &colormap_or_alpha, &alpha);
|
85
|
-
|
86
|
-
if (rb_obj_is_kind_of(colormap_or_alpha, GTYPE2CLASS(GDK_TYPE_COLORMAP))){
|
87
|
-
gdk_pixbuf_render_pixmap_and_mask_for_colormap(_SELF(self),
|
88
|
-
RVAL2GOBJ(colormap_or_alpha),
|
89
|
-
&pixmap,
|
90
|
-
&mask,
|
91
|
-
NIL_P(alpha)?0:NUM2INT(alpha));
|
92
|
-
} else {
|
93
|
-
gdk_pixbuf_render_pixmap_and_mask(_SELF(self),
|
94
|
-
&pixmap,
|
95
|
-
&mask,
|
96
|
-
NIL_P(colormap_or_alpha)?
|
97
|
-
0:NUM2INT(colormap_or_alpha));
|
98
|
-
}
|
99
|
-
|
100
|
-
return rb_ary_new3(2,
|
101
|
-
pixmap ? GOBJ2RVAL(pixmap) : Qnil,
|
102
|
-
mask ? GOBJ2RVAL(mask) : Qnil);
|
103
|
-
}
|
104
|
-
|
105
|
-
static VALUE
|
106
|
-
rg_s_from_drawable(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
107
|
-
{
|
108
|
-
VALUE cmap, src, src_x, src_y, width, height, dest, dest_x, dest_y;
|
109
|
-
GdkPixbuf* buf;
|
110
|
-
|
111
|
-
rb_scan_args(argc, argv, "63", &cmap, &src, &src_x, &src_y, &width, &height,
|
112
|
-
&dest, &dest_x, &dest_y);
|
113
|
-
|
114
|
-
buf = gdk_pixbuf_get_from_drawable(RVAL2GDKPIXBUF(dest),
|
115
|
-
RVAL2GDKDRAWABLE(src),
|
116
|
-
RVAL2GDKCOLORMAP(cmap),
|
117
|
-
NUM2INT(src_x), NUM2INT(src_y),
|
118
|
-
NIL_P(dest_x) ? 0 : NUM2INT(dest_x),
|
119
|
-
NIL_P(dest_y) ? 0 : NUM2INT(dest_y),
|
120
|
-
NUM2INT(width), NUM2INT(height));
|
121
|
-
if (NIL_P(dest)) {
|
122
|
-
if (buf) {
|
123
|
-
return GOBJ2RVALU(buf);
|
124
|
-
} else {
|
125
|
-
return Qnil;
|
126
|
-
}
|
127
|
-
} else {
|
128
|
-
return dest;
|
129
|
-
}
|
130
|
-
}
|
131
|
-
|
132
|
-
static VALUE
|
133
|
-
rg_s_from_image(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
134
|
-
{
|
135
|
-
VALUE cmap, src, src_x, src_y, width, height, dest, dest_x, dest_y;
|
136
|
-
GdkPixbuf* buf;
|
137
|
-
|
138
|
-
rb_scan_args(argc, argv, "63", &cmap, &src, &src_x, &src_y, &width, &height,
|
139
|
-
&dest, &dest_x, &dest_y);
|
140
|
-
|
141
|
-
buf = gdk_pixbuf_get_from_image(RVAL2GDKPIXBUF(dest),
|
142
|
-
RVAL2GDKIMAGE(src),
|
143
|
-
RVAL2GDKCOLORMAP(cmap),
|
144
|
-
NUM2INT(src_x), NUM2INT(src_y),
|
145
|
-
NIL_P(dest_x) ? 0 : NUM2INT(dest_x),
|
146
|
-
NIL_P(dest_y) ? 0 : NUM2INT(dest_y),
|
147
|
-
NUM2INT(width), NUM2INT(height));
|
148
|
-
if (NIL_P(dest)) {
|
149
|
-
if (buf) {
|
150
|
-
return GOBJ2RVAL(buf);
|
151
|
-
} else {
|
152
|
-
return Qnil;
|
153
|
-
}
|
154
|
-
} else {
|
155
|
-
return dest;
|
156
|
-
}
|
157
|
-
}
|
158
|
-
*/
|
159
|
-
|
160
|
-
void
|
161
|
-
Init_gdk_pixbuf(VALUE mGdk)
|
162
|
-
{
|
163
|
-
/*
|
164
|
-
* This defines Gdk::Pixbuf methods of GDK side.
|
165
|
-
*/
|
166
|
-
VALUE RG_TARGET_NAMESPACE = GTYPE2CLASS(GDK_TYPE_PIXBUF);
|
167
|
-
|
168
|
-
/* deprecated
|
169
|
-
RG_DEF_METHOD(render_threshold_alpha, 8);
|
170
|
-
RG_DEF_METHOD(render_to_drawable, -1);
|
171
|
-
RG_DEF_METHOD(render_pixmap_and_mask, -1);
|
172
|
-
|
173
|
-
RG_DEF_SMETHOD(from_drawable, -1);
|
174
|
-
RG_DEF_SMETHOD(from_image, -1);
|
175
|
-
*/
|
176
|
-
}
|
data/ext/gdk3/rbgdkproperty.c
DELETED
@@ -1,305 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/*
|
3
|
-
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
-
* Copyright (C) 2002-2004 Ruby-GNOME2 Project Team
|
5
|
-
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
6
|
-
* Daisuke Kanda,
|
7
|
-
* Hiroshi Igarashi
|
8
|
-
*
|
9
|
-
* This library is free software; you can redistribute it and/or
|
10
|
-
* modify it under the terms of the GNU Lesser General Public
|
11
|
-
* License as published by the Free Software Foundation; either
|
12
|
-
* version 2.1 of the License, or (at your option) any later version.
|
13
|
-
*
|
14
|
-
* This library is distributed in the hope that it will be useful,
|
15
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
17
|
-
* Lesser General Public License for more details.
|
18
|
-
*
|
19
|
-
* You should have received a copy of the GNU Lesser General Public
|
20
|
-
* License along with this library; if not, write to the Free Software
|
21
|
-
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
22
|
-
* MA 02110-1301 USA
|
23
|
-
*/
|
24
|
-
|
25
|
-
#include "rbgdk3private.h"
|
26
|
-
|
27
|
-
#define RG_TARGET_NAMESPACE mProperty
|
28
|
-
|
29
|
-
/* deprecated
|
30
|
-
static VALUE
|
31
|
-
rg_s_text_property_to_text_list(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
32
|
-
{
|
33
|
-
gint num, i;
|
34
|
-
gchar** list;
|
35
|
-
VALUE ret = Qnil;
|
36
|
-
|
37
|
-
if (argc == 3) {
|
38
|
-
VALUE encoding, format, text;
|
39
|
-
rb_scan_args(argc, argv, "30", &encoding, &format, &text);
|
40
|
-
StringValue(text);
|
41
|
-
|
42
|
-
num = gdk_text_property_to_text_list(RVAL2ATOM(encoding),
|
43
|
-
NUM2INT(format),
|
44
|
-
(const guchar*)RVAL2CSTR(text),
|
45
|
-
RSTRING_LEN(text), &list);
|
46
|
-
} else {
|
47
|
-
VALUE display, encoding, format, text;
|
48
|
-
rb_scan_args(argc, argv, "40", &display, &encoding, &format, &text);
|
49
|
-
StringValue(text);
|
50
|
-
|
51
|
-
num = gdk_text_property_to_text_list_for_display(RVAL2GDKDISPLAYOBJECT(display),
|
52
|
-
RVAL2ATOM(encoding),
|
53
|
-
NUM2INT(format),
|
54
|
-
(const guchar*)RVAL2CSTR(text),
|
55
|
-
RSTRING_LEN(text),
|
56
|
-
&list);
|
57
|
-
}
|
58
|
-
|
59
|
-
ret = rb_ary_new2(num);
|
60
|
-
for (i =0; i < num; i++){
|
61
|
-
rb_ary_push(ret, CSTR2RVAL(list[i]));
|
62
|
-
}
|
63
|
-
gdk_free_text_list(list);
|
64
|
-
return ret;
|
65
|
-
}
|
66
|
-
*/
|
67
|
-
|
68
|
-
/* TODO
|
69
|
-
static VALUE
|
70
|
-
rg_s_text_property_to_utf8_list(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
71
|
-
{
|
72
|
-
gint num, i;
|
73
|
-
gchar** list;
|
74
|
-
VALUE ret = Qnil;
|
75
|
-
|
76
|
-
if (argc == 3) {
|
77
|
-
VALUE encoding, format, text;
|
78
|
-
rb_scan_args(argc, argv, "30", &encoding, &format, &text);
|
79
|
-
StringValue(text);
|
80
|
-
|
81
|
-
num = gdk_text_property_to_utf8_list(RVAL2ATOM(encoding),
|
82
|
-
NUM2INT(format),
|
83
|
-
(const guchar*)RVAL2CSTR(text),
|
84
|
-
RSTRING_LEN(text), &list);
|
85
|
-
} else {
|
86
|
-
VALUE display, encoding, format, text;
|
87
|
-
rb_scan_args(argc, argv, "40", &display, &encoding, &format, &text);
|
88
|
-
StringValue(text);
|
89
|
-
|
90
|
-
num = gdk_text_property_to_utf8_list_for_display(RVAL2GDKDISPLAYOBJECT(display),
|
91
|
-
RVAL2ATOM(encoding),
|
92
|
-
NUM2INT(format),
|
93
|
-
(const guchar*)RVAL2CSTR(text),
|
94
|
-
RSTRING_LEN(text),
|
95
|
-
&list);
|
96
|
-
}
|
97
|
-
|
98
|
-
ret = rb_ary_new2(num);
|
99
|
-
for (i =0; i < num; i++){
|
100
|
-
rb_ary_push(ret, CSTR2RVAL(list[i]));
|
101
|
-
}
|
102
|
-
g_strfreev(list);
|
103
|
-
return ret;
|
104
|
-
}
|
105
|
-
*/
|
106
|
-
|
107
|
-
/* deprecated
|
108
|
-
static VALUE
|
109
|
-
rg_s_string_to_compound_text(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
110
|
-
{
|
111
|
-
gint num;
|
112
|
-
GdkAtom encoding;
|
113
|
-
gint format;
|
114
|
-
guchar *ctext;
|
115
|
-
gint length;
|
116
|
-
|
117
|
-
if (argc == 1) {
|
118
|
-
VALUE str;
|
119
|
-
rb_scan_args(argc, argv, "10", &str);
|
120
|
-
num = gdk_string_to_compound_text(RVAL2CSTR(str),
|
121
|
-
&encoding, &format,
|
122
|
-
&ctext, &length);
|
123
|
-
} else {
|
124
|
-
VALUE display, str;
|
125
|
-
|
126
|
-
rb_scan_args(argc, argv, "20", &display, &str);
|
127
|
-
num = gdk_string_to_compound_text_for_display(RVAL2GDKDISPLAYOBJECT(display),
|
128
|
-
RVAL2CSTR(str),
|
129
|
-
&encoding, &format,
|
130
|
-
&ctext, &length);
|
131
|
-
}
|
132
|
-
|
133
|
-
if (num == 0){
|
134
|
-
VALUE ret = CSTR2RVAL((const char*)ctext);
|
135
|
-
gdk_free_compound_text(ctext);
|
136
|
-
return rb_ary_new3(3, GDKATOM2RVAL(encoding),
|
137
|
-
INT2NUM(format), ret);
|
138
|
-
} else {
|
139
|
-
rb_raise(rb_eRuntimeError, "failed to converts a string %d\n", num);
|
140
|
-
}
|
141
|
-
return Qnil;
|
142
|
-
}
|
143
|
-
*/
|
144
|
-
|
145
|
-
static VALUE
|
146
|
-
rg_s_utf8_to_string_target(G_GNUC_UNUSED VALUE self, VALUE str)
|
147
|
-
{
|
148
|
-
return CSTR2RVAL((const char*)gdk_utf8_to_string_target(RVAL2CSTR(str)));
|
149
|
-
}
|
150
|
-
|
151
|
-
/* deprecated
|
152
|
-
static VALUE
|
153
|
-
rg_s_utf8_to_compound_text(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
154
|
-
{
|
155
|
-
GdkAtom encoding;
|
156
|
-
gint format;
|
157
|
-
guchar *ctext;
|
158
|
-
gint length;
|
159
|
-
gint ret;
|
160
|
-
|
161
|
-
if (argc == 1) {
|
162
|
-
VALUE str;
|
163
|
-
rb_scan_args(argc, argv, "10", &str);
|
164
|
-
|
165
|
-
ret = gdk_utf8_to_compound_text(RVAL2CSTR(str),
|
166
|
-
&encoding, &format,
|
167
|
-
&ctext, &length);
|
168
|
-
} else {
|
169
|
-
VALUE display, str;
|
170
|
-
|
171
|
-
rb_scan_args(argc, argv, "20", &display, &str);
|
172
|
-
ret = gdk_utf8_to_compound_text_for_display(RVAL2GDKDISPLAYOBJECT(display),
|
173
|
-
RVAL2CSTR(str),
|
174
|
-
&encoding, &format,
|
175
|
-
&ctext, &length);
|
176
|
-
}
|
177
|
-
|
178
|
-
if (ret){
|
179
|
-
VALUE val = CSTR2RVAL((const char*)ctext);
|
180
|
-
gdk_free_compound_text(ctext);
|
181
|
-
return rb_ary_new3(3, GDKATOM2RVAL(encoding),
|
182
|
-
INT2NUM(format), val);
|
183
|
-
} else {
|
184
|
-
rb_raise(rb_eRuntimeError, "failed to converts a string %d\n", ret);
|
185
|
-
}
|
186
|
-
return Qnil;
|
187
|
-
}
|
188
|
-
*/
|
189
|
-
|
190
|
-
/* TODO
|
191
|
-
static VALUE
|
192
|
-
rg_s_change(int argc, VALUE *argv, VALUE self)
|
193
|
-
{
|
194
|
-
int fmt, len;
|
195
|
-
void* dat;
|
196
|
-
GdkAtom ntype;
|
197
|
-
VALUE win, property, type, size= Qnil, mode, src;
|
198
|
-
|
199
|
-
if(6 == argc)
|
200
|
-
rb_scan_args(argc, argv, "60", &win, &property, &type, &size, &mode, &src);
|
201
|
-
else
|
202
|
-
rb_scan_args(argc, argv, "50", &win, &property, &type, &mode, &src);
|
203
|
-
|
204
|
-
rbgtk_atom2selectiondata(type, size, src, &ntype, &dat, &fmt, &len);
|
205
|
-
|
206
|
-
gdk_property_change(RVAL2GDKWINDOW(win), RVAL2ATOM(property),
|
207
|
-
ntype, fmt, RVAL2GDKPROPMODE(mode), dat, len);
|
208
|
-
|
209
|
-
rbgtk_atom2selectiondata_free(ntype, dat);
|
210
|
-
|
211
|
-
return self;
|
212
|
-
}
|
213
|
-
*/
|
214
|
-
|
215
|
-
static VALUE
|
216
|
-
rg_s_get(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
217
|
-
{
|
218
|
-
/* for argument processing */
|
219
|
-
GdkAtom rtype;
|
220
|
-
gint rfmt, rlen;
|
221
|
-
guchar* rdat;
|
222
|
-
VALUE win, property, type, offset=INT2FIX(0), length=INT2FIX(9999), delete;
|
223
|
-
|
224
|
-
/* for inner processing */
|
225
|
-
gint i;
|
226
|
-
size_t j;
|
227
|
-
VALUE ret = 0;
|
228
|
-
|
229
|
-
if(6 == argc)
|
230
|
-
rb_scan_args(argc, argv, "60", &win, &property, &type, &offset, &length, &delete);
|
231
|
-
else
|
232
|
-
rb_scan_args(argc, argv, "40", &win, &property, &type, &delete);
|
233
|
-
|
234
|
-
if(gdk_property_get(RVAL2GDKWINDOW(win), RVAL2ATOM(property), RVAL2ATOM(type),
|
235
|
-
NUM2INT(offset), NUM2INT(length),
|
236
|
-
RVAL2CBOOL(delete), &rtype, &rfmt, &rlen, &rdat) == FALSE){
|
237
|
-
return Qnil;
|
238
|
-
}
|
239
|
-
|
240
|
-
switch(rfmt){
|
241
|
-
case 8:
|
242
|
-
default:
|
243
|
-
ret = RBG_STRING_SET_UTF8_ENCODING(rb_str_new((const char*)rdat, rlen));
|
244
|
-
break;
|
245
|
-
|
246
|
-
case 16:
|
247
|
-
ret = rb_ary_new();
|
248
|
-
|
249
|
-
for( i = 0; i < rlen; i++){
|
250
|
-
rb_ary_push(ret, rb_Integer(((unsigned short*)rdat)[i]));
|
251
|
-
}
|
252
|
-
break;
|
253
|
-
|
254
|
-
case 32:
|
255
|
-
ret = rb_ary_new();
|
256
|
-
|
257
|
-
if(rtype != GDK_SELECTION_TYPE_ATOM){
|
258
|
-
for(j = 0; j < (rlen/sizeof(unsigned long)); j++){
|
259
|
-
rb_ary_push(ret, INT2FIX(((unsigned long*)rdat)[j]));
|
260
|
-
}
|
261
|
-
} else {
|
262
|
-
for(j = 0; j < (rlen/sizeof(unsigned long)); j++){
|
263
|
-
rb_ary_push(ret, GDKATOM2RVAL((GdkAtom)((unsigned long*)rdat)[j]));
|
264
|
-
}
|
265
|
-
}
|
266
|
-
break;
|
267
|
-
}
|
268
|
-
|
269
|
-
return rb_ary_new3(3, GDKATOM2RVAL(rtype),
|
270
|
-
ret, INT2NUM(rlen));
|
271
|
-
}
|
272
|
-
|
273
|
-
static VALUE
|
274
|
-
rg_s_delete(VALUE self, VALUE win, VALUE property)
|
275
|
-
{
|
276
|
-
gdk_property_delete(RVAL2GDKWINDOW(win), RVAL2ATOM(property));
|
277
|
-
return self;
|
278
|
-
}
|
279
|
-
|
280
|
-
void
|
281
|
-
Init_gdk_property(VALUE mGdk)
|
282
|
-
{
|
283
|
-
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGdk, "Property");
|
284
|
-
|
285
|
-
/* deprecated
|
286
|
-
RG_DEF_SMETHOD(text_property_to_text_list, -1);
|
287
|
-
*/
|
288
|
-
/* TODO
|
289
|
-
RG_DEF_SMETHOD(text_property_to_utf8_list, -1);
|
290
|
-
*/
|
291
|
-
/* deprecated
|
292
|
-
RG_DEF_SMETHOD(string_to_compound_text, -1);
|
293
|
-
*/
|
294
|
-
RG_DEF_SMETHOD(utf8_to_string_target, 1);
|
295
|
-
/* deprecated
|
296
|
-
RG_DEF_SMETHOD(utf8_to_compound_text, -1);
|
297
|
-
*/
|
298
|
-
/* TODO
|
299
|
-
RG_DEF_SMETHOD(change, -1);
|
300
|
-
*/
|
301
|
-
RG_DEF_SMETHOD(get, -1);
|
302
|
-
RG_DEF_SMETHOD(delete, 2);
|
303
|
-
|
304
|
-
G_DEF_CLASS(GDK_TYPE_PROP_MODE, "PropMode", RG_TARGET_NAMESPACE);
|
305
|
-
}
|