unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#48865: [PATCH] Allow ‘ns-hide-emacs’ to bring only the selected frame forward
@ 2021-06-06  5:23 Matt Beshara
  2021-06-11 17:22 ` Alan Third
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Beshara @ 2021-06-06  5:23 UTC (permalink / raw)
  To: 48865


[-- Attachment #1.1: Type: text/plain, Size: 713 bytes --]

Hi there,
I have attached a patch which adds a new capability to the 
‘ns-hide-emacs’ function in the NS port.  Specifically, it causes 
the ‘ns-hide-emacs’ function to respond to being called with the 
argument 'activate-front in a similar way to how it responds when 
called with 'activate.  The difference is, instead of layering 
every Emacs frame in front of every other application’s windows, 
it only brings the selected frame forward.  I have uploaded a 
small video of the new functionality in action here: 
https://mfa.pw/activate-front.mp4

Please let me know if any modifications would need to be made to
this patch before it could be accepted.

Thanks for your time,
Matt


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: activate-front.patch --]
[-- Type: text/x-patch, Size: 1709 bytes --]

From e595e37fa7ea503020e8acfe82324cff7751bf3d Mon Sep 17 00:00:00 2001
From: Matt Beshara <m@mfa.pw>
Date: Sun, 6 Jun 2021 13:06:47 +1000
Subject: [PATCH] =?UTF-8?q?Allow=20=E2=80=98ns-hide-emacs=E2=80=99=20to=20?=
 =?UTF-8?q?bring=20only=20the=20selected=20frame=20forward?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/nsfns.m | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/nsfns.m b/src/nsfns.m
index d14f7b51ea..f6ad1f7b9d 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1953,8 +1953,11 @@ Frames are listed from topmost (first) to bottommost (last).  */)
        doc: /* If ON is non-nil, the entire Emacs application is hidden.
 Otherwise if Emacs is hidden, it is unhidden.
 If ON is equal to `activate', Emacs is unhidden and becomes
-the active application.  */)
-     (Lisp_Object on)
+the active application.
+If ON is equal to `activate-front', Emacs is unhidden and
+becomes the active application, but only the selected frame
+is layered in front of the windows of other applications.  */)
+  (Lisp_Object on)
 {
   check_window_system (NULL);
   if (EQ (on, intern ("activate")))
@@ -1962,6 +1965,12 @@ Frames are listed from topmost (first) to bottommost (last).  */)
       [NSApp unhide: NSApp];
       [NSApp activateIgnoringOtherApps: YES];
     }
+  else if (EQ (on, intern ("activate-front")))
+    {
+      [NSApp unhide: NSApp];
+      [[NSRunningApplication currentApplication]
+        activateWithOptions: NSApplicationActivateIgnoringOtherApps];
+    }
   else if (NILP (on))
     [NSApp unhide: NSApp];
   else
-- 
2.24.3 (Apple Git-128)


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 239 bytes --]

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

* bug#48865: [PATCH] Allow ‘ns-hide-emacs’ to bring only the selected frame forward
  2021-06-06  5:23 bug#48865: [PATCH] Allow ‘ns-hide-emacs’ to bring only the selected frame forward Matt Beshara
@ 2021-06-11 17:22 ` Alan Third
  2021-06-11 23:39   ` Matt Beshara
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Third @ 2021-06-11 17:22 UTC (permalink / raw)
  To: Matt Beshara; +Cc: 48865

On Sun, Jun 06, 2021 at 03:23:31PM +1000, Matt Beshara wrote:
> Hi there,
> I have attached a patch which adds a new capability to the ‘ns-hide-emacs’
> function in the NS port.  Specifically, it causes the ‘ns-hide-emacs’
> function to respond to being called with the argument 'activate-front in a
> similar way to how it responds when called with 'activate.  The difference
> is, instead of layering every Emacs frame in front of every other
> application’s windows, it only brings the selected frame forward.  I have
> uploaded a small video of the new functionality in action here:
> https://mfa.pw/activate-front.mp4

Hi, I don't see any problems with this.

> Please let me know if any modifications would need to be made to
> this patch before it could be accepted.

If you could fill out the commit message in line with CONTRIBUTE, that
would be great.

Thanks!
-- 
Alan Third





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

* bug#48865: [PATCH] Allow ‘ns-hide-emacs’ to bring only the selected frame forward
  2021-06-11 17:22 ` Alan Third
@ 2021-06-11 23:39   ` Matt Beshara
  2021-06-12  9:15     ` Alan Third
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Beshara @ 2021-06-11 23:39 UTC (permalink / raw)
  To: Alan Third; +Cc: 48865


[-- Attachment #1.1: Type: text/plain, Size: 1091 bytes --]


Alan Third <alan@idiocy.org> writes:

Hi Alan,
I’ve attached an updated patch.
Is the commit message OK?

Matt

> On Sun, Jun 06, 2021 at 03:23:31PM +1000, Matt Beshara wrote:
>> Hi there,
>> I have attached a patch which adds a new capability to the 
>> ‘ns-hide-emacs’
>> function in the NS port.  Specifically, it causes the 
>> ‘ns-hide-emacs’
>> function to respond to being called with the argument 
>> 'activate-front in a
>> similar way to how it responds when called with 'activate.  The 
>> difference
>> is, instead of layering every Emacs frame in front of every 
>> other
>> application’s windows, it only brings the selected frame 
>> forward.  I have
>> uploaded a small video of the new functionality in action here:
>> https://mfa.pw/activate-front.mp4
>
> Hi, I don't see any problems with this.
>
>> Please let me know if any modifications would need to be made 
>> to
>> this patch before it could be accepted.
>
> If you could fill out the commit message in line with 
> CONTRIBUTE, that
> would be great.
>
> Thanks!


[-- Attachment #1.2: activate-front-2.patch --]
[-- Type: text/x-patch, Size: 1835 bytes --]

From 6458bf34fd29dbc34ac0f91a087dbaaccc6c13a3 Mon Sep 17 00:00:00 2001
From: Matt Beshara <m@mfa.pw>
Date: Sun, 6 Jun 2021 13:06:47 +1000
Subject: [PATCH] * src/nsfns.m (Fns_hide_emacs): Allow activating only
 selected frame
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Causes ‘ns-hide-emacs’ to layer the selected frame in front of every other
application’s windows, and give that frame keyboard focus, when called with
'activate-front.
---
 src/nsfns.m | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/nsfns.m b/src/nsfns.m
index 98801d8526..454a6fdab6 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1953,8 +1953,11 @@ Frames are listed from topmost (first) to bottommost (last).  */)
        doc: /* If ON is non-nil, the entire Emacs application is hidden.
 Otherwise if Emacs is hidden, it is unhidden.
 If ON is equal to `activate', Emacs is unhidden and becomes
-the active application.  */)
-     (Lisp_Object on)
+the active application.
+If ON is equal to `activate-front', Emacs is unhidden and
+becomes the active application, but only the selected frame
+is layered in front of the windows of other applications.  */)
+  (Lisp_Object on)
 {
   check_window_system (NULL);
   if (EQ (on, intern ("activate")))
@@ -1962,6 +1965,12 @@ Frames are listed from topmost (first) to bottommost (last).  */)
       [NSApp unhide: NSApp];
       [NSApp activateIgnoringOtherApps: YES];
     }
+  else if (EQ (on, intern ("activate-front")))
+    {
+      [NSApp unhide: NSApp];
+      [[NSRunningApplication currentApplication]
+        activateWithOptions: NSApplicationActivateIgnoringOtherApps];
+    }
   else if (NILP (on))
     [NSApp unhide: NSApp];
   else
-- 
2.24.3 (Apple Git-128)


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 239 bytes --]

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

* bug#48865: [PATCH] Allow ‘ns-hide-emacs’ to bring only the selected frame forward
  2021-06-11 23:39   ` Matt Beshara
@ 2021-06-12  9:15     ` Alan Third
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Third @ 2021-06-12  9:15 UTC (permalink / raw)
  To: Matt Beshara; +Cc: 48865

On Sat, Jun 12, 2021 at 09:39:13AM +1000, Matt Beshara wrote:
> 
> Alan Third <alan@idiocy.org> writes:
> 
> Hi Alan,
> I’ve attached an updated patch.
> Is the commit message OK?

Near enough. I've made a few small changes and will push it. I take it
you've done the copyright paperwork?

-- 
Alan Third





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

end of thread, other threads:[~2021-06-12  9:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-06  5:23 bug#48865: [PATCH] Allow ‘ns-hide-emacs’ to bring only the selected frame forward Matt Beshara
2021-06-11 17:22 ` Alan Third
2021-06-11 23:39   ` Matt Beshara
2021-06-12  9:15     ` 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).