Mercurial > hg > xemacs-beta
diff src/gui-x.c @ 1346:01c57eb70ae9
[xemacs-hg @ 2003-03-09 02:27:27 by ben]
To: xemacs-patches@xemacs.org
i.c: Sleep between calls to check for I/O, since these calls are non-blocking.
behavior.el: Allow other keywords for forward compatibility.
cl-macs.el: Rewrite to eliminate byte-compiler warning when `return' is used
without `finally'.
cmdloop.el: Avoid truncated error messages for `end-of-file' and the like.
cmdloop.el: Avoid char-int error after syncing.
files.el: Eliminate byte-compile warnings.
printer.el: Fix line-width calculations.
#### This used to work. Someone's changes (perhaps by
Michael Sperber?) seem to have messed something up.
simple.el: Use new clear-left-side functions to avoid messages ending up on
the same line as other output.
xemacs.mak: Add override for info/ as well when separate source/build dirs.
xemacs.mak: Order sections in main build process and add comments. Add
additional dependencies to try and prevent later steps from
happening when failures in earlier steps have occurred.
Makefile.in.in: Order sections in main build process and add comments. Add
additional dependencies to try and prevent later steps from
happening when failures in earlier steps have occurred.
alloc.c: Don't arbitrarily clear Vconfigure_info_directory since it
messes up separate build/source dirs.
console.c, console.h, device-msw.c, device.c: Add accidentally omitted msprinter console and data descriptions.
print.c, console-msw.c: Add clear-left-side functionality to help keep stdio/stderr
output from separate sources on separate lines. Generalize
the different kinds of debugging output. Add dpa().
profile.c: Add better docs on Unix/Windows differences.
regex.c: Fix problems with rel-alloc compilation caused by previous patch.
emacs.c: Seg fault rather than abort on Cygwin, since gdb doesn't trap
aborts properly.
console-gtk-impl.h, console-gtk.h, console-msw.h, console-x-impl.h, console-x.h, dialog-gtk.c, dialog-x.c, event-msw.c, frame-gtk.c, frame-x.c, frameslots.h, glyphs-gtk.c, glyphs-x.c, gui-gtk.c, gui-x.c, inline.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, scrollbar-gtk.c, scrollbar-x.c, ui-gtk.c: Delete popup-data object. Delete menubar_data field from frames,
since its usage is frame-specific. Delete menubar-msw.h,
gui-x.h, gui-gtk.h. Clean up handling of lwlib callback data
GCPRO'ing and add missing GCPRO recomputation in widget code.
author | ben |
---|---|
date | Sun, 09 Mar 2003 02:27:46 +0000 |
parents | 70921960b980 |
children | a8d8f419b459 |
line wrap: on
line diff
--- a/src/gui-x.c Sat Mar 08 22:52:26 2003 +0000 +++ b/src/gui-x.c Sun Mar 09 02:27:46 2003 +0000 @@ -39,7 +39,6 @@ #include "redisplay.h" #include "console-x-impl.h" -#include "gui-x.h" #ifdef LWLIB_USES_MOTIF #include "xmotif.h" /* for XmVersion */ @@ -51,7 +50,10 @@ LWLIB_ID new_lwlib_id (void) { - return ++lwlib_id_tick; + lwlib_id_tick++; + if (!lwlib_id_tick) + lwlib_id_tick++; + return lwlib_id_tick; } widget_value * @@ -63,93 +65,75 @@ } -static Lisp_Object -mark_popup_data (Lisp_Object obj) -{ - struct popup_data *data = (struct popup_data *) XPOPUP_DATA (obj); - - mark_object (data->last_menubar_buffer); - return data->protect_me; -} + +/* This contains an alist of (id . protect-me) for GCPRO'ing the callbacks + of the popup menus and dialog boxes. */ +static Lisp_Object Vpopup_callbacks; -static const struct memory_description popup_data_description [] = { - { XD_LISP_OBJECT, offsetof (struct popup_data, last_menubar_buffer) }, - { XD_LISP_OBJECT, offsetof (struct popup_data, protect_me) }, - { XD_END } +struct widget_value_mapper +{ + Lisp_Object protect_me; }; -DEFINE_LRECORD_IMPLEMENTATION ("popup-data", popup_data, - 0, /*dumpable-flag*/ - mark_popup_data, internal_object_printer, - 0, 0, 0, - popup_data_description, - struct popup_data); - -/* This is like FRAME_MENUBAR_DATA (f), but contains an alist of - (id . popup-data) for GCPRO'ing the callbacks of the popup menus - and dialog boxes. */ -static Lisp_Object Vpopup_callbacks; - static int snarf_widget_value_mapper (widget_value *val, void *closure) { - struct popup_data *pdata = (struct popup_data *) closure; + struct widget_value_mapper *z = (struct widget_value_mapper *) closure; if (val->call_data) - pdata->protect_me = Fcons (VOID_TO_LISP (val->call_data), - pdata->protect_me); + z->protect_me = Fcons (VOID_TO_LISP (val->call_data), z->protect_me); if (val->accel) - pdata->protect_me = Fcons (VOID_TO_LISP (val->accel), - pdata->protect_me); + z->protect_me = Fcons (VOID_TO_LISP (val->accel), z->protect_me); return 0; } /* Snarf the callbacks and other Lisp data that are hidden in the lwlib - call-data and accel and stick them into POPUP-DATA for proper marking. */ + call-data and accel associated with id ID and return them for + proper marking. */ -void -snarf_widget_values_for_gcpro (Lisp_Object popup_data) +static Lisp_Object +snarf_widget_values_for_gcpro (LWLIB_ID id) { - struct popup_data *pdata = XPOPUP_DATA (popup_data); + struct widget_value_mapper z; - free_list (pdata->protect_me); - pdata->protect_me = Qnil; + z.protect_me = Qnil; + lw_map_widget_values (id, snarf_widget_value_mapper, &z); + return z.protect_me; +} - if (pdata->id) - lw_map_widget_values (pdata->id, snarf_widget_value_mapper, pdata); -} +/* Given an lwlib id ID associated with a widget tree, make sure that all + Lisp callbacks in the tree are GC-protected. This can be called + multiple times on the same widget tree -- this should be done at + creation time and each time the tree is modified. */ void gcpro_popup_callbacks (LWLIB_ID id) { - struct popup_data *pdata; Lisp_Object lid = make_int (id); - Lisp_Object lpdata; + Lisp_Object this = assq_no_quit (lid, Vpopup_callbacks); - assert (NILP (assq_no_quit (lid, Vpopup_callbacks))); - pdata = alloc_lcrecord_type (struct popup_data, &lrecord_popup_data); - pdata->id = id; - pdata->last_menubar_buffer = Qnil; - pdata->protect_me = Qnil; - pdata->menubar_contents_up_to_date = 0; - lpdata = wrap_popup_data (pdata); + if (!NILP (this)) + { + free_list (XCDR (this)); + XCDR (this) = snarf_widget_values_for_gcpro (id); + } + else + Vpopup_callbacks = Fcons (Fcons (lid, snarf_widget_values_for_gcpro (id)), + Vpopup_callbacks); +} - snarf_widget_values_for_gcpro (lpdata); - - Vpopup_callbacks = Fcons (Fcons (lid, lpdata), Vpopup_callbacks); -} +/* Remove GC-protection from the just-destroyed widget tree associated + with lwlib id ID. */ void ungcpro_popup_callbacks (LWLIB_ID id) { - struct popup_data *pdata; Lisp_Object lid = make_int (id); Lisp_Object this = assq_no_quit (lid, Vpopup_callbacks); + assert (!NILP (this)); - pdata = XPOPUP_DATA (XCDR (this)); - free_list (pdata->protect_me); - pdata->protect_me = Qnil; + free_list (XCDR (this)); Vpopup_callbacks = delq_no_quit (this, Vpopup_callbacks); } @@ -692,7 +676,6 @@ void syms_of_gui_x (void) { - INIT_LRECORD_IMPLEMENTATION (popup_data); } void