* bug#51651: 29.0.50; [PATCH] Fix xwidget-webkit-goto-history
[not found] <87r1bswlw6.fsf.ref@yahoo.com>
@ 2021-11-07 5:54 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-07 13:41 ` Lars Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-11-07 5:54 UTC (permalink / raw)
To: 51651
[-- Attachment #1: Type: text/plain, Size: 69 bytes --]
This makes the back/forward navigation commands work again.
Thanks.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-xwidget-webkit-goto-history.patch --]
[-- Type: text/x-patch, Size: 2000 bytes --]
From ec300c45296d3e247402fe72bff185e750d6e289 Mon Sep 17 00:00:00 2001
From: Po Lu <luangruo@yahoo.com>
Date: Sun, 7 Nov 2021 13:52:38 +0800
Subject: [PATCH] Fix xwidget-webkit-goto-history
* src/xwidget.c (xwidget-webkit-goto-history): Use WebKitBackForwardList
and XFIXNUM instead of XFIXNAT.
---
src/xwidget.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/src/xwidget.c b/src/xwidget.c
index 78a3860490..7944ca5c4b 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -1516,7 +1516,11 @@ DEFUN ("xwidget-webkit-goto-uri",
DEFUN ("xwidget-webkit-goto-history",
Fxwidget_webkit_goto_history, Sxwidget_webkit_goto_history,
2, 2, 0,
- doc: /* Make the XWIDGET webkit load REL-POS (-1, 0, 1) page in browse history. */)
+ doc: /* Make the XWIDGET webkit the REL-POSth element in load history.
+
+If REL-POS is 0, the widget will be just reload the current element in
+history. If REL-POS is more or less than 0, the widget will load the
+REL-POSth element around the current spot in the load history. */)
(Lisp_Object xwidget, Lisp_Object rel_pos)
{
WEBKIT_FN_INIT ();
@@ -1526,11 +1530,20 @@ DEFUN ("xwidget-webkit-goto-history",
#ifdef USE_GTK
WebKitWebView *wkwv = WEBKIT_WEB_VIEW (xw->widget_osr);
- switch (XFIXNAT (rel_pos))
+ WebKitBackForwardList *list;
+ WebKitBackForwardListItem *it;
+
+ if (XFIXNUM (rel_pos) == 0)
+ webkit_web_view_reload (wkwv);
+ else
{
- case -1: webkit_web_view_go_back (wkwv); break;
- case 0: webkit_web_view_reload (wkwv); break;
- case 1: webkit_web_view_go_forward (wkwv); break;
+ list = webkit_web_view_get_back_forward_list (wkwv);
+ it = webkit_back_forward_list_get_nth_item (list, XFIXNUM (rel_pos));
+
+ if (!it)
+ error ("There is no item at this index");
+
+ webkit_web_view_go_to_back_forward_list_item (wkwv, it);
}
#elif defined NS_IMPL_COCOA
nsxwidget_webkit_goto_history (xw, XFIXNAT (rel_pos));
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#51651: 29.0.50; [PATCH] Fix xwidget-webkit-goto-history
2021-11-07 5:54 ` bug#51651: 29.0.50; [PATCH] Fix xwidget-webkit-goto-history Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-11-07 13:41 ` Lars Ingebrigtsen
0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-07 13:41 UTC (permalink / raw)
To: 51651; +Cc: Po Lu
Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs@gnu.org> writes:
> This makes the back/forward navigation commands work again.
Thanks; applied to the trunk.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-07 13:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <87r1bswlw6.fsf.ref@yahoo.com>
2021-11-07 5:54 ` bug#51651: 29.0.50; [PATCH] Fix xwidget-webkit-goto-history Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-07 13:41 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.