comparison src/redisplay-x.c @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 8b8b7f3559a2
children 48d667d6f17f
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
45 #include "window.h" 45 #include "window.h"
46 #include <X11/bitmaps/gray> 46 #include <X11/bitmaps/gray>
47 47
48 #include "sysproc.h" /* for select() */ 48 #include "sysproc.h" /* for select() */
49 49
50 #ifdef MULE
51 #include "mule-coding.h" /* for CCL conversion */
52 #endif
50 53
51 /* X_DIVIDER_LINE_WIDTH is the width of the line drawn in the gutter. 54 /* X_DIVIDER_LINE_WIDTH is the width of the line drawn in the gutter.
52 X_DIVIDER_SPACING is the amount of blank space on each side of the line. 55 X_DIVIDER_SPACING is the amount of blank space on each side of the line.
53 X_DIVIDER_WIDTH = X_DIVIDER_LINE_WIDTH + 2*X_DIVIDER_SPACING 56 X_DIVIDER_WIDTH = X_DIVIDER_LINE_WIDTH + 2*X_DIVIDER_SPACING
54 */ 57 */
142 Lisp_Object prev_charset = Qunbound; /* not Qnil because that is a 145 Lisp_Object prev_charset = Qunbound; /* not Qnil because that is a
143 possible valid charset when 146 possible valid charset when
144 MULE is not defined */ 147 MULE is not defined */
145 int runs_so_far = 0; 148 int runs_so_far = 0;
146 int i; 149 int i;
150 #ifdef MULE
151 struct ccl_program char_converter;
152 int need_ccl_conversion = 0;
153 #endif
147 154
148 for (i = 0; i < len; i++) 155 for (i = 0; i < len; i++)
149 { 156 {
150 Emchar ch = str[i]; 157 Emchar ch = str[i];
151 Lisp_Object charset; 158 Lisp_Object charset;
170 if (run_storage[runs_so_far - 1].dimension == 2) 177 if (run_storage[runs_so_far - 1].dimension == 2)
171 run_storage[runs_so_far - 1].len >>= 1; 178 run_storage[runs_so_far - 1].len >>= 1;
172 } 179 }
173 runs_so_far++; 180 runs_so_far++;
174 prev_charset = charset; 181 prev_charset = charset;
182 #ifdef MULE
183 {
184 Lisp_Object ccl_prog = XCHARSET_CCL_PROGRAM (charset);
185 need_ccl_conversion = !NILP (ccl_prog);
186 if (need_ccl_conversion)
187 set_ccl_program (&char_converter, ccl_prog, 0, 0, 0);
188 }
189 #endif
175 } 190 }
176 191
177 if (graphic == 0) 192 if (graphic == 0)
178 { 193 {
179 byte1 &= 0x7F; 194 byte1 &= 0x7F;
182 else if (graphic == 1) 197 else if (graphic == 1)
183 { 198 {
184 byte1 |= 0x80; 199 byte1 |= 0x80;
185 byte2 |= 0x80; 200 byte2 |= 0x80;
186 } 201 }
202 #ifdef MULE
203 if (need_ccl_conversion)
204 {
205 char_converter.reg[0] = byte1;
206 char_converter.reg[1] = byte2;
207 char_converter.ic = 0; /* start at beginning each time */
208 ccl_driver (&char_converter, 0, 0, 0, 0);
209 byte1 = char_converter.reg[0];
210 byte2 = char_converter.reg[1];
211 }
212 #endif
187 *text_storage++ = (unsigned char) byte1; 213 *text_storage++ = (unsigned char) byte1;
188 if (dimension == 2) 214 if (dimension == 2)
189 *text_storage++ = (unsigned char) byte2; 215 *text_storage++ = (unsigned char) byte2;
190 } 216 }
191 217
825 may cause the cache to resize and any pointers to it to 851 may cause the cache to resize and any pointers to it to
826 become invalid. */ 852 become invalid. */
827 cachel = WINDOW_FACE_CACHEL (w, findex); 853 cachel = WINDOW_FACE_CACHEL (w, findex);
828 } 854 }
829 855
856 #ifdef HAVE_XIM
857 if (cursor && focus && (cursor_start == clip_start) && cursor_height)
858 XIM_SetSpotLocation (f, xpos - 2, dl->ypos + dl->descent - 2);
859 #endif /* HAVE_XIM */
830 860
831 bg_pmap = cachel->background_pixmap; 861 bg_pmap = cachel->background_pixmap;
832 if (!IMAGE_INSTANCEP (bg_pmap) 862 if (!IMAGE_INSTANCEP (bg_pmap)
833 || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap))) 863 || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
834 bg_pmap = Qnil; 864 bg_pmap = Qnil;
1118 Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f)); 1148 Window x_win = XtWindow (FRAME_X_TEXT_WIDGET (f));
1119 1149
1120 GC gc; 1150 GC gc;
1121 XGCValues gcv; 1151 XGCValues gcv;
1122 unsigned long pixmap_mask; 1152 unsigned long pixmap_mask;
1123 int need_clipping = (clip_x || clip_y);
1124 1153
1125 if (!override_gc) 1154 if (!override_gc)
1126 { 1155 {
1127 memset (&gcv, ~0, sizeof (XGCValues)); 1156 memset (&gcv, ~0, sizeof (XGCValues));
1128 gcv.graphics_exposures = False; 1157 gcv.graphics_exposures = False;
1136 gcv.clip_mask = IMAGE_INSTANCE_X_MASK (p); 1165 gcv.clip_mask = IMAGE_INSTANCE_X_MASK (p);
1137 gcv.clip_x_origin = x; 1166 gcv.clip_x_origin = x;
1138 gcv.clip_y_origin = y - pixmap_offset; 1167 gcv.clip_y_origin = y - pixmap_offset;
1139 pixmap_mask |= (GCFunction | GCClipMask | GCClipXOrigin | 1168 pixmap_mask |= (GCFunction | GCClipMask | GCClipXOrigin |
1140 GCClipYOrigin); 1169 GCClipYOrigin);
1141 /* Can't set a clip rectangle below because we already have a mask.
1142 We could conceivably create a new clipmask by zeroing out
1143 everything outside the clip region. Is it worth it?
1144 Is it possible to get an equivalent effect by changing the
1145 args to XCopyArea below rather than messing with a clip box?
1146 - dkindred@cs.cmu.edu */
1147 need_clipping = 0;
1148 } 1170 }
1149 1171
1150 gc = gc_cache_lookup (DEVICE_X_GC_CACHE (d), &gcv, pixmap_mask); 1172 gc = gc_cache_lookup (DEVICE_X_GC_CACHE (d), &gcv, pixmap_mask);
1151 } 1173 }
1152 else 1174 else
1153 { 1175 gc = override_gc;
1154 gc = override_gc; 1176
1155 /* override_gc might have a mask already--we don't want to nuke it. 1177 if (clip_x || clip_y)
1156 Maybe we can insist that override_gc have no mask, or use
1157 one of the suggestions above. */
1158 need_clipping = 0;
1159 }
1160
1161 if (need_clipping)
1162 { 1178 {
1163 XRectangle clip_box[1]; 1179 XRectangle clip_box[1];
1164 1180
1165 clip_box[0].x = clip_x; 1181 clip_box[0].x = clip_x;
1166 clip_box[0].y = clip_y; 1182 clip_box[0].y = clip_y;
1191 ? y - pixmap_offset 1207 ? y - pixmap_offset
1192 : y), 1208 : y),
1193 1L); 1209 1L);
1194 } 1210 }
1195 1211
1196 if (need_clipping) 1212 if (clip_x || clip_y)
1197 { 1213 {
1198 XSetClipMask (dpy, gc, None); 1214 XSetClipMask (dpy, gc, None);
1199 XSetClipOrigin (dpy, gc, 0, 0); 1215 XSetClipOrigin (dpy, gc, 0, 0);
1200 } 1216 }
1201 } 1217 }
2061 2077
2062 XSETWINDOW (window, w); 2078 XSETWINDOW (window, w);
2063 default_face_font_info (window, &defascent, 0, &defheight, 0, 0); 2079 default_face_font_info (window, &defascent, 0, &defheight, 0, 0);
2064 } 2080 }
2065 2081
2066 /* make sure the cursor is entirely contained between y and y+height */ 2082 cursor_y = dl->ypos - defascent;
2067 cursor_height = min (defheight, height); 2083 if (cursor_y < y)
2068 cursor_y = max (y, min (y + height - cursor_height, 2084 cursor_y = y;
2069 dl->ypos - defascent)); 2085 cursor_height = defheight;
2086 if (cursor_y + cursor_height > y + height)
2087 cursor_height = y + height - cursor_y;
2070 2088
2071 if (focus) 2089 if (focus)
2072 { 2090 {
2091 #ifdef HAVE_XIM
2092 XIM_SetSpotLocation (f, x - 2 , cursor_y + cursor_height - 2);
2093 #endif /* HAVE_XIM */
2073 2094
2074 if (NILP (bar_cursor_value)) 2095 if (NILP (bar_cursor_value))
2075 { 2096 {
2076 XFillRectangle (dpy, x_win, gc, x, cursor_y, width, cursor_height); 2097 XFillRectangle (dpy, x_win, gc, x, cursor_y, width, cursor_height);
2077 } 2098 }