diff options
| -rw-r--r-- | README.xwidget | 88 |
1 files changed, 73 insertions, 15 deletions
diff --git a/README.xwidget b/README.xwidget index 0a9e1a221fb..050cb381047 100644 --- a/README.xwidget +++ b/README.xwidget | |||
| @@ -19,30 +19,88 @@ where a plain image can be shown in several windows. The xwidget code | |||
| 19 | tries to handle this by essentialy making a screen capture of the | 19 | tries to handle this by essentialy making a screen capture of the |
| 20 | widget and displaying those in the non-active windows, and the real | 20 | widget and displaying those in the non-active windows, and the real |
| 21 | widget in the active window. This doesnt currently work for xembed | 21 | widget in the active window. This doesnt currently work for xembed |
| 22 | widgets. | 22 | gtk_socket widgets. |
| 23 | 23 | ||
| 24 | The current state is that one window, one frame, showing many xwidgets | 24 | The current state is that one window, one frame, showing many xwidgets |
| 25 | is a nice demo. | 25 | is a nice demo. One frame, many windows, will have lots of display |
| 26 | glitches. Many frames, many windows, will probably work even worse. | ||
| 26 | 27 | ||
| 28 | * Brief overview of how xwidgets work | ||
| 29 | Xwidgets work in one way like images in Emacs. You bind a display spec very | ||
| 30 | similar to an image display spec to buffer contents. The display engine will | ||
| 31 | notice the display spec and try to display the xwidget there. The display engine | ||
| 32 | prepares space at the right place for the xwidget and so on for free, as long as | ||
| 33 | we provide proper sizes and so on. | ||
| 27 | 34 | ||
| 28 | TODO | 35 | The problem is that Emacs cant actually draw the widgets, as it can with |
| 36 | images. Emacs must notify GTK about where the widgets should be, and how they | ||
| 37 | should be clipped and so on, and this information must be given to GTK | ||
| 38 | synchonous with Emacs display changes. Ok, so why is that difficult then? | ||
| 29 | 39 | ||
| 30 | - Examine using XComposite rather than GTK off-screen rendering. This | 40 | - How do we know when a widget is NOT to be drawn? The only way I found so far |
| 31 | would make xembed widgets work much better. | 41 | is having a flag for each xwdiget, that is reset before a redisplay. When an |
| 42 | xwidget is encountered during display, the flag is set. After redisplay, | ||
| 43 | iterate all xwidgets and hide those which hasnt been displayed. | ||
| 32 | 44 | ||
| 33 | - make the keyboard event code propagation code work. | 45 | - In the general case, there can only be one xwidget, and several views of |
| 46 | it. There is one real view, and several shadow views. The real view is defined | ||
| 47 | to be in the currently selected window. All other views are shadow views. | ||
| 34 | 48 | ||
| 35 | - remove the special-case for when the minibuffer is | 49 | Even this simple rule is difficult to implement in practice because Emacs |
| 36 | active. Special-casing will never work properly. | 50 | display is clever and optimized. It is often difficult to know that a xwdiget |
| 51 | hasnt actually been displayed after a redisplay. | ||
| 37 | 52 | ||
| 38 | - disable emacs cursor drawing on top of an active xwidget | 53 | - shadow views of xwidgets are thankfully not so hard because gtk supports |
| 54 | offscreen rendering of many widget types. Except it doesnt for the gtk socket | ||
| 55 | type, which happens to be very desirable. This might be solvable with | ||
| 56 | xcomposite, but is difficult. | ||
| 39 | 57 | ||
| 40 | - figure out what to do with the multiple frames case | 58 | - The gtk socket type for embedding external applications is desirable but |
| 59 | presents a lot of difficulties of its own. Offscreen rendering has been | ||
| 60 | mentioned already. Another difficulty is deciding which input events to | ||
| 61 | forward, and when and how to do it. | ||
| 41 | 62 | ||
| 42 | - improve the xwidgets programming interface so its less of | 63 | - The case of showing an xwidget in several frames is not solved at all |
| 43 | hand-waving affair | 64 | currently. This would mean moving the real xwidget between frames when the |
| 65 | selected window moves. The gtk widget will need to be reparented between | ||
| 66 | windows, which seem fragile. | ||
| 44 | 67 | ||
| 45 | - more documentation | 68 | * ToDo:s |
| 69 | |||
| 70 | ** TODO Examine using XComposite rather than GTK off-screen rendering. This | ||
| 71 | would make xembed widgets work much better. This would probably be | ||
| 72 | rathter difficult, but could open up other interesting possibilities | ||
| 73 | for Emacs. | ||
| 74 | |||
| 75 | ** TODO make the keyboard event code propagation code work. There is an attempt | ||
| 76 | to provide an api to send keyboard events to an xwidget, but it doesnt currently | ||
| 77 | work very well. | ||
| 78 | |||
| 79 | ** TODO remove the special-case for when the minibuffer is | ||
| 80 | active. I added some code to reduce the annoying problem display artefacts | ||
| 81 | when making the minibuffer the selected window. This made xwidgets in the | ||
| 82 | buffer go grey or black whenever one did m-x to activate the minibuffer. The | ||
| 83 | coded tried to handle the minibuffer as a special case. That simply wasnt a | ||
| 84 | good idea. Special-casing will never work properly. It is much better to spend | ||
| 85 | time finding solutions that work acceptably in the general case. | ||
| 86 | |||
| 87 | ** TODO disable emacs cursor drawing on top of an active xwidget. | ||
| 88 | This ought to be rather simple and should improve the visuals a lot. | ||
| 89 | |||
| 90 | ** TODO figure out what to do with the multiple frames case. | ||
| 91 | I havent spent any time at all on this. | ||
| 92 | |||
| 93 | ** TODO improve the xwidgets programming interface so its less of | ||
| 94 | hand-waving affair. This shouldnt be too hard, but I have deliberatley not | ||
| 95 | spent any time on it, since getting the visuals right is much harder. | ||
| 96 | |||
| 97 | ** TODO more documentation | ||
| 98 | There should be user docs, and xwidget contributor docs. The current README | ||
| 99 | is all contributor docs there is now, apart from the code. | ||
| 100 | |||
| 101 | ** TODO look into more ways of displaying xwidgets, like binding them to a | ||
| 102 | window rather than a point in a buffer. This was suggested by Chidong. | ||
| 103 | This would be a useful addition to Emacs in itself, and would avoid nearly all | ||
| 104 | display issues. I still think the general case is more interesting, but this | ||
| 105 | special case should also be added. | ||
| 46 | 106 | ||
| 47 | - look into more ways of displaying xwidgets, like binding them to a | ||
| 48 | window rather than a point in a buffer. | ||