;;(add-hook 'window-configuration-change-hook 'xwidget-cleanup)
(add-hook 'window-configuration-change-hook 'xwidget-delete-zombies)
+(defun xwidget-kill-buffer-query-function ()
+ "Ask beforek illing a buffer that has xwidgets."
+ (let ((xwidgets (get-buffer-xwidgets (current-buffer))))
+ (or (not xwidgets)
+ (yes-or-no-p
+ (format "Buffer %S has xwidgets; kill it? "
+ (buffer-name (current-buffer)))))))
+
+(add-hook 'kill-buffer-query-functions 'xwidget-kill-buffer-query-function)
+
;;killflash is sadly not reliable yet.
(defvar xwidget-webkit-kill-flash-oneshot t)
(defun xwidget-webkit-kill-flash ()
#include "keymap.h"
#include "frame.h"
+#ifdef HAVE_XWIDGETS
+#include "xwidget.h"
+#endif /* HAVE_XWIDGETS */
+
struct buffer *current_buffer; /* The current buffer. */
/* First buffer in chain of all buffers (in reverse order of creation).
kill_buffer_processes (buffer);
UNGCPRO;
+#ifdef HAVE_XWIDGETS
+ GCPRO1 (buffer);
+ kill_buffer_xwidgets (buffer);
+ UNGCPRO;
+#endif /* HAVE_XWIDGETS */
/* Killing buffer processes may run sentinels which may have killed
our buffer. */
if (!BUFFER_LIVE_P (b))
//should work a bit like "make-button"(make-button BEG END &rest PROPERTIES)
// arg "type" and fwd should be keyword args eventually
//(make-xwidget 3 3 'button "oei" 31 31 nil)
- //(xwidget-info (car xwidget-alist))
+ //(xwidget-info (car xwidget-list))
struct xwidget* xw = allocate_xwidget();
Lisp_Object val;
xw->type = type;
DEFSYM (QCplist, ":plist");
- DEFVAR_LISP ("xwidget-alist", Vxwidget_list, doc: /*xwidgets list*/);
+ DEFVAR_LISP ("xwidget-list", Vxwidget_list, doc: /*xwidgets list*/);
Vxwidget_list = Qnil;
DEFVAR_LISP ("xwidget-view-alist", Vxwidget_view_alist, doc: /*xwidget views list*/);
}
}
+/* Kill all xwidget in BUFFER. */
+void
+kill_buffer_xwidgets (Lisp_Object buffer)
+{
+ Lisp_Object tail, xw;
+
+ for (tail = Fget_buffer_xwidgets (buffer); CONSP (tail); tail = XCDR (tail))
+ {
+ xw = XCAR (tail);
+ Vxwidget_list = Fdelq (xw, Vxwidget_list);
+ /* TODO free the GTK things in xw */
+ }
+}
+
#endif /* HAVE_XWIDGETS */
#define XG_XWIDGET "emacs_xwidget"
#define XG_XWIDGET_VIEW "emacs_xwidget_view"
void xwidget_view_delete_all_in_window( struct window *w );
+
+void kill_buffer_xwidgets (Lisp_Object buffer);
#endif /* XWIDGET_H_INCLUDED */