From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#27053: 26.0.50; x-show-tip gets wrong mouse position if frame moves w/o mouse moving on macOS Date: Thu, 25 May 2017 20:23:26 +0100 Message-ID: <20170525192326.GB3197@breton.holly.idiocy.org> References: <5925823B.8020609@gmx.at> <59268137.1050507@gmx.at> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="7iMSBzlTiPOCCT2k" Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1495740254 28465 195.159.176.226 (25 May 2017 19:24:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 25 May 2017 19:24:14 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: 27053@debbugs.gnu.org, Aaron Jensen To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu May 25 21:24:10 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 1dDyMj-0007HI-8T for geb-bug-gnu-emacs@m.gmane.org; Thu, 25 May 2017 21:24:09 +0200 Original-Received: from localhost ([::1]:33377 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDyMo-00043I-LB for geb-bug-gnu-emacs@m.gmane.org; Thu, 25 May 2017 15:24:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dDyMg-00042k-IX for bug-gnu-emacs@gnu.org; Thu, 25 May 2017 15:24:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dDyMc-0005PC-JO for bug-gnu-emacs@gnu.org; Thu, 25 May 2017 15:24:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35438) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dDyMc-0005P3-Dw for bug-gnu-emacs@gnu.org; Thu, 25 May 2017 15:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dDyMc-0001Q9-4N for bug-gnu-emacs@gnu.org; Thu, 25 May 2017 15:24:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 25 May 2017 19:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27053 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27053-submit@debbugs.gnu.org id=B27053.14957402175429 (code B ref 27053); Thu, 25 May 2017 19:24:02 +0000 Original-Received: (at 27053) by debbugs.gnu.org; 25 May 2017 19:23:37 +0000 Original-Received: from localhost ([127.0.0.1]:38115 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDyMD-0001PV-86 for submit@debbugs.gnu.org; Thu, 25 May 2017 15:23:37 -0400 Original-Received: from mail-wm0-f47.google.com ([74.125.82.47]:35059) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dDyMB-0001PG-Id for 27053@debbugs.gnu.org; Thu, 25 May 2017 15:23:36 -0400 Original-Received: by mail-wm0-f47.google.com with SMTP id b84so104460785wmh.0 for <27053@debbugs.gnu.org>; Thu, 25 May 2017 12:23:35 -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=rSbgx6uj5+r4noQwYhJzP4I1URofeGuHbgK3U4BfDHA=; b=RdUnwl7zsene0vDFF3BylQaQ/DDOY+MPa9n9K/DsPdngm/EPOPeqSy3gjwGeWA11f0 WgV6y7F0pHD4o+kW9RxmFqZiq5/rZOHI5eeZTzgL5OM3GtQqiZa4dj0Dn3C1iCX/YFRk Eyvz9i+a3R+k0j55IGUap0ANPq0Ifsmw953FuJBwicoGxA5TfvJsrBv1eCDjBdaeU1b0 O9XPWFJ9BqdEq4jLYuInc4bZoe0BMi4RrnHrgRuoIEWXe3sduu4+xgxDIe09wVLVUcNR SLvFsVVBLvodVx80HYrBesQJw7hPa4MahRHrff8h3DfufKALUXcUI2+6TVg/mVV2TPvZ wiEg== 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=rSbgx6uj5+r4noQwYhJzP4I1URofeGuHbgK3U4BfDHA=; b=qQ2R35yyi/LcqjTlVb+eU/Uap/IzYhY6BIvRlScCqOvFfIMh/gtiYPhy4S+WAY1s7x UQ2LnBExJw50TucsyPIhhBdh6iVNVEQVShV8bQeSaCqsssI7A58BlqJBC+kUQA1Y++Uq 5gdafoYdhoqL9wKFaTlByGK+TVz4if4kDvEyuL41ZYY8wxDcdnl0ccaimk9k+Vusz9lv Rvb5bhxNxXqsgFpLtverceTv1A3e+Ovhecss5Hk68VRXTJsUBqTq0wJVNbvA+BpNfSSd bUN9waBrTo+y6234sYKfLj46PgJIhTHBnBr+LNZRBqLc666z6Xv50howpAE42ZGcMJrv XJOw== X-Gm-Message-State: AODbwcADDMRonToRWCefMZyVTQQ6NiUSXtn988NNSpUfGy4qSZBfB0J2 4DjyreeF5wOrag== X-Received: by 10.28.31.136 with SMTP id f130mr10299480wmf.117.1495740209951; Thu, 25 May 2017 12:23:29 -0700 (PDT) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-757d-ca29-5867-b957.holly.idiocy.org. [2001:8b0:3f8:8129:757d:ca29:5867:b957]) by smtp.gmail.com with ESMTPSA id m191sm10286408wmg.30.2017.05.25.12.23.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 May 2017 12:23:28 -0700 (PDT) Content-Disposition: inline In-Reply-To: <59268137.1050507@gmx.at> 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:132855 Archived-At: --7iMSBzlTiPOCCT2k Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Thu, May 25, 2017 at 09:01:11AM +0200, martin rudalics wrote: > > I do not know what the best solution to this is. They could be stored > > in screen local coordinates and converted to frame local as they're > > needed, or they could be recalculated/asked for whenever the frame is > > moved. > > Both, X and Windows query the absolute mouse position here and the NS > code should do the same (just that I don't have any idea what the direct > NS equivalent for XQueryPointer/GetCursorPos is - it should be somehwere > hidden in ns_mouse_position's > > position = [[view window] mouseLocationOutsideOfEventStream]; > position = [view convertPoint: position fromView: nil]; > > but I'm too lazy to figure that out). last_mouse_motion_x/_y are > conceptually reserved for note_mouse_movement and should not be used for > anything else (IMHO). Looks like the right way to get it in screen‐coords is [NSEvent mouseLocation] which returns an NSPoint. https://developer.apple.com/reference/appkit/nsevent/1533380-mouselocation?language=objc Seems strange to me that it’s in NSEvent, but I guess it makes sense to someone. Patch attached. I’ve just noticed the grocer’s apostrophe in the commit message. *sigh* It seems to me that the NS port seems to like storing values and then reusing them later even though they can be asked for directly in real‐time. I don’t know if that’s a coding style thing or what. -- Alan Third --7iMSBzlTiPOCCT2k Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Fix-NS-tooltip-s-showing-in-the-wrong-place-bug-2705.patch" >From 4edade12422f7dc147e7de540f447e2f779508c3 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Thu, 25 May 2017 20:13:21 +0100 Subject: [PATCH] Fix NS tooltip's showing in the wrong place (bug#27053) * src/nsfns.m (compute_tip_xy): Get current mouse position instead of last recorded position. --- src/nsfns.m | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/nsfns.m b/src/nsfns.m index 3833ee75ac..f2f6a491a9 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -2742,22 +2742,7 @@ and GNUstep implementations ("distributor-specific release if ((!INTEGERP (left) && !INTEGERP (right)) || (!INTEGERP (top) && !INTEGERP (bottom))) - { - pt.x = dpyinfo->last_mouse_motion_x; - pt.y = dpyinfo->last_mouse_motion_y; - /* Convert to screen coordinates */ - pt = [view convertPoint: pt toView: nil]; -#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 - pt = [[view window] convertBaseToScreen: pt]; -#else - { - NSRect r = NSMakeRect (pt.x, pt.y, 0, 0); - r = [[view window] convertRectToScreen: r]; - pt.x = r.origin.x; - pt.y = r.origin.y; - } -#endif - } + pt = [NSEvent mouseLocation]; else { /* Absolute coordinates. */ -- 2.12.0 --7iMSBzlTiPOCCT2k--