From debbugs-submit-bounces@debbugs.gnu.org Sat May 13 03:43:51 2017 Received: (at submit) by debbugs.gnu.org; 13 May 2017 07:43:51 +0000 Received: from localhost ([127.0.0.1]:41718 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9RiR-0003EQ-AE for submit@debbugs.gnu.org; Sat, 13 May 2017 03:43:51 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57334) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9RiP-0003ED-9c for submit@debbugs.gnu.org; Sat, 13 May 2017 03:43:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d9RiJ-0003aV-1A for submit@debbugs.gnu.org; Sat, 13 May 2017 03:43:43 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:37681) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d9RiI-0003aR-UX for submit@debbugs.gnu.org; Sat, 13 May 2017 03:43:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48303) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d9RiH-0005mW-PT for bug-gnu-emacs@gnu.org; Sat, 13 May 2017 03:43:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d9RiE-0003XA-Mw for bug-gnu-emacs@gnu.org; Sat, 13 May 2017 03:43:41 -0400 Received: from [195.159.176.226] (port=43536 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d9RiE-0003T3-GM for bug-gnu-emacs@gnu.org; Sat, 13 May 2017 03:43:38 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1d9Ri5-0001hp-33 for bug-gnu-emacs@gnu.org; Sat, 13 May 2017 09:43:29 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: "Charles A. Roelli" Subject: 25.2: MacOS: tooltips show in wrong display Date: Sat, 13 May 2017 09:43:27 +0200 Lines: 41 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 X-Mozilla-News-Host: news://news.gmane.org:119 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Continuing from bug#26816 (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26816#32): On 11/05/2017 23:43, Alan Third wrote: >> This now reminds me of a related problem, though: with Emacs 25.2 (or in >> Emacs 26, with the above change applied to NS_PARENT_WINDOW_TOP_POS(f)), >> tooltips originating from an area with a help-echo property (like "Lisp >> Interaction" in the mode line in emacs -Q) in a frame on the secondary >> monitor actually show up in the primary monitor instead -- as if the tooltip >> frame is constrained to having a positive x-coordinate only. I haven't >> found where it happens, but I guess the cause is similar. > > Look at compute_tip_xy in nsfns.m. It moves tooltips into the positive > screen space. I’ve not managed to get to grips with this code yet. > > I think what we want is for it to try to keep the tooltip on one > screen, so it’s not spanning two monitors, but allow it to go into > negative space. > > Perhaps this should be a separate bug report. "Primary" and "secondary" monitors are as follows: (display-monitor-attributes-list) => (((name . "Color LCD") (geometry 0 0 1280 800) (workarea 0 22 1280 714) (mm-size 290 180) (frames # # # # # #) (source . "NS")) ((name . "DELL 2007WFP") (geometry -1050 -880 1050 1680) (workarea -1050 -880 1050 1680) (mm-size 430 270) (frames #) (source . "NS"))) From debbugs-submit-bounces@debbugs.gnu.org Sat May 13 05:02:17 2017 Received: (at 26905) by debbugs.gnu.org; 13 May 2017 09:02:17 +0000 Received: from localhost ([127.0.0.1]:41753 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9SwL-00052n-9F for submit@debbugs.gnu.org; Sat, 13 May 2017 05:02:17 -0400 Received: from sinyavsky.aurox.ch ([37.35.109.145]:46354) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9SwI-00052a-0E for 26905@debbugs.gnu.org; Sat, 13 May 2017 05:02:15 -0400 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id E689122424 for <26905@debbugs.gnu.org>; Sat, 13 May 2017 08:57:50 +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-transfer-encoding:content-type:content-type:in-reply-to :mime-version:user-agent:date:date:message-id:from:from :references:to:subject:subject; s=dkim; t=1494665869; x= 1495529870; bh=1SFzzQXpPoPiM/eCrArcFaKNfC8F00RVQIV5MAQs8B4=; b=e izyTb/ItGJnoicSxJFakg9gCHPiO3y7OkKeEbKU9Q3/xSh/ndJq1qdgiDHRYsaFF oe0bJ7HIXiOzHGxOBfG4c3iU6dQ6BM3Wn1ZEL8ZM5L/e5DgwWVYFe9IsWWzoZpbj gJm1wdKeIcwW5yx8IdjcPH10ZN3y23AZfjyzVJkLAk= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com 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 PUVz4Zb7HN2N for <26905@debbugs.gnu.org>; Sat, 13 May 2017 08:57:49 +0000 (UTC) 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 807EC22422 for <26905@debbugs.gnu.org>; Sat, 13 May 2017 08:57:49 +0000 (UTC) Subject: Re: bug#26905: 25.2: MacOS: tooltips show in wrong display To: 26905@debbugs.gnu.org References: From: "Charles A. Roelli" Message-ID: Date: Sat, 13 May 2017 11:02:04 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 26905 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) If I remove the marked lines in compute_tip_xy: if (INTEGERP (left) || INTEGERP (right)) *root_x = pt.x; => else if (pt.x + XINT (dx) <= 0) => *root_x = 0; /* Can happen for negative dx */ else if (pt.x + XINT (dx) + width <= x_display_pixel_width (FRAME_DISPLAY_INFO (f))) /* It fits to the right of the pointer. */ *root_x = pt.x + XINT (dx); else if (width + XINT (dx) <= pt.x) /* It fits to the left of the pointer. */ *root_x = pt.x - width - XINT (dx); else /* Put it left justified on the screen -- it ought to fit that way. */ *root_x = 0; Then the problem is gone. I notice now, though, that the tooltip can end up partially offscreen, both with and without the above change (e.g. when you create a tooltip with the mouse pointer at the right edge of the primary monitor). IIRC on GNU/Linux the tooltip is adjusted to fit on screen. Maybe this adjustment works on newer versions of OS X? From debbugs-submit-bounces@debbugs.gnu.org Sat May 13 05:57:11 2017 Received: (at 26905) by debbugs.gnu.org; 13 May 2017 09:57:11 +0000 Received: from localhost ([127.0.0.1]:41807 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9TnT-00086i-A0 for submit@debbugs.gnu.org; Sat, 13 May 2017 05:57:11 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50166) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9TnS-00086U-33 for 26905@debbugs.gnu.org; Sat, 13 May 2017 05:57:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d9TnI-0003Z9-14 for 26905@debbugs.gnu.org; Sat, 13 May 2017 05:57:04 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:45102) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d9TnH-0003Z4-Tn; Sat, 13 May 2017 05:56:59 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3863 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1d9TnH-0003aF-8P; Sat, 13 May 2017 05:56:59 -0400 Date: Sat, 13 May 2017 12:56:39 +0300 Message-Id: <83o9ux84h4.fsf@gnu.org> From: Eli Zaretskii To: "Charles A. Roelli" In-reply-to: (charles@aurox.ch) Subject: Re: bug#26905: 25.2: MacOS: tooltips show in wrong display References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 26905 Cc: 26905@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: "Charles A. Roelli" > Date: Sat, 13 May 2017 11:02:04 +0200 > > If I remove the marked lines in compute_tip_xy: > > if (INTEGERP (left) || INTEGERP (right)) > *root_x = pt.x; > => else if (pt.x + XINT (dx) <= 0) > => *root_x = 0; /* Can happen for negative dx */ > else if (pt.x + XINT (dx) + width > <= x_display_pixel_width (FRAME_DISPLAY_INFO (f))) > /* It fits to the right of the pointer. */ > *root_x = pt.x + XINT (dx); > else if (width + XINT (dx) <= pt.x) > /* It fits to the left of the pointer. */ > *root_x = pt.x - width - XINT (dx); > else > /* Put it left justified on the screen -- it ought to fit that way. */ > *root_x = 0; > > Then the problem is gone. Those lines were added to fix some problems (whose particulars I cannot find at the moment), so we shouldn't remove them without understanding what is going on. From debbugs-submit-bounces@debbugs.gnu.org Sat May 13 10:04:54 2017 Received: (at 26905) by debbugs.gnu.org; 13 May 2017 14:04:54 +0000 Received: from localhost ([127.0.0.1]:43054 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9Xf8-0007br-Ho for submit@debbugs.gnu.org; Sat, 13 May 2017 10:04:54 -0400 Received: from sinyavsky.aurox.ch ([37.35.109.145]:46481) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9Xf6-0007ba-1R for 26905@debbugs.gnu.org; Sat, 13 May 2017 10:04:49 -0400 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 7AB6622428 for <26905@debbugs.gnu.org>; Sat, 13 May 2017 14:00:25 +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-transfer-encoding:content-type:content-type:in-reply-to :mime-version:user-agent:date:date:message-id:from:from :references:to:subject:subject; s=dkim; t=1494684021; x= 1495548022; bh=qur9mJ7kz87AFkl4xWHTvrOqPeaR+0+aM/NrA3dphWY=; b=D /OQHw0jnl3oyIFBwKh+11BoRWpkv0J/Ee8vRur5OwPV7IhnVhrpPXdqSxWCRkYPp h2pmuAFblh2JIRokBBos14E+2KiYUwT1QA8Ex5AhqjIuAhk/nrHH0JgAc50BmOfi QEEl3HqC+RryY9UpbfOy5CBvUuLT/Xq6YwRAnAKWLs= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com 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 hmYw01rU-GyU for <26905@debbugs.gnu.org>; Sat, 13 May 2017 14:00:21 +0000 (UTC) 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 B294F22422; Sat, 13 May 2017 14:00:17 +0000 (UTC) Subject: Re: bug#26905: 25.2: MacOS: tooltips show in wrong display To: Eli Zaretskii References: <83o9ux84h4.fsf@gnu.org> From: "Charles A. Roelli" Message-ID: <16a6fc81-06de-8c4a-8159-2f07f50f5585@aurox.ch> Date: Sat, 13 May 2017 16:04:32 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <83o9ux84h4.fsf@gnu.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 26905 Cc: 26905@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) FWIW, I found this change to the Windows port of Emacs (not sure if it was ever committed): https://lists.gnu.org/archive/html/bug-gnu-emacs/2007-07/msg00153.html And a more recent change as a result of #22549: commit c77ffc8019bceb850a794c13f2e3ad991cc7e412, with changes to xfns.c. c77ffc8..: Oscar Fuentes 2016-02-06 Use monitor's resolution for positioning tooltips commit c77ffc8019bceb850a794c13f2e3ad991cc7e412 Author: Oscar Fuentes Date: Sat Feb 6 22:12:53 2016 +0100 Use monitor's resolution for positioning tooltips * src/xfns.c (compute_tip_xy): Use the resolution of the monitor where the mouse pointer is to avoid placing the tooltip over the border of the monitor on multi-head displays. Fixes bug#22549. Seems like the Windows and X versions nowadays have a check that looks like this: else if (*root_x + XINT (dx) <= min_x) *root_x = 0; /* Can happen for negative dx */ i.e. compare *root_x + XINT (dx) against the variable "min_x", rather than comparing against zero, as is done in the NS port. Since frames can be in the negative coordinate space, it makes sense to allow a tooltip to have a x-coordinate less than 0 -- so the NS port's code should probably be changed. I'm also not sure why, in the above code from the Windows and X versions, *root_x is constrained to zero if *root_x + dx goes below min_x. Wouldn't it make more sense to constrain to min_x, which could be negative? On 13/05/2017 11:56, Eli Zaretskii wrote: >> From: "Charles A. Roelli" >> Date: Sat, 13 May 2017 11:02:04 +0200 >> >> If I remove the marked lines in compute_tip_xy: >> >> if (INTEGERP (left) || INTEGERP (right)) >> *root_x = pt.x; >> => else if (pt.x + XINT (dx) <= 0) >> => *root_x = 0; /* Can happen for negative dx */ >> else if (pt.x + XINT (dx) + width >> <= x_display_pixel_width (FRAME_DISPLAY_INFO (f))) >> /* It fits to the right of the pointer. */ >> *root_x = pt.x + XINT (dx); >> else if (width + XINT (dx) <= pt.x) >> /* It fits to the left of the pointer. */ >> *root_x = pt.x - width - XINT (dx); >> else >> /* Put it left justified on the screen -- it ought to fit that way. */ >> *root_x = 0; >> >> Then the problem is gone. > Those lines were added to fix some problems (whose particulars I > cannot find at the moment), so we shouldn't remove them without > understanding what is going on. From debbugs-submit-bounces@debbugs.gnu.org Sat May 13 11:28:32 2017 Received: (at 26905) by debbugs.gnu.org; 13 May 2017 15:28:32 +0000 Received: from localhost ([127.0.0.1]:43106 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9Yy7-000160-Qi for submit@debbugs.gnu.org; Sat, 13 May 2017 11:28:31 -0400 Received: from mail-wm0-f53.google.com ([74.125.82.53]:36800) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9Yy6-00015m-JM for 26905@debbugs.gnu.org; Sat, 13 May 2017 11:28:31 -0400 Received: by mail-wm0-f53.google.com with SMTP id u65so43197242wmu.1 for <26905@debbugs.gnu.org>; Sat, 13 May 2017 08:28:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=VVFKBoN/LJKCrWxDBgdF6V98NHMdfhA1y8tKAusOGFo=; b=AZKXslPOr+49bRm9pfzLIGEIk1SJeD6mChGpupvs8SSKZ7TTyUOWREIk6lwLCaDxwc ztjnxixxRxRShq9VmbMqGBJuIVr9EOuEVVihzYLmh2DbaQYrZX3MiQuf7F7F6hP8ANzd 2p1R2ZNaVGHkm9hDyVIvEFFLGWQa4p4I9GHoIllgkpu/4fND6/cbnKvth23sDRpT7ze+ ERRdLhfQcKbp6XqGtNrfr1+jufNgmdHgfnpzoKsO8Q6etef4D69x4ICPnsezkiRL+OC1 fRbHjjAMVQCUT/65pBksdX+nSA1QZ6bvwiQ/ialWi8nQ6ZxvFKbdPEkTX0XxvP/mnTWb gIkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=VVFKBoN/LJKCrWxDBgdF6V98NHMdfhA1y8tKAusOGFo=; b=HFf6ZieD7V+WVPX48ql6cmmN0TG/lFkT42m41xSpyoZrZxmxsY0/FcVASOkPxUM9In Vcx2gWETF42w0Y76V67idmySwBKoalkTf8JUwqFGDDJ6GVCzo+/5t0Q4apsk1nSkn0VQ 9eEgucdLqcPx3stHzD18nid1ZvZ2CmZp3JHCyJWNzqxiCC/rfqIneKXwO9Bn0K8XdQAE C12mF6y3q3d9CtQc9gM0mKmo768lG7G20awklTdkddwhyBsk4QSI4PDI5J0ITh/killB mH5oSkPDj2znxmU52txm23/ZgL9DyufJrSN3L1ir18NM/uyUf3kB3dkiQ/TGCZ945jKL FKHQ== X-Gm-Message-State: AODbwcCoWDeHGBxObSMMWjAHEh/rxeJPE1S6OGY/hMXSWhGVqxVqhQA2 K8JpcpmdLFfINm9wXss= X-Received: by 10.28.203.131 with SMTP id b125mr1299492wmg.135.1494689304559; Sat, 13 May 2017 08:28:24 -0700 (PDT) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-e9b1-3358-0f3c-df92.holly.idiocy.org. [2001:8b0:3f8:8129:e9b1:3358:f3c:df92]) by smtp.gmail.com with ESMTPSA id q16sm8503432wmg.2.2017.05.13.08.28.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 May 2017 08:28:23 -0700 (PDT) Date: Sat, 13 May 2017 16:28:21 +0100 From: Alan Third To: "Charles A. Roelli" Subject: Re: bug#26905: 25.2: MacOS: tooltips show in wrong display Message-ID: <20170513152821.GA13308@breton.holly.idiocy.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 26905 Cc: 26905@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) On Sat, May 13, 2017 at 11:02:04AM +0200, Charles A. Roelli wrote: > I notice now, though, that the tooltip can end up partially offscreen, both > with and without the above change (e.g. when you create a tooltip with the > mouse pointer at the right edge of the primary monitor). IIRC on GNU/Linux > the tooltip is adjusted to fit on screen. Maybe this adjustment works on > newer versions of OS X? I was thinking about this earlier and I suspect that if we want to avoid tooltips crossing monitors we’ll have to step through each screen in [NSScreen screens], check if `pt` is within it’s bounds, and when we find the right screen, use it’s origin and frame to calculate the min/max x/y. constrain_frame_rect in nsterm.m does something similar already. There’s a method in CGRect called CGRectContainsPoint, which should help us here, as NSRect is really just a CGRect. Unfortunately it doesn’t appear to be available in GNUstep, so it may be necessary to implement the check ourselves. If we don’t care about spanning monitors, I think we still need to step through each screen and calculate the overall min/max values. What do you think? -- Alan Third From debbugs-submit-bounces@debbugs.gnu.org Tue May 16 17:56:39 2017 Received: (at 26905) by debbugs.gnu.org; 16 May 2017 21:56:39 +0000 Received: from localhost ([127.0.0.1]:49256 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dAkSN-0003V0-B9 for submit@debbugs.gnu.org; Tue, 16 May 2017 17:56:39 -0400 Received: from mail-wr0-f169.google.com ([209.85.128.169]:36379) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dAkSL-0003Uo-Sa for 26905@debbugs.gnu.org; Tue, 16 May 2017 17:56:38 -0400 Received: by mail-wr0-f169.google.com with SMTP id l50so84115228wrc.3 for <26905@debbugs.gnu.org>; Tue, 16 May 2017 14:56:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=lbeSFHp+QRREAetup7HIvhiwMHeC3gfGnd+I6m8HPAU=; b=c/7RqROlzxHDxHaphW8Q4jFLRHT+DzEMCICPH/FKRlInLSI0jnxkczOvaT2xqwa8v1 9+jxR+iNuJY3BHMTMKO/BNlEByizWRfdK4Lvxu0fTFALTwYlNAANmhGOfTUj7oygelqu rVvYnqAT9YiL5+ZjnZ3QJhniEeDMIZ+HaJEfODZ91AoCTJRXrjPvgNl6D6rwEQkrjCLC Hpqfq2AozcDjnbKo8FzAmh0gCgkPjgxFGT3j2MToeIwEEryYAEHVtn/7EbBZlNcCf3aW zQxIxVNVaFJP1UkbgAIuK1iJk0l4UNbucQLq+1t++YH5S/j2pYqfbaiBcv8aoBTJfF3H 3zJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=lbeSFHp+QRREAetup7HIvhiwMHeC3gfGnd+I6m8HPAU=; b=CWarjaMT8cJ1gmRA657ZJWk14V/ErO/X55+u+aawpXPsZAjUJOOa0SJFEWTshe68qj 8JGbxvCSS/QUjkGtHMkFRXDGNRO/YsNxouOEdE/hC29NVeVsk8on8x+qxPTCoXAm2dQm pnZ/TMyU8iTyNbuGZhcDAXpwD6sROHoTkqniEc8p+U5aOrJqtGk9OdvNu9d7FD3XFilr 3AsVYIxCFWNBKuA1TQKUUhBr4WizlANxFSsaeY03s9AbqO9sidrYLGyL1Ge81U1ZCaQw wd+QlnGqt8+Cf+qxe0ZJzwfCT75nPDJUepMQzby9LCXMvy00dx3otMI25xcUwKwaupEf 2Amw== X-Gm-Message-State: AODbwcCCUQtXynDek1ZKnyM6Mm5SFLsrcPsAtmwAs6EDfu2iwljfCjoP 5dbkK594TmWKe5xf61s= X-Received: by 10.223.139.146 with SMTP id o18mr64127wra.146.1494971791984; Tue, 16 May 2017 14:56:31 -0700 (PDT) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-e9b1-3358-0f3c-df92.holly.idiocy.org. [2001:8b0:3f8:8129:e9b1:3358:f3c:df92]) by smtp.gmail.com with ESMTPSA id p5sm11374689wma.17.2017.05.16.14.56.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 May 2017 14:56:31 -0700 (PDT) Date: Tue, 16 May 2017 22:56:28 +0100 From: Alan Third To: "Charles A. Roelli" Subject: [PATCH] Show tooltip on correct screen (bug#26905) Message-ID: <20170516215628.GA49365@breton.holly.idiocy.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 26905 Cc: 26905@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) * src/nsfns.m (compute_tip_xy): Find the correct screen for the tooltip and constrain it to that screen. --- src/nsfns.m | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/nsfns.m b/src/nsfns.m index cbe0ffb858..04565a99bb 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -2760,6 +2760,7 @@ and GNUstep implementations ("distributor-specific release EmacsView *view = FRAME_NS_VIEW (f); struct ns_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); NSPoint pt; + NSScreen *screen; /* Start with user-specified or mouse position. */ left = Fcdr (Fassq (Qleft, parms)); @@ -2794,13 +2795,25 @@ and GNUstep implementations ("distributor-specific release - height); } + /* Find the screen that pt is on. */ + for (screen in [NSScreen screens]) +#ifdef NS_IMPL_COCOA + if (CGRectContainsPoint ([screen frame], pt)) +#else + if (pt.x >= screen.frame.origin.x + && pt.x < screen.frame.origin.x + screen.frame.size.width + && pt.y >= screen.frame.origin.y + && pt.y < screen.frame.origin.y + screen.frame.size.height) +#endif + break; + /* Ensure in bounds. (Note, screen origin = lower left.) */ if (INTEGERP (left) || INTEGERP (right)) *root_x = pt.x; - else if (pt.x + XINT (dx) <= 0) - *root_x = 0; /* Can happen for negative dx */ + else if (pt.x + XINT (dx) <= screen.frame.origin.x) + *root_x = screen.frame.origin.x; /* Can happen for negative dx */ else if (pt.x + XINT (dx) + width - <= x_display_pixel_width (FRAME_DISPLAY_INFO (f))) + <= screen.frame.origin.x + screen.frame.size.width) /* It fits to the right of the pointer. */ *root_x = pt.x + XINT (dx); else if (width + XINT (dx) <= pt.x) @@ -2808,20 +2821,20 @@ and GNUstep implementations ("distributor-specific release *root_x = pt.x - width - XINT (dx); else /* Put it left justified on the screen -- it ought to fit that way. */ - *root_x = 0; + *root_x = screen.frame.origin.x; if (INTEGERP (top) || INTEGERP (bottom)) *root_y = pt.y; - else if (pt.y - XINT (dy) - height >= 0) + else if (pt.y - XINT (dy) - height >= screen.frame.origin.y) /* It fits below the pointer. */ *root_y = pt.y - height - XINT (dy); else if (pt.y + XINT (dy) + height - <= x_display_pixel_height (FRAME_DISPLAY_INFO (f))) + <= screen.frame.origin.y + screen.frame.size.height) /* It fits above the pointer */ *root_y = pt.y + XINT (dy); else /* Put it on the top. */ - *root_y = x_display_pixel_height (FRAME_DISPLAY_INFO (f)) - height; + *root_y = screen.frame.origin.y + screen.frame.size.height - height; } -- Here’s my go at this. It seems to work OK on single and multi‐monitor setups in macOS, and in GNUstep in single monitor (I can’t test it multi‐monitor). -- Alan Third From debbugs-submit-bounces@debbugs.gnu.org Fri May 19 12:30:45 2017 Received: (at 26905) by debbugs.gnu.org; 19 May 2017 16:30:45 +0000 Received: from localhost ([127.0.0.1]:55561 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dBknc-0007xM-OD for submit@debbugs.gnu.org; Fri, 19 May 2017 12:30:44 -0400 Received: from sinyavsky.aurox.ch ([37.35.109.145]:50874) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dBkna-0007x9-Ht for 26905@debbugs.gnu.org; Fri, 19 May 2017 12:30:43 -0400 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 966BD22437 for <26905@debbugs.gnu.org>; Fri, 19 May 2017 16:26:11 +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=to :references:message-id:content-transfer-encoding:date:date :in-reply-to:x-mailer:from:from:subject:subject:mime-version :content-type:content-type; s=dkim; t=1495211169; x=1496075170; bh=G89We6Ite5/6iCtAedbM2RQsmVZSRrCg+rKjbFAglUI=; b=E5l44coq931r Iv/fsZSf0lebVkrNSqoo9w/gHY0LFpRPQnbmHjjhRYi05C2JC0AJ1tiXXWGwZ4bQ qmkYOlV2Le6KC8bd6Z/3d1YstSKaFSThrJXusseEm1dUWbnpOnTr0uYvv9Z9t/Lp D6OhJT2JluZNvt7iWlwW8nC7v9J1hQI= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com 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 OEnSBVOs3j-G for <26905@debbugs.gnu.org>; Fri, 19 May 2017 16:26:09 +0000 (UTC) Received: from [192.168.1.110] (179.133.105.92.dynamic.wline.res.cust.swisscom.ch [92.105.133.179]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id 9032322427; Fri, 19 May 2017 16:26:09 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] Show tooltip on correct screen (bug#26905) From: "Charles A. Roelli" X-Mailer: iPhone Mail (14E304) In-Reply-To: <20170516215628.GA49365@breton.holly.idiocy.org> Date: Fri, 19 May 2017 18:30:30 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <03F7D972-4113-4CEE-94EB-410A5AD25CE1@aurox.ch> References: <20170516215628.GA49365@breton.holly.idiocy.org> To: Alan Third X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 26905 Cc: 26905@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Works fine for me too! Thanks for coming up with this fix. > On 16 May 2017, at 23:56, Alan Third wrote: >=20 > * src/nsfns.m (compute_tip_xy): Find the correct screen for the > tooltip and constrain it to that screen. > --- > src/nsfns.m | 27 ++++++++++++++++++++------- > 1 file changed, 20 insertions(+), 7 deletions(-) >=20 > diff --git a/src/nsfns.m b/src/nsfns.m > index cbe0ffb858..04565a99bb 100644 > --- a/src/nsfns.m > +++ b/src/nsfns.m > @@ -2760,6 +2760,7 @@ and GNUstep implementations ("distributor-specific r= elease > EmacsView *view =3D FRAME_NS_VIEW (f); > struct ns_display_info *dpyinfo =3D FRAME_DISPLAY_INFO (f); > NSPoint pt; > + NSScreen *screen; >=20 > /* Start with user-specified or mouse position. */ > left =3D Fcdr (Fassq (Qleft, parms)); > @@ -2794,13 +2795,25 @@ and GNUstep implementations ("distributor-specific= release > - height); > } >=20 > + /* Find the screen that pt is on. */ > + for (screen in [NSScreen screens]) > +#ifdef NS_IMPL_COCOA > + if (CGRectContainsPoint ([screen frame], pt)) > +#else > + if (pt.x >=3D screen.frame.origin.x > + && pt.x < screen.frame.origin.x + screen.frame.size.width > + && pt.y >=3D screen.frame.origin.y > + && pt.y < screen.frame.origin.y + screen.frame.size.height) > +#endif > + break; > + > /* Ensure in bounds. (Note, screen origin =3D lower left.) */ > if (INTEGERP (left) || INTEGERP (right)) > *root_x =3D pt.x; > - else if (pt.x + XINT (dx) <=3D 0) > - *root_x =3D 0; /* Can happen for negative dx */ > + else if (pt.x + XINT (dx) <=3D screen.frame.origin.x) > + *root_x =3D screen.frame.origin.x; /* Can happen for negative dx */ > else if (pt.x + XINT (dx) + width > - <=3D x_display_pixel_width (FRAME_DISPLAY_INFO (f))) > + <=3D screen.frame.origin.x + screen.frame.size.width) > /* It fits to the right of the pointer. */ > *root_x =3D pt.x + XINT (dx); > else if (width + XINT (dx) <=3D pt.x) > @@ -2808,20 +2821,20 @@ and GNUstep implementations ("distributor-specific= release > *root_x =3D pt.x - width - XINT (dx); > else > /* Put it left justified on the screen -- it ought to fit that way. *= / > - *root_x =3D 0; > + *root_x =3D screen.frame.origin.x; >=20 > if (INTEGERP (top) || INTEGERP (bottom)) > *root_y =3D pt.y; > - else if (pt.y - XINT (dy) - height >=3D 0) > + else if (pt.y - XINT (dy) - height >=3D screen.frame.origin.y) > /* It fits below the pointer. */ > *root_y =3D pt.y - height - XINT (dy); > else if (pt.y + XINT (dy) + height > - <=3D x_display_pixel_height (FRAME_DISPLAY_INFO (f))) > + <=3D screen.frame.origin.y + screen.frame.size.height) > /* It fits above the pointer */ > *root_y =3D pt.y + XINT (dy); > else > /* Put it on the top. */ > - *root_y =3D x_display_pixel_height (FRAME_DISPLAY_INFO (f)) - height;= > + *root_y =3D screen.frame.origin.y + screen.frame.size.height - height= ; > } >=20 >=20 > --=20 >=20 > Here=E2=80=99s my go at this. It seems to work OK on single and multi=E2=80= =90monitor > setups in macOS, and in GNUstep in single monitor (I can=E2=80=99t test it= > multi=E2=80=90monitor). >=20 > --=20 > Alan Third From debbugs-submit-bounces@debbugs.gnu.org Sat May 20 19:16:09 2017 Received: (at 26905-done) by debbugs.gnu.org; 20 May 2017 23:16:09 +0000 Received: from localhost ([127.0.0.1]:57483 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCDbV-00066K-Ez for submit@debbugs.gnu.org; Sat, 20 May 2017 19:16:09 -0400 Received: from mail-wr0-f178.google.com ([209.85.128.178]:33409) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCDbT-00065Q-6t for 26905-done@debbugs.gnu.org; Sat, 20 May 2017 19:16:07 -0400 Received: by mail-wr0-f178.google.com with SMTP id w50so32842456wrc.0 for <26905-done@debbugs.gnu.org>; Sat, 20 May 2017 16:16:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=IeNjEO592SLcBq9Hk9jrMpGSyNQxztT3b6H83JtZUeI=; b=ggtRhvs1BaIXsM0bdmNgDKK4RhrygnIGuOmaIrY/vLurf5ECqgiV+wFBxld/fMwba/ 0dsP9GJL+anV/FoUKrPz/lOQ9wUVk/x84u3z4ucLj8UEP9yAYy2YxDIAq7CNNvLllDas bgHwKAsWD+1daEIvoQfCVM8VRKdkCOljevKBHb+ARs9yHQKKvrwzuB/DIUbQRMov7CxD KcUeqV7Tl4uv8hS4BKNNxk8/TscsyJ1774BPsMvjNQcLF1ot2is9j0hGmZP9ZEWhC6gA ozfaV4JtXZ+B/YWkpT5TursM6dRmKbcPzKQGpch2UgMcc0g6U9o/KdMRz09RICQOLP36 3qSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version :content-transfer-encoding; bh=IeNjEO592SLcBq9Hk9jrMpGSyNQxztT3b6H83JtZUeI=; b=s319Pwaw31IuxGnuPXpZyAnzAP9u1t9Qb1uaGtJU7TS6bSxJ80NP4twSdpWnwhZQfX fMYl6TybL+Aok2YkSdXptawhd2bccdVgFFglkDS2Q33C1c6j03r+w2A4vqiKiuwgQqI7 usorxfES9PkfAc2cftI3dOQdPEoxV3vZaBE03Hu3Q5QMBuiddzrCr7FF89T8pOdGKRjz rK7xvLx6RL+dGHUrqrChz3+fmL5+8+DwNCb6eSQa/qdUA2dXx2q3HiA5xY1XhLbZeqjS 2u+f55g7yDlp17Cf24hqvQ4IYh6bJGPTUdxObNyXA29s+a4crVjpLjkIKuix2Z92kV1d DmWQ== X-Gm-Message-State: AODbwcDrmtxeEwS2CRol1jp/w+oOS5THEQ0q4MbO1txcWHiZzQbfu6yh 6TadFjBhX6I+cNX9cgk= X-Received: by 10.223.161.144 with SMTP id u16mr6651963wru.145.1495322161218; Sat, 20 May 2017 16:16:01 -0700 (PDT) Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-1c23-04ca-53b1-12e4.holly.idiocy.org. [2001:8b0:3f8:8129:1c23:4ca:53b1:12e4]) by smtp.gmail.com with ESMTPSA id e83sm30722497wmc.28.2017.05.20.16.16.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 20 May 2017 16:16:00 -0700 (PDT) From: Alan Third To: "Charles A. Roelli" Subject: Re: bug#26905: [PATCH] Show tooltip on correct screen (bug#26905) References: <20170516215628.GA49365@breton.holly.idiocy.org> <03F7D972-4113-4CEE-94EB-410A5AD25CE1@aurox.ch> Date: Sun, 21 May 2017 00:15:59 +0100 In-Reply-To: <03F7D972-4113-4CEE-94EB-410A5AD25CE1@aurox.ch> (Charles A. Roelli's message of "Fri, 19 May 2017 18:30:30 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (darwin) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 26905-done Cc: 26905-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) "Charles A. Roelli" writes: > Works fine for me too! Thanks for coming up with this fix. >>=20 >> Here=E2=80=99s my go at this. It seems to work OK on single and multi=E2= =80=90monitor >> setups in macOS, and in GNUstep in single monitor (I can=E2=80=99t test = it >> multi=E2=80=90monitor). Pushed to master. --=20 Alan Third From unknown Thu Jun 19 16:24:16 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 18 Jun 2017 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator