unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: emacs-devel@gnu.org
Subject: Re: Using xwidget to play youtube videos
Date: Mon, 22 Feb 2016 14:56:10 +1100	[thread overview]
Message-ID: <874md1z9d1.fsf@gnus.org> (raw)
In-Reply-To: 87fuwmm18o.fsf@esperi.org.uk

I've taken another short stab at playing with xwidget, and I can't
really make heads or tails of it, I'm afraid.  Patch to eww below.

First of all, it seems like all the xwidget functions are geared towards
only being displayed in an xwidget buffer.  The xwidget functions rename
buffers willy-nilly when just inserting an xwidget into a buffer, and
that should not happen.  There are also hard-coded callbacks in the
xwidgets for adjusting the size and ... stuff ... that don't make any
sense in anything but xwidget buffers, either.

The xwidget core code has to be separated out from the xwidget mode
code, and the latter should set the callbacks it wants to use.

I think that's probably easily doable, but it would be nice if someone
who knew the code and what it was trying to do did that.  :-)

Second of all, it's quite glitchy.  Even if you manage to somehow insert
an xwidget into your buffer, scrolling around in the buffer sometimes
makes the xwidget show up twice, or no times, or leaves half the widget
displayed and half not.

So, er...  this stuff doesn't really seem finished.  :-)  I think it's
exciting, but it needs work.  Should this be in emacs-25?

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 7f9f4fa..3d94508 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -426,6 +426,7 @@ eww-display-html
               '((title . eww-tag-title)
                 (form . eww-tag-form)
                 (input . eww-tag-input)
+                (iframe . eww-tag-iframe)
                 (button . eww-form-submit)
                 (textarea . eww-tag-textarea)
                 (select . eww-tag-select)
@@ -2000,6 +2001,16 @@ eww-restore-desktop
 (add-to-list 'desktop-buffer-mode-handlers
              '(eww-mode . eww-restore-desktop))
 
+(defun eww-tag-iframe (dom)
+  (when (fboundp 'make-xwidget)
+    (require 'xwidget)
+    (insert "-")
+    (let ((xw (xwidget-insert (1- (point)) 'webkit-osr  (current-buffer)
+                              (string-to-number (dom-attr dom 'width))
+                              (string-to-number (dom-attr dom 'height)))))
+      (xwidget-webkit-goto-uri xw (dom-attr dom 'src))
+      (insert "---"))))
+
 ;;; Isearch support
 
 (defun eww-isearch-next-buffer (&optional _buffer wrap)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2016-02-22  3:56 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-09  5:58 Using xwidget to play youtube videos Lars Ingebrigtsen
2016-02-09  9:38 ` joakim
2016-02-09 22:55   ` Lars Ingebrigtsen
2016-02-10 14:14     ` Richard Stallman
2016-02-10 14:41       ` Andreas Schwab
2016-02-11  5:18         ` Marcin Borkowski
2016-02-11  9:51           ` Andreas Schwab
2016-02-11 18:21           ` Richard Stallman
2016-02-21 17:17             ` Nix
2016-02-22  3:56               ` Lars Ingebrigtsen [this message]
2016-02-22  9:27                 ` joakim
2016-02-22 16:26                   ` Eli Zaretskii
2016-02-23  1:24                   ` Lars Ingebrigtsen
2016-02-22 16:09                 ` Eli Zaretskii
2016-02-22 18:59                   ` joakim
2016-02-22 18:59                   ` John Wiegley
2016-02-12  3:43           ` Matthew Carter
2016-02-12 13:05             ` Marcin Borkowski
2016-02-13 15:33               ` Richard Stallman
2016-02-14 12:21                 ` Elias Mårtenson
2016-02-14 12:33                   ` Dmitry Gutov
2016-02-14 15:32                     ` Elias Mårtenson
2016-02-15 10:26                   ` Richard Stallman
2016-02-15 10:42                     ` Marcin Borkowski
2016-02-11  3:48       ` Lars Ingebrigtsen
2016-02-11 18:21         ` Richard Stallman
2016-02-11 18:46           ` joakim
2016-02-12 12:34             ` Richard Stallman
2016-02-09 16:31 ` raman
2016-02-09 22:59   ` Lars Ingebrigtsen
2016-02-10  8:03     ` joakim
2016-02-09 16:51 ` Eli Zaretskii
2016-02-09 23:00   ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874md1z9d1.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).