diff options
| author | Po Lu | 2021-11-20 18:23:02 +0800 |
|---|---|---|
| committer | Po Lu | 2021-11-20 18:24:43 +0800 |
| commit | fbf361f593df52ff414a4483f105e2e4c1a921e2 (patch) | |
| tree | d3da8d4e8060b6285a6ef57a5c2f236ded6b384a | |
| parent | 2ba7d1e84e76fa4d08fd8ed5a915793d4bf881cd (diff) | |
| download | emacs-fbf361f593df52ff414a4483f105e2e4c1a921e2.tar.gz emacs-fbf361f593df52ff414a4483f105e2e4c1a921e2.zip | |
Allow terminating page loading operations in webkit xwidgets
* doc/lispref/display.texi (Xwidgets): Document new function.
* etc/NEWS: Announce `xwidget-webkit-stop-loading'.
* src/xwidget.c (Fxwidget_webkit_stop_loading): New function.
(syms_of_xwidget): Define new subr.
| -rw-r--r-- | doc/lispref/display.texi | 6 | ||||
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | src/xwidget.c | 25 |
3 files changed, 36 insertions, 0 deletions
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 08426032e09..c093901ea1d 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -7025,6 +7025,12 @@ If this function is not called at least once on @var{xwidget} or a | |||
| 7025 | related widget, @var{xwidget} will not store cookies on disk at all. | 7025 | related widget, @var{xwidget} will not store cookies on disk at all. |
| 7026 | @end defun | 7026 | @end defun |
| 7027 | 7027 | ||
| 7028 | @defun xwidget-webkit-stop-loading xwidget | ||
| 7029 | Terminate any data transfer still in progress in the WebKit widget | ||
| 7030 | @var{xwidget} as part of a page-loading operation. If a page is not | ||
| 7031 | being loaded, this function does nothing. | ||
| 7032 | @end defun | ||
| 7033 | |||
| 7028 | @node Buttons | 7034 | @node Buttons |
| 7029 | @section Buttons | 7035 | @section Buttons |
| 7030 | @cindex buttons in buffers | 7036 | @cindex buttons in buffers |
| @@ -874,6 +874,11 @@ This function is used to obtain the estimated progress of page loading | |||
| 874 | in a given WebKit xwidget. | 874 | in a given WebKit xwidget. |
| 875 | 875 | ||
| 876 | +++ | 876 | +++ |
| 877 | *** New function 'xwidget-webkit-stop-loading'. | ||
| 878 | This function is used to terminate all data transfer during page loads | ||
| 879 | in a given WebKit xwidget. | ||
| 880 | |||
| 881 | +++ | ||
| 877 | *** 'load-changed' xwidget events are now more detailed. | 882 | *** 'load-changed' xwidget events are now more detailed. |
| 878 | In particular, they can now have different arguments based on the | 883 | In particular, they can now have different arguments based on the |
| 879 | state of the WebKit widget. 'load-finished' is sent when a load has | 884 | state of the WebKit widget. 'load-finished' is sent when a load has |
diff --git a/src/xwidget.c b/src/xwidget.c index 8cad2fbc2c1..b1bf291a168 100644 --- a/src/xwidget.c +++ b/src/xwidget.c | |||
| @@ -2615,6 +2615,30 @@ store cookies in FILE and load them from there. */) | |||
| 2615 | return Qnil; | 2615 | return Qnil; |
| 2616 | } | 2616 | } |
| 2617 | 2617 | ||
| 2618 | DEFUN ("xwidget-webkit-stop-loading", Fxwidget_webkit_stop_loading, | ||
| 2619 | Sxwidget_webkit_stop_loading, | ||
| 2620 | 1, 1, 0, doc: /* Stop loading data in the WebKit widget XWIDGET. | ||
| 2621 | This will stop any data transfer that may still be in progress inside | ||
| 2622 | XWIDGET as part of loading a page. */) | ||
| 2623 | (Lisp_Object xwidget) | ||
| 2624 | { | ||
| 2625 | #ifdef USE_GTK | ||
| 2626 | struct xwidget *xw; | ||
| 2627 | WebKitWebView *webview; | ||
| 2628 | |||
| 2629 | CHECK_LIVE_XWIDGET (xwidget); | ||
| 2630 | xw = XXWIDGET (xwidget); | ||
| 2631 | CHECK_WEBKIT_WIDGET (xw); | ||
| 2632 | |||
| 2633 | block_input (); | ||
| 2634 | webview = WEBKIT_WEB_VIEW (xw->widget_osr); | ||
| 2635 | webkit_web_view_stop_loading (webview); | ||
| 2636 | unblock_input (); | ||
| 2637 | #endif | ||
| 2638 | |||
| 2639 | return Qnil; | ||
| 2640 | } | ||
| 2641 | |||
| 2618 | void | 2642 | void |
| 2619 | syms_of_xwidget (void) | 2643 | syms_of_xwidget (void) |
| 2620 | { | 2644 | { |
| @@ -2656,6 +2680,7 @@ syms_of_xwidget (void) | |||
| 2656 | defsubr (&Sxwidget_webkit_previous_result); | 2680 | defsubr (&Sxwidget_webkit_previous_result); |
| 2657 | defsubr (&Sset_xwidget_buffer); | 2681 | defsubr (&Sset_xwidget_buffer); |
| 2658 | defsubr (&Sxwidget_webkit_set_cookie_storage_file); | 2682 | defsubr (&Sxwidget_webkit_set_cookie_storage_file); |
| 2683 | defsubr (&Sxwidget_webkit_stop_loading); | ||
| 2659 | #ifdef USE_GTK | 2684 | #ifdef USE_GTK |
| 2660 | defsubr (&Sxwidget_webkit_load_html); | 2685 | defsubr (&Sxwidget_webkit_load_html); |
| 2661 | defsubr (&Sxwidget_webkit_back_forward_list); | 2686 | defsubr (&Sxwidget_webkit_back_forward_list); |