From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Anders Lindgren Newsgroups: gmane.emacs.bugs Subject: bug#25818: 25.2; frame moved off display does not return (OS X) Date: Mon, 3 Apr 2017 10:33:04 +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/alternative; boundary=001a11425a8015b6c7054c3f02ff X-Trace: blaine.gmane.org 1491208458 31029 195.159.176.226 (3 Apr 2017 08:34:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 3 Apr 2017 08:34:18 +0000 (UTC) Cc: 25818@debbugs.gnu.org To: "Charles A. Roelli" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 03 10:34:13 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 1cuxRC-0007Dg-IR for geb-bug-gnu-emacs@m.gmane.org; Mon, 03 Apr 2017 10:34:10 +0200 Original-Received: from localhost ([::1]:58058 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuxRI-0005fz-GB for geb-bug-gnu-emacs@m.gmane.org; Mon, 03 Apr 2017 04:34:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50113) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuxR8-0005ec-5H for bug-gnu-emacs@gnu.org; Mon, 03 Apr 2017 04:34:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuxR4-00040l-RY for bug-gnu-emacs@gnu.org; Mon, 03 Apr 2017 04:34:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:59890) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuxR4-00040e-Nc for bug-gnu-emacs@gnu.org; Mon, 03 Apr 2017 04:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cuxR4-0007dw-Fu for bug-gnu-emacs@gnu.org; Mon, 03 Apr 2017 04:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Anders Lindgren Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 03 Apr 2017 08: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.149120839429323 (code B ref 25818); Mon, 03 Apr 2017 08:34:02 +0000 Original-Received: (at 25818) by debbugs.gnu.org; 3 Apr 2017 08:33:14 +0000 Original-Received: from localhost ([127.0.0.1]:58089 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cuxQH-0007ct-Np for submit@debbugs.gnu.org; Mon, 03 Apr 2017 04:33:13 -0400 Original-Received: from mail-vk0-f47.google.com ([209.85.213.47]:33786) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cuxQF-0007cf-5S for 25818@debbugs.gnu.org; Mon, 03 Apr 2017 04:33:11 -0400 Original-Received: by mail-vk0-f47.google.com with SMTP id d188so129293423vka.0 for <25818@debbugs.gnu.org>; Mon, 03 Apr 2017 01:33:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=5cOGtrU8Ea0QVbKF6JJYj46g6woxZQzw0E8UVqLw4e0=; b=n+b/8aDwr1W/dQsIyBsdOo2EMXWKYF7l+miZC6yuteG9zYrPwGUO3fXFoLcAl5U4Nd A8tNEARhYOCmnCbvX5AFz18Tetc/Oum30s2JS1lCJqQvIeEzdBi1yvyNyJE9SGa3ohle JnRMurHcbYL90GRH9XGHzR6+3W0T/VapI9jDK1m/dAgAyQjghHuBq2cTiTViAMLObSOW DZCF2dny2SUqujDOMGgxC7fg2HTGGnqrb9yrR2vUPdKvudA+jC+pOR/Y3cUINiLITXcY ZWDhwSftmf8kIE8cggAZ+583waVYYYaaTlsWPM2E0O5apWwtmS1MC/+sFWRSGKiuBcjM pn9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=5cOGtrU8Ea0QVbKF6JJYj46g6woxZQzw0E8UVqLw4e0=; b=GPx7WujnNl22aV25fw59/KIbjzm9MO0VHcRch1du2ewtQisEONPweJv3gFbBbpZbHP tmSRRecwEsuKSVLY2iHplrSW7o56ZGp0H0FV68ecjtodMVr+fx09hZa5S5pvJeSFRO4+ qPRf8M7ZuqINJbW6Wj668smEZoHmNkZ80ZjeaRNqBJIzBBIZk3H/NcPeadGZuBTSt6kI /ZdS61hf07gjgkzqwnJEmjau0EMy8eBH6uTb8HL3yXIsDwcNYn6seJm1p7CUE6sgSVJ0 ZuEraH/xAzqalfpXW0DdK9pz18umBE2TmUeeD4hln0I8rD6fNDM6g62PGb70rngN1p/Z e54Q== X-Gm-Message-State: AFeK/H2lnfHmINf1QqeVEG1Bn1cZq9SsH7PuKLxS5o0Y10bJVJUoBQfUtGqF8ZHmtMJpn8DPUpzKsI59jlKq4Q== X-Received: by 10.31.150.14 with SMTP id y14mr6985361vkd.18.1491208385178; Mon, 03 Apr 2017 01:33:05 -0700 (PDT) Original-Received: by 10.31.165.71 with HTTP; Mon, 3 Apr 2017 01:33:04 -0700 (PDT) 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:131241 Archived-At: --001a11425a8015b6c7054c3f02ff Content-Type: text/plain; charset=UTF-8 Hi! I think this is a good start. However, there is a case that your patch miss. If you have multiple monitors arranged in, say, an L-shape, a frame might be placed inside "multiscreenRect", without actually being visible on any screen. (This typically occur when you have a large desktop monitor connected to a laptop or when you have one monitor placed horizontally and one vertically.) Fortunately, it should be easy to fix. What about something like (in pseudo-code): BOOL in_any_screen = NO; for (screen = /* Loop over all screens */ ...) { if (overlapping(frame, scree)) { in_any_screen = YES; break; } } if ( ! in_any_screen ) { /* Move the frame in */ } Anyway, I think that we're on the right track and I appreciate that you have taken time to work on this! -- Anders PS. I just found another, unrelated, problem, when comparing the NS and X11 versions. When passing a negative value to `set-frame-position' it is supposed to place the frame relative to the right/bottom border of the display, but in the NS version it doesn't. (The X11 version gets the Y placement wrong with 48 pixels, but that is another story.) On Sun, Apr 2, 2017 at 4:14 PM, Charles A. Roelli wrote: > Hi Anders, > > Does the attached patch work for you? It's still a bit rough around the > edges, but seems to do the right thing. > > A quick test on 10.6: > > (setq ns-auto-hide-menu-bar t) > > ;; Places the frame just above the top of the screen. > (set-frame-position (selected-frame) 0 -20) > > ;; Frame would be completely offscreen; so it's constrained and brought > ;; back. > (set-frame-position (selected-frame) 0 -10000) > > Cheers, > Charles > > --001a11425a8015b6c7054c3f02ff Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi!

I think this is a good start. Howev= er, there is a case that your patch miss. If you have multiple monitors arr= anged in, say, an L-shape, a frame might be placed inside "multiscreen= Rect", without actually being visible on any screen. (This typically o= ccur when you have a large desktop monitor connected to a laptop or when yo= u have one monitor placed horizontally and one vertically.)

<= /div>
Fortunately, it should be easy to fix. What about something like = (in pseudo-code):

=C2=A0 =C2=A0 =C2=A0BOOL in_any_= screen =3D NO;
=C2=A0 =C2=A0 =C2=A0for (screen =3D /* Loop over a= ll screens */ ...)
=C2=A0 =C2=A0 =C2=A0 =C2=A0{
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0if (overlapping(frame, scree))
=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0{
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 in_any_screen =3D YES;
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 break;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2= =A0 =C2=A0if ( ! in_any_screen )
=C2=A0 =C2=A0 =C2=A0 =C2=A0{
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* Move the frame in */
= =C2=A0 =C2=A0 =C2=A0 =C2=A0}

Anyway, I think that = we're on the right track and I appreciate that you have taken time to w= ork on this!

=C2=A0 =C2=A0 -- Anders

PS. I just found another, unrelated, problem, when comparin= g the NS and X11 versions. When passing a negative value to `set-frame-posi= tion' it is supposed to place the frame relative to the right/bottom bo= rder of the display, but in the NS version it doesn't. (The X11 version= gets the Y placement wrong with 48 pixels, but that is another story.)
=

On Su= n, Apr 2, 2017 at 4:14 PM, Charles A. Roelli <charles@aurox.ch> wrote:
Hi Anders,

Does the attached patch work for you?=C2=A0 It's still a bit rough arou= nd the
edges, but seems to do the right thing.

A quick test on 10.6:

(setq ns-auto-hide-menu-bar t)

;; Places the frame just above the top of the screen.
(set-frame-position (selected-frame) 0 -20)

;; Frame would be completely offscreen; so it's constrained and brought=
;; back.
(set-frame-position (selected-frame) 0 -10000)

Cheers,
Charles


--001a11425a8015b6c7054c3f02ff--