Skip to content

Instantly share code, notes, and snippets.

@railwaycat
Created April 29, 2017 05:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save railwaycat/3347b49ae1e3ee0468770f1d66f9e86d to your computer and use it in GitHub Desktop.
Save railwaycat/3347b49ae1e3ee0468770f1d66f9e86d to your computer and use it in GitHub Desktop.
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 4df6781243..5afd89a473 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -558,6 +558,7 @@ minibuffer-prompt-properties--setter
(mac-pass-command-to-system mac boolean "22.1")
(mac-pass-control-to-system mac boolean "22.1")
(mac-drawing-use-gcd mac boolean "24.4")
+ (mac-use-title-bar mac boolean "25.2")
(mac-frame-tabbing mac (choice (const automatic) (const inverted)
(const nil) (const t)) "24.5")
(debug-on-event debug
diff --git a/src/macappkit.m b/src/macappkit.m
index b3905f12a9..6ddecb9a9a 100644
--- a/src/macappkit.m
+++ b/src/macappkit.m
@@ -1824,6 +1824,16 @@ - (void)showMenuBar
@implementation EmacsWindow
+- (BOOL)canBecomeKeyWindow
+{
+ return YES;
+}
+
+- (BOOL)canBecomeMainWindow
+{
+ return [self isVisible];
+}
+
- (instancetype)initWithContentRect:(NSRect)contentRect
styleMask:(NSWindowStyleMask)windowStyle
backing:(NSBackingStoreType)bufferingType
@@ -2190,9 +2200,13 @@ - (void)setupWindow
else
{
windowClass = [EmacsWindow class];
- windowStyle = (NSWindowStyleMaskTitled | NSWindowStyleMaskClosable
- | NSWindowStyleMaskMiniaturizable
- | NSWindowStyleMaskResizable);
+ if (mac_use_title_bar)
+ windowStyle = (NSWindowStyleMaskTitled | NSWindowStyleMaskClosable
+ | NSWindowStyleMaskMiniaturizable
+ | NSWindowStyleMaskResizable);
+ else
+ windowStyle = (NSWindowStyleMaskBorderless | NSWindowStyleMaskResizable
+ | NSWindowStyleMaskMiniaturizable);
}
}
else
diff --git a/src/macterm.c b/src/macterm.c
index 6c406e664e..926f0bafbf 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -6168,4 +6168,14 @@ tabbing is disallowed and preferred, respectively.
This variable has no effect on OS X 10.11 and earlier. */);
Vmac_frame_tabbing = Qautomatic;
+
+ DEFVAR_BOOL ("mac-use-title-bar", mac_use_title_bar,
+ doc: /*Non-nil means to include the title bar on frames. Nil means to
+omit the title bar on OSX >= 10.7. This variable is ignored on OSX <
+10.7. Note that the first frame per emacs session (unless it is an
+emacsclient) will use the default value of this variable (nil--do not
+include a title bar), ignoring (!) the user-set value of this
+variable. This is almost certainly due to a bug in the patch adding
+this variable. Default is nil.*/);
+ mac_use_title_bar = false;
}
@railwaycat
Copy link
Author

This patch based on braham-snyder's no-title-bar patch for Emacs NS port(official trunk) and Jan Jungnickel's patch for earlier Mac port version

@vikasrawal
Copy link

It fails when using --HEAD option

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment