* xwidget branch
@ 2010-06-23 11:35 joakim
2010-06-30 11:55 ` Jan Djärv
0 siblings, 1 reply; 6+ messages in thread
From: joakim @ 2010-06-23 11:35 UTC (permalink / raw
To: Emacs development discussions
I created a new "xwidget" branch. It is a very experimental branch that
allows gtk widgets to be embedded in an emacs buffer, much like images.
It is, for instance, possible to embedd a browser in an Emacs window.
See some screenshots here:
http://www.emacswiki.org/emacs/EmacsXembed
Soem screenshots of Daivd Hackneys work to embed the usbl browser:
http://www.haxney.org/2009/08/its-alive.html
There is also a README in the root of the branch.
Please note that the code really is experimental and that there are a
number of hard problems still unsolved. That said, I still find it very
cool to see gtk buttons moving in an Emacs window, and even Emacs
embedded in Emacs :)
--
Joakim Verona
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: xwidget branch
2010-06-23 11:35 xwidget branch joakim
@ 2010-06-30 11:55 ` Jan Djärv
2010-06-30 13:09 ` joakim
0 siblings, 1 reply; 6+ messages in thread
From: Jan Djärv @ 2010-06-30 11:55 UTC (permalink / raw
To: joakim; +Cc: Emacs development discussions
This sounds like fun. How do you handle multiple windows, that is the same
buffer with widgets displayed in different frames/windows?
Does the widgets always flow with the text or can you anchor them at fixed
positions? I was thinking of per window toolbars.
Jan D.
joakim@verona.se skrev 2010-06-23 13.35:
> I created a new "xwidget" branch. It is a very experimental branch that
> allows gtk widgets to be embedded in an emacs buffer, much like images.
>
> It is, for instance, possible to embedd a browser in an Emacs window.
>
> See some screenshots here:
>
> http://www.emacswiki.org/emacs/EmacsXembed
>
> Soem screenshots of Daivd Hackneys work to embed the usbl browser:
>
> http://www.haxney.org/2009/08/its-alive.html
>
> There is also a README in the root of the branch.
>
> Please note that the code really is experimental and that there are a
> number of hard problems still unsolved. That said, I still find it very
> cool to see gtk buttons moving in an Emacs window, and even Emacs
> embedded in Emacs :)
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: xwidget branch
2010-06-30 11:55 ` Jan Djärv
@ 2010-06-30 13:09 ` joakim
2010-07-01 15:52 ` Jan Djärv
0 siblings, 1 reply; 6+ messages in thread
From: joakim @ 2010-06-30 13:09 UTC (permalink / raw
To: Jan Djärv; +Cc: Emacs development discussions
Jan Djärv <jan.h.d@swipnet.se> writes:
> This sounds like fun. How do you handle multiple windows, that is the
> same buffer with widgets displayed in different frames/windows?
There are some notes in the readme. I paste it below so we can discuss it
and improve it. This is as you might imagine the really tricky part.
> Does the widgets always flow with the text or can you anchor them at
> fixed positions? I was thinking of per window toolbars.
They work like images. It ought to be possible to bind them to a margin
or something like images, but I havent tested this. Also like images
they are not tied to a window but to a buffer. OTOH xwidgets have,
unlike images, their own identity, and I have been thinking of letting
an xwidget be able to replace an entire window, etc.
The readme follows:
* Xwidgets
This is an experimental branch to enable embedding of GTK widgets
inside an Emacs window. The Emacs abstraction is called an Xwidget,
for eXternal widget, and also in reference to the Xembed protocoll.
There is a demo file called xwidget-test.el which shows some of the
possibilities. There are some screnshots at the emacswiki.
Currently its possible to insert buttons, sliders, and xembed widgets
in the buffer. It works similar to the support for images in Emacs.
A difference from images is that xwidgets live their own life. You
create them with an api, get a reference, and tie them to a particular
buffer with a display spec. Also, xwidgets exists in only one copy,
where a plain image can be shown in several windows. The xwidget code
tries to handle this by essentialy making a screen capture of the
widget and displaying those in the non-active windows, and the real
widget in the active window. This doesnt currently work for xembed
widgets.
The current state is that one window, one frame, showing many xwidgets
is a nice demo.
TODO
- Examine using XComposite rather than GTK off-screen rendering. This
would make xembed widgets work much better.
- make the keyboard event code propagation code work.
- remove the special-case for when the minibuffer is
active. Special-casing will never work properly.
- disable cursor drawing on top of an active xwidget
- figure out what to do with the multiple frames case
- improve the xwidgets programming interface so its less of
hand-waving affair
- more documentation
> Jan D.
>
>
> joakim@verona.se skrev 2010-06-23 13.35:
>> I created a new "xwidget" branch. It is a very experimental branch that
>> allows gtk widgets to be embedded in an emacs buffer, much like images.
>>
>> It is, for instance, possible to embedd a browser in an Emacs window.
>>
>> See some screenshots here:
>>
>> http://www.emacswiki.org/emacs/EmacsXembed>
>> Soem screenshots of Daivd Hackneys work to embed the usbl browser:
>>
>> http://www.haxney.org/2009/08/its-alive.html>
>> There is also a README in the root of the branch.
>>
>> Please note that the code really is experimental and that there are a
>> number of hard problems still unsolved. That said, I still find it very
>> cool to see gtk buttons moving in an Emacs window, and even Emacs
>> embedded in Emacs :)
>>
--
Joakim Verona
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: xwidget branch
2010-06-30 13:09 ` joakim
@ 2010-07-01 15:52 ` Jan Djärv
2010-07-01 19:28 ` joakim
0 siblings, 1 reply; 6+ messages in thread
From: Jan Djärv @ 2010-07-01 15:52 UTC (permalink / raw
To: joakim; +Cc: Emacs development discussions
joakim@verona.se skrev 2010-06-30 15.09:
> Jan Djärv<jan.h.d@swipnet.se> writes:
>
>> This sounds like fun. How do you handle multiple windows, that is the
>> same buffer with widgets displayed in different frames/windows?
>
> There are some notes in the readme. I paste it below so we can discuss it
> and improve it. This is as you might imagine the really tricky part.
>
>
I guess it takes some kind of proxy object that keeps track of creating the
real widget for each window. GtkAction:s can help here. You can have a
GtkAction instead of the real widget. When redisplay is done, check all proxy
widgets for the GtkAction, and if no one is present for the window, create
one. The window can be saved in the real widget as widget data.
I think the "don't display cursor over widget"-problem should have some
precedence, it really looks awful :-).
I see lots of redisplay-problems with widgets, but that is to expected as
Emacs doesn't use the Gtk+ event loop. It took a while before Gtk+ scrollbars
displayed nicely, and even now bugs show up. You have to request redraw on
widgets and flush the Gdk event queue manually at appropriate places.
>> Does the widgets always flow with the text or can you anchor them at
>> fixed positions? I was thinking of per window toolbars.
>
> They work like images. It ought to be possible to bind them to a margin
> or something like images, but I havent tested this. Also like images
> they are not tied to a window but to a buffer. OTOH xwidgets have,
> unlike images, their own identity, and I have been thinking of letting
> an xwidget be able to replace an entire window, etc.
>
I'll give it a try.
Jan D.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: xwidget branch
2010-07-01 15:52 ` Jan Djärv
@ 2010-07-01 19:28 ` joakim
2010-07-02 8:40 ` Jan Djärv
0 siblings, 1 reply; 6+ messages in thread
From: joakim @ 2010-07-01 19:28 UTC (permalink / raw
To: Jan Djärv; +Cc: Emacs development discussions
Jan Djärv <jan.h.d@swipnet.se> writes:
> joakim@verona.se skrev 2010-06-30 15.09:
>> Jan Djärv<jan.h.d@swipnet.se> writes:
>>
>>> This sounds like fun. How do you handle multiple windows, that is the
>>> same buffer with widgets displayed in different frames/windows?
>>
>> There are some notes in the readme. I paste it below so we can discuss it
>> and improve it. This is as you might imagine the really tricky part.
>>
>>
>
> I guess it takes some kind of proxy object that keeps track of
> creating the real widget for each window. GtkAction:s can help here.
> You can have a GtkAction instead of the real widget. When redisplay
> is done, check all proxy widgets for the GtkAction, and if no one is
> present for the window, create one. The window can be saved in the
> real widget as widget data.
Ill have to look into that idea. Would it really work for all sorts of
widgets, like sliders? Maybe you can elaborate a bit more, it sounds
interesting.
> I think the "don't display cursor over widget"-problem should have
> some precedence, it really looks awful :-).
Its not spectacularily beautiful no. But doesnt images have the same
issues? Maybe images have some cursor handling code that can be reused?
> I see lots of redisplay-problems with widgets, but that is to expected
> as Emacs doesn't use the Gtk+ event loop. It took a while before Gtk+
> scrollbars displayed nicely, and even now bugs show up. You have to
> request redraw on widgets and flush the Gdk event queue manually at
> appropriate places.
Do you have any example pointers in the Emacs source handy?
>>> Does the widgets always flow with the text or can you anchor them at
>>> fixed positions? I was thinking of per window toolbars.
>>
>> They work like images. It ought to be possible to bind them to a margin
>> or something like images, but I havent tested this. Also like images
>> they are not tied to a window but to a buffer. OTOH xwidgets have,
>> unlike images, their own identity, and I have been thinking of letting
>> an xwidget be able to replace an entire window, etc.
>>
>
> I'll give it a try.
>
> Jan D.
>
>
--
Joakim Verona
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: xwidget branch
2010-07-01 19:28 ` joakim
@ 2010-07-02 8:40 ` Jan Djärv
0 siblings, 0 replies; 6+ messages in thread
From: Jan Djärv @ 2010-07-02 8:40 UTC (permalink / raw
To: joakim; +Cc: Emacs development discussions
joakim@verona.se skrev 2010-07-01 21.28:
> Jan Djärv<jan.h.d@swipnet.se> writes:
>
>> joakim@verona.se skrev 2010-06-30 15.09:
>>> Jan Djärv<jan.h.d@swipnet.se> writes:
>>>
>>>> This sounds like fun. How do you handle multiple windows, that is the
>>>> same buffer with widgets displayed in different frames/windows?
>>>
>>> There are some notes in the readme. I paste it below so we can discuss it
>>> and improve it. This is as you might imagine the really tricky part.
>>>
>>>
>>
>> I guess it takes some kind of proxy object that keeps track of
>> creating the real widget for each window. GtkAction:s can help here.
>> You can have a GtkAction instead of the real widget. When redisplay
>> is done, check all proxy widgets for the GtkAction, and if no one is
>> present for the window, create one. The window can be saved in the
>> real widget as widget data.
>
> Ill have to look into that idea. Would it really work for all sorts of
> widgets, like sliders? Maybe you can elaborate a bit more, it sounds
> interesting.
No, unfortunately GtkAction only works with widgets that implement the
interface GtkActivatable. A custom Emacs proxy would be needed.
I was just thinking of a list that stores <widget, window> pairs and adds to
it if the current window isn't there. Of course removing from this list
becomes a problem. Keeping thinks like sliders in sync is also an issue.
>
>> I think the "don't display cursor over widget"-problem should have
>> some precedence, it really looks awful :-).
>
> Its not spectacularily beautiful no. But doesnt images have the same
> issues? Maybe images have some cursor handling code that can be reused?
It can be tricky to do exactly the same. Images just alter the background
when the cursor is over them. But Gtk+ widgets can repaint the background
when they feel like it. I suggest trying to alter the widget state, for
example to PRELIGHT. Then again, not all widgets differ between normal and
prelight state.
>
>> I see lots of redisplay-problems with widgets, but that is to expected
>> as Emacs doesn't use the Gtk+ event loop. It took a while before Gtk+
>> scrollbars displayed nicely, and even now bugs show up. You have to
>> request redraw on widgets and flush the Gdk event queue manually at
>> appropriate places.
>
> Do you have any example pointers in the Emacs source handy?
>
x_clear_frame and x_clear_frame_area in xterm.c, xg_update_scrollbar_pos in
gtkutil.c forces redraw.
Jan D.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-07-02 8:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-23 11:35 xwidget branch joakim
2010-06-30 11:55 ` Jan Djärv
2010-06-30 13:09 ` joakim
2010-07-01 15:52 ` Jan Djärv
2010-07-01 19:28 ` joakim
2010-07-02 8:40 ` Jan Djärv
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).