From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#57012: Activating versus raising frames Date: Sun, 07 Aug 2022 09:55:24 +0800 Message-ID: <87y1w03jhv.fsf@yahoo.com> References: <18270a59cb0.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org> <878ro25eo7.fsf@yahoo.com> <6c3817726a4fc63e83a3d004dffdf072cae278c5.camel@dancol.org> Reply-To: Po Lu Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20039"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) Cc: 57012@debbugs.gnu.org To: Daniel Colascione Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 07 03:56:11 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oKVWU-0004yh-U8 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Aug 2022 03:56:11 +0200 Original-Received: from localhost ([::1]:53394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKVWT-0006Hg-F7 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Aug 2022 21:56:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33928) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKVWM-0006HJ-Jo for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2022 21:56:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45958) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oKVWM-0006cS-B5 for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2022 21:56:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oKVWM-0006hZ-5J for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2022 21:56:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Aug 2022 01:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57012 X-GNU-PR-Package: emacs Original-Received: via spool by 57012-submit@debbugs.gnu.org id=B57012.165983734725739 (code B ref 57012); Sun, 07 Aug 2022 01:56:02 +0000 Original-Received: (at 57012) by debbugs.gnu.org; 7 Aug 2022 01:55:47 +0000 Original-Received: from localhost ([127.0.0.1]:35707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKVW6-0006h5-NU for submit@debbugs.gnu.org; Sat, 06 Aug 2022 21:55:46 -0400 Original-Received: from sonic305-22.consmr.mail.ne1.yahoo.com ([66.163.185.148]:34453) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKVW2-0006gp-J3 for 57012@debbugs.gnu.org; Sat, 06 Aug 2022 21:55:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1659837334; bh=HgoBXwEoMTvieVRakks7RxUx4lxf68dI91WQDzWTszM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=rZTum5JCyFIOXU6xGqHoweYSjQQ/dAFW2jMC7bWvvauJhQmNOC/i3h7ddbQEuCVmVvhzCSfLUjebiK0DlLl8V3S9Y6v4BawZcv22c9AzbKHlTOZJca0g78urJ4nzCiqJ+r3k2BpZ1qIPoD9kK/7AkG5jM6weeflhXzYz4uAqSFE4rBheNAdkUxgpSUxVG3qpgVmy7Ec2sGHphCMpcBcpg+xKWe1c6nyNPnG2D4w7lG7r1Z6MYsJRAciF7VsDqXLqjKY5/LTnY6s1bHTZV/rV2Ma9Yaxc3A9CSPWRBAaJGzmqdHbJLwoD//50crVJCIDYlSPvDp3J4p3npDxWsw5mJQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1659837334; bh=O0PIdjsjB3KPs1FQnOQWwSbXXxcPpozui5BuKkNC1xf=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=HuZax/a4eQdnXmpPyui0EvftVgi4CGO+ukG/id25d6W5rYyFQvB95H7oLd4FWJh5/cgn4BMsM0S60637zA4OaEQo61bDMCrSwvQCuTDqktftbnpu66nTnhJLiXYC2DBuiifxzsOevu2VyNHIlk5oqVS2Uh/273qDUx+L9RgbUoSYqX4Ev50+1/A56Ahw6jPN7lfnRa5apdkoKXJxlVlGre4Qzr6cJAea+eHGhhYVDaDawLLgP31DZvwIDbNMr470VCZop6UNR9KMg/3BqprjveWGRrKsFO586bpjDwIkSi1Jx7dEUixumarwn7qh8ck7n1G0D8zP+GD4+cjfZS+Bzw== X-YMail-OSG: zkiIYvsVM1lb2.9foZ6jpXeKJPL5rrRhitxeHDuk5pyvH.lL7oKOcQqE589NNE6 82uQZRvm.RE3decV1Gn37E65hPnl2IxBJTZxVX5hvf8S61CLyaAtPhjh80cYzBZLOKhprwfjtUED I0WO33SU6D3ooLMkM40fk9S0aZkIKz1F8CKeh2FH5zmI0ru_VIjs4hNB5aIkuOTZO_GcQp3jllI7 ZPYc5aoDG6yeX_cAY7R6J0oe.u7dMBskVt2dYm1hOMeB126TyHSg092x3AFnEs2hOI14Ch0aeYhx kbngf.sFZlTWMRZY6qnL0dl1BBi0Vj04P5gBkBML9KGgeTFRncLc4Lwg6WmMh2c9Lt9cJZ2Pid4s lM5dfEBptRCLJFuPp1h.44_ROdaCpJ_wjQXiyTvN.UOMG61hWJo4U93vIPusUq88eIgRDBQ1kONI QBmJsJsrkMi0DwnUK4NZi3x0d5Ywz2IN86Sojm4of9LDrQikfy0hEHFq.polkyu6bhXMsoNwCQwi iMBIFNDlfYPLGbJFS.DvKZVA9t1R_bClpusMd3rWWZh930XBlNrr02bfuNqsJ_LSKmyUEAjFqeGL y8EtngYHm0hBi7WOlr_6z275QB2tzdkXKduSN2dml1oeZEI4leE.McEUlo_wnub3hE7BAn0UOwB4 _HTeu1EuDh78_dziOgCjT.Vi.kk..bX8lRcfRUinjpUQX_HI9sxhIo__HtqY7eLad__Z5ytZ6aGi rsuws9LlCYHGZKfH5njVmyYiHFg6IBBFcGkVrkj8EAgxR3Tj44mTHJJDx6MXMSPEQQzGRl4a3VO6 13xusjM8584v_ifTU1VSYay1P3.sFpBMpIgdyg7kwS X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.ne1.yahoo.com with HTTP; Sun, 7 Aug 2022 01:55:34 +0000 Original-Received: by hermes--canary-production-sg3-6f58cd9b5-q5dg5 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 1b7ba6513734d35cfc9abe8b56a8bd64; Sun, 07 Aug 2022 01:55:29 +0000 (UTC) In-Reply-To: <6c3817726a4fc63e83a3d004dffdf072cae278c5.camel@dancol.org> (Daniel Colascione's message of "Sat, 06 Aug 2022 19:57:41 -0400") X-Mailer: WebService/1.1.20491 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:239012 Archived-At: Daniel Colascione writes: > Hoo boy. I spent a bit of time digging into the event code. The root > cause of the inability of emacsclient to raise the frame is that > we've been getting X11 event timestamps wrong for some time. In > particular, 1) in GTK builds, we're not updating the X timestamps for > keyboard and mouse input events The reason for that is because GTK is supposed to do that itself, after the event ends up dispatched to GDK. I will investigate this further. > , and 2) we're not updating the X timestamp when we get an emacsclient > request. Because of #2, when we=C2=A0call x-focus-window in > select-frame-set-input-focus, the timestamp we send along with the > _NET_ACTIVE_WINDOW request is stale, causing some window managers > (e.g. cinnamon and kwin) to just ignore the _NET_ACTIVE_WINDOW. But > because we use _NET_ACTIVE_WINDOW *and* XSetInputFocus and the latter > works, the overall effect is that the call to > select-frame-set-input-focus in server.el focuses the Emacs window, > but doesn't raise it. That sounds likely to me, thanks for investigating. > The following patch should fix both problems: Right, but I saw a similar problem in the DND code, so I'd prefer you modified `x-display-set-last-user-time' instead. I think adding a separate FRAME argument to that function would be in order. Aside from that, this is too X-specific to warrant a terminal hook. The rest of the code is fine by me (tho there is a dpyinfo->server_time_monotonic_p flag that can be used to avoid a sync with the X server when trying to obtain the server time), but needs coding style fixes. I'm sure you already know how to do that.