/* NeXT/Open/GNUstep / MacOSX communication module.
-Copyright (C) 1989, 1993-1994, 2005-2006, 2008-2013
- Free Software Foundation, Inc.
+Copyright (C) 1989, 1993-1994, 2005-2006, 2008-2014 Free Software
+Foundation, Inc.
This file is part of GNU Emacs.
extern NSString *NSMenuDidBeginTrackingNotification;
+/* ==========================================================================
+
+ NSColor, EmacsColor category.
+
+ ========================================================================== */
+@implementation NSColor (EmacsColor)
++ (NSColor *)colorForEmacsRed:(CGFloat)red green:(CGFloat)green
+ blue:(CGFloat)blue alpha:(CGFloat)alpha
+{
+#ifdef NS_IMPL_COCOA
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+ if (ns_use_srgb_colorspace)
+ return [NSColor colorWithSRGBRed: red
+ green: green
+ blue: blue
+ alpha: alpha];
+#endif
+#endif
+ return [NSColor colorWithCalibratedRed: red
+ green: green
+ blue: blue
+ alpha: alpha];
+}
+
+- (NSColor *)colorUsingDefaultColorSpace
+{
+#ifdef NS_IMPL_COCOA
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+ if (ns_use_srgb_colorspace)
+ return [self colorUsingColorSpace: [NSColorSpace sRGBColorSpace]];
+#endif
+#endif
+ return [self colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
+}
+
+@end
+
/* ==========================================================================
Local declarations
check_frame_size (f, &width, &height, pixelwise);
- f->scroll_bar_actual_width = NS_SCROLL_BAR_WIDTH (f);
compute_fringe_widths (f, 0);
if (pixelwise)
#endif
if ((new = [NSColor selectedTextBackgroundColor]) != nil)
{
- *col = [new colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
+ *col = [new colorUsingDefaultColorSpace];
unblock_input ();
return 0;
}
*/
if ((new = [NSColor selectedTextColor]) != nil)
{
- *col = [new colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
+ *col = [new colorUsingDefaultColorSpace];
unblock_input ();
return 0;
}
if (r >= 0.0F)
{
- *col = [NSColor colorWithCalibratedRed: r green: g blue: b alpha: 1.0];
+ *col = [NSColor colorForEmacsRed: r green: g blue: b alpha: 1.0];
unblock_input ();
return 0;
}
}
if (new)
- *col = [new colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
+ *col = [new colorUsingDefaultColorSpace];
unblock_input ();
return new ? 0 : 1;
}
return build_string ((char *)str);
}
- [[col colorUsingColorSpaceName: NSCalibratedRGBColorSpace]
+ [[col colorUsingDefaultColorSpace]
getRed: &red green: &green blue: &blue alpha: &alpha];
- if (red ==green && red ==blue)
+ if (red == green && red == blue)
{
[[col colorUsingColorSpaceName: NSCalibratedWhiteColorSpace]
getWhite: &gray alpha: &alpha];
/*NSTRACE (ns_send_appdefined); */
#ifdef NS_IMPL_GNUSTEP
- // GNUStep needs postEvent to happen on the main thread.
+ // GNUstep needs postEvent to happen on the main thread.
if (! [[NSThread currentThread] isMainThread])
{
EmacsApp *app = (EmacsApp *)NSApp;
if (FRAME_NS_P (f))
{
EmacsView *view = FRAME_NS_VIEW (f);
- [view updateCollectionBehaviour];
+ [view updateCollectionBehavior];
}
}
}
#endif
-/* GNUStep and OSX <= 10.4 does not have cancelTracking. */
+/* GNUstep and OSX <= 10.4 does not have cancelTracking. */
#if defined (NS_IMPL_COCOA) && \
MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-/* Check if menu open should be cancelled or continued as normal. */
+/* Check if menu open should be canceled or continued as normal. */
void
ns_check_menu_open (NSMenu *menu)
{
name = SSDATA (XCAR (color));
c = XINT (XCDR (color));
[cl setColor:
- [NSColor colorWithCalibratedRed: RED_FROM_ULONG (c) / 255.0
- green: GREEN_FROM_ULONG (c) / 255.0
- blue: BLUE_FROM_ULONG (c) / 255.0
- alpha: 1.0]
+ [NSColor colorForEmacsRed: RED_FROM_ULONG (c) / 255.0
+ green: GREEN_FROM_ULONG (c) / 255.0
+ blue: BLUE_FROM_ULONG (c) / 255.0
+ alpha: 1.0]
forKey: [NSString stringWithUTF8String: name]];
}
[cl writeToFile: nil];
if (! [self isFullscreen])
{
#ifdef NS_IMPL_GNUSTEP
- // GNUStep does not always update the tool bar height. Force it.
+ // GNUstep does not always update the tool bar height. Force it.
if (toolbar) update_frame_tool_bar (emacsframe);
#endif
if (is_focus_frame)
dpyinfo->x_focus_frame = 0;
+ emacsframe->mouse_moved = 0;
ns_frame_rehighlight (emacsframe);
/* FIXME: for some reason needed on second and subsequent clicks away
[self setFSValue: fs_before_fs];
fs_before_fs = -1;
#ifdef HAVE_NATIVE_FS
- [self updateCollectionBehaviour];
+ [self updateCollectionBehavior];
#endif
if (FRAME_EXTERNAL_TOOL_BAR (emacsframe))
{
}
#ifdef HAVE_NATIVE_FS
-- (void)updateCollectionBehaviour
+- (void)updateCollectionBehavior
{
if (! [self isFullscreen])
{
if (fs_state != FULLSCREEN_BOTH)
{
+ NSScreen *screen = [w screen];
+
+#if defined (NS_IMPL_COCOA) && \
+ MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
+ /* Hide ghost menu bar on secondary monitor? */
+ if (! onFirstScreen)
+ onFirstScreen = [NSScreen screensHaveSeparateSpaces];
+#endif
/* Hide dock and menubar if we are on the primary screen. */
if (onFirstScreen)
{
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:YES
- screen:[w screen]];
+ screen:screen];
[fw setContentView:[w contentView]];
[fw setTitle:[w title]];
[fw makeKeyAndOrderFront:NSApp];
[fw makeFirstResponder:self];
[w orderOut:self];
- r = [fw frameRectForContentRect:[[fw screen] frame]];
+ r = [fw frameRectForContentRect:[screen frame]];
[fw setFrame: r display:YES animate:YES];
[self windowDidEnterFullScreen:nil];
[fw display];
doc: /*Non-nil means to use native fullscreen on OSX >= 10.7.
Nil means use fullscreen the old (< 10.7) way. The old way works better with
multiple monitors, but lacks tool bar. This variable is ignored on OSX < 10.7.
-Default is t for OSX >= 10.7, nil otherwise. */);
+Default is t for OSX >= 10.7, nil otherwise. */);
#ifdef HAVE_NATIVE_FS
ns_use_native_fullscreen = YES;
#else
#endif
ns_last_use_native_fullscreen = ns_use_native_fullscreen;
+ DEFVAR_BOOL ("ns-use-srgb-colorspace", ns_use_srgb_colorspace,
+ doc: /*Non-nil means to use sRGB colorspace on OSX >= 10.7.
+Note that this does not apply to images.
+This variable is ignored on OSX < 10.7 and GNUstep. */);
+ ns_use_srgb_colorspace = YES;
+
/* TODO: move to common code */
DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars,
doc: /* Which toolkit scroll bars Emacs uses, if any.