202 |
|
|
203 |
/* If a string, XTread_socket generates an event to display that string. |
/* If a string, XTread_socket generates an event to display that string. |
204 |
(The display is done in read_char.) */ |
(The display is done in read_char.) */ |
205 |
|
|
206 |
static Lisp_Object help_echo; |
static Lisp_Object help_echo; |
207 |
static Lisp_Object help_echo_window; |
static Lisp_Object help_echo_window; |
208 |
static Lisp_Object help_echo_object; |
static Lisp_Object help_echo_object; |
259 |
|
|
260 |
struct frame *pending_autoraise_frame; |
struct frame *pending_autoraise_frame; |
261 |
|
|
262 |
/* Nominal cursor position -- where to draw output. |
/* Nominal cursor position -- where to draw output. |
263 |
HPOS and VPOS are window relative glyph matrix coordinates. |
HPOS and VPOS are window relative glyph matrix coordinates. |
264 |
X and Y are window relative pixel coordinates. */ |
X and Y are window relative pixel coordinates. */ |
265 |
|
|
456 |
static void x_update_window_cursor P_ ((struct window *, int)); |
static void x_update_window_cursor P_ ((struct window *, int)); |
457 |
static void x_erase_phys_cursor P_ ((struct window *)); |
static void x_erase_phys_cursor P_ ((struct window *)); |
458 |
void x_display_and_set_cursor P_ ((struct window *, int, int, int, int, int)); |
void x_display_and_set_cursor P_ ((struct window *, int, int, int, int, int)); |
459 |
static void x_draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, |
static void x_draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, |
460 |
enum fringe_bitmap_type, int left_p)); |
enum fringe_bitmap_type, int left_p)); |
461 |
static void x_clip_to_row P_ ((struct window *, struct glyph_row *, |
static void x_clip_to_row P_ ((struct window *, struct glyph_row *, |
462 |
GC, int)); |
GC, int)); |
505 |
Pixmap pixmap; |
Pixmap pixmap; |
506 |
{ |
{ |
507 |
PixMap *p = (PixMap *) pixmap; |
PixMap *p = (PixMap *) pixmap; |
508 |
|
|
509 |
xfree (p->baseAddr); |
xfree (p->baseAddr); |
510 |
xfree (p); |
xfree (p); |
511 |
} |
} |
518 |
mac_set_forecolor (unsigned long color) |
mac_set_forecolor (unsigned long color) |
519 |
{ |
{ |
520 |
RGBColor fg_color; |
RGBColor fg_color; |
521 |
|
|
522 |
fg_color.red = RED_FROM_ULONG (color) * 256; |
fg_color.red = RED_FROM_ULONG (color) * 256; |
523 |
fg_color.green = GREEN_FROM_ULONG (color) * 256; |
fg_color.green = GREEN_FROM_ULONG (color) * 256; |
524 |
fg_color.blue = BLUE_FROM_ULONG (color) * 256; |
fg_color.blue = BLUE_FROM_ULONG (color) * 256; |
525 |
|
|
526 |
RGBForeColor (&fg_color); |
RGBForeColor (&fg_color); |
527 |
} |
} |
528 |
|
|
529 |
|
|
534 |
mac_set_backcolor (unsigned long color) |
mac_set_backcolor (unsigned long color) |
535 |
{ |
{ |
536 |
RGBColor bg_color; |
RGBColor bg_color; |
537 |
|
|
538 |
bg_color.red = RED_FROM_ULONG (color) * 256; |
bg_color.red = RED_FROM_ULONG (color) * 256; |
539 |
bg_color.green = GREEN_FROM_ULONG (color) * 256; |
bg_color.green = GREEN_FROM_ULONG (color) * 256; |
540 |
bg_color.blue = BLUE_FROM_ULONG (color) * 256; |
bg_color.blue = BLUE_FROM_ULONG (color) * 256; |
541 |
|
|
542 |
RGBBackColor (&bg_color); |
RGBBackColor (&bg_color); |
543 |
} |
} |
544 |
|
|
545 |
/* Set foreground and background color for subsequent QuickDraw |
/* Set foreground and background color for subsequent QuickDraw |
626 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
627 |
{ |
{ |
628 |
Rect r; |
Rect r; |
629 |
|
|
630 |
GetWindowPortBounds (w, &r); |
GetWindowPortBounds (w, &r); |
631 |
EraseRect (&r); |
EraseRect (&r); |
632 |
} |
} |
667 |
UnlockPortBits (GetWindowPort (w)); |
UnlockPortBits (GetWindowPort (w)); |
668 |
} |
} |
669 |
#else /* not TARGET_API_MAC_CARBON */ |
#else /* not TARGET_API_MAC_CARBON */ |
670 |
CopyBits (bitmap, &(w->portBits), &(bitmap->bounds), &r, srcCopy, 0); |
CopyBits (bitmap, &(w->portBits), &(bitmap->bounds), &r, srcCopy, 0); |
671 |
#endif /* not TARGET_API_MAC_CARBON */ |
#endif /* not TARGET_API_MAC_CARBON */ |
672 |
} |
} |
673 |
|
|
698 |
WindowPtr w; |
WindowPtr w; |
699 |
{ |
{ |
700 |
Rect r; |
Rect r; |
701 |
|
|
702 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
703 |
SetPort (GetWindowPort (w)); |
SetPort (GetWindowPort (w)); |
704 |
#else |
#else |
957 |
local_to_global_coord (short *h, short *v) |
local_to_global_coord (short *h, short *v) |
958 |
{ |
{ |
959 |
Point p; |
Point p; |
960 |
|
|
961 |
p.h = *h; |
p.h = *h; |
962 |
p.v = *v; |
p.v = *v; |
963 |
|
|
964 |
LocalToGlobal (&p); |
LocalToGlobal (&p); |
965 |
|
|
966 |
*h = p.h; |
*h = p.h; |
967 |
*v = p.v; |
*v = p.v; |
968 |
} |
} |
1023 |
ForeColor (blackColor); |
ForeColor (blackColor); |
1024 |
BackColor (whiteColor); |
BackColor (whiteColor); |
1025 |
CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0); |
CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0); |
1026 |
|
|
1027 |
mac_set_colors (gc); |
mac_set_colors (gc); |
1028 |
#endif |
#endif |
1029 |
#endif /* not TARGET_API_MAC_CARBON */ |
#endif /* not TARGET_API_MAC_CARBON */ |
1033 |
/* Mac replacement for XCopyArea: dest must be Pixmap. */ |
/* Mac replacement for XCopyArea: dest must be Pixmap. */ |
1034 |
|
|
1035 |
static void |
static void |
1036 |
mac_copy_area_to_pixmap (display, src, dest, gc, src_x, src_y, width, height, |
mac_copy_area_to_pixmap (display, src, dest, gc, src_x, src_y, width, height, |
1037 |
dest_x, dest_y) |
dest_x, dest_y) |
1038 |
Display *display; |
Display *display; |
1039 |
Pixmap src; |
Pixmap src; |
1050 |
int h = src_bottom - src_y; |
int h = src_bottom - src_y; |
1051 |
|
|
1052 |
mac_set_colors (gc); |
mac_set_colors (gc); |
1053 |
|
|
1054 |
SetRect (&src_r, src_x, src_y, src_right, src_bottom); |
SetRect (&src_r, src_x, src_y, src_right, src_bottom); |
1055 |
SetRect (&dest_r, dest_x, dest_y, dest_x + w, dest_y + h); |
SetRect (&dest_r, dest_x, dest_y, dest_x + w, dest_y + h); |
1056 |
|
|
1160 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
1161 |
#define XFlush(DISPLAY) QDFlushPortBuffer (GetQDGlobalsThePort (), NULL) |
#define XFlush(DISPLAY) QDFlushPortBuffer (GetQDGlobalsThePort (), NULL) |
1162 |
#else |
#else |
1163 |
#define XFlush(DISPLAY) (void) 0 |
#define XFlush(DISPLAY) (void) 0 |
1164 |
#endif |
#endif |
1165 |
|
|
1166 |
/* Flush display of frame F, or of all frames if F is null. */ |
/* Flush display of frame F, or of all frames if F is null. */ |
1200 |
/*********************************************************************** |
/*********************************************************************** |
1201 |
Starting and ending an update |
Starting and ending an update |
1202 |
***********************************************************************/ |
***********************************************************************/ |
1203 |
|
|
1204 |
/* Start an update of frame F. This function is installed as a hook |
/* Start an update of frame F. This function is installed as a hook |
1205 |
for update_begin, i.e. it is called when update_begin is called. |
for update_begin, i.e. it is called when update_begin is called. |
1206 |
This function is called prior to calls to x_update_window_begin for |
This function is called prior to calls to x_update_window_begin for |
1224 |
{ |
{ |
1225 |
struct frame *f = XFRAME (WINDOW_FRAME (w)); |
struct frame *f = XFRAME (WINDOW_FRAME (w)); |
1226 |
struct mac_display_info *display_info = FRAME_MAC_DISPLAY_INFO (f); |
struct mac_display_info *display_info = FRAME_MAC_DISPLAY_INFO (f); |
1227 |
|
|
1228 |
updated_window = w; |
updated_window = w; |
1229 |
set_output_cursor (&w->cursor); |
set_output_cursor (&w->cursor); |
1230 |
|
|
1246 |
flag set. So, rows containing mouse-face glyphs are never |
flag set. So, rows containing mouse-face glyphs are never |
1247 |
scrolled, and we don't have to switch the mouse highlight off |
scrolled, and we don't have to switch the mouse highlight off |
1248 |
here to prevent it from being scrolled. */ |
here to prevent it from being scrolled. */ |
1249 |
|
|
1250 |
/* Can we tell that this update does not affect the window |
/* Can we tell that this update does not affect the window |
1251 |
where the mouse highlight is? If so, no need to turn off. |
where the mouse highlight is? If so, no need to turn off. |
1252 |
Likewise, don't do anything if the frame is garbaged; |
Likewise, don't do anything if the frame is garbaged; |
1279 |
struct window *w; |
struct window *w; |
1280 |
{ |
{ |
1281 |
struct frame *f = XFRAME (WINDOW_FRAME (w)); |
struct frame *f = XFRAME (WINDOW_FRAME (w)); |
1282 |
|
|
1283 |
/* Redraw borders between horizontally adjacent windows. Don't |
/* Redraw borders between horizontally adjacent windows. Don't |
1284 |
do it for frames with vertical scroll bars because either the |
do it for frames with vertical scroll bars because either the |
1285 |
right scroll bar of a window, or the left scroll bar of its |
right scroll bar of a window, or the left scroll bar of its |
1292 |
window_box_edges (w, -1, &x0, &y0, &x1, &y1); |
window_box_edges (w, -1, &x0, &y0, &x1, &y1); |
1293 |
x1 += FRAME_X_RIGHT_FRINGE_WIDTH (f); |
x1 += FRAME_X_RIGHT_FRINGE_WIDTH (f); |
1294 |
y1 -= 1; |
y1 -= 1; |
1295 |
|
|
1296 |
XDrawLine (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), |
XDrawLine (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), |
1297 |
f->output_data.mac->normal_gc, x1, y0, x1, y1); |
f->output_data.mac->normal_gc, x1, y0, x1, y1); |
1298 |
} |
} |
1299 |
} |
} |
1300 |
|
|
1301 |
|
|
1302 |
/* End update of window W (which is equal to updated_window). |
/* End update of window W (which is equal to updated_window). |
1303 |
|
|
1304 |
Draw vertical borders between horizontally adjacent windows, and |
Draw vertical borders between horizontally adjacent windows, and |
1328 |
x_display_and_set_cursor (w, 1, output_cursor.hpos, |
x_display_and_set_cursor (w, 1, output_cursor.hpos, |
1329 |
output_cursor.vpos, |
output_cursor.vpos, |
1330 |
output_cursor.x, output_cursor.y); |
output_cursor.x, output_cursor.y); |
1331 |
|
|
1332 |
x_draw_vertical_border (w); |
x_draw_vertical_border (w); |
1333 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
1334 |
} |
} |
1371 |
#endif |
#endif |
1372 |
|
|
1373 |
mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f)); |
mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f)); |
1374 |
|
|
1375 |
/* Mouse highlight may be displayed again. */ |
/* Mouse highlight may be displayed again. */ |
1376 |
FRAME_MAC_DISPLAY_INFO (f)->mouse_face_defer = 0; |
FRAME_MAC_DISPLAY_INFO (f)->mouse_face_defer = 0; |
1377 |
|
|
1424 |
int width, height; |
int width, height; |
1425 |
|
|
1426 |
xassert (w); |
xassert (w); |
1427 |
|
|
1428 |
if (!desired_row->mode_line_p && !w->pseudo_window_p) |
if (!desired_row->mode_line_p && !w->pseudo_window_p) |
1429 |
{ |
{ |
1430 |
BLOCK_INPUT; |
BLOCK_INPUT; |
1459 |
XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), |
XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), |
1460 |
f->output_data.mac->pixel_width - width, y, |
f->output_data.mac->pixel_width - width, y, |
1461 |
width, height, 0); |
width, height, 0); |
1462 |
|
|
1463 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
1464 |
} |
} |
1465 |
} |
} |
1506 |
h = left_height; |
h = left_height; |
1507 |
bits = left_bits; |
bits = left_bits; |
1508 |
break; |
break; |
1509 |
|
|
1510 |
case OVERLAY_ARROW_BITMAP: |
case OVERLAY_ARROW_BITMAP: |
1511 |
wd = ov_width; |
wd = ov_width; |
1512 |
h = ov_height; |
h = ov_height; |
1513 |
bits = ov_bits; |
bits = ov_bits; |
1514 |
break; |
break; |
1515 |
|
|
1516 |
case RIGHT_TRUNCATION_BITMAP: |
case RIGHT_TRUNCATION_BITMAP: |
1517 |
wd = right_width; |
wd = right_width; |
1518 |
h = right_height; |
h = right_height; |
1524 |
h = continued_height; |
h = continued_height; |
1525 |
bits = continued_bits; |
bits = continued_bits; |
1526 |
break; |
break; |
1527 |
|
|
1528 |
case CONTINUATION_LINE_BITMAP: |
case CONTINUATION_LINE_BITMAP: |
1529 |
wd = continuation_width; |
wd = continuation_width; |
1530 |
h = continuation_height; |
h = continuation_height; |
1731 |
|
|
1732 |
HPOS and VPOS are column/row positions in a window glyph matrix. X |
HPOS and VPOS are column/row positions in a window glyph matrix. X |
1733 |
and Y are window text area relative pixel positions. |
and Y are window text area relative pixel positions. |
1734 |
|
|
1735 |
If this is done during an update, updated_window will contain the |
If this is done during an update, updated_window will contain the |
1736 |
window that is being updated and the position is the future output |
window that is being updated and the position is the future output |
1737 |
cursor position for that window. If updated_window is null, use |
cursor position for that window. If updated_window is null, use |
1905 |
ccl->reg[1] = char2b->byte1; |
ccl->reg[1] = char2b->byte1; |
1906 |
ccl->reg[2] = char2b->byte2; |
ccl->reg[2] = char2b->byte2; |
1907 |
} |
} |
1908 |
|
|
1909 |
ccl_driver (ccl, NULL, NULL, 0, 0, NULL); |
ccl_driver (ccl, NULL, NULL, 0, 0, NULL); |
1910 |
|
|
1911 |
/* We assume that MSBs are appropriately set/reset by CCL |
/* We assume that MSBs are appropriately set/reset by CCL |
1912 |
program. */ |
program. */ |
1913 |
if (font->max_byte1 == 0) /* 1-byte font */ |
if (font->max_byte1 == 0) /* 1-byte font */ |
1920 |
/* Fixed encoding scheme. See fontset.h for the meaning of the |
/* Fixed encoding scheme. See fontset.h for the meaning of the |
1921 |
encoding numbers. */ |
encoding numbers. */ |
1922 |
int enc = font_info->encoding[charset]; |
int enc = font_info->encoding[charset]; |
1923 |
|
|
1924 |
if ((enc == 1 || enc == 2) |
if ((enc == 1 || enc == 2) |
1925 |
&& CHARSET_DIMENSION (charset) == 2) |
&& CHARSET_DIMENSION (charset) == 2) |
1926 |
char2b->byte1 |= 0x80; |
char2b->byte1 |= 0x80; |
1927 |
|
|
1928 |
if (enc == 1 || enc == 3) |
if (enc == 1 || enc == 3) |
1929 |
char2b->byte2 |= 0x80; |
char2b->byte2 |= 0x80; |
1930 |
|
|
1972 |
else |
else |
1973 |
{ |
{ |
1974 |
int c1, c2, charset; |
int c1, c2, charset; |
1975 |
|
|
1976 |
/* Split characters into bytes. If c2 is -1 afterwards, C is |
/* Split characters into bytes. If c2 is -1 afterwards, C is |
1977 |
really a one-byte character so that byte1 is zero. */ |
really a one-byte character so that byte1 is zero. */ |
1978 |
SPLIT_CHAR (c, charset, c1, c2); |
SPLIT_CHAR (c, charset, c1, c2); |
1994 |
/* Make sure X resources of the face are allocated. */ |
/* Make sure X resources of the face are allocated. */ |
1995 |
xassert (face != NULL); |
xassert (face != NULL); |
1996 |
PREPARE_FACE_FOR_DISPLAY (f, face); |
PREPARE_FACE_FOR_DISPLAY (f, face); |
1997 |
|
|
1998 |
return face; |
return face; |
1999 |
} |
} |
2000 |
|
|
2035 |
else |
else |
2036 |
{ |
{ |
2037 |
int c1, c2, charset; |
int c1, c2, charset; |
2038 |
|
|
2039 |
/* Split characters into bytes. If c2 is -1 afterwards, C is |
/* Split characters into bytes. If c2 is -1 afterwards, C is |
2040 |
really a one-byte character so that byte1 is zero. */ |
really a one-byte character so that byte1 is zero. */ |
2041 |
SPLIT_CHAR (glyph->u.ch, charset, c1, c2); |
SPLIT_CHAR (glyph->u.ch, charset, c1, c2); |
2066 |
} |
} |
2067 |
|
|
2068 |
|
|
2069 |
/* Store one glyph for IT->char_to_display in IT->glyph_row. |
/* Store one glyph for IT->char_to_display in IT->glyph_row. |
2070 |
Called from x_produce_glyphs when IT->glyph_row is non-null. */ |
Called from x_produce_glyphs when IT->glyph_row is non-null. */ |
2071 |
|
|
2072 |
static INLINE void |
static INLINE void |
2075 |
{ |
{ |
2076 |
struct glyph *glyph; |
struct glyph *glyph; |
2077 |
enum glyph_row_area area = it->area; |
enum glyph_row_area area = it->area; |
2078 |
|
|
2079 |
xassert (it->glyph_row); |
xassert (it->glyph_row); |
2080 |
xassert (it->char_to_display != '\n' && it->char_to_display != '\t'); |
xassert (it->char_to_display != '\n' && it->char_to_display != '\t'); |
2081 |
|
|
2082 |
glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; |
glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; |
2083 |
if (glyph < it->glyph_row->glyphs[area + 1]) |
if (glyph < it->glyph_row->glyphs[area + 1]) |
2084 |
{ |
{ |
2100 |
} |
} |
2101 |
} |
} |
2102 |
|
|
2103 |
/* Store one glyph for the composition IT->cmp_id in IT->glyph_row. |
/* Store one glyph for the composition IT->cmp_id in IT->glyph_row. |
2104 |
Called from x_produce_glyphs when IT->glyph_row is non-null. */ |
Called from x_produce_glyphs when IT->glyph_row is non-null. */ |
2105 |
|
|
2106 |
static INLINE void |
static INLINE void |
2109 |
{ |
{ |
2110 |
struct glyph *glyph; |
struct glyph *glyph; |
2111 |
enum glyph_row_area area = it->area; |
enum glyph_row_area area = it->area; |
2112 |
|
|
2113 |
xassert (it->glyph_row); |
xassert (it->glyph_row); |
2114 |
|
|
2115 |
glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; |
glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; |
2116 |
if (glyph < it->glyph_row->glyphs[area + 1]) |
if (glyph < it->glyph_row->glyphs[area + 1]) |
2117 |
{ |
{ |
2181 |
it->pixel_width = img->width + 2 * img->hmargin; |
it->pixel_width = img->width + 2 * img->hmargin; |
2182 |
|
|
2183 |
it->nglyphs = 1; |
it->nglyphs = 1; |
2184 |
|
|
2185 |
if (face->box != FACE_NO_BOX) |
if (face->box != FACE_NO_BOX) |
2186 |
{ |
{ |
2187 |
if (face->box_line_width > 0) |
if (face->box_line_width > 0) |
2189 |
it->ascent += face->box_line_width; |
it->ascent += face->box_line_width; |
2190 |
it->descent += face->box_line_width; |
it->descent += face->box_line_width; |
2191 |
} |
} |
2192 |
|
|
2193 |
if (it->start_of_box_run_p) |
if (it->start_of_box_run_p) |
2194 |
it->pixel_width += abs (face->box_line_width); |
it->pixel_width += abs (face->box_line_width); |
2195 |
if (it->end_of_box_run_p) |
if (it->end_of_box_run_p) |
2197 |
} |
} |
2198 |
|
|
2199 |
take_vertical_position_into_account (it); |
take_vertical_position_into_account (it); |
2200 |
|
|
2201 |
if (it->glyph_row) |
if (it->glyph_row) |
2202 |
{ |
{ |
2203 |
struct glyph *glyph; |
struct glyph *glyph; |
2204 |
enum glyph_row_area area = it->area; |
enum glyph_row_area area = it->area; |
2205 |
|
|
2206 |
glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; |
glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; |
2207 |
if (glyph < it->glyph_row->glyphs[area + 1]) |
if (glyph < it->glyph_row->glyphs[area + 1]) |
2208 |
{ |
{ |
2226 |
|
|
2227 |
|
|
2228 |
/* Append a stretch glyph to IT->glyph_row. OBJECT is the source |
/* Append a stretch glyph to IT->glyph_row. OBJECT is the source |
2229 |
of the glyph, WIDTH and HEIGHT are the width and height of the |
of the glyph, WIDTH and HEIGHT are the width and height of the |
2230 |
stretch. ASCENT is the percentage/100 of HEIGHT to use for the |
stretch. ASCENT is the percentage/100 of HEIGHT to use for the |
2231 |
ascent of the glyph (0 <= ASCENT <= 1). */ |
ascent of the glyph (0 <= ASCENT <= 1). */ |
2232 |
|
|
2233 |
static void |
static void |
2234 |
x_append_stretch_glyph (it, object, width, height, ascent) |
x_append_stretch_glyph (it, object, width, height, ascent) |
2235 |
struct it *it; |
struct it *it; |
2241 |
enum glyph_row_area area = it->area; |
enum glyph_row_area area = it->area; |
2242 |
|
|
2243 |
xassert (ascent >= 0 && ascent <= 1); |
xassert (ascent >= 0 && ascent <= 1); |
2244 |
|
|
2245 |
glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; |
glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; |
2246 |
if (glyph < it->glyph_row->glyphs[area + 1]) |
if (glyph < it->glyph_row->glyphs[area + 1]) |
2247 |
{ |
{ |
2270 |
being recognized: |
being recognized: |
2271 |
|
|
2272 |
1. `:width WIDTH' specifies that the space should be WIDTH * |
1. `:width WIDTH' specifies that the space should be WIDTH * |
2273 |
canonical char width wide. WIDTH may be an integer or floating |
canonical char width wide. WIDTH may be an integer or floating |
2274 |
point number. |
point number. |
2275 |
|
|
2276 |
2. `:relative-width FACTOR' specifies that the width of the stretch |
2. `:relative-width FACTOR' specifies that the width of the stretch |
2280 |
3. `:align-to HPOS' specifies that the space should be wide enough |
3. `:align-to HPOS' specifies that the space should be wide enough |
2281 |
to reach HPOS, a value in canonical character units. |
to reach HPOS, a value in canonical character units. |
2282 |
|
|
2283 |
Exactly one of the above pairs must be present. |
Exactly one of the above pairs must be present. |
2284 |
|
|
2285 |
4. `:height HEIGHT' specifies that the height of the stretch produced |
4. `:height HEIGHT' specifies that the height of the stretch produced |
2286 |
should be HEIGHT, measured in canonical character units. |
should be HEIGHT, measured in canonical character units. |
2318 |
XFontStruct *font = face->font ? face->font : FRAME_FONT (it->f); |
XFontStruct *font = face->font ? face->font : FRAME_FONT (it->f); |
2319 |
|
|
2320 |
PREPARE_FACE_FOR_DISPLAY (it->f, face); |
PREPARE_FACE_FOR_DISPLAY (it->f, face); |
2321 |
|
|
2322 |
/* List should start with `space'. */ |
/* List should start with `space'. */ |
2323 |
xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace)); |
xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace)); |
2324 |
plist = XCDR (it->object); |
plist = XCDR (it->object); |
2336 |
property. */ |
property. */ |
2337 |
struct it it2; |
struct it it2; |
2338 |
unsigned char *p = BYTE_POS_ADDR (IT_BYTEPOS (*it)); |
unsigned char *p = BYTE_POS_ADDR (IT_BYTEPOS (*it)); |
2339 |
|
|
2340 |
it2 = *it; |
it2 = *it; |
2341 |
if (it->multibyte_p) |
if (it->multibyte_p) |
2342 |
{ |
{ |
2358 |
else |
else |
2359 |
/* Nothing specified -> width defaults to canonical char width. */ |
/* Nothing specified -> width defaults to canonical char width. */ |
2360 |
width = CANON_X_UNIT (it->f); |
width = CANON_X_UNIT (it->f); |
2361 |
|
|
2362 |
/* Compute height. */ |
/* Compute height. */ |
2363 |
if (prop = Fplist_get (plist, QCheight), |
if (prop = Fplist_get (plist, QCheight), |
2364 |
NUMVAL (prop) > 0) |
NUMVAL (prop) > 0) |
2369 |
else |
else |
2370 |
height = FONT_HEIGHT (font); |
height = FONT_HEIGHT (font); |
2371 |
|
|
2372 |
/* Compute percentage of height used for ascent. If |
/* Compute percentage of height used for ascent. If |
2373 |
`:ascent ASCENT' is present and valid, use that. Otherwise, |
`:ascent ASCENT' is present and valid, use that. Otherwise, |
2374 |
derive the ascent from the font in use. */ |
derive the ascent from the font in use. */ |
2375 |
if (prop = Fplist_get (plist, QCascent), |
if (prop = Fplist_get (plist, QCascent), |
2403 |
it->ascent += face->box_line_width; |
it->ascent += face->box_line_width; |
2404 |
it->descent += face->box_line_width; |
it->descent += face->box_line_width; |
2405 |
} |
} |
2406 |
|
|
2407 |
if (it->start_of_box_run_p) |
if (it->start_of_box_run_p) |
2408 |
it->pixel_width += abs (face->box_line_width); |
it->pixel_width += abs (face->box_line_width); |
2409 |
if (it->end_of_box_run_p) |
if (it->end_of_box_run_p) |
2410 |
it->pixel_width += abs (face->box_line_width); |
it->pixel_width += abs (face->box_line_width); |
2411 |
} |
} |
2412 |
|
|
2413 |
take_vertical_position_into_account (it); |
take_vertical_position_into_account (it); |
2414 |
} |
} |
2415 |
|
|
2501 |
face = FACE_FROM_ID (it->f, it->face_id); |
face = FACE_FROM_ID (it->f, it->face_id); |
2502 |
} |
} |
2503 |
} |
} |
2504 |
|
|
2505 |
/* Get font to use. Encode IT->char_to_display. */ |
/* Get font to use. Encode IT->char_to_display. */ |
2506 |
x_get_char_face_and_encoding (it->f, it->char_to_display, |
x_get_char_face_and_encoding (it->f, it->char_to_display, |
2507 |
it->face_id, &char2b, |
it->face_id, &char2b, |
2549 |
it->phys_descent = FONT_DESCENT (font) - boff; |
it->phys_descent = FONT_DESCENT (font) - boff; |
2550 |
it->pixel_width = FONT_WIDTH (font); |
it->pixel_width = FONT_WIDTH (font); |
2551 |
} |
} |
2552 |
|
|
2553 |
/* If this is a space inside a region of text with |
/* If this is a space inside a region of text with |
2554 |
`space-width' property, change its width. */ |
`space-width' property, change its width. */ |
2555 |
stretched_p = it->char_to_display == ' ' && !NILP (it->space_width); |
stretched_p = it->char_to_display == ' ' && !NILP (it->space_width); |
2562 |
if (face->box != FACE_NO_BOX) |
if (face->box != FACE_NO_BOX) |
2563 |
{ |
{ |
2564 |
int thick = face->box_line_width; |
int thick = face->box_line_width; |
2565 |
|
|
2566 |
if (thick > 0) |
if (thick > 0) |
2567 |
{ |
{ |
2568 |
it->ascent += thick; |
it->ascent += thick; |
2570 |
} |
} |
2571 |
else |
else |
2572 |
thick = -thick; |
thick = -thick; |
2573 |
|
|
2574 |
if (it->start_of_box_run_p) |
if (it->start_of_box_run_p) |
2575 |
it->pixel_width += thick; |
it->pixel_width += thick; |
2576 |
if (it->end_of_box_run_p) |
if (it->end_of_box_run_p) |
2583 |
it->ascent += 2; |
it->ascent += 2; |
2584 |
|
|
2585 |
take_vertical_position_into_account (it); |
take_vertical_position_into_account (it); |
2586 |
|
|
2587 |
/* If we have to actually produce glyphs, do it. */ |
/* If we have to actually produce glyphs, do it. */ |
2588 |
if (it->glyph_row) |
if (it->glyph_row) |
2589 |
{ |
{ |
2593 |
into a stretch glyph. */ |
into a stretch glyph. */ |
2594 |
double ascent = (double) FONT_BASE (font) |
double ascent = (double) FONT_BASE (font) |
2595 |
/ FONT_HEIGHT (font); |
/ FONT_HEIGHT (font); |
2596 |
x_append_stretch_glyph (it, it->object, it->pixel_width, |
x_append_stretch_glyph (it, it->object, it->pixel_width, |
2597 |
it->ascent + it->descent, ascent); |
it->ascent + it->descent, ascent); |
2598 |
} |
} |
2599 |
else |
else |
2613 |
it->nglyphs = 0; |
it->nglyphs = 0; |
2614 |
it->ascent = it->phys_ascent = FONT_BASE (font) + boff; |
it->ascent = it->phys_ascent = FONT_BASE (font) + boff; |
2615 |
it->descent = it->phys_descent = FONT_DESCENT (font) - boff; |
it->descent = it->phys_descent = FONT_DESCENT (font) - boff; |
2616 |
|
|
2617 |
if (face->box != FACE_NO_BOX |
if (face->box != FACE_NO_BOX |
2618 |
&& face->box_line_width > 0) |
&& face->box_line_width > 0) |
2619 |
{ |
{ |
2626 |
int tab_width = it->tab_width * CANON_X_UNIT (it->f); |
int tab_width = it->tab_width * CANON_X_UNIT (it->f); |
2627 |
int x = it->current_x + it->continuation_lines_width; |
int x = it->current_x + it->continuation_lines_width; |
2628 |
int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width; |
int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width; |
2629 |
|
|
2630 |
/* If the distance from the current position to the next tab |
/* If the distance from the current position to the next tab |
2631 |
stop is less than a canonical character width, use the |
stop is less than a canonical character width, use the |
2632 |
tab stop after that. */ |
tab stop after that. */ |
2637 |
it->nglyphs = 1; |
it->nglyphs = 1; |
2638 |
it->ascent = it->phys_ascent = FONT_BASE (font) + boff; |
it->ascent = it->phys_ascent = FONT_BASE (font) + boff; |
2639 |
it->descent = it->phys_descent = FONT_DESCENT (font) - boff; |
it->descent = it->phys_descent = FONT_DESCENT (font) - boff; |
2640 |
|
|
2641 |
if (it->glyph_row) |
if (it->glyph_row) |
2642 |
{ |
{ |
2643 |
double ascent = (double) it->ascent / (it->ascent + it->descent); |
double ascent = (double) it->ascent / (it->ascent + it->descent); |
2644 |
x_append_stretch_glyph (it, it->object, it->pixel_width, |
x_append_stretch_glyph (it, it->object, it->pixel_width, |
2645 |
it->ascent + it->descent, ascent); |
it->ascent + it->descent, ascent); |
2646 |
} |
} |
2647 |
} |
} |
2648 |
else |
else |
2649 |
{ |
{ |
2650 |
/* A multi-byte character. Assume that the display width of the |
/* A multi-byte character. Assume that the display width of the |
2651 |
character is the width of the character multiplied by the |
character is the width of the character multiplied by the |
2691 |
} |
} |
2692 |
else |
else |
2693 |
thick = - thick; |
thick = - thick; |
2694 |
|
|
2695 |
if (it->start_of_box_run_p) |
if (it->start_of_box_run_p) |
2696 |
it->pixel_width += thick; |
it->pixel_width += thick; |
2697 |
if (it->end_of_box_run_p) |
if (it->end_of_box_run_p) |
2698 |
it->pixel_width += thick; |
it->pixel_width += thick; |
2699 |
} |
} |
2700 |
|
|
2701 |
/* If face has an overline, add the height of the overline |
/* If face has an overline, add the height of the overline |
2702 |
(1 pixel) and a 1 pixel margin to the character height. */ |
(1 pixel) and a 1 pixel margin to the character height. */ |
2703 |
if (face->overline_p) |
if (face->overline_p) |
2704 |
it->ascent += 2; |
it->ascent += 2; |
2705 |
|
|
2706 |
take_vertical_position_into_account (it); |
take_vertical_position_into_account (it); |
2707 |
|
|
2708 |
if (it->glyph_row) |
if (it->glyph_row) |
2709 |
x_append_glyph (it); |
x_append_glyph (it); |
2710 |
} |
} |
2798 |
ascent = FONT_BASE (font); |
ascent = FONT_BASE (font); |
2799 |
descent = FONT_DESCENT (font); |
descent = FONT_DESCENT (font); |
2800 |
} |
} |
2801 |
|
|
2802 |
rightmost = width; |
rightmost = width; |
2803 |
lowest = - descent + boff; |
lowest = - descent + boff; |
2804 |
highest = ascent + boff; |
highest = ascent + boff; |
2805 |
leftmost = 0; |
leftmost = 0; |
2806 |
|
|
2807 |
if (font_info |
if (font_info |
2808 |
&& font_info->default_ascent |
&& font_info->default_ascent |
2809 |
&& CHAR_TABLE_P (Vuse_default_ascent) |
&& CHAR_TABLE_P (Vuse_default_ascent) |
2964 |
} |
} |
2965 |
else |
else |
2966 |
thick = - thick; |
thick = - thick; |
2967 |
|
|
2968 |
if (it->start_of_box_run_p) |
if (it->start_of_box_run_p) |
2969 |
it->pixel_width += thick; |
it->pixel_width += thick; |
2970 |
if (it->end_of_box_run_p) |
if (it->end_of_box_run_p) |
2971 |
it->pixel_width += thick; |
it->pixel_width += thick; |
2972 |
} |
} |
2973 |
|
|
2974 |
/* If face has an overline, add the height of the overline |
/* If face has an overline, add the height of the overline |
2975 |
(1 pixel) and a 1 pixel margin to the character height. */ |
(1 pixel) and a 1 pixel margin to the character height. */ |
2976 |
if (face->overline_p) |
if (face->overline_p) |
2977 |
it->ascent += 2; |
it->ascent += 2; |
2978 |
|
|
2979 |
take_vertical_position_into_account (it); |
take_vertical_position_into_account (it); |
2980 |
|
|
2981 |
if (it->glyph_row) |
if (it->glyph_row) |
2982 |
x_append_composite_glyph (it); |
x_append_composite_glyph (it); |
2983 |
} |
} |
3024 |
height += 2 * face->box_line_width; |
height += 2 * face->box_line_width; |
3025 |
} |
} |
3026 |
} |
} |
3027 |
|
|
3028 |
return height; |
return height; |
3029 |
} |
} |
3030 |
|
|
3194 |
static void x_init_glyph_string P_ ((struct glyph_string *, |
static void x_init_glyph_string P_ ((struct glyph_string *, |
3195 |
XChar2b *, struct window *, |
XChar2b *, struct window *, |
3196 |
struct glyph_row *, |
struct glyph_row *, |
3197 |
enum glyph_row_area, int, |
enum glyph_row_area, int, |
3198 |
enum draw_glyphs_face)); |
enum draw_glyphs_face)); |
3199 |
static int x_draw_glyphs P_ ((struct window *, int , struct glyph_row *, |
static int x_draw_glyphs P_ ((struct window *, int , struct glyph_row *, |
3200 |
enum glyph_row_area, int, int, |
enum glyph_row_area, int, int, |
3240 |
static void x_check_font P_ ((struct frame *, XFontStruct *)); |
static void x_check_font P_ ((struct frame *, XFontStruct *)); |
3241 |
#endif |
#endif |
3242 |
|
|
3243 |
|
|
3244 |
/* Append the list of glyph strings with head H and tail T to the list |
/* Append the list of glyph strings with head H and tail T to the list |
3245 |
with head *HEAD and tail *TAIL. Set *HEAD and *TAIL to the result. */ |
with head *HEAD and tail *TAIL. Set *HEAD and *TAIL to the result. */ |
3246 |
|
|
3349 |
|
|
3350 |
|
|
3351 |
/* Set up S->gc of glyph string S for drawing text in mouse face. */ |
/* Set up S->gc of glyph string S for drawing text in mouse face. */ |
3352 |
|
|
3353 |
static void |
static void |
3354 |
x_set_mouse_face_gc (s) |
x_set_mouse_face_gc (s) |
3355 |
struct glyph_string *s; |
struct glyph_string *s; |
3356 |
{ |
{ |
3357 |
int face_id; |
int face_id; |
3358 |
struct face *face; |
struct face *face; |
3359 |
|
|
3362 |
face = FACE_FROM_ID (s->f, face_id); |
face = FACE_FROM_ID (s->f, face_id); |
3363 |
if (face == NULL) |
if (face == NULL) |
3364 |
face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); |
face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); |
3365 |
|
|
3366 |
if (s->first_glyph->type == CHAR_GLYPH) |
if (s->first_glyph->type == CHAR_GLYPH) |
3367 |
face_id = FACE_FOR_CHAR (s->f, face, s->first_glyph->u.ch); |
face_id = FACE_FOR_CHAR (s->f, face, s->first_glyph->u.ch); |
3368 |
else |
else |
3379 |
but font FONT. */ |
but font FONT. */ |
3380 |
XGCValues xgcv; |
XGCValues xgcv; |
3381 |
unsigned long mask; |
unsigned long mask; |
3382 |
|
|
3383 |
xgcv.background = s->face->background; |
xgcv.background = s->face->background; |
3384 |
xgcv.foreground = s->face->foreground; |
xgcv.foreground = s->face->foreground; |
3385 |
IF_DEBUG (x_check_font (s->f, s->font)); |
IF_DEBUG (x_check_font (s->f, s->font)); |
3386 |
xgcv.font = s->font; |
xgcv.font = s->font; |
3387 |
mask = GCForeground | GCBackground | GCFont; |
mask = GCForeground | GCBackground | GCFont; |
3388 |
|
|
3389 |
if (FRAME_MAC_DISPLAY_INFO (s->f)->scratch_cursor_gc) |
if (FRAME_MAC_DISPLAY_INFO (s->f)->scratch_cursor_gc) |
3390 |
XChangeGC (s->display, FRAME_MAC_DISPLAY_INFO (s->f)->scratch_cursor_gc, |
XChangeGC (s->display, FRAME_MAC_DISPLAY_INFO (s->f)->scratch_cursor_gc, |
3391 |
mask, &xgcv); |
mask, &xgcv); |
3392 |
else |
else |
3393 |
FRAME_MAC_DISPLAY_INFO (s->f)->scratch_cursor_gc |
FRAME_MAC_DISPLAY_INFO (s->f)->scratch_cursor_gc |
3394 |
= XCreateGC (s->display, s->window, mask, &xgcv); |
= XCreateGC (s->display, s->window, mask, &xgcv); |
3395 |
|
|
3396 |
s->gc = FRAME_MAC_DISPLAY_INFO (s->f)->scratch_cursor_gc; |
s->gc = FRAME_MAC_DISPLAY_INFO (s->f)->scratch_cursor_gc; |
3397 |
} |
} |
3398 |
|
|
3407 |
static INLINE void |
static INLINE void |
3408 |
x_set_mode_line_face_gc (s) |
x_set_mode_line_face_gc (s) |
3409 |
struct glyph_string *s; |
struct glyph_string *s; |
3410 |
{ |
{ |
3411 |
s->gc = s->face->gc; |
s->gc = s->face->gc; |
3412 |
} |
} |
3413 |
|
|
3421 |
struct glyph_string *s; |
struct glyph_string *s; |
3422 |
{ |
{ |
3423 |
PREPARE_FACE_FOR_DISPLAY (s->f, s->face); |
PREPARE_FACE_FOR_DISPLAY (s->f, s->face); |
3424 |
|
|
3425 |
if (s->hl == DRAW_NORMAL_TEXT) |
if (s->hl == DRAW_NORMAL_TEXT) |
3426 |
{ |
{ |
3427 |
s->gc = s->face->gc; |
s->gc = s->face->gc; |
3472 |
{ |
{ |
3473 |
/* Draw full-width. X coordinates are relative to S->w->left. */ |
/* Draw full-width. X coordinates are relative to S->w->left. */ |
3474 |
int canon_x = CANON_X_UNIT (s->f); |
int canon_x = CANON_X_UNIT (s->f); |
3475 |
|
|
3476 |
r->left = WINDOW_LEFT_MARGIN (s->w) * canon_x; |
r->left = WINDOW_LEFT_MARGIN (s->w) * canon_x; |
3477 |
r_width = XFASTINT (s->w->width) * canon_x; |
r_width = XFASTINT (s->w->width) * canon_x; |
3478 |
|
|
3482 |
if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (s->f)) |
if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (s->f)) |
3483 |
r->left -= width; |
r->left -= width; |
3484 |
} |
} |
3485 |
|
|
3486 |
r->left += FRAME_INTERNAL_BORDER_WIDTH (s->f); |
r->left += FRAME_INTERNAL_BORDER_WIDTH (s->f); |
3487 |
|
|
3488 |
/* Unless displaying a mode or menu bar line, which are always |
/* Unless displaying a mode or menu bar line, which are always |
3568 |
/* Compute overhangs and x-positions for glyph string S and its |
/* Compute overhangs and x-positions for glyph string S and its |
3569 |
predecessors, or successors. X is the starting x-position for S. |
predecessors, or successors. X is the starting x-position for S. |
3570 |
BACKWARD_P non-zero means process predecessors. */ |
BACKWARD_P non-zero means process predecessors. */ |
3571 |
|
|
3572 |
static void |
static void |
3573 |
x_compute_overhangs_and_x (s, x, backward_p) |
x_compute_overhangs_and_x (s, x, backward_p) |
3574 |
struct glyph_string *s; |
struct glyph_string *s; |
3609 |
int *left, *right; |
int *left, *right; |
3610 |
{ |
{ |
3611 |
*left = *right = 0; |
*left = *right = 0; |
3612 |
|
|
3613 |
if (glyph->type == CHAR_GLYPH) |
if (glyph->type == CHAR_GLYPH) |
3614 |
{ |
{ |
3615 |
XFontStruct *font; |
XFontStruct *font; |
3642 |
struct glyph_string *s; |
struct glyph_string *s; |
3643 |
{ |
{ |
3644 |
int k; |
int k; |
3645 |
|
|
3646 |
if (s->left_overhang) |
if (s->left_overhang) |
3647 |
{ |
{ |
3648 |
int x = 0, i; |
int x = 0, i; |
3704 |
struct glyph *glyphs = s->row->glyphs[s->area]; |
struct glyph *glyphs = s->row->glyphs[s->area]; |
3705 |
int first = (s->first_glyph - glyphs) + (s->cmp ? 1 : s->nchars); |
int first = (s->first_glyph - glyphs) + (s->cmp ? 1 : s->nchars); |
3706 |
int end = s->row->used[s->area]; |
int end = s->row->used[s->area]; |
3707 |
|
|
3708 |
for (i = first; i < end && s->right_overhang > x; ++i) |
for (i = first; i < end && s->right_overhang > x; ++i) |
3709 |
x += glyphs[i].pixel_width; |
x += glyphs[i].pixel_width; |
3710 |
|
|
3927 |
struct x_display_info *dpyinfo; |
struct x_display_info *dpyinfo; |
3928 |
Lisp_Object tail; |
Lisp_Object tail; |
3929 |
struct frame *f; |
struct frame *f; |
3930 |
|
|
3931 |
dpyinfo = x_display_info_for_display (XtDisplay (widget)); |
dpyinfo = x_display_info_for_display (XtDisplay (widget)); |
3932 |
|
|
3933 |
/* Find the top-level shell of the widget. Note that this function |
/* Find the top-level shell of the widget. Note that this function |
3934 |
can be called when the widget is not yet realized, so XtWindow |
can be called when the widget is not yet realized, so XtWindow |
3935 |
(widget) == 0. That's the reason we can't simply use |
(widget) == 0. That's the reason we can't simply use |
4016 |
nearest_delta = delta; |
nearest_delta = delta; |
4017 |
} |
} |
4018 |
} |
} |
4019 |
|
|
4020 |
color->red = cells[nearest].red; |
color->red = cells[nearest].red; |
4021 |
color->green = cells[nearest].green; |
color->green = cells[nearest].green; |
4022 |
color->blue = cells[nearest].blue; |
color->blue = cells[nearest].blue; |
4027 |
if (rc) |
if (rc) |
4028 |
register_color (color->pixel); |
register_color (color->pixel); |
4029 |
#endif /* DEBUG_X_COLORS */ |
#endif /* DEBUG_X_COLORS */ |
4030 |
|
|
4031 |
return rc; |
return rc; |
4032 |
} |
} |
4033 |
|
|
4124 |
DELTA lighter or darker than the relief's background which is found |
DELTA lighter or darker than the relief's background which is found |
4125 |
in S->f->output_data.x->relief_background. If such a color cannot |
in S->f->output_data.x->relief_background. If such a color cannot |
4126 |
be allocated, use DEFAULT_PIXEL, instead. */ |
be allocated, use DEFAULT_PIXEL, instead. */ |
4127 |
|
|
4128 |
static void |
static void |
4129 |
x_setup_relief_color (f, relief, factor, delta, default_pixel) |
x_setup_relief_color (f, relief, factor, delta, default_pixel) |
4130 |
struct frame *f; |
struct frame *f; |
4150 |
relief->allocated_p = 1; |
relief->allocated_p = 1; |
4151 |
xgcv.foreground = relief->pixel = pixel; |
xgcv.foreground = relief->pixel = pixel; |
4152 |
} |
} |
4153 |
|
|
4154 |
if (relief->gc == 0) |
if (relief->gc == 0) |
4155 |
{ |
{ |
4156 |
#if 0 /* MAC_TODO: stipple */ |
#if 0 /* MAC_TODO: stipple */ |
4178 |
else |
else |
4179 |
{ |
{ |
4180 |
XGCValues xgcv; |
XGCValues xgcv; |
4181 |
|
|
4182 |
/* Get the background color of the face. */ |
/* Get the background color of the face. */ |
4183 |
XGetGCValues (s->display, s->gc, GCBackground, &xgcv); |
XGetGCValues (s->display, s->gc, GCBackground, &xgcv); |
4184 |
color = xgcv.background; |
color = xgcv.background; |
4213 |
{ |
{ |
4214 |
int i; |
int i; |
4215 |
GC gc; |
GC gc; |
4216 |
|
|
4217 |
if (raised_p) |
if (raised_p) |
4218 |
gc = f->output_data.mac->white_relief.gc; |
gc = f->output_data.mac->white_relief.gc; |
4219 |
else |
else |
4239 |
gc = f->output_data.mac->white_relief.gc; |
gc = f->output_data.mac->white_relief.gc; |
4240 |
mac_set_clip_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), |
mac_set_clip_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), |
4241 |
clip_rect); |
clip_rect); |
4242 |
|
|
4243 |
/* Bottom. */ |
/* Bottom. */ |
4244 |
for (i = 0; i < width; ++i) |
for (i = 0; i < width; ++i) |
4245 |
XDrawLine (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), gc, |
XDrawLine (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), gc, |
4246 |
left_x + i * left_p, bottom_y - i, |
left_x + i * left_p, bottom_y - i, |
4247 |
right_x + 1 - i * right_p, bottom_y - i); |
right_x + 1 - i * right_p, bottom_y - i); |
4248 |
|
|
4249 |
/* Right. */ |
/* Right. */ |
4250 |
if (right_p) |
if (right_p) |
4251 |
for (i = 0; i < width; ++i) |
for (i = 0; i < width; ++i) |
4271 |
Rect *clip_rect; |
Rect *clip_rect; |
4272 |
{ |
{ |
4273 |
XGCValues xgcv; |
XGCValues xgcv; |
4274 |
|
|
4275 |
xgcv.foreground = s->face->box_color; |
xgcv.foreground = s->face->box_color; |
4276 |
mac_set_clip_rectangle (s->display, s->window, clip_rect); |
mac_set_clip_rectangle (s->display, s->window, clip_rect); |
4277 |
|
|
4278 |
/* Top. */ |
/* Top. */ |
4279 |
XFillRectangle (s->display, s->window, &xgcv, |
XFillRectangle (s->display, s->window, &xgcv, |
4280 |
left_x, top_y, right_x - left_x, width); |
left_x, top_y, right_x - left_x, width); |
4287 |
/* Bottom. */ |
/* Bottom. */ |
4288 |
XFillRectangle (s->display, s->window, &xgcv, |
XFillRectangle (s->display, s->window, &xgcv, |
4289 |
left_x, bottom_y - width, right_x - left_x, width); |
left_x, bottom_y - width, right_x - left_x, width); |
4290 |
|
|
4291 |
/* Right. */ |
/* Right. */ |
4292 |
if (right_p) |
if (right_p) |
4293 |
XFillRectangle (s->display, s->window, &xgcv, |
XFillRectangle (s->display, s->window, &xgcv, |
4316 |
if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (s->f)) |
if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (s->f)) |
4317 |
last_x += FRAME_SCROLL_BAR_WIDTH (s->f) * CANON_X_UNIT (s->f); |
last_x += FRAME_SCROLL_BAR_WIDTH (s->f) * CANON_X_UNIT (s->f); |
4318 |
} |
} |
4319 |
|
|
4320 |
/* The glyph that may have a right box line. */ |
/* The glyph that may have a right box line. */ |
4321 |
last_glyph = (s->cmp || s->img |
last_glyph = (s->cmp || s->img |
4322 |
? s->first_glyph |
? s->first_glyph |
4339 |
|| (s->hl == DRAW_MOUSE_FACE |
|| (s->hl == DRAW_MOUSE_FACE |
4340 |
&& (s->next == NULL |
&& (s->next == NULL |
4341 |
|| s->next->hl != s->hl))); |
|| s->next->hl != s->hl))); |
4342 |
|
|
4343 |
x_get_glyph_string_clip_rect (s, &clip_rect); |
x_get_glyph_string_clip_rect (s, &clip_rect); |
4344 |
|
|
4345 |
if (s->face->box == FACE_SIMPLE_BOX) |
if (s->face->box == FACE_SIMPLE_BOX) |
4396 |
xgcv.clip_y_origin = y; |
xgcv.clip_y_origin = y; |
4397 |
xgcv.function = GXcopy; |
xgcv.function = GXcopy; |
4398 |
XChangeGC (s->display, s->gc, mask, &xgcv); |
XChangeGC (s->display, s->gc, mask, &xgcv); |
4399 |
|
|
4400 |
x_get_glyph_string_clip_rect (s, &clip_rect); |
x_get_glyph_string_clip_rect (s, &clip_rect); |
4401 |
image_rect.x = x; |
image_rect.x = x; |
4402 |
image_rect.y = y; |
image_rect.y = y; |
4411 |
{ |
{ |
4412 |
mac_copy_area (s->display, s->img->pixmap, s->window, s->gc, |
mac_copy_area (s->display, s->img->pixmap, s->window, s->gc, |
4413 |
0, 0, s->img->width, s->img->height, x, y); |
0, 0, s->img->width, s->img->height, x, y); |
4414 |
|
|
4415 |
/* When the image has a mask, we can expect that at |
/* When the image has a mask, we can expect that at |
4416 |
least part of a mouse highlight or a block cursor will |
least part of a mouse highlight or a block cursor will |
4417 |
be visible. If the image doesn't have a mask, make |
be visible. If the image doesn't have a mask, make |
4445 |
Rect r; |
Rect r; |
4446 |
int x; |
int x; |
4447 |
int y = s->ybase - image_ascent (s->img, s->face); |
int y = s->ybase - image_ascent (s->img, s->face); |
4448 |
|
|
4449 |
/* If first glyph of S has a left box line, start drawing it to the |
/* If first glyph of S has a left box line, start drawing it to the |
4450 |
right of that line. */ |
right of that line. */ |
4451 |
if (s->face->box != FACE_NO_BOX |
if (s->face->box != FACE_NO_BOX |
4453 |
x = s->x + abs (s->face->box_line_width); |
x = s->x + abs (s->face->box_line_width); |
4454 |
else |
else |
4455 |
x = s->x; |
x = s->x; |
4456 |
|
|
4457 |
/* If there is a margin around the image, adjust x- and y-position |
/* If there is a margin around the image, adjust x- and y-position |
4458 |
by that margin. */ |
by that margin. */ |
4459 |
x += s->img->hmargin; |
x += s->img->hmargin; |
4460 |
y += s->img->vmargin; |
y += s->img->vmargin; |
4461 |
|
|
4462 |
if (s->hl == DRAW_IMAGE_SUNKEN |
if (s->hl == DRAW_IMAGE_SUNKEN |
4463 |
|| s->hl == DRAW_IMAGE_RAISED) |
|| s->hl == DRAW_IMAGE_RAISED) |
4464 |
{ |
{ |
4470 |
thick = abs (s->img->relief); |
thick = abs (s->img->relief); |
4471 |
raised_p = s->img->relief > 0; |
raised_p = s->img->relief > 0; |
4472 |
} |
} |
4473 |
|
|
4474 |
x0 = x - thick; |
x0 = x - thick; |
4475 |
y0 = y - thick; |
y0 = y - thick; |
4476 |
x1 = x + s->img->width + thick - 1; |
x1 = x + s->img->width + thick - 1; |
4477 |
y1 = y + s->img->height + thick - 1; |
y1 = y + s->img->height + thick - 1; |
4478 |
|
|
4479 |
x_setup_relief_colors (s); |
x_setup_relief_colors (s); |
4480 |
x_get_glyph_string_clip_rect (s, &r); |
x_get_glyph_string_clip_rect (s, &r); |
4481 |
x_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p, 1, 1, &r); |
x_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p, 1, 1, &r); |
4534 |
{ |
{ |
4535 |
mac_copy_area_to_pixmap (s->display, s->img->pixmap, pixmap, s->gc, |
mac_copy_area_to_pixmap (s->display, s->img->pixmap, pixmap, s->gc, |
4536 |
0, 0, s->img->width, s->img->height, x, y); |
0, 0, s->img->width, s->img->height, x, y); |
4537 |
|
|
4538 |
/* When the image has a mask, we can expect that at |
/* When the image has a mask, we can expect that at |
4539 |
least part of a mouse highlight or a block cursor will |
least part of a mouse highlight or a block cursor will |
4540 |
be visible. If the image doesn't have a mask, make |
be visible. If the image doesn't have a mask, make |
4579 |
} |
} |
4580 |
|
|
4581 |
|
|
4582 |
/* Draw image glyph string S. |
/* Draw image glyph string S. |
4583 |
|
|
4584 |
s->y |
s->y |
4585 |
s->x +------------------------- |
s->x +------------------------- |
4622 |
x = s->x + box_line_hwidth; |
x = s->x + box_line_hwidth; |
4623 |
else |
else |
4624 |
x = s->x; |
x = s->x; |
4625 |
|
|
4626 |
y = s->y + box_line_vwidth; |
y = s->y + box_line_vwidth; |
4627 |
#if 0 /* TODO: image mask */ |
#if 0 /* TODO: image mask */ |
4628 |
if (s->img->mask) |
if (s->img->mask) |
4637 |
pixmap = XCreatePixmap (s->display, s->window, |
pixmap = XCreatePixmap (s->display, s->window, |
4638 |
s->background_width, |
s->background_width, |
4639 |
s->height, depth); |
s->height, depth); |
4640 |
|
|
4641 |
/* Don't clip in the following because we're working on the |
/* Don't clip in the following because we're working on the |
4642 |
pixmap. */ |
pixmap. */ |
4643 |
XSetClipMask (s->display, s->gc, None); |
XSetClipMask (s->display, s->gc, None); |
4665 |
else |
else |
4666 |
#endif |
#endif |
4667 |
x_draw_glyph_string_bg_rect (s, x, y, s->background_width, height); |
x_draw_glyph_string_bg_rect (s, x, y, s->background_width, height); |
4668 |
|
|
4669 |
s->background_filled_p = 1; |
s->background_filled_p = 1; |
4670 |
} |
} |
4671 |
|
|
4725 |
} |
} |
4726 |
else |
else |
4727 |
gc = s->face->gc; |
gc = s->face->gc; |
4728 |
|
|
4729 |
x_get_glyph_string_clip_rect (s, &r); |
x_get_glyph_string_clip_rect (s, &r); |
4730 |
mac_set_clip_rectangle (s->display, s->window, &r); |
mac_set_clip_rectangle (s->display, s->window, &r); |
4731 |
|
|
4753 |
else if (!s->background_filled_p) |
else if (!s->background_filled_p) |
4754 |
x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width, |
x_draw_glyph_string_bg_rect (s, s->x, s->y, s->background_width, |
4755 |
s->height); |
s->height); |
4756 |
|
|
4757 |
s->background_filled_p = 1; |
s->background_filled_p = 1; |
4758 |
} |
} |
4759 |
|
|
4835 |
{ |
{ |
4836 |
unsigned long h = 1; |
unsigned long h = 1; |
4837 |
unsigned long dy = s->height - h; |
unsigned long dy = s->height - h; |
4838 |
|
|
4839 |
if (s->face->underline_defaulted_p) |
if (s->face->underline_defaulted_p) |
4840 |
XFillRectangle (s->display, s->window, s->gc, s->x, s->y + dy, |
XFillRectangle (s->display, s->window, s->gc, s->x, s->y + dy, |
4841 |
s->width, h); |
s->width, h); |
4868 |
XSetForeground (s->display, s->gc, xgcv.foreground); |
XSetForeground (s->display, s->gc, xgcv.foreground); |
4869 |
} |
} |
4870 |
} |
} |
4871 |
|
|
4872 |
/* Draw strike-through. */ |
/* Draw strike-through. */ |
4873 |
if (s->face->strike_through_p) |
if (s->face->strike_through_p) |
4874 |
{ |
{ |
4888 |
XSetForeground (s->display, s->gc, xgcv.foreground); |
XSetForeground (s->display, s->gc, xgcv.foreground); |
4889 |
} |
} |
4890 |
} |
} |
4891 |
|
|
4892 |
/* Draw relief. */ |
/* Draw relief. */ |
4893 |
if (!relief_drawn_p && s->face->box != FACE_NO_BOX) |
if (!relief_drawn_p && s->face->box != FACE_NO_BOX) |
4894 |
x_draw_glyph_string_box (s); |
x_draw_glyph_string_box (s); |
4904 |
|
|
4905 |
|
|
4906 |
/* Fill glyph string S with composition components specified by S->cmp. |
/* Fill glyph string S with composition components specified by S->cmp. |
4907 |
|
|
4908 |
FACES is an array of faces for all components of this composition. |
FACES is an array of faces for all components of this composition. |
4909 |
S->gidx is the index of the first component for S. |
S->gidx is the index of the first component for S. |
4910 |
OVERLAPS_P non-zero means S should draw the foreground only, and |
OVERLAPS_P non-zero means S should draw the foreground only, and |
4952 |
|
|
4953 |
/* Adjust base line for subscript/superscript text. */ |
/* Adjust base line for subscript/superscript text. */ |
4954 |
s->ybase += s->first_glyph->voffset; |
s->ybase += s->first_glyph->voffset; |
4955 |
|
|
4956 |
xassert (s->face && s->face->gc); |
xassert (s->face && s->face->gc); |
4957 |
|
|
4958 |
/* This glyph string must always be drawn with 16-bit functions. */ |
/* This glyph string must always be drawn with 16-bit functions. */ |
4963 |
|
|
4964 |
|
|
4965 |
/* Fill glyph string S from a sequence of character glyphs. |
/* Fill glyph string S from a sequence of character glyphs. |
4966 |
|
|
4967 |
FACE_ID is the face id of the string. START is the index of the |
FACE_ID is the face id of the string. START is the index of the |
4968 |
first glyph to consider, END is the index of the last + 1. |
first glyph to consider, END is the index of the last + 1. |
4969 |
OVERLAPS_P non-zero means S should draw the foreground only, and |
OVERLAPS_P non-zero means S should draw the foreground only, and |
5013 |
|
|
5014 |
s->font = s->face->font; |
s->font = s->face->font; |
5015 |
s->font_info = FONT_INFO_FROM_ID (s->f, s->face->font_info_id); |
s->font_info = FONT_INFO_FROM_ID (s->f, s->face->font_info_id); |
5016 |
|
|
5017 |
/* If the specified font could not be loaded, use the frame's font, |
/* If the specified font could not be loaded, use the frame's font, |
5018 |
but record the fact that we couldn't load it in |
but record the fact that we couldn't load it in |
5019 |
S->font_not_found_p so that we can draw rectangles for the |
S->font_not_found_p so that we can draw rectangles for the |
5026 |
|
|
5027 |
/* Adjust base line for subscript/superscript text. */ |
/* Adjust base line for subscript/superscript text. */ |
5028 |
s->ybase += voffset; |
s->ybase += voffset; |
5029 |
|
|
5030 |
xassert (s->face && s->face->gc); |
xassert (s->face && s->face->gc); |
5031 |
return glyph - s->row->glyphs[s->area]; |
return glyph - s->row->glyphs[s->area]; |
5032 |
} |
} |
5044 |
s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id); |
s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id); |
5045 |
s->font = s->face->font; |
s->font = s->face->font; |
5046 |
s->width = s->first_glyph->pixel_width; |
s->width = s->first_glyph->pixel_width; |
5047 |
|
|
5048 |
/* Adjust base line for subscript/superscript text. */ |
/* Adjust base line for subscript/superscript text. */ |
5049 |
s->ybase += s->first_glyph->voffset; |
s->ybase += s->first_glyph->voffset; |
5050 |
} |
} |
5067 |
{ |
{ |
5068 |
struct glyph *glyph, *last; |
struct glyph *glyph, *last; |
5069 |
int voffset, face_id; |
int voffset, face_id; |
5070 |
|
|
5071 |
xassert (s->first_glyph->type == STRETCH_GLYPH); |
xassert (s->first_glyph->type == STRETCH_GLYPH); |
5072 |
|
|
5073 |
glyph = s->row->glyphs[s->area] + start; |
glyph = s->row->glyphs[s->area] + start; |
5074 |
last = s->row->glyphs[s->area] + end; |
last = s->row->glyphs[s->area] + end; |
5075 |
face_id = glyph->face_id; |
face_id = glyph->face_id; |
5086 |
&& glyph->face_id == face_id); |
&& glyph->face_id == face_id); |
5087 |
++glyph) |
++glyph) |
5088 |
s->width += glyph->pixel_width; |
s->width += glyph->pixel_width; |
5089 |
|
|
5090 |
/* Adjust base line for subscript/superscript text. */ |
/* Adjust base line for subscript/superscript text. */ |
5091 |
s->ybase += voffset; |
s->ybase += voffset; |
5092 |
|
|
5102 |
and area within the row from which S is constructed. START is the |
and area within the row from which S is constructed. START is the |
5103 |
index of the first glyph structure covered by S. HL is a |
index of the first glyph structure covered by S. HL is a |
5104 |
face-override for drawing S. */ |
face-override for drawing S. */ |
5105 |
|
|
5106 |
static void |
static void |
5107 |
x_init_glyph_string (s, char2b, w, row, area, start, hl) |
x_init_glyph_string (s, char2b, w, row, area, start, hl) |
5108 |
struct glyph_string *s; |
struct glyph_string *s; |
5129 |
/* Display the internal border below the tool-bar window. */ |
/* Display the internal border below the tool-bar window. */ |
5130 |
if (s->w == XWINDOW (s->f->tool_bar_window)) |
if (s->w == XWINDOW (s->f->tool_bar_window)) |
5131 |
s->y -= s->f->output_data.mac->internal_border_width; |
s->y -= s->f->output_data.mac->internal_border_width; |
5132 |
|
|
5133 |
s->ybase = s->y + row->ascent; |
s->ybase = s->y + row->ascent; |
5134 |
} |
} |
5135 |
|
|
5147 |
/* If the face of this glyph string has to be drawn to the end of |
/* If the face of this glyph string has to be drawn to the end of |
5148 |
the drawing area, set S->extends_to_end_of_line_p. */ |
the drawing area, set S->extends_to_end_of_line_p. */ |
5149 |
struct face *default_face = FACE_FROM_ID (s->f, DEFAULT_FACE_ID); |
struct face *default_face = FACE_FROM_ID (s->f, DEFAULT_FACE_ID); |
5150 |
|
|
5151 |
if (start == s->row->used[s->area] |
if (start == s->row->used[s->area] |
5152 |
&& s->area == TEXT_AREA |
&& s->area == TEXT_AREA |
5153 |
&& ((s->hl == DRAW_NORMAL_TEXT |
&& ((s->hl == DRAW_NORMAL_TEXT |
5159 |
|| ((s->hl == DRAW_IMAGE_RAISED || s->hl == DRAW_IMAGE_SUNKEN) |
|| ((s->hl == DRAW_IMAGE_RAISED || s->hl == DRAW_IMAGE_SUNKEN) |
5160 |
&& s->row->fill_line_p))) |
&& s->row->fill_line_p))) |
5161 |
s->extends_to_end_of_line_p = 1; |
s->extends_to_end_of_line_p = 1; |
5162 |
|
|
5163 |
/* If S extends its face to the end of the line, set its |
/* If S extends its face to the end of the line, set its |
5164 |
background_width to the distance to the right edge of the drawing |
background_width to the distance to the right edge of the drawing |
5165 |
area. */ |
area. */ |
5240 |
OVERLAPS_P); \ |
OVERLAPS_P); \ |
5241 |
} \ |
} \ |
5242 |
while (0) |
while (0) |
5243 |
|
|
5244 |
|
|
5245 |
/* Add a glyph string for a composite sequence to the list of strings |
/* Add a glyph string for a composite sequence to the list of strings |
5246 |
between HEAD and TAIL. START is the index of the first glyph in |
between HEAD and TAIL. START is the index of the first glyph in |
5296 |
++START; \ |
++START; \ |
5297 |
s = first_s; \ |
s = first_s; \ |
5298 |
} while (0) |
} while (0) |
5299 |
|
|
5300 |
|
|
5301 |
/* Build a list of glyph strings between HEAD and TAIL for the glyphs |
/* Build a list of glyph strings between HEAD and TAIL for the glyphs |
5302 |
of AREA of glyph row ROW on window W between indices START and END. |
of AREA of glyph row ROW on window W between indices START and END. |
5365 |
and clip to the physical height of ROW. |
and clip to the physical height of ROW. |
5366 |
|
|
5367 |
Value is the x-position reached, relative to AREA of W. */ |
Value is the x-position reached, relative to AREA of W. */ |
5368 |
|
|
5369 |
static int |
static int |
5370 |
x_draw_glyphs (w, x, row, area, start, end, hl, overlaps_p) |
x_draw_glyphs (w, x, row, area, start, end, hl, overlaps_p) |
5371 |
struct window *w; |
struct window *w; |
5446 |
/* Prepend glyph strings for glyphs in front of the first glyph |
/* Prepend glyph strings for glyphs in front of the first glyph |
5447 |
string that are overwritten because of the first glyph |
string that are overwritten because of the first glyph |
5448 |
string's left overhang. The background of all strings |
string's left overhang. The background of all strings |
5449 |
prepended must be drawn because the first glyph string |
prepended must be drawn because the first glyph string |
5450 |
draws over it. */ |
draws over it. */ |
5451 |
i = x_left_overwritten (head); |
i = x_left_overwritten (head); |
5452 |
if (i >= 0) |
if (i >= 0) |
5524 |
{ |
{ |
5525 |
int x0 = head ? head->x : x; |
int x0 = head ? head->x : x; |
5526 |
int x1 = tail ? tail->x + tail->background_width : x; |
int x1 = tail ? tail->x + tail->background_width : x; |
5527 |
|
|
5528 |
x0 = FRAME_TO_WINDOW_PIXEL_X (w, x0); |
x0 = FRAME_TO_WINDOW_PIXEL_X (w, x0); |
5529 |
x1 = FRAME_TO_WINDOW_PIXEL_X (w, x1); |
x1 = FRAME_TO_WINDOW_PIXEL_X (w, x1); |
5530 |
|
|
5531 |
if (!row->full_width_p && XFASTINT (w->left_margin_width) != 0) |
if (!row->full_width_p && XFASTINT (w->left_margin_width) != 0) |
5532 |
{ |
{ |
5533 |
int left_area_width = window_box_width (w, LEFT_MARGIN_AREA); |
int left_area_width = window_box_width (w, LEFT_MARGIN_AREA); |
5563 |
enum glyph_row_area area; |
enum glyph_row_area area; |
5564 |
{ |
{ |
5565 |
int i, x; |
int i, x; |
5566 |
|
|
5567 |
BLOCK_INPUT; |
BLOCK_INPUT; |
5568 |
|
|
5569 |
if (area == LEFT_MARGIN_AREA) |
if (area == LEFT_MARGIN_AREA) |
5570 |
x = 0; |
x = 0; |
5571 |
else if (area == TEXT_AREA) |
else if (area == TEXT_AREA) |
5597 |
++i; |
++i; |
5598 |
} |
} |
5599 |
} |
} |
5600 |
|
|
5601 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
5602 |
} |
} |
5603 |
|
|
5617 |
|
|
5618 |
xassert (updated_window && updated_row); |
xassert (updated_window && updated_row); |
5619 |
BLOCK_INPUT; |
BLOCK_INPUT; |
5620 |
|
|
5621 |
/* Write glyphs. */ |
/* Write glyphs. */ |
5622 |
|
|
5623 |
hpos = start - updated_row->glyphs[updated_area]; |
hpos = start - updated_row->glyphs[updated_area]; |
5627 |
DRAW_NORMAL_TEXT, 0); |
DRAW_NORMAL_TEXT, 0); |
5628 |
|
|
5629 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
5630 |
|
|
5631 |
/* Advance the output cursor. */ |
/* Advance the output cursor. */ |
5632 |
output_cursor.hpos += len; |
output_cursor.hpos += len; |
5633 |
output_cursor.x = x; |
output_cursor.x = x; |
5715 |
struct window *w = updated_window; |
struct window *w = updated_window; |
5716 |
int max_x, min_y, max_y; |
int max_x, min_y, max_y; |
5717 |
int from_x, from_y, to_y; |
int from_x, from_y, to_y; |
5718 |
|
|
5719 |
xassert (updated_window && updated_row); |
xassert (updated_window && updated_row); |
5720 |
f = XFRAME (w->frame); |
f = XFRAME (w->frame); |
5721 |
|
|
5722 |
if (updated_row->full_width_p) |
if (updated_row->full_width_p) |
5723 |
{ |
{ |
5724 |
max_x = XFASTINT (w->width) * CANON_X_UNIT (f); |
max_x = XFASTINT (w->width) * CANON_X_UNIT (f); |
5740 |
to_x = min (to_x, max_x); |
to_x = min (to_x, max_x); |
5741 |
|
|
5742 |
to_y = min (max_y, output_cursor.y + updated_row->height); |
to_y = min (max_y, output_cursor.y + updated_row->height); |
5743 |
|
|
5744 |
/* Notice if the cursor will be cleared by this operation. */ |
/* Notice if the cursor will be cleared by this operation. */ |
5745 |
if (!updated_row->full_width_p) |
if (!updated_row->full_width_p) |
5746 |
notice_overwritten_cursor (w, updated_area, |
notice_overwritten_cursor (w, updated_area, |
5761 |
from_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, from_x); |
from_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, from_x); |
5762 |
to_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, to_x); |
to_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, to_x); |
5763 |
} |
} |
5764 |
|
|
5765 |
min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); |
min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); |
5766 |
from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, output_cursor.y)); |
from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, output_cursor.y)); |
5767 |
to_y = WINDOW_TO_FRAME_PIXEL_Y (w, to_y); |
to_y = WINDOW_TO_FRAME_PIXEL_Y (w, to_y); |
5768 |
|
|
5769 |
/* Prevent inadvertently clearing to end of the X window. */ |
/* Prevent inadvertently clearing to end of the X window. */ |
5770 |
if (to_x > from_x && to_y > from_y) |
if (to_x > from_x && to_y > from_y) |
5771 |
{ |
{ |
5836 |
y.tv_usec -= 1000000 * nsec; |
y.tv_usec -= 1000000 * nsec; |
5837 |
y.tv_sec += nsec; |
y.tv_sec += nsec; |
5838 |
} |
} |
5839 |
|
|
5840 |
if (x.tv_usec - y.tv_usec > 1000000) |
if (x.tv_usec - y.tv_usec > 1000000) |
5841 |
{ |
{ |
5842 |
int nsec = (y.tv_usec - x.tv_usec) / 1000000; |
int nsec = (y.tv_usec - x.tv_usec) / 1000000; |
5888 |
select (0, NULL, NULL, NULL, &timeout); |
select (0, NULL, NULL, NULL, &timeout); |
5889 |
} |
} |
5890 |
} |
} |
5891 |
|
|
5892 |
FlashMenuBar (0); |
FlashMenuBar (0); |
5893 |
|
|
5894 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
5903 |
XTring_bell () |
XTring_bell () |
5904 |
{ |
{ |
5905 |
struct frame *f = SELECTED_FRAME (); |
struct frame *f = SELECTED_FRAME (); |
5906 |
|
|
5907 |
#if defined (HAVE_TIMEVAL) && defined (HAVE_SELECT) |
#if defined (HAVE_TIMEVAL) && defined (HAVE_SELECT) |
5908 |
if (visible_bell) |
if (visible_bell) |
5909 |
XTflash (f); |
XTflash (f); |
5989 |
} |
} |
5990 |
|
|
5991 |
BLOCK_INPUT; |
BLOCK_INPUT; |
5992 |
|
|
5993 |
/* Cursor off. Will be switched on again in x_update_window_end. */ |
/* Cursor off. Will be switched on again in x_update_window_end. */ |
5994 |
updated_window = w; |
updated_window = w; |
5995 |
x_clear_cursor (w); |
x_clear_cursor (w); |
5999 |
x, from_y, |
x, from_y, |
6000 |
width, height, |
width, height, |
6001 |
x, to_y); |
x, to_y); |
6002 |
|
|
6003 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
6004 |
} |
} |
6005 |
|
|
6008 |
/*********************************************************************** |
/*********************************************************************** |
6009 |
Exposure Events |
Exposure Events |
6010 |
***********************************************************************/ |
***********************************************************************/ |
6011 |
|
|
6012 |
/* Redisplay an exposed area of frame F. X and Y are the upper-left |
/* Redisplay an exposed area of frame F. X and Y are the upper-left |
6013 |
corner of the exposed rectangle. W and H are width and height of |
corner of the exposed rectangle. W and H are width and height of |
6014 |
the exposed area. All are pixel values. W or H zero means redraw |
the exposed area. All are pixel values. W or H zero means redraw |
6167 |
x += first->pixel_width; |
x += first->pixel_width; |
6168 |
++first; |
++first; |
6169 |
} |
} |
6170 |
|
|
6171 |
/* Find the last one. */ |
/* Find the last one. */ |
6172 |
last = first; |
last = first; |
6173 |
first_x = x; |
first_x = x; |
6199 |
Rect *r; |
Rect *r; |
6200 |
{ |
{ |
6201 |
xassert (row->enabled_p); |
xassert (row->enabled_p); |
6202 |
|
|
6203 |
if (row->mode_line_p || w->pseudo_window_p) |
if (row->mode_line_p || w->pseudo_window_p) |
6204 |
x_draw_glyphs (w, 0, row, TEXT_AREA, 0, row->used[TEXT_AREA], |
x_draw_glyphs (w, 0, row, TEXT_AREA, 0, row->used[TEXT_AREA], |
6205 |
DRAW_NORMAL_TEXT, 0); |
DRAW_NORMAL_TEXT, 0); |
6257 |
struct glyph_row *last_overlapping_row; |
struct glyph_row *last_overlapping_row; |
6258 |
{ |
{ |
6259 |
struct glyph_row *row; |
struct glyph_row *row; |
6260 |
|
|
6261 |
for (row = first_overlapping_row; row <= last_overlapping_row; ++row) |
for (row = first_overlapping_row; row <= last_overlapping_row; ++row) |
6262 |
if (row->overlapping_p) |
if (row->overlapping_p) |
6263 |
{ |
{ |
6264 |
xassert (row->enabled_p && !row->mode_line_p); |
xassert (row->enabled_p && !row->mode_line_p); |
6265 |
|
|
6266 |
if (row->used[LEFT_MARGIN_AREA]) |
if (row->used[LEFT_MARGIN_AREA]) |
6267 |
x_fix_overlapping_area (w, row, LEFT_MARGIN_AREA); |
x_fix_overlapping_area (w, row, LEFT_MARGIN_AREA); |
6268 |
|
|
6269 |
if (row->used[TEXT_AREA]) |
if (row->used[TEXT_AREA]) |
6270 |
x_fix_overlapping_area (w, row, TEXT_AREA); |
x_fix_overlapping_area (w, row, TEXT_AREA); |
6271 |
|
|
6272 |
if (row->used[RIGHT_MARGIN_AREA]) |
if (row->used[RIGHT_MARGIN_AREA]) |
6273 |
x_fix_overlapping_area (w, row, RIGHT_MARGIN_AREA); |
x_fix_overlapping_area (w, row, RIGHT_MARGIN_AREA); |
6274 |
} |
} |
6317 |
struct glyph_row *row; |
struct glyph_row *row; |
6318 |
int cursor_cleared_p; |
int cursor_cleared_p; |
6319 |
struct glyph_row *first_overlapping_row, *last_overlapping_row; |
struct glyph_row *first_overlapping_row, *last_overlapping_row; |
6320 |
|
|
6321 |
TRACE ((stderr, "expose_window (%d, %d, %d, %d)\n", |
TRACE ((stderr, "expose_window (%d, %d, %d, %d)\n", |
6322 |
r.left, r.top, r.right, r.bottom)); |
r.left, r.top, r.right, r.bottom)); |
6323 |
|
|
6357 |
first_overlapping_row = row; |
first_overlapping_row = row; |
6358 |
last_overlapping_row = row; |
last_overlapping_row = row; |
6359 |
} |
} |
6360 |
|
|
6361 |
if (expose_line (w, row, &r)) |
if (expose_line (w, row, &r)) |
6362 |
mouse_face_overwritten_p = 1; |
mouse_face_overwritten_p = 1; |
6363 |
} |
} |
6364 |
|
|
6365 |
if (y1 >= yb) |
if (y1 >= yb) |
6366 |
break; |
break; |
6367 |
} |
} |
6381 |
/* Fix the display of overlapping rows. */ |
/* Fix the display of overlapping rows. */ |
6382 |
if (first_overlapping_row) |
if (first_overlapping_row) |
6383 |
expose_overlaps (w, first_overlapping_row, last_overlapping_row); |
expose_overlaps (w, first_overlapping_row, last_overlapping_row); |
6384 |
|
|
6385 |
/* Draw border between windows. */ |
/* Draw border between windows. */ |
6386 |
x_draw_vertical_border (w); |
x_draw_vertical_border (w); |
6387 |
|
|
6388 |
/* Turn the cursor on again. */ |
/* Turn the cursor on again. */ |
6389 |
if (cursor_cleared_p) |
if (cursor_cleared_p) |
6390 |
x_update_window_cursor (w, 1); |
x_update_window_cursor (w, 1); |
6410 |
Rect *left, *right; |
Rect *left, *right; |
6411 |
Rect *upper, *lower; |
Rect *upper, *lower; |
6412 |
int intersection_p = 0; |
int intersection_p = 0; |
6413 |
|
|
6414 |
/* Rerrange so that R1 is the left-most rectangle. */ |
/* Rerrange so that R1 is the left-most rectangle. */ |
6415 |
if (r1->left < r2->left) |
if (r1->left < r2->left) |
6416 |
left = r1, right = r2; |
left = r1, right = r2; |
6422 |
if (right->left <= left->right) |
if (right->left <= left->right) |
6423 |
{ |
{ |
6424 |
result->left = right->left; |
result->left = right->left; |
6425 |
|
|
6426 |
/* The right end of the intersection is the minimum of the |
/* The right end of the intersection is the minimum of the |
6427 |
the right ends of left and right. */ |
the right ends of left and right. */ |
6428 |
result->right = min (left->right, right->right); |
result->right = min (left->right, right->right); |
6438 |
if (lower->top <= upper->bottom) |
if (lower->top <= upper->bottom) |
6439 |
{ |
{ |
6440 |
result->top = lower->top; |
result->top = lower->top; |
6441 |
|
|
6442 |
/* The lower end of the intersection is the minimum of the lower |
/* The lower end of the intersection is the minimum of the lower |
6443 |
ends of upper and lower. */ |
ends of upper and lower. */ |
6444 |
result->bottom = min (lower->bottom, upper->bottom); |
result->bottom = min (lower->bottom, upper->bottom); |
6989 |
else if (!buffer_only_p || BUFFERP (glyph->object)) |
else if (!buffer_only_p || BUFFERP (glyph->object)) |
6990 |
break; |
break; |
6991 |
} |
} |
6992 |
|
|
6993 |
x0 += glyph->pixel_width; |
x0 += glyph->pixel_width; |
6994 |
++glyph; |
++glyph; |
6995 |
} |
} |
7052 |
struct glyph *glyph, *end; |
struct glyph *glyph, *end; |
7053 |
Lisp_Object help, map; |
Lisp_Object help, map; |
7054 |
int x0; |
int x0; |
7055 |
|
|
7056 |
/* Find the glyph under X. */ |
/* Find the glyph under X. */ |
7057 |
glyph = row->glyphs[TEXT_AREA]; |
glyph = row->glyphs[TEXT_AREA]; |
7058 |
end = glyph + row->used[TEXT_AREA]; |
end = glyph + row->used[TEXT_AREA]; |
7059 |
x0 = - (FRAME_LEFT_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f) |
x0 = - (FRAME_LEFT_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f) |
7060 |
+ FRAME_X_LEFT_FRINGE_WIDTH (f)); |
+ FRAME_X_LEFT_FRINGE_WIDTH (f)); |
7061 |
|
|
7062 |
while (glyph < end |
while (glyph < end |
7063 |
&& x >= x0 + glyph->pixel_width) |
&& x >= x0 + glyph->pixel_width) |
7064 |
{ |
{ |
7418 |
the text ``under'' it might have. */ |
the text ``under'' it might have. */ |
7419 |
struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos); |
struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos); |
7420 |
int start = MATRIX_ROW_START_CHARPOS (r); |
int start = MATRIX_ROW_START_CHARPOS (r); |
7421 |
|
|
7422 |
pos = string_buffer_position (w, object, start); |
pos = string_buffer_position (w, object, start); |
7423 |
if (pos > 0) |
if (pos > 0) |
7424 |
mouse_face = get_char_property_and_overlay (make_number (pos), |
mouse_face = get_char_property_and_overlay (make_number (pos), |
7442 |
&dpyinfo->mouse_face_beg_x, |
&dpyinfo->mouse_face_beg_x, |
7443 |
&dpyinfo->mouse_face_beg_y, |
&dpyinfo->mouse_face_beg_y, |
7444 |
object); |
object); |
7445 |
|
|
7446 |
dpyinfo->mouse_face_past_end |
dpyinfo->mouse_face_past_end |
7447 |
= !fast_find_position (w, XFASTINT (after), |
= !fast_find_position (w, XFASTINT (after), |
7448 |
&dpyinfo->mouse_face_end_col, |
&dpyinfo->mouse_face_end_col, |
7474 |
for (i = noverlays - 1; i >= 0 && NILP (help); --i) |
for (i = noverlays - 1; i >= 0 && NILP (help); --i) |
7475 |
{ |
{ |
7476 |
overlay = overlay_vec[i]; |
overlay = overlay_vec[i]; |
7477 |
help = Foverlay_get (overlay, Qhelp_echo); |
help = Foverlay_get (overlay, Qhelp_echo); |
7478 |
} |
} |
7479 |
|
|
7480 |
if (!NILP (help)) |
if (!NILP (help)) |
7521 |
&& charpos < ZV) |
&& charpos < ZV) |
7522 |
help = Fget_text_property (make_number (charpos), Qhelp_echo, |
help = Fget_text_property (make_number (charpos), Qhelp_echo, |
7523 |
object); |
object); |
7524 |
|
|
7525 |
if (!NILP (help)) |
if (!NILP (help)) |
7526 |
{ |
{ |
7527 |
help_echo = help; |
help_echo = help; |
7608 |
|| *hpos < dpyinfo->mouse_face_end_col |
|| *hpos < dpyinfo->mouse_face_end_col |
7609 |
|| dpyinfo->mouse_face_past_end)) |
|| dpyinfo->mouse_face_past_end)) |
7610 |
return 0; |
return 0; |
7611 |
|
|
7612 |
return 1; |
return 1; |
7613 |
} |
} |
7614 |
|
|
7629 |
Lisp_Object enabled_p; |
Lisp_Object enabled_p; |
7630 |
int x = button_event->where.h; |
int x = button_event->where.h; |
7631 |
int y = button_event->where.v; |
int y = button_event->where.v; |
7632 |
|
|
7633 |
/* If not on the highlighted tool-bar item, return. */ |
/* If not on the highlighted tool-bar item, return. */ |
7634 |
frame_to_window_pixel_xy (w, &x, &y); |
frame_to_window_pixel_xy (w, &x, &y); |
7635 |
if (x_tool_bar_item (f, x, y, &glyph, &hpos, &vpos, &prop_idx) != 0) |
if (x_tool_bar_item (f, x, y, &glyph, &hpos, &vpos, &prop_idx) != 0) |
7639 |
enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); |
enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); |
7640 |
if (NILP (enabled_p)) |
if (NILP (enabled_p)) |
7641 |
return; |
return; |
7642 |
|
|
7643 |
if (button_event->what == mouseDown) |
if (button_event->what == mouseDown) |
7644 |
{ |
{ |
7645 |
/* Show item in pressed state. */ |
/* Show item in pressed state. */ |
7716 |
goto set_help_echo; |
goto set_help_echo; |
7717 |
|
|
7718 |
clear_mouse_face (dpyinfo); |
clear_mouse_face (dpyinfo); |
7719 |
|
|
7720 |
/* Mouse is down, but on different tool-bar item? */ |
/* Mouse is down, but on different tool-bar item? */ |
7721 |
mouse_down_p = (dpyinfo->grabbed |
mouse_down_p = (dpyinfo->grabbed |
7722 |
&& f == last_mouse_frame |
&& f == last_mouse_frame |
7727 |
|
|
7728 |
dpyinfo->mouse_face_image_state = DRAW_NORMAL_TEXT; |
dpyinfo->mouse_face_image_state = DRAW_NORMAL_TEXT; |
7729 |
draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED; |
draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED; |
7730 |
|
|
7731 |
/* If tool-bar item is not enabled, don't highlight it. */ |
/* If tool-bar item is not enabled, don't highlight it. */ |
7732 |
enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); |
enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); |
7733 |
if (!NILP (enabled_p)) |
if (!NILP (enabled_p)) |
7737 |
row = MATRIX_ROW (w->current_matrix, vpos); |
row = MATRIX_ROW (w->current_matrix, vpos); |
7738 |
for (i = x = 0; i < hpos; ++i) |
for (i = x = 0; i < hpos; ++i) |
7739 |
x += row->glyphs[TEXT_AREA][i].pixel_width; |
x += row->glyphs[TEXT_AREA][i].pixel_width; |
7740 |
|
|
7741 |
/* Record this as the current active region. */ |
/* Record this as the current active region. */ |
7742 |
dpyinfo->mouse_face_beg_col = hpos; |
dpyinfo->mouse_face_beg_col = hpos; |
7743 |
dpyinfo->mouse_face_beg_row = vpos; |
dpyinfo->mouse_face_beg_row = vpos; |
7744 |
dpyinfo->mouse_face_beg_x = x; |
dpyinfo->mouse_face_beg_x = x; |
7745 |
dpyinfo->mouse_face_beg_y = row->y; |
dpyinfo->mouse_face_beg_y = row->y; |
7746 |
dpyinfo->mouse_face_past_end = 0; |
dpyinfo->mouse_face_past_end = 0; |
7747 |
|
|
7748 |
dpyinfo->mouse_face_end_col = hpos + 1; |
dpyinfo->mouse_face_end_col = hpos + 1; |
7749 |
dpyinfo->mouse_face_end_row = vpos; |
dpyinfo->mouse_face_end_row = vpos; |
7750 |
dpyinfo->mouse_face_end_x = x + glyph->pixel_width; |
dpyinfo->mouse_face_end_x = x + glyph->pixel_width; |
7751 |
dpyinfo->mouse_face_end_y = row->y; |
dpyinfo->mouse_face_end_y = row->y; |
7752 |
dpyinfo->mouse_face_window = window; |
dpyinfo->mouse_face_window = window; |
7753 |
dpyinfo->mouse_face_face_id = TOOL_BAR_FACE_ID; |
dpyinfo->mouse_face_face_id = TOOL_BAR_FACE_ID; |
7754 |
|
|
7755 |
/* Display it as active. */ |
/* Display it as active. */ |
7756 |
show_mouse_face (dpyinfo, draw); |
show_mouse_face (dpyinfo, draw); |
7757 |
dpyinfo->mouse_face_image_state = draw; |
dpyinfo->mouse_face_image_state = draw; |
7758 |
} |
} |
7759 |
|
|
7760 |
set_help_echo: |
set_help_echo: |
7761 |
|
|
7762 |
/* Set help_echo to a help string.to display for this tool-bar item. |
/* Set help_echo to a help string.to display for this tool-bar item. |
7763 |
XTread_socket does the rest. */ |
XTread_socket does the rest. */ |
7764 |
help_echo_object = help_echo_window = Qnil; |
help_echo_object = help_echo_window = Qnil; |
7780 |
#if 0 /* This is a version of fast_find_position that's more correct |
#if 0 /* This is a version of fast_find_position that's more correct |
7781 |
in the presence of hscrolling, for example. I didn't install |
in the presence of hscrolling, for example. I didn't install |
7782 |
it right away because the problem fixed is minor, it failed |
it right away because the problem fixed is minor, it failed |
7783 |
in 20.x as well, and I think it's too risky to install |
in 20.x as well, and I think it's too risky to install |
7784 |
so near the release of 21.1. 2001-09-25 gerd. */ |
so near the release of 21.1. 2001-09-25 gerd. */ |
7785 |
|
|
7786 |
static int |
static int |
7813 |
*x = row->x; |
*x = row->x; |
7814 |
*y = row->y; |
*y = row->y; |
7815 |
*vpos = MATRIX_ROW_VPOS (row, w->current_matrix); |
*vpos = MATRIX_ROW_VPOS (row, w->current_matrix); |
7816 |
|
|
7817 |
glyph = row->glyphs[TEXT_AREA]; |
glyph = row->glyphs[TEXT_AREA]; |
7818 |
end = glyph + row->used[TEXT_AREA]; |
end = glyph + row->used[TEXT_AREA]; |
7819 |
|
|
7820 |
/* Skip over glyphs not having an object at the start of the row. |
/* Skip over glyphs not having an object at the start of the row. |
7821 |
These are special glyphs like truncation marks on terminal |
These are special glyphs like truncation marks on terminal |
7822 |
frames. */ |
frames. */ |
8018 |
*x += best_glyph->pixel_width; |
*x += best_glyph->pixel_width; |
8019 |
++*hpos; |
++*hpos; |
8020 |
} |
} |
8021 |
|
|
8022 |
*y = best_row->y; |
*y = best_row->y; |
8023 |
*vpos = best_row - w->current_matrix->rows; |
*vpos = best_row - w->current_matrix->rows; |
8024 |
} |
} |
8037 |
{ |
{ |
8038 |
struct window *w = XWINDOW (dpyinfo->mouse_face_window); |
struct window *w = XWINDOW (dpyinfo->mouse_face_window); |
8039 |
struct frame *f = XFRAME (WINDOW_FRAME (w)); |
struct frame *f = XFRAME (WINDOW_FRAME (w)); |
8040 |
|
|
8041 |
if (/* If window is in the process of being destroyed, don't bother |
if (/* If window is in the process of being destroyed, don't bother |
8042 |
to do anything. */ |
to do anything. */ |
8043 |
w->current_matrix != NULL |
w->current_matrix != NULL |
8052 |
|
|
8053 |
first = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_beg_row); |
first = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_beg_row); |
8054 |
last = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_end_row); |
last = MATRIX_ROW (w->current_matrix, dpyinfo->mouse_face_end_row); |
8055 |
|
|
8056 |
for (row = first; row <= last && row->enabled_p; ++row) |
for (row = first; row <= last && row->enabled_p; ++row) |
8057 |
{ |
{ |
8058 |
int start_hpos, end_hpos, start_x; |
int start_hpos, end_hpos, start_x; |
8076 |
|
|
8077 |
if (end_hpos > start_hpos) |
if (end_hpos > start_hpos) |
8078 |
{ |
{ |
8079 |
x_draw_glyphs (w, start_x, row, TEXT_AREA, |
x_draw_glyphs (w, start_x, row, TEXT_AREA, |
8080 |
start_hpos, end_hpos, draw, 0); |
start_hpos, end_hpos, draw, 0); |
8081 |
|
|
8082 |
row->mouse_face_p |
row->mouse_face_p |
8307 |
Lisp_Object frame, tail; |
Lisp_Object frame, tail; |
8308 |
|
|
8309 |
if (is_emacs_window(wp)) |
if (is_emacs_window(wp)) |
8310 |
f = ((mac_output *) GetWRefCon (wp))->mFP; |
f = ((mac_output *) GetWRefCon (wp))->mFP; |
8311 |
|
|
8312 |
BLOCK_INPUT; |
BLOCK_INPUT; |
8313 |
|
|
8339 |
XSETINT (*y, mouse_pos.v); |
XSETINT (*y, mouse_pos.v); |
8340 |
*time = last_mouse_movement_time; |
*time = last_mouse_movement_time; |
8341 |
} |
} |
8342 |
|
|
8343 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
8344 |
} |
} |
8345 |
|
|
8347 |
/************************************************************************ |
/************************************************************************ |
8348 |
Scroll bars, general |
Scroll bars, general |
8349 |
************************************************************************/ |
************************************************************************/ |
8350 |
|
|
8351 |
/* Create a scroll bar and return the scroll bar vector for it. W is |
/* Create a scroll bar and return the scroll bar vector for it. W is |
8352 |
the Emacs window on which to create the scroll bar. TOP, LEFT, |
the Emacs window on which to create the scroll bar. TOP, LEFT, |
8353 |
WIDTH and HEIGHT are the pixel coordinates and dimensions of the |
WIDTH and HEIGHT are the pixel coordinates and dimensions of the |
8370 |
r.top = disp_top; |
r.top = disp_top; |
8371 |
r.right = left + width; |
r.right = left + width; |
8372 |
r.bottom = disp_top + disp_height; |
r.bottom = disp_top + disp_height; |
8373 |
|
|
8374 |
#ifdef TARGET_API_MAC_CARBON |
#ifdef TARGET_API_MAC_CARBON |
8375 |
ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", 1, 0, 0, 0, |
ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", 1, 0, 0, 0, |
8376 |
kControlScrollBarProc, 0L); |
kControlScrollBarProc, 0L); |
8403 |
|
|
8404 |
|
|
8405 |
/* Draw BAR's handle in the proper position. |
/* Draw BAR's handle in the proper position. |
8406 |
|
|
8407 |
If the handle is already drawn from START to END, don't bother |
If the handle is already drawn from START to END, don't bother |
8408 |
redrawing it, unless REBUILD is non-zero; in that case, always |
redrawing it, unless REBUILD is non-zero; in that case, always |
8409 |
redraw it. (REBUILD is handy for drawing the handle after expose |
redraw it. (REBUILD is handy for drawing the handle after expose |
8442 |
else if (start > top_range) |
else if (start > top_range) |
8443 |
start = top_range; |
start = top_range; |
8444 |
end = start + length; |
end = start + length; |
8445 |
|
|
8446 |
if (end < start) |
if (end < start) |
8447 |
end = start; |
end = start; |
8448 |
else if (end > top_range && ! dragging) |
else if (end > top_range && ! dragging) |
8536 |
|
|
8537 |
/* Compute the left edge of the scroll bar. */ |
/* Compute the left edge of the scroll bar. */ |
8538 |
if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) |
if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) |
8539 |
sb_left = left + width - sb_width - (width - sb_width) / 2; |
sb_left = left + width - sb_width - (width - sb_width) / 2; |
8540 |
else |
else |
8541 |
sb_left = left + (width - sb_width) / 2; |
sb_left = left + (width - sb_width) / 2; |
8542 |
|
|
8543 |
/* Adjustments according to Inside Macintosh to make it look nice */ |
/* Adjustments according to Inside Macintosh to make it look nice */ |
8544 |
disp_top = top; |
disp_top = top; |
8545 |
disp_height = height; |
disp_height = height; |
8553 |
disp_top++; |
disp_top++; |
8554 |
disp_height--; |
disp_height--; |
8555 |
} |
} |
8556 |
|
|
8557 |
if (sb_left + sb_width == PIXEL_WIDTH (f)) |
if (sb_left + sb_width == PIXEL_WIDTH (f)) |
8558 |
sb_left++; |
sb_left++; |
8559 |
|
|
8560 |
/* Does the scroll bar exist yet? */ |
/* Does the scroll bar exist yet? */ |
8561 |
if (NILP (w->vertical_scroll_bar)) |
if (NILP (w->vertical_scroll_bar)) |
8562 |
{ |
{ |
8572 |
{ |
{ |
8573 |
/* It may just need to be moved and resized. */ |
/* It may just need to be moved and resized. */ |
8574 |
ControlHandle ch; |
ControlHandle ch; |
8575 |
|
|
8576 |
bar = XSCROLL_BAR (w->vertical_scroll_bar); |
bar = XSCROLL_BAR (w->vertical_scroll_bar); |
8577 |
ch = SCROLL_BAR_CONTROL_HANDLE (bar); |
ch = SCROLL_BAR_CONTROL_HANDLE (bar); |
8578 |
|
|
8605 |
SizeControl (ch, sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, |
SizeControl (ch, sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, |
8606 |
disp_height); |
disp_height); |
8607 |
ShowControl (ch); |
ShowControl (ch); |
8608 |
|
|
8609 |
/* Remember new settings. */ |
/* Remember new settings. */ |
8610 |
XSETINT (bar->left, sb_left); |
XSETINT (bar->left, sb_left); |
8611 |
XSETINT (bar->top, top); |
XSETINT (bar->top, top); |
8749 |
{ |
{ |
8750 |
Lisp_Object bar; |
Lisp_Object bar; |
8751 |
ControlHandle ch; |
ControlHandle ch; |
8752 |
|
|
8753 |
bar = FRAME_SCROLL_BARS (frame); |
bar = FRAME_SCROLL_BARS (frame); |
8754 |
while (! NILP (bar)) |
while (! NILP (bar)) |
8755 |
{ |
{ |
8773 |
{ |
{ |
8774 |
Lisp_Object bar; |
Lisp_Object bar; |
8775 |
ControlHandle ch; |
ControlHandle ch; |
8776 |
|
|
8777 |
bar = FRAME_SCROLL_BARS (frame); |
bar = FRAME_SCROLL_BARS (frame); |
8778 |
while (! NILP (bar)) |
while (! NILP (bar)) |
8779 |
{ |
{ |
8782 |
DeactivateControl (ch); |
DeactivateControl (ch); |
8783 |
#else |
#else |
8784 |
SetControlMaximum (ch, XINT (-1)); |
SetControlMaximum (ch, XINT (-1)); |
8785 |
#endif |
#endif |
8786 |
bar = XSCROLL_BAR (bar)->next; |
bar = XSCROLL_BAR (bar)->next; |
8787 |
} |
} |
8788 |
} |
} |
8808 |
bufp->arg = Qnil; |
bufp->arg = Qnil; |
8809 |
|
|
8810 |
bar->dragging = Qnil; |
bar->dragging = Qnil; |
8811 |
|
|
8812 |
switch (part_code) |
switch (part_code) |
8813 |
{ |
{ |
8814 |
case kControlUpButtonPart: |
case kControlUpButtonPart: |
9034 |
if (cursor_glyph->type == STRETCH_GLYPH |
if (cursor_glyph->type == STRETCH_GLYPH |
9035 |
&& !x_stretch_cursor_p) |
&& !x_stretch_cursor_p) |
9036 |
wd = min (CANON_X_UNIT (f), wd); |
wd = min (CANON_X_UNIT (f), wd); |
9037 |
|
|
9038 |
/* The foreground of cursor_gc is typically the same as the normal |
/* The foreground of cursor_gc is typically the same as the normal |
9039 |
background color, which can cause the cursor box to be invisible. */ |
background color, which can cause the cursor box to be invisible. */ |
9040 |
xgcv.foreground = f->output_data.mac->cursor_pixel; |
xgcv.foreground = f->output_data.mac->cursor_pixel; |
9078 |
XGCValues xgcv; |
XGCValues xgcv; |
9079 |
Display *dpy; |
Display *dpy; |
9080 |
Window window; |
Window window; |
9081 |
|
|
9082 |
cursor_glyph = get_phys_cursor_glyph (w); |
cursor_glyph = get_phys_cursor_glyph (w); |
9083 |
if (cursor_glyph == NULL) |
if (cursor_glyph == NULL) |
9084 |
return; |
return; |
9089 |
dpy = FRAME_MAC_DISPLAY (f); |
dpy = FRAME_MAC_DISPLAY (f); |
9090 |
window = FRAME_MAC_WINDOW (f); |
window = FRAME_MAC_WINDOW (f); |
9091 |
gc = FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc; |
gc = FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc; |
9092 |
|
|
9093 |
if (gc) |
if (gc) |
9094 |
XChangeGC (dpy, gc, mask, &xgcv); |
XChangeGC (dpy, gc, mask, &xgcv); |
9095 |
else |
else |
9183 |
screen. */ |
screen. */ |
9184 |
if (w->phys_cursor_type == NO_CURSOR) |
if (w->phys_cursor_type == NO_CURSOR) |
9185 |
goto mark_cursor_off; |
goto mark_cursor_off; |
9186 |
|
|
9187 |
/* VPOS >= active_glyphs->nrows means that window has been resized. |
/* VPOS >= active_glyphs->nrows means that window has been resized. |
9188 |
Don't bother to erase the cursor. */ |
Don't bother to erase the cursor. */ |
9189 |
if (vpos >= active_glyphs->nrows) |
if (vpos >= active_glyphs->nrows) |
9194 |
cursor_row = MATRIX_ROW (active_glyphs, vpos); |
cursor_row = MATRIX_ROW (active_glyphs, vpos); |
9195 |
if (!cursor_row->enabled_p) |
if (!cursor_row->enabled_p) |
9196 |
goto mark_cursor_off; |
goto mark_cursor_off; |
9197 |
|
|
9198 |
/* If row is completely invisible, don't attempt to delete a cursor which |
/* If row is completely invisible, don't attempt to delete a cursor which |
9199 |
isn't there. This may happen if cursor is at top of window, and |
isn't there. This may happen if cursor is at top of window, and |
9200 |
we switch to a buffer with a header line in that window. */ |
we switch to a buffer with a header line in that window. */ |
9201 |
if (cursor_row->visible_height <= 0) |
if (cursor_row->visible_height <= 0) |
9202 |
goto mark_cursor_off; |
goto mark_cursor_off; |
9203 |
|
|
9204 |
/* This can happen when the new row is shorter than the old one. |
/* This can happen when the new row is shorter than the old one. |
9205 |
In this case, either x_draw_glyphs or clear_end_of_line |
In this case, either x_draw_glyphs or clear_end_of_line |
9206 |
should have cleared the cursor. Note that we wouldn't be |
should have cleared the cursor. Note that we wouldn't be |
9208 |
cursor glyph at hand. */ |
cursor glyph at hand. */ |
9209 |
if (w->phys_cursor.hpos >= cursor_row->used[TEXT_AREA]) |
if (w->phys_cursor.hpos >= cursor_row->used[TEXT_AREA]) |
9210 |
goto mark_cursor_off; |
goto mark_cursor_off; |
9211 |
|
|
9212 |
/* If the cursor is in the mouse face area, redisplay that when |
/* If the cursor is in the mouse face area, redisplay that when |
9213 |
we clear the cursor. */ |
we clear the cursor. */ |
9214 |
if (! NILP (dpyinfo->mouse_face_window) |
if (! NILP (dpyinfo->mouse_face_window) |
9236 |
goto mark_cursor_off; |
goto mark_cursor_off; |
9237 |
|
|
9238 |
x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x), |
x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x), |
9239 |
|
|
9240 |
XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), |
XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), |
9241 |
x, |
x, |
9242 |
WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, |
WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, |
9245 |
cursor_row->visible_height, |
cursor_row->visible_height, |
9246 |
0); |
0); |
9247 |
} |
} |
9248 |
|
|
9249 |
/* Erase the cursor by redrawing the character underneath it. */ |
/* Erase the cursor by redrawing the character underneath it. */ |
9250 |
if (mouse_face_here_p) |
if (mouse_face_here_p) |
9251 |
hl = DRAW_MOUSE_FACE; |
hl = DRAW_MOUSE_FACE; |
9268 |
struct mac_display_info *dpyinfo |
struct mac_display_info *dpyinfo |
9269 |
= FRAME_MAC_DISPLAY_INFO (XFRAME (w->frame)); |
= FRAME_MAC_DISPLAY_INFO (XFRAME (w->frame)); |
9270 |
int in_mouse_face = 0; |
int in_mouse_face = 0; |
9271 |
|
|
9272 |
if (WINDOWP (dpyinfo->mouse_face_window) |
if (WINDOWP (dpyinfo->mouse_face_window) |
9273 |
&& XWINDOW (dpyinfo->mouse_face_window) == w) |
&& XWINDOW (dpyinfo->mouse_face_window) == w) |
9274 |
{ |
{ |
9323 |
current_glyphs = w->current_matrix; |
current_glyphs = w->current_matrix; |
9324 |
glyph_row = MATRIX_ROW (current_glyphs, vpos); |
glyph_row = MATRIX_ROW (current_glyphs, vpos); |
9325 |
glyph = glyph_row->glyphs[TEXT_AREA] + hpos; |
glyph = glyph_row->glyphs[TEXT_AREA] + hpos; |
9326 |
|
|
9327 |
/* If cursor row is not enabled, we don't really know where to |
/* If cursor row is not enabled, we don't really know where to |
9328 |
display the cursor. */ |
display the cursor. */ |
9329 |
if (!glyph_row->enabled_p) |
if (!glyph_row->enabled_p) |
9330 |
{ |
{ |
9356 |
{ |
{ |
9357 |
w->phys_cursor_ascent = glyph_row->ascent; |
w->phys_cursor_ascent = glyph_row->ascent; |
9358 |
w->phys_cursor_height = glyph_row->height; |
w->phys_cursor_height = glyph_row->height; |
9359 |
|
|
9360 |
/* Set phys_cursor_.* before x_draw_.* is called because some |
/* Set phys_cursor_.* before x_draw_.* is called because some |
9361 |
of them may need the information. */ |
of them may need the information. */ |
9362 |
w->phys_cursor.x = x; |
w->phys_cursor.x = x; |
9760 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
9761 |
{ |
{ |
9762 |
Rect r; |
Rect r; |
9763 |
|
|
9764 |
GetWindowPortBounds (FRAME_MAC_WINDOW (f), &r); |
GetWindowPortBounds (FRAME_MAC_WINDOW (f), &r); |
9765 |
SetPt(&pt, r.left, r.top); |
SetPt(&pt, r.left, r.top); |
9766 |
} |
} |
9841 |
int cols, rows; |
int cols, rows; |
9842 |
{ |
{ |
9843 |
int pixelwidth, pixelheight; |
int pixelwidth, pixelheight; |
9844 |
|
|
9845 |
BLOCK_INPUT; |
BLOCK_INPUT; |
9846 |
|
|
9847 |
check_frame_size (f, &rows, &cols); |
check_frame_size (f, &rows, &cols); |
9848 |
f->output_data.mac->vertical_scroll_bar_extra |
f->output_data.mac->vertical_scroll_bar_extra |
9849 |
= (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
= (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
9864 |
but the window manager will get around to dealing with the size |
but the window manager will get around to dealing with the size |
9865 |
change request eventually, and we'll hear how it went when the |
change request eventually, and we'll hear how it went when the |
9866 |
ConfigureNotify event gets here. |
ConfigureNotify event gets here. |
9867 |
|
|
9868 |
We could just not bother storing any of this information here, |
We could just not bother storing any of this information here, |
9869 |
and let the ConfigureNotify event set everything up, but that |
and let the ConfigureNotify event set everything up, but that |
9870 |
might be kind of confusing to the Lisp code, since size changes |
might be kind of confusing to the Lisp code, since size changes |
9889 |
mark_window_cursors_off (XWINDOW (f->root_window)); |
mark_window_cursors_off (XWINDOW (f->root_window)); |
9890 |
|
|
9891 |
/* Clear out any recollection of where the mouse highlighting was, |
/* Clear out any recollection of where the mouse highlighting was, |
9892 |
since it might be in a place that's outside the new frame size. |
since it might be in a place that's outside the new frame size. |
9893 |
Actually checking whether it is outside is a pain in the neck, |
Actually checking whether it is outside is a pain in the neck, |
9894 |
so don't try--just let the highlighting be done afresh with new size. */ |
so don't try--just let the highlighting be done afresh with new size. */ |
9895 |
cancel_mouse_face (f); |
cancel_mouse_face (f); |
10018 |
f->output_data.mac->top_pos, 0); |
f->output_data.mac->top_pos, 0); |
10019 |
|
|
10020 |
f->output_data.mac->asked_for_visible = 1; |
f->output_data.mac->asked_for_visible = 1; |
10021 |
|
|
10022 |
ShowWindow (FRAME_MAC_WINDOW (f)); |
ShowWindow (FRAME_MAC_WINDOW (f)); |
10023 |
} |
} |
10024 |
|
|
10082 |
/* Don't keep the highlight on an invisible frame. */ |
/* Don't keep the highlight on an invisible frame. */ |
10083 |
if (FRAME_MAC_DISPLAY_INFO (f)->x_highlight_frame == f) |
if (FRAME_MAC_DISPLAY_INFO (f)->x_highlight_frame == f) |
10084 |
FRAME_MAC_DISPLAY_INFO (f)->x_highlight_frame = 0; |
FRAME_MAC_DISPLAY_INFO (f)->x_highlight_frame = 0; |
10085 |
|
|
10086 |
BLOCK_INPUT; |
BLOCK_INPUT; |
10087 |
|
|
10088 |
HideWindow (FRAME_MAC_WINDOW (f)); |
HideWindow (FRAME_MAC_WINDOW (f)); |
10089 |
|
|
10090 |
/* We can't distinguish this from iconification |
/* We can't distinguish this from iconification |
10091 |
just by the event that we get from the server. |
just by the event that we get from the server. |
10092 |
So we can't win using the usual strategy of letting |
So we can't win using the usual strategy of letting |
10096 |
FRAME_ICONIFIED_P (f) = 0; |
FRAME_ICONIFIED_P (f) = 0; |
10097 |
f->async_visible = 0; |
f->async_visible = 0; |
10098 |
f->async_iconified = 0; |
f->async_iconified = 0; |
10099 |
|
|
10100 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
10101 |
} |
} |
10102 |
|
|
10119 |
BLOCK_INPUT; |
BLOCK_INPUT; |
10120 |
|
|
10121 |
CollapseWindow (FRAME_MAC_WINDOW (f), true); |
CollapseWindow (FRAME_MAC_WINDOW (f), true); |
10122 |
|
|
10123 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
10124 |
} |
} |
10125 |
|
|
10380 |
} |
} |
10381 |
|
|
10382 |
#else /* not USE_X_TOOLKIT */ |
#else /* not USE_X_TOOLKIT */ |
10383 |
|
|
10384 |
f->output_data.x->wm_hints.flags |= IconPixmapHint; |
f->output_data.x->wm_hints.flags |= IconPixmapHint; |
10385 |
XSetWMHints (FRAME_X_DISPLAY (f), window, &f->output_data.x->wm_hints); |
XSetWMHints (FRAME_X_DISPLAY (f), window, &f->output_data.x->wm_hints); |
10386 |
|
|
10450 |
} |
} |
10451 |
|
|
10452 |
/* Assume parameter 1 is fully qualified, no wildcards. */ |
/* Assume parameter 1 is fully qualified, no wildcards. */ |
10453 |
static int |
static int |
10454 |
mac_font_pattern_match (fontname, pattern) |
mac_font_pattern_match (fontname, pattern) |
10455 |
char * fontname; |
char * fontname; |
10456 |
char * pattern; |
char * pattern; |
10487 |
|
|
10488 |
/* Two font specs are considered to match if their foundry, family, |
/* Two font specs are considered to match if their foundry, family, |
10489 |
weight, slant, and charset match. */ |
weight, slant, and charset match. */ |
10490 |
static int |
static int |
10491 |
mac_font_match (char *mf, char *xf) |
mac_font_match (char *mf, char *xf) |
10492 |
{ |
{ |
10493 |
char m_foundry[50], m_family[50], m_weight[20], m_slant[2], m_charset[20]; |
char m_foundry[50], m_family[50], m_weight[20], m_slant[2], m_charset[20]; |
10543 |
break; |
break; |
10544 |
case smKorean: |
case smKorean: |
10545 |
strcpy(cs, "ksc5601.1989-0"); |
strcpy(cs, "ksc5601.1989-0"); |
10546 |
break; |
break; |
10547 |
default: |
default: |
10548 |
strcpy(cs, "mac-roman"); |
strcpy(cs, "mac-roman"); |
10549 |
break; |
break; |
10553 |
sprintf(xf, "-%s-%s-%s-%c-normal--%d-%d-75-75-m-%d-%s", |
sprintf(xf, "-%s-%s-%s-%c-normal--%d-%d-75-75-m-%d-%s", |
10554 |
foundry, family, style & bold ? "bold" : "medium", |
foundry, family, style & bold ? "bold" : "medium", |
10555 |
style & italic ? 'i' : 'r', size, size * 10, size * 10, cs); |
style & italic ? 'i' : 'r', size, size * 10, size * 10, cs); |
10556 |
|
|
10557 |
result = (char *) xmalloc (strlen (xf) + 1); |
result = (char *) xmalloc (strlen (xf) + 1); |
10558 |
strcpy (result, xf); |
strcpy (result, xf); |
10559 |
for (p = result; *p; p++) |
for (p = result; *p; p++) |
10560 |
*p = tolower(*p); |
*p = tolower(*p); |
10561 |
return result; |
return result; |
10562 |
} |
} |
10563 |
|
|
10564 |
|
|
10565 |
/* Convert an X font spec to the corresponding mac font name, which |
/* Convert an X font spec to the corresponding mac font name, which |
10566 |
can then be passed to GetFNum after conversion to a Pascal string. |
can then be passed to GetFNum after conversion to a Pascal string. |
10622 |
{ |
{ |
10623 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
10624 |
SInt32 sv; |
SInt32 sv; |
10625 |
|
|
10626 |
if (Gestalt (gestaltSystemVersion, &sv) == noErr && sv >= 0x1000) |
if (Gestalt (gestaltSystemVersion, &sv) == noErr && sv >= 0x1000) |
10627 |
{ |
{ |
10628 |
FMFontFamilyIterator ffi; |
FMFontFamilyIterator ffi; |
10648 |
FMFontStyle style; |
FMFontStyle style; |
10649 |
FMFontSize size; |
FMFontSize size; |
10650 |
SInt16 sc; |
SInt16 sc; |
10651 |
|
|
10652 |
if (FMGetFontFamilyName (ff, name) != noErr) |
if (FMGetFontFamilyName (ff, name) != noErr) |
10653 |
break; |
break; |
10654 |
p2cstr (name); |
p2cstr (name); |
10655 |
|
|
10656 |
sc = FontToScript (ff); |
sc = FontToScript (ff); |
10657 |
|
|
10658 |
/* Point the instance iterator at the current font family. */ |
/* Point the instance iterator at the current font family. */ |
10659 |
if (FMResetFontFamilyInstanceIterator(ff, &ffii) != noErr) |
if (FMResetFontFamilyInstanceIterator(ff, &ffii) != noErr) |
10660 |
break; |
break; |
10661 |
|
|
10662 |
while (FMGetNextFontFamilyInstance (&ffii, &font, &style, &size) |
while (FMGetNextFontFamilyInstance (&ffii, &font, &style, &size) |
10663 |
== noErr) |
== noErr) |
10664 |
if (size == 0) |
if (size == 0) |
10683 |
-smJapanese)); |
-smJapanese)); |
10684 |
} |
} |
10685 |
} |
} |
10686 |
|
|
10687 |
/* Dispose of the iterators. */ |
/* Dispose of the iterators. */ |
10688 |
FMDisposeFontFamilyIterator (&ffi); |
FMDisposeFontFamilyIterator (&ffi); |
10689 |
FMDisposeFontFamilyInstanceIterator (&ffii); |
FMDisposeFontFamilyInstanceIterator (&ffii); |
10701 |
Str32 name; |
Str32 name; |
10702 |
struct FontAssoc *fat; |
struct FontAssoc *fat; |
10703 |
struct AsscEntry *assc_entry; |
struct AsscEntry *assc_entry; |
10704 |
|
|
10705 |
GetPort (&port); /* save the current font number used */ |
GetPort (&port); /* save the current font number used */ |
10706 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
10707 |
old_fontnum = GetPortTextFont (port); |
old_fontnum = GetPortTextFont (port); |
10714 |
font_handle = GetIndResource ('FOND', i); |
font_handle = GetIndResource ('FOND', i); |
10715 |
if (!font_handle) |
if (!font_handle) |
10716 |
continue; |
continue; |
10717 |
|
|
10718 |
GetResInfo (font_handle, &id, &type, name); |
GetResInfo (font_handle, &id, &type, name); |
10719 |
GetFNum (name, &fontnum); |
GetFNum (name, &fontnum); |
10720 |
p2cstr (name); |
p2cstr (name); |
10721 |
if (fontnum == 0) |
if (fontnum == 0) |
10722 |
continue; |
continue; |
10723 |
|
|
10724 |
TextFont (fontnum); |
TextFont (fontnum); |
10725 |
scriptcode = FontToScript (fontnum); |
scriptcode = FontToScript (fontnum); |
10726 |
do |
do |
10727 |
{ |
{ |
10728 |
HLock (font_handle); |
HLock (font_handle); |
10729 |
|
|
10730 |
if (GetResourceSizeOnDisk (font_handle) |
if (GetResourceSizeOnDisk (font_handle) |
10731 |
>= sizeof (struct FamRec)) |
>= sizeof (struct FamRec)) |
10732 |
{ |
{ |
10736 |
= (struct AsscEntry *) (*font_handle |
= (struct AsscEntry *) (*font_handle |
10737 |
+ sizeof (struct FamRec) |
+ sizeof (struct FamRec) |
10738 |
+ sizeof (struct FontAssoc)); |
+ sizeof (struct FontAssoc)); |
10739 |
|
|
10740 |
for (j = 0; j <= fat->numAssoc; j++, assc_entry++) |
for (j = 0; j <= fat->numAssoc; j++, assc_entry++) |
10741 |
{ |
{ |
10742 |
if (font_name_table_size == 0) |
if (font_name_table_size == 0) |
10770 |
} |
} |
10771 |
} |
} |
10772 |
} |
} |
10773 |
|
|
10774 |
HUnlock (font_handle); |
HUnlock (font_handle); |
10775 |
font_handle_2 = GetNextFOND (font_handle); |
font_handle_2 = GetNextFOND (font_handle); |
10776 |
ReleaseResource (font_handle); |
ReleaseResource (font_handle); |
10778 |
} |
} |
10779 |
while (ResError () == noErr && font_handle); |
while (ResError () == noErr && font_handle); |
10780 |
} |
} |
10781 |
|
|
10782 |
TextFont (old_fontnum); |
TextFont (old_fontnum); |
10783 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
10784 |
} |
} |
10836 |
break; |
break; |
10837 |
} |
} |
10838 |
} |
} |
10839 |
|
|
10840 |
/* MAC_TODO: add code for matching outline fonts here */ |
/* MAC_TODO: add code for matching outline fonts here */ |
10841 |
|
|
10842 |
UNGCPRO; |
UNGCPRO; |
10848 |
XCDR (dpyinfo->name_list_element))); |
XCDR (dpyinfo->name_list_element))); |
10849 |
} |
} |
10850 |
label_cached: |
label_cached: |
10851 |
|
|
10852 |
return newlist; |
return newlist; |
10853 |
} |
} |
10854 |
|
|
10869 |
xassert (font != NULL); |
xassert (font != NULL); |
10870 |
|
|
10871 |
for (i = 0; i < dpyinfo->n_fonts; i++) |
for (i = 0; i < dpyinfo->n_fonts; i++) |
10872 |
if (dpyinfo->font_table[i].name |
if (dpyinfo->font_table[i].name |
10873 |
&& font == dpyinfo->font_table[i].font) |
&& font == dpyinfo->font_table[i].font) |
10874 |
break; |
break; |
10875 |
|
|
10913 |
MacFontStruct *font; |
MacFontStruct *font; |
10914 |
int old_width = dpyinfo->smallest_char_width; |
int old_width = dpyinfo->smallest_char_width; |
10915 |
int old_height = dpyinfo->smallest_font_height; |
int old_height = dpyinfo->smallest_font_height; |
10916 |
|
|
10917 |
dpyinfo->smallest_font_height = 100000; |
dpyinfo->smallest_font_height = 100000; |
10918 |
dpyinfo->smallest_char_width = 100000; |
dpyinfo->smallest_char_width = 100000; |
10919 |
|
|
10920 |
for (i = 0; i < dpyinfo->n_fonts; ++i) |
for (i = 0; i < dpyinfo->n_fonts; ++i) |
10921 |
if (dpyinfo->font_table[i].name) |
if (dpyinfo->font_table[i].name) |
10922 |
{ |
{ |
10923 |
struct font_info *fontp = dpyinfo->font_table + i; |
struct font_info *fontp = dpyinfo->font_table + i; |
10924 |
int w, h; |
int w, h; |
10925 |
|
|
10926 |
font = (MacFontStruct *) fontp->font; |
font = (MacFontStruct *) fontp->font; |
10927 |
xassert (font != (MacFontStruct *) ~0); |
xassert (font != (MacFontStruct *) ~0); |
10928 |
x_font_min_bounds (font, &w, &h); |
x_font_min_bounds (font, &w, &h); |
10929 |
|
|
10930 |
dpyinfo->smallest_font_height = min (dpyinfo->smallest_font_height, h); |
dpyinfo->smallest_font_height = min (dpyinfo->smallest_font_height, h); |
10931 |
dpyinfo->smallest_char_width = min (dpyinfo->smallest_char_width, w); |
dpyinfo->smallest_char_width = min (dpyinfo->smallest_char_width, w); |
10932 |
} |
} |
10951 |
|
|
10952 |
if (*p != '-') |
if (*p != '-') |
10953 |
return 0; |
return 0; |
10954 |
|
|
10955 |
for (i = 0; i < 13; i++) |
for (i = 0; i < 13; i++) |
10956 |
{ |
{ |
10957 |
q = strchr (p + 1, '-'); |
q = strchr (p + 1, '-'); |
10964 |
|
|
10965 |
if (strchr (p + 1, '-') != NULL) |
if (strchr (p + 1, '-') != NULL) |
10966 |
return 0; |
return 0; |
10967 |
|
|
10968 |
if (*(p + 1) == '*' && *(p + 2) == '\0') |
if (*(p + 1) == '*' && *(p + 2) == '\0') |
10969 |
return 0; |
return 0; |
10970 |
|
|
11006 |
|
|
11007 |
if (i >= font_name_count) |
if (i >= font_name_count) |
11008 |
return NULL; |
return NULL; |
11009 |
|
|
11010 |
name = font_name_table[i]; |
name = font_name_table[i]; |
11011 |
} |
} |
11012 |
|
|
11037 |
GetFNum (mfontname, &fontnum); |
GetFNum (mfontname, &fontnum); |
11038 |
if (fontnum == 0) |
if (fontnum == 0) |
11039 |
return NULL; |
return NULL; |
11040 |
|
|
11041 |
font = (MacFontStruct *) xmalloc (sizeof (struct MacFontStruct)); |
font = (MacFontStruct *) xmalloc (sizeof (struct MacFontStruct)); |
11042 |
|
|
11043 |
font->fontname = (char *) xmalloc (strlen (name) + 1); |
font->fontname = (char *) xmalloc (strlen (name) + 1); |
11044 |
bcopy (name, font->fontname, strlen (name) + 1); |
bcopy (name, font->fontname, strlen (name) + 1); |
11045 |
|
|
11055 |
{ |
{ |
11056 |
char cs[32]; |
char cs[32]; |
11057 |
|
|
11058 |
if (sscanf (name, |
if (sscanf (name, |
11059 |
"-%*[^-]-%*[^-]-%*[^-]-%*c-%*[^-]--%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*c-%*[^-]-%31s", |
"-%*[^-]-%*[^-]-%*[^-]-%*c-%*[^-]--%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*c-%*[^-]-%31s", |
11060 |
cs) == 1 |
cs) == 1 |
11061 |
&& 0 == strcmp (cs, "jisx0201.1976-0")) |
&& 0 == strcmp (cs, "jisx0201.1976-0")) |
11062 |
font->mac_scriptcode = smRoman; |
font->mac_scriptcode = smRoman; |
11063 |
} |
} |
11064 |
|
|
11065 |
is_two_byte_font = font->mac_scriptcode == smJapanese || |
is_two_byte_font = font->mac_scriptcode == smJapanese || |
11066 |
font->mac_scriptcode == smTradChinese || |
font->mac_scriptcode == smTradChinese || |
11067 |
font->mac_scriptcode == smSimpChinese || |
font->mac_scriptcode == smSimpChinese || |
11070 |
TextFont (fontnum); |
TextFont (fontnum); |
11071 |
TextSize (size); |
TextSize (size); |
11072 |
TextFace (fontface); |
TextFace (fontface); |
11073 |
|
|
11074 |
GetFontInfo (&the_fontinfo); |
GetFontInfo (&the_fontinfo); |
11075 |
|
|
11076 |
font->ascent = the_fontinfo.ascent; |
font->ascent = the_fontinfo.ascent; |
11083 |
font->max_byte1 = 0; |
font->max_byte1 = 0; |
11084 |
font->min_char_or_byte2 = 0x20; |
font->min_char_or_byte2 = 0x20; |
11085 |
font->max_char_or_byte2 = 0xff; |
font->max_char_or_byte2 = 0xff; |
11086 |
|
|
11087 |
if (is_two_byte_font) |
if (is_two_byte_font) |
11088 |
{ |
{ |
11089 |
/* Use the width of an "ideographic space" of that font because |
/* Use the width of an "ideographic space" of that font because |
11125 |
xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1)); |
xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1)); |
11126 |
{ |
{ |
11127 |
int c; |
int c; |
11128 |
|
|
11129 |
for (c = 0x20; c <= 0xff; c++) |
for (c = 0x20; c <= 0xff; c++) |
11130 |
{ |
{ |
11131 |
font->per_char[c - 0x20] = font->max_bounds; |
font->per_char[c - 0x20] = font->max_bounds; |
11133 |
} |
} |
11134 |
} |
} |
11135 |
} |
} |
11136 |
|
|
11137 |
TextFont (old_fontnum); /* restore previous font number, size and face */ |
TextFont (old_fontnum); /* restore previous font number, size and face */ |
11138 |
TextSize (old_fontsize); |
TextSize (old_fontsize); |
11139 |
TextFace (old_fontface); |
TextFace (old_fontface); |
11140 |
|
|
11141 |
return font; |
return font; |
11142 |
} |
} |
11143 |
|
|
11531 |
|
|
11532 |
/* Drag and Drop */ |
/* Drag and Drop */ |
11533 |
static OSErr init_mac_drag_n_drop (); |
static OSErr init_mac_drag_n_drop (); |
11534 |
static pascal OSErr mac_do_receive_drag (WindowPtr, void*, DragReference); |
static pascal OSErr mac_do_receive_drag (WindowPtr, void*, DragReference); |
11535 |
|
|
11536 |
#if USE_CARBON_EVENTS |
#if USE_CARBON_EVENTS |
11537 |
/* Preliminary Support for the OSX Services Menu */ |
/* Preliminary Support for the OSX Services Menu */ |
11546 |
extern void initialize_applescript(); |
extern void initialize_applescript(); |
11547 |
extern void terminate_applescript(); |
extern void terminate_applescript(); |
11548 |
|
|
11549 |
static unsigned int |
static unsigned int |
11550 |
#if USE_CARBON_EVENTS |
#if USE_CARBON_EVENTS |
11551 |
mac_to_emacs_modifiers (UInt32 mods) |
mac_to_emacs_modifiers (UInt32 mods) |
11552 |
#else |
#else |
11568 |
#if USE_CARBON_EVENTS |
#if USE_CARBON_EVENTS |
11569 |
/* Obtains the event modifiers from the event ref and then calls |
/* Obtains the event modifiers from the event ref and then calls |
11570 |
mac_to_emacs_modifiers. */ |
mac_to_emacs_modifiers. */ |
11571 |
static int |
static int |
11572 |
mac_event_to_emacs_modifiers (EventRef eventRef) |
mac_event_to_emacs_modifiers (EventRef eventRef) |
11573 |
{ |
{ |
11574 |
UInt32 mods = 0; |
UInt32 mods = 0; |
11575 |
GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL, |
GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL, |
11580 |
/* Given an event ref, return the code to use for the mouse button |
/* Given an event ref, return the code to use for the mouse button |
11581 |
code in the emacs input_event. */ |
code in the emacs input_event. */ |
11582 |
static int |
static int |
11583 |
mac_get_mouse_btn (EventRef ref) |
mac_get_mouse_btn (EventRef ref) |
11584 |
{ |
{ |
11585 |
EventMouseButton result = kEventMouseButtonPrimary; |
EventMouseButton result = kEventMouseButtonPrimary; |
11586 |
GetEventParameter (ref, kEventParamMouseButton, typeMouseButton, NULL, |
GetEventParameter (ref, kEventParamMouseButton, typeMouseButton, NULL, |
11587 |
sizeof (EventMouseButton), NULL, &result); |
sizeof (EventMouseButton), NULL, &result); |
11588 |
switch (result) |
switch (result) |
11589 |
{ |
{ |
11590 |
case kEventMouseButtonPrimary: |
case kEventMouseButtonPrimary: |
11591 |
return 0; |
return 0; |
11592 |
case kEventMouseButtonSecondary: |
case kEventMouseButtonSecondary: |
11593 |
return NILP (Vmac_wheel_button_is_mouse_2) ? 1 : 2; |
return NILP (Vmac_wheel_button_is_mouse_2) ? 1 : 2; |
11594 |
case kEventMouseButtonTertiary: |
case kEventMouseButtonTertiary: |
11595 |
case 4: /* 4 is the number for the mouse wheel button */ |
case 4: /* 4 is the number for the mouse wheel button */ |
11596 |
return NILP (Vmac_wheel_button_is_mouse_2) ? 2 : 1; |
return NILP (Vmac_wheel_button_is_mouse_2) ? 2 : 1; |
11597 |
default: |
default: |
11598 |
return 0; |
return 0; |
11599 |
} |
} |
11605 |
checks to see if it is a mouse up or down carbon event that has not |
checks to see if it is a mouse up or down carbon event that has not |
11606 |
been converted, and if so, converts it by hand (to be picked up in |
been converted, and if so, converts it by hand (to be picked up in |
11607 |
the XTread_socket loop). */ |
the XTread_socket loop). */ |
11608 |
static Boolean mac_convert_event_ref (EventRef eventRef, EventRecord *eventRec) |
static Boolean mac_convert_event_ref (EventRef eventRef, EventRecord *eventRec) |
11609 |
{ |
{ |
11610 |
Boolean result = ConvertEventRefToEventRecord (eventRef, eventRec); |
Boolean result = ConvertEventRefToEventRecord (eventRef, eventRec); |
11611 |
/* Do special case for mouse wheel button. */ |
/* Do special case for mouse wheel button. */ |
11612 |
if (!result && GetEventClass (eventRef) == kEventClassMouse) |
if (!result && GetEventClass (eventRef) == kEventClassMouse) |
11613 |
{ |
{ |
11614 |
UInt32 kind = GetEventKind (eventRef); |
UInt32 kind = GetEventKind (eventRef); |
11615 |
if (kind == kEventMouseDown && !(eventRec->what == mouseDown)) |
if (kind == kEventMouseDown && !(eventRec->what == mouseDown)) |
11616 |
{ |
{ |
11617 |
eventRec->what = mouseDown; |
eventRec->what = mouseDown; |
11618 |
result=1; |
result=1; |
11619 |
} |
} |
11620 |
if (kind == kEventMouseUp && !(eventRec->what == mouseUp)) |
if (kind == kEventMouseUp && !(eventRec->what == mouseUp)) |
11621 |
{ |
{ |
11622 |
eventRec->what = mouseUp; |
eventRec->what = mouseUp; |
11623 |
result=1; |
result=1; |
11624 |
} |
} |
11625 |
if (result) |
if (result) |
11626 |
{ |
{ |
11627 |
/* Need where and when. */ |
/* Need where and when. */ |
11628 |
UInt32 mods; |
UInt32 mods; |
11636 |
typeUInt32, NULL, sizeof (UInt32), |
typeUInt32, NULL, sizeof (UInt32), |
11637 |
NULL, &mods); |
NULL, &mods); |
11638 |
eventRec->modifiers = mods; |
eventRec->modifiers = mods; |
11639 |
|
|
11640 |
eventRec->when = EventTimeToTicks (GetEventTime (eventRef)); |
eventRec->when = EventTimeToTicks (GetEventTime (eventRef)); |
11641 |
} |
} |
11642 |
} |
} |
11650 |
{ |
{ |
11651 |
Handle menubar_handle; |
Handle menubar_handle; |
11652 |
MenuHandle menu_handle; |
MenuHandle menu_handle; |
11653 |
|
|
11654 |
menubar_handle = GetNewMBar (128); |
menubar_handle = GetNewMBar (128); |
11655 |
if(menubar_handle == NULL) |
if(menubar_handle == NULL) |
11656 |
abort (); |
abort (); |
11678 |
InitDialogs (NULL); |
InitDialogs (NULL); |
11679 |
#endif /* !TARGET_API_MAC_CARBON */ |
#endif /* !TARGET_API_MAC_CARBON */ |
11680 |
InitCursor (); |
InitCursor (); |
11681 |
|
|
11682 |
#if !TARGET_API_MAC_CARBON |
#if !TARGET_API_MAC_CARBON |
11683 |
/* set up some extra stack space for use by emacs */ |
/* set up some extra stack space for use by emacs */ |
11684 |
SetApplLimit ((Ptr) ((long) GetApplLimit () - EXTRA_STACK_ALLOC)); |
SetApplLimit ((Ptr) ((long) GetApplLimit () - EXTRA_STACK_ALLOC)); |
11694 |
do_check_ram_size (void) |
do_check_ram_size (void) |
11695 |
{ |
{ |
11696 |
SInt32 physical_ram_size, logical_ram_size; |
SInt32 physical_ram_size, logical_ram_size; |
11697 |
|
|
11698 |
if (Gestalt (gestaltPhysicalRAMSize, &physical_ram_size) != noErr |
if (Gestalt (gestaltPhysicalRAMSize, &physical_ram_size) != noErr |
11699 |
|| Gestalt (gestaltLogicalRAMSize, &logical_ram_size) != noErr |
|| Gestalt (gestaltLogicalRAMSize, &logical_ram_size) != noErr |
11700 |
|| physical_ram_size > 256 * 1024 * 1024 |
|| physical_ram_size > 256 * 1024 * 1024 |
11718 |
f->async_visible = 1; |
f->async_visible = 1; |
11719 |
f->async_iconified = 0; |
f->async_iconified = 0; |
11720 |
SET_FRAME_GARBAGED (f); |
SET_FRAME_GARBAGED (f); |
11721 |
|
|
11722 |
/* An update event is equivalent to MapNotify on X, so report |
/* An update event is equivalent to MapNotify on X, so report |
11723 |
visibility changes properly. */ |
visibility changes properly. */ |
11724 |
if (! NILP(Vframe_list) && ! NILP (XCDR (Vframe_list))) |
if (! NILP(Vframe_list) && ! NILP (XCDR (Vframe_list))) |
11767 |
{ |
{ |
11768 |
mwp = (mac_output *) GetWRefCon (win); |
mwp = (mac_output *) GetWRefCon (win); |
11769 |
f = mwp->mFP; |
f = mwp->mFP; |
11770 |
|
|
11771 |
if (f) |
if (f) |
11772 |
{ |
{ |
11773 |
x_new_focus_frame (FRAME_MAC_DISPLAY_INFO (f), f); |
x_new_focus_frame (FRAME_MAC_DISPLAY_INFO (f), f); |
11786 |
{ |
{ |
11787 |
mwp = (mac_output *) GetWRefCon (win); |
mwp = (mac_output *) GetWRefCon (win); |
11788 |
f = mwp->mFP; |
f = mwp->mFP; |
11789 |
|
|
11790 |
if (f == FRAME_MAC_DISPLAY_INFO (f)->x_focus_frame) |
if (f == FRAME_MAC_DISPLAY_INFO (f)->x_focus_frame) |
11791 |
{ |
{ |
11792 |
x_new_focus_frame (FRAME_MAC_DISPLAY_INFO (f), 0); |
x_new_focus_frame (FRAME_MAC_DISPLAY_INFO (f), 0); |
11850 |
WindowPtr wp = FrontWindow (); |
WindowPtr wp = FrontWindow (); |
11851 |
struct frame *f; |
struct frame *f; |
11852 |
|
|
11853 |
if (is_emacs_window (wp)) |
if (is_emacs_window (wp)) |
11854 |
{ |
{ |
11855 |
f = ((mac_output *) GetWRefCon (wp))->mFP; |
f = ((mac_output *) GetWRefCon (wp))->mFP; |
11856 |
|
|
11857 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
11858 |
SetPort (GetWindowPort (wp)); |
SetPort (GetWindowPort (wp)); |
11859 |
#else |
#else |
11861 |
#endif |
#endif |
11862 |
|
|
11863 |
GlobalToLocal (&mouse_pos); |
GlobalToLocal (&mouse_pos); |
11864 |
|
|
11865 |
note_mouse_movement (f, &mouse_pos); |
note_mouse_movement (f, &mouse_pos); |
11866 |
} |
} |
11867 |
} |
} |
11878 |
else |
else |
11879 |
do_app_suspend (); |
do_app_suspend (); |
11880 |
break; |
break; |
11881 |
|
|
11882 |
case mouseMovedMessage: |
case mouseMovedMessage: |
11883 |
do_mouse_moved (erp->where); |
do_mouse_moved (erp->where); |
11884 |
break; |
break; |
11913 |
#if !TARGET_API_MAC_CARBON |
#if !TARGET_API_MAC_CARBON |
11914 |
Str255 item_name; |
Str255 item_name; |
11915 |
SInt16 da_driver_refnum; |
SInt16 da_driver_refnum; |
11916 |
|
|
11917 |
if (menu_item == I_ABOUT) |
if (menu_item == I_ABOUT) |
11918 |
NoteAlert (ABOUT_ALERT_ID, NULL); |
NoteAlert (ABOUT_ALERT_ID, NULL); |
11919 |
else |
else |
11928 |
do_menu_choice (SInt32 menu_choice) |
do_menu_choice (SInt32 menu_choice) |
11929 |
{ |
{ |
11930 |
SInt16 menu_id, menu_item; |
SInt16 menu_id, menu_item; |
11931 |
|
|
11932 |
menu_id = HiWord (menu_choice); |
menu_id = HiWord (menu_choice); |
11933 |
menu_item = LoWord (menu_choice); |
menu_item = LoWord (menu_choice); |
11934 |
|
|
11935 |
if (menu_id == 0) |
if (menu_id == 0) |
11936 |
return; |
return; |
11937 |
|
|
11938 |
switch (menu_id) |
switch (menu_id) |
11939 |
{ |
{ |
11940 |
case M_APPLE: |
case M_APPLE: |
11944 |
default: |
default: |
11945 |
{ |
{ |
11946 |
WindowPtr wp = FrontWindow (); |
WindowPtr wp = FrontWindow (); |
11947 |
struct frame *f = ((mac_output *) GetWRefCon (wp))->mFP; |
struct frame *f = ((mac_output *) GetWRefCon (wp))->mFP; |
11948 |
MenuHandle menu = GetMenuHandle (menu_id); |
MenuHandle menu = GetMenuHandle (menu_id); |
11949 |
if (menu) |
if (menu) |
11950 |
{ |
{ |
11951 |
UInt32 refcon; |
UInt32 refcon; |
11952 |
|
|
11953 |
GetMenuItemRefCon (menu, menu_item, &refcon); |
GetMenuItemRefCon (menu, menu_item, &refcon); |
11954 |
menubar_selection_callback (f, refcon); |
menubar_selection_callback (f, refcon); |
11955 |
} |
} |
11956 |
} |
} |
11957 |
} |
} |
11958 |
|
|
11959 |
HiliteMenu (0); |
HiliteMenu (0); |
11960 |
} |
} |
11961 |
|
|
11971 |
int rows, columns; |
int rows, columns; |
11972 |
mac_output *mwp = (mac_output *) GetWRefCon (w); |
mac_output *mwp = (mac_output *) GetWRefCon (w); |
11973 |
struct frame *f = mwp->mFP; |
struct frame *f = mwp->mFP; |
11974 |
|
|
11975 |
SetRect(&limit_rect, MIN_DOC_SIZE, MIN_DOC_SIZE, MAX_DOC_SIZE, MAX_DOC_SIZE); |
SetRect(&limit_rect, MIN_DOC_SIZE, MIN_DOC_SIZE, MAX_DOC_SIZE, MAX_DOC_SIZE); |
11976 |
|
|
11977 |
grow_size = GrowWindow (w, e->where, &limit_rect); |
grow_size = GrowWindow (w, e->where, &limit_rect); |
11978 |
|
|
11979 |
/* see if it really changed size */ |
/* see if it really changed size */ |
11980 |
if (grow_size != 0) |
if (grow_size != 0) |
11981 |
{ |
{ |
11982 |
rows = PIXEL_TO_CHAR_HEIGHT (f, HiWord (grow_size)); |
rows = PIXEL_TO_CHAR_HEIGHT (f, HiWord (grow_size)); |
11983 |
columns = PIXEL_TO_CHAR_WIDTH (f, LoWord (grow_size)); |
columns = PIXEL_TO_CHAR_WIDTH (f, LoWord (grow_size)); |
11984 |
|
|
11985 |
x_set_window_size (f, 0, columns, rows); |
x_set_window_size (f, 0, columns, rows); |
11986 |
} |
} |
11987 |
} |
} |
12001 |
int w_title_height, columns, rows, width, height, dummy, x, y; |
int w_title_height, columns, rows, width, height, dummy, x, y; |
12002 |
mac_output *mwp = (mac_output *) GetWRefCon (w); |
mac_output *mwp = (mac_output *) GetWRefCon (w); |
12003 |
struct frame *f = mwp->mFP; |
struct frame *f = mwp->mFP; |
12004 |
|
|
12005 |
GetPort (&save_port); |
GetPort (&save_port); |
12006 |
|
|
12007 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
12015 |
{ |
{ |
12016 |
Rect r; |
Rect r; |
12017 |
BitMap bm; |
BitMap bm; |
12018 |
|
|
12019 |
GetWindowPortBounds (w, &r); |
GetWindowPortBounds (w, &r); |
12020 |
EraseRect (&r); |
EraseRect (&r); |
12021 |
|
|
12030 |
zoom_rect = bm.bounds; |
zoom_rect = bm.bounds; |
12031 |
zoom_rect.top += w_title_height; |
zoom_rect.top += w_title_height; |
12032 |
InsetRect (&zoom_rect, 8, 4); /* not too tight */ |
InsetRect (&zoom_rect, 8, 4); /* not too tight */ |
12033 |
|
|
12034 |
zoom_rect.right = zoom_rect.left |
zoom_rect.right = zoom_rect.left |
12035 |
+ CHAR_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); |
+ CHAR_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); |
12036 |
|
|
12052 |
zoom_rect = qd.screenBits.bounds; |
zoom_rect = qd.screenBits.bounds; |
12053 |
zoom_rect.top += w_title_height; |
zoom_rect.top += w_title_height; |
12054 |
InsetRect (&zoom_rect, 8, 4); /* not too tight */ |
InsetRect (&zoom_rect, 8, 4); /* not too tight */ |
12055 |
|
|
12056 |
zoom_rect.right = zoom_rect.left |
zoom_rect.right = zoom_rect.left |
12057 |
+ CHAR_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); |
+ CHAR_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); |
12058 |
|
|
12098 |
|
|
12099 |
if (!(result & (1 << gestaltAppleEventsPresent))) |
if (!(result & (1 << gestaltAppleEventsPresent))) |
12100 |
abort (); |
abort (); |
12101 |
|
|
12102 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
12103 |
err = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, |
err = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, |
12104 |
NewAEEventHandlerUPP |
NewAEEventHandlerUPP |
12175 |
mac_handle_service_event (EventHandlerCallRef callRef, |
mac_handle_service_event (EventHandlerCallRef callRef, |
12176 |
EventRef event, void *data) |
EventRef event, void *data) |
12177 |
{ |
{ |
12178 |
OSStatus err = noErr; |
OSStatus err = noErr; |
12179 |
switch (GetEventKind (event)) |
switch (GetEventKind (event)) |
12180 |
{ |
{ |
12181 |
case kEventServiceGetTypes: |
case kEventServiceGetTypes: |
12182 |
{ |
{ |
12183 |
CFMutableArrayRef copyTypes, pasteTypes; |
CFMutableArrayRef copyTypes, pasteTypes; |
12184 |
CFStringRef type; |
CFStringRef type; |
12214 |
{ |
{ |
12215 |
GetEventParameter (event, kEventParamScrapRef, typeScrapRef, NULL, |
GetEventParameter (event, kEventParamScrapRef, typeScrapRef, NULL, |
12216 |
sizeof (ScrapRef), NULL, &specificScrap); |
sizeof (ScrapRef), NULL, &specificScrap); |
12217 |
|
|
12218 |
err = GetScrapFlavorData (currentScrap, kScrapFlavorTypeText, |
err = GetScrapFlavorData (currentScrap, kScrapFlavorTypeText, |
12219 |
&byteCount, buffer); |
&byteCount, buffer); |
12220 |
if (err == noErr) |
if (err == noErr) |
12221 |
PutScrapFlavor (specificScrap, kScrapFlavorTypeText, |
PutScrapFlavor (specificScrap, kScrapFlavorTypeText, |
12222 |
kScrapFlavorMaskNone, byteCount, buffer); |
kScrapFlavorMaskNone, byteCount, buffer); |
12223 |
xfree (buffer); |
xfree (buffer); |
12224 |
} |
} |
12225 |
} |
} |
12226 |
err = noErr; |
err = noErr; |
12227 |
} |
} |
12237 |
if (err == noErr) { |
if (err == noErr) { |
12238 |
void * buffer = xmalloc(byteCount); |
void * buffer = xmalloc(byteCount); |
12239 |
if (buffer != NULL ) { |
if (buffer != NULL ) { |
12240 |
err = GetScrapFlavorData(specificScrap, kScrapFlavorTypeText, |
err = GetScrapFlavorData(specificScrap, kScrapFlavorTypeText, |
12241 |
&byteCount, buffer); |
&byteCount, buffer); |
12242 |
if (err == noErr) { |
if (err == noErr) { |
12243 |
// Actually place in the buffer |
// Actually place in the buffer |
12249 |
xfree(buffer); |
xfree(buffer); |
12250 |
} |
} |
12251 |
*/ |
*/ |
12252 |
} |
} |
12253 |
} |
} |
12254 |
return err; |
return err; |
12255 |
} |
} |
12271 |
/* Called when we receive an AppleEvent with an ID of |
/* Called when we receive an AppleEvent with an ID of |
12272 |
"kAEOpenDocuments". This routine gets the direct parameter, |
"kAEOpenDocuments". This routine gets the direct parameter, |
12273 |
extracts the FSSpecs in it, and puts their names on a list. */ |
extracts the FSSpecs in it, and puts their names on a list. */ |
12274 |
static pascal OSErr |
static pascal OSErr |
12275 |
do_ae_open_documents(AppleEvent *message, AppleEvent *reply, long refcon) |
do_ae_open_documents(AppleEvent *message, AppleEvent *reply, long refcon) |
12276 |
{ |
{ |
12277 |
OSErr err, err2; |
OSErr err, err2; |
12287 |
/* Check to see that we got all of the required parameters from the |
/* Check to see that we got all of the required parameters from the |
12288 |
event descriptor. For an 'odoc' event this should just be the |
event descriptor. For an 'odoc' event this should just be the |
12289 |
file list. */ |
file list. */ |
12290 |
err = AEGetAttributePtr(message, keyMissedKeywordAttr, typeWildCard, |
err = AEGetAttributePtr(message, keyMissedKeywordAttr, typeWildCard, |
12291 |
&actual_type, (Ptr) &keyword, |
&actual_type, (Ptr) &keyword, |
12292 |
sizeof (keyword), &actual_size); |
sizeof (keyword), &actual_size); |
12293 |
/* No error means that we found some unused parameters. |
/* No error means that we found some unused parameters. |
12309 |
if (err == noErr) |
if (err == noErr) |
12310 |
{ |
{ |
12311 |
int i; |
int i; |
12312 |
|
|
12313 |
/* AE file list is one based so just use that for indexing here. */ |
/* AE file list is one based so just use that for indexing here. */ |
12314 |
for (i = 1; (err == noErr) && (i <= num_files_to_open); i++) |
for (i = 1; (err == noErr) && (i <= num_files_to_open); i++) |
12315 |
{ |
{ |
12366 |
drag_and_drop_file_list = Qnil; |
drag_and_drop_file_list = Qnil; |
12367 |
GetDragMouse (theDrag, &mouse, 0L); |
GetDragMouse (theDrag, &mouse, 0L); |
12368 |
CountDragItems (theDrag, &items); |
CountDragItems (theDrag, &items); |
12369 |
for (index = 1; index <= items; index++) |
for (index = 1; index <= items; index++) |
12370 |
{ |
{ |
12371 |
/* Only handle file references. */ |
/* Only handle file references. */ |
12372 |
GetDragItemReferenceNumber (theDrag, index, &theItem); |
GetDragItemReferenceNumber (theDrag, index, &theItem); |
12398 |
} |
} |
12399 |
/* If there are items in the list, construct an event and post it to |
/* If there are items in the list, construct an event and post it to |
12400 |
the queue like an interrupt using kbd_buffer_store_event. */ |
the queue like an interrupt using kbd_buffer_store_event. */ |
12401 |
if (!NILP (drag_and_drop_file_list)) |
if (!NILP (drag_and_drop_file_list)) |
12402 |
{ |
{ |
12403 |
struct input_event event; |
struct input_event event; |
12404 |
Lisp_Object frame; |
Lisp_Object frame; |
12479 |
|
|
12480 |
#if !TARGET_API_MAC_CARBON |
#if !TARGET_API_MAC_CARBON |
12481 |
#undef main |
#undef main |
12482 |
int |
int |
12483 |
main (void) |
main (void) |
12484 |
{ |
{ |
12485 |
#if __profile__ /* is the profiler on? */ |
#if __profile__ /* is the profiler on? */ |
12494 |
#endif |
#endif |
12495 |
|
|
12496 |
do_init_managers (); |
do_init_managers (); |
12497 |
|
|
12498 |
do_get_menus (); |
do_get_menus (); |
12499 |
|
|
12500 |
do_check_ram_size (); |
do_check_ram_size (); |
12501 |
|
|
12502 |
init_emacs_passwd_dir (); |
init_emacs_passwd_dir (); |
12506 |
initialize_applescript (); |
initialize_applescript (); |
12507 |
|
|
12508 |
init_required_apple_events (); |
init_required_apple_events (); |
12509 |
|
|
12510 |
{ |
{ |
12511 |
char **argv; |
char **argv; |
12512 |
int argc = 0; |
int argc = 0; |
12544 |
/*0x38*/ 0, 0, 0, 0, |
/*0x38*/ 0, 0, 0, 0, |
12545 |
/*0x3C*/ 0, 0, 0, 0, |
/*0x3C*/ 0, 0, 0, 0, |
12546 |
|
|
12547 |
/*0x40*/ 0, 0xae /*kp-.*/, 0, 0xaa /*kp-**/, |
/*0x40*/ 0, 0xae /*kp-.*/, 0, 0xaa /*kp-**/, |
12548 |
/*0x44*/ 0, 0xab /*kp-+*/, 0, 0x7f /*kp-clear*/, |
/*0x44*/ 0, 0xab /*kp-+*/, 0, 0x7f /*kp-clear*/, |
12549 |
/*0x48*/ 0, 0, 0, 0xaf /*kp-/*/, |
/*0x48*/ 0, 0, 0, 0xaf /*kp-/*/, |
12550 |
/*0x4C*/ 0x8d /*kp-enter*/, 0, 0xad /*kp--*/, 0, |
/*0x4C*/ 0x8d /*kp-enter*/, 0, 0xad /*kp--*/, 0, |
12555 |
/*0x5C*/ 0xb9 /*kp-9*/, 0, 0, 0, |
/*0x5C*/ 0xb9 /*kp-9*/, 0, 0, 0, |
12556 |
|
|
12557 |
/*0x60*/ 0xc2 /*f5*/, 0xc3 /*f6*/, 0xc4 /*f7*/, 0xc0 /*f3*/, |
/*0x60*/ 0xc2 /*f5*/, 0xc3 /*f6*/, 0xc4 /*f7*/, 0xc0 /*f3*/, |
12558 |
/*0x64*/ 0xc5 /*f8*/, 0xc6 /*f9*/, 0, 0xc8 /*f11*/, |
/*0x64*/ 0xc5 /*f8*/, 0xc6 /*f9*/, 0, 0xc8 /*f11*/, |
12559 |
/*0x68*/ 0, 0xca /*f13*/, 0, 0xcb /*f14*/, |
/*0x68*/ 0, 0xca /*f13*/, 0, 0xcb /*f14*/, |
12560 |
/*0x6C*/ 0, 0xc7 /*f10*/, 0, 0xc9 /*f12*/, |
/*0x6C*/ 0, 0xc7 /*f10*/, 0, 0xc9 /*f12*/, |
12561 |
|
|
12562 |
/*0x70*/ 0, 0xcc /*f15*/, 0x9e /*insert (or 0x6a==help)*/, 0x95 /*home*/, |
/*0x70*/ 0, 0xcc /*f15*/, 0x9e /*insert (or 0x6a==help)*/, 0x95 /*home*/, |
12577 |
int |
int |
12578 |
XTread_socket (int sd, struct input_event *bufp, int numchars, int expected) |
XTread_socket (int sd, struct input_event *bufp, int numchars, int expected) |
12579 |
{ |
{ |
12580 |
int count = 0; |
int count = 0; |
12581 |
#if USE_CARBON_EVENTS |
#if USE_CARBON_EVENTS |
12582 |
OSStatus rneResult; |
OSStatus rneResult; |
12583 |
EventRef eventRef; |
EventRef eventRef; |
12629 |
event_mask -= highLevelEventMask; |
event_mask -= highLevelEventMask; |
12630 |
|
|
12631 |
#if USE_CARBON_EVENTS |
#if USE_CARBON_EVENTS |
12632 |
rneResult = ReceiveNextEvent (0, NULL, |
rneResult = ReceiveNextEvent (0, NULL, |
12633 |
expected |
expected |
12634 |
? TicksToEventTime (app_sleep_time) |
? TicksToEventTime (app_sleep_time) |
12635 |
: 0, |
: 0, |
12637 |
if (!rneResult) |
if (!rneResult) |
12638 |
{ |
{ |
12639 |
/* Handle new events */ |
/* Handle new events */ |
12640 |
if (!mac_convert_event_ref (eventRef, &er)) |
if (!mac_convert_event_ref (eventRef, &er)) |
12641 |
switch (GetEventClass (eventRef)) |
switch (GetEventClass (eventRef)) |
12642 |
{ |
{ |
12643 |
case kEventClassMouse: |
case kEventClassMouse: |
12644 |
if (GetEventKind (eventRef) == kEventMouseWheelMoved) |
if (GetEventKind (eventRef) == kEventMouseWheelMoved) |
12645 |
{ |
{ |
12646 |
SInt32 delta; |
SInt32 delta; |
12647 |
Point point; |
Point point; |
12671 |
bufp->timestamp = EventTimeToTicks (GetEventTime (eventRef))*(1000/60); |
bufp->timestamp = EventTimeToTicks (GetEventTime (eventRef))*(1000/60); |
12672 |
count++; |
count++; |
12673 |
} |
} |
12674 |
else |
else |
12675 |
SendEventToEventTarget (eventRef, GetEventDispatcherTarget ()); |
SendEventToEventTarget (eventRef, GetEventDispatcherTarget ()); |
12676 |
|
|
12677 |
break; |
break; |
12707 |
{ |
{ |
12708 |
struct mac_output *mwp = (mac_output *) GetWRefCon (window_ptr); |
struct mac_output *mwp = (mac_output *) GetWRefCon (window_ptr); |
12709 |
Point mouse_loc = er.where; |
Point mouse_loc = er.where; |
12710 |
|
|
12711 |
/* Convert to local coordinates of new window. */ |
/* Convert to local coordinates of new window. */ |
12712 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
12713 |
SetPort (GetWindowPort (window_ptr)); |
SetPort (GetWindowPort (window_ptr)); |
12716 |
#endif |
#endif |
12717 |
|
|
12718 |
GlobalToLocal (&mouse_loc); |
GlobalToLocal (&mouse_loc); |
12719 |
|
|
12720 |
#if USE_CARBON_EVENTS |
#if USE_CARBON_EVENTS |
12721 |
bufp->code = mac_get_mouse_btn (eventRef); |
bufp->code = mac_get_mouse_btn (eventRef); |
12722 |
#else |
#else |
12736 |
|
|
12737 |
XSETINT (bufp->x, tracked_scroll_bar->left + 2); |
XSETINT (bufp->x, tracked_scroll_bar->left + 2); |
12738 |
XSETINT (bufp->y, mouse_loc.v - 24); |
XSETINT (bufp->y, mouse_loc.v - 24); |
12739 |
tracked_scroll_bar->dragging = Qnil; |
tracked_scroll_bar->dragging = Qnil; |
12740 |
mouse_tracking_in_progress = mouse_tracking_none; |
mouse_tracking_in_progress = mouse_tracking_none; |
12741 |
tracked_scroll_bar = NULL; |
tracked_scroll_bar = NULL; |
12742 |
count++; |
count++; |
12744 |
} |
} |
12745 |
|
|
12746 |
part_code = FindWindow (er.where, &window_ptr); |
part_code = FindWindow (er.where, &window_ptr); |
12747 |
|
|
12748 |
switch (part_code) |
switch (part_code) |
12749 |
{ |
{ |
12750 |
case inMenuBar: |
case inMenuBar: |
12768 |
struct mac_output *mwp = (mac_output *) |
struct mac_output *mwp = (mac_output *) |
12769 |
GetWRefCon (window_ptr); |
GetWRefCon (window_ptr); |
12770 |
Point mouse_loc = er.where; |
Point mouse_loc = er.where; |
12771 |
|
|
12772 |
/* convert to local coordinates of new window */ |
/* convert to local coordinates of new window */ |
12773 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
12774 |
SetPort (GetWindowPort (window_ptr)); |
SetPort (GetWindowPort (window_ptr)); |
12782 |
&control_part_code); |
&control_part_code); |
12783 |
#else |
#else |
12784 |
control_part_code = FindControl (mouse_loc, window_ptr, &ch); |
control_part_code = FindControl (mouse_loc, window_ptr, &ch); |
12785 |
#endif |
#endif |
12786 |
|
|
12787 |
#if USE_CARBON_EVENTS |
#if USE_CARBON_EVENTS |
12788 |
bufp->code = mac_get_mouse_btn (eventRef); |
bufp->code = mac_get_mouse_btn (eventRef); |
12789 |
#else |
#else |
12790 |
bufp->code = 0; /* only one mouse button */ |
bufp->code = 0; /* only one mouse button */ |
12791 |
#endif |
#endif |
12792 |
XSETINT (bufp->x, mouse_loc.h); |
XSETINT (bufp->x, mouse_loc.h); |
12794 |
bufp->timestamp = er.when * (1000 / 60); |
bufp->timestamp = er.when * (1000 / 60); |
12795 |
/* ticks to milliseconds */ |
/* ticks to milliseconds */ |
12796 |
|
|
12797 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
12798 |
if (ch != 0) |
if (ch != 0) |
12799 |
#else |
#else |
12800 |
if (control_part_code != 0) |
if (control_part_code != 0) |
12827 |
else |
else |
12828 |
mouse_tracking_in_progress = mouse_tracking_none; |
mouse_tracking_in_progress = mouse_tracking_none; |
12829 |
} |
} |
12830 |
|
|
12831 |
#if USE_CARBON_EVENTS |
#if USE_CARBON_EVENTS |
12832 |
bufp->modifiers = mac_event_to_emacs_modifiers (eventRef); |
bufp->modifiers = mac_event_to_emacs_modifiers (eventRef); |
12833 |
#else |
#else |
12843 |
bufp->modifiers |= up_modifier; |
bufp->modifiers |= up_modifier; |
12844 |
break; |
break; |
12845 |
} |
} |
12846 |
|
|
12847 |
count++; |
count++; |
12848 |
} |
} |
12849 |
break; |
break; |
12852 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
12853 |
{ |
{ |
12854 |
BitMap bm; |
BitMap bm; |
12855 |
|
|
12856 |
GetQDGlobalsScreenBits (&bm); |
GetQDGlobalsScreenBits (&bm); |
12857 |
DragWindow (window_ptr, er.where, &bm.bounds); |
DragWindow (window_ptr, er.where, &bm.bounds); |
12858 |
} |
} |
12875 |
case inGrow: |
case inGrow: |
12876 |
do_grow_window(window_ptr, &er); |
do_grow_window(window_ptr, &er); |
12877 |
break; |
break; |
12878 |
|
|
12879 |
/* window zoom handling added --ben */ |
/* window zoom handling added --ben */ |
12880 |
case inZoomIn: |
case inZoomIn: |
12881 |
case inZoomOut: |
case inZoomOut: |
12888 |
} |
} |
12889 |
} |
} |
12890 |
break; |
break; |
12891 |
|
|
12892 |
case updateEvt: |
case updateEvt: |
12893 |
case osEvt: |
case osEvt: |
12894 |
case activateEvt: |
case activateEvt: |
12895 |
#if USE_CARBON_EVENTS |
#if USE_CARBON_EVENTS |
12896 |
if (eventNotHandledErr == SendEventToEventTarget (eventRef, GetEventDispatcherTarget ())) |
if (eventNotHandledErr == SendEventToEventTarget (eventRef, GetEventDispatcherTarget ())) |
12897 |
#endif |
#endif |
12898 |
do_events (&er); |
do_events (&er); |
12899 |
break; |
break; |
12900 |
|
|
12901 |
case keyDown: |
case keyDown: |
12902 |
case autoKey: |
case autoKey: |
12903 |
{ |
{ |
12904 |
int keycode = (er.message & keyCodeMask) >> 8; |
int keycode = (er.message & keyCodeMask) >> 8; |
12905 |
int xkeysym; |
int xkeysym; |
12906 |
|
|
12907 |
#if USE_CARBON_EVENTS |
#if USE_CARBON_EVENTS |
12908 |
/* When using Carbon Events, we need to pass raw keyboard events |
/* When using Carbon Events, we need to pass raw keyboard events |
12909 |
to the TSM ourselves. If TSM handles it, it will pass back |
to the TSM ourselves. If TSM handles it, it will pass back |
12921 |
break; |
break; |
12922 |
} |
} |
12923 |
#endif |
#endif |
12924 |
|
|
12925 |
if (!IsValidWindowPtr (FrontNonFloatingWindow ())) |
if (!IsValidWindowPtr (FrontNonFloatingWindow ())) |
12926 |
{ |
{ |
12927 |
SysBeep (1); |
SysBeep (1); |
12928 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
12929 |
return 0; |
return 0; |
12930 |
} |
} |
12931 |
|
|
12932 |
ObscureCursor (); |
ObscureCursor (); |
12933 |
|
|
12934 |
if (keycode_to_xkeysym (keycode, &xkeysym)) |
if (keycode_to_xkeysym (keycode, &xkeysym)) |
12935 |
{ |
{ |
12936 |
bufp->code = 0xff00 | xkeysym; |
bufp->code = 0xff00 | xkeysym; |
12937 |
bufp->kind = NON_ASCII_KEYSTROKE_EVENT; |
bufp->kind = NON_ASCII_KEYSTROKE_EVENT; |
12938 |
} |
} |
12939 |
else |
else |
12940 |
{ |
{ |
12941 |
if (er.modifiers & (controlKey | |
if (er.modifiers & (controlKey | |
12942 |
(NILP (Vmac_command_key_is_meta) ? optionKey |
(NILP (Vmac_command_key_is_meta) ? optionKey |
12943 |
: cmdKey))) |
: cmdKey))) |
12944 |
{ |
{ |
12945 |
/* This code comes from Keyboard Resource, Appendix |
/* This code comes from Keyboard Resource, Appendix |
12946 |
C of IM - Text. This is necessary since shift is |
C of IM - Text. This is necessary since shift is |
12947 |
ignored in KCHR table translation when option or |
ignored in KCHR table translation when option or |
12948 |
command is pressed. It also does not translate |
command is pressed. It also does not translate |
12949 |
correctly control-shift chars like C-% so mask off |
correctly control-shift chars like C-% so mask off |
12950 |
shift here also */ |
shift here also */ |
12951 |
int new_modifiers = er.modifiers & 0xe600; |
int new_modifiers = er.modifiers & 0xe600; |
12961 |
bufp->kind = ASCII_KEYSTROKE_EVENT; |
bufp->kind = ASCII_KEYSTROKE_EVENT; |
12962 |
} |
} |
12963 |
} |
} |
12964 |
|
|
12965 |
/* If variable mac-convert-keyboard-input-to-latin-1 is non-nil, |
/* If variable mac-convert-keyboard-input-to-latin-1 is non-nil, |
12966 |
convert non-ASCII characters typed at the Mac keyboard |
convert non-ASCII characters typed at the Mac keyboard |
12967 |
(presumed to be in the Mac Roman encoding) to iso-latin-1 |
(presumed to be in the Mac Roman encoding) to iso-latin-1 |
12974 |
static TECObjectRef converter = NULL; |
static TECObjectRef converter = NULL; |
12975 |
OSStatus the_err = noErr; |
OSStatus the_err = noErr; |
12976 |
OSStatus convert_status = noErr; |
OSStatus convert_status = noErr; |
12977 |
|
|
12978 |
if (converter == NULL) |
if (converter == NULL) |
12979 |
{ |
{ |
12980 |
the_err = TECCreateConverter (&converter, |
the_err = TECCreateConverter (&converter, |
12994 |
mac_keyboard_text_encoding); |
mac_keyboard_text_encoding); |
12995 |
current_mac_keyboard_text_encoding |
current_mac_keyboard_text_encoding |
12996 |
= mac_keyboard_text_encoding; |
= mac_keyboard_text_encoding; |
12997 |
} |
} |
12998 |
|
|
12999 |
if (the_err == noErr) |
if (the_err == noErr) |
13000 |
{ |
{ |
13001 |
unsigned char ch = bufp->code; |
unsigned char ch = bufp->code; |
13002 |
ByteCount actual_input_length, actual_output_length; |
ByteCount actual_input_length, actual_output_length; |
13003 |
unsigned char outch; |
unsigned char outch; |
13004 |
|
|
13005 |
convert_status = TECConvertText (converter, &ch, 1, |
convert_status = TECConvertText (converter, &ch, 1, |
13006 |
&actual_input_length, |
&actual_input_length, |
13007 |
&outch, 1, |
&outch, 1, |
13012 |
bufp->code = outch; |
bufp->code = outch; |
13013 |
} |
} |
13014 |
} |
} |
13015 |
|
|
13016 |
#if USE_CARBON_EVENTS |
#if USE_CARBON_EVENTS |
13017 |
bufp->modifiers = mac_event_to_emacs_modifiers (eventRef); |
bufp->modifiers = mac_event_to_emacs_modifiers (eventRef); |
13018 |
#else |
#else |
13019 |
bufp->modifiers = mac_to_emacs_modifiers (er.modifiers); |
bufp->modifiers = mac_to_emacs_modifiers (er.modifiers); |
13020 |
#endif |
#endif |
13021 |
|
|
13022 |
{ |
{ |
13023 |
mac_output *mwp |
mac_output *mwp |
13024 |
= (mac_output *) GetWRefCon (FrontNonFloatingWindow ()); |
= (mac_output *) GetWRefCon (FrontNonFloatingWindow ()); |
13025 |
XSETFRAME (bufp->frame_or_window, mwp->mFP); |
XSETFRAME (bufp->frame_or_window, mwp->mFP); |
13026 |
} |
} |
13027 |
|
|
13028 |
bufp->timestamp = er.when * (1000 / 60); /* ticks to milliseconds */ |
bufp->timestamp = er.when * (1000 / 60); /* ticks to milliseconds */ |
13029 |
|
|
13030 |
count++; |
count++; |
13034 |
drag_and_drop_file_list = Qnil; |
drag_and_drop_file_list = Qnil; |
13035 |
|
|
13036 |
AEProcessAppleEvent(&er); |
AEProcessAppleEvent(&er); |
13037 |
|
|
13038 |
/* Build a DRAG_N_DROP_EVENT type event as is done in |
/* Build a DRAG_N_DROP_EVENT type event as is done in |
13039 |
constuct_drag_n_drop in w32term.c. */ |
constuct_drag_n_drop in w32term.c. */ |
13040 |
if (!NILP (drag_and_drop_file_list)) |
if (!NILP (drag_and_drop_file_list)) |
13044 |
Lisp_Object frame; |
Lisp_Object frame; |
13045 |
|
|
13046 |
wp = FrontNonFloatingWindow (); |
wp = FrontNonFloatingWindow (); |
13047 |
|
|
13048 |
if (!wp) |
if (!wp) |
13049 |
{ |
{ |
13050 |
struct frame *f = XFRAME (XCAR (Vframe_list)); |
struct frame *f = XFRAME (XCAR (Vframe_list)); |
13053 |
} |
} |
13054 |
|
|
13055 |
if (wp && is_emacs_window(wp)) |
if (wp && is_emacs_window(wp)) |
13056 |
f = ((mac_output *) GetWRefCon (wp))->mFP; |
f = ((mac_output *) GetWRefCon (wp))->mFP; |
13057 |
|
|
13058 |
bufp->kind = DRAG_N_DROP_EVENT; |
bufp->kind = DRAG_N_DROP_EVENT; |
13059 |
bufp->code = 0; |
bufp->code = 0; |
13079 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
13080 |
{ |
{ |
13081 |
Rect r; |
Rect r; |
13082 |
|
|
13083 |
GetWindowPortBounds (wp, &r); |
GetWindowPortBounds (wp, &r); |
13084 |
InvalWindowRect (wp, &r); |
InvalWindowRect (wp, &r); |
13085 |
} |
} |
13086 |
#else /* not TARGET_API_MAC_CARBON */ |
#else /* not TARGET_API_MAC_CARBON */ |
13087 |
InvalRect (&(wp->portRect)); |
InvalRect (&(wp->portRect)); |
13088 |
#endif /* not TARGET_API_MAC_CARBON */ |
#endif /* not TARGET_API_MAC_CARBON */ |
13089 |
|
|
13090 |
count++; |
count++; |
13091 |
} |
} |
13092 |
default: |
default: |
13112 |
|
|
13113 |
{ |
{ |
13114 |
static Point old_mouse_pos = { -1, -1 }; |
static Point old_mouse_pos = { -1, -1 }; |
13115 |
|
|
13116 |
if (app_is_suspended) |
if (app_is_suspended) |
13117 |
{ |
{ |
13118 |
old_mouse_pos.h = -1; |
old_mouse_pos.h = -1; |
13124 |
WindowPtr wp; |
WindowPtr wp; |
13125 |
struct frame *f; |
struct frame *f; |
13126 |
Lisp_Object bar; |
Lisp_Object bar; |
13127 |
struct scroll_bar *sb; |
struct scroll_bar *sb; |
13128 |
|
|
13129 |
wp = FrontWindow (); |
wp = FrontWindow (); |
13130 |
if (is_emacs_window (wp)) |
if (is_emacs_window (wp)) |
13149 |
TickCount() * (1000 / 60)); |
TickCount() * (1000 / 60)); |
13150 |
else |
else |
13151 |
note_mouse_movement (f, &mouse_pos); |
note_mouse_movement (f, &mouse_pos); |
13152 |
|
|
13153 |
old_mouse_pos = mouse_pos; |
old_mouse_pos = mouse_pos; |
13154 |
} |
} |
13155 |
} |
} |
13156 |
} |
} |
13157 |
} |
} |
13158 |
|
|
13159 |
UNBLOCK_INPUT; |
UNBLOCK_INPUT; |
13160 |
|
|
13161 |
return count; |
return count; |
13162 |
} |
} |
13163 |
|
|
13206 |
else |
else |
13207 |
if (!(mwp->mWP = GetNewCWindow (WINDOW_RESOURCE, NULL, (WindowPtr) -1))) |
if (!(mwp->mWP = GetNewCWindow (WINDOW_RESOURCE, NULL, (WindowPtr) -1))) |
13208 |
abort (); |
abort (); |
13209 |
|
|
13210 |
SetWRefCon (mwp->mWP, (long) mwp); |
SetWRefCon (mwp->mWP, (long) mwp); |
13211 |
/* so that update events can find this mac_output struct */ |
/* so that update events can find this mac_output struct */ |
13212 |
mwp->mFP = fp; /* point back to emacs frame */ |
mwp->mFP = fp; /* point back to emacs frame */ |
13218 |
#endif |
#endif |
13219 |
|
|
13220 |
mwp->fontset = -1; |
mwp->fontset = -1; |
13221 |
|
|
13222 |
SizeWindow (mwp->mWP, mwp->pixel_width, mwp->pixel_height, false); |
SizeWindow (mwp->mWP, mwp->pixel_width, mwp->pixel_height, false); |
13223 |
ShowWindow (mwp->mWP); |
ShowWindow (mwp->mWP); |
13224 |
|
|
13225 |
} |
} |
13226 |
|
|
13227 |
|
|
13232 |
FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_right; |
FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_right; |
13233 |
|
|
13234 |
FRAME_DESIRED_CURSOR (f) = FILLED_BOX_CURSOR; |
FRAME_DESIRED_CURSOR (f) = FILLED_BOX_CURSOR; |
13235 |
|
|
13236 |
NewMacWindow(f); |
NewMacWindow(f); |
13237 |
|
|
13238 |
f->output_data.mac->cursor_pixel = 0; |
f->output_data.mac->cursor_pixel = 0; |
13247 |
f->output_data.mac->top_pos = 4; |
f->output_data.mac->top_pos = 4; |
13248 |
f->output_data.mac->border_width = 0; |
f->output_data.mac->border_width = 0; |
13249 |
f->output_data.mac->explicit_parent = 0; |
f->output_data.mac->explicit_parent = 0; |
13250 |
|
|
13251 |
f->output_data.mac->internal_border_width = 0; |
f->output_data.mac->internal_border_width = 0; |
13252 |
|
|
13253 |
f->output_method = output_mac; |
f->output_method = output_mac; |
13254 |
|
|
13255 |
f->auto_raise = 1; |
f->auto_raise = 1; |
13256 |
f->auto_lower = 1; |
f->auto_lower = 1; |
13257 |
|
|
13258 |
f->new_width = 0; |
f->new_width = 0; |
13259 |
f->new_height = 0; |
f->new_height = 0; |
13260 |
} |
} |
13273 |
f->output_data.mac->fontset = -1; |
f->output_data.mac->fontset = -1; |
13274 |
f->output_data.mac->scroll_bar_foreground_pixel = -1; |
f->output_data.mac->scroll_bar_foreground_pixel = -1; |
13275 |
f->output_data.mac->scroll_bar_background_pixel = -1; |
f->output_data.mac->scroll_bar_background_pixel = -1; |
13276 |
|
|
13277 |
XSETFRAME (FRAME_KBOARD (f)->Vdefault_minibuffer_frame, f); |
XSETFRAME (FRAME_KBOARD (f)->Vdefault_minibuffer_frame, f); |
13278 |
|
|
13279 |
f->width = 96; |
f->width = 96; |
13282 |
make_mac_frame (f); |
make_mac_frame (f); |
13283 |
|
|
13284 |
x_make_gc (f); |
x_make_gc (f); |
13285 |
|
|
13286 |
/* Need to be initialized for unshow_buffer in window.c. */ |
/* Need to be initialized for unshow_buffer in window.c. */ |
13287 |
selected_window = f->selected_window; |
selected_window = f->selected_window; |
13288 |
|
|
13384 |
x_display_name_list = Fcons (Fcons (build_string ("Mac"), Qnil), |
x_display_name_list = Fcons (Fcons (build_string ("Mac"), Qnil), |
13385 |
x_display_name_list); |
x_display_name_list); |
13386 |
dpyinfo->name_list_element = XCAR (x_display_name_list); |
dpyinfo->name_list_element = XCAR (x_display_name_list); |
13387 |
|
|
13388 |
#if 0 |
#if 0 |
13389 |
dpyinfo->mac_id_name |
dpyinfo->mac_id_name |
13390 |
= (char *) xmalloc (SCHARS (Vinvocation_name) |
= (char *) xmalloc (SCHARS (Vinvocation_name) |
13478 |
{ |
{ |
13479 |
ProcessSerialNumber psn; |
ProcessSerialNumber psn; |
13480 |
OSErr err; |
OSErr err; |
13481 |
|
|
13482 |
err = GetCurrentProcess (&psn); |
err = GetCurrentProcess (&psn); |
13483 |
if (err == noErr) |
if (err == noErr) |
13484 |
(void) SetFrontProcess (&psn); |
(void) SetFrontProcess (&psn); |
13512 |
mac_quit_char_keycode = 5; |
mac_quit_char_keycode = 5; |
13513 |
/* Look at <architecture/adb_kb_map.h> for details */ |
/* Look at <architecture/adb_kb_map.h> for details */ |
13514 |
/* http://gemma.apple.com/techpubs/mac/Toolbox/Toolbox-40.html#MARKER-9-184*/ |
/* http://gemma.apple.com/techpubs/mac/Toolbox/Toolbox-40.html#MARKER-9-184*/ |
13515 |
|
|
13516 |
mac_determine_quit_char_modifiers(); |
mac_determine_quit_char_modifiers(); |
13517 |
} |
} |
13518 |
|
|
13526 |
{ |
{ |
13527 |
UInt32 keyCode; |
UInt32 keyCode; |
13528 |
UInt32 keyModifiers; |
UInt32 keyModifiers; |
13529 |
GetEventParameter(inEvent, kEventParamKeyCode, |
GetEventParameter(inEvent, kEventParamKeyCode, |
13530 |
typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode); |
typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode); |
13531 |
if (keyCode != mac_quit_char_keycode) |
if (keyCode != mac_quit_char_keycode) |
13532 |
return false; |
return false; |
13533 |
GetEventParameter(inEvent, kEventParamKeyModifiers, |
GetEventParameter(inEvent, kEventParamKeyModifiers, |
13534 |
typeUInt32, NULL, sizeof(UInt32), NULL, &keyModifiers); |
typeUInt32, NULL, sizeof(UInt32), NULL, &keyModifiers); |
13535 |
if (keyModifiers != mac_quit_char_modifiers) |
if (keyModifiers != mac_quit_char_modifiers) |
13536 |
return false; |
return false; |
13552 |
/* Fill the queue with events */ |
/* Fill the queue with events */ |
13553 |
ReceiveNextEvent (0, NULL, kEventDurationNoWait, false, &event); |
ReceiveNextEvent (0, NULL, kEventDurationNoWait, false, &event); |
13554 |
event = FindSpecificEventInQueue (GetMainEventQueue(), quit_char_comp, NULL); |
event = FindSpecificEventInQueue (GetMainEventQueue(), quit_char_comp, NULL); |
13555 |
if (event) |
if (event) |
13556 |
{ |
{ |
13557 |
struct input_event e; |
struct input_event e; |
13558 |
struct mac_output *mwp = (mac_output*) GetWRefCon (FrontNonFloatingWindow ()); |
struct mac_output *mwp = (mac_output*) GetWRefCon (FrontNonFloatingWindow ()); |
13629 |
x_noop_count = 0; |
x_noop_count = 0; |
13630 |
last_tool_bar_item = -1; |
last_tool_bar_item = -1; |
13631 |
any_help_event_p = 0; |
any_help_event_p = 0; |
13632 |
|
|
13633 |
/* Try to use interrupt input; if we can't, then start polling. */ |
/* Try to use interrupt input; if we can't, then start polling. */ |
13634 |
Fset_input_mode (Qt, Qnil, Qt, Qnil); |
Fset_input_mode (Qt, Qnil, Qt, Qnil); |
13635 |
|
|
13649 |
start_atimer (ATIMER_CONTINUOUS, interval, x_process_timeouts, 0); |
start_atimer (ATIMER_CONTINUOUS, interval, x_process_timeouts, 0); |
13650 |
} |
} |
13651 |
#endif |
#endif |
13652 |
|
|
13653 |
#if USE_TOOLKIT_SCROLL_BARS |
#if USE_TOOLKIT_SCROLL_BARS |
13654 |
xaw3d_arrow_scroll = False; |
xaw3d_arrow_scroll = False; |
13655 |
xaw3d_pick_top = True; |
xaw3d_pick_top = True; |
13751 |
|
|
13752 |
staticpro (&last_mouse_motion_frame); |
staticpro (&last_mouse_motion_frame); |
13753 |
last_mouse_motion_frame = Qnil; |
last_mouse_motion_frame = Qnil; |
13754 |
|
|
13755 |
DEFVAR_LISP ("mac-command-key-is-meta", &Vmac_command_key_is_meta, |
DEFVAR_LISP ("mac-command-key-is-meta", &Vmac_command_key_is_meta, |
13756 |
doc: /* Non-nil means that the command key is used as the Emacs meta key. |
doc: /* Non-nil means that the command key is used as the Emacs meta key. |
13757 |
Otherwise the option key is used. */); |
Otherwise the option key is used. */); |