From: Akira Kyle <akira@akirakyle.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: larsi@gnus.org, emacs-devel@gnu.org
Subject: Re: Introducing emacs-webkit and more thoughts on Emacs rendering (was Rethinking the design of xwidgets)
Date: Sun, 29 Nov 2020 20:54:01 -0700 [thread overview]
Message-ID: <86lfeja49y.fsf@akirakyle.com> (raw)
In-Reply-To: <83czzwkmwk.fsf@gnu.org>
On Sun, Nov 29, 2020 at 12:01 PM, Eli Zaretskii <eliz@gnu.org>
wrote:
>> One such fundamental incompatibility stems from the fact that
>> Emacs may have multiple views on one buffer split across
>> various
>> windows and/or frames. Gtk assumes that each widget will only
>> have
>> one view. The 'webkit xwidget type currently works around this
>> by
>> drawing to an offscreen window then for every window that's
>> supposed to display the widget, creating a gtk drawing area
>> widget
>> and copying the offscreen window's surface to the drawing
>> surface. I don't think gtk really intends for ofscreen widgets
>> to
>> be used this way and as far as I can tell offscreen window
>> widgets
>> have been removed in gtk4.
>>
>> Another issue is that emacs uses a GtkFixed (or a custom
>> subclassed EmacsFixed for gtk3) as the container widget for the
>> main frame area. There isn't a mechanism to control z-ordering
>> of
>> child widgets other than removing and re-adding them in the
>> desired z-order, which is what emacs-webkit has to do in order
>> for
>> child frames to not render below the webkit widget.
>
> The same problems plague your experiment with a module, don't
> they?
More or less yes. Restricting myself to just a webkit widget
allows me to not have to solve these problems generally. For
example I don't draw the widget offscreen, instead I take a lesson
from exwm and try to force Emacs to only ever display at most one
window per webkit buffer.
> Anyway, this just tells me that GTK is not a good starting point
> for
> embedding widgets. Do other projects build embedded widgets on
> such
> shaky grounds?
I wouldn't say GTK isn't good for embedding widgets. In fact I'd
say it's probably great if you're wanting to extend an existing
GTK app with custom widgets. The problem is Emacs, despite using
GTK as a toolkit, isn't really a GTK app. Emacs just uses GTK to
handle getting input and drawing a surface to the screen. Because
Emacs isn't itself composed of GTK "normal" widgets, but rather
just one GtkFixed container it does all its drawing in, you can't
expect GTK widgets added along side what Emacs draws in that area
to play nicely together without significant effort. And that
effort boils down to making GTK aware of what Emacs has drawn and
vice versa. If all the UI components of Emacs such as windows, the
mode line, etc, were each implemented as a sensible GTK widget,
then this wouldn't be so much of an issue since then GTK would
already know where and what things are.
>> > As long as the widget can be told to use a given rectangular
>> > portion of the screen, we should be fine: the current Emacs
>> > display engine is perfectly capable of handling display
>> > elements
>> > that occupy an area of certain dimensions.
>>
>> This is more an issue on the gtk side of things. With the
>> webkit
>> widget it isn't an issue since the widget doesn't define a
>> minimum
>> size so any size you request it to render at, it will
>> obey. However other widgets, such as buttons, sliders, etc,
>> have a
>> minimum size they will render at. If you tell it to render
>> itself
>> smaller, it will refuse and so it's impossible to simply tell
>> the
>> widget "here's the space you have to go in". This becomes a
>> problem when the widget needs to be clipped at a window
>> boundary
>> as gtk will happily draw the widgets across them as gtk has no
>> internal knowledge of Emacs window boundaries being a place
>> that
>> widget must be clipped at.
>
> This is solvable. We already have similar situation in the
> display
> engine, where some display element cannot be usefully "clipped".
> We
> either don't display it at all or display it on the next screen
> line,
> depending on the wrap mode.
I don't doubt its solvable, but how satisfactorily and at what
complexity? I would say not displaying an element when some
portion could be displayed is visually very unsatisfying. What if
the element is large and 99% of it could be visible? What if the
element is wider than the window? What if
`window-resize-pixelwise` or `frame-resize-pixelwise` non-nil and
the element is on the last, partially clipped line?
>> The direction I'm thinking of going in the future since I feel
>> like thus far the xwidget route has been fairly troublesome is
>> to
>> expose interfaces to the cairo surfaces used in image.c. This
>> could be through modifying image.c or through defining a new
>> display element type. I would try to expose the cairo API to
>> lisp
>> and allow dynamic modules to directly draw to a cairo surface
>> given to it through the lisp interface. Gtk along with many
>> other
>> libraries (such as librsvg and poppler) support drawing to a
>> cairo
>> surface and then Emacs gets to have full control over how that
>> cario surface ends up on screen. I would see this as a stepping
>> stone to attempting to do something similar with a opengl
>> surface.
>
> My suggestion is to think how to integrate this idea into Emacs
> proper, without introducing modules into the equation. Modules
> add
> another layer of complexity, so I would suggest to design the
> solution
> inside Emacs, and only after that see how to do that from a
> module.
> One step at a time.
Of course the first step would be to work inside Emacs proper, and
expose lisp interfaces. However I think designing such a feature
should keep eventual integration with modules in mind. Especially
since in general graphics is very performance sensitive and so
doing some drawing in elisp just might not cut it and many
interesting applications of such a feature would require
interfacing with an external c library. This is all pretty
hypothetical at this point though and as I keep learning with
Emacs C code: its hard to speculate on the best way to do
something without actually trying something out first.
next prev parent reply other threads:[~2020-11-30 3:54 UTC|newest]
Thread overview: 225+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-12 20:58 Rethinking the design of xwidgets Akira Kyle
2020-10-12 22:18 ` joakim
2020-10-13 16:07 ` Akira Kyle
2020-10-13 19:06 ` joakim
2020-10-14 0:33 ` Akira Kyle
2020-10-13 13:36 ` Stefan Monnier
2020-10-13 16:09 ` Akira Kyle
2020-10-13 14:16 ` Eli Zaretskii
2020-10-13 17:05 ` Akira Kyle
2020-10-13 17:24 ` Qiantan Hong
2020-10-13 18:29 ` Akira Kyle
2020-10-13 18:44 ` Qiantan Hong
2020-10-13 19:17 ` Eli Zaretskii
2020-10-13 20:52 ` Akira Kyle
2020-10-14 14:36 ` Eli Zaretskii
2020-10-14 17:01 ` Stefan Monnier
2020-10-15 19:55 ` arthur miller
2020-10-13 18:45 ` Eli Zaretskii
2020-10-13 21:00 ` Akira Kyle
2020-10-14 14:44 ` Eli Zaretskii
2020-10-15 0:35 ` Akira Kyle
2020-10-15 2:07 ` Stefan Monnier
2020-10-15 3:35 ` arthur miller
2020-10-15 15:06 ` Eli Zaretskii
2020-10-15 15:20 ` Arthur Miller
2020-10-15 15:48 ` Eli Zaretskii
2020-10-13 17:55 ` Eli Zaretskii
2020-10-13 18:42 ` Basil L. Contovounesios
2020-10-13 19:10 ` Eli Zaretskii
2020-10-13 20:37 ` Akira Kyle
2020-10-14 14:33 ` Eli Zaretskii
2020-10-14 15:04 ` Arthur Miller
2020-10-14 15:32 ` Eli Zaretskii
2020-10-15 13:20 ` Arthur Miller
2020-10-17 4:26 ` Kai Ma
2020-10-17 4:42 ` Qiantan Hong
2020-11-14 5:40 ` Richard Stallman
2020-10-14 16:53 ` Stefan Monnier
2020-10-14 18:56 ` Aiko Kyle
2020-10-15 12:48 ` Arthur Miller
2020-10-15 16:25 ` Akira Kyle
2020-10-15 12:35 ` Arthur Miller
2020-10-16 4:02 ` Richard Stallman
2020-10-16 13:03 ` Arthur Miller
2020-10-16 18:38 ` Dmitry Gutov
2020-10-17 4:19 ` Richard Stallman
2020-10-17 4:21 ` Richard Stallman
2020-10-17 6:30 ` Arthur Miller
2020-10-17 13:35 ` Stefan Monnier
2020-10-17 19:15 ` Arthur Miller
2020-10-19 3:44 ` Richard Stallman
2020-10-18 4:17 ` Richard Stallman
2020-10-18 4:17 ` Richard Stallman
2020-10-18 9:31 ` Dmitry Gutov
2020-10-19 3:44 ` Richard Stallman
2020-10-19 12:37 ` Dmitry Gutov
2020-10-19 13:43 ` Arthur Miller
2020-10-20 5:13 ` Richard Stallman
2020-10-20 5:47 ` Arthur Miller
2020-10-20 12:58 ` Stefan Monnier
2020-10-20 13:40 ` Arthur Miller
2020-10-21 4:42 ` Richard Stallman
2020-10-21 12:25 ` Arthur Miller
2020-10-21 4:46 ` Richard Stallman
2020-10-20 5:14 ` Richard Stallman
2020-10-20 5:56 ` Arthur Miller
2020-10-20 10:45 ` Dmitry Gutov
2020-10-20 13:49 ` Arthur Miller
2020-10-20 20:11 ` Jean Louis
2020-10-20 23:25 ` Sv: " arthur miller
2020-10-21 8:10 ` Jean Louis
2020-10-21 11:59 ` Arthur Miller
2020-10-21 12:58 ` Hardware respecting your freedom Jean Louis
2020-10-22 2:53 ` Arthur Miller
2020-10-22 7:08 ` Jean Louis
2020-10-23 3:40 ` Richard Stallman
2020-10-23 12:53 ` Arthur Miller
2020-10-23 15:15 ` Pankaj Jangid
2020-10-24 3:49 ` Richard Stallman
2020-10-24 6:02 ` Jean Louis
2020-10-24 15:00 ` Arthur Miller
2020-10-25 3:54 ` Richard Stallman
2020-10-21 4:46 ` Rethinking the design of xwidgets Richard Stallman
2020-10-19 13:34 ` Arthur Miller
2020-10-19 14:04 ` Stefan Monnier
2020-10-20 5:13 ` Richard Stallman
2020-10-18 14:41 ` Arthur Miller
2020-10-19 3:48 ` Richard Stallman
2020-10-19 13:48 ` Arthur Miller
2020-10-16 14:54 ` Dmitry Gutov
2020-10-14 18:07 ` Akira Kyle
2020-10-14 18:32 ` Eli Zaretskii
2020-10-14 19:10 ` Akira Kyle
2020-10-13 18:36 ` Tomas Hlavaty
2020-10-13 18:38 ` Tomas Hlavaty
2020-10-13 21:20 ` Aiko Kyle
2020-10-14 0:12 ` Corwin Brust
2020-10-14 19:16 ` Akira Kyle
2020-10-14 7:32 ` Tomas Hlavaty
2020-10-14 15:02 ` Eli Zaretskii
2020-10-14 16:35 ` Tomas Hlavaty
2020-10-14 19:22 ` Akira Kyle
2020-10-14 21:29 ` Tomas Hlavaty
2020-10-16 4:02 ` Richard Stallman
2020-10-16 13:09 ` Arthur Miller
2020-10-14 19:24 ` Mingde (Matthew) Zeng
2020-10-14 21:46 ` Akira Kyle
2020-10-15 5:17 ` Mingde (Matthew) Zeng
2020-10-14 4:38 ` Richard Stallman
2020-10-14 6:36 ` Akira Kyle
2020-11-22 3:35 ` Introducing emacs-webkit and more thoughts on Emacs rendering (was Rethinking the design of xwidgets) Akira Kyle
2020-11-22 12:01 ` Jean Louis
2020-11-22 12:04 ` Jean Louis
2020-11-22 12:18 ` tomas
2020-11-22 12:57 ` Jean Louis
2020-11-22 16:24 ` tomas
2020-11-22 17:18 ` Jean Louis
2020-11-22 17:48 ` tomas
2020-11-22 18:40 ` Akira Kyle
2020-11-22 19:58 ` Jean Louis
2020-11-22 20:29 ` Akira Kyle
2020-11-22 20:38 ` Jean Louis
2020-11-22 15:27 ` Arthur Miller
2020-11-22 12:50 ` Jean Louis
2020-11-22 18:33 ` Akira Kyle
2020-11-22 18:04 ` Eli Zaretskii
2020-11-22 18:46 ` Akira Kyle
2020-11-22 21:20 ` Vasilij Schneidermann
2020-11-22 22:04 ` Akira Kyle
2020-11-22 18:29 ` T.V Raman
2020-11-22 18:53 ` Akira Kyle
2020-11-22 19:35 ` T.V Raman
2020-11-22 20:26 ` Akira Kyle
2020-11-23 0:46 ` T.V Raman
2020-11-23 3:44 ` Akira Kyle
2020-11-23 3:01 ` T.V Raman
2020-11-23 3:47 ` Akira Kyle
2020-11-23 16:29 ` Jose A. Ortega Ruiz
2020-11-23 9:39 ` Lars Ingebrigtsen
2020-11-23 13:26 ` joakim
2020-11-24 6:21 ` Lars Ingebrigtsen
2020-11-23 14:59 ` Arthur Miller
2020-11-23 23:47 ` Alan Third
2020-11-24 3:58 ` Akira Kyle
2020-11-24 8:06 ` Arthur Miller
2020-11-24 5:51 ` Richard Stallman
2020-11-24 6:24 ` Lars Ingebrigtsen
2020-11-26 4:49 ` Richard Stallman
2020-11-26 5:25 ` Arthur Miller
2020-11-26 8:27 ` tomas
2020-11-26 14:55 ` Arthur Miller
2020-11-26 19:11 ` Tomas Hlavaty
2020-11-26 19:34 ` arthur miller
2020-11-27 8:04 ` Tomas Hlavaty
2020-11-27 8:44 ` Arthur Miller
2020-11-27 13:35 ` Richard Stallman
2020-11-27 19:22 ` Arthur Miller
2020-11-27 20:01 ` Eli Zaretskii
2020-11-27 21:22 ` Arthur Miller
2020-11-27 20:07 ` Stefan Monnier
2020-11-27 21:09 ` Arthur Miller
2020-11-27 21:35 ` Stefan Monnier
2020-11-27 23:23 ` Arthur Miller
2020-11-28 0:28 ` Stefan Monnier
2020-11-28 8:48 ` Arthur Miller
2020-11-27 21:22 ` Akira Kyle
2020-11-28 7:31 ` Eli Zaretskii
2020-11-28 5:55 ` Richard Stallman
2020-11-28 8:50 ` Arthur Miller
2020-11-29 5:24 ` Richard Stallman
2020-11-24 7:50 ` Arthur Miller
2020-11-24 8:47 ` tomas
2020-11-24 9:04 ` Arthur Miller
2020-11-25 5:38 ` Richard Stallman
2020-11-25 8:46 ` tomas
2020-11-25 15:26 ` Arthur Miller
2020-11-25 16:15 ` Eric S Fraga
2020-11-24 15:43 ` T.V Raman
2020-11-25 5:38 ` Richard Stallman
2020-11-25 8:54 ` tomas
2020-11-24 6:23 ` Lars Ingebrigtsen
2020-11-24 3:33 ` Akira Kyle
2020-11-24 6:27 ` Lars Ingebrigtsen
2020-11-25 1:36 ` Akira Kyle
2020-11-25 15:11 ` Eli Zaretskii
2020-11-27 20:56 ` Akira Kyle
2020-11-28 8:38 ` Eli Zaretskii
2020-11-28 8:57 ` Arthur Miller
2020-11-28 9:19 ` Eli Zaretskii
2020-11-29 0:22 ` Arthur Miller
2020-11-29 1:29 ` Akira Kyle
2020-11-29 8:22 ` martin rudalics
2020-11-29 19:01 ` Eli Zaretskii
2020-11-30 3:54 ` Akira Kyle [this message]
2020-11-30 15:39 ` Eli Zaretskii
2020-11-30 17:03 ` Akira Kyle
2020-11-30 18:11 ` Eli Zaretskii
2020-11-30 18:30 ` Akira Kyle
2020-12-01 7:44 ` Tomas Hlavaty
2020-12-03 0:24 ` Akira Kyle
2020-12-03 8:07 ` Tomas Hlavaty
2020-12-03 20:34 ` Arthur Miller
2020-12-03 20:53 ` Stefan Monnier
2020-12-01 8:01 ` Tomas Hlavaty
2020-12-01 15:36 ` Arthur Miller
2020-12-01 16:48 ` Tomas Hlavaty
2020-12-01 15:58 ` Eli Zaretskii
2020-12-01 17:33 ` Tomas Hlavaty
2020-12-01 19:41 ` Eli Zaretskii
2020-12-02 20:37 ` Tomas Hlavaty
2020-12-03 14:39 ` Eli Zaretskii
2020-12-03 21:02 ` Tomas Hlavaty
2020-12-04 7:48 ` Eli Zaretskii
2020-12-03 0:37 ` Akira Kyle
2020-12-03 8:15 ` Tomas Hlavaty
2020-12-03 15:13 ` Eli Zaretskii
2020-12-03 21:15 ` Tomas Hlavaty
2020-12-04 8:00 ` Eli Zaretskii
2020-11-30 9:05 ` martin rudalics
2020-11-30 16:10 ` Eli Zaretskii
2020-11-23 22:12 ` Alexander Adolf
2020-11-24 1:30 ` T.V Raman
2020-11-24 8:13 ` Arthur Miller
2020-11-24 3:51 ` Akira Kyle
-- strict thread matches above, loose matches on Subject: below --
2020-12-02 2:58 arthur miller
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86lfeja49y.fsf@akirakyle.com \
--to=akira@akirakyle.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=larsi@gnus.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.