;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defun xwidget-delete-zombies ()
+ (mapcar (lambda (xwidget-view)
+ (when (or (not (window-live-p (xwidget-view-window xwidget-view)))
+ (not (find (xwidget-view-model xwidget-view)
+ xwidget-list)))
+ (delete-xwidget-view xwidget-view)))
+ xwidget-view-list))
+
(defun xwidget-cleanup ()
"Delete zombie xwidgets."
;;its still pretty easy to trigger bugs with xwidgets.
;;this function tries to implement a workaround
(interactive)
- (xwidget-delete-zombies) ;;kill xviews who should have been deleted but stull linger
- (redraw-display);;redraw display otherwise ghost of zombies will remain to haunt the screen
- )
-
-
+ ;; kill xviews who should have been deleted but stull linger
+ (xwidget-delete-zombies)
+ ;; redraw display otherwise ghost of zombies will remain to haunt the screen
+ (redraw-display))
;;this is a workaround because I cant find the right place to put it in C
;;seems to work well in practice though
return Qnil;
}
-
-
-DEFUN("xwidget-delete-zombies", Fxwidget_delete_zombies , Sxwidget_delete_zombies, 0,0,0, doc: /* */)
- (void)
+DEFUN ("delete-xwidget-view", Fdelete_xwidget_view, Sdelete_xwidget_view,
+ 1, 1, 0,
+ doc: /* Delete the XWIDGET-VIEW. */)
+ (Lisp_Object xwidget_view)
{
- /*
- - remove all views with window gone
-
- TODO
- - remove all xwidgets with buffer gone
- - remove all views with xw gone
-
- */
- struct xwidget_view* xv = NULL;
- for (Lisp_Object tail = Vxwidget_view_list; CONSP (tail); tail = XCDR (tail))
- {
- if (XWIDGET_VIEW_P (XCAR (tail))) {
- xv = XXWIDGET_VIEW (XCAR (tail));
- if(!WINDOW_LIVE_P (xv->w)) {
- gtk_widget_destroy(GTK_WIDGET(xv->widgetwindow));
- Vxwidget_view_list = Fdelq (XCAR (tail), Vxwidget_view_list);
- }
- }
- }
+ CHECK_XWIDGET_VIEW (xwidget_view);
+ struct xwidget_view *xv = XXWIDGET_VIEW (xwidget_view);
+ gtk_widget_destroy(GTK_WIDGET (xv->widgetwindow));
+ Vxwidget_view_list = Fdelq (xwidget_view, Vxwidget_view_list);
}
DEFUN ("xwidget-view-lookup", Fxwidget_view_lookup, Sxwidget_view_lookup,
defsubr (&Sxwgir_xwidget_call_method );
defsubr (&Sxwgir_require_namespace);
defsubr (&Sxwidget_size_request );
- defsubr (&Sxwidget_delete_zombies);
+ defsubr (&Sdelete_xwidget_view);
defsubr (&Sxwidget_disable_plugin_for_mime);
defsubr (&Sxwidget_send_keyboard_event);