]>
Commit | Line | Data |
---|---|---|
862f9807 | 1 | diff -x '*~' -Nru dfbiterm-0.1/src/keyboard.c dfbiterm-0.1.new/src/keyboard.c |
2 | --- dfbiterm-0.1/src/keyboard.c 2006-02-11 18:32:14.000000000 +0100 | |
3 | +++ dfbiterm-0.1.new/src/keyboard.c 2006-02-14 15:30:42.849133000 +0100 | |
4 | @@ -5,8 +5,8 @@ | |
5 | #include "dfbiterm.h" | |
6 | #include <directfb.h> | |
7 | ||
8 | -/* remapping table for function keys 5-12 */ | |
9 | -static const unsigned char f5_f12_remap[] = {15,17,18,19,20,21,23,24}; | |
10 | +/* remapping table for function keys 1-12 */ | |
11 | +static const unsigned char f1_f12_remap[] = {11,12,13,14,15,17,18,19,20,21,23,24}; | |
12 | ||
13 | void | |
14 | term_handle_key(DFBWindowEvent *evt) | |
15 | @@ -46,11 +46,15 @@ | |
16 | case '-': | |
17 | write(pIterm->fd, "\037", 1); | |
18 | break; | |
19 | + case '\r': | |
20 | + write(pIterm->fd, "\033\r", 2); | |
21 | + break; | |
22 | default: | |
23 | write(pIterm->fd, &c, 1); | |
24 | break; | |
25 | } | |
26 | - } | |
27 | + } else if ((evt->modifiers & DIMM_ALT) && evt->key_symbol == '\r') | |
28 | + write(pIterm->fd, "\033\r", 2); | |
29 | else | |
30 | write(pIterm->fd, &c, 1); | |
31 | } | |
32 | @@ -94,10 +98,10 @@ | |
33 | } | |
34 | break; | |
35 | case DIKS_HOME: | |
36 | - write(pIterm->fd, "\033OH", 3); | |
37 | + write(pIterm->fd, "\033[1~", 4); | |
38 | break; | |
39 | case DIKS_END: | |
40 | - write(pIterm->fd, "\033OF", 3); | |
41 | + write(pIterm->fd, "\033[4~", 4); | |
42 | break; | |
43 | case DIKS_PAGE_UP: | |
44 | if (evt->modifiers & DIMM_SHIFT) { | |
45 | @@ -113,23 +117,11 @@ | |
46 | } else | |
47 | write(pIterm->fd, "\033[6~", 4); | |
48 | break; | |
49 | - case DIKS_F1: | |
50 | - write(pIterm->fd, "\033OP", 3); | |
51 | - break; | |
52 | - case DIKS_F2: | |
53 | - write(pIterm->fd, "\033OQ", 3); | |
54 | - break; | |
55 | - case DIKS_F3: | |
56 | - write(pIterm->fd, "\033OR", 3); | |
57 | - break; | |
58 | - case DIKS_F4: | |
59 | - write(pIterm->fd, "\033OS", 3); | |
60 | - break; | |
61 | - case DIKS_F5 ... DIKS_F12: | |
62 | + case DIKS_F1 ... DIKS_F12: | |
63 | { | |
64 | char buf[6]; | |
65 | ||
66 | - sprintf (buf, "\033[%d~", f5_f12_remap[evt->key_symbol - DIKS_F5]); | |
67 | + sprintf (buf, "\033[%d~", f1_f12_remap[evt->key_symbol - DIKS_F1]); | |
68 | write(pIterm->fd, buf, strlen(buf)); | |
69 | } | |
70 | break; | |
71 | diff -x '*~' -Nru dfbiterm-0.1/src/vt.c dfbiterm-0.1.new/src/vt.c | |
72 | --- dfbiterm-0.1/src/vt.c 2006-02-11 18:31:53.000000000 +0100 | |
73 | +++ dfbiterm-0.1.new/src/vt.c 2006-02-14 14:35:19.035163250 +0100 | |
74 | @@ -12,7 +12,7 @@ | |
75 | char *shell; | |
76 | char *program[] = { defaultShell, NULL }; | |
77 | ||
78 | - putenv("TERM=xterm"); | |
79 | + putenv("TERM=iterm"); | |
80 | shell = getenv ("SHELL"); | |
81 | if (shell != NULL && shell[0] != '\0') | |
82 | program[0] = shell; | |
83 | diff -x '*~' -Nru dfbiterm-0.1/src/VTScreenView.c dfbiterm-0.1.new/src/VTScreenView.c | |
84 | --- dfbiterm-0.1/src/VTScreenView.c 2006-02-11 18:25:02.000000000 +0100 | |
85 | +++ dfbiterm-0.1.new/src/VTScreenView.c 2006-02-14 14:34:27.647951750 +0100 | |
86 | @@ -10,18 +10,28 @@ | |
87 | VTScreenView_draw_text(VTScreenView * view, int col, int row, | |
88 | unsigned char *mbstring, int length, int width) | |
89 | { | |
90 | - int x, y, h, w, i; | |
91 | + int x, y, h, w, i, xs, foreground, background; | |
92 | ||
93 | if (pIterm->lock) return; | |
94 | ||
95 | - x = col * pIterm->cell_width; | |
96 | + xs = x = col * pIterm->cell_width; | |
97 | y = row * pIterm->cell_height; | |
98 | w = pIterm->cell_width * width; | |
99 | h = pIterm->cell_height; | |
100 | ||
101 | - pIterm->surface->SetColor(pIterm->surface, red[pIterm->background], green[pIterm->background], blue[pIterm->background], 0xff); | |
102 | + foreground = pIterm->foreground; | |
103 | + background = pIterm->background; | |
104 | + | |
105 | + if (pIterm->indexed) | |
106 | + pIterm->surface->SetColorIndex(pIterm->surface, background); | |
107 | + else | |
108 | + pIterm->surface->SetColor(pIterm->surface, red[background], green[background], blue[background], 0xff); | |
109 | pIterm->surface->FillRectangle(pIterm->surface, x, y, w, h); | |
110 | - pIterm->surface->SetColor(pIterm->surface, red[pIterm->foreground], green[pIterm->foreground], blue[pIterm->foreground], 0xff); | |
111 | + | |
112 | + if (pIterm->indexed) | |
113 | + pIterm->surface->SetColorIndex(pIterm->surface, foreground); | |
114 | + else | |
115 | + pIterm->surface->SetColor(pIterm->surface, red[foreground], green[foreground], blue[foreground], 0xff); | |
116 | if (pIterm->charset == SPECIAL_GRAPHICS) { | |
117 | for (i = 0; i < length; i++) { | |
118 | if (0x5E <mbstring[i] && mbstring[i] < 0x7F) { | |
119 | @@ -38,6 +48,7 @@ | |
120 | pIterm->surface->DrawGlyph(pIterm->surface, indeks, x, y, DSTF_TOPLEFT); | |
121 | x += pIterm->cell_width; | |
122 | } | |
123 | + if (pIterm->underline) pIterm->surface->DrawLine(pIterm->surface, xs, y + pIterm->cell_height - 1, x - 1, y + pIterm->cell_height - 1); | |
124 | } | |
125 | ||
126 | static void | |
127 | @@ -52,68 +63,20 @@ | |
128 | w = (e_col - s_col) * pIterm->cell_width; | |
129 | h = (e_row - s_row) * pIterm->cell_height; | |
130 | ||
131 | - pIterm->surface->SetColor(pIterm->surface, red[pIterm->background], green[pIterm->background], blue[pIterm->background], 0xff); | |
132 | + if (pIterm->indexed) | |
133 | + pIterm->surface->SetColorIndex(pIterm->surface, 0); | |
134 | + else | |
135 | + pIterm->surface->SetColor(pIterm->surface, red[0], green[0], blue[0], 0xff); | |
136 | pIterm->surface->FillRectangle(pIterm->surface, x, y, w, h); | |
137 | } | |
138 | ||
139 | static void | |
140 | -VTScreenView_draw_text8(VTScreenView * view, int col, int row, | |
141 | - unsigned char *mbstring, int length, int width) | |
142 | -{ | |
143 | - int x, y, w, i, h; | |
144 | - | |
145 | - if (pIterm->lock) return; | |
146 | - | |
147 | - x = col * pIterm->cell_width; | |
148 | - y = row * pIterm->cell_height; | |
149 | - w = pIterm->cell_width * width; | |
150 | - h = pIterm->cell_height; | |
151 | - | |
152 | - if (pIterm->charset == SPECIAL_GRAPHICS) { | |
153 | - for (i = 0; i < length; i++) { | |
154 | - if (0x5E <mbstring[i] && mbstring[i] < 0x7F) { | |
155 | - mbstring[i] = ((mbstring[i]==0x5F)? 0x7F : mbstring[i]-0x5F); | |
156 | - } | |
157 | - } | |
158 | - } | |
159 | - pIterm->surface->SetColorIndex(pIterm->surface, pIterm->background); | |
160 | - pIterm->surface->FillRectangle(pIterm->surface, x, y, w, h); | |
161 | - pIterm->surface->SetColorIndex(pIterm->surface, pIterm->foreground); | |
162 | - for (i = 0; i < length; i++) { | |
163 | - unsigned int indeks = mbstring[i]; | |
164 | - | |
165 | - if (indeks > 0x7f) { | |
166 | - indeks = btowc(indeks); | |
167 | - } | |
168 | - pIterm->surface->DrawGlyph(pIterm->surface, indeks, x, y, DSTF_TOPLEFT); | |
169 | - x += pIterm->cell_width; | |
170 | - } | |
171 | -} | |
172 | - | |
173 | -static void | |
174 | -VTScreenView_clear_rect8(VTScreenView * view, int s_col, int s_row, | |
175 | - int e_col, int e_row) | |
176 | -{ | |
177 | - int x, y, w, h; | |
178 | - if (pIterm->lock) return; | |
179 | - | |
180 | - x = s_col * pIterm->cell_width; | |
181 | - y = s_row * pIterm->cell_height; | |
182 | - w = (e_col - s_col) * pIterm->cell_width; | |
183 | - h = (e_row - s_row) * pIterm->cell_height; | |
184 | - | |
185 | - pIterm->surface->SetColorIndex(pIterm->surface, pIterm->background); | |
186 | - pIterm->surface->FillRectangle(pIterm->surface, x, y, w, h); | |
187 | -} | |
188 | - | |
189 | -static void | |
190 | VTScreenView_set_rendition (VTScreenView * view, int bold, int blink, | |
191 | int inverse, int underline, | |
192 | int foreground, int background, char charset) | |
193 | { | |
194 | -/* pIterm->fb->set_rendition (bold, blink, inverse, underline, foreground, | |
195 | - background, charset); */ | |
196 | if (pIterm->lock) return; | |
197 | + | |
198 | if (!background && !foreground) { | |
199 | foreground = 7; | |
200 | } | |
201 | @@ -171,14 +134,10 @@ | |
202 | } | |
203 | ||
204 | VTScreenView_init(view); | |
205 | - if (pIterm->indexed) { | |
206 | - set_palette(); | |
207 | - view->draw_text = VTScreenView_draw_text8; | |
208 | - view->clear_rect = VTScreenView_clear_rect8; | |
209 | - } else { | |
210 | - view->draw_text = VTScreenView_draw_text; | |
211 | - view->clear_rect = VTScreenView_clear_rect; | |
212 | - } | |
213 | + if (pIterm->indexed) set_palette(); | |
214 | + pIterm->foreground = 7; | |
215 | + view->draw_text = VTScreenView_draw_text; | |
216 | + view->clear_rect = VTScreenView_clear_rect; | |
217 | view->set_rendition = VTScreenView_set_rendition; | |
218 | view->scroll_view = VTScreenView_scroll_view; | |
219 | return view; |