1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-18 00:50:44 -08:00

Implement zoom for WebKit widget.

* src/xwidget.c (xwidget-webkit-zoom): New procedure.
* lisp/xwidget.el: Bind "+" and "-" to zoom in and out, respectively.
(xwidget-webkit-zoom): Declare procedure.
(xwidget-webkit-zoom-in, xwidget-webkit-zoom-out): New procedures.
This commit is contained in:
Ricardo Wurmus 2016-10-25 23:00:35 -07:00 committed by Paul Eggert
parent a9785bd5c2
commit e443eab6bf
2 changed files with 33 additions and 0 deletions

View file

@ -681,6 +681,25 @@ DEFUN ("xwidget-webkit-goto-uri",
return Qnil;
}
DEFUN ("xwidget-webkit-zoom",
Fxwidget_webkit_zoom, Sxwidget_webkit_zoom,
2, 2, 0,
doc: /* Change the zoom factor of the xwidget webkit instance
referenced by XWIDGET. */)
(Lisp_Object xwidget, Lisp_Object factor)
{
WEBKIT_FN_INIT ();
if (FLOATP (factor))
{
double zoom_change = XFLOAT_DATA (factor);
webkit_web_view_set_zoom_level
(WEBKIT_WEB_VIEW (xw->widget_osr),
webkit_web_view_get_zoom_level
(WEBKIT_WEB_VIEW (xw->widget_osr)) + zoom_change);
}
return Qnil;
}
DEFUN ("xwidget-webkit-execute-script",
Fxwidget_webkit_execute_script, Sxwidget_webkit_execute_script,
@ -953,6 +972,7 @@ syms_of_xwidget (void)
defsubr (&Sset_xwidget_query_on_exit_flag);
defsubr (&Sxwidget_webkit_goto_uri);
defsubr (&Sxwidget_webkit_zoom);
defsubr (&Sxwidget_webkit_execute_script);
DEFSYM (Qwebkit, "webkit");