all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Third <alan@idiocy.org>
To: martin rudalics <rudalics@gmx.at>
Cc: "Arthur Miller" <arthur.miller.no1@gmail.com>,
	25408@debbugs.gnu.org,
	"Clément Pit--Claudel" <clement.pit@gmail.com>,
	"Anders Lindgren" <andlind@gmail.com>
Subject: bug#25408: Remove Decorations Around Emacs Frame (NS port)
Date: Sun, 11 Jun 2017 17:35:44 +0100	[thread overview]
Message-ID: <20170611163544.GA70844@breton.holly.idiocy.org> (raw)
In-Reply-To: <593CFB04.8000600@gmx.at>

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

On Sun, Jun 11, 2017 at 10:10:44AM +0200, martin rudalics wrote:
> > no-accept-focus is done, but no-focus-on-map is harder. I believe I
> > can get a new frame to not be focused on creation, but I don’t see any
> > way to prevent a minimized frame from becoming focused when
> > unminimized.
> 
> Don't worry.  Unminimizing is different from mapping.  The former works
> on already mapped frames only, the latter on invisible frames only.
> "on-map" stands for "on making the frame visible" which might happen
> some time after the frame was created.  Once visible you cannot map the
> frame until you make it invisible again.
> 
> Alt-tabbing and unminimizing OTOH work on visible frames only, you
> cannot really unminimize an invisible window (although the window
> manager might remember the requested fullscreen status somewhere and
> later, when it makes the window visible, apply that state).
> 
> ‘no-focus-on-map’ behaves well for all platforms and builds I tried so
> far.  It would be nice to have it for NS builds too.  So all that is
> afforded by ‘no-focus-on-map’ is that, whenever a frame changes from the
> invisible to the visible state, it does not get focus.

Your explanation made it much clearer what was required. I believe
I’ve got it sorted now. I’ve attached a patch.

> >> And please have a look into the Elisp manual: Maybe you find something
> >> worth mentioning (the fact that removing decorations removes the tool
> >> bar should certainly go there).
> 
> This one still stupefies me because it's a deviation from the other
> builds.  It certainly should be documented.  Did you document that a
> fullscreen NS screen doesn't have a toolbar either?

It actually does, it’s just hidden, along with the title‐bar and
menu‐bar. At least that’s how it works on macOS, I’m unsure how
GNUStep deals with full‐screen as it’s using a different mechanism, if
it handles it at all.

I’m struggling to find where this should be documented. Any ideas
which part of the manual covers full‐screen?

> BTW, I meanwhile wrote some code to resize and move undecorated frames
> with the mouse.  For this purpose I need some mouse pointers indicating
> that a frame corner (not a frame edge) can be dragged.  Under X I use
> XC_top_left_corner, XC_top_right_corner, ...  On Windows I use the
> IDC_SIZENWSE and IDC_SIZENESW arrows.  I have not found any equivalent
> for NS.  How does NS indicate that the corner of a decorated frame can
> be dragged when the mouse is over it?

macOS uses double‐headed diagonal arrows, but they’re undocumented:

    https://stackoverflow.com/questions/27242353/cocoa-predefined-resize-mouse-cursor

GNUStep doesn’t implement them and doesn’t seem to have any
equivalent.

On macOS we can actually make undecorated frames resizable quite
easily just by including the resizable style mask. GNUstep doesn’t
like that, of course.
-- 
Alan Third

[-- Attachment #2: 0001-Add-no-focus-on-map-to-NS-build-bug-25408.patch --]
[-- Type: text/plain, Size: 4608 bytes --]

From 72ec4de5701cb3029cb3ae2c4c3262144c4eff76 Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Sun, 11 Jun 2017 17:07:28 +0100
Subject: [PATCH] Add no-focus-on-map to NS build (bug#25408)

* src/nsfns.m (ns_frame_parm_handlers): Add x_set_no_focus_on_map.
(x-create-frame): Check for no-focus-on-map.
* src/nsterm.h (x_set_no_focus_on_map): New function.
* src/nsterm.m (x_set_no_focus_on_map): New function.
(ns_raise_frame): Add parameter for specifying whether to focus the
frame.
(ns_frame_raise_lower):
(x_make_frame_visible): Handle new parameter for ns_raise_frame.
---
 src/nsfns.m  |  4 +++-
 src/nsterm.h |  2 ++
 src/nsterm.m | 33 +++++++++++++++++++++++++++++----
 3 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/src/nsfns.m b/src/nsfns.m
index 0c865070fb..dbce279da6 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -980,7 +980,7 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
 #endif
   x_set_parent_frame,
   0, /* x_set_skip_taskbar */
-  0, /* x_set_no_focus_on_map */
+  x_set_no_focus_on_map,
   x_set_no_accept_focus,
   x_set_z_group, /* x_set_z_group */
   0, /* x_set_override_redirect */
@@ -1288,6 +1288,8 @@ Turn the input menu (an NSMenu) into a lisp list for tracking on lisp side
   store_frame_param (f, Qparent_frame, parent_frame);
 
   x_default_parameter (f, parms, Qz_group, Qnil, NULL, NULL, RES_TYPE_SYMBOL);
+  x_default_parameter (f, parms, Qno_focus_on_map, Qnil,
+		       NULL, NULL, RES_TYPE_BOOLEAN);
   x_default_parameter (f, parms, Qno_accept_focus, Qnil,
                        NULL, NULL, RES_TYPE_BOOLEAN);
 
diff --git a/src/nsterm.h b/src/nsterm.h
index f75e3759e4..bed0b92c79 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -1218,6 +1218,8 @@ extern void x_set_undecorated (struct frame *f, Lisp_Object new_value,
                                Lisp_Object old_value);
 extern void x_set_parent_frame (struct frame *f, Lisp_Object new_value,
                                 Lisp_Object old_value);
+extern void x_set_no_focus_on_map (struct frame *f, Lisp_Object new_value,
+                                   Lisp_Object old_value);
 extern void x_set_no_accept_focus (struct frame *f, Lisp_Object new_value,
                                    Lisp_Object old_value);
 extern void x_set_z_group (struct frame *f, Lisp_Object new_value,
diff --git a/src/nsterm.m b/src/nsterm.m
index 633ca3bf76..b298e4a153 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1463,7 +1463,7 @@ -(void)remove
 
 
 static void
-ns_raise_frame (struct frame *f)
+ns_raise_frame (struct frame *f, BOOL make_key)
 /* --------------------------------------------------------------------------
      Bring window to foreground and make it active
    -------------------------------------------------------------------------- */
@@ -1474,7 +1474,12 @@ -(void)remove
   view = FRAME_NS_VIEW (f);
   block_input ();
   if (FRAME_VISIBLE_P (f))
-    [[view window] makeKeyAndOrderFront: NSApp];
+    {
+      if (make_key)
+        [[view window] makeKeyAndOrderFront: NSApp];
+      else
+        [[view window] orderFront: NSApp];
+    }
   unblock_input ();
 }
 
@@ -1504,7 +1509,7 @@ -(void)remove
   NSTRACE ("ns_frame_raise_lower");
 
   if (raise)
-    ns_raise_frame (f);
+    ns_raise_frame (f, YES);
   else
     ns_lower_frame (f);
 }
@@ -1567,7 +1572,7 @@ -(void)remove
       EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f);
 
       SET_FRAME_VISIBLE (f, 1);
-      ns_raise_frame (f);
+      ns_raise_frame (f, ! FRAME_NO_FOCUS_ON_MAP (f));
 
       /* Making a new frame from a fullscreen frame will make the new frame
          fullscreen also.  So skip handleFS as this will print an error.  */
@@ -1926,6 +1931,26 @@ so some key presses (TAB) are swallowed by the system. */
     }
 }
 
+/**
+ * x_set_no_focus_on_map:
+ *
+ * Set frame F's `no-focus-on-map' parameter which, if non-nil, means
+ * that F's window-system window does not want to receive input focus
+ * when it is mapped.  (A frame's window is mapped when the frame is
+ * displayed for the first time and when the frame changes its state
+ * from `iconified' or `invisible' to `visible'.)
+ *
+ * Some window managers may not honor this parameter.
+ */
+void
+x_set_no_focus_on_map (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
+{
+  if (!EQ (new_value, old_value))
+    {
+      FRAME_NO_FOCUS_ON_MAP (f) = !NILP (new_value);
+    }
+}
+
 void
 x_set_no_accept_focus (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
 /*  Set frame F's `no-accept-focus' parameter which, if non-nil, hints
-- 
2.12.0


  reply	other threads:[~2017-06-11 16:35 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-09 22:20 bug#25408: Remove Decorations Around Emacs Frame (Windows OS) Arthur Miller
2017-01-10  8:23 ` martin rudalics
2017-01-10 17:07   ` Eli Zaretskii
2017-01-10 18:07     ` martin rudalics
2017-01-10 18:27       ` Eli Zaretskii
2017-01-10 20:39         ` Clément Pit--Claudel
2017-01-11  7:08           ` Arthur Miller
2017-01-11  7:24             ` Arthur Miller
2017-01-11  7:48               ` Arthur Miller
2017-01-11  7:50                 ` Arthur Miller
2017-01-11  8:15                   ` Arthur Miller
2017-01-11  8:39                 ` martin rudalics
2017-01-11  9:17                   ` Arthur Miller
2017-01-11 10:20                     ` Arthur Miller
2017-01-11 13:55                       ` martin rudalics
2017-02-07  5:28                   ` Clément Pit--Claudel
2017-02-07  6:53                     ` martin rudalics
2017-02-07 13:05                       ` Clément Pit--Claudel
2017-02-11 14:27                         ` martin rudalics
2017-02-11 21:02                           ` Clément Pit--Claudel
2017-02-11 21:10                             ` Clément Pit--Claudel
2017-02-12 11:13                             ` martin rudalics
2017-02-15 19:49                               ` Arthur Miller
2017-02-16  8:04                                 ` martin rudalics
2017-02-16 13:22                                   ` Arthur Miller
2017-02-16 14:06                                     ` Arthur Miller
2017-02-17  7:03                                       ` martin rudalics
2017-02-17  7:03                                     ` martin rudalics
2017-04-12  9:27                               ` martin rudalics
2017-05-06  0:06                                 ` Clément Pit-Claudel
2017-05-06  7:13                                   ` Eli Zaretskii
2017-05-06 13:26                                     ` Clément Pit-Claudel
2017-05-06  7:40                                   ` martin rudalics
2017-05-06  9:41                                     ` martin rudalics
2017-05-06 13:28                                       ` Clément Pit-Claudel
2017-05-06 14:20                                         ` Eli Zaretskii
2017-05-06 21:01                                           ` Clément Pit-Claudel
2017-05-07  2:30                                             ` Eli Zaretskii
2017-05-07  8:41                                           ` martin rudalics
2017-05-07  8:40                                         ` martin rudalics
2017-05-07 17:19                                           ` Eli Zaretskii
2017-05-07 18:07                                             ` martin rudalics
2017-05-07 18:33                                               ` Eli Zaretskii
2017-05-08  6:48                                                 ` martin rudalics
2017-05-08 14:41                                                   ` Eli Zaretskii
2017-06-25 11:02                                   ` martin rudalics
2017-06-25 16:23                                     ` Clément Pit-Claudel
2017-04-12 17:38                           ` Alan Third
2017-04-12 19:13                             ` martin rudalics
2017-04-12 19:51                               ` Alan Third
2017-04-13  7:10                                 ` martin rudalics
2017-04-13 10:30                                   ` Alan Third
2017-04-13 11:56                                     ` martin rudalics
2017-04-15 16:29                                   ` Alan Third
2017-04-15 19:39                                     ` martin rudalics
2017-04-17 14:56                                       ` bug#25408: Remove Decorations Around Emacs Frame (NS port) Alan Third
2017-04-17 15:43                                         ` martin rudalics
2017-04-17 16:21                                           ` Alan Third
2017-04-17 17:20                                             ` martin rudalics
2017-04-17 18:55                                               ` Alan Third
2017-04-19  7:26                                                 ` martin rudalics
2017-04-19 14:33                                                   ` Alan Third
2017-04-19 16:01                                                     ` martin rudalics
2017-04-19 17:04                                                       ` Alan Third
2017-04-19 18:07                                                         ` martin rudalics
2017-06-10 15:38                                                           ` Alan Third
2017-06-11  8:10                                                             ` martin rudalics
2017-06-11 16:35                                                               ` Alan Third [this message]
2017-06-12  6:09                                                                 ` martin rudalics
2017-06-12 17:59                                                                   ` Alan Third
2017-06-13  7:24                                                                     ` martin rudalics
2017-06-22  9:10                                                                     ` martin rudalics
2017-06-25 14:22                                                                       ` Alan Third
2017-06-25 15:58                                                                         ` martin rudalics
2017-07-15 21:27                                                                           ` Alan Third
2017-07-16  8:28                                                                             ` martin rudalics
2017-04-19 11:24                                         ` Anders Lindgren
2017-04-19 12:50                                           ` martin rudalics
2017-04-19 13:51                                           ` Alan Third
2017-01-11  8:38             ` bug#25408: Remove Decorations Around Emacs Frame (Windows OS) martin rudalics
2017-01-11 16:39             ` Richard Stallman
2017-01-10 19:36 ` Richard Stallman
2017-01-11 13:50 ` bug#25408: SV: " arthur.miller.no1
2017-01-11 13:57   ` martin rudalics
2017-01-11 14:59 ` arthur.miller.no1

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=20170611163544.GA70844@breton.holly.idiocy.org \
    --to=alan@idiocy.org \
    --cc=25408@debbugs.gnu.org \
    --cc=andlind@gmail.com \
    --cc=arthur.miller.no1@gmail.com \
    --cc=clement.pit@gmail.com \
    --cc=rudalics@gmx.at \
    /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.