Mercurial > hg > xemacs-beta
annotate src/EmacsShell.c @ 5124:623d57b7fbe8 ben-lisp-object
separate regular and disksave finalization, print method fixes.
Create separate disksave method and make the finalize method only be for
actual object finalization, not disksave finalization.
Fix places where 0 was given in place of a printer -- print methods are
mandatory, and internal objects formerly without a print method now must
explicitly specify internal_object_printer().
Change the defn of CONSOLE_LIVE_P to avoid problems in some weird situations.
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2010-01-20 Ben Wing <ben@xemacs.org>
* alloc.c:
* alloc.c (very_old_free_lcrecord):
* alloc.c (disksave_object_finalization_1):
* alloc.c (make_lcrecord_list):
* alloc.c (alloc_managed_lcrecord):
* alloc.c (free_managed_lcrecord):
* alloc.c (sweep_lcrecords_1):
* buffer.c:
* bytecode.c:
* bytecode.c (Fcompiled_function_p):
* chartab.c:
* console-impl.h:
* console-impl.h (CONSOLE_TYPE_P):
* console.c:
* console.c (set_quit_events):
* data.c:
* data.c (Fmake_ephemeron):
* database.c:
* database.c (finalize_database):
* database.c (Fclose_database):
* device-msw.c:
* device-msw.c (finalize_devmode):
* device-msw.c (allocate_devmode):
* device.c:
* elhash.c:
* elhash.c (finalize_hash_table):
* eval.c:
* eval.c (bind_multiple_value_limits):
* event-stream.c:
* event-stream.c (finalize_command_builder):
* events.c:
* events.c (mark_event):
* extents.c:
* extents.c (finalize_extent_info):
* extents.c (uninit_buffer_extents):
* faces.c:
* file-coding.c:
* file-coding.c (finalize_coding_system):
* file-coding.h:
* file-coding.h (struct coding_system_methods):
* file-coding.h (struct detector):
* floatfns.c:
* floatfns.c (extract_float):
* fns.c:
* fns.c (Fidentity):
* font-mgr.c (finalize_fc_pattern):
* font-mgr.c (finalize_fc_config):
* frame.c:
* glyphs.c:
* glyphs.c (finalize_image_instance):
* glyphs.c (unmap_subwindow_instance_cache_mapper):
* gui.c:
* gui.c (gui_error):
* keymap.c:
* lisp.h (struct Lisp_Symbol):
* lrecord.h:
* lrecord.h (struct lrecord_implementation):
* lrecord.h (MC_ALLOC_CALL_FINALIZER):
* lrecord.h (MC_ALLOC_CALL_FINALIZER_FOR_DISKSAVE):
* lrecord.h (DEFINE_DUMPABLE_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_GENERAL_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_SIZABLE_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_SIZABLE_GENERAL_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_FROB_BLOCK_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_FROB_BLOCK_GENERAL_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_FROB_BLOCK_SIZABLE_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_SIZABLE_INTERNAL_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_GENERAL_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_SIZABLE_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_SIZABLE_GENERAL_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_FROB_BLOCK_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_FROB_BLOCK_GENERAL_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_FROB_BLOCK_SIZABLE_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_INTERNAL_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_SIZABLE_INTERNAL_LISP_OBJECT):
* lrecord.h (MAKE_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_MODULE_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_MODULE_GENERAL_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_MODULE_SIZABLE_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_MODULE_SIZABLE_GENERAL_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_MODULE_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_MODULE_GENERAL_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_MODULE_SIZABLE_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_MODULE_SIZABLE_GENERAL_LISP_OBJECT):
* lrecord.h (MAKE_MODULE_LISP_OBJECT):
* lstream.c:
* lstream.c (finalize_lstream):
* lstream.c (disksave_lstream):
* marker.c:
* marker.c (finalize_marker):
* mule-charset.c (make_charset):
* number.c:
* objects.c:
* objects.c (finalize_color_instance):
* objects.c (finalize_font_instance):
* opaque.c:
* opaque.c (make_opaque_ptr):
* process-nt.c:
* process-nt.c (nt_finalize_process_data):
* process-nt.c (nt_deactivate_process):
* process.c:
* process.c (finalize_process):
* procimpl.h (struct process_methods):
* scrollbar.c:
* scrollbar.c (free_scrollbar_instance):
* specifier.c (finalize_specifier):
* symbols.c:
* toolbar.c:
* toolbar.c (Ftoolbar_button_p):
* tooltalk.c:
* ui-gtk.c:
* ui-gtk.c (emacs_gtk_object_finalizer):
* ui-gtk.c (allocate_emacs_gtk_boxed_data):
* window.c:
* window.c (finalize_window):
* window.c (mark_window_as_deleted):
Separate out regular and disksave finalization. Instead of a
FOR_DISKSAVE argument to the finalizer, create a separate object
method `disksaver'. Make `finalizer' have only one argument.
Go through and separate out all finalize methods into finalize
and disksave. Delete lots of thereby redundant disksave checking.
Delete places that signal an error if we attempt to disksave --
all of these objects are non-dumpable and we will get an error
from pdump anyway if we attempt to dump them. After this is done,
only one object remains that has a disksave method -- lstream.
Change DEFINE_*_LISP_OBJECT_WITH_PROPS to DEFINE_*_GENERAL_LISP_OBJECT,
which is used for specifying either property methods or disksave
methods (or in the future, any other less-used methods).
Remove the for_disksave argument to finalize_process_data. Don't
provide a disksaver for processes because no one currently needs
it.
Clean up various places where objects didn't provide a print method.
It was made mandatory in previous changes, and all methods now
either provide their own print method or use internal_object_printer
or external_object_printer.
Change the definition of CONSOLE_LIVE_P to use the contype enum
rather than looking into the conmeths structure -- in some weird
situations with dead objects, the conmeths structure is NULL,
and printing such objects from debug_print() will crash if we try
to look into the conmeths structure.
| author | Ben Wing <ben@xemacs.org> |
|---|---|
| date | Wed, 20 Jan 2010 07:05:57 -0600 |
| parents | 3d8143fc88e1 |
| children | 308d34e9f07d |
| rev | line source |
|---|---|
| 428 | 1 /* Emacs shell widget -- glue. |
| 2 Copyright (C) 1994, 1995 Sun Microsystems, Inc. | |
| 3 | |
| 4 This file is part of XEmacs. | |
| 5 | |
| 6 XEmacs is free software; you can redistribute it and/or modify it | |
| 7 under the terms of the GNU General Public License as published by the | |
| 8 Free Software Foundation; either version 2, or (at your option) any | |
| 9 later version. | |
| 10 | |
| 11 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
| 12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 14 for more details. | |
| 15 | |
| 16 You should have received a copy of the GNU General Public License | |
| 17 along with XEmacs; see the file COPYING. If not, write to | |
| 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
| 19 Boston, MA 02111-1307, USA. */ | |
| 20 | |
| 21 /* Synched up with: Not in FSF. */ | |
| 22 | |
| 23 /* Written by Ben Wing, May, 1994. */ | |
| 24 | |
| 25 #include <config.h> | |
| 26 | |
| 27 #include <stdio.h> | |
| 28 #include <assert.h> | |
| 29 #include <stdlib.h> | |
| 30 #include <X11/StringDefs.h> | |
| 31 #include "xintrinsicp.h" | |
| 32 #include <X11/Shell.h> | |
| 33 #include <X11/ShellP.h> | |
| 34 #include "EmacsShell.h" | |
| 35 #include "ExternalShell.h" | |
| 36 | |
| 2500 | 37 #define ABORT abort |
| 38 | |
| 428 | 39 #if 0 /* Not currently used */ |
| 40 | |
| 41 /* The root_geometry_manager() method in Shell.c is fucked up with regard | |
| 42 to the user-specified-position vs. program-specified-position and | |
| 43 user-specified-size vs. program-specified-size flag. (It always | |
| 44 sets program-specified whenever the program requests a change | |
| 45 in its size or position, even when this came from direct user | |
| 46 request.) So we provide external entry points to fix this after | |
| 47 the program requested a size or position change. If it turns | |
| 48 out that the user-specified-position flag needs to be set at the | |
| 49 *same* time that the geometry change request is made, then we | |
| 50 will have to duplicate the entire root_geometry_manager() method; | |
| 51 but I don't think there are any WM's that require this. */ | |
| 52 | |
| 53 /* junk stolen from IntrinsicI.h */ | |
| 54 | |
| 55 extern void _XtAllocError( String /* alloc_type */); | |
| 56 | |
| 57 /* junk ungraciously copied from Shell.c */ | |
| 58 | |
| 59 static void ComputeWMSizeHints(w, hints) | |
| 60 WMShellWidget w; | |
| 61 XSizeHints *hints; | |
| 62 { | |
| 63 long flags; | |
| 64 hints->flags = flags = w->wm.size_hints.flags; | |
| 65 #define copy(field) hints->field = w->wm.size_hints.field | |
| 66 if (flags & (USPosition | PPosition)) { | |
| 67 copy(x); | |
| 68 copy(y); | |
| 69 } | |
| 70 if (flags & (USSize | PSize)) { | |
| 71 copy(width); | |
| 72 copy(height); | |
| 73 } | |
| 74 if (flags & PMinSize) { | |
| 75 copy(min_width); | |
| 76 copy(min_height); | |
| 77 } | |
| 78 if (flags & PMaxSize) { | |
| 79 copy(max_width); | |
| 80 copy(max_height); | |
| 81 } | |
| 82 if (flags & PResizeInc) { | |
| 83 copy(width_inc); | |
| 84 copy(height_inc); | |
| 85 } | |
| 86 if (flags & PAspect) { | |
| 87 copy(min_aspect.x); | |
| 88 copy(min_aspect.y); | |
| 89 copy(max_aspect.x); | |
| 90 copy(max_aspect.y); | |
| 91 } | |
| 92 #undef copy | |
| 93 #define copy(field) hints->field = w->wm.field | |
| 94 if (flags & PBaseSize) { | |
| 95 copy(base_width); | |
| 96 copy(base_height); | |
| 97 } | |
| 98 if (flags & PWinGravity) | |
| 99 copy(win_gravity); | |
| 100 #undef copy | |
| 101 } | |
| 102 | |
| 103 static void _SetWMSizeHints(w) | |
| 104 WMShellWidget w; | |
| 105 { | |
| 106 XSizeHints *size_hints = XAllocSizeHints(); | |
| 107 | |
| 108 if (size_hints == NULL) _XtAllocError("XAllocSizeHints"); | |
| 109 ComputeWMSizeHints(w, size_hints); | |
| 110 XSetWMNormalHints(XtDisplay((Widget)w), XtWindow((Widget)w), size_hints); | |
| 111 XFree((char*)size_hints); | |
| 112 } | |
| 113 | |
| 114 /* end of junk ungraciously copied from Shell.c */ | |
| 115 | |
| 116 #endif /* 0 */ | |
| 117 #if 0 /* Not currently used */ | |
| 118 | |
| 119 void | |
| 120 EmacsShellSetSizeUserSpecified (Widget gw) | |
| 121 { | |
| 122 WMShellWidget w = (WMShellWidget) gw; | |
| 123 w->wm.size_hints.flags |= USSize; | |
| 124 w->wm.size_hints.flags &= ~PSize; | |
| 125 if (!w->shell.override_redirect && XtIsRealized (gw)) | |
| 126 _SetWMSizeHints (w); | |
| 127 } | |
| 128 | |
| 129 void | |
| 130 EmacsShellSetPositionUserSpecified (Widget gw) | |
| 131 { | |
| 132 WMShellWidget w = (WMShellWidget) gw; | |
| 133 w->wm.size_hints.flags |= USPosition; | |
| 134 w->wm.size_hints.flags &= ~PPosition; | |
| 135 if (!w->shell.override_redirect && XtIsRealized (gw)) | |
| 136 _SetWMSizeHints (w); | |
| 137 } | |
| 138 | |
| 139 #endif /* 0 */ | |
| 140 | |
| 141 void | |
| 142 EmacsShellSmashIconicHint (Widget shell, int iconic_p) | |
| 143 { | |
| 144 /* See comment in frame-x.c about this */ | |
| 145 WMShellWidget wmshell = (WMShellWidget) shell; | |
| 146 assert (XtIsSubclass (shell, wmShellWidgetClass)); | |
| 147 /* old_state = (wmshell->wm.wm_hints.flags & StateHint | |
| 148 ? wmshell->wm.wm_hints.initial_state | |
| 149 : NormalState); */ | |
| 150 wmshell->wm.wm_hints.flags |= StateHint; | |
| 151 wmshell->wm.wm_hints.initial_state = iconic_p ? IconicState : NormalState; | |
| 152 } | |
| 153 | |
| 154 void | |
| 155 EmacsShellUpdateSizeHints (Widget gw) | |
| 156 { | |
| 157 if (XtIsSubclass (gw, topLevelEmacsShellWidgetClass)) | |
| 158 TopLevelEmacsShellUpdateSizeHints (gw); | |
| 159 #ifdef EXTERNAL_WIDGET | |
| 160 else if (XtIsSubclass (gw, externalShellWidgetClass)) | |
| 161 /* do what ??? Don't abort! */; | |
| 162 #endif | |
| 163 else if (XtIsSubclass (gw, transientEmacsShellWidgetClass)) | |
| 164 TransientEmacsShellUpdateSizeHints (gw); | |
| 165 else | |
| 2500 | 166 ABORT (); |
| 428 | 167 } |
