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: Fri, 28 Apr 2017 19:33:00 +0200 Message-ID: <1df59292-0652-fd04-686f-0e4d4a61105a@aurox.ch> References: <20170427200523.GA51359@breton.holly.idiocy.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------C38AE984E99F6AFFC0228855" X-Trace: blaine.gmane.org 1493400850 15816 195.159.176.226 (28 Apr 2017 17:34:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 28 Apr 2017 17:34:10 +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, Anders Lindgren To: Alan Third Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Apr 28 19:34:06 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 1d49mP-00040O-TB for geb-bug-gnu-emacs@m.gmane.org; Fri, 28 Apr 2017 19:34:06 +0200 Original-Received: from localhost ([::1]:38174 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d49mV-00021X-LC for geb-bug-gnu-emacs@m.gmane.org; Fri, 28 Apr 2017 13:34:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43521) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d49mQ-00021R-9Y for bug-gnu-emacs@gnu.org; Fri, 28 Apr 2017 13:34:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d49mN-0006tY-58 for bug-gnu-emacs@gnu.org; Fri, 28 Apr 2017 13:34:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46771) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d49mM-0006tR-Rs for bug-gnu-emacs@gnu.org; Fri, 28 Apr 2017 13:34:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d49mM-0005E3-Ft for bug-gnu-emacs@gnu.org; Fri, 28 Apr 2017 13:34: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: Fri, 28 Apr 2017 17:34: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.149340079319995 (code B ref 25818); Fri, 28 Apr 2017 17:34:02 +0000 Original-Received: (at 25818) by debbugs.gnu.org; 28 Apr 2017 17:33:13 +0000 Original-Received: from localhost ([127.0.0.1]:44970 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d49lZ-0005CR-7h for submit@debbugs.gnu.org; Fri, 28 Apr 2017 13:33:13 -0400 Original-Received: from sinyavsky.aurox.ch ([37.35.109.145]:36151) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d49lW-0005C8-Vr for 25818@debbugs.gnu.org; Fri, 28 Apr 2017 13:33:11 -0400 Original-Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id C021E22407 for <25818@debbugs.gnu.org>; Fri, 28 Apr 2017 17:29:02 +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=1493400540; x=1494264541; bh=X6d31ap31Em06wr39XiEf7Mh kQCjmhBosUd9SjxG6nw=; b=NcO0aAp+/GTqyCvTBrOSR5LAaZtdgN2gukQTmY7s LJ7kPHOqvvmYbwTTs79IlHADL1071BC2yfKBH/sU164D/N37k3sDAuzeBUoIextF XVqIbB92F+0SdWMSkZ1gTDoVGhfgkXNAE9CCkpLGqLp1n0pQ7oOeveRsLosRPNob ShI= 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 DP3yseHnn5YX for <25818@debbugs.gnu.org>; Fri, 28 Apr 2017 17:29:00 +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 B3847223E5; Fri, 28 Apr 2017 17:28:58 +0000 (UTC) In-Reply-To: <20170427200523.GA51359@breton.holly.idiocy.org> 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:132082 Archived-At: This is a multi-part message in MIME format. --------------C38AE984E99F6AFFC0228855 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 27/04/2017 22:05, Alan Third wrote: > Looks good to me. It doesn’t actually apply here, so I did it > manually. I suspect it just needs rebased onto a more recent commit or > something. You're right: attached is the rebased version. >> 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. > If you put the top of the child frame off the top of the screen, then > click on it, it jumps back down so the titlebar is visible again. Is > this intentional? For me, this can be prevented by setting variable `ns-auto-hide-menu-bar' to t. And on OS X 10.9+, the behavior may change if you have Spaces enabled (I haven't tested it). >> * src/nsterm.m (constrainFrameRect:toScreen:): Constrain non-child >> frames in OS X, if they would otherwise go offscreen. > I can’t find this in CONTRIBUTE, but you’re allowed to specify > #ifdef’d code with something like: > > * src/nsterm.m (constrainFrameRect:toScreen:) [NS_IMPL_COCOA]: > Constrain non-child frames if they would otherwise go offscreen. > > Thanks for working on this. :) My pleasure, and thank you for your work on the NS port. --------------C38AE984E99F6AFFC0228855 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 6a68480187916af3136e36596f50226f3544ded4 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 f75a9fe..c22c5a7 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -8040,7 +8040,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 windows). + + 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 --------------C38AE984E99F6AFFC0228855--