summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.dir-locals.el5
-rw-r--r--COPYING216
-rw-r--r--Makefile.am9
-rw-r--r--NEWS172
-rw-r--r--acinclude.m4345
-rwxr-xr-xautogen.sh31
-rw-r--r--configure.ac (renamed from configure.in)367
-rw-r--r--doc/Makefile.am16
-rw-r--r--doc/boxes.txt68
-rw-r--r--doc/ctlseqs.ms1647
-rw-r--r--doc/reference/Makefile.am10
-rw-r--r--doc/reference/vte-docs.xml17
-rw-r--r--doc/reference/vte-sections.txt130
-rw-r--r--doc/reference/vte.types14
-rw-r--r--doc/rewrap.txt448
-rw-r--r--git.mk177
-rw-r--r--glade/Makefile.am5
-rw-r--r--glade/vte.xml.in.in (renamed from glade/vte.xml.in)3
-rw-r--r--gnome-pty-helper/COPYING217
-rw-r--r--gnome-pty-helper/Makefile.am3
-rw-r--r--gnome-pty-helper/configure.in5
-rw-r--r--perf/Makefile.am8
-rwxr-xr-xperf/img.sh71
-rwxr-xr-xperf/inc.sh2
-rw-r--r--po/LINGUAS4
-rw-r--r--po/POTFILES.in1
-rw-r--r--po/an.po87
-rw-r--r--po/as.po69
-rw-r--r--po/be.po150
-rw-r--r--po/ca.po6
-rw-r--r--po/ca@valencia.po6
-rw-r--r--po/fur.po83
-rw-r--r--po/ga.po51
-rw-r--r--po/pl.po49
-rw-r--r--po/tg.po87
-rw-r--r--po/tr.po56
-rw-r--r--po/uz@cyrillic.po82
-rw-r--r--python/Makefile.am43
-rwxr-xr-xpython/cat.py57
-rw-r--r--python/pyvte.pc.in11
-rwxr-xr-xpython/unrealize.py51
-rwxr-xr-xpython/vte-demo.py98
-rw-r--r--python/vte.defs818
-rw-r--r--python/vte.override657
-rw-r--r--python/vtemodule.c50
-rw-r--r--src/Makefile.am144
-rw-r--r--src/box_drawing.txt768
-rwxr-xr-xsrc/box_drawing_generate.sh70
-rw-r--r--src/buffer.h34
-rw-r--r--src/caps.c88
-rw-r--r--src/caps.h20
-rw-r--r--src/debug.c23
-rw-r--r--src/debug.h32
-rw-r--r--src/dumpkeys.c20
-rwxr-xr-xsrc/genkeysyms.py27
-rw-r--r--src/interpret.c32
-rw-r--r--src/iso2022.c302
-rw-r--r--src/iso2022.h24
-rw-r--r--src/keymap.c514
-rw-r--r--src/keymap.h20
-rw-r--r--src/keysyms.c1254
-rw-r--r--src/matcher.c20
-rw-r--r--src/matcher.h20
-rw-r--r--src/mev.c48
-rwxr-xr-xsrc/osc11
-rw-r--r--src/pty.c497
-rw-r--r--src/pty.h52
-rw-r--r--src/reaper.c226
-rw-r--r--src/reaper.h75
-rw-r--r--src/reflect.c56
-rw-r--r--src/ring.c637
-rw-r--r--src/ring.h35
-rw-r--r--src/slowcat.c22
-rw-r--r--src/table.c65
-rw-r--r--src/table.h20
-rwxr-xr-xsrc/test-vte-sh.sh76
-rw-r--r--src/trie.c20
-rw-r--r--src/trie.h20
-rw-r--r--src/vte-gtk-compat.h80
-rw-r--r--src/vte-private.h167
-rw-r--r--src/vte.c7098
-rw-r--r--src/vte.gresource.xml.in22
-rw-r--r--src/vte.h273
-rw-r--r--src/vte.sh63
-rw-r--r--src/vteaccess.c797
-rw-r--r--src/vteaccess.h61
-rw-r--r--src/vteapp.c572
-rw-r--r--src/vtebg.c529
-rw-r--r--src/vtebg.h70
-rw-r--r--src/vteconv.c64
-rw-r--r--src/vteconv.h20
-rw-r--r--src/vtedeprecated.h105
-rw-r--r--src/vtedraw.c379
-rw-r--r--src/vtedraw.h72
-rw-r--r--src/vteint.h20
-rw-r--r--src/vtepty-private.h28
-rw-r--r--src/vtepty.h30
-rw-r--r--src/vteregex.c119
-rw-r--r--src/vteregex.h38
-rw-r--r--src/vterowdata.c20
-rw-r--r--src/vterowdata.h89
-rw-r--r--src/vteseq-n.gperf44
-rw-r--r--src/vteseq.c1036
-rw-r--r--src/vtestream-base.h45
-rw-r--r--src/vtestream-file.h406
-rw-r--r--src/vtestream.c20
-rw-r--r--src/vtestream.h28
-rw-r--r--src/vtetc.c89
-rw-r--r--src/vtetc.h22
-rw-r--r--src/vtetree.c20
-rw-r--r--src/vtetree.h20
-rw-r--r--src/vtetypebuiltins.c.template2
-rw-r--r--src/vtetypebuiltins.h.template2
-rw-r--r--src/vteunistr.c20
-rw-r--r--src/vteunistr.h20
-rw-r--r--src/vteutils.c75
-rw-r--r--src/vteutils.h30
-rw-r--r--src/vteversion.h.in20
-rw-r--r--src/xticker.c20
-rw-r--r--termcaps/Makefile.am12
-rw-r--r--vte-uninstalled.pc.in13
-rw-r--r--vte.pc.in6
122 files changed, 9888 insertions, 14552 deletions
diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 00000000..4182da82
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,5 @@
+((c-mode . ((c-file-style . "GNU")
+ (indent-tabs-mode . nil)
+ (c-basic-offset . 8)
+ (tab-width . 8)
+ (show-trailing-whitespace . t))))
diff --git a/COPYING b/COPYING
index bf50f20d..4362b491 100644
--- a/COPYING
+++ b/COPYING
@@ -1,112 +1,125 @@
- GNU LIBRARY GENERAL PUBLIC LICENSE
- Version 2, June 1991
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
- Copyright (C) 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
-[This is the first released version of the library GPL. It is
- numbered 2 because it goes with version 2 of the ordinary GPL.]
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
- Preamble
+ Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
- This license, the Library General Public License, applies to some
-specially designated Free Software Foundation software, and to any
-other libraries whose authors decide to use it. You can use it for
-your libraries, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if
-you distribute copies of the library, or if you modify it.
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
-code. If you link a program with the library, you must provide
-complete object files to the recipients so that they can relink them
-with the library, after making changes to the library and recompiling
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
- Our method of protecting your rights has two steps: (1) copyright
-the library, and (2) offer you this license which gives you legal
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
- Also, for each distributor's protection, we want to make certain
-that everyone understands that there is no warranty for this free
-library. If the library is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original
-version, so that any problems introduced by others will not reflect on
-the original authors' reputations.
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that companies distributing free
-software will individually obtain patent licenses, thus in effect
-transforming the program into proprietary software. To prevent this,
-we have made it clear that any patent must be licensed for everyone's
-free use or not licensed at all.
-
- Most GNU software, including some libraries, is covered by the ordinary
-GNU General Public License, which was designed for utility programs. This
-license, the GNU Library General Public License, applies to certain
-designated libraries. This license is quite different from the ordinary
-one; be sure to read it in full, and don't assume that anything in it is
-the same as in the ordinary license.
-
- The reason we have a separate public license for some libraries is that
-they blur the distinction we usually make between modifying or adding to a
-program and simply using it. Linking a program with a library, without
-changing the library, is in some sense simply using the library, and is
-analogous to running a utility program or application program. However, in
-a textual and legal sense, the linked executable is a combined work, a
-derivative of the original library, and the ordinary General Public License
-treats it as such.
-
- Because of this blurred distinction, using the ordinary General
-Public License for libraries did not effectively promote software
-sharing, because most developers did not use the libraries. We
-concluded that weaker conditions might promote sharing better.
-
- However, unrestricted linking of non-free programs would deprive the
-users of those programs of all benefit from the free status of the
-libraries themselves. This Library General Public License is intended to
-permit developers of non-free programs to use free libraries, while
-preserving your freedom as a user of such programs to change the free
-libraries that are incorporated in them. (We have not seen how to achieve
-this as regards changes in header files, but we have achieved it as regards
-changes in the actual functions of the Library.) The hope is that this
-will lead to faster development of free libraries.
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, while the latter only
-works together with the library.
-
- Note that it is possible for a library to be covered by the ordinary
-General Public License rather than by this special one.
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
- GNU LIBRARY GENERAL PUBLIC LICENSE
+ GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
- 0. This License Agreement applies to any software library which
-contains a notice placed by the copyright holder or other authorized
-party saying it may be distributed under the terms of this Library
-General Public License (also called "this License"). Each licensee is
-addressed as "you".
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
@@ -133,7 +146,7 @@ such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
-
+
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
@@ -255,7 +268,7 @@ distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
- 6. As an exception to the Sections above, you may also compile or
+ 6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
@@ -282,23 +295,31 @@ of these things:
Library will not necessarily be able to recompile the application
to use the modified definitions.)
- b) Accompany the work with a written offer, valid for at
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
- c) If distribution of the work is made by offering access to copy
+ d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
- d) Verify that the user has already received a copy of these
+ e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
-the source code distributed need not include anything that is normally
-distributed (in either source or binary form) with the major
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
@@ -347,7 +368,7 @@ Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
+You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
@@ -390,7 +411,7 @@ excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
-versions of the Library General Public License from time to time.
+versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
@@ -411,7 +432,7 @@ decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
- NO WARRANTY
+ NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
@@ -434,7 +455,7 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
- END OF TERMS AND CONDITIONS
+ END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
@@ -453,19 +474,18 @@ convey the exclusion of warranty; and each file should have at least the
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
+ modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
+ version 2.1 of the License, or (at your option) any later version.
This library 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
- Library General Public License for more details.
+ Lesser General Public License for more details.
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307 USA.
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
diff --git a/Makefile.am b/Makefile.am
index 570c8010..42306074 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,11 +1,7 @@
-ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS}
+ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4
SUBDIRS = src termcaps po doc perf
-if HAVE_GTK_2
-SUBDIRS += python
-endif
-
EXTRA_DIST = \
MAINTAINERS \
HACKING \
@@ -23,11 +19,12 @@ SUBDIRS += glade
endif
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = vte$(VTE_PC_VERSION).pc
+pkgconfig_DATA = vte-$(VTE_API_VERSION).pc
DISTCHECK_CONFIGURE_FLAGS = \
--enable-gtk-doc \
--disable-introspection \
+ --disable-vala \
--disable-silent-rules \
--with-gtk=3.0
diff --git a/NEWS b/NEWS
index a25860bb..17601879 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,174 @@
+0.36.0
+======
+* Build fixes (#726604)
+* Docs updates
+
+0.35.90
+=======
+* prompt: Use precmd hook on zsh (#724982)
+* Fix many compiler warnings
+* Remove obsolete gtk+-2.0 conditional code
+* Support OSC 19 and 119 sequences (#725974)
+* Also pass Ctrl-F1 to applications (#726438)
+* Nicer box drawing characters (#709556)
+
+0.35.2
+======
+* Colour palette handling fixes (#640040)
+* Add support for OSC 104 (reset colors) (#640040)
+* Add support for OSC 1?1[017] (fg, bg, highlight colors) (#640040)
+* Add support for OSC 112 (reset cursor color) (#640040)
+* Make OSC response use the same terminator as the query (#722446)
+* Maintain selection when rewrapping (#722635)
+* Fix selection with widget padding adjustment (#722873)
+
+0.35.1
+======
+* Support for 16 million colors (#704449)
+* Fix Home/End and some other keys (#600659, #643233, #710349)
+* Add API to enable/disable rewrap on resize (#336238)
+* Fix a longstanding performance regression (#721944)
+* Bug fixes (#586950, #619891, #672210, #685759, #691972, #720977, #721522)
+
+0.35.0
+======
+* Build fixes
+* Portability fixes (#710165)
+* Rewrap contents upon window resize (#336238)
+* Bug fixes (#4993, #13299, #542087, #686097, #693013, #705985, #709692,
+ #709584, #709930, #710426, #710481, #710483, #710484, #710488, #710486)
+
+Many thanks to Egmont Koblinger who contributed most of these bug fixes!
+
+0.34.9
+======
+* Lines disappear after positioning back the cursor (#708496)
+* Garbage displayed after resizing whilst using an alternate screen (#415277)
+* vte uses too many file descriptors (part of #646098)
+* Incorrect scrollbar position after the "less" command (#676075)
+* Add support for DEC 1007 to set the alternate scroll mode (#518405, #709060)
+* Use O_TMPFILE when available (#704705)
+* Improvements to scrollback storage (#637275)
+* Aborts on assertion (#676075)
+* zsh - lots of blank space upon resizing VTE based terminals (#708213)
+* Misc fixes
+
+0.34.8
+======
+- Build fixes
+- Fix crash on pathological fonts (#708196)
+- Use correct character attributes around graphic characters (part of #707221)
+- Make extended fore/background colour handling more xterm-like (#616436)
+
+0.34.7
+======
+- Honour gtk-enable-primary-paste setting
+- Redraw when changing colours (#702415)
+
+0.34.6
+======
+- vte.sh bugfix
+- Add new flag for vte_terminal_fork_command_full() to not copy the
+ parent environment
+- Allow the empty string to OSC 6 and OSC 7 to unset a previously
+ set value
+
+0.34.5
+======
+- Improved vte.sh script (#697475): It is now not necessary anymore
+ to manually change PS1. On distributions that automatically source
+ /etc/profile.d/*.sh scripts for all interactive shells (ie Fedora),
+ no manual intervention is needed at all; for others the only change
+ required is to source the vte.sh script.
+ Also, the script now works for both bash and zsh shells.
+
+0.34.4
+======
+- Improved vte.sh script (#697225)
+
+0.34.3
+======
+- Introspection fixes (#676999, #690003)
+- Build fixes (#690554)
+- Portability fixes (#694494)
+- Translation updates
+
+0.34.2
+======
+- Translation updates
+
+0.34.1
+======
+* End selection mode misses Shift release (#683730)
+* Don't report shift-left-button release (#683729)
+* xterm extended mouse tracking mode (#681329)
+* Support SGR 3 (italic text) (#685223)
+
+0.34.0
+======
+* Support escape sequences to set the current directory (#675987)
+* Fixed drawing of Box Drawing and Block Elements characters (#682692)
+* Introspection fixes (#679805, #681714)
+* Build fixes
+
+0.32.2
+======
+- emulation: Fix DoS by malicious escape sequences (#676090)
+- widget: Fix crash with NULL tag in match_check (#676886)
+- keymap: Treat ALT as META (#663779)
+
+0.32.1
+======
+- pty: Fix custom child setup function (#672649)
+- leak fix in vte_draw_set_text_font() (#672757)
+- emulation: Fix off-by-one error in interpretation of ECH (#670037)
+
+0.32.0
+======
+- Use GResource for our default termcap
+- build fixes for interix (#652290)
+- Allocate PTYs with openpty on BSD (#670758)
+- Introspection fixes (#648183, #655402, #661716)
+- Fix mouse whell scrolling with gtk+ 3.4 (#671305)
+- Use correct library name for glade integration (#671760)
+- gnome-pty-helper: Respect SUID_CFLAGS and SUID_LDFLAGS (#670732)
+
+0.31.0
+======
+- Don't override the widget background colour
+- Add missing (closure) annotation on VteSelectionFunc (#655405, Evan Nemerson)
+- use gtk_drag_check_threshold() (#654691, Dan Winship)
+- Add urxvt extended mouse tracking mode support (#662423, Egmont Koblinger)
+- Add runtime check for X11 display (#660151, Young-Ho Cha)
+- Build fixes (#661121, #616001)
+- Translation updates
+
+0.30.1
+======
+- Translation updates
+
+0.30.0
+======
+- Translation updates
+
+0.29.1
+======
+- Bugs fixed:
+ - Bug 657581 - gdk-3.0 supports multiple targets; the "target" variable is gone
+ - Bug 657584 - vte needs to properly set VTE_API_VERSION
+
+0.29.0
+======
+- Drop GTK 2 support
+- Fix accessibility with GTK 3.1 (#654630)
+- Translation updates
+
+0.28.1
+======
+- Bugs fixed:
+ * Bug 652124 - malicious escape sequence causes gnome-terminal to exhaust memory
+- Translation updates
+
0.28.0
======
- Bugs fixed:
@@ -1054,4 +1225,3 @@ prehistory
Local Variables:
coding: utf-8
End:
-vim: encoding=utf-8:
diff --git a/acinclude.m4 b/acinclude.m4
index 1a95c35f..4701476a 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1,32 +1,317 @@
-dnl From msw.
+dnl Macros to check the presence of generic (non-typed) symbols.
+dnl Copyright (c) 2006-2008 Diego Pettenò <flameeyes@gmail.com>
+dnl Copyright (c) 2006-2008 xine project
dnl
-dnl a macro to check for ability to create python extensions
-dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
-dnl function also defines PYTHON_INCLUDES
-AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
-[AC_REQUIRE([AM_PATH_PYTHON])
-AC_MSG_CHECKING(for headers required to compile python extensions)
-dnl deduce PYTHON_INCLUDES
-py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
-py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
-if test -x "$PYTHON-config"; then
- PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null`
-else
- PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
- if test "$py_prefix" != "$py_exec_prefix"; then
- PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
- fi
-fi
-PYTHON_LIBS="-L${py_prefix}/libs -lpython${PYTHON_VERSION}"
-AC_SUBST(PYTHON_INCLUDES)
-AC_SUBST(PYTHON_LIBS)
-dnl check if the headers exist:
-save_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
-AC_TRY_CPP([#include <Python.h>],dnl
-[AC_MSG_RESULT(found)
-$1],dnl
-[AC_MSG_RESULT(not found)
-$2])
-CPPFLAGS="$save_CPPFLAGS"
+dnl This program is free software: you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation, either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
+dnl
+dnl As a special exception, the copyright owners of the
+dnl macro gives unlimited permission to copy, distribute and modify the
+dnl configure scripts that are the output of Autoconf when processing the
+dnl Macro. You need not follow the terms of the GNU General Public
+dnl License when using or distributing such scripts, even though portions
+dnl of the text of the Macro appear in them. The GNU General Public
+dnl License (GPL) does govern all other use of the material that
+dnl constitutes the Autoconf Macro.
+dnl
+dnl This special exception to the GPL applies to versions of the
+dnl Autoconf Macro released by this project. When you make and
+dnl distribute a modified version of the Autoconf Macro, you may extend
+dnl this special exception to the GPL to apply to your modified version as
+dnl well.
+
+dnl Check if the flag is supported by compiler
+dnl CC_CHECK_CFLAGS_SILENT([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
+
+AC_DEFUN([CC_CHECK_CFLAGS_SILENT], [
+ AC_CACHE_VAL(AS_TR_SH([cc_cv_cflags_$1]),
+ [ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $1"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([int a;])],
+ [eval "AS_TR_SH([cc_cv_cflags_$1])='yes'"],
+ [eval "AS_TR_SH([cc_cv_cflags_$1])='no'"])
+ CFLAGS="$ac_save_CFLAGS"
+ ])
+
+ AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
+ [$2], [$3])
+])
+
+dnl Check if the flag is supported by compiler (cacheable)
+dnl CC_CHECK_CFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
+
+AC_DEFUN([CC_CHECK_CFLAGS], [
+ AC_CACHE_CHECK([if $CC supports $1 flag],
+ AS_TR_SH([cc_cv_cflags_$1]),
+ CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here!
+ )
+
+ AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
+ [$2], [$3])
+])
+
+dnl CC_CHECK_CFLAG_APPEND(FLAG, [action-if-found], [action-if-not-found])
+dnl Check for CFLAG and appends them to CFLAGS if supported
+AC_DEFUN([CC_CHECK_CFLAG_APPEND], [
+ AC_CACHE_CHECK([if $CC supports $1 flag],
+ AS_TR_SH([cc_cv_cflags_$1]),
+ CC_CHECK_CFLAGS_SILENT([$1]) dnl Don't execute actions here!
+ )
+
+ AS_IF([eval test x$]AS_TR_SH([cc_cv_cflags_$1])[ = xyes],
+ [CFLAGS="$CFLAGS $1"; DEBUG_CFLAGS="$DEBUG_CFLAGS $1"; $2], [$3])
+])
+
+dnl CC_CHECK_CFLAGS_APPEND([FLAG1 FLAG2], [action-if-found], [action-if-not])
+AC_DEFUN([CC_CHECK_CFLAGS_APPEND], [
+ for flag in $1; do
+ CC_CHECK_CFLAG_APPEND($flag, [$2], [$3])
+ done
+])
+
+dnl Check if the flag is supported by linker (cacheable)
+dnl CC_CHECK_LDFLAGS([FLAG], [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
+
+AC_DEFUN([CC_CHECK_LDFLAGS], [
+ AC_CACHE_CHECK([if $CC supports $1 flag],
+ AS_TR_SH([cc_cv_ldflags_$1]),
+ [ac_save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $1"
+ AC_LANG_PUSH([C])
+ AC_LINK_IFELSE([AC_LANG_SOURCE([int main() { return 1; }])],
+ [eval "AS_TR_SH([cc_cv_ldflags_$1])='yes'"],
+ [eval "AS_TR_SH([cc_cv_ldflags_$1])="])
+ AC_LANG_POP([C])
+ LDFLAGS="$ac_save_LDFLAGS"
+ ])
+
+ AS_IF([eval test x$]AS_TR_SH([cc_cv_ldflags_$1])[ = xyes],
+ [$2], [$3])
+])
+
+dnl define the LDFLAGS_NOUNDEFINED variable with the correct value for
+dnl the current linker to avoid undefined references in a shared object.
+AC_DEFUN([CC_NOUNDEFINED], [
+ dnl We check $host for which systems to enable this for.
+ AC_REQUIRE([AC_CANONICAL_HOST])
+
+ case $host in
+ dnl FreeBSD (et al.) does not complete linking for shared objects when pthreads
+ dnl are requested, as different implementations are present; to avoid problems
+ dnl use -Wl,-z,defs only for those platform not behaving this way.
+ *-freebsd* | *-openbsd*) ;;
+ *)
+ dnl First of all check for the --no-undefined variant of GNU ld. This allows
+ dnl for a much more readable commandline, so that people can understand what
+ dnl it does without going to look for what the heck -z defs does.
+ for possible_flags in "-Wl,--no-undefined" "-Wl,-z,defs"; do
+ CC_CHECK_LDFLAGS([$possible_flags], [LDFLAGS_NOUNDEFINED="$possible_flags"])
+ break
+ done
+ ;;
+ esac
+
+ AC_SUBST([LDFLAGS_NOUNDEFINED])
+])
+
+dnl Check for a -Werror flag or equivalent. -Werror is the GCC
+dnl and ICC flag that tells the compiler to treat all the warnings
+dnl as fatal. We usually need this option to make sure that some
+dnl constructs (like attributes) are not simply ignored.
+dnl
+dnl Other compilers don't support -Werror per se, but they support
+dnl an equivalent flag:
+dnl - Sun Studio compiler supports -errwarn=%all
+AC_DEFUN([CC_CHECK_WERROR], [
+ AC_CACHE_CHECK(
+ [for $CC way to treat warnings as errors],
+ [cc_cv_werror],
+ [CC_CHECK_CFLAGS_SILENT([-Werror], [cc_cv_werror=-Werror],
+ [CC_CHECK_CFLAGS_SILENT([-errwarn=%all], [cc_cv_werror=-errwarn=%all])])
+ ])
+])
+
+AC_DEFUN([CC_CHECK_ATTRIBUTE], [
+ AC_REQUIRE([CC_CHECK_WERROR])
+ AC_CACHE_CHECK([if $CC supports __attribute__(( ifelse([$2], , [$1], [$2]) ))],
+ AS_TR_SH([cc_cv_attribute_$1]),
+ [ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $cc_cv_werror"
+ AC_LANG_PUSH([C])
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([$3])],
+ [eval "AS_TR_SH([cc_cv_attribute_$1])='yes'"],
+ [eval "AS_TR_SH([cc_cv_attribute_$1])='no'"])
+ AC_LANG_POP([C])
+ CFLAGS="$ac_save_CFLAGS"
+ ])
+
+ AS_IF([eval test x$]AS_TR_SH([cc_cv_attribute_$1])[ = xyes],
+ [AC_DEFINE(
+ AS_TR_CPP([SUPPORT_ATTRIBUTE_$1]), 1,
+ [Define this if the compiler supports __attribute__(( ifelse([$2], , [$1], [$2]) ))]
+ )
+ $4],
+ [$5])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_CONSTRUCTOR], [
+ CC_CHECK_ATTRIBUTE(
+ [constructor],,
+ [void __attribute__((constructor)) ctor() { int a; }],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_FORMAT], [
+ CC_CHECK_ATTRIBUTE(
+ [format], [format(printf, n, n)],
+ [void __attribute__((format(printf, 1, 2))) printflike(const char *fmt, ...) { fmt = (void *)0; }],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_FORMAT_ARG], [
+ CC_CHECK_ATTRIBUTE(
+ [format_arg], [format_arg(printf)],
+ [char *__attribute__((format_arg(1))) gettextlike(const char *fmt) { fmt = (void *)0; }],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_VISIBILITY], [
+ CC_CHECK_ATTRIBUTE(
+ [visibility_$1], [visibility("$1")],
+ [void __attribute__((visibility("$1"))) $1_function() { }],
+ [$2], [$3])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_NONNULL], [
+ CC_CHECK_ATTRIBUTE(
+ [nonnull], [nonnull()],
+ [void __attribute__((nonnull())) some_function(void *foo, void *bar) { foo = (void*)0; bar = (void*)0; }],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_UNUSED], [
+ CC_CHECK_ATTRIBUTE(
+ [unused], ,
+ [void some_function(void *foo, __attribute__((unused)) void *bar);],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_SENTINEL], [
+ CC_CHECK_ATTRIBUTE(
+ [sentinel], ,
+ [void some_function(void *foo, ...) __attribute__((sentinel));],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_DEPRECATED], [
+ CC_CHECK_ATTRIBUTE(
+ [deprecated], ,
+ [void some_function(void *foo, ...) __attribute__((deprecated));],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_ALIAS], [
+ CC_CHECK_ATTRIBUTE(
+ [alias], [weak, alias],
+ [void other_function(void *foo) { }
+ void some_function(void *foo) __attribute__((weak, alias("other_function")));],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_MALLOC], [
+ CC_CHECK_ATTRIBUTE(
+ [malloc], ,
+ [void * __attribute__((malloc)) my_alloc(int n);],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_PACKED], [
+ CC_CHECK_ATTRIBUTE(
+ [packed], ,
+ [struct astructure { char a; int b; long c; void *d; } __attribute__((packed));],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_CONST], [
+ CC_CHECK_ATTRIBUTE(
+ [const], ,
+ [int __attribute__((const)) twopow(int n) { return 1 << n; } ],
+ [$1], [$2])
+])
+
+AC_DEFUN([CC_FLAG_VISIBILITY], [
+ AC_REQUIRE([CC_CHECK_WERROR])
+ AC_CACHE_CHECK([if $CC supports -fvisibility=hidden],
+ [cc_cv_flag_visibility],
+ [cc_flag_visibility_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $cc_cv_werror"
+ CC_CHECK_CFLAGS_SILENT([-fvisibility=hidden],
+ cc_cv_flag_visibility='yes',
+ cc_cv_flag_visibility='no')
+ CFLAGS="$cc_flag_visibility_save_CFLAGS"])
+
+ AS_IF([test "x$cc_cv_flag_visibility" = "xyes"],
+ [AC_DEFINE([SUPPORT_FLAG_VISIBILITY], 1,
+ [Define this if the compiler supports the -fvisibility flag])
+ $1],
+ [$2])
+])
+
+AC_DEFUN([CC_FUNC_EXPECT], [
+ AC_REQUIRE([CC_CHECK_WERROR])
+ AC_CACHE_CHECK([if compiler has __builtin_expect function],
+ [cc_cv_func_expect],
+ [ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $cc_cv_werror"
+ AC_LANG_PUSH([C])
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [int some_function() {
+ int a = 3;
+ return (int)__builtin_expect(a, 3);
+ }])],
+ [cc_cv_func_expect=yes],
+ [cc_cv_func_expect=no])
+ AC_LANG_POP([C])
+ CFLAGS="$ac_save_CFLAGS"
+ ])
+
+ AS_IF([test "x$cc_cv_func_expect" = "xyes"],
+ [AC_DEFINE([SUPPORT__BUILTIN_EXPECT], 1,
+ [Define this if the compiler supports __builtin_expect() function])
+ $1],
+ [$2])
+])
+
+AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [
+ AC_REQUIRE([CC_CHECK_WERROR])
+ AC_CACHE_CHECK([highest __attribute__ ((aligned ())) supported],
+ [cc_cv_attribute_aligned],
+ [ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $cc_cv_werror"
+ AC_LANG_PUSH([C])
+ for cc_attribute_align_try in 64 32 16 8 4 2; do
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+ int main() {
+ static char c __attribute__ ((aligned($cc_attribute_align_try))) = 0;
+ return c;
+ }])], [cc_cv_attribute_aligned=$cc_attribute_align_try; break])
+ done
+ AC_LANG_POP([C])
+ CFLAGS="$ac_save_CFLAGS"
+ ])
+
+ if test "x$cc_cv_attribute_aligned" != "x"; then
+ AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX], [$cc_cv_attribute_aligned],
+ [Define the highest alignment supported])
+ fi
])
diff --git a/autogen.sh b/autogen.sh
index e1cc1329..1e312d0f 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,29 +1,16 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
+set -e
+
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
-PKG_NAME="vte"
-
-(test -f $srcdir/configure.in \
- && test -f $srcdir/README \
- && test -d $srcdir/src) || {
- echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
- echo " top-level $PKG_NAME directory"
- exit 1
-}
-
-echo "checking for GNU gperf"
-which gperf || {
- echo "You need to install GNU gperf"
- exit 1
-}
-
-echo "checking for gnome-autogen.sh"
-which gnome-autogen.sh || {
- echo "You need to install the gnome-common package"
- exit 1
-}
+cd "$srcdir"
+mkdir -p m4 >/dev/null 2>&1 || true
+gtkdocize --copy --flavour no-tmpl
+autoreconf --verbose --force --install
+intltoolize --force
+cd -
-. gnome-autogen.sh
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/configure.in b/configure.ac
index b19faf9f..87b0c97b 100644
--- a/configure.in
+++ b/configure.ac
@@ -1,20 +1,19 @@
m4_define([version_major],0)
-m4_define([version_minor],29)
+m4_define([version_minor],37)
m4_define([version_micro],0)
m4_define([version_triplet],version_major.version_minor.version_micro)
-m4_define([so_major_adjust],9) dnl Don't change!
-
AC_PREREQ([2.63])
AC_INIT([vte],
[version_triplet],
[http://bugzilla.gnome.org/enter_bug.cgi?product=vte],
[vte])
+AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/vte.c])
AC_CONFIG_HEADERS([config.h])
-AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-bzip2])
+AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-bzip2 -Wno-portability])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
@@ -28,7 +27,7 @@ AM_MAINTAINER_MODE([enable])
################################################################################
m4_define([lt_revision], m4_if(m4_eval(version_minor%2),1,0,version_micro))
m4_define([lt_age], m4_eval(version_minor*100+version_micro-lt_revision))
-m4_define([lt_current], m4_eval(so_major_adjust+version_major+lt_age))
+m4_define([lt_current], m4_eval(version_major+lt_age))
m4_define([lt_triplet],lt_current:lt_revision:lt_age)
LT_VERSION_INFO="lt_triplet()"
@@ -38,50 +37,18 @@ AC_SUBST([LT_VERSION_INFO])
# GTK+
################################################################################
-AC_MSG_CHECKING([which gtk+ version to compile against])
-AC_ARG_WITH([gtk],
- [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against (default: 2.0)])],
- [case "$with_gtk" in
- 2.0|3.0) ;;
- *) AC_MSG_ERROR([invalid gtk version specified]) ;;
- esac],
- [with_gtk=2.0])
-AC_MSG_RESULT([$with_gtk])
-
-case "$with_gtk" in
- 2.0) VTE_API_VERSION=0.0
- VTE_API_MAJOR_VERSION=0
- VTE_API_MINOR_VERSION=0
- VTE_PC_VERSION=
- VTE_LIBRARY_SUFFIX=
- VTE_SEAL_CFLAGS=
- GTK_API_VERSION=2.0
- GTK_REQUIRED=2.20.0
- GLADE_API_VERSION=1.0
- ;;
- 3.0) VTE_API_VERSION=2.90
- VTE_API_MAJOR_VERSION=2
- VTE_API_MINOR_VERSION=90
- VTE_PC_VERSION=-$VTE_API_VERSION
- VTE_LIBRARY_SUFFIX=$VTE_API_VERSION
- VTE_SEAL_CFLAGS="-DVTE_SEAL_ENABLE"
- GTK_API_VERSION=3.0
- GTK_REQUIRED=3.0.0
- GLADE_API_VERSION=2.0
- ;;
-esac
+VTE_API_MAJOR_VERSION=2
+VTE_API_MINOR_VERSION=91
+VTE_API_VERSION=$VTE_API_MAJOR_VERSION.$VTE_API_MINOR_VERSION
+GTK_API_VERSION=3.0
+GTK_REQUIRED=3.8.0
+GLADE_API_VERSION=2.0
AC_SUBST([VTE_API_VERSION])
AC_SUBST([VTE_API_VERSION_U],[AS_TR_SH([$VTE_API_VERSION])])
AC_SUBST([VTE_API_MAJOR_VERSION])
AC_SUBST([VTE_API_MINOR_VERSION])
-AC_SUBST([VTE_PC_VERSION])
-AC_SUBST([VTE_SEAL_CFLAGS])
AC_SUBST([GTK_API_VERSION])
-AC_SUBST([VTE_LIBRARY_SUFFIX_U],[AS_TR_SH([$VTE_LIBRARY_SUFFIX])])
-
-AM_CONDITIONAL([HAVE_GTK_2],[test "$with_gtk" = "2.0"])
-AM_CONDITIONAL([HAVE_GTK_3],[test "$with_gtk" = "3.0"])
################################################################################
@@ -95,6 +62,18 @@ AC_PROG_SED
LT_PREREQ([2.2])
LT_INIT
+################################################################################
+# Enable debugging messages and additional run-time checks.
+################################################################################
+
+AC_ARG_ENABLE([debug],
+ [AS_HELP_STRING([--enable-debug],
+ [enable extra debugging checks and logging messages])],
+ [],[enable_debug=no])
+if test "x$enable_debug" = "xyes" ; then
+ AC_MSG_RESULT([enabling debug checks and messages])
+ AC_DEFINE(VTE_DEBUG,1,[Enable debugging messages.])
+fi
################################################################################
# i18n
@@ -109,7 +88,6 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",
AM_GLIB_GNU_GETTEXT
AC_CHECK_DECLS(bind_textdomain_codeset,,,[#include "libintl.h"])
-
################################################################################
# Platform checks
################################################################################
@@ -146,111 +124,22 @@ AC_SUBST([LIBTOOL_EXPORT_OPTIONS])
LIBTOOL_FLAGS='-as-needed'
AC_SUBST([LIBTOOL_FLAGS])
-
################################################################################
# Compilation
################################################################################
-dnl Use lots of warning flags with with gcc and compatible compilers
-dnl Copied from cairo
-AC_DEFUN([VTE_CC_TRY_FLAG], [
- AC_MSG_CHECKING([whether $CC supports $1])
-
- vte_save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $1"
-
- AC_COMPILE_IFELSE([ ], [vte_cc_flag=yes], [vte_cc_flag=no])
- CFLAGS="$vte_save_CFLAGS"
-
- if test "x$vte_cc_flag" = "xyes"; then
- ifelse([$2], , :, [$2])
- else
- ifelse([$3], , :, [$3])
- fi
- AC_MSG_RESULT([$vte_cc_flag])
-])
-AC_DEFUN([VTE_LD_TRY_FLAG], [
- AC_MSG_CHECKING([whether $CC supports $1 when linking])
-
- vte_save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS $1"
-
- AC_LINK_IFELSE([int main(void) {return 0;}],
- [vte_ld_flag=yes], [vte_ld_flag=no])
- LDFLAGS="$vte_save_LDFLAGS"
-
- if test "x$vte_ld_flag" = "xyes"; then
- ifelse([$2], , :, [$2])
- else
- ifelse([$3], , :, [$3])
- fi
- AC_MSG_RESULT([$vte_ld_flag])
-])
-
-
-dnl Note: if you change the following variable, the cache is automatically
-dnl skipped and all flags rechecked. So there's no need to do anything
-dnl else. If for any reason you need to force a recheck, just change
-dnl MAYBE_WARN in an ignorable way (like adding whitespace)
-
-MAYBE_WARN="-Wall -Wextra \
--Wsign-compare -Werror-implicit-function-declaration \
--Wpointer-arith -Wwrite-strings -Wstrict-prototypes \
--Waggregate-return -Wcast-align -Wimplicit -Wuninitialised \
--Wmissing-prototypes -Wmissing-declarations -Wnested-externs \
--Wpacked -Wmissing-format-attribute -Wshadow \
--Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
--Wdeclaration-after-statement -Wold-style-definition \
--Wno-missing-field-initializers -Wno-unused-parameter \
--fno-common -Wno-switch-enum"
-
-# invalidate cached value if MAYBE_WARN has changed
-if test "x$vte_cv_warn_maybe" != "x$MAYBE_WARN"; then
- unset vte_cv_warn_cflags
-fi
-AC_CACHE_CHECK([for supported warning flags], vte_cv_warn_cflags, [
- echo
- WARN_CFLAGS=""
-
- # Some warning options are not supported by all versions of
- # gcc, so test all desired options against the current
- # compiler.
- #
- # Note that there are some order dependencies
- # here. Specifically, an option that disables a warning will
- # have no net effect if a later option then enables that
- # warnings, (perhaps implicitly). So we put some grouped
- # options (-Wall and -Wextra) up front and the -Wno options
- # last.
-
- for W in $MAYBE_WARN; do
- VTE_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"])
- done
-
- vte_cv_warn_cflags=$WARN_CFLAGS
- vte_cv_warn_maybe=$MAYBE_WARN
-
- AC_MSG_CHECKING([which warning flags were supported])])
-WARN_CFLAGS=$vte_cv_warn_cflags
-AC_SUBST(WARN_CFLAGS)
-CFLAGS="$CFLAGS $WARN_CFLAGS"
-
-PYTHON_LDFLAGS=""
-for W in "-Wl,--warn-unresolved-symbols"; do
- VTE_LD_TRY_FLAG([$W], [PYTHON_LDFLAGS="$PYTHON_LDFLAGS $W"])
-done
-AC_SUBST(PYTHON_LDFLAGS)
-
-# Enable debugging messages and additional run-time checks.
-AC_ARG_ENABLE(debug,
- [AS_HELP_STRING([--enable-debug],
- [enable extra debugging checks and logging messages]
- )],
- DEBUG=$enableval, DEBUG=no)
-if test "x$DEBUG" != "xno" ; then
- AC_MSG_RESULT([enabling debug checks and messages])
- AC_DEFINE(VTE_DEBUG,1,[Enable debugging messages.])
-fi
+CC_CHECK_CFLAGS_APPEND([ \
+ -Wall -Wextra \
+ -Wformat-nonliteral -Werror=format-security \
+ -Wsign-compare -Werror=implicit-function-declaration \
+ -Wpointer-arith -Wwrite-strings -Wstrict-prototypes \
+ -Waggregate-return -Wcast-align -Wimplicit -Wuninitialized \
+ -Wmissing-prototypes -Wmissing-declarations -Wnested-externs \
+ -Wpacked -Wmissing-format-attribute -Wshadow \
+ -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
+ -Wdeclaration-after-statement -Wold-style-definition \
+ -Wno-missing-field-initializers -Wno-unused-parameter \
+ -fno-common -Wno-switch-enum])
##########################################################
# Check for -Bsymbolic-functions linker flag used to avoid
@@ -264,9 +153,8 @@ AC_ARG_ENABLE([Bsymbolic],
VTE_LDFLAGS=
if test "$enable_Bsymbolic" != "no"; then
- FLAG="-Wl,-Bsymbolic-functions"
- VTE_LD_TRY_FLAG([$FLAG],
- [VTE_LDFLAGS="$VTE_LDFLAGS $FLAG"],
+ CC_CHECK_LDFLAGS(["-Wl,-Bsymbolic-functions"],
+ [VTE_LDFLAGS="$VTE_LDFLAGS -Wl,-Bsymbolic-functions"],
[if test "$enable_Bsymbolic" = "auto"; then
AC_MSG_WARN([-Bsymbolic not supported by ld; disabling])
enable_Bsymbolic=no
@@ -278,32 +166,6 @@ fi
AC_SUBST([VTE_LDFLAGS])
################################################################################
-
-# Disable deprecations and single includes
-# We don't use GNOME_MAINTAINER_MODE_DEFINES here since it's too much and
-# it also defines VTE's own defines.
-dnl AC_ARG_ENABLE([deprecation],
-dnl [AS_HELP_STRING([--disable-deprecation],
-dnl [prohibit VTE from using deprecated GLib/Pango/ATK/GDK/GTK+ features])],
-dnl [],[enable_deprecation=$enable_maintainer_mode])
-dnl if test "x$enable_deprecation" = xyes; then
-dnl AC_MSG_NOTICE([disabling deprecated GLIB/PANGO/GDK/ATK/GTK+ features])
-dnl
-dnl AC_DEFINE([ATK_DISABLE_DEPRECATED],[1],[Disable deprecated features])
-dnl AC_DEFINE([ATK_DISABLE_SINGLE_INCLUDES],[1],[Disable single includes])
-dnl AC_DEFINE([G_DISABLE_DEPRECATED],[1],[Disable deprecated features])
-dnl AC_DEFINE([G_DISABLE_SINGLE_INCLUDES],[1],[Disable single includes])
-dnl AC_DEFINE([GDK_DISABLE_DEPRECATED],[1],[Disable deprecated features])
-dnl AC_DEFINE([GDK_DISABLE_SINGLE_INCLUDES],[1],[Disable single includes])
-dnl AC_DEFINE([GDK_PIXBUF_DISABLE_DEPRECATED],[1],[Disable deprecated features])
-dnl AC_DEFINE([GDK_PIXBUF_DISABLE_SINGLE_INCLUDES],[1],[Disable single includes])
-dnl AC_DEFINE([GTK_DISABLE_DEPRECATED],[1],[Disable deprecated features])
-dnl AC_DEFINE([GTK_DISABLE_SINGLE_INCLUDES],[1],[Disable single includes])
-dnl AC_DEFINE([PANGO_DISABLE_DEPRECATED],[1],[Disable deprecated features])
-dnl AC_DEFINE([PANGO_DISABLE_SINGLE_INCLUDES],[1],[Disable single includes])
-dnl fi
-
-################################################################################
# Core
################################################################################
@@ -326,36 +188,41 @@ case $host in
;;
esac
-GLIB_REQUIRED=2.26.0
+GLIB_REQUIRED=2.31.13
+GIO_REQUIRED=2.31.13
PANGO_REQUIRED=1.22.0
-AC_DEFINE(GDK_MULTIHEAD_SAFE,1,[Force use of GDK's multihead-safe APIs.])
-PKG_CHECK_MODULES(GLIB,[glib-2.0 >= $GLIB_REQUIRED gobject-2.0])
-PKG_CHECK_MODULES(GTK,[glib-2.0 >= $GLIB_REQUIRED gobject-2.0 gtk+-$GTK_API_VERSION >= $GTK_REQUIRED])
+AC_DEFINE(GDK_MULTIHEAD_SAFE,1,[Force use of GDK multihead-safe APIs.])
+PKG_CHECK_MODULES(GLIB,[glib-2.0 >= $GLIB_REQUIRED gobject-2.0 gio-2.0 >= $GIO_REQUIRED])
+PKG_CHECK_MODULES(GTK,[glib-2.0 >= $GLIB_REQUIRED gobject-2.0 gio-2.0 >= $GIO_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED])
AC_PATH_PROG([GLIB_GENMARSHAL],[glib-genmarshal])
AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums])
-# Let the user specify the default terminal emulation.
-AC_ARG_WITH(default-emulation,
-AS_HELP_STRING(--with-default-emulation=xterm,default terminal type to be emulated),
-emulation=$withval,emulation=xterm)
-AC_DEFINE_UNQUOTED(VTE_DEFAULT_EMULATION,"$emulation",[The default terminal type to be emulated.])
-VTE_DEFAULT_EMULATION=$emulation
-AC_SUBST(VTE_DEFAULT_EMULATION)
-AM_CONDITIONAL(VTE_DEFAULT_EMULATION, [test "$emulation" != xterm])
+AC_ARG_VAR([GLIB_COMPILE_RESOURCES],[the glib-compile-resources programme])
+AC_PATH_PROG([GLIB_COMPILE_RESOURCES],[glib-compile-resources],[])
+if test -z "$GLIB_COMPILE_RESOURCES"; then
+ AC_MSG_ERROR([glib-compile-resources not found])
+fi
+
+VTE_DEFAULT_EMULATION=xterm
+AC_DEFINE_UNQUOTED(VTE_DEFAULT_EMULATION,"$VTE_DEFAULT_EMULATION",[The default terminal type to be emulated.])
# Check for headers.
-AC_CHECK_HEADERS(sys/select.h sys/syslimits.h sys/termios.h sys/un.h sys/wait.h stropts.h termios.h wchar.h)
+AC_CHECK_HEADERS(sys/select.h sys/syslimits.h sys/termios.h sys/un.h sys/wait.h stropts.h termios.h util.h wchar.h)
AC_HEADER_TIOCGWINSZ
# Check for PTY handling functions.
-AC_CHECK_FUNCS([cfmakeraw fork setsid setpgid getpgid getpt grantpt unlockpt ptsname ptsname_r tcgetattr tcsetattr])
+AC_CHECK_FUNCS([cfmakeraw fork setsid setpgid getpgid getpt grantpt unlockpt posix_openpt ptsname ptsname_r tcgetattr tcsetattr])
+
+# Misc I/O routines.
+AC_CHECK_FUNCS([pread pwrite fwrite_unlocked])
# Pull in the right libraries for various functions which might not be
# bundled into an exploded libc.
AC_CHECK_FUNC(socket,[have_socket=1],AC_CHECK_LIB(socket,socket,[have_socket=1; LIBS="$LIBS -lsocket"]))
AC_CHECK_FUNC(socketpair,[have_socketpair=1],AC_CHECK_LIB(socket,socketpair,[have_socketpair=1; LIBS="$LIBS -lsocket"]))
AC_CHECK_FUNC(recvmsg,[have_recvmsg=1],AC_CHECK_LIB(socket,recvmsg,[have_recvmsg=1; LIBS="$LIBS -lsocket -lnsl"]))
+AC_CHECK_FUNC(openpty,[have_openpty=1],AC_CHECK_LIB(util,openpty,[have_openpty=1; LIBS="$LIBS -lutil"]))
if test x$have_socket = x1 ; then
AC_DEFINE(HAVE_SOCKET,1,[Define if you have the socket function.])
fi
@@ -365,8 +232,11 @@ fi
if test x$have_recvmsg = x1 ; then
AC_DEFINE(HAVE_RECVMSG,1,[Define if you have the recvmsg function.])
fi
+if test x$have_openpty = x1 ; then
+ AC_DEFINE(HAVE_OPENPTY,1,[Define if you have the openpty function.])
+fi
AC_CHECK_FUNC(floor,,AC_CHECK_LIB(m,floor,LIBS=["$LIBS -lm"]))
-AC_CHECK_FUNCS([ceil floor])
+AC_CHECK_FUNCS([ceil floor round])
# Look for tgetent
@@ -410,16 +280,7 @@ esac
# Search for the required modules.
-# We have a direct dependency on X11 on gdk-x11, see bug #613525
-AC_MSG_CHECKING([for GDK target])
-GDK_TARGET="$($PKG_CONFIG --variable target gdk-$GTK_API_VERSION)"
-AC_MSG_RESULT([$GDK_TARGET])
-case "$GDK_TARGET" in
- x11) PLATFORM_PKGS="x11 cairo-xlib" ;;
- *) PLATFORM_PKGS="" ;;
-esac
-
-VTE_PKGS="glib-2.0 >= $GLIB_REQUIRED gobject-2.0 pango >= $PANGO_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gobject-2.0 gio-2.0 gio-unix-2.0 $PLATFORM_PKGS"
+VTE_PKGS="glib-2.0 >= $GLIB_REQUIRED gobject-2.0 pango >= $PANGO_REQUIRED gtk+-$GTK_API_VERSION >= $GTK_REQUIRED gobject-2.0 gio-2.0 gio-unix-2.0"
PKG_CHECK_MODULES([VTE],[$VTE_PKGS])
AC_SUBST([VTE_PKGS])
@@ -441,85 +302,6 @@ wcs_funcs_includes="
AC_CHECK_TYPES(wint_t, AC_DEFINE(HAVE_WINT_T, , [Defined when the wint_t type is supported]), ,$wcs_funcs_includes)
-
-################################################################################
-# Auxillary modules
-################################################################################
-
-if test "$with_gtk" = "2.0"; then
-
-# Search for Python.
-BUILD_PYTHON=true
-AC_ARG_ENABLE(python, [AS_HELP_STRING(--enable-python,Build python bindings [default=yes])],[
-if test x"$enableval" != xno ; then
- BUILD_PYTHON=true
-else
- BUILD_PYTHON=false
-fi],BUILD_PYTHON=true)
-
-if $BUILD_PYTHON ; then
- AM_PATH_PYTHON
- if test -z "$PYTHON" ; then
- BUILD_PYTHON=false
- fi
-fi
-
-if $BUILD_PYTHON ; then
- AC_MSG_CHECKING(for python >= 2.2)
- prog="
-import sys, string
-minver = (2,2,0,'final',0)
-if sys.version_info < minver:
- sys.exit(1)
-sys.exit(0)
-"
- if $PYTHON -c "$prog" 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
- then
- AC_MSG_RESULT([okay])
- else
- BUILD_PYTHON=false
- AC_MSG_RESULT([too old])
- fi
-fi
-
-if $BUILD_PYTHON ; then
- AM_CHECK_PYTHON_HEADERS(,BUILD_PYTHON=false)
-fi
-
-if $BUILD_PYTHON ; then
- AC_MSG_CHECKING([for pygtk-2.0])
- if pkg-config --exists pygtk-2.0 ; then
- AC_MSG_RESULT([found])
- PKG_CHECK_MODULES(PYGTK,[pygtk-2.0])
-
- AC_PATH_PROG(PYGTK_CODEGEN, pygtk-codegen-2.0, no)
- if test "x$PYGTK_CODEGEN" = xno; then
- AC_MSG_ERROR(could not find pygtk-codegen-2.0 script)
- fi
-
- AC_MSG_CHECKING(for pygtk defs)
- PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0`
- AC_SUBST(PYGTK_DEFSDIR)
- AC_MSG_RESULT($PYGTK_DEFSDIR)
- else
- AC_MSG_RESULT([not found])
- BUILD_PYTHON=false
- fi
-fi
-
-if ! $BUILD_PYTHON ; then
- AC_MSG_RESULT([Python bindings disabled.])
-fi
-
-AC_SUBST(PYTHONREV)
-AC_SUBST(PYTHONMODULES)
-
-else # with_gtk = 3.0
- BUILD_PYTHON=false
-fi # with_gtk = 2.0
-
-AM_CONDITIONAL(BUILD_PYTHON_MODULES, $BUILD_PYTHON)
-
################################################################################
# GNOME PTY Helper
################################################################################
@@ -557,9 +339,9 @@ fi
AM_CONDITIONAL([ENABLE_GLADE_CATALOGUE],[test "$enable_glade_catalogue" = "yes"])
-# *************
-# Introspection
-# *************
+# ********
+# Bindings
+# ********
# No automagic please!
if test -z "$enable_introspection"; then
@@ -568,6 +350,13 @@ fi
GOBJECT_INTROSPECTION_CHECK([0.9.0])
+# No automagic please!
+if test -z "$enable_vala"; then
+ enable_vala=no
+fi
+
+VAPIGEN_CHECK([0.16])
+
################################################################################
GTK_DOC_CHECK([1.13],[--flavour no-tmpl])
@@ -581,26 +370,29 @@ AC_SUBST([VTE_MAJOR_VERSION],[version_major])
AC_SUBST([VTE_MINOR_VERSION],[version_minor])
AC_SUBST([VTE_MICRO_VERSION],[version_micro])
+AC_SUBST([AM_CPPFLAGS],["$AM_CPPFLAGS -DGLIB_DISABLE_DEPRECATION_WARNINGS"])
+AC_SUBST([AM_CFLAGS])
+AC_SUBST([AM_LDFLAGS])
+
################################################################################
AC_CONFIG_FILES([
Makefile
src/Makefile
src/vteversion.h
+src/vte.gresource.xml
termcaps/Makefile
perf/Makefile
-python/Makefile
-python/pyvte.pc
po/Makefile.in
doc/Makefile
doc/openi18n/Makefile
doc/reference/Makefile
doc/reference/version.xml
glade/Makefile
+glade/vte.xml.in
])
-AC_CONFIG_FILES([vte${VTE_PC_VERSION}.pc:vte.pc.in],[VTE_PC_VERSION=${VTE_PC_VERSION}])
-AC_CONFIG_FILES([vte${VTE_PC_VERSION}-uninstalled.pc:vte-uninstalled.pc.in],[VTE_PC_VERSION=${VTE_PC_VERSION}])
+AC_CONFIG_FILES([vte-${VTE_API_VERSION}.pc:vte.pc.in],[VTE_API_VERSION=${VTE_API_VERSION}])
AC_OUTPUT
@@ -615,6 +407,7 @@ cat <<EOF | tee -a config.log
Configuration for libvte $VERSION for gtk+-$GTK_API_VERSION
Installing Glade catalogue: $enable_glade_catalogue
- Debugging: $DEBUG
- Disallow deprecated features: $enable_deprecation
+ Debugging: $enable_debug
+ Introspection: $enable_introspection
+ Vala bindings: $enable_vala
EOF
diff --git a/doc/Makefile.am b/doc/Makefile.am
index d36e90dc..7b367dff 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,11 +1,13 @@
-SUBDIRS = reference openi18n
-
-EXTRA_DIST = ctlseqs.ms readme.txt utmpwtmp.txt boxes.txt
+NULL =
-ctlseqs.ps: ctlseqs.ms
- $(AM_V_GEN) tbl $^ | groff -ms > $@
+SUBDIRS = reference openi18n
-ctlseqs.txt: ctlseqs.ms
- $(AM_V_GEN) tbl $^ | nroff -c -ms > $@
+EXTRA_DIST = \
+ ambiguous.txt \
+ boxes.txt \
+ readme.txt \
+ rewrap.txt \
+ utmpwtmp.txt \
+ $(NULL)
-include $(top_srcdir)/git.mk
diff --git a/doc/boxes.txt b/doc/boxes.txt
index 6a676894..cb2df8cf 100644
--- a/doc/boxes.txt
+++ b/doc/boxes.txt
@@ -63,12 +63,80 @@ Double width, mixed fill (double vertical, single horizontal).
╚╩╝
Double horizontal, single vertical.
+┍┑
+┕┙
╒╕
╘╛
Double vertical, single horizontal.
+┎┒
+┖┚
╓╖
╙╜
+Single width, double, triple and quadruple dash.
+┌╌╌┐ ┌┄┄┐ ┌┈┈┐
+╎ ╎ ┆ ┆ ┊ ┊
+╎ ╎ ┆ ┆ ┊ ┊
+└╌╌┘ └┄┄┘ └┈┈┘
+
+Double width, double, triple and quadruple dash.
+┏╍╍┓ ┏┅┅┓ ┏┉┉┓
+╏ ╏ ┇ ┇ ┋ ┋
+╏ ╏ ┇ ┇ ┋ ┋
+┗╍╍┛ ┗┅┅┛ ┗┉┉┛
+
+One single, two double lines meet.
+┢┪ ┲┱
+┡┩ ┺┹
+
+One double, two single lines meet.
+┞┦ ┭┮
+┟┧ ┵┶
+
+One single, three double lines meet.
+╇ ╉╊
+╈
+
+One double, three single lines meet.
+╁ ┾┽
+╀
+
+Two double, two single lines meet.
+╆╅
+╄╃
+
+Mixed width, starting, ending and changing width mid-character.
+╷ ╻ ╶╼╸
+╽ ╿ ╺╾╴
+╹ ╵
+
+Rounded.
+╭─╮
+│ │
+╰─╯
+
+Other.
+╲ ╳ ╱
+
+Block elements.
+
+ ▐ ▌ ▛▀#▀▜
+▄▞▀ ▗▄▀▘ ▌▗▄▖▐
+ ▌ ▐ #▐#▌#
+▀▚▄ ▝▀▄▖ ▌▝▀▘▐
+ ▐ ▌ ▙▄#▄▟
+
+▁▂▃▄▅▆▇█ ▖# ▗#
+ ▉ ▌# ▐#
+▔▇ ▊ ▐# ▌#
+ ▋ ▝# ▘#
+░ ▌
+▒░ ▍ ▌# ▐#
+▓▒░ ▉ ▎ ▚# ▞#
+█▓▒░ ▕ ▏ ▐# ▌#
+
+
VT-102: http://vt100.net/docs/vt102-ug/table5-13.html
Unicode: http://www.unicode.org/charts/PDF/U2500.pdf
+ and http://www.unicode.org/charts/PDF/U2580.pdf
diff --git a/doc/ctlseqs.ms b/doc/ctlseqs.ms
deleted file mode 100644
index 026d78ff..00000000
--- a/doc/ctlseqs.ms
+++ /dev/null
@@ -1,1647 +0,0 @@
-.\"#! troff -ms $1 -*- Nroff -*-
-.\" "Xterm Control Sequences" document
-.\" $Xorg: ctlseqs.ms,v 1.3 2000/08/17 19:42:51 cpqbld Exp $
-.\"
-.\"
-.\"
-.\"
-.\" $XFree86: xc/doc/specs/xterm/ctlseqs.ms,v 3.43 2001/03/29 22:48:02 dickey Exp $
-.\"
-.\"
-.\" Copyright 1996,1997,1998,1999,2000 by Thomas E. Dickey
-.\"
-.\" All Rights Reserved
-.\"
-.\" Permission is hereby granted, free of charge, to any person obtaining a
-.\" copy of this software and associated documentation files (the
-.\" "Software"), to deal in the Software without restriction, including
-.\" without limitation the rights to use, copy, modify, merge, publish,
-.\" distribute, sublicense, and/or sell copies of the Software, and to
-.\" permit persons to whom the Software is furnished to do so, subject to
-.\" the following conditions:
-.\"
-.\" The above copyright notice and this permission notice shall be included
-.\" in all copies or substantial portions of the Software.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-.\" IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
-.\" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-.\" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-.\" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-.\"
-.\" Except as contained in this notice, the name(s) of the above copyright
-.\" holders shall not be used in advertising or otherwise to promote the
-.\" sale, use or other dealings in this Software without prior written
-.\" authorization.
-.\"
-.\"
-.\" Copyright 1991, 1994 X Consortium
-.\"
-.\" Permission is hereby granted, free of charge, to any person obtaining
-.\" a copy of this software and associated documentation files (the
-.\" "Software"), to deal in the Software without restriction, including
-.\" without limitation the rights to use, copy, modify, merge, publish,
-.\" distribute, sublicense, and/or sell copies of the Software, and to
-.\" permit persons to whom the Software is furnished to do so, subject to
-.\" the following conditions:
-.\"
-.\" The above copyright notice and this permission notice shall be
-.\" included in all copies or substantial portions of the Software.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-.\" IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
-.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-.\" OTHER DEALINGS IN THE SOFTWARE.
-.\"
-.\" Except as contained in this notice, the name of the X Consortium shall
-.\" not be used in advertising or otherwise to promote the sale, use or
-.\" other dealings in this Software without prior written authorization
-.\" from the X Consortium.
-.\"
-.\" X Window System is a trademark of X Consortium, Inc.
-.\"
-.\" Originally written by Edward Moy, University of California,
-.\" Berkeley, edmoy@violet.berkeley.edu, for the X.V10R4 xterm.
-.\" The X Consortium staff has since updated it for X11.
-.\" Updated by Thomas E. Dickey for XFree86 3.2 - XFree86 4.0
-.\"
-.\" Run this file through troff and use the -ms macro package.
-.\"
-.if n .pl 9999v \" no page breaks in nroff
-.ND
-.de St
-.sp
-.nr PD 0
-.nr PI 1.5i
-.nr VS 16
-..
-.de Ed
-.nr PD .3v
-.nr VS 12
-..
-.ds CH \" as nothing
-.ds LH Xterm Control Sequences
-.nr s 6*\n(PS/10
-.ds L \s\nsBEL\s0
-.ds E \s\nsESC\s0
-.ds T \s\nsTAB\s0
-.ds X \s\nsETX\s0
-.ds N \s\nsENQ\s0
-.ds e \s\nsETB\s0
-.ds C \s\nsCAN\s0
-.ds S \s\nsSUB\s0
-.\" space between chars
-.ie t .ds s \|
-.el .ds s " \"
-.nr [W \w'\*L'u
-.nr w \w'\*E'u
-.if \nw>\n([W .nr [W \nw
-.nr w \w'\*T'u
-.if \nw>\n([W .nr [W \nw
-.nr w \w'\*X'u
-.if \nw>\n([W .nr [W \nw
-.nr w \w'\*N'u
-.if \nw>\n([W .nr [W \nw
-.nr w \w'\*e'u
-.if \nw>\n([W .nr [W \nw
-.nr w \w'\*C'u
-.if \nw>\n([W .nr [W \nw
-.nr w \w'\*S'u
-.if \nw>\n([W .nr [W \nw
-.nr [W +\w'\|\|'u
-.de []
-.nr w \w'\\$2'
-.nr H \\n([Wu-\\nwu
-.nr h \\nHu/2u
-.\" do fancy box in troff
-.ie t .ds \\$1 \(br\v'-1p'\(br\v'1p'\h'\\nhu'\\$2\h'\\nHu-\\nhu'\(br\l'-\\n([Wu\(ul'\v'-1p'\(br\l'-\\n([Wu\(rn'\v'1p'\*s
-.el .ds \\$1 \\$2\*s
-..
-.[] Et \v'-1p'\*X\v'1p'
-.[] En \v'-1p'\*N\v'1p'
-.[] Be \v'-1p'\*L\v'1p'
-.[] AP \v'-1p'\s\nsAPC\s0\v'1p'
-.[] Bs \v'-1p'\s\nsBS\s0\v'1p'
-.[] Cs \v'-1p'\s\nsCSI\s0\v'1p'
-.[] S3 \v'-1p'\s\nsSS3\s0\v'1p'
-.[] Dc \v'-1p'\s\nsDCS\s0\v'1p'
-.[] Os \v'-1p'\s\nsOSC\s0\v'1p'
-.[] PM \v'-1p'\s\nsPM\s0\v'1p'
-.[] ST \v'-1p'\s\nsST\s0\v'1p'
-.[] Ta \v'-1p'\*T\v'1p'
-.[] Lf \v'-1p'\s\nsLF\s0\v'1p'
-.[] Vt \v'-1p'\s\nsVT\s0\v'1p'
-.[] Ff \v'-1p'\s\nsFF\s0\v'1p'
-.[] Cr \v'-1p'\s\nsCR\s0\v'1p'
-.[] So \v'-1p'\s\nsSO\s0\v'1p'
-.[] Sp \v'-1p'\s\nsSP\s0\v'1p'
-.[] Si \v'-1p'\s\nsSI\s0\v'1p'
-.[] Eb \v'-1p'\*e\v'1p'
-.[] Ca \v'-1p'\*C\v'1p'
-.[] Su \v'-1p'\*S\v'1p'
-.[] Es \v'-1p'\*E\v'1p'
-.[] Fs \v'-1p'\s\nsFS\s0\v'1p'
-.[] Gs \v'-1p'\s\nsGS\s0\v'1p'
-.[] Rs \v'-1p'\s\nsRS\s0\v'1p'
-.[] Us \v'-1p'\s\nsUS\s0\v'1p'
-.[] XX \v'-1p'\s\nsXX\s0\v'1p'
-.[] $ $
-.[] ! !
-.[] # #
-.[] % %
-.[] (( (
-.[] ) )
-.[] * *
-.[] + +
-.[] 0 0
-.[] 1 1
-.[] 2 2
-.[] 3 3
-.[] 4 4
-.[] 5 5
-.[] 6 6
-.[] 7 7
-.[] 8 8
-.[] 9 9
-.[] : :
-.[] ; ;
-.[] = =
-.[] / /
-.[] < <
-.[] > >
-.[] ? ?
-.[] @ @
-.[] A A
-.[] cB B
-.[] C C
-.[] D D
-.[] E E
-.[] F F
-.[] G G
-.[] H H
-.[] I I
-.[] J J
-.[] K K
-.[] L L
-.[] M M
-.[] N N
-.[] O O
-.[] P P
-.[] Q Q
-.[] R R
-.[] S S
-.[] T T
-.[] V V
-.[] W W
-.[] XX X
-.[] Y Y
-.[] Z Z
-.[] [[ [
-.[] ]] ]
-.[] bS \\e
-.[] { {
-.[] ] ]
-.[] & &
-.[] ^ ^
-.[] _ _
-.[] qu \'
-.[] ` \`
-.[] a a
-.[] b b
-.[] c c
-.[] d d
-.[] f f
-.[] g g
-.[] h h
-.[] i i
-.[] j j
-.[] k k
-.[] l l
-.[] m m
-.[] n n
-.[] o o
-.[] p p
-.[] q q
-.[] r r
-.[] cs s
-.[] t t
-.[] u u
-.[] v v
-.[] w w
-.[] x x
-.[] y y
-.[] z z
-.[] | |
-.[] } }
-.[] ! !
-.[] c" \(lq
-.[] c~ ~
-.[] Sc \fIc\fP
-.ds Cc \fIC\fP
-.ds Cb \fIC\v'.3m'\h'-.2m'\s-2b\s0\v'-.3m'\fP
-.ds Cx \fIC\v'.3m'\h'-.2m'\s-2x\s0\v'-.3m'\fP
-.ds Cy \fIC\v'.3m'\h'-.2m'\s-2y\s0\v'-.3m'\fP
-.ds Pb \fIP\v'.3m'\h'-.2m'\s-2b\s0\v'-.3m'\fP
-.ds Pc \fIP\v'.3m'\h'-.2m'\s-2c\s0\v'-.3m'\fP
-.ds Pe \fIP\v'.3m'\h'-.2m'\s-2e\s0\v'-.3m'\fP
-.ds Pl \fIP\v'.3m'\h'-.2m'\s-2l\s0\v'-.3m'\fP
-.ds Pm \fIP\v'.3m'\h'-.2m'\s-2m\s0\v'-.3m'\fP
-.ds Pp \fIP\v'.3m'\h'-.2m'\s-2p\s0\v'-.3m'\fP
-.ds Pr \fIP\v'.3m'\h'-.2m'\s-2r\s0\v'-.3m'\fP
-.ds Ps \fIP\v'.3m'\h'-.2m'\s-2s\s0\v'-.3m'\fP
-.ds Pt \fIP\v'.3m'\h'-.2m'\s-2t\s0\v'-.3m'\fP
-.ds Pu \fIP\v'.3m'\h'-.2m'\s-2u\s0\v'-.3m'\fP
-.ds Pv \fIP\v'.3m'\h'-.2m'\s-2v\s0\v'-.3m'\fP
-.ds Ix \fIx\fP
-.ds Iy \fIy\fP
-.ds Iw \fIw\fP
-.ds Ih \fIh\fP
-.ds Ir \fIr\fP
-.ds Ic \fIc\fP
-.ie t .nr LL 6.5i
-.el .nr LL 72m
-.if n .na
-.TL
-Xterm Control Sequences
-.AU
-Edward Moy
-.AI
-University of California, Berkeley
-.sp
-Revised by
-.AU
-Stephen Gildea
-.AI
-X Consortium (1994)
-.AU
-Thomas Dickey
-.AI
-XFree86 Project (1996-1999)
-.AU
-.
-.am BT \" add page numbers after first page
-.ds CF %
-..
-.SH
-Definitions
-.IP \*(Sc
-The literal character \fIc\fP.
-.IP \*(Cc
-A single (required) character.
-.IP \*(Ps
-A single (usually optional) numeric parameter, composed of one of more digits.
-.IP \*(Pm
-A multiple numeric parameter composed of any number of single numeric
-parameters, separated by \*; character(s).
-Individual values for the parameters are listed with \*(Ps .
-.IP \*(Pt
-A text parameter composed of printable characters.
-.
-.SH
-C1 (8-Bit) Control Characters
-.ds RH C1 (8-Bit) Control Characters
-.LP
-The \fIxterm\fP program recognizes both 8-bit and 7-bit control characters.
-It generates 7-bit controls (by default) or 8-bit if S8C1T is enabled.
-The following pairs of 7-bit and 8-bit control characters are equivalent:
-.St
-.IP \\*(Es\\*D
-Index (IND: 0x84)
-.IP \\*(Es\\*E
-Next Line (NEL: 0x85)
-.IP \\*(Es\\*H
-Tab Set (HTS: 0x88)
-.IP \\*(Es\\*M
-Reverse Index (RI: 0x8d)
-.IP \\*(Es\\*N
-Single Shift Select of G2 Character Set (SS2: 0x8e): affects next character only
-.IP \\*(Es\\*O
-Single Shift Select of G3 Character Set (SS3: 0x8f): affects next character only
-.IP \\*(Es\\*P
-Device Control String (DCS: 0x90)
-.IP \\*(Es\\*V
-Start of Guarded Area (SPA: 0x96)
-.IP \\*(Es\\*W
-End of Guarded Area (EPA: 0x97)
-.IP \\*(Es\\(*X
-Start of String (SOS: 0x98)
-.IP \\*(Es\\*Z
-Return Terminal ID (DECID: 0x9a). Obsolete form of \*(Cs\*c (DA).
-.IP \\*(Es\\*([[
-Control Sequence Introducer (CSI: 0x9b)
-.IP \\*(Es\\*(bS
-String Terminator (ST: 0x9c)
-.IP \\*(Es\\*(]]
-Operating System Command (OSC: 0x9d)
-.IP \\*(Es\\*^
-Privacy Message (PM: 0x9e)
-.IP \\*(Es\\*_
-Application Program Command (APC: 0x9f)
-.Ed
-.sp
-.LP
-These control characters are used in the vtXXX emulation.
-.
-.SH
-VT100 Mode
-.ds RH VT100 Mode
-.LP
-Most of these control sequences are standard VT102 control sequences,
-but there is support for later DEC VT terminals (i.e., VT220 and VT320),
-as well as ISO 6429 and \fIaixterm\fP color controls.
-VT102 features not supported are
-auto-repeat and blinking characters.
-There are additional control sequences to provide
-\fIxterm-\fPdependent functions, such as the scrollbar or window size.
-Where the function is specified by DEC or ISO 6429, the code assigned
-to it is given in parentheses. The escape codes to designate and invoke
-character sets are specified by ISO 2022; see that document for a
-discussion of character sets.
-.
-.St
-.\"
-.LP
-.B
-Single-character functions
-.\"
-.IP \\*(Be
-Bell (Ctrl-G)
-.
-.IP \\*(Bs
-Backspace (Ctrl-H)
-.
-.IP \\*(Cr
-Carriage Return (Ctrl-M)
-.
-.IP \\*(En
-Return Terminal Status (Ctrl-E).
-Default response is the terminal name, e.g., "xterm", but may be overridden
-by a resource \fIanswerbackString\fP.
-.
-.IP \\*(Ff
-Form Feed or New Page (NP) (Ctrl-L) same as LF
-.
-.IP \\*(Lf
-Line Feed or New Line (NL) (Ctrl-J)
-.
-.IP \\*(So
-Shift Out (Ctrl-N) \(-> Switch to Alternate Character Set: invokes the
-G1 character set.
-.
-.IP \\*(Sp
-Space.
-.
-.IP \\*(Ta
-Horizontal Tab (HT) (Ctrl-I)
-.
-.IP \\*(Vt
-Vertical Tab (Ctrl-K) same as LF
-.
-.IP \\*(Si
-Shift In (Ctrl-O) \(-> Switch to Standard Character Set: invokes the
-G0 character set (the default).
-.Ed
-.\"
-.\"
-.\"
-.St
-.LP
-.B
-Controls beginning with ESC (other than those where ESC is part of a 7-bit equivalent to 8-bit C1 controls), ordered by the final character(s).
-.\"
-.IP \\*(Es\\*(Sp\\*F
-7-bit controls (S7C1T).
-.
-.IP \\*(Es\\*(Sp\\*G
-8-bit controls (S8C1T).
-.
-.IP \\*(Es\\*(Sp\\*L
-Set ANSI conformance level 1 (vt100, 7-bit controls).
-.
-.IP \\*(Es\\*(Sp\\*M
-Set ANSI conformance level 2 (vt200).
-.
-.IP \\*(Es\\*(Sp\\*N
-Set ANSI conformance level 3 (vt300).
-.
-.IP \\*(Es\\*#\\*3
-DEC double-height line, top half (DECDHL)
-.
-.IP \\*(Es\\*#\\*4
-DEC double-height line, bottom half (DECDHL)
-.
-.IP \\*(Es\\*#\\*5
-DEC single-width line (DECSWL)
-.
-.IP \\*(Es\\*#\\*6
-DEC double-width line (DECDWL)
-.
-.IP \\*(Es\\*#\\*8
-DEC Screen Alignment Test (DECALN)
-.
-.IP \\*(Es\\*%\\*@
-Select default character set, ISO 8859-1 (ISO 2022)
-.
-.IP \\*(Es\\*%\\*G
-Select UTF-8 character set (ISO 2022)
-.
-.IP \\*(Es\\*(((\\*(Cc
-Designate G0 Character Set (ISO 2022)
-.IP \\*(Es\\*)\\*(Cc
-Designate G1 Character Set (ISO 2022)
-.
-.IP \\*(Es\\**\\*(Cc
-Designate G2 Character Set (ISO 2022)
-.
-.IP \\*(Es\\*+\\*(Cc
-Designate G3 Character Set (ISO 2022)
-.br
-Final character \*(Cc for designating character sets
-(\*0, \*A and \*(cB apply to VT100 and up, the remainder to VT220 and up):
- \*(Cc = \*0 \(-> DEC Special Character and Line Drawing Set
- \*(Cc = \*A \(-> United Kingdom (UK)
- \*(Cc = \*(cB \(-> United States (USASCII)
- \*(Cc = \*4 \(-> Dutch
- \*(Cc = \*C or \*5 \(-> Finnish
- \*(Cc = \*R \(-> French
- \*(Cc = \*Q \(-> French Canadian
- \*(Cc = \*K \(-> German
- \*(Cc = \*Y \(-> Italian
- \*(Cc = \*E or \*6 \(-> Norwegian/Danish
- \*(Cc = \*Z \(-> Spanish
- \*(Cc = \*H or \*7 \(-> Swedish
- \*(Cc = \*= \(-> Swiss
-.
-.IP \\*(Es\\*7
-Save Cursor (DECSC)
-.
-.IP \\*(Es\\*8
-Restore Cursor (DECRC)
-.
-.IP \\*(Es\\*=
-Application Keypad (DECPAM)
-.
-.IP \\*(Es\\*>
-Normal Keypad (DECPNM)
-.
-.IP \\*(Es\\*F
-Cursor to lower left corner of screen (if
-enabled by the \fBhpLowerleftBugCompat\fP resource).
-.
-.IP \\*(Es\\*c
-Full Reset (RIS)
-.
-.IP \\*(Es\\*l
-Memory Lock (per HP terminals). Locks memory above the cursor.
-.
-.IP \\*(Es\\*m
-Memory Unlock (per HP terminals)
-.
-.IP \\*(Es\\*n
-Invoke the G2 Character Set (LS2)
-.
-.IP \\*(Es\\*o
-Invoke the G3 Character Set (LS3)
-.
-.IP \\*(Es\\*|
-Invoke the G3 Character Set as GR (LS3R). Has no visible effect in \fIxterm\fP.
-.
-.IP \\*(Es\\*}
-Invoke the G2 Character Set as GR (LS2R). Has no visible effect in \fIxterm\fP.
-.
-.IP \\*(Es\\*(c~
-Invoke the G1 Character Set as GR (LS1R). Has no visible effect in \fIxterm\fP.
-.Ed
-.
-.St
-.LP
-.B
-Application Program-Control functions
-.IP \\*(AP\\*(Pt\\*s\\*(ST
-\fIxterm\fP implements no APC functions; \*(Pt is ignored.
-\*(Pt need not be printable characters.
-.Ed
-.
-.St
-.LP
-.B
-Device-Control functions
-.IP \\*(Dc\\*(Ps\\*;\\*(Ps\\*|\\*(Pt\\*s\\*(ST
-User-Defined Keys (DECUDK).
-The first parameter:
- \*(Ps = \*0 \(-> Clear all UDK definitions before starting (default)
- \*(Ps = \*1 \(-> Erase Below (default)
-.br
-The second parameter:
- \*(Ps = \*0 \(-> Lock the keys (default)
- \*(Ps = \*1 \(-> Do not lock.
-.br
-The third parameter is a ';'-separated list of strings denoting
-the key-code separated by a '/' from the hex-encoded key value.
-The key codes correspond to the DEC function-key codes (e.g., F6=17).
-.
-.IP \\*(Dc\\*$\\*q\\*(Pt\\*s\\*(ST
-Request Status String (DECRQSS).
-The string following the "q" is one of the following:
- \*(c"\*q \(-> DECSCA
- \*(c"\*p \(-> DECSCL
- \*r \(-> DECSTBM
- \*m \(-> SGR
-.br
-\fIxterm\fP responds with
-\*(Dc\*1\*$\*r\*(Pt\*s\*(ST
-for valid requests, replacing the \*(Pt with the corresponding \*(Cs
-string,
-or
-\*(Dc\*0\*$\*r\*(Pt\*s\*(ST
-for invalid requests.
-.
-.IP \\*(Dc\\*+\\*q\\*(Pt\\*s\\*(ST
-Request Termcap/Terminfo String (xterm, experimental).
-The string following the "q" is a list of names
-encoded in hexadecimal (2 digits per character)
-separated by \*;
-which correspond to termcap or terminfo key names.
-.br
-\fIxterm\fP responds with
-\*(Dc\*1\*+\*r\*(Pt\*s\*(ST
-for valid requests, adding to \*(Pt an \*=,
-and the value of the corresponding string that xterm would send,
-or
-\*(Dc\*0\*+\*r\*(Pt\*s\*(ST
-for invalid requests.
-The strings are encoded in hexadecimal (2 digits per character).
-.Ed
-.\"
-.St
-.LP
-.B
-Functions using CSI, ordered by the final character(s)
-.IP \\*(Cs\\*(Ps\\*s\\*@
-Insert \*(Ps (Blank) Character(s) (default = 1) (ICH)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*A
-Cursor Up \*(Ps Times (default = 1) (CUU)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*(cB
-Cursor Down \*(Ps Times (default = 1) (CUD)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*C
-Cursor Forward \*(Ps Times (default = 1) (CUF)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*D
-Cursor Backward \*(Ps Times (default = 1) (CUB)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*E
-Cursor Next Line \*(Ps Times (default = 1) (CNL)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*F
-Cursor Preceding Line \*(Ps Times (default = 1) (CPL)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*G
-Cursor Character Absolute [column] (default = [row,1]) (CHA)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*;\\*(Ps\\*s\\*H
-Cursor Position [row;column] (default = [1,1]) (CUP)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*I
-Cursor Forward Tabulation \*(Ps tab stops (default = 1) (CHT)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*J
-Erase in Display (ED)
- \*(Ps = \*0 \(-> Erase Below (default)
- \*(Ps = \*1 \(-> Erase Above
- \*(Ps = \*2 \(-> Erase All
- \*(Ps = \*3 \(-> Erase Saved Lines (xterm)
-.
-.IP \\*(Cs\\*?\\*(Ps\\*s\\*J
-Erase in Display (DECSED)
- \*(Ps = \*0 \(-> Selective Erase Below (default)
- \*(Ps = \*1 \(-> Selective Erase Above
- \*(Ps = \*2 \(-> Selective Erase All
-.
-.IP \\*(Cs\\*(Ps\\*s\\*K
-Erase in Line (EL)
- \*(Ps = \*0 \(-> Erase to Right (default)
- \*(Ps = \*1 \(-> Erase to Left
- \*(Ps = \*2 \(-> Erase All
-.
-.IP \\*(Cs\\*?\\*(Ps\\*s\\*K
-Erase in Line (DECSEL)
- \*(Ps = \*0 \(-> Selective Erase to Right (default)
- \*(Ps = \*1 \(-> Selective Erase to Left
- \*(Ps = \*2 \(-> Selective Erase All
-.
-.IP \\*(Cs\\*(Ps\\*s\\*L
-Insert \*(Ps Line(s) (default = 1) (IL)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*M
-Delete \*(Ps Line(s) (default = 1) (DL)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*P
-Delete \*(Ps Character(s) (default = 1) (DCH)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*S
-Scroll up \*(Ps lines (default = 1) (SU)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*T
-Scroll down \*(Ps lines (default = 1) (SD)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*;\\*(Ps\\*s\\*;\\*(Ps\\*s\\*;\\*(Ps\\*s\\*;\\*(Ps\\*s\\*T
-Initiate hilite mouse tracking.
-Parameters are [func;startx;starty;firstrow;lastrow].
-See the section \fBMouse Tracking\fP.
-.
-.IP \\*(Cs\\*(Ps\\*s\\*(XX
-Erase \*(Ps Character(s) (default = 1) (ECH)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*Z
-Cursor Backward Tabulation \*(Ps tab stops (default = 1) (CBT)
-.
-.IP \\*(Cs\\*(Pm\\*s\\*`
-Character Position Absolute [column] (default = [row,1]) (HPA)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*b
-Repeat the preceding graphic character \*(Ps times (REP)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*c
-Send Device Attributes (Primary DA)
- \*(Ps = \*0, 1 or omitted \(-> request attributes from terminal.
-The response depends on the \fBdecTerminalId\fP resource setting.
- \(-> \*(Cs\*?\*1\*;\*2\*c (``VT100 with Advanced Video Option'')
- \(-> \*(Cs\*?\*1\*;\*0\*c (``VT101 with No Options'')
- \(-> \*(Cs\*?\*6\*c (``VT102'')
- \(-> \*(Cs\*?\*6\*0\*;\*1\*;\*2\*;\*6\*;\*8\*;\*9\*;\*1\*5\*;\*c (``VT220'')
-.br
-The VT100-style response parameters do not mean anything by themselves.
-VT220 parameters do, telling the host what features the terminal supports:
- \(-> \*1 132-columns
- \(-> \*2 Printer
- \(-> \*6 Selective erase
- \(-> \*8 User-defined keys
- \(-> \*9 National replacement character sets
- \(-> \*1\*5 Technical characters
-.
-.IP \\*(Cs\\*>\\*(Ps\\*s\\*c
-Send Device Attributes (Secondary DA)
- \*(Ps = \*0, 1 or omitted \(-> request the terminal's identification code.
-The response depends on the \fBdecTerminalId\fP resource setting.
-It should apply only to VT220 and up, but \fIxterm\fP extends this to VT100.
- \(-> \*(Cs\*(Pp\*s\*;\*(Pv\*s\*;\*(Pc\*s\*c
-.br
-where \*(Pp denotes the terminal type
- \(-> \*0 (``VT100'')
- \(-> \*1 (``VT220'')
-.br
-and \*(Pv is the firmware version (for \fIxterm\fP, this is the XFree86
-patch number, starting with 95).
-In a DEC terminal, \*(Pc indicates the ROM cartridge
-registration number and is always zero.
-.
-.IP \\*(Cs\\*(Pm\\*s\\*d
-Line Position Absolute [row] (default = [1,column]) (VPA)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*;\\*(Ps\\*s\\*f
-Horizontal and Vertical Position [row;column] (default = [1,1]) (HVP)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*g
-Tab Clear (TBC)
- \*(Ps = \*0 \(-> Clear Current Column (default)
- \*(Ps = \*3 \(-> Clear All
-.
-.IP \\*(Cs\\*(Pm\\*s\\*h
-Set Mode (SM)
- \*(Ps = \*2 \(-> Keyboard Action Mode (AM)
- \*(Ps = \*4 \(-> Insert Mode (IRM)
- \*(Ps = \*1\*2 \(-> Send/receive (SRM)
- \*(Ps = \*2\*0 \(-> Automatic Newline (LNM)
-.
-.IP \\*(Cs\\*?\\*(Pm\\*s\\*h
-DEC Private Mode Set (DECSET)
- \*(Ps = \*1 \(-> Application Cursor Keys (DECCKM)
- \*(Ps = \*2 \(-> Designate USASCII for character sets G0-G3 (DECANM),
-and set VT100 mode.
- \*(Ps = \*3 \(-> 132 Column Mode (DECCOLM)
- \*(Ps = \*4 \(-> Smooth (Slow) Scroll (DECSCLM)
- \*(Ps = \*5 \(-> Reverse Video (DECSCNM)
- \*(Ps = \*6 \(-> Origin Mode (DECOM)
- \*(Ps = \*7 \(-> Wraparound Mode (DECAWM)
- \*(Ps = \*8 \(-> Auto-repeat Keys (DECARM)
- \*(Ps = \*9 \(-> Send Mouse X & Y on button press.
-See the section \fBMouse Tracking\fP.
- \*(Ps = \*1\*8 \(-> Print form feed (DECPFF)
- \*(Ps = \*1\*9 \(-> Set print extent to full screen (DECPEX)
- \*(Ps = \*2\*5 \(-> Show Cursor (DECTCEM)
- \*(Ps = \*3\*0 \(-> Show scrollbar (rxvt).
- \*(Ps = \*3\*5 \(-> Enable font-shifting functions (rxvt).
- \*(Ps = \*3\*8 \(-> Enter Tektronix Mode (DECTEK)
- \*(Ps = \*4\*0 \(-> Allow 80 \z\(<-\(-> 132 Mode
- \*(Ps = \*4\*1 \(-> \fImore\fP(1) fix (see \fIcurses\fP resource)
- \*(Ps = \*4\*2 \(-> Enable Nation Replacement Character sets (DECNRCM)
- \*(Ps = \*4\*4 \(-> Turn On Margin Bell
- \*(Ps = \*4\*5 \(-> Reverse-wraparound Mode
- \*(Ps = \*4\*6 \(-> Start Logging
-(normally disabled by a compile-time option)
- \*(Ps = \*4\*7 \(-> Use Alternate Screen Buffer (unless
-disabled by the \fBtiteInhibit\fP resource)
- \*(Ps = \*6\*6 \(-> Application keypad (DECNKM)
- \*(Ps = \*6\*7 \(-> Backarrow key sends delete (DECBKM)
- \*(Ps = \*1\*0\*0\*0 \(-> Send Mouse X & Y on button press and release.
-See the section \fBMouse Tracking\fP.
- \*(Ps = \*1\*0\*0\*1 \(-> Use Hilite Mouse Tracking.
- \*(Ps = \*1\*0\*0\*2 \(-> Use Cell Motion Mouse Tracking.
- \*(Ps = \*1\*0\*0\*3 \(-> Use All Motion Mouse Tracking.
- \*(Ps = \*1\*0\*1\*0 \(-> Scroll to bottom on tty output (rxvt).
- \*(Ps = \*1\*0\*1\*1 \(-> Scroll to bottom on key press (rxvt).
- \*(Ps = \*1\*0\*3\*5 \(-> Enable special modifiers for Alt and NumLock keys.
- \*(Ps = \*1\*0\*3\*6 \(-> Send ESC when Meta modifies a key
-(enables the \fBmetaSendsEscape\fP resource).
- \*(Ps = \*1\*0\*3\*7 \(-> Send DEL from the editing-keypad Delete key
- \*(Ps = \*1\*0\*4\*7 \(-> Use Alternate Screen Buffer (unless
-disabled by the \fBtiteInhibit\fP resource)
- \*(Ps = \*1\*0\*4\*8 \(-> Save cursor as in DECSC (unless
-disabled by the \fBtiteInhibit\fP resource)
- \*(Ps = \*1\*0\*4\*9 \(-> Save cursor as in DECSC
-and use Alternate Screen Buffer, clearing it first (unless
-disabled by the \fBtiteInhibit\fP resource)
- \*(Ps = \*1\*0\*5\*1 \(-> Set Sun function-key mode.
- \*(Ps = \*1\*0\*5\*2 \(-> Set HP function-key mode.
- \*(Ps = \*1\*0\*6\*0 \(-> Set legacy keyboard emulation (X11R6).
- \*(Ps = \*1\*0\*6\*1 \(-> Set Sun/PC keyboard emulation of VT220 keyboard.
-.
-.IP \\*(Cs\\*(Pm\\*s\\*i
-Media Copy (MC)
- \*(Ps = \*0 \(-> Print screen (default)
- \*(Ps = \*4 \(-> Turn off printer controller mode
- \*(Ps = \*5 \(-> Turn on printer controller mode
-.
-.IP \\*(Cs\\*?\\*(Pm\\*s\\*i
-Media Copy (MC, DEC-specific)
- \*(Ps = \*1 \(-> Print line containing cursor
- \*(Ps = \*4 \(-> Turn off autoprint mode
- \*(Ps = \*5 \(-> Turn on autoprint mode
- \*(Ps = \*1 \*0 \(-> Print composed display, ignores DECPEX
- \*(Ps = \*1 \*1 \(-> Print all pages
-.
-.IP \\*(Cs\\*(Pm\\*s\\*l
-Reset Mode (RM)
- \*(Ps = \*2 \(-> Keyboard Action Mode (AM)
- \*(Ps = \*4 \(-> Replace Mode (IRM)
- \*(Ps = \*1\*2 \(-> Send/receive (SRM)
- \*(Ps = \*2\*0 \(-> Normal Linefeed (LNM)
-.
-.IP \\*(Cs\\*?\\*(Pm\\*s\\*l
-DEC Private Mode Reset (DECRST)
- \*(Ps = \*1 \(-> Normal Cursor Keys (DECCKM)
- \*(Ps = \*2 \(-> Designate VT52 mode (DECANM).
- \*(Ps = \*3 \(-> 80 Column Mode (DECCOLM)
- \*(Ps = \*4 \(-> Jump (Fast) Scroll (DECSCLM)
- \*(Ps = \*5 \(-> Normal Video (DECSCNM)
- \*(Ps = \*6 \(-> Normal Cursor Mode (DECOM)
- \*(Ps = \*7 \(-> No Wraparound Mode (DECAWM)
- \*(Ps = \*8 \(-> No Auto-repeat Keys (DECARM)
- \*(Ps = \*9 \(-> Don't Send Mouse X & Y on button press
- \*(Ps = \*1\*8 \(-> Don't print form feed (DECPFF)
- \*(Ps = \*1\*9 \(-> Limit print to scrolling region (DECPEX)
- \*(Ps = \*2\*5 \(-> Hide Cursor (DECTCEM)
- \*(Ps = \*3\*0 \(-> Don't show scrollbar (rxvt).
- \*(Ps = \*3\*5 \(-> Disable font-shifting functions (rxvt).
- \*(Ps = \*4\*0 \(-> Disallow 80 \z\(<-\(-> 132 Mode
- \*(Ps = \*4\*1 \(-> No \fImore\fP(1) fix (see \fIcurses\fP resource)
- \*(Ps = \*4\*2 \(-> Disable Nation Replacement Character sets (DECNRCM)
- \*(Ps = \*4\*4 \(-> Turn Off Margin Bell
- \*(Ps = \*4\*5 \(-> No Reverse-wraparound Mode
- \*(Ps = \*4\*6 \(-> Stop Logging
-(normally disabled by a compile-time option)
- \*(Ps = \*4\*7 \(-> Use Normal Screen Buffer
- \*(Ps = \*6\*6 \(-> Numeric keypad (DECNKM)
- \*(Ps = \*6\*7 \(-> Backarrow key sends backspace (DECBKM)
- \*(Ps = \*1\*0\*0\*0 \(-> Don't Send Mouse X & Y on button press and
-release.
-See the section \fBMouse Tracking\fP.
- \*(Ps = \*1\*0\*0\*1 \(-> Don't Use Hilite Mouse Tracking
- \*(Ps = \*1\*0\*0\*2 \(-> Don't Use Cell Motion Mouse Tracking
- \*(Ps = \*1\*0\*0\*3 \(-> Don't Use All Motion Mouse Tracking
- \*(Ps = \*1\*0\*1\*0 \(-> Don't scroll to bottom on tty output (rxvt).
- \*(Ps = \*1\*0\*1\*1 \(-> Don't scroll to bottom on key press (rxvt).
- \*(Ps = \*1\*0\*3\*5 \(-> Disable special modifiers for Alt and NumLock keys.
- \*(Ps = \*1\*0\*3\*6 \(-> Don't send ESC when Meta modifies a key
-(disables the \fBmetaSendsEscape\fP resource).
- \*(Ps = \*1\*0\*3\*7 \(-> Send VT220 Remove from the editing-keypad Delete key
- \*(Ps = \*1\*0\*4\*7 \(-> Use Normal Screen Buffer, clearing screen
-first if in the Alternate Screen (unless
-disabled by the \fBtiteInhibit\fP resource)
- \*(Ps = \*1\*0\*4\*8 \(-> Restore cursor as in DECRC (unless
-disabled by the \fBtiteInhibit\fP resource)
- \*(Ps = \*1\*0\*4\*9 \(-> Use Normal Screen Buffer and restore cursor
-as in DECRC (unless
-disabled by the \fBtiteInhibit\fP resource)
- \*(Ps = \*1\*0\*5\*1 \(-> Reset Sun function-key mode.
- \*(Ps = \*1\*0\*5\*2 \(-> Reset HP function-key mode.
- \*(Ps = \*1\*0\*6\*0 \(-> Reset legacy keyboard emulation (X11R6).
- \*(Ps = \*1\*0\*6\*1 \(-> Reset Sun/PC keyboard emulation of VT220 keyboard.
-.
-.IP \\*(Cs\\*(Pm\\*s\\*m
-Character Attributes (SGR)
- \*(Ps = \*0 \(-> Normal (default)
- \*(Ps = \*1 \(-> Bold
- \*(Ps = \*4 \(-> Underlined
- \*(Ps = \*5 \(-> Blink (appears as Bold)
- \*(Ps = \*7 \(-> Inverse
- \*(Ps = \*8 \(-> Invisible (hidden)
- \*(Ps = \*2\*2 \(-> Normal (neither bold nor faint)
- \*(Ps = \*2\*4 \(-> Not underlined
- \*(Ps = \*2\*5 \(-> Steady (not blinking)
- \*(Ps = \*2\*7 \(-> Positive (not inverse)
- \*(Ps = \*2\*8 \(-> Visible (not hidden)
- \*(Ps = \*3\*0 \(-> Set foreground color to Black
- \*(Ps = \*3\*1 \(-> Set foreground color to Red
- \*(Ps = \*3\*2 \(-> Set foreground color to Green
- \*(Ps = \*3\*3 \(-> Set foreground color to Yellow
- \*(Ps = \*3\*4 \(-> Set foreground color to Blue
- \*(Ps = \*3\*5 \(-> Set foreground color to Magenta
- \*(Ps = \*3\*6 \(-> Set foreground color to Cyan
- \*(Ps = \*3\*7 \(-> Set foreground color to White
- \*(Ps = \*3\*9 \(-> Set foreground color to default (original)
- \*(Ps = \*4\*0 \(-> Set background color to Black
- \*(Ps = \*4\*1 \(-> Set background color to Red
- \*(Ps = \*4\*2 \(-> Set background color to Green
- \*(Ps = \*4\*3 \(-> Set background color to Yellow
- \*(Ps = \*4\*4 \(-> Set background color to Blue
- \*(Ps = \*4\*5 \(-> Set background color to Magenta
- \*(Ps = \*4\*6 \(-> Set background color to Cyan
- \*(Ps = \*4\*7 \(-> Set background color to White
- \*(Ps = \*4\*9 \(-> Set background color to default (original).
-.sp
-If 16-color support is compiled, the following apply.
-Assume that \fIxterm\fP's resources
-are set so that the ISO color codes are the first 8 of a set of 16.
-Then the \fIaixterm\fP colors are the bright versions of the ISO colors:
- \*(Ps = \*9\*0 \(-> Set foreground color to Black
- \*(Ps = \*9\*1 \(-> Set foreground color to Red
- \*(Ps = \*9\*2 \(-> Set foreground color to Green
- \*(Ps = \*9\*3 \(-> Set foreground color to Yellow
- \*(Ps = \*9\*4 \(-> Set foreground color to Blue
- \*(Ps = \*9\*5 \(-> Set foreground color to Magenta
- \*(Ps = \*9\*6 \(-> Set foreground color to Cyan
- \*(Ps = \*9\*7 \(-> Set foreground color to White
- \*(Ps = \*1\*0\*0 \(-> Set background color to Black
- \*(Ps = \*1\*0\*1 \(-> Set background color to Red
- \*(Ps = \*1\*0\*2 \(-> Set background color to Green
- \*(Ps = \*1\*0\*3 \(-> Set background color to Yellow
- \*(Ps = \*1\*0\*4 \(-> Set background color to Blue
- \*(Ps = \*1\*0\*5 \(-> Set background color to Magenta
- \*(Ps = \*1\*0\*6 \(-> Set background color to Cyan
- \*(Ps = \*1\*0\*7 \(-> Set background color to White
-.sp
-If \fIxterm\fP is compiled with the 16-color support disabled, it supports
-the following, from \fIrxvt\fP:
- \*(Ps = \*1\*0\*0 \(-> Set foreground and background color to default
-.sp
-If 88- or 256-color support is compiled, the following apply.
- \*(Ps = \*3\*8 ; \*5 ; \*(Ps \(-> Set foreground color to the second \*(Ps
- \*(Ps = \*4\*8 ; \*5 ; \*(Ps \(-> Set background color to the second \*(Ps
-.sp
-.
-.IP \\*(Cs\\*(Ps\\*s\\*n
-Device Status Report (DSR)
- \*(Ps = \*5 \(-> Status Report \*(Cs\*0\*n (``OK'')
- \*(Ps = \*6 \(-> Report Cursor Position (CPR) [row;column] as
-.br
-\*(Cs\*(Ir\*s\*;\*(Ic\*s\*R
-.
-.IP \\*(Cs\\*?\\*(Ps\\*s\\*n
-Device Status Report (DSR, DEC-specific)
- \*(Ps = \*6 \(-> Report Cursor Position (CPR) [row;column] as
-\*(Cs\*?\*(Ir\*s\*;\*(Ic\*s\*R
-(assumes page is zero).
- \*(Ps = \*1\*5 \(-> Report Printer status as
-\*(Cs\*?\*1\*0\*s\*n (ready)
-or
-\*(Cs\*?\*1\*1\*s\*n (not ready)
- \*(Ps = \*2\*5 \(-> Report UDK status as
-\*(Cs\*?\*2\*0\*s\*n (unlocked)
-or
-\*(Cs\*?\*2\*1\*s\*n (locked)
- \*(Ps = \*2\*6 \(-> Report Keyboard status as
-.br
-\*(Cs\*?\*2\*7\*s\*;\*s\*1\*s\*;\*s\*0\*s\*;\*s\*0\*s\*n (North American)
-.br
-\*(Cs\*?\*5\*3\*s\*n Locator available, if compiled-in, or
-.br
-\*(Cs\*?\*5\*0\*s\*n No Locator, if not.
-.
-.IP \\*(Cs\\*s\\*!\\*p
-Soft terminal reset (DECSTR)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*;\\*(Ps\\*s\\*(c"\\*p
-Set conformance level (DECSCL)
-Valid values for the first parameter:
- \*(Ps = \*6\*1 \(-> VT100
- \*(Ps = \*6\*2 \(-> VT200
- \*(Ps = \*6\*3 \(-> VT300
-.br
-Valid values for the second parameter:
- \*(Ps = \*0 \(-> 8-bit controls
- \*(Ps = \*1 \(-> 7-bit controls (always set for VT100)
- \*(Ps = \*2 \(-> 8-bit controls
-.
-.IP \\*(Cs\\*(Ps\\*s\\*(c"\\*q
-Select character protection attribute (DECSCA).
-Valid values for the parameter:
- \*(Ps = \*0 \(-> DECSED and DECSEL can erase (default)
- \*(Ps = \*1 \(-> DECSED and DECSEL cannot erase
- \*(Ps = \*2 \(-> DECSED and DECSEL can erase
-.
-.IP \\*(Cs\\*(Ps\\*s\\*;\\*(Ps\\*s\\*r
-Set Scrolling Region [top;bottom] (default = full size of window) (DECSTBM)
-.
-.IP \\*(Cs\\*?\\*(Pm\\*s\\*r
-Restore DEC Private Mode Values. The value of \*(Ps previously saved is
-restored. \*(Ps values are the same as for DECSET.
-.
-.IP \\*(Cs\\*?\\*(Pm\\*s\\*(cs
-Save DEC Private Mode Values. \*(Ps values are the same as for DECSET.
-.
-.IP \\*(Cs\\*(Ps\\*s\\*;\\*(Ps\\*s\\*;\\*(Ps\\*s\\*t
-Window manipulation (from \fIdtterm\fP, as well as extensions).
-Valid values for the first (and any additional parameters) are:
- \*(Ps = \*1 \(-> De-iconify window.
- \*(Ps = \*2 \(-> Iconify window.
- \*(Ps = \*3 ; \fIx ; y\fP \(-> Move window to [x, y].
- \*(Ps = \*4 ; \fIheight ; width\fP \(-> Resize the \fIxterm\fP window to height and width in pixels.
- \*(Ps = \*5 \(-> Raise the \fIxterm\fP window to the front of the stacking order.
- \*(Ps = \*6 \(-> Lower the \fIxterm\fP window to the bottom of the stacking order.
- \*(Ps = \*7 \(-> Refresh the \fIxterm\fP window.
- \*(Ps = \*8 ; \fIheight ; width\fP \(-> Resize the text area to [height;width] in characters.
- \*(Ps = \*9 ; \*0 \(-> Restore maximized window.
- \*(Ps = \*9 ; \*1 \(-> Maximize window (i.e., resize to screen size).
- \*(Ps = \*1\*1 \(-> Report \fIxterm\fP window state.
-If the \fIxterm\fP window is open (non-iconified), it returns \*(Cs\*1\*t.
-If the \fIxterm\fP window is iconified, it returns \*(Cs\*2\*t.
- \*(Ps = \*1\*3 \(-> Report \fIxterm\fP window position as
-\*(Cs\*3\*;\*(Ix\*;\*(Iy\*t
- \*(Ps = \*1\*4 \(-> Report \fIxterm\fP window in pixels as
-\*(Cs\*s\*4\*s\*;\*s\fIheight\fP\*s\*;\*s\fIwidth\fP\*s\*t
- \*(Ps = \*1\*8 \(-> Report the size of the text area in characters as
-\*(Cs\*s\*8\*s\*;\*s\fIheight\fP\*s\*;\*s\fIwidth\fP\*s\*t
- \*(Ps = \*1\*9 \(-> Report the size of the screen in characters as
-\*(Cs\*s\*9\*s\*;\*s\fIheight\fP\*s\*;\*s\fIwidth\fP\*s\*t
- \*(Ps = \*2\*0 \(-> Report \fIxterm\fP window's icon label as
-\*(Os\*s\*L\*s\fIlabel\fP\*s\*(ST
- \*(Ps = \*2\*1 \(-> Report \fIxterm\fP window's title as
-\*(Os\*s\*l\*s\fItitle\fP\*s\*(ST
- \*(Ps >= \*2\*4 \(-> Resize to \*(Ps lines (DECSLPP)
-.
-.IP \\*(Cs\\*(Pt\\*s\\*;\\*(Pl\\*s\\*;\\*(Pb\\*s\\*;\\*(Pr\\*s\\*(qu\\*w
-Enable Filter Rectangle (DECEFR)
-.br
-Parameters are [top;left;bottom;right].
-.br
-Defines the coordinates of a filter rectangle and activates it.
-Anytime the locator is detected outside of the filter rectangle,
-an outside rectangle event is generated and the rectangle is disabled.
-Filter rectangles are always treated as "one-shot" events.
-Any parameters that are omitted default to the current locator position.
-If all parameters are omitted, any locator motion will be reported.
-DECELR always cancels any prevous rectangle definition.
-.
-.IP \\*(Cs\\*(Ps\\*s\\*x
-Request Terminal Parameters (DECREQTPARM)
-.
-.IP \\*(Cs\\*(Ps\\*s\\*;\\*(Pu\\*s\\*(qu\\*z
-Enable Locator Reporting (DECELR)
-.br
-Valid values for the first parameter:
- \*(Ps = \*0 \(-> Locator disabled (default)
- \*(Ps = \*1 \(-> Locator enabled
- \*(Ps = \*2 \(-> Locator enabled for one report, then disabled
-.br
-The second parameter specifies the coordinate unit for locator reports.
-.br
-Valid values for the second parameter:
- \*(Pu = \*0 or omitted \(-> default to character cells
- \*(Pu = \*1 \(-> device physical pixels
- \*(Pu = \*2 \(-> character cells
-.
-.IP \\*(Cs\\*(Pm\\*s\\*(qu\\*{
-Select Locator Events (DECSLE)
-.br
-Valid values for the first (and any additional parameters) are:
- \*(Ps = \*0 \(-> only respond to explicit host requests (DECRQLP)
- (default) also cancels any filter rectangle
- \*(Ps = \*1 \(-> report button down transitions
- \*(Ps = \*2 \(-> do not report button down transitions
- \*(Ps = \*3 \(-> report button up transitions
- \*(Ps = \*4 \(-> do not report button up transitions
-.
-.IP \\*(Cs\\*(Ps\\*s\\*(qu\\*|
-Request Locator Position (DECRQLP)
-.br
-Valid values for the parameter are:
- \*(Ps = \*0, 1 or omitted \(-> transmit a single DECLRP locator report
-.sp
-If Locator Reporting has been enabled by a DECELR, xterm will respond
-with a DECLRP Locator Report. This report is also generated on button
-up and down events if they have been enabled with a DECSLE, or when
-the locator is detected outside of a filter rectangle, if filter rectangles
-have been enabled with a DECEFR.
-.sp
- \(-> \*(Cs\*(Pe\*s\*;\*(Pb\*s\*;\*(Pr\*s\*;\*(Pc\*s\*;\*(Pp\*s\*&\*s\*w
-.sp
-Parameters are [event;button;row;column;page].
-.br
-Valid values for the event:
- \*(Pe = \*0 \(-> locator unavailable - no other parameters sent
- \*(Pe = \*1 \(-> request - xterm received a DECRQLP
- \*(Pe = \*2 \(-> left button down
- \*(Pe = \*3 \(-> left button up
- \*(Pe = \*4 \(-> middle button down
- \*(Pe = \*5 \(-> middle button up
- \*(Pe = \*6 \(-> right button down
- \*(Pe = \*7 \(-> right button up
- \*(Pe = \*8 \(-> M4 button down
- \*(Pe = \*9 \(-> M4 button up
- \*(Pe = \*1\*0 \(-> locator outside filter rectangle
-.br
-``button'' parameter is a bitmask indicating which buttons are pressed:
- \*(Pb = \*0 \(-> no buttons down
- \*(Pb & \*1 \(-> right button down
- \*(Pb & \*2 \(-> middle button down
- \*(Pb & \*4 \(-> left button down
- \*(Pb & \*8 \(-> M4 button down
-.br
-``row'' and ``column'' parameters are the coordinates of the locator
-position in the xterm window, encoded as ASCII decimal.
-.br
-The ``page'' parameter is not used by xterm, and will be omitted.
-.
-.Ed
-.
-.St
-.LP
-.B
-Operating System Controls
-.
-.IP \\*(Os\\*(Ps\\*s\\*;\\*(Pt\\*s\\*(ST
-.IP \\*(Os\\*(Ps\\*s\\*;\\*(Pt\\*s\\*(Be
-Set Text Parameters.
-For colors and font,
-if \*(Pt is a "?", the control sequence elicits a response which consists
-of the control sequence which would set the corresponding value.
-The \fIdtterm\fP control sequences allow you to determine the icon name
-and window title.
- \*(Ps = \*0 \(-> Change Icon Name and Window Title to \*(Pt
- \*(Ps = \*1 \(-> Change Icon Name to \*(Pt
- \*(Ps = \*2 \(-> Change Window Title to \*(Pt
- \*(Ps = \*3 \(-> Set X property on top-level window. \*(Pt should be in the form
-"\fIprop=value\fP", or just "\fIprop\fP" to delete the property
- \*(Ps = \*4 ; \fIc ; name\fP \(-> Change Color #\fIc\fP to \fIcname\fP. Any
-number of \fIc name\fP pairs may be given.
- \*(Ps = \*1\*0 \(-> Change color names starting with text foreground to \*(Pt
-(a list of one or more color names or RGB specifications, separated by
-semicolon, up to eight, as per \fIXParseColor\fP).
- \*(Ps = \*1\*1 \(-> Change colors starting with text background to \*(Pt
- \*(Ps = \*1\*2 \(-> Change colors starting with text cursor to \*(Pt
- \*(Ps = \*1\*3 \(-> Change colors starting with mouse foreground to \*(Pt
- \*(Ps = \*1\*4 \(-> Change colors starting with mouse background to \*(Pt
- \*(Ps = \*1\*5 \(-> Change colors starting with Tek foreground to \*(Pt
- \*(Ps = \*1\*6 \(-> Change colors starting with Tek background to \*(Pt
- \*(Ps = \*1\*7 \(-> Change colors starting with highlight to \*(Pt
- \*(Ps = \*4\*6 \(-> Change Log File to \*(Pt (normally disabled by a
-compile-time option)
- \*(Ps = \*5\*0 \(-> Set Font to \*(Pt
-If \*(Pt begins with a "#", index in the font menu, relative (if the
-next character is a plus or minus sign) or absolute. A number is
-expected but not required after the sign (the default is the current
-entry for relative, zero for absolute indexing).
-.Ed
-.
-.St
-.LP
-.B
-Privacy Message
-.IP \\*(PM\\*(Pt\\*s\\*(ST
-\fIxterm\fP implements no PM functions; \*(Pt is ignored.
-\*(Pt need not be printable characters.
-.Ed
-.
-.SH
-PC-Style Function Keys
-.ds RH Function Keys
-.LP
-If \fIxterm\fP does minimal translation of the function keys, it usually does this
-with a PC-style keyboard, so PC-style function keys result.
-Sun keyboards are similar to PC keyboards.
-Both have cursor and scrolling operations printed on the keypad,
-which duplicate the smaller cursor and scrolling keypads.
-.LP
-X does not predefine NumLock (used for VT220 keyboards) or Alt (used as
-an extension for the Sun/PC keyboards) as modifiers.
-These keys are recognized as modifiers when enabled
-by the \fBnumLock\fP resource,
-or by the DECSET \*1\*0\*3\*5 control sequence.
-.LP
-The cursor keys transmit the following escape sequences depending on the
-mode specified via the \fBDECCKM\fP escape sequence.
-.TS
-center;
-cf3 cf3 cf3
-lf3w(2c) lf3w(2c) lf3w(2c) .
-Key Normal Application
-_
-Cursor Up \*(Cs\*A \*(S3\*A
-Cursor Down \*(Cs\*(cB \*(S3\*(cB
-Cursor Right \*(Cs\*C \*(S3\*C
-Cursor Left \*(Cs\*D \*(S3\*D
-.TE
-.LP
-The application keypad transmits the following escape sequences depending on the
-mode specified via the \fBDECPNM\fP and \fBDECPAM\fP escape sequences.
-Use the NumLock key to override the application mode.
-.LP
-Not all keys are present on the Sun/PC keypad (e.g., PF1, Tab), but are supported by
-the program.
-.TS
-center;
-cf3 cf3 cf3 cf3 cf3
-lf3w(2c) lf3w(2c) lf3w(2c) lf3w(2c) lf3w(2c) .
-Key Numeric Application Terminfo Termcap
-_
-Space \*(Sp \*(S3\*(Sp - -
-Tab \*(Ta \*(S3\*I - -
-Enter \*(Cr \*(S3\*M kent @8
-PF1 \*(S3\*P \*(S3\*P kf1 k1
-PF2 \*(S3\*Q \*(S3\*Q kf2 k2
-PF3 \*(S3\*R \*(S3\*R kf3 k3
-PF4 \*(S3\*S \*(S3\*S kf4 k4
-* \f1(multiply)\fP * \*(S3\*j - -
-+ \f1(add)\fP + \*(S3\*k - -
-, \f1(comma)\fP , \*(S3\*l - -
-- \f1(minus)\fP - \*(S3\*m - -
-\. \f1(Delete)\fP \. \*(S3\*3\*(c~ - -
-/ \f1(divide)\fP / \*(S3\*o - -
-0 \f1(Insert)\fP 0 \*(Cs\*2\*(c~ - -
-1 \f1(End)\fP 1 \*(Cs\*4\*(c~ kc1 K4
-2 \f1(DownArrow)\fP 2 \*(Cs\*(cB - -
-3 \f1(PageDown)\fP 3 \*(Cs\*5\*(c~ kc3 K5
-4 \f1(LeftArrow)\fP 4 \*(Cs\*D - -
-5 \f1(Begin)\fP 5 \*(Cs\*E kb2 K2
-6 \f1(RightArrow)\fP 6 \*(Cs\*C - -
-7 \f1(Home)\fP 7 \*(Cs\*1\*(c~ ka1 K1
-8 \f1(UpArrow)\fP 8 \*(Cs\*A - -
-9 \f1(PageUp)\fP 9 \*(Cs\*5\*(c~ ka3 K3
-= (equal) \&= \*(S3\*(XX - -
-.TE
-They also provide 12 function keys, as well as a few other special-purpose keys.
-.TS
-center;
-cf3 cf3
-lf3w(2c) lf3w(2c) .
-Key Escape Sequence
-_
-F1 \*(S3\*P
-F2 \*(S3\*Q
-F3 \*(S3\*R
-F4 \*(S3\*S
-F5 \*(Cs\*1\*5\*(c~
-F6 \*(Cs\*1\*7\*(c~
-F7 \*(Cs\*1\*8\*(c~
-F8 \*(Cs\*1\*9\*(c~
-F9 \*(Cs\*2\*0\*(c~
-F10 \*(Cs\*2\*1\*(c~
-F11 \*(Cs\*2\*3\*(c~
-F12 \*(Cs\*2\*4\*(c~
-.TE
-.LP
-Older versions of \fIxterm\fP implement different escape sequences for F1 through F4.
-These can be activated by setting the \fIoldXtermFKeys\fP resource.
-However, since they do not correspond to any hardware terminal, they have been deprecated.
-(The DEC VT220 reserves F1 through F5 for local functions such as \fBSetup\fP).
-.TS
-center;
-cf3 cf3
-lf3w(2c) lf3w(2c) .
-Key Escape Sequence
-_
-F1 \*(Cs\*1\*1\*(c~
-F2 \*(Cs\*1\*2\*(c~
-F3 \*(Cs\*1\*3\*(c~
-F4 \*(Cs\*1\*4\*(c~
-.TE
-In normal mode, i.e., a Sun/PC keyboard
-when the \fBsunKeyboard\fP resource is false,
-\fIxterm\fP recognizes function key modifiers
-which are parameters appended before the final character
-of the control sequence.
-.TS
-center;
-cf3 lf3
-cf3w(2c) lf3w(2c) .
-Code Modifiers
-_
-2 Shift
-3 Alt
-4 Shift + Alt
-5 Control
-6 Shift + Control
-7 Alt + Control
-8 Shift + Alt + Control
-.TE
-For example, shift-F5 would be sent as
-\*(Cs\*1\*5\*;\*2\*(c~
-
-If the \fBalwaysUseMods\fP resource is set, the Meta modifier also is
-recognized, making parameters 9 through 16.
-.SH
-VT220-Style Function Keys
-.LP
-However, \fIxterm\fP is most useful as a DEC VT102 or VT220 emulator.
-Set the \fBsunKeyboard\fP resource to true to force a Sun/PC keyboard
-to act like a VT220 keyboard.
-.LP
-The VT102/VT220 application keypad transmits unique escape sequences in
-application mode, which are distinct from the cursor and scrolling keypad:
-.TS
-center;
-cf3 cf3 cf3
-lf3w(2c) lf3w(2c) lf3w(2c) .
-Key Numeric Application
-_
-Space Space \*(S3\*(Sp
-Tab Tab \*(S3\*I
-Enter CR \*(S3\*M
-PF1 \*(S3\*P \*(S3\*P
-PF2 \*(S3\*Q \*(S3\*Q
-PF3 \*(S3\*R \*(S3\*R
-PF4 \*(S3\*S \*(S3\*S
-* \f1(multiply)\fP * \*(S3\*j
-+ \f1(add)\fP + \*(S3\*k
-, \f1(comma)\fP , \*(S3\*l
-- \f1(minus)\fP - \*(S3\*m
-\. \f1(period)\fP \. \*(S3\*n
-/ \f1(divide)\fP / \*(S3\*o
-0 0 \*(S3\*p
-1 1 \*(S3\*q
-2 2 \*(S3\*r
-3 3 \*(S3\*(cs
-4 4 \*(S3\*t
-5 5 \*(S3\*u
-6 6 \*(S3\*v
-7 7 \*(S3\*w
-8 8 \*(S3\*x
-9 9 \*(S3\*y
-= (equal) \&= \*(S3\*(XX
-.TE
-.LP
-The VT220 provides 8 additional function keys.
-With a Sun/PC keyboard, access these keys by Control/F1 for F13, etc.
-.TS
-center;
-cf3 cf3
-lf3w(2c) lf3w(2c) .
-Key Escape Sequence
-_
-F13 \*(Cs\*2\*5\*(c~
-F14 \*(Cs\*2\*6\*(c~
-F15 \*(Cs\*2\*8\*(c~
-F16 \*(Cs\*2\*9\*(c~
-F17 \*(Cs\*3\*1\*(c~
-F18 \*(Cs\*3\*2\*(c~
-F19 \*(Cs\*3\*3\*(c~
-F20 \*(Cs\*3\*4\*(c~
-.TE
-.SH
-VT52-Style Function Keys
-.LP
-A VT52 does not have function keys, but it does have a numeric keypad and cursor keys.
-They differ from the other emulations by the prefix.
-Also, the cursor keys do not change:
-.TS
-center;
-cf3 cf3
-lf3w(2c) lf3w(2c) .
-Key Normal/Application
-_
-Cursor Up \*(Es\*A
-Cursor Down \*(Es\*(cB
-Cursor Right \*(Es\*C
-Cursor Left \*(Es\*D
-.TE
-The keypad is similar:
-.TS
-center;
-cf3 cf3 cf3
-lf3w(2c) lf3w(2c) lf3w(2c) .
-Key Numeric Application
-_
-Space Space \*(Es\*?\*(Sp
-Tab Tab \*(Es\*?\*I
-Enter CR \*(Es\*?\*M
-PF1 \*(Es\*P \*(Es\*P
-PF2 \*(Es\*Q \*(Es\*Q
-PF3 \*(Es\*R \*(Es\*R
-PF4 \*(Es\*S \*(Es\*S
-* \f1(multiply)\fP * \*(Es\*?\*j
-+ \f1(add)\fP + \*(Es\*?\*k
-, \f1(comma)\fP , \*(Es\*?\*l
-- \f1(minus)\fP - \*(Es\*?\*m
-\. \f1(period)\fP \. \*(Es\*?\*n
-/ \f1(divide)\fP / \*(Es\*?\*o
-0 0 \*(Es\*?\*p
-1 1 \*(Es\*?\*q
-2 2 \*(Es\*?\*r
-3 3 \*(Es\*?\*(cs
-4 4 \*(Es\*?\*t
-5 5 \*(Es\*?\*u
-6 6 \*(Es\*?\*v
-7 7 \*(Es\*?\*w
-8 8 \*(Es\*?\*x
-9 9 \*(Es\*?\*y
-= (equal) \&= \*(Es\*?\*(XX
-.TE
-.SH
-Sun-Style Function Keys
-.LP
-The \fIxterm\fP program provides support for Sun keyboards more directly, by
-a menu toggle that causes it to send Sun-style function key codes rather than VT220.
-Note, however, that the \fIsun\fP and \fIvt100\fP emulations are not really
-compatible. For example, their wrap-margin behavior differs.
-.LP
-Only function keys are altered; keypad and cursor keys are the same.
-The emulation responds identically.
-See the xterm-sun terminfo entry for details.
-.SH
-HP-Style Function Keys
-.LP
-Similarly, \fIxterm\fP can be compiled to support HP keyboards.
-See the xterm-hp terminfo entry for details.
-.SH
-Mouse Tracking
-.ds RH Mouse Tracking
-.LP
-The VT widget can be set to send the mouse position and other
-information on button presses. These modes are typically used by
-editors and other full-screen applications that want to make use of
-the mouse.
-
-There are six mutually exclusive modes. One is DEC Locator mode, enabled by the
-DECELR \*(Cs\*(Ps\*s\*;\*(Ps\*s\*s\*'\*s\*z
-control sequence, and is not described here. The remaining five
-modes are each enabled (or disabled) by a different parameter in
-DECSET \*(Cs\*?\*(Pm\*s\*h
-or
-DECRST \*(Cs\*?\*(Pm\*s\*l
-control sequence.
-
-Manifest constants for the parameter values
-are defined in \fBxcharmouse.h\fP as follows:
-.
-.DS B
-#define SET_X10_MOUSE 9
-#define SET_VT200_MOUSE 1000
-#define SET_VT200_HIGHLIGHT_MOUSE 1001
-#define SET_BTN_EVENT_MOUSE 1002
-#define SET_ANY_EVENT_MOUSE 1003
-.DE
-.LP
-The motion reporting modes are strictly \fIxterm\fP extensions, and are not
-part of any standard, though they are analogous to the DEC VT200 DECELR
-locator reports.
-
-Parameters (such as pointer position and button number) for all mouse
-tracking escape sequences generated by \fIxterm\fP
-encode numeric parameters in a single character as
-\fIvalue\fP+32.
-For example, \*! specifies the value 1.
-The upper left character position on the terminal is denoted as 1,1.
-
-X10 compatibility mode sends an escape sequence only on button press,
-encoding the location and the mouse button pressed.
-It is enabled by specifying parameter 9 to DECSET.
-On button press, \fIxterm\fP sends
-\*(Cs\*M\*(Cb\*(Cx\*(Cy (6 characters).
-\*(Cb is button\-1.
-\*(Cx and \*(Cy are the x and y coordinates of the mouse when the
-button was pressed.
-
-Normal tracking mode sends an escape sequence on both button press and
-release. Modifier key (shift, ctrl, meta) information is also sent.
-It is enabled by specifying parameter 1000 to DECSET.
-On button press or release, \fIxterm\fP sends
-\*(Cs\*M\*(Cb\*(Cx\*(Cy.
-The low two bits of \*(Cb encode button information:
-0=MB1 pressed, 1=MB2 pressed, 2=MB3 pressed, 3=release.
-The next three bits encode the modifiers which were down when the button was
-pressed and are added together: 4=Shift, 8=Meta, 16=Control.
-Note however that the shift and control bits are normally unavailable
-because \fIxterm\fP uses the control modifier with mouse for popup menus,
-and the shift modifier is used in the default translations for button events.
-The \fIMeta\fP modifier recognized by \fIxterm\fP is the \fImod1\fP mask,
-and is not necessarily the "Meta" key (see \fIxmodmap\fP).
-\*(Cx and \*(Cy are the x and y coordinates of the mouse event, encoded as
-in X10 mode.
-
-Wheel mice may return buttons 4 and 5.
-Those buttons are represented by adding 64 to the event code.
-
-Mouse hilite tracking notifies a program of a button press, receives a
-range of lines from the program, highlights the region covered by
-the mouse within that range until button release, and then sends the
-program the release coordinates.
-It is enabled by specifying parameter 1001 to DECSET.
-Highlighting is performed only for button 1, though other button events
-can be received.
-\fBWarning:\fP use of this mode requires a cooperating program or it will
-hang \fIxterm.\fP
-On button press, the same information as for normal tracking is
-generated; \fIxterm\fP then waits for the program to send mouse
-tracking information.
-\fIAll X events are ignored until the proper escape sequence is
-received from the pty:\fP
-\*(Cs\*(Ps\*s\*;\*(Ps\*s\*;\*(Ps\*s\*;\*(Ps\*s\*;\*(Ps\*s\*T.
-The parameters are \fIfunc, startx, starty, firstrow,\fP and \fIlastrow.\fP
-\fIfunc\fP is non-zero to initiate hilite tracking and zero to abort.
-\fIstartx\fP and \fIstarty\fP give the starting x and y location for
-the highlighted region. The ending location tracks the mouse, but
-will never be above row \fIfirstrow\fP and will always be above row
-\fIlastrow.\fP (The top of the screen is row 1.)
-When the button is released, \fIxterm\fP reports the ending position
-one of two ways: if the start and end coordinates are valid text
-locations: \*(Cs\*t\*(Cx\*(Cy. If either coordinate is past
-the end of the line:
-\*(Cs\*T\*(Cx\*(Cy\*(Cx\*(Cy\*(Cx\*(Cy.
-The parameters are \fIstartx, starty, endx, endy, mousex,\fP and \fImousey.\fP
-\fIstartx, starty, endx, \fPand\fI endy\fP give the starting and
-ending character positions of the region. \fImousex\fP and \fImousey\fP
-give the location of the mouse at button up, which may not be over a
-character.
-
-Button-event tracking is essentially the same as normal tracking, but
-\fIxterm\fP also reports button-motion events. Motion events
-are reported only if the mouse pointer has moved to a different character
-cell. It is enabled by specifying parameter 1002 to DECSET.
-On button press or release, \fIxterm\fP sends the same codes used by normal
-tracking mode. On button-motion events, \fIxterm\fP adds 32 to the event code
-(the third character, \*(Cb).
-The other bits of the event code specify button and modifier keys as in normal mode.
-For example, motion into cell x,y with button 1
-down is reported as \*(Cs\*M\*@\*(Cx\*(Cy.
-( \*@ = 32 + 0 (button 1) + 32 (motion indicator) ).
-Similarly, motion with button 3
-down is reported as \*(Cs\*M\*(cB\*(Cx\*(Cy.
-( \*(cB = 32 + 2 (button 3) + 32 (motion indicator) ).
-
-Any-event mode is the same as button-event mode, except that all motion
-events are reported instead of just those that enter a new character cell.
-It is enabled by specifying 1003 to DECSET.
-.
-.br
-.ds RH Tektronix 4014 Mode
-.SH
-Tektronix 4014 Mode
-.LP
-Most of these sequences are standard Tektronix 4014 control sequences.
-Graph mode supports the 12-bit addressing of the Tektronix 4014.
-The major features missing are
-the write-through and defocused modes.
-This document does not describe the commands used in the various
-Tektronix plotting modes but does describe the commands to switch modes.
-.St
-.IP \\*(Be
-Bell (Ctrl-G)
-.IP \\*(Bs
-Backspace (Ctrl-H)
-.IP \\*(Ta
-Horizontal Tab (Ctrl-I)
-.IP \\*(Lf
-Line Feed or New Line (Ctrl-J)
-.IP \\*(Vt
-Cursor up (Ctrl-K)
-.IP \\*(Ff
-Form Feed or New Page (Ctrl-L)
-.IP \\*(Cr
-Carriage Return (Ctrl-M)
-.IP \\*(Es\\*(Et
-Switch to VT100 Mode (ESC Ctrl-C)
-.IP \\*(Es\\*(En
-Return Terminal Status (ESC Ctrl-E)
-.IP \\*(Es\\*(Ff
-PAGE (Clear Screen) (ESC Ctrl-L)
-.IP \\*(Es\\*(So
-Begin 4015 APL mode (ignored by \fIxterm\fP) (ESC Ctrl-N)
-.IP \\*(Es\\*(Si
-End 4015 APL mode (ignored by \fIxterm\fP) (ESC Ctrl-O)
-.IP \\*(Es\\*(Eb
-COPY (Save Tektronix Codes to file COPYyyyy-mm-dd.hh:mm:ss) (ESC Ctrl-W)
-.IP \\*(Es\\*(Ca
-Bypass Condition (ESC Ctrl-X)
-.IP \\*(Es\\*(Su
-GIN mode (ESC Ctrl-Z)
-.IP \\*(Es\\*(Fs
-Special Point Plot Mode (ESC Ctrl-\e)
-.IP \\*(Es\\*8
-Select Large Character Set
-.IP \\*(Es\\*9
-Select #2 Character Set
-.IP \\*(Es\\*:
-Select #3 Character Set
-.IP \\*(Es\\*;
-Select Small Character Set
-.IP \\*(Os\\*(Ps\\*s\\*;\\*(Pt\\*s\\*(Be
-Set Text Parameters of VT window
- \*(Ps = \*0 \(-> Change Icon Name and Window Title to \*(Pt
- \*(Ps = \*1 \(-> Change Icon Name to \*(Pt
- \*(Ps = \*2 \(-> Change Window Title to \*(Pt
- \*(Ps = \*4\*6 \(-> Change Log File to \*(Pt (normally disabled by a
-compile-time option)
-.IP \\*(Es\\*`
-Normal Z Axis and Normal (solid) Vectors
-.IP \\*(Es\\*a
-Normal Z Axis and Dotted Line Vectors
-.IP \\*(Es\\*b
-Normal Z Axis and Dot-Dashed Vectors
-.IP \\*(Es\\*c
-Normal Z Axis and Short-Dashed Vectors
-.IP \\*(Es\\*d
-Normal Z Axis and Long-Dashed Vectors
-.IP \\*(Es\\*h
-Defocused Z Axis and Normal (solid) Vectors
-.IP \\*(Es\\*i
-Defocused Z Axis and Dotted Line Vectors
-.IP \\*(Es\\*j
-Defocused Z Axis and Dot-Dashed Vectors
-.IP \\*(Es\\*k
-Defocused Z Axis and Short-Dashed Vectors
-.IP \\*(Es\\*l
-Defocused Z Axis and Long-Dashed Vectors
-.IP \\*(Es\\*p
-Write-Thru Mode and Normal (solid) Vectors
-.IP \\*(Es\\*q
-Write-Thru Mode and Dotted Line Vectors
-.IP \\*(Es\\*r
-Write-Thru Mode and Dot-Dashed Vectors
-.IP \\*(Es\\*(cs
-Write-Thru Mode and Short-Dashed Vectors
-.IP \\*(Es\\*t
-Write-Thru Mode and Long-Dashed Vectors
-.IP \\*(Fs
-Point Plot Mode (Ctrl-\e)
-.IP \\*(Gs
-Graph Mode (Ctrl-])
-.IP \\*(Rs
-Incremental Plot Mode (Ctrl-^)
-.IP \\*(Us
-Alpha Mode (Ctrl-_)
-.Ed
-.
-.
-.br
-.ds RH VT52 Mode
-.SH
-VT52 Mode
-.LP
-Parameters for cursor movement are at the end of the \*(Es\*Y escape sequence.
-Each ordinate is encoded in a single character as \fIvalue\fP+32.
-For example, \*! is 1.
-The screen coodinate system is 0-based.
-.St
-.IP \\*(Es\\*A
-Cursor up.
-.IP \\*(Es\\*(cB
-Cursor down.
-.IP \\*(Es\\*C
-Cursor right.
-.IP \\*(Es\\*D
-Cursor left.
-.IP \\*(Es\\*F
-Enter graphics mode.
-.IP \\*(Es\\*G
-Exit graphics mode.
-.IP \\*(Es\\*H
-Move the cursor to the home position.
-.IP \\*(Es\\*I
-Reverse line feed.
-.IP \\*(Es\\*J
-Erase from the cursor to the end of the screen.
-.IP \\*(Es\\*K
-Erase from the cursor to the end of the line.
-.IP \\*(Es\\*Y\\*(Ps\\*s\\*(Ps
-Move the cursor to given row and column.
-.IP \\*(Es\\*Z
-Identify
- \(-> \*(Es\*s\*/\*s\*Z (``I am a VT52.'')
-.IP \\*(Es\\*=
-Enter alternate keypad mode.
-.IP \\*(Es\\*>
-Exit alternate keypad mode.
-.IP \\*(Es\\*<
-Exit VT52 mode (Enter VT100 mode).
-.Ed
-.
-.if n .pl \n(nlu+1v
diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am
index f250d63f..808ef8ea 100644
--- a/doc/reference/Makefile.am
+++ b/doc/reference/Makefile.am
@@ -19,7 +19,9 @@ DOC_MAIN_SGML_FILE = $(DOC_MODULE)-docs.xml
# gtk-doc will search all .c & .h files beneath here for inline comments
# documenting the functions and macros.
# e.g. DOC_SOURCE_DIR=../../../gtk
-DOC_SOURCE_DIR = ../../src
+DOC_SOURCE_DIR = \
+ $(top_srcdir)/src \
+ $(top_builddir)/src
# Extra options to pass to gtkdoc-scangobj. Not normally needed.
SCANGOBJ_OPTIONS =
@@ -79,12 +81,10 @@ IGNORE_HFILES = \
stamp-vtetypebuiltins.h \
table.h \
trie.h \
- vtebg.h \
vteconv.h \
vtedraw.h \
vteint.h \
vte-private.h \
- vteregex.h \
vterowdata.h \
vteseq-list.h \
vtestream-base.h \
@@ -102,7 +102,7 @@ HTML_IMAGES =
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
content_files = \
- version.xml
+ version.xml
# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
# These files must be listed here *and* in content_files
@@ -123,7 +123,7 @@ GTKDOC_CFLAGS = \
$(VTE_CFLAGS)
GTKDOC_LIBS = \
- $(top_builddir)/src/libvte@VTE_LIBRARY_SUFFIX_U@.la \
+ $(top_builddir)/src/libvte-@VTE_API_VERSION@.la \
$(VTE_LIBS)
# This includes the standard gtk-doc make rules, copied by gtkdocize.
diff --git a/doc/reference/vte-docs.xml b/doc/reference/vte-docs.xml
index e18b52f2..868a44cc 100644
--- a/doc/reference/vte-docs.xml
+++ b/doc/reference/vte-docs.xml
@@ -61,15 +61,6 @@
<chapter>
<xi:include href="xml/vte-version.xml"/>
</chapter>
-
- <chapter id="internal-objects">
- <title>Interna</title>
- <xi:include href="xml/vte-access.xml"/>
- </chapter>
- <chapter id="deprecated-objects">
- <title>Deprecated</title>
- <xi:include href="xml/vte-reaper.xml"/>
- </chapter>
</part>
<chapter id="object-hierarchy">
@@ -101,6 +92,14 @@
<title>Index of new symbols in 0.28</title>
<xi:include href="xml/api-index-0.28.xml"><xi:fallback /></xi:include>
</index>
+ <index id="api-index-0-34" role="0.34">
+ <title>Index of new symbols in 0.34</title>
+ <xi:include href="xml/api-index-0.34.xml"><xi:fallback /></xi:include>
+ </index>
+ <index id="api-index-0-36" role="0.36">
+ <title>Index of new symbols in 0.36</title>
+ <xi:include href="xml/api-index-0.36.xml"><xi:fallback /></xi:include>
+ </index>
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
diff --git a/doc/reference/vte-sections.txt b/doc/reference/vte-sections.txt
index 1a7d821e..8878ef28 100644
--- a/doc/reference/vte-sections.txt
+++ b/doc/reference/vte-sections.txt
@@ -2,25 +2,24 @@
<FILE>vte-terminal</FILE>
<TITLE>VteTerminal</TITLE>
VteTerminal
-VteTerminalAntiAlias
-VteTerminalCursorBlinkMode
-VteTerminalCursorShape
-VteTerminalEraseBinding
-VteTerminalWriteFlags
+VteCursorBlinkMode
+VteCursorShape
+VteEraseBinding
+VteWriteFlags
VteSelectionFunc
vte_terminal_new
-vte_terminal_im_append_menuitems
vte_terminal_feed
vte_terminal_feed_child
vte_terminal_feed_child_binary
-vte_terminal_get_child_exit_status
vte_terminal_select_all
-vte_terminal_select_none
+vte_terminal_unselect_all
vte_terminal_copy_clipboard
vte_terminal_paste_clipboard
vte_terminal_copy_primary
vte_terminal_paste_primary
vte_terminal_set_size
+vte_terminal_set_font_scale
+vte_terminal_get_font_scale
vte_terminal_set_audible_bell
vte_terminal_get_audible_bell
vte_terminal_set_visible_bell
@@ -29,43 +28,25 @@ vte_terminal_set_allow_bold
vte_terminal_get_allow_bold
vte_terminal_set_scroll_on_output
vte_terminal_set_scroll_on_keystroke
-vte_terminal_set_color_bold
+vte_terminal_set_rewrap_on_resize
+vte_terminal_get_rewrap_on_resize
vte_terminal_set_color_bold_rgba
-vte_terminal_set_color_foreground
vte_terminal_set_color_foreground_rgba
-vte_terminal_set_color_background
vte_terminal_set_color_background_rgba
-vte_terminal_set_color_dim
vte_terminal_set_color_dim_rgba
-vte_terminal_set_color_cursor
vte_terminal_set_color_cursor_rgba
-vte_terminal_set_color_highlight
vte_terminal_set_color_highlight_rgba
-vte_terminal_set_colors
+vte_terminal_set_color_highlight_foreground_rgba
vte_terminal_set_colors_rgba
vte_terminal_set_default_colors
-vte_terminal_set_opacity
-vte_terminal_set_background_image
-vte_terminal_set_background_image_file
-vte_terminal_set_background_saturation
-vte_terminal_set_background_transparent
-vte_terminal_set_background_tint_color
-vte_terminal_set_scroll_background
vte_terminal_set_cursor_shape
vte_terminal_get_cursor_shape
-vte_terminal_set_cursor_blinks
vte_terminal_get_cursor_blink_mode
vte_terminal_set_cursor_blink_mode
vte_terminal_set_scrollback_lines
vte_terminal_set_font
-vte_terminal_set_font_from_string
-vte_terminal_set_font_from_string_full
-vte_terminal_set_font_full
vte_terminal_get_font
-vte_terminal_get_using_xft
vte_terminal_get_has_selection
-vte_terminal_set_word_chars
-vte_terminal_is_word_char
vte_terminal_set_backspace_binding
vte_terminal_set_delete_binding
vte_terminal_set_mouse_autohide
@@ -75,21 +56,20 @@ vte_terminal_get_text
vte_terminal_get_text_include_trailing_spaces
vte_terminal_get_text_range
vte_terminal_get_cursor_position
-vte_terminal_match_clear_all
-vte_terminal_match_add
vte_terminal_match_add_gregex
vte_terminal_match_remove
+vte_terminal_match_remove_all
vte_terminal_match_check
vte_terminal_match_set_cursor
vte_terminal_match_set_cursor_type
vte_terminal_match_set_cursor_name
+vte_terminal_set_cjk_ambiguous_width
+vte_terminal_get_cjk_ambiguous_width
vte_terminal_set_emulation
vte_terminal_get_emulation
-vte_terminal_get_default_emulation
vte_terminal_set_encoding
vte_terminal_get_encoding
vte_terminal_get_status_line
-vte_terminal_get_padding
vte_terminal_write_contents
vte_terminal_search_find_next
vte_terminal_search_find_previous
@@ -99,30 +79,29 @@ vte_terminal_search_set_gregex
vte_terminal_search_set_wrap_around
<SUBSECTION>
+vte_get_default_emulation
vte_get_user_shell
<SUBSECTION>
-vte_terminal_fork_command
-vte_terminal_fork_command_full
-vte_terminal_forkpty
+vte_terminal_spawn_sync
vte_terminal_get_pty
-vte_terminal_get_pty_object
-vte_terminal_pty_new
vte_terminal_set_pty
-vte_terminal_set_pty_object
+vte_terminal_pty_new_sync
vte_terminal_watch_child
+<SUBSECTION>
+vte_terminal_get_geometry_hints
+vte_terminal_set_geometry_hints_for_window
+
<SUBSECTION Standard>
-VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE
-vte_terminal_cursor_blink_mode_get_type
-VTE_TYPE_TERMINAL_CURSOR_SHAPE
-vte_terminal_cursor_shape_get_type
-VTE_TYPE_TERMINAL_ERASE_BINDING
-vte_terminal_erase_binding_get_type
-VTE_TYPE_TERMINAL_WRITE_FLAGS
-vte_terminal_write_flags_get_type
-VTE_TYPE_TERMINAL_ANTI_ALIAS
-vte_terminal_anti_alias_get_type
+VTE_TYPE_CURSOR_BLINK_MODE
+vte_cursor_blink_mode_get_type
+VTE_TYPE_CURSOR_SHAPE
+vte_cursor_shape_get_type
+VTE_TYPE_ERASE_BINDING
+vte_erase_binding_get_type
+VTE_TYPE_WRITE_FLAGS
+vte_write_flags_get_type
VTE_TYPE_TERMINAL
vte_terminal_get_type
VTE_IS_TERMINAL
@@ -132,19 +111,16 @@ VTE_IS_TERMINAL_CLASS
VTE_TERMINAL_CLASS
<SUBSECTION Binding Accessors>
-vte_terminal_get_adjustment
-vte_terminal_get_char_ascent
-vte_terminal_get_char_descent
vte_terminal_get_char_height
vte_terminal_get_char_width
vte_terminal_get_column_count
vte_terminal_get_icon_title
vte_terminal_get_row_count
vte_terminal_get_window_title
+vte_terminal_get_current_directory_uri
+vte_terminal_get_current_file_uri
<SUBSECTION Private>
-VTE_IS_TERMINAL_ANTI_ALIAS
-VTE_IS_TERMINAL_ERASE_BINDING
VteCharAttributes
VteTerminalPrivate
VteTerminalClassPrivate
@@ -156,8 +132,8 @@ VteTerminalClassPrivate
VtePtyFlags
VtePtyError
VtePty
-vte_pty_new
-vte_pty_new_foreign
+vte_pty_new_sync
+vte_pty_new_foreign_sync
vte_pty_close
vte_pty_child_setup
vte_pty_get_fd
@@ -195,45 +171,3 @@ VTE_MICRO_VERSION
VTE_CHECK_VERSION
</SECTION>
-
-<SECTION>
-<FILE>vte-access</FILE>
-<TITLE>VteTerminalAccessible</TITLE>
-VteTerminalAccessible
-vte_terminal_accessible_new
-<SUBSECTION Standard>
-VTE_IS_TERMINAL_ACCESSIBLE
-VTE_IS_TERMINAL_ACCESSIBLE_CLASS
-VTE_IS_TERMINAL_ACCESSIBLE_FACTORY
-VTE_IS_TERMINAL_ACCESSIBLE_FACTORY_CLASS
-VTE_TERMINAL_ACCESSIBLE
-VTE_TERMINAL_ACCESSIBLE_CLASS
-VTE_TERMINAL_ACCESSIBLE_FACTORY
-VTE_TERMINAL_ACCESSIBLE_FACTORY_CLASS
-VTE_TERMINAL_ACCESSIBLE_FACTORY_GET_CLASS
-VTE_TERMINAL_ACCESSIBLE_GET_CLASS
-vte_terminal_accessible_get_type
-VTE_TYPE_TERMINAL_ACCESSIBLE
-vte_terminal_accessible_factory_get_type
-VTE_TYPE_TERMINAL_ACCESSIBLE_FACTORY
-VteTerminalAccessibleFactory
-VteTerminalAccessibleFactoryClass
-vte_terminal_accessible_factory_new
-</SECTION>
-
-<SECTION>
-<FILE>vte-reaper</FILE>
-<TITLE>VteReaper</TITLE>
-VteReaper
-vte_reaper_add_child
-vte_reaper_get
-
-<SUBSECTION Standard>
-VTE_IS_REAPER
-VTE_IS_REAPER_CLASS
-VTE_REAPER
-VTE_REAPER_CLASS
-VTE_REAPER_GET_CLASS
-VTE_TYPE_REAPER
-vte_reaper_get_type
-</SECTION>
diff --git a/doc/reference/vte.types b/doc/reference/vte.types
index 83b1aecd..c508837f 100644
--- a/doc/reference/vte.types
+++ b/doc/reference/vte.types
@@ -4,21 +4,15 @@
#include <gtk/gtk.h>
#include "vte.h"
#include "vteversion.h"
-#include "vteaccess.h"
#include "vtepty.h"
#include "vtetypebuiltins.h"
-#include "reaper.h"
vte_pty_get_type
-vte_reaper_get_type
vte_terminal_get_type
-vte_terminal_accessible_get_type
-vte_terminal_accessible_factory_get_type
vte_pty_error_get_type
vte_pty_flags_get_type
-vte_terminal_anti_alias_get_type
-vte_terminal_cursor_blink_mode_get_type
-vte_terminal_cursor_shape_get_type
-vte_terminal_erase_binding_get_type
-vte_terminal_write_flags_get_type
+vte_cursor_blink_mode_get_type
+vte_cursor_shape_get_type
+vte_erase_binding_get_type
+vte_write_flags_get_type
diff --git a/doc/rewrap.txt b/doc/rewrap.txt
new file mode 100644
index 00000000..35bc2c8b
--- /dev/null
+++ b/doc/rewrap.txt
@@ -0,0 +1,448 @@
+╔════════════════╗
+║ VTE rewrapping ║
+╚════════════════╝
+
+as per the feature request and discussions at
+https://bugzilla.gnome.org/show_bug.cgi?id=336238
+
+by Egmont Koblinger and Behdad Esfahbod
+
+
+Overview
+════════
+
+It is a really cool feature if the terminal rewraps long lines when the window
+is resized.
+
+In order to implement this, we need to remember for each line whether we
+advanced to the next because a newline (a.k.a. linefeed) was printed, or
+because the end of line was reached. VTE and most other terminals already
+remember this (even if they don't support rewrap) for copy-paste purposes.
+
+Let's use the following terminology:
+
+A "line" or "row" (these two words are used interchangeably in this document)
+refer to a physical line of the terminal.
+
+A line is "hard wrapped" if it was terminated by an explicit newline. On
+contrary, a line is "soft wrapped" if the text overflowed to the next line.
+
+It's not clear by this definition whether the last line should be defined as
+hard or soft wrapped. It should be irrelevant. The definition also gets
+unclear as soon as we start printing escape codes that move the cursor. E.g.
+should positioning the cursor to the beginning of a previous line and printing
+something there effect the soft or hard wrapped state of the preceding line?
+
+A "paragraph" is one or more lines enclosed between two hard line breaks. That
+is, the line preceding the paragraph is hard wrapped (or we're at the
+beginning of the buffer), all lines of the paragraph except the last are soft
+wrapped, and the last line is hard wrapped (or we're at the end of the buffer,
+in which case it can also be soft wrapped).
+
+
+Specification
+═════════════
+
+Content after rewrapping
+────────────────────────
+
+The basic goal is that if an application prints some continuous stream of text
+(with no cursor positioning escape codes) then after resizing the terminal the
+text should look just as if it was originally printed at the new terminal
+width.
+
+Rewrapping paragraphs containing single width and combining characters only
+should be obvious.
+
+Double width (CJK) characters should not be cut in half. If they don't fit at
+the end of the row, they should overflow to the next, leaving one empty cell
+at the end of the previous line. That empty cell should not be considered when
+copy-pasting the text, nor when rewrapping the text again. This is the same as
+when the CJK text is originally printed.
+
+TAB characters are a nightmare. Even without rewrapping, their behavior is
+weird. You can print arbitrary amount of tabs, the cursor doesn't advance from
+the last column. Then you can print a letter, and the cursor stays just beyond
+the last cell and yet again you can print arbitrary amounts of tabs which do
+nothing. Then the next letter wraps to the next line. So, even without
+rewrapping, copy-pasting tabs around EOL doesn't reproduce the exact same text
+that was printed by the application, tab characters can get dropped. In order
+to "fix" this, we'd need to remember two numbers per line (number of tabs at
+EOL before the last character, and number of tabs at EOL after the last
+character). It's definitely not worth it. Furthermore, there's dynamic tab
+stop positions, and the very last thing we'd want to do is to remember for
+each tab character where the tab stops were when it was printed. So when
+rewrapping, we don't try to rewrap to the state exactly as if the application
+originally printed the text at the new width. If we do anything that's not
+obviously horribly broken then we're okay. (In other words, in this respect
+we're safe to say that tab is a cursor positioning code rather than a
+printable character.)
+
+
+Other generic expectations
+──────────────────────────
+
+Window managers can be configured to resize applications (and hence the VTE
+widget) only once for the final size, and can resize it continuously. It's
+expected that these two should lead to the same result (as much as possible).
+
+Some terminal emulators scroll to the bottom on resize. VTE has traditionally
+been cleverer, it kept the scroll position. I believe it's a nice feature and
+we should try to keep it the same.
+
+It is expected that a small difference in the way you resize the terminal
+shouldn't lead to a big difference in behavior. This is very hard to lay in
+exact specifications, these are rather "common sense" expectations, but I try
+to demonstrate via a couple of examples. If you change the width but all
+paragraphs were and still are shorter than the width, rewrapping shouldn't
+change the scroll offset. If there was only 1 paragraph that needed to be
+rewrapped from one line to two lines, the content shouldn't scroll by more
+than 1 line anywhere on the screen. If you change the height only, the
+behavior would be the same as with old non-rewrapping VTE. In this case the
+rewrapping code is actually skipped (because it's an expensive operation), but
+even if it was executed, the behavior should remain the same.
+
+
+Normal vs alternate screen
+──────────────────────────
+
+The normal screen should always be resized and rewrapped, even if the
+alternate screen is visible (bug 415277). This can occur immediately on each
+resize, or once when returning from the alternate screen. Probably resizing
+immediately gives a better user experience (main bug comment 34), since
+resizing is a heavyweight user-initiated event, while returning from the
+alternate screen is not where the user would expect the terminal to hang for
+some time.
+
+The alternate screen should not be rewrapped. It is used by applications that
+have full control over the entire area and they will repaint it themselves.
+Rewrapping by vte would cause ugly artifacts after vte rewraps but before the
+application catches up, e.g. characters aligned below each other would become
+arranged diagonally for a short while. (Moreover, with current VTE design,
+rewrapping the alternate screen would require many new fds to be used: main
+bug comment 60).
+
+
+Cursor position after rewrapping
+────────────────────────────────
+
+Both the active cursor and the saved cursor should be updated when rewrapping.
+(The saved cursor might be important e.g. when returning from alternate
+screen.)
+
+The cursor should ideally stay over the same character (whenever possible), or
+as "close" to that as possible. If it is over the second cell of a CJK, or in
+the middle of a Tab, it should remain so.
+
+If rewrapping is disabled, the cursor can be anywhere to the right, even
+beyond the right end of the screen. This can occur easily when the window is
+narrowed. But even with rewrapping enabled, there is 1 more valid position
+than the number of columns. E.g. with 80 columns, the cursor can be over the
+1st character, ..., over the 80th character, or beyond the 80th character,
+which are 81 valid horizontal positions; in the latter case the cursor is not
+over a character. We need to distinguish all these positions and keep them
+during rewrap whenever possible.
+
+Let's assume the cursor's old position is not above a character, but at EOL or
+beyond. After rewrapping, we should try to maintain this position, so we
+should walk to the right from the corresponding character if possible.
+However, we should not walk into text that got joined with this line during
+rewrapping a paragraphs, nor should we wrap to next line.
+
+Here are a couple of examples. Imagine the cursor stands in the underlined
+cell (although it's technically an "upper one eighth block" character in the
+cell below in this document). The text printed by applications doesn't contain
+space characters in these examples.
+
+- The cursor is far to the right in a hard wrapped line. Keep that position,
+ no matter if visible or not:
+
+ ▏width 13 ▏ ▏width 20 ▏
+ paragraphend. <-> paragraphend.
+ Newparagraph ▔ Newparagraph ▔
+
+- The cursor is far to the right in a soft wrapped line. That position cannot
+ be maintained, so jump to a character:
+
+ ▏width 11 ▏ ▏width 10 ▏ ▏width 12 ▏
+ blabla12345 -> blabla1234 or blabla123456
+ 67890 ▔ 567890 7890 ▔
+ ▔
+- The cursor is far to the right in a soft wrapped line. That position can be
+ maintained because the next CJK doesn't fix:
+
+ ▏width 11 ▏ ▏width 12 ▏
+ blabla12345 <-> blabla12345
+ 伀 ▔ 伀 ▔
+
+- Wrapping a CJK leaves an empty cell. Also, keep the cursor under the second
+ half:
+
+ ▏width 13 ▏ ▏width 12 ▏
+ blabla12345伀 <-> blabla12345
+ ▔ 伀
+ ▔
+
+Shell prompt
+────────────
+
+If you resize the terminal to be narrower than your shell prompt (plus the
+command you're entering) while the shell is waiting for your command, you see
+weird behavior there. This is not a bug in rewrapping: it's because the shell
+redisplays its prompt (and command line) on every resize. There's not much VTE
+could do here.
+
+As a long term goal, maybe readline could have an option where it knows that
+the terminal rewraps its contents so that it doesn't redisplay the prompt and
+the command line, just expects the terminal to do this correctly. It's a bit
+risky, since probably all terminals that support rewrapping do this a little
+bit differently.
+
+
+Scroll position, cutting lines from the bottom
+──────────────────────────────────────────────
+
+A very tricky question is to figure out the scroll position after a resize.
+First, let's ignore bug 708213's requirements.
+
+Normally the scrollbar is at the bottom. If this is the case, it should remain
+so.
+
+How to position the scroll offset if the scrollbar is somewhere at the middle?
+Playing with various possibilities suggested that probably the best behavior
+is if we try to keep the bottom visible paragraph at the bottom. (After all,
+in terminals the bottom is far more important than the top.) It's not yet
+exactly specified if the bottom of the viewport cuts a paragraph in two, but
+still then we try to keep it approximately there.
+
+The exact implemented behavior is: we look at the character at the cell just
+under the viewport's bottom left corner, keep track where this character moves
+during rewrapping, and position the scrollbar so that this character is again
+just under the viewport.
+
+As an exception, I personally found a "snap to top" feature useful: if the
+scrollbar was all the way at the top, it should stay there.
+
+Now let's address bug 708213.
+
+This breaks the expectation that changing the terminal height back and forth
+should be a no-op. To match XTerm's behavior, when the window height is
+reduced and there are lines under the cursor then those lines should be
+dropped for good.
+
+It is very hard to figure out the desired behavior when this is combined with
+rewrapping. E.g. in one step you decrease the height and would expect lines to
+be dropped from the bottom, but in the very same step you increase the width
+which causes some previously wrapped paragraphs to fit in a single line (this
+could be above or below the cursor or just in the cursor's line, or all of
+these) which makes room for previously undisplayed lines. What to do then?
+
+The total number of rows, the number of rows above the cursor, and the number
+of rows below the cursor can all increase/decrease/stay pretty much
+independently from each other, almost all combinations are possible when
+resizing diagonally with rewrapping enabled. The behavior should also be sane
+when the cursor's paragraph starts wrapping.
+
+As an additional requirement, I had the aforementioned shell prompt feature in
+mind. One of the most typical use cases when the cursor is not in the bottom
+row is when you edit a multiline shell command and move the cursor back. In
+this case, shrinking the terminal shouldn't cut lines from the bottom.
+
+My best idea which reasonably covers all the possible cases is that we drop
+the lines (if necessary) after rewrapping, but before computing the new
+scrollbar offsets, and we drop the highest number of lines that satisfies all
+these three conditions:
+
+ - We shouldn't drop more lines than necessary to fit the content without
+ scrollbars.
+
+ - We should only drop data that's below the cursor's paragraph. (We don't
+ drop data that is under the cursor's row, but belongs to the same
+ paragraph).
+
+ - We track the character cell that immediately follows the cursor's
+ paragraph (that is, the line after this paragraph, first column), and see
+ how much it would get closer to the top of the window (assuming viewport is
+ scrolled to the bottom). The original bug is about that the cursor
+ shouldn't get closer to the top, with rewrapping I found that it's probably
+ not the cursor but the end of the cursor's paragraph that makes sense to
+ track. We shouldn't drop more lines than the amount by which this point
+ would get closer to the top.
+
+
+Implementation
+══════════════
+
+Storing lines
+─────────────
+
+Vte's ring was designed with rewrapping in mind, nevertheless it operates with
+rows. Changing it to work on paragraphs would require heavy refactoring, and
+would cause all sorts of troubles with overlong paragraphs. As the main
+features of terminals (showing content, scrolling etc.) are all built around
+rows, such a change for rewrapping only doesn't sound feasible. It's even
+unclear which approach would be better for a terminal built from scratch. So
+we decided to keep Vte operate with rows. Rewrapping is an expensive operation
+that builds up the notion of paragraphs from rows, and then cuts them to rows
+again.
+
+The scrollback buffer also remains defined in terms of lines, rather than
+paragraphs or memory. This also guarantees that the scrollbar's length cannot
+fluctuate.
+
+
+Ring
+────
+
+The ring contains some of the bottom rows in thawed state, while most of the
+scrollback buffer is frozen. Rewrapping is very complicated so we don't want
+the code to be duplicated. It is also computational heavy and we should try to
+be as fast as possible. Hence we work on frozen data structure in which most
+of the data lies, and we freeze all the rows for this purpose.
+
+The frozen text is stored in UTF-8. Care should be taken that the number of
+visual cells, number of Unicode characters, and number of bytes are three
+different values.
+
+The buffer is stored in three streams: text_stream contains the raw text
+encoded in UTF-8, with '\n' characters at paragraph boundaries; attr_stream
+contains records for each continuous run of identical attributes (same colors,
+character width, etc.) of text_stream (with the exception of '\n' where the
+attribute is ignored, e.g. it can be even embedded in a continuous run of
+double-width CJK characters); and row_stream consists of pointers into
+attr_steam and text_stream for every row. Out of these three, only row_stream
+needs to be regenerated.
+
+We start building up the new row stream beginning at new row number 0. We
+could make it any other arbitrary number, but we wouldn't be able to keep any
+of the old numbers unchanged (neither ring->start because lines can be dropped
+from the scrollback's top when narrowing the window, nor ring->end because we
+have no clue at the beginning how many rows we'll have), so there's no point
+even trying.
+
+
+Rewrapping
+──────────
+
+For higher performance, for each row we store whether it consists of ASCII
+32..126 characters only (excluding tabs too). (The flag can err in the safe
+way: it can be false even if the paragraph is ASCII only.) If a paragraph
+consists solely of such rows, we can rewrap it without looking at text_stream,
+since we know that all characters are stored as a single byte and all occupy a
+single cell.
+
+If it's not the case, we need to look at text_stream to be able to wrap the
+paragraph.
+
+Other than this, rewrapping is long, boring, but straightforward code without
+any further tricks.
+
+
+Markers
+───────
+
+There are some cell positions (I call them markers) that we need to keep track
+of, and tell where they moved during rewrapping. Such markers are the cursor,
+the saved cursor, the cell under the viewport's bottom left corner (for
+computing the new scrollbar offset), the cell under the bottom left corner of
+the cursor's paragraph (for computing the number of lines to get dropped), and
+the boundaries of the highlighted region.
+
+A marker is a (row, column) pair where the row is either within the ring's
+range or in a further row, and the column is arbitrary.
+
+Before rewrapping, if the row is within the ring's range, the (row, column)
+pair is converted to a VteCellTextOffset which contains the text offset,
+fragment_cells denoting how many cells to walk from the first cell of a
+multicell character (i.e. 1 for the right half of a CJK), and eol_cells
+containing -1 if the cursor is over a character, 0 if the cursor is just after
+the last character, or more if the cursor is farther to the right. Example:
+
+ ▏width 24 ▏
+ Line 0 overflowing to LI
+ NE 1 ▔
+
+If the cursor is over 'I' then text_offset is 23, eol_cells is -1.
+If the cursor is just after the 'I' (as shown) then text_offset is 24,
+eol_cells is 0.
+If the cursor is one n more cells further to the right then text_offset is 24,
+eol_cells is n.
+if the cursor is over 'N' then text_offset is 24 and eol_cells is -1.
+If the cursor is over 'E' then text_offset is 25 and eol_cells is -1.
+
+If the row is beyond the range covered by the ring, then text_offset will be
+text_stream's head for the immediate next row, one bigger for next row and so
+on, eol_cells will be set to the desired column, and fragment_cells is 0.
+Pretty much as if the ring continued with empty hard wrapped lines.
+
+After rewrapping, VteCellTextOffset is converted back to (row, column)
+according to the new width and new row numbering. This could be done solely
+based on VteCellTextOffset, but instead we update the row during rewrapping,
+and only compute the column afterwards. This is because we don't have a fast
+way of mapping text_offset to row number, this would require a binary search,
+it's much easier to remember this data when we're there anyway while
+rewrapping.
+
+
+Further optimization
+────────────────────
+
+In row_stream and attr_stream, along with the text offset we could similarly
+store the character offset (a counter that is increased by 1 on every Unicode
+character, in other words what the value of the text offset would be if we
+stored the text in UCS-4 rather than UTF-8).
+
+This, along with the fact that a cell's attribute contains the character
+width, and hence there is an attr change at every boundary where the character
+width changes, would enable us to compute the number of lines for each
+paragraph without looking at text_stream. This could be a huge win, since
+text_stream is by far the biggest of the three streams.
+
+The trick is however that we'd only know the number of lines for the
+paragraph, but not the text offsets for the inner lines. These would have to
+remain in a special uninitialized state in the new row_stream, and be computed
+lazily on demand. For storing that, streams would need to be writable at
+arbitrary positions, rather than just allowing appending of new data.
+
+Care should be taken that this "on demand" includes the case when they are
+being scrolled out from the scrollback buffer for good, because we'd still
+need to be able to tell the text offset for the remaining lines of the
+paragraph.
+
+
+Bugs
+════
+
+With the current design, the top of the scrollback buffer can easily contain a
+partial paragraph. After a subsequent resize, this might lead to the topmost
+row missing its first part. E.g. after executing "ls -l /bin" at width 40 and
+then widening the terminal, the first 40 characters of bash's paragraph can be
+cut off like this, because that used to form a row that got scrolled out:
+
+012 bash
+-rwxr-xr-x 3 root root 31152 Aug 3 2012 bunzip2
+-rwxr-xr-x 1 root root 1999912 Mar 13 2013 busybox
+
+With the current design I can't see any easy and clean workaround for this
+that wouldn't introduce other side effects or terribly complicated code. I'd
+say this is a small glitch we can easily live with.
+
+
+Caveats
+═══════
+
+With extremely large scrollback buffers (let's not forget: VTE supports
+infinite scrollback) rewrapping might become slow. On my computer (average
+laptop with Intel(R) Core(TM) i3 CPU, old-fashioned HDD) resizing 1 million
+lines take about 0.2 seconds wall clock time, this is close to the boundary of
+okay-ish speed. For this reason, rewrapping can be disabled with the
+vte_terminal_set_rewrap_on_resize() api call.
+
+Developers writing Vte-based multi-tab terminal emulators are encouraged to
+resize only the visible Vte, the hidden ones should be resized when they
+become visible. This avoids the time it takes to rewrap the buffer to be
+multiplied by the number of tabs and so block the user for a long
+uninterrupted time when they resize the window. Developers are also encouraged
+to implement a user friendly way of disabling rewrapping if they allow giant
+scrollback buffer.
+
diff --git a/git.mk b/git.mk
index 5ab41bab..2a144a8f 100644
--- a/git.mk
+++ b/git.mk
@@ -1,18 +1,23 @@
# git.mk
#
# Copyright 2009, Red Hat, Inc.
+# Copyright 2010,2011,2012,2013 Behdad Esfahbod
# Written by Behdad Esfahbod
#
# Copying and distribution of this file, with or without modification,
-# are permitted in any medium without royalty provided the copyright
+# is permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
#
-# The canonical source for this file is pango/git.mk, or whereever the
-# header of pango/git.mk suggests in the future.
+# The latest version of this file can be downloaded from:
+# https://raw.github.com/behdad/git.mk/master/git.mk
+# Bugs, etc, should be reported upstream at:
+# https://github.com/behdad/git.mk
#
# To use in your project, import this file in your git repo's toplevel,
# then do "make -f git.mk". This modifies all Makefile.am files in
-# your project to include git.mk.
+# your project to -include git.mk. Remember to add that line to new
+# Makefile.am files you create in your project, or just rerun the
+# "make -f git.mk".
#
# This enables automatic .gitignore generation. If you need to ignore
# more files, add them to the GITIGNOREFILES variable in your Makefile.am.
@@ -22,7 +27,7 @@
#
# The only case that you need to manually add a file to GITIGNOREFILES is
# when remove files in one of mostlyclean-local, clean-local, distclean-local,
-# or maintainer-clean-local.
+# or maintainer-clean-local make targets.
#
# Note that for files like editor backup, etc, there are better places to
# ignore them. See "man gitignore".
@@ -30,18 +35,24 @@
# If "make maintainer-clean" removes the files but they are not recognized
# by this script (that is, if "git status" shows untracked files still), send
# me the output of "git status" as well as your Makefile.am and Makefile for
-# the directories involved.
+# the directories involved and I'll diagnose.
#
# For a list of toplevel files that should be in MAINTAINERCLEANFILES, see
-# pango/Makefile.am.
+# Makefile.am.sample in the git.mk git repo.
#
# Don't EXTRA_DIST this file. It is supposed to only live in git clones,
# not tarballs. It serves no useful purpose in tarballs and clutters the
# build dir.
#
# This file knows how to handle autoconf, automake, libtool, gtk-doc,
-# gnome-doc-utils, intltool.
+# gnome-doc-utils, yelp.m4, mallard, intltool, gsettings, dejagnu.
#
+# This makefile provides the following targets:
+#
+# - all: "make all" will build all gitignore files.
+# - gitignore: makes all gitignore files in the current dir and subdirs.
+# - .gitignore: make gitignore file for the current dir.
+# - gitignore-recurse: makes all gitignore files in the subdirs.
#
# KNOWN ISSUES:
#
@@ -53,13 +64,65 @@
# example.
#
+
+
+###############################################################################
+# Variables user modules may want to add to toplevel MAINTAINERCLEANFILES:
+###############################################################################
+
+#
+# Most autotools-using modules should be fine including this variable in their
+# toplevel MAINTAINERCLEANFILES:
+GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL = \
+ $(srcdir)/aclocal.m4 \
+ $(srcdir)/autoscan.log \
+ $(srcdir)/configure.scan \
+ `AUX_DIR=$(srcdir)/$$($(AUTOCONF) --trace 'AC_CONFIG_AUX_DIR:$$1'); for x in \
+ ar-lib \
+ compile \
+ config.guess \
+ config.sub \
+ depcomp \
+ install-sh \
+ ltmain.sh \
+ missing \
+ mkinstalldirs \
+ ; do echo "$$AUX_DIR/$$x"; done` \
+ `$(AUTOCONF) --trace 'AC_CONFIG_HEADERS:$$1' $(srcdir)/configure.ac | \
+ head -n 1 | while read f; do echo "$(srcdir)/$$f.in"; done`
+#
+# All modules should also be fine including the following variable, which
+# removes automake-generated Makefile.in files:
+GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN = \
+ `$(AUTOCONF) --trace 'AC_CONFIG_FILES:$$1' $(srcdir)/configure.ac | \
+ while read f; do \
+ case $$f in Makefile|*/Makefile) \
+ test -f "$(srcdir)/$$f.am" && echo "$(srcdir)/$$f.in";; esac; \
+ done`
+#
+# Modules that use libtool /and/ use AC_CONFIG_MACRO_DIR([m4]) may also
+# include this:
+GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL = \
+ $(srcdir)/m4/libtool.m4 \
+ $(srcdir)/m4/ltoptions.m4 \
+ $(srcdir)/m4/ltsugar.m4 \
+ $(srcdir)/m4/ltversion.m4 \
+ $(srcdir)/m4/lt~obsolete.m4
+
+
+
+###############################################################################
+# Default rule is to install ourselves in all Makefile.am files:
+###############################################################################
+
git-all: git-mk-install
git-mk-install:
- @echo Installing git makefile
- @any_failed=; find $(top_srcdir) -name Makefile.am | while read x; do \
+ @echo "Installing git makefile"
+ @any_failed=; \
+ find "`test -z "$(top_srcdir)" && echo . || echo "$(top_srcdir)"`" -name Makefile.am | while read x; do \
if grep 'include .*/git.mk' $$x >/dev/null; then \
- echo $$x already includes git.mk; \
+ echo "$$x already includes git.mk"; \
else \
failed=; \
echo "Updating $$x"; \
@@ -71,7 +134,7 @@ git-mk-install:
mv $$x.tmp $$x || failed=1; \
fi; \
if test x$$failed = x; then : else \
- echo Failed updating $$x; >&2 \
+ echo "Failed updating $$x"; >&2 \
any_failed=1; \
fi; \
fi; done; test -z "$$any_failed"
@@ -79,11 +142,14 @@ git-mk-install:
.PHONY: git-all git-mk-install
-### .gitignore generation
+
+###############################################################################
+# Actual .gitignore generation:
+###############################################################################
$(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
- $(AM_V_GEN) \
- { \
+ @echo "git.mk: Generating $@"
+ @{ \
if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \
for x in \
$(DOC_MODULE)-decl-list.txt \
@@ -91,35 +157,62 @@ $(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
tmpl/$(DOC_MODULE)-unused.sgml \
"tmpl/*.bak" \
xml html \
- ; do echo /$$x; done; \
+ ; do echo "/$$x"; done; \
fi; \
- if test "x$(DOC_MODULE)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \
+ if test "x$(DOC_MODULE)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \
+ for lc in $(DOC_LINGUAS); do \
+ for x in \
+ $(if $(DOC_MODULE),$(DOC_MODULE).xml) \
+ $(DOC_PAGES) \
+ $(DOC_INCLUDES) \
+ ; do echo "/$$lc/$$x"; done; \
+ done; \
for x in \
- $(_DOC_C_DOCS) \
- $(_DOC_LC_DOCS) \
$(_DOC_OMF_ALL) \
$(_DOC_DSK_ALL) \
$(_DOC_HTML_ALL) \
- $(_DOC_POFILES) \
+ $(_DOC_MOFILES) \
+ $(DOC_H_FILE) \
"*/.xml2po.mo" \
"*/*.omf.out" \
; do echo /$$x; done; \
fi; \
+ if test "x$(HELP_ID)" = x -o "x$(HELP_LINGUAS)" = x; then :; else \
+ for lc in $(HELP_LINGUAS); do \
+ for x in \
+ $(HELP_FILES) \
+ "$$lc.stamp" \
+ "$$lc.mo" \
+ ; do echo "/$$lc/$$x"; done; \
+ done; \
+ fi; \
+ if test "x$(gsettings_SCHEMAS)" = x; then :; else \
+ for x in \
+ $(gsettings_SCHEMAS:.xml=.valid) \
+ $(gsettings__enum_file) \
+ ; do echo "/$$x"; done; \
+ fi; \
if test -f $(srcdir)/po/Makefile.in.in; then \
for x in \
po/Makefile.in.in \
+ po/Makefile.in.in~ \
po/Makefile.in \
po/Makefile \
+ po/Makevars.template \
po/POTFILES \
+ po/Rules-quot \
po/stamp-it \
po/.intltool-merge-cache \
"po/*.gmo" \
+ "po/*.header" \
"po/*.mo" \
+ "po/*.sed" \
+ "po/*.sin" \
po/$(GETTEXT_PACKAGE).pot \
intltool-extract.in \
intltool-merge.in \
intltool-update.in \
- ; do echo /$$x; done; \
+ ; do echo "/$$x"; done; \
fi; \
if test -f $(srcdir)/configure; then \
for x in \
@@ -129,21 +222,33 @@ $(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
stamp-h1 \
libtool \
config.lt \
- ; do echo /$$x; done; \
+ ; do echo "/$$x"; done; \
+ fi; \
+ if test "x$(DEJATOOL)" = x; then :; else \
+ for x in \
+ $(DEJATOOL) \
+ ; do echo "/$$x.sum"; echo "/$$x.log"; done; \
+ echo /site.exp; \
+ fi; \
+ if test "x$(am__dirstamp)" = x; then :; else \
+ echo "$(am__dirstamp)"; \
+ fi; \
+ if test "x$(LTCOMPILE)" = x; then :; else \
+ for x in \
+ "*.lo" \
+ ".libs" "_libs" \
+ ; do echo "$$x"; done; \
fi; \
for x in \
.gitignore \
$(GITIGNOREFILES) \
$(CLEANFILES) \
- $(PROGRAMS) \
- $(check_PROGRAMS) \
- $(EXTRA_PROGRAMS) \
- $(LTLIBRARIES) \
+ $(PROGRAMS) $(check_PROGRAMS) $(EXTRA_PROGRAMS) \
+ $(LIBRARIES) $(check_LIBRARIES) $(EXTRA_LIBRARIES) \
+ $(LTLIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LTLIBRARIES) \
so_locations \
- .libs _libs \
$(MOSTLYCLEANFILES) \
"*.$(OBJEXT)" \
- "*.lo" \
$(DISTCLEANFILES) \
$(am__CONFIG_DISTCLEAN_FILES) \
$(CONFIG_CLEAN_FILES) \
@@ -159,7 +264,8 @@ $(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
"*.bak" \
"*~" \
".*.sw[nop]" \
- ; do echo /$$x; done; \
+ ".dirstamp" \
+ ; do echo "/$$x"; done; \
} | \
sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \
sed 's@/[.]/@/@g' | \
@@ -167,18 +273,19 @@ $(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
mv $@.tmp $@;
all: $(srcdir)/.gitignore gitignore-recurse-maybe
+gitignore: $(srcdir)/.gitignore gitignore-recurse
+
gitignore-recurse-maybe:
- @if test "x$(SUBDIRS)" = "x$(DIST_SUBDIRS)"; then :; else \
- $(MAKE) $(AM_MAKEFLAGS) gitignore-recurse; \
- fi;
-gitignore-recurse:
@for subdir in $(DIST_SUBDIRS); do \
case " $(SUBDIRS) " in \
*" $$subdir "*) :;; \
- *) test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse || echo "Skipping $$subdir");; \
+ *) test "$$subdir" = . -o -e "$$subdir/.git" || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) gitignore || echo "Skipping $$subdir");; \
esac; \
done
-gitignore: $(srcdir)/.gitignore gitignore-recurse
+gitignore-recurse:
+ @for subdir in $(DIST_SUBDIRS); do \
+ test "$$subdir" = . -o -e "$$subdir/.git" || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) gitignore || echo "Skipping $$subdir"); \
+ done
maintainer-clean: gitignore-clean
gitignore-clean:
diff --git a/glade/Makefile.am b/glade/Makefile.am
index 151f9855..372652a9 100644
--- a/glade/Makefile.am
+++ b/glade/Makefile.am
@@ -1,8 +1,8 @@
NULL =
cataloguedir = $(GLADE_CATALOGUE_DIR)
-catalogue_in_files = vte.xml.in
-catalogue_DATA = $(catalogue_in_files:.xml.in=.xml)
+catalogue_in_files = vte.xml.in.in
+catalogue_DATA = $(catalogue_in_files:.xml.in.in=.xml)
icons = \
hicolor_actions_16x16_widget-vte-terminal.png \
@@ -10,7 +10,6 @@ icons = \
$(NULL)
EXTRA_DIST = \
- $(catalogue_DATA) \
$(icons) \
$(NULL)
diff --git a/glade/vte.xml.in b/glade/vte.xml.in.in
index 263ec899..8371bacd 100644
--- a/glade/vte.xml.in
+++ b/glade/vte.xml.in.in
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<glade-catalog name="vte" library="vte" domain="vte" depends="gtk+" book="vte" supports="gtkbuilder">
+<glade-catalog name="vte" library="vte-@VTE_API_VERSION@" domain="vte-@VTE_API_VERSION@" depends="gtk+" book="vte" supports="gtkbuilder">
<glade-widget-classes>
<glade-widget-class title="VTE Terminal" name="VteTerminal" generic-name="terminal">
<properties>
@@ -27,7 +27,6 @@
<property id="scroll-on-keystroke" />
<property id="scroll-on-output" />
<property id="window-title" />
- <property id="word-chars" />
<property id="visible-bell" />
</properties>
</glade-widget-class>
diff --git a/gnome-pty-helper/COPYING b/gnome-pty-helper/COPYING
index eb685a5e..4362b491 100644
--- a/gnome-pty-helper/COPYING
+++ b/gnome-pty-helper/COPYING
@@ -1,112 +1,125 @@
- GNU LIBRARY GENERAL PUBLIC LICENSE
- Version 2, June 1991
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
- Copyright (C) 1991 Free Software Foundation, Inc.
- 675 Mass Ave, Cambridge, MA 02139, USA
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
-[This is the first released version of the library GPL. It is
- numbered 2 because it goes with version 2 of the ordinary GPL.]
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
- Preamble
+ Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
- This license, the Library General Public License, applies to some
-specially designated Free Software Foundation software, and to any
-other libraries whose authors decide to use it. You can use it for
-your libraries, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if
-you distribute copies of the library, or if you modify it.
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
-code. If you link a program with the library, you must provide
-complete object files to the recipients so that they can relink them
-with the library, after making changes to the library and recompiling
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
- Our method of protecting your rights has two steps: (1) copyright
-the library, and (2) offer you this license which gives you legal
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
- Also, for each distributor's protection, we want to make certain
-that everyone understands that there is no warranty for this free
-library. If the library is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original
-version, so that any problems introduced by others will not reflect on
-the original authors' reputations.
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that companies distributing free
-software will individually obtain patent licenses, thus in effect
-transforming the program into proprietary software. To prevent this,
-we have made it clear that any patent must be licensed for everyone's
-free use or not licensed at all.
-
- Most GNU software, including some libraries, is covered by the ordinary
-GNU General Public License, which was designed for utility programs. This
-license, the GNU Library General Public License, applies to certain
-designated libraries. This license is quite different from the ordinary
-one; be sure to read it in full, and don't assume that anything in it is
-the same as in the ordinary license.
-
- The reason we have a separate public license for some libraries is that
-they blur the distinction we usually make between modifying or adding to a
-program and simply using it. Linking a program with a library, without
-changing the library, is in some sense simply using the library, and is
-analogous to running a utility program or application program. However, in
-a textual and legal sense, the linked executable is a combined work, a
-derivative of the original library, and the ordinary General Public License
-treats it as such.
-
- Because of this blurred distinction, using the ordinary General
-Public License for libraries did not effectively promote software
-sharing, because most developers did not use the libraries. We
-concluded that weaker conditions might promote sharing better.
-
- However, unrestricted linking of non-free programs would deprive the
-users of those programs of all benefit from the free status of the
-libraries themselves. This Library General Public License is intended to
-permit developers of non-free programs to use free libraries, while
-preserving your freedom as a user of such programs to change the free
-libraries that are incorporated in them. (We have not seen how to achieve
-this as regards changes in header files, but we have achieved it as regards
-changes in the actual functions of the Library.) The hope is that this
-will lead to faster development of free libraries.
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, while the latter only
-works together with the library.
-
- Note that it is possible for a library to be covered by the ordinary
-General Public License rather than by this special one.
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
- GNU LIBRARY GENERAL PUBLIC LICENSE
+ GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
- 0. This License Agreement applies to any software library which
-contains a notice placed by the copyright holder or other authorized
-party saying it may be distributed under the terms of this Library
-General Public License (also called "this License"). Each licensee is
-addressed as "you".
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
@@ -133,7 +146,7 @@ such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
-
+
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
@@ -255,7 +268,7 @@ distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
- 6. As an exception to the Sections above, you may also compile or
+ 6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
@@ -282,23 +295,31 @@ of these things:
Library will not necessarily be able to recompile the application
to use the modified definitions.)
- b) Accompany the work with a written offer, valid for at
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
- c) If distribution of the work is made by offering access to copy
+ d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
- d) Verify that the user has already received a copy of these
+ e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
-the source code distributed need not include anything that is normally
-distributed (in either source or binary form) with the major
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
@@ -347,7 +368,7 @@ Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
+You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
@@ -390,7 +411,7 @@ excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
-versions of the Library General Public License from time to time.
+versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
@@ -411,7 +432,7 @@ decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
- NO WARRANTY
+ NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
@@ -434,9 +455,9 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
- END OF TERMS AND CONDITIONS
+ END OF TERMS AND CONDITIONS
- Appendix: How to Apply These Terms to Your New Libraries
+ How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
@@ -453,18 +474,18 @@ convey the exclusion of warranty; and each file should have at least the
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
+ modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
+ version 2.1 of the License, or (at your option) any later version.
This library 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
- Library General Public License for more details.
+ Lesser General Public License for more details.
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
diff --git a/gnome-pty-helper/Makefile.am b/gnome-pty-helper/Makefile.am
index bb54503d..10a1c896 100644
--- a/gnome-pty-helper/Makefile.am
+++ b/gnome-pty-helper/Makefile.am
@@ -7,6 +7,9 @@ gnome_pty_helper_SOURCES = \
gnome-pty-helper.c \
gnome-utmp.c
+gnome_pty_helper_CFLAGS = $(SUID_CFLAGS) $(AM_CFLAGS)
+gnome_pty_helper_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS)
+
install-exec-hook:
chown root.utmp $(DESTDIR)$(libexecdir)/gnome-pty-helper || true
chmod g+s $(DESTDIR)$(libexecdir)/gnome-pty-helper || true
diff --git a/gnome-pty-helper/configure.in b/gnome-pty-helper/configure.in
index 73a400ed..16940ea8 100644
--- a/gnome-pty-helper/configure.in
+++ b/gnome-pty-helper/configure.in
@@ -45,6 +45,11 @@ case $host in
;;
esac
+AC_ARG_VAR([SUID_CFLAGS],
+ [CFLAGS used for binaries which are usually with the suid bit])
+AC_ARG_VAR([SUID_LDFLAGS],
+ [LDFLAGS used for binaries which are usually with the suid bit])
+
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
diff --git a/perf/Makefile.am b/perf/Makefile.am
index 5a3bf66d..35ba00d7 100644
--- a/perf/Makefile.am
+++ b/perf/Makefile.am
@@ -1,5 +1,11 @@
EXTRA_DIST = \
UTF-8-demo.txt \
- vim.sh scroll.vim
+ img.sh \
+ inc.sh \
+ random.sh \
+ scroll.vim \
+ utf8.sh \
+ vim.sh \
+ $(NULL)
-include $(top_srcdir)/git.mk
diff --git a/perf/img.sh b/perf/img.sh
new file mode 100755
index 00000000..5756d2aa
--- /dev/null
+++ b/perf/img.sh
@@ -0,0 +1,71 @@
+#!/usr/bin/env bash
+
+# Image viewer for terminals that support true colors.
+# Copyright (C) 2014 Egmont Koblinger
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+if [ $# != 1 -o "$1" = "--help" ]; then
+ echo 'Usage: img.sh imagefile' >&2
+ exit 1
+elif [ -z $(type -p convert) ]; then
+ echo 'Please install ImageMagick to run this script.' >&2
+ exit 1
+fi
+
+# This is so that "upper" is still visible after exiting the while loop.
+shopt -s lastpipe
+
+COLUMNS=$(tput cols)
+
+declare -a upper lower
+upper=()
+lower=()
+
+convert -thumbnail ${COLUMNS}x "$1" txt:- |
+while IFS=',:() ' read col row dummy red green blue rest; do
+ if [ "$col" = "#" ]; then
+ continue
+ fi
+
+ if [ $((row%2)) = 0 ]; then
+ upper[$col]="$red;$green;$blue"
+ else
+ lower[$col]="$red;$green;$blue"
+ fi
+
+ # After reading every second image row, print them out.
+ if [ $((row%2)) = 1 -a $col = $((COLUMNS-1)) ]; then
+ i=0
+ while [ $i -lt $COLUMNS ]; do
+ echo -ne "\\e[38;2;${upper[$i]};48;2;${lower[$i]}m▀"
+ i=$((i+1))
+ done
+ # \e[K is useful when you resize the terminal while this script is still running.
+ echo -e "\\e[0m\e[K"
+ upper=()
+ d=()
+ fi
+done
+
+# Print the last half line, if required.
+if [ "${upper[0]}" != "" ]; then
+ i=0
+ while [ $i -lt $COLUMNS ]; do
+ echo -ne "\\e[38;2;${upper[$i]}m▀"
+ i=$((i+1))
+ done
+ echo -e "\\e[0m\e[K"
+fi
diff --git a/perf/inc.sh b/perf/inc.sh
index fcd3e7c3..ab88c906 100755
--- a/perf/inc.sh
+++ b/perf/inc.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
cnt=$1
[ -n "$cnt" ] || cnt=500000
diff --git a/po/LINGUAS b/po/LINGUAS
index b5b83d5a..c1c7a36b 100644
--- a/po/LINGUAS
+++ b/po/LINGUAS
@@ -1,7 +1,6 @@
# please keep this list sorted alphabetically
#
am
-an
ang
ar
as
@@ -31,6 +30,7 @@ eu
fa
fi
fr
+fur
ga
gl
gu
@@ -80,10 +80,12 @@ sr@latin
sv
ta
te
+tg
th
tr
ug
uk
+uz@cyrillic
vi
wa
xh
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 257e69cb..d278756e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,6 +1,5 @@
src/iso2022.c
src/pty.c
-src/reaper.c
src/trie.c
src/vteapp.c
src/vte.c
diff --git a/po/an.po b/po/an.po
deleted file mode 100644
index df491374..00000000
--- a/po/an.po
+++ /dev/null
@@ -1,87 +0,0 @@
-# Aragonese translation for vte.
-# Copyright (C) 2011 vte's COPYRIGHT HOLDER
-# This file is distributed under the same license as the vte package.
-# Daniel Martinez Cucalon <entaltoaragon@gmail.com>, 2011.
-# FULL NAME <EMAIL@ADDRESS>, 2011.
-#
-msgid ""
-msgstr ""
-"Project-Id-Version: vte master\n"
-"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
-"product=vte&keywords=I18N+L10N&component=general\n"
-"POT-Creation-Date: 2011-04-25 23:03+0000\n"
-"PO-Revision-Date: 2011-05-09 18:20+0200\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: Aragonese <softaragones@googlegroups.com>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-#: ../src/iso2022.c:779 ../src/iso2022.c:787 ../src/iso2022.c:818
-#: ../src/vte.c:2279
-#, c-format
-msgid "Unable to convert characters from %s to %s."
-msgstr "No se pueden convertir caracters de %s a %s."
-
-#: ../src/iso2022.c:1472
-#, c-format
-msgid "Attempt to set invalid NRC map '%c'."
-msgstr "S'ha prebau de definir un mapa NRC no valido \"%c\"."
-
-#. Application signalled an "identified coding system" we haven't heard of. See ECMA-35 for gory details.
-#: ../src/iso2022.c:1502
-msgid "Unrecognized identified coding system."
-msgstr "Sistema de codificacion identificau no reconoxiu."
-
-#: ../src/iso2022.c:1561 ../src/iso2022.c:1588
-#, c-format
-msgid "Attempt to set invalid wide NRC map '%c'."
-msgstr "S'ha prebau de definir un amplo no valido en o mapa NRC \"%c\"."
-
-#: ../src/trie.c:409
-#, c-format
-msgid "Duplicate (%s/%s)!"
-msgstr "Duplicau (%s/%s)"
-
-#. Bail back to normal mode.
-#: ../src/vteapp.c:981
-msgid "Could not open console.\n"
-msgstr "No s'ha puesto ubrir a consola.\n"
-
-#: ../src/vteapp.c:1077
-msgid "Could not parse the geometry spec passed to --geometry"
-msgstr ""
-"No s'ha puesto analizar a especificacion de cheometria pasada a --geometry"
-
-#: ../src/vte.c:1305
-#, c-format
-msgid "Error compiling regular expression \"%s\"."
-msgstr "Error en compilar a expresion regular \"%s\"."
-
-#. Translators: %s is replaced with error message returned by strerror().
-#: ../src/vte.c:4593
-#, c-format
-msgid "Error reading from child: %s."
-msgstr "Error en leyer dende o fillo: %s."
-
-#: ../src/vte.c:4720
-msgid "Unable to send data to child, invalid charset convertor"
-msgstr ""
-"No se pueden ninviar os datos a lo fillo, conversor de codigos de caracters "
-"invalido"
-
-#: ../src/vte.c:4731 ../src/vte.c:5793
-#, c-format
-msgid "Error (%s) converting data for child, dropping."
-msgstr "Error (%s) en convertir datos dende o fillo, omitiendo."
-
-#: ../src/vte.c:7978
-#, c-format
-msgid "Error reading PTY size, using defaults: %s\n"
-msgstr ""
-"Error en leyer o tamanyo PTY, fendo servir as valuras predeterminadas: %s.\n"
-
-#. Aaargh. We're screwed.
-#: ../src/vte.c:13796
-msgid "_vte_conv_open() failed setting word characters"
-msgstr "Error en _vte_conv_open() al establir os caracters d'a parola"
diff --git a/po/as.po b/po/as.po
index 96edc9c3..1e7f6d9c 100644
--- a/po/as.po
+++ b/po/as.po
@@ -6,9 +6,9 @@
msgid ""
msgstr ""
"Project-Id-Version: as\n"
-"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug."
-"cgi?product=vte&component=general\n"
-"POT-Creation-Date: 2010-03-17 17:23+0000\n"
+"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
+"product=vte&keywords=I18N+L10N&component=general\n"
+"POT-Creation-Date: 2011-08-17 06:08+0000\n"
"PO-Revision-Date: 2011-03-14 18:17+0000\n"
"Last-Translator: Nilamdyuti Goswami <ngoswami@redhat.com>\n"
"Language-Team: Assamese <kde-i18n-doc@kde.org>\n"
@@ -18,77 +18,70 @@ msgstr ""
"X-Generator: Lokalize 1.0\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
-#: ../src/iso2022.c:771 ../src/iso2022.c:779 ../src/iso2022.c:810
-#: ../src/vte.c:2232
+#: ../src/iso2022.c:779 ../src/iso2022.c:787 ../src/iso2022.c:818
+#: ../src/vte.c:2279
#, c-format
msgid "Unable to convert characters from %s to %s."
-msgstr "%s ৰ পৰা %s লৈ অক্ষৰ ৰূপান্তৰ কৰিবলৈ ব্যৰ্থ ।"
+msgstr "%s ৰ পৰা %s লৈ আখৰ ৰূপান্তৰ কৰিবলৈ ব্যৰ্থ।"
-#: ../src/iso2022.c:1464
+#: ../src/iso2022.c:1472
#, c-format
msgid "Attempt to set invalid NRC map '%c'."
-msgstr "অবৈধ NRC মেপ '%c' নিৰ্ধাৰণৰ প্ৰচেষ্টা কৰা হৈছে ।"
+msgstr "অবৈধ NRC মেপ '%c' নিৰ্ধাৰণৰ প্ৰচেষ্টা কৰা হৈছে।"
#. Application signalled an "identified coding system" we haven't heard of. See ECMA-35 for gory details.
-#: ../src/iso2022.c:1494
+#: ../src/iso2022.c:1502
msgid "Unrecognized identified coding system."
-msgstr "চিনাক্ত কৰা কোডিং প্ৰণালী অজ্ঞাত ।"
+msgstr "অজ্ঞাত পৰিচিত কোডিং প্ৰণালী।"
-#: ../src/iso2022.c:1553 ../src/iso2022.c:1580
+#: ../src/iso2022.c:1561 ../src/iso2022.c:1588
#, c-format
msgid "Attempt to set invalid wide NRC map '%c'."
-msgstr "অবৈধ প্ৰশস্ত NRC মেপ '%c' নিৰ্ধাৰণৰ প্ৰচেষ্টা কৰা হৈছে ।"
-
-#. Give the user some clue as to why session logging is not
-#. * going to work (assuming we can open a pty using some other
-#. * method).
-#: ../src/pty.c:1073 ../src/pty.c:1076
-#, c-format
-msgid "can not run %s"
-msgstr "%s চলাওঁতে ব্যৰ্থ"
+msgstr "অবৈধ প্ৰশস্ত NRC মেপ '%c' নিৰ্ধাৰণৰ প্ৰচেষ্টা কৰা হৈছে।"
#: ../src/trie.c:409
#, c-format
msgid "Duplicate (%s/%s)!"
-msgstr "দ্বৈত (%s/%s)!"
+msgstr "প্ৰতিলিপি (%s/%s)!"
#. Bail back to normal mode.
-#: ../src/vteapp.c:876
+#: ../src/vteapp.c:981
msgid "Could not open console.\n"
-msgstr "কন্সোল খুলিবলৈ ব্যৰ্থ ।\n"
+msgstr "কনচল খোলিব নোৱাৰি।\n"
-#: ../src/vteapp.c:967
+#: ../src/vteapp.c:1077
msgid "Could not parse the geometry spec passed to --geometry"
-msgstr "--geometry বিকল্পৰ সৈতে প্ৰেৰিত geometry spec বিশ্লেষণ কৰিবলৈ বিফল"
+msgstr "--geometry বিকল্পৰ সৈতে প্ৰেৰিত geometry spec বিশ্লেষণ কৰিব নোৱাৰি"
-#: ../src/vte.c:1279
+#: ../src/vte.c:1305
#, c-format
msgid "Error compiling regular expression \"%s\"."
-msgstr "ৰেগুলাৰ এক্সপ্ৰেশন \"%s\" কম্পাইল কৰিবলৈ সমস্যা ।"
+msgstr "সাধাৰণ অভিব্যক্তি \"%s\" কম্পাইল কৰোতে ত্ৰুটি।"
#. Translators: %s is replaced with error message returned by strerror().
-#: ../src/vte.c:4344
+#: ../src/vte.c:4593
#, c-format
msgid "Error reading from child: %s."
-msgstr "চাইল্ডৰ পৰা পঢ়িবলৈ সমস্যা: %s ।"
+msgstr "ছাইল্ডৰ পৰা পঢ়োতে ত্ৰুটি: %s।"
-#: ../src/vte.c:4472
+#: ../src/vte.c:4720
msgid "Unable to send data to child, invalid charset convertor"
-msgstr "অবৈধ charset ৰূপান্তৰৰ ফলত চাইল্ডত তথ্য প্ৰেৰণ কৰিবলৈ ব্যৰ্থ"
+msgstr "ছাইল্ডলে তথ্য পঠাবলে অক্ষম, অবৈধ আখৰ পৰিৱৰ্তক"
-#: ../src/vte.c:4483 ../src/vte.c:5505
+#: ../src/vte.c:4731 ../src/vte.c:5793
#, c-format
msgid "Error (%s) converting data for child, dropping."
-msgstr "চাইল্ডৰ বাবে তথ্য ৰূপান্তৰ কৰিবলৈ সমস্যা (%s), বৰ্জন কৰা হৈছে ।"
+msgstr "ছাইল্ডৰ বাবে তথ্য ৰূপান্তৰ কৰোতে ত্ৰুটি (%s), বৰ্জন কৰা হৈছে।"
-#: ../src/vte.c:7726
+#: ../src/vte.c:7978
#, c-format
-#| msgid "Error reading PTY size, using defaults: %s."
msgid "Error reading PTY size, using defaults: %s\n"
-msgstr "PTY -ৰ আকাৰ পঢ়িবলৈ সমস্যা, অবিকল্পিত মান ব্যবহাৰ কৰা হৈছে: %s\n"
+msgstr "PTY -ৰ আকাৰ পঢ়োতে ত্ৰুটি, অবিকল্পিত মান ব্যবহাৰ কৰা হৈছে: %s\n"
#. Aaargh. We're screwed.
-#: ../src/vte.c:13281
+#: ../src/vte.c:13796
msgid "_vte_conv_open() failed setting word characters"
-msgstr "_vte_conv_open() দ্বাৰা শব্দৰ অক্ষৰ নিৰ্ধাৰণ কৰিবলৈ ব্যৰ্থ"
+msgstr "_vte_conv_open() শব্দৰ আখৰ নিৰ্ধাৰণ কৰিবলৈ ব্যৰ্থ হল"
+#~ msgid "can not run %s"
+#~ msgstr "%s চলাওঁতে ব্যৰ্থ"
diff --git a/po/be.po b/po/be.po
index 65872916..0997b18b 100644
--- a/po/be.po
+++ b/po/be.po
@@ -1,149 +1,83 @@
-# translation of vte.HEAD.be.po to Belarusian
-# translation of vte.gnome-2-2.po to belarusian
-# This file is distributed under the same license as the PACKAGE package.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# Vital Khilko <dojlid@mova.org>, 2003
+# Vital Khilko <dojlid@mova.org>, 2003.
+# Ihar Hrachyshka <ihar.hrachyshka@gmail.com>, 2007, 2011.
#
msgid ""
msgstr ""
-"Project-Id-Version: vte.HEAD.be\n"
+"Project-Id-Version: vte.master\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-03-01 21:17+0200\n"
-"PO-Revision-Date: 2007-03-01 21:18+0300\n"
+"POT-Creation-Date: 2011-09-04 19:30+0300\n"
+"PO-Revision-Date: 2011-09-04 19:30+0300\n"
"Last-Translator: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>\n"
-"Language-Team: Belarusian <i18n@mova.org>\n"
+"Language-Team: Belarusian <i18n-bel-googlegroups.com>\n"
+"Language: be\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: KBabel 0.9.6\n"
-#: ../src/iso2022.c:784
-#: ../src/iso2022.c:792
-#: ../src/iso2022.c:823
-#: ../src/vte.c:1776
+#: ../src/iso2022.c:779 ../src/iso2022.c:787 ../src/iso2022.c:818
+#: ../src/vte.c:2279
#, c-format
msgid "Unable to convert characters from %s to %s."
-msgstr "Немагчыма пераўтварыць знакі з %s у %s."
+msgstr "Не ўдалося пераўтварыць знакі з %s у %s."
-#: ../src/iso2022.c:1532
+#: ../src/iso2022.c:1472
#, c-format
msgid "Attempt to set invalid NRC map '%c'."
-msgstr "Спроба ўсталяваць недапушчальную NRC мапу '%c'."
+msgstr "Спроба ўжыць хібную NRC-карту \"%c\"."
#. Application signalled an "identified coding system" we haven't heard of. See ECMA-35 for gory details.
-#: ../src/iso2022.c:1562
+#: ../src/iso2022.c:1502
msgid "Unrecognized identified coding system."
-msgstr "Нераспазнаная вызначаная сыстэма кадаваньня."
+msgstr "Неапазнаная ідэнтыфікаваная сістэма кадавання."
-#: ../src/iso2022.c:1621
-#: ../src/iso2022.c:1648
+#: ../src/iso2022.c:1561 ../src/iso2022.c:1588
#, c-format
msgid "Attempt to set invalid wide NRC map '%c'."
-msgstr "Спроба усталяваць недапушчальную шырокую мапу '%c'."
+msgstr "Спроба ўжыць хібную шырокафарматную NRC-карту \"%c\"."
-#. Give the user some clue as to why session logging is not
-#. * going to work (assuming we can open a pty using some other
-#. * method).
-#: ../src/pty.c:837
+#: ../src/trie.c:409
#, c-format
-msgid "can not run %s"
-msgstr "немагчыма запусьціць %s"
+msgid "Duplicate (%s/%s)!"
+msgstr "Дублікат (%s/%s)."
-#: ../src/reaper.c:136
-msgid "Error creating signal pipe."
-msgstr "Памылка стварэньня сыгнальнага канала."
+#. Bail back to normal mode.
+#: ../src/vteapp.c:981
+msgid "Could not open console.\n"
+msgstr "Не ўдалося адкрыць кансоль.\n"
-#: ../src/trie.c:414
-#, c-format
-msgid "Duplicate (%s/%s)!"
-msgstr "Двайнік (%s/%s)!"
+#: ../src/vteapp.c:1077
+msgid "Could not parse the geometry spec passed to --geometry"
+msgstr ""
+"Не ўдалося разабраць спецыфікацыю памераў акна, пададзеных для опцыі --"
+"geometry"
-#: ../src/vte.c:1163
+#: ../src/vte.c:1305
#, c-format
msgid "Error compiling regular expression \"%s\"."
-msgstr "Памылка кампіляцыі сталага выраза \"%s\"."
-
-#: ../src/vte.c:2620
-#: ../src/vte.c:2625
-#, c-format
-msgid "No handler for control sequence `%s' defined."
-msgstr "Ня вызначаны апрацоўшчык для кіруючае пасьлядоўнасьці `%s'."
+msgstr "Памылка кампіляцыі рэгулярнага выразу \"%s\"."
#. Translators: %s is replaced with error message returned by strerror().
-#: ../src/vte.c:3575
+#: ../src/vte.c:4593
#, c-format
msgid "Error reading from child: %s."
-msgstr "Памылка чытаньня з нашчадка: %s."
+msgstr "Памылка чытання даных ад нашчадка: %s."
-#: ../src/vte.c:3692
+#: ../src/vte.c:4720
msgid "Unable to send data to child, invalid charset convertor"
-msgstr "Немагчыма адправіць зьвесткі нашчадку: няправільны канвэртар знаказбораў"
+msgstr ""
+"Не ўдалося паслаць даныя нашчадку: хібны модуль пераўтварэння знаказбору"
-#: ../src/vte.c:3703
-#: ../src/vte.c:4598
+#: ../src/vte.c:4731 ../src/vte.c:5793
#, c-format
msgid "Error (%s) converting data for child, dropping."
-msgstr "Памылка (%s) пераўтварэньня даньняў для нашчадка; скіданьне."
+msgstr "Памылка (%s) пераўтварэння даных ад нашчадка: ігнаруецца."
-#: ../src/vte.c:6824
+#: ../src/vte.c:7978
#, c-format
-msgid "Error reading PTY size, using defaults: %s."
-msgstr "Памылка чытаньня PTY памера, выкарыстоўваецца дапомны: %s."
-
-#: ../src/vte.c:6853
-#, c-format
-msgid "Error setting PTY size: %s."
-msgstr "Памылка ўсталяваньня памера PTY: %s."
+msgid "Error reading PTY size, using defaults: %s\n"
+msgstr "Памылка чытання памеру PTY: выкарыстоўваецца прадвызначаны: %s\n"
#. Aaargh. We're screwed.
-#: ../src/vte.c:11189
+#: ../src/vte.c:13807
msgid "_vte_conv_open() failed setting word characters"
-msgstr "_vte_conv_open() памылка усталяваньня знакаў слова"
-
-#: ../src/vteseq.c:3910
-#, c-format
-msgid "Got unexpected (key?) sequence `%s'."
-msgstr "Атрымана нечаканая (key?) пасьлядоўнасьць `%s'."
-
-#. Bail back to normal mode.
-#: ../src/vteapp.c:774
-msgid "Could not open console.\n"
-msgstr "Немагчыма адчыніць кансоль.\n"
-
-#: ../src/vteapp.c:838
-msgid "Could not parse the geometry spec passed to --geometry"
-msgstr "Немагчыма разабраць парамэтар геамэтрыі --geometry"
-
-#: ../src/vteglyph.c:562
-#, c-format
-msgid "Unknown pixel mode %d.\n"
-msgstr "Невядомы рэжым піксэля %d.\n"
-
-#: ../src/vtexft.c:267
-#, c-format
-msgid "Can not find appropiate font for character U+%04x.\n"
-msgstr "Немагчыма знайсьці адпаведны шрыфт для знака U+%04x.\n"
-
-#~ msgid "Error adding `%s' to environment, continuing."
-#~ msgstr "Памылка даданьня `%s' да асяродьдзя, працягваем."
-#~ msgid "Using fontset \"%s\", which is missing these character sets: %s."
-#~ msgstr ""
-#~ "Выкарыстоўваецца набор шрыфтоў \"%s\", у якім прапушчаны гэты набор "
-#~ "знакаў: %s."
-#~ msgid ""
-#~ "Failed to load Xft font pattern \"%s\", falling back to default font."
-#~ msgstr ""
-#~ "Памылка загрузкі Xft шаблёну шрыфта \"%s\", адкат да дапомнага шрыфта."
-#~ msgid "Failed to load default Xft font."
-#~ msgstr "Памылка загрузкі дапомнага Xft шрыфта."
-#~ msgid "Failed to load font set \"%s\", falling back to default font."
-#~ msgstr "Памылка загрузкі набору шрыфтоў \"%s\", адкат да дапомнага шрыфта."
-#~ msgid "Failed to load default font, crashing or behaving abnormally."
-#~ msgstr "НЕмагчыма загрузіць дапомны шрыфт, збой ці не адпаведныя паводзіны."
-#~ msgid "Error allocating draw, disabling Xft."
-#~ msgstr "Памылка разьмяшчэньня адлюстраваньня, выключэньне Xft."
-#~ msgid "Error allocating context, disabling Pango."
-#~ msgstr "Памылка разьмяшчэньня зместа, выключэньне Pango."
-#~ msgid "Error allocating layout, disabling Pango."
-#~ msgstr "Памылка разьмяшчэньня разьметкі, выключэньне Pango."
-
+msgstr "_vte_conv_open() не здолеў настроіць знакі, якія ўжываюцца ў словах"
diff --git a/po/ca.po b/po/ca.po
index 0ff49586..8a745df9 100644
--- a/po/ca.po
+++ b/po/ca.po
@@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: vte 0.11.6\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-08-22 10:10+0200\n"
-"PO-Revision-Date: 2011-04-05 23:08+0200\n"
+"PO-Revision-Date: 2010-08-22 10:11+0200\n"
"Last-Translator: Jordi Mallach <jordi@sindominio.net>\n"
"Language-Team: Catalan <tradgnome@softcatala.org>\n"
"Language: ca\n"
@@ -25,7 +25,7 @@ msgstr "No es pot convertir el caràcter %s a %s."
#: ../src/iso2022.c:1464
#, c-format
msgid "Attempt to set invalid NRC map '%c'."
-msgstr "S'ha intentat fixar el mapa NRC no vàlid «%c»."
+msgstr "S'ha intentat fixar el mapa NRC invàlid «%c»."
#. Application signalled an "identified coding system" we haven't heard of. See ECMA-35 for gory details.
#: ../src/iso2022.c:1494
@@ -66,7 +66,7 @@ msgstr "S'ha produït un error en llegir del fill: %s."
#: ../src/vte.c:4489
msgid "Unable to send data to child, invalid charset convertor"
msgstr ""
-"No s'han pogut enviar les dades al fill, el convertidor de codificació no és "
+"No s'ha pogut enviar les dades al fill, el convertidor de codificació no és "
"vàlid"
#: ../src/vte.c:4500 ../src/vte.c:5526
diff --git a/po/ca@valencia.po b/po/ca@valencia.po
index 33d3cf39..066720df 100644
--- a/po/ca@valencia.po
+++ b/po/ca@valencia.po
@@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: vte 0.11.6\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-05-29 19:12+0200\n"
-"PO-Revision-Date: 2011-04-05 23:08+0200\n"
+"PO-Revision-Date: 2010-08-22 10:11+0200\n"
"Last-Translator: Jordi Mallach <jordi@sindominio.net>\n"
"Language-Team: Catalan <tradgnome@softcatala.org>\n"
"Language: ca\n"
@@ -25,7 +25,7 @@ msgstr "No es pot convertir el caràcter %s a %s."
#: ../src/iso2022.c:1472
#, c-format
msgid "Attempt to set invalid NRC map '%c'."
-msgstr "S'ha intentat fixar el mapa NRC no vàlid «%c»."
+msgstr "S'ha intentat fixar el mapa NRC invàlid «%c»."
#. Application signalled an "identified coding system" we haven't heard of. See ECMA-35 for gory details.
#: ../src/iso2022.c:1502
@@ -66,7 +66,7 @@ msgstr "S'ha produït un error en llegir del fill: %s."
#: ../src/vte.c:4720
msgid "Unable to send data to child, invalid charset convertor"
msgstr ""
-"No s'han pogut enviar les dades al fill, el convertidor de codificació no és "
+"No s'ha pogut enviar les dades al fill, el convertidor de codificació no és "
"vàlid"
#: ../src/vte.c:4731 ../src/vte.c:5793
diff --git a/po/fur.po b/po/fur.po
new file mode 100644
index 00000000..117c8669
--- /dev/null
+++ b/po/fur.po
@@ -0,0 +1,83 @@
+# Friulian translation for vte.
+# Copyright (C) 2012 vte's COPYRIGHT HOLDER
+# This file is distributed under the same license as the vte package.
+# TmTFx <f.t.public@gmail.com>, 2012.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: vte vte-0-34\n"
+"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
+"product=vte&keywords=I18N+L10N&component=general\n"
+"POT-Creation-Date: 2012-12-20 13:10+0000\n"
+"PO-Revision-Date: 2012-12-28 14:51+0100\n"
+"Last-Translator: TmTFx <f.t.public@gmail.com>\n"
+"Language-Team: Friulian <fur@li.org>\n"
+"Language: fur\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../src/iso2022.c:795 ../src/iso2022.c:803 ../src/iso2022.c:834
+#: ../src/vte.c:2296
+#, c-format
+msgid "Unable to convert characters from %s to %s."
+msgstr "Impussibil convertî i caratars da %s a %s."
+
+#: ../src/iso2022.c:1488
+#, c-format
+msgid "Attempt to set invalid NRC map '%c'."
+msgstr "Tentatîf di impuestâ une mape NRC '%c' no valide."
+
+#. Application signalled an "identified coding system" we haven't heard of. See ECMA-35 for gory details.
+#: ../src/iso2022.c:1518
+msgid "Unrecognized identified coding system."
+msgstr "«Sisteme di codifiche identificât» no ricognossût."
+
+#: ../src/iso2022.c:1577 ../src/iso2022.c:1604
+#, c-format
+msgid "Attempt to set invalid wide NRC map '%c'."
+msgstr "Tentatîf di impuestâ une mape NRC amplie no valide \"%c\"."
+
+#: ../src/trie.c:409
+#, c-format
+msgid "Duplicate (%s/%s)!"
+msgstr "Duplicât (%s/%s)!"
+
+#. Bail back to normal mode.
+#: ../src/vteapp.c:981
+msgid "Could not open console.\n"
+msgstr "No puès vierzi la console.\n"
+
+#: ../src/vteapp.c:1077
+msgid "Could not parse the geometry spec passed to --geometry"
+msgstr "No puès analizâ le specifiche di geometrie pasade a --geometry"
+
+#: ../src/vte.c:1318
+#, c-format
+msgid "Error compiling regular expression \"%s\"."
+msgstr "Erôr compilant l'espresion regolâr \"%s\"."
+
+#. Translators: %s is replaced with error message returned by strerror().
+#: ../src/vte.c:4610
+#, c-format
+msgid "Error reading from child: %s."
+msgstr "Erôr leint dal procès fî: %s."
+
+#: ../src/vte.c:4737
+msgid "Unable to send data to child, invalid charset convertor"
+msgstr "Impussibil inviâ dâts al procès fî, convertidôr di caratars no valit"
+
+#: ../src/vte.c:4748 ../src/vte.c:5795
+#, c-format
+msgid "Error (%s) converting data for child, dropping."
+msgstr "Erôr (%s) convertint i dâts par il proces fî, a restaran come prime."
+
+#: ../src/vte.c:8000
+#, c-format
+msgid "Error reading PTY size, using defaults: %s\n"
+msgstr "Erôr leint la dimension PTY, doprarai i valôrs di default: %s\n"
+
+#. Aaargh. We're screwed.
+#: ../src/vte.c:13817
+msgid "_vte_conv_open() failed setting word characters"
+msgstr "_vte_conv_open() al a falît tal impuestâ i caratars de peraule"
diff --git a/po/ga.po b/po/ga.po
index 845f60f4..50d3d29c 100644
--- a/po/ga.po
+++ b/po/ga.po
@@ -1,94 +1,87 @@
# Irish translations for vte package.
-# Copyright (C) 2009 Free Software Foundation, Inc.
+# Copyright (C) 2009-2013 Free Software Foundation, Inc.
# This file is distributed under the same license as the vte package.
-# Seán de Búrca <leftmostcat@gmail.com>, 2009.
+# Seán de Búrca <leftmostcat@gmail.com>, 2009-2013.
#
msgid ""
msgstr ""
"Project-Id-Version: vte.master\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2009-08-09 13:57-0600\n"
-"PO-Revision-Date: 2009-08-09 14:10-0600\n"
+"POT-Creation-Date: 2013-08-29 16:00-0600\n"
+"PO-Revision-Date: 2013-08-29 16:00-0600\n"
"Last-Translator: Seán de Búrca <leftmostcat@gmail.com>\n"
"Language-Team: Irish <gaeilge-gnulinux@lists.sourceforge.net>\n"
+"Language: ga\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=5; plural=n==1 ? 0 : (n%10==1 || n%10==2) ? 1 : (n%"
-"10>=3 && n%10<= 6) ? 2 : ((n%10>=7 && n%10<=9) || n==10) ? 3 : 4;\n"
+"Plural-Forms: nplurals=5; plural=n==1 ? 0 : n==2 ? 1 : n<7 ? 2 : n<11 ? 3 : "
+"4;\n"
-#: ../src/iso2022.c:751 ../src/iso2022.c:759 ../src/iso2022.c:790
-#: ../src/vte.c:2288
+#: ../src/iso2022.c:795 ../src/iso2022.c:803 ../src/iso2022.c:834
+#: ../src/vte.c:2296
#, c-format
msgid "Unable to convert characters from %s to %s."
msgstr "Ní féidir carachtair a thiontú ó %s go %s."
-#: ../src/iso2022.c:1444
+#: ../src/iso2022.c:1488
#, c-format
msgid "Attempt to set invalid NRC map '%c'."
msgstr "Déan iarracht ar mapa NRC neamhbhailí '%c' a shocrú."
#. Application signalled an "identified coding system" we haven't heard of. See ECMA-35 for gory details.
-#: ../src/iso2022.c:1474
+#: ../src/iso2022.c:1518
msgid "Unrecognized identified coding system."
msgstr "Córas códaithe aitheanta anaithnid."
-#: ../src/iso2022.c:1533 ../src/iso2022.c:1560
+#: ../src/iso2022.c:1577 ../src/iso2022.c:1604
#, c-format
msgid "Attempt to set invalid wide NRC map '%c'."
msgstr "Déan iarracht ar mapa NRC leathan neamhbhailí '%c' a shocrú."
-#. Give the user some clue as to why session logging is not
-#. * going to work (assuming we can open a pty using some other
-#. * method).
-#: ../src/pty.c:831
-#, c-format
-msgid "can not run %s"
-msgstr "ní féidir %s a rith"
-
#: ../src/trie.c:409
#, c-format
msgid "Duplicate (%s/%s)!"
msgstr "Dúblach (%s/%s)!"
#. Bail back to normal mode.
-#: ../src/vteapp.c:846
+#: ../src/vteapp.c:981
msgid "Could not open console.\n"
msgstr "Níorbh fhéidir consól a oscailt.\n"
-#: ../src/vteapp.c:910
+#: ../src/vteapp.c:1077
msgid "Could not parse the geometry spec passed to --geometry"
msgstr ""
"Níorbh fhéidir an tsonraíocht céimseatan a seoladh chuig --geometry a "
"pharsáil"
-#: ../src/vte.c:1337
+#: ../src/vte.c:1318
#, c-format
msgid "Error compiling regular expression \"%s\"."
msgstr "Earráid agus slonn ionadaíochta \"%s\" á thiomsú."
#. Translators: %s is replaced with error message returned by strerror().
-#: ../src/vte.c:4291
+#: ../src/vte.c:4613
#, c-format
msgid "Error reading from child: %s."
msgstr "Earráid agus á léamh ó mhac: %s."
-#: ../src/vte.c:4419
+#: ../src/vte.c:4740
msgid "Unable to send data to child, invalid charset convertor"
msgstr ""
"Ní féidir sonraí a sheoladh chuig mac, tiontaire tacair carachtar neamhbhailí"
-#: ../src/vte.c:4430 ../src/vte.c:5422
+#: ../src/vte.c:4751 ../src/vte.c:5798
#, c-format
msgid "Error (%s) converting data for child, dropping."
msgstr "Earráid (%s) agus sonraí á thiontú do mhac, á mbaint."
-#: ../src/vte.c:7691
+#: ../src/vte.c:8009
#, c-format
-msgid "Error reading PTY size, using defaults: %s."
-msgstr "Earráid agus méid PTY á léamh, ag úsáid réamhshocruithe: %s."
+msgid "Error reading PTY size, using defaults: %s\n"
+msgstr "Earráid agus méid PTY á léamh, réamhshocruithe á úsáid: %s\n"
#. Aaargh. We're screwed.
-#: ../src/vte.c:13289
+#: ../src/vte.c:13852
msgid "_vte_conv_open() failed setting word characters"
msgstr "theip _vte_conv_open() ar shocrú carachtar focail"
diff --git a/po/pl.po b/po/pl.po
index 0664f362..a41c8006 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -4,14 +4,19 @@
# pomóc w jego rozwijaniu i pielęgnowaniu, napisz do nas:
# gnomepl@aviary.pl
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+# Zbigniew Chyla <chyla@alice.ci.pwr.wroc.pl>, 2003.
+# Artur Flinta <aflinta@at.kernel.pl>, 2003-2007.
+# Piotr Drąg <piotrdrag@gmail.com>, 2010-2012.
+# Aviary.pl <gnomepl@aviary.pl>, 2010-2012.
msgid ""
msgstr ""
"Project-Id-Version: vte\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2010-09-07 19:02+0200\n"
-"PO-Revision-Date: 2010-09-07 17:30+0200\n"
+"POT-Creation-Date: 2012-09-04 23:46+0200\n"
+"PO-Revision-Date: 2012-09-04 23:47+0200\n"
"Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n"
"Language-Team: Polish <gnomepl@aviary.pl>\n"
+"Language: pl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -20,23 +25,23 @@ msgstr ""
"X-Poedit-Language: Polish\n"
"X-Poedit-Country: Poland\n"
-#: ../src/iso2022.c:771 ../src/iso2022.c:779 ../src/iso2022.c:810
-#: ../src/vte.c:2254
+#: ../src/iso2022.c:795 ../src/iso2022.c:803 ../src/iso2022.c:834
+#: ../src/vte.c:2292
#, c-format
msgid "Unable to convert characters from %s to %s."
msgstr "Nie można przekonwertować znaków z %s na %s."
-#: ../src/iso2022.c:1464
+#: ../src/iso2022.c:1488
#, c-format
msgid "Attempt to set invalid NRC map '%c'."
msgstr "Próba ustawienia nieprawidłowej mapy NRC \"%c\"."
#. Application signalled an "identified coding system" we haven't heard of. See ECMA-35 for gory details.
-#: ../src/iso2022.c:1494
+#: ../src/iso2022.c:1518
msgid "Unrecognized identified coding system."
msgstr "Nierozpoznany system kodowania."
-#: ../src/iso2022.c:1553 ../src/iso2022.c:1580
+#: ../src/iso2022.c:1577 ../src/iso2022.c:1604
#, c-format
msgid "Attempt to set invalid wide NRC map '%c'."
msgstr "Próba ustawienia nieprawidłowej rozległej mapy NRC \"%c\"."
@@ -44,46 +49,48 @@ msgstr "Próba ustawienia nieprawidłowej rozległej mapy NRC \"%c\"."
#: ../src/trie.c:409
#, c-format
msgid "Duplicate (%s/%s)!"
-msgstr "Duplikat (%s/%s)!"
+msgstr "Duplikat (%s/%s)."
#. Bail back to normal mode.
-#: ../src/vteapp.c:965
+#: ../src/vteapp.c:981
msgid "Could not open console.\n"
msgstr "Nie można otworzyć konsoli.\n"
-#: ../src/vteapp.c:1056
+#: ../src/vteapp.c:1077
msgid "Could not parse the geometry spec passed to --geometry"
msgstr ""
"Nie można przetworzyć danych geometrii przekazanych za pomocą --geometry"
-#: ../src/vte.c:1280
+#: ../src/vte.c:1314
#, c-format
msgid "Error compiling regular expression \"%s\"."
msgstr "Błąd podczas kompilowania wyrażenia regularnego \"%s\"."
#. Translators: %s is replaced with error message returned by strerror().
-#: ../src/vte.c:4362
+#: ../src/vte.c:4606
#, c-format
msgid "Error reading from child: %s."
msgstr "Błąd podczas odczytywania z procesu potomnego: %s."
-#: ../src/vte.c:4489
+#: ../src/vte.c:4733
msgid "Unable to send data to child, invalid charset convertor"
-msgstr "Nie można wysłać danych do potomka, nieprawidłowa konwersja znaków"
+msgstr ""
+"Nie można wysłać danych do procesu potomnego, nieprawidłowa konwersja znaków"
-#: ../src/vte.c:4500 ../src/vte.c:5531
+#: ../src/vte.c:4744 ../src/vte.c:5791
#, c-format
msgid "Error (%s) converting data for child, dropping."
-msgstr "Błąd (%s) podczas konwertowania danych dla potomka. Porzucono."
+msgstr ""
+"Błąd (%s) podczas konwertowania danych dla procesu potomnego. Porzucono."
-#: ../src/vte.c:7725
+#: ../src/vte.c:8009
#, c-format
msgid "Error reading PTY size, using defaults: %s\n"
-msgstr "Błąd podczas odczytywania rozmiaru PTY, używanie domyślnego: %s\n"
+msgstr "Błąd podczas odczytywania rozmiaru PTY. Używanie domyślnego: %s\n"
#. Aaargh. We're screwed.
-#: ../src/vte.c:13296
+#: ../src/vte.c:13817
msgid "_vte_conv_open() failed setting word characters"
msgstr ""
-"Funkcja g_iconv_open() nie została ukończona podczas ustawiania znaków o "
-"szerokości słowa"
+"Ustawienie znaków o szerokości słowa przez funkcję _vte_conv_open() się nie "
+"powiodło"
diff --git a/po/tg.po b/po/tg.po
new file mode 100644
index 00000000..1cf04c3f
--- /dev/null
+++ b/po/tg.po
@@ -0,0 +1,87 @@
+# Tajik translation for vte.
+# Copyright (C) 2013 vte's COPYRIGHT HOLDER
+# This file is distributed under the same license as the vte package.
+# Victor Ibragimov <victor.ibragimov@gmail.com>, 2013.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: vte vte-0-34\n"
+"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
+"product=vte&keywords=I18N+L10N&component=general\n"
+"POT-Creation-Date: 2013-10-03 12:35+0000\n"
+"PO-Revision-Date: 2013-10-10 16:55+0500\n"
+"Last-Translator: Victor Ibragimov <victor.ibragimov@gmail.com>\n"
+"Language-Team: Tajik <tg@li.org>\n"
+"Language: tg\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 1.5.7\n"
+
+#: ../src/iso2022.c:795 ../src/iso2022.c:803 ../src/iso2022.c:834
+#: ../src/vte.c:2294
+#, c-format
+msgid "Unable to convert characters from %s to %s."
+msgstr "Аломатҳо аз %s ба %s табдил карда нашудаанд."
+
+#: ../src/iso2022.c:1488
+#, c-format
+msgid "Attempt to set invalid NRC map '%c'."
+msgstr "Кӯшиши танзими харитаи нодурусти NRC '%c'."
+
+#. Application signalled an "identified coding system" we haven't heard of. See ECMA-35 for gory details.
+#: ../src/iso2022.c:1518
+msgid "Unrecognized identified coding system."
+msgstr "Системаи рамзии муайяншудаи ношинос"
+
+#: ../src/iso2022.c:1577 ../src/iso2022.c:1604
+#, c-format
+msgid "Attempt to set invalid wide NRC map '%c'."
+msgstr "Кӯшиши танзими харитаи васеи нодурусти NRC '%c'."
+
+#: ../src/trie.c:409
+#, c-format
+msgid "Duplicate (%s/%s)!"
+msgstr "Нусха (%s/%s)!"
+
+#. Bail back to normal mode.
+#: ../src/vteapp.c:981
+msgid "Could not open console.\n"
+msgstr "Консол кушода нашуд.\n"
+
+#: ../src/vteapp.c:1077
+msgid "Could not parse the geometry spec passed to --geometry"
+msgstr "Хусусияти геометрии ба --geometry гузошта таҷзия карда нашуд"
+
+#: ../src/vte.c:1316
+#, c-format
+msgid "Error compiling regular expression \"%s\"."
+msgstr "Хатои ҳамгардонии ифодаи оддии \"%s\"."
+
+#. Translators: %s is replaced with error message returned by strerror().
+#: ../src/vte.c:4613
+#, c-format
+msgid "Error reading from child: %s."
+msgstr "Хатои хониш аз унсури иловагӣ: %s."
+
+#: ../src/vte.c:4740
+msgid "Unable to send data to child, invalid charset convertor"
+msgstr ""
+"Иттилоот ба унсури иловагӣ фиристода нашуд, зеро ки табдилгари рамзгузорӣ "
+"нодуруст аст"
+
+#: ../src/vte.c:4751 ../src/vte.c:5798
+#, c-format
+msgid "Error (%s) converting data for child, dropping."
+msgstr ""
+"Хатои (%s) табдилдиҳии иттилоот барои унсури иловагӣ. Қатъ шуда истодааст."
+
+#: ../src/vte.c:8009
+#, c-format
+msgid "Error reading PTY size, using defaults: %s\n"
+msgstr "Хатои хониши андозаи PTY бо истифодаи пешфарзҳо: %s\n"
+
+#. Aaargh. We're screwed.
+#: ../src/vte.c:13914
+msgid "_vte_conv_open() failed setting word characters"
+msgstr "_vte_conv_open() барои танзими аломатҳои калима қатъ шудааст"
diff --git a/po/tr.po b/po/tr.po
index 520d7654..63f74a43 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -3,100 +3,94 @@
# Copyright (C) 2003 vte's COPYRIGHT HOLDER
# This file is distributed under the same license as the vte package.
#
-# Görkem Çetin <gorkem@gelecek.com.tr>, 2003.
+# Görkem �Getin <gorkem@gelecek.com.tr>, 2003.
# Arman Aksoy <armish@linux-sevenler.de>, 2003.
# Baris Cicek <baris@teamforce.name.tr>, 2004, 2008.
-# Muhammet Kara <muhammet.k@gmail.com>, 2011.
-#
+# Volkan Yalçın <vlyalcin@gmail.com>, 2011.
msgid ""
msgstr ""
"Project-Id-Version: vte.HEAD.tr\n"
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
-"product=vte&component=general\n"
-"POT-Creation-Date: 2010-03-17 17:23+0000\n"
-"PO-Revision-Date: 2011-04-26 02:00+0300\n"
-"Last-Translator: Muhammet Kara <muhammet.k@gmail.com>\n"
+"product=vte&keywords=I18N+L10N&component=general\n"
+"POT-Creation-Date: 2011-08-28 21:48+0000\n"
+"PO-Revision-Date: 2011-09-09 12:17+0300\n"
+"Last-Translator: Volkan Yalçın <vlyalcin@gmail.com>\n"
"Language-Team: Turkish <gnome-turk@gnome.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: KBabel 1.11.4\n"
-"Plural-Forms: nplurals=1; plural=0;\n"
+"X-Generator: Lokalize 1.2\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+"Language: tr\n"
-#: ../src/iso2022.c:771 ../src/iso2022.c:779 ../src/iso2022.c:810
-#: ../src/vte.c:2232
+#: ../src/iso2022.c:779 ../src/iso2022.c:787 ../src/iso2022.c:818
+#: ../src/vte.c:2279
#, c-format
msgid "Unable to convert characters from %s to %s."
msgstr "Karakterler %s'den %s'e dönüştürülemiyor."
-#: ../src/iso2022.c:1464
+#: ../src/iso2022.c:1472
#, c-format
msgid "Attempt to set invalid NRC map '%c'."
msgstr "Geçersiz NRC haritası '%c' ayarlanmaya çalışıldı."
#. Application signalled an "identified coding system" we haven't heard of. See ECMA-35 for gory details.
-#: ../src/iso2022.c:1494
+#: ../src/iso2022.c:1502
msgid "Unrecognized identified coding system."
msgstr "Anımsanmayan tanımlanmış kodlama sistemi."
-#: ../src/iso2022.c:1553 ../src/iso2022.c:1580
+#: ../src/iso2022.c:1561 ../src/iso2022.c:1588
#, c-format
msgid "Attempt to set invalid wide NRC map '%c'."
msgstr "Geçersiz geniş NRC haritası '%c' ayarlanmaya çalışıldı."
-#. Give the user some clue as to why session logging is not
-#. * going to work (assuming we can open a pty using some other
-#. * method).
-#: ../src/pty.c:1073 ../src/pty.c:1076
-#, c-format
-msgid "can not run %s"
-msgstr "%s çalıştırılamadı"
-
#: ../src/trie.c:409
#, c-format
msgid "Duplicate (%s/%s)!"
msgstr "Çift (%s/%s)!"
#. Bail back to normal mode.
-#: ../src/vteapp.c:876
+#: ../src/vteapp.c:981
msgid "Could not open console.\n"
msgstr "Konsol açılamadı.\n"
-#: ../src/vteapp.c:967
+#: ../src/vteapp.c:1077
msgid "Could not parse the geometry spec passed to --geometry"
msgstr "--geometry'de belirtilen geometri belirtimi ayrıştırılamadı"
-#: ../src/vte.c:1279
+#: ../src/vte.c:1305
#, c-format
msgid "Error compiling regular expression \"%s\"."
msgstr "Düzenli ifade derlenirken hata: \"%s\"."
#. Translators: %s is replaced with error message returned by strerror().
-#: ../src/vte.c:4344
+#: ../src/vte.c:4593
#, c-format
msgid "Error reading from child: %s."
msgstr "Oğul süreçten okunurken hata: %s."
-#: ../src/vte.c:4472
+#: ../src/vte.c:4720
msgid "Unable to send data to child, invalid charset convertor"
msgstr "Alt sürece veri gönderilemedi, geçersiz karakter kümesi çevirici"
-#: ../src/vte.c:4483 ../src/vte.c:5505
+#: ../src/vte.c:4731 ../src/vte.c:5793
#, c-format
msgid "Error (%s) converting data for child, dropping."
msgstr "Oğul süreç için veriyi çeviriken hata (%s), bırakılıyor."
-#: ../src/vte.c:7726
+#: ../src/vte.c:7978
#, c-format
-#| msgid "Error reading PTY size, using defaults: %s."
msgid "Error reading PTY size, using defaults: %s\n"
msgstr "PTY boyutu okunurken hata, öntanımlı değerler kullanılıyor: %s\n"
#. Aaargh. We're screwed.
-#: ../src/vte.c:13281
+#: ../src/vte.c:13796
msgid "_vte_conv_open() failed setting word characters"
msgstr "_vte_iconv_open() kelime karakterlerini ayarlarken başarısız oldu"
+#~ msgid "can not run %s"
+#~ msgstr "%s çalıştırılamadı"
+
#~ msgid "Error creating signal pipe."
#~ msgstr "Sinyal borusu oluştururken hata."
diff --git a/po/uz@cyrillic.po b/po/uz@cyrillic.po
new file mode 100644
index 00000000..bb2257be
--- /dev/null
+++ b/po/uz@cyrillic.po
@@ -0,0 +1,82 @@
+# Uzbek (Cyrillic) translation for vte.
+# Copyright (C) 2012 vte's COPYRIGHT HOLDER
+# This file is distributed under the same license as the vte package.
+# Bahodir Mansurov <6ahodir@gmail.com>, 2012.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: vte master\n"
+"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?"
+"product=vte&keywords=I18N+L10N&component=general\n"
+"POT-Creation-Date: 2012-02-19 10:56+0000\n"
+"PO-Revision-Date: 2012-02-19 10:56+0000\n"
+"Last-Translator: Bahodir Mansurov <6ahodir@gmail.com>\n"
+"Language-Team: Uzbek (Cyrillic) <uz@cyrillic@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../src/iso2022.c:779 ../src/iso2022.c:787 ../src/iso2022.c:818
+#: ../src/vte.c:2277
+#, c-format
+msgid "Unable to convert characters from %s to %s."
+msgstr "Белгиларни %sдан %sга ўгириб бўлмади."
+
+#: ../src/iso2022.c:1472
+#, c-format
+msgid "Attempt to set invalid NRC map '%c'."
+msgstr "Нотўғри NRC харитаси '%c'ни ўрнатишга ҳаракат қилинди."
+
+#. Application signalled an "identified coding system" we haven't heard of. See ECMA-35 for gory details.
+#: ../src/iso2022.c:1502
+msgid "Unrecognized identified coding system."
+msgstr "Номаълум кодлаш системаси"
+
+#: ../src/iso2022.c:1561 ../src/iso2022.c:1588
+#, c-format
+msgid "Attempt to set invalid wide NRC map '%c'."
+msgstr "Нотўғри кенг NRC харитаси '%c'ни ўрнатишга ҳаракат қилинди."
+
+#: ../src/trie.c:409
+#, c-format
+msgid "Duplicate (%s/%s)!"
+msgstr "(%s/%s) янги нусха яратиш!"
+
+#. Bail back to normal mode.
+#: ../src/vteapp.c:981
+msgid "Could not open console.\n"
+msgstr "Консолни очиб бўлмади.\n"
+
+#: ../src/vteapp.c:1077
+msgid "Could not parse the geometry spec passed to --geometry"
+msgstr "--geometry параметрига берилган геометрия хусусиятини таҳлил қилиб бўлмади."
+
+#: ../src/vte.c:1303
+#, c-format
+msgid "Error compiling regular expression \"%s\"."
+msgstr "Доимий ифодани теришда хатолик \"%s\"."
+
+#. Translators: %s is replaced with error message returned by strerror().
+#: ../src/vte.c:4591
+#, c-format
+msgid "Error reading from child: %s."
+msgstr "Авлоддан ўқишда хатолик: %s."
+
+#: ../src/vte.c:4718
+msgid "Unable to send data to child, invalid charset convertor"
+msgstr "Авлодга маълумотни жўнатиб бўлмади, кодлар жадвалининг нотўғри ўгиргичи"
+
+#: ../src/vte.c:4729 ../src/vte.c:5791
+#, c-format
+msgid "Error (%s) converting data for child, dropping."
+msgstr "Авлод учун маълумотни ўгиришда хатолик (%s), ташлаб юбориляпи."
+
+#: ../src/vte.c:7976
+#, c-format
+msgid "Error reading PTY size, using defaults: %s\n"
+msgstr "PTY ўлчамларини ўқишда хатолик, андоза қийматлар ишлатиляпти: %s\n"
+
+#. Aaargh. We're screwed.
+#: ../src/vte.c:13794
+msgid "_vte_conv_open() failed setting word characters"
+msgstr "_vte_conv_open() сўз белгиларини ўрната олмади"
diff --git a/python/Makefile.am b/python/Makefile.am
deleted file mode 100644
index ca5f3ed5..00000000
--- a/python/Makefile.am
+++ /dev/null
@@ -1,43 +0,0 @@
-EXTRA_DIST = vte.defs pyvte.pc.in vte.override cat.py unrealize.py vte-demo.py
-
-if BUILD_PYTHON_MODULES
-
-defsdir = $(datadir)/pygtk/2.0/defs
-defs_DATA = vte.defs
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = pyvte.pc
-
-PYTHON_MODULES = vtemodule.la
-
-pythonsiteexecdir = $(pyexecdir)/gtk-2.0
-pythonsiteexec_LTLIBRARIES = $(PYTHON_MODULES)
-
-CLEANFILES = vte.c
-
-vtemodule_la_SOURCES = vtemodule.c
-vtemodule_la_CPPFLAGS = -I$(top_builddir)/src $(AM_CPPFLAGS)
-vtemodule_la_CFLAGS = $(VTE_CFLAGS) $(X_CFLAGS) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) $(AM_CFLAGS)
-
-# we do this to suport building with -Wl,-z,defs which errors on
-# vtemodule.so as we cannot include $(PYTHON_LIBS) due to bug 410986.
-vtemodule_la_LDFLAGS = -module -avoid-version -export-symbols-regex initvte $(PYTHON_LDFLAGS) $(AM_LDFLAGS)
-vtemodule_la_LIBADD = $(top_builddir)/src/libvte.la $(LIBS) $(PYGTK_LIBS) $(VTE_LIBS) $(X_LIBS)
-nodist_vtemodule_la_SOURCES = vte.c
-
-vte.c: vte.defs vte.override
-
-.defs.c:
- $(AM_V_GEN) (cd $(srcdir) \
- && $(PYGTK_CODEGEN) \
- --register $(PYGTK_DEFSDIR)/pango-types.defs \
- --register $(PYGTK_DEFSDIR)/gdk-types.defs \
- --register $(PYGTK_DEFSDIR)/gtk-types.defs \
- --override $*.override \
- --prefix py$* $*.defs) > gen-$*.c \
- && cp gen-$*.c $*.c \
- && rm -f gen-$*.c
-
-endif
-
--include $(top_srcdir)/git.mk
diff --git a/python/cat.py b/python/cat.py
deleted file mode 100755
index ec7d3b6f..00000000
--- a/python/cat.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/python
-import sys
-import string
-import getopt
-import gtk
-import vte
-
-def main_quit(object, *args):
- gtk.main_quit()
-
-def commit_cb(object, *args):
- (text, length) = args
- # Echo the text input by the user to stdout. Note that the string's
- # length isn't always going to be right.
- if (0):
- sys.stdout.write(text)
- sys.stdout.flush()
- else:
- # Test the get_text() function.
- for line in (string.splitfields(object.get_text(),"\n")):
- if (line.__len__() > 0):
- print line
- # Also display it.
- object.feed(text, length)
-
-if __name__ == '__main__':
- font = "fixed 12"
- scrollback = 100
- # Let the user override them.
- (shorts, longs) = getopt.getopt(sys.argv[1:], "f:", ["font="])
- for argpair in (shorts + longs):
- if ((argpair[0] == '-f') or (argpair[0] == '--font')):
- print "Setting font to `" + argpair[1] + "'."
- font = argpair[1]
- window = gtk.Window()
- window.connect("delete-event", main_quit)
-
- terminal = vte.Terminal()
- terminal.set_cursor_blinks(gtk.TRUE)
- terminal.set_emulation("xterm")
- terminal.set_font_from_string(font)
- terminal.set_scrollback_lines(1000)
- terminal.set_audible_bell(gtk.TRUE)
- terminal.set_visible_bell(gtk.FALSE)
- terminal.connect("commit", commit_cb)
- terminal.show()
-
- scrollbar = gtk.VScrollbar()
- scrollbar.set_adjustment(terminal.get_adjustment())
-
- box = gtk.HBox()
- box.pack_start(terminal)
- box.pack_start(scrollbar)
-
- window.add(box)
- window.show_all()
- gtk.main()
diff --git a/python/pyvte.pc.in b/python/pyvte.pc.in
deleted file mode 100644
index 63773bfd..00000000
--- a/python/pyvte.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-includedir=@includedir@
-datarootdir=@datarootdir@
-datadir=@datadir@
-
-Name: PyVte
-Description: Python bindings for the Vte terminal widget.
-Requires: vte
-Version: @VERSION@
-
diff --git a/python/unrealize.py b/python/unrealize.py
deleted file mode 100755
index 87ebb0ea..00000000
--- a/python/unrealize.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python
-import sys
-import getopt
-import gtk
-import vte
-
-# FIXME: figure out why we don't get a PID here.
-def exited_cb(terminal):
- gtk.main_quit()
-
-def nuke(button, (box, terminal)):
- box.remove(terminal)
- box.pack_start(terminal)
-
-if __name__ == '__main__':
- child_pid = -1;
- # Defaults.
- emulation = "xterm"
- font = "fixed 12"
- command = None
- # Let the user override them.
- (shorts, longs) = getopt.getopt(sys.argv[1:], "c:t:f:", ["command=", "terminal=", "font="])
- for argpair in (shorts + longs):
- if ((argpair[0] == '-c') or (argpair[0] == '--command')):
- print "Running command `" + argpair[1] + "'."
- command = argpair[1]
- if ((argpair[0] == '-f') or (argpair[0] == '--font')):
- print "Setting font to `" + argpair[1] + "'."
- font = argpair[1]
- if ((argpair[0] == '-t') or (argpair[0] == '--terminal')):
- print "Setting terminal type to `" + argpair[1] + "'."
- emulation = argpair[1]
- window = gtk.Window()
- terminal = vte.Terminal()
- terminal.set_emulation(emulation)
- terminal.set_font_from_string(font)
- terminal.connect("child-exited", exited_cb)
- if (command):
- # Start up the specified command.
- child_pid = terminal.fork_command(command)
- else:
- # Start up the default command, the user's shell.
- child_pid = terminal.fork_command()
- box = gtk.VBox()
- box.pack_start(terminal)
- button = gtk.Button("remove")
- button.connect("pressed", nuke, (box, terminal))
- box.pack_start(button)
- window.add(box)
- window.show_all()
- gtk.main()
diff --git a/python/vte-demo.py b/python/vte-demo.py
deleted file mode 100755
index 985c023e..00000000
--- a/python/vte-demo.py
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/usr/bin/python
-import sys
-import string
-import getopt
-import gtk
-import vte
-
-def selected_cb(terminal, column, row, cb_data):
- if (row == 15):
- if (column < 40):
- return 1
- return 0
-
-def restore_cb(terminal):
- (text, attrs) = terminal.get_text(selected_cb, 1)
- print "A portion of the text at restore-time is:"
- print text
-
-def child_exited_cb(terminal):
- gtk.main_quit()
-
-if __name__ == '__main__':
- child_pid = -1;
- # Defaults.
- audible = 0
- background = None
- blink = 0
- command = None
- emulation = "xterm"
- font = "fixed 12"
- scrollback = 100
- transparent = 0
- visible = 0
- # Let the user override them.
- (shorts, longs) = getopt.getopt(sys.argv[1:], "B:Tabc:f:n:t:v", ["background", "transparent", "audible", "blink", "command=", "font=", "scrollback=", "terminal=", "visible"])
- for argpair in (shorts + longs):
- if ((argpair[0] == '-B') or (argpair[0] == '--background')):
- print "Setting background image to `" + argpair[1] + "'."
- background = argpair[1]
- if ((argpair[0] == '-T') or (argpair[0] == '--transparent')):
- print "Setting transparency."
- transparent = not transparent
- if ((argpair[0] == '-a') or (argpair[0] == '--audible')):
- print "Setting audible bell."
- audible = not audible
- if ((argpair[0] == '-b') or (argpair[0] == '--blink')):
- print "Setting blinking cursor."
- blink = not blink
- if ((argpair[0] == '-c') or (argpair[0] == '--command')):
- print "Running command `" + argpair[1] + "'."
- command = argpair[1]
- if ((argpair[0] == '-f') or (argpair[0] == '--font')):
- print "Setting font to `" + argpair[1] + "'."
- font = argpair[1]
- if ((argpair[0] == '-n') or (argpair[0] == '--scrollback')):
- scrollback = string.atoi(argpair[1])
- if (scrollback == 0):
- scrollback = 100
- else:
- print "Setting scrollback size to `" + str(scrollback) + "'."
- if ((argpair[0] == '-t') or (argpair[0] == '--terminal')):
- print "Setting terminal type to `" + argpair[1] + "'."
- emulation = argpair[1]
- if ((argpair[0] == '-v') or (argpair[0] == '--visible')):
- print "Setting visible bell."
- visible = not visible
- window = gtk.Window()
- terminal = vte.Terminal()
- if (background):
- terminal.set_background_image(background)
- if (transparent):
- terminal.set_background_transparent(gtk.TRUE)
- terminal.set_cursor_blinks(blink)
- terminal.set_emulation(emulation)
- terminal.set_font_from_string(font)
- terminal.set_scrollback_lines(scrollback)
- terminal.set_audible_bell(audible)
- terminal.set_visible_bell(visible)
- terminal.connect("child-exited", child_exited_cb)
- terminal.connect("restore-window", restore_cb)
- if (command):
- # Start up the specified command.
- child_pid = terminal.fork_command(command)
- else:
- # Start up the default command, the user's shell.
- child_pid = terminal.fork_command()
- terminal.show()
-
- scrollbar = gtk.VScrollbar()
- scrollbar.set_adjustment(terminal.get_adjustment())
-
- box = gtk.HBox()
- box.pack_start(terminal)
- box.pack_start(scrollbar)
-
- window.add(box)
- window.show_all()
- gtk.main()
diff --git a/python/vte.defs b/python/vte.defs
deleted file mode 100644
index 5fa028fc..00000000
--- a/python/vte.defs
+++ /dev/null
@@ -1,818 +0,0 @@
-;; -*- scheme -*-
-; object definitions ...
-(define-object Terminal
- (in-module "Vte")
- (parent "GtkWidget")
- (c-name "VteTerminal")
- (gtype-id "VTE_TYPE_TERMINAL")
-)
-
-;; Enumerations and flags ...
-
-(define-enum TerminalEraseBinding
- (in-module "Vte")
- (c-name "VteTerminalEraseBinding")
- (gtype-id "VTE_TYPE_TERMINAL_ERASE_BINDING")
- (values
- '("auto" "VTE_ERASE_AUTO")
- '("ascii-backspace" "VTE_ERASE_ASCII_BACKSPACE")
- '("ascii-delete" "VTE_ERASE_ASCII_DELETE")
- '("delete-sequence" "VTE_ERASE_DELETE_SEQUENCE")
- )
-)
-
-(define-enum TerminalAntiAlias
- (in-module "Vte")
- (c-name "VteTerminalAntiAlias")
- (gtype-id "VTE_TYPE_TERMINAL_ANTI_ALIAS")
- (values
- '("use-default" "VTE_ANTI_ALIAS_USE_DEFAULT")
- '("force-enable" "VTE_ANTI_ALIAS_FORCE_ENABLE")
- '("force-disable" "VTE_ANTI_ALIAS_FORCE_DISABLE")
- )
-)
-
-(define-enum TerminalCursorBlinkMode
- (in-module "Vte")
- (c-name "VteTerminalCursorBlinkMode")
- (gtype-id "VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE")
- (values
- '("system" "VTE_CURSOR_BLINK_SYSTEM")
- '("on" "VTE_CURSOR_BLINK_ON")
- '("off" "VTE_CURSOR_BLINK_OFF")
- )
-)
-
-(define-enum TerminalCursorShape
- (in-module "Vte")
- (c-name "VteTerminalCursorShape")
- (gtype-id "VTE_TYPE_TERMINAL_CURSOR_SHAPE")
- (values
- '("block" "VTE_CURSOR_SHAPE_BLOCK")
- '("ibeam" "VTE_CURSOR_SHAPE_IBEAM")
- '("underline" "VTE_CURSOR_SHAPE_UNDERLINE")
- )
-)
-
-
-;; From vte.h
-
-(define-function vte_terminal_get_type
- (c-name "vte_terminal_get_type")
- (return-type "GType")
-)
-
-(define-function vte_terminal_new
- (c-name "vte_terminal_new")
- (is-constructor-of "VteTerminal")
- (return-type "GtkWidget*")
-)
-
-(define-method fork_command
- (of-object "VteTerminal")
- (c-name "vte_terminal_fork_command")
- (return-type "pid_t")
- (parameters
- '("const-char*" "command")
- '("char**" "argv")
- '("char**" "envv")
- '("const-char*" "directory")
- '("gboolean" "lastlog")
- '("gboolean" "utmp")
- '("gboolean" "wtmp")
- )
-)
-
-(define-method forkpty
- (of-object "VteTerminal")
- (c-name "vte_terminal_forkpty")
- (return-type "pid_t")
- (parameters
- '("char**" "envv")
- '("const-char*" "directory")
- '("gboolean" "lastlog")
- '("gboolean" "utmp")
- '("gboolean" "wtmp")
- )
-)
-
-(define-method feed
- (of-object "VteTerminal")
- (c-name "vte_terminal_feed")
- (return-type "none")
- (parameters
- '("const-char*" "data")
- '("glong" "length" (default "-1"))
- )
-)
-
-(define-method feed_child
- (of-object "VteTerminal")
- (c-name "vte_terminal_feed_child")
- (return-type "none")
- (parameters
- '("const-char*" "text")
- '("glong" "length" (default "-1"))
- )
-)
-
-(define-method feed_child_binary
- (of-object "VteTerminal")
- (c-name "vte_terminal_feed_child_binary")
- (return-type "none")
- (parameters
- '("const-char*" "data")
- '("glong" "length" (default "-1"))
- )
-)
-
-(define-method copy_clipboard
- (of-object "VteTerminal")
- (c-name "vte_terminal_copy_clipboard")
- (return-type "none")
-)
-
-(define-method paste_clipboard
- (of-object "VteTerminal")
- (c-name "vte_terminal_paste_clipboard")
- (return-type "none")
-)
-
-(define-method copy_primary
- (of-object "VteTerminal")
- (c-name "vte_terminal_copy_primary")
- (return-type "none")
-)
-
-(define-method paste_primary
- (of-object "VteTerminal")
- (c-name "vte_terminal_paste_primary")
- (return-type "none")
-)
-
-(define-method select_all
- (of-object "VteTerminal")
- (c-name "vte_terminal_select_all")
- (return-type "none")
-)
-
-(define-method select_none
- (of-object "VteTerminal")
- (c-name "vte_terminal_select_none")
- (return-type "none")
-)
-
-(define-method set_size
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_size")
- (return-type "none")
- (parameters
- '("glong" "columns")
- '("glong" "rows")
- )
-)
-
-(define-method set_audible_bell
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_audible_bell")
- (return-type "none")
- (parameters
- '("gboolean" "is_audible")
- )
-)
-
-(define-method get_audible_bell
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_audible_bell")
- (return-type "gboolean")
-)
-
-(define-method set_visible_bell
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_visible_bell")
- (return-type "none")
- (parameters
- '("gboolean" "is_visible")
- )
-)
-
-(define-method get_visible_bell
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_visible_bell")
- (return-type "gboolean")
-)
-
-(define-method set_scroll_background
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_scroll_background")
- (return-type "none")
- (parameters
- '("gboolean" "scroll")
- )
-)
-
-(define-method set_scroll_on_output
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_scroll_on_output")
- (return-type "none")
- (parameters
- '("gboolean" "scroll")
- )
-)
-
-(define-method set_scroll_on_keystroke
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_scroll_on_keystroke")
- (return-type "none")
- (parameters
- '("gboolean" "scroll")
- )
-)
-
-(define-method set_color_dim
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_color_dim")
- (return-type "none")
- (parameters
- '("const-GdkColor*" "dim")
- )
-)
-
-(define-method set_color_bold
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_color_bold")
- (return-type "none")
- (parameters
- '("const-GdkColor*" "bold")
- )
-)
-
-(define-method set_color_foreground
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_color_foreground")
- (return-type "none")
- (parameters
- '("const-GdkColor*" "foreground")
- )
-)
-
-(define-method set_color_background
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_color_background")
- (return-type "none")
- (parameters
- '("const-GdkColor*" "background")
- )
-)
-
-(define-method set_color_cursor
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_color_cursor")
- (return-type "none")
- (parameters
- '("const-GdkColor*" "cursor_background")
- )
-)
-
-(define-method set_color_highlight
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_color_highlight")
- (return-type "none")
- (parameters
- '("const-GdkColor*" "highlight_background")
- )
-)
-
-(define-method set_colors
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_colors")
- (return-type "none")
- (parameters
- '("const-GdkColor*" "foreground")
- '("const-GdkColor*" "background")
- '("const-GdkColor*" "palette")
- '("glong" "palette_size")
- )
-)
-
-(define-method set_default_colors
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_default_colors")
- (return-type "none")
-)
-
-(define-method set_background_image
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_background_image")
- (return-type "none")
- (parameters
- '("GdkPixbuf*" "image")
- )
-)
-
-(define-method set_background_image_file
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_background_image_file")
- (return-type "none")
- (parameters
- '("const-char*" "path")
- )
-)
-
-(define-method set_background_tint_color
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_background_tint_color")
- (return-type "none")
- (parameters
- '("const-GdkColor*" "color")
- )
-)
-
-(define-method set_background_saturation
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_background_saturation")
- (return-type "none")
- (parameters
- '("double" "saturation")
- )
-)
-
-(define-method set_background_transparent
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_background_transparent")
- (return-type "none")
- (parameters
- '("gboolean" "transparent")
- )
-)
-
-(define-method set_opacity
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_opacity")
- (return-type "none")
- (parameters
- '("guint16" "opacity")
- )
-)
-
-(define-method set_cursor_blinks
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_cursor_blinks")
- (return-type "none")
- (parameters
- '("gboolean" "blink")
- )
-)
-
-(define-method set_cursor_blink_mode
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_cursor_blink_mode")
- (return-type "none")
- (parameters
- '("VteTerminalCursorBlinkMode" "mode")
- )
-)
-
-(define-method get_cursor_blink_mode
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_cursor_blink_mode")
- (return-type "VteTerminalCursorBlinkMode")
-)
-
-(define-method set_cursor_shape
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_cursor_shape")
- (return-type "none")
- (parameters
- '("VteTerminalCursorShape" "shape")
- )
-)
-
-(define-method get_cursor_shape
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_cursor_shape")
- (return-type "VteTerminalCursorShape")
-)
-
-(define-method set_scrollback_lines
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_scrollback_lines")
- (return-type "none")
- (parameters
- '("glong" "lines")
- )
-)
-
-(define-method im_append_menuitems
- (of-object "VteTerminal")
- (c-name "vte_terminal_im_append_menuitems")
- (return-type "none")
- (parameters
- '("GtkMenuShell*" "menushell")
- )
-)
-
-(define-method set_font
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_font")
- (return-type "none")
- (parameters
- '("const-PangoFontDescription*" "font_desc")
- )
-)
-
-(define-method set_font_full
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_font_full")
- (return-type "none")
- (parameters
- '("const-PangoFontDescription*" "font_desc")
- '("VteTerminalAntiAlias" "antialias")
- )
-)
-
-(define-method set_font_from_string
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_font_from_string")
- (return-type "none")
- (parameters
- '("const-char*" "name")
- )
-)
-
-(define-method set_font_from_string_full
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_font_from_string_full")
- (return-type "none")
- (parameters
- '("const-char*" "name")
- '("VteTerminalAntiAlias" "antialias")
- )
-)
-
-(define-method get_font
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_font")
- (return-type "const-PangoFontDescription*")
-)
-
-(define-method get_using_xft
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_using_xft")
- (return-type "gboolean")
-)
-
-(define-method set_allow_bold
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_allow_bold")
- (return-type "none")
- (parameters
- '("gboolean" "allow_bold")
- )
-)
-
-(define-method get_allow_bold
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_allow_bold")
- (return-type "gboolean")
-)
-
-(define-method get_has_selection
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_has_selection")
- (return-type "gboolean")
-)
-
-(define-method set_word_chars
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_word_chars")
- (return-type "none")
- (parameters
- '("const-char*" "spec")
- )
-)
-
-(define-method is_word_char
- (of-object "VteTerminal")
- (c-name "vte_terminal_is_word_char")
- (return-type "gboolean")
- (parameters
- '("gunichar" "c")
- )
-)
-
-(define-method set_backspace_binding
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_backspace_binding")
- (return-type "none")
- (parameters
- '("VteTerminalEraseBinding" "binding")
- )
-)
-
-(define-method set_delete_binding
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_delete_binding")
- (return-type "none")
- (parameters
- '("VteTerminalEraseBinding" "binding")
- )
-)
-
-(define-method set_mouse_autohide
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_mouse_autohide")
- (return-type "none")
- (parameters
- '("gboolean" "setting")
- )
-)
-
-(define-method get_mouse_autohide
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_mouse_autohide")
- (return-type "gboolean")
-)
-
-(define-method reset
- (of-object "VteTerminal")
- (c-name "vte_terminal_reset")
- (return-type "none")
- (parameters
- '("gboolean" "full")
- '("gboolean" "clear_history")
- )
-)
-
-(define-method get_text
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_text")
- (return-type "char*")
- (parameters
- '("gboolean(*" "is_selected")
- )
-)
-
-(define-method get_text_include_trailing_spaces
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_text_include_trailing_spaces")
- (return-type "char*")
- (parameters
- '("gboolean(*" "is_selected")
- )
-)
-
-(define-method get_text_range
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_text_range")
- (return-type "char*")
- (parameters
- '("glong" "start_row")
- '("glong" "start_col")
- '("glong" "end_row")
- '("glong" "end_col")
- '("gboolean(*" "is_selected")
- )
-)
-
-(define-method get_cursor_position
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_cursor_position")
- (return-type "none")
- (parameters
- '("glong*" "column")
- '("glong*" "row")
- )
-)
-
-(define-method match_clear_all
- (of-object "VteTerminal")
- (c-name "vte_terminal_match_clear_all")
- (return-type "none")
-)
-
-(define-method match_add
- (of-object "VteTerminal")
- (c-name "vte_terminal_match_add")
- (return-type "int")
- (parameters
- '("const-char*" "match")
- )
-)
-
-(define-method match_add_gregex
- (of-object "VteTerminal")
- (c-name "vte_terminal_match_add_gregex")
- (return-type "int")
- (parameters
- '("GRegex*" "regex")
- '("GRegexMatchFlags" "flags" (default 0))
- )
-)
-
-(define-method match_set_cursor
- (of-object "VteTerminal")
- (c-name "vte_terminal_match_set_cursor")
- (return-type "none")
- (parameters
- '("int" "tag")
- '("GdkCursor*" "cursor")
- )
-)
-
-(define-method match_set_cursor_type
- (of-object "VteTerminal")
- (c-name "vte_terminal_match_set_cursor_type")
- (return-type "none")
- (parameters
- '("int" "tag")
- '("GdkCursorType" "cursor_type")
- )
-)
-
-(define-method match_set_cursor_name
- (of-object "VteTerminal")
- (c-name "vte_terminal_match_set_cursor_name")
- (return-type "none")
- (parameters
- '("int" "tag")
- '("const-char*" "cursor_name")
- )
-)
-
-(define-method match_remove
- (of-object "VteTerminal")
- (c-name "vte_terminal_match_remove")
- (return-type "none")
- (parameters
- '("int" "tag")
- )
-)
-
-(define-method match_check
- (of-object "VteTerminal")
- (c-name "vte_terminal_match_check")
- (return-type "char*")
- (parameters
- '("glong" "column")
- '("glong" "row")
- '("int*" "tag")
- )
-)
-
-(define-method set_emulation
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_emulation")
- (return-type "none")
- (parameters
- '("const-char*" "emulation")
- )
-)
-
-(define-method get_emulation
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_emulation")
- (return-type "const-char*")
-)
-
-(define-method get_default_emulation
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_default_emulation")
- (return-type "const-char*")
-)
-
-(define-method set_encoding
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_encoding")
- (return-type "none")
- (parameters
- '("const-char*" "codeset")
- )
-)
-
-(define-method get_encoding
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_encoding")
- (return-type "const-char*")
-)
-
-(define-method get_status_line
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_status_line")
- (return-type "const-char*")
-)
-
-(define-method get_padding
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_padding")
- (return-type "none")
- (parameters
- '("int*" "xpad")
- '("int*" "ypad")
- )
-)
-
-(define-method set_pty
- (of-object "VteTerminal")
- (c-name "vte_terminal_set_pty")
- (return-type "none")
- (parameters
- '("int" "pty_master")
- )
-)
-
-(define-method get_pty
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_pty")
- (return-type "int")
-)
-
-(define-method get_adjustment
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_adjustment")
- (return-type "GtkAdjustment*")
-)
-
-(define-method get_char_width
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_char_width")
- (return-type "glong")
-)
-
-(define-method get_char_height
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_char_height")
- (return-type "glong")
-)
-
-(define-method get_char_descent
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_char_descent")
- (return-type "glong")
-)
-
-(define-method get_char_ascent
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_char_ascent")
- (return-type "glong")
-)
-
-(define-method get_row_count
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_row_count")
- (return-type "glong")
-)
-
-(define-method get_column_count
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_column_count")
- (return-type "glong")
-)
-
-(define-method get_window_title
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_window_title")
- (return-type "const-char*")
-)
-
-(define-method get_icon_title
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_icon_title")
- (return-type "const-char*")
-)
-
-(define-method get_child_exit_status
- (of-object "VteTerminal")
- (c-name "vte_terminal_get_child_exit_status")
- (return-type "int")
-)
-
-
-
-;; From vtetypebuiltins.h
-
-(define-function vte_terminal_erase_binding_get_type
- (c-name "vte_terminal_erase_binding_get_type")
- (return-type "GType")
-)
-
-(define-function vte_terminal_anti_alias_get_type
- (c-name "vte_terminal_anti_alias_get_type")
- (return-type "GType")
-)
-
-(define-function vte_terminal_cursor_blink_mode_get_type
- (c-name "vte_terminal_cursor_blink_mode_get_type")
- (return-type "GType")
-)
-
-(define-function vte_terminal_cursor_shape_get_type
- (c-name "vte_terminal_cursor_shape_get_type")
- (return-type "GType")
-)
-
-
-
-;; From vteversion.h
-
-
diff --git a/python/vte.override b/python/vte.override
deleted file mode 100644
index 3f26f5a5..00000000
--- a/python/vte.override
+++ /dev/null
@@ -1,657 +0,0 @@
-/* -*- Mode: C; c-basic-offset: 4 -*- */
-%%
-headers
-#include <Python.h>
-#define NO_IMPORT_PYGTK
-#include <pygtk/pygtk.h>
-#include <pygobject.h>
-#include <gtk/gtk.h>
-#include "../src/vte.h"
-
-void pyvte_add_constants(PyObject *module, const gchar *strip_prefix);
-void pyvte_register_classes(PyObject *d);
-%%
-modulename vte
-%%
-import gtk.gdk.Pixbuf as PyGdkPixbuf_Type
-import gtk.MenuShell as PyGtkMenuShell_Type
-import gtk.Widget as PyGtkWidget_Type
-%%
-override vte_terminal_feed kwargs
-static PyObject *
-_wrap_vte_terminal_feed(PyGObject *self, PyObject *args, PyObject *kwargs)
-{
- static char *kwlist[] = { "data", "length", NULL };
- char *data;
- int length;
- PyObject *length_obj = NULL;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "s#|O:VteTerminal.feed",
- kwlist, &data, &length, &length_obj)) {
- return NULL;
- }
- if ((length_obj != NULL) && PyNumber_Check(length_obj)) {
- PyObject *intobj;
- intobj = PyNumber_Int(length_obj);
- if (intobj) {
- if (PyInt_AsLong(intobj) != -1) {
- length = PyInt_AsLong(intobj);
- }
- Py_DECREF(intobj);
- }
- }
- vte_terminal_feed(VTE_TERMINAL(self->obj), data, length);
- Py_INCREF(Py_None);
- return Py_None;
-}
-%%
-override vte_terminal_feed_child kwargs
-static PyObject *
-_wrap_vte_terminal_feed_child(PyGObject *self, PyObject *args, PyObject *kwargs)
-{
- static char *kwlist[] = { "data", "length", NULL };
- char *data;
- int length;
- PyObject *length_obj = NULL;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "s#|O:VteTerminal.feed_child",
- kwlist, &data, &length, &length_obj)) {
- return NULL;
- }
- if ((length_obj != NULL) && PyNumber_Check(length_obj)) {
- PyObject *intobj;
- intobj = PyNumber_Int(length_obj);
- if (intobj) {
- if (PyInt_AsLong(intobj) != -1) {
- length = PyInt_AsLong(intobj);
- }
- Py_DECREF(intobj);
- }
- }
- vte_terminal_feed_child(VTE_TERMINAL(self->obj), data, length);
- Py_INCREF(Py_None);
- return Py_None;
-}
-%%
-override vte_terminal_feed_child_binary kwargs
-static PyObject *
-_wrap_vte_terminal_feed_child_binary(PyGObject *self, PyObject *args, PyObject *kwargs)
-{
- static char *kwlist[] = { "data", "length", NULL };
- char *data;
- int length;
- PyObject *length_obj = NULL;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "s#|O:VteTerminal.feed_child_binary",
- kwlist, &data, &length, &length_obj)) {
- return NULL;
- }
- if ((length_obj != NULL) && PyNumber_Check(length_obj)) {
- PyObject *intobj;
- intobj = PyNumber_Int(length_obj);
- if (intobj) {
- if (PyInt_AsLong(intobj) != -1) {
- length = PyInt_AsLong(intobj);
- }
- Py_DECREF(intobj);
- }
- }
- vte_terminal_feed_child_binary(VTE_TERMINAL(self->obj), data, length);
- Py_INCREF(Py_None);
- return Py_None;
-}
-%%
-override vte_terminal_fork_command kwargs
-
-static int
-_build_envv(PyObject *py_envv, char ***envv)
-{
- int i, pos, n_envs;
- PyObject *py_dict_k, *py_dict_v;
-
- if (py_envv == NULL || py_envv == Py_None) {
- return 0;
- }
-
- if (PyDict_Check(py_envv)) {
- n_envs = PyMapping_Length(py_envv);
- *envv = g_new(gchar *, n_envs + 1);
- pos = 0;
- i = 0;
- while (PyDict_Next(py_envv, &pos, &py_dict_k, &py_dict_v)) {
- (*envv)[i++] = g_strdup_printf("%s=%s",
- PyString_AsString(py_dict_k),
- PyString_AsString(py_dict_v));
- }
- (*envv)[n_envs] = NULL;
- } else if (PySequence_Check(py_envv)) {
- n_envs = PySequence_Length(py_envv);
- *envv = g_new(gchar *, n_envs + 1);
- for (i = 0; i < n_envs; i++) {
- PyObject *item = PySequence_GetItem(py_envv, i);
- Py_DECREF(item); /* PySequence_GetItem INCREF's */
- (*envv)[i] = PyString_AsString(item);
- }
- (*envv)[n_envs] = NULL;
- } else {
- PyErr_SetString(PyExc_TypeError,
- "envv must be a sequence or a dictionary");
- return -1;
- }
-
- return n_envs;
-}
-
-static void
-_free_envv(PyObject *py_envv, char **envv)
-{
- if (PyDict_Check(py_envv)) {
- g_strfreev(envv);
- } else {
- g_free(envv);
- }
-}
-
-static PyObject *
-_wrap_vte_terminal_fork_command(PyGObject * self, PyObject * args,
- PyObject * kwargs)
-{
- gchar **argv = NULL, **envv = NULL;
- gchar *command = NULL, *directory = NULL;
- static char *kwlist[] = { "command", "argv", "envv", "directory",
- "loglastlog", "logutmp", "logwtmp",
- NULL };
- PyObject *py_argv = NULL, *py_envv = NULL,
- *loglastlog = NULL, *logutmp = NULL, *logwtmp = NULL;
- int i, n_args, n_envs;
- pid_t pid;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|zOOzOOO:fork_command",
- kwlist, &command, &py_argv, &py_envv,
- &directory,
- &loglastlog, &logutmp, &logwtmp)) {
- return NULL;
- }
-
-
- if (py_argv != NULL && py_argv != Py_None) {
- if (!PySequence_Check(py_argv)) {
- PyErr_SetString(PyExc_TypeError,
- "argv must be a sequence");
- return NULL;
- }
-
- n_args = PySequence_Length(py_argv);
- argv = g_new(gchar *, n_args + 1);
- for (i = 0; i < n_args; i++) {
- PyObject *item = PySequence_GetItem(py_argv, i);
- Py_DECREF(item); /* PySequence_GetItem INCREF's */
- argv[i] = PyString_AsString(item);
- }
- argv[n_args] = NULL;
- }
-
- n_envs = _build_envv(py_envv, &envv);
- if (n_envs == -1) {
- g_free(argv);
- return NULL;
- }
-
- pid = vte_terminal_fork_command(VTE_TERMINAL(self->obj),
- command, argv, envv, directory,
- (loglastlog != NULL) &&
- PyObject_IsTrue(loglastlog),
- (logutmp != NULL) &&
- PyObject_IsTrue(logutmp),
- (logwtmp != NULL) &&
- PyObject_IsTrue(logwtmp));
-
- if (envv) {
- _free_envv(py_envv, envv);
- }
-
- if (argv) {
- g_free(argv);
- }
-
- return PyInt_FromLong(pid);
-}
-%%
-override vte_terminal_forkpty kwargs
-
-static PyObject *
-_wrap_vte_terminal_forkpty(PyGObject * self, PyObject * args, PyObject * kwargs)
-{
- gchar **envv = NULL, *directory = NULL;
- static char *kwlist[] = { "envv", "directory",
- "loglastlog", "logutmp", "logwtmp",
- NULL };
- PyObject *py_envv = NULL,
- *loglastlog = NULL, *logutmp = NULL, *logwtmp = NULL;
- int n_envs;
- pid_t pid;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OzOOO:forkpty",
- kwlist, &py_envv, &directory,
- &loglastlog, &logutmp, &logwtmp)) {
- return NULL;
- }
-
- n_envs = _build_envv(py_envv, &envv);
- if (n_envs == -1) {
- return NULL;
- }
-
- pid = vte_terminal_forkpty(VTE_TERMINAL(self->obj),
- envv, directory,
- (loglastlog != NULL) &&
- PyObject_IsTrue(loglastlog),
- (logutmp != NULL) &&
- PyObject_IsTrue(logutmp),
- (logwtmp != NULL) &&
- PyObject_IsTrue(logwtmp));
-
- if (envv) {
- _free_envv(py_envv, envv);
- }
-
- return PyInt_FromLong(pid);
-}
-%%
-override vte_terminal_get_cursor_position noargs
-
-static PyObject *
-_wrap_vte_terminal_get_cursor_position(PyGObject *self)
-{
- PyObject *ret;
- glong column, row;
-
- vte_terminal_get_cursor_position(VTE_TERMINAL(self->obj),
- &column, &row);
- ret = PyTuple_New(2);
- PyTuple_SetItem(ret, 0, PyInt_FromLong(column));
- PyTuple_SetItem(ret, 1, PyInt_FromLong(row));
- return ret;
-}
-%%
-override vte_terminal_get_padding noargs
-
-static PyObject *
-_wrap_vte_terminal_get_padding(PyGObject *self)
-{
- PyObject *ret;
- int xpad, ypad;
-
- vte_terminal_get_padding(VTE_TERMINAL(self->obj), &xpad, &ypad);
- ret = PyTuple_New(2);
- PyTuple_SetItem(ret, 0, PyInt_FromLong(xpad));
- PyTuple_SetItem(ret, 1, PyInt_FromLong(ypad));
- return ret;
-}
-%%
-override vte_terminal_get_text kwargs
-
-static gboolean
-call_callback(VteTerminal *terminal, glong column, glong row, gpointer data)
-{
- PyObject *cb, *args, *result;
- gboolean ret;
-
- if (!PySequence_Check(data)) {
- PyErr_SetString(PyExc_TypeError, "expected argument list in a tuple");
- return FALSE;
- }
-
- cb = PySequence_GetItem(data, 0); /* INCREFs */
- Py_XDECREF(cb);
-
- if (!PyCallable_Check(cb)) {
- PyErr_SetString(PyExc_TypeError, "callback is not a callable object");
- return FALSE;
- }
-
- args = PyTuple_New(4);
- PyTuple_SetItem(args, 0, PySequence_GetItem(data, 1));
- PyTuple_SetItem(args, 1, PyInt_FromLong(column));
- PyTuple_SetItem(args, 2, PyInt_FromLong(row));
- PyTuple_SetItem(args, 3, PySequence_GetItem(data, 2));
-
- result = PyObject_CallObject(cb, args);
- Py_DECREF(args);
-
- ret = (result && PyObject_IsTrue(result));
- Py_XDECREF(result);
-
- return ret;
-}
-
-static PyObject*
-build_attributes(GArray *attrs)
-{
- PyObject *py_attrs = PyTuple_New(attrs->len);
- int count;
- PyObject *row = PyString_FromString("row");
- PyObject *column = PyString_FromString("column");
- PyObject *fore = PyString_FromString("fore");
- PyObject *back = PyString_FromString("back");
- PyObject *underline = PyString_FromString("underline");
- PyObject *striketrough = PyString_FromString("striketrough");
-
- for (count = 0; count < attrs->len; count++) {
- VteCharAttributes *cht;
- PyObject *py_char_attr;
-
- py_char_attr = Py_BuildValue("{S:l,S:l,S:N,S:N,S:I,S:I}",
- row, cht->row,
- column, cht->column,
- fore, pyg_boxed_new(GDK_TYPE_COLOR, &cht->fore, TRUE, TRUE),
- back, pyg_boxed_new(GDK_TYPE_COLOR, &cht->back, TRUE, TRUE),
- underline, (unsigned int) cht->underline,
- striketrough, (unsigned int) cht->strikethrough);
- PyTuple_SetItem(py_attrs, count, py_char_attr);
- }
-
- Py_DECREF(row);
- Py_DECREF(column);
- Py_DECREF(fore);
- Py_DECREF(back);
- Py_DECREF(underline);
- Py_DECREF(striketrough);
-
- return py_attrs;
-}
-
-static gboolean
-always_true(VteTerminal *terminal, glong row, glong column, gpointer data)
-{
- return TRUE;
-}
-
-static PyObject *
-_wrap_vte_terminal_get_text(PyGObject *self, PyObject *args, PyObject *kwargs)
-{
- static char *kwlist[] = { "callback", "get_attributes", "data", NULL };
- PyObject *callback = NULL, *do_attr = NULL, *data = NULL;
- PyObject *callback_and_args = NULL;
- PyObject *result = NULL;
- GArray *attrs = NULL;
- char *text;
- PyObject *py_attrs;
- int count;
- long length;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OO:terminal_get_text",
- kwlist, &callback, &do_attr, &data)) {
- return NULL;
- }
-
- if ((do_attr != NULL) && (PyObject_IsTrue(do_attr))) {
- attrs = g_array_new(FALSE, TRUE, sizeof(VteCharAttributes));
- } else {
- attrs = NULL;
- }
-
- if (callback != NULL) {
- if (!PyCallable_Check(callback)) {
- PyErr_SetString(PyExc_TypeError, "1st argument not callable.");
- if (attrs) {
- g_array_free(attrs, TRUE);
- }
- return NULL;
- }
-
- callback_and_args = PyTuple_New(3);
- Py_INCREF(callback); /* PyTuple_SetItem will assume ownership. */
- PyTuple_SetItem(callback_and_args, 0, callback);
- Py_INCREF(self); /* PyTuple_SetItem will assume ownership. */
- PyTuple_SetItem(callback_and_args, 1, (PyObject*) self);
- if (data != NULL) {
- Py_INCREF(data); /* PyTuple_SetItem will assume ownership. */
- PyTuple_SetItem(callback_and_args, 2, data);
- } else {
- PyTuple_SetItem(callback_and_args, 2, PyTuple_New(0));
- }
- text = vte_terminal_get_text(VTE_TERMINAL(self->obj),
- call_callback,
- callback_and_args,
- attrs);
- Py_DECREF(callback_and_args);
- } else {
- text = vte_terminal_get_text(VTE_TERMINAL(self->obj),
- always_true,
- NULL,
- attrs);
- }
-
- if (attrs) {
- py_attrs = build_attributes(attrs);
- length = attrs->len;
- g_array_free(attrs, TRUE);
- result = Py_BuildValue("(s#N)", text, length, py_attrs);
- } else {
- result = Py_BuildValue("s", text);
- }
-
- g_free (text);
- return result;
-}
-%%
-override vte_terminal_get_text_include_trailing_spaces kwargs
-
-static PyObject *
-_wrap_vte_terminal_get_text_include_trailing_spaces(PyGObject *self, PyObject *args, PyObject *kwargs)
-{
- static char *kwlist[] = { "callback", "get_attributes", "data", NULL };
- PyObject *callback = NULL, *do_attr = NULL, *data = NULL;
- PyObject *callback_and_args = NULL;
- PyObject *result = NULL;
- GArray *attrs = NULL;
- char *text;
- PyObject *py_attrs;
- int count;
- long length;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OO:terminal_get_text_include_trailing_spaces",
- kwlist, &callback, &do_attr, &data)) {
- return NULL;
- }
-
- if ((do_attr != NULL) && (PyObject_IsTrue(do_attr))) {
- attrs = g_array_new(FALSE, TRUE, sizeof(VteCharAttributes));
- } else {
- attrs = NULL;
- }
-
- if (callback != NULL) {
- if (!PyCallable_Check(callback)) {
- PyErr_SetString(PyExc_TypeError, "1st argument not callable.");
- if (attrs) {
- g_array_free(attrs, TRUE);
- }
- return NULL;
- }
-
- callback_and_args = PyTuple_New(3);
- Py_INCREF(callback); /* PyTuple_SetItem will assume ownership. */
- PyTuple_SetItem(callback_and_args, 0, callback);
- Py_INCREF(self); /* PyTuple_SetItem will assume ownership. */
- PyTuple_SetItem(callback_and_args, 1, (PyObject*) self);
- if (data != NULL) {
- Py_INCREF(data); /* PyTuple_SetItem will assume ownership. */
- PyTuple_SetItem(callback_and_args, 2, data);
- } else {
- PyTuple_SetItem(callback_and_args, 2, PyTuple_New(0));
- }
- text = vte_terminal_get_text_include_trailing_spaces(VTE_TERMINAL(self->obj),
- call_callback,
- callback_and_args,
- attrs);
- Py_DECREF(callback_and_args);
- } else {
- text = vte_terminal_get_text_include_trailing_spaces(VTE_TERMINAL(self->obj),
- always_true,
- NULL,
- attrs);
- }
-
- if (attrs) {
- py_attrs = build_attributes(attrs);
- length = attrs->len;
- g_array_free(attrs, TRUE);
- result = Py_BuildValue("(s#N)", text, length, py_attrs);
- } else {
- result = Py_BuildValue("s", text);
- }
- g_free (text);
- return result;
-}
-%%
-override vte_terminal_get_text_range kwargs
-static PyObject *
-_wrap_vte_terminal_get_text_range(PyGObject *self, PyObject *args, PyObject *kwargs)
-{
- static char *kwlist[] = { "start_row", "start_col", "end_row", "end_col",
- "callback", "get_attributes", "data", NULL };
- PyObject *callback = NULL, *do_attr = NULL, *data = NULL;
- glong start_row, start_col, end_row, end_col;
- PyObject *callback_and_args = NULL;
- PyObject *result = NULL;
- GArray *attrs = NULL;
- char *text;
- PyObject *py_attrs;
- int count;
- long length;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs,
- "llllO|OO:terminal_get_text_range",
- kwlist,
- &start_row, &start_col, &end_row, &end_col,
- &callback, &do_attr, &data)) {
- return NULL;
- }
-
- if ((do_attr != NULL) && (PyObject_IsTrue(do_attr))) {
- attrs = g_array_new(FALSE, TRUE, sizeof(VteCharAttributes));
- } else {
- attrs = NULL;
- }
-
- if (callback != NULL) {
- if (!PyCallable_Check(callback)) {
- PyErr_SetString(PyExc_TypeError, "1st argument not callable.");
- if (attrs) {
- g_array_free(attrs, TRUE);
- }
- return NULL;
- }
-
- callback_and_args = PyTuple_New(3);
- Py_INCREF(callback); /* PyTuple_SetItem will assume ownership. */
- PyTuple_SetItem(callback_and_args, 0, callback);
- Py_INCREF(self); /* PyTuple_SetItem will assume ownership. */
- PyTuple_SetItem(callback_and_args, 1, (PyObject*) self);
- if (data != NULL) {
- Py_INCREF(data); /* PyTuple_SetItem will assume ownership. */
- PyTuple_SetItem(callback_and_args, 2, data);
- } else {
- PyTuple_SetItem(callback_and_args, 2, PyTuple_New(0));
- }
- text = vte_terminal_get_text_range(VTE_TERMINAL(self->obj),
- start_row, start_col,
- end_row, end_col,
- call_callback,
- callback_and_args,
- attrs);
- Py_DECREF(callback_and_args);
- } else {
- text = vte_terminal_get_text_range(VTE_TERMINAL(self->obj),
- start_row, start_col,
- end_row, end_col,
- always_true,
- NULL,
- attrs);
- }
-
- if (attrs) {
- py_attrs = build_attributes(attrs);
- length = attrs->len;
- g_array_free(attrs, TRUE);
- result = Py_BuildValue("(s#N)", text, length, py_attrs);
- } else {
- result = Py_BuildValue("s", text);
- }
-
- g_free (text);
- return result;
-}
-%%
-override vte_terminal_set_colors kwargs
-static PyObject *
-_wrap_vte_terminal_set_colors(PyGObject *self, PyObject *args, PyObject *kwargs)
-{
- static char *kwlist[] = { "foreground", "background", "palette", NULL };
- PyObject *py_foreground, *py_background, *py_palette, *item;
- int palette_size, i;
- GdkColor *foreground = NULL, *background = NULL, *palette = NULL;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:VteTerminal.set_colors", kwlist, &py_foreground, &py_background, &py_palette, &palette_size))
- return NULL;
- if (pyg_boxed_check(py_foreground, GDK_TYPE_COLOR))
- foreground = pyg_boxed_get(py_foreground, GdkColor);
- else {
- PyErr_SetString(PyExc_TypeError, "foreground should be a GdkColor");
- return NULL;
- }
- if (pyg_boxed_check(py_background, GDK_TYPE_COLOR))
- background = pyg_boxed_get(py_background, GdkColor);
- else {
- PyErr_SetString(PyExc_TypeError, "background should be a GdkColor");
- return NULL;
- }
- if (PySequence_Check(py_palette)) {
- palette_size = PySequence_Length(py_palette);
- palette = g_malloc(sizeof(GdkColor) * palette_size);
- for (i = 0; i < palette_size; i++) {
- item = PySequence_GetItem(py_palette, i); /* INCREFs */
- if (!pyg_boxed_check(item, GDK_TYPE_COLOR)) {
- g_free(palette);
- PyErr_SetString(PyExc_TypeError, "palette should be a list of GdkColors");
- return NULL;
- }
- palette[i] = *((GdkColor*)pyg_boxed_get(item, GdkColor));
- Py_DECREF(item);
- }
- } else {
- PyErr_SetString(PyExc_TypeError, "palette should be a list of GdkColors");
- return NULL;
- }
- vte_terminal_set_colors(VTE_TERMINAL(self->obj), foreground, background, palette, palette_size);
- g_free(palette);
- Py_INCREF(Py_None);
- return Py_None;
-}
-%%
-override vte_terminal_match_check kwargs
-static PyObject *
-_wrap_vte_terminal_match_check(PyGObject *self, PyObject *args, PyObject *kwargs)
-{
- static char *kwlist[] = { "column", "row", NULL };
- gchar *ret;
- glong column, row;
- int *tag;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ll:VteTerminal.match_check", kwlist, &column, &row))
- return NULL;
- ret = vte_terminal_match_check(VTE_TERMINAL(self->obj), column, row, &tag);
- if (ret) {
- PyObject *py_ret = Py_BuildValue("si", ret, tag);
- g_free(ret);
- return py_ret;
- }
- Py_INCREF(Py_None);
- return Py_None;
-}
-%%
diff --git a/python/vtemodule.c b/python/vtemodule.c
deleted file mode 100644
index 3bd42693..00000000
--- a/python/vtemodule.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2002 Red Hat, Inc.
- *
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "../config.h"
-#endif
-#include <Python.h>
-#include <pygobject.h>
-#include <pygtk/pygtk.h>
-#include "../src/vte.h"
-
-extern void pyvte_register_classes(PyObject * d);
-extern void pyvte_add_constants(PyObject *module, const gchar *strip_prefix);
-extern PyMethodDef pyvte_functions[];
-extern DL_EXPORT(void) initvte(void);
-extern PyTypeObject PyVteTerminal_Type;
-
-DL_EXPORT(void)
-initvte(void)
-{
- PyObject *m, *d;
-
- init_pygobject();
- init_pygtk();
-
- m = Py_InitModule("vte", pyvte_functions);
- d = PyModule_GetDict(m);
-
- pyvte_register_classes(d);
- pyvte_add_constants(m, "VTE_");
-
- if (PyErr_Occurred()) {
- Py_FatalError("can't initialise module vte");
- }
-}
diff --git a/src/Makefile.am b/src/Makefile.am
index 1971458e..05c54b2d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,13 +5,11 @@ EXTRA_DIST = iso2022.txt
# The library
headerdir = $(includedir)/vte-$(VTE_API_VERSION)/vte
-header_HEADERS = pty.h reaper.h vte.h vteaccess.h vtepty.h vtetypebuiltins.h vteversion.h vtedeprecated.h
+header_HEADERS = vte.h vtepty.h vtetypebuiltins.h vteversion.h
-lib_LTLIBRARIES = libvte@VTE_LIBRARY_SUFFIX_U@.la
+lib_LTLIBRARIES = libvte-@VTE_API_MAJOR_VERSION@.@VTE_API_MINOR_VERSION@.la
-EXTRA_libvte@VTE_LIBRARY_SUFFIX_U@_la_SOURCES = \
- genkeysyms.py \
- keysyms.c \
+EXTRA_libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_SOURCES = \
marshal.list \
mkunitables.sh \
unitable.CNS11643 \
@@ -30,7 +28,8 @@ EXTRA_libvte@VTE_LIBRARY_SUFFIX_U@_la_SOURCES = \
vtetypebuiltins.h.template \
$(NULL)
-libvte@VTE_LIBRARY_SUFFIX_U@_la_SOURCES = \
+libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_SOURCES = \
+ box_drawing.h \
buffer.h \
caps.c \
caps.h \
@@ -45,9 +44,6 @@ libvte@VTE_LIBRARY_SUFFIX_U@_la_SOURCES = \
matcher.c \
matcher.h \
pty.c \
- pty.h \
- reaper.c \
- reaper.h \
ring.c \
ring.h \
table.c \
@@ -56,22 +52,17 @@ libvte@VTE_LIBRARY_SUFFIX_U@_la_SOURCES = \
trie.h \
vte.c \
vte.h \
- vte-gtk-compat.h \
vte-private.h \
vteaccess.c \
vteaccess.h \
- vtebg.c \
- vtebg.h \
vteconv.c \
vteconv.h \
vtedraw.c \
vtedraw.h \
- vtedeprecated.h \
vteint.h \
vtepty.h \
vtepty-private.h \
- vteregex.c \
- vteregex.h \
+ vteresources.c \
vterowdata.c \
vterowdata.h \
vteseq.c \
@@ -88,24 +79,27 @@ libvte@VTE_LIBRARY_SUFFIX_U@_la_SOURCES = \
vtetypebuiltins.h \
vteunistr.c \
vteunistr.h \
+ vteutils.c \
+ vteutils.h \
vteversion.h
$(NULL)
-libvte@VTE_LIBRARY_SUFFIX_U@_la_CPPFLAGS = \
- -DG_LOG_DOMAIN=\"Vte-$(VTE_API_VERSION)\" \
- -DDATADIR='"$(datadir)"' \
+libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CPPFLAGS = \
+ -DG_LOG_DOMAIN=\"Vte\" \
+ -DVTE_API_VERSION=\"$(VTE_API_VERSION)\" \
+ -DDATADIR='"$(datadir)"' \
-DLIBEXECDIR='"$(libexecdir)"' \
-DLOCALEDIR='"$(localedir)"' \
- -DTERMCAPDIR='"$(pkgdatadir)/termcap-$(VTE_API_VERSION)"' \
+ -DGLIB_DISABLE_DEPRECATION_WARNINGS \
-DVTE_COMPILATION \
$(AM_CPPFLAGS)
-libvte@VTE_LIBRARY_SUFFIX_U@_la_CFLAGS = $(VTE_CFLAGS) $(AM_CFLAGS)
-libvte@VTE_LIBRARY_SUFFIX_U@_la_LIBADD = $(VTE_LIBS)
-libvte@VTE_LIBRARY_SUFFIX_U@_la_LDFLAGS = \
- $(VTE_LDFLAGS) \
+libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_CFLAGS = $(VTE_CFLAGS) $(AM_CFLAGS)
+libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_LIBADD = $(VTE_LIBS)
+libvte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_la_LDFLAGS = \
+ $(VTE_LDFLAGS) \
-version-info $(LT_VERSION_INFO) \
- -export-symbols-regex "^vte_terminal_.*|^vte_pty_.*|^vte_get_.*|^_vte_pty_.*|^vte_reaper_.*|_vte_debug_.*" \
+ -export-symbols-regex "^vte_.*" \
@LIBTOOL_EXPORT_OPTIONS@ @LIBTOOL_FLAGS@ \
$(AM_LDFLAGS)
@@ -113,26 +107,29 @@ libvte@VTE_LIBRARY_SUFFIX_U@_la_LDFLAGS = \
# Generated sources
VTESEQ_BUILTSOURCES = vteseq-list.h vteseq-2.c vteseq-n.c
-BUILT_SOURCES = marshal.c marshal.h vtetypebuiltins.c vtetypebuiltins.h $(VTESEQ_BUILTSOURCES)
+BUILT_SOURCES = box_drawing.h marshal.c marshal.h vtetypebuiltins.c vtetypebuiltins.h vteresources.c $(VTESEQ_BUILTSOURCES)
MAINTAINERCLEANFILES = $(VTESEQ_BUILTSOURCES)
-EXTRA_DIST += $(VTESEQ_BUILTSOURCES)
-CLEANFILES = marshal.c marshal.h vtetypebuiltins.c vtetypebuiltins.h stamp-vtetypebuiltins.h
+EXTRA_DIST += $(VTESEQ_BUILTSOURCES) box_drawing.txt
+CLEANFILES = box_drawing.h marshal.c marshal.h vtetypebuiltins.c vtetypebuiltins.h stamp-vtetypebuiltins.h vteresources.c
+
+box_drawing.h: box_drawing.txt
+ $(AM_V_GEN) $(srcdir)/box_drawing_generate.sh < $< > $@
marshal.c: marshal.list
$(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_vte_marshal --header --body --internal $< > $@
-
+
marshal.h: marshal.list
$(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_vte_marshal --header --internal $< > $@
vtetypebuiltins.h: stamp-vtetypebuiltins.h
@true
-stamp-vtetypebuiltins.h: vtetypebuiltins.h.template vte.h vtepty.h vtedeprecated.h
+stamp-vtetypebuiltins.h: vtetypebuiltins.h.template vte.h vtepty.h
$(AM_V_GEN) $(GLIB_MKENUMS) --template $< $(filter %.h,$^) > xgen-vtbh \
&& (cmp -s xgen-vtbh vtetypebuiltins.h || cp xgen-vtbh vtetypebuiltins.h ) \
&& rm -f xgen-vtbh \
&& echo timestamp > $(@F)
-vtetypebuiltins.c: vtetypebuiltins.c.template vte.h vtepty.h vtedeprecated.h
+vtetypebuiltins.c: vtetypebuiltins.c.template vte.h vtepty.h
$(AM_V_GEN) $(GLIB_MKENUMS) --template $< $(filter %.h,$^) > xgen-vtbc \
&& (cmp -s xgen-vtbc vtetypebuiltins.c || cp xgen-vtbc vtetypebuiltins.c ) \
&& rm -f xgen-vtbc
@@ -150,14 +147,31 @@ vteseq-list.h: vteseq-2.gperf vteseq-n.gperf
cat $^ | grep -v '^#' | grep '\<VTE_SEQUENCE_HANDLER\>'| sed 's/.*, //' | LANG=C sort -u >> $@.tmp && \
mv -f $@.tmp $@
+vteresources.c: vte.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies vte.gresource.xml)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir . --generate --c-name vte $<
# vte the application
-bin_PROGRAMS = vte@VTE_LIBRARY_SUFFIX_U@
+bin_PROGRAMS = vte-@VTE_API_MAJOR_VERSION@.@VTE_API_MINOR_VERSION@
-vte@VTE_LIBRARY_SUFFIX_U@_SOURCES = vteapp.c
-vte@VTE_LIBRARY_SUFFIX_U@_CFLAGS = $(VTE_CFLAGS)
-vte@VTE_LIBRARY_SUFFIX_U@_LDADD = libvte@VTE_LIBRARY_SUFFIX_U@.la $(VTE_LIBS)
+vte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_SOURCES = \
+ vteapp.c \
+ debug.c \
+ debug.h \
+ $(NULL)
+
+vte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_CPPFLAGS = \
+ -DGLIB_DISABLE_DEPRECATION_WARNINGS \
+ -DGDK_DISABLE_DEPRECATION_WARNINGS \
+ $(AM_CPPFLAGS)
+
+vte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_CFLAGS = \
+ $(VTE_CFLAGS) \
+ $(AM_CFLAGS)
+
+vte_@VTE_API_MAJOR_VERSION@_@VTE_API_MINOR_VERSION@_LDADD = \
+ libvte-$(VTE_API_VERSION).la \
+ $(VTE_LIBS)
# introspection
@@ -166,11 +180,14 @@ INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --warn-all
INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
if HAVE_INTROSPECTION
+include $(INTROSPECTION_MAKEFILE)
-Vte-@VTE_API_VERSION@.gir: libvte@VTE_LIBRARY_SUFFIX_U@.la
+Vte-@VTE_API_VERSION@.gir: libvte-$(VTE_API_VERSION).la
Vte_@VTE_API_VERSION_U@_gir_INCLUDES = Pango-1.0 Gdk-$(GTK_API_VERSION) Gtk-$(GTK_API_VERSION)
Vte_@VTE_API_VERSION_U@_gir_CFLAGS = $(VTE_CFLAGS) -DVTE_COMPILATION -I$(top_srcdir)
-Vte_@VTE_API_VERSION_U@_gir_LIBS = libvte@VTE_LIBRARY_SUFFIX_U@.la
+Vte_@VTE_API_VERSION_U@_gir_LIBS = libvte-$(VTE_API_VERSION).la
+Vte_@VTE_API_VERSION_U@_gir_EXPORT_PACKAGES = vte-$(VTE_API_VERSION)
+Vte_@VTE_API_VERSION_U@_gir_SCANNERFLAGS = --c-include "vte/vte.h"
Vte_@VTE_API_VERSION_U@_gir_FILES = \
vte.c \
vte.h \
@@ -182,15 +199,38 @@ Vte_@VTE_API_VERSION_U@_gir_FILES = \
INTROSPECTION_GIRS += Vte-$(VTE_API_VERSION).gir
-girdir = $(INTROSPECTION_GIRDIR)
+girdir = $(datadir)/gir-1.0
nodist_gir_DATA = $(INTROSPECTION_GIRS)
-typelibdir = $(INTROSPECTION_TYPELIBDIR)
+typelibdir = $(libdir)/girepository-1.0
nodist_typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
CLEANFILES += $(nodist_gir_DATA) $(nodist_typelib_DATA)
-endif
+if ENABLE_VAPIGEN
+include $(VAPIGEN_MAKEFILE)
+
+VAPIGEN_VAPIS = Vte-$(VTE_API_VERSION).vapi
+
+Vte-@VTE_API_VERSION@.vapi: Vte-$(VTE_API_VERSION).gir
+Vte_@VTE_API_VERSION_U@_vapi_DEPS = \
+ glib-2.0 \
+ gio-2.0 \
+ pango \
+ gdk-$(GTK_API_VERSION) \
+ gtk+-$(GTK_API_VERSION) \
+ $(NULL)
+Vte_@VTE_API_VERSION_U@_vapi_METADATADIRS = $(srcdir)
+Vte_@VTE_API_VERSION_U@_vapi_FILES = Vte-$(VTE_API_VERSION).gir
+
+vapidir = $(datadir)/vala/vapi
+nodist_vapi_DATA = $(VAPIGEN_VAPIS)
+
+CLEANFILES += $(nodist_vapi_DATA)
+
+endif # ENABLE_VAPIGEN
+
+endif # HAVE_INTROSPECTION
# Misc unit tests and utilities
@@ -198,10 +238,13 @@ noinst_PROGRAMS = interpret slowcat
noinst_SCRIPTS = decset osc window
EXTRA_DIST += $(noinst_SCRIPTS)
-TEST_SH = check-doc-syntax.sh
+TEST_SH = \
+ check-doc-syntax.sh \
+ test-vte-sh.sh \
+ $(NULL)
EXTRA_DIST += $(TEST_SH)
-check_PROGRAMS = dumpkeys iso2022 reaper reflect-text-view reflect-vte mev ssfe table trie xticker vteconv vtetc
+check_PROGRAMS = dumpkeys iso2022 reflect-text-view reflect-vte mev ssfe table trie xticker vteconv vtetc
TESTS = table trie $(TEST_SH)
AM_CFLAGS = $(GLIB_CFLAGS)
@@ -215,7 +258,7 @@ reflect_text_view_LDADD = $(VTE_LIBS)
reflect_vte_CPPFLAGS = -DUSE_VTE
reflect_vte_CFLAGS = $(VTE_CFLAGS)
reflect_vte_SOURCES = reflect.c
-reflect_vte_LDADD = libvte@VTE_LIBRARY_SUFFIX_U@.la $(VTE_LIBS)
+reflect_vte_LDADD = libvte-$(VTE_API_VERSION).la $(VTE_LIBS)
interpret_SOURCES = \
buffer.h \
@@ -233,14 +276,16 @@ interpret_SOURCES = \
trie.h \
vteconv.c \
vteconv.h \
+ vteresources.c \
vtetc.c \
vtetc.h \
vtetree.c \
vtetree.h \
interpret.c
interpret_CPPFLAGS = \
- -DINTERPRET_MAIN \
- -DTERMCAPDIR='"$(pkgdatadir)/termcap-$(VTE_API_VERSION)"'
+ -DINTERPRET_MAIN \
+ -DVTE_API_VERSION=\"$(VTE_API_VERSION)\" \
+ $(AM_CPPFLAGS)
interpret_CFLAGS = $(GTK_CFLAGS)
interpret_LDADD = $(GTK_LIBS)
@@ -314,9 +359,6 @@ trie_LDADD = $(VTE_LIBS)
vtetc_SOURCES = vtetc.c vtetc.h debug.c debug.h
vtetc_CPPFLAGS = -DTERMCAP_MAIN
-reaper_SOURCES = reaper.c reaper.h debug.c debug.h marshal.c marshal.h
-reaper_CPPFLAGS = -DREAPER_MAIN -DLOCALEDIR='"$(localedir)"'
-
vteconv_SOURCES = buffer.h debug.c debug.h vteconv.c vteconv.h
vteconv_CPPFLAGS = -DVTECONV_MAIN
vteconv_CFLAGS = $(VTE_CFLAGS)
@@ -327,7 +369,11 @@ mev_SOURCES = mev.c
ssfe_SOURCES = ssfe.c
xticker_SOURCES = xticker.c
-#
+# Shell
+
+profiledir = $(sysconfdir)/profile.d
+dist_profile_DATA = vte.sh
+
+.DELETE_ON_ERROR:
-include $(top_srcdir)/git.mk
--include $(INTROSPECTION_MAKEFILE)
diff --git a/src/box_drawing.txt b/src/box_drawing.txt
new file mode 100644
index 00000000..966c34f1
--- /dev/null
+++ b/src/box_drawing.txt
@@ -0,0 +1,768 @@
+U+2500 - light horizontal
+░░░░░
+░░░░░
+▓▓▓▓▓
+░░░░░
+░░░░░
+U+2501 - heavy horizontal
+░░░░░
+▓▓▓▓▓
+▓▓▓▓▓
+▓▓▓▓▓
+░░░░░
+U+2502 - light vertical
+░░▓░░
+░░▓░░
+░░▓░░
+░░▓░░
+░░▓░░
+U+2503 - heavy vertical
+░▓▓▓░
+░▓▓▓░
+░▓▓▓░
+░▓▓▓░
+░▓▓▓░
+U+2504 - not handled here: light triple dash horizontal
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2505 - not handled here: heavy triple dash horizontal
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2506 - not handled here: light triple dash vertical
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2507 - not handled here: heavy triple dash vertical
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2508 - not handled here: light quadruple dash horizontal
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2509 - not handled here: heavy quadruple dash horizontal
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+250A - not handled here: light quadruple dash vertical
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+250B - not handled here: heavy quadruple dash vertical
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+250C - light down and right
+░░░░░
+░░░░░
+░░▓▓▓
+░░▓░░
+░░▓░░
+U+250D - down light and right heavy
+░░░░░
+░░▓▓▓
+░░▓▓▓
+░░▓▓▓
+░░▓░░
+U+250E - down heavy and right light
+░░░░░
+░░░░░
+░▓▓▓▓
+░▓▓▓░
+░▓▓▓░
+U+250F - heavy down and right
+░░░░░
+░▓▓▓▓
+░▓▓▓▓
+░▓▓▓▓
+░▓▓▓░
+U+2510 - light down and left
+░░░░░
+░░░░░
+▓▓▓░░
+░░▓░░
+░░▓░░
+U+2511 - down light and left heavy
+░░░░░
+▓▓▓░░
+▓▓▓░░
+▓▓▓░░
+░░▓░░
+U+2512 - down heavy and left light
+░░░░░
+░░░░░
+▓▓▓▓░
+░▓▓▓░
+░▓▓▓░
+U+2513 - heavy down and left
+░░░░░
+▓▓▓▓░
+▓▓▓▓░
+▓▓▓▓░
+░▓▓▓░
+U+2514 - light up and right
+░░▓░░
+░░▓░░
+░░▓▓▓
+░░░░░
+░░░░░
+U+2515 - up light and right heavy
+░░▓░░
+░░▓▓▓
+░░▓▓▓
+░░▓▓▓
+░░░░░
+U+2516 - up heavy and right light
+░▓▓▓░
+░▓▓▓░
+░▓▓▓▓
+░░░░░
+░░░░░
+U+2517 - heavy up and right
+░▓▓▓░
+░▓▓▓▓
+░▓▓▓▓
+░▓▓▓▓
+░░░░░
+U+2518 - light up and left
+░░▓░░
+░░▓░░
+▓▓▓░░
+░░░░░
+░░░░░
+U+2519 - up light and left heavy
+░░▓░░
+▓▓▓░░
+▓▓▓░░
+▓▓▓░░
+░░░░░
+U+251A - up heavy and left light
+░▓▓▓░
+░▓▓▓░
+▓▓▓▓░
+░░░░░
+░░░░░
+U+251B - heavy up and left
+░▓▓▓░
+▓▓▓▓░
+▓▓▓▓░
+▓▓▓▓░
+░░░░░
+U+251C - light vertical and right
+░░▓░░
+░░▓░░
+░░▓▓▓
+░░▓░░
+░░▓░░
+U+251D - vertical light and right heavy
+░░▓░░
+░░▓▓▓
+░░▓▓▓
+░░▓▓▓
+░░▓░░
+U+251E - up heavy and right down light
+░▓▓▓░
+░▓▓▓░
+░▓▓▓▓
+░░▓░░
+░░▓░░
+U+251F - down heavy and right up light
+░░▓░░
+░░▓░░
+░▓▓▓▓
+░▓▓▓░
+░▓▓▓░
+U+2520 - vertical heavy and right light
+░▓▓▓░
+░▓▓▓░
+░▓▓▓▓
+░▓▓▓░
+░▓▓▓░
+U+2521 - down light and right up heavy
+░▓▓▓░
+░▓▓▓▓
+░▓▓▓▓
+░▓▓▓▓
+░░▓░░
+U+2522 - up light and right down heavy
+░░▓░░
+░▓▓▓▓
+░▓▓▓▓
+░▓▓▓▓
+░▓▓▓░
+U+2523 - heavy vertical and right
+░▓▓▓░
+░▓▓▓▓
+░▓▓▓▓
+░▓▓▓▓
+░▓▓▓░
+U+2524 - light vertical and left
+░░▓░░
+░░▓░░
+▓▓▓░░
+░░▓░░
+░░▓░░
+U+2525 - vertical light and left heavy
+░░▓░░
+▓▓▓░░
+▓▓▓░░
+▓▓▓░░
+░░▓░░
+U+2526 - up heavy and left down light
+░▓▓▓░
+░▓▓▓░
+▓▓▓▓░
+░░▓░░
+░░▓░░
+U+2527 - down heavy and left up light
+░░▓░░
+░░▓░░
+▓▓▓▓░
+░▓▓▓░
+░▓▓▓░
+U+2528 - vertical heavy and left light
+░▓▓▓░
+░▓▓▓░
+▓▓▓▓░
+░▓▓▓░
+░▓▓▓░
+U+2529 - down light and left up heavy
+░▓▓▓░
+▓▓▓▓░
+▓▓▓▓░
+▓▓▓▓░
+░░▓░░
+U+252A - up light and left down heavy
+░░▓░░
+▓▓▓▓░
+▓▓▓▓░
+▓▓▓▓░
+░▓▓▓░
+U+252B - heavy vertical and left
+░▓▓▓░
+▓▓▓▓░
+▓▓▓▓░
+▓▓▓▓░
+░▓▓▓░
+U+252C - light down and horizontal
+░░░░░
+░░░░░
+▓▓▓▓▓
+░░▓░░
+░░▓░░
+U+252D - left heavy and right down light
+░░░░░
+▓▓▓░░
+▓▓▓▓▓
+▓▓▓░░
+░░▓░░
+U+252E - right heavy and left down light
+░░░░░
+░░▓▓▓
+▓▓▓▓▓
+░░▓▓▓
+░░▓░░
+U+252F - down light and horizontal heavy
+░░░░░
+▓▓▓▓▓
+▓▓▓▓▓
+▓▓▓▓▓
+░░▓░░
+U+2530 - down heavy and horizontal light
+░░░░░
+░░░░░
+▓▓▓▓▓
+░▓▓▓░
+░▓▓▓░
+U+2531 - right light and left down heavy
+░░░░░
+▓▓▓▓░
+▓▓▓▓▓
+▓▓▓▓░
+░▓▓▓░
+U+2532 - left light and right down heavy
+░░░░░
+░▓▓▓▓
+▓▓▓▓▓
+░▓▓▓▓
+░▓▓▓░
+U+2533 - heavy down and horizontal
+░░░░░
+▓▓▓▓▓
+▓▓▓▓▓
+▓▓▓▓▓
+░▓▓▓░
+U+2534 - light up and horizontal
+░░▓░░
+░░▓░░
+▓▓▓▓▓
+░░░░░
+░░░░░
+U+2535 - left heavy and right up light
+░░▓░░
+▓▓▓░░
+▓▓▓▓▓
+▓▓▓░░
+░░░░░
+U+2536 - right heavy and left up light
+░░▓░░
+░░▓▓▓
+▓▓▓▓▓
+░░▓▓▓
+░░░░░
+U+2537 - up light and horizontal heavy
+░░▓░░
+▓▓▓▓▓
+▓▓▓▓▓
+▓▓▓▓▓
+░░░░░
+U+2538 - up heavy and horizontal light
+░▓▓▓░
+░▓▓▓░
+▓▓▓▓▓
+░░░░░
+░░░░░
+U+2539 - right light and left up heavy
+░▓▓▓░
+▓▓▓▓░
+▓▓▓▓▓
+▓▓▓▓░
+░░░░░
+U+253A - left light and right up heavy
+░▓▓▓░
+░▓▓▓▓
+▓▓▓▓▓
+░▓▓▓▓
+░░░░░
+U+253B - heavy up and horizontal
+░▓▓▓░
+▓▓▓▓▓
+▓▓▓▓▓
+▓▓▓▓▓
+░░░░░
+U+253C - light vertical and horizontal
+░░▓░░
+░░▓░░
+▓▓▓▓▓
+░░▓░░
+░░▓░░
+U+253D - left heavy and right vertical light
+░░▓░░
+▓▓▓░░
+▓▓▓▓▓
+▓▓▓░░
+░░▓░░
+U+253E - right heavy and left vertical light
+░░▓░░
+░░▓▓▓
+▓▓▓▓▓
+░░▓▓▓
+░░▓░░
+U+253F - vertical light and horizontal heavy
+░░▓░░
+▓▓▓▓▓
+▓▓▓▓▓
+▓▓▓▓▓
+░░▓░░
+U+2540 - up heavy and down horizontal light
+░▓▓▓░
+░▓▓▓░
+▓▓▓▓▓
+░░▓░░
+░░▓░░
+U+2541 - down heavy and up horizontal light
+░░▓░░
+░░▓░░
+▓▓▓▓▓
+░▓▓▓░
+░▓▓▓░
+U+2542 - vertical heavy and horizontal light
+░▓▓▓░
+░▓▓▓░
+▓▓▓▓▓
+░▓▓▓░
+░▓▓▓░
+U+2543 - left up heavy and right down light
+░▓▓▓░
+▓▓▓▓░
+▓▓▓▓▓
+▓▓▓▓░
+░░▓░░
+U+2544 - right up heavy and left down light
+░▓▓▓░
+░▓▓▓▓
+▓▓▓▓▓
+░▓▓▓▓
+░░▓░░
+U+2545 - left down heavy and right up light
+░░▓░░
+▓▓▓▓░
+▓▓▓▓▓
+▓▓▓▓░
+░▓▓▓░
+U+2546 - right down heavy and left up light
+░░▓░░
+░▓▓▓▓
+▓▓▓▓▓
+░▓▓▓▓
+░▓▓▓░
+U+2547 - down light and up horizontal heavy
+░▓▓▓░
+▓▓▓▓▓
+▓▓▓▓▓
+▓▓▓▓▓
+░░▓░░
+U+2548 - up light and down horizontal heavy
+░░▓░░
+▓▓▓▓▓
+▓▓▓▓▓
+▓▓▓▓▓
+░▓▓▓░
+U+2549 - right light and left vertical heavy
+░▓▓▓░
+▓▓▓▓░
+▓▓▓▓▓
+▓▓▓▓░
+░▓▓▓░
+U+254A - left light and right vertical heavy
+░▓▓▓░
+░▓▓▓▓
+▓▓▓▓▓
+░▓▓▓▓
+░▓▓▓░
+U+254B - heavy vertical and horizontal
+░▓▓▓░
+▓▓▓▓▓
+▓▓▓▓▓
+▓▓▓▓▓
+░▓▓▓░
+U+254C - not handled here: light double dash horizontal
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+254D - not handled here: heavy double dash horizontal
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+254E - not handled here: light double dash vertical
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+254F - not handled here: heavy double dash vertical
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2550 - double horizontal
+░░░░░
+▓▓▓▓▓
+░░░░░
+▓▓▓▓▓
+░░░░░
+U+2551 - double vertical
+░▓░▓░
+░▓░▓░
+░▓░▓░
+░▓░▓░
+░▓░▓░
+U+2552 - down single and right double
+░░░░░
+░░▓▓▓
+░░▓░░
+░░▓▓▓
+░░▓░░
+U+2553 - down double and right single
+░░░░░
+░░░░░
+░▓▓▓▓
+░▓░▓░
+░▓░▓░
+U+2554 - double down and right
+░░░░░
+░▓▓▓▓
+░▓░░░
+░▓░▓▓
+░▓░▓░
+U+2555 - down single and left double
+░░░░░
+▓▓▓░░
+░░▓░░
+▓▓▓░░
+░░▓░░
+U+2556 - down double and left single
+░░░░░
+░░░░░
+▓▓▓▓░
+░▓░▓░
+░▓░▓░
+U+2557 - double down and left
+░░░░░
+▓▓▓▓░
+░░░▓░
+▓▓░▓░
+░▓░▓░
+U+2558 - up single and right double
+░░▓░░
+░░▓▓▓
+░░▓░░
+░░▓▓▓
+░░░░░
+U+2559 - up double and right single
+░▓░▓░
+░▓░▓░
+░▓▓▓▓
+░░░░░
+░░░░░
+U+255A - double up and right
+░▓░▓░
+░▓░▓▓
+░▓░░░
+░▓▓▓▓
+░░░░░
+U+255B - up single and left double
+░░▓░░
+▓▓▓░░
+░░▓░░
+▓▓▓░░
+░░░░░
+U+255C - up double and left single
+░▓░▓░
+░▓░▓░
+▓▓▓▓░
+░░░░░
+░░░░░
+U+255D - double up and left
+░▓░▓░
+▓▓░▓░
+░░░▓░
+▓▓▓▓░
+░░░░░
+U+255E - vertical single and right double
+░░▓░░
+░░▓▓▓
+░░▓░░
+░░▓▓▓
+░░▓░░
+U+255F - vertical double and right single
+░▓░▓░
+░▓░▓░
+░▓░▓▓
+░▓░▓░
+░▓░▓░
+U+2560 - double vertical and right
+░▓░▓░
+░▓░▓▓
+░▓░░░
+░▓░▓▓
+░▓░▓░
+U+2561 - vertical single and left double
+░░▓░░
+▓▓▓░░
+░░▓░░
+▓▓▓░░
+░░▓░░
+U+2562 - vertical double and left single
+░▓░▓░
+░▓░▓░
+▓▓░▓░
+░▓░▓░
+░▓░▓░
+U+2563 - double vertical and left
+░▓░▓░
+▓▓░▓░
+░░░▓░
+▓▓░▓░
+░▓░▓░
+U+2564 - down single and horizontal double
+░░░░░
+▓▓▓▓▓
+░░░░░
+▓▓▓▓▓
+░░▓░░
+U+2565 - down double and horizontal single
+░░░░░
+░░░░░
+▓▓▓▓▓
+░▓░▓░
+░▓░▓░
+U+2566 - double down and horizontal
+░░░░░
+▓▓▓▓▓
+░░░░░
+▓▓░▓▓
+░▓░▓░
+U+2567 - up single and horizontal double
+░░▓░░
+▓▓▓▓▓
+░░░░░
+▓▓▓▓▓
+░░░░░
+U+2568 - up double and horizontal single
+░▓░▓░
+░▓░▓░
+▓▓▓▓▓
+░░░░░
+░░░░░
+U+2569 - double up and horizontal
+░▓░▓░
+▓▓░▓▓
+░░░░░
+▓▓▓▓▓
+░░░░░
+U+256A - vertical single and horizontal double
+░░▓░░
+▓▓▓▓▓
+░░▓░░
+▓▓▓▓▓
+░░▓░░
+U+256B - vertical double and horizontal single
+░▓░▓░
+░▓░▓░
+▓▓▓▓▓
+░▓░▓░
+░▓░▓░
+U+256C - double vertical and horizontal
+░▓░▓░
+▓▓░▓▓
+░░░░░
+▓▓░▓▓
+░▓░▓░
+U+256D - not handled here: light arc down and right
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+256E - not handled here: light arc down and left
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+256F - not handled here: light arc up and left
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2570 - not handled here: light arc up and right
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2571 - not handled here: light diagonal upper right to lower left
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2572 - not handled here: light diagonal upper left to lower right
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2573 - not handled here: light diagonal cross
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+░░░░░
+U+2574 - light left
+░░░░░
+░░░░░
+▓▓▓░░
+░░░░░
+░░░░░
+U+2575 - light up
+░░▓░░
+░░▓░░
+░░▓░░
+░░░░░
+░░░░░
+U+2576 - light right
+░░░░░
+░░░░░
+░░▓▓▓
+░░░░░
+░░░░░
+U+2577 - light down
+░░░░░
+░░░░░
+░░▓░░
+░░▓░░
+░░▓░░
+U+2578 - heavy left
+░░░░░
+▓▓▓░░
+▓▓▓░░
+▓▓▓░░
+░░░░░
+U+2579 - heavy up
+░▓▓▓░
+░▓▓▓░
+░▓▓▓░
+░░░░░
+░░░░░
+U+257A - heavy right
+░░░░░
+░░▓▓▓
+░░▓▓▓
+░░▓▓▓
+░░░░░
+U+257B - heavy down
+░░░░░
+░░░░░
+░▓▓▓░
+░▓▓▓░
+░▓▓▓░
+U+257C - light left and heavy right
+░░░░░
+░░▓▓▓
+▓▓▓▓▓
+░░▓▓▓
+░░░░░
+U+257D - light up and heavy down
+░░▓░░
+░░▓░░
+░▓▓▓░
+░▓▓▓░
+░▓▓▓░
+U+257E - heavy left and light right
+░░░░░
+▓▓▓░░
+▓▓▓▓▓
+▓▓▓░░
+░░░░░
+U+257F - heavy up and light down
+░▓▓▓░
+░▓▓▓░
+░▓▓▓░
+░░▓░░
+░░▓░░
diff --git a/src/box_drawing_generate.sh b/src/box_drawing_generate.sh
new file mode 100755
index 00000000..ef48788b
--- /dev/null
+++ b/src/box_drawing_generate.sh
@@ -0,0 +1,70 @@
+#!/usr/bin/env bash
+# Copyright © 2014 Egmont Koblinger
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+cat <<"END"
+/* Generated by box_drawing_generate.sh; do not edit! */
+
+#define VTE_BOX_DRAWING_5_BY_5_BITMAP(x11, x12, x13, x14, x15, \
+ x21, x22, x23, x24, x25, \
+ x31, x32, x33, x34, x35, \
+ x41, x42, x43, x44, x45, \
+ x51, x52, x53, x54, x55) \
+ (((x11) << 24) | ((x12) << 23) | ((x13) << 22) | ((x14) << 21) | ((x15) << 20) | \
+ ((x21) << 19) | ((x22) << 18) | ((x23) << 17) | ((x24) << 16) | ((x25) << 15) | \
+ ((x31) << 14) | ((x32) << 13) | ((x33) << 12) | ((x34) << 11) | ((x35) << 10) | \
+ ((x41) << 9) | ((x42) << 8) | ((x43) << 7) | ((x44) << 6) | ((x45) << 5) | \
+ ((x51) << 4) | ((x52) << 3) | ((x53) << 2) | ((x54) << 1) | ((x55)))
+
+/* Definition of most of the glyphs in the 2500..257F range as 5x5 bitmaps
+ (bits 24..0 in the obvious order), see bug 709556 and ../doc/boxes.txt */
+static const guint32 _vte_box_drawing_bitmaps[128] = {
+END
+
+LC_ALL=C
+pos=$((0x2500))
+while [ $pos -lt $((0x2580)) ]; do
+ read header
+ echo -e "\\t/* $header */"
+ echo -e "\\tVTE_BOX_DRAWING_5_BY_5_BITMAP("
+ for y in 1 2 3 4 5; do
+ echo -ne '\t\t'
+ read line
+ for x in 1 2 3 4 5; do
+ if [ "${line:0:3}" == "▓" ]; then
+ echo -n '1'
+ else
+ echo -n '0'
+ fi
+ line="${line:3}"
+ if [ $x = 5 -a $y = 5 ]; then
+ echo -n ')'
+ fi
+ echo -n ', '
+ if [ $x = 5 ]; then
+ echo
+ fi
+ done
+ done
+ echo
+ pos=$((pos+1))
+done
+
+cat <<"END"
+};
+
+#undef VTE_BOX_DRAWING_5_BY_5_BITMAP
+END
diff --git a/src/buffer.h b/src/buffer.h
index 987a6a81..4f4cf317 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -1,21 +1,19 @@
/*
* Copyright 2009 Red Hat, Inc.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA
+ * Lesser General Public License for more details.
*
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* The interfaces in this file are subject to change at any time. */
@@ -28,15 +26,15 @@
G_BEGIN_DECLS
-typedef GByteArray VteBuffer;
+typedef GByteArray VteByteArray;
-#define _vte_buffer_new g_byte_array_new
-#define _vte_buffer_free(B) g_byte_array_free (B, TRUE)
-#define _vte_buffer_append(B, data, length) g_byte_array_append (B, (const guint8 *) (data), length)
-#define _vte_buffer_length(B) ((B)->len)
-#define _vte_buffer_consume(B, length) g_byte_array_remove_range (B, 0, length)
-#define _vte_buffer_clear(B) g_byte_array_set_size (B, 0)
-#define _vte_buffer_set_minimum_size(B, length) g_byte_array_set_size (B, (guint) MAX ((gint) (length), (gint) (B)->len))
+#define _vte_byte_array_new g_byte_array_new
+#define _vte_byte_array_free(B) g_byte_array_free (B, TRUE)
+#define _vte_byte_array_append(B, data, length) g_byte_array_append (B, (const guint8 *) (data), length)
+#define _vte_byte_array_length(B) ((B)->len)
+#define _vte_byte_array_consume(B, length) g_byte_array_remove_range (B, 0, length)
+#define _vte_byte_array_clear(B) g_byte_array_set_size (B, 0)
+#define _vte_byte_array_set_minimum_size(B, length) g_byte_array_set_size (B, (guint) MAX ((gint) (length), (gint) (B)->len))
G_END_DECLS
diff --git a/src/caps.c b/src/caps.c
index c7217e0e..137cea5d 100644
--- a/src/caps.c
+++ b/src/caps.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2001,2002 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <config.h>
@@ -523,18 +523,34 @@ struct _vte_capability_string _vte_xterm_capability_strings[] = {
{OSC "1;%s" BEL, "set-icon-title", 0},
{OSC "2;%s" BEL, "set-window-title", 0},
{OSC "3;%s" BEL, "set-xproperty", 0},
- {OSC "4;%s" BEL, "change-color", 0},
- {OSC "10;%s" BEL, "change-foreground-colors", 0},
- {OSC "11;%s" BEL, "change-background-colors", 0},
- {OSC "12;%s" BEL, "change-cursor-colors", 0},
- {OSC "13;%s" BEL, "change-mouse-cursor-foreground-colors", 0},
- {OSC "14;%s" BEL, "change-mouse-cursor-foreground-colors", 0},
- {OSC "15;%s" BEL, "change-tek-background-colors", 0},
- {OSC "16;%s" BEL, "change-tek-background-colors", 0},
- {OSC "17;%s" BEL, "change-highlight-colors", 0},
+ {OSC "4;%s" BEL, "change-color-bel", 0},
+ {OSC "6;%s" BEL, "set-current-file-uri", 0},
+ {OSC "7;%s" BEL, "set-current-directory-uri", 0},
+ {OSC "10;%s" BEL, "change-foreground-colors-bel", 0},
+ {OSC "11;%s" BEL, "change-background-colors-bel", 0},
+ {OSC "12;%s" BEL, "change-cursor-colors-bel", 0},
+ {OSC "13;%s" BEL, "change-mouse-cursor-foreground-colors-bel", 0},
+ {OSC "14;%s" BEL, "change-mouse-cursor-background-colors-bel", 0},
+ {OSC "15;%s" BEL, "change-tek-foreground-colors-bel", 0},
+ {OSC "16;%s" BEL, "change-tek-background-colors-bel", 0},
+ {OSC "17;%s" BEL, "change-highlight-background-colors-bel", 0},
+ {OSC "18;%s" BEL, "change-tek-cursor-colors-bel", 0},
+ {OSC "19;%s" BEL, "change-highlight-foreground-colors-bel", 0},
{OSC "46;%s" BEL, "change-logfile", 0},
{OSC "50;#%d" BEL, "change-font-number", 0},
{OSC "50;%s" BEL, "change-font-name", 0},
+ {OSC "104" BEL, "reset-color", 0},
+ {OSC "104;%m" BEL, "reset-color", 0},
+ {OSC "110" BEL, "reset-foreground-colors", 0},
+ {OSC "111" BEL, "reset-background-colors", 0},
+ {OSC "112" BEL, "reset-cursor-colors", 0},
+ {OSC "113" BEL, "reset-mouse-cursor-foreground-colors", 0},
+ {OSC "114" BEL, "reset-mouse-cursor-background-colors", 0},
+ {OSC "115" BEL, "reset-tek-foreground-colors", 0},
+ {OSC "116" BEL, "reset-tek-background-colors", 0},
+ {OSC "117" BEL, "reset-highlight-background-colors", 0},
+ {OSC "118" BEL, "reset-tek-cursor-colors", 0},
+ {OSC "119" BEL, "reset-highlight-foreground-colors", 0},
/* Set text parameters, ST-terminated versions. */
{OSC ";%s" ST, "set-icon-and-window-title", 0}, /* undocumented default */
@@ -542,18 +558,34 @@ struct _vte_capability_string _vte_xterm_capability_strings[] = {
{OSC "1;%s" ST, "set-icon-title", 0},
{OSC "2;%s" ST, "set-window-title", 0},
{OSC "3;%s" ST, "set-xproperty", 0},
- {OSC "4;%s" ST, "change-color", 0},
- {OSC "10;%s" ST, "change-foreground-colors", 0},
- {OSC "11;%s" ST, "change-background-colors", 0},
- {OSC "12;%s" ST, "change-cursor-colors", 0},
- {OSC "13;%s" ST, "change-mouse-cursor-foreground-colors", 0},
- {OSC "14;%s" ST, "change-mouse-cursor-foreground-colors", 0},
- {OSC "15;%s" ST, "change-tek-background-colors", 0},
- {OSC "16;%s" ST, "change-tek-background-colors", 0},
- {OSC "17;%s" ST, "change-highlight-colors", 0},
+ {OSC "4;%s" ST, "change-color-st", 0},
+ {OSC "6;%s" ST, "set-current-file-uri", 0},
+ {OSC "7;%s" ST, "set-current-directory-uri", 0},
+ {OSC "10;%s" ST, "change-foreground-colors-st", 0},
+ {OSC "11;%s" ST, "change-background-colors-st", 0},
+ {OSC "12;%s" ST, "change-cursor-colors-st", 0},
+ {OSC "13;%s" ST, "change-mouse-cursor-foreground-colors-st", 0},
+ {OSC "14;%s" ST, "change-mouse-cursor-background-colors-st", 0},
+ {OSC "15;%s" ST, "change-tek-foreground-colors-st", 0},
+ {OSC "16;%s" ST, "change-tek-background-colors-st", 0},
+ {OSC "17;%s" ST, "change-highlight-background-colors-st", 0},
+ {OSC "18;%s" ST, "change-tek-cursor-colors-st", 0},
+ {OSC "19;%s" ST, "change-highlight-foreground-colors-st", 0},
{OSC "46;%s" ST, "change-logfile", 0},
{OSC "50;#%d" ST, "change-font-number", 0},
{OSC "50;%s" ST, "change-font-name", 0},
+ {OSC "104" ST, "reset-color", 0},
+ {OSC "104;%m" ST, "reset-color", 0},
+ {OSC "110" ST, "reset-foreground-colors", 0},
+ {OSC "111" ST, "reset-background-colors", 0},
+ {OSC "112" ST, "reset-cursor-colors", 0},
+ {OSC "113" ST, "reset-mouse-cursor-foreground-colors", 0},
+ {OSC "114" ST, "reset-mouse-cursor-background-colors", 0},
+ {OSC "115" ST, "reset-tek-foreground-colors", 0},
+ {OSC "116" ST, "reset-tek-background-colors", 0},
+ {OSC "117" ST, "reset-highlight-background-colors", 0},
+ {OSC "118" ST, "reset-tek-cursor-colors", 0},
+ {OSC "119" ST, "reset-highlight-foreground-colors", 0},
/* These may be bogus, I can't find docs for them anywhere (#104154). */
{OSC "21;%s" BEL, "set-text-property-21", 0},
diff --git a/src/caps.h b/src/caps.h
index e8d1118b..a043c58f 100644
--- a/src/caps.h
+++ b/src/caps.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2001,2002 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* The interfaces in this file are subject to change at any time. */
diff --git a/src/debug.c b/src/debug.c
index 54997b91..cac1a573 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2002,2003 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <config.h>
@@ -50,7 +50,8 @@ _vte_debug_init(void)
{ "ally", VTE_DEBUG_ALLY },
{ "pangocairo", VTE_DEBUG_PANGOCAIRO },
{ "widget-size", VTE_DEBUG_WIDGET_SIZE },
- { "bg", VTE_DEBUG_BG }
+ { "style", VTE_DEBUG_STYLE },
+ { "resize", VTE_DEBUG_RESIZE }
};
_vte_debug_flags = g_parse_debug_string (g_getenv("VTE_DEBUG"),
diff --git a/src/debug.h b/src/debug.h
index eee72cb5..9b64a0aa 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* The interfaces in this file are subject to change at any time. */
@@ -25,6 +25,15 @@
#include <glib.h>
+#ifndef VTE_COMPILATION
+#define _vte_debug_flags _vte_external_debug_flags
+#define _vte_debug_init _vte_external_debug_init
+#define _vte_debug_on _vte_external_debug_on
+#if !defined(__GNUC__) || !G_HAVE_GNUC_VARARGS
+#define _vte_debug_print _vte_external_debug_print
+#endif
+#endif
+
G_BEGIN_DECLS
typedef enum {
@@ -50,7 +59,8 @@ typedef enum {
VTE_DEBUG_ADJ = 1 << 19,
VTE_DEBUG_PANGOCAIRO = 1 << 20,
VTE_DEBUG_WIDGET_SIZE = 1 << 21,
- VTE_DEBUG_BG = 1 << 22
+ VTE_DEBUG_STYLE = 1 << 22,
+ VTE_DEBUG_RESIZE = 1 << 23
} VteDebugFlags;
void _vte_debug_init(void);
diff --git a/src/dumpkeys.c b/src/dumpkeys.c
index 976eb5eb..07b57c61 100644
--- a/src/dumpkeys.c
+++ b/src/dumpkeys.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <config.h>
diff --git a/src/genkeysyms.py b/src/genkeysyms.py
deleted file mode 100755
index b99bd79c..00000000
--- a/src/genkeysyms.py
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/python
-
-import os, string, sys
-
-def scanheader(filename):
- definitions = {}
- file = open(filename, "r")
- if file:
- for line in file.readlines():
- if line[:12] == '#define GDK_':
- fields = string.split(line)
- fields[2] = string.lower(fields[2])
- if definitions.has_key(fields[2]):
- definitions[fields[2]] = definitions[fields[2]] + ", " + fields[1]
- else:
- definitions[fields[2]] = fields[1]
- file.close()
- for key in definitions.keys():
- print '\tcase %s: return \"%s\";' % (key, definitions[key])
-
-print '\t/* this file is auto-generated -- do not edit */'
-
-if len(sys.argv) > 1:
- for header in sys.argv[1:]:
- scanheader(header)
-else:
- scanheader("/usr/include/gtk-2.0/gdk/gdkkeysyms.h")
diff --git a/src/interpret.c b/src/interpret.c
index 782d05b5..41656375 100644
--- a/src/interpret.c
+++ b/src/interpret.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2001,2002,2003 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <config.h>
@@ -72,15 +72,17 @@ main(int argc, char **argv)
g_type_init();
terminal = argv[1];
- termcap = _vte_termcap_new(g_build_filename(TERMCAPDIR, terminal, NULL));
- if (termcap == NULL) {
- termcap = _vte_termcap_new("/etc/termcap");
- }
+ termcap = _vte_termcap_new(terminal);
+ if (termcap == NULL) {
+ g_printerr ("No termcap entry for '%s'\n", terminal);
+ return 1;
+ }
+
array = g_array_new(FALSE, FALSE, sizeof(gunichar));
matcher = _vte_matcher_new(terminal, termcap);
- subst = _vte_iso2022_state_new(NULL, NULL, NULL);
+ subst = _vte_iso2022_state_new(NULL, VTE_ISO2022_DEFAULT_UTF8_AMBIGUOUS_WIDTH, NULL, NULL);
for (;;) {
l = read (infile, buf, sizeof (buf));
diff --git a/src/iso2022.c b/src/iso2022.c
index 79a9e017..f493496c 100644
--- a/src/iso2022.c
+++ b/src/iso2022.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2002,2003 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <config.h>
@@ -37,13 +37,6 @@
#include <gtk/gtk.h>
-#if GTK_CHECK_VERSION (2, 90, 7)
-#define GDK_KEY(symbol) GDK_KEY_##symbol
-#else
-#include <gdk/gdkkeysyms.h>
-#define GDK_KEY(symbol) GDK_##symbol
-#endif
-
/* Maps which jive with XTerm's ESC ()*+ ? sequences, RFC 1468. Add the
* PC437 map because despite knowing that XTerm doesn't support it, certain
* applications try to use it anyway. */
@@ -80,10 +73,11 @@ struct _vte_iso2022_state {
gunichar g[4];
const gchar *codeset, *native_codeset, *utf8_codeset, *target_codeset;
gint ambiguous_width;
+ gint utf8_ambiguous_width;
VteConv conv;
_vte_iso2022_codeset_changed_cb_fn codeset_changed;
gpointer codeset_changed_data;
- VteBuffer *buffer;
+ VteByteArray *buffer;
};
/* DEC Special Character and Line Drawing Set. VT100 and higher (per XTerm
@@ -123,7 +117,7 @@ static const struct _vte_iso2022_map16 _vte_iso2022_map_0[] = {
};
/* United Kingdom. VT100 and higher (per XTerm docs). */
static const struct _vte_iso2022_map16 _vte_iso2022_map_A[] = {
- {'$', GDK_KEY (sterling)},
+ {'$', GDK_KEY_sterling},
};
/* US-ASCII (no conversions). VT100 and higher (per XTerm docs). */
static const struct _vte_iso2022_map16 _vte_iso2022_map_B[] = {
@@ -131,128 +125,128 @@ static const struct _vte_iso2022_map16 _vte_iso2022_map_B[] = {
};
/* Dutch. VT220 and higher (per XTerm docs). */
static const struct _vte_iso2022_map16 _vte_iso2022_map_4[] = {
- {'#', GDK_KEY (sterling)},
- {'@', GDK_KEY (threequarters)},
- {'[', GDK_KEY (ydiaeresis)},
- {'\\', GDK_KEY (onehalf)},
- {']', GDK_KEY (bar)}, /* FIXME? not in XTerm 170 */
- {'{', GDK_KEY (diaeresis)},
+ {'#', GDK_KEY_sterling},
+ {'@', GDK_KEY_threequarters},
+ {'[', GDK_KEY_ydiaeresis},
+ {'\\', GDK_KEY_onehalf},
+ {']', GDK_KEY_bar}, /* FIXME? not in XTerm 170 */
+ {'{', GDK_KEY_diaeresis},
{'|', 0x192}, /* f with hook (florin) */ /* FIXME? not in XTerm 170 */
- {'}', GDK_KEY (onequarter)},
- {'~', GDK_KEY (acute)}
+ {'}', GDK_KEY_onequarter},
+ {'~', GDK_KEY_acute},
};
/* Finnish. VT220 and higher (per XTerm docs). */
static const struct _vte_iso2022_map16 _vte_iso2022_map_C[] = {
- {'[', GDK_KEY (Adiaeresis)},
- {'\\', GDK_KEY (Odiaeresis)},
- {']', GDK_KEY (Aring)},
- {'^', GDK_KEY (Udiaeresis)},
- {'`', GDK_KEY (eacute)},
- {'{', GDK_KEY (adiaeresis)},
- {'|', GDK_KEY (odiaeresis)},
- {'}', GDK_KEY (aring)},
- {'~', GDK_KEY (udiaeresis)},
+ {'[', GDK_KEY_Adiaeresis},
+ {'\\', GDK_KEY_Odiaeresis},
+ {']', GDK_KEY_Aring},
+ {'^', GDK_KEY_Udiaeresis},
+ {'`', GDK_KEY_eacute},
+ {'{', GDK_KEY_adiaeresis},
+ {'|', GDK_KEY_odiaeresis},
+ {'}', GDK_KEY_aring},
+ {'~', GDK_KEY_udiaeresis},
};
/* French. VT220 and higher (per XTerm docs). */
static const struct _vte_iso2022_map16 _vte_iso2022_map_R[] = {
- {'#', GDK_KEY (sterling)},
- {'@', GDK_KEY (agrave)},
- {'[', GDK_KEY (degree)},
- {'\\', GDK_KEY (ccedilla)},
- {']', GDK_KEY (section)},
- {'{', GDK_KEY (eacute)},
- {'|', GDK_KEY (ugrave)},
- {'}', GDK_KEY (egrave)},
- {'~', GDK_KEY (diaeresis)},
+ {'#', GDK_KEY_sterling},
+ {'@', GDK_KEY_agrave},
+ {'[', GDK_KEY_degree},
+ {'\\', GDK_KEY_ccedilla},
+ {']', GDK_KEY_section},
+ {'{', GDK_KEY_eacute},
+ {'|', GDK_KEY_ugrave},
+ {'}', GDK_KEY_egrave},
+ {'~', GDK_KEY_diaeresis},
};
/* French Canadian. VT220 and higher (per XTerm docs). */
static const struct _vte_iso2022_map16 _vte_iso2022_map_Q[] = {
- {'@', GDK_KEY (agrave)},
- {'[', GDK_KEY (acircumflex)},
- {'\\', GDK_KEY (ccedilla)},
- {']', GDK_KEY (ecircumflex)},
- {'^', GDK_KEY (icircumflex)},
- {'`', GDK_KEY (ocircumflex)},
- {'{', GDK_KEY (eacute)},
- {'|', GDK_KEY (ugrave)},
- {'}', GDK_KEY (egrave)},
- {'~', GDK_KEY (ucircumflex)},
+ {'@', GDK_KEY_agrave},
+ {'[', GDK_KEY_acircumflex},
+ {'\\', GDK_KEY_ccedilla},
+ {']', GDK_KEY_ecircumflex},
+ {'^', GDK_KEY_icircumflex},
+ {'`', GDK_KEY_ocircumflex},
+ {'{', GDK_KEY_eacute},
+ {'|', GDK_KEY_ugrave},
+ {'}', GDK_KEY_egrave},
+ {'~', GDK_KEY_ucircumflex},
};
/* German. VT220 and higher (per XTerm docs). */
static const struct _vte_iso2022_map16 _vte_iso2022_map_K[] = {
- {'@', GDK_KEY (section)},
- {'[', GDK_KEY (Adiaeresis)},
- {'\\', GDK_KEY (Odiaeresis)},
- {']', GDK_KEY (Udiaeresis)},
- {'{', GDK_KEY (adiaeresis)},
- {'|', GDK_KEY (odiaeresis)},
- {'}', GDK_KEY (udiaeresis)},
- {'~', GDK_KEY (ssharp)},
+ {'@', GDK_KEY_section},
+ {'[', GDK_KEY_Adiaeresis},
+ {'\\', GDK_KEY_Odiaeresis},
+ {']', GDK_KEY_Udiaeresis},
+ {'{', GDK_KEY_adiaeresis},
+ {'|', GDK_KEY_odiaeresis},
+ {'}', GDK_KEY_udiaeresis},
+ {'~', GDK_KEY_ssharp},
};
/* Italian. VT220 and higher (per XTerm docs). */
static const struct _vte_iso2022_map16 _vte_iso2022_map_Y[] = {
- {'#', GDK_KEY (sterling)},
- {'@', GDK_KEY (section)},
- {'[', GDK_KEY (degree)},
- {'\\', GDK_KEY (ccedilla)},
- {']', GDK_KEY (eacute)},
- {'`', GDK_KEY (ugrave)},
- {'{', GDK_KEY (agrave)},
- {'|', GDK_KEY (ograve)},
- {'}', GDK_KEY (egrave)},
- {'~', GDK_KEY (igrave)},
+ {'#', GDK_KEY_sterling},
+ {'@', GDK_KEY_section},
+ {'[', GDK_KEY_degree},
+ {'\\', GDK_KEY_ccedilla},
+ {']', GDK_KEY_eacute},
+ {'`', GDK_KEY_ugrave},
+ {'{', GDK_KEY_agrave},
+ {'|', GDK_KEY_ograve},
+ {'}', GDK_KEY_egrave},
+ {'~', GDK_KEY_igrave},
};
/* Norwegian and Danish. VT220 and higher (per XTerm docs). */
static const struct _vte_iso2022_map16 _vte_iso2022_map_E[] = {
- {'@', GDK_KEY (Adiaeresis)},
- {'[', GDK_KEY (AE)},
- {'\\', GDK_KEY (Ooblique)},
- {']', GDK_KEY (Aring)},
- {'^', GDK_KEY (Udiaeresis)},
- {'`', GDK_KEY (adiaeresis)},
- {'{', GDK_KEY (ae)},
- {'|', GDK_KEY (oslash)},
- {'}', GDK_KEY (aring)},
- {'~', GDK_KEY (udiaeresis)},
+ {'@', GDK_KEY_Adiaeresis},
+ {'[', GDK_KEY_AE},
+ {'\\', GDK_KEY_Ooblique},
+ {']', GDK_KEY_Aring},
+ {'^', GDK_KEY_Udiaeresis},
+ {'`', GDK_KEY_adiaeresis},
+ {'{', GDK_KEY_ae},
+ {'|', GDK_KEY_oslash},
+ {'}', GDK_KEY_aring},
+ {'~', GDK_KEY_udiaeresis},
};
/* Spanish. VT220 and higher (per XTerm docs). */
static const struct _vte_iso2022_map16 _vte_iso2022_map_Z[] = {
- {'#', GDK_KEY (sterling)},
- {'@', GDK_KEY (section)},
- {'[', GDK_KEY (exclamdown)},
- {'\\', GDK_KEY (Ntilde)},
- {']', GDK_KEY (questiondown)},
- {'{', GDK_KEY (degree)},
- {'|', GDK_KEY (ntilde)},
- {'}', GDK_KEY (ccedilla)},
+ {'#', GDK_KEY_sterling},
+ {'@', GDK_KEY_section},
+ {'[', GDK_KEY_exclamdown},
+ {'\\', GDK_KEY_Ntilde},
+ {']', GDK_KEY_questiondown},
+ {'{', GDK_KEY_degree},
+ {'|', GDK_KEY_ntilde},
+ {'}', GDK_KEY_ccedilla},
};
/* Swedish. VT220 and higher (per XTerm docs). */
static const struct _vte_iso2022_map16 _vte_iso2022_map_H[] = {
- {'@', GDK_KEY (Eacute)},
- {'[', GDK_KEY (Adiaeresis)},
- {'\\', GDK_KEY (Odiaeresis)},
- {']', GDK_KEY (Aring)},
- {'^', GDK_KEY (Udiaeresis)},
- {'`', GDK_KEY (eacute)},
- {'{', GDK_KEY (adiaeresis)},
- {'|', GDK_KEY (odiaeresis)},
- {'}', GDK_KEY (aring)},
- {'~', GDK_KEY (udiaeresis)},
+ {'@', GDK_KEY_Eacute},
+ {'[', GDK_KEY_Adiaeresis},
+ {'\\', GDK_KEY_Odiaeresis},
+ {']', GDK_KEY_Aring},
+ {'^', GDK_KEY_Udiaeresis},
+ {'`', GDK_KEY_eacute},
+ {'{', GDK_KEY_adiaeresis},
+ {'|', GDK_KEY_odiaeresis},
+ {'}', GDK_KEY_aring},
+ {'~', GDK_KEY_udiaeresis},
};
/* Swiss. VT220 and higher (per XTerm docs). */
static const struct _vte_iso2022_map16 _vte_iso2022_map_equal[] = {
- {'#', GDK_KEY (ugrave)},
- {'@', GDK_KEY (agrave)},
- {'[', GDK_KEY (eacute)},
- {'\\', GDK_KEY (ccedilla)},
- {']', GDK_KEY (ecircumflex)},
- {'^', GDK_KEY (icircumflex)},
- {'_', GDK_KEY (egrave)},
- {'`', GDK_KEY (ocircumflex)},
- {'{', GDK_KEY (adiaeresis)},
- {'|', GDK_KEY (odiaeresis)},
- {'}', GDK_KEY (udiaeresis)},
- {'~', GDK_KEY (ucircumflex)},
+ {'#', GDK_KEY_ugrave},
+ {'@', GDK_KEY_agrave},
+ {'[', GDK_KEY_eacute},
+ {'\\', GDK_KEY_ccedilla},
+ {']', GDK_KEY_ecircumflex},
+ {'^', GDK_KEY_icircumflex},
+ {'_', GDK_KEY_egrave},
+ {'`', GDK_KEY_ocircumflex},
+ {'{', GDK_KEY_adiaeresis},
+ {'|', GDK_KEY_odiaeresis},
+ {'}', GDK_KEY_udiaeresis},
+ {'~', GDK_KEY_ucircumflex},
};
/* Codepage 437. */
static const struct _vte_iso2022_map16 _vte_iso2022_map_U[] = {
@@ -345,15 +339,29 @@ _vte_iso2022_ambiguous_width(struct _vte_iso2022_state *state)
* current locale is UTF-8.
*/
if (strcmp (codeset, "utf8") == 0) {
- const char *env = g_getenv ("VTE_CJK_WIDTH");
- if (env && (g_ascii_strcasecmp (env, "wide")==0 || g_ascii_strcasecmp (env, "1")==0))
- return 2;
+ return state->utf8_ambiguous_width;
}
/* Not in the list => not wide. */
return 1;
}
+static gboolean
+_vte_unichar_iswide_cjk(gunichar c)
+{
+ /* U+254C..U+254F and U+2574..U+257F have East Asian Width property
+ * N (neutral) while all the other line drawing characters are
+ * A (ambigous). This makes those characters not match up with those
+ * other line drawing characters from the Box Drawing (U+2500..U+257F)
+ * block; so we treat them as ambigous too.
+ *
+ * And we also do the same for the Terminal Graphic Characters
+ * (U+2596..U+259F) as well as U+2590 and U+2591 from the Block Elements
+ * (U+2580..U+259F) block.
+ */
+ return G_UNLIKELY(c >= 0x2500 && c <= 0x259f);
+}
+
static inline gboolean
_vte_iso2022_is_ambiguous(gunichar c)
{
@@ -361,7 +369,7 @@ _vte_iso2022_is_ambiguous(gunichar c)
return FALSE;
if (G_UNLIKELY (g_unichar_iszerowidth (c)))
return FALSE;
- return G_UNLIKELY (!g_unichar_iswide (c) && g_unichar_iswide_cjk (c));
+ return G_UNLIKELY (!g_unichar_iswide (c) && (g_unichar_iswide_cjk (c) || _vte_unichar_iswide_cjk (c)));
}
int
@@ -748,10 +756,14 @@ _vte_iso2022_set_encoded_width(gunichar c, int width)
struct _vte_iso2022_state *
_vte_iso2022_state_new(const char *native_codeset,
+ int utf8_ambiguous_width,
_vte_iso2022_codeset_changed_cb_fn fn,
gpointer data)
{
struct _vte_iso2022_state *state;
+
+ g_return_val_if_fail(utf8_ambiguous_width == 1 || utf8_ambiguous_width == 2, NULL);
+
state = g_slice_new0(struct _vte_iso2022_state);
state->nrc_enabled = TRUE;
state->current = 0;
@@ -760,13 +772,13 @@ _vte_iso2022_state_new(const char *native_codeset,
state->g[1] = 'B';
state->g[2] = 'B';
state->g[3] = 'B';
- state->codeset = native_codeset;
- state->native_codeset = state->codeset;
+ state->native_codeset = state->codeset = g_intern_string(native_codeset);
if (native_codeset == NULL) {
- g_get_charset(&state->codeset);
- state->native_codeset = state->codeset;
- }
- state->utf8_codeset = "UTF-8";
+ const char *codeset;
+ g_get_charset(&codeset);
+ state->native_codeset = state->codeset = g_intern_string(codeset);
+ }
+ state->utf8_codeset = g_intern_string("UTF-8");
state->target_codeset = VTE_CONV_GUNICHAR_TYPE;
_vte_debug_print(VTE_DEBUG_SUBSTITUTION,
"Native codeset \"%s\", currently %s\n",
@@ -774,7 +786,7 @@ _vte_iso2022_state_new(const char *native_codeset,
state->conv = _vte_conv_open(state->target_codeset, state->codeset);
state->codeset_changed = fn;
state->codeset_changed_data = data;
- state->buffer = _vte_buffer_new();
+ state->buffer = _vte_byte_array_new();
if (state->conv == VTE_INVALID_CONV) {
g_warning(_("Unable to convert characters from %s to %s."),
state->codeset, state->target_codeset);
@@ -788,14 +800,14 @@ _vte_iso2022_state_new(const char *native_codeset,
state->codeset, state->target_codeset);
}
}
- state->ambiguous_width = _vte_iso2022_ambiguous_width(state);
+ _vte_iso2022_state_set_utf8_ambiguous_width(state, utf8_ambiguous_width);
return state;
}
void
_vte_iso2022_state_free(struct _vte_iso2022_state *state)
{
- _vte_buffer_free(state->buffer);
+ _vte_byte_array_free(state->buffer);
if (state->conv != VTE_INVALID_CONV) {
_vte_conv_close(state->conv);
}
@@ -825,6 +837,7 @@ _vte_iso2022_state_set_codeset(struct _vte_iso2022_state *state,
state->codeset = g_intern_string (codeset);
state->conv = conv;
state->ambiguous_width = _vte_iso2022_ambiguous_width (state);
+
}
const char *
@@ -833,6 +846,14 @@ _vte_iso2022_state_get_codeset(struct _vte_iso2022_state *state)
return state->codeset;
}
+void
+_vte_iso2022_state_set_utf8_ambiguous_width(struct _vte_iso2022_state *state,
+ int utf8_ambiguous_width)
+{
+ state->utf8_ambiguous_width = utf8_ambiguous_width;
+ state->ambiguous_width = _vte_iso2022_ambiguous_width(state);
+}
+
static const guchar *
_vte_iso2022_find_nextctl(const guchar *p, const guchar * const q)
{
@@ -1140,7 +1161,7 @@ process_8_bit_sequence(struct _vte_iso2022_state *state,
static glong
process_cdata(struct _vte_iso2022_state *state, const guchar *cdata, gsize length,
- GArray *gunichars)
+ gboolean incomplete_is_invalid, GArray *gunichars)
{
int ambiguous_width;
glong processed = 0;
@@ -1169,7 +1190,7 @@ process_cdata(struct _vte_iso2022_state *state, const guchar *cdata, gsize lengt
if (!state->nrc_enabled || (state->g[current] == 'B')) {
inbuf = cdata;
inbytes = length;
- _vte_buffer_set_minimum_size(state->buffer,
+ _vte_byte_array_set_minimum_size(state->buffer,
sizeof(gunichar) * length * 2);
buf = (gunichar *)state->buffer->data;
outbuf = buf;
@@ -1181,6 +1202,9 @@ process_cdata(struct _vte_iso2022_state *state, const guchar *cdata, gsize lengt
stop = FALSE;
switch (converted) {
case ((gsize)-1):
+ if (errno == EINVAL && incomplete_is_invalid) {
+ errno = EILSEQ;
+ }
switch (errno) {
case EILSEQ:
/* Check if it's an 8-bit sequence. */
@@ -1611,6 +1635,7 @@ process_block (struct _vte_iso2022_state *state,
guchar *input,
struct _vte_iso2022_block *block,
gboolean last,
+ gboolean incomplete_is_invalid,
GArray *gunichars)
{
guint preserve_last = -1;
@@ -1644,6 +1669,7 @@ process_block (struct _vte_iso2022_state *state,
block->end -
block->start -
initial,
+ incomplete_is_invalid,
gunichars);
if (j == 0) {
break;
@@ -1699,6 +1725,7 @@ _vte_iso2022_process(struct _vte_iso2022_state *state,
preserve_last = process_block (state,
input, &block,
TRUE,
+ FALSE,
gunichars);
break;
}
@@ -1707,7 +1734,7 @@ _vte_iso2022_process(struct _vte_iso2022_state *state,
block.type = _vte_iso2022_cdata;
block.start = p - input;
block.end = nextctl - input;
- process_block (state, input, &block, FALSE, gunichars);
+ process_block (state, input, &block, FALSE, TRUE, gunichars);
}
/* Move on to the control data. */
p = nextctl;
@@ -1742,6 +1769,7 @@ _vte_iso2022_process(struct _vte_iso2022_state *state,
preserve_last = process_block (state,
input, &block,
FALSE,
+ FALSE,
gunichars);
} while (p < q);
if (preserve_last != (guint) -1) {
@@ -1757,7 +1785,7 @@ _vte_iso2022_process(struct _vte_iso2022_state *state,
int
main(int argc, char **argv)
{
- VteBuffer *buffer;
+ VteByteArray *buffer;
struct _vte_iso2022_state *state;
GString *string;
GArray *gunichars;
@@ -1784,8 +1812,8 @@ main(int argc, char **argv)
FILE *fp;
guchar b;
- state = _vte_iso2022_state_new(NULL, NULL, NULL);
- buffer = _vte_buffer_new();
+ state = _vte_iso2022_state_new(NULL, VTE_ISO2022_DEFAULT_UTF8_AMBIGUOUS_WIDTH, NULL, NULL);
+ buffer = _vte_byte_array_new();
gunichars = g_array_new(FALSE, FALSE, sizeof(gunichar));
if (argc > 1) {
string = g_string_new(NULL);
@@ -1802,20 +1830,20 @@ main(int argc, char **argv)
fclose(fp);
}
}
- _vte_buffer_append(buffer, string->str, string->len);
- _vte_iso2022_process(state, buffer->data, _vte_buffer_length (buffer), gunichars);
+ _vte_byte_array_append(buffer, string->str, string->len);
+ _vte_iso2022_process(state, buffer->data, _vte_byte_array_length (buffer), gunichars);
g_string_free(string, TRUE);
} else {
for (i = 0; i < G_N_ELEMENTS(strings); i++) {
string = g_string_new(strings[i].s);
- _vte_buffer_append(buffer, string->str, string->len);
+ _vte_byte_array_append(buffer, string->str, string->len);
g_string_free(string, TRUE);
if (strings[i].process) {
- _vte_iso2022_process(state, buffer->data, _vte_buffer_length (buffer), gunichars);
+ _vte_iso2022_process(state, buffer->data, _vte_byte_array_length (buffer), gunichars);
}
}
}
- _vte_buffer_free(buffer);
+ _vte_byte_array_free(buffer);
_vte_iso2022_state_free(state);
string = g_string_new(NULL);
diff --git a/src/iso2022.h b/src/iso2022.h
index cb54f819..0c186e79 100644
--- a/src/iso2022.h
+++ b/src/iso2022.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* The interfaces in this file are subject to change at any time. */
@@ -33,10 +33,13 @@ struct _vte_iso2022_state;
typedef void (*_vte_iso2022_codeset_changed_cb_fn)(struct _vte_iso2022_state *,
gpointer);
struct _vte_iso2022_state *_vte_iso2022_state_new(const char *native_codeset,
+ int utf8_ambiguous_width,
_vte_iso2022_codeset_changed_cb_fn,
gpointer);
void _vte_iso2022_state_set_codeset(struct _vte_iso2022_state *state,
const char *codeset);
+void _vte_iso2022_state_set_utf8_ambiguous_width(struct _vte_iso2022_state *state,
+ int utf8_ambiguous_width);
const char *_vte_iso2022_state_get_codeset(struct _vte_iso2022_state *state);
gsize _vte_iso2022_process(struct _vte_iso2022_state *state,
guchar *input, gsize length,
@@ -45,6 +48,7 @@ gunichar _vte_iso2022_process_single(struct _vte_iso2022_state *state,
gunichar c, gunichar map);
void _vte_iso2022_state_free(struct _vte_iso2022_state *);
+#define VTE_ISO2022_DEFAULT_UTF8_AMBIGUOUS_WIDTH 1
#define VTE_ISO2022_ENCODED_WIDTH_BIT_OFFSET 28
#define VTE_ISO2022_ENCODED_WIDTH_MASK (3 << VTE_ISO2022_ENCODED_WIDTH_BIT_OFFSET)
diff --git a/src/keymap.c b/src/keymap.c
index 9a216694..c61d7d87 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1,22 +1,24 @@
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*- */
/*
* Copyright (C) 2002,2003 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <config.h>
+#include "config.h"
+
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
@@ -27,13 +29,6 @@
#include "keymap.h"
#include "vtetc.h"
-#if GTK_CHECK_VERSION (2, 90, 7)
-#define GDK_KEY(symbol) GDK_KEY_##symbol
-#else
-#include <gdk/gdkkeysyms.h>
-#define GDK_KEY(symbol) GDK_##symbol
-#endif
-
#if defined(HAVE_NCURSES_H) && defined(HAVE_TERM_H)
#include <ncurses.h>
#include <term.h>
@@ -54,16 +49,6 @@
#endif
#ifdef VTE_DEBUG
-static const char *
-_vte_keysym_name(guint keyval)
-{
- switch (keyval) {
-#include "keysyms.c"
- default:
- break;
- }
- return "(unknown)";
-}
static void
_vte_keysym_print(guint keyval,
GdkModifierType modifiers,
@@ -85,7 +70,7 @@ _vte_keysym_print(guint keyval,
if (modifiers & GDK_SHIFT_MASK) {
g_printerr("Shift+");
}
- g_printerr("%s" , _vte_keysym_name(keyval));
+ g_printerr("%s" , gdk_keyval_name(keyval));
if (sun_mode|hp_mode|legacy_mode|vt220_mode) {
gboolean first = TRUE;
g_printerr("(");
@@ -172,8 +157,17 @@ struct _vte_keymap_entry {
#define X_NULL ""
+enum _vte_modifier_encoding_method {
+ MODIFIER_ENCODING_NONE,
+ MODIFIER_ENCODING_SHORT,
+ MODIFIER_ENCODING_LONG,
+};
+
/* Normal keys unaffected by modes. */
static const struct _vte_keymap_entry _vte_keymap_GDK_space[] = {
+ /* Control+Meta+space = ESC+NUL */
+ {cursor_all, keypad_all, fkey_all,
+ GDK_CONTROL_MASK | VTE_META_MASK, _VTE_CAP_ESC "\0", 2, X_NULL},
/* Meta+space = ESC+" " */
{cursor_all, keypad_all, fkey_all,
VTE_META_MASK, _VTE_CAP_ESC " ", 2, X_NULL},
@@ -286,6 +280,8 @@ static const struct _vte_keymap_entry _vte_keymap_GDK_Home[] = {
{cursor_all, keypad_all, fkey_vt220, 0, _VTE_CAP_CSI "1~", -1, X_NULL},
{cursor_all, keypad_all, fkey_hp, 0, _VTE_CAP_ESC "h", -1, X_NULL},
{cursor_all, keypad_all, fkey_nothpvt, 0, X_NULL, 0, "kh"},
+ {cursor_default, keypad_all, fkey_default, 0, _VTE_CAP_CSI "H", -1, X_NULL},
+ {cursor_app, keypad_all, fkey_default, 0, _VTE_CAP_SS3 "H", -1, X_NULL},
{cursor_all, keypad_all, fkey_all, 0, X_NULL, 0, X_NULL},
};
@@ -293,6 +289,8 @@ static const struct _vte_keymap_entry _vte_keymap_GDK_End[] = {
{cursor_all, keypad_all, fkey_all, 0, X_NULL, 0, "@7"},
{cursor_all, keypad_all, fkey_vt220, 0, _VTE_CAP_CSI "4~", -1, X_NULL},
{cursor_all, keypad_all, fkey_notvt220, 0, X_NULL, 0, "@7"},
+ {cursor_default, keypad_all, fkey_default, 0, _VTE_CAP_CSI "F", -1, X_NULL},
+ {cursor_app, keypad_all, fkey_default, 0, _VTE_CAP_SS3 "F", -1, X_NULL},
{cursor_all, keypad_all, fkey_all, 0, X_NULL, 0, X_NULL},
};
@@ -509,6 +507,8 @@ static const struct _vte_keymap_entry _vte_keymap_GDK_KP_End[] = {
{cursor_all, keypad_default, fkey_vt220, 0, "1", 1, X_NULL},
{cursor_all, keypad_app, fkey_notvt220, 0, _VTE_CAP_CSI "4~", -1, X_NULL},
{cursor_all, keypad_app, fkey_vt220, 0, _VTE_CAP_SS3 "q", -1, X_NULL},
+ {cursor_default, keypad_all, fkey_default, 0, _VTE_CAP_CSI "F", -1, X_NULL},
+ {cursor_app, keypad_all, fkey_default, 0, _VTE_CAP_SS3 "F", -1, X_NULL},
{cursor_all, keypad_all, fkey_all, 0, X_NULL, 0, X_NULL},
};
@@ -545,10 +545,9 @@ static const struct _vte_keymap_entry _vte_keymap_GDK_KP_Left[] = {
static const struct _vte_keymap_entry _vte_keymap_GDK_KP_Begin[] = {
{cursor_all, keypad_default, fkey_all, 0, X_NULL, 0, "K2"},
- {cursor_all, keypad_default, fkey_notvt220,
- 0, _VTE_CAP_CSI "E", -1, X_NULL},
+ {cursor_app, keypad_all, fkey_notvt220, 0, _VTE_CAP_SS3 "E", -1, X_NULL},
+ {cursor_default, keypad_all, fkey_notvt220, 0, _VTE_CAP_CSI "E", -1, X_NULL},
{cursor_all, keypad_default, fkey_vt220, 0, "5", 1, X_NULL},
- {cursor_all, keypad_app, fkey_notvt220, 0, _VTE_CAP_CSI "E", -1, X_NULL},
{cursor_all, keypad_app, fkey_vt220, 0, _VTE_CAP_SS3 "u", -1, X_NULL},
{cursor_all, keypad_all, fkey_all, 0, X_NULL, 0, X_NULL},
};
@@ -570,6 +569,8 @@ static const struct _vte_keymap_entry _vte_keymap_GDK_KP_Home[] = {
{cursor_all, keypad_default, fkey_vt220, 0, "7", 1, X_NULL},
{cursor_all, keypad_app, fkey_notvt220, 0, _VTE_CAP_CSI "1~", -1, X_NULL},
{cursor_all, keypad_app, fkey_vt220, 0, _VTE_CAP_SS3 "w", -1, X_NULL},
+ {cursor_default, keypad_all, fkey_default, 0, _VTE_CAP_CSI "H", -1, X_NULL},
+ {cursor_app, keypad_all, fkey_default, 0, _VTE_CAP_SS3 "H", -1, X_NULL},
{cursor_all, keypad_all, fkey_all, 0, X_NULL, 0, X_NULL},
};
@@ -599,6 +600,9 @@ static const struct _vte_keymap_entry _vte_keymap_GDK_F1[] = {
{cursor_all, keypad_all, fkey_notvt220, 0, X_NULL, 0, "k1"},
{cursor_all, keypad_all, fkey_vt220, GDK_CONTROL_MASK, X_NULL, 0, "F3"},
{cursor_all, keypad_all, fkey_vt220, 0, X_NULL, 0, "k1"},
+ {cursor_all, keypad_all, fkey_default, GDK_CONTROL_MASK, _VTE_CAP_CSI "P", -1, X_NULL},
+ {cursor_all, keypad_all, fkey_default, GDK_SHIFT_MASK, _VTE_CAP_CSI "P", -1, X_NULL},
+ {cursor_all, keypad_all, fkey_default, VTE_META_MASK, _VTE_CAP_CSI "P", -1, X_NULL},
{cursor_all, keypad_all, fkey_default, 0, _VTE_CAP_SS3 "P", -1, X_NULL},
{cursor_all, keypad_all, fkey_sun, 0, _VTE_CAP_CSI "224z", -1, X_NULL},
{cursor_all, keypad_all, fkey_hp, 0, _VTE_CAP_ESC "p", -1, X_NULL},
@@ -613,6 +617,9 @@ static const struct _vte_keymap_entry _vte_keymap_GDK_F2[] = {
{cursor_all, keypad_all, fkey_notvt220, 0, X_NULL, 0, "k2"},
{cursor_all, keypad_all, fkey_vt220, GDK_CONTROL_MASK, X_NULL, 0, "F4"},
{cursor_all, keypad_all, fkey_vt220, 0, X_NULL, 0, "k2"},
+ {cursor_all, keypad_all, fkey_default, GDK_CONTROL_MASK, _VTE_CAP_CSI "Q", -1, X_NULL},
+ {cursor_all, keypad_all, fkey_default, GDK_SHIFT_MASK, _VTE_CAP_CSI "Q", -1, X_NULL},
+ {cursor_all, keypad_all, fkey_default, VTE_META_MASK, _VTE_CAP_CSI "Q", -1, X_NULL},
{cursor_all, keypad_all, fkey_default, 0, _VTE_CAP_SS3 "Q", -1, X_NULL},
{cursor_all, keypad_all, fkey_sun, 0, _VTE_CAP_CSI "225z", -1, X_NULL},
{cursor_all, keypad_all, fkey_hp, 0, _VTE_CAP_ESC "q", -1, X_NULL},
@@ -627,6 +634,9 @@ static const struct _vte_keymap_entry _vte_keymap_GDK_F3[] = {
{cursor_all, keypad_all, fkey_notvt220, 0, X_NULL, 0, "k3"},
{cursor_all, keypad_all, fkey_vt220, GDK_CONTROL_MASK, X_NULL, 0, "F5"},
{cursor_all, keypad_all, fkey_vt220, 0, X_NULL, 0, "k3"},
+ {cursor_all, keypad_all, fkey_default, GDK_CONTROL_MASK, _VTE_CAP_CSI "R", -1, X_NULL},
+ {cursor_all, keypad_all, fkey_default, GDK_SHIFT_MASK, _VTE_CAP_CSI "R", -1, X_NULL},
+ {cursor_all, keypad_all, fkey_default, VTE_META_MASK, _VTE_CAP_CSI "R", -1, X_NULL},
{cursor_all, keypad_all, fkey_default, 0, _VTE_CAP_SS3 "R", -1, X_NULL},
{cursor_all, keypad_all, fkey_sun, 0, _VTE_CAP_CSI "226z", -1, X_NULL},
{cursor_all, keypad_all, fkey_hp, 0, _VTE_CAP_ESC "r", -1, X_NULL},
@@ -641,6 +651,9 @@ static const struct _vte_keymap_entry _vte_keymap_GDK_F4[] = {
{cursor_all, keypad_all, fkey_notvt220, 0, X_NULL, 0, "k4"},
{cursor_all, keypad_all, fkey_vt220, GDK_CONTROL_MASK, X_NULL, 0, "F6"},
{cursor_all, keypad_all, fkey_vt220, 0, X_NULL, 0, "k4"},
+ {cursor_all, keypad_all, fkey_default, GDK_CONTROL_MASK, _VTE_CAP_CSI "S", -1, X_NULL},
+ {cursor_all, keypad_all, fkey_default, GDK_SHIFT_MASK, _VTE_CAP_CSI "S", -1, X_NULL},
+ {cursor_all, keypad_all, fkey_default, VTE_META_MASK, _VTE_CAP_CSI "S", -1, X_NULL},
{cursor_all, keypad_all, fkey_default, 0, _VTE_CAP_SS3 "S", -1, X_NULL},
{cursor_all, keypad_all, fkey_sun, 0, _VTE_CAP_CSI "227z", -1, X_NULL},
{cursor_all, keypad_all, fkey_hp, 0, _VTE_CAP_ESC "s", -1, X_NULL},
@@ -890,104 +903,104 @@ static const struct _vte_keymap_group {
guint keyval;
const struct _vte_keymap_entry *entries;
} _vte_keymap[] = {
- {GDK_KEY (space), _vte_keymap_GDK_space},
- {GDK_KEY (Return), _vte_keymap_GDK_Return},
- {GDK_KEY (Escape), _vte_keymap_GDK_Escape},
- {GDK_KEY (Tab), _vte_keymap_GDK_Tab},
- {GDK_KEY (ISO_Left_Tab), _vte_keymap_GDK_ISO_Left_Tab},
- {GDK_KEY (Home), _vte_keymap_GDK_Home},
- {GDK_KEY (End), _vte_keymap_GDK_End},
- {GDK_KEY (Insert), _vte_keymap_GDK_Insert},
- {GDK_KEY (slash), _vte_keymap_GDK_slash},
- {GDK_KEY (question), _vte_keymap_GDK_question},
- /* GDK_KEY (Delete is all handled in code), due to funkiness. */
- {GDK_KEY (Page_Up), _vte_keymap_GDK_Page_Up},
- {GDK_KEY (Page_Down), _vte_keymap_GDK_Page_Down},
-
- {GDK_KEY (2), _vte_keymap_GDK_2},
- {GDK_KEY (3), _vte_keymap_GDK_3},
- {GDK_KEY (4), _vte_keymap_GDK_4},
- {GDK_KEY (5), _vte_keymap_GDK_5},
- {GDK_KEY (6), _vte_keymap_GDK_6},
- {GDK_KEY (7), _vte_keymap_GDK_7},
- {GDK_KEY (8), _vte_keymap_GDK_8},
- {GDK_KEY (minus), _vte_keymap_GDK_Minus},
-
- {GDK_KEY (Up), _vte_keymap_GDK_Up},
- {GDK_KEY (Down), _vte_keymap_GDK_Down},
- {GDK_KEY (Right), _vte_keymap_GDK_Right},
- {GDK_KEY (Left), _vte_keymap_GDK_Left},
-
- {GDK_KEY (KP_Space), _vte_keymap_GDK_KP_Space},
- {GDK_KEY (KP_Tab), _vte_keymap_GDK_KP_Tab},
- {GDK_KEY (KP_Enter), _vte_keymap_GDK_KP_Enter},
- {GDK_KEY (KP_F1), _vte_keymap_GDK_KP_F1},
- {GDK_KEY (KP_F2), _vte_keymap_GDK_KP_F2},
- {GDK_KEY (KP_F3), _vte_keymap_GDK_KP_F3},
- {GDK_KEY (KP_F4), _vte_keymap_GDK_KP_F4},
- {GDK_KEY (KP_Multiply), _vte_keymap_GDK_KP_Multiply},
- {GDK_KEY (KP_Add), _vte_keymap_GDK_KP_Add},
- {GDK_KEY (KP_Separator), _vte_keymap_GDK_KP_Separator},
- {GDK_KEY (KP_Subtract), _vte_keymap_GDK_KP_Subtract},
- {GDK_KEY (KP_Decimal), _vte_keymap_GDK_KP_Decimal_Delete},
- {GDK_KEY (KP_Delete), _vte_keymap_GDK_KP_Decimal_Delete},
- {GDK_KEY (KP_Divide), _vte_keymap_GDK_KP_Divide},
- {GDK_KEY (KP_0), _vte_keymap_GDK_KP_0},
- {GDK_KEY (KP_Insert), _vte_keymap_GDK_KP_Insert},
- {GDK_KEY (KP_1), _vte_keymap_GDK_KP_1},
- {GDK_KEY (KP_End), _vte_keymap_GDK_KP_End},
- {GDK_KEY (KP_2), _vte_keymap_GDK_KP_2},
- {GDK_KEY (KP_Down), _vte_keymap_GDK_KP_Down},
- {GDK_KEY (KP_3), _vte_keymap_GDK_KP_3},
- {GDK_KEY (KP_Page_Down), _vte_keymap_GDK_KP_Page_Down},
- {GDK_KEY (KP_4), _vte_keymap_GDK_KP_4},
- {GDK_KEY (KP_Left), _vte_keymap_GDK_KP_Left},
- {GDK_KEY (KP_5), _vte_keymap_GDK_KP_5},
- {GDK_KEY (KP_Begin), _vte_keymap_GDK_KP_Begin},
- {GDK_KEY (KP_6), _vte_keymap_GDK_KP_6},
- {GDK_KEY (KP_Right), _vte_keymap_GDK_KP_Right},
- {GDK_KEY (KP_7), _vte_keymap_GDK_KP_7},
- {GDK_KEY (KP_Home), _vte_keymap_GDK_KP_Home},
- {GDK_KEY (KP_8), _vte_keymap_GDK_KP_8},
- {GDK_KEY (KP_Up), _vte_keymap_GDK_KP_Up},
- {GDK_KEY (KP_9), _vte_keymap_GDK_KP_9},
- {GDK_KEY (KP_Page_Up), _vte_keymap_GDK_KP_Page_Up},
-
- {GDK_KEY (F1), _vte_keymap_GDK_F1},
- {GDK_KEY (F2), _vte_keymap_GDK_F2},
- {GDK_KEY (F3), _vte_keymap_GDK_F3},
- {GDK_KEY (F4), _vte_keymap_GDK_F4},
- {GDK_KEY (F5), _vte_keymap_GDK_F5},
- {GDK_KEY (F6), _vte_keymap_GDK_F6},
- {GDK_KEY (F7), _vte_keymap_GDK_F7},
- {GDK_KEY (F8), _vte_keymap_GDK_F8},
- {GDK_KEY (F9), _vte_keymap_GDK_F9},
- {GDK_KEY (F10), _vte_keymap_GDK_F10},
- {GDK_KEY (F11), _vte_keymap_GDK_F11},
- {GDK_KEY (F12), _vte_keymap_GDK_F12},
- {GDK_KEY (F13), _vte_keymap_GDK_F13},
- {GDK_KEY (F14), _vte_keymap_GDK_F14},
- {GDK_KEY (F15), _vte_keymap_GDK_F15},
- {GDK_KEY (F16), _vte_keymap_GDK_F16},
- {GDK_KEY (F17), _vte_keymap_GDK_F17},
- {GDK_KEY (F18), _vte_keymap_GDK_F18},
- {GDK_KEY (F19), _vte_keymap_GDK_F19},
- {GDK_KEY (F20), _vte_keymap_GDK_F20},
- {GDK_KEY (F21), _vte_keymap_GDK_F21},
- {GDK_KEY (F22), _vte_keymap_GDK_F22},
- {GDK_KEY (F23), _vte_keymap_GDK_F23},
- {GDK_KEY (F24), _vte_keymap_GDK_F24},
- {GDK_KEY (F25), _vte_keymap_GDK_F25},
- {GDK_KEY (F26), _vte_keymap_GDK_F26},
- {GDK_KEY (F27), _vte_keymap_GDK_F27},
- {GDK_KEY (F28), _vte_keymap_GDK_F28},
- {GDK_KEY (F29), _vte_keymap_GDK_F29},
- {GDK_KEY (F30), _vte_keymap_GDK_F30},
- {GDK_KEY (F31), _vte_keymap_GDK_F31},
- {GDK_KEY (F32), _vte_keymap_GDK_F32},
- {GDK_KEY (F33), _vte_keymap_GDK_F33},
- {GDK_KEY (F34), _vte_keymap_GDK_F34},
- {GDK_KEY (F35), _vte_keymap_GDK_F35},
+ {GDK_KEY_space, _vte_keymap_GDK_space},
+ {GDK_KEY_Return, _vte_keymap_GDK_Return},
+ {GDK_KEY_Escape, _vte_keymap_GDK_Escape},
+ {GDK_KEY_Tab, _vte_keymap_GDK_Tab},
+ {GDK_KEY_ISO_Left_Tab, _vte_keymap_GDK_ISO_Left_Tab},
+ {GDK_KEY_Home, _vte_keymap_GDK_Home},
+ {GDK_KEY_End, _vte_keymap_GDK_End},
+ {GDK_KEY_Insert, _vte_keymap_GDK_Insert},
+ {GDK_KEY_slash, _vte_keymap_GDK_slash},
+ {GDK_KEY_question, _vte_keymap_GDK_question},
+ /* GDK_Delete is all handled in code, due to funkiness. */
+ {GDK_KEY_Page_Up, _vte_keymap_GDK_Page_Up},
+ {GDK_KEY_Page_Down, _vte_keymap_GDK_Page_Down},
+
+ {GDK_KEY_2, _vte_keymap_GDK_2},
+ {GDK_KEY_3, _vte_keymap_GDK_3},
+ {GDK_KEY_4, _vte_keymap_GDK_4},
+ {GDK_KEY_5, _vte_keymap_GDK_5},
+ {GDK_KEY_6, _vte_keymap_GDK_6},
+ {GDK_KEY_7, _vte_keymap_GDK_7},
+ {GDK_KEY_8, _vte_keymap_GDK_8},
+ {GDK_KEY_minus, _vte_keymap_GDK_Minus},
+
+ {GDK_KEY_Up, _vte_keymap_GDK_Up},
+ {GDK_KEY_Down, _vte_keymap_GDK_Down},
+ {GDK_KEY_Right, _vte_keymap_GDK_Right},
+ {GDK_KEY_Left, _vte_keymap_GDK_Left},
+
+ {GDK_KEY_KP_Space, _vte_keymap_GDK_KP_Space},
+ {GDK_KEY_KP_Tab, _vte_keymap_GDK_KP_Tab},
+ {GDK_KEY_KP_Enter, _vte_keymap_GDK_KP_Enter},
+ {GDK_KEY_KP_F1, _vte_keymap_GDK_KP_F1},
+ {GDK_KEY_KP_F2, _vte_keymap_GDK_KP_F2},
+ {GDK_KEY_KP_F3, _vte_keymap_GDK_KP_F3},
+ {GDK_KEY_KP_F4, _vte_keymap_GDK_KP_F4},
+ {GDK_KEY_KP_Multiply, _vte_keymap_GDK_KP_Multiply},
+ {GDK_KEY_KP_Add, _vte_keymap_GDK_KP_Add},
+ {GDK_KEY_KP_Separator, _vte_keymap_GDK_KP_Separator},
+ {GDK_KEY_KP_Subtract, _vte_keymap_GDK_KP_Subtract},
+ {GDK_KEY_KP_Decimal, _vte_keymap_GDK_KP_Decimal_Delete},
+ {GDK_KEY_KP_Delete, _vte_keymap_GDK_KP_Decimal_Delete},
+ {GDK_KEY_KP_Divide, _vte_keymap_GDK_KP_Divide},
+ {GDK_KEY_KP_0, _vte_keymap_GDK_KP_0},
+ {GDK_KEY_KP_Insert, _vte_keymap_GDK_KP_Insert},
+ {GDK_KEY_KP_1, _vte_keymap_GDK_KP_1},
+ {GDK_KEY_KP_End, _vte_keymap_GDK_KP_End},
+ {GDK_KEY_KP_2, _vte_keymap_GDK_KP_2},
+ {GDK_KEY_KP_Down, _vte_keymap_GDK_KP_Down},
+ {GDK_KEY_KP_3, _vte_keymap_GDK_KP_3},
+ {GDK_KEY_KP_Page_Down, _vte_keymap_GDK_KP_Page_Down},
+ {GDK_KEY_KP_4, _vte_keymap_GDK_KP_4},
+ {GDK_KEY_KP_Left, _vte_keymap_GDK_KP_Left},
+ {GDK_KEY_KP_5, _vte_keymap_GDK_KP_5},
+ {GDK_KEY_KP_Begin, _vte_keymap_GDK_KP_Begin},
+ {GDK_KEY_KP_6, _vte_keymap_GDK_KP_6},
+ {GDK_KEY_KP_Right, _vte_keymap_GDK_KP_Right},
+ {GDK_KEY_KP_7, _vte_keymap_GDK_KP_7},
+ {GDK_KEY_KP_Home, _vte_keymap_GDK_KP_Home},
+ {GDK_KEY_KP_8, _vte_keymap_GDK_KP_8},
+ {GDK_KEY_KP_Up, _vte_keymap_GDK_KP_Up},
+ {GDK_KEY_KP_9, _vte_keymap_GDK_KP_9},
+ {GDK_KEY_KP_Page_Up, _vte_keymap_GDK_KP_Page_Up},
+
+ {GDK_KEY_F1, _vte_keymap_GDK_F1},
+ {GDK_KEY_F2, _vte_keymap_GDK_F2},
+ {GDK_KEY_F3, _vte_keymap_GDK_F3},
+ {GDK_KEY_F4, _vte_keymap_GDK_F4},
+ {GDK_KEY_F5, _vte_keymap_GDK_F5},
+ {GDK_KEY_F6, _vte_keymap_GDK_F6},
+ {GDK_KEY_F7, _vte_keymap_GDK_F7},
+ {GDK_KEY_F8, _vte_keymap_GDK_F8},
+ {GDK_KEY_F9, _vte_keymap_GDK_F9},
+ {GDK_KEY_F10, _vte_keymap_GDK_F10},
+ {GDK_KEY_F11, _vte_keymap_GDK_F11},
+ {GDK_KEY_F12, _vte_keymap_GDK_F12},
+ {GDK_KEY_F13, _vte_keymap_GDK_F13},
+ {GDK_KEY_F14, _vte_keymap_GDK_F14},
+ {GDK_KEY_F15, _vte_keymap_GDK_F15},
+ {GDK_KEY_F16, _vte_keymap_GDK_F16},
+ {GDK_KEY_F17, _vte_keymap_GDK_F17},
+ {GDK_KEY_F18, _vte_keymap_GDK_F18},
+ {GDK_KEY_F19, _vte_keymap_GDK_F19},
+ {GDK_KEY_F20, _vte_keymap_GDK_F20},
+ {GDK_KEY_F21, _vte_keymap_GDK_F21},
+ {GDK_KEY_F22, _vte_keymap_GDK_F22},
+ {GDK_KEY_F23, _vte_keymap_GDK_F23},
+ {GDK_KEY_F24, _vte_keymap_GDK_F24},
+ {GDK_KEY_F25, _vte_keymap_GDK_F25},
+ {GDK_KEY_F26, _vte_keymap_GDK_F26},
+ {GDK_KEY_F27, _vte_keymap_GDK_F27},
+ {GDK_KEY_F28, _vte_keymap_GDK_F28},
+ {GDK_KEY_F29, _vte_keymap_GDK_F29},
+ {GDK_KEY_F30, _vte_keymap_GDK_F30},
+ {GDK_KEY_F31, _vte_keymap_GDK_F31},
+ {GDK_KEY_F32, _vte_keymap_GDK_F32},
+ {GDK_KEY_F33, _vte_keymap_GDK_F33},
+ {GDK_KEY_F34, _vte_keymap_GDK_F34},
+ {GDK_KEY_F35, _vte_keymap_GDK_F35},
};
/* Map the specified keyval/modifier setup, dependent on the mode, to either
@@ -1059,13 +1072,13 @@ _vte_keymap_map(guint keyval,
mods &= entries[j].mod_mask;
}
switch (_vte_keymap[i].keyval) {
- case GDK_KEY (2):
- case GDK_KEY (3):
- case GDK_KEY (4):
- case GDK_KEY (5):
- case GDK_KEY (6):
- case GDK_KEY (7):
- case GDK_KEY (8):
+ case GDK_KEY_2:
+ case GDK_KEY_3:
+ case GDK_KEY_4:
+ case GDK_KEY_5:
+ case GDK_KEY_6:
+ case GDK_KEY_7:
+ case GDK_KEY_8:
/* Known non-full-coverage cases. */
break;
default:
@@ -1220,34 +1233,37 @@ _vte_keymap_key_is_modifier(guint keyval)
gboolean modifier = FALSE;
/* Determine if this is just a modifier key. */
switch (keyval) {
- case GDK_KEY (Alt_L):
- case GDK_KEY (Alt_R):
- case GDK_KEY (Caps_Lock):
- case GDK_KEY (Control_L):
- case GDK_KEY (Control_R):
- case GDK_KEY (Eisu_Shift):
- case GDK_KEY (Hyper_L):
- case GDK_KEY (Hyper_R):
- case GDK_KEY (ISO_First_Group_Lock):
- case GDK_KEY (ISO_Group_Lock):
- case GDK_KEY (ISO_Group_Shift):
- case GDK_KEY (ISO_Last_Group_Lock):
- case GDK_KEY (ISO_Level3_Lock):
- case GDK_KEY (ISO_Level3_Shift):
- case GDK_KEY (ISO_Lock):
- case GDK_KEY (ISO_Next_Group_Lock):
- case GDK_KEY (ISO_Prev_Group_Lock):
- case GDK_KEY (Kana_Lock):
- case GDK_KEY (Kana_Shift):
- case GDK_KEY (Meta_L):
- case GDK_KEY (Meta_R):
- case GDK_KEY (Num_Lock):
- case GDK_KEY (Scroll_Lock):
- case GDK_KEY (Shift_L):
- case GDK_KEY (Shift_Lock):
- case GDK_KEY (Shift_R):
- case GDK_KEY (Super_L):
- case GDK_KEY (Super_R):
+ case GDK_KEY_Alt_L:
+ case GDK_KEY_Alt_R:
+ case GDK_KEY_Caps_Lock:
+ case GDK_KEY_Control_L:
+ case GDK_KEY_Control_R:
+ case GDK_KEY_Eisu_Shift:
+ case GDK_KEY_Hyper_L:
+ case GDK_KEY_Hyper_R:
+ case GDK_KEY_ISO_First_Group_Lock:
+ case GDK_KEY_ISO_Group_Lock:
+ case GDK_KEY_ISO_Group_Shift:
+ case GDK_KEY_ISO_Last_Group_Lock:
+ case GDK_KEY_ISO_Level3_Lock:
+ case GDK_KEY_ISO_Level3_Shift:
+ case GDK_KEY_ISO_Level5_Lock:
+ case GDK_KEY_ISO_Level5_Shift:
+ case GDK_KEY_ISO_Lock:
+ case GDK_KEY_ISO_Next_Group_Lock:
+ case GDK_KEY_ISO_Prev_Group_Lock:
+ case GDK_KEY_Kana_Lock:
+ case GDK_KEY_Kana_Shift:
+ case GDK_KEY_Meta_L:
+ case GDK_KEY_Meta_R:
+ case GDK_KEY_ModeLock:
+ case GDK_KEY_Num_Lock:
+ case GDK_KEY_Scroll_Lock:
+ case GDK_KEY_Shift_L:
+ case GDK_KEY_Shift_Lock:
+ case GDK_KEY_Shift_R:
+ case GDK_KEY_Super_L:
+ case GDK_KEY_Super_R:
modifier = TRUE;
break;
default:
@@ -1257,70 +1273,81 @@ _vte_keymap_key_is_modifier(guint keyval)
return modifier;
}
-static gboolean
-_vte_keymap_key_gets_modifiers(guint keyval)
+static enum _vte_modifier_encoding_method
+_vte_keymap_key_get_modifier_encoding_method(guint keyval)
{
- gboolean fkey = FALSE;
+ enum _vte_modifier_encoding_method method = MODIFIER_ENCODING_NONE;
/* Determine if this key gets modifiers. */
switch (keyval) {
- case GDK_KEY (Up):
- case GDK_KEY (Down):
- case GDK_KEY (Left):
- case GDK_KEY (Right):
- case GDK_KEY (Insert):
- case GDK_KEY (Delete):
- case GDK_KEY (Page_Up):
- case GDK_KEY (Page_Down):
- case GDK_KEY (KP_Up):
- case GDK_KEY (KP_Down):
- case GDK_KEY (KP_Left):
- case GDK_KEY (KP_Right):
- case GDK_KEY (KP_Insert):
- case GDK_KEY (KP_Delete):
- case GDK_KEY (KP_Page_Up):
- case GDK_KEY (KP_Page_Down):
- case GDK_KEY (F1):
- case GDK_KEY (F2):
- case GDK_KEY (F3):
- case GDK_KEY (F4):
- case GDK_KEY (F5):
- case GDK_KEY (F6):
- case GDK_KEY (F7):
- case GDK_KEY (F8):
- case GDK_KEY (F9):
- case GDK_KEY (F10):
- case GDK_KEY (F11):
- case GDK_KEY (F12):
- case GDK_KEY (F13):
- case GDK_KEY (F14):
- case GDK_KEY (F15):
- case GDK_KEY (F16):
- case GDK_KEY (F17):
- case GDK_KEY (F18):
- case GDK_KEY (F19):
- case GDK_KEY (F20):
- case GDK_KEY (F21):
- case GDK_KEY (F22):
- case GDK_KEY (F23):
- case GDK_KEY (F24):
- case GDK_KEY (F25):
- case GDK_KEY (F26):
- case GDK_KEY (F27):
- case GDK_KEY (F28):
- case GDK_KEY (F29):
- case GDK_KEY (F30):
- case GDK_KEY (F31):
- case GDK_KEY (F32):
- case GDK_KEY (F33):
- case GDK_KEY (F34):
- case GDK_KEY (F35):
- fkey = TRUE;
+ case GDK_KEY_Up:
+ case GDK_KEY_Down:
+ case GDK_KEY_Left:
+ case GDK_KEY_Right:
+ case GDK_KEY_Insert:
+ case GDK_KEY_Delete:
+ case GDK_KEY_Home:
+ case GDK_KEY_End:
+ case GDK_KEY_Page_Up:
+ case GDK_KEY_Page_Down:
+ case GDK_KEY_KP_Up:
+ case GDK_KEY_KP_Down:
+ case GDK_KEY_KP_Left:
+ case GDK_KEY_KP_Right:
+ case GDK_KEY_KP_Insert:
+ case GDK_KEY_KP_Delete:
+ case GDK_KEY_KP_Home:
+ case GDK_KEY_KP_End:
+ case GDK_KEY_KP_Page_Up:
+ case GDK_KEY_KP_Page_Down:
+ case GDK_KEY_KP_Begin:
+ case GDK_KEY_F1:
+ case GDK_KEY_F2:
+ case GDK_KEY_F3:
+ case GDK_KEY_F4:
+ case GDK_KEY_F5:
+ case GDK_KEY_F6:
+ case GDK_KEY_F7:
+ case GDK_KEY_F8:
+ case GDK_KEY_F9:
+ case GDK_KEY_F10:
+ case GDK_KEY_F11:
+ case GDK_KEY_F12:
+ case GDK_KEY_F13:
+ case GDK_KEY_F14:
+ case GDK_KEY_F15:
+ case GDK_KEY_F16:
+ case GDK_KEY_F17:
+ case GDK_KEY_F18:
+ case GDK_KEY_F19:
+ case GDK_KEY_F20:
+ case GDK_KEY_F21:
+ case GDK_KEY_F22:
+ case GDK_KEY_F23:
+ case GDK_KEY_F24:
+ case GDK_KEY_F25:
+ case GDK_KEY_F26:
+ case GDK_KEY_F27:
+ case GDK_KEY_F28:
+ case GDK_KEY_F29:
+ case GDK_KEY_F30:
+ case GDK_KEY_F31:
+ case GDK_KEY_F32:
+ case GDK_KEY_F33:
+ case GDK_KEY_F34:
+ case GDK_KEY_F35:
+ method = MODIFIER_ENCODING_LONG;
+ break;
+ case GDK_KEY_KP_Divide:
+ case GDK_KEY_KP_Multiply:
+ case GDK_KEY_KP_Subtract:
+ case GDK_KEY_KP_Add:
+ method = MODIFIER_ENCODING_SHORT;
break;
default:
- fkey = FALSE;
+ method = MODIFIER_ENCODING_NONE;
break;
}
- return fkey;
+ return method;
}
/* Prior and Next are ommitted for the SS3 to CSI switch below */
@@ -1328,19 +1355,21 @@ static gboolean
is_cursor_key(guint keyval)
{
switch (keyval) {
- case GDK_KEY (Home):
- case GDK_KEY (Left):
- case GDK_KEY (Up):
- case GDK_KEY (Right):
- case GDK_KEY (Down):
- case GDK_KEY (End):
-
- case GDK_KEY (KP_Home):
- case GDK_KEY (KP_Left):
- case GDK_KEY (KP_Up):
- case GDK_KEY (KP_Right):
- case GDK_KEY (KP_Down):
- case GDK_KEY (KP_End):
+ case GDK_KEY_Home:
+ case GDK_KEY_Left:
+ case GDK_KEY_Up:
+ case GDK_KEY_Right:
+ case GDK_KEY_Down:
+ case GDK_KEY_End:
+ case GDK_KEY_Begin:
+
+ case GDK_KEY_KP_Home:
+ case GDK_KEY_KP_Left:
+ case GDK_KEY_KP_Up:
+ case GDK_KEY_KP_Right:
+ case GDK_KEY_KP_Down:
+ case GDK_KEY_KP_End:
+ case GDK_KEY_KP_Begin:
return TRUE;
default:
return FALSE;
@@ -1361,13 +1390,15 @@ _vte_keymap_key_add_key_modifiers(guint keyval,
{
int modifier, offset;
char *nnormal;
+ enum _vte_modifier_encoding_method modifier_encoding_method;
GdkModifierType significant_modifiers;
significant_modifiers = GDK_SHIFT_MASK |
GDK_CONTROL_MASK |
VTE_META_MASK;
- if (!_vte_keymap_key_gets_modifiers(keyval)) {
+ modifier_encoding_method = _vte_keymap_key_get_modifier_encoding_method(keyval);
+ if (modifier_encoding_method == MODIFIER_ENCODING_NONE) {
return;
}
if (sun_mode || hp_mode || vt220_mode) {
@@ -1430,22 +1461,21 @@ _vte_keymap_key_add_key_modifiers(guint keyval,
nnormal[offset + 1] = modifier + '0';
nnormal[offset + 0] = ';';
*normal_length += 2;
- } else {
-#if 1
+ } else if (modifier_encoding_method == MODIFIER_ENCODING_LONG) {
/* Stuff a "1", a semicolon and the modifier in right
- * before that last character, matching Xterm. */
+ * before that last character, matching Xterm most of the time. */
nnormal[offset + 3] = nnormal[offset];
nnormal[offset + 2] = modifier + '0';
nnormal[offset + 1] = ';';
nnormal[offset + 0] = '1';
*normal_length += 3;
-#else
+ } else {
/* Stuff the modifier in right before that last
- * character, matching what people expect. */
+ * character, matching what people expect,
+ * and what Xterm does with numpad math operators */
nnormal[offset + 1] = nnormal[offset];
nnormal[offset + 0] = modifier + '0';
*normal_length += 1;
-#endif
}
g_free(*normal);
*normal = nnormal;
diff --git a/src/keymap.h b/src/keymap.h
index 243e22e2..0f19aef2 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* The interfaces in this file are subject to change at any time. */
diff --git a/src/keysyms.c b/src/keysyms.c
deleted file mode 100644
index c8acee37..00000000
--- a/src/keysyms.c
+++ /dev/null
@@ -1,1254 +0,0 @@
- /* this file is auto-generated -- do not edit */
- case 0xfe0a: return "GDK_ISO_Prev_Group";
- case 0xfe0c: return "GDK_ISO_First_Group";
- case 0xfe0b: return "GDK_ISO_Prev_Group_Lock";
- case 0xfe0e: return "GDK_ISO_Last_Group";
- case 0xfe0d: return "GDK_ISO_First_Group_Lock";
- case 0xfe0f: return "GDK_ISO_Last_Group_Lock";
- case 0xce5: return "GDK_hebrew_waw";
- case 0xcf7: return "GDK_hebrew_qoph, GDK_hebrew_kuf";
- case 0x2a1: return "GDK_Hstroke";
- case 0xdbd: return "GDK_Thai_fofa";
- case 0x4df: return "GDK_semivoicedsound";
- case 0x2bc: return "GDK_jcircumflex";
- case 0x2bb: return "GDK_gbreve";
- case 0x9ec: return "GDK_upleftcorner";
- case 0x9eb: return "GDK_uprightcorner";
- case 0x9ea: return "GDK_lowrightcorner";
- case 0xcf9: return "GDK_hebrew_shin";
- case 0x47e: return "GDK_overline";
- case 0xce6: return "GDK_hebrew_zain, GDK_hebrew_zayin";
- case 0x05b: return "GDK_bracketleft";
- case 0x05c: return "GDK_backslash";
- case 0x05a: return "GDK_Z";
- case 0x05f: return "GDK_underscore";
- case 0x05d: return "GDK_bracketright";
- case 0x05e: return "GDK_asciicircum";
- case 0x6c6: return "GDK_Cyrillic_ef";
- case 0x6c7: return "GDK_Cyrillic_ghe";
- case 0x6c4: return "GDK_Cyrillic_de";
- case 0x6c5: return "GDK_Cyrillic_ie";
- case 0x6c2: return "GDK_Cyrillic_be";
- case 0x6c3: return "GDK_Cyrillic_tse";
- case 0x6c0: return "GDK_Cyrillic_yu";
- case 0x6c1: return "GDK_Cyrillic_a";
- case 0x5e3: return "GDK_Arabic_kaf";
- case 0x5e2: return "GDK_Arabic_qaf";
- case 0x5e1: return "GDK_Arabic_feh";
- case 0x5e0: return "GDK_Arabic_tatweel";
- case 0x5e7: return "GDK_Arabic_ha, GDK_Arabic_heh";
- case 0x5e6: return "GDK_Arabic_noon";
- case 0x5e5: return "GDK_Arabic_meem";
- case 0x5e4: return "GDK_Arabic_lam";
- case 0x5e9: return "GDK_Arabic_alefmaksura";
- case 0x5e8: return "GDK_Arabic_waw";
- case 0xab4: return "GDK_threefifths";
- case 0x2b1: return "GDK_hstroke";
- case 0x9e5: return "GDK_lf";
- case 0x13bc: return "GDK_OE";
- case 0x9e3: return "GDK_ff";
- case 0x9e2: return "GDK_ht";
- case 0x9e1: return "GDK_checkerboard";
- case 0x2b6: return "GDK_hcircumflex";
- case 0x2b9: return "GDK_idotless";
- case 0xee4: return "GDK_Hangul_J_Pieub";
- case 0xecc: return "GDK_Hangul_U";
- case 0xef4: return "GDK_Hangul_SunkyeongeumPhieuf";
- case 0x9e9: return "GDK_vt";
- case 0x9e8: return "GDK_nl";
- case 0xfe01: return "GDK_ISO_Lock";
- case 0xfe03: return "GDK_ISO_Level3_Shift";
- case 0xfe02: return "GDK_ISO_Level2_Latch";
- case 0xfe05: return "GDK_ISO_Level3_Lock";
- case 0xfe04: return "GDK_ISO_Level3_Latch";
- case 0xfe07: return "GDK_ISO_Group_Lock";
- case 0xfe06: return "GDK_ISO_Group_Latch";
- case 0xfe09: return "GDK_ISO_Next_Group_Lock";
- case 0xfe08: return "GDK_ISO_Next_Group";
- case 0xab1: return "GDK_twothirds";
- case 0x065: return "GDK_e";
- case 0xef3: return "GDK_Hangul_KkogjiDalrinIeung";
- case 0x5ec: return "GDK_Arabic_dammatan";
- case 0xffee: return "GDK_Hyper_R";
- case 0x5ea: return "GDK_Arabic_yeh";
- case 0xfd0c: return "GDK_3270_PA3";
- case 0x5ef: return "GDK_Arabic_damma";
- case 0x5ee: return "GDK_Arabic_fatha";
- case 0x5ed: return "GDK_Arabic_kasratan";
- case 0x0f3: return "GDK_oacute";
- case 0x063: return "GDK_c";
- case 0x7a3: return "GDK_Greek_ETAaccent";
- case 0xfd0e: return "GDK_3270_Attn";
- case 0x052: return "GDK_R";
- case 0x053: return "GDK_S";
- case 0x050: return "GDK_P";
- case 0x051: return "GDK_Q";
- case 0x056: return "GDK_V";
- case 0x057: return "GDK_W";
- case 0x054: return "GDK_T";
- case 0x055: return "GDK_U";
- case 0x6cf: return "GDK_Cyrillic_o";
- case 0xffea: return "GDK_Alt_R";
- case 0x058: return "GDK_X";
- case 0x059: return "GDK_Y";
- case 0x6cb: return "GDK_Cyrillic_ka";
- case 0x6cc: return "GDK_Cyrillic_el";
- case 0x6ca: return "GDK_Cyrillic_shorti";
- case 0x0c4: return "GDK_Adiaeresis";
- case 0x0c5: return "GDK_Aring";
- case 0x0c6: return "GDK_AE";
- case 0x0c7: return "GDK_Ccedilla";
- case 0x0c0: return "GDK_Agrave";
- case 0xffec: return "GDK_Super_R";
- case 0x0c2: return "GDK_Acircumflex";
- case 0x0c3: return "GDK_Atilde";
- case 0xffeb: return "GDK_Super_L";
- case 0x0c8: return "GDK_Egrave";
- case 0x0c9: return "GDK_Eacute";
- case 0xeab: return "GDK_Hangul_RieulMieum";
- case 0x0a6: return "GDK_brokenbar";
- case 0xba9: return "GDK_upcaret";
- case 0x7c9: return "GDK_Greek_IOTA";
- case 0x0a7: return "GDK_section";
- case 0x7c7: return "GDK_Greek_ETA";
- case 0x7c6: return "GDK_Greek_ZETA";
- case 0x7c5: return "GDK_Greek_EPSILON";
- case 0x7c4: return "GDK_Greek_DELTA";
- case 0x7c3: return "GDK_Greek_GAMMA";
- case 0x7c2: return "GDK_Greek_BETA";
- case 0x7c1: return "GDK_Greek_ALPHA";
- case 0x9e0: return "GDK_soliddiamond";
- case 0xbd8: return "GDK_rightshoe";
- case 0xea3: return "GDK_Hangul_KiyeogSios";
- case 0x20aa: return "GDK_NewSheqelSign";
- case 0x8da: return "GDK_includedin";
- case 0xfefd: return "GDK_Pointer_Drag5";
- case 0xfefc: return "GDK_Pointer_DfltBtnPrev";
- case 0xfefb: return "GDK_Pointer_DfltBtnNext";
- case 0xfefa: return "GDK_Pointer_Accelerate";
- case 0x20a8: return "GDK_RupeeSign";
- case 0x8dc: return "GDK_intersection";
- case 0xec9: return "GDK_Hangul_WAE";
- case 0xec8: return "GDK_Hangul_WA";
- case 0xad1: return "GDK_rightsinglequotemark";
- case 0x7cf: return "GDK_Greek_OMICRON";
- case 0x7ce: return "GDK_Greek_XI";
- case 0x7cd: return "GDK_Greek_NU";
- case 0x7cc: return "GDK_Greek_MU";
- case 0x7cb: return "GDK_Greek_LAMDA, GDK_Greek_LAMBDA";
- case 0x7ca: return "GDK_Greek_KAPPA";
- case 0x8dd: return "GDK_union";
- case 0x0cd: return "GDK_Iacute";
- case 0x0ce: return "GDK_Icircumflex";
- case 0x0cf: return "GDK_Idiaeresis";
- case 0xde5: return "GDK_Thai_lakkhangyao";
- case 0x0ca: return "GDK_Ecircumflex";
- case 0x0cb: return "GDK_Ediaeresis";
- case 0x0cc: return "GDK_Igrave";
- case 0xaf8: return "GDK_femalesymbol";
- case 0xfef7: return "GDK_Pointer_Drag3";
- case 0xfef6: return "GDK_Pointer_Drag2";
- case 0xfef5: return "GDK_Pointer_Drag1";
- case 0xfef4: return "GDK_Pointer_Drag_Dflt";
- case 0xfef3: return "GDK_Pointer_DblClick5";
- case 0xfef2: return "GDK_Pointer_DblClick4";
- case 0xfef1: return "GDK_Pointer_DblClick3";
- case 0xfef0: return "GDK_Pointer_DblClick2";
- case 0xdaf: return "GDK_Thai_topatak";
- case 0x6c9: return "GDK_Cyrillic_i";
- case 0xfef9: return "GDK_Pointer_EnableKeys";
- case 0xfef8: return "GDK_Pointer_Drag4";
- case 0xec1: return "GDK_Hangul_YA";
- case 0xec0: return "GDK_Hangul_AE";
- case 0xdae: return "GDK_Thai_dochada";
- case 0xec3: return "GDK_Hangul_EO";
- case 0xcfa: return "GDK_hebrew_taw, GDK_hebrew_taf";
- case 0xec2: return "GDK_Hangul_YAE";
- case 0x6f7: return "GDK_Cyrillic_VE";
- case 0x1bf: return "GDK_zabovedot";
- case 0xec5: return "GDK_Hangul_YEO";
- case 0x1bd: return "GDK_doubleacute";
- case 0x1be: return "GDK_zcaron";
- case 0x1bb: return "GDK_tcaron";
- case 0x1bc: return "GDK_zacute";
- case 0x1ba: return "GDK_scedilla";
- case 0xbdc: return "GDK_lefttack";
- case 0xef9: return "GDK_Hangul_J_KkogjiDalrinIeung";
- case 0xde8: return "GDK_Thai_maiek";
- case 0x02c: return "GDK_comma";
- case 0x02b: return "GDK_plus";
- case 0x02a: return "GDK_asterisk";
- case 0xec6: return "GDK_Hangul_YE";
- case 0x02f: return "GDK_slash";
- case 0x02e: return "GDK_period";
- case 0x02d: return "GDK_minus";
- case 0xecd: return "GDK_Hangul_WEO";
- case 0x3dd: return "GDK_Utilde";
- case 0x3de: return "GDK_Umacron";
- case 0xff55: return "GDK_Prior, GDK_Page_Up";
- case 0xff54: return "GDK_Down";
- case 0xff57: return "GDK_End";
- case 0xff56: return "GDK_Next, GDK_Page_Down";
- case 0xff51: return "GDK_Left";
- case 0xff50: return "GDK_Home";
- case 0xff53: return "GDK_Right";
- case 0xff52: return "GDK_Up";
- case 0xadd: return "GDK_filledrighttribullet";
- case 0xff58: return "GDK_Begin";
- case 0x7f6: return "GDK_Greek_phi";
- case 0xfd08: return "GDK_3270_Reset";
- case 0x029: return "GDK_parenright";
- case 0x028: return "GDK_parenleft";
- case 0x023: return "GDK_numbersign";
- case 0x022: return "GDK_quotedbl";
- case 0x021: return "GDK_exclam";
- case 0x020: return "GDK_space";
- case 0x027: return "GDK_apostrophe, GDK_quoteright";
- case 0x026: return "GDK_ampersand";
- case 0x025: return "GDK_percent";
- case 0x024: return "GDK_dollar";
- case 0xcf0: return "GDK_hebrew_nun";
- case 0xcf1: return "GDK_hebrew_samech, GDK_hebrew_samekh";
- case 0xcf2: return "GDK_hebrew_ayin";
- case 0xcf3: return "GDK_hebrew_finalpe";
- case 0xcf4: return "GDK_hebrew_pe";
- case 0xcf5: return "GDK_hebrew_finalzade, GDK_hebrew_finalzadi";
- case 0xcf6: return "GDK_hebrew_zade, GDK_hebrew_zadi";
- case 0x1b9: return "GDK_scaron";
- case 0x1b6: return "GDK_sacute";
- case 0x1b7: return "GDK_caron";
- case 0x1b5: return "GDK_lcaron";
- case 0x1b2: return "GDK_ogonek";
- case 0x1b3: return "GDK_lstroke";
- case 0x1b1: return "GDK_aogonek";
- case 0xef6: return "GDK_Hangul_AraeA";
- case 0xef7: return "GDK_Hangul_AraeAE";
- case 0xece: return "GDK_Hangul_WE";
- case 0xef5: return "GDK_Hangul_YeorinHieuh";
- case 0xef2: return "GDK_Hangul_PanSios";
- case 0xdab: return "GDK_Thai_soso";
- case 0xef0: return "GDK_Hangul_SunkyeongeumMieum";
- case 0xef1: return "GDK_Hangul_SunkyeongeumPieub";
- case 0xef8: return "GDK_Hangul_J_PanSios";
- case 0xac4: return "GDK_threeeighths";
- case 0xdca: return "GDK_Thai_sosua";
- case 0x3d9: return "GDK_Uogonek";
- case 0x5ac: return "GDK_Arabic_comma";
- case 0xfd01: return "GDK_3270_Duplicate";
- case 0x3d2: return "GDK_Omacron";
- case 0x3d3: return "GDK_Kcedilla";
- case 0x3d1: return "GDK_Ncedilla";
- case 0x06e: return "GDK_n";
- case 0xdc5: return "GDK_Thai_loling";
- case 0x7a2: return "GDK_Greek_EPSILONaccent";
- case 0xffe5: return "GDK_Caps_Lock";
- case 0x06d: return "GDK_m";
- case 0xff8d: return "GDK_KP_Enter";
- case 0xebb: return "GDK_Hangul_Khieuq";
- case 0x06c: return "GDK_l";
- case 0xdc7: return "GDK_Thai_wowaen";
- case 0xffe7: return "GDK_Meta_L";
- case 0xfd05: return "GDK_3270_BackTab";
- case 0xdc0: return "GDK_Thai_phosamphao";
- case 0xdc1: return "GDK_Thai_moma";
- case 0xdc2: return "GDK_Thai_yoyak";
- case 0xffe6: return "GDK_Shift_Lock";
- case 0xdc4: return "GDK_Thai_ru";
- case 0x06a: return "GDK_j";
- case 0xdc6: return "GDK_Thai_lu";
- case 0xacd: return "GDK_rightopentriangle";
- case 0xace: return "GDK_emopencircle";
- case 0xffe1: return "GDK_Shift_L";
- case 0xacf: return "GDK_emopenrectangle";
- case 0xaca: return "GDK_signaturemark";
- case 0xacc: return "GDK_leftopentriangle";
- case 0xffe0: return "GDK_F35, GDK_R15";
- case 0xfe78: return "GDK_Overlay1_Enable";
- case 0xfe79: return "GDK_Overlay2_Enable";
- case 0xea4: return "GDK_Hangul_Nieun";
- case 0xff3b: return "GDK_Hangul_PostHanja";
- case 0xfe70: return "GDK_AccessX_Enable";
- case 0xfe71: return "GDK_AccessX_Feedback_Enable";
- case 0xfe72: return "GDK_RepeatKeys_Enable";
- case 0xffe2: return "GDK_Shift_R";
- case 0xfe74: return "GDK_BounceKeys_Enable";
- case 0xfe75: return "GDK_StickyKeys_Enable";
- case 0xfe76: return "GDK_MouseKeys_Enable";
- case 0xfe77: return "GDK_MouseKeys_Accel_Enable";
- case 0xdde: return "GDK_Thai_maihanakat_maitho";
- case 0x4a8: return "GDK_kana_i";
- case 0x4a9: return "GDK_kana_u";
- case 0xdda: return "GDK_Thai_phinthu";
- case 0xed6: return "GDK_Hangul_J_KiyeogSios";
- case 0x4a2: return "GDK_kana_openingbracket";
- case 0x4a3: return "GDK_kana_closingbracket";
- case 0x4a1: return "GDK_kana_fullstop";
- case 0x4a6: return "GDK_kana_WO";
- case 0x4a7: return "GDK_kana_a";
- case 0x4a4: return "GDK_kana_comma";
- case 0x4a5: return "GDK_kana_conjunctive, GDK_kana_middledot";
- case 0x8c8: return "GDK_approximate";
- case 0xba3: return "GDK_leftcaret";
- case 0xdcb: return "GDK_Thai_hohip";
- case 0xdcc: return "GDK_Thai_lochula";
- case 0xac9: return "GDK_trademark";
- case 0xdce: return "GDK_Thai_honokhuk";
- case 0xdcf: return "GDK_Thai_paiyannoi";
- case 0xac5: return "GDK_fiveeighths";
- case 0x0ab: return "GDK_guillemotleft";
- case 0xff3d: return "GDK_MultipleCandidate, GDK_Zen_Koho, GDK_Hangul_MultipleCandidate";
- case 0xac3: return "GDK_oneeighth";
- case 0x0ac: return "GDK_notsign";
- case 0x7f4: return "GDK_Greek_tau";
- case 0x7f5: return "GDK_Greek_upsilon";
- case 0xff80: return "GDK_KP_Space";
- case 0x7f7: return "GDK_Greek_chi";
- case 0x7f0: return "GDK_Greek_pi";
- case 0x7f1: return "GDK_Greek_rho";
- case 0x7f2: return "GDK_Greek_sigma";
- case 0x7f3: return "GDK_Greek_finalsmallsigma";
- case 0xff89: return "GDK_KP_Tab";
- case 0x7f8: return "GDK_Greek_psi";
- case 0x7f9: return "GDK_Greek_omega";
- case 0xdd5: return "GDK_Thai_saraii";
- case 0xdd4: return "GDK_Thai_sarai";
- case 0xdd7: return "GDK_Thai_sarauee";
- case 0xdd6: return "GDK_Thai_saraue";
- case 0xdd1: return "GDK_Thai_maihanakat";
- case 0xdd0: return "GDK_Thai_saraa";
- case 0xdd3: return "GDK_Thai_saraam";
- case 0xdd2: return "GDK_Thai_saraaa";
- case 0x4ab: return "GDK_kana_o";
- case 0x4ac: return "GDK_kana_ya";
- case 0x4aa: return "GDK_kana_e";
- case 0x4af: return "GDK_kana_tsu, GDK_kana_tu";
- case 0xdd8: return "GDK_Thai_sarau";
- case 0x4ad: return "GDK_kana_yu";
- case 0x4ae: return "GDK_kana_yo";
- case 0xad9: return "GDK_latincross";
- case 0xdf1: return "GDK_Thai_leknung";
- case 0xada: return "GDK_hexagram";
- case 0xad0: return "GDK_leftsinglequotemark";
- case 0xfe7a: return "GDK_AudibleBell_Enable";
- case 0xad2: return "GDK_leftdoublequotemark";
- case 0xad3: return "GDK_rightdoublequotemark";
- case 0xad4: return "GDK_prescription";
- case 0xadb: return "GDK_filledrectbullet";
- case 0xad6: return "GDK_minutes";
- case 0xad7: return "GDK_seconds";
- case 0xffd6: return "GDK_F25, GDK_R5";
- case 0xffd7: return "GDK_F26, GDK_R6";
- case 0xffd4: return "GDK_F23, GDK_R3";
- case 0xfe73: return "GDK_SlowKeys_Enable";
- case 0xffd2: return "GDK_F21, GDK_R1";
- case 0xffd3: return "GDK_F22, GDK_R2";
- case 0xffd0: return "GDK_F19, GDK_L9";
- case 0xffd1: return "GDK_F20, GDK_L10";
- case 0xffffff: return "GDK_VoidSymbol";
- case 0xffd8: return "GDK_F27, GDK_R7";
- case 0xffd9: return "GDK_F28, GDK_R8";
- case 0x1fb: return "GDK_udoubleacute";
- case 0x8b2: return "GDK_botleftsummation";
- case 0x8b1: return "GDK_topleftsummation";
- case 0x8b0: return "GDK_rightmiddlecurlybrace";
- case 0x1ff: return "GDK_abovedot";
- case 0x8b6: return "GDK_botrightsummation";
- case 0x8b5: return "GDK_toprightsummation";
- case 0x1fe: return "GDK_tcedilla";
- case 0xdaa: return "GDK_Thai_chochang";
- case 0xba6: return "GDK_rightcaret";
- case 0xda3: return "GDK_Thai_khokhuat";
- case 0xacb: return "GDK_trademarkincircle";
- case 0xabb: return "GDK_figdash";
- case 0x5da: return "GDK_Arabic_ghain";
- case 0xaf9: return "GDK_telephone";
- case 0xabc: return "GDK_leftanglebracket";
- case 0xffc3: return "GDK_F6";
- case 0xffc2: return "GDK_F5";
- case 0xffc1: return "GDK_F4";
- case 0xffc0: return "GDK_F3";
- case 0xffc7: return "GDK_F10";
- case 0xffc6: return "GDK_F9";
- case 0xfee8: return "GDK_Pointer_Button_Dflt";
- case 0xfee9: return "GDK_Pointer_Button1";
- case 0xfee6: return "GDK_Pointer_DownLeft";
- case 0xfee7: return "GDK_Pointer_DownRight";
- case 0xffc9: return "GDK_F12, GDK_L2";
- case 0xfee5: return "GDK_Pointer_UpRight";
- case 0xfee2: return "GDK_Pointer_Up";
- case 0xfee3: return "GDK_Pointer_Down";
- case 0xfee0: return "GDK_Pointer_Left";
- case 0xfee1: return "GDK_Pointer_Right";
- case 0x1f2: return "GDK_ncaron";
- case 0x1f0: return "GDK_dstroke";
- case 0x1f1: return "GDK_nacute";
- case 0x8bf: return "GDK_integral";
- case 0x8be: return "GDK_greaterthanequal";
- case 0x1f5: return "GDK_odoubleacute";
- case 0x20a7: return "GDK_PesetaSign";
- case 0xdf7: return "GDK_Thai_lekchet";
- case 0x1f8: return "GDK_rcaron";
- case 0x1f9: return "GDK_uring";
- case 0xdf6: return "GDK_Thai_lekhok";
- case 0xffdf: return "GDK_F34, GDK_R14";
- case 0xedd: return "GDK_Hangul_J_RieulMieum";
- case 0xffdd: return "GDK_F32, GDK_R12";
- case 0xffde: return "GDK_F33, GDK_R13";
- case 0xffdb: return "GDK_F30, GDK_R10";
- case 0xffdc: return "GDK_F31, GDK_R11";
- case 0xffda: return "GDK_F29, GDK_R9";
- case 0xeca: return "GDK_Hangul_OE";
- case 0xedf: return "GDK_Hangul_J_RieulSios";
- case 0xbfc: return "GDK_righttack";
- case 0xffcc: return "GDK_F15, GDK_L5";
- case 0xffcb: return "GDK_F14, GDK_L4";
- case 0xffca: return "GDK_F13, GDK_L3";
- case 0xeb9: return "GDK_Hangul_SsangJieuj";
- case 0x20ac: return "GDK_EuroSign";
- case 0xffcf: return "GDK_F18, GDK_L8";
- case 0xffce: return "GDK_F17, GDK_L7";
- case 0xffcd: return "GDK_F16, GDK_L6";
- case 0xfeef: return "GDK_Pointer_DblClick1";
- case 0xeb3: return "GDK_Hangul_SsangPieub";
- case 0xfeed: return "GDK_Pointer_Button5";
- case 0xff1b: return "GDK_Escape";
- case 0xfeeb: return "GDK_Pointer_Button3";
- case 0xfeec: return "GDK_Pointer_Button4";
- case 0xeb4: return "GDK_Hangul_PieubSios";
- case 0xfeea: return "GDK_Pointer_Button2";
- case 0x5d8: return "GDK_Arabic_zah";
- case 0x5d9: return "GDK_Arabic_ain";
- case 0x5d4: return "GDK_Arabic_sheen";
- case 0x5d5: return "GDK_Arabic_sad";
- case 0x5d6: return "GDK_Arabic_dad";
- case 0x5d7: return "GDK_Arabic_tah";
- case 0x5d0: return "GDK_Arabic_thal";
- case 0x5d1: return "GDK_Arabic_ra";
- case 0x5d2: return "GDK_Arabic_zain";
- case 0x5d3: return "GDK_Arabic_seen";
- case 0xefa: return "GDK_Hangul_J_YeorinHieuh";
- case 0x2c6: return "GDK_Ccircumflex";
- case 0x2c5: return "GDK_Cabovedot";
- case 0xdf4: return "GDK_Thai_leksi";
- case 0x7ba: return "GDK_Greek_upsilonaccentdieresis";
- case 0x7bb: return "GDK_Greek_omegaaccent";
- case 0x3a3: return "GDK_Rcedilla";
- case 0x0da: return "GDK_Uacute";
- case 0x0dc: return "GDK_Udiaeresis";
- case 0x0db: return "GDK_Ucircumflex";
- case 0x0de: return "GDK_THORN, GDK_Thorn";
- case 0x0dd: return "GDK_Yacute";
- case 0x0df: return "GDK_ssharp";
- case 0xfe34: return "GDK_ISO_Enter";
- case 0xdcd: return "GDK_Thai_oang";
- case 0xac6: return "GDK_seveneighths";
- case 0xfe30: return "GDK_ISO_Continuous_Underline";
- case 0xfe31: return "GDK_ISO_Discontinuous_Underline";
- case 0xfe32: return "GDK_ISO_Emphasize";
- case 0xfe33: return "GDK_ISO_Center_Object";
- case 0xce9: return "GDK_hebrew_yod";
- case 0xce8: return "GDK_hebrew_tet, GDK_hebrew_teth";
- case 0xea5: return "GDK_Hangul_NieunJieuj";
- case 0x1c6: return "GDK_Cacute";
- case 0xce1: return "GDK_hebrew_bet, GDK_hebrew_beth";
- case 0xce0: return "GDK_hebrew_aleph";
- case 0xce3: return "GDK_hebrew_dalet, GDK_hebrew_daleth";
- case 0xce2: return "GDK_hebrew_gimel, GDK_hebrew_gimmel";
- case 0x7a4: return "GDK_Greek_IOTAaccent";
- case 0xce4: return "GDK_hebrew_he";
- case 0xce7: return "GDK_hebrew_chet, GDK_hebrew_het";
- case 0x1c0: return "GDK_Racute";
- case 0x3c0: return "GDK_Amacron";
- case 0x3c7: return "GDK_Iogonek";
- case 0x1c3: return "GDK_Abreve";
- case 0x069: return "GDK_i";
- case 0x068: return "GDK_h";
- case 0x067: return "GDK_g";
- case 0x066: return "GDK_f";
- case 0xfd0b: return "GDK_3270_PA2";
- case 0x064: return "GDK_d";
- case 0xfd0d: return "GDK_3270_Test";
- case 0x062: return "GDK_b";
- case 0x061: return "GDK_a";
- case 0x060: return "GDK_grave, GDK_quoteleft";
- case 0x0d1: return "GDK_Ntilde";
- case 0x0d0: return "GDK_ETH, GDK_Eth";
- case 0x0d3: return "GDK_Oacute";
- case 0x0d2: return "GDK_Ograve";
- case 0x0d5: return "GDK_Otilde";
- case 0x0d4: return "GDK_Ocircumflex";
- case 0x0d7: return "GDK_multiply";
- case 0x0d6: return "GDK_Odiaeresis";
- case 0x0d9: return "GDK_Ugrave";
- case 0x0d8: return "GDK_Ooblique";
- case 0x6ae: return "GDK_Byelorussian_shortu";
- case 0xdea: return "GDK_Thai_maitri";
- case 0x7b8: return "GDK_Greek_upsilonaccent";
- case 0x7b9: return "GDK_Greek_upsilondieresis";
- case 0x9df: return "GDK_blank";
- case 0x7b1: return "GDK_Greek_alphaaccent";
- case 0x7b2: return "GDK_Greek_epsilonaccent";
- case 0x7b3: return "GDK_Greek_etaaccent";
- case 0x7b4: return "GDK_Greek_iotaaccent";
- case 0x6cd: return "GDK_Cyrillic_em";
- case 0x7b6: return "GDK_Greek_iotaaccentdieresis";
- case 0x7b7: return "GDK_Greek_omicronaccent";
- case 0x3cc: return "GDK_Eabovedot";
- case 0xfd09: return "GDK_3270_Quit";
- case 0x6ce: return "GDK_Cyrillic_en";
- case 0x3cf: return "GDK_Imacron";
- case 0x06f: return "GDK_o";
- case 0xfd02: return "GDK_3270_FieldMark";
- case 0xfd03: return "GDK_3270_Right2";
- case 0xfd04: return "GDK_3270_Left2";
- case 0x06b: return "GDK_k";
- case 0xfd06: return "GDK_3270_EraseEOF";
- case 0xfd07: return "GDK_3270_EraseInput";
- case 0xcea: return "GDK_hebrew_finalkaph";
- case 0xcec: return "GDK_hebrew_lamed";
- case 0xceb: return "GDK_hebrew_kaph";
- case 0xcee: return "GDK_hebrew_mem";
- case 0x8b3: return "GDK_topvertsummationconnector";
- case 0xcef: return "GDK_hebrew_finalnun";
- case 0x8f6: return "GDK_function";
- case 0xddf: return "GDK_Thai_baht";
- case 0xdf8: return "GDK_Thai_lekpaet";
- case 0x6df: return "GDK_Cyrillic_hardsign";
- case 0x6de: return "GDK_Cyrillic_che";
- case 0x6dd: return "GDK_Cyrillic_shcha";
- case 0x6dc: return "GDK_Cyrillic_e";
- case 0x6db: return "GDK_Cyrillic_sha";
- case 0x6da: return "GDK_Cyrillic_ze";
- case 0xeb6: return "GDK_Hangul_SsangSios";
- case 0x0c1: return "GDK_Aacute";
- case 0xade: return "GDK_emfilledcircle";
- case 0xff6a: return "GDK_Help";
- case 0xff6b: return "GDK_Break";
- case 0x7e9: return "GDK_Greek_iota";
- case 0x7e8: return "GDK_Greek_theta";
- case 0xff34: return "GDK_Hangul_Hanja";
- case 0x7e5: return "GDK_Greek_epsilon";
- case 0x7e4: return "GDK_Greek_delta";
- case 0x7e7: return "GDK_Greek_eta";
- case 0x7e6: return "GDK_Greek_zeta";
- case 0x7e1: return "GDK_Greek_alpha";
- case 0x7e3: return "GDK_Greek_gamma";
- case 0x7e2: return "GDK_Greek_beta";
- case 0x1e6: return "GDK_cacute";
- case 0x7b5: return "GDK_Greek_iotadieresis";
- case 0x1e5: return "GDK_lacute";
- case 0xda5: return "GDK_Thai_khokhon";
- case 0xecb: return "GDK_Hangul_YO";
- case 0xbcc: return "GDK_quad";
- case 0x8ef: return "GDK_partialderivative";
- case 0xbca: return "GDK_jot";
- case 0x8fe: return "GDK_downarrow";
- case 0x8fd: return "GDK_rightarrow";
- case 0x8fc: return "GDK_uparrow";
- case 0x8fb: return "GDK_leftarrow";
- case 0x6d9: return "GDK_Cyrillic_yeru";
- case 0x6d8: return "GDK_Cyrillic_softsign";
- case 0x6d7: return "GDK_Cyrillic_ve";
- case 0x6d6: return "GDK_Cyrillic_zhe";
- case 0x6d5: return "GDK_Cyrillic_u";
- case 0x1e0: return "GDK_racute";
- case 0x6d3: return "GDK_Cyrillic_es";
- case 0x6d2: return "GDK_Cyrillic_er";
- case 0x6d1: return "GDK_Cyrillic_ya";
- case 0x6d0: return "GDK_Cyrillic_pe";
- case 0xea7: return "GDK_Hangul_Dikeud";
- case 0xfee4: return "GDK_Pointer_UpLeft";
- case 0xed4: return "GDK_Hangul_J_Kiyeog";
- case 0xea6: return "GDK_Hangul_NieunHieuh";
- case 0xbcf: return "GDK_circle";
- case 0xff60: return "GDK_Select";
- case 0x04e: return "GDK_N";
- case 0xff62: return "GDK_Execute";
- case 0xff63: return "GDK_Insert";
- case 0xff65: return "GDK_Undo";
- case 0xff66: return "GDK_Redo";
- case 0xff7f: return "GDK_Num_Lock";
- case 0xff68: return "GDK_Find";
- case 0xff69: return "GDK_Cancel";
- case 0x7ef: return "GDK_Greek_omicron";
- case 0x7ea: return "GDK_Greek_kappa";
- case 0x6b7: return "GDK_Ukrainian_YI, GDK_Ukranian_YI";
- case 0x6ac: return "GDK_Macedonia_kje";
- case 0x7eb: return "GDK_Greek_lamda, GDK_Greek_lambda";
- case 0xed5: return "GDK_Hangul_J_SsangKiyeog";
- case 0xdf0: return "GDK_Thai_leksun";
- case 0xea1: return "GDK_Hangul_Kiyeog";
- case 0xaac: return "GDK_signifblank";
- case 0xdd9: return "GDK_Thai_sarauu";
- case 0x7c8: return "GDK_Greek_THETA";
- case 0x2de: return "GDK_Scircumflex";
- case 0x2dd: return "GDK_Ubreve";
- case 0x1a9: return "GDK_Scaron";
- case 0xed2: return "GDK_Hangul_YI";
- case 0xab6: return "GDK_onesixth";
- case 0x1a3: return "GDK_Lstroke";
- case 0x1a2: return "GDK_breve";
- case 0x1a1: return "GDK_Aogonek";
- case 0xed3: return "GDK_Hangul_I";
- case 0x1a6: return "GDK_Sacute";
- case 0x1a5: return "GDK_Lcaron";
- case 0x03d: return "GDK_equal";
- case 0x03e: return "GDK_greater";
- case 0x03f: return "GDK_question";
- case 0xee0: return "GDK_Hangul_J_RieulTieut";
- case 0xee7: return "GDK_Hangul_J_SsangSios";
- case 0x03a: return "GDK_colon";
- case 0x03b: return "GDK_semicolon";
- case 0x03c: return "GDK_less";
- case 0xee9: return "GDK_Hangul_J_Jieuj";
- case 0xffc5: return "GDK_F8";
- case 0x4bf: return "GDK_kana_SO";
- case 0x4be: return "GDK_kana_SE";
- case 0x4bd: return "GDK_kana_SU";
- case 0x4bc: return "GDK_kana_SHI";
- case 0x4bb: return "GDK_kana_SA";
- case 0x4ba: return "GDK_kana_KO";
- case 0xec7: return "GDK_Hangul_O";
- case 0xed7: return "GDK_Hangul_J_Nieun";
- case 0x7ab: return "GDK_Greek_OMEGAaccent";
- case 0x0f4: return "GDK_ocircumflex";
- case 0x1ac: return "GDK_Zacute";
- case 0x1ab: return "GDK_Tcaron";
- case 0x1aa: return "GDK_Scedilla";
- case 0x1af: return "GDK_Zabovedot";
- case 0x1ae: return "GDK_Zcaron";
- case 0x2d8: return "GDK_Gcircumflex";
- case 0x1cc: return "GDK_Ecaron";
- case 0xfe60: return "GDK_dead_belowdot";
- case 0x20a1: return "GDK_ColonSign";
- case 0xed0: return "GDK_Hangul_YU";
- case 0x2d5: return "GDK_Gabovedot";
- case 0x4b7: return "GDK_kana_KI";
- case 0x4b6: return "GDK_kana_KA";
- case 0x4b5: return "GDK_kana_O";
- case 0x4b4: return "GDK_kana_E";
- case 0x4b3: return "GDK_kana_U";
- case 0x4b2: return "GDK_kana_I";
- case 0x4b1: return "GDK_kana_A";
- case 0x4b0: return "GDK_prolongedsound";
- case 0x4b9: return "GDK_kana_KE";
- case 0x4b8: return "GDK_kana_KU";
- case 0x034: return "GDK_4";
- case 0x035: return "GDK_5";
- case 0x036: return "GDK_6";
- case 0x037: return "GDK_7";
- case 0x030: return "GDK_0";
- case 0x031: return "GDK_1";
- case 0x032: return "GDK_2";
- case 0x033: return "GDK_3";
- case 0xed1: return "GDK_Hangul_EU";
- case 0x038: return "GDK_8";
- case 0x3bf: return "GDK_eng";
- case 0xdb2: return "GDK_Thai_thophuthao";
- case 0xab8: return "GDK_careof";
- case 0x8cd: return "GDK_ifonlyif";
- case 0x8ce: return "GDK_implies";
- case 0x8cf: return "GDK_identical";
- case 0xab5: return "GDK_fourfifths";
- case 0xab2: return "GDK_onefifth";
- case 0xab3: return "GDK_twofifths";
- case 0xab0: return "GDK_onethird";
- case 0x07e: return "GDK_asciitilde";
- case 0xff91: return "GDK_KP_F1";
- case 0xffed: return "GDK_Hyper_L";
- case 0xff93: return "GDK_KP_F3";
- case 0xff92: return "GDK_KP_F2";
- case 0xff95: return "GDK_KP_Home";
- case 0xff94: return "GDK_KP_F4";
- case 0xff97: return "GDK_KP_Up";
- case 0xff96: return "GDK_KP_Left";
- case 0xff99: return "GDK_KP_Down";
- case 0xff98: return "GDK_KP_Right";
- case 0x0a4: return "GDK_currency";
- case 0x0a5: return "GDK_yen";
- case 0x0a2: return "GDK_cent";
- case 0x0a3: return "GDK_sterling";
- case 0x0a0: return "GDK_nobreakspace";
- case 0x0a1: return "GDK_exclamdown";
- case 0xde6: return "GDK_Thai_maiyamok";
- case 0xde7: return "GDK_Thai_maitaikhu";
- case 0xde4: return "GDK_Thai_saraaimaimalai";
- case 0x6d4: return "GDK_Cyrillic_te";
- case 0xde2: return "GDK_Thai_sarao";
- case 0xde3: return "GDK_Thai_saraaimaimuan";
- case 0xde0: return "GDK_Thai_sarae";
- case 0xde1: return "GDK_Thai_saraae";
- case 0x7a8: return "GDK_Greek_UPSILONaccent";
- case 0x8b7: return "GDK_rightmiddlesummation";
- case 0xde9: return "GDK_Thai_maitho";
- case 0xff2d: return "GDK_Kana_Lock";
- case 0xff2e: return "GDK_Kana_Shift";
- case 0xff2f: return "GDK_Eisu_Shift";
- case 0xff2a: return "GDK_Zenkaku_Hankaku";
- case 0xff2b: return "GDK_Touroku";
- case 0xff2c: return "GDK_Massyo";
- case 0x7af: return "GDK_Greek_horizbar";
- case 0xff9a: return "GDK_KP_Prior, GDK_KP_Page_Up";
- case 0xffe4: return "GDK_Control_R";
- case 0xff9c: return "GDK_KP_End";
- case 0xff9b: return "GDK_KP_Next, GDK_KP_Page_Down";
- case 0xff9e: return "GDK_KP_Insert";
- case 0xff9d: return "GDK_KP_Begin";
- case 0xffe3: return "GDK_Control_L";
- case 0xff9f: return "GDK_KP_Delete";
- case 0x0af: return "GDK_macron";
- case 0x0ad: return "GDK_hyphen";
- case 0x0ae: return "GDK_registered";
- case 0xffe9: return "GDK_Alt_L";
- case 0xffe8: return "GDK_Meta_R";
- case 0x0aa: return "GDK_ordfeminine";
- case 0xeba: return "GDK_Hangul_Cieuc";
- case 0xda9: return "GDK_Thai_choching";
- case 0xfd0a: return "GDK_3270_PA1";
- case 0x8c9: return "GDK_similarequal";
- case 0xabf: return "GDK_marker";
- case 0x8c5: return "GDK_nabla";
- case 0xabd: return "GDK_decimalpoint";
- case 0xabe: return "GDK_rightanglebracket";
- case 0x8c0: return "GDK_therefore";
- case 0x8c1: return "GDK_variation";
- case 0x8c2: return "GDK_infinity";
- case 0xff24: return "GDK_Romaji";
- case 0xff25: return "GDK_Hiragana";
- case 0xff26: return "GDK_Katakana";
- case 0xff27: return "GDK_Hiragana_Katakana";
- case 0xff20: return "GDK_Multi_key";
- case 0xff21: return "GDK_Kanji";
- case 0xff22: return "GDK_Muhenkan";
- case 0xff23: return "GDK_Henkan_Mode, GDK_Henkan";
- case 0xcdf: return "GDK_hebrew_doublelowline";
- case 0xff28: return "GDK_Zenkaku";
- case 0xff29: return "GDK_Hankaku";
- case 0xded: return "GDK_Thai_nikhahit";
- case 0xdeb: return "GDK_Thai_maichattawa";
- case 0xdec: return "GDK_Thai_thanthakhat";
- case 0xebc: return "GDK_Hangul_Tieut";
- case 0xab7: return "GDK_fivesixths";
- case 0xfed5: return "GDK_Terminate_Server";
- case 0xfed4: return "GDK_Last_Virtual_Screen";
- case 0x6c8: return "GDK_Cyrillic_ha";
- case 0xfed1: return "GDK_Prev_Virtual_Screen";
- case 0xfed0: return "GDK_First_Virtual_Screen";
- case 0xfed2: return "GDK_Next_Virtual_Screen";
- case 0xced: return "GDK_hebrew_finalmem";
- case 0x1e8: return "GDK_ccaron";
- case 0xfe2c: return "GDK_ISO_Fast_Cursor_Left";
- case 0xfe2b: return "GDK_ISO_Release_Both_Margins";
- case 0xfe2a: return "GDK_ISO_Release_Margin_Right";
- case 0x8b4: return "GDK_botvertsummationconnector";
- case 0x1e3: return "GDK_abreve";
- case 0xfe2f: return "GDK_ISO_Fast_Cursor_Down";
- case 0xfe2e: return "GDK_ISO_Fast_Cursor_Up";
- case 0xfe2d: return "GDK_ISO_Fast_Cursor_Right";
- case 0x6a4: return "GDK_Ukrainian_ie, GDK_Ukranian_je";
- case 0x6a5: return "GDK_Macedonia_dse";
- case 0x6a6: return "GDK_Ukrainian_i, GDK_Ukranian_i";
- case 0x6a7: return "GDK_Ukrainian_yi, GDK_Ukranian_yi";
- case 0x7d1: return "GDK_Greek_RHO";
- case 0x6a1: return "GDK_Serbian_dje";
- case 0x6a2: return "GDK_Macedonia_gje";
- case 0x6a3: return "GDK_Cyrillic_io";
- case 0x6a8: return "GDK_Cyrillic_je, GDK_Serbian_je";
- case 0x6a9: return "GDK_Cyrillic_lje, GDK_Serbian_lje";
- case 0xea9: return "GDK_Hangul_Rieul";
- case 0xea8: return "GDK_Hangul_SsangDikeud";
- case 0xdc8: return "GDK_Thai_sosala";
- case 0xeaa: return "GDK_Hangul_RieulKiyeog";
- case 0xff61: return "GDK_Print";
- case 0x3bd: return "GDK_ENG";
- case 0x07a: return "GDK_z";
- case 0x07b: return "GDK_braceleft";
- case 0x07c: return "GDK_bar";
- case 0x07d: return "GDK_braceright";
- case 0x3ba: return "GDK_emacron";
- case 0x3bb: return "GDK_gcedilla";
- case 0x3bc: return "GDK_tslash";
- case 0x5c9: return "GDK_Arabic_tehmarbuta";
- case 0x5c8: return "GDK_Arabic_beh";
- case 0xaae: return "GDK_ellipsis";
- case 0x5c1: return "GDK_Arabic_hamza";
- case 0x5c3: return "GDK_Arabic_hamzaonalef";
- case 0x5c2: return "GDK_Arabic_maddaonalef";
- case 0x5c5: return "GDK_Arabic_hamzaunderalef";
- case 0x5c4: return "GDK_Arabic_hamzaonwaw";
- case 0x5c7: return "GDK_Arabic_alef";
- case 0x5c6: return "GDK_Arabic_hamzaonyeh";
- case 0xdc9: return "GDK_Thai_sorusi";
- case 0x4c0: return "GDK_kana_TA";
- case 0x6af: return "GDK_Cyrillic_dzhe, GDK_Serbian_dze";
- case 0xead: return "GDK_Hangul_RieulSios";
- case 0xeac: return "GDK_Hangul_RieulPieub";
- case 0x6aa: return "GDK_Cyrillic_nje, GDK_Serbian_nje";
- case 0x6ab: return "GDK_Serbian_tshe";
- case 0x4c1: return "GDK_kana_CHI, GDK_kana_TI";
- case 0xba8: return "GDK_downcaret";
- case 0xff67: return "GDK_Menu";
- case 0xadf: return "GDK_emfilledrect";
- case 0x7ee: return "GDK_Greek_xi";
- case 0xfe29: return "GDK_ISO_Release_Margin_Left";
- case 0xfe28: return "GDK_ISO_Set_Margin_Right";
- case 0x7ed: return "GDK_Greek_nu";
- case 0xfe23: return "GDK_ISO_Partial_Line_Up";
- case 0x1ef: return "GDK_dcaron";
- case 0xfe21: return "GDK_ISO_Move_Line_Up";
- case 0xfe20: return "GDK_ISO_Left_Tab";
- case 0xfe27: return "GDK_ISO_Set_Margin_Left";
- case 0xfe26: return "GDK_ISO_Partial_Space_Right";
- case 0xfe25: return "GDK_ISO_Partial_Space_Left";
- case 0xfe24: return "GDK_ISO_Partial_Line_Down";
- case 0xeb0: return "GDK_Hangul_RieulHieuh";
- case 0x4c6: return "GDK_kana_NI";
- case 0xed9: return "GDK_Hangul_J_NieunHieuh";
- case 0x5ca: return "GDK_Arabic_teh";
- case 0x5cc: return "GDK_Arabic_jeem";
- case 0x4c7: return "GDK_kana_NU";
- case 0x5ce: return "GDK_Arabic_khah";
- case 0x5cd: return "GDK_Arabic_hah";
- case 0x5cf: return "GDK_Arabic_dal";
- case 0x078: return "GDK_x";
- case 0x079: return "GDK_y";
- case 0x7ec: return "GDK_Greek_mu";
- case 0x070: return "GDK_p";
- case 0x071: return "GDK_q";
- case 0x072: return "GDK_r";
- case 0x073: return "GDK_s";
- case 0x074: return "GDK_t";
- case 0x075: return "GDK_u";
- case 0x076: return "GDK_v";
- case 0x077: return "GDK_w";
- case 0x0e2: return "GDK_acircumflex";
- case 0x0e3: return "GDK_atilde";
- case 0x0e0: return "GDK_agrave";
- case 0x0e1: return "GDK_aacute";
- case 0x0e6: return "GDK_ae";
- case 0x0e7: return "GDK_ccedilla";
- case 0x0e4: return "GDK_adiaeresis";
- case 0x0e5: return "GDK_aring";
- case 0x0e8: return "GDK_egrave";
- case 0x0e9: return "GDK_eacute";
- case 0xea2: return "GDK_Hangul_SsangKiyeog";
- case 0xfd17: return "GDK_3270_Setup";
- case 0xfd16: return "GDK_3270_Play";
- case 0xfd15: return "GDK_3270_Copy";
- case 0xfd14: return "GDK_3270_Rule";
- case 0xfd13: return "GDK_3270_Ident";
- case 0xfd12: return "GDK_3270_Jump";
- case 0xfd11: return "GDK_3270_KeyClick";
- case 0xfe22: return "GDK_ISO_Move_Line_Down";
- case 0xffaa: return "GDK_KP_Multiply";
- case 0xff3a: return "GDK_Hangul_PreHanja";
- case 0xffac: return "GDK_KP_Separator";
- case 0xffab: return "GDK_KP_Add";
- case 0xffae: return "GDK_KP_Decimal";
- case 0xffad: return "GDK_KP_Subtract";
- case 0xfd19: return "GDK_3270_ChangeScreen";
- case 0xfd18: return "GDK_3270_Record";
- case 0xafb: return "GDK_phonographcopyright";
- case 0x041: return "GDK_A";
- case 0xda8: return "GDK_Thai_chochan";
- case 0xafa: return "GDK_telephonerecorder";
- case 0xaff: return "GDK_cursor";
- case 0xfe58: return "GDK_dead_abovering";
- case 0xfe59: return "GDK_dead_doubleacute";
- case 0xfe56: return "GDK_dead_abovedot";
- case 0x1ec: return "GDK_ecaron";
- case 0xfe54: return "GDK_dead_macron";
- case 0xfe55: return "GDK_dead_breve";
- case 0xfe52: return "GDK_dead_circumflex";
- case 0xfe53: return "GDK_dead_tilde";
- case 0xfe50: return "GDK_dead_grave";
- case 0xfe51: return "GDK_dead_acute";
- case 0xaaa: return "GDK_endash";
- case 0x20a9: return "GDK_WonSign";
- case 0x042: return "GDK_B";
- case 0x1ea: return "GDK_eogonek";
- case 0x20a3: return "GDK_FFrancSign";
- case 0x20a2: return "GDK_CruzeiroSign";
- case 0xebf: return "GDK_Hangul_A";
- case 0xfd1e: return "GDK_3270_Enter";
- case 0xfd1d: return "GDK_3270_PrintScreen";
- case 0xfd1c: return "GDK_3270_CursorSelect";
- case 0xfd1b: return "GDK_3270_ExSelect";
- case 0xfd1a: return "GDK_3270_DeleteWord";
- case 0x3a2: return "GDK_kra, GDK_kappa";
- case 0xffc4: return "GDK_F7";
- case 0x0eb: return "GDK_ediaeresis";
- case 0x0ec: return "GDK_igrave";
- case 0x0ea: return "GDK_ecircumflex";
- case 0x0ef: return "GDK_idiaeresis";
- case 0x0ed: return "GDK_iacute";
- case 0x0ee: return "GDK_icircumflex";
- case 0xee1: return "GDK_Hangul_J_RieulPhieuf";
- case 0xff13: return "GDK_Pause";
- case 0xcf8: return "GDK_hebrew_resh";
- case 0xed8: return "GDK_Hangul_J_NieunJieuj";
- case 0xffc8: return "GDK_F11, GDK_L1";
- case 0x20a4: return "GDK_LiraSign";
- case 0x7d8: return "GDK_Greek_PSI";
- case 0x7d9: return "GDK_Greek_OMEGA";
- case 0x7d6: return "GDK_Greek_PHI";
- case 0xff15: return "GDK_Sys_Req";
- case 0x7d4: return "GDK_Greek_TAU";
- case 0x7d5: return "GDK_Greek_UPSILON";
- case 0x7d2: return "GDK_Greek_SIGMA";
- case 0x7d0: return "GDK_Greek_PI";
- case 0xff14: return "GDK_Scroll_Lock";
- case 0xaf2: return "GDK_doubledagger";
- case 0xaf3: return "GDK_checkmark";
- case 0xaf0: return "GDK_maltesecross";
- case 0xaf1: return "GDK_dagger";
- case 0xaf6: return "GDK_musicalflat";
- case 0xaf7: return "GDK_malesymbol";
- case 0xaf4: return "GDK_ballotcross";
- case 0xaf5: return "GDK_musicalsharp";
- case 0xfe5f: return "GDK_dead_semivoiced_sound";
- case 0xdac: return "GDK_Thai_chochoe";
- case 0xfe5d: return "GDK_dead_iota";
- case 0xfe5e: return "GDK_dead_voiced_sound";
- case 0xfe5b: return "GDK_dead_cedilla";
- case 0xfe5c: return "GDK_dead_ogonek";
- case 0xdad: return "GDK_Thai_yoying";
- case 0xfe5a: return "GDK_dead_caron";
- case 0x8bc: return "GDK_lessthanequal";
- case 0x5cb: return "GDK_Arabic_theh";
- case 0xdf5: return "GDK_Thai_lekha";
- case 0x6e8: return "GDK_Cyrillic_HA";
- case 0x6e9: return "GDK_Cyrillic_I";
- case 0x20a6: return "GDK_NairaSign";
- case 0xee5: return "GDK_Hangul_J_PieubSios";
- case 0x6e0: return "GDK_Cyrillic_YU";
- case 0x6e1: return "GDK_Cyrillic_A";
- case 0x6e2: return "GDK_Cyrillic_BE";
- case 0x6e3: return "GDK_Cyrillic_TSE";
- case 0x6e4: return "GDK_Cyrillic_DE";
- case 0x6e5: return "GDK_Cyrillic_IE";
- case 0x6e6: return "GDK_Cyrillic_EF";
- case 0x6e7: return "GDK_Cyrillic_GHE";
- case 0x8bd: return "GDK_notequal";
- case 0xbc2: return "GDK_downtack";
- case 0xbc3: return "GDK_upshoe";
- case 0xbc0: return "GDK_overbar";
- case 0x3fd: return "GDK_utilde";
- case 0x3fe: return "GDK_umacron";
- case 0xbc4: return "GDK_downstile";
- case 0xaa2: return "GDK_enspace";
- case 0x6be: return "GDK_Byelorussian_SHORTU";
- case 0xede: return "GDK_Hangul_J_RieulPieub";
- case 0x0a8: return "GDK_diaeresis";
- case 0x6bf: return "GDK_Cyrillic_DZHE, GDK_Serbian_DZE";
- case 0x6ba: return "GDK_Cyrillic_NJE, GDK_Serbian_NJE";
- case 0xeda: return "GDK_Hangul_J_Dikeud";
- case 0x6bc: return "GDK_Macedonia_KJE";
- case 0x6bb: return "GDK_Serbian_TSHE";
- case 0x20ab: return "GDK_DongSign";
- case 0xee3: return "GDK_Hangul_J_Mieum";
- case 0x9ef: return "GDK_horizlinescan1";
- case 0x7a1: return "GDK_Greek_ALPHAaccent";
- case 0xee2: return "GDK_Hangul_J_RieulHieuh";
- case 0x6ea: return "GDK_Cyrillic_SHORTI";
- case 0x6eb: return "GDK_Cyrillic_KA";
- case 0x6ec: return "GDK_Cyrillic_EL";
- case 0x6ed: return "GDK_Cyrillic_EM";
- case 0x6ee: return "GDK_Cyrillic_EN";
- case 0x6ef: return "GDK_Cyrillic_O";
- case 0xeb8: return "GDK_Hangul_Jieuj";
- case 0x3b5: return "GDK_itilde";
- case 0x0a9: return "GDK_copyright";
- case 0x3b6: return "GDK_lcedilla";
- case 0xee6: return "GDK_Hangul_J_Sios";
- case 0x3f1: return "GDK_ncedilla";
- case 0x3f2: return "GDK_omacron";
- case 0x3f3: return "GDK_kcedilla";
- case 0x6b9: return "GDK_Cyrillic_LJE, GDK_Serbian_LJE";
- case 0x6b8: return "GDK_Cyrillic_JE, GDK_Serbian_JE";
- case 0xbce: return "GDK_uptack";
- case 0x6b5: return "GDK_Macedonia_DSE";
- case 0x3f9: return "GDK_uogonek";
- case 0xff7e: return "GDK_Mode_switch, GDK_script_switch, GDK_ISO_Group_Shift, GDK_kana_switch, GDK_Arabic_switch, GDK_Greek_switch, GDK_Hebrew_switch, GDK_Hangul_switch";
- case 0x6b6: return "GDK_Ukrainian_I, GDK_Ukranian_I";
- case 0x6b1: return "GDK_Serbian_DJE";
- case 0x6b0: return "GDK_numerosign";
- case 0x6b3: return "GDK_Cyrillic_IO";
- case 0x6b2: return "GDK_Macedonia_GJE";
- case 0x5f2: return "GDK_Arabic_sukun";
- case 0x5f0: return "GDK_Arabic_kasra";
- case 0x5f1: return "GDK_Arabic_shadda";
- case 0xda6: return "GDK_Thai_khorakhang";
- case 0x3b3: return "GDK_rcedilla";
- case 0x9ed: return "GDK_lowleftcorner";
- case 0x2e5: return "GDK_cabovedot";
- case 0x2e6: return "GDK_ccircumflex";
- case 0xdc3: return "GDK_Thai_rorua";
- case 0x0bc: return "GDK_onequarter";
- case 0x0bb: return "GDK_guillemotright";
- case 0x0ba: return "GDK_masculine";
- case 0x0bf: return "GDK_questiondown";
- case 0x0be: return "GDK_threequarters";
- case 0x0bd: return "GDK_onehalf";
- case 0x9f8: return "GDK_vertbar";
- case 0x9f2: return "GDK_horizlinescan7";
- case 0x9f3: return "GDK_horizlinescan9";
- case 0x9f0: return "GDK_horizlinescan3";
- case 0x9f1: return "GDK_horizlinescan5";
- case 0x9f6: return "GDK_bott";
- case 0x9f7: return "GDK_topt";
- case 0x9f4: return "GDK_leftt";
- case 0x9f5: return "GDK_rightt";
- case 0x4de: return "GDK_voicedsound";
- case 0x4dd: return "GDK_kana_N";
- case 0x4c2: return "GDK_kana_TSU, GDK_kana_TU";
- case 0x4c3: return "GDK_kana_TE";
- case 0x4da: return "GDK_kana_RE";
- case 0x4c5: return "GDK_kana_NA";
- case 0x4dc: return "GDK_kana_WA";
- case 0x4db: return "GDK_kana_RO";
- case 0x4c8: return "GDK_kana_NE";
- case 0x4c9: return "GDK_kana_NO";
- case 0xee8: return "GDK_Hangul_J_Ieung";
- case 0x3a5: return "GDK_Itilde";
- case 0x040: return "GDK_at";
- case 0x043: return "GDK_C";
- case 0x3a6: return "GDK_Lcedilla";
- case 0x045: return "GDK_E";
- case 0x044: return "GDK_D";
- case 0x047: return "GDK_G";
- case 0x046: return "GDK_F";
- case 0x049: return "GDK_I";
- case 0x048: return "GDK_H";
- case 0x7a5: return "GDK_Greek_IOTAdiaeresis";
- case 0x7ae: return "GDK_Greek_accentdieresis";
- case 0xdf3: return "GDK_Thai_leksam";
- case 0xaa9: return "GDK_emdash";
- case 0xaa8: return "GDK_hairspace";
- case 0xeec: return "GDK_Hangul_J_Tieut";
- case 0xaa3: return "GDK_em3space";
- case 0x9e4: return "GDK_cr";
- case 0xaa1: return "GDK_emspace";
- case 0xaa7: return "GDK_thinspace";
- case 0xaa6: return "GDK_punctspace";
- case 0xaa5: return "GDK_digitspace";
- case 0xaa4: return "GDK_em4space";
- case 0x0b9: return "GDK_onesuperior";
- case 0x0b8: return "GDK_cedilla";
- case 0x0b3: return "GDK_threesuperior";
- case 0x0b2: return "GDK_twosuperior";
- case 0x0b1: return "GDK_plusminus";
- case 0x0b0: return "GDK_degree";
- case 0x0b7: return "GDK_periodcentered";
- case 0x0b6: return "GDK_paragraph";
- case 0x0b5: return "GDK_mu";
- case 0x0b4: return "GDK_acute";
- case 0x04a: return "GDK_J";
- case 0xdf2: return "GDK_Thai_leksong";
- case 0x04c: return "GDK_L";
- case 0x04b: return "GDK_K";
- case 0x3aa: return "GDK_Emacron";
- case 0x04d: return "GDK_M";
- case 0x3ac: return "GDK_Tslash";
- case 0x3ab: return "GDK_Gcedilla";
- case 0xdf9: return "GDK_Thai_lekkao";
- case 0x04f: return "GDK_O";
- case 0x13bd: return "GDK_oe";
- case 0x13be: return "GDK_Ydiaeresis";
- case 0x4d5: return "GDK_kana_YU";
- case 0x4ca: return "GDK_kana_HA";
- case 0x4cb: return "GDK_kana_HI";
- case 0x4cc: return "GDK_kana_FU, GDK_kana_HU";
- case 0x4d1: return "GDK_kana_MU";
- case 0x4d0: return "GDK_kana_MI";
- case 0x4d3: return "GDK_kana_MO";
- case 0x4d2: return "GDK_kana_ME";
- case 0x7a7: return "GDK_Greek_OMICRONaccent";
- case 0xae0: return "GDK_enopencircbullet";
- case 0x4d9: return "GDK_kana_RU";
- case 0x4d8: return "GDK_kana_RI";
- case 0x6fa: return "GDK_Cyrillic_ZE";
- case 0xeea: return "GDK_Hangul_J_Cieuc";
- case 0x6fc: return "GDK_Cyrillic_E";
- case 0xfeee: return "GDK_Pointer_DblClick_Dflt";
- case 0x6fe: return "GDK_Cyrillic_CHE";
- case 0x6fd: return "GDK_Cyrillic_SHCHA";
- case 0x6ff: return "GDK_Cyrillic_HARDSIGN";
- case 0xbd3: return "GDK_upstile";
- case 0xeb2: return "GDK_Hangul_Pieub";
- case 0xfd10: return "GDK_3270_AltCursor";
- case 0xbd6: return "GDK_downshoe";
- case 0xeb7: return "GDK_Hangul_Ieung";
- case 0xec4: return "GDK_Hangul_E";
- case 0xedc: return "GDK_Hangul_J_RieulKiyeog";
- case 0x1db: return "GDK_Udoubleacute";
- case 0xeb5: return "GDK_Hangul_Sios";
- case 0x1de: return "GDK_Tcedilla";
- case 0x8d6: return "GDK_radical";
- case 0xff33: return "GDK_Hangul_End";
- case 0xff32: return "GDK_Hangul_Start";
- case 0xff31: return "GDK_Hangul";
- case 0xff30: return "GDK_Eisu_toggle";
- case 0xff37: return "GDK_Codeinput, GDK_Kanji_Bangou, GDK_Hangul_Codeinput";
- case 0xff36: return "GDK_Hangul_Romaja";
- case 0xff35: return "GDK_Hangul_Jamo";
- case 0x4d4: return "GDK_kana_YA";
- case 0x5bb: return "GDK_Arabic_semicolon";
- case 0xff39: return "GDK_Hangul_Banja";
- case 0xff38: return "GDK_Hangul_Jeonja";
- case 0x5bf: return "GDK_Arabic_question_mark";
- case 0x4d7: return "GDK_kana_RA";
- case 0x4c4: return "GDK_kana_TO";
- case 0x4d6: return "GDK_kana_YO";
- case 0x7a9: return "GDK_Greek_UPSILONdieresis";
- case 0x4cd: return "GDK_kana_HE";
- case 0xffaf: return "GDK_KP_Divide";
- case 0x4ce: return "GDK_kana_HO";
- case 0x1d8: return "GDK_Rcaron";
- case 0x1d9: return "GDK_Uring";
- case 0x4cf: return "GDK_kana_MA";
- case 0xafc: return "GDK_caret";
- case 0x1d0: return "GDK_Dstroke";
- case 0x1d1: return "GDK_Nacute";
- case 0x1d2: return "GDK_Ncaron";
- case 0x8db: return "GDK_includes";
- case 0x8de: return "GDK_logicaland";
- case 0x1d5: return "GDK_Odoubleacute";
- case 0x9ee: return "GDK_crossinglines";
- case 0x8df: return "GDK_logicalor";
- case 0x6f1: return "GDK_Cyrillic_YA";
- case 0x6f0: return "GDK_Cyrillic_PE";
- case 0x6f3: return "GDK_Cyrillic_ES";
- case 0x6f2: return "GDK_Cyrillic_ER";
- case 0x6f5: return "GDK_Cyrillic_U";
- case 0x6f4: return "GDK_Cyrillic_TE";
- case 0xffff: return "GDK_Delete";
- case 0x6f6: return "GDK_Cyrillic_ZHE";
- case 0x6f9: return "GDK_Cyrillic_YERU";
- case 0x6f8: return "GDK_Cyrillic_SOFTSIGN";
- case 0xbda: return "GDK_leftshoe";
- case 0xeef: return "GDK_Hangul_RieulYeorinHieuh";
- case 0xadc: return "GDK_filledlefttribullet";
- case 0xdbf: return "GDK_Thai_fofan";
- case 0xeb1: return "GDK_Hangul_Mieum";
- case 0xafd: return "GDK_singlelowquotemark";
- case 0xebe: return "GDK_Hangul_Hieuh";
- case 0xafe: return "GDK_doublelowquotemark";
- case 0xff3c: return "GDK_SingleCandidate, GDK_Hangul_SingleCandidate";
- case 0xda2: return "GDK_Thai_khokhai";
- case 0xaaf: return "GDK_doubbaselinedot";
- case 0xff3f: return "GDK_Hangul_Special";
- case 0xff3e: return "GDK_PreviousCandidate, GDK_Mae_Koho, GDK_Hangul_PreviousCandidate";
- case 0xfe57: return "GDK_dead_diaeresis";
- case 0xecf: return "GDK_Hangul_WI";
- case 0x2a9: return "GDK_Iabovedot";
- case 0xdbe: return "GDK_Thai_phophan";
- case 0xda1: return "GDK_Thai_kokai";
- case 0xdbc: return "GDK_Thai_phophung";
- case 0xdbb: return "GDK_Thai_popla";
- case 0xdba: return "GDK_Thai_bobaimai";
- case 0x2fe: return "GDK_scircumflex";
- case 0x2fd: return "GDK_ubreve";
- case 0xeaf: return "GDK_Hangul_RieulPhieuf";
- case 0x2a6: return "GDK_Hcircumflex";
- case 0xda7: return "GDK_Thai_ngongu";
- case 0x6fb: return "GDK_Cyrillic_SHA";
- case 0x1c8: return "GDK_Ccaron";
- case 0x1c5: return "GDK_Lacute";
- case 0x0ff: return "GDK_ydiaeresis";
- case 0x0fe: return "GDK_thorn";
- case 0x0fd: return "GDK_yacute";
- case 0x0fc: return "GDK_udiaeresis";
- case 0x0fb: return "GDK_ucircumflex";
- case 0x0fa: return "GDK_uacute";
- case 0xeff: return "GDK_Korean_Won";
- case 0xda4: return "GDK_Thai_khokhwai";
- case 0xeae: return "GDK_Hangul_RieulTieut";
- case 0xffd5: return "GDK_F24, GDK_R4";
- case 0x20a5: return "GDK_MillSign";
- case 0x3e0: return "GDK_amacron";
- case 0xebd: return "GDK_Hangul_Phieuf";
- case 0x3e7: return "GDK_iogonek";
- case 0x6b4: return "GDK_Ukrainian_IE, GDK_Ukranian_JE";
- case 0x0f9: return "GDK_ugrave";
- case 0x0f8: return "GDK_oslash";
- case 0x0f7: return "GDK_division";
- case 0x0f6: return "GDK_odiaeresis";
- case 0x0f5: return "GDK_otilde";
- case 0x1cf: return "GDK_Dcaron";
- case 0x1ca: return "GDK_Eogonek";
- case 0x0f2: return "GDK_ograve";
- case 0x0f1: return "GDK_ntilde";
- case 0x0f0: return "GDK_eth";
- case 0xdb7: return "GDK_Thai_thothahan";
- case 0xdb6: return "GDK_Thai_thothung";
- case 0xdb5: return "GDK_Thai_totao";
- case 0xdb4: return "GDK_Thai_dodek";
- case 0xdb3: return "GDK_Thai_nonen";
- case 0x2f8: return "GDK_gcircumflex";
- case 0xdb1: return "GDK_Thai_thonangmontho";
- case 0xdb0: return "GDK_Thai_thothan";
- case 0x2f5: return "GDK_gabovedot";
- case 0x2ab: return "GDK_Gbreve";
- case 0x2ac: return "GDK_Jcircumflex";
- case 0xdb9: return "GDK_Thai_nonu";
- case 0xdb8: return "GDK_Thai_thothong";
- case 0x3ec: return "GDK_eabovedot";
- case 0x3ef: return "GDK_imacron";
- case 0x8af: return "GDK_leftmiddlecurlybrace";
- case 0x8ad: return "GDK_toprightparens";
- case 0x8ae: return "GDK_botrightparens";
- case 0x8ab: return "GDK_topleftparens";
- case 0x8ac: return "GDK_botleftparens";
- case 0x8aa: return "GDK_botrightsqbracket";
- case 0xfd0f: return "GDK_3270_CursorBlink";
- case 0xffbd: return "GDK_KP_Equal";
- case 0xffbe: return "GDK_F1";
- case 0xffbf: return "GDK_F2";
- case 0xeeb: return "GDK_Hangul_J_Khieuq";
- case 0xff0b: return "GDK_Clear";
- case 0xff0a: return "GDK_Linefeed";
- case 0xff08: return "GDK_BackSpace";
- case 0xff0d: return "GDK_Return";
- case 0xff09: return "GDK_Tab";
- case 0xae9: return "GDK_filledtribulletdown";
- case 0xae8: return "GDK_filledtribulletup";
- case 0xae7: return "GDK_enfilledsqbullet";
- case 0xae6: return "GDK_enfilledcircbullet";
- case 0xae5: return "GDK_openstar";
- case 0xae4: return "GDK_opentribulletdown";
- case 0xae3: return "GDK_opentribulletup";
- case 0xae2: return "GDK_openrectbullet";
- case 0xae1: return "GDK_enopensquarebullet";
- case 0xffb1: return "GDK_KP_1";
- case 0xeee: return "GDK_Hangul_J_Hieuh";
- case 0x20a0: return "GDK_EcuSign";
- case 0xeed: return "GDK_Hangul_J_Phieuf";
- case 0xbc6: return "GDK_underbar";
- case 0x8a6: return "GDK_vertconnector";
- case 0x8a7: return "GDK_topleftsqbracket";
- case 0x8a4: return "GDK_topintegral";
- case 0x8a5: return "GDK_botintegral";
- case 0x8a2: return "GDK_topleftradical";
- case 0x8a3: return "GDK_horizconnector";
- case 0x8a1: return "GDK_leftradical";
- case 0x8a8: return "GDK_botleftsqbracket";
- case 0x8a9: return "GDK_toprightsqbracket";
- case 0xedb: return "GDK_Hangul_J_Rieul";
- case 0xaee: return "GDK_heart";
- case 0xaed: return "GDK_diamond";
- case 0xaec: return "GDK_club";
- case 0xaeb: return "GDK_rightpointer";
- case 0xaea: return "GDK_leftpointer";
- case 0x039: return "GDK_9";
- case 0xffb4: return "GDK_KP_4";
- case 0xffb5: return "GDK_KP_5";
- case 0xffb6: return "GDK_KP_6";
- case 0xffb7: return "GDK_KP_7";
- case 0xffb0: return "GDK_KP_0";
- case 0x5eb: return "GDK_Arabic_fathatan";
- case 0xffb2: return "GDK_KP_2";
- case 0xffb3: return "GDK_KP_3";
- case 0xffb8: return "GDK_KP_8";
- case 0xffb9: return "GDK_KP_9";
- case 0x7d7: return "GDK_Greek_CHI";
diff --git a/src/matcher.c b/src/matcher.c
index 723cbaa9..fddae0a1 100644
--- a/src/matcher.c
+++ b/src/matcher.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
diff --git a/src/matcher.h b/src/matcher.h
index 540cf97f..6e000733 100644
--- a/src/matcher.h
+++ b/src/matcher.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* The interfaces in this file are subject to change at any time. */
diff --git a/src/mev.c b/src/mev.c
index f6817e11..1bc3b484 100644
--- a/src/mev.c
+++ b/src/mev.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2003 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <config.h>
@@ -42,7 +42,9 @@ static enum {
tracking_mouse = 1000,
tracking_hilite = 1001,
tracking_cell_motion = 1002,
- tracking_all_motion = 1003
+ tracking_all_motion = 1003,
+ tracking_xterm_ext = 1006,
+ tracking_urxvt = 1015
} tracking_mode = 0;
static void
@@ -59,6 +61,8 @@ reset(void)
decset(tracking_hilite, FALSE);
decset(tracking_cell_motion, FALSE);
decset(tracking_all_motion, FALSE);
+ decset(tracking_xterm_ext, FALSE);
+ decset(tracking_urxvt, FALSE);
fflush(stdout);
}
@@ -93,6 +97,14 @@ clear(void)
fprintf(stdout, "All motion tracking enabled.\r\n");
decset(tracking_all_motion, TRUE);
break;
+ case tracking_xterm_ext:
+ fprintf(stdout, "Xterm 1006 mouse tracking extension enabled.\r\n");
+ decset(tracking_xterm_ext, TRUE);
+ break;
+ case tracking_urxvt:
+ fprintf(stdout, "rxvt-unicode 1015 mouse tracking extension enabled.\r\n");
+ decset(tracking_urxvt, TRUE);
+ break;
default:
fprintf(stdout, "Tracking disabled.\r\n");
break;
@@ -102,6 +114,8 @@ clear(void)
fprintf(stdout, "C - Hilite tracking [FIXME: NOT IMPLEMENTED].\r\n");
fprintf(stdout, "D - Cell motion tracking.\r\n");
fprintf(stdout, "E - All motion tracking.\r\n");
+ fprintf(stdout, "F - Xterm 1006 extension.\r\n");
+ fprintf(stdout, "G - rxvt-unicode extension.\r\n");
fprintf(stdout, "%s", _VTE_CAP_ESC "8");
fflush(stdout);
}
@@ -153,6 +167,18 @@ parse(void)
0 : tracking_all_motion;
i++;
break;
+ case 'F':
+ case 'f':
+ tracking_mode = (tracking_mode == tracking_xterm_ext) ?
+ 0 : tracking_xterm_ext;
+ i++;
+ break;
+ case 'G':
+ case 'g':
+ tracking_mode = (tracking_mode == tracking_urxvt) ?
+ 0 : tracking_urxvt;
+ i++;
+ break;
case 'Q':
case 'q':
ret = TRUE;
diff --git a/src/osc b/src/osc
index 1a8d41f4..c7f095c6 100755
--- a/src/osc
+++ b/src/osc
@@ -8,7 +8,18 @@ if [ "$#" -eq 0 ] ; then
echo " 0 'title' change icon name and window title"
echo " 1 'title' change icon name"
echo " 2 'title' change window title"
+ echo " 4 'index;color' change color"
+ echo " 6 'uri' change current file uri"
+ echo " 7 'uri' change current directory uri"
+ echo " 10 'color' change foreground color"
+ echo " 11 'color' change background color"
echo " 12 'color' change cursor color"
+ echo " 17 'color' change highlight background color"
+ echo " 104 'index' reset color (or all colors)"
+ echo " 110 reset foreground color"
+ echo " 111 reset background color"
+ echo " 112 reset cursor color"
+ echo " 117 reset highlight background color"
exit
fi
args=
diff --git a/src/pty.c b/src/pty.c
index a4c8c070..82b15d60 100644
--- a/src/pty.c
+++ b/src/pty.c
@@ -2,19 +2,19 @@
* Copyright (C) 2001,2002 Red Hat, Inc.
* Copyright © 2009, 2010 Christian Persch
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
@@ -33,6 +33,7 @@
#include "vtepty.h"
#include "vtepty-private.h"
#include "vte.h"
+#include "vteversion.h"
#include <sys/types.h>
#include <sys/ioctl.h>
@@ -54,6 +55,9 @@
#include <termios.h>
#endif
#include <unistd.h>
+#ifdef HAVE_UTIL_H
+#include <util.h>
+#endif
#ifdef HAVE_STROPTS_H
#include <stropts.h>
#endif
@@ -81,6 +85,14 @@ static pid_t _vte_pty_helper_pid = -1;
static int _vte_pty_helper_tunnel = -1;
#endif
+#if defined(HAVE_PTSNAME_R) || defined(HAVE_PTSNAME) || defined(TIOCGPTN)
+#define HAVE_UNIX98_PTY
+#else
+#undef HAVE_UNIX98_PTY
+#endif
+
+#define VTE_VERSION_NUMERIC ((VTE_MAJOR_VERSION) * 10000 + (VTE_MINOR_VERSION) * 100 + (VTE_MICRO_VERSION))
+
/* Reset the handlers for all known signals to their defaults. The parent
* (or one of the libraries it links to) may have changed one to be ignored. */
static void
@@ -192,6 +204,9 @@ typedef struct {
const char *name;
int fd;
} tty;
+
+ GSpawnChildSetupFunc extra_child_setup;
+ gpointer extra_child_setup_data;
} VtePtyChildSetupData;
/**
@@ -239,6 +254,7 @@ vte_pty_child_setup (VtePty *pty)
VtePtyChildSetupData *data = &priv->child_setup_data;
int fd = -1;
const char *tty = NULL;
+ char version[7];
if (priv->foreign) {
fd = priv->pty_fd;
@@ -340,6 +356,14 @@ vte_pty_child_setup (VtePty *pty)
if (priv->term != NULL) {
g_setenv("TERM", priv->term, TRUE);
}
+
+ g_snprintf (version, sizeof (version), "%u", VTE_VERSION_NUMERIC);
+ g_setenv ("VTE_VERSION", version, TRUE);
+
+ /* Finally call an extra child setup */
+ if (data->extra_child_setup) {
+ data->extra_child_setup (data->extra_child_setup_data);
+ }
}
/* TODO: clean up the spawning
@@ -347,54 +371,19 @@ vte_pty_child_setup (VtePty *pty)
*/
/*
- * __vte_pty_get_argv:
- * @command: the command to run
- * @argv: the argument vector
- * @flags: (inout) flags from #GSpawnFlags
- *
- * Creates an argument vector to pass to g_spawn_async() from @command and
- * @argv, modifying *@flags if necessary.
- *
- * Returns: a newly allocated array of strings. Free with g_strfreev()
- */
-char **
-__vte_pty_get_argv (const char *command,
- char **argv,
- GSpawnFlags *flags /* inout */)
-{
- char **argv2;
- int i, argc;
-
- g_return_val_if_fail(command != NULL, NULL);
-
- /* push the command into argv[0] */
- argc = argv ? g_strv_length (argv) : 0;
- argv2 = g_new (char *, argc + 2);
-
- argv2[0] = g_strdup (command);
-
- for (i = 0; i < argc; i++) {
- argv2[i+1] = g_strdup (argv[i]);
- }
- argv2[i+1] = NULL;
-
- if (argv) {
- *flags |= G_SPAWN_FILE_AND_ARGV_ZERO;
- }
-
- return argv2;
-}
-
-/*
* __vte_pty_merge_environ:
* @envp: environment vector
+ * @term_value: the value for the TERM env variable, or %NULL
+ * @inherit: whether to use the parent environment
*
* Merges @envp to the parent environment, and returns a new environment vector.
*
* Returns: a newly allocated string array. Free using g_strfreev()
*/
static gchar **
-__vte_pty_merge_environ (char **envp, const char *term_value)
+__vte_pty_merge_environ (char **envp,
+ const char *term_value,
+ gboolean inherit)
{
GHashTable *table;
GHashTableIter iter;
@@ -405,13 +394,15 @@ __vte_pty_merge_environ (char **envp, const char *term_value)
table = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
- parent_environ = g_listenv ();
- for (i = 0; parent_environ[i] != NULL; i++) {
- g_hash_table_replace (table,
- g_strdup (parent_environ[i]),
- g_strdup (g_getenv (parent_environ[i])));
+ if (inherit) {
+ parent_environ = g_listenv ();
+ for (i = 0; parent_environ[i] != NULL; i++) {
+ g_hash_table_replace (table,
+ g_strdup (parent_environ[i]),
+ g_strdup (g_getenv (parent_environ[i])));
+ }
+ g_strfreev (parent_environ);
}
- g_strfreev (parent_environ);
if (envp != NULL) {
for (i = 0; envp[i] != NULL; i++) {
@@ -428,6 +419,8 @@ __vte_pty_merge_environ (char **envp, const char *term_value)
if (term_value != NULL)
g_hash_table_replace (table, g_strdup ("TERM"), g_strdup (term_value));
+ g_hash_table_replace (table, g_strdup ("VTE_VERSION"), g_strdup_printf ("%u", VTE_VERSION_NUMERIC));
+
array = g_ptr_array_sized_new (g_hash_table_size (table) + 1);
g_hash_table_iter_init(&iter, table);
while (g_hash_table_iter_next(&iter, (gpointer) &name, (gpointer) &value)) {
@@ -441,34 +434,6 @@ __vte_pty_merge_environ (char **envp, const char *term_value)
}
/*
- * __vte_pty_get_pty_flags:
- * @lastlog: %TRUE if the session should be logged to the lastlog
- * @utmp: %TRUE if the session should be logged to the utmp/utmpx log
- * @wtmp: %TRUE if the session should be logged to the wtmp/wtmpx log
- *
- * Combines the @lastlog, @utmp, @wtmp arguments into the coresponding
- * #VtePtyFlags flags.
- *
- * Returns: flags from #VtePtyFlags
- */
-VtePtyFlags
-__vte_pty_get_pty_flags(gboolean lastlog,
- gboolean utmp,
- gboolean wtmp)
-{
- VtePtyFlags flags = VTE_PTY_DEFAULT;
-
- if (!lastlog)
- flags |= VTE_PTY_NO_LASTLOG;
- if (!utmp)
- flags |= VTE_PTY_NO_UTMP;
- if (!wtmp)
- flags |= VTE_PTY_NO_WTMP;
-
- return flags;
-}
-
-/*
* __vte_pty_spawn:
* @pty: a #VtePty
* @directory: the name of a directory the command should start in, or %NULL
@@ -508,7 +473,10 @@ __vte_pty_spawn (VtePty *pty,
GPid *child_pid /* out */,
GError **error)
{
+ VtePtyPrivate *priv = pty->priv;
+ VtePtyChildSetupData *data = &priv->child_setup_data;
gboolean ret = TRUE;
+ gboolean inherit_envv;
char **envp2;
gint i;
GError *err = NULL;
@@ -520,8 +488,11 @@ __vte_pty_spawn (VtePty *pty,
*/
spawn_flags &= ~G_SPAWN_LEAVE_DESCRIPTORS_OPEN;
+ inherit_envv = (spawn_flags & VTE_SPAWN_NO_PARENT_ENVV) == 0;
+ spawn_flags &= ~VTE_SPAWN_NO_PARENT_ENVV;
+
/* add the given environment to the childs */
- envp2 = __vte_pty_merge_environ (envv, pty->priv->term);
+ envp2 = __vte_pty_merge_environ (envv, pty->priv->term, inherit_envv);
_VTE_DEBUG_IF (VTE_DEBUG_MISC) {
g_printerr ("Spawing command:\n");
@@ -535,12 +506,14 @@ __vte_pty_spawn (VtePty *pty,
directory ? directory : "(none)");
}
+ data->extra_child_setup = child_setup;
+ data->extra_child_setup_data = child_setup_data;
+
ret = g_spawn_async_with_pipes(directory,
argv, envp2,
spawn_flags,
- child_setup ? child_setup
- : (GSpawnChildSetupFunc) vte_pty_child_setup,
- child_setup ? child_setup_data : pty,
+ (GSpawnChildSetupFunc) vte_pty_child_setup,
+ pty,
child_pid,
NULL, NULL, NULL,
&err);
@@ -552,9 +525,8 @@ __vte_pty_spawn (VtePty *pty,
ret = g_spawn_async_with_pipes(NULL,
argv, envp2,
spawn_flags,
- child_setup ? child_setup
- : (GSpawnChildSetupFunc) vte_pty_child_setup,
- child_setup ? child_setup_data : pty,
+ (GSpawnChildSetupFunc) vte_pty_child_setup,
+ pty,
child_pid,
NULL, NULL, NULL,
&err);
@@ -562,6 +534,9 @@ __vte_pty_spawn (VtePty *pty,
g_strfreev (envp2);
+ data->extra_child_setup = NULL;
+ data->extra_child_setup_data = NULL;
+
if (ret)
return TRUE;
@@ -569,48 +544,6 @@ __vte_pty_spawn (VtePty *pty,
return FALSE;
}
-/*
- * __vte_pty_fork:
- * @pty: a #VtePty
- * @pid: (out) a location to store a #GPid, or %NULL
- * @error: a location to store a #GError, or %NULL
- *
- * Forks and calls vte_pty_child_setup() in the child.
- *
- * Returns: %TRUE on success, or %FALSE on failure with @error filled in
- */
-gboolean
-__vte_pty_fork(VtePty *pty,
- GPid *pid,
- GError **error)
-{
-#ifdef HAVE_FORK
- gboolean ret = TRUE;
-
- *pid = fork();
- switch (*pid) {
- case -1:
- g_set_error(error,
- G_SPAWN_ERROR,
- G_SPAWN_ERROR_FAILED,
- "Unable to fork: %s",
- g_strerror(errno));
- ret = FALSE;
- case 0: /* child */
- vte_pty_child_setup(pty);
- break;
- default: /* parent */
- break;
- }
-
- return ret;
-#else /* !HAVE_FORK */
- g_set_error_literal(error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED,
- "No fork implementation");
- return FALSE;
-#endif /* HAVE_FORK */
-}
-
/**
* vte_pty_set_size:
* @pty: a #VtePty
@@ -633,15 +566,12 @@ vte_pty_set_size(VtePty *pty,
int columns,
GError **error)
{
- VtePtyPrivate *priv;
struct winsize size;
int master;
int ret;
g_return_val_if_fail(VTE_IS_PTY(pty), FALSE);
- priv = pty->priv;
-
master = vte_pty_get_fd(pty);
memset(&size, 0, sizeof(size));
@@ -692,15 +622,12 @@ vte_pty_get_size(VtePty *pty,
int *columns,
GError **error)
{
- VtePtyPrivate *priv;
struct winsize size;
int master;
int ret;
g_return_val_if_fail(VTE_IS_PTY(pty), FALSE);
- priv = pty->priv;
-
master = vte_pty_get_fd(pty);
memset(&size, 0, sizeof(size));
@@ -734,6 +661,8 @@ vte_pty_get_size(VtePty *pty,
}
}
+#if defined(HAVE_UNIX98_PTY)
+
/*
* _vte_pty_ptsname:
* @master: file descriptor to the PTY master
@@ -812,7 +741,9 @@ static int
_vte_pty_getpt(GError **error)
{
int fd, flags, rv;
-#ifdef HAVE_GETPT
+#if defined(HAVE_POSIX_OPENPT)
+ fd = posix_openpt(O_RDWR | O_NOCTTY);
+#elif defined(HAVE_GETPT)
/* Call the system's function for allocating a pty. */
fd = getpt();
#else
@@ -951,6 +882,44 @@ _vte_pty_open_unix98(VtePty *pty,
return TRUE;
}
+#elif defined(HAVE_OPENPTY)
+
+/*
+ * _vte_pty_open_bsd:
+ * @pty: a #VtePty
+ * @error: a location to store a #GError, or %NULL
+ *
+ * Opens new file descriptors to a new PTY master and slave.
+ *
+ * Returns: %TRUE on success, %FALSE on failure with @error filled in
+ */
+static gboolean
+_vte_pty_open_bsd(VtePty *pty,
+ GError **error)
+{
+ VtePtyPrivate *priv = pty->priv;
+ int parentfd, childfd;
+
+ if (openpty(&parentfd, &childfd, NULL, NULL, NULL) != 0) {
+ int errsv = errno;
+ g_set_error(error, VTE_PTY_ERROR, VTE_PTY_ERROR_PTY98_FAILED,
+ "%s failed: %s", "openpty", g_strerror(errsv));
+ errno = errsv;
+ return FALSE;
+ }
+
+ priv->pty_fd = parentfd;
+ priv->child_setup_data.mode = TTY_OPEN_BY_FD;
+ priv->child_setup_data.tty.fd = childfd;
+ priv->using_helper = FALSE;
+
+ return TRUE;
+}
+
+#else
+#error Have neither UNIX98 PTY nor BSD openpty!
+#endif /* HAVE_UNIX98_PTY */
+
#ifdef VTE_USE_GNOME_PTY_HELPER
#ifdef HAVE_RECVMSG
static void
@@ -1511,7 +1480,7 @@ vte_pty_initable_init (GInitable *initable,
}
g_error_free(err);
- /* Fall back to unix98 PTY */
+ /* Fall back to unix98 or bsd PTY */
}
#else
if (priv->flags & VTE_PTY_NO_FALLBACK) {
@@ -1521,7 +1490,13 @@ vte_pty_initable_init (GInitable *initable,
}
#endif /* VTE_USE_GNOME_PTY_HELPER */
+#if defined(HAVE_UNIX98_PTY)
ret = _vte_pty_open_unix98(pty, error);
+#elif defined(HAVE_OPENPTY)
+ ret = _vte_pty_open_bsd(pty, error);
+#else
+#error Have neither UNIX98 PTY nor BSD openpty!
+#endif
out:
_vte_debug_print(VTE_DEBUG_PTY,
@@ -1554,7 +1529,7 @@ vte_pty_init (VtePty *pty)
priv->foreign = FALSE;
priv->using_helper = FALSE;
priv->helper_tag = NULL;
- priv->term = vte_terminal_get_default_emulation(NULL /* that's ok, this function is just retarded */); /* already interned */
+ priv->term = vte_get_default_emulation(); /* already interned */
}
static void
@@ -1720,8 +1695,9 @@ vte_pty_error_quark(void)
}
/**
- * vte_pty_new:
+ * vte_pty_new_sync:
* @flags: flags from #VtePtyFlags
+ * @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: (allow-none): return location for a #GError, or %NULL
*
* Allocates a new pseudo-terminal.
@@ -1734,6 +1710,11 @@ vte_pty_error_quark(void)
* If using g_spawn_async() and friends, you MUST either use
* vte_pty_child_setup() directly as the child setup function, or call
* vte_pty_child_setup() from your own child setup function supplied.
+ *
+ * When using vte_terminal_fork_command_full() with a custom child setup
+ * function, vte_pty_child_setup() will be called before the supplied
+ * function; you must not call it again.
+ *
* Also, you MUST pass the %G_SPAWN_DO_NOT_REAP_CHILD flag.
*
* If GNOME PTY Helper is available and
@@ -1752,19 +1733,21 @@ vte_pty_error_quark(void)
* Since: 0.26
*/
VtePty *
-vte_pty_new (VtePtyFlags flags,
- GError **error)
+vte_pty_new_sync (VtePtyFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
return g_initable_new (VTE_TYPE_PTY,
- NULL /* cancellable */,
+ cancellable,
error,
"flags", flags,
NULL);
}
/**
- * vte_pty_new_foreign:
+ * vte_pty_new_foreign_sync:
* @fd: (transfer full): a file descriptor to the PTY
+ * @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: (allow-none): return location for a #GError, or %NULL
*
* Creates a new #VtePty for the PTY master @fd.
@@ -1779,13 +1762,14 @@ vte_pty_new (VtePtyFlags flags,
* Since: 0.26
*/
VtePty *
-vte_pty_new_foreign (int fd,
- GError **error)
+vte_pty_new_foreign_sync (int fd,
+ GCancellable *cancellable,
+ GError **error)
{
g_return_val_if_fail(fd >= 0, NULL);
return g_initable_new (VTE_TYPE_PTY,
- NULL /* cancellable */,
+ cancellable,
error,
"fd", fd,
NULL);
@@ -1837,216 +1821,3 @@ vte_pty_set_term (VtePty *pty,
priv->term = emulation;
g_object_notify(G_OBJECT(pty), "term");
}
-
-/* Reimplementation of the ugly deprecated APIs _vte_pty_*() */
-
-#ifndef VTE_DISABLE_DEPRECATED_SOURCE
-
-static GHashTable *fd_to_pty_hash = NULL;
-
-static VtePty *
-get_vte_pty_for_fd (int fd)
-{
- VtePty *pty;
-
- if (fd_to_pty_hash != NULL &&
- (pty = g_hash_table_lookup(fd_to_pty_hash, &fd)) != NULL)
- return pty;
-
- g_warning("No VtePty found for fd %d!\n", fd);
- return NULL;
-}
-
-/**
- * _vte_pty_open:
- * @child: location to store the new process's ID
- * @env_add: a list of environment variables to add to the child's environment
- * @command: name of the binary to run
- * @argv: arguments to pass to @command
- * @directory: directory to start the new command in, or %NULL
- * @columns: desired window columns
- * @rows: desired window rows
- * @lastlog: %TRUE if the lastlog should be updated
- * @utmp: %TRUE if the utmp or utmpx log should be updated
- * @wtmp: %TRUE if the wtmp or wtmpx log should be updated
- *
- * Starts a new copy of @command running under a psuedo-terminal, optionally in
- * the supplied @directory, with window size set to @rows x @columns
- * and variables in @env_add added to its environment. If any combination of
- * @lastlog, @utmp, and @wtmp is set, then the session is logged in the
- * corresponding system files.
- *
- * Returns: an open file descriptor for the pty master, -1 on failure
- *
- * Deprecated: 0.26: Use #VtePty together with fork() or the g_spawn_async() family of functions instead
- */
-int
-_vte_pty_open(pid_t *child,
- char **env_add,
- const char *command,
- char **argv,
- const char *directory,
- int columns,
- int rows,
- gboolean lastlog,
- gboolean utmp,
- gboolean wtmp)
-{
- VtePty *pty;
- GPid pid;
- gboolean ret;
-
- pty = vte_pty_new(__vte_pty_get_pty_flags (lastlog, utmp, wtmp), NULL);
- if (pty == NULL)
- return -1;
-
- if (command != NULL) {
- char **real_argv;
- GSpawnFlags spawn_flags;
-
- spawn_flags = G_SPAWN_CHILD_INHERITS_STDIN |
- G_SPAWN_SEARCH_PATH;
- real_argv = __vte_pty_get_argv(command, argv, &spawn_flags);
- ret = __vte_pty_spawn(pty,
- directory,
- real_argv,
- env_add,
- spawn_flags,
- NULL, NULL,
- &pid,
- NULL);
- g_strfreev(real_argv);
- } else {
- ret = __vte_pty_fork(pty, &pid, NULL);
- }
-
- if (!ret) {
- g_object_unref(pty);
- return -1;
- }
-
- vte_pty_set_size(pty, rows, columns, NULL);
-
- /* Stash the pty in the hash so we can later retrieve it by FD */
- if (fd_to_pty_hash == NULL) {
- fd_to_pty_hash = g_hash_table_new_full(g_int_hash,
- g_int_equal,
- NULL,
- (GDestroyNotify) g_object_unref);
- }
-
- g_hash_table_insert(fd_to_pty_hash, &pty->priv->pty_fd, pty /* adopt refcount */);
-
- if (child)
- *child = (pid_t) pid;
-
- return vte_pty_get_fd(pty);
-}
-
-/**
- * _vte_pty_get_size:
- * @master: the file descriptor of the PTY master
- * @columns: a place to store the number of columns
- * @rows: a place to store the number of rows
- *
- * Attempts to read the pseudo terminal's window size.
- *
- * Returns: 0 on success, -1 on failure.
- *
- * Deprecated: 0.26: Use #VtePty and vte_pty_get_size() instead
- */
-int
-_vte_pty_get_size(int master,
- int *columns,
- int *rows)
-{
- VtePty *pty;
-
- if ((pty = get_vte_pty_for_fd(master)) == NULL)
- return -1;
-
- if (vte_pty_get_size(pty, rows, columns, NULL))
- return 0;
-
- return -1;
-}
-
-/**
- * _vte_pty_set_size:
- * @master: the file descriptor of the PTY master
- * @columns: the desired number of columns
- * @rows: the desired number of rows
- *
- * Attempts to resize the pseudo terminal's window size. If successful, the
- * OS kernel will send #SIGWINCH to the child process group.
- *
- * Returns: 0 on success, -1 on failure.
- *
- * Deprecated: 0.26: Use #VtePty and vte_pty_set_size() instead
- */
-int
-_vte_pty_set_size(int master,
- int columns,
- int rows)
-{
- VtePty *pty;
-
- if ((pty = get_vte_pty_for_fd(master)) == NULL)
- return -1;
-
- if (vte_pty_set_size(pty, rows, columns, NULL))
- return 0;
-
- return -1;
-}
-
-/**
- * _vte_pty_set_utf8:
- * @pty: The pty master descriptor.
- * @utf8: Whether or not the pty is in UTF-8 mode.
- *
- * Tells the kernel whether the terminal is UTF-8 or not, in case it can make
- * use of the info. Linux 2.6.5 or so defines IUTF8 to make the line
- * discipline do multibyte backspace correctly.
- *
- * Deprecated: 0.26: Use #VtePty and vte_pty_set_utf8() instead
- */
-void _vte_pty_set_utf8(int master,
- gboolean utf8)
-{
- VtePty *pty;
-
- if ((pty = get_vte_pty_for_fd(master)) == NULL)
- return;
-
- vte_pty_set_utf8(pty, utf8, NULL);
-}
-
-/**
- * _vte_pty_close:
- * @pty: the pty master descriptor.
- *
- * Cleans up the PTY associated with the descriptor, specifically any logging
- * performed for the session. The descriptor itself remains open.
- *
- * Deprecated: 0.26: Use #VtePty and vte_pty_close() instead
- */
-void _vte_pty_close(int master)
-{
- VtePty *pty;
-
- if ((pty = get_vte_pty_for_fd(master)) == NULL)
- return;
-
- /* Prevent closing the FD */
- pty->priv->pty_fd = -1;
-
- g_hash_table_remove(fd_to_pty_hash, &master);
-
- if (g_hash_table_size(fd_to_pty_hash) == 0) {
- g_hash_table_destroy(fd_to_pty_hash);
- fd_to_pty_hash = NULL;
- }
-}
-
-#endif /* !VTE_DISABLE_DEPRECATED_SOURCE */
diff --git a/src/pty.h b/src/pty.h
deleted file mode 100644
index 726d6394..00000000
--- a/src/pty.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2001,2002 Red Hat, Inc.
- *
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef VTE_DISABLE_DEPRECATED
-
-#ifndef vte_pty_h_included
-#define vte_pty_h_included
-
-#include <sys/types.h>
-
-G_BEGIN_DECLS
-
-/* 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. */
-int _vte_pty_open(pid_t *child, char **env_add,
- const char *command, char **argv, const char *directory,
- int columns, int rows,
- gboolean lastlog, gboolean utmp, gboolean wtmp);
-
-/* Set or read the size of a terminal. Returns 0 on success, -1 on failure,
- * with errno set to defined return codes from ioctl(). */
-int _vte_pty_get_size(int master, int *columns, int *rows);
-int _vte_pty_set_size(int master, int columns, int rows);
-
-/* Try to let the kernel know that the terminal is or is not UTF-8. */
-void _vte_pty_set_utf8(int pty, gboolean utf8);
-
-/* Close a pty. */
-void _vte_pty_close(int pty);
-
-G_END_DECLS
-
-#endif /* vte_pty_h_included */
-
-#endif /* !VTE_DISABLE_DEPRECATED */
diff --git a/src/reaper.c b/src/reaper.c
deleted file mode 100644
index 35ae4880..00000000
--- a/src/reaper.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (C) 2002 Red Hat, Inc.
- *
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/**
- * SECTION: vte-reaper
- * @short_description: A singleton object which catches %SIGCHLD signals and
- * converts them into GObject-style &quot;child-exited&quot; signals
- *
- * Because an application may need to be notified when child processes
- * exit, and because there is only one %SIGCHLD handler, the #VteTerminal
- * widget relies on a #VteReaper to watch for %SIGCHLD notifications and
- * retrieve the exit status of child processes which have exited. When
- * glib provides child_watch functionality, the #VteReaper merely acts as
- * a proxy for glib's own functionality.
- *
- * Since 0.11.11
- */
-
-#include <config.h>
-
-#include "debug.h"
-#include "marshal.h"
-#include "reaper.h"
-
-static VteReaper *singleton_reaper = NULL;
-
-G_DEFINE_TYPE(VteReaper, vte_reaper, G_TYPE_OBJECT)
-
-static void
-vte_reaper_child_watch_cb(GPid pid, gint status, gpointer data)
-{
- _vte_debug_print(VTE_DEBUG_SIGNALS,
- "Reaper emitting child-exited signal.\n");
- g_signal_emit_by_name(data, "child-exited", pid, status);
- g_spawn_close_pid (pid);
-}
-
-/**
- * vte_reaper_add_child:
- * @pid: the ID of a child process which will be monitored
- *
- * Ensures that child-exited signals will be emitted when @pid exits. This is
- * necessary for correct operation when running with glib versions >= 2.4.
- *
- * Returns: the new source ID
- *
- * Since 0.11.11
- */
-int
-vte_reaper_add_child(GPid pid)
-{
- return g_child_watch_add_full(G_PRIORITY_LOW,
- pid,
- vte_reaper_child_watch_cb,
- vte_reaper_get(),
- (GDestroyNotify)g_object_unref);
-}
-
-static void
-vte_reaper_init(VteReaper *reaper)
-{
-}
-
-static GObject*
-vte_reaper_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam *construct_properties)
-{
- if (singleton_reaper) {
- return g_object_ref (singleton_reaper);
- } else {
- GObject *obj;
- obj = G_OBJECT_CLASS (vte_reaper_parent_class)->constructor (type, n_construct_properties, construct_properties);
- singleton_reaper = VTE_REAPER (obj);
- return obj;
- }
-}
-
-
-static void
-vte_reaper_finalize(GObject *reaper)
-{
- G_OBJECT_CLASS(vte_reaper_parent_class)->finalize(reaper);
- singleton_reaper = NULL;
-}
-
-static void
-vte_reaper_class_init(VteReaperClass *klass)
-{
- GObjectClass *gobject_class;
-
- /**
- * VteReaper::child-exited:
- * @vtereaper: the object which received the signal
- * @arg1: the process ID of the exited child
- * @arg2: the status of the exited child, as returned by waitpid()
- *
- * Emitted when the #VteReaper object detects that a child of the
- * current process has exited.
- *
- * Since: 0.11.11
- */
- klass->child_exited_signal = g_signal_new(g_intern_static_string("child-exited"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL,
- NULL,
- _vte_marshal_VOID__INT_INT,
- G_TYPE_NONE,
- 2, G_TYPE_INT, G_TYPE_INT);
-
- gobject_class = G_OBJECT_CLASS(klass);
- gobject_class->constructor = vte_reaper_constructor;
- gobject_class->finalize = vte_reaper_finalize;
-}
-
-/**
- * vte_reaper_get:
- *
- * Finds the address of the global #VteReaper object, creating the object if
- * necessary.
- *
- * Returns: the global #VteReaper object, which should not be unreffed.
- */
-VteReaper *
-vte_reaper_get(void)
-{
- return g_object_new(VTE_TYPE_REAPER, NULL);
-}
-
-#ifdef REAPER_MAIN
-
-#include <unistd.h>
-
-GMainContext *context;
-GMainLoop *loop;
-pid_t child;
-
-static void
-child_exited(GObject *object, int pid, int status, gpointer data)
-{
- g_print("[parent] Child with pid %d exited with code %d, "
- "was waiting for %d.\n", pid, status, GPOINTER_TO_INT(data));
- if (child == pid) {
- g_print("[parent] Quitting.\n");
- g_main_loop_quit(loop);
- }
-}
-
-int
-main(int argc, char **argv)
-{
- VteReaper *reaper;
- pid_t p, q;
-
- _vte_debug_init();
-
- g_type_init();
- context = g_main_context_default();
- loop = g_main_loop_new(context, FALSE);
- reaper = vte_reaper_get();
-
- g_print("[parent] Forking.\n");
- p = fork();
- switch (p) {
- case -1:
- g_print("[parent] Fork failed.\n");
- g_assert_not_reached();
- break;
- case 0:
- g_print("[child] Going to sleep.\n");
- sleep(10);
- g_print("[child] Quitting.\n");
- _exit(30);
- break;
- default:
- g_print("[parent] Starting to wait for %d.\n", p);
- child = p;
- g_signal_connect(reaper,
- "child-exited",
- G_CALLBACK(child_exited),
- GINT_TO_POINTER(child));
- break;
- }
-
- g_print("[parent] Forking.\n");
- q = fork();
- switch (q) {
- case -1:
- g_print("[parent] Fork failed.\n");
- g_assert_not_reached();
- break;
- case 0:
- g_print("[child] Going to sleep.\n");
- sleep(5);
- _exit(5);
- break;
- default:
- g_print("[parent] Not waiting for %d.\n", q);
- break;
- }
-
-
- g_main_loop_run(loop);
-
- g_object_unref(reaper);
-
- return 0;
-}
-#endif
diff --git a/src/reaper.h b/src/reaper.h
deleted file mode 100644
index d67498e6..00000000
--- a/src/reaper.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2002 Red Hat, Inc.
- *
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef VTE_DISABLE_DEPRECATED
-
-#ifndef vte_reaper_h_included
-#define vte_reaper_h_included
-
-#include <sys/wait.h>
-#include <signal.h>
-#include <glib.h>
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-/**
- * VteReaper:
- *
- * The reaper object.
- */
-struct _VteReaper {
- GObject object;
-
- /*< private >*/
- GIOChannel *_channel; /* unused */
- int _iopipe[2]; /* unused */
-};
-typedef struct _VteReaper VteReaper;
-
-struct _VteReaperClass {
- GObjectClass parent_class;
- /*< private >*/
- guint child_exited_signal;
-};
-typedef struct _VteReaperClass VteReaperClass;
-
-GType vte_reaper_get_type(void);
-
-#define VTE_TYPE_REAPER (vte_reaper_get_type())
-#define VTE_REAPER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
- VTE_TYPE_REAPER, \
- VteReaper))
-#define VTE_REAPER_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), \
- VTE_TYPE_REAPER, \
- VteReaperClass)
-#define VTE_IS_REAPER(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), VTE_TYPE_REAPER)
-#define VTE_IS_REAPER_CLASS(klass) G_TYPE_CHECK_CLASS_TYPE((klass), \
- VTE_TYPE_REAPER)
-#define VTE_REAPER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \
- VTE_TYPE_REAPER, \
- VteReaperClass))
-
-VteReaper *vte_reaper_get(void);
-int vte_reaper_add_child(GPid pid);
-
-G_END_DECLS
-
-#endif
-
-#endif /* !VTE_DISABLE_DEPRECATED */
diff --git a/src/reflect.c b/src/reflect.c
index 6d43649c..102663e6 100644
--- a/src/reflect.c
+++ b/src/reflect.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2003 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <config.h>
@@ -48,11 +48,7 @@ terminal_shell_text_view(GtkWidget *widget)
static GtkAdjustment *
terminal_adjustment_text_view(GtkWidget *terminal)
{
-#if GTK_CHECK_VERSION (2, 21, 6)
return gtk_text_view_get_vadjustment(GTK_TEXT_VIEW(terminal));
-#else
- return GTK_TEXT_VIEW(terminal)->vadjustment;
-#endif
}
#endif
#ifdef USE_VTE
@@ -71,19 +67,19 @@ terminal_init_vte(GtkWidget **terminal)
static void
terminal_shell_vte(GtkWidget *terminal)
{
- vte_terminal_fork_command(VTE_TERMINAL(terminal),
- getenv("SHELL") ? getenv("SHELL") : "/bin/sh",
- NULL,
- NULL,
- g_get_home_dir() ? g_get_home_dir() : NULL,
- FALSE,
- FALSE,
- FALSE);
-}
-static GtkAdjustment *
-terminal_adjustment_vte(GtkWidget *terminal)
-{
- return (VTE_TERMINAL(terminal))->adjustment;
+ char *argv[2];
+
+ argv[0] = vte_get_user_shell ();
+ argv[1] = NULL;
+ vte_terminal_spawn_sync(VTE_TERMINAL(terminal),
+ VTE_PTY_DEFAULT,
+ g_get_home_dir() ? g_get_home_dir() : NULL,
+ argv,
+ NULL,
+ 0, NULL, NULL,
+ NULL,
+ NULL,
+ NULL);
}
#endif
@@ -237,7 +233,7 @@ terminal_adjustment(GtkWidget *terminal)
return terminal_adjustment_text_view(terminal);
#endif
#ifdef USE_VTE
- return terminal_adjustment_vte(terminal);
+ return gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(terminal));
#endif
g_assert_not_reached();
}
@@ -284,11 +280,7 @@ main(int argc, char **argv)
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), label);
gtk_widget_show(label);
-#if GTK_CHECK_VERSION (2, 91, 2)
pane = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
-#else
- pane = gtk_vpaned_new();
-#endif
gtk_paned_pack1(GTK_PANED(pane), tophalf, TRUE, FALSE);
gtk_paned_pack2(GTK_PANED(pane), sw, TRUE, FALSE);
gtk_widget_show(tophalf);
diff --git a/src/ring.c b/src/ring.c
index db4edecc..267be8b7 100644
--- a/src/ring.c
+++ b/src/ring.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2002,2009,2010 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Red Hat Author(s): Nalin Dahyabhai, Behdad Esfahbod
*/
@@ -35,8 +35,8 @@ _vte_ring_validate (VteRing * ring)
{
g_assert(ring != NULL);
_vte_debug_print(VTE_DEBUG_RING,
- " Delta = %lu, Length = %lu, Max = %lu, Writable = %lu.\n",
- ring->start, ring->end - ring->start,
+ " Delta = %lu, Length = %lu, Next = %lu, Max = %lu, Writable = %lu.\n",
+ ring->start, ring->end - ring->start, ring->end,
ring->max, ring->end - ring->writable);
g_assert (ring->start <= ring->writable);
@@ -66,13 +66,15 @@ _vte_ring_init (VteRing *ring, gulong max_rows)
ring->text_stream = _vte_file_stream_new ();
ring->row_stream = _vte_file_stream_new ();
- ring->last_attr.text_offset = 0;
- ring->last_attr.attr.i = basic_cell.i.attr;
+ ring->last_attr_text_start_offset = 0;
+ ring->last_attr.i = basic_cell.i.attr;
ring->utf8_buffer = g_string_sized_new (128);
_vte_row_data_init (&ring->cached_row);
ring->cached_row_num = (gulong) -1;
+ ring->visible_rows_hint = 0;
+
_vte_ring_validate(ring);
}
@@ -96,10 +98,19 @@ _vte_ring_fini (VteRing *ring)
}
typedef struct _VteRowRecord {
- gsize text_offset;
- gsize attr_offset;
+ gsize text_start_offset; /* offset where text of this row begins */
+ gsize attr_start_offset; /* offset of the first character's attributes */
+ int soft_wrapped: 1; /* end of line is not '\n' */
+ int is_ascii: 1; /* for rewrapping speedup: guarantees that line contains 32..126 bytes only. Can be 0 even when ascii only. */
} VteRowRecord;
+/* Represents a cell position, see ../doc/rewrap.txt */
+typedef struct _VteCellTextOffset {
+ gsize text_offset; /* byte offset in text_stream (or perhaps beyond) */
+ gint fragment_cells; /* extra number of cells to walk within a multicell character */
+ gint eol_cells; /* -1 if over a character, >=0 if at EOL or beyond */
+} VteCellTextOffset;
+
static gboolean
_vte_ring_read_row_record (VteRing *ring, VteRowRecord *record, gulong position)
{
@@ -122,8 +133,10 @@ _vte_ring_freeze_row (VteRing *ring, gulong position, const VteRowData *row)
_vte_debug_print (VTE_DEBUG_RING, "Freezing row %lu.\n", position);
- record.text_offset = _vte_stream_head (ring->text_stream);
- record.attr_offset = _vte_stream_head (ring->attr_stream);
+ memset(&record, 0, sizeof (record));
+ record.text_start_offset = _vte_stream_head (ring->text_stream);
+ record.attr_start_offset = _vte_stream_head (ring->attr_stream);
+ record.is_ascii = 1;
g_string_set_size (buffer, 0);
for (i = 0, cell = row->cells; i < row->len; i++, cell++) {
@@ -143,30 +156,39 @@ _vte_ring_freeze_row (VteRing *ring, gulong position, const VteRowData *row)
*/
attr.s = cell->attr;
if (G_LIKELY (!attr.s.fragment)) {
-
- if (ring->last_attr.attr.i != attr.i) {
- ring->last_attr.text_offset = record.text_offset + buffer->len;
- _vte_stream_append (ring->attr_stream, (const char *) &ring->last_attr, sizeof (ring->last_attr));
+ VteCellAttrChange attr_change;
+
+ if (ring->last_attr.i != attr.i) {
+ ring->last_attr_text_start_offset = record.text_start_offset + buffer->len;
+ memset(&attr_change, 0, sizeof (attr_change));
+ attr_change.text_end_offset = ring->last_attr_text_start_offset;
+ attr_change.attr = ring->last_attr;
+ _vte_stream_append (ring->attr_stream, (const char *) &attr_change, sizeof (attr_change));
if (!buffer->len)
/* This row doesn't use last_attr, adjust */
- record.attr_offset += sizeof (ring->last_attr);
- ring->last_attr.attr = attr;
+ record.attr_start_offset += sizeof (attr_change);
+ ring->last_attr = attr;
}
num_chars = _vte_unistr_strlen (cell->c);
if (num_chars > 1) {
attr.s.columns = 0;
- ring->last_attr.text_offset = record.text_offset + buffer->len
- + g_unichar_to_utf8 (_vte_unistr_get_base (cell->c), NULL);
- _vte_stream_append (ring->attr_stream, (const char *) &ring->last_attr, sizeof (ring->last_attr));
- ring->last_attr.attr = attr;
+ ring->last_attr_text_start_offset = record.text_start_offset + buffer->len
+ + g_unichar_to_utf8 (_vte_unistr_get_base (cell->c), NULL);
+ memset(&attr_change, 0, sizeof (attr_change));
+ attr_change.text_end_offset = ring->last_attr_text_start_offset;
+ attr_change.attr = ring->last_attr;
+ _vte_stream_append (ring->attr_stream, (const char *) &attr_change, sizeof (attr_change));
+ ring->last_attr = attr;
}
+ if (cell->c < 32 || cell->c > 126) record.is_ascii = 0;
_vte_unistr_append_to_string (cell->c, buffer);
}
}
if (!row->attr.soft_wrapped)
g_string_append_c (buffer, '\n');
+ record.soft_wrapped = row->attr.soft_wrapped;
_vte_stream_append (ring->text_stream, buffer->str, buffer->len);
_vte_ring_append_row_record (ring, &record, position);
@@ -186,7 +208,7 @@ _vte_ring_thaw_row (VteRing *ring, gulong position, VteRowData *row, gboolean do
_vte_row_data_clear (row);
- attr_change.text_offset = 0;
+ attr_change.text_end_offset = 0;
if (!_vte_ring_read_row_record (ring, &records[0], position))
return;
@@ -194,10 +216,10 @@ _vte_ring_thaw_row (VteRing *ring, gulong position, VteRowData *row, gboolean do
if (!_vte_ring_read_row_record (ring, &records[1], position + 1))
return;
} else
- records[1].text_offset = _vte_stream_head (ring->text_stream);
+ records[1].text_start_offset = _vte_stream_head (ring->text_stream);
- g_string_set_size (buffer, records[1].text_offset - records[0].text_offset);
- if (!_vte_stream_read (ring->text_stream, records[0].text_offset, buffer->str, buffer->len))
+ g_string_set_size (buffer, records[1].text_start_offset - records[0].text_start_offset);
+ if (!_vte_stream_read (ring->text_stream, records[0].text_start_offset, buffer->str, buffer->len))
return;
record = records[0];
@@ -211,13 +233,13 @@ _vte_ring_thaw_row (VteRing *ring, gulong position, VteRowData *row, gboolean do
end = p + buffer->len;
while (p < end) {
- if (record.text_offset >= ring->last_attr.text_offset) {
- attr = ring->last_attr.attr;
+ if (record.text_start_offset >= ring->last_attr_text_start_offset) {
+ attr = ring->last_attr;
} else {
- if (record.text_offset >= attr_change.text_offset) {
- if (!_vte_stream_read (ring->attr_stream, record.attr_offset, (char *) &attr_change, sizeof (attr_change)))
+ if (record.text_start_offset >= attr_change.text_end_offset) {
+ if (!_vte_stream_read (ring->attr_stream, record.attr_start_offset, (char *) &attr_change, sizeof (attr_change)))
return;
- record.attr_offset += sizeof (attr_change);
+ record.attr_start_offset += sizeof (attr_change);
}
attr = attr_change.attr;
}
@@ -226,7 +248,7 @@ _vte_ring_thaw_row (VteRing *ring, gulong position, VteRowData *row, gboolean do
cell.c = g_utf8_get_char (p);
q = g_utf8_next_char (p);
- record.text_offset += q - p;
+ record.text_start_offset += q - p;
p = q;
if (G_UNLIKELY (cell.attr.columns == 0)) {
@@ -251,14 +273,33 @@ _vte_ring_thaw_row (VteRing *ring, gulong position, VteRowData *row, gboolean do
}
if (do_truncate) {
- if (records[0].text_offset < ring->last_attr.text_offset)
- if (!_vte_stream_read (ring->attr_stream, records[0].attr_offset, (char *) &ring->last_attr, sizeof (ring->last_attr))) {
- ring->last_attr.text_offset = 0;
- ring->last_attr.attr.i = basic_cell.i.attr;
+ gsize attr_stream_truncate_at = records[0].attr_start_offset;
+ _vte_debug_print (VTE_DEBUG_RING, "Truncating\n");
+ if (records[0].text_start_offset <= ring->last_attr_text_start_offset) {
+ /* Check the previous attr record. If its text ends where truncating, this attr record also needs to be removed. */
+ if (_vte_stream_read (ring->attr_stream, attr_stream_truncate_at - sizeof (attr_change), (char *) &attr_change, sizeof (attr_change))) {
+ if (records[0].text_start_offset == attr_change.text_end_offset) {
+ _vte_debug_print (VTE_DEBUG_RING, "... at attribute change\n");
+ attr_stream_truncate_at -= sizeof (attr_change);
+ }
+ }
+ /* Reconstruct last_attr from the first record of attr_stream that we cut off,
+ last_attr_text_start_offset from the last record that we keep. */
+ if (_vte_stream_read (ring->attr_stream, attr_stream_truncate_at, (char *) &attr_change, sizeof (attr_change))) {
+ ring->last_attr = attr_change.attr;
+ if (_vte_stream_read (ring->attr_stream, attr_stream_truncate_at - sizeof (attr_change), (char *) &attr_change, sizeof (attr_change))) {
+ ring->last_attr_text_start_offset = attr_change.text_end_offset;
+ } else {
+ ring->last_attr_text_start_offset = 0;
+ }
+ } else {
+ ring->last_attr_text_start_offset = 0;
+ ring->last_attr.i = basic_cell.i.attr;
}
+ }
_vte_stream_truncate (ring->row_stream, position * sizeof (record));
- _vte_stream_truncate (ring->attr_stream, records[0].attr_offset);
- _vte_stream_truncate (ring->text_stream, records[0].text_offset);
+ _vte_stream_truncate (ring->attr_stream, attr_stream_truncate_at);
+ _vte_stream_truncate (ring->text_stream, records[0].text_start_offset);
}
}
@@ -271,26 +312,10 @@ _vte_ring_reset_streams (VteRing *ring, gulong position)
_vte_stream_reset (ring->text_stream, 0);
_vte_stream_reset (ring->attr_stream, 0);
- ring->last_attr.text_offset = 0;
- ring->last_attr.attr.i = basic_cell.i.attr;
-
- ring->last_page = position;
+ ring->last_attr_text_start_offset = 0;
+ ring->last_attr.i = basic_cell.i.attr;
}
-static void
-_vte_ring_new_page (VteRing *ring)
-{
- _vte_debug_print (VTE_DEBUG_RING, "Starting new stream page at %lu.\n", ring->writable);
-
- _vte_stream_new_page (ring->attr_stream);
- _vte_stream_new_page (ring->text_stream);
- _vte_stream_new_page (ring->row_stream);
-
- ring->last_page = ring->writable;
-}
-
-
-
static inline VteRowData *
_vte_ring_writable_index (VteRing *ring, gulong position)
{
@@ -334,9 +359,6 @@ _vte_ring_freeze_one_row (VteRing *ring)
_vte_ring_freeze_row (ring, ring->writable, row);
ring->writable++;
-
- if (G_UNLIKELY (ring->writable == ring->last_page || ring->writable - ring->last_page >= ring->max))
- _vte_ring_new_page (ring);
}
static void
@@ -363,7 +385,14 @@ _vte_ring_discard_one_row (VteRing *ring)
{
ring->start++;
if (G_UNLIKELY (ring->start == ring->writable)) {
- _vte_ring_reset_streams (ring, 0);
+ _vte_ring_reset_streams (ring, ring->writable);
+ } else {
+ VteRowRecord record;
+ _vte_stream_advance_tail (ring->row_stream, ring->start * sizeof (record));
+ if (G_LIKELY (_vte_ring_read_row_record (ring, &record, ring->start))) {
+ _vte_stream_advance_tail (ring->text_stream, record.text_start_offset);
+ _vte_stream_advance_tail (ring->attr_stream, record.attr_start_offset);
+ }
}
if (ring->start > ring->writable)
ring->writable = ring->start;
@@ -372,8 +401,10 @@ _vte_ring_discard_one_row (VteRing *ring)
static void
_vte_ring_maybe_freeze_one_row (VteRing *ring)
{
- if (G_LIKELY (ring->writable + ring->mask == ring->end))
+ if (G_LIKELY (ring->mask >= ring->visible_rows_hint && ring->writable + ring->mask + 1 == ring->end))
_vte_ring_freeze_one_row (ring);
+ else
+ _vte_ring_ensure_writable_room (ring);
}
static void
@@ -389,15 +420,18 @@ _vte_ring_ensure_writable_room (VteRing *ring)
gulong new_mask, old_mask, i, end;
VteRowData *old_array, *new_array;;
- if (G_LIKELY (ring->writable + ring->mask > ring->end))
+ if (G_LIKELY (ring->mask >= ring->visible_rows_hint && ring->writable + ring->mask + 1 > ring->end))
return;
- _vte_debug_print(VTE_DEBUG_RING, "Enlarging writable array.\n");
-
old_mask = ring->mask;
old_array = ring->array;
- ring->mask = (ring->mask << 1) + 1;
+ do {
+ ring->mask = (ring->mask << 1) + 1;
+ } while (ring->mask < ring->visible_rows_hint || ring->writable + ring->mask + 1 <= ring->end);
+
+ _vte_debug_print(VTE_DEBUG_RING, "Enlarging writable array from %lu to %lu\n", old_mask, ring->mask);
+
ring->array = g_malloc0 (sizeof (ring->array[0]) * (ring->mask + 1));
new_mask = ring->mask;
@@ -439,7 +473,7 @@ _vte_ring_resize (VteRing *ring, gulong max_rows)
if ((gulong) _vte_ring_length (ring) > max_rows) {
ring->start = ring->end - max_rows;
if (ring->start >= ring->writable) {
- _vte_ring_reset_streams (ring, 0);
+ _vte_ring_reset_streams (ring, ring->writable);
ring->writable = ring->start;
}
}
@@ -560,11 +594,430 @@ _vte_ring_append (VteRing * ring)
}
+/**
+ * _vte_ring_set_visible_rows_hint:
+ * @ring: a #VteRing
+ *
+ * Set the number of visible rows, a hint only for better performance.
+ */
+void
+_vte_ring_set_visible_rows_hint (VteRing *ring, gulong rows)
+{
+ ring->visible_rows_hint = rows;
+}
+
+
+/* Convert a (row,col) into a VteCellTextOffset.
+ * Requires the row to be frozen, or be outsize the range covered by the ring.
+ */
+static gboolean
+_vte_frozen_row_column_to_text_offset (VteRing *ring,
+ gulong position,
+ gulong column,
+ VteCellTextOffset *offset)
+{
+ VteRowRecord records[2];
+ VteCell *cell;
+ GString *buffer = ring->utf8_buffer;
+ const VteRowData *row;
+ unsigned int i, num_chars, off;
+
+ if (position >= ring->end) {
+ offset->text_offset = _vte_stream_head (ring->text_stream) + position - ring->end;
+ offset->fragment_cells = 0;
+ offset->eol_cells = column;
+ return TRUE;
+ }
+
+ if (G_UNLIKELY (position < ring->start)) {
+ /* This happens when the marker (saved cursor position) is
+ scrolled off at the top of the scrollback buffer. */
+ position = ring->start;
+ column = 0;
+ /* go on */
+ }
+
+ g_assert(position < ring->writable);
+ if (!_vte_ring_read_row_record (ring, &records[0], position))
+ return FALSE;
+ if ((position + 1) * sizeof (records[0]) < _vte_stream_head (ring->row_stream)) {
+ if (!_vte_ring_read_row_record (ring, &records[1], position + 1))
+ return FALSE;
+ } else
+ records[1].text_start_offset = _vte_stream_head (ring->text_stream);
+
+ g_string_set_size (buffer, records[1].text_start_offset - records[0].text_start_offset);
+ if (!_vte_stream_read (ring->text_stream, records[0].text_start_offset, buffer->str, buffer->len))
+ return FALSE;
+
+ if (G_LIKELY (buffer->len && buffer->str[buffer->len - 1] == '\n'))
+ buffer->len--;
+
+ row = _vte_ring_index(ring, position);
+
+ /* row and buffer now contain the same text, in different representation */
+
+ /* count the number of characters up to the given column */
+ offset->fragment_cells = 0;
+ offset->eol_cells = -1;
+ num_chars = 0;
+ for (i = 0, cell = row->cells; i < row->len && i < column; i++, cell++) {
+ if (G_LIKELY (!cell->attr.fragment)) {
+ if (G_UNLIKELY (i + cell->attr.columns > column)) {
+ offset->fragment_cells = column - i;
+ break;
+ }
+ num_chars += _vte_unistr_strlen(cell->c);
+ }
+ }
+ if (i >= row->len) {
+ offset->eol_cells = column - i;
+ }
+
+ /* count the number of UTF-8 bytes for the given number of characters */
+ off = 0;
+ while (num_chars > 0 && off < buffer->len) {
+ off++;
+ if ((buffer->str[off] & 0xC0) != 0x80) num_chars--;
+ }
+ offset->text_offset = records[0].text_start_offset + off;
+ return TRUE;
+}
+
+
+/* Given a row number and a VteCellTextOffset, compute the column within that row.
+ It's the caller's responsibility to ensure that VteCellTextOffset really falls into that row.
+ Requires the row to be frozen, or be outsize the range covered by the ring.
+ */
+static gboolean
+_vte_frozen_row_text_offset_to_column (VteRing *ring,
+ gulong position,
+ const VteCellTextOffset *offset,
+ long *column)
+{
+ VteRowRecord records[2];
+ VteCell *cell;
+ GString *buffer = ring->utf8_buffer;
+ const VteRowData *row;
+ unsigned int i, off, num_chars, nc;
+
+ if (position >= ring->end) {
+ *column = offset->eol_cells;
+ return TRUE;
+ }
+
+ if (G_UNLIKELY (position < ring->start)) {
+ /* This happens when the marker (saved cursor position) is
+ scrolled off at the top of the scrollback buffer. */
+ *column = 0;
+ return TRUE;
+ }
+
+ g_assert(position < ring->writable);
+ if (!_vte_ring_read_row_record (ring, &records[0], position))
+ return FALSE;
+ if ((position + 1) * sizeof (records[0]) < _vte_stream_head (ring->row_stream)) {
+ if (!_vte_ring_read_row_record (ring, &records[1], position + 1))
+ return FALSE;
+ } else
+ records[1].text_start_offset = _vte_stream_head (ring->text_stream);
+
+ g_assert(offset->text_offset >= records[0].text_start_offset && offset->text_offset < records[1].text_start_offset);
+
+ g_string_set_size (buffer, records[1].text_start_offset - records[0].text_start_offset);
+ if (!_vte_stream_read (ring->text_stream, records[0].text_start_offset, buffer->str, buffer->len))
+ return FALSE;
+
+ if (G_LIKELY (buffer->len && buffer->str[buffer->len - 1] == '\n'))
+ buffer->len--;
+
+ row = _vte_ring_index(ring, position);
+
+ /* row and buffer now contain the same text, in different representation */
+
+ /* count the number of characters for the given UTF-8 text offset */
+ off = offset->text_offset - records[0].text_start_offset;
+ num_chars = 0;
+ for (i = 0; i < off && i < buffer->len; i++) {
+ if ((buffer->str[i] & 0xC0) != 0x80) num_chars++;
+ }
+
+ /* count the number of columns for the given number of characters */
+ for (i = 0, cell = row->cells; i < row->len; i++, cell++) {
+ if (G_LIKELY (!cell->attr.fragment)) {
+ if (num_chars == 0) break;
+ nc = _vte_unistr_strlen(cell->c);
+ if (nc > num_chars) break;
+ num_chars -= nc;
+ }
+ }
+
+ /* always add fragment_cells, but add eol_cells only if we're at eol */
+ i += offset->fragment_cells;
+ if (G_UNLIKELY (offset->eol_cells >= 0 && i == row->len))
+ i += offset->eol_cells;
+ *column = i;
+ return TRUE;
+}
+
+
+/**
+ * _vte_ring_rewrap:
+ * @ring: a #VteRing
+ * @columns: new number of columns
+ * @markers: NULL-terminated array of #VteVisualPosition
+ *
+ * Reflow the @ring to match the new number of @columns.
+ * For all @markers, find the cell at that position and update them to
+ * reflect the cell's new position.
+ */
+/* See ../doc/rewrap.txt for design and implementation details. */
+void
+_vte_ring_rewrap (VteRing *ring,
+ glong columns,
+ VteVisualPosition **markers)
+{
+ gulong old_row_index, new_row_index;
+ int i;
+ int num_markers = 0;
+ VteCellTextOffset *marker_text_offsets;
+ VteVisualPosition *new_markers;
+ VteRowRecord old_record;
+ VteCellAttrChange attr_change;
+ VteStream *new_row_stream;
+ gsize paragraph_start_text_offset;
+ gsize paragraph_end_text_offset;
+ gsize paragraph_len; /* excluding trailing '\n' */
+ gsize attr_offset;
+ gsize old_ring_end;
+
+ if (_vte_ring_length(ring) == 0)
+ return;
+ _vte_debug_print(VTE_DEBUG_RING, "Ring before rewrapping:\n");
+ _vte_ring_validate(ring);
+ new_row_stream = _vte_file_stream_new ();
+
+ /* Freeze everything, because rewrapping is really complicated and we don't want to
+ duplicate the code for frozen and thawed rows. */
+ while (ring->writable < ring->end)
+ _vte_ring_freeze_one_row(ring);
+
+ /* For markers given as (row,col) pairs find their offsets in the text stream.
+ This code requires that the rows are already frozen. */
+ while (markers[num_markers] != NULL)
+ num_markers++;
+ marker_text_offsets = g_malloc(num_markers * sizeof (marker_text_offsets[0]));
+ new_markers = g_malloc(num_markers * sizeof (new_markers[0]));
+ for (i = 0; i < num_markers; i++) {
+ /* Convert visual column into byte offset */
+ if (!_vte_frozen_row_column_to_text_offset(ring, markers[i]->row, markers[i]->col, &marker_text_offsets[i]))
+ goto err;
+ new_markers[i].row = new_markers[i].col = -1;
+ _vte_debug_print(VTE_DEBUG_RING,
+ "Marker #%d old coords: row %ld col %ld -> text_offset %" G_GSIZE_FORMAT " fragment_cells %d eol_cells %d\n",
+ i, markers[i]->row, markers[i]->col, marker_text_offsets[i].text_offset,
+ marker_text_offsets[i].fragment_cells, marker_text_offsets[i].eol_cells);
+ }
+
+ /* Prepare for rewrapping */
+ if (!_vte_ring_read_row_record(ring, &old_record, ring->start))
+ goto err;
+ paragraph_start_text_offset = old_record.text_start_offset;
+ paragraph_end_text_offset = _vte_stream_head (ring->text_stream); /* initialized to silence gcc */
+ new_row_index = 0;
+
+ attr_offset = old_record.attr_start_offset;
+ if (!_vte_stream_read(ring->attr_stream, attr_offset, (char *) &attr_change, sizeof (attr_change))) {
+ attr_change.attr = ring->last_attr;
+ attr_change.text_end_offset = _vte_stream_head (ring->text_stream);
+ }
+
+ old_row_index = ring->start + 1;
+ while (paragraph_start_text_offset < _vte_stream_head (ring->text_stream)) {
+ /* Find the boundaries of the next paragraph */
+ gboolean prev_record_was_soft_wrapped = FALSE;
+ gboolean paragraph_is_ascii = TRUE;
+ gsize paragraph_start_row = old_row_index - 1;
+ gsize paragraph_end_row; /* points to beyond the end */
+ gsize text_offset = paragraph_start_text_offset;
+ VteRowRecord new_record;
+ glong col = 0;
+ _vte_debug_print(VTE_DEBUG_RING,
+ " Old paragraph: row %" G_GSIZE_FORMAT " (text_offset %" G_GSIZE_FORMAT ") up to (exclusive) ", /* no '\n' */
+ paragraph_start_row, paragraph_start_text_offset);
+ while (old_row_index <= ring->end) {
+ prev_record_was_soft_wrapped = old_record.soft_wrapped;
+ paragraph_is_ascii = paragraph_is_ascii && old_record.is_ascii;
+ if (G_LIKELY (old_row_index < ring->end)) {
+ if (!_vte_ring_read_row_record(ring, &old_record, old_row_index))
+ goto err;
+ paragraph_end_text_offset = old_record.text_start_offset;
+ } else {
+ paragraph_end_text_offset = _vte_stream_head (ring->text_stream);
+ }
+ old_row_index++;
+ if (!prev_record_was_soft_wrapped)
+ break;
+ }
+ paragraph_end_row = old_row_index - 1;
+ paragraph_len = paragraph_end_text_offset - paragraph_start_text_offset;
+ if (!prev_record_was_soft_wrapped) /* The last paragraph can be soft wrapped! */
+ paragraph_len--; /* Strip trailing '\n' */
+ _vte_debug_print(VTE_DEBUG_RING,
+ "row %" G_GSIZE_FORMAT " (text_offset %" G_GSIZE_FORMAT ")%s len %" G_GSIZE_FORMAT " is_ascii %d\n",
+ paragraph_end_row, paragraph_end_text_offset,
+ prev_record_was_soft_wrapped ? " soft_wrapped" : "",
+ paragraph_len, paragraph_is_ascii);
+
+ /* Wrap the paragraph */
+ if (attr_change.text_end_offset <= text_offset) {
+ /* Attr change at paragraph boundary, advance to next attr. */
+ attr_offset += sizeof (attr_change);
+ if (!_vte_stream_read(ring->attr_stream, attr_offset, (char *) &attr_change, sizeof (attr_change))) {
+ attr_change.attr = ring->last_attr;
+ attr_change.text_end_offset = _vte_stream_head (ring->text_stream);
+ }
+ }
+ memset(&new_record, 0, sizeof (new_record));
+ new_record.text_start_offset = text_offset;
+ new_record.attr_start_offset = attr_offset;
+ new_record.is_ascii = paragraph_is_ascii;
+
+ while (paragraph_len > 0) {
+ /* Wrap one continuous run of identical attributes within the paragraph. */
+ gsize runlength; /* number of bytes we process in one run: identical attributes, within paragraph */
+ if (attr_change.text_end_offset <= text_offset) {
+ /* Attr change at line boundary, advance to next attr. */
+ attr_offset += sizeof (attr_change);
+ if (!_vte_stream_read(ring->attr_stream, attr_offset, (char *) &attr_change, sizeof (attr_change))) {
+ attr_change.attr = ring->last_attr;
+ attr_change.text_end_offset = _vte_stream_head (ring->text_stream);
+ }
+ }
+ runlength = MIN(paragraph_len, attr_change.text_end_offset - text_offset);
+
+ if (G_UNLIKELY (attr_change.attr.s.columns == 0)) {
+ /* Combining characters all fit in the current row */
+ text_offset += runlength;
+ paragraph_len -= runlength;
+ } else {
+ while (runlength) {
+ if (col >= columns - attr_change.attr.s.columns + 1) {
+ /* Wrap now, write the soft wrapped row's record */
+ new_record.soft_wrapped = 1;
+ _vte_stream_append(new_row_stream, (const char *) &new_record, sizeof (new_record));
+ _vte_debug_print(VTE_DEBUG_RING,
+ " New row %ld text_offset %" G_GSIZE_FORMAT " attr_offset %" G_GSIZE_FORMAT " soft_wrapped\n",
+ new_row_index,
+ new_record.text_start_offset, new_record.attr_start_offset);
+ for (i = 0; i < num_markers; i++) {
+ if (G_UNLIKELY (marker_text_offsets[i].text_offset >= new_record.text_start_offset &&
+ marker_text_offsets[i].text_offset < text_offset)) {
+ new_markers[i].row = new_row_index;
+ _vte_debug_print(VTE_DEBUG_RING,
+ " Marker #%d will be here in row %lu\n", i, new_row_index);
+ }
+ }
+ new_row_index++;
+ new_record.text_start_offset = text_offset;
+ new_record.attr_start_offset = attr_offset;
+ col = 0;
+ }
+ if (paragraph_is_ascii) {
+ /* Shortcut for quickly wrapping ASCII (excluding TAB) text.
+ Don't read text_stream, and advance by a whole row of characters. */
+ int len = MIN(runlength, (gsize) (columns - col));
+ col += len;
+ text_offset += len;
+ paragraph_len -= len;
+ runlength -= len;
+ } else {
+ /* Process one character only. */
+ char textbuf[6]; /* fits at least one UTF-8 character */
+ int textbuf_len;
+ col += attr_change.attr.s.columns;
+ /* Find beginning of next UTF-8 character */
+ text_offset++; paragraph_len--; runlength--;
+ textbuf_len = MIN(runlength, sizeof (textbuf));
+ if (!_vte_stream_read(ring->text_stream, text_offset, textbuf, textbuf_len))
+ goto err;
+ for (i = 0; i < textbuf_len && (textbuf[i] & 0xC0) == 0x80; i++) {
+ text_offset++; paragraph_len--; runlength--;
+ }
+ }
+ }
+ }
+ }
+
+ /* Write the record of the paragraph's last row. */
+ /* Hard wrapped, except maybe at the end of the very last paragraph */
+ new_record.soft_wrapped = prev_record_was_soft_wrapped;
+ _vte_stream_append(new_row_stream, (const char *) &new_record, sizeof (new_record));
+ _vte_debug_print(VTE_DEBUG_RING,
+ " New row %ld text_offset %" G_GSIZE_FORMAT " attr_offset %" G_GSIZE_FORMAT "\n",
+ new_row_index,
+ new_record.text_start_offset, new_record.attr_start_offset);
+ for (i = 0; i < num_markers; i++) {
+ if (G_UNLIKELY (marker_text_offsets[i].text_offset >= new_record.text_start_offset &&
+ marker_text_offsets[i].text_offset < paragraph_end_text_offset)) {
+ new_markers[i].row = new_row_index;
+ _vte_debug_print(VTE_DEBUG_RING,
+ " Marker #%d will be here in row %lu\n", i, new_row_index);
+ }
+ }
+ new_row_index++;
+ paragraph_start_text_offset = paragraph_end_text_offset;
+ }
+
+ /* Update the ring. */
+ old_ring_end = ring->end;
+ g_object_unref(ring->row_stream);
+ ring->row_stream = new_row_stream;
+ ring->writable = ring->end = new_row_index;
+ ring->start = 0;
+ if (ring->end > ring->max)
+ ring->start = ring->end - ring->max;
+ ring->cached_row_num = (gulong) -1;
+
+ /* Find the markers. This requires that the ring is already updated. */
+ for (i = 0; i < num_markers; i++) {
+ /* Compute the row for markers beyond the ring */
+ if (new_markers[i].row == -1)
+ new_markers[i].row = markers[i]->row - old_ring_end + ring->end;
+ /* Convert byte offset into visual column */
+ if (!_vte_frozen_row_text_offset_to_column(ring, new_markers[i].row, &marker_text_offsets[i], &new_markers[i].col))
+ goto err;
+ _vte_debug_print(VTE_DEBUG_RING,
+ "Marker #%d new coords: text_offset %" G_GSIZE_FORMAT " fragment_cells %d eol_cells %d -> row %ld col %ld\n",
+ i, marker_text_offsets[i].text_offset, marker_text_offsets[i].fragment_cells,
+ marker_text_offsets[i].eol_cells, new_markers[i].row, new_markers[i].col);
+ markers[i]->row = new_markers[i].row;
+ markers[i]->col = new_markers[i].col;
+ }
+ g_free(marker_text_offsets);
+ g_free(new_markers);
+
+ _vte_debug_print(VTE_DEBUG_RING, "Ring after rewrapping:\n");
+ _vte_ring_validate(ring);
+ return;
+
+err:
+#ifdef VTE_DEBUG
+ _vte_debug_print(VTE_DEBUG_RING,
+ "Error while rewrapping\n");
+ g_assert_not_reached();
+#endif
+ g_object_unref(new_row_stream);
+ g_free(marker_text_offsets);
+ g_free(new_markers);
+}
+
+
static gboolean
_vte_ring_write_row (VteRing *ring,
GOutputStream *stream,
VteRowData *row,
- VteTerminalWriteFlags flags,
+ VteWriteFlags flags,
GCancellable *cancellable,
GError **error)
{
@@ -590,7 +1043,7 @@ _vte_ring_write_row (VteRing *ring,
* _vte_ring_write_contents:
* @ring: a #VteRing
* @stream: a #GOutputStream to write to
- * @flags: a set of #VteTerminalWriteFlags
+ * @flags: a set of #VteWriteFlags
* @cancellable: optional #GCancellable object, %NULL to ignore
* @error: a #GError location to store the error occuring, or %NULL to ignore
*
@@ -601,7 +1054,7 @@ _vte_ring_write_row (VteRing *ring,
gboolean
_vte_ring_write_contents (VteRing *ring,
GOutputStream *stream,
- VteTerminalWriteFlags flags,
+ VteWriteFlags flags,
GCancellable *cancellable,
GError **error)
{
@@ -609,15 +1062,35 @@ _vte_ring_write_contents (VteRing *ring,
_vte_debug_print(VTE_DEBUG_RING, "Writing contents to GOutputStream.\n");
- if (ring->start < ring->writable) {
+ if (ring->start < ring->writable)
+ {
VteRowRecord record;
- /* XXX what to do in case of error? */
- if (_vte_ring_read_row_record (ring, &record, ring->start)) {
- if (!_vte_stream_write_contents (ring->text_stream, stream,
- record.text_offset,
- cancellable, error))
- return FALSE;
+
+ if (_vte_ring_read_row_record (ring, &record, ring->start))
+ {
+ gsize start_offset = record.text_start_offset;
+ gsize end_offset = _vte_stream_head (ring->text_stream);
+ char buf[4096];
+ while (start_offset < end_offset)
+ {
+ gsize bytes_written, len;
+
+ len = MIN (G_N_ELEMENTS (buf), end_offset - start_offset);
+
+ if (!_vte_stream_read (ring->text_stream, start_offset,
+ buf, len))
+ return FALSE;
+
+ if (!g_output_stream_write_all (stream, buf, len,
+ &bytes_written, cancellable,
+ error))
+ return FALSE;
+
+ start_offset += len;
+ }
}
+ else
+ return FALSE;
}
for (i = ring->writable; i < ring->end; i++) {
diff --git a/src/ring.h b/src/ring.h
index 50dd5a27..ec38019b 100644
--- a/src/ring.h
+++ b/src/ring.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2002,2009,2010 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Red Hat Author(s): Behdad Esfahbod
*/
@@ -32,8 +32,12 @@
G_BEGIN_DECLS
+typedef struct _VteVisualPosition {
+ long row, col;
+} VteVisualPosition;
+
typedef struct _VteCellAttrChange {
- gsize text_offset;
+ gsize text_end_offset; /* offset of first character no longer using this attr */
VteIntCellAttr attr;
} VteCellAttrChange;
@@ -53,14 +57,15 @@ struct _VteRing {
VteRowData *array;
/* Storage */
- gulong last_page;
VteStream *attr_stream, *text_stream, *row_stream;
- VteCellAttrChange last_attr;
+ gsize last_attr_text_start_offset;
+ VteIntCellAttr last_attr;
GString *utf8_buffer;
VteRowData cached_row;
gulong cached_row_num;
+ gulong visible_rows_hint; /* to keep at least a screenful of lines in memory, bug 646098 comment 12 */
};
#define _vte_ring_contains(__ring, __position) \
@@ -80,9 +85,11 @@ void _vte_ring_shrink (VteRing *ring, gulong max_len);
VteRowData *_vte_ring_insert (VteRing *ring, gulong position);
VteRowData *_vte_ring_append (VteRing *ring);
void _vte_ring_remove (VteRing *ring, gulong position);
+void _vte_ring_set_visible_rows_hint (VteRing *ring, gulong rows);
+void _vte_ring_rewrap (VteRing *ring, glong columns, VteVisualPosition **markers);
gboolean _vte_ring_write_contents (VteRing *ring,
GOutputStream *stream,
- VteTerminalWriteFlags flags,
+ VteWriteFlags flags,
GCancellable *cancellable,
GError **error);
diff --git a/src/slowcat.c b/src/slowcat.c
index 78ac531e..15983d26 100644
--- a/src/slowcat.c
+++ b/src/slowcat.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <config.h>
@@ -62,7 +62,7 @@ catfile(const char *pathname, long delay, long chunksize)
}
}
if (i > 0) {
- int bytes;
+ int bytes G_GNUC_UNUSED;
bytes = write(STDOUT_FILENO, buf, i);
fsync(STDOUT_FILENO);
}
diff --git a/src/table.c b/src/table.c
index 140e8c88..f1ea798a 100644
--- a/src/table.c
+++ b/src/table.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <config.h>
@@ -36,7 +36,7 @@
#define _vte_table_is_numeric(__c) \
(((__c) >= '0') && ((__c) <= '9'))
#define _vte_table_is_numeric_list(__c) \
- ((((__c) >= '0') && ((__c) <= '9')) || (__c) == ';')
+ ((((__c) >= '0') && ((__c) <= '9')) || (__c) == ';' || (__c) == ':')
struct _vte_table {
struct _vte_matcher_impl impl;
@@ -463,7 +463,7 @@ _vte_table_matchi(struct _vte_table *table,
const char *local_result;
subtable = table->table_number_list;
- /* Iterate over all numeric characters and ';'. */
+ /* Iterate over all numeric characters, ';' and ':'. */
for (i = 1; i < length; i++) {
if (!_vte_table_is_numeric_list(candidate[i])) {
break;
@@ -536,22 +536,40 @@ _vte_table_extract_numbers(GValueArray **array,
struct _vte_table_arginfo *arginfo, long increment)
{
GValue value = {0,};
+ GValue subvalue = {0,};
+ GValueArray *subarray = NULL;
gssize i;
+ if (G_UNLIKELY (*array == NULL)) {
+ *array = g_value_array_new(1);
+ }
+
g_value_init(&value, G_TYPE_LONG);
+ g_value_init(&subvalue, G_TYPE_VALUE_ARRAY);
i = 0;
do {
long total = 0;
- for (; i < arginfo->length && arginfo->start[i] != ';'; i++) {
+ for (; i < arginfo->length && arginfo->start[i] != ';' && arginfo->start[i] != ':'; i++) {
gint v = g_unichar_digit_value (arginfo->start[i]);
total *= 10;
total += v == -1 ? 0 : v;
}
- if (G_UNLIKELY (*array == NULL)) {
- *array = g_value_array_new(1);
+ g_value_set_long(&value, CLAMP (total, 0, G_MAXUSHORT));
+ if (i < arginfo->length && arginfo->start[i] == ':') {
+ if (subarray == NULL) {
+ subarray = g_value_array_new(2);
+ }
+ g_value_array_append(subarray, &value);
+ } else {
+ if (subarray == NULL) {
+ g_value_array_append(*array, &value);
+ } else {
+ g_value_array_append(subarray, &value);
+ g_value_set_boxed(&subvalue, subarray);
+ g_value_array_append(*array, &subvalue);
+ subarray = NULL;
+ }
}
- g_value_set_long(&value, total);
- g_value_array_append(*array, &value);
} while (i++ < arginfo->length);
g_value_unset(&value);
}
@@ -858,6 +876,9 @@ print_array(GValueArray *array)
printf("\"%ls\"",
(wchar_t*) g_value_get_pointer(value));
}
+ if (G_VALUE_HOLDS_BOXED(value)) {
+ print_array(g_value_get_boxed(value));
+ }
}
printf(")");
/* _vte_matcher_free_params_array(array); */
@@ -877,6 +898,12 @@ main(int argc, char **argv)
"]3;fook",
"oo",
"",
+ "",
+ "[3;5:42m",
+ "[3:5:42m",
+ "",
+ "[3;2:110:120:130m",
+ "[3:2:110:120:130m",
"k",
"k",
"",
@@ -900,9 +927,7 @@ main(int argc, char **argv)
_vte_table_add(table, "ACDEF%sJ", 8, "ACDEF%sJ", 0);
_vte_table_add(table, "ACDEF%i%mJ", 10, "ACDEF%dJ", 0);
_vte_table_add(table, "[%mh", 5, "move-cursor", 0);
- _vte_table_add(table, "[%d;%d;%dm", 11, "set-graphic-rendition", 0);
- _vte_table_add(table, "[%dm", 5, "set-graphic-rendition", 0);
- _vte_table_add(table, "", 3, "set-graphic-rendition", 0);
+ _vte_table_add(table, "[%mm", 5, "character-attributes", 0);
_vte_table_add(table, "]3;%s", 7, "set-icon-title", 0);
_vte_table_add(table, "]4;%s", 7, "set-window-title", 0);
printf("Table contents:\n");
diff --git a/src/table.h b/src/table.h
index 31989f2e..c96a2773 100644
--- a/src/table.h
+++ b/src/table.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* The interfaces in this file are subject to change at any time. */
diff --git a/src/test-vte-sh.sh b/src/test-vte-sh.sh
new file mode 100755
index 00000000..13bc7dd8
--- /dev/null
+++ b/src/test-vte-sh.sh
@@ -0,0 +1,76 @@
+#!/usr/bin/env bash
+# Copyright © 2013 Christian Persch
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+set -ei
+
+export VTE_VERSION=9999
+
+source $srcdir/vte.sh
+
+check_urlencode() (
+ input=$(echo -ne "$1")
+ encoded=$(__vte_urlencode "$input")
+ if test "$encoded" != "$2"; then
+ echo "FAILED:"
+ echo "Input : \"$input\""
+ echo "Output : \"$encoded\""
+ echo "Expected: \"$2\""
+ exit 1
+ fi
+)
+
+# raw bytes
+
+check_urlencode "\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017" \
+ "%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F"
+check_urlencode "\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" \
+ "%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F"
+check_urlencode "\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057" \
+ "%20!%22%23%24%25%26'()%2A%2B%2C-./"
+check_urlencode "\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077" \
+ "0123456789:%3B%3C%3D%3E%3F"
+check_urlencode "\0100\0101\0102\0103\0104\0105\0106\0107\0110\0111\0112\0113\0114\0115\0116\0117" \
+ "%40ABCDEFGHIJKLMNO"
+check_urlencode "\0120\0121\0122\0123\0124\0125\0126\0127\0130\0131\0132\0133\0134\0135\0136\0137" \
+ "PQRSTUVWXYZ%5B%5C%5D%5E_"
+check_urlencode "\0140\0141\0142\0143\0144\0145\0146\0147\0150\0151\0152\0153\0154\0155\0156\0157" \
+ "%60abcdefghijklmno"
+check_urlencode "\0160\0161\0162\0163\0164\0165\0166\0167\0170\0171\0172\0173\0174\0175\0176\0177" \
+ "pqrstuvwxyz%7B%7C%7D~%7F"
+check_urlencode "\0200\0201\0202\0203\0204\0205\0206\0207\0210\0211\0212\0213\0214\0215\0216\0217" \
+ "%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F"
+check_urlencode "\0220\0221\0222\0223\0224\0225\0226\0227\0230\0231\0232\0233\0234\0235\0236\0237" \
+ "%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F"
+check_urlencode "\0240\0241\0242\0243\0244\0245\0246\0247\0250\0251\0252\0253\0254\0255\0256\0257" \
+ "%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF"
+check_urlencode "\0260\0261\0262\0263\0264\0265\0266\0267\0270\0271\0272\0273\0274\0275\0276\0277" \
+ "%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF"
+check_urlencode "\0300\0301\0302\0303\0304\0305\0306\0307\0310\0311\0312\0313\0314\0315\0316\0317" \
+ "%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF"
+check_urlencode "\0320\0321\0322\0323\0324\0325\0326\0327\0330\0331\0332\0333\0334\0335\0336\0337" \
+ "%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF"
+check_urlencode "\0340\0341\0342\0343\0344\0345\0346\0347\0350\0351\0352\0353\0354\0355\0356\0357" \
+ "%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF"
+check_urlencode "\0360\0361\0362\0363\0364\0365\0366\0367\0370\0371\0372\0373\0374\0375\0376\0377" \
+ "%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF"
+
+# UTF-8
+
+check_urlencode "ẞ" "%E1%BA%9E"
+
+# all tests pass!
+exit 0
diff --git a/src/trie.c b/src/trie.c
index 7b40a355..b13fc62c 100644
--- a/src/trie.c
+++ b/src/trie.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2001,2002 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <config.h>
diff --git a/src/trie.h b/src/trie.h
index 3e23c2c9..67ce0f58 100644
--- a/src/trie.h
+++ b/src/trie.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2001,2002 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* The interfaces in this file are subject to change at any time. */
diff --git a/src/vte-gtk-compat.h b/src/vte-gtk-compat.h
deleted file mode 100644
index 3c897f37..00000000
--- a/src/vte-gtk-compat.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2010 Saleem Abdulrasool <compnerd@compnerd.org>
- *
- * This is free software; you can redistribute it and/or modify it under the
- * terms of the GNU Library General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This program 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 General Public License for
- * more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef vte_gtk_compat_h_included
-#define vte_gtk_compat_h_included
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#if GTK_CHECK_VERSION (2, 90, 5)
-
-#define GdkRegion cairo_region_t
-#define VteRegionRectangle cairo_rectangle_int_t
-#define gdk_region_new() cairo_region_create()
-#define gdk_region_rectangle(r) cairo_region_create_rectangle(r)
-#define gdk_region_copy(r) cairo_region_copy(r)
-#define gdk_region_destroy cairo_region_destroy
-#define gdk_region_union_with_rect(r, rect) cairo_region_union_rectangle(r, rect)
-#define gdk_region_union(r, s) cairo_region_union(r, s)
-#define gdk_region_get_clipbox(r, rect) cairo_region_get_extents(r, rect)
-#define gdk_region_get_rectangles(r, rects, n_rects) \
- do { \
- int i; \
- \
- *(n_rects) = cairo_region_num_rectangles(r); \
- *(rects) = g_new(cairo_rectangle_int_t, *(n_rects)); \
- for (i = 0; i < *(n_rects); i++) \
- cairo_region_get_rectangle ((r), i, &(*(rects))[i]); \
- } while (0)
-
-#else
-
-#define VteRegionRectangle GdkRectangle
-
-#endif
-
-#if !GTK_CHECK_VERSION (2, 90, 8)
-#define gdk_error_trap_pop_ignored gdk_error_trap_pop
-#endif
-
-#if !GTK_CHECK_VERSION (2, 22, 0)
-#define gtk_accessible_get_widget(accessible) ((accessible)->widget)
-#endif
-
-#if !GTK_CHECK_VERSION (2, 20, 0)
-#define gtk_widget_get_mapped(widget) (GTK_WIDGET_MAPPED ((widget)))
-#define gtk_widget_get_realized(widget) (GTK_WIDGET_REALIZED ((widget)))
-#define gtk_widget_set_realized(widget, state) ((state) ? GTK_WIDGET_SET_FLAGS ((widget), GTK_REALIZED) : GTK_WIDGET_UNSET_FLAGS ((widget), GTK_REALIZED))
-#endif
-
-#if !GTK_CHECK_VERSION (2, 18, 0)
-#define gtk_widget_has_focus(widget) (GTK_WIDGET_HAS_FOCUS ((widget)))
-#define gtk_widget_get_state(widget) ((widget)->state)
-#define gtk_widget_set_window(widget, wndw) ((widget)->window = (wndw))
-#define gtk_widget_is_drawable(widget) (GTK_WIDGET_DRAWABLE ((widget)))
-#define gtk_widget_get_allocation(widget, alloc) (*(alloc) = (widget)->allocation)
-#define gtk_widget_set_allocation(widget, alloc) ((widget)->allocation = *(alloc))
-#define gtk_widget_get_double_buffered(widget) (GTK_WIDGET_DOUBLE_BUFFERED ((widget)))
-#endif
-
-G_END_DECLS
-
-#endif
-
diff --git a/src/vte-private.h b/src/vte-private.h
index 06e9ee64..1ccc44b7 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2001-2004 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef vte_vte_private_h_included
@@ -46,7 +46,6 @@
#include "debug.h"
#include "vteconv.h"
#include "vtedraw.h"
-#include "reaper.h"
#include "ring.h"
#include "caps.h"
@@ -56,14 +55,36 @@ G_BEGIN_DECLS
#define VTE_LINE_WIDTH 1
#define VTE_ROWS 24
#define VTE_COLUMNS 80
+
+/*
+ * Colors are encoded in 25 bits as follows:
+ *
+ * 0 .. 255:
+ * Colors set by SGR 256-color extension (38/48;5;index).
+ * These are direct indices into the color palette.
+ *
+ * 256 .. VTE_PALETTE_SIZE - 1 (261):
+ * Special values, such as default colors.
+ * These are direct indices into the color palette.
+ *
+ * VTE_LEGACY_COLORS_OFFSET (512) .. VTE_LEGACY_COLORS_OFFSET + VTE_LEGACY_FULL_COLOR_SET_SIZE - 1 (527):
+ * Colors set by legacy escapes (30..37/40..47, 90..97/100..107).
+ * These are translated to 0 .. 15 before looking up in the palette, taking bold into account.
+ *
+ * VTE_RGB_COLOR (2^24) .. VTE_RGB_COLOR + 16Mi - 1 (2^25 - 1):
+ * Colors set by SGR truecolor extension (38/48;2;red;green;blue)
+ * These are direct RGB values.
+ */
+#define VTE_LEGACY_COLORS_OFFSET 512
#define VTE_LEGACY_COLOR_SET_SIZE 8
+#define VTE_LEGACY_FULL_COLOR_SET_SIZE 16
#define VTE_COLOR_PLAIN_OFFSET 0
#define VTE_COLOR_BRIGHT_OFFSET 8
#define VTE_COLOR_DIM_OFFSET 16
-/* More color defines in ring.h */
+#define VTE_RGB_COLOR (1 << 24)
+/* More color defines in vterowdata.h */
-#define VTE_SCROLLBACK_INIT 100
-#define VTE_SATURATION_MAX 10000
+#define VTE_SCROLLBACK_INIT 512
#define VTE_DEFAULT_CURSOR GDK_XTERM
#define VTE_MOUSING_CURSOR GDK_LEFT_PTR
#define VTE_TAB_MAX 999
@@ -86,14 +107,14 @@ G_BEGIN_DECLS
#define VTE_UTF8_BPC (6) /* Maximum number of bytes used per UTF-8 character */
-#define I_(string) (g_intern_static_string(string))
+/* Keep in decreasing order of precedence. */
+#define VTE_COLOR_SOURCE_ESCAPE 0
+#define VTE_COLOR_SOURCE_API 1
+#define VTE_FONT_SCALE_MIN (.25)
+#define VTE_FONT_SCALE_MAX (4.)
-typedef enum {
- VTE_REGEX_GREGEX,
- VTE_REGEX_VTE,
- VTE_REGEX_UNDECIDED
-} VteRegexMode;
+#define I_(string) (g_intern_static_string(string))
typedef enum {
VTE_REGEX_CURSOR_GDKCURSOR,
@@ -129,14 +150,8 @@ typedef enum {
/* A match regex, with a tag. */
struct vte_match_regex {
gint tag;
- VteRegexMode mode;
- union { /* switched on |mode| */
- struct {
- GRegex *regex;
- GRegexMatchFlags flags;
- } gregex;
- struct _vte_regex *reg;
- } regex;
+ GRegex *regex;
+ GRegexMatchFlags match_flags;
VteRegexCursorMode cursor_mode;
union {
GdkCursor *cursor;
@@ -154,20 +169,22 @@ typedef enum _VteKeymode {
typedef struct _VteScreen VteScreen;
-typedef struct _VteWordCharRange {
- gunichar start, end;
-} VteWordCharRange;
-
-typedef struct _VteVisualPosition {
- long row, col;
-} VteVisualPosition;
+typedef struct _VtePaletteColor {
+ struct {
+ PangoColor color;
+ gboolean is_set;
+ } sources[2];
+} VtePaletteColor;
/* Terminal private data. */
struct _VteTerminalPrivate {
+ /* Metric and sizing data: dimensions of the window */
+ glong row_count;
+ glong column_count;
+
/* Emulation setup data. */
struct _vte_termcap *termcap; /* termcap storage */
struct _vte_matcher *matcher; /* control sequence matcher */
- const char *termcap_path; /* path to termcap file */
const char *emulation; /* terminal type to emulate */
struct vte_terminal_flags { /* boolean termcap flags */
gboolean am;
@@ -194,11 +211,11 @@ struct _VteTerminalPrivate {
guint pty_output_source;
gboolean pty_input_active;
GPid pty_pid; /* pid of child using pty slave */
- VteReaper *pty_reaper;
- int child_exit_status;
+ guint child_watch_source;
/* Input data queues. */
const char *encoding; /* the pty's encoding */
+ int iso2022_utf8_ambiguous_width;
struct _vte_iso2022_state *iso2022;
struct _vte_incoming_chunk{
struct _vte_incoming_chunk *next;
@@ -214,11 +231,11 @@ struct _VteTerminalPrivate {
glong max_input_bytes;
/* Output data queue. */
- VteBuffer *outgoing; /* pending input characters */
+ VteByteArray *outgoing; /* pending input characters */
VteConv outgoing_conv;
/* IConv buffer. */
- VteBuffer *conv_buffer;
+ VteByteArray *conv_buffer;
/* Screen data. We support the normal screen, and an alternate
* screen, which seems to be a DEC-specific feature. */
@@ -258,9 +275,9 @@ struct _VteTerminalPrivate {
} normal_screen, alternate_screen, *screen;
/* Selection information. */
- GArray *word_chars;
gboolean has_selection;
gboolean selecting;
+ gboolean selecting_after_threshold;
gboolean selecting_restart;
gboolean selecting_had_delta;
gboolean selection_block_mode;
@@ -280,7 +297,7 @@ struct _VteTerminalPrivate {
GtkClipboard *clipboard[LAST_VTE_SELECTION];
/* Miscellaneous options. */
- VteTerminalEraseBinding backspace_binding, delete_binding;
+ VteEraseBinding backspace_binding, delete_binding;
gboolean meta_sends_escape;
gboolean audible_bell;
gboolean visible_bell;
@@ -288,24 +305,26 @@ struct _VteTerminalPrivate {
guint bell_margin;
gboolean allow_bold;
gboolean nrc_mode;
- gboolean smooth_scroll;
+ gboolean deccolm_mode; /* DECCOLM allowed */
GHashTable *tabstops;
gboolean text_modified_flag;
gboolean text_inserted_flag;
gboolean text_deleted_flag;
+ gboolean rewrap_on_resize;
/* Scrolling options. */
gboolean scroll_background;
gboolean scroll_on_output;
gboolean scroll_on_keystroke;
+ gboolean alternate_screen_scroll;
long scrollback_lines;
/* Cursor shape */
- VteTerminalCursorShape cursor_shape;
+ VteCursorShape cursor_shape;
float cursor_aspect_ratio;
/* Cursor blinking. */
- VteTerminalCursorBlinkMode cursor_blink_mode;
+ VteCursorBlinkMode cursor_blink_mode;
gboolean cursor_blink_state;
guint cursor_blink_tag; /* cursor blinking timeout ID */
gint cursor_blink_cycle; /* gtk-cursor-blink-time / 2 */
@@ -324,11 +343,13 @@ struct _VteTerminalPrivate {
long mouse_last_x, mouse_last_y;
gboolean mouse_autohide;
guint mouse_autoscroll_tag;
+ gboolean mouse_xterm_extension;
+ gboolean mouse_urxvt_extension;
+ double mouse_smooth_scroll_delta;
/* State variables for handling match checks. */
char *match_contents;
GArray *match_attributes;
- VteRegexMode match_regex_mode;
GArray *match_regexes;
char *match;
int match_tag;
@@ -337,14 +358,21 @@ struct _VteTerminalPrivate {
/* Search data. */
GRegex *search_regex;
+ GRegexMatchFlags search_match_flags;
gboolean search_wrap_around;
GArray *search_attrs; /* Cache attrs */
/* Data used when rendering the text which does not require server
* resources and which can be kept after unrealizing. */
+ PangoFontDescription *unscaled_font_desc;
PangoFontDescription *fontdesc;
- VteTerminalAntiAlias fontantialias;
+ gdouble font_scale;
gboolean fontdirty;
+ glong char_ascent;
+ glong char_descent;
+ /* dimensions of character cells */
+ glong char_width;
+ glong char_height;
/* Data used when rendering the text which reflects server resources
* and data, which should be dropped when unrealizing and (re)created
@@ -352,9 +380,7 @@ struct _VteTerminalPrivate {
struct _vte_draw *draw;
gboolean palette_initialized;
- gboolean highlight_color_set;
- gboolean cursor_color_set;
- PangoColor palette[VTE_PALETTE_SIZE];
+ VtePaletteColor palette[VTE_PALETTE_SIZE];
/* Mouse cursors. */
gboolean mouse_cursor_visible;
@@ -379,18 +405,17 @@ struct _VteTerminalPrivate {
gboolean contents_changed_pending;
/* window name changes */
+ gchar *window_title;
gchar *window_title_changed;
+ gchar *icon_title;
gchar *icon_title_changed;
+ gchar *current_directory_uri;
+ gchar *current_directory_uri_changed;
+ gchar *current_file_uri;
+ gchar *current_file_uri_changed;
- /* Background images/"transparency". */
- guint root_pixmap_changed_tag;
- gboolean bg_update_pending;
- gboolean bg_transparent;
- GdkPixbuf *bg_pixbuf;
- char *bg_file;
- PangoColor bg_tint_color;
- guint16 bg_saturation; /* out of VTE_SATURATION_MAX */
- guint16 bg_opacity;
+ /* Background */
+ gdouble background_alpha;
/* Key modifiers. */
GdkModifierType modifiers;
@@ -405,22 +430,19 @@ struct _VteTerminalPrivate {
glong strikethrough_position;
/* Style stuff */
- GtkBorder inner_border;
+ GtkBorder padding;
-#if GTK_CHECK_VERSION (2, 91, 2)
/* GtkScrollable impl */
GtkAdjustment *hadjustment; /* unused */
+ GtkAdjustment *vadjustment;
guint hscroll_policy : 1; /* unused */
guint vscroll_policy : 1;
-#endif
};
-#if GTK_CHECK_VERSION (2, 99, 0)
struct _VteTerminalClassPrivate {
GtkStyleProvider *style_provider;
};
-#endif
VteRowData *_vte_terminal_ensure_row(VteTerminal *terminal);
void _vte_terminal_set_pointer_visible(VteTerminal *terminal, gboolean visible);
@@ -450,6 +472,11 @@ void _vte_terminal_cleanup_tab_fragments_at_cursor (VteTerminal *terminal);
void _vte_terminal_audible_beep(VteTerminal *terminal);
void _vte_terminal_visible_beep(VteTerminal *terminal);
void _vte_terminal_beep(VteTerminal *terminal);
+PangoColor *_vte_terminal_get_color(const VteTerminal *terminal, int idx);
+void _vte_terminal_set_color_internal(VteTerminal *terminal,
+ int idx,
+ int source,
+ const PangoColor *color);
void _vte_terminal_inline_error_message(VteTerminal *terminal, const char *format, ...) G_GNUC_PRINTF(2,3);
@@ -462,6 +489,18 @@ void _vte_terminal_handle_sequence(VteTerminal *terminal,
const char *match_s,
GQuark match,
GValueArray *params);
+gboolean _vte_terminal_xy_to_grid(VteTerminal *terminal,
+ long x,
+ long y,
+ long *col,
+ long *row);
+gboolean _vte_terminal_size_to_grid_size(VteTerminal *terminal,
+ long w,
+ long h,
+ long *cols,
+ long *rows);
+
+gboolean _vte_terminal_is_word_char(VteTerminal *terminal, gunichar c);
G_END_DECLS
diff --git a/src/vte.c b/src/vte.c
index 54291aa0..cb15f939 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -1,27 +1,28 @@
+/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*- */
/*
* Copyright (C) 2001-2004,2009,2010 Red Hat, Inc.
* Copyright © 2008, 2009, 2010 Christian Persch
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* SECTION: vte-terminal
* @short_description: A terminal widget implementation
*
- * A VteTerminal is a terminal emulator implemented as a GTK2 widget.
+ * A VteTerminal is a terminal emulator implemented as a GTK3 widget.
*/
#include <config.h>
@@ -30,7 +31,6 @@
#include "vte.h"
#include "vte-private.h"
-#include "vte-gtk-compat.h"
#ifdef HAVE_WCHAR_H
#include <wchar.h>
@@ -56,18 +56,20 @@
#include "vteint.h"
#include "vtepty.h"
#include "vtepty-private.h"
-#include "vteregex.h"
#include "vtetc.h"
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
-#if GTK_CHECK_VERSION (2, 90, 7)
-#define GDK_KEY(symbol) GDK_KEY_##symbol
-#else
-#include <gdk/gdkkeysyms.h>
-#define GDK_KEY(symbol) GDK_##symbol
+#ifndef HAVE_ROUND
+static inline double round(double x) {
+ if(x - floor(x) < 0.5) {
+ return floor(x);
+ } else {
+ return ceil(x);
+ }
+}
#endif
#ifndef HAVE_WINT_T
@@ -78,12 +80,8 @@ typedef gunichar wint_t;
#define howmany(x, y) (((x) + ((y) - 1)) / (y))
#endif
-#define STATIC_PARAMS (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
-
-
static void vte_terminal_set_visibility (VteTerminal *terminal, GdkVisibilityState state);
-static void vte_terminal_set_termcap(VteTerminal *terminal, const char *path,
- gboolean reset);
+static void vte_terminal_set_termcap(VteTerminal *terminal);
static void vte_terminal_paste(VteTerminal *terminal, GdkAtom board);
static void vte_terminal_real_copy_clipboard(VteTerminal *terminal);
static void vte_terminal_real_paste_clipboard(VteTerminal *terminal);
@@ -98,8 +96,7 @@ static void vte_terminal_match_hilite_hide(VteTerminal *terminal);
static void vte_terminal_match_hilite_show(VteTerminal *terminal, long x, long y);
static void vte_terminal_match_hilite_update(VteTerminal *terminal, long x, long y);
static void vte_terminal_match_contents_clear(VteTerminal *terminal);
-static gboolean vte_terminal_background_update(VteTerminal *data);
-static void vte_terminal_queue_background_update(VteTerminal *terminal);
+static void vte_terminal_background_update(VteTerminal *data);
static void vte_terminal_process_incoming(VteTerminal *terminal);
static void vte_terminal_emit_pending_signals(VteTerminal *terminal);
static gboolean vte_cell_is_selected(VteTerminal *terminal,
@@ -131,13 +128,16 @@ static void add_update_timeout (VteTerminal *terminal);
static void remove_update_timeout (VteTerminal *terminal);
static void reset_update_regions (VteTerminal *terminal);
static void vte_terminal_set_cursor_blinks_internal(VteTerminal *terminal, gboolean blink);
-static void vte_terminal_set_font_full_internal(VteTerminal *terminal,
- const PangoFontDescription *font_desc,
- VteTerminalAntiAlias antialias);
static void _vte_check_cursor_blink(VteTerminal *terminal);
static gboolean process_timeout (gpointer data);
static gboolean update_timeout (gpointer data);
+static cairo_region_t *vte_cairo_get_clip_region (cairo_t *cr);
+static void vte_terminal_determine_colors_internal(VteTerminal *terminal,
+ const VteCellAttr *attr,
+ gboolean selected,
+ gboolean cursor,
+ guint *pfore, guint *pback);
enum {
COPY_CLIPBOARD,
@@ -148,23 +148,18 @@ static guint signals[LAST_SIGNAL];
enum {
PROP_0,
-#if GTK_CHECK_VERSION (2, 91, 2)
PROP_HADJUSTMENT,
PROP_VADJUSTMENT,
PROP_HSCROLL_POLICY,
PROP_VSCROLL_POLICY,
-#endif
PROP_ALLOW_BOLD,
PROP_AUDIBLE_BELL,
- PROP_BACKGROUND_IMAGE_FILE,
- PROP_BACKGROUND_IMAGE_PIXBUF,
- PROP_BACKGROUND_OPACITY,
- PROP_BACKGROUND_SATURATION,
- PROP_BACKGROUND_TINT_COLOR,
- PROP_BACKGROUND_TRANSPARENT,
PROP_BACKSPACE_BINDING,
+ PROP_CJK_AMBIGUOUS_WIDTH,
PROP_CURSOR_BLINK_MODE,
PROP_CURSOR_SHAPE,
+ PROP_CURRENT_DIRECTORY_URI,
+ PROP_CURRENT_FILE_URI,
PROP_DELETE_BINDING,
PROP_EMULATION,
PROP_ENCODING,
@@ -172,14 +167,13 @@ enum {
PROP_ICON_TITLE,
PROP_MOUSE_POINTER_AUTOHIDE,
PROP_PTY,
- PROP_PTY_OBJECT,
- PROP_SCROLL_BACKGROUND,
+ PROP_REWRAP_ON_RESIZE,
PROP_SCROLLBACK_LINES,
PROP_SCROLL_ON_KEYSTROKE,
PROP_SCROLL_ON_OUTPUT,
PROP_WINDOW_TITLE,
- PROP_WORD_CHARS,
- PROP_VISIBLE_BELL
+ PROP_VISIBLE_BELL,
+ PROP_FONT_SCALE
};
/* these static variables are guarded by the GDK mutex */
@@ -190,7 +184,7 @@ static gboolean in_update_timeout;
static GList *active_terminals;
static GTimer *process_timer;
-static const GtkBorder default_inner_border = { 1, 1, 1, 1 };
+static const GtkBorder default_padding = { 1, 1, 1, 1 };
/* process incoming data without copying */
static struct _vte_incoming_chunk *free_chunks;
@@ -282,7 +276,6 @@ _vte_incoming_chunks_reverse(struct _vte_incoming_chunk *chunk)
return prev;
}
-#if GTK_CHECK_VERSION (2, 99, 0)
#ifdef VTE_DEBUG
G_DEFINE_TYPE_WITH_CODE(VteTerminal, vte_terminal, GTK_TYPE_WIDGET,
g_type_add_class_private (g_define_type_id, sizeof (VteTerminalClassPrivate));
@@ -295,16 +288,6 @@ G_DEFINE_TYPE_WITH_CODE(VteTerminal, vte_terminal, GTK_TYPE_WIDGET,
g_type_add_class_private (g_define_type_id, sizeof (VteTerminalClassPrivate));
G_IMPLEMENT_INTERFACE(GTK_TYPE_SCROLLABLE, NULL))
#endif
-#else
-#ifdef VTE_DEBUG
-G_DEFINE_TYPE_WITH_CODE(VteTerminal, vte_terminal, GTK_TYPE_WIDGET,
- if (_vte_debug_on(VTE_DEBUG_LIFECYCLE)) {
- g_printerr("vte_terminal_get_type()\n");
- })
-#else
-G_DEFINE_TYPE(VteTerminal, vte_terminal, GTK_TYPE_WIDGET)
-#endif
-#endif /* GTK 3.0 */
/* Indexes in the "palette" color array for the dim colors.
* Only the first %VTE_LEGACY_COLOR_SET_SIZE colors have dim versions. */
@@ -330,11 +313,12 @@ _vte_terminal_ring_insert (VteTerminal *terminal, glong position, gboolean fill)
VteRing *ring = terminal->pvt->screen->row_data;
while (G_UNLIKELY (_vte_ring_next (ring) < position)) {
row = _vte_ring_append (ring);
- _vte_row_data_fill (row, &terminal->pvt->screen->fill_defaults, terminal->column_count);
+ if (terminal->pvt->screen->fill_defaults.attr.back != VTE_DEFAULT_BG)
+ _vte_row_data_fill (row, &terminal->pvt->screen->fill_defaults, terminal->pvt->column_count);
}
row = _vte_ring_insert (ring, position);
- if (fill)
- _vte_row_data_fill (row, &terminal->pvt->screen->fill_defaults, terminal->column_count);
+ if (fill && terminal->pvt->screen->fill_defaults.attr.back != VTE_DEFAULT_BG)
+ _vte_row_data_fill (row, &terminal->pvt->screen->fill_defaults, terminal->pvt->column_count);
return row;
}
@@ -369,15 +353,17 @@ _vte_invalidate_cells(VteTerminal *terminal,
glong column_start, gint column_count,
glong row_start, gint row_count)
{
- VteRegionRectangle rect;
+ cairo_rectangle_int_t rect;
glong i;
+ if (G_UNLIKELY (!gtk_widget_get_realized(&terminal->widget)))
+ return;
+
if (!column_count || !row_count) {
return;
}
- if (G_UNLIKELY (! gtk_widget_is_drawable (&terminal->widget)
- || terminal->pvt->invalidated_all)) {
+ if (terminal->pvt->invalidated_all) {
return;
}
@@ -394,25 +380,25 @@ _vte_invalidate_cells(VteTerminal *terminal,
row_start -= terminal->pvt->screen->scroll_delta;
/* Ensure the start of region is on screen */
- if (column_start > terminal->column_count ||
- row_start > terminal->row_count) {
+ if (column_start > terminal->pvt->column_count ||
+ row_start > terminal->pvt->row_count) {
return;
}
/* Clamp the start values to reasonable numbers. */
i = row_start + row_count;
row_start = MAX (0, row_start);
- row_count = CLAMP (i - row_start, 0, terminal->row_count);
+ row_count = CLAMP (i - row_start, 0, terminal->pvt->row_count);
i = column_start + column_count;
column_start = MAX (0, column_start);
- column_count = CLAMP (i - column_start, 0 , terminal->column_count);
+ column_count = CLAMP (i - column_start, 0 , terminal->pvt->column_count);
if (!column_count || !row_count) {
return;
}
- if (column_count == terminal->column_count &&
- row_count == terminal->row_count) {
+ if (column_count == terminal->pvt->column_count &&
+ row_count == terminal->pvt->row_count) {
_vte_invalidate_all (terminal);
return;
}
@@ -421,23 +407,23 @@ _vte_invalidate_cells(VteTerminal *terminal,
* by multiplying by the size of a character cell.
* Always include the extra pixel border and overlap pixel.
*/
- rect.x = column_start * terminal->char_width - 1;
+ rect.x = column_start * terminal->pvt->char_width - 1;
if (column_start != 0) {
- rect.x += terminal->pvt->inner_border.left;
+ rect.x += terminal->pvt->padding.left;
}
- rect.width = (column_start + column_count) * terminal->char_width + 3 + terminal->pvt->inner_border.left;
- if (column_start + column_count == terminal->column_count) {
- rect.width += terminal->pvt->inner_border.right;
+ rect.width = (column_start + column_count) * terminal->pvt->char_width + 3 + terminal->pvt->padding.left;
+ if (column_start + column_count == terminal->pvt->column_count) {
+ rect.width += terminal->pvt->padding.right;
}
rect.width -= rect.x;
- rect.y = row_start * terminal->char_height - 1;
+ rect.y = row_start * terminal->pvt->char_height - 1;
if (row_start != 0) {
- rect.y += terminal->pvt->inner_border.top;
+ rect.y += terminal->pvt->padding.top;
}
- rect.height = (row_start + row_count) * terminal->char_height + 2 + terminal->pvt->inner_border.top;
- if (row_start + row_count == terminal->row_count) {
- rect.height += terminal->pvt->inner_border.bottom;
+ rect.height = (row_start + row_count) * terminal->pvt->char_height + 2 + terminal->pvt->padding.top;
+ if (row_start + row_count == terminal->pvt->row_count) {
+ rect.height += terminal->pvt->padding.bottom;
}
rect.height -= rect.y;
@@ -448,7 +434,7 @@ _vte_invalidate_cells(VteTerminal *terminal,
if (terminal->pvt->active != NULL) {
terminal->pvt->update_regions = g_slist_prepend (
terminal->pvt->update_regions,
- gdk_region_rectangle (&rect));
+ cairo_region_create_rectangle (&rect));
/* Wait a bit before doing any invalidation, just in
* case updates are coming in really soon. */
add_update_timeout (terminal);
@@ -472,10 +458,10 @@ _vte_invalidate_region (VteTerminal *terminal,
} else {
_vte_invalidate_cells(terminal,
scolumn,
- terminal->column_count - scolumn,
+ terminal->pvt->column_count - scolumn,
srow, 1);
_vte_invalidate_cells(terminal,
- 0, terminal->column_count,
+ 0, terminal->pvt->column_count,
srow + 1, erow - srow - 1);
_vte_invalidate_cells(terminal,
0, ecolumn + 1,
@@ -488,14 +474,14 @@ _vte_invalidate_region (VteTerminal *terminal,
void
_vte_invalidate_all(VteTerminal *terminal)
{
- VteRegionRectangle rect;
+ cairo_rectangle_int_t rect;
GtkAllocation allocation;
g_assert(VTE_IS_TERMINAL(terminal));
- if (! gtk_widget_is_drawable (&terminal->widget)) {
- return;
- }
+ if (G_UNLIKELY (!gtk_widget_get_realized(&terminal->widget)))
+ return;
+
if (terminal->pvt->invalidated_all) {
return;
}
@@ -514,7 +500,7 @@ _vte_invalidate_all(VteTerminal *terminal)
if (terminal->pvt->active != NULL) {
terminal->pvt->update_regions = g_slist_prepend (NULL,
- gdk_region_rectangle (&rect));
+ cairo_region_create_rectangle (&rect));
/* Wait a bit before doing any invalidation, just in
* case updates are coming in really soon. */
add_update_timeout (terminal);
@@ -534,14 +520,14 @@ _vte_terminal_scroll_region (VteTerminal *terminal,
return;
}
- if (terminal->pvt->scroll_background || count >= terminal->row_count) {
+ if (count >= terminal->pvt->row_count) {
/* We have to repaint the entire window. */
_vte_invalidate_all(terminal);
} else {
/* We have to repaint the area which is to be
* scrolled. */
_vte_invalidate_cells(terminal,
- 0, terminal->column_count,
+ 0, terminal->pvt->column_count,
row, count);
}
}
@@ -615,7 +601,7 @@ find_end_column (VteTerminal *terminal, glong col, glong row)
columns = cell->attr.columns - 1;
}
}
- return MIN(col + columns, terminal->column_count);
+ return MIN(col + columns, terminal->pvt->column_count);
}
@@ -673,9 +659,12 @@ _vte_invalidate_cell(VteTerminal *terminal, glong col, glong row)
{
const VteRowData *row_data;
int columns;
+ guint style;
+
+ if (G_UNLIKELY (!gtk_widget_get_realized(&terminal->widget)))
+ return;
- if (G_UNLIKELY (! gtk_widget_is_drawable (&terminal->widget)
- || terminal->pvt->invalidated_all)) {
+ if (terminal->pvt->invalidated_all) {
return;
}
@@ -689,12 +678,12 @@ _vte_invalidate_cell(VteTerminal *terminal, glong col, glong row)
cell = _vte_row_data_get (row_data, --col);
}
columns = cell->attr.columns;
+ style = _vte_draw_get_style(cell->attr.bold, cell->attr.italic);
if (cell->c != 0 &&
_vte_draw_get_char_width (
terminal->pvt->draw,
- cell->c,
- columns, cell->attr.bold) >
- terminal->char_width * columns) {
+ cell->c, columns, style) >
+ terminal->pvt->char_width * columns) {
columns++;
}
}
@@ -717,6 +706,10 @@ _vte_invalidate_cursor_once(VteTerminal *terminal, gboolean periodic)
gssize preedit_width;
glong column, row;
gint columns;
+ guint style;
+
+ if (G_UNLIKELY(!gtk_widget_get_realized(&terminal->widget)))
+ return;
if (terminal->pvt->invalidated_all) {
return;
@@ -728,7 +721,7 @@ _vte_invalidate_cursor_once(VteTerminal *terminal, gboolean periodic)
}
}
- if (terminal->pvt->cursor_visible && gtk_widget_is_drawable (&terminal->widget)) {
+ if (terminal->pvt->cursor_visible) {
preedit_width = vte_terminal_preedit_width(terminal, FALSE);
screen = terminal->pvt->screen;
@@ -739,12 +732,13 @@ _vte_invalidate_cursor_once(VteTerminal *terminal, gboolean periodic)
cell = vte_terminal_find_charcell(terminal, column, row);
if (cell != NULL) {
columns = cell->attr.columns;
+ style = _vte_draw_get_style(cell->attr.bold, cell->attr.italic);
if (cell->c != 0 &&
_vte_draw_get_char_width (
terminal->pvt->draw,
cell->c,
- columns, cell->attr.bold) >
- terminal->char_width * columns) {
+ columns, style) >
+ terminal->pvt->char_width * columns) {
columns++;
}
}
@@ -847,11 +841,12 @@ vte_terminal_emit_encoding_changed(VteTerminal *terminal)
/* Emit a "child-exited" signal. */
static void
-vte_terminal_emit_child_exited(VteTerminal *terminal)
+vte_terminal_emit_child_exited(VteTerminal *terminal,
+ int status)
{
_vte_debug_print(VTE_DEBUG_SIGNALS,
"Emitting `child-exited'.\n");
- g_signal_emit_by_name(terminal, "child-exited");
+ g_signal_emit_by_name(terminal, "child-exited", status);
}
/* Emit a "contents_changed" signal. */
@@ -905,9 +900,15 @@ vte_terminal_emit_eof(VteTerminal *terminal)
{
_vte_debug_print(VTE_DEBUG_SIGNALS,
"Emitting `eof'.\n");
- GDK_THREADS_ENTER ();
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ gdk_threads_enter ();
+ G_GNUC_END_IGNORE_DEPRECATIONS;
+
g_signal_emit_by_name(terminal, "eof");
- GDK_THREADS_LEAVE ();
+
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ gdk_threads_leave ();
+ G_GNUC_END_IGNORE_DEPRECATIONS;
return FALSE;
}
@@ -1142,7 +1143,7 @@ regex_match_clear_cursor (struct vte_match_regex *regex)
switch (regex->cursor_mode) {
case VTE_REGEX_CURSOR_GDKCURSOR:
if (regex->cursor.cursor != NULL) {
- gdk_cursor_unref(regex->cursor.cursor);
+ g_object_unref(regex->cursor.cursor);
regex->cursor.cursor = NULL;
}
break;
@@ -1163,13 +1164,8 @@ regex_match_clear (struct vte_match_regex *regex)
{
regex_match_clear_cursor(regex);
- if (regex->mode == VTE_REGEX_GREGEX) {
- g_regex_unref(regex->regex.gregex.regex);
- regex->regex.gregex.regex = NULL;
- } else if (regex->mode == VTE_REGEX_VTE) {
- _vte_regex_free(regex->regex.reg);
- regex->regex.reg = NULL;
- }
+ g_regex_unref(regex->regex);
+ regex->regex = NULL;
regex->tag = -1;
}
@@ -1185,7 +1181,7 @@ vte_terminal_set_cursor_from_regex_match(VteTerminal *terminal, struct vte_match
switch (regex->cursor_mode) {
case VTE_REGEX_CURSOR_GDKCURSOR:
if (regex->cursor.cursor != NULL) {
- cursor = gdk_cursor_ref(regex->cursor.cursor);
+ cursor = g_object_ref(regex->cursor.cursor);
}
break;
case VTE_REGEX_CURSOR_GDKCURSORTYPE:
@@ -1202,18 +1198,20 @@ vte_terminal_set_cursor_from_regex_match(VteTerminal *terminal, struct vte_match
gdk_window_set_cursor (gtk_widget_get_window (&terminal->widget), cursor);
if (cursor)
- gdk_cursor_unref(cursor);
+ g_object_unref(cursor);
}
/**
- * vte_terminal_match_clear_all:
+ * vte_terminal_match_remove_all:
* @terminal: a #VteTerminal
*
* Clears the list of regular expressions the terminal uses to highlight text
* when the user moves the mouse cursor.
+ *
+ * Since: 0.30
*/
void
-vte_terminal_match_clear_all(VteTerminal *terminal)
+vte_terminal_match_remove_all(VteTerminal *terminal)
{
struct vte_match_regex *regex;
guint i;
@@ -1272,65 +1270,6 @@ vte_terminal_cursor_new(VteTerminal *terminal, GdkCursorType cursor_type)
}
/**
- * vte_terminal_match_add:
- * @terminal: a #VteTerminal
- * @match: a regular expression
- *
- * Adds a regular expression to the list of matching expressions. When the
- * user moves the mouse cursor over a section of displayed text which matches
- * this expression, the text will be highlighted.
- *
- * Returns: an integer associated with this expression
- *
- * Deprecated: 0.17.1: Use vte_terminal_match_add_gregex() instead
- */
-int
-vte_terminal_match_add(VteTerminal *terminal, const char *match)
-{
- struct vte_match_regex new_regex, *regex;
- guint ret;
- g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1);
- g_return_val_if_fail(terminal->pvt->match_regex_mode != VTE_REGEX_GREGEX, -1);
- g_return_val_if_fail(match != NULL, -1);
- g_return_val_if_fail(strlen(match) > 0, -1);
-
- terminal->pvt->match_regex_mode = VTE_REGEX_VTE;
-
- memset(&new_regex, 0, sizeof(new_regex));
- new_regex.mode = VTE_REGEX_VTE;
- new_regex.regex.reg = _vte_regex_compile(match);
- if (new_regex.regex.reg == NULL) {
- g_warning(_("Error compiling regular expression \"%s\"."),
- match);
- return -1;
- }
-
- /* Search for a hole. */
- for (ret = 0; ret < terminal->pvt->match_regexes->len; ret++) {
- regex = &g_array_index(terminal->pvt->match_regexes,
- struct vte_match_regex,
- ret);
- if (regex->tag == -1) {
- break;
- }
- }
- /* Set the tag to the insertion point. */
- new_regex.tag = ret;
- new_regex.cursor_mode = VTE_REGEX_CURSOR_GDKCURSORTYPE;
- new_regex.cursor.cursor_type = VTE_DEFAULT_CURSOR;
- if (ret < terminal->pvt->match_regexes->len) {
- /* Overwrite. */
- g_array_index(terminal->pvt->match_regexes,
- struct vte_match_regex,
- ret) = new_regex;
- } else {
- /* Append. */
- g_array_append_val(terminal->pvt->match_regexes, new_regex);
- }
- return new_regex.tag;
-}
-
-/**
* vte_terminal_match_add_gregex:
* @terminal: a #VteTerminal
* @regex: a #GRegex
@@ -1352,11 +1291,9 @@ vte_terminal_match_add_gregex(VteTerminal *terminal, GRegex *regex, GRegexMatchF
guint ret, len;
g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1);
- g_return_val_if_fail(terminal->pvt->match_regex_mode != VTE_REGEX_VTE, -1);
g_return_val_if_fail(regex != NULL, -1);
pvt = terminal->pvt;
- pvt->match_regex_mode = VTE_REGEX_GREGEX;
/* Search for a hole. */
len = pvt->match_regexes->len;
@@ -1370,9 +1307,8 @@ vte_terminal_match_add_gregex(VteTerminal *terminal, GRegex *regex, GRegexMatchF
}
/* Set the tag to the insertion point. */
- new_regex_match.mode = VTE_REGEX_GREGEX;
- new_regex_match.regex.gregex.regex = g_regex_ref(regex);
- new_regex_match.regex.gregex.flags = flags;
+ new_regex_match.regex = g_regex_ref(regex);
+ new_regex_match.match_flags = flags;
new_regex_match.tag = ret;
new_regex_match.cursor_mode = VTE_REGEX_CURSOR_GDKCURSORTYPE;
new_regex_match.cursor.cursor_type = VTE_DEFAULT_CURSOR;
@@ -1413,7 +1349,7 @@ vte_terminal_match_set_cursor(VteTerminal *terminal, int tag, GdkCursor *cursor)
tag);
regex_match_clear_cursor(regex);
regex->cursor_mode = VTE_REGEX_CURSOR_GDKCURSOR;
- regex->cursor.cursor = cursor ? gdk_cursor_ref(cursor) : NULL;
+ regex->cursor.cursor = cursor ? g_object_ref(cursor) : NULL;
vte_terminal_match_hilite_clear(terminal);
}
@@ -1478,231 +1414,6 @@ vte_terminal_match_set_cursor_name(VteTerminal *terminal,
* it does, return the string, and store the match tag in the optional tag
* argument. */
static char *
-vte_terminal_match_check_internal_vte(VteTerminal *terminal,
- long column, glong row,
- int *tag, int *start, int *end)
-{
- struct _vte_regex_match matches[256];
- guint i, j;
- gint k;
- gint start_blank, end_blank;
- int ret, offset;
- struct vte_match_regex *regex = NULL;
- struct _VteCharAttributes *attr = NULL;
- gssize sattr, eattr;
- gchar *line, eol;
-
- _vte_debug_print(VTE_DEBUG_EVENTS,
- "Checking for match at (%ld,%ld).\n", row, column);
- *tag = -1;
- if (start != NULL) {
- *start = 0;
- }
- if (end != NULL) {
- *end = 0;
- }
- /* Map the pointer position to a portion of the string. */
- eattr = terminal->pvt->match_attributes->len;
- for (offset = eattr; offset--; ) {
- attr = &g_array_index(terminal->pvt->match_attributes,
- struct _VteCharAttributes,
- offset);
- if (row < attr->row) {
- eattr = offset;
- }
- if (row == attr->row &&
- column == attr->column &&
- terminal->pvt->match_contents[offset] != ' ') {
- break;
- }
- }
-
- _VTE_DEBUG_IF(VTE_DEBUG_EVENTS) {
- if (offset < 0)
- g_printerr("Cursor is not on a character.\n");
- else
- g_printerr("Cursor is on character '%c' at %d.\n",
- g_utf8_get_char (terminal->pvt->match_contents + offset),
- offset);
- }
-
- /* If the pointer isn't on a matchable character, bug out. */
- if (offset < 0) {
- return NULL;
- }
-
- /* If the pointer is on a newline, bug out. */
- if ((g_ascii_isspace(terminal->pvt->match_contents[offset])) ||
- (terminal->pvt->match_contents[offset] == '\0')) {
- _vte_debug_print(VTE_DEBUG_EVENTS,
- "Cursor is on whitespace.\n");
- return NULL;
- }
-
- /* Snip off any final newlines. */
- while (terminal->pvt->match_contents[eattr] == '\n' ||
- terminal->pvt->match_contents[eattr] == '\0') {
- eattr--;
- }
- /* and scan forwards to find the end of this line */
- while (!(terminal->pvt->match_contents[eattr] == '\n' ||
- terminal->pvt->match_contents[eattr] == '\0')) {
- eattr++;
- }
-
- /* find the start of row */
- if (row == 0) {
- sattr = 0;
- } else {
- for (sattr = offset; sattr > 0; sattr--) {
- attr = &g_array_index(terminal->pvt->match_attributes,
- struct _VteCharAttributes,
- sattr);
- if (row > attr->row) {
- break;
- }
- }
- }
- /* Scan backwards to find the start of this line */
- while (sattr > 0 &&
- ! (terminal->pvt->match_contents[sattr] == '\n' ||
- terminal->pvt->match_contents[sattr] == '\0')) {
- sattr--;
- }
- /* and skip any initial newlines. */
- while (terminal->pvt->match_contents[sattr] == '\n' ||
- terminal->pvt->match_contents[sattr] == '\0') {
- sattr++;
- }
- if (eattr <= sattr) { /* blank line */
- return NULL;
- }
- if (eattr <= offset || sattr > offset) {
- /* nothing to match on this line */
- return NULL;
- }
- offset -= sattr;
- eattr -= sattr;
-
- /* temporarily shorten the contents to this row */
- line = terminal->pvt->match_contents + sattr;
- eol = line[eattr];
- line[eattr] = '\0';
-
- start_blank = 0;
- end_blank = eattr;
-
- /* Now iterate over each regex we need to match against. */
- for (i = 0; i < terminal->pvt->match_regexes->len; i++) {
- regex = &g_array_index(terminal->pvt->match_regexes,
- struct vte_match_regex,
- i);
- /* Skip holes. */
- if (regex->tag < 0) {
- continue;
- }
- /* We'll only match the first item in the buffer which
- * matches, so we'll have to skip each match until we
- * stop getting matches. */
- k = 0;
- ret = _vte_regex_exec(regex->regex.reg,
- line + k,
- G_N_ELEMENTS(matches),
- matches);
- while (ret == 0) {
- gint ko = offset - k;
- gint sblank=G_MININT, eblank=G_MAXINT;
- for (j = 0;
- j < G_N_ELEMENTS(matches) &&
- matches[j].rm_so != -1;
- j++) {
- /* The offsets should be "sane". */
- g_assert(matches[j].rm_so + k < eattr);
- g_assert(matches[j].rm_eo + k <= eattr);
- _VTE_DEBUG_IF(VTE_DEBUG_MISC) {
- gchar *match;
- struct _VteCharAttributes *_sattr, *_eattr;
- match = g_strndup(line + matches[j].rm_so + k,
- matches[j].rm_eo - matches[j].rm_so);
- _sattr = &g_array_index(terminal->pvt->match_attributes,
- struct _VteCharAttributes,
- matches[j].rm_so + k);
- _eattr = &g_array_index(terminal->pvt->match_attributes,
- struct _VteCharAttributes,
- matches[j].rm_eo + k - 1);
- g_printerr("Match %u `%s' from %d(%ld,%ld) to %d(%ld,%ld) (%d).\n",
- j, match,
- matches[j].rm_so + k,
- _sattr->column,
- _sattr->row,
- matches[j].rm_eo + k - 1,
- _eattr->column,
- _eattr->row,
- offset);
- g_free(match);
-
- }
- /* If the pointer is in this substring,
- * then we're done. */
- if (ko >= matches[j].rm_so &&
- ko < matches[j].rm_eo) {
- gchar *result;
- if (tag != NULL) {
- *tag = regex->tag;
- }
- if (start != NULL) {
- *start = sattr + k + matches[j].rm_so;
- }
- if (end != NULL) {
- *end = sattr + k + matches[j].rm_eo - 1;
- }
- vte_terminal_set_cursor_from_regex_match(terminal, regex);
- result = g_strndup(line + k + matches[j].rm_so,
- matches[j].rm_eo - matches[j].rm_so);
- line[eattr] = eol;
- return result;
- }
- if (ko > matches[j].rm_eo &&
- matches[j].rm_eo > sblank) {
- sblank = matches[j].rm_eo;
- }
- if (ko < matches[j].rm_so &&
- matches[j].rm_so < eblank) {
- eblank = matches[j].rm_so;
- }
- }
- if (k + sblank > start_blank) {
- start_blank = k + sblank;
- }
- if (k + eblank < end_blank) {
- end_blank = k + eblank;
- }
- /* Skip past the beginning of this match to
- * look for more. */
- k += matches[0].rm_so + 1;
- if (k > offset) {
- break;
- }
- ret = _vte_regex_exec(regex->regex.reg,
- line + k,
- G_N_ELEMENTS(matches),
- matches);
- }
- }
- line[eattr] = eol;
- if (start != NULL) {
- *start = sattr + start_blank;
- }
- if (end != NULL) {
- *end = sattr + end_blank;
- }
- return NULL;
-}
-
-/* Check if a given cell on the screen contains part of a matched string. If
- * it does, return the string, and store the match tag in the optional tag
- * argument. */
-static char *
vte_terminal_match_check_internal_gregex(VteTerminal *terminal,
long column, glong row,
int *tag, int *start, int *end)
@@ -1718,7 +1429,9 @@ vte_terminal_match_check_internal_gregex(VteTerminal *terminal,
_vte_debug_print(VTE_DEBUG_EVENTS,
"Checking for gregex match at (%ld,%ld).\n", row, column);
- *tag = -1;
+ if (tag != NULL) {
+ *tag = -1;
+ }
if (start != NULL) {
*start = 0;
}
@@ -1828,9 +1541,9 @@ vte_terminal_match_check_internal_gregex(VteTerminal *terminal,
/* We'll only match the first item in the buffer which
* matches, so we'll have to skip each match until we
* stop getting matches. */
- if (!g_regex_match_full(regex->regex.gregex.regex,
+ if (!g_regex_match_full(regex->regex,
line, -1, 0,
- regex->regex.gregex.flags,
+ regex->match_flags,
&match_info,
NULL)) {
g_match_info_free(match_info);
@@ -1929,11 +1642,7 @@ vte_terminal_match_check_internal(VteTerminal *terminal,
vte_terminal_match_contents_refresh(terminal);
}
- if (terminal->pvt->match_regex_mode == VTE_REGEX_GREGEX)
- return vte_terminal_match_check_internal_gregex(terminal, column, row, tag, start, end);
- if (terminal->pvt->match_regex_mode == VTE_REGEX_VTE)
- return vte_terminal_match_check_internal_vte(terminal, column, row, tag, start, end);
- return NULL;
+ return vte_terminal_match_check_internal_gregex(terminal, column, row, tag, start, end);
}
static gboolean
@@ -2016,15 +1725,15 @@ vte_terminal_emit_adjustment_changed(VteTerminal *terminal)
glong v;
gdouble current;
- g_object_freeze_notify (G_OBJECT (terminal->adjustment));
+ g_object_freeze_notify (G_OBJECT (terminal->pvt->vadjustment));
v = _vte_ring_delta (screen->row_data);
- current = gtk_adjustment_get_lower(terminal->adjustment);
+ current = gtk_adjustment_get_lower(terminal->pvt->vadjustment);
if (current != v) {
_vte_debug_print(VTE_DEBUG_ADJ,
"Changing lower bound from %.0f to %ld\n",
current, v);
- gtk_adjustment_set_lower(terminal->adjustment, v);
+ gtk_adjustment_set_lower(terminal->pvt->vadjustment, v);
changed = TRUE;
}
@@ -2032,16 +1741,16 @@ vte_terminal_emit_adjustment_changed(VteTerminal *terminal)
* one to the cursor offset because it's zero-based.) */
v = MAX(_vte_ring_next(screen->row_data),
screen->cursor_current.row + 1);
- current = gtk_adjustment_get_upper(terminal->adjustment);
+ current = gtk_adjustment_get_upper(terminal->pvt->vadjustment);
if (current != v) {
_vte_debug_print(VTE_DEBUG_ADJ,
"Changing upper bound from %.0f to %ld\n",
current, v);
- gtk_adjustment_set_upper(terminal->adjustment, v);
+ gtk_adjustment_set_upper(terminal->pvt->vadjustment, v);
changed = TRUE;
}
- g_object_thaw_notify (G_OBJECT (terminal->adjustment));
+ g_object_thaw_notify (G_OBJECT (terminal->pvt->vadjustment));
if (changed)
_vte_debug_print(VTE_DEBUG_SIGNALS,
@@ -2053,7 +1762,7 @@ vte_terminal_emit_adjustment_changed(VteTerminal *terminal)
_vte_debug_print(VTE_DEBUG_SIGNALS,
"Emitting adjustment_value_changed.\n");
terminal->pvt->adjustment_value_changed_pending = FALSE;
- v = round (gtk_adjustment_get_value(terminal->adjustment));
+ v = round (gtk_adjustment_get_value(terminal->pvt->vadjustment));
if (v != terminal->pvt->screen->scroll_delta) {
/* this little dance is so that the scroll_delta is
* updated immediately, but we still handled scrolling
@@ -2062,7 +1771,7 @@ vte_terminal_emit_adjustment_changed(VteTerminal *terminal)
*/
delta = terminal->pvt->screen->scroll_delta;
terminal->pvt->screen->scroll_delta = v;
- gtk_adjustment_set_value(terminal->adjustment, delta);
+ gtk_adjustment_set_value(terminal->pvt->vadjustment, delta);
}
}
}
@@ -2090,10 +1799,10 @@ vte_terminal_queue_adjustment_value_changed_clamped(VteTerminal *terminal, glong
{
gdouble lower, upper;
- lower = gtk_adjustment_get_lower(terminal->adjustment);
- upper = gtk_adjustment_get_upper(terminal->adjustment);
+ lower = gtk_adjustment_get_lower(terminal->pvt->vadjustment);
+ upper = gtk_adjustment_get_upper(terminal->pvt->vadjustment);
- v = CLAMP(v, lower, MAX (lower, upper - terminal->row_count));
+ v = CLAMP(v, lower, MAX (lower, upper - terminal->pvt->row_count));
vte_terminal_queue_adjustment_value_changed (terminal, v);
}
@@ -2139,44 +1848,44 @@ _vte_terminal_adjust_adjustments_full (VteTerminal *terminal)
_vte_terminal_adjust_adjustments(terminal);
- g_object_freeze_notify(G_OBJECT(terminal->adjustment));
+ g_object_freeze_notify(G_OBJECT(terminal->pvt->vadjustment));
/* The step increment should always be one. */
- v = gtk_adjustment_get_step_increment(terminal->adjustment);
+ v = gtk_adjustment_get_step_increment(terminal->pvt->vadjustment);
if (v != 1) {
_vte_debug_print(VTE_DEBUG_ADJ,
"Changing step increment from %.0lf to %ld\n",
- v, terminal->row_count);
- gtk_adjustment_set_step_increment(terminal->adjustment, 1);
+ v, terminal->pvt->row_count);
+ gtk_adjustment_set_step_increment(terminal->pvt->vadjustment, 1);
changed = TRUE;
}
/* Set the number of rows the user sees to the number of rows the
* user sees. */
- v = gtk_adjustment_get_page_size(terminal->adjustment);
- if (v != terminal->row_count) {
+ v = gtk_adjustment_get_page_size(terminal->pvt->vadjustment);
+ if (v != terminal->pvt->row_count) {
_vte_debug_print(VTE_DEBUG_ADJ,
"Changing page size from %.0f to %ld\n",
- v, terminal->row_count);
- gtk_adjustment_set_page_size(terminal->adjustment,
- terminal->row_count);
+ v, terminal->pvt->row_count);
+ gtk_adjustment_set_page_size(terminal->pvt->vadjustment,
+ terminal->pvt->row_count);
changed = TRUE;
}
/* Clicking in the empty area should scroll one screen, so set the
* page size to the number of visible rows. */
- v = gtk_adjustment_get_page_increment(terminal->adjustment);
- if (v != terminal->row_count) {
+ v = gtk_adjustment_get_page_increment(terminal->pvt->vadjustment);
+ if (v != terminal->pvt->row_count) {
_vte_debug_print(VTE_DEBUG_ADJ,
"Changing page increment from "
"%.0f to %ld\n",
- v, terminal->row_count);
- gtk_adjustment_set_page_increment(terminal->adjustment,
- terminal->row_count);
+ v, terminal->pvt->row_count);
+ gtk_adjustment_set_page_increment(terminal->pvt->vadjustment,
+ terminal->pvt->row_count);
changed = TRUE;
}
- g_object_thaw_notify(G_OBJECT(terminal->adjustment));
+ g_object_thaw_notify(G_OBJECT(terminal->pvt->vadjustment));
if (changed)
_vte_debug_print(VTE_DEBUG_SIGNALS,
@@ -2200,7 +1909,7 @@ vte_terminal_scroll_lines(VteTerminal *terminal, gint lines)
static void
vte_terminal_scroll_pages(VteTerminal *terminal, gint pages)
{
- vte_terminal_scroll_lines(terminal, pages * terminal->row_count);
+ vte_terminal_scroll_lines(terminal, pages * terminal->pvt->row_count);
}
/* Scroll so that the scroll delta is the minimum value. */
@@ -2288,11 +1997,11 @@ vte_terminal_set_encoding(VteTerminal *terminal, const char *codeset)
terminal->pvt->encoding = g_intern_string(codeset);
/* Convert any buffered output bytes. */
- if ((_vte_buffer_length(terminal->pvt->outgoing) > 0) &&
+ if ((_vte_byte_array_length(terminal->pvt->outgoing) > 0) &&
(old_codeset != NULL)) {
/* Convert back to UTF-8. */
obuf1 = g_convert((gchar *)terminal->pvt->outgoing->data,
- _vte_buffer_length(terminal->pvt->outgoing),
+ _vte_byte_array_length(terminal->pvt->outgoing),
"UTF-8",
old_codeset,
NULL,
@@ -2308,8 +2017,8 @@ vte_terminal_set_encoding(VteTerminal *terminal, const char *codeset)
&bytes_written,
NULL);
if (obuf2 != NULL) {
- _vte_buffer_clear(terminal->pvt->outgoing);
- _vte_buffer_append(terminal->pvt->outgoing,
+ _vte_byte_array_clear(terminal->pvt->outgoing);
+ _vte_byte_array_append(terminal->pvt->outgoing,
obuf2, bytes_written);
g_free(obuf2);
}
@@ -2345,6 +2054,49 @@ vte_terminal_get_encoding(VteTerminal *terminal)
return terminal->pvt->encoding;
}
+/**
+ * vte_terminal_set_cjk_ambiguous_width:
+ * @terminal: a #VteTerminal
+ * @width: either 1 (narrow) or 2 (wide)
+ *
+ * This setting controls whether ambiguous-width characters are narrow or wide
+ * when using the UTF-8 encoding (vte_terminal_set_encoding()). In all other encodings,
+ * the width of ambiguous-width characters is fixed.
+ *
+ * This setting only takes effect the next time the terminal is reset, either
+ * via escape sequence or with vte_terminal_reset().
+ *
+ * Since: 0.38
+ */
+void
+vte_terminal_set_cjk_ambiguous_width(VteTerminal *terminal, int width)
+{
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
+ g_return_if_fail(width == 1 || width == 2);
+
+ terminal->pvt->iso2022_utf8_ambiguous_width = width;
+ if (terminal->pvt->pty == NULL)
+ _vte_iso2022_state_set_utf8_ambiguous_width(terminal->pvt->iso2022, width);
+}
+
+/**
+ * vte_terminal_get_cjk_ambiguous_width:
+ * @terminal: a #VteTerminal
+ *
+ * Returns whether ambiguous-width characters are narrow or wide when using
+ * the UTF-8 encoding (vte_terminal_set_encoding()).
+ *
+ * Returns: 1 if ambiguous-width characters are narrow, or 2 if they are wide
+ *
+ * Since: 0.38
+ */
+int
+vte_terminal_get_cjk_ambiguous_width(VteTerminal *terminal)
+{
+ g_return_val_if_fail(VTE_IS_TERMINAL(terminal), 1);
+ return terminal->pvt->iso2022_utf8_ambiguous_width;
+}
+
static inline VteRowData *
vte_terminal_insert_rows (VteTerminal *terminal, guint cnt)
{
@@ -2418,9 +2170,9 @@ _vte_terminal_update_insert_delta(VteTerminal *terminal)
* the buffer (even if it's empty). This usually causes the
* top row to become a history-only row. */
delta = screen->insert_delta;
- delta = MIN(delta, rows - terminal->row_count);
+ delta = MIN(delta, rows - terminal->pvt->row_count);
delta = MAX(delta,
- screen->cursor_current.row - (terminal->row_count - 1));
+ screen->cursor_current.row - (terminal->pvt->row_count - 1));
delta = MAX(delta, _vte_ring_delta(screen->row_data));
/* Adjust the insert delta and scroll if needed. */
@@ -2472,7 +2224,7 @@ _vte_terminal_set_pointer_visible(VteTerminal *terminal, gboolean visible)
*
* Creates a new terminal widget.
*
- * Returns: (transfer full) (type Vte.Terminal): a new #VteTerminal object
+ * Returns: (transfer none) (type Vte.Terminal): a new #VteTerminal object
*/
GtkWidget *
vte_terminal_new(void)
@@ -2480,30 +2232,56 @@ vte_terminal_new(void)
return g_object_new(VTE_TYPE_TERMINAL, NULL);
}
+/* Get the actually used color from the palette. */
+PangoColor *
+_vte_terminal_get_color(const VteTerminal *terminal, int entry)
+{
+ VtePaletteColor *palette_color = &terminal->pvt->palette[entry];
+ guint source;
+ for (source = 0; source < G_N_ELEMENTS(palette_color->sources); source++)
+ if (palette_color->sources[source].is_set)
+ return &palette_color->sources[source].color;
+ return NULL;
+}
+
/* Set up a palette entry with a more-or-less match for the requested color. */
-static void
-vte_terminal_set_color_internal(VteTerminal *terminal, int entry,
- const GdkColor *proposed)
+void
+_vte_terminal_set_color_internal(VteTerminal *terminal,
+ int entry,
+ int source,
+ const PangoColor *proposed)
{
- PangoColor *color;
+ VtePaletteColor *palette_color = &terminal->pvt->palette[entry];
- color = &terminal->pvt->palette[entry];
+ /* Save the requested color. */
+ if (proposed != NULL) {
+ _vte_debug_print(VTE_DEBUG_MISC,
+ "Set %s color[%d] to (%04x,%04x,%04x).\n",
+ source == VTE_COLOR_SOURCE_ESCAPE ? "escape" : "API",
+ entry, proposed->red, proposed->green, proposed->blue);
+
+ if (palette_color->sources[source].is_set &&
+ palette_color->sources[source].color.red == proposed->red &&
+ palette_color->sources[source].color.green == proposed->green &&
+ palette_color->sources[source].color.blue == proposed->blue) {
+ return;
+ }
+ palette_color->sources[source].is_set = TRUE;
+ palette_color->sources[source].color.red = proposed->red;
+ palette_color->sources[source].color.green = proposed->green;
+ palette_color->sources[source].color.blue = proposed->blue;
+ } else {
+ _vte_debug_print(VTE_DEBUG_MISC,
+ "Reset %s color[%d].\n",
+ source == VTE_COLOR_SOURCE_ESCAPE ? "escape" : "API",
+ entry);
- if (color->red == proposed->red &&
- color->green == proposed->green &&
- color->blue == proposed->blue) {
- return;
+ if (!palette_color->sources[source].is_set) {
+ return;
+ }
+ palette_color->sources[source].is_set = FALSE;
}
- _vte_debug_print(VTE_DEBUG_MISC,
- "Set color[%d] to (%04x,%04x,%04x).\n", entry,
- proposed->red, proposed->green, proposed->blue);
-
- /* Save the requested color. */
- color->red = proposed->red;
- color->green = proposed->green;
- color->blue = proposed->blue;
-
/* If we're not realized yet, there's nothing else to do. */
if (! gtk_widget_get_realized (&terminal->widget)) {
return;
@@ -2511,12 +2289,12 @@ vte_terminal_set_color_internal(VteTerminal *terminal, int entry,
/* If we're setting the background color, set the background color
* on the widget as well. */
- if (entry == VTE_DEF_BG) {
- vte_terminal_queue_background_update(terminal);
+ if (entry == VTE_DEFAULT_BG) {
+ vte_terminal_background_update(terminal);
}
/* and redraw */
- if (entry == VTE_CUR_BG)
+ if (entry == VTE_CURSOR_BG)
_vte_invalidate_cursor_once(terminal, FALSE);
else
_vte_invalidate_all (terminal);
@@ -2526,7 +2304,7 @@ static void
vte_terminal_generate_bold(const PangoColor *foreground,
const PangoColor *background,
double factor,
- GdkColor *bold)
+ PangoColor *bold /* (out) (callee allocates) */)
{
double fy, fcb, fcr, by, bcb, bcr, r, g, b;
g_assert(foreground != NULL);
@@ -2560,7 +2338,6 @@ vte_terminal_generate_bold(const PangoColor *foreground,
"Calculated bold (%d, %d, %d) = (%lf,%lf,%lf)",
foreground->red, foreground->green, foreground->blue,
r, g, b);
- bold->pixel = 0;
bold->red = CLAMP(r, 0, 0xffff);
bold->green = CLAMP(g, 0, 0xffff);
bold->blue = CLAMP(b, 0, 0xffff);
@@ -2569,154 +2346,179 @@ vte_terminal_generate_bold(const PangoColor *foreground,
bold->red, bold->green, bold->blue);
}
-/**
- * vte_terminal_set_color_bold:
+/*
+ * _vte_terminal_set_color_bold:
* @terminal: a #VteTerminal
* @bold: the new bold color
*
* Sets the color used to draw bold text in the default foreground color.
*/
-void
-vte_terminal_set_color_bold(VteTerminal *terminal, const GdkColor *bold)
+static void
+_vte_terminal_set_color_bold(VteTerminal *terminal,
+ const PangoColor *bold)
{
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
- g_return_if_fail(bold != NULL);
-
_vte_debug_print(VTE_DEBUG_MISC,
"Set bold color to (%04x,%04x,%04x).\n",
bold->red, bold->green, bold->blue);
- vte_terminal_set_color_internal(terminal, VTE_BOLD_FG, bold);
+ _vte_terminal_set_color_internal(terminal, VTE_BOLD_FG, VTE_COLOR_SOURCE_API, bold);
}
-/**
- * vte_terminal_set_color_dim:
+/*
+ * _vte_terminal_set_color_dim:
* @terminal: a #VteTerminal
* @dim: the new dim color
*
* Sets the color used to draw dim text in the default foreground color.
*/
-void
-vte_terminal_set_color_dim(VteTerminal *terminal, const GdkColor *dim)
+static void
+_vte_terminal_set_color_dim(VteTerminal *terminal,
+ const PangoColor *dim)
{
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
- g_return_if_fail(dim != NULL);
-
_vte_debug_print(VTE_DEBUG_MISC,
"Set dim color to (%04x,%04x,%04x).\n",
dim->red, dim->green, dim->blue);
- vte_terminal_set_color_internal(terminal, VTE_DIM_FG, dim);
+ _vte_terminal_set_color_internal(terminal, VTE_DIM_FG, VTE_COLOR_SOURCE_API, dim);
}
-/**
- * vte_terminal_set_color_foreground:
+/*
+ * _vte_terminal_set_color_foreground:
* @terminal: a #VteTerminal
* @foreground: the new foreground color
*
* Sets the foreground color used to draw normal text
*/
-void
-vte_terminal_set_color_foreground(VteTerminal *terminal,
- const GdkColor *foreground)
+static void
+_vte_terminal_set_color_foreground(VteTerminal *terminal,
+ const PangoColor *foreground)
{
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
- g_return_if_fail(foreground != NULL);
-
_vte_debug_print(VTE_DEBUG_MISC,
"Set foreground color to (%04x,%04x,%04x).\n",
foreground->red, foreground->green, foreground->blue);
- vte_terminal_set_color_internal(terminal, VTE_DEF_FG, foreground);
+ _vte_terminal_set_color_internal(terminal, VTE_DEFAULT_FG, VTE_COLOR_SOURCE_API, foreground);
}
-/**
- * vte_terminal_set_color_background:
+/*
+ * _vte_terminal_set_color_background:
* @terminal: a #VteTerminal
* @background: the new background color
*
* Sets the background color for text which does not have a specific background
- * color assigned. Only has effect when no background image is set and when
- * the terminal is not transparent.
+ * color assigned. Only has effect when no background image is set.
*/
-void
-vte_terminal_set_color_background(VteTerminal *terminal,
- const GdkColor *background)
+static void
+_vte_terminal_set_color_background(VteTerminal *terminal,
+ const PangoColor *background)
{
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
- g_return_if_fail(background != NULL);
-
_vte_debug_print(VTE_DEBUG_MISC,
"Set background color to (%04x,%04x,%04x).\n",
background->red, background->green, background->blue);
- vte_terminal_set_color_internal(terminal, VTE_DEF_BG, background);
+ _vte_terminal_set_color_internal(terminal, VTE_DEFAULT_BG, VTE_COLOR_SOURCE_API, background);
}
-/**
- * vte_terminal_set_color_cursor:
+/*
+ * _vte_terminal_set_background_alpha:
+ * @terminal: a #VteTerminal
+ * @alpha: an alpha value from 0.0 to 0.1
+ */
+static void
+_vte_terminal_set_background_alpha(VteTerminal *terminal,
+ gdouble alpha)
+{
+ VteTerminalPrivate *pvt = terminal->pvt;
+
+ if (alpha == pvt->background_alpha)
+ return;
+
+ _vte_debug_print(VTE_DEBUG_MISC,
+ "Setting background alpha to %.3f\n", alpha);
+
+ pvt->background_alpha = alpha;
+
+ vte_terminal_background_update(terminal);
+}
+
+/*
+ * _vte_terminal_set_color_cursor:
* @terminal: a #VteTerminal
* @cursor_background: (allow-none): the new color to use for the text cursor, or %NULL
*
* Sets the background color for text which is under the cursor. If %NULL, text
* under the cursor will be drawn with foreground and background colors
* reversed.
- *
- * Since: 0.11.11
*/
-void
-vte_terminal_set_color_cursor(VteTerminal *terminal,
- const GdkColor *cursor_background)
+static void
+_vte_terminal_set_color_cursor(VteTerminal *terminal,
+ const PangoColor *cursor_background)
{
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
if (cursor_background != NULL) {
_vte_debug_print(VTE_DEBUG_MISC,
"Set cursor color to (%04x,%04x,%04x).\n",
cursor_background->red,
cursor_background->green,
cursor_background->blue);
- vte_terminal_set_color_internal(terminal, VTE_CUR_BG,
- cursor_background);
- terminal->pvt->cursor_color_set = TRUE;
} else {
_vte_debug_print(VTE_DEBUG_MISC,
- "Cleared cursor color.\n");
- terminal->pvt->cursor_color_set = FALSE;
+ "Reset cursor color.\n");
}
+ _vte_terminal_set_color_internal(terminal, VTE_CURSOR_BG, VTE_COLOR_SOURCE_API, cursor_background);
}
-/**
- * vte_terminal_set_color_highlight:
+/*
+ * _vte_terminal_set_color_highlight:
* @terminal: a #VteTerminal
* @highlight_background: (allow-none): the new color to use for highlighted text, or %NULL
*
* Sets the background color for text which is highlighted. If %NULL,
+ * it is unset. If neither highlight background nor highlight foreground are set,
* highlighted text (which is usually highlighted because it is selected) will
* be drawn with foreground and background colors reversed.
- *
- * Since: 0.11.11
*/
-void
-vte_terminal_set_color_highlight(VteTerminal *terminal,
- const GdkColor *highlight_background)
+static void
+_vte_terminal_set_color_highlight(VteTerminal *terminal,
+ const PangoColor *highlight_background)
{
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
if (highlight_background != NULL) {
_vte_debug_print(VTE_DEBUG_MISC,
- "Set highlight color to (%04x,%04x,%04x).\n",
+ "Set highlight background color to (%04x,%04x,%04x).\n",
highlight_background->red,
highlight_background->green,
highlight_background->blue);
- vte_terminal_set_color_internal(terminal, VTE_DEF_HL,
- highlight_background);
- terminal->pvt->highlight_color_set = TRUE;
} else {
_vte_debug_print(VTE_DEBUG_MISC,
- "Cleared highlight color.\n");
- terminal->pvt->highlight_color_set = FALSE;
+ "Reset highlight background color.\n");
}
+ _vte_terminal_set_color_internal(terminal, VTE_HIGHLIGHT_BG, VTE_COLOR_SOURCE_API, highlight_background);
}
-/**
- * vte_terminal_set_colors:
+/*
+ * _vte_terminal_set_color_highlight_foreground:
+ * @terminal: a #VteTerminal
+ * @highlight_foreground: (allow-none): the new color to use for highlighted text, or %NULL
+ *
+ * Sets the foreground color for text which is highlighted. If %NULL,
+ * it is unset. If neither highlight background nor highlight foreground are set,
+ * highlighted text (which is usually highlighted because it is selected) will
+ * be drawn with foreground and background colors reversed.
+ */
+static void
+_vte_terminal_set_color_highlight_foreground(VteTerminal *terminal,
+ const PangoColor *highlight_foreground)
+{
+ if (highlight_foreground != NULL) {
+ _vte_debug_print(VTE_DEBUG_MISC,
+ "Set highlight foreground color to (%04x,%04x,%04x).\n",
+ highlight_foreground->red,
+ highlight_foreground->green,
+ highlight_foreground->blue);
+ } else {
+ _vte_debug_print(VTE_DEBUG_MISC,
+ "Reset highlight foreground color.\n");
+ }
+ _vte_terminal_set_color_internal(terminal, VTE_HIGHLIGHT_FG, VTE_COLOR_SOURCE_API, highlight_foreground);
+}
+
+/*
+ * _vte_terminal_set_colors:
* @terminal: a #VteTerminal
* @foreground: (allow-none): the new foreground color, or %NULL
* @background: (allow-none): the new background color, or %NULL
@@ -2728,7 +2530,7 @@ vte_terminal_set_color_highlight(VteTerminal *terminal,
* color, an eight color palette, bold versions of the eight color palette,
* and a dim version of the the eight color palette.
*
- * @palette_size must be either 0, 8, 16, or 24, or between 25 and 255 inclusive.
+ * @palette_size must be either 0, 8, 16, or 24, or between 25 and 256 inclusive.
* If @foreground is %NULL and
* @palette_size is greater than 0, the new foreground color is taken from
* @palette[7]. If @background is %NULL and @palette_size is greater than 0,
@@ -2737,27 +2539,19 @@ vte_terminal_set_color_highlight(VteTerminal *terminal,
* 8-color palettes are extrapolated from the new background color and the items
* in @palette.
*/
-void
-vte_terminal_set_colors(VteTerminal *terminal,
- const GdkColor *foreground,
- const GdkColor *background,
- const GdkColor *palette,
- glong palette_size)
+static void
+_vte_terminal_set_colors(VteTerminal *terminal,
+ const PangoColor *foreground,
+ const PangoColor *background,
+ const PangoColor *palette,
+ gsize palette_size)
{
- guint i;
- GdkColor color;
-
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
- g_return_if_fail(palette_size >= 0);
- g_return_if_fail((palette_size == 0) ||
- (palette_size == 8) ||
- (palette_size == 16) ||
- (palette_size == 24) ||
- (palette_size > 24 && palette_size < 256));
+ gsize i;
+ PangoColor color;
+ gboolean unset = FALSE;
_vte_debug_print(VTE_DEBUG_MISC,
- "Set color palette [%ld elements].\n",
+ "Set color palette [%" G_GSIZE_FORMAT " elements].\n",
palette_size);
/* Accept NULL as the default foreground and background colors if we
@@ -2774,6 +2568,7 @@ vte_terminal_set_colors(VteTerminal *terminal,
/* Initialize each item in the palette if we got any entries to work
* with. */
for (i=0; i < G_N_ELEMENTS(terminal->pvt->palette); i++) {
+ unset = FALSE;
if (i < 16) {
color.blue = (i & 4) ? 0xc000 : 0;
color.green = (i & 2) ? 0xc000 : 0;
@@ -2798,7 +2593,7 @@ vte_terminal_set_colors(VteTerminal *terminal,
color.red = color.green = color.blue = shade | shade << 8;
}
else switch (i) {
- case VTE_DEF_BG:
+ case VTE_DEFAULT_BG:
if (background != NULL) {
color = *background;
} else {
@@ -2807,7 +2602,7 @@ vte_terminal_set_colors(VteTerminal *terminal,
color.green = 0;
}
break;
- case VTE_DEF_FG:
+ case VTE_DEFAULT_FG:
if (foreground != NULL) {
color = *foreground;
} else {
@@ -2817,47 +2612,46 @@ vte_terminal_set_colors(VteTerminal *terminal,
}
break;
case VTE_BOLD_FG:
- vte_terminal_generate_bold(&terminal->pvt->palette[VTE_DEF_FG],
- &terminal->pvt->palette[VTE_DEF_BG],
+ vte_terminal_generate_bold(_vte_terminal_get_color(terminal, VTE_DEFAULT_FG),
+ _vte_terminal_get_color(terminal, VTE_DEFAULT_BG),
1.8,
&color);
break;
case VTE_DIM_FG:
- vte_terminal_generate_bold(&terminal->pvt->palette[VTE_DEF_FG],
- &terminal->pvt->palette[VTE_DEF_BG],
+ vte_terminal_generate_bold(_vte_terminal_get_color(terminal, VTE_DEFAULT_FG),
+ _vte_terminal_get_color(terminal, VTE_DEFAULT_BG),
0.5,
&color);
break;
- case VTE_DEF_HL:
- color.red = 0xc000;
- color.blue = 0xc000;
- color.green = 0xc000;
+ case VTE_HIGHLIGHT_BG:
+ unset = TRUE;
break;
- case VTE_CUR_BG:
- color.red = 0x0000;
- color.blue = 0x0000;
- color.green = 0x0000;
+ case VTE_HIGHLIGHT_FG:
+ unset = TRUE;
+ break;
+ case VTE_CURSOR_BG:
+ unset = TRUE;
break;
}
/* Override from the supplied palette if there is one. */
- if ((glong) i < palette_size) {
+ if (i < palette_size) {
color = palette[i];
}
/* Set up the color entry. */
- vte_terminal_set_color_internal(terminal, i, &color);
+ _vte_terminal_set_color_internal(terminal, i, VTE_COLOR_SOURCE_API, unset ? NULL : &color);
+ if (!terminal->pvt->palette_initialized)
+ terminal->pvt->palette[i].sources[VTE_COLOR_SOURCE_ESCAPE].is_set = FALSE;
}
/* Track that we had a color palette set. */
terminal->pvt->palette_initialized = TRUE;
}
-#if GTK_CHECK_VERSION (2, 99, 0)
-
-static GdkColor *
-gdk_color_from_rgba (GdkColor *color,
- const GdkRGBA *rgba)
+static PangoColor *
+_pango_color_from_rgba (PangoColor *color,
+ const GdkRGBA *rgba)
{
if (rgba == NULL)
return NULL;
@@ -2865,7 +2659,6 @@ gdk_color_from_rgba (GdkColor *color,
color->red = rgba->red * 65535.;
color->green = rgba->green * 65535.;
color->blue = rgba->blue * 65535.;
- color->pixel = 0;
return color;
}
@@ -2882,21 +2675,23 @@ void
vte_terminal_set_color_bold_rgba(VteTerminal *terminal,
const GdkRGBA *bold)
{
- GdkColor color;
+ PangoColor color;
+
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
if (bold == NULL)
{
- vte_terminal_generate_bold(&terminal->pvt->palette[VTE_DEF_FG],
- &terminal->pvt->palette[VTE_DEF_BG],
+ vte_terminal_generate_bold(_vte_terminal_get_color(terminal, VTE_DEFAULT_FG),
+ _vte_terminal_get_color(terminal, VTE_DEFAULT_BG),
1.8,
&color);
}
else
{
- gdk_color_from_rgba(&color, bold);
+ _pango_color_from_rgba(&color, bold);
}
- vte_terminal_set_color_bold(terminal, &color);
+ _vte_terminal_set_color_bold(terminal, &color);
}
/**
@@ -2913,21 +2708,23 @@ void
vte_terminal_set_color_dim_rgba(VteTerminal *terminal,
const GdkRGBA *dim)
{
- GdkColor color;
+ PangoColor color;
+
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
if (dim == NULL)
{
- vte_terminal_generate_bold(&terminal->pvt->palette[VTE_DEF_FG],
- &terminal->pvt->palette[VTE_DEF_BG],
+ vte_terminal_generate_bold(_vte_terminal_get_color(terminal, VTE_DEFAULT_FG),
+ _vte_terminal_get_color(terminal, VTE_DEFAULT_BG),
0.5,
&color);
}
else
{
- gdk_color_from_rgba(&color, dim);
+ _pango_color_from_rgba(&color, dim);
}
- vte_terminal_set_color_dim(terminal, &color);
+ _vte_terminal_set_color_dim(terminal, &color);
}
/**
@@ -2943,10 +2740,13 @@ void
vte_terminal_set_color_foreground_rgba(VteTerminal *terminal,
const GdkRGBA *foreground)
{
- GdkColor color;
+ PangoColor color;
+
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
+ g_return_if_fail(foreground != NULL);
- vte_terminal_set_color_foreground(terminal,
- gdk_color_from_rgba(&color, foreground));
+ _vte_terminal_set_color_foreground(terminal,
+ _pango_color_from_rgba(&color, foreground));
}
/**
@@ -2964,10 +2764,14 @@ void
vte_terminal_set_color_background_rgba(VteTerminal *terminal,
const GdkRGBA *background)
{
- GdkColor color;
+ PangoColor color;
+
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
+ g_return_if_fail(background != NULL);
- vte_terminal_set_color_background(terminal,
- gdk_color_from_rgba (&color, background));
+ _vte_terminal_set_color_background(terminal,
+ _pango_color_from_rgba (&color, background));
+ _vte_terminal_set_background_alpha(terminal, background->alpha);
}
/**
@@ -2985,10 +2789,13 @@ void
vte_terminal_set_color_cursor_rgba(VteTerminal *terminal,
const GdkRGBA *cursor_background)
{
- GdkColor color;
+ PangoColor color;
- vte_terminal_set_color_cursor(terminal,
- gdk_color_from_rgba(&color, cursor_background));
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
+ g_return_if_fail(cursor_background != NULL);
+
+ _vte_terminal_set_color_cursor(terminal,
+ _pango_color_from_rgba(&color, cursor_background));
}
/**
@@ -2997,6 +2804,7 @@ vte_terminal_set_color_cursor_rgba(VteTerminal *terminal,
* @highlight_background: (allow-none): the new color to use for highlighted text, or %NULL
*
* Sets the background color for text which is highlighted. If %NULL,
+ * it is unset. If neither highlight background nor highlight foreground are set,
* highlighted text (which is usually highlighted because it is selected) will
* be drawn with foreground and background colors reversed.
*
@@ -3006,10 +2814,38 @@ void
vte_terminal_set_color_highlight_rgba(VteTerminal *terminal,
const GdkRGBA *highlight_background)
{
- GdkColor color;
+ PangoColor color;
+
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
+ g_return_if_fail(highlight_background != NULL);
+
+ _vte_terminal_set_color_highlight(terminal,
+ _pango_color_from_rgba(&color, highlight_background));
+}
+
+/**
+ * vte_terminal_set_color_highlight_foreground_rgba:
+ * @terminal: a #VteTerminal
+ * @highlight_foreground: (allow-none): the new color to use for highlighted text, or %NULL
+ *
+ * Sets the foreground color for text which is highlighted. If %NULL,
+ * it is unset. If neither highlight background nor highlight foreground are set,
+ * highlighted text (which is usually highlighted because it is selected) will
+ * be drawn with foreground and background colors reversed.
+ *
+ * Since: 0.36
+ */
+void
+vte_terminal_set_color_highlight_foreground_rgba(VteTerminal *terminal,
+ const GdkRGBA *highlight_foreground)
+{
+ PangoColor color;
+
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
+ g_return_if_fail(highlight_foreground != NULL);
- vte_terminal_set_color_highlight(terminal,
- gdk_color_from_rgba(&color, highlight_background));
+ _vte_terminal_set_color_highlight_foreground(terminal,
+ _pango_color_from_rgba(&color, highlight_foreground));
}
/**
@@ -3025,7 +2861,7 @@ vte_terminal_set_color_highlight_rgba(VteTerminal *terminal,
* color, an eight color palette, bold versions of the eight color palette,
* and a dim version of the the eight color palette.
*
- * @palette_size must be either 0, 8, 16, or 24, or between 25 and 255 inclusive.
+ * @palette_size must be either 0, 8, 16, or 24, or between 25 and 256 inclusive.
* If @foreground is %NULL and
* @palette_size is greater than 0, the new foreground color is taken from
* @palette[7]. If @background is %NULL and @palette_size is greater than 0,
@@ -3043,48 +2879,28 @@ vte_terminal_set_colors_rgba(VteTerminal *terminal,
const GdkRGBA *palette,
gsize palette_size)
{
- GdkColor fg, bg, *pal;
+ PangoColor fg, bg, *pal;
gsize i;
- pal = g_new (GdkColor, palette_size);
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
+ g_return_if_fail((palette_size == 0) ||
+ (palette_size == 8) ||
+ (palette_size == 16) ||
+ (palette_size == 24) ||
+ (palette_size > 24 && palette_size <= 256));
+
+ pal = g_new (PangoColor, palette_size);
for (i = 0; i < palette_size; ++i)
- gdk_color_from_rgba(&pal[i], &palette[i]);
+ _pango_color_from_rgba(&pal[i], &palette[i]);
- vte_terminal_set_colors(terminal,
- gdk_color_from_rgba(&fg, foreground),
- gdk_color_from_rgba(&bg, background),
- pal, palette_size);
+ _vte_terminal_set_colors(terminal,
+ _pango_color_from_rgba(&fg, foreground),
+ _pango_color_from_rgba(&bg, background),
+ pal, palette_size);
g_free (pal);
}
-#endif /* GTK 3.0 */
-
-/**
- * vte_terminal_set_opacity:
- * @terminal: a #VteTerminal
- * @opacity: the new opacity
- *
- * Sets the opacity of the terminal background, were 0 means completely
- * transparent and 65535 means completely opaque.
- */
-void
-vte_terminal_set_opacity(VteTerminal *terminal, guint16 opacity)
-{
- VteTerminalPrivate *pvt;
-
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
- pvt = terminal->pvt;
-
- if (opacity == pvt->bg_opacity)
- return;
-
- pvt->bg_opacity = opacity;
-
- g_object_notify(G_OBJECT(terminal), "background-opacity");
-}
-
/**
* vte_terminal_set_default_colors:
* @terminal: a #VteTerminal
@@ -3095,7 +2911,7 @@ void
vte_terminal_set_default_colors(VteTerminal *terminal)
{
g_return_if_fail(VTE_IS_TERMINAL(terminal));
- vte_terminal_set_colors(terminal, NULL, NULL, NULL, 0);
+ _vte_terminal_set_colors(terminal, NULL, NULL, NULL, 0);
}
@@ -3144,23 +2960,15 @@ _vte_terminal_cursor_down (VteTerminal *terminal)
end = screen->insert_delta + screen->scrolling_region.end;
} else {
start = screen->insert_delta;
- end = start + terminal->row_count - 1;
+ end = start + terminal->pvt->row_count - 1;
}
if (screen->cursor_current.row == end) {
- /* Match xterm and fill to the end of row when scrolling. */
- if (screen->fill_defaults.attr.back != VTE_DEF_BG) {
- VteRowData *rowdata;
- rowdata = _vte_terminal_ensure_row (terminal);
- _vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count);
- }
-
if (screen->scrolling_restricted) {
if (start == screen->insert_delta) {
/* Scroll this line into the scrollback
* buffer by inserting a line at the next
* line and scrolling the area up. */
screen->insert_delta++;
- screen->scroll_delta++;
screen->cursor_current.row++;
/* update start and end, as they are relative
* to insert_delta. */
@@ -3183,7 +2991,7 @@ _vte_terminal_cursor_down (VteTerminal *terminal)
_vte_terminal_scroll_region(terminal, start,
end - start + 1, -1);
_vte_invalidate_cells(terminal,
- 0, terminal->column_count,
+ 0, terminal->pvt->column_count,
end - 2, 2);
}
} else {
@@ -3193,10 +3001,10 @@ _vte_terminal_cursor_down (VteTerminal *terminal)
}
/* Match xterm and fill the new row when scrolling. */
- if (screen->fill_defaults.attr.back != VTE_DEF_BG) {
+ if (screen->fill_defaults.attr.back != VTE_DEFAULT_BG) {
VteRowData *rowdata;
rowdata = _vte_terminal_ensure_row (terminal);
- _vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count);
+ _vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->pvt->column_count);
}
} else {
/* Otherwise, just move the cursor down. */
@@ -3248,7 +3056,7 @@ _vte_terminal_insert_char(VteTerminal *terminal, gunichar c,
/* If we're autowrapping here, do it. */
col = screen->cursor_current.col;
- if (G_UNLIKELY (columns && col + columns > terminal->column_count)) {
+ if (G_UNLIKELY (columns && col + columns > terminal->pvt->column_count)) {
if (terminal->pvt->flags.am) {
_vte_debug_print(VTE_DEBUG_ADJ,
"Autowrapping before character\n");
@@ -3262,7 +3070,7 @@ _vte_terminal_insert_char(VteTerminal *terminal, gunichar c,
} else {
/* Don't wrap, stay at the rightmost column. */
col = screen->cursor_current.col =
- terminal->column_count - columns;
+ terminal->pvt->column_count - columns;
}
line_wrapped = TRUE;
}
@@ -3270,8 +3078,8 @@ _vte_terminal_insert_char(VteTerminal *terminal, gunichar c,
_vte_debug_print(VTE_DEBUG_PARSE,
"Inserting %ld '%c' (%d/%d) (%ld+%d, %ld), delta = %ld; ",
(long)c, c < 256 ? c : ' ',
- screen->defaults.attr.fore,
- screen->defaults.attr.back,
+ screen->color_defaults.attr.fore,
+ screen->color_defaults.attr.back,
col, columns, (long)screen->cursor_current.row,
(long)screen->insert_delta);
@@ -3376,6 +3184,8 @@ _vte_terminal_insert_char(VteTerminal *terminal, gunichar c,
}
attr = screen->defaults.attr;
+ attr.fore = screen->color_defaults.attr.fore;
+ attr.back = screen->color_defaults.attr.back;
attr.columns = columns;
if (G_UNLIKELY (c == '_' && terminal->pvt->flags.ul)) {
@@ -3407,20 +3217,20 @@ _vte_terminal_insert_char(VteTerminal *terminal, gunichar c,
pcell->attr = attr;
col++;
}
- _vte_row_data_shrink (row, terminal->column_count);
+ _vte_row_data_shrink (row, terminal->pvt->column_count);
/* Signal that this part of the window needs drawing. */
if (G_UNLIKELY (invalidate_now)) {
_vte_invalidate_cells(terminal,
col - columns,
- insert ? terminal->column_count : columns,
+ insert ? terminal->pvt->column_count : columns,
screen->cursor_current.row, 1);
}
/* If we're autowrapping *here*, do it. */
screen->cursor_current.col = col;
- if (G_UNLIKELY (col >= terminal->column_count)) {
+ if (G_UNLIKELY (col >= terminal->pvt->column_count)) {
if (terminal->pvt->flags.am && !terminal->pvt->flags.xn) {
/* Wrap. */
screen->cursor_current.col = 0;
@@ -3441,11 +3251,10 @@ not_inserted:
return line_wrapped;
}
-/* Catch a VteReaper child-exited signal, and if it matches the one we're
- * looking for, emit one of our own. */
static void
-vte_terminal_catch_child_exited(VteReaper *reaper, int pid, int status,
- VteTerminal *terminal)
+vte_terminal_child_watch_cb(GPid pid,
+ int status,
+ VteTerminal *terminal)
{
if (pid == terminal->pvt->pty_pid) {
GObject *object = G_OBJECT(terminal);
@@ -3466,22 +3275,15 @@ vte_terminal_catch_child_exited(VteReaper *reaper, int pid, int status,
}
#endif
}
- /* Disconnect from the reaper. */
- if (terminal->pvt->pty_reaper != NULL) {
- g_signal_handlers_disconnect_by_func(terminal->pvt->pty_reaper,
- vte_terminal_catch_child_exited,
- terminal);
- g_object_unref(terminal->pvt->pty_reaper);
- terminal->pvt->pty_reaper = NULL;
- }
+
+ terminal->pvt->child_watch_source = 0;
terminal->pvt->pty_pid = -1;
/* Close out the PTY. */
- vte_terminal_set_pty_object(terminal, NULL);
+ vte_terminal_set_pty(terminal, NULL);
/* Tell observers what's happened. */
- terminal->pvt->child_exit_status = status;
- vte_terminal_emit_child_exited(terminal);
+ vte_terminal_emit_child_exited(terminal, status);
g_object_thaw_notify(object);
g_object_unref(object);
@@ -3569,9 +3371,10 @@ _vte_terminal_disconnect_pty_write(VteTerminal *terminal)
}
/**
- * vte_terminal_pty_new:
+ * vte_terminal_pty_new_sync:
* @terminal: a #VteTerminal
* @flags: flags from #VtePtyFlags
+ * @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: (allow-none): return location for a #GError, or %NULL
*
* Creates a new #VtePty, and sets the emulation property
@@ -3580,21 +3383,20 @@ _vte_terminal_disconnect_pty_write(VteTerminal *terminal)
* See vte_pty_new() for more information.
*
* Returns: (transfer full): a new #VtePty
- * Since: 0.26
+ *
+ * Since: 0.30
*/
VtePty *
-vte_terminal_pty_new(VteTerminal *terminal,
- VtePtyFlags flags,
- GError **error)
+vte_terminal_pty_new_sync(VteTerminal *terminal,
+ VtePtyFlags flags,
+ GCancellable *cancellable,
+ GError **error)
{
- VteTerminalPrivate *pvt;
VtePty *pty;
g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL);
- pvt = terminal->pvt;
-
- pty = vte_pty_new(flags, error);
+ pty = vte_pty_new_sync(flags, cancellable, error);
if (pty == NULL)
return NULL;
@@ -3608,12 +3410,11 @@ vte_terminal_pty_new(VteTerminal *terminal,
* @terminal: a #VteTerminal
* @child_pid: a #GPid
*
- * Watches @child_pid. When the process exists, the #VteReaper::child-exited
- * signal will be called. Use vte_terminal_get_child_exit_status() to
- * retrieve the child's exit status.
+ * Watches @child_pid. When the process exists, the #VteTerminal::child-exited
+ * signal will be called with the child's exit status.
*
* Prior to calling this function, a #VtePty must have been set in @terminal
- * using vte_terminal_set_pty_object().
+ * using vte_terminal_set_pty().
* When the child exits, the terminal's #VtePty will be set to %NULL.
*
* Note: g_child_watch_add() or g_child_watch_add_full() must not have
@@ -3631,7 +3432,6 @@ vte_terminal_watch_child (VteTerminal *terminal,
{
VteTerminalPrivate *pvt;
GObject *object;
- VteReaper *reaper;
g_return_if_fail(VTE_IS_TERMINAL(terminal));
g_return_if_fail(child_pid != -1);
@@ -3647,25 +3447,16 @@ vte_terminal_watch_child (VteTerminal *terminal,
/* Set this as the child's pid. */
pvt->pty_pid = child_pid;
- pvt->child_exit_status = 0;
/* Catch a child-exited signal from the child pid. */
- reaper = vte_reaper_get();
- vte_reaper_add_child(child_pid);
- if (reaper != pvt->pty_reaper) {
- if (terminal->pvt->pty_reaper != NULL) {
- g_signal_handlers_disconnect_by_func(pvt->pty_reaper,
- vte_terminal_catch_child_exited,
- terminal);
- g_object_unref(pvt->pty_reaper);
- }
- g_signal_connect(reaper, "child-exited",
- G_CALLBACK(vte_terminal_catch_child_exited),
- terminal);
- pvt->pty_reaper = reaper;
- } else {
- g_object_unref(reaper);
- }
+ if (terminal->pvt->child_watch_source != 0) {
+ g_source_remove (terminal->pvt->child_watch_source);
+ }
+ terminal->pvt->child_watch_source =
+ g_child_watch_add_full(G_PRIORITY_HIGH,
+ child_pid,
+ (GChildWatchFunc)vte_terminal_child_watch_cb,
+ terminal, NULL);
/* FIXMEchpe: call vte_terminal_set_size here? */
@@ -3678,7 +3469,7 @@ vte_terminal_watch_child (VteTerminal *terminal,
* Gets the user's shell, or %NULL. In the latter case, the
* system default (usually "/bin/sh") should be used.
*
- * Returns: (tranfer full) (type filename): a newly allocated string with the
+ * Returns: (transfer full) (type filename): a newly allocated string with the
* user's shell, or %NULL
*
* Since: 0.28
@@ -3695,129 +3486,8 @@ vte_get_user_shell (void)
return NULL;
}
-static char *
-_vte_terminal_get_user_shell_with_fallback (void)
-{
- char *command;
- const gchar *env;
-
- if ((command = vte_get_user_shell ()))
- return command;
-
- if ((env = g_getenv ("SHELL")))
- return g_strdup (env);
-
- return g_strdup ("/bin/sh");
-}
-
-/*
- * _vte_terminal_get_argv:
- * @command: the command to run
- * @argv: the argument vector
- * @flags: (inout) flags from #GSpawnFlags
- *
- * Creates an argument vector to pass to g_spawn_async() from @command and
- * @argv, modifying *@flags if necessary.
- * Like __vte_pty_get_argv(), but returns the argument vector to spawn
- * the user's shell if @command is %NULL.
- *
- * Returns: a newly allocated array of strings. Free with g_strfreev()
- */
-static char **
-_vte_terminal_get_argv (const char *command,
- char **argv,
- GSpawnFlags *flags /* inout */)
-{
- char **argv2;
- char *shell = NULL;
-
- argv2 = __vte_pty_get_argv(command ? command : (shell = _vte_terminal_get_user_shell_with_fallback ()),
- argv,
- flags);
- g_free(shell);
- return argv2;
-}
-
-/**
- * vte_terminal_fork_command:
- * @terminal: a #VteTerminal
- * @command: (allow-none) (type filename): the name of a binary to run, or %NULL to spawn the user's shell
- * @argv: (allow-none) (array zero-terminated=1) (element-type filename): the argument list to be passed to @command, or %NULL
- * @envv: (allow-none) (array zero-terminated=1) (element-type filename): a list of environment variables to be added to the environment before
- * starting @command, or %NULL
- * @working_directory: (allow-none) (type filename): the name of a directory the command should start in, or %NULL
- * @lastlog: %TRUE if the session should be logged to the lastlog
- * @utmp: %TRUE if the session should be logged to the utmp/utmpx log
- * @wtmp: %TRUE if the session should be logged to the wtmp/wtmpx log
- *
- * Starts the specified command under a newly-allocated controlling
- * pseudo-terminal. The @argv and @envv lists should be %NULL-terminated, and
- * 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's emulation setting. If @lastlog, @utmp, or @wtmp are %TRUE,
- * logs the session to the specified system log files.
- *
- * Note that all file descriptors except stdin/stdout/stderr will be closed
- * before calling exec() in the child.
- *
- * Returns: the PID of the new process, or <literal>-1</literal> on failure
- *
- * Deprecated: 0.26: Use vte_terminal_fork_command_full()
- */
-pid_t
-vte_terminal_fork_command(VteTerminal *terminal,
- const char *command,
- char **argv,
- char **envv,
- const char *working_directory,
- gboolean lastlog,
- gboolean utmp,
- gboolean wtmp)
-{
- char **real_argv;
- GSpawnFlags spawn_flags;
- GPid child_pid;
- gboolean ret;
-#ifdef VTE_DEBUG
- GError *error = NULL;
- GError **err = &error;
-#else
- GError **err = NULL;
-#endif
-
- g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1);
-
- spawn_flags = G_SPAWN_CHILD_INHERITS_STDIN |
- G_SPAWN_SEARCH_PATH;
- real_argv = _vte_terminal_get_argv (command, argv, &spawn_flags);
-
- ret = vte_terminal_fork_command_full(terminal,
- __vte_pty_get_pty_flags(lastlog, utmp, wtmp),
- working_directory,
- real_argv,
- envv,
- spawn_flags,
- NULL, NULL,
- &child_pid,
- err);
- g_strfreev (real_argv);
-
-#ifdef VTE_DEBUG
- if (error) {
- _vte_debug_print(VTE_DEBUG_MISC,
- "vte_terminal_fork_command failed: %s\n", error->message);
- g_error_free(error);
- }
-#endif
-
- if (!ret)
- return -1;
-
- return (pid_t) child_pid;
-}
-
/**
- * vte_terminal_fork_command_full:
+ * vte_terminal_spawn_sync:
* @terminal: a #VteTerminal
* @pty_flags: flags from #VtePtyFlags
* @working_directory: (allow-none): the name of a directory the command should start
@@ -3826,9 +3496,10 @@ vte_terminal_fork_command(VteTerminal *terminal,
* @envv: (allow-none) (array zero-terminated=1) (element-type filename): a list of environment
* variables to be added to the environment before starting the process, or %NULL
* @spawn_flags: flags from #GSpawnFlags
- * @child_setup: (allow-none) (scope call): function to run in the child just before exec(), or %NULL
+ * @child_setup: (allow-none) (scope call): an extra child setup function to run in the child just before exec(), or %NULL
* @child_setup_data: user data for @child_setup
* @child_pid: (out) (allow-none) (transfer full): a location to store the child PID, or %NULL
+ * @cancellable: (allow-none): a #GCancellable, or %NULL
* @error: (allow-none): return location for a #GError, or %NULL
*
* Starts the specified command under a newly-allocated controlling
@@ -3847,10 +3518,10 @@ vte_terminal_fork_command(VteTerminal *terminal,
*
* Returns: %TRUE on success, or %FALSE on error with @error filled in
*
- * Since: 0.26
+ * Since: 0.30
*/
gboolean
-vte_terminal_fork_command_full(VteTerminal *terminal,
+vte_terminal_spawn_sync(VteTerminal *terminal,
VtePtyFlags pty_flags,
const char *working_directory,
char **argv,
@@ -3859,6 +3530,7 @@ vte_terminal_fork_command_full(VteTerminal *terminal,
GSpawnChildSetupFunc child_setup,
gpointer child_setup_data,
GPid *child_pid /* out */,
+ GCancellable *cancellable,
GError **error)
{
VtePty *pty;
@@ -3869,7 +3541,7 @@ vte_terminal_fork_command_full(VteTerminal *terminal,
g_return_val_if_fail(child_setup_data == NULL || child_setup, FALSE);
g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
- pty = vte_pty_new(pty_flags, error);
+ pty = vte_terminal_pty_new_sync(terminal, pty_flags, cancellable, error);
if (pty == NULL)
return FALSE;
@@ -3888,7 +3560,7 @@ vte_terminal_fork_command_full(VteTerminal *terminal,
return FALSE;
}
- vte_terminal_set_pty_object(terminal, pty);
+ vte_terminal_set_pty(terminal, pty);
vte_terminal_watch_child(terminal, pid);
g_object_unref (pty);
@@ -3898,66 +3570,6 @@ vte_terminal_fork_command_full(VteTerminal *terminal,
return TRUE;
}
-/**
- * vte_terminal_forkpty:
- * @terminal: a #VteTerminal
- * @envv: a list of environment variables to be added to the environment before
- * starting returning in the child process, or %NULL
- * @working_directory: the name of a directory the child process should change to, or
- * %NULL
- * @lastlog: %TRUE if the session should be logged to the lastlog
- * @utmp: %TRUE if the session should be logged to the utmp/utmpx log
- * @wtmp: %TRUE if the session should be logged to the wtmp/wtmpx log
- *
- * Starts a new child process under a newly-allocated controlling
- * pseudo-terminal. TERM is automatically set to reflect the terminal widget's
- * emulation setting. If @lastlog, @utmp, or @wtmp are %TRUE, logs the session
- * to the specified system log files.
- *
- * Note that all file descriptors except stdin/stdout/stderr will be closed
- * in the child.
- *
- * Note that @envv and @working_directory are silently ignored.
- *
- * Returns: the ID of the new process in the parent, 0 in the child, and -1 if
- * there was an error
- *
- * Since: 0.11.11
- *
- * Deprecated: 0.26: Use #VtePty and fork() instead
- */
-pid_t
-vte_terminal_forkpty(VteTerminal *terminal,
- char **envv, const char *working_directory,
- gboolean lastlog, gboolean utmp, gboolean wtmp)
-{
-#ifdef HAVE_FORK
- VtePty *pty;
- GPid pid;
-
- g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1);
-
- pty = vte_pty_new(__vte_pty_get_pty_flags(lastlog, utmp, wtmp), NULL);
- if (pty == NULL)
- return FALSE;
-
- if (!__vte_pty_fork(pty,
- &pid,
- NULL)) {
- g_object_unref(pty);
- return FALSE;
- }
-
- vte_terminal_set_pty_object(terminal, pty);
- // FIXMEchpe is that really right?
- vte_terminal_watch_child(terminal, pid);
-
- return pid;
-#else
- return -1;
-#endif
-}
-
/* Handle an EOF from the client. */
static void
vte_terminal_eof(GIOChannel *channel, VteTerminal *terminal)
@@ -3966,7 +3578,7 @@ vte_terminal_eof(GIOChannel *channel, VteTerminal *terminal)
g_object_freeze_notify(object);
- vte_terminal_set_pty_object(terminal, NULL);
+ vte_terminal_set_pty(terminal, NULL);
/* Emit a signal that we read an EOF. */
vte_terminal_queue_eof(terminal);
@@ -4055,6 +3667,7 @@ vte_terminal_process_incoming(VteTerminal *terminal)
long wcount, start, delta;
gboolean leftovers, modified, bottom, again;
gboolean invalidated_text;
+ gboolean in_scroll_region;
GArray *unichars;
struct _vte_incoming_chunk *chunk, *next_chunk, *achunk = NULL;
@@ -4074,6 +3687,10 @@ vte_terminal_process_incoming(VteTerminal *terminal)
cursor = screen->cursor_current;
cursor_visible = terminal->pvt->cursor_visible;
+ in_scroll_region = screen->scrolling_restricted
+ && (screen->cursor_current.row >= (screen->insert_delta + screen->scrolling_region.start))
+ && (screen->cursor_current.row <= (screen->insert_delta + screen->scrolling_region.end));
+
/* We should only be called when there's data to process. */
g_assert(terminal->pvt->incoming ||
(terminal->pvt->pending->len > 0));
@@ -4172,6 +3789,8 @@ skip_chunk:
* points to the first character which isn't part of this
* sequence. */
if ((match != NULL) && (match[0] != '\0')) {
+ gboolean new_in_scroll_region;
+
/* Call the right sequence handler for the requested
* behavior. */
_vte_terminal_handle_sequence(terminal,
@@ -4182,20 +3801,29 @@ skip_chunk:
start = (next - wbuf);
modified = TRUE;
- /* if we have moved during the sequence handler, restart the bbox */
+ new_in_scroll_region = screen->scrolling_restricted
+ && (screen->cursor_current.row >= (screen->insert_delta + screen->scrolling_region.start))
+ && (screen->cursor_current.row <= (screen->insert_delta + screen->scrolling_region.end));
+
+ delta = screen->scroll_delta; /* delta may have changed from sequence. */
+
+ /* if we have moved greatly during the sequence handler, or moved
+ * into a scroll_region from outside it, restart the bbox.
+ */
if (invalidated_text &&
- (screen->cursor_current.col > bbox_bottomright.x + VTE_CELL_BBOX_SLACK ||
- screen->cursor_current.col < bbox_topleft.x - VTE_CELL_BBOX_SLACK ||
- screen->cursor_current.row > bbox_bottomright.y + VTE_CELL_BBOX_SLACK ||
- screen->cursor_current.row < bbox_topleft.y - VTE_CELL_BBOX_SLACK)) {
+ ((new_in_scroll_region && !in_scroll_region) ||
+ (screen->cursor_current.col > bbox_bottomright.x + VTE_CELL_BBOX_SLACK ||
+ screen->cursor_current.col < bbox_topleft.x - VTE_CELL_BBOX_SLACK ||
+ screen->cursor_current.row > bbox_bottomright.y + VTE_CELL_BBOX_SLACK ||
+ screen->cursor_current.row < bbox_topleft.y - VTE_CELL_BBOX_SLACK))) {
/* Clip off any part of the box which isn't already on-screen. */
bbox_topleft.x = MAX(bbox_topleft.x, 0);
bbox_topleft.y = MAX(bbox_topleft.y, delta);
bbox_bottomright.x = MIN(bbox_bottomright.x,
- terminal->column_count);
+ terminal->pvt->column_count);
/* lazily apply the +1 to the cursor_row */
bbox_bottomright.y = MIN(bbox_bottomright.y + 1,
- delta + terminal->row_count);
+ delta + terminal->pvt->row_count);
_vte_invalidate_cells(terminal,
bbox_topleft.x,
@@ -4207,6 +3835,8 @@ skip_chunk:
bbox_bottomright.x = bbox_bottomright.y = -G_MAXINT;
bbox_topleft.x = bbox_topleft.y = G_MAXINT;
}
+
+ in_scroll_region = new_in_scroll_region;
} else
/* Second, we have a NULL match, and next points to the very
* next character in the buffer. Insert the character which
@@ -4285,10 +3915,10 @@ skip_chunk:
bbox_topleft.x = MAX(bbox_topleft.x, 0);
bbox_topleft.y = MAX(bbox_topleft.y, delta);
bbox_bottomright.x = MIN(bbox_bottomright.x,
- terminal->column_count);
+ terminal->pvt->column_count);
/* lazily apply the +1 to the cursor_row */
bbox_bottomright.y = MIN(bbox_bottomright.y + 1,
- delta + terminal->row_count);
+ delta + terminal->pvt->row_count);
_vte_invalidate_cells(terminal,
bbox_topleft.x,
@@ -4380,7 +4010,7 @@ next_match:
terminal->pvt->selection_start.row,
0,
terminal->pvt->selection_end.row,
- terminal->column_count,
+ terminal->pvt->column_count,
vte_cell_is_selected,
NULL,
NULL);
@@ -4405,10 +4035,10 @@ next_match:
bbox_topleft.x = MAX(bbox_topleft.x, 0);
bbox_topleft.y = MAX(bbox_topleft.y, delta);
bbox_bottomright.x = MIN(bbox_bottomright.x,
- terminal->column_count);
+ terminal->pvt->column_count);
/* lazily apply the +1 to the cursor_row */
bbox_bottomright.y = MIN(bbox_bottomright.y + 1,
- delta + terminal->row_count);
+ delta + terminal->pvt->row_count);
_vte_invalidate_cells(terminal,
bbox_topleft.x,
@@ -4436,11 +4066,11 @@ next_match:
if (gtk_widget_get_realized (&terminal->widget)) {
GdkRectangle rect;
rect.x = terminal->pvt->screen->cursor_current.col *
- terminal->char_width + terminal->pvt->inner_border.left;
- rect.width = terminal->char_width;
+ terminal->pvt->char_width + terminal->pvt->padding.left;
+ rect.width = terminal->pvt->char_width;
rect.y = (terminal->pvt->screen->cursor_current.row - delta) *
- terminal->char_height + terminal->pvt->inner_border.top;
- rect.height = terminal->char_height;
+ terminal->pvt->char_height + terminal->pvt->padding.top;
+ rect.height = terminal->pvt->char_height;
gtk_im_context_set_cursor_location(terminal->pvt->im_context,
&rect);
}
@@ -4519,7 +4149,7 @@ vte_terminal_io_read(GIOChannel *channel,
if (max_bytes) {
max_bytes = terminal->pvt->max_input_bytes / max_bytes;
} else {
- max_bytes = VTE_MAX_INPUT_READ;
+ max_bytes = terminal->pvt->max_input_bytes;
}
bytes = terminal->pvt->input_bytes;
@@ -4563,9 +4193,14 @@ out:
_vte_terminal_feed_chunks (terminal, chunks);
}
if (!vte_terminal_is_processing (terminal)) {
- GDK_THREADS_ENTER ();
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ gdk_threads_enter ();
+ G_GNUC_END_IGNORE_DEPRECATIONS;
+
vte_terminal_add_process_timeout (terminal);
- GDK_THREADS_LEAVE ();
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ gdk_threads_leave ();
+ G_GNUC_END_IGNORE_DEPRECATIONS;
}
terminal->pvt->pty_input_active = len != 0;
terminal->pvt->input_bytes = bytes;
@@ -4598,9 +4233,15 @@ out:
if (eof) {
/* potential deadlock ... */
if (!vte_terminal_is_processing (terminal)) {
- GDK_THREADS_ENTER ();
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ gdk_threads_enter ();
+ G_GNUC_END_IGNORE_DEPRECATIONS;
+
vte_terminal_eof (channel, terminal);
- GDK_THREADS_LEAVE ();
+
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ gdk_threads_leave ();
+ G_GNUC_END_IGNORE_DEPRECATIONS;
} else {
vte_terminal_eof (channel, terminal);
}
@@ -4614,7 +4255,7 @@ out:
/**
* vte_terminal_feed:
* @terminal: a #VteTerminal
- * @data: a string in the terminal's current encoding
+ * @data: (array length=length) (element-type guint8): a string in the terminal's current encoding
* @length: the length of the string
*
* Interprets @data as if it were data received from a child process. This
@@ -4670,7 +4311,7 @@ vte_terminal_io_write(GIOChannel *channel,
fd = g_io_channel_unix_get_fd(channel);
count = write(fd, terminal->pvt->outgoing->data,
- _vte_buffer_length(terminal->pvt->outgoing));
+ _vte_byte_array_length(terminal->pvt->outgoing));
if (count != -1) {
_VTE_DEBUG_IF (VTE_DEBUG_IO) {
gssize i;
@@ -4683,10 +4324,10 @@ vte_terminal_io_write(GIOChannel *channel,
((guint8)terminal->pvt->outgoing->data[i]) + 64);
}
}
- _vte_buffer_consume(terminal->pvt->outgoing, count);
+ _vte_byte_array_consume(terminal->pvt->outgoing, count);
}
- if (_vte_buffer_length(terminal->pvt->outgoing) == 0) {
+ if (_vte_byte_array_length(terminal->pvt->outgoing) == 0) {
leave_open = FALSE;
} else {
leave_open = TRUE;
@@ -4723,7 +4364,7 @@ vte_terminal_send(VteTerminal *terminal, const char *encoding,
icount = length;
ibuf = data;
ocount = ((length + 1) * VTE_UTF8_BPC) + 1;
- _vte_buffer_set_minimum_size(terminal->pvt->conv_buffer, ocount);
+ _vte_byte_array_set_minimum_size(terminal->pvt->conv_buffer, ocount);
obuf = obufptr = terminal->pvt->conv_buffer->data;
if (_vte_conv(conv, &ibuf, &icount, &obuf, &ocount) == (gsize)-1) {
@@ -4785,7 +4426,7 @@ vte_terminal_send(VteTerminal *terminal, const char *encoding,
/* If there's a place for it to go, add the data to the
* outgoing buffer. */
if ((cooked_length > 0) && (terminal->pvt->pty != NULL)) {
- _vte_buffer_append(terminal->pvt->outgoing,
+ _vte_byte_array_append(terminal->pvt->outgoing,
cooked, cooked_length);
_VTE_DEBUG_IF(VTE_DEBUG_KEYBOARD) {
for (i = 0; i < cooked_length; i++) {
@@ -4859,7 +4500,7 @@ vte_terminal_feed_child_binary(VteTerminal *terminal, const char *data, glong le
/* If there's a place for it to go, add the data to the
* outgoing buffer. */
if (terminal->pvt->pty != NULL) {
- _vte_buffer_append(terminal->pvt->outgoing,
+ _vte_byte_array_append(terminal->pvt->outgoing,
data, length);
/* If we need to start waiting for the child pty to
* become available for writing, set that up here. */
@@ -4944,90 +4585,40 @@ vte_terminal_im_preedit_changed(GtkIMContext *im_context, VteTerminal *terminal)
_vte_invalidate_cursor_once(terminal, FALSE);
}
-/* Handle the toplevel being reconfigured. */
-static gboolean
-vte_terminal_configure_toplevel(VteTerminal *terminal)
-{
- _vte_debug_print(VTE_DEBUG_EVENTS, "Top level parent configured.\n");
-
- if (terminal->pvt->bg_transparent) {
- /* We have to repaint the entire window, because we don't get
- * an expose event unless some portion of our visible area
- * moved out from behind another window. */
- _vte_invalidate_all(terminal);
- }
-
- return FALSE;
-}
-
-/* Handle a hierarchy-changed signal. */
static void
-vte_terminal_hierarchy_changed(GtkWidget *widget, GtkWidget *old_toplevel,
- gpointer data)
-{
- GtkWidget *toplevel;
-
- _vte_debug_print(VTE_DEBUG_EVENTS, "Hierarchy changed.\n");
- if (old_toplevel != NULL) {
- g_signal_handlers_disconnect_by_func(old_toplevel,
- vte_terminal_configure_toplevel,
- widget);
- }
-
- toplevel = gtk_widget_get_toplevel(widget);
- if (toplevel != NULL) {
- g_signal_connect_swapped (toplevel, "configure-event",
- G_CALLBACK (vte_terminal_configure_toplevel),
- widget);
- }
-}
-
-static void
-vte_terminal_set_inner_border(VteTerminal *terminal)
+vte_terminal_set_padding(VteTerminal *terminal)
{
VteTerminalPrivate *pvt = terminal->pvt;
GtkWidget *widget = GTK_WIDGET(terminal);
- GtkBorder *border = NULL;
- GtkBorder inner_border;
-
- gtk_widget_style_get(widget, "inner-border", &border, NULL);
+ GtkBorder padding;
- if (border != NULL) {
- inner_border = *border;
- gtk_border_free(border);
- } else {
- inner_border = default_inner_border;
- }
+ gtk_style_context_get_padding(gtk_widget_get_style_context(widget),
+ gtk_widget_get_state_flags(widget),
+ &padding);
_vte_debug_print(VTE_DEBUG_MISC,
- "Setting inner-border to { %d, %d, %d, %d }\n",
- inner_border.left, inner_border.right,
- inner_border.top, inner_border.bottom);
+ "Setting padding to (%d,%d,%d,%d)\n",
+ padding.left, padding.right,
+ padding.top, padding.bottom);
- if (memcmp(&inner_border, &pvt->inner_border, sizeof(GtkBorder)) == 0)
+ if (memcmp(&padding, &pvt->padding, sizeof(GtkBorder)) == 0)
return;
- pvt->inner_border = inner_border;
+ pvt->padding = padding;
gtk_widget_queue_resize(widget);
}
static void
-vte_terminal_style_set (GtkWidget *widget,
- GtkStyle *prev_style)
+vte_terminal_style_updated (GtkWidget *widget)
{
VteTerminal *terminal = VTE_TERMINAL(widget);
float aspect;
- GTK_WIDGET_CLASS (vte_terminal_parent_class)->style_set (widget, prev_style);
+ GTK_WIDGET_CLASS (vte_terminal_parent_class)->style_updated (widget);
- if (gtk_widget_get_style(widget) == prev_style)
- return;
-
- vte_terminal_set_font_full_internal(terminal, terminal->pvt->fontdesc,
- terminal->pvt->fontantialias);
-
- vte_terminal_set_inner_border(terminal);
+ vte_terminal_set_font(terminal, terminal->pvt->fontdesc);
+ vte_terminal_set_padding(terminal);
gtk_widget_style_get(widget, "cursor-aspect-ratio", &aspect, NULL);
if (aspect != terminal->pvt->cursor_aspect_ratio) {
@@ -5085,28 +4676,9 @@ _vte_terminal_audible_beep(VteTerminal *terminal)
void
_vte_terminal_visible_beep(VteTerminal *terminal)
{
- GtkWidget *widget;
- GtkAllocation allocation;
- GtkStyle *style;
- PangoColor color;
-
- widget = &terminal->widget;
+ GtkWidget *widget = &terminal->widget;
if (gtk_widget_get_realized (widget)) {
-
- style = gtk_widget_get_style (widget);
- gtk_widget_get_allocation (widget, &allocation);
- color.red = style->fg[gtk_widget_get_state (widget)].red;
- color.green = style->fg[gtk_widget_get_state (widget)].green;
- color.blue = style->fg[gtk_widget_get_state (widget)].blue;
-
- _vte_draw_start(terminal->pvt->draw);
- _vte_draw_fill_rectangle(terminal->pvt->draw,
- 0, 0,
- allocation.width, allocation.height,
- &color, VTE_DRAW_OPAQUE);
- _vte_draw_end(terminal->pvt->draw);
-
/* Force the repaint, max delay of UPDATE_REPEAT_TIMEOUT */
_vte_invalidate_all (terminal);
}
@@ -5134,11 +4706,7 @@ vte_translate_ctrlkey (GdkEventKey *event)
if (event->keyval < 128)
return event->keyval;
-#if GTK_CHECK_VERSION (2, 90, 8)
keymap = gdk_keymap_get_for_display(gdk_window_get_display (event->window));
-#else
- keymap = gdk_keymap_get_for_display(gdk_drawable_get_display (event->window));
-#endif
/* Try groups in order to find one mapping the key to ASCII */
for (i = 0; i < 4; i++) {
@@ -5163,19 +4731,24 @@ static void
vte_terminal_read_modifiers (VteTerminal *terminal,
GdkEvent *event)
{
+ GdkKeymap *keymap;
GdkModifierType modifiers;
/* Read the modifiers. */
- if (gdk_event_get_state((GdkEvent*)event, &modifiers)) {
- GdkKeymap *keymap;
-#if GTK_CHECK_VERSION (2, 90, 8)
- keymap = gdk_keymap_get_for_display(gdk_window_get_display(((GdkEventAny*)event)->window));
-#else
- keymap = gdk_keymap_get_for_display(gdk_drawable_get_display(((GdkEventAny*)event)->window));
+ if (!gdk_event_get_state((GdkEvent*)event, &modifiers))
+ return;
+
+ keymap = gdk_keymap_get_for_display(gdk_window_get_display(((GdkEventAny*)event)->window));
+
+ gdk_keymap_add_virtual_modifiers (keymap, &modifiers);
+
+#if 1
+ /* HACK! Treat ALT as META; see bug #663779. */
+ if (modifiers & GDK_MOD1_MASK)
+ modifiers |= VTE_META_MASK;
#endif
- gdk_keymap_add_virtual_modifiers (keymap, &modifiers);
- terminal->pvt->modifiers = modifiers;
- }
+
+ terminal->pvt->modifiers = modifiers;
}
/* Read and handle a keypress event. */
@@ -5220,7 +4793,7 @@ vte_terminal_key_press(GtkWidget *widget, GdkEventKey *event)
if (terminal->pvt->margin_bell) {
if ((terminal->pvt->screen->cursor_current.col +
(glong) terminal->pvt->bell_margin) ==
- terminal->column_count) {
+ terminal->pvt->column_count) {
_vte_terminal_beep (terminal);
}
}
@@ -5249,11 +4822,11 @@ vte_terminal_key_press(GtkWidget *widget, GdkEventKey *event)
/* We steal many keypad keys here. */
if (!terminal->pvt->im_preedit_active) {
switch (keyval) {
- case GDK_KEY (KP_Add):
- case GDK_KEY (KP_Subtract):
- case GDK_KEY (KP_Multiply):
- case GDK_KEY (KP_Divide):
- case GDK_KEY (KP_Enter):
+ case GDK_KEY_KP_Add:
+ case GDK_KEY_KP_Subtract:
+ case GDK_KEY_KP_Multiply:
+ case GDK_KEY_KP_Divide:
+ case GDK_KEY_KP_Enter:
steal = TRUE;
break;
default:
@@ -5263,27 +4836,68 @@ vte_terminal_key_press(GtkWidget *widget, GdkEventKey *event)
steal = TRUE;
}
switch (keyval) {
- case GDK_KEY (Multi_key):
- case GDK_KEY (Codeinput):
- case GDK_KEY (SingleCandidate):
- case GDK_KEY (MultipleCandidate):
- case GDK_KEY (PreviousCandidate):
- case GDK_KEY (Kanji):
- case GDK_KEY (Muhenkan):
- case GDK_KEY (Henkan):
- case GDK_KEY (Romaji):
- case GDK_KEY (Hiragana):
- case GDK_KEY (Katakana):
- case GDK_KEY (Hiragana_Katakana):
- case GDK_KEY (Zenkaku):
- case GDK_KEY (Hankaku):
- case GDK_KEY (Zenkaku_Hankaku):
- case GDK_KEY (Touroku):
- case GDK_KEY (Massyo):
- case GDK_KEY (Kana_Lock):
- case GDK_KEY (Kana_Shift):
- case GDK_KEY (Eisu_Shift):
- case GDK_KEY (Eisu_toggle):
+ case GDK_KEY_ISO_Lock:
+ case GDK_KEY_ISO_Level2_Latch:
+ case GDK_KEY_ISO_Level3_Shift:
+ case GDK_KEY_ISO_Level3_Latch:
+ case GDK_KEY_ISO_Level3_Lock:
+ case GDK_KEY_ISO_Level5_Shift:
+ case GDK_KEY_ISO_Level5_Latch:
+ case GDK_KEY_ISO_Level5_Lock:
+ case GDK_KEY_ISO_Group_Shift:
+ case GDK_KEY_ISO_Group_Latch:
+ case GDK_KEY_ISO_Group_Lock:
+ case GDK_KEY_ISO_Next_Group:
+ case GDK_KEY_ISO_Next_Group_Lock:
+ case GDK_KEY_ISO_Prev_Group:
+ case GDK_KEY_ISO_Prev_Group_Lock:
+ case GDK_KEY_ISO_First_Group:
+ case GDK_KEY_ISO_First_Group_Lock:
+ case GDK_KEY_ISO_Last_Group:
+ case GDK_KEY_ISO_Last_Group_Lock:
+ case GDK_KEY_Multi_key:
+ case GDK_KEY_Codeinput:
+ case GDK_KEY_SingleCandidate:
+ case GDK_KEY_MultipleCandidate:
+ case GDK_KEY_PreviousCandidate:
+ case GDK_KEY_Kanji:
+ case GDK_KEY_Muhenkan:
+ case GDK_KEY_Henkan_Mode:
+ /* case GDK_KEY_Henkan: is GDK_KEY_Henkan_Mode */
+ case GDK_KEY_Romaji:
+ case GDK_KEY_Hiragana:
+ case GDK_KEY_Katakana:
+ case GDK_KEY_Hiragana_Katakana:
+ case GDK_KEY_Zenkaku:
+ case GDK_KEY_Hankaku:
+ case GDK_KEY_Zenkaku_Hankaku:
+ case GDK_KEY_Touroku:
+ case GDK_KEY_Massyo:
+ case GDK_KEY_Kana_Lock:
+ case GDK_KEY_Kana_Shift:
+ case GDK_KEY_Eisu_Shift:
+ case GDK_KEY_Eisu_toggle:
+ /* case GDK_KEY_Kanji_Bangou: is GDK_KEY_Codeinput */
+ /* case GDK_KEY_Zen_Koho: is GDK_KEY_MultipleCandidate */
+ /* case GDK_KEY_Mae_Koho: is GDK_KEY_PreviousCandidate */
+ /* case GDK_KEY_kana_switch: is GDK_KEY_ISO_Group_Shift */
+ case GDK_KEY_Hangul:
+ case GDK_KEY_Hangul_Start:
+ case GDK_KEY_Hangul_End:
+ case GDK_KEY_Hangul_Hanja:
+ case GDK_KEY_Hangul_Jamo:
+ case GDK_KEY_Hangul_Romaja:
+ /* case GDK_KEY_Hangul_Codeinput: is GDK_KEY_Codeinput */
+ case GDK_KEY_Hangul_Jeonja:
+ case GDK_KEY_Hangul_Banja:
+ case GDK_KEY_Hangul_PreHanja:
+ case GDK_KEY_Hangul_PostHanja:
+ /* case GDK_KEY_Hangul_SingleCandidate: is GDK_KEY_SingleCandidate */
+ /* case GDK_KEY_Hangul_MultipleCandidate: is GDK_KEY_MultipleCandidate */
+ /* case GDK_KEY_Hangul_PreviousCandidate: is GDK_KEY_PreviousCandidate */
+ case GDK_KEY_Hangul_Special:
+ /* case GDK_KEY_Hangul_switch: is GDK_KEY_ISO_Group_Shift */
+
steal = FALSE;
break;
default:
@@ -5309,7 +4923,7 @@ vte_terminal_key_press(GtkWidget *widget, GdkEventKey *event)
handled = FALSE;
/* Map the key to a sequence name if we can. */
switch (keyval) {
- case GDK_KEY (BackSpace):
+ case GDK_KEY_BackSpace:
switch (terminal->pvt->backspace_binding) {
case VTE_ERASE_ASCII_BACKSPACE:
normal = g_strdup("");
@@ -5357,8 +4971,8 @@ vte_terminal_key_press(GtkWidget *widget, GdkEventKey *event)
}
handled = TRUE;
break;
- case GDK_KEY (KP_Delete):
- case GDK_KEY (Delete):
+ case GDK_KEY_KP_Delete:
+ case GDK_KEY_Delete:
switch (terminal->pvt->delete_binding) {
case VTE_ERASE_ASCII_BACKSPACE:
normal = g_strdup("\010");
@@ -5386,8 +5000,8 @@ vte_terminal_key_press(GtkWidget *widget, GdkEventKey *event)
handled = TRUE;
suppress_meta_esc = TRUE;
break;
- case GDK_KEY (KP_Insert):
- case GDK_KEY (Insert):
+ case GDK_KEY_KP_Insert:
+ case GDK_KEY_Insert:
if (modifiers & GDK_SHIFT_MASK) {
if (modifiers & GDK_CONTROL_MASK) {
vte_terminal_paste_clipboard(terminal);
@@ -5405,9 +5019,10 @@ vte_terminal_key_press(GtkWidget *widget, GdkEventKey *event)
}
break;
/* Keypad/motion keys. */
- case GDK_KEY (KP_Up):
- case GDK_KEY (Up):
- if (modifiers & GDK_CONTROL_MASK
+ case GDK_KEY_KP_Up:
+ case GDK_KEY_Up:
+ if (terminal->pvt->screen == &terminal->pvt->normal_screen
+ && modifiers & GDK_CONTROL_MASK
&& modifiers & GDK_SHIFT_MASK) {
vte_terminal_scroll_lines(terminal, -1);
scrolled = TRUE;
@@ -5415,9 +5030,10 @@ vte_terminal_key_press(GtkWidget *widget, GdkEventKey *event)
suppress_meta_esc = TRUE;
}
break;
- case GDK_KEY (KP_Down):
- case GDK_KEY (Down):
- if (modifiers & GDK_CONTROL_MASK
+ case GDK_KEY_KP_Down:
+ case GDK_KEY_Down:
+ if (terminal->pvt->screen == &terminal->pvt->normal_screen
+ && modifiers & GDK_CONTROL_MASK
&& modifiers & GDK_SHIFT_MASK) {
vte_terminal_scroll_lines(terminal, 1);
scrolled = TRUE;
@@ -5425,52 +5041,56 @@ vte_terminal_key_press(GtkWidget *widget, GdkEventKey *event)
suppress_meta_esc = TRUE;
}
break;
- case GDK_KEY (KP_Page_Up):
- case GDK_KEY (Page_Up):
- if (modifiers & GDK_SHIFT_MASK) {
+ case GDK_KEY_KP_Page_Up:
+ case GDK_KEY_Page_Up:
+ if (terminal->pvt->screen == &terminal->pvt->normal_screen
+ && modifiers & GDK_SHIFT_MASK) {
vte_terminal_scroll_pages(terminal, -1);
scrolled = TRUE;
handled = TRUE;
suppress_meta_esc = TRUE;
}
break;
- case GDK_KEY (KP_Page_Down):
- case GDK_KEY (Page_Down):
- if (modifiers & GDK_SHIFT_MASK) {
+ case GDK_KEY_KP_Page_Down:
+ case GDK_KEY_Page_Down:
+ if (terminal->pvt->screen == &terminal->pvt->normal_screen
+ && modifiers & GDK_SHIFT_MASK) {
vte_terminal_scroll_pages(terminal, 1);
scrolled = TRUE;
handled = TRUE;
suppress_meta_esc = TRUE;
}
break;
- case GDK_KEY (KP_Home):
- case GDK_KEY (Home):
- if (modifiers & GDK_SHIFT_MASK) {
+ case GDK_KEY_KP_Home:
+ case GDK_KEY_Home:
+ if (terminal->pvt->screen == &terminal->pvt->normal_screen
+ && modifiers & GDK_SHIFT_MASK) {
vte_terminal_maybe_scroll_to_top(terminal);
scrolled = TRUE;
handled = TRUE;
}
break;
- case GDK_KEY (KP_End):
- case GDK_KEY (End):
- if (modifiers & GDK_SHIFT_MASK) {
+ case GDK_KEY_KP_End:
+ case GDK_KEY_End:
+ if (terminal->pvt->screen == &terminal->pvt->normal_screen
+ && modifiers & GDK_SHIFT_MASK) {
vte_terminal_maybe_scroll_to_bottom(terminal);
scrolled = TRUE;
handled = TRUE;
}
break;
/* Let Shift +/- tweak the font, like XTerm does. */
- case GDK_KEY (KP_Add):
- case GDK_KEY (KP_Subtract):
+ case GDK_KEY_KP_Add:
+ case GDK_KEY_KP_Subtract:
if (modifiers &
(GDK_SHIFT_MASK | GDK_CONTROL_MASK)) {
switch (keyval) {
- case GDK_KEY (KP_Add):
+ case GDK_KEY_KP_Add:
vte_terminal_emit_increase_font_size(terminal);
handled = TRUE;
suppress_meta_esc = TRUE;
break;
- case GDK_KEY (KP_Subtract):
+ case GDK_KEY_KP_Subtract:
vte_terminal_emit_decrease_font_size(terminal);
handled = TRUE;
suppress_meta_esc = TRUE;
@@ -5493,7 +5113,7 @@ vte_terminal_key_press(GtkWidget *widget, GdkEventKey *event)
terminal->pvt->keypad_mode == VTE_KEYMODE_APPLICATION,
terminal->pvt->termcap,
terminal->pvt->emulation ?
- terminal->pvt->emulation : vte_terminal_get_default_emulation(terminal),
+ terminal->pvt->emulation : vte_get_default_emulation(),
&normal,
&normal_length,
&special);
@@ -5610,8 +5230,8 @@ vte_terminal_key_release(GtkWidget *widget, GdkEventKey *event)
&& gtk_im_context_filter_keypress (terminal->pvt->im_context, event);
}
-/**
- * vte_terminal_is_word_char:
+/*
+ * _vte_terminal_is_word_char:
* @terminal: a #VteTerminal
* @c: a candidate Unicode code point
*
@@ -5621,32 +5241,11 @@ vte_terminal_key_release(GtkWidget *widget, GdkEventKey *event)
* Returns: %TRUE if the character is considered to be part of a word
*/
gboolean
-vte_terminal_is_word_char(VteTerminal *terminal, gunichar c)
+_vte_terminal_is_word_char(VteTerminal *terminal, gunichar c)
{
- guint i;
- VteWordCharRange *range;
- g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
-
- if (terminal->pvt->word_chars != NULL) {
- /* Go through each range and check if c is included. */
- for (i = 0; i < terminal->pvt->word_chars->len; i++) {
- range = &g_array_index(terminal->pvt->word_chars,
- VteWordCharRange,
- i);
- if ((c >= range->start) && (c <= range->end))
- return TRUE;
- }
- }
-
- /* If not ASCII, or ASCII and no array set (or empty array),
- * fall back on Unicode properties. */
- return (c >= 0x80 ||
- (terminal->pvt->word_chars == NULL) ||
- (terminal->pvt->word_chars->len == 0)) &&
- g_unichar_isgraph(c) &&
- !g_unichar_ispunct(c) &&
- !g_unichar_isspace(c) &&
- (c != '\0');
+ return g_unichar_isgraph(c) &&
+ (g_unichar_isalnum(c) ||
+ g_unichar_ispunct(c));
}
/* Check if the characters in the two given locations are in the same class
@@ -5658,7 +5257,7 @@ vte_same_class(VteTerminal *terminal, glong acol, glong arow,
const VteCell *pcell = NULL;
gboolean word_char;
if ((pcell = vte_terminal_find_charcell(terminal, acol, arow)) != NULL && pcell->c != 0) {
- word_char = vte_terminal_is_word_char(terminal, _vte_unistr_get_base (pcell->c));
+ word_char = _vte_terminal_is_word_char(terminal, _vte_unistr_get_base (pcell->c));
/* Lets not group non-wordchars together (bug #25290) */
if (!word_char)
@@ -5668,7 +5267,7 @@ vte_same_class(VteTerminal *terminal, glong acol, glong arow,
if (pcell == NULL || pcell->c == 0) {
return FALSE;
}
- if (word_char != vte_terminal_is_word_char(terminal, _vte_unistr_get_base (pcell->c))) {
+ if (word_char != _vte_terminal_is_word_char(terminal, _vte_unistr_get_base (pcell->c))) {
return FALSE;
}
return TRUE;
@@ -5814,22 +5413,88 @@ vte_terminal_paste_cb(GtkClipboard *clipboard, const gchar *text, gpointer data)
}
}
+/**
+ * _vte_terminal_xy_to_grid:
+ * @x: the X coordinate
+ * @y: the Y coordinate
+ * @col: return location to store the column
+ * @row: return location to store the row
+ *
+ * Translates from widget coordinates to grid coordinates.
+ *
+ * If the coordinates are outside the grid, returns %FALSE.
+ */
+gboolean
+_vte_terminal_xy_to_grid(VteTerminal *terminal,
+ long x,
+ long y,
+ long *col,
+ long *row)
+{
+ VteTerminalPrivate *pvt = terminal->pvt;
+ long c, r;
+
+ /* FIXMEchpe: is this correct for RTL? */
+ c = (x - pvt->padding.left) / pvt->char_width;
+ r = (y - pvt->padding.top) / pvt->char_height;
+
+ if ((c < 0 || c >= pvt->column_count) ||
+ (r < 0 || r >= pvt->row_count))
+ return FALSE;
+
+ *col = c;
+ *row = r;
+ return TRUE;
+}
+
+/*
+ * _vte_terminal_size_to_grid_size:
+ * @w: the width in px
+ * @h: the height in px
+ * @col: return location to store the column count
+ * @row: return location to store the row count
+ *
+ * Translates from widget size to grid size.
+ *
+ * If the given width or height are insufficient to show even
+ * one column or row (i.e due to padding), returns %FALSE.
+ */
+gboolean
+_vte_terminal_size_to_grid_size(VteTerminal *terminal,
+ long w,
+ long h,
+ long *cols,
+ long *rows)
+{
+ VteTerminalPrivate *pvt = terminal->pvt;
+ long n_cols, n_rows;
+
+ n_cols = (w - pvt->padding.left - pvt->padding.right) / pvt->char_width;
+ n_rows = (h - pvt->padding.top -pvt->padding.bottom) / pvt->char_height;
+
+ if (n_cols <= 0 || n_rows <= 0)
+ return FALSE;
+
+ *cols = n_cols;
+ *rows = n_rows;
+ return TRUE;
+}
+
static void
-vte_terminal_get_mouse_tracking_info (VteTerminal *terminal,
- int button,
- long col,
- long row,
- unsigned char *pb,
- unsigned char *px,
- unsigned char *py)
+vte_terminal_feed_mouse_event(VteTerminal *terminal,
+ int button,
+ gboolean is_drag,
+ gboolean is_release,
+ long col,
+ long row)
{
- unsigned char cb = 0, cx = 0, cy = 0;
+ unsigned char cb = 0;
+ long cx, cy;
+ char buf[LINE_MAX];
+ gint len = 0;
/* Encode the button information in cb. */
switch (button) {
- case 0: /* Release/no buttons. */
- cb = 3;
- break;
case 1: /* Left. */
cb = 0;
break;
@@ -5846,7 +5511,12 @@ vte_terminal_get_mouse_tracking_info (VteTerminal *terminal,
cb = 65; /* Scroll down. */
break;
}
- cb += 32; /* 32 for normal */
+
+ /* With the exception of the 1006 mode, button release is also encoded here. */
+ /* Note that if multiple extensions are enabled, the 1006 is used, so it's okay to check for only that. */
+ if (is_release && !terminal->pvt->mouse_xterm_extension) {
+ cb = 3;
+ }
/* Encode the modifiers. */
if (terminal->pvt->modifiers & GDK_SHIFT_MASK) {
@@ -5859,42 +5529,59 @@ vte_terminal_get_mouse_tracking_info (VteTerminal *terminal,
cb |= 16;
}
- /* Encode the cursor coordinates. */
- cx = 32 + CLAMP(1 + col,
- 1, terminal->column_count);
- cy = 32 + CLAMP(1 + row,
- 1, terminal->row_count);;
+ /* Encode a drag event. */
+ if (is_drag) {
+ cb |= 32;
+ }
+
+ /* Clamp the cursor coordinates. Make them 1-based. */
+ cx = CLAMP(1 + col,
+ 1, terminal->pvt->column_count);
+ cy = CLAMP(1 + row,
+ 1, terminal->pvt->row_count);
- *pb = cb;
- *px = cx;
- *py = cy;
+ /* Check the extensions in decreasing order of preference. Encoding the release event above assumes that 1006 comes first. */
+ if (terminal->pvt->mouse_xterm_extension) {
+ /* xterm's extended mode (1006) */
+ len = g_snprintf(buf, sizeof(buf), _VTE_CAP_CSI "<%d;%ld;%ld%c", cb, cx, cy, is_release ? 'm' : 'M');
+ } else if (terminal->pvt->mouse_urxvt_extension) {
+ /* urxvt's extended mode (1015) */
+ len = g_snprintf(buf, sizeof(buf), _VTE_CAP_CSI "%d;%ld;%ldM", 32 + cb, cx, cy);
+ } else if (cx <= 231 && cy <= 231) {
+ /* legacy mode */
+ len = g_snprintf(buf, sizeof(buf), _VTE_CAP_CSI "M%c%c%c", 32 + cb, 32 + (guchar)cx, 32 + (guchar)cy);
+ }
+
+ /* Send event direct to the child, this is binary not text data */
+ vte_terminal_feed_child_binary(terminal, buf, len);
}
static void
vte_terminal_send_mouse_button_internal(VteTerminal *terminal,
int button,
+ gboolean is_release,
long x,
long y)
{
- unsigned char cb, cx, cy;
- char buf[LINE_MAX];
- gint len;
- int width = terminal->char_width;
- int height = terminal->char_height;
- long col = (x - terminal->pvt->inner_border.left) / width;
- long row = (y - terminal->pvt->inner_border.top) / height;
+ int width = terminal->pvt->char_width;
+ int height = terminal->pvt->char_height;
+ long col = (x - terminal->pvt->padding.left) / width;
+ long row = (y - terminal->pvt->padding.top) / height;
- vte_terminal_get_mouse_tracking_info (terminal,
- button, col, row,
- &cb, &cx, &cy);
-
- /* Send event direct to the child, this is binary not text data */
- len = g_snprintf(buf, sizeof(buf), _VTE_CAP_CSI "M%c%c%c", cb, cx, cy);
- vte_terminal_feed_child_binary(terminal, buf, len);
+ vte_terminal_feed_mouse_event(terminal, button, FALSE /* not drag */, is_release, col, row);
}
-/* Send a mouse button click/release notification. */
-static void
+/*
+ * vte_terminal_maybe_send_mouse_button:
+ * @terminal:
+ * @event:
+ *
+ * Sends a mouse button click or release notification to the application,
+ * if the terminal is in mouse tracking mode.
+ *
+ * Returns: %TRUE iff the event was consumed
+ */
+static gboolean
vte_terminal_maybe_send_mouse_button(VteTerminal *terminal,
GdkEventButton *event)
{
@@ -5903,68 +5590,72 @@ vte_terminal_maybe_send_mouse_button(VteTerminal *terminal,
switch (event->type) {
case GDK_BUTTON_PRESS:
if (terminal->pvt->mouse_tracking_mode < MOUSE_TRACKING_SEND_XY_ON_CLICK) {
- return;
+ return FALSE;
}
break;
case GDK_BUTTON_RELEASE: {
if (terminal->pvt->mouse_tracking_mode < MOUSE_TRACKING_SEND_XY_ON_BUTTON) {
- return;
+ return FALSE;
}
break;
}
default:
- return;
+ return FALSE;
break;
}
vte_terminal_send_mouse_button_internal(terminal,
- (event->type == GDK_BUTTON_PRESS) ? event->button : 0,
+ event->button,
+ event->type == GDK_BUTTON_RELEASE,
event->x, event->y);
+ return TRUE;
}
-/* Send a mouse motion notification. */
-static void
+/*
+ * vte_terminal_maybe_send_mouse_drag:
+ * @terminal:
+ * @event:
+ *
+ * Sends a mouse motion notification to the application,
+ * if the terminal is in mouse tracking mode.
+ *
+ * Returns: %TRUE iff the event was consumed
+ */
+static gboolean
vte_terminal_maybe_send_mouse_drag(VteTerminal *terminal, GdkEventMotion *event)
{
- unsigned char cb, cx, cy;
- char buf[LINE_MAX];
- gint len;
- int width = terminal->char_width;
- int height = terminal->char_height;
- long col = ((long) event->x - terminal->pvt->inner_border.left) / width;
- long row = ((long) event->y - terminal->pvt->inner_border.top) / height;
+ int width = terminal->pvt->char_width;
+ int height = terminal->pvt->char_height;
+ long col = ((long) event->x - terminal->pvt->padding.left) / width;
+ long row = ((long) event->y - terminal->pvt->padding.top) / height;
/* First determine if we even want to send notification. */
switch (event->type) {
case GDK_MOTION_NOTIFY:
if (terminal->pvt->mouse_tracking_mode < MOUSE_TRACKING_CELL_MOTION_TRACKING)
- return;
+ return FALSE;
if (terminal->pvt->mouse_tracking_mode < MOUSE_TRACKING_ALL_MOTION_TRACKING) {
if (terminal->pvt->mouse_last_button == 0) {
- return;
+ return FALSE;
}
/* the xterm doc is not clear as to whether
* all-tracking also sends degenerate same-cell events */
if (col == terminal->pvt->mouse_last_x / width &&
row == terminal->pvt->mouse_last_y / height)
- return;
+ return FALSE;
}
break;
default:
- return;
+ return FALSE;
break;
}
- vte_terminal_get_mouse_tracking_info (terminal,
- terminal->pvt->mouse_last_button, col, row,
- &cb, &cx, &cy);
- cb += 32; /* for movement */
-
- /* Send event direct to the child, this is binary not text data */
- len = g_snprintf(buf, sizeof(buf), _VTE_CAP_CSI "M%c%c%c", cb, cx, cy);
- vte_terminal_feed_child_binary(terminal, buf, len);
+ vte_terminal_feed_mouse_event(terminal, terminal->pvt->mouse_last_button,
+ TRUE /* drag */, FALSE /* not release */,
+ col, row);
+ return TRUE;
}
/* Clear all match hilites. */
@@ -5998,8 +5689,8 @@ vte_terminal_match_hilite_clear(VteTerminal *terminal)
static gboolean
cursor_inside_match (VteTerminal *terminal, long x, long y)
{
- gint width = terminal->char_width;
- gint height = terminal->char_height;
+ gint width = terminal->pvt->char_width;
+ gint height = terminal->pvt->char_height;
glong col = x / width;
glong row = y / height + terminal->pvt->screen->scroll_delta;
if (terminal->pvt->match_start.row == terminal->pvt->match_end.row) {
@@ -6060,8 +5751,8 @@ vte_terminal_match_hilite_update(VteTerminal *terminal, long x, long y)
VteScreen *screen;
long delta;
- width = terminal->char_width;
- height = terminal->char_height;
+ width = terminal->pvt->char_width;
+ height = terminal->pvt->char_height;
/* Check for matches. */
screen = terminal->pvt->screen;
@@ -6151,8 +5842,8 @@ vte_terminal_match_hilite(VteTerminal *terminal, long x, long y)
int width, height;
GtkAllocation allocation;
- width = terminal->char_width;
- height = terminal->char_height;
+ width = terminal->pvt->char_width;
+ height = terminal->pvt->char_height;
gtk_widget_get_allocation (&terminal->widget, &allocation);
@@ -6243,12 +5934,29 @@ vte_terminal_copy_cb(GtkClipboard *clipboard, GtkSelectionData *data,
}
}
+/* Convert the internal color code (either index or RGB, see vte-private.h) into RGB. */
+static void
+vte_terminal_get_rgb_from_index(const VteTerminal *terminal, guint index, PangoColor *color)
+{
+ if (index >= VTE_LEGACY_COLORS_OFFSET && index < VTE_LEGACY_COLORS_OFFSET + VTE_LEGACY_FULL_COLOR_SET_SIZE)
+ index -= VTE_LEGACY_COLORS_OFFSET;
+ if (index < VTE_PALETTE_SIZE) {
+ memcpy(color, _vte_terminal_get_color(terminal, index), sizeof(PangoColor));
+ } else if (index & VTE_RGB_COLOR) {
+ color->red = ((index >> 16) & 0xFF) * 257;
+ color->green = ((index >> 8) & 0xFF) * 257;
+ color->blue = (index & 0xFF) * 257;
+ } else {
+ g_assert_not_reached();
+ }
+}
+
/**
* VteSelectionFunc:
* @terminal: terminal in which the cell is.
* @column: column in which the cell is.
* @row: row in which the cell is.
- * @data: user data.
+ * @data: (closure): user data.
*
* Specifies the type of a selection function used to check whether
* a cell has to be selected or not.
@@ -6263,9 +5971,9 @@ vte_terminal_copy_cb(GtkClipboard *clipboard, GtkSelectionData *data,
* @start_col: first column to search for data
* @end_row: last row to search for data
* @end_col: last column to search for data
- * @is_selected: a #VteSelectionFunc callback
+ * @is_selected: (scope call) (allow-none): a #VteSelectionFunc callback
* @user_data: (closure): user data to be passed to the callback
- * @attributes: (out) (transfer full) (array) (element-type Vte.CharAttributes): location for storing text attributes
+ * @attributes: (out caller-allocates) (transfer full) (array) (element-type Vte.CharAttributes): location for storing text attributes
*
* Extracts a view of the visible part of the terminal. If @is_selected is not
* %NULL, characters will only be read if @is_selected returns %TRUE after being
@@ -6307,24 +6015,20 @@ vte_terminal_get_text_range_maybe_wrapped(VteTerminal *terminal,
gboolean include_trailing_spaces)
{
glong col, row, last_empty, last_emptycol, last_nonempty, last_nonemptycol;
- VteScreen *screen;
const VteCell *pcell = NULL;
GString *string;
struct _VteCharAttributes attr;
- PangoColor fore, back, *palette;
+ PangoColor fore, back;
if (!is_selected)
is_selected = always_selected;
- screen = terminal->pvt->screen;
-
if (attributes)
g_array_set_size (attributes, 0);
string = g_string_new(NULL);
memset(&attr, 0, sizeof(attr));
- palette = terminal->pvt->palette;
col = start_col;
for (row = start_row; row < end_row + 1; row++, col = 0) {
const VteRowData *row_data = _vte_terminal_find_row_data (terminal, row);
@@ -6344,8 +6048,8 @@ vte_terminal_get_text_range_maybe_wrapped(VteTerminal *terminal,
* the selection. */
if (!pcell->attr.fragment && is_selected(terminal, col, row, data)) {
/* Store the attributes of this character. */
- fore = palette[pcell->attr.fore];
- back = palette[pcell->attr.back];
+ vte_terminal_get_rgb_from_index(terminal, pcell->attr.fore, &fore);
+ vte_terminal_get_rgb_from_index(terminal, pcell->attr.back, &back);
attr.fore.red = fore.red;
attr.fore.green = fore.green;
attr.fore.blue = fore.blue;
@@ -6410,7 +6114,7 @@ vte_terminal_get_text_range_maybe_wrapped(VteTerminal *terminal,
}
/* Adjust column, in case we want to append a newline */
- attr.column = MAX(terminal->column_count, attr.column + 1);
+ attr.column = MAX(terminal->pvt->column_count, attr.column + 1);
/* Add a newline in block mode. */
if (terminal->pvt->selection_block_mode) {
@@ -6418,7 +6122,7 @@ vte_terminal_get_text_range_maybe_wrapped(VteTerminal *terminal,
}
/* Else, if the last visible column on this line was selected and
* not soft-wrapped, append a newline. */
- else if (is_selected(terminal, terminal->column_count, row, data)) {
+ else if (is_selected(terminal, terminal->pvt->column_count, row, data)) {
/* If we didn't softwrap, add a newline. */
/* XXX need to clear row->soft_wrap on deletion! */
if (!vte_line_is_wrappable(terminal, row)) {
@@ -6447,8 +6151,8 @@ vte_terminal_get_text_maybe_wrapped(VteTerminal *terminal,
long start_row, start_col, end_row, end_col;
start_row = terminal->pvt->screen->scroll_delta;
start_col = 0;
- end_row = start_row + terminal->row_count - 1;
- end_col = terminal->column_count - 1;
+ end_row = start_row + terminal->pvt->row_count - 1;
+ end_col = terminal->pvt->column_count - 1;
return vte_terminal_get_text_range_maybe_wrapped(terminal,
start_row, start_col,
end_row, end_col,
@@ -6462,9 +6166,9 @@ vte_terminal_get_text_maybe_wrapped(VteTerminal *terminal,
/**
* vte_terminal_get_text:
* @terminal: a #VteTerminal
- * @is_selected: a #VteSelectionFunc callback
+ * @is_selected: (scope call) (allow-none): a #VteSelectionFunc callback
* @user_data: (closure): user data to be passed to the callback
- * @attributes: (out) (transfer full) (array) (element-type Vte.CharAttributes): location for storing text attributes
+ * @attributes: (out caller-allocates) (transfer full) (array) (element-type Vte.CharAttributes): location for storing text attributes
*
* Extracts a view of the visible part of the terminal. If @is_selected is not
* %NULL, characters will only be read if @is_selected returns %TRUE after being
@@ -6492,9 +6196,9 @@ vte_terminal_get_text(VteTerminal *terminal,
/**
* vte_terminal_get_text_include_trailing_spaces:
* @terminal: a #VteTerminal
- * @is_selected: a #VteSelectionFunc callback
+ * @is_selected: (scope call) (allow-none): a #VteSelectionFunc callback
* @user_data: (closure): user data to be passed to the callback
- * @attributes: (out) (transfer full) (array) (element-type Vte.CharAttributes): location for storing text attributes
+ * @attributes: (out caller-allocates) (transfer full) (array) (element-type Vte.CharAttributes): location for storing text attributes
*
* Extracts a view of the visible part of the terminal. If @is_selected is not
* %NULL, characters will only be read if @is_selected returns %TRUE after being
@@ -6523,116 +6227,6 @@ vte_terminal_get_text_include_trailing_spaces(VteTerminal *terminal,
TRUE);
}
-static inline void
-swap (guint *a, guint *b)
-{
- guint tmp;
- tmp = *a, *a = *b, *b = tmp;
-}
-
-static void
-vte_terminal_determine_colors_internal(VteTerminal *terminal,
- const VteCellAttr *attr,
- gboolean selected,
- gboolean cursor,
- guint *pfore, guint *pback)
-{
- guint fore, back;
-
- g_assert(attr);
-
- /* Start with cell colors */
- fore = attr->fore;
- back = attr->back;
-
- /* Reverse-mode switches default fore and back colors */
- if (G_UNLIKELY (terminal->pvt->screen->reverse_mode)) {
- if (fore == VTE_DEF_FG)
- fore = VTE_DEF_BG;
- if (back == VTE_DEF_BG)
- back = VTE_DEF_FG;
- }
-
- /* Handle bold by using set bold color or brightening */
- if (attr->bold) {
- if (fore == VTE_DEF_FG)
- fore = VTE_BOLD_FG;
- else if (fore < VTE_LEGACY_COLOR_SET_SIZE) {
- fore += VTE_COLOR_BRIGHT_OFFSET;
- }
- }
-
- /* Handle half similarly */
- if (attr->half) {
- if (fore == VTE_DEF_FG)
- fore = VTE_DIM_FG;
- else if ((fore < VTE_LEGACY_COLOR_SET_SIZE))
- fore = corresponding_dim_index[fore];
- }
-
- /* And standout */
- if (attr->standout) {
- if (back < VTE_LEGACY_COLOR_SET_SIZE)
- back += VTE_COLOR_BRIGHT_OFFSET;
- }
-
- /* Reverse cell? */
- if (attr->reverse) {
- swap (&fore, &back);
- }
-
- /* Selection: use hightlight back, or inverse */
- if (selected) {
- /* XXX what if hightlight back is same color as current back? */
- if (terminal->pvt->highlight_color_set)
- back = VTE_DEF_HL;
- else
- swap (&fore, &back);
- }
-
- /* Cursor: use cursor back, or inverse */
- if (cursor) {
- /* XXX what if cursor back is same color as current back? */
- if (terminal->pvt->cursor_color_set)
- back = VTE_CUR_BG;
- else
- swap (&fore, &back);
- }
-
- /* Invisible? */
- if (attr->invisible) {
- fore = back;
- }
-
- *pfore = fore;
- *pback = back;
-}
-
-static inline void
-vte_terminal_determine_colors (VteTerminal *terminal,
- const VteCell *cell,
- gboolean highlight,
- guint *fore, guint *back)
-{
- return vte_terminal_determine_colors_internal (terminal,
- cell ? &cell->attr : &basic_cell.cell.attr,
- highlight, FALSE,
- fore, back);
-}
-
-static inline void
-vte_terminal_determine_cursor_colors (VteTerminal *terminal,
- const VteCell *cell,
- gboolean highlight,
- guint *fore, guint *back)
-{
- return vte_terminal_determine_colors_internal (terminal,
- cell ? &cell->attr : &basic_cell.cell.attr,
- highlight, TRUE,
- fore, back);
-}
-
-
/*
* Compares the visual attributes of a VteCellAttr for equality, but ignores
* attributes that tend to change from character to character or are otherwise
@@ -6674,24 +6268,28 @@ vte_terminal_cellattr_to_html(VteTerminal *terminal, const VteCellAttr *attr, co
g_string_prepend(string, "<b>");
g_string_append(string, "</b>");
}
- if (attr->fore != VTE_DEF_FG || attr->reverse) {
- PangoColor *color = &terminal->pvt->palette[fore];
- gchar *tag = g_strdup_printf(
- "<font color=\"#%02X%02X%02X\">",
- color->red >> 8,
- color->green >> 8,
- color->blue >> 8);
+ if (attr->fore != VTE_DEFAULT_FG || attr->reverse) {
+ PangoColor color;
+ char *tag;
+
+ vte_terminal_get_rgb_from_index(terminal, attr->fore, &color);
+ tag = g_strdup_printf("<font color=\"#%02X%02X%02X\">",
+ color.red >> 8,
+ color.green >> 8,
+ color.blue >> 8);
g_string_prepend(string, tag);
g_free(tag);
g_string_append(string, "</font>");
}
- if (attr->back != VTE_DEF_BG || attr->reverse) {
- PangoColor *color = &terminal->pvt->palette[back];
- gchar *tag = g_strdup_printf(
- "<span style=\"background-color:#%02X%02X%02X\">",
- color->red >> 8,
- color->green >> 8,
- color->blue >> 8);
+ if (attr->back != VTE_DEFAULT_BG || attr->reverse) {
+ PangoColor color;
+ char *tag;
+
+ vte_terminal_get_rgb_from_index(terminal, attr->back, &color);
+ tag = g_strdup_printf("<span style=\"background-color:#%02X%02X%02X\">",
+ color.red >> 8,
+ color.green >> 8,
+ color.blue >> 8);
g_string_prepend(string, tag);
g_free(tag);
g_string_append(string, "</span>");
@@ -6791,7 +6389,7 @@ vte_terminal_attributes_to_html(VteTerminal *terminal, const gchar *text, GArray
* vte_terminal_get_cursor_position:
* @terminal: a #VteTerminal
* @column: (out) (allow-none): a location to store the column, or %NULL
- * @row : (out) (allow-none): a location to store the row, or %NULL
+ * @row: (out) (allow-none): a location to store the row, or %NULL
*
* Reads the location of the insertion cursor and returns it. The row
* coordinate is absolute.
@@ -6831,7 +6429,7 @@ vte_terminal_copy(VteTerminal *terminal, VteSelection sel)
terminal->pvt->selection_start.row,
0,
terminal->pvt->selection_end.row,
- terminal->column_count,
+ terminal->pvt->column_count,
vte_cell_is_selected,
NULL,
attributes);
@@ -6871,14 +6469,6 @@ vte_terminal_copy(VteTerminal *terminal, VteSelection sel)
}
}
-/* Place the selected text onto the CLIPBOARD clipboard. Do this
- * asynchronously, so that we can suppor the html target as well */
-static void
-vte_terminal_real_copy_clipboard(VteTerminal *terminal)
-{
- vte_terminal_copy(terminal, VTE_SELECTION_CLIPBOARD);
-}
-
/* Paste from the given clipboard. */
static void
vte_terminal_paste(VteTerminal *terminal, GdkAtom board)
@@ -6905,10 +6495,35 @@ vte_terminal_invalidate_selection (VteTerminal *terminal)
terminal->pvt->selection_block_mode);
}
+/* Confine coordinates into the visible area. Padding is alreday subtracted. */
+static void
+vte_terminal_confine_coordinates (VteTerminal *terminal, long *xp, long *yp)
+{
+ long x = *xp;
+ long y = *yp;
+
+ if (y < 0) {
+ y = 0;
+ if (!terminal->pvt->selection_block_mode)
+ x = 0;
+ } else if (y >= terminal->pvt->row_count * terminal->pvt->char_height) {
+ y = terminal->pvt->row_count * terminal->pvt->char_height - 1;
+ if (!terminal->pvt->selection_block_mode)
+ x = terminal->pvt->column_count * terminal->pvt->char_width - 1;
+ }
+ if (x < 0) {
+ x = 0;
+ } else if (x >= terminal->pvt->column_count * terminal->pvt->char_width) {
+ x = terminal->pvt->column_count * terminal->pvt->char_width - 1;
+ }
+
+ *xp = x;
+ *yp = y;
+}
/* Start selection at the location of the event. */
static void
-vte_terminal_start_selection(VteTerminal *terminal, GdkEventButton *event,
+vte_terminal_start_selection(VteTerminal *terminal, long x, long y,
enum vte_selection_type selection_type)
{
long delta;
@@ -6918,12 +6533,14 @@ vte_terminal_start_selection(VteTerminal *terminal, GdkEventButton *event,
if (terminal->pvt->selection_block_mode)
selection_type = selection_type_char;
+ /* Confine coordinates into the visible area. (#563024, #722635c7) */
+ vte_terminal_confine_coordinates(terminal, &x, &y);
+
/* Record that we have the selection, and where it started. */
delta = terminal->pvt->screen->scroll_delta;
terminal->pvt->has_selection = TRUE;
- terminal->pvt->selection_last.x = event->x - terminal->pvt->inner_border.left;
- terminal->pvt->selection_last.y = event->y - terminal->pvt->inner_border.top +
- (terminal->char_height * delta);
+ terminal->pvt->selection_last.x = x;
+ terminal->pvt->selection_last.y = y + (terminal->pvt->char_height * delta);
/* Decide whether or not to restart on the next drag. */
switch (selection_type) {
@@ -6947,6 +6564,7 @@ vte_terminal_start_selection(VteTerminal *terminal, GdkEventButton *event,
/* Record the selection type. */
terminal->pvt->selection_type = selection_type;
terminal->pvt->selecting = TRUE;
+ terminal->pvt->selecting_after_threshold = FALSE;
_vte_debug_print(VTE_DEBUG_SELECTION,
"Selection started at (%ld,%ld).\n",
@@ -6975,7 +6593,11 @@ _vte_terminal_maybe_end_selection (VteTerminal *terminal)
return TRUE;
}
- return FALSE;
+
+ if (terminal->pvt->selecting_after_threshold)
+ return TRUE;
+
+ return FALSE;
}
static long
@@ -7046,17 +6668,18 @@ vte_terminal_extend_selection_expand (VteTerminal *terminal)
break;
}
/* If the end point is to its right, then extend the
- * endpoint as far right as we can expect. */
+ * endpoint to the beginning of the next row. */
if (ec->col >= i) {
- ec->col = MAX(ec->col,
- MAX(terminal->column_count,
- (long) _vte_row_data_length (rowdata)));
+ ec->col = -1;
+ ec->row++;
}
} else {
- /* Snap to the rightmost column, only if selecting anything of
- * this row. */
- if (ec->col >= 0)
- ec->col = MAX(ec->col, terminal->column_count);
+ /* Snap to the beginning of the next line, only if
+ * selecting anything of this row. */
+ if (ec->col >= 0) {
+ ec->col = -1;
+ ec->row++;
+ }
}
ec->col = find_end_column (terminal, ec->col, ec->row);
@@ -7080,7 +6703,7 @@ vte_terminal_extend_selection_expand (VteTerminal *terminal)
/* Back up. */
for (i = (j == sc->row) ?
sc->col :
- terminal->column_count;
+ terminal->pvt->column_count;
i > 0;
i--) {
if (vte_same_class(terminal,
@@ -7100,13 +6723,13 @@ vte_terminal_extend_selection_expand (VteTerminal *terminal)
} else {
if (vte_line_is_wrappable(terminal, j - 1) &&
vte_same_class(terminal,
- terminal->column_count - 1,
+ terminal->pvt->column_count - 1,
j - 1,
0,
j)) {
/* Move on to the previous line. */
j--;
- sc->col = terminal->column_count - 1;
+ sc->col = terminal->pvt->column_count - 1;
sc->row = j;
} else {
break;
@@ -7127,7 +6750,7 @@ vte_terminal_extend_selection_expand (VteTerminal *terminal)
for (i = (j == ec->row) ?
ec->col :
0;
- i < terminal->column_count - 1;
+ i < terminal->pvt->column_count - 1;
i++) {
if (vte_same_class(terminal,
i,
@@ -7140,13 +6763,13 @@ vte_terminal_extend_selection_expand (VteTerminal *terminal)
break;
}
}
- if (i < terminal->column_count - 1) {
+ if (i < terminal->pvt->column_count - 1) {
/* We hit a stopping point, so stop. */
break;
} else {
if (vte_line_is_wrappable(terminal, j) &&
vte_same_class(terminal,
- terminal->column_count - 1,
+ terminal->pvt->column_count - 1,
j,
0,
j + 1)) {
@@ -7177,14 +6800,10 @@ vte_terminal_extend_selection_expand (VteTerminal *terminal)
j++;
ec->row = j;
}
- /* Make sure we include all of the last line. */
- ec->col = terminal->column_count;
- if (_vte_ring_contains (screen->row_data, ec->row)) {
- rowdata = _vte_ring_index(screen->row_data, ec->row);
- if (rowdata != NULL) {
- ec->col = MAX(ec->col, (long) _vte_row_data_length (rowdata));
- }
- }
+ /* Make sure we include all of the last line by extending
+ * to the beginning of the next line. */
+ ec->row++;
+ ec->col = -1;
break;
}
}
@@ -7202,22 +6821,11 @@ vte_terminal_extend_selection(VteTerminal *terminal, long x, long y,
gboolean invalidate_selected = FALSE;
gboolean had_selection;
- height = terminal->char_height;
- width = terminal->char_width;
+ height = terminal->pvt->char_height;
+ width = terminal->pvt->char_width;
- /* Confine y into the visible area. (#563024) */
- if (y < 0) {
- y = 0;
- if (!terminal->pvt->selection_block_mode)
- x = 0;
- } else if (y >= terminal->row_count * height) {
- if (!terminal->pvt->selection_block_mode) {
- y = terminal->row_count * height;
- x = -1;
- } else {
- y = terminal->row_count * height - 1;
- }
- }
+ /* Confine coordinates into the visible area. (#563024, #722635c7) */
+ vte_terminal_confine_coordinates(terminal, &x, &y);
screen = terminal->pvt->screen;
old_start = terminal->pvt->selection_start;
@@ -7464,15 +7072,13 @@ vte_terminal_select_all (VteTerminal *terminal)
}
/**
- * vte_terminal_select_none:
+ * vte_terminal_unselect_all:
* @terminal: a #VteTerminal
*
* Clears the current selection.
- *
- * Since: 0.16
*/
void
-vte_terminal_select_none (VteTerminal *terminal)
+vte_terminal_unselect_all(VteTerminal *terminal)
{
g_return_if_fail (VTE_IS_TERMINAL (terminal));
@@ -7481,8 +7087,6 @@ vte_terminal_select_none (VteTerminal *terminal)
vte_terminal_deselect_all (terminal);
}
-
-
/* Autoscroll a bit. */
static gboolean
vte_terminal_autoscroll(VteTerminal *terminal)
@@ -7493,7 +7097,7 @@ vte_terminal_autoscroll(VteTerminal *terminal)
/* Provide an immediate effect for mouse wigglers. */
if (terminal->pvt->mouse_last_y < 0) {
- if (terminal->adjustment) {
+ if (terminal->pvt->vadjustment) {
/* Try to scroll up by one line. */
adj = terminal->pvt->screen->scroll_delta - 1;
vte_terminal_queue_adjustment_value_changed_clamped (terminal, adj);
@@ -7502,8 +7106,8 @@ vte_terminal_autoscroll(VteTerminal *terminal)
_vte_debug_print(VTE_DEBUG_EVENTS, "Autoscrolling down.\n");
}
if (terminal->pvt->mouse_last_y >=
- terminal->row_count * terminal->char_height) {
- if (terminal->adjustment) {
+ terminal->pvt->row_count * terminal->pvt->char_height) {
+ if (terminal->pvt->vadjustment) {
/* Try to scroll up by one line. */
adj = terminal->pvt->screen->scroll_delta + 1;
vte_terminal_queue_adjustment_value_changed_clamped (terminal, adj);
@@ -7513,8 +7117,8 @@ vte_terminal_autoscroll(VteTerminal *terminal)
}
if (extend) {
/* Don't select off-screen areas. That just confuses people. */
- xmax = terminal->column_count * terminal->char_width;
- ymax = terminal->row_count * terminal->char_height;
+ xmax = terminal->pvt->column_count * terminal->pvt->char_width;
+ ymax = terminal->pvt->row_count * terminal->pvt->char_height;
x = CLAMP(terminal->pvt->mouse_last_x, 0, xmax);
y = CLAMP(terminal->pvt->mouse_last_y, 0, ymax);
@@ -7524,7 +7128,7 @@ vte_terminal_autoscroll(VteTerminal *terminal)
x = 0;
}
if (terminal->pvt->mouse_last_y >= ymax && !terminal->pvt->selection_block_mode) {
- x = terminal->column_count * terminal->char_width;
+ x = terminal->pvt->column_count * terminal->pvt->char_width;
}
/* Extend selection to cover the newly-scrolled area. */
vte_terminal_extend_selection(terminal, x, y, FALSE, TRUE);
@@ -7542,7 +7146,7 @@ vte_terminal_start_autoscroll(VteTerminal *terminal)
if (terminal->pvt->mouse_autoscroll_tag == 0) {
terminal->pvt->mouse_autoscroll_tag =
g_timeout_add_full(G_PRIORITY_LOW,
- 666 / terminal->row_count,
+ 666 / terminal->pvt->row_count,
(GSourceFunc)vte_terminal_autoscroll,
terminal,
NULL);
@@ -7563,21 +7167,19 @@ vte_terminal_stop_autoscroll(VteTerminal *terminal)
static gboolean
vte_terminal_motion_notify(GtkWidget *widget, GdkEventMotion *event)
{
- VteTerminal *terminal;
+ VteTerminal *terminal = VTE_TERMINAL(widget);
int width, height;
long x, y;
gboolean handled = FALSE;
/* check to see if it matters */
- if (! gtk_widget_is_drawable (widget)) {
- return handled;
- }
+ if (G_UNLIKELY(!gtk_widget_get_realized(&terminal->widget)))
+ return FALSE;
- terminal = VTE_TERMINAL(widget);
- x = event->x - terminal->pvt->inner_border.left;
- y = event->y - terminal->pvt->inner_border.top;
- width = terminal->char_width;
- height = terminal->char_height;
+ x = event->x - terminal->pvt->padding.left;
+ y = event->y - terminal->pvt->padding.top;
+ width = terminal->pvt->char_width;
+ height = terminal->pvt->char_height;
_vte_debug_print(VTE_DEBUG_EVENTS,
"Motion notify (%ld,%ld) [%ld, %ld].\n",
@@ -7597,6 +7199,19 @@ vte_terminal_motion_notify(GtkWidget *widget, GdkEventMotion *event)
switch (event->type) {
case GDK_MOTION_NOTIFY:
+ if (terminal->pvt->selecting_after_threshold) {
+ if (!gtk_drag_check_threshold (widget,
+ terminal->pvt->mouse_last_x,
+ terminal->pvt->mouse_last_y,
+ x, y))
+ return TRUE;
+
+ vte_terminal_start_selection(terminal,
+ terminal->pvt->mouse_last_x,
+ terminal->pvt->mouse_last_y,
+ selection_type_char);
+ }
+
if (terminal->pvt->selecting &&
((terminal->pvt->modifiers & GDK_SHIFT_MASK) ||
!terminal->pvt->mouse_tracking_mode))
@@ -7606,9 +7221,9 @@ vte_terminal_motion_notify(GtkWidget *widget, GdkEventMotion *event)
x, y, FALSE, FALSE);
/* Start scrolling if we need to. */
- if (event->y < terminal->pvt->inner_border.top ||
- event->y >= terminal->row_count * height +
- terminal->pvt->inner_border.top)
+ if (event->y < terminal->pvt->padding.top ||
+ event->y >= terminal->pvt->row_count * height +
+ terminal->pvt->padding.top)
{
/* Give mouse wigglers something. */
vte_terminal_autoscroll(terminal);
@@ -7647,11 +7262,11 @@ vte_terminal_button_press(GtkWidget *widget, GdkEventButton *event)
terminal = VTE_TERMINAL(widget);
- x = event->x - terminal->pvt->inner_border.left;
- y = event->y - terminal->pvt->inner_border.top;
+ x = event->x - terminal->pvt->padding.left;
+ y = event->y - terminal->pvt->padding.top;
- height = terminal->char_height;
- width = terminal->char_width;
+ height = terminal->pvt->char_height;
+ width = terminal->pvt->char_width;
delta = terminal->pvt->screen->scroll_delta;
vte_terminal_match_hilite(terminal, x, y);
@@ -7669,7 +7284,7 @@ vte_terminal_button_press(GtkWidget *widget, GdkEventButton *event)
_vte_debug_print(VTE_DEBUG_EVENTS,
"Button %d single-click at (%ld,%ld)\n",
event->button,
- x, y + terminal->char_height * delta);
+ x, y + terminal->pvt->char_height * delta);
/* Handle this event ourselves. */
switch (event->button) {
case 1:
@@ -7703,9 +7318,7 @@ vte_terminal_button_press(GtkWidget *widget, GdkEventButton *event)
}
if (start_selecting) {
vte_terminal_deselect_all(terminal);
- vte_terminal_start_selection(terminal,
- event,
- selection_type_char);
+ terminal->pvt->selecting_after_threshold = TRUE;
handled = TRUE;
}
if (extend_selecting) {
@@ -7724,8 +7337,14 @@ vte_terminal_button_press(GtkWidget *widget, GdkEventButton *event)
case 2:
if ((terminal->pvt->modifiers & GDK_SHIFT_MASK) ||
!terminal->pvt->mouse_tracking_mode) {
- vte_terminal_paste_primary(terminal);
- handled = TRUE;
+ gboolean do_paste;
+
+ g_object_get (gtk_widget_get_settings(widget),
+ "gtk-enable-primary-paste",
+ &do_paste, NULL);
+ if (do_paste)
+ vte_terminal_paste_primary(terminal);
+ handled = do_paste;
}
break;
case 3:
@@ -7735,24 +7354,30 @@ vte_terminal_button_press(GtkWidget *widget, GdkEventButton *event)
/* If we haven't done anything yet, try sending the mouse
* event to the app. */
if (handled == FALSE) {
- vte_terminal_maybe_send_mouse_button(terminal, event);
- handled = TRUE;
+ handled = vte_terminal_maybe_send_mouse_button(terminal, event);
}
break;
case GDK_2BUTTON_PRESS:
_vte_debug_print(VTE_DEBUG_EVENTS,
"Button %d double-click at (%ld,%ld)\n",
event->button,
- x, y + (terminal->char_height * delta));
+ x, y + (terminal->pvt->char_height * delta));
switch (event->button) {
case 1:
+ if (terminal->pvt->selecting_after_threshold) {
+ vte_terminal_start_selection(terminal,
+ x, y,
+ selection_type_char);
+ handled = TRUE;
+ }
if ((terminal->pvt->modifiers & GDK_SHIFT_MASK) ||
!terminal->pvt->mouse_tracking_mode) {
vte_terminal_start_selection(terminal,
- event,
+ x, y,
selection_type_word);
vte_terminal_extend_selection(terminal,
x, y, FALSE, TRUE);
+ handled = TRUE;
}
break;
case 2:
@@ -7765,16 +7390,17 @@ vte_terminal_button_press(GtkWidget *widget, GdkEventButton *event)
_vte_debug_print(VTE_DEBUG_EVENTS,
"Button %d triple-click at (%ld,%ld).\n",
event->button,
- x, y + (terminal->char_height * delta));
+ x, y + (terminal->pvt->char_height * delta));
switch (event->button) {
case 1:
if ((terminal->pvt->modifiers & GDK_SHIFT_MASK) ||
!terminal->pvt->mouse_tracking_mode) {
vte_terminal_start_selection(terminal,
- event,
+ x, y,
selection_type_line);
vte_terminal_extend_selection(terminal,
x, y, FALSE, TRUE);
+ handled = TRUE;
}
break;
case 2:
@@ -7791,7 +7417,7 @@ vte_terminal_button_press(GtkWidget *widget, GdkEventButton *event)
terminal->pvt->mouse_last_x = x;
terminal->pvt->mouse_last_y = y;
- return TRUE;
+ return handled;
}
/* Read and handle a pointing device buttonrelease event. */
@@ -7804,8 +7430,8 @@ vte_terminal_button_release(GtkWidget *widget, GdkEventButton *event)
terminal = VTE_TERMINAL(widget);
- x = event->x - terminal->pvt->inner_border.left;
- y = event->y - terminal->pvt->inner_border.top;
+ x = event->x - terminal->pvt->padding.left;
+ y = event->y - terminal->pvt->padding.top;
vte_terminal_match_hilite(terminal, x, y);
@@ -7822,25 +7448,17 @@ vte_terminal_button_release(GtkWidget *widget, GdkEventButton *event)
event->button, x, y);
switch (event->button) {
case 1:
- /* If Shift is held down, or we're not in events mode,
- * copy the selected text. */
- if ((terminal->pvt->modifiers & GDK_SHIFT_MASK) ||
- !terminal->pvt->mouse_tracking_mode)
- handled = _vte_terminal_maybe_end_selection (terminal);
+ handled = _vte_terminal_maybe_end_selection (terminal);
break;
case 2:
- if ((terminal->pvt->modifiers & GDK_SHIFT_MASK) ||
- !terminal->pvt->mouse_tracking_mode) {
- handled = TRUE;
- }
+ handled = TRUE;
break;
case 3:
default:
break;
}
if (!handled) {
- vte_terminal_maybe_send_mouse_button(terminal, event);
- handled = TRUE;
+ handled = vte_terminal_maybe_send_mouse_button(terminal, event);
}
break;
default:
@@ -7851,8 +7469,9 @@ vte_terminal_button_release(GtkWidget *widget, GdkEventButton *event)
terminal->pvt->mouse_last_button = 0;
terminal->pvt->mouse_last_x = x;
terminal->pvt->mouse_last_y = y;
+ terminal->pvt->selecting_after_threshold = FALSE;
- return TRUE;
+ return handled;
}
/* Handle receiving or losing focus. */
@@ -7927,8 +7546,8 @@ vte_terminal_enter(GtkWidget *widget, GdkEventCrossing *event)
VteTerminal *terminal = VTE_TERMINAL (widget);
/* Hilite any matches. */
vte_terminal_match_hilite_show(terminal,
- event->x - terminal->pvt->inner_border.left,
- event->y - terminal->pvt->inner_border.top);
+ event->x - terminal->pvt->padding.left,
+ event->y - terminal->pvt->padding.top);
}
return ret;
}
@@ -8029,21 +7648,21 @@ vte_terminal_apply_metrics(VteTerminal *terminal,
descent = MAX(descent, 1);
/* Change settings, and keep track of when we've changed anything. */
- if (width != terminal->char_width) {
+ if (width != terminal->pvt->char_width) {
resize = cresize = TRUE;
- terminal->char_width = width;
+ terminal->pvt->char_width = width;
}
- if (height != terminal->char_height) {
+ if (height != terminal->pvt->char_height) {
resize = cresize = TRUE;
- terminal->char_height = height;
+ terminal->pvt->char_height = height;
}
- if (ascent != terminal->char_ascent) {
+ if (ascent != terminal->pvt->char_ascent) {
resize = TRUE;
- terminal->char_ascent = ascent;
+ terminal->pvt->char_ascent = ascent;
}
- if (descent != terminal->char_descent) {
+ if (descent != terminal->pvt->char_descent) {
resize = TRUE;
- terminal->char_descent = descent;
+ terminal->pvt->char_descent = descent;
}
terminal->pvt->line_thickness = line_thickness = MAX (MIN ((height - ascent) / 2, height / 14), 1);
terminal->pvt->underline_position = MIN (ascent + line_thickness, height - line_thickness);
@@ -8058,8 +7677,8 @@ vte_terminal_apply_metrics(VteTerminal *terminal,
/* Emit a signal that the font changed. */
if (cresize) {
vte_terminal_emit_char_size_changed(terminal,
- terminal->char_width,
- terminal->char_height);
+ terminal->pvt->char_width,
+ terminal->pvt->char_height);
}
/* Repaint. */
_vte_invalidate_all(terminal);
@@ -8072,16 +7691,15 @@ vte_terminal_ensure_font (VteTerminal *terminal)
if (terminal->pvt->draw != NULL) {
/* Load default fonts, if no fonts have been loaded. */
if (!terminal->pvt->has_fonts) {
- vte_terminal_set_font_full_internal(terminal,
- terminal->pvt->fontdesc,
- terminal->pvt->fontantialias);
+ vte_terminal_set_font(terminal,
+ terminal->pvt->fontdesc);
}
if (terminal->pvt->fontdirty) {
gint width, height, ascent;
terminal->pvt->fontdirty = FALSE;
_vte_draw_set_text_font (terminal->pvt->draw,
- terminal->pvt->fontdesc,
- terminal->pvt->fontantialias);
+ &terminal->widget,
+ terminal->pvt->fontdesc);
_vte_draw_get_text_metrics (terminal->pvt->draw,
&width, &height, &ascent);
vte_terminal_apply_metrics(terminal,
@@ -8090,40 +7708,59 @@ vte_terminal_ensure_font (VteTerminal *terminal)
}
}
+static void
+vte_terminal_update_font(VteTerminal *terminal)
+{
+ VteTerminalPrivate *pvt = terminal->pvt;
+ PangoFontDescription *desc;
+ gdouble size;
+
+ /* We'll get called again later */
+ if (pvt->unscaled_font_desc == NULL)
+ return;
-/**
- * vte_terminal_set_font_full:
+ desc = pango_font_description_copy(pvt->unscaled_font_desc);
+
+ size = pango_font_description_get_size(desc);
+ if (pango_font_description_get_size_is_absolute(desc)) {
+ pango_font_description_set_absolute_size(desc, pvt->font_scale * size);
+ } else {
+ pango_font_description_set_size(desc, pvt->font_scale * size);
+ }
+
+ if (pvt->fontdesc) {
+ pango_font_description_free(pvt->fontdesc);
+ }
+ pvt->fontdesc = desc;
+
+ pvt->fontdirty = TRUE;
+ pvt->has_fonts = TRUE;
+
+ /* Set the drawing font. */
+ if (gtk_widget_get_realized (&terminal->widget)) {
+ vte_terminal_ensure_font (terminal);
+ }
+}
+
+/*
+ * _vte_terminal_set_font:
* @terminal: a #VteTerminal
- * @font_desc: The #PangoFontDescription of the desired font, or %NULL
- * @antialias: Specify if anti aliasing of the fonts is to be used or not.
+ * @font_desc: (allow-none): a #PangoFontDescription for the desired font, or %NULL
*
* 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.
- *
- * Since: 0.11.11
- *
- * Deprecated: 0.20: Use vte_terminal_set_font()
*/
void
-vte_terminal_set_font_full(VteTerminal *terminal,
- const PangoFontDescription *font_desc,
- VteTerminalAntiAlias antialias)
-{
- vte_terminal_set_font_full_internal(terminal, font_desc, antialias);
-}
-
-static void
-vte_terminal_set_font_full_internal(VteTerminal *terminal,
- const PangoFontDescription *font_desc,
- VteTerminalAntiAlias antialias)
+vte_terminal_set_font(VteTerminal *terminal,
+ const PangoFontDescription *font_desc)
{
GObject *object;
- GtkStyle *style;
+ GtkStyleContext *context;
VteTerminalPrivate *pvt;
- PangoFontDescription *desc;
+ PangoFontDescription *desc;
gboolean same_desc;
g_return_if_fail(VTE_IS_TERMINAL(terminal));
@@ -8132,9 +7769,8 @@ vte_terminal_set_font_full_internal(VteTerminal *terminal,
pvt = terminal->pvt;
/* Create an owned font description. */
- gtk_widget_ensure_style (&terminal->widget);
- style = gtk_widget_get_style (&terminal->widget);
- desc = pango_font_description_copy (style->font_desc);
+ context = gtk_widget_get_style_context(&terminal->widget);
+ gtk_style_context_get(context, GTK_STATE_FLAG_NORMAL, "font", &desc, NULL);
pango_font_description_set_family_static (desc, "monospace");
if (font_desc != NULL) {
pango_font_description_merge (desc, font_desc, TRUE);
@@ -8151,122 +7787,81 @@ vte_terminal_set_font_full_internal(VteTerminal *terminal,
"Using default monospace font.\n");
}
- same_desc = pvt->fontdesc && pango_font_description_equal (pvt->fontdesc, desc);
-
+ same_desc = pvt->unscaled_font_desc &&
+ pango_font_description_equal (pvt->unscaled_font_desc, desc);
+
/* Note that we proceed to recreating the font even if the description
- * and antialias settings are the same. This is because maybe screen
+ * are the same. This is because maybe screen
* font options were changed, or new fonts installed. Those will be
* detected at font creation time and respected.
*/
- g_object_freeze_notify(object);
-
/* Free the old font description and save the new one. */
- if (terminal->pvt->fontdesc != NULL) {
- pango_font_description_free(terminal->pvt->fontdesc);
+ if (terminal->pvt->unscaled_font_desc != NULL) {
+ pango_font_description_free(terminal->pvt->unscaled_font_desc);
}
- pvt->fontdesc = desc;
- pvt->fontantialias = antialias;
- pvt->fontdirty = TRUE;
- pvt->has_fonts = TRUE;
- if (!same_desc)
- g_object_notify(object, "font-desc");
+ terminal->pvt->unscaled_font_desc = desc /* adopted */;
- /* Set the drawing font. */
- if (gtk_widget_get_realized (&terminal->widget)) {
- vte_terminal_ensure_font (terminal);
- }
+ vte_terminal_update_font(terminal);
- g_object_thaw_notify(object);
+ if (!same_desc)
+ g_object_notify(object, "font-desc");
}
-/**
- * vte_terminal_set_font:
+ /**
+ * vte_terminal_get_font:
* @terminal: a #VteTerminal
- * @font_desc: (allow-none): a #PangoFontDescription for the desired font, or %NULL
*
- * 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.
+ * Queries the terminal for information about the fonts which will be
+ * used to draw text in the terminal.
+ *
+ * Returns: (transfer none): a #PangoFontDescription describing the font the terminal is
+ * currently using to render text
*/
-void
-vte_terminal_set_font(VteTerminal *terminal,
- const PangoFontDescription *font_desc)
-{
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
- vte_terminal_set_font_full_internal(terminal, font_desc,
- VTE_ANTI_ALIAS_USE_DEFAULT);
-}
-
-static void
-vte_terminal_set_font_from_string_full_internal(VteTerminal *terminal,
- const char *name,
- VteTerminalAntiAlias antialias)
+const PangoFontDescription *
+vte_terminal_get_font(VteTerminal *terminal)
{
- PangoFontDescription *font_desc = NULL;
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
+ g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL);
- if (name)
- font_desc = pango_font_description_from_string(name);
- vte_terminal_set_font_full_internal(terminal, font_desc, antialias);
- pango_font_description_free(font_desc);
+ return terminal->pvt->unscaled_font_desc;
}
/**
- * vte_terminal_set_font_from_string_full:
+ * vte_terminal_set_font_scale:
* @terminal: a #VteTerminal
- * @name: A string describing the font.
- * @antialias: Whether or not to antialias the font (if possible).
- *
- * A convenience function which converts @name into a #PangoFontDescription and
- * passes it to vte_terminal_set_font_full().
+ * @scale: the font scale
*
- * Since: 0.11.11
+ * Sets the terminal's font scale to @scale.
*
- * Deprecated: 0.20: Use vte_terminal_set_font()
+ * Since: 0.30
*/
void
-vte_terminal_set_font_from_string_full(VteTerminal *terminal, const char *name,
- VteTerminalAntiAlias antialias)
+vte_terminal_set_font_scale(VteTerminal *terminal,
+ gdouble scale)
{
- vte_terminal_set_font_from_string_full_internal(terminal, name, antialias);
-}
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
-/**
- * vte_terminal_set_font_from_string:
- * @terminal: a #VteTerminal
- * @name: (type utf8): a pango font description in string form
- *
- * A convenience function which converts @name into a #PangoFontDescription and
- * passes it to vte_terminal_set_font().
- */
-void
-vte_terminal_set_font_from_string(VteTerminal *terminal, const char *name)
-{
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
- g_return_if_fail(name != NULL);
- vte_terminal_set_font_from_string_full_internal(terminal, name,
- VTE_ANTI_ALIAS_USE_DEFAULT);
+ terminal->pvt->font_scale = CLAMP(scale, VTE_FONT_SCALE_MIN, VTE_FONT_SCALE_MAX);
+ vte_terminal_update_font(terminal);
+
+ g_object_notify(G_OBJECT(terminal), "font-scale");
}
/**
- * vte_terminal_get_font:
+ * vte_terminal_get_font_scale:
* @terminal: a #VteTerminal
*
- * Queries the terminal for information about the fonts which will be
- * used to draw text in the terminal.
+ * Returns: the terminal's font scale
*
- * Returns: (transfer none): a #PangoFontDescription describing the font the terminal is
- * currently using to render text
+ * Since: 0.30
*/
-const PangoFontDescription *
-vte_terminal_get_font(VteTerminal *terminal)
+gdouble
+vte_terminal_get_font_scale(VteTerminal *terminal)
{
- g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL);
- return terminal->pvt->fontdesc;
+ g_return_val_if_fail(VTE_IS_TERMINAL(terminal), 1.);
+
+ return terminal->pvt->font_scale;
}
/* Read and refresh our perception of the size of the PTY. */
@@ -8281,14 +7876,149 @@ vte_terminal_refresh_size(VteTerminal *terminal)
return;
if (vte_pty_get_size(pvt->pty, &rows, &columns, &error)) {
- terminal->row_count = rows;
- terminal->column_count = columns;
+ terminal->pvt->row_count = rows;
+ terminal->pvt->column_count = columns;
} else {
g_warning(_("Error reading PTY size, using defaults: %s\n"), error->message);
g_error_free(error);
}
}
+/* Resize the given screen (normal or alternate) of the terminal. */
+static void
+vte_terminal_screen_set_size(VteTerminal *terminal, VteScreen *screen, glong old_columns, glong old_rows, gboolean do_rewrap)
+{
+ VteRing *ring = screen->row_data;
+ VteVisualPosition cursor_saved_absolute;
+ VteVisualPosition below_viewport;
+ VteVisualPosition below_current_paragraph;
+ VteVisualPosition *markers[7];
+ gboolean was_scrolled_to_top = (screen->scroll_delta == _vte_ring_delta(ring));
+ gboolean was_scrolled_to_bottom = (screen->scroll_delta == screen->insert_delta);
+ glong old_top_lines;
+ glong new_scroll_delta;
+
+ _vte_debug_print(VTE_DEBUG_RESIZE,
+ "Resizing %s screen\n"
+ "Old insert_delta=%ld scroll_delta=%ld\n"
+ " cursor_current (absolute) row=%ld (visual line %ld) col=%ld\n"
+ " cursor_saved (relative to insert_delta) row=%ld col=%ld\n",
+ screen == &terminal->pvt->normal_screen ? "normal" : "alternate",
+ screen->insert_delta, screen->scroll_delta,
+ screen->cursor_current.row, screen->cursor_current.row - screen->scroll_delta + 1, screen->cursor_current.col,
+ screen->cursor_saved.row, screen->cursor_saved.col);
+
+ screen->scrolling_restricted = FALSE;
+
+ cursor_saved_absolute.row = screen->cursor_saved.row + screen->insert_delta;
+ cursor_saved_absolute.col = screen->cursor_saved.col;
+ below_viewport.row = screen->scroll_delta + old_rows;
+ below_viewport.col = 0;
+ below_current_paragraph.row = screen->cursor_current.row + 1;
+ while (below_current_paragraph.row < _vte_ring_next(ring)
+ && _vte_ring_index(ring, below_current_paragraph.row - 1)->attr.soft_wrapped) {
+ below_current_paragraph.row++;
+ }
+ below_current_paragraph.col = 0;
+ markers[0] = &screen->cursor_current;
+ markers[1] = &cursor_saved_absolute;
+ markers[2] = &below_viewport;
+ markers[3] = &below_current_paragraph;
+ if (screen == terminal->pvt->screen && terminal->pvt->has_selection) {
+ /* selection_end is inclusive, make it non-inclusive, see bug 722635. */
+ terminal->pvt->selection_end.col++;
+ markers[4] = &terminal->pvt->selection_start;
+ markers[5] = &terminal->pvt->selection_end;
+ markers[6] = NULL;
+ } else {
+ markers[4] = NULL;
+ }
+
+ old_top_lines = below_current_paragraph.row - screen->insert_delta;
+
+ if (do_rewrap && old_columns != terminal->pvt->column_count)
+ _vte_ring_rewrap(ring, terminal->pvt->column_count, markers);
+
+ if (_vte_ring_length(ring) > terminal->pvt->row_count) {
+ /* The content won't fit without scrollbars. Before figuring out the position, we might need to
+ drop some lines from the ring if the cursor is not at the bottom, as XTerm does. See bug 708213.
+ This code is really tricky, see ../doc/rewrap.txt for details! */
+ glong new_top_lines, drop1, drop2, drop3, drop;
+ screen->insert_delta = _vte_ring_next(ring) - terminal->pvt->row_count;
+ new_top_lines = below_current_paragraph.row - screen->insert_delta;
+ drop1 = _vte_ring_length(ring) - terminal->pvt->row_count;
+ drop2 = _vte_ring_length(ring) - below_current_paragraph.row;
+ drop3 = old_top_lines - new_top_lines;
+ drop = MIN(MIN(drop1, drop2), drop3);
+ if (drop > 0) {
+ int new_ring_next = screen->insert_delta + terminal->pvt->row_count - drop;
+ _vte_debug_print(VTE_DEBUG_RESIZE,
+ "Dropping %ld [== MIN(%ld, %ld, %ld)] rows at the bottom\n",
+ drop, drop1, drop2, drop3);
+ _vte_ring_shrink(ring, new_ring_next - _vte_ring_delta(ring));
+ }
+ }
+
+ if (screen == terminal->pvt->screen && terminal->pvt->has_selection) {
+ /* Make selection_end inclusive again, see above. */
+ terminal->pvt->selection_end.col--;
+ }
+
+ /* Figure out new insert and scroll deltas */
+ if (_vte_ring_length(ring) <= terminal->pvt->row_count) {
+ /* Everything fits without scrollbars. Align at top. */
+ screen->insert_delta = _vte_ring_delta(ring);
+ new_scroll_delta = screen->insert_delta;
+ _vte_debug_print(VTE_DEBUG_RESIZE,
+ "Everything fits without scrollbars\n");
+ } else {
+ /* Scrollbar required. Can't afford unused lines at bottom. */
+ screen->insert_delta = _vte_ring_next(ring) - terminal->pvt->row_count;
+ if (was_scrolled_to_bottom) {
+ /* Was scrolled to bottom, keep this way. */
+ new_scroll_delta = screen->insert_delta;
+ _vte_debug_print(VTE_DEBUG_RESIZE,
+ "Scroll to bottom\n");
+ } else if (was_scrolled_to_top) {
+ /* Was scrolled to top, keep this way. Not sure if this special case is worth it. */
+ new_scroll_delta = _vte_ring_delta(ring);
+ _vte_debug_print(VTE_DEBUG_RESIZE,
+ "Scroll to top\n");
+ } else {
+ /* Try to scroll so that the bottom visible row stays.
+ More precisely, the character below the bottom left corner stays in that
+ (invisible) row.
+ So if the bottom of the screen was at a hard line break then that hard
+ line break will stay there.
+ TODO: What would be the best behavior if the bottom of the screen is a
+ soft line break, i.e. only a partial line is visible at the bottom? */
+ new_scroll_delta = below_viewport.row - terminal->pvt->row_count;
+ _vte_debug_print(VTE_DEBUG_RESIZE,
+ "Scroll so bottom row stays\n");
+ }
+ }
+
+ /* Don't clamp, they'll be clamped when restored. Until then remember off-screen values
+ since they might become on-screen again on subsequent resizes. */
+ screen->cursor_saved.row = cursor_saved_absolute.row - screen->insert_delta;
+ screen->cursor_saved.col = cursor_saved_absolute.col;
+
+ _vte_debug_print(VTE_DEBUG_RESIZE,
+ "New insert_delta=%ld scroll_delta=%ld\n"
+ " cursor_current (absolute) row=%ld (visual line %ld) col=%ld\n"
+ " cursor_saved (relative to insert_delta) row=%ld col=%ld\n\n",
+ screen->insert_delta, new_scroll_delta,
+ screen->cursor_current.row, screen->cursor_current.row - new_scroll_delta + 1, screen->cursor_current.col,
+ screen->cursor_saved.row, screen->cursor_saved.col);
+
+ if (screen == terminal->pvt->screen)
+ vte_terminal_queue_adjustment_value_changed (
+ terminal,
+ new_scroll_delta);
+ else
+ screen->scroll_delta = new_scroll_delta;
+}
+
/**
* vte_terminal_set_size:
* @terminal: a #VteTerminal
@@ -8305,12 +8035,12 @@ vte_terminal_set_size(VteTerminal *terminal, glong columns, glong rows)
g_return_if_fail(VTE_IS_TERMINAL(terminal));
- _vte_debug_print(VTE_DEBUG_MISC,
+ _vte_debug_print(VTE_DEBUG_RESIZE,
"Setting PTY size to %ldx%ld.\n",
columns, rows);
- old_rows = terminal->row_count;
- old_columns = terminal->column_count;
+ old_rows = terminal->pvt->row_count;
+ old_columns = terminal->pvt->column_count;
if (terminal->pvt->pty != NULL) {
GError *error = NULL;
@@ -8324,19 +8054,20 @@ vte_terminal_set_size(VteTerminal *terminal, glong columns, glong rows)
}
vte_terminal_refresh_size(terminal);
} else {
- terminal->row_count = rows;
- terminal->column_count = columns;
+ terminal->pvt->row_count = rows;
+ terminal->pvt->column_count = columns;
}
- if (old_rows != terminal->row_count || old_columns != terminal->column_count) {
- VteScreen *screen = terminal->pvt->screen;
- glong visible_rows = MIN (old_rows, _vte_ring_length (screen->row_data));
- if (terminal->row_count < visible_rows) {
- glong delta = visible_rows - terminal->row_count;
- screen->insert_delta += delta;
- vte_terminal_queue_adjustment_value_changed (
- terminal,
- screen->scroll_delta + delta);
- }
+ if (old_rows != terminal->pvt->row_count || old_columns != terminal->pvt->column_count) {
+ _vte_ring_set_visible_rows_hint(terminal->pvt->normal_screen.row_data, terminal->pvt->row_count);
+ _vte_ring_set_visible_rows_hint(terminal->pvt->alternate_screen.row_data, terminal->pvt->row_count);
+
+ /* Always resize normal screen (given that this feature is enabled), even if alternate is visible: bug 415277 */
+ vte_terminal_screen_set_size(terminal, &terminal->pvt->normal_screen, old_columns, old_rows, terminal->pvt->rewrap_on_resize);
+ /* Resize the alternate screen if it's the current one, but never rewrap it: bug 336238 comment 60 */
+ if (terminal->pvt->screen == &terminal->pvt->alternate_screen)
+ vte_terminal_screen_set_size(terminal, &terminal->pvt->alternate_screen, old_columns, old_rows, FALSE);
+
+ _vte_terminal_adjust_adjustments_full (terminal);
gtk_widget_queue_resize_no_redraw (&terminal->widget);
/* Our visible text changed. */
vte_terminal_emit_text_modified(terminal);
@@ -8353,13 +8084,14 @@ vte_terminal_handle_scroll(VteTerminal *terminal)
screen = terminal->pvt->screen;
/* Read the new adjustment value and save the difference. */
- adj = round (gtk_adjustment_get_value(terminal->adjustment));
+ adj = round (gtk_adjustment_get_value(terminal->pvt->vadjustment));
dy = adj - screen->scroll_delta;
screen->scroll_delta = adj;
/* Sanity checks. */
- if (! gtk_widget_is_drawable (&terminal->widget)
- || terminal->pvt->visibility_state == GDK_VISIBILITY_FULLY_OBSCURED) {
+ if (G_UNLIKELY(!gtk_widget_get_realized(&terminal->widget)))
+ return;
+ if (terminal->pvt->visibility_state == GDK_VISIBILITY_FULLY_OBSCURED) {
return;
}
@@ -8367,7 +8099,7 @@ vte_terminal_handle_scroll(VteTerminal *terminal)
_vte_debug_print(VTE_DEBUG_ADJ,
"Scrolling by %ld\n", dy);
_vte_terminal_scroll_region(terminal, screen->scroll_delta,
- terminal->row_count, -dy);
+ terminal->pvt->row_count, -dy);
vte_terminal_emit_text_scrolled(terminal, dy);
_vte_terminal_queue_contents_changed(terminal);
} else {
@@ -8375,7 +8107,6 @@ vte_terminal_handle_scroll(VteTerminal *terminal)
}
}
-#if GTK_CHECK_VERSION (2, 91, 2)
static void
vte_terminal_set_hadjustment(VteTerminal *terminal,
GtkAdjustment *adjustment)
@@ -8390,15 +8121,14 @@ vte_terminal_set_hadjustment(VteTerminal *terminal,
pvt->hadjustment = adjustment ? g_object_ref_sink (adjustment) : NULL;
}
-#endif
static void
vte_terminal_set_vadjustment(VteTerminal *terminal,
GtkAdjustment *adjustment)
{
- if (adjustment != NULL && adjustment == terminal->adjustment)
+ if (adjustment != NULL && adjustment == terminal->pvt->vadjustment)
return;
- if (adjustment == NULL && terminal->adjustment != NULL)
+ if (adjustment == NULL && terminal->pvt->vadjustment != NULL)
return;
if (adjustment == NULL)
@@ -8409,35 +8139,24 @@ vte_terminal_set_vadjustment(VteTerminal *terminal,
/* Add a reference to the new adjustment object. */
g_object_ref_sink(adjustment);
/* Get rid of the old adjustment object. */
- if (terminal->adjustment != NULL) {
+ if (terminal->pvt->vadjustment != NULL) {
/* Disconnect our signal handlers from this object. */
- g_signal_handlers_disconnect_by_func(terminal->adjustment,
+ g_signal_handlers_disconnect_by_func(terminal->pvt->vadjustment,
vte_terminal_handle_scroll,
terminal);
- g_object_unref(terminal->adjustment);
+ g_object_unref(terminal->pvt->vadjustment);
}
/* Set the new adjustment object. */
- terminal->adjustment = adjustment;
+ terminal->pvt->vadjustment = adjustment;
/* We care about the offset, not the top or bottom. */
- g_signal_connect_swapped(terminal->adjustment,
+ g_signal_connect_swapped(terminal->pvt->vadjustment,
"value-changed",
G_CALLBACK(vte_terminal_handle_scroll),
terminal);
}
-/* Set the adjustment objects used by the terminal widget. */
-#if !GTK_CHECK_VERSION (2, 91, 2)
-static void
-vte_terminal_set_scroll_adjustments(GtkWidget *widget,
- GtkAdjustment *hadjustment G_GNUC_UNUSED,
- GtkAdjustment *vadjustment)
-{
- vte_terminal_set_vadjustment(VTE_TERMINAL(widget), vadjustment);
-}
-#endif /* GTK 2.x */
-
/**
* vte_terminal_set_emulation:
* @terminal: a #VteTerminal
@@ -8450,26 +8169,24 @@ vte_terminal_set_scroll_adjustments(GtkWidget *widget,
void
vte_terminal_set_emulation(VteTerminal *terminal, const char *emulation)
{
- VteTerminalPrivate *pvt;
GObject *object;
int columns, rows;
g_return_if_fail(VTE_IS_TERMINAL(terminal));
object = G_OBJECT(terminal);
- pvt = terminal->pvt;
g_object_freeze_notify(object);
/* Set the emulation type, for reference. */
if (emulation == NULL) {
- emulation = vte_terminal_get_default_emulation(terminal);
+ emulation = vte_get_default_emulation();
}
terminal->pvt->emulation = g_intern_string(emulation);
_vte_debug_print(VTE_DEBUG_MISC,
"Setting emulation to `%s'...\n", emulation);
/* Find and read the right termcap file. */
- vte_terminal_set_termcap(terminal, NULL, FALSE);
+ vte_terminal_set_termcap(terminal);
/* Create a table to hold the control sequences. */
if (terminal->pvt->matcher != NULL) {
@@ -8519,21 +8236,19 @@ vte_terminal_set_emulation(VteTerminal *terminal, const char *emulation)
g_object_thaw_notify(object);
}
-/* FIXMEchpe deprecate this function, it's wrong */
/**
- * vte_terminal_get_default_emulation:
- * @terminal: a #VteTerminal
+ * vte_get_default_emulation:
*
- * Queries the terminal for its default emulation, which is attempted if the
+ * Returns the default emulation, which is used in #VteTerminal if the
* terminal type passed to vte_terminal_set_emulation() is %NULL.
*
- * Returns: (transfer none) (type utf8): an interned string containing the name of the default terminal
- * type the widget attempts to emulate
+ * Returns: (transfer none) (type utf8): an interned string containing the name
+ * of the default terminal type the widget attempts to emulate
*
- * Since: 0.11.11
+ * Since: 0.30
*/
const char *
-vte_terminal_get_default_emulation(VteTerminal *terminal)
+vte_get_default_emulation(void)
{
return g_intern_static_string(VTE_DEFAULT_EMULATION);
}
@@ -8573,50 +8288,27 @@ _vte_terminal_inline_error_message(VteTerminal *terminal, const char *format, ..
/* Set the path to the termcap file we read, and read it in. */
static void
-vte_terminal_set_termcap(VteTerminal *terminal, const char *path,
- gboolean reset)
+vte_terminal_set_termcap(VteTerminal *terminal)
{
GObject *object = G_OBJECT(terminal);
- struct stat st;
- char *wpath;
-
- if (path == NULL) {
- wpath = g_build_filename(TERMCAPDIR,
- terminal->pvt->emulation ?
- terminal->pvt->emulation :
- vte_terminal_get_default_emulation(terminal),
- NULL);
- if (g_stat(wpath, &st) != 0) {
- g_free(wpath);
- wpath = g_strdup("/etc/termcap");
- }
- path = g_intern_string (wpath);
- g_free(wpath);
- } else {
- path = g_intern_string (path);
- }
- if (path == terminal->pvt->termcap_path) {
- return;
- }
+ const char *emulation;
g_object_freeze_notify(object);
- terminal->pvt->termcap_path = path;
+ emulation = terminal->pvt->emulation ? terminal->pvt->emulation
+ : vte_get_default_emulation();
_vte_debug_print(VTE_DEBUG_MISC, "Loading termcap `%s'...",
- terminal->pvt->termcap_path);
+ emulation);
if (terminal->pvt->termcap != NULL) {
_vte_termcap_free(terminal->pvt->termcap);
}
- terminal->pvt->termcap = _vte_termcap_new(terminal->pvt->termcap_path);
+ terminal->pvt->termcap = _vte_termcap_new(emulation);
_vte_debug_print(VTE_DEBUG_MISC, "\n");
if (terminal->pvt->termcap == NULL) {
_vte_terminal_inline_error_message(terminal,
- "Failed to load terminal capabilities from '%s'",
- terminal->pvt->termcap_path);
- }
- if (reset) {
- vte_terminal_set_emulation(terminal, terminal->pvt->emulation);
+ "Failed to load terminal capabilities for '%s'",
+ emulation);
}
g_object_thaw_notify(object);
@@ -8635,6 +8327,7 @@ static void
vte_terminal_init(VteTerminal *terminal)
{
VteTerminalPrivate *pvt;
+ GtkStyleContext *context;
GdkDisplay *display;
_vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_init()\n");
@@ -8650,24 +8343,20 @@ vte_terminal_init(VteTerminal *terminal)
gtk_widget_set_redraw_on_allocate (&terminal->widget, FALSE);
/* Set an adjustment for the application to use to control scrolling. */
- terminal->adjustment = NULL;
-#if GTK_CHECK_VERSION (2, 91, 2)
+ terminal->pvt->vadjustment = NULL;
pvt->hadjustment = NULL;
/* GtkScrollable */
pvt->hscroll_policy = GTK_SCROLL_NATURAL;
pvt->vscroll_policy = GTK_SCROLL_NATURAL;
vte_terminal_set_hadjustment(terminal, NULL);
-#endif
-
vte_terminal_set_vadjustment(terminal, NULL);
-
/* Set up dummy metrics, value != 0 to avoid division by 0 */
- terminal->char_width = 1;
- terminal->char_height = 1;
- terminal->char_ascent = 1;
- terminal->char_descent = 1;
+ terminal->pvt->char_width = 1;
+ terminal->pvt->char_height = 1;
+ terminal->pvt->char_ascent = 1;
+ terminal->pvt->char_descent = 1;
terminal->pvt->line_thickness = 1;
terminal->pvt->underline_position = 1;
terminal->pvt->strikethrough_position = 1;
@@ -8675,7 +8364,7 @@ vte_terminal_init(VteTerminal *terminal)
/* We allocated zeroed memory, just fill in non-zero stuff. */
/* Initialize the screens and histories. */
- _vte_ring_init (pvt->alternate_screen.row_data, terminal->row_count);
+ _vte_ring_init (pvt->alternate_screen.row_data, terminal->pvt->row_count);
pvt->alternate_screen.sendrecv_mode = TRUE;
pvt->alternate_screen.status_line_contents = g_string_new(NULL);
pvt->screen = &terminal->pvt->alternate_screen;
@@ -8688,16 +8377,18 @@ vte_terminal_init(VteTerminal *terminal)
_vte_terminal_set_default_attributes(terminal);
/* Set up I/O encodings. */
+ pvt->iso2022_utf8_ambiguous_width = VTE_ISO2022_DEFAULT_UTF8_AMBIGUOUS_WIDTH;
pvt->iso2022 = _vte_iso2022_state_new(pvt->encoding,
+ pvt->iso2022_utf8_ambiguous_width,
&_vte_terminal_codeset_changed_cb,
terminal);
pvt->incoming = NULL;
pvt->pending = g_array_new(FALSE, TRUE, sizeof(gunichar));
pvt->max_input_bytes = VTE_MAX_INPUT_READ;
pvt->cursor_blink_tag = 0;
- pvt->outgoing = _vte_buffer_new();
+ pvt->outgoing = _vte_byte_array_new();
pvt->outgoing_conv = VTE_INVALID_CONV;
- pvt->conv_buffer = _vte_buffer_new();
+ pvt->conv_buffer = _vte_byte_array_new();
vte_terminal_set_encoding(terminal, NULL);
g_assert(terminal->pvt->encoding != NULL);
@@ -8718,15 +8409,14 @@ vte_terminal_init(VteTerminal *terminal)
pvt->pty_input_source = 0;
pvt->pty_output_source = 0;
pvt->pty_pid = -1;
- pvt->child_exit_status = 0;
/* Scrolling options. */
pvt->scroll_on_keystroke = TRUE;
+ pvt->alternate_screen_scroll = TRUE;
pvt->scrollback_lines = -1; /* force update in vte_terminal_set_scrollback_lines */
vte_terminal_set_scrollback_lines(terminal, VTE_SCROLLBACK_INIT);
/* Selection info. */
- vte_terminal_set_word_chars(terminal, NULL);
display = gtk_widget_get_display(&terminal->widget);
pvt->clipboard[VTE_SELECTION_PRIMARY] = gtk_clipboard_get_for_display(display, GDK_SELECTION_PRIMARY);
pvt->clipboard[VTE_SELECTION_CLIPBOARD] = gtk_clipboard_get_for_display(display, GDK_SELECTION_CLIPBOARD);
@@ -8739,6 +8429,8 @@ vte_terminal_init(VteTerminal *terminal)
pvt->bell_margin = 10;
pvt->allow_bold = TRUE;
pvt->nrc_mode = TRUE;
+ pvt->deccolm_mode = FALSE;
+ pvt->rewrap_on_resize = TRUE;
vte_terminal_set_default_tabstops(terminal);
/* Cursor shape. */
@@ -8752,58 +8444,37 @@ vte_terminal_init(VteTerminal *terminal)
pvt->cursor_blink_mode = VTE_CURSOR_BLINK_SYSTEM;
/* Matching data. */
- pvt->match_regex_mode = VTE_REGEX_UNDECIDED;
pvt->match_regexes = g_array_new(FALSE, TRUE,
sizeof(struct vte_match_regex));
+ pvt->match_tag = -1;
vte_terminal_match_hilite_clear(terminal);
- /* Rendering data. Try everything. */
- pvt->draw = _vte_draw_new(&terminal->widget);
-
- /* The font description. */
- pvt->fontantialias = VTE_ANTI_ALIAS_USE_DEFAULT;
- gtk_widget_ensure_style(&terminal->widget);
+ /* Rendering data */
+ pvt->draw = _vte_draw_new();
/* Set up background information. */
- pvt->bg_tint_color.red = 0;
- pvt->bg_tint_color.green = 0;
- pvt->bg_tint_color.blue = 0;
- pvt->bg_saturation = 0.4 * VTE_SATURATION_MAX;
- pvt->bg_opacity = 0xffff;
+ pvt->background_alpha = 1.;
+
pvt->selection_block_mode = FALSE;
+ pvt->unscaled_font_desc = pvt->fontdesc = NULL;
+ pvt->font_scale = 1.;
pvt->has_fonts = FALSE;
- pvt->root_pixmap_changed_tag = 0;
+
+ pvt->alternate_screen_scroll = TRUE;
/* Not all backends generate GdkVisibilityNotify, so mark the
* window as unobscured initially. */
pvt->visibility_state = GDK_VISIBILITY_UNOBSCURED;
- /* Listen for hierarchy change notifications. */
- g_signal_connect(terminal, "hierarchy-changed",
- G_CALLBACK(vte_terminal_hierarchy_changed),
- NULL);
-
- pvt->inner_border = default_inner_border;
-
-#ifdef VTE_DEBUG
- /* In debuggable mode, we always do this. */
- /* gtk_widget_get_accessible(&terminal->widget); */
-#endif
-
-#if GTK_CHECK_VERSION (2, 99, 0)
-{
- GtkStyleContext *context;
+ pvt->padding = default_padding;
context = gtk_widget_get_style_context (&terminal->widget);
gtk_style_context_add_provider (context,
VTE_TERMINAL_GET_CLASS (terminal)->priv->style_provider,
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
-#endif
-}
/* Tell GTK+ how much space we need. */
-#if GTK_CHECK_VERSION (2, 91, 0)
static void
vte_terminal_get_preferred_width(GtkWidget *widget,
int *minimum_width,
@@ -8818,20 +8489,20 @@ vte_terminal_get_preferred_width(GtkWidget *widget,
vte_terminal_ensure_font (terminal);
vte_terminal_refresh_size(terminal);
- *minimum_width = terminal->char_width * 1;
- *natural_width = terminal->char_width * terminal->column_count;
+ *minimum_width = terminal->pvt->char_width * 1;
+ *natural_width = terminal->pvt->char_width * terminal->pvt->column_count;
- *minimum_width += terminal->pvt->inner_border.left +
- terminal->pvt->inner_border.right;
- *natural_width += terminal->pvt->inner_border.left +
- terminal->pvt->inner_border.right;
+ *minimum_width += terminal->pvt->padding.left +
+ terminal->pvt->padding.right;
+ *natural_width += terminal->pvt->padding.left +
+ terminal->pvt->padding.right;
_vte_debug_print(VTE_DEBUG_WIDGET_SIZE,
"[Terminal %p] minimum_width=%d, natural_width=%d for %ldx%ld cells.\n",
terminal,
*minimum_width, *natural_width,
- terminal->column_count,
- terminal->row_count);
+ terminal->pvt->column_count,
+ terminal->pvt->row_count);
}
static void
@@ -8848,50 +8519,21 @@ vte_terminal_get_preferred_height(GtkWidget *widget,
vte_terminal_ensure_font (terminal);
vte_terminal_refresh_size(terminal);
- *minimum_height = terminal->char_height * 1;
- *natural_height = terminal->char_height * terminal->row_count;
+ *minimum_height = terminal->pvt->char_height * 1;
+ *natural_height = terminal->pvt->char_height * terminal->pvt->row_count;
- *minimum_height += terminal->pvt->inner_border.left +
- terminal->pvt->inner_border.right;
- *natural_height += terminal->pvt->inner_border.left +
- terminal->pvt->inner_border.right;
+ *minimum_height += terminal->pvt->padding.left +
+ terminal->pvt->padding.right;
+ *natural_height += terminal->pvt->padding.left +
+ terminal->pvt->padding.right;
_vte_debug_print(VTE_DEBUG_WIDGET_SIZE,
"[Terminal %p] minimum_height=%d, natural_height=%d for %ldx%ld cells.\n",
terminal,
*minimum_height, *natural_height,
- terminal->column_count,
- terminal->row_count);
+ terminal->pvt->column_count,
+ terminal->pvt->row_count);
}
-#else /* GTK+ 2.x */
-static void
-vte_terminal_size_request(GtkWidget *widget, GtkRequisition *requisition)
-{
- VteTerminal *terminal;
-
- _vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_size_request()\n");
-
- terminal = VTE_TERMINAL(widget);
-
- vte_terminal_ensure_font (terminal);
-
- vte_terminal_refresh_size(terminal);
- requisition->width = terminal->char_width * terminal->column_count;
- requisition->height = terminal->char_height * terminal->row_count;
-
- requisition->width += terminal->pvt->inner_border.left +
- terminal->pvt->inner_border.right;
- requisition->height += terminal->pvt->inner_border.top +
- terminal->pvt->inner_border.bottom;
-
- _vte_debug_print(VTE_DEBUG_WIDGET_SIZE,
- "[Terminal %p] Size request is %dx%d for %ldx%ld cells.\n",
- terminal,
- requisition->width, requisition->height,
- terminal->column_count,
- terminal->row_count);
-}
-#endif
/* Accept a given size from GTK+. */
static void
@@ -8907,10 +8549,10 @@ vte_terminal_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
terminal = VTE_TERMINAL(widget);
- width = (allocation->width - (terminal->pvt->inner_border.left + terminal->pvt->inner_border.right)) /
- terminal->char_width;
- height = (allocation->height - (terminal->pvt->inner_border.top + terminal->pvt->inner_border.bottom)) /
- terminal->char_height;
+ width = (allocation->width - (terminal->pvt->padding.left + terminal->pvt->padding.right)) /
+ terminal->pvt->char_width;
+ height = (allocation->height - (terminal->pvt->padding.top + terminal->pvt->padding.bottom)) /
+ terminal->pvt->char_height;
width = MAX(width, 1);
height = MAX(height, 1);
@@ -8929,8 +8571,8 @@ vte_terminal_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
/* Set our allocation to match the structure. */
gtk_widget_set_allocation (widget, allocation);
- if (width != terminal->column_count
- || height != terminal->row_count
+ if (width != terminal->pvt->column_count
+ || height != terminal->pvt->row_count
|| update_scrollback)
{
VteScreen *screen = terminal->pvt->screen;
@@ -8943,10 +8585,10 @@ vte_terminal_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
if (screen->scrolling_restricted) {
screen->scrolling_region.start =
MIN(screen->scrolling_region.start,
- terminal->row_count - 1);
+ terminal->pvt->row_count - 1);
screen->scrolling_region.end =
MIN(screen->scrolling_region.end,
- terminal->row_count - 1);
+ terminal->pvt->row_count - 1);
}
/* Ensure scrollback buffers cover the screen. */
@@ -8976,16 +8618,6 @@ vte_terminal_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
}
}
-/* Queue a background update. */
-static void
-root_pixmap_changed_cb(VteBg *bg, VteTerminal *terminal)
-{
- _vte_debug_print (VTE_DEBUG_EVENTS, "Root pixmap changed.\n");
- if (terminal->pvt->bg_transparent) {
- vte_terminal_queue_background_update(terminal);
- }
-}
-
/* The window is being destroyed. */
static void
vte_terminal_unrealize(GtkWidget *widget)
@@ -8998,22 +8630,13 @@ vte_terminal_unrealize(GtkWidget *widget)
terminal = VTE_TERMINAL (widget);
window = gtk_widget_get_window (widget);
- /* Disconnect from background-change events. */
- if (terminal->pvt->root_pixmap_changed_tag != 0) {
- VteBg *bg;
- bg = vte_bg_get_for_screen(gtk_widget_get_screen(widget));
- g_signal_handler_disconnect (bg,
- terminal->pvt->root_pixmap_changed_tag);
- terminal->pvt->root_pixmap_changed_tag = 0;
- }
-
/* Deallocate the cursors. */
terminal->pvt->mouse_cursor_visible = FALSE;
- gdk_cursor_unref(terminal->pvt->mouse_default_cursor);
+ g_object_unref(terminal->pvt->mouse_default_cursor);
terminal->pvt->mouse_default_cursor = NULL;
- gdk_cursor_unref(terminal->pvt->mouse_mousing_cursor);
+ g_object_unref(terminal->pvt->mouse_mousing_cursor);
terminal->pvt->mouse_mousing_cursor = NULL;
- gdk_cursor_unref(terminal->pvt->mouse_inviso_cursor);
+ g_object_unref(terminal->pvt->mouse_inviso_cursor);
terminal->pvt->mouse_inviso_cursor = NULL;
vte_terminal_match_hilite_clear(terminal);
@@ -9054,12 +8677,6 @@ vte_terminal_unrealize(GtkWidget *widget)
/* Remove the GDK window. */
if (window != NULL) {
- /* detach style */
- GtkStyle *style;
-
- style = gtk_widget_get_style (widget);
- gtk_style_detach (style);
-
gdk_window_set_user_data (window, NULL);
gtk_widget_set_window (widget, NULL);
@@ -9153,7 +8770,7 @@ vte_terminal_finalize(GObject *object)
{
GtkWidget *widget = GTK_WIDGET (object);
VteTerminal *terminal = VTE_TERMINAL (object);
- GtkWidget *toplevel;
+ VteTerminalPrivate *pvt = terminal->pvt;
GtkClipboard *clipboard;
GtkSettings *settings;
VteSelection sel;
@@ -9170,14 +8787,13 @@ vte_terminal_finalize(GObject *object)
/* The NLS maps. */
_vte_iso2022_state_free(terminal->pvt->iso2022);
- /* Free background info. */
- g_free(terminal->pvt->bg_file);
-
/* Free the font description. */
+ if (pvt->unscaled_font_desc != NULL) {
+ pango_font_description_free(pvt->unscaled_font_desc);
+ }
if (terminal->pvt->fontdesc != NULL) {
pango_font_description_free(terminal->pvt->fontdesc);
}
- terminal->pvt->fontantialias = VTE_ANTI_ALIAS_USE_DEFAULT;
/* Free matching data. */
if (terminal->pvt->match_attributes != NULL) {
@@ -9203,14 +8819,6 @@ vte_terminal_finalize(GObject *object)
if (terminal->pvt->search_attrs)
g_array_free (terminal->pvt->search_attrs, TRUE);
- /* Disconnect from toplevel window configure events. */
- toplevel = gtk_widget_get_toplevel(&terminal->widget);
- if ((toplevel != NULL) && (G_OBJECT(toplevel) != object)) {
- g_signal_handlers_disconnect_by_func(toplevel,
- vte_terminal_configure_toplevel,
- terminal);
- }
-
/* Disconnect from autoscroll requests. */
vte_terminal_stop_autoscroll(terminal);
@@ -9237,9 +8845,6 @@ vte_terminal_finalize(GObject *object)
g_free(terminal->pvt->selection_html[sel]);
}
}
- if (terminal->pvt->word_chars != NULL) {
- g_array_free(terminal->pvt->word_chars, TRUE);
- }
/* Clear the output histories. */
_vte_ring_fini(terminal->pvt->normal_screen.row_data);
@@ -9258,21 +8863,19 @@ vte_terminal_finalize(GObject *object)
}
/* Stop listening for child-exited signals. */
- if (terminal->pvt->pty_reaper != NULL) {
- g_signal_handlers_disconnect_by_func(terminal->pvt->pty_reaper,
- vte_terminal_catch_child_exited,
- terminal);
- g_object_unref(terminal->pvt->pty_reaper);
- }
+ if (terminal->pvt->child_watch_source != 0) {
+ g_source_remove (terminal->pvt->child_watch_source);
+ terminal->pvt->child_watch_source = 0;
+ }
/* Stop processing input. */
vte_terminal_stop_processing (terminal);
/* Discard any pending data. */
_vte_incoming_chunks_release (terminal->pvt->incoming);
- _vte_buffer_free(terminal->pvt->outgoing);
+ _vte_byte_array_free(terminal->pvt->outgoing);
g_array_free(terminal->pvt->pending, TRUE);
- _vte_buffer_free(terminal->pvt->conv_buffer);
+ _vte_byte_array_free(terminal->pvt->conv_buffer);
/* Stop the child and stop watching for input from the child. */
if (terminal->pvt->pty_pid != -1) {
@@ -9311,14 +8914,18 @@ vte_terminal_finalize(GObject *object)
remove_update_timeout (terminal);
/* discard title updates */
- g_free(terminal->pvt->window_title_changed);
+ g_free(terminal->pvt->window_title);
+ g_free(terminal->pvt->window_title_changed);
g_free(terminal->pvt->icon_title_changed);
+ g_free(terminal->pvt->current_directory_uri_changed);
+ g_free(terminal->pvt->current_directory_uri);
+ g_free(terminal->pvt->current_file_uri_changed);
+ g_free(terminal->pvt->current_file_uri);
/* Free public-facing data. */
- g_free(terminal->window_title);
- g_free(terminal->icon_title);
- if (terminal->adjustment != NULL) {
- g_object_unref(terminal->adjustment);
+ g_free(terminal->pvt->icon_title);
+ if (terminal->pvt->vadjustment != NULL) {
+ g_object_unref(terminal->pvt->vadjustment);
}
settings = gtk_widget_get_settings (widget);
@@ -9338,19 +8945,13 @@ vte_terminal_realize(GtkWidget *widget)
VteTerminal *terminal;
GdkWindowAttr attributes;
GtkAllocation allocation;
- GdkColor color;
- guint attributes_mask = 0, i;
+ guint attributes_mask = 0;
_vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_realize()\n");
terminal = VTE_TERMINAL(widget);
gtk_widget_get_allocation (widget, &allocation);
- /* Create the draw structure if we don't already have one. */
- if (terminal->pvt->draw == NULL) {
- terminal->pvt->draw = _vte_draw_new(&terminal->widget);
- }
-
/* Create the stock cursors. */
terminal->pvt->mouse_cursor_visible = TRUE;
terminal->pvt->mouse_default_cursor =
@@ -9366,13 +8967,14 @@ vte_terminal_realize(GtkWidget *widget)
attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
-#if !GTK_CHECK_VERSION (2, 90, 8)
- attributes.colormap = gtk_widget_get_colormap (widget);
-#endif
attributes.event_mask = gtk_widget_get_events(widget) |
GDK_EXPOSURE_MASK |
GDK_VISIBILITY_NOTIFY_MASK |
GDK_FOCUS_CHANGE_MASK |
+#if GTK_CHECK_VERSION (3, 4, 0)
+ GDK_SMOOTH_SCROLL_MASK |
+#endif
+ GDK_SCROLL_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK |
@@ -9385,9 +8987,6 @@ vte_terminal_realize(GtkWidget *widget)
attributes_mask = GDK_WA_X |
GDK_WA_Y |
(attributes.visual ? GDK_WA_VISUAL : 0) |
-#if !GTK_CHECK_VERSION (2, 90, 8)
- (attributes.colormap ? GDK_WA_COLORMAP : 0) |
-#endif
GDK_WA_CURSOR;
window = gdk_window_new (gtk_widget_get_parent_window (widget),
@@ -9405,15 +9004,6 @@ vte_terminal_realize(GtkWidget *widget)
vte_terminal_set_default_colors(terminal);
}
- /* Allocate colors. */
- for (i = 0; i < G_N_ELEMENTS(terminal->pvt->palette); i++) {
- color.red = terminal->pvt->palette[i].red;
- color.green = terminal->pvt->palette[i].green;
- color.blue = terminal->pvt->palette[i].blue;
- color.pixel = 0;
- vte_terminal_set_color_internal(terminal, i, &color);
- }
-
/* Set up input method support. FIXME: do we need to handle the
* "retrieve-surrounding" and "delete-surrounding" events? */
if (terminal->pvt->im_context != NULL) {
@@ -9441,28 +9031,7 @@ vte_terminal_realize(GtkWidget *widget)
terminal->pvt->modifiers = 0;
/* Create our invisible cursor. */
-#if GTK_CHECK_VERSION (2, 15, 1)
terminal->pvt->mouse_inviso_cursor = gdk_cursor_new_for_display(gtk_widget_get_display(widget), GDK_BLANK_CURSOR);
-#else
- {
- GdkPixmap *bitmap;
- GdkColor black = {0,0,0,0};
-
- bitmap = gdk_bitmap_create_from_data (window, "\0", 1, 1);
- terminal->pvt->mouse_inviso_cursor = gdk_cursor_new_from_pixmap(bitmap,
- bitmap,
- &black,
- &black,
- 0, 0);
- g_object_unref(bitmap);
- }
-#endif /* GTK >= 2.15.1 */
-
-#if GTK_CHECK_VERSION (2, 20, 0)
- gtk_widget_style_attach (widget);
-#else
- widget->style = gtk_style_attach(widget->style, widget->window);
-#endif
vte_terminal_ensure_font (terminal);
@@ -9470,52 +9039,127 @@ vte_terminal_realize(GtkWidget *widget)
vte_terminal_background_update(terminal);
}
-/* Check if a unicode character is actually a graphic character we draw
- * ourselves to handle cases where fonts don't have glyphs for them. */
-static gboolean
-vte_unichar_is_local_graphic(vteunistr c)
+static inline void
+swap (guint *a, guint *b)
{
- if ((c >= 0x2500) && (c <= 0x257f)) {
- return TRUE;
+ guint tmp;
+ tmp = *a, *a = *b, *b = tmp;
+}
+
+static void
+vte_terminal_determine_colors_internal(VteTerminal *terminal,
+ const VteCellAttr *attr,
+ gboolean selected,
+ gboolean cursor,
+ guint *pfore, guint *pback)
+{
+ guint fore, back;
+
+ g_assert(attr);
+
+ /* Start with cell colors */
+ fore = attr->fore;
+ back = attr->back;
+
+ /* Reverse-mode switches default fore and back colors */
+ if (G_UNLIKELY (terminal->pvt->screen->reverse_mode)) {
+ if (fore == VTE_DEFAULT_FG)
+ fore = VTE_DEFAULT_BG;
+ if (back == VTE_DEFAULT_BG)
+ back = VTE_DEFAULT_FG;
}
- switch (c) {
- case 0x00a3: /* british pound */
- case 0x00b0: /* degree */
- case 0x00b1: /* plus/minus */
- case 0x00b7: /* bullet */
- case 0x03c0: /* pi */
- case 0x2190: /* left arrow */
- case 0x2191: /* up arrow */
- case 0x2192: /* right arrow */
- case 0x2193: /* down arrow */
- case 0x2260: /* != */
- case 0x2264: /* <= */
- case 0x2265: /* >= */
- case 0x23ba: /* scanline 1/9 */
- case 0x23bb: /* scanline 3/9 */
- case 0x23bc: /* scanline 7/9 */
- case 0x23bd: /* scanline 9/9 */
- case 0x2409: /* HT symbol */
- case 0x240a: /* LF symbol */
- case 0x240b: /* VT symbol */
- case 0x240c: /* FF symbol */
- case 0x240d: /* CR symbol */
- case 0x2424: /* NL symbol */
- case 0x2592: /* checkerboard */
- case 0x25ae: /* solid rectangle */
- case 0x25c6: /* diamond */
- return TRUE;
- break;
- default:
- break;
+
+ /* Handle bold by using set bold color or brightening */
+ if (attr->bold) {
+ if (fore == VTE_DEFAULT_FG)
+ fore = VTE_BOLD_FG;
+ else if (fore >= VTE_LEGACY_COLORS_OFFSET && fore < VTE_LEGACY_COLORS_OFFSET + VTE_LEGACY_COLOR_SET_SIZE) {
+ fore += VTE_COLOR_BRIGHT_OFFSET;
+ }
}
- return FALSE;
+
+ /* Handle half similarly */
+ if (attr->half) {
+ if (fore == VTE_DEFAULT_FG)
+ fore = VTE_DIM_FG;
+ else if (fore >= VTE_LEGACY_COLORS_OFFSET && fore < VTE_LEGACY_COLORS_OFFSET + VTE_LEGACY_COLOR_SET_SIZE)
+ fore = corresponding_dim_index[fore - VTE_LEGACY_COLORS_OFFSET];
+ }
+
+ /* And standout */
+ if (attr->standout) {
+ if (back >= VTE_LEGACY_COLORS_OFFSET && back < VTE_LEGACY_COLORS_OFFSET + VTE_LEGACY_COLOR_SET_SIZE)
+ back += VTE_COLOR_BRIGHT_OFFSET;
+ }
+
+ /* Reverse cell? */
+ if (attr->reverse) {
+ swap (&fore, &back);
+ }
+
+ /* Selection: use hightlight back/fore, or inverse */
+ if (selected) {
+ /* XXX what if hightlight back is same color as current back? */
+ gboolean do_swap = TRUE;
+ if (_vte_terminal_get_color(terminal, VTE_HIGHLIGHT_BG) != NULL) {
+ back = VTE_HIGHLIGHT_BG;
+ do_swap = FALSE;
+ }
+ if (_vte_terminal_get_color(terminal, VTE_HIGHLIGHT_FG) != NULL) {
+ fore = VTE_HIGHLIGHT_FG;
+ do_swap = FALSE;
+ }
+ if (do_swap)
+ swap (&fore, &back);
+ }
+
+ /* Cursor: use cursor back, or inverse */
+ if (cursor) {
+ /* XXX what if cursor back is same color as current back? */
+ if (_vte_terminal_get_color(terminal, VTE_CURSOR_BG) != NULL)
+ back = VTE_CURSOR_BG;
+ else
+ swap (&fore, &back);
+ }
+
+ /* Invisible? */
+ if (attr->invisible) {
+ fore = back;
+ }
+
+ *pfore = fore;
+ *pback = back;
}
+
+static inline void
+vte_terminal_determine_colors (VteTerminal *terminal,
+ const VteCell *cell,
+ gboolean highlight,
+ guint *fore, guint *back)
+{
+ vte_terminal_determine_colors_internal (terminal, cell ? &cell->attr : &basic_cell.cell.attr,
+ highlight, FALSE,
+ fore, back);
+}
+
+static inline void
+vte_terminal_determine_cursor_colors (VteTerminal *terminal,
+ const VteCell *cell,
+ gboolean highlight,
+ guint *fore, guint *back)
+{
+ vte_terminal_determine_colors_internal (terminal, cell ? &cell->attr : &basic_cell.cell.attr,
+ highlight, TRUE,
+ fore, back);
+}
+
+/* Check if a unicode character is actually a graphic character we draw
+ * ourselves to handle cases where fonts don't have glyphs for them. */
static gboolean
-vte_terminal_unichar_is_local_graphic(VteTerminal *terminal, vteunistr c, gboolean bold)
+vte_unichar_is_local_graphic(vteunistr c)
{
- return vte_unichar_is_local_graphic (c) &&
- !_vte_draw_has_char (terminal->pvt->draw, c, bold);
+ /* Box Drawing & Block Elements */
+ return (c >= 0x2500) && (c <= 0x259f);
}
static void
@@ -9526,13 +9170,11 @@ vte_terminal_fill_rectangle(VteTerminal *terminal,
gint width,
gint height)
{
- _vte_draw_start(terminal->pvt->draw);
_vte_draw_fill_rectangle(terminal->pvt->draw,
- x + terminal->pvt->inner_border.left,
- y + terminal->pvt->inner_border.top,
+ x + terminal->pvt->padding.left,
+ y + terminal->pvt->padding.top,
width, height,
color, VTE_DRAW_OPAQUE);
- _vte_draw_end(terminal->pvt->draw);
}
static void
@@ -9556,23 +9198,14 @@ vte_terminal_draw_rectangle(VteTerminal *terminal,
gint width,
gint height)
{
- _vte_draw_start(terminal->pvt->draw);
_vte_draw_draw_rectangle(terminal->pvt->draw,
- x + terminal->pvt->inner_border.left,
- y + terminal->pvt->inner_border.top,
+ x + terminal->pvt->padding.left,
+ y + terminal->pvt->padding.top,
width, height,
color, VTE_DRAW_OPAQUE);
- _vte_draw_end(terminal->pvt->draw);
}
-static void
-vte_terminal_draw_point(VteTerminal *terminal,
- const PangoColor *color,
- gint x,
- gint y)
-{
- vte_terminal_fill_rectangle(terminal, color, x, y, 1, 1);
-}
+#include "box_drawing.h"
/* Draw the graphic representation of a line-drawing or special graphics
* character. */
@@ -9580,759 +9213,479 @@ static gboolean
vte_terminal_draw_graphic(VteTerminal *terminal, vteunistr c,
guint fore, guint back, gboolean draw_default_bg,
gint x, gint y,
- gint column_width, gint columns, gint row_height,
- gboolean bold)
+ gint column_width, gint columns, gint row_height)
{
- gboolean ret;
- gint xcenter, xright, ycenter, ybottom, i;
- struct _vte_draw_text_request request;
+ gint width, xcenter, xright, ycenter, ybottom;
+ int upper_half, lower_half, left_half, right_half;
+ int light_line_width, heavy_line_width;
+ double adjust;
+ cairo_t *cr = _vte_draw_get_context (terminal->pvt->draw);
- request.c = c;
- request.x = x + terminal->pvt->inner_border.left;
- request.y = y + terminal->pvt->inner_border.top;
- request.columns = columns;
+ PangoColor fg, bg;
+ vte_terminal_get_rgb_from_index(terminal, fore, &fg);
+ vte_terminal_get_rgb_from_index(terminal, back, &bg);
- xright = x + column_width * columns;
- ybottom = y + row_height;
- xcenter = (x + xright) / 2;
- ycenter = (y + ybottom) / 2;
+ width = column_width * columns;
- if ((back != VTE_DEF_BG) || draw_default_bg) {
+ if ((back != VTE_DEFAULT_BG) || draw_default_bg) {
vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[back],
- x, y,
- column_width * columns, row_height);
+ &bg,
+ x, y, width, row_height);
}
- if (_vte_draw_char(terminal->pvt->draw, &request,
- &terminal->pvt->palette[fore], VTE_DRAW_OPAQUE, bold)) {
- /* We were able to draw with actual fonts. */
- return TRUE;
- }
+ cairo_save (cr);
- ret = TRUE;
-
- switch (c) {
- case 124:
- xcenter--;
- ycenter--;
- xright--;
- ybottom--;
- /* != */
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- (x + xcenter) / 2 - 1, ycenter,
- (xright + xcenter) / 2 + 1, ycenter);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- (x + xcenter) / 2 - 1,
- (ybottom + ycenter) / 2,
- (xright + xcenter) / 2 + 1,
- (ybottom + ycenter) / 2);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xright - 1, y + 1,
- x + 1, ybottom - 1);
- break;
- case 127:
- xcenter--;
- ycenter--;
- xright--;
- ybottom--;
- /* A "delete" symbol I saw somewhere. */
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- x, ycenter,
- xcenter, y);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xcenter, y,
- xright - 1, ycenter);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xright - 1, ycenter,
- xright - 1, ybottom - 1);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xright - 1, ybottom - 1,
- x, ybottom - 1);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- x, ybottom - 1,
- x, ycenter);
- break;
- case 0x00a3:
- xcenter--;
- ycenter--;
- xright--;
- ybottom--;
- /* British pound. An "L" with a hyphen. */
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- (x + xcenter) / 2,
- (y + ycenter) / 2,
- (x + xcenter) / 2,
- (ycenter + ybottom) / 2);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- (x + xcenter) / 2,
- (ycenter + ybottom) / 2,
- (xcenter + xright) / 2,
- (ycenter + ybottom) / 2);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- x, ycenter,
- xcenter + 1, ycenter);
- break;
- case 0x00b0: /* f */
- /* litle circle */
- vte_terminal_draw_point(terminal,
- &terminal->pvt->palette[fore],
- xcenter - 1, ycenter);
- vte_terminal_draw_point(terminal,
- &terminal->pvt->palette[fore],
- xcenter + 1, ycenter);
- vte_terminal_draw_point(terminal,
- &terminal->pvt->palette[fore],
- xcenter, ycenter - 1);
- vte_terminal_draw_point(terminal,
- &terminal->pvt->palette[fore],
- xcenter, ycenter + 1);
- break;
- case 0x00b1: /* g */
- xcenter--;
- ycenter--;
- xright--;
- ybottom--;
- /* +/- */
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- (y + ycenter) / 2,
- xcenter,
- (ycenter + ybottom) / 2);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- (x + xcenter) / 2,
- ycenter,
- (xcenter + xright) / 2,
- ycenter);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- (x + xcenter) / 2,
- (ycenter + ybottom) / 2,
- (xcenter + xright) / 2,
- (ycenter + ybottom) / 2);
- break;
- case 0x00b7:
- xcenter--;
- ycenter--;
- xright--;
- ybottom--;
- /* short hyphen? */
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xcenter - 1, ycenter,
- xcenter + 1, ycenter);
- break;
- case 0x3c0: /* pi */
- xcenter--;
- ycenter--;
- xright--;
- ybottom--;
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- (x + xcenter) / 2 - 1,
- (y + ycenter) / 2,
- (xright + xcenter) / 2 + 1,
- (y + ycenter) / 2);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- (x + xcenter) / 2,
- (y + ycenter) / 2,
- (x + xcenter) / 2,
- (ybottom + ycenter) / 2);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- (xright + xcenter) / 2,
- (y + ycenter) / 2,
- (xright + xcenter) / 2,
- (ybottom + ycenter) / 2);
- break;
- /* case 0x2190: FIXME */
- /* case 0x2191: FIXME */
- /* case 0x2192: FIXME */
- /* case 0x2193: FIXME */
- /* case 0x2260: FIXME */
- case 0x2264: /* y */
- xcenter--;
- ycenter--;
- xright--;
- ybottom--;
- /* <= */
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xright - 1, y,
- x, (y + ycenter) / 2);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- x, (y + ycenter) / 2,
- xright - 1, ycenter);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- x, ycenter,
- xright - 1, (ycenter + ybottom) / 2);
- break;
- case 0x2265: /* z */
- xcenter--;
- ycenter--;
- xright--;
- ybottom--;
- /* >= */
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- x, y,
- xright - 1, (y + ycenter) / 2);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xright - 1, (y + ycenter) / 2,
- x, ycenter);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xright - 1, ycenter,
- x, (ycenter + ybottom) / 2);
- break;
- case 0x23ba: /* o */
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- x, y,
- column_width * columns,
- VTE_LINE_WIDTH);
- break;
- case 0x23bb: /* p */
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- x, (y + ycenter) / 2,
- column_width * columns,
- VTE_LINE_WIDTH);
- break;
- case 0x23bc: /* r */
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- x,
- (ycenter + ybottom) / 2,
- column_width * columns,
- VTE_LINE_WIDTH);
- break;
- case 0x23bd: /* s */
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- x,
- ybottom - 1,
- column_width * columns,
- VTE_LINE_WIDTH);
- break;
- case 0x2409: /* b */
- xcenter--;
- ycenter--;
- xright--;
- ybottom--;
- /* H */
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- x, y,
- x, ycenter);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xcenter, y,
- xcenter, ycenter);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- x, (y + ycenter) / 2,
- xcenter, (y + ycenter) / 2);
- /* T */
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xcenter, ycenter,
- xright - 1, ycenter);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- (xcenter + xright) / 2, ycenter,
- (xcenter + xright) / 2, ybottom - 1);
- break;
- case 0x240a: /* e */
- xcenter--;
- ycenter--;
- xright--;
- ybottom--;
- /* L */
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- x, y,
- x, ycenter);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- x, ycenter,
- xcenter, ycenter);
- /* F */
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xcenter, ycenter,
- xcenter, ybottom - 1);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xcenter, ycenter,
- xright - 1, ycenter);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xcenter, (ycenter + ybottom) / 2,
- xright - 1, (ycenter + ybottom) / 2);
- break;
- case 0x240b: /* i */
- xcenter--;
- ycenter--;
- xright--;
- ybottom--;
- /* V */
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- x, y,
- (x + xcenter) / 2, ycenter);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- (x + xcenter) / 2, ycenter,
- xcenter, y);
- /* T */
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xcenter, ycenter,
- xright - 1, ycenter);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- (xcenter + xright) / 2, ycenter,
- (xcenter + xright) / 2, ybottom - 1);
- break;
- case 0x240c: /* c */
- xcenter--;
- ycenter--;
- xright--;
- ybottom--;
- /* F */
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- x, y,
- x, ycenter);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- x, y,
- xcenter, y);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- x, (y + ycenter) / 2,
- xcenter, (y + ycenter) / 2);
- /* F */
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xcenter, ycenter,
- xcenter, ybottom - 1);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xcenter, ycenter,
- xright - 1, ycenter);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xcenter, (ycenter + ybottom) / 2,
- xright - 1, (ycenter + ybottom) / 2);
- break;
- case 0x240d: /* d */
- xcenter--;
- ycenter--;
- xright--;
- ybottom--;
- /* C */
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- x, y,
- x, ycenter);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- x, y,
- xcenter, y);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- x, ycenter,
- xcenter, ycenter);
- /* R */
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xcenter, ycenter,
- xcenter, ybottom - 1);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xcenter, ycenter,
- xright - 1, ycenter);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xright - 1, ycenter,
- xright - 1, (ycenter + ybottom) / 2);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xright - 1, (ycenter + ybottom) / 2,
- xcenter, (ycenter + ybottom) / 2);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xcenter, (ycenter + ybottom) / 2,
- xright - 1, ybottom - 1);
- break;
- case 0x2424: /* h */
- xcenter--;
- ycenter--;
- xright--;
- ybottom--;
- /* N */
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- x, y,
- x, ycenter);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- x, y,
- xcenter, ycenter);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xcenter, y,
- xcenter, ycenter);
- /* L */
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xcenter, ycenter,
- xcenter, ybottom - 1);
- vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
- xcenter, ybottom - 1,
- xright - 1, ybottom - 1);
- break;
- case 0x2500: /* q */
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- x,
- ycenter,
- column_width * columns,
- VTE_LINE_WIDTH);
- break;
- case 0x2501:
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- x,
- ycenter,
- column_width * columns,
- VTE_LINE_WIDTH * 2);
- break;
- case 0x2502: /* x */
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- y,
- VTE_LINE_WIDTH,
- row_height);
- break;
- case 0x2503:
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- y,
- VTE_LINE_WIDTH * 2,
- row_height);
- break;
- case 0x250c: /* l */
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- ycenter,
- xright - xcenter,
- VTE_LINE_WIDTH);
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- ycenter,
- VTE_LINE_WIDTH,
- ybottom - ycenter);
- break;
- case 0x250f:
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- ycenter,
- xright - xcenter,
- VTE_LINE_WIDTH * 2);
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- ycenter,
- VTE_LINE_WIDTH * 2,
- ybottom - ycenter);
- break;
- case 0x2510: /* k */
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- x,
- ycenter,
- xcenter - x + VTE_LINE_WIDTH,
- VTE_LINE_WIDTH);
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- ycenter,
- VTE_LINE_WIDTH,
- ybottom - ycenter);
- break;
- case 0x2513:
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- x,
- ycenter,
- xcenter - x + VTE_LINE_WIDTH * 2,
- VTE_LINE_WIDTH * 2);
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- ycenter,
- VTE_LINE_WIDTH * 2,
- ybottom - ycenter);
- break;
- case 0x2514: /* m */
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- ycenter,
- xright - xcenter,
- VTE_LINE_WIDTH);
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- y,
- VTE_LINE_WIDTH,
- ycenter - y + VTE_LINE_WIDTH);
- break;
- case 0x2517:
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- ycenter,
- xright - xcenter,
- VTE_LINE_WIDTH * 2);
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- y,
- VTE_LINE_WIDTH * 2,
- ycenter - y + VTE_LINE_WIDTH * 2);
- break;
- case 0x2518: /* j */
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- x,
- ycenter,
- xcenter - x + VTE_LINE_WIDTH,
- VTE_LINE_WIDTH);
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- y,
- VTE_LINE_WIDTH,
- ycenter - y + VTE_LINE_WIDTH);
- break;
- case 0x251b:
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- x,
- ycenter,
- xcenter - x + VTE_LINE_WIDTH * 2,
- VTE_LINE_WIDTH * 2);
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- y,
- VTE_LINE_WIDTH * 2,
- ycenter - y + VTE_LINE_WIDTH * 2);
- break;
- case 0x251c: /* t */
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- y,
- VTE_LINE_WIDTH,
- row_height);
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- ycenter,
- xright - xcenter,
- VTE_LINE_WIDTH);
- break;
- case 0x2523:
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- y,
- VTE_LINE_WIDTH * 2,
- row_height);
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- ycenter,
- xright - xcenter,
- VTE_LINE_WIDTH * 2);
- break;
- case 0x2524: /* u */
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- y,
- VTE_LINE_WIDTH,
- row_height);
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- x,
- ycenter,
- xcenter - x + VTE_LINE_WIDTH,
- VTE_LINE_WIDTH);
- break;
- case 0x252b:
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- y,
- VTE_LINE_WIDTH * 2,
- row_height);
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- x,
- ycenter,
- xcenter - x + VTE_LINE_WIDTH * 2,
- VTE_LINE_WIDTH * 2);
- break;
- case 0x252c: /* w */
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- ycenter,
- VTE_LINE_WIDTH,
- ybottom - ycenter);
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- x,
- ycenter,
- column_width * columns,
- VTE_LINE_WIDTH);
- break;
- case 0x2533:
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- ycenter,
- VTE_LINE_WIDTH * 2,
- ybottom - ycenter);
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- x,
- ycenter,
- column_width * columns,
- VTE_LINE_WIDTH * 2);
- break;
- case 0x2534: /* v */
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- y,
- VTE_LINE_WIDTH,
- ycenter - y + VTE_LINE_WIDTH);
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- x,
- ycenter,
- column_width * columns,
- VTE_LINE_WIDTH);
- break;
- case 0x253c: /* n */
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- y,
- VTE_LINE_WIDTH,
- row_height);
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- x,
- ycenter,
- column_width * columns,
- VTE_LINE_WIDTH);
- break;
- case 0x254b:
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- xcenter,
- y,
- VTE_LINE_WIDTH * 2,
- row_height);
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- x,
- ycenter,
- column_width * columns,
- VTE_LINE_WIDTH * 2);
- break;
- case 0x2592: /* a */
- for (i = x; i < xright + 1; i++) {
- gint j, draw = ((i - x) & 1) == 0;
- for (j = y; j < ybottom; j++) {
- if (draw) {
- vte_terminal_draw_point(terminal,
- &terminal->pvt->palette[fore],
- i, j);
- }
- draw = !draw;
- }
- }
- break;
- case 0x25ae: /* solid rectangle */
- vte_terminal_fill_rectangle(terminal,
- &terminal->pvt->palette[fore],
- x, y,
- xright - x, ybottom - y);
- break;
- case 0x25c6:
- /* diamond */
- vte_terminal_draw_point(terminal,
- &terminal->pvt->palette[fore],
- xcenter - 2, ycenter);
- vte_terminal_draw_point(terminal,
- &terminal->pvt->palette[fore],
- xcenter + 2, ycenter);
- vte_terminal_draw_point(terminal,
- &terminal->pvt->palette[fore],
- xcenter, ycenter - 2);
- vte_terminal_draw_point(terminal,
- &terminal->pvt->palette[fore],
- xcenter, ycenter + 2);
- vte_terminal_draw_point(terminal,
- &terminal->pvt->palette[fore],
- xcenter - 1, ycenter - 1);
- vte_terminal_draw_point(terminal,
- &terminal->pvt->palette[fore],
- xcenter - 1, ycenter + 1);
- vte_terminal_draw_point(terminal,
- &terminal->pvt->palette[fore],
- xcenter + 1, ycenter - 1);
- vte_terminal_draw_point(terminal,
- &terminal->pvt->palette[fore],
- xcenter + 1, ycenter + 1);
- break;
- default:
- ret = FALSE;
- break;
- }
- return ret;
+ cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
+ _vte_draw_set_source_color_alpha (terminal->pvt->draw, &fg, VTE_DRAW_OPAQUE);
+
+ // FIXME wtf!?
+ x += terminal->pvt->padding.left;
+ y += terminal->pvt->padding.top;
+
+ upper_half = row_height / 2;
+ lower_half = row_height - upper_half;
+ left_half = width / 2;
+ right_half = width - left_half;
+
+ /* Note that the upper/left halves above are the same as 4 eights */
+ /* FIXME: this could be smarter for very small n (< 8 resp. < 4) */
+#define EIGHTS(n, k) \
+ ({ int k_eights = (n) * (k) / 8; \
+ k_eights = MAX(k_eights, 1); \
+ k_eights; \
+ })
+
+ light_line_width = terminal->pvt->char_width / 5;
+ light_line_width = MAX (light_line_width, 1);
+
+ if (c >= 0x2550 && c <= 0x256c) {
+ heavy_line_width = 3 * light_line_width;
+ } else {
+ heavy_line_width = light_line_width + 2;
+ }
+
+ xcenter = x + left_half;
+ ycenter = y + upper_half;
+ xright = x + width;
+ ybottom = y + row_height;
+
+ switch (c) {
+
+ /* Box Drawing */
+ case 0x2500: /* box drawings light horizontal */
+ case 0x2501: /* box drawings heavy horizontal */
+ case 0x2502: /* box drawings light vertical */
+ case 0x2503: /* box drawings heavy vertical */
+ case 0x250c: /* box drawings light down and right */
+ case 0x250d: /* box drawings down light and right heavy */
+ case 0x250e: /* box drawings down heavy and right light */
+ case 0x250f: /* box drawings heavy down and right */
+ case 0x2510: /* box drawings light down and left */
+ case 0x2511: /* box drawings down light and left heavy */
+ case 0x2512: /* box drawings down heavy and left light */
+ case 0x2513: /* box drawings heavy down and left */
+ case 0x2514: /* box drawings light up and right */
+ case 0x2515: /* box drawings up light and right heavy */
+ case 0x2516: /* box drawings up heavy and right light */
+ case 0x2517: /* box drawings heavy up and right */
+ case 0x2518: /* box drawings light up and left */
+ case 0x2519: /* box drawings up light and left heavy */
+ case 0x251a: /* box drawings up heavy and left light */
+ case 0x251b: /* box drawings heavy up and left */
+ case 0x251c: /* box drawings light vertical and right */
+ case 0x251d: /* box drawings vertical light and right heavy */
+ case 0x251e: /* box drawings up heavy and right down light */
+ case 0x251f: /* box drawings down heavy and right up light */
+ case 0x2520: /* box drawings vertical heavy and right light */
+ case 0x2521: /* box drawings down light and right up heavy */
+ case 0x2522: /* box drawings up light and right down heavy */
+ case 0x2523: /* box drawings heavy vertical and right */
+ case 0x2524: /* box drawings light vertical and left */
+ case 0x2525: /* box drawings vertical light and left heavy */
+ case 0x2526: /* box drawings up heavy and left down light */
+ case 0x2527: /* box drawings down heavy and left up light */
+ case 0x2528: /* box drawings vertical heavy and left light */
+ case 0x2529: /* box drawings down light and left up heavy */
+ case 0x252a: /* box drawings up light and left down heavy */
+ case 0x252b: /* box drawings heavy vertical and left */
+ case 0x252c: /* box drawings light down and horizontal */
+ case 0x252d: /* box drawings left heavy and right down light */
+ case 0x252e: /* box drawings right heavy and left down light */
+ case 0x252f: /* box drawings down light and horizontal heavy */
+ case 0x2530: /* box drawings down heavy and horizontal light */
+ case 0x2531: /* box drawings right light and left down heavy */
+ case 0x2532: /* box drawings left light and right down heavy */
+ case 0x2533: /* box drawings heavy down and horizontal */
+ case 0x2534: /* box drawings light up and horizontal */
+ case 0x2535: /* box drawings left heavy and right up light */
+ case 0x2536: /* box drawings right heavy and left up light */
+ case 0x2537: /* box drawings up light and horizontal heavy */
+ case 0x2538: /* box drawings up heavy and horizontal light */
+ case 0x2539: /* box drawings right light and left up heavy */
+ case 0x253a: /* box drawings left light and right up heavy */
+ case 0x253b: /* box drawings heavy up and horizontal */
+ case 0x253c: /* box drawings light vertical and horizontal */
+ case 0x253d: /* box drawings left heavy and right vertical light */
+ case 0x253e: /* box drawings right heavy and left vertical light */
+ case 0x253f: /* box drawings vertical light and horizontal heavy */
+ case 0x2540: /* box drawings up heavy and down horizontal light */
+ case 0x2541: /* box drawings down heavy and up horizontal light */
+ case 0x2542: /* box drawings vertical heavy and horizontal light */
+ case 0x2543: /* box drawings left up heavy and right down light */
+ case 0x2544: /* box drawings right up heavy and left down light */
+ case 0x2545: /* box drawings left down heavy and right up light */
+ case 0x2546: /* box drawings right down heavy and left up light */
+ case 0x2547: /* box drawings down light and up horizontal heavy */
+ case 0x2548: /* box drawings up light and down horizontal heavy */
+ case 0x2549: /* box drawings right light and left vertical heavy */
+ case 0x254a: /* box drawings left light and right vertical heavy */
+ case 0x254b: /* box drawings heavy vertical and horizontal */
+ case 0x2550: /* box drawings double horizontal */
+ case 0x2551: /* box drawings double vertical */
+ case 0x2552: /* box drawings down single and right double */
+ case 0x2553: /* box drawings down double and right single */
+ case 0x2554: /* box drawings double down and right */
+ case 0x2555: /* box drawings down single and left double */
+ case 0x2556: /* box drawings down double and left single */
+ case 0x2557: /* box drawings double down and left */
+ case 0x2558: /* box drawings up single and right double */
+ case 0x2559: /* box drawings up double and right single */
+ case 0x255a: /* box drawings double up and right */
+ case 0x255b: /* box drawings up single and left double */
+ case 0x255c: /* box drawings up double and left single */
+ case 0x255d: /* box drawings double up and left */
+ case 0x255e: /* box drawings vertical single and right double */
+ case 0x255f: /* box drawings vertical double and right single */
+ case 0x2560: /* box drawings double vertical and right */
+ case 0x2561: /* box drawings vertical single and left double */
+ case 0x2562: /* box drawings vertical double and left single */
+ case 0x2563: /* box drawings double vertical and left */
+ case 0x2564: /* box drawings down single and horizontal double */
+ case 0x2565: /* box drawings down double and horizontal single */
+ case 0x2566: /* box drawings double down and horizontal */
+ case 0x2567: /* box drawings up single and horizontal double */
+ case 0x2568: /* box drawings up double and horizontal single */
+ case 0x2569: /* box drawings double up and horizontal */
+ case 0x256a: /* box drawings vertical single and horizontal double */
+ case 0x256b: /* box drawings vertical double and horizontal single */
+ case 0x256c: /* box drawings double vertical and horizontal */
+ case 0x2574: /* box drawings light left */
+ case 0x2575: /* box drawings light up */
+ case 0x2576: /* box drawings light right */
+ case 0x2577: /* box drawings light down */
+ case 0x2578: /* box drawings heavy left */
+ case 0x2579: /* box drawings heavy up */
+ case 0x257a: /* box drawings heavy right */
+ case 0x257b: /* box drawings heavy down */
+ case 0x257c: /* box drawings light left and heavy right */
+ case 0x257d: /* box drawings light up and heavy down */
+ case 0x257e: /* box drawings heavy left and light right */
+ case 0x257f: /* box drawings heavy up and light down */
+ {
+ guint32 bitmap = _vte_box_drawing_bitmaps[c - 0x2500];
+ int xboundaries[6] = { 0,
+ left_half - heavy_line_width / 2,
+ left_half - light_line_width / 2,
+ left_half - light_line_width / 2 + light_line_width,
+ left_half - heavy_line_width / 2 + heavy_line_width,
+ terminal->pvt->char_width};
+ int yboundaries[6] = { 0,
+ upper_half - heavy_line_width / 2,
+ upper_half - light_line_width / 2,
+ upper_half - light_line_width / 2 + light_line_width,
+ upper_half - heavy_line_width / 2 + heavy_line_width,
+ terminal->pvt->char_height};
+ int xi, yi;
+ cairo_set_line_width(cr, 0);
+ for (yi = 4; yi >= 0; yi--) {
+ for (xi = 4; xi >= 0; xi--) {
+ if (bitmap & 1) {
+ cairo_rectangle(cr,
+ x + xboundaries[xi],
+ y + yboundaries[yi],
+ xboundaries[xi + 1] - xboundaries[xi],
+ yboundaries[yi + 1] - yboundaries[yi]);
+ cairo_fill(cr);
+ }
+ bitmap >>= 1;
+ }
+ }
+ break;
+ }
+
+ case 0x2504: /* box drawings light triple dash horizontal */
+ case 0x2505: /* box drawings heavy triple dash horizontal */
+ case 0x2506: /* box drawings light triple dash vertical */
+ case 0x2507: /* box drawings heavy triple dash vertical */
+ case 0x2508: /* box drawings light quadruple dash horizontal */
+ case 0x2509: /* box drawings heavy quadruple dash horizontal */
+ case 0x250a: /* box drawings light quadruple dash vertical */
+ case 0x250b: /* box drawings heavy quadruple dash vertical */
+ case 0x254c: /* box drawings light double dash horizontal */
+ case 0x254d: /* box drawings heavy double dash horizontal */
+ case 0x254e: /* box drawings light double dash vertical */
+ case 0x254f: /* box drawings heavy double dash vertical */
+ {
+ const guint v = c - 0x2500;
+ int size, line_width;
+
+ size = (v & 2) ? row_height : width;
+
+ switch (v >> 2) {
+ case 1: /* triple dash */
+ {
+ double segment = size / 8.;
+ double dashes[2] = { segment * 2., segment };
+ cairo_set_dash(cr, dashes, G_N_ELEMENTS(dashes), 0.);
+ break;
+ }
+ case 2: /* quadruple dash */
+ {
+ double segment = size / 11.;
+ double dashes[2] = { segment * 2., segment };
+ cairo_set_dash(cr, dashes, G_N_ELEMENTS(dashes), 0.);
+ break;
+ }
+ case 19: /* double dash */
+ {
+ double segment = size / 5.;
+ double dashes[2] = { segment * 2., segment };
+ cairo_set_dash(cr, dashes, G_N_ELEMENTS(dashes), 0.);
+ break;
+ }
+ }
+
+ line_width = (v & 1) ? heavy_line_width : light_line_width;
+ adjust = (line_width & 1) ? .5 : 0.;
+
+ cairo_set_line_width(cr, line_width);
+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
+ if (v & 2) {
+ cairo_move_to(cr, xcenter + adjust, y);
+ cairo_line_to(cr, xcenter + adjust, y + row_height);
+ } else {
+ cairo_move_to(cr, x, ycenter + adjust);
+ cairo_line_to(cr, x + width, ycenter + adjust);
+ }
+ cairo_stroke(cr);
+ break;
+ }
+
+ case 0x256d: /* box drawings light arc down and right */
+ case 0x256e: /* box drawings light arc down and left */
+ case 0x256f: /* box drawings light arc up and left */
+ case 0x2570: /* box drawings light arc up and right */
+ {
+ const guint v = c - 0x256d;
+ int line_width;
+ int radius;
+
+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_BUTT);
+
+ line_width = light_line_width;
+ adjust = (line_width & 1) ? .5 : 0.;
+ cairo_set_line_width(cr, line_width);
+
+ radius = (terminal->pvt->char_width + 2) / 3;
+ radius = MAX(radius, heavy_line_width);
+
+ if (v & 2) {
+ cairo_move_to(cr, xcenter + adjust, y);
+ cairo_line_to(cr, xcenter + adjust, ycenter - radius + 2 * adjust);
+ } else {
+ cairo_move_to(cr, xcenter + adjust, ybottom);
+ cairo_line_to(cr, xcenter + adjust, ycenter + radius);
+ }
+ cairo_stroke(cr);
+
+ cairo_arc(cr,
+ (v == 1 || v == 2) ? xcenter - radius + 2 * adjust
+ : xcenter + radius,
+ (v & 2) ? ycenter - radius + 2 * adjust
+ : ycenter + radius,
+ radius - adjust,
+ (v + 2) * M_PI / 2.0, (v + 3) * M_PI / 2.0);
+ cairo_stroke(cr);
+
+ if (v == 1 || v == 2) {
+ cairo_move_to(cr, xcenter - radius + 2 * adjust, ycenter + adjust);
+ cairo_line_to(cr, x, ycenter + adjust);
+ } else {
+ cairo_move_to(cr, xcenter + radius, ycenter + adjust);
+ cairo_line_to(cr, xright, ycenter + adjust);
+ }
+
+ cairo_stroke(cr);
+ break;
+ }
+
+ case 0x2571: /* box drawings light diagonal upper right to lower left */
+ case 0x2572: /* box drawings light diagonal upper left to lower right */
+ case 0x2573: /* box drawings light diagonal cross */
+ {
+ cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
+ cairo_set_line_width(cr, light_line_width);
+ adjust = light_line_width / 2.;
+ if (c != 0x2571) {
+ cairo_move_to(cr, x + adjust, y + adjust);
+ cairo_line_to(cr, xright - adjust, ybottom - adjust);
+ cairo_stroke(cr);
+ }
+ if (c != 0x2572) {
+ cairo_move_to(cr, xright - adjust, y + adjust);
+ cairo_line_to(cr, x + adjust, ybottom - adjust);
+ cairo_stroke(cr);
+ }
+ break;
+ }
+
+ /* Block Elements */
+ case 0x2580: /* upper half block */
+ cairo_rectangle(cr, x, y, width, upper_half);
+ cairo_fill (cr);
+ break;
+
+ case 0x2581: /* lower one eighth block */
+ case 0x2582: /* lower one quarter block */
+ case 0x2583: /* lower three eighths block */
+ case 0x2584: /* lower half block */
+ case 0x2585: /* lower five eighths block */
+ case 0x2586: /* lower three quarters block */
+ case 0x2587: /* lower seven eighths block */
+ {
+ const guint v = c - 0x2580;
+ /* Use the number of eights from the top, so that
+ * U+2584 aligns with U+2596..U+259f.
+ */
+ const int h = EIGHTS (row_height, 8 - v);
+
+ cairo_rectangle(cr, x, y + h, width, row_height - h);
+ cairo_fill (cr);
+ break;
+ }
+
+ case 0x2588: /* full block */
+ case 0x2589: /* left seven eighths block */
+ case 0x258a: /* left three quarters block */
+ case 0x258b: /* left five eighths block */
+ case 0x258c: /* left half block */
+ case 0x258d: /* left three eighths block */
+ case 0x258e: /* left one quarter block */
+ case 0x258f: /* left one eighth block */
+ {
+ const guint v = c - 0x2588;
+ /* Use the number of eights from the top, so that
+ * U+258c aligns with U+2596..U+259f.
+ */
+ const int w = EIGHTS (width, 8 - v);
+
+ cairo_rectangle(cr, x, y, w, row_height);
+ cairo_fill (cr);
+ break;
+ }
+
+ case 0x2590: /* right half block */
+ cairo_rectangle(cr, x + left_half, y, right_half, row_height);
+ cairo_fill (cr);
+ break;
+
+ case 0x2591: /* light shade */
+ case 0x2592: /* medium shade */
+ case 0x2593: /* dark shade */
+ cairo_set_source_rgba (cr,
+ fg.red / 65535.,
+ fg.green / 65535.,
+ fg.blue / 65535.,
+ (c - 0x2590) / 4.);
+ cairo_rectangle(cr, x, y, width, row_height);
+ cairo_fill (cr);
+ break;
+
+ case 0x2594: /* upper one eighth block */
+ {
+ const int h = EIGHTS (row_height, 1); /* Align with U+2587 */
+ cairo_rectangle(cr, x, y, width, h);
+ cairo_fill (cr);
+ break;
+ }
+
+ case 0x2595: /* right one eighth block */
+ {
+ const int w = EIGHTS (width, 7); /* Align with U+2589 */
+ cairo_rectangle(cr, x + w, y, width - w, row_height);
+ cairo_fill (cr);
+ break;
+ }
+
+ case 0x2596: /* quadrant lower left */
+ cairo_rectangle(cr, x, y + upper_half, left_half, lower_half);
+ cairo_fill (cr);
+ break;
+
+ case 0x2597: /* quadrant lower right */
+ cairo_rectangle(cr, x + left_half, y + upper_half, right_half, lower_half);
+ cairo_fill (cr);
+ break;
+
+ case 0x2598: /* quadrant upper left */
+ cairo_rectangle(cr, x, y, left_half, upper_half);
+ cairo_fill (cr);
+ break;
+
+ case 0x2599: /* quadrant upper left and lower left and lower right */
+ cairo_rectangle(cr, x, y, left_half, upper_half);
+ cairo_rectangle(cr, x, y + upper_half, left_half, lower_half);
+ cairo_rectangle(cr, x + left_half, y + upper_half, right_half, lower_half);
+ cairo_fill (cr);
+ break;
+
+ case 0x259a: /* quadrant upper left and lower right */
+ cairo_rectangle(cr, x, y, left_half, upper_half);
+ cairo_rectangle(cr, x + left_half, y + upper_half, right_half, lower_half);
+ cairo_fill (cr);
+ break;
+
+ case 0x259b: /* quadrant upper left and upper right and lower left */
+ cairo_rectangle(cr, x, y, left_half, upper_half);
+ cairo_rectangle(cr, x + left_half, y, right_half, upper_half);
+ cairo_rectangle(cr, x, y + upper_half, left_half, lower_half);
+ cairo_fill (cr);
+ break;
+
+ case 0x259c: /* quadrant upper left and upper right and lower right */
+ cairo_rectangle(cr, x, y, left_half, upper_half);
+ cairo_rectangle(cr, x + left_half, y, right_half, upper_half);
+ cairo_rectangle(cr, x + left_half, y + upper_half, right_half, lower_half);
+ cairo_fill (cr);
+ break;
+
+ case 0x259d: /* quadrant upper right */
+ cairo_rectangle(cr, x + left_half, y, right_half, upper_half);
+ cairo_fill (cr);
+ break;
+
+ case 0x259e: /* quadrant upper right and lower left */
+ cairo_rectangle(cr, x + left_half, y, right_half, upper_half);
+ cairo_rectangle(cr, x, y + upper_half, left_half, lower_half);
+ cairo_fill (cr);
+ break;
+
+ case 0x259f: /* quadrant upper right and lower left and lower right */
+ cairo_rectangle(cr, x + left_half, y, right_half, upper_half);
+ cairo_rectangle(cr, x, y + upper_half, left_half, lower_half);
+ cairo_rectangle(cr, x + left_half, y + upper_half, right_half, lower_half);
+ cairo_fill (cr);
+ break;
+
+ default:
+ g_assert_not_reached();
+ }
+
+#undef EIGHTS
+
+ cairo_restore(cr);
+
+ return TRUE;
}
/* Draw a string of characters with similar attributes. */
@@ -10341,13 +9694,13 @@ vte_terminal_draw_cells(VteTerminal *terminal,
struct _vte_draw_text_request *items, gssize n,
guint fore, guint back, gboolean clear,
gboolean draw_default_bg,
- gboolean bold, gboolean underline,
+ gboolean bold, gboolean italic, gboolean underline,
gboolean strikethrough, gboolean hilite, gboolean boxed,
gint column_width, gint row_height)
{
- int i, x, y, ascent;
+ int i, x, y;
gint columns = 0;
- PangoColor *fg, *bg, *defbg;
+ PangoColor fg, bg;
g_assert(n > 0);
_VTE_DEBUG_IF(VTE_DEBUG_CELLS) {
@@ -10365,10 +9718,8 @@ vte_terminal_draw_cells(VteTerminal *terminal,
}
bold = bold && terminal->pvt->allow_bold;
- fg = &terminal->pvt->palette[fore];
- bg = &terminal->pvt->palette[back];
- defbg = &terminal->pvt->palette[VTE_DEF_BG];
- ascent = terminal->char_ascent;
+ vte_terminal_get_rgb_from_index(terminal, fore, &fg);
+ vte_terminal_get_rgb_from_index(terminal, back, &bg);
i = 0;
do {
@@ -10377,26 +9728,30 @@ vte_terminal_draw_cells(VteTerminal *terminal,
y = items[i].y;
for (; i < n && items[i].y == y; i++) {
/* Adjust for the border. */
- items[i].x += terminal->pvt->inner_border.left;
- items[i].y += terminal->pvt->inner_border.top;
+ items[i].x += terminal->pvt->padding.left;
+ items[i].y += terminal->pvt->padding.top;
columns += items[i].columns;
}
- if (clear && (draw_default_bg || bg != defbg)) {
+ if (clear && (draw_default_bg || back != VTE_DEFAULT_BG)) {
+ gint bold_offset = _vte_draw_has_bold(terminal->pvt->draw,
+ VTE_DRAW_BOLD) ? 0 : bold;
_vte_draw_fill_rectangle(terminal->pvt->draw,
- x + terminal->pvt->inner_border.left,
- y + terminal->pvt->inner_border.top,
- columns * column_width + bold,
- row_height,
- bg, VTE_DRAW_OPAQUE);
+ x + terminal->pvt->padding.left,
+ y + terminal->pvt->padding.top,
+ columns * column_width + bold_offset, row_height,
+ &bg, VTE_DRAW_OPAQUE);
}
} while (i < n);
+
_vte_draw_text(terminal->pvt->draw,
items, n,
- fg, VTE_DRAW_OPAQUE, bold);
+ &fg, VTE_DRAW_OPAQUE,
+ _vte_draw_get_style(bold, italic));
+
for (i = 0; i < n; i++) {
/* Deadjust for the border. */
- items[i].x -= terminal->pvt->inner_border.left;
- items[i].y -= terminal->pvt->inner_border.top;
+ items[i].x -= terminal->pvt->padding.left;
+ items[i].y -= terminal->pvt->padding.top;
}
/* Draw whatever SFX are required. */
@@ -10410,7 +9765,7 @@ vte_terminal_draw_cells(VteTerminal *terminal,
}
if (underline) {
vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
+ &fg,
x,
y + terminal->pvt->underline_position,
x + (columns * column_width) - 1,
@@ -10418,7 +9773,7 @@ vte_terminal_draw_cells(VteTerminal *terminal,
}
if (strikethrough) {
vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
+ &fg,
x,
y + terminal->pvt->strikethrough_position,
x + (columns * column_width) - 1,
@@ -10426,7 +9781,7 @@ vte_terminal_draw_cells(VteTerminal *terminal,
}
if (hilite) {
vte_terminal_draw_line(terminal,
- &terminal->pvt->palette[fore],
+ &fg,
x,
y + row_height - 1,
x + (columns * column_width) - 1,
@@ -10434,7 +9789,7 @@ vte_terminal_draw_cells(VteTerminal *terminal,
}
if (boxed) {
vte_terminal_draw_rectangle(terminal,
- &terminal->pvt->palette[fore],
+ &fg,
x, y,
MAX(0, (columns * column_width)),
MAX(0, row_height));
@@ -10443,44 +9798,6 @@ vte_terminal_draw_cells(VteTerminal *terminal,
}
}
-/* Try to map a PangoColor to a palette entry and return its index. */
-static guint
-_vte_terminal_map_pango_color(VteTerminal *terminal, PangoColor *color)
-{
- long distance[G_N_ELEMENTS(terminal->pvt->palette)];
- guint i, ret;
-
- /* Calculate a "distance" value. Could stand to be improved a bit. */
- for (i = 0; i < G_N_ELEMENTS(distance); i++) {
- const PangoColor *entry = &terminal->pvt->palette[i];
- distance[i] = 0;
- distance[i] += ((entry->red >> 8) - (color->red >> 8)) *
- ((entry->red >> 8) - (color->red >> 8));
- distance[i] += ((entry->blue >> 8) - (color->blue >> 8)) *
- ((entry->blue >> 8) - (color->blue >> 8));
- distance[i] += ((entry->green >> 8) - (color->green >> 8)) *
- ((entry->green >> 8) - (color->green >> 8));
- }
-
- /* Find the index of the minimum value. */
- ret = 0;
- for (i = 1; i < G_N_ELEMENTS(distance); i++) {
- if (distance[i] < distance[ret]) {
- ret = i;
- }
- }
-
- _vte_debug_print(VTE_DEBUG_UPDATES,
- "mapped PangoColor(%04x,%04x,%04x) to "
- "palette entry (%04x,%04x,%04x)\n",
- color->red, color->green, color->blue,
- terminal->pvt->palette[ret].red,
- terminal->pvt->palette[ret].green,
- terminal->pvt->palette[ret].blue);
-
- return ret;
-}
-
/* FIXME: we don't have a way to tell GTK+ what the default text attributes
* should be, so for now at least it's assuming white-on-black is the norm and
* is using "black-on-white" to signify "inverse". Pick up on that state and
@@ -10569,8 +9886,10 @@ _vte_terminal_apply_pango_attr(VteTerminal *terminal, PangoAttribute *attr,
case PANGO_ATTR_FOREGROUND:
case PANGO_ATTR_BACKGROUND:
attrcolor = (PangoAttrColor*) attr;
- ival = _vte_terminal_map_pango_color(terminal,
- &attrcolor->color);
+ ival = VTE_RGB_COLOR |
+ ((attrcolor->color.red & 0xFF00) << 8) |
+ ((attrcolor->color.green & 0xFF00)) |
+ ((attrcolor->color.blue & 0xFF00) >> 8);
for (i = attr->start_index;
i < attr->end_index && i < n_cells;
i++) {
@@ -10699,6 +10018,7 @@ vte_terminal_draw_cells_with_attributes(VteTerminal *terminal,
back,
TRUE, draw_default_bg,
cells[j].attr.bold,
+ cells[j].attr.italic,
cells[j].attr.underline,
cells[j].attr.strikethrough,
FALSE, FALSE, column_width, height);
@@ -10722,8 +10042,7 @@ vte_terminal_draw_rows(VteTerminal *terminal,
struct _vte_draw_text_request items[4*VTE_DRAW_MAX_LENGTH];
gint i, j, row, rows, x, y, end_column;
guint fore, nfore, back, nback;
- glong delta;
- gboolean underline, nunderline, bold, nbold, hilite, nhilite,
+ gboolean underline, nunderline, bold, nbold, italic, nitalic, hilite, nhilite,
selected, nselected, strikethrough, nstrikethrough;
guint item_count;
const VteCell *cell;
@@ -10734,9 +10053,8 @@ vte_terminal_draw_rows(VteTerminal *terminal,
end_column = start_column + column_count;
/* clear the background */
- delta = screen->scroll_delta;
- x = start_x + terminal->pvt->inner_border.left;
- y = start_y + terminal->pvt->inner_border.top;
+ x = start_x + terminal->pvt->padding.left;
+ y = start_y + terminal->pvt->padding.top;
row = start_row;
rows = row_count;
do {
@@ -10783,14 +10101,18 @@ vte_terminal_draw_rows(VteTerminal *terminal,
bold = cell && cell->attr.bold;
j += cell ? cell->attr.columns : 1;
}
- if (back != VTE_DEF_BG) {
+ if (back != VTE_DEFAULT_BG) {
+ PangoColor bg;
+ gint bold_offset = _vte_draw_has_bold(terminal->pvt->draw,
+ VTE_DRAW_BOLD) ? 0 : bold;
+ vte_terminal_get_rgb_from_index(terminal, back, &bg);
_vte_draw_fill_rectangle (
terminal->pvt->draw,
x + i * column_width,
y,
- (j - i) * column_width + bold,
+ (j - i) * column_width + bold_offset,
row_height,
- &terminal->pvt->palette[back], VTE_DRAW_OPAQUE);
+ &bg, VTE_DRAW_OPAQUE);
}
/* We'll need to continue at the first cell which didn't
* match the first one in this set. */
@@ -10808,13 +10130,15 @@ vte_terminal_draw_rows(VteTerminal *terminal,
j++;
}
vte_terminal_determine_colors(terminal, NULL, selected, &fore, &back);
- if (back != VTE_DEF_BG) {
+ if (back != VTE_DEFAULT_BG) {
+ PangoColor bg;
+ vte_terminal_get_rgb_from_index(terminal, back, &bg);
_vte_draw_fill_rectangle (terminal->pvt->draw,
x + i *column_width,
y,
(j - i) * column_width,
row_height,
- &terminal->pvt->palette[back], VTE_DRAW_OPAQUE);
+ &bg, VTE_DRAW_OPAQUE);
}
i = j;
} while (i < end_column);
@@ -10870,6 +10194,7 @@ vte_terminal_draw_rows(VteTerminal *terminal,
underline = cell->attr.underline;
strikethrough = cell->attr.strikethrough;
bold = cell->attr.bold;
+ italic = cell->attr.italic;
if (terminal->pvt->show_match) {
hilite = vte_cell_is_between(i, row,
terminal->pvt->match_start.col,
@@ -10888,7 +10213,7 @@ vte_terminal_draw_rows(VteTerminal *terminal,
j = i + items[0].columns;
/* If this is a graphics character, draw it locally. */
- if (vte_terminal_unichar_is_local_graphic(terminal, cell->c, cell->attr.bold)) {
+ if (vte_unichar_is_local_graphic(cell->c)) {
if (vte_terminal_draw_graphic(terminal,
items[0].c,
fore, back,
@@ -10897,8 +10222,7 @@ vte_terminal_draw_rows(VteTerminal *terminal,
items[0].y,
column_width,
items[0].columns,
- row_height,
- cell->attr.bold)) {
+ row_height)) {
i = j;
continue;
}
@@ -10936,22 +10260,10 @@ vte_terminal_draw_rows(VteTerminal *terminal,
* in this chunk. */
selected = vte_cell_is_selected(terminal, j, row, NULL);
vte_terminal_determine_colors(terminal, cell, selected, &nfore, &nback);
- /* Graphic characters must be drawn individually. */
- if (vte_terminal_unichar_is_local_graphic(terminal, cell->c, cell->attr.bold)) {
- if (vte_terminal_draw_graphic(terminal,
- cell->c,
- nfore, nback,
- FALSE,
- start_x + j * column_width,
- y,
- column_width,
- cell->attr.columns,
- row_height,
- cell->attr.bold)) {
-
- j += cell->attr.columns;
- continue;
- }
+ /* Graphic characters must be drawn individually and thus break the
+ * run of characters with the same attributes. */
+ if (vte_unichar_is_local_graphic(cell->c)) {
+ break;
}
if (nfore != fore) {
break;
@@ -10960,6 +10272,10 @@ vte_terminal_draw_rows(VteTerminal *terminal,
if (nbold != bold) {
break;
}
+ nitalic = cell->attr.italic;
+ if (nitalic != italic) {
+ break;
+ }
/* Break up underlined/not-underlined text. */
nunderline = cell->attr.underline;
if (nunderline != underline) {
@@ -11024,7 +10340,7 @@ fg_draw:
items,
item_count,
fore, back, FALSE, FALSE,
- bold, underline,
+ bold, italic, underline,
strikethrough, hilite, FALSE,
column_width, row_height);
item_count = 1;
@@ -11044,41 +10360,38 @@ fg_out:
}
static void
-vte_terminal_expand_region (VteTerminal *terminal, GdkRegion *region, const GdkRectangle *area)
+vte_terminal_expand_region (VteTerminal *terminal, cairo_region_t *region, const GdkRectangle *area)
{
- VteScreen *screen;
int width, height;
int row, col, row_stop, col_stop;
- VteRegionRectangle rect;
+ cairo_rectangle_int_t rect;
- screen = terminal->pvt->screen;
-
- width = terminal->char_width;
- height = terminal->char_height;
+ width = terminal->pvt->char_width;
+ height = terminal->pvt->char_height;
/* increase the paint by one pixel on all sides to force the
* inclusion of neighbouring cells */
- row = MAX(0, (area->y - terminal->pvt->inner_border.top - 1) / height);
- row_stop = MIN(howmany(area->height + area->y - terminal->pvt->inner_border.top + 1, height),
- terminal->row_count);
+ row = MAX(0, (area->y - terminal->pvt->padding.top - 1) / height);
+ row_stop = MIN(howmany(area->height + area->y - terminal->pvt->padding.top + 1, height),
+ terminal->pvt->row_count);
if (row_stop <= row) {
return;
}
- col = MAX(0, (area->x - terminal->pvt->inner_border.left - 1) / width);
- col_stop = MIN(howmany(area->width + area->x - terminal->pvt->inner_border.left + 1, width),
- terminal->column_count);
+ col = MAX(0, (area->x - terminal->pvt->padding.left - 1) / width);
+ col_stop = MIN(howmany(area->width + area->x - terminal->pvt->padding.left + 1, width),
+ terminal->pvt->column_count);
if (col_stop <= col) {
return;
}
- rect.x = col*width + terminal->pvt->inner_border.left;
+ rect.x = col*width + terminal->pvt->padding.left;
rect.width = (col_stop - col) * width;
- rect.y = row*height + terminal->pvt->inner_border.top;
+ rect.y = row*height + terminal->pvt->padding.top;
rect.height = (row_stop - row)*height;
/* the rect must be cell aligned to avoid overlapping XY bands */
- gdk_region_union_with_rect(region, &rect);
+ cairo_region_union_rectangle(region, &rect);
_vte_debug_print (VTE_DEBUG_UPDATES,
"vte_terminal_expand_region"
@@ -11099,18 +10412,18 @@ vte_terminal_paint_area (VteTerminal *terminal, const GdkRectangle *area)
screen = terminal->pvt->screen;
- width = terminal->char_width;
- height = terminal->char_height;
+ width = terminal->pvt->char_width;
+ height = terminal->pvt->char_height;
- row = MAX(0, (area->y - terminal->pvt->inner_border.top) / height);
- row_stop = MIN((area->height + area->y - terminal->pvt->inner_border.top) / height,
- terminal->row_count);
+ row = MAX(0, (area->y - terminal->pvt->padding.top) / height);
+ row_stop = MIN((area->height + area->y - terminal->pvt->padding.top) / height,
+ terminal->pvt->row_count);
if (row_stop <= row) {
return;
}
- col = MAX(0, (area->x - terminal->pvt->inner_border.left) / width);
- col_stop = MIN((area->width + area->x - terminal->pvt->inner_border.left) / width,
- terminal->column_count);
+ col = MAX(0, (area->x - terminal->pvt->padding.left) / width);
+ col_stop = MIN((area->width + area->x - terminal->pvt->padding.left) / width,
+ terminal->pvt->column_count);
if (col_stop <= col) {
return;
}
@@ -11121,8 +10434,8 @@ vte_terminal_paint_area (VteTerminal *terminal, const GdkRectangle *area)
" [(%d,%d)x(%d,%d) pixels]\n",
area->x, area->y, area->width, area->height,
col, row, col_stop - col, row_stop - row,
- col * width + terminal->pvt->inner_border.left,
- row * height + terminal->pvt->inner_border.top,
+ col * width + terminal->pvt->padding.left,
+ row * height + terminal->pvt->padding.top,
(col_stop - col) * width,
(row_stop - row) * height);
@@ -11148,6 +10461,7 @@ vte_terminal_paint_cursor(VteTerminal *terminal)
int row, drow, col;
long width, height, delta, cursor_width;
guint fore, back;
+ PangoColor bg;
int x, y;
gboolean blink, selected, focus;
@@ -11159,11 +10473,11 @@ vte_terminal_paint_cursor(VteTerminal *terminal)
col = screen->cursor_current.col;
drow = screen->cursor_current.row;
row = drow - delta;
- width = terminal->char_width;
- height = terminal->char_height;
+ width = terminal->pvt->char_width;
+ height = terminal->pvt->char_height;
- if ((CLAMP(col, 0, terminal->column_count - 1) != col) ||
- (CLAMP(row, 0, terminal->row_count - 1) != row))
+ if ((CLAMP(col, 0, terminal->pvt->column_count - 1) != col) ||
+ (CLAMP(row, 0, terminal->pvt->row_count - 1) != row))
return;
focus = terminal->pvt->has_focus;
@@ -11181,19 +10495,23 @@ vte_terminal_paint_cursor(VteTerminal *terminal)
/* Draw the cursor. */
item.c = (cell && cell->c) ? cell->c : ' ';
- item.columns = cell ? cell->attr.columns : 1;
+ item.columns = item.c == '\t' ? 1 : cell ? cell->attr.columns : 1;
item.x = col * width;
item.y = row * height;
cursor_width = item.columns * width;
if (cell && cell->c != 0) {
- gint cw = _vte_draw_get_char_width (terminal->pvt->draw,
- cell->c, cell->attr.columns, cell->attr.bold);
+ guint style;
+ gint cw;
+ style = _vte_draw_get_style(cell->attr.bold, cell->attr.italic);
+ cw = _vte_draw_get_char_width (terminal->pvt->draw, cell->c,
+ cell->attr.columns, style);
cursor_width = MAX(cursor_width, cw);
}
selected = vte_cell_is_selected(terminal, col, drow, NULL);
vte_terminal_determine_cursor_colors(terminal, cell, selected, &fore, &back);
+ vte_terminal_get_rgb_from_index(terminal, back, &bg);
x = item.x;
y = item.y;
@@ -11206,7 +10524,7 @@ vte_terminal_paint_cursor(VteTerminal *terminal)
stem_width = (int) (((float) height) * terminal->pvt->cursor_aspect_ratio + 0.5);
stem_width = CLAMP (stem_width, VTE_LINE_WIDTH, cursor_width);
- vte_terminal_fill_rectangle(terminal, &terminal->pvt->palette[back],
+ vte_terminal_fill_rectangle(terminal, &bg,
x, y, stem_width, height);
break;
}
@@ -11214,10 +10532,12 @@ vte_terminal_paint_cursor(VteTerminal *terminal)
case VTE_CURSOR_SHAPE_UNDERLINE: {
int line_height;
- line_height = (int) (((float) width) * terminal->pvt->cursor_aspect_ratio + 0.5);
+ /* use height (not width) so underline and ibeam will
+ * be equally visible */
+ line_height = (int) (((float) height) * terminal->pvt->cursor_aspect_ratio + 0.5);
line_height = CLAMP (line_height, VTE_LINE_WIDTH, height);
- vte_terminal_fill_rectangle(terminal, &terminal->pvt->palette[back],
+ vte_terminal_fill_rectangle(terminal, &bg,
x, y + height - line_height,
cursor_width, line_height);
break;
@@ -11228,11 +10548,11 @@ vte_terminal_paint_cursor(VteTerminal *terminal)
if (focus) {
/* just reverse the character under the cursor */
vte_terminal_fill_rectangle (terminal,
- &terminal->pvt->palette[back],
+ &bg,
x, y,
cursor_width, height);
- if (!vte_terminal_unichar_is_local_graphic(terminal, item.c, cell ? cell->attr.bold : FALSE) ||
+ if (!vte_unichar_is_local_graphic(item.c) ||
!vte_terminal_draw_graphic(terminal,
item.c,
fore, back,
@@ -11241,8 +10561,7 @@ vte_terminal_paint_cursor(VteTerminal *terminal)
item.y,
width,
item.columns,
- height,
- cell ? cell->attr.bold : FALSE)) {
+ height)) {
gboolean hilite = FALSE;
if (cell && terminal->pvt->show_match) {
hilite = vte_cell_is_between(col, row,
@@ -11257,6 +10576,7 @@ vte_terminal_paint_cursor(VteTerminal *terminal)
&item, 1,
fore, back, TRUE, FALSE,
cell->attr.bold,
+ cell->attr.italic,
cell->attr.underline,
cell->attr.strikethrough,
hilite,
@@ -11270,7 +10590,7 @@ vte_terminal_paint_cursor(VteTerminal *terminal)
/* draw a box around the character */
vte_terminal_draw_rectangle (terminal,
- &terminal->pvt->palette[back],
+ &bg,
x - VTE_LINE_WIDTH,
y - VTE_LINE_WIDTH,
cursor_width + 2*VTE_LINE_WIDTH,
@@ -11285,8 +10605,8 @@ static void
vte_terminal_paint_im_preedit_string(VteTerminal *terminal)
{
VteScreen *screen;
- int row, drow, col, columns;
- long width, height, ascent, descent, delta;
+ int row, col, columns;
+ long width, height, delta;
int i, len;
guint fore, back;
@@ -11297,13 +10617,10 @@ vte_terminal_paint_im_preedit_string(VteTerminal *terminal)
screen = terminal->pvt->screen;
/* Keep local copies of rendering information. */
- width = terminal->char_width;
- height = terminal->char_height;
- ascent = terminal->char_ascent;
- descent = terminal->char_descent;
+ width = terminal->pvt->char_width;
+ height = terminal->pvt->char_height;
delta = screen->scroll_delta;
- drow = screen->cursor_current.row;
row = screen->cursor_current.row - delta;
/* Find out how many columns the pre-edit string takes up. */
@@ -11313,8 +10630,8 @@ vte_terminal_paint_im_preedit_string(VteTerminal *terminal)
/* If the pre-edit string won't fit on the screen if we start
* drawing it at the cursor's position, move it left. */
col = screen->cursor_current.col;
- if (col + columns > terminal->column_count) {
- col = MAX(0, terminal->column_count - columns);
+ if (col + columns > terminal->pvt->column_count) {
+ col = MAX(0, terminal->pvt->column_count - columns);
}
/* Draw the preedit string, boxed. */
@@ -11334,12 +10651,12 @@ vte_terminal_paint_im_preedit_string(VteTerminal *terminal)
preedit = g_utf8_next_char(preedit);
}
_vte_draw_clear(terminal->pvt->draw,
- col * width + terminal->pvt->inner_border.left,
- row * height + terminal->pvt->inner_border.top,
+ col * width + terminal->pvt->padding.left,
+ row * height + terminal->pvt->padding.top,
width * columns,
height);
- fore = screen->defaults.attr.fore;
- back = screen->defaults.attr.back;
+ fore = screen->color_defaults.attr.fore;
+ back = screen->color_defaults.attr.back;
vte_terminal_draw_cells_with_attributes(terminal,
items, len,
terminal->pvt->im_preedit_attrs,
@@ -11355,6 +10672,7 @@ vte_terminal_paint_im_preedit_string(VteTerminal *terminal)
FALSE,
FALSE,
FALSE,
+ FALSE,
TRUE,
width, height);
}
@@ -11362,66 +10680,64 @@ vte_terminal_paint_im_preedit_string(VteTerminal *terminal)
}
}
-/* Draw the widget. */
-static void
-vte_terminal_paint(GtkWidget *widget, GdkRegion *region)
+static gboolean
+vte_terminal_draw(GtkWidget *widget,
+ cairo_t *cr)
{
- VteTerminal *terminal;
- GtkAllocation allocation;
+ VteTerminal *terminal = VTE_TERMINAL (widget);
+ cairo_rectangle_int_t clip_rect;
+ cairo_region_t *region;
+ int allocated_width, allocated_height;
- _vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_paint()\n");
- _vte_debug_print(VTE_DEBUG_WORK, "=");
+ if (!gdk_cairo_get_clip_rectangle (cr, &clip_rect))
+ return FALSE;
- terminal = VTE_TERMINAL(widget);
- gtk_widget_get_allocation (widget, &allocation);
+ _vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_draw()\n");
+ _vte_debug_print (VTE_DEBUG_WORK, "+");
+ _vte_debug_print (VTE_DEBUG_UPDATES, "Draw (%d,%d)x(%d,%d)\n",
+ clip_rect.x, clip_rect.y,
+ clip_rect.width, clip_rect.height);
- /* Designate the start of the drawing operation and clear the area. */
- _vte_draw_start(terminal->pvt->draw);
- if (terminal->pvt->bg_transparent) {
- int x, y;
- gdk_window_get_origin (gtk_widget_get_window (widget), &x, &y);
- _vte_draw_set_background_scroll(terminal->pvt->draw, x, y);
- } else {
- if (terminal->pvt->scroll_background) {
- _vte_draw_set_background_scroll(terminal->pvt->draw,
- 0,
- terminal->pvt->screen->scroll_delta *
- terminal->char_height);
- } else {
- _vte_draw_set_background_scroll(terminal->pvt->draw, 0, 0);
- }
- }
+ region = vte_cairo_get_clip_region (cr);
+ if (region == NULL)
+ return FALSE;
- _VTE_DEBUG_IF (VTE_DEBUG_UPDATES) {
- VteRegionRectangle clip;
- gdk_region_get_clipbox (region, &clip);
- g_printerr ("vte_terminal_paint"
- " (%d,%d)x(%d,%d) pixels\n",
- clip.x, clip.y, clip.width, clip.height);
- }
+ allocated_width = gtk_widget_get_allocated_width(widget);
+ allocated_height = gtk_widget_get_allocated_height(widget);
+
+ /* Designate the start of the drawing operation and clear the area. */
+ _vte_draw_set_cairo(terminal->pvt->draw, cr);
- _vte_draw_clip(terminal->pvt->draw, region);
- gtk_widget_get_allocation(&terminal->widget, &allocation);
_vte_draw_clear (terminal->pvt->draw, 0, 0,
- allocation.width, allocation.height);
+ allocated_width, allocated_height);
/* Calculate the bounding rectangle. */
{
- VteRegionRectangle *rectangles;
+ cairo_rectangle_int_t *rectangles;
gint n, n_rectangles;
- gdk_region_get_rectangles (region, &rectangles, &n_rectangles);
+ n_rectangles = cairo_region_num_rectangles (region);
+ rectangles = g_new (cairo_rectangle_int_t, n_rectangles);
+ for (n = 0; n < n_rectangles; n++) {
+ cairo_region_get_rectangle (region, n, &rectangles[n]);
+ }
+
/* don't bother to enlarge an invalidate all */
if (!(n_rectangles == 1
- && rectangles[0].width == allocation.width
- && rectangles[0].height == allocation.height)) {
- GdkRegion *rr = gdk_region_new ();
+ && rectangles[0].width == allocated_width
+ && rectangles[0].height == allocated_height)) {
+ cairo_region_t *rr = cairo_region_create ();
/* convert pixels into whole cells */
for (n = 0; n < n_rectangles; n++) {
vte_terminal_expand_region (terminal, rr, rectangles + n);
}
g_free (rectangles);
- gdk_region_get_rectangles (rr, &rectangles, &n_rectangles);
- gdk_region_destroy (rr);
+
+ n_rectangles = cairo_region_num_rectangles (rr);
+ rectangles = g_new (cairo_rectangle_int_t, n_rectangles);
+ for (n = 0; n < n_rectangles; n++) {
+ cairo_region_get_rectangle (rr, n, &rectangles[n]);
+ }
+ cairo_region_destroy (rr);
}
/* and now paint them */
@@ -11436,12 +10752,16 @@ vte_terminal_paint(GtkWidget *widget, GdkRegion *region)
vte_terminal_paint_im_preedit_string(terminal);
/* Done with various structures. */
- _vte_draw_end(terminal->pvt->draw);
+ _vte_draw_set_cairo(terminal->pvt->draw, NULL);
+
+ cairo_region_destroy (region);
+
+ terminal->pvt->invalidated_all = FALSE;
+
+ return FALSE;
}
/* Handle an expose event by painting the exposed area. */
-#if GTK_CHECK_VERSION (2, 90, 8)
-
static cairo_region_t *
vte_cairo_get_clip_region (cairo_t *cr)
{
@@ -11482,153 +10802,92 @@ vte_cairo_get_clip_region (cairo_t *cr)
return region;
}
-static gboolean
-vte_terminal_draw(GtkWidget *widget,
- cairo_t *cr)
-{
- VteTerminal *terminal = VTE_TERMINAL (widget);
- cairo_rectangle_int_t clip_rect;
- cairo_region_t *region;
-
- if (!gdk_cairo_get_clip_rectangle (cr, &clip_rect))
- return FALSE;
-
- _vte_debug_print (VTE_DEBUG_WORK, "+");
- _vte_debug_print (VTE_DEBUG_EVENTS, "Draw (%d,%d)x(%d,%d)\n",
- clip_rect.x, clip_rect.y,
- clip_rect.width, clip_rect.height);
-
- region = vte_cairo_get_clip_region (cr);
- if (region == NULL)
- return FALSE;
-
- vte_terminal_paint(widget, region);
- cairo_region_destroy (region);
-
- terminal->pvt->invalidated_all = FALSE;
-
- return FALSE;
-}
-
-#else
-
-static gboolean
-vte_terminal_expose(GtkWidget *widget,
- GdkEventExpose *event)
-{
- VteTerminal *terminal = VTE_TERMINAL (widget);
- GtkAllocation allocation;
-
- /* Beware the out of order events -
- * do not even think about skipping exposes! */
- _vte_debug_print (VTE_DEBUG_WORK, "+");
- _vte_debug_print (VTE_DEBUG_EVENTS, "Expose (%d,%d)x(%d,%d)\n",
- event->area.x, event->area.y,
- event->area.width, event->area.height);
- if (terminal->pvt->active != NULL &&
- update_timeout_tag != 0 &&
- !in_update_timeout) {
- /* fix up a race condition where we schedule a delayed update
- * after an 'immediate' invalidate all */
- if (terminal->pvt->invalidated_all &&
- terminal->pvt->update_regions == NULL) {
- terminal->pvt->invalidated_all = FALSE;
- }
- /* if we expect to redraw the widget soon,
- * just add this event to the list */
- if (!terminal->pvt->invalidated_all) {
- gtk_widget_get_allocation (widget, &allocation);
- if (event->area.width >= allocation.width &&
- event->area.height >= allocation.height) {
- _vte_invalidate_all (terminal);
- } else {
- terminal->pvt->update_regions =
- g_slist_prepend (terminal->pvt->update_regions,
- gdk_region_copy (event->region));
- }
- }
- } else {
- vte_terminal_paint(widget, event->region);
- terminal->pvt->invalidated_all = FALSE;
- }
- return FALSE;
-}
-
-#endif /* GTK 3.0 */
-
/* Handle a scroll event. */
static gboolean
vte_terminal_scroll(GtkWidget *widget, GdkEventScroll *event)
{
GtkAdjustment *adj;
VteTerminal *terminal;
+ gdouble delta_x, delta_y;
gdouble v;
+ gint cnt, i;
int button;
terminal = VTE_TERMINAL(widget);
vte_terminal_read_modifiers (terminal, (GdkEvent*) event);
- _VTE_DEBUG_IF(VTE_DEBUG_EVENTS)
- switch (event->direction) {
- case GDK_SCROLL_UP:
- g_printerr("Scroll up.\n");
- break;
- case GDK_SCROLL_DOWN:
- g_printerr("Scroll down.\n");
- break;
- default:
- break;
- }
+ switch (event->direction) {
+ case GDK_SCROLL_UP:
+ terminal->pvt->mouse_smooth_scroll_delta -= 1.;
+ _vte_debug_print(VTE_DEBUG_EVENTS, "Scroll up\n");
+ break;
+ case GDK_SCROLL_DOWN:
+ terminal->pvt->mouse_smooth_scroll_delta += 1.;
+ _vte_debug_print(VTE_DEBUG_EVENTS, "Scroll down\n");
+ break;
+#if GTK_CHECK_VERSION (3, 4, 0)
+ case GDK_SCROLL_SMOOTH:
+ gdk_event_get_scroll_deltas ((GdkEvent*) event, &delta_x, &delta_y);
+ terminal->pvt->mouse_smooth_scroll_delta += delta_y;
+ _vte_debug_print(VTE_DEBUG_EVENTS,
+ "Smooth scroll by %f, delta now at %f\n",
+ delta_y, terminal->pvt->mouse_smooth_scroll_delta);
+ break;
+#endif
+ default:
+ break;
+ }
/* If we're running a mouse-aware application, map the scroll event
* to a button press on buttons four and five. */
if (terminal->pvt->mouse_tracking_mode) {
- switch (event->direction) {
- case GDK_SCROLL_UP:
- button = 4;
- break;
- case GDK_SCROLL_DOWN:
- button = 5;
- break;
- default:
- button = 0;
- break;
- }
- if (button != 0) {
+ cnt = terminal->pvt->mouse_smooth_scroll_delta;
+ if (cnt == 0)
+ return TRUE;
+ terminal->pvt->mouse_smooth_scroll_delta -= cnt;
+ _vte_debug_print(VTE_DEBUG_EVENTS,
+ "Scroll application by %d lines, smooth scroll delta set back to %f\n",
+ cnt, terminal->pvt->mouse_smooth_scroll_delta);
+
+ button = cnt > 0 ? 5 : 4;
+ if (cnt < 0)
+ cnt = -cnt;
+ for (i = 0; i < cnt; i++) {
/* Encode the parameters and send them to the app. */
vte_terminal_send_mouse_button_internal(terminal,
button,
+ FALSE /* not release */,
event->x,
event->y);
}
return TRUE;
}
- adj = terminal->adjustment;
+ adj = terminal->pvt->vadjustment;
v = MAX (1., ceil (gtk_adjustment_get_page_increment (adj) / 10.));
- switch (event->direction) {
- case GDK_SCROLL_UP:
- v = -v;
- break;
- case GDK_SCROLL_DOWN:
- break;
- default:
- return FALSE;
- }
+ _vte_debug_print(VTE_DEBUG_EVENTS,
+ "Scroll speed is %d lines per non-smooth scroll unit\n",
+ (int) v);
+ cnt = v * terminal->pvt->mouse_smooth_scroll_delta;
+ if (cnt == 0)
+ return TRUE;
+ terminal->pvt->mouse_smooth_scroll_delta -= cnt / v;
+ _vte_debug_print(VTE_DEBUG_EVENTS,
+ "Scroll by %d lines, smooth scroll delta set back to %f\n",
+ cnt, terminal->pvt->mouse_smooth_scroll_delta);
- if (terminal->pvt->screen == &terminal->pvt->alternate_screen ||
- terminal->pvt->normal_screen.scrolling_restricted) {
+ if (terminal->pvt->screen == &terminal->pvt->alternate_screen &&
+ terminal->pvt->alternate_screen_scroll) {
char *normal;
gssize normal_length;
const gchar *special;
- gint i, cnt = v;
/* In the alternate screen there is no scrolling,
* so fake a few cursor keystrokes. */
_vte_keymap_map (
- cnt > 0 ? GDK_KEY (Down) : GDK_KEY (Up),
+ cnt > 0 ? GDK_KEY_Down : GDK_KEY_Up,
terminal->pvt->modifiers,
terminal->pvt->sun_fkey_mode,
terminal->pvt->hp_fkey_mode,
@@ -11638,7 +10897,7 @@ vte_terminal_scroll(GtkWidget *widget, GdkEventScroll *event)
terminal->pvt->keypad_mode == VTE_KEYMODE_APPLICATION,
terminal->pvt->termcap,
terminal->pvt->emulation ?
- terminal->pvt->emulation : vte_terminal_get_default_emulation(terminal),
+ terminal->pvt->emulation : vte_get_default_emulation(),
&normal,
&normal_length,
&special);
@@ -11651,52 +10910,13 @@ vte_terminal_scroll(GtkWidget *widget, GdkEventScroll *event)
g_free (normal);
} else {
/* Perform a history scroll. */
- v += terminal->pvt->screen->scroll_delta;
- vte_terminal_queue_adjustment_value_changed_clamped (terminal, v);
+ cnt += terminal->pvt->screen->scroll_delta;
+ vte_terminal_queue_adjustment_value_changed_clamped (terminal, cnt);
}
return TRUE;
}
-/* Create a new accessible object associated with ourselves, and return
- * it to the caller. */
-static AtkObject *
-vte_terminal_get_accessible(GtkWidget *widget)
-{
- VteTerminal *terminal;
- static gboolean first_time = TRUE;
-
- terminal = VTE_TERMINAL(widget);
-
- if (first_time) {
- AtkObjectFactory *factory;
- AtkRegistry *registry;
- GType derived_type;
- GType derived_atk_type;
-
- /*
- * Figure out whether accessibility is enabled by looking at the
- * type of the accessible object which would be created for
- * the parent type of VteTerminal.
- */
- derived_type = g_type_parent (VTE_TYPE_TERMINAL);
-
- registry = atk_get_default_registry ();
- factory = atk_registry_get_factory (registry,
- derived_type);
-
- derived_atk_type = atk_object_factory_get_accessible_type (factory);
- if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE)) {
- atk_registry_set_factory_type (registry,
- VTE_TYPE_TERMINAL,
- vte_terminal_accessible_factory_get_type ());
- }
- first_time = FALSE;
- }
-
- return GTK_WIDGET_CLASS (vte_terminal_parent_class)->get_accessible (widget);
-}
-
static void
vte_terminal_get_property (GObject *object,
guint prop_id,
@@ -11708,12 +10928,11 @@ vte_terminal_get_property (GObject *object,
switch (prop_id)
{
-#if GTK_CHECK_VERSION (2, 91, 2)
case PROP_HADJUSTMENT:
g_value_set_object (value, pvt->hadjustment);
break;
case PROP_VADJUSTMENT:
- g_value_set_object (value, terminal->adjustment);
+ g_value_set_object (value, terminal->pvt->vadjustment);
break;
case PROP_HSCROLL_POLICY:
g_value_set_enum (value, pvt->hscroll_policy);
@@ -11721,37 +10940,27 @@ vte_terminal_get_property (GObject *object,
case PROP_VSCROLL_POLICY:
g_value_set_enum (value, pvt->vscroll_policy);
break;
-#endif
case PROP_ALLOW_BOLD:
g_value_set_boolean (value, vte_terminal_get_allow_bold (terminal));
break;
case PROP_AUDIBLE_BELL:
g_value_set_boolean (value, vte_terminal_get_audible_bell (terminal));
break;
- case PROP_BACKGROUND_IMAGE_FILE:
- g_value_set_string (value, pvt->bg_file);
- break;
- case PROP_BACKGROUND_IMAGE_PIXBUF:
- g_value_set_object (value, pvt->bg_pixbuf);
- break;
- case PROP_BACKGROUND_OPACITY:
- g_value_set_double (value, (double) pvt->bg_opacity / (double) G_MAXUINT16);
- break;
- case PROP_BACKGROUND_SATURATION:
- g_value_set_double (value, (double) pvt->bg_saturation / (double) VTE_SATURATION_MAX);
- break;
- case PROP_BACKGROUND_TINT_COLOR:
- g_value_set_boxed (value, &pvt->bg_tint_color);
- break;
- case PROP_BACKGROUND_TRANSPARENT:
- g_value_set_boolean (value, pvt->bg_transparent);
- break;
case PROP_BACKSPACE_BINDING:
g_value_set_enum (value, pvt->backspace_binding);
break;
+ case PROP_CJK_AMBIGUOUS_WIDTH:
+ g_value_set_int (value, vte_terminal_get_cjk_ambiguous_width (terminal));
+ break;
case PROP_CURSOR_BLINK_MODE:
g_value_set_enum (value, vte_terminal_get_cursor_blink_mode (terminal));
break;
+ case PROP_CURRENT_DIRECTORY_URI:
+ g_value_set_string (value, vte_terminal_get_current_directory_uri (terminal));
+ break;
+ case PROP_CURRENT_FILE_URI:
+ g_value_set_string (value, vte_terminal_get_current_file_uri (terminal));
+ break;
case PROP_CURSOR_SHAPE:
g_value_set_enum (value, vte_terminal_get_cursor_shape (terminal));
break;
@@ -11774,13 +10983,10 @@ vte_terminal_get_property (GObject *object,
g_value_set_boolean (value, vte_terminal_get_mouse_autohide (terminal));
break;
case PROP_PTY:
- g_value_set_int (value, pvt->pty != NULL ? vte_pty_get_fd(pvt->pty) : -1);
+ g_value_set_object (value, vte_terminal_get_pty(terminal));
break;
- case PROP_PTY_OBJECT:
- g_value_set_object (value, vte_terminal_get_pty_object(terminal));
- break;
- case PROP_SCROLL_BACKGROUND:
- g_value_set_boolean (value, pvt->scroll_background);
+ case PROP_REWRAP_ON_RESIZE:
+ g_value_set_boolean (value, vte_terminal_get_rewrap_on_resize (terminal));
break;
case PROP_SCROLLBACK_LINES:
g_value_set_uint (value, pvt->scrollback_lines);
@@ -11794,12 +11000,12 @@ vte_terminal_get_property (GObject *object,
case PROP_WINDOW_TITLE:
g_value_set_string (value, vte_terminal_get_window_title (terminal));
break;
- case PROP_WORD_CHARS:
- g_value_set_string (value, NULL /* FIXME */);
- break;
case PROP_VISIBLE_BELL:
g_value_set_boolean (value, vte_terminal_get_visible_bell (terminal));
break;
+ case PROP_FONT_SCALE:
+ g_value_set_double (value, vte_terminal_get_font_scale (terminal));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -11818,7 +11024,6 @@ vte_terminal_set_property (GObject *object,
switch (prop_id)
{
-#if GTK_CHECK_VERSION (2, 91, 2)
case PROP_HADJUSTMENT:
vte_terminal_set_hadjustment (terminal, g_value_get_object (value));
break;
@@ -11833,34 +11038,18 @@ vte_terminal_set_property (GObject *object,
pvt->vscroll_policy = g_value_get_enum (value);
gtk_widget_queue_resize_no_redraw (GTK_WIDGET (terminal));
break;
-#endif
case PROP_ALLOW_BOLD:
vte_terminal_set_allow_bold (terminal, g_value_get_boolean (value));
break;
case PROP_AUDIBLE_BELL:
vte_terminal_set_audible_bell (terminal, g_value_get_boolean (value));
break;
- case PROP_BACKGROUND_IMAGE_FILE:
- vte_terminal_set_background_image_file (terminal, g_value_get_string (value));
- break;
- case PROP_BACKGROUND_IMAGE_PIXBUF:
- vte_terminal_set_background_image (terminal, g_value_get_object (value));
- break;
- case PROP_BACKGROUND_OPACITY:
- vte_terminal_set_opacity (terminal, g_value_get_double (value) * (double) G_MAXUINT16);
- break;
- case PROP_BACKGROUND_SATURATION:
- vte_terminal_set_background_saturation (terminal, g_value_get_double (value));
- break;
- case PROP_BACKGROUND_TINT_COLOR:
- vte_terminal_set_background_tint_color (terminal, g_value_get_boxed (value));
- break;
- case PROP_BACKGROUND_TRANSPARENT:
- vte_terminal_set_background_transparent (terminal, g_value_get_boolean (value));
- break;
case PROP_BACKSPACE_BINDING:
vte_terminal_set_backspace_binding (terminal, g_value_get_enum (value));
break;
+ case PROP_CJK_AMBIGUOUS_WIDTH:
+ vte_terminal_set_cjk_ambiguous_width (terminal, g_value_get_int (value));
+ break;
case PROP_CURSOR_BLINK_MODE:
vte_terminal_set_cursor_blink_mode (terminal, g_value_get_enum (value));
break;
@@ -11877,19 +11066,16 @@ vte_terminal_set_property (GObject *object,
vte_terminal_set_encoding (terminal, g_value_get_string (value));
break;
case PROP_FONT_DESC:
- vte_terminal_set_font_full_internal (terminal, g_value_get_boxed (value), pvt->fontantialias);
+ vte_terminal_set_font (terminal, g_value_get_boxed (value));
break;
case PROP_MOUSE_POINTER_AUTOHIDE:
vte_terminal_set_mouse_autohide (terminal, g_value_get_boolean (value));
break;
case PROP_PTY:
- vte_terminal_set_pty (terminal, g_value_get_int (value));
- break;
- case PROP_PTY_OBJECT:
- vte_terminal_set_pty_object (terminal, g_value_get_object (value));
+ vte_terminal_set_pty (terminal, g_value_get_object (value));
break;
- case PROP_SCROLL_BACKGROUND:
- vte_terminal_set_scroll_background (terminal, g_value_get_boolean (value));
+ case PROP_REWRAP_ON_RESIZE:
+ vte_terminal_set_rewrap_on_resize (terminal, g_value_get_boolean (value));
break;
case PROP_SCROLLBACK_LINES:
vte_terminal_set_scrollback_lines (terminal, g_value_get_uint (value));
@@ -11900,14 +11086,16 @@ vte_terminal_set_property (GObject *object,
case PROP_SCROLL_ON_OUTPUT:
vte_terminal_set_scroll_on_output (terminal, g_value_get_boolean (value));
break;
- case PROP_WORD_CHARS:
- vte_terminal_set_word_chars (terminal, g_value_get_string (value));
- break;
case PROP_VISIBLE_BELL:
vte_terminal_set_visible_bell (terminal, g_value_get_boolean (value));
break;
+ case PROP_FONT_SCALE:
+ vte_terminal_set_font_scale (terminal, g_value_get_double (value));
+ break;
/* Not writable */
+ case PROP_CURRENT_DIRECTORY_URI:
+ case PROP_CURRENT_FILE_URI:
case PROP_ICON_TITLE:
case PROP_WINDOW_TITLE:
g_assert_not_reached ();
@@ -11945,7 +11133,6 @@ vte_terminal_class_init(VteTerminalClass *klass)
" * _vte_invalidate_all\n"
" ) end _vte_terminal_process_incoming\n"
" - gdk_window_process_updates\n"
- " + vte_terminal_expose\n"
" = vte_terminal_paint\n"
" ]} end update_timeout\n"
" > end process_timeout\n");
@@ -11968,11 +11155,7 @@ vte_terminal_class_init(VteTerminalClass *klass)
gobject_class->set_property = vte_terminal_set_property;
widget_class->realize = vte_terminal_realize;
widget_class->scroll_event = vte_terminal_scroll;
-#if GTK_CHECK_VERSION (2, 90, 8)
widget_class->draw = vte_terminal_draw;
-#else
- widget_class->expose_event = vte_terminal_expose;
-#endif
widget_class->key_press_event = vte_terminal_key_press;
widget_class->key_release_event = vte_terminal_key_release;
widget_class->button_press_event = vte_terminal_button_press;
@@ -11984,15 +11167,10 @@ vte_terminal_class_init(VteTerminalClass *klass)
widget_class->focus_out_event = vte_terminal_focus_out;
widget_class->visibility_notify_event = vte_terminal_visibility_notify;
widget_class->unrealize = vte_terminal_unrealize;
- widget_class->style_set = vte_terminal_style_set;
-#if GTK_CHECK_VERSION (2, 91, 0)
+ widget_class->style_updated = vte_terminal_style_updated;
widget_class->get_preferred_width = vte_terminal_get_preferred_width;
widget_class->get_preferred_height = vte_terminal_get_preferred_height;
-#else
- widget_class->size_request = vte_terminal_size_request;
-#endif
widget_class->size_allocate = vte_terminal_size_allocate;
- widget_class->get_accessible = vte_terminal_get_accessible;
widget_class->screen_changed = vte_terminal_screen_changed;
/* Initialize default handlers. */
@@ -12032,49 +11210,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
klass->beep = NULL;
-#if GTK_CHECK_VERSION (2, 91, 2)
/* GtkScrollable interface properties */
g_object_class_override_property (gobject_class, PROP_HADJUSTMENT, "hadjustment");
g_object_class_override_property (gobject_class, PROP_VADJUSTMENT, "vadjustment");
g_object_class_override_property (gobject_class, PROP_HSCROLL_POLICY, "hscroll-policy");
g_object_class_override_property (gobject_class, PROP_VSCROLL_POLICY, "vscroll-policy");
-#else
-
- klass->set_scroll_adjustments = vte_terminal_set_scroll_adjustments;
-
- /**
- * VteTerminal::set-scroll-adjustments:
- * @vteterminal: the object which received the signal
- * @horizontal: (allow-none): the horizontal #GtkAdjustment (unused in #VteTerminal)
- * @vertical: (allow-none): the vertical #GtkAdjustment
- *
- * Set the scroll adjustments for the terminal. Usually scrolled containers
- * like #GtkScrolledWindow will emit this signal to connect two instances
- * of #GtkScrollbar to the scroll directions of the #VteTerminal.
- *
- * Since: 0.17.1
- */
- widget_class->set_scroll_adjustments_signal =
- g_signal_new(I_("set-scroll-adjustments"),
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (VteTerminalClass, set_scroll_adjustments),
- NULL, NULL,
- _vte_marshal_VOID__OBJECT_OBJECT,
- G_TYPE_NONE, 2,
- GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
-
-#endif
-
/* Register some signals of our own. */
-#if GTK_CHECK_VERSION (2, 99, 0)
-#define OBSOLETE_SIGNAL(str)
-#else
-#define OBSOLETE_SIGNAL(str) str
-#endif
-
/**
* VteTerminal::eof:
* @vteterminal: the object which received the signal
@@ -12083,32 +11226,32 @@ vte_terminal_class_init(VteTerminalClass *klass)
* is running in the terminal. This signal is frequently (but not
* always) emitted with a #VteTerminal::child-exited signal.
*/
- OBSOLETE_SIGNAL (klass->eof_signal =)
- g_signal_new(I_("eof"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, eof),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("eof"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, eof),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::child-exited:
* @vteterminal: the object which received the signal
+ * @status: the child's exit status
*
- * This signal is emitted when the terminal detects that a child started
- * using vte_terminal_fork_command() has exited.
+ * This signal is emitted when the terminal detects that a child
+ * watched using vte_terminal_watch_child() has exited.
*/
- OBSOLETE_SIGNAL (klass->child_exited_signal =)
- g_signal_new(I_("child-exited"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, child_exited),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("child-exited"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, child_exited),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE,
+ 1, G_TYPE_INT);
/**
* VteTerminal::window-title-changed:
@@ -12116,15 +11259,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
*
* Emitted when the terminal's %window_title field is modified.
*/
- OBSOLETE_SIGNAL (klass->window_title_changed_signal =)
- g_signal_new(I_("window-title-changed"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, window_title_changed),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("window-title-changed"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, window_title_changed),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::icon-title-changed:
@@ -12132,15 +11274,48 @@ vte_terminal_class_init(VteTerminalClass *klass)
*
* Emitted when the terminal's %icon_title field is modified.
*/
- OBSOLETE_SIGNAL (klass->icon_title_changed_signal =)
- g_signal_new(I_("icon-title-changed"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, icon_title_changed),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("icon-title-changed"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, icon_title_changed),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ /**
+ * VteTerminal::current-directory-uri-changed:
+ * @vteterminal: the object which received the signal
+ *
+ * Emitted when the current directory URI is modified.
+ *
+ * Since: 0.34
+ */
+ g_signal_new(I_("current-directory-uri-changed"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ /**
+ * VteTerminal::current-file-uri-changed:
+ * @vteterminal: the object which received the signal
+ *
+ * Emitted when the current file URI is modified.
+ *
+ * Since: 0.34
+ */
+ g_signal_new(I_("current-file-uri-changed"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::encoding-changed:
@@ -12150,15 +11325,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
* as a result of receiving a control sequence which toggled between the
* local and UTF-8 encodings, or at the parent application's request.
*/
- OBSOLETE_SIGNAL (klass->encoding_changed_signal =)
- g_signal_new(I_("encoding-changed"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, encoding_changed),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("encoding-changed"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, encoding_changed),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::commit:
@@ -12170,15 +11344,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
* prepares to send it to the child process. The signal is emitted even
* when there is no child process.
*/
- OBSOLETE_SIGNAL (klass->commit_signal =)
- g_signal_new(I_("commit"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, commit),
- NULL,
- NULL,
- _vte_marshal_VOID__STRING_UINT,
- G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_UINT);
+ g_signal_new(I_("commit"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, commit),
+ NULL,
+ NULL,
+ _vte_marshal_VOID__STRING_UINT,
+ G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_UINT);
/**
* VteTerminal::emulation-changed:
@@ -12187,15 +11360,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
* Emitted whenever the terminal's emulation changes, only possible at
* the parent application's request.
*/
- OBSOLETE_SIGNAL (klass->emulation_changed_signal =)
- g_signal_new(I_("emulation-changed"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, emulation_changed),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("emulation-changed"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, emulation_changed),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::char-size-changed:
@@ -12206,15 +11378,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
* Emitted whenever selection of a new font causes the values of the
* %char_width or %char_height fields to change.
*/
- OBSOLETE_SIGNAL (klass->char_size_changed_signal =)
- g_signal_new(I_("char-size-changed"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, char_size_changed),
- NULL,
- NULL,
- _vte_marshal_VOID__UINT_UINT,
- G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
+ g_signal_new(I_("char-size-changed"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, char_size_changed),
+ NULL,
+ NULL,
+ _vte_marshal_VOID__UINT_UINT,
+ G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
/**
* VteTerminal::selection-changed:
@@ -12222,15 +11393,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
*
* Emitted whenever the contents of terminal's selection changes.
*/
- OBSOLETE_SIGNAL (klass->selection_changed_signal =)
- g_signal_new (I_("selection-changed"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, selection_changed),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new (I_("selection-changed"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, selection_changed),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::contents-changed:
@@ -12239,15 +11409,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
* Emitted whenever the visible appearance of the terminal has changed.
* Used primarily by #VteTerminalAccessible.
*/
- OBSOLETE_SIGNAL (klass->contents_changed_signal =)
- g_signal_new(I_("contents-changed"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, contents_changed),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("contents-changed"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, contents_changed),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::cursor-moved:
@@ -12256,15 +11425,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
* Emitted whenever the cursor moves to a new character cell. Used
* primarily by #VteTerminalAccessible.
*/
- OBSOLETE_SIGNAL (klass->cursor_moved_signal =)
- g_signal_new(I_("cursor-moved"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, cursor_moved),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("cursor-moved"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, cursor_moved),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::deiconify-window:
@@ -12272,15 +11440,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
*
* Emitted at the child application's request.
*/
- OBSOLETE_SIGNAL (klass->deiconify_window_signal =)
- g_signal_new(I_("deiconify-window"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, deiconify_window),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("deiconify-window"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, deiconify_window),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::iconify-window:
@@ -12288,15 +11455,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
*
* Emitted at the child application's request.
*/
- OBSOLETE_SIGNAL (klass->iconify_window_signal =)
- g_signal_new(I_("iconify-window"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, iconify_window),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("iconify-window"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, iconify_window),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::raise-window:
@@ -12304,15 +11470,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
*
* Emitted at the child application's request.
*/
- OBSOLETE_SIGNAL (klass->raise_window_signal =)
- g_signal_new(I_("raise-window"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, raise_window),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("raise-window"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, raise_window),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::lower-window:
@@ -12320,15 +11485,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
*
* Emitted at the child application's request.
*/
- OBSOLETE_SIGNAL (klass->lower_window_signal =)
- g_signal_new(I_("lower-window"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, lower_window),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("lower-window"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, lower_window),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::refresh-window:
@@ -12336,15 +11500,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
*
* Emitted at the child application's request.
*/
- OBSOLETE_SIGNAL (klass->refresh_window_signal =)
- g_signal_new(I_("refresh-window"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, refresh_window),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("refresh-window"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, refresh_window),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::restore-window:
@@ -12352,15 +11515,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
*
* Emitted at the child application's request.
*/
- OBSOLETE_SIGNAL (klass->restore_window_signal =)
- g_signal_new(I_("restore-window"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, restore_window),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("restore-window"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, restore_window),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::maximize-window:
@@ -12368,15 +11530,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
*
* Emitted at the child application's request.
*/
- OBSOLETE_SIGNAL (klass->maximize_window_signal =)
- g_signal_new(I_("maximize-window"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, maximize_window),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("maximize-window"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, maximize_window),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::resize-window:
@@ -12386,15 +11547,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
*
* Emitted at the child application's request.
*/
- OBSOLETE_SIGNAL (klass->resize_window_signal =)
- g_signal_new(I_("resize-window"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, resize_window),
- NULL,
- NULL,
- _vte_marshal_VOID__UINT_UINT,
- G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
+ g_signal_new(I_("resize-window"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, resize_window),
+ NULL,
+ NULL,
+ _vte_marshal_VOID__UINT_UINT,
+ G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
/**
* VteTerminal::move-window:
@@ -12404,15 +11564,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
*
* Emitted at the child application's request.
*/
- OBSOLETE_SIGNAL (klass->move_window_signal =)
- g_signal_new(I_("move-window"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, move_window),
- NULL,
- NULL,
- _vte_marshal_VOID__UINT_UINT,
- G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
+ g_signal_new(I_("move-window"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, move_window),
+ NULL,
+ NULL,
+ _vte_marshal_VOID__UINT_UINT,
+ G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
/**
* VteTerminal::status-line-changed:
@@ -12421,15 +11580,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
* Emitted whenever the contents of the status line are modified or
* cleared.
*/
- OBSOLETE_SIGNAL (klass->status_line_changed_signal =)
- g_signal_new(I_("status-line-changed"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, status_line_changed),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("status-line-changed"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, status_line_changed),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::increase-font-size:
@@ -12437,15 +11595,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
*
* Emitted when the user hits the '+' key while holding the Control key.
*/
- OBSOLETE_SIGNAL (klass->increase_font_size_signal =)
- g_signal_new(I_("increase-font-size"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, increase_font_size),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("increase-font-size"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, increase_font_size),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::decrease-font-size:
@@ -12453,15 +11610,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
*
* Emitted when the user hits the '-' key while holding the Control key.
*/
- OBSOLETE_SIGNAL (klass->decrease_font_size_signal =)
- g_signal_new(I_("decrease-font-size"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, decrease_font_size),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("decrease-font-size"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, decrease_font_size),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::text-modified:
@@ -12471,15 +11627,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
* its accessibility peer. May not be emitted under certain
* circumstances.
*/
- OBSOLETE_SIGNAL (klass->text_modified_signal =)
- g_signal_new(I_("text-modified"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, text_modified),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("text-modified"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, text_modified),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::text-inserted:
@@ -12489,15 +11644,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
* its accessibility peer. May not be emitted under certain
* circumstances.
*/
- OBSOLETE_SIGNAL (klass->text_inserted_signal =)
- g_signal_new(I_("text-inserted"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, text_inserted),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("text-inserted"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, text_inserted),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::text-deleted:
@@ -12507,15 +11661,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
* its accessibility peer. May not be emitted under certain
* circumstances.
*/
- OBSOLETE_SIGNAL (klass->text_deleted_signal =)
- g_signal_new(I_("text-deleted"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, text_deleted),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ g_signal_new(I_("text-deleted"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, text_deleted),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
/**
* VteTerminal::text-scrolled:
@@ -12526,17 +11679,14 @@ vte_terminal_class_init(VteTerminalClass *klass)
* its accessibility peer. May not be emitted under certain
* circumstances.
*/
- OBSOLETE_SIGNAL (klass->text_scrolled_signal =)
- g_signal_new(I_("text-scrolled"),
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(VteTerminalClass, text_scrolled),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
-#undef OBSOLETE_SIGNAL
+ g_signal_new(I_("text-scrolled"),
+ G_OBJECT_CLASS_TYPE(klass),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(VteTerminalClass, text_scrolled),
+ NULL,
+ NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, 1, G_TYPE_INT);
/**
* VteTerminal::copy-clipboard:
@@ -12600,7 +11750,7 @@ vte_terminal_class_init(VteTerminalClass *klass)
PROP_ALLOW_BOLD,
g_param_spec_boolean ("allow-bold", NULL, NULL,
TRUE,
- G_PARAM_READWRITE | STATIC_PARAMS));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* VteTerminal:audible-bell:
@@ -12615,134 +11765,42 @@ vte_terminal_class_init(VteTerminalClass *klass)
PROP_AUDIBLE_BELL,
g_param_spec_boolean ("audible-bell", NULL, NULL,
TRUE,
- G_PARAM_READWRITE | STATIC_PARAMS));
-
- /**
- * VteTerminal:background-image-file: (type filename):
- *
- * Sets a background image file for the widget. If specified by
- * #VteTerminal:background-saturation:, the terminal will tint its
- * in-memory copy of the image before applying it to the terminal.
- *
- * Since: 0.20
- */
- g_object_class_install_property
- (gobject_class,
- PROP_BACKGROUND_IMAGE_FILE,
- g_param_spec_string ("background-image-file", NULL, NULL,
- NULL,
- G_PARAM_READWRITE | STATIC_PARAMS));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
- * VteTerminal:background-image-pixbuf:
+ * VteTerminal:backspace-binding:
*
- * Sets a background image for the widget. Text which would otherwise be
- * drawn using the default background color will instead be drawn over the
- * specified image. If necessary, the image will be tiled to cover the
- * widget's entire visible area. If specified by
- * #VteTerminal:background-saturation:, the terminal will tint its
- * in-memory copy of the image before applying it to the terminal.
+ * *Controls what string or control sequence the terminal sends to its child
+ * when the user presses the backspace key.
*
* Since: 0.20
*/
g_object_class_install_property
(gobject_class,
- PROP_BACKGROUND_IMAGE_PIXBUF,
- g_param_spec_object ("background-image-pixbuf", NULL, NULL,
- GDK_TYPE_PIXBUF,
- G_PARAM_READWRITE | STATIC_PARAMS));
+ PROP_BACKSPACE_BINDING,
+ g_param_spec_enum ("backspace-binding", NULL, NULL,
+ VTE_TYPE_ERASE_BINDING,
+ VTE_ERASE_AUTO,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
- * VteTerminal:background-opacity:
- *
- * Sets the opacity of the terminal background, were 0.0 means completely
- * transparent and 1.0 means completely opaque.
- *
- * Since: 0.20
- */
- g_object_class_install_property
- (gobject_class,
- PROP_BACKGROUND_OPACITY,
- g_param_spec_double ("background-opacity", NULL, NULL,
- 0.0, 1.0,
- 1.0,
- G_PARAM_READWRITE | STATIC_PARAMS));
-
- /**
- * VteTerminal:background-saturation:
- *
- * If a background image has been set using #VteTerminal:background-image-file: or
- * #VteTerminal:background-image-pixbuf:, or #VteTerminal:background-transparent:,
- * and the saturation value is less
- * than 1.0, the terminal will adjust the colors of the image before drawing
- * the image. To do so, the terminal will create a copy of the background
- * image (or snapshot of the root window) and modify its pixel values.
- *
- * Since: 0.20
- */
- g_object_class_install_property
- (gobject_class,
- PROP_BACKGROUND_SATURATION,
- g_param_spec_double ("background-saturation", NULL, NULL,
- 0.0, 1.0,
- 0.4,
- G_PARAM_READWRITE | STATIC_PARAMS));
-
- /**
- * VteTerminal:background-tint-color:
- *
- * If a background image has been set using #VteTerminal:background-image-file: or
- * #VteTerminal:background-image-pixbuf:, or #VteTerminal:background-transparent:, and
- * and the value set by VteTerminal:background-saturation: is less than 1.0,
- * the terminal
- * will adjust the color of the image before drawing the image. To do so,
- * the terminal will create a copy of the background image (or snapshot of
- * the root window) and modify its pixel values. The initial tint color
- * is black.
- *
- * Since: 0.20
- */
- g_object_class_install_property
- (gobject_class,
- PROP_BACKGROUND_TINT_COLOR,
- g_param_spec_boxed ("background-tint-color", NULL, NULL,
- GDK_TYPE_COLOR,
- G_PARAM_READWRITE | STATIC_PARAMS));
-
- /**
- * VteTerminal:background-transparent:
- *
- * Sets whther the terminal uses the pixmap stored in the root
- * window as the background, adjusted so that if there are no windows
- * below your application, the widget will appear to be transparent.
+ * VteTerminal:cjk-ambiguous-width:
*
- * Note: When using a compositing window manager, you should instead
- * set a RGBA colourmap on the toplevel window, so you get real transparency.
- *
- * Since: 0.20
- */
- g_object_class_install_property
- (gobject_class,
- PROP_BACKGROUND_TRANSPARENT,
- g_param_spec_boolean ("background-transparent", NULL, NULL,
- FALSE,
- G_PARAM_READWRITE | STATIC_PARAMS));
-
- /**
- * VteTerminal:backspace-binding:
+ * This setting controls whether ambiguous-width characters are narrow or wide
+ * when using the UTF-8 encoding (vte_terminal_set_encoding()). In all other encodings,
+ * the width of ambiguous-width characters is fixed.
*
- * *Controls what string or control sequence the terminal sends to its child
- * when the user presses the backspace key.
+ * This setting only takes effect the next time the terminal is reset, either
+ * via escape sequence or with vte_terminal_reset().
*
- * Since: 0.20
+ * Since: 0.38
*/
g_object_class_install_property
(gobject_class,
- PROP_BACKSPACE_BINDING,
- g_param_spec_enum ("backspace-binding", NULL, NULL,
- VTE_TYPE_TERMINAL_ERASE_BINDING,
- VTE_ERASE_AUTO,
- G_PARAM_READWRITE | STATIC_PARAMS));
+ PROP_CURSOR_BLINK_MODE,
+ g_param_spec_int ("cjk-ambiguous-width", NULL, NULL,
+ 1, 2, VTE_ISO2022_DEFAULT_UTF8_AMBIGUOUS_WIDTH,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* VteTerminal:cursor-blink-mode:
@@ -12756,10 +11814,10 @@ vte_terminal_class_init(VteTerminalClass *klass)
(gobject_class,
PROP_CURSOR_BLINK_MODE,
g_param_spec_enum ("cursor-blink-mode", NULL, NULL,
- VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE,
+ VTE_TYPE_CURSOR_BLINK_MODE,
VTE_CURSOR_BLINK_SYSTEM,
- G_PARAM_READWRITE | STATIC_PARAMS));
-
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
/**
* VteTerminal:cursor-shape:
*
@@ -12771,9 +11829,9 @@ vte_terminal_class_init(VteTerminalClass *klass)
(gobject_class,
PROP_CURSOR_SHAPE,
g_param_spec_enum ("cursor-shape", NULL, NULL,
- VTE_TYPE_TERMINAL_CURSOR_SHAPE,
+ VTE_TYPE_CURSOR_SHAPE,
VTE_CURSOR_SHAPE_BLOCK,
- G_PARAM_READWRITE | STATIC_PARAMS));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* VteTerminal:delete-binding:
@@ -12787,9 +11845,9 @@ vte_terminal_class_init(VteTerminalClass *klass)
(gobject_class,
PROP_DELETE_BINDING,
g_param_spec_enum ("delete-binding", NULL, NULL,
- VTE_TYPE_TERMINAL_ERASE_BINDING,
+ VTE_TYPE_ERASE_BINDING,
VTE_ERASE_AUTO,
- G_PARAM_READWRITE | STATIC_PARAMS));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* VteTerminal:emulation:
@@ -12805,8 +11863,24 @@ vte_terminal_class_init(VteTerminalClass *klass)
PROP_EMULATION,
g_param_spec_string ("emulation", NULL, NULL,
VTE_DEFAULT_EMULATION,
- G_PARAM_READWRITE | STATIC_PARAMS));
-
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * VteTerminal:font-scale:
+ *
+ * The terminal's font scale.
+ *
+ * Since: 0.30
+ */
+ g_object_class_install_property
+ (gobject_class,
+ PROP_AUDIBLE_BELL,
+ g_param_spec_double ("font-scale", NULL, NULL,
+ VTE_FONT_SCALE_MIN,
+ VTE_FONT_SCALE_MAX,
+ 1.,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
/**
* VteTerminal:encoding:
*
@@ -12822,7 +11896,7 @@ vte_terminal_class_init(VteTerminalClass *klass)
PROP_ENCODING,
g_param_spec_string ("encoding", NULL, NULL,
NULL,
- G_PARAM_READWRITE | STATIC_PARAMS));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* VteTerminal:font-desc:
@@ -12840,7 +11914,7 @@ vte_terminal_class_init(VteTerminalClass *klass)
PROP_FONT_DESC,
g_param_spec_boxed ("font-desc", NULL, NULL,
PANGO_TYPE_FONT_DESCRIPTION,
- G_PARAM_READWRITE | STATIC_PARAMS));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* VteTerminal:icon-title:
@@ -12854,7 +11928,7 @@ vte_terminal_class_init(VteTerminalClass *klass)
PROP_ICON_TITLE,
g_param_spec_string ("icon-title", NULL, NULL,
NULL,
- G_PARAM_READABLE | STATIC_PARAMS));
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
/**
* VteTerminal:pointer-autohide:
@@ -12870,27 +11944,10 @@ vte_terminal_class_init(VteTerminalClass *klass)
PROP_MOUSE_POINTER_AUTOHIDE,
g_param_spec_boolean ("pointer-autohide", NULL, NULL,
FALSE,
- G_PARAM_READWRITE | STATIC_PARAMS));
-
- /**
- * VteTerminal:pty:
- *
- * The file descriptor of the master end of the terminal's PTY.
- *
- * Since: 0.20
- *
- * Deprecated: 0.26: Use the #VteTerminal:pty-object property instead
- */
- g_object_class_install_property
- (gobject_class,
- PROP_PTY,
- g_param_spec_int ("pty", NULL, NULL,
- -1, G_MAXINT,
- -1,
- G_PARAM_READWRITE | STATIC_PARAMS));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
- * VteTerminal:pty-object:
+ * VteTerminal:pty:
*
* The PTY object for the terminal.
*
@@ -12898,27 +11955,27 @@ vte_terminal_class_init(VteTerminalClass *klass)
*/
g_object_class_install_property
(gobject_class,
- PROP_PTY_OBJECT,
- g_param_spec_object ("pty-object", NULL, NULL,
+ PROP_PTY,
+ g_param_spec_object ("pty", NULL, NULL,
VTE_TYPE_PTY,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
- * VteTerminal:scroll-background:
+ * VteTerminal:rewrap-on-resize:
*
- * Controls whether or not the terminal will scroll the background image (if
- * one is set) when the text in the window must be scrolled.
+ * Controls whether or not the terminal will rewrap its contents, including
+ * the scrollback buffer, whenever the terminal's width changes.
*
- * Since: 0.20
+ * Since: 0.36
*/
g_object_class_install_property
(gobject_class,
- PROP_SCROLL_BACKGROUND,
- g_param_spec_boolean ("scroll-background", NULL, NULL,
- FALSE,
- G_PARAM_READWRITE | STATIC_PARAMS));
-
+ PROP_REWRAP_ON_RESIZE,
+ g_param_spec_boolean ("rewrap-on-resize", NULL, NULL,
+ TRUE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
/**
* VteTerminal:scrollback-lines:
*
@@ -12937,7 +11994,7 @@ vte_terminal_class_init(VteTerminalClass *klass)
g_param_spec_uint ("scrollback-lines", NULL, NULL,
0, G_MAXUINT,
VTE_SCROLLBACK_INIT,
- G_PARAM_READWRITE | STATIC_PARAMS));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* VteTerminal:scroll-on-keystroke:
@@ -12953,7 +12010,7 @@ vte_terminal_class_init(VteTerminalClass *klass)
PROP_SCROLL_ON_KEYSTROKE,
g_param_spec_boolean ("scroll-on-keystroke", NULL, NULL,
FALSE,
- G_PARAM_READWRITE | STATIC_PARAMS));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* VteTerminal:scroll-on-output:
@@ -12968,7 +12025,7 @@ vte_terminal_class_init(VteTerminalClass *klass)
PROP_SCROLL_ON_OUTPUT,
g_param_spec_boolean ("scroll-on-output", NULL, NULL,
TRUE,
- G_PARAM_READWRITE | STATIC_PARAMS));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* VteTerminal:window-title:
@@ -12982,28 +12039,36 @@ vte_terminal_class_init(VteTerminalClass *klass)
PROP_WINDOW_TITLE,
g_param_spec_string ("window-title", NULL, NULL,
NULL,
- G_PARAM_READABLE | STATIC_PARAMS));
-
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
/**
- * VteTerminal:word-chars:
+ * VteTerminal:current-directory-uri:
*
- * When the user double-clicks to start selection, the terminal will extend
- * the selection on word boundaries. It will treat characters the word-chars
- * characters as parts of words, and all other characters as word separators.
- * Ranges of characters can be specified by separating them with a hyphen.
+ * The current directory URI, or %NULL if unset.
*
- * As a special case, when setting this to %NULL or the empty string, the terminal will
- * treat all graphic non-punctuation non-space characters as word characters.
- *
- * Since: 0.20
+ * Since: 0.34
*/
g_object_class_install_property
(gobject_class,
- PROP_WORD_CHARS,
- g_param_spec_string ("word-chars", NULL, NULL,
+ PROP_CURRENT_DIRECTORY_URI,
+ g_param_spec_string ("current-directory-uri", NULL, NULL,
NULL,
- G_PARAM_READWRITE | STATIC_PARAMS));
-
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
+ /**
+ * VteTerminal:current-file-uri:
+ *
+ * The current file URI, or %NULL if unset.
+ *
+ * Since: 0.34
+ */
+ g_object_class_install_property
+ (gobject_class,
+ PROP_CURRENT_FILE_URI,
+ g_param_spec_string ("current-file-uri", NULL, NULL,
+ NULL,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
/**
* VteTerminal:visible-bell:
*
@@ -13018,52 +12083,35 @@ vte_terminal_class_init(VteTerminalClass *klass)
PROP_VISIBLE_BELL,
g_param_spec_boolean ("visible-bell", NULL, NULL,
FALSE,
- G_PARAM_READWRITE | STATIC_PARAMS));
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/* Style properties */
- /**
- * VteTerminal:inner-border:
- *
- * Sets the border around the terminal.
- *
- * Since: 0.24
- */
- gtk_widget_class_install_style_property
- (widget_class,
- g_param_spec_boxed ("inner-border", NULL, NULL,
- GTK_TYPE_BORDER,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
-
-#if !GTK_CHECK_VERSION (2,99, 0)
- /* Now install the default style */
- gtk_rc_parse_string("style \"vte-default-style\" {\n"
- "VteTerminal::inner-border = { 1, 1, 1, 1 }\n"
- "}\n"
- "class \"VteTerminal\" style : gtk \"vte-default-style\"\n");
-#endif
-
/* Keybindings */
binding_set = gtk_binding_set_by_class(klass);
/* Bind Copy, Paste, Cut keys */
- gtk_binding_entry_add_signal(binding_set, GDK_KEY (F16), 0, "copy-clipboard",0);
- gtk_binding_entry_add_signal(binding_set, GDK_KEY (F18), 0, "paste-clipboard", 0);
- gtk_binding_entry_add_signal(binding_set, GDK_KEY (F20), 0, "copy-clipboard",0);
+ gtk_binding_entry_add_signal(binding_set, GDK_KEY_F16, 0, "copy-clipboard",0);
+ gtk_binding_entry_add_signal(binding_set, GDK_KEY_F18, 0, "paste-clipboard", 0);
+ gtk_binding_entry_add_signal(binding_set, GDK_KEY_F20, 0, "copy-clipboard",0);
+
+ /* Disable GTK's builtin handler for Ctrl+F1, see bug 726438 */
+ binding_set = gtk_binding_set_by_class(vte_terminal_parent_class);
+ gtk_binding_entry_skip(binding_set, GDK_KEY_F1, GDK_CONTROL_MASK);
process_timer = g_timer_new ();
-#if GTK_CHECK_VERSION (2, 99, 0)
klass->priv = G_TYPE_CLASS_GET_PRIVATE (klass, VTE_TYPE_TERMINAL, VteTerminalClassPrivate);
klass->priv->style_provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (klass->priv->style_provider),
"VteTerminal {\n"
- "-VteTerminal-inner-border: 1;\n"
+ "padding: 1px 1px 1px 1px;\n"
"}\n",
-1, NULL);
-#endif /* GTK 3.0 */
+
+ /* a11y */
+ gtk_widget_class_set_accessible_type(widget_class, VTE_TYPE_TERMINAL_ACCESSIBLE);
}
/**
@@ -13199,37 +12247,6 @@ vte_terminal_get_allow_bold(VteTerminal *terminal)
}
/**
- * vte_terminal_set_scroll_background:
- * @terminal: a #VteTerminal
- * @scroll: whether the terminal should scroll the background image along with
- * the text
- *
- * Controls whether or not the terminal will scroll the background image (if
- * one is set) when the text in the window must be scrolled.
- *
- * Since: 0.11
- */
-void
-vte_terminal_set_scroll_background(VteTerminal *terminal, gboolean scroll)
-{
- VteTerminalPrivate *pvt;
-
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
- pvt = terminal->pvt;
-
- scroll = scroll != FALSE;
- if (scroll == pvt->scroll_background)
- return;
-
- pvt->scroll_background = scroll;
-
- g_object_notify (G_OBJECT (terminal), "scroll-background");
-
- vte_terminal_queue_background_update(terminal);
-}
-
-/**
* vte_terminal_set_scroll_on_output:
* @terminal: a #VteTerminal
* @scroll: whether the terminal should scroll on output
@@ -13272,6 +12289,57 @@ vte_terminal_set_scroll_on_keystroke(VteTerminal *terminal, gboolean scroll)
}
/**
+ * vte_terminal_set_rewrap_on_resize:
+ * @terminal: a #VteTerminal
+ * @rewrap: %TRUE if the terminal should rewrap on resize
+ *
+ * Controls whether or not the terminal will rewrap its contents, including
+ * the scrollback history, whenever the terminal's width changes.
+ *
+ * Since: 0.36
+ */
+void
+vte_terminal_set_rewrap_on_resize(VteTerminal *terminal, gboolean rewrap)
+{
+ VteTerminalPrivate *pvt;
+
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
+
+ pvt = terminal->pvt;
+
+ if (rewrap == pvt->rewrap_on_resize)
+ return;
+
+ pvt->rewrap_on_resize = rewrap;
+ g_object_notify (G_OBJECT (terminal), "rewrap-on-resize");
+}
+
+/**
+ * vte_terminal_get_rewrap_on_resize:
+ * @terminal: a #VteTerminal
+ *
+ * Checks whether or not the terminal will rewrap its contents upon resize.
+ *
+ * Returns: %TRUE if rewrapping is enabled, %FALSE if not
+ *
+ * Since: 0.36
+ */
+gboolean
+vte_terminal_get_rewrap_on_resize(VteTerminal *terminal)
+{
+ g_return_val_if_fail(VTE_IS_TERMINAL(terminal), FALSE);
+ return terminal->pvt->rewrap_on_resize;
+}
+
+/* Place the selected text onto the CLIPBOARD clipboard. Do this
+ * asynchronously, so that we can support the html target as well */
+static void
+vte_terminal_real_copy_clipboard(VteTerminal *terminal)
+{
+ vte_terminal_copy(terminal, VTE_SELECTION_CLIPBOARD);
+}
+
+/**
* vte_terminal_copy_clipboard:
* @terminal: a #VteTerminal
*
@@ -13341,360 +12409,37 @@ vte_terminal_paste_primary(VteTerminal *terminal)
vte_terminal_paste(terminal, GDK_SELECTION_PRIMARY);
}
-/**
- * vte_terminal_im_append_menuitems:
- * @terminal: a #VteTerminal
- * @menushell: a GtkMenuShell
- *
- * 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.
- */
-void
-vte_terminal_im_append_menuitems(VteTerminal *terminal, GtkMenuShell *menushell)
-{
- GtkIMMulticontext *context;
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
- g_return_if_fail (gtk_widget_get_realized (&terminal->widget));
- g_return_if_fail(GTK_IS_MENU_SHELL(menushell));
- context = GTK_IM_MULTICONTEXT(terminal->pvt->im_context);
- gtk_im_multicontext_append_menuitems(context, menushell);
-}
-
/* Set up whatever background we wanted. */
-static gboolean
+static void
vte_terminal_background_update(VteTerminal *terminal)
{
- double saturation;
const PangoColor *entry;
- GdkColor color;
+ GdkRGBA color;
/* If we're not realized yet, don't worry about it, because we get
* called when we realize. */
if (! gtk_widget_get_realized (&terminal->widget)) {
- _vte_debug_print(VTE_DEBUG_MISC,
- "Can not set background image without "
- "window.\n");
- return TRUE;
+ return;
}
_vte_debug_print(VTE_DEBUG_MISC|VTE_DEBUG_EVENTS,
- "Updating background image.\n");
+ "Updating background color.\n");
- entry = &terminal->pvt->palette[VTE_DEF_BG];
- _vte_debug_print(VTE_DEBUG_BG,
- "Setting background color to (%d, %d, %d, %d).\n",
+ entry = _vte_terminal_get_color(terminal, VTE_DEFAULT_BG);
+ _vte_debug_print(VTE_DEBUG_STYLE,
+ "Setting background color to (%d, %d, %d, %.3f).\n",
entry->red, entry->green, entry->blue,
- terminal->pvt->bg_opacity);
-
- /* Set the terminal widget background color since otherwise we
- * won't draw it for VTE_BG_SOURCE_NONE. */
- color.red = entry->red;
- color.green = entry->green;
- color.blue = entry->blue;
- gtk_widget_modify_bg (&terminal->widget, GTK_STATE_NORMAL, &color);
-
- _vte_draw_set_background_solid (terminal->pvt->draw,
- entry->red / 65535.,
- entry->green / 65535.,
- entry->blue / 65535.,
- terminal->pvt->bg_opacity / 65535.);
-
- /* If we're transparent, and either have no root image or are being
- * told to update it, get a new copy of the root window. */
- saturation = (double) terminal->pvt->bg_saturation;
- saturation /= VTE_SATURATION_MAX;
- if (terminal->pvt->bg_transparent) {
- if (terminal->pvt->root_pixmap_changed_tag == 0) {
- VteBg *bg;
-
- /* Connect to background-change events. */
- bg = vte_bg_get_for_screen (gtk_widget_get_screen (&terminal->widget));
- terminal->pvt->root_pixmap_changed_tag =
- g_signal_connect(bg, "root-pixmap-changed",
- G_CALLBACK(root_pixmap_changed_cb),
- terminal);
- }
-
- _vte_draw_set_background_image(terminal->pvt->draw,
- VTE_BG_SOURCE_ROOT,
- NULL,
- NULL,
- &terminal->pvt->bg_tint_color,
- saturation);
- } else
- if (terminal->pvt->bg_file) {
- _vte_draw_set_background_image(terminal->pvt->draw,
- VTE_BG_SOURCE_FILE,
- NULL,
- terminal->pvt->bg_file,
- &terminal->pvt->bg_tint_color,
- saturation);
- } else
- if (GDK_IS_PIXBUF(terminal->pvt->bg_pixbuf)) {
- _vte_draw_set_background_image(terminal->pvt->draw,
- VTE_BG_SOURCE_PIXBUF,
- terminal->pvt->bg_pixbuf,
- NULL,
- &terminal->pvt->bg_tint_color,
- saturation);
- } else {
- _vte_draw_set_background_image(terminal->pvt->draw,
- VTE_BG_SOURCE_NONE,
- NULL,
- NULL,
- &terminal->pvt->bg_tint_color,
- saturation);
- }
+ terminal->pvt->background_alpha);
+
+ color.red = entry->red / 65535.;
+ color.green = entry->green / 65535.;
+ color.blue = entry->blue / 65535.;
+ color.alpha = terminal->pvt->background_alpha;
- /* Note that the update has finished. */
- terminal->pvt->bg_update_pending = FALSE;
+ _vte_draw_set_background_solid (terminal->pvt->draw, &color);
/* Force a redraw for everything. */
_vte_invalidate_all (terminal);
-
- return FALSE;
-}
-
-/* Queue an update of the background image, to be done as soon as we can
- * get to it. Just bail if there's already an update pending, so that if
- * opaque move tables to screw us, we don't end up with an insane backlog
- * of updates after the user finishes moving us. */
-static void
-vte_terminal_queue_background_update(VteTerminal *terminal)
-{
- _vte_debug_print(VTE_DEBUG_EVENTS,
- "Queued background update.\n");
- terminal->pvt->bg_update_pending = TRUE;
- /* force a redraw when convenient */
- add_update_timeout (terminal);
-}
-
-/**
- * vte_terminal_set_background_saturation:
- * @terminal: a #VteTerminal
- * @saturation: a floating point value between 0.0 and 1.0.
- *
- * If a background image has been set using
- * vte_terminal_set_background_image(),
- * vte_terminal_set_background_image_file(), or
- * vte_terminal_set_background_transparent(), and the saturation value is less
- * than 1.0, the terminal will adjust the colors of the image before drawing
- * the image. To do so, the terminal will create a copy of the background
- * image (or snapshot of the root window) and modify its pixel values.
- */
-void
-vte_terminal_set_background_saturation(VteTerminal *terminal, double saturation)
-{
- VteTerminalPrivate *pvt;
- guint v;
-
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
- pvt = terminal->pvt;
-
- v = CLAMP(saturation * VTE_SATURATION_MAX, 0, VTE_SATURATION_MAX);
- if (v == pvt->bg_saturation)
- return;
-
- _vte_debug_print(VTE_DEBUG_MISC,
- "Setting background saturation to %d/%d.\n",
- v, VTE_SATURATION_MAX);
-
- pvt->bg_saturation = v;
- g_object_notify(G_OBJECT (terminal), "background-saturation");
-
- vte_terminal_queue_background_update(terminal);
-}
-
-/**
- * vte_terminal_set_background_tint_color:
- * @terminal: a #VteTerminal
- * @color: a color which the terminal background should be tinted to if its
- * saturation is not 1.0.
- *
- * If a background image has been set using
- * vte_terminal_set_background_image(),
- * vte_terminal_set_background_image_file(), or
- * vte_terminal_set_background_transparent(), and the value set by
- * vte_terminal_set_background_saturation() is less than one, the terminal
- * will adjust the color of the image before drawing the image. To do so,
- * the terminal will create a copy of the background image (or snapshot of
- * the root window) and modify its pixel values. The initial tint color
- * is black.
- *
- * Since: 0.11
- */
-void
-vte_terminal_set_background_tint_color(VteTerminal *terminal,
- const GdkColor *color)
-{
- VteTerminalPrivate *pvt;
- PangoColor *tint;
-
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
- g_return_if_fail(color != NULL);
-
- pvt = terminal->pvt;
-
- _vte_debug_print(VTE_DEBUG_MISC,
- "Setting background tint to %d,%d,%d.\n",
- terminal->pvt->bg_tint_color.red >> 8,
- terminal->pvt->bg_tint_color.green >> 8,
- terminal->pvt->bg_tint_color.blue >> 8);
- tint = &pvt->bg_tint_color;
- if (color->red == tint->red &&
- color->green == tint->green &&
- color->blue == tint->blue)
- return;
-
- tint->red = color->red;
- tint->green = color->green;
- tint->blue = color->blue;
-
- g_object_notify(G_OBJECT (terminal), "background-tint-color");
-
- vte_terminal_queue_background_update(terminal);
-}
-
-/**
- * vte_terminal_set_background_transparent:
- * @terminal: a #VteTerminal
- * @transparent: whether the terminal should fake transparency
- *
- * Sets the terminal's background image to the pixmap stored in the root
- * window, adjusted so that if there are no windows below your application,
- * the widget will appear to be transparent.
- */
-void
-vte_terminal_set_background_transparent(VteTerminal *terminal,
- gboolean transparent)
-{
- VteTerminalPrivate *pvt;
-
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
- pvt = terminal->pvt;
-
- transparent = transparent != FALSE;
- if (transparent == pvt->bg_transparent)
- return;
-
- _vte_debug_print(VTE_DEBUG_MISC,
- "Turning background transparency %s.\n",
- transparent ? "on" : "off");
-
- pvt->bg_transparent = transparent;
- g_object_notify(G_OBJECT (terminal), "background-transparent");
-
- /* Update the background. */
- vte_terminal_queue_background_update(terminal);
-}
-
-/**
- * vte_terminal_set_background_image:
- * @terminal: a #VteTerminal
- * @image: (allow-none): a #GdkPixbuf to use, or %NULL to unset the background
- *
- * Sets a background image for the widget. Text which would otherwise be
- * drawn using the default background color will instead be drawn over the
- * 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.
- */
-void
-vte_terminal_set_background_image(VteTerminal *terminal, GdkPixbuf *image)
-{
- VteTerminalPrivate *pvt;
- GObject *object;
-
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
- g_return_if_fail(image==NULL || GDK_IS_PIXBUF(image));
-
- object = G_OBJECT(terminal);
- pvt = terminal->pvt;
-
- if (image && image == pvt->bg_pixbuf)
- return;
-
- _vte_debug_print(VTE_DEBUG_MISC,
- "%s background image.\n",
- GDK_IS_PIXBUF(image) ? "Setting" : "Clearing");
-
- g_object_freeze_notify(object);
-
- /* Get a ref to the new image if there is one. Do it here just in
- * case we're actually given the same one we're already using. */
- if (image != NULL) {
- g_object_ref(image);
- }
-
- /* Unref the previous background image. */
- if (pvt->bg_pixbuf != NULL) {
- g_object_unref(pvt->bg_pixbuf);
- }
-
- /* Clear a background file name, if one was set. */
- if (pvt->bg_file) {
- g_free(pvt->bg_file);
- pvt->bg_file = NULL;
-
- g_object_notify(object, "background-image-file");
- }
-
- /* Set the new background. */
- pvt->bg_pixbuf = image;
-
- g_object_notify(object, "background-image-pixbuf");
-
- vte_terminal_queue_background_update(terminal);
-
- g_object_thaw_notify(object);
-}
-
-/**
- * vte_terminal_set_background_image_file:
- * @terminal: a #VteTerminal
- * @path: (type filename): path to an image file
- *
- * Sets a background image for the widget. 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.
- */
-void
-vte_terminal_set_background_image_file(VteTerminal *terminal, const char *path)
-{
- VteTerminalPrivate *pvt;
- GObject *object;
-
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
-
- object = G_OBJECT(terminal);
- pvt = terminal->pvt;
-
- _vte_debug_print(VTE_DEBUG_MISC,
- "Loading background image from `%s'.\n", path);
-
- g_object_freeze_notify(G_OBJECT(terminal));
-
- /* Save this background type. */
- g_free(pvt->bg_file);
- pvt->bg_file = g_strdup(path);
-
- /* Turn off other background types. */
- if (pvt->bg_pixbuf != NULL) {
- g_object_unref(pvt->bg_pixbuf);
- pvt->bg_pixbuf = NULL;
-
- g_object_notify(object, "background-image-pixbuf");
- }
-
- g_object_notify(object, "background-image-file");
-
- vte_terminal_queue_background_update(terminal);
-
- g_object_thaw_notify(G_OBJECT(terminal));
}
/**
@@ -13714,26 +12459,6 @@ vte_terminal_get_has_selection(VteTerminal *terminal)
return terminal->pvt->has_selection;
}
-/**
- * vte_terminal_get_using_xft:
- * @terminal: a #VteTerminal
- *
- * A #VteTerminal can use multiple methods to draw text. This function
- * allows an application to determine whether or not the current method uses
- * fontconfig to find fonts. This setting cannot be changed by the caller,
- * but in practice usually matches the behavior of GTK+ itself.
- *
- * Returns: %TRUE
- *
- * Deprecated: 0.20
- */
-gboolean
-vte_terminal_get_using_xft(VteTerminal *terminal)
-{
- g_return_val_if_fail(VTE_IS_TERMINAL(terminal), TRUE);
- return TRUE;
-}
-
static void
vte_terminal_set_cursor_blinks_internal(VteTerminal *terminal, gboolean blink)
{
@@ -13748,24 +12473,9 @@ vte_terminal_set_cursor_blinks_internal(VteTerminal *terminal, gboolean blink)
}
/**
- * vte_terminal_set_cursor_blinks:
- * @terminal: a #VteTerminal
- * @blink: whether the cursor should blink
- *
- * Sets whether or not the cursor will blink.
- *
- * Deprecated: 0.17.1 Use vte_terminal_set_cursor_blink_mode() instead.
- */
-void
-vte_terminal_set_cursor_blinks(VteTerminal *terminal, gboolean blink)
-{
- vte_terminal_set_cursor_blink_mode(terminal, blink ? VTE_CURSOR_BLINK_ON : VTE_CURSOR_BLINK_OFF);
-}
-
-/**
* vte_terminal_set_cursor_blink_mode:
* @terminal: a #VteTerminal
- * @mode: the #VteTerminalCursorBlinkMode to use
+ * @mode: the #VteCursorBlinkMode to use
*
* Sets whether or not the cursor will blink. Using %VTE_CURSOR_BLINK_SYSTEM
* will use the #GtkSettings::gtk-cursor-blink setting.
@@ -13773,7 +12483,7 @@ vte_terminal_set_cursor_blinks(VteTerminal *terminal, gboolean blink)
* Since: 0.17.1
*/
void
-vte_terminal_set_cursor_blink_mode(VteTerminal *terminal, VteTerminalCursorBlinkMode mode)
+vte_terminal_set_cursor_blink_mode(VteTerminal *terminal, VteCursorBlinkMode mode)
{
VteTerminalPrivate *pvt;
gboolean blinks;
@@ -13815,7 +12525,7 @@ vte_terminal_set_cursor_blink_mode(VteTerminal *terminal, VteTerminalCursorBlink
*
* Since: 0.17.1
*/
-VteTerminalCursorBlinkMode
+VteCursorBlinkMode
vte_terminal_get_cursor_blink_mode(VteTerminal *terminal)
{
g_return_val_if_fail(VTE_IS_TERMINAL(terminal), VTE_CURSOR_BLINK_SYSTEM);
@@ -13826,14 +12536,14 @@ vte_terminal_get_cursor_blink_mode(VteTerminal *terminal)
/**
* vte_terminal_set_cursor_shape:
* @terminal: a #VteTerminal
- * @shape: the #VteTerminalCursorShape to use
+ * @shape: the #VteCursorShape to use
*
* Sets the shape of the cursor drawn.
*
* Since: 0.20
*/
void
-vte_terminal_set_cursor_shape(VteTerminal *terminal, VteTerminalCursorShape shape)
+vte_terminal_set_cursor_shape(VteTerminal *terminal, VteCursorShape shape)
{
VteTerminalPrivate *pvt;
@@ -13859,7 +12569,7 @@ vte_terminal_set_cursor_shape(VteTerminal *terminal, VteTerminalCursorShape shap
*
* Since: 0.17.6
*/
-VteTerminalCursorShape
+VteCursorShape
vte_terminal_get_cursor_shape(VteTerminal *terminal)
{
g_return_val_if_fail(VTE_IS_TERMINAL(terminal), VTE_CURSOR_SHAPE_BLOCK);
@@ -13919,28 +12629,31 @@ vte_terminal_set_scrollback_lines(VteTerminal *terminal, glong lines)
if (screen == &terminal->pvt->normal_screen) {
glong low, high, next;
/* We need at least as many lines as are visible */
- lines = MAX (lines, terminal->row_count);
+ lines = MAX (lines, terminal->pvt->row_count);
next = MAX (screen->cursor_current.row + 1,
_vte_ring_next (screen->row_data));
_vte_ring_resize (screen->row_data, lines);
low = _vte_ring_delta (screen->row_data);
- high = lines + MIN (G_MAXLONG - lines, low - terminal->row_count + 1);
+ high = lines + MIN (G_MAXLONG - lines, low - terminal->pvt->row_count + 1);
screen->insert_delta = CLAMP (screen->insert_delta, low, high);
scroll_delta = CLAMP (scroll_delta, low, screen->insert_delta);
- next = MIN (next, screen->insert_delta + terminal->row_count);
+ next = MIN (next, screen->insert_delta + terminal->pvt->row_count);
if (_vte_ring_next (screen->row_data) > next){
_vte_ring_shrink (screen->row_data, next - low);
}
} else {
- _vte_ring_resize (screen->row_data, terminal->row_count);
+ _vte_ring_resize (screen->row_data, terminal->pvt->row_count);
scroll_delta = _vte_ring_delta (screen->row_data);
screen->insert_delta = _vte_ring_delta (screen->row_data);
- if (_vte_ring_next (screen->row_data) > screen->insert_delta + terminal->row_count){
- _vte_ring_shrink (screen->row_data, terminal->row_count);
+ if (_vte_ring_next (screen->row_data) > screen->insert_delta + terminal->pvt->row_count){
+ _vte_ring_shrink (screen->row_data, terminal->pvt->row_count);
}
}
/* Adjust the scrollbars to the new locations. */
+ /* Hack: force a change in scroll_delta even if the value remains, so that
+ vte_term_q_adj_val_changed() doesn't shortcut to no-op, see bug 676075. */
+ terminal->pvt->screen->scroll_delta = -1;
vte_terminal_queue_adjustment_value_changed (terminal, scroll_delta);
_vte_terminal_adjust_adjustments_full (terminal);
@@ -13950,102 +12663,9 @@ vte_terminal_set_scrollback_lines(VteTerminal *terminal, glong lines)
}
/**
- * vte_terminal_set_word_chars:
- * @terminal: a #VteTerminal
- * @spec: a specification
- *
- * When the user double-clicks to start selection, the terminal will extend
- * the selection on word boundaries. It will treat characters included in @spec
- * as parts of words, and all other characters as word separators. Ranges of
- * characters can be specified by separating them with a hyphen.
- *
- * As a special case, if @spec is %NULL or the empty string, the terminal will
- * treat all graphic non-punctuation non-space characters as word characters.
- */
-void
-vte_terminal_set_word_chars(VteTerminal *terminal, const char *spec)
-{
- VteConv conv;
- gunichar *wbuf;
- guchar *ibuf, *ibufptr, *obuf, *obufptr;
- gsize ilen, olen;
- VteWordCharRange range;
- guint i;
-
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
- /* Allocate a new range array. */
- if (terminal->pvt->word_chars != NULL) {
- g_array_free(terminal->pvt->word_chars, TRUE);
- }
- terminal->pvt->word_chars = g_array_new(FALSE, TRUE,
- sizeof(VteWordCharRange));
- /* Special case: if spec is NULL, try to do the right thing. */
- if (spec == NULL || spec[0] == '\0') {
- g_object_notify(G_OBJECT(terminal), "word-chars");
- return;
- }
- /* Convert the spec from UTF-8 to a string of gunichars . */
- /* FIXME: why not just directly use g_utf8_to_ucs4 here? It'll never fail */
- conv = _vte_conv_open(VTE_CONV_GUNICHAR_TYPE, "UTF-8");
- if (conv == VTE_INVALID_CONV) {
- /* Aaargh. We're screwed. */
- g_warning(_("_vte_conv_open() failed setting word characters"));
- return;
- }
- ilen = strlen(spec);
- ibuf = ibufptr = (guchar *)g_strdup(spec);
- olen = (ilen + 1) * sizeof(gunichar);
- _vte_buffer_set_minimum_size(terminal->pvt->conv_buffer, olen);
- obuf = obufptr = terminal->pvt->conv_buffer->data;
- wbuf = (gunichar*) obuf;
- wbuf[ilen] = '\0';
- _vte_conv(conv, (const guchar **)&ibuf, &ilen, &obuf, &olen);
- _vte_conv_close(conv);
- for (i = 0; i < ((obuf - obufptr) / sizeof(gunichar)); i++) {
- /* The hyphen character. */
- if (wbuf[i] == '-') {
- range.start = wbuf[i];
- range.end = wbuf[i];
- g_array_append_val(terminal->pvt->word_chars, range);
- _vte_debug_print(VTE_DEBUG_MISC,
- "Word charset includes hyphen.\n");
- continue;
- }
- /* A single character, not the start of a range. */
- if ((wbuf[i] != '-') && (wbuf[i + 1] != '-')) {
- range.start = wbuf[i];
- range.end = wbuf[i];
- g_array_append_val(terminal->pvt->word_chars, range);
- _vte_debug_print(VTE_DEBUG_MISC,
- "Word charset includes `%lc'.\n",
- (wint_t) wbuf[i]);
- continue;
- }
- /* The start of a range. */
- if ((wbuf[i] != '-') &&
- (wbuf[i + 1] == '-') &&
- (wbuf[i + 2] != '-') &&
- (wbuf[i + 2] != 0)) {
- range.start = wbuf[i];
- range.end = wbuf[i + 2];
- g_array_append_val(terminal->pvt->word_chars, range);
- _vte_debug_print(VTE_DEBUG_MISC,
- "Word charset includes range from "
- "`%lc' to `%lc'.\n", (wint_t) wbuf[i],
- (wint_t) wbuf[i + 2]);
- i += 2;
- continue;
- }
- }
- g_free(ibufptr);
-
- g_object_notify(G_OBJECT(terminal), "word-chars");
-}
-
-/**
* vte_terminal_set_backspace_binding:
* @terminal: a #VteTerminal
- * @binding: a #VteTerminalEraseBinding for the backspace key
+ * @binding: a #VteEraseBinding for the backspace key
*
* Modifies the terminal's backspace key binding, which controls what
* string or control sequence the terminal sends to its child when the user
@@ -14053,7 +12673,7 @@ vte_terminal_set_word_chars(VteTerminal *terminal, const char *spec)
*/
void
vte_terminal_set_backspace_binding(VteTerminal *terminal,
- VteTerminalEraseBinding binding)
+ VteEraseBinding binding)
{
VteTerminalPrivate *pvt;
@@ -14073,7 +12693,7 @@ vte_terminal_set_backspace_binding(VteTerminal *terminal,
/**
* vte_terminal_set_delete_binding:
* @terminal: a #VteTerminal
- * @binding: a #VteTerminalEraseBinding for the delete key
+ * @binding: a #VteEraseBinding for the delete key
*
* Modifies the terminal's delete key binding, which controls what
* string or control sequence the terminal sends to its child when the user
@@ -14081,7 +12701,7 @@ vte_terminal_set_backspace_binding(VteTerminal *terminal,
*/
void
vte_terminal_set_delete_binding(VteTerminal *terminal,
- VteTerminalEraseBinding binding)
+ VteEraseBinding binding)
{
VteTerminalPrivate *pvt;
@@ -14161,6 +12781,7 @@ vte_terminal_reset(VteTerminal *terminal,
gboolean clear_history)
{
VteTerminalPrivate *pvt;
+ int i;
VteSelection sel;
g_return_if_fail(VTE_IS_TERMINAL(terminal));
@@ -14176,10 +12797,11 @@ vte_terminal_reset(VteTerminal *terminal,
_vte_incoming_chunks_release (pvt->incoming);
pvt->incoming = NULL;
g_array_set_size(pvt->pending, 0);
- _vte_buffer_clear(pvt->outgoing);
+ _vte_byte_array_clear(pvt->outgoing);
/* Reset charset substitution state. */
_vte_iso2022_state_free(pvt->iso2022);
pvt->iso2022 = _vte_iso2022_state_new(NULL,
+ pvt->iso2022_utf8_ambiguous_width,
&_vte_terminal_codeset_changed_cb,
terminal);
_vte_iso2022_state_set_codeset(pvt->iso2022,
@@ -14193,19 +12815,21 @@ vte_terminal_reset(VteTerminal *terminal,
pvt->vt220_fkey_mode = FALSE;
/* Enable meta-sends-escape. */
pvt->meta_sends_escape = TRUE;
- /* Disable smooth scroll. */
- pvt->smooth_scroll = FALSE;
/* Disable margin bell. */
pvt->margin_bell = FALSE;
/* Enable iso2022/NRC processing. */
pvt->nrc_mode = TRUE;
+ /* Disable DECCOLM mode. */
+ pvt->deccolm_mode = FALSE;
/* Reset saved settings. */
if (pvt->dec_saved != NULL) {
g_hash_table_destroy(pvt->dec_saved);
pvt->dec_saved = g_hash_table_new(NULL, NULL);
}
- /* Reset the color palette. */
- /* vte_terminal_set_default_colors(terminal); */
+ /* Reset the color palette. Only the 256 indexed colors, not the special ones.
+ * (XTerm doesn't reset the cursor color, the others are not alterable by escapes in vte.) */
+ for (i = 0; i < 256; i++)
+ terminal->pvt->palette[i].sources[VTE_COLOR_SOURCE_ESCAPE].is_set = FALSE;
/* Reset the default attributes. Reset the alternate attribute because
* it's not a real attribute, but we need to treat it as one here. */
pvt->screen = &pvt->alternate_screen;
@@ -14220,7 +12844,7 @@ vte_terminal_reset(VteTerminal *terminal,
_vte_ring_fini(pvt->normal_screen.row_data);
_vte_ring_init(pvt->normal_screen.row_data, pvt->scrollback_lines);
_vte_ring_fini(pvt->alternate_screen.row_data);
- _vte_ring_init(pvt->alternate_screen.row_data, terminal->row_count);
+ _vte_ring_init(pvt->alternate_screen.row_data, terminal->pvt->row_count);
pvt->normal_screen.cursor_saved.row = 0;
pvt->normal_screen.cursor_saved.col = 0;
pvt->normal_screen.cursor_current.row = 0;
@@ -14271,6 +12895,8 @@ vte_terminal_reset(VteTerminal *terminal,
pvt->alternate_screen.reverse_mode = FALSE;
pvt->alternate_screen.bracketed_paste_mode = FALSE;
pvt->cursor_visible = TRUE;
+ /* For some reason, xterm doesn't reset alternateScroll, but we do. */
+ pvt->alternate_screen_scroll = TRUE;
/* Reset the encoding. */
vte_terminal_set_encoding(terminal, NULL);
g_assert(pvt->encoding != NULL);
@@ -14288,19 +12914,23 @@ vte_terminal_reset(VteTerminal *terminal,
pvt->selection_html[sel] = NULL;
}
}
- memset(&pvt->selection_origin, 0,
- sizeof(&pvt->selection_origin));
- memset(&pvt->selection_last, 0,
- sizeof(&pvt->selection_last));
- memset(&pvt->selection_start, 0,
- sizeof(&pvt->selection_start));
- memset(&pvt->selection_end, 0,
- sizeof(&pvt->selection_end));
+ memset(&pvt->selection_origin, 0,
+ sizeof(pvt->selection_origin));
+ memset(&pvt->selection_last, 0,
+ sizeof(pvt->selection_last));
+ memset(&pvt->selection_start, 0,
+ sizeof(pvt->selection_start));
+ memset(&pvt->selection_end, 0,
+ sizeof(pvt->selection_end));
+
/* Reset mouse motion events. */
pvt->mouse_tracking_mode = MOUSE_TRACKING_NONE;
pvt->mouse_last_button = 0;
pvt->mouse_last_x = 0;
pvt->mouse_last_y = 0;
+ pvt->mouse_xterm_extension = FALSE;
+ pvt->mouse_urxvt_extension = FALSE;
+ pvt->mouse_smooth_scroll_delta = 0.;
/* Clear modifiers. */
pvt->modifiers = 0;
/* Cause everything to be redrawn (or cleared). */
@@ -14330,51 +12960,6 @@ vte_terminal_get_status_line(VteTerminal *terminal)
}
/**
- * vte_terminal_get_padding:
- * @terminal: a #VteTerminal
- * @xpad: address in which to store left/right-edge padding
- * @ypad: address in which to store top/bottom-edge ypadding
- *
- * 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 @xpad and @ypad are the total padding used in
- * each direction, and do not need to be doubled.
- *
- * Deprecated: 0.26: Get the #VteTerminal:inner-border style property instead
- */
-void
-vte_terminal_get_padding(VteTerminal *terminal, int *xpad, int *ypad)
-{
- g_return_if_fail(VTE_IS_TERMINAL(terminal));
- g_return_if_fail(xpad != NULL);
- g_return_if_fail(ypad != NULL);
- *xpad = terminal->pvt->inner_border.left + terminal->pvt->inner_border.right;
- *ypad = terminal->pvt->inner_border.top + terminal->pvt->inner_border.bottom;
-}
-
-/**
- * vte_terminal_get_adjustment:
- * @terminal: a #VteTerminal
- *
- * An accessor function provided for the benefit of language bindings.
- *
- * Returns: (transfer none): the contents of @terminal's adjustment field
- *
- * Deprecated: 0.28: Use gtk_scrollable_get_vadjustment() instead
- */
-GtkAdjustment *
-vte_terminal_get_adjustment(VteTerminal *terminal)
-{
- g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL);
- return terminal->adjustment;
-}
-
-/**
* vte_terminal_get_char_width:
* @terminal: a #VteTerminal
*
@@ -14385,7 +12970,7 @@ vte_terminal_get_char_width(VteTerminal *terminal)
{
g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1);
vte_terminal_ensure_font (terminal);
- return terminal->char_width;
+ return terminal->pvt->char_width;
}
/**
@@ -14399,43 +12984,7 @@ vte_terminal_get_char_height(VteTerminal *terminal)
{
g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1);
vte_terminal_ensure_font (terminal);
- return terminal->char_height;
-}
-
-/**
- * vte_terminal_get_char_descent:
- * @terminal: a #VteTerminal
- *
- * An accessor function provided for the benefit of language bindings.
- *
- * Returns: the contents of @terminal's char_descent field
- *
- * Deprecated: 0.20
- */
-glong
-vte_terminal_get_char_descent(VteTerminal *terminal)
-{
- g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1);
- vte_terminal_ensure_font (terminal);
- return terminal->char_descent;
-}
-
-/**
- * vte_terminal_get_char_ascent:
- * @terminal: a #VteTerminal
- *
- * An accessor function provided for the benefit of language bindings.
- *
- * Returns: the contents of @terminal's char_ascent field
- *
- * Deprecated: 0.20
- */
-glong
-vte_terminal_get_char_ascent(VteTerminal *terminal)
-{
- g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1);
- vte_terminal_ensure_font (terminal);
- return terminal->char_ascent;
+ return terminal->pvt->char_height;
}
/**
@@ -14449,7 +12998,7 @@ glong
vte_terminal_get_row_count(VteTerminal *terminal)
{
g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1);
- return terminal->row_count;
+ return terminal->pvt->row_count;
}
/**
@@ -14462,7 +13011,7 @@ glong
vte_terminal_get_column_count(VteTerminal *terminal)
{
g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1);
- return terminal->column_count;
+ return terminal->pvt->column_count;
}
/**
@@ -14475,7 +13024,7 @@ const char *
vte_terminal_get_window_title(VteTerminal *terminal)
{
g_return_val_if_fail(VTE_IS_TERMINAL(terminal), "");
- return terminal->window_title;
+ return terminal->pvt->window_title;
}
/**
@@ -14488,41 +13037,44 @@ const char *
vte_terminal_get_icon_title(VteTerminal *terminal)
{
g_return_val_if_fail(VTE_IS_TERMINAL(terminal), "");
- return terminal->icon_title;
+ return terminal->pvt->icon_title;
}
/**
- * vte_terminal_set_pty:
+ * vte_terminal_get_current_directory_uri:
* @terminal: a #VteTerminal
- * @pty_master: a file descriptor of the master end of a PTY, or %-1
- *
- * Attach an existing PTY master side to the terminal widget. Use
- * instead of vte_terminal_fork_command() or vte_terminal_forkpty().
*
- * Since: 0.12.1
+ * Returns: (transfer none): the URI of the current directory of the
+ * process running in the terminal, or %NULL
*
- * Deprecated: 0.26: Use vte_pty_new_foreign() and vte_terminal_set_pty_object()
+ * Since: 0.34
*/
-void
-vte_terminal_set_pty(VteTerminal *terminal, int pty_master)
+const char *
+vte_terminal_get_current_directory_uri(VteTerminal *terminal)
{
- VtePty *pty;
-
- if (pty_master == -1) {
- vte_terminal_set_pty_object(terminal, NULL);
- return;
- }
-
- pty = vte_pty_new_foreign(pty_master, NULL);
- if (pty == NULL)
- return;
+ g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL);
+ return terminal->pvt->current_directory_uri;
+}
- vte_terminal_set_pty_object(terminal, pty);
- g_object_unref(pty);
+/**
+ * vte_terminal_get_current_file_uri:
+ * @terminal: a #VteTerminal
+ *
+ * Returns: (transfer none): the URI of the current file the
+ * process running in the terminal is operating on, or %NULL if
+ * not set
+ *
+ * Since: 0.34
+ */
+const char *
+vte_terminal_get_current_file_uri(VteTerminal *terminal)
+{
+ g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL);
+ return terminal->pvt->current_file_uri;
}
/**
- * vte_terminal_set_pty_object:
+ * vte_terminal_set_pty:
* @terminal: a #VteTerminal
* @pty: (allow-none): a #VtePty, or %NULL
*
@@ -14532,7 +13084,7 @@ vte_terminal_set_pty(VteTerminal *terminal, int pty_master)
* Since: 0.26.
*/
void
-vte_terminal_set_pty_object(VteTerminal *terminal,
+vte_terminal_set_pty(VteTerminal *terminal,
VtePty *pty)
{
VteTerminalPrivate *pvt;
@@ -14573,7 +13125,7 @@ vte_terminal_set_pty_object(VteTerminal *terminal,
vte_terminal_stop_processing (terminal);
/* Clear the outgoing buffer as well. */
- _vte_buffer_clear(terminal->pvt->outgoing);
+ _vte_byte_array_clear(terminal->pvt->outgoing);
vte_pty_close(pvt->pty);
g_object_unref(pvt->pty);
@@ -14583,7 +13135,6 @@ vte_terminal_set_pty_object(VteTerminal *terminal,
if (pty == NULL) {
pvt->pty = NULL;
g_object_notify(object, "pty");
- g_object_notify(object, "pty-object");
g_object_thaw_notify(object);
return;
}
@@ -14602,8 +13153,8 @@ vte_terminal_set_pty_object(VteTerminal *terminal,
}
vte_terminal_set_size(terminal,
- terminal->column_count,
- terminal->row_count);
+ terminal->pvt->column_count,
+ terminal->pvt->row_count);
_vte_terminal_setup_utf8 (terminal);
@@ -14611,7 +13162,6 @@ vte_terminal_set_pty_object(VteTerminal *terminal,
_vte_terminal_connect_pty_read (terminal);
g_object_notify(object, "pty");
- g_object_notify(object, "pty-object");
g_object_thaw_notify(object);
}
@@ -14620,32 +13170,6 @@ vte_terminal_set_pty_object(VteTerminal *terminal,
* vte_terminal_get_pty:
* @terminal: a #VteTerminal
*
- * Returns the file descriptor of the master end of @terminal's PTY.
- *
- * Return value: the file descriptor, or -1 if the terminal has no PTY.
- *
- * Since: 0.20
- *
- * Deprecated: 0.26: Use vte_terminal_get_pty_object() and vte_pty_get_fd()
- */
-int
-vte_terminal_get_pty(VteTerminal *terminal)
-{
- VteTerminalPrivate *pvt;
-
- g_return_val_if_fail (VTE_IS_TERMINAL (terminal), -1);
-
- pvt = terminal->pvt;
- if (pvt->pty != NULL)
- return vte_pty_get_fd(pvt->pty);
-
- return -1;
-}
-
-/**
- * vte_terminal_get_pty_object:
- * @terminal: a #VteTerminal
- *
* Returns the #VtePty of @terminal.
*
* Returns: (transfer none): a #VtePty, or %NULL
@@ -14653,35 +13177,13 @@ vte_terminal_get_pty(VteTerminal *terminal)
* Since: 0.26
*/
VtePty *
-vte_terminal_get_pty_object(VteTerminal *terminal)
+vte_terminal_get_pty(VteTerminal *terminal)
{
g_return_val_if_fail (VTE_IS_TERMINAL (terminal), NULL);
return terminal->pvt->pty;
}
-/**
- * vte_terminal_get_child_exit_status:
- * @terminal: a #VteTerminal
- *
- * Gets the exit status of the command started by vte_terminal_fork_command().
- * See your C library's documentation for more details on how to interpret the
- * exit status.
- *
- * Note that this function may only be called from the signal handler of
- * the #VteTerminal::child-exited signal.
- *
- * Returns: the child's exit status
- *
- * Since: 0.20
- */
-int
-vte_terminal_get_child_exit_status(VteTerminal *terminal)
-{
- g_return_val_if_fail(VTE_IS_TERMINAL(terminal), -1);
- return terminal->pvt->child_exit_status;
-}
-
/* We need this bit of glue to ensure that accessible objects will always
* get signals. */
void
@@ -14806,7 +13308,7 @@ reset_update_regions (VteTerminal *terminal)
{
if (terminal->pvt->update_regions != NULL) {
g_slist_foreach (terminal->pvt->update_regions,
- (GFunc)gdk_region_destroy, NULL);
+ (GFunc)cairo_region_destroy, NULL);
g_slist_free (terminal->pvt->update_regions);
terminal->pvt->update_regions = NULL;
}
@@ -14912,6 +13414,22 @@ vte_terminal_emit_window_title_changed(VteTerminal *terminal)
}
static void
+vte_terminal_emit_current_directory_uri_changed(VteTerminal *terminal)
+{
+ _vte_debug_print(VTE_DEBUG_SIGNALS,
+ "Emitting `current-directory-uri-changed'.\n");
+ g_signal_emit_by_name(terminal, "current-directory-uri-changed");
+}
+
+static void
+vte_terminal_emit_current_file_uri_changed(VteTerminal *terminal)
+{
+ _vte_debug_print(VTE_DEBUG_SIGNALS,
+ "Emitting `current-file-uri-changed'.\n");
+ g_signal_emit_by_name(terminal, "current-file-uri-changed");
+}
+
+static void
vte_terminal_emit_pending_signals(VteTerminal *terminal)
{
GObject *object;
@@ -14930,27 +13448,45 @@ vte_terminal_emit_pending_signals(VteTerminal *terminal)
}
if (terminal->pvt->window_title_changed) {
- g_free (terminal->window_title);
- terminal->window_title = terminal->pvt->window_title_changed;
+ g_free (terminal->pvt->window_title);
+ terminal->pvt->window_title = terminal->pvt->window_title_changed;
terminal->pvt->window_title_changed = NULL;
if (window)
- gdk_window_set_title (window, terminal->window_title);
+ gdk_window_set_title (window, terminal->pvt->window_title);
vte_terminal_emit_window_title_changed(terminal);
g_object_notify(object, "window-title");
}
if (terminal->pvt->icon_title_changed) {
- g_free (terminal->icon_title);
- terminal->icon_title = terminal->pvt->icon_title_changed;
+ g_free (terminal->pvt->icon_title);
+ terminal->pvt->icon_title = terminal->pvt->icon_title_changed;
terminal->pvt->icon_title_changed = NULL;
if (window)
- gdk_window_set_icon_name (window, terminal->icon_title);
+ gdk_window_set_icon_name (window, terminal->pvt->icon_title);
vte_terminal_emit_icon_title_changed(terminal);
g_object_notify(object, "icon-title");
}
+ if (terminal->pvt->current_directory_uri_changed) {
+ g_free (terminal->pvt->current_directory_uri);
+ terminal->pvt->current_directory_uri = terminal->pvt->current_directory_uri_changed;
+ terminal->pvt->current_directory_uri_changed = NULL;
+
+ vte_terminal_emit_current_directory_uri_changed(terminal);
+ g_object_notify(object, "current-directory-uri");
+ }
+
+ if (terminal->pvt->current_file_uri_changed) {
+ g_free (terminal->pvt->current_file_uri);
+ terminal->pvt->current_file_uri = terminal->pvt->current_file_uri_changed;
+ terminal->pvt->current_file_uri_changed = NULL;
+
+ vte_terminal_emit_current_file_uri_changed(terminal);
+ g_object_notify(object, "current-file-uri");
+ }
+
/* Flush any pending "inserted" signals. */
vte_terminal_emit_cursor_moved(terminal);
vte_terminal_emit_pending_text_signals(terminal, 0);
@@ -14981,7 +13517,9 @@ process_timeout (gpointer data)
GList *l, *next;
gboolean again;
- GDK_THREADS_ENTER();
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ gdk_threads_enter();
+ G_GNUC_END_IGNORE_DEPRECATIONS;
in_process_timeout = TRUE;
@@ -15043,7 +13581,9 @@ process_timeout (gpointer data)
in_process_timeout = FALSE;
- GDK_THREADS_LEAVE();
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ gdk_threads_leave();
+ G_GNUC_END_IGNORE_DEPRECATIONS;
if (again) {
/* Force us to relinquish the CPU as the child is running
@@ -15063,11 +13603,12 @@ static gboolean
update_regions (VteTerminal *terminal)
{
GSList *l;
- GdkRegion *region;
+ cairo_region_t *region;
GdkWindow *window;
- if (G_UNLIKELY (! gtk_widget_is_drawable (&terminal->widget)
- || terminal->pvt->visibility_state == GDK_VISIBILITY_FULLY_OBSCURED)) {
+ if (G_UNLIKELY(!gtk_widget_get_realized(&terminal->widget)))
+ return FALSE;
+ if (terminal->pvt->visibility_state == GDK_VISIBILITY_FULLY_OBSCURED) {
reset_update_regions (terminal);
return FALSE;
}
@@ -15079,10 +13620,10 @@ update_regions (VteTerminal *terminal)
l = terminal->pvt->update_regions;
if (g_slist_next (l) != NULL) {
/* amalgamate into one super-region */
- region = gdk_region_new ();
+ region = cairo_region_create ();
do {
- gdk_region_union (region, l->data);
- gdk_region_destroy (l->data);
+ cairo_region_union (region, l->data);
+ cairo_region_destroy (l->data);
} while ((l = g_slist_next (l)) != NULL);
} else {
region = l->data;
@@ -15095,7 +13636,7 @@ update_regions (VteTerminal *terminal)
window = gtk_widget_get_window (&terminal->widget);
gdk_window_invalidate_region (window, region, FALSE);
gdk_window_process_updates (window, FALSE);
- gdk_region_destroy (region);
+ cairo_region_destroy (region);
_vte_debug_print (VTE_DEBUG_WORK, "-");
@@ -15108,7 +13649,9 @@ update_repeat_timeout (gpointer data)
GList *l, *next;
gboolean again;
- GDK_THREADS_ENTER();
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ gdk_threads_enter();
+ G_GNUC_END_IGNORE_DEPRECATIONS;
in_update_timeout = TRUE;
@@ -15134,9 +13677,6 @@ update_repeat_timeout (gpointer data)
}
_vte_terminal_enable_input_source (terminal);
}
- if (terminal->pvt->bg_update_pending) {
- vte_terminal_background_update (terminal);
- }
vte_terminal_emit_adjustment_changed (terminal);
if (need_processing (terminal)) {
if (VTE_MAX_PROCESS_TIME) {
@@ -15184,7 +13724,9 @@ update_repeat_timeout (gpointer data)
in_update_timeout = FALSE;
- GDK_THREADS_LEAVE();
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ gdk_threads_leave();
+ G_GNUC_END_IGNORE_DEPRECATIONS;
if (again) {
/* Force us to relinquish the CPU as the child is running
@@ -15205,7 +13747,9 @@ update_timeout (gpointer data)
GList *l, *next;
gboolean redraw = FALSE;
- GDK_THREADS_ENTER();
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ gdk_threads_enter();
+ G_GNUC_END_IGNORE_DEPRECATIONS;
in_update_timeout = TRUE;
@@ -15238,9 +13782,6 @@ update_timeout (gpointer data)
}
_vte_terminal_enable_input_source (terminal);
}
- if (terminal->pvt->bg_update_pending) {
- vte_terminal_background_update (terminal);
- }
vte_terminal_emit_adjustment_changed (terminal);
if (need_processing (terminal)) {
if (VTE_MAX_PROCESS_TIME) {
@@ -15273,7 +13814,9 @@ update_timeout (gpointer data)
NULL);
in_update_timeout = FALSE;
- GDK_THREADS_LEAVE();
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ gdk_threads_leave();
+ G_GNUC_END_IGNORE_DEPRECATIONS;
return FALSE;
}
@@ -15282,7 +13825,7 @@ update_timeout (gpointer data)
* vte_terminal_write_contents:
* @terminal: a #VteTerminal
* @stream: a #GOutputStream to write to
- * @flags: a set of #VteTerminalWriteFlags
+ * @flags: a set of #VteWriteFlags
* @cancellable: (allow-none): a #GCancellable object, or %NULL
* @error: (allow-none): a #GError location to store the error occuring, or %NULL
*
@@ -15304,7 +13847,7 @@ update_timeout (gpointer data)
gboolean
vte_terminal_write_contents (VteTerminal *terminal,
GOutputStream *stream,
- VteTerminalWriteFlags flags,
+ VteWriteFlags flags,
GCancellable *cancellable,
GError **error)
{
@@ -15326,6 +13869,7 @@ vte_terminal_write_contents (VteTerminal *terminal,
* vte_terminal_search_set_gregex:
* @terminal: a #VteTerminal
* @regex: (allow-none): a #GRegex, or %NULL
+ * @flags: flags from #GRegexMatchFlags
*
* Sets the #GRegex regex to search for. Unsets the search regex when passed %NULL.
*
@@ -15333,7 +13877,8 @@ vte_terminal_write_contents (VteTerminal *terminal,
*/
void
vte_terminal_search_set_gregex (VteTerminal *terminal,
- GRegex *regex)
+ GRegex *regex,
+ GRegexMatchFlags flags)
{
g_return_if_fail(VTE_IS_TERMINAL(terminal));
@@ -15347,6 +13892,7 @@ vte_terminal_search_set_gregex (VteTerminal *terminal,
if (regex)
terminal->pvt->search_regex = g_regex_ref (regex);
+ terminal->pvt->search_match_flags = flags;
_vte_invalidate_all (terminal);
}
@@ -15423,7 +13969,9 @@ vte_terminal_search_rows (VteTerminal *terminal,
row_text = vte_terminal_get_text_range (terminal, start_row, 0, end_row, -1, NULL, NULL, NULL);
- g_regex_match_full (pvt->search_regex, row_text, -1, 0, G_REGEX_MATCH_NOTEMPTY, &match_info, &error);
+ g_regex_match_full (pvt->search_regex, row_text, -1, 0,
+ pvt->search_match_flags | G_REGEX_MATCH_NOTEMPTY,
+ &match_info, &error);
if (error) {
g_printerr ("Error while matching: %s\n", error->message);
g_error_free (error);
@@ -15463,8 +14011,8 @@ vte_terminal_search_rows (VteTerminal *terminal,
_vte_terminal_select_text (terminal, start_col, start_row, end_col, end_row, 0, 0);
/* Quite possibly the math here should not access adjustment directly... */
- value = gtk_adjustment_get_value(terminal->adjustment);
- page_size = gtk_adjustment_get_page_size(terminal->adjustment);
+ value = gtk_adjustment_get_value(terminal->pvt->vadjustment);
+ page_size = gtk_adjustment_get_page_size(terminal->pvt->vadjustment);
if (backward) {
if (end_row < value || end_row >= value + page_size)
vte_terminal_queue_adjustment_value_changed_clamped (terminal, end_row - page_size + 1);
@@ -15542,7 +14090,7 @@ vte_terminal_search_find (VteTerminal *terminal,
last_start_row = pvt->selection_start.row;
last_end_row = pvt->selection_end.row + 1;
} else {
- last_start_row = pvt->screen->scroll_delta + terminal->row_count;
+ last_start_row = pvt->screen->scroll_delta + terminal->pvt->row_count;
last_end_row = pvt->screen->scroll_delta;
}
last_start_row = MAX (buffer_start_row, last_start_row);
@@ -15620,3 +14168,79 @@ vte_terminal_search_find_next (VteTerminal *terminal)
{
return vte_terminal_search_find (terminal, FALSE);
}
+
+/* Just some arbitrary minimum values */
+#define MIN_COLUMNS (16)
+#define MIN_ROWS (2)
+
+/**
+ * vte_terminal_get_geometry_hints:
+ * @terminal: a #VteTerminal
+ * @hints: (out caller-allocates): a #GdkGeometry to fill in
+ * @min_rows: the minimum number of rows to request
+ * @min_columns: the minimum number of columns to request
+ *
+ * Fills in some @hints from @terminal's geometry. The hints
+ * filled are those covered by the %GDK_HINT_RESIZE_INC,
+ * %GDK_HINT_MIN_SIZE and %GDK_HINT_BASE_SIZE flags.
+ *
+ * See gtk_window_set_geometry_hints() for more information.
+ *
+ * @terminal must be realized (see gtk_widget_get_realized()).
+ */
+void
+vte_terminal_get_geometry_hints(VteTerminal *terminal,
+ GdkGeometry *hints,
+ int min_rows,
+ int min_columns)
+{
+ VteTerminalPrivate *pvt;
+ GtkWidget *widget;
+ GtkBorder padding;
+
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
+ g_return_if_fail(hints != NULL);
+ widget = &terminal->widget;
+ g_return_if_fail(gtk_widget_get_realized(widget));
+
+ pvt = terminal->pvt;
+
+ gtk_style_context_get_padding(gtk_widget_get_style_context(widget),
+ gtk_widget_get_state_flags(widget),
+ &padding);
+
+ hints->base_width = padding.left + padding.right;
+ hints->base_height = padding.top + padding.bottom;
+ hints->width_inc = pvt->char_width;
+ hints->height_inc = pvt->char_height;
+ hints->min_width = hints->base_width + hints->width_inc * min_columns;
+ hints->min_height = hints->base_height + hints->height_inc * min_rows;
+}
+
+/**
+ * vte_terminal_set_geometry_hints_for_window:
+ * @terminal: a #VteTerminal
+ * @window: a #GtkWindow
+ *
+ * Sets @terminal as @window's geometry widget. See
+ * gtk_window_set_geometry_hints() for more information.
+ *
+ * @terminal must be realized (see gtk_widget_get_realized()).
+ */
+void
+vte_terminal_set_geometry_hints_for_window(VteTerminal *terminal,
+ GtkWindow *window)
+{
+ GdkGeometry hints;
+
+ g_return_if_fail(VTE_IS_TERMINAL(terminal));
+ g_return_if_fail(gtk_widget_get_realized(&terminal->widget));
+
+ vte_terminal_get_geometry_hints(terminal, &hints, MIN_ROWS, MIN_COLUMNS);
+ gtk_window_set_geometry_hints(window,
+ &terminal->widget,
+ &hints,
+ GDK_HINT_RESIZE_INC |
+ GDK_HINT_MIN_SIZE |
+ GDK_HINT_BASE_SIZE);
+}
diff --git a/src/vte.gresource.xml.in b/src/vte.gresource.xml.in
new file mode 100644
index 00000000..1c39baff
--- /dev/null
+++ b/src/vte.gresource.xml.in
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright © 2012 Christian Persch
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1, or (at your option)
+ any later version.
+
+ This program is distributed in the hope 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 General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+-->
+<gresources>
+ <gresource prefix="/org/gnome/vte/@VTE_API_VERSION@/termcap">
+ <file alias="xterm">@top_srcdir@/termcaps/xterm</file>
+ </gresource>
+</gresources>
diff --git a/src/vte.h b/src/vte.h
index 98714c58..abd7be94 100644
--- a/src/vte.h
+++ b/src/vte.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2001,2002,2003,2009,2010 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef vte_vte_h_included
@@ -34,18 +34,6 @@
G_BEGIN_DECLS
-#ifdef VTE_SEAL_ENABLE
-#define _VTE_SEAL(name) _vte_sealed__ ## name
-#else
-#define _VTE_SEAL(name) name
-#endif
-
-#ifdef VTE_DISABLE_DEPRECATED
-#define _VTE_DEPRECATED(name) _vte_deprecated__ ## name
-#else
-#define _VTE_DEPRECATED(name) name
-#endif
-
#define VTE_TYPE_TERMINAL (vte_terminal_get_type())
#define VTE_TERMINAL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VTE_TYPE_TERMINAL, VteTerminal))
#define VTE_TERMINAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VTE_TYPE_TERMINAL, VteTerminalClass))
@@ -57,27 +45,14 @@ typedef struct _VteTerminal VteTerminal;
typedef struct _VteTerminalPrivate VteTerminalPrivate;
typedef struct _VteTerminalClass VteTerminalClass;
typedef struct _VteTerminalClassPrivate VteTerminalClassPrivate;
+typedef struct _VteCharAttributes VteCharAttributes;
/**
* VteTerminal:
- *
- * All of these fields should be considered read-only and deprecated.
*/
struct _VteTerminal {
GtkWidget widget;
/*< private >*/
- GtkAdjustment *_VTE_SEAL(adjustment); /* Scrolling adjustment. */
-
- /* Metric and sizing data. */
- glong _VTE_SEAL(char_width), _VTE_SEAL(char_height); /* dimensions of character cells */
- glong _VTE_SEAL(char_ascent), _VTE_SEAL(char_descent); /* important font metrics */
- glong _VTE_SEAL(row_count), _VTE_SEAL(column_count); /* dimensions of the window */
-
- /* Titles. */
- char *_VTE_SEAL(window_title);
- char *_VTE_SEAL(icon_title);
-
- /*< private >*/
VteTerminalPrivate *pvt;
};
@@ -94,7 +69,7 @@ struct _VteTerminalClass {
/*< protected > */
/* Default signal handlers. */
void (*eof)(VteTerminal* terminal);
- void (*child_exited)(VteTerminal* terminal);
+ void (*child_exited)(VteTerminal* terminal, int status);
void (*emulation_changed)(VteTerminal* terminal);
void (*encoding_changed)(VteTerminal* terminal);
void (*char_size_changed)(VteTerminal* terminal, guint char_width, guint char_height);
@@ -116,6 +91,9 @@ struct _VteTerminalClass {
void (*resize_window)(VteTerminal* terminal, guint width, guint height);
void (*move_window)(VteTerminal* terminal, guint x, guint y);
+ /* FIXMEchpe: should these return gboolean and have defaul thandlers
+ * settings the "scale" property?
+ */
void (*increase_font_size)(VteTerminal* terminal);
void (*decrease_font_size)(VteTerminal* terminal);
@@ -126,66 +104,16 @@ struct _VteTerminalClass {
void (*copy_clipboard)(VteTerminal* terminal);
void (*paste_clipboard)(VteTerminal* terminal);
-#if !GTK_CHECK_VERSION (2, 91, 2)
- void (* set_scroll_adjustments) (GtkWidget *widget,
- GtkAdjustment *hadjustment,
- GtkAdjustment *vadjustment);
-#endif
-
void (*beep)(VteTerminal* terminal);
-#if GTK_CHECK_VERSION (2, 99, 0)
/* Padding for future expansion. */
gpointer padding[16];
-#else
- /* Padding for future expansion. */
- void (*vte_reserved3)(void);
- void (*vte_reserved4)(void);
-
- /*< private > */
- /* Signals we might emit. */
- guint _VTE_DEPRECATED(eof_signal);
- guint _VTE_DEPRECATED(child_exited_signal);
- guint _VTE_DEPRECATED(emulation_changed_signal);
- guint _VTE_DEPRECATED(encoding_changed_signal);
- guint _VTE_DEPRECATED(char_size_changed_signal);
- guint _VTE_DEPRECATED(window_title_changed_signal);
- guint _VTE_DEPRECATED(icon_title_changed_signal);
- guint _VTE_DEPRECATED(selection_changed_signal);
- guint _VTE_DEPRECATED(contents_changed_signal);
- guint _VTE_DEPRECATED(cursor_moved_signal);
- guint _VTE_DEPRECATED(status_line_changed_signal);
- guint _VTE_DEPRECATED(commit_signal);
- guint _VTE_DEPRECATED(deiconify_window_signal);
- guint _VTE_DEPRECATED(iconify_window_signal);
- guint _VTE_DEPRECATED(raise_window_signal);
- guint _VTE_DEPRECATED(lower_window_signal);
- guint _VTE_DEPRECATED(refresh_window_signal);
- guint _VTE_DEPRECATED(restore_window_signal);
- guint _VTE_DEPRECATED(maximize_window_signal);
- guint _VTE_DEPRECATED(resize_window_signal);
- guint _VTE_DEPRECATED(move_window_signal);
- guint _VTE_DEPRECATED(increase_font_size_signal);
- guint _VTE_DEPRECATED(decrease_font_size_signal);
- guint _VTE_DEPRECATED(text_modified_signal);
- guint _VTE_DEPRECATED(text_inserted_signal);
- guint _VTE_DEPRECATED(text_deleted_signal);
- guint _VTE_DEPRECATED(text_scrolled_signal);
- guint _VTE_DEPRECATED(reserved1);
- guint _VTE_DEPRECATED(reserved2);
- guint _VTE_DEPRECATED(reserved3);
- guint _VTE_DEPRECATED(reserved4);
- guint _VTE_DEPRECATED(reserved5);
- guint _VTE_DEPRECATED(reserved6);
-#endif
-#if GTK_CHECK_VERSION (2, 99, 0)
VteTerminalClassPrivate *priv;
-#endif
};
/**
- * VteTerminalEraseBinding:
+ * VteEraseBinding:
* @VTE_ERASE_AUTO: For backspace, attempt to determine the right value from the terminal's IO settings. For delete, use the control sequence.
* @VTE_ERASE_ASCII_BACKSPACE: Send an ASCII backspace character (0x08).
* @VTE_ERASE_ASCII_DELETE: Send an ASCII delete character (0x7F).
@@ -202,10 +130,10 @@ typedef enum {
VTE_ERASE_ASCII_DELETE,
VTE_ERASE_DELETE_SEQUENCE,
VTE_ERASE_TTY
-} VteTerminalEraseBinding;
+} VteEraseBinding;
/**
- * VteTerminalCursorBlinkMode:
+ * VteCursorBlinkMode:
* @VTE_CURSOR_BLINK_SYSTEM: Follow GTK+ settings for cursor blinking.
* @VTE_CURSOR_BLINK_ON: Cursor blinks.
* @VTE_CURSOR_BLINK_OFF: Cursor does not blink.
@@ -217,10 +145,10 @@ typedef enum {
VTE_CURSOR_BLINK_SYSTEM,
VTE_CURSOR_BLINK_ON,
VTE_CURSOR_BLINK_OFF
-} VteTerminalCursorBlinkMode;
+} VteCursorBlinkMode;
/**
- * VteTerminalCursorShape:
+ * VteCursorShape:
* @VTE_CURSOR_SHAPE_BLOCK: Draw a block cursor. This is the default.
* @VTE_CURSOR_SHAPE_IBEAM: Draw a vertical bar on the left side of character.
* This is similar to the default cursor for other GTK+ widgets.
@@ -233,22 +161,14 @@ typedef enum {
VTE_CURSOR_SHAPE_BLOCK,
VTE_CURSOR_SHAPE_IBEAM,
VTE_CURSOR_SHAPE_UNDERLINE
-} VteTerminalCursorShape;
+} VteCursorShape;
/* The structure we return as the supplemental attributes for strings. */
-struct _VteCharAttributes {
- /*< private >*/
- long row, column;
- GdkColor fore, back;
- guint underline:1, strikethrough:1;
-};
typedef struct _VteCharAttributes VteCharAttributes;
-
-/* The name of the same structure in the 0.10 series, for API compatibility. */
-struct vte_char_attributes {
+struct _VteCharAttributes {
/*< private >*/
long row, column;
- GdkColor fore, back;
+ PangoColor fore, back;
guint underline:1, strikethrough:1;
};
@@ -262,23 +182,25 @@ GType vte_terminal_get_type(void);
GtkWidget *vte_terminal_new(void);
-VtePty *vte_terminal_pty_new (VteTerminal *terminal,
- VtePtyFlags flags,
- GError **error);
+VtePty *vte_terminal_pty_new_sync (VteTerminal *terminal,
+ VtePtyFlags flags,
+ GCancellable *cancellable,
+ GError **error);
void vte_terminal_watch_child (VteTerminal *terminal,
GPid child_pid);
-gboolean vte_terminal_fork_command_full(VteTerminal *terminal,
- VtePtyFlags pty_flags,
- const char *working_directory,
- char **argv,
- char **envv,
- GSpawnFlags spawn_flags,
- GSpawnChildSetupFunc child_setup,
- gpointer child_setup_data,
- GPid *child_pid /* out */,
- GError **error);
+gboolean vte_terminal_spawn_sync(VteTerminal *terminal,
+ VtePtyFlags pty_flags,
+ const char *working_directory,
+ char **argv,
+ char **envv,
+ GSpawnFlags spawn_flags,
+ GSpawnChildSetupFunc child_setup,
+ gpointer child_setup_data,
+ GPid *child_pid /* out */,
+ GCancellable *cancellable,
+ GError **error);
/* Send data to the terminal to display, or to the terminal's forked command
* to handle in some way. If it's 'cat', they should be the same. */
@@ -293,44 +215,29 @@ void vte_terminal_paste_clipboard(VteTerminal *terminal);
void vte_terminal_copy_primary(VteTerminal *terminal);
void vte_terminal_paste_primary(VteTerminal *terminal);
-/* simple manipulation of selection */
void vte_terminal_select_all(VteTerminal *terminal);
-void vte_terminal_select_none(VteTerminal *terminal);
+void vte_terminal_unselect_all(VteTerminal *terminal);
/* Set the terminal's size. */
void vte_terminal_set_size(VteTerminal *terminal,
glong columns, glong rows);
+void vte_terminal_set_font_scale(VteTerminal *terminal,
+ gdouble scale);
+gdouble vte_terminal_get_font_scale(VteTerminal *terminal);
+
/* Set various on-off settings. */
void vte_terminal_set_audible_bell(VteTerminal *terminal, gboolean is_audible);
gboolean vte_terminal_get_audible_bell(VteTerminal *terminal);
void vte_terminal_set_visible_bell(VteTerminal *terminal, gboolean is_visible);
gboolean vte_terminal_get_visible_bell(VteTerminal *terminal);
-void vte_terminal_set_scroll_background(VteTerminal *terminal, gboolean scroll);
void vte_terminal_set_scroll_on_output(VteTerminal *terminal, gboolean scroll);
void vte_terminal_set_scroll_on_keystroke(VteTerminal *terminal,
gboolean scroll);
+void vte_terminal_set_rewrap_on_resize(VteTerminal *terminal, gboolean rewrap);
+gboolean vte_terminal_get_rewrap_on_resize(VteTerminal *terminal);
/* Set the color scheme. */
-void vte_terminal_set_color_dim(VteTerminal *terminal,
- const GdkColor *dim);
-void vte_terminal_set_color_bold(VteTerminal *terminal,
- const GdkColor *bold);
-void vte_terminal_set_color_foreground(VteTerminal *terminal,
- const GdkColor *foreground);
-void vte_terminal_set_color_background(VteTerminal *terminal,
- const GdkColor *background);
-void vte_terminal_set_color_cursor(VteTerminal *terminal,
- const GdkColor *cursor_background);
-void vte_terminal_set_color_highlight(VteTerminal *terminal,
- const GdkColor *highlight_background);
-void vte_terminal_set_colors(VteTerminal *terminal,
- const GdkColor *foreground,
- const GdkColor *background,
- const GdkColor *palette,
- glong palette_size);
-
-#if GTK_CHECK_VERSION (2, 99, 0)
void vte_terminal_set_color_bold_rgba(VteTerminal *terminal,
const GdkRGBA *bold);
void vte_terminal_set_color_dim_rgba(VteTerminal *terminal,
@@ -343,48 +250,32 @@ void vte_terminal_set_color_cursor_rgba(VteTerminal *terminal,
const GdkRGBA *cursor_background);
void vte_terminal_set_color_highlight_rgba(VteTerminal *terminal,
const GdkRGBA *highlight_background);
+void vte_terminal_set_color_highlight_foreground_rgba(VteTerminal *terminal,
+ const GdkRGBA *highlight_foreground);
void vte_terminal_set_colors_rgba(VteTerminal *terminal,
const GdkRGBA *foreground,
const GdkRGBA *background,
const GdkRGBA *palette,
gsize palette_size);
-#endif
void vte_terminal_set_default_colors(VteTerminal *terminal);
-/* Background effects. */
-void vte_terminal_set_background_image(VteTerminal *terminal, GdkPixbuf *image);
-void vte_terminal_set_background_image_file(VteTerminal *terminal,
- const char *path);
-void vte_terminal_set_background_tint_color(VteTerminal *terminal,
- const GdkColor *color);
-void vte_terminal_set_background_saturation(VteTerminal *terminal,
- double saturation);
-void vte_terminal_set_background_transparent(VteTerminal *terminal,
- gboolean transparent);
-void vte_terminal_set_opacity(VteTerminal *terminal, guint16 opacity);
-
/* Set whether or not the cursor blinks. */
void vte_terminal_set_cursor_blink_mode(VteTerminal *terminal,
- VteTerminalCursorBlinkMode mode);
-VteTerminalCursorBlinkMode vte_terminal_get_cursor_blink_mode(VteTerminal *terminal);
+ VteCursorBlinkMode mode);
+VteCursorBlinkMode vte_terminal_get_cursor_blink_mode(VteTerminal *terminal);
/* Set cursor shape */
void vte_terminal_set_cursor_shape(VteTerminal *terminal,
- VteTerminalCursorShape shape);
-VteTerminalCursorShape vte_terminal_get_cursor_shape(VteTerminal *terminal);
+ VteCursorShape shape);
+VteCursorShape vte_terminal_get_cursor_shape(VteTerminal *terminal);
/* Set the number of scrollback lines, above or at an internal minimum. */
void vte_terminal_set_scrollback_lines(VteTerminal *terminal, glong lines);
-/* Append the input method menu items to a given shell. */
-void vte_terminal_im_append_menuitems(VteTerminal *terminal,
- GtkMenuShell *menushell);
-
/* Set or retrieve the current font. */
void vte_terminal_set_font(VteTerminal *terminal,
const PangoFontDescription *font_desc);
-void vte_terminal_set_font_from_string(VteTerminal *terminal, const char *name);
const PangoFontDescription *vte_terminal_get_font(VteTerminal *terminal);
void vte_terminal_set_allow_bold(VteTerminal *terminal, gboolean allow_bold);
gboolean vte_terminal_get_allow_bold(VteTerminal *terminal);
@@ -392,17 +283,11 @@ gboolean vte_terminal_get_allow_bold(VteTerminal *terminal);
/* Check if the terminal is the current selection owner. */
gboolean vte_terminal_get_has_selection(VteTerminal *terminal);
-/* Set the list of word chars, optionally using hyphens to specify ranges
- * (to get a hyphen, place it first), and check if a character is in the
- * range. */
-void vte_terminal_set_word_chars(VteTerminal *terminal, const char *spec);
-gboolean vte_terminal_is_word_char(VteTerminal *terminal, gunichar c);
-
/* Set what happens when the user strikes backspace or delete. */
void vte_terminal_set_backspace_binding(VteTerminal *terminal,
- VteTerminalEraseBinding binding);
+ VteEraseBinding binding);
void vte_terminal_set_delete_binding(VteTerminal *terminal,
- VteTerminalEraseBinding binding);
+ VteEraseBinding binding);
/* Manipulate the autohide setting. */
void vte_terminal_set_mouse_autohide(VteTerminal *terminal, gboolean setting);
@@ -438,8 +323,6 @@ char *vte_terminal_attributes_to_html(VteTerminal *terminal,
GArray *attributes);
void vte_terminal_get_cursor_position(VteTerminal *terminal,
glong *column, glong *row);
-/* Display string matching: clear all matching expressions. */
-void vte_terminal_match_clear_all(VteTerminal *terminal);
/* Add a matching expression, returning the tag the widget assigns to that
* expression. */
@@ -451,8 +334,8 @@ void vte_terminal_match_set_cursor_type(VteTerminal *terminal,
int tag, GdkCursorType cursor_type);
void vte_terminal_match_set_cursor_name(VteTerminal *terminal,
int tag, const char *cursor_name);
-/* Remove a matching expression by tag. */
void vte_terminal_match_remove(VteTerminal *terminal, int tag);
+void vte_terminal_match_remove_all(VteTerminal *terminal);
/* Check if a given cell on the screen contains part of a matched string. If
* it does, return the string, and store the match tag in the optional tag
@@ -462,7 +345,8 @@ char *vte_terminal_match_check(VteTerminal *terminal,
int *tag);
void vte_terminal_search_set_gregex (VteTerminal *terminal,
- GRegex *regex);
+ GRegex *regex,
+ GRegexMatchFlags flags);
GRegex *vte_terminal_search_get_gregex (VteTerminal *terminal);
void vte_terminal_search_set_wrap_around (VteTerminal *terminal,
gboolean wrap_around);
@@ -474,63 +358,62 @@ gboolean vte_terminal_search_find_next (VteTerminal *terminal);
/* Set the emulation type. Most of the time you won't need this. */
void vte_terminal_set_emulation(VteTerminal *terminal, const char *emulation);
const char *vte_terminal_get_emulation(VteTerminal *terminal);
-const char *vte_terminal_get_default_emulation(VteTerminal *terminal);
+
+const char *vte_get_default_emulation(void);
/* Set the character encoding. Most of the time you won't need this. */
void vte_terminal_set_encoding(VteTerminal *terminal, const char *codeset);
const char *vte_terminal_get_encoding(VteTerminal *terminal);
+/* CJK compatibility setting */
+void vte_terminal_set_cjk_ambiguous_width(VteTerminal *terminal, int width);
+int vte_terminal_get_cjk_ambiguous_width(VteTerminal *terminal);
+
/* Get the contents of the status line. */
const char *vte_terminal_get_status_line(VteTerminal *terminal);
-void vte_terminal_set_pty_object(VteTerminal *terminal, VtePty *pty);
-VtePty *vte_terminal_get_pty_object(VteTerminal *terminal);
+void vte_terminal_set_pty(VteTerminal *terminal, VtePty *pty);
+VtePty *vte_terminal_get_pty(VteTerminal *terminal);
char *vte_get_user_shell (void);
/* Accessors for bindings. */
-#if !GTK_CHECK_VERSION (2, 91, 2)
-GtkAdjustment *vte_terminal_get_adjustment(VteTerminal *terminal);
-#endif
-
glong vte_terminal_get_char_width(VteTerminal *terminal);
glong vte_terminal_get_char_height(VteTerminal *terminal);
glong vte_terminal_get_row_count(VteTerminal *terminal);
glong vte_terminal_get_column_count(VteTerminal *terminal);
const char *vte_terminal_get_window_title(VteTerminal *terminal);
const char *vte_terminal_get_icon_title(VteTerminal *terminal);
+const char *vte_terminal_get_current_directory_uri(VteTerminal *terminal);
+const char *vte_terminal_get_current_file_uri(VteTerminal *terminal);
-int vte_terminal_get_child_exit_status(VteTerminal *terminal);
-
+/* Window geometry helpers */
+void vte_terminal_get_geometry_hints(VteTerminal *terminal,
+ GdkGeometry *hints,
+ int min_rows,
+ int min_columns);
+void vte_terminal_set_geometry_hints_for_window(VteTerminal *terminal,
+ GtkWindow *window);
/* Writing contents out */
/**
- * VteTerminalWriteFlags:
- * @VTE_TERMINAL_WRITE_DEFAULT: Write contents as UTF-8 text. This is the default.
+ * VteWriteFlags:
+ * @VTE_WRITE_DEFAULT: Write contents as UTF-8 text. This is the default.
*
* A flag type to determine how terminal contents should be written
* to an output stream.
*/
typedef enum {
- VTE_TERMINAL_WRITE_DEFAULT = 0
-} VteTerminalWriteFlags;
+ VTE_WRITE_DEFAULT = 0
+} VteWriteFlags;
gboolean vte_terminal_write_contents (VteTerminal *terminal,
GOutputStream *stream,
- VteTerminalWriteFlags flags,
+ VteWriteFlags flags,
GCancellable *cancellable,
GError **error);
-#undef _VTE_SEAL
-#undef _VTE_DEPRECATED
-
G_END_DECLS
-#ifndef VTE_DISABLE_DEPRECATED
-#define __VTE_VTE_H_INSIDE__ 1
-#include "vtedeprecated.h"
-#undef __VTE_VTE_H_INSIDE__
-#endif /* VTE_DISABLE_DEPRECATED */
-
#endif
diff --git a/src/vte.sh b/src/vte.sh
new file mode 100644
index 00000000..3b57f838
--- /dev/null
+++ b/src/vte.sh
@@ -0,0 +1,63 @@
+# Copyright © 2006 Shaun McCance <shaunm@gnome.org>
+# Copyright © 2013 Peter De Wachter <pdewacht@gmail.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Not bash or zsh?
+[ -n "$BASH_VERSION" -o -n "$ZSH_VERSION" ] || return 0
+
+# Not an interactive shell?
+[[ $- == *i* ]] || return 0
+
+# Not running under vte?
+[ "${VTE_VERSION:-0}" -ge 3405 ] || return 0
+
+__vte_urlencode() (
+ # This is important to make sure string manipulation is handled
+ # byte-by-byte.
+ LC_ALL=C
+ str="$1"
+ while [ -n "$str" ]; do
+ safe="${str%%[!a-zA-Z0-9/:_\.\-\!\'\(\)~]*}"
+ printf "%s" "$safe"
+ str="${str#"$safe"}"
+ if [ -n "$str" ]; then
+ printf "%%%02X" "'$str"
+ str="${str#?}"
+ fi
+ done
+)
+
+# Print a warning so that anyone who's added this manually to his PS1 can adapt.
+# The function will be removed in a later version.
+__vte_ps1() {
+ echo -n "(__vte_ps1 is obsolete)"
+}
+
+__vte_osc7 () {
+ printf "\033]7;file://%s%s\a" "${HOSTNAME:-}" "$(__vte_urlencode "${PWD}")"
+}
+
+__vte_prompt_command() {
+ printf "\033]0;%s@%s:%s\007%s" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}" "$(__vte_osc7)"
+}
+
+case "$TERM" in
+ xterm*|vte*)
+ [ -n "$BASH_VERSION" ] && PROMPT_COMMAND="__vte_prompt_command"
+ [ -n "$ZSH_VERSION" ] && precmd_functions+=(__vte_osc7)
+ ;;
+esac
+
+true
diff --git a/src/vteaccess.c b/src/vteaccess.c
index af3887f9..1c9603a9 100644
--- a/src/vteaccess.c
+++ b/src/vteaccess.c
@@ -1,22 +1,22 @@
/*
* Copyright (C) 2002,2003 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/**
+/*
* SECTION: vte-access
* @short_description: Accessibility peer of #VteTerminal
*
@@ -28,12 +28,16 @@
#include <atk/atk.h>
#include <gtk/gtk.h>
+#include <gtk/gtk-a11y.h>
+#ifdef GDK_WINDOWING_X11
+#include <gdk/gdkx.h>
+#endif
#include <string.h>
#include "debug.h"
#include "vte.h"
#include "vteaccess.h"
#include "vteint.h"
-#include "vte-gtk-compat.h"
+#include "vte-private.h"
#ifdef HAVE_LOCALE_H
#include <locale.h>
@@ -45,8 +49,6 @@ enum {
LAST_ACTION
};
-#define VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA "VteTerminalAccessiblePrivateData"
-
typedef struct _VteTerminalAccessiblePrivate {
gboolean snapshot_contents_invalid; /* This data is stale. */
gboolean snapshot_caret_invalid; /* This data is stale. */
@@ -67,9 +69,6 @@ enum direction {
static gunichar vte_terminal_accessible_get_character_at_offset(AtkText *text,
gint offset);
-static gpointer vte_terminal_accessible_parent_class;
-
-G_DEFINE_TYPE(VteTerminalAccessibleFactory, vte_terminal_accessible_factory, ATK_TYPE_OBJECT_FACTORY)
static const char *vte_terminal_accessible_action_names[] = {
"menu",
@@ -81,46 +80,15 @@ static const char *vte_terminal_accessible_action_descriptions[] = {
NULL
};
-/* Create snapshot private data. */
-static VteTerminalAccessiblePrivate *
-vte_terminal_accessible_new_private_data(void)
-{
- VteTerminalAccessiblePrivate *priv;
- priv = g_slice_new0(VteTerminalAccessiblePrivate);
- priv->snapshot_text = NULL;
- priv->snapshot_characters = NULL;
- priv->snapshot_attributes = NULL;
- priv->snapshot_linebreaks = NULL;
- priv->snapshot_caret = -1;
- priv->snapshot_contents_invalid = TRUE;
- priv->snapshot_caret_invalid = TRUE;
- return priv;
-}
+static void vte_terminal_accessible_text_iface_init(AtkTextIface *iface);
+static void vte_terminal_accessible_component_iface_init(AtkComponentIface *component);
+static void vte_terminal_accessible_action_iface_init(AtkActionIface *action);
-/* Free snapshot private data. */
-static void
-vte_terminal_accessible_free_private_data(VteTerminalAccessiblePrivate *priv)
-{
- gint i;
-
- g_assert(priv != NULL);
- if (priv->snapshot_text != NULL) {
- g_string_free(priv->snapshot_text, TRUE);
- }
- if (priv->snapshot_characters != NULL) {
- g_array_free(priv->snapshot_characters, TRUE);
- }
- if (priv->snapshot_attributes != NULL) {
- g_array_free(priv->snapshot_attributes, TRUE);
- }
- if (priv->snapshot_linebreaks != NULL) {
- g_array_free(priv->snapshot_linebreaks, TRUE);
- }
- for (i = 0; i < LAST_ACTION; i++) {
- g_free (priv->action_descriptions[i]);
- }
- g_slice_free(VteTerminalAccessiblePrivate, priv);
-}
+G_DEFINE_TYPE_WITH_CODE (VteTerminalAccessible, _vte_terminal_accessible, GTK_TYPE_WIDGET_ACCESSIBLE,
+ G_ADD_PRIVATE (VteTerminalAccessible)
+ G_IMPLEMENT_INTERFACE (ATK_TYPE_TEXT, vte_terminal_accessible_text_iface_init)
+ G_IMPLEMENT_INTERFACE (ATK_TYPE_COMPONENT, vte_terminal_accessible_component_iface_init)
+ G_IMPLEMENT_INTERFACE (ATK_TYPE_ACTION, vte_terminal_accessible_action_iface_init))
static gint
offset_from_xy (VteTerminalAccessiblePrivate *priv,
@@ -233,24 +201,17 @@ emit_text_changed_delete(GObject *object,
}
static void
-vte_terminal_accessible_update_private_data_if_needed(AtkObject *text,
+vte_terminal_accessible_update_private_data_if_needed(VteTerminalAccessible *accessible,
char **old, glong *olen)
{
- VteTerminal *terminal;
- VteTerminalAccessiblePrivate *priv;
+ VteTerminalAccessiblePrivate *priv = _vte_terminal_accessible_get_instance_private(accessible);
+ VteTerminal *terminal;
struct _VteCharAttributes attrs;
char *next, *tmp;
long row, offset, caret;
long ccol, crow;
guint i;
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(text));
-
- /* Retrieve the private data structure. It must already exist. */
- priv = g_object_get_data(G_OBJECT(text),
- VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
- g_assert(priv != NULL);
-
/* If nothing's changed, just return immediately. */
if ((priv->snapshot_contents_invalid == FALSE) &&
(priv->snapshot_caret_invalid == FALSE)) {
@@ -279,7 +240,7 @@ vte_terminal_accessible_update_private_data_if_needed(AtkObject *text,
}
/* Re-read the contents of the widget if the contents have changed. */
- terminal = VTE_TERMINAL(gtk_accessible_get_widget(GTK_ACCESSIBLE(text)));
+ terminal = VTE_TERMINAL(gtk_accessible_get_widget(GTK_ACCESSIBLE(accessible)));
if (priv->snapshot_contents_invalid) {
/* Free the outdated snapshot data, unless the caller
* wants it. */
@@ -411,7 +372,7 @@ vte_terminal_accessible_update_private_data_if_needed(AtkObject *text,
/* Notify observers if the caret moved. */
if (caret != priv->snapshot_caret) {
priv->snapshot_caret = caret;
- emit_text_caret_moved(G_OBJECT(text), caret);
+ emit_text_caret_moved(G_OBJECT(accessible), caret);
}
/* Done updating the caret position, whether we needed to or not. */
@@ -428,20 +389,15 @@ vte_terminal_accessible_update_private_data_if_needed(AtkObject *text,
static void
vte_terminal_accessible_text_modified(VteTerminal *terminal, gpointer data)
{
- VteTerminalAccessiblePrivate *priv;
+ VteTerminalAccessible *accessible = data;
+ VteTerminalAccessiblePrivate *priv = _vte_terminal_accessible_get_instance_private(accessible);
char *old, *current;
glong offset, caret_offset, olen, clen;
gint old_snapshot_caret;
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(data));
-
- priv = g_object_get_data(G_OBJECT(data),
- VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
- g_assert(priv != NULL);
-
old_snapshot_caret = priv->snapshot_caret;
priv->snapshot_contents_invalid = TRUE;
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(data),
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
&old, &olen);
g_assert(old != NULL);
@@ -471,7 +427,7 @@ vte_terminal_accessible_text_modified(VteTerminal *terminal, gpointer data)
(old_snapshot_caret == priv->snapshot_caret + 1)) {
priv->snapshot_text->str = old;
priv->snapshot_text->len = caret_offset + 1;
- emit_text_changed_delete(G_OBJECT(data),
+ emit_text_changed_delete(G_OBJECT(accessible),
old, caret_offset, 1);
priv->snapshot_text->str = current;
priv->snapshot_text->len = clen;
@@ -508,7 +464,7 @@ vte_terminal_accessible_text_modified(VteTerminal *terminal, gpointer data)
priv->snapshot_text->str = old;
priv->snapshot_text->len = olen;
- emit_text_changed_delete(G_OBJECT(data),
+ emit_text_changed_delete(G_OBJECT(accessible),
old,
offset,
olen - offset);
@@ -518,7 +474,7 @@ vte_terminal_accessible_text_modified(VteTerminal *terminal, gpointer data)
/* .. and an inserted signal for text that wasn't in the old
* string but is in the new one. */
if (clen > offset) {
- emit_text_changed_insert(G_OBJECT(data),
+ emit_text_changed_insert(G_OBJECT(accessible),
current,
offset,
clen - offset);
@@ -534,37 +490,34 @@ vte_terminal_accessible_text_scrolled(VteTerminal *terminal,
gint howmuch,
gpointer data)
{
- VteTerminalAccessiblePrivate *priv;
+ VteTerminalAccessible *accessible = data;
+ VteTerminalAccessiblePrivate *priv = _vte_terminal_accessible_get_instance_private(accessible);
struct _VteCharAttributes attr;
- long delta;
+ long delta, row_count;
guint i, len;
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(data));
g_assert(howmuch != 0);
- priv = g_object_get_data(G_OBJECT(data),
- VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
- g_assert(priv != NULL);
-
- if (((howmuch < 0) && (howmuch <= -terminal->row_count)) ||
- ((howmuch > 0) && (howmuch >= terminal->row_count))) {
+ row_count = vte_terminal_get_row_count(terminal);
+ if (((howmuch < 0) && (howmuch <= -row_count)) ||
+ ((howmuch > 0) && (howmuch >= row_count))) {
/* All of the text was removed. */
if (priv->snapshot_text != NULL) {
if (priv->snapshot_text->str != NULL) {
- emit_text_changed_delete(G_OBJECT(data),
+ emit_text_changed_delete(G_OBJECT(accessible),
priv->snapshot_text->str,
0,
priv->snapshot_text->len);
}
}
priv->snapshot_contents_invalid = TRUE;
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(data),
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL,
NULL);
/* All of the present text was added. */
if (priv->snapshot_text != NULL) {
if (priv->snapshot_text->str != NULL) {
- emit_text_changed_insert(G_OBJECT(data),
+ emit_text_changed_insert(G_OBJECT(accessible),
priv->snapshot_text->str,
0,
priv->snapshot_text->len);
@@ -584,7 +537,7 @@ vte_terminal_accessible_text_scrolled(VteTerminal *terminal,
}
/* We scrolled up, so text was added at the top and removed
* from the bottom. */
- if ((howmuch < 0) && (howmuch > -terminal->row_count)) {
+ if ((howmuch < 0) && (howmuch > -row_count)) {
gboolean inserted = FALSE;
howmuch = -howmuch;
if (priv->snapshot_attributes != NULL &&
@@ -594,13 +547,13 @@ vte_terminal_accessible_text_scrolled(VteTerminal *terminal,
attr = g_array_index(priv->snapshot_attributes,
struct _VteCharAttributes,
i);
- if (attr.row >= delta + terminal->row_count - howmuch) {
+ if (attr.row >= delta + row_count - howmuch) {
break;
}
}
if (i < priv->snapshot_attributes->len) {
/* The rest of the string was deleted -- make a note. */
- emit_text_changed_delete(G_OBJECT(data),
+ emit_text_changed_delete(G_OBJECT(accessible),
priv->snapshot_text->str,
i,
priv->snapshot_attributes->len - i);
@@ -610,7 +563,7 @@ vte_terminal_accessible_text_scrolled(VteTerminal *terminal,
/* Refresh. Note that i is now the length of the data which
* we expect to have left over. */
priv->snapshot_contents_invalid = TRUE;
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(data),
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL,
NULL);
/* If we now have more text than before, the initial portion
@@ -618,7 +571,7 @@ vte_terminal_accessible_text_scrolled(VteTerminal *terminal,
if (inserted) {
len = priv->snapshot_text->len;
if (len > i) {
- emit_text_changed_insert(G_OBJECT(data),
+ emit_text_changed_insert(G_OBJECT(accessible),
priv->snapshot_text->str,
0,
len - i);
@@ -628,7 +581,7 @@ vte_terminal_accessible_text_scrolled(VteTerminal *terminal,
}
/* We scrolled down, so text was added at the bottom and removed
* from the top. */
- if ((howmuch > 0) && (howmuch < terminal->row_count)) {
+ if ((howmuch > 0) && (howmuch < row_count)) {
gboolean inserted = FALSE;
if (priv->snapshot_attributes != NULL &&
priv->snapshot_text != NULL) {
@@ -642,7 +595,7 @@ vte_terminal_accessible_text_scrolled(VteTerminal *terminal,
}
}
/* That many bytes disappeared -- make a note. */
- emit_text_changed_delete(G_OBJECT(data),
+ emit_text_changed_delete(G_OBJECT(accessible),
priv->snapshot_text->str,
0,
i);
@@ -651,7 +604,7 @@ vte_terminal_accessible_text_scrolled(VteTerminal *terminal,
inserted = TRUE;
}
priv->snapshot_contents_invalid = TRUE;
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(data),
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL,
NULL);
/* Any newly-added string data is new, so note that it was
@@ -659,7 +612,7 @@ vte_terminal_accessible_text_scrolled(VteTerminal *terminal,
if (inserted) {
len = priv->snapshot_text->len;
if (len > i) {
- emit_text_changed_insert(G_OBJECT(data),
+ emit_text_changed_insert(G_OBJECT(accessible),
priv->snapshot_text->str,
i,
len - i);
@@ -674,18 +627,13 @@ vte_terminal_accessible_text_scrolled(VteTerminal *terminal,
static void
vte_terminal_accessible_invalidate_cursor(VteTerminal *terminal, gpointer data)
{
- VteTerminalAccessiblePrivate *priv;
-
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(data));
-
- priv = g_object_get_data(G_OBJECT(data),
- VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
- g_assert(priv != NULL);
+ VteTerminalAccessible *accessible = data;
+ VteTerminalAccessiblePrivate *priv = _vte_terminal_accessible_get_instance_private(accessible);
_vte_debug_print(VTE_DEBUG_ALLY,
"Invalidating accessibility cursor.\n");
priv->snapshot_caret_invalid = TRUE;
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(data),
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL, NULL);
}
@@ -693,37 +641,9 @@ vte_terminal_accessible_invalidate_cursor(VteTerminal *terminal, gpointer data)
static void
vte_terminal_accessible_title_changed(VteTerminal *terminal, gpointer data)
{
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(data));
- g_assert(VTE_IS_TERMINAL(terminal));
- atk_object_set_description(ATK_OBJECT(data), terminal->window_title);
-}
-
-/* Reflect focus-in events. */
-static gboolean
-vte_terminal_accessible_focus_in(VteTerminal *terminal, GdkEventFocus *event,
- gpointer data)
-{
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(data));
- g_assert(VTE_IS_TERMINAL(terminal));
- g_signal_emit_by_name(data, "focus-event", TRUE);
- atk_object_notify_state_change(ATK_OBJECT(data),
- ATK_STATE_FOCUSED, TRUE);
-
- return FALSE;
-}
-
-/* Reflect focus-out events. */
-static gboolean
-vte_terminal_accessible_focus_out(VteTerminal *terminal, GdkEventFocus *event,
- gpointer data)
-{
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(data));
- g_assert(VTE_IS_TERMINAL(terminal));
- g_signal_emit_by_name(data, "focus-event", FALSE);
- atk_object_notify_state_change(ATK_OBJECT(data),
- ATK_STATE_FOCUSED, FALSE);
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(data);
- return FALSE;
+ atk_object_set_description(ATK_OBJECT(accessible), vte_terminal_get_window_title(terminal));
}
/* Reflect visibility-notify events. */
@@ -732,16 +652,16 @@ vte_terminal_accessible_visibility_notify(VteTerminal *terminal,
GdkEventVisibility *event,
gpointer data)
{
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(data);
GtkWidget *widget;
gboolean visible;
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(data));
- g_assert(VTE_IS_TERMINAL(terminal));
+
visible = event->state != GDK_VISIBILITY_FULLY_OBSCURED;
/* The VISIBLE state indicates that this widget is "visible". */
- atk_object_notify_state_change(ATK_OBJECT(data),
+ atk_object_notify_state_change(ATK_OBJECT(accessible),
ATK_STATE_VISIBLE,
visible);
- widget = GTK_WIDGET(terminal);
+ widget = &terminal->widget;
while (visible) {
if (gtk_widget_get_toplevel(widget) == widget) {
break;
@@ -754,7 +674,7 @@ vte_terminal_accessible_visibility_notify(VteTerminal *terminal,
}
/* The SHOWING state indicates that this widget, and all of its
* parents up to the toplevel, are "visible". */
- atk_object_notify_state_change(ATK_OBJECT(data),
+ atk_object_notify_state_change(ATK_OBJECT(accessible),
ATK_STATE_SHOWING,
visible);
@@ -765,28 +685,22 @@ static void
vte_terminal_accessible_selection_changed (VteTerminal *terminal,
gpointer data)
{
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(data));
- g_assert(VTE_IS_TERMINAL(terminal));
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(data);
- g_signal_emit_by_name (data, "text_selection_changed");
+ g_signal_emit_by_name (accessible, "text_selection_changed");
}
static void
-vte_terminal_initialize (AtkObject *obj, gpointer data)
+vte_terminal_accessible_initialize (AtkObject *obj, gpointer data)
{
- VteTerminal *terminal;
+ VteTerminal *terminal = VTE_TERMINAL (data);
AtkObject *parent;
+ const char *window_title;
- ATK_OBJECT_CLASS (vte_terminal_accessible_parent_class)->initialize (obj, data);
-
- terminal = VTE_TERMINAL (data);
+ ATK_OBJECT_CLASS (_vte_terminal_accessible_parent_class)->initialize (obj, data);
_vte_terminal_accessible_ref(terminal);
- g_object_set_data(G_OBJECT(obj),
- VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA,
- vte_terminal_accessible_new_private_data());
-
g_signal_connect(terminal, "text-inserted",
G_CALLBACK(vte_terminal_accessible_text_modified),
obj);
@@ -805,31 +719,15 @@ vte_terminal_initialize (AtkObject *obj, gpointer data)
g_signal_connect(terminal, "window-title-changed",
G_CALLBACK(vte_terminal_accessible_title_changed),
obj);
- g_signal_connect(terminal, "focus-in-event",
- G_CALLBACK(vte_terminal_accessible_focus_in),
- obj);
- g_signal_connect(terminal, "focus-out-event",
- G_CALLBACK(vte_terminal_accessible_focus_out),
- obj);
+
g_signal_connect(terminal, "visibility-notify-event",
- G_CALLBACK(vte_terminal_accessible_visibility_notify),
- obj);
+ G_CALLBACK(vte_terminal_accessible_visibility_notify), obj);
g_signal_connect(terminal, "selection-changed",
- G_CALLBACK(vte_terminal_accessible_selection_changed),
- obj);
-
- if (GTK_IS_WIDGET(gtk_widget_get_parent(GTK_WIDGET(terminal)))) {
- parent = gtk_widget_get_accessible(gtk_widget_get_parent ((GTK_WIDGET(terminal))));
- if (ATK_IS_OBJECT(parent)) {
- atk_object_set_parent(obj, parent);
- }
- }
+ G_CALLBACK(vte_terminal_accessible_selection_changed), obj);
atk_object_set_name(obj, "Terminal");
- atk_object_set_description(obj,
- terminal->window_title ?
- terminal->window_title :
- "");
+ window_title = vte_terminal_get_window_title(terminal);
+ atk_object_set_description(obj, window_title ? window_title : "");
atk_object_notify_state_change(obj,
ATK_STATE_FOCUSABLE, TRUE);
@@ -837,44 +735,36 @@ vte_terminal_initialize (AtkObject *obj, gpointer data)
ATK_STATE_EXPANDABLE, FALSE);
atk_object_notify_state_change(obj,
ATK_STATE_RESIZABLE, TRUE);
- obj->role = ATK_ROLE_TERMINAL;
+ atk_object_set_role(obj, ATK_ROLE_TERMINAL);
}
-/**
- * vte_terminal_accessible_new:
- * @terminal: a #VteTerminal
- *
- * Creates a new accessibility peer for the terminal widget.
- *
- * Returns: the new #AtkObject
- */
-AtkObject *
-vte_terminal_accessible_new(VteTerminal *terminal)
+static void
+_vte_terminal_accessible_init (VteTerminalAccessible *accessible)
{
- AtkObject *accessible;
- GObject *object;
+ VteTerminalAccessiblePrivate *priv = _vte_terminal_accessible_get_instance_private (accessible);
- g_return_val_if_fail(VTE_IS_TERMINAL(terminal), NULL);
+ _vte_debug_print(VTE_DEBUG_ALLY, "Initialising accessible peer.\n");
- object = g_object_new(VTE_TYPE_TERMINAL_ACCESSIBLE, NULL);
- accessible = ATK_OBJECT (object);
- atk_object_initialize(accessible, terminal);
-
- return accessible;
+ priv->snapshot_text = NULL;
+ priv->snapshot_characters = NULL;
+ priv->snapshot_attributes = NULL;
+ priv->snapshot_linebreaks = NULL;
+ priv->snapshot_caret = -1;
+ priv->snapshot_contents_invalid = TRUE;
+ priv->snapshot_caret_invalid = TRUE;
}
static void
vte_terminal_accessible_finalize(GObject *object)
{
- VteTerminalAccessiblePrivate *priv;
- GtkAccessible *accessible = NULL;
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(object);
+ VteTerminalAccessiblePrivate *priv = _vte_terminal_accessible_get_instance_private(accessible);
GtkWidget *widget;
+ gint i;
_vte_debug_print(VTE_DEBUG_ALLY, "Finalizing accessible peer.\n");
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(object));
- accessible = GTK_ACCESSIBLE(object);
- widget = gtk_accessible_get_widget (accessible);
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE(accessible));
if (widget != NULL) {
g_object_remove_weak_pointer(G_OBJECT(widget),
@@ -907,40 +797,40 @@ vte_terminal_accessible_finalize(GObject *object)
G_SIGNAL_MATCH_FUNC |
G_SIGNAL_MATCH_DATA,
0, 0, NULL,
- vte_terminal_accessible_focus_in,
- object);
- g_signal_handlers_disconnect_matched(widget,
- G_SIGNAL_MATCH_FUNC |
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL,
- vte_terminal_accessible_focus_out,
- object);
- g_signal_handlers_disconnect_matched(widget,
- G_SIGNAL_MATCH_FUNC |
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL,
vte_terminal_accessible_visibility_notify,
object);
}
- priv = g_object_get_data(object,
- VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
- if (priv != NULL) {
- vte_terminal_accessible_free_private_data(priv);
- g_object_set_data(object,
- VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA,
- NULL);
+
+ if (priv->snapshot_text != NULL) {
+ g_string_free(priv->snapshot_text, TRUE);
+ }
+ if (priv->snapshot_characters != NULL) {
+ g_array_free(priv->snapshot_characters, TRUE);
+ }
+ if (priv->snapshot_attributes != NULL) {
+ g_array_free(priv->snapshot_attributes, TRUE);
}
- G_OBJECT_CLASS(vte_terminal_accessible_parent_class)->finalize(object);
+ if (priv->snapshot_linebreaks != NULL) {
+ g_array_free(priv->snapshot_linebreaks, TRUE);
+ }
+ for (i = 0; i < LAST_ACTION; i++) {
+ g_free (priv->action_descriptions[i]);
+ }
+
+ G_OBJECT_CLASS(_vte_terminal_accessible_parent_class)->finalize(object);
}
static gchar *
vte_terminal_accessible_get_text(AtkText *text,
gint start_offset, gint end_offset)
{
- VteTerminalAccessiblePrivate *priv;
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(text);
+ VteTerminalAccessiblePrivate *priv = _vte_terminal_accessible_get_instance_private(accessible);
int start, end;
gchar *ret;
+ g_assert(VTE_IS_TERMINAL_ACCESSIBLE(accessible));
+
/* Swap around if start is greater than end */
if (start_offset > end_offset && end_offset != -1) {
gint tmp;
@@ -952,16 +842,13 @@ vte_terminal_accessible_get_text(AtkText *text,
g_assert((start_offset >= 0) && (end_offset >= -1));
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL, NULL);
- priv = g_object_get_data(G_OBJECT(text),
- VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
_vte_debug_print(VTE_DEBUG_ALLY,
"Getting text from %d to %d of %d.\n",
start_offset, end_offset,
priv->snapshot_characters->len);
- g_assert(ATK_IS_TEXT(text));
/* If the requested area is after all of the text, just return an
* empty string. */
@@ -1000,17 +887,16 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
gint *start_offset,
gint *end_offset)
{
- VteTerminalAccessiblePrivate *priv;
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(text);
+ VteTerminalAccessiblePrivate *priv = _vte_terminal_accessible_get_instance_private(accessible);
VteTerminal *terminal;
gunichar current, prev, next;
guint start, end, line;
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL, NULL);
- priv = g_object_get_data(G_OBJECT(text),
- VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
- terminal = VTE_TERMINAL(gtk_accessible_get_widget (GTK_ACCESSIBLE(text)));
+ terminal = VTE_TERMINAL(gtk_accessible_get_widget (GTK_ACCESSIBLE(accessible)));
_vte_debug_print(VTE_DEBUG_ALLY,
"Getting %s %s at %d of %d.\n",
@@ -1044,7 +930,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
/* Back up to the previous non-word-word transition. */
while (offset > 0) {
prev = vte_terminal_accessible_get_character_at_offset(text, offset - 1);
- if (vte_terminal_is_word_char(terminal, prev)) {
+ if (_vte_terminal_is_word_char(terminal, prev)) {
offset--;
} else {
break;
@@ -1058,7 +944,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
if (direction == direction_previous) {
while (offset > 0) {
prev = vte_terminal_accessible_get_character_at_offset(text, offset - 1);
- if (!vte_terminal_is_word_char(terminal, prev)) {
+ if (!_vte_terminal_is_word_char(terminal, prev)) {
offset--;
} else {
break;
@@ -1066,7 +952,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
}
while (offset > 0) {
prev = vte_terminal_accessible_get_character_at_offset(text, offset - 1);
- if (vte_terminal_is_word_char(terminal, prev)) {
+ if (_vte_terminal_is_word_char(terminal, prev)) {
offset--;
} else {
break;
@@ -1081,7 +967,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
if (direction == direction_next) {
while (offset < (int) priv->snapshot_characters->len) {
next = vte_terminal_accessible_get_character_at_offset(text, offset);
- if (vte_terminal_is_word_char(terminal, next)) {
+ if (_vte_terminal_is_word_char(terminal, next)) {
offset++;
} else {
break;
@@ -1089,7 +975,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
}
while (offset < (int) priv->snapshot_characters->len) {
next = vte_terminal_accessible_get_character_at_offset(text, offset);
- if (!vte_terminal_is_word_char(terminal, next)) {
+ if (!_vte_terminal_is_word_char(terminal, next)) {
offset++;
} else {
break;
@@ -1100,7 +986,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
/* Now find the end of this word. */
while (offset < (int) priv->snapshot_characters->len) {
current = vte_terminal_accessible_get_character_at_offset(text, offset);
- if (vte_terminal_is_word_char(terminal, current)) {
+ if (_vte_terminal_is_word_char(terminal, current)) {
offset++;
} else {
break;
@@ -1110,7 +996,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
/* Now find the next non-word-word transition */
while (offset < (int) priv->snapshot_characters->len) {
next = vte_terminal_accessible_get_character_at_offset(text, offset);
- if (!vte_terminal_is_word_char(terminal, next)) {
+ if (!_vte_terminal_is_word_char(terminal, next)) {
offset++;
} else {
break;
@@ -1123,8 +1009,8 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
current = vte_terminal_accessible_get_character_at_offset(text, offset);
while (offset > 0) {
prev = vte_terminal_accessible_get_character_at_offset(text, offset - 1);
- if (vte_terminal_is_word_char(terminal, prev) &&
- !vte_terminal_is_word_char(terminal, current)) {
+ if (_vte_terminal_is_word_char(terminal, prev) &&
+ !_vte_terminal_is_word_char(terminal, current)) {
break;
} else {
offset--;
@@ -1139,7 +1025,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
if (direction == direction_previous) {
while (offset > 0) {
prev = vte_terminal_accessible_get_character_at_offset(text, offset - 1);
- if (vte_terminal_is_word_char(terminal, prev)) {
+ if (_vte_terminal_is_word_char(terminal, prev)) {
offset--;
} else {
break;
@@ -1148,8 +1034,8 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
current = vte_terminal_accessible_get_character_at_offset(text, offset);
while (offset > 0) {
prev = vte_terminal_accessible_get_character_at_offset(text, offset - 1);
- if (vte_terminal_is_word_char(terminal, prev) &&
- !vte_terminal_is_word_char(terminal, current)) {
+ if (_vte_terminal_is_word_char(terminal, prev) &&
+ !_vte_terminal_is_word_char(terminal, current)) {
break;
} else {
offset--;
@@ -1165,7 +1051,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
if (direction == direction_next) {
while (offset < (int) priv->snapshot_characters->len) {
current = vte_terminal_accessible_get_character_at_offset(text, offset);
- if (!vte_terminal_is_word_char(terminal, current)) {
+ if (!_vte_terminal_is_word_char(terminal, current)) {
offset++;
} else {
break;
@@ -1173,7 +1059,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
}
while (offset < (int) priv->snapshot_characters->len) {
current = vte_terminal_accessible_get_character_at_offset(text, offset);
- if (vte_terminal_is_word_char(terminal, current)) {
+ if (_vte_terminal_is_word_char(terminal, current)) {
offset++;
} else {
break;
@@ -1184,7 +1070,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
/* Now find the next word end. */
while (offset < (int) priv->snapshot_characters->len) {
current = vte_terminal_accessible_get_character_at_offset(text, offset);
- if (!vte_terminal_is_word_char(terminal, current)) {
+ if (!_vte_terminal_is_word_char(terminal, current)) {
offset++;
} else {
break;
@@ -1192,7 +1078,7 @@ vte_terminal_accessible_get_text_somewhere(AtkText *text,
}
while (offset < (int) priv->snapshot_characters->len) {
current = vte_terminal_accessible_get_character_at_offset(text, offset);
- if (vte_terminal_is_word_char(terminal, current)) {
+ if (_vte_terminal_is_word_char(terminal, current)) {
offset++;
} else {
break;
@@ -1250,8 +1136,9 @@ vte_terminal_accessible_get_text_before_offset(AtkText *text, gint offset,
gint *start_offset,
gint *end_offset)
{
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(text));
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(text);
+
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL, NULL);
return vte_terminal_accessible_get_text_somewhere(text,
offset,
@@ -1267,8 +1154,9 @@ vte_terminal_accessible_get_text_after_offset(AtkText *text, gint offset,
gint *start_offset,
gint *end_offset)
{
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(text));
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(text);
+
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL, NULL);
return vte_terminal_accessible_get_text_somewhere(text,
offset,
@@ -1284,8 +1172,9 @@ vte_terminal_accessible_get_text_at_offset(AtkText *text, gint offset,
gint *start_offset,
gint *end_offset)
{
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(text));
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(text);
+
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL, NULL);
return vte_terminal_accessible_get_text_somewhere(text,
offset,
@@ -1298,21 +1187,16 @@ vte_terminal_accessible_get_text_at_offset(AtkText *text, gint offset,
static gunichar
vte_terminal_accessible_get_character_at_offset(AtkText *text, gint offset)
{
- VteTerminalAccessiblePrivate *priv;
- int mapped;
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(text);
+ VteTerminalAccessiblePrivate *priv = _vte_terminal_accessible_get_instance_private(accessible);
char *unichar;
gunichar ret;
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL, NULL);
- priv = g_object_get_data(G_OBJECT(text),
- VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
-
g_assert(offset < (int) priv->snapshot_characters->len);
- mapped = g_array_index(priv->snapshot_characters, int, offset);
-
unichar = vte_terminal_accessible_get_text(text, offset, offset + 1);
ret = g_utf8_get_char(unichar);
g_free(unichar);
@@ -1323,14 +1207,12 @@ vte_terminal_accessible_get_character_at_offset(AtkText *text, gint offset)
static gint
vte_terminal_accessible_get_caret_offset(AtkText *text)
{
- VteTerminalAccessiblePrivate *priv;
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(text);
+ VteTerminalAccessiblePrivate *priv = _vte_terminal_accessible_get_instance_private(accessible);
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL, NULL);
- priv = g_object_get_data(G_OBJECT(text),
- VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
-
return priv->snapshot_caret;
}
@@ -1367,21 +1249,28 @@ get_attribute_set (struct _VteCharAttributes attr)
return set;
}
+static gboolean
+_pango_color_equal(const PangoColor *a,
+ const PangoColor *b)
+{
+ return a->red == b->red &&
+ a->green == b->green &&
+ a->blue == b->blue;
+}
+
static AtkAttributeSet *
vte_terminal_accessible_get_run_attributes(AtkText *text, gint offset,
gint *start_offset, gint *end_offset)
{
- VteTerminalAccessiblePrivate *priv;
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(text);
+ VteTerminalAccessiblePrivate *priv = _vte_terminal_accessible_get_instance_private(accessible);
guint i;
struct _VteCharAttributes cur_attr;
struct _VteCharAttributes attr;
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL, NULL);
- priv = g_object_get_data(G_OBJECT(text),
- VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
-
attr = g_array_index (priv->snapshot_attributes,
struct _VteCharAttributes,
offset);
@@ -1390,8 +1279,8 @@ vte_terminal_accessible_get_run_attributes(AtkText *text, gint offset,
cur_attr = g_array_index (priv->snapshot_attributes,
struct _VteCharAttributes,
i);
- if (!gdk_color_equal (&cur_attr.fore, &attr.fore) ||
- !gdk_color_equal (&cur_attr.back, &attr.back) ||
+ if (!_pango_color_equal (&cur_attr.fore, &attr.fore) ||
+ !_pango_color_equal (&cur_attr.back, &attr.back) ||
cur_attr.underline != attr.underline ||
cur_attr.strikethrough != attr.strikethrough) {
*start_offset = i + 1;
@@ -1403,8 +1292,8 @@ vte_terminal_accessible_get_run_attributes(AtkText *text, gint offset,
cur_attr = g_array_index (priv->snapshot_attributes,
struct _VteCharAttributes,
i);
- if (!gdk_color_equal (&cur_attr.fore, &attr.fore) ||
- !gdk_color_equal (&cur_attr.back, &attr.back) ||
+ if (!_pango_color_equal (&cur_attr.fore, &attr.fore) ||
+ !_pango_color_equal (&cur_attr.back, &attr.back) ||
cur_attr.underline != attr.underline ||
cur_attr.strikethrough != attr.strikethrough) {
*end_offset = i - 1;
@@ -1427,20 +1316,17 @@ vte_terminal_accessible_get_character_extents(AtkText *text, gint offset,
gint *width, gint *height,
AtkCoordType coords)
{
- VteTerminalAccessiblePrivate *priv;
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(text);
+ VteTerminalAccessiblePrivate *priv = _vte_terminal_accessible_get_instance_private(accessible);
VteTerminal *terminal;
glong char_width, char_height;
- gint base_x, base_y;
-
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(text));
+ gint base_x, base_y, w, h;
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL, NULL);
- priv = g_object_get_data(G_OBJECT(text),
- VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
terminal = VTE_TERMINAL (gtk_accessible_get_widget (GTK_ACCESSIBLE (text)));
- atk_component_get_position (ATK_COMPONENT (text), &base_x, &base_y, coords);
+ atk_component_get_extents (ATK_COMPONENT (text), &base_x, &base_y, &w, &h, coords);
xy_from_offset (priv, offset, x, y);
char_width = vte_terminal_get_char_width (terminal);
char_height = vte_terminal_get_char_height (terminal);
@@ -1455,14 +1341,12 @@ vte_terminal_accessible_get_character_extents(AtkText *text, gint offset,
static gint
vte_terminal_accessible_get_character_count(AtkText *text)
{
- VteTerminalAccessiblePrivate *priv;
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(text);
+ VteTerminalAccessiblePrivate *priv = _vte_terminal_accessible_get_instance_private(accessible);
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL, NULL);
- priv = g_object_get_data(G_OBJECT(text),
- VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
-
return priv->snapshot_attributes->len;
}
@@ -1471,20 +1355,18 @@ vte_terminal_accessible_get_offset_at_point(AtkText *text,
gint x, gint y,
AtkCoordType coords)
{
- VteTerminalAccessiblePrivate *priv;
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(text);
+ VteTerminalAccessiblePrivate *priv = _vte_terminal_accessible_get_instance_private(accessible);
VteTerminal *terminal;
glong char_width, char_height;
- gint base_x, base_y;
+ gint base_x, base_y, w, h;
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(text));
-
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL, NULL);
- priv = g_object_get_data(G_OBJECT(text),
- VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
terminal = VTE_TERMINAL (gtk_accessible_get_widget (GTK_ACCESSIBLE (text)));
- atk_component_get_position (ATK_COMPONENT (text), &base_x, &base_y, coords);
+ atk_component_get_extents (ATK_COMPONENT (text), &base_x, &base_y, &w, &h, coords);
+ /* FIXME: use _vte_terminal_xy_to_grid */
char_width = vte_terminal_get_char_width (terminal);
char_height = vte_terminal_get_char_height (terminal);
x -= base_x;
@@ -1497,19 +1379,18 @@ vte_terminal_accessible_get_offset_at_point(AtkText *text,
static gint
vte_terminal_accessible_get_n_selections(AtkText *text)
{
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(text);
GtkWidget *widget;
VteTerminal *terminal;
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(text));
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL, NULL);
-
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE(text));
if (widget == NULL) {
/* State is defunct */
return -1;
}
- g_assert(VTE_IS_TERMINAL (widget));
+
terminal = VTE_TERMINAL (widget);
return (vte_terminal_get_has_selection (terminal)) ? 1 : 0;
}
@@ -1518,20 +1399,20 @@ static gchar *
vte_terminal_accessible_get_selection(AtkText *text, gint selection_number,
gint *start_offset, gint *end_offset)
{
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(text);
+ VteTerminalAccessiblePrivate *priv = _vte_terminal_accessible_get_instance_private(accessible);
GtkWidget *widget;
VteTerminal *terminal;
- VteTerminalAccessiblePrivate *priv;
long start_x, start_y, end_x, end_y;
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(text));
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL, NULL);
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE(text));
if (widget == NULL) {
/* State is defunct */
return NULL;
}
- g_assert(VTE_IS_TERMINAL (widget));
+
terminal = VTE_TERMINAL (widget);
if (!vte_terminal_get_has_selection (terminal)) {
return NULL;
@@ -1540,9 +1421,8 @@ vte_terminal_accessible_get_selection(AtkText *text, gint selection_number,
return NULL;
}
- priv = g_object_get_data(G_OBJECT(text),
- VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
_vte_terminal_get_start_selection (terminal, &start_x, &start_y);
+
*start_offset = offset_from_xy (priv, start_x, start_y);
_vte_terminal_get_end_selection (terminal, &end_x, &end_y);
*end_offset = offset_from_xy (priv, end_x, end_y);
@@ -1553,24 +1433,23 @@ static gboolean
vte_terminal_accessible_add_selection(AtkText *text,
gint start_offset, gint end_offset)
{
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(text);
+ VteTerminalAccessiblePrivate *priv = _vte_terminal_accessible_get_instance_private(accessible);
GtkWidget *widget;
VteTerminal *terminal;
- VteTerminalAccessiblePrivate *priv;
gint start_x, start_y, end_x, end_y;
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(text));
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL, NULL);
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE(text));
if (widget == NULL) {
/* State is defunct */
return FALSE;
}
- g_assert(VTE_IS_TERMINAL (widget));
+
terminal = VTE_TERMINAL (widget);
g_assert(!vte_terminal_get_has_selection (terminal));
- priv = g_object_get_data(G_OBJECT(text),
- VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
+
xy_from_offset (priv, start_offset, &start_x, &start_y);
xy_from_offset (priv, end_offset, &end_x, &end_y);
_vte_terminal_select_text (terminal, start_x, start_y, end_x, end_y, start_offset, end_offset);
@@ -1581,18 +1460,18 @@ static gboolean
vte_terminal_accessible_remove_selection(AtkText *text,
gint selection_number)
{
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(text);
GtkWidget *widget;
VteTerminal *terminal;
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(text));
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL, NULL);
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE(text));
if (widget == NULL) {
/* State is defunct */
return FALSE;
}
- g_assert(VTE_IS_TERMINAL (widget));
+
terminal = VTE_TERMINAL (widget);
if (selection_number == 0 && vte_terminal_get_has_selection (terminal)) {
_vte_terminal_remove_selection (terminal);
@@ -1606,18 +1485,18 @@ static gboolean
vte_terminal_accessible_set_selection(AtkText *text, gint selection_number,
gint start_offset, gint end_offset)
{
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(text);
GtkWidget *widget;
VteTerminal *terminal;
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(text));
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL, NULL);
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE(text));
if (widget == NULL) {
/* State is defunct */
return FALSE;
}
- g_assert(VTE_IS_TERMINAL (widget));
+
terminal = VTE_TERMINAL (widget);
if (selection_number != 0) {
return FALSE;
@@ -1632,21 +1511,17 @@ vte_terminal_accessible_set_selection(AtkText *text, gint selection_number,
static gboolean
vte_terminal_accessible_set_caret_offset(AtkText *text, gint offset)
{
- g_assert(VTE_IS_TERMINAL_ACCESSIBLE(text));
- vte_terminal_accessible_update_private_data_if_needed(ATK_OBJECT(text),
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(text);
+
+ vte_terminal_accessible_update_private_data_if_needed(accessible,
NULL, NULL);
/* Whoa, very not allowed. */
return FALSE;
}
static void
-vte_terminal_accessible_text_init(gpointer iface, gpointer data)
+vte_terminal_accessible_text_iface_init(AtkTextIface *text)
{
- AtkTextIface *text;
- g_assert(G_TYPE_FROM_INTERFACE(iface) == ATK_TYPE_TEXT);
- text = iface;
- _vte_debug_print(VTE_DEBUG_ALLY,
- "Initializing accessible peer's AtkText interface.\n");
text->get_text = vte_terminal_accessible_get_text;
text->get_text_after_offset = vte_terminal_accessible_get_text_after_offset;
text->get_text_at_offset = vte_terminal_accessible_get_text_at_offset;
@@ -1692,70 +1567,6 @@ vte_terminal_accessible_contains(AtkComponent *component,
(y < ey + eheight));
}
-static void
-vte_terminal_accessible_get_extents(AtkComponent *component,
- gint *x, gint *y,
- gint *width, gint *height,
- AtkCoordType coord_type)
-{
- atk_component_get_position(component, x, y, coord_type);
- atk_component_get_size(component, width, height);
-}
-
-static void
-vte_terminal_accessible_get_position(AtkComponent *component,
- gint *x, gint *y,
- AtkCoordType coord_type)
-{
- GtkWidget *widget;
- *x = 0;
- *y = 0;
- widget = gtk_accessible_get_widget (GTK_ACCESSIBLE(component));
- if (widget == NULL) {
- return;
- }
- if (!gtk_widget_get_realized(widget)) {
- return;
- }
- switch (coord_type) {
- case ATK_XY_SCREEN:
- gdk_window_get_origin(gtk_widget_get_window (widget), x, y);
- break;
- case ATK_XY_WINDOW:
- gdk_window_get_position(gtk_widget_get_window (widget), x, y);
- break;
- default:
- g_assert_not_reached();
- break;
- }
-}
-
-static void
-vte_terminal_accessible_get_size(AtkComponent *component,
- gint *width, gint *height)
-{
- GtkWidget *widget;
- GdkWindow *window;
- *width = 0;
- *height = 0;
- widget = gtk_accessible_get_widget (GTK_ACCESSIBLE(component));
- if (widget == NULL) {
- return;
- }
- if (!gtk_widget_get_realized(widget)) {
- return;
- }
- window = gtk_widget_get_window (widget);
-#if GTK_CHECK_VERSION (2, 90, 8)
- if (width)
- *width = gdk_window_get_width (window);
- if (height)
- *height = gdk_window_get_height (window);
-#else
- gdk_drawable_get_size(window, width, height);
-#endif
-}
-
static gboolean
vte_terminal_accessible_set_extents(AtkComponent *component,
gint x, gint y,
@@ -1780,25 +1591,21 @@ static gboolean
vte_terminal_accessible_set_size(AtkComponent *component,
gint width, gint height)
{
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(component);
VteTerminal *terminal;
- gint columns, rows, char_width, char_height;
+ long columns, rows;
GtkWidget *widget;
- GtkBorder *inner_border;
- widget = gtk_accessible_get_widget (GTK_ACCESSIBLE(component));
+ widget = gtk_accessible_get_widget (GTK_ACCESSIBLE(accessible));
if (widget == NULL) {
return FALSE;
}
terminal = VTE_TERMINAL(widget);
- char_width = vte_terminal_get_char_width (terminal);
- char_height = vte_terminal_get_char_height (terminal);
- gtk_widget_style_get (widget, "inner-border", &inner_border, NULL);
- /* If the size is an exact multiple of the cell size, use that,
- * otherwise round down. */
- columns = (width - (inner_border ? (inner_border->left + inner_border->right) : 0)) / char_width;
- rows = (height - (inner_border ? (inner_border->top + inner_border->bottom) : 0)) / char_height;
- gtk_border_free (inner_border);
+ /* If the size is an exact multiple of the cell size, use that,
+ * otherwise round down. */
+ (void) _vte_terminal_size_to_grid_size(terminal, width, height, &columns, &rows);
+
vte_terminal_set_size(terminal, columns, rows);
return (vte_terminal_get_row_count (terminal) == rows) &&
(vte_terminal_get_column_count (terminal) == columns);
@@ -1843,22 +1650,11 @@ vte_terminal_accessible_remove_focus_handler(AtkComponent *component,
}
static void
-vte_terminal_accessible_component_init(gpointer iface, gpointer data)
+vte_terminal_accessible_component_iface_init(AtkComponentIface *component)
{
- AtkComponentIface *component;
- g_assert(G_TYPE_FROM_INTERFACE(iface) == ATK_TYPE_COMPONENT);
- component = iface;
-
- _vte_debug_print(VTE_DEBUG_ALLY,
- "Initializing accessible peer's "
- "AtkComponent interface.\n");
- /* Set our virtual functions. */
component->add_focus_handler = vte_terminal_accessible_add_focus_handler;
component->contains = vte_terminal_accessible_contains;
component->ref_accessible_at_point = vte_terminal_accessible_ref_accessible_at_point;
- component->get_extents = vte_terminal_accessible_get_extents;
- component->get_position = vte_terminal_accessible_get_position;
- component->get_size = vte_terminal_accessible_get_size;
component->remove_focus_handler = vte_terminal_accessible_remove_focus_handler;
component->set_extents = vte_terminal_accessible_set_extents;
component->set_position = vte_terminal_accessible_set_position;
@@ -1900,19 +1696,13 @@ vte_terminal_accessible_get_n_actions (AtkAction *accessible)
}
static const char *
-vte_terminal_accessible_action_get_description (AtkAction *accessible, int i)
+vte_terminal_accessible_action_get_description (AtkAction *action, int i)
{
- VteTerminalAccessiblePrivate *priv;
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(action);
+ VteTerminalAccessiblePrivate *priv = _vte_terminal_accessible_get_instance_private(accessible);
g_return_val_if_fail (i < LAST_ACTION, NULL);
- g_return_val_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(accessible), NULL);
-
- /* Retrieve the private data structure. It must already exist. */
- priv = g_object_get_data(G_OBJECT(accessible),
- VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
- g_return_val_if_fail(priv != NULL, NULL);
-
if (priv->action_descriptions[i]) {
return priv->action_descriptions[i];
} else {
@@ -1937,21 +1727,15 @@ vte_terminal_accessible_action_get_keybinding (AtkAction *accessible, int i)
}
static gboolean
-vte_terminal_accessible_action_set_description (AtkAction *accessible,
+vte_terminal_accessible_action_set_description (AtkAction *action,
int i,
const char *description)
{
- VteTerminalAccessiblePrivate *priv;
+ VteTerminalAccessible *accessible = VTE_TERMINAL_ACCESSIBLE(action);
+ VteTerminalAccessiblePrivate *priv = _vte_terminal_accessible_get_instance_private(accessible);
g_return_val_if_fail (i < LAST_ACTION, FALSE);
- g_return_val_if_fail(VTE_IS_TERMINAL_ACCESSIBLE(accessible), FALSE);
-
- /* Retrieve the private data structure. It must already exist. */
- priv = g_object_get_data(G_OBJECT(accessible),
- VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA);
- g_return_val_if_fail(priv != NULL, FALSE);
-
if (priv->action_descriptions[i]) {
g_free (priv->action_descriptions[i]);
}
@@ -1961,16 +1745,8 @@ vte_terminal_accessible_action_set_description (AtkAction *accessible,
}
static void
-vte_terminal_accessible_action_init(gpointer iface, gpointer data)
+vte_terminal_accessible_action_iface_init(AtkActionIface *action)
{
- AtkActionIface *action;
- g_return_if_fail(G_TYPE_FROM_INTERFACE(iface) == ATK_TYPE_ACTION);
- action = iface;
-
- _vte_debug_print(VTE_DEBUG_ALLY,
- "Initializing accessible peer's "
- "AtkAction interface.\n");
- /* Set our virtual functions. */
action->do_action = vte_terminal_accessible_do_action;
action->get_n_actions = vte_terminal_accessible_get_n_actions;
action->get_description = vte_terminal_accessible_action_get_description;
@@ -1978,149 +1754,14 @@ vte_terminal_accessible_action_init(gpointer iface, gpointer data)
action->get_keybinding = vte_terminal_accessible_action_get_keybinding;
action->set_description = vte_terminal_accessible_action_set_description;
}
+
static void
-vte_terminal_accessible_class_init(gpointer *klass)
+_vte_terminal_accessible_class_init(VteTerminalAccessibleClass *klass)
{
- GObjectClass *gobject_class;
+ GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
- vte_terminal_accessible_parent_class = g_type_class_peek_parent (klass);
-
- gobject_class = G_OBJECT_CLASS(klass);
-
- class->initialize = vte_terminal_initialize;
- /* Override the finalize method. */
gobject_class->finalize = vte_terminal_accessible_finalize;
-}
-
-GType
-vte_terminal_accessible_get_type(void)
-{
- static GType terminal_accessible_type = 0;
-
- if (G_UNLIKELY (terminal_accessible_type == 0)) {
- AtkRegistry *registry;
- AtkObjectFactory *factory;
- GType parent_type, parent_accessible_type;
- GTypeQuery type_info;
-
- GInterfaceInfo text = {
- vte_terminal_accessible_text_init,
- NULL,
- NULL,
- };
- GInterfaceInfo component = {
- vte_terminal_accessible_component_init,
- NULL,
- NULL,
- };
- GInterfaceInfo action = {
- vte_terminal_accessible_action_init,
- NULL,
- NULL,
- };
- GTypeInfo terminal_accessible_info = {
- 0,
- (GBaseInitFunc)NULL,
- (GBaseFinalizeFunc)NULL,
-
- (GClassInitFunc)vte_terminal_accessible_class_init,
- (GClassFinalizeFunc)NULL,
- (gconstpointer)NULL,
-
- 0,
- 0,
- (GInstanceInitFunc) NULL,
-
- (GTypeValueTable*)NULL,
- };
-
- /* Find the Atk object used for the parent (GtkWidget) type. */
- parent_type = g_type_parent(VTE_TYPE_TERMINAL);
- factory = atk_registry_get_factory(atk_get_default_registry(),
- parent_type);
- parent_accessible_type = atk_object_factory_get_accessible_type(factory);
- if (!g_type_is_a(parent_accessible_type, GTK_TYPE_ACCESSIBLE)) {
-#ifdef VTE_DEBUG
- g_warning("Accessibility (%s) is not derived from "
- "%s (GTK_MODULES=gail not set?), "
- "deriving from %s instead.\n",
- g_type_name(parent_accessible_type),
- g_type_name(GTK_TYPE_ACCESSIBLE),
- g_type_name(GTK_TYPE_ACCESSIBLE));
-#endif
- /* Fudge it. */
- parent_accessible_type = GTK_TYPE_ACCESSIBLE;
- }
-
- /* Find the size of the parent type's objects. */
- g_type_query(parent_accessible_type, &type_info);
- terminal_accessible_info.class_size = type_info.class_size;
- terminal_accessible_info.instance_size = type_info.instance_size;
- /* Register the class with the GObject type system. */
- terminal_accessible_type = g_type_register_static(parent_accessible_type,
- "VteTerminalAccessible",
- &terminal_accessible_info,
- 0);
-
- /* Add a text interface to this object class. */
- g_type_add_interface_static(terminal_accessible_type,
- ATK_TYPE_TEXT,
- &text);
- /* Add a component interface to this object class. */
- g_type_add_interface_static(terminal_accessible_type,
- ATK_TYPE_COMPONENT,
- &component);
- /* Add an action interface to this object class. */
- g_type_add_interface_static(terminal_accessible_type,
- ATK_TYPE_ACTION,
- &action);
-
- /* Associate the terminal and its peer factory in the
- * Atk type registry. */
- registry = atk_get_default_registry();
- atk_registry_set_factory_type(registry,
- VTE_TYPE_TERMINAL,
- VTE_TYPE_TERMINAL_ACCESSIBLE_FACTORY);
- }
-
- return terminal_accessible_type;
-}
-
-/* Create an accessible peer for the object. */
-static AtkObject *
-vte_terminal_accessible_factory_create_accessible(GObject *obj)
-{
- GtkAccessible *accessible;
- VteTerminal *terminal;
-
- g_assert(VTE_IS_TERMINAL(obj));
-
- terminal = VTE_TERMINAL(obj);
- accessible = GTK_ACCESSIBLE(vte_terminal_accessible_new(terminal));
- g_assert(accessible != NULL);
- return ATK_OBJECT(accessible);
+ class->initialize = vte_terminal_accessible_initialize;
}
-
-static void
-vte_terminal_accessible_factory_class_init(VteTerminalAccessibleFactoryClass *klass)
-{
- AtkObjectFactoryClass *class = ATK_OBJECT_FACTORY_CLASS(klass);
- /* Override the one method we care about. */
- class->create_accessible = vte_terminal_accessible_factory_create_accessible;
-}
-static void
-vte_terminal_accessible_factory_init(VteTerminalAccessibleFactory *self)
-{
- /* nothing to initialise */
-}
-
-AtkObjectFactory *
-vte_terminal_accessible_factory_new(void)
-{
- _vte_debug_print(VTE_DEBUG_ALLY,
- "Creating a new VteTerminalAccessibleFactory.\n");
- return g_object_new(VTE_TYPE_TERMINAL_ACCESSIBLE_FACTORY, NULL);
-}
-
diff --git a/src/vteaccess.h b/src/vteaccess.h
index 7204d37f..cdb5e3cd 100644
--- a/src/vteaccess.h
+++ b/src/vteaccess.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef vte_vteaccess_h_included
@@ -22,18 +22,19 @@
#include <glib.h>
#include <gtk/gtk.h>
+#include <gtk/gtk-a11y.h>
#include "vte.h"
G_BEGIN_DECLS
-#define VTE_TYPE_TERMINAL_ACCESSIBLE (vte_terminal_accessible_get_type ())
+#define VTE_TYPE_TERMINAL_ACCESSIBLE (_vte_terminal_accessible_get_type ())
#define VTE_TERMINAL_ACCESSIBLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), VTE_TYPE_TERMINAL_ACCESSIBLE, VteTerminalAccessible))
#define VTE_TERMINAL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VTE_TYPE_TERMINAL_ACCESSIBLE, VteTerminalAccessibleClass))
#define VTE_IS_TERMINAL_ACCESSIBLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), VTE_TYPE_TERMINAL_ACCESSIBLE))
#define VTE_IS_TERMINAL_ACCESSIBLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VTE_TYPE_TERMINAL_ACCESSIBLE))
#define VTE_TERMINAL_ACCESSIBLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VTE_TYPE_TERMINAL_ACCESSIBLE, VteTerminalAccessibleClass))
-typedef struct _VteTerminalAccessible VteTerminalAccessible;
+typedef struct _VteTerminalAccessible VteTerminalAccessible;
typedef struct _VteTerminalAccessibleClass VteTerminalAccessibleClass;
/**
@@ -42,44 +43,14 @@ typedef struct _VteTerminalAccessibleClass VteTerminalAccessibleClass;
* The accessible peer for #VteTerminal.
*/
struct _VteTerminalAccessible {
- GtkAccessible parent;
- /*< private > */
- /* Unknown GailWidget implementation stuffs, exact size of which is
- * worked out at run-time. */
+ GtkWidgetAccessible parent;
};
struct _VteTerminalAccessibleClass {
- GtkAccessibleClass parent_class;
- /*< private > */
- /* Unknown GailWidgetClass implementation stuffs, exact size of which
- * is worked out at run-time. */
+ GtkWidgetAccessibleClass parent_class;
};
-GType vte_terminal_accessible_get_type(void);
-
-AtkObject *vte_terminal_accessible_new(VteTerminal *terminal);
-
-#define VTE_TYPE_TERMINAL_ACCESSIBLE_FACTORY (vte_terminal_accessible_factory_get_type ())
-#define VTE_TERMINAL_ACCESSIBLE_FACTORY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), VTE_TYPE_TERMINAL_ACCESSIBLE_FACTORY, VteTerminalAccessibleFactory))
-#define VTE_TERMINAL_ACCESSIBLE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VTE_TYPE_TERMINAL_ACCESSIBLE_FACTORY, VteTerminalAccessibleFactoryClass))
-#define VTE_IS_TERMINAL_ACCESSIBLE_FACTORY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), VTE_TYPE_TERMINAL_ACCESSIBLE_FACTORY))
-#define VTE_IS_TERMINAL_ACCESSIBLE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VTE_TYPE_TERMINAL_ACCESSIBLE_FACTORY))
-#define VTE_TERMINAL_ACCESSIBLE_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VTE_TYPE_TERMINAL_ACCESSIBLE_FACTORY, VteTerminalAccessibleFactoryClass))
-
-typedef struct _VteTerminalAccessibleFactory VteTerminalAccessibleFactory;
-typedef struct _VteTerminalAccessibleFactoryClass VteTerminalAccessibleFactoryClass;
-
-struct _VteTerminalAccessibleFactory {
- AtkObjectFactory parent;
-};
-
-struct _VteTerminalAccessibleFactoryClass {
- AtkObjectFactoryClass parent;
-};
-
-GType vte_terminal_accessible_factory_get_type(void);
-
-AtkObjectFactory *vte_terminal_accessible_factory_new(void);
+GType _vte_terminal_accessible_get_type(void);
G_END_DECLS
diff --git a/src/vteapp.c b/src/vteapp.c
index c6ab68ae..8f6a364a 100644
--- a/src/vteapp.c
+++ b/src/vteapp.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2001,2002 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -36,7 +36,13 @@
#include <glib/gi18n.h>
#define DINGUS1 "(((gopher|news|telnet|nntp|file|http|ftp|https)://)|(www|ftp)[-A-Za-z0-9]*\\.)[-A-Za-z0-9\\.]+(:[0-9]*)?"
-#define DINGUS2 "(((gopher|news|telnet|nntp|file|http|ftp|https)://)|(www|ftp)[-A-Za-z0-9]*\\.)[-A-Za-z0-9\\.]+(:[0-9]*)?/[-A-Za-z0-9_\\$\\.\\+\\!\\*\\(\\),;:@&=\\?/~\\#\\%]*[^]'\\.}>\\) ,\\\"]"
+#define DINGUS2 DINGUS1 "/[-A-Za-z0-9_\\$\\.\\+\\!\\*\\(\\),;:@&=\\?/~\\#\\%]*[^]'\\.}>\\) ,\\\"]"
+
+static const char *builtin_dingus[] = {
+ DINGUS1,
+ DINGUS2,
+ NULL
+};
static void
window_title_changed(GtkWidget *widget, gpointer win)
@@ -45,89 +51,43 @@ window_title_changed(GtkWidget *widget, gpointer win)
g_assert(VTE_TERMINAL(widget));
g_assert(GTK_IS_WINDOW(win));
- g_assert(VTE_TERMINAL(widget)->window_title != NULL);
window = GTK_WINDOW(win);
- gtk_window_set_title(window, VTE_TERMINAL(widget)->window_title);
+ gtk_window_set_title(window, vte_terminal_get_window_title(VTE_TERMINAL(widget)));
}
static void
icon_title_changed(GtkWidget *widget, gpointer win)
{
- GtkWindow *window;
-
g_assert(VTE_TERMINAL(widget));
g_assert(GTK_IS_WINDOW(win));
- g_assert(VTE_TERMINAL(widget)->icon_title != NULL);
- window = GTK_WINDOW(win);
g_message("Icon title changed to \"%s\".\n",
- VTE_TERMINAL(widget)->icon_title);
+ vte_terminal_get_icon_title(VTE_TERMINAL(widget)));
}
static void
char_size_changed(GtkWidget *widget, guint width, guint height, gpointer data)
{
- VteTerminal *terminal;
- GtkWindow *window;
- GdkGeometry geometry;
- GtkBorder *inner_border;
-
- g_assert(GTK_IS_WINDOW(data));
- g_assert(VTE_IS_TERMINAL(widget));
+ VteTerminal *terminal = VTE_TERMINAL(widget);
+ GtkWindow *window = GTK_WINDOW(data);
- terminal = VTE_TERMINAL(widget);
- window = GTK_WINDOW(data);
- if (!gtk_widget_get_realized (GTK_WIDGET (window)))
+ if (!gtk_widget_get_realized (widget))
return;
- gtk_widget_style_get (widget, "inner-border", &inner_border, NULL);
- geometry.width_inc = width;
- geometry.height_inc = height;
- geometry.base_width = inner_border ? (inner_border->left + inner_border->right) : 0;
- geometry.base_height = inner_border ? (inner_border->top + inner_border->bottom) : 0;
- geometry.min_width = geometry.base_width + width * 2;
- geometry.min_height = geometry.base_height + height * 2;
- gtk_border_free (inner_border);
-
- gtk_window_set_geometry_hints(window, widget, &geometry,
- GDK_HINT_RESIZE_INC |
- GDK_HINT_BASE_SIZE |
- GDK_HINT_MIN_SIZE);
+ vte_terminal_set_geometry_hints_for_window(terminal, window);
}
static void
char_size_realized(GtkWidget *widget, gpointer data)
{
- VteTerminal *terminal;
- GtkWindow *window;
- GdkGeometry geometry;
- guint width, height;
- GtkBorder *inner_border;
+ VteTerminal *terminal = VTE_TERMINAL(widget);
+ GtkWindow *window = GTK_WINDOW(data);
- g_assert(GTK_IS_WINDOW(data));
- g_assert(VTE_IS_TERMINAL(widget));
+ if (!gtk_widget_get_realized (widget))
+ return;
- terminal = VTE_TERMINAL(widget);
- window = GTK_WINDOW(data);
- if (!gtk_widget_get_realized (GTK_WIDGET(window)))
- return;
-
- gtk_widget_style_get (widget, "inner-border", &inner_border, NULL);
- width = vte_terminal_get_char_width (terminal);
- height = vte_terminal_get_char_height (terminal);
- geometry.width_inc = width;
- geometry.height_inc = height;
- geometry.base_width = inner_border ? (inner_border->left + inner_border->right) : 0;
- geometry.base_height = inner_border ? (inner_border->top + inner_border->bottom) : 0;
- geometry.min_width = geometry.base_width + width * 2;
- geometry.min_height = geometry.base_height + height * 2;
- gtk_border_free (inner_border);
-
- gtk_window_set_geometry_hints(window, widget, &geometry,
- GDK_HINT_RESIZE_INC |
- GDK_HINT_BASE_SIZE |
- GDK_HINT_MIN_SIZE);
+ vte_terminal_set_geometry_hints_for_window(terminal, window);
}
@@ -146,7 +106,7 @@ destroy_and_quit(VteTerminal *terminal, GtkWidget *window)
if (stream) {
vte_terminal_write_contents (terminal, stream,
- VTE_TERMINAL_WRITE_DEFAULT,
+ VTE_WRITE_DEFAULT,
NULL, &error);
g_object_unref (stream);
}
@@ -168,10 +128,9 @@ delete_event(GtkWidget *window, GdkEvent *event, gpointer terminal)
destroy_and_quit(VTE_TERMINAL (terminal), window);
}
static void
-child_exited(GtkWidget *terminal, gpointer window)
+child_exited(GtkWidget *terminal, int status, gpointer window)
{
- _vte_debug_print(VTE_DEBUG_MISC, "Child exited with status %x\n",
- vte_terminal_get_child_exit_status (VTE_TERMINAL (terminal)));
+ _vte_debug_print(VTE_DEBUG_MISC, "Child exited with status %x\n", status);
destroy_and_quit(VTE_TERMINAL (terminal), GTK_WIDGET (window));
}
@@ -188,21 +147,22 @@ button_pressed(GtkWidget *widget, GdkEventButton *event, gpointer data)
VteTerminal *terminal;
char *match;
int tag;
- GtkBorder *inner_border;
+ GtkBorder padding;
int char_width, char_height;
switch (event->button) {
case 3:
terminal = VTE_TERMINAL(widget);
- gtk_widget_style_get (widget, "inner-border", &inner_border, NULL);
- char_width = vte_terminal_get_char_width (terminal);
+ gtk_style_context_get_padding(gtk_widget_get_style_context(widget),
+ gtk_widget_get_state_flags(widget),
+ &padding);
+ char_width = vte_terminal_get_char_width (terminal);
char_height = vte_terminal_get_char_height (terminal);
match = vte_terminal_match_check(terminal,
- (event->x - (inner_border ? inner_border->left : 0)) / char_width,
- (event->y - (inner_border ? inner_border->top : 0)) / char_height,
+ (event->x - padding.left) / char_width,
+ (event->y - padding.top) / char_height,
&tag);
- gtk_border_free (inner_border);
if (match != NULL) {
g_print("Matched `%s' (%d).\n", match, tag);
g_free(match);
@@ -309,7 +269,7 @@ resize_window(GtkWidget *widget, guint width, guint height, gpointer data)
if ((GTK_IS_WINDOW(data)) && (width >= 2) && (height >= 2)) {
gint owidth, oheight, char_width, char_height, column_count, row_count;
- GtkBorder *inner_border;
+ GtkBorder padding;
terminal = VTE_TERMINAL(widget);
@@ -320,17 +280,14 @@ resize_window(GtkWidget *widget, guint width, guint height, gpointer data)
char_height = vte_terminal_get_char_height (terminal);
column_count = vte_terminal_get_column_count (terminal);
row_count = vte_terminal_get_row_count (terminal);
- gtk_widget_style_get (widget, "inner-border", &inner_border, NULL);
+ gtk_style_context_get_padding(gtk_widget_get_style_context(widget),
+ gtk_widget_get_state_flags(widget),
+ &padding);
- owidth -= char_width * column_count;
- oheight -= char_height * row_count;
- if (inner_border != NULL) {
- owidth -= inner_border->left + inner_border->right;
- oheight -= inner_border->top + inner_border->bottom;
- }
+ owidth -= char_width * column_count + padding.left + padding.right;
+ oheight -= char_height * row_count + padding.top + padding.bottom;
gtk_window_resize(GTK_WINDOW(data),
width + owidth, height + oheight);
- gtk_border_free (inner_border);
}
}
@@ -348,50 +305,47 @@ move_window(GtkWidget *widget, guint x, guint y, gpointer data)
}
static void
-adjust_font_size(GtkWidget *widget, gpointer data, gint howmuch)
+adjust_font_size(GtkWidget *widget, gpointer data, gdouble factor)
{
VteTerminal *terminal;
- PangoFontDescription *desired;
- gint newsize;
+ gdouble scale;
+ glong char_width, char_height;
gint columns, rows, owidth, oheight;
/* Read the screen dimensions in cells. */
terminal = VTE_TERMINAL(widget);
- columns = terminal->column_count;
- rows = terminal->row_count;
+ columns = vte_terminal_get_column_count(terminal);
+ rows = vte_terminal_get_row_count(terminal);
/* Take into account padding and border overhead. */
gtk_window_get_size(GTK_WINDOW(data), &owidth, &oheight);
- owidth -= terminal->char_width * terminal->column_count;
- oheight -= terminal->char_height * terminal->row_count;
-
- /* Calculate the new font size. */
- desired = pango_font_description_copy(vte_terminal_get_font(terminal));
- newsize = pango_font_description_get_size(desired) / PANGO_SCALE;
- newsize += howmuch;
- pango_font_description_set_size(desired,
- CLAMP(newsize, 4, 144) * PANGO_SCALE);
-
- /* Change the font, then resize the window so that we have the same
- * number of rows and columns. */
- vte_terminal_set_font(terminal, desired);
- gtk_window_resize(GTK_WINDOW(data),
- columns * terminal->char_width + owidth,
- rows * terminal->char_height + oheight);
+ char_width = vte_terminal_get_char_width (terminal);
+ char_height = vte_terminal_get_char_height (terminal);
+ owidth -= char_width * columns;
+ oheight -= char_height * rows;
+
+ scale = vte_terminal_get_font_scale(terminal);
+ vte_terminal_set_font_scale(terminal, scale * factor);
+
+ /* This above call will have changed the char size! */
+ char_width = vte_terminal_get_char_width (terminal);
+ char_height = vte_terminal_get_char_height (terminal);
- pango_font_description_free(desired);
+ gtk_window_resize(GTK_WINDOW(data),
+ columns * char_width + owidth,
+ rows * char_height + oheight);
}
static void
increase_font_size(GtkWidget *widget, gpointer data)
{
- adjust_font_size(widget, data, 1);
+ adjust_font_size(widget, data, 1.2);
}
static void
decrease_font_size(GtkWidget *widget, gpointer data)
{
- adjust_font_size(widget, data, -1);
+ adjust_font_size(widget, data, 1. / 1.2);
}
static gboolean
@@ -411,7 +365,7 @@ read_and_feed(GIOChannel *source, GIOCondition condition, gpointer data)
}
static void
-disconnect_watch(GtkWidget *widget, gpointer data)
+disconnect_watch(gpointer data)
{
g_source_remove(GPOINTER_TO_INT(data));
}
@@ -430,12 +384,14 @@ take_xconsole_ownership(GtkWidget *widget, gpointer data)
char *name, hostname[255];
GdkAtom atom;
GtkClipboard *clipboard;
- const GtkTargetEntry targets[] = {
- {"UTF8_STRING", 0, 0},
- {"COMPOUND_TEXT", 0, 0},
- {"TEXT", 0, 0},
- {"STRING", 0, 0},
- };
+ GtkTargetList *target_list;
+ GtkTargetEntry *targets;
+ int n_targets;
+
+ target_list = gtk_target_list_new(NULL, 0);
+ gtk_target_list_add_text_targets(target_list, 0);
+ targets = gtk_target_table_new_from_list (target_list, &n_targets);
+ gtk_target_list_unref(target_list);
memset(hostname, '\0', sizeof(hostname));
gethostname(hostname, sizeof(hostname) - 1);
@@ -448,7 +404,7 @@ take_xconsole_ownership(GtkWidget *widget, gpointer data)
gtk_clipboard_set_with_owner(clipboard,
targets,
- G_N_ELEMENTS(targets),
+ n_targets,
clipboard_get,
(GtkClipboardClearFunc)gtk_main_quit,
G_OBJECT(widget));
@@ -481,12 +437,40 @@ terminal_notify_cb(GObject *object,
g_value_unset(&value);
}
+/* Derived terminal class */
+
+typedef struct _VteappTerminal VteappTerminal;
+typedef struct _VteappTerminalClass VteappTerminalClass;
+
+struct _VteappTerminalClass {
+ VteTerminalClass parent_class;
+};
+struct _VteappTerminal {
+ VteTerminal parent_instance;
+};
+
+static GType vteapp_terminal_get_type(void);
+
+G_DEFINE_TYPE(VteappTerminal, vteapp_terminal, VTE_TYPE_TERMINAL)
+
+static void
+vteapp_terminal_class_init(VteappTerminalClass *klass)
+{
+}
+
static void
-child_exit_cb(VteTerminal *terminal,
- gpointer user_data)
+vteapp_terminal_init(VteappTerminal *terminal)
{
}
+static GtkWidget *
+vteapp_terminal_new(void)
+{
+ return g_object_new(vteapp_terminal_get_type(), NULL);
+}
+
+/* Command line options */
+
static int
parse_enum(GType type,
const char *string)
@@ -534,15 +518,48 @@ parse_flags(GType type,
return value;
}
+static gboolean
+parse_color (const gchar *value,
+ GdkRGBA *color)
+{
+ if (!gdk_rgba_parse(color, value)) {
+ g_printerr("Failed to parse value \"%s\" as color", value);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void
+add_dingus (VteTerminal *terminal,
+ char **dingus)
+{
+ const GdkCursorType cursors[] = { GDK_GUMBY, GDK_HAND1 };
+ GRegex *regex;
+ GError *error;
+ int id, i;
+
+ for (i = 0; dingus[i]; ++i) {
+ error = NULL;
+ if (!(regex = g_regex_new(dingus[i], G_REGEX_OPTIMIZE, 0, &error))) {
+ g_warning("Failed to compile regex '%s': %s\n",
+ dingus[i], error->message);
+ g_error_free(error);
+ continue;
+ }
+
+ id = vte_terminal_match_add_gregex(terminal, regex, 0);
+ g_regex_unref (regex);
+ vte_terminal_match_set_cursor_type(terminal, id,
+ cursors[i % G_N_ELEMENTS(cursors)]);
+ }
+}
+
int
main(int argc, char **argv)
{
GdkScreen *screen;
-#if GTK_CHECK_VERSION (2, 90, 8)
GdkVisual *visual;
-#else
- GdkColormap *colormap;
-#endif
GtkWidget *window, *widget,*hbox = NULL, *scrollbar, *scrolled_window = NULL;
VteTerminal *terminal;
char *env_add[] = {
@@ -550,16 +567,18 @@ main(int argc, char **argv)
(char *) "FOO=BAR", (char *) "BOO=BIZ",
#endif
NULL};
- const char *background = NULL;
- gboolean transparent = FALSE, audible = TRUE,
- debug = FALSE, dingus = FALSE, dbuffer = TRUE,
- console = FALSE, scroll = FALSE, keep = FALSE,
- icon_title = FALSE, shell = TRUE, highlight_set = FALSE,
- cursor_set = FALSE, reverse = FALSE, use_geometry_hints = TRUE,
- antialias = TRUE, use_scrolled_window = FALSE,
- show_object_notifications = FALSE;
+ char *transparent = NULL;
+ char *encoding = NULL;
+ char *cjk_ambiguous_width = NULL;
+ gboolean audible = TRUE,
+ debug = FALSE, no_builtin_dingus = FALSE, dbuffer = TRUE,
+ console = FALSE, keep = FALSE,
+ icon_title = FALSE, shell = TRUE,
+ reverse = FALSE, use_geometry_hints = TRUE,
+ use_scrolled_window = FALSE,
+ show_object_notifications = FALSE, rewrap = TRUE;
char *geometry = NULL;
- gint lines = 100;
+ gint lines = -1;
const char *message = "Launching interactive shell...\r\n";
const char *font = NULL;
const char *termcap = NULL;
@@ -570,27 +589,32 @@ main(int argc, char **argv)
char *cursor_blink_mode_string = NULL;
char *cursor_shape_string = NULL;
char *scrollbar_policy_string = NULL;
- GdkColor fore, back, tint, highlight, cursor;
+ char *border_width_string = NULL;
+ char *cursor_color_string = NULL;
+ char *highlight_foreground_color_string = NULL;
+ char *highlight_background_color_string = NULL;
+ char **dingus = NULL;
+ GdkRGBA fore, back;
const GOptionEntry options[]={
{
- "antialias", 'A', G_OPTION_FLAG_REVERSE,
- G_OPTION_ARG_NONE, &antialias,
- "Disable the use of anti-aliasing", NULL
- },
- {
- "background", 'B', 0,
- G_OPTION_ARG_FILENAME, &background,
- "Specify a background image", NULL
- },
- {
"console", 'C', 0,
G_OPTION_ARG_NONE, &console,
"Watch /dev/console", NULL
},
+ {
+ "no-builtin-dingus", 0, G_OPTION_FLAG_REVERSE,
+ G_OPTION_ARG_NONE, &no_builtin_dingus,
+ "Highlight URLs inside the terminal", NULL
+ },
+ {
+ "dingu", 'D', 0,
+ G_OPTION_ARG_STRING_ARRAY, &dingus,
+ "Add regex highlight", NULL
+ },
{
- "dingus", 'D', 0,
- G_OPTION_ARG_NONE, &dingus,
- "Highlight URLs inside the terminal", NULL
+ "no-rewrap", 'R', G_OPTION_FLAG_REVERSE,
+ G_OPTION_ARG_NONE, &rewrap,
+ "Disable rewrapping on resize", NULL
},
{
"shell", 'S', G_OPTION_FLAG_REVERSE,
@@ -599,8 +623,8 @@ main(int argc, char **argv)
},
{
"transparent", 'T', 0,
- G_OPTION_ARG_NONE, &transparent,
- "Enable the use of a transparent background", NULL
+ G_OPTION_ARG_STRING, &transparent,
+ "Enable the use of a transparent background", "ALPHA"
},
{
"double-buffer", '2', G_OPTION_FLAG_REVERSE,
@@ -634,9 +658,14 @@ main(int argc, char **argv)
"Set the size (in characters) and position", "GEOMETRY"
},
{
- "highlight", 'h', 0,
- G_OPTION_ARG_NONE, &highlight_set,
- "Enable distinct highlight color for selection", NULL
+ "highlight-foreground-color", 0, 0,
+ G_OPTION_ARG_STRING, &highlight_foreground_color_string,
+ "Enable distinct highlight foreground color for selection", NULL
+ },
+ {
+ "highlight-background-color", 0, 0,
+ G_OPTION_ARG_STRING, &highlight_background_color_string,
+ "Enable distinct highlight background color for selection", NULL
},
{
"icon-title", 'i', 0,
@@ -659,8 +688,8 @@ main(int argc, char **argv)
"Cursor blink mode (system|on|off)", "MODE"
},
{
- "color-cursor", 'r', 0,
- G_OPTION_ARG_NONE, &cursor_set,
+ "cursor-color", 0, 0,
+ G_OPTION_ARG_STRING, &cursor_color_string,
"Enable a colored cursor", NULL
},
{
@@ -669,16 +698,21 @@ main(int argc, char **argv)
"Set cursor shape (block|underline|ibeam)", NULL
},
{
- "scroll-background", 's', 0,
- G_OPTION_ARG_NONE, &scroll,
- "Enable a scrolling background", NULL
- },
- {
"termcap", 't', 0,
G_OPTION_ARG_STRING, &termcap,
"Specify the terminal emulation to use", NULL
},
{
+ "encoding", 0, 0,
+ G_OPTION_ARG_STRING, &encoding,
+ "Specify the terminal encoding to use", NULL
+ },
+ {
+ "cjk-width", 0, 0,
+ G_OPTION_ARG_STRING, &cjk_ambiguous_width,
+ "Specify the cjk ambiguous width to use for UTF-8 encoding", "NARROW|WIDE"
+ },
+ {
"working-directory", 'w', 0,
G_OPTION_ARG_FILENAME, &working_directory,
"Specify the initial working directory of the terminal",
@@ -723,21 +757,31 @@ main(int argc, char **argv)
G_OPTION_ARG_STRING, &pty_flags_string,
"PTY flags set from default|no-utmp|no-wtmp|no-lastlog|no-helper|no-fallback", NULL
},
+ {
+ "border-width", 0, 0,
+ G_OPTION_ARG_STRING, &border_width_string,
+ "Border with", "WIDTH"
+ },
{ NULL }
};
GOptionContext *context;
GError *error = NULL;
- VteTerminalCursorBlinkMode cursor_blink_mode = VTE_CURSOR_BLINK_SYSTEM;
- VteTerminalCursorShape cursor_shape = VTE_CURSOR_SHAPE_BLOCK;
+ VteCursorBlinkMode cursor_blink_mode = VTE_CURSOR_BLINK_SYSTEM;
+ VteCursorShape cursor_shape = VTE_CURSOR_SHAPE_BLOCK;
GtkPolicyType scrollbar_policy = GTK_POLICY_ALWAYS;
VtePtyFlags pty_flags = VTE_PTY_DEFAULT;
+ _vte_debug_init();
+
/* Have to do this early. */
if (getenv("VTE_PROFILE_MEMORY")) {
if (atol(getenv("VTE_PROFILE_MEMORY")) != 0) {
g_mem_set_vtable(glib_mem_profiler_table);
}
}
+ if (g_getenv("VTE_CJK_WIDTH")) {
+ g_printerr("VTE_CJK_WIDTH is not supported anymore, use --cjk-width instead\n");
+ }
context = g_option_context_new (" - test VTE terminal emulation");
g_option_context_add_main_entries (context, options, NULL);
@@ -752,11 +796,11 @@ main(int argc, char **argv)
}
if (cursor_blink_mode_string) {
- cursor_blink_mode = parse_enum(VTE_TYPE_TERMINAL_CURSOR_BLINK_MODE, cursor_blink_mode_string);
+ cursor_blink_mode = parse_enum(VTE_TYPE_CURSOR_BLINK_MODE, cursor_blink_mode_string);
g_free(cursor_blink_mode_string);
}
if (cursor_shape_string) {
- cursor_shape = parse_enum(VTE_TYPE_TERMINAL_CURSOR_SHAPE, cursor_shape_string);
+ cursor_shape = parse_enum(VTE_TYPE_CURSOR_SHAPE, cursor_shape_string);
g_free(cursor_shape_string);
}
if (scrollbar_policy_string) {
@@ -769,19 +813,13 @@ main(int argc, char **argv)
}
if (!reverse) {
- back.red = back.green = back.blue = 0xffff;
- fore.red = fore.green = fore.blue = 0x0000;
+ back.red = back.green = back.blue = 1.0; back.alpha = 1.0;
+ fore.red = fore.green = fore.blue = 0.0; fore.alpha = 1.0;
} else {
- back.red = back.green = back.blue = 0x0000;
- fore.red = fore.green = fore.blue = 0xffff;
+ back.red = back.green = back.blue = 0.0; back.alpha = 1.0;
+ fore.red = fore.green = fore.blue = 1.0; fore.alpha = 1.0;
}
- highlight.red = highlight.green = highlight.blue = 0xc000;
- cursor.red = 0xffff;
- cursor.green = cursor.blue = 0x8000;
- tint.red = tint.green = tint.blue = 0;
- tint = back;
-
gdk_window_set_debug_updates(debug);
/* Create a window to hold the scrolling shell, and hook its
@@ -789,18 +827,19 @@ main(int argc, char **argv)
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_container_set_resize_mode(GTK_CONTAINER(window),
GTK_RESIZE_IMMEDIATE);
+ if (border_width_string) {
+ guint w;
- /* Set ARGB colormap */
+ w = g_ascii_strtoull (border_width_string, NULL, 10);
+ gtk_container_set_border_width(GTK_CONTAINER(window), w);
+ g_free (border_width_string);
+ }
+
+ /* Set ARGB visual */
screen = gtk_widget_get_screen (window);
-#if GTK_CHECK_VERSION (2, 90, 8)
visual = gdk_screen_get_rgba_visual(screen);
if (visual)
gtk_widget_set_visual(GTK_WIDGET(window), visual);
-#else
- colormap = gdk_screen_get_rgba_colormap (screen);
- if (colormap)
- gtk_widget_set_colormap(window, colormap);
-#endif
if (use_scrolled_window) {
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
@@ -814,12 +853,11 @@ main(int argc, char **argv)
}
/* Create the terminal widget and add it to the scrolling shell. */
- widget = vte_terminal_new();
+ widget = vteapp_terminal_new();
terminal = VTE_TERMINAL (widget);
- if (!dbuffer) {
+ if (!dbuffer) {
gtk_widget_set_double_buffered(widget, dbuffer);
}
- g_signal_connect(terminal, "child-exited", G_CALLBACK(child_exit_cb), NULL);
if (show_object_notifications)
g_signal_connect(terminal, "notify", G_CALLBACK(terminal_notify_cb), NULL);
if (use_scrolled_window) {
@@ -883,7 +921,7 @@ main(int argc, char **argv)
if (!use_scrolled_window) {
/* Create the scrollbar for the widget. */
- scrollbar = gtk_vscrollbar_new(terminal->adjustment);
+ scrollbar = gtk_vscrollbar_new(gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(terminal)));
gtk_box_pack_start(GTK_BOX(hbox), scrollbar, FALSE, FALSE, 0);
}
@@ -891,53 +929,80 @@ main(int argc, char **argv)
vte_terminal_set_audible_bell(terminal, audible);
vte_terminal_set_visible_bell(terminal, !audible);
vte_terminal_set_cursor_blink_mode(terminal, cursor_blink_mode);
- vte_terminal_set_scroll_background(terminal, scroll);
vte_terminal_set_scroll_on_output(terminal, FALSE);
vte_terminal_set_scroll_on_keystroke(terminal, TRUE);
vte_terminal_set_scrollback_lines(terminal, lines);
vte_terminal_set_mouse_autohide(terminal, TRUE);
- if (background != NULL) {
- vte_terminal_set_background_image_file(terminal,
- background);
- }
- if (transparent) {
- vte_terminal_set_background_transparent(terminal,
- TRUE);
+
+ if (transparent != NULL) {
+ back.alpha = g_ascii_strtod (transparent, NULL);
+ g_free (transparent);
+ }
+
+ vte_terminal_set_colors_rgba(terminal, &fore, &back, NULL, 0);
+
+ if (cursor_color_string) {
+ GdkRGBA rgba;
+ if (parse_color (cursor_color_string, &rgba))
+ vte_terminal_set_color_cursor_rgba(terminal, &rgba);
+ g_free(cursor_color_string);
}
- vte_terminal_set_background_tint_color(terminal, &tint);
- vte_terminal_set_colors(terminal, &fore, &back, NULL, 0);
- vte_terminal_set_opacity(terminal, 0xdddd);
- if (highlight_set) {
- vte_terminal_set_color_highlight(terminal,
- &highlight);
+ if (highlight_foreground_color_string) {
+ GdkRGBA rgba;
+ if (parse_color (highlight_foreground_color_string, &rgba))
+ vte_terminal_set_color_cursor_rgba(terminal, &rgba);
+ g_free(highlight_foreground_color_string);
}
- if (cursor_set) {
- vte_terminal_set_color_cursor(terminal, &cursor);
+ if (highlight_background_color_string) {
+ GdkRGBA rgba;
+ if (parse_color (highlight_background_color_string, &rgba))
+ vte_terminal_set_color_cursor_rgba(terminal, &rgba);
+ g_free(highlight_background_color_string);
}
+
if (termcap != NULL) {
vte_terminal_set_emulation(terminal, termcap);
}
+ if (encoding != NULL) {
+ vte_terminal_set_encoding(terminal, encoding);
+ g_free(encoding);
+ }
+ if (cjk_ambiguous_width != NULL) {
+ int width = 1;
+
+ if (g_ascii_strcasecmp(cjk_ambiguous_width, "narrow") == 0)
+ width = 1;
+ else if (g_ascii_strcasecmp(cjk_ambiguous_width, "wide") == 0)
+ width = 2;
+ else
+ g_printerr("Unrecognised value \"%s\" for --cjk-width\n",
+ cjk_ambiguous_width);
+ g_free(cjk_ambiguous_width);
+
+ vte_terminal_set_cjk_ambiguous_width(terminal, width);
+ }
+
vte_terminal_set_cursor_shape(terminal, cursor_shape);
+ vte_terminal_set_rewrap_on_resize(terminal, rewrap);
+
/* Set the default font. */
- vte_terminal_set_font_from_string_full(terminal, font,
- antialias ? VTE_ANTI_ALIAS_USE_DEFAULT : VTE_ANTI_ALIAS_FORCE_DISABLE);
+ if (font) {
+ PangoFontDescription *desc;
+
+ desc = pango_font_description_from_string(font);
+ vte_terminal_set_font(terminal, desc);
+ pango_font_description_free(desc);
+ }
/* Match "abcdefg". */
- if (dingus) {
- int id;
- GRegex *regex;
- regex = g_regex_new (DINGUS1, 0, 0, NULL);
- id = vte_terminal_match_add_gregex(terminal, regex, 0);
- g_regex_unref (regex);
- vte_terminal_match_set_cursor_type(terminal,
- id, GDK_GUMBY);
- regex = g_regex_new (DINGUS2, 0, 0, NULL);
- id = vte_terminal_match_add_gregex(terminal, regex, 0);
- g_regex_unref (regex);
- vte_terminal_match_set_cursor_type(terminal,
- id, GDK_HAND1);
+ if (!no_builtin_dingus) {
+ add_dingus (terminal, (char **) builtin_dingus);
}
+ if (dingus) {
+ add_dingus (terminal, dingus);
+ g_strfreev (dingus);
+ }
if (console) {
/* Open a "console" connection. */
@@ -955,14 +1020,14 @@ main(int argc, char **argv)
G_IO_IN,
read_and_feed,
widget);
- g_signal_connect(widget,
- "eof",
- G_CALLBACK(disconnect_watch),
- GINT_TO_POINTER(watch));
- g_signal_connect(widget,
- "child-exited",
- G_CALLBACK(disconnect_watch),
- GINT_TO_POINTER(watch));
+ g_signal_connect_swapped(widget,
+ "eof",
+ G_CALLBACK(disconnect_watch),
+ GINT_TO_POINTER(watch));
+ g_signal_connect_swapped(widget,
+ "child-exited",
+ G_CALLBACK(disconnect_watch),
+ GINT_TO_POINTER(watch));
g_signal_connect(widget,
"realize",
G_CALLBACK(take_xconsole_ownership),
@@ -990,12 +1055,13 @@ main(int argc, char **argv)
char **command_argv = NULL;
int command_argc;
GPid pid = -1;
+ char *free_me = NULL;
_VTE_DEBUG_IF(VTE_DEBUG_MISC)
vte_terminal_feed(terminal, message, -1);
if (command == NULL || *command == '\0')
- command = vte_get_user_shell ();
+ command = free_me = vte_get_user_shell ();
if (command == NULL || *command == '\0')
command = g_getenv ("SHELL");
@@ -1004,7 +1070,7 @@ main(int argc, char **argv)
command = "/bin/sh";
if (!g_shell_parse_argv(command, &command_argc, &command_argv, &err) ||
- !vte_terminal_fork_command_full(terminal,
+ !vte_terminal_spawn_sync(terminal,
pty_flags,
NULL,
command_argv,
@@ -1012,6 +1078,7 @@ main(int argc, char **argv)
G_SPAWN_SEARCH_PATH,
NULL, NULL,
&pid,
+ NULL /* cancellable */,
&err)) {
g_warning("Failed to fork: %s\n", err->message);
g_error_free(err);
@@ -1019,34 +1086,42 @@ main(int argc, char **argv)
g_print("Fork succeeded, PID %d\n", pid);
}
+ g_free (free_me);
g_strfreev(command_argv);
- #ifdef VTE_DEBUG
- if (command == NULL) {
- vte_terminal_feed_child(terminal,
- "pwd\n", -1);
- }
- #endif
} else {
- long i;
- i = vte_terminal_forkpty(terminal,
- env_add, working_directory,
- TRUE, TRUE, TRUE);
- switch (i) {
+ #ifdef HAVE_FORK
+ GError *err = NULL;
+ VtePty *pty;
+ pid_t pid;
+ int i;
+
+ pty = vte_pty_new_sync(VTE_PTY_DEFAULT, NULL, &err);
+ if (pty == NULL) {
+ g_printerr ("Failed to create PTY: %s\n", err->message);
+ g_error_free(err);
+ return 1;
+ }
+
+ pid = fork();
+ switch (pid) {
case -1:
/* abnormal */
- g_warning("Error in vte_terminal_forkpty(): %s",
- strerror(errno));
- break;
+ g_warning("Error forking: %s",
+ g_strerror(errno));
+ g_object_unref(pty);
+ break;
case 0:
/* child */
+ vte_pty_child_setup(pty);
+
for (i = 0; ; i++) {
switch (i % 3) {
case 0:
case 1:
- g_print("%ld\n", i);
+ g_print("%d\n", i);
break;
case 2:
- g_printerr("%ld\n", i);
+ g_printerr("%d\n", i);
break;
}
sleep(1);
@@ -1054,11 +1129,15 @@ main(int argc, char **argv)
_exit(0);
break;
default:
- g_print("Child PID is %ld (mine is %ld).\n",
- (long) i, (long) getpid());
+ vte_terminal_set_pty(terminal, pty);
+ g_object_unref(pty);
+ vte_terminal_watch_child(terminal, pid);
+ g_print("Child PID is %d (mine is %d).\n",
+ (int) pid, (int) getpid());
/* normal */
break;
}
+ #endif /* HAVE_FORK */
}
}
@@ -1076,9 +1155,7 @@ main(int argc, char **argv)
if (!gtk_window_parse_geometry (GTK_WINDOW(window), geometry)) {
g_warning (_("Could not parse the geometry spec passed to --geometry"));
}
- }
-#if GTK_CHECK_VERSION(2, 91, 0)
- else {
+ } else {
/* As of GTK+ 2.91.0, the default size of a window comes from its minimum
* size not its natural size, so we need to set the right default size
* explicitly */
@@ -1086,7 +1163,6 @@ main(int argc, char **argv)
vte_terminal_get_column_count (terminal),
vte_terminal_get_row_count (terminal));
}
-#endif
gtk_widget_show_all(window);
diff --git a/src/vtebg.c b/src/vtebg.c
deleted file mode 100644
index 5eeb778a..00000000
--- a/src/vtebg.c
+++ /dev/null
@@ -1,529 +0,0 @@
-/*
- * Copyright (C) 2003 Red Hat, Inc.
- *
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <gtk/gtk.h>
-#include "debug.h"
-#include "marshal.h"
-#include "vtebg.h"
-#include "vte-gtk-compat.h"
-
-#ifdef GDK_WINDOWING_X11
-#include <gdk/gdkx.h>
-#include <cairo-xlib.h>
-#endif
-
-G_DEFINE_TYPE(VteBg, vte_bg, G_TYPE_OBJECT)
-
-struct _VteBgPrivate {
- GList *cache;
- GdkScreen *screen;
-#ifdef GDK_WINDOWING_X11
- cairo_surface_t *root_surface;
- struct {
- GdkDisplay *display;
- GdkWindow *window;
- XID native_window;
- GdkAtom atom;
- Atom native_atom;
- } native;
-#endif
-};
-
-typedef struct {
- VteBgSourceType source_type;
- GdkPixbuf *source_pixbuf;
- char *source_file;
-
- PangoColor tint_color;
- double saturation;
- cairo_surface_t *surface;
-} VteBgCacheItem;
-
-static void vte_bg_cache_item_free(VteBgCacheItem *item);
-static void vte_bg_cache_prune_int(VteBg *bg, gboolean root);
-static const cairo_user_data_key_t item_surface_key;
-
-#ifdef GDK_WINDOWING_X11
-
-static void
-_vte_bg_display_sync(VteBg *bg)
-{
- VteBgPrivate *pvt = bg->pvt;
-
- gdk_display_sync(pvt->native.display);
-}
-
-static gboolean
-_vte_property_get_pixmaps(GdkWindow *window, GdkAtom atom,
- GdkAtom *type, int *size,
- XID **pixmaps)
-{
- return gdk_property_get(window, atom, GDK_TARGET_PIXMAP,
- 0, INT_MAX - 3,
- FALSE,
- type, NULL, size,
- (guchar**) pixmaps);
-}
-
-static cairo_surface_t *
-vte_bg_root_surface(VteBg *bg)
-{
- VteBgPrivate *pvt = bg->pvt;
- GdkAtom prop_type;
- int prop_size;
- Window root;
- XID *pixmaps;
- int x, y;
- unsigned int width, height, border_width, depth;
- cairo_surface_t *surface = NULL;
- Display *display;
- Screen *screen;
-
- pixmaps = NULL;
- gdk_error_trap_push();
- if (!_vte_property_get_pixmaps(pvt->native.window, pvt->native.atom,
- &prop_type, &prop_size,
- &pixmaps))
- goto out;
-
- if ((prop_type != GDK_TARGET_PIXMAP) ||
- (prop_size < (int)sizeof(XID) ||
- (pixmaps == NULL)))
- goto out_pixmaps;
-
- if (!XGetGeometry (GDK_DISPLAY_XDISPLAY (pvt->native.display),
- pixmaps[0], &root,
- &x, &y, &width, &height, &border_width, &depth))
- goto out_pixmaps;
-
- display = gdk_x11_display_get_xdisplay (pvt->native.display);
- screen = gdk_x11_screen_get_xscreen (pvt->screen);
- surface = cairo_xlib_surface_create (display,
- pixmaps[0],
- DefaultVisualOfScreen(screen),
- width, height);
-
- _vte_debug_print(VTE_DEBUG_BG|VTE_DEBUG_EVENTS,
- "VteBg new background image %dx%d\n", width, height);
-
- out_pixmaps:
- g_free(pixmaps);
- out:
- _vte_bg_display_sync(bg);
- gdk_error_trap_pop_ignored ();
-
- return surface;
-}
-
-static void
-vte_bg_set_root_surface(VteBg *bg, cairo_surface_t *surface)
-{
- VteBgPrivate *pvt = bg->pvt;
-
- if (pvt->root_surface != NULL) {
- cairo_surface_destroy (pvt->root_surface);
- }
- pvt->root_surface = surface;
- vte_bg_cache_prune_int (bg, TRUE);
- g_signal_emit_by_name(bg, "root-pixmap-changed");
-}
-
-static GdkFilterReturn
-vte_bg_root_filter(GdkXEvent *native, GdkEvent *event, gpointer data)
-{
- XEvent *xevent = (XEvent*) native;
- VteBg *bg;
- VteBgPrivate *pvt;
- cairo_surface_t *surface;
-
- switch (xevent->type) {
- case PropertyNotify:
- bg = VTE_BG(data);
- pvt = bg->pvt;
- if ((xevent->xproperty.window == pvt->native.native_window) &&
- (xevent->xproperty.atom == pvt->native.native_atom)) {
- surface = vte_bg_root_surface(bg);
- vte_bg_set_root_surface(bg, surface);
- }
- break;
- default:
- break;
- }
- return GDK_FILTER_CONTINUE;
-}
-
-#endif /* GDK_WINDOWING_X11 */
-
-static void
-vte_bg_finalize (GObject *obj)
-{
- VteBg *bg = VTE_BG (obj);
- VteBgPrivate *pvt = bg->pvt;
-
- g_list_foreach (pvt->cache, (GFunc)vte_bg_cache_item_free, NULL);
- g_list_free (pvt->cache);
-
- G_OBJECT_CLASS(vte_bg_parent_class)->finalize (obj);
-}
-
-static void
-vte_bg_class_init(VteBgClass *klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
-
- gobject_class->finalize = vte_bg_finalize;
-
- g_signal_new("root-pixmap-changed",
- G_OBJECT_CLASS_TYPE(klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL,
- NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- g_type_class_add_private(klass, sizeof (VteBgPrivate));
-}
-
-static void
-vte_bg_init(VteBg *bg)
-{
- bg->pvt = G_TYPE_INSTANCE_GET_PRIVATE (bg, VTE_TYPE_BG, VteBgPrivate);
-}
-
-/**
- * vte_bg_get:
- * @screen: a #GdkScreen
- *
- * Returns the global #VteBg object for @screen, creating it if necessary.
- *
- * Returns: (transfer none): a #VteBg
- */
-VteBg *
-vte_bg_get_for_screen(GdkScreen *screen)
-{
- VteBg *bg;
-
- bg = g_object_get_data(G_OBJECT(screen), "vte-bg");
- if (G_UNLIKELY(bg == NULL)) {
- VteBgPrivate *pvt;
-
- bg = g_object_new(VTE_TYPE_BG, NULL);
- g_object_set_data_full(G_OBJECT(screen),
- "vte-bg", bg, (GDestroyNotify)g_object_unref);
-
- /* connect bg to screen */
- pvt = bg->pvt;
- pvt->screen = screen;
-#ifdef GDK_WINDOWING_X11
- {
- GdkEventMask events;
- GdkWindow *window;
-
- window = gdk_screen_get_root_window(screen);
- pvt->native.window = window;
-#if GTK_CHECK_VERSION (2, 91, 6)
- pvt->native.native_window = GDK_WINDOW_XID (window);
- pvt->native.display = gdk_window_get_display(window);
-#else
- pvt->native.native_window = gdk_x11_drawable_get_xid(window);
- pvt->native.display = gdk_drawable_get_display(GDK_DRAWABLE(window));
-#endif
- pvt->native.native_atom = gdk_x11_get_xatom_by_name_for_display(pvt->native.display, "_XROOTPMAP_ID");
- pvt->native.atom = gdk_x11_xatom_to_atom_for_display(pvt->native.display, pvt->native.native_atom);
- pvt->root_surface = vte_bg_root_surface(bg);
- events = gdk_window_get_events(window);
- events |= GDK_PROPERTY_CHANGE_MASK;
- gdk_window_set_events(window, events);
- gdk_window_add_filter(window, vte_bg_root_filter, bg);
- }
-#endif /* GDK_WINDOWING_X11 */
- }
-
- return bg;
-}
-
-static gboolean
-vte_bg_colors_equal(const PangoColor *a, const PangoColor *b)
-{
- return (a->red >> 8) == (b->red >> 8) &&
- (a->green >> 8) == (b->green >> 8) &&
- (a->blue >> 8) == (b->blue >> 8);
-}
-
-static void
-vte_bg_cache_item_free(VteBgCacheItem *item)
-{
- _vte_debug_print(VTE_DEBUG_BG,
- "VteBgCacheItem %p freed\n", item);
-
- /* Clean up whatever is left in the structure. */
- if (item->source_pixbuf != NULL) {
- g_object_remove_weak_pointer(G_OBJECT(item->source_pixbuf),
- (gpointer*)(void*)&item->source_pixbuf);
- }
- g_free(item->source_file);
-
- if (item->surface != NULL)
- cairo_surface_set_user_data (item->surface,
- &item_surface_key, NULL, NULL);
-
- g_slice_free(VteBgCacheItem, item);
-}
-
-static void
-vte_bg_cache_prune_int(VteBg *bg, gboolean root)
-{
- GList *i, *next;
- for (i = bg->pvt->cache; i != NULL; i = next) {
- VteBgCacheItem *item = i->data;
- next = g_list_next (i);
- /* Prune the item if either it is a "root pixmap" item and
- * we want to prune them, or its surface is NULL because
- * whichever object it created has been destroyed. */
- if ((root && (item->source_type == VTE_BG_SOURCE_ROOT)) ||
- item->surface == NULL) {
- vte_bg_cache_item_free (item);
- bg->pvt->cache = g_list_delete_link(bg->pvt->cache, i);
- }
- }
-}
-
-static void
-vte_bg_cache_prune(VteBg *bg)
-{
- vte_bg_cache_prune_int(bg, FALSE);
-}
-
-static void item_surface_destroy_func(void *data)
-{
- VteBgCacheItem *item = data;
-
- _vte_debug_print(VTE_DEBUG_BG,
- "VteBgCacheItem %p surface destroyed\n", item);
-
- item->surface = NULL;
-}
-
-/*
- * vte_bg_cache_add:
- * @bg: a #VteBg
- * @item: a #VteBgCacheItem
- *
- * Adds @item to @bg's cache, instructing all of the objects therein to
- * clear the field which holds a pointer to the object upon its destruction.
- */
-static void
-vte_bg_cache_add(VteBg *bg, VteBgCacheItem *item)
-{
- vte_bg_cache_prune(bg);
- bg->pvt->cache = g_list_prepend(bg->pvt->cache, item);
- if (item->source_pixbuf != NULL) {
- g_object_add_weak_pointer(G_OBJECT(item->source_pixbuf),
- (gpointer*)(void*)&item->source_pixbuf);
- }
-
- if (item->surface != NULL)
- cairo_surface_set_user_data (item->surface, &item_surface_key, item,
- item_surface_destroy_func);
-}
-
-/*
- * vte_bg_cache_search:
- * @bg: a #VteBg
- * @source_type: a #VteBgSourceType
- * @source_pixbuf: a #GdkPixbuf, or %NULL
- * @source_file: path of an image file, or %NULL
- * @tint: a #PangoColor to use as tint color
- * @saturation: the saturation as a value between 0.0 and 1.0
- *
- * Returns: a reference to a #cairo_surface_t, or %NULL on if
- * there is no matching item in the cache
- */
-static cairo_surface_t *
-vte_bg_cache_search(VteBg *bg,
- VteBgSourceType source_type,
- const GdkPixbuf *source_pixbuf,
- const char *source_file,
- const PangoColor *tint,
- double saturation)
-{
- GList *i;
-
- vte_bg_cache_prune(bg);
- for (i = bg->pvt->cache; i != NULL; i = g_list_next(i)) {
- VteBgCacheItem *item = i->data;
- if (vte_bg_colors_equal(&item->tint_color, tint) &&
- (saturation == item->saturation) &&
- (source_type == item->source_type)) {
- switch (source_type) {
- case VTE_BG_SOURCE_ROOT:
- break;
- case VTE_BG_SOURCE_PIXBUF:
- if (item->source_pixbuf != source_pixbuf) {
- continue;
- }
- break;
- case VTE_BG_SOURCE_FILE:
- if (strcmp(item->source_file, source_file)) {
- continue;
- }
- break;
- default:
- g_assert_not_reached();
- break;
- }
-
- return cairo_surface_reference(item->surface);
- }
- }
- return NULL;
-}
-
-/*< private >
- * vte_bg_get_surface:
- * @bg: a #VteBg
- * @source_type: a #VteBgSourceType
- * @source_pixbuf: (allow-none): a #GdkPixbuf, or %NULL
- * @source_file: (allow-none): path of an image file, or %NULL
- * @tint: a #PangoColor to use as tint color
- * @saturation: the saturation as a value between 0.0 and 1.0
- * @other: a #cairo_surface_t
- *
- * Returns: a reference to a #cairo_surface_t, or %NULL on failure
- */
-cairo_surface_t *
-vte_bg_get_surface(VteBg *bg,
- VteBgSourceType source_type,
- GdkPixbuf *source_pixbuf,
- const char *source_file,
- const PangoColor *tint,
- double saturation,
- cairo_surface_t *other)
-{
- VteBgPrivate *pvt;
- VteBgCacheItem *item;
- GdkPixbuf *pixbuf;
- cairo_surface_t *cached;
- cairo_t *cr;
- int width, height;
-
- g_return_val_if_fail(VTE_IS_BG(bg), NULL);
- pvt = bg->pvt;
-
- if (source_type == VTE_BG_SOURCE_NONE) {
- return NULL;
- }
-#ifndef GDK_WINDOWING_X11
- if (source_type == VTE_BG_SOURCE_ROOT) {
- return NULL;
- }
-#endif
-
- cached = vte_bg_cache_search(bg, source_type,
- source_pixbuf, source_file,
- tint, saturation);
- if (cached != NULL) {
- return cached;
- }
-
- /* FIXME: The above only returned a hit when the source *and*
- * tint and saturation matched. This means that for VTE_BG_SOURCE_FILE,
- * we will create below *another* #GdkPixbuf for the same source file,
- * wasting memory. We should instead look up the source pixbuf regardless
- * of tint and saturation, and just create a new #VteBgCacheItem
- * with a new surface for it.
- */
-
- item = g_slice_new(VteBgCacheItem);
- item->source_type = source_type;
- item->source_pixbuf = NULL;
- item->source_file = NULL;
- item->tint_color = *tint;
- item->saturation = saturation;
- item->surface = NULL;
- pixbuf = NULL;
-
- switch (source_type) {
- case VTE_BG_SOURCE_ROOT:
- break;
- case VTE_BG_SOURCE_PIXBUF:
- item->source_pixbuf = g_object_ref (source_pixbuf);
- pixbuf = g_object_ref (source_pixbuf);
- break;
- case VTE_BG_SOURCE_FILE:
- if (source_file != NULL && source_file[0] != '\0') {
- item->source_file = g_strdup(source_file);
- pixbuf = gdk_pixbuf_new_from_file(source_file, NULL);
- }
- break;
- default:
- g_assert_not_reached();
- break;
- }
-
- if (pixbuf) {
- width = gdk_pixbuf_get_width(pixbuf);
- height = gdk_pixbuf_get_height(pixbuf);
- }
-#ifdef GDK_WINDOWING_X11
- else if (source_type == VTE_BG_SOURCE_ROOT &&
- pvt->root_surface != NULL) {
- width = cairo_xlib_surface_get_width(pvt->root_surface);
- height = cairo_xlib_surface_get_height(pvt->root_surface);
- }
-#endif
- else
- goto out;
-
- item->surface =
- cairo_surface_create_similar(other, CAIRO_CONTENT_COLOR_ALPHA,
- width, height);
-
- cr = cairo_create (item->surface);
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- if (pixbuf)
- gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
-#ifdef GDK_WINDOWING_X11
- else if (source_type == VTE_BG_SOURCE_ROOT)
- cairo_set_source_surface (cr, pvt->root_surface, 0, 0);
-#endif
- cairo_paint (cr);
-
- if (saturation < 1.0) {
- cairo_set_source_rgba (cr,
- tint->red / 65535.,
- tint->green / 65535.,
- tint->blue / 65535.,
- 1 - saturation);
- cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
- cairo_paint (cr);
- }
- cairo_destroy (cr);
-
- out:
- vte_bg_cache_add(bg, item);
-
- if (pixbuf)
- g_object_unref (pixbuf);
-
- return item->surface;
-}
diff --git a/src/vtebg.h b/src/vtebg.h
deleted file mode 100644
index f2cf77b3..00000000
--- a/src/vtebg.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2003 Red Hat, Inc.
- *
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef vte_vtebg_included
-#define vte_vtebg_included
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define VTE_TYPE_BG (vte_bg_get_type())
-#define VTE_BG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VTE_TYPE_BG, VteBg))
-#define VTE_BG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VTE_TYPE_BG, VteBgClass))
-#define VTE_IS_BG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VTE_TYPE_BG))
-#define VTE_IS_BG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VTE_TYPE_BG))
-#define VTE_BG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VTE_TYPE_BG, VteBgClass))
-
-typedef struct _VteBg VteBg;
-typedef struct _VteBgPrivate VteBgPrivate;
-typedef struct _VteBgClass VteBgClass;
-
-struct _VteBg {
- GObject parent;
-
- /*< private >*/
- VteBgPrivate *pvt;
-};
-
-struct _VteBgClass {
- GObjectClass parent_class;
-};
-
-GType vte_bg_get_type(void);
-
-VteBg *vte_bg_get_for_screen(GdkScreen *screen);
-
-typedef enum {
- VTE_BG_SOURCE_NONE,
- VTE_BG_SOURCE_ROOT,
- VTE_BG_SOURCE_PIXBUF,
- VTE_BG_SOURCE_FILE
-} VteBgSourceType;
-
-cairo_surface_t *
-vte_bg_get_surface(VteBg *bg,
- VteBgSourceType source_type,
- GdkPixbuf *source_pixbuf,
- const char *source_file,
- const PangoColor *tint,
- double saturation,
- cairo_surface_t *other);
-
-G_END_DECLS
-
-#endif
diff --git a/src/vteconv.c b/src/vteconv.c
index 2b91d33e..ef94880e 100644
--- a/src/vteconv.c
+++ b/src/vteconv.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2003 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* The interfaces in this file are subject to change at any time. */
@@ -38,7 +38,7 @@ struct _VteConv {
convert_func convert;
gint (*close)(GIConv converter);
gboolean in_unichar, out_unichar;
- VteBuffer *in_scratch, *out_scratch;
+ VteByteArray *in_scratch, *out_scratch;
};
/* We can't use g_utf8_strlen as that's not nul-safe :( */
@@ -66,7 +66,6 @@ _vte_conv_utf8_utf8(GIConv converter,
gboolean validated;
const gchar *endptr;
size_t bytes;
- guint skip;
/* We don't tolerate shenanigans! */
g_assert(*outbytes_left >= *inbytes_left);
@@ -88,29 +87,9 @@ _vte_conv_utf8_utf8(GIConv converter,
return 0;
}
- /* Determine why the end of the string is not valid.
- * We are pur b@stards for running g_utf8_next_char() on an
- * invalid sequence. */
- skip = g_utf8_next_char(*inbuf) - *inbuf;
- if (skip > *inbytes_left) {
- /* We didn't have enough bytes to validate the character.
- * That qualifies for EINVAL, but only if the part of the
- * character that we have is a valid prefix to a character.
- * Differentiating those requires verifying that all the
- * remaining bytes after this one are UTF-8 continuation
- * bytes. Actually even that is not quite enough as not
- * all continuation bytes are valid in the most strict
- * interpretation of UTF-8, but we don't care about that.
- */
- size_t i;
-
- for (i = 1; i < *inbytes_left; i++)
- if (((*inbuf)[i] & 0xC0) != 0x80) {
- /* Not a continuation byte */
- errno = EILSEQ;
- return (size_t) -1;
- }
-
+ /* Determine why the end of the string is not valid. */
+ if (g_utf8_get_char_validated(*inbuf, *inbytes_left) == (gunichar) -2) {
+ /* Prefix of a valid UTF-8 */
errno = EINVAL;
} else {
/* We had enough bytes to validate the character, and
@@ -192,8 +171,8 @@ _vte_conv_open(const char *target, const char *source)
ret->out_unichar = out_unichar;
/* Create scratch buffers. */
- ret->in_scratch = _vte_buffer_new();
- ret->out_scratch = _vte_buffer_new();
+ ret->in_scratch = _vte_byte_array_new();
+ ret->out_scratch = _vte_byte_array_new();
return ret;
}
@@ -211,8 +190,8 @@ _vte_conv_close(VteConv converter)
}
/* Free the scratch buffers. */
- _vte_buffer_free(converter->in_scratch);
- _vte_buffer_free(converter->out_scratch);
+ _vte_byte_array_free(converter->in_scratch);
+ _vte_byte_array_free(converter->out_scratch);
/* Free the structure itself. */
g_slice_free(struct _VteConv, converter);
@@ -229,7 +208,6 @@ _vte_conv(VteConv converter,
const guchar *work_inbuf_start, *work_inbuf_working;
guchar *work_outbuf_start, *work_outbuf_working;
gsize work_inbytes, work_outbytes;
- gsize in_converted, out_converted;
g_assert(converter != NULL);
g_assert(converter != VTE_INVALID_CONV);
@@ -238,8 +216,6 @@ _vte_conv(VteConv converter,
work_outbuf_start = work_outbuf_working = *outbuf;
work_inbytes = *inbytes_left;
work_outbytes = *outbytes_left;
- in_converted = 0;
- out_converted = 0;
/* Possibly convert the input data from gunichars to UTF-8. */
if (converter->in_unichar) {
@@ -248,7 +224,7 @@ _vte_conv(VteConv converter,
gunichar *g;
/* Make sure the scratch buffer has enough space. */
char_count = *inbytes_left / sizeof(gunichar);
- _vte_buffer_set_minimum_size(converter->in_scratch,
+ _vte_byte_array_set_minimum_size(converter->in_scratch,
(char_count + 1) * VTE_UTF8_BPC);
/* Convert the incoming text. */
g = (gunichar*) *inbuf;
@@ -267,7 +243,7 @@ _vte_conv(VteConv converter,
/* Possibly set the output pointers to point at our scratch buffer. */
if (converter->out_unichar) {
work_outbytes = *outbytes_left * VTE_UTF8_BPC;
- _vte_buffer_set_minimum_size(converter->out_scratch,
+ _vte_byte_array_set_minimum_size(converter->out_scratch,
work_outbytes);
work_outbuf_start = converter->out_scratch->data;
work_outbuf_working = work_outbuf_start;
diff --git a/src/vteconv.h b/src/vteconv.h
index 88485ae5..4434eea1 100644
--- a/src/vteconv.h
+++ b/src/vteconv.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2003 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* The interfaces in this file are subject to change at any time. */
diff --git a/src/vtedeprecated.h b/src/vtedeprecated.h
deleted file mode 100644
index e531b0d0..00000000
--- a/src/vtedeprecated.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2001,2002,2003,2009,2010 Red Hat, Inc.
- *
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#if !defined (__VTE_VTE_H_INSIDE__) && !defined (VTE_COMPILATION)
-#error "Only <vte/vte.h> can be included directly."
-#endif
-
-#ifndef VTE_DISABLE_DEPRECATED
-
-#ifndef vte_deprecated_h_included
-#define vte_deprecated_h_included
-
-#include <sys/types.h> /* for pid_t */
-
-G_BEGIN_DECLS
-
-/**
- * VTE_IS_TERMINAL_ERASE_BINDING:
- *
- * Does nothing.
- *
- * Returns: %FALSE
- *
- * @Deprecated: 0.20
- */
-#define VTE_IS_TERMINAL_ERASE_BINDING(obj) (FALSE)
-
-/**
- * VTE_IS_TERMINAL_ANTI_ALIAS:
- *
- * Does nothing.
- *
- * Returns: %FALSE
- *
- * @Deprecated: 0.20
- */
-#define VTE_IS_TERMINAL_ANTI_ALIAS(obj) (FALSE)
-
-/**
- * VteTerminalAntiAlias:
- * @VTE_ANTI_ALIAS_USE_DEFAULT: Use the system default anti-alias setting
- * @VTE_ANTI_ALIAS_FORCE_ENABLE: Force enable anti-aliasing
- * @VTE_ANTI_ALIAS_FORCE_DISABLE: Force disable anti-aliasing
- *
- * An enumeration describing which anti-alias setting to use.
- *
- * @Deprecated: 0.20
- */
-typedef enum {
- VTE_ANTI_ALIAS_USE_DEFAULT,
- VTE_ANTI_ALIAS_FORCE_ENABLE,
- VTE_ANTI_ALIAS_FORCE_DISABLE
-} VteTerminalAntiAlias;
-
-void vte_terminal_set_cursor_blinks(VteTerminal *terminal,
- gboolean blink) G_GNUC_DEPRECATED;
-gboolean vte_terminal_get_using_xft(VteTerminal *terminal) G_GNUC_DEPRECATED;
-int vte_terminal_match_add(VteTerminal *terminal, const char *match) G_GNUC_DEPRECATED;
-glong vte_terminal_get_char_descent(VteTerminal *terminal) G_GNUC_DEPRECATED;
-glong vte_terminal_get_char_ascent(VteTerminal *terminal) G_GNUC_DEPRECATED;
-void vte_terminal_set_font_full(VteTerminal *terminal,
- const PangoFontDescription *font_desc,
- VteTerminalAntiAlias antialias) G_GNUC_DEPRECATED;
-void vte_terminal_set_font_from_string_full(VteTerminal *terminal,
- const char *name,
- VteTerminalAntiAlias antialias) G_GNUC_DEPRECATED;
-pid_t vte_terminal_fork_command(VteTerminal *terminal,
- const char *command, char **argv,
- char **envv, const char *working_directory,
- gboolean lastlog,
- gboolean utmp,
- gboolean wtmp) G_GNUC_DEPRECATED;
-pid_t vte_terminal_forkpty(VteTerminal *terminal,
- char **envv, const char *working_directory,
- gboolean lastlog,
- gboolean utmp,
- gboolean wtmp) G_GNUC_DEPRECATED;
-void vte_terminal_get_padding(VteTerminal *terminal, int *xpad, int *ypad) G_GNUC_DEPRECATED;
-void vte_terminal_set_pty(VteTerminal *terminal, int pty_master);
-int vte_terminal_get_pty(VteTerminal *terminal);
-
-#if GTK_CHECK_VERSION (2, 91, 2)
-GtkAdjustment *vte_terminal_get_adjustment(VteTerminal *terminal);
-#endif
-
-G_END_DECLS
-
-#endif /* !vte_deprecated_h_included */
-
-#endif /* !VTE_DISABLE_DEPRECATED */
diff --git a/src/vtedraw.c b/src/vtedraw.c
index 029ebb37..23984fa1 100644
--- a/src/vtedraw.c
+++ b/src/vtedraw.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2003,2008 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -24,7 +24,6 @@
#include <gtk/gtk.h>
#include <glib.h>
#include "debug.h"
-#include "vtebg.h"
#include "vtedraw.h"
#include "vte-private.h"
@@ -368,6 +367,9 @@ font_info_measure_font (struct font_info *info)
/* We don't do CEIL for width since we are averaging;
* rounding is more accurate */
info->width = PANGO_PIXELS (howmany (logical.width, strlen(VTE_DRAW_SINGLE_WIDE_CHARACTERS)));
+ /* Guard against pathological font since width=0 causes a FPE later on */
+ info->width = MAX (info->width, 1);
+
info->height = PANGO_PIXELS_CEIL (logical.height);
info->ascent = PANGO_PIXELS_CEIL (pango_layout_get_baseline (info->layout));
@@ -570,13 +572,13 @@ font_info_find_for_context (PangoContext *context)
_vte_debug_print (VTE_DEBUG_PANGOCAIRO,
"vtepangocairo: %p found font_info in cache\n",
info);
- return font_info_reference (info);
+ info = font_info_reference (info);
+ } else {
+ info = font_info_allocate (context);
+ info->ref_count = 1;
+ font_info_register (info);
}
- info = font_info_allocate (context);
- info->ref_count = 1;
- font_info_register (info);
-
g_object_unref (context);
return info;
@@ -586,7 +588,6 @@ font_info_find_for_context (PangoContext *context)
static struct font_info *
font_info_create_for_context (PangoContext *context,
const PangoFontDescription *desc,
- VteTerminalAntiAlias antialias,
PangoLanguage *language,
guint fontconfig_timestamp)
{
@@ -607,37 +608,16 @@ font_info_create_for_context (PangoContext *context,
pango_context_set_language (context, language);
- switch (antialias) {
- cairo_font_options_t *font_options;
- cairo_antialias_t cr_aa;
-
- case VTE_ANTI_ALIAS_FORCE_ENABLE:
- case VTE_ANTI_ALIAS_FORCE_DISABLE:
-
- if (antialias == VTE_ANTI_ALIAS_FORCE_ENABLE)
- cr_aa = CAIRO_ANTIALIAS_DEFAULT; /* let surface decide between gray and subpixel */
- else
- cr_aa = CAIRO_ANTIALIAS_NONE;
+ /* Make sure our contexts have a font_options set. We use
+ * this invariant in our context hash and equal functions.
+ */
+ if (!pango_cairo_context_get_font_options (context)) {
+ cairo_font_options_t *font_options;
- font_options = cairo_font_options_copy (pango_cairo_context_get_font_options (context));
- cairo_font_options_set_antialias (font_options, cr_aa);
- pango_cairo_context_set_font_options (context, font_options);
- cairo_font_options_destroy (font_options);
-
- break;
-
- default:
- case VTE_ANTI_ALIAS_USE_DEFAULT:
- /* Make sure our contexts have a font_options set. We use
- * this invariant in our context hash and equal functions.
- */
- if (!pango_cairo_context_get_font_options (context)) {
- font_options = cairo_font_options_create ();
- pango_cairo_context_set_font_options (context, font_options);
- cairo_font_options_destroy (font_options);
- }
- break;
- }
+ font_options = cairo_font_options_create ();
+ pango_cairo_context_set_font_options (context, font_options);
+ cairo_font_options_destroy (font_options);
+ }
return font_info_find_for_context (context);
}
@@ -645,25 +625,23 @@ font_info_create_for_context (PangoContext *context,
static struct font_info *
font_info_create_for_screen (GdkScreen *screen,
const PangoFontDescription *desc,
- VteTerminalAntiAlias antialias,
PangoLanguage *language)
{
GtkSettings *settings = gtk_settings_get_for_screen (screen);
int fontconfig_timestamp;
g_object_get (settings, "gtk-fontconfig-timestamp", &fontconfig_timestamp, NULL);
return font_info_create_for_context (gdk_pango_context_get_for_screen (screen),
- desc, antialias, language, fontconfig_timestamp);
+ desc, language, fontconfig_timestamp);
}
static struct font_info *
font_info_create_for_widget (GtkWidget *widget,
- const PangoFontDescription *desc,
- VteTerminalAntiAlias antialias)
+ const PangoFontDescription *desc)
{
GdkScreen *screen = gtk_widget_get_screen (widget);
PangoLanguage *language = pango_context_get_language (gtk_widget_get_pango_context (widget));
- return font_info_create_for_screen (screen, desc, antialias, language);
+ return font_info_create_for_screen (screen, desc, language);
}
static struct unistr_info *
@@ -744,35 +722,47 @@ font_info_get_unistr_info (struct font_info *info,
return uinfo;
}
+guint _vte_draw_get_style(gboolean bold, gboolean italic) {
+ guint style = 0;
+ if (bold)
+ style |= VTE_DRAW_BOLD;
+ if (italic)
+ style |= VTE_DRAW_ITALIC;
+ return style;
+}
+
struct _vte_draw {
GtkWidget *widget;
- gint started;
-
- struct font_info *font;
- struct font_info *font_bold;
+ struct font_info *fonts[4];
cairo_pattern_t *bg_pattern;
cairo_t *cr;
};
struct _vte_draw *
-_vte_draw_new (GtkWidget *widget)
+_vte_draw_new (void)
{
struct _vte_draw *draw;
/* Create the structure. */
draw = g_slice_new0 (struct _vte_draw);
- draw->widget = g_object_ref (widget);
_vte_debug_print (VTE_DEBUG_DRAW, "draw_new\n");
return draw;
}
+cairo_t *
+_vte_draw_get_context (struct _vte_draw *draw)
+{
+ return draw->cr;
+}
+
void
_vte_draw_free (struct _vte_draw *draw)
{
+ gint style;
_vte_debug_print (VTE_DEBUG_DRAW, "draw_free\n");
if (draw->bg_pattern != NULL) {
@@ -780,120 +770,44 @@ _vte_draw_free (struct _vte_draw *draw)
draw->bg_pattern = NULL;
}
- if (draw->font != NULL) {
- font_info_destroy (draw->font);
- draw->font = NULL;
- }
-
- if (draw->widget != NULL) {
- g_object_unref (draw->widget);
+ /* Free all fonts (make sure to destroy every font only once)*/
+ for (style = 3; style >= 0; style--) {
+ if (draw->fonts[style] != NULL &&
+ (style == 0 || draw->fonts[style] != draw->fonts[style-1])) {
+ font_info_destroy (draw->fonts[style]);
+ draw->fonts[style] = NULL;
+ }
}
g_slice_free (struct _vte_draw, draw);
}
void
-_vte_draw_start (struct _vte_draw *draw)
-{
- GdkWindow *window;
-
- g_return_if_fail (gtk_widget_get_realized (draw->widget));
-
- _vte_debug_print (VTE_DEBUG_DRAW, "draw_start\n");
-
- if (draw->started == 0) {
- window = gtk_widget_get_window(draw->widget);
- g_object_ref (window);
- draw->cr = gdk_cairo_create (window);
- }
-
- draw->started++;
-}
-
-void
-_vte_draw_end (struct _vte_draw *draw)
+_vte_draw_set_cairo (struct _vte_draw *draw,
+ cairo_t *cr)
{
- g_return_if_fail (draw->started);
-
- draw->started--;
- if (draw->started == 0) {
- cairo_destroy (draw->cr);
- draw->cr = NULL;
- g_object_unref (gtk_widget_get_window(draw->widget));
- }
-
- _vte_debug_print (VTE_DEBUG_DRAW, "draw_end\n");
+ _vte_debug_print (VTE_DEBUG_DRAW, "%s cairo context\n", cr ? "Settings" : "Unsetting");
+
+ if (cr) {
+ g_assert (draw->cr == NULL);
+ draw->cr = cr;
+ } else {
+ g_assert (draw->cr != NULL);
+ draw->cr = NULL;
+ }
}
void
_vte_draw_set_background_solid(struct _vte_draw *draw,
- double red,
- double green,
- double blue,
- double opacity)
+ const GdkRGBA *color)
{
if (draw->bg_pattern)
cairo_pattern_destroy (draw->bg_pattern);
- draw->bg_pattern = cairo_pattern_create_rgba (red,
- green,
- blue,
- opacity);
-}
-
-void
-_vte_draw_set_background_image (struct _vte_draw *draw,
- VteBgSourceType type,
- GdkPixbuf *pixbuf,
- const char *filename,
- const PangoColor *color,
- double saturation)
-{
- cairo_surface_t *surface;
-
- /* Need a valid draw->cr for cairo_get_target () */
- _vte_draw_start (draw);
-
- surface = vte_bg_get_surface (vte_bg_get_for_screen (gtk_widget_get_screen (draw->widget)),
- type, pixbuf, filename,
- color, saturation,
- cairo_get_target(draw->cr));
-
- _vte_draw_end (draw);
-
- if (!surface)
- return;
-
- if (draw->bg_pattern)
- cairo_pattern_destroy (draw->bg_pattern);
-
- draw->bg_pattern = cairo_pattern_create_for_surface (surface);
- cairo_surface_destroy (surface);
- cairo_pattern_set_extend (draw->bg_pattern, CAIRO_EXTEND_REPEAT);
-}
-
-void
-_vte_draw_set_background_scroll (struct _vte_draw *draw,
- gint x, gint y)
-{
- cairo_matrix_t matrix;
-
- _vte_debug_print (VTE_DEBUG_DRAW,
- "draw_set_scroll (%d, %d)\n",
- x, y);
-
- g_return_if_fail (draw->bg_pattern != NULL);
-
- cairo_matrix_init_translate (&matrix, x, y);
- cairo_pattern_set_matrix (draw->bg_pattern, &matrix);
-}
-
-void
-_vte_draw_clip (struct _vte_draw *draw, GdkRegion *region)
-{
- _vte_debug_print (VTE_DEBUG_DRAW, "draw_clip\n");
- gdk_cairo_region(draw->cr, region);
- cairo_clip (draw->cr);
+ draw->bg_pattern = cairo_pattern_create_rgba (color->red,
+ color->green,
+ color->blue,
+ color->alpha);
}
void
@@ -904,6 +818,7 @@ _vte_draw_clear (struct _vte_draw *draw, gint x, gint y, gint width, gint height
_vte_debug_print (VTE_DEBUG_DRAW, "draw_clear (%d, %d, %d, %d)\n",
x,y,width, height);
+ g_assert(draw->cr);
cairo_rectangle (draw->cr, x, y, width, height);
cairo_set_operator (draw->cr, CAIRO_OPERATOR_SOURCE);
cairo_set_source (draw->cr, draw->bg_pattern);
@@ -912,32 +827,66 @@ _vte_draw_clear (struct _vte_draw *draw, gint x, gint y, gint width, gint height
void
_vte_draw_set_text_font (struct _vte_draw *draw,
- const PangoFontDescription *fontdesc,
- VteTerminalAntiAlias antialias)
+ GtkWidget *widget,
+ const PangoFontDescription *fontdesc)
{
- PangoFontDescription *bolddesc = NULL;
-
- _vte_debug_print (VTE_DEBUG_DRAW, "draw_set_text_font (aa=%d)\n",
- antialias);
-
- if (draw->font_bold != draw->font)
- font_info_destroy (draw->font_bold);
- font_info_destroy (draw->font);
- draw->font = font_info_create_for_widget (draw->widget, fontdesc, antialias);
+ PangoFontDescription *bolddesc = NULL;
+ PangoFontDescription *italicdesc = NULL;
+ PangoFontDescription *bolditalicdesc = NULL;
+ gint style, normal, bold, ratio;
+
+ _vte_debug_print (VTE_DEBUG_DRAW, "draw_set_text_font\n");
+
+ /* Free all fonts (make sure to destroy every font only once)*/
+ for (style = 3; style >= 0; style--) {
+ if (draw->fonts[style] != NULL &&
+ (style == 0 || draw->fonts[style] != draw->fonts[style-1])) {
+ font_info_destroy (draw->fonts[style]);
+ draw->fonts[style] = NULL;
+ }
+ }
/* calculate bold font desc */
bolddesc = pango_font_description_copy (fontdesc);
pango_font_description_set_weight (bolddesc, PANGO_WEIGHT_BOLD);
- draw->font_bold = font_info_create_for_widget (draw->widget, bolddesc, antialias);
+ /* calculate italic font desc */
+ italicdesc = pango_font_description_copy (fontdesc);
+ pango_font_description_set_style (italicdesc, PANGO_STYLE_ITALIC);
+
+ /* calculate bold italic font desc */
+ bolditalicdesc = pango_font_description_copy (bolddesc);
+ pango_font_description_set_style (bolditalicdesc, PANGO_STYLE_ITALIC);
+
+ draw->fonts[VTE_DRAW_NORMAL] = font_info_create_for_widget (widget, fontdesc);
+ draw->fonts[VTE_DRAW_BOLD] = font_info_create_for_widget (widget, bolddesc);
+ draw->fonts[VTE_DRAW_ITALIC] = font_info_create_for_widget (widget, italicdesc);
+ draw->fonts[VTE_DRAW_ITALIC | VTE_DRAW_BOLD] =
+ font_info_create_for_widget (widget, bolditalicdesc);
pango_font_description_free (bolddesc);
+ pango_font_description_free (italicdesc);
+ pango_font_description_free (bolditalicdesc);
/* Decide if we should keep this bold font face, per bug 54926:
* - reject bold font if it is not within 10% of normal font width
*/
- if ( abs((draw->font_bold->width * 100 / draw->font->width) - 100) > 10 ) {
- font_info_destroy (draw->font_bold);
- draw->font_bold = draw->font;
+ normal = VTE_DRAW_NORMAL;
+ bold = normal | VTE_DRAW_BOLD;
+ ratio = draw->fonts[bold]->width * 100 / draw->fonts[normal]->width;
+ if (abs(ratio - 100) > 10) {
+ _vte_debug_print (VTE_DEBUG_DRAW,
+ "Rejecting bold font (%i%%).\n", ratio);
+ font_info_destroy (draw->fonts[bold]);
+ draw->fonts[bold] = draw->fonts[normal];
+ }
+ normal = VTE_DRAW_ITALIC;
+ bold = normal | VTE_DRAW_BOLD;
+ ratio = draw->fonts[bold]->width * 100 / draw->fonts[normal]->width;
+ if (abs(ratio - 100) > 10) {
+ _vte_debug_print (VTE_DEBUG_DRAW,
+ "Rejecting italic bold font (%i%%).\n", ratio);
+ font_info_destroy (draw->fonts[bold]);
+ draw->fonts[bold] = draw->fonts[normal];
}
}
@@ -945,41 +894,42 @@ void
_vte_draw_get_text_metrics(struct _vte_draw *draw,
gint *width, gint *height, gint *ascent)
{
- g_return_if_fail (draw->font != NULL);
+ g_return_if_fail (draw->fonts[VTE_DRAW_NORMAL] != NULL);
if (width)
- *width = draw->font->width;
+ *width = draw->fonts[VTE_DRAW_NORMAL]->width;
if (height)
- *height = draw->font->height;
+ *height = draw->fonts[VTE_DRAW_NORMAL]->height;
if (ascent)
- *ascent = draw->font->ascent;
+ *ascent = draw->fonts[VTE_DRAW_NORMAL]->ascent;
}
int
_vte_draw_get_char_width (struct _vte_draw *draw, vteunistr c, int columns,
- gboolean bold)
+ guint style)
{
struct unistr_info *uinfo;
- g_return_val_if_fail (draw->font != NULL, 0);
+ g_return_val_if_fail (draw->fonts[VTE_DRAW_NORMAL] != NULL, 0);
- uinfo = font_info_get_unistr_info (bold ? draw->font_bold : draw->font, c);
+ uinfo = font_info_get_unistr_info (draw->fonts[style], c);
return uinfo->width;
}
-static gboolean
-_vte_draw_has_bold (struct _vte_draw *draw)
+gboolean
+_vte_draw_has_bold (struct _vte_draw *draw, guint style)
{
- return (draw->font != draw->font_bold);
+ return (draw->fonts[style ^ VTE_DRAW_BOLD] != draw->fonts[style]);
}
-static void
-set_source_color_alpha (cairo_t *cr,
- const PangoColor *color,
- guchar alpha)
+void
+_vte_draw_set_source_color_alpha (struct _vte_draw *draw,
+ const PangoColor *color,
+ guchar alpha)
{
- cairo_set_source_rgba (cr,
+ g_assert(draw->cr);
+ cairo_set_source_rgba (draw->cr,
color->red / 65535.,
color->green / 65535.,
color->blue / 65535.,
@@ -989,17 +939,18 @@ set_source_color_alpha (cairo_t *cr,
static void
_vte_draw_text_internal (struct _vte_draw *draw,
struct _vte_draw_text_request *requests, gsize n_requests,
- const PangoColor *color, guchar alpha, gboolean bold)
+ const PangoColor *color, guchar alpha, guint style)
{
gsize i;
cairo_scaled_font_t *last_scaled_font = NULL;
int n_cr_glyphs = 0;
cairo_glyph_t cr_glyphs[MAX_RUN_LENGTH];
- struct font_info *font = bold ? draw->font_bold : draw->font;
+ struct font_info *font = draw->fonts[style];
g_return_if_fail (font != NULL);
- set_source_color_alpha (draw->cr, color, alpha);
+ g_assert(draw->cr);
+ _vte_draw_set_source_color_alpha (draw, color, alpha);
cairo_set_operator (draw->cr, CAIRO_OPERATOR_OVER);
for (i = 0; i < n_requests; i++) {
@@ -1055,9 +1006,9 @@ _vte_draw_text_internal (struct _vte_draw *draw,
void
_vte_draw_text (struct _vte_draw *draw,
struct _vte_draw_text_request *requests, gsize n_requests,
- const PangoColor *color, guchar alpha, gboolean bold)
+ const PangoColor *color, guchar alpha, guint style)
{
- g_return_if_fail (draw->started);
+ g_assert(draw->cr);
if (_vte_debug_on (VTE_DEBUG_DRAW)) {
GString *string = g_string_new ("");
@@ -1067,16 +1018,17 @@ _vte_draw_text (struct _vte_draw *draw,
g_string_append_unichar (string, requests[n].c);
}
str = g_string_free (string, FALSE);
- g_printerr ("draw_text (\"%s\", len=%"G_GSIZE_FORMAT", color=(%d,%d,%d,%d), %s)\n",
- str, n_requests, color->red, color->green, color->blue,
- alpha, bold ? "bold" : "normal");
+ g_printerr ("draw_text (\"%s\", len=%"G_GSIZE_FORMAT", color=(%d,%d,%d,%d), %s - %s)\n",
+ str, n_requests, color->red, color->green, color->blue, alpha,
+ (style & VTE_DRAW_BOLD) ? "bold" : "normal",
+ (style & VTE_DRAW_ITALIC) ? "italic" : "regular");
g_free (str);
}
- _vte_draw_text_internal (draw, requests, n_requests, color, alpha, bold);
+ _vte_draw_text_internal (draw, requests, n_requests, color, alpha, style);
/* handle fonts that lack a bold face by double-striking */
- if (bold && !_vte_draw_has_bold (draw)) {
+ if ((style & VTE_DRAW_BOLD) && !_vte_draw_has_bold (draw, style)) {
gsize i;
/* Take a step to the right. */
@@ -1084,7 +1036,7 @@ _vte_draw_text (struct _vte_draw *draw,
requests[i].x++;
}
_vte_draw_text_internal (draw, requests,
- n_requests, color, alpha, FALSE);
+ n_requests, color, alpha, style);
/* Now take a step back. */
for (i = 0; i < n_requests; i++) {
requests[i].x--;
@@ -1093,35 +1045,38 @@ _vte_draw_text (struct _vte_draw *draw,
}
gboolean
-_vte_draw_has_char (struct _vte_draw *draw, vteunistr c, gboolean bold)
+_vte_draw_has_char (struct _vte_draw *draw, vteunistr c, guint style)
{
struct unistr_info *uinfo;
- _vte_debug_print (VTE_DEBUG_DRAW, "draw_has_char ('0x%04X', %s)\n", c,
- bold ? "bold" : "normal");
+ _vte_debug_print (VTE_DEBUG_DRAW, "draw_has_char ('0x%04X', %s - %s)\n", c,
+ (style & VTE_DRAW_BOLD) ? "bold" : "normal",
+ (style & VTE_DRAW_ITALIC) ? "italic" : "regular");
- g_return_val_if_fail (draw->font != NULL, FALSE);
+ g_return_val_if_fail (draw->fonts[VTE_DRAW_NORMAL] != NULL, FALSE);
- uinfo = font_info_get_unistr_info (bold ? draw->font_bold : draw->font, c);
+ uinfo = font_info_get_unistr_info (draw->fonts[style], c);
return !uinfo->has_unknown_chars;
}
gboolean
_vte_draw_char (struct _vte_draw *draw,
struct _vte_draw_text_request *request,
- const PangoColor *color, guchar alpha, gboolean bold)
+ const PangoColor *color, guchar alpha, guint style)
{
gboolean has_char;
_vte_debug_print (VTE_DEBUG_DRAW,
- "draw_char ('%c', color=(%d,%d,%d,%d), %s)\n",
+ "draw_char ('%c', color=(%d,%d,%d,%d), %s, %s)\n",
request->c,
color->red, color->green, color->blue,
- alpha, bold ? "bold" : "normal");
+ alpha,
+ (style & VTE_DRAW_BOLD) ? "bold" : "normal",
+ (style & VTE_DRAW_ITALIC) ? "italic" : "regular");
- has_char =_vte_draw_has_char (draw, request->c, bold);
+ has_char =_vte_draw_has_char (draw, request->c, style);
if (has_char)
- _vte_draw_text (draw, request, 1, color, alpha, bold);
+ _vte_draw_text (draw, request, 1, color, alpha, style);
return has_char;
}
@@ -1131,7 +1086,7 @@ _vte_draw_draw_rectangle (struct _vte_draw *draw,
gint x, gint y, gint width, gint height,
const PangoColor *color, guchar alpha)
{
- g_return_if_fail (draw->started);
+ g_assert(draw->cr);
_vte_debug_print (VTE_DEBUG_DRAW,
"draw_rectangle (%d, %d, %d, %d, color=(%d,%d,%d,%d))\n",
@@ -1141,7 +1096,7 @@ _vte_draw_draw_rectangle (struct _vte_draw *draw,
cairo_set_operator (draw->cr, CAIRO_OPERATOR_OVER);
cairo_rectangle (draw->cr, x+VTE_LINE_WIDTH/2., y+VTE_LINE_WIDTH/2., width-VTE_LINE_WIDTH, height-VTE_LINE_WIDTH);
- set_source_color_alpha (draw->cr, color, alpha);
+ _vte_draw_set_source_color_alpha (draw, color, alpha);
cairo_set_line_width (draw->cr, VTE_LINE_WIDTH);
cairo_stroke (draw->cr);
}
@@ -1151,7 +1106,7 @@ _vte_draw_fill_rectangle (struct _vte_draw *draw,
gint x, gint y, gint width, gint height,
const PangoColor *color, guchar alpha)
{
- g_return_if_fail (draw->started);
+ g_assert(draw->cr);
_vte_debug_print (VTE_DEBUG_DRAW,
"draw_fill_rectangle (%d, %d, %d, %d, color=(%d,%d,%d,%d))\n",
@@ -1161,6 +1116,6 @@ _vte_draw_fill_rectangle (struct _vte_draw *draw,
cairo_set_operator (draw->cr, CAIRO_OPERATOR_OVER);
cairo_rectangle (draw->cr, x, y, width, height);
- set_source_color_alpha (draw->cr, color, alpha);
+ _vte_draw_set_source_color_alpha (draw, color, alpha);
cairo_fill (draw->cr);
}
diff --git a/src/vtedraw.h b/src/vtedraw.h
index 4f651838..3f75e390 100644
--- a/src/vtedraw.h
+++ b/src/vtedraw.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2003 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* The interfaces in this file are subject to change at any time. */
@@ -24,10 +24,9 @@
#include <glib.h>
#include <gtk/gtk.h>
-#include "vtebg.h"
+#include <cairo.h>
#include "vte.h"
#include "vteunistr.h"
-#include "vte-gtk-compat.h"
G_BEGIN_DECLS
@@ -49,6 +48,10 @@ G_BEGIN_DECLS
#define VTE_DRAW_OPAQUE 0xff
#define VTE_DRAW_MAX_LENGTH 1024
+#define VTE_DRAW_NORMAL 0
+#define VTE_DRAW_BOLD 1
+#define VTE_DRAW_ITALIC 2
+
struct _vte_draw;
/* A request to draw a particular character spanning a given number of columns
@@ -60,49 +63,39 @@ struct _vte_draw_text_request {
gshort x, y, columns;
};
+guint _vte_draw_get_style(gboolean bold, gboolean italic);
+
/* Create and destroy a draw structure. */
-struct _vte_draw *_vte_draw_new(GtkWidget *widget);
+struct _vte_draw *_vte_draw_new(void);
void _vte_draw_free(struct _vte_draw *draw);
-/* Begin and end a drawing operation. If anything is buffered locally, it is
- flushed to the window system when _end() is called. */
-void _vte_draw_start(struct _vte_draw *draw);
-void _vte_draw_end(struct _vte_draw *draw);
+cairo_t *_vte_draw_get_context (struct _vte_draw *draw);
+
+void _vte_draw_set_cairo(struct _vte_draw *draw,
+ cairo_t *cr);
void _vte_draw_set_background_solid(struct _vte_draw *draw,
- double red,
- double green,
- double blue,
- double opacity);
-void _vte_draw_set_background_image(struct _vte_draw *draw,
- VteBgSourceType type,
- GdkPixbuf *pixbuf,
- const char *file,
- const PangoColor *color,
- double saturation);
-void _vte_draw_set_background_scroll(struct _vte_draw *draw,
- gint x, gint y);
-
-void _vte_draw_clip(struct _vte_draw *draw, GdkRegion *region);
+ const GdkRGBA *color);
+
void _vte_draw_clear(struct _vte_draw *draw,
gint x, gint y, gint width, gint height);
void _vte_draw_set_text_font(struct _vte_draw *draw,
- const PangoFontDescription *fontdesc,
- VteTerminalAntiAlias anti_alias);
+ GtkWidget *widget,
+ const PangoFontDescription *fontdesc);
void _vte_draw_get_text_metrics(struct _vte_draw *draw,
gint *width, gint *height, gint *ascent);
int _vte_draw_get_char_width(struct _vte_draw *draw, vteunistr c, int columns,
- gboolean bold);
+ guint style);
+gboolean _vte_draw_has_bold (struct _vte_draw *draw, guint style);
void _vte_draw_text(struct _vte_draw *draw,
struct _vte_draw_text_request *requests, gsize n_requests,
- const PangoColor *color, guchar alpha, gboolean);
+ const PangoColor *color, guchar alpha, guint style);
gboolean _vte_draw_char(struct _vte_draw *draw,
struct _vte_draw_text_request *request,
- const PangoColor *color, guchar alpha, gboolean bold);
-gboolean _vte_draw_has_char(struct _vte_draw *draw, vteunistr c, gboolean bold);
-
+ const PangoColor *color, guchar alpha, guint style);
+gboolean _vte_draw_has_char(struct _vte_draw *draw, vteunistr c, guint style);
void _vte_draw_fill_rectangle(struct _vte_draw *draw,
gint x, gint y, gint width, gint height,
@@ -110,6 +103,9 @@ void _vte_draw_fill_rectangle(struct _vte_draw *draw,
void _vte_draw_draw_rectangle(struct _vte_draw *draw,
gint x, gint y, gint width, gint height,
const PangoColor *color, guchar alpha);
+void _vte_draw_set_source_color_alpha (struct _vte_draw *draw,
+ const PangoColor *color,
+ guchar alpha);
G_END_DECLS
diff --git a/src/vteint.h b/src/vteint.h
index d7a2af61..fd5d62df 100644
--- a/src/vteint.h
+++ b/src/vteint.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2003 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef vte_vteint_h_included
diff --git a/src/vtepty-private.h b/src/vtepty-private.h
index 70347ee5..461ef0e3 100644
--- a/src/vtepty-private.h
+++ b/src/vtepty-private.h
@@ -1,31 +1,23 @@
/*
* Copyright © 2009, 2010 Christian Persch
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
G_BEGIN_DECLS
-VtePtyFlags __vte_pty_get_pty_flags(gboolean lastlog,
- gboolean utmp,
- gboolean wtmp);
-
-char **__vte_pty_get_argv (const char *command,
- char **argv,
- GSpawnFlags *flags /* inout */);
-
gboolean __vte_pty_spawn (VtePty *pty,
const char *working_directory,
char **argv,
@@ -36,8 +28,4 @@ gboolean __vte_pty_spawn (VtePty *pty,
GPid *child_pid /* out */,
GError **error);
-gboolean __vte_pty_fork(VtePty *pty,
- GPid *pid,
- GError **error);
-
G_END_DECLS
diff --git a/src/vtepty.h b/src/vtepty.h
index a0aea6ad..2cda0f7b 100644
--- a/src/vtepty.h
+++ b/src/vtepty.h
@@ -1,19 +1,19 @@
/*
* Copyright © 2009, 2010 Christian Persch
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined (__VTE_VTE_H_INSIDE__) && !defined (VTE_COMPILATION)
@@ -23,7 +23,7 @@
#ifndef VTE_PTY_H
#define VTE_PTY_H
-#include <glib-object.h>
+#include <gio/gio.h>
G_BEGIN_DECLS
@@ -61,6 +61,8 @@ typedef enum {
VTE_PTY_ERROR_PTY98_FAILED
} VtePtyError;
+#define VTE_SPAWN_NO_PARENT_ENVV (1 << 25)
+
GQuark vte_pty_error_quark (void);
/**
@@ -87,11 +89,13 @@ typedef struct _VtePtyClass VtePtyClass;
GType vte_pty_get_type (void);
-VtePty *vte_pty_new (VtePtyFlags flags,
- GError **error);
+VtePty *vte_pty_new_sync (VtePtyFlags flags,
+ GCancellable *cancellable,
+ GError **error);
-VtePty *vte_pty_new_foreign (int fd,
- GError **error);
+VtePty *vte_pty_new_foreign_sync (int fd,
+ GCancellable *cancellable,
+ GError **error);
int vte_pty_get_fd (VtePty *pty);
diff --git a/src/vteregex.c b/src/vteregex.c
deleted file mode 100644
index c8d1fe7a..00000000
--- a/src/vteregex.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (C) 2003 Red Hat, Inc.
- *
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <config.h>
-
-#include <sys/types.h>
-#include <errno.h>
-#include <limits.h>
-#include <string.h>
-#include <unistd.h>
-#include <glib.h>
-
-#include <regex.h>
-
-#include "vteregex.h"
-
-static gint
-compare_matches(gconstpointer a, gconstpointer b)
-{
- const struct _vte_regex_match *A, *B;
- A = a;
- B = b;
- if (B->rm_so != A->rm_so) {
- return B->rm_so - A->rm_so;
- }
- return B->rm_eo - A->rm_eo;
-}
-
-/* Sort match structures first by starting position, and then by ending
- * position. We do this because some expression matching APIs sort their
- * results differently, or just plain don't sort them. */
-static void
-_vte_regex_sort_matches(struct _vte_regex_match *matches, gsize n_matches)
-{
- GArray *array;
- if (n_matches <= 1) {
- return;
- }
- array = g_array_new(FALSE, FALSE, sizeof(struct _vte_regex_match));
- g_array_append_vals(array, matches, n_matches);
- g_array_sort(array, compare_matches);
- memmove(matches, array->data,
- n_matches * sizeof(struct _vte_regex_match));
- g_array_free(array, TRUE);
-}
-
-/* Ah, POSIX regex. Kind of clunky, but I don't have anything better to
- * suggest. Better still, it works on my machine. */
-
-struct _vte_regex {
- regex_t posix_regex;
-};
-
-struct _vte_regex *
-_vte_regex_compile(const char *pattern)
-{
- struct _vte_regex *ret;
- int i;
-
- ret = g_slice_new(struct _vte_regex);
- i = regcomp(&ret->posix_regex, pattern, REG_EXTENDED);
- if (i != 0) {
- g_slice_free(struct _vte_regex, ret);
- return NULL;
- }
- return ret;
-}
-
-void
-_vte_regex_free(struct _vte_regex *regex)
-{
- regfree(&regex->posix_regex);
- g_slice_free(struct _vte_regex, regex);
-}
-
-int
-_vte_regex_exec(struct _vte_regex *regex, const char *string,
- gsize nmatch, struct _vte_regex_match *matches)
-{
- regmatch_t *posix_matches;
- guint i, ret;
-
- posix_matches = g_new(regmatch_t, nmatch);
- ret = regexec(&regex->posix_regex, string, nmatch, posix_matches, 0);
- if (ret == 0) {
- for (i = 0; i < nmatch; i++) {
- matches[i].rm_so = -1;
- matches[i].rm_eo = -1;
- }
- for (i = 0; i < nmatch; i++) {
- matches[i].rm_so = posix_matches[i].rm_so;
- matches[i].rm_eo = posix_matches[i].rm_eo;
- if (matches[i].rm_so == -1) {
- _vte_regex_sort_matches(matches, i);
- break;
- }
- }
- }
- g_free(posix_matches);
- if (ret == 0) {
- return 0;
- }
- return -1;
-}
diff --git a/src/vteregex.h b/src/vteregex.h
deleted file mode 100644
index 26fc884c..00000000
--- a/src/vteregex.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2003 Red Hat, Inc.
- *
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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
- * General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef vte_vteregex_h_included
-#define vte_vteregex_h_included
-
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-struct _vte_regex_match {
- int rm_so, rm_eo;
-};
-struct _vte_regex;
-
-struct _vte_regex * _vte_regex_compile(const char *pattern);
-void _vte_regex_free(struct _vte_regex *regex);
-int _vte_regex_exec(struct _vte_regex *regex, const char *string,
- gsize nmatch, struct _vte_regex_match *matches);
-G_END_DECLS
-
-#endif
diff --git a/src/vterowdata.c b/src/vterowdata.c
index 1a295236..52f7960d 100644
--- a/src/vterowdata.c
+++ b/src/vterowdata.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2002,2009 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Red Hat Author(s): Nalin Dahyabhai, Behdad Esfahbod
*/
diff --git a/src/vterowdata.h b/src/vterowdata.h
index a911500a..10e2140e 100644
--- a/src/vterowdata.h
+++ b/src/vterowdata.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2002 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* The interfaces in this file are subject to change at any time. */
@@ -26,13 +26,22 @@
G_BEGIN_DECLS
-#define VTE_DEF_FG 256
-#define VTE_DEF_BG 257
+#define VTE_DEFAULT_FG 256
+#define VTE_DEFAULT_BG 257
#define VTE_BOLD_FG 258
#define VTE_DIM_FG 259
-#define VTE_DEF_HL 260
-#define VTE_CUR_BG 261
-#define VTE_PALETTE_SIZE 262
+#define VTE_HIGHLIGHT_FG 260
+#define VTE_HIGHLIGHT_BG 261
+#define VTE_CURSOR_BG 262
+#define VTE_PALETTE_SIZE 263
+
+
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 6)
+#define VTE_GNUC_PACKED \
+ __attribute__((__packed__))
+#else
+#define VTE_GNUC_PACKED
+#endif /* !__GNUC__ */
/*
@@ -40,39 +49,38 @@ G_BEGIN_DECLS
*
* Ordered by most commonly changed attributes, to
* optimize the compact representation.
+ *
+ * When adding new attributes, remember to update basic_cell below too.
*/
typedef struct _VteCellAttr {
- guint32 fragment: 1; /* A continuation cell. */
- guint32 columns: 4; /* Number of visible columns
+ guint64 fragment: 1; /* A continuation cell. */
+ guint64 columns: 4; /* Number of visible columns
(as determined by g_unicode_iswide(c)).
Also abused for tabs; bug 353610
Keep at least 4 for tabs to work
*/
- guint32 bold: 1;
- guint32 fore: 9; /* Index into color palette */
- guint32 back: 9; /* Index into color palette. */
-
- guint32 standout: 1;
- guint32 underline: 1;
- guint32 strikethrough: 1;
+ guint64 bold: 1;
+ guint64 italic: 1;
+ guint64 fore: 25; /* Index into color palette, or direct RGB, */
+ /* 4-byte boundary */
+ guint64 back: 25; /* see vte-private.h */
- guint32 reverse: 1;
- guint32 blink: 1;
- guint32 half: 1;
+ guint64 standout: 1;
+ guint64 underline: 1;
+ guint64 strikethrough: 1;
- guint32 invisible: 1;
- /* unused; bug 499893
- guint32 protect: 1;
- */
+ guint64 reverse: 1;
+ guint64 blink: 1;
+ guint64 half: 1;
- /* 30 bits */
+ guint64 invisible: 1;
} VteCellAttr;
-G_STATIC_ASSERT (sizeof (VteCellAttr) == 4);
+G_STATIC_ASSERT (sizeof (VteCellAttr) == 8);
typedef union _VteIntCellAttr {
VteCellAttr s;
- guint32 i;
+ guint64 i;
} VteIntCellAttr;
G_STATIC_ASSERT (sizeof (VteCellAttr) == sizeof (VteIntCellAttr));
@@ -80,17 +88,17 @@ G_STATIC_ASSERT (sizeof (VteCellAttr) == sizeof (VteIntCellAttr));
* VteCell: A single cell's data
*/
-typedef struct _VteCell {
+typedef struct VTE_GNUC_PACKED _VteCell {
vteunistr c;
VteCellAttr attr;
} VteCell;
-G_STATIC_ASSERT (sizeof (VteCell) == 8);
+G_STATIC_ASSERT (sizeof (VteCell) == 12);
typedef union _VteIntCell {
VteCell cell;
- struct {
+ struct VTE_GNUC_PACKED {
guint32 c;
- guint32 attr;
+ guint64 attr;
} i;
} VteIntCell;
G_STATIC_ASSERT (sizeof (VteCell) == sizeof (VteIntCell));
@@ -102,8 +110,9 @@ static const VteIntCell basic_cell = {
0, /* fragment */
1, /* columns */
0, /* bold */
- VTE_DEF_FG, /* fore */
- VTE_DEF_BG, /* back */
+ 0, /* italic */
+ VTE_DEFAULT_FG, /* fore */
+ VTE_DEFAULT_BG, /* back */
0, /* standout */
0, /* underline */
diff --git a/src/vteseq-n.gperf b/src/vteseq-n.gperf
index 8cbcb218..388c98f9 100644
--- a/src/vteseq-n.gperf
+++ b/src/vteseq-n.gperf
@@ -41,7 +41,9 @@ struct vteseq_n_struct {
#"memory-lock", VTE_SEQUENCE_HANDLER_NULL
"save-cursor", VTE_SEQUENCE_HANDLER(vte_sequence_handler_sc)
"scroll-down", VTE_SEQUENCE_HANDLER(vte_sequence_handler_scroll_down)
-"change-color", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_color)
+"change-color-bel", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_color_bel)
+"change-color-st", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_color_st)
+"reset-color", VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_color)
"delete-lines", VTE_SEQUENCE_HANDLER(vte_sequence_handler_delete_lines)
#"double-width", VTE_SEQUENCE_HANDLER_NULL
"insert-lines", VTE_SEQUENCE_HANDLER(vte_sequence_handler_insert_lines)
@@ -77,7 +79,9 @@ struct vteseq_n_struct {
#"end-of-guarded-area", VTE_SEQUENCE_HANDLER_NULL
"utf-8-character-set", VTE_SEQUENCE_HANDLER(vte_sequence_handler_utf_8_charset)
"window-manipulation", VTE_SEQUENCE_HANDLER(vte_sequence_handler_window_manipulation)
-"change-cursor-colors", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_cursor_color)
+"change-cursor-colors-bel", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_cursor_color_bel)
+"change-cursor-colors-st", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_cursor_color_st)
+"reset-cursor-colors", VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_cursor_color)
"character-attributes", VTE_SEQUENCE_HANDLER(vte_sequence_handler_character_attributes)
"device-status-report", VTE_SEQUENCE_HANDLER(vte_sequence_handler_device_status_report)
"set-scrolling-region", VTE_SEQUENCE_HANDLER(vte_sequence_handler_set_scrolling_region)
@@ -94,7 +98,12 @@ struct vteseq_n_struct {
#"double-height-top-half", VTE_SEQUENCE_HANDLER_NULL
"line-position-absolute", VTE_SEQUENCE_HANDLER(vte_sequence_handler_line_position_absolute)
"return-terminal-status", VTE_SEQUENCE_HANDLER(vte_sequence_handler_return_terminal_status)
-#"change-highlight-colors", VTE_SEQUENCE_HANDLER_NULL
+"change-highlight-background-colors-bel", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_highlight_background_color_bel)
+"change-highlight-background-colors-st", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_highlight_background_color_st)
+"reset-highlight-background-colors", VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_highlight_background_color)
+"change-highlight-foreground-colors-bel", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_highlight_foreground_color_bel)
+"change-highlight-foreground-colors-st", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_highlight_foreground_color_st)
+"reset-highlight-foreground-colors", VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_highlight_foreground_color)
#"enable-filter-rectangle", VTE_SEQUENCE_HANDLER_NULL
"insert-blank-characters", VTE_SEQUENCE_HANDLER(vte_sequence_handler_insert_blank_characters)
#"invoke-g2-character-set", VTE_SEQUENCE_HANDLER_NULL
@@ -104,8 +113,12 @@ struct vteseq_n_struct {
#"ansi-conformance-level-1", VTE_SEQUENCE_HANDLER_NULL
#"ansi-conformance-level-2", VTE_SEQUENCE_HANDLER_NULL
#"ansi-conformance-level-3", VTE_SEQUENCE_HANDLER_NULL
-#"change-background-colors", VTE_SEQUENCE_HANDLER_NULL
-#"change-foreground-colors", VTE_SEQUENCE_HANDLER_NULL
+"change-background-colors-bel", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_background_color_bel)
+"change-background-colors-st", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_background_color_st)
+"reset-background-colors", VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_background_color)
+"change-foreground-colors-bel", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_foreground_color_bel)
+"change-foreground-colors-st", VTE_SEQUENCE_HANDLER(vte_sequence_handler_change_foreground_color_st)
+"reset-foreground-colors", VTE_SEQUENCE_HANDLER(vte_sequence_handler_reset_foreground_color)
"dec-device-status-report", VTE_SEQUENCE_HANDLER(vte_sequence_handler_dec_device_status_report)
#"enable-locator-reporting", VTE_SEQUENCE_HANDLER_NULL
#"request-locator-position", VTE_SEQUENCE_HANDLER_NULL
@@ -117,8 +130,15 @@ struct vteseq_n_struct {
"character-position-absolute", VTE_SEQUENCE_HANDLER(vte_sequence_handler_character_position_absolute)
"request-terminal-parameters", VTE_SEQUENCE_HANDLER(vte_sequence_handler_request_terminal_parameters)
#"select-character-protection", VTE_SEQUENCE_HANDLER_NULL
-#"change-tek-background-colors", VTE_SEQUENCE_HANDLER_NULL
-#"change-tek-foreground-colors", VTE_SEQUENCE_HANDLER_NULL
+#"change-tek-background-colors-bel", VTE_SEQUENCE_HANDLER_NULL
+#"change-tek-background-colors-st", VTE_SEQUENCE_HANDLER_NULL
+#"reset-tek-background-colors", VTE_SEQUENCE_HANDLER_NULL
+#"change-tek-foreground-colors-bel", VTE_SEQUENCE_HANDLER_NULL
+#"change-tek-foreground-colors-st", VTE_SEQUENCE_HANDLER_NULL
+#"reset-tek-foreground-colors", VTE_SEQUENCE_HANDLER_NULL
+#"change-tek-cursor-colors-bel", VTE_SEQUENCE_HANDLER_NULL
+#"change-tek-cursor-colors-st", VTE_SEQUENCE_HANDLER_NULL
+#"reset-tek-cursor-colors", VTE_SEQUENCE_HANDLER_NULL
#"invoke-g1-character-set-as-gr", VTE_SEQUENCE_HANDLER_NULL
#"invoke-g2-character-set-as-gr", VTE_SEQUENCE_HANDLER_NULL
#"invoke-g3-character-set-as-gr", VTE_SEQUENCE_HANDLER_NULL
@@ -127,5 +147,11 @@ struct vteseq_n_struct {
"linux-console-cursor-attributes", VTE_SEQUENCE_HANDLER(vte_sequence_handler_noop)
"horizontal-and-vertical-position", VTE_SEQUENCE_HANDLER(vte_sequence_handler_horizontal_and_vertical_position)
"send-secondary-device-attributes", VTE_SEQUENCE_HANDLER(vte_sequence_handler_send_secondary_device_attributes)
-#"change-mouse-cursor-background-colors", VTE_SEQUENCE_HANDLER_NULL
-#"change-mouse-cursor-foreground-colors", VTE_SEQUENCE_HANDLER_NULL
+#"change-mouse-cursor-background-colors-bel", VTE_SEQUENCE_HANDLER_NULL
+#"change-mouse-cursor-background-colors-st", VTE_SEQUENCE_HANDLER_NULL
+#"reset-mouse-cursor-background-colors", VTE_SEQUENCE_HANDLER_NULL
+#"change-mouse-cursor-foreground-colors-bel", VTE_SEQUENCE_HANDLER_NULL
+#"change-mouse-cursor-foreground-colors-st", VTE_SEQUENCE_HANDLER_NULL
+#"reset-mouse-cursor-foreground-colors", VTE_SEQUENCE_HANDLER_NULL
+"set-current-directory-uri", VTE_SEQUENCE_HANDLER(vte_sequence_handler_set_current_directory_uri)
+"set-current-file-uri", VTE_SEQUENCE_HANDLER(vte_sequence_handler_set_current_file_uri)
diff --git a/src/vteseq.c b/src/vteseq.c
index 6273f9e3..c0f676ef 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2001-2004 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -31,6 +31,7 @@
#include "vtetc.h"
#define BEL "\007"
+#define ST _VTE_CAP_ST
@@ -115,13 +116,13 @@ vte_ucs4_to_utf8 (VteTerminal *terminal, const guchar *in)
inlen = vte_unichar_strlen ((gunichar *) in) * sizeof (gunichar);
outlen = (inlen * VTE_UTF8_BPC) + 1;
- _vte_buffer_set_minimum_size (terminal->pvt->conv_buffer, outlen);
+ _vte_byte_array_set_minimum_size (terminal->pvt->conv_buffer, outlen);
buf = bufptr = terminal->pvt->conv_buffer->data;
if (_vte_conv (conv, &in, &inlen, &buf, &outlen) == (size_t) -1) {
_vte_debug_print (VTE_DEBUG_IO,
"Error converting %ld string bytes (%s), skipping.\n",
- (long) _vte_buffer_length (terminal->pvt->outgoing),
+ (long) _vte_byte_array_length (terminal->pvt->outgoing),
g_strerror (errno));
bufptr = NULL;
} else {
@@ -135,10 +136,11 @@ vte_ucs4_to_utf8 (VteTerminal *terminal, const guchar *in)
}
static gboolean
-vte_parse_color (const char *spec, GdkColor *color)
+vte_parse_color (const char *spec, PangoColor *color)
{
gchar *spec_copy = (gchar *) spec;
gboolean retval = FALSE;
+ GdkColor gdk_color;
/* gdk_color_parse doesnt handle all XParseColor formats. It only
* supports the #RRRGGGBBB format, not the rgb:RRR/GGG/BBB format.
@@ -158,11 +160,17 @@ vte_parse_color (const char *spec, GdkColor *color)
*cur++ = '\0';
}
- retval = gdk_color_parse (spec_copy, color);
+ retval = gdk_color_parse (spec_copy, &gdk_color);
if (spec_copy != spec)
g_free (spec_copy);
+ if (retval) {
+ color->red = gdk_color.red;
+ color->green = gdk_color.green;
+ color->blue = gdk_color.blue;
+ }
+
return retval;
}
@@ -276,7 +284,7 @@ _vte_terminal_clear_screen (VteTerminal *terminal)
row = screen->cursor_current.row - screen->insert_delta;
initial = _vte_ring_next(screen->row_data);
/* Add a new screen's worth of rows. */
- for (i = 0; i < terminal->row_count; i++)
+ for (i = 0; i < terminal->pvt->row_count; i++)
_vte_terminal_ring_append (terminal, TRUE);
/* Move the cursor and insertion delta to the first line in the
* newly-cleared area and scroll if need be. */
@@ -307,11 +315,11 @@ _vte_terminal_clear_current_line (VteTerminal *terminal)
/* Remove it. */
_vte_row_data_shrink (rowdata, 0);
/* Add enough cells to the end of the line to fill out the row. */
- _vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count);
+ _vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->pvt->column_count);
rowdata->attr.soft_wrapped = 0;
/* Repaint this row. */
_vte_invalidate_cells(terminal,
- 0, terminal->column_count,
+ 0, terminal->pvt->column_count,
screen->cursor_current.row, 1);
}
@@ -337,11 +345,11 @@ _vte_terminal_clear_above_current (VteTerminal *terminal)
/* Remove it. */
_vte_row_data_shrink (rowdata, 0);
/* Add new cells until we fill the row. */
- _vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count);
+ _vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->pvt->column_count);
rowdata->attr.soft_wrapped = 0;
/* Repaint the row. */
_vte_invalidate_cells(terminal,
- 0, terminal->column_count, i, 1);
+ 0, terminal->pvt->column_count, i, 1);
}
}
/* We've modified the display. Make a note of it. */
@@ -362,7 +370,7 @@ _vte_terminal_scroll_text (VteTerminal *terminal, int scroll_amount)
end = screen->insert_delta + screen->scrolling_region.end;
} else {
start = screen->insert_delta;
- end = start + terminal->row_count - 1;
+ end = start + terminal->pvt->row_count - 1;
}
while (_vte_ring_next(screen->row_data) <= end)
@@ -557,7 +565,7 @@ vte_sequence_handler_multiple(VteTerminal *terminal,
GValueArray *params,
VteTerminalSequenceHandler handler)
{
- vte_sequence_handler_multiple_limited(terminal, params, handler, G_MAXLONG);
+ vte_sequence_handler_multiple_limited(terminal, params, handler, G_MAXUSHORT);
}
static void
@@ -566,7 +574,35 @@ vte_sequence_handler_multiple_r(VteTerminal *terminal,
VteTerminalSequenceHandler handler)
{
vte_sequence_handler_multiple_limited(terminal, params, handler,
- terminal->column_count - terminal->pvt->screen->cursor_current.col);
+ terminal->pvt->column_count - terminal->pvt->screen->cursor_current.col);
+}
+
+static void
+vte_reset_mouse_smooth_scroll_delta(VteTerminal *terminal,
+ GValueArray *params)
+{
+ terminal->pvt->mouse_smooth_scroll_delta = 0.;
+}
+
+struct decset_t {
+ gint16 setting;
+ /* offset in VteTerminalPrivate (> 0) or VteScreen (< 0) */
+ gint16 boffset;
+ gint16 ioffset;
+ gint16 poffset;
+ gint16 fvalue;
+ gint16 tvalue;
+ VteTerminalSequenceHandler reset, set;
+};
+
+static int
+decset_cmp(const void *va,
+ const void *vb)
+{
+ const struct decset_t *a = va;
+ const struct decset_t *b = vb;
+
+ return a->setting < b->setting ? -1 : a->setting > b->setting;
}
/* Manipulate certain terminal attributes. */
@@ -577,183 +613,226 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
gboolean save,
gboolean set)
{
- gboolean recognized = FALSE;
- gpointer p;
- guint i;
- struct {
- int setting;
- gboolean *bvalue;
- gint *ivalue;
- gpointer *pvalue;
- gpointer fvalue;
- gpointer tvalue;
- VteTerminalSequenceHandler reset, set;
- } settings[] = {
+ static const struct decset_t const settings[] = {
+#define PRIV_OFFSET(member) (G_STRUCT_OFFSET(VteTerminalPrivate, member))
+#define SCREEN_OFFSET(member) (-G_STRUCT_OFFSET(VteScreen, member))
/* 1: Application/normal cursor keys. */
- {1, NULL, &terminal->pvt->cursor_mode, NULL,
- GINT_TO_POINTER(VTE_KEYMODE_NORMAL),
- GINT_TO_POINTER(VTE_KEYMODE_APPLICATION),
+ {1, 0, PRIV_OFFSET(cursor_mode), 0,
+ VTE_KEYMODE_NORMAL,
+ VTE_KEYMODE_APPLICATION,
NULL, NULL,},
/* 2: disallowed, we don't do VT52. */
- {2, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
- /* 3: disallowed, window size is set by user. */
- {3, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
- /* 4: Smooth scroll. */
- {4, &terminal->pvt->smooth_scroll, NULL, NULL,
- GINT_TO_POINTER(FALSE),
- GINT_TO_POINTER(TRUE),
- NULL, NULL,},
+ {2, 0, 0, 0, 0, 0, NULL, NULL,},
+ /* 3: DECCOLM set/reset to and from 132/80 columns */
+ {3, 0, 0, 0,
+ FALSE,
+ TRUE,
+ NULL, NULL,},
/* 5: Reverse video. */
- {5, &terminal->pvt->screen->reverse_mode, NULL, NULL,
- GINT_TO_POINTER(FALSE),
- GINT_TO_POINTER(TRUE),
+ {5, SCREEN_OFFSET(reverse_mode), 0, 0,
+ FALSE,
+ TRUE,
NULL, NULL,},
/* 6: Origin mode: when enabled, cursor positioning is
* relative to the scrolling region. */
- {6, &terminal->pvt->screen->origin_mode, NULL, NULL,
- GINT_TO_POINTER(FALSE),
- GINT_TO_POINTER(TRUE),
+ {6, SCREEN_OFFSET(origin_mode), 0, 0,
+ FALSE,
+ TRUE,
NULL, NULL,},
/* 7: Wraparound mode. */
- {7, &terminal->pvt->flags.am, NULL, NULL,
- GINT_TO_POINTER(FALSE),
- GINT_TO_POINTER(TRUE),
+ {7, PRIV_OFFSET(flags.am), 0, 0,
+ FALSE,
+ TRUE,
NULL, NULL,},
/* 8: disallowed, keyboard repeat is set by user. */
- {8, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
+ {8, 0, 0, 0, 0, 0, NULL, NULL,},
/* 9: Send-coords-on-click. */
- {9, NULL, &terminal->pvt->mouse_tracking_mode, NULL,
- GINT_TO_POINTER(0),
- GINT_TO_POINTER(MOUSE_TRACKING_SEND_XY_ON_CLICK),
- NULL, NULL,},
+ {9, 0, PRIV_OFFSET(mouse_tracking_mode), 0,
+ 0,
+ MOUSE_TRACKING_SEND_XY_ON_CLICK,
+ vte_reset_mouse_smooth_scroll_delta,
+ vte_reset_mouse_smooth_scroll_delta,},
/* 12: disallowed, cursor blinks is set by user. */
- {12, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
+ {12, 0, 0, 0, 0, 0, NULL, NULL,},
/* 18: print form feed. */
/* 19: set print extent to full screen. */
/* 25: Cursor visible. */
- {25, &terminal->pvt->cursor_visible, NULL, NULL,
- GINT_TO_POINTER(FALSE),
- GINT_TO_POINTER(TRUE),
+ {25, PRIV_OFFSET(cursor_visible), 0, 0,
+ FALSE,
+ TRUE,
NULL, NULL,},
/* 30/rxvt: disallowed, scrollbar visibility is set by user. */
- {30, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
+ {30, 0, 0, 0, 0, 0, NULL, NULL,},
/* 35/rxvt: disallowed, fonts set by user. */
- {35, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
+ {35, 0, 0, 0, 0, 0, NULL, NULL,},
/* 38: enter Tektronix mode. */
- /* 40: disallowed, the user sizes dynamically. */
- {40, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
+ /* 40: Enable DECCOLM mode. */
+ {40, PRIV_OFFSET(deccolm_mode), 0, 0,
+ FALSE,
+ TRUE,
+ NULL, NULL,},
/* 41: more(1) fix. */
/* 42: Enable NLS replacements. */
- {42, &terminal->pvt->nrc_mode, NULL, NULL,
- GINT_TO_POINTER(FALSE),
- GINT_TO_POINTER(TRUE),
+ {42, PRIV_OFFSET(nrc_mode), 0, 0,
+ FALSE,
+ TRUE,
NULL, NULL,},
/* 44: Margin bell. */
- {44, &terminal->pvt->margin_bell, NULL, NULL,
- GINT_TO_POINTER(FALSE),
- GINT_TO_POINTER(TRUE),
+ {44, PRIV_OFFSET(margin_bell), 0, 0,
+ FALSE,
+ TRUE,
NULL, NULL,},
/* 47: Alternate screen. */
- {47, NULL, NULL, (gpointer) &terminal->pvt->screen,
- &terminal->pvt->normal_screen,
- &terminal->pvt->alternate_screen,
+ {47, 0, 0, PRIV_OFFSET(screen),
+ PRIV_OFFSET(normal_screen),
+ PRIV_OFFSET(alternate_screen),
NULL, NULL,},
/* 66: Keypad mode. */
- {66, &terminal->pvt->keypad_mode, NULL, NULL,
- GINT_TO_POINTER(VTE_KEYMODE_NORMAL),
- GINT_TO_POINTER(VTE_KEYMODE_APPLICATION),
+ {66, PRIV_OFFSET(keypad_mode), 0, 0,
+ VTE_KEYMODE_NORMAL,
+ VTE_KEYMODE_APPLICATION,
NULL, NULL,},
/* 67: disallowed, backspace key policy is set by user. */
- {67, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
+ {67, 0, 0, 0, 0, 0, NULL, NULL,},
/* 1000: Send-coords-on-button. */
- {1000, NULL, &terminal->pvt->mouse_tracking_mode, NULL,
- GINT_TO_POINTER(0),
- GINT_TO_POINTER(MOUSE_TRACKING_SEND_XY_ON_BUTTON),
- NULL, NULL,},
+ {1000, 0, PRIV_OFFSET(mouse_tracking_mode), 0,
+ 0,
+ MOUSE_TRACKING_SEND_XY_ON_BUTTON,
+ vte_reset_mouse_smooth_scroll_delta,
+ vte_reset_mouse_smooth_scroll_delta,},
/* 1001: Hilite tracking. */
- {1001, NULL, &terminal->pvt->mouse_tracking_mode, NULL,
- GINT_TO_POINTER(0),
- GINT_TO_POINTER(MOUSE_TRACKING_HILITE_TRACKING),
- NULL, NULL,},
+ {1001, 0, PRIV_OFFSET(mouse_tracking_mode), 0,
+ (0),
+ (MOUSE_TRACKING_HILITE_TRACKING),
+ vte_reset_mouse_smooth_scroll_delta,
+ vte_reset_mouse_smooth_scroll_delta,},
/* 1002: Cell motion tracking. */
- {1002, NULL, &terminal->pvt->mouse_tracking_mode, NULL,
- GINT_TO_POINTER(0),
- GINT_TO_POINTER(MOUSE_TRACKING_CELL_MOTION_TRACKING),
- NULL, NULL,},
+ {1002, 0, PRIV_OFFSET(mouse_tracking_mode), 0,
+ (0),
+ (MOUSE_TRACKING_CELL_MOTION_TRACKING),
+ vte_reset_mouse_smooth_scroll_delta,
+ vte_reset_mouse_smooth_scroll_delta,},
/* 1003: All motion tracking. */
- {1003, NULL, &terminal->pvt->mouse_tracking_mode, NULL,
- GINT_TO_POINTER(0),
- GINT_TO_POINTER(MOUSE_TRACKING_ALL_MOTION_TRACKING),
+ {1003, 0, PRIV_OFFSET(mouse_tracking_mode), 0,
+ (0),
+ (MOUSE_TRACKING_ALL_MOTION_TRACKING),
+ vte_reset_mouse_smooth_scroll_delta,
+ vte_reset_mouse_smooth_scroll_delta,},
+ /* 1006: Extended mouse coordinates. */
+ {1006, PRIV_OFFSET(mouse_xterm_extension), 0, 0,
+ FALSE,
+ TRUE,
+ NULL, NULL,},
+ /* 1007: Alternate screen scroll. */
+ {1007, PRIV_OFFSET(alternate_screen_scroll), 0, 0,
+ FALSE,
+ TRUE,
NULL, NULL,},
/* 1010/rxvt: disallowed, scroll-on-output is set by user. */
- {1010, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
+ {1010, 0, 0, 0, 0, 0, NULL, NULL,},
/* 1011/rxvt: disallowed, scroll-on-keypress is set by user. */
- {1011, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
+ {1011, 0, 0, 0, 0, 0, NULL, NULL,},
+ /* 1015/urxvt: Extended mouse coordinates. */
+ {1015, PRIV_OFFSET(mouse_urxvt_extension), 0, 0,
+ FALSE,
+ TRUE,
+ NULL, NULL,},
/* 1035: disallowed, don't know what to do with it. */
- {1035, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
+ {1035, 0, 0, 0, 0, 0, NULL, NULL,},
/* 1036: Meta-sends-escape. */
- {1036, &terminal->pvt->meta_sends_escape, NULL, NULL,
- GINT_TO_POINTER(FALSE),
- GINT_TO_POINTER(TRUE),
+ {1036, PRIV_OFFSET(meta_sends_escape), 0, 0,
+ FALSE,
+ TRUE,
NULL, NULL,},
/* 1037: disallowed, delete key policy is set by user. */
- {1037, NULL, NULL, NULL, NULL, NULL, NULL, NULL,},
+ {1037, 0, 0, 0, 0, 0, NULL, NULL,},
/* 1047: Use alternate screen buffer. */
- {1047, NULL, NULL, (gpointer) &terminal->pvt->screen,
- &terminal->pvt->normal_screen,
- &terminal->pvt->alternate_screen,
+ {1047, 0, 0, PRIV_OFFSET(screen),
+ PRIV_OFFSET(normal_screen),
+ PRIV_OFFSET(alternate_screen),
NULL, NULL,},
/* 1048: Save/restore cursor position. */
- {1048, NULL, NULL, NULL,
- NULL,
- NULL,
+ {1048, 0, 0, 0,
+ 0,
+ 0,
vte_sequence_handler_rc,
vte_sequence_handler_sc,},
/* 1049: Use alternate screen buffer, saving the cursor
* position. */
- {1049, NULL, NULL, (gpointer) &terminal->pvt->screen,
- &terminal->pvt->normal_screen,
- &terminal->pvt->alternate_screen,
+ {1049, 0, 0, PRIV_OFFSET(screen),
+ PRIV_OFFSET(normal_screen),
+ PRIV_OFFSET(alternate_screen),
vte_sequence_handler_rc,
vte_sequence_handler_sc,},
/* 1051: Sun function key mode. */
- {1051, NULL, NULL, (gpointer) &terminal->pvt->sun_fkey_mode,
- GINT_TO_POINTER(FALSE),
- GINT_TO_POINTER(TRUE),
+ {1051, PRIV_OFFSET(sun_fkey_mode), 0, 0,
+ FALSE,
+ TRUE,
NULL, NULL},
/* 1052: HP function key mode. */
- {1052, NULL, NULL, (gpointer) &terminal->pvt->hp_fkey_mode,
- GINT_TO_POINTER(FALSE),
- GINT_TO_POINTER(TRUE),
+ {1052, PRIV_OFFSET(hp_fkey_mode), 0, 0,
+ FALSE,
+ TRUE,
NULL, NULL},
/* 1060: Legacy function key mode. */
- {1060, NULL, NULL, (gpointer) &terminal->pvt->legacy_fkey_mode,
- GINT_TO_POINTER(FALSE),
- GINT_TO_POINTER(TRUE),
+ {1060, PRIV_OFFSET(legacy_fkey_mode), 0, 0,
+ FALSE,
+ TRUE,
NULL, NULL},
/* 1061: VT220 function key mode. */
- {1061, NULL, NULL, (gpointer) &terminal->pvt->vt220_fkey_mode,
- GINT_TO_POINTER(FALSE),
- GINT_TO_POINTER(TRUE),
+ {1061, PRIV_OFFSET(vt220_fkey_mode), 0, 0,
+ FALSE,
+ TRUE,
NULL, NULL},
/* 2004: Bracketed paste mode. */
- {2004, &terminal->pvt->screen->bracketed_paste_mode, NULL, NULL,
- GINT_TO_POINTER(FALSE),
- GINT_TO_POINTER(TRUE),
+ {2004, SCREEN_OFFSET(bracketed_paste_mode), 0, 0,
+ FALSE,
+ TRUE,
NULL, NULL,},
+#undef PRIV_OFFSET
+#undef SCREEN_OFFSET
};
+ struct decset_t key;
+ struct decset_t *found;
/* Handle the setting. */
- for (i = 0; i < G_N_ELEMENTS(settings); i++)
- if (settings[i].setting == setting) {
- recognized = TRUE;
+ key.setting = setting;
+ found = bsearch(&key, settings, G_N_ELEMENTS(settings), sizeof(settings[0]), decset_cmp);
+ if (!found) {
+ _vte_debug_print (VTE_DEBUG_MISC,
+ "DECSET/DECRESET mode %d not recognized, ignoring.\n",
+ setting);
+ return;
+ }
+
+ key = *found;
+ do {
+ gboolean *bvalue = NULL;
+ gint *ivalue = NULL;
+ gpointer *pvalue = NULL, pfvalue = NULL, ptvalue = NULL;
+ gpointer p;
+
/* Handle settings we want to ignore. */
- if ((settings[i].fvalue == settings[i].tvalue) &&
- (settings[i].set == NULL) &&
- (settings[i].reset == NULL)) {
- continue;
+ if ((key.fvalue == key.tvalue) &&
+ (key.set == NULL) &&
+ (key.reset == NULL)) {
+ break;
}
+#define STRUCT_MEMBER_P(type,total_offset) \
+ (type) (total_offset >= 0 ? G_STRUCT_MEMBER_P(terminal->pvt, total_offset) : G_STRUCT_MEMBER_P(terminal->pvt->screen, -total_offset))
+
+ if (key.boffset) {
+ bvalue = STRUCT_MEMBER_P(gboolean*, key.boffset);
+ } else if (key.ioffset) {
+ ivalue = STRUCT_MEMBER_P(int*, key.ioffset);
+ } else if (key.poffset) {
+ pvalue = STRUCT_MEMBER_P(gpointer*, key.poffset);
+ pfvalue = STRUCT_MEMBER_P(gpointer, key.fvalue);
+ ptvalue = STRUCT_MEMBER_P(gpointer, key.tvalue);
+ }
+#undef STRUCT_MEMBER_P
+
/* Read the old setting. */
if (restore) {
p = g_hash_table_lookup(terminal->pvt->dec_saved,
@@ -765,16 +844,14 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
}
/* Save the current setting. */
if (save) {
- if (settings[i].bvalue) {
- set = *(settings[i].bvalue) != FALSE;
+ if (bvalue) {
+ set = *(bvalue) != FALSE;
} else
- if (settings[i].ivalue) {
- set = *(settings[i].ivalue) ==
- GPOINTER_TO_INT(settings[i].tvalue);
+ if (ivalue) {
+ set = *(ivalue) == (int)key.tvalue;
} else
- if (settings[i].pvalue) {
- set = *(settings[i].pvalue) ==
- settings[i].tvalue;
+ if (pvalue) {
+ set = *(pvalue) == ptvalue;
}
_vte_debug_print(VTE_DEBUG_PARSE,
"Setting %d is %s, saving.\n",
@@ -788,27 +865,23 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
_vte_debug_print(VTE_DEBUG_PARSE,
"Setting %d to %s.\n",
setting, set ? "set" : "unset");
- if (settings[i].set && set) {
- settings[i].set (terminal, NULL);
+ if (key.set && set) {
+ key.set (terminal, NULL);
}
- if (settings[i].bvalue) {
- *(settings[i].bvalue) = set;
+ if (bvalue) {
+ *(bvalue) = set;
} else
- if (settings[i].ivalue) {
- *(settings[i].ivalue) = set ?
- GPOINTER_TO_INT(settings[i].tvalue) :
- GPOINTER_TO_INT(settings[i].fvalue);
+ if (ivalue) {
+ *(ivalue) = set ? (int)key.tvalue : (int)key.fvalue;
} else
- if (settings[i].pvalue) {
- *(settings[i].pvalue) = set ?
- settings[i].tvalue :
- settings[i].fvalue;
+ if (pvalue) {
+ *(pvalue) = set ? ptvalue : pfvalue;
}
- if (settings[i].reset && !set) {
- settings[i].reset (terminal, NULL);
+ if (key.reset && !set) {
+ key.reset (terminal, NULL);
}
}
- }
+ } while (0);
/* Do whatever's necessary when the setting changes. */
switch (setting) {
@@ -817,21 +890,22 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
"Entering application cursor mode.\n" :
"Leaving application cursor mode.\n");
break;
-#if 0 /* 3: disallowed, window size is set by user. */
case 3:
- vte_terminal_emit_resize_window(terminal,
- (set ? 132 : 80) *
- terminal->char_width +
- terminal->pvt->inner_border.left +
- terminal->pvt->inner_border.right,
- terminal->row_count *
- terminal->char_height +
- terminal->pvt->inner_border.top +
- terminal->pvt->inner_border.bottom);
- /* Request a resize and redraw. */
- _vte_invalidate_all(terminal);
+ /* 3: DECCOLM set/reset to 132/80 columns mode */
+ if (terminal->pvt->deccolm_mode) {
+ vte_terminal_emit_resize_window(terminal,
+ (set ? 132 : 80) *
+ terminal->pvt->char_width +
+ terminal->pvt->padding.left +
+ terminal->pvt->padding.right,
+ terminal->pvt->row_count *
+ terminal->pvt->char_height +
+ terminal->pvt->padding.top +
+ terminal->pvt->padding.bottom);
+ /* Request a resize and redraw. */
+ _vte_invalidate_all(terminal);
+ }
break;
-#endif
case 5:
/* Repaint everything in reverse mode. */
_vte_invalidate_all(terminal);
@@ -848,11 +922,12 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
/* Clear the alternate screen if we're switching
* to it, and home the cursor. */
if (set) {
+ _vte_terminal_set_default_attributes (terminal);
_vte_terminal_clear_screen (terminal);
_vte_terminal_home_cursor (terminal);
}
/* Reset scrollbars and repaint everything. */
- gtk_adjustment_set_value(terminal->adjustment,
+ gtk_adjustment_set_value(terminal->pvt->vadjustment,
terminal->pvt->screen->scroll_delta);
vte_terminal_set_scrollback_lines(terminal,
terminal->pvt->scrollback_lines);
@@ -895,12 +970,6 @@ vte_sequence_handler_decset_internal(VteTerminal *terminal,
default:
break;
}
-
- if (!recognized) {
- _vte_debug_print (VTE_DEBUG_MISC,
- "DECSET/DECRESET mode %d not recognized, ignoring.\n",
- setting);
- }
}
@@ -930,7 +999,7 @@ vte_sequence_handler_al (VteTerminal *terminal, GValueArray *params)
if (screen->scrolling_restricted) {
end = screen->insert_delta + screen->scrolling_region.end;
} else {
- end = screen->insert_delta + terminal->row_count - 1;
+ end = screen->insert_delta + terminal->pvt->row_count - 1;
}
/* Extract any parameters. */
@@ -995,7 +1064,7 @@ vte_sequence_handler_bt (VteTerminal *terminal, GValueArray *params)
while (newcol > 0) {
newcol--;
if (_vte_terminal_get_tabstop(terminal,
- newcol % terminal->column_count)) {
+ newcol % terminal->pvt->column_count)) {
break;
}
}
@@ -1072,7 +1141,7 @@ vte_sequence_handler_cd (VteTerminal *terminal, GValueArray *params)
}
/* Now fill the cleared areas. */
for (i = screen->cursor_current.row;
- i < screen->insert_delta + terminal->row_count;
+ i < screen->insert_delta + terminal->pvt->row_count;
i++) {
/* Retrieve the row's data, creating it if necessary. */
if (_vte_ring_contains (screen->row_data, i)) {
@@ -1082,11 +1151,13 @@ vte_sequence_handler_cd (VteTerminal *terminal, GValueArray *params)
rowdata = _vte_terminal_ring_append (terminal, FALSE);
}
/* Pad out the row. */
- _vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count);
+ if (screen->fill_defaults.attr.back != VTE_DEFAULT_BG) {
+ _vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->pvt->column_count);
+ }
rowdata->attr.soft_wrapped = 0;
/* Repaint this row. */
_vte_invalidate_cells(terminal,
- 0, terminal->column_count,
+ 0, terminal->pvt->column_count,
i, 1);
}
@@ -1112,15 +1183,15 @@ vte_sequence_handler_ce (VteTerminal *terminal, GValueArray *params)
/* We've modified the display. Make a note of it. */
terminal->pvt->text_deleted_flag = TRUE;
}
- if (screen->fill_defaults.attr.back != VTE_DEF_BG) {
+ if (screen->fill_defaults.attr.back != VTE_DEFAULT_BG) {
/* Add enough cells to fill out the row. */
- _vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count);
+ _vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->pvt->column_count);
}
rowdata->attr.soft_wrapped = 0;
/* Repaint this row. */
_vte_invalidate_cells(terminal,
screen->cursor_current.col,
- terminal->column_count -
+ terminal->pvt->column_count -
screen->cursor_current.col,
screen->cursor_current.row, 1);
}
@@ -1140,7 +1211,7 @@ vte_sequence_handler_ch (VteTerminal *terminal, GValueArray *params)
if (G_VALUE_HOLDS_LONG(value)) {
val = CLAMP(g_value_get_long(value),
0,
- terminal->column_count - 1);
+ terminal->pvt->column_count - 1);
/* Move the cursor. */
screen->cursor_current.col = val;
_vte_terminal_cleanup_tab_fragments_at_cursor (terminal);
@@ -1182,13 +1253,13 @@ vte_sequence_handler_cm (VteTerminal *terminal, GValueArray *params)
origin = 0;
}
rowval = g_value_get_long(row) + origin;
- rowval = CLAMP(rowval, 0, terminal->row_count - 1);
+ rowval = CLAMP(rowval, 0, terminal->pvt->row_count - 1);
}
if (params->n_values >= 2) {
col = g_value_array_get_nth(params, 1);
if (G_VALUE_HOLDS_LONG(col)) {
colval = g_value_get_long(col);
- colval = CLAMP(colval, 0, terminal->column_count - 1);
+ colval = CLAMP(colval, 0, terminal->pvt->column_count - 1);
}
}
}
@@ -1230,7 +1301,7 @@ vte_sequence_handler_cs (VteTerminal *terminal, GValueArray *params)
end = g_value_get_long(value);
}
/* Catch garbage. */
- rows = terminal->row_count;
+ rows = terminal->pvt->row_count;
if (start <= 0 || start >= rows) {
start = 0;
}
@@ -1241,10 +1312,14 @@ vte_sequence_handler_cs (VteTerminal *terminal, GValueArray *params)
screen->scrolling_region.start = start;
screen->scrolling_region.end = end;
screen->scrolling_restricted = TRUE;
- /* Special case -- run wild, run free. */
if (screen->scrolling_region.start == 0 &&
screen->scrolling_region.end == rows - 1) {
+ /* Special case -- run wild, run free. */
screen->scrolling_restricted = FALSE;
+ } else {
+ /* Maybe extend the ring -- bug 710483 */
+ while (_vte_ring_next(screen->row_data) < screen->insert_delta + rows)
+ _vte_ring_insert(screen->row_data, _vte_ring_next(screen->row_data));
}
}
@@ -1253,7 +1328,7 @@ vte_sequence_handler_cs (VteTerminal *terminal, GValueArray *params)
static void
vte_sequence_handler_cS (VteTerminal *terminal, GValueArray *params)
{
- long start=0, end=terminal->row_count-1, rows;
+ long start=0, end=terminal->pvt->row_count-1, rows;
GValue *value;
VteScreen *screen;
@@ -1277,11 +1352,15 @@ vte_sequence_handler_cS (VteTerminal *terminal, GValueArray *params)
screen->scrolling_region.start = start;
screen->scrolling_region.end = end;
screen->scrolling_restricted = TRUE;
- /* Special case -- run wild, run free. */
- rows = terminal->row_count;
+ rows = terminal->pvt->row_count;
if ((screen->scrolling_region.start == 0) &&
(screen->scrolling_region.end == rows - 1)) {
+ /* Special case -- run wild, run free. */
screen->scrolling_restricted = FALSE;
+ } else {
+ /* Maybe extend the ring -- bug 710483 */
+ while (_vte_ring_next(screen->row_data) < screen->insert_delta + rows)
+ _vte_ring_insert(screen->row_data, _vte_ring_next(screen->row_data));
}
/* Clamp the cursor to the scrolling region. */
screen->cursor_current.row = CLAMP(screen->cursor_current.row,
@@ -1306,12 +1385,12 @@ vte_sequence_handler_cursor_lower_left (VteTerminal *terminal, GValueArray *para
VteScreen *screen;
long row;
screen = terminal->pvt->screen;
- row = MAX(0, terminal->row_count - 1);
+ row = MAX(0, terminal->pvt->row_count - 1);
screen->cursor_current.row = screen->insert_delta + row;
screen->cursor_current.col = 0;
}
-/* Move the cursor to the beginning of the next line, scrolling if necessary. */
+/* Move the cursor to the beginning of the next line, no scrolling. */
static void
vte_sequence_handler_cursor_next_line (VteTerminal *terminal, GValueArray *params)
{
@@ -1319,7 +1398,7 @@ vte_sequence_handler_cursor_next_line (VteTerminal *terminal, GValueArray *param
vte_sequence_handler_DO (terminal, params);
}
-/* Move the cursor to the beginning of the next line, scrolling if necessary. */
+/* Move the cursor to the beginning of the previous line, no scrolling. */
static void
vte_sequence_handler_cursor_preceding_line (VteTerminal *terminal, GValueArray *params)
{
@@ -1347,7 +1426,7 @@ vte_sequence_handler_cv (VteTerminal *terminal, GValueArray *params)
origin = 0;
}
val = g_value_get_long(value) + origin;
- val = CLAMP(val, 0, terminal->row_count - 1);
+ val = CLAMP(val, 0, terminal->pvt->row_count - 1);
screen->cursor_current.row = screen->insert_delta + val;
}
}
@@ -1373,9 +1452,9 @@ vte_sequence_handler_dc (VteTerminal *terminal, GValueArray *params)
/* Remove the column. */
if (col < len) {
_vte_row_data_remove (rowdata, col);
- if (screen->fill_defaults.attr.back != VTE_DEF_BG) {
- _vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->column_count);
- len = terminal->column_count;
+ if (screen->fill_defaults.attr.back != VTE_DEFAULT_BG) {
+ _vte_row_data_fill (rowdata, &screen->fill_defaults, terminal->pvt->column_count);
+ len = terminal->pvt->column_count;
}
/* Repaint this row. */
_vte_invalidate_cells(terminal,
@@ -1392,7 +1471,7 @@ vte_sequence_handler_dc (VteTerminal *terminal, GValueArray *params)
static void
vte_sequence_handler_DC (VteTerminal *terminal, GValueArray *params)
{
- vte_sequence_handler_multiple(terminal, params, vte_sequence_handler_dc);
+ vte_sequence_handler_multiple_r(terminal, params, vte_sequence_handler_dc);
}
/* Delete a line at the current cursor position. */
@@ -1409,7 +1488,7 @@ vte_sequence_handler_dl (VteTerminal *terminal, GValueArray *params)
if (screen->scrolling_restricted) {
end = screen->insert_delta + screen->scrolling_region.end;
} else {
- end = screen->insert_delta + terminal->row_count - 1;
+ end = screen->insert_delta + terminal->pvt->row_count - 1;
}
/* Extract any parameters. */
@@ -1459,7 +1538,7 @@ vte_sequence_handler_do (VteTerminal *terminal, GValueArray *params)
end = screen->insert_delta + screen->scrolling_region.end;
} else {
start = screen->insert_delta;
- end = start + terminal->row_count - 1;
+ end = start + terminal->pvt->row_count - 1;
}
/* Move the cursor down. */
@@ -1518,7 +1597,7 @@ vte_sequence_handler_ec (VteTerminal *terminal, GValueArray *params)
*cell = screen->color_defaults;
} else {
/* Add new cells until we have one here. */
- _vte_row_data_fill (rowdata, &screen->color_defaults, col);
+ _vte_row_data_fill (rowdata, &screen->color_defaults, col + 1);
}
}
}
@@ -1641,7 +1720,7 @@ vte_sequence_handler_le (VteTerminal *terminal, GValueArray *params)
} else {
if (terminal->pvt->flags.bw) {
/* Wrap to the previous line. */
- screen->cursor_current.col = terminal->column_count - 1;
+ screen->cursor_current.col = terminal->pvt->column_count - 1;
if (screen->scrolling_restricted) {
vte_sequence_handler_sr (terminal, params);
} else {
@@ -1670,7 +1749,7 @@ vte_sequence_handler_ll (VteTerminal *terminal, GValueArray *params)
screen = terminal->pvt->screen;
screen->cursor_current.row = MAX(screen->insert_delta,
screen->insert_delta +
- terminal->row_count - 1);
+ terminal->pvt->row_count - 1);
screen->cursor_current.col = 0;
}
@@ -1733,7 +1812,7 @@ vte_sequence_handler_nd (VteTerminal *terminal, GValueArray *params)
{
VteScreen *screen;
screen = terminal->pvt->screen;
- if ((screen->cursor_current.col + 1) < terminal->column_count) {
+ if ((screen->cursor_current.col + 1) < terminal->pvt->column_count) {
/* There's room to move right. */
screen->cursor_current.col++;
}
@@ -1744,7 +1823,7 @@ static void
vte_sequence_handler_next_line (VteTerminal *terminal, GValueArray *params)
{
terminal->pvt->screen->cursor_current.col = 0;
- vte_sequence_handler_DO (terminal, params);
+ _vte_terminal_cursor_down (terminal);
}
/* No-op. */
@@ -1771,7 +1850,7 @@ vte_sequence_handler_rc (VteTerminal *terminal, GValueArray *params)
screen->insert_delta,
screen->insert_delta,
screen->insert_delta +
- terminal->row_count - 1);
+ terminal->pvt->row_count - 1);
}
/* Cursor down, with scrolling. */
@@ -1785,7 +1864,7 @@ vte_sequence_handler_reverse_index (VteTerminal *terminal, GValueArray *params)
static void
vte_sequence_handler_RI (VteTerminal *terminal, GValueArray *params)
{
- vte_sequence_handler_multiple(terminal, params, vte_sequence_handler_nd);
+ vte_sequence_handler_multiple_r(terminal, params, vte_sequence_handler_nd);
}
/* Save cursor (position). */
@@ -1797,7 +1876,7 @@ vte_sequence_handler_sc (VteTerminal *terminal, GValueArray *params)
screen->cursor_saved.col = screen->cursor_current.col;
screen->cursor_saved.row = CLAMP(screen->cursor_current.row -
screen->insert_delta,
- 0, terminal->row_count - 1);
+ 0, terminal->pvt->row_count - 1);
}
/* Scroll the text down, but don't move the cursor. */
@@ -1818,13 +1897,14 @@ vte_sequence_handler_scroll_down (VteTerminal *terminal, GValueArray *params)
_vte_terminal_scroll_text (terminal, val);
}
-/* change color in the palette */
+/* Internal helper for changing color in the palette */
static void
-vte_sequence_handler_change_color (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_change_color_internal (VteTerminal *terminal, GValueArray *params,
+ const char *terminator)
{
gchar **pairs, *str = NULL;
GValue *value;
- GdkColor color;
+ PangoColor color;
guint idx, i;
if (params != NULL && params->n_values > 0) {
@@ -1847,20 +1927,18 @@ vte_sequence_handler_change_color (VteTerminal *terminal, GValueArray *params)
for (i = 0; pairs[i] && pairs[i + 1]; i += 2) {
idx = strtoul (pairs[i], (char **) NULL, 10);
- if (idx >= VTE_DEF_FG)
+ if (idx >= VTE_DEFAULT_FG)
continue;
if (vte_parse_color (pairs[i + 1], &color)) {
- terminal->pvt->palette[idx].red = color.red;
- terminal->pvt->palette[idx].green = color.green;
- terminal->pvt->palette[idx].blue = color.blue;
+ _vte_terminal_set_color_internal(terminal, idx, VTE_COLOR_SOURCE_ESCAPE, &color);
} else if (strcmp (pairs[i + 1], "?") == 0) {
gchar buf[128];
+ PangoColor *c = _vte_terminal_get_color(terminal, idx);
+ g_assert(c != NULL);
g_snprintf (buf, sizeof (buf),
- _VTE_CAP_OSC "4;%u;rgb:%04x/%04x/%04x" BEL, idx,
- terminal->pvt->palette[idx].red,
- terminal->pvt->palette[idx].green,
- terminal->pvt->palette[idx].blue);
+ _VTE_CAP_OSC "4;%u;rgb:%04x/%04x/%04x%s",
+ idx, c->red, c->green, c->blue, terminator);
vte_terminal_feed_child (terminal, buf, -1);
}
}
@@ -1874,6 +1952,46 @@ vte_sequence_handler_change_color (VteTerminal *terminal, GValueArray *params)
}
}
+/* Change color in the palette, BEL terminated */
+static void
+vte_sequence_handler_change_color_bel (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_color_internal (terminal, params, BEL);
+}
+
+/* Change color in the palette, ST terminated */
+static void
+vte_sequence_handler_change_color_st (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_color_internal (terminal, params, ST);
+}
+
+/* Reset color in the palette */
+static void
+vte_sequence_handler_reset_color (VteTerminal *terminal, GValueArray *params)
+{
+ GValue *value;
+ long idx, i;
+
+ if (params != NULL && params->n_values > 0) {
+ for (i = 0; i < params->n_values; i++) {
+ value = g_value_array_get_nth (params, i);
+
+ if (!G_VALUE_HOLDS_LONG (value))
+ continue;
+ idx = g_value_get_long (value);
+ if (idx < 0 || idx >= VTE_DEFAULT_FG)
+ continue;
+
+ _vte_terminal_set_color_internal(terminal, idx, VTE_COLOR_SOURCE_ESCAPE, NULL);
+ }
+ } else {
+ for (idx = 0; idx < VTE_DEFAULT_FG; idx++) {
+ _vte_terminal_set_color_internal(terminal, idx, VTE_COLOR_SOURCE_ESCAPE, NULL);
+ }
+ }
+}
+
/* Scroll the text up, but don't move the cursor. */
static void
vte_sequence_handler_scroll_up (VteTerminal *terminal, GValueArray *params)
@@ -1988,7 +2106,7 @@ vte_sequence_handler_sr (VteTerminal *terminal, GValueArray *params)
end = screen->scrolling_region.end + screen->insert_delta;
} else {
start = terminal->pvt->screen->insert_delta;
- end = start + terminal->row_count - 1;
+ end = start + terminal->pvt->row_count - 1;
}
if (screen->cursor_current.row == start) {
@@ -1999,7 +2117,7 @@ vte_sequence_handler_sr (VteTerminal *terminal, GValueArray *params)
/* Update the display. */
_vte_terminal_scroll_region(terminal, start, end - start + 1, 1);
_vte_invalidate_cells(terminal,
- 0, terminal->column_count,
+ 0, terminal->pvt->column_count,
start, 2);
} else {
/* Otherwise, just move the cursor up. */
@@ -2053,8 +2171,8 @@ vte_sequence_handler_ta (VteTerminal *terminal, GValueArray *params)
/* If we have no tab stops or went past the end of the line, stop
* at the right-most column. */
- if (newcol >= terminal->column_count) {
- newcol = terminal->column_count - 1;
+ if (newcol >= terminal->pvt->column_count) {
+ newcol = terminal->pvt->column_count - 1;
}
/* but make sure we don't move cursor back (bug #340631) */
@@ -2197,16 +2315,14 @@ static void
vte_sequence_handler_up (VteTerminal *terminal, GValueArray *params)
{
VteScreen *screen;
- long start, end;
+ long start;
screen = terminal->pvt->screen;
if (screen->scrolling_restricted) {
start = screen->insert_delta + screen->scrolling_region.start;
- end = screen->insert_delta + screen->scrolling_region.end;
} else {
start = screen->insert_delta;
- end = start + terminal->row_count - 1;
}
screen->cursor_current.row = MAX(screen->cursor_current.row - 1, start);
@@ -2262,7 +2378,54 @@ vte_sequence_handler_vs (VteTerminal *terminal, GValueArray *params)
visible. */
}
-/* Handle ANSI color setting and related stuffs (SGR). */
+/* Parse parameters of SGR 38 or 48, starting at @index within @params.
+ * Returns the color index, or -1 on error.
+ * Increments @index to point to the last consumed parameter (not beyond). */
+static gint32
+vte_sequence_parse_sgr_38_48_parameters (GValueArray *params, unsigned int *index)
+{
+ if (*index < params->n_values) {
+ GValue *value0, *value1, *value2, *value3;
+ long param0, param1, param2, param3;
+ value0 = g_value_array_get_nth(params, *index);
+ if (G_UNLIKELY (!G_VALUE_HOLDS_LONG(value0)))
+ return -1;
+ param0 = g_value_get_long(value0);
+ switch (param0) {
+ case 2:
+ if (G_UNLIKELY (*index + 3 >= params->n_values))
+ return -1;
+ value1 = g_value_array_get_nth(params, *index + 1);
+ value2 = g_value_array_get_nth(params, *index + 2);
+ value3 = g_value_array_get_nth(params, *index + 3);
+ if (G_UNLIKELY (!(G_VALUE_HOLDS_LONG(value1) && G_VALUE_HOLDS_LONG(value2) && G_VALUE_HOLDS_LONG(value3))))
+ return -1;
+ param1 = g_value_get_long(value1);
+ param2 = g_value_get_long(value2);
+ param3 = g_value_get_long(value3);
+ if (G_UNLIKELY (param1 < 0 || param1 >= 256 || param2 < 0 || param2 >= 256 || param3 < 0 || param3 >= 256))
+ return -1;
+ *index += 3;
+ return VTE_RGB_COLOR | (param1 << 16) | (param2 << 8) | param3;
+ case 5:
+ if (G_UNLIKELY (*index + 1 >= params->n_values))
+ return -1;
+ value1 = g_value_array_get_nth(params, *index + 1);
+ if (G_UNLIKELY (!G_VALUE_HOLDS_LONG(value1)))
+ return -1;
+ param1 = g_value_get_long(value1);
+ if (G_UNLIKELY (param1 < 0 || param1 >= 256))
+ return -1;
+ *index += 1;
+ return param1;
+ }
+ }
+ return -1;
+}
+
+/* Handle ANSI color setting and related stuffs (SGR).
+ * @params contains the values split at semicolons, with sub arrays splitting at colons
+ * wherever colons were encountered. */
static void
vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *params)
{
@@ -2273,8 +2436,36 @@ vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *p
param = 0;
/* Step through each numeric parameter. */
for (i = 0; (params != NULL) && (i < params->n_values); i++) {
- /* If this parameter isn't a number, skip it. */
value = g_value_array_get_nth(params, i);
+ /* If this parameter is a GValueArray, it can be a fully colon separated 38 or 48
+ * (see below for details). */
+ if (G_UNLIKELY (G_VALUE_HOLDS_BOXED(value))) {
+ GValueArray *subvalues = g_value_get_boxed(value);
+ GValue *value0;
+ long param0;
+ gint32 color;
+ unsigned int index = 1;
+
+ value0 = g_value_array_get_nth(subvalues, 0);
+ if (G_UNLIKELY (!G_VALUE_HOLDS_LONG(value0)))
+ continue;
+ param0 = g_value_get_long(value0);
+ if (G_UNLIKELY (param0 != 38 && param0 != 48))
+ continue;
+ color = vte_sequence_parse_sgr_38_48_parameters(subvalues, &index);
+ /* Bail out on additional colon-separated values. */
+ if (G_UNLIKELY (index != subvalues->n_values - 1))
+ continue;
+ if (G_LIKELY (color != -1)) {
+ if (param0 == 38) {
+ terminal->pvt->screen->defaults.attr.fore = color;
+ } else {
+ terminal->pvt->screen->defaults.attr.back = color;
+ }
+ }
+ continue;
+ }
+ /* If this parameter is not a GValueArray and not a number either, skip it. */
if (!G_VALUE_HOLDS_LONG(value)) {
continue;
}
@@ -2291,6 +2482,9 @@ vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *p
terminal->pvt->screen->defaults.attr.half = 1;
terminal->pvt->screen->defaults.attr.bold = 0;
break;
+ case 3:
+ terminal->pvt->screen->defaults.attr.italic = 1;
+ break;
case 4:
terminal->pvt->screen->defaults.attr.underline = 1;
break;
@@ -2311,6 +2505,9 @@ vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *p
terminal->pvt->screen->defaults.attr.bold = 0;
terminal->pvt->screen->defaults.attr.half = 0;
break;
+ case 23:
+ terminal->pvt->screen->defaults.attr.italic = 0;
+ break;
case 24:
terminal->pvt->screen->defaults.attr.underline = 0;
break;
@@ -2334,30 +2531,53 @@ vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *p
case 35:
case 36:
case 37:
- terminal->pvt->screen->defaults.attr.fore = param - 30;
+ terminal->pvt->screen->defaults.attr.fore = VTE_LEGACY_COLORS_OFFSET + param - 30;
break;
case 38:
+ case 48:
{
- /* The format looks like: ^[[38;5;COLORNUMBERm,
- so look for COLORNUMBER here. */
- if ((i + 2) < params->n_values){
- GValue *value1, *value2;
- long param1, param2;
- value1 = g_value_array_get_nth(params, i + 1);
- value2 = g_value_array_get_nth(params, i + 2);
- if (G_UNLIKELY (!(G_VALUE_HOLDS_LONG(value1) && G_VALUE_HOLDS_LONG(value2))))
+ /* The format looks like:
+ * - 256 color indexed palette:
+ * - ^[[38;5;INDEXm
+ * - ^[[38;5:INDEXm
+ * - ^[[38:5:INDEXm
+ * - true colors:
+ * - ^[[38;2;RED;GREEN;BLUEm
+ * - ^[[38;2:RED:GREEN:BLUEm
+ * - ^[[38:2:RED:GREEN:BLUEm
+ * See bug 685759 for details.
+ * The fully colon versions were handled above separately. The code is reached
+ * if the first separator is a semicolon. */
+ if ((i + 1) < params->n_values) {
+ gint32 color;
+ GValue *value1 = g_value_array_get_nth(params, ++i);
+ if (G_VALUE_HOLDS_LONG(value1)) {
+ /* Only semicolons as separators. */
+ color = vte_sequence_parse_sgr_38_48_parameters(params, &i);
+ } else if (G_VALUE_HOLDS_BOXED(value1)) {
+ /* The first separator was a semicolon, the rest are colons. */
+ GValueArray *subvalues = g_value_get_boxed(value1);
+ unsigned int index = 0;
+ color = vte_sequence_parse_sgr_38_48_parameters(subvalues, &index);
+ /* Bail out on additional colon-separated values. */
+ if (G_UNLIKELY (index != subvalues->n_values - 1))
+ break;
+ } else {
break;
- param1 = g_value_get_long(value1);
- param2 = g_value_get_long(value2);
- if (G_LIKELY (param1 == 5 && param2 >= 0 && param2 < 256))
- terminal->pvt->screen->defaults.attr.fore = param2;
- i += 2;
+ }
+ if (G_LIKELY (color != -1)) {
+ if (param == 38) {
+ terminal->pvt->screen->defaults.attr.fore = color;
+ } else {
+ terminal->pvt->screen->defaults.attr.back = color;
+ }
+ }
}
break;
}
case 39:
/* default foreground */
- terminal->pvt->screen->defaults.attr.fore = VTE_DEF_FG;
+ terminal->pvt->screen->defaults.attr.fore = VTE_DEFAULT_FG;
break;
case 40:
case 41:
@@ -2367,30 +2587,12 @@ vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *p
case 45:
case 46:
case 47:
- terminal->pvt->screen->defaults.attr.back = param - 40;
+ terminal->pvt->screen->defaults.attr.back = VTE_LEGACY_COLORS_OFFSET + param - 40;
break;
- case 48:
- {
- /* The format looks like: ^[[48;5;COLORNUMBERm,
- so look for COLORNUMBER here. */
- if ((i + 2) < params->n_values){
- GValue *value1, *value2;
- long param1, param2;
- value1 = g_value_array_get_nth(params, i + 1);
- value2 = g_value_array_get_nth(params, i + 2);
- if (G_UNLIKELY (!(G_VALUE_HOLDS_LONG(value1) && G_VALUE_HOLDS_LONG(value2))))
- break;
- param1 = g_value_get_long(value1);
- param2 = g_value_get_long(value2);
- if (G_LIKELY (param1 == 5 && param2 >= 0 && param2 < 256))
- terminal->pvt->screen->defaults.attr.back = param2;
- i += 2;
- }
- break;
- }
+ /* case 48: was handled above at 38 to avoid code duplication */
case 49:
/* default background */
- terminal->pvt->screen->defaults.attr.back = VTE_DEF_BG;
+ terminal->pvt->screen->defaults.attr.back = VTE_DEFAULT_BG;
break;
case 90:
case 91:
@@ -2400,7 +2602,7 @@ vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *p
case 95:
case 96:
case 97:
- terminal->pvt->screen->defaults.attr.fore = param - 90 + VTE_COLOR_BRIGHT_OFFSET;
+ terminal->pvt->screen->defaults.attr.fore = VTE_LEGACY_COLORS_OFFSET + param - 90 + VTE_COLOR_BRIGHT_OFFSET;
break;
case 100:
case 101:
@@ -2410,7 +2612,7 @@ vte_sequence_handler_character_attributes (VteTerminal *terminal, GValueArray *p
case 105:
case 106:
case 107:
- terminal->pvt->screen->defaults.attr.back = param - 100 + VTE_COLOR_BRIGHT_OFFSET;
+ terminal->pvt->screen->defaults.attr.back = VTE_LEGACY_COLORS_OFFSET + param - 100 + VTE_COLOR_BRIGHT_OFFSET;
break;
}
}
@@ -2444,7 +2646,7 @@ vte_sequence_handler_cursor_character_absolute (VteTerminal *terminal, GValueArr
value = g_value_array_get_nth(params, 0);
if (G_VALUE_HOLDS_LONG(value)) {
val = CLAMP(g_value_get_long(value),
- 1, terminal->column_count) - 1;
+ 1, terminal->pvt->column_count) - 1;
}
}
@@ -2529,6 +2731,74 @@ vte_sequence_handler_set_icon_and_window_title (VteTerminal *terminal, GValueArr
vte_sequence_handler_set_title_internal(terminal, params, TRUE, TRUE);
}
+static void
+vte_sequence_handler_set_current_directory_uri (VteTerminal *terminal, GValueArray *params)
+{
+ GValue *value;
+ char *uri, *filename;
+
+ uri = NULL;
+ if (params != NULL && params->n_values > 0) {
+ value = g_value_array_get_nth(params, 0);
+
+ if (G_VALUE_HOLDS_POINTER(value)) {
+ uri = vte_ucs4_to_utf8 (terminal, g_value_get_pointer (value));
+ } else if (G_VALUE_HOLDS_STRING(value)) {
+ /* Copy the string into the buffer. */
+ uri = g_value_dup_string(value);
+ }
+ }
+
+ /* Validate URI */
+ if (uri && uri[0]) {
+ filename = g_filename_from_uri (uri, NULL, NULL);
+ if (filename == NULL) {
+ /* invalid URI */
+ g_free (uri);
+ uri = NULL;
+ } else {
+ g_free (filename);
+ }
+ }
+
+ g_free(terminal->pvt->current_directory_uri_changed);
+ terminal->pvt->current_directory_uri_changed = uri;
+}
+
+static void
+vte_sequence_handler_set_current_file_uri (VteTerminal *terminal, GValueArray *params)
+{
+ GValue *value;
+ char *uri, *filename;
+
+ uri = NULL;
+ if (params != NULL && params->n_values > 0) {
+ value = g_value_array_get_nth(params, 0);
+
+ if (G_VALUE_HOLDS_POINTER(value)) {
+ uri = vte_ucs4_to_utf8 (terminal, g_value_get_pointer (value));
+ } else if (G_VALUE_HOLDS_STRING(value)) {
+ /* Copy the string into the buffer. */
+ uri = g_value_dup_string(value);
+ }
+ }
+
+ /* Validate URI */
+ if (uri && uri[0]) {
+ filename = g_filename_from_uri (uri, NULL, NULL);
+ if (filename == NULL) {
+ /* invalid URI */
+ g_free (uri);
+ uri = NULL;
+ } else {
+ g_free (filename);
+ }
+ }
+
+ g_free(terminal->pvt->current_file_uri_changed);
+ terminal->pvt->current_file_uri_changed = uri;
+}
+
/* Restrict the scrolling region. */
static void
vte_sequence_handler_set_scrolling_region (VteTerminal *terminal, GValueArray *params)
@@ -2777,8 +3047,7 @@ vte_sequence_handler_insert_lines (VteTerminal *terminal, GValueArray *params)
{
GValue *value;
VteScreen *screen;
- long param, end, row;
- int i;
+ long param, end, row, i, limit;
screen = terminal->pvt->screen;
/* The default is one. */
param = 1;
@@ -2794,9 +3063,15 @@ vte_sequence_handler_insert_lines (VteTerminal *terminal, GValueArray *params)
if (screen->scrolling_restricted) {
end = screen->insert_delta + screen->scrolling_region.end;
} else {
- end = screen->insert_delta + terminal->row_count - 1;
+ end = screen->insert_delta + terminal->pvt->row_count - 1;
}
- /* Insert the new lines at the cursor. */
+
+ /* Only allow to insert as many lines as there are between this row
+ * and the end of the scrolling region. See bug #676090.
+ */
+ limit = end - row + 1;
+ param = MIN (param, limit);
+
for (i = 0; i < param; i++) {
/* Clear a line off the end of the region and add one to the
* top of the region. */
@@ -2817,8 +3092,7 @@ vte_sequence_handler_delete_lines (VteTerminal *terminal, GValueArray *params)
{
GValue *value;
VteScreen *screen;
- long param, end, row;
- int i;
+ long param, end, row, i, limit;
screen = terminal->pvt->screen;
/* The default is one. */
@@ -2835,8 +3109,15 @@ vte_sequence_handler_delete_lines (VteTerminal *terminal, GValueArray *params)
if (screen->scrolling_restricted) {
end = screen->insert_delta + screen->scrolling_region.end;
} else {
- end = screen->insert_delta + terminal->row_count - 1;
+ end = screen->insert_delta + terminal->pvt->row_count - 1;
}
+
+ /* Only allow to delete as many lines as there are between this row
+ * and the end of the scrolling region. See bug #676090.
+ */
+ limit = end - row + 1;
+ param = MIN (param, limit);
+
/* Clear them from below the current cursor. */
for (i = 0; i < param; i++) {
/* Insert a line at the end of the region and remove one from
@@ -2856,7 +3137,7 @@ vte_sequence_handler_delete_lines (VteTerminal *terminal, GValueArray *params)
static void
vte_sequence_handler_local_charset (VteTerminal *terminal, GValueArray *params)
{
- const char *locale_encoding;
+ G_CONST_RETURN char *locale_encoding;
g_get_charset(&locale_encoding);
vte_terminal_set_encoding(terminal, locale_encoding);
}
@@ -3004,7 +3285,7 @@ vte_sequence_handler_screen_alignment_test (VteTerminal *terminal, GValueArray *
screen = terminal->pvt->screen;
for (row = terminal->pvt->screen->insert_delta;
- row < terminal->pvt->screen->insert_delta + terminal->row_count;
+ row < terminal->pvt->screen->insert_delta + terminal->pvt->row_count;
row++) {
/* Find this row. */
while (_vte_ring_next(screen->row_data) <= row)
@@ -3020,7 +3301,7 @@ vte_sequence_handler_screen_alignment_test (VteTerminal *terminal, GValueArray *
cell.c = 'E';
cell.attr = basic_cell.cell.attr;
cell.attr.columns = 1;
- _vte_row_data_fill (rowdata, &cell, terminal->column_count);
+ _vte_row_data_fill (rowdata, &cell, terminal->pvt->column_count);
_vte_terminal_emit_text_inserted(terminal);
}
_vte_invalidate_all(terminal);
@@ -3043,7 +3324,6 @@ static void
vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *params)
{
GdkScreen *gscreen;
- VteScreen *screen;
GValue *value;
GtkWidget *widget;
char buf[128];
@@ -3053,7 +3333,6 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
GtkAllocation allocation;
widget = &terminal->widget;
- screen = terminal->pvt->screen;
for (i = 0; ((params != NULL) && (i < params->n_values)); i++) {
arg1 = arg2 = -1;
@@ -3103,11 +3382,11 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
arg2, arg1);
vte_terminal_emit_resize_window(terminal,
arg2 +
- terminal->pvt->inner_border.left +
- terminal->pvt->inner_border.right,
+ terminal->pvt->padding.left +
+ terminal->pvt->padding.right,
arg1 +
- terminal->pvt->inner_border.top +
- terminal->pvt->inner_border.bottom);
+ terminal->pvt->padding.top +
+ terminal->pvt->padding.bottom);
i += 2;
}
break;
@@ -3132,12 +3411,12 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
"(to %ld columns, %ld rows).\n",
arg2, arg1);
vte_terminal_emit_resize_window(terminal,
- arg2 * terminal->char_width +
- terminal->pvt->inner_border.left +
- terminal->pvt->inner_border.right,
- arg1 * terminal->char_height +
- terminal->pvt->inner_border.top +
- terminal->pvt->inner_border.bottom);
+ arg2 * terminal->pvt->char_width +
+ terminal->pvt->padding.left +
+ terminal->pvt->padding.right,
+ arg1 * terminal->pvt->char_height +
+ terminal->pvt->padding.top +
+ terminal->pvt->padding.bottom);
i += 2;
}
break;
@@ -3175,8 +3454,8 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
&width, &height);
g_snprintf(buf, sizeof(buf),
_VTE_CAP_CSI "3;%d;%dt",
- width + terminal->pvt->inner_border.left,
- height + terminal->pvt->inner_border.top);
+ width + terminal->pvt->padding.left,
+ height + terminal->pvt->padding.top);
_vte_debug_print(VTE_DEBUG_PARSE,
"Reporting window location"
"(%d++,%d++).\n",
@@ -3189,16 +3468,16 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
g_snprintf(buf, sizeof(buf),
_VTE_CAP_CSI "4;%d;%dt",
allocation.height -
- (terminal->pvt->inner_border.top +
- terminal->pvt->inner_border.bottom),
+ (terminal->pvt->padding.top +
+ terminal->pvt->padding.bottom),
allocation.width -
- (terminal->pvt->inner_border.left +
- terminal->pvt->inner_border.right));
+ (terminal->pvt->padding.left +
+ terminal->pvt->padding.right));
_vte_debug_print(VTE_DEBUG_PARSE,
"Reporting window size "
"(%dx%dn",
- width - (terminal->pvt->inner_border.left + terminal->pvt->inner_border.right),
- height - (terminal->pvt->inner_border.top + terminal->pvt->inner_border.bottom));
+ width - (terminal->pvt->padding.left + terminal->pvt->padding.right),
+ height - (terminal->pvt->padding.top + terminal->pvt->padding.bottom));
vte_terminal_feed_child(terminal, buf, -1);
break;
case 18:
@@ -3207,8 +3486,8 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
"Reporting widget size.\n");
g_snprintf(buf, sizeof(buf),
_VTE_CAP_CSI "8;%ld;%ldt",
- terminal->row_count,
- terminal->column_count);
+ terminal->pvt->row_count,
+ terminal->pvt->column_count);
vte_terminal_feed_child(terminal, buf, -1);
break;
case 19:
@@ -3219,8 +3498,8 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
width = gdk_screen_get_width(gscreen);
g_snprintf(buf, sizeof(buf),
_VTE_CAP_CSI "9;%ld;%ldt",
- height / terminal->char_height,
- width / terminal->char_width);
+ height / terminal->pvt->char_height,
+ width / terminal->pvt->char_width);
vte_terminal_feed_child(terminal, buf, -1);
break;
case 20:
@@ -3231,7 +3510,7 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
and CVE-2003-0070. */
_vte_debug_print(VTE_DEBUG_PARSE,
"Reporting fake icon title.\n");
- /* never use terminal->icon_title here! */
+ /* never use terminal->pvt->icon_title here! */
g_snprintf (buf, sizeof (buf),
_VTE_CAP_OSC "LTerminal" _VTE_CAP_ST);
vte_terminal_feed_child(terminal, buf, -1);
@@ -3244,7 +3523,7 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
and CVE-2003-0070. */
_vte_debug_print(VTE_DEBUG_PARSE,
"Reporting fake window title.\n");
- /* never use terminal->window_title here! */
+ /* never use terminal->pvt->window_title here! */
g_snprintf (buf, sizeof (buf),
_VTE_CAP_OSC "lTerminal" _VTE_CAP_ST);
vte_terminal_feed_child(terminal, buf, -1);
@@ -3257,25 +3536,27 @@ vte_sequence_handler_window_manipulation (VteTerminal *terminal, GValueArray *pa
/* Resize to the specified number of
* rows. */
vte_terminal_emit_resize_window(terminal,
- terminal->column_count * terminal->char_width +
- terminal->pvt->inner_border.left +
- terminal->pvt->inner_border.right,
- param * terminal->char_height +
- terminal->pvt->inner_border.top +
- terminal->pvt->inner_border.bottom);
+ terminal->pvt->column_count * terminal->pvt->char_width +
+ terminal->pvt->padding.left +
+ terminal->pvt->padding.right,
+ param * terminal->pvt->char_height +
+ terminal->pvt->padding.top +
+ terminal->pvt->padding.bottom);
}
break;
}
}
}
-/* Change the color of the cursor */
+/* Internal helper for setting/querying special colors */
static void
-vte_sequence_handler_change_cursor_color (VteTerminal *terminal, GValueArray *params)
+vte_sequence_handler_change_special_color_internal (VteTerminal *terminal, GValueArray *params,
+ int index, int index_fallback, int osc,
+ const char *terminator)
{
gchar *name = NULL;
GValue *value;
- GdkColor color;
+ PangoColor color;
if (params != NULL && params->n_values > 0) {
value = g_value_array_get_nth (params, 0);
@@ -3289,14 +3570,16 @@ vte_sequence_handler_change_cursor_color (VteTerminal *terminal, GValueArray *pa
return;
if (vte_parse_color (name, &color))
- vte_terminal_set_color_cursor (terminal, &color);
+ _vte_terminal_set_color_internal(terminal, index, VTE_COLOR_SOURCE_ESCAPE, &color);
else if (strcmp (name, "?") == 0) {
gchar buf[128];
+ PangoColor *c = _vte_terminal_get_color(terminal, index);
+ if (c == NULL && index_fallback != -1)
+ c = _vte_terminal_get_color(terminal, index_fallback);
+ g_assert(c != NULL);
g_snprintf (buf, sizeof (buf),
- _VTE_CAP_OSC "12;rgb:%04x/%04x/%04x" BEL,
- terminal->pvt->palette[VTE_CUR_BG].red,
- terminal->pvt->palette[VTE_CUR_BG].green,
- terminal->pvt->palette[VTE_CUR_BG].blue);
+ _VTE_CAP_OSC "%d;rgb:%04x/%04x/%04x%s",
+ osc, c->red, c->green, c->blue, terminator);
vte_terminal_feed_child (terminal, buf, -1);
}
@@ -3304,6 +3587,121 @@ vte_sequence_handler_change_cursor_color (VteTerminal *terminal, GValueArray *pa
}
}
+/* Change the default foreground cursor, BEL terminated */
+static void
+vte_sequence_handler_change_foreground_color_bel (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_special_color_internal (terminal, params,
+ VTE_DEFAULT_FG, -1, 10, BEL);
+}
+
+/* Change the default foreground cursor, ST terminated */
+static void
+vte_sequence_handler_change_foreground_color_st (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_special_color_internal (terminal, params,
+ VTE_DEFAULT_FG, -1, 10, ST);
+}
+
+/* Reset the default foreground color */
+static void
+vte_sequence_handler_reset_foreground_color (VteTerminal *terminal, GValueArray *params)
+{
+ _vte_terminal_set_color_internal(terminal, VTE_DEFAULT_FG, VTE_COLOR_SOURCE_ESCAPE, NULL);
+}
+
+/* Change the default background cursor, BEL terminated */
+static void
+vte_sequence_handler_change_background_color_bel (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_special_color_internal (terminal, params,
+ VTE_DEFAULT_BG, -1, 11, BEL);
+}
+
+/* Change the default background cursor, ST terminated */
+static void
+vte_sequence_handler_change_background_color_st (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_special_color_internal (terminal, params,
+ VTE_DEFAULT_BG, -1, 11, ST);
+}
+
+/* Reset the default background color */
+static void
+vte_sequence_handler_reset_background_color (VteTerminal *terminal, GValueArray *params)
+{
+ _vte_terminal_set_color_internal(terminal, VTE_DEFAULT_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
+}
+
+/* Change the color of the cursor, BEL terminated */
+static void
+vte_sequence_handler_change_cursor_color_bel (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_special_color_internal (terminal, params,
+ VTE_CURSOR_BG, VTE_DEFAULT_FG, 12, BEL);
+}
+
+/* Change the color of the cursor, ST terminated */
+static void
+vte_sequence_handler_change_cursor_color_st (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_special_color_internal (terminal, params,
+ VTE_CURSOR_BG, VTE_DEFAULT_FG, 12, ST);
+}
+
+/* Reset the color of the cursor */
+static void
+vte_sequence_handler_reset_cursor_color (VteTerminal *terminal, GValueArray *params)
+{
+ _vte_terminal_set_color_internal(terminal, VTE_CURSOR_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
+}
+
+/* Change the highlight background color, BEL terminated */
+static void
+vte_sequence_handler_change_highlight_background_color_bel (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_special_color_internal (terminal, params,
+ VTE_HIGHLIGHT_BG, VTE_DEFAULT_FG, 17, BEL);
+}
+
+/* Change the highlight background color, ST terminated */
+static void
+vte_sequence_handler_change_highlight_background_color_st (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_special_color_internal (terminal, params,
+ VTE_HIGHLIGHT_BG, VTE_DEFAULT_FG, 17, ST);
+}
+
+/* Reset the highlight background color */
+static void
+vte_sequence_handler_reset_highlight_background_color (VteTerminal *terminal, GValueArray *params)
+{
+ _vte_terminal_set_color_internal(terminal, VTE_HIGHLIGHT_BG, VTE_COLOR_SOURCE_ESCAPE, NULL);
+}
+
+/* Change the highlight foreground color, BEL terminated */
+static void
+vte_sequence_handler_change_highlight_foreground_color_bel (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_special_color_internal (terminal, params,
+ VTE_HIGHLIGHT_FG, VTE_DEFAULT_BG, 19, BEL);
+}
+
+/* Change the highlight foreground color, ST terminated */
+static void
+vte_sequence_handler_change_highlight_foreground_color_st (VteTerminal *terminal, GValueArray *params)
+{
+ vte_sequence_handler_change_special_color_internal (terminal, params,
+ VTE_HIGHLIGHT_FG, VTE_DEFAULT_BG, 19, ST);
+}
+
+/* Reset the highlight foreground color */
+static void
+vte_sequence_handler_reset_highlight_foreground_color (VteTerminal *terminal, GValueArray *params)
+{
+ _vte_terminal_set_color_internal(terminal, VTE_HIGHLIGHT_FG, VTE_COLOR_SOURCE_ESCAPE, NULL);
+}
+
/* Lookup tables */
diff --git a/src/vtestream-base.h b/src/vtestream-base.h
index 913f9c9e..ebe3eec5 100644
--- a/src/vtestream-base.h
+++ b/src/vtestream-base.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2009,2010 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Red Hat Author(s): Behdad Esfahbod
*/
@@ -33,14 +33,11 @@ typedef struct _VteStreamClass {
GObjectClass parent_class;
void (*reset) (VteStream *stream, gsize offset);
- gsize (*append) (VteStream *stream, const char *data, gsize len);
+ void (*append) (VteStream *stream, const char *data, gsize len);
gboolean (*read) (VteStream *stream, gsize offset, char *data, gsize len);
void (*truncate) (VteStream *stream, gsize offset);
- void (*new_page) (VteStream *stream);
+ void (*advance_tail) (VteStream *stream, gsize offset);
gsize (*head) (VteStream *stream);
- gboolean (*write_contents) (VteStream *stream, GOutputStream *output,
- gsize start_offset,
- GCancellable *cancellable, GError **error);
} VteStreamClass;
static GType _vte_stream_get_type (void);
@@ -65,10 +62,10 @@ _vte_stream_reset (VteStream *stream, gsize offset)
VTE_STREAM_GET_CLASS (stream)->reset (stream, offset);
}
-gsize
+void
_vte_stream_append (VteStream *stream, const char *data, gsize len)
{
- return VTE_STREAM_GET_CLASS (stream)->append (stream, data, len);
+ VTE_STREAM_GET_CLASS (stream)->append (stream, data, len);
}
gboolean
@@ -84,9 +81,9 @@ _vte_stream_truncate (VteStream *stream, gsize offset)
}
void
-_vte_stream_new_page (VteStream *stream)
+_vte_stream_advance_tail (VteStream *stream, gsize offset)
{
- VTE_STREAM_GET_CLASS (stream)->new_page (stream);
+ VTE_STREAM_GET_CLASS (stream)->advance_tail (stream, offset);
}
gsize
@@ -94,13 +91,3 @@ _vte_stream_head (VteStream *stream)
{
return VTE_STREAM_GET_CLASS (stream)->head (stream);
}
-
-gboolean
-_vte_stream_write_contents (VteStream *stream, GOutputStream *output,
- gsize start_offset,
- GCancellable *cancellable, GError **error)
-{
- return VTE_STREAM_GET_CLASS (stream)->write_contents (stream, output,
- start_offset,
- cancellable, error);
-}
diff --git a/src/vtestream-file.h b/src/vtestream-file.h
index bc92d6f8..8e7485a0 100644
--- a/src/vtestream-file.h
+++ b/src/vtestream-file.h
@@ -1,39 +1,138 @@
/*
* Copyright (C) 2009,2010 Red Hat, Inc.
+ * Copyright (C) 2013 Google, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Red Hat Author(s): Behdad Esfahbod
+ * Google Author(s): Behdad Esfahbod
*/
-#include <string.h>
-#include <unistd.h>
#include <errno.h>
-#include <gio/gunixinputstream.h>
+#include "vteutils.h"
+
+
+/*
+ * We provide two file implementations: one based on raw
+ * syscalls, and one based on stdio. The syscall one has
+ * got more than enough testing in the past. The stdio
+ * is newer, but has a default cache, which greatly reduces
+ * number of syscalls.
+ *
+ * Change the following conditional to 0 for syscalls, and
+ * to 1 for stdio. Please test both branches before
+ * making changes to _file_t semantics or implementation.
+ */
+
+#if 0
+
+
+/*
+ * File implementation using Unix syscalls.
+ */
+
+#include <unistd.h>
+
+#ifndef HAVE_PREAD
+#define pread _pread
+static inline gsize
+pread (int fd, char *data, gsize len, gsize offset)
+{
+ if (-1 == lseek (fd, offset, SEEK_SET))
+ return -1;
+ return read (fd, data, len);
+}
+#endif
+
+#ifndef HAVE_PWRITE
+#define pwrite _pwrite
+static inline gsize
+pwrite (int fd, char *data, gsize len, gsize offset)
+{
+ if (-1 == lseek (fd, offset, SEEK_SET))
+ return -1;
+ return write (fd, data, len);
+}
+#endif
+
+
+typedef struct
+{
+ int fd;
+} _file_t;
+
+static inline void
+_file_init (_file_t *f)
+{
+ f->fd = -1;
+}
+
+static inline void
+_file_open (_file_t *f, int fd)
+{
+ f->fd = fd;
+}
+
+static inline gboolean
+_file_isopen (_file_t *f)
+{
+ return f->fd != -1;
+}
+
+static inline void
+_file_close (_file_t *f)
+{
+ if (G_UNLIKELY (!_file_isopen (f)))
+ return;
+
+ close (f->fd);
+}
+
+
+static gboolean
+_file_try_truncate (_file_t *f, gsize offset)
+{
+ int ret;
+
+ if (G_UNLIKELY (!_file_isopen (f)))
+ return;
+
+ do {
+ ret = ftruncate (f->fd, offset);
+ } while (ret == -1 && errno == EINTR);
+
+ return !ret;
+}
+
+static void
+_file_reset (_file_t *f)
+{
+ _file_try_truncate (f, 0);
+}
static gsize
-_xread (int fd, char *data, gsize len)
+_file_read (_file_t *f, char *data, gsize len, gsize offset)
{
gsize ret, total = 0;
- if (G_UNLIKELY (len && !fd))
+ if (G_UNLIKELY (!_file_isopen (f)))
return 0;
while (len) {
- ret = read (fd, data, len);
+ ret = pread (f->fd, data, len, offset);
if (G_UNLIKELY (ret == (gsize) -1)) {
if (errno == EINTR)
continue;
@@ -44,23 +143,36 @@ _xread (int fd, char *data, gsize len)
break;
data += ret;
len -= ret;
+ offset += ret;
total += ret;
}
return total;
}
static void
-_xwrite (int fd, const char *data, gsize len)
+_file_write (_file_t *f, const char *data, gsize len, gsize offset)
{
gsize ret;
+ gboolean truncated = FALSE;
- g_assert (fd || !len);
+ g_assert (_file_isopen (f) || !len);
while (len) {
- ret = write (fd, data, len);
+ ret = pwrite (f->fd, data, len, offset);
if (G_UNLIKELY (ret == (gsize) -1)) {
if (errno == EINTR)
continue;
+ else if (errno == EINVAL && !truncated)
+ {
+ /* Perhaps previous writes failed and now we are
+ * seeking past end of file. Try extending it
+ * and retry. This allows recovering from a
+ * "/tmp is full" error.
+ */
+ _file_try_truncate (f, offset);
+ truncated = TRUE;
+ continue;
+ }
else
break;
}
@@ -68,49 +180,166 @@ _xwrite (int fd, const char *data, gsize len)
break;
data += ret;
len -= ret;
+ offset += ret;
}
}
+
+#else
+
+
+/*
+ * File implementation using stdio.
+ */
+
+#include <stdio.h>
+
+/* Use unlocked versions if available. */
+#ifdef HAVE_FWRITE_UNLOCKED
+# define fwrite fwrite_unlocked
+# define fread fread_unlocked
+# define fflush fflush_unlocked
+#endif
+
+typedef struct
+{
+ FILE *fp;
+ gsize pos;
+} _file_t;
+
+static inline void
+_file_init (_file_t *f)
+{
+ f->fp = NULL;
+ f->pos = -1;
+}
+
+static inline void
+_file_open (_file_t *f, int fd)
+{
+ f->fp = fdopen (fd, "w+");
+ f->pos = 0;
+}
+
+static inline gboolean
+_file_isopen (_file_t *f)
+{
+ return f->fp != NULL;
+}
+
+static inline void
+_file_close (_file_t *f)
+{
+ if (G_UNLIKELY (!_file_isopen (f)))
+ return;
+
+ fclose (f->fp);
+}
+
+
+static gboolean
+_file_try_truncate (_file_t *f, gsize offset)
+{
+ if (G_UNLIKELY (!_file_isopen (f)))
+ return TRUE;
+
+ /* We don't have to truncate. The bytestream works
+ * without a working truncate (hence the "try").
+ * Here's a fallback implementation. Things should
+ * work with or without this.
+ */
+ if (1)
+ {
+ int ret;
+
+ fflush (f->fp);
+
+ do {
+ ret = ftruncate (fileno (f->fp), offset);
+ } while (ret == -1 && errno == EINTR);
+
+ return !ret;
+ }
+
+ return FALSE;
+}
+
static void
-_xtruncate (gint fd, gsize offset)
+_file_reset (_file_t *f)
{
- int ret;
+ int fd;
- if (G_UNLIKELY (!fd))
+ if (_file_try_truncate (f, 0))
return;
- do {
- ret = ftruncate (fd, offset);
- } while (ret == -1 && errno == EINTR);
+ if (G_UNLIKELY (!_file_isopen (f)))
+ return;
+
+ /* Reopen file to truncate it. */
+
+ fd = dup (fileno (f->fp));
+
+ _file_close (f);
+ _file_open (f, fd);
}
static gboolean
-_xwrite_contents (gint fd, GOutputStream *output, GCancellable *cancellable, GError **error)
+_file_seek (_file_t *f, gsize offset)
{
- gboolean ret;
- GInputStream *input;
+ if (f->pos != offset)
+ {
+ if (-1 == fseek (f->fp, offset, SEEK_SET))
+ return FALSE;
+ f->pos = offset;
+ }
+ return TRUE;
+}
- if (G_UNLIKELY (!fd))
- return TRUE;
+static gsize
+_file_read (_file_t *f, char *data, gsize len, gsize offset)
+{
+ gsize ret;
- input = g_unix_input_stream_new (fd, FALSE);
- ret = -1 != g_output_stream_splice (output, input, G_OUTPUT_STREAM_SPLICE_NONE, cancellable, error);
- g_object_unref (input);
+ if (G_UNLIKELY (!_file_isopen (f)))
+ return 0;
+ if (!_file_seek (f, offset))
+ return 0;
+
+ ret = fread (data, 1, len, f->fp);
+ f->pos += ret;
return ret;
}
+static void
+_file_write (_file_t *f, const char *data, gsize len, gsize offset)
+{
+ gsize ret;
+
+ g_assert (_file_isopen (f) || !len);
+
+ if (!_file_seek (f, offset))
+ return;
+
+ ret = fwrite (data, 1, len, f->fp);
+ f->pos += ret;
+}
+
+
+#endif
+
/*
- * VteFileStream: A POSIX file-based stream
+ * VteFileStream: A file-based stream
*/
typedef struct _VteFileStream {
VteStream parent;
- /* The first fd/offset is for the write head, second is for last page */
- gint fd[2];
+ /* The first file/offset is for the write head, second is for last page */
+ _file_t file[2];
gsize offset[2];
+ gsize head;
} VteFileStream;
typedef VteStreamClass VteFileStreamClass;
@@ -121,8 +350,10 @@ static GType _vte_file_stream_get_type (void);
G_DEFINE_TYPE (VteFileStream, _vte_file_stream, VTE_TYPE_STREAM)
static void
-_vte_file_stream_init (VteFileStream *stream G_GNUC_UNUSED)
+_vte_file_stream_init (VteFileStream *stream)
{
+ _file_init (&stream->file[0]);
+ _file_init (&stream->file[1]);
}
VteStream *
@@ -136,29 +367,25 @@ _vte_file_stream_finalize (GObject *object)
{
VteFileStream *stream = (VteFileStream *) object;
- if (stream->fd[0]) close (stream->fd[0]);
- if (stream->fd[1]) close (stream->fd[1]);
+ _file_close (&stream->file[0]);
+ _file_close (&stream->file[1]);
G_OBJECT_CLASS (_vte_file_stream_parent_class)->finalize(object);
}
static inline void
-_vte_file_stream_ensure_fd0 (VteFileStream *stream)
+_vte_file_stream_ensure_file0 (VteFileStream *stream)
{
- gint fd;
- gchar *file_name;
- if (G_LIKELY (stream->fd[0]))
- return;
+ int fd;
- fd = g_file_open_tmp ("vteXXXXXX", &file_name, NULL);
- if (fd != -1) {
- unlink (file_name);
- g_free (file_name);
- }
+ if (G_LIKELY (_file_isopen (&stream->file[0])))
+ return;
- stream->fd[0] = dup (fd); /* we do the dup to make sure ->fd[0] is not 0 */
+ fd = _vte_mkstemp ();
+ if (fd == -1)
+ return;
- close (fd);
+ _file_open (&stream->file[0], fd);
}
static void
@@ -166,24 +393,21 @@ _vte_file_stream_reset (VteStream *astream, gsize offset)
{
VteFileStream *stream = (VteFileStream *) astream;
- if (stream->fd[0]) _xtruncate (stream->fd[0], 0);
- if (stream->fd[1]) _xtruncate (stream->fd[1], 0);
+ _file_reset (&stream->file[0]);
+ _file_reset (&stream->file[1]);
- stream->offset[0] = stream->offset[1] = offset;
+ stream->head = stream->offset[0] = stream->offset[1] = offset;
}
-static gsize
+static void
_vte_file_stream_append (VteStream *astream, const char *data, gsize len)
{
VteFileStream *stream = (VteFileStream *) astream;
- gsize ret;
-
- _vte_file_stream_ensure_fd0 (stream);
- ret = lseek (stream->fd[0], 0, SEEK_END);
- _xwrite (stream->fd[0], data, len);
+ _vte_file_stream_ensure_file0 (stream);
- return stream->offset[0] + ret;
+ _file_write (&stream->file[0], data, len, stream->head - stream->offset[0]);
+ stream->head += len;
}
static gboolean
@@ -196,13 +420,11 @@ _vte_file_stream_read (VteStream *astream, gsize offset, char *data, gsize len)
return FALSE;
if (offset < stream->offset[0]) {
- lseek (stream->fd[1], offset - stream->offset[1], SEEK_SET);
- l = _xread (stream->fd[1], data, len);
+ l = _file_read (&stream->file[1], data, len, offset - stream->offset[1]);
offset += l; data += l; len -= l; if (!len) return TRUE;
}
- lseek (stream->fd[0], offset - stream->offset[0], SEEK_SET);
- l = _xread (stream->fd[0], data, len);
+ l = _file_read (&stream->file[0], data, len, offset - stream->offset[0]);
offset += l; data += l; len -= l; if (!len) return TRUE;
return FALSE;
@@ -211,9 +433,9 @@ _vte_file_stream_read (VteStream *astream, gsize offset, char *data, gsize len)
static void
_vte_file_stream_swap_fds (VteFileStream *stream)
{
- gint fd;
+ _file_t f;
- fd = stream->fd[0]; stream->fd[0] = stream->fd[1]; stream->fd[1] = fd;
+ f = stream->file[0]; stream->file[0] = stream->file[1]; stream->file[1] = f;
}
static void
@@ -222,29 +444,32 @@ _vte_file_stream_truncate (VteStream *astream, gsize offset)
VteFileStream *stream = (VteFileStream *) astream;
if (G_UNLIKELY (offset < stream->offset[1])) {
- _xtruncate (stream->fd[1], 0);
+ _file_reset (&stream->file[1]);
stream->offset[1] = offset;
}
if (G_UNLIKELY (offset < stream->offset[0])) {
- _xtruncate (stream->fd[0], 0);
+ _file_reset (&stream->file[0]);
stream->offset[0] = stream->offset[1];
_vte_file_stream_swap_fds (stream);
} else {
- _xtruncate (stream->fd[0], offset - stream->offset[0]);
+ _file_try_truncate (&stream->file[0], offset - stream->offset[0]);
}
+
+ stream->head = offset;
}
static void
-_vte_file_stream_new_page (VteStream *astream)
+_vte_file_stream_advance_tail (VteStream *astream, gsize offset)
{
VteFileStream *stream = (VteFileStream *) astream;
- stream->offset[1] = stream->offset[0];
- if (stream->fd[0])
- stream->offset[0] += lseek (stream->fd[0], 0, SEEK_END);
- _vte_file_stream_swap_fds (stream);
- _xtruncate (stream->fd[0], 0);
+ if (offset >= stream->offset[0]) {
+ stream->offset[1] = stream->offset[0];
+ stream->offset[0] = stream->head;
+ _vte_file_stream_swap_fds (stream);
+ _file_reset (&stream->file[0]);
+ }
}
static gsize
@@ -252,31 +477,7 @@ _vte_file_stream_head (VteStream *astream)
{
VteFileStream *stream = (VteFileStream *) astream;
- if (stream->fd[0])
- return stream->offset[0] + lseek (stream->fd[0], 0, SEEK_END);
- else
- return stream->offset[0];
-}
-
-static gboolean
-_vte_file_stream_write_contents (VteStream *astream, GOutputStream *output,
- gsize offset,
- GCancellable *cancellable, GError **error)
-{
- VteFileStream *stream = (VteFileStream *) astream;
-
- if (G_UNLIKELY (offset < stream->offset[1]))
- return FALSE;
-
- if (offset < stream->offset[0]) {
- lseek (stream->fd[1], offset - stream->offset[1], SEEK_SET);
- if (!_xwrite_contents (stream->fd[1], output, cancellable, error))
- return FALSE;
- offset = stream->offset[0];
- }
-
- lseek (stream->fd[0], offset - stream->offset[0], SEEK_SET);
- return _xwrite_contents (stream->fd[0], output, cancellable, error);
+ return stream->head;
}
static void
@@ -290,7 +491,6 @@ _vte_file_stream_class_init (VteFileStreamClass *klass)
klass->append = _vte_file_stream_append;
klass->read = _vte_file_stream_read;
klass->truncate = _vte_file_stream_truncate;
- klass->new_page = _vte_file_stream_new_page;
+ klass->advance_tail = _vte_file_stream_advance_tail;
klass->head = _vte_file_stream_head;
- klass->write_contents = _vte_file_stream_write_contents;
}
diff --git a/src/vtestream.c b/src/vtestream.c
index ab909482..4fc5ef76 100644
--- a/src/vtestream.c
+++ b/src/vtestream.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2009,2010 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Red Hat Author(s): Behdad Esfahbod
*/
diff --git a/src/vtestream.h b/src/vtestream.h
index 27a28297..4cf68624 100644
--- a/src/vtestream.h
+++ b/src/vtestream.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2009,2010 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Red Hat Author(s): Behdad Esfahbod
*/
@@ -29,15 +29,11 @@ G_BEGIN_DECLS
typedef struct _VteStream VteStream;
void _vte_stream_reset (VteStream *stream, gsize offset);
-gsize _vte_stream_append (VteStream *stream, const char *data, gsize len);
+void _vte_stream_append (VteStream *stream, const char *data, gsize len);
gboolean _vte_stream_read (VteStream *stream, gsize offset, char *data, gsize len);
void _vte_stream_truncate (VteStream *stream, gsize offset);
-void _vte_stream_new_page (VteStream *stream);
+void _vte_stream_advance_tail (VteStream *stream, gsize offset);
gsize _vte_stream_head (VteStream *stream);
-gboolean _vte_stream_write_contents (VteStream *stream, GOutputStream *output,
- gsize start_offset,
- GCancellable *cancellable, GError **error);
-
/* Various streams */
diff --git a/src/vtetc.c b/src/vtetc.c
index 88e814ce..8c8e20c4 100644
--- a/src/vtetc.c
+++ b/src/vtetc.c
@@ -2,24 +2,25 @@
* Copyright © 2006 Ryan Lortie <desrt@desrt.ca>
* based on code © 2000-2002 Red Hat, Inc. and others.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <string.h>
#include <stdlib.h>
#include <glib.h>
+#include <gio/gio.h>
#include "vtetc.h"
@@ -28,7 +29,7 @@
*/
typedef struct _vte_termcap
{
- GMappedFile *file;
+ GBytes *data;
GTree *tree;
const char *end;
} VteTermcap;
@@ -470,35 +471,71 @@ _vte_termcap_parse_file (const char *contents, int length)
}
static VteTermcap *
-_vte_termcap_create (const char *filename)
+_vte_termcap_new_take_bytes (GBytes *data)
{
- const char *contents;
VteTermcap *termcap;
- GMappedFile *file;
- int length;
-
- file = g_mapped_file_new (filename, FALSE, NULL);
- if (file == NULL)
- return NULL;
+ const char *contents;
+ gsize length;
- contents = g_mapped_file_get_contents (file);
- length = g_mapped_file_get_length (file);
+ contents = g_bytes_get_data (data, &length);
termcap = g_slice_new (VteTermcap);
- termcap->file = file;
+ termcap->data = data; /* adopted */
termcap->tree = _vte_termcap_parse_file (contents, length);
termcap->end = contents + length;
return termcap;
}
+static VteTermcap *
+_vte_termcap_new_from_file (const char *path)
+{
+ GMappedFile *file;
+ GBytes *data;
+
+ file = g_mapped_file_new (path, FALSE, NULL);
+ if (file == NULL)
+ return NULL;
+
+ data = g_bytes_new_with_free_func (g_mapped_file_get_contents (file),
+ g_mapped_file_get_length (file),
+ (GDestroyNotify) g_mapped_file_unref,
+ file);
+
+ return _vte_termcap_new_take_bytes (data);
+}
+
+static VteTermcap *
+_vte_termcap_create (const char *name)
+{
+#ifdef VTE_API_VERSION
+ char *path;
+ GBytes *data;
+
+ /* First try the builtin termcaps */
+ path = g_build_path ("/",
+ "/org/gnome/vte",
+ VTE_API_VERSION,
+ "termcap",
+ name,
+ NULL);
+ data = g_resources_lookup_data (path, G_RESOURCE_LOOKUP_FLAGS_NONE, NULL);
+ g_free(path);
+ if (data != NULL)
+ return _vte_termcap_new_take_bytes (data);
+#endif /* VTE_API_VERSION */
+
+ /* Try /etc/termcap */
+ return _vte_termcap_new_from_file ("/etc/termcap");
+}
+
static void
_vte_termcap_destroy (VteTermcap *termcap)
{
if (!termcap)
return;
g_tree_destroy (termcap->tree);
- g_mapped_file_unref (termcap->file);
+ g_bytes_unref (termcap->data);
g_slice_free (VteTermcap, termcap);
}
@@ -509,7 +546,7 @@ static GStaticMutex _vte_termcap_mutex = G_STATIC_MUTEX_INIT;
static GCache *_vte_termcap_cache = NULL;
VteTermcap *
-_vte_termcap_new(const char *filename)
+_vte_termcap_new(const char *name)
{
VteTermcap *result;
@@ -522,7 +559,7 @@ _vte_termcap_new(const char *filename)
(GCacheDestroyFunc) g_free,
g_str_hash, g_direct_hash, g_str_equal);
- result = g_cache_insert (_vte_termcap_cache, (gpointer) filename);
+ result = g_cache_insert (_vte_termcap_cache, (gpointer) name);
g_static_mutex_unlock (&_vte_termcap_mutex);
@@ -559,7 +596,7 @@ main (int argc, char **argv)
return 1;
}
- tc = _vte_termcap_new (argv[1]);
+ tc = _vte_termcap_new_from_file (argv[1]);
if (tc == NULL)
{
diff --git a/src/vtetc.h b/src/vtetc.h
index d1bab8d6..0b914ce0 100644
--- a/src/vtetc.h
+++ b/src/vtetc.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2000-2002 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* The interfaces in this file are subject to change at any time. */
@@ -29,7 +29,7 @@ G_BEGIN_DECLS
struct _vte_termcap;
/* Create a new termcap structure. */
-struct _vte_termcap *_vte_termcap_new(const char *filename);
+struct _vte_termcap *_vte_termcap_new(const char *name);
/* Free a termcap structure. */
void _vte_termcap_free(struct _vte_termcap *termcap);
diff --git a/src/vtetree.c b/src/vtetree.c
index c2b80549..5bd45ac4 100644
--- a/src/vtetree.c
+++ b/src/vtetree.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2004 Benjamin Otte <otte@gnome.org>
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* The interfaces in this file are subject to change at any time. */
diff --git a/src/vtetree.h b/src/vtetree.h
index 6c78143d..4587fcdf 100644
--- a/src/vtetree.h
+++ b/src/vtetree.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2004 Benjamin Otte <otte@gnome.org>
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* The interfaces in this file are subject to change at any time. */
diff --git a/src/vtetypebuiltins.c.template b/src/vtetypebuiltins.c.template
index 0a6c5b27..bef7a461 100644
--- a/src/vtetypebuiltins.c.template
+++ b/src/vtetypebuiltins.c.template
@@ -4,7 +4,7 @@
/*** END file-header ***/
/*** BEGIN file-production ***/
-/* enumerations from "@filename@" */
+/* enumerations from "@basename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
diff --git a/src/vtetypebuiltins.h.template b/src/vtetypebuiltins.h.template
index a886d590..255b6c24 100644
--- a/src/vtetypebuiltins.h.template
+++ b/src/vtetypebuiltins.h.template
@@ -13,7 +13,7 @@ G_BEGIN_DECLS
/*** BEGIN file-production ***/
-/* enumerations from "@filename@" */
+/* enumerations from "@basename@" */
/*** END file-production ***/
/*** BEGIN value-header ***/
diff --git a/src/vteunistr.c b/src/vteunistr.c
index 435371ff..2e412e3e 100644
--- a/src/vteunistr.c
+++ b/src/vteunistr.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2008 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author(s):
* Behdad Esfahbod
diff --git a/src/vteunistr.h b/src/vteunistr.h
index 3c22bee2..04aa9fb6 100644
--- a/src/vteunistr.h
+++ b/src/vteunistr.h
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2008 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author(s):
* Behdad Esfahbod
diff --git a/src/vteutils.c b/src/vteutils.c
new file mode 100644
index 00000000..f840b89e
--- /dev/null
+++ b/src/vteutils.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright © 2013 Christian Persch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE /* for O_TMPFILE */
+#endif
+
+#include "vteutils.h"
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <glib.h>
+
+/* Temporary define until glibc release catches up */
+#ifdef __linux__
+#ifndef O_TMPFILE
+#ifndef __O_TMPFILE
+#define __O_TMPFILE 020000000
+#endif
+#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
+#endif
+#endif
+
+int
+_vte_mkstemp (void)
+{
+ int fd;
+ gchar *file_name;
+
+#ifdef O_TMPFILE
+ fd = open (g_get_tmp_dir (),
+ O_TMPFILE | O_EXCL | O_RDWR | O_NOATIME,
+ 0600);
+ if (fd != -1)
+ goto done;
+
+ /* Try again with g_file_open_tmp */
+#endif
+
+ fd = g_file_open_tmp ("vteXXXXXX", &file_name, NULL);
+ if (fd == -1)
+ return -1;
+
+ unlink (file_name);
+ g_free (file_name);
+
+#ifdef O_NOATIME
+ do { } while (fcntl (fd, F_SETFL, O_NOATIME) == -1 && errno == EINTR);
+#endif
+
+#ifdef O_TMPFILE
+ done:
+#endif
+
+ return fd;
+}
diff --git a/src/vteutils.h b/src/vteutils.h
new file mode 100644
index 00000000..999e3bf9
--- /dev/null
+++ b/src/vteutils.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright © 2013 Christian Persch
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __VTE_UTILS_H__
+#define __VTE_UTILS_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+int _vte_mkstemp (void);
+
+G_END_DECLS
+
+#endif /* __VTE_UTILS_H__ */
diff --git a/src/vteversion.h.in b/src/vteversion.h.in
index 0f801b7f..65d8fcdd 100644
--- a/src/vteversion.h.in
+++ b/src/vteversion.h.in
@@ -1,19 +1,19 @@
/*
* Copyright © 2008 Christian Persch
*
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as published by the
- * Free Software Foundation; either version 2.1 of the License, or (at your
- * option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public License along
- * with this library; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02110-1301 USA
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if !defined (__VTE_VTE_H_INSIDE__) && !defined (VTE_COMPILATION)
diff --git a/src/xticker.c b/src/xticker.c
index e5648cb8..20e46fb3 100644
--- a/src/xticker.c
+++ b/src/xticker.c
@@ -1,19 +1,19 @@
/*
* Copyright (C) 2003 Red Hat, Inc.
*
- * This is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Library General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library 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
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <config.h>
diff --git a/termcaps/Makefile.am b/termcaps/Makefile.am
index 965071b6..da5eeae7 100644
--- a/termcaps/Makefile.am
+++ b/termcaps/Makefile.am
@@ -1,12 +1,4 @@
-EXTRA_DIST = xterm xterm.baseline
-termcapdir = $(pkgdatadir)/termcap-$(VTE_API_VERSION)
-termcap_DATA = xterm
-
-if VTE_DEFAULT_EMULATION
-termcap_DATA += $(VTE_DEFAULT_EMULATION)
-$(VTE_DEFAULT_EMULATION): xterm
- $(AM_V_GEN) $(SED) -e s,^xterm:,$(VTE_DEFAULT_EMULATION):,g \
- -e s,^xterm\|,$(VTE_DEFAULT_EMULATION)\|,g $< > $@
-endif
+EXTRA_DIST = xterm.baseline
+dist_noinst_DATA = xterm
-include $(top_srcdir)/git.mk
diff --git a/vte-uninstalled.pc.in b/vte-uninstalled.pc.in
deleted file mode 100644
index 36ee26b0..00000000
--- a/vte-uninstalled.pc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-defaultemulation=@VTE_DEFAULT_EMULATION@
-
-Name: vte
-Description: Vte terminal widget.
-Version: @VERSION@
-Requires: @VTE_PKGS@
-Libs: ${pc_top_builddir}/${pcfiledir}/src/libvte@VTE_LIBRARY_SUFFIX_U@.la
-Cflags: -I${pc_top_builddir}/${pcfiledir}/src @VTE_SEAL_CFLAGS@
diff --git a/vte.pc.in b/vte.pc.in
index 672171a7..7dd5559b 100644
--- a/vte.pc.in
+++ b/vte.pc.in
@@ -3,11 +3,9 @@ exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
-defaultemulation=@VTE_DEFAULT_EMULATION@
-
Name: vte
Description: Vte terminal widget.
Version: @VERSION@
Requires: @VTE_PKGS@
-Libs: -L${libdir} -lvte@VTE_LIBRARY_SUFFIX_U@
-Cflags: -I${includedir}/vte-@VTE_API_VERSION@ @VTE_SEAL_CFLAGS@
+Libs: -L${libdir} -lvte-@VTE_API_VERSION@
+Cflags: -I${includedir}/vte-@VTE_API_VERSION@