aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.xwidget46
-rw-r--r--lisp/xwidget.el47
2 files changed, 82 insertions, 11 deletions
diff --git a/README.xwidget b/README.xwidget
index 11406a99894..f457b5cd10e 100644
--- a/README.xwidget
+++ b/README.xwidget
@@ -887,8 +887,16 @@ easy.
887 887
888** webkit related 888** webkit related
889*** TODO webkit support webkit signals 889*** TODO webkit support webkit signals
890*** TODO particularily document-load-finished 890
891**** DONE particularily document-load-finished
892 CLOSED: [2011-08-01 Mon 22:34]
891http://webkitgtk.org/reference/webkitgtk-webkitwebview.html#WebKitWebView-document-load-finished 893http://webkitgtk.org/reference/webkitgtk-webkitwebview.html#WebKitWebView-document-load-finished
894because one might need tell set a title and sizes and things when it loads.
895**** TODO event bug
896Debugger entered--Lisp error: (error "Two bases given in one event")
897
898for some reason hapens sometimes with xwidget events.
899
892*** TODO console messages 900*** TODO console messages
893http://webkitgtk.org/reference/webkitgtk-webkitwebview.html#WebKitWebView-console-message 901http://webkitgtk.org/reference/webkitgtk-webkitwebview.html#WebKitWebView-console-message
894http://getfirebug.com/wiki/index.php/Console_API#console.count.28.5Btitle.5D.29 902http://getfirebug.com/wiki/index.php/Console_API#console.count.28.5Btitle.5D.29
@@ -898,8 +906,7 @@ because maybe we can make a simple JS REPL that way.
898prints hello to stdout but theres no way to catch stdout from webkit I 906prints hello to stdout but theres no way to catch stdout from webkit I
899think other than receiving the signal. 907think other than receiving the signal.
900 908
901*** DONE webkit flashkiller by default 909*** TODO webkit flashkiller by default
902 CLOSED: [2011-07-19 Tue 14:27]
903while its possible to support plugins in the webkit xwidget, flash has 910while its possible to support plugins in the webkit xwidget, flash has
904issues on 64 bit, and slows down emacs to a halt with off screen 911issues on 64 bit, and slows down emacs to a halt with off screen
905rendering, and of course is not free software. its in the way for real 912rendering, and of course is not free software. its in the way for real
@@ -912,6 +919,9 @@ http://stackoverflow.com/questions/4885513/prevent-flash-in-cocoa-webview
912simply use this api: 919simply use this api:
913http://webkitgtk.org/reference/WebKitWebPluginDatabase.html 920http://webkitgtk.org/reference/WebKitWebPluginDatabase.html
914 921
922theres an implementation now but it's not robust enough webkit often
923crashes taking emacs with it.
924
915*** TODO webkit downloads 925*** TODO webkit downloads
916when clicking a download link in Webkit Emacs should take over and handle it 926when clicking a download link in Webkit Emacs should take over and handle it
917from there. Probably need signals. There are Emacs libraries to 927from there. Probably need signals. There are Emacs libraries to
@@ -926,7 +936,8 @@ open a new window or something, which wont work.
926have a look at how docview solves it 936have a look at how docview solves it
927webkit_web_view_search_text () 937webkit_web_view_search_text ()
928*** TODO webkit relative references doesn't work 938*** TODO webkit relative references doesn't work
929probably because we handle scrolling in a non-standard way 939probably because we handle scrolling in a non-standard way. It does
940work sort of when theres a html frameset and webkit scrols by itself.
930*** TODO webkit width adjustment handling issue 941*** TODO webkit width adjustment handling issue
931since there are so many levels of clipping and whatnot in xwidgets 942since there are so many levels of clipping and whatnot in xwidgets
932sizing issues are difficult. 943sizing issues are difficult.
@@ -946,16 +957,33 @@ to see the problem surface to http://www.slashdot.org
946- xwidget-webkit-adjust-size 957- xwidget-webkit-adjust-size
947- xwidget-webkit-adjust-size-to-content 958- xwidget-webkit-adjust-size-to-content
948 959
949and then try resizing Epiphany. 960and then compare by resizing in Epiphany, which is also webkit based.
950 961
951*** TODO xwidget webkit allow loading from string from emacs 962*** TODO xwidget webkit allow loading from string from emacs
952*** TODO xwidget-webkit-last-session 963*** DONE xwidget-webkit-last-session
964 CLOSED: [2011-08-01 Mon 22:38]
953was rather hurried. end result is that the lisp layer only really 965was rather hurried. end result is that the lisp layer only really
954allows for one webkit session. 966allows for one webkit session.
955*** TODO C-X b in other buffer from webkit 967*** TODO C-X b in other buffer from webkit
956bafflingly resets the webkit view to the top. Maybe the window 968bafflingly resets the webkit view to the top. Maybe the window
957reconfiguration hook code? further mystification is added because it 969reconfiguration hook code? further mystification is added because it
958only seems to happen with ido mode enabled. 970only seems to happen with ido mode enabled.
971
972in comparison with image-mode which does the right thing, I discovered
973that image-mode has special code to handle scrolling. the browser mode
974and image mode has some similarities.
975
976** TODO xwidget image display spec compatibility
977some history: the first version of the xwidget display spec was
978the same as an image spec. This turned out not to be fantastic because
979an xwidget is both like a process and like an image. it has a separate
980existence from display. So now the xwidget display spec is just a
981pointer to a xwidget. But then some useful functionality in Emacs
982can't be reused for xwidget, in particular image-mode.
983
984Maybe a new image type could be added that was a wraper on an
985xwidget. Then image mode could be reused for webkit mode.
986
959** socket related 987** socket related
960*** TODO some flickering during redisplay of sockets 988*** TODO some flickering during redisplay of sockets
961with gtk3 an size allocation workaround is used. 989with gtk3 an size allocation workaround is used.
@@ -987,9 +1015,10 @@ fine-tuning to reduce flicker.
987 1015
988 1016
989 1017
990** TODO xwidgets doesn't work during bootstrap all of a sudden 1018** DONE xwidgets doesn't work during bootstrap all of a sudden
1019 CLOSED: [2011-08-01 Mon 22:33]
991might be some annoying local issues with my install because it is not 1020might be some annoying local issues with my install because it is not
992reliably reproducible. 1021reliably reproducible. (went away during merges)
993 1022
994** TODO low impact xwidget based image viewer 1023** TODO low impact xwidget based image viewer
995for instance to render SVG using webkit, or some other canvas. 1024for instance to render SVG using webkit, or some other canvas.
@@ -998,6 +1027,7 @@ that way it would be possible to merge to trunk in stages.
998so, webkit could be used to display the SVG. the display spec for 1027so, webkit could be used to display the SVG. the display spec for
999images would be used. multiple webkits would be used rather than 1028images would be used. multiple webkits would be used rather than
1000offscreen rendering, so it would be GTK2 compatible. 1029offscreen rendering, so it would be GTK2 compatible.
1030**
1001* old notes from x_draw_xwidget_glyph_string 1031* old notes from x_draw_xwidget_glyph_string
1002 1032
1003 BUG it seems this method for some reason is called with bad s->x and s->y sometimes. 1033 BUG it seems this method for some reason is called with bad s->x and s->y sometimes.
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index aef04cfb542..5ca8fb58d69 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -56,6 +56,7 @@ see xwidget.c for types suitable for TYPE.
56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 56;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
57;;; webkit support 57;;; webkit support
58(require 'browse-url) 58(require 'browse-url)
59(require 'image-mode)
59;;;###autoload 60;;;###autoload
60(defun xwidget-webkit-browse-url (url &optional new-session) 61(defun xwidget-webkit-browse-url (url &optional new-session)
61 "Ask xwidget-webkit to browse URL. 62 "Ask xwidget-webkit to browse URL.
@@ -81,23 +82,62 @@ defaults to the string looking like a url around the cursor position."
81 (define-key map "r" 'xwidget-webkit-reload ) 82 (define-key map "r" 'xwidget-webkit-reload )
82 (define-key map "\C-m" 'xwidget-webkit-insert-string) 83 (define-key map "\C-m" 'xwidget-webkit-insert-string)
83 (define-key map [xwidget-event] 'xwidget-webkit-event-handler) 84 (define-key map [xwidget-event] 'xwidget-webkit-event-handler)
85
86 ;;similar to image mode bindings
87 (define-key map (kbd "SPC") 'image-scroll-up)
88 (define-key map (kbd "DEL") 'image-scroll-down)
89
90 (define-key map [remap forward-char] (xwidget-image-mode-navigation-adaptor 'image-forward-hscroll))
91 (define-key map [remap backward-char] (xwidget-image-mode-navigation-adaptor 'image-backward-hscroll))
92 (define-key map [remap right-char] (xwidget-image-mode-navigation-adaptor 'image-forward-hscroll))
93 (define-key map [remap left-char] (xwidget-image-mode-navigation-adaptor 'image-backward-hscroll))
94 (define-key map [remap previous-line] (xwidget-image-mode-navigation-adaptor 'image-previous-line))
95 (define-key map [remap next-line] (xwidget-image-mode-navigation-adaptor 'image-next-line))
96 (define-key map [remap scroll-up] (xwidget-image-mode-navigation-adaptor 'image-scroll-up))
97 (define-key map [remap scroll-up-command] (xwidget-image-mode-navigation-adaptor 'image-scroll-up))
98
99 (define-key map [remap scroll-down] (xwidget-image-mode-navigation-adaptor 'image-scroll-down))
100
101 (define-key map [remap scroll-down-command] (xwidget-image-mode-navigation-adaptor 'image-scroll-down))
102 (define-key map [remap move-beginning-of-line] (xwidget-image-mode-navigation-adaptor 'image-bol))
103 (define-key map [remap move-end-of-line] (xwidget-image-mode-navigation-adaptor 'image-eol))
104 (define-key map [remap beginning-of-buffer] (xwidget-image-mode-navigation-adaptor 'image-bob))
105 (define-key map [remap end-of-buffer] (xwidget-image-mode-navigation-adaptor 'image-eob))
106
107
84 map) 108 map)
85 109
86 "Keymap for `xwidget-webkit-mode'.") 110 "Keymap for `xwidget-webkit-mode'.")
87 111
112(defun xwidget-image-display-size (spec &optional pixels frame)
113 (let ((xwi (xwidget-info (xwidget-at 1))))
114 (cons (aref xwi 2)
115 (aref xwi 3))))
116
117(defmacro xwidget-image-mode-navigation-adaptor (fn)
118 `(lambda () (interactive)
119 (flet ((image-display-size (spec &optional pixels frame) (xwidget-image-display-size spec)))
120 (funcall ,fn))))
121 )
122
88(defun xwidget-webkit-event-handler () 123(defun xwidget-webkit-event-handler ()
89 (interactive) 124 (interactive)
90 (message "stuff happened to webkit xwidget %S" last-input-event) 125 (message "stuff happened to webkit xwidget %S" last-input-event)
91 (let* 126 (let*
92 ((xwidget-event-type (nth 2 last-input-event)) 127 ((xwidget-event-type (nth 2 last-input-event))
93 (xwidget (nth 1 last-input-event))) 128 (xwidget (nth 1 last-input-event)))
94 (cond ( (eq xwidget-event-type 'document-load-finished) 129 (cond ((eq xwidget-event-type 'document-load-finished)
95 (message "webkit loaded %s" xwidget)) 130 (message "webkit loaded %s" xwidget)
131 (xwidget-webkit-adjust-size-to-content))
96 ))) 132 )))
97 133
98(define-derived-mode xwidget-webkit-mode 134(define-derived-mode xwidget-webkit-mode
99 special-mode "xwidget-webkit" "xwidget webkit view mode" 135 special-mode "xwidget-webkit" "xwidget webkit view mode"
100 (setq buffer-read-only t)) 136 (setq buffer-read-only t)
137 ;; Keep track of [vh]scroll when switching buffers
138 (image-mode-setup-winprops)
139
140 )
101 141
102(defvar xwidget-webkit-last-session-buffer nil) 142(defvar xwidget-webkit-last-session-buffer nil)
103 143
@@ -189,6 +229,7 @@ defaults to the string looking like a url around the cursor position."
189;;this is a workaround because I cant find the right place to put it in C 229;;this is a workaround because I cant find the right place to put it in C
190(add-hook 'window-configuration-change-hook 'xwidget-cleanup) 230(add-hook 'window-configuration-change-hook 'xwidget-cleanup)
191 231
232;;killflash is sadly not reliable yet.
192(defvar xwidget-webkit-kill-flash-oneshot t) 233(defvar xwidget-webkit-kill-flash-oneshot t)
193(defun xwidget-webkit-kill-flash () 234(defun xwidget-webkit-kill-flash ()
194 ;;you can only call this once or webkit crashes and takes emacs with it. odd. 235 ;;you can only call this once or webkit crashes and takes emacs with it. odd.