diff options
| author | Joakim Verona | 2011-07-12 23:06:27 +0200 |
|---|---|---|
| committer | Joakim Verona | 2011-07-12 23:06:27 +0200 |
| commit | 42f051946e70bb5e6ad407b85d003040d9ba5006 (patch) | |
| tree | 6ee7f041da3d9348bd357d77c854706366371366 | |
| parent | 347166ea436327f6ded4550ed004d43f6042f6b4 (diff) | |
| download | emacs-42f051946e70bb5e6ad407b85d003040d9ba5006.tar.gz emacs-42f051946e70bb5e6ad407b85d003040d9ba5006.zip | |
cleanups. tentative webkit lisp interface, but i got annoyed now with the primitives.
| -rw-r--r-- | README.xwidget | 45 | ||||
| -rw-r--r-- | lisp/xwidget.el | 45 | ||||
| -rw-r--r-- | src/xwidget.c | 3 |
3 files changed, 71 insertions, 22 deletions
diff --git a/README.xwidget b/README.xwidget index 068ffa01bed..a47f57a4d04 100644 --- a/README.xwidget +++ b/README.xwidget | |||
| @@ -144,9 +144,11 @@ this is aproach worked so-so. | |||
| 144 | the attempt was further worked on, and the xlib calls replaced with | 144 | the attempt was further worked on, and the xlib calls replaced with |
| 145 | gdk calls, this works better. | 145 | gdk calls, this works better. |
| 146 | 146 | ||
| 147 | ** TODO make the keyboard event code propagation code work. There is an attempt | 147 | ** TODO make the keyboard event code propagation code work. |
| 148 | to provide an api to send keyboard events to an xwidget, but it doesnt currently | 148 | There is an attempt to provide an api to send keyboard events to an |
| 149 | work very well. | 149 | xwidget, but it doesnt currently work very well. |
| 150 | |||
| 151 | try gtk event creation instead since that works fine in the webkit osr code. | ||
| 150 | 152 | ||
| 151 | ** DONE remove the special-case for when the minibuffer is | 153 | ** DONE remove the special-case for when the minibuffer is |
| 152 | active. I added some code to reduce the annoying problem display artefacts | 154 | active. I added some code to reduce the annoying problem display artefacts |
| @@ -159,19 +161,20 @@ work very well. | |||
| 159 | ** DONE disable emacs cursor drawing on top of an active xwidget. | 161 | ** DONE disable emacs cursor drawing on top of an active xwidget. |
| 160 | This ought to be rather simple and should improve the visuals a lot. | 162 | This ought to be rather simple and should improve the visuals a lot. |
| 161 | 163 | ||
| 162 | ** TODO improve the xwidgets programming interface so its less of | 164 | ** TODO improve the xwidgets programming interface |
| 163 | hand-waving affair. This shouldnt be too hard, but I have deliberatley not | 165 | so its less of hand-waving affair. This shouldnt be too hard, but I |
| 164 | spent any time on it, since getting the visuals right is much | 166 | have deliberatley not spent any time on it, since getting the |
| 165 | harder. Anyway, I sort of think the interface should be somewhat like | 167 | visuals right is much harder. Anyway, I sort of think the interface |
| 166 | it is, except symbols is used instead of integers. | 168 | should be somewhat like it is, except symbols is used instead of |
| 169 | integers. | ||
| 167 | *** DONE use symbols for xwidget types rather than ints | 170 | *** DONE use symbols for xwidget types rather than ints |
| 168 | CLOSED: [2011-06-27 Mon 12:52] | 171 | CLOSED: [2011-06-27 Mon 12:52] |
| 169 | 172 | ||
| 170 | 173 | ||
| 171 | *** TODO better lisp based structure for xwidgets | 174 | *** TODO better lisp based structure for xwidgets |
| 172 | the lisp interface woud be like this: | 175 | the lisp interface woud be like this: |
| 173 | - xwidget-create returns an xwidget object, similar to a process | 176 | - make-xwidget returns an xwidget object, similar to a process |
| 174 | object. this id is used when creating the display spec(instead of | 177 | object. this object is used when creating the display spec(instead of |
| 175 | the user defined id now used) | 178 | the user defined id now used) |
| 176 | 179 | ||
| 177 | the data structure would be something like this: | 180 | the data structure would be something like this: |
| @@ -245,6 +248,14 @@ generates an event if I cant set the id beforehand? | |||
| 245 | so, therefore, the first two aproach is used. | 248 | so, therefore, the first two aproach is used. |
| 246 | 249 | ||
| 247 | 250 | ||
| 251 | *** TODO xwidget creation interface actually | ||
| 252 | conclusion of above ramblings: | ||
| 253 | - should be similar to make-text-button | ||
| 254 | - don't init from display spec, instead during make-xwidget call | ||
| 255 | *** TODO callbacks would be nice | ||
| 256 | but they need to be handled initially with events for technical | ||
| 257 | reasons. C code can't call Lisp easily. The event handler can call the | ||
| 258 | callback though. | ||
| 248 | 259 | ||
| 249 | ** TODO more documentation | 260 | ** TODO more documentation |
| 250 | There should be user docs, and xwidget contributor docs. The current README | 261 | There should be user docs, and xwidget contributor docs. The current README |
| @@ -349,15 +360,14 @@ export LDFLAGS=`pkg-config --libs clutter-gtk-0.10` | |||
| 349 | make | 360 | make |
| 350 | 361 | ||
| 351 | 362 | ||
| 352 | ** TODO mvc code crashes after a while | 363 | ** DONE mvc code crashes after a while |
| 364 | CLOSED: [2011-07-12 Tue 18:52] | ||
| 353 | seemingly only when compiling with optimizations. | 365 | seemingly only when compiling with optimizations. |
| 354 | I have no idea why. | 366 | I have no idea why. |
| 355 | 367 | ||
| 368 | Doesn't seem to happen after some code cleanups. | ||
| 356 | ** TODO xwidget-resize-at | 369 | ** TODO xwidget-resize-at |
| 357 | currently it rewrites the display spec. then it resizes the xwidget | 370 | reimplement so display special is not involved |
| 358 | views. maybe rewriting the spec should be sufficient, and changes to | ||
| 359 | it be picked up during redisplay somehow. | ||
| 360 | |||
| 361 | ** TODO display spec validation | 371 | ** TODO display spec validation |
| 362 | it is an error to reuse xwidgets in several buffers or in the same | 372 | it is an error to reuse xwidgets in several buffers or in the same |
| 363 | buffer. how do we catch these errors? | 373 | buffer. how do we catch these errors? |
| @@ -657,7 +667,8 @@ parts of emacs must be very clean. | |||
| 657 | *** TODO use FRAME_GTK_WIDGET (f) | 667 | *** TODO use FRAME_GTK_WIDGET (f) |
| 658 | rather than gwfixed. | 668 | rather than gwfixed. |
| 659 | 669 | ||
| 660 | *** TODO support configure | 670 | *** DONE support configure |
| 671 | CLOSED: [2011-07-12 Tue 18:48] | ||
| 661 | ** DONE translate clicks | 672 | ** DONE translate clicks |
| 662 | CLOSED: [2011-07-03 Sun 22:12] | 673 | CLOSED: [2011-07-03 Sun 22:12] |
| 663 | on onscreen webkit peer to offscreen | 674 | on onscreen webkit peer to offscreen |
| @@ -665,7 +676,7 @@ on onscreen webkit peer to offscreen | |||
| 665 | maybe | 676 | maybe |
| 666 | http://developer.gnome.org/gdk/stable/gdk-Windows.html#GdkWindow-from-embedder | 677 | http://developer.gnome.org/gdk/stable/gdk-Windows.html#GdkWindow-from-embedder |
| 667 | 678 | ||
| 668 | turned out tell be not so hard, captured events, copied them and | 679 | turned out to be not so hard, captured events, copied them and |
| 669 | forwarded them offscreen! | 680 | forwarded them offscreen! |
| 670 | 681 | ||
| 671 | ** TODO investigate gdk_window_redirect_to_drawable | 682 | ** TODO investigate gdk_window_redirect_to_drawable |
diff --git a/lisp/xwidget.el b/lisp/xwidget.el index 71dcc15df69..6fbf10556bd 100644 --- a/lisp/xwidget.el +++ b/lisp/xwidget.el | |||
| @@ -3,15 +3,13 @@ | |||
| 3 | 3 | ||
| 4 | (require 'xwidget-internal) | 4 | (require 'xwidget-internal) |
| 5 | 5 | ||
| 6 | 6 | ;;TODO model after make-text-button instead! | |
| 7 | (defun xwidget-insert (pos type title width height &optional id) | 7 | (defun xwidget-insert (pos type title width height &optional id) |
| 8 | "Insert an xwidget at POS, given ID, TYPE, TITLE WIDTH and HEIGHT. | 8 | "Insert an xwidget at POS, given ID, TYPE, TITLE WIDTH and HEIGHT. |
| 9 | Return ID | 9 | Return ID |
| 10 | ID will be made optional, but it isnt implemented yet! | 10 | ID will be made optional, but it isnt implemented yet! |
| 11 | 11 | ||
| 12 | currently interface is lame: | 12 | see xwidget.c for types suitable for TYPE. |
| 13 | :type 1=button, 2=toggle btn, 3=xembed socket(id will be printed to stdout) | ||
| 14 | obviously these should be symbols | ||
| 15 | 13 | ||
| 16 | :xwidget-id 1, MUST be unique and < 100 ! | 14 | :xwidget-id 1, MUST be unique and < 100 ! |
| 17 | if slightly wrong, emacs WILL CRASH | 15 | if slightly wrong, emacs WILL CRASH |
| @@ -40,7 +38,7 @@ hand-wave issues like these until the hard parts are solved. | |||
| 40 | 38 | ||
| 41 | 39 | ||
| 42 | (defun xwidget-socket-handler () | 40 | (defun xwidget-socket-handler () |
| 43 | "creates plug for socket." | 41 | "creates plug for socket. TODO" |
| 44 | (interactive) | 42 | (interactive) |
| 45 | (message "socket handler xwidget %S" last-input-event) | 43 | (message "socket handler xwidget %S" last-input-event) |
| 46 | (let* | 44 | (let* |
| @@ -62,6 +60,43 @@ hand-wave issues like these until the hard parts are solved. | |||
| 62 | )))) | 60 | )))) |
| 63 | 61 | ||
| 64 | 62 | ||
| 63 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 64 | ;;; webkit support | ||
| 65 | |||
| 66 | ;;;###autoload | ||
| 67 | (defun xwidget-webkit-browse-url (url &optional new-session) | ||
| 68 | "Ask xwidget-webkit to browse URL. | ||
| 69 | NEW-SESSION specifies whether to create a new xwidget-webkit session. URL | ||
| 70 | defaults to the string looking like a url around the cursor position." | ||
| 71 | (interactive (progn | ||
| 72 | (require 'browse-url) | ||
| 73 | (browse-url-interactive-arg "xwidget-webkit URL: "))) | ||
| 74 | (when (stringp url) | ||
| 75 | (if new-session | ||
| 76 | (xwidget-webkit-new-session url) | ||
| 77 | (xwidget-webkit-goto-url url)))) | ||
| 78 | |||
| 79 | |||
| 80 | ;;todo. | ||
| 81 | ;; - support browse-url with xwidget-webkit | ||
| 82 | ;; - check that the webkit support is compiled in | ||
| 83 | (define-derived-mode xwidget-webkit-mode special-mode "xwidget-webkit" "xwidget webkit special mode" ) | ||
| 84 | (defun xwidget-webkit-new-session (url) | ||
| 85 | (save-excursion | ||
| 86 | (let* | ||
| 87 | ((bufname (generate-new-buffer-name "*xwidget-webkit*")) | ||
| 88 | (xwid 1)) | ||
| 89 | (set-buffer (get-buffer-create bufname)) | ||
| 90 | (insert " ") | ||
| 91 | (xwidget-insert 1 'webkit-osr bufname 1000 1000 xwid) | ||
| 92 | (xwidget-webkit-mode) | ||
| 93 | (xwidget-webkit-goto-uri xwid url )) | ||
| 94 | ) | ||
| 95 | |||
| 96 | ) | ||
| 97 | |||
| 98 | (defun xwidget-webkit-goto-url (url)) | ||
| 99 | |||
| 65 | 100 | ||
| 66 | ;; use declare here? | 101 | ;; use declare here? |
| 67 | ;; (declare-function xwidget-resize-internal "xwidget.c" ) | 102 | ;; (declare-function xwidget-resize-internal "xwidget.c" ) |
diff --git a/src/xwidget.c b/src/xwidget.c index ef9de279939..e82864e2220 100644 --- a/src/xwidget.c +++ b/src/xwidget.c | |||
| @@ -986,6 +986,9 @@ lookup_xwidget (Lisp_Object spec) | |||
| 986 | /* When a xwidget lisp spec is found initialize the C struct that is used in the C code. | 986 | /* When a xwidget lisp spec is found initialize the C struct that is used in the C code. |
| 987 | This is done by redisplay so values change if the spec changes. | 987 | This is done by redisplay so values change if the spec changes. |
| 988 | So, take special care of one-shot events | 988 | So, take special care of one-shot events |
| 989 | |||
| 990 | TODO remove xwidget init from display spec. simply store an xwidget reference only and set | ||
| 991 | size etc when creating the xwidget, which should happen before insertion into buffer | ||
| 989 | */ | 992 | */ |
| 990 | int found = 0, found1 = 0, found2 = 0; | 993 | int found = 0, found1 = 0, found2 = 0; |
| 991 | Lisp_Object value; | 994 | Lisp_Object value; |