zvt patch
- From: Havoc Pennington <hp redhat com>
- To: gnome-libs-devel gnome org
- Cc: jacob ximian com
- Subject: zvt patch
- Date: 11 Dec 2001 23:27:18 -0500
Hi,
- fixes bug I posted about earlier with title_changed signal
- fixes encoding of the title given in title_changed
Will commit soon if no one appears and says otherwise.
Havoc
Index: libzvt/ChangeLog
===================================================================
RCS file: /cvs/gnome/libzvt/libzvt/ChangeLog,v
retrieving revision 1.307
diff -u -p -u -r1.307 ChangeLog
--- libzvt/ChangeLog 2001/12/11 15:05:34 1.307
+++ libzvt/ChangeLog 2001/12/12 04:30:01
@@ -1,3 +1,9 @@
+2001-12-11 Havoc Pennington <hp pobox com>
+
+ * zvtterm.c (zvt_term_class_init): make title_changed signal
+ signature reflect reality
+ (zvt_term_title_changed): fix signature
+
2001-12-11 Laszlo Peter <laca ireland sun com>
* gnome-pty-helper.c: use glib/galloca.h instead of copy-pasted checks,
Index: libzvt/Makefile.am
===================================================================
RCS file: /cvs/gnome/libzvt/libzvt/Makefile.am,v
retrieving revision 1.55
diff -u -p -u -r1.55 Makefile.am
--- libzvt/Makefile.am 2001/10/30 17:42:56 1.55
+++ libzvt/Makefile.am 2001/12/12 04:30:01
@@ -43,10 +43,28 @@ libzvt_2_la_SOURCES = \
vtx.h \
background.c \
background.h \
- zvtterm.c
+ zvtterm.c \
+ zvt-marshal.c \
+ zvt-marshal.h
libzvt_2_la_LIBADD = $(ZVT_LIBS)
+$(srcdir)/zvt-marshal.h: Makefile.am zvt-marshal.list
+ cd $(srcdir) \
+ && glib-genmarshal --prefix=zvt_marshal zvt-marshal.list --header >> xgen-gmh \
+ && (cmp -s xgen-gmh zvt-marshal.h || cp xgen-gmh zvt-marshal.h) \
+ && rm -f xgen-gmh xgen-gmh~
+
+$(srcdir)/zvt-marshal.c: Makefile.am zvt-marshal.list
+ cd $(srcdir) \
+ && glib-genmarshal --prefix=zvt_marshal zvt-marshal.list --body >> xgen-gmc \
+ && cp xgen-gmc zvt-marshal.c \
+ && rm -f xgen-gmc xgen-gmc~
+
+BUILT_SOURCES = \
+ zvt-marshal.h \
+ zvt-marshal.c
+
gnome_pty_helper_2_SOURCES= \
gnome-pty-helper.c \
gnome-login-support.c \
@@ -56,7 +74,7 @@ gnome_pty_helper_2_LDADD= $(UTIL_LIBS)
# Since we do gnome-pty-helper manually, include the relevant sources here
EXTRA_DIST = TODO BUGS README \
- gnome-pty.h gnome-pty-helper.c gnome-utmp.c
+ gnome-pty.h gnome-pty-helper.c gnome-utmp.c zvt-marshal.list zvt-marshal.c
zterm_SOURCES = zterm.c
zterm_INCLUDES = $(INCLUDES)
@@ -74,3 +92,4 @@ test_utmp_LDADD =
install-exec-local:
-file=$(DESTDIR)$(sbindir)/gnome-pty-helper-2; \
chown root $$file && chgrp root $$file && chmod u+s $$file
+
Index: libzvt/libzvt.h
===================================================================
RCS file: /cvs/gnome/libzvt/libzvt/libzvt.h,v
retrieving revision 1.6
diff -u -p -u -r1.6 libzvt.h
--- libzvt/libzvt.h 2001/12/06 22:58:55 1.6
+++ libzvt/libzvt.h 2001/12/12 04:30:01
@@ -151,7 +151,7 @@ struct _ZvtTermClass
GtkWidgetClass parent_class;
void (* child_died) (ZvtTerm *term);
- void (* title_changed) (ZvtTerm *term, char *newtitle, VTTITLE_TYPE type);
+ void (* title_changed) (ZvtTerm *term, VTTITLE_TYPE type, const char *newtitle);
void (* got_output) (ZvtTerm* term, const gchar *buffer, gint count);
void (* match_clicked) (ZvtTerm *term, GdkEventButton *event, char *match, void *data);
/* Bindings actions */
Index: libzvt/vt.c
===================================================================
RCS file: /cvs/gnome/libzvt/libzvt/vt.c,v
retrieving revision 1.81
diff -u -p -u -r1.81 vt.c
--- libzvt/vt.c 2001/10/13 22:30:00 1.81
+++ libzvt/vt.c 2001/12/12 04:30:01
@@ -1342,7 +1342,8 @@ vt_set_text(struct vt_em *vt)
{
char *p;
int i;
-
+ char *utf8;
+
if (vt->change_my_name) {
p = strchr(vt->arg.txt.args_mem, ';');
if (p) {
@@ -1368,8 +1369,43 @@ vt_set_text(struct vt_em *vt)
default: /* dont care, piss off */
return;
}
- /* Order changed to reflect the changed arg. order */
- vt->change_my_name(vt->user_data, p, i);
+
+ /* XPROPERTY sets an XA_STRING in gnome-terminal and must
+ * therefore be Latin-1 unless gnome-terminal is on crack.
+ * We'll assume the title/iconname are in locale encoding, since
+ * AFAIK they aren't tagged for encoding. xterm seems to treat
+ * them as locale encoding.
+ */
+
+ if (i == VTTITLE_XPROPERTY)
+ {
+ const char *s;
+ GString *str;
+
+ str = g_string_new ("");
+
+ s = p;
+ while (*s)
+ {
+ g_string_append_unichar (str, *s);
+ ++s;
+ }
+
+ utf8 = g_string_free (str, FALSE);
+ }
+ else
+ {
+ utf8 = g_locale_to_utf8 (p, -1, NULL, NULL, NULL);
+ /* utf8 will be NULL if the title was not valid
+ * in the locale encoding
+ */
+ }
+
+ if (utf8)
+ {
+ vt->change_my_name (vt->user_data, utf8, i);
+ g_free (utf8);
+ }
}
}
}
Index: libzvt/zvt-marshal.list
===================================================================
RCS file: zvt-marshal.list
diff -N zvt-marshal.list
--- /dev/null Tue May 5 16:32:27 1998
+++ zvt-marshal.list Tue Dec 11 23:30:01 2001
@@ -0,0 +1 @@
+VOID:INT,POINTER
Index: libzvt/zvtterm.c
===================================================================
RCS file: /cvs/gnome/libzvt/libzvt/zvtterm.c,v
retrieving revision 1.165
diff -u -p -u -r1.165 zvtterm.c
--- libzvt/zvtterm.c 2001/12/06 22:58:56 1.165
+++ libzvt/zvtterm.c 2001/12/12 04:30:02
@@ -51,6 +51,7 @@
#include <X11/Xatom.h>
#include <X11/Xos.h>
+#include "zvt-marshal.h"
/* define to 'x' to enable copious debug output */
#define d(x)
@@ -84,7 +85,7 @@ static void zvt_term_selection_get (GtkW
guint info,
guint time);
static void zvt_term_child_died (ZvtTerm *term);
-static void zvt_term_title_changed (ZvtTerm *term, char *str, VTTITLE_TYPE type);
+static void zvt_term_title_changed (ZvtTerm *term, VTTITLE_TYPE type, const char *str);
static void zvt_term_title_changed_raise (void *user_data, char *str, VTTITLE_TYPE type);
static void zvt_term_got_output (ZvtTerm *term, const gchar *buffer, gint count);
static gint zvt_term_cursor_blink (gpointer data);
@@ -202,10 +203,10 @@ zvt_term_class_init (ZvtTermClass *class
/*
gnome_marshal_VOID__INT_POINTER,
*/
- gtk_marshal_VOID__POINTER_INT,
+ zvt_marshal_VOID__INT_POINTER,
GTK_TYPE_NONE, 2,
- GTK_TYPE_POINTER,
- GTK_TYPE_INT);
+ GTK_TYPE_INT,
+ GTK_TYPE_POINTER);
term_signals[GOT_OUTPUT] =
gtk_signal_new ("got_output",
@@ -2575,7 +2576,7 @@ zvt_term_child_died (ZvtTerm *term)
/* dummy default signal handler for title_changed */
static void
-zvt_term_title_changed (ZvtTerm *term, char *str, VTTITLE_TYPE type)
+zvt_term_title_changed (ZvtTerm *term, VTTITLE_TYPE type, const char *str)
{
g_return_if_fail (term != NULL);
g_return_if_fail (ZVT_IS_TERM (term));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]