Mercurial > hg > xemacs-beta
annotate src/frame.c @ 4952:19a72041c5ed
Mule-izing, various fixes related to char * arguments
-------------------- ChangeLog entries follow: --------------------
modules/ChangeLog addition:
2010-01-26 Ben Wing <ben@xemacs.org>
* postgresql/postgresql.c:
* postgresql/postgresql.c (CHECK_LIVE_CONNECTION):
* postgresql/postgresql.c (print_pgresult):
* postgresql/postgresql.c (Fpq_conn_defaults):
* postgresql/postgresql.c (Fpq_connectdb):
* postgresql/postgresql.c (Fpq_connect_start):
* postgresql/postgresql.c (Fpq_result_status):
* postgresql/postgresql.c (Fpq_res_status):
Mule-ize large parts of it.
2010-01-26 Ben Wing <ben@xemacs.org>
* ldap/eldap.c (print_ldap):
* ldap/eldap.c (allocate_ldap):
Use write_ascstring().
src/ChangeLog addition:
2010-01-26 Ben Wing <ben@xemacs.org>
* alloc.c:
* alloc.c (build_ascstring):
* alloc.c (build_msg_cistring):
* alloc.c (staticpro_1):
* alloc.c (staticpro_name):
* alloc.c (staticpro_nodump_1):
* alloc.c (staticpro_nodump_name):
* alloc.c (unstaticpro_nodump_1):
* alloc.c (mcpro_1):
* alloc.c (mcpro_name):
* alloc.c (object_memory_usage_stats):
* alloc.c (common_init_alloc_early):
* alloc.c (init_alloc_once_early):
* buffer.c (print_buffer):
* buffer.c (vars_of_buffer):
* buffer.c (common_init_complex_vars_of_buffer):
* buffer.c (init_initial_directory):
* bytecode.c (invalid_byte_code):
* bytecode.c (print_compiled_function):
* bytecode.c (mark_compiled_function):
* chartab.c (print_table_entry):
* chartab.c (print_char_table):
* config.h.in:
* console-gtk.c:
* console-gtk.c (gtk_device_to_console_connection):
* console-gtk.c (gtk_semi_canonicalize_console_connection):
* console-gtk.c (gtk_canonicalize_console_connection):
* console-gtk.c (gtk_semi_canonicalize_device_connection):
* console-gtk.c (gtk_canonicalize_device_connection):
* console-stream.c (stream_init_frame_1):
* console-stream.c (vars_of_console_stream):
* console-stream.c (init_console_stream):
* console-x.c (x_semi_canonicalize_console_connection):
* console-x.c (x_semi_canonicalize_device_connection):
* console-x.c (x_canonicalize_device_connection):
* console-x.h:
* data.c (eq_with_ebola_notice):
* data.c (Fsubr_interactive):
* data.c (Fnumber_to_string):
* data.c (digit_to_number):
* device-gtk.c (gtk_init_device):
* device-msw.c (print_devmode):
* device-x.c (x_event_name):
* dialog-msw.c (handle_directory_dialog_box):
* dialog-msw.c (handle_file_dialog_box):
* dialog-msw.c (vars_of_dialog_mswindows):
* doc.c (weird_doc):
* doc.c (Fsnarf_documentation):
* doc.c (vars_of_doc):
* dumper.c (pdump):
* dynarr.c:
* dynarr.c (Dynarr_realloc):
* editfns.c (Fuser_real_login_name):
* editfns.c (get_home_directory):
* elhash.c (print_hash_table_data):
* elhash.c (print_hash_table):
* emacs.c (main_1):
* emacs.c (vars_of_emacs):
* emodules.c:
* emodules.c (_emodules_list):
* emodules.c (Fload_module):
* emodules.c (Funload_module):
* emodules.c (Flist_modules):
* emodules.c (find_make_module):
* emodules.c (attempt_module_delete):
* emodules.c (emodules_load):
* emodules.c (emodules_doc_subr):
* emodules.c (emodules_doc_sym):
* emodules.c (syms_of_module):
* emodules.c (vars_of_module):
* emodules.h:
* eval.c (print_subr):
* eval.c (signal_call_debugger):
* eval.c (build_error_data):
* eval.c (signal_error):
* eval.c (maybe_signal_error):
* eval.c (signal_continuable_error):
* eval.c (maybe_signal_continuable_error):
* eval.c (signal_error_2):
* eval.c (maybe_signal_error_2):
* eval.c (signal_continuable_error_2):
* eval.c (maybe_signal_continuable_error_2):
* eval.c (signal_ferror):
* eval.c (maybe_signal_ferror):
* eval.c (signal_continuable_ferror):
* eval.c (maybe_signal_continuable_ferror):
* eval.c (signal_ferror_with_frob):
* eval.c (maybe_signal_ferror_with_frob):
* eval.c (signal_continuable_ferror_with_frob):
* eval.c (maybe_signal_continuable_ferror_with_frob):
* eval.c (syntax_error):
* eval.c (syntax_error_2):
* eval.c (maybe_syntax_error):
* eval.c (sferror):
* eval.c (sferror_2):
* eval.c (maybe_sferror):
* eval.c (invalid_argument):
* eval.c (invalid_argument_2):
* eval.c (maybe_invalid_argument):
* eval.c (invalid_constant):
* eval.c (invalid_constant_2):
* eval.c (maybe_invalid_constant):
* eval.c (invalid_operation):
* eval.c (invalid_operation_2):
* eval.c (maybe_invalid_operation):
* eval.c (invalid_change):
* eval.c (invalid_change_2):
* eval.c (maybe_invalid_change):
* eval.c (invalid_state):
* eval.c (invalid_state_2):
* eval.c (maybe_invalid_state):
* eval.c (wtaerror):
* eval.c (stack_overflow):
* eval.c (out_of_memory):
* eval.c (print_multiple_value):
* eval.c (issue_call_trapping_problems_warning):
* eval.c (backtrace_specials):
* eval.c (backtrace_unevalled_args):
* eval.c (Fbacktrace):
* eval.c (warn_when_safe):
* event-Xt.c (modwarn):
* event-Xt.c (modbarf):
* event-Xt.c (check_modifier):
* event-Xt.c (store_modifier):
* event-Xt.c (emacs_Xt_format_magic_event):
* event-Xt.c (describe_event):
* event-gtk.c (dragndrop_data_received):
* event-gtk.c (store_modifier):
* event-gtk.c (gtk_reset_modifier_mapping):
* event-msw.c (dde_eval_string):
* event-msw.c (Fdde_alloc_advise_item):
* event-msw.c (mswindows_dde_callback):
* event-msw.c (FROB):
* event-msw.c (emacs_mswindows_format_magic_event):
* event-stream.c (external_debugging_print_event):
* event-stream.c (execute_help_form):
* event-stream.c (vars_of_event_stream):
* events.c (print_event_1):
* events.c (print_event):
* events.c (event_equal):
* extents.c (print_extent_1):
* extents.c (print_extent):
* extents.c (vars_of_extents):
* faces.c (print_face):
* faces.c (complex_vars_of_faces):
* file-coding.c:
* file-coding.c (print_coding_system):
* file-coding.c (print_coding_system_in_print_method):
* file-coding.c (default_query_method):
* file-coding.c (find_coding_system):
* file-coding.c (make_coding_system_1):
* file-coding.c (chain_print):
* file-coding.c (undecided_print):
* file-coding.c (gzip_print):
* file-coding.c (vars_of_file_coding):
* file-coding.c (complex_vars_of_file_coding):
* fileio.c:
* fileio.c (report_file_type_error):
* fileio.c (report_error_with_errno):
* fileio.c (report_file_error):
* fileio.c (barf_or_query_if_file_exists):
* fileio.c (vars_of_fileio):
* floatfns.c (matherr):
* fns.c (print_bit_vector):
* fns.c (Fmapconcat):
* fns.c (add_suffix_to_symbol):
* fns.c (add_prefix_to_symbol):
* frame-gtk.c:
* frame-gtk.c (Fgtk_window_id):
* frame-x.c (def):
* frame-x.c (x_cde_transfer_callback):
* frame.c:
* frame.c (Fmake_frame):
* gc.c (show_gc_cursor_and_message):
* gc.c (vars_of_gc):
* glyphs-eimage.c (png_instantiate):
* glyphs-eimage.c (tiff_instantiate):
* glyphs-gtk.c (gtk_print_image_instance):
* glyphs-msw.c (mswindows_print_image_instance):
* glyphs-x.c (x_print_image_instance):
* glyphs-x.c (update_widget_face):
* glyphs.c (make_string_from_file):
* glyphs.c (print_image_instance):
* glyphs.c (signal_image_error):
* glyphs.c (signal_image_error_2):
* glyphs.c (signal_double_image_error):
* glyphs.c (signal_double_image_error_2):
* glyphs.c (xbm_mask_file_munging):
* glyphs.c (pixmap_to_lisp_data):
* glyphs.h:
* gui.c (gui_item_display_flush_left):
* hpplay.c (player_error_internal):
* hpplay.c (myHandler):
* intl-win32.c:
* intl-win32.c (langcode_to_lang):
* intl-win32.c (sublangcode_to_lang):
* intl-win32.c (Fmswindows_get_locale_info):
* intl-win32.c (lcid_to_locale_mule_or_no):
* intl-win32.c (mswindows_multibyte_to_unicode_print):
* intl-win32.c (complex_vars_of_intl_win32):
* keymap.c:
* keymap.c (print_keymap):
* keymap.c (ensure_meta_prefix_char_keymapp):
* keymap.c (Fkey_description):
* keymap.c (Ftext_char_description):
* lisp.h:
* lisp.h (struct):
* lisp.h (DECLARE_INLINE_HEADER):
* lread.c (Fload_internal):
* lread.c (locate_file):
* lread.c (read_escape):
* lread.c (read_raw_string):
* lread.c (read1):
* lread.c (read_list):
* lread.c (read_compiled_function):
* lread.c (init_lread):
* lrecord.h:
* marker.c (print_marker):
* marker.c (marker_equal):
* menubar-msw.c (displayable_menu_item):
* menubar-x.c (command_builder_operate_menu_accelerator):
* menubar.c (vars_of_menubar):
* minibuf.c (reinit_complex_vars_of_minibuf):
* minibuf.c (complex_vars_of_minibuf):
* mule-charset.c (Fmake_charset):
* mule-charset.c (complex_vars_of_mule_charset):
* mule-coding.c (iso2022_print):
* mule-coding.c (fixed_width_query):
* number.c (bignum_print):
* number.c (ratio_print):
* number.c (bigfloat_print):
* number.c (bigfloat_finalize):
* objects-msw.c:
* objects-msw.c (mswindows_color_to_string):
* objects-msw.c (mswindows_color_list):
* objects-tty.c:
* objects-tty.c (tty_font_list):
* objects-tty.c (tty_find_charset_font):
* objects-xlike-inc.c (xft_find_charset_font):
* objects-xlike-inc.c (endif):
* print.c:
* print.c (write_istring):
* print.c (write_ascstring):
* print.c (Fterpri):
* print.c (Fprint):
* print.c (print_error_message):
* print.c (print_vector_internal):
* print.c (print_cons):
* print.c (print_string):
* print.c (printing_unreadable_object):
* print.c (print_internal):
* print.c (print_float):
* print.c (print_symbol):
* process-nt.c (mswindows_report_winsock_error):
* process-nt.c (nt_canonicalize_host_name):
* process-unix.c (unix_canonicalize_host_name):
* process.c (print_process):
* process.c (report_process_error):
* process.c (report_network_error):
* process.c (make_process_internal):
* process.c (Fstart_process_internal):
* process.c (status_message):
* process.c (putenv_internal):
* process.c (vars_of_process):
* process.h:
* profile.c (vars_of_profile):
* rangetab.c (print_range_table):
* realpath.c (vars_of_realpath):
* redisplay.c (vars_of_redisplay):
* search.c (wordify):
* search.c (Freplace_match):
* sheap.c (sheap_adjust_h):
* sound.c (report_sound_error):
* sound.c (Fplay_sound_file):
* specifier.c (print_specifier):
* symbols.c (Fsubr_name):
* symbols.c (do_symval_forwarding):
* symbols.c (set_default_buffer_slot_variable):
* symbols.c (set_default_console_slot_variable):
* symbols.c (store_symval_forwarding):
* symbols.c (default_value):
* symbols.c (defsymbol_massage_name_1):
* symbols.c (defsymbol_massage_name_nodump):
* symbols.c (defsymbol_massage_name):
* symbols.c (defsymbol_massage_multiword_predicate_nodump):
* symbols.c (defsymbol_massage_multiword_predicate):
* symbols.c (defsymbol_nodump):
* symbols.c (defsymbol):
* symbols.c (defkeyword):
* symbols.c (defkeyword_massage_name):
* symbols.c (check_module_subr):
* symbols.c (deferror_1):
* symbols.c (deferror):
* symbols.c (deferror_massage_name):
* symbols.c (deferror_massage_name_and_message):
* symbols.c (defvar_magic):
* symeval.h:
* symeval.h (DEFVAR_SYMVAL_FWD):
* sysdep.c:
* sysdep.c (init_system_name):
* sysdll.c:
* sysdll.c (MAYBE_PREPEND_UNDERSCORE):
* sysdll.c (dll_function):
* sysdll.c (dll_variable):
* sysdll.c (dll_error):
* sysdll.c (dll_open):
* sysdll.c (dll_close):
* sysdll.c (image_for_address):
* sysdll.c (my_find_image):
* sysdll.c (search_linked_libs):
* sysdll.h:
* sysfile.h:
* sysfile.h (DEFAULT_DIRECTORY_FALLBACK):
* syswindows.h:
* tests.c (DFC_CHECK_LENGTH):
* tests.c (DFC_CHECK_CONTENT):
* tests.c (Ftest_hash_tables):
* text.c (vars_of_text):
* text.h:
* tooltalk.c (tt_opnum_string):
* tooltalk.c (tt_message_arg_ival_string):
* tooltalk.c (Ftooltalk_default_procid):
* tooltalk.c (Ftooltalk_default_session):
* tooltalk.c (init_tooltalk):
* tooltalk.c (vars_of_tooltalk):
* ui-gtk.c (Fdll_load):
* ui-gtk.c (type_to_marshaller_type):
* ui-gtk.c (Fgtk_import_function_internal):
* ui-gtk.c (emacs_gtk_object_printer):
* ui-gtk.c (emacs_gtk_boxed_printer):
* unicode.c (unicode_to_ichar):
* unicode.c (unicode_print):
* unicode.c (unicode_query):
* unicode.c (vars_of_unicode):
* unicode.c (complex_vars_of_unicode):
* win32.c:
* win32.c (mswindows_report_process_error):
* window.c (print_window):
* xemacs.def.in.in:
BASIC IDEA: Further fixing up uses of char * and CIbyte *
to reflect their actual semantics; Mule-izing some code;
redoing of the not-yet-working code to handle message translation.
Clean up code to handle message-translation (not yet working).
Create separate versions of build_msg_string() for working with
Ibyte *, CIbyte *, and Ascbyte * arguments. Assert that Ascbyte *
arguments are pure-ASCII. Make build_msg_string() be the same
as build_msg_ascstring(). Create same three versions of GETTEXT()
and DEFER_GETTEXT(). Also create build_defer_string() and
variants for the equivalent of DEFER_GETTEXT() when building a
string. Remove old CGETTEXT(). Clean up code where GETTEXT(),
DEFER_GETTEXT(), build_msg_string(), etc. was being called and
introduce some new calls to build_msg_string(), etc. Remove
GETTEXT() from calls to weird_doc() -- we assume that the
message snarfer knows about weird_doc(). Remove uses of
DEFER_GETTEXT() from error messages in sysdep.c and instead use
special comments /* @@@begin-snarf@@@ */ and /* @@@end-snarf@@@ */
that the message snarfer presumably knows about.
Create build_ascstring() and use it in many instances in place
of build_string(). The purpose of having Ascbyte * variants is
to make the code more self-documenting in terms of what sort of
semantics is expected for char * strings. In fact in the process
of looking for uses of build_string(), much improperly Mule-ized
was discovered.
Mule-ize a lot of code as described in previous paragraph,
e.g. in sysdep.c.
Make the error functions take Ascbyte * strings and fix up a
couple of places where non-pure-ASCII strings were being passed in
(file-coding.c, mule-coding.c, unicode.c). (It's debatable whether
we really need to make the error functions work this way. It
helps catch places where code is written in a way that message
translation won't work, but we may well never implement message
translation.)
Make staticpro() and friends take Ascbyte * strings instead of
raw char * strings. Create a const_Ascbyte_ptr dynarr type
to describe what's held by staticpro_names[] and friends,
create pdump descriptions for const_Ascbyte_ptr dynarrs, and
use them in place of specially-crafted staticpro descriptions.
Mule-ize certain other functions (e.g. x_event_name) by correcting
raw use of char * to Ascbyte *, Rawbyte * or another such type,
and raw use of char[] buffers to another type (usually Ascbyte[]).
Change many uses of write_c_string() to write_msg_string(),
write_ascstring(), etc.
Mule-ize emodules.c, emodules.h, sysdll.h.
Fix some un-Mule-ized code in intl-win32.c.
A comment in event-Xt.c and the limitations of the message
snarfer (make-msgfile or whatever) is presumably incorrect --
it should be smart enough to handle function calls spread over
more than one line. Clean up code in event-Xt.c that was
written awkwardly for this reason.
In config.h.in, instead of NEED_ERROR_CHECK_TYPES_INLINES,
create a more general XEMACS_DEFS_NEEDS_INLINE_DECLS to
indicate when inlined functions need to be declared in
xemacs.defs.in.in, and make use of it in xemacs.defs.in.in.
We need to do this because postgresql.c now calls qxestrdup(),
which is an inline function.
Make nconc2() and other such functions MODULE_API and put
them in xemacs.defs.in.in since postgresql.c now uses them.
Clean up indentation in lread.c and a few other places.
In text.h, document ASSERT_ASCTEXT_ASCII() and
ASSERT_ASCTEXT_ASCII_LEN(), group together the stand-in
encodings and add some more for DLL symbols, function and
variable names, etc.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Tue, 26 Jan 2010 23:22:30 -0600 |
parents | a98ca4640147 |
children | 0d4c9d0f6a8d |
rev | line source |
---|---|
428 | 1 /* Generic frame functions. |
2 Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. | |
3025 | 3 Copyright (C) 1995, 1996, 2002, 2003, 2005 Ben Wing. |
428 | 4 Copyright (C) 1995 Sun Microsystems, Inc. |
5 | |
6 This file is part of XEmacs. | |
7 | |
8 XEmacs is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
10 Free Software Foundation; either version 2, or (at your option) any | |
11 later version. | |
12 | |
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with XEmacs; see the file COPYING. If not, write to | |
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
21 Boston, MA 02111-1307, USA. */ | |
22 | |
23 /* Synched up with: FSF 19.30. */ | |
24 | |
25 /* This file has been Mule-ized. */ | |
26 | |
27 #include <config.h> | |
28 #include "lisp.h" | |
29 | |
30 #include "buffer.h" /* for Vbuffer_alist */ | |
31 #include "console.h" | |
872 | 32 #include "device-impl.h" |
428 | 33 #include "events.h" |
34 #include "extents.h" | |
35 #include "faces.h" | |
872 | 36 #include "frame-impl.h" |
428 | 37 #include "glyphs.h" |
38 #include "gutter.h" | |
39 #include "menubar.h" | |
2681 | 40 #include "process.h" /* for egetenv */ |
428 | 41 #include "redisplay.h" |
42 #include "scrollbar.h" | |
800 | 43 #include "toolbar.h" |
428 | 44 #include "window.h" |
45 | |
46 Lisp_Object Vselect_frame_hook, Qselect_frame_hook; | |
47 Lisp_Object Vdeselect_frame_hook, Qdeselect_frame_hook; | |
48 Lisp_Object Vcreate_frame_hook, Qcreate_frame_hook; | |
49 Lisp_Object Vdelete_frame_hook, Qdelete_frame_hook; | |
50 Lisp_Object Vmouse_enter_frame_hook, Qmouse_enter_frame_hook; | |
51 Lisp_Object Vmouse_leave_frame_hook, Qmouse_leave_frame_hook; | |
52 Lisp_Object Vmap_frame_hook, Qmap_frame_hook; | |
53 Lisp_Object Vunmap_frame_hook, Qunmap_frame_hook; | |
54 int allow_deletion_of_last_visible_frame; | |
55 Lisp_Object Vadjust_frame_function; | |
56 Lisp_Object Vmouse_motion_handler; | |
57 Lisp_Object Vsynchronize_minibuffers; | |
58 Lisp_Object Qsynchronize_minibuffers; | |
59 Lisp_Object Qbuffer_predicate; | |
60 Lisp_Object Qmake_initial_minibuffer_frame; | |
61 Lisp_Object Qcustom_initialize_frame; | |
62 | |
63 /* We declare all these frame properties here even though many of them | |
64 are currently only used in frame-x.c, because we should generalize | |
65 them. */ | |
66 | |
67 Lisp_Object Qminibuffer; | |
68 Lisp_Object Qunsplittable; | |
69 Lisp_Object Qinternal_border_width; | |
70 Lisp_Object Qtop_toolbar_shadow_color; | |
71 Lisp_Object Qbottom_toolbar_shadow_color; | |
72 Lisp_Object Qbackground_toolbar_color; | |
73 Lisp_Object Qtop_toolbar_shadow_pixmap; | |
74 Lisp_Object Qbottom_toolbar_shadow_pixmap; | |
75 Lisp_Object Qtoolbar_shadow_thickness; | |
76 Lisp_Object Qscrollbar_placement; | |
77 Lisp_Object Qinter_line_space; | |
78 Lisp_Object Qvisual_bell; | |
79 Lisp_Object Qbell_volume; | |
80 Lisp_Object Qpointer_background; | |
81 Lisp_Object Qpointer_color; | |
82 Lisp_Object Qtext_pointer; | |
83 Lisp_Object Qspace_pointer; | |
84 Lisp_Object Qmodeline_pointer; | |
85 Lisp_Object Qgc_pointer; | |
86 Lisp_Object Qinitially_unmapped; | |
87 Lisp_Object Quse_backing_store; | |
88 Lisp_Object Qborder_color; | |
89 Lisp_Object Qborder_width; | |
90 | |
91 Lisp_Object Qframep, Qframe_live_p; | |
92 Lisp_Object Qdelete_frame; | |
93 | |
94 Lisp_Object Qframe_title_format, Vframe_title_format; | |
95 Lisp_Object Qframe_icon_title_format, Vframe_icon_title_format; | |
96 | |
97 Lisp_Object Vdefault_frame_name; | |
98 Lisp_Object Vdefault_frame_plist; | |
99 | |
100 Lisp_Object Vframe_icon_glyph; | |
101 | |
102 Lisp_Object Qhidden; | |
103 | |
104 Lisp_Object Qvisible, Qiconic, Qinvisible, Qvisible_iconic, Qinvisible_iconic; | |
105 Lisp_Object Qnomini, Qvisible_nomini, Qiconic_nomini, Qinvisible_nomini; | |
106 Lisp_Object Qvisible_iconic_nomini, Qinvisible_iconic_nomini; | |
107 | |
442 | 108 Lisp_Object Qset_specifier, Qset_face_property; |
428 | 109 Lisp_Object Qface_property_instance; |
110 | |
111 Lisp_Object Qframe_property_alias; | |
112 | |
113 /* If this is non-nil, it is the frame that make-frame is currently | |
114 creating. We can't set the current frame to this in case the | |
115 debugger goes off because it would try and display to it. However, | |
116 there are some places which need to reference it which have no | |
117 other way of getting it if it isn't the selected frame. */ | |
118 Lisp_Object Vframe_being_created; | |
119 Lisp_Object Qframe_being_created; | |
120 | |
121 static void store_minibuf_frame_prop (struct frame *f, Lisp_Object val); | |
1125 | 122 |
123 typedef enum { | |
124 DISPLAYABLE_PIXEL_TO_CHAR, | |
125 TOTAL_PIXEL_TO_CHAR, | |
126 CHAR_TO_TOTAL_PIXEL, | |
1429 | 127 CHAR_TO_DISPLAYABLE_PIXEL |
1125 | 128 } pixel_to_char_mode_t; |
129 | |
130 static void frame_conversion_internal (struct frame *f, | |
131 pixel_to_char_mode_t pixel_to_char, | |
863 | 132 int *pixel_width, int *pixel_height, |
133 int *char_width, int *char_height, | |
134 int real_face); | |
438 | 135 static struct display_line title_string_display_line; |
136 /* Used by generate_title_string. Global because they get used so much that | |
137 the dynamic allocation time adds up. */ | |
867 | 138 static Ichar_dynarr *title_string_ichar_dynarr; |
428 | 139 |
140 | |
1204 | 141 |
3092 | 142 #ifndef NEW_GC |
1204 | 143 extern const struct sized_memory_description gtk_frame_data_description; |
144 extern const struct sized_memory_description mswindows_frame_data_description; | |
145 extern const struct sized_memory_description x_frame_data_description; | |
3092 | 146 #endif /* not NEW_GC */ |
1204 | 147 |
148 static const struct memory_description frame_data_description_1 []= { | |
3092 | 149 #ifdef NEW_GC |
150 #ifdef HAVE_GTK | |
151 { XD_LISP_OBJECT, gtk_console }, | |
152 #endif | |
153 #ifdef HAVE_MS_WINDOWS | |
154 { XD_LISP_OBJECT, mswindows_console }, | |
155 #endif | |
156 #ifdef HAVE_X_WINDOWS | |
157 { XD_LISP_OBJECT, x_console }, | |
158 #endif | |
159 #else /* not NEW_GC */ | |
1204 | 160 #ifdef HAVE_GTK |
2551 | 161 { XD_BLOCK_PTR, gtk_console, 1, { >k_frame_data_description} }, |
1204 | 162 #endif |
163 #ifdef HAVE_MS_WINDOWS | |
2551 | 164 { XD_BLOCK_PTR, mswindows_console, 1, { &mswindows_frame_data_description} }, |
1204 | 165 #endif |
166 #ifdef HAVE_X_WINDOWS | |
2551 | 167 { XD_BLOCK_PTR, x_console, 1, { &x_frame_data_description} }, |
1204 | 168 #endif |
3092 | 169 #endif /* not NEW_GC */ |
1204 | 170 { XD_END } |
171 }; | |
172 | |
173 static const struct sized_memory_description frame_data_description = { | |
174 sizeof (void *), frame_data_description_1 | |
175 }; | |
176 | |
3092 | 177 #ifdef NEW_GC |
178 static const struct memory_description expose_ignore_description_1 [] = { | |
179 { XD_LISP_OBJECT, offsetof (struct expose_ignore, next) }, | |
180 { XD_END } | |
181 }; | |
182 | |
4207 | 183 DEFINE_LRECORD_IMPLEMENTATION ("expose-ignore", |
3092 | 184 expose_ignore, |
185 1, /*dumpable-flag*/ | |
4207 | 186 0, 0, 0, 0, 0, |
3092 | 187 expose_ignore_description_1, |
188 struct expose_ignore); | |
189 #else /* not NEW_GC */ | |
1204 | 190 extern const struct sized_memory_description expose_ignore_description; |
191 | |
192 static const struct memory_description expose_ignore_description_1 [] = { | |
2367 | 193 { XD_BLOCK_PTR, offsetof (struct expose_ignore, next), |
2551 | 194 1, { &expose_ignore_description } }, |
1204 | 195 { XD_END } |
196 }; | |
197 | |
198 const struct sized_memory_description expose_ignore_description = { | |
199 sizeof (struct expose_ignore), | |
200 expose_ignore_description_1 | |
201 }; | |
3092 | 202 #endif /* not NEW_GC */ |
1204 | 203 |
204 static const struct memory_description display_line_dynarr_pointer_description_1 []= { | |
2551 | 205 { XD_BLOCK_PTR, 0, 1, { &display_line_dynarr_description} }, |
1204 | 206 { XD_END } |
207 }; | |
208 | |
209 static const struct sized_memory_description display_line_dynarr_pointer_description = { | |
210 sizeof (display_line_dynarr *), display_line_dynarr_pointer_description_1 | |
211 }; | |
212 | |
213 static const struct memory_description frame_description [] = { | |
214 { XD_INT, offsetof (struct frame, frametype) }, | |
215 #define MARKED_SLOT(x) { XD_LISP_OBJECT, offsetof (struct frame, x) }, | |
216 #define MARKED_SLOT_ARRAY(slot, size) \ | |
217 { XD_LISP_OBJECT_ARRAY, offsetof (struct frame, slot), size }, | |
218 #include "frameslots.h" | |
219 | |
3092 | 220 #ifdef NEW_GC |
221 { XD_LISP_OBJECT, offsetof (struct frame, subwindow_exposures) }, | |
222 { XD_LISP_OBJECT, offsetof (struct frame, subwindow_exposures_tail) }, | |
223 #else /* not NEW_GC */ | |
2367 | 224 { XD_BLOCK_PTR, offsetof (struct frame, subwindow_exposures), |
2551 | 225 1, { &expose_ignore_description } }, |
2367 | 226 { XD_BLOCK_PTR, offsetof (struct frame, subwindow_exposures_tail), |
2551 | 227 1, { &expose_ignore_description } }, |
3092 | 228 #endif /* not NEW_GC */ |
1204 | 229 |
230 #ifdef HAVE_SCROLLBARS | |
231 { XD_LISP_OBJECT, offsetof (struct frame, sb_vcache) }, | |
232 { XD_LISP_OBJECT, offsetof (struct frame, sb_hcache) }, | |
233 #endif /* HAVE_SCROLLBARS */ | |
234 | |
2367 | 235 { XD_BLOCK_ARRAY, offsetof (struct frame, current_display_lines), |
2551 | 236 4, { &display_line_dynarr_pointer_description } }, |
2367 | 237 { XD_BLOCK_ARRAY, offsetof (struct frame, desired_display_lines), |
2551 | 238 4, { &display_line_dynarr_pointer_description } }, |
1204 | 239 |
2367 | 240 { XD_BLOCK_PTR, offsetof (struct frame, framemeths), 1, |
2551 | 241 { &console_methods_description } }, |
4207 | 242 { XD_UNION, offsetof (struct frame, frame_data), |
2551 | 243 XD_INDIRECT (0, 0), { &frame_data_description } }, |
1204 | 244 { XD_END } |
245 }; | |
246 | |
428 | 247 static Lisp_Object |
248 mark_frame (Lisp_Object obj) | |
249 { | |
250 struct frame *f = XFRAME (obj); | |
251 | |
1204 | 252 #define MARKED_SLOT(x) mark_object (f->x); |
428 | 253 #include "frameslots.h" |
254 | |
255 if (FRAME_LIVE_P (f)) /* device is nil for a dead frame */ | |
256 MAYBE_FRAMEMETH (f, mark_frame, (f)); | |
257 | |
617 | 258 #ifdef HAVE_SCROLLBARS |
259 if (f->sb_vcache) | |
260 mark_object (wrap_scrollbar_instance (f->sb_vcache)); | |
261 if (f->sb_hcache) | |
262 mark_object (wrap_scrollbar_instance (f->sb_hcache)); | |
263 #endif | |
264 | |
265 mark_gutters (f); | |
266 | |
428 | 267 return Qnil; |
268 } | |
269 | |
270 static void | |
2286 | 271 print_frame (Lisp_Object obj, Lisp_Object printcharfun, |
272 int UNUSED (escapeflag)) | |
428 | 273 { |
274 struct frame *frm = XFRAME (obj); | |
275 | |
276 if (print_readably) | |
4846 | 277 printing_unreadable_lcrecord (obj, XSTRING_DATA (frm->name)); |
428 | 278 |
800 | 279 write_fmt_string (printcharfun, "#<%s-frame ", !FRAME_LIVE_P (frm) ? "dead" : |
280 FRAME_TYPE_NAME (frm)); | |
428 | 281 print_internal (frm->name, printcharfun, 1); |
800 | 282 write_fmt_string (printcharfun, " 0x%x>", frm->header.uid); |
428 | 283 } |
284 | |
934 | 285 DEFINE_LRECORD_IMPLEMENTATION ("frame", frame, |
286 0, /*dumpable-flag*/ | |
4207 | 287 mark_frame, print_frame, 0, 0, 0, |
1204 | 288 frame_description, |
934 | 289 struct frame); |
428 | 290 |
291 static void | |
292 nuke_all_frame_slots (struct frame *f) | |
293 { | |
3017 | 294 ZERO_LCRECORD (f); |
617 | 295 |
1204 | 296 #define MARKED_SLOT(x) f->x = Qnil; |
428 | 297 #include "frameslots.h" |
298 } | |
299 | |
300 /* Allocate a new frame object and set all its fields to reasonable | |
301 values. The root window is created but the minibuffer will be done | |
302 later. */ | |
303 | |
304 static struct frame * | |
305 allocate_frame_core (Lisp_Object device) | |
306 { | |
307 /* This function can GC */ | |
308 Lisp_Object frame; | |
309 Lisp_Object root_window; | |
3017 | 310 struct frame *f = ALLOC_LCRECORD_TYPE (struct frame, &lrecord_frame); |
428 | 311 |
312 nuke_all_frame_slots (f); | |
793 | 313 frame = wrap_frame (f); |
428 | 314 |
315 f->device = device; | |
316 f->framemeths = XDEVICE (device)->devmeths; | |
1204 | 317 f->frametype = get_console_variant (XDEVICE_TYPE (device)); |
428 | 318 f->buffer_alist = Fcopy_sequence (Vbuffer_alist); |
319 | |
320 root_window = allocate_window (); | |
321 XWINDOW (root_window)->frame = frame; | |
322 | |
323 /* 10 is arbitrary, | |
324 Just so that there is "something there." | |
325 Correct size will be set up later with change_frame_size. */ | |
326 | |
327 f->width = 10; | |
328 f->height = 10; | |
329 | |
330 XWINDOW (root_window)->pixel_width = 10; | |
331 XWINDOW (root_window)->pixel_height = 9; | |
332 | |
333 f->root_window = root_window; | |
334 f->selected_window = root_window; | |
335 f->last_nonminibuf_window = root_window; | |
336 | |
337 /* cache of subwindows visible on frame */ | |
442 | 338 f->subwindow_instance_cache = make_weak_list (WEAK_LIST_SIMPLE); |
428 | 339 |
340 /* associated exposure ignore list */ | |
341 f->subwindow_exposures = 0; | |
342 f->subwindow_exposures_tail = 0; | |
343 | |
442 | 344 FRAME_SET_PAGENUMBER (f, 1); |
345 | |
853 | 346 note_object_created (root_window); |
347 | |
428 | 348 /* Choose a buffer for the frame's root window. */ |
349 XWINDOW (root_window)->buffer = Qt; | |
350 { | |
351 Lisp_Object buf; | |
352 | |
353 buf = Fcurrent_buffer (); | |
354 /* If buf is a 'hidden' buffer (i.e. one whose name starts with | |
355 a space), try to find another one. */ | |
867 | 356 if (string_ichar (Fbuffer_name (buf), 0) == ' ') |
428 | 357 buf = Fother_buffer (buf, Qnil, Qnil); |
440 | 358 Fset_window_buffer (root_window, buf, Qnil); |
428 | 359 } |
360 | |
361 return f; | |
362 } | |
363 | |
364 static void | |
365 setup_normal_frame (struct frame *f) | |
366 { | |
367 Lisp_Object mini_window; | |
793 | 368 Lisp_Object frame = wrap_frame (f); |
369 | |
428 | 370 |
371 mini_window = allocate_window (); | |
372 XWINDOW (f->root_window)->next = mini_window; | |
373 XWINDOW (mini_window)->prev = f->root_window; | |
374 XWINDOW (mini_window)->mini_p = Qt; | |
375 XWINDOW (mini_window)->frame = frame; | |
376 f->minibuffer_window = mini_window; | |
377 f->has_minibuffer = 1; | |
378 | |
853 | 379 note_object_created (mini_window); |
380 | |
428 | 381 XWINDOW (mini_window)->buffer = Qt; |
440 | 382 Fset_window_buffer (mini_window, Vminibuffer_zero, Qt); |
428 | 383 } |
384 | |
385 /* Make a frame using a separate minibuffer window on another frame. | |
386 MINI_WINDOW is the minibuffer window to use. nil means use the | |
387 default-minibuffer-frame. */ | |
388 | |
389 static void | |
390 setup_frame_without_minibuffer (struct frame *f, Lisp_Object mini_window) | |
391 { | |
392 /* This function can GC */ | |
393 Lisp_Object device = f->device; | |
394 | |
395 if (!NILP (mini_window)) | |
396 CHECK_LIVE_WINDOW (mini_window); | |
397 | |
398 if (!NILP (mini_window) | |
399 && !EQ (DEVICE_CONSOLE (XDEVICE (device)), | |
400 FRAME_CONSOLE (XFRAME (XWINDOW (mini_window)->frame)))) | |
563 | 401 invalid_argument ("frame and minibuffer must be on the same console", Qunbound); |
428 | 402 |
442 | 403 /* Do not create a default minibuffer frame on printer devices. */ |
404 if (NILP (mini_window) | |
405 && DEVICE_DISPLAY_P (XDEVICE (FRAME_DEVICE (f)))) | |
428 | 406 { |
407 struct console *con = XCONSOLE (FRAME_CONSOLE (f)); | |
408 /* Use default-minibuffer-frame if possible. */ | |
409 if (!FRAMEP (con->default_minibuffer_frame) | |
410 || ! FRAME_LIVE_P (XFRAME (con->default_minibuffer_frame))) | |
411 { | |
412 /* If there's no minibuffer frame to use, create one. */ | |
413 con->default_minibuffer_frame | |
414 = call1 (Qmake_initial_minibuffer_frame, device); | |
415 } | |
416 mini_window = XFRAME (con->default_minibuffer_frame)->minibuffer_window; | |
417 } | |
418 | |
419 /* Install the chosen minibuffer window, with proper buffer. */ | |
442 | 420 if (!NILP (mini_window)) |
421 { | |
422 store_minibuf_frame_prop (f, mini_window); | |
423 Fset_window_buffer (mini_window, Vminibuffer_zero, Qt); | |
424 } | |
425 else | |
426 f->minibuffer_window = Qnil; | |
428 | 427 } |
428 | |
429 /* Make a frame containing only a minibuffer window. */ | |
430 | |
431 static void | |
432 setup_minibuffer_frame (struct frame *f) | |
433 { | |
434 /* This function can GC */ | |
435 /* First make a frame containing just a root window, no minibuffer. */ | |
436 Lisp_Object mini_window; | |
793 | 437 Lisp_Object frame = wrap_frame (f); |
438 | |
428 | 439 |
440 f->no_split = 1; | |
441 f->has_minibuffer = 1; | |
442 | |
443 /* Now label the root window as also being the minibuffer. | |
444 Avoid infinite looping on the window chain by marking next pointer | |
445 as nil. */ | |
446 | |
447 mini_window = f->minibuffer_window = f->root_window; | |
448 XWINDOW (mini_window)->mini_p = Qt; | |
449 XWINDOW (mini_window)->next = Qnil; | |
450 XWINDOW (mini_window)->prev = Qnil; | |
451 XWINDOW (mini_window)->frame = frame; | |
452 | |
453 /* Put the proper buffer in that window. */ | |
454 | |
440 | 455 Fset_window_buffer (mini_window, Vminibuffer_zero, Qt); |
428 | 456 } |
457 | |
458 static Lisp_Object | |
459 make_sure_its_a_fresh_plist (Lisp_Object foolist) | |
460 { | |
461 if (CONSP (Fcar (foolist))) | |
462 { | |
463 /* looks like an alist to me. */ | |
464 foolist = Fcopy_alist (foolist); | |
465 foolist = Fdestructive_alist_to_plist (foolist); | |
466 } | |
467 else | |
468 foolist = Fcopy_sequence (foolist); | |
469 | |
470 return foolist; | |
471 } | |
472 | |
558 | 473 static Lisp_Object |
546 | 474 restore_frame_list_to_its_unbesmirched_state (Lisp_Object kawnz) |
475 { | |
476 Lisp_Object lissed = XCDR (kawnz); | |
477 if (!EQ (lissed, Qunbound)) | |
478 DEVICE_FRAME_LIST (XDEVICE (XCAR (kawnz))) = lissed; | |
479 return Qnil; | |
4207 | 480 } |
546 | 481 |
428 | 482 DEFUN ("make-frame", Fmake_frame, 0, 2, "", /* |
483 Create and return a new frame, displaying the current buffer. | |
484 Runs the functions listed in `create-frame-hook' after frame creation. | |
485 | |
486 Optional argument PROPS is a property list (a list of alternating | |
487 keyword-value specifications) of properties for the new frame. | |
488 \(An alist is accepted for backward compatibility but should not | |
489 be passed in.) | |
490 | |
491 See `set-frame-properties', `default-x-frame-plist', and | |
492 `default-tty-frame-plist' for the specially-recognized properties. | |
493 */ | |
494 (props, device)) | |
495 { | |
496 struct frame *f; | |
497 struct device *d; | |
498 Lisp_Object frame = Qnil, name = Qnil, minibuf; | |
499 struct gcpro gcpro1, gcpro2, gcpro3; | |
546 | 500 int speccount = specpdl_depth (), speccount2; |
428 | 501 int first_frame_on_device = 0; |
502 int first_frame_on_console = 0; | |
546 | 503 Lisp_Object besmirched_cons = Qnil; |
771 | 504 int frame_name_is_defaulted = 1; |
428 | 505 |
506 d = decode_device (device); | |
793 | 507 device = wrap_device (d); |
428 | 508 |
509 /* PROPS and NAME may be freshly-created, so make sure to GCPRO. */ | |
510 GCPRO3 (frame, props, name); | |
511 | |
512 props = make_sure_its_a_fresh_plist (props); | |
513 if (DEVICE_SPECIFIC_FRAME_PROPS (d)) | |
514 /* Put the device-specific props before the more general ones so | |
515 that they override them. */ | |
516 props = nconc2 (props, | |
517 make_sure_its_a_fresh_plist | |
518 (*DEVICE_SPECIFIC_FRAME_PROPS (d))); | |
519 props = nconc2 (props, make_sure_its_a_fresh_plist (Vdefault_frame_plist)); | |
520 Fcanonicalize_lax_plist (props, Qnil); | |
521 | |
522 name = Flax_plist_get (props, Qname, Qnil); | |
523 if (!NILP (name)) | |
771 | 524 { |
525 CHECK_STRING (name); | |
526 frame_name_is_defaulted = 0; | |
527 } | |
2681 | 528 else if (!initialized) |
529 { | |
530 /* We leave Vdefault_frame_name alone here so that it'll remain Qnil | |
531 in the dumped executable, and we can choose it at runtime. */ | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4846
diff
changeset
|
532 name = build_ascstring ("XEmacs"); |
2681 | 533 } |
4207 | 534 else if (NILP (Vdefault_frame_name)) |
535 { | |
2681 | 536 if (egetenv ("USE_EMACS_AS_DEFAULT_APPLICATION_CLASS")) |
537 { | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4846
diff
changeset
|
538 Vdefault_frame_name = build_ascstring ("emacs"); |
2681 | 539 } |
4207 | 540 else |
2681 | 541 { |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4846
diff
changeset
|
542 Vdefault_frame_name = build_ascstring ("XEmacs"); |
2681 | 543 } |
544 } | |
545 | |
546 if (NILP(name) && STRINGP(Vdefault_frame_name)) | |
547 { | |
548 name = Vdefault_frame_name; | |
549 } | |
428 | 550 |
867 | 551 if (!NILP (Fstring_match (make_string ((const Ibyte *) "\\.", 2), name, |
428 | 552 Qnil, Qnil))) |
563 | 553 syntax_error (". not allowed in frame names", name); |
428 | 554 |
555 f = allocate_frame_core (device); | |
793 | 556 frame = wrap_frame (f); |
428 | 557 |
558 specbind (Qframe_being_created, name); | |
559 f->name = name; | |
560 | |
771 | 561 FRAMEMETH (f, init_frame_1, (f, props, frame_name_is_defaulted)); |
428 | 562 |
563 minibuf = Flax_plist_get (props, Qminibuffer, Qunbound); | |
564 if (UNBOUNDP (minibuf)) | |
565 { | |
566 /* If minibuf is unspecified, then look for a minibuffer X resource. */ | |
567 /* #### Not implemented any more. We need to fix things up so | |
568 that we search out all X resources and append them to the end of | |
569 props, above. This is the only way in general to assure | |
570 coherent behavior for all frame properties/resources/etc. */ | |
571 } | |
572 else | |
573 props = Flax_plist_remprop (props, Qminibuffer); | |
574 | |
575 if (EQ (minibuf, Qnone) || NILP (minibuf)) | |
576 setup_frame_without_minibuffer (f, Qnil); | |
577 else if (EQ (minibuf, Qonly)) | |
578 setup_minibuffer_frame (f); | |
579 else if (WINDOWP (minibuf)) | |
580 setup_frame_without_minibuffer (f, minibuf); | |
581 else if (EQ (minibuf, Qt) || UNBOUNDP (minibuf)) | |
582 setup_normal_frame (f); | |
583 else | |
563 | 584 invalid_argument ("Invalid value for `minibuffer'", minibuf); |
428 | 585 |
586 update_frame_window_mirror (f); | |
587 | |
588 if (initialized && !DEVICE_STREAM_P (d)) | |
589 { | |
590 if (!NILP (f->minibuffer_window)) | |
4207 | 591 reset_face_cachels (XWINDOW (f->minibuffer_window)); |
428 | 592 reset_face_cachels (XWINDOW (f->root_window)); |
593 } | |
594 | |
595 /* If no frames on this device formerly existed, say this is the | |
596 first frame. It kind of assumes that frameless devices don't | |
597 exist, but it shouldn't be too harmful. */ | |
598 if (NILP (DEVICE_FRAME_LIST (d))) | |
599 first_frame_on_device = 1; | |
600 | |
546 | 601 /* It's possible for one of the init methods below to signal an error; |
602 in that case, let's make sure the device isn't besmirched by | |
603 having a half-initialized frame attached to it */ | |
604 speccount2 = specpdl_depth (); | |
605 record_unwind_protect (restore_frame_list_to_its_unbesmirched_state, | |
606 besmirched_cons = | |
607 Fcons (device, DEVICE_FRAME_LIST (d))); | |
608 | |
428 | 609 /* This *must* go before the init_*() methods. Those functions |
610 call Lisp code, and if any of them causes a warning to be displayed | |
611 and the *Warnings* buffer to be created, it won't get added to | |
612 the frame-specific version of the buffer-alist unless the frame | |
613 is accessible from the device. */ | |
614 | |
615 #if 0 | |
616 DEVICE_FRAME_LIST (d) = nconc2 (DEVICE_FRAME_LIST (d), Fcons (frame, Qnil)); | |
617 #endif | |
618 DEVICE_FRAME_LIST (d) = Fcons (frame, DEVICE_FRAME_LIST (d)); | |
619 RESET_CHANGED_SET_FLAGS; | |
620 | |
853 | 621 note_object_created (frame); |
622 | |
428 | 623 /* Now make sure that the initial cached values are set correctly. |
624 Do this after the init_frame method is called because that may | |
625 do things (e.g. create widgets) that are necessary for the | |
626 specifier value-changed methods to work OK. */ | |
627 recompute_all_cached_specifiers_in_frame (f); | |
628 | |
629 if (!DEVICE_STREAM_P (d)) | |
630 { | |
631 init_frame_faces (f); | |
632 | |
633 #ifdef HAVE_SCROLLBARS | |
634 /* Finish up resourcing the scrollbars. */ | |
635 init_frame_scrollbars (f); | |
636 #endif | |
637 | |
638 #ifdef HAVE_TOOLBARS | |
639 /* Create the initial toolbars. We have to do this after the frame | |
640 methods are called because it may potentially call some things itself | |
641 which depend on the normal frame methods having initialized | |
642 things. */ | |
643 init_frame_toolbars (f); | |
644 #endif | |
645 reset_face_cachels (XWINDOW (FRAME_SELECTED_WINDOW (f))); | |
646 reset_glyph_cachels (XWINDOW (FRAME_SELECTED_WINDOW (f))); | |
442 | 647 |
428 | 648 change_frame_size (f, f->height, f->width, 0); |
649 } | |
650 | |
651 MAYBE_FRAMEMETH (f, init_frame_2, (f, props)); | |
652 Fset_frame_properties (frame, props); | |
653 MAYBE_FRAMEMETH (f, init_frame_3, (f)); | |
654 | |
655 /* Hallelujah, praise the lord. */ | |
656 f->init_finished = 1; | |
657 | |
546 | 658 XCDR (besmirched_cons) = Qunbound; |
659 | |
771 | 660 unbind_to (speccount2); |
546 | 661 |
428 | 662 /* If this is the first frame on the device, make it the selected one. */ |
663 if (first_frame_on_device && NILP (DEVICE_SELECTED_FRAME (d))) | |
664 set_device_selected_frame (d, frame); | |
665 | |
666 /* If at startup or if the current console is a stream console | |
667 (usually also at startup), make this console the selected one | |
668 so that messages show up on it. */ | |
669 if (NILP (Fselected_console ()) || | |
670 CONSOLE_STREAM_P (XCONSOLE (Fselected_console ()))) | |
671 Fselect_console (DEVICE_CONSOLE (d)); | |
672 | |
673 first_frame_on_console = | |
674 (first_frame_on_device && | |
675 XINT (Flength (CONSOLE_DEVICE_LIST (XCONSOLE (DEVICE_CONSOLE (d))))) | |
676 == 1); | |
677 | |
678 /* #### all this calling of frame methods at various odd times | |
679 is somewhat of a mess. It's necessary to do it this way due | |
680 to strange console-type-specific things that need to be done. */ | |
681 MAYBE_FRAMEMETH (f, after_init_frame, (f, first_frame_on_device, | |
682 first_frame_on_console)); | |
683 | |
442 | 684 if (!DEVICE_STREAM_P (d)) |
685 { | |
686 /* Now initialise the gutters. This won't change the frame size, | |
4207 | 687 but is needed as input to the layout that change_frame_size |
688 will eventually do. Unfortunately gutter sizing code relies | |
689 on the frame in question being visible so we can't do this | |
690 earlier. */ | |
442 | 691 init_frame_gutters (f); |
692 | |
693 change_frame_size (f, f->height, f->width, 0); | |
694 } | |
695 | |
428 | 696 if (first_frame_on_device) |
697 { | |
698 if (first_frame_on_console) | |
699 va_run_hook_with_args (Qcreate_console_hook, 1, DEVICE_CONSOLE (d)); | |
700 va_run_hook_with_args (Qcreate_device_hook, 1, device); | |
701 } | |
702 va_run_hook_with_args (Qcreate_frame_hook, 1, frame); | |
703 | |
704 /* Initialize custom-specific stuff. */ | |
705 if (!UNBOUNDP (symbol_function (XSYMBOL (Qcustom_initialize_frame)))) | |
706 call1 (Qcustom_initialize_frame, frame); | |
707 | |
1204 | 708 UNGCPRO; |
771 | 709 unbind_to (speccount); |
428 | 710 |
711 return frame; | |
712 } | |
713 | |
714 | |
715 /* this function should be used in most cases when a Lisp function is passed | |
716 a FRAME argument. Use this unless you don't accept nil == current frame | |
717 (in which case, do a CHECK_LIVE_FRAME() and then an XFRAME()) or you | |
718 allow dead frames. Note that very few functions should accept dead | |
719 frames. It could be argued that functions should just do nothing when | |
720 given a dead frame, but the presence of a dead frame usually indicates | |
721 an oversight in the Lisp code that could potentially lead to strange | |
722 results and so it is better to catch the error early. | |
723 | |
724 If you only accept X frames, use decode_x_frame(), which does what this | |
725 function does but also makes sure the frame is an X frame. */ | |
726 | |
727 struct frame * | |
728 decode_frame (Lisp_Object frame) | |
729 { | |
730 if (NILP (frame)) | |
731 return selected_frame (); | |
732 | |
733 CHECK_LIVE_FRAME (frame); | |
734 return XFRAME (frame); | |
735 } | |
736 | |
737 struct frame * | |
738 decode_frame_or_selected (Lisp_Object cdf) | |
739 { | |
740 if (CONSOLEP (cdf)) | |
741 cdf = CONSOLE_SELECTED_DEVICE (decode_console (cdf)); | |
742 if (DEVICEP (cdf)) | |
743 cdf = DEVICE_SELECTED_FRAME (decode_device (cdf)); | |
744 return decode_frame (cdf); | |
745 } | |
746 | |
872 | 747 Lisp_Object |
748 frame_device (struct frame *f) | |
749 { | |
750 return FRAME_DEVICE (f); | |
751 } | |
752 | |
753 int | |
754 frame_live_p (struct frame *f) | |
755 { | |
756 return FRAME_LIVE_P (f); | |
757 } | |
758 | |
428 | 759 |
760 void | |
761 invalidate_vertical_divider_cache_in_frame (struct frame *f) | |
762 { | |
763 /* Invalidate cached value of needs_vertical_divider_p in | |
764 every and all windows */ | |
765 map_windows (f, invalidate_vertical_divider_cache_in_window, 0); | |
766 } | |
767 | |
768 /* | |
769 * Frame size may change due to changes in scrollbars, toolbars, | |
770 * default font etc. These changes are applied early in redisplay | |
771 * frame. | |
772 */ | |
773 void | |
774 adjust_frame_size (struct frame *f) | |
775 { | |
1318 | 776 /* This can call Lisp. */ |
428 | 777 int keep_char_size = 0; |
793 | 778 Lisp_Object frame = wrap_frame (f); |
779 | |
428 | 780 if (!f->size_slipped) |
781 return; | |
782 | |
783 /* Don't adjust tty frames. #### May break when TTY have menubars. | |
784 Then, write an Vadjust_frame_function which will return t for TTY | |
785 frames. Another solution is frame_size_fixed_p method for TTYs, | |
786 which always returned yes it's fixed. | |
787 */ | |
788 if (!FRAME_WIN_P (f)) | |
789 { | |
790 CLEAR_FRAME_SIZE_SLIPPED (f); | |
791 return; | |
792 } | |
793 | |
794 /* frame_size_fixed_p tells that frame size cannot currently | |
795 be changed change due to external conditions */ | |
796 if (!FRAMEMETH_OR_GIVEN (f, frame_size_fixed_p, (f), 0)) | |
797 { | |
798 if (NILP (Vadjust_frame_function)) | |
799 keep_char_size = 1; | |
800 else if (EQ (Vadjust_frame_function, Qt)) | |
801 keep_char_size = 0; | |
802 else | |
803 keep_char_size = | |
853 | 804 NILP (call1_trapping_problems ("Error in adjust-frame-function", |
805 Vadjust_frame_function, frame, | |
806 0)); | |
428 | 807 |
808 if (keep_char_size) | |
809 Fset_frame_size (frame, make_int (FRAME_CHARWIDTH(f)), | |
810 make_int (FRAME_CHARHEIGHT(f)), Qnil); | |
811 } | |
812 | |
813 if (!keep_char_size) | |
814 { | |
815 int height, width; | |
816 pixel_to_char_size (f, FRAME_PIXWIDTH(f), FRAME_PIXHEIGHT(f), | |
817 &width, &height); | |
818 change_frame_size (f, height, width, 0); | |
819 CLEAR_FRAME_SIZE_SLIPPED (f); | |
820 } | |
821 } | |
822 | |
823 /* | |
824 * This is a "specifier changed in frame" handler for various specifiers | |
825 * changing which causes frame size adjustment | |
826 */ | |
827 void | |
2286 | 828 frame_size_slipped (Lisp_Object UNUSED (specifier), struct frame *f, |
829 Lisp_Object UNUSED (oldval)) | |
428 | 830 { |
831 MARK_FRAME_SIZE_SLIPPED(f); | |
832 } | |
833 | |
834 DEFUN ("framep", Fframep, 1, 1, 0, /* | |
835 Return non-nil if OBJECT is a frame. | |
836 Also see `frame-live-p'. | |
837 Note that FSF Emacs kludgily returns a value indicating what type of | |
838 frame this is. Use the cleaner function `frame-type' for that. | |
839 */ | |
840 (object)) | |
841 { | |
842 return FRAMEP (object) ? Qt : Qnil; | |
843 } | |
844 | |
845 DEFUN ("frame-live-p", Fframe_live_p, 1, 1, 0, /* | |
846 Return non-nil if OBJECT is a frame which has not been deleted. | |
847 */ | |
848 (object)) | |
849 { | |
850 return FRAMEP (object) && FRAME_LIVE_P (XFRAME (object)) ? Qt : Qnil; | |
851 } | |
852 | |
853 | |
854 DEFUN ("focus-frame", Ffocus_frame, 1, 1, 0, /* | |
855 Select FRAME and give it the window system focus. | |
856 This function is not affected by the value of `focus-follows-mouse'. | |
857 */ | |
858 (frame)) | |
859 { | |
860 CHECK_LIVE_FRAME (frame); | |
861 | |
862 MAYBE_DEVMETH (XDEVICE (FRAME_DEVICE (XFRAME (frame))), focus_on_frame, | |
863 (XFRAME (frame))); | |
864 /* FRAME will be selected by the time we receive the next event. | |
865 However, it is better to select it explicitly now, in case the | |
866 Lisp code depends on frame being selected. */ | |
867 Fselect_frame (frame); | |
868 return Qnil; | |
869 } | |
870 | |
871 /* Called from Fselect_window() */ | |
872 void | |
873 select_frame_1 (Lisp_Object frame) | |
874 { | |
875 struct frame *f = XFRAME (frame); | |
876 Lisp_Object old_selected_frame = Fselected_frame (Qnil); | |
877 | |
878 if (EQ (frame, old_selected_frame)) | |
879 return; | |
880 | |
881 /* now select the frame's device */ | |
882 set_device_selected_frame (XDEVICE (FRAME_DEVICE (f)), frame); | |
883 select_device_1 (FRAME_DEVICE (f)); | |
884 | |
885 update_frame_window_mirror (f); | |
886 } | |
887 | |
888 DEFUN ("select-frame", Fselect_frame, 1, 1, 0, /* | |
889 Select the frame FRAME. | |
890 Subsequent editing commands apply to its selected window. | |
891 The selection of FRAME lasts until the next time the user does | |
892 something to select a different frame, or until the next time this | |
893 function is called. | |
894 | |
895 Note that this does not actually cause the window-system focus to be | |
896 set to this frame, or the `select-frame-hook' or `deselect-frame-hook' | |
897 to be run, until the next time that XEmacs is waiting for an event. | |
898 | |
899 Also note that when focus-follows-mouse is non-nil, the frame | |
900 selection is temporary and is reverted when the current command | |
901 terminates, much like the buffer selected by `set-buffer'. In order | |
902 to effect a permanent focus change, use `focus-frame'. | |
903 */ | |
904 (frame)) | |
905 { | |
906 CHECK_LIVE_FRAME (frame); | |
907 | |
908 /* select the frame's selected window. This will call | |
909 selected_frame_1(). */ | |
910 Fselect_window (FRAME_SELECTED_WINDOW (XFRAME (frame)), Qnil); | |
911 | |
912 /* Nothing should be depending on the return value of this function. | |
913 But, of course, there is stuff out there which is. */ | |
914 return frame; | |
915 } | |
916 | |
917 /* use this to retrieve the currently selected frame. You should use | |
918 this in preference to Fselected_frame (Qnil) unless you are prepared | |
919 to handle the possibility of there being no selected frame (this | |
920 happens at some points during startup). */ | |
921 | |
922 struct frame * | |
923 selected_frame (void) | |
924 { | |
925 Lisp_Object device = Fselected_device (Qnil); | |
926 Lisp_Object frame = DEVICE_SELECTED_FRAME (XDEVICE (device)); | |
927 if (NILP (frame)) | |
563 | 928 gui_error ("No frames exist on device", device); |
428 | 929 return XFRAME (frame); |
930 } | |
931 | |
932 /* use this instead of XFRAME (DEVICE_SELECTED_FRAME (d)) to catch | |
933 the possibility of there being no frames on the device (just created). | |
934 There is no point doing this inside of redisplay because errors | |
2500 | 935 cause an ABORT(), indicating a flaw in the logic, and error_check_frame() |
428 | 936 will catch this just as well. */ |
937 | |
938 struct frame * | |
939 device_selected_frame (struct device *d) | |
940 { | |
941 Lisp_Object frame = DEVICE_SELECTED_FRAME (d); | |
942 if (NILP (frame)) | |
943 { | |
793 | 944 Lisp_Object device = wrap_device (d); |
945 | |
563 | 946 gui_error ("No frames exist on device", device); |
428 | 947 } |
948 return XFRAME (frame); | |
949 } | |
950 | |
951 #if 0 /* FSFmacs */ | |
952 | |
826 | 953 DEFUN ("handle-switch-frame", Fhandle_switch_frame, 1, 2, "e", /* |
428 | 954 Handle a switch-frame event EVENT. |
955 Switch-frame events are usually bound to this function. | |
956 A switch-frame event tells Emacs that the window manager has requested | |
957 that the user's events be directed to the frame mentioned in the event. | |
958 This function selects the selected window of the frame of EVENT. | |
959 | |
960 If EVENT is frame object, handle it as if it were a switch-frame event | |
961 to that frame. | |
962 */ | |
963 (frame, no_enter)) | |
964 { | |
965 /* Preserve prefix arg that the command loop just cleared. */ | |
966 XCONSOLE (Vselected_console)->prefix_arg = Vcurrent_prefix_arg; | |
967 #if 0 /* unclean! */ | |
968 run_hook (Qmouse_leave_buffer_hook); | |
969 #endif | |
970 return do_switch_frame (frame, no_enter, 0); | |
971 } | |
972 | |
973 /* A load of garbage. */ | |
826 | 974 DEFUN ("ignore-event", Fignore_event, 0, 0, "", /* |
428 | 975 Do nothing, but preserve any prefix argument already specified. |
976 This is a suitable binding for iconify-frame and make-frame-visible. | |
977 */ | |
978 ()) | |
979 { | |
980 struct console *c = XCONSOLE (Vselected_console); | |
981 | |
982 c->prefix_arg = Vcurrent_prefix_arg; | |
983 return Qnil; | |
984 } | |
985 | |
986 #endif /* 0 */ | |
987 | |
988 DEFUN ("selected-frame", Fselected_frame, 0, 1, 0, /* | |
989 Return the frame that is now selected on device DEVICE. | |
990 If DEVICE is not specified, the selected device will be used. | |
991 If no frames exist on the device, nil is returned. | |
992 */ | |
993 (device)) | |
994 { | |
995 if (NILP (device) && NILP (Fselected_device (Qnil))) | |
996 return Qnil; /* happens early in temacs */ | |
997 return DEVICE_SELECTED_FRAME (decode_device (device)); | |
998 } | |
999 | |
1000 Lisp_Object | |
1001 frame_first_window (struct frame *f) | |
1002 { | |
1003 Lisp_Object w = f->root_window; | |
1004 | |
1005 while (1) | |
1006 { | |
1007 if (! NILP (XWINDOW (w)->hchild)) | |
1008 w = XWINDOW (w)->hchild; | |
1009 else if (! NILP (XWINDOW (w)->vchild)) | |
1010 w = XWINDOW (w)->vchild; | |
1011 else | |
1012 break; | |
1013 } | |
1014 | |
1015 return w; | |
1016 } | |
1017 | |
1018 DEFUN ("active-minibuffer-window", Factive_minibuffer_window, 0, 0, 0, /* | |
1019 Return the currently active minibuffer window, or nil if none. | |
1020 */ | |
1021 ()) | |
1022 { | |
1023 return minibuf_level ? minibuf_window : Qnil; | |
1024 } | |
1025 | |
1026 DEFUN ("last-nonminibuf-frame", Flast_nonminibuf_frame, 0, 1, 0, /* | |
1027 Return the most-recently-selected non-minibuffer-only frame on CONSOLE. | |
1028 This will always be the same as (selected-frame device) unless the | |
1029 selected frame is a minibuffer-only frame. | |
1030 CONSOLE defaults to the selected console if omitted. | |
1031 */ | |
1032 (console)) | |
1033 { | |
1034 Lisp_Object result; | |
1035 | |
793 | 1036 console = wrap_console (decode_console (console)); |
428 | 1037 /* Just in case the machinations in delete_frame_internal() resulted |
1038 in the last-nonminibuf-frame getting out of sync, make sure and | |
1039 return the selected frame if it's acceptable. */ | |
1040 result = Fselected_frame (CONSOLE_SELECTED_DEVICE (XCONSOLE (console))); | |
1041 if (!NILP (result) && !FRAME_MINIBUF_ONLY_P (XFRAME (result))) | |
1042 return result; | |
1043 return CONSOLE_LAST_NONMINIBUF_FRAME (XCONSOLE (console)); | |
1044 } | |
1045 | |
1046 DEFUN ("frame-root-window", Fframe_root_window, 0, 1, 0, /* | |
1047 Return the root-window of FRAME. | |
1048 If omitted, FRAME defaults to the currently selected frame. | |
1049 */ | |
1050 (frame)) | |
1051 { | |
1052 struct frame *f = decode_frame (frame); | |
1053 return FRAME_ROOT_WINDOW (f); | |
1054 } | |
1055 | |
1056 DEFUN ("frame-selected-window", Fframe_selected_window, 0, 1, 0, /* | |
1057 Return the selected window of frame object FRAME. | |
1058 If omitted, FRAME defaults to the currently selected frame. | |
1059 */ | |
1060 (frame)) | |
1061 { | |
1062 struct frame *f = decode_frame (frame); | |
1063 return FRAME_SELECTED_WINDOW (f); | |
1064 } | |
1065 | |
1066 void | |
1067 set_frame_selected_window (struct frame *f, Lisp_Object window) | |
1068 { | |
1069 assert (XFRAME (WINDOW_FRAME (XWINDOW (window))) == f); | |
1070 f->selected_window = window; | |
1071 if (!MINI_WINDOW_P (XWINDOW (window)) || FRAME_MINIBUF_ONLY_P (f)) | |
1072 { | |
1073 if (!EQ (f->last_nonminibuf_window, window)) | |
1074 { | |
442 | 1075 #ifdef HAVE_TOOLBARS |
428 | 1076 MARK_TOOLBAR_CHANGED; |
442 | 1077 #endif |
428 | 1078 MARK_GUTTER_CHANGED; |
1079 } | |
1080 f->last_nonminibuf_window = window; | |
1081 } | |
1082 } | |
1083 | |
1084 DEFUN ("set-frame-selected-window", Fset_frame_selected_window, 2, 2, 0, /* | |
460 | 1085 Set the selected window of FRAME to WINDOW. |
428 | 1086 If FRAME is nil, the selected frame is used. |
1087 If FRAME is the selected frame, this makes WINDOW the selected window. | |
1088 */ | |
1089 (frame, window)) | |
1090 { | |
793 | 1091 frame = wrap_frame (decode_frame (frame)); |
428 | 1092 CHECK_LIVE_WINDOW (window); |
1093 | |
1094 if (! EQ (frame, WINDOW_FRAME (XWINDOW (window)))) | |
563 | 1095 invalid_argument ("In `set-frame-selected-window', WINDOW is not on FRAME", Qunbound); |
428 | 1096 |
1097 if (XFRAME (frame) == selected_frame ()) | |
1098 return Fselect_window (window, Qnil); | |
1099 | |
1100 set_frame_selected_window (XFRAME (frame), window); | |
1101 return window; | |
1102 } | |
1103 | |
1104 | |
1105 DEFUN ("frame-device", Fframe_device, 0, 1, 0, /* | |
1106 Return the device that FRAME is on. | |
1107 If omitted, FRAME defaults to the currently selected frame. | |
1108 */ | |
1109 (frame)) | |
1110 { | |
1111 return FRAME_DEVICE (decode_frame (frame)); | |
1112 } | |
1113 | |
1114 int | |
1115 is_surrogate_for_selected_frame (struct frame *f) | |
1116 { | |
1117 struct device *d = XDEVICE (f->device); | |
1118 struct frame *dsf = device_selected_frame (d); | |
1119 | |
1120 /* Can't be a surrogate for ourselves. */ | |
1121 if (f == dsf) | |
1122 return 0; | |
1123 | |
1124 if (!FRAME_HAS_MINIBUF_P (dsf) && | |
1125 f == XFRAME (WINDOW_FRAME (XWINDOW (FRAME_MINIBUF_WINDOW (dsf))))) | |
1126 return 1; | |
1127 else | |
1128 return 0; | |
1129 } | |
1130 | |
1131 static int | |
444 | 1132 frame_matches_frame_spec (Lisp_Object frame, Lisp_Object type) |
428 | 1133 { |
1134 struct frame *f = XFRAME (frame); | |
1135 | |
1136 if (WINDOWP (type)) | |
1137 { | |
1138 CHECK_LIVE_WINDOW (type); | |
1139 | |
1140 if (EQ (FRAME_MINIBUF_WINDOW (f), type) | |
1141 /* Check that F either is, or has forwarded | |
1142 its focus to, TYPE's frame. */ | |
1143 && (EQ (WINDOW_FRAME (XWINDOW (type)), frame) | |
1144 || EQ (WINDOW_FRAME (XWINDOW (type)), | |
1145 FRAME_FOCUS_FRAME (f)))) | |
1146 return 1; | |
1147 else | |
1148 return 0; | |
1149 } | |
1150 | |
1151 #if 0 /* FSFmacs */ | |
1152 if (EQ (type, Qvisible) || EQ (type, Qiconic) || EQ (type, Qvisible_iconic) | |
1153 || EQ (type, Qvisible_nomini) || EQ (type, Qiconic_nomini) | |
1154 || EQ (type, Qvisible_iconic_nomini)) | |
1155 FRAME_SAMPLE_VISIBILITY (f); | |
1156 #endif | |
1157 | |
1158 if (NILP (type)) | |
1159 type = Qnomini; | |
1160 if (ZEROP (type)) | |
1161 type = Qvisible_iconic; | |
1162 | |
1163 if (EQ (type, Qvisible)) | |
1164 return FRAME_VISIBLE_P (f); | |
1165 if (EQ (type, Qiconic)) | |
1166 return FRAME_ICONIFIED_P (f); | |
1167 if (EQ (type, Qinvisible)) | |
1168 return !FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f); | |
1169 if (EQ (type, Qvisible_iconic)) | |
1170 return FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f); | |
1171 if (EQ (type, Qinvisible_iconic)) | |
1172 return !FRAME_VISIBLE_P (f); | |
1173 | |
1174 if (EQ (type, Qnomini)) | |
1175 return !FRAME_MINIBUF_ONLY_P (f); | |
1176 if (EQ (type, Qvisible_nomini)) | |
1177 return FRAME_VISIBLE_P (f) && !FRAME_MINIBUF_ONLY_P (f); | |
1178 if (EQ (type, Qiconic_nomini)) | |
1179 return FRAME_ICONIFIED_P (f) && !FRAME_MINIBUF_ONLY_P (f); | |
1180 if (EQ (type, Qinvisible_nomini)) | |
1181 return !FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f) && | |
1182 !FRAME_MINIBUF_ONLY_P (f); | |
1183 if (EQ (type, Qvisible_iconic_nomini)) | |
1184 return ((FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f)) | |
1185 && !FRAME_MINIBUF_ONLY_P (f)); | |
1186 if (EQ (type, Qinvisible_iconic_nomini)) | |
1187 return !FRAME_VISIBLE_P (f) && !FRAME_MINIBUF_ONLY_P (f); | |
1188 | |
1189 return 1; | |
1190 } | |
1191 | |
1192 int | |
444 | 1193 device_matches_device_spec (Lisp_Object device, Lisp_Object device_spec) |
428 | 1194 { |
444 | 1195 if (EQ (device_spec, Qwindow_system)) |
428 | 1196 return DEVICE_WIN_P (XDEVICE (device)); |
444 | 1197 if (DEVICEP (device_spec)) |
1198 return EQ (device, device_spec); | |
1199 if (CONSOLEP (device_spec)) | |
1200 return EQ (DEVICE_CONSOLE (XDEVICE (device)), device_spec); | |
1201 if (valid_console_type_p (device_spec)) | |
1202 return EQ (DEVICE_TYPE (XDEVICE (device)), device_spec); | |
428 | 1203 return 1; |
1204 } | |
1205 | |
1206 /* Return the next frame in the frame list after FRAME. | |
444 | 1207 WHICH-FRAMES and WHICH-DEVICES control which frames and devices |
428 | 1208 are considered; see `next-frame'. */ |
1209 | |
1210 Lisp_Object | |
444 | 1211 next_frame (Lisp_Object frame, Lisp_Object which_frames, Lisp_Object which_devices) |
428 | 1212 { |
442 | 1213 Lisp_Object first = Qnil; |
1214 Lisp_Object devcons, concons; | |
1215 int passed = 0; | |
1216 | |
1217 CHECK_LIVE_FRAME (frame); | |
1218 | |
1219 DEVICE_LOOP_NO_BREAK (devcons, concons) | |
1220 { | |
1221 Lisp_Object device = XCAR (devcons); | |
1222 Lisp_Object frmcons; | |
1223 | |
444 | 1224 if (!device_matches_device_spec (device, which_devices)) |
442 | 1225 { |
1226 if (EQ (device, FRAME_DEVICE (XFRAME (frame)))) | |
1227 passed = 1; | |
1228 continue; | |
1229 } | |
1230 | |
1231 DEVICE_FRAME_LOOP (frmcons, XDEVICE (device)) | |
1232 { | |
1233 Lisp_Object f = XCAR (frmcons); | |
1234 | |
1235 if (passed) | |
1236 { | |
444 | 1237 if (frame_matches_frame_spec (f, which_frames)) |
442 | 1238 return f; |
1239 } | |
1240 else | |
1241 { | |
1242 if (EQ (frame, f)) | |
1243 { | |
1244 passed = 1; | |
1245 } | |
1246 else | |
1247 { | |
444 | 1248 if (NILP (first) && frame_matches_frame_spec (f, which_frames)) |
442 | 1249 first = f; |
1250 } | |
1251 } | |
1252 } | |
1253 } | |
1254 | |
1255 if (NILP (first)) | |
1256 /* We went through the whole frame list without finding a single | |
1257 acceptable frame. Return the original frame. */ | |
1258 return frame; | |
1259 else | |
1260 /* There were no acceptable frames in the list after FRAME; otherwise, | |
1261 we would have returned directly from the loop. Since FIRST is the last | |
1262 acceptable frame in the list, return it. */ | |
1263 return first; | |
428 | 1264 } |
1265 | |
1266 /* Return the previous frame in the frame list before FRAME. | |
444 | 1267 WHICH-FRAMES and WHICH-DEVICES control which frames and devices |
428 | 1268 are considered; see `next-frame'. */ |
1269 | |
1270 Lisp_Object | |
444 | 1271 previous_frame (Lisp_Object frame, Lisp_Object which_frames, Lisp_Object which_devices) |
428 | 1272 { |
1273 Lisp_Object devcons, concons; | |
442 | 1274 Lisp_Object last = Qnil; |
1275 | |
428 | 1276 CHECK_LIVE_FRAME (frame); |
1277 | |
1278 DEVICE_LOOP_NO_BREAK (devcons, concons) | |
1279 { | |
1280 Lisp_Object device = XCAR (devcons); | |
1281 Lisp_Object frmcons; | |
1282 | |
444 | 1283 if (!device_matches_device_spec (device, which_devices)) |
442 | 1284 { |
1285 if (EQ (device, FRAME_DEVICE (XFRAME (frame))) | |
1286 && !NILP (last)) | |
1287 return last; | |
1288 continue; | |
1289 } | |
428 | 1290 |
1291 DEVICE_FRAME_LOOP (frmcons, XDEVICE (device)) | |
1292 { | |
1293 Lisp_Object f = XCAR (frmcons); | |
1294 | |
442 | 1295 if (EQ (frame, f)) |
1296 { | |
1297 if (!NILP (last)) | |
1298 return last; | |
1299 } | |
1300 else | |
1301 { | |
444 | 1302 if (frame_matches_frame_spec (f, which_frames)) |
442 | 1303 last = f; |
1304 } | |
428 | 1305 } |
1306 } | |
1307 | |
442 | 1308 if (NILP (last)) |
428 | 1309 /* We went through the whole frame list without finding a single |
1310 acceptable frame. Return the original frame. */ | |
1311 return frame; | |
1312 else | |
1313 /* There were no acceptable frames in the list before FRAME; otherwise, | |
442 | 1314 we would have returned directly from the loop. Since LAST is the last |
428 | 1315 acceptable frame in the list, return it. */ |
442 | 1316 return last; |
428 | 1317 } |
1318 | |
1319 DEFUN ("next-frame", Fnext_frame, 0, 3, 0, /* | |
1320 Return the next frame of the right type in the frame list after FRAME. | |
444 | 1321 WHICH-FRAMES controls which frames are eligible to be returned; all |
428 | 1322 others will be skipped. Note that if there is only one eligible |
1323 frame, then `next-frame' called repeatedly will always return | |
1324 the same frame, and if there is no eligible frame, then FRAME is | |
1325 returned. | |
1326 | |
444 | 1327 Possible values for WHICH-FRAMES are |
428 | 1328 |
3025 | 1329 `visible' Consider only frames that are visible. |
1330 `iconic' Consider only frames that are iconic. | |
1331 `invisible' Consider only frames that are invisible | |
4207 | 1332 (this is different from iconic). |
3025 | 1333 `visible-iconic' Consider frames that are visible or iconic. |
1334 `invisible-iconic' Consider frames that are invisible or iconic. | |
1335 `nomini' Consider all frames except minibuffer-only ones. | |
1336 `visible-nomini' Like `visible' but omits minibuffer-only frames. | |
1337 `iconic-nomini' Like `iconic' but omits minibuffer-only frames. | |
1338 `invisible-nomini' Like `invisible' but omits minibuffer-only frames. | |
1339 `visible-iconic-nomini' Like `visible-iconic' but omits minibuffer-only | |
4207 | 1340 frames. |
3025 | 1341 `invisible-iconic-nomini' Like `invisible-iconic' but omits minibuffer-only |
4207 | 1342 frames. |
3025 | 1343 any other value Consider all frames. |
1344 | |
1345 If WHICH-FRAMES is omitted, `nomini' is used. A value for WHICH-FRAMES | |
1346 of 0 (a number) is treated like `iconic', for backwards compatibility. | |
444 | 1347 |
1348 If WHICH-FRAMES is a window, include only its own frame and any frame | |
1349 now using that window as the minibuffer. | |
1350 | |
1351 The optional third argument WHICH-DEVICES further clarifies on which | |
1352 devices to search for frames as specified by WHICH-FRAMES. | |
1353 If nil or omitted, search all devices on FRAME's console. | |
1354 If a device, only search that device. | |
1355 If a console, search all devices on that console. | |
1356 If a device type, search all devices of that type. | |
1357 If `window-system', search all window-system devices. | |
1358 Any other non-nil value means search all devices. | |
428 | 1359 */ |
444 | 1360 (frame, which_frames, which_devices)) |
428 | 1361 { |
793 | 1362 frame = wrap_frame (decode_frame (frame)); |
428 | 1363 |
444 | 1364 return next_frame (frame, which_frames, which_devices); |
428 | 1365 } |
1366 | |
1367 DEFUN ("previous-frame", Fprevious_frame, 0, 3, 0, /* | |
1368 Return the next frame of the right type in the frame list after FRAME. | |
444 | 1369 WHICH-FRAMES controls which frames are eligible to be returned; all |
428 | 1370 others will be skipped. Note that if there is only one eligible |
1371 frame, then `previous-frame' called repeatedly will always return | |
1372 the same frame, and if there is no eligible frame, then FRAME is | |
1373 returned. | |
1374 | |
444 | 1375 See `next-frame' for an explanation of the WHICH-FRAMES and WHICH-DEVICES |
428 | 1376 arguments. |
1377 */ | |
444 | 1378 (frame, which_frames, which_devices)) |
428 | 1379 { |
793 | 1380 frame = wrap_frame (decode_frame (frame)); |
428 | 1381 |
444 | 1382 return previous_frame (frame, which_frames, which_devices); |
428 | 1383 } |
1384 | |
1385 /* Return any frame for which PREDICATE is non-zero, or return Qnil | |
1386 if there aren't any. */ | |
1387 | |
1388 Lisp_Object | |
1389 find_some_frame (int (*predicate) (Lisp_Object, void *), | |
1390 void *closure) | |
1391 { | |
1392 Lisp_Object framecons, devcons, concons; | |
1393 | |
1394 FRAME_LOOP_NO_BREAK (framecons, devcons, concons) | |
1395 { | |
1396 Lisp_Object frame = XCAR (framecons); | |
1397 | |
1398 if ((predicate) (frame, closure)) | |
1399 return frame; | |
1400 } | |
1401 | |
1402 return Qnil; | |
1403 } | |
1404 | |
1405 | |
1406 | |
1407 /* extern void free_line_insertion_deletion_costs (struct frame *f); */ | |
1408 | |
1409 /* Return 1 if it is ok to delete frame F; | |
1410 0 if all frames aside from F are invisible. | |
1411 (Exception: if F is a stream frame, it's OK to delete if | |
1412 any other frames exist.) */ | |
1413 | |
442 | 1414 int |
1415 other_visible_frames (struct frame *f) | |
428 | 1416 { |
793 | 1417 Lisp_Object frame = wrap_frame (f); |
1418 | |
428 | 1419 if (FRAME_STREAM_P (f)) |
442 | 1420 return !EQ (frame, next_frame (frame, Qt, Qt)); |
1421 return !EQ (frame, next_frame (frame, Qvisible_iconic_nomini, Qt)); | |
428 | 1422 } |
1423 | |
1424 /* Delete frame F. | |
1425 | |
1426 If FORCE is non-zero, allow deletion of the only frame. | |
1427 | |
1428 If CALLED_FROM_DELETE_DEVICE is non-zero, then, if | |
1429 deleting the last frame on a device, just delete it, | |
1430 instead of calling `delete-device'. | |
1431 | |
1432 If FROM_IO_ERROR is non-zero, then the frame is gone due | |
1433 to an I/O error. This affects what happens if we exit | |
1434 (we do an emergency exit instead of `save-buffers-kill-emacs'.) | |
1435 */ | |
1436 | |
1437 void | |
1438 delete_frame_internal (struct frame *f, int force, | |
1439 int called_from_delete_device, | |
1440 int from_io_error) | |
1441 { | |
1442 /* This function can GC */ | |
1443 int minibuffer_selected; | |
1444 struct device *d; | |
1445 struct console *con; | |
1446 Lisp_Object frame; | |
1447 Lisp_Object device; | |
1448 Lisp_Object console; | |
1449 struct gcpro gcpro1; | |
1313 | 1450 int depth; |
428 | 1451 |
1452 /* OK to delete an already deleted frame. */ | |
853 | 1453 if (!FRAME_LIVE_P (f)) |
428 | 1454 return; |
1455 | |
793 | 1456 frame = wrap_frame (f); |
853 | 1457 |
1458 if (!force) | |
1459 check_allowed_operation (OPERATION_DELETE_OBJECT, frame, Qnil); | |
1460 | |
428 | 1461 GCPRO1 (frame); |
1462 | |
1463 device = FRAME_DEVICE (f); | |
1464 d = XDEVICE (device); | |
1465 console = DEVICE_CONSOLE (d); | |
1466 con = XCONSOLE (console); | |
1467 | |
545 | 1468 if (!called_from_delete_device |
1469 && !DEVICE_IMPL_FLAG (d, XDEVIMPF_FRAMELESS_OK)) | |
428 | 1470 { |
1471 /* If we're deleting the only non-minibuffer frame on the | |
1472 device, delete the device. */ | |
1473 if (EQ (frame, next_frame (frame, Qnomini, FRAME_DEVICE (f)))) | |
1474 { | |
1475 delete_device_internal (d, force, 0, from_io_error); | |
1476 UNGCPRO; | |
1477 return; | |
1478 } | |
1479 } | |
1480 | |
1481 /* In FSF, delete-frame will not normally allow you to delete the | |
1482 last visible frame. This was too annoying, so we changed it to the | |
1483 only frame. However, this would let people shoot themselves by | |
1484 deleting all frames which were either visible or iconified and thus | |
1485 losing any way of communicating with the still running XEmacs process. | |
1486 So we put it back. */ | |
1487 if (!force && !allow_deletion_of_last_visible_frame && | |
442 | 1488 !other_visible_frames (f)) |
563 | 1489 invalid_operation ("Attempt to delete the sole visible or iconified frame", Qunbound); |
428 | 1490 |
1491 /* Does this frame have a minibuffer, and is it the surrogate | |
1492 minibuffer for any other frame? */ | |
1493 if (FRAME_HAS_MINIBUF_P (f)) | |
1494 { | |
1495 Lisp_Object frmcons, devcons, concons; | |
1496 | |
1497 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons) | |
1498 { | |
2552 | 1499 Lisp_Object this_frame = XCAR (frmcons); |
1500 | |
1501 if (! EQ (this_frame, frame) | |
428 | 1502 && EQ (frame, (WINDOW_FRAME |
1503 (XWINDOW | |
2552 | 1504 (FRAME_MINIBUF_WINDOW (XFRAME (this_frame))))))) |
428 | 1505 { |
1506 /* We've found another frame whose minibuffer is on | |
1507 this frame. */ | |
563 | 1508 gui_error |
428 | 1509 ("Attempt to delete a surrogate minibuffer frame", frame); |
1510 } | |
1511 } | |
1512 } | |
1513 | |
1514 /* Test for popup frames hanging around. */ | |
1515 /* Deletion of a parent frame with popups is deadly. */ | |
1516 { | |
1517 Lisp_Object frmcons, devcons, concons; | |
1518 | |
1519 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons) | |
1520 { | |
2552 | 1521 Lisp_Object this_frame = XCAR (frmcons); |
1522 | |
1523 | |
1524 if (! EQ (this_frame, frame)) | |
428 | 1525 { |
1526 struct device *devcons_d = XDEVICE (XCAR (devcons)); | |
1527 if (EQ (frame, DEVMETH_OR_GIVEN (devcons_d, get_frame_parent, | |
2552 | 1528 (XFRAME (this_frame)), |
428 | 1529 Qnil))) |
1530 /* We've found a popup frame whose parent is this frame. */ | |
563 | 1531 gui_error |
428 | 1532 ("Attempt to delete a frame with live popups", frame); |
1533 } | |
1534 } | |
1535 } | |
1536 | |
1537 /* Before here, we haven't made any dangerous changes (just checked for | |
1538 error conditions). Now run the delete-frame-hook. Remember that | |
1539 user code there could do any number of dangerous things, including | |
1540 signalling an error. */ | |
1541 | |
1542 va_run_hook_with_args (Qdelete_frame_hook, 1, frame); | |
1543 | |
1544 if (!FRAME_LIVE_P (f)) /* Make sure the delete-frame-hook didn't */ | |
1545 { /* go ahead and delete anything. */ | |
1546 UNGCPRO; | |
1547 return; | |
1548 } | |
1549 | |
1550 /* Call the delete-device-hook and delete-console-hook now if | |
1551 appropriate, before we do any dangerous things -- they too could | |
1552 signal an error. */ | |
1553 if (XINT (Flength (DEVICE_FRAME_LIST (d))) == 1) | |
1554 { | |
1555 va_run_hook_with_args (Qdelete_device_hook, 1, device); | |
1556 if (!FRAME_LIVE_P (f)) /* Make sure the delete-device-hook didn't */ | |
1557 { /* go ahead and delete anything. */ | |
1558 UNGCPRO; | |
1559 return; | |
1560 } | |
1561 | |
1562 if (XINT (Flength (CONSOLE_DEVICE_LIST (con))) == 1) | |
1563 { | |
1564 va_run_hook_with_args (Qdelete_console_hook, 1, console); | |
1565 if (!FRAME_LIVE_P (f)) /* Make sure the delete-console-hook didn't */ | |
1566 { /* go ahead and delete anything. */ | |
1567 UNGCPRO; | |
1568 return; | |
1569 } | |
1570 } | |
1571 } | |
1572 | |
1573 minibuffer_selected = EQ (minibuf_window, Fselected_window (Qnil)); | |
1574 | |
1575 /* If we were focused on this frame, then we're not any more. | |
1576 Assume that we lost the focus; that way, the call to | |
1577 Fselect_frame() below won't end up making us explicitly | |
1578 focus on another frame, which is generally undesirable in | |
1579 a point-to-type world. If our mouse ends up sitting over | |
1580 another frame, we will receive a FocusIn event and end up | |
1581 making that frame the selected frame. | |
1582 | |
1583 #### This may not be an ideal solution in a click-to-type | |
1584 world (in that case, we might want to explicitly choose | |
1585 another frame to have the focus, rather than relying on | |
1586 the WM, which might focus on a frame in a different app | |
1587 or focus on nothing at all). But there's no easy way | |
1588 to detect which focus model we're running on, and the | |
1589 alternative is more heinous. */ | |
1590 | |
1591 if (EQ (frame, DEVICE_FRAME_WITH_FOCUS_REAL (d))) | |
1592 DEVICE_FRAME_WITH_FOCUS_REAL (d) = Qnil; | |
1593 if (EQ (frame, DEVICE_FRAME_WITH_FOCUS_FOR_HOOKS (d))) | |
1594 DEVICE_FRAME_WITH_FOCUS_FOR_HOOKS (d) = Qnil; | |
1595 if (EQ (frame, DEVICE_FRAME_THAT_OUGHT_TO_HAVE_FOCUS (d))) | |
1596 DEVICE_FRAME_THAT_OUGHT_TO_HAVE_FOCUS (d) = Qnil; | |
1597 | |
1598 /* Don't allow the deleted frame to remain selected. | |
1599 Note that in the former scheme of things, this would | |
1600 have caused us to regain the focus. This no longer | |
1601 applies (see above); I think the new behavior is more | |
1602 logical. If someone disagrees, it can always be | |
1603 changed (or a new user variable can be introduced, ugh.) */ | |
1604 if (EQ (frame, DEVICE_SELECTED_FRAME (d))) | |
1605 { | |
1606 Lisp_Object next; | |
1607 | |
1608 /* If this is a popup frame, select its parent if possible. | |
1609 Otherwise, find another visible frame; if none, just take any frame. | |
4207 | 1610 First try the same device, then the same console. */ |
428 | 1611 |
1612 next = DEVMETH_OR_GIVEN (d, get_frame_parent, (f), Qnil); | |
1613 if (NILP (next) || EQ (next, frame) || ! FRAME_LIVE_P (XFRAME (next))) | |
442 | 1614 next = next_frame (frame, Qvisible, device); |
428 | 1615 if (NILP (next) || EQ (next, frame)) |
442 | 1616 next = next_frame (frame, Qvisible, console); |
1617 if (NILP (next) || EQ (next, frame)) | |
1618 next = next_frame (frame, Qvisible, Qt); | |
428 | 1619 if (NILP (next) || EQ (next, frame)) |
442 | 1620 next = next_frame (frame, Qt, device); |
428 | 1621 if (NILP (next) || EQ (next, frame)) |
442 | 1622 next = next_frame (frame, Qt, console); |
428 | 1623 if (NILP (next) || EQ (next, frame)) |
442 | 1624 next = next_frame (frame, Qt, Qt); |
428 | 1625 |
1626 /* if we haven't found another frame at this point | |
1627 then there aren't any. */ | |
1628 if (NILP (next) || EQ (next, frame)) | |
1629 ; | |
1630 else | |
1631 { | |
1632 int did_select = 0; | |
1633 /* if this is the global selected frame, select another one. */ | |
1634 if (EQ (frame, Fselected_frame (Qnil))) | |
1635 { | |
1636 Fselect_frame (next); | |
1637 did_select = 1; | |
1638 } | |
1639 /* | |
1640 * If the new frame we just selected is on a different | |
1641 * device then we still need to change DEVICE_SELECTED_FRAME(d) | |
1642 * to a live frame, if there are any left on this device. | |
1643 */ | |
1644 if (!EQ (device, FRAME_DEVICE(XFRAME(next)))) | |
1645 { | |
442 | 1646 Lisp_Object next_f = next_frame (frame, Qt, device); |
428 | 1647 if (NILP (next_f) || EQ (next_f, frame)) |
440 | 1648 set_device_selected_frame (d, Qnil); |
428 | 1649 else |
1650 set_device_selected_frame (d, next_f); | |
1651 } | |
1652 else if (! did_select) | |
1653 set_device_selected_frame (d, next); | |
1654 | |
1655 } | |
1656 } | |
1657 | |
1658 /* Don't allow minibuf_window to remain on a deleted frame. */ | |
1659 if (EQ (f->minibuffer_window, minibuf_window)) | |
1660 { | |
1661 struct frame *sel_frame = selected_frame (); | |
1662 Fset_window_buffer (sel_frame->minibuffer_window, | |
440 | 1663 XWINDOW (minibuf_window)->buffer, Qt); |
428 | 1664 minibuf_window = sel_frame->minibuffer_window; |
1665 | |
1666 /* If the dying minibuffer window was selected, | |
1667 select the new one. */ | |
1668 if (minibuffer_selected) | |
1669 Fselect_window (minibuf_window, Qnil); | |
1670 } | |
1671 | |
1672 /* After this point, no errors must be allowed to occur. */ | |
1673 | |
1313 | 1674 /* Checking for QUIT can run all sorts of weird code and may be deadly |
1675 so don't let it happen. */ | |
1676 depth = begin_dont_check_for_quit (); | |
1677 | |
428 | 1678 #ifdef HAVE_MENUBARS |
1679 free_frame_menubars (f); | |
1680 #endif | |
1681 #ifdef HAVE_SCROLLBARS | |
1682 free_frame_scrollbars (f); | |
1683 #endif | |
1684 #ifdef HAVE_TOOLBARS | |
1685 free_frame_toolbars (f); | |
1686 #endif | |
1687 free_frame_gutters (f); | |
442 | 1688 /* Unfortunately deleting the frame will also delete the parent of |
1689 all of the subwindow instances current on the frame. I think this | |
1690 can lead to bad things when trying to finalize the | |
1691 instances. Thus we loop over all instance caches calling the | |
1692 finalize method for each instance. */ | |
1693 free_frame_subwindow_instances (f); | |
428 | 1694 |
1695 /* This must be done before the window and window_mirror structures | |
1696 are freed. The scrollbar information is attached to them. */ | |
1697 MAYBE_FRAMEMETH (f, delete_frame, (f)); | |
1698 | |
1699 /* Mark all the windows that used to be on FRAME as deleted, and then | |
1700 remove the reference to them. */ | |
1701 delete_all_subwindows (XWINDOW (f->root_window)); | |
1702 f->root_window = Qnil; | |
1703 | |
1704 /* clear out the cached glyph information */ | |
442 | 1705 f->subwindow_instance_cache = Qnil; |
428 | 1706 |
1707 /* Remove the frame now from the list. This way, any events generated | |
1708 on this frame by the maneuvers below will disperse themselves. */ | |
1709 | |
1710 /* This used to be Fdelq(), but that will cause a seg fault if the | |
1711 QUIT checker happens to get invoked, because the frame list is in | |
1712 an inconsistent state. */ | |
1713 d->frame_list = delq_no_quit (frame, d->frame_list); | |
1714 RESET_CHANGED_SET_FLAGS; | |
1715 | |
1716 f->visible = 0; | |
1717 | |
617 | 1718 free_window_mirror (XWINDOW_MIRROR (f->root_mirror)); |
853 | 1719 |
428 | 1720 /* free_line_insertion_deletion_costs (f); */ |
1721 | |
1722 /* If we've deleted the last non-minibuf frame, then try to find | |
1723 another one. */ | |
1724 if (EQ (frame, CONSOLE_LAST_NONMINIBUF_FRAME (con))) | |
1725 { | |
1726 Lisp_Object frmcons, devcons; | |
1727 | |
1728 set_console_last_nonminibuf_frame (con, Qnil); | |
1729 | |
1730 CONSOLE_FRAME_LOOP_NO_BREAK (frmcons, devcons, con) | |
1731 { | |
1732 Lisp_Object ecran = XCAR (frmcons); | |
1733 if (!FRAME_MINIBUF_ONLY_P (XFRAME (ecran))) | |
1734 { | |
1735 set_console_last_nonminibuf_frame (con, ecran); | |
1736 goto double_break_1; | |
1737 } | |
1738 } | |
1739 } | |
1740 double_break_1: | |
1741 | |
1742 #if 0 | |
1743 /* The following test is degenerate FALSE */ | |
1744 if (called_from_delete_device < 0) | |
1745 /* then we're being called from delete-console, and we shouldn't | |
1746 try to find another default-minibuffer frame for the console. | |
1747 */ | |
1748 con->default_minibuffer_frame = Qnil; | |
1749 #endif | |
1750 | |
1751 /* If we've deleted this console's default_minibuffer_frame, try to | |
1752 find another one. Prefer minibuffer-only frames, but also notice | |
1753 frames with other windows. */ | |
1754 if (EQ (frame, con->default_minibuffer_frame)) | |
1755 { | |
1756 Lisp_Object frmcons, devcons; | |
1757 /* The last frame we saw with a minibuffer, minibuffer-only or not. */ | |
1758 Lisp_Object frame_with_minibuf; | |
1759 /* Some frame we found on the same console, or nil if there are none. */ | |
1760 Lisp_Object frame_on_same_console; | |
1761 | |
1762 frame_on_same_console = Qnil; | |
1763 frame_with_minibuf = Qnil; | |
1764 | |
1765 set_console_last_nonminibuf_frame (con, Qnil); | |
1766 | |
1767 CONSOLE_FRAME_LOOP_NO_BREAK (frmcons, devcons, con) | |
1768 { | |
2552 | 1769 Lisp_Object this_frame; |
428 | 1770 struct frame *f1; |
1771 | |
2552 | 1772 this_frame = XCAR (frmcons); |
1773 f1 = XFRAME (this_frame); | |
428 | 1774 |
1775 /* Consider only frames on the same console | |
1776 and only those with minibuffers. */ | |
1777 if (FRAME_HAS_MINIBUF_P (f1)) | |
1778 { | |
2552 | 1779 frame_with_minibuf = this_frame; |
428 | 1780 if (FRAME_MINIBUF_ONLY_P (f1)) |
1781 goto double_break_2; | |
1782 } | |
1783 | |
2552 | 1784 frame_on_same_console = this_frame; |
428 | 1785 } |
1786 double_break_2: | |
1787 | |
1788 if (!NILP (frame_on_same_console)) | |
1789 { | |
1790 /* We know that there must be some frame with a minibuffer out | |
1791 there. If this were not true, all of the frames present | |
1792 would have to be minibuffer-less, which implies that at some | |
1793 point their minibuffer frames must have been deleted, but | |
1794 that is prohibited at the top; you can't delete surrogate | |
1795 minibuffer frames. */ | |
1796 if (NILP (frame_with_minibuf)) | |
2500 | 1797 ABORT (); |
428 | 1798 |
1799 con->default_minibuffer_frame = frame_with_minibuf; | |
1800 } | |
1801 else | |
1802 /* No frames left on this console--say no minibuffer either. */ | |
1803 con->default_minibuffer_frame = Qnil; | |
1804 } | |
1805 | |
617 | 1806 /* Nobody should be accessing anything in this object any more, and |
1807 making all Lisp_Objects Qnil allows for better GC'ing in case a | |
1808 pointer to the dead frame continues to hang around. Zero all | |
1809 other structs in case someone tries to access something through | |
1810 them. */ | |
1811 | |
1812 nuke_all_frame_slots (f); | |
428 | 1813 f->framemeths = dead_console_methods; |
1204 | 1814 f->frametype = dead_console; |
617 | 1815 |
853 | 1816 note_object_deleted (frame); |
1817 | |
1313 | 1818 unbind_to (depth); |
1819 | |
428 | 1820 UNGCPRO; |
1821 } | |
1822 | |
1823 void | |
1824 io_error_delete_frame (Lisp_Object frame) | |
1825 { | |
1826 delete_frame_internal (XFRAME (frame), 1, 0, 1); | |
1827 } | |
1828 | |
1829 DEFUN ("delete-frame", Fdelete_frame, 0, 2, "", /* | |
1830 Delete FRAME, permanently eliminating it from use. | |
1831 If omitted, FRAME defaults to the selected frame. | |
1832 A frame may not be deleted if its minibuffer is used by other frames. | |
1833 Normally, you cannot delete the last non-minibuffer-only frame (you must | |
1834 use `save-buffers-kill-emacs' or `kill-emacs'). However, if optional | |
1835 second argument FORCE is non-nil, you can delete the last frame. (This | |
1836 will automatically call `save-buffers-kill-emacs'.) | |
1837 */ | |
1838 (frame, force)) | |
1839 { | |
1840 /* This function can GC */ | |
1841 struct frame *f; | |
1842 | |
1843 if (NILP (frame)) | |
1844 { | |
1845 f = selected_frame (); | |
793 | 1846 frame = wrap_frame (f); |
428 | 1847 } |
1848 else | |
1849 { | |
1850 CHECK_FRAME (frame); | |
1851 f = XFRAME (frame); | |
1852 } | |
1853 | |
1854 delete_frame_internal (f, !NILP (force), 0, 0); | |
1855 return Qnil; | |
1856 } | |
1857 | |
1858 | |
1859 /* Return mouse position in character cell units. */ | |
1860 | |
1861 static int | |
1862 mouse_pixel_position_1 (struct device *d, Lisp_Object *frame, | |
1863 int *x, int *y) | |
1864 { | |
1865 switch (DEVMETH_OR_GIVEN (d, get_mouse_position, (d, frame, x, y), -1)) | |
1866 { | |
1867 case 1: | |
1868 return 1; | |
1869 | |
1870 case 0: | |
1871 *frame = Qnil; | |
1872 break; | |
1873 | |
1874 case -1: | |
1875 *frame = DEVICE_SELECTED_FRAME (d); | |
1876 break; | |
1877 | |
1878 default: | |
2500 | 1879 ABORT (); /* method is incorrectly written */ |
428 | 1880 } |
1881 | |
1882 return 0; | |
1883 } | |
1884 | |
1885 DEFUN ("mouse-pixel-position", Fmouse_pixel_position, 0, 1, 0, /* | |
1886 Return a list (WINDOW X . Y) giving the current mouse window and position. | |
442 | 1887 The position is given in pixel units, where (0, 0) is the upper-left corner |
1888 of the window. | |
428 | 1889 |
1890 When the cursor is not over a window, the return value is a list (nil nil). | |
1891 | |
1892 DEVICE specifies the device on which to read the mouse position, and | |
1893 defaults to the selected device. If the device is a mouseless terminal | |
442 | 1894 or XEmacs hasn't been programmed to read its mouse position, it returns |
428 | 1895 the device's selected window for WINDOW and nil for X and Y. |
1896 */ | |
1897 (device)) | |
1898 { | |
1899 struct device *d = decode_device (device); | |
1900 Lisp_Object frame; | |
1901 Lisp_Object window = Qnil; | |
1902 Lisp_Object x = Qnil; | |
1903 Lisp_Object y = Qnil; | |
1904 int intx, inty; | |
1905 | |
1906 if (mouse_pixel_position_1 (d, &frame, &intx, &inty) > 0) | |
1907 { | |
1908 struct window *w = | |
1909 find_window_by_pixel_pos (intx, inty, XFRAME (frame)->root_window); | |
1910 if (w) | |
1911 { | |
793 | 1912 window = wrap_window (w); |
428 | 1913 |
1914 /* Adjust the position to be relative to the window. */ | |
1915 intx -= w->pixel_left; | |
1916 inty -= w->pixel_top; | |
793 | 1917 x = make_int (intx); |
1918 y = make_int (inty); | |
428 | 1919 } |
1920 } | |
1921 else if (FRAMEP (frame)) | |
1922 window = FRAME_SELECTED_WINDOW (XFRAME (frame)); | |
1923 | |
1924 return Fcons (window, Fcons (x, y)); | |
1925 } | |
1926 | |
1927 DEFUN ("mouse-position", Fmouse_position, 0, 1, 0, /* | |
1928 Return a list (WINDOW X . Y) giving the current mouse window and position. | |
1929 The position is of a character under cursor, where (0, 0) is the upper-left | |
1930 corner of the window. | |
1931 | |
1932 When the cursor is not over a character, or not over a window, the return | |
1933 value is a list (nil nil). | |
1934 | |
1935 DEVICE specifies the device on which to read the mouse position, and | |
1936 defaults to the selected device. If the device is a mouseless terminal | |
1937 or Emacs hasn't been programmed to read its mouse position, it returns | |
1938 the device's selected window for WINDOW and nil for X and Y. | |
1939 */ | |
1940 (device)) | |
1941 { | |
1942 struct device *d = decode_device (device); | |
1943 struct window *w; | |
1944 Lisp_Object frame, window = Qnil, lisp_x = Qnil, lisp_y = Qnil; | |
1945 int x, y, obj_x, obj_y; | |
665 | 1946 Charbpos charbpos, closest; |
428 | 1947 Charcount modeline_closest; |
1948 Lisp_Object obj1, obj2; | |
1949 | |
1950 if (mouse_pixel_position_1 (d, &frame, &x, &y) > 0) | |
1951 { | |
1952 int res = pixel_to_glyph_translation (XFRAME (frame), x, y, &x, &y, | |
665 | 1953 &obj_x, &obj_y, &w, &charbpos, |
428 | 1954 &closest, &modeline_closest, |
1955 &obj1, &obj2); | |
1956 if (res == OVER_TEXT) | |
1957 { | |
1958 lisp_x = make_int (x); | |
1959 lisp_y = make_int (y); | |
793 | 1960 window = wrap_window (w); |
428 | 1961 } |
1962 } | |
1963 else if (FRAMEP (frame)) | |
1964 window = FRAME_SELECTED_WINDOW (XFRAME (frame)); | |
1965 | |
1966 return Fcons (window, Fcons (lisp_x, lisp_y)); | |
1967 } | |
1968 | |
1969 DEFUN ("mouse-position-as-motion-event", Fmouse_position_as_motion_event, 0, 1, 0, /* | |
1970 Return the current mouse position as a motion event. | |
1971 This allows you to call the standard event functions such as | |
1972 `event-over-toolbar-p' to determine where the mouse is. | |
1973 | |
1974 DEVICE specifies the device on which to read the mouse position, and | |
1975 defaults to the selected device. If the mouse position can't be determined | |
1976 \(e.g. DEVICE is a TTY device), nil is returned instead of an event. | |
1977 */ | |
1978 (device)) | |
1979 { | |
1980 struct device *d = decode_device (device); | |
1981 Lisp_Object frame; | |
1982 int intx, inty; | |
1983 | |
1984 if (mouse_pixel_position_1 (d, &frame, &intx, &inty)) | |
1985 { | |
1986 Lisp_Object event = Fmake_event (Qnil, Qnil); | |
934 | 1987 XSET_EVENT_TYPE (event, pointer_motion_event); |
1988 XSET_EVENT_CHANNEL (event, frame); | |
1204 | 1989 XSET_EVENT_MOTION_X (event, intx); |
1990 XSET_EVENT_MOTION_Y (event, inty); | |
428 | 1991 return event; |
1992 } | |
1993 else | |
1994 return Qnil; | |
1995 } | |
1996 | |
1997 DEFUN ("set-mouse-position", Fset_mouse_position, 3, 3, 0, /* | |
1998 Move the mouse pointer to the center of character cell (X,Y) in WINDOW. | |
1999 Note, this is a no-op for an X frame that is not visible. | |
2000 If you have just created a frame, you must wait for it to become visible | |
2001 before calling this function on it, like this. | |
2002 (while (not (frame-visible-p frame)) (sleep-for .5)) | |
2003 Note also: Warping the mouse is contrary to the ICCCM, so be very sure | |
2004 that the behavior won't end up being obnoxious! | |
2005 */ | |
2006 (window, x, y)) | |
2007 { | |
2008 struct window *w; | |
2009 int pix_x, pix_y; | |
2010 | |
2011 CHECK_LIVE_WINDOW (window); | |
2012 CHECK_INT (x); | |
2013 CHECK_INT (y); | |
2014 | |
2015 /* Warping the mouse will cause EnterNotify and Focus events under X. */ | |
2016 w = XWINDOW (window); | |
2017 glyph_to_pixel_translation (w, XINT (x), XINT (y), &pix_x, &pix_y); | |
2018 | |
2019 MAYBE_FRAMEMETH (XFRAME (w->frame), set_mouse_position, (w, pix_x, pix_y)); | |
2020 | |
2021 return Qnil; | |
2022 } | |
2023 | |
2024 DEFUN ("set-mouse-pixel-position", Fset_mouse_pixel_position, 3, 3, 0, /* | |
2025 Move the mouse pointer to pixel position (X,Y) in WINDOW. | |
2026 Note, this is a no-op for an X frame that is not visible. | |
2027 If you have just created a frame, you must wait for it to become visible | |
2028 before calling this function on it, like this. | |
2029 (while (not (frame-visible-p frame)) (sleep-for .5)) | |
2030 */ | |
2031 (window, x, y)) | |
2032 { | |
2033 struct window *w; | |
2034 | |
2035 CHECK_LIVE_WINDOW (window); | |
2036 CHECK_INT (x); | |
2037 CHECK_INT (y); | |
2038 | |
2039 /* Warping the mouse will cause EnterNotify and Focus events under X. */ | |
2040 w = XWINDOW (window); | |
2041 FRAMEMETH (XFRAME (w->frame), set_mouse_position, (w, XINT (x), XINT (y))); | |
2042 | |
2043 return Qnil; | |
2044 } | |
2045 | |
2046 DEFUN ("make-frame-visible", Fmake_frame_visible, 0, 1, 0, /* | |
2047 Make the frame FRAME visible (assuming it is an X-window). | |
2048 If omitted, FRAME defaults to the currently selected frame. | |
2049 Also raises the frame so that nothing obscures it. | |
2050 */ | |
2051 (frame)) | |
2052 { | |
2053 struct frame *f = decode_frame (frame); | |
2054 | |
2055 MAYBE_FRAMEMETH (f, make_frame_visible, (f)); | |
2056 return frame; | |
2057 } | |
2058 | |
2059 DEFUN ("make-frame-invisible", Fmake_frame_invisible, 0, 2, 0, /* | |
2060 Unconditionally removes frame from the display (assuming it is an X-window). | |
2061 If omitted, FRAME defaults to the currently selected frame. | |
2062 If what you want to do is iconify the frame (if the window manager uses | |
2063 icons) then you should call `iconify-frame' instead. | |
2064 Normally you may not make FRAME invisible if all other frames are invisible | |
2065 and uniconified, but if the second optional argument FORCE is non-nil, | |
2066 you may do so. | |
2067 */ | |
2068 (frame, force)) | |
2069 { | |
2070 struct frame *f, *sel_frame; | |
2071 struct device *d; | |
2072 | |
2073 f = decode_frame (frame); | |
2074 d = XDEVICE (FRAME_DEVICE (f)); | |
2075 sel_frame = XFRAME (DEVICE_SELECTED_FRAME (d)); | |
2076 | |
2077 if (NILP (force) && !other_visible_frames (f)) | |
563 | 2078 invalid_operation ("Attempt to make invisible the sole visible or iconified frame", Qunbound); |
428 | 2079 |
2080 /* Don't allow minibuf_window to remain on a deleted frame. */ | |
2081 if (EQ (f->minibuffer_window, minibuf_window)) | |
2082 { | |
2083 Fset_window_buffer (sel_frame->minibuffer_window, | |
440 | 2084 XWINDOW (minibuf_window)->buffer, Qt); |
428 | 2085 minibuf_window = sel_frame->minibuffer_window; |
2086 } | |
2087 | |
2088 MAYBE_FRAMEMETH (f, make_frame_invisible, (f)); | |
2089 | |
2090 return Qnil; | |
2091 } | |
2092 | |
2093 DEFUN ("iconify-frame", Ficonify_frame, 0, 1, "", /* | |
2094 Make the frame FRAME into an icon, if the window manager supports icons. | |
2095 If omitted, FRAME defaults to the currently selected frame. | |
2096 */ | |
2097 (frame)) | |
2098 { | |
2099 struct frame *f, *sel_frame; | |
2100 struct device *d; | |
2101 | |
2102 f = decode_frame (frame); | |
2103 d = XDEVICE (FRAME_DEVICE (f)); | |
2104 sel_frame = XFRAME (DEVICE_SELECTED_FRAME (d)); | |
2105 | |
2106 /* Don't allow minibuf_window to remain on a deleted frame. */ | |
2107 if (EQ (f->minibuffer_window, minibuf_window)) | |
2108 { | |
2109 Fset_window_buffer (sel_frame->minibuffer_window, | |
440 | 2110 XWINDOW (minibuf_window)->buffer, Qt); |
428 | 2111 minibuf_window = sel_frame->minibuffer_window; |
2112 } | |
2113 | |
2114 MAYBE_FRAMEMETH (f, iconify_frame, (f)); | |
2115 | |
2116 return Qnil; | |
2117 } | |
2118 | |
2119 DEFUN ("deiconify-frame", Fdeiconify_frame, 0, 1, 0, /* | |
2120 Open (de-iconify) the iconified frame FRAME. | |
2121 Under X, this is currently the same as `make-frame-visible'. | |
2122 If omitted, FRAME defaults to the currently selected frame. | |
2123 Also raises the frame so that nothing obscures it. | |
2124 */ | |
2125 (frame)) | |
2126 { | |
2127 return Fmake_frame_visible (frame); | |
2128 } | |
2129 | |
3025 | 2130 /* FSF returns `icon' for iconized frames. What a crock! */ |
428 | 2131 |
2132 DEFUN ("frame-visible-p", Fframe_visible_p, 0, 1, 0, /* | |
2133 Return non NIL if FRAME is now "visible" (actually in use for display). | |
2134 A frame that is not visible is not updated, and, if it works through a | |
2135 window system, may not show at all. | |
2136 N.B. Under X "visible" means Mapped. It the window is mapped but not | |
3025 | 2137 actually visible on screen then `frame-visible-p' returns `hidden'. |
428 | 2138 */ |
2139 (frame)) | |
2140 { | |
2141 struct frame *f = decode_frame (frame); | |
2142 int visible = FRAMEMETH_OR_GIVEN (f, frame_visible_p, (f), f->visible); | |
2143 return visible ? ( visible > 0 ? Qt : Qhidden ) : Qnil; | |
2144 } | |
2145 | |
2146 DEFUN ("frame-totally-visible-p", Fframe_totally_visible_p, 0, 1, 0, /* | |
2147 Return t if frame is not obscured by any other window system windows. | |
2148 Always returns t for tty frames. | |
2149 */ | |
2150 (frame)) | |
2151 { | |
2152 struct frame *f = decode_frame (frame); | |
2153 return (FRAMEMETH_OR_GIVEN (f, frame_totally_visible_p, (f), f->visible) | |
2154 ? Qt : Qnil); | |
2155 } | |
2156 | |
2157 DEFUN ("frame-iconified-p", Fframe_iconified_p, 0, 1, 0, /* | |
2158 Return t if FRAME is iconified. | |
2159 Not all window managers use icons; some merely unmap the window, so this | |
2160 function is not the inverse of `frame-visible-p'. It is possible for a | |
2161 frame to not be visible and not be iconified either. However, if the | |
2162 frame is iconified, it will not be visible. | |
2163 */ | |
2164 (frame)) | |
2165 { | |
2166 struct frame *f = decode_frame (frame); | |
2167 if (f->visible) | |
2168 return Qnil; | |
2169 f->iconified = FRAMEMETH_OR_GIVEN (f, frame_iconified_p, (f), 0); | |
2170 return f->iconified ? Qt : Qnil; | |
2171 } | |
2172 | |
2173 DEFUN ("visible-frame-list", Fvisible_frame_list, 0, 1, 0, /* | |
2174 Return a list of all frames now "visible" (being updated). | |
2175 If DEVICE is specified only frames on that device will be returned. | |
460 | 2176 Note that under virtual window managers not all these frames are |
2177 necessarily really updated. | |
428 | 2178 */ |
2179 (device)) | |
2180 { | |
2181 Lisp_Object devcons, concons; | |
2182 struct frame *f; | |
2183 Lisp_Object value; | |
2184 | |
2185 value = Qnil; | |
2186 | |
2187 DEVICE_LOOP_NO_BREAK (devcons, concons) | |
2188 { | |
2189 assert (DEVICEP (XCAR (devcons))); | |
2190 | |
2191 if (NILP (device) || EQ (device, XCAR (devcons))) | |
2192 { | |
2193 Lisp_Object frmcons; | |
2194 | |
2195 DEVICE_FRAME_LOOP (frmcons, XDEVICE (XCAR (devcons))) | |
2196 { | |
2197 Lisp_Object frame = XCAR (frmcons); | |
2198 f = XFRAME (frame); | |
2199 if (FRAME_VISIBLE_P(f)) | |
2200 value = Fcons (frame, value); | |
2201 } | |
2202 } | |
2203 } | |
2204 | |
2205 return value; | |
2206 } | |
2207 | |
2208 | |
2209 DEFUN ("raise-frame", Fraise_frame, 0, 1, "", /* | |
2210 Bring FRAME to the front, so it occludes any frames it overlaps. | |
2211 If omitted, FRAME defaults to the currently selected frame. | |
2212 If FRAME is invisible, make it visible. | |
2213 If Emacs is displaying on an ordinary terminal or some other device which | |
2214 doesn't support multiple overlapping frames, this function does nothing. | |
2215 */ | |
2216 (frame)) | |
2217 { | |
2218 struct frame *f = decode_frame (frame); | |
2219 | |
2220 /* Do like the documentation says. */ | |
2221 Fmake_frame_visible (frame); | |
2222 MAYBE_FRAMEMETH (f, raise_frame, (f)); | |
2223 return Qnil; | |
2224 } | |
2225 | |
2226 DEFUN ("lower-frame", Flower_frame, 0, 1, "", /* | |
2227 Send FRAME to the back, so it is occluded by any frames that overlap it. | |
2228 If omitted, FRAME defaults to the currently selected frame. | |
2229 If Emacs is displaying on an ordinary terminal or some other device which | |
2230 doesn't support multiple overlapping frames, this function does nothing. | |
2231 */ | |
2232 (frame)) | |
2233 { | |
2234 struct frame *f = decode_frame (frame); | |
2235 | |
2236 MAYBE_FRAMEMETH (f, lower_frame, (f)); | |
2237 return Qnil; | |
2238 } | |
2239 | |
442 | 2240 |
2241 DEFUN ("disable-frame", Fdisable_frame, 1, 1, 0, /* | |
2242 Disable frame FRAME, so that it cannot have the focus or receive user input. | |
2243 This is normally used during modal dialog boxes. | |
2244 WARNING: Be very careful not to wedge XEmacs! | |
2245 Use an `unwind-protect' that re-enables the frame to avoid this. | |
2246 */ | |
2247 (frame)) | |
2248 { | |
2249 struct frame *f = decode_frame (frame); | |
2250 | |
2251 f->disabled = 1; | |
2252 MAYBE_FRAMEMETH (f, disable_frame, (f)); | |
2253 return Qnil; | |
2254 } | |
2255 | |
2256 DEFUN ("enable-frame", Fenable_frame, 1, 1, 0, /* | |
2257 Enable frame FRAME, so that it can have the focus and receive user input. | |
2258 Frames are normally enabled, unless explicitly disabled using `disable-frame'. | |
2259 */ | |
2260 (frame)) | |
2261 { | |
2262 struct frame *f = decode_frame (frame); | |
2263 f->disabled = 0; | |
2264 MAYBE_FRAMEMETH (f, enable_frame, (f)); | |
2265 return Qnil; | |
2266 } | |
2267 | |
428 | 2268 /* Ben thinks there is no need for `redirect-frame-focus' or `frame-focus', |
2269 crockish FSFmacs functions. See summary on focus in event-stream.c. */ | |
442 | 2270 |
2271 DEFUN ("print-job-page-number", Fprint_job_page_number, 1, 1, 0, /* | |
2272 Return current page number for the print job FRAME. | |
2273 */ | |
2274 (frame)) | |
2275 { | |
2276 CHECK_PRINTER_FRAME (frame); | |
2277 return make_int (FRAME_PAGENUMBER (XFRAME (frame))); | |
2278 } | |
2279 | |
2280 DEFUN ("print-job-eject-page", Fprint_job_eject_page, 1, 1, 0, /* | |
2281 Eject page in the print job FRAME. | |
2282 */ | |
2283 (frame)) | |
2284 { | |
2285 struct frame *f; | |
2286 | |
2287 CHECK_PRINTER_FRAME (frame); | |
2288 f = XFRAME (frame); | |
2289 FRAMEMETH (f, eject_page, (f)); | |
2290 FRAME_SET_PAGENUMBER (f, 1 + FRAME_PAGENUMBER (f)); | |
2291 f->clear = 1; | |
2292 | |
2293 return Qnil; | |
2294 } | |
428 | 2295 |
2296 | |
2297 /***************************************************************************/ | |
2298 /* frame properties */ | |
2299 /***************************************************************************/ | |
2300 | |
2301 static void internal_set_frame_size (struct frame *f, int cols, int rows, | |
2302 int pretend); | |
2303 | |
2304 static void | |
2305 store_minibuf_frame_prop (struct frame *f, Lisp_Object val) | |
2306 { | |
1318 | 2307 /* This can call Lisp. */ |
793 | 2308 Lisp_Object frame = wrap_frame (f); |
2309 | |
428 | 2310 if (WINDOWP (val)) |
2311 { | |
2312 if (! MINI_WINDOW_P (XWINDOW (val))) | |
563 | 2313 gui_error |
428 | 2314 ("Surrogate minibuffer windows must be minibuffer windows", |
2315 val); | |
2316 | |
2317 if (FRAME_HAS_MINIBUF_P (f) || FRAME_MINIBUF_ONLY_P (f)) | |
563 | 2318 gui_error |
428 | 2319 ("Can't change the surrogate minibuffer of a frame with its own minibuffer", frame); |
2320 | |
2321 /* Install the chosen minibuffer window, with proper buffer. */ | |
2322 f->minibuffer_window = val; | |
2323 } | |
2324 else if (EQ (val, Qt)) | |
2325 { | |
2326 if (FRAME_HAS_MINIBUF_P (f) || FRAME_MINIBUF_ONLY_P (f)) | |
563 | 2327 gui_error |
428 | 2328 ("Frame already has its own minibuffer", frame); |
2329 else | |
2330 { | |
2331 setup_normal_frame (f); | |
2332 f->mirror_dirty = 1; | |
2333 | |
2334 update_frame_window_mirror (f); | |
2335 internal_set_frame_size (f, f->width, f->height, 1); | |
2336 } | |
2337 } | |
2338 } | |
2339 | |
2340 #if 0 | |
2341 | |
2342 /* possible code if you want to have symbols such as `default-background' | |
2343 map to setting the background of `default', etc. */ | |
2344 | |
2345 static int | |
2346 dissect_as_face_setting (Lisp_Object sym, Lisp_Object *face_out, | |
2347 Lisp_Object *face_prop_out) | |
2348 { | |
2349 Lisp_Object list = Vbuilt_in_face_specifiers; | |
793 | 2350 Lisp_Object s; |
428 | 2351 |
2352 if (!SYMBOLP (sym)) | |
2353 return 0; | |
2354 | |
2355 s = symbol_name (XSYMBOL (sym)); | |
2356 | |
2357 while (!NILP (list)) | |
2358 { | |
2359 Lisp_Object prop = Fcar (list); | |
793 | 2360 Lisp_Object prop_name; |
428 | 2361 |
2362 if (!SYMBOLP (prop)) | |
2363 continue; | |
2364 prop_name = symbol_name (XSYMBOL (prop)); | |
793 | 2365 if (XSTRING_LENGTH (s) > XSTRING_LENGTH (prop_name) + 1 |
2366 && !memcmp (XSTRING_DATA (prop_name), | |
2367 XSTRING_DATA (s) + XSTRING_LENGTH (s) | |
2368 - XSTRING_LENGTH (prop_name), | |
2369 XSTRING_LENGTH (prop_name)) | |
2370 && XSTRING_DATA (s)[XSTRING_LENGTH (s) - XSTRING_LENGTH (prop_name) | |
428 | 2371 - 1] == '-') |
2372 { | |
2373 Lisp_Object face = | |
793 | 2374 Ffind_face (make_string (XSTRING_DATA (s), |
2375 XSTRING_LENGTH (s) | |
2376 - XSTRING_LENGTH (prop_name) | |
428 | 2377 - 1)); |
2378 if (!NILP (face)) | |
2379 { | |
2380 *face_out = face; | |
2381 *face_prop_out = prop; | |
2382 return 1; | |
2383 } | |
2384 } | |
2385 | |
2386 list = Fcdr (list); | |
2387 } | |
2388 | |
2389 return 0; | |
2390 } | |
2391 | |
2392 #endif /* 0 */ | |
2393 | |
2394 static Lisp_Object | |
2395 get_property_alias (Lisp_Object prop) | |
2396 { | |
2397 while (1) | |
2398 { | |
2399 Lisp_Object alias = Qnil; | |
2400 | |
2401 if (SYMBOLP (prop)) | |
2402 alias = Fget (prop, Qframe_property_alias, Qnil); | |
2403 if (NILP (alias)) | |
2404 break; | |
2405 prop = alias; | |
2406 QUIT; | |
2407 } | |
2408 | |
2409 return prop; | |
2410 } | |
2411 | |
2412 /* #### Using this to modify the internal border width has no effect | |
2413 because the change isn't propagated to the windows. Are there | |
2414 other properties which this claims to handle, but doesn't? | |
2415 | |
2416 But of course. This stuff needs more work, but it's a lot closer | |
2417 to sanity now than before with the horrible frame-params stuff. */ | |
2418 | |
2419 DEFUN ("set-frame-properties", Fset_frame_properties, 2, 2, 0, /* | |
2420 Change some properties of a frame. | |
2421 PLIST is a property list. | |
2422 You can also change frame properties individually using `set-frame-property', | |
2423 but it may be more efficient to change many properties at once. | |
2424 | |
2425 Frame properties can be retrieved using `frame-property' or `frame-properties'. | |
2426 | |
2427 The following symbols etc. have predefined meanings: | |
2428 | |
2429 name Name of the frame. Used with X resources. | |
2430 Unchangeable after creation. | |
2431 | |
2432 height Height of the frame, in lines. | |
2433 | |
2434 width Width of the frame, in characters. | |
2435 | |
2436 minibuffer Gives the minibuffer behavior for this frame. Either | |
2437 t (frame has its own minibuffer), `only' (frame is | |
442 | 2438 a minibuffer-only frame), `none' (frame has no minibuffer) |
2439 or a window (frame uses that window, which is on another | |
2440 frame, as the minibuffer). | |
428 | 2441 |
2442 unsplittable If non-nil, frame cannot be split by `display-buffer'. | |
2443 | |
2444 current-display-table, menubar-visible-p, left-margin-width, | |
2445 right-margin-width, minimum-line-ascent, minimum-line-descent, | |
2446 use-left-overflow, use-right-overflow, scrollbar-width, scrollbar-height, | |
2447 default-toolbar, top-toolbar, bottom-toolbar, left-toolbar, right-toolbar, | |
2448 default-toolbar-height, default-toolbar-width, top-toolbar-height, | |
2449 bottom-toolbar-height, left-toolbar-width, right-toolbar-width, | |
2450 default-toolbar-visible-p, top-toolbar-visible-p, bottom-toolbar-visible-p, | |
2451 left-toolbar-visible-p, right-toolbar-visible-p, toolbar-buttons-captioned-p, | |
2452 top-toolbar-border-width, bottom-toolbar-border-width, | |
2453 left-toolbar-border-width, right-toolbar-border-width, | |
442 | 2454 modeline-shadow-thickness, has-modeline-p, |
2455 default-gutter, top-gutter, bottom-gutter, left-gutter, right-gutter, | |
2456 default-gutter-height, default-gutter-width, top-gutter-height, | |
2457 bottom-gutter-height, left-gutter-width, right-gutter-width, | |
2458 default-gutter-visible-p, top-gutter-visible-p, bottom-gutter-visible-p, | |
2459 left-gutter-visible-p, right-gutter-visible-p, top-gutter-border-width, | |
2460 bottom-gutter-border-width, left-gutter-border-width, right-gutter-border-width, | |
428 | 2461 [Giving the name of any built-in specifier variable is |
2462 equivalent to calling `set-specifier' on the specifier, | |
2463 with a locale of FRAME. Giving the name to `frame-property' | |
2464 calls `specifier-instance' on the specifier.] | |
2465 | |
2466 text-pointer-glyph, nontext-pointer-glyph, modeline-pointer-glyph, | |
2467 selection-pointer-glyph, busy-pointer-glyph, toolbar-pointer-glyph, | |
2468 menubar-pointer-glyph, scrollbar-pointer-glyph, gc-pointer-glyph, | |
2469 octal-escape-glyph, control-arrow-glyph, invisible-text-glyph, | |
2470 hscroll-glyph, truncation-glyph, continuation-glyph | |
2471 [Giving the name of any glyph variable is equivalent to | |
2472 calling `set-glyph-image' on the glyph, with a locale | |
2473 of FRAME. Giving the name to `frame-property' calls | |
2474 `glyph-image-instance' on the glyph.] | |
2475 | |
2476 [default foreground], [default background], [default font], | |
2477 [modeline foreground], [modeline background], [modeline font], | |
2478 etc. | |
2479 [Giving a vector of a face and a property is equivalent | |
2480 to calling `set-face-property' on the face and property, | |
2481 with a locale of FRAME. Giving the vector to | |
2482 `frame-property' calls `face-property-instance' on the | |
2483 face and property.] | |
2484 | |
2485 Finally, if a frame property symbol has the property `frame-property-alias' | |
2486 on it, then the value will be used in place of that symbol when looking | |
2487 up and setting frame property values. This allows you to alias one | |
2488 frame property name to another. | |
2489 | |
2490 See the variables `default-x-frame-plist', `default-tty-frame-plist' | |
2491 and `default-mswindows-frame-plist' for a description of the properties | |
2492 recognized for particular types of frames. | |
2493 */ | |
2494 (frame, plist)) | |
2495 { | |
1318 | 2496 /* This can call Lisp. */ |
428 | 2497 struct frame *f = decode_frame (frame); |
2498 Lisp_Object tail; | |
2499 Lisp_Object *tailp; | |
2500 struct gcpro gcpro1, gcpro2; | |
2501 | |
793 | 2502 frame = wrap_frame (f); |
428 | 2503 GCPRO2 (frame, plist); |
2504 Fcheck_valid_plist (plist); | |
2505 plist = Fcopy_sequence (plist); | |
2506 Fcanonicalize_lax_plist (plist, Qnil); | |
2507 for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail))) | |
2508 { | |
2509 Lisp_Object prop = Fcar (tail); | |
2510 Lisp_Object val = Fcar (Fcdr (tail)); | |
2511 | |
2512 prop = get_property_alias (prop); | |
2513 | |
2514 #if 0 | |
2515 /* mly wants this, but it's not reasonable to change the name of a | |
2516 frame after it has been created, because the old name was used | |
2517 for resource lookup. */ | |
2518 if (EQ (prop, Qname)) | |
4207 | 2519 { |
2520 CHECK_STRING (val); | |
2521 f->name = val; | |
2522 } | |
428 | 2523 #endif /* 0 */ |
2524 if (EQ (prop, Qminibuffer)) | |
2525 store_minibuf_frame_prop (f, val); | |
2526 if (EQ (prop, Qunsplittable)) | |
2527 f->no_split = !NILP (val); | |
2528 if (EQ (prop, Qbuffer_predicate)) | |
2529 f->buffer_predicate = val; | |
2530 if (SYMBOLP (prop) && EQ (Fbuilt_in_variable_type (prop), | |
2531 Qconst_specifier)) | |
2532 call3 (Qset_specifier, Fsymbol_value (prop), val, frame); | |
2533 if (SYMBOLP (prop) && !NILP (Fget (prop, Qconst_glyph_variable, Qnil))) | |
2534 call3 (Qset_glyph_image, Fsymbol_value (prop), val, frame); | |
2535 if (VECTORP (prop) && XVECTOR_LENGTH (prop) == 2) | |
2536 { | |
2537 Lisp_Object face_prop = XVECTOR_DATA (prop)[1]; | |
2538 CHECK_SYMBOL (face_prop); | |
2539 call4 (Qset_face_property, | |
2540 Fget_face (XVECTOR_DATA (prop)[0]), | |
2541 face_prop, val, frame); | |
2542 } | |
2543 } | |
2544 | |
2545 MAYBE_FRAMEMETH (f, set_frame_properties, (f, plist)); | |
2546 for (tailp = &plist; !NILP (*tailp);) | |
2547 { | |
2548 Lisp_Object *next_tailp; | |
2549 Lisp_Object next; | |
2550 Lisp_Object prop; | |
2551 | |
2552 next = Fcdr (*tailp); | |
2553 CHECK_CONS (next); | |
2554 next_tailp = &XCDR (next); | |
2555 prop = Fcar (*tailp); | |
2556 | |
2557 prop = get_property_alias (prop); | |
2558 | |
2559 if (EQ (prop, Qminibuffer) | |
2560 || EQ (prop, Qunsplittable) | |
2561 || EQ (prop, Qbuffer_predicate) | |
2562 || EQ (prop, Qheight) | |
2563 || EQ (prop, Qwidth) | |
2564 || (SYMBOLP (prop) && EQ (Fbuilt_in_variable_type (prop), | |
2565 Qconst_specifier)) | |
2566 || (SYMBOLP (prop) && !NILP (Fget (prop, Qconst_glyph_variable, | |
2567 Qnil))) | |
2568 || (VECTORP (prop) && XVECTOR_LENGTH (prop) == 2) | |
2569 || FRAMEMETH_OR_GIVEN (f, internal_frame_property_p, (f, prop), 0)) | |
2570 *tailp = *next_tailp; | |
2571 tailp = next_tailp; | |
2572 } | |
2573 | |
2574 f->plist = nconc2 (plist, f->plist); | |
2575 Fcanonicalize_lax_plist (f->plist, Qnil); | |
2576 UNGCPRO; | |
2577 return Qnil; | |
2578 } | |
2579 | |
2580 DEFUN ("frame-property", Fframe_property, 2, 3, 0, /* | |
2581 Return FRAME's value for property PROPERTY. | |
444 | 2582 Return DEFAULT if there is no such property. |
428 | 2583 See `set-frame-properties' for the built-in property names. |
2584 */ | |
2585 (frame, property, default_)) | |
2586 { | |
2587 struct frame *f = decode_frame (frame); | |
2588 Lisp_Object value; | |
2589 | |
793 | 2590 frame = wrap_frame (f); |
428 | 2591 |
2592 property = get_property_alias (property); | |
2593 | |
2594 if (EQ (Qname, property)) return f->name; | |
2595 | |
2596 if (EQ (Qheight, property) || EQ (Qwidth, property)) | |
2597 { | |
2598 if (window_system_pixelated_geometry (frame)) | |
2599 { | |
2600 int width, height; | |
2601 pixel_to_real_char_size (f, FRAME_PIXWIDTH (f), FRAME_PIXHEIGHT (f), | |
2602 &width, &height); | |
2603 return make_int (EQ (Qheight, property) ? height: width); | |
2604 } | |
2605 else | |
2606 return make_int (EQ (Qheight, property) ? | |
2607 FRAME_HEIGHT (f) : | |
2608 FRAME_WIDTH (f)); | |
2609 } | |
2610 | |
2611 /* NOTE: FSF returns Qnil instead of Qt for FRAME_HAS_MINIBUF_P. | |
2612 This is over-the-top bogosity, because it's inconsistent with | |
2613 the semantics of `minibuffer' when passed to `make-frame'. | |
2614 Returning Qt makes things consistent. */ | |
2615 if (EQ (Qminibuffer, property)) | |
2616 return (FRAME_MINIBUF_ONLY_P (f) ? Qonly : | |
2617 FRAME_HAS_MINIBUF_P (f) ? Qt : | |
2618 FRAME_MINIBUF_WINDOW (f)); | |
2619 if (EQ (Qunsplittable, property)) | |
2620 return FRAME_NO_SPLIT_P (f) ? Qt : Qnil; | |
2621 if (EQ (Qbuffer_predicate, property)) | |
2622 return f->buffer_predicate; | |
2623 | |
2624 if (SYMBOLP (property)) | |
2625 { | |
2626 if (EQ (Fbuilt_in_variable_type (property), Qconst_specifier)) | |
2627 return Fspecifier_instance (Fsymbol_value (property), | |
2628 frame, default_, Qnil); | |
2629 if (!NILP (Fget (property, Qconst_glyph_variable, Qnil))) | |
2630 { | |
2631 Lisp_Object glyph = Fsymbol_value (property); | |
2632 CHECK_GLYPH (glyph); | |
2633 return Fspecifier_instance (XGLYPH_IMAGE (glyph), | |
2634 frame, default_, Qnil); | |
2635 } | |
2636 } | |
2637 | |
2638 if (VECTORP (property) && XVECTOR_LENGTH (property) == 2) | |
2639 { | |
2640 Lisp_Object face_prop = XVECTOR_DATA (property)[1]; | |
2641 CHECK_SYMBOL (face_prop); | |
2642 return call3 (Qface_property_instance, | |
2643 Fget_face (XVECTOR_DATA (property)[0]), | |
2644 face_prop, frame); | |
2645 } | |
2646 | |
2647 if (HAS_FRAMEMETH_P (f, frame_property)) | |
2648 if (!UNBOUNDP (value = FRAMEMETH (f, frame_property, (f, property)))) | |
2649 return value; | |
2650 | |
2651 if (!UNBOUNDP (value = external_plist_get (&f->plist, property, 1, ERROR_ME))) | |
2652 return value; | |
2653 | |
2654 return default_; | |
2655 } | |
2656 | |
2657 DEFUN ("frame-properties", Fframe_properties, 0, 1, 0, /* | |
2658 Return a property list of the properties of FRAME. | |
2659 Do not modify this list; use `set-frame-property' instead. | |
2660 */ | |
2661 (frame)) | |
2662 { | |
2663 struct frame *f = decode_frame (frame); | |
2664 Lisp_Object result = Qnil; | |
2665 struct gcpro gcpro1; | |
2666 | |
2667 GCPRO1 (result); | |
2668 | |
793 | 2669 frame = wrap_frame (f); |
428 | 2670 |
2671 /* #### for the moment (since old code uses `frame-parameters'), | |
2672 we call `copy-sequence' on f->plist. That allows frame-parameters | |
2673 to destructively convert the plist into an alist, which is more | |
2674 efficient than doing it non-destructively. At some point we | |
2675 should remove the call to copy-sequence. */ | |
2676 result = Fcopy_sequence (f->plist); | |
2677 | |
2678 /* #### should we be adding all the specifiers and glyphs? | |
2679 That would entail having a list of them all. */ | |
2680 if (HAS_FRAMEMETH_P (f, frame_properties)) | |
2681 result = nconc2 (FRAMEMETH (f, frame_properties, (f)), result); | |
2682 | |
2683 if (!NILP (f->buffer_predicate)) | |
2684 result = cons3 (Qbuffer_predicate, f->buffer_predicate, result); | |
2685 | |
2686 if (FRAME_NO_SPLIT_P (f)) | |
2687 result = cons3 (Qunsplittable, Qt, result); | |
2688 | |
2689 /* NOTE: FSF returns Qnil instead of Qt for FRAME_HAS_MINIBUF_P. | |
2690 This is over-the-top bogosity, because it's inconsistent with | |
2691 the semantics of `minibuffer' when passed to `make-frame'. | |
2692 Returning Qt makes things consistent. */ | |
2693 result = cons3 (Qminibuffer, | |
2694 (FRAME_MINIBUF_ONLY_P (f) ? Qonly : | |
2695 FRAME_HAS_MINIBUF_P (f) ? Qt : | |
2696 FRAME_MINIBUF_WINDOW (f)), | |
2697 result); | |
2698 { | |
2699 int width, height; | |
2700 | |
2701 if (window_system_pixelated_geometry (frame)) | |
2702 { | |
2703 pixel_to_real_char_size (f, FRAME_PIXWIDTH (f), FRAME_PIXHEIGHT (f), | |
2704 &width, &height); | |
2705 } | |
2706 else | |
2707 { | |
2708 height = FRAME_HEIGHT (f); | |
2709 width = FRAME_WIDTH (f); | |
2710 } | |
2711 result = cons3 (Qwidth , make_int (width), result); | |
2712 result = cons3 (Qheight, make_int (height), result); | |
2713 } | |
2714 | |
2715 result = cons3 (Qname, f->name, result); | |
2716 | |
2717 UNGCPRO; | |
2718 return result; | |
2719 } | |
2720 | |
2721 | |
2722 DEFUN ("frame-pixel-height", Fframe_pixel_height, 0, 1, 0, /* | |
1125 | 2723 Return the total height in pixels of FRAME. |
428 | 2724 */ |
2725 (frame)) | |
2726 { | |
2727 return make_int (decode_frame (frame)->pixheight); | |
2728 } | |
2729 | |
1125 | 2730 DEFUN ("frame-displayable-pixel-height", Fframe_displayable_pixel_height, 0, 1, 0, /* |
2731 Return the height of the displayable area in pixels of FRAME. | |
2732 */ | |
2733 (frame)) | |
2734 { | |
2735 struct frame *f = decode_frame (frame); | |
2736 int height, pheight; | |
2737 frame = wrap_frame (f); | |
2738 | |
4207 | 2739 if (!window_system_pixelated_geometry (frame)) |
1125 | 2740 { |
2741 height = FRAME_HEIGHT (f); | |
2742 | |
2743 frame_conversion_internal (f, CHAR_TO_DISPLAYABLE_PIXEL, | |
2744 0, &pheight, 0, &height, 0); | |
2745 } | |
4207 | 2746 else |
1125 | 2747 pheight = FRAME_PIXHEIGHT (f); |
2748 | |
2749 return make_int (pheight); | |
2750 } | |
2751 | |
428 | 2752 DEFUN ("frame-pixel-width", Fframe_pixel_width, 0, 1, 0, /* |
1125 | 2753 Return the total width in pixels of FRAME. |
428 | 2754 */ |
2755 (frame)) | |
2756 { | |
2757 return make_int (decode_frame (frame)->pixwidth); | |
2758 } | |
2759 | |
1125 | 2760 DEFUN ("frame-displayable-pixel-width", Fframe_displayable_pixel_width, 0, 1, 0, /* |
2761 Return the width of the displayable area in pixels of FRAME. | |
2762 */ | |
2763 (frame)) | |
2764 { | |
2765 struct frame *f = decode_frame (frame); | |
2766 int width, pwidth; | |
2767 frame = wrap_frame (f); | |
2768 | |
4207 | 2769 if (!window_system_pixelated_geometry (frame)) |
1125 | 2770 { |
2771 width = FRAME_WIDTH (f); | |
2772 | |
2773 frame_conversion_internal (f, CHAR_TO_DISPLAYABLE_PIXEL, | |
2774 &pwidth, 0, &width, 0, 0); | |
2775 } | |
4207 | 2776 else |
1125 | 2777 pwidth = FRAME_PIXWIDTH (f); |
2778 | |
2779 return make_int (pwidth); | |
2780 } | |
2781 | |
428 | 2782 DEFUN ("frame-name", Fframe_name, 0, 1, 0, /* |
2783 Return the name of FRAME (defaulting to the selected frame). | |
2784 This is not the same as the `title' of the frame. | |
2785 */ | |
2786 (frame)) | |
2787 { | |
2788 return decode_frame (frame)->name; | |
2789 } | |
2790 | |
2791 DEFUN ("frame-modified-tick", Fframe_modified_tick, 0, 1, 0, /* | |
2792 Return FRAME's tick counter, incremented for each change to the frame. | |
2793 Each frame has a tick counter which is incremented each time the frame | |
2794 is resized, a window is resized, added, or deleted, a face is changed, | |
2795 `set-window-buffer' or `select-window' is called on a window in the | |
2796 frame, the window-start of a window in the frame has changed, or | |
2797 anything else interesting has happened. It wraps around occasionally. | |
2798 No argument or nil as argument means use selected frame as FRAME. | |
2799 */ | |
2800 (frame)) | |
2801 { | |
2802 return make_int (decode_frame (frame)->modiff); | |
2803 } | |
2804 | |
2805 static void | |
2806 internal_set_frame_size (struct frame *f, int cols, int rows, int pretend) | |
2807 { | |
1318 | 2808 /* This can call Lisp. See mswindows_set_frame_size(). */ |
428 | 2809 /* An explicit size change cancels any pending frame size adjustment */ |
1318 | 2810 CLEAR_FRAME_SIZE_SLIPPED (f); |
428 | 2811 |
2812 if (pretend || !HAS_FRAMEMETH_P (f, set_frame_size)) | |
2813 change_frame_size (f, rows, cols, 0); | |
2814 else | |
2815 FRAMEMETH (f, set_frame_size, (f, cols, rows)); | |
2816 } | |
2817 | |
2818 DEFUN ("set-frame-height", Fset_frame_height, 2, 3, 0, /* | |
2819 Specify that the frame FRAME has LINES lines. | |
2820 Optional third arg non-nil means that redisplay should use LINES lines | |
2821 but that the idea of the actual height of the frame should not be changed. | |
2822 */ | |
444 | 2823 (frame, lines, pretend)) |
428 | 2824 { |
1318 | 2825 /* This can call Lisp. */ |
428 | 2826 struct frame *f = decode_frame (frame); |
2827 int height, width; | |
793 | 2828 frame = wrap_frame (f); |
444 | 2829 CHECK_INT (lines); |
428 | 2830 |
2831 if (window_system_pixelated_geometry (frame)) | |
2832 { | |
444 | 2833 char_to_real_pixel_size (f, 0, XINT (lines), 0, &height); |
428 | 2834 width = FRAME_PIXWIDTH (f); |
2835 } | |
2836 else | |
2837 { | |
444 | 2838 height = XINT (lines); |
428 | 2839 width = FRAME_WIDTH (f); |
2840 } | |
2841 | |
2842 internal_set_frame_size (f, width, height, !NILP (pretend)); | |
2843 return frame; | |
2844 } | |
2845 | |
863 | 2846 DEFUN ("set-frame-pixel-height", Fset_frame_pixel_height, 2, 3, 0, /* |
1125 | 2847 Specify that the frame FRAME is a total of HEIGHT pixels tall. |
863 | 2848 Optional third arg non-nil means that redisplay should be HEIGHT pixels tall |
2849 but that the idea of the actual height of the frame should not be changed. | |
2850 */ | |
2851 (frame, height, pretend)) | |
2852 { | |
1318 | 2853 /* This can call Lisp. */ |
863 | 2854 struct frame *f = decode_frame (frame); |
2855 int pheight, width; | |
2856 frame = wrap_frame (f); | |
2857 CHECK_INT (height); | |
2858 | |
4207 | 2859 if (!window_system_pixelated_geometry (frame)) |
863 | 2860 { |
2861 int h = XINT (height); | |
2862 width = FRAME_WIDTH (f); | |
1125 | 2863 |
2864 frame_conversion_internal (f, TOTAL_PIXEL_TO_CHAR, 0, &h, 0, &pheight, 0); | |
863 | 2865 } |
4207 | 2866 else |
863 | 2867 { |
2868 width = FRAME_PIXWIDTH (f); | |
2869 pheight = XINT (height); | |
2870 } | |
2871 | |
2872 internal_set_frame_size (f, width, pheight, !NILP (pretend)); | |
2873 return frame; | |
2874 } | |
2875 | |
1125 | 2876 DEFUN ("set-frame-displayable-pixel-height", Fset_frame_displayable_pixel_height, 2, 3, 0, /* |
2877 Specify that the displayable area of frame FRAME is HEIGHT pixels tall. | |
2878 Optional third arg non-nil means that redisplay should be HEIGHT pixels tall | |
2879 but that the idea of the actual height of the frame should not be changed. | |
2880 */ | |
2881 (frame, height, pretend)) | |
2882 { | |
1318 | 2883 /* This can call Lisp. */ |
1125 | 2884 struct frame *f = decode_frame (frame); |
2885 int pheight, width; | |
2886 frame = wrap_frame (f); | |
2887 CHECK_INT (height); | |
2888 | |
4207 | 2889 if (!window_system_pixelated_geometry (frame)) |
1125 | 2890 { |
2891 int h = XINT (height); | |
2892 width = FRAME_WIDTH (f); | |
2893 frame_conversion_internal (f, DISPLAYABLE_PIXEL_TO_CHAR, 0, &h, 0, &pheight, 0); | |
2894 } | |
4207 | 2895 else |
1125 | 2896 { |
2897 width = FRAME_PIXWIDTH (f); | |
2898 pheight = XINT (height); | |
2899 } | |
2900 | |
2901 internal_set_frame_size (f, width, pheight, !NILP (pretend)); | |
2902 return frame; | |
2903 } | |
2904 | |
2905 | |
428 | 2906 DEFUN ("set-frame-width", Fset_frame_width, 2, 3, 0, /* |
2907 Specify that the frame FRAME has COLS columns. | |
2908 Optional third arg non-nil means that redisplay should use COLS columns | |
2909 but that the idea of the actual width of the frame should not be changed. | |
2910 */ | |
2911 (frame, cols, pretend)) | |
2912 { | |
1318 | 2913 /* This can call Lisp. */ |
428 | 2914 struct frame *f = decode_frame (frame); |
2915 int width, height; | |
793 | 2916 frame = wrap_frame (f); |
428 | 2917 CHECK_INT (cols); |
2918 | |
2919 if (window_system_pixelated_geometry (frame)) | |
2920 { | |
2921 char_to_real_pixel_size (f, XINT (cols), 0, &width, 0); | |
2922 height = FRAME_PIXHEIGHT (f); | |
2923 } | |
2924 else | |
2925 { | |
2926 width = XINT (cols); | |
2927 height = FRAME_HEIGHT (f); | |
2928 } | |
2929 | |
2930 internal_set_frame_size (f, width, height, !NILP (pretend)); | |
2931 return frame; | |
2932 } | |
2933 | |
863 | 2934 DEFUN ("set-frame-pixel-width", Fset_frame_pixel_width, 2, 3, 0, /* |
1125 | 2935 Specify that the frame FRAME is a total of WIDTH pixels wide. |
863 | 2936 Optional third arg non-nil means that redisplay should be WIDTH wide |
2937 but that the idea of the actual height of the frame should not be changed. | |
2938 */ | |
2939 (frame, width, pretend)) | |
2940 { | |
1318 | 2941 /* This can call Lisp. */ |
863 | 2942 struct frame *f = decode_frame (frame); |
2943 int height, pwidth; | |
2944 frame = wrap_frame (f); | |
2945 CHECK_INT (width); | |
2946 | |
2947 if (!window_system_pixelated_geometry (frame)) | |
2948 { | |
2949 int w = XINT (width); | |
2950 height = FRAME_HEIGHT (f); | |
1125 | 2951 frame_conversion_internal (f, TOTAL_PIXEL_TO_CHAR, &w, 0, &pwidth, 0, 0); |
2952 } | |
2953 else | |
2954 { | |
2955 height = FRAME_PIXHEIGHT (f); | |
2956 pwidth = XINT (width); | |
2957 } | |
2958 | |
2959 internal_set_frame_size (f, pwidth, height, !NILP (pretend)); | |
2960 return frame; | |
2961 } | |
2962 | |
2963 DEFUN ("set-frame-displayable-pixel-width", Fset_frame_displayable_pixel_width, 2, 3, 0, /* | |
2964 Specify that the displayable area of frame FRAME is WIDTH pixels wide. | |
2965 Optional third arg non-nil means that redisplay should be WIDTH wide | |
2966 but that the idea of the actual height of the frame should not be changed. | |
2967 */ | |
2968 (frame, width, pretend)) | |
2969 { | |
1318 | 2970 /* This can call Lisp. */ |
1125 | 2971 struct frame *f = decode_frame (frame); |
2972 int height, pwidth; | |
2973 frame = wrap_frame (f); | |
2974 CHECK_INT (width); | |
2975 | |
2976 if (!window_system_pixelated_geometry (frame)) | |
2977 { | |
2978 int w = XINT (width); | |
2979 height = FRAME_HEIGHT (f); | |
2980 frame_conversion_internal (f, DISPLAYABLE_PIXEL_TO_CHAR, &w, 0, &pwidth, 0, 0); | |
863 | 2981 } |
2982 else | |
2983 { | |
2984 height = FRAME_PIXHEIGHT (f); | |
2985 pwidth = XINT (width); | |
2986 } | |
2987 | |
2988 internal_set_frame_size (f, pwidth, height, !NILP (pretend)); | |
2989 return frame; | |
2990 } | |
2991 | |
428 | 2992 DEFUN ("set-frame-size", Fset_frame_size, 3, 4, 0, /* |
444 | 2993 Set the size of FRAME to COLS by ROWS, measured in characters. |
428 | 2994 Optional fourth arg non-nil means that redisplay should use COLS by ROWS |
2995 but that the idea of the actual size of the frame should not be changed. | |
2996 */ | |
2997 (frame, cols, rows, pretend)) | |
2998 { | |
1318 | 2999 /* This can call Lisp. */ |
428 | 3000 struct frame *f = decode_frame (frame); |
3001 int height, width; | |
793 | 3002 frame = wrap_frame (f); |
428 | 3003 CHECK_INT (cols); |
3004 CHECK_INT (rows); | |
3005 | |
3006 if (window_system_pixelated_geometry (frame)) | |
3007 char_to_real_pixel_size (f, XINT (cols), XINT (rows), &width, &height); | |
3008 else | |
3009 { | |
3010 height = XINT (rows); | |
3011 width = XINT (cols); | |
3012 } | |
3013 | |
3014 internal_set_frame_size (f, width, height, !NILP (pretend)); | |
3015 return frame; | |
3016 } | |
3017 | |
863 | 3018 DEFUN ("set-frame-pixel-size", Fset_frame_pixel_size, 3, 4, 0, /* |
1125 | 3019 Set the total size of FRAME to WIDTH by HEIGHT, measured in pixels. |
863 | 3020 Optional fourth arg non-nil means that redisplay should use WIDTH by HEIGHT |
3021 but that the idea of the actual size of the frame should not be changed. | |
3022 */ | |
3023 (frame, width, height, pretend)) | |
3024 { | |
1318 | 3025 /* This can call Lisp. */ |
863 | 3026 struct frame *f = decode_frame (frame); |
3027 int pheight, pwidth; | |
3028 frame = wrap_frame (f); | |
3029 CHECK_INT (width); | |
3030 CHECK_INT (height); | |
3031 | |
4207 | 3032 if (!window_system_pixelated_geometry (frame)) |
863 | 3033 { |
3034 int w = XINT (width); | |
3035 int h = XINT (height); | |
1125 | 3036 frame_conversion_internal (f, TOTAL_PIXEL_TO_CHAR, &w, &h, &pwidth, &pheight, 0); |
3037 } | |
3038 else | |
3039 { | |
3040 pheight = XINT (height); | |
3041 pwidth = XINT (width); | |
3042 } | |
3043 | |
3044 internal_set_frame_size (f, pwidth, pheight, !NILP (pretend)); | |
3045 return frame; | |
3046 } | |
3047 | |
3048 DEFUN ("set-frame-displayable-pixel-size", Fset_frame_displayable_pixel_size, 3, 4, 0, /* | |
3049 Set the displayable size of FRAME to WIDTH by HEIGHT, measured in pixels. | |
3050 Optional fourth arg non-nil means that redisplay should use WIDTH by HEIGHT | |
3051 but that the idea of the actual size of the frame should not be changed. | |
3052 */ | |
3053 (frame, width, height, pretend)) | |
3054 { | |
1318 | 3055 /* This can call Lisp. */ |
1125 | 3056 struct frame *f = decode_frame (frame); |
3057 int pheight, pwidth; | |
3058 frame = wrap_frame (f); | |
3059 CHECK_INT (width); | |
3060 CHECK_INT (height); | |
3061 | |
4207 | 3062 if (!window_system_pixelated_geometry (frame)) |
1125 | 3063 { |
3064 int w = XINT (width); | |
3065 int h = XINT (height); | |
3066 frame_conversion_internal (f, DISPLAYABLE_PIXEL_TO_CHAR, &w, &h, &pwidth, &pheight, 0); | |
863 | 3067 } |
3068 else | |
3069 { | |
3070 pheight = XINT (height); | |
3071 pwidth = XINT (width); | |
3072 } | |
3073 | |
3074 internal_set_frame_size (f, pwidth, pheight, !NILP (pretend)); | |
3075 return frame; | |
3076 } | |
3077 | |
428 | 3078 DEFUN ("set-frame-position", Fset_frame_position, 3, 3, 0, /* |
3079 Set position of FRAME in pixels to XOFFSET by YOFFSET. | |
3080 This is actually the position of the upper left corner of the frame. | |
3081 Negative values for XOFFSET or YOFFSET are interpreted relative to | |
3082 the rightmost or bottommost possible position (that stays within the screen). | |
3083 */ | |
3084 (frame, xoffset, yoffset)) | |
3085 { | |
3086 struct frame *f = decode_frame (frame); | |
3087 CHECK_INT (xoffset); | |
3088 CHECK_INT (yoffset); | |
3089 | |
3090 MAYBE_FRAMEMETH (f, set_frame_position, (f, XINT (xoffset), XINT (yoffset))); | |
3091 | |
3092 return Qt; | |
3093 } | |
3094 | |
3095 | |
3096 | |
3097 /* Frame size conversion functions moved here from EmacsFrame.c | |
3098 because they're generic and really don't belong in that file. | |
3099 Function get_default_char_pixel_size() removed because it's | |
3100 exactly the same as default_face_height_and_width(). */ | |
3101 static void | |
1125 | 3102 frame_conversion_internal (struct frame *f, |
3103 pixel_to_char_mode_t pixel_to_char, | |
428 | 3104 int *pixel_width, int *pixel_height, |
3105 int *char_width, int *char_height, | |
3106 int real_face) | |
3107 { | |
3108 int cpw; | |
3109 int cph; | |
3110 int egw; | |
3111 int obw, obh, bdr; | |
3112 Lisp_Object frame, window; | |
3113 | |
793 | 3114 frame = wrap_frame (f); |
428 | 3115 if (real_face) |
3116 default_face_height_and_width (frame, &cph, &cpw); | |
3117 else | |
3118 default_face_height_and_width_1 (frame, &cph, &cpw); | |
3119 | |
3120 window = FRAME_SELECTED_WINDOW (f); | |
3121 | |
438 | 3122 egw = max (glyph_width (Vcontinuation_glyph, window), |
3123 glyph_width (Vtruncation_glyph, window)); | |
428 | 3124 egw = max (egw, cpw); |
3125 bdr = 2 * f->internal_border_width; | |
3126 obw = FRAME_SCROLLBAR_WIDTH (f) + FRAME_THEORETICAL_LEFT_TOOLBAR_WIDTH (f) + | |
3127 FRAME_THEORETICAL_RIGHT_TOOLBAR_WIDTH (f) + | |
3128 2 * FRAME_THEORETICAL_LEFT_TOOLBAR_BORDER_WIDTH (f) + | |
3129 2 * FRAME_THEORETICAL_RIGHT_TOOLBAR_BORDER_WIDTH (f); | |
3130 obh = FRAME_SCROLLBAR_HEIGHT (f) + FRAME_THEORETICAL_TOP_TOOLBAR_HEIGHT (f) + | |
3131 FRAME_THEORETICAL_BOTTOM_TOOLBAR_HEIGHT (f) + | |
3132 2 * FRAME_THEORETICAL_TOP_TOOLBAR_BORDER_WIDTH (f) + | |
3133 2 * FRAME_THEORETICAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f); | |
3134 | |
863 | 3135 /* Convert to chars so that the displayable area is pixel_width x |
3136 pixel_height. | |
3137 | |
3138 #### Consider rounding up to 0.5 characters to avoid adding too | |
3139 much space. */ | |
1125 | 3140 switch (pixel_to_char) |
863 | 3141 { |
1125 | 3142 case DISPLAYABLE_PIXEL_TO_CHAR: |
863 | 3143 if (char_width) |
3144 *char_width = ROUND_UP (*pixel_width, cpw) / cpw; | |
3145 if (char_height) | |
3146 *char_height = ROUND_UP (*pixel_height, cph) / cph; | |
1125 | 3147 break; |
3148 case TOTAL_PIXEL_TO_CHAR: | |
3149 /* Convert to chars so that the total frame size is pixel_width x | |
3150 pixel_height. */ | |
428 | 3151 if (char_width) |
3152 *char_width = 1 + ((*pixel_width - egw) - bdr - obw) / cpw; | |
3153 if (char_height) | |
3154 *char_height = (*pixel_height - bdr - obh) / cph; | |
1125 | 3155 break; |
3156 case CHAR_TO_TOTAL_PIXEL: | |
428 | 3157 if (pixel_width) |
3158 *pixel_width = (*char_width - 1) * cpw + egw + bdr + obw; | |
3159 if (pixel_height) | |
3160 *pixel_height = *char_height * cph + bdr + obh; | |
1125 | 3161 break; |
3162 case CHAR_TO_DISPLAYABLE_PIXEL: | |
3163 if (pixel_width) | |
3164 *pixel_width = *char_width * cpw; | |
3165 if (pixel_height) | |
3166 *pixel_height = *char_height * cph; | |
3167 break; | |
428 | 3168 } |
3169 } | |
3170 | |
3171 /* This takes the size in pixels of the text area, and returns the number | |
3172 of characters that will fit there, taking into account the internal | |
3173 border width, and the pixel width of the line terminator glyphs (which | |
3174 always count as one "character" wide, even if they are not the same size | |
3175 as the default character size of the default font). The frame scrollbar | |
3176 width and left and right toolbar widths are also subtracted out of the | |
3177 available width. The frame scrollbar height and top and bottom toolbar | |
3178 heights are subtracted out of the available height. | |
3179 | |
3180 Therefore the result is not necessarily a multiple of anything in | |
3181 particular. */ | |
3182 void | |
3183 pixel_to_char_size (struct frame *f, int pixel_width, int pixel_height, | |
3184 int *char_width, int *char_height) | |
3185 { | |
1125 | 3186 frame_conversion_internal (f, TOTAL_PIXEL_TO_CHAR, |
3187 &pixel_width, &pixel_height, char_width, | |
428 | 3188 char_height, 0); |
3189 } | |
3190 | |
3191 /* Given a character size, this returns the minimum number of pixels | |
3192 necessary to display that many characters, taking into account the | |
3193 internal border width, scrollbar height and width, toolbar heights and | |
3194 widths and the size of the line terminator glyphs (assuming the line | |
3195 terminators take up exactly one character position). | |
3196 | |
3197 Therefore the result is not necessarily a multiple of anything in | |
3198 particular. */ | |
3199 void | |
3200 char_to_pixel_size (struct frame *f, int char_width, int char_height, | |
3201 int *pixel_width, int *pixel_height) | |
3202 { | |
1125 | 3203 frame_conversion_internal (f, CHAR_TO_TOTAL_PIXEL, |
3204 pixel_width, pixel_height, &char_width, | |
428 | 3205 &char_height, 0); |
3206 } | |
3207 | |
3208 /* Given a pixel size, rounds DOWN to the smallest size in pixels necessary | |
3209 to display the same number of characters as are displayable now. | |
3210 */ | |
3211 void | |
3212 round_size_to_char (struct frame *f, int in_width, int in_height, | |
3213 int *out_width, int *out_height) | |
3214 { | |
3215 int char_width; | |
3216 int char_height; | |
3217 pixel_to_char_size (f, in_width, in_height, &char_width, &char_height); | |
3218 char_to_pixel_size (f, char_width, char_height, out_width, out_height); | |
3219 } | |
3220 | |
3221 /* Versions of the above which always account for real font metrics. | |
3222 */ | |
3223 void | |
3224 pixel_to_real_char_size (struct frame *f, int pixel_width, int pixel_height, | |
3225 int *char_width, int *char_height) | |
3226 { | |
1125 | 3227 frame_conversion_internal (f, TOTAL_PIXEL_TO_CHAR, |
3228 &pixel_width, &pixel_height, char_width, | |
428 | 3229 char_height, 1); |
3230 } | |
3231 | |
3232 void | |
3233 char_to_real_pixel_size (struct frame *f, int char_width, int char_height, | |
3234 int *pixel_width, int *pixel_height) | |
3235 { | |
1125 | 3236 frame_conversion_internal (f, CHAR_TO_TOTAL_PIXEL, |
3237 pixel_width, pixel_height, &char_width, | |
428 | 3238 &char_height, 1); |
3239 } | |
3240 | |
3241 void | |
3242 round_size_to_real_char (struct frame *f, int in_width, int in_height, | |
3243 int *out_width, int *out_height) | |
3244 { | |
3245 int char_width; | |
3246 int char_height; | |
3247 pixel_to_real_char_size (f, in_width, in_height, &char_width, &char_height); | |
3248 char_to_real_pixel_size (f, char_width, char_height, out_width, out_height); | |
3249 } | |
3250 | |
3251 /* Change the frame height and/or width. Values may be given as zero to | |
3252 indicate no change is to take place. */ | |
3253 static void | |
3254 change_frame_size_1 (struct frame *f, int newheight, int newwidth) | |
3255 { | |
3256 Lisp_Object frame; | |
3257 int new_pixheight, new_pixwidth; | |
3258 int font_height, real_font_height, font_width; | |
3259 | |
3260 /* #### Chuck -- shouldn't we be checking to see if the frame | |
3261 is being "changed" to its existing size, and do nothing if so? */ | |
3262 /* No, because it would hose toolbar updates. The toolbar | |
3263 update code relies on this function to cause window `top' and | |
3264 `left' coordinates to be recomputed even though no frame size | |
3265 change occurs. --kyle */ | |
1318 | 3266 if (in_display || hold_frame_size_changes) |
2500 | 3267 ABORT (); |
428 | 3268 |
793 | 3269 frame = wrap_frame (f); |
428 | 3270 |
3271 default_face_height_and_width (frame, &real_font_height, 0); | |
3272 default_face_height_and_width_1 (frame, &font_height, &font_width); | |
3273 | |
3274 /* This size-change overrides any pending one for this frame. */ | |
4307 | 3275 f->size_change_pending = 0; |
428 | 3276 FRAME_NEW_HEIGHT (f) = 0; |
3277 FRAME_NEW_WIDTH (f) = 0; | |
3278 | |
3279 new_pixheight = newheight * font_height; | |
3280 new_pixwidth = (newwidth - 1) * font_width; | |
3281 | |
3282 /* #### dependency on FRAME_WIN_P should be removed. */ | |
3283 if (FRAME_WIN_P (f)) | |
3284 { | |
3285 new_pixheight += FRAME_SCROLLBAR_HEIGHT (f); | |
3286 new_pixwidth += FRAME_SCROLLBAR_WIDTH (f); | |
3287 } | |
3288 | |
3289 /* when frame_conversion_internal() calculated the number of rows/cols | |
3290 in the frame, the theoretical toolbar sizes were subtracted out. | |
3291 The calculations below adjust for real toolbar height/width in | |
3292 frame, which may be different from frame spec, taking the above | |
3293 fact into account */ | |
3294 new_pixheight += | |
3295 + FRAME_THEORETICAL_TOP_TOOLBAR_HEIGHT (f) | |
3296 + 2 * FRAME_THEORETICAL_TOP_TOOLBAR_BORDER_WIDTH (f) | |
3297 - FRAME_REAL_TOP_TOOLBAR_HEIGHT (f) | |
3298 - 2 * FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f); | |
3299 | |
3300 new_pixheight += | |
3301 + FRAME_THEORETICAL_BOTTOM_TOOLBAR_HEIGHT (f) | |
3302 + 2 * FRAME_THEORETICAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f) | |
3303 - FRAME_REAL_BOTTOM_TOOLBAR_HEIGHT (f) | |
3304 - 2 * FRAME_REAL_BOTTOM_TOOLBAR_BORDER_WIDTH (f); | |
3305 | |
3306 new_pixwidth += | |
3307 + FRAME_THEORETICAL_LEFT_TOOLBAR_WIDTH (f) | |
3308 + 2 * FRAME_THEORETICAL_LEFT_TOOLBAR_BORDER_WIDTH (f) | |
3309 - FRAME_REAL_LEFT_TOOLBAR_WIDTH (f) | |
3310 - 2 * FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f); | |
3311 | |
3312 new_pixwidth += | |
3313 + FRAME_THEORETICAL_RIGHT_TOOLBAR_WIDTH (f) | |
3314 + 2 * FRAME_THEORETICAL_RIGHT_TOOLBAR_BORDER_WIDTH (f) | |
3315 - FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f) | |
3316 - 2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f); | |
3317 | |
3318 /* Adjust the width for the end glyph which may be a different width | |
3319 than the default character width. */ | |
3320 { | |
3321 int adjustment, trunc_width, cont_width; | |
3322 | |
440 | 3323 trunc_width = glyph_width (Vtruncation_glyph, |
428 | 3324 FRAME_SELECTED_WINDOW (f)); |
440 | 3325 cont_width = glyph_width (Vcontinuation_glyph, |
428 | 3326 FRAME_SELECTED_WINDOW (f)); |
3327 adjustment = max (trunc_width, cont_width); | |
3328 adjustment = max (adjustment, font_width); | |
3329 | |
3330 new_pixwidth += adjustment; | |
3331 } | |
3332 | |
3333 /* If we don't have valid values, exit. */ | |
3334 if (!new_pixheight && !new_pixwidth) | |
3335 return; | |
3336 | |
3337 if (new_pixheight) | |
3338 { | |
442 | 3339 /* Adjust for gutters here so that we always get set |
4207 | 3340 properly. */ |
442 | 3341 new_pixheight -= |
3342 (FRAME_TOP_GUTTER_BOUNDS (f) | |
3343 + FRAME_BOTTOM_GUTTER_BOUNDS (f)); | |
3344 | |
3345 XWINDOW (FRAME_ROOT_WINDOW (f))->pixel_top | |
3346 = FRAME_TOP_BORDER_END (f) + FRAME_TOP_GUTTER_BOUNDS (f); | |
428 | 3347 |
3348 if (FRAME_HAS_MINIBUF_P (f) | |
3349 && ! FRAME_MINIBUF_ONLY_P (f)) | |
3350 /* Frame has both root and minibuffer. */ | |
3351 { | |
3352 /* | |
3353 * Leave the minibuffer height the same if the frame has | |
3354 * been initialized, and the minibuffer height is tall | |
3355 * enough to display at least one line of text in the default | |
3356 * font, and the old minibuffer height is a multiple of the | |
3357 * default font height. This should cause the minibuffer | |
3358 * height to be recomputed on font changes but not for | |
3359 * other frame size changes, which seems reasonable. | |
3360 */ | |
3361 int old_minibuf_height = | |
3362 XWINDOW(FRAME_MINIBUF_WINDOW(f))->pixel_height; | |
3363 int minibuf_height = | |
3364 f->init_finished && (old_minibuf_height % real_font_height) == 0 ? | |
3365 max(old_minibuf_height, real_font_height) : | |
3366 real_font_height; | |
3367 set_window_pixheight (FRAME_ROOT_WINDOW (f), | |
3368 /* - font_height for minibuffer */ | |
3369 new_pixheight - minibuf_height, 0); | |
3370 | |
3371 XWINDOW (FRAME_MINIBUF_WINDOW (f))->pixel_top = | |
442 | 3372 FRAME_TOP_BORDER_END (f) + |
3373 FRAME_TOP_GUTTER_BOUNDS (f) + | |
3374 FRAME_BOTTOM_GUTTER_BOUNDS (f) + | |
3375 new_pixheight - minibuf_height; | |
428 | 3376 |
3377 set_window_pixheight (FRAME_MINIBUF_WINDOW (f), minibuf_height, 0); | |
3378 } | |
3379 else | |
3380 /* Frame has just one top-level window. */ | |
3381 set_window_pixheight (FRAME_ROOT_WINDOW (f), new_pixheight, 0); | |
3382 | |
3383 FRAME_HEIGHT (f) = newheight; | |
3384 if (FRAME_TTY_P (f)) | |
3385 f->pixheight = newheight; | |
3386 } | |
3387 | |
3388 if (new_pixwidth) | |
3389 { | |
442 | 3390 /* Adjust for gutters here so that we always get set |
4207 | 3391 properly. */ |
442 | 3392 new_pixwidth -= |
3393 (FRAME_LEFT_GUTTER_BOUNDS (f) | |
3394 + FRAME_RIGHT_GUTTER_BOUNDS (f)); | |
3395 | |
3396 XWINDOW (FRAME_ROOT_WINDOW (f))->pixel_left = | |
3397 FRAME_LEFT_BORDER_END (f) + FRAME_LEFT_GUTTER_BOUNDS (f); | |
428 | 3398 set_window_pixwidth (FRAME_ROOT_WINDOW (f), new_pixwidth, 0); |
3399 | |
3400 if (FRAME_HAS_MINIBUF_P (f)) | |
3401 { | |
3402 XWINDOW (FRAME_MINIBUF_WINDOW (f))->pixel_left = | |
442 | 3403 FRAME_LEFT_BORDER_END (f) + FRAME_LEFT_GUTTER_BOUNDS (f); |
428 | 3404 set_window_pixwidth (FRAME_MINIBUF_WINDOW (f), new_pixwidth, 0); |
3405 } | |
3406 | |
3407 FRAME_WIDTH (f) = newwidth; | |
3408 if (FRAME_TTY_P (f)) | |
3409 f->pixwidth = newwidth; | |
3410 } | |
3411 | |
3412 if (window_system_pixelated_geometry (frame)) | |
3413 pixel_to_real_char_size (f, FRAME_PIXWIDTH (f), FRAME_PIXHEIGHT (f), | |
3414 &FRAME_CHARWIDTH (f), &FRAME_CHARHEIGHT (f)); | |
3415 else | |
3416 { | |
3417 FRAME_CHARWIDTH (f) = FRAME_WIDTH (f); | |
3418 FRAME_CHARHEIGHT (f) = FRAME_HEIGHT (f); | |
3419 } | |
3420 | |
3421 MARK_FRAME_TOOLBARS_CHANGED (f); | |
442 | 3422 MARK_FRAME_GUTTERS_CHANGED (f); |
428 | 3423 MARK_FRAME_CHANGED (f); |
3424 f->echo_area_garbaged = 1; | |
3425 } | |
3426 | |
3427 void | |
3428 change_frame_size (struct frame *f, int newheight, int newwidth, int delay) | |
3429 { | |
3430 /* sometimes we get passed a size that's too small (esp. when a | |
3431 client widget gets resized, since we have no control over this). | |
3432 So deal. */ | |
3433 check_frame_size (f, &newheight, &newwidth); | |
3434 | |
450 | 3435 /* Unconditionally mark that the frame has changed size. This is |
3436 because many things need to know after the | |
3437 fact. f->size_change_pending will get reset below. The most that | |
3438 can happen is that we will cycle through redisplay once more | |
3439 --andy. */ | |
3440 MARK_FRAME_SIZE_CHANGED (f); | |
3441 | |
3092 | 3442 #ifdef NEW_GC |
3443 if (delay || hold_frame_size_changes) | |
3444 #else /* not NEW_GC */ | |
1318 | 3445 if (delay || hold_frame_size_changes || gc_in_progress) |
3092 | 3446 #endif /* not NEW_GC */ |
428 | 3447 { |
3448 f->new_width = newwidth; | |
3449 f->new_height = newheight; | |
3450 return; | |
3451 } | |
3452 | |
3453 /* For TTY frames, it's like one, like all ... | |
3454 Can't have two TTY frames of different sizes on the same device. */ | |
3455 if (FRAME_TTY_P (f)) | |
3456 { | |
3457 Lisp_Object frmcons; | |
3458 | |
3459 DEVICE_FRAME_LOOP (frmcons, XDEVICE (FRAME_DEVICE (f))) | |
3460 change_frame_size_1 (XFRAME (XCAR (frmcons)), newheight, newwidth); | |
3461 } | |
3462 else | |
3463 change_frame_size_1 (f, newheight, newwidth); | |
3464 } | |
3465 | |
3466 | |
438 | 3467 /* The caller is responsible for freeing the returned string. */ |
867 | 3468 static Ibyte * |
438 | 3469 generate_title_string (struct window *w, Lisp_Object format_str, |
3470 face_index findex, int type) | |
3471 { | |
3472 struct display_line *dl; | |
3473 struct display_block *db; | |
3474 int elt = 0; | |
3475 | |
3476 dl = &title_string_display_line; | |
3477 db = get_display_block_from_line (dl, TEXT); | |
3478 Dynarr_reset (db->runes); | |
3479 | |
3480 generate_formatted_string_db (format_str, Qnil, w, dl, db, findex, 0, | |
4207 | 3481 -1, type); |
438 | 3482 |
867 | 3483 Dynarr_reset (title_string_ichar_dynarr); |
438 | 3484 while (elt < Dynarr_length (db->runes)) |
3485 { | |
3486 if (Dynarr_atp (db->runes, elt)->type == RUNE_CHAR) | |
867 | 3487 Dynarr_add (title_string_ichar_dynarr, |
438 | 3488 Dynarr_atp (db->runes, elt)->object.chr.ch); |
3489 elt++; | |
3490 } | |
3491 | |
3492 return | |
867 | 3493 convert_ichar_string_into_malloced_string |
3494 (Dynarr_atp (title_string_ichar_dynarr, 0), | |
3495 Dynarr_length (title_string_ichar_dynarr), 0); | |
438 | 3496 } |
3497 | |
428 | 3498 void |
3499 update_frame_title (struct frame *f) | |
3500 { | |
3501 struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f)); | |
3502 Lisp_Object title_format; | |
3503 Lisp_Object icon_format; | |
867 | 3504 Ibyte *title; |
428 | 3505 |
3506 /* We don't change the title for the minibuffer unless the frame | |
3507 only has a minibuffer. */ | |
3508 if (MINI_WINDOW_P (w) && !FRAME_MINIBUF_ONLY_P (f)) | |
3509 return; | |
3510 | |
3511 /* And we don't want dead buffers to blow up on us. */ | |
3512 if (!BUFFER_LIVE_P (XBUFFER (w->buffer))) | |
3513 return; | |
3514 | |
3515 title = NULL; | |
3516 title_format = symbol_value_in_buffer (Qframe_title_format, w->buffer); | |
3517 icon_format = symbol_value_in_buffer (Qframe_icon_title_format, w->buffer); | |
3518 | |
867 | 3519 if (HAS_FRAMEMETH_P (f, set_title_from_ibyte)) |
428 | 3520 { |
438 | 3521 title = generate_title_string (w, title_format, |
3522 DEFAULT_INDEX, CURRENT_DISP); | |
867 | 3523 FRAMEMETH (f, set_title_from_ibyte, (f, title)); |
428 | 3524 } |
3525 | |
867 | 3526 if (HAS_FRAMEMETH_P (f, set_icon_name_from_ibyte)) |
428 | 3527 { |
3528 if (!EQ (icon_format, title_format) || !title) | |
3529 { | |
3530 if (title) | |
1726 | 3531 xfree (title, Ibyte *); |
428 | 3532 |
438 | 3533 title = generate_title_string (w, icon_format, |
3534 DEFAULT_INDEX, CURRENT_DISP); | |
428 | 3535 } |
867 | 3536 FRAMEMETH (f, set_icon_name_from_ibyte, (f, title)); |
428 | 3537 } |
3538 | |
3539 if (title) | |
1726 | 3540 xfree (title, Ibyte *); |
428 | 3541 } |
3542 | |
3543 | |
3544 DEFUN ("set-frame-pointer", Fset_frame_pointer, 2, 2, 0, /* | |
3545 Set the mouse pointer of FRAME to the given pointer image instance. | |
3546 You should not call this function directly. Instead, set one of | |
3547 the variables `text-pointer-glyph', `nontext-pointer-glyph', | |
3548 `modeline-pointer-glyph', `selection-pointer-glyph', | |
3549 `busy-pointer-glyph', or `toolbar-pointer-glyph'. | |
3550 */ | |
3551 (frame, image_instance)) | |
3552 { | |
3553 struct frame *f = decode_frame (frame); | |
3554 CHECK_POINTER_IMAGE_INSTANCE (image_instance); | |
3555 if (!EQ (f->pointer, image_instance)) | |
3556 { | |
3557 f->pointer = image_instance; | |
3558 MAYBE_FRAMEMETH (f, set_frame_pointer, (f)); | |
3559 } | |
3560 return Qnil; | |
3561 } | |
3562 | |
3563 | |
3564 void | |
3565 update_frame_icon (struct frame *f) | |
3566 { | |
3567 if (f->icon_changed || f->windows_changed) | |
3568 { | |
3569 Lisp_Object frame; | |
3570 Lisp_Object new_icon; | |
3571 | |
793 | 3572 frame = wrap_frame (f); |
428 | 3573 new_icon = glyph_image_instance (Vframe_icon_glyph, frame, |
3574 ERROR_ME_WARN, 0); | |
3575 if (!EQ (new_icon, f->icon)) | |
3576 { | |
3577 f->icon = new_icon; | |
3578 MAYBE_FRAMEMETH (f, set_frame_icon, (f)); | |
3579 } | |
3580 } | |
3581 | |
3582 f->icon_changed = 0; | |
3583 } | |
3584 | |
3585 static void | |
2286 | 3586 icon_glyph_changed (Lisp_Object UNUSED (glyph), Lisp_Object UNUSED (property), |
3587 Lisp_Object UNUSED (locale)) | |
428 | 3588 { |
3589 MARK_ICON_CHANGED; | |
3590 } | |
3591 | |
3592 | |
438 | 3593 /***************************************************************************/ |
3594 /* */ | |
3595 /* initialization */ | |
3596 /* */ | |
3597 /***************************************************************************/ | |
3598 | |
3599 void | |
3600 init_frame (void) | |
3601 { | |
3602 #ifndef PDUMP | |
3603 if (!initialized) | |
3604 #endif | |
3605 { | |
867 | 3606 title_string_ichar_dynarr = Dynarr_new (Ichar); |
4207 | 3607 DISPLAY_LINE_INIT (title_string_display_line); |
438 | 3608 } |
3609 } | |
3610 | |
428 | 3611 void |
3612 syms_of_frame (void) | |
3613 { | |
442 | 3614 INIT_LRECORD_IMPLEMENTATION (frame); |
3092 | 3615 #ifdef NEW_GC |
3616 INIT_LRECORD_IMPLEMENTATION (expose_ignore); | |
3617 #endif /* NEW_GC */ | |
442 | 3618 |
563 | 3619 DEFSYMBOL (Qdelete_frame_hook); |
3620 DEFSYMBOL (Qselect_frame_hook); | |
3621 DEFSYMBOL (Qdeselect_frame_hook); | |
3622 DEFSYMBOL (Qcreate_frame_hook); | |
3623 DEFSYMBOL (Qcustom_initialize_frame); | |
3624 DEFSYMBOL (Qmouse_enter_frame_hook); | |
3625 DEFSYMBOL (Qmouse_leave_frame_hook); | |
3626 DEFSYMBOL (Qmap_frame_hook); | |
3627 DEFSYMBOL (Qunmap_frame_hook); | |
3628 | |
3629 DEFSYMBOL (Qframep); | |
3630 DEFSYMBOL (Qframe_live_p); | |
3631 DEFSYMBOL (Qdelete_frame); | |
3632 DEFSYMBOL (Qsynchronize_minibuffers); | |
3633 DEFSYMBOL (Qbuffer_predicate); | |
3634 DEFSYMBOL (Qframe_being_created); | |
3635 DEFSYMBOL (Qmake_initial_minibuffer_frame); | |
3636 | |
3637 DEFSYMBOL (Qframe_title_format); | |
3638 DEFSYMBOL (Qframe_icon_title_format); | |
3639 | |
3640 DEFSYMBOL (Qhidden); | |
3641 DEFSYMBOL (Qvisible); | |
3642 DEFSYMBOL (Qiconic); | |
3643 DEFSYMBOL (Qinvisible); | |
3644 DEFSYMBOL (Qvisible_iconic); | |
3645 DEFSYMBOL (Qinvisible_iconic); | |
3646 DEFSYMBOL (Qnomini); | |
3647 DEFSYMBOL (Qvisible_nomini); | |
3648 DEFSYMBOL (Qiconic_nomini); | |
3649 DEFSYMBOL (Qinvisible_nomini); | |
3650 DEFSYMBOL (Qvisible_iconic_nomini); | |
3651 DEFSYMBOL (Qinvisible_iconic_nomini); | |
3652 | |
3653 DEFSYMBOL (Qminibuffer); | |
3654 DEFSYMBOL (Qunsplittable); | |
3655 DEFSYMBOL (Qinternal_border_width); | |
3656 DEFSYMBOL (Qtop_toolbar_shadow_color); | |
3657 DEFSYMBOL (Qbottom_toolbar_shadow_color); | |
3658 DEFSYMBOL (Qbackground_toolbar_color); | |
3659 DEFSYMBOL (Qtop_toolbar_shadow_pixmap); | |
3660 DEFSYMBOL (Qbottom_toolbar_shadow_pixmap); | |
3661 DEFSYMBOL (Qtoolbar_shadow_thickness); | |
3662 DEFSYMBOL (Qscrollbar_placement); | |
3663 DEFSYMBOL (Qinter_line_space); | |
428 | 3664 /* Qiconic already in this function. */ |
563 | 3665 DEFSYMBOL (Qvisual_bell); |
3666 DEFSYMBOL (Qbell_volume); | |
3667 DEFSYMBOL (Qpointer_background); | |
3668 DEFSYMBOL (Qpointer_color); | |
3669 DEFSYMBOL (Qtext_pointer); | |
3670 DEFSYMBOL (Qspace_pointer); | |
3671 DEFSYMBOL (Qmodeline_pointer); | |
3672 DEFSYMBOL (Qgc_pointer); | |
3673 DEFSYMBOL (Qinitially_unmapped); | |
3674 DEFSYMBOL (Quse_backing_store); | |
3675 DEFSYMBOL (Qborder_color); | |
3676 DEFSYMBOL (Qborder_width); | |
428 | 3677 /* Qwidth, Qheight, Qleft, Qtop in general.c */ |
563 | 3678 DEFSYMBOL (Qset_specifier); |
3679 DEFSYMBOL (Qset_face_property); | |
3680 DEFSYMBOL (Qface_property_instance); | |
3681 DEFSYMBOL (Qframe_property_alias); | |
428 | 3682 |
3683 DEFSUBR (Fmake_frame); | |
3684 DEFSUBR (Fframep); | |
3685 DEFSUBR (Fframe_live_p); | |
3686 #if 0 /* FSFmacs */ | |
3687 DEFSUBR (Fignore_event); | |
3688 #endif | |
3689 DEFSUBR (Ffocus_frame); | |
3690 DEFSUBR (Fselect_frame); | |
3691 DEFSUBR (Fselected_frame); | |
3692 DEFSUBR (Factive_minibuffer_window); | |
3693 DEFSUBR (Flast_nonminibuf_frame); | |
3694 DEFSUBR (Fframe_root_window); | |
3695 DEFSUBR (Fframe_selected_window); | |
3696 DEFSUBR (Fset_frame_selected_window); | |
3697 DEFSUBR (Fframe_device); | |
3698 DEFSUBR (Fnext_frame); | |
3699 DEFSUBR (Fprevious_frame); | |
3700 DEFSUBR (Fdelete_frame); | |
3701 DEFSUBR (Fmouse_position); | |
3702 DEFSUBR (Fmouse_pixel_position); | |
3703 DEFSUBR (Fmouse_position_as_motion_event); | |
3704 DEFSUBR (Fset_mouse_position); | |
3705 DEFSUBR (Fset_mouse_pixel_position); | |
3706 DEFSUBR (Fmake_frame_visible); | |
3707 DEFSUBR (Fmake_frame_invisible); | |
3708 DEFSUBR (Ficonify_frame); | |
3709 DEFSUBR (Fdeiconify_frame); | |
3710 DEFSUBR (Fframe_visible_p); | |
3711 DEFSUBR (Fframe_totally_visible_p); | |
3712 DEFSUBR (Fframe_iconified_p); | |
3713 DEFSUBR (Fvisible_frame_list); | |
3714 DEFSUBR (Fraise_frame); | |
3715 DEFSUBR (Flower_frame); | |
442 | 3716 DEFSUBR (Fdisable_frame); |
3717 DEFSUBR (Fenable_frame); | |
428 | 3718 DEFSUBR (Fframe_property); |
3719 DEFSUBR (Fframe_properties); | |
3720 DEFSUBR (Fset_frame_properties); | |
3721 DEFSUBR (Fframe_pixel_height); | |
1125 | 3722 DEFSUBR (Fframe_displayable_pixel_height); |
428 | 3723 DEFSUBR (Fframe_pixel_width); |
1125 | 3724 DEFSUBR (Fframe_displayable_pixel_width); |
428 | 3725 DEFSUBR (Fframe_name); |
3726 DEFSUBR (Fframe_modified_tick); | |
3727 DEFSUBR (Fset_frame_height); | |
3728 DEFSUBR (Fset_frame_width); | |
3729 DEFSUBR (Fset_frame_size); | |
863 | 3730 DEFSUBR (Fset_frame_pixel_height); |
1125 | 3731 DEFSUBR (Fset_frame_displayable_pixel_height); |
863 | 3732 DEFSUBR (Fset_frame_pixel_width); |
1125 | 3733 DEFSUBR (Fset_frame_displayable_pixel_width); |
863 | 3734 DEFSUBR (Fset_frame_pixel_size); |
1125 | 3735 DEFSUBR (Fset_frame_displayable_pixel_size); |
428 | 3736 DEFSUBR (Fset_frame_position); |
3737 DEFSUBR (Fset_frame_pointer); | |
442 | 3738 DEFSUBR (Fprint_job_page_number); |
3739 DEFSUBR (Fprint_job_eject_page); | |
428 | 3740 } |
3741 | |
3742 void | |
3743 vars_of_frame (void) | |
3744 { | |
3745 /* */ | |
3746 Vframe_being_created = Qnil; | |
3747 staticpro (&Vframe_being_created); | |
3748 | |
3749 #ifdef HAVE_CDE | |
3750 Fprovide (intern ("cde")); | |
3751 #endif | |
3752 | |
3753 #if 0 /* FSFmacs stupidity */ | |
3754 xxDEFVAR_LISP ("emacs-iconified", &Vemacs_iconified /* | |
3755 Non-nil if all of emacs is iconified and frame updates are not needed. | |
3756 */ ); | |
3757 Vemacs_iconified = Qnil; | |
3758 #endif | |
3759 | |
3760 DEFVAR_LISP ("select-frame-hook", &Vselect_frame_hook /* | |
3761 Function or functions to run just after a new frame is given the focus. | |
3762 Note that calling `select-frame' does not necessarily set the focus: | |
3763 The actual window-system focus will not be changed until the next time | |
3764 that XEmacs is waiting for an event, and even then, the window manager | |
3765 may refuse the focus-change request. | |
3766 */ ); | |
3767 Vselect_frame_hook = Qnil; | |
3768 | |
3769 DEFVAR_LISP ("deselect-frame-hook", &Vdeselect_frame_hook /* | |
3770 Function or functions to run just before a frame loses the focus. | |
3771 See `select-frame-hook'. | |
3772 */ ); | |
3773 Vdeselect_frame_hook = Qnil; | |
3774 | |
3775 DEFVAR_LISP ("delete-frame-hook", &Vdelete_frame_hook /* | |
3776 Function or functions to call when a frame is deleted. | |
3777 One argument, the about-to-be-deleted frame. | |
3778 */ ); | |
3779 Vdelete_frame_hook = Qnil; | |
3780 | |
3781 DEFVAR_LISP ("create-frame-hook", &Vcreate_frame_hook /* | |
3782 Function or functions to call when a frame is created. | |
3783 One argument, the newly-created frame. | |
3784 */ ); | |
3785 Vcreate_frame_hook = Qnil; | |
3786 | |
3787 DEFVAR_LISP ("mouse-enter-frame-hook", &Vmouse_enter_frame_hook /* | |
3788 Function or functions to call when the mouse enters a frame. | |
3789 One argument, the frame. | |
3790 Be careful not to make assumptions about the window manager's focus model. | |
3791 In most cases, the `deselect-frame-hook' is more appropriate. | |
3792 */ ); | |
3793 Vmouse_enter_frame_hook = Qnil; | |
3794 | |
3795 DEFVAR_LISP ("mouse-leave-frame-hook", &Vmouse_leave_frame_hook /* | |
3796 Function or functions to call when the mouse leaves a frame. | |
3797 One argument, the frame. | |
3798 Be careful not to make assumptions about the window manager's focus model. | |
3799 In most cases, the `select-frame-hook' is more appropriate. | |
3800 */ ); | |
3801 Vmouse_leave_frame_hook = Qnil; | |
3802 | |
3803 DEFVAR_LISP ("map-frame-hook", &Vmap_frame_hook /* | |
3804 Function or functions to call when a frame is mapped. | |
3805 One argument, the frame. | |
3806 */ ); | |
3807 Vmap_frame_hook = Qnil; | |
3808 | |
3809 DEFVAR_LISP ("unmap-frame-hook", &Vunmap_frame_hook /* | |
3810 Function or functions to call when a frame is unmapped. | |
3811 One argument, the frame. | |
3812 */ ); | |
3813 Vunmap_frame_hook = Qnil; | |
3814 | |
3815 DEFVAR_BOOL ("allow-deletion-of-last-visible-frame", | |
3816 &allow_deletion_of_last_visible_frame /* | |
3817 *Non-nil means to assume the force option to delete-frame. | |
3818 */ ); | |
3819 allow_deletion_of_last_visible_frame = 0; | |
3820 | |
3821 DEFVAR_LISP ("adjust-frame-function", &Vadjust_frame_function /* | |
3822 Function or constant controlling adjustment of frame. | |
3823 When scrollbars, toolbars, default font etc. change in frame, the frame | |
3824 needs to be adjusted. The adjustment is controlled by this variable. | |
3825 Legal values are: | |
3826 nil to keep character frame size unchanged when possible (resize) | |
3827 t to keep pixel size unchanged (never resize) | |
3828 function symbol or lambda form. This function must return boolean | |
3829 value which is treated as above. Function is passed one parameter, | |
3830 the frame being adjusted. It function should not modify or delete | |
3831 the frame. | |
3832 */ ); | |
3833 Vadjust_frame_function = Qnil; | |
3834 | |
3835 DEFVAR_LISP ("mouse-motion-handler", &Vmouse_motion_handler /* | |
3577 | 3836 Handler for motion events. Must be a function taking one argument, the event. |
428 | 3837 For most applications, you should use `mode-motion-hook' instead of this. |
3577 | 3838 The default value is `default-mouse-motion-handler'. |
3839 | |
3840 Note that this is NOT a hook variable, so there is no standard way to remove | |
3841 actions from it. Instead, when adding a new kind of action, a hook variable | |
3842 should be defined and initialized to the current value of this variable, then | |
3843 this variable set to a function that runs the new hook. To disable the new | |
3844 actions, use `remove-hook' rather than setting `mouse-motion-handler'. | |
3845 | |
3846 `mouse-motion-hook' in the balloon-help library exemplifies this pattern. | |
428 | 3847 */ ); |
3848 Vmouse_motion_handler = Qnil; | |
3849 | |
3850 DEFVAR_LISP ("synchronize-minibuffers",&Vsynchronize_minibuffers /* | |
3851 Set to t if all minibuffer windows are to be synchronized. | |
3852 This will cause echo area messages to appear in the minibuffers of all | |
3853 visible frames. | |
3854 */ ); | |
3855 Vsynchronize_minibuffers = Qnil; | |
3856 | |
3857 DEFVAR_LISP ("frame-title-format", &Vframe_title_format /* | |
442 | 3858 Controls the title of the window-system window of the selected frame. |
428 | 3859 This is the same format as `modeline-format' with the exception that |
3860 %- is ignored. | |
3861 */ ); | |
442 | 3862 /* #### I would change this unilaterally but for the wrath of the Kyles |
3863 of the world. */ | |
3864 #ifdef WIN32_NATIVE | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4846
diff
changeset
|
3865 Vframe_title_format = build_ascstring ("%b - XEmacs"); |
442 | 3866 #else |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4846
diff
changeset
|
3867 Vframe_title_format = build_ascstring ("%S: %b"); |
442 | 3868 #endif |
428 | 3869 |
3870 DEFVAR_LISP ("frame-icon-title-format", &Vframe_icon_title_format /* | |
3871 Controls the title of the icon corresponding to the selected frame. | |
3872 See also the variable `frame-title-format'. | |
3873 */ ); | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4846
diff
changeset
|
3874 Vframe_icon_title_format = build_ascstring ("%b"); |
428 | 3875 |
3876 DEFVAR_LISP ("default-frame-name", &Vdefault_frame_name /* | |
3877 The default name to assign to newly-created frames. | |
442 | 3878 This can be overridden by arguments to `make-frame'. This must be a string. |
3879 This is used primarily for picking up X resources, and is *not* the title | |
3880 of the frame. (See `frame-title-format'.) | |
2681 | 3881 |
3882 Previous to 21.5.21, this defaulted to `emacs'; since that release, it has | |
3883 defaulted to `XEmacs'. In the short term you can restore the old default by | |
3884 setting the environment variable USE_EMACS_AS_DEFAULT_APPLICATION_CLASS | |
3885 (which does affect the frame name, despite what it's called) to some value | |
3886 before starting XEmacs, but this is deprecated. | |
428 | 3887 */ ); |
2681 | 3888 Vdefault_frame_name = Qnil; |
428 | 3889 |
3890 DEFVAR_LISP ("default-frame-plist", &Vdefault_frame_plist /* | |
3891 Plist of default values for frame creation, other than the first one. | |
3892 These may be set in your init file, like this: | |
3893 | |
3894 \(setq default-frame-plist '(width 80 height 55)) | |
3895 | |
2747 | 3896 Predefined properties are described in `set-frame-properties'. |
3897 | |
428 | 3898 The properties may be in alist format for backward compatibility |
3899 but you should not rely on this behavior. | |
3900 | |
3901 These override values given in window system configuration data, | |
2747 | 3902 including X Windows' defaults database. |
3903 | |
3904 Values for the first Emacs frame are taken from `initial-frame-plist'. | |
3905 Since the first X frame is created before loading your .emacs file, you | |
3906 may wish use the X resource database to avoid flashing. | |
3907 | |
428 | 3908 For values specific to the separate minibuffer frame, see |
2747 | 3909 `minibuffer-frame-plist'. See also the variables `default-x-frame-plist' |
3910 and `default-tty-frame-plist', which are like `default-frame-plist' | |
3911 except that they apply only to X or tty frames, respectively \(whereas | |
3912 `default-frame-plist' applies to all types of frames). | |
428 | 3913 */ ); |
3914 Vdefault_frame_plist = Qnil; | |
3915 | |
3916 DEFVAR_LISP ("frame-icon-glyph", &Vframe_icon_glyph /* | |
3917 Icon glyph used to iconify a frame. | |
3918 */ ); | |
3919 } | |
3920 | |
3921 void | |
3922 complex_vars_of_frame (void) | |
3923 { | |
3924 Vframe_icon_glyph = allocate_glyph (GLYPH_ICON, icon_glyph_changed); | |
3925 } |