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.devel Subject: Re: master 4b98a79a50: Improve X event timestamp tracking Date: Sun, 07 Aug 2022 02:55:39 -0400 Message-ID: <18277167df8.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org> References: <165984385935.14715.8191942019361575877@vcs2.savannah.gnu.org> <20220807034419.B5F2FC09BFD@vcs2.savannah.gnu.org> <87y1w0zpe9.fsf@yahoo.com> <87r11szp6h.fsf@yahoo.com> <19d020d85bed5d030e706800f8cbb0b7fbb3bc65.camel@dancol.org> <875yj4znp5.fsf@yahoo.com> <75aa6286819b4ca9b008a3697b293567321c0d86.camel@dancol.org> <87h72oy682.fsf@yahoo.com> <0b58658c390b8c62cc1c5dfadd9e1f0621f64d82.camel@dancol.org> <87iln4wprn.fsf@yahoo.com> <87edxsv9me.fsf@yahoo.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="182771680ac50e22829c71272f" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38009"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: AquaMail/1.38.0 (build: 103800177) Cc: To: Po Lu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Aug 07 08:58:02 2022 Return-path: Envelope-to: ged-emacs-devel@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 1oKaEb-0009hM-WB for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Aug 2022 08:58:02 +0200 Original-Received: from localhost ([::1]:44534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oKaEa-0002od-NS for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Aug 2022 02:58:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKaCQ-00022y-Oh for emacs-devel@gnu.org; Sun, 07 Aug 2022 02:55:47 -0400 Original-Received: from dancol.org ([2600:3c01:e000:3d8::1]:42308) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oKaCO-0001iz-2Y for emacs-devel@gnu.org; Sun, 07 Aug 2022 02:55:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Type:MIME-Version:Subject:References:In-Reply-To:Message-ID: Date:CC:To:From:Sender:Reply-To:Content-Transfer-Encoding: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=/RT4QSTslZSyA7kFnNsptwcgGxf3ZnZVyTfjMAlZEjk=; b=eAfcfC96cGHQN7DcecdOuqiDrs /sjiS/4Pf1PSVHEVAPMOHPhNcrkqhVuQHJykAyE3jXkQFj090Xvulpzmmx6phsLA90wpuwHlMx7YL LQcIE1d/hgkcLMEp3IgMT4lskcVda8slaL7pxhQqMehQ4XtuLBS62lFQ5MdEU9rU1Zg9H/qq3rA99 vX+vYrU+rhIskJhCGRlotk+QjMDX/qW/OGONqIIxIDSxX9pyoqz27oMXewF8Z3CQDR18yYcVnsNAU 4qyVo1XdLYbGh/2nTts5gFeS+k6jo+bJomVZ1DvhYZORVIATNpxldUgsh0SRCeVBu30G0x1kp+9xg 9F6rkM1w==; Original-Received: from [97.104.88.154] (port=44566 helo=[192.168.86.77]) by dancol.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1oKaCM-0007K4-0v; Sat, 06 Aug 2022 23:55:42 -0700 In-Reply-To: <87edxsv9me.fsf@yahoo.com> Received-SPF: pass client-ip=2600:3c01:e000:3d8::1; envelope-from=dancol@dancol.org; helo=dancol.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:293182 Archived-At: This is a multi-part message in MIME format. --182771680ac50e22829c71272f Content-Type: text/plain; format=flowed; charset="us-ascii" Content-Transfer-Encoding: 8bit On August 7, 2022 02:41:25 Po Lu wrote: > Daniel Colascione writes: > >> Should Emacs set override-redirect all its frames, draw client-side >> decorations, and grab the keyboard all the time too --- just in case >> the window manager does something wrong? The purpose of a window >> manager is to manage windows: it's the part of the system tasked with >> what-goes-where policy. I'm genuinely confused about why you think >> Emacs in particular should go to lengths to contravene that policy. > > Because our users asked for it, and such a policy is causing Emacs bugs. > Like various other places where we fight with the window manager. Sure, but don't we have, in this instance, an option that doesn't involve fighting the window manager? > > >> This discussion is a great example of why OS developer shouldn't give >> application authors an "escape hatch" that lets them opt of policy >> enforcement under the theory that they must have some good reason for >> doing so. Turns out, everyone thinks he has a good reason. > > Fortunately for us, X was designed with a completely different attitude > in mind. It's definitely from a more naive time. You can tell by the lack of inter-client security. > > >> You're the one suggesting that Emacs developers are somehow talented >> enough not to abuse APIs. > > Well, your suggestion is also abusing an API, just in a different way. > _NET_WM_USER_TIME only applies to ButtonPress and KeyPress events (and > their input extension equivalents.) Programs aren't supposed to get the > timestamp from the X server and set the user time, they're only supposed > to do so in response to a limited set of input events. I'd argue that my suggestion is consistent with the spirit of the API and changes behavior only in a narrow case. Your proposal involves changing the behavior of every x-focus-frame call made when Emacs doesn't have focus, yes? (Also, aren't you worried that the focus check will lead to behavioral inconsistencies?) > > >> Because 1) users won't know it's there, and 2) setting >> x-allow-focus-stealing to nil will break the legitimate emacsclient >> use-case, and 3) what if every program did this? > > It will be documented in PROBLEMS, and emacsclient can be modified to > bind it to some other value in that case. And Emacs isn't every > program. > >> It's a preference in some window managers. That it's reached >> always-enabled status in others suggests that it's a good thing and a >> signaled user preference that Emacs should not attempt to defeat. > > So what about everywhere else we bludgeon the window manager into > obeying our commands? Starting from the various frame resizing hacks > (Martin knows more) to actually determining window manager positioning > behavior and fighting with type "A" window managers over the position of > a frame? All of those solutions have worked fine over decades, so I > don't understand why this has to be any different. Because there's a less invasive alternative. > > >> Yep. That's one way Win32 ends up being better than X. > > But then the bug could never be fixed under MS Windows. The bug doesn't exist on MS Windows because the Win32 API has a function specifically designed to help apps do what emacsclient wants to do. > > >> Emacs is every bit a modern Windows application. There's been a lot of >> effort put into graceful degradation when running under >> less-than-cutting-edge environments like Windows 95. > > I'm talking about the "Modern Application" referred to in the doc, > specifically this part: > >>>> * The foreground process is not a Modern Application or the >>>> Start Screen. > >> Yes it is. > > Why, if there's no way to set it? > >> Sometimes contrary to what the user wants. > > Then the user can customize the variable to nil. Customizing the variable to nil breaks emacsclient. > > >> Yeah, you're right. A synthetic input event would work, wouldn't it? > > Synthesizing input events doesn't work either, because the X server will > cargo cult the timestamp you put in the event that's sent. The only > halfway-reliable way is to change a property on the frame's window and > wait for the PropertyChange event. > > (Grabbing the server doesn't work either because the input events that > pile up will get sent first, after the grab is released.) --182771680ac50e22829c71272f Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable


On August 7, 2022 02:41:25 Po Lu <luangruo@yahoo.com&g= t; wrote:

Daniel Colascione <dancol@dancol.org> writes:

Should Emacs set override-redirect all its frames, draw c= lient-side
decorations, and grab the keyboard all the time too --- j= ust in case
the window manager does something wrong? The purpose of a= window
manager is to manage windows: it's the part of the system= tasked with
what-goes-where policy. I'm genuinely confused about why = you think
Emacs in particular should go to lengths to contravene th= at policy.

Because our users asked for it, and such a policy is caus= ing Emacs bugs.
Like various other places where we fight with the window = manager.

Sure, but don't we have, in this instance, an option that doesn't invol= ve fighting the window manager?



This discussion is a great example of why OS developer sh= ouldn't give
application authors an "escape hatch" that lets them opt = of policy
enforcement under the theory that they must have some goo= d reason for
doing so. Turns out, everyone thinks he has a good reason= .

Fortunately for us, X was designed with a completely diff= erent attitude
in mind.

It's definitely from a more naive time. You can tell = by the lack of inter-client security.


You're the one suggesting that Emacs developers are someh= ow talented
enough not to abuse APIs.

Well, your suggestion is also abusing an API, just in a d= ifferent way.
_NET_WM_USER_TIME only applies to ButtonPress and KeyPres= s events (and
their input extension equivalents.)  Programs aren't= supposed to get the
timestamp from the X server and set the user time, they'r= e only supposed
to do so in response to a limited set of input events.

I'd arg= ue that my suggestion is consistent with the spirit of the API and changes = behavior only in a narrow case. Your proposal involves changing the behavio= r of every x-focus-frame call made when Emacs doesn't have focus, yes? (Als= o, aren't you worried that the focus check will lead to behavioral inconsis= tencies?)



Because 1) users won't know it's there, and 2) setting
x-allow-focus-stealing to nil will break the legitimate e= macsclient
use-case, and 3) what if every program did this?

It will be documented in PROBLEMS, and emacsclient can be= modified to
bind it to some other value in that case.  And Emacs= isn't every
program.

It's a preference in some window managers. That it's reac= hed
always-enabled status in others suggests that it's a good= thing and a
signaled user preference that Emacs should not attempt to= defeat.

So what about everywhere else we bludgeon the window mana= ger into
obeying our commands? Starting from the various frame res= izing hacks
(Martin knows more) to actually determining window manage= r positioning
behavior and fighting with type "A" window managers over = the position of
a frame? All of those solutions have worked fine over dec= ades, so I
don't understand why this has to be any different.
<= /blockquote>

Because the= re's a less invasive alternative.



Yep. That's one way Win32 ends up being better than X.

But then the bug could never be fixed under MS Windows.

The bu= g doesn't exist on MS Windows because the Win32 API has a function specific= ally designed to help apps do what emacsclient wants to do.


Emacs is every bit a modern Windows application. There's = been a lot of
effort put into graceful degradation when running under
less-than-cutting-edge environments like Windows 95.

I'm talking about the "Modern Application" referred to in= the doc,
specifically this part:

* The foreground process is not a Modern Application or t= he
Start Screen.

Yes it is.

Why, if there's no way to set it?

Sometimes contrary to what the user wants.

Then the user can customize the variable to nil.

Customizing t= he variable to nil breaks emacsclient.


Yeah, you're right. A synthetic input event would work, w= ouldn't it?

Synthesizing input events doesn't work either, because th= e X server will
cargo cult the timestamp you put in the event that's sent= .  The only
halfway-reliable way is to change a property on the frame= 's window and
wait for the PropertyChange event.

(Grabbing the server doesn't work either because the inpu= t events that
pile up will get sent first, after the grab is released.)=

--182771680ac50e22829c71272f--