aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2011-07-18 14:37:45 +0200
committerJoakim Verona2011-07-18 14:37:45 +0200
commitf7679969e190ec203eb46e0937185900b72f11c7 (patch)
treeaa502b5db785aedac22e154ea668e7a0f20a8f3b
parent917307c6e1b87f710e34df8daa4160c792ab7cee (diff)
downloademacs-f7679969e190ec203eb46e0937185900b72f11c7.tar.gz
emacs-f7679969e190ec203eb46e0937185900b72f11c7.zip
docs and webkit usability
-rw-r--r--README.xwidget17
-rw-r--r--lisp/xwidget.el31
2 files changed, 47 insertions, 1 deletions
diff --git a/README.xwidget b/README.xwidget
index 0a5f7ac09b0..783e9605ad5 100644
--- a/README.xwidget
+++ b/README.xwidget
@@ -24,6 +24,7 @@ The xwidget code attempts to keep the visual appearance of the views
24in sync with through an Observer pattern implementation. 24in sync with through an Observer pattern implementation.
25 25
26** building 26** building
27bzr co bzr+ssh://jave@bzr.savannah.gnu.org/emacs/xwidget/
27export CFLAGS=" -g -DGLYPH_DEBUG=1" 28export CFLAGS=" -g -DGLYPH_DEBUG=1"
28#export CFLAGS="-g" 29#export CFLAGS="-g"
29./configure --with-x-toolkit=gtk3 --with-xwidgets 30./configure --with-x-toolkit=gtk3 --with-xwidgets
@@ -139,6 +140,22 @@ this is aproach worked so-so.
139;; make all&& src/emacs -q --eval "(progn (load \"`pwd`/lisp/xwidget-test.el\") (xwidget-demo-basic))" 140;; make all&& src/emacs -q --eval "(progn (load \"`pwd`/lisp/xwidget-test.el\") (xwidget-demo-basic))"
140 141
141* ToDo:s 142* ToDo:s
143** TODO webkit flashkiller by default
144while its possible to support plugins in the webkit xwidget, flash has
145issues on 64 bit, and slows down emacs to a halt with off screen
146rendering, and of course is not free software. its in the way for real
147world usage even if its interesting to watch flash animations inside
148emacs. which should be achieved with Gnash or other free software
149instead.
150
151http://stackoverflow.com/questions/4885513/prevent-flash-in-cocoa-webview
152
153simply use this api:
154http://webkitgtk.org/reference/WebKitWebPluginDatabase.html
155
156** TODO allow xwidgets to report thoir size
157now we just hard code sizes. but webkit widgets for instance can
158report sizes that suit the content. support that.
142** TODO BUG xwidget view ghosts 159** TODO BUG xwidget view ghosts
143- xwidget-webkit-browse-url somewhere 160- xwidget-webkit-browse-url somewhere
144- split window. 161- split window.
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index 967577a4e98..436e7b614a4 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -62,7 +62,16 @@ defaults to the string looking like a url around the cursor position."
62;;todo. 62;;todo.
63;; - support browse-url with xwidget-webkit 63;; - support browse-url with xwidget-webkit
64;; - check that the webkit support is compiled in 64;; - check that the webkit support is compiled in
65(define-derived-mode xwidget-webkit-mode view-mode "xwidget-webkit" "xwidget webkit view mode" ) 65(define-derived-mode xwidget-webkit-mode
66 special-mode "xwidget-webkit" "xwidget webkit view mode"
67 (setq buffer-read-only t))
68(defvar xwidget-webkit-mode-map
69 (let ((map (make-sparse-keymap)))
70 (define-key map "g" 'xwidget-webkit-browse-url)
71 (define-key map "a" 'xwidget-webkit-adjust-size-to-content)
72 (define-key map "\C-m" 'xwidget-webkit-insert-string)
73 map)
74 "Keymap for `xwidget-webkit-mode'.")
66 75
67(defvar xwidget-webkit-last-session-buffer nil) 76(defvar xwidget-webkit-last-session-buffer nil)
68 77
@@ -73,6 +82,23 @@ defaults to the string looking like a url around the cursor position."
73 (xwidget-at 1)) 82 (xwidget-at 1))
74 nil)) 83 nil))
75 84
85(defun xwidget-adjust-size-to-content (xw)
86 ;;xwidgets doesnt support widgets that have thoir own opinions about size well yet
87 ;;this reads the size and sets it back
88 (let ((size (xwidget-size-request xw)))
89 (xwidget-resize xw (car size) (cadr size)))
90 )
91
92(defun xwidget-webkit-insert-string (xw str)
93 (interactive (list (xwidget-webkit-last-session)
94 (read-string "string:")))
95 (xwidget-webkit-execute-script xw (format "document.activeElement.value='%s'" str)))
96
97(defun xwidget-webkit-adjust-size-to-content ()
98 (interactive)
99 ( xwidget-adjust-size-to-content ( xwidget-webkit-last-session))
100 )
101
76(defun xwidget-webkit-new-session (url) 102(defun xwidget-webkit-new-session (url)
77 103
78 (let* 104 (let*
@@ -106,4 +132,7 @@ defaults to the string looking like a url around the cursor position."
106 (redraw-display);;redraw display otherwise ghost of zombies will remain to haunt the screen 132 (redraw-display);;redraw display otherwise ghost of zombies will remain to haunt the screen
107 ) 133 )
108 134
135;;this is a workaround because I cant find the right place to put it in C
136(add-hook 'window-configuration-change-hook 'xwidget-cleanup)
137
109(provide 'xwidget) 138(provide 'xwidget)