+2003-06-03 nalin
+ * src/vtebg.c(_vte_bg_get_pixmap, _vte_bg_get_pixbuf): trap X errors
+ while retrieving the contents of the root pixmap.
+ * doc/ambiguous.txt: add.
+ * README: update.
+ * vte.spec: rebuild.
+
Tue Jun 3 15:50:38 2003 Jonathan Blandford <jrb@redhat.com>
* src/pty.c (n_read): add a missing break in the switch statement.
illustrates more or less what the widget sees after it filters incoming data.
* What's missing?
-- Accessibility doesn't work right yet.
-- Chinese and Korean text isn't displayed correctly because we pass it through
- iconv() before performing substitutions, and they both use GR characters.
- Japanese works because it only uses GL characters, which iconv() essentially
- casts to gunichars, where we perform substitutions. Probably we need to break
- the text into narrow and wide chunks by performing substitution first (to find
- and break out the wide chunks) and then iconv the narrow sets (what's left)
- one chunk at a time.
+- Accessibility doesn't work quite right yet.
- Mouse hilite tracking isn't implemented yet.
- Most control sequences are recognized, but many aren't implemented. There
are enough to run ls, vim, less, emacs and mutt, but more need to be
- implemented (ff, i1, i3, is, iP, LF, LO, MC, mh, ML, mm, mo, nw, pf,
- pk, pl, pf, po, pO, ps, px, r1, r2, r3, RA, RF, rp, rs, RX, SA, SX, wi,
- several more from the XTerm set).
+ implemented (ds, ff, hd, hu, i1, i3, iP, is, LF, LO, MC, ML, mm, mo, pf, pk,
+ pl, pn, po, pO, ps, px, r1, r2, r3, RA, RF, rp, rs, RX, SA, SX, wi, several
+ more from the XTerm set).
- I'm not sure the widget implementation itself is correct. There are many
changes in going from GTK+ 1.2 to 2.0, and examples of the proper way to do
things is currently scarce, so some of it's guesswork.
--- /dev/null
+Unicode defines width information for characters. Conventionally this
+describes the number of columns a character is expected to occupy when
+printed or drawn using a monospaced font.
+
+There are five width classes with which we concern ourselves. Four of
+these are narrow, wide, half-width, and full-width. For practical
+purposes, narrow and half-width can be grouped together as
+"single-width" (occupying one column), and wide and full-width can be
+grouped together as "double-width" (occupying two columns).
+
+The last class we're concerned with is those of ambiguous width. These
+are characters which have the same meaning and graphical representation
+everywhere, but which are either single-width or double-width based on
+the context in which they appear.
+
+Width information is crucial for terminal-based applications which need
+to address the screen: if the application draws five characters and
+expects the cursor to be in moved six columns to the right, and the
+terminal moves the cursor seven (or five, or any number other than six),
+display bugs manifest.
+
+Ambiguously-wide characters pose an implementation problem for terminals
+which may not be running in the same locale as an application which is
+running inside the terminal. In these cases, the terminal cannot depend
+on the libc wcwidth() function because wcwidth() typically makes use of
+locale information.
+
+There are basically four approaches to solving this problem:
+A) Force characters with ambiguous width to be single-width.
+B) Force characters with ambiguous width to be double-width.
+C) Force characters with ambiguous width to be have a width value based
+ on the locale's region.
+D) Force characters with ambiguous width to be have a width value based
+ on the locale's encoding.
+
+Methods A and B will produce display bugs, because they don't take into
+account any context information. Method C fails on glibc-based systems
+because glibc uses method D and the two methods produce different
+results for the same wchar_t values.
+
+So the VteTerminal widget uses approach D. Depending on the context in
+which a character was received (a combination of the terminal's encoding
+and whether or not the character was received as an ISO-2022 sequence),
+a character is internally assigned a width when it is received from the
+terminal.
+
+Text which is not received from the terminal (input method preedit data)
+is processed using method C, although now that I think about it, the
+fact that it's UTF-8 text suggests that these characters should be
+treated as single-width.
{"i1", NULL},
{"i3", NULL},
- {"is", NULL},
{"ic", vte_sequence_handler_ic},
{"IC", vte_sequence_handler_IC},
{"if", NULL},
{"im", vte_sequence_handler_im},
{"ip", NULL},
{"iP", NULL},
+ {"is", NULL},
{"K1", vte_sequence_handler_complain_key},
{"K2", vte_sequence_handler_complain_key},
GdkBitmap *mask;
GdkPixbuf *pixbuf;
char *file;
- int width, height;
if (bg == NULL) {
bg = vte_bg_get();
switch (source_type) {
case VTE_BG_SOURCE_ROOT:
if (GDK_IS_PIXMAP(bg->root_pixmap)) {
- gdk_drawable_get_size(bg->root_pixmap, &width, &height);
+ int width, height;
+ /* Tell GTK+ that this foreign pixmap shares the
+ * root window's colormap. */
rcolormap = gdk_drawable_get_colormap(gdk_get_default_root_window());
if (gdk_drawable_get_colormap(bg->root_pixmap) == NULL) {
- gdk_drawable_set_colormap(bg->root_pixmap, rcolormap);
+ gdk_drawable_set_colormap(bg->root_pixmap,
+ rcolormap);
+ }
+
+ /* Retrieve the pixmap's size. */
+ gdk_error_trap_push();
+ width = height = -1;
+ gdk_drawable_get_size(bg->root_pixmap, &width, &height);
+ gdk_error_trap_pop();
+
+ /* If the pixmap gave us a valid size, retrieve its
+ * contents. */
+ if ((width > 0) && (height > 0)) {
+ gdk_error_trap_push();
+ pixbuf = gdk_pixbuf_get_from_drawable(NULL,
+ bg->root_pixmap,
+ NULL,
+ 0, 0,
+ 0, 0,
+ width, height);
+ gdk_error_trap_pop();
}
- pixbuf = gdk_pixbuf_get_from_drawable(NULL,
- bg->root_pixmap,
- NULL,
- 0, 0,
- 0, 0,
- width, height);
}
break;
case VTE_BG_SOURCE_PIXBUF:
case VTE_BG_SOURCE_ROOT:
if (GDK_IS_PIXMAP(bg->root_pixmap)) {
gint width, height;
- gdk_drawable_get_size(bg->root_pixmap, &width, &height);
+
+ /* If the pixmap doesn't have a colormap, tell GTK+ that
+ * it shares the root window's colormap. */
rcolormap = gdk_drawable_get_colormap(gdk_get_default_root_window());
if (gdk_drawable_get_colormap(bg->root_pixmap) == NULL) {
gdk_drawable_set_colormap(bg->root_pixmap, rcolormap);
}
- pixbuf = gdk_pixbuf_get_from_drawable(NULL,
- bg->root_pixmap,
- NULL,
- 0, 0,
- 0, 0,
- width, height);
+
+ /* Read the pixmap's size. */
+ gdk_error_trap_push();
+ width = height = -1;
+ gdk_drawable_get_size(bg->root_pixmap, &width, &height);
+ gdk_error_trap_pop();
+
+ /* If we got a valid size, read the pixmap's
+ * contents. */
+ if ((width > 0) && (height > 0)) {
+ gdk_error_trap_push();
+ pixbuf = gdk_pixbuf_get_from_drawable(NULL,
+ bg->root_pixmap,
+ NULL,
+ 0, 0,
+ 0, 0,
+ width, height);
+ gdk_error_trap_pop();
+ }
}
break;
case VTE_BG_SOURCE_PIXBUF:
Name: vte
Version: 0.11.9
-Release: 1
+Release: 2
Summary: An experimental terminal emulator.
License: LGPL
Group: User Interface/X
%{_libdir}/pkgconfig/*
%changelog
+* Mon Jun 2 2003 Nalin Dahyabhai <nalin@redhat.com> 0.11.9-2
+- rebuild
+
* Mon Jun 2 2003 Nalin Dahyabhai <nalin@redhat.com> 0.11.9-1
- fix saving/restoring the cursor with DECSET/DECRST
- revert behavior wrt ambiguously-wide characters to be more like 0.10.x