diff options
| author | Joakim Verona | 2011-07-10 23:47:48 +0200 |
|---|---|---|
| committer | Joakim Verona | 2011-07-10 23:47:48 +0200 |
| commit | e098c552ccd4be2c05898bb69df97ce35efa90b7 (patch) | |
| tree | 11758196be04a6ec414100fd73419ffb582bde60 /README.xwidget | |
| parent | d812bba65d7f22a624c8cc19e9ec21ffe3720228 (diff) | |
| download | emacs-e098c552ccd4be2c05898bb69df97ce35efa90b7.tar.gz emacs-e098c552ccd4be2c05898bb69df97ce35efa90b7.zip | |
minor cleanups and doc
Diffstat (limited to 'README.xwidget')
| -rw-r--r-- | README.xwidget | 115 |
1 files changed, 102 insertions, 13 deletions
diff --git a/README.xwidget b/README.xwidget index 8c4998cc960..068ffa01bed 100644 --- a/README.xwidget +++ b/README.xwidget | |||
| @@ -198,13 +198,62 @@ stuff that needs to work: | |||
| 198 | - lookup xw-view for xwidget in emacs window(during redisplay) | 198 | - lookup xw-view for xwidget in emacs window(during redisplay) |
| 199 | (- do something for all siblings of a xw-view. not atm) | 199 | (- do something for all siblings of a xw-view. not atm) |
| 200 | 200 | ||
| 201 | *** TODO xwidget creation interface | ||
| 202 | xwidgets are a little bit like emacs processes but also a little bit | ||
| 203 | like emacs images. Therefore its not perfectly obvious how to handle | ||
| 204 | creation. Currently I just use hardcoded identifiers. the real scheme | ||
| 205 | needs to be something else. | ||
| 206 | |||
| 207 | Heres a tentative approach: | ||
| 208 | - xwidget-create returns a xwidget object, like process creation | ||
| 209 | functions. the xwidget will be largely uninitialized until | ||
| 210 | discovered by redisplay. an xw belongs to a buffer | ||
| 211 | - xwidget-insert inserts the xwidget in a buffer. when discovered by | ||
| 212 | redisplay it will be initialized and a xwidget-view allocated | ||
| 213 | - an event will be emitted when initialization is finished when | ||
| 214 | relevant like for sockets | ||
| 215 | |||
| 216 | the problem with this aproach is that its not really legal to reuse | ||
| 217 | xwidget objects by writing several display specs who reference the | ||
| 218 | same xwidget. It could presumably be done but it would just become | ||
| 219 | weird for no real benefit. the big preblem is that the display spec | ||
| 220 | decides the on-screen size, and its not sane to have xwidget views | ||
| 221 | with different sizes. therefore such display specs would need to be | ||
| 222 | catched and dissallowed. Except it is hard because AFAIK the specs | ||
| 223 | don't have an identity as such. A flag in the structure could be set | ||
| 224 | by lookup so the first display attempt would win. but then you can't | ||
| 225 | rewrite the spec to change the size. hmmm. A third approach would be | ||
| 226 | to just allow the 1st spec refering an xw during a redisplay to take | ||
| 227 | effect, the rest are signaled as errors. this wouldnt be too bad. | ||
| 228 | |||
| 229 | the other aproach would be to work more like images: | ||
| 230 | |||
| 231 | - write the display spec with all information needed to create the | ||
| 232 | xwidget. | ||
| 233 | - retrieve the xwidget objet from the spec with an xwidget-at-point function. It | ||
| 234 | can be uninitalized which client code must handle. Unlike | ||
| 235 | assynchronous process creation we dont get back a handle, because | ||
| 236 | there is none yet. | ||
| 237 | - emitted event on initialization, when needed. Many widgets don't | ||
| 238 | need this. for instance, a button sends an event when pressed. but | ||
| 239 | you can't press it unless its on screen, and then its initialized | ||
| 240 | properly. | ||
| 241 | |||
| 242 | This approach seemed good, but how do I know which instance | ||
| 243 | generates an event if I cant set the id beforehand? | ||
| 244 | |||
| 245 | so, therefore, the first two aproach is used. | ||
| 246 | |||
| 247 | |||
| 248 | |||
| 201 | ** TODO more documentation | 249 | ** TODO more documentation |
| 202 | There should be user docs, and xwidget contributor docs. The current README | 250 | There should be user docs, and xwidget contributor docs. The current README |
| 203 | is all contributor docs there is now, apart from the code. | 251 | is all contributor docs there is now, apart from the code. |
| 204 | 252 | ||
| 205 | 253 | ||
| 206 | 254 | ||
| 207 | ** TODO look into more ways of displaying xwidgets, like binding them to a | 255 | ** CANCELLED look into more ways of displaying xwidgets, like binding them to a |
| 256 | CLOSED: [2011-07-05 Tue 11:34] | ||
| 208 | window rather than a point in a buffer. This was suggested by Chidong. | 257 | window rather than a point in a buffer. This was suggested by Chidong. |
| 209 | This would be a useful addition to Emacs in itself, and would avoid nearly all | 258 | This would be a useful addition to Emacs in itself, and would avoid nearly all |
| 210 | display issues. I still think the general case is more interesting, but this | 259 | display issues. I still think the general case is more interesting, but this |
| @@ -212,6 +261,9 @@ special case should also be added. The xwidget would then be bound to | |||
| 212 | replace the view of a particular window, and it would only show in | 261 | replace the view of a particular window, and it would only show in |
| 213 | that window. | 262 | that window. |
| 214 | 263 | ||
| 264 | I got the webkit xwidget to work well enough so I dont see the need | ||
| 265 | for this now, except for sockets and I think it can better be dealt | ||
| 266 | with at the lisp level. | ||
| 215 | 267 | ||
| 216 | ** DONE MVC mode for xwidgets | 268 | ** DONE MVC mode for xwidgets |
| 217 | CLOSED: [2011-06-27 Mon 12:53] | 269 | CLOSED: [2011-06-27 Mon 12:53] |
| @@ -298,10 +350,9 @@ make | |||
| 298 | 350 | ||
| 299 | 351 | ||
| 300 | ** TODO mvc code crashes after a while | 352 | ** TODO mvc code crashes after a while |
| 301 | seemingly only when compiling with optimizations | 353 | seemingly only when compiling with optimizations. |
| 354 | I have no idea why. | ||
| 302 | 355 | ||
| 303 | ** TODO delete xwidgets belonging to an emacs window | ||
| 304 | when it closes | ||
| 305 | ** TODO xwidget-resize-at | 356 | ** TODO xwidget-resize-at |
| 306 | currently it rewrites the display spec. then it resizes the xwidget | 357 | currently it rewrites the display spec. then it resizes the xwidget |
| 307 | views. maybe rewriting the spec should be sufficient, and changes to | 358 | views. maybe rewriting the spec should be sufficient, and changes to |
| @@ -349,7 +400,7 @@ webkitViewportAttributesRecompute is the offender. | |||
| 349 | 400 | ||
| 350 | maybe try gtk3 variants? | 401 | maybe try gtk3 variants? |
| 351 | 402 | ||
| 352 | export CFLAGS="`pkg-config --cflags webkitgtk-3.0 ` -DHAVE_WEBKIT_OSR -g" | 403 | export CFLAGS="`pkg-config --cflags webkitgtk-3.0 ` -DHAVE_WEBKIT_OSR " |
| 353 | export LDFLAGS=`pkg-config --libs webkitgtk-3.0 ` | 404 | export LDFLAGS=`pkg-config --libs webkitgtk-3.0 ` |
| 354 | ./configure --with-x-toolkit=gtk3 | 405 | ./configure --with-x-toolkit=gtk3 |
| 355 | make | 406 | make |
| @@ -420,6 +471,8 @@ interesting than just forwarding keyboard events. | |||
| 420 | 471 | ||
| 421 | webkit_web_view_get_dom_document () | 472 | webkit_web_view_get_dom_document () |
| 422 | 473 | ||
| 474 | this is hard it seems. an idea might be to hack elisp support for swig | ||
| 475 | to machine generate the bindings. | ||
| 423 | **** DONE inject javascript | 476 | **** DONE inject javascript |
| 424 | CLOSED: [2011-07-03 Sun 22:50] | 477 | CLOSED: [2011-07-03 Sun 22:50] |
| 425 | webkit_web_view_execute_script () | 478 | webkit_web_view_execute_script () |
| @@ -448,12 +501,32 @@ or this funny hack: | |||
| 448 | <jave> lucian: that was a pretty cool idea! | 501 | <jave> lucian: that was a pretty cool idea! |
| 449 | 502 | ||
| 450 | 503 | ||
| 451 | **** webkit_web_view_load_string () | 504 | *** webkit_web_view_load_string () |
| 452 | I would like preview of html in a buffer rather than from uri. | 505 | I would like preview of html in a buffer rather than from uri. |
| 453 | 506 | ||
| 454 | 507 | ||
| 455 | 508 | ||
| 456 | ** TODO clipping of controllers | 509 | *** TODO simple xwidget-webkit wrapper |
| 510 | so that it could be used for actual browsing :) | ||
| 511 | I dont want to reinvent too many wheels so i'd like to use existing | ||
| 512 | emacs facilities here possible. use bindings similar to w3m(or info) | ||
| 513 | |||
| 514 | - m-x xwidget-webkit starts a session | ||
| 515 | - 'g' goes to a url | ||
| 516 | - use bookmark-jump i suppose. I mostly use org for bookmarks myself | ||
| 517 | - browse-url support so webkit can be the default browser | ||
| 518 | - some way of getting around the quirky keyboard interaction since | ||
| 519 | xwidgets dont receive keyboard events because I hawe no idea how to | ||
| 520 | do that in a sane way | ||
| 521 | |||
| 522 | ... and one can of course go on bikeshedding forever. lets keep it | ||
| 523 | simple and extensible, and compatible with other Emacs packages. | ||
| 524 | |||
| 525 | the really cool ideas would need Emacs DOM integration, which is not | ||
| 526 | easy. | ||
| 527 | |||
| 528 | ** DONE clipping of controllers | ||
| 529 | CLOSED: [2011-07-05 Tue 11:33] | ||
| 457 | 530 | ||
| 458 | Emacs uses a big GTK window and does its own clipping against Emacs | 531 | Emacs uses a big GTK window and does its own clipping against Emacs |
| 459 | windows inside this area. So, in order to layout gtk widgets in emacs | 532 | windows inside this area. So, in order to layout gtk widgets in emacs |
| @@ -478,6 +551,7 @@ either. | |||
| 478 | 551 | ||
| 479 | http://www.lanedo.com/~carlos/gtk3-doc/chap-drawing-model.html | 552 | http://www.lanedo.com/~carlos/gtk3-doc/chap-drawing-model.html |
| 480 | 553 | ||
| 554 | anyway clipping is rather complicated but seems to finally work okay. | ||
| 481 | 555 | ||
| 482 | *** DONE subclass my own clipping widget | 556 | *** DONE subclass my own clipping widget |
| 483 | CLOSED: [2011-07-04 Mon 16:55] | 557 | CLOSED: [2011-07-04 Mon 16:55] |
| @@ -555,7 +629,8 @@ the needed data is private to the base class. to overcome this: | |||
| 555 | JanD pointed out the GTK3 port already has its own subclass, so I | 629 | JanD pointed out the GTK3 port already has its own subclass, so I |
| 556 | modified that one. | 630 | modified that one. |
| 557 | 631 | ||
| 558 | *** TODO clip top | 632 | *** DONE clip top |
| 633 | CLOSED: [2011-07-05 Tue 11:30] | ||
| 559 | there are four controller edges that potentialy need clipping. I begun | 634 | there are four controller edges that potentialy need clipping. I begun |
| 560 | with right and bottom edges. clipping them is just a matter of setting | 635 | with right and bottom edges. clipping them is just a matter of setting |
| 561 | the right size of the widgetwindow and also ensure it gets the right | 636 | the right size of the widgetwindow and also ensure it gets the right |
| @@ -569,9 +644,20 @@ makes it harder to use the allocation workarounds. | |||
| 569 | see: | 644 | see: |
| 570 | - gtk_widget_set_size_request | 645 | - gtk_widget_set_size_request |
| 571 | - gtkscrolledwindow | 646 | - gtkscrolledwindow |
| 572 | ** TODO use FRAME_GTK_WIDGET (f) | ||
| 573 | rather than gwfixed | ||
| 574 | 647 | ||
| 648 | I returned to using a simple gtkfixed for the widgetwindow. with | ||
| 649 | allocation hack and set_has_window it works. Idea prefer not to have | ||
| 650 | the allocatien hack and it wasnt needed it gtk3 only gtk2. needs | ||
| 651 | furthi investigation, | ||
| 652 | |||
| 653 | ** TODO various code cleanups | ||
| 654 | There are many cleanups necessary before any hope of inclusion in | ||
| 655 | Emacs trunk. To begin with, the part of the patch that touches other | ||
| 656 | parts of emacs must be very clean. | ||
| 657 | *** TODO use FRAME_GTK_WIDGET (f) | ||
| 658 | rather than gwfixed. | ||
| 659 | |||
| 660 | *** TODO support configure | ||
| 575 | ** DONE translate clicks | 661 | ** DONE translate clicks |
| 576 | CLOSED: [2011-07-03 Sun 22:12] | 662 | CLOSED: [2011-07-03 Sun 22:12] |
| 577 | on onscreen webkit peer to offscreen | 663 | on onscreen webkit peer to offscreen |
| @@ -584,18 +670,21 @@ forwarded them offscreen! | |||
| 584 | 670 | ||
| 585 | ** TODO investigate gdk_window_redirect_to_drawable | 671 | ** TODO investigate gdk_window_redirect_to_drawable |
| 586 | http://developer.gnome.org/gdk/stable/gdk-Windows.html#gdk-offscreen-window-set-embedder | 672 | http://developer.gnome.org/gdk/stable/gdk-Windows.html#gdk-offscreen-window-set-embedder |
| 587 | maybe control be used in place of my own copy hacks? | 673 | maybe control be used in place of my own copy hacks? to work it must |
| 674 | support a chain of redirects, which seems unlikely. the benefit would | ||
| 675 | be that I dont have to spend time optimizing redrawing. | ||
| 588 | 676 | ||
| 589 | 677 | ||
| 590 | 678 | ||
| 591 | ** TODO remove xwidget_views when emacs window is deleted | 679 | ** DONE remove xwidget_views when emacs window is deleted |
| 680 | CLOSED: [2011-07-05 Tue 11:29] | ||
| 592 | removing xwidget views when an Emacs window closes is not reliable. | 681 | removing xwidget views when an Emacs window closes is not reliable. |
| 593 | 682 | ||
| 594 | - switching buffers in a window seems to hide the corresponding | 683 | - switching buffers in a window seems to hide the corresponding |
| 595 | xwidget-views properly, but they might as well be deleted. | 684 | xwidget-views properly, but they might as well be deleted. |
| 596 | 685 | ||
| 597 | - patching delete-window-internal could be used to delete the xwidget-views | 686 | - patching delete-window-internal could be used to delete the xwidget-views |
| 598 | 687 | this seems to work | |
| 599 | 688 | ||
| 600 | 689 | ||
| 601 | ** notes from x_draw_xwidget_glyph_string | 690 | ** notes from x_draw_xwidget_glyph_string |