gtk2 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. data/ChangeLog +52 -0
  2. data/ext/gtk2/extconf.rb +18 -9
  3. data/ext/gtk2/rbgdk.h +3 -0
  4. data/ext/gtk2/rbgdkdragcontext.c +4 -4
  5. data/ext/gtk2/rbgdkevent.c +18 -5
  6. data/ext/gtk2/rbgdkpixmap.c +43 -48
  7. data/ext/gtk2/rbgdkproperty.c +6 -5
  8. data/ext/gtk2/rbgdkscreen.c +18 -74
  9. data/ext/gtk2/rbgdkselection.c +2 -2
  10. data/ext/gtk2/rbgdkwindow.c +11 -18
  11. data/ext/gtk2/rbgdkwindowattr.c +1 -1
  12. data/ext/gtk2/rbgtkaccelgroup.c +1 -1
  13. data/ext/gtk2/rbgtkaction.c +8 -26
  14. data/ext/gtk2/rbgtkactiongroup.c +6 -6
  15. data/ext/gtk2/rbgtkadjustment.c +20 -74
  16. data/ext/gtk2/rbgtkbindingset.c +1 -1
  17. data/ext/gtk2/rbgtkbuilder.c +2 -1
  18. data/ext/gtk2/rbgtkbutton.c +1 -9
  19. data/ext/gtk2/rbgtkcalendar.c +1 -1
  20. data/ext/gtk2/rbgtkcellrendererspinner.c +0 -3
  21. data/ext/gtk2/rbgtkcellrenderertext.c +1 -2
  22. data/ext/gtk2/rbgtkcellview.c +6 -11
  23. data/ext/gtk2/rbgtkcolorselectiondialog.c +2 -28
  24. data/ext/gtk2/rbgtkcombo.c +2 -2
  25. data/ext/gtk2/rbgtkcombobox.c +9 -29
  26. data/ext/gtk2/rbgtkcontainer.c +1 -1
  27. data/ext/gtk2/rbgtkcurve.c +4 -2
  28. data/ext/gtk2/rbgtkdialog.c +2 -3
  29. data/ext/gtk2/rbgtkdrag.c +3 -3
  30. data/ext/gtk2/rbgtkentry.c +2 -2
  31. data/ext/gtk2/rbgtkentrycompletion.c +1 -4
  32. data/ext/gtk2/rbgtkfilechooser.c +32 -29
  33. data/ext/gtk2/rbgtkfilechooserdialog.c +8 -6
  34. data/ext/gtk2/rbgtkfilefilter.c +8 -4
  35. data/ext/gtk2/rbgtkframe.c +3 -4
  36. data/ext/gtk2/rbgtkhandlebox.c +0 -7
  37. data/ext/gtk2/rbgtkicontheme.c +4 -13
  38. data/ext/gtk2/rbgtkiconview.c +4 -15
  39. data/ext/gtk2/rbgtkimcontext.c +1 -1
  40. data/ext/gtk2/rbgtkinvisible.c +5 -21
  41. data/ext/gtk2/rbgtkitemfactory.c +3 -3
  42. data/ext/gtk2/rbgtklabel.c +0 -2
  43. data/ext/gtk2/rbgtklinkbutton.c +0 -2
  44. data/ext/gtk2/rbgtkmain.c +7 -10
  45. data/ext/gtk2/rbgtkmenu.c +22 -74
  46. data/ext/gtk2/rbgtkmenuitem.c +16 -55
  47. data/ext/gtk2/rbgtkmenushell.c +3 -11
  48. data/ext/gtk2/rbgtkmessagedialog.c +11 -20
  49. data/ext/gtk2/rbgtknotebook.c +0 -1
  50. data/ext/gtk2/rbgtkoptionmenu.c +1 -2
  51. data/ext/gtk2/rbgtkprintjob.c +1 -2
  52. data/ext/gtk2/rbgtkprintoperation.c +0 -2
  53. data/ext/gtk2/rbgtkradioaction.c +2 -7
  54. data/ext/gtk2/rbgtkradiobutton.c +1 -1
  55. data/ext/gtk2/rbgtkradiomenuitem.c +4 -6
  56. data/ext/gtk2/rbgtkradiotoolbutton.c +2 -4
  57. data/ext/gtk2/rbgtkrange.c +1 -2
  58. data/ext/gtk2/rbgtkrc.c +8 -9
  59. data/ext/gtk2/rbgtkrcstyle.c +2 -2
  60. data/ext/gtk2/rbgtkrecentaction.c +0 -1
  61. data/ext/gtk2/rbgtkrecentchooser.c +3 -3
  62. data/ext/gtk2/rbgtkrecentdata.c +2 -9
  63. data/ext/gtk2/rbgtkrecentfilter.c +2 -1
  64. data/ext/gtk2/rbgtkrecentfilterinfo.c +5 -16
  65. data/ext/gtk2/rbgtkrecentinfo.c +2 -2
  66. data/ext/gtk2/rbgtkrecentmanager.c +1 -2
  67. data/ext/gtk2/rbgtkruler.c +6 -16
  68. data/ext/gtk2/rbgtkscalebutton.c +16 -48
  69. data/ext/gtk2/rbgtkscrolledwindow.c +1 -1
  70. data/ext/gtk2/rbgtkselectiondata.c +10 -34
  71. data/ext/gtk2/rbgtksettings.c +1 -1
  72. data/ext/gtk2/rbgtkspinner.c +0 -3
  73. data/ext/gtk2/rbgtkstatusbar.c +5 -16
  74. data/ext/gtk2/rbgtkstatusicon.c +2 -9
  75. data/ext/gtk2/rbgtkstock.c +4 -4
  76. data/ext/gtk2/rbgtktable.c +8 -13
  77. data/ext/gtk2/rbgtktextattributes.c +0 -2
  78. data/ext/gtk2/rbgtktextbuffer.c +17 -16
  79. data/ext/gtk2/rbgtktextmark.c +7 -14
  80. data/ext/gtk2/rbgtktexttag.c +1 -2
  81. data/ext/gtk2/rbgtktextview.c +3 -4
  82. data/ext/gtk2/rbgtktoggleaction.c +5 -16
  83. data/ext/gtk2/rbgtktogglebutton.c +1 -2
  84. data/ext/gtk2/rbgtktoggletoolbutton.c +5 -16
  85. data/ext/gtk2/rbgtktoolbar.c +8 -31
  86. data/ext/gtk2/rbgtktoolitem.c +3 -1
  87. data/ext/gtk2/rbgtktreerowreference.c +4 -4
  88. data/ext/gtk2/rbgtktreesortable.c +0 -3
  89. data/ext/gtk2/rbgtktreestore.c +10 -7
  90. data/ext/gtk2/rbgtktreeview.c +5 -8
  91. data/ext/gtk2/rbgtktreeviewcolumn.c +13 -34
  92. data/ext/gtk2/rbgtkuimanager.c +2 -3
  93. data/ext/gtk2/rbgtkwidget.c +24 -44
  94. data/ext/gtk2/rbgtkwindow.c +32 -92
  95. data/lib/gtk2/base.rb +1 -1
  96. metadata +13 -13
data/ChangeLog CHANGED
@@ -1,3 +1,55 @@
1
+ 2011-09-16 Nikolai Weibull <now@bitwi.se>
2
+
3
+ * lib/gtk2.rb: Remove unused variable.
4
+ * gtk2/ext/gtk2/rbgdkscreen.c: Use RVAL2STRV() instead of RVAL2ARGV().
5
+
6
+ 2011-09-15 Nikolai Weibull <now@bitwi.se>
7
+
8
+ * ext/gtk2/*.c: Use new G_REPLACE_SET_PROPERTY(),
9
+ G_REPLACE_GET_PROPERTY(), and G_REPLACE_ACTION() macros.
10
+
11
+ 2011-09-14 Nikolai Weibull <now@bitwi.se>
12
+
13
+ * ext/gtk2/*.c: Fix various compiler warnings.
14
+
15
+ 2011-09-12 Nikolai Weibull <now@bitwi.se>
16
+
17
+ * ext/gtk2/*.c: Remove methods that implement methods already
18
+ implemented as properties.
19
+ * ext/gtk2/*.c: Call StringValue() before calling
20
+ RSTRING_PTR()/RSTRING_LEN(); also use RSTRING_PTR() instead of
21
+ RVAL2CSTR() if StringValue() has already been called on the value.
22
+
23
+ 2011-09-11 Kouhei Sutou <kou@cozmixng.org>
24
+
25
+ * ext/gtk2/extconf.rb (InitCreator#print_data): fix wrong
26
+ initialization order bug. If "Init_gtk_gdk_gc()" is the first
27
+ initialize function, the previous implementation can't resolve
28
+ dependency order.
29
+ Reported by ashbb. Thanks!!!
30
+
31
+ 2011-09-10 Nikolai Weibull <now@bitwi.se>
32
+
33
+ * ext/gtk2/*.c: Fix all RVAL2CSTRFILENAME calls.
34
+
35
+ 2011-09-09 Nikolai Weibull <now@bitwi.se>
36
+
37
+ * ext/gtk2/*.c: Fix all warnings generated with gcc 4.4.5.
38
+ * ext/gtk2/*.c: Fix all RVAL2CSTR calls.
39
+
40
+ 2011-08-25 Kouhei Sutou <kou@cozmixng.org>
41
+
42
+ * ext/gtk2/rbgtkfilefilter.c (Gtk::FileFilter#add_custom): fix
43
+ crash bug because of method name is missing.
44
+ Reported by Jeff Moore. Thanks!!!
45
+
46
+ 2011-07-31 Kouhei Sutou <kou@cozmixng.org>
47
+
48
+ * ext/gtk2/rbgtkcellrendererspinner.c, ext/gtk2/rbgtkspinner.c:
49
+ don't expand "$Date$" because it may include non LANG=C
50
+ characters. #3383158
51
+ Reported by Antonio Terceiro. Thanks!!!
52
+
1
53
  2011-06-05 Kouhei Sutou <kou@cozmixng.org>
2
54
 
3
55
  * sample/gtk-demo/cairo-operator.rb
@@ -31,6 +31,8 @@ rescue LoadError
31
31
  require 'mkmf-gnome2'
32
32
  end
33
33
 
34
+ have_func("rb_errinfo")
35
+
34
36
  ["glib2", "atk", "pango", "gdk_pixbuf2"].each do |package|
35
37
  directory = "#{package}#{version_suffix}"
36
38
  build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
@@ -98,8 +100,6 @@ if target != "win32" and PKGConfig.have_package('gtk+-unix-print-2.0')
98
100
  $defs.push("-DHAVE_GTK_UNIX_PRINT")
99
101
  end
100
102
 
101
- have_func("rb_errinfo")
102
-
103
103
  create_pkg_config_file("Ruby/GTK2", package_id, ruby_gnome2_version)
104
104
 
105
105
  class InitCreator
@@ -136,6 +136,16 @@ class InitCreator
136
136
  end
137
137
  end
138
138
 
139
+ inits[""] = inits[""].sort_by do |value|
140
+ if value == "Init_gtk_gdk_draw()"
141
+ inits[""].size * 2
142
+ elsif value == "Init_gtk_gdk_gc()"
143
+ -inits[""].size
144
+ else
145
+ inits[""].index(value)
146
+ end
147
+ end
148
+
139
149
  print_data(inits, "", nil, true)
140
150
  print_data(inits, "GTK_DISABLE_DEPRECATED", "ifndef", true)
141
151
  print_data(inits, "GTK_ENABLE_BROKEN", "ifdef", true)
@@ -157,14 +167,13 @@ class InitCreator
157
167
  print "##{defs} #{type}\n" if defs
158
168
  sorted_array = array[type].dup
159
169
  dependencies.each do |key, values|
160
- key_index = sorted_array.index(key)
161
- values.each do |value|
162
- value_index = sorted_array.index(value)
163
- next if value_index.nil?
164
- sorted_array.delete(value)
165
- sorted_array[key_index - 1, 0] = value
166
- key_index = sorted_array.index(key)
170
+ next unless sorted_array.include?(key)
171
+ sorted_array.delete(key)
172
+ value_indexes = values.collect do |value|
173
+ sorted_array.index(value)
167
174
  end
175
+ max_value_index = value_indexes.compact.max
176
+ sorted_array[max_value_index + 1, 0] = key
168
177
  end
169
178
  sorted_array.each do |val|
170
179
  print "#{extern_def} #{val};\n"
@@ -23,6 +23,9 @@
23
23
  #define GEV2RVAL(ev) (make_gdkevent(ev))
24
24
  #define RVAL2GEV(ev) (get_gdkevent(ev))
25
25
  #define RVAL2ATOM(atom) (get_gdkatom(atom))
26
+ #define RVAL2GDKNATIVEWINDOW(value) ((GdkNativeWindow)NUM2UINT(value))
27
+ /* TODO: Will UINT2NUM work for pointers on 64-bit Windows? */
28
+ #define GDKNATIVEWINDOW2RVAL(value) UINT2NUM((guint32)value)
26
29
 
27
30
  #define GDK_TYPE_GEOMETRY (gdk_geometry_get_type())
28
31
  #define GDK_TYPE_REGION (gdk_region_get_type())
@@ -84,24 +84,24 @@ gdkdragcontext_s_get_protocol(int argc, VALUE *argv, VALUE self)
84
84
  {
85
85
  VALUE xid;
86
86
  GdkDragProtocol prot;
87
- guint32 ret;
87
+ GdkNativeWindow ret;
88
88
 
89
89
  if (argc == 1) {
90
90
  rb_scan_args(argc, argv, "10", &xid);
91
- ret = gdk_drag_get_protocol(NUM2UINT(xid), &prot);
91
+ ret = gdk_drag_get_protocol(RVAL2GDKNATIVEWINDOW(xid), &prot);
92
92
  } else {
93
93
  #if GTK_CHECK_VERSION(2,2,0)
94
94
  VALUE display;
95
95
  rb_scan_args(argc, argv, "20", &display, &xid);
96
96
  ret = gdk_drag_get_protocol_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
97
- NUM2UINT(xid), &prot);
97
+ RVAL2GDKNATIVEWINDOW(xid), &prot);
98
98
  #else
99
99
  rb_warn("Not supported arguments for Gdk::Display in GTK+-2.0.x.");
100
100
  ret = gdk_drag_get_protocol(NUM2UINT(xid), &prot);
101
101
  #endif
102
102
  }
103
103
 
104
- return rb_ary_new3(2, GENUM2RVAL(prot, GDK_TYPE_DRAG_PROTOCOL), UINT2NUM(ret));
104
+ return rb_ary_new3(2, GENUM2RVAL(prot, GDK_TYPE_DRAG_PROTOCOL), GDKNATIVEWINDOW2RVAL(ret));
105
105
  }
106
106
 
107
107
  /* Instance Methods */
@@ -51,7 +51,7 @@ gdkevent ## type ## _ ## name (VALUE self)\
51
51
  static VALUE \
52
52
  gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
53
53
  {\
54
- get_gdkevent(self)->type.name = RVAL2CSTR(val);\
54
+ get_gdkevent(self)->type.name = (gchar *)RVAL2CSTR(val);\
55
55
  return self;\
56
56
  }
57
57
 
@@ -81,6 +81,19 @@ gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
81
81
  return self;\
82
82
  }
83
83
 
84
+ #define ATTR_GDKNATIVEWINDOW(type, name)\
85
+ static VALUE \
86
+ gdkevent ## type ## _ ## name (VALUE self)\
87
+ {\
88
+ return GDKNATIVEWINDOW2RVAL(get_gdkevent(self)->type.name);\
89
+ }\
90
+ static VALUE \
91
+ gdkevent ## type ## _set_ ## name (VALUE self, VALUE val)\
92
+ {\
93
+ get_gdkevent(self)->type.name = RVAL2GDKNATIVEWINDOW(val);\
94
+ return self;\
95
+ }
96
+
84
97
  #define ATTR_FLOAT(type, name)\
85
98
  static VALUE \
86
99
  gdkevent ## type ## _ ## name (VALUE self)\
@@ -502,7 +515,7 @@ GDKEVENT_INIT(property, GDK_PROPERTY_NOTIFY);
502
515
  ATTR_ATOM(selection, selection);
503
516
  ATTR_ATOM(selection, target);
504
517
  ATTR_ATOM(selection, property);
505
- ATTR_UINT(selection, requestor);
518
+ ATTR_GDKNATIVEWINDOW(selection, requestor);
506
519
  ATTR_INT(selection, time);
507
520
 
508
521
  /* GdkEventDND */
@@ -557,13 +570,13 @@ gdkeventclient_send_client_message(int argc, VALUE *argv, VALUE self)
557
570
  rb_scan_args(argc, argv, "11", &xid, &display);
558
571
  if (NIL_P(display)){
559
572
  return CBOOL2RVAL(gdk_event_send_client_message(
560
- get_gdkevent(self), NUM2INT(xid)));
573
+ get_gdkevent(self), RVAL2GDKNATIVEWINDOW(xid)));
561
574
  } else {
562
575
  #if GTK_CHECK_VERSION(2,2,0)
563
576
  return CBOOL2RVAL(gdk_event_send_client_message_for_display(
564
577
  GDK_DISPLAY_OBJECT(RVAL2GOBJ(display)),
565
578
  get_gdkevent(self),
566
- NUM2UINT(xid)));
579
+ RVAL2GDKNATIVEWINDOW(xid)));
567
580
  #else
568
581
  rb_warn("this arguments number has been supported since 2.2");
569
582
  return Qfalse;
@@ -610,7 +623,7 @@ GDKEVENT_INIT(setting, GDK_SETTING);
610
623
 
611
624
  /* GdkEventOwnerChange */
612
625
  #if GTK_CHECK_VERSION(2,6,0)
613
- ATTR_UINT(owner_change, owner);
626
+ ATTR_GDKNATIVEWINDOW(owner_change, owner);
614
627
  ATTR_ENUM(owner_change, reason, GDK_TYPE_OWNER_CHANGE);
615
628
  ATTR_ATOM(owner_change, selection);
616
629
  ATTR_UINT(owner_change, time);
@@ -50,72 +50,67 @@ gdkpmap_create_from_data(int argc, VALUE *argv, VALUE self)
50
50
  static VALUE
51
51
  gdkpmap_create_from_xpm(VALUE self, VALUE win, VALUE color, VALUE fname)
52
52
  {
53
- GdkPixmap *new;
53
+ GdkPixmap *result;
54
54
  GdkBitmap *mask;
55
55
 
56
- new = gdk_pixmap_create_from_xpm(GDK_WINDOW(RVAL2GOBJ(win)), &mask,
57
- RVAL2GDKCOLOR(color), RVAL2CSTR(fname));
58
- if (!new) {
59
- rb_raise(rb_eArgError, "Pixmap not created from %s", RVAL2CSTR(fname));
60
- }
61
- return rb_assoc_new(GOBJ2RVAL(new),GOBJ2RVAL(mask));
56
+ result = gdk_pixmap_create_from_xpm(GDK_WINDOW(RVAL2GOBJ(win)),
57
+ &mask,
58
+ RVAL2GDKCOLOR(color),
59
+ RVAL2CSTR(fname));
60
+ if (result == NULL)
61
+ rb_raise(rb_eArgError, "Pixmap not created from %s", RVAL2CSTR(fname));
62
+
63
+ return rb_assoc_new(GOBJ2RVAL(result), GOBJ2RVAL(mask));
62
64
  }
63
65
 
64
66
  static VALUE
65
67
  gdkpmap_create_from_xpm_d(VALUE self, VALUE win, VALUE tcolor, VALUE data)
66
68
  {
67
- GdkPixmap *new;
69
+ GdkPixmap *result;
68
70
  GdkBitmap *mask;
69
- int i;
70
- gchar **buf;
71
+ const gchar **buf = RVAL2STRV(data);
71
72
 
72
- Check_Type(data, T_ARRAY);
73
- buf = ALLOCA_N(char*, RARRAY_LEN(data));
74
- for (i=0; i < RARRAY_LEN(data); i++) {
75
- buf[i] = RVAL2CSTR(RARRAY_PTR(data)[i]);
76
- }
77
- new = gdk_pixmap_create_from_xpm_d(GDK_WINDOW(RVAL2GOBJ(win)),
78
- &mask, RVAL2GDKCOLOR(tcolor), buf);
73
+ result = gdk_pixmap_create_from_xpm_d(GDK_WINDOW(RVAL2GOBJ(win)),
74
+ &mask,
75
+ RVAL2GDKCOLOR(tcolor),
76
+ (gchar **)buf);
79
77
 
80
- return rb_assoc_new(GOBJ2RVAL(new),GOBJ2RVAL(mask));
78
+ g_free(buf);
79
+
80
+ return rb_assoc_new(GOBJ2RVAL(result), GOBJ2RVAL(mask));
81
81
  }
82
82
 
83
83
  static VALUE
84
84
  gdkpmap_colormap_create_from_xpm(VALUE self, VALUE win, VALUE colormap, VALUE tcolor, VALUE fname)
85
85
  {
86
- GdkPixmap *new;
86
+ GdkPixmap *result;
87
87
  GdkBitmap *mask;
88
88
 
89
- new = gdk_pixmap_colormap_create_from_xpm(NIL_P(win) ? NULL : GDK_WINDOW(RVAL2GOBJ(win)),
90
- GDK_COLORMAP(RVAL2GOBJ(colormap)),
91
- &mask, RVAL2GDKCOLOR(tcolor),
92
- RVAL2CSTR(fname));
93
- if (!new) {
94
- rb_raise(rb_eArgError, "Pixmap not created from %s", RVAL2CSTR(fname));
95
- }
96
- return rb_assoc_new(GOBJ2RVAL(new),GOBJ2RVAL(mask));
89
+ result = gdk_pixmap_colormap_create_from_xpm(NIL_P(win) ? NULL : GDK_WINDOW(RVAL2GOBJ(win)),
90
+ GDK_COLORMAP(RVAL2GOBJ(colormap)),
91
+ &mask,
92
+ RVAL2GDKCOLOR(tcolor),
93
+ RVAL2CSTR(fname));
94
+ if (result == NULL)
95
+ rb_raise(rb_eArgError, "Pixmap not created from %s", RVAL2CSTR(fname));
96
+
97
+ return rb_assoc_new(GOBJ2RVAL(result), GOBJ2RVAL(mask));
97
98
  }
98
99
 
99
100
  static VALUE
100
101
  gdkpmap_colormap_create_from_xpm_d(VALUE self, VALUE win, VALUE colormap, VALUE tcolor, VALUE data)
101
102
  {
102
- GdkPixmap *new;
103
+ GdkPixmap *result;
103
104
  GdkBitmap *mask;
104
- int i;
105
- gchar **buf;
106
-
107
- Check_Type(data, T_ARRAY);
108
- buf = ALLOCA_N(char*, RARRAY_LEN(data));
109
- for (i=0; i<RARRAY_LEN(data); i++) {
110
- buf[i] = RVAL2CSTR(RARRAY_PTR(data)[i]);
111
- }
105
+ const gchar **buf = RVAL2STRV(data);
112
106
 
113
- new = gdk_pixmap_colormap_create_from_xpm_d(NIL_P(win) ? NULL : GDK_WINDOW(RVAL2GOBJ(win)),
114
- GDK_COLORMAP(RVAL2GOBJ(colormap)),
115
- &mask, RVAL2GDKCOLOR(tcolor),
116
- buf);
107
+ result = gdk_pixmap_colormap_create_from_xpm_d(NIL_P(win) ? NULL : GDK_WINDOW(RVAL2GOBJ(win)),
108
+ GDK_COLORMAP(RVAL2GOBJ(colormap)),
109
+ &mask,
110
+ RVAL2GDKCOLOR(tcolor),
111
+ (gchar **)buf);
117
112
 
118
- return rb_assoc_new(GOBJ2RVAL(new),GOBJ2RVAL(mask));
113
+ return rb_assoc_new(GOBJ2RVAL(result), GOBJ2RVAL(mask));
119
114
  }
120
115
 
121
116
  #ifdef HAVE_XREADBITMAPFILEDATA
@@ -156,21 +151,21 @@ gdkpmap_foreign_new(int argc, VALUE *argv, VALUE self)
156
151
  switch(argc)
157
152
  {
158
153
  case 1:
159
- win = gdk_pixmap_foreign_new(NUM2UINT(arg[0]));
154
+ win = gdk_pixmap_foreign_new(RVAL2GDKNATIVEWINDOW(arg[0]));
160
155
  break;
161
156
  case 2:
162
157
  #if GTK_CHECK_VERSION(2,2,0)
163
158
  win = gdk_pixmap_foreign_new_for_display(GDK_DISPLAY_OBJECT(RVAL2GOBJ(arg[0])),
164
- NUM2UINT(arg[1]));
159
+ RVAL2GDKNATIVEWINDOW(arg[1]));
165
160
  #else
166
- win = gdk_pixmap_foreign_new(NUM2UINT(arg[1]));
161
+ win = gdk_pixmap_foreign_new(RVAL2GDKNATIVEWINDOW(arg[1]));
167
162
  rb_warn("Not supported. Use GTK+-2.2.0 or later.");
168
163
  #endif
169
164
  break;
170
165
  case 5:
171
166
  #if GTK_CHECK_VERSION(2,10,0)
172
167
  win = gdk_pixmap_foreign_new_for_screen(GDK_SCREEN(RVAL2GOBJ(arg[0])),
173
- NUM2UINT(arg[1]), /* anid */
168
+ RVAL2GDKNATIVEWINDOW(arg[1]), /* anid */
174
169
  NUM2INT(arg[2]), /* width */
175
170
  NUM2INT(arg[3]), /* height */
176
171
  NUM2INT(arg[4])); /* depth */
@@ -194,13 +189,13 @@ gdkpmap_lookup(int argc, VALUE *argv, VALUE self)
194
189
  switch(argc)
195
190
  {
196
191
  case 1:
197
- win = gdk_pixmap_lookup(NUM2UINT(arg[0]));
192
+ win = gdk_pixmap_lookup(RVAL2GDKNATIVEWINDOW(arg[0]));
198
193
  break;
199
194
  case 2:
200
195
  #if GTK_CHECK_VERSION(2,2,0)
201
- win = gdk_pixmap_lookup_for_display(RVAL2GOBJ(arg[0]), NUM2UINT(arg[1]));
196
+ win = gdk_pixmap_lookup_for_display(RVAL2GOBJ(arg[0]), RVAL2GDKNATIVEWINDOW(arg[1]));
202
197
  #else
203
- win = gdk_pixmap_lookup(NUM2UINT(arg[1]));
198
+ win = gdk_pixmap_lookup(RVAL2GDKNATIVEWINDOW(arg[1]));
204
199
  rb_warn("Not supported in GTK+-2.0.x.");
205
200
  #endif
206
201
  break;
@@ -246,7 +246,8 @@ gdkprop_get(int argc, VALUE *argv, VALUE self)
246
246
  VALUE win, property, type, offset=INT2FIX(0), length=INT2FIX(9999), delete;
247
247
 
248
248
  /* for inner processing */
249
- int i;
249
+ gint i;
250
+ size_t j;
250
251
  VALUE ret = 0;
251
252
 
252
253
  if(6 == argc)
@@ -279,12 +280,12 @@ gdkprop_get(int argc, VALUE *argv, VALUE self)
279
280
  ret = rb_ary_new();
280
281
 
281
282
  if(rtype != GDK_SELECTION_TYPE_ATOM){
282
- for(i = 0; i < (rlen/sizeof(unsigned long)); i++){
283
- rb_ary_push(ret, INT2FIX(((unsigned long*)rdat)[i]));
283
+ for(j = 0; j < (rlen/sizeof(unsigned long)); j++){
284
+ rb_ary_push(ret, INT2FIX(((unsigned long*)rdat)[j]));
284
285
  }
285
286
  } else {
286
- for(i = 0; i < (rlen/sizeof(unsigned long)); i++){
287
- rb_ary_push(ret, BOXED2RVAL((GdkAtom)((unsigned long*)rdat)[i], GDK_TYPE_ATOM));
287
+ for(j = 0; j < (rlen/sizeof(unsigned long)); j++){
288
+ rb_ary_push(ret, BOXED2RVAL((GdkAtom)((unsigned long*)rdat)[j], GDK_TYPE_ATOM));
288
289
  }
289
290
  }
290
291
  break;
@@ -270,54 +270,25 @@ gdkscreen_spawn_on_screen(VALUE self, VALUE working_directory, VALUE argv, VALUE
270
270
  gboolean ret;
271
271
  gint child_pid;
272
272
  VALUE func = Qnil;
273
- gint gargc, genc, i;
274
- gchar** gargv = (gchar**)NULL;
275
- gchar** genvp = (gchar**)NULL;
273
+ gchar **gargv;
274
+ gchar **genvp;
276
275
 
277
276
  if (rb_block_given_p()) {
278
277
  func = rb_block_proc();
279
278
  G_RELATIVE(self, func);
280
279
  }
281
280
 
282
- if (! NIL_P(argv)){
283
- Check_Type(argv, T_ARRAY);
284
- gargc = RARRAY_LEN(argv);
285
- gargv = ALLOCA_N(gchar*, gargc + 1);
286
- for (i = 0; i < gargc; i++) {
287
- if (TYPE(RARRAY_PTR(argv)[i]) == T_STRING) {
288
- gargv[i] = RVAL2CSTR(RARRAY_PTR(argv)[i]);
289
- }
290
- else {
291
- gargv[i] = "";
292
- }
293
- }
294
- gargv[gargc] = (gchar*)NULL;
295
- }
296
-
297
- if (! NIL_P(envp)){
298
- Check_Type(envp, T_ARRAY);
299
- genc = RARRAY_LEN(envp);
300
- genvp = ALLOCA_N(gchar*, genc + 1);
301
- for (i = 0; i < genc; i++) {
302
- if (TYPE(RARRAY_PTR(envp)[i]) == T_STRING) {
303
- genvp[i] = RVAL2CSTR(RARRAY_PTR(envp)[i]);
304
- }
305
- else {
306
- genvp[i] = "";
307
- }
308
- }
309
- genvp[genc] = (gchar*)NULL;
310
- }
311
-
281
+ gargv = (gchar **)RVAL2STRV(argv);
282
+ genvp = (gchar **)RVAL2STRV(envp);
312
283
  ret = gdk_spawn_on_screen(_SELF(self),
313
284
  NIL_P(working_directory) ? NULL : RVAL2CSTR(working_directory),
314
285
  gargv, genvp, NUM2INT(flags),
315
286
  (GSpawnChildSetupFunc)child_setup, (gpointer)func,
316
287
  &child_pid, &err);
317
-
318
- if (! ret){
288
+ g_free(gargv);
289
+ g_free(genvp);
290
+ if (!ret)
319
291
  RAISE_GERROR(err);
320
- }
321
292
 
322
293
  return INT2NUM(child_pid);
323
294
  }
@@ -329,9 +300,8 @@ gdkscreen_spawn_on_screen_with_pipes(VALUE self, VALUE working_directory, VALUE
329
300
  gboolean ret;
330
301
  gint child_pid;
331
302
  VALUE func = Qnil;
332
- gint gargc, genc, i;
333
- gchar** gargv = (gchar**)NULL;
334
- gchar** genvp = (gchar**)NULL;
303
+ gchar **gargv;
304
+ gchar **genvp;
335
305
  gint standard_input, standard_output, standard_error;
336
306
 
337
307
  if (rb_block_given_p()) {
@@ -339,36 +309,8 @@ gdkscreen_spawn_on_screen_with_pipes(VALUE self, VALUE working_directory, VALUE
339
309
  G_RELATIVE(self, func);
340
310
  }
341
311
 
342
- if (! NIL_P(argv)){
343
- Check_Type(argv, T_ARRAY);
344
- gargc = RARRAY_LEN(argv);
345
- gargv = ALLOCA_N(gchar*, gargc + 1);
346
- for (i = 0; i < gargc; i++) {
347
- if (TYPE(RARRAY_PTR(argv)[i]) == T_STRING) {
348
- gargv[i] = RVAL2CSTR(RARRAY_PTR(argv)[i]);
349
- }
350
- else {
351
- gargv[i] = "";
352
- }
353
- }
354
- gargv[gargc] = (gchar*)NULL;
355
- }
356
-
357
- if (! NIL_P(envp)){
358
- Check_Type(envp, T_ARRAY);
359
- genc = RARRAY_LEN(envp);
360
- genvp = ALLOCA_N(gchar*, genc + 1);
361
- for (i = 0; i < genc; i++) {
362
- if (TYPE(RARRAY_PTR(envp)[i]) == T_STRING) {
363
- genvp[i] = RVAL2CSTR(RARRAY_PTR(envp)[i]);
364
- }
365
- else {
366
- genvp[i] = "";
367
- }
368
- }
369
- genvp[genc] = (gchar*)NULL;
370
- }
371
-
312
+ gargv = (gchar **)RVAL2STRV(argv);
313
+ genvp = (gchar **)RVAL2STRV(envp);
372
314
  ret = gdk_spawn_on_screen_with_pipes(_SELF(self),
373
315
  NIL_P(working_directory) ? NULL : RVAL2CSTR(working_directory),
374
316
  gargv, genvp, NUM2INT(flags),
@@ -376,8 +318,10 @@ gdkscreen_spawn_on_screen_with_pipes(VALUE self, VALUE working_directory, VALUE
376
318
  &child_pid,
377
319
  &standard_input, &standard_output,
378
320
  &standard_error, &err);
379
-
380
- if (! ret) RAISE_GERROR(err);
321
+ g_free(gargv);
322
+ g_free(genvp);
323
+ if (!ret)
324
+ RAISE_GERROR(err);
381
325
 
382
326
  return rb_ary_new3(4, INT2NUM(child_pid),
383
327
  rb_funcall(rb_cIO, id_new, 1, INT2NUM(standard_input)),
@@ -438,6 +382,7 @@ Init_gtk_gdk_screen()
438
382
  rb_define_singleton_method(gdkScreen, "default", gdkscreen_default, 0);
439
383
  rb_define_method(gdkScreen, "default_colormap", gdkscreen_get_default_colormap, 0);
440
384
  rb_define_method(gdkScreen, "set_default_colormap", gdkscreen_set_default_colormap, 1);
385
+ G_DEF_SETTER(gdkScreen, "default_colormap");
441
386
  rb_define_method(gdkScreen, "system_colormap", gdkscreen_get_system_colormap, 0);
442
387
  rb_define_method(gdkScreen, "system_visual", gdkscreen_get_system_visual, 0);
443
388
  rb_define_method(gdkScreen, "rgb_colormap", gdkscreen_get_rgb_colormap, 0);
@@ -466,8 +411,8 @@ Init_gtk_gdk_screen()
466
411
  rb_define_method(gdkScreen, "get_setting", gdkscreen_get_setting, -1);
467
412
  #if GTK_CHECK_VERSION(2,10,0)
468
413
  #ifdef HAVE_RB_CAIRO_H
469
- rb_define_method(gdkScreen, "font_options", gdkscreen_get_font_options, 0);
470
- rb_define_method(gdkScreen, "set_font_options", gdkscreen_set_font_options, 1);
414
+ G_REPLACE_GET_PROPERTY(gdkScreen, "font_options", gdkscreen_get_font_options, 0);
415
+ G_REPLACE_SET_PROPERTY(gdkScreen, "font_options", gdkscreen_set_font_options, 1);
471
416
  #endif
472
417
  rb_define_method(gdkScreen, "active_window", gdkscreen_get_active_window, 0);
473
418
  rb_define_method(gdkScreen, "window_stack", gdkscreen_get_window_stack, 0);
@@ -485,7 +430,6 @@ Init_gtk_gdk_screen()
485
430
  rb_define_method(gdkScreen, "window_manager_name", gdkscreen_get_window_manager_name, 0);
486
431
  rb_define_method(gdkScreen, "screen_number", gdkscreen_get_screen_number, 0);
487
432
  #endif
488
- G_DEF_SETTERS(gdkScreen);
489
433
 
490
434
  #ifdef GDK_WINDOWING_X11
491
435
  G_DEF_CLASS3("GdkScreenX11", "ScreenX11", mGdk);