From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.bugs Subject: bug#57012: Activating versus raising frames Date: Sat, 6 Aug 2022 22:07:23 -0400 Message-ID: <06468240-fd7c-72e8-2538-b65dd2f28665@dancol.org> References: <18270a59cb0.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org> <878ro25eo7.fsf@yahoo.com> <6c3817726a4fc63e83a3d004dffdf072cae278c5.camel@dancol.org> <87y1w03jhv.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37698"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Cc: 57012@debbugs.gnu.org To: Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 07 04:09:17 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 1oKVjA-0009eM-Fq for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 07 Aug 2022 04:09:17 +0200 Original-Received: from localhost ([::1]:55168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKVj9-000821-AS for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 06 Aug 2022 22:09:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34746) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKViw-00081t-Mh for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2022 22:09:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45971) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oKViw-0007xp-E2 for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2022 22:09:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oKViw-00071V-AA for bug-gnu-emacs@gnu.org; Sat, 06 Aug 2022 22:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Colascione Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Aug 2022 02:09: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.165983809126940 (code B ref 57012); Sun, 07 Aug 2022 02:09:02 +0000 Original-Received: (at 57012) by debbugs.gnu.org; 7 Aug 2022 02:08:11 +0000 Original-Received: from localhost ([127.0.0.1]:35720 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKVi7-00070S-Hw for submit@debbugs.gnu.org; Sat, 06 Aug 2022 22:08:11 -0400 Original-Received: from dancol.org ([96.126.100.184]:51960) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oKVi4-00070I-67 for 57012@debbugs.gnu.org; Sat, 06 Aug 2022 22:08:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From:References:Cc: To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ByyXE13BfoXA7nh8GNK0puOye3HWAzGsAm2GWTfx9DQ=; b=S+zGP9kZHm1IDgtOF17+4DOR+8 35lJVAtrp+7fG7ax1Wdcwn1iXx5TJXE/gsVsDuzodyjkzj6yiecwSnXrLvcLzQMYLCWqxZZYUt4ZD VWLu7pHDLqze1aNJPuz1xlqEwwuwxAWdP3PQRTC6aapocF3SQkwJvDEseIuCsDp2qOMqGVSCvA1mB 9rBTx2UiqqM/5t7cxPBReycUXyG5sdcJYFwZb2p261Uif/xS7QLUTkdLUlGGV2YPrCX7fux9nLG3x nICSu6HloaU5oCDcJrVvZHEwyvw6zw3HRG4I5ftlEr5NzQJ6wNs28SC4y3sNlDYX+SqZA7uZ35axB bnaXoTzA==; Original-Received: from 2603-9001-4203-1ab2-640d-a545-3db0-5adc.inf6.spectrum.com ([2603:9001:4203:1ab2:640d:a545:3db0:5adc]:39128) by dancol.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1oKVi2-0006jR-KQ; Sat, 06 Aug 2022 19:08:06 -0700 Content-Language: en-US In-Reply-To: <87y1w03jhv.fsf@yahoo.com> 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:239015 Archived-At: On 8/6/22 21:55, Po Lu wrote: > 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. The GDK code specifically mentions that programs that handle events themselves (like Emacs) need to explicitly update the event time (as my patch does) >> , and 2) we're not updating the X timestamp when we get an emacsclient >> request. Because of #2, when we call 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, What is the bug? > 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. We could do that, sure. > Aside from > that, this is too X-specific to warrant a terminal hook. Sorry, but I strongly disagree. The concept of signaling to the underlying window system that the user has interacted in some manner with a frame is generic and not X-specific. In fact --- doesn't the pgtk backend need an implementation of this hook too? It, like the conventional GTK backend, is blind to interactions with the frame performed using emacsclient. > 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), I think server_time_monotonic_p is an unnecessary optimization. > but needs coding style fixes. I'm sure you already know how to do that. The style is fine, thanks.