unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Jay McCarthy <jay.mccarthy@gmail.com>
To: Alan Third <alan@idiocy.org>
Cc: 24579@debbugs.gnu.org
Subject: bug#24579: [PATCH] borderless windows on OS X
Date: Sat, 1 Oct 2016 18:18:00 -0400	[thread overview]
Message-ID: <CAJYbDak2_04BO8vqqsDRLcciqkPjQ-3J9C3DOK=HxWn0UXG+Dg@mail.gmail.com> (raw)
In-Reply-To: <20161001212613.GA40646@breton.holly.idiocy.org>

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

I've attached a modified version with your requests.

Regarding EmacsWindow, I think it would be good to keep it around and
separate, so I didn't remove it in the patch.

Jay

On Sat, Oct 1, 2016 at 5:26 PM, Alan Third <alan@idiocy.org> wrote:
> On Fri, Sep 30, 2016 at 09:31:09PM -0400, Jay McCarthy wrote:
>> 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.
>
> I’d prefer a variable name more like ‘ns-use-titlebar’, as
> ‘titled-windows’ doesn’t mean very much to me.
>
>> -- 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.)
>
> I’d no idea about this, do we even need both types?
>
>> 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.
>
> The changelog is automatically updated from the git repository log, as
> I understand it. We’ll commit it using your name so you’ll be credited
> anyway. :)
>
> Also, I don’t think this patch will be included before Emacs 26.1 as
> it’s a new feature, not a bug fix, so the entry in cus-start.el may
> need to read 26.1.
>
> This one’s a real nit‐pick: I don’t like the version number being on
> the next line in the variable doctype. I don’t see any reason why it
> can’t be moved up on to the previous line next to the greater‐than
> sign. And also change ‘windows’ to ‘frames’ and ‘title’ to ‘titlebar’.
>
> I can’t see anything wrong other than my little moans above, and it
> certainly looks like it does what it’s supposed to do. Thanks for
> doing this.
> --
> Alan Third



-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

           "Wherefore, be not weary in well-doing,
      for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
                          - D&C 64:33

[-- Attachment #2: 0001-Add-ns-use-titlebar.patch --]
[-- Type: application/octet-stream, Size: 2736 bytes --]

From 9dc69fa971b85617f2a1af638e2ea41aeea06862 Mon Sep 17 00:00:00 2001
From: Jay McCarthy <jay.mccarthy@gmail.com>
Date: Fri, 30 Sep 2016 21:08:27 -0400
Subject: [PATCH 1/1] Add ns-use-titlebar

---
 lisp/cus-start.el |  1 +
 src/nsterm.m      | 14 ++++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index d9ad0a5..67bbba6 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-title-bar ns boolean "26.1")
 	     ;; process.c
 	     (delete-exited-processes processes-basics boolean)
 	     ;; syntax.c
diff --git a/src/nsterm.m b/src/nsterm.m
index 1b44a73..cd78294 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_titlebar ?
+                                   NSWindowStyleMaskTitled :
+                                   NSWindowStyleMaskBorderless) |
 #endif
                                   NSWindowStyleMaskMiniaturizable |
                                   NSWindowStyleMaskClosable)
@@ -6812,6 +6814,7 @@ - (BOOL)isOpaque
   [win setTitle: name];
 
   /* toolbar support */
+  if ( ns_use_titlebar ) {
   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-titlebar", ns_use_titlebar,
+     doc: /*Non-nil means to include a titlebar on frames.  Nil means
+to omit the titlebar on OSX >= 10.7.
+This variable is ignored on OSX < 10.7.  Default is t.  */);
+  ns_use_titlebar = 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.
-- 
2.10.0


  reply	other threads:[~2016-10-01 22:18 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-01  1:31 bug#24579: [PATCH] borderless windows on OS X Jay McCarthy
2016-10-01  8:44 ` 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 [this message]
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='CAJYbDak2_04BO8vqqsDRLcciqkPjQ-3J9C3DOK=HxWn0UXG+Dg@mail.gmail.com' \
    --to=jay.mccarthy@gmail.com \
    --cc=24579@debbugs.gnu.org \
    --cc=alan@idiocy.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).