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 /lisp | |
| parent | 347166ea436327f6ded4550ed004d43f6042f6b4 (diff) | |
| download | emacs-42f051946e70bb5e6ad407b85d003040d9ba5006.tar.gz emacs-42f051946e70bb5e6ad407b85d003040d9ba5006.zip | |
cleanups. tentative webkit lisp interface, but i got annoyed now with the primitives.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/xwidget.el | 45 |
1 files changed, 40 insertions, 5 deletions
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" ) |