unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24579: [PATCH] borderless windows on OS X
@ 2016-10-01  1:31 Jay McCarthy
  2016-10-01  8:44 ` martin rudalics
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Jay McCarthy @ 2016-10-01  1:31 UTC (permalink / raw)
  To: 24579

[-- 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.

^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2017-04-21 19:49 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).