(Not yet supported.) */
int x_use_underline_position_properties;
+/* Non-zero means to draw the underline at the same place as the descent line. */
+
+int x_underline_at_descent_line;
+
/* This is a chain of structures for all the X displays currently in
use. */
static void mac_focus_changed P_ ((int, struct mac_display_info *,
struct frame *, struct input_event *));
static void x_detect_focus_change P_ ((struct mac_display_info *,
- EventRecord *, struct input_event *));
+ const EventRecord *,
+ struct input_event *));
static void XTframe_rehighlight P_ ((struct frame *));
static void x_frame_rehighlight P_ ((struct x_display_info *));
static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *));
static XCharStruct *mac_per_char_metric P_ ((XFontStruct *, XChar2b *, int));
static void XSetFont P_ ((Display *, GC, XFontStruct *));
-/* Defined in macmenu.h. */
-extern void menubar_selection_callback (FRAME_PTR, int);
-
#define GC_FORE_COLOR(gc) (&(gc)->fore_color)
#define GC_BACK_COLOR(gc) (&(gc)->back_color)
#define GC_FONT(gc) ((gc)->xgcv.font)
char *bits;
int w, h;
{
- static unsigned char swap_nibble[16]
+ static const unsigned char swap_nibble[16]
= { 0x0, 0x8, 0x4, 0xc, /* 0000 1000 0100 1100 */
0x2, 0xa, 0x6, 0xe, /* 0010 1010 0110 1110 */
0x1, 0x9, 0x5, 0xd, /* 0001 1001 0101 1101 */
if (saved_text_layout == NULL)
{
- UniCharCount lengths[] = {kATSUToTextEnd};
- ATSUAttributeTag tags[] = {kATSULineLayoutOptionsTag};
- ByteCount sizes[] = {sizeof (ATSLineLayoutOptions)};
+ static const UniCharCount lengths[] = {kATSUToTextEnd};
+ static const ATSUAttributeTag tags[] = {kATSULineLayoutOptionsTag};
+ static const ByteCount sizes[] = {sizeof (ATSLineLayoutOptions)};
static ATSLineLayoutOptions line_layout =
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
kATSLineDisableAllLayoutOperations | kATSLineUseDeviceMetrics
kATSLineIsDisplayOnly | kATSLineFractDisable
#endif
;
- ATSUAttributeValuePtr values[] = {&line_layout};
+ static const ATSUAttributeValuePtr values[] = {&line_layout};
err = ATSUCreateTextLayoutWithTextPtr (text,
kATSUFromTextBeginning,
static void
-mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char)
+mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width,
+ overstrike_p, bytes_per_char)
struct frame *f;
GC gc;
int x, y;
char *buf;
- int nchars, bg_width, bytes_per_char;
+ int nchars, bg_width, overstrike_p, bytes_per_char;
{
SetPortWindowPort (FRAME_MAC_WINDOW (f));
ATSUDrawText (text_layout,
kATSUFromTextBeginning, kATSUToTextEnd,
kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc);
+ if (overstrike_p)
+ {
+ MoveTo (x + 1, y);
+ ATSUDrawText (text_layout,
+ kATSUFromTextBeginning, kATSUToTextEnd,
+ kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc);
+ }
mac_end_clip (gc);
#ifdef MAC_OSX
}
else
{
CGrafPtr port;
- CGContextRef context;
+ static CGContextRef context;
float port_height = FRAME_PIXEL_HEIGHT (f);
- ATSUAttributeTag tags[] = {kATSUCGContextTag};
- ByteCount sizes[] = {sizeof (CGContextRef)};
- ATSUAttributeValuePtr values[] = {&context};
+ static const ATSUAttributeTag tags[] = {kATSUCGContextTag};
+ static const ByteCount sizes[] = {sizeof (CGContextRef)};
+ static const ATSUAttributeValuePtr values[] = {&context};
#if USE_CG_DRAWING
context = mac_begin_cg_clip (f, gc);
sizeof (tags) / sizeof (tags[0]),
tags, sizes, values);
if (err == noErr)
- ATSUDrawText (text_layout,
- kATSUFromTextBeginning, kATSUToTextEnd,
- Long2Fix (x), Long2Fix (port_height - y));
+ {
+ ATSUDrawText (text_layout,
+ kATSUFromTextBeginning, kATSUToTextEnd,
+ Long2Fix (x), Long2Fix (port_height - y));
+ if (overstrike_p)
+ ATSUDrawText (text_layout,
+ kATSUFromTextBeginning, kATSUToTextEnd,
+ Long2Fix (x + 1), Long2Fix (port_height - y));
+ }
#if USE_CG_DRAWING
mac_end_cg_clip (f);
context = NULL;
TextFace (GC_FONT (gc)->mac_fontface);
MoveTo (x, y);
DrawText (buf, 0, nchars * bytes_per_char);
+ if (overstrike_p)
+ {
+ TextMode (srcOr);
+ MoveTo (x + 1, y);
+ DrawText (buf, 0, nchars * bytes_per_char);
+ }
if (bg_width)
RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
mac_end_clip (gc);
}
-/* Mac replacement for XDrawString. */
-
-static void
-mac_draw_string (f, gc, x, y, buf, nchars)
- struct frame *f;
- GC gc;
- int x, y;
- char *buf;
- int nchars;
-{
- mac_draw_string_common (f, gc, x, y, buf, nchars, 0, 1);
-}
-
-
-/* Mac replacement for XDrawString16. */
-
-static void
-mac_draw_string_16 (f, gc, x, y, buf, nchars)
- struct frame *f;
- GC gc;
- int x, y;
- XChar2b *buf;
- int nchars;
-{
- mac_draw_string_common (f, gc, x, y, (char *) buf, nchars, 0, 2);
-}
-
-
/* Mac replacement for XDrawImageString. */
static void
-mac_draw_image_string (f, gc, x, y, buf, nchars, bg_width)
+mac_draw_image_string (f, gc, x, y, buf, nchars, bg_width, overstrike_p)
struct frame *f;
GC gc;
int x, y;
char *buf;
- int nchars, bg_width;
+ int nchars, bg_width, overstrike_p;
{
- mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, 1);
+ mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width,
+ overstrike_p, 1);
}
-/* Mac replacement for XDrawString16. */
+/* Mac replacement for XDrawImageString16. */
static void
-mac_draw_image_string_16 (f, gc, x, y, buf, nchars, bg_width)
+mac_draw_image_string_16 (f, gc, x, y, buf, nchars, bg_width, overstrike_p)
struct frame *f;
GC gc;
int x, y;
XChar2b *buf;
- int nchars, bg_width;
+ int nchars, bg_width, overstrike_p;
{
- mac_draw_string_common (f, gc, x, y, (char *) buf, nchars, bg_width, 2);
+ mac_draw_string_common (f, gc, x, y, (char *) buf, nchars, bg_width,
+ overstrike_p, 2);
}
err1 = ATSUGetGlyphInfo (text_layout, kATSUFromTextBeginning,
kATSUToTextEnd, &count,
&glyph_info_array);
- if (err1 == noErr)
+ if (err1 == noErr
+ /* Make sure that we don't have to make layout
+ adjustments. */
+ && glyph_info_array.glyphs[0].deltaY == 0.0f
+ && glyph_info_array.glyphs[0].idealX == 0.0f
+ && glyph_info_array.glyphs[0].screenX == 0)
{
xassert (glyph_info_array.glyphs[0].glyphID);
*cg_glyph = glyph_info_array.glyphs[0].glyphID;
}
static int
-mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width)
+mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width, overstrike_p)
struct frame *f;
GC gc;
int x, y;
XChar2b *buf;
- int nchars, bg_width;
+ int nchars, bg_width, overstrike_p;
{
CGrafPtr port;
float port_height, gx, gy;
if (GC_FONT (gc)->mac_fontsize <= cg_text_anti_aliasing_threshold)
CGContextSetShouldAntialias (context, false);
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
- CGContextSetTextPosition (context, gx, gy);
- CGContextShowGlyphsWithAdvances (context, glyphs, advances, nchars);
-#else
- for (i = 0; i < nchars; i++)
+#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
+ if (CGContextShowGlyphsWithAdvances != NULL)
+#endif
+ {
+ CGContextSetTextPosition (context, gx, gy);
+ CGContextShowGlyphsWithAdvances (context, glyphs, advances, nchars);
+ if (overstrike_p)
+ {
+ CGContextSetTextPosition (context, gx + 1.0f, gy);
+ CGContextShowGlyphsWithAdvances (context, glyphs, advances, nchars);
+ }
+ }
+#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
+ else
+#endif
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 */
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020
{
- CGContextShowGlyphsAtPoint (context, gx, gy, glyphs + i, 1);
- gx += advances[i].width;
+ for (i = 0; i < nchars; i++)
+ {
+ CGContextShowGlyphsAtPoint (context, gx, gy, glyphs + i, 1);
+ if (overstrike_p)
+ CGContextShowGlyphsAtPoint (context, gx + 1.0f, gy, glyphs + i, 1);
+ gx += advances[i].width;
+ }
}
#endif
#if USE_CG_DRAWING
static enum pcm_status
pcm_get_status (pcm)
- XCharStruct *pcm;
+ const XCharStruct *pcm;
{
int height = pcm->ascent + pcm->descent;
Rect r;
MacFontStruct *font = s->font;
+#if USE_CG_DRAWING
+ mac_prepare_for_quickdraw (s->f);
+#endif
+ SetPortWindowPort (FRAME_MAC_WINDOW (s->f));
+
TextFont (font->mac_fontnum);
TextSize (font->mac_fontsize);
TextFace (font->mac_fontface);
#if USE_CG_TEXT_DRAWING
if (!s->two_byte_p
&& mac_draw_image_string_cg (s->f, s->gc, x, s->ybase - boff,
- s->char2b, s->nchars, bg_width))
+ s->char2b, s->nchars, bg_width,
+ s->face->overstrike))
;
else
#endif
mac_draw_image_string_16 (s->f, s->gc, x, s->ybase - boff,
- s->char2b, s->nchars, bg_width);
+ s->char2b, s->nchars, bg_width,
+ s->face->overstrike);
else
mac_draw_image_string (s->f, s->gc, x, s->ybase - boff,
- char1b, s->nchars, bg_width);
+ char1b, s->nchars, bg_width,
+ s->face->overstrike);
}
}
else
{
for (i = 0; i < s->nchars; i++, ++s->gidx)
- mac_draw_string_16 (s->f, s->gc,
- x + s->cmp->offsets[s->gidx * 2],
- s->ybase - s->cmp->offsets[s->gidx * 2 + 1],
- s->char2b + i, 1);
+ mac_draw_image_string_16 (s->f, s->gc,
+ x + s->cmp->offsets[s->gidx * 2],
+ s->ybase - s->cmp->offsets[s->gidx * 2 + 1],
+ s->char2b + i, 1, 0, s->face->overstrike);
}
}
/* Draw underline. */
if (s->face->underline_p)
{
- unsigned long h = 1;
- unsigned long dy = s->height - h;
+ unsigned long tem, h;
+ int y;
+
+#if 0
+ /* Get the underline thickness. Default is 1 pixel. */
+ if (!XGetFontProperty (s->font, XA_UNDERLINE_THICKNESS, &h))
+#endif
+ h = 1;
+
+ y = s->y + s->height - h;
+ if (!x_underline_at_descent_line)
+ {
+ /* Get the underline position. This is the recommended
+ vertical offset in pixels from the baseline to the top of
+ the underline. This is a signed value according to the
+ specs, and its default is
+
+ ROUND ((maximum descent) / 2), with
+ ROUND(x) = floor (x + 0.5) */
+
+#if 0
+ if (x_use_underline_position_properties
+ && XGetFontProperty (s->font, XA_UNDERLINE_POSITION, &tem))
+ y = s->ybase + (long) tem;
+ else
+#endif
+ if (s->face->font)
+ y = s->ybase + (s->face->font->max_bounds.descent + 1) / 2;
+ }
if (s->face->underline_defaulted_p)
- mac_fill_rectangle (s->f, s->gc, s->x, s->y + dy,
+ mac_fill_rectangle (s->f, s->gc, s->x, y,
s->background_width, h);
else
{
XGCValues xgcv;
XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
XSetForeground (s->display, s->gc, s->face->underline_color);
- mac_fill_rectangle (s->f, s->gc, s->x, s->y + dy,
+ mac_fill_rectangle (s->f, s->gc, s->x, y,
s->background_width, h);
XSetForeground (s->display, s->gc, xgcv.foreground);
}
static void
x_detect_focus_change (dpyinfo, event, bufp)
struct mac_display_info *dpyinfo;
- EventRecord *event;
+ const EventRecord *event;
struct input_event *bufp;
{
struct frame *frame;
x_scroll_bar_handle_click (bar, part_code, er, bufp)
struct scroll_bar *bar;
ControlPartCode part_code;
- EventRecord *er;
+ const EventRecord *er;
struct input_event *bufp;
{
int win_y, top_range;
static struct xlfdpat *
xlfdpat_create (pattern)
- char *pattern;
+ const char *pattern;
{
struct xlfdpat *pat;
int nblocks, i, skip;
unsigned char last_char, *p, *q, *anychar_head;
+ const unsigned char *ptr;
struct xlfdpat_block *blk;
pat = xmalloc (sizeof (struct xlfdpat));
anychar_head = NULL;
q = pat->buf;
last_char = '\0';
- for (p = pattern; *p; p++)
+ for (ptr = pattern; *ptr; ptr++)
{
- unsigned char c = *p;
+ unsigned char c = *ptr;
if (c == '*')
if (last_char == '*')
that the pattern in *BLK matches with its prefix. Return NULL
there is no such strings. STRING must be lowered in advance. */
-static char *
+static const char *
xlfdpat_block_match_1 (blk, string, start_max)
struct xlfdpat_block *blk;
- unsigned char *string;
+ const unsigned char *string;
int start_max;
{
int start, infinity;
- unsigned char *p, *s;
+ unsigned char *p;
+ const unsigned char *s;
xassert (blk->len > 0);
xassert (start_max + blk->len <= strlen (string));
((b)->len == 1 ? memchr ((s), (b)->last_char, (m) + 1) \
: xlfdpat_block_match_1 (b, s, m))
-/* Check if XLFD pattern PAT, which is generated by `xfldpat_create',
+/* Check if XLFD pattern PAT, which is generated by `xlfdpat_create',
matches with STRING. STRING must be lowered in advance. */
static int
xlfdpat_match (pat, string)
struct xlfdpat *pat;
- unsigned char *string;
+ const unsigned char *string;
{
int str_len, nblocks, i, start_max;
struct xlfdpat_block *blk;
- unsigned char *s;
+ const unsigned char *s;
xassert (pat->nblocks > 0);
static char *
mac_to_x_fontname (name, size, style, charset)
- char *name;
+ const char *name;
int size;
Style style;
char *charset;
static int
parse_x_font_name (xf, family, size, style, charset)
- char *xf, *family;
+ const char *xf;
+ char *family;
int *size;
Style *style;
char *charset;
static void
add_mac_font_name (name, size, style, charset)
- char *name;
+ const char *name;
int size;
Style style;
- char *charset;
+ const char *charset;
{
if (size > 0)
add_font_name_table_entry (mac_to_x_fontname (name, size, style, charset));
XLFD_SCL_LAST
};
-static int xlfd_scalable_fields[] =
+static const int xlfd_scalable_fields[] =
{
6, /* PIXEL_SIZE */
7, /* POINT_SIZE */
static Lisp_Object
mac_do_list_fonts (pattern, maxnames)
- char *pattern;
+ const char *pattern;
int maxnames;
{
int i, n_fonts = 0;
Lisp_Object font_list = Qnil;
struct xlfdpat *pat;
- char *scaled, *ptr;
- int scl_val[XLFD_SCL_LAST], *field, *val;
+ char *scaled;
+ const char *ptr;
+ int scl_val[XLFD_SCL_LAST], *val;
+ const int *field;
int exact;
if (font_name_table == NULL) /* Initialize when first used. */
fields are present, none is '*'. */
static int
-is_fully_specified_xlfd (char *p)
+is_fully_specified_xlfd (p)
+ const char *p;
{
int i;
char *q;
}
-/* XLoadQueryFont creates and returns an internal representation for a
- font in a MacFontStruct struct. There is really no concept
+/* mac_load_query_font creates and returns an internal representation
+ for a font in a MacFontStruct struct. There is really no concept
corresponding to "loading" a font on the Mac. But we check its
existence and find the font number and all other information for it
and store them in the returned MacFontStruct. */
static MacFontStruct *
-XLoadQueryFont (Display *dpy, char *fontname)
+mac_load_query_font (f, fontname)
+ struct frame *f;
+ char *fontname;
{
int size;
char *name;
if (strcmp (charset, "iso10646-1") == 0) /* XXX */
{
OSStatus err;
- ATSUAttributeTag tags[] = {kATSUFontTag, kATSUSizeTag,
- kATSUQDBoldfaceTag, kATSUQDItalicTag};
- ByteCount sizes[] = {sizeof (ATSUFontID), sizeof (Fixed),
- sizeof (Boolean), sizeof (Boolean)};
+ static const ATSUAttributeTag tags[] =
+ {kATSUFontTag, kATSUSizeTag,
+ kATSUQDBoldfaceTag, kATSUQDItalicTag};
+ static const ByteCount sizes[] =
+ {sizeof (ATSUFontID), sizeof (Fixed),
+ sizeof (Boolean), sizeof (Boolean)};
static Fixed size_fixed;
static Boolean bold_p, italic_p;
- ATSUAttributeValuePtr values[] = {&font_id, &size_fixed,
- &bold_p, &italic_p};
- ATSUFontFeatureType types[] = {kAllTypographicFeaturesType,
- kDiacriticsType};
- ATSUFontFeatureSelector selectors[] = {kAllTypeFeaturesOffSelector,
- kDecomposeDiacriticsSelector};
+ static const ATSUAttributeValuePtr values[] =
+ {&font_id, &size_fixed,
+ &bold_p, &italic_p};
+ static const ATSUFontFeatureType types[] =
+ {kAllTypographicFeaturesType, kDiacriticsType};
+ static const ATSUFontFeatureSelector selectors[] =
+ {kAllTypeFeaturesOffSelector, kDecomposeDiacriticsSelector};
Lisp_Object font_id_cons;
FMFontStyle style;
NULL
#endif
);
- if (err != noErr)
+ if (err != noErr
+ || space_bounds->width <= 0 || FONT_HEIGHT (font) <= 0)
{
mac_unload_font (&one_mac_display_info, font);
return NULL;
else
#endif
{
- GrafPtr port;
- SInt16 old_fontnum, old_fontsize;
- Style old_fontface;
FontInfo the_fontinfo;
int is_two_byte_font;
- /* Save the current font number used. */
- GetPort (&port);
-#if TARGET_API_MAC_CARBON
- old_fontnum = GetPortTextFont (port);
- old_fontsize = GetPortTextSize (port);
- old_fontface = GetPortTextFace (port);
-#else
- old_fontnum = port->txFont;
- old_fontsize = port->txSize;
- old_fontface = port->txFace;
+#if USE_CG_DRAWING
+ mac_prepare_for_quickdraw (f);
#endif
+ SetPortWindowPort (FRAME_MAC_WINDOW (f));
TextFont (fontnum);
TextSize (size);
for (c = 0x21, pcm = space_bounds + 1; c <= 0xff; c++, pcm++)
mac_query_char_extents (NULL, c, NULL, NULL, pcm, NULL);
}
-
- /* Restore previous font number, size and face. */
- TextFont (old_fontnum);
- TextSize (old_fontsize);
- TextFace (old_fontface);
}
if (space_bounds)
pcm->width);
font->min_bounds.ascent = min (font->min_bounds.ascent,
pcm->ascent);
+ font->min_bounds.descent = min (font->min_bounds.descent,
+ pcm->descent);
font->max_bounds.lbearing = max (font->max_bounds.lbearing,
pcm->lbearing);
pcm->width);
font->max_bounds.ascent = max (font->max_bounds.ascent,
pcm->ascent);
+ font->max_bounds.descent = max (font->max_bounds.descent,
+ pcm->descent);
}
if (
#if USE_ATSUI
fontname = (char *) SDATA (XCAR (font_names));
BLOCK_INPUT;
- font = (MacFontStruct *) XLoadQueryFont (FRAME_MAC_DISPLAY (f), fontname);
+ font = mac_load_query_font (f, fontname);
UNBLOCK_INPUT;
if (!font)
return NULL;
#endif
#endif /* ! TARGET_API_MAC_CARBON */
-#define M_APPLE 128
+#define M_APPLE 234
#define I_ABOUT 1
#define WINDOW_RESOURCE 128
except `clear' (-> <clear>) on the KeyPad, `enter' (-> <kp-enter>)
on the right of the Cmd key on laptops, and fn + `enter' (->
<linefeed>). */
-static unsigned char keycode_to_xkeysym_table[] = {
+static const unsigned char keycode_to_xkeysym_table[] = {
/*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/*0x20*/ 0, 0, 0, 0, 0x0d /*return*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
keyboard, and they may not be the same on other types of keyboards.
If the destination is identical to the source (f1 ... f12), it
doesn't map `fn' key to a modifier. */
-static unsigned char fn_keycode_to_keycode_table[] = {
+static const unsigned char fn_keycode_to_keycode_table[] = {
/*0x00*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/*0x10*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/*0x20*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}
#endif
-static void
+#if !TARGET_API_MAC_CARBON
+void
do_apple_menu (SInt16 menu_item)
{
-#if !TARGET_API_MAC_CARBON
Str255 item_name;
SInt16 da_driver_refnum;
GetMenuItemText (GetMenuHandle (M_APPLE), menu_item, item_name);
da_driver_refnum = OpenDeskAcc (item_name);
}
-#endif /* !TARGET_API_MAC_CARBON */
-}
-
-void
-do_menu_choice (SInt32 menu_choice)
-{
- SInt16 menu_id, menu_item;
-
- menu_id = HiWord (menu_choice);
- menu_item = LoWord (menu_choice);
-
- switch (menu_id)
- {
- case 0:
- break;
-
- case M_APPLE:
- do_apple_menu (menu_item);
- break;
-
- default:
- {
- struct frame *f = mac_focus_frame (&one_mac_display_info);
- MenuHandle menu = GetMenuHandle (menu_id);
- if (menu)
- {
- UInt32 refcon;
-
- GetMenuItemRefCon (menu, menu_item, &refcon);
- menubar_selection_callback (f, refcon);
- }
- }
- }
-
- HiliteMenu (0);
}
-
+#endif /* !TARGET_API_MAC_CARBON */
/* Handle drags in size box. Based on code contributed by Ben
Mesander and IM - Window Manager A. */
static void
-do_grow_window (WindowPtr w, EventRecord *e)
+do_grow_window (w, e)
+ WindowPtr w;
+ const EventRecord *e;
{
Rect limit_rect;
int rows, columns, width, height;
Lisp_Object class_key, id_key;
EventRef event;
UInt32 num_params;
- EventParamName *names;
- EventParamType *types;
+ const EventParamName *names;
+ const EventParamType *types;
{
OSStatus err = eventNotHandledErr;
Lisp_Object binding;
{
OSStatus result, err;
HICommand command;
- static EventParamName names[] = {kEventParamDirectObject,
- kEventParamKeyModifiers};
- static EventParamType types[] = {typeHICommand,
- typeUInt32};
+ static const EventParamName names[] =
+ {kEventParamDirectObject, kEventParamKeyModifiers};
+ static const EventParamType types[] =
+ {typeHICommand, typeUInt32};
int num_params = sizeof (names) / sizeof (names[0]);
result = CallNextEventHandler (next_handler, event);
static OSStatus
init_command_handler ()
{
- EventTypeSpec specs[] = {{kEventClassCommand, kEventCommandProcess}};
+ static const EventTypeSpec specs[] =
+ {{kEventClassCommand, kEventCommandProcess}};
static EventHandlerUPP handle_command_eventUPP = NULL;
if (handle_command_eventUPP == NULL)
case kEventWindowToolbarSwitchMode:
result = CallNextEventHandler (next_handler, event);
{
- static EventParamName names[] = {kEventParamDirectObject,
- kEventParamWindowMouseLocation,
- kEventParamKeyModifiers,
- kEventParamMouseButton,
- kEventParamClickCount,
- kEventParamMouseChord};
- static EventParamType types[] = {typeWindowRef,
- typeQDPoint,
- typeUInt32,
- typeMouseButton,
- typeUInt32,
- typeUInt32};
+ static const EventParamName names[] = {kEventParamDirectObject,
+ kEventParamWindowMouseLocation,
+ kEventParamKeyModifiers,
+ kEventParamMouseButton,
+ kEventParamClickCount,
+ kEventParamMouseChord};
+ static const EventParamType types[] = {typeWindowRef,
+ typeQDPoint,
+ typeUInt32,
+ typeMouseButton,
+ typeUInt32,
+ typeUInt32};
int num_params = sizeof (names) / sizeof (names[0]);
err = mac_store_event_ref_as_apple_event (0, 0,
OSStatus result, err;
Lisp_Object id_key;
int num_params;
- EventParamName *names;
- EventParamType *types;
- static EventParamName names_sel[] = {kEventParamATSUFontID,
- kEventParamATSUFontSize,
- kEventParamFMFontFamily,
- kEventParamFMFontSize,
- kEventParamFontColor};
- static EventParamType types_sel[] = {typeATSUFontID,
- typeATSUSize,
- typeFMFontFamily,
- typeFMFontSize,
- typeFontColor};
+ const EventParamName *names;
+ const EventParamType *types;
+ static const EventParamName names_sel[] = {kEventParamATSUFontID,
+ kEventParamATSUFontSize,
+ kEventParamFMFontFamily,
+ kEventParamFMFontSize,
+ kEventParamFontColor};
+ static const EventParamType types_sel[] = {typeATSUFontID,
+ typeATSUSize,
+ typeFMFontFamily,
+ typeFMFontSize,
+ typeFontColor};
result = CallNextEventHandler (next_handler, event);
if (result != eventNotHandledErr)
OSStatus result, err = noErr;
Lisp_Object id_key = Qnil;
int num_params;
- EventParamName *names;
- EventParamType *types;
+ const EventParamName *names;
+ const EventParamType *types;
static UInt32 seqno_uaia = 0;
- static EventParamName names_uaia[] =
+ static const EventParamName names_uaia[] =
{kEventParamTextInputSendComponentInstance,
kEventParamTextInputSendRefCon,
kEventParamTextInputSendSLRec,
kEventParamTextInputSendTextServiceEncoding,
kEventParamTextInputSendTextServiceMacEncoding,
EVENT_PARAM_TEXT_INPUT_SEQUENCE_NUMBER};
- static EventParamType types_uaia[] =
+ static const EventParamType types_uaia[] =
{typeComponentInstance,
typeLongInteger,
typeIntlWritingCode,
typeUInt32,
typeUInt32,
typeUInt32};
- static EventParamName names_ufke[] =
+ static const EventParamName names_ufke[] =
{kEventParamTextInputSendComponentInstance,
kEventParamTextInputSendRefCon,
kEventParamTextInputSendSLRec,
kEventParamTextInputSendText};
- static EventParamType types_ufke[] =
+ static const EventParamType types_ufke[] =
{typeComponentInstance,
typeLongInteger,
typeIntlWritingCode,
OSStatus err;
Lisp_Object id_key;
int num_params;
- EventParamName *names;
- EventParamType *types;
- static EventParamName names_pfm[] = {kEventParamServiceMessageName,
- kEventParamServiceUserData};
- static EventParamType types_pfm[] = {typeCFStringRef,
- typeCFStringRef};
+ const EventParamName *names;
+ const EventParamType *types;
+ static const EventParamName names_pfm[] =
+ {kEventParamServiceMessageName, kEventParamServiceUserData};
+ static const EventParamType types_pfm[] =
+ {typeCFStringRef, typeCFStringRef};
switch (GetEventKind (event))
{
{
OSStatus err = noErr;
#if USE_CARBON_EVENTS
- EventTypeSpec specs_window[] =
+ static const EventTypeSpec specs_window[] =
{{kEventClassWindow, kEventWindowUpdate},
{kEventClassWindow, kEventWindowGetIdealSize},
{kEventClassWindow, kEventWindowBoundsChanging},
{kEventClassWindow, kEventWindowFocusRelinquish},
#endif
};
- EventTypeSpec specs_mouse[] = {{kEventClassMouse, kEventMouseWheelMoved}};
+ static const EventTypeSpec specs_mouse[] =
+ {{kEventClassMouse, kEventMouseWheelMoved}};
static EventHandlerUPP handle_window_eventUPP = NULL;
static EventHandlerUPP handle_mouse_eventUPP = NULL;
#if USE_MAC_FONT_PANEL
- EventTypeSpec specs_font[] = {{kEventClassFont, kEventFontPanelClosed},
- {kEventClassFont, kEventFontSelection}};
+ static const EventTypeSpec specs_font[] =
+ {{kEventClassFont, kEventFontPanelClosed},
+ {kEventClassFont, kEventFontSelection}};
static EventHandlerUPP handle_font_eventUPP = NULL;
#endif
#if USE_MAC_TSM
- EventTypeSpec specs_text_input[] =
+ static const EventTypeSpec specs_text_input[] =
{{kEventClassTextInput, kEventTextInputUpdateActiveInputArea},
{kEventClassTextInput, kEventTextInputUnicodeForKeyEvent},
{kEventClassTextInput, kEventTextInputOffsetToPos}};
static XrmDatabase
mac_make_rdb (xrm_option)
- char *xrm_option;
+ const char *xrm_option;
{
XrmDatabase database;
NOTE: Not supported on Mac yet. */);
x_use_underline_position_properties = 0;
+ DEFVAR_BOOL ("x-underline-at-descent-line",
+ &x_underline_at_descent_line,
+ doc: /* *Non-nil means to draw the underline at the same place as the descent line.
+nil means to draw the underline according to the value of the variable
+`x-use-underline-position-properties', which is usually at the baseline
+level. The default value is nil. */);
+ x_underline_at_descent_line = 0;
+
DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars,
doc: /* If not nil, Emacs uses toolkit scroll bars. */);
#ifdef USE_TOOLKIT_SCROLL_BARS