unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu <luangruo@yahoo.com>
To: Aiko Kyle <aikokyle@gmail.com>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: xwidget events
Date: Sat, 06 Nov 2021 10:12:53 +0800	[thread overview]
Message-ID: <87h7cq6nh6.fsf@yahoo.com> (raw)
In-Reply-To: <CAPWcbYFg3ejMa6OasfFADekkR_r7FHq9r2qtypzPCbwnR5A2jA@mail.gmail.com> (Aiko Kyle's message of "Fri, 5 Nov 2021 19:47:50 -0600")

Aiko Kyle <aikokyle@gmail.com> writes:

> In emacs-webkit, I introduced an "insert" mode to allows one to pass
> keyboard events directly to webkitgtk's widget. This is done by
> focusing the webkitgtk widget so gtk passes input events directly to
> it and emacs does not receive them. I did this since I thought it was
> very bad UI to see one's cursor on a web text field, try to interact
> with it, and have nothing happen. I know xwidgets has this injected JS
> workaround that allows one to type in the emacs minibuffer and send
> the text to the html field. However this won't work to, say, tab
> between form fields or use arrow keys to make selections. I'm not sure
> how you'd extend the JS solution to handle all these cases generally.

BTW, I have already implemented something similar: a function
`xwidget-perform-lispy-event' to send Lisp events to an xwidget, and an
`xwidget-webkit-edit-mode' that sends self inserting characters and
arrow keys to xwidgets-webkit.

You can find a recent version of my changes somewhere in the discussion
around bug#51473.

> On keyboard events, there will always be a tension between the CUA
> keys that webkit is hardcoded to use and emac's keys. Someone could
> write the appropriate translation layer, but it'll be a nontrivial,
> likely manual, task and will require constant upkeep as these things
> evolve in webkitgtk. Personally as an evil and former exwm user,
> making keyboard focus a modal distinction is natural.

Yes, but in the meantime I added some items to the menu bar that could
help with tasks such as saving the selection.

> On mouse events, I'm not sure what you will gain by exposing such
> events to lisp first then passing them to webkit. Is there some use
> case this would enable? I can't imagine it being very helpful without
> lisp also knowing what DOM element the mouse event is associated with.
> I would also be worried about latency with the additional redirection.

I'm not particularly worried about input latency, but it would be a bad
thing to enable this for every xwidget.  WDYT about the ability to set
input event masks for individual xwidgets, so people who write Lisp code
can decide which events get passed through right after handling the X
event, and which events get passed through Lisp code first?

> Additionally, until emacs learns to handle xinput 2 type events, you
> might risk losing all the multitouch gestures that webkit supports
> including smooth two-finger scrolling.

Unfortunately, it's impossible to support XInput 2 devices in any GTK
widget running inside an Emacs process at present: it's disabled so GTK
doesn't set an XI2 event mask that prevents Emacs from handling Core
Input events.

I do have a patch that enables XInput 2 support in Emacs, but I don't
have time to work on it right now.

Thanks.



      reply	other threads:[~2021-11-06  2:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <877ddulkrt.fsf.ref@yahoo.com>
2021-10-30 13:11 ` xwidget events Po Lu
2021-11-06  1:47   ` Aiko Kyle
2021-11-06  2:12     ` Po Lu [this message]

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=87h7cq6nh6.fsf@yahoo.com \
    --to=luangruo@yahoo.com \
    --cc=aikokyle@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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).