Mercurial > hg > xemacs-beta
annotate src/gui.c @ 1204:e22b0213b713
[xemacs-hg @ 2003-01-12 11:07:58 by michaels]
modules/ChangeLog:
2002-12-16 Ben Wing <ben@xemacs.org>
* postgresql/postgresql.c:
remove ifdef USE_KKCC.
src/ChangeLog:
2003-01-08 Mike Sperber <mike@xemacs.org>
* console.h (CDFW_CONSOLE): Don't lead to a crash if we're dealing
with a dead window/frame/device/console.
2002-12-20 Mike Sperber <mike@xemacs.org>
* ui-gtk.c: Fix typo from Ben's patch: emacs_ffi_data is a
typedef, not a struct. emacs_gtk_object_data is a typedef, not a
struct.
* gtk-glue.c (gdk_event_to_emacs_event): Fix typos from Ben's
patch: le -> emacs_event + rearrange the code.
* event-gtk.c (gtk_event_to_emacs_event): Fix typos from Ben's
patch: ..._UNDERLYING_GDK_EVENT -> ..._GDK_EVENT, ev -> key_event.
* device-gtk.c: Fix typo from Ben's patch: x_keysym_map_hash_table
-> x_keysym_map_hashtable.
2002-12-19 Mike Sperber <mike@xemacs.org>
* menubar-x.c (set_frame_menubar): Initialize protect_me field of
popup_data.
2002-12-16 Ben Wing <ben@xemacs.org>
Major cleanup of KKCC, etc.
KKCC, pdump-related:
-- descriptions are written for all objects. this required some
changes in the format of some objects, e.g. extents, popup-data,
coding system, lstream, lcrecord-list.
-- KKCC now handles weakness in markers, hash tables, elsewhere
correctly (formerly, you'd eventually get a stack overflow due
to endlessly expanding markers).
-- textual changes: lrecord_description -> memory_description,
struct_description -> sized_memory_description.
-- extensive comment describing descriptions and pdump.
-- redo XD_UNION so it works inline and change its format to provide
sufficient info for pdump. implement XD_UNION in pdump. also add
XD_UNION_DYNAMIC_SIZE, which works like XD_UNION except for when
auto-computing structure sizes.
-- add support for XD_INDIRECT in description offsets (used by
extents).
-- add support for "description maps", allowing for indirect
descriptions that are retrieved from an object at run-time. this
generalizes XD_CODING_SYSTEM_END, XD_SPECIFIER_END, etc., which
have now been eliminated.
-- add a fifth field "flags" to memory_description, to support flags
that can be specified for this particular line. Currently defined
flags are XD_FLAG_NO_KKCC (KKCC should ignore this entry; useful
for the weakness above in markers, etc.), XD_FLAG_NO_PDUMP (pdump
should ignore this entry), XD_FLAG_UNION_DEFAULT_ENTRY (in
union maps, this specifies a "default" entry for all remaining
values), and XD_FLAG_FREE_LISP_OBJECT (for use with lcrecord-lists).
-- clean up the kkcc-itis in events, so that the differences
between event data as separate objects and as a union are now
minimized to a small number of places. with the new XD_UNION, we
no longer need event data as separate objects, so this code is no
longer ifdef USE_KKCC, but instead ifdef EVENT_DATA_AS_OBJECTS,
not used by default. make sure that we explicitly free the
separate event data objects when no longer in use, to maintain the
invariant the event processing causes no consing.
-- also remove other USE_KKCC ifdefs when not necessary.
-- allow for KKCC compilation under MS Windows.
-- fix README.kkcc.
-- dump_add_root_object -> dump_add_root_lisp_object.
-- implement dump_add_root_block and use this to handle
dump_add_opaque.
-- factor out some code duplicated in kkcc and pdump.
Other allocation/object-related:
-- change various *slots.h so MARKED_SLOT() call no longer
includes semicolon.
-- free_marker() takes a Lisp_Object not a direct pointer.
-- make bit vectors lcrecords, like vectors, and eliminate code
that essentially duplicated the lcrecord handling.
-- additional asserts in FREE_FIXED_TYPE, formerly duplicated in
the various callers of this.
-- all lcrecord allocation functions now zero out the returned
lcrecords. unnecessary calls to zero_lcrecord removed. add long
comment describing these functions.
-- extract out process and coding system slots, like for buffers,
frames, etc.
-- lcrecords now set the type of items sitting on the free list to
lcrecord_type_free.
-- changes to the way that gap arrays are allocated, for kkcc's
benefit -- now, one single memory block with a stretchy array on
the end, instead of a separate block holding the array.
Error-checking-related:
-- now can compile with C++ under MS Windows. clean up compile errors
discovered that way. (a few were real problems)
-- add C++ error-checking code to verify problems with mismatched
GCPRO/UNGCPRO. (there were a few in the kkcc code.) add long
comment about how to catch insufficient GCPRO (yes, it's possible
using C++).
-- add debug_p4(), a simple object printer, when debug_print()
doesn't work.
-- add dp() and db() as short synonyms of debug_print(),
debug_backtrace().
-- `print' tries EXTREMELY hard to avoid core dumping when printing
when crashing or from debug_print(), and tries as hard as it
reasonably can in other situations.
-- Correct the message output upon crashing to be more up-to-date.
Event-related:
-- document event-matches-key-specifier-p better.
-- generalize the dispatch queues formerly duplicated in the
various event implementations. add event methods to drain pending
events. generalize and clean up QUIT handling, removing
event-specific quit processing. allow arbitrary keystrokes, not
just ASCII, to be the QUIT char. among other things, this should
fix some longstanding bugs in X quit handling. long comment
describing the various event queues.
-- implement delaying of XFlush() if there are pending expose events.
SOMEONE PLEASE TRY THIS OUT.
-- Fix `xemacs -batch -l dunnet' under Cygwin. Try to fix under
MS Windows but not quite there yet.
Other:
-- class -> class_ and no more C++ games with this item.
new -> new_ in the lwlib code, so far not elsewhere.
-- use `struct htentry' not `struct hentry' in elhash.c to avoid
debugger confusion with hash.c.
-- new macros ALIST_LOOP_3, ALIST_LOOP_4.
* README.kkcc:
* alloc.c:
* alloc.c (deadbeef_memory):
* alloc.c (allocate_lisp_storage):
* alloc.c (copy_lisp_object):
* alloc.c (ALLOCATE_FIXED_TYPE_1):
* alloc.c (FREE_FIXED_TYPE):
* alloc.c (make_vector_internal):
* alloc.c (make_bit_vector_internal):
* alloc.c (make_key_data):
* alloc.c (make_button_data):
* alloc.c (make_motion_data):
* alloc.c (make_process_data):
* alloc.c (make_timeout_data):
* alloc.c (make_magic_data):
* alloc.c (make_magic_eval_data):
* alloc.c (make_eval_data):
* alloc.c (make_misc_user_data):
* alloc.c (struct string_chars_block):
* alloc.c (mark_lcrecord_list):
* alloc.c (make_lcrecord_list):
* alloc.c (alloc_managed_lcrecord):
* alloc.c (free_managed_lcrecord):
* alloc.c (alloc_automanaged_lcrecord):
* alloc.c (staticpro_1):
* alloc.c (staticpro):
* alloc.c (lispdesc_indirect_count_1):
* alloc.c (lispdesc_indirect_description_1):
* alloc.c (lispdesc_one_description_line_size):
* alloc.c (lispdesc_structure_size):
* alloc.c (mark_object_maybe_checking_free):
* alloc.c (mark_with_description):
* alloc.c (mark_struct_contents):
* alloc.c (mark_object):
* alloc.c (tick_lcrecord_stats):
* alloc.c (free_cons):
* alloc.c (free_key_data):
* alloc.c (free_button_data):
* alloc.c (free_motion_data):
* alloc.c (free_process_data):
* alloc.c (free_timeout_data):
* alloc.c (free_magic_data):
* alloc.c (free_magic_eval_data):
* alloc.c (free_eval_data):
* alloc.c (free_misc_user_data):
* alloc.c (free_marker):
* alloc.c (compact_string_chars):
* alloc.c (gc_sweep):
* alloc.c (garbage_collect_1):
* alloc.c (Fgarbage_collect):
* alloc.c (common_init_alloc_early):
* alloc.c (init_alloc_early):
* alloc.c (init_alloc_once_early):
* buffer.c:
* buffer.c (mark_buffer):
* buffer.c (MARKED_SLOT):
* buffer.c (cleanup_buffer_undo_lists):
* buffer.c (Fget_file_buffer):
* buffer.h (MARKED_SLOT):
* bufslots.h:
* bytecode.c:
* callint.c:
* casetab.c:
* chartab.c:
* chartab.c (symbol_to_char_table_type):
* cmdloop.c:
* cmdloop.c (Fcommand_loop_1):
* config.h.in (new):
* conslots.h:
* console-gtk-impl.h (struct gtk_frame):
* console-impl.h:
* console-impl.h (struct console):
* console-impl.h (MARKED_SLOT):
* console-impl.h (CONSOLE_QUIT_EVENT):
* console-msw-impl.h (XM_BUMPQUEUE):
* console-msw.c (write_string_to_mswindows_debugging_output):
* console-msw.h:
* console-stream-impl.h:
* console-stream-impl.h (struct stream_console):
* console-stream.c:
* console-stream.c (stream_init_console):
* console-stream.h:
* console-tty.c:
* console-tty.h:
* console-x.h:
* console.c:
* console.c (mark_console):
* console.c (MARKED_SLOT):
* console.c (allocate_console):
* console.c (get_console_variant):
* console.c (create_console):
* console.c (delete_console_internal):
* console.c (Fset_input_mode):
* console.c (Fcurrent_input_mode):
* console.c (common_init_complex_vars_of_console):
* console.h:
* console.h (console_variant):
* console.h (device_metrics):
* data.c:
* data.c (Faref):
* data.c (Faset):
* data.c (decode_weak_list_type):
* database.c:
* debug.c (xemacs_debug_loop):
* debug.c (FROB):
* debug.c (Fadd_debug_class_to_check):
* debug.c (Fdelete_debug_class_to_check):
* debug.c (Fset_debug_classes_to_check):
* debug.c (Fset_debug_class_types_to_check):
* debug.c (Fdebug_types_being_checked):
* debug.h (DASSERT):
* device-gtk.c:
* device-impl.h (struct device):
* device-impl.h (MARKED_SLOT):
* device-msw.c:
* device-x.c:
* device-x.c (x_init_device_class):
* device-x.c (x_comp_visual_info):
* device-x.c (x_try_best_visual_class):
* device-x.c (x_init_device):
* device-x.c (construct_name_list):
* device-x.c (x_get_resource_prefix):
* device-x.c (Fx_get_resource):
* device-x.c (Fx_display_visual_class):
* device.c:
* device.c (MARKED_SLOT):
* device.c (allocate_device):
* device.c (Fmake_device):
* device.c (delete_device_internal):
* device.c (Fset_device_class):
* device.h:
* devslots.h:
* devslots.h (MARKED_SLOT):
* dialog-msw.c:
* dired-msw.c (mswindows_ls_sort_fcn):
* dired-msw.c (mswindows_get_files):
* dired-msw.c (mswindows_format_file):
* doprnt.c (parse_doprnt_spec):
* dumper.c:
* dumper.c (struct):
* dumper.c (dump_add_root_block):
* dumper.c (dump_add_root_struct_ptr):
* dumper.c (dump_add_root_lisp_object):
* dumper.c (pdump_struct_list_elt):
* dumper.c (pdump_get_entry_list):
* dumper.c (pdump_backtrace):
* dumper.c (pdump_bump_depth):
* dumper.c (pdump_register_sub):
* dumper.c (pdump_register_object):
* dumper.c (pdump_register_struct_contents):
* dumper.c (pdump_register_struct):
* dumper.c (pdump_store_new_pointer_offsets):
* dumper.c (pdump_dump_data):
* dumper.c (pdump_reloc_one):
* dumper.c (pdump_allocate_offset):
* dumper.c (pdump_scan_by_alignment):
* dumper.c (pdump_dump_root_blocks):
* dumper.c (pdump_dump_rtables):
* dumper.c (pdump_dump_root_lisp_objects):
* dumper.c (pdump):
* dumper.c (pdump_load_finish):
* dumper.c (pdump_file_get):
* dumper.c (pdump_resource_get):
* dumper.c (pdump_load):
* editfns.c (save_excursion_restore):
* editfns.c (user_login_name):
* editfns.c (save_restriction_restore):
* elhash.c:
* elhash.c (htentry):
* elhash.c (struct Lisp_Hash_Table):
* elhash.c (HTENTRY_CLEAR_P):
* elhash.c (LINEAR_PROBING_LOOP):
* elhash.c (check_hash_table_invariants):
* elhash.c (mark_hash_table):
* elhash.c (hash_table_equal):
* elhash.c (print_hash_table_data):
* elhash.c (free_hentries):
* elhash.c (make_general_lisp_hash_table):
* elhash.c (decode_hash_table_weakness):
* elhash.c (decode_hash_table_test):
* elhash.c (Fcopy_hash_table):
* elhash.c (resize_hash_table):
* elhash.c (pdump_reorganize_hash_table):
* elhash.c (find_htentry):
* elhash.c (Fgethash):
* elhash.c (Fputhash):
* elhash.c (remhash_1):
* elhash.c (Fremhash):
* elhash.c (Fclrhash):
* elhash.c (copy_compress_hentries):
* elhash.c (elisp_maphash_unsafe):
* elhash.c (finish_marking_weak_hash_tables):
* elhash.c (prune_weak_hash_tables):
* elhash.h:
* emacs.c:
* emacs.c (main_1):
* emacs.c (main):
* emacs.c (shut_down_emacs):
* emodules.h (dump_add_root_lisp_object):
* eval.c:
* eval.c (unwind_to_catch):
* eval.c (maybe_signal_error_1):
* eval.c (maybe_signal_continuable_error_1):
* eval.c (maybe_signal_error):
* eval.c (maybe_signal_continuable_error):
* eval.c (maybe_signal_error_2):
* eval.c (maybe_signal_continuable_error_2):
* eval.c (maybe_signal_ferror):
* eval.c (maybe_signal_continuable_ferror):
* eval.c (maybe_signal_ferror_with_frob):
* eval.c (maybe_signal_continuable_ferror_with_frob):
* eval.c (maybe_syntax_error):
* eval.c (maybe_sferror):
* eval.c (maybe_invalid_argument):
* eval.c (maybe_invalid_constant):
* eval.c (maybe_invalid_operation):
* eval.c (maybe_invalid_change):
* eval.c (maybe_invalid_state):
* eval.c (Feval):
* eval.c (call_trapping_problems):
* eval.c (call_with_suspended_errors):
* eval.c (warn_when_safe_lispobj):
* eval.c (warn_when_safe):
* eval.c (vars_of_eval):
* event-Xt.c:
* event-Xt.c (maybe_define_x_key_as_self_inserting_character):
* event-Xt.c (x_to_emacs_keysym):
* event-Xt.c (x_event_to_emacs_event):
* event-Xt.c (emacs_Xt_enqueue_focus_event):
* event-Xt.c (emacs_Xt_format_magic_event):
* event-Xt.c (emacs_Xt_compare_magic_event):
* event-Xt.c (emacs_Xt_hash_magic_event):
* event-Xt.c (emacs_Xt_handle_magic_event):
* event-Xt.c (Xt_timeout_to_emacs_event):
* event-Xt.c (Xt_process_to_emacs_event):
* event-Xt.c (signal_special_Xt_user_event):
* event-Xt.c (emacs_Xt_next_event):
* event-Xt.c (emacs_Xt_event_handler):
* event-Xt.c (emacs_Xt_drain_queue):
* event-Xt.c (emacs_Xt_event_pending_p):
* event-Xt.c (check_if_pending_expose_event):
* event-Xt.c (reinit_vars_of_event_Xt):
* event-Xt.c (vars_of_event_Xt):
* event-gtk.c:
* event-gtk.c (IS_MODIFIER_KEY):
* event-gtk.c (emacs_gtk_format_magic_event):
* event-gtk.c (emacs_gtk_compare_magic_event):
* event-gtk.c (emacs_gtk_hash_magic_event):
* event-gtk.c (emacs_gtk_handle_magic_event):
* event-gtk.c (gtk_to_emacs_keysym):
* event-gtk.c (gtk_timeout_to_emacs_event):
* event-gtk.c (gtk_process_to_emacs_event):
* event-gtk.c (dragndrop_data_received):
* event-gtk.c (signal_special_gtk_user_event):
* event-gtk.c (emacs_gtk_next_event):
* event-gtk.c (gtk_event_to_emacs_event):
* event-gtk.c (generic_event_handler):
* event-gtk.c (emacs_shell_event_handler):
* event-gtk.c (emacs_gtk_drain_queue):
* event-gtk.c (emacs_gtk_event_pending_p):
* event-gtk.c (reinit_vars_of_event_gtk):
* event-gtk.c (vars_of_event_gtk):
* event-msw.c:
* event-msw.c (struct winsock_stream):
* event-msw.c (winsock_reader):
* event-msw.c (winsock_writer):
* event-msw.c (mswindows_enqueue_dispatch_event):
* event-msw.c (mswindows_enqueue_misc_user_event):
* event-msw.c (mswindows_enqueue_magic_event):
* event-msw.c (mswindows_enqueue_process_event):
* event-msw.c (mswindows_enqueue_mouse_button_event):
* event-msw.c (mswindows_enqueue_keypress_event):
* event-msw.c (mswindows_dequeue_dispatch_event):
* event-msw.c (emacs_mswindows_drain_queue):
* event-msw.c (mswindows_need_event_in_modal_loop):
* event-msw.c (mswindows_need_event):
* event-msw.c (mswindows_wm_timer_callback):
* event-msw.c (dde_eval_string):
* event-msw.c (Fdde_alloc_advise_item):
* event-msw.c (mswindows_dde_callback):
* event-msw.c (mswindows_wnd_proc):
* event-msw.c (remove_timeout_mapper):
* event-msw.c (emacs_mswindows_remove_timeout):
* event-msw.c (emacs_mswindows_event_pending_p):
* event-msw.c (emacs_mswindows_format_magic_event):
* event-msw.c (emacs_mswindows_compare_magic_event):
* event-msw.c (emacs_mswindows_hash_magic_event):
* event-msw.c (emacs_mswindows_handle_magic_event):
* event-msw.c (emacs_mswindows_select_console):
* event-msw.c (emacs_mswindows_unselect_console):
* event-msw.c (reinit_vars_of_event_mswindows):
* event-msw.c (vars_of_event_mswindows):
* event-stream.c:
* event-stream.c (mark_command_builder):
* event-stream.c (reset_command_builder_event_chain):
* event-stream.c (allocate_command_builder):
* event-stream.c (copy_command_builder):
* event-stream.c (command_builder_append_event):
* event-stream.c (event_stream_event_pending_p):
* event-stream.c (event_stream_force_event_pending):
* event-stream.c (maybe_read_quit_event):
* event-stream.c (event_stream_drain_queue):
* event-stream.c (remove_quit_p_event):
* event-stream.c (event_stream_quit_p):
* event-stream.c (echo_key_event):
* event-stream.c (maybe_kbd_translate):
* event-stream.c (execute_help_form):
* event-stream.c (event_stream_generate_wakeup):
* event-stream.c (enqueue_dispatch_event):
* event-stream.c (enqueue_magic_eval_event):
* event-stream.c (Fenqueue_eval_event):
* event-stream.c (enqueue_misc_user_event):
* event-stream.c (enqueue_misc_user_event_pos):
* event-stream.c (next_event_internal):
* event-stream.c (Fnext_event):
* event-stream.c (Faccept_process_output):
* event-stream.c (execute_internal_event):
* event-stream.c (munge_keymap_translate):
* event-stream.c (command_builder_find_leaf_no_mule_processing):
* event-stream.c (command_builder_find_leaf):
* event-stream.c (lookup_command_event):
* event-stream.c (is_scrollbar_event):
* event-stream.c (execute_command_event):
* event-stream.c (Fdispatch_event):
* event-stream.c (Fread_key_sequence):
* event-stream.c (dribble_out_event):
* event-stream.c (vars_of_event_stream):
* event-tty.c (tty_timeout_to_emacs_event):
* event-tty.c (emacs_tty_next_event):
* event-tty.c (emacs_tty_drain_queue):
* event-tty.c (reinit_vars_of_event_tty):
* event-unixoid.c:
* event-unixoid.c (find_tty_or_stream_console_from_fd):
* event-unixoid.c (read_event_from_tty_or_stream_desc):
* event-unixoid.c (drain_tty_devices):
* event-unixoid.c (poll_fds_for_input):
* events.c:
* events.c (deinitialize_event):
* events.c (zero_event):
* events.c (mark_event):
* events.c (print_event_1):
* events.c (print_event):
* events.c (event_equal):
* events.c (event_hash):
* events.c (Fmake_event):
* events.c (Fdeallocate_event):
* events.c (Fcopy_event):
* events.c (map_event_chain_remove):
* events.c (character_to_event):
* events.c (event_to_character):
* events.c (Fevent_to_character):
* events.c (format_event_object):
* events.c (upshift_event):
* events.c (downshift_event):
* events.c (event_upshifted_p):
* events.c (Fevent_live_p):
* events.c (Fevent_type):
* events.c (Fevent_timestamp):
* events.c (CHECK_EVENT_TYPE):
* events.c (CHECK_EVENT_TYPE2):
* events.c (CHECK_EVENT_TYPE3):
* events.c (Fevent_key):
* events.c (Fevent_button):
* events.c (Fevent_modifier_bits):
* events.c (event_x_y_pixel_internal):
* events.c (event_pixel_translation):
* events.c (Fevent_process):
* events.c (Fevent_function):
* events.c (Fevent_object):
* events.c (Fevent_properties):
* events.c (syms_of_events):
* events.c (vars_of_events):
* events.h:
* events.h (struct event_stream):
* events.h (struct Lisp_Key_Data):
* events.h (KEY_DATA_KEYSYM):
* events.h (EVENT_KEY_KEYSYM):
* events.h (struct Lisp_Button_Data):
* events.h (EVENT_BUTTON_BUTTON):
* events.h (struct Lisp_Motion_Data):
* events.h (EVENT_MOTION_X):
* events.h (struct Lisp_Process_Data):
* events.h (EVENT_PROCESS_PROCESS):
* events.h (struct Lisp_Timeout_Data):
* events.h (EVENT_TIMEOUT_INTERVAL_ID):
* events.h (struct Lisp_Eval_Data):
* events.h (EVENT_EVAL_FUNCTION):
* events.h (struct Lisp_Misc_User_Data):
* events.h (EVENT_MISC_USER_FUNCTION):
* events.h (struct Lisp_Magic_Eval_Data):
* events.h (EVENT_MAGIC_EVAL_INTERNAL_FUNCTION):
* events.h (struct Lisp_Magic_Data):
* events.h (EVENT_MAGIC_UNDERLYING):
* events.h (EVENT_MAGIC_GDK_EVENT):
* events.h (struct Lisp_Event):
* events.h (XEVENT_CHANNEL):
* events.h (SET_EVENT_TIMESTAMP_ZERO):
* events.h (SET_EVENT_CHANNEL):
* events.h (SET_EVENT_NEXT):
* events.h (XSET_EVENT_TYPE):
* events.h (struct command_builder):
* extents.c:
* extents.c (gap_array_adjust_markers):
* extents.c (gap_array_recompute_derived_values):
* extents.c (gap_array_move_gap):
* extents.c (gap_array_make_gap):
* extents.c (gap_array_insert_els):
* extents.c (gap_array_delete_els):
* extents.c (gap_array_make_marker):
* extents.c (gap_array_delete_marker):
* extents.c (gap_array_move_marker):
* extents.c (make_gap_array):
* extents.c (free_gap_array):
* extents.c (extent_list_num_els):
* extents.c (extent_list_insert):
* extents.c (mark_extent_auxiliary):
* extents.c (allocate_extent_auxiliary):
* extents.c (decode_extent_at_flag):
* extents.c (verify_extent_mapper):
* extents.c (symbol_to_glyph_layout):
* extents.c (syms_of_extents):
* faces.c:
* file-coding.c:
* file-coding.c (struct_detector_category_description =):
* file-coding.c (detector_category_dynarr_description_1):
* file-coding.c (struct_detector_description =):
* file-coding.c (detector_dynarr_description_1):
* file-coding.c (MARKED_SLOT):
* file-coding.c (mark_coding_system):
* file-coding.c (coding_system_extra_description_map):
* file-coding.c (coding_system_description):
* file-coding.c (allocate_coding_system):
* file-coding.c (symbol_to_eol_type):
* file-coding.c (Fcoding_system_aliasee):
* file-coding.c (set_coding_stream_coding_system):
* file-coding.c (struct convert_eol_coding_system):
* file-coding.c (struct undecided_coding_system):
* file-coding.c (undecided_mark_coding_stream):
* file-coding.c (coding_category_symbol_to_id):
* file-coding.c (struct gzip_coding_system):
* file-coding.c (coding_system_type_create):
* file-coding.h:
* file-coding.h (struct Lisp_Coding_System):
* file-coding.h (CODING_SYSTEM_SLOT_DECLARATION):
* file-coding.h (coding_system_variant):
* file-coding.h (struct coding_system_methods):
* file-coding.h (DEFINE_CODING_SYSTEM_TYPE_WITH_DATA):
* file-coding.h (INITIALIZE_CODING_SYSTEM_TYPE_WITH_DATA):
* file-coding.h (struct coding_stream):
* fileio.c (Fsubstitute_in_file_name):
* floatfns.c:
* fns.c:
* fns.c (base64_encode_1):
* frame-gtk.c:
* frame-gtk.c (Fgtk_start_drag_internal):
* frame-impl.h (struct frame):
* frame-impl.h (MARKED_SLOT):
* frame-msw.c:
* frame-x.c:
* frame-x.c (Fcde_start_drag_internal):
* frame-x.c (Foffix_start_drag_internal):
* frame.c:
* frame.c (MARKED_SLOT):
* frame.c (allocate_frame_core):
* frame.c (delete_frame_internal):
* frame.c (Fmouse_position_as_motion_event):
* frameslots.h:
* frameslots.h (MARKED_SLOT_ARRAY):
* free-hook.c:
* glyphs-msw.c (mswindows_widget_instantiate):
* glyphs-x.c:
* glyphs-x.c (convert_EImage_to_XImage):
* glyphs.c:
* glyphs.c (process_image_string_instantiator):
* glyphs.c (mark_image_instance):
* glyphs.c (allocate_image_instance):
* glyphs.c (unmap_subwindow):
* glyphs.c (map_subwindow):
* glyphs.c (syms_of_glyphs):
* glyphs.c (specifier_type_create_image):
* glyphs.h:
* glyphs.h (struct text_image_instance):
* glyphs.h (struct Lisp_Image_Instance):
* gmalloc.c:
* gmalloc.c ("C"):
* gpmevent.c (Freceive_gpm_event):
* gpmevent.c (gpm_next_event_cb):
* gpmevent.c (vars_of_gpmevent):
* gtk-glue.c (gdk_event_to_emacs_event):
* gtk-xemacs.c (gtk_xemacs_class_init):
* gui-msw.c:
* gui-msw.c (mswindows_handle_gui_wm_command):
* gui-msw.c (mswindows_translate_menu_or_dialog_item):
* gui-x.c:
* gui-x.c (mark_popup_data):
* gui-x.c (snarf_widget_value_mapper):
* gui-x.c (gcpro_popup_callbacks):
* gui-x.c (ungcpro_popup_callbacks):
* gui-x.c (free_popup_widget_value_tree):
* gui-x.c (popup_selection_callback):
* gui-x.h:
* gui-x.h (struct popup_data):
* gui.c:
* gui.c (allocate_gui_item):
* gutter.c (decode_gutter_position):
* hash.c (NULL_ENTRY):
* indent.c (vmotion_1):
* indent.c (vmotion_pixels):
* input-method-motif.c (res):
* input-method-xlib.c (IMInstantiateCallback):
* input-method-xlib.c (XIM_init_device):
* input-method-xlib.c (res):
* intl-encap-win32.c:
* intl-encap-win32.c (qxeSHGetDataFromIDList):
* intl-win32.c:
* intl-win32.c (mswindows_multibyte_cp_type):
* intl-win32.c (struct mswindows_multibyte_coding_system):
* keymap.c:
* keymap.c (make_key_description):
* keymap.c (keymap_store):
* keymap.c (get_keyelt):
* keymap.c (keymap_lookup_1):
* keymap.c (define_key_parser):
* keymap.c (key_desc_list_to_event):
* keymap.c (event_matches_key_specifier_p):
* keymap.c (meta_prefix_char_p):
* keymap.c (ensure_meta_prefix_char_keymapp):
* keymap.c (Fdefine_key):
* keymap.c (struct raw_lookup_key_mapper_closure):
* keymap.c (raw_lookup_key):
* keymap.c (raw_lookup_key_mapper):
* keymap.c (lookup_keys):
* keymap.c (lookup_events):
* keymap.c (Flookup_key):
* keymap.c (struct map_keymap_unsorted_closure):
* keymap.c (map_keymap_unsorted_mapper):
* keymap.c (map_keymap_sorted):
* keymap.c (map_keymap_mapper):
* keymap.c (map_keymap):
* keymap.c (accessible_keymaps_mapper_1):
* keymap.c (Faccessible_keymaps):
* keymap.c (Fsingle_key_description):
* keymap.c (raw_keys_to_keys):
* keymap.c (format_raw_keys):
* keymap.c (where_is_recursive_mapper):
* keymap.c (where_is_internal):
* keymap.c (describe_map_mapper_shadow_search):
* keymap.c (keymap_lookup_inherited_mapper):
* keymap.c (describe_map_mapper):
* keymap.h (event_matches_key_specifier_p):
* lisp.h:
* lisp.h (this):
* lisp.h (RETURN_NOT_REACHED):
* lisp.h (struct Lisp_Vector):
* lisp.h (struct Lisp_Bit_Vector):
* lisp.h (UNGCPRO_1):
* lisp.h (NUNGCPRO):
* lisp.h (NNUNGCPRO):
* lisp.h (DECLARE_INLINE_HEADER):
* lrecord.h:
* lrecord.h (struct lrecord_header):
* lrecord.h (struct lcrecord_header):
* lrecord.h (lrecord_type):
* lrecord.h (struct lrecord_implementation):
* lrecord.h (RECORD_DUMPABLE):
* lrecord.h (memory_description_type):
* lrecord.h (data_description_entry_flags):
* lrecord.h (struct memory_description):
* lrecord.h (struct sized_memory_description):
* lrecord.h (XD_INDIRECT):
* lrecord.h (XD_IS_INDIRECT):
* lrecord.h (XD_DYNARR_DESC):
* lrecord.h (DEFINE_BASIC_LRECORD_IMPLEMENTATION):
* lrecord.h (MAKE_LRECORD_IMPLEMENTATION):
* lrecord.h (MAKE_EXTERNAL_LRECORD_IMPLEMENTATION):
* lrecord.h (alloc_lcrecord_type):
* lstream.c:
* lstream.c (Lstream_new):
* lstream.c (lisp_buffer_marker):
* lstream.h:
* lstream.h (lstream_implementation):
* lstream.h (DEFINE_LSTREAM_IMPLEMENTATION):
* lstream.h (DEFINE_LSTREAM_IMPLEMENTATION_WITH_DATA):
* marker.c:
* marker.c (copy_marker_1):
* mem-limits.h:
* menubar-gtk.c:
* menubar-gtk.c (gtk_popup_menu):
* menubar-msw.c:
* menubar-msw.c (mswindows_popup_menu):
* menubar-x.c (make_dummy_xbutton_event):
* menubar-x.c (command_builder_operate_menu_accelerator):
* menubar-x.c (menu_accelerator_safe_compare):
* menubar-x.c (menu_accelerator_safe_mod_compare):
* mule-charset.c:
* mule-charset.c (make_charset):
* mule-charset.c (Fcharset_property):
* mule-coding.c:
* mule-coding.c (ccs_description_1):
* mule-coding.c (ccs_description =):
* mule-coding.c (ccsd_description_1):
* mule-coding.c (ccsd_description =):
* nt.c (getpwnam):
* nt.c (init_mswindows_environment):
* nt.c (get_cached_volume_information):
* nt.c (mswindows_is_executable):
* nt.c (read_unc_volume):
* nt.c (mswindows_access):
* nt.c (mswindows_link):
* nt.c (mswindows_fstat):
* nt.c (mswindows_stat):
* nt.c (mswindows_executable_type):
* nt.c (Fmswindows_short_file_name):
* nt.c (Fmswindows_long_file_name):
* objects-impl.h (struct Lisp_Color_Instance):
* objects-impl.h (struct Lisp_Font_Instance):
* objects-tty.c:
* objects-x.c (allocate_nearest_color):
* objects.c:
* objects.c (Fmake_color_instance):
* objects.c (Fmake_font_instance):
* objects.c (font_instantiate):
* opaque.c:
* opaque.c (make_opaque):
* opaque.c (make_opaque_ptr):
* opaque.c (reinit_opaque_early):
* opaque.c (init_opaque_once_early):
* print.c:
* print.c (printing_badness):
* print.c (printing_major_badness):
* print.c (print_internal):
* print.c (debug_p4):
* print.c (dp):
* print.c (debug_backtrace):
* process-nt.c (nt_create_process):
* process-nt.c (get_internet_address):
* process-unix.c:
* process-unix.c (struct unix_process_data):
* process-unix.c (get_internet_address):
* process-unix.c (unix_alloc_process_data):
* process-unix.c (unix_create_process):
* process-unix.c (try_to_initialize_subtty):
* process-unix.c (unix_kill_child_process):
* process-unix.c (process_type_create_unix):
* process.c:
* process.c (mark_process):
* process.c (MARKED_SLOT):
* process.c (make_process_internal):
* process.c (Fprocess_tty_name):
* process.c (decode_signal):
* process.h:
* procimpl.h:
* procimpl.h (struct process_methods):
* procimpl.h (struct Lisp_Process):
* rangetab.c:
* realpath.c (readlink_and_correct_case):
* redisplay-x.c (x_window_output_end):
* redisplay-x.c (x_redraw_exposed_area):
* redisplay-x.c (x_clear_frame):
* redisplay.c:
* redisplay.h:
* redisplay.h (struct rune_dglyph):
* redisplay.h (struct rune):
* scrollbar.c:
* scrollbar.c (create_scrollbar_instance):
* specifier.c:
* specifier.c (specifier_empty_extra_description_1):
* specifier.c (make_specifier_internal):
* specifier.c (decode_locale_type):
* specifier.c (decode_how_to_add_specification):
* specifier.h:
* specifier.h (struct specifier_methods):
* specifier.h (DEFINE_SPECIFIER_TYPE_WITH_DATA):
* specifier.h (INITIALIZE_SPECIFIER_TYPE_WITH_DATA):
* symbols.c:
* symbols.c (Fsetplist):
* symbols.c (default_value):
* symbols.c (decode_magic_handler_type):
* symbols.c (handler_type_from_function_symbol):
* symbols.c (Fdefvaralias):
* symbols.c (init_symbols_once_early):
* symbols.c (reinit_symbols_early):
* symsinit.h:
* sysdep.c (sys_subshell):
* sysdep.c (tty_init_sys_modes_on_device):
* syswindows.h:
* text.c (dfc_convert_to_external_format):
* text.c (dfc_convert_to_internal_format):
* text.c (reinit_eistring_early):
* text.c (init_eistring_once_early):
* text.c (reinit_vars_of_text):
* text.h:
* text.h (INC_IBYTEPTR_FMT):
* text.h (DEC_IBYTEPTR_FMT):
* toolbar.c:
* toolbar.c (decode_toolbar_position):
* tooltalk.c:
* ui-gtk.c:
* unexnt.c:
* unexnt.c (_start):
* unexnt.c (unexec):
* unexnt.c (get_section_info):
* unicode.c:
* unicode.c (vars_of_unicode):
* window.c:
* window.c (allocate_window):
* window.c (new_window_mirror):
* window.c (update_mirror_internal):
* winslots.h:
author | michaels |
---|---|
date | Sun, 12 Jan 2003 11:08:22 +0000 |
parents | c925bacdda60 |
children | b531bf8658e9 |
rev | line source |
---|---|
428 | 1 /* Generic GUI code. (menubars, scrollbars, toolbars, dialogs) |
2 Copyright (C) 1995 Board of Trustees, University of Illinois. | |
793 | 3 Copyright (C) 1995, 1996, 2000, 2001, 2002 Ben Wing. |
428 | 4 Copyright (C) 1995 Sun Microsystems, Inc. |
5 Copyright (C) 1998 Free Software Foundation, Inc. | |
6 | |
7 This file is part of XEmacs. | |
8 | |
9 XEmacs is free software; you can redistribute it and/or modify it | |
10 under the terms of the GNU General Public License as published by the | |
11 Free Software Foundation; either version 2, or (at your option) any | |
12 later version. | |
13 | |
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
17 for more details. | |
18 | |
19 You should have received a copy of the GNU General Public License | |
20 along with XEmacs; see the file COPYING. If not, write to | |
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
22 Boston, MA 02111-1307, USA. */ | |
23 | |
24 /* Synched up with: Not in FSF. */ | |
25 | |
793 | 26 /* This file Mule-ized by Ben Wing, 3-24-02. */ |
442 | 27 |
428 | 28 #include <config.h> |
29 #include "lisp.h" | |
872 | 30 |
442 | 31 #include "buffer.h" |
428 | 32 #include "bytecode.h" |
872 | 33 #include "elhash.h" |
34 #include "gui.h" | |
35 #include "menubar.h" | |
428 | 36 |
442 | 37 Lisp_Object Qmenu_no_selection_hook; |
38 Lisp_Object Vmenu_no_selection_hook; | |
428 | 39 |
40 static Lisp_Object parse_gui_item_tree_list (Lisp_Object list); | |
454 | 41 Lisp_Object find_keyword_in_vector (Lisp_Object vector, Lisp_Object keyword); |
428 | 42 |
563 | 43 Lisp_Object Qgui_error; |
44 | |
428 | 45 #ifdef HAVE_POPUPS |
46 | |
47 /* count of menus/dboxes currently up */ | |
48 int popup_up_p; | |
49 | |
50 DEFUN ("popup-up-p", Fpopup_up_p, 0, 0, 0, /* | |
51 Return t if a popup menu or dialog box is up, nil otherwise. | |
52 See `popup-menu' and `popup-dialog-box'. | |
53 */ | |
54 ()) | |
55 { | |
56 return popup_up_p ? Qt : Qnil; | |
57 } | |
58 #endif /* HAVE_POPUPS */ | |
59 | |
60 int | |
867 | 61 separator_string_p (const Ibyte *s) |
428 | 62 { |
867 | 63 const Ibyte *p; |
64 Ibyte first; | |
428 | 65 |
66 if (!s || s[0] == '\0') | |
67 return 0; | |
68 first = s[0]; | |
69 if (first != '-' && first != '=') | |
70 return 0; | |
71 for (p = s; *p == first; p++) | |
72 ; | |
73 | |
74 return (*p == '!' || *p == ':' || *p == '\0'); | |
75 } | |
76 | |
77 /* Massage DATA to find the correct function and argument. Used by | |
78 popup_selection_callback() and the msw code. */ | |
79 void | |
80 get_gui_callback (Lisp_Object data, Lisp_Object *fn, Lisp_Object *arg) | |
81 { | |
442 | 82 if (EQ (data, Qquit)) |
83 { | |
84 *fn = Qeval; | |
85 *arg = list3 (Qsignal, list2 (Qquote, Qquit), Qnil); | |
86 Vquit_flag = Qt; | |
87 } | |
88 else if (SYMBOLP (data) | |
89 || (COMPILED_FUNCTIONP (data) | |
90 && XCOMPILED_FUNCTION (data)->flags.interactivep) | |
91 || (CONSP (data) && (EQ (XCAR (data), Qlambda)) | |
92 && !NILP (Fassq (Qinteractive, Fcdr (Fcdr (data)))))) | |
428 | 93 { |
94 *fn = Qcall_interactively; | |
95 *arg = data; | |
96 } | |
97 else if (CONSP (data)) | |
98 { | |
99 *fn = Qeval; | |
100 *arg = data; | |
101 } | |
102 else | |
103 { | |
104 *fn = Qeval; | |
105 *arg = list3 (Qsignal, | |
106 list2 (Qquote, Qerror), | |
771 | 107 list2 (Qquote, list2 (build_msg_string |
428 | 108 ("illegal callback"), |
109 data))); | |
110 } | |
111 } | |
112 | |
113 /* | |
114 * Add a value VAL associated with keyword KEY into PGUI_ITEM | |
115 * structure. If KEY is not a keyword, or is an unknown keyword, then | |
116 * error is signaled. | |
117 */ | |
454 | 118 int |
428 | 119 gui_item_add_keyval_pair (Lisp_Object gui_item, |
440 | 120 Lisp_Object key, Lisp_Object val, |
578 | 121 Error_Behavior errb) |
428 | 122 { |
442 | 123 Lisp_Gui_Item *pgui_item = XGUI_ITEM (gui_item); |
454 | 124 int retval = 0; |
428 | 125 |
126 if (!KEYWORDP (key)) | |
563 | 127 sferror_2 ("Non-keyword in gui item", key, pgui_item->name); |
428 | 128 |
454 | 129 if (EQ (key, Q_descriptor)) |
130 { | |
131 if (!EQ (pgui_item->name, val)) | |
132 { | |
133 retval = 1; | |
134 pgui_item->name = val; | |
135 } | |
136 } | |
793 | 137 #define FROB(slot) \ |
454 | 138 else if (EQ (key, Q_##slot)) \ |
139 { \ | |
793 | 140 if (!EQ (pgui_item->slot, val)) \ |
454 | 141 { \ |
142 retval = 1; \ | |
793 | 143 pgui_item->slot = val; \ |
454 | 144 } \ |
145 } | |
146 FROB (suffix) | |
147 FROB (active) | |
148 FROB (included) | |
149 FROB (config) | |
150 FROB (filter) | |
151 FROB (style) | |
152 FROB (selected) | |
153 FROB (keys) | |
154 FROB (callback) | |
155 FROB (callback_ex) | |
156 FROB (value) | |
157 #undef FROB | |
440 | 158 else if (EQ (key, Q_key_sequence)) ; /* ignored for FSF compatibility */ |
428 | 159 else if (EQ (key, Q_label)) ; /* ignored for 21.0 implement in 21.2 */ |
160 else if (EQ (key, Q_accelerator)) | |
161 { | |
454 | 162 if (!EQ (pgui_item->accelerator, val)) |
163 { | |
164 retval = 1; | |
165 if (SYMBOLP (val) || CHARP (val)) | |
166 pgui_item->accelerator = val; | |
167 else if (ERRB_EQ (errb, ERROR_ME)) | |
563 | 168 invalid_argument ("Bad keyboard accelerator", val); |
454 | 169 } |
428 | 170 } |
171 else if (ERRB_EQ (errb, ERROR_ME)) | |
793 | 172 invalid_argument_2 ("Unknown keyword in gui item", key, pgui_item->name); |
454 | 173 return retval; |
428 | 174 } |
175 | |
176 void | |
177 gui_item_init (Lisp_Object gui_item) | |
178 { | |
440 | 179 Lisp_Gui_Item *lp = XGUI_ITEM (gui_item); |
428 | 180 |
181 lp->name = Qnil; | |
182 lp->callback = Qnil; | |
442 | 183 lp->callback_ex = Qnil; |
428 | 184 lp->suffix = Qnil; |
185 lp->active = Qt; | |
186 lp->included = Qt; | |
187 lp->config = Qnil; | |
188 lp->filter = Qnil; | |
189 lp->style = Qnil; | |
190 lp->selected = Qnil; | |
191 lp->keys = Qnil; | |
192 lp->accelerator = Qnil; | |
442 | 193 lp->value = Qnil; |
428 | 194 } |
195 | |
196 Lisp_Object | |
197 allocate_gui_item (void) | |
198 { | |
440 | 199 Lisp_Gui_Item *lp = alloc_lcrecord_type (Lisp_Gui_Item, &lrecord_gui_item); |
428 | 200 Lisp_Object val; |
201 | |
793 | 202 val = wrap_gui_item (lp); |
428 | 203 |
204 gui_item_init (val); | |
205 | |
206 return val; | |
207 } | |
208 | |
209 /* | |
210 * ITEM is a lisp vector, describing a menu item or a button. The | |
211 * function extracts the description of the item into the PGUI_ITEM | |
212 * structure. | |
213 */ | |
214 static Lisp_Object | |
215 make_gui_item_from_keywords_internal (Lisp_Object item, | |
578 | 216 Error_Behavior errb) |
428 | 217 { |
218 int length, plist_p, start; | |
219 Lisp_Object *contents; | |
220 Lisp_Object gui_item = allocate_gui_item (); | |
442 | 221 Lisp_Gui_Item *pgui_item = XGUI_ITEM (gui_item); |
428 | 222 |
223 CHECK_VECTOR (item); | |
224 length = XVECTOR_LENGTH (item); | |
225 contents = XVECTOR_DATA (item); | |
226 | |
227 if (length < 1) | |
563 | 228 sferror ("GUI item descriptors must be at least 1 elts long", item); |
428 | 229 |
230 /* length 1: [ "name" ] | |
231 length 2: [ "name" callback ] | |
232 length 3: [ "name" callback active-p ] | |
233 or [ "name" keyword value ] | |
234 length 4: [ "name" callback active-p suffix ] | |
235 or [ "name" callback keyword value ] | |
236 length 5+: [ "name" callback [ keyword value ]+ ] | |
237 or [ "name" [ keyword value ]+ ] | |
238 */ | |
239 plist_p = (length > 2 && (KEYWORDP (contents [1]) | |
240 || KEYWORDP (contents [2]))); | |
241 | |
242 pgui_item->name = contents [0]; | |
243 if (length > 1 && !KEYWORDP (contents [1])) | |
244 { | |
245 pgui_item->callback = contents [1]; | |
246 start = 2; | |
247 } | |
440 | 248 else |
428 | 249 start =1; |
250 | |
251 if (!plist_p && length > 2) | |
252 /* the old way */ | |
253 { | |
254 pgui_item->active = contents [2]; | |
255 if (length == 4) | |
256 pgui_item->suffix = contents [3]; | |
257 } | |
258 else | |
259 /* the new way */ | |
260 { | |
261 int i; | |
262 if ((length - start) & 1) | |
563 | 263 sferror ( |
428 | 264 "GUI item descriptor has an odd number of keywords and values", |
793 | 265 item); |
428 | 266 |
267 for (i = start; i < length;) | |
268 { | |
269 Lisp_Object key = contents [i++]; | |
270 Lisp_Object val = contents [i++]; | |
271 gui_item_add_keyval_pair (gui_item, key, val, errb); | |
272 } | |
273 } | |
274 return gui_item; | |
275 } | |
276 | |
454 | 277 /* This will only work with descriptors in the new format. */ |
278 Lisp_Object | |
279 widget_gui_parse_item_keywords (Lisp_Object item) | |
280 { | |
281 int i, length; | |
282 Lisp_Object *contents; | |
283 Lisp_Object gui_item = allocate_gui_item (); | |
284 Lisp_Object desc = find_keyword_in_vector (item, Q_descriptor); | |
285 | |
286 CHECK_VECTOR (item); | |
287 length = XVECTOR_LENGTH (item); | |
288 contents = XVECTOR_DATA (item); | |
289 | |
290 if (!NILP (desc) && !STRINGP (desc) && !VECTORP (desc)) | |
563 | 291 sferror ("Invalid GUI item descriptor", item); |
454 | 292 |
293 if (length & 1) | |
294 { | |
295 if (!SYMBOLP (contents [0])) | |
563 | 296 sferror ("Invalid GUI item descriptor", item); |
454 | 297 contents++; /* Ignore the leading symbol. */ |
298 length--; | |
299 } | |
300 | |
301 for (i = 0; i < length;) | |
302 { | |
303 Lisp_Object key = contents [i++]; | |
304 Lisp_Object val = contents [i++]; | |
305 gui_item_add_keyval_pair (gui_item, key, val, ERROR_ME_NOT); | |
306 } | |
307 | |
308 return gui_item; | |
309 } | |
310 | |
311 /* Update a gui item from a partial descriptor. */ | |
312 int | |
313 update_gui_item_keywords (Lisp_Object gui_item, Lisp_Object item) | |
314 { | |
315 int i, length, retval = 0; | |
316 Lisp_Object *contents; | |
317 | |
318 CHECK_VECTOR (item); | |
319 length = XVECTOR_LENGTH (item); | |
320 contents = XVECTOR_DATA (item); | |
321 | |
322 if (length & 1) | |
323 { | |
324 if (!SYMBOLP (contents [0])) | |
563 | 325 sferror ("Invalid GUI item descriptor", item); |
454 | 326 contents++; /* Ignore the leading symbol. */ |
327 length--; | |
328 } | |
329 | |
330 for (i = 0; i < length;) | |
331 { | |
332 Lisp_Object key = contents [i++]; | |
333 Lisp_Object val = contents [i++]; | |
793 | 334 if (gui_item_add_keyval_pair (gui_item, key, val, ERROR_ME_DEBUG_WARN)) |
454 | 335 retval = 1; |
336 } | |
337 return retval; | |
338 } | |
339 | |
428 | 340 Lisp_Object |
341 gui_parse_item_keywords (Lisp_Object item) | |
342 { | |
343 return make_gui_item_from_keywords_internal (item, ERROR_ME); | |
344 } | |
345 | |
346 Lisp_Object | |
347 gui_parse_item_keywords_no_errors (Lisp_Object item) | |
348 { | |
793 | 349 return make_gui_item_from_keywords_internal (item, ERROR_ME_DEBUG_WARN); |
428 | 350 } |
351 | |
352 /* convert a gui item into plist properties */ | |
353 void | |
354 gui_add_item_keywords_to_plist (Lisp_Object plist, Lisp_Object gui_item) | |
355 { | |
442 | 356 Lisp_Gui_Item *pgui_item = XGUI_ITEM (gui_item); |
440 | 357 |
428 | 358 if (!NILP (pgui_item->callback)) |
359 Fplist_put (plist, Q_callback, pgui_item->callback); | |
442 | 360 if (!NILP (pgui_item->callback_ex)) |
361 Fplist_put (plist, Q_callback_ex, pgui_item->callback_ex); | |
428 | 362 if (!NILP (pgui_item->suffix)) |
363 Fplist_put (plist, Q_suffix, pgui_item->suffix); | |
364 if (!NILP (pgui_item->active)) | |
365 Fplist_put (plist, Q_active, pgui_item->active); | |
366 if (!NILP (pgui_item->included)) | |
367 Fplist_put (plist, Q_included, pgui_item->included); | |
368 if (!NILP (pgui_item->config)) | |
369 Fplist_put (plist, Q_config, pgui_item->config); | |
370 if (!NILP (pgui_item->filter)) | |
371 Fplist_put (plist, Q_filter, pgui_item->filter); | |
372 if (!NILP (pgui_item->style)) | |
373 Fplist_put (plist, Q_style, pgui_item->style); | |
374 if (!NILP (pgui_item->selected)) | |
375 Fplist_put (plist, Q_selected, pgui_item->selected); | |
376 if (!NILP (pgui_item->keys)) | |
377 Fplist_put (plist, Q_keys, pgui_item->keys); | |
378 if (!NILP (pgui_item->accelerator)) | |
379 Fplist_put (plist, Q_accelerator, pgui_item->accelerator); | |
442 | 380 if (!NILP (pgui_item->value)) |
381 Fplist_put (plist, Q_value, pgui_item->value); | |
428 | 382 } |
383 | |
384 /* | |
385 * Decide whether a GUI item is active by evaluating its :active form | |
386 * if any | |
387 */ | |
388 int | |
389 gui_item_active_p (Lisp_Object gui_item) | |
390 { | |
391 /* This function can call lisp */ | |
392 | |
393 /* Shortcut to avoid evaluating Qt each time */ | |
394 return (EQ (XGUI_ITEM (gui_item)->active, Qt) | |
395 || !NILP (Feval (XGUI_ITEM (gui_item)->active))); | |
396 } | |
397 | |
398 /* set menu accelerator key to first underlined character in menu name */ | |
399 Lisp_Object | |
400 gui_item_accelerator (Lisp_Object gui_item) | |
401 { | |
442 | 402 Lisp_Gui_Item *pgui = XGUI_ITEM (gui_item); |
440 | 403 |
428 | 404 if (!NILP (pgui->accelerator)) |
405 return pgui->accelerator; | |
406 | |
407 else | |
442 | 408 return gui_name_accelerator (pgui->name); |
428 | 409 } |
410 | |
411 Lisp_Object | |
412 gui_name_accelerator (Lisp_Object nm) | |
413 { | |
867 | 414 Ibyte *name = XSTRING_DATA (nm); |
428 | 415 |
442 | 416 while (*name) |
417 { | |
418 if (*name == '%') | |
428 | 419 { |
442 | 420 ++name; |
421 if (!(*name)) | |
422 return Qnil; | |
423 if (*name == '_' && *(name + 1)) | |
424 { | |
867 | 425 Ichar accelerator = itext_ichar (name + 1); |
771 | 426 return make_char (DOWNCASE (0, accelerator)); |
442 | 427 } |
428 | 428 } |
867 | 429 INC_IBYTEPTR (name); |
428 | 430 } |
867 | 431 return make_char (DOWNCASE (0, itext_ichar (XSTRING_DATA (nm)))); |
428 | 432 } |
433 | |
434 /* | |
435 * Decide whether a GUI item is selected by evaluating its :selected form | |
436 * if any | |
437 */ | |
438 int | |
439 gui_item_selected_p (Lisp_Object gui_item) | |
440 { | |
441 /* This function can call lisp */ | |
442 | |
443 /* Shortcut to avoid evaluating Qt each time */ | |
444 return (EQ (XGUI_ITEM (gui_item)->selected, Qt) | |
445 || !NILP (Feval (XGUI_ITEM (gui_item)->selected))); | |
446 } | |
447 | |
442 | 448 Lisp_Object |
449 gui_item_list_find_selected (Lisp_Object gui_item_list) | |
450 { | |
451 /* This function can GC. */ | |
452 Lisp_Object rest; | |
453 LIST_LOOP (rest, gui_item_list) | |
454 { | |
455 if (gui_item_selected_p (XCAR (rest))) | |
456 return XCAR (rest); | |
457 } | |
458 return XCAR (gui_item_list); | |
459 } | |
460 | |
428 | 461 /* |
462 * Decide whether a GUI item is included by evaluating its :included | |
463 * form if given, and testing its :config form against supplied CONFLIST | |
464 * configuration variable | |
465 */ | |
466 int | |
467 gui_item_included_p (Lisp_Object gui_item, Lisp_Object conflist) | |
468 { | |
469 /* This function can call lisp */ | |
442 | 470 Lisp_Gui_Item *pgui_item = XGUI_ITEM (gui_item); |
428 | 471 |
472 /* Evaluate :included first. Shortcut to avoid evaluating Qt each time */ | |
473 if (!EQ (pgui_item->included, Qt) | |
474 && NILP (Feval (pgui_item->included))) | |
475 return 0; | |
476 | |
477 /* Do :config if conflist is given */ | |
478 if (!NILP (conflist) && !NILP (pgui_item->config) | |
479 && NILP (Fmemq (pgui_item->config, conflist))) | |
480 return 0; | |
481 | |
482 return 1; | |
483 } | |
484 | |
485 /* | |
771 | 486 * Format "left flush" display portion of an item. |
428 | 487 */ |
771 | 488 Lisp_Object |
489 gui_item_display_flush_left (Lisp_Object gui_item) | |
428 | 490 { |
491 /* This function can call lisp */ | |
442 | 492 Lisp_Gui_Item *pgui_item = XGUI_ITEM (gui_item); |
771 | 493 Lisp_Object retval; |
428 | 494 |
495 CHECK_STRING (pgui_item->name); | |
771 | 496 retval = pgui_item->name; |
428 | 497 |
498 if (!NILP (pgui_item->suffix)) | |
499 { | |
500 Lisp_Object suffix = pgui_item->suffix; | |
501 /* Shortcut to avoid evaluating suffix each time */ | |
502 if (!STRINGP (suffix)) | |
503 { | |
504 suffix = Feval (suffix); | |
505 CHECK_STRING (suffix); | |
506 } | |
507 | |
771 | 508 retval = concat3 (pgui_item->name, build_string (" "), suffix); |
428 | 509 } |
771 | 510 |
511 return retval; | |
428 | 512 } |
513 | |
514 /* | |
771 | 515 * Format "right flush" display portion of an item into BUF. |
428 | 516 */ |
771 | 517 Lisp_Object |
518 gui_item_display_flush_right (Lisp_Object gui_item) | |
428 | 519 { |
442 | 520 Lisp_Gui_Item *pgui_item = XGUI_ITEM (gui_item); |
428 | 521 |
522 #ifdef HAVE_MENUBARS | |
523 /* Have keys? */ | |
524 if (!menubar_show_keybindings) | |
771 | 525 return Qnil; |
428 | 526 #endif |
527 | |
528 /* Try :keys first */ | |
529 if (!NILP (pgui_item->keys)) | |
530 { | |
531 CHECK_STRING (pgui_item->keys); | |
771 | 532 return pgui_item->keys; |
428 | 533 } |
534 | |
535 /* See if we can derive keys out of callback symbol */ | |
536 if (SYMBOLP (pgui_item->callback)) | |
537 { | |
793 | 538 DECLARE_EISTRING_MALLOC (buf); |
539 Lisp_Object str; | |
540 | |
541 where_is_to_char (pgui_item->callback, buf); | |
542 str = eimake_string (buf); | |
543 eifree (buf); | |
544 return str; | |
428 | 545 } |
546 | |
547 /* No keys - no right flush display */ | |
771 | 548 return Qnil; |
428 | 549 } |
550 | |
1204 | 551 static const struct memory_description gui_item_description [] = { |
934 | 552 { XD_LISP_OBJECT, offsetof (struct Lisp_Gui_Item, name) }, |
553 { XD_LISP_OBJECT, offsetof (struct Lisp_Gui_Item, callback) }, | |
554 { XD_LISP_OBJECT, offsetof (struct Lisp_Gui_Item, callback_ex) }, | |
555 { XD_LISP_OBJECT, offsetof (struct Lisp_Gui_Item, suffix) }, | |
556 { XD_LISP_OBJECT, offsetof (struct Lisp_Gui_Item, active) }, | |
557 { XD_LISP_OBJECT, offsetof (struct Lisp_Gui_Item, included) }, | |
558 { XD_LISP_OBJECT, offsetof (struct Lisp_Gui_Item, config) }, | |
559 { XD_LISP_OBJECT, offsetof (struct Lisp_Gui_Item, filter) }, | |
560 { XD_LISP_OBJECT, offsetof (struct Lisp_Gui_Item, style) }, | |
561 { XD_LISP_OBJECT, offsetof (struct Lisp_Gui_Item, selected) }, | |
562 { XD_LISP_OBJECT, offsetof (struct Lisp_Gui_Item, keys) }, | |
563 { XD_LISP_OBJECT, offsetof (struct Lisp_Gui_Item, accelerator) }, | |
564 { XD_LISP_OBJECT, offsetof (struct Lisp_Gui_Item, value) }, | |
565 { XD_END } | |
566 }; | |
567 | |
428 | 568 static Lisp_Object |
569 mark_gui_item (Lisp_Object obj) | |
570 { | |
440 | 571 Lisp_Gui_Item *p = XGUI_ITEM (obj); |
428 | 572 |
573 mark_object (p->name); | |
574 mark_object (p->callback); | |
442 | 575 mark_object (p->callback_ex); |
428 | 576 mark_object (p->config); |
577 mark_object (p->suffix); | |
578 mark_object (p->active); | |
579 mark_object (p->included); | |
580 mark_object (p->config); | |
581 mark_object (p->filter); | |
582 mark_object (p->style); | |
583 mark_object (p->selected); | |
584 mark_object (p->keys); | |
585 mark_object (p->accelerator); | |
442 | 586 mark_object (p->value); |
428 | 587 |
588 return Qnil; | |
589 } | |
590 | |
665 | 591 static Hashcode |
428 | 592 gui_item_hash (Lisp_Object obj, int depth) |
593 { | |
440 | 594 Lisp_Gui_Item *p = XGUI_ITEM (obj); |
428 | 595 |
442 | 596 return HASH2 (HASH6 (internal_hash (p->name, depth + 1), |
428 | 597 internal_hash (p->callback, depth + 1), |
442 | 598 internal_hash (p->callback_ex, depth + 1), |
428 | 599 internal_hash (p->suffix, depth + 1), |
600 internal_hash (p->active, depth + 1), | |
601 internal_hash (p->included, depth + 1)), | |
442 | 602 HASH6 (internal_hash (p->config, depth + 1), |
428 | 603 internal_hash (p->filter, depth + 1), |
604 internal_hash (p->style, depth + 1), | |
605 internal_hash (p->selected, depth + 1), | |
442 | 606 internal_hash (p->keys, depth + 1), |
607 internal_hash (p->value, depth + 1))); | |
428 | 608 } |
609 | |
610 int | |
611 gui_item_id_hash (Lisp_Object hashtable, Lisp_Object gitem, int slot) | |
612 { | |
613 int hashid = gui_item_hash (gitem, 0); | |
614 int id = GUI_ITEM_ID_BITS (hashid, slot); | |
853 | 615 while (!UNBOUNDP (Fgethash (make_int (id), hashtable, Qunbound))) |
428 | 616 { |
617 id = GUI_ITEM_ID_BITS (id + 1, slot); | |
618 } | |
619 return id; | |
620 } | |
621 | |
442 | 622 int |
623 gui_item_equal_sans_selected (Lisp_Object obj1, Lisp_Object obj2, int depth) | |
428 | 624 { |
440 | 625 Lisp_Gui_Item *p1 = XGUI_ITEM (obj1); |
626 Lisp_Gui_Item *p2 = XGUI_ITEM (obj2); | |
428 | 627 |
628 if (!(internal_equal (p1->name, p2->name, depth + 1) | |
629 && | |
630 internal_equal (p1->callback, p2->callback, depth + 1) | |
631 && | |
442 | 632 internal_equal (p1->callback_ex, p2->callback_ex, depth + 1) |
633 && | |
428 | 634 EQ (p1->suffix, p2->suffix) |
635 && | |
636 EQ (p1->active, p2->active) | |
637 && | |
638 EQ (p1->included, p2->included) | |
639 && | |
640 EQ (p1->config, p2->config) | |
641 && | |
642 EQ (p1->filter, p2->filter) | |
643 && | |
644 EQ (p1->style, p2->style) | |
645 && | |
646 EQ (p1->accelerator, p2->accelerator) | |
647 && | |
442 | 648 EQ (p1->keys, p2->keys) |
649 && | |
650 EQ (p1->value, p2->value))) | |
651 return 0; | |
652 return 1; | |
653 } | |
654 | |
655 static int | |
656 gui_item_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) | |
657 { | |
658 Lisp_Gui_Item *p1 = XGUI_ITEM (obj1); | |
659 Lisp_Gui_Item *p2 = XGUI_ITEM (obj2); | |
660 | |
661 if (!(gui_item_equal_sans_selected (obj1, obj2, depth) | |
662 && | |
663 EQ (p1->selected, p2->selected))) | |
428 | 664 return 0; |
665 return 1; | |
666 } | |
667 | |
668 static void | |
669 print_gui_item (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag) | |
670 { | |
440 | 671 Lisp_Gui_Item *g = XGUI_ITEM (obj); |
428 | 672 |
673 if (print_readably) | |
563 | 674 printing_unreadable_object ("#<gui-item 0x%x>", g->header.uid); |
428 | 675 |
793 | 676 write_fmt_string (printcharfun, "#<gui-item 0x%x>", g->header.uid); |
428 | 677 } |
678 | |
454 | 679 Lisp_Object |
442 | 680 copy_gui_item (Lisp_Object gui_item) |
681 { | |
682 Lisp_Object ret = allocate_gui_item (); | |
683 Lisp_Gui_Item *lp, *g = XGUI_ITEM (gui_item); | |
684 | |
685 lp = XGUI_ITEM (ret); | |
686 lp->name = g->name; | |
687 lp->callback = g->callback; | |
688 lp->callback_ex = g->callback_ex; | |
689 lp->suffix = g->suffix; | |
690 lp->active = g->active; | |
691 lp->included = g->included; | |
692 lp->config = g->config; | |
693 lp->filter = g->filter; | |
694 lp->style = g->style; | |
695 lp->selected = g->selected; | |
696 lp->keys = g->keys; | |
697 lp->accelerator = g->accelerator; | |
698 lp->value = g->value; | |
699 | |
700 return ret; | |
701 } | |
702 | |
703 Lisp_Object | |
704 copy_gui_item_tree (Lisp_Object arg) | |
705 { | |
706 if (CONSP (arg)) | |
707 { | |
708 Lisp_Object rest = arg = Fcopy_sequence (arg); | |
709 while (CONSP (rest)) | |
710 { | |
711 XCAR (rest) = copy_gui_item_tree (XCAR (rest)); | |
712 rest = XCDR (rest); | |
713 } | |
714 return arg; | |
715 } | |
716 else if (GUI_ITEMP (arg)) | |
717 return copy_gui_item (arg); | |
718 else | |
719 return arg; | |
720 } | |
721 | |
428 | 722 /* parse a glyph descriptor into a tree of gui items. |
723 | |
724 The gui_item slot of an image instance can be a single item or an | |
725 arbitrarily nested hierarchy of item lists. */ | |
726 | |
442 | 727 static Lisp_Object |
728 parse_gui_item_tree_item (Lisp_Object entry) | |
428 | 729 { |
730 Lisp_Object ret = entry; | |
442 | 731 struct gcpro gcpro1; |
732 | |
733 GCPRO1 (ret); | |
734 | |
428 | 735 if (VECTORP (entry)) |
736 { | |
442 | 737 ret = gui_parse_item_keywords_no_errors (entry); |
428 | 738 } |
739 else if (STRINGP (entry)) | |
740 { | |
741 CHECK_STRING (entry); | |
742 } | |
743 else | |
563 | 744 sferror ("item must be a vector or a string", entry); |
428 | 745 |
442 | 746 RETURN_UNGCPRO (ret); |
428 | 747 } |
748 | |
442 | 749 Lisp_Object |
750 parse_gui_item_tree_children (Lisp_Object list) | |
428 | 751 { |
442 | 752 Lisp_Object rest, ret = Qnil, sub = Qnil; |
753 struct gcpro gcpro1, gcpro2; | |
754 | |
755 GCPRO2 (ret, sub); | |
428 | 756 CHECK_CONS (list); |
757 /* recursively add items to the tree view */ | |
758 LIST_LOOP (rest, list) | |
759 { | |
760 if (CONSP (XCAR (rest))) | |
761 sub = parse_gui_item_tree_list (XCAR (rest)); | |
762 else | |
763 sub = parse_gui_item_tree_item (XCAR (rest)); | |
440 | 764 |
428 | 765 ret = Fcons (sub, ret); |
766 } | |
767 /* make the order the same as the items we have parsed */ | |
442 | 768 RETURN_UNGCPRO (Fnreverse (ret)); |
428 | 769 } |
770 | |
442 | 771 static Lisp_Object |
772 parse_gui_item_tree_list (Lisp_Object list) | |
428 | 773 { |
774 Lisp_Object ret; | |
442 | 775 struct gcpro gcpro1; |
428 | 776 CHECK_CONS (list); |
777 /* first one can never be a list */ | |
778 ret = parse_gui_item_tree_item (XCAR (list)); | |
442 | 779 GCPRO1 (ret); |
780 ret = Fcons (ret, parse_gui_item_tree_children (XCDR (list))); | |
781 RETURN_UNGCPRO (ret); | |
782 } | |
783 | |
784 static void | |
793 | 785 finalize_gui_item (void *header, int for_disksave) |
442 | 786 { |
428 | 787 } |
788 | |
934 | 789 DEFINE_LRECORD_IMPLEMENTATION ("gui-item", gui_item, |
790 0, /*dumpable-flag*/ | |
791 mark_gui_item, print_gui_item, | |
792 finalize_gui_item, gui_item_equal, | |
793 gui_item_hash, | |
794 gui_item_description, | |
795 Lisp_Gui_Item); | |
563 | 796 |
797 DOESNT_RETURN | |
793 | 798 gui_error (const Char_ASCII *reason, Lisp_Object frob) |
563 | 799 { |
800 signal_error (Qgui_error, reason, frob); | |
801 } | |
802 | |
569 | 803 DOESNT_RETURN |
793 | 804 gui_error_2 (const Char_ASCII *reason, Lisp_Object frob0, Lisp_Object frob1) |
569 | 805 { |
806 signal_error_2 (Qgui_error, reason, frob0, frob1); | |
807 } | |
808 | |
428 | 809 void |
810 syms_of_gui (void) | |
811 { | |
442 | 812 INIT_LRECORD_IMPLEMENTATION (gui_item); |
428 | 813 |
442 | 814 DEFSYMBOL (Qmenu_no_selection_hook); |
428 | 815 |
563 | 816 DEFERROR_STANDARD (Qgui_error, Qio_error); |
817 | |
428 | 818 #ifdef HAVE_POPUPS |
819 DEFSUBR (Fpopup_up_p); | |
820 #endif | |
821 } | |
822 | |
823 void | |
824 vars_of_gui (void) | |
825 { | |
442 | 826 DEFVAR_LISP ("menu-no-selection-hook", &Vmenu_no_selection_hook /* |
827 Function or functions to call when a menu or dialog box is dismissed | |
828 without a selection having been made. | |
829 */ ); | |
830 Vmenu_no_selection_hook = Qnil; | |
428 | 831 } |