From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Andrii Kolomoiets Newsgroups: gmane.emacs.bugs Subject: bug#36672: 27.0.50; NS build: Creating child frame leads to empty space Date: Wed, 17 Jul 2019 21:51:47 +0300 Message-ID: <213A995F-5DF6-4CE1-9365-1E227B732CE7@gmail.com> References: <04CF7A6F-C1E7-4FE5-B648-8DA8CBD3B1ED@gmail.com> <20190716192822.GA63701@breton.holly.idiocy.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_F6C08BAC-3CDA-4FBC-B7B9-D4FE4B5082AF" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="133491"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 36672@debbugs.gnu.org To: Alan Third Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 17 20:52:07 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hnp26-000YcR-US for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Jul 2019 20:52:07 +0200 Original-Received: from localhost ([::1]:59950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hnp25-000877-RC for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Jul 2019 14:52:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38978) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hnp23-000871-AS for bug-gnu-emacs@gnu.org; Wed, 17 Jul 2019 14:52:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hnp22-0006Hh-7s for bug-gnu-emacs@gnu.org; Wed, 17 Jul 2019 14:52:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44175) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hnp22-0006HZ-3E for bug-gnu-emacs@gnu.org; Wed, 17 Jul 2019 14:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hnp21-0004Mz-Tj for bug-gnu-emacs@gnu.org; Wed, 17 Jul 2019 14:52:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrii Kolomoiets Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Jul 2019 18:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36672 X-GNU-PR-Package: emacs Original-Received: via spool by 36672-submit@debbugs.gnu.org id=B36672.156338951916786 (code B ref 36672); Wed, 17 Jul 2019 18:52:01 +0000 Original-Received: (at 36672) by debbugs.gnu.org; 17 Jul 2019 18:51:59 +0000 Original-Received: from localhost ([127.0.0.1]:52996 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hnp1z-0004Mg-8W for submit@debbugs.gnu.org; Wed, 17 Jul 2019 14:51:59 -0400 Original-Received: from mail-wr1-f68.google.com ([209.85.221.68]:36981) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hnp1w-0004MP-7L for 36672@debbugs.gnu.org; Wed, 17 Jul 2019 14:51:57 -0400 Original-Received: by mail-wr1-f68.google.com with SMTP id n9so881086wrr.4 for <36672@debbugs.gnu.org>; Wed, 17 Jul 2019 11:51:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=xLzlLXz9i7gJX6IXWV+3CvFKppK3qUKGn1Q5/d96gqM=; b=oxjljmu3zocjmle3ZlZAaTPLI6n1QxTu2M4SKwyLv6fOkxpBNnPzvo2fGrJCgbj7HE RohMO+yX21lu6Ou//DnOmjinTHGVqNpv2n+vB8tKrlfbV/PCvEUK4bCRmDq1c6R0fRmk F7m//VYGqdFW/0XR1f8HFgklN1YN9FTq2/23WPThIhmH9bcov/sOkiUORkLoS9Cl4tv2 UWxEP+6e4A9BJNakAySINCnClgaIVBx8cNFlxMKu+M1EnTjKbkQnXB1X6UzhOlVgBtsg 93zsxW85ncVhmUNYctCrFJ/3SdVrl4tYtnVUxAYJ8eON2i3JliqqBeqrD5ZkPUFtrNYP Ojuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=xLzlLXz9i7gJX6IXWV+3CvFKppK3qUKGn1Q5/d96gqM=; b=kPaaLqCQL2JWArosAegeZTwoD+ktWvhY2Vx1C+nFmvyyKvH6LqsmvPyzgbIvIiH3Ml rxtraxcR6z/RQvEl7iSvrOvUJUe7MYDkvlO6cZzcgJO5/laomcqeVyDLsMatY1bu/8iA LjI2SG5CqojlSCAccYAFDdgOLFuCI5I7qjS90I/Eimi1zADXTIB5u5h0oy0tLs4ItZhl vPp49pMxsGO4ts5j0U6TNdmE4+LkFOL0bOxu6zA9LOwI089o57rqB8OOx5+OXzpHAaUm +PlZBcDP5kqsLugUkH3y4EGA+2oBM5OQqJwrgXVQA4ZoeCThS/vPKGsEaSzZNgDA0Usv W8rA== X-Gm-Message-State: APjAAAV/NTiGo2JiNUQREdkGTOnp9Jl5QSA142jV+R/LmscToEB8ri5O gX8JQAvgMi+1wEfYVRYC6ws= X-Google-Smtp-Source: APXvYqysS7QAyCHv6yODAKGbmRTp36uLcGg6kke9w75yklh+ocx/LKJmpb0pTOr5K56XfJ7g7R4+ww== X-Received: by 2002:a5d:63c8:: with SMTP id c8mr1733172wrw.21.1563389509309; Wed, 17 Jul 2019 11:51:49 -0700 (PDT) Original-Received: from [192.168.0.100] ([91.206.110.133]) by smtp.gmail.com with ESMTPSA id x185sm13642195wmg.46.2019.07.17.11.51.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jul 2019 11:51:48 -0700 (PDT) In-Reply-To: <20190716192822.GA63701@breton.holly.idiocy.org> X-Mailer: Apple Mail (2.3445.104.11) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:163263 Archived-At: --Apple-Mail=_F6C08BAC-3CDA-4FBC-B7B9-D4FE4B5082AF Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 On Jul 16, 2019, at 22:28, Alan Third wrote: >=20 > On Mon, Jul 15, 2019 at 08:38:31PM +0300, Andrii Kolomoiets wrote: >> Assume there are only one space - Desktop >> 1. emacs -Q >> 2. M-x toggle-frame-fullscreen >> Now there are two spaces - Desktop and *scratch* >> 3. eval (make-frame `((parent-frame . ,(window-frame)))) >> Now there are three spaces: >> - Desktop >> - Empty space named *scratch* with emacs menu >> - *scratch* with emacs frames but without menu >=20 > I hit C-x C-c at this point to exit Emacs and it completely crashed my > session. Not great... >=20 > The patch looks good to me, but lets see if we can find solutions to > these other issues. To be honest, given that Apple don=E2=80=99t = provide any > way to properly deal with spaces, I=E2=80=99d expect this stuff to be = handled > sensibly by default, but I guess that=E2=80=99s too much to ask. >=20 >> 1. Removing parent-frame property leaves the frame is same space: >>=20 >> (let ((new-frame (make-frame `((parent-frame . ,(window-frame)))))) >> (modify-frame-parameters new-frame `((parent-frame . nil)))) >>=20 >> Maybe child frame must go fullscreen if ex-parent frame is in >> fullscreen. >=20 > I suppose the best thing to do would be to move it onto the first > space, but there=E2=80=99s no API for that, apparently. Going = fullscreen seems > like a reasonable work=E2=80=90around to me. >=20 I manage to make this code work. Please see attached updated patch. But this patch is not completely ready as it missing compilation = conditions. Just hope you find it useful. >> 2. Setting parent frame after frame creation: >>=20 >> (let ((frame (window-frame)) >> (new-frame (make-frame))) >> (modify-frame-parameters new-frame `((parent-frame . ,frame)))) >=20 > What do you see happening in this case? I=E2=80=99ve got spaces turned = on and > everything I do just seems to create a new fullscreen space (except > when it crashes my session). >=20 I see same result as in the first case: Desktop, empty blank space with Emacs menu, space with Emacs frame and no menu/titlebar. Still can't make this case work. Probably window animation stand in the = way: nsterm.m : 1869: [ 376] ns_set_parent_frame nsterm.m : 1912: [ 377] | child frame must not be in fullscreen 2019-07-17 21:20:49.027 Emacs[91925:3597098] not in fullscreen state If ns_set_parent_frame is called while window is still in process of = going full screen then maybe it must be deferred until animation ends. --Apple-Mail=_F6C08BAC-3CDA-4FBC-B7B9-D4FE4B5082AF Content-Disposition: attachment; filename=ns-emacs-spaces-wip.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="ns-emacs-spaces-wip.patch" Content-Transfer-Encoding: 7bit diff --git a/src/nsterm.h b/src/nsterm.h index 9773eb3e66..d16588718e 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -1274,6 +1274,7 @@ extern char gnustep_base_version[]; /* version tracking */ #if !defined (NS_IMPL_COCOA) || !defined (MAC_OS_X_VERSION_10_7) #define NSFullScreenWindowMask (1 << 14) #define NSWindowCollectionBehaviorFullScreenPrimary (1 << 7) +#define NSWindowCollectionBehaviorFullScreenAuxiliary (1 << 8) #define NSApplicationPresentationFullScreen (1 << 10) #define NSApplicationPresentationAutoHideToolbar (1 << 11) #define NSAppKitVersionNumber10_7 1138 diff --git a/src/nsterm.m b/src/nsterm.m index 02331826d9..8725520d4a 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -1884,6 +1884,8 @@ so some key presses (TAB) are swallowed by the system. */ if ([child parentWindow] != nil) { + parent = [child parentWindow]; + [[child parentWindow] removeChildWindow:child]; #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 #if MAC_OS_X_VERSION_MIN_REQUIRED < 101000 @@ -1891,10 +1893,28 @@ so some key presses (TAB) are swallowed by the system. */ #endif [child setAccessibilitySubrole:NSAccessibilityStandardWindowSubrole]; #endif + if (NILP (new_value)){ + NSTRACE ("child setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary"); + [child setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; + // TODO check parents of parent + if (([parent styleMask] & NSWindowStyleMaskFullScreen) != 0){ + // if current parent in fullscreen and not new parent make child fullscreen + NSTRACE ("make child fullscreen"); + [child toggleFullScreen:child]; + } + } } if (!NILP (new_value)) { + // child frame must not be in fullscreen + if (([child styleMask] & NSWindowStyleMaskFullScreen) != 0){ + NSTRACE ("child frame must not be in fullscreen"); + [child toggleFullScreen:child]; + } + NSTRACE ("child setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary"); + [child setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary]; + parent = [FRAME_NS_VIEW (p) window]; [parent addChildWindow: child @@ -7365,7 +7385,10 @@ - (instancetype) initFrameFromEmacs: (struct frame *)f #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 if (NSAppKitVersionNumber >= NSAppKitVersionNumber10_7) #endif - [win setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; + if (FRAME_PARENT_FRAME (f)) + [win setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary]; + else + [win setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; #endif wr = [win frame]; --Apple-Mail=_F6C08BAC-3CDA-4FBC-B7B9-D4FE4B5082AF--