vte 0.90.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,75 @@
1
+ 2011-01-22 Masaaki Aoyagi
2
+
3
+ * src/lib/: -> lib/.
4
+
5
+ * src/: -> ext/vte/.
6
+
7
+ * extconf.rb: -> ext/vte/extconf.rb
8
+
9
+ * ext/vte/extconf.rb: support directory structure change.
10
+
11
+ * extconf.rb: add.
12
+
13
+ * Rakefile: add.
14
+
15
+ 2010-09-23 Kouhei Sutou <kou@cozmixng.org>
16
+
17
+ * extconf.rb: support Ruby/GLib2 directory structure change.
18
+
19
+ 2009-06-28 Kouhei Sutou <kou@cozmixng.org>
20
+
21
+ * src/rbvte-terminal.c:
22
+ - support vte_terminal_{set,get}_cursor_blink_mode().
23
+ - support vte_terminal_{set,get}_cursor_shape().
24
+ - support vte_terminal_get_pty().
25
+ - support vte_terminal_get_child_exit_status().
26
+
27
+ * extconf.rb, src/rbvte.h: use VTE_CHECK_VERSION provided by VTE itself.
28
+
29
+ 2008-11-01 Kouhei Sutou <kou@cozmixng.org>
30
+
31
+ * src/: use RARRAY_PTR() and RARRAY_LEN().
32
+
33
+ 2008-09-13 Kouhei Sutou <kou@cozmixng.org>
34
+
35
+ * extconf.rb: use check_cairo.
36
+
37
+ 2008-04-13 Kouhei Sutou <kou@cozmixng.org>
38
+
39
+ * extconf.rb: fix rcairo's source path.
40
+
41
+ 2007-07-13 Guillaume Cottenceau
42
+
43
+ * src/rbvte-terminal.c: replace RTEST uses by RVAL2CBOOL
44
+
45
+ 2007-06-16 Kouhei Sutou <kou@cozmixng.org>
46
+
47
+ * src/rbvte-terminal.c: used RSTRING_LEN/RSTRING_PTR instead of
48
+ RSTRING()->len/ptr to support ruby 1.9.
49
+
50
+ 2006-06-17 Masao Mutoh <mutoh@highway.ne.jp>
51
+
52
+ * sample/*.rb: code cleanup.
53
+
54
+ 2006-05-26 Kouhei Sutou <kou@cozmixng.org>
55
+
56
+ * src/rbvte.h: added extern modifier.
57
+
58
+ 2006-05-19 Kouhei Sutou <kou@cozmixng.org>
59
+
60
+ * src/rbvte-terminal.c (term_set_color_highlight,
61
+ term_set_word_chars): accepted nil.
62
+ (term_get_text, term_get_text_range, term_match_check): fixed
63
+ memory leak.
64
+ (word_char?): fixed typo.
65
+
66
+ 2006-05-18 Kouhei Sutou <kou@cozmixng.org>
67
+
68
+ * src/rbvte-terminal.c (term_set_color_cursor): accepted nil.
69
+
70
+ * README: required 0.12.1 or later.
71
+ * extconf.rb: ditto.
72
+
73
+ 2006-05-17 Kouhei Sutou <kou@cozmixng.org>
74
+
75
+ * .: imported.
data/README ADDED
@@ -0,0 +1,34 @@
1
+ Ruby/VTE
2
+ ========
3
+
4
+ Ruby/VTE is a Ruby binding of VTE.
5
+
6
+ Requirements
7
+ ------------
8
+
9
+ Ruby: http://www.ruby-lang.org/
10
+ VTE [*]: http://www.gnome.org/
11
+ Ruby/GTK2: http://ruby-gnome2.sourceforge.net/
12
+
13
+ [*]: 0.12.1 or later is required.
14
+
15
+ Install
16
+ -------
17
+
18
+ 0. install ruby and VTE.
19
+ 1. ruby extconf.rb
20
+ 2. make
21
+ 3. su
22
+ 4. make install
23
+
24
+ Copying
25
+ -------
26
+ Copyright (c) 2002-2006 Ruby-GNOME2 Project Team
27
+
28
+ This program is free software.
29
+ You can distribute/modify this program under the terms of
30
+ the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
31
+
32
+ Project Website
33
+ ---------------
34
+ http://ruby-gnome2.sourceforge.jp/
@@ -0,0 +1,13 @@
1
+ # -*- ruby -*-
2
+
3
+ require './../glib2/lib/gnome2-raketask'
4
+
5
+ package = GNOME2Package.new do |_package|
6
+ _package.summary = "Ruby/VTE is a Ruby binding of VTE."
7
+ _package.description = "Ruby/VTE is a Ruby binding of VTE."
8
+ _package.dependency.gem.runtime = ["gtk2"]
9
+ _package.win32.packages = []
10
+ _package.win32.dependencies = []
11
+ end
12
+ package.define_tasks
13
+
@@ -0,0 +1,162 @@
1
+
2
+ SHELL = /bin/sh
3
+
4
+ #### Start of system configuration section. ####
5
+
6
+ srcdir = /home/kou/work/ruby/ruby-gnome2/vte/ext/vte
7
+ topdir = /usr/lib/ruby/1.8/x86_64-linux
8
+ hdrdir = $(topdir)
9
+ VPATH = $(srcdir):$(topdir):$(hdrdir)
10
+ exec_prefix = $(prefix)
11
+ prefix = $(DESTDIR)/usr
12
+ sharedstatedir = $(prefix)/com
13
+ mandir = $(prefix)/share/man
14
+ psdir = $(docdir)
15
+ oldincludedir = $(DESTDIR)/usr/include
16
+ localedir = $(datarootdir)/locale
17
+ bindir = $(exec_prefix)/bin
18
+ libexecdir = $(prefix)/lib/ruby1.8
19
+ sitedir = $(DESTDIR)/usr/local/lib/site_ruby
20
+ htmldir = $(docdir)
21
+ vendorarchdir = $(vendorlibdir)/$(sitearch)
22
+ includedir = $(prefix)/include
23
+ infodir = $(prefix)/share/info
24
+ vendorlibdir = $(vendordir)/$(ruby_version)
25
+ sysconfdir = $(DESTDIR)/etc
26
+ libdir = $(exec_prefix)/lib
27
+ sbindir = $(exec_prefix)/sbin
28
+ rubylibdir = $(libdir)/ruby/$(ruby_version)
29
+ docdir = $(datarootdir)/doc/$(PACKAGE)
30
+ dvidir = $(docdir)
31
+ vendordir = $(libdir)/ruby/vendor_ruby
32
+ datarootdir = $(prefix)/share
33
+ pdfdir = $(docdir)
34
+ archdir = $(rubylibdir)/$(arch)
35
+ sitearchdir = $(sitelibdir)/$(sitearch)
36
+ datadir = $(datarootdir)
37
+ localstatedir = $(DESTDIR)/var
38
+ sitelibdir = $(sitedir)/$(ruby_version)
39
+
40
+ CC = gcc
41
+ LIBRUBY = $(LIBRUBY_SO)
42
+ LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
43
+ LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
44
+ LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
45
+
46
+ RUBY_EXTCONF_H =
47
+ CFLAGS = -fPIC -fno-strict-aliasing -g -g -O2 -fPIC $(cflags) -Wall -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0 -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/lib/gtk-2.0/include -pthread
48
+ INCFLAGS = -I. -I/home/kou/work/ruby/ruby-gnome2/gtk2/ext/gtk2 -I/home/kou/work/ruby/ruby-gnome2/gtk2/ext/gtk2 -I/home/kou/work/ruby/ruby-gnome2/gtk2/ext/gtk2 -I/home/kou/work/ruby/ruby-gnome2/atk/ext/atk -I/home/kou/work/ruby/ruby-gnome2/atk/ext/atk -I/home/kou/work/ruby/ruby-gnome2/atk/ext/atk -I/home/kou/work/ruby/ruby-gnome2/glib2/ext/glib2 -I/home/kou/work/ruby/ruby-gnome2/glib2/ext/glib2 -I/home/kou/work/ruby/ruby-gnome2/glib2/ext/glib2 -I. -I/usr/lib/ruby/1.8/x86_64-linux -I/home/kou/work/ruby/ruby-gnome2/vte/ext/vte
49
+ DEFS =
50
+ CPPFLAGS = -DHAVE_RB_DEFINE_ALLOC_FUNC -DHAVE_RB_BLOCK_PROC -DHAVE_OBJECT_ALLOCATE -DHAVE_NODE_ATTRASGN -DHAVE_TYPE_VTETERMINALCURSORBLINKMODE -DRUBY_VTE_COMPILATION
51
+ CXXFLAGS = $(CFLAGS)
52
+ ldflags = -L. -rdynamic -Wl,-export-dynamic -pthread
53
+ dldflags =
54
+ archflag =
55
+ DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
56
+ LDSHARED = $(CC) -shared
57
+ AR = ar
58
+ EXEEXT =
59
+
60
+ RUBY_INSTALL_NAME = ruby1.8
61
+ RUBY_SO_NAME = ruby1.8
62
+ arch = x86_64-linux
63
+ sitearch = x86_64-linux
64
+ ruby_version = 1.8
65
+ ruby = /usr/bin/ruby1.8
66
+ RUBY = $(ruby)
67
+ RM = rm -f
68
+ MAKEDIRS = mkdir -p
69
+ INSTALL = /usr/bin/install -c
70
+ INSTALL_PROG = $(INSTALL) -m 0755
71
+ INSTALL_DATA = $(INSTALL) -m 644
72
+ COPY = cp
73
+
74
+ #### End of system configuration section. ####
75
+
76
+ preload =
77
+
78
+ libpath = . $(libdir)
79
+ LIBPATH = -L. -L$(libdir)
80
+ DEFFILE =
81
+
82
+ CLEANFILES = mkmf.log
83
+ DISTCLEANFILES =
84
+
85
+ extout =
86
+ extout_prefix =
87
+ target_prefix =
88
+ LOCAL_LIBS =
89
+ LIBS = $(LIBRUBYARG_SHARED) -lvte -lglib-2.0 -lgobject-2.0 -lgthread-2.0 -lrt -lpango-1.0 -lgmodule-2.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lcairo -lgio-2.0 -latk-1.0 -lpangoft2-1.0 -lfreetype -lfontconfig -lX11 -lpthread -lrt -ldl -lcrypt -lm -lc
90
+ SRCS = rbvte-terminal.c rbvte-reaper.c rbvte-access.c rbvte.c
91
+ OBJS = rbvte-terminal.o rbvte-reaper.o rbvte-access.o rbvte.o
92
+ TARGET = vte
93
+ DLLIB = $(TARGET).so
94
+ EXTSTATIC =
95
+ STATIC_LIB =
96
+
97
+ BINDIR = $(bindir)
98
+ RUBYCOMMONDIR = $(sitedir)$(target_prefix)
99
+ RUBYLIBDIR = $(sitelibdir)$(target_prefix)
100
+ RUBYARCHDIR = $(sitearchdir)$(target_prefix)
101
+
102
+ TARGET_SO = $(DLLIB)
103
+ CLEANLIBS = $(TARGET).so $(TARGET).il? $(TARGET).tds $(TARGET).map
104
+ CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
105
+
106
+ all: $(DLLIB)
107
+ static: $(STATIC_LIB)
108
+
109
+ clean:
110
+ @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
111
+
112
+ distclean: clean
113
+ @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
114
+ @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
115
+
116
+ realclean: distclean
117
+ install: install-so install-rb
118
+
119
+ install-so: $(RUBYARCHDIR)
120
+ install-so: $(RUBYARCHDIR)/$(DLLIB)
121
+ $(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
122
+ $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
123
+ install-rb: pre-install-rb install-rb-default
124
+ install-rb-default: pre-install-rb-default
125
+ pre-install-rb: Makefile
126
+ pre-install-rb-default: Makefile
127
+ $(RUBYARCHDIR):
128
+ $(MAKEDIRS) $@
129
+
130
+ site-install: site-install-so site-install-rb
131
+ site-install-so: install-so
132
+ site-install-rb: install-rb
133
+
134
+ .SUFFIXES: .c .m .cc .cxx .cpp .C .o
135
+
136
+ .cc.o:
137
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
138
+
139
+ .cxx.o:
140
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
141
+
142
+ .cpp.o:
143
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
144
+
145
+ .C.o:
146
+ $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
147
+
148
+ .c.o:
149
+ $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
150
+
151
+ $(DLLIB): $(OBJS) Makefile
152
+ @-$(RM) $@
153
+ $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
154
+
155
+
156
+
157
+ ###
158
+ install:
159
+ if test -n "$(pkgconfigdir)"; then \
160
+ $(MAKEDIRS) $(pkgconfigdir); \
161
+ $(INSTALL_DATA) ../ruby-vte.pc $(pkgconfigdir); \
162
+ fi
@@ -0,0 +1,5 @@
1
+ install:
2
+ if test -n "$(pkgconfigdir)"; then \
3
+ $(MAKEDIRS) $(pkgconfigdir); \
4
+ $(INSTALL_DATA) ../ruby-vte.pc $(pkgconfigdir); \
5
+ fi
@@ -0,0 +1,57 @@
1
+ =begin
2
+ extconf.rb for Ruby/VTE extention library
3
+ =end
4
+
5
+ require 'pathname'
6
+
7
+ base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path
8
+ top_dir = base_dir.parent
9
+ top_build_dir = Pathname(".").parent.parent.parent.expand_path
10
+
11
+ mkmf_gnome2_dir = top_dir + "glib2" + 'lib'
12
+ version_suffix = ""
13
+ unless mkmf_gnome2_dir.exist?
14
+ if /(-\d+\.\d+\.\d+)(?:\.\d+)?\z/ =~ base_dir.basename.to_s
15
+ version_suffix = $1
16
+ mkmf_gnome2_dir = top_dir + "glib2#{version_suffix}" + 'lib'
17
+ end
18
+ end
19
+
20
+ $LOAD_PATH.unshift(mkmf_gnome2_dir.to_s)
21
+
22
+ module_name = "vte"
23
+ package_id = "vte"
24
+
25
+ require 'mkmf-gnome2'
26
+
27
+ setup_win32(module_name, base_dir)
28
+
29
+ PKGConfig.have_package(package_id, 0, 12, 1) or exit(false)
30
+
31
+ ["glib2", "atk", "gtk2"].each do |package|
32
+ directory = "#{package}#{version_suffix}"
33
+ build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
34
+ add_depend_package(package, "#{directory}/ext/#{package}",
35
+ top_dir.to_s,
36
+ :top_build_dir => top_build_dir.to_s,
37
+ :target_build_dir => build_dir)
38
+ end
39
+
40
+ vte_headers = ["vte/vte.h"]
41
+ have_type("VteTerminalCursorBlinkMode", vte_headers)
42
+
43
+ unless have_macro("VTE_CHECK_VERSION", vte_headers)
44
+ make_version_header("VTE", package_id, ".")
45
+ end
46
+
47
+ create_pkg_config_file("Ruby/VTE", package_id)
48
+ $defs << "-DRUBY_VTE_COMPILATION"
49
+ create_makefile(module_name)
50
+ pkg_config_dir = with_config("pkg-config-dir")
51
+ if pkg_config_dir.is_a?(String)
52
+ File.open("Makefile", "ab") do |makefile|
53
+ makefile.puts
54
+ makefile.puts("pkgconfigdir=#{pkg_config_dir}")
55
+ end
56
+ end
57
+
@@ -0,0 +1,33 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /**********************************************************************
3
+
4
+ rbvte-access.c -
5
+
6
+ $Author: ktou $
7
+ $Date: 2006/05/17 12:40:47 $
8
+
9
+ Copyright (C) 2006 Ruby-GNOME2 Project Team
10
+
11
+ **********************************************************************/
12
+
13
+ #include "rbvte.h"
14
+
15
+ static VALUE
16
+ ta_initialize(VALUE self, VALUE terminal)
17
+ {
18
+ G_INITIALIZE(self, vte_terminal_accessible_new(RVAL2TERM(terminal)));
19
+ return Qnil;
20
+ }
21
+
22
+ void
23
+ Init_vte_access(VALUE mVte)
24
+ {
25
+ VALUE cTerminalAccessible;
26
+
27
+ cTerminalAccessible = G_DEF_CLASS(VTE_TYPE_TERMINAL_ACCESSIBLE,
28
+ "TerminalAccessible", mVte);
29
+
30
+ rb_define_method(cTerminalAccessible, "initialize", ta_initialize, 1);
31
+
32
+ G_DEF_SETTERS(cTerminalAccessible);
33
+ }
Binary file
@@ -0,0 +1,31 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /**********************************************************************
3
+
4
+ rbvte-reaper.c -
5
+
6
+ $Author: ktou $
7
+ $Date: 2006/05/17 12:40:47 $
8
+
9
+ Copyright (C) 2006 Ruby-GNOME2 Project Team
10
+
11
+ **********************************************************************/
12
+
13
+ #include "rbvte.h"
14
+
15
+ static VALUE
16
+ reaper_get(VALUE self)
17
+ {
18
+ return GOBJ2RVAL(vte_reaper_get());
19
+ }
20
+
21
+ void
22
+ Init_vte_reaper(VALUE mVte)
23
+ {
24
+ VALUE cReaper;
25
+
26
+ cReaper = G_DEF_CLASS(VTE_TYPE_REAPER, "Reaper", mVte);
27
+
28
+ rb_define_module_function(cReaper, "get", reaper_get, 0);
29
+
30
+ G_DEF_SETTERS(cReaper);
31
+ }
Binary file
@@ -0,0 +1,1030 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /**********************************************************************
3
+
4
+ rbvte-terminal.c -
5
+
6
+ $Author: ggc $
7
+ $Date: 2007/07/13 16:07:34 $
8
+
9
+ Copyright (C) 2006 Ruby-GNOME2 Project Team
10
+
11
+ **********************************************************************/
12
+
13
+ #include "rbvte.h"
14
+
15
+ static VALUE cCharAttributes;
16
+ static ID id_new, id_call;
17
+ static ID id_row, id_column, id_fore, id_back, id_underline, id_strikethrough;
18
+
19
+
20
+ static char **
21
+ rval2cstrary(VALUE ary)
22
+ {
23
+ long i, len;
24
+ char **result;
25
+
26
+ if (NIL_P(ary))
27
+ return NULL;
28
+
29
+ len = RARRAY_LEN(ary);
30
+ result = ALLOC_N(char *, len + 1);
31
+ for (i = 0; i < len; i++) {
32
+ result[i] = g_strdup(RVAL2CSTR(RARRAY_PTR(ary)[i]));
33
+ }
34
+ result[i] = NULL;
35
+
36
+ return result;
37
+ }
38
+
39
+ static void
40
+ free_cstrary(char **ary)
41
+ {
42
+ long i;
43
+
44
+ if (!ary) return;
45
+
46
+ for (i = 0; ary[i] != NULL; i++) {
47
+ g_free(ary[i]);
48
+ }
49
+ g_free(ary);
50
+ }
51
+
52
+ static VALUE
53
+ attrary2rval(GArray *attrs)
54
+ {
55
+ long i, len;
56
+ VALUE rb_attrs;
57
+
58
+ len = attrs->len;
59
+ rb_attrs = rb_ary_new2(len);
60
+
61
+ for (i = 0; i < len; i++) {
62
+ VteCharAttributes *attr;
63
+ attr = &g_array_index(attrs, VteCharAttributes, i);
64
+ rb_ary_push(rb_attrs, rb_funcall(cCharAttributes, id_new, 6,
65
+ LONG2NUM(attr->row),
66
+ LONG2NUM(attr->column),
67
+ COLOR2RVAL(&(attr->fore)),
68
+ COLOR2RVAL(&(attr->back)),
69
+ CBOOL2RVAL(attr->underline),
70
+ CBOOL2RVAL(attr->strikethrough)));
71
+ }
72
+
73
+ return rb_attrs;
74
+ }
75
+
76
+
77
+
78
+ static VALUE
79
+ ca_initialize(VALUE self, VALUE row, VALUE column, VALUE fore, VALUE back,
80
+ VALUE underline, VALUE strikethrough)
81
+ {
82
+ rb_ivar_set(self, id_row, row);
83
+ rb_ivar_set(self, id_column, column);
84
+ rb_ivar_set(self, id_fore, fore);
85
+ rb_ivar_set(self, id_back, back);
86
+ rb_ivar_set(self, id_underline, underline);
87
+ rb_ivar_set(self, id_strikethrough, strikethrough);
88
+ return Qnil;
89
+ }
90
+
91
+ static VALUE
92
+ ca_get_underline(VALUE self)
93
+ {
94
+ return rb_ivar_get(self, id_underline);
95
+ }
96
+
97
+ static VALUE
98
+ ca_get_strikethrough(VALUE self)
99
+ {
100
+ return rb_ivar_get(self, id_strikethrough);
101
+ }
102
+
103
+
104
+
105
+ static VALUE
106
+ term_initialize(VALUE self)
107
+ {
108
+ RBGTK_INITIALIZE(self, vte_terminal_new());
109
+ return Qnil;
110
+ }
111
+
112
+ static VALUE
113
+ term_fork_command(int argc, VALUE *argv, VALUE self)
114
+ {
115
+ VALUE rb_command, rb_command_argv, rb_envv, rb_directory;
116
+ VALUE lastlog, utmp, wtmp;
117
+ char *command;
118
+ char **command_argv;
119
+ char **envv;
120
+ char *directory;
121
+ pid_t pid;
122
+
123
+ rb_scan_args(argc, argv, "07", &rb_command, &rb_command_argv,
124
+ &rb_envv, &rb_directory, &lastlog, &utmp, &wtmp);
125
+
126
+ command = NIL_P(rb_command) ? NULL : RVAL2CSTR(rb_command);
127
+ command_argv = rval2cstrary(rb_command_argv);
128
+ envv = rval2cstrary(rb_envv);
129
+ directory = NIL_P(rb_directory) ? NULL : RVAL2CSTR(rb_directory);
130
+ pid = vte_terminal_fork_command(RVAL2TERM(self), command,
131
+ command_argv, envv, directory,
132
+ NIL_P(lastlog) ? TRUE : RVAL2CBOOL(lastlog),
133
+ NIL_P(utmp) ? TRUE : RVAL2CBOOL(utmp),
134
+ NIL_P(wtmp) ? TRUE : RVAL2CBOOL(wtmp));
135
+ free_cstrary(command_argv);
136
+ free_cstrary(envv);
137
+
138
+ return INT2NUM(pid);
139
+ }
140
+
141
+ static VALUE
142
+ term_fork_pty(int argc, VALUE *argv, VALUE self)
143
+ {
144
+ VALUE rb_envv, rb_directory, lastlog, utmp, wtmp;
145
+ char **envv;
146
+ char *directory;
147
+ pid_t pid;
148
+
149
+ rb_scan_args(argc, argv, "05", &rb_envv, &rb_directory,
150
+ &lastlog, &utmp, &wtmp);
151
+
152
+ envv = rval2cstrary(rb_envv);
153
+ directory = NIL_P(rb_directory) ? NULL : RVAL2CSTR(rb_directory);
154
+ pid = vte_terminal_forkpty(RVAL2TERM(self), envv, directory,
155
+ NIL_P(lastlog) ? TRUE : RVAL2CBOOL(lastlog),
156
+ NIL_P(utmp) ? TRUE : RVAL2CBOOL(utmp),
157
+ NIL_P(wtmp) ? TRUE : RVAL2CBOOL(wtmp));
158
+ free_cstrary(envv);
159
+
160
+ return INT2NUM(pid);
161
+ }
162
+
163
+ static VALUE
164
+ term_feed(VALUE self, VALUE data)
165
+ {
166
+ glong length;
167
+
168
+ length = RSTRING_LEN(data);
169
+
170
+ if (length > 0) {
171
+ vte_terminal_feed(RVAL2TERM(self), RSTRING_PTR(data), length);
172
+ }
173
+
174
+ return Qnil;
175
+ }
176
+
177
+ static VALUE
178
+ term_feed_child(VALUE self, VALUE data)
179
+ {
180
+ glong length;
181
+
182
+ length = RSTRING_LEN(data);
183
+
184
+ if (length > 0) {
185
+ vte_terminal_feed_child(RVAL2TERM(self), RSTRING_PTR(data), length);
186
+ }
187
+
188
+ return Qnil;
189
+ }
190
+
191
+ static VALUE
192
+ term_feed_child_binary(VALUE self, VALUE data)
193
+ {
194
+ glong length;
195
+
196
+ length = RSTRING_LEN(data);
197
+
198
+ if (length > 0) {
199
+ vte_terminal_feed_child_binary(RVAL2TERM(self),
200
+ RSTRING_PTR(data), length);
201
+ }
202
+
203
+ return Qnil;
204
+ }
205
+
206
+ static VALUE
207
+ term_copy_clipboard(VALUE self)
208
+ {
209
+ vte_terminal_copy_clipboard(RVAL2TERM(self));
210
+ return Qnil;
211
+ }
212
+
213
+ static VALUE
214
+ term_paste_clipboard(VALUE self)
215
+ {
216
+ vte_terminal_paste_clipboard(RVAL2TERM(self));
217
+ return Qnil;
218
+ }
219
+
220
+ static VALUE
221
+ term_copy_primary(VALUE self)
222
+ {
223
+ vte_terminal_copy_primary(RVAL2TERM(self));
224
+ return Qnil;
225
+ }
226
+
227
+ static VALUE
228
+ term_paste_primary(VALUE self)
229
+ {
230
+ vte_terminal_paste_primary(RVAL2TERM(self));
231
+ return Qnil;
232
+ }
233
+
234
+ static VALUE
235
+ term_set_size(VALUE self, VALUE columns, VALUE rows)
236
+ {
237
+ vte_terminal_set_size(RVAL2TERM(self), NUM2LONG(columns), NUM2LONG(rows));
238
+ return Qnil;
239
+ }
240
+
241
+ static VALUE
242
+ term_set_audible_bell(VALUE self, VALUE is_audible)
243
+ {
244
+ vte_terminal_set_audible_bell(RVAL2TERM(self), RVAL2CBOOL(is_audible));
245
+ return Qnil;
246
+ }
247
+
248
+ static VALUE
249
+ term_get_audible_bell(VALUE self)
250
+ {
251
+ return CBOOL2RVAL(vte_terminal_get_audible_bell(RVAL2TERM(self)));
252
+ }
253
+
254
+ static VALUE
255
+ term_set_visible_bell(VALUE self, VALUE is_visible)
256
+ {
257
+ vte_terminal_set_visible_bell(RVAL2TERM(self), RVAL2CBOOL(is_visible));
258
+ return Qnil;
259
+ }
260
+
261
+ static VALUE
262
+ term_get_visible_bell(VALUE self)
263
+ {
264
+ return CBOOL2RVAL(vte_terminal_get_visible_bell(RVAL2TERM(self)));
265
+ }
266
+
267
+ static VALUE
268
+ term_set_scroll_background(VALUE self, VALUE scroll)
269
+ {
270
+ vte_terminal_set_scroll_background(RVAL2TERM(self), RVAL2CBOOL(scroll));
271
+ return Qnil;
272
+ }
273
+
274
+ static VALUE
275
+ term_set_scroll_on_output(VALUE self, VALUE scroll)
276
+ {
277
+ vte_terminal_set_scroll_on_output(RVAL2TERM(self), RVAL2CBOOL(scroll));
278
+ return Qnil;
279
+ }
280
+
281
+ static VALUE
282
+ term_set_scroll_on_keystroke(VALUE self, VALUE scroll)
283
+ {
284
+ vte_terminal_set_scroll_on_keystroke(RVAL2TERM(self), RVAL2CBOOL(scroll));
285
+ return Qnil;
286
+ }
287
+
288
+ static VALUE
289
+ term_set_color_dim(VALUE self, VALUE dim)
290
+ {
291
+ vte_terminal_set_color_dim(RVAL2TERM(self), RVAL2COLOR(dim));
292
+ return Qnil;
293
+ }
294
+
295
+ static VALUE
296
+ term_set_color_bold(VALUE self, VALUE bold)
297
+ {
298
+ vte_terminal_set_color_bold(RVAL2TERM(self), RVAL2COLOR(bold));
299
+ return Qnil;
300
+ }
301
+
302
+ static VALUE
303
+ term_set_color_foreground(VALUE self, VALUE foreground)
304
+ {
305
+ vte_terminal_set_color_foreground(RVAL2TERM(self), RVAL2COLOR(foreground));
306
+ return Qnil;
307
+ }
308
+
309
+ static VALUE
310
+ term_set_color_background(VALUE self, VALUE background)
311
+ {
312
+ vte_terminal_set_color_background(RVAL2TERM(self), RVAL2COLOR(background));
313
+ return Qnil;
314
+ }
315
+
316
+ static VALUE
317
+ term_set_color_cursor(VALUE self, VALUE cursor)
318
+ {
319
+ vte_terminal_set_color_cursor(RVAL2TERM(self),
320
+ NIL_P(cursor) ? NULL : RVAL2COLOR(cursor));
321
+ return Qnil;
322
+ }
323
+
324
+ static VALUE
325
+ term_set_color_highlight(VALUE self, VALUE highlight)
326
+ {
327
+ vte_terminal_set_color_highlight(RVAL2TERM(self),
328
+ NIL_P(highlight) ?
329
+ NULL : RVAL2COLOR(highlight));
330
+ return Qnil;
331
+ }
332
+
333
+ static VALUE
334
+ term_set_colors(VALUE self, VALUE foreground, VALUE background,
335
+ VALUE rb_palette)
336
+ {
337
+ glong i, len;
338
+ GdkColor *palette;
339
+
340
+ len = RARRAY_LEN(rb_palette);
341
+
342
+ if (!(len == 0 || len == 8 || len == 16 || len == 24)) {
343
+ char *inspect;
344
+ inspect = RVAL2CSTR(rb_palette);
345
+ rb_raise(rb_eArgError, "palette size must be 0, 8, 16 or 24: %s",
346
+ inspect);
347
+ }
348
+
349
+ palette = ALLOCA_N(GdkColor, len);
350
+ for (i = 0; i < len; i++) {
351
+ GdkColor *color;
352
+ color = RVAL2COLOR(RARRAY_PTR(rb_palette)[i]);
353
+ palette[i] = *color;
354
+ }
355
+
356
+ vte_terminal_set_colors(RVAL2TERM(self), RVAL2COLOR(foreground),
357
+ RVAL2COLOR(background), palette, len);
358
+ return Qnil;
359
+ }
360
+
361
+ static VALUE
362
+ term_set_default_colors(VALUE self)
363
+ {
364
+ vte_terminal_set_default_colors(RVAL2TERM(self));
365
+ return Qnil;
366
+ }
367
+
368
+ static VALUE
369
+ term_set_background_image(VALUE self, VALUE image_or_path)
370
+ {
371
+ if (RVAL2CBOOL(rb_obj_is_kind_of(image_or_path, rb_cString))) {
372
+ vte_terminal_set_background_image_file(RVAL2TERM(self),
373
+ RVAL2CSTR(image_or_path));
374
+ } else {
375
+ vte_terminal_set_background_image(RVAL2TERM(self),
376
+ RVAL2GOBJ(image_or_path));
377
+ }
378
+
379
+ return Qnil;
380
+ }
381
+
382
+ static VALUE
383
+ term_set_background_tint_color(VALUE self, VALUE color)
384
+ {
385
+ vte_terminal_set_background_tint_color(RVAL2TERM(self), RVAL2COLOR(color));
386
+ return Qnil;
387
+ }
388
+
389
+ static VALUE
390
+ term_set_background_saturation(VALUE self, VALUE saturation)
391
+ {
392
+ vte_terminal_set_background_saturation(RVAL2TERM(self),
393
+ NUM2DBL(saturation));
394
+ return Qnil;
395
+ }
396
+
397
+ static VALUE
398
+ term_set_background_transparent(VALUE self, VALUE transparent)
399
+ {
400
+ vte_terminal_set_background_transparent(RVAL2TERM(self),
401
+ RVAL2CBOOL(transparent));
402
+ return Qnil;
403
+ }
404
+
405
+ static VALUE
406
+ term_set_cursor_blinks(VALUE self, VALUE blink)
407
+ {
408
+ #if VTE_CHECK_VERSION(0, 18, 0)
409
+ VteTerminalCursorBlinkMode mode;
410
+
411
+ mode = RVAL2CBOOL(blink) ? VTE_CURSOR_BLINK_ON : VTE_CURSOR_BLINK_OFF;
412
+ vte_terminal_set_cursor_blink_mode(RVAL2TERM(self), mode);
413
+ #else
414
+ vte_terminal_set_cursor_blinks(RVAL2TERM(self), RVAL2CBOOL(blink));
415
+ #endif
416
+ return Qnil;
417
+ }
418
+
419
+ #if VTE_CHECK_VERSION(0, 18, 0)
420
+ static VALUE
421
+ term_set_cursor_blink_mode(VALUE self, VALUE rb_mode)
422
+ {
423
+ VteTerminalCursorBlinkMode mode;
424
+
425
+ mode = RVAL2GENUM(rb_mode, VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE);
426
+ vte_terminal_set_cursor_blink_mode(RVAL2TERM(self), mode);
427
+ return Qnil;
428
+ }
429
+
430
+ static VALUE
431
+ term_get_cursor_blink_mode(VALUE self)
432
+ {
433
+ VteTerminalCursorBlinkMode mode;
434
+
435
+ mode = vte_terminal_get_cursor_blink_mode(RVAL2TERM(self));
436
+ return GENUM2RVAL(mode, VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE);
437
+ }
438
+ #endif
439
+
440
+ #if VTE_CHECK_VERSION(0, 19, 1)
441
+ static VALUE
442
+ term_set_cursor_shape(VALUE self, VALUE rb_shape)
443
+ {
444
+ VteTerminalCursorShape shape;
445
+
446
+ shape = RVAL2GENUM(rb_shape, VTE_TYPE_TERMINAL_CURSOR_SHAPE);
447
+ vte_terminal_set_cursor_shape(RVAL2TERM(self), shape);
448
+ return Qnil;
449
+ }
450
+
451
+ static VALUE
452
+ term_get_cursor_shape(VALUE self)
453
+ {
454
+ VteTerminalCursorShape shape;
455
+
456
+ shape = vte_terminal_get_cursor_shape(RVAL2TERM(self));
457
+ return GENUM2RVAL(shape, VTE_TYPE_TERMINAL_CURSOR_SHAPE);
458
+ }
459
+
460
+ static VALUE
461
+ term_get_pty(VALUE self)
462
+ {
463
+ return INT2NUM(vte_terminal_get_pty(RVAL2TERM(self)));
464
+ }
465
+
466
+ static VALUE
467
+ term_get_child_exit_status(VALUE self)
468
+ {
469
+ return INT2NUM(vte_terminal_get_child_exit_status(RVAL2TERM(self)));
470
+ }
471
+ #endif
472
+
473
+ static VALUE
474
+ term_set_scrollback_lines(VALUE self, VALUE lines)
475
+ {
476
+ vte_terminal_set_scrollback_lines(RVAL2TERM(self), NUM2LONG(lines));
477
+ return Qnil;
478
+ }
479
+
480
+ static VALUE
481
+ term_im_append_menuitems(VALUE self, VALUE menushell)
482
+ {
483
+ vte_terminal_im_append_menuitems(RVAL2TERM(self), RVAL2GOBJ(menushell));
484
+ return Qnil;
485
+ }
486
+
487
+ static VALUE
488
+ term_set_font(int argc, VALUE *argv, VALUE self)
489
+ {
490
+ VALUE font_desc_or_name, rb_antialias;
491
+ VteTerminalAntiAlias antialias = VTE_ANTI_ALIAS_USE_DEFAULT;
492
+ VteTerminal *term;
493
+
494
+ rb_scan_args(argc, argv, "11", &font_desc_or_name, &rb_antialias);
495
+
496
+ term = RVAL2TERM(self);
497
+ if (!NIL_P(rb_antialias))
498
+ antialias = RVAL2AA(rb_antialias);
499
+
500
+ if (rb_obj_is_kind_of(font_desc_or_name, rb_cString)) {
501
+ char *name;
502
+ name = RVAL2CSTR(font_desc_or_name);
503
+ if (NIL_P(rb_antialias))
504
+ vte_terminal_set_font_from_string(term, name);
505
+ else
506
+ vte_terminal_set_font_from_string_full(term, name, antialias);
507
+ } else {
508
+ PangoFontDescription *font_desc;
509
+ font_desc = RVAL2PFD(font_desc_or_name);
510
+ if (NIL_P(rb_antialias))
511
+ vte_terminal_set_font(term, font_desc);
512
+ else
513
+ vte_terminal_set_font_full(term, font_desc, antialias);
514
+ }
515
+
516
+ return Qnil;
517
+ }
518
+
519
+ static VALUE
520
+ term_get_font(VALUE self)
521
+ {
522
+ PangoFontDescription *font_desc;
523
+ font_desc = (PangoFontDescription *)vte_terminal_get_font(RVAL2TERM(self));
524
+ return PFD2RVAL(font_desc);
525
+ }
526
+
527
+ static VALUE
528
+ term_get_using_xft(VALUE self)
529
+ {
530
+ return CBOOL2RVAL(vte_terminal_get_using_xft(RVAL2TERM(self)));
531
+ }
532
+
533
+ static VALUE
534
+ term_set_allow_bold(VALUE self, VALUE allow_bold)
535
+ {
536
+ vte_terminal_set_allow_bold(RVAL2TERM(self), RVAL2CBOOL(allow_bold));
537
+ return Qnil;
538
+ }
539
+
540
+ static VALUE
541
+ term_get_allow_bold(VALUE self)
542
+ {
543
+ return CBOOL2RVAL(vte_terminal_get_allow_bold(RVAL2TERM(self)));
544
+ }
545
+
546
+ static VALUE
547
+ term_get_has_selection(VALUE self)
548
+ {
549
+ return CBOOL2RVAL(vte_terminal_get_has_selection(RVAL2TERM(self)));
550
+ }
551
+
552
+ static VALUE
553
+ term_set_word_chars(VALUE self, VALUE word_chars)
554
+ {
555
+ vte_terminal_set_word_chars(RVAL2TERM(self),
556
+ NIL_P(word_chars) ?
557
+ NULL : RVAL2CSTR(word_chars));
558
+ return Qnil;
559
+ }
560
+
561
+ static VALUE
562
+ term_is_word_char(VALUE self, VALUE c)
563
+ {
564
+ return CBOOL2RVAL(vte_terminal_is_word_char(RVAL2TERM(self), NUM2UINT(c)));
565
+ }
566
+
567
+ static VALUE
568
+ term_set_backspace_binding(VALUE self, VALUE binding)
569
+ {
570
+ vte_terminal_set_backspace_binding(RVAL2TERM(self), RVAL2EB(binding));
571
+ return Qnil;
572
+ }
573
+
574
+ static VALUE
575
+ term_set_delete_binding(VALUE self, VALUE binding)
576
+ {
577
+ vte_terminal_set_delete_binding(RVAL2TERM(self), RVAL2EB(binding));
578
+ return Qnil;
579
+ }
580
+
581
+ static VALUE
582
+ term_get_mouse_autohide(VALUE self)
583
+ {
584
+ return CBOOL2RVAL(vte_terminal_get_mouse_autohide(RVAL2TERM(self)));
585
+ }
586
+
587
+ static VALUE
588
+ term_set_mouse_autohide(VALUE self, VALUE setting)
589
+ {
590
+ vte_terminal_set_mouse_autohide(RVAL2TERM(self), RVAL2CBOOL(setting));
591
+ return Qnil;
592
+ }
593
+
594
+ static VALUE
595
+ term_reset(VALUE self, VALUE full, VALUE clear_history)
596
+ {
597
+ vte_terminal_reset(RVAL2TERM(self), RVAL2CBOOL(full),
598
+ RVAL2CBOOL(clear_history));
599
+ return Qnil;
600
+ }
601
+
602
+ static gboolean
603
+ term_is_selected_cb(VteTerminal *terminal, glong column, glong row,
604
+ gpointer data)
605
+ {
606
+ gboolean result = TRUE;
607
+ VALUE callback = (VALUE)data;
608
+
609
+ if (!NIL_P(callback)) {
610
+ VALUE rb_result;
611
+ rb_result = rb_funcall(callback, id_call, 3, GOBJ2RVAL(terminal),
612
+ LONG2NUM(column), LONG2NUM(row));
613
+ result = RVAL2CBOOL(rb_result);
614
+ }
615
+
616
+ return result;
617
+ }
618
+
619
+ static VALUE
620
+ term_get_text(int argc, VALUE *argv, VALUE self)
621
+ {
622
+ VALUE get_attrs, include_trailing_spaces, proc, rb_text;
623
+ GArray *attrs = NULL;
624
+ char *text;
625
+
626
+ rb_scan_args(argc, argv, "02&", &get_attrs,
627
+ &include_trailing_spaces, &proc);
628
+
629
+ if (get_attrs != Qfalse)
630
+ attrs = g_array_new(FALSE, TRUE, sizeof(VteCharAttributes));
631
+
632
+ if (RVAL2CBOOL(include_trailing_spaces)) {
633
+ text = vte_terminal_get_text_include_trailing_spaces(
634
+ RVAL2TERM(self), term_is_selected_cb, (gpointer)proc, attrs);
635
+ } else {
636
+ text = vte_terminal_get_text(RVAL2TERM(self), term_is_selected_cb,
637
+ (gpointer)proc, attrs);
638
+ }
639
+ rb_text = CSTR2RVAL(text);
640
+ free(text);
641
+
642
+ if (attrs) {
643
+ VALUE rb_attrs;
644
+ rb_attrs = attrary2rval(attrs);
645
+ g_array_free(attrs, TRUE);
646
+ return rb_ary_new3(2, rb_text, rb_attrs);
647
+ } else {
648
+ return rb_text;
649
+ }
650
+ }
651
+
652
+ static VALUE
653
+ term_get_text_range(int argc, VALUE *argv, VALUE self)
654
+ {
655
+ VALUE start_row, start_col, end_row, end_col, get_attrs, proc, rb_text;
656
+ GArray *attrs = NULL;
657
+ char *text;
658
+
659
+ rb_scan_args(argc, argv, "41&", &start_row, &start_col,
660
+ &end_row, &end_col, &get_attrs, &proc);
661
+
662
+ if (get_attrs != Qfalse)
663
+ attrs = g_array_new(FALSE, TRUE, sizeof(VteCharAttributes));
664
+
665
+ text = vte_terminal_get_text_range(RVAL2TERM(self),
666
+ NUM2LONG(start_row),
667
+ NUM2LONG(start_col),
668
+ NUM2LONG(end_row),
669
+ NUM2LONG(end_col),
670
+ term_is_selected_cb,
671
+ (gpointer)proc,
672
+ attrs);
673
+ rb_text = CSTR2RVAL(text);
674
+ free(text);
675
+
676
+ if (attrs) {
677
+ VALUE rb_attrs;
678
+ rb_attrs = attrary2rval(attrs);
679
+ g_array_free(attrs, TRUE);
680
+ return rb_ary_new3(2, rb_text, rb_attrs);
681
+ } else {
682
+ return rb_text;
683
+ }
684
+ }
685
+
686
+ static VALUE
687
+ term_get_cursor_position(VALUE self)
688
+ {
689
+ glong column, row;
690
+ vte_terminal_get_cursor_position(RVAL2TERM(self), &column, &row);
691
+ return rb_ary_new3(2, LONG2NUM(column), LONG2NUM(row));
692
+ }
693
+
694
+ static VALUE
695
+ term_match_clear_all(VALUE self)
696
+ {
697
+ vte_terminal_match_clear_all(RVAL2TERM(self));
698
+ return Qnil;
699
+ }
700
+
701
+ static VALUE
702
+ term_match_add(VALUE self, VALUE match)
703
+ {
704
+ return INT2NUM(vte_terminal_match_add(RVAL2TERM(self), RVAL2CSTR(match)));
705
+ }
706
+
707
+ static VALUE
708
+ term_match_set_cursor(VALUE self, VALUE tag, VALUE cursor)
709
+ {
710
+ vte_terminal_match_set_cursor(RVAL2TERM(self), NUM2INT(tag),
711
+ RVAL2GOBJ(cursor));
712
+ return Qnil;
713
+ }
714
+
715
+ static VALUE
716
+ term_match_set_cursor_type(VALUE self, VALUE tag, VALUE cursor_type)
717
+ {
718
+ vte_terminal_match_set_cursor_type(RVAL2TERM(self), NUM2INT(tag),
719
+ RVAL2CT(cursor_type));
720
+ return Qnil;
721
+ }
722
+
723
+ static VALUE
724
+ term_match_remove(VALUE self, VALUE tag)
725
+ {
726
+ vte_terminal_match_remove(RVAL2TERM(self), NUM2INT(tag));
727
+ return Qnil;
728
+ }
729
+
730
+ static VALUE
731
+ term_match_check(VALUE self, VALUE column, VALUE row)
732
+ {
733
+ char *string;
734
+ int tag;
735
+
736
+ string = vte_terminal_match_check(RVAL2TERM(self), NUM2LONG(column),
737
+ NUM2LONG(row), &tag);
738
+ if (string) {
739
+ VALUE rb_string;
740
+ rb_string = CSTR2RVAL(string);
741
+ free(string);
742
+ return rb_ary_new3(2, rb_string, INT2NUM(tag));
743
+ } else {
744
+ return Qnil;
745
+ }
746
+ }
747
+
748
+ static VALUE
749
+ term_set_emulation(VALUE self, VALUE emulation)
750
+ {
751
+ vte_terminal_set_emulation(RVAL2TERM(self), RVAL2CSTR(emulation));
752
+ return Qnil;
753
+ }
754
+
755
+ static VALUE
756
+ term_get_emulation(VALUE self)
757
+ {
758
+ return CSTR2RVAL(vte_terminal_get_emulation(RVAL2TERM(self)));
759
+ }
760
+
761
+ static VALUE
762
+ term_get_default_emulation(VALUE self)
763
+ {
764
+ return CSTR2RVAL(vte_terminal_get_default_emulation(RVAL2TERM(self)));
765
+ }
766
+
767
+ static VALUE
768
+ term_set_encoding(VALUE self, VALUE encoding)
769
+ {
770
+ vte_terminal_set_encoding(RVAL2TERM(self), RVAL2CSTR(encoding));
771
+ return Qnil;
772
+ }
773
+
774
+ static VALUE
775
+ term_get_encoding(VALUE self)
776
+ {
777
+ return CSTR2RVAL(vte_terminal_get_encoding(RVAL2TERM(self)));
778
+ }
779
+
780
+ static VALUE
781
+ term_get_status_line(VALUE self)
782
+ {
783
+ return CSTR2RVAL(vte_terminal_get_status_line(RVAL2TERM(self)));
784
+ }
785
+
786
+ static VALUE
787
+ term_get_padding(VALUE self)
788
+ {
789
+ int xpad, ypad;
790
+ vte_terminal_get_padding(RVAL2TERM(self), &xpad, &ypad);
791
+ return rb_ary_new3(2, INT2NUM(xpad), INT2NUM(ypad));
792
+ }
793
+
794
+ static VALUE
795
+ term_set_pty(VALUE self, VALUE pty_master)
796
+ {
797
+ vte_terminal_set_pty(RVAL2TERM(self), NUM2INT(pty_master));
798
+ return Qnil;
799
+ }
800
+
801
+ static VALUE
802
+ term_get_adjustment(VALUE self)
803
+ {
804
+ return GOBJ2RVAL(vte_terminal_get_adjustment(RVAL2TERM(self)));
805
+ }
806
+
807
+ static VALUE
808
+ term_get_char_width(VALUE self)
809
+ {
810
+ return LONG2NUM(vte_terminal_get_char_width(RVAL2TERM(self)));
811
+ }
812
+
813
+ static VALUE
814
+ term_get_char_height(VALUE self)
815
+ {
816
+ return LONG2NUM(vte_terminal_get_char_height(RVAL2TERM(self)));
817
+ }
818
+
819
+ static VALUE
820
+ term_get_char_descent(VALUE self)
821
+ {
822
+ return LONG2NUM(vte_terminal_get_char_descent(RVAL2TERM(self)));
823
+ }
824
+
825
+ static VALUE
826
+ term_get_char_ascent(VALUE self)
827
+ {
828
+ return LONG2NUM(vte_terminal_get_char_ascent(RVAL2TERM(self)));
829
+ }
830
+
831
+ static VALUE
832
+ term_get_row_count(VALUE self)
833
+ {
834
+ return LONG2NUM(vte_terminal_get_row_count(RVAL2TERM(self)));
835
+ }
836
+
837
+ static VALUE
838
+ term_get_column_count(VALUE self)
839
+ {
840
+ return LONG2NUM(vte_terminal_get_column_count(RVAL2TERM(self)));
841
+ }
842
+
843
+ static VALUE
844
+ term_get_window_title(VALUE self)
845
+ {
846
+ return CSTR2RVAL(vte_terminal_get_window_title(RVAL2TERM(self)));
847
+ }
848
+
849
+ static VALUE
850
+ term_get_icon_title(VALUE self)
851
+ {
852
+ return CSTR2RVAL(vte_terminal_get_icon_title(RVAL2TERM(self)));
853
+ }
854
+
855
+
856
+ void
857
+ Init_vte_terminal(VALUE mVte)
858
+ {
859
+ VALUE cTerminal, cTerminalEraseBinding, cTerminalAntiAlias;
860
+ #if VTE_CHECK_VERSION(0, 18, 0)
861
+ VALUE cTerminalCursorBlinkMode;
862
+ #endif
863
+ #if VTE_CHECK_VERSION(0, 19, 1)
864
+ VALUE cTerminalCursorShape;
865
+ #endif
866
+
867
+ id_new = rb_intern("new");
868
+ id_call = rb_intern("call");
869
+
870
+ id_row = rb_intern("@row");
871
+ id_column = rb_intern("@column");
872
+ id_fore = rb_intern("@fore");
873
+ id_back = rb_intern("@back");
874
+ id_underline = rb_intern("@underline");
875
+ id_strikethrough = rb_intern("@strikethrough");
876
+
877
+ cTerminal = G_DEF_CLASS(VTE_TYPE_TERMINAL, "Terminal", mVte);
878
+ cTerminalEraseBinding = G_DEF_CLASS(VTE_TYPE_TERMINAL_ERASE_BINDING,
879
+ "TerminalEraseBinding", mVte);
880
+ #if VTE_CHECK_VERSION(0, 18, 0)
881
+ cTerminalCursorBlinkMode = G_DEF_CLASS(VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE,
882
+ "TerminalCursorBlinkMode", mVte);
883
+ #endif
884
+ #if VTE_CHECK_VERSION(0, 19, 1)
885
+ cTerminalCursorShape = G_DEF_CLASS(VTE_TYPE_TERMINAL_CURSOR_SHAPE,
886
+ "TerminalCursorShape", mVte);
887
+ #endif
888
+ cTerminalAntiAlias = G_DEF_CLASS(VTE_TYPE_TERMINAL_ANTI_ALIAS,
889
+ "TerminalAntiAlias", mVte);
890
+
891
+ cCharAttributes = rb_define_class_under(mVte, "CharAttributes", rb_cObject);
892
+
893
+ rb_define_method(cCharAttributes, "initialize", ca_initialize, 6);
894
+ rb_attr(cCharAttributes, rb_intern("row"), TRUE, FALSE, TRUE);
895
+ rb_attr(cCharAttributes, rb_intern("column"), TRUE, FALSE, TRUE);
896
+ rb_attr(cCharAttributes, rb_intern("fore"), TRUE, FALSE, TRUE);
897
+ rb_attr(cCharAttributes, rb_intern("back"), TRUE, FALSE, TRUE);
898
+ rb_define_alias(cCharAttributes, "foreground", "fore");
899
+ rb_define_alias(cCharAttributes, "background", "back");
900
+ rb_define_method(cCharAttributes, "underline?", ca_get_underline, 0);
901
+ rb_define_method(cCharAttributes, "strikethrough?",
902
+ ca_get_strikethrough, 0);
903
+
904
+
905
+ rb_define_method(cTerminal, "initialize", term_initialize, 0);
906
+
907
+ rb_define_method(cTerminal, "fork_command", term_fork_command, -1);
908
+ rb_define_method(cTerminal, "fork_pty", term_fork_pty, -1);
909
+
910
+ rb_define_method(cTerminal, "feed", term_feed, 1);
911
+ rb_define_method(cTerminal, "feed_child", term_feed_child, 1);
912
+ rb_define_method(cTerminal, "feed_child_binary", term_feed_child_binary, 1);
913
+
914
+ rb_define_method(cTerminal, "copy_clipboard", term_copy_clipboard, 0);
915
+ rb_define_method(cTerminal, "paste_clipboard", term_paste_clipboard, 0);
916
+ rb_define_method(cTerminal, "copy_primary", term_copy_primary, 0);
917
+ rb_define_method(cTerminal, "paste_primary", term_paste_primary, 0);
918
+
919
+ rb_define_method(cTerminal, "set_size", term_set_size, 2);
920
+
921
+ rb_define_method(cTerminal, "set_audible_bell", term_set_audible_bell, 1);
922
+ rb_define_method(cTerminal, "audible_bell?", term_get_audible_bell, 0);
923
+ rb_define_method(cTerminal, "set_visible_bell", term_set_visible_bell, 1);
924
+ rb_define_method(cTerminal, "visible_bell?", term_get_visible_bell, 0);
925
+
926
+ rb_define_method(cTerminal, "set_scroll_background",
927
+ term_set_scroll_background, 1);
928
+ rb_define_method(cTerminal, "set_scroll_on_output",
929
+ term_set_scroll_on_output, 1);
930
+ rb_define_method(cTerminal, "set_scroll_on_keystroke",
931
+ term_set_scroll_on_keystroke, 1);
932
+
933
+ rb_define_method(cTerminal, "set_color_dim", term_set_color_dim, 1);
934
+ rb_define_method(cTerminal, "set_color_bold", term_set_color_bold, 1);
935
+ rb_define_method(cTerminal, "set_color_foreground",
936
+ term_set_color_foreground, 1);
937
+ rb_define_method(cTerminal, "set_color_background",
938
+ term_set_color_background, 1);
939
+ rb_define_method(cTerminal, "set_color_cursor", term_set_color_cursor, 1);
940
+ rb_define_method(cTerminal, "set_color_highlight",
941
+ term_set_color_highlight, 1);
942
+ rb_define_method(cTerminal, "set_colors", term_set_colors, 3);
943
+ rb_define_method(cTerminal, "set_default_colors",
944
+ term_set_default_colors, 0);
945
+ rb_define_method(cTerminal, "set_background_image",
946
+ term_set_background_image, 1);
947
+ rb_define_method(cTerminal, "set_background_tint_color",
948
+ term_set_background_tint_color, 1);
949
+ rb_define_method(cTerminal, "set_background_saturation",
950
+ term_set_background_saturation, 1);
951
+ rb_define_method(cTerminal, "set_background_transparent",
952
+ term_set_background_transparent, 1);
953
+ rb_define_method(cTerminal, "set_cursor_blinks", term_set_cursor_blinks, 1);
954
+ #if VTE_CHECK_VERSION(0, 18, 0)
955
+ rb_define_method(cTerminal, "set_cursor_blink_mode",
956
+ term_set_cursor_blink_mode, 1);
957
+ rb_define_method(cTerminal, "cursor_blink_mode",
958
+ term_get_cursor_blink_mode, 0);
959
+ #endif
960
+ #if VTE_CHECK_VERSION(0, 19, 1)
961
+ rb_define_method(cTerminal, "set_cursor_shape", term_set_cursor_shape, 1);
962
+ rb_define_method(cTerminal, "cursor_shape", term_get_cursor_shape, 0);
963
+ rb_define_method(cTerminal, "pty", term_get_pty, 0);
964
+ rb_define_method(cTerminal, "child_exit_status",
965
+ term_get_child_exit_status, 0);
966
+ #endif
967
+ rb_define_method(cTerminal, "set_scrollback_lines",
968
+ term_set_scrollback_lines, 1);
969
+
970
+ rb_define_method(cTerminal, "im_append_menuitems",
971
+ term_im_append_menuitems, 1);
972
+
973
+ rb_define_method(cTerminal, "set_font", term_set_font, -1);
974
+ rb_define_method(cTerminal, "font", term_get_font, 0);
975
+ rb_define_method(cTerminal, "using_xft?", term_get_using_xft, 0);
976
+ rb_define_method(cTerminal, "set_allow_bold", term_set_allow_bold, 1);
977
+ rb_define_method(cTerminal, "allow_bold?", term_get_allow_bold, 0);
978
+ rb_define_method(cTerminal, "has_selection?", term_get_has_selection, 0);
979
+ rb_define_alias(cTerminal, "have_selection?", "has_selection?");
980
+ rb_define_method(cTerminal, "set_word_chars", term_set_word_chars, 1);
981
+ rb_define_method(cTerminal, "word_char?", term_is_word_char, 1);
982
+ rb_define_method(cTerminal, "set_backspace_binding",
983
+ term_set_backspace_binding, 1);
984
+ rb_define_method(cTerminal, "set_delete_binding",
985
+ term_set_delete_binding, 1);
986
+ rb_define_method(cTerminal, "mouse_autohide?", term_get_mouse_autohide, 0);
987
+ rb_define_method(cTerminal, "set_mouse_autohide",
988
+ term_set_mouse_autohide, 1);
989
+
990
+ rb_define_method(cTerminal, "reset", term_reset, 2);
991
+
992
+ rb_define_method(cTerminal, "get_text", term_get_text, -1);
993
+ rb_define_method(cTerminal, "get_text_range", term_get_text_range, -1);
994
+
995
+ rb_define_method(cTerminal, "cursor_position", term_get_cursor_position, 0);
996
+
997
+ rb_define_method(cTerminal, "match_clear_all", term_match_clear_all, 0);
998
+ rb_define_method(cTerminal, "match_add", term_match_add, 1);
999
+ rb_define_method(cTerminal, "match_set_cursor",
1000
+ term_match_set_cursor, 2);
1001
+ rb_define_method(cTerminal, "match_set_cursor_type",
1002
+ term_match_set_cursor_type, 2);
1003
+ rb_define_method(cTerminal, "match_remove", term_match_remove, 1);
1004
+ rb_define_method(cTerminal, "match_check", term_match_check, 2);
1005
+
1006
+ rb_define_method(cTerminal, "set_emulation", term_set_emulation, 1);
1007
+ rb_define_method(cTerminal, "emulation", term_get_emulation, 0);
1008
+ rb_define_method(cTerminal, "default_emulation",
1009
+ term_get_default_emulation, 0);
1010
+
1011
+ rb_define_method(cTerminal, "set_encoding", term_set_encoding, 1);
1012
+ rb_define_method(cTerminal, "encoding", term_get_encoding, 0);
1013
+
1014
+ rb_define_method(cTerminal, "status_line", term_get_status_line, 0);
1015
+ rb_define_method(cTerminal, "padding", term_get_padding, 0);
1016
+
1017
+ rb_define_method(cTerminal, "set_pty", term_set_pty, 1);
1018
+
1019
+ rb_define_method(cTerminal, "adjustment", term_get_adjustment, 0);
1020
+ rb_define_method(cTerminal, "char_width", term_get_char_width, 0);
1021
+ rb_define_method(cTerminal, "char_height", term_get_char_height, 0);
1022
+ rb_define_method(cTerminal, "char_descent", term_get_char_descent, 0);
1023
+ rb_define_method(cTerminal, "char_ascent", term_get_char_ascent, 0);
1024
+ rb_define_method(cTerminal, "row_count", term_get_row_count, 0);
1025
+ rb_define_method(cTerminal, "column_count", term_get_column_count, 0);
1026
+ rb_define_method(cTerminal, "window_title", term_get_window_title, 0);
1027
+ rb_define_method(cTerminal, "icon_title", term_get_icon_title, 0);
1028
+
1029
+ G_DEF_SETTERS(cTerminal);
1030
+ }