summaryrefslogtreecommitdiffstats
path: root/x11-terms/xterm/files/xterm-ds-sm.patch
blob: 12c125891cf9a25c02618be11a70c42fd59503a5 (plain)
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
diff -dPNur xterm-207-new/menu.c xterm-207/menu.c
--- xterm-207-new/menu.c	2005-11-13 23:10:36.000000000 +0000
+++ xterm-207/menu.c	2005-12-26 13:58:51.000000000 +0000
@@ -175,6 +175,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
@@ -339,6 +343,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 },
 #endif
 #endif /* toggles for other font extensions */
@@ -683,6 +688,15 @@
 #if OPT_WIDE_CHARS
 	    update_font_utf8_mode();
 #endif
+#if OPT_WIDE_CHARS
+	    if ((term->screen.utf8_mode==2)||(!term->screen.wide_chars)) {
+		set_sensitivity(mw,
+				fontMenuEntries[fontMenu_font_multibyte].widget,
+				False);
+	    } else {
+		update_font_multibyte();
+	    }
+#endif
 	}
 	FindFontSelection(NULL, True);
 	set_sensitivity(mw,
@@ -1423,6 +1437,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
  */
@@ -2054,6 +2085,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-207-new/menu.h xterm-207/menu.h
--- xterm-207-new/menu.h	2005-11-03 13:17:28.000000000 +0000
+++ xterm-207/menu.h	2005-12-26 13:58:51.000000000 +0000
@@ -87,6 +87,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;
@@ -252,6 +253,9 @@
     fontMenu_font_loadable,
 #endif
 #endif
+#if OPT_WIDE_CHARS
+    fontMenu_font_multibyte,
+#endif
 
 #if OPT_RENDERFONT || OPT_WIDE_CHARS
     fontMenu_line2,
@@ -430,6 +434,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() \
+  update_menu_item (term->screen.fontMenu, \
+		    fontMenuEntries[fontMenu_font_multibyte].widget, \
+		    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-207-new/ptyx.h xterm-207/ptyx.h
--- xterm-207-new/ptyx.h	2005-11-03 13:17:28.000000000 +0000
+++ xterm-207/ptyx.h	2005-12-26 13:59:17.000000000 +0000
@@ -1237,6 +1237,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;
 #endif