1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
diff -dPNur xterm-243/menu.c xterm-243-sm/menu.c
--- xterm-243/menu.c 2009-03-28 18:27:57.000000000 +0100
+++ xterm-243-sm/menu.c 2009-06-14 05:54:26.000000000 +0200
@@ -186,6 +186,10 @@
static void do_font_loadable PROTO_XT_CALLBACK_ARGS;
#endif
+#if OPT_WIDE_CHARS
+static void do_font_multibyte PROTO_XT_CALLBACK_ARGS;
+#endif
+
#if OPT_HP_FUNC_KEYS
static void do_hp_fkeys PROTO_XT_CALLBACK_ARGS;
#endif
@@ -245,6 +249,15 @@
static void do_font_utf8_title PROTO_XT_CALLBACK_ARGS;
#endif
+static void
+UpdateMenuItem(
+#if OPT_TRACE
+ const char *func,
+#endif
+ MenuEntry * menu,
+ int which,
+ Bool val);
+
/*
* The order of entries MUST match the values given in menu.h
*/
@@ -365,6 +378,7 @@
{ "render-font", do_font_renderfont,NULL },
#endif
#if OPT_WIDE_CHARS
+ { "font-multibyte", do_font_multibyte, NULL },
{ "utf8-mode", do_font_utf8_mode,NULL },
{ "utf8-title", do_font_utf8_title,NULL },
#endif
@@ -697,6 +711,14 @@
}
}
#endif
+#if OPT_WIDE_CHARS
+ if ((term->screen.utf8_mode>255)||(!term->screen.wide_chars)) {
+ SetItemSensitivity(fontMenuEntries[fontMenu_font_multibyte].widget,
+ False);
+ } else {
+ update_font_multibyte();
+ }
+#endif
}
break;
@@ -1560,6 +1582,23 @@
}
#endif
+#if OPT_WIDE_CHARS
+static void
+do_font_multibyte(Widget gw GCC_UNUSED,
+ XtPointer closure GCC_UNUSED,
+ XtPointer data GCC_UNUSED)
+{
+ term->screen.font_multibyte = !term->screen.font_multibyte;
+ if (term->screen.font_multibyte) {
+ term->screen.utf8_mode=1;
+ } else {
+ term->screen.utf8_mode=0;
+ }
+ update_font_multibyte();
+ Redraw();
+}
+#endif
+
/*
* tek menu
*/
@@ -2221,6 +2260,18 @@
}
#endif
+#if OPT_WIDE_CHARS
+void
+HandleFontMultibyte(Widget w,
+ XEvent * event GCC_UNUSED,
+ String * params,
+ Cardinal * param_count)
+{
+ handle_toggle(do_font_multibyte, (int) term->screen.font_multibyte,
+ params, *param_count, w, (XtPointer) 0, (XtPointer) 0);
+}
+#endif
+
#if OPT_BOX_CHARS
void
HandleFontBoxChars(Widget w,
diff -dPNur xterm-243/menu.h xterm-243-sm/menu.h
--- xterm-243/menu.h 2009-02-13 20:55:26.000000000 +0100
+++ xterm-243-sm/menu.h 2009-06-14 05:57:56.000000000 +0200
@@ -90,6 +90,7 @@
extern void HandleFontBoxChars PROTO_XT_ACTIONS_ARGS;
extern void HandleFontDoublesize PROTO_XT_ACTIONS_ARGS;
extern void HandleFontLoading PROTO_XT_ACTIONS_ARGS;
+extern void HandleFontMultibyte PROTO_XT_ACTIONS_ARGS;
extern void HandleHardReset PROTO_XT_ACTIONS_ARGS;
extern void HandleHpFunctionKeys PROTO_XT_ACTIONS_ARGS;
extern void HandleJumpscroll PROTO_XT_ACTIONS_ARGS;
@@ -264,6 +265,9 @@
fontMenu_font_loadable,
#endif
#endif
+#if OPT_WIDE_CHARS
+ fontMenu_font_multibyte,
+#endif
#if OPT_RENDERFONT || OPT_WIDE_CHARS
fontMenu_line2,
@@ -470,6 +474,15 @@
#define FS2MI(n) (n) /* font_size_to_menu_item */
#define MI2FS(n) (n) /* menu_item_to_font_size */
+#if OPT_WIDE_CHARS
+#define update_font_multibyte() \
+ UpdateMenuItem (fontMenuEntries, \
+ fontMenu_font_multibyte, \
+ term->screen.font_multibyte)
+#else
+#define update_font_multibyte() /* nothing */
+#endif
+
#if OPT_TEK4014
extern void set_tekfont_menu_item(int n,int val);
#else
diff -dPNur xterm-243/ptyx.h xterm-243-sm/ptyx.h
--- xterm-243/ptyx.h 2009-03-24 23:20:06.000000000 +0100
+++ xterm-243-sm/ptyx.h 2009-06-14 05:59:38.000000000 +0200
@@ -1358,6 +1358,7 @@
int unicode_font; /* font uses unicode encoding */
int utf_count; /* state of utf_char */
IChar utf_char; /* in-progress character */
+ int font_multibyte; /* is UTF mode switched on */
int last_written_col;
int last_written_row;
XChar2b *draw_buf; /* drawXtermText() data */
|