diff options
| author | Joakim Verona | 2011-07-22 08:14:13 +0200 |
|---|---|---|
| committer | Joakim Verona | 2011-07-22 08:14:13 +0200 |
| commit | de37acc4249c95bd02295f7c3a8c080297335a1d (patch) | |
| tree | 3f7760807b3521f20fe8692f44822f172175dc53 | |
| parent | c196618976ca42baca2e2de2167a8c5b9c28d75f (diff) | |
| download | emacs-de37acc4249c95bd02295f7c3a8c080297335a1d.tar.gz emacs-de37acc4249c95bd02295f7c3a8c080297335a1d.zip | |
notes
| -rw-r--r-- | README.xwidget | 134 |
1 files changed, 98 insertions, 36 deletions
diff --git a/README.xwidget b/README.xwidget index 4cb0f704195..296be30bb6d 100644 --- a/README.xwidget +++ b/README.xwidget | |||
| @@ -7,10 +7,10 @@ for eXternal widget, and also in reference to the Xembed protocoll. | |||
| 7 | There is a demo file called xwidget-test.el which shows some of the | 7 | There is a demo file called xwidget-test.el which shows some of the |
| 8 | possibilities. There are some screnshots at the emacswiki. | 8 | possibilities. There are some screnshots at the emacswiki. |
| 9 | 9 | ||
| 10 | Currently its possible to insert buttons, sliders, and xembed widgets | 10 | Currently its possible to insert buttons, sliders, xembed widgets, and |
| 11 | in the buffer. It works similar to the support for images in Emacs. | 11 | webkit in the buffer. It works similar to the support for images in |
| 12 | Adding more types of widgets should be fairly straightforward, but | 12 | Emacs. Adding more types of widgets should be fairly straightforward, |
| 13 | will require adapter code for each type. | 13 | but will require adapter code for each type. |
| 14 | 14 | ||
| 15 | A difference from images is that xwidgets live their own life. You | 15 | A difference from images is that xwidgets live their own life. You |
| 16 | create them with an api, get a reference, and tie them to a particular | 16 | create them with an api, get a reference, and tie them to a particular |
| @@ -21,42 +21,48 @@ model, and an xwidget-view is a view of the xwidget in a particular | |||
| 21 | Emacs window. | 21 | Emacs window. |
| 22 | 22 | ||
| 23 | The xwidget code attempts to keep the visual appearance of the views | 23 | The xwidget code attempts to keep the visual appearance of the views |
| 24 | in sync with through an Observer pattern implementation. | 24 | in sync with through an Observer pattern implementation. This is |
| 25 | necessary to support the Emacs window paradigm. | ||
| 25 | 26 | ||
| 26 | ** building | 27 | ** building |
| 27 | bzr co bzr+ssh://bzr.savannah.gnu.org/emacs/xwidget/ | 28 | bzr co bzr+ssh://bzr.savannah.gnu.org/emacs/xwidget/ |
| 28 | export CFLAGS=" -g -DGLYPH_DEBUG=1" | 29 | export CFLAGS=" -g -DGLYPH_DEBUG=1" |
| 29 | #export CFLAGS="-g" | ||
| 30 | ./configure --with-x-toolkit=gtk3 --with-xwidgets | 30 | ./configure --with-x-toolkit=gtk3 --with-xwidgets |
| 31 | make -j4 | 31 | make -j4 |
| 32 | 32 | ||
| 33 | ** MVC and Xembedd | 33 | ** try it out |
| 34 | The MVC approach appears to be at least in principle robust for plain gtk | 34 | If you have GTK3 and gtk-webkit installed, you should be able to |
| 35 | widgets. For the interesting case of gtk sockets which implements an | 35 | started the embedded webkit browser now: |
| 36 | xembed host widget that allows for embedding other applications inside | ||
| 37 | an Emacs window, the story gets more complex. | ||
| 38 | 36 | ||
| 39 | The problem is that xembed is designed to plug an application window | 37 | M-X xwidget-webkit-browse-url |
| 40 | inside a a secket and thats it. You can't move a plug between | ||
| 41 | sockets. I tried numerous hacks to get around this but there is | ||
| 42 | nothing that works realy well. | ||
| 43 | 38 | ||
| 44 | Therefore the Emacs part of the code will only expose well-defined | 39 | If that didnt work out try the minimal demonstration instead: |
| 45 | interfaces. cooperating applications will be able to use the interface | ||
| 46 | in a well defined manner. The problem is that there is no known xembeddable | ||
| 47 | application that implement the needed type of functionality, which is | ||
| 48 | allowing for creating new windows on the fly that plug into new | ||
| 49 | sockets. | ||
| 50 | 40 | ||
| 51 | Therefore I will attempt to provide an external application that wraps | 41 | (load-library "xwidget-test") |
| 52 | another application and through hacks attempts to provide the needed | 42 | (xwidget-demo-a-button) |
| 53 | multi view xembed function. That way Emacs is sane and the insanity | ||
| 54 | contained. | ||
| 55 | 43 | ||
| 56 | This app will work by providing a socket that an app plugs into. The | 44 | It looks unimpressive, but it's a gtk button inside an Emars buffer! |
| 57 | socket window is copied efficientlp by means of composition to a | 45 | |
| 58 | number of other windows, that then are plugged into the different | 46 | ** Stability |
| 59 | Emacs sockets. | 47 | Beginning with Summer 2011 I am now able to use Xwidget Emacs as my |
| 48 | primary Emacs. That is good for the project and the stability of the | ||
| 49 | code. | ||
| 50 | |||
| 51 | At the time of writing I have 24 hour Emacs uptime with several | ||
| 52 | embedded webkit browsers, Gnus, org-mode, tramp, etc. etc. | ||
| 53 | |||
| 54 | That said, there are still many improvements that needs to be done, | ||
| 55 | particularily in memory management. Expect xwidget emacs to leak | ||
| 56 | heavily for now. | ||
| 57 | |||
| 58 | ** timeline for inclusion in trunk | ||
| 59 | The Emacs 24 feature freeze is passed, so xwidgets won't probably be merged | ||
| 60 | until Emacs 25. OTOH since I now use xwidget emacs as my primary | ||
| 61 | emacs, I will merge from trunk much more often than in the past. | ||
| 62 | |||
| 63 | ** Thanks | ||
| 64 | emacs-devel@gnu.org. There are very helpful people there. When I | ||
| 65 | started the xwidget project I had no clue about the Emacs internals. | ||
| 60 | 66 | ||
| 61 | * Brief overview of how xwidgets work | 67 | * Brief overview of how xwidgets work |
| 62 | Xwidgets work in one way like images in Emacs. You bind a display spec very | 68 | Xwidgets work in one way like images in Emacs. You bind a display spec very |
| @@ -139,6 +145,33 @@ this is aproach worked so-so. | |||
| 139 | ;; cd /path/to/xwidgets-emacs-dir | 145 | ;; cd /path/to/xwidgets-emacs-dir |
| 140 | ;; make all&& src/emacs -q --eval "(progn (load \"`pwd`/lisp/xwidget-test.el\") (xwidget-demo-basic))" | 146 | ;; make all&& src/emacs -q --eval "(progn (load \"`pwd`/lisp/xwidget-test.el\") (xwidget-demo-basic))" |
| 141 | 147 | ||
| 148 | ** MVC and Xembedd | ||
| 149 | The MVC approach appears to be at least in principle robust for plain gtk | ||
| 150 | widgets. For the interesting case of gtk sockets which implements an | ||
| 151 | xembed host widget that allows for embedding other applications inside | ||
| 152 | an Emacs window, the story gets more complex. | ||
| 153 | |||
| 154 | The problem is that xembed is designed to plug an application window | ||
| 155 | inside a a secket and thats it. You can't move a plug between | ||
| 156 | sockets. I tried numerous hacks to get around this but there is | ||
| 157 | nothing that works realy well. | ||
| 158 | |||
| 159 | Therefore the Emacs part of the code will only expose well-defined | ||
| 160 | interfaces. cooperating applications will be able to use the interface | ||
| 161 | in a well defined manner. The problem is that there is no known xembeddable | ||
| 162 | application that implement the needed type of functionality, which is | ||
| 163 | allowing for creating new windows on the fly that plug into new | ||
| 164 | sockets. | ||
| 165 | |||
| 166 | Therefore I will attempt to provide an external application that wraps | ||
| 167 | another application and through hacks attempts to provide the needed | ||
| 168 | multi view xembed function. That way Emacs is sane and the insanity | ||
| 169 | contained. | ||
| 170 | |||
| 171 | This app will work by providing a socket that an app plugs into. The | ||
| 172 | socket window is copied efficientlp by means of composition to a | ||
| 173 | number of other windows, that then are plugged into the different | ||
| 174 | Emacs sockets. | ||
| 142 | * ToDo:s | 175 | * ToDo:s |
| 143 | ** DONE webkit flashkiller by default | 176 | ** DONE webkit flashkiller by default |
| 144 | CLOSED: [2011-07-19 Tue 14:27] | 177 | CLOSED: [2011-07-19 Tue 14:27] |
| @@ -407,7 +440,7 @@ Surprisingly, this just worked! | |||
| 407 | I used gtk signals, the implementation for sliders works well! | 440 | I used gtk signals, the implementation for sliders works well! |
| 408 | 441 | ||
| 409 | ** TODO canvas support | 442 | ** TODO canvas support |
| 410 | heresy an interesting comparision of gtk canvases | 443 | heres an interesting comparision of gtk canvases |
| 411 | http://live.gnome.org/ProjectRidley/CanvasOverview | 444 | http://live.gnome.org/ProjectRidley/CanvasOverview |
| 412 | *** goocanvas | 445 | *** goocanvas |
| 413 | goocanvas is a gtk canvas implemented using cairo. investigate. | 446 | goocanvas is a gtk canvas implemented using cairo. investigate. |
| @@ -490,7 +523,8 @@ so turned out this got solved by using proper lisp objects for | |||
| 490 | xwidgets. yay! | 523 | xwidgets. yay! |
| 491 | 524 | ||
| 492 | 525 | ||
| 493 | ** TODO browser xwidget | 526 | ** DONE browser xwidget |
| 527 | CLOSED: [2011-07-20 Wed 20:05] | ||
| 494 | although embedding a browser is not my primary concern many are | 528 | although embedding a browser is not my primary concern many are |
| 495 | interested in this. some suitable browser component needs to be found | 529 | interested in this. some suitable browser component needs to be found |
| 496 | supporting gtk. | 530 | supporting gtk. |
| @@ -586,7 +620,8 @@ offscreen rendering issues makes it interesting to see what ff brings | |||
| 586 | to the table. turns out webkit has as good offscreen support as anyone. | 620 | to the table. turns out webkit has as good offscreen support as anyone. |
| 587 | 621 | ||
| 588 | 622 | ||
| 589 | *** TODO text field support | 623 | *** DONE text field support |
| 624 | CLOSED: [2011-07-20 Wed 20:05] | ||
| 590 | Emacs captures all keyboard events so text field support isn't super | 625 | Emacs captures all keyboard events so text field support isn't super |
| 591 | straightforward. | 626 | straightforward. |
| 592 | 627 | ||
| @@ -777,11 +812,13 @@ allocation hack and set_has_window it works. Idea prefer not to have | |||
| 777 | the allocatien hack and it wasnt needed it gtk3 only gtk2. needs | 812 | the allocatien hack and it wasnt needed it gtk3 only gtk2. needs |
| 778 | furthi investigation, | 813 | furthi investigation, |
| 779 | 814 | ||
| 780 | ** TODO various code cleanups | 815 | ** DONE various code cleanups |
| 816 | CLOSED: [2011-07-20 Wed 20:05] | ||
| 781 | There are many cleanups necessary before any hope of inclusion in | 817 | There are many cleanups necessary before any hope of inclusion in |
| 782 | Emacs trunk. To begin with, the part of the patch that touches other | 818 | Emacs trunk. To begin with, the part of the patch that touches other |
| 783 | parts of emacs must be very clean. | 819 | parts of emacs must be very clean. |
| 784 | *** TODO use FRAME_GTK_WIDGET (f) | 820 | *** DONE use FRAME_GTK_WIDGET (f) |
| 821 | CLOSED: [2011-07-20 Wed 20:02] | ||
| 785 | rather than gwfixed. | 822 | rather than gwfixed. |
| 786 | 823 | ||
| 787 | *** DONE support configure | 824 | *** DONE support configure |
| @@ -816,9 +853,34 @@ this seems to work | |||
| 816 | 853 | ||
| 817 | 854 | ||
| 818 | ** TODO support webkit signals | 855 | ** TODO support webkit signals |
| 819 | particularily document-load-finished | 856 | *** TODO particularily document-load-finished |
| 820 | http://webkitgtk.org/reference/webkitgtk-webkitwebview.html#WebKitWebView-document-load-finished | 857 | http://webkitgtk.org/reference/webkitgtk-webkitwebview.html#WebKitWebView-document-load-finished |
| 821 | ** notes from x_draw_xwidget_glyph_string | 858 | *** TODO console messages |
| 859 | http://webkitgtk.org/reference/webkitgtk-webkitwebview.html#WebKitWebView-console-message | ||
| 860 | http://getfirebug.com/wiki/index.php/Console_API#console.count.28.5Btitle.5D.29 | ||
| 861 | because maybe we can make a simple JS REPL that way. | ||
| 862 | (xwidget-webkit-execute-script ( xwidget-webkit-last-session) | ||
| 863 | "console.log('hello')") | ||
| 864 | prints hello to stdout but theres no way to catch stdout from webkit I | ||
| 865 | think other than receiving the signal. | ||
| 866 | |||
| 867 | |||
| 868 | |||
| 869 | ** TODO webkit downloads | ||
| 870 | when clicking a download link in Webkit Emacs should take over and handle it | ||
| 871 | from there. Probably need signals. | ||
| 872 | |||
| 873 | ** TODO webkit alt-text not handled | ||
| 874 | XKCD use image-title to display a cartoon comment. These mysteriously | ||
| 875 | don't work ATM. Other mouseovers work though. Maybe webkit tries to | ||
| 876 | open a new window or something, which wont work. | ||
| 877 | |||
| 878 | ** TODO isearch in webkit buffers | ||
| 879 | have a look at how docview solves it | ||
| 880 | webkit_web_view_search_text () | ||
| 881 | ** TODO webkit relative references doesn't work | ||
| 882 | probably because we handle scrolling in a non-standard way | ||
| 883 | * old notes from x_draw_xwidget_glyph_string | ||
| 822 | 884 | ||
| 823 | BUG it seems this method for some reason is called with bad s->x and s->y sometimes. | 885 | BUG it seems this method for some reason is called with bad s->x and s->y sometimes. |
| 824 | When this happens the xwidget doesnt move on screen as it should. | 886 | When this happens the xwidget doesnt move on screen as it should. |