Skip to content

Instantly share code, notes, and snippets.

@jakejx
Last active December 18, 2019 18:12
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 jakejx/1538373194edff34f98b328198a7f7dc to your computer and use it in GitHub Desktop.
Save jakejx/1538373194edff34f98b328198a7f7dc to your computer and use it in GitHub Desktop.
Emacs 27 no titlebar patch
diff --git a/src/nsterm.m b/src/nsterm.m
index 6995577920..948e93e47b 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -470,11 +470,9 @@ - (NSColor *)colorUsingDefaultColorSpace
/* These flags will be OR'd or XOR'd with the NSWindow's styleMask
property depending on what we're doing. */
-#define FRAME_DECORATED_FLAGS (NSWindowStyleMaskTitled \
- | NSWindowStyleMaskResizable \
+#define FRAME_UNDECORATED_FLAGS ( NSWindowStyleMaskResizable \
| NSWindowStyleMaskMiniaturizable \
| NSWindowStyleMaskClosable)
-#define FRAME_UNDECORATED_FLAGS NSWindowStyleMaskBorderless
/* TODO: Get rid of need for these forward declarations. */
static void ns_condemn_scroll_bars (struct frame *f);
@@ -1829,23 +1827,11 @@ Hide the window (X11 semantics)
{
block_input ();
- if (NILP (new_value))
- {
- FRAME_UNDECORATED (f) = false;
- [window setStyleMask: ((window.styleMask | FRAME_DECORATED_FLAGS)
- ^ FRAME_UNDECORATED_FLAGS)];
-
- [view createToolbar: f];
- }
- else
- {
- [window setToolbar: nil];
- /* Do I need to release the toolbar here? */
+ [window setToolbar: nil];
+ /* Do I need to release the toolbar here? */
- FRAME_UNDECORATED (f) = true;
- [window setStyleMask: ((window.styleMask | FRAME_UNDECORATED_FLAGS)
- ^ FRAME_DECORATED_FLAGS)];
- }
+ FRAME_UNDECORATED (f) = true;
+ [window setStyleMask: (window.styleMask | FRAME_UNDECORATED_FLAGS)];
/* At this point it seems we don't have an active NSResponder,
so some key presses (TAB) are swallowed by the system. */
@@ -7025,36 +7011,7 @@ - (void) updateFrameSize: (BOOL) delay
NSTRACE_MSG ("Original columns: %d", cols);
NSTRACE_MSG ("Original rows: %d", rows);
- if (! [self isFullscreen])
- {
- int toolbar_height;
-#ifdef NS_IMPL_GNUSTEP
- // GNUstep does not always update the tool bar height. Force it.
- if (toolbar && [toolbar isVisible])
- update_frame_tool_bar (emacsframe);
-#endif
-
- toolbar_height = FRAME_TOOLBAR_HEIGHT (emacsframe);
- if (toolbar_height < 0)
- toolbar_height = 35;
-
- extra = FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
- + toolbar_height;
- }
-
- if (wait_for_tool_bar)
- {
- /* The toolbar height is always 0 in fullscreen and undecorated
- frames, so don't wait for it to become available. */
- if (FRAME_TOOLBAR_HEIGHT (emacsframe) == 0
- && FRAME_UNDECORATED (emacsframe) == false
- && ! [self isFullscreen])
- {
- NSTRACE_MSG ("Waiting for toolbar");
- return;
- }
- wait_for_tool_bar = NO;
- }
+ wait_for_tool_bar = NO;
neww = (int)wr.size.width - emacsframe->border_width;
newh = (int)wr.size.height - extra;
@@ -7429,11 +7386,9 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f
maximizing_resize = NO;
#endif
- win = [[EmacsWindow alloc]
+ win = [[EmacsFSWindow alloc]
initWithContentRect: r
- styleMask: (FRAME_UNDECORATED (f)
- ? FRAME_UNDECORATED_FLAGS
- : FRAME_DECORATED_FLAGS)
+ styleMask: FRAME_UNDECORATED_FLAGS
backing: NSBackingStoreBuffered
defer: YES];
@@ -7466,10 +7421,6 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f
NILP (tem) ? "Emacs" : SSDATA (tem)];
[win setTitle: name];
- /* toolbar support */
- if (! FRAME_UNDECORATED (f))
- [self createToolbar: f];
-
#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
#ifndef NSAppKitVersionNumber10_10
#define NSAppKitVersionNumber10_10 1343
@@ -8503,7 +8454,7 @@ - (id)accessibilityAttributeValue:(NSString *)attribute
NSTRACE ("[EmacsWindow accessibilityAttributeValue:]");
if ([attribute isEqualToString:NSAccessibilityRoleAttribute])
- return NSAccessibilityTextFieldRole;
+ return NSAccessibilityWindowRole;
if ([attribute isEqualToString:NSAccessibilitySelectedTextAttribute]
&& curbuf && ! NILP (BVAR (curbuf, mark_active)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment