diff options
| author | Ricardo Wurmus | 2016-10-25 23:00:35 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-10-25 23:07:13 -0700 |
| commit | e443eab6bf2b7b6e2f6a9ab06b1c5618b19ae653 (patch) | |
| tree | c8062ae848fa5e031d1cf06663c86e6b7cf6ca13 /src | |
| parent | a9785bd5c2e27e949040342e441c1a65a5b650d0 (diff) | |
| download | emacs-e443eab6bf2b7b6e2f6a9ab06b1c5618b19ae653.tar.gz emacs-e443eab6bf2b7b6e2f6a9ab06b1c5618b19ae653.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xwidget.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/xwidget.c b/src/xwidget.c index dbd8fc18ad7..8105b3d825d 100644 --- a/src/xwidget.c +++ b/src/xwidget.c | |||
| @@ -681,6 +681,25 @@ DEFUN ("xwidget-webkit-goto-uri", | |||
| 681 | return Qnil; | 681 | return Qnil; |
| 682 | } | 682 | } |
| 683 | 683 | ||
| 684 | DEFUN ("xwidget-webkit-zoom", | ||
| 685 | Fxwidget_webkit_zoom, Sxwidget_webkit_zoom, | ||
| 686 | 2, 2, 0, | ||
| 687 | doc: /* Change the zoom factor of the xwidget webkit instance | ||
| 688 | referenced by XWIDGET. */) | ||
| 689 | (Lisp_Object xwidget, Lisp_Object factor) | ||
| 690 | { | ||
| 691 | WEBKIT_FN_INIT (); | ||
| 692 | if (FLOATP (factor)) | ||
| 693 | { | ||
| 694 | double zoom_change = XFLOAT_DATA (factor); | ||
| 695 | webkit_web_view_set_zoom_level | ||
| 696 | (WEBKIT_WEB_VIEW (xw->widget_osr), | ||
| 697 | webkit_web_view_get_zoom_level | ||
| 698 | (WEBKIT_WEB_VIEW (xw->widget_osr)) + zoom_change); | ||
| 699 | } | ||
| 700 | return Qnil; | ||
| 701 | } | ||
| 702 | |||
| 684 | 703 | ||
| 685 | DEFUN ("xwidget-webkit-execute-script", | 704 | DEFUN ("xwidget-webkit-execute-script", |
| 686 | Fxwidget_webkit_execute_script, Sxwidget_webkit_execute_script, | 705 | Fxwidget_webkit_execute_script, Sxwidget_webkit_execute_script, |
| @@ -953,6 +972,7 @@ syms_of_xwidget (void) | |||
| 953 | defsubr (&Sset_xwidget_query_on_exit_flag); | 972 | defsubr (&Sset_xwidget_query_on_exit_flag); |
| 954 | 973 | ||
| 955 | defsubr (&Sxwidget_webkit_goto_uri); | 974 | defsubr (&Sxwidget_webkit_goto_uri); |
| 975 | defsubr (&Sxwidget_webkit_zoom); | ||
| 956 | defsubr (&Sxwidget_webkit_execute_script); | 976 | defsubr (&Sxwidget_webkit_execute_script); |
| 957 | DEFSYM (Qwebkit, "webkit"); | 977 | DEFSYM (Qwebkit, "webkit"); |
| 958 | 978 | ||