From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Third Newsgroups: gmane.emacs.devel Subject: Re: select-frame-set-input-focus fails to raise the frame Date: Wed, 13 Dec 2017 22:26:34 +0000 Message-ID: <20171213222634.GA2144@breton.holly.idiocy.org> References: <20171213204737.GA1621@breton.holly.idiocy.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 1513204003 16169 195.159.176.226 (13 Dec 2017 22:26:43 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 13 Dec 2017 22:26:43 +0000 (UTC) User-Agent: Mutt/1.9.1 (2017-09-22) Cc: emacs-devel To: rswgnu@gmail.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Dec 13 23:26:39 2017 Return-path: Envelope-to: ged-emacs-devel@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 1ePFU6-0003va-O1 for ged-emacs-devel@m.gmane.org; Wed, 13 Dec 2017 23:26:38 +0100 Original-Received: from localhost ([::1]:38045 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePFUD-0001C2-Mz for ged-emacs-devel@m.gmane.org; Wed, 13 Dec 2017 17:26:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37360) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ePFU7-0001Bt-6Q for emacs-devel@gnu.org; Wed, 13 Dec 2017 17:26:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ePFU6-0003AL-CA for emacs-devel@gnu.org; Wed, 13 Dec 2017 17:26:39 -0500 Original-Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]:46576) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ePFU6-00039y-41 for emacs-devel@gnu.org; Wed, 13 Dec 2017 17:26:38 -0500 Original-Received: by mail-wm0-x22e.google.com with SMTP id r78so7904354wme.5 for ; Wed, 13 Dec 2017 14:26:38 -0800 (PST) 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=XhpX0sILMSOz1RUC1l5mZxtUtCmZAWUw6BLuGk7xss0=; b=Z28zOdhsjnTGA/8xa5ku61NySzL56Wk1JFLu1jE436pD56gU1o1zeUadBHfeMYMuTU EgKp6Hkd2ULHDMnQbaSjXQoT9YOd/8Kxk/2oI+EAnEj1YM6KINg4bm4hd8HzOyR+1efx 4zqzSlWP41THljDnVouvUR0lTVCc8otqS7r+GeYslvQ6806NSJJMseVRPmLRQGaAzXbW kbUMRvoPi9Sn01hnKzNlTwgV/2Q6Ne/WEJ/8p1DPIknd/2v2/3H8NhIxgQ8nKv4NbXyT Nkf/r8xt0Lb6BUaAHvvSXRqS58jPNHLH5byOLaEXsrYA5vbzsI0Y4c62oR5CKRollDbY AyIA== 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=XhpX0sILMSOz1RUC1l5mZxtUtCmZAWUw6BLuGk7xss0=; b=mx7KXkK89YsvslEMv/UNtK8bVivTyTsN0tiQdJ1j8VZtdYjIZ0gOi/HeKeFDfGUlxD seYx8Kv5bfjrOm59sSKN4p+RkCG+E8PaMh4L9/3sqOxj58ylR0nvBfv4EOLLHoWw+XSw 4Bj3o6ZTzF9R7Y/pWH0xvwFWA9OHyeUgRxL4F37ZXsZD5Cm/nyvTTF7K1SL4P0XAR0h9 OpAr3q25h8HlihnutG0Ydit9ASoQf1wRiXgSuONWK/Hdhomrove8ArLNEnvjOV+AOrNj LgOa05M5j16qeycEZMbfOwZKWPPaTAXCK7CZnrCNOVHAG/Kfsx851Y1Gn3m7s4LZoGwA ZewA== X-Gm-Message-State: AKGB3mKhJ1Q7YOEYrQa3/bpUpPUnXJ2vE2n8H93l6k0ZAzsgorJ4PfeO funV/Fk2TynVPB7p42yAg0SlBVhCSc8= X-Google-Smtp-Source: ACJfBouzI2VI6kg4454Uvi8X7Evl6qsRViSju0cMZfHhmOY7MEGwNkJvZQyLfBS7VR/z7qso4GOk6w== X-Received: by 10.28.231.25 with SMTP id e25mr412530wmh.139.1513203996994; Wed, 13 Dec 2017 14:26:36 -0800 (PST) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-f9b9-51e6-17ae-73d0.holly.idiocy.org. [2001:8b0:3f8:8129:f9b9:51e6:17ae:73d0]) by smtp.gmail.com with ESMTPSA id l142sm3656362wmb.43.2017.12.13.14.26.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Dec 2017 14:26:36 -0800 (PST) Content-Disposition: inline In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::22e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:221029 Archived-At: On Wed, Dec 13, 2017 at 05:00:18PM -0500, Robert Weiner wrote: > On Wed, Dec 13, 2017 at 3:47 PM, Alan Third wrote: > > > On Tue, Dec 12, 2017 at 06:26:50PM -0500, Robert Weiner wrote: > > > Here is a seemingly related problem with raise and lower frame. > > > > > > ;; This whole sexp works > > > (let ((f (selected-frame))) > > > (lower-frame f) > > > (sit-for 1) > > > (raise-frame f)) > > > > > > ;; Only the first raise-frame call works > > > (let ((f (next-frame))) > > > ;; f is raised > > > (raise-frame f) > > > (sit-for 1) > > > ;; f is NEVER LOWERED > > > (lower-frame f)) > > > > I can’t reproduce this, these both work as expected for me here on > > macOS using the master branch and the -Q flag. > > > ​​ > ​You are correct. This works fine today; strange it did not yesterday. > The example I gave with the function named 'test' still fails as before. I tried it again and it didn’t work! Changing the sit-for to sleep-for fixed it. I know that sometimes sit-for doesn’t actually wait for the given time, and I think that’s what’s happening here as I’m seeing the frame being lowered, but not raised. Presumably there’s some sort of timing thing where raise-frame then lower-frame in rapid succession fails randomly. FWIW, changing sit-for to sleep-for in ‘test’ results in 4 seconds of a blank frame, but otherwise behaves as expected. This seems to work, though: (defun test () (let ((depress-frame (selected-frame)) (release-frame (make-frame))) (select-frame-set-input-focus depress-frame) (sit-for 0) (sit-for 4) (select-frame-set-input-focus release-frame))) (test) Presumably the first sit-for clears any pending input which then means the second sit-for can actually do its thing. (I think this is a side‐effect of the way input works on the NS port where various things that you might not think of as ‘input’ are essentially indistinguishable from keyboard input.) -- Alan Third