unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Colascione <dancol@dancol.org>
To: Po Lu <luangruo@yahoo.com>
Cc: <emacs-devel@gnu.org>
Subject: Re: master 4b98a79a50: Improve X event timestamp tracking
Date: Sun, 07 Aug 2022 02:55:39 -0400	[thread overview]
Message-ID: <18277167df8.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org> (raw)
In-Reply-To: <87edxsv9me.fsf@yahoo.com>

[-- Attachment #1: Type: text/plain, Size: 4364 bytes --]



On August 7, 2022 02:41:25 Po Lu <luangruo@yahoo.com> wrote:

> Daniel Colascione <dancol@dancol.org> 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.)


[-- Attachment #2: Type: text/html, Size: 10324 bytes --]

  reply	other threads:[~2022-08-07  6:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <165984385935.14715.8191942019361575877@vcs2.savannah.gnu.org>
     [not found] ` <20220807034419.B5F2FC09BFD@vcs2.savannah.gnu.org>
2022-08-07  3:46   ` master 4b98a79a50: Improve X event timestamp tracking Po Lu
2022-08-07  3:48     ` Daniel Colascione
2022-08-07  3:51       ` Po Lu
2022-08-07  4:03         ` Daniel Colascione
2022-08-07  4:23           ` Po Lu
2022-08-07  4:39             ` Daniel Colascione
2022-08-07  5:26               ` Po Lu
2022-08-07  5:43                 ` Daniel Colascione
2022-08-07  6:07                   ` Po Lu
2022-08-07  6:25                     ` Daniel Colascione
2022-08-07  6:41                       ` Po Lu
2022-08-07  6:55                         ` Daniel Colascione [this message]
2022-08-07  7:06                           ` Po Lu
2022-08-07  5:41               ` Eli Zaretskii
2022-08-07  5:51                 ` Daniel Colascione
2022-08-07  5:53                 ` Po Lu
2022-08-07  6:04                   ` Daniel Colascione
2022-08-07  6:15                     ` Po Lu
2022-08-07  6:43                       ` Daniel Colascione
2022-08-07  7:02                         ` Po Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=18277167df8.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org \
    --to=dancol@dancol.org \
    --cc=emacs-devel@gnu.org \
    --cc=luangruo@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).