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#31546: 27.0.50; macOS child frames with no mode-line mouse click problem Date: Sun, 27 May 2018 22:24:29 +0100 Message-ID: <20180527212429.GA19272@breton.holly.idiocy.org> References: <20180526163844.GA16324@breton.holly.idiocy.org> <20180526182215.GA18042@breton.holly.idiocy.org> <5B0A4EC3.6080403@gmx.at> <83h8mt851r.fsf@gnu.org> <8336yd80cy.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1527456193 714 195.159.176.226 (27 May 2018 21:23:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 27 May 2018 21:23:13 +0000 (UTC) User-Agent: Mutt/1.9.3 (2018-01-21) Cc: 31546@debbugs.gnu.org To: Aaron Jensen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun May 27 23:23:09 2018 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 1fN388-0008VZ-HH for geb-bug-gnu-emacs@m.gmane.org; Sun, 27 May 2018 23:23:08 +0200 Original-Received: from localhost ([::1]:53317 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fN3AF-00071N-IN for geb-bug-gnu-emacs@m.gmane.org; Sun, 27 May 2018 17:25:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fN3A1-000702-Ng for bug-gnu-emacs@gnu.org; Sun, 27 May 2018 17:25:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fN39y-0007Hj-Jr for bug-gnu-emacs@gnu.org; Sun, 27 May 2018 17:25:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:43404) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fN39y-0007HT-EJ for bug-gnu-emacs@gnu.org; Sun, 27 May 2018 17:25:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fN39y-000618-4W for bug-gnu-emacs@gnu.org; Sun, 27 May 2018 17:25: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: Sun, 27 May 2018 21:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31546 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31546-submit@debbugs.gnu.org id=B31546.152745628323104 (code B ref 31546); Sun, 27 May 2018 21:25:02 +0000 Original-Received: (at 31546) by debbugs.gnu.org; 27 May 2018 21:24:43 +0000 Original-Received: from localhost ([127.0.0.1]:51301 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fN39f-00060a-89 for submit@debbugs.gnu.org; Sun, 27 May 2018 17:24:43 -0400 Original-Received: from mail-wm0-f52.google.com ([74.125.82.52]:55813) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fN39b-00060L-5N for 31546@debbugs.gnu.org; Sun, 27 May 2018 17:24:41 -0400 Original-Received: by mail-wm0-f52.google.com with SMTP id a8-v6so27126532wmg.5 for <31546@debbugs.gnu.org>; Sun, 27 May 2018 14:24:39 -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=we3z8H0rWop40Uacet5mHkey91tnVhkv2EHVoC/f+sM=; b=mHjzb87P44dYhiErK7N/eaPy1VpLPtXHnkYw+NlX5+Y7DJgfbkfa+ipl0hrvqykPyz YQp4gU9PrFWmRyLsOhwkzR9UU4FwW9qY6sbazWN0bB0vtOeotvIn+eM7EP9QGxoDlqb9 vdonTLBP9eHjR004a5mmkdEWUrGwkO5VKdbj/eCzq1L5cveeqUtvuNBxVeO5UF9VMU3y ASPih35t9DEcILF9QEfyKZjptmMhSPVeBA+smCsRAnX6XqVxwRzkhSQoL94fR12nnN/0 wfDWbCV87X/1aceNCYnyuw5OgYlwNVrb2IIt+NGNQJhFfmpQJ/LWv9FjTkvMi5YUPgL+ kxRw== 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=we3z8H0rWop40Uacet5mHkey91tnVhkv2EHVoC/f+sM=; b=GKfvmHWV/1Dcqb+4S0ALYRhhWlcPCAW1fG5fH2/DmqWEEukKEglKq2lC+V8NxSvPTT OtuQ2iWzaxgN/drxHI749V2ZhBwPMadQRjZEJeDsAyZRNE18AyTKSpcggU9Ejyvdcgbp PxzPRMfGdn6YWfD2HFawWkMBnY1gFstZ+WDfXjAyBXIL+c+0xRapNXj4mZQ80pCRG/4N f9U1fcX0D7G/MP8556Z1N5+S5EMS7JXC2l1RR/c2j6zCLPnbQ0REY/ZqdA+h74fvy8J8 O66a2ak0AOl3zN8aKDj+XlT1X98DYlVqqysAFrTg163Tqt+iewKaC/V0DzCFyZV4uiqp s8qw== X-Gm-Message-State: ALKqPwe+sHqiwQmCfuESMQsblFUxd9vfOScMFhhfUjLVNIjmkgVxbgY0 ks93CZA8uSFFAGydQn5KWO0= X-Google-Smtp-Source: ADUXVKL8lQ2i18pV59KcITTTy4TTJZYCubHvt+BniWbsoSlSIO/D8ciq2hIugk3Fdd9/ay6LcXfpEg== X-Received: by 2002:a1c:cfc2:: with SMTP id f185-v6mr2214279wmg.101.1527456273263; Sun, 27 May 2018 14:24:33 -0700 (PDT) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-acd0-c556-d8b1-5ceb.holly.idiocy.org. [2001:8b0:3f8:8129:acd0:c556:d8b1:5ceb]) by smtp.gmail.com with ESMTPSA id c53-v6sm318731wrg.12.2018.05.27.14.24.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 May 2018 14:24:32 -0700 (PDT) Content-Disposition: inline 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:146614 Archived-At: On Sun, May 27, 2018 at 11:52:36AM -0700, Aaron Jensen wrote: > One more clue: On a frame that doesn't accept focus on a mac, a > single click results in a mouse-movement getting fired immediately > after the down-mouse-1. A single click on a normal frame does not do > this. This is why this issue doesn't repro on a frame that accepts > focus. Something about how the non-focusable frames are causes them > to get mouse moves immediately after a click. This means that the > transient map created in mouse-drag-track immediately gets invoked > with a mouse-movement, which is what triggers the scroll. As > mentioned earlier in the thread, this is only true if the mouse has > moved since the last click. That means if you click twice in row, > only the first click will get a mouse-movement fired after it. If > you then move the mouse and click again, it'll fire the down-mouse-1 > then the mouse-movement again. > > Perhaps someone who understands the way that mouse tracking works on > mac would know why a frame that doesn't accept focus behaves > differently? It's as if the non-focusable window only gets notified > of a mouse's new position whenever a click happens, so every click > is as if the click happened and then the mouse moved to that > position. Hmm, OK. So normally the first click on a non‐selected NSWindow makes that NSWindow key (i.e. it selects the frame without registering an emacs mouse down event), but by enabling no-accept-focus we prevent the NSWindow becoming key, and the click is then actually registered as a mouseDown event (therefore causing an Emacs mouse down event). There’s also a mouseMoved method that says ‘Tell emacs the mouse has moved.’, but I’m unsure how it does that, or if it’s even relevant. I don’t think it sends any events unless you have mouse-autoselect-window set. mouseDragged just calls mouseMoved, so Emacs must be doing its own mouse move/drag detection elsewhere. mouseMoved is called every time the mouse pointer moves on an Emacs frame whether it’s selected or not. Is it possible a move is being registered because the click was in frame X, but frame Y is selected? I noticed while testing this that ns_mouse_position is sometimes (always?) called for multiple frames when one mouse click has been made. And, actually, I’m not sure if it’s a bug, but the X and Y coords returned are for the frame ns-mouse-position is being run from, rather than from the frame it lists in its output... *sigh* try this: modified src/nsterm.m @@ -2547,7 +2547,7 @@ so some key presses (TAB) are swallowed by the system. */ if (f && FRAME_NS_P (f)) { - view = FRAME_NS_VIEW (*fp); + view = FRAME_NS_VIEW (f); position = [[view window] mouseLocationOutsideOfEventStream]; position = [view convertPoint: position fromView: nil]; -- Alan Third