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 20:27:12 +01:00
|
|
|
;;; xwidget.el --- api functions for xwidgets -*- lexical-binding: t -*-
|
2022-07-20 22:34:34 +02:00
|
|
|
|
2024-01-02 09:47:10 +08:00
|
|
|
;; Copyright (C) 2011-2024 Free Software Foundation, Inc.
|
2022-07-20 22:34:34 +02:00
|
|
|
|
|
|
|
;; Author: Joakim Verona <joakim@verona.se>
|
|
|
|
|
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 20:27:12 +01:00
|
|
|
;; This file is part of GNU Emacs.
|
2022-07-20 22:34:34 +02:00
|
|
|
|
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 20:27:12 +01:00
|
|
|
;; 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
|
2017-09-13 15:52:52 -07:00
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
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 20:27:12 +01:00
|
|
|
|
|
|
|
;;; Commentary:
|
2022-11-11 15:26:09 +01:00
|
|
|
|
2022-11-12 07:06:26 +01:00
|
|
|
;; See the node "(emacs)Embedded WebKit Widgets" in the Emacs manual for
|
|
|
|
;; help on user-facing features, and "(elisp)Embedded Native Widgets" in
|
|
|
|
;; the Emacs Lisp reference manual for help on more API functions.
|
2022-11-11 15:26:09 +01:00
|
|
|
|
|
|
|
;;; Code:
|
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 20:27:12 +01:00
|
|
|
|
2016-01-25 18:17:33 -05: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 20:27:12 +01:00
|
|
|
;;(require 'xwidget-internal)
|
|
|
|
|
|
|
|
(require 'cl-lib)
|
|
|
|
(require 'bookmark)
|
2021-11-11 18:24:49 +08:00
|
|
|
(require 'format-spec)
|
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 20:27:12 +01:00
|
|
|
|
2016-01-19 18:44:29 -05:00
|
|
|
(declare-function make-xwidget "xwidget.c"
|
2022-05-14 16:19:12 +03:00
|
|
|
(type title width height &optional arguments buffer related))
|
2016-01-19 18:44:29 -05:00
|
|
|
(declare-function xwidget-buffer "xwidget.c" (xwidget))
|
2021-11-06 20:59:08 +08:00
|
|
|
(declare-function set-xwidget-buffer "xwidget.c" (xwidget buffer))
|
2016-01-19 18:44:29 -05:00
|
|
|
(declare-function xwidget-size-request "xwidget.c" (xwidget))
|
|
|
|
(declare-function xwidget-resize "xwidget.c" (xwidget new-width new-height))
|
2016-10-25 23:00:35 -07:00
|
|
|
(declare-function xwidget-webkit-execute-script "xwidget.c"
|
|
|
|
(xwidget script &optional callback))
|
2020-08-12 12:34:29 +02:00
|
|
|
(declare-function xwidget-webkit-uri "xwidget.c" (xwidget))
|
|
|
|
(declare-function xwidget-webkit-title "xwidget.c" (xwidget))
|
2016-01-19 18:44:29 -05:00
|
|
|
(declare-function xwidget-webkit-goto-uri "xwidget.c" (xwidget uri))
|
2020-08-12 12:34:29 +02:00
|
|
|
(declare-function xwidget-webkit-goto-history "xwidget.c" (xwidget rel-pos))
|
2016-10-25 23:00:35 -07:00
|
|
|
(declare-function xwidget-webkit-zoom "xwidget.c" (xwidget factor))
|
2016-01-19 18:44:29 -05:00
|
|
|
(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))
|
2016-01-27 17:06:08 -05:00
|
|
|
(declare-function xwidget-query-on-exit-flag "xwidget.c" (xwidget))
|
2021-11-15 13:12:45 +08:00
|
|
|
(declare-function xwidget-webkit-back-forward-list "xwidget.c" (xwidget &optional limit))
|
2021-11-19 18:41:53 +08:00
|
|
|
(declare-function xwidget-webkit-estimated-load-progress "xwidget.c" (xwidget))
|
2021-11-19 20:04:08 +08:00
|
|
|
(declare-function xwidget-webkit-set-cookie-storage-file "xwidget.c" (xwidget file))
|
2021-11-20 14:30:12 +08:00
|
|
|
(declare-function xwidget-live-p "xwidget.c" (xwidget))
|
2021-11-21 13:32:03 +08:00
|
|
|
(declare-function xwidget-webkit-stop-loading "xwidget.c" (xwidget))
|
2021-12-30 15:04:18 +08:00
|
|
|
(declare-function xwidget-info "xwidget.c" (xwidget))
|
2016-01-19 18:44:29 -05:00
|
|
|
|
2020-08-12 12:34:29 +02:00
|
|
|
(defgroup xwidget nil
|
|
|
|
"Displaying native widgets in Emacs buffers."
|
|
|
|
:group 'widgets)
|
|
|
|
|
2021-11-07 08:50:59 +08:00
|
|
|
(defun xwidget-insert (pos type title width height &optional args related)
|
2016-01-25 18:17:33 -05:00
|
|
|
"Insert an xwidget at position POS.
|
2021-11-07 08:50:59 +08:00
|
|
|
Supply the xwidget's TYPE, TITLE, WIDTH, HEIGHT, and RELATED.
|
2016-01-25 18:17:33 -05:00
|
|
|
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 20:27:12 +01:00
|
|
|
(goto-char pos)
|
2021-11-07 08:50:59 +08:00
|
|
|
(let ((id (make-xwidget type title width height args nil related)))
|
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 20:27:12 +01:00
|
|
|
(put-text-property (point) (+ 1 (point))
|
|
|
|
'display (list 'xwidget ':xwidget id))
|
|
|
|
id))
|
|
|
|
|
|
|
|
(defun xwidget-at (pos)
|
|
|
|
"Return xwidget at POS."
|
|
|
|
(let* ((disp (get-text-property pos 'display))
|
2024-07-14 01:46:07 -05:00
|
|
|
(xw (ignore-errors (car (cdr (cdr disp))))))
|
2021-11-20 14:30:12 +08:00
|
|
|
(when (xwidget-live-p xw) xw)))
|
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 20:27:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;;; webkit support
|
|
|
|
(require 'browse-url)
|
|
|
|
(require 'image-mode);;for some image-mode alike functionality
|
2020-08-12 12:34:29 +02:00
|
|
|
(require 'seq)
|
|
|
|
(require 'url-handlers)
|
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 20:27:12 +01:00
|
|
|
|
2021-11-09 04:52:59 +01:00
|
|
|
(defgroup xwidget-webkit nil
|
|
|
|
"Displaying webkit xwidgets in Emacs buffers."
|
|
|
|
:version "29.1"
|
|
|
|
:group 'web
|
|
|
|
:prefix "xwidget-webkit-")
|
|
|
|
|
2021-11-11 18:24:49 +08:00
|
|
|
(defcustom xwidget-webkit-buffer-name-format "*xwidget-webkit: %T*"
|
|
|
|
"Template for naming `xwidget-webkit' buffers.
|
|
|
|
It can use the following special constructs:
|
|
|
|
|
2021-11-11 18:45:52 +08:00
|
|
|
%T -- the title of the Web page loaded by the xwidget.
|
|
|
|
%U -- the URI of the Web page loaded by the xwidget."
|
2021-11-09 04:52:59 +01:00
|
|
|
:type 'string
|
|
|
|
:version "29.1")
|
|
|
|
|
2021-11-20 08:38:04 +08:00
|
|
|
(defcustom xwidget-webkit-cookie-file nil
|
2021-11-19 15:41:48 +02:00
|
|
|
"The name of the file where `xwidget-webkit-browse-url' will store cookies.
|
|
|
|
They will be stored as plain text in Mozilla \"cookies.txt\"
|
2021-11-20 14:11:13 +08:00
|
|
|
format. If nil, do not store cookies. You must kill all xwidget-webkit
|
|
|
|
buffers for this setting to take effect after setting it to nil."
|
2021-11-20 14:15:46 +08:00
|
|
|
:type '(choice (const :tag "Do not store cookies" nil) file)
|
2021-11-19 20:04:08 +08:00
|
|
|
:version "29.1")
|
|
|
|
|
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 20:27:12 +01:00
|
|
|
;;;###autoload
|
|
|
|
(defun xwidget-webkit-browse-url (url &optional new-session)
|
|
|
|
"Ask xwidget-webkit to browse URL.
|
2016-01-25 18:17:33 -05: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 20:27:12 +01:00
|
|
|
(interactive (progn
|
|
|
|
(require 'browse-url)
|
2021-08-23 01:52:16 +02:00
|
|
|
(browse-url-interactive-arg "xwidget-webkit URL: ")))
|
2016-01-27 17:01:30 -05: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 20:27:12 +01:00
|
|
|
(when (stringp url)
|
2020-07-20 12:21:39 +02:00
|
|
|
;; If it's a "naked url", just try adding https: to it.
|
|
|
|
(unless (string-match "\\`[A-Za-z]+:" url)
|
|
|
|
(setq url (concat "https://" 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 20:27:12 +01:00
|
|
|
(if new-session
|
|
|
|
(xwidget-webkit-new-session url)
|
|
|
|
(xwidget-webkit-goto-url url))))
|
|
|
|
|
2022-07-14 19:50:39 +08:00
|
|
|
(function-put 'xwidget-webkit-browse-url 'browse-url-browser-kind 'internal)
|
|
|
|
|
2020-08-12 12:12:34 +02:00
|
|
|
(defun xwidget-webkit-clone-and-split-below ()
|
|
|
|
"Clone current URL into a new widget place in new window below.
|
|
|
|
Get the URL of current session, then browse to the URL
|
|
|
|
in `split-window-below' with a new xwidget webkit session."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive nil xwidget-webkit-mode)
|
2021-12-31 10:25:52 +01:00
|
|
|
(let ((url (xwidget-webkit-uri (xwidget-webkit-current-session))))
|
2020-08-12 12:12:34 +02:00
|
|
|
(with-selected-window (split-window-below)
|
|
|
|
(xwidget-webkit-new-session url))))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-clone-and-split-right ()
|
|
|
|
"Clone current URL into a new widget place in new window right.
|
|
|
|
Get the URL of current session, then browse to the URL
|
|
|
|
in `split-window-right' with a new xwidget webkit session."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive nil xwidget-webkit-mode)
|
2021-12-31 10:25:52 +01:00
|
|
|
(let ((url (xwidget-webkit-uri (xwidget-webkit-current-session))))
|
2020-08-12 12:12:34 +02:00
|
|
|
(with-selected-window (split-window-right)
|
|
|
|
(xwidget-webkit-new-session url))))
|
|
|
|
|
2021-11-05 14:47:26 +08:00
|
|
|
(declare-function xwidget-perform-lispy-event "xwidget.c")
|
|
|
|
|
2021-11-12 17:48:56 +08:00
|
|
|
(defvar xwidget-webkit--input-method-events nil
|
|
|
|
"Internal variable used to store input method events.")
|
|
|
|
|
2021-11-19 18:41:53 +08:00
|
|
|
(defvar-local xwidget-webkit--loading-p nil
|
|
|
|
"Whether or not a page is being loaded.")
|
|
|
|
|
|
|
|
(defvar-local xwidget-webkit--progress-update-timer nil
|
|
|
|
"Timer that updates the display of page load progress in the header line.")
|
|
|
|
|
2021-11-12 17:48:56 +08:00
|
|
|
(defun xwidget-webkit-pass-command-event-with-input-method ()
|
|
|
|
"Handle a `with-input-method' event."
|
|
|
|
(interactive)
|
|
|
|
(let ((key (pop unread-command-events)))
|
|
|
|
(setq xwidget-webkit--input-method-events
|
|
|
|
(funcall input-method-function key))
|
|
|
|
(exit-minibuffer)))
|
|
|
|
|
2021-11-05 14:47:26 +08:00
|
|
|
(defun xwidget-webkit-pass-command-event ()
|
2021-11-12 17:48:56 +08:00
|
|
|
"Pass `last-command-event' to the current buffer's WebKit widget.
|
|
|
|
If `current-input-method' is non-nil, consult `input-method-function'
|
|
|
|
for the actual events that will be sent."
|
2021-11-05 14:47:26 +08:00
|
|
|
(interactive)
|
2021-11-12 17:48:56 +08:00
|
|
|
(if (and current-input-method
|
|
|
|
(characterp last-command-event))
|
|
|
|
(let ((xwidget-webkit--input-method-events nil)
|
|
|
|
(minibuffer-local-map (make-keymap)))
|
|
|
|
(define-key minibuffer-local-map [with-input-method]
|
|
|
|
'xwidget-webkit-pass-command-event-with-input-method)
|
|
|
|
(push last-command-event unread-command-events)
|
|
|
|
(push 'with-input-method unread-command-events)
|
|
|
|
(read-from-minibuffer "" nil nil nil nil nil t)
|
|
|
|
(dolist (event xwidget-webkit--input-method-events)
|
|
|
|
(xwidget-perform-lispy-event (xwidget-webkit-current-session)
|
|
|
|
event)))
|
|
|
|
(xwidget-perform-lispy-event (xwidget-webkit-current-session)
|
|
|
|
last-command-event)))
|
2021-11-05 14:47:26 +08:00
|
|
|
|
2022-07-21 09:19:14 +08:00
|
|
|
;;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)
|
|
|
|
(define-key map "b" 'xwidget-webkit-back)
|
|
|
|
(define-key map "f" 'xwidget-webkit-forward)
|
|
|
|
(define-key map "r" 'xwidget-webkit-reload)
|
|
|
|
(define-key map "\C-m" 'xwidget-webkit-insert-string)
|
|
|
|
(define-key map "w" 'xwidget-webkit-current-url)
|
|
|
|
(define-key map "+" 'xwidget-webkit-zoom-in)
|
|
|
|
(define-key map "-" 'xwidget-webkit-zoom-out)
|
|
|
|
(define-key map "e" 'xwidget-webkit-edit-mode)
|
|
|
|
(define-key map "\C-r" 'xwidget-webkit-isearch-mode)
|
|
|
|
(define-key map "\C-s" 'xwidget-webkit-isearch-mode)
|
|
|
|
(define-key map "H" 'xwidget-webkit-browse-history)
|
|
|
|
|
|
|
|
;;similar to image mode bindings
|
|
|
|
(define-key map (kbd "SPC") 'xwidget-webkit-scroll-up)
|
|
|
|
(define-key map (kbd "S-SPC") 'xwidget-webkit-scroll-down)
|
|
|
|
(define-key map (kbd "DEL") 'xwidget-webkit-scroll-down)
|
|
|
|
|
|
|
|
(define-key map [remap scroll-up] 'xwidget-webkit-scroll-up-line)
|
|
|
|
(define-key map [remap scroll-up-command] 'xwidget-webkit-scroll-up)
|
|
|
|
|
|
|
|
(define-key map [remap scroll-down] 'xwidget-webkit-scroll-down-line)
|
|
|
|
(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] 'xwidget-webkit-scroll-down-line)
|
|
|
|
(define-key map [remap next-line] 'xwidget-webkit-scroll-up-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] 'xwidget-webkit-scroll-top)
|
|
|
|
(define-key map [remap end-of-buffer] 'xwidget-webkit-scroll-bottom)
|
|
|
|
map)
|
|
|
|
"Keymap for `xwidget-webkit-mode'.")
|
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 20:27:12 +01:00
|
|
|
|
2021-11-05 18:53:50 +08:00
|
|
|
(easy-menu-define nil xwidget-webkit-mode-map "Xwidget WebKit menu."
|
|
|
|
(list "Xwidget WebKit"
|
|
|
|
["Browse URL" xwidget-webkit-browse-url
|
|
|
|
:active t
|
|
|
|
:help "Prompt for a URL, then instruct WebKit to browse it"]
|
|
|
|
["Back" xwidget-webkit-back t]
|
|
|
|
["Forward" xwidget-webkit-forward t]
|
|
|
|
["Reload" xwidget-webkit-reload t]
|
2021-11-15 13:12:45 +08:00
|
|
|
["History" xwidget-webkit-browse-history t]
|
2021-11-05 18:53:50 +08:00
|
|
|
["Insert String" xwidget-webkit-insert-string
|
|
|
|
:active t
|
|
|
|
:help "Insert a string into the currently active field"]
|
|
|
|
["Zoom In" xwidget-webkit-zoom-in t]
|
|
|
|
["Zoom Out" xwidget-webkit-zoom-out t]
|
|
|
|
["Edit Mode" xwidget-webkit-edit-mode
|
|
|
|
:active t
|
|
|
|
:style toggle
|
|
|
|
:selected xwidget-webkit-edit-mode
|
2021-11-05 19:40:24 +08:00
|
|
|
:help "Send self inserting characters to the WebKit widget"]
|
|
|
|
["Save Selection" xwidget-webkit-copy-selection-as-kill
|
|
|
|
:active t
|
2021-11-06 18:27:48 +08:00
|
|
|
:help "Save the browser's selection in the kill ring"]
|
|
|
|
["Incremental Search" xwidget-webkit-isearch-mode
|
|
|
|
:active (not xwidget-webkit-isearch-mode)
|
2021-11-21 13:32:03 +08:00
|
|
|
:help "Perform incremental search inside the WebKit widget"]
|
|
|
|
["Stop Loading" xwidget-webkit-stop
|
|
|
|
:active xwidget-webkit--loading-p]))
|
2021-11-05 18:53:50 +08:00
|
|
|
|
2021-11-05 19:32:20 +08:00
|
|
|
(defvar xwidget-webkit-tool-bar-map
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
(prog1 map
|
2021-11-21 13:32:03 +08:00
|
|
|
(tool-bar-local-item-from-menu 'xwidget-webkit-stop
|
|
|
|
"cancel"
|
|
|
|
map
|
|
|
|
xwidget-webkit-mode-map)
|
2021-11-05 19:32:20 +08:00
|
|
|
(tool-bar-local-item-from-menu 'xwidget-webkit-back
|
|
|
|
"left-arrow"
|
|
|
|
map
|
|
|
|
xwidget-webkit-mode-map)
|
|
|
|
(tool-bar-local-item-from-menu 'xwidget-webkit-forward
|
|
|
|
"right-arrow"
|
|
|
|
map
|
|
|
|
xwidget-webkit-mode-map)
|
|
|
|
(tool-bar-local-item-from-menu 'xwidget-webkit-reload
|
|
|
|
"refresh"
|
|
|
|
map
|
|
|
|
xwidget-webkit-mode-map)
|
|
|
|
(tool-bar-local-item-from-menu 'xwidget-webkit-zoom-in
|
|
|
|
"zoom-in"
|
|
|
|
map
|
|
|
|
xwidget-webkit-mode-map)
|
|
|
|
(tool-bar-local-item-from-menu 'xwidget-webkit-zoom-out
|
|
|
|
"zoom-out"
|
|
|
|
map
|
|
|
|
xwidget-webkit-mode-map)
|
|
|
|
(tool-bar-local-item-from-menu 'xwidget-webkit-browse-url
|
|
|
|
"connect-to-url"
|
|
|
|
map
|
2021-11-06 18:27:48 +08:00
|
|
|
xwidget-webkit-mode-map)
|
|
|
|
(tool-bar-local-item-from-menu 'xwidget-webkit-isearch-mode
|
|
|
|
"search"
|
|
|
|
map
|
2021-11-05 19:32:20 +08:00
|
|
|
xwidget-webkit-mode-map))))
|
|
|
|
|
2016-10-25 23:00:35 -07:00
|
|
|
(defun xwidget-webkit-zoom-in ()
|
|
|
|
"Increase webkit view zoom factor."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive nil xwidget-webkit-mode)
|
2016-10-25 23:00:35 -07:00
|
|
|
(xwidget-webkit-zoom (xwidget-webkit-current-session) 0.1))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-zoom-out ()
|
|
|
|
"Decrease webkit view zoom factor."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive nil xwidget-webkit-mode)
|
2016-10-25 23:00:35 -07:00
|
|
|
(xwidget-webkit-zoom (xwidget-webkit-current-session) -0.1))
|
|
|
|
|
2020-08-12 12:34:29 +02:00
|
|
|
(defun xwidget-webkit-scroll-up (&optional arg)
|
|
|
|
"Scroll webkit up by ARG pixels; or full window height if no ARG.
|
|
|
|
Stop if bottom of page is reached.
|
|
|
|
Interactively, ARG is the prefix numeric argument.
|
|
|
|
Negative ARG scrolls down."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive "P" xwidget-webkit-mode)
|
2016-10-25 23:00:35 -07:00
|
|
|
(xwidget-webkit-execute-script
|
|
|
|
(xwidget-webkit-current-session)
|
2020-08-12 12:34:29 +02:00
|
|
|
(format "window.scrollBy(0, %d);"
|
|
|
|
(or arg (xwidget-window-inside-pixel-height (selected-window))))))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-scroll-down (&optional arg)
|
|
|
|
"Scroll webkit down by ARG pixels; or full window height if no ARG.
|
|
|
|
Stop if top of page is reached.
|
|
|
|
Interactively, ARG is the prefix numeric argument.
|
|
|
|
Negative ARG scrolls up."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive "P" xwidget-webkit-mode)
|
2016-10-25 23:00:35 -07:00
|
|
|
(xwidget-webkit-execute-script
|
|
|
|
(xwidget-webkit-current-session)
|
2020-08-12 12:34:29 +02:00
|
|
|
(format "window.scrollBy(0, -%d);"
|
|
|
|
(or arg (xwidget-window-inside-pixel-height (selected-window))))))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-scroll-up-line (&optional n)
|
|
|
|
"Scroll webkit up by N lines.
|
|
|
|
The height of line is calculated with `window-font-height'.
|
|
|
|
Stop if the bottom edge of the page is reached.
|
|
|
|
If N is omitted or nil, scroll up by one line."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive "p" xwidget-webkit-mode)
|
2020-08-12 12:34:29 +02:00
|
|
|
(xwidget-webkit-scroll-up (* n (window-font-height))))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-scroll-down-line (&optional n)
|
|
|
|
"Scroll webkit down by N lines.
|
|
|
|
The height of line is calculated with `window-font-height'.
|
|
|
|
Stop if the top edge of the page is reached.
|
|
|
|
If N is omitted or nil, scroll down by one line."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive "p" xwidget-webkit-mode)
|
2020-08-12 12:34:29 +02:00
|
|
|
(xwidget-webkit-scroll-down (* n (window-font-height))))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-scroll-forward (&optional n)
|
|
|
|
"Scroll webkit horizontally by N chars.
|
2021-12-30 15:04:18 +08:00
|
|
|
If the widget is larger than the window, hscroll by N columns
|
|
|
|
instead. The width of char is calculated with
|
|
|
|
`window-font-width'. If N is omitted or nil, scroll forwards by
|
|
|
|
one char."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive "p" xwidget-webkit-mode)
|
2021-12-30 15:04:18 +08:00
|
|
|
(let ((session (xwidget-webkit-current-session)))
|
|
|
|
(if (> (- (aref (xwidget-info session) 2)
|
|
|
|
(window-text-width nil t))
|
|
|
|
(window-font-width))
|
|
|
|
(set-window-hscroll nil (+ (window-hscroll) n))
|
|
|
|
(xwidget-webkit-execute-script session
|
|
|
|
(format "window.scrollBy(%d, 0);"
|
|
|
|
(* n (window-font-width)))))))
|
2020-08-12 12:34:29 +02:00
|
|
|
|
|
|
|
(defun xwidget-webkit-scroll-backward (&optional n)
|
|
|
|
"Scroll webkit back by N chars.
|
2021-12-30 15:04:18 +08:00
|
|
|
If the widget is larger than the window, hscroll backwards by N
|
|
|
|
columns instead. The width of char is calculated with
|
|
|
|
`window-font-width'. If N is omitted or nil, scroll backwards by
|
|
|
|
one char."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive "p" xwidget-webkit-mode)
|
2021-12-30 15:04:18 +08:00
|
|
|
(let ((session (xwidget-webkit-current-session)))
|
|
|
|
(if (and (> (- (aref (xwidget-info session) 2)
|
|
|
|
(window-text-width nil t))
|
|
|
|
(window-font-width))
|
|
|
|
(> (window-hscroll) 0))
|
|
|
|
(set-window-hscroll nil (- (window-hscroll) n))
|
|
|
|
(xwidget-webkit-execute-script session
|
2024-06-18 17:14:41 -05:00
|
|
|
(format "window.scrollBy(-%d, 0);"
|
2021-12-30 15:04:18 +08:00
|
|
|
(* n (window-font-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 20:27:12 +01:00
|
|
|
|
2016-10-25 23:00:35 -07:00
|
|
|
(defun xwidget-webkit-scroll-top ()
|
|
|
|
"Scroll webkit to the very top."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive nil xwidget-webkit-mode)
|
2016-10-25 23:00:35 -07:00
|
|
|
(xwidget-webkit-execute-script
|
|
|
|
(xwidget-webkit-current-session)
|
|
|
|
"window.scrollTo(pageXOffset, 0);"))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-scroll-bottom ()
|
|
|
|
"Scroll webkit to the very bottom."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive nil xwidget-webkit-mode)
|
2016-10-25 23:00:35 -07:00
|
|
|
(xwidget-webkit-execute-script
|
|
|
|
(xwidget-webkit-current-session)
|
2020-08-12 12:34:29 +02:00
|
|
|
"window.scrollTo(pageXOffset, window.document.body.scrollHeight);"))
|
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 20:27:12 +01:00
|
|
|
|
2021-11-20 14:57:22 +08:00
|
|
|
;; The xwidget event needs to go in the special map. To receive
|
|
|
|
;; xwidget events, you should place a callback in the property list of
|
|
|
|
;; the xwidget, instead of handling these events manually.
|
|
|
|
;;
|
|
|
|
;; See `xwidget-webkit-new-session' for an example of how to do this.
|
|
|
|
(define-key special-event-map [xwidget-event] #'xwidget-event-handler)
|
|
|
|
|
2016-01-19 20:53:10 -05:00
|
|
|
(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 20:27:12 +01:00
|
|
|
"Log MSG to a buffer."
|
2016-01-19 20:53:10 -05: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 20:27:12 +01:00
|
|
|
(insert "\n"))))
|
|
|
|
|
|
|
|
(defun xwidget-event-handler ()
|
|
|
|
"Receive xwidget event."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive nil xwidget-webkit-mode)
|
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 20:27:12 +01:00
|
|
|
(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))
|
2020-08-11 16:23:10 +02:00
|
|
|
(xwidget-callback (xwidget-get xwidget 'callback)))
|
2021-11-09 05:48:28 +01:00
|
|
|
(when xwidget-callback
|
|
|
|
(funcall xwidget-callback xwidget 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 20:27:12 +01:00
|
|
|
|
2021-11-19 18:41:53 +08:00
|
|
|
(defun xwidget-webkit--update-progress-timer-function (xwidget)
|
|
|
|
"Force an update of the header line of XWIDGET's buffer."
|
|
|
|
(with-current-buffer (xwidget-buffer xwidget)
|
|
|
|
(force-mode-line-update)))
|
|
|
|
|
2021-12-07 13:44:52 +08:00
|
|
|
(defun xwidget-webkit-buffer-kill ()
|
|
|
|
"Clean up an xwidget-webkit buffer before it is killed."
|
|
|
|
(when (timerp xwidget-webkit--progress-update-timer)
|
|
|
|
(cancel-timer xwidget-webkit--progress-update-timer)))
|
|
|
|
|
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 20:27:12 +01:00
|
|
|
(defun xwidget-webkit-callback (xwidget xwidget-event-type)
|
|
|
|
"Callback for xwidgets.
|
|
|
|
XWIDGET instance, XWIDGET-EVENT-TYPE depends on the originating xwidget."
|
2016-01-19 20:53:10 -05:00
|
|
|
(if (not (buffer-live-p (xwidget-buffer xwidget)))
|
|
|
|
(xwidget-log
|
|
|
|
"error: callback called for xwidget with dead buffer")
|
2021-11-09 04:52:59 +01:00
|
|
|
(cond ((eq xwidget-event-type 'load-changed)
|
2021-11-11 18:45:52 +08:00
|
|
|
(let ((title (xwidget-webkit-title xwidget))
|
|
|
|
(uri (xwidget-webkit-uri xwidget)))
|
Mark if-let and when-let obsolete
* lisp/subr.el (if-let*, when-let*, if-let, when-let): Mark
if-let and when-let obsolete (bug#73853 and elsewhere). Move
docstring text around so that if-let* and when-let* descriptions
no longer refer to if-let and when-let.
* etc/NEWS: Announce the change.
* admin/admin.el (reminder-for-release-blocking-bugs):
* doc/misc/erc.texi (display-buffer):
* lisp/ansi-color.el (ansi-color-apply)
(ansi-color--face-vec-face):
* lisp/ansi-osc.el (ansi-osc-apply-on-region)
(ansi-osc-hyperlink):
* lisp/arc-mode.el (archive-goto-file)
(archive-next-file-displayer):
* lisp/auth-source-pass.el (auth-source-pass-search)
(auth-source-pass--parse-data)
(auth-source-pass--find-match-many):
* lisp/autorevert.el (auto-revert-notify-rm-watch):
* lisp/buff-menu.el (Buffer-menu-unmark-all-buffers)
(Buffer-menu-group-by-root):
* lisp/calendar/parse-time.el (parse-iso8601-time-string):
* lisp/cedet/pulse.el (pulse-tick):
* lisp/comint.el (comint--fontify-input-ppss-flush-indirect)
(comint--intersect-regions):
* lisp/completion-preview.el (completion-preview--try-table)
(completion-preview--capf-wrapper, completion-preview--update):
* lisp/cus-edit.el (setopt--set)
(custom-dirlocals-maybe-update-cons, custom-dirlocals-validate):
* lisp/custom.el (load-theme):
* lisp/descr-text.el (describe-char):
* lisp/desktop.el (desktop--emacs-pid-running-p):
* lisp/dired-x.el (menu):
* lisp/dired.el (dired-font-lock-keywords)
(dired-insert-directory, dired--insert-disk-space, dired-mode):
* lisp/dnd.el (dnd-handle-multiple-urls):
* lisp/dom.el (dom-remove-attribute):
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
* lisp/emacs-lisp/bytecomp.el (bytecomp--custom-declare):
* lisp/emacs-lisp/comp-common.el (comp-function-type-spec):
* lisp/emacs-lisp/comp-cstr.el (comp--all-classes)
(comp-cstr-set-range-for-arithm, comp--cstr-union-1-no-mem)
(comp-cstr-intersection-no-mem, comp-cstr-fixnum-p)
(comp-cstr-type-p):
* lisp/emacs-lisp/comp-run.el (comp-subr-trampoline-install)
(native--compile-async):
* lisp/emacs-lisp/comp.el (comp--get-function-cstr)
(comp--function-pure-p, comp--intern-func-in-ctxt)
(comp--addr-to-bb-name, comp--emit-assume, comp--maybe-add-vmvar)
(comp--add-call-cstr, comp--compute-dominator-tree)
(comp--dom-tree-walker, comp--ssa-rename)
(comp--function-call-maybe-fold, comp--fwprop-call)
(comp--call-optim-func):
* lisp/emacs-lisp/edebug.el (edebug-global-prefix)
(edebug-remove-instrumentation):
* lisp/emacs-lisp/eieio.el (initialize-instance):
* lisp/emacs-lisp/ert-x.el (ert-resource-directory):
* lisp/emacs-lisp/ert.el (ert--expand-should-1)
(ert-test-location, ert-write-junit-test-report)
(ert-test--erts-test):
* lisp/emacs-lisp/icons.el (icon-complete-spec, icon-string)
(icons--create):
* lisp/emacs-lisp/lisp-mode.el (lisp--local-defform-body-p):
* lisp/emacs-lisp/loaddefs-gen.el
(loaddefs-generate--make-autoload)
(loaddefs-generate--parse-file):
* lisp/emacs-lisp/multisession.el
(multisession-edit-mode--revert, multisession-edit-value):
* lisp/emacs-lisp/package-vc.el (package-vc--read-archive-data)
(package-vc--version, package-vc--clone):
* lisp/emacs-lisp/package.el (package--reload-previously-loaded):
* lisp/emacs-lisp/pp.el (pp--insert-lisp):
* lisp/emacs-lisp/subr-x.el (add-display-text-property):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-print):
* lisp/emacs-lisp/timer.el (run-at-time):
* lisp/emacs-lisp/vtable.el (vtable-goto-table)
(vtable-goto-column, vtable-update-object, vtable--insert-line)
(vtable--compute-widths, vtable--make-keymap):
* lisp/emacs-lisp/warnings.el (display-warning):
* lisp/epa-file.el (epa-file-insert-file-contents):
* lisp/epa.el (epa-show-key):
* lisp/erc/erc-backend.el (erc--split-line, erc--conceal-prompt)
(PRIVMSG, erc--get-isupport-entry):
* lisp/erc/erc-button.el (erc-button-add-nickname-buttons)
(erc--button-next):
* lisp/erc/erc-common.el (erc--find-group):
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static)
(erc-fill--wrap-escape-hidden-speaker)
(erc-fill--wrap-unmerge-on-date-stamp)
(erc-fill--wrap-massage-initial-message-post-clear)
(erc-fill-wrap, erc-fill--wrap-rejigger-region):
* lisp/erc/erc-goodies.el (erc--scrolltobottom-all)
(erc--keep-place-indicator-on-window-buffer-change)
(keep-place-indicator, erc--keep-place-indicator-adjust-on-clear)
(erc-keep-place-move, erc--command-indicator-display):
* lisp/erc/erc-ibuffer.el (erc-members):
* lisp/erc/erc-join.el (erc-join--remove-requested-channel)
(erc-autojoin--join):
* lisp/erc/erc-networks.el
(erc-networks--id-qualifying-init-parts, erc-networks--id-reload)
(erc-networks--id-ensure-comparable)
(erc-networks--reclaim-orphaned-target-buffers)
(erc-networks--server-select):
* lisp/erc/erc-nicks.el (erc-nicks-invert)
(erc-nicks--redirect-face-widget-link, erc-nicks--highlight)
(erc-nicks--highlight-button)
(erc-nicks--list-faces-help-button-action, erc-nicks-list-faces)
(erc-nicks-refresh, erc-nicks--colors-from-faces)
(erc-nicks--track-prioritize)
(erc-nicks--remember-face-for-track):
* lisp/erc/erc-notify.el (querypoll, erc--querypoll-get-next)
(erc--querypoll-on-352, erc--querypoll-send):
* lisp/erc/erc-sasl.el (erc-sasl--read-password):
* lisp/erc/erc-services.el
(erc-services-issue-ghost-and-retry-nick):
* lisp/erc/erc-speedbar.el (erc-speedbar--ensure, nickbar)
(erc-speedbar-toggle-nicknames-window-lock)
(erc-speedbar--compose-nicks-face):
* lisp/erc/erc-stamp.el (erc-stamp--recover-on-reconnect)
(erc-stamp-prefix-log-filter, erc--conceal-prompt)
(erc--insert-timestamp-left, erc-insert-timestamp-right)
(erc-stamp--defer-date-insertion-on-post-modify)
(erc-insert-timestamp-left-and-right)
(erc-stamp--redo-right-stamp-post-clear)
(erc-stamp--reset-on-clear, erc-stamp--dedupe-date-stamps):
* lisp/erc/erc-status-sidebar.el (bufbar)
(erc-status-sidebar-prefer-target-as-name)
(erc-status-sidebar-default-allsort, erc-status-sidebar-click):
* lisp/erc/erc-track.el (erc-track--shortened-names-get)
(erc-track--setup, erc-track--select-mode-line-face)
(erc-track-modified-channels, erc-track--collect-faces-in)
(erc-track--switch-buffer, erc-track--replace-killed-buffer):
* lisp/erc/erc-truncate.el (erc-truncate--setup)
(erc-truncate-buffer):
* lisp/erc/erc.el (erc--ensure-query-member)
(erc--ensure-query-members, erc--remove-channel-users-but)
(erc--cusr-change-status, erc--find-mode, erc--update-modules)
(erc-log-irc-protocol, erc--refresh-prompt)
(erc--restore-important-text-props)
(erc--order-text-properties-from-hash, erc-send-input-line)
(erc-cmd-IGNORE, erc--unignore-user, erc-cmd-QUERY)
(erc-cmd-BANLIST, erc--speakerize-nick)
(erc--format-speaker-input-message, erc-channel-receive-names)
(erc-send-current-line, erc-format-target-and/or-network)
(erc-kill-buffer-function, erc-restore-text-properties)
(erc--get-eq-comparable-cmd):
* lisp/eshell/em-alias.el (eshell-maybe-replace-by-alias--which)
(eshell-maybe-replace-by-alias):
* lisp/eshell/em-glob.el (eshell-glob-convert):
* lisp/eshell/em-pred.el (eshell-pred-user-or-group)
(eshell-pred-file-time, eshell-pred-file-type)
(eshell-pred-file-mode, eshell-pred-file-links)
(eshell-pred-file-size):
* lisp/eshell/em-prompt.el (eshell-forward-paragraph)
(eshell-next-prompt):
* lisp/eshell/esh-arg.el (eshell-resolve-current-argument):
* lisp/eshell/esh-cmd.el (eshell-do-eval, eshell/which)
(eshell-plain-command--which, eshell-plain-command):
* lisp/eshell/esh-io.el (eshell-duplicate-handles)
(eshell-protect-handles, eshell-get-target, eshell-close-target):
* lisp/eshell/esh-proc.el (eshell-sentinel):
* lisp/eshell/esh-var.el (eshell-parse-variable-ref)
(eshell-get-variable, eshell-set-variable):
* lisp/faces.el (face-at-point):
* lisp/ffap.el (ffap-in-project):
* lisp/filenotify.el (file-notify--rm-descriptor):
* lisp/files-x.el (read-dir-locals-file)
(connection-local-update-profile-variables)
(connection-local-value):
* lisp/files.el (file-remote-p, abbreviate-file-name)
(set-auto-mode, hack-local-variables)
(revert-buffer-restore-read-only):
* lisp/find-dired.el (find-dired-sort-by-filename):
* lisp/font-lock.el (font-lock--filter-keywords):
* lisp/gnus/gnus-art.el (article-emojize-symbols):
* lisp/gnus/gnus-int.el (gnus-close-server):
* lisp/gnus/gnus-search.el (gnus-search-transform)
(gnus-search-indexed-parse-output, gnus-search-server-to-engine):
* lisp/gnus/gnus-sum.el (gnus-collect-urls, gnus-shorten-url):
* lisp/gnus/gnus.el (gnus-check-backend-function):
* lisp/gnus/message.el (message-send-mail):
* lisp/gnus/mml.el (mml-generate-mime, mml-insert-mime-headers):
* lisp/gnus/nnatom.el (nnatom--read-feed, nnatom--read-article)
(nnatom--read-article-or-group-authors, nnatom--read-publish)
(nnatom--read-update, nnatom--read-links):
* lisp/gnus/nnfeed.el (nnfeed--read-server, nnfeed--write-server)
(nnfeed--parse-feed, nnfeed--group-data, nnfeed-retrieve-article)
(nnfeed-retrieve-headers, nnfeed--print-part)
(nnfeed-request-article, nnfeed-request-group)
(nnfeed-request-list, nnfeed--group-description)
(nnfeed-request-group-description)
(nnfeed-request-list-newsgroups, nnfeed-request-rename-group):
* lisp/gnus/nnmh.el (nnmh-update-gnus-unreads):
* lisp/help-fns.el (help-find-source)
(help-fns--insert-menu-bindings, help-fns--mention-first-release)
(help-fns--mention-shortdoc-groups)
(help-fns--customize-variable-version)
(help-fns--face-custom-version-info, describe-mode):
* lisp/help-mode.el (help-make-xrefs):
* lisp/help.el (help-key-description, help--describe-command):
* lisp/hfy-cmap.el (htmlfontify-load-rgb-file):
* lisp/ibuf-ext.el (ibuffer-jump-to-filter-group)
(ibuffer-kill-filter-group, ibuffer-kill-line)
(ibuffer-save-filter-groups, ibuffer-save-filters, filename)
(basename, file-extension, ibuffer-diff-buffer-with-file-1)
(ibuffer-mark-by-file-name-regexp)
(ibuffer-mark-by-content-regexp):
* lisp/ibuf-macs.el (ibuffer-aif, ibuffer-awhen):
* lisp/ibuffer.el (ibuffer-mouse-toggle-mark)
(ibuffer-toggle-marks, ibuffer-mark-interactive)
(ibuffer-compile-format, process, ibuffer-map-lines):
* lisp/image.el (image--compute-map)
(image--compute-original-map):
* lisp/image/exif.el (exif-parse-buffer):
* lisp/image/image-converter.el (image-convert-p, image-convert)
(image-converter--find-converter):
* lisp/image/image-dired-util.el
(image-dired-file-name-at-point):
* lisp/image/image-dired.el (image-dired-track-original-file)
(image-dired--on-file-in-dired-buffer)
(image-dired--with-thumbnail-buffer)
(image-dired-jump-original-dired-buffer)
(image-dired--slideshow-step, image-dired-display-image):
* lisp/image/wallpaper.el (wallpaper--init-action-kill)
(wallpaper--find-setter, wallpaper--find-command)
(wallpaper--find-command-args, wallpaper--x-monitor-name):
* lisp/info-look.el (info-lookup-interactive-arguments)
(info-complete)::(:mode):
* lisp/info.el (info-pop-to-buffer, Info-read-node-name-1):
* lisp/international/emoji.el (emoji--adjust-displayable-1)
(emoji--add-recent):
* lisp/jsonrpc.el (jsonrpc--call-deferred)
(jsonrpc--process-sentinel, jsonrpc--remove):
* lisp/keymap.el (keymap-local-lookup):
* lisp/mail/emacsbug.el (report-emacs-bug-hook)
(submit-emacs-patch):
* lisp/mail/ietf-drums.el (ietf-drums-parse-addresses):
* lisp/mail/mailclient.el (mailclient-send-it):
* lisp/mail/rfc6068.el (rfc6068-parse-mailto-url):
* lisp/mail/undigest.el (rmail-digest-parse-mixed-mime):
* lisp/minibuffer.el (completion-metadata-get)
(completions--after-change)
(minibuffer-visible-completions--filter):
* lisp/net/browse-url.el (browse-url-url-at-point)
(browse-url-file-url, browse-url-emacs):
* lisp/net/dbus.el (dbus-byte-array-to-string)
(dbus-monitor-goto-serial):
* lisp/net/dictionary.el (dictionary-search):
* lisp/net/eww.el (eww--download-directory)
(eww-auto-rename-buffer, eww-open-in-new-buffer, eww-submit)
(eww-follow-link, eww-read-alternate-url)
(eww-copy-alternate-url):
* lisp/net/goto-addr.el (goto-address-at-point):
* lisp/net/mailcap.el (mailcap-mime-info):
* lisp/net/rcirc.el (rcirc, rcirc-connect, rcirc-send-string)
(rcirc-kill-buffer-hook, rcirc-print, rcirc-when)
(rcirc-color-attributes, rcirc-handler-NICK)
(rcirc-handler-TAGMSG, rcirc-handler-BATCH):
* lisp/net/shr.el (shr-descend, shr-adaptive-fill-function)
(shr-correct-dom-case, shr-tag-a):
* lisp/net/sieve.el (sieve-manage-quit):
* lisp/outline.el (outline-cycle-buffer):
* lisp/pcmpl-git.el (pcmpl-git--tracked-file-predicate):
* lisp/proced.el (proced-auto-update-timer):
* lisp/progmodes/bug-reference.el
(bug-reference-try-setup-from-vc):
* lisp/progmodes/c-ts-common.el (c-ts-common--fill-paragraph):
* lisp/progmodes/c-ts-mode.el (c-ts-mode--preproc-offset)
(c-ts-mode--anchor-prev-sibling, c-ts-mode-indent-defun):
* lisp/progmodes/compile.el (compilation-error-properties)
(compilation-find-file-1):
* lisp/progmodes/eglot.el (eglot--check-object)
(eglot--read-server, eglot-upgrade-eglot)
(eglot-handle-notification, eglot--CompletionParams)
(eglot-completion-at-point, eglot--sig-info)
(eglot-register-capability):
* lisp/progmodes/elisp-mode.el
(emacs-lisp-native-compile-and-load)
(elisp-eldoc-var-docstring-with-value):
* lisp/progmodes/erts-mode.el (erts-mode--goto-start-of-test):
* lisp/progmodes/flymake.el (flymake--update-eol-overlays)
(flymake-eldoc-function):
* lisp/progmodes/gdb-mi.el (gdb-breakpoints-list-handler-custom)
(gdb-frame-handler):
* lisp/progmodes/go-ts-mode.el (go-ts-mode-docstring)
(go-ts-mode--comment-on-previous-line-p)
(go-ts-mode--get-test-regexp-at-point)
(go-ts-mode-test-this-file):
* lisp/progmodes/grep.el (lgrep, rgrep-default-command)
(grep-file-at-point):
* lisp/progmodes/perl-mode.el (perl--end-of-format-p):
* lisp/progmodes/php-ts-mode.el
(php-ts-mode--anchor-prev-sibling, php-ts-mode--indent-defun):
* lisp/progmodes/project.el (project--other-place-command)
(project--find-default-from, project--transplant-file-name)
(project-prefixed-buffer-name, project--remove-from-project-list)
(project-prompt-project-name, project-remember-projects-under)
(project--switch-project-command)
(project-uniquify-dirname-transform, project-mode-line-format):
* lisp/progmodes/python.el
(python-font-lock-keywords-maximum-decoration)
(python--treesit-fontify-union-types)
(python-shell-get-process-name, python-shell-restart)
(python-shell-completion-at-point, python-ffap-module-path)
(python-util-comint-end-of-output-p, python--import-sources)
(python-add-import, python-remove-import, python-fix-imports):
* lisp/progmodes/xref.el (xref--add-log-current-defun):
* lisp/repeat.el (repeat-echo-message-string):
* lisp/saveplace.el (save-place-dired-hook):
* lisp/server.el (server-save-buffers-kill-terminal):
* lisp/shadowfile.el (shadow-make-fullname)
(shadow-contract-file-name, shadow-define-literal-group):
* lisp/shell.el (shell-highlight-undef-mode):
* lisp/simple.el (command-completion-using-modes-p)
(command-execute, file-user-uid, file-group-gid)
(first-completion, last-completion, switch-to-completions):
* lisp/startup.el (startup--load-user-init-file):
* lisp/tab-line.el (tab-line-tabs-buffer-group-by-project):
* lisp/tar-mode.el (tar-goto-file, tar-next-file-displayer):
* lisp/term/android-win.el (android-encode-select-string)
(gui-backend-set-selection):
* lisp/term/haiku-win.el (haiku-dnd-convert-string)
(haiku-select-encode-xstring, haiku-select-encode-utf-8-string):
* lisp/textmodes/emacs-news-mode.el (emacs-news--buttonize):
* lisp/textmodes/ispell.el (ispell-completion-at-point):
* lisp/textmodes/sgml-mode.el (sgml-validate)
(html-mode--complete-at-point):
* lisp/textmodes/tex-mode.el (tex-recenter-output-buffer)
(xref-backend-references):
* lisp/thingatpt.el (thing-at-point-file-at-point)
(thing-at-point-face-at-point):
* lisp/thread.el (thread-list--get-status):
* lisp/time.el (world-clock-copy-time-as-kill, world-clock):
* lisp/touch-screen.el (touch-screen-handle-touch):
* lisp/treesit.el (treesit-language-at, treesit-node-at)
(treesit-node-on, treesit-buffer-root-node)
(treesit-node-field-name, treesit-local-parsers-at)
(treesit-local-parsers-on, treesit--cleanup-local-range-overlays)
(treesit-font-lock-recompute-features)
(treesit-font-lock-fontify-region, treesit-transpose-sexps)
(treesit-add-log-current-defun, treesit-major-mode-setup)
(treesit--explorer-refresh, treesit-install-language-grammar):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/vc/smerge-mode.el (smerge-diff):
* lisp/vc/vc-dir.el (vc-dir):
* lisp/vc/vc-dispatcher.el (vc-do-async-command):
* lisp/vc/vc-git.el (vc-git-dir--branch-headers)
(vc-git-dir--stash-headers, vc-git--log-edit-summary-check)
(vc-git-stash-list):
* lisp/vc/vc.el (vc-responsible-backend, vc-buffer-sync-fileset)
(vc-clone):
* lisp/visual-wrap.el (visual-wrap--apply-to-line):
* lisp/wid-edit.el (widget-text)
(widget-editable-list-insert-before):
* lisp/window-tool-bar.el
(window-tool-bar--keymap-entry-to-string):
* lisp/window.el (display-buffer, display-buffer-full-frame)
(window-point-context-set, window-point-context-use)
(window-point-context-use-default-function):
* lisp/xdg.el (xdg-current-desktop):
* lisp/xwidget.el (xwidget-webkit-callback):
* lisp/yank-media.el (yank-media--get-selection)
(yank-media-types):
* test/lisp/comint-tests.el
(comint-tests/test-password-function):
* test/lisp/completion-preview-tests.el
(completion-preview-tests--capf):
* test/lisp/cus-edit-tests.el (with-cus-edit-test):
* test/lisp/erc/erc-scenarios-base-local-modules.el
(-phony-sblm-):
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify):
* test/lisp/erc/erc-services-tests.el
(erc-services-tests--asp-parse-entry):
* test/lisp/erc/erc-tests.el (erc-modules--internal-property)
(erc--find-mode, erc-tests--update-modules):
* test/lisp/erc/resources/erc-d/erc-d-i.el
(erc-d-i--parse-message):
* test/lisp/erc/resources/erc-d/erc-d-t.el
(erc-d-t-kill-related-buffers, erc-d-t-with-cleanup):
* test/lisp/erc/resources/erc-d/erc-d-tests.el
(erc-d-i--parse-message--irc-parser-tests):
* test/lisp/erc/resources/erc-d/erc-d-u.el
(erc-d-u--read-exchange-slowly):
* test/lisp/erc/resources/erc-d/erc-d.el (erc-d--expire)
(erc-d--finalize-done, erc-d--command-handle-all):
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-common-with-cleanup):
* test/lisp/erc/resources/erc-tests-common.el
(erc-tests--common-display-message)
(erc-tests-common-create-subprocess):
* test/lisp/ibuffer-tests.el (ibuffer-test-Bug25058):
* test/lisp/international/mule-tests.el
(mule-cmds-tests--ucs-names-missing-names):
* test/lisp/progmodes/python-tests.el
(python-tests-get-shell-interpreter)
(python-tests--get-interpreter-info):
* test/lisp/progmodes/ruby-ts-mode-tests.el
(ruby-ts-resource-file):
* test/lisp/replace-tests.el (replace-tests-with-undo):
* test/src/emacs-tests.el (emacs-tests--seccomp-debug):
* test/src/process-tests.el (process-tests--emacs-command)
(process-tests--emacs-binary, process-tests--dump-file):
* test/src/treesit-tests.el (treesit--ert-test-defun-navigation):
Replace use of the now-obsolete if-let and when-let.
2024-10-24 16:50:07 +08:00
|
|
|
(when-let* ((buffer (get-buffer "*Xwidget WebKit History*")))
|
2021-11-17 09:10:10 +08:00
|
|
|
(with-current-buffer buffer
|
|
|
|
(revert-buffer)))
|
2021-11-19 18:41:53 +08:00
|
|
|
(with-current-buffer (xwidget-buffer xwidget)
|
|
|
|
(if (string-equal (nth 3 last-input-event)
|
|
|
|
"load-finished")
|
|
|
|
(progn
|
|
|
|
(setq xwidget-webkit--loading-p nil)
|
|
|
|
(cancel-timer xwidget-webkit--progress-update-timer))
|
|
|
|
(unless xwidget-webkit--loading-p
|
|
|
|
(setq xwidget-webkit--loading-p t
|
|
|
|
xwidget-webkit--progress-update-timer
|
|
|
|
(run-at-time 0.5 0.5 #'xwidget-webkit--update-progress-timer-function
|
|
|
|
xwidget)))))
|
2022-05-15 11:15:06 +02:00
|
|
|
;; This function will be called multi times, so only
|
2021-11-09 07:46:48 +01:00
|
|
|
;; change buffer name when the load actually completes
|
|
|
|
;; this can limit buffer-name flicker in mode-line.
|
|
|
|
(when (or (string-equal (nth 3 last-input-event)
|
|
|
|
"load-finished")
|
|
|
|
(> (length title) 0))
|
2021-11-09 04:52:59 +01:00
|
|
|
(with-current-buffer (xwidget-buffer xwidget)
|
|
|
|
(force-mode-line-update)
|
|
|
|
(xwidget-log "webkit finished loading: %s" title)
|
|
|
|
;; Do not adjust webkit size to window here, the
|
|
|
|
;; selected window can be the mini-buffer window
|
|
|
|
;; unwantedly.
|
2021-11-11 18:24:49 +08:00
|
|
|
(rename-buffer
|
|
|
|
(format-spec
|
|
|
|
xwidget-webkit-buffer-name-format
|
2021-11-11 18:45:52 +08:00
|
|
|
`((?T . ,title)
|
|
|
|
(?U . ,uri)))
|
2021-11-11 18:24:49 +08:00
|
|
|
t)))))
|
2021-11-09 04:52:59 +01:00
|
|
|
((eq xwidget-event-type 'decide-policy)
|
|
|
|
(let ((strarg (nth 3 last-input-event)))
|
|
|
|
(if (string-match ".*#\\(.*\\)" strarg)
|
|
|
|
(xwidget-webkit-show-id-or-named-element
|
|
|
|
xwidget
|
|
|
|
(match-string 1 strarg)))))
|
|
|
|
;; TODO: Response handling other than download.
|
|
|
|
((eq xwidget-event-type 'download-callback)
|
|
|
|
(let ((url (nth 3 last-input-event))
|
|
|
|
(mime-type (nth 4 last-input-event))
|
|
|
|
(file-name (nth 5 last-input-event)))
|
|
|
|
(xwidget-webkit-save-as-file url mime-type file-name)))
|
|
|
|
((eq xwidget-event-type 'javascript-callback)
|
|
|
|
(let ((proc (nth 3 last-input-event))
|
|
|
|
(arg (nth 4 last-input-event)))
|
|
|
|
(funcall proc arg)))
|
|
|
|
(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 20:27:12 +01:00
|
|
|
|
|
|
|
(defvar bookmark-make-record-function)
|
2020-08-12 12:12:34 +02:00
|
|
|
(when (memq window-system '(mac ns))
|
2021-08-23 01:45:10 +02:00
|
|
|
(defcustom xwidget-webkit-enable-plugins nil
|
2020-08-12 12:12:34 +02:00
|
|
|
"Enable plugins for xwidget webkit.
|
2021-08-23 01:45:10 +02:00
|
|
|
If non-nil, plugins are enabled. Otherwise, disabled."
|
|
|
|
:type 'boolean
|
|
|
|
:version "28.1"))
|
2020-08-12 12:12:34 +02:00
|
|
|
|
2021-08-23 01:52:16 +02:00
|
|
|
(define-derived-mode xwidget-webkit-mode special-mode "xwidget-webkit"
|
|
|
|
"Xwidget webkit view mode."
|
2020-08-12 12:34:29 +02:00
|
|
|
(setq buffer-read-only t)
|
2021-12-07 13:44:52 +08:00
|
|
|
(add-hook 'kill-buffer-hook #'xwidget-webkit-buffer-kill)
|
2021-11-05 19:32:20 +08:00
|
|
|
(setq-local tool-bar-map xwidget-webkit-tool-bar-map)
|
2020-08-12 12:34:29 +02:00
|
|
|
(setq-local bookmark-make-record-function
|
|
|
|
#'xwidget-webkit-bookmark-make-record)
|
2021-11-19 18:41:53 +08:00
|
|
|
(setq-local header-line-format
|
|
|
|
(list "WebKit: "
|
|
|
|
'(:eval
|
|
|
|
(xwidget-webkit-title (xwidget-webkit-current-session)))
|
|
|
|
'(:eval
|
|
|
|
(when xwidget-webkit--loading-p
|
|
|
|
(let ((session (xwidget-webkit-current-session)))
|
|
|
|
(format " [%d%%%%]"
|
|
|
|
(* 100
|
|
|
|
(xwidget-webkit-estimated-load-progress
|
|
|
|
session))))))))
|
2020-08-12 12:34:29 +02:00
|
|
|
;; Keep track of [vh]scroll when switching buffers
|
|
|
|
(image-mode-setup-winprops))
|
|
|
|
|
2020-08-12 12:39:50 +02:00
|
|
|
;;; Download, save as file.
|
|
|
|
|
|
|
|
(defcustom xwidget-webkit-download-dir "~/Downloads/"
|
|
|
|
"Directory where download file saved."
|
2020-09-15 15:35:32 +09:00
|
|
|
:version "28.1"
|
2020-08-12 12:39:50 +02:00
|
|
|
:type 'file)
|
|
|
|
|
|
|
|
(defun xwidget-webkit-save-as-file (url mime-type file-name)
|
|
|
|
"For XWIDGET webkit, save URL of MIME-TYPE to location specified by user.
|
|
|
|
FILE-NAME combined with `xwidget-webkit-download-dir' is the default file name
|
|
|
|
of the prompt when reading. When the file name the user specified is a
|
|
|
|
directory, URL is saved at the specified directory as FILE-NAME."
|
2020-09-13 14:58:24 +02:00
|
|
|
(let ((save-name (read-file-name
|
|
|
|
(format "Save URL `%s' of type `%s' in file/directory: "
|
|
|
|
url mime-type)
|
|
|
|
xwidget-webkit-download-dir
|
|
|
|
(when file-name
|
|
|
|
(expand-file-name
|
|
|
|
file-name
|
|
|
|
xwidget-webkit-download-dir)))))
|
2020-08-12 12:39:50 +02:00
|
|
|
(if (file-directory-p save-name)
|
|
|
|
(setq save-name
|
|
|
|
(expand-file-name (file-name-nondirectory file-name) save-name)))
|
|
|
|
(setq xwidget-webkit-download-dir (file-name-directory save-name))
|
|
|
|
(url-copy-file url save-name t)))
|
|
|
|
|
2020-08-12 12:34:29 +02:00
|
|
|
;;; Bookmarks integration
|
|
|
|
|
|
|
|
(defcustom xwidget-webkit-bookmark-jump-new-session nil
|
2021-12-31 10:25:52 +01:00
|
|
|
"Whether to jump to a bookmarked URL in a new xwidget webkit session.
|
|
|
|
If non-nil, create a new xwidget webkit session, otherwise use
|
|
|
|
the value of `xwidget-webkit-last-session'."
|
2020-09-15 15:35:32 +09:00
|
|
|
:version "28.1"
|
2020-08-12 12:34:29 +02:00
|
|
|
:type 'boolean)
|
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 20:27:12 +01:00
|
|
|
|
|
|
|
(defun xwidget-webkit-bookmark-make-record ()
|
2021-12-31 10:25:52 +01:00
|
|
|
"Create a bookmark record for a 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 20:27:12 +01:00
|
|
|
(nconc (bookmark-make-record-default t t)
|
2020-08-12 12:34:29 +02:00
|
|
|
`((page . ,(xwidget-webkit-uri (xwidget-webkit-current-session)))
|
2021-12-31 10:25:52 +01:00
|
|
|
(handler . xwidget-webkit-bookmark-jump-handler))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun xwidget-webkit-bookmark-jump-handler (bookmark)
|
|
|
|
"Jump to the web page bookmarked by the bookmark record BOOKMARK.
|
|
|
|
If `xwidget-webkit-bookmark-jump-new-session' is non-nil, create
|
|
|
|
a new xwidget-webkit session, otherwise use an existing session."
|
|
|
|
(let* ((url (bookmark-prop-get bookmark 'page))
|
|
|
|
(xwbuf (if (or xwidget-webkit-bookmark-jump-new-session
|
|
|
|
(not (xwidget-webkit-current-session)))
|
|
|
|
(xwidget-webkit--create-new-session-buffer url)
|
|
|
|
(xwidget-buffer (xwidget-webkit-current-session)))))
|
|
|
|
(with-current-buffer xwbuf
|
|
|
|
(xwidget-webkit-goto-uri (xwidget-webkit-current-session) url))
|
|
|
|
(set-buffer xwbuf)))
|
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 20:27:12 +01:00
|
|
|
|
2020-08-12 12:34:29 +02:00
|
|
|
;;; xwidget webkit 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 20:27:12 +01:00
|
|
|
|
|
|
|
(defvar xwidget-webkit-last-session-buffer nil)
|
|
|
|
|
2016-01-19 19:06:32 -05: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 20:27:12 +01: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-19 19:09:45 -05: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 20:27:12 +01:00
|
|
|
nil))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-current-session ()
|
2016-01-19 19:06:32 -05:00
|
|
|
"Either the webkit in the current buffer, or the last one used.
|
|
|
|
The latter might be nil."
|
2016-01-19 19:09:45 -05: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 20:27:12 +01:00
|
|
|
|
|
|
|
(defun xwidget-adjust-size-to-content (xw)
|
|
|
|
"Resize XW to content."
|
2016-01-19 19:06:32 -05:00
|
|
|
;; xwidgets doesn't support widgets that have their own opinions about
|
2016-01-19 20:53:10 -05:00
|
|
|
;; size well, yet this reads the desired size and resizes the Emacs
|
2016-01-19 19:06:32 -05: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 20:27:12 +01:00
|
|
|
(let ((size (xwidget-size-request xw)))
|
|
|
|
(xwidget-resize xw (car size) (cadr size))))
|
|
|
|
|
2021-11-21 13:32:03 +08:00
|
|
|
(defun xwidget-webkit-stop ()
|
|
|
|
"Stop trying to load the current page."
|
|
|
|
(interactive)
|
|
|
|
(xwidget-webkit-stop-loading (xwidget-webkit-current-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 20:27:12 +01:00
|
|
|
|
|
|
|
(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;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
"
|
|
|
|
|
2020-08-12 12:34:29 +02:00
|
|
|
"Javascript that finds the active element."
|
2016-01-19 19:06:32 -05: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 20:27:12 +01: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.
|
|
|
|
)
|
|
|
|
|
2016-10-25 23:00:35 -07:00
|
|
|
(defun xwidget-webkit-insert-string ()
|
2020-08-12 12:34:29 +02:00
|
|
|
"Insert string into the active field in the current webkit widget."
|
2016-01-19 19:06:32 -05:00
|
|
|
;; Read out the string in the field first and provide for edit.
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive nil xwidget-webkit-mode)
|
2020-08-12 12:34:29 +02:00
|
|
|
;; As the prompt differs on JavaScript execution results,
|
|
|
|
;; the function must handle the prompt itself.
|
2016-10-25 23:00:35 -07:00
|
|
|
(let ((xww (xwidget-webkit-current-session)))
|
|
|
|
(xwidget-webkit-execute-script
|
|
|
|
xww
|
|
|
|
(concat xwidget-webkit-activeelement-js "
|
|
|
|
(function () {
|
|
|
|
var res = findactiveelement(document);
|
2020-08-12 12:34:29 +02:00
|
|
|
if (res)
|
|
|
|
return [res.value, res.type];
|
2016-10-25 23:00:35 -07:00
|
|
|
})();")
|
|
|
|
(lambda (field)
|
2020-08-12 12:34:29 +02:00
|
|
|
"Prompt a string for the FIELD and insert in the active input."
|
2016-10-25 23:00:35 -07:00
|
|
|
(let ((str (pcase field
|
|
|
|
(`[,val "text"]
|
|
|
|
(read-string "Text: " val))
|
|
|
|
(`[,val "password"]
|
|
|
|
(read-passwd "Password: " nil val))
|
|
|
|
(`[,val "textarea"]
|
|
|
|
(xwidget-webkit-begin-edit-textarea xww val)))))
|
|
|
|
(xwidget-webkit-execute-script
|
|
|
|
xww
|
|
|
|
(format "findactiveelement(document).value='%s'" str)))))))
|
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 20:27:12 +01:00
|
|
|
|
|
|
|
(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"))
|
2020-12-09 09:44:38 +01:00
|
|
|
(setq-local xwidget-xwbl xw)
|
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 20:27:12 +01:00
|
|
|
(insert text))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-end-edit-textarea ()
|
2016-01-19 20:53:10 -05:00
|
|
|
"End editing of a webkit text area."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive nil xwidget-webkit-mode)
|
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 20:27:12 +01:00
|
|
|
(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
|
|
|
|
)
|
|
|
|
|
2016-10-25 23:00:35 -07:00
|
|
|
(defun xwidget-webkit-show-element (xw element-selector)
|
|
|
|
"Make webkit xwidget XW show a named element ELEMENT-SELECTOR.
|
|
|
|
The ELEMENT-SELECTOR must be a valid CSS selector. For example,
|
|
|
|
use this to display an anchor."
|
|
|
|
(interactive (list (xwidget-webkit-current-session)
|
2021-08-23 01:52:16 +02:00
|
|
|
(read-string "Element selector: "))
|
|
|
|
xwidget-webkit-mode)
|
2016-10-25 23:00:35 -07:00
|
|
|
(xwidget-webkit-execute-script
|
|
|
|
xw
|
|
|
|
(format "
|
|
|
|
(function (query) {
|
|
|
|
var el = document.querySelector(query);
|
|
|
|
if (el !== null) {
|
|
|
|
window.scrollTo(0, el.offsetTop);
|
|
|
|
}
|
|
|
|
})('%s');"
|
|
|
|
element-selector)))
|
|
|
|
|
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 20:27:12 +01:00
|
|
|
(defun xwidget-webkit-show-named-element (xw element-name)
|
2016-01-25 18:17:33 -05: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 20:27:12 +01:00
|
|
|
(interactive (list (xwidget-webkit-current-session)
|
2021-08-23 01:52:16 +02:00
|
|
|
(read-string "Element name: "))
|
|
|
|
xwidget-webkit-mode)
|
2016-10-25 23:00:35 -07:00
|
|
|
;; TODO: This needs to be interfaced into browse-url somehow. The
|
|
|
|
;; tricky part is that we need to do this in two steps: A: load the
|
|
|
|
;; base url, wait for load signal to arrive B: navigate to the
|
|
|
|
;; anchor when the base url is finished rendering
|
|
|
|
(xwidget-webkit-execute-script
|
|
|
|
xw
|
|
|
|
(format "
|
|
|
|
(function (query) {
|
|
|
|
var el = document.getElementsByName(query)[0];
|
|
|
|
if (el !== undefined) {
|
|
|
|
window.scrollTo(0, el.offsetTop);
|
|
|
|
}
|
|
|
|
})('%s');"
|
|
|
|
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 20:27:12 +01:00
|
|
|
|
|
|
|
(defun xwidget-webkit-show-id-element (xw element-id)
|
2016-01-25 18:17:33 -05: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 20:27:12 +01:00
|
|
|
(interactive (list (xwidget-webkit-current-session)
|
2021-08-23 01:52:16 +02:00
|
|
|
(read-string "Element id: "))
|
|
|
|
xwidget-webkit-mode)
|
2016-10-25 23:00:35 -07:00
|
|
|
(xwidget-webkit-execute-script
|
|
|
|
xw
|
|
|
|
(format "
|
|
|
|
(function (query) {
|
|
|
|
var el = document.getElementById(query);
|
|
|
|
if (el !== null) {
|
|
|
|
window.scrollTo(0, el.offsetTop);
|
|
|
|
}
|
|
|
|
})('%s');"
|
|
|
|
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 20:27:12 +01:00
|
|
|
|
|
|
|
(defun xwidget-webkit-show-id-or-named-element (xw element-id)
|
2016-01-25 18:17:33 -05: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 20:27:12 +01:00
|
|
|
(interactive (list (xwidget-webkit-current-session)
|
2021-08-23 01:52:16 +02:00
|
|
|
(read-string "Name or element id: "))
|
|
|
|
xwidget-webkit-mode)
|
2016-10-25 23:00:35 -07:00
|
|
|
(xwidget-webkit-execute-script
|
|
|
|
xw
|
|
|
|
(format "
|
|
|
|
(function (query) {
|
|
|
|
var el = document.getElementById(query) ||
|
|
|
|
document.getElementsByName(query)[0];
|
|
|
|
if (el !== undefined) {
|
|
|
|
window.scrollTo(0, el.offsetTop);
|
|
|
|
}
|
|
|
|
})('%s');"
|
|
|
|
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 20:27:12 +01:00
|
|
|
|
|
|
|
(defun xwidget-webkit-adjust-size-to-content ()
|
|
|
|
"Adjust webkit to content size."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive nil xwidget-webkit-mode)
|
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 20:27:12 +01:00
|
|
|
(xwidget-adjust-size-to-content (xwidget-webkit-current-session)))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-adjust-size-dispatch ()
|
|
|
|
"Adjust size according to mode."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive nil xwidget-webkit-mode)
|
2016-10-25 23:00:35 -07:00
|
|
|
(xwidget-webkit-adjust-size-to-window (xwidget-webkit-current-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 20:27:12 +01:00
|
|
|
;; The recenter is intended to correct a visual glitch.
|
2016-01-19 19:06:32 -05: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 20:27:12 +01:00
|
|
|
(ignore-errors
|
2016-01-25 18:17:33 -05: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 20:27:12 +01:00
|
|
|
|
2020-08-12 12:34:29 +02:00
|
|
|
;; Utility functions
|
|
|
|
|
|
|
|
(defun xwidget-window-inside-pixel-width (window)
|
|
|
|
"Return Emacs WINDOW body width in pixel."
|
|
|
|
(let ((edges (window-inside-pixel-edges window)))
|
|
|
|
(- (nth 2 edges) (nth 0 edges))))
|
|
|
|
|
|
|
|
(defun xwidget-window-inside-pixel-height (window)
|
|
|
|
"Return Emacs WINDOW body height in pixel."
|
|
|
|
(let ((edges (window-inside-pixel-edges window)))
|
|
|
|
(- (nth 3 edges) (nth 1 edges))))
|
|
|
|
|
2016-10-25 23:00:35 -07:00
|
|
|
(defun xwidget-webkit-adjust-size-to-window (xwidget &optional window)
|
|
|
|
"Adjust the size of the webkit XWIDGET to fit the WINDOW."
|
|
|
|
(xwidget-resize xwidget
|
2020-08-12 12:34:29 +02:00
|
|
|
(xwidget-window-inside-pixel-width window)
|
|
|
|
(xwidget-window-inside-pixel-height window)))
|
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 20:27:12 +01:00
|
|
|
|
|
|
|
(defun xwidget-webkit-adjust-size (w h)
|
2016-01-25 18:17:33 -05: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 20:27:12 +01:00
|
|
|
;; TODO shouldn't be tied to the webkit xwidget
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive "nWidth:\nnHeight:\n" xwidget-webkit-mode)
|
2016-01-19 20:53:10 -05: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 20:27:12 +01:00
|
|
|
|
|
|
|
(defun xwidget-webkit-fit-width ()
|
|
|
|
"Adjust width of webkit to window width."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive nil xwidget-webkit-mode)
|
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 20:27:12 +01:00
|
|
|
(xwidget-webkit-adjust-size (- (nth 2 (window-inside-pixel-edges))
|
|
|
|
(car (window-inside-pixel-edges)))
|
|
|
|
1000))
|
|
|
|
|
2016-10-25 23:00:35 -07:00
|
|
|
(defun xwidget-webkit-auto-adjust-size (window)
|
|
|
|
"Adjust the size of the webkit widget in the given WINDOW."
|
|
|
|
(with-current-buffer (window-buffer window)
|
|
|
|
(when (eq major-mode 'xwidget-webkit-mode)
|
|
|
|
(let ((xwidget (xwidget-webkit-current-session)))
|
|
|
|
(xwidget-webkit-adjust-size-to-window xwidget window)))))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-adjust-size-in-frame (frame)
|
|
|
|
"Dynamically adjust webkit widget for all windows of the FRAME."
|
|
|
|
(walk-windows 'xwidget-webkit-auto-adjust-size 'no-minibuf frame))
|
|
|
|
|
|
|
|
(eval-after-load 'xwidget-webkit-mode
|
|
|
|
(add-to-list 'window-size-change-functions
|
|
|
|
'xwidget-webkit-adjust-size-in-frame))
|
|
|
|
|
2021-12-31 10:25:52 +01:00
|
|
|
(defun xwidget-webkit--create-new-session-buffer (url &optional callback)
|
|
|
|
"Create a new webkit session buffer to display URL in an xwidget.
|
|
|
|
Optional function CALLBACK specifies the callback for webkit xwidgets;
|
|
|
|
see `xwidget-webkit-callback'."
|
2021-11-09 04:52:59 +01:00
|
|
|
(let* ((bufname
|
2021-12-31 10:25:52 +01:00
|
|
|
;; Generate a temp-name based on current buffer name. The
|
|
|
|
;; buffer will subsequently be renamed by
|
|
|
|
;; `xwidget-webkit-callback'. This approach can avoid
|
|
|
|
;; flicker of buffer-name in mode-line.
|
2021-11-09 06:49:15 +01:00
|
|
|
(generate-new-buffer-name (buffer-name)))
|
2021-11-09 04:52:59 +01:00
|
|
|
(callback (or callback #'xwidget-webkit-callback))
|
|
|
|
(current-session (xwidget-webkit-current-session))
|
|
|
|
xw)
|
2021-12-31 10:25:52 +01:00
|
|
|
(setq xwidget-webkit-last-session-buffer (get-buffer-create bufname))
|
2016-10-25 23:00:35 -07:00
|
|
|
;; The xwidget id is stored in a text property, so we need to have
|
|
|
|
;; at least character in this buffer.
|
2020-08-12 12:34:29 +02:00
|
|
|
;; Insert invisible url, good default for next `g' to browse url.
|
2021-12-31 10:25:52 +01:00
|
|
|
(with-current-buffer xwidget-webkit-last-session-buffer
|
|
|
|
(let ((start (point)))
|
|
|
|
(insert url)
|
|
|
|
(put-text-property start (+ start (length url)) 'invisible t)
|
|
|
|
(setq xw (xwidget-insert
|
|
|
|
start 'webkit bufname
|
|
|
|
(xwidget-window-inside-pixel-width (selected-window))
|
|
|
|
(xwidget-window-inside-pixel-height (selected-window))
|
|
|
|
nil current-session)))
|
|
|
|
(when xwidget-webkit-cookie-file
|
|
|
|
(xwidget-webkit-set-cookie-storage-file
|
|
|
|
xw (expand-file-name xwidget-webkit-cookie-file)))
|
|
|
|
(xwidget-put xw 'callback callback)
|
|
|
|
(xwidget-put xw 'display-callback #'xwidget-webkit-display-callback)
|
|
|
|
(xwidget-webkit-mode))
|
|
|
|
xwidget-webkit-last-session-buffer))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-new-session (url)
|
|
|
|
"Display URL in a new webkit xwidget."
|
|
|
|
(switch-to-buffer (xwidget-webkit--create-new-session-buffer url))
|
|
|
|
(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 20:27:12 +01:00
|
|
|
|
2021-11-06 20:59:08 +08:00
|
|
|
(defun xwidget-webkit-import-widget (xwidget)
|
|
|
|
"Create a new webkit session buffer from XWIDGET, an existing xwidget.
|
|
|
|
Return the buffer."
|
2021-11-09 04:52:59 +01:00
|
|
|
(let* ((bufname
|
|
|
|
;; Generate a temp-name based on current buffer name. it
|
|
|
|
;; will be renamed by `xwidget-webkit-callback' in the
|
|
|
|
;; future. This approach can limit flicker of buffer-name in
|
|
|
|
;; mode-line.
|
2021-11-09 06:49:15 +01:00
|
|
|
(generate-new-buffer-name (buffer-name)))
|
2021-11-06 20:59:08 +08:00
|
|
|
(callback #'xwidget-webkit-callback)
|
|
|
|
(buffer (get-buffer-create bufname)))
|
|
|
|
(with-current-buffer buffer
|
2021-11-15 13:12:45 +08:00
|
|
|
(setq xwidget-webkit-last-session-buffer buffer)
|
2021-11-06 20:59:08 +08:00
|
|
|
(save-excursion
|
|
|
|
(erase-buffer)
|
|
|
|
(insert ".")
|
|
|
|
(put-text-property (point-min) (point-max)
|
|
|
|
'display (list 'xwidget :xwidget xwidget)))
|
|
|
|
(xwidget-put xwidget 'callback callback)
|
2021-11-22 10:42:46 +08:00
|
|
|
(xwidget-put xwidget 'display-callback
|
|
|
|
#'xwidget-webkit-display-callback)
|
2021-11-06 20:59:08 +08:00
|
|
|
(set-xwidget-buffer xwidget buffer)
|
|
|
|
(xwidget-webkit-mode))
|
|
|
|
buffer))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-display-event (event)
|
2021-11-22 10:42:46 +08:00
|
|
|
"Trigger display callback for EVENT."
|
2021-11-06 20:59:08 +08:00
|
|
|
(interactive "e")
|
2021-11-22 10:42:46 +08:00
|
|
|
(let ((xwidget (cadr event))
|
|
|
|
(source (caddr event)))
|
|
|
|
(when (xwidget-get source 'display-callback)
|
|
|
|
(funcall (xwidget-get source 'display-callback)
|
|
|
|
xwidget source))))
|
2021-11-06 20:59:08 +08:00
|
|
|
|
2021-11-22 10:42:46 +08:00
|
|
|
(defun xwidget-webkit-display-callback (xwidget _source)
|
|
|
|
"Import XWIDGET and display it."
|
|
|
|
(display-buffer (xwidget-webkit-import-widget xwidget)))
|
|
|
|
|
|
|
|
(define-key special-event-map [xwidget-display-event] 'xwidget-webkit-display-event)
|
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 20:27:12 +01:00
|
|
|
|
|
|
|
(defun xwidget-webkit-goto-url (url)
|
2020-08-12 12:34:29 +02:00
|
|
|
"Goto URL with xwidget webkit."
|
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 20:27:12 +01:00
|
|
|
(if (xwidget-webkit-current-session)
|
|
|
|
(progn
|
2021-11-11 10:13:42 +08:00
|
|
|
(xwidget-webkit-goto-uri (xwidget-webkit-current-session) url)
|
|
|
|
(switch-to-buffer (xwidget-buffer (xwidget-webkit-current-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 20:27:12 +01:00
|
|
|
(xwidget-webkit-new-session url)))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-back ()
|
2020-08-12 12:34:29 +02:00
|
|
|
"Go back to previous URL in xwidget webkit buffer."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive nil xwidget-webkit-mode)
|
2020-08-12 12:34:29 +02:00
|
|
|
(xwidget-webkit-goto-history (xwidget-webkit-current-session) -1))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-forward ()
|
|
|
|
"Go forward in history."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive nil xwidget-webkit-mode)
|
2020-08-12 12:34:29 +02:00
|
|
|
(xwidget-webkit-goto-history (xwidget-webkit-current-session) 1))
|
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 20:27:12 +01:00
|
|
|
|
|
|
|
(defun xwidget-webkit-reload ()
|
2020-08-12 12:34:29 +02:00
|
|
|
"Reload current URL."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive nil xwidget-webkit-mode)
|
2020-08-12 12:34:29 +02:00
|
|
|
(xwidget-webkit-goto-history (xwidget-webkit-current-session) 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 20:27:12 +01:00
|
|
|
|
|
|
|
(defun xwidget-webkit-current-url ()
|
2020-08-12 12:34:29 +02:00
|
|
|
"Display the current xwidget webkit URL and place it on the `kill-ring'."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive nil xwidget-webkit-mode)
|
2020-08-12 12:34:29 +02:00
|
|
|
(let ((url (xwidget-webkit-uri (xwidget-webkit-current-session))))
|
2023-02-23 22:47:41 -05:00
|
|
|
(when url (kill-new url))
|
|
|
|
(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 20:27:12 +01:00
|
|
|
|
2021-11-15 13:12:45 +08:00
|
|
|
(defun xwidget-webkit-browse-history ()
|
|
|
|
"Display a buffer containing the history of page loads."
|
|
|
|
(interactive)
|
|
|
|
(setq xwidget-webkit-last-session-buffer (current-buffer))
|
|
|
|
(let ((buffer (get-buffer-create "*Xwidget WebKit History*")))
|
|
|
|
(with-current-buffer buffer
|
|
|
|
(xwidget-webkit-history-mode))
|
|
|
|
(display-buffer 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 20:27:12 +01:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2016-10-25 23:00:35 -07:00
|
|
|
(defun xwidget-webkit-get-selection (proc)
|
|
|
|
"Get the webkit selection and pass it to PROC."
|
|
|
|
(xwidget-webkit-execute-script
|
|
|
|
(xwidget-webkit-current-session)
|
|
|
|
"window.getSelection().toString();"
|
|
|
|
proc))
|
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 20:27:12 +01:00
|
|
|
|
|
|
|
(defun xwidget-webkit-copy-selection-as-kill ()
|
2020-08-12 12:34:29 +02:00
|
|
|
"Get the webkit selection and put it on the `kill-ring'."
|
2021-08-23 01:52:16 +02:00
|
|
|
(interactive nil xwidget-webkit-mode)
|
2020-08-12 12:34:29 +02:00
|
|
|
(xwidget-webkit-get-selection #'kill-new))
|
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 20:27:12 +01:00
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2016-01-19 19:06:32 -05: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 20:27:12 +01:00
|
|
|
|
|
|
|
(defun xwidget-get (xwidget propname)
|
2016-01-25 18:17:33 -05: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 20:27:12 +01:00
|
|
|
(plist-get (xwidget-plist xwidget) propname))
|
|
|
|
|
|
|
|
(defun xwidget-put (xwidget propname value)
|
2016-01-25 18:17:33 -05: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 20:27:12 +01:00
|
|
|
(set-xwidget-plist xwidget
|
|
|
|
(plist-put (xwidget-plist xwidget) propname value)))
|
|
|
|
|
2022-07-21 09:19:14 +08:00
|
|
|
(defvar-keymap xwidget-webkit-edit-mode-map :full t)
|
|
|
|
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [backspace] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [tab] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [left] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [right] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [up] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [down] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [return] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [C-left] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [C-right] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [C-up] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [C-down] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [C-return] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [S-left] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [S-right] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [S-up] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [S-down] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [S-return] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [M-left] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [M-right] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [M-up] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [M-down] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [M-return] 'xwidget-webkit-pass-command-event)
|
|
|
|
(define-key xwidget-webkit-edit-mode-map [C-backspace] 'xwidget-webkit-pass-command-event)
|
2021-11-05 14:47:26 +08:00
|
|
|
|
|
|
|
(define-minor-mode xwidget-webkit-edit-mode
|
|
|
|
"Minor mode for editing the content of WebKit buffers.
|
|
|
|
|
|
|
|
This defines most self-inserting characters and some common
|
|
|
|
keyboard shortcuts to `xwidget-webkit-pass-command-event', which
|
|
|
|
will pass the key events corresponding to these characters to the
|
|
|
|
WebKit widget."
|
|
|
|
:keymap xwidget-webkit-edit-mode-map)
|
|
|
|
|
|
|
|
(substitute-key-definition 'self-insert-command
|
|
|
|
'xwidget-webkit-pass-command-event
|
|
|
|
xwidget-webkit-edit-mode-map
|
|
|
|
global-map)
|
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 20:27:12 +01:00
|
|
|
|
2021-11-06 18:20:03 +08:00
|
|
|
(declare-function xwidget-webkit-search "xwidget.c")
|
|
|
|
(declare-function xwidget-webkit-next-result "xwidget.c")
|
|
|
|
(declare-function xwidget-webkit-previous-result "xwidget.c")
|
|
|
|
(declare-function xwidget-webkit-finish-search "xwidget.c")
|
|
|
|
|
|
|
|
(defvar-local xwidget-webkit-isearch--string ""
|
|
|
|
"The current search query.")
|
|
|
|
(defvar-local xwidget-webkit-isearch--is-reverse nil
|
|
|
|
"Whether or not the current isearch should be reverse.")
|
2021-11-12 14:04:38 +08:00
|
|
|
(defvar xwidget-webkit-isearch--read-string-buffer nil
|
|
|
|
"The buffer we are reading input method text for, if any.")
|
2021-11-06 18:20:03 +08:00
|
|
|
|
2021-11-07 09:02:12 +08:00
|
|
|
(defun xwidget-webkit-isearch--update (&optional only-message)
|
2021-11-06 18:20:03 +08:00
|
|
|
"Update the current buffer's WebKit widget's search query.
|
2021-11-07 09:02:12 +08:00
|
|
|
If ONLY-MESSAGE is non-nil, the query will not be sent to the
|
|
|
|
WebKit widget. The query will be set to the contents of
|
|
|
|
`xwidget-webkit-isearch--string'."
|
|
|
|
(unless only-message
|
|
|
|
(xwidget-webkit-search xwidget-webkit-isearch--string
|
|
|
|
(xwidget-webkit-current-session)
|
|
|
|
t xwidget-webkit-isearch--is-reverse t))
|
2021-11-13 08:30:43 +08:00
|
|
|
(let ((message-log-max nil))
|
2021-11-16 09:25:55 +08:00
|
|
|
(message "%s" (concat (propertize "Search contents: " 'face 'minibuffer-prompt)
|
|
|
|
xwidget-webkit-isearch--string))))
|
2021-11-06 18:20:03 +08:00
|
|
|
|
|
|
|
(defun xwidget-webkit-isearch-erasing-char (count)
|
|
|
|
"Erase the last COUNT characters of the current query."
|
|
|
|
(interactive (list (prefix-numeric-value current-prefix-arg)))
|
|
|
|
(when (> (length xwidget-webkit-isearch--string) 0)
|
|
|
|
(setq xwidget-webkit-isearch--string
|
|
|
|
(substring xwidget-webkit-isearch--string 0
|
|
|
|
(- (length xwidget-webkit-isearch--string) count))))
|
|
|
|
(xwidget-webkit-isearch--update))
|
|
|
|
|
2021-11-12 14:04:38 +08:00
|
|
|
(defun xwidget-webkit-isearch-with-input-method ()
|
|
|
|
"Handle a request to use the input method to modify the search query."
|
|
|
|
(interactive)
|
|
|
|
(let ((key (car unread-command-events))
|
|
|
|
events)
|
|
|
|
(setq unread-command-events (cdr unread-command-events)
|
|
|
|
events (funcall input-method-function key))
|
|
|
|
(dolist (k events)
|
|
|
|
(with-current-buffer xwidget-webkit-isearch--read-string-buffer
|
|
|
|
(setq xwidget-webkit-isearch--string
|
|
|
|
(concat xwidget-webkit-isearch--string
|
|
|
|
(char-to-string k)))))
|
|
|
|
(exit-minibuffer)))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-isearch-printing-char-with-input-method (char)
|
|
|
|
"Handle printing char CHAR with the current input method."
|
|
|
|
(let ((minibuffer-local-map (make-keymap))
|
|
|
|
(xwidget-webkit-isearch--read-string-buffer (current-buffer)))
|
|
|
|
(define-key minibuffer-local-map [with-input-method]
|
|
|
|
'xwidget-webkit-isearch-with-input-method)
|
|
|
|
(setq unread-command-events
|
|
|
|
(cons 'with-input-method
|
|
|
|
(cons char unread-command-events)))
|
|
|
|
(read-string "Search contents: "
|
|
|
|
xwidget-webkit-isearch--string
|
|
|
|
'junk-hist nil t)
|
|
|
|
(xwidget-webkit-isearch--update)))
|
|
|
|
|
2021-11-06 18:20:03 +08:00
|
|
|
(defun xwidget-webkit-isearch-printing-char (char &optional count)
|
|
|
|
"Add ordinary character CHAR to the search string and search.
|
|
|
|
With argument, add COUNT copies of CHAR."
|
|
|
|
(interactive (list last-command-event
|
|
|
|
(prefix-numeric-value current-prefix-arg)))
|
2021-11-12 14:04:38 +08:00
|
|
|
(if current-input-method
|
|
|
|
(xwidget-webkit-isearch-printing-char-with-input-method char)
|
|
|
|
(setq xwidget-webkit-isearch--string (concat xwidget-webkit-isearch--string
|
|
|
|
(make-string (or count 1) char))))
|
2021-11-06 18:20:03 +08:00
|
|
|
(xwidget-webkit-isearch--update))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-isearch-forward (count)
|
|
|
|
"Move to the next search result COUNT times."
|
|
|
|
(interactive (list (prefix-numeric-value current-prefix-arg)))
|
|
|
|
(let ((was-reverse xwidget-webkit-isearch--is-reverse))
|
|
|
|
(setq xwidget-webkit-isearch--is-reverse nil)
|
|
|
|
(when was-reverse
|
2021-11-10 17:53:13 +08:00
|
|
|
(xwidget-webkit-isearch--update)
|
|
|
|
(setq count (1- count))))
|
2021-11-06 18:20:03 +08:00
|
|
|
(let ((i 0))
|
|
|
|
(while (< i count)
|
|
|
|
(xwidget-webkit-next-result (xwidget-webkit-current-session))
|
2021-11-07 09:02:12 +08:00
|
|
|
(cl-incf i)))
|
|
|
|
(xwidget-webkit-isearch--update t))
|
2021-11-06 18:20:03 +08:00
|
|
|
|
|
|
|
(defun xwidget-webkit-isearch-backward (count)
|
|
|
|
"Move to the previous search result COUNT times."
|
|
|
|
(interactive (list (prefix-numeric-value current-prefix-arg)))
|
|
|
|
(let ((was-reverse xwidget-webkit-isearch--is-reverse))
|
|
|
|
(setq xwidget-webkit-isearch--is-reverse t)
|
|
|
|
(unless was-reverse
|
2021-11-10 17:53:13 +08:00
|
|
|
(xwidget-webkit-isearch--update)
|
|
|
|
(setq count (1- count))))
|
2021-11-06 18:20:03 +08:00
|
|
|
(let ((i 0))
|
|
|
|
(while (< i count)
|
2021-11-07 14:22:52 +08:00
|
|
|
(xwidget-webkit-previous-result (xwidget-webkit-current-session))
|
2021-11-07 09:02:12 +08:00
|
|
|
(cl-incf i)))
|
|
|
|
(xwidget-webkit-isearch--update t))
|
2021-11-06 18:20:03 +08:00
|
|
|
|
|
|
|
(defun xwidget-webkit-isearch-exit ()
|
|
|
|
"Exit incremental search of a WebKit buffer."
|
|
|
|
(interactive)
|
|
|
|
(xwidget-webkit-isearch-mode 0))
|
|
|
|
|
Prefer defvar-keymap in some trivial cases
* lisp/calendar/diary-lib.el (diary-fancy-overriding-map):
* lisp/emacs-lisp/chart.el (chart-mode-map):
* lisp/emulation/cua-base.el (cua-global-keymap)
(cua--cua-keys-keymap, cua--prefix-override-keymap)
(cua--prefix-repeat-keymap, cua--global-mark-keymap)
(cua--rectangle-keymap, cua--region-keymap):
* lisp/emulation/viper-keym.el (viper-vi-intercept-map)
(viper-insert-intercept-map, viper-emacs-intercept-map)
(viper-vi-global-user-map, viper-vi-basic-map, viper-vi-kbd-map)
(viper-vi-diehard-map, viper-insert-global-user-map)
(viper-insert-basic-map, viper-insert-diehard-map)
(viper-insert-kbd-map, viper-replace-map)
(viper-emacs-global-user-map, viper-emacs-kbd-map)
(viper-empty-keymap, viper-mode-map, viper-minibuffer-map)
(viper-ex-cmd-map, ex-read-filename-map)
(viper-slash-and-colon-map, viper-comint-mode-modifier-map)
(viper-dired-modifier-map, viper-gnus-modifier-map):
* lisp/gnus/gnus-sum.el (gnus-summary-generic-mark-map):
* lisp/menu-bar.el (global-buffers-menu-map)
(menu-bar-preferences-menu):
* lisp/mh-e/mh-e.el (mh-folder-mode-map, mh-inc-spool-map)
(mh-search-mode-map, mh-show-mode-map):
* lisp/play/dunnet.el (dungeon-batch-map):
* lisp/progmodes/autoconf.el (autoconf-mode-map):
* lisp/tool-bar.el (tool-bar-map):
* lisp/vc/ediff-help.el (ediff-help-region-map):
* lisp/vc/ediff-hook.el (menu-bar-epatch-menu)
(menu-bar-ediff-merge-menu, menu-bar-ediff-menu):
* lisp/windmove.el (windmove-mode-map):
* lisp/xwidget.el (xwidget-webkit-isearch-mode-map)
(xwidget-webkit-edit-mode-map): Prefer defvar-keymap.
2022-07-20 09:27:10 +02:00
|
|
|
(defvar-keymap xwidget-webkit-isearch-mode-map
|
|
|
|
:doc "The keymap used inside `xwidget-webkit-isearch-mode'."
|
|
|
|
:full t)
|
2021-11-06 18:20:03 +08:00
|
|
|
|
|
|
|
(set-char-table-range (nth 1 xwidget-webkit-isearch-mode-map)
|
|
|
|
(cons 0 (max-char))
|
|
|
|
'xwidget-webkit-isearch-exit)
|
|
|
|
|
|
|
|
(substitute-key-definition 'self-insert-command
|
|
|
|
'xwidget-webkit-isearch-printing-char
|
|
|
|
xwidget-webkit-isearch-mode-map
|
|
|
|
global-map)
|
|
|
|
|
|
|
|
(define-key xwidget-webkit-isearch-mode-map (kbd "DEL")
|
|
|
|
'xwidget-webkit-isearch-erasing-char)
|
2021-11-07 04:32:20 +01:00
|
|
|
(define-key xwidget-webkit-isearch-mode-map [backspace] 'xwidget-webkit-isearch-erasing-char)
|
2021-11-06 18:20:03 +08:00
|
|
|
(define-key xwidget-webkit-isearch-mode-map [return] 'xwidget-webkit-isearch-exit)
|
|
|
|
(define-key xwidget-webkit-isearch-mode-map "\r" 'xwidget-webkit-isearch-exit)
|
|
|
|
(define-key xwidget-webkit-isearch-mode-map "\C-g" 'xwidget-webkit-isearch-exit)
|
|
|
|
(define-key xwidget-webkit-isearch-mode-map "\C-r" 'xwidget-webkit-isearch-backward)
|
2021-11-06 18:27:48 +08:00
|
|
|
(define-key xwidget-webkit-isearch-mode-map "\C-s" 'xwidget-webkit-isearch-forward)
|
2021-11-10 18:13:22 +08:00
|
|
|
(define-key xwidget-webkit-isearch-mode-map "\C-y" 'xwidget-webkit-isearch-yank-kill)
|
2021-11-12 14:04:38 +08:00
|
|
|
(define-key xwidget-webkit-isearch-mode-map "\C-\\" 'toggle-input-method)
|
2021-11-06 18:20:03 +08:00
|
|
|
(define-key xwidget-webkit-isearch-mode-map "\t" 'xwidget-webkit-isearch-printing-char)
|
|
|
|
|
|
|
|
(let ((meta-map (make-keymap)))
|
|
|
|
(set-char-table-range (nth 1 meta-map)
|
|
|
|
(cons 0 (max-char))
|
|
|
|
'xwidget-webkit-isearch-exit)
|
|
|
|
(define-key xwidget-webkit-isearch-mode-map (char-to-string meta-prefix-char) meta-map))
|
|
|
|
|
|
|
|
(define-minor-mode xwidget-webkit-isearch-mode
|
|
|
|
"Minor mode for performing incremental search inside WebKit buffers.
|
|
|
|
|
2021-11-07 11:50:06 +02:00
|
|
|
This resembles the regular incremental search, but it does not
|
|
|
|
support recursive edits.
|
2021-11-06 18:20:03 +08:00
|
|
|
|
2021-11-07 11:50:06 +02:00
|
|
|
If this mode is activated with `\\<xwidget-webkit-isearch-mode-map>\\[xwidget-webkit-isearch-backward]', then the search will by default
|
|
|
|
start in the reverse direction.
|
2021-11-06 18:20:03 +08:00
|
|
|
|
|
|
|
To navigate around the search results, type
|
2021-11-07 11:50:06 +02:00
|
|
|
\\<xwidget-webkit-isearch-mode-map>\\[xwidget-webkit-isearch-forward] to move forward, and
|
|
|
|
\\<xwidget-webkit-isearch-mode-map>\\[xwidget-webkit-isearch-backward] to move backward.
|
2021-11-06 18:20:03 +08:00
|
|
|
|
2021-11-10 18:13:22 +08:00
|
|
|
To insert the string at the front of the kill ring into the
|
|
|
|
search query, type \\<xwidget-webkit-isearch-mode-map>\\[xwidget-webkit-isearch-yank-kill].
|
|
|
|
|
2021-11-07 11:50:06 +02:00
|
|
|
Press \\<xwidget-webkit-isearch-mode-map>\\[xwidget-webkit-isearch-exit] to exit incremental search."
|
2021-11-06 18:20:03 +08:00
|
|
|
:keymap xwidget-webkit-isearch-mode-map
|
|
|
|
(if xwidget-webkit-isearch-mode
|
|
|
|
(progn
|
|
|
|
(setq xwidget-webkit-isearch--string "")
|
2021-11-07 09:02:12 +08:00
|
|
|
(setq xwidget-webkit-isearch--is-reverse (eq last-command-event ?\C-r))
|
|
|
|
(xwidget-webkit-isearch--update))
|
2021-11-06 18:20:03 +08:00
|
|
|
(xwidget-webkit-finish-search (xwidget-webkit-current-session))))
|
|
|
|
|
2021-11-10 18:13:22 +08:00
|
|
|
(defun xwidget-webkit-isearch-yank-kill ()
|
2021-11-11 14:54:58 +08:00
|
|
|
"Append the most recent kill from `kill-ring' to the current query."
|
2021-11-10 18:13:22 +08:00
|
|
|
(interactive)
|
|
|
|
(unless xwidget-webkit-isearch-mode
|
|
|
|
(xwidget-webkit-isearch-mode t))
|
|
|
|
(setq xwidget-webkit-isearch--string
|
|
|
|
(concat xwidget-webkit-isearch--string
|
|
|
|
(current-kill 0)))
|
|
|
|
(xwidget-webkit-isearch--update))
|
2021-11-15 13:12:45 +08:00
|
|
|
|
|
|
|
(defvar-local xwidget-webkit-history--session nil
|
|
|
|
"The xwidget this history buffer controls.")
|
|
|
|
|
|
|
|
(define-button-type 'xwidget-webkit-history 'action #'xwidget-webkit-history-select-item)
|
|
|
|
|
|
|
|
(defun xwidget-webkit-history--insert-item (item)
|
|
|
|
"Insert specified ITEM into the current buffer."
|
|
|
|
(let ((idx (car item))
|
|
|
|
(title (cadr item))
|
|
|
|
(uri (caddr item)))
|
|
|
|
(push (list idx (vector (list (number-to-string idx)
|
|
|
|
:type 'xwidget-webkit-history)
|
|
|
|
(list title :type 'xwidget-webkit-history)
|
|
|
|
(list uri :type 'xwidget-webkit-history)))
|
|
|
|
tabulated-list-entries)))
|
|
|
|
|
|
|
|
(defun xwidget-webkit-history-select-item (pos)
|
|
|
|
"Navigate to the history item underneath POS."
|
|
|
|
(interactive "P")
|
|
|
|
(let ((id (tabulated-list-get-id pos)))
|
|
|
|
(xwidget-webkit-goto-history xwidget-webkit-history--session id))
|
|
|
|
(xwidget-webkit-history-reload))
|
|
|
|
|
2022-10-26 16:35:59 +03:00
|
|
|
(defun xwidget-webkit-history-reload (&rest _ignored)
|
2021-11-15 13:12:45 +08:00
|
|
|
"Reload the current history buffer."
|
|
|
|
(interactive)
|
|
|
|
(setq tabulated-list-entries nil)
|
|
|
|
(let* ((back-forward-list
|
|
|
|
(xwidget-webkit-back-forward-list xwidget-webkit-history--session))
|
|
|
|
(back-list (car back-forward-list))
|
|
|
|
(here (cadr back-forward-list))
|
|
|
|
(forward-list (caddr back-forward-list)))
|
|
|
|
(mapc #'xwidget-webkit-history--insert-item (nreverse forward-list))
|
|
|
|
(xwidget-webkit-history--insert-item here)
|
|
|
|
(mapc #'xwidget-webkit-history--insert-item back-list)
|
|
|
|
(tabulated-list-print t nil)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(let ((position (line-beginning-position (1+ (length back-list)))))
|
|
|
|
(goto-char position)
|
|
|
|
(setq-local overlay-arrow-position (make-marker))
|
|
|
|
(set-marker overlay-arrow-position position))))
|
|
|
|
|
|
|
|
(define-derived-mode xwidget-webkit-history-mode tabulated-list-mode
|
|
|
|
"Xwidget Webkit History"
|
|
|
|
"Major mode for browsing the history of an Xwidget Webkit buffer.
|
|
|
|
Each line describes an entry in history."
|
|
|
|
(setq truncate-lines t)
|
|
|
|
(setq buffer-read-only t)
|
|
|
|
(setq tabulated-list-format [("Index" 10 nil)
|
|
|
|
("Title" 50 nil)
|
|
|
|
("URL" 100 nil)])
|
|
|
|
(setq tabulated-list-entries nil)
|
|
|
|
(setq xwidget-webkit-history--session (xwidget-webkit-current-session))
|
|
|
|
(xwidget-webkit-history-reload)
|
|
|
|
(setq-local revert-buffer-function #'xwidget-webkit-history-reload)
|
|
|
|
(tabulated-list-init-header))
|
|
|
|
|
|
|
|
(define-key xwidget-webkit-history-mode-map (kbd "RET")
|
|
|
|
#'xwidget-webkit-history-select-item)
|
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 20:27:12 +01:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
2016-01-19 18:44:29 -05: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 20:27:12 +01: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-19 19:06:32 -05: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 20:27:12 +01: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-19 19:06:32 -05: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 20:27:12 +01:00
|
|
|
(let ((xwidgets (get-buffer-xwidgets (current-buffer))))
|
|
|
|
(or (not xwidgets)
|
2016-01-19 20:53:10 -05: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 20:27:12 +01:00
|
|
|
(yes-or-no-p
|
2016-01-19 20:53:10 -05: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 20:27:12 +01:00
|
|
|
|
2016-01-19 20:53:10 -05: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 20:27:12 +01:00
|
|
|
|
|
|
|
(provide 'xwidget)
|
|
|
|
;;; xwidget.el ends here
|