emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master fbf361f: Allow terminating page loading operations in webkit xwid


From: Po Lu
Subject: master fbf361f: Allow terminating page loading operations in webkit xwidgets
Date: Sat, 20 Nov 2021 05:24:57 -0500 (EST)

branch: master
commit fbf361f593df52ff414a4483f105e2e4c1a921e2
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    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.
---
 doc/lispref/display.texi |  6 ++++++
 etc/NEWS                 |  5 +++++
 src/xwidget.c            | 25 +++++++++++++++++++++++++
 3 files changed, 36 insertions(+)

diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 0842603..c093901 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
 related widget, @var{xwidget} will not store cookies on disk at all.
 @end defun
 
+@defun xwidget-webkit-stop-loading xwidget
+Terminate any data transfer still in progress in the WebKit widget
+@var{xwidget} as part of a page-loading operation.  If a page is not
+being loaded, this function does nothing.
+@end defun
+
 @node Buttons
 @section Buttons
 @cindex buttons in buffers
diff --git a/etc/NEWS b/etc/NEWS
index 70ba534..a5ca8fb 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -874,6 +874,11 @@ This function is used to obtain the estimated progress of 
page loading
 in a given WebKit xwidget.
 
 +++
+*** New function 'xwidget-webkit-stop-loading'.
+This function is used to terminate all data transfer during page loads
+in a given WebKit xwidget.
+
++++
 *** 'load-changed' xwidget events are now more detailed.
 In particular, they can now have different arguments based on the
 state of the WebKit widget.  'load-finished' is sent when a load has
diff --git a/src/xwidget.c b/src/xwidget.c
index 8cad2fb..b1bf291 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -2615,6 +2615,30 @@ store cookies in FILE and load them from there.  */)
   return Qnil;
 }
 
+DEFUN ("xwidget-webkit-stop-loading", Fxwidget_webkit_stop_loading,
+       Sxwidget_webkit_stop_loading,
+       1, 1, 0, doc: /* Stop loading data in the WebKit widget XWIDGET.
+This will stop any data transfer that may still be in progress inside
+XWIDGET as part of loading a page.  */)
+  (Lisp_Object xwidget)
+{
+#ifdef USE_GTK
+  struct xwidget *xw;
+  WebKitWebView *webview;
+
+  CHECK_LIVE_XWIDGET (xwidget);
+  xw = XXWIDGET (xwidget);
+  CHECK_WEBKIT_WIDGET (xw);
+
+  block_input ();
+  webview = WEBKIT_WEB_VIEW (xw->widget_osr);
+  webkit_web_view_stop_loading (webview);
+  unblock_input ();
+#endif
+
+  return Qnil;
+}
+
 void
 syms_of_xwidget (void)
 {
@@ -2656,6 +2680,7 @@ syms_of_xwidget (void)
   defsubr (&Sxwidget_webkit_previous_result);
   defsubr (&Sset_xwidget_buffer);
   defsubr (&Sxwidget_webkit_set_cookie_storage_file);
+  defsubr (&Sxwidget_webkit_stop_loading);
 #ifdef USE_GTK
   defsubr (&Sxwidget_webkit_load_html);
   defsubr (&Sxwidget_webkit_back_forward_list);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]