[libvtemm] Another bunch of unrelated changes, I'm too lazy to separate them.



commit 71cb6bbf8e94735788d2cd5be90b177dda67a626
Author: Krzesimir Nowak <krnowak svn gnome org>
Date:   Fri May 22 03:46:46 2009 +0200

    Another bunch of unrelated changes, I'm too lazy to separate them.
    
    * src/libvtemm.h: Removed inclusion of pty.h, added inclusion of
    shared.h.
    * src/Makefile.am: Added ptysize to files_extra.
    * src/libvtemm/cursorposition.cc:
    * src/libvtemm/padding.cc:
    * src/libvtemm/textandcharattrs.cc:
    * src/libvtemm/textandcharattrs.h: Some bracket moving, variable
    renaming and docs adapting - small and stupid.
    * src/libvtemm/g/charattributes.hg: One grammar fix in docs.
    Changed default value of take_copy in Glib::wrap from false to
    true, because CharAttributes deletes its gobject_ in destructor.
    * src/libvtemm/g/libvte_docs_override.xml: Bunch of documentation
    fixes. Too many to list.
    * src/libvtemm/g/terminal.ccg:
    * src/libvtemm/g/terminal.hg: Get rid of non-const
    get_audible_bell and get_visible_bell methods - they were omitted
    by accident in earlier cleansing. Docs for set_default_colors(...)
    are now more concise. Added unset_background_image method. Returned
    values from get_font, get_emulation, get_default_emulation,
    get_encoding and get_status_line are not const now.
    * src/libvtemm/pty.cc:
    * src/libvtemm/pty.h: Overhaul - instead of having six functions,
    there is now a class called Master.
    * src/libvtemm/ptysize.cc:
    * src/libvtemm/ptysize.h: New files. Size class defined.
    * tools/m4/convert_libvtemm.m4: There was a mess and now there is
    some order - conversions were grouped by related libraries. Several
    conversions were commented and it seems they are not needed. Some
    conversions were rewritten into something else or fixed.
---
 src/libvtemm.h                          |    3 +-
 src/libvtemm/Makefile.am                |    4 +-
 src/libvtemm/cursorposition.cc          |    6 +-
 src/libvtemm/g/charattributes.hg        |    6 +-
 src/libvtemm/g/libvte_docs_override.xml |  234 ++++++++++++++++++++++++-------
 src/libvtemm/g/terminal.ccg             |    6 +
 src/libvtemm/g/terminal.hg              |   30 ++--
 src/libvtemm/padding.cc                 |    6 +-
 src/libvtemm/pty.cc                     |   72 ++++++++--
 src/libvtemm/pty.h                      |  111 +++++++++------
 src/libvtemm/ptysize.cc                 |   61 ++++++++
 src/libvtemm/ptysize.h                  |   71 ++++++++++
 src/libvtemm/textandcharattrs.cc        |   13 +-
 src/libvtemm/textandcharattrs.h         |   10 +-
 tools/m4/convert_libvtemm.m4            |   53 +++++---
 15 files changed, 518 insertions(+), 168 deletions(-)

diff --git a/src/libvtemm.h b/src/libvtemm.h
index 1f23f10..091c02d 100644
--- a/src/libvtemm.h
+++ b/src/libvtemm.h
@@ -27,8 +27,7 @@
 #include <libvtemm/init.h>
 #include <libvtemm/match.h>
 #include <libvtemm/padding.h>
-#include <libvtemm/pty.h>
-//#include <libvtemm/reaper.h>
+#include <libvtemm/shared.h>
 #include <libvtemm/terminal.h>
 #include <libvtemm/terminalaccessible.h>
 #include <libvtemm/textandcharattrs.h>
diff --git a/src/libvtemm/Makefile.am b/src/libvtemm/Makefile.am
index d67b8ab..e4ac7e0 100644
--- a/src/libvtemm/Makefile.am
+++ b/src/libvtemm/Makefile.am
@@ -3,9 +3,9 @@
 
 SUBDIRS = g private
 
-files_extra_h = cursorposition.h init.h match.h padding.h pty.h \
+files_extra_h = cursorposition.h init.h match.h padding.h pty.h ptysize.h \
 	textandcharattrs.h wrap_init.h shared.h
-files_extra_cc = cursorposition.cc init.cc match.cc padding.cc pty.cc \
+files_extra_cc = cursorposition.cc init.cc match.cc padding.cc pty.cc ptysize.cc \
 	textandcharattrs.cc
 
 files_internal_h = internalroutines.h
diff --git a/src/libvtemm/cursorposition.cc b/src/libvtemm/cursorposition.cc
index 0707a59..6cad850 100644
--- a/src/libvtemm/cursorposition.cc
+++ b/src/libvtemm/cursorposition.cc
@@ -30,12 +30,10 @@ CursorPosition::CursorPosition(long column, long row)
 :
   m_column(column),
   m_row(row)
-{
-}
+{}
 
 CursorPosition::~CursorPosition()
-{
-}
+{}
 
 long CursorPosition::get_column() const
 {
diff --git a/src/libvtemm/g/charattributes.hg b/src/libvtemm/g/charattributes.hg
index d755514..31c02c7 100644
--- a/src/libvtemm/g/charattributes.hg
+++ b/src/libvtemm/g/charattributes.hg
@@ -65,8 +65,8 @@ public:
  * @return <tt>true</tt> if char is underlined, otherwise <tt>false</tt>.
  */
   _MEMBER_GET(underline, underline, bool, guint)
-/** Checks whether or not a char is strokethrough.
- * @return <tt>true</tt> if char is strokethrough, otherwise <tt>false</tt>.
+/** Checks whether or not a char is struckthrough.
+ * @return <tt>true</tt> if char is struckthrough, otherwise <tt>false</tt>.
  */
   _MEMBER_GET(strikethrough, strikethrough, bool, guint)
 
@@ -107,6 +107,6 @@ namespace Glib
  *
  * @relates Gnome::Vte::CharAttributes
  */
-Gnome::Vte::CharAttributes wrap(VteCharAttributes* object, bool take_copy = false);
+Gnome::Vte::CharAttributes wrap(VteCharAttributes* object, bool take_copy = true);
 
 } // namespace Glib
diff --git a/src/libvtemm/g/libvte_docs_override.xml b/src/libvtemm/g/libvte_docs_override.xml
index 4a30a0c..19904fc 100644
--- a/src/libvtemm/g/libvte_docs_override.xml
+++ b/src/libvtemm/g/libvte_docs_override.xml
@@ -95,11 +95,12 @@ from the new background color and the items in @palette.
 <function name="vte_terminal_get_text_include_trailing_spaces">
 <description>
 Extracts a view of the visible part of the terminal. Characters will only be
-read if @slot returns %true after being passed the column and row, respectively.
-A #VteCharAttributes structure is added to #TextAndCharAttrs return value for
+read if @slot returns \c true after being passed the column and row, respectively.
+A Gnome::Vte::CharAttributes structure is added to Gnome::Vte::TextAndCharAttrs return value for
 each byte added to the returned string detailing the character&apos;s position,
 colors, and other characteristics. This function differs from get_text() in that
-trailing spaces at the end of lines are included.
+trailing spaces at the end of lines are included. Remember: to get byte
+representation of gotten text, use std::string.
 
 
 </description>
@@ -113,7 +114,7 @@ trailing spaces at the end of lines are included.
 </parameter_description>
 </parameter>
 </parameters>
-<return> a #TextAndCharAttrs with text that may be empty and stored text
+<return> a Gnome::Vte::TextAndCharAttrs with text that may be empty and stored text
 attributes
 </return>
 </function>
@@ -121,10 +122,11 @@ attributes
 <function name="vte_terminal_get_text">
 <description>
 Extracts a view of the visible part of the terminal. Characters will only be
-read if @slot returns %true after being passed the column and row, respectively.
-A #VteCharAttributes structure is added to #TextAndCharAttrs return value for
+read if @slot returns \c true after being passed the column and row, respectively.
+A Gnome::Vte::CharAttributes structure is added to Gnome::Vte::TextAndCharAttrs return value for
 each byte added to the returned string detailing the character&apos;s position,
-colors, and other characteristics.
+colors, and other characteristics. Remember: to get byte representation of
+gotten text, use std::string.
 
 
 </description>
@@ -138,7 +140,7 @@ colors, and other characteristics.
 </parameter_description>
 </parameter>
 </parameters>
-<return> a #TextAndCharAttrs with text that may be empty and stored text
+<return> a Gnome::Vte::TextAndCharAttrs with text that may be empty and stored text
 attributes
 </return>
 </function>
@@ -146,11 +148,12 @@ attributes
 <function name="vte_terminal_get_text_range">
 <description>
 Extracts a view of the visible part of the terminal. Characters will only be
-read if @slot returns %true after being passed the column and row, respectively.
-A #VteCharAttributes structure is added to #TextAndCharAttrs return value for
+read if @slot returns \c true after being passed the column and row, respectively.
+A Gnome::Vte::CharAttributes structure is added to Gnome::Vte::TextAndCharAttrs return value for
 each byte added to the returned string detailing the character&apos;s position,
 colors, and other characteristics. The entire scrollback buffer is scanned, so
 it is possible to read the entire contents of the buffer using this function.
+Remember: to get byte representation of gotten text, use std::string.
 
 
 </description>
@@ -180,7 +183,7 @@ it is possible to read the entire contents of the buffer using this function.
 </parameter_description>
 </parameter>
 </parameters>
-<return> a #TextAndCharAttrs with text that may be empty and stored text
+<return> a Gnome::Vte::TextAndCharAttrs with text that may be empty and stored text
 attributes
 </return>
 </function>
@@ -189,10 +192,9 @@ attributes
 <description>
 Starts a new child process under a newly-allocated controlling
 pseudo-terminal.  TERM is automatically set to reflect the terminal widget&apos;s
-emulation setting.  If @lastlog, @utmp, or @wtmp are %true, logs the session
+emulation setting.  If @lastlog, @utmp, or @wtmp are \c true, logs the session
 to the specified system log files.
-See Gnome::Vte::Terminal::fork_command() for description about format of @envv
-parameter.
+See fork_command() for description about format of @envv parameter.
 
 
 </description>
@@ -212,15 +214,15 @@ empty string to inherit starting directory from parent
 </parameter_description>
 </parameter>
 <parameter name="lastlog">
-<parameter_description> %true if the session should be logged to the lastlog
+<parameter_description> \c true if the session should be logged to the lastlog
 </parameter_description>
 </parameter>
 <parameter name="utmp">
-<parameter_description> %true if the session should be logged to the utmp/utmpx log
+<parameter_description> \c true if the session should be logged to the utmp/utmpx log
 </parameter_description>
 </parameter>
 <parameter name="wtmp">
-<parameter_description> %true if the session should be logged to the wtmp/wtmpx log
+<parameter_description> \c true if the session should be logged to the wtmp/wtmpx log
 </parameter_description>
 </parameter>
 </parameters>
@@ -234,10 +236,10 @@ Starts the specified command under a newly-allocated controlling
 pseudo-terminal.  The argv[0] is expected to be the name of the file being run,
 as it would be if execve() were being called. TERM is automatically set to
 reflect the terminal widget&apos;s emulation setting. If @lastlog, @utmp, or
- wtmp are %true, logs the session to the specified system log files.
+ wtmp are \c true, logs the session to the specified system log files.
 @argv and @envv can be in two formats: with last string empty and with last
-string non-empty, so user-defined vector or result of #Glib::shell_parse_argv
-can be passed.
+string non-empty, so result of Glib::shell_parse_argv() or user-defined vector
+with all strings non-empty can be passed.
 
 
 </description>
@@ -265,15 +267,15 @@ empty string to inherit starting directory from parent
 </parameter_description>
 </parameter>
 <parameter name="lastlog">
-<parameter_description> %true if the session should be logged to the lastlog
+<parameter_description> \c true if the session should be logged to the lastlog
 </parameter_description>
 </parameter>
 <parameter name="utmp">
-<parameter_description> %true if the session should be logged to the utmp/utmpx log
+<parameter_description> \c true if the session should be logged to the utmp/utmpx log
 </parameter_description>
 </parameter>
 <parameter name="wtmp">
-<parameter_description> %true if the session should be logged to the wtmp/wtmpx log
+<parameter_description> \c true if the session should be logged to the wtmp/wtmpx log
 </parameter_description>
 </parameter>
 </parameters>
@@ -308,7 +310,7 @@ which they were added.
 </parameter_description>
 </parameter>
 </parameters>
-<return> a #Gnome::Vte::Match instance holding string which matches one of the
+<return> a Gnome::Vte::Match instance holding string which matches one of the
 previously set regular expressions and a tag of matched regular expression.
 </return>
 </function>
@@ -326,7 +328,7 @@ coordinate is absolute.
 </parameter_description>
 </parameter>
 </parameters>
-<return> #Gnome::Vte::CursorPosition instance holding both coordinates</return>
+<return> Gnome::Vte::CursorPosition instance holding both coordinates</return>
 </function>
 
 <function name="vte_terminal_get_padding">
@@ -335,10 +337,10 @@ Determines the amount of additional space the widget is using to pad the
 edges of its visible area. This is necessary for cases where characters in
 the selected font don't themselves include a padding area and the text
 itself would otherwise be contiguous with the window border. Applications
-which use the widget's row count, column count, char height, and
-char width fields to set geometry hints using
-#Gtk::Window::set_geometry_hints() will need to add this value to the base
-size. The values returned in #Gnome::Vte::Padding are the total padding
+which use the terminal's row count, column count, char height, and
+char width to set geometry hints using
+Gtk::Window::set_geometry_hints() will need to add this value to the base
+size. The values returned in Gnome::Vte::Padding are the total padding
 used in each direction, and do not need to be doubled.
 
 
@@ -349,7 +351,7 @@ used in each direction, and do not need to be doubled.
 </parameter_description>
 </parameter>
 </parameters>
-<return> #Gnome::Vte::Padding instance holding both paddings
+<return> Gnome::Vte::Padding instance holding both paddings
 </return>
 </function>
 
@@ -407,7 +409,7 @@ Gets cursor shape.
 <function name="vte_terminal_get_default_emulation">
 <description>
 Queries the terminal for its default emulation, which is attempted if
-vte_terminal_set_default_emulation() is used.
+set_default_emulation() is used.
 
 
 </description>
@@ -450,11 +452,11 @@ this expression, the text will be highlighted.
 </parameter_description>
 </parameter>
 <parameter name="regex">
-<parameter_description> a #GRegex
+<parameter_description> a Glib::RefPtr&lt;Glib::Regex&gt;
 </parameter_description>
 </parameter>
 <parameter name="flags">
-<parameter_description> the #GRegexMatchFlags to use when matching the regex
+<parameter_description> the Glib::RegexMatchFlags to use when matching the regex
 </parameter_description>
 </parameter>
 </parameters>
@@ -479,7 +481,7 @@ specified by @tag. The terminal keeps a reference to @cursor.
 </parameter_description>
 </parameter>
 <parameter name="cursor">
-<parameter_description> the #GdkCursor which the terminal should use when the pattern is
+<parameter_description> the Gdk::Cursor which the terminal should use when the pattern is
 highlighted
 </parameter_description>
 </parameter>
@@ -528,7 +530,7 @@ specified by @tag.
 </parameter_description>
 </parameter>
 <parameter name="cursor_type">
-<parameter_description> a #GdkCursorType
+<parameter_description> a Gdk::CursorType
 </parameter_description>
 </parameter>
 </parameters>
@@ -633,8 +635,8 @@ Sets the background color for text which is highlighted.
 
 <function name="vte_terminal_set_cursor_blink_mode">
 <description>
-Sets whether or not the cursor will blink. Using %VTE_CURSOR_BLINK_SYSTEM
-will use the #Gtk::Settings::property_gtk_cursor_blink setting.
+Sets whether or not the cursor will blink. Using Gnome::Vte::CURSOR_BLINK_SYSTEM
+will use the Gtk::Settings::property_gtk_cursor_blink() setting.
 
 </description>
 <parameters>
@@ -643,7 +645,7 @@ will use the #Gtk::Settings::property_gtk_cursor_blink setting.
 </parameter_description>
 </parameter>
 <parameter name="mode">
-<parameter_description> the #VteTerminalCursorBlinkMode to use
+<parameter_description> the Gnome::Vte::TerminalCursorBlinkMode to use
 </parameter_description>
 </parameter>
 </parameters>
@@ -662,7 +664,7 @@ Sets the shape of the cursor drawn.
 </parameter_description>
 </parameter>
 <parameter name="shape">
-<parameter_description> the #VteTerminalCursorShape to use
+<parameter_description> the Gnome::Vte::TerminalCursorShape to use
 </parameter_description>
 </parameter>
 </parameters>
@@ -702,7 +704,7 @@ one is set) when the text in the window must be scrolled.
 </parameter_description>
 </parameter>
 <parameter name="scroll">
-<parameter_description> %TRUE if the terminal should scroll the background image along with
+<parameter_description> \c true if the terminal should scroll the background image along with
 text.
 </parameter_description>
 </parameter>
@@ -742,7 +744,8 @@ specified image. If necessary, the image will be tiled to cover the
 widget's entire visible area. If specified by
 vte_terminal_set_background_saturation(), the terminal will tint its
 in-memory copy of the image before applying it to the terminal. If @image will
-be Glib::RefPtr&lt;Gdk::PixBuf&gt;(<!-- -->) then background will be canceled.
+be Glib::RefPtr&lt;Gdk::PixBuf&gt;(<!-- -->) then background will be canceled
+(or just use unset_background_image()).
 
 
 </description>
@@ -771,7 +774,7 @@ Gets terminal's adjustment for use in scrollbar for example.
 </parameter_description>
 </parameter>
 </parameters>
-<return> @terminal's adjustment
+<return> terminal's adjustment
 </return>
 </function>
 
@@ -787,13 +790,13 @@ Gets terminal's window title.
 </parameter_description>
 </parameter>
 </parameters>
-<return> @terminal's window title
+<return> terminal's window title
 </return>
 </function>
 
 <function name="vte_terminal_get_char_height">
 <description>
-Gets terminal's char height for use in @GtkGeometry for example.
+Gets terminal's char height for use in Gdk::Geometry for example.
 
 
 </description>
@@ -803,7 +806,7 @@ Gets terminal's char height for use in @GtkGeometry for example.
 </parameter_description>
 </parameter>
 </parameters>
-<return> @terminal's char height
+<return> terminal's char height
 </return>
 </function>
 
@@ -819,7 +822,7 @@ Gets terminal's row count.
 </parameter_description>
 </parameter>
 </parameters>
-<return> @terminal's row count
+<return> terminal's row count
 </return>
 </function>
 
@@ -835,13 +838,13 @@ Gets terminal's icon title.
 </parameter_description>
 </parameter>
 </parameters>
-<return> @terminal's icon title
+<return> terminal's icon title
 </return>
 </function>
 
 <function name="vte_terminal_get_char_width">
 <description>
-Gets terminal's char width for use in @GtkGeometry for example.
+Gets terminal's char width for use in Gdk::Geometry for example.
 
 
 </description>
@@ -851,7 +854,7 @@ Gets terminal's char width for use in @GtkGeometry for example.
 </parameter_description>
 </parameter>
 </parameters>
-<return> @terminal's char width
+<return> terminal's char width
 </return>
 </function>
 
@@ -867,8 +870,139 @@ Gets terminal's column count.
 </parameter_description>
 </parameter>
 </parameters>
-<return> @terminal's column count
+<return> terminal's column count
 </return>
 </function>
 
+<function name="vte_terminal_copy_clipboard">
+<description>
+Places the selected text in the terminal in the \c GDK_SELECTION_CLIPBOARD
+selection.
+
+
+</description>
+<parameters>
+<parameter name="terminal">
+<parameter_description> a #VteTerminal
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
+<function name="vte_terminal_paste_clipboard">
+<description>
+Sends the contents of the \c GDK_SELECTION_CLIPBOARD selection to the
+terminal's child.  If necessary, the data is converted from UTF-8 to the
+terminal's current encoding. It's called on paste menu item, or when
+user presses Shift+Insert.
+
+</description>
+<parameters>
+<parameter name="terminal">
+<parameter_description> a #VteTerminal
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
+<function name="vte_terminal_paste_primary">
+<description>
+Sends the contents of the \c GDK_SELECTION_PRIMARY selection to the terminal's
+child.  If necessary, the data is converted from UTF-8 to the terminal's
+current encoding.  The terminal will call also paste the
+\c GDK_SELECTION_PRIMARY selection when the user clicks with the the second
+mouse button.
+
+
+</description>
+<parameters>
+<parameter name="terminal">
+<parameter_description> a #VteTerminal
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
+<function name="vte_terminal_copy_primary">
+<description>
+Places the selected text in the terminal in the \c GDK_SELECTION_PRIMARY
+selection.
+
+
+</description>
+<parameters>
+<parameter name="terminal">
+<parameter_description> a #VteTerminal
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
+<function name="vte_terminal_set_font">
+<description>
+Sets the font used for rendering all text displayed by the terminal,
+overriding any fonts set using Gtk::Widget::modify_font().  The terminal
+will immediately attempt to load the desired font, retrieve its
+metrics, and attempt to resize itself to keep the same number of rows
+and columns.
+
+
+</description>
+<parameters>
+<parameter name="terminal">
+<parameter_description> a #VteTerminal
+</parameter_description>
+</parameter>
+<parameter name="font_desc">
+<parameter_description> The Pango::FontDescription of the desired font.
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
+<function name="vte_terminal_get_status_line">
+<description>
+Some terminal emulations specify a status line which is separate from the
+main display area, and define a means for applications to move the cursor
+to the status line and back.
+
+
+</description>
+<parameters>
+<parameter name="terminal">
+<parameter_description> a #VteTerminal
+</parameter_description>
+</parameter>
+</parameters>
+<return> the current contents of the terminal's status line.  For terminals
+like &quot;xterm&quot;, this will usually be the empty string.
+</return>
+</function>
+
+<function name="vte_terminal_im_append_menuitems">
+<description>
+Appends menu items for various input methods to the given menu.  The
+user can select one of these items to modify the input method used by
+the terminal.
+
+
+</description>
+<parameters>
+<parameter name="terminal">
+<parameter_description> a #VteTerminal
+</parameter_description>
+</parameter>
+<parameter name="menushell">
+<parameter_description> a Gtk::MenuShell
+</parameter_description>
+</parameter>
+</parameters>
+<return></return>
+</function>
+
 </root>
diff --git a/src/libvtemm/g/terminal.ccg b/src/libvtemm/g/terminal.ccg
index af4f66b..20880a2 100644
--- a/src/libvtemm/g/terminal.ccg
+++ b/src/libvtemm/g/terminal.ccg
@@ -117,6 +117,12 @@ Terminal::set_default_colors(const Gdk::ArrayHandle_Color& palette)
   vte_terminal_set_colors(gobj(), 0, 0, palette.data(), palette.size());
 }
 
+void
+Terminal::unset_background_image()
+{
+  vte_terminal_set_background_image(gobj(), 0);
+}
+
 bool
 Terminal::always_selected(long, long)
 {
diff --git a/src/libvtemm/g/terminal.hg b/src/libvtemm/g/terminal.hg
index b3abd9c..72f5f38 100644
--- a/src/libvtemm/g/terminal.hg
+++ b/src/libvtemm/g/terminal.hg
@@ -96,11 +96,9 @@ public:
   _WRAP_METHOD(void set_size(long columns, long rows), vte_terminal_set_size)
 
   _WRAP_METHOD(void set_audible_bell(bool is_audible = true), vte_terminal_set_audible_bell)
-  _WRAP_METHOD(bool get_audible_bell(), vte_terminal_get_audible_bell)
-  _WRAP_METHOD(bool get_audible_bell() const, vte_terminal_get_audible_bell, constversion)
+  _WRAP_METHOD(bool get_audible_bell() const, vte_terminal_get_audible_bell)
   _WRAP_METHOD(void set_visible_bell(bool is_visible = true), vte_terminal_set_visible_bell)
-  _WRAP_METHOD(bool get_visible_bell(), vte_terminal_get_visible_bell)
-  _WRAP_METHOD(bool get_visible_bell() const, vte_terminal_get_visible_bell, constversion)
+  _WRAP_METHOD(bool get_visible_bell() const, vte_terminal_get_visible_bell)
   _WRAP_METHOD(void set_scroll_background(bool scroll = true), vte_terminal_set_scroll_background)
   _WRAP_METHOD(void set_scroll_on_output(bool scroll = true), vte_terminal_set_scroll_on_output)
   _WRAP_METHOD(void set_scroll_on_keystroke(bool scroll = true), vte_terminal_set_scroll_on_keystroke)
@@ -131,8 +129,7 @@ public:
    * and a dim version of the the eight color palette.
    *
    * Size of @a palette must be either 0, 8, 16, or 24.  If size of @a palette is greater
-   * than 0, the new foreground color is taken from @a palette[7].
-   * If size of @a palette is greater than 0, the new background color is taken from
+   * than 0, the new foreground color is taken from @a palette[7] and the new background color is taken from
    * @a palette[0].  If size of @a palette is 8 or 16, the third (dim) and possibly the
    * second (bold) 8-color palettes are extrapolated from the new background
    * color and the items in @a palette.
@@ -141,6 +138,11 @@ public:
 
   _WRAP_METHOD(void set_background_image(const Glib::RefPtr<Gdk::Pixbuf>& image), vte_terminal_set_background_image)
   _WRAP_METHOD(void set_background_image_file(const std::string& path), vte_terminal_set_background_image_file)
+  
+  /** Convenience method which cancels background image. Equivalent to
+   * set_background_image(Glib::RefPtr<Gdk::Pixbuf>()).
+   */
+  void unset_background_image();
   _WRAP_METHOD(void set_background_tint_color(const Gdk::Color& color), vte_terminal_set_background_tint_color)
   _WRAP_METHOD(void set_background_saturation(double saturation), vte_terminal_set_background_saturation)
   _WRAP_METHOD(void set_background_transparent(bool transparent = true), vte_terminal_set_background_transparent)
@@ -160,8 +162,8 @@ public:
   _WRAP_METHOD(void set_font(const Pango::FontDescription& font_desc), vte_terminal_set_font)
 //  _WRAP_METHOD(void set_font_full(const Pango::FontDescription& font_desc, TerminalAntiAlias antialias), vte_terminal_set_font_full, deprecated)
   _WRAP_METHOD(void set_font_from_string(const Glib::ustring& name), vte_terminal_set_font_from_string)
-//  _WRAP_METHOD(void set_font_from_string_full(const Glib::ustring name, TerminalAntiAlias antialias), vte_terminal_set_font_from_string_full, deprecated)
-  _WRAP_METHOD(const Pango::FontDescription get_font() const, vte_terminal_get_font)
+//  _WRAP_METHOD(void set_font_from_string_full(const Glib::ustring& name, TerminalAntiAlias antialias), vte_terminal_set_font_from_string_full, deprecated)
+  _WRAP_METHOD(Pango::FontDescription get_font() const, vte_terminal_get_font)
 //  _WRAP_METHOD(bool get_using_xft() const, vte_terminal_get_using_xft, deprecated)
   _WRAP_METHOD(void set_allow_bold(bool allow_bold = true), vte_terminal_set_allow_bold)
   _WRAP_METHOD(bool get_allow_bold() const, vte_terminal_get_allow_bold)
@@ -186,13 +188,13 @@ public:
    */
   typedef sigc::slot<bool, long /* column */, long /* row */> SlotSelectedCallback;
   
-  /** Convenience callback, which always returns %true.
+  /** Convenience callback, which always returns @c true.
    *
    * @see get_text(), get_text_include_trailing_spaces(), get_text_range().
    */
   static bool always_selected(long, long);
   
-  /** Convenience callback, which always returns %false.
+  /** Convenience callback, which always returns @c false.
    *
    * @see get_text(), get_text_include_trailing_spaces(), get_text_range().
    */
@@ -228,13 +230,13 @@ public:
   /** Sets default type of terminal the widget attempts to emulate.
    */
   void set_default_emulation();
-  _WRAP_METHOD(const Glib::ustring get_emulation() const, vte_terminal_get_emulation)
-  _WRAP_METHOD(const Glib::ustring get_default_emulation() const, vte_terminal_get_default_emulation)
+  _WRAP_METHOD(Glib::ustring get_emulation() const, vte_terminal_get_emulation)
+  _WRAP_METHOD(Glib::ustring get_default_emulation() const, vte_terminal_get_default_emulation)
 
   _WRAP_METHOD(void set_encoding(const Glib::ustring& codeset), vte_terminal_set_encoding)
-  _WRAP_METHOD(const Glib::ustring get_encoding() const, vte_terminal_get_encoding)
+  _WRAP_METHOD(Glib::ustring get_encoding() const, vte_terminal_get_encoding)
 
-  _WRAP_METHOD(const Glib::ustring get_status_line() const, vte_terminal_get_status_line)
+  _WRAP_METHOD(Glib::ustring get_status_line() const, vte_terminal_get_status_line)
 
   _WRAP_METHOD_DOCS_ONLY(vte_terminal_get_padding)
   Padding get_padding() const;
diff --git a/src/libvtemm/padding.cc b/src/libvtemm/padding.cc
index 0afaf38..af39712 100644
--- a/src/libvtemm/padding.cc
+++ b/src/libvtemm/padding.cc
@@ -30,12 +30,10 @@ Padding::Padding(int x_pad, int y_pad)
 :
   m_x_pad(x_pad),
   m_y_pad(y_pad)
-{
-}
+{}
 
 Padding::~Padding()
-{
-}
+{}
 
 int Padding::get_x_pad() const
 {
diff --git a/src/libvtemm/pty.cc b/src/libvtemm/pty.cc
index e92e848..3f0d6bc 100644
--- a/src/libvtemm/pty.cc
+++ b/src/libvtemm/pty.cc
@@ -33,40 +33,82 @@ namespace Vte
 namespace Pty
 {
 
-int _open(Glib::Pid& child, const StdStringArrayHandle& env_add,
-          const std::string& command, const StdStringArrayHandle& argv,
-          const std::string& directory,
-          int columns, int rows,
-          bool lastlog, bool utmp, bool wtmp)
+Master::Master(int d)
+:
+  m_d(d)
+{}
+
+Master::~Master()
+{
+  if (m_d != -1)
+  {
+    close();
+  }
+}
+
+
+Glib::Pid
+Master::open(const std::string& command,
+             const StdStringArrayHandle& argv,
+             const StdStringArrayHandle& env_add,
+             const std::string& directory,
+             int columns,
+             int rows,
+             bool lastlog,
+             bool utmp,
+             bool wtmp)
 {
+  Glib::Pid child = -1;
   const char* c_command = get_c_string(command);
   const char* c_directory = get_c_string(directory);
   char** c_env_add = get_c_string_vector(env_add);
   char** c_argv = get_c_string_vector(argv);
-  int master = _vte_pty_open(&child, c_env_add, c_command, c_argv, c_directory, columns, rows, static_cast<gboolean>(lastlog), static_cast<gboolean>(utmp), static_cast<gboolean>(wtmp));
+  m_d = _vte_pty_open(&child, c_env_add, c_command, c_argv, c_directory, columns, rows, static_cast<gboolean>(lastlog), static_cast<gboolean>(utmp), static_cast<gboolean>(wtmp));
   g_strfreev(c_env_add);
   g_strfreev(c_argv);
-  return master;
+  return child;
+}
+
+Size
+Master::get_size() const
+{
+  int columns, rows;
+  int res = _vte_pty_get_size(m_d, &columns, &rows);
+  if (res < 0)
+  {
+    return Size(-1, -1, false);
+  }
+  return Size(columns, rows);
 }
 
-int _get_size(int master, int& columns, int& rows)
+bool
+Master::set_size(int columns, int rows)
 {
-  return _vte_pty_get_size(master, &columns, &rows);
+  int res = _vte_pty_set_size(m_d, columns, rows);
+  if (res < 0)
+  {
+    return false;
+  }
+  return true;
 }
 
-int _set_size(int master, int columns, int rows)
+void
+Master::set_utf8(bool utf8)
 {
-  return _vte_pty_set_size(master, columns, rows);
+  _vte_pty_set_utf8(m_d, static_cast<gboolean>(utf8));
 }
 
-void _set_utf8(int pty, bool utf8)
+int
+Master::get_pty() const
 {
-  _vte_pty_set_utf8(pty, static_cast<gboolean>(utf8));
+  return m_d;
 }
 
-void _close(int pty)
+void
+Master::close()
 {
-  _vte_pty_close(pty);
+  _vte_pty_close(m_d);
+  m_d = -1;
 }
 
 } // namespace Pty
diff --git a/src/libvtemm/pty.h b/src/libvtemm/pty.h
index dff721a..8b0f969 100644
--- a/src/libvtemm/pty.h
+++ b/src/libvtemm/pty.h
@@ -22,6 +22,7 @@
 #define _LIBVTEMM_PTY_H_
 
 #include <glibmm.h>
+#include <libvtemm/ptysize.h>
 #include <libvtemm/shared.h>
 
 namespace Gnome
@@ -33,54 +34,78 @@ namespace Vte
 namespace Pty
 {
 
-/** Start up the given binary (exact path, not interpreted at all) in a
- * pseudo-terminal of its own, returning the descriptor for the master
- * side of the PTY pair, logging the session to the specified files, and
- * storing the child's PID in the given argument.
- * @param child Stored child's PID.
- * @param env_add Empty string terminated list of environment variables to be added before executing a command. See Gnome::Vte::Terminal::fork_command() for description about format of this parameter.
- * @param command Command to be executed (not interpreted at all). If empty, fork will be executed.
- * @param argv Empty string terminated list of arguments given to executed binary (argv[0] should be a binary name). See Gnome::Vte::Terminal::fork_command() for description about format of this parameter.
- * @param directory Path where command have to be executed. If empty, path will be inherited from parent.
- * @param columns Number of columns of pty.
- * @param rows Number of rows of pty.
- * @param lastlog %true if the session should be logged to the lastlog.
- * @param utmp %true if the session should be logged to the utmp/utmpx log.
- * @param wtmp %true if the session should be logged to the wtmp/wtmpx log.
- * @return Descriptor for the master side of the PTY pair.
+/** Master - class holding a descriptor for the master side of PTY pair.
  */
-int _open(Glib::Pid& child, const StdStringArrayHandle& env_add,
-          const std::string& command, const StdStringArrayHandle& argv,
-          const std::string& directory,
-          int columns, int rows,
-          bool lastlog, bool utmp, bool wtmp);
+class Master
+{
+public:
+  /** Sets descriptor for the master side of PTY pair to @a d. Use other than
+   * default value at your own risk. Otherwise
+   * use open() to set a descriptor.
+   * @param d Descriptor for the master side of PTY pair. -1 by default.
+   */
+  Master(int d = -1);
+  /** If master side of PTY pair is not equal to -1, it calls close().
+   * Otherwise it do nothing.
+   */
+  ~Master();
 
-/** Read the size of a terminal.
- * @param master Descriptor for the master side of the PTY pair.
- * @param columns Stored number of columns.
- * @param rows Stored number of rows.
- * @return Returns 0 on success, -1 on failure, with errno set to defined return codes from ioctl().
- */
-int _get_size(int master, int& columns, int& rows);
+  /** Start up the given binary (exact path, not interpreted at all) in a
+   * pseudo-terminal of its own, returning the child's PID and logging the
+   * session to the specified files.
+   * @param env_add Empty string terminated list of environment variables to be added before executing a command. See Gnome::Vte::Terminal::fork_command() for description about format of this parameter.
+   * @param command Command to be executed (not interpreted at all). If empty, fork will be executed.
+   * @param argv Empty string terminated list of arguments given to executed binary (argv[0] should be a binary name). See Gnome::Vte::Terminal::fork_command() for description about format of this parameter.
+   * @param directory Path where command have to be executed. If empty, path will be inherited from parent.
+   * @param columns Number of columns of pty. If set to 0, compiled-in defaults will be used.
+   * @param rows Number of rows of pty. If set to 0, compiled-in defaults will be used.
+   * @param lastlog @c true if the session should be logged to the lastlog.
+   * @param utmp @c true if the session should be logged to the utmp/utmpx log.
+   * @param wtmp @c true if the session should be logged to the wtmp/wtmpx log.
+   * @return Descriptor for the master side of the PTY pair.
+   */
+  Glib::Pid open(const std::string& command = std::string(),
+                 const StdStringArrayHandle& argv = StdStringArrayHandle(0, Glib::OWNERSHIP_NONE),
+                 const StdStringArrayHandle& env_add = StdStringArrayHandle(0, Glib::OWNERSHIP_NONE),
+                 const std::string& directory = std::string(),
+                 int columns = 0,
+                 int rows = 0,
+                 bool lastlog = false,
+                 bool utmp = false,
+                 bool wtmp = false);
 
-/** Set the size of a terminal.
- * @param master Descriptor for the master side of the PTY pair.
- * @param columns Number of columns to set.
- * @param rows Number of rows to set.
- * @return Returns 0 on success, -1 on failure, with errno set to defined return codes from ioctl().
- */
-int _set_size(int master, int columns, int rows);
+  /** Attempts to read the pseudo terminal's window size. If something goes
+   * wrong, Gnome::Vte::Pty::Size::is_ok() will return @c false and @c errno
+   * will be set.
+   * @return Gnome::Vte::Pty::Size instance holding number of columns and rows.
+   */
+  Size get_size() const;
 
-/** Try to let the kernel know that the terminal is or is not UTF-8.
- * @param pty Descriptor for the master side of the PTY pair.
- * @param utf8 %TRUE if the terminal is UTF-8.
- */
-void _set_utf8(int pty, bool utf8);
+  /** Attempts to resize the pseudo terminal's window size.  If successful, the
+   * OS kernel will send @c SIGWINCH to the child process group, otherwise
+   * @c false will be returned and @c errno will be set.
+   * @param columns The desired number of columns.
+   * @param rows The desired number of rows.
+   * @return @c false if there was an error, otherwise @c true.
+   */
+  bool set_size(int columns, int rows);
 
-/** Close a pty
- * @param pty Descriptor for the master side of the PTY pair.
- */
-void _close(int pty);
+  /** Try to let the kernel know that the terminal is or is not UTF-8.
+   * @param utf8 @c true if the terminal is UTF-8.
+   */
+  void set_utf8(bool utf8 = true);
+  
+  /** Gets descriptor for the master side of the PTY pair.
+   * @return Descriptor for the master side of the PTY pair.
+   */
+  int get_pty() const;
+
+  /** Close a pty. This is also called in destructor.
+   */
+  void close();
+private:
+  int m_d;
+};
 
 } // namespace Pty
 
diff --git a/src/libvtemm/ptysize.cc b/src/libvtemm/ptysize.cc
new file mode 100644
index 0000000..da847b2
--- /dev/null
+++ b/src/libvtemm/ptysize.cc
@@ -0,0 +1,61 @@
+/* ptysize.cc
+ *
+ * Copyright (C) 2008, 2009 libvtemm Development Team
+ *
+ * This file is part of libvtemm.
+ *
+ * libvtemm is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * libvtemm is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser Public License
+ * along with libvtemm.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ptysize.h"
+
+namespace Gnome
+{
+
+namespace Vte
+{
+
+namespace Pty
+{
+
+Size::Size(int columns, int rows, bool ok)
+:
+  m_columns(columns),
+  m_rows(rows),
+  m_ok(ok)
+{}
+
+Size::~Size()
+{}
+
+int Size::get_columns() const
+{
+  return m_columns;
+}
+
+int Size::get_rows() const
+{
+  return m_rows;
+}
+
+bool Size::is_ok() const
+{
+  return m_ok;
+}
+
+} // namespace Pty
+
+} // namespace Vte
+
+} // namespace Gnome
diff --git a/src/libvtemm/ptysize.h b/src/libvtemm/ptysize.h
new file mode 100644
index 0000000..ca323f1
--- /dev/null
+++ b/src/libvtemm/ptysize.h
@@ -0,0 +1,71 @@
+/* ptysize.h
+ *
+ * Copyright (C) 2008, 2009 libvtemm Development Team
+ *
+ * This file is part of libvtemm.
+ *
+ * libvtemm is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * libvtemm is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser Public License
+ * along with libvtemm.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _LIBVTEMM_PTY_SIZE_H_
+#define _LIBVTEMM_PTY_SIZE_H_
+
+namespace Gnome
+{
+
+namespace Vte
+{
+
+namespace Pty
+{
+
+/** Size - simple class holding size of a pseudo-terminal.
+ */
+class Size
+{
+public:
+  /** The only way to fill #Gnome::Vte::Pty::Size class.
+   * @param columns Pseudo-terminals number of columns.
+   * @param rows Pseudo-terminals number of rows.
+   */
+  Size(int columns, int rows, bool ok = true);
+  virtual ~Size();
+
+  /** Gets number of columns.
+   * @return Number of columns.
+   */
+  int get_columns() const;
+
+  /** Gets number of rows.
+   * @return Number of rows.
+   */
+  int get_rows() const;
+
+  /** Checks if there was an error during getting size.
+   * @return @c false if something went wrong, otherwise @c true.
+   */
+  bool is_ok() const;
+private:
+  int m_columns;
+  int m_rows;
+  bool m_ok;
+};
+
+} // namespace Pty
+
+} // namespace Vte
+
+} // namespace Gnome
+
+#endif // _LIBVTEMM_PTY_SIZE_H_
diff --git a/src/libvtemm/textandcharattrs.cc b/src/libvtemm/textandcharattrs.cc
index 68fc12f..5bdf8af 100644
--- a/src/libvtemm/textandcharattrs.cc
+++ b/src/libvtemm/textandcharattrs.cc
@@ -26,15 +26,14 @@ namespace Gnome
 namespace Vte
 {
 
-TextAndCharAttrs::TextAndCharAttrs(const Glib::ustring& src_text, const ArrayHandle_CharAttributes& src_attributes)
-: attributes(src_attributes),
-  text(src_text)
-{
-}
+TextAndCharAttrs::TextAndCharAttrs(const Glib::ustring& text, const ArrayHandle_CharAttributes& attributes)
+:
+  m_attributes(attributes),
+  m_text(text)
+{}
 
 TextAndCharAttrs::~TextAndCharAttrs()
-{
-}
+{}
 
 Glib::ustring TextAndCharAttrs::get_text() const
 {
diff --git a/src/libvtemm/textandcharattrs.h b/src/libvtemm/textandcharattrs.h
index f35972d..cbbb5b2 100644
--- a/src/libvtemm/textandcharattrs.h
+++ b/src/libvtemm/textandcharattrs.h
@@ -35,10 +35,10 @@ class TextAndCharAttrs
 {
 public:
 /** The only way to fill #Gnome::Vte::TextAndCharAttrs class.
- * @param src_text String to store.
- * @param src_attributes Array of string's attributes.
+ * @param text String to store.
+ * @param attributes Array of string's attributes.
  */
-  TextAndCharAttrs(const Glib::ustring& src_text, const ArrayHandle_CharAttributes& src_attributes);
+  TextAndCharAttrs(const Glib::ustring& text, const ArrayHandle_CharAttributes& attributes);
   virtual ~TextAndCharAttrs();
 
 /** Gets stored string.
@@ -52,8 +52,8 @@ public:
   ArrayHandle_CharAttributes get_attributes() const;
   // well, setters are not needed.
 private:
-  ArrayHandle_CharAttributes attributes;
-  Glib::ustring text;
+  ArrayHandle_CharAttributes m_attributes;
+  Glib::ustring m_text;
 };
 
 } // namespace Vte
diff --git a/tools/m4/convert_libvtemm.m4 b/tools/m4/convert_libvtemm.m4
index bb6c6e2..392cea6 100644
--- a/tools/m4/convert_libvtemm.m4
+++ b/tools/m4/convert_libvtemm.m4
@@ -1,27 +1,42 @@
 _EQUAL(glong,long)
+_EQUAL(pid_t, Glib::Pid)
+_EQUAL(Glib::Pid, GPid)
 
 _CONV_ENUM(Vte,TerminalEraseBinding)
 _CONV_ENUM(Vte,TerminalAntiAlias)
 _CONV_ENUM(Vte,TerminalCursorBlinkMode)
 _CONV_ENUM(Vte,TerminalCursorShape)
-# eh?
-_CONV_ENUM(Gdk,CursorType)
-
-_CONVERSION(`pid_t', `Glib::Pid', `($3)')
-_CONVERSION(`Glib::Pid', `GPid', `($3)')
-_CONVERSION(`const PangoFontDescription*',`const Pango::FontDescription',`Pango::FontDescription(const_cast<PangoFontDescription*>($3))')
-_CONVERSION(`const Pango::FontDescription&',`const PangoFontDescription*',`($3).gobj()')
-_CONVERSION(`const Glib::ustring',`const char*',`($3).c_str()')
-_CONVERSION(`const char*',`const Glib::ustring',__GCHARP_TO_USTRING)
-_CONVERSION(`const Gdk::Color&',`const GdkColor*',__CFR2P)
-_CONVERSION(`Gtk::MenuShell&', `GtkMenuShell*',`($3).gobj()')
-_CONVERSION(`long&',`glong*',`&($3)')
-_CONVERSION(`Gdk::Cursor&',`GdkCursor*',`($3).gobj_copy()')
-_CONVERSION(`const char*',`const Glib::ustring&',__GCHARP_TO_USTRING)
+## eh?
+## _CONV_ENUM(Gdk,CursorType)
+
+## reminder on __Fx2y
+## __FR2P = (x).gobj()
+## __GCHARP_TO_USTRING = Glib::convert_const_gchar_ptr_to_ustring(x)
+## __CFR2P = const_cast<y>(x.gobj())
+
+
+#glib
+##_CONVERSION(`pid_t', `Glib::Pid', `($3)')
+##_CONVERSION(`Glib::Pid', `GPid', `($3)')
+##_CONVERSION(`const Glib::ustring&',`const char*',`($3).c_str()')
+##_CONVERSION(`const char*',`Glib::ustring',__GCHARP_TO_USTRING)
+##_CONVERSION(`const std::string&', `const char*', `($3).c_str()')
+_CONVERSION(`Glib::RefPtr<Glib::Regex>', `GRegex*', __CONVERT_REFPTR_TO_P)
+
+#pango
+_CONVERSION(`const PangoFontDescription*',`Pango::FontDescription',`Pango::FontDescription(const_cast<PangoFontDescription*>($3))')
+_CONVERSION(`const Pango::FontDescription&',`const PangoFontDescription*',__FR2P)
+
+#gdk
+_CONVERSION(`const Gdk::Color&',`const GdkColor*',__FR2P) ## this should be commented
+_CONVERSION(`Gdk::Cursor&',`GdkCursor*',__FR2P)
+
+#gtk
+_CONVERSION(`Gtk::MenuShell&', `GtkMenuShell*',__FR2P)
 _CONVERSION(`GtkAdjustment*',`Gtk::Adjustment&',`*(Glib::wrap($3))')
-_CONVERSION(`const Terminal&',`VteTerminal*', __FR2P)
-_CONVERSION(`const std::string&', `const char*', `($3).c_str()')
+
+#vte
+_CONVERSION(`const Terminal&',`VteTerminal*', __CFR2P)
 _CONVERSION(`const StdStringArrayHandle&', `char**', `const_cast<char**>(($3).data())')
-_CONVERSION(`guint',`bool',`($3)')
-_CONVERSION(`VteReaper*',`const Glib::RefPtr<Reaper>',`Glib::wrap($3)')
-_CONVERSION(`Glib::RefPtr<Glib::Regex>', `GRegex*', `($3)->gobj()')
+##_CONVERSION(`guint',`bool',`($3)')
+##_CONVERSION(`VteReaper*',`const Glib::RefPtr<Reaper>',`Glib::wrap($3)')



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]