From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Charles A. Roelli" Newsgroups: gmane.emacs.bugs Subject: bug#25818: 25.2; frame moved off display does not return (OS X) Date: Thu, 27 Apr 2017 21:14:05 +0200 Message-ID: References: <58AEA232.4000708@gmx.at> <58B30634.1090904@gmx.at> <58B3DDBA.6060003@gmx.at> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------55AD41D0C9147250318857EA" X-Trace: blaine.gmane.org 1493320514 3299 195.159.176.226 (27 Apr 2017 19:15:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 27 Apr 2017 19:15:14 +0000 (UTC) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cc: 25818@debbugs.gnu.org, alan@idiocy.org To: Anders Lindgren Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Apr 27 21:15:08 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d3osd-0000j8-S4 for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Apr 2017 21:15:08 +0200 Original-Received: from localhost ([::1]:33857 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3osj-0002vG-Pm for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Apr 2017 15:15:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35052) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d3osc-0002tf-W7 for bug-gnu-emacs@gnu.org; Thu, 27 Apr 2017 15:15:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d3osY-0003aP-VV for bug-gnu-emacs@gnu.org; Thu, 27 Apr 2017 15:15:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45023) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d3osY-0003aK-Pp for bug-gnu-emacs@gnu.org; Thu, 27 Apr 2017 15:15:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d3osY-0002Q8-IP for bug-gnu-emacs@gnu.org; Thu, 27 Apr 2017 15:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Charles A. Roelli" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 27 Apr 2017 19:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25818 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 25818-submit@debbugs.gnu.org id=B25818.14933204599235 (code B ref 25818); Thu, 27 Apr 2017 19:15:02 +0000 Original-Received: (at 25818) by debbugs.gnu.org; 27 Apr 2017 19:14:19 +0000 Original-Received: from localhost ([127.0.0.1]:43222 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d3orq-0002Os-PO for submit@debbugs.gnu.org; Thu, 27 Apr 2017 15:14:18 -0400 Original-Received: from sinyavsky.aurox.ch ([37.35.109.145]:35437) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d3orp-0002Oe-0Y for 25818@debbugs.gnu.org; Thu, 27 Apr 2017 15:14:17 -0400 Original-Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 0F2E622400 for <25818@debbugs.gnu.org>; Thu, 27 Apr 2017 19:10:08 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-type:content-type:in-reply-to:mime-version:user-agent :date:date:message-id:from:from:references:to:subject:subject; s=dkim; t=1493320206; x=1494184207; bh=4SgDicC07bYPzyIaBUOGY72k LYrEsPYjcwW40i+pSmY=; b=Yp1r8Mrfwf8QE9hmDqHUsZU8P3Eyjjj/T0HI1xnX +Ro1jOX9Dye9iKzymDqxqm/4iTCv0R+x10QZD02LQJYCiz2hL/YHiWuAPgobIfoj K1FE9cL23yRmmLJMfXi3OjQFWovGJ2sdwqxFQ29OetNAQTO3HOOmtQwdkZS8i4M8 v3g= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Original-Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id d2OiPbDX8J9s for <25818@debbugs.gnu.org>; Thu, 27 Apr 2017 19:10:06 +0000 (UTC) Original-Received: from [192.168.1.106] (179.133.105.92.dynamic.wline.res.cust.swisscom.ch [92.105.133.179]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id B1A07223E5; Thu, 27 Apr 2017 19:10:04 +0000 (UTC) In-Reply-To: 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: 208.118.235.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:132058 Archived-At: This is a multi-part message in MIME format. --------------55AD41D0C9147250318857EA Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi Anders, As discussed off-list, the copyright assignment is done. I fixed the patch so that child frames are never constrained (after some testing, it seems that a child frame cannot get stuck off screen as long as its parent is still visible). To test this out, evaluate the following from emacs -Q, (progn (setq test-frame (make-frame `((parent-frame . ,(selected-frame))))) (set-frame-position test-frame 0 500)) and drag the parent frame down until its child is off screen. When the parent is moved back up, the child should reappear with it. (Assuming Spaces is off; not sure what would happen in OS X 10.9+ in this case when Spaces is on... I guess the child would be constrained before it is placed off screen?). I've also CC'ed Alan since this change is related to the new frame parameters. Cheers, Charles --------------55AD41D0C9147250318857EA Content-Type: text/x-patch; name="0001-Constrain-non-child-frames-to-screen-area-in-OS-X.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Constrain-non-child-frames-to-screen-area-in-OS-X.patch" >From d2ed9a7bed8872bd89c32d3475607a6e5a271198 Mon Sep 17 00:00:00 2001 From: Charles A. Roelli Date: Thu, 27 Apr 2017 20:44:09 +0200 Subject: [PATCH] Constrain non-child frames to screen area in OS X * src/nsterm.m (constrainFrameRect:toScreen:): Constrain non-child frames in OS X, if they would otherwise go offscreen. Fixes: debbugs:25818 --- src/nsterm.m | 35 ++++++++++++++++++++++++++++++++++- 1 files changed, 34 insertions(+), 1 deletions(-) diff --git a/src/nsterm.m b/src/nsterm.m index 8c5eb06..f0495c4 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -8011,8 +8011,40 @@ - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen NSTRACE_RETURN_RECT (frameRect); return frameRect; } -#endif + else +#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 */ + // Check that the proposed frameRect is visible in at least one + // screen. If it is not, ask the system to reposition it (only + // for non-child frames). + + if (!FRAME_PARENT_FRAME (((EmacsView *)[self delegate])->emacsframe)) + { + NSArray *screens = [NSScreen screens]; + NSUInteger nr_screens = [screens count]; + + int i; + BOOL frame_on_screen = NO; + + for (i = 0; i < nr_screens; ++i) + { + NSScreen *s = [screens objectAtIndex: i]; + NSRect scrRect = [s frame]; + + if (NSIntersectsRect(frameRect, scrRect)) + { + frame_on_screen = YES; + break; + } + } + + if (!frame_on_screen) + { + NSTRACE_MSG ("Frame outside screens; constraining"); + frameRect = [super constrainFrameRect:frameRect toScreen:screen]; + NSTRACE_RETURN_RECT (frameRect); + return frameRect; + } + } #endif return constrain_frame_rect(frameRect, -- 1.7.4.4 --------------55AD41D0C9147250318857EA--