Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
;;; xwidget.el --- api functions for xwidgets -*- lexical-binding: t -*-
|
|
|
|
;;
|
2016-01-19 21:00:34 +00:00
|
|
|
;; Copyright (C) 2011-2016 Free Software Foundation, Inc.
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
;;
|
|
|
|
;; Author: Joakim Verona (joakim@verona.se)
|
|
|
|
;;
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
;;
|
|
|
|
;; --------------------------------------------------------------------
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
;;
|
2016-01-20 00:06:32 +00:00
|
|
|
;; See xwidget.c for more api functions.
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
|
2016-01-25 23:17:33 +00:00
|
|
|
;; This breaks compilation when we don't have xwidgets.
|
|
|
|
;; And is pointless when we do, since it's in C and so preloaded.
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
;;(require 'xwidget-internal)
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(require 'cl-lib)
|
|
|
|
(require 'bookmark)
|
|
|
|
|
2016-01-25 23:19:34 +00:00
|
|
|
(defcustom xwidget-webkit-scroll-behavior 'native
|
2016-01-25 23:17:33 +00:00
|
|
|
"Scrolling behavior of the webkit instance.
|
|
|
|
The possible values are: `native' or `image'."
|
2016-01-19 23:03:37 +00:00
|
|
|
:version "25.1"
|
|
|
|
:group 'frames ; TODO add xwidgets group if more options are added
|
|
|
|
:type '(choice (const native) (const image)))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
|
2016-01-19 23:44:29 +00:00
|
|
|
(declare-function make-xwidget "xwidget.c"
|
|
|
|
(beg end type title width height arguments &optional buffer))
|
|
|
|
(declare-function xwidget-set-adjustment "xwidget.c"
|
|
|
|
(xwidget axis relative value))
|
|
|
|
(declare-function xwidget-buffer "xwidget.c" (xwidget))
|
|
|
|
(declare-function xwidget-webkit-get-title "xwidget.c" (xwidget))
|
|
|
|
(declare-function xwidget-size-request "xwidget.c" (xwidget))
|
|
|
|
(declare-function xwidget-resize "xwidget.c" (xwidget new-width new-height))
|
|
|
|
(declare-function xwidget-webkit-execute-script "xwidget.c" (xwidget script))
|
|
|
|
(declare-function xwidget-webkit-goto-uri "xwidget.c" (xwidget uri))
|
|
|
|
(declare-function xwidget-plist "xwidget.c" (xwidget))
|
|
|
|
(declare-function set-xwidget-plist "xwidget.c" (xwidget plist))
|
|
|
|
(declare-function xwidget-view-window "xwidget.c" (xwidget-view))
|
|
|
|
(declare-function xwidget-view-model "xwidget.c" (xwidget-view))
|
|
|
|
(declare-function delete-xwidget-view "xwidget.c" (xwidget-view))
|
|
|
|
(declare-function get-buffer-xwidgets "xwidget.c" (buffer))
|
|
|
|
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(defun xwidget-insert (pos type title width height &optional args)
|
2016-01-25 23:17:33 +00:00
|
|
|
"Insert an xwidget at position POS.
|
|
|
|
Supply the xwidget's TYPE, TITLE, WIDTH, and HEIGHT.
|
|
|
|
See `make-xwidget' for the possible TYPE values.
|
|
|
|
The usage of optional argument ARGS depends on the xwidget.
|
|
|
|
This returns the result of `make-xwidget'."
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(goto-char pos)
|
|
|
|
(let ((id (make-xwidget (point) (point)
|
|
|
|
type title width height args)))
|
|
|
|
(put-text-property (point) (+ 1 (point))
|
|
|
|
'display (list 'xwidget ':xwidget id))
|
|
|
|
id))
|
|
|
|
|
|
|
|
(defun xwidget-at (pos)
|
|
|
|
"Return xwidget at POS."
|
2016-01-20 00:06:32 +00:00
|
|
|
;; TODO this function is a bit tedious because the C layer isn't well
|
|
|
|
;; protected yet and xwidgetp apparently doesn't work yet.
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(let* ((disp (get-text-property pos 'display))
|
|
|
|
(xw (car (cdr (cdr disp)))))
|
2016-01-20 01:53:10 +00:00
|
|
|
;;(if (xwidgetp xw) xw nil)
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(if (equal 'xwidget (car disp)) xw)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;;; webkit support
|
|
|
|
(require 'browse-url)
|
|
|
|
(require 'image-mode);;for some image-mode alike functionality
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun xwidget-webkit-browse-url (url &optional new-session)
|
|
|
|
"Ask xwidget-webkit to browse URL.
|
2016-01-25 23:17:33 +00:00
|
|
|
NEW-SESSION specifies whether to create a new xwidget-webkit session.
|
|
|
|
Interactively, URL defaults to the string looking like a url around point."
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(interactive (progn
|
|
|
|
(require 'browse-url)
|
|
|
|
(browse-url-interactive-arg "xwidget-webkit URL: "
|
2016-01-20 01:53:10 +00:00
|
|
|
;;(xwidget-webkit-current-url)
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
)))
|
2016-01-27 22:01:30 +00:00
|
|
|
(or (featurep 'xwidget-internal)
|
|
|
|
(user-error "Your Emacs was not compiled with xwidgets support"))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(when (stringp url)
|
|
|
|
(if new-session
|
|
|
|
(xwidget-webkit-new-session url)
|
|
|
|
(xwidget-webkit-goto-url url))))
|
|
|
|
|
|
|
|
;;todo.
|
|
|
|
;; - check that the webkit support is compiled in
|
|
|
|
(defvar xwidget-webkit-mode-map
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
(define-key map "g" 'xwidget-webkit-browse-url)
|
|
|
|
(define-key map "a" 'xwidget-webkit-adjust-size-dispatch)
|
2016-01-20 01:53:10 +00:00
|
|
|
(define-key map "b" 'xwidget-webkit-back)
|
|
|
|
(define-key map "r" 'xwidget-webkit-reload)
|
|
|
|
(define-key map "t" (lambda () (interactive) (message "o"))) ;FIXME: ?!?
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(define-key map "\C-m" 'xwidget-webkit-insert-string)
|
|
|
|
(define-key map "w" 'xwidget-webkit-current-url)
|
|
|
|
|
|
|
|
;;similar to image mode bindings
|
|
|
|
(define-key map (kbd "SPC") 'xwidget-webkit-scroll-up)
|
|
|
|
(define-key map (kbd "DEL") 'xwidget-webkit-scroll-down)
|
|
|
|
|
|
|
|
(define-key map [remap scroll-up] 'xwidget-webkit-scroll-up)
|
|
|
|
(define-key map [remap scroll-up-command] 'xwidget-webkit-scroll-up)
|
|
|
|
|
|
|
|
(define-key map [remap scroll-down] 'xwidget-webkit-scroll-down)
|
|
|
|
(define-key map [remap scroll-down-command] 'xwidget-webkit-scroll-down)
|
|
|
|
|
|
|
|
(define-key map [remap forward-char] 'xwidget-webkit-scroll-forward)
|
|
|
|
(define-key map [remap backward-char] 'xwidget-webkit-scroll-backward)
|
|
|
|
(define-key map [remap right-char] 'xwidget-webkit-scroll-forward)
|
|
|
|
(define-key map [remap left-char] 'xwidget-webkit-scroll-backward)
|
|
|
|
;; (define-key map [remap previous-line] 'image-previous-line)
|
|
|
|
;; (define-key map [remap next-line] 'image-next-line)
|
|
|
|
|
|
|
|
;; (define-key map [remap move-beginning-of-line] 'image-bol)
|
|
|
|
;; (define-key map [remap move-end-of-line] 'image-eol)
|
|
|
|
;; (define-key map [remap beginning-of-buffer] 'image-bob)
|
|
|
|
;; (define-key map [remap end-of-buffer] 'image-eob)
|
|
|
|
map)
|
|
|
|
"Keymap for `xwidget-webkit-mode'.")
|
|
|
|
|
|
|
|
(defun xwidget-webkit-scroll-up ()
|
2016-01-25 23:17:33 +00:00
|
|
|
"Scroll webkit up.
|
2016-01-25 23:19:34 +00:00
|
|
|
Depending on the value of `xwidget-webkit-scroll-behavior',
|
2016-01-25 23:17:33 +00:00
|
|
|
this scrolls in 'native' fashion, or like `image-mode' would."
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(interactive)
|
2016-01-25 23:19:34 +00:00
|
|
|
(if (eq xwidget-webkit-scroll-behavior 'native)
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(xwidget-set-adjustment (xwidget-webkit-last-session) 'vertical t 50)
|
|
|
|
(image-scroll-up)))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-scroll-down ()
|
2016-01-25 23:17:33 +00:00
|
|
|
"Scroll webkit down.
|
2016-01-25 23:19:34 +00:00
|
|
|
Depending on the value of `xwidget-webkit-scroll-behavior',
|
2016-01-25 23:17:33 +00:00
|
|
|
this scrolls in 'native' fashion, or like `image-mode' would."
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(interactive)
|
2016-01-25 23:19:34 +00:00
|
|
|
(if (eq xwidget-webkit-scroll-behavior 'native)
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(xwidget-set-adjustment (xwidget-webkit-last-session) 'vertical t -50)
|
|
|
|
(image-scroll-down)))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-scroll-forward ()
|
2016-01-25 23:17:33 +00:00
|
|
|
"Scroll webkit forwards.
|
2016-01-25 23:19:34 +00:00
|
|
|
Depending on the value of `xwidget-webkit-scroll-behavior',
|
2016-01-25 23:17:33 +00:00
|
|
|
this scrolls in 'native' fashion, or like `image-mode' would."
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(interactive)
|
2016-01-25 23:19:34 +00:00
|
|
|
(if (eq xwidget-webkit-scroll-behavior 'native)
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(xwidget-set-adjustment (xwidget-webkit-last-session) 'horizontal t 50)
|
2016-01-25 23:17:33 +00:00
|
|
|
(xwidget-webkit-scroll-forward))) ; FIXME infloop!
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
|
|
|
|
(defun xwidget-webkit-scroll-backward ()
|
2016-01-25 23:17:33 +00:00
|
|
|
"Scroll webkit backwards.
|
2016-01-25 23:19:34 +00:00
|
|
|
Depending on the value of `xwidget-webkit-scroll-behavior',
|
2016-01-25 23:17:33 +00:00
|
|
|
this scrolls in 'native' fashion, or like `image-mode' would."
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(interactive)
|
2016-01-25 23:19:34 +00:00
|
|
|
(if (eq xwidget-webkit-scroll-behavior 'native)
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(xwidget-set-adjustment (xwidget-webkit-last-session) 'horizontal t -50)
|
2016-01-25 23:17:33 +00:00
|
|
|
(xwidget-webkit-scroll-backward))) ; FIXME infloop!
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
|
|
|
|
|
2016-01-20 00:06:32 +00:00
|
|
|
;; The xwidget event needs to go into a higher level handler
|
|
|
|
;; since the xwidget can generate an event even if it's offscreen.
|
|
|
|
;; TODO this needs to use callbacks and consider different xwidget event types.
|
2016-01-20 01:53:10 +00:00
|
|
|
(define-key (current-global-map) [xwidget-event] #'xwidget-event-handler)
|
|
|
|
(defun xwidget-log (&rest msg)
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
"Log MSG to a buffer."
|
2016-01-20 01:53:10 +00:00
|
|
|
(let ((buf (get-buffer-create " *xwidget-log*")))
|
|
|
|
(with-current-buffer buf
|
|
|
|
(insert (apply #'format msg))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(insert "\n"))))
|
|
|
|
|
|
|
|
(defun xwidget-event-handler ()
|
|
|
|
"Receive xwidget event."
|
|
|
|
(interactive)
|
|
|
|
(xwidget-log "stuff happened to xwidget %S" last-input-event)
|
|
|
|
(let*
|
|
|
|
((xwidget-event-type (nth 1 last-input-event))
|
|
|
|
(xwidget (nth 2 last-input-event))
|
|
|
|
;;(xwidget-callback (xwidget-get xwidget 'callback))
|
|
|
|
;;TODO stopped working for some reason
|
|
|
|
)
|
|
|
|
;;(funcall xwidget-callback xwidget xwidget-event-type)
|
|
|
|
(message "xw callback %s" xwidget)
|
|
|
|
(funcall 'xwidget-webkit-callback xwidget xwidget-event-type)))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-callback (xwidget xwidget-event-type)
|
|
|
|
"Callback for xwidgets.
|
|
|
|
XWIDGET instance, XWIDGET-EVENT-TYPE depends on the originating xwidget."
|
2016-01-20 01:53:10 +00:00
|
|
|
(if (not (buffer-live-p (xwidget-buffer xwidget)))
|
|
|
|
(xwidget-log
|
|
|
|
"error: callback called for xwidget with dead buffer")
|
|
|
|
(with-current-buffer (xwidget-buffer xwidget)
|
|
|
|
(let* ((strarg (nth 3 last-input-event)))
|
|
|
|
(cond ((eq xwidget-event-type 'document-load-finished)
|
|
|
|
(xwidget-log "webkit finished loading: '%s'"
|
|
|
|
(xwidget-webkit-get-title xwidget))
|
|
|
|
;;TODO - check the native/internal scroll
|
|
|
|
;;(xwidget-adjust-size-to-content xwidget)
|
|
|
|
(xwidget-webkit-adjust-size-dispatch) ;;TODO xwidget arg
|
|
|
|
(rename-buffer (format "*xwidget webkit: %s *"
|
|
|
|
(xwidget-webkit-get-title xwidget)))
|
|
|
|
(pop-to-buffer (current-buffer)))
|
|
|
|
((eq xwidget-event-type
|
|
|
|
'navigation-policy-decision-requested)
|
|
|
|
(if (string-match ".*#\\(.*\\)" strarg)
|
|
|
|
(xwidget-webkit-show-id-or-named-element
|
|
|
|
xwidget
|
|
|
|
(match-string 1 strarg))))
|
|
|
|
(t (xwidget-log "unhandled event:%s" xwidget-event-type)))))))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
|
|
|
|
(defvar bookmark-make-record-function)
|
|
|
|
(define-derived-mode xwidget-webkit-mode
|
2016-01-20 01:53:10 +00:00
|
|
|
special-mode "xwidget-webkit" "Xwidget webkit view mode."
|
|
|
|
(setq buffer-read-only t)
|
|
|
|
(setq-local bookmark-make-record-function
|
|
|
|
#'xwidget-webkit-bookmark-make-record)
|
|
|
|
;; Keep track of [vh]scroll when switching buffers
|
|
|
|
(image-mode-setup-winprops))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
|
|
|
|
(defun xwidget-webkit-bookmark-make-record ()
|
2016-01-20 01:53:10 +00:00
|
|
|
"Integrate Emacs bookmarks with the webkit xwidget."
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(nconc (bookmark-make-record-default t t)
|
|
|
|
`((page . ,(xwidget-webkit-current-url))
|
|
|
|
(handler . (lambda (bmk) (browse-url
|
2016-01-20 01:53:10 +00:00
|
|
|
(bookmark-prop-get bmk 'page)))))))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
(defvar xwidget-webkit-last-session-buffer nil)
|
|
|
|
|
2016-01-20 00:06:32 +00:00
|
|
|
(defun xwidget-webkit-last-session ()
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
"Last active webkit, or nil."
|
|
|
|
(if (buffer-live-p xwidget-webkit-last-session-buffer)
|
|
|
|
(with-current-buffer xwidget-webkit-last-session-buffer
|
2016-01-20 00:09:45 +00:00
|
|
|
(xwidget-at (point-min)))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
nil))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-current-session ()
|
2016-01-20 00:06:32 +00:00
|
|
|
"Either the webkit in the current buffer, or the last one used.
|
|
|
|
The latter might be nil."
|
2016-01-20 00:09:45 +00:00
|
|
|
(or (xwidget-at (point-min)) (xwidget-webkit-last-session)))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
|
|
|
|
(defun xwidget-adjust-size-to-content (xw)
|
|
|
|
"Resize XW to content."
|
2016-01-20 00:06:32 +00:00
|
|
|
;; xwidgets doesn't support widgets that have their own opinions about
|
2016-01-20 01:53:10 +00:00
|
|
|
;; size well, yet this reads the desired size and resizes the Emacs
|
2016-01-20 00:06:32 +00:00
|
|
|
;; allocated area accordingly.
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(let ((size (xwidget-size-request xw)))
|
|
|
|
(xwidget-resize xw (car size) (cadr size))))
|
|
|
|
|
|
|
|
|
|
|
|
(defvar xwidget-webkit-activeelement-js"
|
|
|
|
function findactiveelement(doc){
|
|
|
|
//alert(doc.activeElement.value);
|
|
|
|
if(doc.activeElement.value != undefined){
|
|
|
|
return doc.activeElement;
|
|
|
|
}else{
|
|
|
|
// recurse over the child documents:
|
|
|
|
var frames = doc.getElementsByTagName('frame');
|
|
|
|
for (var i = 0; i < frames.length; i++)
|
|
|
|
{
|
|
|
|
var d = frames[i].contentDocument;
|
|
|
|
var rv = findactiveelement(d);
|
|
|
|
if(rv != undefined){
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return undefined;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
"
|
|
|
|
|
|
|
|
"javascript that finds the active element."
|
2016-01-20 00:06:32 +00:00
|
|
|
;; Yes it's ugly, because:
|
|
|
|
;; - there is apparently no way to find the active frame other than recursion
|
|
|
|
;; - the js "for each" construct misbehaved on the "frames" collection
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
;; - a window with no frameset still has frames.length == 1, but
|
|
|
|
;; frames[0].document.activeElement != document.activeElement
|
|
|
|
;;TODO the activeelement type needs to be examined, for iframe, etc.
|
|
|
|
)
|
|
|
|
|
|
|
|
(defun xwidget-webkit-insert-string (xw str)
|
2016-01-25 23:17:33 +00:00
|
|
|
"Insert string STR in the active field in the webkit XW."
|
2016-01-20 00:06:32 +00:00
|
|
|
;; Read out the string in the field first and provide for edit.
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(interactive
|
|
|
|
(let* ((xww (xwidget-webkit-current-session))
|
|
|
|
|
|
|
|
(field-value
|
|
|
|
(progn
|
|
|
|
(xwidget-webkit-execute-script xww xwidget-webkit-activeelement-js)
|
|
|
|
(xwidget-webkit-execute-script-rv
|
|
|
|
xww
|
2016-01-20 01:53:10 +00:00
|
|
|
"findactiveelement(document).value;")))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(field-type (xwidget-webkit-execute-script-rv
|
|
|
|
xww
|
2016-01-20 01:53:10 +00:00
|
|
|
"findactiveelement(document).type;")))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(list xww
|
|
|
|
(cond ((equal "text" field-type)
|
2016-01-25 23:17:33 +00:00
|
|
|
(read-string "Text: " field-value))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
((equal "password" field-type)
|
2016-01-25 23:17:33 +00:00
|
|
|
(read-passwd "Password: " nil field-value))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
((equal "textarea" field-type)
|
|
|
|
(xwidget-webkit-begin-edit-textarea xww field-value))))))
|
|
|
|
(xwidget-webkit-execute-script
|
|
|
|
xw
|
|
|
|
(format "findactiveelement(document).value='%s'" str)))
|
|
|
|
|
|
|
|
(defvar xwidget-xwbl)
|
|
|
|
(defun xwidget-webkit-begin-edit-textarea (xw text)
|
|
|
|
"Start editing of a webkit text area.
|
|
|
|
XW is the xwidget identifier, TEXT is retrieved from the webkit."
|
|
|
|
(switch-to-buffer
|
|
|
|
(generate-new-buffer "textarea"))
|
|
|
|
(set (make-local-variable 'xwidget-xwbl) xw)
|
|
|
|
(insert text))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-end-edit-textarea ()
|
2016-01-20 01:53:10 +00:00
|
|
|
"End editing of a webkit text area."
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(interactive)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (search-forward "\n" nil t)
|
|
|
|
(replace-match "\\n" nil t))
|
|
|
|
(xwidget-webkit-execute-script
|
|
|
|
xwidget-xwbl
|
|
|
|
(format "findactiveelement(document).value='%s'"
|
|
|
|
(buffer-substring (point-min) (point-max))))
|
|
|
|
;;TODO convert linefeed to \n
|
|
|
|
)
|
|
|
|
|
|
|
|
(defun xwidget-webkit-show-named-element (xw element-name)
|
2016-01-25 23:17:33 +00:00
|
|
|
"Make webkit xwidget XW show a named element ELEMENT-NAME.
|
|
|
|
For example, use this to display an anchor."
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(interactive (list (xwidget-webkit-current-session)
|
2016-01-25 23:17:33 +00:00
|
|
|
(read-string "Element name: ")))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
;;TODO since an xwidget is an Emacs object, it is not trivial to do
|
|
|
|
;; some things that are taken for granted in a normal browser.
|
|
|
|
;; scrolling an anchor/named-element into view is one such thing.
|
|
|
|
;; This function implements a proof-of-concept for this. Problems
|
|
|
|
;; remaining: - The selected window is scrolled but this is not
|
|
|
|
;; always correct - This needs to be interfaced into browse-url
|
2016-01-20 00:06:32 +00:00
|
|
|
;; somehow. The tricky part is that we need to do this in two steps:
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
;; A: load the base url, wait for load signal to arrive B: navigate
|
|
|
|
;; to the anchor when the base url is finished rendering
|
|
|
|
|
|
|
|
;; This part figures out the Y coordinate of the element
|
|
|
|
(let ((y (string-to-number
|
|
|
|
(xwidget-webkit-execute-script-rv
|
|
|
|
xw
|
|
|
|
(format
|
|
|
|
"document.getElementsByName('%s')[0].getBoundingClientRect().top"
|
|
|
|
element-name)
|
|
|
|
0))))
|
2016-01-20 01:53:10 +00:00
|
|
|
;; Now we need to tell Emacs to scroll the element into view.
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(xwidget-log "scroll: %d" y)
|
|
|
|
(set-window-vscroll (selected-window) y t)))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-show-id-element (xw element-id)
|
2016-01-25 23:17:33 +00:00
|
|
|
"Make webkit xwidget XW show an id-element ELEMENT-ID.
|
|
|
|
For example, use this to display an anchor."
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(interactive (list (xwidget-webkit-current-session)
|
2016-01-25 23:17:33 +00:00
|
|
|
(read-string "Element id: ")))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(let ((y (string-to-number
|
|
|
|
(xwidget-webkit-execute-script-rv
|
|
|
|
xw
|
|
|
|
(format "document.getElementById('%s').getBoundingClientRect().top"
|
|
|
|
element-id)
|
|
|
|
0))))
|
2016-01-20 01:53:10 +00:00
|
|
|
;; Now we need to tell Emacs to scroll the element into view.
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(xwidget-log "scroll: %d" y)
|
|
|
|
(set-window-vscroll (selected-window) y t)))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-show-id-or-named-element (xw element-id)
|
2016-01-25 23:17:33 +00:00
|
|
|
"Make webkit xwidget XW show a name or element id ELEMENT-ID.
|
|
|
|
For example, use this to display an anchor."
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(interactive (list (xwidget-webkit-current-session)
|
2016-01-25 23:17:33 +00:00
|
|
|
(read-string "Name or element id: ")))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(let* ((y1 (string-to-number
|
|
|
|
(xwidget-webkit-execute-script-rv
|
|
|
|
xw
|
|
|
|
(format "document.getElementsByName('%s')[0].getBoundingClientRect().top" element-id)
|
|
|
|
"0")))
|
|
|
|
(y2 (string-to-number
|
|
|
|
(xwidget-webkit-execute-script-rv
|
|
|
|
xw
|
|
|
|
(format "document.getElementById('%s').getBoundingClientRect().top" element-id)
|
2016-01-20 01:53:10 +00:00
|
|
|
"0")))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(y3 (max y1 y2)))
|
2016-01-20 01:53:10 +00:00
|
|
|
;; Now we need to tell Emacs to scroll the element into view.
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(xwidget-log "scroll: %d" y3)
|
|
|
|
(set-window-vscroll (selected-window) y3 t)))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-adjust-size-to-content ()
|
|
|
|
"Adjust webkit to content size."
|
|
|
|
(interactive)
|
|
|
|
(xwidget-adjust-size-to-content (xwidget-webkit-current-session)))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-adjust-size-dispatch ()
|
|
|
|
"Adjust size according to mode."
|
|
|
|
(interactive)
|
2016-01-25 23:19:34 +00:00
|
|
|
(if (eq xwidget-webkit-scroll-behavior 'native)
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(xwidget-webkit-adjust-size-to-window)
|
|
|
|
(xwidget-webkit-adjust-size-to-content))
|
|
|
|
;; The recenter is intended to correct a visual glitch.
|
2016-01-20 00:06:32 +00:00
|
|
|
;; It errors out if the buffer isn't visible, but then we don't get
|
|
|
|
;; the glitch, so silence errors.
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(ignore-errors
|
2016-01-25 23:17:33 +00:00
|
|
|
(recenter-top-bottom)))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
|
|
|
|
(defun xwidget-webkit-adjust-size-to-window ()
|
|
|
|
"Adjust webkit to window."
|
|
|
|
(interactive)
|
2016-01-20 01:53:10 +00:00
|
|
|
(xwidget-resize (xwidget-webkit-current-session) (window-pixel-width)
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(window-pixel-height)))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-adjust-size (w h)
|
2016-01-25 23:17:33 +00:00
|
|
|
"Manually set webkit size to width W, height H."
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
;; TODO shouldn't be tied to the webkit xwidget
|
|
|
|
(interactive "nWidth:\nnHeight:\n")
|
2016-01-20 01:53:10 +00:00
|
|
|
(xwidget-resize (xwidget-webkit-current-session) w h))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
|
|
|
|
(defun xwidget-webkit-fit-width ()
|
|
|
|
"Adjust width of webkit to window width."
|
|
|
|
(interactive)
|
|
|
|
(xwidget-webkit-adjust-size (- (nth 2 (window-inside-pixel-edges))
|
|
|
|
(car (window-inside-pixel-edges)))
|
|
|
|
1000))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-new-session (url)
|
|
|
|
"Create a new webkit session buffer with URL."
|
|
|
|
(let*
|
|
|
|
((bufname (generate-new-buffer-name "*xwidget-webkit*"))
|
|
|
|
xw)
|
|
|
|
(setq xwidget-webkit-last-session-buffer (switch-to-buffer
|
|
|
|
(get-buffer-create bufname)))
|
|
|
|
(insert " 'a' adjusts the xwidget size.")
|
|
|
|
(setq xw (xwidget-insert 1 'webkit-osr bufname 1000 1000))
|
|
|
|
(xwidget-put xw 'callback 'xwidget-webkit-callback)
|
|
|
|
(xwidget-webkit-mode)
|
2016-01-20 01:53:10 +00:00
|
|
|
(xwidget-webkit-goto-uri (xwidget-webkit-last-session) url)))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
(defun xwidget-webkit-goto-url (url)
|
|
|
|
"Goto URL."
|
|
|
|
(if (xwidget-webkit-current-session)
|
|
|
|
(progn
|
|
|
|
(xwidget-webkit-goto-uri (xwidget-webkit-current-session) url))
|
|
|
|
(xwidget-webkit-new-session url)))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-back ()
|
2016-01-25 23:17:33 +00:00
|
|
|
"Go back in history."
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(interactive)
|
|
|
|
(xwidget-webkit-execute-script (xwidget-webkit-current-session)
|
|
|
|
"history.go(-1);"))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-reload ()
|
|
|
|
"Reload current url."
|
|
|
|
(interactive)
|
|
|
|
(xwidget-webkit-execute-script (xwidget-webkit-current-session)
|
|
|
|
"history.go(0);"))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-current-url ()
|
2016-01-25 23:17:33 +00:00
|
|
|
"Get the webkit url and place it on the kill-ring."
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(interactive)
|
|
|
|
(let* ((rv (xwidget-webkit-execute-script-rv (xwidget-webkit-current-session)
|
|
|
|
"document.URL"))
|
|
|
|
(url (kill-new (or rv ""))))
|
2016-01-20 01:53:10 +00:00
|
|
|
(message "url: %s" url)
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
url))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-execute-script-rv (xw script &optional default)
|
2016-01-25 23:17:33 +00:00
|
|
|
"Same as `xwidget-webkit-execute-script' but with return value.
|
2016-01-20 00:06:32 +00:00
|
|
|
XW is the webkit instance. SCRIPT is the script to execute.
|
2016-01-25 16:08:24 +00:00
|
|
|
DEFAULT is the default return value."
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
;; Notice the ugly "title" hack. It is needed because the Webkit
|
|
|
|
;; API at the time of writing didn't support returning values. This
|
2016-01-20 00:06:32 +00:00
|
|
|
;; is a wrapper for the title hack so it's easy to remove should
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
;; Webkit someday support JS return values or we find some other way
|
|
|
|
;; to access the DOM.
|
|
|
|
|
2016-01-20 00:06:32 +00:00
|
|
|
;; Reset webkit title. Not very nice.
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(let* ((emptytag "titlecantbewhitespaceohthehorror")
|
|
|
|
title)
|
|
|
|
(xwidget-webkit-execute-script xw (format "document.title=\"%s\";"
|
|
|
|
(or default emptytag)))
|
|
|
|
(xwidget-webkit-execute-script xw (format "document.title=%s;" script))
|
|
|
|
(setq title (xwidget-webkit-get-title xw))
|
|
|
|
(if (equal emptytag title)
|
|
|
|
(setq title ""))
|
|
|
|
(unless title
|
|
|
|
(setq title default))
|
|
|
|
title))
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
(defun xwidget-webkit-get-selection ()
|
|
|
|
"Get the webkit selection."
|
|
|
|
(xwidget-webkit-execute-script-rv (xwidget-webkit-current-session)
|
|
|
|
"window.getSelection().toString();"))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-copy-selection-as-kill ()
|
2016-01-25 23:17:33 +00:00
|
|
|
"Get the webkit selection and put it on the kill-ring."
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(interactive)
|
|
|
|
(kill-new (xwidget-webkit-get-selection)))
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2016-01-20 00:06:32 +00:00
|
|
|
;; Xwidget plist management (similar to the process plist functions)
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
|
|
|
|
(defun xwidget-get (xwidget propname)
|
2016-01-25 23:17:33 +00:00
|
|
|
"Get an xwidget's property value.
|
|
|
|
XWIDGET is an xwidget, PROPNAME a property.
|
|
|
|
Returns the last value stored with `xwidget-put'."
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(plist-get (xwidget-plist xwidget) propname))
|
|
|
|
|
|
|
|
(defun xwidget-put (xwidget propname value)
|
2016-01-25 23:17:33 +00:00
|
|
|
"Set an xwidget's property value.
|
|
|
|
XWIDGET is an xwidget, PROPNAME a property to be set to specified VALUE.
|
|
|
|
You can retrieve the value with `xwidget-get'."
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(set-xwidget-plist xwidget
|
|
|
|
(plist-put (xwidget-plist xwidget) propname value)))
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
2016-01-19 23:44:29 +00:00
|
|
|
(defvar xwidget-view-list) ; xwidget.c
|
|
|
|
(defvar xwidget-list) ; xwidget.c
|
|
|
|
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(defun xwidget-delete-zombies ()
|
|
|
|
"Helper for `xwidget-cleanup'."
|
|
|
|
(dolist (xwidget-view xwidget-view-list)
|
|
|
|
(when (or (not (window-live-p (xwidget-view-window xwidget-view)))
|
|
|
|
(not (memq (xwidget-view-model xwidget-view)
|
|
|
|
xwidget-list)))
|
|
|
|
(delete-xwidget-view xwidget-view))))
|
|
|
|
|
|
|
|
(defun xwidget-cleanup ()
|
|
|
|
"Delete zombie xwidgets."
|
|
|
|
;; During development it was sometimes easy to wind up with zombie
|
|
|
|
;; xwidget instances.
|
|
|
|
;; This function tries to implement a workaround should it occur again.
|
|
|
|
(interactive)
|
2016-01-20 00:06:32 +00:00
|
|
|
;; Kill xviews that should have been deleted but still linger.
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(xwidget-delete-zombies)
|
|
|
|
;; Redraw display otherwise ghost of zombies will remain to haunt the screen
|
|
|
|
(redraw-display))
|
|
|
|
|
|
|
|
(defun xwidget-kill-buffer-query-function ()
|
2016-01-20 00:06:32 +00:00
|
|
|
"Ask before killing a buffer that has xwidgets."
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(let ((xwidgets (get-buffer-xwidgets (current-buffer))))
|
|
|
|
(or (not xwidgets)
|
2016-01-20 01:53:10 +00:00
|
|
|
(not (memq t (mapcar #'xwidget-query-on-exit-flag xwidgets)))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
(yes-or-no-p
|
2016-01-20 01:53:10 +00:00
|
|
|
(format "Buffer %S has xwidgets; kill it? " (buffer-name))))))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
|
2016-01-20 01:53:10 +00:00
|
|
|
(when (featurep 'xwidget-internal)
|
|
|
|
(add-hook 'kill-buffer-query-functions #'xwidget-kill-buffer-query-function)
|
|
|
|
;; This would have felt better in C, but this seems to work well in
|
|
|
|
;; practice though.
|
|
|
|
(add-hook 'window-configuration-change-hook #'xwidget-delete-zombies))
|
Support for the new Xwidget feature.
* configure.ac:
(HAVE_XWIDGETS, WIDGET_OBJ, EMACS_CONFIG_FEATURES):
* xterm.c (x_draw_glyph_string, x_draw_bar_cursor):
* xdisp.c:
(handle_display_spec, handle_single_display_spec, push_it)
(pop_it, set_iterator_to_next, dump_glyph)
(calc_pixel_width_or_height, fill_xwidget_glyph_string)
(BUILD_XWIDGET_GLYPH_STRING, BUILD_GLYPH_STRINGS)
(produce_xwidget_glyph, x_produce_glyphs)
(get_window_cursor_type):
* window.c (Fdelete_window_internal):
* termhooks.h (e):
* print.c (print_object):
* lisp.h (ptrdiff_t):
* keyboard.c (kbd_buffer_get_event, make_lispy_event)
(syms_of_keyboard):
* emacs.c (main):
* dispnew.c (update_window, scrolling_window):
* dispextern.h (g, i):
* Makefile.in (XWIDGETS_OBJ, WEBKIT_CFLAGS, WEBKIT_LIBS)
(GIR_LIBS, ALL_CFLAGS, base_obj, LIBES):
* keyboard.c (kbd_buffer_get_event):
* emacsgtkfixed.c (emacs_fixed_gtk_widget_size_allocate)
(emacs_fixed_class_init): Add case for an xwidget view.
* xwidget.c, xwidget.h, xwidget.el: New files for xwidgets
Co-authored-by: Grégoire Jadi <daimrod@gmail.com>
Various improvements to the Xwidget feature.
* xwidgets.c:
* emacsgtkfixed.c:
* xwidget.el:
2016-01-19 19:27:12 +00:00
|
|
|
|
|
|
|
(provide 'xwidget)
|
|
|
|
;;; xwidget.el ends here
|