aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.xwidget426
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/gnus/ChangeLog4
-rw-r--r--lisp/gnus/shr.el3
-rw-r--r--lisp/window.el60
-rw-r--r--lisp/xwidget-screencast.el32
-rw-r--r--lisp/xwidget-test.el138
-rw-r--r--lisp/xwidget.el4
-rw-r--r--src/ChangeLog23
-rw-r--r--src/dispnew.c1
-rw-r--r--src/editfns.c7
-rw-r--r--src/frame.c8
-rw-r--r--src/xml.c27
-rw-r--r--src/xwidget.c24
14 files changed, 382 insertions, 384 deletions
diff --git a/README.xwidget b/README.xwidget
index 296be30bb6d..cee891931d2 100644
--- a/README.xwidget
+++ b/README.xwidget
@@ -41,7 +41,36 @@ If that didnt work out try the minimal demonstration instead:
41(load-library "xwidget-test") 41(load-library "xwidget-test")
42(xwidget-demo-a-button) 42(xwidget-demo-a-button)
43 43
44It looks unimpressive, but it's a gtk button inside an Emars buffer! 44It looks unimpressive, but it's a gtk button inside an Emacs buffer!
45*** webkit hints
46If you got webkit working, great! Please note, though, that the
47current support is far from a full fledged browser. My focus is on
48delivering a component that can be used to build a full emacs based
49browser on. Since I implement a browse-url function you can get quite
50far just by:
51
52(setq browse-url-browser-function 'xwidget-webkit-browse-url)
53
54then all Emacs browser interface systems work to a degree.
55heres stuff I use currenly
56
57- m-x anything-surfraw interfaces to search engines
58- C-o in org mode opens links inside org
59- m-x ffap opens links anywhere in a buffer
60- m-x gtk-lookup-symbol searches gtk docs
61- m-x bookmark-jump
62etc..
63
64I'll add more examples as I go along.
65
66However theres lots of support missing, see TODO list for
67information. Briefly:
68- download handling
69- keyboard field navigation
70- isearch
71- history
72- sites that use flash. I dont really care about this issue so its
73unlikely to be fixed. Just a heads up.
45 74
46** Stability 75** Stability
47Beginning with Summer 2011 I am now able to use Xwidget Emacs as my 76Beginning with Summer 2011 I am now able to use Xwidget Emacs as my
@@ -173,20 +202,6 @@ socket window is copied efficientlp by means of composition to a
173number of other windows, that then are plugged into the different 202number of other windows, that then are plugged into the different
174Emacs sockets. 203Emacs sockets.
175* ToDo:s 204* ToDo:s
176** DONE webkit flashkiller by default
177 CLOSED: [2011-07-19 Tue 14:27]
178while its possible to support plugins in the webkit xwidget, flash has
179issues on 64 bit, and slows down emacs to a halt with off screen
180rendering, and of course is not free software. its in the way for real
181world usage even if its interesting to watch flash animations inside
182emacs. which should be achieved with Gnash or other free software
183instead.
184
185http://stackoverflow.com/questions/4885513/prevent-flash-in-cocoa-webview
186
187simply use this api:
188http://webkitgtk.org/reference/WebKitWebPluginDatabase.html
189
190** DONE allow xwidgets to report thoir size 205** DONE allow xwidgets to report thoir size
191 CLOSED: [2011-07-19 Tue 14:26] 206 CLOSED: [2011-07-19 Tue 14:26]
192now we just hard code sizes. but webkit widgets for instance can 207now we just hard code sizes. but webkit widgets for instance can
@@ -522,171 +537,6 @@ buffer. how do we catch these errors?
522so turned out this got solved by using proper lisp objects for 537so turned out this got solved by using proper lisp objects for
523xwidgets. yay! 538xwidgets. yay!
524 539
525
526** DONE browser xwidget
527 CLOSED: [2011-07-20 Wed 20:05]
528although embedding a browser is not my primary concern many are
529interested in this. some suitable browser component needs to be found
530supporting gtk.
531
532*** DONE webkit
533 CLOSED: [2011-07-03 Sun 22:13]
534there is a webkit gtk port. there is no obvious mvc support.
535http://live.gnome.org/WebKitGtk
536http://webkitgtk.org/
537
538it might be possible to keep a set of webxits in artificial
539synchronisation by recursive deep copy of the DOM from one webkit to
540another. This will be error prone at best though. Another way might be
541to just use bitmap copy of the "live"instance to the "phantom"
542instances. the problem of transfering the live view remains though.
543
544export CFLAGS="`pkg-config --cflags webkit-1.0` -DHAVE_WEBKIT -g"
545export LDFLAGS=`pkg-config --libs webkit-1.0`
546./configure
547make
548
549**** off screen rendering
550export CFLAGS="`pkg-config --cflags webkit-1.0` -DHAVE_WEBKIT_OSR -g"
551export LDFLAGS=`pkg-config --libs webkit-1.0`
552./configure
553make
554
555works a little bit but i get errors like:
556
557(emacs:8362): GLib-GObject-WARNING **: invalid cast from `GdkOffscreenWindow' to `GdkDrawableImplX11'
558
559set a breakpoint in g_log, backtrace seems to indicate
560webkitViewportAttributesRecompute is the offender.
561
562maybe try gtk3 variants?
563
564export CFLAGS="`pkg-config --cflags webkitgtk-3.0 ` -DHAVE_WEBKIT_OSR "
565export LDFLAGS=`pkg-config --libs webkitgtk-3.0 `
566./configure --with-x-toolkit=gtk3
567make
568
569crash in gtk_window_get_size instead. great.
570
571http://gtkplus-p3.0.sourcearchive.com/documentation/2.91.5-0ubuntu1/testoffscreenwindow_8c-source.html
572
573after many atempts, the basic issue remains. for some reason the
574offscreen widget isnt ok when I want to snapshot it, so i simply get
575emptiness. the surface is only ok someimes.
576
577here is a useful debugging snippets:
578 // debugging redraw:
579 // - the bg colors always change, so theres no error in signal handling
580 // - i get this error now and then:
581 //(emacs:7109): GLib-GObject-WARNING **: invalid cast from `GdkOffscreenWindow' to `GdkDrawableImplX11'
582 // seems to happen in webkit actually. see README
583
584 if(0){ //redraw debug hack. helped a lot in fact. use the with alpha painter below also
585 cairo_set_source_rgb(cr, osr_dbg_color, 1.0, 0.2);
586 cairo_rectangle(cr, 0,0, xw->width, xw->height);
587 cairo_fill(cr);
588 osr_dbg_color+=0.1;
589 if(osr_dbg_color>1.0)
590 osr_dbg_color=0.0;
591
592 }
593
594you need to terminate drawing like this:
595
596 //cairo_set_source_surface (cr, src_pixmap, 0,0);
597 //cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
598
599 //cairo_paint_with_alpha (cr, 1.0);
600 //cairo_paint(cr);
601
602the snippets change background color on oach redraw.
603
604**** on-screen rendering to separate window
605an alternative might be to open a separate window and snapshot it. the
606idea is that whatever oddness webkit does so that offscreen rendering
607doesnt work, doesnt happen on-screen. the window could be opened
608somewhere not in the way.
609
610*** CANCELLED firefox
611 CLOSED: [2011-07-03 Sun 22:13]
612http://www-archive.mozilla.org/unix/gtk-embedding.html
613seems to be severly bitrotted
614
615heres a newer aproach
616http://hg.mozilla.org/incubator/embedding/file/29ac0fe51754/gtk/tests/test.cpp
617
618while webkit clearly has the best traction as an embeddee, the
619offscreen rendering issues makes it interesting to see what ff brings
620to the table. turns out webkit has as good offscreen support as anyone.
621
622
623*** DONE text field support
624 CLOSED: [2011-07-20 Wed 20:05]
625Emacs captures all keyboard events so text field support isn't super
626straightforward.
627
628**** propagate keyboard events
629I have some old hacks for this and they are not good.
630**** use the DOM model
631expose document.activeElement to lisp. This is potentially more
632interesting than just forwarding keyboard events.
633
634webkit_web_view_get_dom_document ()
635
636this is hard it seems. an idea might be to hack elisp support for swig
637to machine generate the bindings.
638**** DONE inject javascript
639 CLOSED: [2011-07-03 Sun 22:50]
640webkit_web_view_execute_script ()
641
642this works now:
643(xwidget-webkit-execute-script 5 "document.activeElement.value='test'")
644
645so it should be possible to do some interesting stuff.
646execute-script does however not return anything at the interface level
647so satisfaction is not total:
648
649http://markmail.org/message/4yowmdgras73z3x5
650
651maybe
652https://launchpad.net/gnome-seed
653
654or this funny hack:
655<jave> im trying to understanh how to interact via javascript to an embedded
656 webkit gtk instance [23:38]
657<jave> i use webkit_web_view_execute_script() which is nice but doesnt return
658 a value, by design aparently [23:39]
659<jave> any hints?
660<lucian> jave: afaik, webkit still doesn't have full gobject bindings [23:48]
661<lucian> jave: you can hack it up by making the JS modify the title, and read
662 the title from gtk-side
663<jave> lucian: that was a pretty cool idea!
664
665
666*** webkit_web_view_load_string ()
667I would like preview of html in a buffer rather than from uri.
668
669
670
671*** TODO simple xwidget-webkit wrapper
672so that it could be used for actual browsing :)
673I dont want to reinvent too many wheels so i'd like to use existing
674emacs facilities here possible. use bindings similar to w3m(or info)
675
676- m-x xwidget-webkit starts a session
677- 'g' goes to a url
678- use bookmark-jump i suppose. I mostly use org for bookmarks myself
679- browse-url support so webkit can be the default browser
680- some way of getting around the quirky keyboard interaction since
681 xwidgets dont receive keyboard events because I hawe no idea how to
682 do that in a sane way
683
684... and one can of course go on bikeshedding forever. lets keep it
685simple and extensible, and compatible with other Emacs packages.
686
687the really cool ideas would need Emacs DOM integration, which is not
688easy.
689
690** DONE clipping of controllers 540** DONE clipping of controllers
691 CLOSED: [2011-07-05 Tue 11:33] 541 CLOSED: [2011-07-05 Tue 11:33]
692 542
@@ -840,7 +690,6 @@ support a chain of redirects, which seems unlikely. the benefit would
840be that I dont have to spend time optimizing redrawing. 690be that I dont have to spend time optimizing redrawing.
841 691
842 692
843
844** DONE remove xwidget_views when emacs window is deleted 693** DONE remove xwidget_views when emacs window is deleted
845 CLOSED: [2011-07-05 Tue 11:29] 694 CLOSED: [2011-07-05 Tue 11:29]
846removing xwidget views when an Emacs window closes is not reliable. 695removing xwidget views when an Emacs window closes is not reliable.
@@ -852,6 +701,171 @@ removing xwidget views when an Emacs window closes is not reliable.
852this seems to work 701this seems to work
853 702
854 703
704** browser xwidget
705although embedding a browser is not my primary concern many are
706interested in this. some suitable browser component needs to be found
707supporting gtk.
708
709*** DONE webkit
710 CLOSED: [2011-07-03 Sun 22:13]
711there is a webkit gtk port. there is no obvious mvc support.
712http://live.gnome.org/WebKitGtk
713http://webkitgtk.org/
714
715it might be possible to keep a set of webxits in artificial
716synchronisation by recursive deep copy of the DOM from one webkit to
717another. This will be error prone at best though. Another way might be
718to just use bitmap copy of the "live"instance to the "phantom"
719instances. the problem of transfering the live view remains though.
720
721export CFLAGS="`pkg-config --cflags webkit-1.0` -DHAVE_WEBKIT -g"
722export LDFLAGS=`pkg-config --libs webkit-1.0`
723./configure
724make
725
726**** off screen rendering
727export CFLAGS="`pkg-config --cflags webkit-1.0` -DHAVE_WEBKIT_OSR -g"
728export LDFLAGS=`pkg-config --libs webkit-1.0`
729./configure
730make
731
732works a little bit but i get errors like:
733
734(emacs:8362): GLib-GObject-WARNING **: invalid cast from `GdkOffscreenWindow' to `GdkDrawableImplX11'
735
736set a breakpoint in g_log, backtrace seems to indicate
737webkitViewportAttributesRecompute is the offender.
738
739maybe try gtk3 variants?
740
741export CFLAGS="`pkg-config --cflags webkitgtk-3.0 ` -DHAVE_WEBKIT_OSR "
742export LDFLAGS=`pkg-config --libs webkitgtk-3.0 `
743./configure --with-x-toolkit=gtk3
744make
745
746crash in gtk_window_get_size instead. great.
747
748http://gtkplus-p3.0.sourcearchive.com/documentation/2.91.5-0ubuntu1/testoffscreenwindow_8c-source.html
749
750after many atempts, the basic issue remains. for some reason the
751offscreen widget isnt ok when I want to snapshot it, so i simply get
752emptiness. the surface is only ok someimes.
753
754here is a useful debugging snippets:
755 // debugging redraw:
756 // - the bg colors always change, so theres no error in signal handling
757 // - i get this error now and then:
758 //(emacs:7109): GLib-GObject-WARNING **: invalid cast from `GdkOffscreenWindow' to `GdkDrawableImplX11'
759 // seems to happen in webkit actually. see README
760
761 if(0){ //redraw debug hack. helped a lot in fact. use the with alpha painter below also
762 cairo_set_source_rgb(cr, osr_dbg_color, 1.0, 0.2);
763 cairo_rectangle(cr, 0,0, xw->width, xw->height);
764 cairo_fill(cr);
765 osr_dbg_color+=0.1;
766 if(osr_dbg_color>1.0)
767 osr_dbg_color=0.0;
768
769 }
770
771you need to terminate drawing like this:
772
773 //cairo_set_source_surface (cr, src_pixmap, 0,0);
774 //cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
775
776 //cairo_paint_with_alpha (cr, 1.0);
777 //cairo_paint(cr);
778
779the snippets change background color on oach redraw.
780
781**** on-screen rendering to separate window
782an alternative might be to open a separate window and snapshot it. the
783idea is that whatever oddness webkit does so that offscreen rendering
784doesnt work, doesnt happen on-screen. the window could be opened
785somewhere not in the way.
786
787*** CANCELLED firefox
788 CLOSED: [2011-07-03 Sun 22:13]
789http://www-archive.mozilla.org/unix/gtk-embedding.html
790seems to be severly bitrotted
791
792heres a newer aproach
793http://hg.mozilla.org/incubator/embedding/file/29ac0fe51754/gtk/tests/test.cpp
794
795while webkit clearly has the best traction as an embeddee, the
796offscreen rendering issues makes it interesting to see what ff brings
797to the table. turns out webkit has as good offscreen support as anyone.
798
799
800*** DONE text field support
801 CLOSED: [2011-07-20 Wed 20:05]
802Emacs captures all keyboard events so text field support isn't super
803straightforward.
804
805**** propagate keyboard events
806I have some old hacks for this and they are not good.
807**** use the DOM model
808expose document.activeElement to lisp. This is potentially more
809interesting than just forwarding keyboard events.
810
811webkit_web_view_get_dom_document ()
812
813this is hard it seems. an idea might be to hack elisp support for swig
814to machine generate the bindings.
815**** DONE inject javascript
816 CLOSED: [2011-07-03 Sun 22:50]
817webkit_web_view_execute_script ()
818
819this works now:
820(xwidget-webkit-execute-script 5 "document.activeElement.value='test'")
821
822so it should be possible to do some interesting stuff.
823execute-script does however not return anything at the interface level
824so satisfaction is not total:
825
826http://markmail.org/message/4yowmdgras73z3x5
827
828maybe
829https://launchpad.net/gnome-seed
830
831or this funny hack:
832<jave> im trying to understanh how to interact via javascript to an embedded
833 webkit gtk instance [23:38]
834<jave> i use webkit_web_view_execute_script() which is nice but doesnt return
835 a value, by design aparently [23:39]
836<jave> any hints?
837<lucian> jave: afaik, webkit still doesn't have full gobject bindings [23:48]
838<lucian> jave: you can hack it up by making the JS modify the title, and read
839 the title from gtk-side
840<jave> lucian: that was a pretty cool idea!
841
842
843*** webkit_web_view_load_string ()
844I would like preview of html in a buffer rather than from uri.
845
846
847
848*** DONE simple xwidget-webkit wrapper
849 CLOSED: [2011-07-22 Fri 11:01]
850so that it could be used for actual browsing :)
851I dont want to reinvent too many wheels so i'd like to use existing
852emacs facilities here possible. use bindings similar to w3m(or info)
853
854- m-x xwidget-webkit starts a session
855- 'g' goes to a url
856- use bookmark-jump i suppose. I mostly use org for bookmarks myself
857- browse-url support so webkit can be the default browser
858- some way of getting around the quirky keyboard interaction since
859 xwidgets dont receive keyboard events because I hawe no idea how to
860 do that in a sane way
861
862... and one can of course go on bikeshedding forever. lets keep it
863simple and extensible, and compatible with other Emacs packages.
864
865the really cool ideas would need Emacs DOM integration, which is not
866easy.
867
868
855** TODO support webkit signals 869** TODO support webkit signals
856*** TODO particularily document-load-finished 870*** TODO particularily document-load-finished
857http://webkitgtk.org/reference/webkitgtk-webkitwebview.html#WebKitWebView-document-load-finished 871http://webkitgtk.org/reference/webkitgtk-webkitwebview.html#WebKitWebView-document-load-finished
@@ -865,11 +879,26 @@ prints hello to stdout but theres no way to catch stdout from webkit I
865think other than receiving the signal. 879think other than receiving the signal.
866 880
867 881
882** DONE webkit flashkiller by default
883 CLOSED: [2011-07-19 Tue 14:27]
884while its possible to support plugins in the webkit xwidget, flash has
885issues on 64 bit, and slows down emacs to a halt with off screen
886rendering, and of course is not free software. its in the way for real
887world usage even if its interesting to watch flash animations inside
888emacs. which should be achieved with Gnash or other free software
889instead.
890
891http://stackoverflow.com/questions/4885513/prevent-flash-in-cocoa-webview
892
893simply use this api:
894http://webkitgtk.org/reference/WebKitWebPluginDatabase.html
895
868 896
869** TODO webkit downloads 897** TODO webkit downloads
870when clicking a download link in Webkit Emacs should take over and handle it 898when clicking a download link in Webkit Emacs should take over and handle it
871from there. Probably need signals. 899from there. Probably need signals. There are Emacs libraries to
872 900download things, with wget etc.
901"download-requested"
873** TODO webkit alt-text not handled 902** TODO webkit alt-text not handled
874XKCD use image-title to display a cartoon comment. These mysteriously 903XKCD use image-title to display a cartoon comment. These mysteriously
875don't work ATM. Other mouseovers work though. Maybe webkit tries to 904don't work ATM. Other mouseovers work though. Maybe webkit tries to
@@ -880,6 +909,36 @@ have a look at how docview solves it
880webkit_web_view_search_text () 909webkit_web_view_search_text ()
881** TODO webkit relative references doesn't work 910** TODO webkit relative references doesn't work
882probably because we handle scrolling in a non-standard way 911probably because we handle scrolling in a non-standard way
912** TODO webkit width adjustment handling issue
913since there are so many levels of clipping and whatnot in xwidgets
914sizing issues are difficult.
915
916- an xwidget is told how large it can be by emacs. thats the end of
917 it. if the xwidget thinks otherwise it will be clipped.
918- but emacs can ask the xwudget how large it wants to be. it can then
919 resize the reserved area and inform the xwidget thusly.
920
921That should have been enough. but webkit never reports less than what
922it already has. So currently a webkit view will only growth and not
923adjust to smaller sizes.
924
925This is not a big problem in practice but is still annoying.
926
927to see the problem surface to http://www.slashdot.org
928- xwidget-webkit-adjust-size
929- xwidget-webkit-adjust-size-to-content
930
931and then try resizing Epiphany.
932
933
934** TODO synchronise emacs background with xwidget color
935fine-tuning to reduce flicker.
936
937** TODO xwidget allow loading from string from emacs
938
939
940** TODO xwidgets doesn't work during bootstrap all of a sudden
941
883* old notes from x_draw_xwidget_glyph_string 942* old notes from x_draw_xwidget_glyph_string
884 943
885 BUG it seems this method for some reason is called with bad s->x and s->y sometimes. 944 BUG it seems this method for some reason is called with bad s->x and s->y sometimes.
@@ -922,3 +981,4 @@ probably because we handle scrolling in a non-standard way
922 this means valid cases like xwidgets being displayed only once in 981 this means valid cases like xwidgets being displayed only once in
923 non-selected windows, does not work well. they should also be visible 982 non-selected windows, does not work well. they should also be visible
924 in that case not phantomed. 983 in that case not phantomed.
984
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d96ad569543..a2169898670 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12011-07-21 Martin Rudalics <rudalics@gmx.at>
2
3 * window.el (display-buffer-pop-up-window)
4 (display-buffer-pop-up-side-window)
5 (display-buffer-in-side-window): Call display-buffer-set-height
6 and display-buffer-set-width after setting the new window's
7 buffer so `fit-window-to-buffer' and friends work on the right
8 buffer.
9
12011-07-20 Sam Steingold <sds@gnu.org> 102011-07-20 Sam Steingold <sds@gnu.org>
2 11
3 * progmodes/etags.el (etags-file-of-tag, etags-tags-table-files) 12 * progmodes/etags.el (etags-file-of-tag, etags-tags-table-files)
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index a1cb003a8ff..a8065fc5ca4 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,7 @@
12011-07-20 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * shr.el (shr-tag-comment): Ignore HTML comments.
4
12011-07-20 Andrew Cohen <cohen@andy.bu.edu> 52011-07-20 Andrew Cohen <cohen@andy.bu.edu>
2 6
3 * nnir.el (gnus-group-make-nnir-group): Allow optional search query 7 * nnir.el (gnus-group-make-nnir-group): Allow optional search query
diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el
index f8a85579b4f..8faa5071616 100644
--- a/lisp/gnus/shr.el
+++ b/lisp/gnus/shr.el
@@ -761,6 +761,9 @@ ones, in case fg and bg are nil."
761(defun shr-tag-script (cont) 761(defun shr-tag-script (cont)
762 ) 762 )
763 763
764(defun shr-tag-comment (cont)
765 )
766
764(defun shr-tag-sup (cont) 767(defun shr-tag-sup (cont)
765 (let ((start (point))) 768 (let ((start (point)))
766 (shr-generic cont) 769 (shr-generic cont)
diff --git a/lisp/window.el b/lisp/window.el
index 12c9da85d57..905db8dc9b6 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -5051,14 +5051,22 @@ description."
5051 (funcall side window))))) 5051 (funcall side window)))))
5052 5052
5053 (when (window-live-p window) 5053 (when (window-live-p window)
5054 ;; Adjust sizes if asked for. 5054 ;; In `quit-restore' parameter record that we popped up
5055 (display-buffer-set-height window specifiers) 5055 ;; this window, its buffer and which window was selected.
5056 (display-buffer-set-width window specifiers)
5057 (set-window-parameter 5056 (set-window-parameter
5058 window 'quit-restore (list 'new-window buffer selected-window)) 5057 window 'quit-restore (list 'new-window buffer selected-window))
5058 ;; For `display-buffer-window' mark window as new.
5059 (setq display-buffer-window (cons window 'new-window)) 5059 (setq display-buffer-window (cons window 'new-window))
5060 ;; Install BUFFER in the new window.
5060 (display-buffer-in-window buffer window specifiers) 5061 (display-buffer-in-window buffer window specifiers)
5062 ;; Adjust sizes if asked for (for `fit-window-to-buffer'
5063 ;; and friends BUFFER must be already shown in the new
5064 ;; window).
5065 (display-buffer-set-height window specifiers)
5066 (display-buffer-set-width window specifiers)
5067 ;; Reset list of window's previous buffers to nil.
5061 (set-window-prev-buffers window nil) 5068 (set-window-prev-buffers window nil)
5069 ;; Return the new window.
5062 (throw 'done window)))))))) 5070 (throw 'done window))))))))
5063 5071
5064(defun display-buffer-pop-up-frame (buffer &optional graphic-only specifiers) 5072(defun display-buffer-pop-up-frame (buffer &optional graphic-only specifiers)
@@ -5113,26 +5121,33 @@ failed."
5113 (display-buffer-split-window main-or-root on-side specifiers)) 5121 (display-buffer-split-window main-or-root on-side specifiers))
5114 fun) 5122 fun)
5115 (when window 5123 (when window
5124 ;; We were able to split off a new window.
5116 (unless main 5125 (unless main
5117 (walk-window-subtree 5126 (walk-window-subtree
5118 (lambda (window) 5127 (lambda (window)
5119 ;; Make all main-or-root subwindows main windows. 5128 ;; Make all main-or-root subwindows main windows.
5120 (set-window-parameter window 'window-side 'none)) 5129 (set-window-parameter window 'window-side 'none))
5121 main-or-root t)) 5130 main-or-root t))
5122 ;; Make sure that parent's window-side is nil. 5131 ;; Reset window-side parameter of new window's parent to nil.
5123 (set-window-parameter (window-parent window) 'window-side nil) 5132 (set-window-parameter (window-parent window) 'window-side nil)
5124 ;; Initialize side. 5133 ;; Initialize window-side parameter of new window to SIDE.
5125 (set-window-parameter window 'window-side side) 5134 (set-window-parameter window 'window-side side)
5126 ;; Adjust sizes if asked for. 5135 ;; Install window-slot parameter of new window.
5127 (display-buffer-set-height window specifiers) 5136 (set-window-parameter window 'window-slot slot)
5128 (display-buffer-set-width window specifiers) 5137 ;; In `quit-restore' parameter record that we popped up a new
5129 ;; Set window parameters. 5138 ;; window.
5130 (set-window-parameter 5139 (set-window-parameter
5131 window 'quit-restore (list 'new-window buffer selected-window)) 5140 window 'quit-restore (list 'new-window buffer selected-window))
5141 ;; For `display-buffer-window' mark window as new.
5132 (setq display-buffer-window (cons window 'new-window)) 5142 (setq display-buffer-window (cons window 'new-window))
5133 (set-window-parameter window 'window-slot slot) 5143 ;; Install BUFFER in new window.
5134 (display-buffer-in-window buffer window specifiers) 5144 (display-buffer-in-window buffer window specifiers)
5145 ;; Adjust sizes of new window if asked for.
5146 (display-buffer-set-height window specifiers)
5147 (display-buffer-set-width window specifiers)
5148 ;; Reset list of new window's previous buffers to nil.
5135 (set-window-prev-buffers window nil) 5149 (set-window-prev-buffers window nil)
5150 ;; Return the new window.
5136 window))) 5151 window)))
5137 5152
5138(defun display-buffer-in-side-window (buffer side &optional slot specifiers) 5153(defun display-buffer-in-side-window (buffer side &optional slot specifiers)
@@ -5160,7 +5175,7 @@ SPECIFIERS must be a list of buffer display specifiers."
5160 window-sides-slots)) 5175 window-sides-slots))
5161 (selected-window (selected-window)) 5176 (selected-window (selected-window))
5162 window this-window this-slot prev-window next-window 5177 window this-window this-slot prev-window next-window
5163 best-window best-slot abs-slot dedicated) 5178 best-window best-slot abs-slot dedicated new-window)
5164 5179
5165 (unless (numberp slot) 5180 (unless (numberp slot)
5166 (setq slot 0)) 5181 (setq slot 0))
@@ -5233,13 +5248,16 @@ SPECIFIERS must be a list of buffer display specifiers."
5233 (setq window (display-buffer-split-window 5248 (setq window (display-buffer-split-window
5234 prev-window prev-side specifiers))))) 5249 prev-window prev-side specifiers)))))
5235 (progn 5250 (progn
5236 (display-buffer-set-height window specifiers) 5251 ;; In `quit-restore' parameter record that we popped up
5237 (display-buffer-set-width window specifiers) 5252 ;; this window, its buffer and the old selected window.
5238 (set-window-parameter 5253 (set-window-parameter
5239 window 'quit-restore 5254 window 'quit-restore
5240 (list 'new-window buffer selected-window)) 5255 (list 'new-window buffer selected-window))
5256 ;; For `display-buffer-window' mark window as new.
5241 (setq display-buffer-window (cons window 'new-window)) 5257 (setq display-buffer-window (cons window 'new-window))
5242 window)) 5258 ;; Record that window is new, we need this for
5259 ;; adjusting sizes below.
5260 (setq new-window window)))
5243 (and best-window 5261 (and best-window
5244 (setq window best-window) 5262 (setq window best-window)
5245 ;; Reuse best window (the window nearest to SLOT). 5263 ;; Reuse best window (the window nearest to SLOT).
@@ -5262,7 +5280,17 @@ SPECIFIERS must be a list of buffer display specifiers."
5262 (unless (window-parameter window 'window-slot) 5280 (unless (window-parameter window 'window-slot)
5263 ;; Don't change exisiting slot value. 5281 ;; Don't change exisiting slot value.
5264 (set-window-parameter window 'window-slot slot)) 5282 (set-window-parameter window 'window-slot slot))
5265 (display-buffer-in-window buffer window specifiers))))) 5283 ;; Install BUFFER in the window.
5284 (display-buffer-in-window buffer window specifiers)
5285 (when new-window
5286 ;; Adjust sizes if asked for (for `fit-window-to-buffer' and
5287 ;; friends BUFFER must be already shown in the new window).
5288 (display-buffer-set-height window specifiers)
5289 (display-buffer-set-width window specifiers)
5290 ;; Reset list of new window's previous buffers to nil.
5291 (set-window-prev-buffers window nil))
5292 ;; Return the window used.
5293 window))))
5266 5294
5267(defun window-normalize-buffer-to-display (buffer-or-name) 5295(defun window-normalize-buffer-to-display (buffer-or-name)
5268 "Normalize BUFFER-OR-NAME argument for buffer display functions. 5296 "Normalize BUFFER-OR-NAME argument for buffer display functions.
@@ -6926,7 +6954,7 @@ WINDOW was scrolled."
6926 ;; `with-selected-window' should orderly restore the current buffer. 6954 ;; `with-selected-window' should orderly restore the current buffer.
6927 (with-selected-window window 6955 (with-selected-window window
6928 ;; We are in WINDOW's buffer now. 6956 ;; We are in WINDOW's buffer now.
6929 (let* ( ;; Adjust MIN-HEIGHT. 6957 (let* (;; Adjust MIN-HEIGHT.
6930 (min-height 6958 (min-height
6931 (if override 6959 (if override
6932 (window-min-size window nil window) 6960 (window-min-size window nil window)
diff --git a/lisp/xwidget-screencast.el b/lisp/xwidget-screencast.el
deleted file mode 100644
index f85dbe8f247..00000000000
--- a/lisp/xwidget-screencast.el
+++ /dev/null
@@ -1,32 +0,0 @@
1;;(require 'screencast)
2(require 'xwidget)
3(defconst xwidget-screencast-webkit '("Hello, and welcome to a
4 short demo of the Emacs xwidget branch, and the Webkit
5 integration it provides." n
6 "Xwidgets are toolkit widgets that behave like images in an
7 Emacs buffer. Except they are actual widgets, so you can
8 interact with them." n
9 "There are several, but people seem to fancy the webkit the most so lets have a look!"
10 (insert "some text")
11 (xwidget-insert (point-min) 'webkit-osr "webkit-osr" 500 1000 5)
12 n
13 "Okay so thats an actual webkit instance in an Emacs buffer! " n
14 "Mouse-overs work" n
15 "Mouse-clicks work" n
16 (split-window-vertically)
17 "You can split the buffer and scroll the windows separately, as
18 usual in Emacs. This is however not so usual in the browser
19 world for some reason." n
20 "So, can you use the xwidget branch as your main Emacs instance?"n
21 "Not yet, its still not mature. There are many tricky issues
22 left. That being said, there are many simple tasks to help out
23 with also if you like!" ))
24
25
26(defun xwidget-screencast(&optional arg)
27 "Displays the screencast for xwidgets."
28 (interactive "P")
29 (apply (if arg
30 'screencast-record
31 'screencast)
32 xwidget-screencast-webkit "xvidgets" 1 ()))
diff --git a/lisp/xwidget-test.el b/lisp/xwidget-test.el
deleted file mode 100644
index 087892244df..00000000000
--- a/lisp/xwidget-test.el
+++ /dev/null
@@ -1,138 +0,0 @@
1;;test like:
2;; cd /path/to/xwidgets-emacs-dir
3;; make all&& src/emacs -q --eval "(progn (load \"`pwd`/lisp/xwidget-test.el\") (xwidget-demo-basic))"
4
5
6;; you should see:
7;; - a gtk button
8;; - a gtk toggle button
9;; - a gtk slider button
10;; - an xembed window(using gtk_socket) showing another emacs instance
11;; - an xembed window(using gtk_socket) showing an uzbl web browser if its installed
12
13;;the widgets will move when you type in the buffer. good!
14
15;;there will be redrawing issues when widgets change rows, etc. bad!
16
17;;its currently difficult to give kbd focus to the xembedded emacs,
18;;but try evaling the following:
19
20;; (xwidget-set-keyboard-grab 3 1)
21
22
23
24
25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
27;; demo/test functions
28(require 'xwidget)
29
30(defmacro xwidget-demo (name &rest body)
31 `(defun ,(intern (concat "xwidget-demo-" name)) ()
32 (interactive)
33 (switch-to-buffer ,(format "*xwidget-demo-%s*" name))
34 (text-mode);;otherwise no local keymap
35 (insert "Some random text for xwidgets to be inserted in for demo purposes.\n")
36 ,@body))
37
38(xwidget-demo "a-button"
39 (xwidget-insert (point-min) 'button "button" 40 50)
40 (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic))
41
42(xwidget-demo "a-big-button"
43 (xwidget-insert (point-min) 'button "button" 400 500)
44 (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic))
45
46(xwidget-demo "a-socket"
47 (xwidget-insert (point-min) 'socket "socket" 500 500)
48 (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic))
49
50
51(xwidget-demo "a-slider"
52 (xwidget-insert (point-min) 'slider "slider" 500 100)
53 (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic))
54
55(xwidget-demo "a-canvas"
56 (xwidget-insert (point-min) 'cairo "canvas" 1000 1000)
57 (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic))
58
59(xwidget-demo "a-webkit"
60 (xwidget-insert (point-min) 'webkit "webkit" 1000 1000)
61 (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic))
62
63(xwidget-demo "a-webkit-osr"
64 (xwidget-insert (point-min) 'webkit-osr "webkit-osr" 1000 1000)
65 (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic))
66
67
68
69(xwidget-demo "basic"
70 (xwidget-insert (point-min) 'button "button" 40 50 )
71 (xwidget-insert 15 'toggle "toggle" 60 30 )
72 (xwidget-insert 30 'socket "emacs" 400 200 )
73 (xwidget-insert 20 'slider "slider" 100 50 )
74 (xwidget-insert 40 'socket "uzbl-core" 400 400 )
75 (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-basic)
76)
77
78
79;it doesnt seem gtk_socket_steal works very well. its deprecated.
80; xwininfo -int
81; then (xwidget-embed-steal 3 <winid>)
82(defun xwidget-demo-grab ()
83 (interactive)
84 (insert "0 <<< grabbed appp will appear here\n")
85 (xwidget-insert 1 1 3 "1" 1000 )
86 (define-key (current-local-map) [xwidget-event] 'xwidget-handler-demo-grab)
87 )
88
89;ive basically found these xembeddable things:
90;openvrml
91;emacs
92;mplayer
93;surf
94;uzbl
95
96;try the openvrml:
97;/usr/libexec/openvrml-xembed 0 ~/Desktop/HelloWorld.wrl
98
99
100(defun xwidget-handler-demo-basic ()
101 (interactive)
102 (message "stuff happened to xwidget %S" last-input-event)
103 (let*
104 ((xwidget-event-type (nth 2 last-input-event))
105 (xwidget-id (nth 1 last-input-event)))
106 (cond ( (eq xwidget-event-type 'xembed-ready)
107 (let*
108 ((xembed-id (nth 3 last-input-event)))
109 (message "xembed ready event: %S xw-id:%s" xembed-id xwidget-id)
110 ;;will start emacs/uzbl in a xembed socket when its ready
111 (cond
112 ((eq 3 xwidget-id)
113 (start-process "xembed" "*xembed*" (format "%ssrc/emacs" default-directory) "-q" "--parent-id" (number-to-string xembed-id) ) )
114 ((eq 5 xwidget-id)
115 (start-process "xembed2" "*xembed2*" "uzbl-core" "-s" (number-to-string xembed-id) "http://www.fsf.org" ) )
116
117 )
118 )))))
119
120
121
122(defun xwidget-handler-demo-grab ()
123 (interactive)
124 (message "stuff happened to xwidget %S" last-input-event)
125 (let*
126 ((xwidget-event-type (nth 2 last-input-event)))
127 (cond ( (eq xwidget-event-type 'xembed-ready)
128 (let*
129 ((xembed-id (nth 3 last-input-event)))
130 (message "xembed ready %S" xembed-id)
131 )
132 ))))
133(defun xwidget-dummy-hook ()
134 (message "xwidget dummy hook called"))
135
136; (xwidget-resize-hack 1 200 200)
137
138;(xwidget-demo-basic)
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index 837f8454671..7f1ffd56fb9 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -110,6 +110,10 @@ defaults to the string looking like a url around the cursor position."
110 (interactive) 110 (interactive)
111 ( xwidget-adjust-size-to-content ( xwidget-webkit-last-session))) 111 ( xwidget-adjust-size-to-content ( xwidget-webkit-last-session)))
112 112
113(defun xwidget-webkit-adjust-size (w h)
114 (interactive "nWidth:\nnHeight:\n")
115 ( xwidget-resize ( xwidget-webkit-last-session) w h))
116
113 117
114(defun xwidget-webkit-new-session (url) 118(defun xwidget-webkit-new-session (url)
115 119
diff --git a/src/ChangeLog b/src/ChangeLog
index e098e536efb..65cd07df0ae 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,26 @@
12011-07-22 Chong Yidong <cyd@stupidchicken.com>
2
3 * frame.c (Fmodify_frame_parameters): In tty case, update the
4 default face if necessary (Bug#4238).
5
62011-07-21 Chong Yidong <cyd@stupidchicken.com>
7
8 * editfns.c (Fstring_to_char): No need to explain what a character
9 is in the docstring (Bug#6576).
10
112011-07-20 Lars Magne Ingebrigtsen <larsi@gnus.org>
12
13 * xml.c (parse_region): Make sure we always return a tree.
14
152011-07-20 HAMANO Kiyoto <khiker.mail@gmail.com>
16
17 * xml.c (parse_region): If a document contains only comments,
18 return that, too.
19
202011-07-20 Lars Magne Ingebrigtsen <larsi@gnus.org>
21
22 * xml.c (make_dom): Return comments, too.
23
12011-07-19 Paul Eggert <eggert@cs.ucla.edu> 242011-07-19 Paul Eggert <eggert@cs.ucla.edu>
2 25
3 Port to OpenBSD. 26 Port to OpenBSD.
diff --git a/src/dispnew.c b/src/dispnew.c
index e1311634e2c..804ca14d936 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -15,7 +15,6 @@ GNU General Public License for more details.
15 15
16You should have received a copy of the GNU General Public License 16You should have received a copy of the GNU General Public License
17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
18
19#include <config.h> 18#include <config.h>
20#include <signal.h> 19#include <signal.h>
21#include <stdio.h> 20#include <stdio.h>
diff --git a/src/editfns.c b/src/editfns.c
index b20c38faacd..56ad99d199f 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -194,12 +194,7 @@ DEFUN ("byte-to-string", Fbyte_to_string, Sbyte_to_string, 1, 1, 0,
194} 194}
195 195
196DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0, 196DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0,
197 doc: /* Return the first character in STRING. 197 doc: /* Return the first character in STRING. */)
198A multibyte character is handled correctly.
199The value returned is a Unicode codepoint if it is below #x110000 (in
200hex). Codepoints beyond that are Emacs extensions of Unicode. In
201particular, eight-bit characters are returned as codepoints in the
202range #x3FFF80 through #x3FFFFF, inclusive. */)
203 (register Lisp_Object string) 198 (register Lisp_Object string)
204{ 199{
205 register Lisp_Object val; 200 register Lisp_Object val;
diff --git a/src/frame.c b/src/frame.c
index 635996ca424..19ce78dfd9c 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2437,11 +2437,9 @@ use is not recommended. Explicitly check for a frame-parameter instead. */)
2437 val = values[i]; 2437 val = values[i];
2438 store_frame_param (f, prop, val); 2438 store_frame_param (f, prop, val);
2439 2439
2440 /* Changing the background color might change the background 2440 if (EQ (prop, Qforeground_color)
2441 mode, so that we have to load new defface specs. 2441 || EQ (prop, Qbackground_color))
2442 Call frame-set-background-mode to do that. */ 2442 update_face_from_frame_parameter (f, prop, val);
2443 if (EQ (prop, Qbackground_color))
2444 call1 (Qframe_set_background_mode, frame);
2445 } 2443 }
2446 } 2444 }
2447 return Qnil; 2445 return Qnil;
diff --git a/src/xml.c b/src/xml.c
index 63041c96b24..a8a4d8122da 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -71,6 +71,14 @@ make_dom (xmlNode *node)
71 else 71 else
72 return Qnil; 72 return Qnil;
73 } 73 }
74 else if (node->type == XML_COMMENT_NODE)
75 {
76 if (node->content)
77 return list3 (intern ("comment"), Qnil,
78 build_string ((char *) node->content));
79 else
80 return Qnil;
81 }
74 else 82 else
75 return Qnil; 83 return Qnil;
76} 84}
@@ -117,9 +125,22 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
117 125
118 if (doc != NULL) 126 if (doc != NULL)
119 { 127 {
120 node = xmlDocGetRootElement (doc); 128 xmlNode *n = doc->children->next;
121 if (node != NULL) 129 Lisp_Object r = Qnil;
122 result = make_dom (node); 130
131 while (n) {
132 if (r != Qnil)
133 result = Fcons (r, result);
134 r = make_dom (n);
135 n = n->next;
136 }
137
138 if (result == Qnil)
139 result = r;
140 else
141 result = Fcons (intern ("top"),
142 Fcons (Qnil, Fnreverse (Fcons (r, result))));
143
123 xmlFreeDoc (doc); 144 xmlFreeDoc (doc);
124 xmlCleanupParser (); 145 xmlCleanupParser ();
125 } 146 }
diff --git a/src/xwidget.c b/src/xwidget.c
index bd007aad005..b362ca55a1f 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -786,6 +786,28 @@ DEFUN("xwidget-view-info", Fxwidget_view_info , Sxwidget_view_info, 2,2,0, doc:
786 return info; 786 return info;
787} 787}
788 788
789DEFUN ("xwidget-send-keyboard-event", Fxwidget_send_keyboard_event, Sxwidget_send_keyboard_event, 2, 2, 0, doc:/* synthesize a kbd event for a xwidget. */
790 )
791 (Lisp_Object xwidget, Lisp_Object keydescriptor)
792{
793 int keyval = 0x058; //X
794 char *keystring = "";
795
796 struct xwidget *xw = XXWIDGET(xwidget);
797
798 GdkEventKey* ev = (GdkEventKey*)gdk_event_new(GDK_KEY_PRESS);
799 ev->window = gtk_widget_get_window(xw->widget_osr);
800 ev->keyval = keyval;
801 gdk_event_put((GdkEvent*)ev);
802 ev->type = GDK_KEY_RELEASE;
803 gdk_event_put((GdkEvent*)ev);
804 gtk_main_do_event(ev);
805 gdk_event_free((GdkEvent*)ev);
806
807 return Qnil;
808}
809
810
789 811
790DEFUN("xwidget-delete-zombies", Fxwidget_delete_zombies , Sxwidget_delete_zombies, 0,0,0, doc: /* */) 812DEFUN("xwidget-delete-zombies", Fxwidget_delete_zombies , Sxwidget_delete_zombies, 0,0,0, doc: /* */)
791 (void) 813 (void)
@@ -842,6 +864,8 @@ syms_of_xwidget (void)
842 defsubr (&Sxwidget_size_request ); 864 defsubr (&Sxwidget_size_request );
843 defsubr (&Sxwidget_delete_zombies); 865 defsubr (&Sxwidget_delete_zombies);
844 defsubr (&Sxwidget_disable_plugin_for_mime); 866 defsubr (&Sxwidget_disable_plugin_for_mime);
867
868 defsubr (&Sxwidget_send_keyboard_event);
845 DEFSYM (Qxwidget ,"xwidget"); 869 DEFSYM (Qxwidget ,"xwidget");
846 870
847 DEFSYM (Qcxwidget ,":xwidget"); 871 DEFSYM (Qcxwidget ,":xwidget");