gdk3 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
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,71 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008 Ruby-GNOME2 Project Team
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
+ #ifndef __RBGDK3_H__
23
+ #define __RBGDK3_H__
24
+
25
+ #include <gdk/gdk.h>
26
+ #ifdef GDK_WINDOWING_X11
27
+ # include <gdk/gdkx.h>
28
+ #endif
29
+ #ifdef GDK_WINDOWING_WIN32
30
+ # include <gdk/gdkwin32.h>
31
+ #endif
32
+
33
+ #include "rbgdk3conversions.h"
34
+
35
+ #define RBGDK_MAJOR_VERSION RBGLIB_MAJOR_VERSION
36
+ #define RBGDK_MINOR_VERSION RBGLIB_MINOR_VERSION
37
+ #define RBGDK_MICRO_VERSION RBGLIB_MICRO_VERSION
38
+
39
+ #define RVAL2GDKPOINTS(value, n) rbgdk_rval2gdkpoints(value, n)
40
+ #define RVAL2GDKATOMS(value, n) rbgdk_rval2gdkatoms(value, n)
41
+
42
+ #define RVAL2GDKPIXBUFGLIST(value) rbgdk_rval2gdkpixbufglist(value)
43
+
44
+ #define GEV2RVAL(ev) (make_gdkevent(ev))
45
+ #define RVAL2GEV(ev) (get_gdkevent(ev))
46
+ #define RVAL2ATOM(atom) (get_gdkatom(atom))
47
+
48
+ #define GDK_TYPE_GEOMETRY (gdk_geometry_get_type())
49
+ #define GDK_TYPE_ATOM (gdk_atom_get_type())
50
+ #define GDK_TYPE_WINDOW_ATTR (gdk_windowattr_get_type())
51
+ #define GDK_TYPE_TIME_COORD (gdk_timecoord_get_type())
52
+
53
+ typedef struct {
54
+ GdkAtom atom;
55
+ } GdkAtomData;
56
+
57
+ GdkPoint *rbgdk_rval2gdkpoints(VALUE value, long *n);
58
+ GdkAtom *rbgdk_rval2gdkatoms(VALUE value, long *n);
59
+
60
+ GList *rbgdk_rval2gdkpixbufglist(VALUE value);
61
+
62
+ extern GType gdk_windowattr_get_type(void);
63
+ extern GType gdk_atom_get_type(void);
64
+ extern GType gdk_geometry_get_type(void);
65
+ extern GType gdk_timecoord_get_type(void);
66
+
67
+ extern GdkAtom get_gdkatom(VALUE atom);
68
+ extern VALUE make_gdkevent(GdkEvent* event);
69
+ extern GdkEvent* get_gdkevent(VALUE event);
70
+
71
+ #endif /* __RBGDK3_H__ */
@@ -0,0 +1,118 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2008 Ruby-GNOME2 Project Team
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
+ #ifndef __RBGDK3CONVERSIONS_H__
23
+ #define __RBGDK3CONVERSIONS_H__
24
+
25
+ #define RVAL2GDKDEVICE(o) (GDK_DEVICE(RVAL2GOBJ(o)))
26
+ #define RVAL2GDKDISPLAY(o) (GDK_DISPLAY(RVAL2GOBJ(o)))
27
+ #define RVAL2GDKDISPLAYMANAGER(o) (GDK_DISPLAY_MANAGER(RVAL2GOBJ(o)))
28
+ #define RVAL2GDKDISPLAYOBJECT(o) (GDK_DISPLAY_OBJECT(RVAL2GOBJ(o)))
29
+ #define RVAL2GDKDRAGCONTEXT(o) (GDK_DRAG_CONTEXT(RVAL2GOBJ(o)))
30
+ #define RVAL2GDKDRAWABLE(o) (GDK_DRAWABLE(RVAL2GOBJ(o)))
31
+ #define RVAL2GDKKEYMAP(o) (GDK_KEYMAP(RVAL2GOBJ(o)))
32
+ #define RVAL2GDKPANGORENDERER(o) (GDK_PANGO_RENDERER(RVAL2GOBJ(o)))
33
+ #define RVAL2GDKPIXBUF(o) (GDK_PIXBUF(RVAL2GOBJ(o)))
34
+ #define RVAL2GDKSCREEN(o) (GDK_SCREEN(RVAL2GOBJ(o)))
35
+ #define RVAL2GDKVISUAL(o) (GDK_VISUAL(RVAL2GOBJ(o)))
36
+ #define RVAL2GDKWINDOW(o) (GDK_WINDOW(RVAL2GOBJ(o)))
37
+ #define RVAL2GDKX11WINDOW(o) (GDK_X11_WINDOW(RVAL2GOBJ(o)))
38
+
39
+ #define RVAL2GDKATOM(o) ((GdkAtomData*)RVAL2BOXED(o, GDK_TYPE_ATOM))
40
+ #define GDKATOM2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_ATOM))
41
+ #define RVAL2GDKCOLOR(o) ((GdkColor*)RVAL2BOXED(o, GDK_TYPE_COLOR))
42
+ #define GDKCOLOR2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_COLOR))
43
+ #define RVAL2GDKCURSOR(o) ((GdkCursor*)RVAL2BOXED(o, GDK_TYPE_CURSOR))
44
+ #define GDKCURSOR2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_CURSOR))
45
+ #define RVAL2GDKEVENT(o) ((GdkEvent*)RVAL2BOXED(o, GDK_TYPE_EVENT))
46
+ #define GDKEVENT2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_EVENT))
47
+ #define RVAL2GDKGEOMETRY(o) ((GdkGeometry*)RVAL2BOXED(o, GDK_TYPE_GEOMETRY))
48
+ #define GDKGEOMETRY2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_GEOMETRY))
49
+ #define RVAL2GDKRECTANGLE(o) ((GdkRectangle*)RVAL2BOXED(o, GDK_TYPE_RECTANGLE))
50
+ #define GDKRECTANGLE2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_RECTANGLE))
51
+ #define RVAL2GDKRGBA(o) ((GdkRGBA*)RVAL2BOXED(o, GDK_TYPE_RGBA))
52
+ #define GDKRGBA2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_RGBA))
53
+ #define RVAL2GDKTIMECOORD(o) ((GdkTimeCoord*)RVAL2BOXED(o, GDK_TYPE_TIME_COORD))
54
+ #define GDKTIMECOORD2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_TIME_COORD))
55
+ #define RVAL2GDKWINDOWATTR(o) ((GdkWindowAttr*)RVAL2BOXED(o, GDK_TYPE_WINDOW_ATTR))
56
+ #define GDKWINDOWATTR2RVAL(o) (BOXED2RVAL(o, GDK_TYPE_WINDOW_ATTR))
57
+
58
+ #define RVAL2GDKEVENTKEY(o) ((GdkEventKey*)RVAL2GDKEVENT(o))
59
+
60
+ #define RVAL2GDKAXISUSE(o) (RVAL2GENUM(o, GDK_TYPE_AXIS_USE))
61
+ #define GDKAXISUSE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_AXIS_USE))
62
+ #define RVAL2GDKBYTEORDER(o) (RVAL2GENUM(o, GDK_TYPE_BYTE_ORDER))
63
+ #define GDKBYTEORDER2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_BYTE_ORDER))
64
+ #define RVAL2GDKCURSORTYPE(o) (RVAL2GENUM(o, GDK_TYPE_CURSOR_TYPE))
65
+ #define GDKCURSORTYPE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_CURSOR_TYPE))
66
+ #define RVAL2GDKDRAGPROTOCOL(o) (RVAL2GENUM(o, GDK_TYPE_DRAG_PROTOCOL))
67
+ #define GDKDRAGPROTOCOL2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_DRAG_PROTOCOL))
68
+ #define RVAL2GDKEVENTTYPE(o) (RVAL2GENUM(o, GDK_TYPE_EVENT_TYPE))
69
+ #define GDKEVENTTYPE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_EVENT_TYPE))
70
+ #define RVAL2GDKFILTERRETURN(o) (RVAL2GENUM(o, GDK_TYPE_FILTER_RETURN))
71
+ #define GDKFILTERRETURN2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_FILTER_RETURN))
72
+ #define RVAL2GDKGRABSTATUS(o) (RVAL2GENUM(o, GDK_TYPE_GRAB_STATUS))
73
+ #define GDKGRABSTATUS2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_GRAB_STATUS))
74
+ #define RVAL2GDKGRAVITY(o) (RVAL2GENUM(o, GDK_TYPE_GRAVITY))
75
+ #define GDKGRAVITY2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_GRAVITY))
76
+ #define RVAL2GDKINPUTMODE(o) (RVAL2GENUM(o, GDK_TYPE_INPUT_MODE))
77
+ #define GDKINPUTMODE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_INPUT_MODE))
78
+ #define RVAL2GDKINPUTSOURCE(o) (RVAL2GENUM(o, GDK_TYPE_INPUT_SOURCE))
79
+ #define GDKINPUTSOURCE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_INPUT_SOURCE))
80
+ #define RVAL2GDKPROPMODE(o) (RVAL2GENUM(o, GDK_TYPE_PROP_MODE))
81
+ #define GDKPROPMODE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_PROP_MODE))
82
+ #define RVAL2GDKRGBDITHER(o) (RVAL2GENUM(o, GDK_TYPE_RGB_DITHER))
83
+ #define GDKRGBDITHER2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_RGB_DITHER))
84
+ #define RVAL2GDKVISUALTYPE(o) (RVAL2GENUM(o, GDK_TYPE_VISUAL_TYPE))
85
+ #define GDKVISUALTYPE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_VISUAL_TYPE))
86
+ #define RVAL2GDKWINDOWEDGE(o) (RVAL2GENUM(o, GDK_TYPE_WINDOW_EDGE))
87
+ #define GDKWINDOWEDGE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_WINDOW_EDGE))
88
+ #define RVAL2GDKWINDOWSTATE(o) (RVAL2GENUM(o, GDK_TYPE_WINDOW_STATE))
89
+ #define GDKWINDOWSTATE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_WINDOW_STATE))
90
+ #define RVAL2GDKWINDOWTYPE(o) (RVAL2GENUM(o, GDK_TYPE_WINDOW_TYPE))
91
+ #define GDKWINDOWTYPE2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_WINDOW_TYPE))
92
+ #define RVAL2GDKWINDOWHINT(o) (RVAL2GENUM(o, GDK_TYPE_WINDOW_TYPE_HINT))
93
+ #define GDKWINDOWHINT2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_WINDOW_TYPE_HINT))
94
+ #define RVAL2GDKWINDOWWINDOWCLASS(o) (RVAL2GENUM(o, GDK_TYPE_WINDOW_WINDOW_CLASS))
95
+ #define GDKWINDOWWINDOWCLASS2RVAL(o) (GENUM2RVAL(o, GDK_TYPE_WINDOW_WINDOW_CLASS))
96
+
97
+ #define RVAL2GDKDRAGACTION(o) (RVAL2GFLAGS(o, GDK_TYPE_DRAG_ACTION))
98
+ #define GDKDRAGACTION2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_DRAG_ACTION))
99
+ #define RVAL2GDKEVENTMASK(o) (RVAL2GFLAGS(o, GDK_TYPE_EVENT_MASK))
100
+ #define GDKEVENTMASK2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_EVENT_MASK))
101
+ #define RVAL2GDKMODIFIERTYPE(o) (RVAL2GFLAGS(o, GDK_TYPE_MODIFIER_TYPE))
102
+ #define GDKMODIFIERTYPE2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_MODIFIER_TYPE))
103
+ #define RVAL2GDKWINDOWHINTS(o) (RVAL2GFLAGS(o, GDK_TYPE_WINDOW_HINTS))
104
+ #define GDKWINDOWHINTS2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_WINDOW_HINTS))
105
+ #define RVAL2GDKWMDECORATION(o) (RVAL2GFLAGS(o, GDK_TYPE_WM_DECORATION))
106
+ #define GDKWMDECORATION2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_WM_DECORATION))
107
+ #define RVAL2GDKWMFUNCTION(o) (RVAL2GFLAGS(o, GDK_TYPE_WM_FUNCTION))
108
+ #define GDKWMFUNCTION2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_WM_FUNCTION))
109
+ #define RVAL2GDKDRAGACTION(o) (RVAL2GFLAGS(o, GDK_TYPE_DRAG_ACTION))
110
+ #define GDKDRAGACTION2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_DRAG_ACTION))
111
+ #define RVAL2GDKMODIFIERTYPE(o) (RVAL2GFLAGS(o, GDK_TYPE_MODIFIER_TYPE))
112
+ #define GDKMODIFIERTYPE2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_MODIFIER_TYPE))
113
+ #define RVAL2GDKWINDOWATTRIBUTESTYPE(o) (RVAL2GFLAGS(o, GDK_TYPE_WINDOW_ATTRIBUTES_TYPE))
114
+ #define GDKWINDOWATTRIBUTESTYPE2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_WINDOW_ATTRIBUTES_TYPE))
115
+ #define RVAL2GDKWINDOWHINTS(o) (RVAL2GFLAGS(o, GDK_TYPE_WINDOW_HINTS))
116
+ #define GDKWINDOWHINTS2RVAL(o) (GFLAGS2RVAL(o, GDK_TYPE_WINDOW_HINTS))
117
+
118
+ #endif /* __RBGDK3CONVERSIONS_H__ */
@@ -0,0 +1,93 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2002,2003 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
+ #ifndef __RBGDK3PRIVATE_H__
26
+ #define __RBGDK3PRIVATE_H__
27
+
28
+ #ifdef HAVE_RUBY_ST_H
29
+ # include <ruby/st.h>
30
+ #else
31
+ # include <st.h>
32
+ #endif
33
+
34
+ #include <rb_cairo.h>
35
+ #include <rbgobject.h>
36
+ #include <rbpango.h>
37
+ #include "rbgdk3.h"
38
+
39
+ #ifndef HAVE_RB_ERRINFO
40
+ # define rb_errinfo() (ruby_errinfo)
41
+ #endif
42
+
43
+ #ifndef G_VALUE_INIT
44
+ # define G_VALUE_INIT { 0, { { 0 } } }
45
+ #endif
46
+
47
+ #if defined(HAVE_RB_CAIRO_H)
48
+ # define CAIRO_AVAILABLE 1
49
+ #else
50
+ # define CAIRO_AVAILABLE 0
51
+ #endif
52
+
53
+ extern ID id_call;
54
+
55
+ G_GNUC_INTERNAL void Init_gdk(void);
56
+ G_GNUC_INTERNAL void Init_gdk_atom(VALUE mGdk);
57
+ G_GNUC_INTERNAL void Init_gdk_cairo(void);
58
+ G_GNUC_INTERNAL void Init_gdk_color(VALUE mGdk);
59
+ G_GNUC_INTERNAL void Init_gdk_const(VALUE mGdk);
60
+ G_GNUC_INTERNAL void Init_gdk_cursor(VALUE mGdk);
61
+ G_GNUC_INTERNAL void Init_gdk_device(VALUE mGdk);
62
+ G_GNUC_INTERNAL void Init_gdk_display(VALUE mGdk);
63
+ G_GNUC_INTERNAL void Init_gdk_display_manager(VALUE mGdk);
64
+ G_GNUC_INTERNAL void Init_gdk_dragcontext(VALUE mGdk);
65
+ G_GNUC_INTERNAL void Init_gdk_event(VALUE mGdk);
66
+ G_GNUC_INTERNAL void Init_gdk_geometry(VALUE mGdk);
67
+ G_GNUC_INTERNAL void Init_gdk_keymap(VALUE mGdk);
68
+ G_GNUC_INTERNAL void Init_gdk_keyval(VALUE mGdk);
69
+ G_GNUC_INTERNAL void Init_gdk_pango(VALUE mGdk);
70
+ /* deprecated
71
+ G_GNUC_INTERNAL void Init_gdk_pangorenderer(VALUE mGdk);
72
+ */
73
+ G_GNUC_INTERNAL void Init_gdk_pixbuf(VALUE mGdk);
74
+ G_GNUC_INTERNAL void Init_gdk_property(VALUE mGdk);
75
+ G_GNUC_INTERNAL void Init_gdk_rectangle(VALUE mGdk);
76
+ /* deprecated
77
+ G_GNUC_INTERNAL void Init_gdk_rgb(VALUE mGdk);
78
+ */
79
+ G_GNUC_INTERNAL void Init_gdk_rgba(VALUE mGdk);
80
+ G_GNUC_INTERNAL void Init_gdk_screen(VALUE mGdk);
81
+ G_GNUC_INTERNAL void Init_gdk_selection(VALUE mGdk);
82
+ G_GNUC_INTERNAL void Init_gdk_threads(VALUE mGdk);
83
+ G_GNUC_INTERNAL void Init_gdk_timecoord(VALUE mGdk);
84
+ G_GNUC_INTERNAL void Init_gdk_visual(VALUE mGdk);
85
+ G_GNUC_INTERNAL void Init_gdk_window(VALUE mGdk);
86
+ G_GNUC_INTERNAL void Init_gdk_windowattr(VALUE mGdk);
87
+ G_GNUC_INTERNAL void Init_gdkx11(void);
88
+ G_GNUC_INTERNAL void Init_gdkx11_x11window(VALUE mGdkX11);
89
+ /* deprecated
90
+ G_GNUC_INTERNAL void Init_gdk_draw(VALUE mGdk);
91
+ */
92
+
93
+ #endif /* __RBGDK3PRIVATE_H__ */
@@ -0,0 +1,122 @@
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 cAtom
25
+ #define _SELF(a) ((RVAL2GDKATOM(a))->atom)
26
+
27
+ /*****************************************/
28
+ static GdkAtomData *
29
+ gdk_atom_copy(const GdkAtom atom)
30
+ {
31
+ GdkAtomData* data;
32
+ data = g_new(GdkAtomData, 1);
33
+ data->atom = atom;
34
+ return data;
35
+ }
36
+
37
+ GType
38
+ gdk_atom_get_type(void)
39
+ {
40
+ static GType our_type = 0;
41
+ if (our_type == 0)
42
+ our_type = g_boxed_type_register_static ("GdkAtomData",
43
+ (GBoxedCopyFunc)gdk_atom_copy,
44
+ (GBoxedFreeFunc)g_free);
45
+ return our_type;
46
+ }
47
+
48
+ GdkAtom
49
+ get_gdkatom(VALUE atom)
50
+ {
51
+ if (TYPE(atom) == T_STRING)
52
+ return gdk_atom_intern(RVAL2CSTR(atom), FALSE);
53
+ return (RVAL2GDKATOM(atom))->atom;
54
+ }
55
+ /*****************************************/
56
+
57
+ static VALUE
58
+ rg_s_intern(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
59
+ {
60
+ VALUE name;
61
+ VALUE exist;
62
+
63
+ rb_scan_args(argc, argv, "11", &name, &exist);
64
+
65
+ return GDKATOM2RVAL(gdk_atom_intern(RVAL2CSTR(name), RVAL2CBOOL(exist)));
66
+ }
67
+
68
+ /* We don't need them.
69
+ GdkAtom gdk_atom_intern_static_string(const gchar *atom_name);
70
+ */
71
+
72
+ static VALUE
73
+ rg_initialize(VALUE self, VALUE num)
74
+ {
75
+ guint atom = FIX2INT(num);
76
+ if (atom == 0){
77
+ /* This is a trick for passing 0(NULL) */
78
+ G_INITIALIZE(self, GUINT_TO_POINTER(1));
79
+ _SELF(self) = GUINT_TO_POINTER(GDK_NONE);
80
+ } else {
81
+ G_INITIALIZE(self, GUINT_TO_POINTER(atom));
82
+ }
83
+
84
+ return Qnil;
85
+ }
86
+
87
+ static VALUE
88
+ rg_name(VALUE self)
89
+ {
90
+ return CSTR2RVAL_FREE(gdk_atom_name(_SELF(self)));
91
+ }
92
+
93
+ static VALUE
94
+ rg_to_i(VALUE self)
95
+ {
96
+ return UINT2NUM(GPOINTER_TO_UINT(_SELF(self)));
97
+ }
98
+
99
+ static VALUE
100
+ rg_operator_equal(VALUE self, VALUE other)
101
+ {
102
+ return CBOOL2RVAL(_SELF(self) == _SELF(other));
103
+ }
104
+
105
+ void
106
+ Init_gdk_atom(VALUE mGdk)
107
+ {
108
+ VALUE none;
109
+ VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_ATOM, "Atom", mGdk);
110
+
111
+ RG_DEF_SMETHOD(intern, -1);
112
+
113
+ RG_DEF_METHOD(initialize, 1);
114
+ RG_DEF_METHOD(name, 0);
115
+ RG_DEF_METHOD(to_i, 0);
116
+ RG_DEF_METHOD_OPERATOR("==", equal, 1);
117
+
118
+ /* This is a trick to define GDK_NONE as a BOXED object */
119
+ none = GDKATOM2RVAL((gpointer)1);
120
+ rb_define_const(RG_TARGET_NAMESPACE, "NONE", none);
121
+ _SELF(none) = GDK_NONE;
122
+ }
@@ -0,0 +1,95 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
+ * Copyright (C) 2005 Kouhei Sutou
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
+ #if CAIRO_AVAILABLE
25
+ #include <gdk/gdk.h>
26
+ #include <rb_cairo.h>
27
+
28
+ #define RG_TARGET_NAMESPACE rb_cCairo_Context
29
+ #define _SELF(self) RVAL2CRCONTEXT(self)
30
+
31
+ static VALUE
32
+ rg_set_source_gdk_color(VALUE self, VALUE color)
33
+ {
34
+ gdk_cairo_set_source_color(_SELF(self), RVAL2GDKCOLOR(color));
35
+ rb_cairo_check_status(cairo_status(_SELF(self)));
36
+ return self;
37
+ }
38
+
39
+ static VALUE
40
+ rg_set_source_pixbuf(int argc, VALUE *argv, VALUE self)
41
+ {
42
+ VALUE pixbuf, pixbuf_x, pixbuf_y;
43
+
44
+ rb_scan_args(argc, argv, "12", &pixbuf, &pixbuf_x, &pixbuf_y);
45
+
46
+ gdk_cairo_set_source_pixbuf(_SELF(self),
47
+ RVAL2GDKPIXBUF(pixbuf),
48
+ NIL_P(pixbuf_x) ? 0 : NUM2DBL(pixbuf_x),
49
+ NIL_P(pixbuf_y) ? 0 : NUM2DBL(pixbuf_y));
50
+ rb_cairo_check_status(cairo_status(_SELF(self)));
51
+ return self;
52
+ }
53
+
54
+ /* deprecated
55
+ static VALUE
56
+ rg_set_source_pixmap(VALUE self, VALUE pixmap, VALUE pixmap_x, VALUE pixmap_y)
57
+ {
58
+ gdk_cairo_set_source_pixmap(_SELF(self), RVAL2GDKPIXMAP(pixmap),
59
+ NUM2DBL(pixmap_x), NUM2DBL(pixmap_y));
60
+ rb_cairo_check_status(cairo_status(_SELF(self)));
61
+ return self;
62
+ }
63
+ */
64
+
65
+ static VALUE
66
+ rg_gdk_rectangle(VALUE self, VALUE rectangle)
67
+ {
68
+ gdk_cairo_rectangle(_SELF(self),
69
+ RVAL2GDKRECTANGLE(rectangle));
70
+ rb_cairo_check_status(cairo_status(_SELF(self)));
71
+ return self;
72
+ }
73
+
74
+ static VALUE
75
+ rg_gdk_region(VALUE self, VALUE region)
76
+ {
77
+ gdk_cairo_region(_SELF(self), RVAL2CRREGION(region));
78
+ rb_cairo_check_status(cairo_status(_SELF(self)));
79
+ return self;
80
+ }
81
+ #endif
82
+
83
+ void
84
+ Init_gdk_cairo(void)
85
+ {
86
+ #if CAIRO_AVAILABLE
87
+ RG_DEF_METHOD(set_source_gdk_color, 1);
88
+ RG_DEF_METHOD(set_source_pixbuf, -1);
89
+ /* deprecated
90
+ RG_DEF_METHOD(set_source_pixmap, 3);
91
+ */
92
+ RG_DEF_METHOD(gdk_rectangle, 1);
93
+ RG_DEF_METHOD(gdk_region, 1);
94
+ #endif
95
+ }