1994-01-18 23:47:41 +00:00
|
|
|
|
/* A general interface to the widgets of different toolkits.
|
2011-02-10 05:03:29 +00:00
|
|
|
|
|
2007-02-27 03:08:59 +00:00
|
|
|
|
Copyright (C) 1992, 1993 Lucid, Inc.
|
2013-01-01 09:11:05 +00:00
|
|
|
|
Copyright (C) 1994-1996, 1999-2013 Free Software Foundation, Inc.
|
1994-01-18 23:47:41 +00:00
|
|
|
|
|
|
|
|
|
This file is part of the Lucid Widget Library.
|
|
|
|
|
|
2003-02-04 14:56:31 +00:00
|
|
|
|
The Lucid Widget Library is free software; you can redistribute it and/or
|
1994-01-18 23:47:41 +00:00
|
|
|
|
modify it under the terms of the GNU General Public License as published by
|
2007-02-28 04:25:21 +00:00
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
|
|
The Lucid Widget Library is distributed in the hope that it will be useful,
|
2003-02-04 14:56:31 +00:00
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
1994-01-18 23:47:41 +00:00
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2012-12-31 15:34:32 +00:00
|
|
|
|
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
1994-01-18 23:47:41 +00:00
|
|
|
|
|
Add support for large files, plus some locale improvements.
* dispatch.c, lwlib-Xaw.c, lwlib-Xlw.c, lwlib-Xm.c, lwlib.c, xlwmenu.c,
xrdb-cpp.c, xrdb.c:
Include <config.h> before any system include files.
* lwlib-Xm.c, lwlib.c:
Do not include <stdlib.h> or <string.h>, as <config.h> does this.
1999-10-19 07:21:16 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2009-10-19 04:27:09 +00:00
|
|
|
|
#include <setjmp.h>
|
2011-02-10 05:03:29 +00:00
|
|
|
|
#include <lisp.h>
|
2012-07-06 21:07:46 +00:00
|
|
|
|
#include <c-strcase.h>
|
2001-12-02 04:52:12 +00:00
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <stdio.h>
|
1994-01-18 23:52:12 +00:00
|
|
|
|
#include "lwlib-int.h"
|
1994-01-18 23:47:41 +00:00
|
|
|
|
#include "lwlib-utils.h"
|
1994-01-30 03:17:32 +00:00
|
|
|
|
#include <X11/StringDefs.h>
|
1994-01-18 23:47:41 +00:00
|
|
|
|
|
|
|
|
|
#if defined (USE_LUCID)
|
|
|
|
|
#include "lwlib-Xlw.h"
|
|
|
|
|
#endif
|
|
|
|
|
#if defined (USE_MOTIF)
|
|
|
|
|
#include "lwlib-Xm.h"
|
1994-03-11 15:15:31 +00:00
|
|
|
|
#else /* not USE_MOTIF */
|
|
|
|
|
#if defined (USE_LUCID)
|
|
|
|
|
#define USE_XAW
|
|
|
|
|
#endif /* not USE_MOTIF && USE_LUCID */
|
1994-01-18 23:47:41 +00:00
|
|
|
|
#endif
|
1994-03-11 10:36:17 +00:00
|
|
|
|
#if defined (USE_XAW)
|
2007-06-13 17:34:30 +00:00
|
|
|
|
#ifdef HAVE_XAW3D
|
|
|
|
|
#include <X11/Xaw3d/Paned.h>
|
|
|
|
|
#else /* !HAVE_XAW3D */
|
1998-04-06 10:23:30 +00:00
|
|
|
|
#include <X11/Xaw/Paned.h>
|
2007-06-13 17:34:30 +00:00
|
|
|
|
#endif /* HAVE_XAW3D */
|
1994-03-11 10:36:17 +00:00
|
|
|
|
#include "lwlib-Xaw.h"
|
|
|
|
|
#endif
|
1994-01-18 23:47:41 +00:00
|
|
|
|
|
2002-11-20 19:26:18 +00:00
|
|
|
|
#if !defined (USE_LUCID) && !defined (USE_MOTIF)
|
|
|
|
|
#error At least one of USE_LUCID or USE_MOTIF must be defined.
|
1994-01-18 23:47:41 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1994-09-16 17:37:05 +00:00
|
|
|
|
#ifndef max
|
|
|
|
|
#define max(x, y) ((x) > (y) ? (x) : (y))
|
|
|
|
|
#endif
|
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
/* List of all widgets managed by the library. */
|
|
|
|
|
static widget_info*
|
|
|
|
|
all_widget_info = NULL;
|
|
|
|
|
|
1995-06-11 20:22:09 +00:00
|
|
|
|
#ifdef USE_MOTIF
|
2010-09-20 11:44:39 +00:00
|
|
|
|
const char *lwlib_toolkit_type = "motif";
|
1995-06-11 20:22:09 +00:00
|
|
|
|
#else
|
2010-09-20 11:44:39 +00:00
|
|
|
|
const char *lwlib_toolkit_type = "lucid";
|
1995-06-11 20:22:09 +00:00
|
|
|
|
#endif
|
1994-01-18 23:47:41 +00:00
|
|
|
|
|
2010-07-02 12:19:53 +00:00
|
|
|
|
static widget_value *merge_widget_value (widget_value *,
|
|
|
|
|
widget_value *,
|
|
|
|
|
int, int *);
|
|
|
|
|
static void instantiate_widget_instance (widget_instance *);
|
|
|
|
|
static void safe_free_str (char *);
|
|
|
|
|
static void free_widget_value_tree (widget_value *);
|
|
|
|
|
static widget_value *copy_widget_value_tree (widget_value *,
|
|
|
|
|
change_type);
|
2010-09-20 11:44:39 +00:00
|
|
|
|
static widget_info *allocate_widget_info (const char *, const char *, LWLIB_ID,
|
2010-07-02 12:19:53 +00:00
|
|
|
|
widget_value *,
|
|
|
|
|
lw_callback, lw_callback,
|
|
|
|
|
lw_callback, lw_callback);
|
|
|
|
|
static void free_widget_info (widget_info *);
|
|
|
|
|
static void mark_widget_destroyed (Widget, XtPointer, XtPointer);
|
|
|
|
|
static widget_instance *allocate_widget_instance (widget_info *,
|
|
|
|
|
Widget, Boolean);
|
|
|
|
|
static void free_widget_instance (widget_instance *);
|
|
|
|
|
static widget_info *get_widget_info (LWLIB_ID, Boolean);
|
|
|
|
|
static widget_instance *get_widget_instance (Widget, Boolean);
|
|
|
|
|
static widget_instance *find_instance (LWLIB_ID, Widget, Boolean);
|
2010-09-26 15:11:48 +00:00
|
|
|
|
static Boolean safe_strcmp (const char *, const char *);
|
|
|
|
|
static Widget name_to_widget (widget_instance *, const char *);
|
2010-07-02 12:19:53 +00:00
|
|
|
|
static void set_one_value (widget_instance *, widget_value *, Boolean);
|
|
|
|
|
static void update_one_widget_instance (widget_instance *, Boolean);
|
|
|
|
|
static void update_all_widget_values (widget_info *, Boolean);
|
|
|
|
|
static void initialize_widget_instance (widget_instance *);
|
2010-09-26 15:11:48 +00:00
|
|
|
|
static widget_creation_function find_in_table (const char *, const widget_creation_entry *);
|
|
|
|
|
static Boolean dialog_spec_p (const char *);
|
2010-07-02 12:19:53 +00:00
|
|
|
|
static void destroy_one_instance (widget_instance *);
|
|
|
|
|
static void lw_pop_all_widgets (LWLIB_ID, Boolean);
|
|
|
|
|
static Boolean get_one_value (widget_instance *, widget_value *);
|
|
|
|
|
static void show_one_widget_busy (Widget, Boolean);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
/* utility functions for widget_instance and widget_info */
|
1994-05-09 23:08:26 +00:00
|
|
|
|
char *
|
2010-07-04 05:47:55 +00:00
|
|
|
|
safe_strdup (const char *s)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
char *result;
|
|
|
|
|
if (! s) return 0;
|
2011-01-31 06:44:05 +00:00
|
|
|
|
result = (char *) xmalloc (strlen (s) + 1);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
strcpy (result, s);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2010-07-04 05:47:55 +00:00
|
|
|
|
safe_free_str (char *s)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
2011-10-13 14:55:46 +00:00
|
|
|
|
xfree (s);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static widget_value *widget_value_free_list = 0;
|
1994-02-18 13:24:41 +00:00
|
|
|
|
static int malloc_cpt = 0;
|
1994-01-18 23:47:41 +00:00
|
|
|
|
|
|
|
|
|
widget_value *
|
2010-07-04 05:47:55 +00:00
|
|
|
|
malloc_widget_value (void)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_value *wv;
|
|
|
|
|
if (widget_value_free_list)
|
|
|
|
|
{
|
|
|
|
|
wv = widget_value_free_list;
|
|
|
|
|
widget_value_free_list = wv->free_list;
|
|
|
|
|
wv->free_list = 0;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2011-01-31 06:44:05 +00:00
|
|
|
|
wv = (widget_value *) xmalloc (sizeof (widget_value));
|
1994-02-18 13:24:41 +00:00
|
|
|
|
malloc_cpt++;
|
1994-01-18 23:47:41 +00:00
|
|
|
|
}
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-07 22:18:28 +00:00
|
|
|
|
memset ((void*) wv, 0, sizeof (widget_value));
|
1994-01-18 23:47:41 +00:00
|
|
|
|
return wv;
|
|
|
|
|
}
|
|
|
|
|
|
1996-01-12 21:48:53 +00:00
|
|
|
|
/* this is analogous to free(). It frees only what was allocated
|
2003-02-04 14:56:31 +00:00
|
|
|
|
by malloc_widget_value(), and no substructures.
|
1994-01-18 23:47:41 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2010-07-04 05:47:55 +00:00
|
|
|
|
free_widget_value (widget_value *wv)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
if (wv->free_list)
|
|
|
|
|
abort ();
|
1994-02-18 13:24:41 +00:00
|
|
|
|
|
1994-02-18 22:38:14 +00:00
|
|
|
|
if (malloc_cpt > 25)
|
1994-02-18 13:24:41 +00:00
|
|
|
|
{
|
|
|
|
|
/* When the number of already allocated cells is too big,
|
|
|
|
|
We free it. */
|
2011-10-13 14:55:46 +00:00
|
|
|
|
xfree (wv);
|
1994-02-18 22:38:14 +00:00
|
|
|
|
malloc_cpt--;
|
1994-02-18 13:24:41 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
wv->free_list = widget_value_free_list;
|
|
|
|
|
widget_value_free_list = wv;
|
|
|
|
|
}
|
1994-01-18 23:47:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2010-07-04 05:47:55 +00:00
|
|
|
|
free_widget_value_tree (widget_value *wv)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
if (!wv)
|
|
|
|
|
return;
|
|
|
|
|
|
2011-10-13 14:55:46 +00:00
|
|
|
|
xfree (wv->name);
|
|
|
|
|
xfree (wv->value);
|
|
|
|
|
xfree (wv->key);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
|
2001-12-02 04:52:12 +00:00
|
|
|
|
wv->name = wv->value = wv->key = (char *) 0xDEADBEEF;
|
1994-01-18 23:47:41 +00:00
|
|
|
|
|
|
|
|
|
if (wv->toolkit_data && wv->free_toolkit_data)
|
|
|
|
|
{
|
1996-02-21 20:54:46 +00:00
|
|
|
|
XtFree (wv->toolkit_data);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
wv->toolkit_data = (void *) 0xDEADBEEF;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (wv->contents && (wv->contents != (widget_value*)1))
|
|
|
|
|
{
|
|
|
|
|
free_widget_value_tree (wv->contents);
|
|
|
|
|
wv->contents = (widget_value *) 0xDEADBEEF;
|
|
|
|
|
}
|
|
|
|
|
if (wv->next)
|
|
|
|
|
{
|
|
|
|
|
free_widget_value_tree (wv->next);
|
|
|
|
|
wv->next = (widget_value *) 0xDEADBEEF;
|
|
|
|
|
}
|
|
|
|
|
free_widget_value (wv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static widget_value *
|
2010-07-04 05:47:55 +00:00
|
|
|
|
copy_widget_value_tree (widget_value *val, change_type change)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_value* copy;
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
if (!val)
|
|
|
|
|
return NULL;
|
|
|
|
|
if (val == (widget_value *) 1)
|
|
|
|
|
return val;
|
|
|
|
|
|
|
|
|
|
copy = malloc_widget_value ();
|
|
|
|
|
copy->name = safe_strdup (val->name);
|
|
|
|
|
copy->value = safe_strdup (val->value);
|
|
|
|
|
copy->key = safe_strdup (val->key);
|
2001-12-02 04:52:12 +00:00
|
|
|
|
copy->help = val->help;
|
1994-01-18 23:47:41 +00:00
|
|
|
|
copy->enabled = val->enabled;
|
1999-07-21 21:43:52 +00:00
|
|
|
|
copy->button_type = val->button_type;
|
1994-01-18 23:47:41 +00:00
|
|
|
|
copy->selected = val->selected;
|
|
|
|
|
copy->edited = False;
|
|
|
|
|
copy->change = change;
|
1996-03-25 01:47:33 +00:00
|
|
|
|
copy->this_one_change = change;
|
1994-01-18 23:47:41 +00:00
|
|
|
|
copy->contents = copy_widget_value_tree (val->contents, change);
|
|
|
|
|
copy->call_data = val->call_data;
|
|
|
|
|
copy->next = copy_widget_value_tree (val->next, change);
|
|
|
|
|
copy->toolkit_data = NULL;
|
|
|
|
|
copy->free_toolkit_data = False;
|
|
|
|
|
return copy;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static widget_info *
|
2010-09-20 11:44:39 +00:00
|
|
|
|
allocate_widget_info (const char* type,
|
|
|
|
|
const char* name,
|
Change function definition from K&R to prototype. Fix prototype warnings.
* lwlib-Xaw.c (xaw_generic_callback, command_reset)
(xaw_update_one_value): Reformat.
(xaw_update_one_widget): Reformat and remove dead code.
(xaw_scrollbar_scroll, xaw_scrollbar_jump, xaw_create_scrollbar)
(xaw_update_scrollbar): Remove (not used).
(make_dialog): Change from K&R to prototype. Remove dead code.
(xaw_creation_table): Remove scrollbar entry.
* lwlib-Xlw.c (x_print_complete_resource_name): Change from K&R to
prototype.
(xlw_update_one_value): Reformat.
* lwlib-Xm.c (x_print_complete_resource_name)
(make_destroyed_instance, free_destroyed_instance, first_child)
(lw_motif_widget_p, resource_motif_string, destroy_all_children)
(xm_arm_callback, xm_update_label, xm_update_list)
(xm_update_pushbutton, xm_update_cascadebutton)
(xm_update_toggle, xm_update_radiobox, make_menu_in_widget)
(update_one_menu_entry, xm_update_menu, xm_update_text)
(xm_update_text_field, xm_update_one_widget)
(xm_update_one_value, activate_button, dialog_key_cb)
(make_dialog, mark_dead_instance_destroyed)
(find_matching_instance, recenter_widget, recycle_instance)
(xm_create_dialog, make_menubar, remove_grabs, make_popup_menu)
(make_main, xm_destroy_instance, xm_popup_menu)
(set_min_dialog_size, xm_pop_instance, do_call)
(xm_internal_update_other_instances, xm_generic_callback)
(xm_nosel_callback, xm_pull_down_callback, xm_pop_down_callback)
(xm_set_keyboard_focus, xm_set_main_areas, xm_manage_resizing): Change
from K&R to prototype.
* lwlib-int.h (widget_creation_function): Fix prototype.
* lwlib.c (allocate_widget_info, lw_register_widget): Change from K&R
to prototype.
(lw_internal_update_other_instances, merge_widget_value): Reformat.
* xlwmenu.c (size_menu_item): Change from K&R to prototype.
Change label_width and height to int.
(draw_arrow, draw_shadow_rectangle, draw_shadow_rhombus)
(draw_separator, display_menu, fit_to_screen, motion_event_is_in_menu)
(map_event_to_widget_value): Reformat.
(display_menu_item): Change from K&R to prototype.
2010-07-08 10:29:51 +00:00
|
|
|
|
LWLIB_ID id,
|
|
|
|
|
widget_value* val,
|
|
|
|
|
lw_callback pre_activate_cb,
|
|
|
|
|
lw_callback selection_cb,
|
|
|
|
|
lw_callback post_activate_cb,
|
|
|
|
|
lw_callback highlight_cb)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
2011-01-31 06:44:05 +00:00
|
|
|
|
widget_info* info = (widget_info*) xmalloc (sizeof (widget_info));
|
1994-01-18 23:47:41 +00:00
|
|
|
|
info->type = safe_strdup (type);
|
|
|
|
|
info->name = safe_strdup (name);
|
|
|
|
|
info->id = id;
|
|
|
|
|
info->val = copy_widget_value_tree (val, STRUCTURAL_CHANGE);
|
|
|
|
|
info->busy = False;
|
|
|
|
|
info->pre_activate_cb = pre_activate_cb;
|
|
|
|
|
info->selection_cb = selection_cb;
|
|
|
|
|
info->post_activate_cb = post_activate_cb;
|
2000-01-17 09:10:05 +00:00
|
|
|
|
info->highlight_cb = highlight_cb;
|
1994-01-18 23:47:41 +00:00
|
|
|
|
info->instances = NULL;
|
|
|
|
|
|
|
|
|
|
info->next = all_widget_info;
|
|
|
|
|
all_widget_info = info;
|
|
|
|
|
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2010-07-04 05:47:55 +00:00
|
|
|
|
free_widget_info (widget_info *info)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
safe_free_str (info->type);
|
|
|
|
|
safe_free_str (info->name);
|
|
|
|
|
free_widget_value_tree (info->val);
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-07 22:18:28 +00:00
|
|
|
|
memset ((void*)info, 0xDEADBEEF, sizeof (widget_info));
|
2011-10-13 14:55:46 +00:00
|
|
|
|
xfree (info);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2010-07-04 05:47:55 +00:00
|
|
|
|
mark_widget_destroyed (Widget widget, XtPointer closure, XtPointer call_data)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_instance* instance = (widget_instance*)closure;
|
|
|
|
|
|
|
|
|
|
/* be very conservative */
|
|
|
|
|
if (instance->widget == widget)
|
|
|
|
|
instance->widget = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static widget_instance *
|
2002-11-20 19:26:18 +00:00
|
|
|
|
allocate_widget_instance (widget_info* info, Widget parent, Boolean pop_up_p)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_instance* instance =
|
2011-01-31 06:44:05 +00:00
|
|
|
|
(widget_instance*) xmalloc (sizeof (widget_instance));
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-07 22:18:28 +00:00
|
|
|
|
memset (instance, 0, sizeof *instance);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
instance->parent = parent;
|
|
|
|
|
instance->pop_up_p = pop_up_p;
|
|
|
|
|
instance->info = info;
|
|
|
|
|
instance->next = info->instances;
|
|
|
|
|
info->instances = instance;
|
|
|
|
|
|
1996-01-12 21:48:53 +00:00
|
|
|
|
instantiate_widget_instance (instance);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
|
|
|
|
|
XtAddCallback (instance->widget, XtNdestroyCallback,
|
|
|
|
|
mark_widget_destroyed, (XtPointer)instance);
|
|
|
|
|
return instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2010-07-04 05:47:55 +00:00
|
|
|
|
free_widget_instance (widget_instance *instance)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-07 22:18:28 +00:00
|
|
|
|
memset ((void*)instance, 0xDEADBEEF, sizeof (widget_instance));
|
2011-10-13 14:55:46 +00:00
|
|
|
|
xfree (instance);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static widget_info *
|
2002-11-20 19:26:18 +00:00
|
|
|
|
get_widget_info (LWLIB_ID id, Boolean remove_p)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_info* info;
|
|
|
|
|
widget_info* prev;
|
|
|
|
|
for (prev = NULL, info = all_widget_info;
|
|
|
|
|
info;
|
|
|
|
|
prev = info, info = info->next)
|
|
|
|
|
if (info->id == id)
|
|
|
|
|
{
|
|
|
|
|
if (remove_p)
|
|
|
|
|
{
|
|
|
|
|
if (prev)
|
|
|
|
|
prev->next = info->next;
|
|
|
|
|
else
|
|
|
|
|
all_widget_info = info->next;
|
|
|
|
|
}
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
1994-03-11 10:36:17 +00:00
|
|
|
|
/* Internal function used by the library dependent implementation to get the
|
|
|
|
|
widget_value for a given widget in an instance */
|
|
|
|
|
widget_info *
|
2010-07-04 05:47:55 +00:00
|
|
|
|
lw_get_widget_info (LWLIB_ID id)
|
1994-03-11 10:36:17 +00:00
|
|
|
|
{
|
|
|
|
|
return get_widget_info (id, 0);
|
|
|
|
|
}
|
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
static widget_instance *
|
2002-11-20 19:26:18 +00:00
|
|
|
|
get_widget_instance (Widget widget, Boolean remove_p)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_info* info;
|
|
|
|
|
widget_instance* instance;
|
|
|
|
|
widget_instance* prev;
|
|
|
|
|
for (info = all_widget_info; info; info = info->next)
|
|
|
|
|
for (prev = NULL, instance = info->instances;
|
|
|
|
|
instance;
|
|
|
|
|
prev = instance, instance = instance->next)
|
|
|
|
|
if (instance->widget == widget)
|
|
|
|
|
{
|
|
|
|
|
if (remove_p)
|
|
|
|
|
{
|
|
|
|
|
if (prev)
|
|
|
|
|
prev->next = instance->next;
|
|
|
|
|
else
|
|
|
|
|
info->instances = instance->next;
|
|
|
|
|
}
|
|
|
|
|
return instance;
|
|
|
|
|
}
|
|
|
|
|
return (widget_instance *) 0;
|
|
|
|
|
}
|
|
|
|
|
|
2000-01-17 09:10:05 +00:00
|
|
|
|
/* Value is a pointer to the widget_instance corresponding to
|
|
|
|
|
WIDGET, or null if WIDGET is not a lwlib widget. */
|
|
|
|
|
|
|
|
|
|
widget_instance *
|
2010-07-04 05:47:55 +00:00
|
|
|
|
lw_get_widget_instance (Widget widget)
|
2000-01-17 09:10:05 +00:00
|
|
|
|
{
|
|
|
|
|
return get_widget_instance (widget, False);
|
|
|
|
|
}
|
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
static widget_instance*
|
2002-11-20 19:26:18 +00:00
|
|
|
|
find_instance (LWLIB_ID id, Widget parent, Boolean pop_up_p)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_info* info = get_widget_info (id, False);
|
|
|
|
|
widget_instance* instance;
|
|
|
|
|
|
|
|
|
|
if (info)
|
|
|
|
|
for (instance = info->instances; instance; instance = instance->next)
|
|
|
|
|
if (instance->parent == parent && instance->pop_up_p == pop_up_p)
|
|
|
|
|
return instance;
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* utility function for widget_value */
|
|
|
|
|
static Boolean
|
2010-09-26 15:11:48 +00:00
|
|
|
|
safe_strcmp (const char *s1, const char *s2)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
if (!!s1 ^ !!s2) return True;
|
|
|
|
|
return (s1 && s2) ? strcmp (s1, s2) : s1 ? False : !!s2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
# define EXPLAIN(name, oc, nc, desc, a1, a2) \
|
|
|
|
|
printf ("Change: \"%s\"\tmax(%s=%d,%s=%d)\t%s %d %d\n", \
|
|
|
|
|
name, \
|
|
|
|
|
(oc == NO_CHANGE ? "none" : \
|
|
|
|
|
(oc == INVISIBLE_CHANGE ? "invisible" : \
|
|
|
|
|
(oc == VISIBLE_CHANGE ? "visible" : \
|
|
|
|
|
(oc == STRUCTURAL_CHANGE ? "structural" : "???")))), \
|
|
|
|
|
oc, \
|
|
|
|
|
(nc == NO_CHANGE ? "none" : \
|
|
|
|
|
(nc == INVISIBLE_CHANGE ? "invisible" : \
|
|
|
|
|
(nc == VISIBLE_CHANGE ? "visible" : \
|
|
|
|
|
(nc == STRUCTURAL_CHANGE ? "structural" : "???")))), \
|
|
|
|
|
nc, desc, a1, a2)
|
|
|
|
|
#else
|
2011-04-16 01:42:03 +00:00
|
|
|
|
# define EXPLAIN(name, oc, nc, desc, a1, a2) ((void) 0)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static widget_value *
|
Change function definition from K&R to prototype. Fix prototype warnings.
* lwlib-Xaw.c (xaw_generic_callback, command_reset)
(xaw_update_one_value): Reformat.
(xaw_update_one_widget): Reformat and remove dead code.
(xaw_scrollbar_scroll, xaw_scrollbar_jump, xaw_create_scrollbar)
(xaw_update_scrollbar): Remove (not used).
(make_dialog): Change from K&R to prototype. Remove dead code.
(xaw_creation_table): Remove scrollbar entry.
* lwlib-Xlw.c (x_print_complete_resource_name): Change from K&R to
prototype.
(xlw_update_one_value): Reformat.
* lwlib-Xm.c (x_print_complete_resource_name)
(make_destroyed_instance, free_destroyed_instance, first_child)
(lw_motif_widget_p, resource_motif_string, destroy_all_children)
(xm_arm_callback, xm_update_label, xm_update_list)
(xm_update_pushbutton, xm_update_cascadebutton)
(xm_update_toggle, xm_update_radiobox, make_menu_in_widget)
(update_one_menu_entry, xm_update_menu, xm_update_text)
(xm_update_text_field, xm_update_one_widget)
(xm_update_one_value, activate_button, dialog_key_cb)
(make_dialog, mark_dead_instance_destroyed)
(find_matching_instance, recenter_widget, recycle_instance)
(xm_create_dialog, make_menubar, remove_grabs, make_popup_menu)
(make_main, xm_destroy_instance, xm_popup_menu)
(set_min_dialog_size, xm_pop_instance, do_call)
(xm_internal_update_other_instances, xm_generic_callback)
(xm_nosel_callback, xm_pull_down_callback, xm_pop_down_callback)
(xm_set_keyboard_focus, xm_set_main_areas, xm_manage_resizing): Change
from K&R to prototype.
* lwlib-int.h (widget_creation_function): Fix prototype.
* lwlib.c (allocate_widget_info, lw_register_widget): Change from K&R
to prototype.
(lw_internal_update_other_instances, merge_widget_value): Reformat.
* xlwmenu.c (size_menu_item): Change from K&R to prototype.
Change label_width and height to int.
(draw_arrow, draw_shadow_rectangle, draw_shadow_rhombus)
(draw_separator, display_menu, fit_to_screen, motion_event_is_in_menu)
(map_event_to_widget_value): Reformat.
(display_menu_item): Change from K&R to prototype.
2010-07-08 10:29:51 +00:00
|
|
|
|
merge_widget_value (widget_value *val1,
|
|
|
|
|
widget_value *val2,
|
|
|
|
|
int level,
|
|
|
|
|
int *change_p)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
1996-03-25 01:47:33 +00:00
|
|
|
|
change_type change, this_one_change;
|
1994-01-18 23:47:41 +00:00
|
|
|
|
widget_value* merged_next;
|
|
|
|
|
widget_value* merged_contents;
|
|
|
|
|
|
|
|
|
|
if (!val1)
|
|
|
|
|
{
|
|
|
|
|
if (val2)
|
2000-03-05 14:31:04 +00:00
|
|
|
|
{
|
|
|
|
|
*change_p = 1;
|
|
|
|
|
return copy_widget_value_tree (val2, STRUCTURAL_CHANGE);
|
|
|
|
|
}
|
1994-01-18 23:47:41 +00:00
|
|
|
|
else
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
if (!val2)
|
|
|
|
|
{
|
2000-03-05 14:31:04 +00:00
|
|
|
|
*change_p = 1;
|
1994-01-18 23:47:41 +00:00
|
|
|
|
free_widget_value_tree (val1);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
change = NO_CHANGE;
|
|
|
|
|
|
|
|
|
|
if (safe_strcmp (val1->name, val2->name))
|
|
|
|
|
{
|
|
|
|
|
EXPLAIN (val1->name, change, STRUCTURAL_CHANGE, "name change",
|
|
|
|
|
val1->name, val2->name);
|
|
|
|
|
change = max (change, STRUCTURAL_CHANGE);
|
|
|
|
|
safe_free_str (val1->name);
|
|
|
|
|
val1->name = safe_strdup (val2->name);
|
|
|
|
|
}
|
|
|
|
|
if (safe_strcmp (val1->value, val2->value))
|
|
|
|
|
{
|
|
|
|
|
EXPLAIN (val1->name, change, VISIBLE_CHANGE, "value change",
|
|
|
|
|
val1->value, val2->value);
|
|
|
|
|
change = max (change, VISIBLE_CHANGE);
|
|
|
|
|
safe_free_str (val1->value);
|
|
|
|
|
val1->value = safe_strdup (val2->value);
|
|
|
|
|
}
|
|
|
|
|
if (safe_strcmp (val1->key, val2->key))
|
|
|
|
|
{
|
|
|
|
|
EXPLAIN (val1->name, change, VISIBLE_CHANGE, "key change",
|
|
|
|
|
val1->key, val2->key);
|
|
|
|
|
change = max (change, VISIBLE_CHANGE);
|
|
|
|
|
safe_free_str (val1->key);
|
|
|
|
|
val1->key = safe_strdup (val2->key);
|
|
|
|
|
}
|
2001-12-02 04:52:12 +00:00
|
|
|
|
if (! EQ (val1->help, val2->help))
|
2000-01-17 09:10:05 +00:00
|
|
|
|
{
|
|
|
|
|
EXPLAIN (val1->name, change, VISIBLE_CHANGE, "help change",
|
|
|
|
|
val1->help, val2->help);
|
|
|
|
|
change = max (change, VISIBLE_CHANGE);
|
2001-12-02 04:52:12 +00:00
|
|
|
|
val1->help = val2->help;
|
2000-01-17 09:10:05 +00:00
|
|
|
|
}
|
1994-01-18 23:47:41 +00:00
|
|
|
|
if (val1->enabled != val2->enabled)
|
|
|
|
|
{
|
|
|
|
|
EXPLAIN (val1->name, change, VISIBLE_CHANGE, "enablement change",
|
|
|
|
|
val1->enabled, val2->enabled);
|
|
|
|
|
change = max (change, VISIBLE_CHANGE);
|
|
|
|
|
val1->enabled = val2->enabled;
|
|
|
|
|
}
|
1999-07-21 21:43:52 +00:00
|
|
|
|
if (val1->button_type != val2->button_type)
|
|
|
|
|
{
|
|
|
|
|
EXPLAIN (val1->name, change, VISIBLE_CHANGE, "button type change",
|
|
|
|
|
val1->button_type, val2->button_type);
|
|
|
|
|
change = max (change, VISIBLE_CHANGE);
|
|
|
|
|
val1->button_type = val2->button_type;
|
|
|
|
|
}
|
1994-01-18 23:47:41 +00:00
|
|
|
|
if (val1->selected != val2->selected)
|
|
|
|
|
{
|
|
|
|
|
EXPLAIN (val1->name, change, VISIBLE_CHANGE, "selection change",
|
|
|
|
|
val1->selected, val2->selected);
|
|
|
|
|
change = max (change, VISIBLE_CHANGE);
|
|
|
|
|
val1->selected = val2->selected;
|
|
|
|
|
}
|
|
|
|
|
if (val1->call_data != val2->call_data)
|
|
|
|
|
{
|
|
|
|
|
EXPLAIN (val1->name, change, INVISIBLE_CHANGE, "call-data change",
|
|
|
|
|
val1->call_data, val2->call_data);
|
|
|
|
|
change = max (change, INVISIBLE_CHANGE);
|
|
|
|
|
val1->call_data = val2->call_data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (level > 0)
|
|
|
|
|
{
|
|
|
|
|
merged_contents =
|
2000-03-05 14:31:04 +00:00
|
|
|
|
merge_widget_value (val1->contents, val2->contents, level - 1,
|
|
|
|
|
change_p);
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
if (val1->contents && !merged_contents)
|
|
|
|
|
{
|
1996-01-12 21:48:53 +00:00
|
|
|
|
/* This used to say INVISIBLE_CHANGE,
|
|
|
|
|
but it is visible and vitally important when
|
|
|
|
|
the contents of the menu bar itself are entirely deleted.
|
|
|
|
|
|
|
|
|
|
But maybe it doesn't matter. This fails to fix the bug. */
|
|
|
|
|
EXPLAIN (val1->name, change, STRUCTURAL_CHANGE, "(contents gone)",
|
1994-01-18 23:47:41 +00:00
|
|
|
|
0, 0);
|
1996-01-12 21:48:53 +00:00
|
|
|
|
change = max (change, STRUCTURAL_CHANGE);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
}
|
|
|
|
|
else if (merged_contents && merged_contents->change != NO_CHANGE)
|
|
|
|
|
{
|
|
|
|
|
EXPLAIN (val1->name, change, INVISIBLE_CHANGE, "(contents change)",
|
|
|
|
|
0, 0);
|
|
|
|
|
change = max (change, INVISIBLE_CHANGE);
|
1996-08-10 18:51:19 +00:00
|
|
|
|
#if 0 /* This was replaced by the August 9 1996 change in lwlib-Xm.c. */
|
1996-07-27 16:19:46 +00:00
|
|
|
|
#ifdef USE_MOTIF
|
|
|
|
|
change = max (merged_contents->change, change);
|
1996-08-10 18:51:19 +00:00
|
|
|
|
#endif
|
1996-07-27 16:19:46 +00:00
|
|
|
|
#endif
|
1994-01-18 23:47:41 +00:00
|
|
|
|
}
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
val1->contents = merged_contents;
|
|
|
|
|
}
|
|
|
|
|
|
1996-03-25 01:47:33 +00:00
|
|
|
|
this_one_change = change;
|
|
|
|
|
|
2000-03-05 14:31:04 +00:00
|
|
|
|
merged_next = merge_widget_value (val1->next, val2->next, level, change_p);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
|
|
|
|
|
if (val1->next && !merged_next)
|
|
|
|
|
{
|
|
|
|
|
EXPLAIN (val1->name, change, STRUCTURAL_CHANGE, "(following gone)",
|
|
|
|
|
0, 0);
|
|
|
|
|
change = max (change, STRUCTURAL_CHANGE);
|
|
|
|
|
}
|
|
|
|
|
else if (merged_next)
|
|
|
|
|
{
|
|
|
|
|
if (merged_next->change)
|
|
|
|
|
EXPLAIN (val1->name, change, merged_next->change, "(following change)",
|
|
|
|
|
0, 0);
|
|
|
|
|
change = max (change, merged_next->change);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
val1->next = merged_next;
|
|
|
|
|
|
1996-03-25 01:47:33 +00:00
|
|
|
|
val1->this_one_change = this_one_change;
|
1994-01-18 23:47:41 +00:00
|
|
|
|
val1->change = change;
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
if (change > NO_CHANGE && val1->toolkit_data)
|
|
|
|
|
{
|
2000-03-05 14:31:04 +00:00
|
|
|
|
*change_p = 1;
|
1994-01-18 23:47:41 +00:00
|
|
|
|
if (val1->free_toolkit_data)
|
1996-02-21 20:54:46 +00:00
|
|
|
|
XtFree (val1->toolkit_data);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
val1->toolkit_data = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return val1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* modifying the widgets */
|
|
|
|
|
static Widget
|
2010-09-26 15:11:48 +00:00
|
|
|
|
name_to_widget (widget_instance *instance, const char *name)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
Widget widget = NULL;
|
|
|
|
|
|
|
|
|
|
if (!instance->widget)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
if (!strcmp (XtName (instance->widget), name))
|
|
|
|
|
widget = instance->widget;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int length = strlen (name) + 2;
|
1994-05-16 21:29:03 +00:00
|
|
|
|
char* real_name = (char *) xmalloc (length);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
real_name [0] = '*';
|
|
|
|
|
strcpy (real_name + 1, name);
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
widget = XtNameToWidget (instance->widget, real_name);
|
1994-05-16 21:29:03 +00:00
|
|
|
|
|
2011-10-13 14:55:46 +00:00
|
|
|
|
xfree (real_name);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
}
|
|
|
|
|
return widget;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2002-11-20 19:26:18 +00:00
|
|
|
|
set_one_value (widget_instance* instance, widget_value* val, Boolean deep_p)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
Widget widget = name_to_widget (instance, val->name);
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
if (widget)
|
|
|
|
|
{
|
|
|
|
|
#if defined (USE_LUCID)
|
|
|
|
|
if (lw_lucid_widget_p (instance->widget))
|
|
|
|
|
xlw_update_one_widget (instance, widget, val, deep_p);
|
|
|
|
|
#endif
|
|
|
|
|
#if defined (USE_MOTIF)
|
|
|
|
|
if (lw_motif_widget_p (instance->widget))
|
|
|
|
|
xm_update_one_widget (instance, widget, val, deep_p);
|
|
|
|
|
#endif
|
1994-03-11 10:36:17 +00:00
|
|
|
|
#if defined (USE_XAW)
|
|
|
|
|
if (lw_xaw_widget_p (instance->widget))
|
|
|
|
|
xaw_update_one_widget (instance, widget, val, deep_p);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2002-11-20 19:26:18 +00:00
|
|
|
|
update_one_widget_instance (widget_instance* instance, Boolean deep_p)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_value *val;
|
|
|
|
|
|
|
|
|
|
if (!instance->widget)
|
|
|
|
|
/* the widget was destroyed */
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for (val = instance->info->val; val; val = val->next)
|
|
|
|
|
if (val->change != NO_CHANGE)
|
|
|
|
|
set_one_value (instance, val, deep_p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2002-11-20 19:26:18 +00:00
|
|
|
|
update_all_widget_values (widget_info* info, Boolean deep_p)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_instance* instance;
|
|
|
|
|
widget_value* val;
|
|
|
|
|
|
|
|
|
|
for (instance = info->instances; instance; instance = instance->next)
|
|
|
|
|
update_one_widget_instance (instance, deep_p);
|
|
|
|
|
|
|
|
|
|
for (val = info->val; val; val = val->next)
|
|
|
|
|
val->change = NO_CHANGE;
|
|
|
|
|
}
|
|
|
|
|
|
2000-03-05 14:31:04 +00:00
|
|
|
|
int
|
2002-11-20 19:26:18 +00:00
|
|
|
|
lw_modify_all_widgets (LWLIB_ID id, widget_value* val, Boolean deep_p)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_info* info = get_widget_info (id, False);
|
|
|
|
|
widget_value* new_val;
|
|
|
|
|
widget_value* next_new_val;
|
|
|
|
|
widget_value* cur;
|
|
|
|
|
widget_value* prev;
|
|
|
|
|
widget_value* next;
|
|
|
|
|
int found;
|
2000-03-05 14:31:04 +00:00
|
|
|
|
int change_p = 0;
|
1994-01-18 23:47:41 +00:00
|
|
|
|
|
|
|
|
|
if (!info)
|
2000-06-06 14:15:49 +00:00
|
|
|
|
return 0;
|
1994-01-18 23:47:41 +00:00
|
|
|
|
|
|
|
|
|
for (new_val = val; new_val; new_val = new_val->next)
|
|
|
|
|
{
|
|
|
|
|
next_new_val = new_val->next;
|
|
|
|
|
new_val->next = NULL;
|
|
|
|
|
found = False;
|
|
|
|
|
for (prev = NULL, cur = info->val; cur; prev = cur, cur = cur->next)
|
|
|
|
|
if (!strcmp (cur->name, new_val->name))
|
|
|
|
|
{
|
|
|
|
|
found = True;
|
|
|
|
|
next = cur->next;
|
|
|
|
|
cur->next = NULL;
|
2000-03-05 14:31:04 +00:00
|
|
|
|
cur = merge_widget_value (cur, new_val, deep_p ? 1000 : 1,
|
|
|
|
|
&change_p);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
if (prev)
|
|
|
|
|
prev->next = cur ? cur : next;
|
|
|
|
|
else
|
|
|
|
|
info->val = cur ? cur : next;
|
|
|
|
|
if (cur)
|
|
|
|
|
cur->next = next;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (!found)
|
|
|
|
|
{
|
|
|
|
|
/* Could not find it, add it */
|
|
|
|
|
if (prev)
|
|
|
|
|
prev->next = copy_widget_value_tree (new_val, STRUCTURAL_CHANGE);
|
|
|
|
|
else
|
|
|
|
|
info->val = copy_widget_value_tree (new_val, STRUCTURAL_CHANGE);
|
2000-03-05 14:31:04 +00:00
|
|
|
|
change_p = 1;
|
1994-01-18 23:47:41 +00:00
|
|
|
|
}
|
|
|
|
|
new_val->next = next_new_val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
update_all_widget_values (info, deep_p);
|
2000-03-05 14:31:04 +00:00
|
|
|
|
return change_p;
|
1994-01-18 23:47:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* creating the widgets */
|
|
|
|
|
|
|
|
|
|
static void
|
2010-07-04 05:47:55 +00:00
|
|
|
|
initialize_widget_instance (widget_instance *instance)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_value* val;
|
|
|
|
|
|
|
|
|
|
for (val = instance->info->val; val; val = val->next)
|
|
|
|
|
val->change = STRUCTURAL_CHANGE;
|
|
|
|
|
|
|
|
|
|
update_one_widget_instance (instance, True);
|
|
|
|
|
|
|
|
|
|
for (val = instance->info->val; val; val = val->next)
|
|
|
|
|
val->change = NO_CHANGE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static widget_creation_function
|
2010-09-26 15:11:48 +00:00
|
|
|
|
find_in_table (const char *type, const widget_creation_entry *table)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
2010-09-26 15:11:48 +00:00
|
|
|
|
const widget_creation_entry* cur;
|
1994-01-18 23:47:41 +00:00
|
|
|
|
for (cur = table; cur->type; cur++)
|
2012-07-06 21:07:46 +00:00
|
|
|
|
if (!c_strcasecmp (type, cur->type))
|
1994-01-18 23:47:41 +00:00
|
|
|
|
return cur->function;
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Boolean
|
2010-09-26 15:11:48 +00:00
|
|
|
|
dialog_spec_p (const char *name)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
2003-02-04 14:56:31 +00:00
|
|
|
|
/* return True if name matches [EILPQeilpq][1-9][Bb] or
|
1994-01-18 23:47:41 +00:00
|
|
|
|
[EILPQeilpq][1-9][Bb][Rr][1-9] */
|
|
|
|
|
if (!name)
|
|
|
|
|
return False;
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
switch (name [0])
|
|
|
|
|
{
|
|
|
|
|
case 'E': case 'I': case 'L': case 'P': case 'Q':
|
|
|
|
|
case 'e': case 'i': case 'l': case 'p': case 'q':
|
|
|
|
|
if (name [1] >= '0' && name [1] <= '9')
|
|
|
|
|
{
|
|
|
|
|
if (name [2] != 'B' && name [2] != 'b')
|
|
|
|
|
return False;
|
|
|
|
|
if (!name [3])
|
|
|
|
|
return True;
|
|
|
|
|
if ((name [3] == 'T' || name [3] == 't') && !name [4])
|
|
|
|
|
return True;
|
|
|
|
|
if ((name [3] == 'R' || name [3] == 'r')
|
|
|
|
|
&& name [4] >= '0' && name [4] <= '9' && !name [5])
|
|
|
|
|
return True;
|
|
|
|
|
return False;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return False;
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
default:
|
|
|
|
|
return False;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2010-07-04 05:47:55 +00:00
|
|
|
|
instantiate_widget_instance (widget_instance *instance)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_creation_function function = NULL;
|
|
|
|
|
|
|
|
|
|
#if defined (USE_LUCID)
|
|
|
|
|
if (!function)
|
|
|
|
|
function = find_in_table (instance->info->type, xlw_creation_table);
|
|
|
|
|
#endif
|
|
|
|
|
#if defined(USE_MOTIF)
|
|
|
|
|
if (!function)
|
|
|
|
|
function = find_in_table (instance->info->type, xm_creation_table);
|
|
|
|
|
#endif
|
1994-03-11 10:36:17 +00:00
|
|
|
|
#if defined (USE_XAW)
|
|
|
|
|
if (!function)
|
|
|
|
|
function = find_in_table (instance->info->type, xaw_creation_table);
|
|
|
|
|
#endif
|
1994-01-18 23:47:41 +00:00
|
|
|
|
|
|
|
|
|
if (!function)
|
|
|
|
|
{
|
|
|
|
|
if (dialog_spec_p (instance->info->type))
|
|
|
|
|
{
|
|
|
|
|
#if defined (USE_LUCID)
|
|
|
|
|
/* not yet */
|
|
|
|
|
#endif
|
|
|
|
|
#if defined(USE_MOTIF)
|
|
|
|
|
if (!function)
|
|
|
|
|
function = xm_create_dialog;
|
|
|
|
|
#endif
|
1994-03-11 10:36:17 +00:00
|
|
|
|
#if defined (USE_XAW)
|
|
|
|
|
if (!function)
|
|
|
|
|
function = xaw_create_dialog;
|
1994-01-18 23:47:41 +00:00
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
if (!function)
|
|
|
|
|
{
|
|
|
|
|
printf ("No creation function for widget type %s\n",
|
|
|
|
|
instance->info->type);
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
instance->widget = (*function) (instance);
|
|
|
|
|
|
|
|
|
|
if (!instance->widget)
|
|
|
|
|
abort ();
|
|
|
|
|
|
|
|
|
|
/* XtRealizeWidget (instance->widget);*/
|
|
|
|
|
}
|
|
|
|
|
|
2003-02-04 14:56:31 +00:00
|
|
|
|
void
|
2010-09-20 11:44:39 +00:00
|
|
|
|
lw_register_widget (const char* type,
|
|
|
|
|
const char* name,
|
Change function definition from K&R to prototype. Fix prototype warnings.
* lwlib-Xaw.c (xaw_generic_callback, command_reset)
(xaw_update_one_value): Reformat.
(xaw_update_one_widget): Reformat and remove dead code.
(xaw_scrollbar_scroll, xaw_scrollbar_jump, xaw_create_scrollbar)
(xaw_update_scrollbar): Remove (not used).
(make_dialog): Change from K&R to prototype. Remove dead code.
(xaw_creation_table): Remove scrollbar entry.
* lwlib-Xlw.c (x_print_complete_resource_name): Change from K&R to
prototype.
(xlw_update_one_value): Reformat.
* lwlib-Xm.c (x_print_complete_resource_name)
(make_destroyed_instance, free_destroyed_instance, first_child)
(lw_motif_widget_p, resource_motif_string, destroy_all_children)
(xm_arm_callback, xm_update_label, xm_update_list)
(xm_update_pushbutton, xm_update_cascadebutton)
(xm_update_toggle, xm_update_radiobox, make_menu_in_widget)
(update_one_menu_entry, xm_update_menu, xm_update_text)
(xm_update_text_field, xm_update_one_widget)
(xm_update_one_value, activate_button, dialog_key_cb)
(make_dialog, mark_dead_instance_destroyed)
(find_matching_instance, recenter_widget, recycle_instance)
(xm_create_dialog, make_menubar, remove_grabs, make_popup_menu)
(make_main, xm_destroy_instance, xm_popup_menu)
(set_min_dialog_size, xm_pop_instance, do_call)
(xm_internal_update_other_instances, xm_generic_callback)
(xm_nosel_callback, xm_pull_down_callback, xm_pop_down_callback)
(xm_set_keyboard_focus, xm_set_main_areas, xm_manage_resizing): Change
from K&R to prototype.
* lwlib-int.h (widget_creation_function): Fix prototype.
* lwlib.c (allocate_widget_info, lw_register_widget): Change from K&R
to prototype.
(lw_internal_update_other_instances, merge_widget_value): Reformat.
* xlwmenu.c (size_menu_item): Change from K&R to prototype.
Change label_width and height to int.
(draw_arrow, draw_shadow_rectangle, draw_shadow_rhombus)
(draw_separator, display_menu, fit_to_screen, motion_event_is_in_menu)
(map_event_to_widget_value): Reformat.
(display_menu_item): Change from K&R to prototype.
2010-07-08 10:29:51 +00:00
|
|
|
|
LWLIB_ID id,
|
|
|
|
|
widget_value* val,
|
|
|
|
|
lw_callback pre_activate_cb,
|
|
|
|
|
lw_callback selection_cb,
|
|
|
|
|
lw_callback post_activate_cb,
|
|
|
|
|
lw_callback highlight_cb)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
if (!get_widget_info (id, False))
|
|
|
|
|
allocate_widget_info (type, name, id, val, pre_activate_cb, selection_cb,
|
2000-01-17 09:10:05 +00:00
|
|
|
|
post_activate_cb, highlight_cb);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget
|
2002-11-20 19:26:18 +00:00
|
|
|
|
lw_get_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_instance* instance;
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
instance = find_instance (id, parent, pop_up_p);
|
|
|
|
|
return instance ? instance->widget : NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget
|
2002-11-20 19:26:18 +00:00
|
|
|
|
lw_make_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_instance* instance;
|
|
|
|
|
widget_info* info;
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
instance = find_instance (id, parent, pop_up_p);
|
|
|
|
|
if (!instance)
|
|
|
|
|
{
|
|
|
|
|
info = get_widget_info (id, False);
|
|
|
|
|
if (!info)
|
|
|
|
|
return NULL;
|
|
|
|
|
instance = allocate_widget_instance (info, parent, pop_up_p);
|
|
|
|
|
initialize_widget_instance (instance);
|
|
|
|
|
}
|
|
|
|
|
if (!instance->widget)
|
|
|
|
|
abort ();
|
|
|
|
|
return instance->widget;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget
|
2010-09-20 11:44:39 +00:00
|
|
|
|
lw_create_widget (const char* type, const char* name, LWLIB_ID id, widget_value* val,
|
2002-11-20 19:26:18 +00:00
|
|
|
|
Widget parent, Boolean pop_up_p,
|
|
|
|
|
lw_callback pre_activate_cb, lw_callback selection_cb,
|
|
|
|
|
lw_callback post_activate_cb, lw_callback highlight_cb)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
lw_register_widget (type, name, id, val, pre_activate_cb, selection_cb,
|
2000-01-17 09:10:05 +00:00
|
|
|
|
post_activate_cb, highlight_cb);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
return lw_make_widget (id, parent, pop_up_p);
|
|
|
|
|
}
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
|
|
|
|
|
/* destroying the widgets */
|
|
|
|
|
static void
|
2010-07-04 05:47:55 +00:00
|
|
|
|
destroy_one_instance (widget_instance *instance)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
/* Remove the destroy callback on the widget; that callback will try to
|
|
|
|
|
dereference the instance object (to set its widget slot to 0, since the
|
|
|
|
|
widget is dead.) Since the instance is now dead, we don't have to worry
|
|
|
|
|
about the fact that its widget is dead too.
|
|
|
|
|
|
|
|
|
|
This happens in the Phase2Destroy of the widget, so this callback would
|
|
|
|
|
not have been run until arbitrarily long after the instance was freed.
|
|
|
|
|
*/
|
|
|
|
|
if (instance->widget)
|
|
|
|
|
XtRemoveCallback (instance->widget, XtNdestroyCallback,
|
|
|
|
|
mark_widget_destroyed, (XtPointer)instance);
|
|
|
|
|
|
|
|
|
|
if (instance->widget)
|
|
|
|
|
{
|
|
|
|
|
/* The else are pretty tricky here, including the empty statement
|
|
|
|
|
at the end because it would be very bad to destroy a widget
|
|
|
|
|
twice. */
|
|
|
|
|
#if defined (USE_LUCID)
|
|
|
|
|
if (lw_lucid_widget_p (instance->widget))
|
|
|
|
|
xlw_destroy_instance (instance);
|
|
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
#if defined (USE_MOTIF)
|
|
|
|
|
if (lw_motif_widget_p (instance->widget))
|
|
|
|
|
xm_destroy_instance (instance);
|
|
|
|
|
else
|
|
|
|
|
#endif
|
1994-03-11 10:36:17 +00:00
|
|
|
|
#if defined (USE_XAW)
|
|
|
|
|
if (lw_xaw_widget_p (instance->widget))
|
|
|
|
|
xaw_destroy_instance (instance);
|
2003-02-04 14:56:31 +00:00
|
|
|
|
else
|
1994-01-18 23:47:41 +00:00
|
|
|
|
#endif
|
2011-04-16 01:42:03 +00:00
|
|
|
|
{
|
|
|
|
|
/* Empty compound statement to terminate if-then-else chain. */
|
|
|
|
|
}
|
1994-01-18 23:47:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free_widget_instance (instance);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2010-07-04 05:47:55 +00:00
|
|
|
|
lw_destroy_widget (Widget w)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_instance* instance = get_widget_instance (w, True);
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
if (instance)
|
|
|
|
|
{
|
|
|
|
|
widget_info *info = instance->info;
|
|
|
|
|
/* instance has already been removed from the list; free it */
|
|
|
|
|
destroy_one_instance (instance);
|
|
|
|
|
/* if there are no instances left, free the info too */
|
|
|
|
|
if (!info->instances)
|
|
|
|
|
lw_destroy_all_widgets (info->id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2010-07-04 05:47:55 +00:00
|
|
|
|
lw_destroy_all_widgets (LWLIB_ID id)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_info* info = get_widget_info (id, True);
|
|
|
|
|
widget_instance* instance;
|
|
|
|
|
widget_instance* next;
|
|
|
|
|
|
|
|
|
|
if (info)
|
|
|
|
|
{
|
|
|
|
|
for (instance = info->instances; instance; )
|
|
|
|
|
{
|
|
|
|
|
next = instance->next;
|
|
|
|
|
destroy_one_instance (instance);
|
|
|
|
|
instance = next;
|
|
|
|
|
}
|
|
|
|
|
free_widget_info (info);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2010-07-04 05:47:55 +00:00
|
|
|
|
lw_destroy_everything (void)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
while (all_widget_info)
|
|
|
|
|
lw_destroy_all_widgets (all_widget_info->id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2010-07-04 05:47:55 +00:00
|
|
|
|
lw_destroy_all_pop_ups (void)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_info* info;
|
|
|
|
|
widget_info* next;
|
|
|
|
|
widget_instance* instance;
|
|
|
|
|
|
|
|
|
|
for (info = all_widget_info; info; info = next)
|
|
|
|
|
{
|
|
|
|
|
next = info->next;
|
|
|
|
|
instance = info->instances;
|
|
|
|
|
if (instance && instance->pop_up_p)
|
|
|
|
|
lw_destroy_all_widgets (info->id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef USE_MOTIF
|
2011-04-16 16:42:58 +00:00
|
|
|
|
extern Widget first_child (Widget); /* garbage */
|
1994-01-18 23:47:41 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
Widget
|
2010-07-04 05:47:55 +00:00
|
|
|
|
lw_raise_all_pop_up_widgets (void)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_info* info;
|
|
|
|
|
widget_instance* instance;
|
|
|
|
|
Widget result = NULL;
|
|
|
|
|
|
|
|
|
|
for (info = all_widget_info; info; info = info->next)
|
|
|
|
|
for (instance = info->instances; instance; instance = instance->next)
|
|
|
|
|
if (instance->pop_up_p)
|
|
|
|
|
{
|
|
|
|
|
Widget widget = instance->widget;
|
|
|
|
|
if (widget)
|
|
|
|
|
{
|
|
|
|
|
if (XtIsManaged (widget)
|
|
|
|
|
#ifdef USE_MOTIF
|
|
|
|
|
/* What a complete load of crap!!!!
|
|
|
|
|
When a dialogShell is on the screen, it is not managed!
|
|
|
|
|
*/
|
|
|
|
|
|| (lw_motif_widget_p (instance->widget) &&
|
|
|
|
|
XtIsManaged (first_child (widget)))
|
|
|
|
|
#endif
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
if (!result)
|
|
|
|
|
result = widget;
|
|
|
|
|
XMapRaised (XtDisplay (widget), XtWindow (widget));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2002-11-20 19:26:18 +00:00
|
|
|
|
lw_pop_all_widgets (LWLIB_ID id, Boolean up)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_info* info = get_widget_info (id, False);
|
|
|
|
|
widget_instance* instance;
|
|
|
|
|
|
|
|
|
|
if (info)
|
|
|
|
|
for (instance = info->instances; instance; instance = instance->next)
|
|
|
|
|
if (instance->pop_up_p && instance->widget)
|
|
|
|
|
{
|
|
|
|
|
#if defined (USE_LUCID)
|
|
|
|
|
if (lw_lucid_widget_p (instance->widget))
|
1994-03-11 10:36:17 +00:00
|
|
|
|
{
|
|
|
|
|
XtRealizeWidget (instance->widget);
|
|
|
|
|
xlw_pop_instance (instance, up);
|
|
|
|
|
}
|
1994-01-18 23:47:41 +00:00
|
|
|
|
#endif
|
|
|
|
|
#if defined (USE_MOTIF)
|
|
|
|
|
if (lw_motif_widget_p (instance->widget))
|
1994-03-11 10:36:17 +00:00
|
|
|
|
{
|
|
|
|
|
XtRealizeWidget (instance->widget);
|
|
|
|
|
xm_pop_instance (instance, up);
|
|
|
|
|
}
|
1994-01-18 23:47:41 +00:00
|
|
|
|
#endif
|
1994-03-11 10:36:17 +00:00
|
|
|
|
#if defined (USE_XAW)
|
|
|
|
|
if (lw_xaw_widget_p (instance->widget))
|
|
|
|
|
{
|
|
|
|
|
XtRealizeWidget (XtParent (instance->widget));
|
|
|
|
|
XtRealizeWidget (instance->widget);
|
|
|
|
|
xaw_pop_instance (instance, up);
|
|
|
|
|
}
|
1994-01-18 23:47:41 +00:00
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2010-07-04 05:47:55 +00:00
|
|
|
|
lw_pop_up_all_widgets (LWLIB_ID id)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
lw_pop_all_widgets (id, True);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2010-07-04 05:47:55 +00:00
|
|
|
|
lw_pop_down_all_widgets (LWLIB_ID id)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
lw_pop_all_widgets (id, False);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2010-07-04 05:47:55 +00:00
|
|
|
|
lw_popup_menu (Widget widget, XEvent *event)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
#if defined (USE_LUCID)
|
|
|
|
|
if (lw_lucid_widget_p (widget))
|
1995-08-02 07:13:19 +00:00
|
|
|
|
xlw_popup_menu (widget, event);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
#endif
|
|
|
|
|
#if defined (USE_MOTIF)
|
|
|
|
|
if (lw_motif_widget_p (widget))
|
1995-08-02 07:13:19 +00:00
|
|
|
|
xm_popup_menu (widget, event);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
#endif
|
1994-03-11 10:36:17 +00:00
|
|
|
|
#if defined (USE_XAW)
|
|
|
|
|
if (lw_xaw_widget_p (widget))
|
1995-08-02 07:13:19 +00:00
|
|
|
|
xaw_popup_menu (widget, event);
|
1994-03-11 10:36:17 +00:00
|
|
|
|
#endif
|
1994-01-18 23:47:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* get the values back */
|
|
|
|
|
static Boolean
|
2010-07-04 05:47:55 +00:00
|
|
|
|
get_one_value (widget_instance *instance, widget_value *val)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
Widget widget = name_to_widget (instance, val->name);
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
if (widget)
|
|
|
|
|
{
|
|
|
|
|
#if defined (USE_LUCID)
|
|
|
|
|
if (lw_lucid_widget_p (instance->widget))
|
|
|
|
|
xlw_update_one_value (instance, widget, val);
|
|
|
|
|
#endif
|
|
|
|
|
#if defined (USE_MOTIF)
|
|
|
|
|
if (lw_motif_widget_p (instance->widget))
|
|
|
|
|
xm_update_one_value (instance, widget, val);
|
|
|
|
|
#endif
|
1994-03-11 10:36:17 +00:00
|
|
|
|
#if defined (USE_XAW)
|
|
|
|
|
if (lw_xaw_widget_p (instance->widget))
|
|
|
|
|
xaw_update_one_value (instance, widget, val);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
#endif
|
|
|
|
|
return True;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return False;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Boolean
|
2010-07-04 05:47:55 +00:00
|
|
|
|
lw_get_some_values (LWLIB_ID id, widget_value *val_out)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_info* info = get_widget_info (id, False);
|
|
|
|
|
widget_instance* instance;
|
|
|
|
|
widget_value* val;
|
|
|
|
|
Boolean result = False;
|
|
|
|
|
|
|
|
|
|
if (!info)
|
|
|
|
|
return False;
|
|
|
|
|
|
|
|
|
|
instance = info->instances;
|
|
|
|
|
if (!instance)
|
|
|
|
|
return False;
|
|
|
|
|
|
|
|
|
|
for (val = val_out; val; val = val->next)
|
|
|
|
|
if (get_one_value (instance, val))
|
|
|
|
|
result = True;
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
widget_value*
|
2010-07-04 05:47:55 +00:00
|
|
|
|
lw_get_all_values (LWLIB_ID id)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_info* info = get_widget_info (id, False);
|
|
|
|
|
widget_value* val = info->val;
|
|
|
|
|
if (lw_get_some_values (id, val))
|
|
|
|
|
return val;
|
|
|
|
|
else
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* internal function used by the library dependent implementation to get the
|
|
|
|
|
widget_value for a given widget in an instance */
|
|
|
|
|
widget_value*
|
2010-07-04 05:47:55 +00:00
|
|
|
|
lw_get_widget_value_for_widget (widget_instance *instance, Widget w)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
char* name = XtName (w);
|
|
|
|
|
widget_value* cur;
|
|
|
|
|
for (cur = instance->info->val; cur; cur = cur->next)
|
|
|
|
|
if (!strcmp (cur->name, name))
|
|
|
|
|
return cur;
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* update other instances value when one thing changed */
|
1996-02-19 07:38:02 +00:00
|
|
|
|
|
|
|
|
|
/* To forbid recursive calls */
|
|
|
|
|
static Boolean lwlib_updating;
|
|
|
|
|
|
2011-11-24 01:58:14 +00:00
|
|
|
|
/* This function can be used as an XtCallback for the widgets that get
|
|
|
|
|
modified to update other instances of the widgets. Closure should be the
|
|
|
|
|
widget_instance. */
|
1994-01-18 23:47:41 +00:00
|
|
|
|
void
|
Change function definition from K&R to prototype. Fix prototype warnings.
* lwlib-Xaw.c (xaw_generic_callback, command_reset)
(xaw_update_one_value): Reformat.
(xaw_update_one_widget): Reformat and remove dead code.
(xaw_scrollbar_scroll, xaw_scrollbar_jump, xaw_create_scrollbar)
(xaw_update_scrollbar): Remove (not used).
(make_dialog): Change from K&R to prototype. Remove dead code.
(xaw_creation_table): Remove scrollbar entry.
* lwlib-Xlw.c (x_print_complete_resource_name): Change from K&R to
prototype.
(xlw_update_one_value): Reformat.
* lwlib-Xm.c (x_print_complete_resource_name)
(make_destroyed_instance, free_destroyed_instance, first_child)
(lw_motif_widget_p, resource_motif_string, destroy_all_children)
(xm_arm_callback, xm_update_label, xm_update_list)
(xm_update_pushbutton, xm_update_cascadebutton)
(xm_update_toggle, xm_update_radiobox, make_menu_in_widget)
(update_one_menu_entry, xm_update_menu, xm_update_text)
(xm_update_text_field, xm_update_one_widget)
(xm_update_one_value, activate_button, dialog_key_cb)
(make_dialog, mark_dead_instance_destroyed)
(find_matching_instance, recenter_widget, recycle_instance)
(xm_create_dialog, make_menubar, remove_grabs, make_popup_menu)
(make_main, xm_destroy_instance, xm_popup_menu)
(set_min_dialog_size, xm_pop_instance, do_call)
(xm_internal_update_other_instances, xm_generic_callback)
(xm_nosel_callback, xm_pull_down_callback, xm_pop_down_callback)
(xm_set_keyboard_focus, xm_set_main_areas, xm_manage_resizing): Change
from K&R to prototype.
* lwlib-int.h (widget_creation_function): Fix prototype.
* lwlib.c (allocate_widget_info, lw_register_widget): Change from K&R
to prototype.
(lw_internal_update_other_instances, merge_widget_value): Reformat.
* xlwmenu.c (size_menu_item): Change from K&R to prototype.
Change label_width and height to int.
(draw_arrow, draw_shadow_rectangle, draw_shadow_rhombus)
(draw_separator, display_menu, fit_to_screen, motion_event_is_in_menu)
(map_event_to_widget_value): Reformat.
(display_menu_item): Change from K&R to prototype.
2010-07-08 10:29:51 +00:00
|
|
|
|
lw_internal_update_other_instances (Widget widget,
|
|
|
|
|
XtPointer closure,
|
|
|
|
|
XtPointer call_data)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_instance* instance = (widget_instance*)closure;
|
|
|
|
|
char* name = XtName (widget);
|
|
|
|
|
widget_info* info;
|
|
|
|
|
widget_instance* cur;
|
|
|
|
|
widget_value* val;
|
|
|
|
|
|
1996-02-19 07:38:02 +00:00
|
|
|
|
/* Avoid possibly infinite recursion. */
|
|
|
|
|
if (lwlib_updating)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* protect against the widget being destroyed */
|
|
|
|
|
if (XtWidgetBeingDestroyedP (widget))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Return immediately if there are no other instances */
|
|
|
|
|
info = instance->info;
|
|
|
|
|
if (!info->instances->next)
|
|
|
|
|
return;
|
|
|
|
|
|
1996-02-19 07:38:02 +00:00
|
|
|
|
lwlib_updating = True;
|
1994-01-18 23:47:41 +00:00
|
|
|
|
|
|
|
|
|
for (val = info->val; val && strcmp (val->name, name); val = val->next);
|
|
|
|
|
|
|
|
|
|
if (val && get_one_value (instance, val))
|
|
|
|
|
for (cur = info->instances; cur; cur = cur->next)
|
|
|
|
|
if (cur != instance)
|
|
|
|
|
set_one_value (cur, val, True);
|
|
|
|
|
|
1996-02-19 07:38:02 +00:00
|
|
|
|
lwlib_updating = False;
|
1994-01-18 23:47:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* get the id */
|
|
|
|
|
|
|
|
|
|
LWLIB_ID
|
2010-07-04 05:47:55 +00:00
|
|
|
|
lw_get_widget_id (Widget w)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_instance* instance = get_widget_instance (w, False);
|
|
|
|
|
|
|
|
|
|
return instance ? instance->info->id : 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* set the keyboard focus */
|
|
|
|
|
void
|
2010-07-04 05:47:55 +00:00
|
|
|
|
lw_set_keyboard_focus (Widget parent, Widget w)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
#if defined (USE_MOTIF)
|
|
|
|
|
xm_set_keyboard_focus (parent, w);
|
|
|
|
|
#else
|
|
|
|
|
XtSetKeyboardFocus (parent, w);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Show busy */
|
|
|
|
|
static void
|
2002-11-20 19:26:18 +00:00
|
|
|
|
show_one_widget_busy (Widget w, Boolean flag)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
Pixel foreground = 0;
|
|
|
|
|
Pixel background = 1;
|
|
|
|
|
Widget widget_to_invert = XtNameToWidget (w, "*sheet");
|
|
|
|
|
if (!widget_to_invert)
|
|
|
|
|
widget_to_invert = w;
|
2003-02-04 14:56:31 +00:00
|
|
|
|
|
1994-01-18 23:47:41 +00:00
|
|
|
|
XtVaGetValues (widget_to_invert,
|
|
|
|
|
XtNforeground, &foreground,
|
|
|
|
|
XtNbackground, &background,
|
2000-08-03 20:09:56 +00:00
|
|
|
|
NULL);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
XtVaSetValues (widget_to_invert,
|
|
|
|
|
XtNforeground, background,
|
|
|
|
|
XtNbackground, foreground,
|
2000-08-03 20:09:56 +00:00
|
|
|
|
NULL);
|
1994-01-18 23:47:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2002-11-20 19:26:18 +00:00
|
|
|
|
lw_show_busy (Widget w, Boolean busy)
|
1994-01-18 23:47:41 +00:00
|
|
|
|
{
|
|
|
|
|
widget_instance* instance = get_widget_instance (w, False);
|
|
|
|
|
widget_info* info;
|
|
|
|
|
widget_instance* next;
|
|
|
|
|
|
|
|
|
|
if (instance)
|
|
|
|
|
{
|
|
|
|
|
info = instance->info;
|
|
|
|
|
if (info->busy != busy)
|
|
|
|
|
{
|
|
|
|
|
for (next = info->instances; next; next = next->next)
|
|
|
|
|
if (next->widget)
|
|
|
|
|
show_one_widget_busy (next->widget, busy);
|
|
|
|
|
info->busy = busy;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
1994-09-16 17:37:05 +00:00
|
|
|
|
|
|
|
|
|
/* This hack exists because Lucid/Athena need to execute the strange
|
|
|
|
|
function below to support geometry management. */
|
|
|
|
|
void
|
2002-11-20 19:26:18 +00:00
|
|
|
|
lw_refigure_widget (Widget w, Boolean doit)
|
1994-09-16 17:37:05 +00:00
|
|
|
|
{
|
2003-02-04 14:56:31 +00:00
|
|
|
|
#if defined (USE_XAW)
|
1994-09-16 17:37:05 +00:00
|
|
|
|
XawPanedSetRefigureMode (w, doit);
|
|
|
|
|
#endif
|
|
|
|
|
#if defined (USE_MOTIF)
|
|
|
|
|
if (doit)
|
|
|
|
|
XtManageChild (w);
|
1995-05-06 01:54:19 +00:00
|
|
|
|
else
|
|
|
|
|
XtUnmanageChild (w);
|
1994-09-16 17:37:05 +00:00
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Toolkit independent way of determining if an event window is in the
|
|
|
|
|
menubar. */
|
|
|
|
|
Boolean
|
2010-07-04 05:47:55 +00:00
|
|
|
|
lw_window_is_in_menubar (Window win, Widget menubar_widget)
|
1994-09-16 17:37:05 +00:00
|
|
|
|
{
|
|
|
|
|
return menubar_widget
|
|
|
|
|
#if defined (USE_LUCID)
|
|
|
|
|
&& XtWindow (menubar_widget) == win;
|
|
|
|
|
#endif
|
|
|
|
|
#if defined (USE_MOTIF)
|
1996-02-25 06:59:59 +00:00
|
|
|
|
&& ((XtWindow (menubar_widget) == win)
|
|
|
|
|
|| (XtWindowToWidget (XtDisplay (menubar_widget), win)
|
|
|
|
|
&& (XtParent (XtWindowToWidget (XtDisplay (menubar_widget), win))
|
|
|
|
|
== menubar_widget)));
|
1994-09-16 17:37:05 +00:00
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Motif hack to set the main window areas. */
|
|
|
|
|
void
|
2010-07-04 05:47:55 +00:00
|
|
|
|
lw_set_main_areas (Widget parent, Widget menubar, Widget work_area)
|
1994-09-16 17:37:05 +00:00
|
|
|
|
{
|
|
|
|
|
#if defined (USE_MOTIF)
|
1994-09-25 23:35:41 +00:00
|
|
|
|
xm_set_main_areas (parent, menubar, work_area);
|
1994-09-16 17:37:05 +00:00
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Manage resizing for Motif. This disables resizing when the menubar
|
|
|
|
|
is about to be modified. */
|
|
|
|
|
void
|
2002-11-20 19:26:18 +00:00
|
|
|
|
lw_allow_resizing (Widget w, Boolean flag)
|
1994-09-16 17:37:05 +00:00
|
|
|
|
{
|
|
|
|
|
#if defined (USE_MOTIF)
|
1994-10-02 12:07:01 +00:00
|
|
|
|
xm_manage_resizing (w, flag);
|
1994-09-16 17:37:05 +00:00
|
|
|
|
#endif
|
|
|
|
|
}
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Value is non-zero if LABEL is a menu separator. If it is, *TYPE is
|
|
|
|
|
set to an appropriate enumerator of type enum menu_separator.
|
|
|
|
|
MOTIF_P non-zero means map separator types not supported by Motif
|
|
|
|
|
to similar ones that are supported. */
|
|
|
|
|
|
|
|
|
|
int
|
2010-09-26 15:11:48 +00:00
|
|
|
|
lw_separator_p (const char *label, enum menu_separator *type, int motif_p)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
{
|
2000-09-30 17:03:27 +00:00
|
|
|
|
int separator_p = 0;
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
|
|
if (strlen (label) >= 3
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-07 22:18:28 +00:00
|
|
|
|
&& memcmp (label, "--:", 3) == 0)
|
1999-07-21 21:43:52 +00:00
|
|
|
|
{
|
|
|
|
|
static struct separator_table
|
|
|
|
|
{
|
2010-09-20 11:44:39 +00:00
|
|
|
|
const char *name;
|
1999-07-21 21:43:52 +00:00
|
|
|
|
enum menu_separator type;
|
|
|
|
|
}
|
|
|
|
|
separator_names[] =
|
|
|
|
|
{
|
2001-12-18 06:23:17 +00:00
|
|
|
|
{"space", SEPARATOR_NO_LINE},
|
|
|
|
|
{"noLine", SEPARATOR_NO_LINE},
|
|
|
|
|
{"singleLine", SEPARATOR_SINGLE_LINE},
|
|
|
|
|
{"doubleLine", SEPARATOR_DOUBLE_LINE},
|
|
|
|
|
{"singleDashedLine", SEPARATOR_SINGLE_DASHED_LINE},
|
|
|
|
|
{"doubleDashedLine", SEPARATOR_DOUBLE_DASHED_LINE},
|
|
|
|
|
{"shadowEtchedIn", SEPARATOR_SHADOW_ETCHED_IN},
|
|
|
|
|
{"shadowEtchedOut", SEPARATOR_SHADOW_ETCHED_OUT},
|
|
|
|
|
{"shadowEtchedInDash", SEPARATOR_SHADOW_ETCHED_IN_DASH},
|
|
|
|
|
{"shadowEtchedOutDash", SEPARATOR_SHADOW_ETCHED_OUT_DASH},
|
|
|
|
|
{"shadowDoubleEtchedIn", SEPARATOR_SHADOW_DOUBLE_ETCHED_IN},
|
|
|
|
|
{"shadowDoubleEtchedOut", SEPARATOR_SHADOW_DOUBLE_ETCHED_OUT},
|
|
|
|
|
{"shadowDoubleEtchedInDash", SEPARATOR_SHADOW_DOUBLE_ETCHED_IN_DASH},
|
|
|
|
|
{"shadowDoubleEtchedOutDash", SEPARATOR_SHADOW_DOUBLE_ETCHED_OUT_DASH},
|
|
|
|
|
{0,0}
|
1999-07-21 21:43:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
label += 3;
|
|
|
|
|
for (i = 0; separator_names[i].name; ++i)
|
|
|
|
|
if (strcmp (label, separator_names[i].name) == 0)
|
|
|
|
|
{
|
|
|
|
|
separator_p = 1;
|
|
|
|
|
*type = separator_names[i].type;
|
|
|
|
|
|
1999-09-06 15:57:51 +00:00
|
|
|
|
/* If separator type is not supported under Motif,
|
|
|
|
|
use a similar one. */
|
|
|
|
|
if (motif_p && *type >= SEPARATOR_SHADOW_DOUBLE_ETCHED_IN)
|
|
|
|
|
*type -= 4;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (strlen (label) > 3
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-07 22:18:28 +00:00
|
|
|
|
&& memcmp (label, "--", 2) == 0
|
1999-09-14 15:30:15 +00:00
|
|
|
|
&& label[2] != '-')
|
1999-09-06 15:57:51 +00:00
|
|
|
|
{
|
|
|
|
|
/* Alternative, more Emacs-style names. */
|
|
|
|
|
static struct separator_table
|
|
|
|
|
{
|
2010-09-20 11:44:39 +00:00
|
|
|
|
const char *name;
|
1999-09-06 15:57:51 +00:00
|
|
|
|
enum menu_separator type;
|
|
|
|
|
}
|
|
|
|
|
separator_names[] =
|
|
|
|
|
{
|
2001-12-18 06:23:17 +00:00
|
|
|
|
{"space", SEPARATOR_NO_LINE},
|
|
|
|
|
{"no-line", SEPARATOR_NO_LINE},
|
|
|
|
|
{"single-line", SEPARATOR_SINGLE_LINE},
|
|
|
|
|
{"double-line", SEPARATOR_DOUBLE_LINE},
|
|
|
|
|
{"single-dashed-line", SEPARATOR_SINGLE_DASHED_LINE},
|
|
|
|
|
{"double-dashed-line", SEPARATOR_DOUBLE_DASHED_LINE},
|
|
|
|
|
{"shadow-etched-in", SEPARATOR_SHADOW_ETCHED_IN},
|
|
|
|
|
{"shadow-etched-out", SEPARATOR_SHADOW_ETCHED_OUT},
|
|
|
|
|
{"shadow-etched-in-dash", SEPARATOR_SHADOW_ETCHED_IN_DASH},
|
|
|
|
|
{"shadow-etched-out-dash", SEPARATOR_SHADOW_ETCHED_OUT_DASH},
|
|
|
|
|
{"shadow-double-etched-in", SEPARATOR_SHADOW_DOUBLE_ETCHED_IN},
|
|
|
|
|
{"shadow-double-etched-out", SEPARATOR_SHADOW_DOUBLE_ETCHED_OUT},
|
|
|
|
|
{"shadow-double-etched-in-dash", SEPARATOR_SHADOW_DOUBLE_ETCHED_IN_DASH},
|
|
|
|
|
{"shadow-double-etched-out-dash",SEPARATOR_SHADOW_DOUBLE_ETCHED_OUT_DASH},
|
|
|
|
|
{0,0}
|
1999-09-06 15:57:51 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
label += 2;
|
|
|
|
|
for (i = 0; separator_names[i].name; ++i)
|
|
|
|
|
if (strcmp (label, separator_names[i].name) == 0)
|
|
|
|
|
{
|
|
|
|
|
separator_p = 1;
|
|
|
|
|
*type = separator_names[i].type;
|
|
|
|
|
|
1999-07-21 21:43:52 +00:00
|
|
|
|
/* If separator type is not supported under Motif,
|
|
|
|
|
use a similar one. */
|
|
|
|
|
if (motif_p && *type >= SEPARATOR_SHADOW_DOUBLE_ETCHED_IN)
|
|
|
|
|
*type -= 4;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Old-style separator, maybe. It's a separator if it contains
|
|
|
|
|
only dashes. */
|
|
|
|
|
while (*label == '-')
|
|
|
|
|
++label;
|
|
|
|
|
separator_p = *label == 0;
|
|
|
|
|
*type = SEPARATOR_SHADOW_ETCHED_IN;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return separator_p;
|
|
|
|
|
}
|