all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jay McCarthy <jay.mccarthy@gmail.com>
To: 24579@debbugs.gnu.org
Subject: bug#24579: [PATCH] borderless windows on OS X
Date: Fri, 30 Sep 2016 21:31:09 -0400	[thread overview]
Message-ID: <CAJYbDamXwyEXxZUPrn9=pXAzQhjq-sEu0pAfedxuMuKSx+MUBQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1190 bytes --]

There are two popular Emacs patches for OS X that make all its windows
have no title bar:

https://github.com/nikhilunni/BorderlessEmacs

https://github.com/gwydirsam/emacs-mac-borderless

This patch integrates these by providing a variable
(ns-use-titled-windows) that allows this decision to be controlled at
runtime. The default is to use titles, like normal.

-- Some comments on the patch

This is my first Emacs patch. I hope it's okay.

The only difference between EmacsFSWindow and EmacsWindow is
explicitly telling OS X that the window can be the subject of focus,
which is required for borderless windows. (EmacsFSWindow has nothing
to do with being fullscreen.)

A toolbar can't be used without a title bar. If this isn't included,
then the console prints an error, but nothing bad happens. I think it
is a bit ugly to `if` out this, but not as ugly as an expected error
message.

I included a note in the Changelog, because it looks like all
variables like this get put in, but it could be removed from my
perspective... I have no need to satisfy my pride with my name in the
log. However, I didn't add anything to NEWS, because it seems to not
always mention things like this.

[-- Attachment #2: ns-use-titled-windows.patch --]
[-- Type: application/octet-stream, Size: 2744 bytes --]

diff --git a/ChangeLog.2 b/ChangeLog.2
index 3f3d558..b0bfdc6 100644
--- a/ChangeLog.2
+++ b/ChangeLog.2
@@ -1,3 +1,7 @@
+2016-09-30  Jay McCarthy  <jay.mccarthy@gmail.com)
+
+	* cus-start.el (all): Add ns-use-titled-windows
+
 2016-09-26  Nicolas Petton  <nicolas@petton.fr>
 
 	* Version 25.1 released.
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index d9ad0a5..9e52d0f 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -446,6 +446,7 @@ minibuffer-prompt-properties--setter
 	     (ns-use-native-fullscreen ns boolean "24.4")
              (ns-use-fullscreen-animation ns boolean "25.1")
              (ns-use-srgb-colorspace ns boolean "24.4")
+             (ns-use-titled-windows ns boolean "25.2")
 	     ;; process.c
 	     (delete-exited-processes processes-basics boolean)
 	     ;; syntax.c
diff --git a/src/nsterm.m b/src/nsterm.m
index 1b44a73..d013101 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -6775,11 +6775,13 @@ - (BOOL)isOpaque
   maximizing_resize = NO;
 #endif
 
-  win = [[EmacsWindow alloc]
+  win = [[EmacsFSWindow alloc]
             initWithContentRect: r
                       styleMask: (NSWindowStyleMaskResizable |
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
-                                  NSWindowStyleMaskTitled |
+                                  (ns_use_titled_windows ?
+                                   NSWindowStyleMaskTitled :
+                                   NSWindowStyleMaskBorderless) |
 #endif
                                   NSWindowStyleMaskMiniaturizable |
                                   NSWindowStyleMaskClosable)
@@ -6812,6 +6814,7 @@ - (BOOL)isOpaque
   [win setTitle: name];
 
   /* toolbar support */
+  if ( ns_use_titled_windows ) {
   toolbar = [[EmacsToolbar alloc] initForView: self withIdentifier:
                          [NSString stringWithFormat: @"Emacs Frame %d",
                                    ns_window_num]];
@@ -6833,6 +6836,7 @@ This avoids an extra clear and redraw (flicker) at frame creation.  */
   }
 #endif
   FRAME_TOOLBAR_HEIGHT (f) = 0;
+  }
 
   tem = f->icon_name;
   if (!NILP (tem))
@@ -8759,6 +8763,12 @@ Nil means use fullscreen the old (< 10.7) way.  The old way works better with
 This variable is ignored on OSX < 10.7 and GNUstep.  */);
   ns_use_srgb_colorspace = YES;
 
+  DEFVAR_BOOL ("ns-use-titled-windows", ns_use_titled_windows,
+     doc: /*Non-nil means to include a title on windows.  Nil means to
+omit the title on OSX >= 10.7.  This variable is ignored on OSX <
+10.7.  Default is t.  */);
+  ns_use_titled_windows = 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.

             reply	other threads:[~2016-10-01  1:31 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-01  1:31 Jay McCarthy [this message]
2016-10-01  8:44 ` bug#24579: [PATCH] borderless windows on OS X martin rudalics
2016-10-01 11:53   ` Jay McCarthy
2016-10-01 13:41     ` martin rudalics
2016-10-01 20:18       ` Jay McCarthy
2016-10-02  8:29         ` martin rudalics
2016-10-13 17:56           ` Jay McCarthy
2016-10-13 18:36             ` martin rudalics
2016-10-13 22:27               ` Jay McCarthy
2016-10-01 21:26 ` Alan Third
2016-10-01 22:18   ` Jay McCarthy
2016-10-01 23:04     ` Alan Third
2016-10-02  0:49       ` Clément Pit--Claudel
2016-10-02  8:30         ` martin rudalics
2016-10-02 15:07           ` Alan Third
2016-10-02 16:39             ` martin rudalics
2016-10-02 16:49               ` Alan Third
2016-10-02 18:10                 ` martin rudalics
2016-10-02 18:31                   ` Clément Pit--Claudel
2016-10-02 15:18           ` Clément Pit--Claudel
2016-10-02 16:39             ` martin rudalics
2016-10-02 16:50               ` Clément Pit--Claudel
2016-10-02 18:09                 ` martin rudalics
2017-04-21 19:49 ` Alan Third

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJYbDamXwyEXxZUPrn9=pXAzQhjq-sEu0pAfedxuMuKSx+MUBQ@mail.gmail.com' \
    --to=jay.mccarthy@gmail.com \
    --cc=24579@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.