[[view window] orderOut: NSApp];
[[view window] setFrame: t display: NO];
}
+
+ /* Processing input while Emacs is being minimized can cause a
+ crash, so block it for the duration. */
+ block_input();
[[view window] miniaturize: NSApp];
+ unblock_input();
}
/* Free X resources of frame F. */
r.size.height = h;
r.size.width = w->phys_cursor_width;
- /* TODO: only needed in rare cases with last-resort font in HELLO..
- should we do this more efficiently? */
- ns_clip_to_row (w, glyph_row, ANY_AREA, NO); /* do ns_focus(f, &r, 1); if remove */
+ /* Prevent the cursor from being drawn outside the text area. */
+ ns_clip_to_row (w, glyph_row, TEXT_AREA, NO); /* do ns_focus(f, &r, 1); if remove */
- face = FACE_FROM_ID (f, phys_cursor_glyph->face_id);
+ face = FACE_FROM_ID_OR_NULL (f, phys_cursor_glyph->face_id);
if (face && NS_FACE_BACKGROUND (face)
== ns_index_color (FRAME_CURSOR_COLOR (f), f))
{
NSTRACE ("ns_draw_vertical_window_border");
- face = FACE_FROM_ID (f, VERTICAL_BORDER_FACE_ID);
- if (face)
- [ns_lookup_indexed_color(face->foreground, f) set];
+ face = FACE_FROM_ID_OR_NULL (f, VERTICAL_BORDER_FACE_ID);
ns_focus (f, &r, 1);
+ if (face)
+ [ns_lookup_indexed_color(face->foreground, f) set];
+
NSRectFill(r);
ns_unfocus (f);
}
NSTRACE ("ns_draw_window_divider");
- face = FACE_FROM_ID (f, WINDOW_DIVIDER_FACE_ID);
- if (face)
- [ns_lookup_indexed_color(face->foreground, f) set];
+ face = FACE_FROM_ID_OR_NULL (f, WINDOW_DIVIDER_FACE_ID);
ns_focus (f, &r, 1);
+ if (face)
+ [ns_lookup_indexed_color(face->foreground, f) set];
+
NSRectFill(r);
ns_unfocus (f);
}
if (s->hl == DRAW_MOUSE_FACE)
{
- face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
+ face = FACE_FROM_ID_OR_NULL (s->f,
+ MOUSE_HL_INFO (s->f)->mouse_face_face_id);
if (!face)
- face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
+ face = FACE_FROM_ID_OR_NULL (s->f, MOUSE_FACE_ID);
}
else
face = s->face;
struct face *face;
if (s->hl == DRAW_MOUSE_FACE)
{
- face = FACE_FROM_ID (s->f,
- MOUSE_HL_INFO (s->f)->mouse_face_face_id);
+ face
+ = FACE_FROM_ID_OR_NULL (s->f,
+ MOUSE_HL_INFO (s->f)->mouse_face_face_id);
if (!face)
face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
}
with its background color), we must clear just the image area. */
if (s->hl == DRAW_MOUSE_FACE)
{
- face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
+ face = FACE_FROM_ID_OR_NULL (s->f,
+ MOUSE_HL_INFO (s->f)->mouse_face_face_id);
if (!face)
face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
}
if (s->hl == DRAW_MOUSE_FACE)
{
- face = FACE_FROM_ID (s->f, MOUSE_HL_INFO (s->f)->mouse_face_face_id);
+ face = FACE_FROM_ID_OR_NULL (s->f,
+ MOUSE_HL_INFO (s->f)->mouse_face_face_id);
if (!face)
face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
}
}
+static void
+ns_draw_glyph_string_foreground (struct glyph_string *s)
+{
+ int x, flags;
+ struct font *font = s->font;
+
+ /* If first glyph of S has a left box line, start drawing the text
+ of S to the right of that box line. */
+ if (s->face && s->face->box != FACE_NO_BOX
+ && s->first_glyph->left_box_line_p)
+ x = s->x + eabs (s->face->box_line_width);
+ else
+ x = s->x;
+
+ flags = s->hl == DRAW_CURSOR ? NS_DUMPGLYPH_CURSOR :
+ (s->hl == DRAW_MOUSE_FACE ? NS_DUMPGLYPH_MOUSEFACE :
+ (s->for_overlaps ? NS_DUMPGLYPH_FOREGROUND :
+ NS_DUMPGLYPH_NORMAL));
+
+ font->driver->draw
+ (s, s->cmp_from, s->nchars, x, s->ybase,
+ (flags == NS_DUMPGLYPH_NORMAL && !s->background_filled_p)
+ || flags == NS_DUMPGLYPH_MOUSEFACE);
+}
+
+
static void
ns_draw_composite_glyph_string_foreground (struct glyph_string *s)
{
{
/* TODO (optimize): focus for box and contents draw */
NSRect r[2];
- int n, flags;
+ int n;
char box_drawn_p = 0;
struct font *font = s->face->font;
if (! font) font = FRAME_FONT (s->f);
ns_maybe_dumpglyphs_background
(s, s->first_glyph->type == COMPOSITE_GLYPH);
- flags = s->hl == DRAW_CURSOR ? NS_DUMPGLYPH_CURSOR :
- (s->hl == DRAW_MOUSE_FACE ? NS_DUMPGLYPH_MOUSEFACE :
- (s->for_overlaps ? NS_DUMPGLYPH_FOREGROUND :
- NS_DUMPGLYPH_NORMAL));
-
if (s->hl == DRAW_CURSOR && s->w->phys_cursor_type == FILLED_BOX_CURSOR)
{
unsigned long tmp = NS_FACE_BACKGROUND (s->face);
if (isComposite)
ns_draw_composite_glyph_string_foreground (s);
else
- font->driver->draw
- (s, s->cmp_from, s->nchars, s->x, s->ybase,
- (flags == NS_DUMPGLYPH_NORMAL && !s->background_filled_p)
- || flags == NS_DUMPGLYPH_MOUSEFACE);
+ ns_draw_glyph_string_foreground (s);
}
{
NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_read_socket");
+ if (apploopnr > 0)
+ return -1; /* Already within event loop. */
+
#ifdef HAVE_NATIVE_FS
check_native_fs ();
#endif
NSTRACE_WHEN (NSTRACE_GROUP_EVENTS, "ns_select");
+ if (apploopnr > 0)
+ return -1; /* Already within event loop. */
+
#ifdef HAVE_NATIVE_FS
check_native_fs ();
#endif
+FRAME_LINE_HEIGHT (emacsframe));
pt = [self convertPoint: pt toView: nil];
+#if !defined (NS_IMPL_COCOA) || \
+ MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
pt = [[self window] convertBaseToScreen: pt];
rect.origin = pt;
+#else
+ rect.origin = pt;
+ rect = [[self window] convertRectToScreen: rect];
+#endif
return rect;
}