summaryrefslogtreecommitdiff
path: root/src/nsterm.m
diff options
context:
space:
mode:
Diffstat (limited to 'src/nsterm.m')
-rw-r--r--src/nsterm.m119
1 files changed, 78 insertions, 41 deletions
diff --git a/src/nsterm.m b/src/nsterm.m
index 26059ab67cd..fa38350a2f6 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -140,14 +140,9 @@ char const * nstrace_fullscreen_type_name (int fs_type)
+ (NSColor *)colorForEmacsRed:(CGFloat)red green:(CGFloat)green
blue:(CGFloat)blue alpha:(CGFloat)alpha
{
-#if defined (NS_IMPL_COCOA) \
- && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (ns_use_srgb_colorspace
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
- && [NSColor respondsToSelector:
- @selector(colorWithSRGBRed:green:blue:alpha:)]
-#endif
- )
+ && NSAppKitVersionNumber >= NSAppKitVersionNumber10_7)
return [NSColor colorWithSRGBRed: red
green: green
blue: blue
@@ -161,28 +156,12 @@ char const * nstrace_fullscreen_type_name (int fs_type)
- (NSColor *)colorUsingDefaultColorSpace
{
- /* FIXME: We're checking for colorWithSRGBRed here so this will only
- work in the same place as in the method above. It should really
- be a check whether we're on macOS 10.7 or above. */
-#if defined (NS_IMPL_COCOA) \
- && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
- if ([NSColor respondsToSelector:
- @selector(colorWithSRGBRed:green:blue:alpha:)])
-#endif
- {
- if (ns_use_srgb_colorspace)
- return [self colorUsingColorSpace: [NSColorSpace sRGBColorSpace]];
- else
- return [self colorUsingColorSpace: [NSColorSpace deviceRGBColorSpace]];
- }
-#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
- else
-#endif
-#endif /* NS_IMPL_COCOA && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 */
-#if defined (NS_IMPL_GNUSTEP) || MAC_OS_X_VERSION_MIN_REQUIRED < 1070
- return [self colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
+#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
+ if (ns_use_srgb_colorspace
+ && NSAppKitVersionNumber >= NSAppKitVersionNumber10_7)
+ return [self colorUsingColorSpace: [NSColorSpace sRGBColorSpace]];
#endif
+ return [self colorUsingColorSpace: [NSColorSpace deviceRGBColorSpace]];
}
@end
@@ -2209,10 +2188,6 @@ ns_set_appearance (struct frame *f, Lisp_Object new_value, Lisp_Object old_value
NSTRACE ("ns_set_appearance");
-#ifndef NSAppKitVersionNumber10_10
-#define NSAppKitVersionNumber10_10 1343
-#endif
-
if (NSAppKitVersionNumber < NSAppKitVersionNumber10_10)
return;
@@ -3053,6 +3028,46 @@ ns_scroll_run (struct window *w, struct run *run)
static void
+ns_clear_under_internal_border (struct frame *f)
+{
+ NSTRACE ("ns_clear_under_internal_border");
+
+ if (FRAME_LIVE_P (f) && FRAME_INTERNAL_BORDER_WIDTH (f) > 0)
+ {
+ int border_width = FRAME_INTERNAL_BORDER_WIDTH (f);
+ NSView *view = FRAME_NS_VIEW (f);
+ NSRect edge_rect, frame_rect = [view bounds];
+ NSRectEdge edge[] = {NSMinXEdge, NSMinYEdge, NSMaxXEdge, NSMaxYEdge};
+
+ int face_id =
+ !NILP (Vface_remapping_alist)
+ ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID)
+ : INTERNAL_BORDER_FACE_ID;
+ struct face *face = FACE_FROM_ID_OR_NULL (f, face_id);
+
+ if (!face)
+ face = FRAME_DEFAULT_FACE (f);
+
+ /* Sometimes with new frames we reach this point and have no
+ face. I'm not sure why we have a live frame but no face, so
+ just give up. */
+ if (!face)
+ return;
+
+ ns_focus (f, &frame_rect, 1);
+ [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set];
+ for (int i = 0; i < 4 ; i++)
+ {
+ NSDivideRect (frame_rect, &edge_rect, &frame_rect, border_width, edge[i]);
+
+ NSRectFill (edge_rect);
+ }
+ ns_unfocus (f);
+ }
+}
+
+
+static void
ns_after_update_window_line (struct window *w, struct glyph_row *desired_row)
/* --------------------------------------------------------------------------
External (RIF): preparatory to fringe update after text was updated
@@ -3080,12 +3095,32 @@ ns_after_update_window_line (struct window *w, struct glyph_row *desired_row)
height > 0))
{
int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
+ int face_id =
+ !NILP (Vface_remapping_alist)
+ ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID)
+ : INTERNAL_BORDER_FACE_ID;
+ struct face *face = FACE_FROM_ID_OR_NULL (f, face_id);
block_input ();
- ns_clear_frame_area (f, 0, y, width, height);
- ns_clear_frame_area (f,
- FRAME_PIXEL_WIDTH (f) - width,
- y, width, height);
+ if (face)
+ {
+ NSRect r = NSMakeRect (0, y, FRAME_PIXEL_WIDTH (f), height);
+ ns_focus (f, &r, 1);
+
+ [ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), f) set];
+ NSRectFill (NSMakeRect (0, y, width, height));
+ NSRectFill (NSMakeRect (FRAME_PIXEL_WIDTH (f) - width,
+ y, width, height));
+
+ ns_unfocus (f);
+ }
+ else
+ {
+ ns_clear_frame_area (f, 0, y, width, height);
+ ns_clear_frame_area (f,
+ FRAME_PIXEL_WIDTH (f) - width,
+ y, width, height);
+ }
unblock_input ();
}
}
@@ -3140,10 +3175,12 @@ ns_compute_glyph_string_overhangs (struct glyph_string *s)
else
{
s->left_overhang = 0;
+#ifdef NS_IMPL_GNUSTEP
if (EQ (font->driver->type, Qns))
s->right_overhang = ((struct nsfont_info *)font)->ital ?
FONT_HEIGHT (font) * 0.2 : 0;
else
+#endif
s->right_overhang = 0;
}
}
@@ -5301,7 +5338,7 @@ static struct redisplay_interface ns_redisplay_interface =
ns_draw_glyph_string,
ns_define_frame_cursor,
ns_clear_frame_area,
- 0, /* clear_under_internal_border */
+ ns_clear_under_internal_border, /* clear_under_internal_border */
ns_draw_window_cursor,
ns_draw_vertical_window_border,
ns_draw_window_divider,
@@ -6449,7 +6486,7 @@ not_in_argv (NSString *arg)
if (nsEvArray == nil)
nsEvArray = [[NSMutableArray alloc] initWithCapacity: 1];
- [NSCursor setHiddenUntilMouseMoves: YES];
+ [NSCursor setHiddenUntilMouseMoves:! NILP (Vmake_pointer_invisible)];
if (hlinfo->mouse_face_hidden && FIXNUMP (Vmouse_highlight))
{
@@ -8610,7 +8647,7 @@ not_in_argv (NSString *arg)
while ( (file = [fenum nextObject]) )
strings = Fcons ([file lispString], strings);
}
- else if ([type isEqualToString: NSURLPboardType])
+ else if ([type isEqualToString: NSPasteboardTypeURL])
{
NSURL *url = [NSURL URLFromPasteboard: pb];
if (url == nil) return NO;
@@ -8619,8 +8656,8 @@ not_in_argv (NSString *arg)
strings = list1 ([[url absoluteString] lispString]);
}
- else if ([type isEqualToString: NSStringPboardType]
- || [type isEqualToString: NSTabularTextPboardType])
+ else if ([type isEqualToString: NSPasteboardTypeString]
+ || [type isEqualToString: NSPasteboardTypeTabularText])
{
NSString *data;