aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXue Fuqiao2013-08-04 10:59:08 +0800
committerXue Fuqiao2013-08-04 10:59:08 +0800
commit99191b89ff64172740add88e67f163619a07830c (patch)
tree828d1ac7c917076703b9d4a3746ff7480bd97f0d /src
parentab419665caa6e2ad7465cf59ef902cc4ad1d2117 (diff)
parent2ad0a067728ccc7f8b32b0c3db1677ca351943fe (diff)
downloademacs-99191b89ff64172740add88e67f163619a07830c.tar.gz
emacs-99191b89ff64172740add88e67f163619a07830c.zip
Merge from mainline.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog196
-rw-r--r--src/callproc.c5
-rw-r--r--src/coding.c2
-rw-r--r--src/composite.c30
-rw-r--r--src/composite.h88
-rw-r--r--src/data.c4
-rw-r--r--src/eval.c124
-rw-r--r--src/fileio.c2
-rw-r--r--src/fns.c2
-rw-r--r--src/font.c107
-rw-r--r--src/font.h59
-rw-r--r--src/fontset.c21
-rw-r--r--src/fontset.h6
-rw-r--r--src/frame.c74
-rw-r--r--src/frame.h25
-rw-r--r--src/ftfont.c24
-rw-r--r--src/ftxfont.c22
-rw-r--r--src/gtkutil.c126
-rw-r--r--src/gtkutil.h46
-rw-r--r--src/image.c14
-rw-r--r--src/insdel.c22
-rw-r--r--src/keyboard.c12
-rw-r--r--src/lisp.h1
-rw-r--r--src/menu.c9
-rw-r--r--src/menu.h10
-rw-r--r--src/msdos.c18
-rw-r--r--src/msdos.h2
-rw-r--r--src/nsfns.m27
-rw-r--r--src/nsfont.m28
-rw-r--r--src/nsmenu.m6
-rw-r--r--src/nsterm.h13
-rw-r--r--src/nsterm.m58
-rw-r--r--src/scroll.c12
-rw-r--r--src/term.c28
-rw-r--r--src/terminal.c4
-rw-r--r--src/w32fns.c42
-rw-r--r--src/w32font.c41
-rw-r--r--src/w32font.h10
-rw-r--r--src/w32inevt.c12
-rw-r--r--src/w32inevt.h2
-rw-r--r--src/w32menu.c32
-rw-r--r--src/w32notify.c2
-rw-r--r--src/w32term.c59
-rw-r--r--src/w32term.h4
-rw-r--r--src/w32uniscribe.c23
-rw-r--r--src/w32xfns.c8
-rw-r--r--src/widget.c36
-rw-r--r--src/window.c4
-rw-r--r--src/xdisp.c10
-rw-r--r--src/xfaces.c13
-rw-r--r--src/xfns.c55
-rw-r--r--src/xfont.c35
-rw-r--r--src/xftfont.c28
-rw-r--r--src/xmenu.c89
-rw-r--r--src/xselect.c4
-rw-r--r--src/xterm.c103
-rw-r--r--src/xterm.h6
57 files changed, 956 insertions, 889 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index bfe4dfaf39a..69e00cadbe9 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,191 @@
12013-08-03 Paul Eggert <eggert@cs.ucla.edu>
2
3 * composite.h: Minor fixups.
4 (composition_registered_p): Rename from COMPOSITION_REGISTERD_P
5 to fix a misspelling, and change it to an inline function while
6 we're at it (it need not be a macro). All uses changed.
7 (composition_method, composition_valid_p):
8 Rewrite to avoid assignments in if-conditions.
9
102013-08-03 Dmitry Antipov <dmantipov@yandex.ru>
11
12 Do not use global Lisp_Object in composition macros.
13 * composite.h (composition_temp): Remove declaration.
14 (COMPOSITION_METHOD, COMPOSITION_VALID_P): Replace with...
15 (composition_method, composition_valid_p): ...inline functions.
16 (compose_region): Remove the leftover.
17 * composite.c (composition_temp): Remove.
18 (run_composition_function, update_compositions)
19 (composition_compute_stop_pos, composition_adjust_point)
20 (Ffind_composition_internal):
21 * coding.c (handle_composition_annotation):
22 * xdisp.c (handle_composition_prop, check_point_in_composition):
23 Related users changed.
24
252013-08-03 Dmitry Antipov <dmantipov@yandex.ru>
26
27 Drop FRAME_PTR typedef.
28 * composite.c, font.c, font.h, fontset.c, fontset.h, frame.c, frame.h:
29 * ftfont.c, ftxfont.c, gtkutil.c, gtkutil.h, image.c, keyboard.c:
30 * menu.c, menu.h, msdos.c, nsfns.m, nsfont.m, nsmenu.m, nsterm.h:
31 * nsterm.m, scroll.c, term.c, w32fns.c, w32font.c, w32font.h:
32 * w32inevt.c, w32inevt.h, w32menu.c, w32notify.c, w32term.c, w32term.h:
33 * w32uniscribe.c, w32xfns.c, widget.c, window.c, xdisp.c, xfaces.c:
34 * xfns.c, xfont.c, xftfont.c, xmenu.c, xselect.c, xterm.c:
35 All related users changed.
36
372013-08-02 Stefan Monnier <monnier@iro.umontreal.ca>
38
39 * eval.c (default_toplevel_binding): New function.
40 (Fdefvar): Use it.
41 (unbind_to, backtrace_eval_unrewind): Do a bit of CSE simplification.
42 (Fdefault_toplevel_value, Fset_default_toplevel_value): New subrs.
43 (syms_of_eval): Export them.
44 * data.c (Fdefault_value): Micro cleanup.
45 * term.c (init_tty): Use "false".
46
472013-08-02 Dmitry Antipov <dmantipov@yandex.ru>
48
49 Fix X GC leak in GTK and raw (no toolkit) X ports.
50 * xterm.c (x_free_frame_resources): If white and black relief
51 GCs are allocated, always free them here.
52 * xfns.c (x_make_gc): Omit redundant initialization.
53 * widget.c (create_frame_gcs): Remove the leftover.
54 (EmacsFrameDestroy): Do nothing because all GCs are now freed
55 in x_free_frame_resources.
56
572013-08-02 Jan Djärv <jan.h.d@swipnet.se>
58
59 * nsterm.m (windowWillResize:toSize:): Only change title if
60 ! maximizing_resize && FULLSCREEN_NONE (Bug#15005). strdup title before
61 modifying it.
62 (viewDidEndLiveResize): New method.
63
64 * nsterm.h (EmacsView): Add maximizing_resize, put it and old_title
65 inside NS_IMPL_COCOA.
66
672013-08-02 Dmitry Antipov <dmantipov@yandex.ru>
68
69 * insdel.c (adjust_after_replace, replace_range, del_range_2):
70 Do not check whether undo is enabled because record_insert and
71 record_delete does that themselves.
72
732013-08-02 Dmitry Antipov <dmantipov@yandex.ru>
74
75 * xterm.h (struct x_output) [HAVE_X_I18N]: Remove xic_base_fontname
76 member which is not really used any more.
77 (FRAME_XIC_BASE_FONTNAME): Remove.
78 * xfns.c (xic_free_fontset): Adjust user.
79 * xmenu.c (mouse_position_for_popup, x_activate_menubar)
80 (update_frame_menubar, set_frame_menubar, free_frame_menubar)
81 (create_and_show_popup_menu, xmenu_show, create_and_show_dialog)
82 (xdialog_show): Use eassert for debugging check.
83 * w32term.c (x_unfocus_frame): Remove unused dummy function.
84
852013-08-01 Paul Eggert <eggert@cs.ucla.edu>
86
87 * fileio.c, fns.c (merge): Move extern decl from here ...
88 * lisp.h (merge): ... to here.
89
902013-08-01 Dmitry Antipov <dmantipov@yandex.ru>
91
92 Fix last font-related change.
93 * w32font.h (w32font_list_internal, w32font_match_internal):
94 Fix prototype.
95 * w32uniscribe.c (uniscribe_list, uniscribe_match):
96 (uniscribe_list_family): Adjust to match font API change.
97 MS-Windows breakage reported by Juanma Barranquero <lekktu@gmail.com>
98 at http://lists.gnu.org/archive/html/emacs-devel/2013-08/msg00006.html.
99
1002013-08-01 Dmitry Antipov <dmantipov@yandex.ru>
101
102 * frame.h (FRAME_MOUSE_UPDATE):
103 * nsterm.m (ns_frame_up_to_date): Omit redundant check
104 whether hlinfo->mouse_face_mouse_frame is non-NULL.
105
1062013-08-01 Dmitry Antipov <dmantipov@yandex.ru>
107
108 Avoid redundant Lisp_Object <-> struct frame conversions in font API.
109 * font.h (struct font_driver): Change list, match, and list_family
110 functions to accept struct frame * as first arg.
111 * font.c (font_score, font_compare, font_sort_entities): Remove
112 prototypes.
113 (font_sort_entities, font_list_entities, font_select_entity):
114 (font_find_for_lface, Flist_fonts, Ffont_family_list): Adjust to
115 match font API change.
116 * xfont.c (xfont_list, xfont_match, xfont_list_family):
117 * ftfont.c (ftfont_list, ftfont_match, ftfont_list_family):
118 * ftxfont.c (ftxfont_list, ftxfont_match):
119 * xftfont.c (xftfont_list, xftfont_match):
120 * nsfont.m (nsfont_list, nsfont_match, nsfont_list_family):
121 * w32font.c (w32font_list, w32font_match, w32font_list):
122 (w32font_list_internal, w32_font_match_internal): Likewise.
123 * xfaces.c (Fx_family_fonts): Adjust user.
124
1252013-08-01 Dmitry Antipov <dmantipov@yandex.ru>
126
127 Do not use pure Xism x_wm_set_icon_position in non-X ports.
128 * frame.c (x_set_frame_parameters): Call to x_wm_set_icon_position
129 only if HAVE_X_WINDOWS is in use.
130 * frame.h (x_set_frame_parameters): Move under HAVE_X_WINDOWS.
131 * nsterm.m (x_wm_set_icon_position): Remove no-op.
132 * w32term.c (x_wm_set_icon_position): Likewise.
133 * w32fns.c (x_icon): Adjust user.
134
1352013-08-01 Dmitry Antipov <dmantipov@yandex.ru>
136
137 * xterm.c (last_mouse_press_frame): Remove the
138 leftover which is not really used any more.
139 (handle_one_xevent, syms_of_xterm): Adjust users.
140 (x_flush): Call XFlush once per each X display, not frame.
141 This is better because this code always unconditionally skips
142 non-X frames in Vframe_list and issues the only XFlush if we
143 have more than one X frame on the same X display.
144 (any_help_event_p, x_draw_glyph_string_background, x_display_ok):
145 Use bool for booleans.
146 (x_draw_glyph_string_background, cvt_string_to_pixel):
147 (cvt_pixel_dtor): Drop unnecessary prototypes.
148 * xterm.h (x_display_ok): Adjust prototype.
149
1502013-07-31 Dmitry Antipov <dmantipov@yandex.ru>
151
152 Drop unnecessary functions that deals with frame pixel size.
153 * frame.h, msdos.h, w32term.h, xterm.h (x_pixel_width)
154 (x_pixel_height): Drop prototypes.
155 * msdos.c, nsfns.m, w32fns.c, xfns.c (x_pixel_width)
156 (x_pixel_height): Drop implementations.
157 * frame.c (Fframe_pixel_height): Use FRAME_PIXEL_HEIGHT
158 which should be always valid for window frame.
159 (Frame_pixel_width): Likewise with FRAME_PIXEL_WIDTH.
160 * w32menu.c (Fx_popup_dialog):
161 * xmenu.c (Fx_popup_dialog): Likewise for both.
162
1632013-07-31 Dmitry Antipov <dmantipov@yandex.ru>
164
165 * frame.c (Fmake_terminal_frame): Use store_in_alist to setup
166 frame parameters and call to Fmodify_frame_parameters just once.
167 (Fset_frame_height, Fset_frame_width): Mention nil frame in docstring.
168 (Fset_frame_size, Fset_frame_position): Use decode_live_frame
169 and mention nil frame in docstring.
170
1712013-07-31 Dmitry Antipov <dmantipov@yandex.ru>
172
173 * frame.c (make_frame, x_set_frame_parameters): Use bool for boolean.
174 (x_figure_window_size): Likewise. Adjust to return long.
175 (syms_of_frame): Do not DEFSYM Qterminal_live_p.
176 (toplevel): Move Qterminal_live_p to...
177 * terminal.c (toplevel): ...here, make it static, and...
178 (syms_of_terminal): ...DEFSYM here.
179 * frame.h (Qterminal_live_p): Remove declaration.
180 (make_frame, x_figure_window_size): Adjust prototype.
181 * nsfns.m (Fx_create_frame): Use long for window flags.
182
1832013-07-30 Paul Eggert <eggert@cs.ucla.edu>
184
185 Fix tempfile bug on platforms lacking mkostemp and mkstemp (Bug#14986).
186 * callproc.c (create_temp_file) [! (HAVE_MKOSTEMP || HAVE_MKSTEMP)]:
187 Do not assume that emacs_close (INT_MAX) is a no-op.
188
12013-07-30 Dmitry Antipov <dmantipov@yandex.ru> 1892013-07-30 Dmitry Antipov <dmantipov@yandex.ru>
2 190
3 * xfaces.c (make_face_cache): For struct face_cache, prefer 191 * xfaces.c (make_face_cache): For struct face_cache, prefer
@@ -325,7 +513,7 @@
325 code a bit. It makes no difference on POSIXish platforms but 513 code a bit. It makes no difference on POSIXish platforms but
326 apparently it fixes a bug on w32. 514 apparently it fixes a bug on w32.
327 515
328 Fix bug where insert-file-contents closes a file twice. (Bug#14839). 516 Fix bug where insert-file-contents closes a file twice (Bug#14839).
329 * fileio.c (close_file_unwind): Don't close if FD is negative; 517 * fileio.c (close_file_unwind): Don't close if FD is negative;
330 this can happen when unwinding a zapped file descriptor. 518 this can happen when unwinding a zapped file descriptor.
331 (Finsert_file_contents): Unwind-protect the fd before the point marker, 519 (Finsert_file_contents): Unwind-protect the fd before the point marker,
@@ -478,7 +666,7 @@
478 (make_lispy_focus_in, make_lispy_focus_out): Declare and define. 666 (make_lispy_focus_in, make_lispy_focus_out): Declare and define.
479 (kbd_buffer_get_event): For FOCUS_IN, make a focus_in event if no 667 (kbd_buffer_get_event): For FOCUS_IN, make a focus_in event if no
480 switch frame event is made. Check ! NILP (event->arg) if X11 (moved 668 switch frame event is made. Check ! NILP (event->arg) if X11 (moved
481 from xterm.c). Make focus_out event for FOCUS_OUT_EVENT if NS or X11 669 from xterm.c). Make focus_out event for FOCUS_OUT_EVENT if NS or X11
482 and there is a focused frame. 670 and there is a focused frame.
483 (head_table): Add focus-in and focus-out. 671 (head_table): Add focus-in and focus-out.
484 (keys_of_keyboard): Add focus-in and focus-out to Vspecial_event_map, 672 (keys_of_keyboard): Add focus-in and focus-out to Vspecial_event_map,
@@ -851,7 +1039,7 @@
851 (emacswrite_sig, emacs_perror): New functions. 1039 (emacswrite_sig, emacs_perror): New functions.
852 * xrdb.c (fatal): Don't invoke perror, since errno might be garbage. 1040 * xrdb.c (fatal): Don't invoke perror, since errno might be garbage.
853 1041
8542013-07-08 Magnus Henoch <magnus.henoch@gmail.com> (tiny change). 10422013-07-08 Magnus Henoch <magnus.henoch@gmail.com> (tiny change)
855 1043
856 * image.c (imagemagick_load_image): Do not use MagickExportImagePixels 1044 * image.c (imagemagick_load_image): Do not use MagickExportImagePixels
857 on NS even if it is present. Pixmap on NS is a void*. 1045 on NS even if it is present. Pixmap on NS is a void*.
@@ -1526,7 +1714,7 @@
1526 Now static. 1714 Now static.
1527 * lisp.h: Remove the abovementioned defns and decls. 1715 * lisp.h: Remove the abovementioned defns and decls.
1528 1716
1529 Use functions, not macros, for XINT etc. (Bug#11935). 1717 Use functions, not macros, for XINT etc (Bug#11935).
1530 In lisp.h, prefer functions to function-like macros, and 1718 In lisp.h, prefer functions to function-like macros, and
1531 constants to object-like macros, when either will do. This: 1719 constants to object-like macros, when either will do. This:
1532 . simplifies use, as there's no more need to worry about 1720 . simplifies use, as there's no more need to worry about
diff --git a/src/callproc.c b/src/callproc.c
index 91f29bd589b..450fc57f929 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1018,13 +1018,14 @@ create_temp_file (ptrdiff_t nargs, Lisp_Object *args)
1018#else 1018#else
1019 errno = EEXIST; 1019 errno = EEXIST;
1020 mktemp (tempfile); 1020 mktemp (tempfile);
1021 /* INT_MAX denotes success, because close (INT_MAX) does nothing. */ 1021 fd = *tempfile ? 0 : -1;
1022 fd = *tempfile ? INT_MAX : -1;
1023#endif 1022#endif
1024 if (fd < 0) 1023 if (fd < 0)
1025 report_file_error ("Failed to open temporary file using pattern", 1024 report_file_error ("Failed to open temporary file using pattern",
1026 pattern); 1025 pattern);
1026#if defined HAVE_MKOSTEMP || defined HAVE_MKSTEMP
1027 emacs_close (fd); 1027 emacs_close (fd);
1028#endif
1028 } 1029 }
1029 1030
1030 record_unwind_protect (delete_temp_file, filename_string); 1031 record_unwind_protect (delete_temp_file, filename_string);
diff --git a/src/coding.c b/src/coding.c
index 0cdd8f9cd9e..5b637627763 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -7497,7 +7497,7 @@ handle_composition_annotation (ptrdiff_t pos, ptrdiff_t limit,
7497 /* We found a composition. Store the corresponding 7497 /* We found a composition. Store the corresponding
7498 annotation data in BUF. */ 7498 annotation data in BUF. */
7499 int *head = buf; 7499 int *head = buf;
7500 enum composition_method method = COMPOSITION_METHOD (prop); 7500 enum composition_method method = composition_method (prop);
7501 int nchars = COMPOSITION_LENGTH (prop); 7501 int nchars = COMPOSITION_LENGTH (prop);
7502 7502
7503 ADD_COMPOSITION_DATA (buf, nchars, 0, method); 7503 ADD_COMPOSITION_DATA (buf, nchars, 0, method);
diff --git a/src/composite.c b/src/composite.c
index 99b5da22af5..28942fe4f74 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -160,10 +160,6 @@ static Lisp_Object Qauto_composition_function;
160 auto-compositions. */ 160 auto-compositions. */
161#define MAX_AUTO_COMPOSITION_LOOKBACK 3 161#define MAX_AUTO_COMPOSITION_LOOKBACK 3
162 162
163/* Temporary variable used in macros COMPOSITION_XXX. */
164Lisp_Object composition_temp;
165
166
167/* Return COMPOSITION-ID of a composition at buffer position 163/* Return COMPOSITION-ID of a composition at buffer position
168 CHARPOS/BYTEPOS and length NCHARS. The `composition' property of 164 CHARPOS/BYTEPOS and length NCHARS. The `composition' property of
169 the sequence is PROP. STRING, if non-nil, is a string that 165 the sequence is PROP. STRING, if non-nil, is a string that
@@ -478,11 +474,11 @@ run_composition_function (ptrdiff_t from, ptrdiff_t to, Lisp_Object prop)
478 valid too. */ 474 valid too. */
479 if (from > BEGV 475 if (from > BEGV
480 && find_composition (from - 1, -1, &start, &end, &prop, Qnil) 476 && find_composition (from - 1, -1, &start, &end, &prop, Qnil)
481 && !COMPOSITION_VALID_P (start, end, prop)) 477 && !composition_valid_p (start, end, prop))
482 from = start; 478 from = start;
483 if (to < ZV 479 if (to < ZV
484 && find_composition (to, -1, &start, &end, &prop, Qnil) 480 && find_composition (to, -1, &start, &end, &prop, Qnil)
485 && !COMPOSITION_VALID_P (start, end, prop)) 481 && !composition_valid_p (start, end, prop))
486 to = end; 482 to = end;
487 if (!NILP (Ffboundp (func))) 483 if (!NILP (Ffboundp (func)))
488 call2 (func, make_number (from), make_number (to)); 484 call2 (func, make_number (from), make_number (to));
@@ -524,7 +520,7 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int check_mask)
524 latter to the copy of it. */ 520 latter to the copy of it. */
525 if (from > BEGV 521 if (from > BEGV
526 && find_composition (from - 1, -1, &start, &end, &prop, Qnil) 522 && find_composition (from - 1, -1, &start, &end, &prop, Qnil)
527 && COMPOSITION_VALID_P (start, end, prop)) 523 && composition_valid_p (start, end, prop))
528 { 524 {
529 min_pos = start; 525 min_pos = start;
530 if (end > to) 526 if (end > to)
@@ -538,7 +534,7 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int check_mask)
538 } 534 }
539 else if (from < ZV 535 else if (from < ZV
540 && find_composition (from, -1, &start, &from, &prop, Qnil) 536 && find_composition (from, -1, &start, &from, &prop, Qnil)
541 && COMPOSITION_VALID_P (start, from, prop)) 537 && composition_valid_p (start, from, prop))
542 { 538 {
543 if (from > to) 539 if (from > to)
544 max_pos = from; 540 max_pos = from;
@@ -553,7 +549,7 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int check_mask)
553 (to - 1). */ 549 (to - 1). */
554 while (from < to - 1 550 while (from < to - 1
555 && find_composition (from, to, &start, &from, &prop, Qnil) 551 && find_composition (from, to, &start, &from, &prop, Qnil)
556 && COMPOSITION_VALID_P (start, from, prop) 552 && composition_valid_p (start, from, prop)
557 && from < to - 1) 553 && from < to - 1)
558 run_composition_function (start, from, prop); 554 run_composition_function (start, from, prop);
559 } 555 }
@@ -562,7 +558,7 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int check_mask)
562 { 558 {
563 if (from < to 559 if (from < to
564 && find_composition (to - 1, -1, &start, &end, &prop, Qnil) 560 && find_composition (to - 1, -1, &start, &end, &prop, Qnil)
565 && COMPOSITION_VALID_P (start, end, prop)) 561 && composition_valid_p (start, end, prop))
566 { 562 {
567 /* TO should be also at composition boundary. But, 563 /* TO should be also at composition boundary. But,
568 insertion or deletion will make two compositions adjacent 564 insertion or deletion will make two compositions adjacent
@@ -580,7 +576,7 @@ update_compositions (ptrdiff_t from, ptrdiff_t to, int check_mask)
580 } 576 }
581 else if (to < ZV 577 else if (to < ZV
582 && find_composition (to, -1, &start, &end, &prop, Qnil) 578 && find_composition (to, -1, &start, &end, &prop, Qnil)
583 && COMPOSITION_VALID_P (start, end, prop)) 579 && composition_valid_p (start, end, prop))
584 { 580 {
585 run_composition_function (start, end, prop); 581 run_composition_function (start, end, prop);
586 max_pos = end; 582 max_pos = end;
@@ -901,7 +897,7 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos,
901 Lisp_Object string) 897 Lisp_Object string)
902{ 898{
903 ptrdiff_t count = SPECPDL_INDEX (); 899 ptrdiff_t count = SPECPDL_INDEX ();
904 FRAME_PTR f = XFRAME (win->frame); 900 struct frame *f = XFRAME (win->frame);
905 Lisp_Object pos = make_number (charpos); 901 Lisp_Object pos = make_number (charpos);
906 ptrdiff_t to; 902 ptrdiff_t to;
907 ptrdiff_t pt = PT, pt_byte = PT_BYTE; 903 ptrdiff_t pt = PT, pt_byte = PT_BYTE;
@@ -1012,7 +1008,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos,
1012 if (charpos < endpos 1008 if (charpos < endpos
1013 && find_composition (charpos, endpos, &start, &end, &prop, string) 1009 && find_composition (charpos, endpos, &start, &end, &prop, string)
1014 && start >= charpos 1010 && start >= charpos
1015 && COMPOSITION_VALID_P (start, end, prop)) 1011 && composition_valid_p (start, end, prop))
1016 { 1012 {
1017 cmp_it->stop_pos = endpos = start; 1013 cmp_it->stop_pos = endpos = start;
1018 cmp_it->ch = -1; 1014 cmp_it->ch = -1;
@@ -1672,7 +1668,7 @@ composition_adjust_point (ptrdiff_t last_pt, ptrdiff_t new_pt)
1672 1668
1673 /* At first check the static composition. */ 1669 /* At first check the static composition. */
1674 if (get_property_and_range (new_pt, Qcomposition, &val, &beg, &end, Qnil) 1670 if (get_property_and_range (new_pt, Qcomposition, &val, &beg, &end, Qnil)
1675 && COMPOSITION_VALID_P (beg, end, val)) 1671 && composition_valid_p (beg, end, val))
1676 { 1672 {
1677 if (beg < new_pt /* && end > new_pt <- It's always the case. */ 1673 if (beg < new_pt /* && end > new_pt <- It's always the case. */
1678 && (last_pt <= beg || last_pt >= end)) 1674 && (last_pt <= beg || last_pt >= end))
@@ -1872,12 +1868,12 @@ See `find-composition' for more details. */)
1872 && (e <= XINT (pos) ? e > end : s < start)) 1868 && (e <= XINT (pos) ? e > end : s < start))
1873 return list3 (make_number (s), make_number (e), gstring); 1869 return list3 (make_number (s), make_number (e), gstring);
1874 } 1870 }
1875 if (!COMPOSITION_VALID_P (start, end, prop)) 1871 if (!composition_valid_p (start, end, prop))
1876 return list3 (make_number (start), make_number (end), Qnil); 1872 return list3 (make_number (start), make_number (end), Qnil);
1877 if (NILP (detail_p)) 1873 if (NILP (detail_p))
1878 return list3 (make_number (start), make_number (end), Qt); 1874 return list3 (make_number (start), make_number (end), Qt);
1879 1875
1880 if (COMPOSITION_REGISTERD_P (prop)) 1876 if (composition_registered_p (prop))
1881 id = COMPOSITION_ID (prop); 1877 id = COMPOSITION_ID (prop);
1882 else 1878 else
1883 { 1879 {
@@ -1890,7 +1886,7 @@ See `find-composition' for more details. */)
1890 if (id >= 0) 1886 if (id >= 0)
1891 { 1887 {
1892 Lisp_Object components, relative_p, mod_func; 1888 Lisp_Object components, relative_p, mod_func;
1893 enum composition_method method = COMPOSITION_METHOD (prop); 1889 enum composition_method method = composition_method (prop);
1894 int width = composition_table[id]->width; 1890 int width = composition_table[id]->width;
1895 1891
1896 components = Fcopy_sequence (COMPOSITION_COMPONENTS (prop)); 1892 components = Fcopy_sequence (COMPOSITION_COMPONENTS (prop));
diff --git a/src/composite.h b/src/composite.h
index 603291044bc..53665b36bd1 100644
--- a/src/composite.h
+++ b/src/composite.h
@@ -49,69 +49,41 @@ enum composition_method {
49/* Maximum number of components a single composition can have. */ 49/* Maximum number of components a single composition can have. */
50#define MAX_COMPOSITION_COMPONENTS 16 50#define MAX_COMPOSITION_COMPONENTS 16
51 51
52/* These macros access information about a composition that 52/* These operations access information about a composition that
53 has `composition' property PROP. PROP is: 53 has `composition' property PROP. PROP is:
54 ((LENGTH . COMPONENTS) . MODIFICATION-FUNC) 54 ((LENGTH . COMPONENTS) . MODIFICATION-FUNC)
55 or 55 or
56 (COMPOSITION-ID . (LENGTH COMPONENTS . MODIFICATION-FUNC)) 56 (COMPOSITION-ID . (LENGTH COMPONENTS . MODIFICATION-FUNC))
57 They don't check validity of PROP. */ 57 They don't check validity of PROP. */
58 58
59/* Temporary variable used only in the following macros. */ 59/* Return true if PROP is already registered. */
60extern Lisp_Object composition_temp; 60COMPOSITE_INLINE bool
61 61composition_registered_p (Lisp_Object prop)
62/* Return 1 if the composition is already registered. */ 62{
63#define COMPOSITION_REGISTERD_P(prop) INTEGERP (XCAR (prop)) 63 return INTEGERP (XCAR (prop));
64}
64 65
65/* Return ID number of the already registered composition. */ 66/* Return ID number of the already registered composition. */
66#define COMPOSITION_ID(prop) XINT (XCAR (prop)) 67#define COMPOSITION_ID(prop) XINT (XCAR (prop))
67 68
68/* Return length of the composition. */ 69/* Return length of the composition. */
69#define COMPOSITION_LENGTH(prop) \ 70#define COMPOSITION_LENGTH(prop) \
70 (COMPOSITION_REGISTERD_P (prop) \ 71 (composition_registered_p (prop) \
71 ? XINT (XCAR (XCDR (prop))) \ 72 ? XINT (XCAR (XCDR (prop))) \
72 : XINT (XCAR (XCAR (prop)))) 73 : XINT (XCAR (XCAR (prop))))
73 74
74/* Return components of the composition. */ 75/* Return components of the composition. */
75#define COMPOSITION_COMPONENTS(prop) \ 76#define COMPOSITION_COMPONENTS(prop) \
76 (COMPOSITION_REGISTERD_P (prop) \ 77 (composition_registered_p (prop) \
77 ? XCAR (XCDR (XCDR (prop))) \ 78 ? XCAR (XCDR (XCDR (prop))) \
78 : XCDR (XCAR (prop))) 79 : XCDR (XCAR (prop)))
79 80
80/* Return modification function of the composition. */ 81/* Return modification function of the composition. */
81#define COMPOSITION_MODIFICATION_FUNC(prop) \ 82#define COMPOSITION_MODIFICATION_FUNC(prop) \
82 (COMPOSITION_REGISTERD_P (prop) \ 83 (composition_registered_p (prop) \
83 ? XCDR (XCDR (XCDR (prop))) \ 84 ? XCDR (XCDR (XCDR (prop))) \
84 : CONSP (prop) ? XCDR (prop) : Qnil) 85 : CONSP (prop) ? XCDR (prop) : Qnil)
85 86
86/* Return the method of composition. */
87#define COMPOSITION_METHOD(prop) \
88 (COMPOSITION_REGISTERD_P (prop) \
89 ? composition_table[COMPOSITION_ID (prop)]->method \
90 : (composition_temp = XCDR (XCAR (prop)), \
91 (NILP (composition_temp) \
92 ? COMPOSITION_RELATIVE \
93 : (INTEGERP (composition_temp) || STRINGP (composition_temp)) \
94 ? COMPOSITION_WITH_ALTCHARS \
95 : COMPOSITION_WITH_RULE_ALTCHARS)))
96
97/* Return 1 if the composition is valid. It is valid if length of
98 the composition equals to (END - START). */
99#define COMPOSITION_VALID_P(start, end, prop) \
100 (CONSP (prop) \
101 && (COMPOSITION_REGISTERD_P (prop) \
102 ? (COMPOSITION_ID (prop) >= 0 \
103 && COMPOSITION_ID (prop) <= n_compositions \
104 && CONSP (XCDR (prop))) \
105 : (composition_temp = XCAR (prop), \
106 (CONSP (composition_temp) \
107 && (composition_temp = XCDR (composition_temp), \
108 (NILP (composition_temp) \
109 || STRINGP (composition_temp) \
110 || VECTORP (composition_temp) \
111 || INTEGERP (composition_temp) \
112 || CONSP (composition_temp)))))) \
113 && (end - start) == COMPOSITION_LENGTH (prop))
114
115/* Return the Nth glyph of composition specified by CMP. CMP is a 87/* Return the Nth glyph of composition specified by CMP. CMP is a
116 pointer to `struct composition'. */ 88 pointer to `struct composition'. */
117#define COMPOSITION_GLYPH(cmp, n) \ 89#define COMPOSITION_GLYPH(cmp, n) \
@@ -227,12 +199,48 @@ extern bool find_composition (ptrdiff_t, ptrdiff_t, ptrdiff_t *, ptrdiff_t *,
227 Lisp_Object *, Lisp_Object); 199 Lisp_Object *, Lisp_Object);
228extern void update_compositions (ptrdiff_t, ptrdiff_t, int); 200extern void update_compositions (ptrdiff_t, ptrdiff_t, int);
229extern void make_composition_value_copy (Lisp_Object); 201extern void make_composition_value_copy (Lisp_Object);
230extern void compose_region (int, int, Lisp_Object, Lisp_Object,
231 Lisp_Object);
232extern void syms_of_composite (void); 202extern void syms_of_composite (void);
233extern void compose_text (ptrdiff_t, ptrdiff_t, Lisp_Object, Lisp_Object, 203extern void compose_text (ptrdiff_t, ptrdiff_t, Lisp_Object, Lisp_Object,
234 Lisp_Object); 204 Lisp_Object);
235 205
206/* Return the method of a composition with property PROP. */
207
208COMPOSITE_INLINE enum composition_method
209composition_method (Lisp_Object prop)
210{
211 if (composition_registered_p (prop))
212 return composition_table[COMPOSITION_ID (prop)]->method;
213 else
214 {
215 Lisp_Object temp = XCDR (XCAR (prop));
216 return (NILP (temp)
217 ? COMPOSITION_RELATIVE
218 : INTEGERP (temp) || STRINGP (temp)
219 ? COMPOSITION_WITH_ALTCHARS
220 : COMPOSITION_WITH_RULE_ALTCHARS);
221 }
222}
223
224/* Given offsets START and END, return true if PROP is a valid composition
225 property with length END - START. */
226
227COMPOSITE_INLINE bool
228composition_valid_p (ptrdiff_t start, ptrdiff_t end, Lisp_Object prop)
229{
230 return (CONSP (prop)
231 && (composition_registered_p (prop)
232 ? (COMPOSITION_ID (prop) >= 0
233 && COMPOSITION_ID (prop) <= n_compositions
234 && CONSP (XCDR (prop)))
235 : (CONSP (XCAR (prop))
236 && (NILP (XCDR (XCAR (prop)))
237 || STRINGP (XCDR (XCAR (prop)))
238 || VECTORP (XCDR (XCAR (prop)))
239 || INTEGERP (XCDR (XCAR (prop)))
240 || CONSP (XCDR (XCAR (prop))))))
241 && COMPOSITION_LENGTH (prop) == end - start);
242}
243
236/* Macros for lispy glyph-string. This is completely different from 244/* Macros for lispy glyph-string. This is completely different from
237 struct glyph_string. */ 245 struct glyph_string. */
238 246
diff --git a/src/data.c b/src/data.c
index f04d6da618f..d1e43ac1b5f 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1384,9 +1384,7 @@ for this variable. The default value is meaningful for variables with
1384local bindings in certain buffers. */) 1384local bindings in certain buffers. */)
1385 (Lisp_Object symbol) 1385 (Lisp_Object symbol)
1386{ 1386{
1387 register Lisp_Object value; 1387 Lisp_Object value = default_value (symbol);
1388
1389 value = default_value (symbol);
1390 if (!EQ (value, Qunbound)) 1388 if (!EQ (value, Qunbound))
1391 return value; 1389 return value;
1392 1390
diff --git a/src/eval.c b/src/eval.c
index cb716690e3c..8ee259110f4 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -658,6 +658,51 @@ The return value is BASE-VARIABLE. */)
658 return base_variable; 658 return base_variable;
659} 659}
660 660
661static union specbinding *
662default_toplevel_binding (Lisp_Object symbol)
663{
664 union specbinding *binding = NULL;
665 union specbinding *pdl = specpdl_ptr;
666 while (pdl > specpdl)
667 {
668 switch ((--pdl)->kind)
669 {
670 case SPECPDL_LET_DEFAULT:
671 case SPECPDL_LET:
672 if (EQ (specpdl_symbol (pdl), symbol))
673 binding = pdl;
674 break;
675 }
676 }
677 return binding;
678}
679
680DEFUN ("default-toplevel-value", Fdefault_toplevel_value, Sdefault_toplevel_value, 1, 1, 0,
681 doc: /* Return SYMBOL's toplevel default value.
682"Toplevel" means outside of any let binding. */)
683 (Lisp_Object symbol)
684{
685 union specbinding *binding = default_toplevel_binding (symbol);
686 Lisp_Object value
687 = binding ? specpdl_old_value (binding) : Fdefault_value (symbol);
688 if (!EQ (value, Qunbound))
689 return value;
690 xsignal1 (Qvoid_variable, symbol);
691}
692
693DEFUN ("set-default-toplevel-value", Fset_default_toplevel_value,
694 Sset_default_toplevel_value, 2, 2, 0,
695 doc: /* Set SYMBOL's toplevel default value to VALUE.
696"Toplevel" means outside of any let binding. */)
697 (Lisp_Object symbol, Lisp_Object value)
698{
699 union specbinding *binding = default_toplevel_binding (symbol);
700 if (binding)
701 set_specpdl_old_value (binding, value);
702 else
703 Fset_default (symbol, value);
704 return Qnil;
705}
661 706
662DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0, 707DEFUN ("defvar", Fdefvar, Sdefvar, 1, UNEVALLED, 0,
663 doc: /* Define SYMBOL as a variable, and return SYMBOL. 708 doc: /* Define SYMBOL as a variable, and return SYMBOL.
@@ -706,18 +751,10 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
706 else 751 else
707 { /* Check if there is really a global binding rather than just a let 752 { /* Check if there is really a global binding rather than just a let
708 binding that shadows the global unboundness of the var. */ 753 binding that shadows the global unboundness of the var. */
709 union specbinding *pdl = specpdl_ptr; 754 union specbinding *binding = default_toplevel_binding (sym);
710 while (pdl > specpdl) 755 if (binding && EQ (specpdl_old_value (binding), Qunbound))
711 { 756 {
712 if ((--pdl)->kind >= SPECPDL_LET 757 set_specpdl_old_value (binding, eval_sub (XCAR (tail)));
713 && EQ (specpdl_symbol (pdl), sym)
714 && EQ (specpdl_old_value (pdl), Qunbound))
715 {
716 message_with_string
717 ("Warning: defvar ignored because %s is let-bound",
718 SYMBOL_NAME (sym), 1);
719 break;
720 }
721 } 758 }
722 } 759 }
723 tail = XCDR (tail); 760 tail = XCDR (tail);
@@ -3311,19 +3348,21 @@ unbind_to (ptrdiff_t count, Lisp_Object value)
3311 case SPECPDL_BACKTRACE: 3348 case SPECPDL_BACKTRACE:
3312 break; 3349 break;
3313 case SPECPDL_LET: 3350 case SPECPDL_LET:
3314 /* If variable has a trivial value (no forwarding), we can 3351 { /* If variable has a trivial value (no forwarding), we can
3315 just set it. No need to check for constant symbols here, 3352 just set it. No need to check for constant symbols here,
3316 since that was already done by specbind. */ 3353 since that was already done by specbind. */
3317 if (XSYMBOL (specpdl_symbol (specpdl_ptr))->redirect 3354 struct Lisp_Symbol *sym = XSYMBOL (specpdl_symbol (specpdl_ptr));
3318 == SYMBOL_PLAINVAL) 3355 if (sym->redirect == SYMBOL_PLAINVAL)
3319 SET_SYMBOL_VAL (XSYMBOL (specpdl_symbol (specpdl_ptr)), 3356 {
3320 specpdl_old_value (specpdl_ptr)); 3357 SET_SYMBOL_VAL (sym, specpdl_old_value (specpdl_ptr));
3321 else 3358 break;
3322 /* NOTE: we only ever come here if make_local_foo was used for 3359 }
3323 the first time on this var within this let. */ 3360 else
3324 Fset_default (specpdl_symbol (specpdl_ptr), 3361 { /* FALLTHROUGH!!
3325 specpdl_old_value (specpdl_ptr)); 3362 NOTE: we only ever come here if make_local_foo was used for
3326 break; 3363 the first time on this var within this let. */
3364 }
3365 }
3327 case SPECPDL_LET_DEFAULT: 3366 case SPECPDL_LET_DEFAULT:
3328 Fset_default (specpdl_symbol (specpdl_ptr), 3367 Fset_default (specpdl_symbol (specpdl_ptr),
3329 specpdl_old_value (specpdl_ptr)); 3368 specpdl_old_value (specpdl_ptr));
@@ -3511,24 +3550,23 @@ backtrace_eval_unrewind (int distance)
3511 case SPECPDL_BACKTRACE: 3550 case SPECPDL_BACKTRACE:
3512 break; 3551 break;
3513 case SPECPDL_LET: 3552 case SPECPDL_LET:
3514 /* If variable has a trivial value (no forwarding), we can 3553 { /* If variable has a trivial value (no forwarding), we can
3515 just set it. No need to check for constant symbols here, 3554 just set it. No need to check for constant symbols here,
3516 since that was already done by specbind. */ 3555 since that was already done by specbind. */
3517 if (XSYMBOL (specpdl_symbol (tmp))->redirect 3556 struct Lisp_Symbol *sym = XSYMBOL (specpdl_symbol (tmp));
3518 == SYMBOL_PLAINVAL) 3557 if (sym->redirect == SYMBOL_PLAINVAL)
3519 { 3558 {
3520 struct Lisp_Symbol *sym = XSYMBOL (specpdl_symbol (tmp)); 3559 Lisp_Object old_value = specpdl_old_value (tmp);
3521 Lisp_Object old_value = specpdl_old_value (tmp); 3560 set_specpdl_old_value (tmp, SYMBOL_VAL (sym));
3522 set_specpdl_old_value (tmp, SYMBOL_VAL (sym)); 3561 SET_SYMBOL_VAL (sym, old_value);
3523 SET_SYMBOL_VAL (sym, old_value); 3562 break;
3524 break; 3563 }
3525 } 3564 else
3526 else 3565 { /* FALLTHROUGH!!
3527 { 3566 NOTE: we only ever come here if make_local_foo was used for
3528 /* FALLTHROUGH! 3567 the first time on this var within this let. */
3529 NOTE: we only ever come here if make_local_foo was used for 3568 }
3530 the first time on this var within this let. */ 3569 }
3531 }
3532 case SPECPDL_LET_DEFAULT: 3570 case SPECPDL_LET_DEFAULT:
3533 { 3571 {
3534 Lisp_Object sym = specpdl_symbol (tmp); 3572 Lisp_Object sym = specpdl_symbol (tmp);
@@ -3796,6 +3834,8 @@ alist of active lexical bindings. */);
3796 defsubr (&Ssetq); 3834 defsubr (&Ssetq);
3797 defsubr (&Squote); 3835 defsubr (&Squote);
3798 defsubr (&Sfunction); 3836 defsubr (&Sfunction);
3837 defsubr (&Sdefault_toplevel_value);
3838 defsubr (&Sset_default_toplevel_value);
3799 defsubr (&Sdefvar); 3839 defsubr (&Sdefvar);
3800 defsubr (&Sdefvaralias); 3840 defsubr (&Sdefvaralias);
3801 defsubr (&Sdefconst); 3841 defsubr (&Sdefconst);
diff --git a/src/fileio.c b/src/fileio.c
index c47b3533145..59e84053773 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5096,8 +5096,6 @@ This calls `write-region-annotate-functions' at the start, and
5096 return Qnil; 5096 return Qnil;
5097} 5097}
5098 5098
5099Lisp_Object merge (Lisp_Object, Lisp_Object, Lisp_Object);
5100
5101DEFUN ("car-less-than-car", Fcar_less_than_car, Scar_less_than_car, 2, 2, 0, 5099DEFUN ("car-less-than-car", Fcar_less_than_car, Scar_less_than_car, 2, 2, 0,
5102 doc: /* Return t if (car A) is numerically less than (car B). */) 5100 doc: /* Return t if (car A) is numerically less than (car B). */)
5103 (Lisp_Object a, Lisp_Object b) 5101 (Lisp_Object a, Lisp_Object b)
diff --git a/src/fns.c b/src/fns.c
index 6f81635ab9d..de90fd731fb 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1738,8 +1738,6 @@ See also the function `nreverse', which is used more often. */)
1738 return new; 1738 return new;
1739} 1739}
1740 1740
1741Lisp_Object merge (Lisp_Object org_l1, Lisp_Object org_l2, Lisp_Object pred);
1742
1743DEFUN ("sort", Fsort, Ssort, 2, 2, 0, 1741DEFUN ("sort", Fsort, Ssort, 2, 2, 0,
1744 doc: /* Sort LIST, stably, comparing elements using PREDICATE. 1742 doc: /* Sort LIST, stably, comparing elements using PREDICATE.
1745Returns the sorted list. LIST is modified by side effects. 1743Returns the sorted list. LIST is modified by side effects.
diff --git a/src/font.c b/src/font.c
index 124d5f9bd9e..073487b540d 100644
--- a/src/font.c
+++ b/src/font.c
@@ -204,9 +204,9 @@ font_make_object (int size, Lisp_Object entity, int pixelsize)
204 204
205 205
206 206
207static int font_pixel_size (FRAME_PTR f, Lisp_Object); 207static int font_pixel_size (struct frame *f, Lisp_Object);
208static Lisp_Object font_open_entity (FRAME_PTR, Lisp_Object, int); 208static Lisp_Object font_open_entity (struct frame *, Lisp_Object, int);
209static Lisp_Object font_matching_entity (FRAME_PTR, Lisp_Object *, 209static Lisp_Object font_matching_entity (struct frame *, Lisp_Object *,
210 Lisp_Object); 210 Lisp_Object);
211static unsigned font_encode_char (Lisp_Object, int); 211static unsigned font_encode_char (Lisp_Object, int);
212 212
@@ -269,7 +269,7 @@ font_intern_prop (const char *str, ptrdiff_t len, bool force_symbol)
269/* Return a pixel size of font-spec SPEC on frame F. */ 269/* Return a pixel size of font-spec SPEC on frame F. */
270 270
271static int 271static int
272font_pixel_size (FRAME_PTR f, Lisp_Object spec) 272font_pixel_size (struct frame *f, Lisp_Object spec)
273{ 273{
274#ifdef HAVE_WINDOW_SYSTEM 274#ifdef HAVE_WINDOW_SYSTEM
275 Lisp_Object size = AREF (spec, FONT_SIZE_INDEX); 275 Lisp_Object size = AREF (spec, FONT_SIZE_INDEX);
@@ -2037,11 +2037,6 @@ font_otf_Anchor (OTF_Anchor *anchor)
2037 2037
2038/* Font sorting. */ 2038/* Font sorting. */
2039 2039
2040static unsigned font_score (Lisp_Object, Lisp_Object *);
2041static int font_compare (const void *, const void *);
2042static Lisp_Object font_sort_entities (Lisp_Object, Lisp_Object,
2043 Lisp_Object, int);
2044
2045static double 2040static double
2046font_rescale_ratio (Lisp_Object font_entity) 2041font_rescale_ratio (Lisp_Object font_entity)
2047{ 2042{
@@ -2186,14 +2181,14 @@ font_compare (const void *d1, const void *d2)
2186 such a case. */ 2181 such a case. */
2187 2182
2188static Lisp_Object 2183static Lisp_Object
2189font_sort_entities (Lisp_Object list, Lisp_Object prefer, Lisp_Object frame, int best_only) 2184font_sort_entities (Lisp_Object list, Lisp_Object prefer,
2185 struct frame *f, int best_only)
2190{ 2186{
2191 Lisp_Object prefer_prop[FONT_SPEC_MAX]; 2187 Lisp_Object prefer_prop[FONT_SPEC_MAX];
2192 int len, maxlen, i; 2188 int len, maxlen, i;
2193 struct font_sort_data *data; 2189 struct font_sort_data *data;
2194 unsigned best_score; 2190 unsigned best_score;
2195 Lisp_Object best_entity; 2191 Lisp_Object best_entity;
2196 struct frame *f = XFRAME (frame);
2197 Lisp_Object tail, vec IF_LINT (= Qnil); 2192 Lisp_Object tail, vec IF_LINT (= Qnil);
2198 USE_SAFE_ALLOCA; 2193 USE_SAFE_ALLOCA;
2199 2194
@@ -2201,7 +2196,7 @@ font_sort_entities (Lisp_Object list, Lisp_Object prefer, Lisp_Object frame, int
2201 prefer_prop[i] = AREF (prefer, i); 2196 prefer_prop[i] = AREF (prefer, i);
2202 if (FLOATP (prefer_prop[FONT_SIZE_INDEX])) 2197 if (FLOATP (prefer_prop[FONT_SIZE_INDEX]))
2203 prefer_prop[FONT_SIZE_INDEX] 2198 prefer_prop[FONT_SIZE_INDEX]
2204 = make_number (font_pixel_size (XFRAME (frame), prefer)); 2199 = make_number (font_pixel_size (f, prefer));
2205 2200
2206 if (NILP (XCDR (list))) 2201 if (NILP (XCDR (list)))
2207 { 2202 {
@@ -2502,14 +2497,14 @@ font_match_p (Lisp_Object spec, Lisp_Object font)
2502 is a number frames sharing this cache, and FONT-CACHE-DATA is a 2497 is a number frames sharing this cache, and FONT-CACHE-DATA is a
2503 cons (FONT-SPEC FONT-ENTITY ...). */ 2498 cons (FONT-SPEC FONT-ENTITY ...). */
2504 2499
2505static void font_prepare_cache (FRAME_PTR, struct font_driver *); 2500static void font_prepare_cache (struct frame *, struct font_driver *);
2506static void font_finish_cache (FRAME_PTR, struct font_driver *); 2501static void font_finish_cache (struct frame *, struct font_driver *);
2507static Lisp_Object font_get_cache (FRAME_PTR, struct font_driver *); 2502static Lisp_Object font_get_cache (struct frame *, struct font_driver *);
2508static void font_clear_cache (FRAME_PTR, Lisp_Object, 2503static void font_clear_cache (struct frame *, Lisp_Object,
2509 struct font_driver *); 2504 struct font_driver *);
2510 2505
2511static void 2506static void
2512font_prepare_cache (FRAME_PTR f, struct font_driver *driver) 2507font_prepare_cache (struct frame *f, struct font_driver *driver)
2513{ 2508{
2514 Lisp_Object cache, val; 2509 Lisp_Object cache, val;
2515 2510
@@ -2531,7 +2526,7 @@ font_prepare_cache (FRAME_PTR f, struct font_driver *driver)
2531 2526
2532 2527
2533static void 2528static void
2534font_finish_cache (FRAME_PTR f, struct font_driver *driver) 2529font_finish_cache (struct frame *f, struct font_driver *driver)
2535{ 2530{
2536 Lisp_Object cache, val, tmp; 2531 Lisp_Object cache, val, tmp;
2537 2532
@@ -2552,7 +2547,7 @@ font_finish_cache (FRAME_PTR f, struct font_driver *driver)
2552 2547
2553 2548
2554static Lisp_Object 2549static Lisp_Object
2555font_get_cache (FRAME_PTR f, struct font_driver *driver) 2550font_get_cache (struct frame *f, struct font_driver *driver)
2556{ 2551{
2557 Lisp_Object val = driver->get_cache (f); 2552 Lisp_Object val = driver->get_cache (f);
2558 Lisp_Object type = driver->type; 2553 Lisp_Object type = driver->type;
@@ -2567,7 +2562,7 @@ font_get_cache (FRAME_PTR f, struct font_driver *driver)
2567 2562
2568 2563
2569static void 2564static void
2570font_clear_cache (FRAME_PTR f, Lisp_Object cache, struct font_driver *driver) 2565font_clear_cache (struct frame *f, Lisp_Object cache, struct font_driver *driver)
2571{ 2566{
2572 Lisp_Object tail, elt; 2567 Lisp_Object tail, elt;
2573 Lisp_Object tail2, entity; 2568 Lisp_Object tail2, entity;
@@ -2692,9 +2687,8 @@ font_delete_unmatched (Lisp_Object vec, Lisp_Object spec, int size)
2692 same font-driver. */ 2687 same font-driver. */
2693 2688
2694Lisp_Object 2689Lisp_Object
2695font_list_entities (Lisp_Object frame, Lisp_Object spec) 2690font_list_entities (struct frame *f, Lisp_Object spec)
2696{ 2691{
2697 FRAME_PTR f = XFRAME (frame);
2698 struct font_driver_list *driver_list = f->font_driver_list; 2692 struct font_driver_list *driver_list = f->font_driver_list;
2699 Lisp_Object ftype, val; 2693 Lisp_Object ftype, val;
2700 Lisp_Object list = Qnil; 2694 Lisp_Object list = Qnil;
@@ -2738,7 +2732,7 @@ font_list_entities (Lisp_Object frame, Lisp_Object spec)
2738 { 2732 {
2739 Lisp_Object copy; 2733 Lisp_Object copy;
2740 2734
2741 val = driver_list->driver->list (frame, scratch_font_spec); 2735 val = driver_list->driver->list (f, scratch_font_spec);
2742 if (NILP (val)) 2736 if (NILP (val))
2743 val = zero_vector; 2737 val = zero_vector;
2744 else 2738 else
@@ -2766,14 +2760,12 @@ font_list_entities (Lisp_Object frame, Lisp_Object spec)
2766 font-related attributes. */ 2760 font-related attributes. */
2767 2761
2768static Lisp_Object 2762static Lisp_Object
2769font_matching_entity (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec) 2763font_matching_entity (struct frame *f, Lisp_Object *attrs, Lisp_Object spec)
2770{ 2764{
2771 struct font_driver_list *driver_list = f->font_driver_list; 2765 struct font_driver_list *driver_list = f->font_driver_list;
2772 Lisp_Object ftype, size, entity; 2766 Lisp_Object ftype, size, entity;
2773 Lisp_Object frame;
2774 Lisp_Object work = copy_font_spec (spec); 2767 Lisp_Object work = copy_font_spec (spec);
2775 2768
2776 XSETFRAME (frame, f);
2777 ftype = AREF (spec, FONT_TYPE_INDEX); 2769 ftype = AREF (spec, FONT_TYPE_INDEX);
2778 size = AREF (spec, FONT_SIZE_INDEX); 2770 size = AREF (spec, FONT_SIZE_INDEX);
2779 2771
@@ -2797,7 +2789,7 @@ font_matching_entity (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec)
2797 entity = XCDR (entity); 2789 entity = XCDR (entity);
2798 else 2790 else
2799 { 2791 {
2800 entity = driver_list->driver->match (frame, work); 2792 entity = driver_list->driver->match (f, work);
2801 copy = copy_font_spec (work); 2793 copy = copy_font_spec (work);
2802 ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); 2794 ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type);
2803 XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache))); 2795 XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache)));
@@ -2814,7 +2806,7 @@ font_matching_entity (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec)
2814 opened font object. */ 2806 opened font object. */
2815 2807
2816static Lisp_Object 2808static Lisp_Object
2817font_open_entity (FRAME_PTR f, Lisp_Object entity, int pixel_size) 2809font_open_entity (struct frame *f, Lisp_Object entity, int pixel_size)
2818{ 2810{
2819 struct font_driver_list *driver_list; 2811 struct font_driver_list *driver_list;
2820 Lisp_Object objlist, size, val, font_object; 2812 Lisp_Object objlist, size, val, font_object;
@@ -2892,7 +2884,7 @@ font_open_entity (FRAME_PTR f, Lisp_Object entity, int pixel_size)
2892/* Close FONT_OBJECT that is opened on frame F. */ 2884/* Close FONT_OBJECT that is opened on frame F. */
2893 2885
2894static void 2886static void
2895font_close_object (FRAME_PTR f, Lisp_Object font_object) 2887font_close_object (struct frame *f, Lisp_Object font_object)
2896{ 2888{
2897 struct font *font = XFONT_OBJECT (font_object); 2889 struct font *font = XFONT_OBJECT (font_object);
2898 2890
@@ -2912,7 +2904,7 @@ font_close_object (FRAME_PTR f, Lisp_Object font_object)
2912 FONT is a font-entity and it must be opened to check. */ 2904 FONT is a font-entity and it must be opened to check. */
2913 2905
2914int 2906int
2915font_has_char (FRAME_PTR f, Lisp_Object font, int c) 2907font_has_char (struct frame *f, Lisp_Object font, int c)
2916{ 2908{
2917 struct font *fontp; 2909 struct font *fontp;
2918 2910
@@ -3039,12 +3031,12 @@ font_clear_prop (Lisp_Object *attrs, enum font_property_index prop)
3039 supports C and is the best match for ATTRS and PIXEL_SIZE. */ 3031 supports C and is the best match for ATTRS and PIXEL_SIZE. */
3040 3032
3041static Lisp_Object 3033static Lisp_Object
3042font_select_entity (Lisp_Object frame, Lisp_Object entities, Lisp_Object *attrs, int pixel_size, int c) 3034font_select_entity (struct frame *f, Lisp_Object entities,
3035 Lisp_Object *attrs, int pixel_size, int c)
3043{ 3036{
3044 Lisp_Object font_entity; 3037 Lisp_Object font_entity;
3045 Lisp_Object prefer; 3038 Lisp_Object prefer;
3046 int i; 3039 int i;
3047 FRAME_PTR f = XFRAME (frame);
3048 3040
3049 if (NILP (XCDR (entities)) 3041 if (NILP (XCDR (entities))
3050 && ASIZE (XCAR (entities)) == 1) 3042 && ASIZE (XCAR (entities)) == 1)
@@ -3075,7 +3067,7 @@ font_select_entity (Lisp_Object frame, Lisp_Object entities, Lisp_Object *attrs,
3075 FONT_SET_STYLE (prefer, FONT_WIDTH_INDEX, attrs[LFACE_SWIDTH_INDEX]); 3067 FONT_SET_STYLE (prefer, FONT_WIDTH_INDEX, attrs[LFACE_SWIDTH_INDEX]);
3076 ASET (prefer, FONT_SIZE_INDEX, make_number (pixel_size)); 3068 ASET (prefer, FONT_SIZE_INDEX, make_number (pixel_size));
3077 3069
3078 return font_sort_entities (entities, prefer, frame, c); 3070 return font_sort_entities (entities, prefer, f, c);
3079} 3071}
3080 3072
3081/* Return a font-entity that satisfies SPEC and is the best match for 3073/* Return a font-entity that satisfies SPEC and is the best match for
@@ -3083,10 +3075,10 @@ font_select_entity (Lisp_Object frame, Lisp_Object entities, Lisp_Object *attrs,
3083 character that the entity must support. */ 3075 character that the entity must support. */
3084 3076
3085Lisp_Object 3077Lisp_Object
3086font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c) 3078font_find_for_lface (struct frame *f, Lisp_Object *attrs, Lisp_Object spec, int c)
3087{ 3079{
3088 Lisp_Object work; 3080 Lisp_Object work;
3089 Lisp_Object frame, entities, val; 3081 Lisp_Object entities, val;
3090 Lisp_Object foundry[3], *family, registry[3], adstyle[3]; 3082 Lisp_Object foundry[3], *family, registry[3], adstyle[3];
3091 int pixel_size; 3083 int pixel_size;
3092 int i, j, k, l; 3084 int i, j, k, l;
@@ -3118,7 +3110,6 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c)
3118 3110
3119 work = copy_font_spec (spec); 3111 work = copy_font_spec (spec);
3120 ASET (work, FONT_TYPE_INDEX, AREF (spec, FONT_TYPE_INDEX)); 3112 ASET (work, FONT_TYPE_INDEX, AREF (spec, FONT_TYPE_INDEX));
3121 XSETFRAME (frame, f);
3122 pixel_size = font_pixel_size (f, spec); 3113 pixel_size = font_pixel_size (f, spec);
3123 if (pixel_size == 0 && INTEGERP (attrs[LFACE_HEIGHT_INDEX])) 3114 if (pixel_size == 0 && INTEGERP (attrs[LFACE_HEIGHT_INDEX]))
3124 { 3115 {
@@ -3212,10 +3203,10 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c)
3212 for (l = 0; SYMBOLP (adstyle[l]); l++) 3203 for (l = 0; SYMBOLP (adstyle[l]); l++)
3213 { 3204 {
3214 ASET (work, FONT_ADSTYLE_INDEX, adstyle[l]); 3205 ASET (work, FONT_ADSTYLE_INDEX, adstyle[l]);
3215 entities = font_list_entities (frame, work); 3206 entities = font_list_entities (f, work);
3216 if (! NILP (entities)) 3207 if (! NILP (entities))
3217 { 3208 {
3218 val = font_select_entity (frame, entities, 3209 val = font_select_entity (f, entities,
3219 attrs, pixel_size, c); 3210 attrs, pixel_size, c);
3220 if (! NILP (val)) 3211 if (! NILP (val))
3221 return val; 3212 return val;
@@ -3231,7 +3222,7 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c)
3231 3222
3232 3223
3233Lisp_Object 3224Lisp_Object
3234font_open_for_lface (FRAME_PTR f, Lisp_Object entity, Lisp_Object *attrs, Lisp_Object spec) 3225font_open_for_lface (struct frame *f, Lisp_Object entity, Lisp_Object *attrs, Lisp_Object spec)
3235{ 3226{
3236 int size; 3227 int size;
3237 3228
@@ -3278,7 +3269,7 @@ font_open_for_lface (FRAME_PTR f, Lisp_Object entity, Lisp_Object *attrs, Lisp_O
3278 font-object. */ 3269 font-object. */
3279 3270
3280Lisp_Object 3271Lisp_Object
3281font_load_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec) 3272font_load_for_lface (struct frame *f, Lisp_Object *attrs, Lisp_Object spec)
3282{ 3273{
3283 Lisp_Object entity, name; 3274 Lisp_Object entity, name;
3284 3275
@@ -3307,7 +3298,7 @@ font_load_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec)
3307/* Make FACE on frame F ready to use the font opened for FACE. */ 3298/* Make FACE on frame F ready to use the font opened for FACE. */
3308 3299
3309void 3300void
3310font_prepare_for_face (FRAME_PTR f, struct face *face) 3301font_prepare_for_face (struct frame *f, struct face *face)
3311{ 3302{
3312 if (face->font->driver->prepare_face) 3303 if (face->font->driver->prepare_face)
3313 face->font->driver->prepare_face (f, face); 3304 face->font->driver->prepare_face (f, face);
@@ -3317,7 +3308,7 @@ font_prepare_for_face (FRAME_PTR f, struct face *face)
3317/* Make FACE on frame F stop using the font opened for FACE. */ 3308/* Make FACE on frame F stop using the font opened for FACE. */
3318 3309
3319void 3310void
3320font_done_for_face (FRAME_PTR f, struct face *face) 3311font_done_for_face (struct frame *f, struct face *face)
3321{ 3312{
3322 if (face->font->driver->done_face) 3313 if (face->font->driver->done_face)
3323 face->font->driver->done_face (f, face); 3314 face->font->driver->done_face (f, face);
@@ -3329,7 +3320,7 @@ font_done_for_face (FRAME_PTR f, struct face *face)
3329 font is found, return Qnil. */ 3320 font is found, return Qnil. */
3330 3321
3331Lisp_Object 3322Lisp_Object
3332font_open_by_spec (FRAME_PTR f, Lisp_Object spec) 3323font_open_by_spec (struct frame *f, Lisp_Object spec)
3333{ 3324{
3334 Lisp_Object attrs[LFACE_VECTOR_SIZE]; 3325 Lisp_Object attrs[LFACE_VECTOR_SIZE];
3335 3326
@@ -3353,7 +3344,7 @@ font_open_by_spec (FRAME_PTR f, Lisp_Object spec)
3353 found, return Qnil. */ 3344 found, return Qnil. */
3354 3345
3355Lisp_Object 3346Lisp_Object
3356font_open_by_name (FRAME_PTR f, Lisp_Object name) 3347font_open_by_name (struct frame *f, Lisp_Object name)
3357{ 3348{
3358 Lisp_Object args[2]; 3349 Lisp_Object args[2];
3359 Lisp_Object spec, ret; 3350 Lisp_Object spec, ret;
@@ -3383,7 +3374,7 @@ font_open_by_name (FRAME_PTR f, Lisp_Object name)
3383 (e.g. syms_of_xfont). */ 3374 (e.g. syms_of_xfont). */
3384 3375
3385void 3376void
3386register_font_driver (struct font_driver *driver, FRAME_PTR f) 3377register_font_driver (struct font_driver *driver, struct frame *f)
3387{ 3378{
3388 struct font_driver_list *root = f ? f->font_driver_list : font_driver_list; 3379 struct font_driver_list *root = f ? f->font_driver_list : font_driver_list;
3389 struct font_driver_list *prev, *list; 3380 struct font_driver_list *prev, *list;
@@ -3411,7 +3402,7 @@ register_font_driver (struct font_driver *driver, FRAME_PTR f)
3411} 3402}
3412 3403
3413void 3404void
3414free_font_driver_list (FRAME_PTR f) 3405free_font_driver_list (struct frame *f)
3415{ 3406{
3416 struct font_driver_list *list, *next; 3407 struct font_driver_list *list, *next;
3417 3408
@@ -3433,7 +3424,7 @@ free_font_driver_list (FRAME_PTR f)
3433 F. */ 3424 F. */
3434 3425
3435Lisp_Object 3426Lisp_Object
3436font_update_drivers (FRAME_PTR f, Lisp_Object new_drivers) 3427font_update_drivers (struct frame *f, Lisp_Object new_drivers)
3437{ 3428{
3438 Lisp_Object active_drivers = Qnil; 3429 Lisp_Object active_drivers = Qnil;
3439 struct font_driver_list *list; 3430 struct font_driver_list *list;
@@ -3522,7 +3513,7 @@ font_update_drivers (FRAME_PTR f, Lisp_Object new_drivers)
3522} 3513}
3523 3514
3524int 3515int
3525font_put_frame_data (FRAME_PTR f, struct font_driver *driver, void *data) 3516font_put_frame_data (struct frame *f, struct font_driver *driver, void *data)
3526{ 3517{
3527 struct font_data_list *list, *prev; 3518 struct font_data_list *list, *prev;
3528 3519
@@ -3556,7 +3547,7 @@ font_put_frame_data (FRAME_PTR f, struct font_driver *driver, void *data)
3556 3547
3557 3548
3558void * 3549void *
3559font_get_frame_data (FRAME_PTR f, struct font_driver *driver) 3550font_get_frame_data (struct frame *f, struct font_driver *driver)
3560{ 3551{
3561 struct font_data_list *list; 3552 struct font_data_list *list;
3562 3553
@@ -3630,7 +3621,7 @@ static Lisp_Object
3630font_at (int c, ptrdiff_t pos, struct face *face, struct window *w, 3621font_at (int c, ptrdiff_t pos, struct face *face, struct window *w,
3631 Lisp_Object string) 3622 Lisp_Object string)
3632{ 3623{
3633 FRAME_PTR f; 3624 struct frame *f;
3634 bool multibyte; 3625 bool multibyte;
3635 Lisp_Object font_object; 3626 Lisp_Object font_object;
3636 3627
@@ -4110,12 +4101,10 @@ control the order of the returned list. Fonts are sorted by
4110how close they are to PREFER. */) 4101how close they are to PREFER. */)
4111 (Lisp_Object font_spec, Lisp_Object frame, Lisp_Object num, Lisp_Object prefer) 4102 (Lisp_Object font_spec, Lisp_Object frame, Lisp_Object num, Lisp_Object prefer)
4112{ 4103{
4104 struct frame *f = decode_live_frame (frame);
4113 Lisp_Object vec, list; 4105 Lisp_Object vec, list;
4114 EMACS_INT n = 0; 4106 EMACS_INT n = 0;
4115 4107
4116 if (NILP (frame))
4117 frame = selected_frame;
4118 CHECK_LIVE_FRAME (frame);
4119 CHECK_FONT_SPEC (font_spec); 4108 CHECK_FONT_SPEC (font_spec);
4120 if (! NILP (num)) 4109 if (! NILP (num))
4121 { 4110 {
@@ -4127,7 +4116,7 @@ how close they are to PREFER. */)
4127 if (! NILP (prefer)) 4116 if (! NILP (prefer))
4128 CHECK_FONT_SPEC (prefer); 4117 CHECK_FONT_SPEC (prefer);
4129 4118
4130 list = font_list_entities (frame, font_spec); 4119 list = font_list_entities (f, font_spec);
4131 if (NILP (list)) 4120 if (NILP (list))
4132 return Qnil; 4121 return Qnil;
4133 if (NILP (XCDR (list)) 4122 if (NILP (XCDR (list))
@@ -4135,7 +4124,7 @@ how close they are to PREFER. */)
4135 return list1 (AREF (XCAR (list), 0)); 4124 return list1 (AREF (XCAR (list), 0));
4136 4125
4137 if (! NILP (prefer)) 4126 if (! NILP (prefer))
4138 vec = font_sort_entities (list, prefer, frame, 0); 4127 vec = font_sort_entities (list, prefer, f, 0);
4139 else 4128 else
4140 vec = font_vconcat_entity_vectors (list); 4129 vec = font_vconcat_entity_vectors (list);
4141 if (n == 0 || n >= ASIZE (vec)) 4130 if (n == 0 || n >= ASIZE (vec))
@@ -4163,13 +4152,11 @@ If FRAME is omitted or nil, the selected frame is used. */)
4163 struct font_driver_list *driver_list; 4152 struct font_driver_list *driver_list;
4164 Lisp_Object list = Qnil; 4153 Lisp_Object list = Qnil;
4165 4154
4166 XSETFRAME (frame, f);
4167
4168 for (driver_list = f->font_driver_list; driver_list; 4155 for (driver_list = f->font_driver_list; driver_list;
4169 driver_list = driver_list->next) 4156 driver_list = driver_list->next)
4170 if (driver_list->driver->list_family) 4157 if (driver_list->driver->list_family)
4171 { 4158 {
4172 Lisp_Object val = driver_list->driver->list_family (frame); 4159 Lisp_Object val = driver_list->driver->list_family (f);
4173 Lisp_Object tail = list; 4160 Lisp_Object tail = list;
4174 4161
4175 for (; CONSP (val); val = XCDR (val)) 4162 for (; CONSP (val); val = XCDR (val))
@@ -4247,7 +4234,7 @@ DEFUN ("clear-font-cache", Fclear_font_cache, Sclear_font_cache, 0, 0, 0,
4247 4234
4248 FOR_EACH_FRAME (list, frame) 4235 FOR_EACH_FRAME (list, frame)
4249 { 4236 {
4250 FRAME_PTR f = XFRAME (frame); 4237 struct frame *f = XFRAME (frame);
4251 struct font_driver_list *driver_list = f->font_driver_list; 4238 struct font_driver_list *driver_list = f->font_driver_list;
4252 4239
4253 for (; driver_list; driver_list = driver_list->next) 4240 for (; driver_list; driver_list = driver_list->next)
@@ -4795,7 +4782,7 @@ Type C-l to recover what previously shown. */)
4795 (Lisp_Object font_object, Lisp_Object string) 4782 (Lisp_Object font_object, Lisp_Object string)
4796{ 4783{
4797 Lisp_Object frame = selected_frame; 4784 Lisp_Object frame = selected_frame;
4798 FRAME_PTR f = XFRAME (frame); 4785 struct frame *f = XFRAME (frame);
4799 struct font *font; 4786 struct font *font;
4800 struct face *face; 4787 struct face *face;
4801 int i, len, width; 4788 int i, len, width;
diff --git a/src/font.h b/src/font.h
index ffed0461ff7..daeb320c1ab 100644
--- a/src/font.h
+++ b/src/font.h
@@ -504,7 +504,7 @@ struct font_driver
504 504
505 /* Return a cache of font-entities on frame F. The cache must be a 505 /* Return a cache of font-entities on frame F. The cache must be a
506 cons whose cdr part is the actual cache area. */ 506 cons whose cdr part is the actual cache area. */
507 Lisp_Object (*get_cache) (FRAME_PTR F); 507 Lisp_Object (*get_cache) (struct frame *f);
508 508
509 /* List fonts exactly matching with FONT_SPEC on FRAME. The value 509 /* List fonts exactly matching with FONT_SPEC on FRAME. The value
510 is a list of font-entities. The font properties to be considered 510 is a list of font-entities. The font properties to be considered
@@ -527,7 +527,7 @@ struct font_driver
527 527
528 This and the following `match' are the only APIs that allocate 528 This and the following `match' are the only APIs that allocate
529 font-entities. */ 529 font-entities. */
530 Lisp_Object (*list) (Lisp_Object frame, Lisp_Object font_spec); 530 Lisp_Object (*list) (struct frame *frame, Lisp_Object font_spec);
531 531
532 /* Return a font-entity most closely matching with FONT_SPEC on 532 /* Return a font-entity most closely matching with FONT_SPEC on
533 FRAME. Which font property to consider, and how to calculate the 533 FRAME. Which font property to consider, and how to calculate the
@@ -536,12 +536,12 @@ struct font_driver
536 536
537 The properties that the font-entity has is the same as `list' 537 The properties that the font-entity has is the same as `list'
538 method. */ 538 method. */
539 Lisp_Object (*match) (Lisp_Object frame, Lisp_Object font_spec); 539 Lisp_Object (*match) (struct frame *f, Lisp_Object spec);
540 540
541 /* Optional. 541 /* Optional.
542 List available families. The value is a list of family names 542 List available families. The value is a list of family names
543 (symbols). */ 543 (symbols). */
544 Lisp_Object (*list_family) (Lisp_Object frame); 544 Lisp_Object (*list_family) (struct frame *f);
545 545
546 /* Optional (if FONT_EXTRA_INDEX is not Lisp_Save_Value). 546 /* Optional (if FONT_EXTRA_INDEX is not Lisp_Save_Value).
547 Free FONT_EXTRA_INDEX field of FONT_ENTITY. */ 547 Free FONT_EXTRA_INDEX field of FONT_ENTITY. */
@@ -549,21 +549,21 @@ struct font_driver
549 549
550 /* Open a font specified by FONT_ENTITY on frame F. If the font is 550 /* Open a font specified by FONT_ENTITY on frame F. If the font is
551 scalable, open it with PIXEL_SIZE. */ 551 scalable, open it with PIXEL_SIZE. */
552 Lisp_Object (*open) (FRAME_PTR f, Lisp_Object font_entity, 552 Lisp_Object (*open) (struct frame *f, Lisp_Object font_entity,
553 int pixel_size); 553 int pixel_size);
554 554
555 /* Close FONT on frame F. */ 555 /* Close FONT on frame F. */
556 void (*close) (FRAME_PTR f, struct font *font); 556 void (*close) (struct frame *f, struct font *font);
557 557
558 /* Optional (if FACE->extra is not used). 558 /* Optional (if FACE->extra is not used).
559 Prepare FACE for displaying characters by FONT on frame F by 559 Prepare FACE for displaying characters by FONT on frame F by
560 storing some data in FACE->extra. If successful, return 0. 560 storing some data in FACE->extra. If successful, return 0.
561 Otherwise, return -1. */ 561 Otherwise, return -1. */
562 int (*prepare_face) (FRAME_PTR f, struct face *face); 562 int (*prepare_face) (struct frame *f, struct face *face);
563 563
564 /* Optional. 564 /* Optional.
565 Done FACE for displaying characters by FACE->font on frame F. */ 565 Done FACE for displaying characters by FACE->font on frame F. */
566 void (*done_face) (FRAME_PTR f, struct face *face); 566 void (*done_face) (struct frame *f, struct face *face);
567 567
568 /* Optional. 568 /* Optional.
569 If FONT (FONT-ENTITY or FONT-OBJECT) has a glyph for character C 569 If FONT (FONT-ENTITY or FONT-OBJECT) has a glyph for character C
@@ -646,12 +646,12 @@ struct font_driver
646 Make the font driver ready for frame F. Usually this function 646 Make the font driver ready for frame F. Usually this function
647 makes some data specific to F and stores it in F by calling 647 makes some data specific to F and stores it in F by calling
648 font_put_frame_data (). */ 648 font_put_frame_data (). */
649 int (*start_for_frame) (FRAME_PTR f); 649 int (*start_for_frame) (struct frame *f);
650 650
651 /* Optional. 651 /* Optional.
652 End using the driver for frame F. Usually this function free 652 End using the driver for frame F. Usually this function free
653 some data stored for F. */ 653 some data stored for F. */
654 int (*end_for_frame) (FRAME_PTR f); 654 int (*end_for_frame) (struct frame *f);
655 655
656 /* Optional. 656 /* Optional.
657 657
@@ -674,7 +674,7 @@ struct font_driver
674 If FONT is usable on frame F, return 0. Otherwise return -1. 674 If FONT is usable on frame F, return 0. Otherwise return -1.
675 This method is used only for debugging. If this method is NULL, 675 This method is used only for debugging. If this method is NULL,
676 Emacs assumes that the font is usable on any frame. */ 676 Emacs assumes that the font is usable on any frame. */
677 int (*check) (FRAME_PTR F, struct font *font); 677 int (*check) (struct frame *f, struct font *font);
678 678
679 /* Optional. 679 /* Optional.
680 680
@@ -698,8 +698,8 @@ struct font_driver
698 698
699 699
700/* Chain of font drivers. There's one global font driver list 700/* Chain of font drivers. There's one global font driver list
701 (font_driver_list in font.c). In addition, each frame has its own 701 (font_driver_list in font.c). In addition, each frame has
702 font driver list at FRAME_PTR->font_driver_list. */ 702 its own font driver list at F->font_driver_list. */
703 703
704struct font_driver_list 704struct font_driver_list
705{ 705{
@@ -713,8 +713,8 @@ struct font_driver_list
713}; 713};
714 714
715 715
716/* Chain of arbitrary data specific to each font driver. Each frame 716/* Chain of arbitrary data specific to each font driver.
717 has its own font data list at FRAME_PTR->font_data_list. */ 717 Each frame has its own font data list at F->font_data_list. */
718 718
719struct font_data_list 719struct font_data_list
720{ 720{
@@ -742,28 +742,27 @@ extern Lisp_Object font_style_symbolic (Lisp_Object font,
742 bool for_face); 742 bool for_face);
743 743
744extern bool font_match_p (Lisp_Object spec, Lisp_Object font); 744extern bool font_match_p (Lisp_Object spec, Lisp_Object font);
745extern Lisp_Object font_list_entities (Lisp_Object frame, 745extern Lisp_Object font_list_entities (struct frame *, Lisp_Object);
746 Lisp_Object spec);
747 746
748extern Lisp_Object font_get_name (Lisp_Object font_object); 747extern Lisp_Object font_get_name (Lisp_Object font_object);
749extern Lisp_Object font_spec_from_name (Lisp_Object font_name); 748extern Lisp_Object font_spec_from_name (Lisp_Object font_name);
750extern Lisp_Object font_get_frame (Lisp_Object font_object); 749extern Lisp_Object font_get_frame (Lisp_Object font_object);
751extern int font_has_char (FRAME_PTR, Lisp_Object, int); 750extern int font_has_char (struct frame *, Lisp_Object, int);
752 751
753extern void font_clear_prop (Lisp_Object *attrs, 752extern void font_clear_prop (Lisp_Object *attrs,
754 enum font_property_index prop); 753 enum font_property_index prop);
755extern Lisp_Object font_find_for_lface (FRAME_PTR f, Lisp_Object *lface, 754extern Lisp_Object font_find_for_lface (struct frame *f, Lisp_Object *lface,
756 Lisp_Object spec, int c); 755 Lisp_Object spec, int c);
757extern Lisp_Object font_open_for_lface (FRAME_PTR f, Lisp_Object entity, 756extern Lisp_Object font_open_for_lface (struct frame *f, Lisp_Object entity,
758 Lisp_Object *lface, 757 Lisp_Object *lface,
759 Lisp_Object spec); 758 Lisp_Object spec);
760extern Lisp_Object font_load_for_lface (FRAME_PTR f, Lisp_Object *lface, 759extern Lisp_Object font_load_for_lface (struct frame *f, Lisp_Object *lface,
761 Lisp_Object spec); 760 Lisp_Object spec);
762extern void font_prepare_for_face (FRAME_PTR f, struct face *face); 761extern void font_prepare_for_face (struct frame *f, struct face *face);
763extern void font_done_for_face (FRAME_PTR f, struct face *face); 762extern void font_done_for_face (struct frame *f, struct face *face);
764 763
765extern Lisp_Object font_open_by_spec (FRAME_PTR f, Lisp_Object spec); 764extern Lisp_Object font_open_by_spec (struct frame *f, Lisp_Object spec);
766extern Lisp_Object font_open_by_name (FRAME_PTR f, Lisp_Object name); 765extern Lisp_Object font_open_by_name (struct frame *f, Lisp_Object name);
767 766
768extern Lisp_Object font_intern_prop (const char *str, ptrdiff_t len, 767extern Lisp_Object font_intern_prop (const char *str, ptrdiff_t len,
769 bool force_symbol); 768 bool force_symbol);
@@ -778,9 +777,9 @@ extern ptrdiff_t font_unparse_xlfd (Lisp_Object font, int pixel_size,
778 char *name, int bytes); 777 char *name, int bytes);
779extern int font_unparse_fcname (Lisp_Object font, int pixel_size, 778extern int font_unparse_fcname (Lisp_Object font, int pixel_size,
780 char *name, int bytes); 779 char *name, int bytes);
781extern void register_font_driver (struct font_driver *driver, FRAME_PTR f); 780extern void register_font_driver (struct font_driver *driver, struct frame *f);
782extern void free_font_driver_list (FRAME_PTR f); 781extern void free_font_driver_list (struct frame *f);
783extern Lisp_Object font_update_drivers (FRAME_PTR f, Lisp_Object list); 782extern Lisp_Object font_update_drivers (struct frame *f, Lisp_Object list);
784extern Lisp_Object font_range (ptrdiff_t, ptrdiff_t, ptrdiff_t *, 783extern Lisp_Object font_range (ptrdiff_t, ptrdiff_t, ptrdiff_t *,
785 struct window *, struct face *, 784 struct window *, struct face *,
786 Lisp_Object); 785 Lisp_Object);
@@ -789,10 +788,10 @@ extern void font_fill_lglyph_metrics (Lisp_Object, Lisp_Object);
789extern Lisp_Object font_put_extra (Lisp_Object font, Lisp_Object prop, 788extern Lisp_Object font_put_extra (Lisp_Object font, Lisp_Object prop,
790 Lisp_Object val); 789 Lisp_Object val);
791 790
792extern int font_put_frame_data (FRAME_PTR f, 791extern int font_put_frame_data (struct frame *f,
793 struct font_driver *driver, 792 struct font_driver *driver,
794 void *data); 793 void *data);
795extern void *font_get_frame_data (FRAME_PTR f, 794extern void *font_get_frame_data (struct frame *f,
796 struct font_driver *driver); 795 struct font_driver *driver);
797 796
798extern void font_filter_properties (Lisp_Object font, 797extern void font_filter_properties (Lisp_Object font,
diff --git a/src/fontset.c b/src/fontset.c
index 6a6a434add0..0bf716bf1b2 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -539,8 +539,9 @@ fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id,
539{ 539{
540 Lisp_Object vec, font_group; 540 Lisp_Object vec, font_group;
541 int i, charset_matched = 0, found_index; 541 int i, charset_matched = 0, found_index;
542 FRAME_PTR f = (FRAMEP (FONTSET_FRAME (fontset)) 542 struct frame *f = (FRAMEP (FONTSET_FRAME (fontset))
543 ? XFRAME (FONTSET_FRAME (fontset)) : XFRAME (selected_frame)); 543 ? XFRAME (FONTSET_FRAME (fontset))
544 : XFRAME (selected_frame));
544 Lisp_Object rfont_def; 545 Lisp_Object rfont_def;
545 546
546 font_group = fontset_get_font_group (fontset, fallback ? -1 : c); 547 font_group = fontset_get_font_group (fontset, fallback ? -1 : c);
@@ -859,7 +860,7 @@ fontset_ascii (int id)
859} 860}
860 861
861static void 862static void
862free_realized_fontset (FRAME_PTR f, Lisp_Object fontset) 863free_realized_fontset (struct frame *f, Lisp_Object fontset)
863{ 864{
864#if 0 865#if 0
865 Lisp_Object tail; 866 Lisp_Object tail;
@@ -877,7 +878,7 @@ free_realized_fontset (FRAME_PTR f, Lisp_Object fontset)
877 free_realized_face. */ 878 free_realized_face. */
878 879
879void 880void
880free_face_fontset (FRAME_PTR f, struct face *face) 881free_face_fontset (struct frame *f, struct face *face)
881{ 882{
882 Lisp_Object fontset; 883 Lisp_Object fontset;
883 884
@@ -930,7 +931,7 @@ face_suitable_for_char_p (struct face *face, int c)
930 the macro FACE_FOR_CHAR. */ 931 the macro FACE_FOR_CHAR. */
931 932
932int 933int
933face_for_char (FRAME_PTR f, struct face *face, int c, int pos, Lisp_Object object) 934face_for_char (struct frame *f, struct face *face, int c, int pos, Lisp_Object object)
934{ 935{
935 Lisp_Object fontset, rfont_def, charset; 936 Lisp_Object fontset, rfont_def, charset;
936 int face_id; 937 int face_id;
@@ -1048,7 +1049,7 @@ font_for_char (struct face *face, int c, int pos, Lisp_Object object)
1048 Called from realize_x_face. */ 1049 Called from realize_x_face. */
1049 1050
1050int 1051int
1051make_fontset_for_ascii_face (FRAME_PTR f, int base_fontset_id, struct face *face) 1052make_fontset_for_ascii_face (struct frame *f, int base_fontset_id, struct face *face)
1052{ 1053{
1053 Lisp_Object base_fontset, fontset, frame; 1054 Lisp_Object base_fontset, fontset, frame;
1054 1055
@@ -1227,7 +1228,7 @@ If REGEXPP is non-nil, PATTERN is a regular expression. */)
1227/* Return a list of base fontset names matching PATTERN on frame F. */ 1228/* Return a list of base fontset names matching PATTERN on frame F. */
1228 1229
1229Lisp_Object 1230Lisp_Object
1230list_fontsets (FRAME_PTR f, Lisp_Object pattern, int size) 1231list_fontsets (struct frame *f, Lisp_Object pattern, int size)
1231{ 1232{
1232 Lisp_Object frame, regexp, val; 1233 Lisp_Object frame, regexp, val;
1233 int id; 1234 int id;
@@ -1284,7 +1285,7 @@ free_realized_fontsets (Lisp_Object base)
1284 for (tail = FONTSET_FACE_ALIST (this); CONSP (tail); 1285 for (tail = FONTSET_FACE_ALIST (this); CONSP (tail);
1285 tail = XCDR (tail)) 1286 tail = XCDR (tail))
1286 { 1287 {
1287 FRAME_PTR f = XFRAME (FONTSET_FRAME (this)); 1288 struct frame *f = XFRAME (FONTSET_FRAME (this));
1288 int face_id = XINT (XCDR (XCAR (tail))); 1289 int face_id = XINT (XCDR (XCAR (tail)));
1289 struct face *face = FACE_FROM_ID (f, face_id); 1290 struct face *face = FACE_FROM_ID (f, face_id);
1290 1291
@@ -1612,7 +1613,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */)
1612 name = FONTSET_NAME (fontset); 1613 name = FONTSET_NAME (fontset);
1613 FOR_EACH_FRAME (tail, fr) 1614 FOR_EACH_FRAME (tail, fr)
1614 { 1615 {
1615 FRAME_PTR f = XFRAME (fr); 1616 struct frame *f = XFRAME (fr);
1616 Lisp_Object font_object; 1617 Lisp_Object font_object;
1617 struct face *face; 1618 struct face *face;
1618 1619
@@ -2140,7 +2141,7 @@ dump_fontset (Lisp_Object fontset)
2140 frame = FONTSET_FRAME (fontset); 2141 frame = FONTSET_FRAME (fontset);
2141 if (FRAMEP (frame)) 2142 if (FRAMEP (frame))
2142 { 2143 {
2143 FRAME_PTR f = XFRAME (frame); 2144 struct frame *f = XFRAME (frame);
2144 2145
2145 if (FRAME_LIVE_P (f)) 2146 if (FRAME_LIVE_P (f))
2146 ASET (vec, 1, 2147 ASET (vec, 1,
diff --git a/src/fontset.h b/src/fontset.h
index 926520c8001..fd16c7178f5 100644
--- a/src/fontset.h
+++ b/src/fontset.h
@@ -28,12 +28,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
28 28
29struct face; 29struct face;
30 30
31extern void free_face_fontset (FRAME_PTR, struct face *); 31extern void free_face_fontset (struct frame *, struct face *);
32extern int face_for_char (FRAME_PTR, struct face *, int, 32extern int face_for_char (struct frame *, struct face *, int,
33 int, Lisp_Object); 33 int, Lisp_Object);
34extern Lisp_Object font_for_char (struct face *, int, int, Lisp_Object); 34extern Lisp_Object font_for_char (struct face *, int, int, Lisp_Object);
35 35
36extern int make_fontset_for_ascii_face (FRAME_PTR, int, struct face *); 36extern int make_fontset_for_ascii_face (struct frame *, int, struct face *);
37extern int fontset_from_font (Lisp_Object); 37extern int fontset_from_font (Lisp_Object);
38extern int fs_query_fontset (Lisp_Object, int); 38extern int fs_query_fontset (Lisp_Object, int);
39extern Lisp_Object list_fontsets (struct frame *, Lisp_Object, int); 39extern Lisp_Object list_fontsets (struct frame *, Lisp_Object, int);
diff --git a/src/frame.c b/src/frame.c
index f8b7201e984..14fc15c4717 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -69,7 +69,6 @@ Lisp_Object Qnoelisp;
69static Lisp_Object Qx_frame_parameter; 69static Lisp_Object Qx_frame_parameter;
70Lisp_Object Qx_resource_name; 70Lisp_Object Qx_resource_name;
71Lisp_Object Qterminal; 71Lisp_Object Qterminal;
72Lisp_Object Qterminal_live_p;
73 72
74/* Frame parameters (set or reported). */ 73/* Frame parameters (set or reported). */
75 74
@@ -310,7 +309,7 @@ predicates which report frame's specific UI-related capabilities. */)
310} 309}
311 310
312struct frame * 311struct frame *
313make_frame (int mini_p) 312make_frame (bool mini_p)
314{ 313{
315 Lisp_Object frame; 314 Lisp_Object frame;
316 register struct frame *f; 315 register struct frame *f;
@@ -725,16 +724,13 @@ affects all frames on the same terminal device. */)
725 adjust_glyphs (f); 724 adjust_glyphs (f);
726 calculate_costs (f); 725 calculate_costs (f);
727 XSETFRAME (frame, f); 726 XSETFRAME (frame, f);
727
728 store_in_alist (&parms, Qtty_type, build_string (t->display_info.tty->type));
729 store_in_alist (&parms, Qtty,
730 (t->display_info.tty->name
731 ? build_string (t->display_info.tty->name)
732 : Qnil));
728 Fmodify_frame_parameters (frame, parms); 733 Fmodify_frame_parameters (frame, parms);
729 Fmodify_frame_parameters
730 (frame, list1 (Fcons (Qtty_type,
731 build_string (t->display_info.tty->type))));
732 if (t->display_info.tty->name != NULL)
733 Fmodify_frame_parameters
734 (frame, list1 (Fcons (Qtty,
735 build_string (t->display_info.tty->name))));
736 else
737 Fmodify_frame_parameters (frame, list1 (Fcons (Qtty, Qnil)));
738 734
739 /* Make the frame face alist be frame-specific, so that each 735 /* Make the frame face alist be frame-specific, so that each
740 frame could change its face definitions independently. */ 736 frame could change its face definitions independently. */
@@ -1097,7 +1093,7 @@ Otherwise, include all frames. */)
1097 (Exception: if F is the terminal frame, and we are using X, return 1.) */ 1093 (Exception: if F is the terminal frame, and we are using X, return 1.) */
1098 1094
1099static int 1095static int
1100other_visible_frames (FRAME_PTR f) 1096other_visible_frames (struct frame *f)
1101{ 1097{
1102 Lisp_Object frames, this; 1098 Lisp_Object frames, this;
1103 1099
@@ -1471,7 +1467,7 @@ passing the normal return value to that function as an argument,
1471and returns whatever that function returns. */) 1467and returns whatever that function returns. */)
1472 (void) 1468 (void)
1473{ 1469{
1474 FRAME_PTR f; 1470 struct frame *f;
1475 Lisp_Object lispy_dummy; 1471 Lisp_Object lispy_dummy;
1476 Lisp_Object x, y, retval; 1472 Lisp_Object x, y, retval;
1477 struct gcpro gcpro1; 1473 struct gcpro gcpro1;
@@ -1517,7 +1513,7 @@ to read the mouse position, it returns the selected frame for FRAME
1517and nil for X and Y. */) 1513and nil for X and Y. */)
1518 (void) 1514 (void)
1519{ 1515{
1520 FRAME_PTR f; 1516 struct frame *f;
1521 Lisp_Object lispy_dummy; 1517 Lisp_Object lispy_dummy;
1522 Lisp_Object x, y; 1518 Lisp_Object x, y;
1523 1519
@@ -2365,7 +2361,7 @@ to `frame-height'). */)
2365 2361
2366#ifdef HAVE_WINDOW_SYSTEM 2362#ifdef HAVE_WINDOW_SYSTEM
2367 if (FRAME_WINDOW_P (f)) 2363 if (FRAME_WINDOW_P (f))
2368 return make_number (x_pixel_height (f)); 2364 return make_number (FRAME_PIXEL_HEIGHT (f));
2369 else 2365 else
2370#endif 2366#endif
2371 return make_number (FRAME_LINES (f)); 2367 return make_number (FRAME_LINES (f));
@@ -2382,7 +2378,7 @@ If FRAME is omitted or nil, the selected frame is used. */)
2382 2378
2383#ifdef HAVE_WINDOW_SYSTEM 2379#ifdef HAVE_WINDOW_SYSTEM
2384 if (FRAME_WINDOW_P (f)) 2380 if (FRAME_WINDOW_P (f))
2385 return make_number (x_pixel_width (f)); 2381 return make_number (FRAME_PIXEL_WIDTH (f));
2386 else 2382 else
2387#endif 2383#endif
2388 return make_number (FRAME_COLS (f)); 2384 return make_number (FRAME_COLS (f));
@@ -2407,8 +2403,9 @@ is used. */)
2407 2403
2408DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 3, 0, 2404DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 3, 0,
2409 doc: /* Specify that the frame FRAME has LINES lines. 2405 doc: /* Specify that the frame FRAME has LINES lines.
2410Optional third arg non-nil means that redisplay should use LINES lines 2406If FRAME is nil, the selected frame is used. Optional third arg
2411but that the idea of the actual height of the frame should not be changed. */) 2407non-nil means that redisplay should use LINES lines but that the
2408idea of the actual height of the frame should not be changed. */)
2412 (Lisp_Object frame, Lisp_Object lines, Lisp_Object pretend) 2409 (Lisp_Object frame, Lisp_Object lines, Lisp_Object pretend)
2413{ 2410{
2414 register struct frame *f = decode_live_frame (frame); 2411 register struct frame *f = decode_live_frame (frame);
@@ -2431,8 +2428,9 @@ but that the idea of the actual height of the frame should not be changed. */)
2431 2428
2432DEFUN ("set-frame-width", Fset_frame_width, Sset_frame_width, 2, 3, 0, 2429DEFUN ("set-frame-width", Fset_frame_width, Sset_frame_width, 2, 3, 0,
2433 doc: /* Specify that the frame FRAME has COLS columns. 2430 doc: /* Specify that the frame FRAME has COLS columns.
2434Optional third arg non-nil means that redisplay should use COLS columns 2431If FRAME is nil, the selected frame is used. Optional third arg
2435but that the idea of the actual width of the frame should not be changed. */) 2432non-nil means that redisplay should use COLS columns but that the
2433idea of the actual width of the frame should not be changed. */)
2436 (Lisp_Object frame, Lisp_Object cols, Lisp_Object pretend) 2434 (Lisp_Object frame, Lisp_Object cols, Lisp_Object pretend)
2437{ 2435{
2438 register struct frame *f = decode_live_frame (frame); 2436 register struct frame *f = decode_live_frame (frame);
@@ -2454,15 +2452,14 @@ but that the idea of the actual width of the frame should not be changed. */)
2454} 2452}
2455 2453
2456DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 3, 0, 2454DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 3, 0,
2457 doc: /* Sets size of FRAME to COLS by ROWS, measured in characters. */) 2455 doc: /* Sets size of FRAME to COLS by ROWS, measured in characters.
2456If FRAME is nil, the selected frame is used. */)
2458 (Lisp_Object frame, Lisp_Object cols, Lisp_Object rows) 2457 (Lisp_Object frame, Lisp_Object cols, Lisp_Object rows)
2459{ 2458{
2460 register struct frame *f; 2459 register struct frame *f = decode_live_frame (frame);
2461 2460
2462 CHECK_LIVE_FRAME (frame);
2463 CHECK_TYPE_RANGED_INTEGER (int, cols); 2461 CHECK_TYPE_RANGED_INTEGER (int, cols);
2464 CHECK_TYPE_RANGED_INTEGER (int, rows); 2462 CHECK_TYPE_RANGED_INTEGER (int, rows);
2465 f = XFRAME (frame);
2466 2463
2467 /* I think this should be done with a hook. */ 2464 /* I think this should be done with a hook. */
2468#ifdef HAVE_WINDOW_SYSTEM 2465#ifdef HAVE_WINDOW_SYSTEM
@@ -2484,17 +2481,16 @@ DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 3, 0,
2484DEFUN ("set-frame-position", Fset_frame_position, 2481DEFUN ("set-frame-position", Fset_frame_position,
2485 Sset_frame_position, 3, 3, 0, 2482 Sset_frame_position, 3, 3, 0,
2486 doc: /* Sets position of FRAME in pixels to XOFFSET by YOFFSET. 2483 doc: /* Sets position of FRAME in pixels to XOFFSET by YOFFSET.
2487This is actually the position of the upper left corner of the frame. 2484If FRAME is nil, the selected frame is used. XOFFSET and YOFFSET are
2488Negative values for XOFFSET or YOFFSET are interpreted relative to 2485actually the position of the upper left corner of the frame. Negative
2489the rightmost or bottommost possible position (that stays within the screen). */) 2486values for XOFFSET or YOFFSET are interpreted relative to the rightmost
2487or bottommost possible position (that stays within the screen). */)
2490 (Lisp_Object frame, Lisp_Object xoffset, Lisp_Object yoffset) 2488 (Lisp_Object frame, Lisp_Object xoffset, Lisp_Object yoffset)
2491{ 2489{
2492 register struct frame *f; 2490 register struct frame *f = decode_live_frame (frame);
2493 2491
2494 CHECK_LIVE_FRAME (frame);
2495 CHECK_TYPE_RANGED_INTEGER (int, xoffset); 2492 CHECK_TYPE_RANGED_INTEGER (int, xoffset);
2496 CHECK_TYPE_RANGED_INTEGER (int, yoffset); 2493 CHECK_TYPE_RANGED_INTEGER (int, yoffset);
2497 f = XFRAME (frame);
2498 2494
2499 /* I think this should be done with a hook. */ 2495 /* I think this should be done with a hook. */
2500#ifdef HAVE_WINDOW_SYSTEM 2496#ifdef HAVE_WINDOW_SYSTEM
@@ -2614,7 +2610,7 @@ x_fullscreen_adjust (struct frame *f, int *width, int *height, int *top_pos, int
2614 to store the new value in the parameter alist. */ 2610 to store the new value in the parameter alist. */
2615 2611
2616void 2612void
2617x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist) 2613x_set_frame_parameters (struct frame *f, Lisp_Object alist)
2618{ 2614{
2619 Lisp_Object tail; 2615 Lisp_Object tail;
2620 2616
@@ -2633,9 +2629,9 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist)
2633 Lisp_Object *parms; 2629 Lisp_Object *parms;
2634 Lisp_Object *values; 2630 Lisp_Object *values;
2635 ptrdiff_t i, p; 2631 ptrdiff_t i, p;
2636 int left_no_change = 0, top_no_change = 0; 2632 bool left_no_change = 0, top_no_change = 0;
2637 int icon_left_no_change = 0, icon_top_no_change = 0; 2633 bool icon_left_no_change = 0, icon_top_no_change = 0;
2638 int size_changed = 0; 2634 bool size_changed = 0;
2639 struct gcpro gcpro1, gcpro2; 2635 struct gcpro gcpro1, gcpro2;
2640 2636
2641 i = 0; 2637 i = 0;
@@ -2871,10 +2867,11 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist)
2871 /* Actually set that position, and convert to absolute. */ 2867 /* Actually set that position, and convert to absolute. */
2872 x_set_offset (f, leftpos, toppos, -1); 2868 x_set_offset (f, leftpos, toppos, -1);
2873 } 2869 }
2874 2870#ifdef HAVE_X_WINDOWS
2875 if ((!NILP (icon_left) || !NILP (icon_top)) 2871 if ((!NILP (icon_left) || !NILP (icon_top))
2876 && ! (icon_left_no_change && icon_top_no_change)) 2872 && ! (icon_left_no_change && icon_top_no_change))
2877 x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top)); 2873 x_wm_set_icon_position (f, XINT (icon_left), XINT (icon_top));
2874#endif /* HAVE_X_WINDOWS */
2878 } 2875 }
2879 2876
2880 UNGCPRO; 2877 UNGCPRO;
@@ -3351,7 +3348,7 @@ x_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
3351/* Return non-nil if frame F wants a bitmap icon. */ 3348/* Return non-nil if frame F wants a bitmap icon. */
3352 3349
3353Lisp_Object 3350Lisp_Object
3354x_icon_type (FRAME_PTR f) 3351x_icon_type (struct frame *f)
3355{ 3352{
3356 Lisp_Object tem; 3353 Lisp_Object tem;
3357 3354
@@ -3939,8 +3936,8 @@ On Nextstep, this just calls `ns-parse-geometry'. */)
3939#define DEFAULT_ROWS 35 3936#define DEFAULT_ROWS 35
3940#define DEFAULT_COLS 80 3937#define DEFAULT_COLS 80
3941 3938
3942int 3939long
3943x_figure_window_size (struct frame *f, Lisp_Object parms, int toolbar_p) 3940x_figure_window_size (struct frame *f, Lisp_Object parms, bool toolbar_p)
3944{ 3941{
3945 register Lisp_Object tem0, tem1, tem2; 3942 register Lisp_Object tem0, tem1, tem2;
3946 long window_prompting = 0; 3943 long window_prompting = 0;
@@ -4291,7 +4288,6 @@ syms_of_frame (void)
4291 DEFSYM (Qx_frame_parameter, "x-frame-parameter"); 4288 DEFSYM (Qx_frame_parameter, "x-frame-parameter");
4292 4289
4293 DEFSYM (Qterminal, "terminal"); 4290 DEFSYM (Qterminal, "terminal");
4294 DEFSYM (Qterminal_live_p, "terminal-live-p");
4295 4291
4296 DEFSYM (Qgeometry, "geometry"); 4292 DEFSYM (Qgeometry, "geometry");
4297 DEFSYM (Qworkarea, "workarea"); 4293 DEFSYM (Qworkarea, "workarea");
diff --git a/src/frame.h b/src/frame.h
index 31d3e73c3c3..33e4bb71d7a 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -591,8 +591,6 @@ default_pixels_per_inch_y (void)
591/* Return a pointer to the image cache of frame F. */ 591/* Return a pointer to the image cache of frame F. */
592#define FRAME_IMAGE_CACHE(F) ((F)->terminal->image_cache) 592#define FRAME_IMAGE_CACHE(F) ((F)->terminal->image_cache)
593 593
594typedef struct frame *FRAME_PTR;
595
596#define XFRAME(p) \ 594#define XFRAME(p) \
597 (eassert (FRAMEP (p)), (struct frame *) XUNTAG (p, Lisp_Vectorlike)) 595 (eassert (FRAMEP (p)), (struct frame *) XUNTAG (p, Lisp_Vectorlike))
598#define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME)) 596#define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME))
@@ -929,10 +927,9 @@ typedef struct frame *FRAME_PTR;
929 if (frame == hlinfo->mouse_face_mouse_frame) \ 927 if (frame == hlinfo->mouse_face_mouse_frame) \
930 { \ 928 { \
931 block_input (); \ 929 block_input (); \
932 if (hlinfo->mouse_face_mouse_frame) \ 930 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, \
933 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, \ 931 hlinfo->mouse_face_mouse_x, \
934 hlinfo->mouse_face_mouse_x, \ 932 hlinfo->mouse_face_mouse_y); \
935 hlinfo->mouse_face_mouse_y); \
936 unblock_input (); \ 933 unblock_input (); \
937 } \ 934 } \
938 } while (0) 935 } while (0)
@@ -952,7 +949,7 @@ typedef struct frame *FRAME_PTR;
952extern Lisp_Object Qframep, Qframe_live_p; 949extern Lisp_Object Qframep, Qframe_live_p;
953extern Lisp_Object Qtty, Qtty_type; 950extern Lisp_Object Qtty, Qtty_type;
954extern Lisp_Object Qtty_color_mode; 951extern Lisp_Object Qtty_color_mode;
955extern Lisp_Object Qterminal, Qterminal_live_p; 952extern Lisp_Object Qterminal;
956extern Lisp_Object Qnoelisp; 953extern Lisp_Object Qnoelisp;
957 954
958extern struct frame *last_nonminibuf_frame; 955extern struct frame *last_nonminibuf_frame;
@@ -962,7 +959,7 @@ extern struct frame *decode_window_system_frame (Lisp_Object);
962extern struct frame *decode_live_frame (Lisp_Object); 959extern struct frame *decode_live_frame (Lisp_Object);
963extern struct frame *decode_any_frame (Lisp_Object); 960extern struct frame *decode_any_frame (Lisp_Object);
964extern struct frame *make_initial_frame (void); 961extern struct frame *make_initial_frame (void);
965extern struct frame *make_frame (int); 962extern struct frame *make_frame (bool);
966#ifdef HAVE_WINDOW_SYSTEM 963#ifdef HAVE_WINDOW_SYSTEM
967extern struct frame *make_minibuffer_frame (void); 964extern struct frame *make_minibuffer_frame (void);
968extern struct frame *make_frame_without_minibuffer (Lisp_Object, 965extern struct frame *make_frame_without_minibuffer (Lisp_Object,
@@ -1207,8 +1204,7 @@ extern Lisp_Object Qrun_hook_with_args;
1207 1204
1208extern void x_set_scroll_bar_default_width (struct frame *); 1205extern void x_set_scroll_bar_default_width (struct frame *);
1209extern void x_set_offset (struct frame *, int, int, int); 1206extern void x_set_offset (struct frame *, int, int, int);
1210extern void x_wm_set_icon_position (struct frame *, int, int); 1207extern void x_wm_set_size_hint (struct frame *f, long flags, bool user_position);
1211extern void x_wm_set_size_hint (FRAME_PTR f, long flags, bool user_position);
1212 1208
1213extern Lisp_Object x_new_font (struct frame *, Lisp_Object, int); 1209extern Lisp_Object x_new_font (struct frame *, Lisp_Object, int);
1214 1210
@@ -1242,7 +1238,7 @@ extern void x_set_scroll_bar_width (struct frame *, Lisp_Object,
1242 1238
1243extern Lisp_Object x_icon_type (struct frame *); 1239extern Lisp_Object x_icon_type (struct frame *);
1244 1240
1245extern int x_figure_window_size (struct frame *, Lisp_Object, int); 1241extern long x_figure_window_size (struct frame *, Lisp_Object, bool);
1246 1242
1247extern void x_set_alpha (struct frame *, Lisp_Object, Lisp_Object); 1243extern void x_set_alpha (struct frame *, Lisp_Object, Lisp_Object);
1248 1244
@@ -1264,8 +1260,6 @@ extern void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y);
1264extern void x_make_frame_visible (struct frame *f); 1260extern void x_make_frame_visible (struct frame *f);
1265extern void x_make_frame_invisible (struct frame *f); 1261extern void x_make_frame_invisible (struct frame *f);
1266extern void x_iconify_frame (struct frame *f); 1262extern void x_iconify_frame (struct frame *f);
1267extern int x_pixel_width (struct frame *f);
1268extern int x_pixel_height (struct frame *f);
1269extern void x_set_frame_alpha (struct frame *f); 1263extern void x_set_frame_alpha (struct frame *f);
1270extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); 1264extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
1271extern void x_set_tool_bar_lines (struct frame *f, 1265extern void x_set_tool_bar_lines (struct frame *f,
@@ -1280,9 +1274,12 @@ extern void x_set_menu_bar_lines (struct frame *,
1280extern void free_frame_menubar (struct frame *); 1274extern void free_frame_menubar (struct frame *);
1281extern void x_free_frame_resources (struct frame *); 1275extern void x_free_frame_resources (struct frame *);
1282 1276
1283#if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT 1277#if defined HAVE_X_WINDOWS
1278extern void x_wm_set_icon_position (struct frame *, int, int);
1279#if !defined USE_X_TOOLKIT
1284extern char *x_get_resource_string (const char *, const char *); 1280extern char *x_get_resource_string (const char *, const char *);
1285#endif 1281#endif
1282#endif
1286 1283
1287extern void x_query_colors (struct frame *f, XColor *, int); 1284extern void x_query_colors (struct frame *f, XColor *, int);
1288extern void x_query_color (struct frame *f, XColor *); 1285extern void x_query_color (struct frame *f, XColor *);
diff --git a/src/ftfont.c b/src/ftfont.c
index 10090cb3bda..3636f86f5c4 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -493,12 +493,12 @@ ftfont_get_otf (struct ftfont_info *ftfont_info)
493} 493}
494#endif /* HAVE_LIBOTF */ 494#endif /* HAVE_LIBOTF */
495 495
496static Lisp_Object ftfont_get_cache (FRAME_PTR); 496static Lisp_Object ftfont_get_cache (struct frame *);
497static Lisp_Object ftfont_list (Lisp_Object, Lisp_Object); 497static Lisp_Object ftfont_list (struct frame *, Lisp_Object);
498static Lisp_Object ftfont_match (Lisp_Object, Lisp_Object); 498static Lisp_Object ftfont_match (struct frame *, Lisp_Object);
499static Lisp_Object ftfont_list_family (Lisp_Object); 499static Lisp_Object ftfont_list_family (struct frame *);
500static Lisp_Object ftfont_open (FRAME_PTR, Lisp_Object, int); 500static Lisp_Object ftfont_open (struct frame *, Lisp_Object, int);
501static void ftfont_close (FRAME_PTR, struct font *); 501static void ftfont_close (struct frame *, struct font *);
502static int ftfont_has_char (Lisp_Object, int); 502static int ftfont_has_char (Lisp_Object, int);
503static unsigned ftfont_encode_char (struct font *, int); 503static unsigned ftfont_encode_char (struct font *, int);
504static int ftfont_text_extents (struct font *, unsigned *, int, 504static int ftfont_text_extents (struct font *, unsigned *, int,
@@ -568,7 +568,7 @@ struct font_driver ftfont_driver =
568 }; 568 };
569 569
570static Lisp_Object 570static Lisp_Object
571ftfont_get_cache (FRAME_PTR f) 571ftfont_get_cache (struct frame *f)
572{ 572{
573 return freetype_font_cache; 573 return freetype_font_cache;
574} 574}
@@ -884,7 +884,7 @@ ftfont_spec_pattern (Lisp_Object spec, char *otlayout, struct OpenTypeSpec **ots
884} 884}
885 885
886static Lisp_Object 886static Lisp_Object
887ftfont_list (Lisp_Object frame, Lisp_Object spec) 887ftfont_list (struct frame *f, Lisp_Object spec)
888{ 888{
889 Lisp_Object val = Qnil, family, adstyle; 889 Lisp_Object val = Qnil, family, adstyle;
890 int i; 890 int i;
@@ -1080,7 +1080,7 @@ ftfont_list (Lisp_Object frame, Lisp_Object spec)
1080} 1080}
1081 1081
1082static Lisp_Object 1082static Lisp_Object
1083ftfont_match (Lisp_Object frame, Lisp_Object spec) 1083ftfont_match (struct frame *f, Lisp_Object spec)
1084{ 1084{
1085 Lisp_Object entity = Qnil; 1085 Lisp_Object entity = Qnil;
1086 FcPattern *pattern, *match = NULL; 1086 FcPattern *pattern, *match = NULL;
@@ -1130,7 +1130,7 @@ ftfont_match (Lisp_Object frame, Lisp_Object spec)
1130} 1130}
1131 1131
1132static Lisp_Object 1132static Lisp_Object
1133ftfont_list_family (Lisp_Object frame) 1133ftfont_list_family (struct frame *f)
1134{ 1134{
1135 Lisp_Object list = Qnil; 1135 Lisp_Object list = Qnil;
1136 FcPattern *pattern = NULL; 1136 FcPattern *pattern = NULL;
@@ -1173,7 +1173,7 @@ ftfont_list_family (Lisp_Object frame)
1173 1173
1174 1174
1175static Lisp_Object 1175static Lisp_Object
1176ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) 1176ftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
1177{ 1177{
1178 struct ftfont_info *ftfont_info; 1178 struct ftfont_info *ftfont_info;
1179 struct font *font; 1179 struct font *font;
@@ -1317,7 +1317,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
1317} 1317}
1318 1318
1319static void 1319static void
1320ftfont_close (FRAME_PTR f, struct font *font) 1320ftfont_close (struct frame *f, struct font *font)
1321{ 1321{
1322 struct ftfont_info *ftfont_info = (struct ftfont_info *) font; 1322 struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
1323 Lisp_Object val, cache; 1323 Lisp_Object val, cache;
diff --git a/src/ftxfont.c b/src/ftxfont.c
index 8c56ee05adc..63d03b0e244 100644
--- a/src/ftxfont.c
+++ b/src/ftxfont.c
@@ -57,7 +57,7 @@ struct ftxfont_frame_data
57/* Return an array of 6 GCs for antialiasing. */ 57/* Return an array of 6 GCs for antialiasing. */
58 58
59static GC * 59static GC *
60ftxfont_get_gcs (FRAME_PTR f, long unsigned int foreground, long unsigned int background) 60ftxfont_get_gcs (struct frame *f, long unsigned int foreground, long unsigned int background)
61{ 61{
62 XColor color; 62 XColor color;
63 XGCValues xgcv; 63 XGCValues xgcv;
@@ -134,7 +134,7 @@ ftxfont_get_gcs (FRAME_PTR f, long unsigned int foreground, long unsigned int ba
134} 134}
135 135
136static int 136static int
137ftxfont_draw_bitmap (FRAME_PTR f, GC gc_fore, GC *gcs, struct font *font, 137ftxfont_draw_bitmap (struct frame *f, GC gc_fore, GC *gcs, struct font *font,
138 unsigned int code, int x, int y, XPoint *p, int size, 138 unsigned int code, int x, int y, XPoint *p, int size,
139 int *n, bool flush) 139 int *n, bool flush)
140{ 140{
@@ -212,7 +212,7 @@ ftxfont_draw_bitmap (FRAME_PTR f, GC gc_fore, GC *gcs, struct font *font,
212} 212}
213 213
214static void 214static void
215ftxfont_draw_background (FRAME_PTR f, struct font *font, GC gc, int x, int y, 215ftxfont_draw_background (struct frame *f, struct font *font, GC gc, int x, int y,
216 int width) 216 int width)
217{ 217{
218 XGCValues xgcv; 218 XGCValues xgcv;
@@ -226,9 +226,9 @@ ftxfont_draw_background (FRAME_PTR f, struct font *font, GC gc, int x, int y,
226} 226}
227 227
228static Lisp_Object 228static Lisp_Object
229ftxfont_list (Lisp_Object frame, Lisp_Object spec) 229ftxfont_list (struct frame *f, Lisp_Object spec)
230{ 230{
231 Lisp_Object list = ftfont_driver.list (frame, spec), tail; 231 Lisp_Object list = ftfont_driver.list (f, spec), tail;
232 232
233 for (tail = list; CONSP (tail); tail = XCDR (tail)) 233 for (tail = list; CONSP (tail); tail = XCDR (tail))
234 ASET (XCAR (tail), FONT_TYPE_INDEX, Qftx); 234 ASET (XCAR (tail), FONT_TYPE_INDEX, Qftx);
@@ -236,9 +236,9 @@ ftxfont_list (Lisp_Object frame, Lisp_Object spec)
236} 236}
237 237
238static Lisp_Object 238static Lisp_Object
239ftxfont_match (Lisp_Object frame, Lisp_Object spec) 239ftxfont_match (struct frame *f, Lisp_Object spec)
240{ 240{
241 Lisp_Object entity = ftfont_driver.match (frame, spec); 241 Lisp_Object entity = ftfont_driver.match (f, spec);
242 242
243 if (VECTORP (entity)) 243 if (VECTORP (entity))
244 ASET (entity, FONT_TYPE_INDEX, Qftx); 244 ASET (entity, FONT_TYPE_INDEX, Qftx);
@@ -246,7 +246,7 @@ ftxfont_match (Lisp_Object frame, Lisp_Object spec)
246} 246}
247 247
248static Lisp_Object 248static Lisp_Object
249ftxfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) 249ftxfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
250{ 250{
251 Lisp_Object font_object; 251 Lisp_Object font_object;
252 struct font *font; 252 struct font *font;
@@ -260,7 +260,7 @@ ftxfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
260} 260}
261 261
262static void 262static void
263ftxfont_close (FRAME_PTR f, struct font *font) 263ftxfont_close (struct frame *f, struct font *font)
264{ 264{
265 ftfont_driver.close (f, font); 265 ftfont_driver.close (f, font);
266} 266}
@@ -269,7 +269,7 @@ static int
269ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y, 269ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y,
270 bool with_background) 270 bool with_background)
271{ 271{
272 FRAME_PTR f = s->f; 272 struct frame *f = s->f;
273 struct face *face = s->face; 273 struct face *face = s->face;
274 struct font *font = s->font; 274 struct font *font = s->font;
275 XPoint p[0x700]; 275 XPoint p[0x700];
@@ -338,7 +338,7 @@ ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y,
338} 338}
339 339
340static int 340static int
341ftxfont_end_for_frame (FRAME_PTR f) 341ftxfont_end_for_frame (struct frame *f)
342{ 342{
343 struct ftxfont_frame_data *data = font_get_frame_data (f, &ftxfont_driver); 343 struct ftxfont_frame_data *data = font_get_frame_data (f, &ftxfont_driver);
344 344
diff --git a/src/gtkutil.c b/src/gtkutil.c
index f8ddf6a90f6..237d031295c 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -136,7 +136,7 @@ static GdkDisplay *gdpy_def;
136 W can be a GtkMenu or a GtkWindow widget. */ 136 W can be a GtkMenu or a GtkWindow widget. */
137 137
138static void 138static void
139xg_set_screen (GtkWidget *w, FRAME_PTR f) 139xg_set_screen (GtkWidget *w, struct frame *f)
140{ 140{
141 if (FRAME_X_DISPLAY (f) != DEFAULT_GDK_DISPLAY ()) 141 if (FRAME_X_DISPLAY (f) != DEFAULT_GDK_DISPLAY ())
142 { 142 {
@@ -280,7 +280,7 @@ xg_create_default_cursor (Display *dpy)
280} 280}
281 281
282static GdkPixbuf * 282static GdkPixbuf *
283xg_get_pixbuf_from_pixmap (FRAME_PTR f, Pixmap pix) 283xg_get_pixbuf_from_pixmap (struct frame *f, Pixmap pix)
284{ 284{
285 int iunused; 285 int iunused;
286 GdkPixbuf *tmp_buf; 286 GdkPixbuf *tmp_buf;
@@ -311,7 +311,7 @@ xg_get_pixbuf_from_pixmap (FRAME_PTR f, Pixmap pix)
311/* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel. */ 311/* Apply GMASK to GPIX and return a GdkPixbuf with an alpha channel. */
312 312
313static GdkPixbuf * 313static GdkPixbuf *
314xg_get_pixbuf_from_pix_and_mask (FRAME_PTR f, 314xg_get_pixbuf_from_pix_and_mask (struct frame *f,
315 Pixmap pix, 315 Pixmap pix,
316 Pixmap mask) 316 Pixmap mask)
317{ 317{
@@ -387,7 +387,7 @@ file_for_image (Lisp_Object image)
387 If OLD_WIDGET is not NULL, that widget is modified. */ 387 If OLD_WIDGET is not NULL, that widget is modified. */
388 388
389static GtkWidget * 389static GtkWidget *
390xg_get_image_for_pixmap (FRAME_PTR f, 390xg_get_image_for_pixmap (struct frame *f,
391 struct image *img, 391 struct image *img,
392 GtkWidget *widget, 392 GtkWidget *widget,
393 GtkImage *old_widget) 393 GtkImage *old_widget)
@@ -641,7 +641,7 @@ hierarchy_ch_cb (GtkWidget *widget,
641 GtkWidget *previous_toplevel, 641 GtkWidget *previous_toplevel,
642 gpointer user_data) 642 gpointer user_data)
643{ 643{
644 FRAME_PTR f = (FRAME_PTR) user_data; 644 struct frame *f = (struct frame *) user_data;
645 struct x_output *x = f->output_data.x; 645 struct x_output *x = f->output_data.x;
646 GtkWidget *top = gtk_widget_get_toplevel (x->ttip_lbl); 646 GtkWidget *top = gtk_widget_get_toplevel (x->ttip_lbl);
647 647
@@ -663,7 +663,7 @@ qttip_cb (GtkWidget *widget,
663 GtkTooltip *tooltip, 663 GtkTooltip *tooltip,
664 gpointer user_data) 664 gpointer user_data)
665{ 665{
666 FRAME_PTR f = (FRAME_PTR) user_data; 666 struct frame *f = (struct frame *) user_data;
667 struct x_output *x = f->output_data.x; 667 struct x_output *x = f->output_data.x;
668 if (x->ttip_widget == NULL) 668 if (x->ttip_widget == NULL)
669 { 669 {
@@ -707,7 +707,7 @@ qttip_cb (GtkWidget *widget,
707 Return true if a system tooltip is available. */ 707 Return true if a system tooltip is available. */
708 708
709bool 709bool
710xg_prepare_tooltip (FRAME_PTR f, 710xg_prepare_tooltip (struct frame *f,
711 Lisp_Object string, 711 Lisp_Object string,
712 int *width, 712 int *width,
713 int *height) 713 int *height)
@@ -764,7 +764,7 @@ xg_prepare_tooltip (FRAME_PTR f,
764 xg_prepare_tooltip must have been called before this function. */ 764 xg_prepare_tooltip must have been called before this function. */
765 765
766void 766void
767xg_show_tooltip (FRAME_PTR f, int root_x, int root_y) 767xg_show_tooltip (struct frame *f, int root_x, int root_y)
768{ 768{
769#ifdef USE_GTK_TOOLTIP 769#ifdef USE_GTK_TOOLTIP
770 struct x_output *x = f->output_data.x; 770 struct x_output *x = f->output_data.x;
@@ -783,7 +783,7 @@ xg_show_tooltip (FRAME_PTR f, int root_x, int root_y)
783 system tooltips). */ 783 system tooltips). */
784 784
785bool 785bool
786xg_hide_tooltip (FRAME_PTR f) 786xg_hide_tooltip (struct frame *f)
787{ 787{
788 bool ret = 0; 788 bool ret = 0;
789#ifdef USE_GTK_TOOLTIP 789#ifdef USE_GTK_TOOLTIP
@@ -827,7 +827,7 @@ my_log_handler (const gchar *log_domain, GLogLevelFlags log_level,
827 F is the frame we shall set geometry for. */ 827 F is the frame we shall set geometry for. */
828 828
829static void 829static void
830xg_set_geometry (FRAME_PTR f) 830xg_set_geometry (struct frame *f)
831{ 831{
832 if (f->size_hint_flags & (USPosition | PPosition)) 832 if (f->size_hint_flags & (USPosition | PPosition))
833 { 833 {
@@ -865,7 +865,7 @@ xg_set_geometry (FRAME_PTR f)
865 and use a GtkFixed widget, this doesn't happen automatically. */ 865 and use a GtkFixed widget, this doesn't happen automatically. */
866 866
867static void 867static void
868xg_clear_under_internal_border (FRAME_PTR f) 868xg_clear_under_internal_border (struct frame *f)
869{ 869{
870 if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0) 870 if (FRAME_INTERNAL_BORDER_WIDTH (f) > 0)
871 { 871 {
@@ -903,7 +903,7 @@ xg_clear_under_internal_border (FRAME_PTR f)
903 PIXELWIDTH, PIXELHEIGHT is the new size in pixels. */ 903 PIXELWIDTH, PIXELHEIGHT is the new size in pixels. */
904 904
905void 905void
906xg_frame_resized (FRAME_PTR f, int pixelwidth, int pixelheight) 906xg_frame_resized (struct frame *f, int pixelwidth, int pixelheight)
907{ 907{
908 int rows, columns; 908 int rows, columns;
909 909
@@ -939,7 +939,7 @@ xg_frame_resized (FRAME_PTR f, int pixelwidth, int pixelheight)
939 COLUMNS/ROWS is the size the edit area shall have after the resize. */ 939 COLUMNS/ROWS is the size the edit area shall have after the resize. */
940 940
941void 941void
942xg_frame_set_char_size (FRAME_PTR f, int cols, int rows) 942xg_frame_set_char_size (struct frame *f, int cols, int rows)
943{ 943{
944 int pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows) 944 int pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows)
945 + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f); 945 + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f);
@@ -1002,7 +1002,7 @@ xg_frame_set_char_size (FRAME_PTR f, int cols, int rows)
1002 The policy is to keep the number of editable lines. */ 1002 The policy is to keep the number of editable lines. */
1003 1003
1004static void 1004static void
1005xg_height_or_width_changed (FRAME_PTR f) 1005xg_height_or_width_changed (struct frame *f)
1006{ 1006{
1007 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 1007 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
1008 FRAME_TOTAL_PIXEL_WIDTH (f), 1008 FRAME_TOTAL_PIXEL_WIDTH (f),
@@ -1042,7 +1042,7 @@ xg_win_to_widget (Display *dpy, Window wdesc)
1042/* Set the background of widget W to PIXEL. */ 1042/* Set the background of widget W to PIXEL. */
1043 1043
1044static void 1044static void
1045xg_set_widget_bg (FRAME_PTR f, GtkWidget *w, long unsigned int pixel) 1045xg_set_widget_bg (struct frame *f, GtkWidget *w, long unsigned int pixel)
1046{ 1046{
1047#ifdef HAVE_GTK3 1047#ifdef HAVE_GTK3
1048 GdkRGBA bg; 1048 GdkRGBA bg;
@@ -1093,7 +1093,7 @@ style_changed_cb (GObject *go,
1093 Lisp_Object rest, frame; 1093 Lisp_Object rest, frame;
1094 FOR_EACH_FRAME (rest, frame) 1094 FOR_EACH_FRAME (rest, frame)
1095 { 1095 {
1096 FRAME_PTR f = XFRAME (frame); 1096 struct frame *f = XFRAME (frame);
1097 if (FRAME_LIVE_P (f) 1097 if (FRAME_LIVE_P (f)
1098 && FRAME_X_P (f) 1098 && FRAME_X_P (f)
1099 && FRAME_X_DISPLAY (f) == dpy) 1099 && FRAME_X_DISPLAY (f) == dpy)
@@ -1115,7 +1115,7 @@ delete_cb (GtkWidget *widget,
1115#ifdef HAVE_GTK3 1115#ifdef HAVE_GTK3
1116 /* The event doesn't arrive in the normal event loop. Send event 1116 /* The event doesn't arrive in the normal event loop. Send event
1117 here. */ 1117 here. */
1118 FRAME_PTR f = (FRAME_PTR) user_data; 1118 struct frame *f = (struct frame *) user_data;
1119 struct input_event ie; 1119 struct input_event ie;
1120 1120
1121 EVENT_INIT (ie); 1121 EVENT_INIT (ie);
@@ -1131,7 +1131,7 @@ delete_cb (GtkWidget *widget,
1131 Return true if creation succeeded. */ 1131 Return true if creation succeeded. */
1132 1132
1133bool 1133bool
1134xg_create_frame_widgets (FRAME_PTR f) 1134xg_create_frame_widgets (struct frame *f)
1135{ 1135{
1136 GtkWidget *wtop; 1136 GtkWidget *wtop;
1137 GtkWidget *wvbox, *whbox; 1137 GtkWidget *wvbox, *whbox;
@@ -1300,7 +1300,7 @@ xg_create_frame_widgets (FRAME_PTR f)
1300} 1300}
1301 1301
1302void 1302void
1303xg_free_frame_widgets (FRAME_PTR f) 1303xg_free_frame_widgets (struct frame *f)
1304{ 1304{
1305 if (FRAME_GTK_OUTER_WIDGET (f)) 1305 if (FRAME_GTK_OUTER_WIDGET (f))
1306 { 1306 {
@@ -1332,7 +1332,7 @@ xg_free_frame_widgets (FRAME_PTR f)
1332 flag (this is useful when FLAGS is 0). */ 1332 flag (this is useful when FLAGS is 0). */
1333 1333
1334void 1334void
1335x_wm_set_size_hint (FRAME_PTR f, long int flags, bool user_position) 1335x_wm_set_size_hint (struct frame *f, long int flags, bool user_position)
1336{ 1336{
1337 /* Must use GTK routines here, otherwise GTK resets the size hints 1337 /* Must use GTK routines here, otherwise GTK resets the size hints
1338 to its own defaults. */ 1338 to its own defaults. */
@@ -1432,7 +1432,7 @@ x_wm_set_size_hint (FRAME_PTR f, long int flags, bool user_position)
1432 BG is the pixel value to change to. */ 1432 BG is the pixel value to change to. */
1433 1433
1434void 1434void
1435xg_set_background_color (FRAME_PTR f, long unsigned int bg) 1435xg_set_background_color (struct frame *f, long unsigned int bg)
1436{ 1436{
1437 if (FRAME_GTK_WIDGET (f)) 1437 if (FRAME_GTK_WIDGET (f))
1438 { 1438 {
@@ -1447,7 +1447,7 @@ xg_set_background_color (FRAME_PTR f, long unsigned int bg)
1447 functions so GTK does not overwrite the icon. */ 1447 functions so GTK does not overwrite the icon. */
1448 1448
1449void 1449void
1450xg_set_frame_icon (FRAME_PTR f, Pixmap icon_pixmap, Pixmap icon_mask) 1450xg_set_frame_icon (struct frame *f, Pixmap icon_pixmap, Pixmap icon_mask)
1451{ 1451{
1452 GdkPixbuf *gp = xg_get_pixbuf_from_pix_and_mask (f, 1452 GdkPixbuf *gp = xg_get_pixbuf_from_pix_and_mask (f,
1453 icon_pixmap, 1453 icon_pixmap,
@@ -1693,7 +1693,7 @@ xg_maybe_add_timer (gpointer data)
1693 The dialog W is not destroyed when this function returns. */ 1693 The dialog W is not destroyed when this function returns. */
1694 1694
1695static int 1695static int
1696xg_dialog_run (FRAME_PTR f, GtkWidget *w) 1696xg_dialog_run (struct frame *f, GtkWidget *w)
1697{ 1697{
1698 ptrdiff_t count = SPECPDL_INDEX (); 1698 ptrdiff_t count = SPECPDL_INDEX ();
1699 struct xg_dialog_data dd; 1699 struct xg_dialog_data dd;
@@ -1813,7 +1813,7 @@ xg_toggle_notify_cb (GObject *gobject, GParamSpec *arg1, gpointer user_data)
1813 Returns the created widget. */ 1813 Returns the created widget. */
1814 1814
1815static GtkWidget * 1815static GtkWidget *
1816xg_get_file_with_chooser (FRAME_PTR f, 1816xg_get_file_with_chooser (struct frame *f,
1817 char *prompt, 1817 char *prompt,
1818 char *default_filename, 1818 char *default_filename,
1819 bool mustmatch_p, bool only_dir_p, 1819 bool mustmatch_p, bool only_dir_p,
@@ -1935,7 +1935,7 @@ xg_get_file_name_from_selector (GtkWidget *w)
1935 Returns the created widget. */ 1935 Returns the created widget. */
1936 1936
1937static GtkWidget * 1937static GtkWidget *
1938xg_get_file_with_selection (FRAME_PTR f, 1938xg_get_file_with_selection (struct frame *f,
1939 char *prompt, 1939 char *prompt,
1940 char *default_filename, 1940 char *default_filename,
1941 bool mustmatch_p, bool only_dir_p, 1941 bool mustmatch_p, bool only_dir_p,
@@ -1977,7 +1977,7 @@ xg_get_file_with_selection (FRAME_PTR f,
1977 The returned string must be freed by the caller. */ 1977 The returned string must be freed by the caller. */
1978 1978
1979char * 1979char *
1980xg_get_file_name (FRAME_PTR f, 1980xg_get_file_name (struct frame *f,
1981 char *prompt, 1981 char *prompt,
1982 char *default_filename, 1982 char *default_filename,
1983 bool mustmatch_p, 1983 bool mustmatch_p,
@@ -2051,7 +2051,7 @@ extern Lisp_Object Qxft;
2051 DEFAULT_NAME, if non-zero, is the default font name. */ 2051 DEFAULT_NAME, if non-zero, is the default font name. */
2052 2052
2053Lisp_Object 2053Lisp_Object
2054xg_get_font (FRAME_PTR f, const char *default_name) 2054xg_get_font (struct frame *f, const char *default_name)
2055{ 2055{
2056 GtkWidget *w; 2056 GtkWidget *w;
2057 int done = 0; 2057 int done = 0;
@@ -2169,7 +2169,7 @@ static xg_list_node xg_menu_item_cb_list;
2169 allocated xg_menu_cb_data if CL_DATA is NULL. */ 2169 allocated xg_menu_cb_data if CL_DATA is NULL. */
2170 2170
2171static xg_menu_cb_data * 2171static xg_menu_cb_data *
2172make_cl_data (xg_menu_cb_data *cl_data, FRAME_PTR f, GCallback highlight_cb) 2172make_cl_data (xg_menu_cb_data *cl_data, struct frame *f, GCallback highlight_cb)
2173{ 2173{
2174 if (! cl_data) 2174 if (! cl_data)
2175 { 2175 {
@@ -2201,7 +2201,7 @@ make_cl_data (xg_menu_cb_data *cl_data, FRAME_PTR f, GCallback highlight_cb)
2201 2201
2202static void 2202static void
2203update_cl_data (xg_menu_cb_data *cl_data, 2203update_cl_data (xg_menu_cb_data *cl_data,
2204 FRAME_PTR f, 2204 struct frame *f,
2205 GCallback highlight_cb) 2205 GCallback highlight_cb)
2206{ 2206{
2207 if (cl_data) 2207 if (cl_data)
@@ -2251,7 +2251,7 @@ xg_mark_data (void)
2251 2251
2252 FOR_EACH_FRAME (rest, frame) 2252 FOR_EACH_FRAME (rest, frame)
2253 { 2253 {
2254 FRAME_PTR f = XFRAME (frame); 2254 struct frame *f = XFRAME (frame);
2255 2255
2256 if (FRAME_X_P (f) && FRAME_GTK_OUTER_WIDGET (f)) 2256 if (FRAME_X_P (f) && FRAME_GTK_OUTER_WIDGET (f))
2257 { 2257 {
@@ -2480,7 +2480,7 @@ xg_have_tear_offs (void)
2480 2480
2481static GtkWidget * 2481static GtkWidget *
2482xg_create_one_menuitem (widget_value *item, 2482xg_create_one_menuitem (widget_value *item,
2483 FRAME_PTR f, 2483 struct frame *f,
2484 GCallback select_cb, 2484 GCallback select_cb,
2485 GCallback highlight_cb, 2485 GCallback highlight_cb,
2486 xg_menu_cb_data *cl_data, 2486 xg_menu_cb_data *cl_data,
@@ -2551,7 +2551,7 @@ xg_create_one_menuitem (widget_value *item,
2551 2551
2552static GtkWidget * 2552static GtkWidget *
2553create_menus (widget_value *data, 2553create_menus (widget_value *data,
2554 FRAME_PTR f, 2554 struct frame *f,
2555 GCallback select_cb, 2555 GCallback select_cb,
2556 GCallback deactivate_cb, 2556 GCallback deactivate_cb,
2557 GCallback highlight_cb, 2557 GCallback highlight_cb,
@@ -2694,9 +2694,9 @@ create_menus (widget_value *data,
2694 Returns the widget created. */ 2694 Returns the widget created. */
2695 2695
2696GtkWidget * 2696GtkWidget *
2697xg_create_widget (const char *type, const char *name, FRAME_PTR f, widget_value *val, 2697xg_create_widget (const char *type, const char *name, struct frame *f,
2698 GCallback select_cb, GCallback deactivate_cb, 2698 widget_value *val, GCallback select_cb,
2699 GCallback highlight_cb) 2699 GCallback deactivate_cb, GCallback highlight_cb)
2700{ 2700{
2701 GtkWidget *w = 0; 2701 GtkWidget *w = 0;
2702 bool menu_bar_p = strcmp (type, "menubar") == 0; 2702 bool menu_bar_p = strcmp (type, "menubar") == 0;
@@ -2802,7 +2802,7 @@ xg_destroy_widgets (GList *list)
2802 2802
2803static void 2803static void
2804xg_update_menubar (GtkWidget *menubar, 2804xg_update_menubar (GtkWidget *menubar,
2805 FRAME_PTR f, 2805 struct frame *f,
2806 GList **list, 2806 GList **list,
2807 GList *iter, 2807 GList *iter,
2808 int pos, 2808 int pos,
@@ -3119,7 +3119,7 @@ xg_update_radio_item (widget_value *val, GtkWidget *w)
3119 3119
3120static GtkWidget * 3120static GtkWidget *
3121xg_update_submenu (GtkWidget *submenu, 3121xg_update_submenu (GtkWidget *submenu,
3122 FRAME_PTR f, 3122 struct frame *f,
3123 widget_value *val, 3123 widget_value *val,
3124 GCallback select_cb, 3124 GCallback select_cb,
3125 GCallback deactivate_cb, 3125 GCallback deactivate_cb,
@@ -3261,8 +3261,8 @@ xg_update_submenu (GtkWidget *submenu,
3261 HIGHLIGHT_CB is the callback to call when entering/leaving menu items. */ 3261 HIGHLIGHT_CB is the callback to call when entering/leaving menu items. */
3262 3262
3263void 3263void
3264xg_modify_menubar_widgets (GtkWidget *menubar, FRAME_PTR f, widget_value *val, 3264xg_modify_menubar_widgets (GtkWidget *menubar, struct frame *f,
3265 bool deep_p, 3265 widget_value *val, bool deep_p,
3266 GCallback select_cb, GCallback deactivate_cb, 3266 GCallback select_cb, GCallback deactivate_cb,
3267 GCallback highlight_cb) 3267 GCallback highlight_cb)
3268{ 3268{
@@ -3336,7 +3336,7 @@ static void
3336menubar_map_cb (GtkWidget *w, gpointer user_data) 3336menubar_map_cb (GtkWidget *w, gpointer user_data)
3337{ 3337{
3338 GtkRequisition req; 3338 GtkRequisition req;
3339 FRAME_PTR f = (FRAME_PTR) user_data; 3339 struct frame *f = (struct frame *) user_data;
3340 gtk_widget_get_preferred_size (w, NULL, &req); 3340 gtk_widget_get_preferred_size (w, NULL, &req);
3341 if (FRAME_MENUBAR_HEIGHT (f) != req.height) 3341 if (FRAME_MENUBAR_HEIGHT (f) != req.height)
3342 { 3342 {
@@ -3349,7 +3349,7 @@ menubar_map_cb (GtkWidget *w, gpointer user_data)
3349 changed. */ 3349 changed. */
3350 3350
3351void 3351void
3352xg_update_frame_menubar (FRAME_PTR f) 3352xg_update_frame_menubar (struct frame *f)
3353{ 3353{
3354 struct x_output *x = f->output_data.x; 3354 struct x_output *x = f->output_data.x;
3355 GtkRequisition req; 3355 GtkRequisition req;
@@ -3387,7 +3387,7 @@ xg_update_frame_menubar (FRAME_PTR f)
3387 This is used when deleting a frame, and when turning off the menu bar. */ 3387 This is used when deleting a frame, and when turning off the menu bar. */
3388 3388
3389void 3389void
3390free_frame_menubar (FRAME_PTR f) 3390free_frame_menubar (struct frame *f)
3391{ 3391{
3392 struct x_output *x = f->output_data.x; 3392 struct x_output *x = f->output_data.x;
3393 3393
@@ -3406,7 +3406,7 @@ free_frame_menubar (FRAME_PTR f)
3406} 3406}
3407 3407
3408bool 3408bool
3409xg_event_is_for_menubar (FRAME_PTR f, XEvent *event) 3409xg_event_is_for_menubar (struct frame *f, XEvent *event)
3410{ 3410{
3411 struct x_output *x = f->output_data.x; 3411 struct x_output *x = f->output_data.x;
3412 GList *iter; 3412 GList *iter;
@@ -3619,7 +3619,7 @@ xg_gtk_scroll_destroy (GtkWidget *widget, gpointer data)
3619 to set resources for the widget. */ 3619 to set resources for the widget. */
3620 3620
3621void 3621void
3622xg_create_scroll_bar (FRAME_PTR f, 3622xg_create_scroll_bar (struct frame *f,
3623 struct scroll_bar *bar, 3623 struct scroll_bar *bar,
3624 GCallback scroll_callback, 3624 GCallback scroll_callback,
3625 GCallback end_callback, 3625 GCallback end_callback,
@@ -3681,7 +3681,7 @@ xg_create_scroll_bar (FRAME_PTR f,
3681/* Remove the scroll bar represented by SCROLLBAR_ID from the frame F. */ 3681/* Remove the scroll bar represented by SCROLLBAR_ID from the frame F. */
3682 3682
3683void 3683void
3684xg_remove_scroll_bar (FRAME_PTR f, ptrdiff_t scrollbar_id) 3684xg_remove_scroll_bar (struct frame *f, ptrdiff_t scrollbar_id)
3685{ 3685{
3686 GtkWidget *w = xg_get_widget_from_map (scrollbar_id); 3686 GtkWidget *w = xg_get_widget_from_map (scrollbar_id);
3687 if (w) 3687 if (w)
@@ -3699,7 +3699,7 @@ xg_remove_scroll_bar (FRAME_PTR f, ptrdiff_t scrollbar_id)
3699 WIDTH, HEIGHT is the size in pixels the bar shall have. */ 3699 WIDTH, HEIGHT is the size in pixels the bar shall have. */
3700 3700
3701void 3701void
3702xg_update_scrollbar_pos (FRAME_PTR f, 3702xg_update_scrollbar_pos (struct frame *f,
3703 ptrdiff_t scrollbar_id, 3703 ptrdiff_t scrollbar_id,
3704 int top, 3704 int top,
3705 int left, 3705 int left,
@@ -3781,7 +3781,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
3781{ 3781{
3782 GtkWidget *wscroll = xg_get_widget_from_map (bar->x_window); 3782 GtkWidget *wscroll = xg_get_widget_from_map (bar->x_window);
3783 3783
3784 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); 3784 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
3785 3785
3786 if (wscroll && NILP (bar->dragging)) 3786 if (wscroll && NILP (bar->dragging))
3787 { 3787 {
@@ -3861,7 +3861,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
3861 frame. This function does additional checks. */ 3861 frame. This function does additional checks. */
3862 3862
3863bool 3863bool
3864xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event) 3864xg_event_is_for_scrollbar (struct frame *f, XEvent *event)
3865{ 3865{
3866 bool retval = 0; 3866 bool retval = 0;
3867 3867
@@ -3946,7 +3946,8 @@ xg_tool_bar_callback (GtkWidget *w, gpointer client_data)
3946 gpointer gmod = g_object_get_data (G_OBJECT (w), XG_TOOL_BAR_LAST_MODIFIER); 3946 gpointer gmod = g_object_get_data (G_OBJECT (w), XG_TOOL_BAR_LAST_MODIFIER);
3947 intptr_t mod = (intptr_t) gmod; 3947 intptr_t mod = (intptr_t) gmod;
3948 3948
3949 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); 3949 struct frame *f = (struct frame *) g_object_get_data (G_OBJECT (w),
3950 XG_FRAME_DATA);
3950 Lisp_Object key, frame; 3951 Lisp_Object key, frame;
3951 struct input_event event; 3952 struct input_event event;
3952 EVENT_INIT (event); 3953 EVENT_INIT (event);
@@ -4149,7 +4150,7 @@ xg_tool_bar_detach_callback (GtkHandleBox *wbox,
4149 GtkWidget *w, 4150 GtkWidget *w,
4150 gpointer client_data) 4151 gpointer client_data)
4151{ 4152{
4152 FRAME_PTR f = (FRAME_PTR) client_data; 4153 struct frame *f = (struct frame *) client_data;
4153 4154
4154 g_object_set (G_OBJECT (w), "show-arrow", !x_gtk_whole_detached_tool_bar, 4155 g_object_set (G_OBJECT (w), "show-arrow", !x_gtk_whole_detached_tool_bar,
4155 NULL); 4156 NULL);
@@ -4186,7 +4187,7 @@ xg_tool_bar_attach_callback (GtkHandleBox *wbox,
4186 GtkWidget *w, 4187 GtkWidget *w,
4187 gpointer client_data) 4188 gpointer client_data)
4188{ 4189{
4189 FRAME_PTR f = (FRAME_PTR) client_data; 4190 struct frame *f = (struct frame *) client_data;
4190 g_object_set (G_OBJECT (w), "show-arrow", TRUE, NULL); 4191 g_object_set (G_OBJECT (w), "show-arrow", TRUE, NULL);
4191 4192
4192 if (f) 4193 if (f)
@@ -4224,7 +4225,8 @@ xg_tool_bar_help_callback (GtkWidget *w,
4224 gpointer client_data) 4225 gpointer client_data)
4225{ 4226{
4226 intptr_t idx = (intptr_t) client_data; 4227 intptr_t idx = (intptr_t) client_data;
4227 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); 4228 struct frame *f = (struct frame *) g_object_get_data (G_OBJECT (w),
4229 XG_FRAME_DATA);
4228 Lisp_Object help, frame; 4230 Lisp_Object help, frame;
4229 4231
4230 if (! f || ! f->n_tool_bar_items || NILP (f->tool_bar_items)) 4232 if (! f || ! f->n_tool_bar_items || NILP (f->tool_bar_items))
@@ -4297,7 +4299,7 @@ xg_tool_bar_item_expose_callback (GtkWidget *w,
4297/* Attach a tool bar to frame F. */ 4299/* Attach a tool bar to frame F. */
4298 4300
4299static void 4301static void
4300xg_pack_tool_bar (FRAME_PTR f, Lisp_Object pos) 4302xg_pack_tool_bar (struct frame *f, Lisp_Object pos)
4301{ 4303{
4302 struct x_output *x = f->output_data.x; 4304 struct x_output *x = f->output_data.x;
4303 bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright); 4305 bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright);
@@ -4354,7 +4356,7 @@ xg_pack_tool_bar (FRAME_PTR f, Lisp_Object pos)
4354 x->toolbar_is_packed = true; 4356 x->toolbar_is_packed = true;
4355} 4357}
4356 4358
4357static bool xg_update_tool_bar_sizes (FRAME_PTR f); 4359static bool xg_update_tool_bar_sizes (struct frame *f);
4358 4360
4359static void 4361static void
4360tb_size_cb (GtkWidget *widget, 4362tb_size_cb (GtkWidget *widget,
@@ -4364,7 +4366,7 @@ tb_size_cb (GtkWidget *widget,
4364 /* When tool bar is created it has one preferred size. But when size is 4366 /* When tool bar is created it has one preferred size. But when size is
4365 allocated between widgets, it may get another. So we must update 4367 allocated between widgets, it may get another. So we must update
4366 size hints if tool bar size changes. Seen on Fedora 18 at least. */ 4368 size hints if tool bar size changes. Seen on Fedora 18 at least. */
4367 FRAME_PTR f = (FRAME_PTR) user_data; 4369 struct frame *f = (struct frame *) user_data;
4368 if (xg_update_tool_bar_sizes (f)) 4370 if (xg_update_tool_bar_sizes (f))
4369 x_wm_set_size_hint (f, 0, 0); 4371 x_wm_set_size_hint (f, 0, 0);
4370} 4372}
@@ -4372,7 +4374,7 @@ tb_size_cb (GtkWidget *widget,
4372/* Create a tool bar for frame F. */ 4374/* Create a tool bar for frame F. */
4373 4375
4374static void 4376static void
4375xg_create_tool_bar (FRAME_PTR f) 4377xg_create_tool_bar (struct frame *f)
4376{ 4378{
4377 struct x_output *x = f->output_data.x; 4379 struct x_output *x = f->output_data.x;
4378#if GTK_CHECK_VERSION (3, 3, 6) 4380#if GTK_CHECK_VERSION (3, 3, 6)
@@ -4415,7 +4417,7 @@ xg_create_tool_bar (FRAME_PTR f)
4415 Returns IMAGE if RTL is not found. */ 4417 Returns IMAGE if RTL is not found. */
4416 4418
4417static Lisp_Object 4419static Lisp_Object
4418find_rtl_image (FRAME_PTR f, Lisp_Object image, Lisp_Object rtl) 4420find_rtl_image (struct frame *f, Lisp_Object image, Lisp_Object rtl)
4419{ 4421{
4420 int i; 4422 int i;
4421 Lisp_Object file, rtl_name; 4423 Lisp_Object file, rtl_name;
@@ -4443,7 +4445,7 @@ find_rtl_image (FRAME_PTR f, Lisp_Object image, Lisp_Object rtl)
4443} 4445}
4444 4446
4445static GtkToolItem * 4447static GtkToolItem *
4446xg_make_tool_item (FRAME_PTR f, 4448xg_make_tool_item (struct frame *f,
4447 GtkWidget *wimage, 4449 GtkWidget *wimage,
4448 GtkWidget **wbutton, 4450 GtkWidget **wbutton,
4449 const char *label, 4451 const char *label,
@@ -4606,7 +4608,7 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name,
4606} 4608}
4607 4609
4608static bool 4610static bool
4609xg_update_tool_bar_sizes (FRAME_PTR f) 4611xg_update_tool_bar_sizes (struct frame *f)
4610{ 4612{
4611 struct x_output *x = f->output_data.x; 4613 struct x_output *x = f->output_data.x;
4612 GtkRequisition req; 4614 GtkRequisition req;
@@ -4654,7 +4656,7 @@ xg_update_tool_bar_sizes (FRAME_PTR f)
4654/* Update the tool bar for frame F. Add new buttons and remove old. */ 4656/* Update the tool bar for frame F. Add new buttons and remove old. */
4655 4657
4656void 4658void
4657update_frame_tool_bar (FRAME_PTR f) 4659update_frame_tool_bar (struct frame *f)
4658{ 4660{
4659 int i, j; 4661 int i, j;
4660 struct x_output *x = f->output_data.x; 4662 struct x_output *x = f->output_data.x;
@@ -4929,7 +4931,7 @@ update_frame_tool_bar (FRAME_PTR f)
4929 Remove the tool bar. */ 4931 Remove the tool bar. */
4930 4932
4931void 4933void
4932free_frame_tool_bar (FRAME_PTR f) 4934free_frame_tool_bar (struct frame *f)
4933{ 4935{
4934 struct x_output *x = f->output_data.x; 4936 struct x_output *x = f->output_data.x;
4935 4937
@@ -4976,7 +4978,7 @@ free_frame_tool_bar (FRAME_PTR f)
4976} 4978}
4977 4979
4978void 4980void
4979xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos) 4981xg_change_toolbar_position (struct frame *f, Lisp_Object pos)
4980{ 4982{
4981 struct x_output *x = f->output_data.x; 4983 struct x_output *x = f->output_data.x;
4982 GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x); 4984 GtkWidget *top_widget = TOOLBAR_TOP_WIDGET (x);
diff --git a/src/gtkutil.h b/src/gtkutil.h
index 288b3e99299..482331a8934 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -55,7 +55,7 @@ typedef struct xg_menu_cb_data_
55{ 55{
56 xg_list_node ptrs; 56 xg_list_node ptrs;
57 57
58 FRAME_PTR f; 58 struct frame *f;
59 Lisp_Object menu_bar_vector; 59 Lisp_Object menu_bar_vector;
60 int menu_bar_items_used; 60 int menu_bar_items_used;
61 GCallback highlight_cb; 61 GCallback highlight_cb;
@@ -81,46 +81,46 @@ extern void free_widget_value (struct _widget_value *);
81 81
82extern bool xg_uses_old_file_dialog (void) ATTRIBUTE_CONST; 82extern bool xg_uses_old_file_dialog (void) ATTRIBUTE_CONST;
83 83
84extern char *xg_get_file_name (FRAME_PTR f, 84extern char *xg_get_file_name (struct frame *f,
85 char *prompt, 85 char *prompt,
86 char *default_filename, 86 char *default_filename,
87 bool mustmatch_p, 87 bool mustmatch_p,
88 bool only_dir_p); 88 bool only_dir_p);
89 89
90extern Lisp_Object xg_get_font (FRAME_PTR f, const char *); 90extern Lisp_Object xg_get_font (struct frame *f, const char *);
91 91
92extern GtkWidget *xg_create_widget (const char *type, 92extern GtkWidget *xg_create_widget (const char *type,
93 const char *name, 93 const char *name,
94 FRAME_PTR f, 94 struct frame *f,
95 struct _widget_value *val, 95 struct _widget_value *val,
96 GCallback select_cb, 96 GCallback select_cb,
97 GCallback deactivate_cb, 97 GCallback deactivate_cb,
98 GCallback highlight_cb); 98 GCallback highlight_cb);
99 99
100extern void xg_modify_menubar_widgets (GtkWidget *menubar, 100extern void xg_modify_menubar_widgets (GtkWidget *menubar,
101 FRAME_PTR f, 101 struct frame *f,
102 struct _widget_value *val, 102 struct _widget_value *val,
103 bool deep_p, 103 bool deep_p,
104 GCallback select_cb, 104 GCallback select_cb,
105 GCallback deactivate_cb, 105 GCallback deactivate_cb,
106 GCallback highlight_cb); 106 GCallback highlight_cb);
107 107
108extern void xg_update_frame_menubar (FRAME_PTR f); 108extern void xg_update_frame_menubar (struct frame *f);
109 109
110extern bool xg_event_is_for_menubar (FRAME_PTR f, XEvent *event); 110extern bool xg_event_is_for_menubar (struct frame *f, XEvent *event);
111 111
112extern bool xg_have_tear_offs (void); 112extern bool xg_have_tear_offs (void);
113 113
114extern ptrdiff_t xg_get_scroll_id_for_window (Display *dpy, Window wid); 114extern ptrdiff_t xg_get_scroll_id_for_window (Display *dpy, Window wid);
115 115
116extern void xg_create_scroll_bar (FRAME_PTR f, 116extern void xg_create_scroll_bar (struct frame *f,
117 struct scroll_bar *bar, 117 struct scroll_bar *bar,
118 GCallback scroll_callback, 118 GCallback scroll_callback,
119 GCallback end_callback, 119 GCallback end_callback,
120 const char *scroll_bar_name); 120 const char *scroll_bar_name);
121extern void xg_remove_scroll_bar (FRAME_PTR f, ptrdiff_t scrollbar_id); 121extern void xg_remove_scroll_bar (struct frame *f, ptrdiff_t scrollbar_id);
122 122
123extern void xg_update_scrollbar_pos (FRAME_PTR f, 123extern void xg_update_scrollbar_pos (struct frame *f,
124 ptrdiff_t scrollbar_id, 124 ptrdiff_t scrollbar_id,
125 int top, 125 int top,
126 int left, 126 int left,
@@ -131,40 +131,40 @@ extern void xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
131 int portion, 131 int portion,
132 int position, 132 int position,
133 int whole); 133 int whole);
134extern bool xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event); 134extern bool xg_event_is_for_scrollbar (struct frame *f, XEvent *event);
135extern int xg_get_default_scrollbar_width (void); 135extern int xg_get_default_scrollbar_width (void);
136 136
137extern void update_frame_tool_bar (FRAME_PTR f); 137extern void update_frame_tool_bar (struct frame *f);
138extern void free_frame_tool_bar (FRAME_PTR f); 138extern void free_frame_tool_bar (struct frame *f);
139extern void xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos); 139extern void xg_change_toolbar_position (struct frame *f, Lisp_Object pos);
140 140
141extern void xg_frame_resized (FRAME_PTR f, 141extern void xg_frame_resized (struct frame *f,
142 int pixelwidth, 142 int pixelwidth,
143 int pixelheight); 143 int pixelheight);
144extern void xg_frame_set_char_size (FRAME_PTR f, int cols, int rows); 144extern void xg_frame_set_char_size (struct frame *f, int cols, int rows);
145extern GtkWidget * xg_win_to_widget (Display *dpy, Window wdesc); 145extern GtkWidget * xg_win_to_widget (Display *dpy, Window wdesc);
146 146
147extern void xg_display_open (char *display_name, Display **dpy); 147extern void xg_display_open (char *display_name, Display **dpy);
148extern void xg_display_close (Display *dpy); 148extern void xg_display_close (Display *dpy);
149extern GdkCursor * xg_create_default_cursor (Display *dpy); 149extern GdkCursor * xg_create_default_cursor (Display *dpy);
150 150
151extern bool xg_create_frame_widgets (FRAME_PTR f); 151extern bool xg_create_frame_widgets (struct frame *f);
152extern void xg_free_frame_widgets (FRAME_PTR f); 152extern void xg_free_frame_widgets (struct frame *f);
153extern void xg_set_background_color (FRAME_PTR f, unsigned long bg); 153extern void xg_set_background_color (struct frame *f, unsigned long bg);
154extern bool xg_check_special_colors (struct frame *f, 154extern bool xg_check_special_colors (struct frame *f,
155 const char *color_name, 155 const char *color_name,
156 XColor *color); 156 XColor *color);
157 157
158extern void xg_set_frame_icon (FRAME_PTR f, 158extern void xg_set_frame_icon (struct frame *f,
159 Pixmap icon_pixmap, 159 Pixmap icon_pixmap,
160 Pixmap icon_mask); 160 Pixmap icon_mask);
161 161
162extern bool xg_prepare_tooltip (FRAME_PTR f, 162extern bool xg_prepare_tooltip (struct frame *f,
163 Lisp_Object string, 163 Lisp_Object string,
164 int *width, 164 int *width,
165 int *height); 165 int *height);
166extern void xg_show_tooltip (FRAME_PTR f, int root_x, int root_y); 166extern void xg_show_tooltip (struct frame *f, int root_x, int root_y);
167extern bool xg_hide_tooltip (FRAME_PTR f); 167extern bool xg_hide_tooltip (struct frame *f);
168 168
169 169
170/* Mark all callback data that are Lisp_object:s during GC. */ 170/* Mark all callback data that are Lisp_object:s during GC. */
diff --git a/src/image.c b/src/image.c
index 1f8cb520dca..911ca8e6681 100644
--- a/src/image.c
+++ b/src/image.c
@@ -164,20 +164,20 @@ XPutPixel (XImagePtr ximage, int x, int y, unsigned long pixel)
164/* Functions to access the contents of a bitmap, given an id. */ 164/* Functions to access the contents of a bitmap, given an id. */
165 165
166int 166int
167x_bitmap_height (FRAME_PTR f, ptrdiff_t id) 167x_bitmap_height (struct frame *f, ptrdiff_t id)
168{ 168{
169 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].height; 169 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].height;
170} 170}
171 171
172int 172int
173x_bitmap_width (FRAME_PTR f, ptrdiff_t id) 173x_bitmap_width (struct frame *f, ptrdiff_t id)
174{ 174{
175 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].width; 175 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].width;
176} 176}
177 177
178#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) 178#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI)
179ptrdiff_t 179ptrdiff_t
180x_bitmap_pixmap (FRAME_PTR f, ptrdiff_t id) 180x_bitmap_pixmap (struct frame *f, ptrdiff_t id)
181{ 181{
182 /* HAVE_NTGUI needs the explicit cast here. */ 182 /* HAVE_NTGUI needs the explicit cast here. */
183 return (ptrdiff_t) FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap; 183 return (ptrdiff_t) FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap;
@@ -186,7 +186,7 @@ x_bitmap_pixmap (FRAME_PTR f, ptrdiff_t id)
186 186
187#ifdef HAVE_X_WINDOWS 187#ifdef HAVE_X_WINDOWS
188int 188int
189x_bitmap_mask (FRAME_PTR f, ptrdiff_t id) 189x_bitmap_mask (struct frame *f, ptrdiff_t id)
190{ 190{
191 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].mask; 191 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].mask;
192} 192}
@@ -195,7 +195,7 @@ x_bitmap_mask (FRAME_PTR f, ptrdiff_t id)
195/* Allocate a new bitmap record. Returns index of new record. */ 195/* Allocate a new bitmap record. Returns index of new record. */
196 196
197static ptrdiff_t 197static ptrdiff_t
198x_allocate_bitmap_record (FRAME_PTR f) 198x_allocate_bitmap_record (struct frame *f)
199{ 199{
200 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 200 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
201 ptrdiff_t i; 201 ptrdiff_t i;
@@ -216,7 +216,7 @@ x_allocate_bitmap_record (FRAME_PTR f)
216/* Add one reference to the reference count of the bitmap with id ID. */ 216/* Add one reference to the reference count of the bitmap with id ID. */
217 217
218void 218void
219x_reference_bitmap (FRAME_PTR f, ptrdiff_t id) 219x_reference_bitmap (struct frame *f, ptrdiff_t id)
220{ 220{
221 ++FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].refcount; 221 ++FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].refcount;
222} 222}
@@ -384,7 +384,7 @@ free_bitmap_record (Display_Info *dpyinfo, Bitmap_Record *bm)
384/* Remove reference to bitmap with id number ID. */ 384/* Remove reference to bitmap with id number ID. */
385 385
386void 386void
387x_destroy_bitmap (FRAME_PTR f, ptrdiff_t id) 387x_destroy_bitmap (struct frame *f, ptrdiff_t id)
388{ 388{
389 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 389 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
390 390
diff --git a/src/insdel.c b/src/insdel.c
index 15d585568a0..58c3e15c233 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1211,12 +1211,9 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte,
1211 adjust_markers_for_insert (from, from_byte, 1211 adjust_markers_for_insert (from, from_byte,
1212 from + len, from_byte + len_byte, 0); 1212 from + len, from_byte + len_byte, 0);
1213 1213
1214 if (! EQ (BVAR (current_buffer, undo_list), Qt)) 1214 if (nchars_del > 0)
1215 { 1215 record_delete (from, prev_text);
1216 if (nchars_del > 0) 1216 record_insert (from, len);
1217 record_delete (from, prev_text);
1218 record_insert (from, len);
1219 }
1220 1217
1221 if (len > nchars_del) 1218 if (len > nchars_del)
1222 adjust_overlays_for_insert (from, len - nchars_del); 1219 adjust_overlays_for_insert (from, len - nchars_del);
@@ -1373,12 +1370,12 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
1373 emacs_abort (); 1370 emacs_abort ();
1374#endif 1371#endif
1375 1372
1376 if (! EQ (BVAR (current_buffer, undo_list), Qt)) 1373 /* Record the insertion first, so that when we undo,
1374 the deletion will be undone first. Thus, undo
1375 will insert before deleting, and thus will keep
1376 the markers before and after this text separate. */
1377 if (!NILP (deletion))
1377 { 1378 {
1378 /* Record the insertion first, so that when we undo,
1379 the deletion will be undone first. Thus, undo
1380 will insert before deleting, and thus will keep
1381 the markers before and after this text separate. */
1382 record_insert (from + SCHARS (deletion), inschars); 1379 record_insert (from + SCHARS (deletion), inschars);
1383 record_delete (from, deletion); 1380 record_delete (from, deletion);
1384 } 1381 }
@@ -1718,8 +1715,7 @@ del_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
1718 so that undo handles this after reinserting the text. */ 1715 so that undo handles this after reinserting the text. */
1719 adjust_markers_for_delete (from, from_byte, to, to_byte); 1716 adjust_markers_for_delete (from, from_byte, to, to_byte);
1720 1717
1721 if (! EQ (BVAR (current_buffer, undo_list), Qt)) 1718 record_delete (from, deletion);
1722 record_delete (from, deletion);
1723 MODIFF++; 1719 MODIFF++;
1724 CHARS_MODIFF = MODIFF; 1720 CHARS_MODIFF = MODIFF;
1725 1721
diff --git a/src/keyboard.c b/src/keyboard.c
index 830f70bc1f5..c026b16e689 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1281,7 +1281,7 @@ static
1281#endif 1281#endif
1282bool ignore_mouse_drag_p; 1282bool ignore_mouse_drag_p;
1283 1283
1284static FRAME_PTR 1284static struct frame *
1285some_mouse_moved (void) 1285some_mouse_moved (void)
1286{ 1286{
1287 Lisp_Object tail, frame; 1287 Lisp_Object tail, frame;
@@ -2163,7 +2163,7 @@ show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object,
2163 This causes trouble if we are trying to read a mouse motion 2163 This causes trouble if we are trying to read a mouse motion
2164 event (i.e., if we are inside a `track-mouse' form), so we 2164 event (i.e., if we are inside a `track-mouse' form), so we
2165 restore the mouse_moved flag. */ 2165 restore the mouse_moved flag. */
2166 FRAME_PTR f = NILP (do_mouse_tracking) ? NULL : some_mouse_moved (); 2166 struct frame *f = NILP (do_mouse_tracking) ? NULL : some_mouse_moved ();
2167 help = call1 (Qmouse_fixup_help_message, help); 2167 help = call1 (Qmouse_fixup_help_message, help);
2168 if (f) 2168 if (f)
2169 f->mouse_moved = 1; 2169 f->mouse_moved = 1;
@@ -4152,7 +4152,7 @@ kbd_buffer_get_event (KBOARD **kbp,
4152 /* Try generating a mouse motion event. */ 4152 /* Try generating a mouse motion event. */
4153 else if (!NILP (do_mouse_tracking) && some_mouse_moved ()) 4153 else if (!NILP (do_mouse_tracking) && some_mouse_moved ())
4154 { 4154 {
4155 FRAME_PTR f = some_mouse_moved (); 4155 struct frame *f = some_mouse_moved ();
4156 Lisp_Object bar_window; 4156 Lisp_Object bar_window;
4157 enum scroll_bar_part part; 4157 enum scroll_bar_part part;
4158 Lisp_Object x, y; 4158 Lisp_Object x, y;
@@ -5898,7 +5898,7 @@ make_lispy_event (struct input_event *event)
5898 5898
5899 case DRAG_N_DROP_EVENT: 5899 case DRAG_N_DROP_EVENT:
5900 { 5900 {
5901 FRAME_PTR f; 5901 struct frame *f;
5902 Lisp_Object head, position; 5902 Lisp_Object head, position;
5903 Lisp_Object files; 5903 Lisp_Object files;
5904 5904
@@ -5977,7 +5977,7 @@ make_lispy_event (struct input_event *event)
5977#ifdef HAVE_GPM 5977#ifdef HAVE_GPM
5978 case GPM_CLICK_EVENT: 5978 case GPM_CLICK_EVENT:
5979 { 5979 {
5980 FRAME_PTR f = XFRAME (event->frame_or_window); 5980 struct frame *f = XFRAME (event->frame_or_window);
5981 Lisp_Object head, position; 5981 Lisp_Object head, position;
5982 Lisp_Object *start_pos_ptr; 5982 Lisp_Object *start_pos_ptr;
5983 Lisp_Object start_pos; 5983 Lisp_Object start_pos;
@@ -6031,7 +6031,7 @@ make_lispy_event (struct input_event *event)
6031} 6031}
6032 6032
6033static Lisp_Object 6033static Lisp_Object
6034make_lispy_movement (FRAME_PTR frame, Lisp_Object bar_window, enum scroll_bar_part part, 6034make_lispy_movement (struct frame *frame, Lisp_Object bar_window, enum scroll_bar_part part,
6035 Lisp_Object x, Lisp_Object y, Time t) 6035 Lisp_Object x, Lisp_Object y, Time t)
6036{ 6036{
6037 /* Is it a scroll bar movement? */ 6037 /* Is it a scroll bar movement? */
diff --git a/src/lisp.h b/src/lisp.h
index 254ead231b9..5daddb7d335 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3302,6 +3302,7 @@ extern struct hash_table_test hashtest_eql, hashtest_equal;
3302 3302
3303extern Lisp_Object substring_both (Lisp_Object, ptrdiff_t, ptrdiff_t, 3303extern Lisp_Object substring_both (Lisp_Object, ptrdiff_t, ptrdiff_t,
3304 ptrdiff_t, ptrdiff_t); 3304 ptrdiff_t, ptrdiff_t);
3305extern Lisp_Object merge (Lisp_Object, Lisp_Object, Lisp_Object);
3305extern Lisp_Object do_yes_or_no_p (Lisp_Object); 3306extern Lisp_Object do_yes_or_no_p (Lisp_Object);
3306extern Lisp_Object concat2 (Lisp_Object, Lisp_Object); 3307extern Lisp_Object concat2 (Lisp_Object, Lisp_Object);
3307extern Lisp_Object concat3 (Lisp_Object, Lisp_Object, Lisp_Object); 3308extern Lisp_Object concat3 (Lisp_Object, Lisp_Object, Lisp_Object);
diff --git a/src/menu.c b/src/menu.c
index 6b4a22d3052..6fce5b91caf 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -867,7 +867,8 @@ update_submenu_strings (widget_value *first_wv)
867 VECTOR is an array of menu events for the whole menu. */ 867 VECTOR is an array of menu events for the whole menu. */
868 868
869void 869void
870find_and_call_menu_selection (FRAME_PTR f, int menu_bar_items_used, Lisp_Object vector, void *client_data) 870find_and_call_menu_selection (struct frame *f, int menu_bar_items_used,
871 Lisp_Object vector, void *client_data)
871{ 872{
872 Lisp_Object prefix, entry; 873 Lisp_Object prefix, entry;
873 Lisp_Object *subprefix_stack; 874 Lisp_Object *subprefix_stack;
@@ -950,7 +951,7 @@ find_and_call_menu_selection (FRAME_PTR f, int menu_bar_items_used, Lisp_Object
950/* As above, but return the menu selection instead of storing in kb buffer. 951/* As above, but return the menu selection instead of storing in kb buffer.
951 If KEYMAPS, return full prefixes to selection. */ 952 If KEYMAPS, return full prefixes to selection. */
952Lisp_Object 953Lisp_Object
953find_and_return_menu_selection (FRAME_PTR f, bool keymaps, void *client_data) 954find_and_return_menu_selection (struct frame *f, bool keymaps, void *client_data)
954{ 955{
955 Lisp_Object prefix, entry; 956 Lisp_Object prefix, entry;
956 int i; 957 int i;
@@ -1060,7 +1061,7 @@ no quit occurs and `x-popup-menu' returns nil. */)
1060 Lisp_Object title; 1061 Lisp_Object title;
1061 const char *error_name = NULL; 1062 const char *error_name = NULL;
1062 Lisp_Object selection = Qnil; 1063 Lisp_Object selection = Qnil;
1063 FRAME_PTR f = NULL; 1064 struct frame *f = NULL;
1064 Lisp_Object x, y, window; 1065 Lisp_Object x, y, window;
1065 bool keymaps = 0; 1066 bool keymaps = 0;
1066 bool for_click = 0; 1067 bool for_click = 0;
@@ -1116,7 +1117,7 @@ no quit occurs and `x-popup-menu' returns nil. */)
1116 if (get_current_pos_p) 1117 if (get_current_pos_p)
1117 { 1118 {
1118 /* Use the mouse's current position. */ 1119 /* Use the mouse's current position. */
1119 FRAME_PTR new_f = SELECTED_FRAME (); 1120 struct frame *new_f = SELECTED_FRAME ();
1120#ifdef HAVE_X_WINDOWS 1121#ifdef HAVE_X_WINDOWS
1121 /* Can't use mouse_position_hook for X since it returns 1122 /* Can't use mouse_position_hook for X since it returns
1122 coordinates relative to the window the mouse is in, 1123 coordinates relative to the window the mouse is in,
diff --git a/src/menu.h b/src/menu.h
index f60873eadb3..0f94ad8000b 100644
--- a/src/menu.h
+++ b/src/menu.h
@@ -35,20 +35,20 @@ extern void list_of_panes (Lisp_Object);
35 || defined (HAVE_NS) 35 || defined (HAVE_NS)
36extern void free_menubar_widget_value_tree (widget_value *); 36extern void free_menubar_widget_value_tree (widget_value *);
37extern void update_submenu_strings (widget_value *); 37extern void update_submenu_strings (widget_value *);
38extern void find_and_call_menu_selection (FRAME_PTR, int, 38extern void find_and_call_menu_selection (struct frame *, int,
39 Lisp_Object, void *); 39 Lisp_Object, void *);
40extern widget_value *xmalloc_widget_value (void); 40extern widget_value *xmalloc_widget_value (void);
41extern widget_value *digest_single_submenu (int, int, bool); 41extern widget_value *digest_single_submenu (int, int, bool);
42#endif 42#endif
43 43
44#ifdef HAVE_X_WINDOWS 44#ifdef HAVE_X_WINDOWS
45extern void mouse_position_for_popup (FRAME_PTR f, int *x, int *y); 45extern void mouse_position_for_popup (struct frame *f, int *x, int *y);
46#endif 46#endif
47 47
48extern Lisp_Object w32_menu_show (FRAME_PTR, int, int, int, int, 48extern Lisp_Object w32_menu_show (struct frame *, int, int, int, int,
49 Lisp_Object, const char **); 49 Lisp_Object, const char **);
50extern Lisp_Object ns_menu_show (FRAME_PTR, int, int, bool, bool, 50extern Lisp_Object ns_menu_show (struct frame *, int, int, bool, bool,
51 Lisp_Object, const char **); 51 Lisp_Object, const char **);
52extern Lisp_Object xmenu_show (FRAME_PTR, int, int, bool, bool, 52extern Lisp_Object xmenu_show (struct frame *, int, int, bool, bool,
53 Lisp_Object, const char **, Time); 53 Lisp_Object, const char **, Time);
54#endif /* MENU_H */ 54#endif /* MENU_H */
diff --git a/src/msdos.c b/src/msdos.c
index a2bcc06ac17..88a2eb60726 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -298,7 +298,7 @@ mouse_button_depressed (int b, int *xp, int *yp)
298} 298}
299 299
300void 300void
301mouse_get_pos (FRAME_PTR *f, int insist, Lisp_Object *bar_window, 301mouse_get_pos (struct frame **f, int insist, Lisp_Object *bar_window,
302 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, 302 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y,
303 Time *time) 303 Time *time)
304{ 304{
@@ -1158,7 +1158,7 @@ IT_display_cursor (int on)
1158 to put the cursor at the end of the text displayed there. */ 1158 to put the cursor at the end of the text displayed there. */
1159 1159
1160static void 1160static void
1161IT_cmgoto (FRAME_PTR f) 1161IT_cmgoto (struct frame *f)
1162{ 1162{
1163 /* Only set the cursor to where it should be if the display is 1163 /* Only set the cursor to where it should be if the display is
1164 already in sync with the window contents. */ 1164 already in sync with the window contents. */
@@ -1760,7 +1760,7 @@ IT_set_frame_parameters (struct frame *f, Lisp_Object alist)
1760 } 1760 }
1761} 1761}
1762 1762
1763extern void init_frame_faces (FRAME_PTR); 1763extern void init_frame_faces (struct frame *);
1764 1764
1765#endif /* !HAVE_X_WINDOWS */ 1765#endif /* !HAVE_X_WINDOWS */
1766 1766
@@ -3320,18 +3320,6 @@ XMenuDestroy (Display *foo, XMenu *menu)
3320 xfree (menu); 3320 xfree (menu);
3321 menu_help_message = prev_menu_help_message = NULL; 3321 menu_help_message = prev_menu_help_message = NULL;
3322} 3322}
3323
3324int
3325x_pixel_width (struct frame *f)
3326{
3327 return FRAME_COLS (f);
3328}
3329
3330int
3331x_pixel_height (struct frame *f)
3332{
3333 return FRAME_LINES (f);
3334}
3335#endif /* !HAVE_X_WINDOWS */ 3323#endif /* !HAVE_X_WINDOWS */
3336 3324
3337/* ----------------------- DOS / UNIX conversion --------------------- */ 3325/* ----------------------- DOS / UNIX conversion --------------------- */
diff --git a/src/msdos.h b/src/msdos.h
index ee0d49464ae..6a6fe349131 100644
--- a/src/msdos.h
+++ b/src/msdos.h
@@ -74,8 +74,6 @@ struct window;
74/* Defined in xfns.c; emulated on msdos.c */ 74/* Defined in xfns.c; emulated on msdos.c */
75 75
76extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); 76extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
77extern int x_pixel_width (struct frame *);
78extern int x_pixel_height (struct frame *);
79 77
80#define XFreeGC (void) 78#define XFreeGC (void)
81#define x_destroy_bitmap(p1,p2) 79#define x_destroy_bitmap(p1,p2)
diff --git a/src/nsfns.m b/src/nsfns.m
index 121ac539646..3f43afde787 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -143,7 +143,7 @@ check_ns_display_info (Lisp_Object object)
143 dpyinfo = ns_display_info_for_name (object); 143 dpyinfo = ns_display_info_for_name (object);
144 else 144 else
145 { 145 {
146 FRAME_PTR f = decode_window_system_frame (object); 146 struct frame *f = decode_window_system_frame (object);
147 dpyinfo = FRAME_NS_DISPLAY_INFO (f); 147 dpyinfo = FRAME_NS_DISPLAY_INFO (f);
148 } 148 }
149 149
@@ -431,7 +431,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
431} 431}
432 432
433static void 433static void
434ns_set_name_internal (FRAME_PTR f, Lisp_Object name) 434ns_set_name_internal (struct frame *f, Lisp_Object name)
435{ 435{
436 struct gcpro gcpro1; 436 struct gcpro gcpro1;
437 Lisp_Object encoded_name, encoded_icon_name; 437 Lisp_Object encoded_name, encoded_icon_name;
@@ -503,7 +503,7 @@ ns_set_name (struct frame *f, Lisp_Object name, int explicit)
503 specified a name for the frame; the name will override any set by the 503 specified a name for the frame; the name will override any set by the
504 redisplay code. */ 504 redisplay code. */
505static void 505static void
506x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 506x_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
507{ 507{
508 NSTRACE (x_explicitly_set_name); 508 NSTRACE (x_explicitly_set_name);
509 ns_set_name (f, arg, 1); 509 ns_set_name (f, arg, 1);
@@ -514,7 +514,7 @@ x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
514 name; names set this way will never override names set by the user's 514 name; names set this way will never override names set by the user's
515 lisp code. */ 515 lisp code. */
516void 516void
517x_implicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 517x_implicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
518{ 518{
519 NSTRACE (x_implicitly_set_name); 519 NSTRACE (x_implicitly_set_name);
520 520
@@ -857,7 +857,7 @@ ns_cursor_type_to_lisp (int arg)
857 857
858/* This is the same as the xfns.c definition. */ 858/* This is the same as the xfns.c definition. */
859static void 859static void
860x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 860x_set_cursor_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
861{ 861{
862 set_frame_cursor_types (f, arg); 862 set_frame_cursor_types (f, arg);
863 863
@@ -1068,7 +1068,7 @@ This function is an internal primitive--use `make-frame' instead. */)
1068 Lisp_Object frame, tem; 1068 Lisp_Object frame, tem;
1069 Lisp_Object name; 1069 Lisp_Object name;
1070 int minibuffer_only = 0; 1070 int minibuffer_only = 0;
1071 int window_prompting = 0; 1071 long window_prompting = 0;
1072 int width, height; 1072 int width, height;
1073 ptrdiff_t count = specpdl_ptr - specpdl; 1073 ptrdiff_t count = specpdl_ptr - specpdl;
1074 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 1074 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
@@ -2231,21 +2231,6 @@ x_get_focus_frame (struct frame *frame)
2231 return nsfocus; 2231 return nsfocus;
2232} 2232}
2233 2233
2234
2235int
2236x_pixel_width (struct frame *f)
2237{
2238 return FRAME_PIXEL_WIDTH (f);
2239}
2240
2241
2242int
2243x_pixel_height (struct frame *f)
2244{
2245 return FRAME_PIXEL_HEIGHT (f);
2246}
2247
2248
2249void 2234void
2250x_sync (struct frame *f) 2235x_sync (struct frame *f)
2251{ 2236{
diff --git a/src/nsfont.m b/src/nsfont.m
index df7ef0bb0bc..ad169d7ddae 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -619,13 +619,13 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
619 ========================================================================== */ 619 ========================================================================== */
620 620
621 621
622static Lisp_Object nsfont_get_cache (FRAME_PTR frame); 622static Lisp_Object nsfont_get_cache (struct frame *frame);
623static Lisp_Object nsfont_list (Lisp_Object frame, Lisp_Object font_spec); 623static Lisp_Object nsfont_list (struct frame *, Lisp_Object);
624static Lisp_Object nsfont_match (Lisp_Object frame, Lisp_Object font_spec); 624static Lisp_Object nsfont_match (struct frame *, Lisp_Object);
625static Lisp_Object nsfont_list_family (Lisp_Object frame); 625static Lisp_Object nsfont_list_family (struct frame *);
626static Lisp_Object nsfont_open (FRAME_PTR f, Lisp_Object font_entity, 626static Lisp_Object nsfont_open (struct frame *f, Lisp_Object font_entity,
627 int pixel_size); 627 int pixel_size);
628static void nsfont_close (FRAME_PTR f, struct font *font); 628static void nsfont_close (struct frame *f, struct font *font);
629static int nsfont_has_char (Lisp_Object entity, int c); 629static int nsfont_has_char (Lisp_Object entity, int c);
630static unsigned int nsfont_encode_char (struct font *font, int c); 630static unsigned int nsfont_encode_char (struct font *font, int c);
631static int nsfont_text_extents (struct font *font, unsigned int *code, 631static int nsfont_text_extents (struct font *font, unsigned int *code,
@@ -659,7 +659,7 @@ struct font_driver nsfont_driver =
659/* Return a cache of font-entities on FRAME. The cache must be a 659/* Return a cache of font-entities on FRAME. The cache must be a
660 cons whose cdr part is the actual cache area. */ 660 cons whose cdr part is the actual cache area. */
661static Lisp_Object 661static Lisp_Object
662nsfont_get_cache (FRAME_PTR frame) 662nsfont_get_cache (struct frame *frame)
663{ 663{
664 Display_Info *dpyinfo = FRAME_NS_DISPLAY_INFO (frame); 664 Display_Info *dpyinfo = FRAME_NS_DISPLAY_INFO (frame);
665 return (dpyinfo->name_list_element); 665 return (dpyinfo->name_list_element);
@@ -679,9 +679,9 @@ nsfont_get_cache (FRAME_PTR frame)
679 weight, slant, width, size (0 if scalable), 679 weight, slant, width, size (0 if scalable),
680 dpi, spacing, avgwidth (0 if scalable) */ 680 dpi, spacing, avgwidth (0 if scalable) */
681static Lisp_Object 681static Lisp_Object
682nsfont_list (Lisp_Object frame, Lisp_Object font_spec) 682nsfont_list (struct frame *f, Lisp_Object font_spec)
683{ 683{
684 return ns_findfonts (font_spec, NO); 684 return ns_findfonts (font_spec, NO);
685} 685}
686 686
687 687
@@ -690,16 +690,16 @@ nsfont_list (Lisp_Object frame, Lisp_Object font_spec)
690 `face-font-selection-order' is ignored here. 690 `face-font-selection-order' is ignored here.
691 Properties to be considered are same as for list(). */ 691 Properties to be considered are same as for list(). */
692static Lisp_Object 692static Lisp_Object
693nsfont_match (Lisp_Object frame, Lisp_Object font_spec) 693nsfont_match (struct frame *f, Lisp_Object font_spec)
694{ 694{
695 return ns_findfonts(font_spec, YES); 695 return ns_findfonts (font_spec, YES);
696} 696}
697 697
698 698
699/* List available families. The value is a list of family names 699/* List available families. The value is a list of family names
700 (symbols). */ 700 (symbols). */
701static Lisp_Object 701static Lisp_Object
702nsfont_list_family (Lisp_Object frame) 702nsfont_list_family (struct frame *f)
703{ 703{
704 Lisp_Object list = Qnil; 704 Lisp_Object list = Qnil;
705 NSEnumerator *families; 705 NSEnumerator *families;
@@ -724,7 +724,7 @@ nsfont_list_family (Lisp_Object frame)
724/* Open a font specified by FONT_ENTITY on frame F. If the font is 724/* Open a font specified by FONT_ENTITY on frame F. If the font is
725 scalable, open it with PIXEL_SIZE. */ 725 scalable, open it with PIXEL_SIZE. */
726static Lisp_Object 726static Lisp_Object
727nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) 727nsfont_open (struct frame *f, Lisp_Object font_entity, int pixel_size)
728{ 728{
729 BOOL synthItal; 729 BOOL synthItal;
730 unsigned int traits = 0; 730 unsigned int traits = 0;
@@ -931,7 +931,7 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
931 931
932/* Close FONT on frame F. */ 932/* Close FONT on frame F. */
933static void 933static void
934nsfont_close (FRAME_PTR f, struct font *font) 934nsfont_close (struct frame *f, struct font *font)
935{ 935{
936 struct nsfont_info *font_info = (struct nsfont_info *)font; 936 struct nsfont_info *font_info = (struct nsfont_info *)font;
937 int i; 937 int i;
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 02fe0b04ca0..464be89c524 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -806,7 +806,7 @@ extern NSString *NSMenuDidBeginTrackingNotification;
806 ========================================================================== */ 806 ========================================================================== */
807 807
808Lisp_Object 808Lisp_Object
809ns_menu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps, 809ns_menu_show (struct frame *f, int x, int y, bool for_click, bool keymaps,
810 Lisp_Object title, const char **error) 810 Lisp_Object title, const char **error)
811{ 811{
812 EmacsMenu *pmenu; 812 EmacsMenu *pmenu;
@@ -1028,7 +1028,7 @@ ns_menu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
1028 ========================================================================== */ 1028 ========================================================================== */
1029 1029
1030void 1030void
1031free_frame_tool_bar (FRAME_PTR f) 1031free_frame_tool_bar (struct frame *f)
1032/* -------------------------------------------------------------------------- 1032/* --------------------------------------------------------------------------
1033 Under NS we just hide the toolbar until it might be needed again. 1033 Under NS we just hide the toolbar until it might be needed again.
1034 -------------------------------------------------------------------------- */ 1034 -------------------------------------------------------------------------- */
@@ -1040,7 +1040,7 @@ free_frame_tool_bar (FRAME_PTR f)
1040} 1040}
1041 1041
1042void 1042void
1043update_frame_tool_bar (FRAME_PTR f) 1043update_frame_tool_bar (struct frame *f)
1044/* -------------------------------------------------------------------------- 1044/* --------------------------------------------------------------------------
1045 Update toolbar contents 1045 Update toolbar contents
1046 -------------------------------------------------------------------------- */ 1046 -------------------------------------------------------------------------- */
diff --git a/src/nsterm.h b/src/nsterm.h
index 745b8a4145b..1303a475547 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -109,7 +109,10 @@ typedef float EmacsCGFloat;
109@interface EmacsView : NSView <NSTextInput> 109@interface EmacsView : NSView <NSTextInput>
110#endif 110#endif
111 { 111 {
112#ifdef NS_IMPL_COCOA
112 char *old_title; 113 char *old_title;
114 BOOL maximizing_resize;
115#endif
113 BOOL windowClosing; 116 BOOL windowClosing;
114 NSString *workingText; 117 NSString *workingText;
115 BOOL processingCompose; 118 BOOL processingCompose;
@@ -778,7 +781,7 @@ void ns_dump_glyphstring (struct glyph_string *s);
778 781
779/* Implemented in nsterm, published in or needed from nsfns. */ 782/* Implemented in nsterm, published in or needed from nsfns. */
780extern Lisp_Object Qfontsize; 783extern Lisp_Object Qfontsize;
781extern Lisp_Object ns_list_fonts (FRAME_PTR f, Lisp_Object pattern, 784extern Lisp_Object ns_list_fonts (struct frame *f, Lisp_Object pattern,
782 int size, int maxnames); 785 int size, int maxnames);
783extern void ns_clear_frame (struct frame *f); 786extern void ns_clear_frame (struct frame *f);
784 787
@@ -824,11 +827,11 @@ extern void ns_release_autorelease_pool (void *);
824extern const char *ns_get_defaults_value (const char *key); 827extern const char *ns_get_defaults_value (const char *key);
825 828
826/* in nsmenu */ 829/* in nsmenu */
827extern void update_frame_tool_bar (FRAME_PTR f); 830extern void update_frame_tool_bar (struct frame *f);
828extern void free_frame_tool_bar (FRAME_PTR f); 831extern void free_frame_tool_bar (struct frame *f);
829extern void find_and_call_menu_selection (FRAME_PTR f, 832extern void find_and_call_menu_selection (struct frame *f,
830 int menu_bar_items_used, Lisp_Object vector, void *client_data); 833 int menu_bar_items_used, Lisp_Object vector, void *client_data);
831extern Lisp_Object find_and_return_menu_selection (FRAME_PTR f, 834extern Lisp_Object find_and_return_menu_selection (struct frame *f,
832 bool keymaps, 835 bool keymaps,
833 void *client_data); 836 void *client_data);
834extern Lisp_Object ns_popup_dialog (Lisp_Object position, Lisp_Object contents, 837extern Lisp_Object ns_popup_dialog (Lisp_Object position, Lisp_Object contents,
diff --git a/src/nsterm.m b/src/nsterm.m
index 14706f6b91d..3672c7656da 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1353,7 +1353,7 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows)
1353 1353
1354 1354
1355static void 1355static void
1356ns_fullscreen_hook (FRAME_PTR f) 1356ns_fullscreen_hook (struct frame *f)
1357{ 1357{
1358 EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); 1358 EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f);
1359 1359
@@ -1883,10 +1883,9 @@ ns_frame_up_to_date (struct frame *f)
1883 { 1883 {
1884 block_input (); 1884 block_input ();
1885 ns_update_begin(f); 1885 ns_update_begin(f);
1886 if (hlinfo->mouse_face_mouse_frame) 1886 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
1887 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, 1887 hlinfo->mouse_face_mouse_x,
1888 hlinfo->mouse_face_mouse_x, 1888 hlinfo->mouse_face_mouse_y);
1889 hlinfo->mouse_face_mouse_y);
1890 ns_update_end(f); 1889 ns_update_end(f);
1891 unblock_input (); 1890 unblock_input ();
1892 } 1891 }
@@ -3863,15 +3862,6 @@ ns_judge_scroll_bars (struct frame *f)
3863 [eview updateFrameSize: NO]; 3862 [eview updateFrameSize: NO];
3864} 3863}
3865 3864
3866
3867void
3868x_wm_set_icon_position (struct frame *f, int icon_x, int icon_y)
3869{
3870 /* XXX irrelevant under NS */
3871}
3872
3873
3874
3875/* ========================================================================== 3865/* ==========================================================================
3876 3866
3877 Initialization 3867 Initialization
@@ -5673,17 +5663,17 @@ not_in_argv (NSString *arg)
5673 old_title = 0; 5663 old_title = 0;
5674 } 5664 }
5675 } 5665 }
5676 else 5666 else if (fs_state == FULLSCREEN_NONE && ! maximizing_resize)
5677 { 5667 {
5678 char *size_title; 5668 char *size_title;
5679 NSWindow *window = [self window]; 5669 NSWindow *window = [self window];
5680 if (old_title == 0) 5670 if (old_title == 0)
5681 { 5671 {
5682 const char *t = [[[self window] title] UTF8String]; 5672 char *t = strdup ([[[self window] title] UTF8String]);
5683 char *pos = strstr (t, " — "); 5673 char *pos = strstr (t, " — ");
5684 if (pos) 5674 if (pos)
5685 *pos = '\0'; 5675 *pos = '\0';
5686 old_title = xstrdup (t); 5676 old_title = t;
5687 } 5677 }
5688 size_title = xmalloc (strlen (old_title) + 40); 5678 size_title = xmalloc (strlen (old_title) + 40);
5689 esprintf (size_title, "%s — (%d x %d)", old_title, cols, rows); 5679 esprintf (size_title, "%s — (%d x %d)", old_title, cols, rows);
@@ -5722,21 +5712,27 @@ not_in_argv (NSString *arg)
5722 NSTRACE (windowDidResize); 5712 NSTRACE (windowDidResize);
5723/*fprintf (stderr,"windowDidResize: %.0f\n",[theWindow frame].size.height); */ 5713/*fprintf (stderr,"windowDidResize: %.0f\n",[theWindow frame].size.height); */
5724 5714
5715if (cols > 0 && rows > 0)
5716 {
5717 [self updateFrameSize: YES];
5718 }
5719
5720 ns_send_appdefined (-1);
5721}
5722
5725#ifdef NS_IMPL_COCOA 5723#ifdef NS_IMPL_COCOA
5724- (void)viewDidEndLiveResize
5725{
5726 [super viewDidEndLiveResize];
5726 if (old_title != 0) 5727 if (old_title != 0)
5727 { 5728 {
5729 [[self window] setTitle: [NSString stringWithUTF8String: old_title]];
5728 xfree (old_title); 5730 xfree (old_title);
5729 old_title = 0; 5731 old_title = 0;
5730 } 5732 }
5731#endif /* NS_IMPL_COCOA */ 5733 maximizing_resize = NO;
5732
5733 if (cols > 0 && rows > 0)
5734 {
5735 [self updateFrameSize: YES];
5736 }
5737
5738 ns_send_appdefined (-1);
5739} 5734}
5735#endif /* NS_IMPL_COCOA */
5740 5736
5741 5737
5742- (void)windowDidBecomeKey: (NSNotification *)notification 5738- (void)windowDidBecomeKey: (NSNotification *)notification
@@ -5841,7 +5837,10 @@ not_in_argv (NSString *arg)
5841 5837
5842 FRAME_NS_VIEW (f) = self; 5838 FRAME_NS_VIEW (f) = self;
5843 emacsframe = f; 5839 emacsframe = f;
5840#ifdef NS_IMPL_COCOA
5844 old_title = 0; 5841 old_title = 0;
5842 maximizing_resize = NO;
5843#endif
5845 5844
5846 win = [[EmacsWindow alloc] 5845 win = [[EmacsWindow alloc]
5847 initWithContentRect: r 5846 initWithContentRect: r
@@ -5984,6 +5983,9 @@ not_in_argv (NSString *arg)
5984 maximized_width = -1; 5983 maximized_width = -1;
5985 result.origin.y = defaultFrame.origin.y; 5984 result.origin.y = defaultFrame.origin.y;
5986 [self setFSValue: FULLSCREEN_HEIGHT]; 5985 [self setFSValue: FULLSCREEN_HEIGHT];
5986#ifdef NS_IMPL_COCOA
5987 maximizing_resize = YES;
5988#endif
5987 } 5989 }
5988 else if (next_maximized == FULLSCREEN_WIDTH) 5990 else if (next_maximized == FULLSCREEN_WIDTH)
5989 { 5991 {
@@ -6002,12 +6004,18 @@ not_in_argv (NSString *arg)
6002 maximized_width = result.size.width; 6004 maximized_width = result.size.width;
6003 maximized_height = result.size.height; 6005 maximized_height = result.size.height;
6004 [self setFSValue: FULLSCREEN_MAXIMIZED]; 6006 [self setFSValue: FULLSCREEN_MAXIMIZED];
6007#ifdef NS_IMPL_COCOA
6008 maximizing_resize = YES;
6009#endif
6005 } 6010 }
6006 else 6011 else
6007 { 6012 {
6008 /* restore */ 6013 /* restore */
6009 result = ns_userRect.size.height ? ns_userRect : result; 6014 result = ns_userRect.size.height ? ns_userRect : result;
6010 ns_userRect = NSMakeRect (0, 0, 0, 0); 6015 ns_userRect = NSMakeRect (0, 0, 0, 0);
6016#ifdef NS_IMPL_COCOA
6017 maximizing_resize = fs_state != FULLSCREEN_NONE;
6018#endif
6011 [self setFSValue: FULLSCREEN_NONE]; 6019 [self setFSValue: FULLSCREEN_NONE];
6012 maximized_width = maximized_height = -1; 6020 maximized_width = maximized_height = -1;
6013 } 6021 }
diff --git a/src/scroll.c b/src/scroll.c
index 037e338c696..3e296068e8f 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -86,7 +86,7 @@ static void do_scrolling (struct frame *,
86 new contents appears. */ 86 new contents appears. */
87 87
88static void 88static void
89calculate_scrolling (FRAME_PTR frame, 89calculate_scrolling (struct frame *frame,
90 /* matrix is of size window_size + 1 on each side. */ 90 /* matrix is of size window_size + 1 on each side. */
91 struct matrix_elt *matrix, 91 struct matrix_elt *matrix,
92 int window_size, int lines_below, 92 int window_size, int lines_below,
@@ -422,7 +422,7 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
422 is the equivalent of draw_cost for the old line contents */ 422 is the equivalent of draw_cost for the old line contents */
423 423
424static void 424static void
425calculate_direct_scrolling (FRAME_PTR frame, 425calculate_direct_scrolling (struct frame *frame,
426 /* matrix is of size window_size + 1 on each side. */ 426 /* matrix is of size window_size + 1 on each side. */
427 struct matrix_elt *matrix, 427 struct matrix_elt *matrix,
428 int window_size, int lines_below, 428 int window_size, int lines_below,
@@ -793,7 +793,7 @@ do_direct_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
793 793
794 794
795void 795void
796scrolling_1 (FRAME_PTR frame, int window_size, int unchanged_at_top, 796scrolling_1 (struct frame *frame, int window_size, int unchanged_at_top,
797 int unchanged_at_bottom, int *draw_cost, int *old_draw_cost, 797 int unchanged_at_bottom, int *draw_cost, int *old_draw_cost,
798 int *old_hash, int *new_hash, int free_at_end) 798 int *old_hash, int *new_hash, int free_at_end)
799{ 799{
@@ -883,7 +883,7 @@ scrolling_max_lines_saved (int start, int end,
883 overhead and multiply factor values */ 883 overhead and multiply factor values */
884 884
885static void 885static void
886line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn, 886line_ins_del (struct frame *frame, int ov1, int pf1, int ovn, int pfn,
887 register int *ov, register int *mf) 887 register int *ov, register int *mf)
888{ 888{
889 register int i; 889 register int i;
@@ -901,7 +901,7 @@ line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn,
901} 901}
902 902
903static void 903static void
904ins_del_costs (FRAME_PTR frame, 904ins_del_costs (struct frame *frame,
905 const char *one_line_string, const char *multi_string, 905 const char *one_line_string, const char *multi_string,
906 const char *setup_string, const char *cleanup_string, 906 const char *setup_string, const char *cleanup_string,
907 int *costvec, int *ncostvec, 907 int *costvec, int *ncostvec,
@@ -957,7 +957,7 @@ ins_del_costs (FRAME_PTR frame,
957 */ 957 */
958 958
959void 959void
960do_line_insertion_deletion_costs (FRAME_PTR frame, 960do_line_insertion_deletion_costs (struct frame *frame,
961 const char *ins_line_string, 961 const char *ins_line_string,
962 const char *multi_ins_string, 962 const char *multi_ins_string,
963 const char *del_line_string, 963 const char *del_line_string,
diff --git a/src/term.c b/src/term.c
index 376d6e7831a..fb69aefbe7a 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2522,7 +2522,7 @@ tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row,
2522} 2522}
2523 2523
2524static bool 2524static bool
2525term_mouse_movement (FRAME_PTR frame, Gpm_Event *event) 2525term_mouse_movement (struct frame *frame, Gpm_Event *event)
2526{ 2526{
2527 /* Has the mouse moved off the glyph it was on at the last sighting? */ 2527 /* Has the mouse moved off the glyph it was on at the last sighting? */
2528 if (event->x != last_mouse_x || event->y != last_mouse_y) 2528 if (event->x != last_mouse_x || event->y != last_mouse_y)
@@ -2563,7 +2563,7 @@ timeval_to_Time (struct timeval const *t)
2563 This clears mouse_moved until the next motion 2563 This clears mouse_moved until the next motion
2564 event arrives. */ 2564 event arrives. */
2565static void 2565static void
2566term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, 2566term_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
2567 enum scroll_bar_part *part, Lisp_Object *x, 2567 enum scroll_bar_part *part, Lisp_Object *x,
2568 Lisp_Object *y, Time *timeptr) 2568 Lisp_Object *y, Time *timeptr)
2569{ 2569{
@@ -2933,7 +2933,7 @@ dissociate_if_controlling_tty (int fd)
2933 2933
2934 TERMINAL_TYPE is the termcap type of the device, e.g. "vt100". 2934 TERMINAL_TYPE is the termcap type of the device, e.g. "vt100".
2935 2935
2936 If MUST_SUCCEED is true, then all errors are fatal. */ 2936 If MUST_SUCCEED is true, then all errors are fatal. */
2937 2937
2938struct terminal * 2938struct terminal *
2939init_tty (const char *name, const char *terminal_type, bool must_succeed) 2939init_tty (const char *name, const char *terminal_type, bool must_succeed)
@@ -2944,7 +2944,7 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
2944 int status; 2944 int status;
2945 struct tty_display_info *tty = NULL; 2945 struct tty_display_info *tty = NULL;
2946 struct terminal *terminal = NULL; 2946 struct terminal *terminal = NULL;
2947 bool ctty = 0; /* True if asked to open controlling tty. */ 2947 bool ctty = false; /* True if asked to open controlling tty. */
2948 2948
2949 if (!terminal_type) 2949 if (!terminal_type)
2950 maybe_fatal (must_succeed, 0, 2950 maybe_fatal (must_succeed, 0,
@@ -3031,7 +3031,7 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
3031 tty->termcap_term_buffer = xmalloc (buffer_size); 3031 tty->termcap_term_buffer = xmalloc (buffer_size);
3032 3032
3033 /* On some systems, tgetent tries to access the controlling 3033 /* On some systems, tgetent tries to access the controlling
3034 terminal. */ 3034 terminal. */
3035 block_tty_out_signal (); 3035 block_tty_out_signal ();
3036 status = tgetent (tty->termcap_term_buffer, terminal_type); 3036 status = tgetent (tty->termcap_term_buffer, terminal_type);
3037 unblock_tty_out_signal (); 3037 unblock_tty_out_signal ();
@@ -3101,13 +3101,13 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3101 Right (tty) = tgetstr ("nd", address); 3101 Right (tty) = tgetstr ("nd", address);
3102 Down (tty) = tgetstr ("do", address); 3102 Down (tty) = tgetstr ("do", address);
3103 if (!Down (tty)) 3103 if (!Down (tty))
3104 Down (tty) = tgetstr ("nl", address); /* Obsolete name for "do" */ 3104 Down (tty) = tgetstr ("nl", address); /* Obsolete name for "do". */
3105 if (tgetflag ("bs")) 3105 if (tgetflag ("bs"))
3106 Left (tty) = "\b"; /* can't possibly be longer! */ 3106 Left (tty) = "\b"; /* Can't possibly be longer! */
3107 else /* (Actually, "bs" is obsolete...) */ 3107 else /* (Actually, "bs" is obsolete...) */
3108 Left (tty) = tgetstr ("le", address); 3108 Left (tty) = tgetstr ("le", address);
3109 if (!Left (tty)) 3109 if (!Left (tty))
3110 Left (tty) = tgetstr ("bc", address); /* Obsolete name for "le" */ 3110 Left (tty) = tgetstr ("bc", address); /* Obsolete name for "le". */
3111 tty->TS_pad_char = tgetstr ("pc", address); 3111 tty->TS_pad_char = tgetstr ("pc", address);
3112 tty->TS_repeat = tgetstr ("rp", address); 3112 tty->TS_repeat = tgetstr ("rp", address);
3113 tty->TS_end_standout_mode = tgetstr ("se", address); 3113 tty->TS_end_standout_mode = tgetstr ("se", address);
@@ -3229,7 +3229,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3229 don't think we're losing anything by turning it off. */ 3229 don't think we're losing anything by turning it off. */
3230 terminal->line_ins_del_ok = 0; 3230 terminal->line_ins_del_ok = 0;
3231 3231
3232 tty->TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */ 3232 tty->TN_max_colors = 16; /* Must be non-zero for tty-display-color-p. */
3233#endif /* DOS_NT */ 3233#endif /* DOS_NT */
3234 3234
3235#ifdef HAVE_GPM 3235#ifdef HAVE_GPM
@@ -3325,16 +3325,16 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
3325 tty->Wcm->cm_tab = 0; 3325 tty->Wcm->cm_tab = 0;
3326 /* We can't support standout mode, because it uses magic cookies. */ 3326 /* We can't support standout mode, because it uses magic cookies. */
3327 tty->TS_standout_mode = 0; 3327 tty->TS_standout_mode = 0;
3328 /* But that means we cannot rely on ^M to go to column zero! */ 3328 /* But that means we cannot rely on ^M to go to column zero! */
3329 CR (tty) = 0; 3329 CR (tty) = 0;
3330 /* LF can't be trusted either -- can alter hpos */ 3330 /* LF can't be trusted either -- can alter hpos. */
3331 /* if move at column 0 thru a line with TS_standout_mode */ 3331 /* If move at column 0 thru a line with TS_standout_mode. */
3332 Down (tty) = 0; 3332 Down (tty) = 0;
3333 } 3333 }
3334 3334
3335 tty->specified_window = FrameRows (tty); 3335 tty->specified_window = FrameRows (tty);
3336 3336
3337 if (Wcm_init (tty) == -1) /* can't do cursor motion */ 3337 if (Wcm_init (tty) == -1) /* Can't do cursor motion. */
3338 { 3338 {
3339 maybe_fatal (must_succeed, terminal, 3339 maybe_fatal (must_succeed, terminal,
3340 "Terminal type \"%s\" is not powerful enough to run Emacs", 3340 "Terminal type \"%s\" is not powerful enough to run Emacs",
diff --git a/src/terminal.c b/src/terminal.c
index c55fd4eb077..4b5532e3a44 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -39,6 +39,8 @@ static int next_terminal_id;
39/* The initial terminal device, created by initial_term_init. */ 39/* The initial terminal device, created by initial_term_init. */
40struct terminal *initial_terminal; 40struct terminal *initial_terminal;
41 41
42static Lisp_Object Qterminal_live_p;
43
42static void delete_initial_terminal (struct terminal *); 44static void delete_initial_terminal (struct terminal *);
43 45
44/* This setter is used only in this file, so it can be private. */ 46/* This setter is used only in this file, so it can be private. */
@@ -549,6 +551,8 @@ Each function is called with argument, the terminal.
549This may be called just before actually deleting the terminal, 551This may be called just before actually deleting the terminal,
550or some time later. */); 552or some time later. */);
551 Vdelete_terminal_functions = Qnil; 553 Vdelete_terminal_functions = Qnil;
554
555 DEFSYM (Qterminal_live_p, "terminal-live-p");
552 DEFSYM (Qdelete_terminal_functions, "delete-terminal-functions"); 556 DEFSYM (Qdelete_terminal_functions, "delete-terminal-functions");
553 DEFSYM (Qrun_hook_with_args, "run-hook-with-args"); 557 DEFSYM (Qrun_hook_with_args, "run-hook-with-args");
554 558
diff --git a/src/w32fns.c b/src/w32fns.c
index 2b06936d119..dff35de0973 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -285,7 +285,7 @@ check_x_display_info (Lisp_Object frame)
285 return x_display_info_for_name (frame); 285 return x_display_info_for_name (frame);
286 else 286 else
287 { 287 {
288 FRAME_PTR f; 288 struct frame *f;
289 289
290 CHECK_LIVE_FRAME (frame); 290 CHECK_LIVE_FRAME (frame);
291 f = XFRAME (frame); 291 f = XFRAME (frame);
@@ -344,7 +344,7 @@ void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
344 not Emacs's own window. */ 344 not Emacs's own window. */
345 345
346void 346void
347x_real_positions (FRAME_PTR f, int *xptr, int *yptr) 347x_real_positions (struct frame *f, int *xptr, int *yptr)
348{ 348{
349 POINT pt; 349 POINT pt;
350 RECT rect; 350 RECT rect;
@@ -1019,7 +1019,7 @@ x_to_w32_color (const char * colorname)
1019} 1019}
1020 1020
1021void 1021void
1022w32_regenerate_palette (FRAME_PTR f) 1022w32_regenerate_palette (struct frame *f)
1023{ 1023{
1024 struct w32_palette_entry * list; 1024 struct w32_palette_entry * list;
1025 LOGPALETTE * log_palette; 1025 LOGPALETTE * log_palette;
@@ -1069,7 +1069,7 @@ w32_regenerate_palette (FRAME_PTR f)
1069#if 0 1069#if 0
1070/* Keep these around in case we ever want to track color usage. */ 1070/* Keep these around in case we ever want to track color usage. */
1071void 1071void
1072w32_map_color (FRAME_PTR f, COLORREF color) 1072w32_map_color (struct frame *f, COLORREF color)
1073{ 1073{
1074 struct w32_palette_entry * list = FRAME_W32_DISPLAY_INFO (f)->color_list; 1074 struct w32_palette_entry * list = FRAME_W32_DISPLAY_INFO (f)->color_list;
1075 1075
@@ -1100,7 +1100,7 @@ w32_map_color (FRAME_PTR f, COLORREF color)
1100} 1100}
1101 1101
1102void 1102void
1103w32_unmap_color (FRAME_PTR f, COLORREF color) 1103w32_unmap_color (struct frame *f, COLORREF color)
1104{ 1104{
1105 struct w32_palette_entry * list = FRAME_W32_DISPLAY_INFO (f)->color_list; 1105 struct w32_palette_entry * list = FRAME_W32_DISPLAY_INFO (f)->color_list;
1106 struct w32_palette_entry **prev = &FRAME_W32_DISPLAY_INFO (f)->color_list; 1106 struct w32_palette_entry **prev = &FRAME_W32_DISPLAY_INFO (f)->color_list;
@@ -1153,7 +1153,7 @@ gamma_correct (struct frame *f, COLORREF *color)
1153 If ALLOC is nonzero, allocate a new colormap cell. */ 1153 If ALLOC is nonzero, allocate a new colormap cell. */
1154 1154
1155int 1155int
1156w32_defined_color (FRAME_PTR f, const char *color, XColor *color_def, int alloc) 1156w32_defined_color (struct frame *f, const char *color, XColor *color_def, int alloc)
1157{ 1157{
1158 register Lisp_Object tem; 1158 register Lisp_Object tem;
1159 COLORREF w32_color_ref; 1159 COLORREF w32_color_ref;
@@ -1224,7 +1224,7 @@ w32_defined_color (FRAME_PTR f, const char *color, XColor *color_def, int alloc)
1224 ARG says. */ 1224 ARG says. */
1225 1225
1226int 1226int
1227x_decode_color (FRAME_PTR f, Lisp_Object arg, int def) 1227x_decode_color (struct frame *f, Lisp_Object arg, int def)
1228{ 1228{
1229 XColor cdef; 1229 XColor cdef;
1230 1230
@@ -1525,7 +1525,7 @@ x_set_border_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1525 1525
1526 1526
1527void 1527void
1528x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 1528x_set_cursor_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1529{ 1529{
1530 set_frame_cursor_types (f, arg); 1530 set_frame_cursor_types (f, arg);
1531 1531
@@ -1787,7 +1787,7 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit)
1787 specified a name for the frame; the name will override any set by the 1787 specified a name for the frame; the name will override any set by the
1788 redisplay code. */ 1788 redisplay code. */
1789void 1789void
1790x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 1790x_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1791{ 1791{
1792 x_set_name (f, arg, 1); 1792 x_set_name (f, arg, 1);
1793} 1793}
@@ -1796,7 +1796,7 @@ x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
1796 name; names set this way will never override names set by the user's 1796 name; names set this way will never override names set by the user's
1797 lisp code. */ 1797 lisp code. */
1798void 1798void
1799x_implicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 1799x_implicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1800{ 1800{
1801 x_set_name (f, arg, 0); 1801 x_set_name (f, arg, 0);
1802} 1802}
@@ -4182,9 +4182,6 @@ x_icon (struct frame *f, Lisp_Object parms)
4182 4182
4183 block_input (); 4183 block_input ();
4184 4184
4185 if (! EQ (icon_x, Qunbound))
4186 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y));
4187
4188#if 0 /* TODO */ 4185#if 0 /* TODO */
4189 /* Start up iconic or window? */ 4186 /* Start up iconic or window? */
4190 x_wm_set_window_state 4187 x_wm_set_window_state
@@ -4648,7 +4645,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
4648 (Lisp_Object color, Lisp_Object frame) 4645 (Lisp_Object color, Lisp_Object frame)
4649{ 4646{
4650 XColor foo; 4647 XColor foo;
4651 FRAME_PTR f = decode_window_system_frame (frame); 4648 struct frame *f = decode_window_system_frame (frame);
4652 4649
4653 CHECK_STRING (color); 4650 CHECK_STRING (color);
4654 4651
@@ -4663,7 +4660,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
4663 (Lisp_Object color, Lisp_Object frame) 4660 (Lisp_Object color, Lisp_Object frame)
4664{ 4661{
4665 XColor foo; 4662 XColor foo;
4666 FRAME_PTR f = decode_window_system_frame (frame); 4663 struct frame *f = decode_window_system_frame (frame);
4667 4664
4668 CHECK_STRING (color); 4665 CHECK_STRING (color);
4669 4666
@@ -5139,19 +5136,6 @@ SOUND is nil to use the normal beep. */)
5139 return sound; 5136 return sound;
5140} 5137}
5141 5138
5142
5143int
5144x_pixel_width (register struct frame *f)
5145{
5146 return FRAME_PIXEL_WIDTH (f);
5147}
5148
5149int
5150x_pixel_height (register struct frame *f)
5151{
5152 return FRAME_PIXEL_HEIGHT (f);
5153}
5154
5155int 5139int
5156x_screen_planes (register struct frame *f) 5140x_screen_planes (register struct frame *f)
5157{ 5141{
@@ -6626,7 +6610,7 @@ screen saver if defined.
6626If optional parameter FRAME is not specified, use selected frame. */) 6610If optional parameter FRAME is not specified, use selected frame. */)
6627 (Lisp_Object command, Lisp_Object frame) 6611 (Lisp_Object command, Lisp_Object frame)
6628{ 6612{
6629 FRAME_PTR f = decode_window_system_frame (frame); 6613 struct frame *f = decode_window_system_frame (frame);
6630 6614
6631 CHECK_NUMBER (command); 6615 CHECK_NUMBER (command);
6632 6616
diff --git a/src/w32font.c b/src/w32font.c
index 105daa06365..4a97fd90a4e 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -99,7 +99,7 @@ static Lisp_Object Qw32_charset_thai, Qw32_charset_johab, Qw32_charset_mac;
99/* Font spacing symbols - defined in font.c. */ 99/* Font spacing symbols - defined in font.c. */
100extern Lisp_Object Qc, Qp, Qm; 100extern Lisp_Object Qc, Qp, Qm;
101 101
102static void fill_in_logfont (FRAME_PTR, LOGFONT *, Lisp_Object); 102static void fill_in_logfont (struct frame *, LOGFONT *, Lisp_Object);
103 103
104static BYTE w32_antialias_type (Lisp_Object); 104static BYTE w32_antialias_type (Lisp_Object);
105static Lisp_Object lispy_antialias_type (BYTE); 105static Lisp_Object lispy_antialias_type (BYTE);
@@ -297,7 +297,7 @@ intern_font_name (char * string)
297 Return a cache of font-entities on FRAME. The cache must be a 297 Return a cache of font-entities on FRAME. The cache must be a
298 cons whose cdr part is the actual cache area. */ 298 cons whose cdr part is the actual cache area. */
299Lisp_Object 299Lisp_Object
300w32font_get_cache (FRAME_PTR f) 300w32font_get_cache (struct frame *f)
301{ 301{
302 struct w32_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 302 struct w32_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
303 303
@@ -309,9 +309,9 @@ w32font_get_cache (FRAME_PTR f)
309 is a vector of font-entities. This is the sole API that 309 is a vector of font-entities. This is the sole API that
310 allocates font-entities. */ 310 allocates font-entities. */
311static Lisp_Object 311static Lisp_Object
312w32font_list (Lisp_Object frame, Lisp_Object font_spec) 312w32font_list (struct frame *f, Lisp_Object font_spec)
313{ 313{
314 Lisp_Object fonts = w32font_list_internal (frame, font_spec, 0); 314 Lisp_Object fonts = w32font_list_internal (f, font_spec, 0);
315 FONT_ADD_LOG ("w32font-list", font_spec, fonts); 315 FONT_ADD_LOG ("w32font-list", font_spec, fonts);
316 return fonts; 316 return fonts;
317} 317}
@@ -321,9 +321,9 @@ w32font_list (Lisp_Object frame, Lisp_Object font_spec)
321 FRAME. The closeness is determined by the font backend, thus 321 FRAME. The closeness is determined by the font backend, thus
322 `face-font-selection-order' is ignored here. */ 322 `face-font-selection-order' is ignored here. */
323static Lisp_Object 323static Lisp_Object
324w32font_match (Lisp_Object frame, Lisp_Object font_spec) 324w32font_match (struct frame *f, Lisp_Object font_spec)
325{ 325{
326 Lisp_Object entity = w32font_match_internal (frame, font_spec, 0); 326 Lisp_Object entity = w32font_match_internal (f, font_spec, 0);
327 FONT_ADD_LOG ("w32font-match", font_spec, entity); 327 FONT_ADD_LOG ("w32font-match", font_spec, entity);
328 return entity; 328 return entity;
329} 329}
@@ -332,12 +332,11 @@ w32font_match (Lisp_Object frame, Lisp_Object font_spec)
332 List available families. The value is a list of family names 332 List available families. The value is a list of family names
333 (symbols). */ 333 (symbols). */
334static Lisp_Object 334static Lisp_Object
335w32font_list_family (Lisp_Object frame) 335w32font_list_family (struct frame *f)
336{ 336{
337 Lisp_Object list = Qnil; 337 Lisp_Object list = Qnil;
338 LOGFONT font_match_pattern; 338 LOGFONT font_match_pattern;
339 HDC dc; 339 HDC dc;
340 FRAME_PTR f = XFRAME (frame);
341 340
342 memset (&font_match_pattern, 0, sizeof (font_match_pattern)); 341 memset (&font_match_pattern, 0, sizeof (font_match_pattern));
343 font_match_pattern.lfCharSet = DEFAULT_CHARSET; 342 font_match_pattern.lfCharSet = DEFAULT_CHARSET;
@@ -356,7 +355,7 @@ w32font_list_family (Lisp_Object frame)
356 Open a font specified by FONT_ENTITY on frame F. 355 Open a font specified by FONT_ENTITY on frame F.
357 If the font is scalable, open it with PIXEL_SIZE. */ 356 If the font is scalable, open it with PIXEL_SIZE. */
358static Lisp_Object 357static Lisp_Object
359w32font_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) 358w32font_open (struct frame *f, Lisp_Object font_entity, int pixel_size)
360{ 359{
361 Lisp_Object font_object 360 Lisp_Object font_object
362 = font_make_object (VECSIZE (struct w32font_info), 361 = font_make_object (VECSIZE (struct w32font_info),
@@ -380,7 +379,7 @@ w32font_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
380/* w32 implementation of close for font_backend. 379/* w32 implementation of close for font_backend.
381 Close FONT on frame F. */ 380 Close FONT on frame F. */
382void 381void
383w32font_close (FRAME_PTR f, struct font *font) 382w32font_close (struct frame *f, struct font *font)
384{ 383{
385 int i; 384 int i;
386 struct w32font_info *w32_font = (struct w32font_info *) font; 385 struct w32font_info *w32_font = (struct w32font_info *) font;
@@ -732,13 +731,13 @@ w32font_free_entity (Lisp_Object entity);
732 storing some data in FACE->extra. If successful, return 0. 731 storing some data in FACE->extra. If successful, return 0.
733 Otherwise, return -1. 732 Otherwise, return -1.
734static int 733static int
735w32font_prepare_face (FRAME_PTR f, struct face *face); 734w32font_prepare_face (struct frame *f, struct face *face);
736 */ 735 */
737/* w32 implementation of done_face for font backend. 736/* w32 implementation of done_face for font backend.
738 Optional. 737 Optional.
739 Done FACE for displaying characters by FACE->font on frame F. 738 Done FACE for displaying characters by FACE->font on frame F.
740static void 739static void
741w32font_done_face (FRAME_PTR f, struct face *face); */ 740w32font_done_face (struct frame *f, struct face *face); */
742 741
743/* w32 implementation of get_bitmap for font backend. 742/* w32 implementation of get_bitmap for font backend.
744 Optional. 743 Optional.
@@ -811,15 +810,14 @@ w32font_otf_drive (struct font *font, Lisp_Object features,
811 Additional parameter opentype_only restricts the returned fonts to 810 Additional parameter opentype_only restricts the returned fonts to
812 opentype fonts, which can be used with the Uniscribe backend. */ 811 opentype fonts, which can be used with the Uniscribe backend. */
813Lisp_Object 812Lisp_Object
814w32font_list_internal (Lisp_Object frame, Lisp_Object font_spec, int opentype_only) 813w32font_list_internal (struct frame *f, Lisp_Object font_spec, int opentype_only)
815{ 814{
816 struct font_callback_data match_data; 815 struct font_callback_data match_data;
817 HDC dc; 816 HDC dc;
818 FRAME_PTR f = XFRAME (frame);
819 817
820 match_data.orig_font_spec = font_spec; 818 match_data.orig_font_spec = font_spec;
821 match_data.list = Qnil; 819 match_data.list = Qnil;
822 match_data.frame = frame; 820 XSETFRAME (match_data.frame, f);
823 821
824 memset (&match_data.pattern, 0, sizeof (LOGFONT)); 822 memset (&match_data.pattern, 0, sizeof (LOGFONT));
825 fill_in_logfont (f, &match_data.pattern, font_spec); 823 fill_in_logfont (f, &match_data.pattern, font_spec);
@@ -864,14 +862,13 @@ w32font_list_internal (Lisp_Object frame, Lisp_Object font_spec, int opentype_on
864 Additional parameter opentype_only restricts the returned fonts to 862 Additional parameter opentype_only restricts the returned fonts to
865 opentype fonts, which can be used with the Uniscribe backend. */ 863 opentype fonts, which can be used with the Uniscribe backend. */
866Lisp_Object 864Lisp_Object
867w32font_match_internal (Lisp_Object frame, Lisp_Object font_spec, int opentype_only) 865w32font_match_internal (struct frame *f, Lisp_Object font_spec, int opentype_only)
868{ 866{
869 struct font_callback_data match_data; 867 struct font_callback_data match_data;
870 HDC dc; 868 HDC dc;
871 FRAME_PTR f = XFRAME (frame);
872 869
873 match_data.orig_font_spec = font_spec; 870 match_data.orig_font_spec = font_spec;
874 match_data.frame = frame; 871 XSETFRAME (match_data.frame, f);
875 match_data.list = Qnil; 872 match_data.list = Qnil;
876 873
877 memset (&match_data.pattern, 0, sizeof (LOGFONT)); 874 memset (&match_data.pattern, 0, sizeof (LOGFONT));
@@ -892,7 +889,7 @@ w32font_match_internal (Lisp_Object frame, Lisp_Object font_spec, int opentype_o
892} 889}
893 890
894int 891int
895w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity, 892w32font_open_internal (struct frame *f, Lisp_Object font_entity,
896 int pixel_size, Lisp_Object font_object) 893 int pixel_size, Lisp_Object font_object)
897{ 894{
898 int len, size; 895 int len, size;
@@ -1964,7 +1961,7 @@ w32_to_fc_weight (int n)
1964 1961
1965/* Fill in all the available details of LOGFONT from FONT_SPEC. */ 1962/* Fill in all the available details of LOGFONT from FONT_SPEC. */
1966static void 1963static void
1967fill_in_logfont (FRAME_PTR f, LOGFONT *logfont, Lisp_Object font_spec) 1964fill_in_logfont (struct frame *f, LOGFONT *logfont, Lisp_Object font_spec)
1968{ 1965{
1969 Lisp_Object tmp, extra; 1966 Lisp_Object tmp, extra;
1970 int dpi = FRAME_RES_Y (f); 1967 int dpi = FRAME_RES_Y (f);
@@ -2114,7 +2111,7 @@ static void
2114list_all_matching_fonts (struct font_callback_data *match_data) 2111list_all_matching_fonts (struct font_callback_data *match_data)
2115{ 2112{
2116 HDC dc; 2113 HDC dc;
2117 Lisp_Object families = w32font_list_family (match_data->frame); 2114 Lisp_Object families = w32font_list_family (XFRAME (match_data->frame));
2118 struct frame *f = XFRAME (match_data->frame); 2115 struct frame *f = XFRAME (match_data->frame);
2119 2116
2120 dc = get_frame_dc (f); 2117 dc = get_frame_dc (f);
@@ -2467,7 +2464,7 @@ If EXCLUDE-PROPORTIONAL is non-nil, exclude proportional fonts
2467in the font selection dialog. */) 2464in the font selection dialog. */)
2468 (Lisp_Object frame, Lisp_Object exclude_proportional) 2465 (Lisp_Object frame, Lisp_Object exclude_proportional)
2469{ 2466{
2470 FRAME_PTR f = decode_window_system_frame (frame); 2467 struct frame *f = decode_window_system_frame (frame);
2471 CHOOSEFONT cf; 2468 CHOOSEFONT cf;
2472 LOGFONT lf; 2469 LOGFONT lf;
2473 TEXTMETRIC tm; 2470 TEXTMETRIC tm;
diff --git a/src/w32font.h b/src/w32font.h
index b4345478a22..56220860863 100644
--- a/src/w32font.h
+++ b/src/w32font.h
@@ -63,16 +63,16 @@ struct w32font_info
63 63
64#define CACHE_BLOCKSIZE 128 64#define CACHE_BLOCKSIZE 128
65 65
66Lisp_Object w32font_get_cache (FRAME_PTR fe); 66Lisp_Object w32font_get_cache (struct frame *fe);
67Lisp_Object w32font_list_internal (Lisp_Object frame, 67Lisp_Object w32font_list_internal (struct frame *f,
68 Lisp_Object font_spec, 68 Lisp_Object font_spec,
69 int opentype_only); 69 int opentype_only);
70Lisp_Object w32font_match_internal (Lisp_Object frame, 70Lisp_Object w32font_match_internal (struct frame *f,
71 Lisp_Object font_spec, 71 Lisp_Object font_spec,
72 int opentype_only); 72 int opentype_only);
73int w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity, 73int w32font_open_internal (struct frame *f, Lisp_Object font_entity,
74 int pixel_size, Lisp_Object font_object); 74 int pixel_size, Lisp_Object font_object);
75void w32font_close (FRAME_PTR f, struct font *font); 75void w32font_close (struct frame *f, struct font *font);
76int w32font_has_char (Lisp_Object entity, int c); 76int w32font_has_char (Lisp_Object entity, int c);
77int w32font_text_extents (struct font *font, unsigned *code, int nglyphs, 77int w32font_text_extents (struct font *font, unsigned *code, int nglyphs,
78 struct font_metrics *metrics); 78 struct font_metrics *metrics);
diff --git a/src/w32inevt.c b/src/w32inevt.c
index 88a3f9739cd..ce36f291b00 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -103,10 +103,10 @@ fill_queue (BOOL block)
103} 103}
104 104
105/* In a generic, multi-frame world this should take a console handle 105/* In a generic, multi-frame world this should take a console handle
106 and return the frame for it 106 and return the frame for it.
107 107
108 Right now, there's only one frame so return it. */ 108 Right now, there's only one frame so return it. */
109static FRAME_PTR 109static struct frame *
110get_frame (void) 110get_frame (void)
111{ 111{
112 return SELECTED_FRAME (); 112 return SELECTED_FRAME ();
@@ -394,7 +394,7 @@ key_event (KEY_EVENT_RECORD *event, struct input_event *emacs_ev, int *isdead)
394 394
395/* Mouse position hook. */ 395/* Mouse position hook. */
396void 396void
397w32_console_mouse_position (FRAME_PTR *f, 397w32_console_mouse_position (struct frame **f,
398 int insist, 398 int insist,
399 Lisp_Object *bar_window, 399 Lisp_Object *bar_window,
400 enum scroll_bar_part *part, 400 enum scroll_bar_part *part,
@@ -461,7 +461,7 @@ do_mouse_event (MOUSE_EVENT_RECORD *event,
461 461
462 if (event->dwEventFlags == MOUSE_MOVED) 462 if (event->dwEventFlags == MOUSE_MOVED)
463 { 463 {
464 FRAME_PTR f = SELECTED_FRAME (); 464 struct frame *f = SELECTED_FRAME ();
465 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 465 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
466 int mx = event->dwMousePosition.X, my = event->dwMousePosition.Y; 466 int mx = event->dwMousePosition.X, my = event->dwMousePosition.Y;
467 467
@@ -555,7 +555,7 @@ do_mouse_event (MOUSE_EVENT_RECORD *event,
555static void 555static void
556resize_event (WINDOW_BUFFER_SIZE_RECORD *event) 556resize_event (WINDOW_BUFFER_SIZE_RECORD *event)
557{ 557{
558 FRAME_PTR f = get_frame (); 558 struct frame *f = get_frame ();
559 559
560 change_frame_size (f, event->dwSize.Y, event->dwSize.X, 0, 1, 0); 560 change_frame_size (f, event->dwSize.Y, event->dwSize.X, 0, 1, 0);
561 SET_FRAME_GARBAGED (f); 561 SET_FRAME_GARBAGED (f);
@@ -565,7 +565,7 @@ static void
565maybe_generate_resize_event (void) 565maybe_generate_resize_event (void)
566{ 566{
567 CONSOLE_SCREEN_BUFFER_INFO info; 567 CONSOLE_SCREEN_BUFFER_INFO info;
568 FRAME_PTR f = get_frame (); 568 struct frame *f = get_frame ();
569 569
570 GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &info); 570 GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &info);
571 571
diff --git a/src/w32inevt.h b/src/w32inevt.h
index 8a7e4fed06a..070d1ad7b03 100644
--- a/src/w32inevt.h
+++ b/src/w32inevt.h
@@ -23,7 +23,7 @@ extern int w32_console_unicode_input;
23 23
24extern int w32_console_read_socket (struct terminal *term, 24extern int w32_console_read_socket (struct terminal *term,
25 struct input_event *hold_quit); 25 struct input_event *hold_quit);
26extern void w32_console_mouse_position (FRAME_PTR *f, int insist, 26extern void w32_console_mouse_position (struct frame **f, int insist,
27 Lisp_Object *bar_window, 27 Lisp_Object *bar_window,
28 enum scroll_bar_part *part, 28 enum scroll_bar_part *part,
29 Lisp_Object *x, Lisp_Object *y, 29 Lisp_Object *x, Lisp_Object *y,
diff --git a/src/w32menu.c b/src/w32menu.c
index 346402b7c6b..34020fa61d2 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -100,13 +100,13 @@ MessageBoxW_Proc unicode_message_box = NULL;
100 100
101Lisp_Object Qdebug_on_next_call; 101Lisp_Object Qdebug_on_next_call;
102 102
103void set_frame_menubar (FRAME_PTR, bool, bool); 103void set_frame_menubar (struct frame *, bool, bool);
104 104
105#ifdef HAVE_DIALOGS 105#ifdef HAVE_DIALOGS
106static Lisp_Object w32_dialog_show (FRAME_PTR, int, Lisp_Object, char**); 106static Lisp_Object w32_dialog_show (struct frame *, int, Lisp_Object, char**);
107#else 107#else
108static int is_simple_dialog (Lisp_Object); 108static int is_simple_dialog (Lisp_Object);
109static Lisp_Object simple_dialog_show (FRAME_PTR, Lisp_Object, Lisp_Object); 109static Lisp_Object simple_dialog_show (struct frame *, Lisp_Object, Lisp_Object);
110#endif 110#endif
111 111
112static void utf8to16 (unsigned char *, int, WCHAR *); 112static void utf8to16 (unsigned char *, int, WCHAR *);
@@ -137,7 +137,7 @@ If HEADER is non-nil, the frame title for the box is "Information",
137otherwise it is "Question". */) 137otherwise it is "Question". */)
138 (Lisp_Object position, Lisp_Object contents, Lisp_Object header) 138 (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
139{ 139{
140 FRAME_PTR f = NULL; 140 struct frame *f = NULL;
141 Lisp_Object window; 141 Lisp_Object window;
142 142
143 /* Decode the first argument: find the window or frame to use. */ 143 /* Decode the first argument: find the window or frame to use. */
@@ -147,7 +147,7 @@ otherwise it is "Question". */)
147 { 147 {
148#if 0 /* Using the frame the mouse is on may not be right. */ 148#if 0 /* Using the frame the mouse is on may not be right. */
149 /* Use the mouse's current position. */ 149 /* Use the mouse's current position. */
150 FRAME_PTR new_f = SELECTED_FRAME (); 150 struct frame *new_f = SELECTED_FRAME ();
151 Lisp_Object bar_window; 151 Lisp_Object bar_window;
152 enum scroll_bar_part part; 152 enum scroll_bar_part part;
153 Time time; 153 Time time;
@@ -206,8 +206,8 @@ otherwise it is "Question". */)
206 in the middle of frame F. */ 206 in the middle of frame F. */
207 Lisp_Object x, y, frame, newpos; 207 Lisp_Object x, y, frame, newpos;
208 XSETFRAME (frame, f); 208 XSETFRAME (frame, f);
209 XSETINT (x, x_pixel_width (f) / 2); 209 XSETINT (x, FRAME_PIXEL_WIDTH (f) / 2);
210 XSETINT (y, x_pixel_height (f) / 2); 210 XSETINT (y, FRAME_PIXEL_HEIGHT (f) / 2);
211 newpos = Fcons (Fcons (x, Fcons (y, Qnil)), Fcons (frame, Qnil)); 211 newpos = Fcons (Fcons (x, Fcons (y, Qnil)), Fcons (frame, Qnil));
212 return Fx_popup_menu (newpos, 212 return Fx_popup_menu (newpos,
213 Fcons (Fcar (contents), Fcons (contents, Qnil))); 213 Fcons (Fcar (contents), Fcons (contents, Qnil)));
@@ -252,7 +252,7 @@ otherwise it is "Question". */)
252 This way we can safely execute Lisp code. */ 252 This way we can safely execute Lisp code. */
253 253
254void 254void
255x_activate_menubar (FRAME_PTR f) 255x_activate_menubar (struct frame *f)
256{ 256{
257 set_frame_menubar (f, 0, 1); 257 set_frame_menubar (f, 0, 1);
258 258
@@ -269,7 +269,7 @@ x_activate_menubar (FRAME_PTR f)
269 and put the appropriate events into the keyboard buffer. */ 269 and put the appropriate events into the keyboard buffer. */
270 270
271void 271void
272menubar_selection_callback (FRAME_PTR f, void * client_data) 272menubar_selection_callback (struct frame *f, void * client_data)
273{ 273{
274 Lisp_Object prefix, entry; 274 Lisp_Object prefix, entry;
275 Lisp_Object vector; 275 Lisp_Object vector;
@@ -361,7 +361,7 @@ menubar_selection_callback (FRAME_PTR f, void * client_data)
361 it is set the first time this is called, from initialize_frame_menubar. */ 361 it is set the first time this is called, from initialize_frame_menubar. */
362 362
363void 363void
364set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p) 364set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
365{ 365{
366 HMENU menubar_widget = f->output_data.w32->menubar_widget; 366 HMENU menubar_widget = f->output_data.w32->menubar_widget;
367 Lisp_Object items; 367 Lisp_Object items;
@@ -613,7 +613,7 @@ set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p)
613 is visible. */ 613 is visible. */
614 614
615void 615void
616initialize_frame_menubar (FRAME_PTR f) 616initialize_frame_menubar (struct frame *f)
617{ 617{
618 /* This function is called before the first chance to redisplay 618 /* This function is called before the first chance to redisplay
619 the frame. It has to be, so the frame will have the right size. */ 619 the frame. It has to be, so the frame will have the right size. */
@@ -625,7 +625,7 @@ initialize_frame_menubar (FRAME_PTR f)
625 This is used when deleting a frame, and when turning off the menu bar. */ 625 This is used when deleting a frame, and when turning off the menu bar. */
626 626
627void 627void
628free_frame_menubar (FRAME_PTR f) 628free_frame_menubar (struct frame *f)
629{ 629{
630 block_input (); 630 block_input ();
631 631
@@ -656,7 +656,7 @@ free_frame_menubar (FRAME_PTR f)
656 (We return nil on failure, but the value doesn't actually matter.) */ 656 (We return nil on failure, but the value doesn't actually matter.) */
657 657
658Lisp_Object 658Lisp_Object
659w32_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, 659w32_menu_show (struct frame *f, int x, int y, int for_click, int keymaps,
660 Lisp_Object title, const char **error) 660 Lisp_Object title, const char **error)
661{ 661{
662 int i; 662 int i;
@@ -983,7 +983,7 @@ static char * button_names [] = {
983 "button6", "button7", "button8", "button9", "button10" }; 983 "button6", "button7", "button8", "button9", "button10" };
984 984
985static Lisp_Object 985static Lisp_Object
986w32_dialog_show (FRAME_PTR f, int keymaps, 986w32_dialog_show (struct frame *f, int keymaps,
987 Lisp_Object title, Lisp_Object header, 987 Lisp_Object title, Lisp_Object header,
988 char **error) 988 char **error)
989{ 989{
@@ -1219,7 +1219,7 @@ is_simple_dialog (Lisp_Object contents)
1219} 1219}
1220 1220
1221static Lisp_Object 1221static Lisp_Object
1222simple_dialog_show (FRAME_PTR f, Lisp_Object contents, Lisp_Object header) 1222simple_dialog_show (struct frame *f, Lisp_Object contents, Lisp_Object header)
1223{ 1223{
1224 int answer; 1224 int answer;
1225 UINT type; 1225 UINT type;
@@ -1699,7 +1699,7 @@ DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, Smenu_or_popup_active_
1699 (void) 1699 (void)
1700{ 1700{
1701#ifdef HAVE_MENUS 1701#ifdef HAVE_MENUS
1702 FRAME_PTR f; 1702 struct frame *f;
1703 f = SELECTED_FRAME (); 1703 f = SELECTED_FRAME ();
1704 return (f->output_data.w32->menubar_active > 0) ? Qt : Qnil; 1704 return (f->output_data.w32->menubar_active > 0) ? Qt : Qnil;
1705#else 1705#else
diff --git a/src/w32notify.c b/src/w32notify.c
index 95ab298f2d3..a48a83daf53 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -129,7 +129,7 @@ send_notifications (BYTE *info, DWORD info_size, void *desc,
129 volatile int *terminate) 129 volatile int *terminate)
130{ 130{
131 int done = 0; 131 int done = 0;
132 FRAME_PTR f = SELECTED_FRAME (); 132 struct frame *f = SELECTED_FRAME ();
133 133
134 /* A single buffer is used to communicate all notifications to the 134 /* A single buffer is used to communicate all notifications to the
135 main thread. Since both the main thread and several watcher 135 main thread. Since both the main thread and several watcher
diff --git a/src/w32term.c b/src/w32term.c
index b97632dabca..59cfdee86b0 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -181,7 +181,7 @@ int w32_keyboard_codepage;
181 181
182/* Where the mouse was last time we reported a mouse event. */ 182/* Where the mouse was last time we reported a mouse event. */
183static RECT last_mouse_glyph; 183static RECT last_mouse_glyph;
184static FRAME_PTR last_mouse_glyph_frame; 184static struct frame *last_mouse_glyph_frame;
185 185
186/* The scroll bar in which the last motion event occurred. 186/* The scroll bar in which the last motion event occurred.
187 187
@@ -249,7 +249,7 @@ static void my_set_focus (struct frame *, HWND);
249#endif 249#endif
250static void my_set_foreground_window (HWND); 250static void my_set_foreground_window (HWND);
251static void my_destroy_window (struct frame *, HWND); 251static void my_destroy_window (struct frame *, HWND);
252static void w32fullscreen_hook (FRAME_PTR); 252static void w32fullscreen_hook (struct frame *);
253 253
254#ifdef GLYPH_DEBUG 254#ifdef GLYPH_DEBUG
255static void x_check_font (struct frame *, struct font *); 255static void x_check_font (struct frame *, struct font *);
@@ -450,7 +450,7 @@ w32_draw_rectangle (HDC hdc, XGCValues *gc, int x, int y,
450 450
451/* Draw a filled rectangle at the specified position. */ 451/* Draw a filled rectangle at the specified position. */
452void 452void
453w32_fill_rect (FRAME_PTR f, HDC hdc, COLORREF pix, RECT *lprect) 453w32_fill_rect (struct frame *f, HDC hdc, COLORREF pix, RECT *lprect)
454{ 454{
455 HBRUSH hb; 455 HBRUSH hb;
456 456
@@ -460,7 +460,7 @@ w32_fill_rect (FRAME_PTR f, HDC hdc, COLORREF pix, RECT *lprect)
460} 460}
461 461
462void 462void
463w32_clear_window (FRAME_PTR f) 463w32_clear_window (struct frame *f)
464{ 464{
465 RECT rect; 465 RECT rect;
466 HDC hdc = get_frame_dc (f); 466 HDC hdc = get_frame_dc (f);
@@ -3370,7 +3370,7 @@ static MSG last_mouse_motion_event;
3370static Lisp_Object last_mouse_motion_frame; 3370static Lisp_Object last_mouse_motion_frame;
3371 3371
3372static int 3372static int
3373note_mouse_movement (FRAME_PTR frame, MSG *msg) 3373note_mouse_movement (struct frame *frame, MSG *msg)
3374{ 3374{
3375 int mouse_x = LOWORD (msg->lParam); 3375 int mouse_x = LOWORD (msg->lParam);
3376 int mouse_y = HIWORD (msg->lParam); 3376 int mouse_y = HIWORD (msg->lParam);
@@ -3419,7 +3419,7 @@ note_mouse_movement (FRAME_PTR frame, MSG *msg)
3419 ************************************************************************/ 3419 ************************************************************************/
3420 3420
3421static struct scroll_bar *x_window_to_scroll_bar (Window); 3421static struct scroll_bar *x_window_to_scroll_bar (Window);
3422static void x_scroll_bar_report_motion (FRAME_PTR *, Lisp_Object *, 3422static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *,
3423 enum scroll_bar_part *, 3423 enum scroll_bar_part *,
3424 Lisp_Object *, Lisp_Object *, 3424 Lisp_Object *, Lisp_Object *,
3425 unsigned long *); 3425 unsigned long *);
@@ -3461,11 +3461,11 @@ w32_define_cursor (Window window, Cursor cursor)
3461 movement. */ 3461 movement. */
3462 3462
3463static void 3463static void
3464w32_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, 3464w32_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
3465 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, 3465 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y,
3466 unsigned long *time) 3466 unsigned long *time)
3467{ 3467{
3468 FRAME_PTR f1; 3468 struct frame *f1;
3469 3469
3470 block_input (); 3470 block_input ();
3471 3471
@@ -3696,7 +3696,7 @@ my_create_scrollbar (struct frame * f, struct scroll_bar * bar)
3696/*#define ATTACH_THREADS*/ 3696/*#define ATTACH_THREADS*/
3697 3697
3698static BOOL 3698static BOOL
3699my_show_window (FRAME_PTR f, HWND hwnd, int how) 3699my_show_window (struct frame *f, HWND hwnd, int how)
3700{ 3700{
3701#ifndef ATTACH_THREADS 3701#ifndef ATTACH_THREADS
3702 return SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_SHOWWINDOW, 3702 return SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_SHOWWINDOW,
@@ -3816,7 +3816,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
3816static void 3816static void
3817x_scroll_bar_remove (struct scroll_bar *bar) 3817x_scroll_bar_remove (struct scroll_bar *bar)
3818{ 3818{
3819 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); 3819 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
3820 3820
3821 block_input (); 3821 block_input ();
3822 3822
@@ -3979,7 +3979,7 @@ w32_set_vertical_scroll_bar (struct window *w,
3979 `*redeem_scroll_bar_hook' is applied to its window before the judgment. */ 3979 `*redeem_scroll_bar_hook' is applied to its window before the judgment. */
3980 3980
3981static void 3981static void
3982w32_condemn_scroll_bars (FRAME_PTR frame) 3982w32_condemn_scroll_bars (struct frame *frame)
3983{ 3983{
3984 /* Transfer all the scroll bars to FRAME_CONDEMNED_SCROLL_BARS. */ 3984 /* Transfer all the scroll bars to FRAME_CONDEMNED_SCROLL_BARS. */
3985 while (! NILP (FRAME_SCROLL_BARS (frame))) 3985 while (! NILP (FRAME_SCROLL_BARS (frame)))
@@ -4047,7 +4047,7 @@ w32_redeem_scroll_bar (struct window *window)
4047 last call to `*condemn_scroll_bars_hook'. */ 4047 last call to `*condemn_scroll_bars_hook'. */
4048 4048
4049static void 4049static void
4050w32_judge_scroll_bars (FRAME_PTR f) 4050w32_judge_scroll_bars (struct frame *f)
4051{ 4051{
4052 Lisp_Object bar, next; 4052 Lisp_Object bar, next;
4053 4053
@@ -4185,14 +4185,14 @@ w32_scroll_bar_handle_click (struct scroll_bar *bar, W32Msg *msg,
4185 on the scroll bar. */ 4185 on the scroll bar. */
4186 4186
4187static void 4187static void
4188x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, 4188x_scroll_bar_report_motion (struct frame **fp, Lisp_Object *bar_window,
4189 enum scroll_bar_part *part, 4189 enum scroll_bar_part *part,
4190 Lisp_Object *x, Lisp_Object *y, 4190 Lisp_Object *x, Lisp_Object *y,
4191 unsigned long *time) 4191 unsigned long *time)
4192{ 4192{
4193 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); 4193 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);
4194 Window w = SCROLL_BAR_W32_WINDOW (bar); 4194 Window w = SCROLL_BAR_W32_WINDOW (bar);
4195 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); 4195 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
4196 int pos; 4196 int pos;
4197 int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); 4197 int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height));
4198 SCROLLINFO si; 4198 SCROLLINFO si;
@@ -4244,7 +4244,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window,
4244 redraw them. */ 4244 redraw them. */
4245 4245
4246void 4246void
4247x_scroll_bar_clear (FRAME_PTR f) 4247x_scroll_bar_clear (struct frame *f)
4248{ 4248{
4249 Lisp_Object bar; 4249 Lisp_Object bar;
4250 4250
@@ -4974,7 +4974,7 @@ w32_read_socket (struct terminal *terminal,
4974 if (f) 4974 if (f)
4975 { 4975 {
4976 extern void menubar_selection_callback 4976 extern void menubar_selection_callback
4977 (FRAME_PTR f, void * client_data); 4977 (struct frame *f, void * client_data);
4978 menubar_selection_callback (f, (void *)msg.msg.wParam); 4978 menubar_selection_callback (f, (void *)msg.msg.wParam);
4979 } 4979 }
4980 4980
@@ -5071,7 +5071,7 @@ w32_read_socket (struct terminal *terminal,
5071 5071
5072 FOR_EACH_FRAME (tail, frame) 5072 FOR_EACH_FRAME (tail, frame)
5073 { 5073 {
5074 FRAME_PTR f = XFRAME (frame); 5074 struct frame *f = XFRAME (frame);
5075 /* The tooltip has been drawn already. Avoid the 5075 /* The tooltip has been drawn already. Avoid the
5076 SET_FRAME_GARBAGED below. */ 5076 SET_FRAME_GARBAGED below. */
5077 if (EQ (frame, tip_frame)) 5077 if (EQ (frame, tip_frame))
@@ -5692,7 +5692,7 @@ x_check_fullscreen (struct frame *f)
5692} 5692}
5693 5693
5694static void 5694static void
5695w32fullscreen_hook (FRAME_PTR f) 5695w32fullscreen_hook (struct frame *f)
5696{ 5696{
5697 if (FRAME_VISIBLE_P (f)) 5697 if (FRAME_VISIBLE_P (f))
5698 { 5698 {
@@ -5889,11 +5889,6 @@ x_focus_on_frame (struct frame *f)
5889 unblock_input (); 5889 unblock_input ();
5890} 5890}
5891 5891
5892void
5893x_unfocus_frame (struct frame *f)
5894{
5895}
5896
5897/* Raise frame F. */ 5892/* Raise frame F. */
5898void 5893void
5899x_raise_frame (struct frame *f) 5894x_raise_frame (struct frame *f)
@@ -5969,7 +5964,7 @@ x_lower_frame (struct frame *f)
5969} 5964}
5970 5965
5971static void 5966static void
5972w32_frame_raise_lower (FRAME_PTR f, int raise_flag) 5967w32_frame_raise_lower (struct frame *f, int raise_flag)
5973{ 5968{
5974 if (! FRAME_W32_P (f)) 5969 if (! FRAME_W32_P (f))
5975 return; 5970 return;
@@ -6225,22 +6220,6 @@ x_wm_set_size_hint (struct frame *f, long flags, bool user_position)
6225 leave_crit (); 6220 leave_crit ();
6226} 6221}
6227 6222
6228/* Window manager things */
6229void
6230x_wm_set_icon_position (struct frame *f, int icon_x, int icon_y)
6231{
6232#if 0
6233 Window window = FRAME_W32_WINDOW (f);
6234
6235 f->display.x->wm_hints.flags |= IconPositionHint;
6236 f->display.x->wm_hints.icon_x = icon_x;
6237 f->display.x->wm_hints.icon_y = icon_y;
6238
6239 XSetWMHints (FRAME_X_DISPLAY (f), window, &f->display.x->wm_hints);
6240#endif
6241}
6242
6243
6244/*********************************************************************** 6223/***********************************************************************
6245 Fonts 6224 Fonts
6246 ***********************************************************************/ 6225 ***********************************************************************/
diff --git a/src/w32term.h b/src/w32term.h
index ace58758302..3c9cce35221 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -205,7 +205,7 @@ extern void x_focus_on_frame (struct frame *f);
205 205
206extern struct w32_display_info *w32_term_init (Lisp_Object, 206extern struct w32_display_info *w32_term_init (Lisp_Object,
207 char *, char *); 207 char *, char *);
208extern int w32_defined_color (FRAME_PTR f, const char *color, 208extern int w32_defined_color (struct frame *f, const char *color,
209 XColor *color_def, int alloc); 209 XColor *color_def, int alloc);
210extern void x_set_window_size (struct frame *f, int change_grav, 210extern void x_set_window_size (struct frame *f, int change_grav,
211 int cols, int rows); 211 int cols, int rows);
@@ -218,8 +218,6 @@ extern void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y);
218extern void x_make_frame_visible (struct frame *f); 218extern void x_make_frame_visible (struct frame *f);
219extern void x_make_frame_invisible (struct frame *f); 219extern void x_make_frame_invisible (struct frame *f);
220extern void x_iconify_frame (struct frame *f); 220extern void x_iconify_frame (struct frame *f);
221extern int x_pixel_width (struct frame *f);
222extern int x_pixel_height (struct frame *f);
223extern void x_set_frame_alpha (struct frame *f); 221extern void x_set_frame_alpha (struct frame *f);
224extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); 222extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
225extern void x_set_tool_bar_lines (struct frame *f, 223extern void x_set_tool_bar_lines (struct frame *f,
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index c153c8f3565..b31baa0e65c 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -69,28 +69,27 @@ memq_no_quit (Lisp_Object elt, Lisp_Object list)
69 69
70/* Font backend interface implementation. */ 70/* Font backend interface implementation. */
71static Lisp_Object 71static Lisp_Object
72uniscribe_list (Lisp_Object frame, Lisp_Object font_spec) 72uniscribe_list (struct frame *f, Lisp_Object font_spec)
73{ 73{
74 Lisp_Object fonts = w32font_list_internal (frame, font_spec, 1); 74 Lisp_Object fonts = w32font_list_internal (f, font_spec, 1);
75 FONT_ADD_LOG ("uniscribe-list", font_spec, fonts); 75 FONT_ADD_LOG ("uniscribe-list", font_spec, fonts);
76 return fonts; 76 return fonts;
77} 77}
78 78
79static Lisp_Object 79static Lisp_Object
80uniscribe_match (Lisp_Object frame, Lisp_Object font_spec) 80uniscribe_match (struct frame *f, Lisp_Object font_spec)
81{ 81{
82 Lisp_Object entity = w32font_match_internal (frame, font_spec, 1); 82 Lisp_Object entity = w32font_match_internal (f, font_spec, 1);
83 FONT_ADD_LOG ("uniscribe-match", font_spec, entity); 83 FONT_ADD_LOG ("uniscribe-match", font_spec, entity);
84 return entity; 84 return entity;
85} 85}
86 86
87static Lisp_Object 87static Lisp_Object
88uniscribe_list_family (Lisp_Object frame) 88uniscribe_list_family (struct frame *f)
89{ 89{
90 Lisp_Object list = Qnil; 90 Lisp_Object list = Qnil;
91 LOGFONT font_match_pattern; 91 LOGFONT font_match_pattern;
92 HDC dc; 92 HDC dc;
93 FRAME_PTR f = XFRAME (frame);
94 93
95 memset (&font_match_pattern, 0, sizeof (font_match_pattern)); 94 memset (&font_match_pattern, 0, sizeof (font_match_pattern));
96 /* Limit enumerated fonts to outline fonts to save time. */ 95 /* Limit enumerated fonts to outline fonts to save time. */
@@ -107,7 +106,7 @@ uniscribe_list_family (Lisp_Object frame)
107} 106}
108 107
109static Lisp_Object 108static Lisp_Object
110uniscribe_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) 109uniscribe_open (struct frame *f, Lisp_Object font_entity, int pixel_size)
111{ 110{
112 Lisp_Object font_object 111 Lisp_Object font_object
113 = font_make_object (VECSIZE (struct uniscribe_font_info), 112 = font_make_object (VECSIZE (struct uniscribe_font_info),
@@ -136,7 +135,7 @@ uniscribe_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
136} 135}
137 136
138static void 137static void
139uniscribe_close (FRAME_PTR f, struct font *font) 138uniscribe_close (struct frame *f, struct font *font)
140{ 139{
141 struct uniscribe_font_info *uniscribe_font 140 struct uniscribe_font_info *uniscribe_font
142 = (struct uniscribe_font_info *) font; 141 = (struct uniscribe_font_info *) font;
@@ -600,8 +599,8 @@ uniscribe_encode_char (struct font *font, int c)
600 int x, int y, int with_background); 599 int x, int y, int with_background);
601 600
602 Unused: 601 Unused:
603 int uniscribe_prepare_face (FRAME_PTR f, struct face *face); 602 int uniscribe_prepare_face (struct frame *f, struct face *face);
604 void uniscribe_done_face (FRAME_PTR f, struct face *face); 603 void uniscribe_done_face (struct frame *f, struct face *face);
605 int uniscribe_get_bitmap (struct font *font, unsigned code, 604 int uniscribe_get_bitmap (struct font *font, unsigned code,
606 struct font_bitmap *bitmap, int bits_per_pixel); 605 struct font_bitmap *bitmap, int bits_per_pixel);
607 void uniscribe_free_bitmap (struct font *font, struct font_bitmap *bitmap); 606 void uniscribe_free_bitmap (struct font *font, struct font_bitmap *bitmap);
@@ -609,8 +608,8 @@ uniscribe_encode_char (struct font *font, int c)
609 void uniscribe_free_outline (struct font *font, void *outline); 608 void uniscribe_free_outline (struct font *font, void *outline);
610 int uniscribe_anchor_point (struct font *font, unsigned code, 609 int uniscribe_anchor_point (struct font *font, unsigned code,
611 int index, int *x, int *y); 610 int index, int *x, int *y);
612 int uniscribe_start_for_frame (FRAME_PTR f); 611 int uniscribe_start_for_frame (struct frame *f);
613 int uniscribe_end_for_frame (FRAME_PTR f); 612 int uniscribe_end_for_frame (struct frame *f);
614 613
615*/ 614*/
616 615
diff --git a/src/w32xfns.c b/src/w32xfns.c
index 03611e19768..19c6b72bf89 100644
--- a/src/w32xfns.c
+++ b/src/w32xfns.c
@@ -90,7 +90,7 @@ signal_quit (void)
90} 90}
91 91
92void 92void
93select_palette (FRAME_PTR f, HDC hdc) 93select_palette (struct frame *f, HDC hdc)
94{ 94{
95 struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f); 95 struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f);
96 96
@@ -117,7 +117,7 @@ select_palette (FRAME_PTR f, HDC hdc)
117} 117}
118 118
119void 119void
120deselect_palette (FRAME_PTR f, HDC hdc) 120deselect_palette (struct frame *f, HDC hdc)
121{ 121{
122 if (f->output_data.w32->old_palette) 122 if (f->output_data.w32->old_palette)
123 SelectPalette (hdc, f->output_data.w32->old_palette, FALSE); 123 SelectPalette (hdc, f->output_data.w32->old_palette, FALSE);
@@ -126,7 +126,7 @@ deselect_palette (FRAME_PTR f, HDC hdc)
126/* Get a DC for frame and select palette for drawing; force an update of 126/* Get a DC for frame and select palette for drawing; force an update of
127 all frames if palette's mapping changes. */ 127 all frames if palette's mapping changes. */
128HDC 128HDC
129get_frame_dc (FRAME_PTR f) 129get_frame_dc (struct frame *f)
130{ 130{
131 HDC hdc; 131 HDC hdc;
132 132
@@ -146,7 +146,7 @@ get_frame_dc (FRAME_PTR f)
146} 146}
147 147
148int 148int
149release_frame_dc (FRAME_PTR f, HDC hdc) 149release_frame_dc (struct frame *f, HDC hdc)
150{ 150{
151 int ret; 151 int ret;
152 152
diff --git a/src/widget.c b/src/widget.c
index e2c8e9fa23f..ec0b506046b 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -503,26 +503,6 @@ widget_update_wm_size_hints (Widget widget)
503 update_wm_hints (ew); 503 update_wm_hints (ew);
504} 504}
505 505
506
507#if 0
508
509static void
510create_frame_gcs (EmacsFrame ew)
511{
512 struct frame *s = ew->emacs_frame.frame;
513
514 s->output_data.x->normal_gc
515 = XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)), 0, 0);
516 s->output_data.x->reverse_gc
517 = XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)), 0, 0);
518 s->output_data.x->cursor_gc
519 = XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)), 0, 0);
520 s->output_data.x->black_relief.gc = 0;
521 s->output_data.x->white_relief.gc = 0;
522}
523
524#endif /* 0 */
525
526static char setup_frame_cursor_bits[] = 506static char setup_frame_cursor_bits[] =
527{ 507{
528 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 508 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -683,19 +663,7 @@ EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs
683static void 663static void
684EmacsFrameDestroy (Widget widget) 664EmacsFrameDestroy (Widget widget)
685{ 665{
686 EmacsFrame ew = (EmacsFrame) widget; 666 /* All GCs are now freed in x_free_frame_resources. */
687 struct frame* s = ew->emacs_frame.frame;
688
689 if (! s) emacs_abort ();
690 if (! s->output_data.x) emacs_abort ();
691
692 block_input ();
693 x_free_gcs (s);
694 if (s->output_data.x->white_relief.gc)
695 XFreeGC (XtDisplay (widget), s->output_data.x->white_relief.gc);
696 if (s->output_data.x->black_relief.gc)
697 XFreeGC (XtDisplay (widget), s->output_data.x->black_relief.gc);
698 unblock_input ();
699} 667}
700 668
701static void 669static void
@@ -838,7 +806,7 @@ void
838widget_store_internal_border (Widget widget) 806widget_store_internal_border (Widget widget)
839{ 807{
840 EmacsFrame ew = (EmacsFrame) widget; 808 EmacsFrame ew = (EmacsFrame) widget;
841 FRAME_PTR f = ew->emacs_frame.frame; 809 struct frame *f = ew->emacs_frame.frame;
842 810
843 ew->emacs_frame.internal_border_width = f->internal_border_width; 811 ew->emacs_frame.internal_border_width = f->internal_border_width;
844} 812}
diff --git a/src/window.c b/src/window.c
index 6fd6849c6c3..1b288368884 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3019,7 +3019,7 @@ replace_buffer_in_windows_safely (Lisp_Object buffer)
3019 minimum allowable size. */ 3019 minimum allowable size. */
3020 3020
3021void 3021void
3022check_frame_size (FRAME_PTR frame, int *rows, int *cols) 3022check_frame_size (struct frame *frame, int *rows, int *cols)
3023{ 3023{
3024 /* For height, we have to see: 3024 /* For height, we have to see:
3025 how many windows the frame has at minimum (one or two), 3025 how many windows the frame has at minimum (one or two),
@@ -5516,7 +5516,7 @@ the return value is nil. Otherwise the value is t. */)
5516 struct Lisp_Vector *saved_windows; 5516 struct Lisp_Vector *saved_windows;
5517 Lisp_Object new_current_buffer; 5517 Lisp_Object new_current_buffer;
5518 Lisp_Object frame; 5518 Lisp_Object frame;
5519 FRAME_PTR f; 5519 struct frame *f;
5520 ptrdiff_t old_point = -1; 5520 ptrdiff_t old_point = -1;
5521 5521
5522 CHECK_WINDOW_CONFIGURATION (configuration); 5522 CHECK_WINDOW_CONFIGURATION (configuration);
diff --git a/src/xdisp.c b/src/xdisp.c
index 1da7de5759c..7a1f03ce244 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1854,7 +1854,7 @@ estimate_mode_line_height (struct frame *f, enum face_id face_id)
1854 not force the value into range. */ 1854 not force the value into range. */
1855 1855
1856void 1856void
1857pixel_to_glyph_coords (FRAME_PTR f, register int pix_x, register int pix_y, 1857pixel_to_glyph_coords (struct frame *f, register int pix_x, register int pix_y,
1858 int *x, int *y, NativeRectangle *bounds, int noclip) 1858 int *x, int *y, NativeRectangle *bounds, int noclip)
1859{ 1859{
1860 1860
@@ -5346,7 +5346,7 @@ handle_composition_prop (struct it *it)
5346 composition (in the case that the composition is from the current 5346 composition (in the case that the composition is from the current
5347 buffer), draw a glyph composed from the composition components. */ 5347 buffer), draw a glyph composed from the composition components. */
5348 if (find_composition (pos, -1, &start, &end, &prop, string) 5348 if (find_composition (pos, -1, &start, &end, &prop, string)
5349 && COMPOSITION_VALID_P (start, end, prop) 5349 && composition_valid_p (start, end, prop)
5350 && (STRINGP (it->string) || (PT <= start || PT >= end))) 5350 && (STRINGP (it->string) || (PT <= start || PT >= end)))
5351 { 5351 {
5352 if (start < pos) 5352 if (start < pos)
@@ -11449,7 +11449,7 @@ x_cursor_to (int vpos, int hpos, int y, int x)
11449 11449
11450/* Where the mouse was last time we reported a mouse event. */ 11450/* Where the mouse was last time we reported a mouse event. */
11451 11451
11452FRAME_PTR last_mouse_frame; 11452struct frame *last_mouse_frame;
11453 11453
11454/* Tool-bar item index of the item on which a mouse button was pressed 11454/* Tool-bar item index of the item on which a mouse button was pressed
11455 or -1. */ 11455 or -1. */
@@ -12852,7 +12852,7 @@ check_point_in_composition (struct buffer *prev_buf, ptrdiff_t prev_pt,
12852 12852
12853 if (prev_pt > BUF_BEGV (buf) && prev_pt < BUF_ZV (buf) 12853 if (prev_pt > BUF_BEGV (buf) && prev_pt < BUF_ZV (buf)
12854 && find_composition (prev_pt, -1, &start, &end, &prop, buffer) 12854 && find_composition (prev_pt, -1, &start, &end, &prop, buffer)
12855 && COMPOSITION_VALID_P (start, end, prop) 12855 && composition_valid_p (start, end, prop)
12856 && start < prev_pt && end > prev_pt) 12856 && start < prev_pt && end > prev_pt)
12857 /* The last point was within the composition. Return 1 iff 12857 /* The last point was within the composition. Return 1 iff
12858 point moved out of the composition. */ 12858 point moved out of the composition. */
@@ -12862,7 +12862,7 @@ check_point_in_composition (struct buffer *prev_buf, ptrdiff_t prev_pt,
12862 /* Check a composition at the current point. */ 12862 /* Check a composition at the current point. */
12863 return (pt > BUF_BEGV (buf) && pt < BUF_ZV (buf) 12863 return (pt > BUF_BEGV (buf) && pt < BUF_ZV (buf)
12864 && find_composition (pt, -1, &start, &end, &prop, buffer) 12864 && find_composition (pt, -1, &start, &end, &prop, buffer)
12865 && COMPOSITION_VALID_P (start, end, prop) 12865 && composition_valid_p (start, end, prop)
12866 && start < pt && end > pt); 12866 && start < pt && end > pt);
12867} 12867}
12868 12868
diff --git a/src/xfaces.c b/src/xfaces.c
index 52cd65c029f..acd2d2b1116 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -869,7 +869,7 @@ the pixmap. Bits are stored row by row, each row occupies
869 if these pointers are not null. */ 869 if these pointers are not null. */
870 870
871static ptrdiff_t 871static ptrdiff_t
872load_pixmap (FRAME_PTR f, Lisp_Object name, unsigned int *w_ptr, 872load_pixmap (struct frame *f, Lisp_Object name, unsigned int *w_ptr,
873 unsigned int *h_ptr) 873 unsigned int *h_ptr)
874{ 874{
875 ptrdiff_t bitmap_id; 875 ptrdiff_t bitmap_id;
@@ -1530,15 +1530,12 @@ the face font sort order. */)
1530 (Lisp_Object family, Lisp_Object frame) 1530 (Lisp_Object family, Lisp_Object frame)
1531{ 1531{
1532 Lisp_Object font_spec, list, *drivers, vec; 1532 Lisp_Object font_spec, list, *drivers, vec;
1533 struct frame *f = decode_live_frame (frame);
1533 ptrdiff_t i, nfonts; 1534 ptrdiff_t i, nfonts;
1534 EMACS_INT ndrivers; 1535 EMACS_INT ndrivers;
1535 Lisp_Object result; 1536 Lisp_Object result;
1536 USE_SAFE_ALLOCA; 1537 USE_SAFE_ALLOCA;
1537 1538
1538 if (NILP (frame))
1539 frame = selected_frame;
1540 CHECK_LIVE_FRAME (frame);
1541
1542 font_spec = Ffont_spec (0, NULL); 1539 font_spec = Ffont_spec (0, NULL);
1543 if (!NILP (family)) 1540 if (!NILP (family))
1544 { 1541 {
@@ -1546,7 +1543,7 @@ the face font sort order. */)
1546 font_parse_family_registry (family, Qnil, font_spec); 1543 font_parse_family_registry (family, Qnil, font_spec);
1547 } 1544 }
1548 1545
1549 list = font_list_entities (frame, font_spec); 1546 list = font_list_entities (f, font_spec);
1550 if (NILP (list)) 1547 if (NILP (list))
1551 return Qnil; 1548 return Qnil;
1552 1549
@@ -1589,7 +1586,7 @@ the face font sort order. */)
1589 ASET (v, 0, AREF (font, FONT_FAMILY_INDEX)); 1586 ASET (v, 0, AREF (font, FONT_FAMILY_INDEX));
1590 ASET (v, 1, FONT_WIDTH_SYMBOLIC (font)); 1587 ASET (v, 1, FONT_WIDTH_SYMBOLIC (font));
1591 point = PIXEL_TO_POINT (XINT (AREF (font, FONT_SIZE_INDEX)) * 10, 1588 point = PIXEL_TO_POINT (XINT (AREF (font, FONT_SIZE_INDEX)) * 10,
1592 FRAME_RES_Y (XFRAME (frame))); 1589 FRAME_RES_Y (f));
1593 ASET (v, 2, make_number (point)); 1590 ASET (v, 2, make_number (point));
1594 ASET (v, 3, FONT_WEIGHT_SYMBOLIC (font)); 1591 ASET (v, 3, FONT_WEIGHT_SYMBOLIC (font));
1595 ASET (v, 4, FONT_SLANT_SYMBOLIC (font)); 1592 ASET (v, 4, FONT_SLANT_SYMBOLIC (font));
@@ -3078,7 +3075,7 @@ FRAME 0 means change the face on all frames, and change the default
3078 { 3075 {
3079 if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value)) 3076 if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value))
3080 { 3077 {
3081 FRAME_PTR f; 3078 struct frame *f;
3082 3079
3083 old_value = LFACE_FONT (lface); 3080 old_value = LFACE_FONT (lface);
3084 if (! FONTP (value)) 3081 if (! FONTP (value))
diff --git a/src/xfns.c b/src/xfns.c
index a4492a10fdb..a1e9e916aba 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -176,7 +176,7 @@ check_x_display_info (Lisp_Object object)
176 dpyinfo = x_display_info_for_name (object); 176 dpyinfo = x_display_info_for_name (object);
177 else 177 else
178 { 178 {
179 FRAME_PTR f = decode_window_system_frame (object); 179 struct frame *f = decode_window_system_frame (object);
180 dpyinfo = FRAME_X_DISPLAY_INFO (f); 180 dpyinfo = FRAME_X_DISPLAY_INFO (f);
181 } 181 }
182 182
@@ -369,7 +369,7 @@ x_top_window_to_frame (struct x_display_info *dpyinfo, int wdesc)
369 not Emacs's own window. */ 369 not Emacs's own window. */
370 370
371void 371void
372x_real_positions (FRAME_PTR f, int *xptr, int *yptr) 372x_real_positions (struct frame *f, int *xptr, int *yptr)
373{ 373{
374 int win_x, win_y, outer_x IF_LINT (= 0), outer_y IF_LINT (= 0); 374 int win_x, win_y, outer_x IF_LINT (= 0), outer_y IF_LINT (= 0);
375 int real_x = 0, real_y = 0; 375 int real_x = 0, real_y = 0;
@@ -565,7 +565,7 @@ x_defined_color (struct frame *f, const char *color_name,
565 Signal an error if color can't be allocated. */ 565 Signal an error if color can't be allocated. */
566 566
567static int 567static int
568x_decode_color (FRAME_PTR f, Lisp_Object color_name, int mono_color) 568x_decode_color (struct frame *f, Lisp_Object color_name, int mono_color)
569{ 569{
570 XColor cdef; 570 XColor cdef;
571 571
@@ -626,7 +626,7 @@ x_set_tool_bar_position (struct frame *f,
626 may be any format that GdkPixbuf knows about, i.e. not just bitmaps. */ 626 may be any format that GdkPixbuf knows about, i.e. not just bitmaps. */
627 627
628int 628int
629xg_set_icon (FRAME_PTR f, Lisp_Object file) 629xg_set_icon (struct frame *f, Lisp_Object file)
630{ 630{
631 int result = 0; 631 int result = 0;
632 Lisp_Object found; 632 Lisp_Object found;
@@ -660,7 +660,7 @@ xg_set_icon (FRAME_PTR f, Lisp_Object file)
660} 660}
661 661
662int 662int
663xg_set_icon_from_xpm_data (FRAME_PTR f, const char **data) 663xg_set_icon_from_xpm_data (struct frame *f, const char **data)
664{ 664{
665 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (data); 665 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (data);
666 666
@@ -1050,7 +1050,7 @@ x_set_border_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1050 1050
1051 1051
1052static void 1052static void
1053x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 1053x_set_cursor_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1054{ 1054{
1055 set_frame_cursor_types (f, arg); 1055 set_frame_cursor_types (f, arg);
1056 1056
@@ -1449,7 +1449,7 @@ x_encode_text (Lisp_Object string, Lisp_Object coding_system, int selectionp,
1449 icon name to NAME. */ 1449 icon name to NAME. */
1450 1450
1451static void 1451static void
1452x_set_name_internal (FRAME_PTR f, Lisp_Object name) 1452x_set_name_internal (struct frame *f, Lisp_Object name)
1453{ 1453{
1454 if (FRAME_X_WINDOW (f)) 1454 if (FRAME_X_WINDOW (f))
1455 { 1455 {
@@ -1608,7 +1608,7 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit)
1608 specified a name for the frame; the name will override any set by the 1608 specified a name for the frame; the name will override any set by the
1609 redisplay code. */ 1609 redisplay code. */
1610static void 1610static void
1611x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 1611x_explicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1612{ 1612{
1613 x_set_name (f, arg, 1); 1613 x_set_name (f, arg, 1);
1614} 1614}
@@ -1617,7 +1617,7 @@ x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
1617 name; names set this way will never override names set by the user's 1617 name; names set this way will never override names set by the user's
1618 lisp code. */ 1618 lisp code. */
1619void 1619void
1620x_implicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 1620x_implicitly_set_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1621{ 1621{
1622 x_set_name (f, arg, 0); 1622 x_set_name (f, arg, 0);
1623} 1623}
@@ -1730,7 +1730,7 @@ x_default_scroll_bar_color_parameter (struct frame *f,
1730 for example, but Xt doesn't). */ 1730 for example, but Xt doesn't). */
1731 1731
1732static void 1732static void
1733hack_wm_protocols (FRAME_PTR f, Widget widget) 1733hack_wm_protocols (struct frame *f, Widget widget)
1734{ 1734{
1735 Display *dpy = XtDisplay (widget); 1735 Display *dpy = XtDisplay (widget);
1736 Window w = XtWindow (widget); 1736 Window w = XtWindow (widget);
@@ -2088,9 +2088,6 @@ xic_free_xfontset (struct frame *f)
2088 /* The fontset is not used anymore. It is safe to free it. */ 2088 /* The fontset is not used anymore. It is safe to free it. */
2089 XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f)); 2089 XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f));
2090 2090
2091 if (FRAME_XIC_BASE_FONTNAME (f))
2092 xfree (FRAME_XIC_BASE_FONTNAME (f));
2093 FRAME_XIC_BASE_FONTNAME (f) = NULL;
2094 FRAME_XIC_FONTSET (f) = NULL; 2091 FRAME_XIC_FONTSET (f) = NULL;
2095} 2092}
2096 2093
@@ -2541,7 +2538,7 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
2541#else /* not USE_X_TOOLKIT */ 2538#else /* not USE_X_TOOLKIT */
2542#ifdef USE_GTK 2539#ifdef USE_GTK
2543static void 2540static void
2544x_window (FRAME_PTR f) 2541x_window (struct frame *f)
2545{ 2542{
2546 if (! xg_create_frame_widgets (f)) 2543 if (! xg_create_frame_widgets (f))
2547 error ("Unable to create window"); 2544 error ("Unable to create window");
@@ -2791,10 +2788,6 @@ x_make_gc (struct frame *f)
2791 | GCFillStyle | GCLineWidth), 2788 | GCFillStyle | GCLineWidth),
2792 &gc_values); 2789 &gc_values);
2793 2790
2794 /* Reliefs. */
2795 f->output_data.x->white_relief.gc = 0;
2796 f->output_data.x->black_relief.gc = 0;
2797
2798 /* Create the gray border tile used when the pointer is not in 2791 /* Create the gray border tile used when the pointer is not in
2799 the frame. Since this depends on the frame's pixel values, 2792 the frame. Since this depends on the frame's pixel values,
2800 this must be done on a per-frame basis. */ 2793 this must be done on a per-frame basis. */
@@ -3492,7 +3485,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
3492 (Lisp_Object color, Lisp_Object frame) 3485 (Lisp_Object color, Lisp_Object frame)
3493{ 3486{
3494 XColor foo; 3487 XColor foo;
3495 FRAME_PTR f = decode_window_system_frame (frame); 3488 struct frame *f = decode_window_system_frame (frame);
3496 3489
3497 CHECK_STRING (color); 3490 CHECK_STRING (color);
3498 3491
@@ -3507,7 +3500,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
3507 (Lisp_Object color, Lisp_Object frame) 3500 (Lisp_Object color, Lisp_Object frame)
3508{ 3501{
3509 XColor foo; 3502 XColor foo;
3510 FRAME_PTR f = decode_window_system_frame (frame); 3503 struct frame *f = decode_window_system_frame (frame);
3511 3504
3512 CHECK_STRING (color); 3505 CHECK_STRING (color);
3513 3506
@@ -4325,19 +4318,6 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
4325 return attributes_list; 4318 return attributes_list;
4326} 4319}
4327 4320
4328
4329int
4330x_pixel_width (register struct frame *f)
4331{
4332 return FRAME_PIXEL_WIDTH (f);
4333}
4334
4335int
4336x_pixel_height (register struct frame *f)
4337{
4338 return FRAME_PIXEL_HEIGHT (f);
4339}
4340
4341/************************************************************************ 4321/************************************************************************
4342 X Displays 4322 X Displays
4343 ************************************************************************/ 4323 ************************************************************************/
@@ -4606,7 +4586,7 @@ If TERMINAL is omitted or nil, that stands for the selected frame's display. */
4606/* Wait for responses to all X commands issued so far for frame F. */ 4586/* Wait for responses to all X commands issued so far for frame F. */
4607 4587
4608void 4588void
4609x_sync (FRAME_PTR f) 4589x_sync (struct frame *f)
4610{ 4590{
4611 block_input (); 4591 block_input ();
4612 XSync (FRAME_X_DISPLAY (f), False); 4592 XSync (FRAME_X_DISPLAY (f), False);
@@ -5790,7 +5770,8 @@ or directory must exist.
5790This function is only defined on NS, MS Windows, and X Windows with the 5770This function is only defined on NS, MS Windows, and X Windows with the
5791Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored. 5771Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored.
5792Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) 5772Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
5793 (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) 5773 (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename,
5774 Lisp_Object mustmatch, Lisp_Object only_dir_p)
5794{ 5775{
5795 int result; 5776 int result;
5796 struct frame *f = SELECTED_FRAME (); 5777 struct frame *f = SELECTED_FRAME ();
@@ -5963,7 +5944,7 @@ Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored.
5963Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) 5944Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
5964 (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p) 5945 (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p)
5965{ 5946{
5966 FRAME_PTR f = SELECTED_FRAME (); 5947 struct frame *f = SELECTED_FRAME ();
5967 char *fn; 5948 char *fn;
5968 Lisp_Object file = Qnil; 5949 Lisp_Object file = Qnil;
5969 Lisp_Object decoded_file; 5950 Lisp_Object decoded_file;
@@ -6026,7 +6007,7 @@ FRAME is the frame on which to pop up the font chooser. If omitted or
6026nil, it defaults to the selected frame. */) 6007nil, it defaults to the selected frame. */)
6027 (Lisp_Object frame, Lisp_Object ignored) 6008 (Lisp_Object frame, Lisp_Object ignored)
6028{ 6009{
6029 FRAME_PTR f = decode_window_system_frame (frame); 6010 struct frame *f = decode_window_system_frame (frame);
6030 Lisp_Object font; 6011 Lisp_Object font;
6031 Lisp_Object font_param; 6012 Lisp_Object font_param;
6032 char *default_name = NULL; 6013 char *default_name = NULL;
diff --git a/src/xfont.c b/src/xfont.c
index 9647a51ac6e..f673adbbd5e 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -114,19 +114,19 @@ xfont_get_pcm (XFontStruct *xfont, XChar2b *char2b)
114 ? NULL : pcm); 114 ? NULL : pcm);
115} 115}
116 116
117static Lisp_Object xfont_get_cache (FRAME_PTR); 117static Lisp_Object xfont_get_cache (struct frame *);
118static Lisp_Object xfont_list (Lisp_Object, Lisp_Object); 118static Lisp_Object xfont_list (struct frame *, Lisp_Object);
119static Lisp_Object xfont_match (Lisp_Object, Lisp_Object); 119static Lisp_Object xfont_match (struct frame *, Lisp_Object);
120static Lisp_Object xfont_list_family (Lisp_Object); 120static Lisp_Object xfont_list_family (struct frame *);
121static Lisp_Object xfont_open (FRAME_PTR, Lisp_Object, int); 121static Lisp_Object xfont_open (struct frame *, Lisp_Object, int);
122static void xfont_close (FRAME_PTR, struct font *); 122static void xfont_close (struct frame *, struct font *);
123static int xfont_prepare_face (FRAME_PTR, struct face *); 123static int xfont_prepare_face (struct frame *, struct face *);
124static int xfont_has_char (Lisp_Object, int); 124static int xfont_has_char (Lisp_Object, int);
125static unsigned xfont_encode_char (struct font *, int); 125static unsigned xfont_encode_char (struct font *, int);
126static int xfont_text_extents (struct font *, unsigned *, int, 126static int xfont_text_extents (struct font *, unsigned *, int,
127 struct font_metrics *); 127 struct font_metrics *);
128static int xfont_draw (struct glyph_string *, int, int, int, int, bool); 128static int xfont_draw (struct glyph_string *, int, int, int, int, bool);
129static int xfont_check (FRAME_PTR, struct font *); 129static int xfont_check (struct frame *, struct font *);
130 130
131struct font_driver xfont_driver = 131struct font_driver xfont_driver =
132 { 132 {
@@ -152,7 +152,7 @@ struct font_driver xfont_driver =
152 }; 152 };
153 153
154static Lisp_Object 154static Lisp_Object
155xfont_get_cache (FRAME_PTR f) 155xfont_get_cache (struct frame *f)
156{ 156{
157 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 157 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
158 158
@@ -486,9 +486,8 @@ xfont_list_pattern (Display *display, const char *pattern,
486} 486}
487 487
488static Lisp_Object 488static Lisp_Object
489xfont_list (Lisp_Object frame, Lisp_Object spec) 489xfont_list (struct frame *f, Lisp_Object spec)
490{ 490{
491 FRAME_PTR f = XFRAME (frame);
492 Display *display = FRAME_X_DISPLAY_INFO (f)->display; 491 Display *display = FRAME_X_DISPLAY_INFO (f)->display;
493 Lisp_Object registry, list, val, extra, script; 492 Lisp_Object registry, list, val, extra, script;
494 int len; 493 int len;
@@ -565,9 +564,8 @@ xfont_list (Lisp_Object frame, Lisp_Object spec)
565} 564}
566 565
567static Lisp_Object 566static Lisp_Object
568xfont_match (Lisp_Object frame, Lisp_Object spec) 567xfont_match (struct frame *f, Lisp_Object spec)
569{ 568{
570 FRAME_PTR f = XFRAME (frame);
571 Display *display = FRAME_X_DISPLAY_INFO (f)->display; 569 Display *display = FRAME_X_DISPLAY_INFO (f)->display;
572 Lisp_Object extra, val, entity; 570 Lisp_Object extra, val, entity;
573 char name[512]; 571 char name[512];
@@ -622,9 +620,8 @@ xfont_match (Lisp_Object frame, Lisp_Object spec)
622} 620}
623 621
624static Lisp_Object 622static Lisp_Object
625xfont_list_family (Lisp_Object frame) 623xfont_list_family (struct frame *f)
626{ 624{
627 FRAME_PTR f = XFRAME (frame);
628 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 625 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
629 char **names; 626 char **names;
630 int num_fonts, i; 627 int num_fonts, i;
@@ -679,7 +676,7 @@ xfont_list_family (Lisp_Object frame)
679} 676}
680 677
681static Lisp_Object 678static Lisp_Object
682xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) 679xfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
683{ 680{
684 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 681 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
685 Display *display = dpyinfo->display; 682 Display *display = dpyinfo->display;
@@ -895,7 +892,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
895} 892}
896 893
897static void 894static void
898xfont_close (FRAME_PTR f, struct font *font) 895xfont_close (struct frame *f, struct font *font)
899{ 896{
900 block_input (); 897 block_input ();
901 XFreeFont (FRAME_X_DISPLAY (f), ((struct xfont_info *) font)->xfont); 898 XFreeFont (FRAME_X_DISPLAY (f), ((struct xfont_info *) font)->xfont);
@@ -903,7 +900,7 @@ xfont_close (FRAME_PTR f, struct font *font)
903} 900}
904 901
905static int 902static int
906xfont_prepare_face (FRAME_PTR f, struct face *face) 903xfont_prepare_face (struct frame *f, struct face *face)
907{ 904{
908 block_input (); 905 block_input ();
909 XSetFont (FRAME_X_DISPLAY (f), face->gc, 906 XSetFont (FRAME_X_DISPLAY (f), face->gc,
@@ -1092,7 +1089,7 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y,
1092} 1089}
1093 1090
1094static int 1091static int
1095xfont_check (FRAME_PTR f, struct font *font) 1092xfont_check (struct frame *f, struct font *font)
1096{ 1093{
1097 struct xfont_info *xfont = (struct xfont_info *) font; 1094 struct xfont_info *xfont = (struct xfont_info *) font;
1098 1095
diff --git a/src/xftfont.c b/src/xftfont.c
index 166a70acd85..f2b4c2abe2b 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -70,7 +70,7 @@ struct xftface_info
70 XftColor xft_bg; /* color for face->background */ 70 XftColor xft_bg; /* color for face->background */
71}; 71};
72 72
73static void xftfont_get_colors (FRAME_PTR, struct face *, GC gc, 73static void xftfont_get_colors (struct frame *, struct face *, GC gc,
74 struct xftface_info *, 74 struct xftface_info *,
75 XftColor *fg, XftColor *bg); 75 XftColor *fg, XftColor *bg);
76 76
@@ -80,7 +80,9 @@ static void xftfont_get_colors (FRAME_PTR, struct face *, GC gc,
80 may be NULL. */ 80 may be NULL. */
81 81
82static void 82static void
83xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info *xftface_info, XftColor *fg, XftColor *bg) 83xftfont_get_colors (struct frame *f, struct face *face, GC gc,
84 struct xftface_info *xftface_info,
85 XftColor *fg, XftColor *bg)
84{ 86{
85 if (xftface_info && face->gc == gc) 87 if (xftface_info && face->gc == gc)
86 { 88 {
@@ -139,9 +141,9 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info *
139struct font_driver xftfont_driver; 141struct font_driver xftfont_driver;
140 142
141static Lisp_Object 143static Lisp_Object
142xftfont_list (Lisp_Object frame, Lisp_Object spec) 144xftfont_list (struct frame *f, Lisp_Object spec)
143{ 145{
144 Lisp_Object list = ftfont_driver.list (frame, spec), tail; 146 Lisp_Object list = ftfont_driver.list (f, spec), tail;
145 147
146 for (tail = list; CONSP (tail); tail = XCDR (tail)) 148 for (tail = list; CONSP (tail); tail = XCDR (tail))
147 ASET (XCAR (tail), FONT_TYPE_INDEX, Qxft); 149 ASET (XCAR (tail), FONT_TYPE_INDEX, Qxft);
@@ -149,9 +151,9 @@ xftfont_list (Lisp_Object frame, Lisp_Object spec)
149} 151}
150 152
151static Lisp_Object 153static Lisp_Object
152xftfont_match (Lisp_Object frame, Lisp_Object spec) 154xftfont_match (struct frame *f, Lisp_Object spec)
153{ 155{
154 Lisp_Object entity = ftfont_driver.match (frame, spec); 156 Lisp_Object entity = ftfont_driver.match (f, spec);
155 157
156 if (! NILP (entity)) 158 if (! NILP (entity))
157 ASET (entity, FONT_TYPE_INDEX, Qxft); 159 ASET (entity, FONT_TYPE_INDEX, Qxft);
@@ -262,7 +264,7 @@ xftfont_add_rendering_parameters (FcPattern *pat, Lisp_Object entity)
262} 264}
263 265
264static Lisp_Object 266static Lisp_Object
265xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) 267xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
266{ 268{
267 FcResult result; 269 FcResult result;
268 Display *display = FRAME_X_DISPLAY (f); 270 Display *display = FRAME_X_DISPLAY (f);
@@ -484,7 +486,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
484} 486}
485 487
486static void 488static void
487xftfont_close (FRAME_PTR f, struct font *font) 489xftfont_close (struct frame *f, struct font *font)
488{ 490{
489 struct xftfont_info *xftfont_info = (struct xftfont_info *) font; 491 struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
490 492
@@ -499,7 +501,7 @@ xftfont_close (FRAME_PTR f, struct font *font)
499} 501}
500 502
501static int 503static int
502xftfont_prepare_face (FRAME_PTR f, struct face *face) 504xftfont_prepare_face (struct frame *f, struct face *face)
503{ 505{
504 struct xftface_info *xftface_info; 506 struct xftface_info *xftface_info;
505 507
@@ -522,7 +524,7 @@ xftfont_prepare_face (FRAME_PTR f, struct face *face)
522} 524}
523 525
524static void 526static void
525xftfont_done_face (FRAME_PTR f, struct face *face) 527xftfont_done_face (struct frame *f, struct face *face)
526{ 528{
527 struct xftface_info *xftface_info; 529 struct xftface_info *xftface_info;
528 530
@@ -595,7 +597,7 @@ xftfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct
595} 597}
596 598
597static XftDraw * 599static XftDraw *
598xftfont_get_xft_draw (FRAME_PTR f) 600xftfont_get_xft_draw (struct frame *f)
599{ 601{
600 XftDraw *xft_draw = font_get_frame_data (f, &xftfont_driver); 602 XftDraw *xft_draw = font_get_frame_data (f, &xftfont_driver);
601 603
@@ -617,7 +619,7 @@ static int
617xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, 619xftfont_draw (struct glyph_string *s, int from, int to, int x, int y,
618 bool with_background) 620 bool with_background)
619{ 621{
620 FRAME_PTR f = s->f; 622 struct frame *f = s->f;
621 struct face *face = s->face; 623 struct face *face = s->face;
622 struct xftfont_info *xftfont_info = (struct xftfont_info *) s->font; 624 struct xftfont_info *xftfont_info = (struct xftfont_info *) s->font;
623 struct xftface_info *xftface_info = NULL; 625 struct xftface_info *xftface_info = NULL;
@@ -677,7 +679,7 @@ xftfont_shape (Lisp_Object lgstring)
677#endif 679#endif
678 680
679static int 681static int
680xftfont_end_for_frame (FRAME_PTR f) 682xftfont_end_for_frame (struct frame *f)
681{ 683{
682 XftDraw *xft_draw; 684 XftDraw *xft_draw;
683 685
diff --git a/src/xmenu.c b/src/xmenu.c
index 5cc37842da9..cad892444ff 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -111,7 +111,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
111static Lisp_Object Qdebug_on_next_call; 111static Lisp_Object Qdebug_on_next_call;
112 112
113#if defined (USE_X_TOOLKIT) || defined (USE_GTK) 113#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
114static Lisp_Object xdialog_show (FRAME_PTR, bool, Lisp_Object, Lisp_Object, 114static Lisp_Object xdialog_show (struct frame *, bool, Lisp_Object, Lisp_Object,
115 const char **); 115 const char **);
116#endif 116#endif
117 117
@@ -130,7 +130,7 @@ static struct frame *
130menubar_id_to_frame (LWLIB_ID id) 130menubar_id_to_frame (LWLIB_ID id)
131{ 131{
132 Lisp_Object tail, frame; 132 Lisp_Object tail, frame;
133 FRAME_PTR f; 133 struct frame *f;
134 134
135 FOR_EACH_FRAME (tail, frame) 135 FOR_EACH_FRAME (tail, frame)
136 { 136 {
@@ -154,13 +154,12 @@ menubar_id_to_frame (LWLIB_ID id)
154 the scroll bar or the edit window. Fx_popup_menu needs to be 154 the scroll bar or the edit window. Fx_popup_menu needs to be
155 sure it is the edit window. */ 155 sure it is the edit window. */
156void 156void
157mouse_position_for_popup (FRAME_PTR f, int *x, int *y) 157mouse_position_for_popup (struct frame *f, int *x, int *y)
158{ 158{
159 Window root, dummy_window; 159 Window root, dummy_window;
160 int dummy; 160 int dummy;
161 161
162 if (! FRAME_X_P (f)) 162 eassert (FRAME_X_P (f));
163 emacs_abort ();
164 163
165 block_input (); 164 block_input ();
166 165
@@ -220,7 +219,7 @@ for instance using the window manager, then this produces a quit and
220`x-popup-dialog' does not return. */) 219`x-popup-dialog' does not return. */)
221 (Lisp_Object position, Lisp_Object contents, Lisp_Object header) 220 (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
222{ 221{
223 FRAME_PTR f = NULL; 222 struct frame *f = NULL;
224 Lisp_Object window; 223 Lisp_Object window;
225 224
226 /* Decode the first argument: find the window or frame to use. */ 225 /* Decode the first argument: find the window or frame to use. */
@@ -230,7 +229,7 @@ for instance using the window manager, then this produces a quit and
230 { 229 {
231#if 0 /* Using the frame the mouse is on may not be right. */ 230#if 0 /* Using the frame the mouse is on may not be right. */
232 /* Use the mouse's current position. */ 231 /* Use the mouse's current position. */
233 FRAME_PTR new_f = SELECTED_FRAME (); 232 struct frame *new_f = SELECTED_FRAME ();
234 Lisp_Object bar_window; 233 Lisp_Object bar_window;
235 enum scroll_bar_part part; 234 enum scroll_bar_part part;
236 Time time; 235 Time time;
@@ -294,8 +293,8 @@ for instance using the window manager, then this produces a quit and
294 { 293 {
295 Lisp_Object x, y, frame, newpos; 294 Lisp_Object x, y, frame, newpos;
296 XSETFRAME (frame, f); 295 XSETFRAME (frame, f);
297 XSETINT (x, x_pixel_width (f) / 2); 296 XSETINT (x, FRAME_PIXEL_WIDTH (f) / 2);
298 XSETINT (y, x_pixel_height (f) / 2); 297 XSETINT (y, FRAME_PIXEL_HEIGHT (f) / 2);
299 newpos = list2 (list2 (x, y), frame); 298 newpos = list2 (list2 (x, y), frame);
300 299
301 return Fx_popup_menu (newpos, 300 return Fx_popup_menu (newpos,
@@ -482,7 +481,7 @@ If FRAME is nil or not given, use the selected frame. */)
482 (Lisp_Object frame) 481 (Lisp_Object frame)
483{ 482{
484 XEvent ev; 483 XEvent ev;
485 FRAME_PTR f = decode_window_system_frame (frame); 484 struct frame *f = decode_window_system_frame (frame);
486 Widget menubar; 485 Widget menubar;
487 block_input (); 486 block_input ();
488 487
@@ -560,10 +559,7 @@ If FRAME is nil or not given, use the selected frame. */)
560 (Lisp_Object frame) 559 (Lisp_Object frame)
561{ 560{
562 GtkWidget *menubar; 561 GtkWidget *menubar;
563 FRAME_PTR f; 562 struct frame *f;
564
565 /* gcc 2.95 doesn't accept the FRAME_PTR declaration after
566 block_input (). */
567 563
568 block_input (); 564 block_input ();
569 f = decode_window_system_frame (frame); 565 f = decode_window_system_frame (frame);
@@ -621,10 +617,9 @@ popup_widget_loop (int do_timers, GtkWidget *widget)
621 execute Lisp code. */ 617 execute Lisp code. */
622 618
623void 619void
624x_activate_menubar (FRAME_PTR f) 620x_activate_menubar (struct frame *f)
625{ 621{
626 if (! FRAME_X_P (f)) 622 eassert (FRAME_X_P (f));
627 emacs_abort ();
628 623
629 if (!f->output_data.x->saved_menu_event->type) 624 if (!f->output_data.x->saved_menu_event->type)
630 return; 625 return;
@@ -684,7 +679,7 @@ popup_deactivate_callback (
684 for that widget. 679 for that widget.
685 F is the frame if known, or NULL if not known. */ 680 F is the frame if known, or NULL if not known. */
686static void 681static void
687show_help_event (FRAME_PTR f, xt_or_gtk_widget widget, Lisp_Object help) 682show_help_event (struct frame *f, xt_or_gtk_widget widget, Lisp_Object help)
688{ 683{
689 Lisp_Object frame; 684 Lisp_Object frame;
690 685
@@ -817,7 +812,7 @@ menubar_selection_callback (GtkWidget *widget, gpointer client_data)
817static void 812static void
818menubar_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data) 813menubar_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
819{ 814{
820 FRAME_PTR f; 815 struct frame *f;
821 816
822 f = menubar_id_to_frame (id); 817 f = menubar_id_to_frame (id);
823 if (!f) 818 if (!f)
@@ -831,7 +826,7 @@ menubar_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
831 changed. */ 826 changed. */
832 827
833static void 828static void
834update_frame_menubar (FRAME_PTR f) 829update_frame_menubar (struct frame *f)
835{ 830{
836#ifdef USE_GTK 831#ifdef USE_GTK
837 xg_update_frame_menubar (f); 832 xg_update_frame_menubar (f);
@@ -839,8 +834,7 @@ update_frame_menubar (FRAME_PTR f)
839 struct x_output *x; 834 struct x_output *x;
840 int columns, rows; 835 int columns, rows;
841 836
842 if (! FRAME_X_P (f)) 837 eassert (FRAME_X_P (f));
843 emacs_abort ();
844 838
845 x = f->output_data.x; 839 x = f->output_data.x;
846 840
@@ -914,7 +908,7 @@ apply_systemfont_to_menu (struct frame *f, Widget w)
914 it is set the first time this is called, from initialize_frame_menubar. */ 908 it is set the first time this is called, from initialize_frame_menubar. */
915 909
916void 910void
917set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p) 911set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
918{ 912{
919 xt_or_gtk_widget menubar_widget; 913 xt_or_gtk_widget menubar_widget;
920#ifdef USE_X_TOOLKIT 914#ifdef USE_X_TOOLKIT
@@ -927,8 +921,7 @@ set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p)
927 bool *submenu_top_level_items; 921 bool *submenu_top_level_items;
928 int *submenu_n_panes; 922 int *submenu_n_panes;
929 923
930 if (! FRAME_X_P (f)) 924 eassert (FRAME_X_P (f));
931 emacs_abort ();
932 925
933 menubar_widget = f->output_data.x->menubar_widget; 926 menubar_widget = f->output_data.x->menubar_widget;
934 927
@@ -1267,7 +1260,7 @@ set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p)
1267 is visible. */ 1260 is visible. */
1268 1261
1269void 1262void
1270initialize_frame_menubar (FRAME_PTR f) 1263initialize_frame_menubar (struct frame *f)
1271{ 1264{
1272 /* This function is called before the first chance to redisplay 1265 /* This function is called before the first chance to redisplay
1273 the frame. It has to be, so the frame will have the right size. */ 1266 the frame. It has to be, so the frame will have the right size. */
@@ -1282,12 +1275,11 @@ initialize_frame_menubar (FRAME_PTR f)
1282 1275
1283#ifndef USE_GTK 1276#ifndef USE_GTK
1284void 1277void
1285free_frame_menubar (FRAME_PTR f) 1278free_frame_menubar (struct frame *f)
1286{ 1279{
1287 Widget menubar_widget; 1280 Widget menubar_widget;
1288 1281
1289 if (! FRAME_X_P (f)) 1282 eassert (FRAME_X_P (f));
1290 emacs_abort ();
1291 1283
1292 menubar_widget = f->output_data.x->menubar_widget; 1284 menubar_widget = f->output_data.x->menubar_widget;
1293 1285
@@ -1360,7 +1352,7 @@ static Lisp_Object *volatile menu_item_selection;
1360 create_and_show_popup_menu below. */ 1352 create_and_show_popup_menu below. */
1361struct next_popup_x_y 1353struct next_popup_x_y
1362{ 1354{
1363 FRAME_PTR f; 1355 struct frame *f;
1364 int x; 1356 int x;
1365 int y; 1357 int y;
1366}; 1358};
@@ -1418,7 +1410,7 @@ pop_down_menu (void *arg)
1418 menu pops down. 1410 menu pops down.
1419 menu_item_selection will be set to the selection. */ 1411 menu_item_selection will be set to the selection. */
1420static void 1412static void
1421create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, 1413create_and_show_popup_menu (struct frame *f, widget_value *first_wv, int x, int y,
1422 bool for_click, Time timestamp) 1414 bool for_click, Time timestamp)
1423{ 1415{
1424 int i; 1416 int i;
@@ -1434,8 +1426,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y,
1434 use_pos_func = 1; 1426 use_pos_func = 1;
1435#endif 1427#endif
1436 1428
1437 if (! FRAME_X_P (f)) 1429 eassert (FRAME_X_P (f));
1438 emacs_abort ();
1439 1430
1440 xg_crazy_callback_abort = 1; 1431 xg_crazy_callback_abort = 1;
1441 menu = xg_create_widget ("popup", first_wv->name, f, first_wv, 1432 menu = xg_create_widget ("popup", first_wv->name, f, first_wv,
@@ -1528,7 +1519,7 @@ pop_down_menu (Lisp_Object arg)
1528 menu pops down. 1519 menu pops down.
1529 menu_item_selection will be set to the selection. */ 1520 menu_item_selection will be set to the selection. */
1530static void 1521static void
1531create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, 1522create_and_show_popup_menu (struct frame *f, widget_value *first_wv,
1532 int x, int y, bool for_click, Time timestamp) 1523 int x, int y, bool for_click, Time timestamp)
1533{ 1524{
1534 int i; 1525 int i;
@@ -1539,8 +1530,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
1539 LWLIB_ID menu_id; 1530 LWLIB_ID menu_id;
1540 Widget menu; 1531 Widget menu;
1541 1532
1542 if (! FRAME_X_P (f)) 1533 eassert (FRAME_X_P (f));
1543 emacs_abort ();
1544 1534
1545#ifdef USE_LUCID 1535#ifdef USE_LUCID
1546 apply_systemfont_to_menu (f, f->output_data.x->widget); 1536 apply_systemfont_to_menu (f, f->output_data.x->widget);
@@ -1608,7 +1598,7 @@ cleanup_widget_value_tree (void *arg)
1608} 1598}
1609 1599
1610Lisp_Object 1600Lisp_Object
1611xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps, 1601xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps,
1612 Lisp_Object title, const char **error_name, Time timestamp) 1602 Lisp_Object title, const char **error_name, Time timestamp)
1613{ 1603{
1614 int i; 1604 int i;
@@ -1623,8 +1613,7 @@ xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
1623 1613
1624 ptrdiff_t specpdl_count = SPECPDL_INDEX (); 1614 ptrdiff_t specpdl_count = SPECPDL_INDEX ();
1625 1615
1626 if (! FRAME_X_P (f)) 1616 eassert (FRAME_X_P (f));
1627 emacs_abort ();
1628 1617
1629 *error_name = NULL; 1618 *error_name = NULL;
1630 1619
@@ -1902,12 +1891,11 @@ dialog_selection_callback (GtkWidget *widget, gpointer client_data)
1902 dialog pops down. 1891 dialog pops down.
1903 menu_item_selection will be set to the selection. */ 1892 menu_item_selection will be set to the selection. */
1904static void 1893static void
1905create_and_show_dialog (FRAME_PTR f, widget_value *first_wv) 1894create_and_show_dialog (struct frame *f, widget_value *first_wv)
1906{ 1895{
1907 GtkWidget *menu; 1896 GtkWidget *menu;
1908 1897
1909 if (! FRAME_X_P (f)) 1898 eassert (FRAME_X_P (f));
1910 emacs_abort ();
1911 1899
1912 menu = xg_create_widget ("dialog", first_wv->name, f, first_wv, 1900 menu = xg_create_widget ("dialog", first_wv->name, f, first_wv,
1913 G_CALLBACK (dialog_selection_callback), 1901 G_CALLBACK (dialog_selection_callback),
@@ -1949,12 +1937,11 @@ dialog_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
1949 dialog pops down. 1937 dialog pops down.
1950 menu_item_selection will be set to the selection. */ 1938 menu_item_selection will be set to the selection. */
1951static void 1939static void
1952create_and_show_dialog (FRAME_PTR f, widget_value *first_wv) 1940create_and_show_dialog (struct frame *f, widget_value *first_wv)
1953{ 1941{
1954 LWLIB_ID dialog_id; 1942 LWLIB_ID dialog_id;
1955 1943
1956 if (!FRAME_X_P (f)) 1944 eassert (FRAME_X_P (f));
1957 emacs_abort ();
1958 1945
1959 dialog_id = widget_id_tick++; 1946 dialog_id = widget_id_tick++;
1960#ifdef USE_LUCID 1947#ifdef USE_LUCID
@@ -1994,7 +1981,7 @@ static const char * button_names [] = {
1994 "button6", "button7", "button8", "button9", "button10" }; 1981 "button6", "button7", "button8", "button9", "button10" };
1995 1982
1996static Lisp_Object 1983static Lisp_Object
1997xdialog_show (FRAME_PTR f, 1984xdialog_show (struct frame *f,
1998 bool keymaps, 1985 bool keymaps,
1999 Lisp_Object title, 1986 Lisp_Object title,
2000 Lisp_Object header, 1987 Lisp_Object header,
@@ -2012,8 +1999,7 @@ xdialog_show (FRAME_PTR f,
2012 1999
2013 ptrdiff_t specpdl_count = SPECPDL_INDEX (); 2000 ptrdiff_t specpdl_count = SPECPDL_INDEX ();
2014 2001
2015 if (! FRAME_X_P (f)) 2002 eassert (FRAME_X_P (f));
2016 emacs_abort ();
2017 2003
2018 *error_name = NULL; 2004 *error_name = NULL;
2019 2005
@@ -2225,7 +2211,7 @@ menu_help_callback (char const *help_string, int pane, int item)
2225static void 2211static void
2226pop_down_menu (Lisp_Object arg) 2212pop_down_menu (Lisp_Object arg)
2227{ 2213{
2228 FRAME_PTR f = XSAVE_POINTER (arg, 0); 2214 struct frame *f = XSAVE_POINTER (arg, 0);
2229 XMenu *menu = XSAVE_POINTER (arg, 1); 2215 XMenu *menu = XSAVE_POINTER (arg, 1);
2230 2216
2231 block_input (); 2217 block_input ();
@@ -2253,7 +2239,7 @@ pop_down_menu (Lisp_Object arg)
2253 2239
2254 2240
2255Lisp_Object 2241Lisp_Object
2256xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps, 2242xmenu_show (struct frame *f, int x, int y, bool for_click, bool keymaps,
2257 Lisp_Object title, const char **error_name, Time timestamp) 2243 Lisp_Object title, const char **error_name, Time timestamp)
2258{ 2244{
2259 Window root; 2245 Window root;
@@ -2269,8 +2255,7 @@ xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
2269 unsigned int dummy_uint; 2255 unsigned int dummy_uint;
2270 ptrdiff_t specpdl_count = SPECPDL_INDEX (); 2256 ptrdiff_t specpdl_count = SPECPDL_INDEX ();
2271 2257
2272 if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f)) 2258 eassert (FRAME_X_P (f) || FRAME_MSDOS_P (f));
2273 emacs_abort ();
2274 2259
2275 *error_name = 0; 2260 *error_name = 0;
2276 if (menu_items_n_panes == 0) 2261 if (menu_items_n_panes == 0)
diff --git a/src/xselect.c b/src/xselect.c
index d9f7d9c29c7..3a16d7d3496 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -993,7 +993,7 @@ x_handle_selection_event (struct input_event *event)
993 We do this when about to delete a frame. */ 993 We do this when about to delete a frame. */
994 994
995void 995void
996x_clear_frame_selections (FRAME_PTR f) 996x_clear_frame_selections (struct frame *f)
997{ 997{
998 Lisp_Object frame; 998 Lisp_Object frame;
999 Lisp_Object rest; 999 Lisp_Object rest;
@@ -2377,7 +2377,7 @@ x_property_data_to_lisp (struct frame *f, const unsigned char *data,
2377/* Get the mouse position in frame relative coordinates. */ 2377/* Get the mouse position in frame relative coordinates. */
2378 2378
2379static void 2379static void
2380mouse_position_for_drop (FRAME_PTR f, int *x, int *y) 2380mouse_position_for_drop (struct frame *f, int *x, int *y)
2381{ 2381{
2382 Window root, dummy_window; 2382 Window root, dummy_window;
2383 int dummy; 2383 int dummy;
diff --git a/src/xterm.c b/src/xterm.c
index a2306935e4e..a486242b8c3 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -145,7 +145,7 @@ int use_xim = 0; /* configure --without-xim */
145/* Non-zero means that a HELP_EVENT has been generated since Emacs 145/* Non-zero means that a HELP_EVENT has been generated since Emacs
146 start. */ 146 start. */
147 147
148static int any_help_event_p; 148static bool any_help_event_p;
149 149
150/* Last window where we saw the mouse. Used by mouse-autoselect-window. */ 150/* Last window where we saw the mouse. Used by mouse-autoselect-window. */
151static Lisp_Object last_window; 151static Lisp_Object last_window;
@@ -212,8 +212,7 @@ static unsigned long ignore_next_mouse_click_timeout;
212/* Where the mouse was last time we reported a mouse event. */ 212/* Where the mouse was last time we reported a mouse event. */
213 213
214static XRectangle last_mouse_glyph; 214static XRectangle last_mouse_glyph;
215static FRAME_PTR last_mouse_glyph_frame; 215static struct frame *last_mouse_glyph_frame;
216static Lisp_Object last_mouse_press_frame;
217 216
218/* The scroll bar in which the last X motion event occurred. 217/* The scroll bar in which the last X motion event occurred.
219 218
@@ -288,8 +287,6 @@ enum xembed_message
288 XEMBED_ACTIVATE_ACCELERATOR = 14 287 XEMBED_ACTIVATE_ACCELERATOR = 14
289 }; 288 };
290 289
291/* Used in x_flush. */
292
293static bool x_alloc_nearest_color_1 (Display *, Colormap, XColor *); 290static bool x_alloc_nearest_color_1 (Display *, Colormap, XColor *);
294static void x_set_window_size_1 (struct frame *, int, int, int); 291static void x_set_window_size_1 (struct frame *, int, int, int);
295static void x_raise_frame (struct frame *); 292static void x_raise_frame (struct frame *);
@@ -357,15 +354,18 @@ x_flush (struct frame *f)
357 return; 354 return;
358 355
359 block_input (); 356 block_input ();
360 if (f == NULL) 357 if (f)
358 {
359 eassert (FRAME_X_P (f));
360 XFlush (FRAME_X_DISPLAY (f));
361 }
362 else
361 { 363 {
362 Lisp_Object rest, frame; 364 /* Flush all displays and so all frames on them. */
363 FOR_EACH_FRAME (rest, frame) 365 struct x_display_info *xdi;
364 if (FRAME_X_P (XFRAME (frame))) 366 for (xdi = x_display_list; xdi; xdi = xdi->next)
365 x_flush (XFRAME (frame)); 367 XFlush (xdi->display);
366 } 368 }
367 else if (FRAME_X_P (f))
368 XFlush (FRAME_X_DISPLAY (f));
369 unblock_input (); 369 unblock_input ();
370} 370}
371 371
@@ -877,8 +877,6 @@ XTreset_terminal_modes (struct terminal *terminal)
877 877
878static void x_set_glyph_string_clipping (struct glyph_string *); 878static void x_set_glyph_string_clipping (struct glyph_string *);
879static void x_set_glyph_string_gc (struct glyph_string *); 879static void x_set_glyph_string_gc (struct glyph_string *);
880static void x_draw_glyph_string_background (struct glyph_string *,
881 int);
882static void x_draw_glyph_string_foreground (struct glyph_string *); 880static void x_draw_glyph_string_foreground (struct glyph_string *);
883static void x_draw_composite_glyph_string_foreground (struct glyph_string *); 881static void x_draw_composite_glyph_string_foreground (struct glyph_string *);
884static void x_draw_glyph_string_box (struct glyph_string *); 882static void x_draw_glyph_string_box (struct glyph_string *);
@@ -1163,7 +1161,7 @@ x_clear_glyph_string_rect (struct glyph_string *s, int x, int y, int w, int h)
1163 contains the first component of a composition. */ 1161 contains the first component of a composition. */
1164 1162
1165static void 1163static void
1166x_draw_glyph_string_background (struct glyph_string *s, int force_p) 1164x_draw_glyph_string_background (struct glyph_string *s, bool force_p)
1167{ 1165{
1168 /* Nothing to do if background has already been drawn or if it 1166 /* Nothing to do if background has already been drawn or if it
1169 shouldn't be drawn in the first place. */ 1167 shouldn't be drawn in the first place. */
@@ -1413,11 +1411,6 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
1413 1411
1414#ifdef USE_X_TOOLKIT 1412#ifdef USE_X_TOOLKIT
1415 1413
1416static Boolean cvt_string_to_pixel (Display *, XrmValue *, Cardinal *,
1417 XrmValue *, XrmValue *, XtPointer *);
1418static void cvt_pixel_dtor (XtAppContext, XrmValue *, XtPointer,
1419 XrmValue *, Cardinal *);
1420
1421#ifdef USE_LUCID 1414#ifdef USE_LUCID
1422 1415
1423/* Return the frame on which widget WIDGET is used.. Abort if frame 1416/* Return the frame on which widget WIDGET is used.. Abort if frame
@@ -3195,7 +3188,7 @@ XTflash (struct frame *f)
3195 3188
3196 3189
3197static void 3190static void
3198XTtoggle_invisible_pointer (FRAME_PTR f, int invisible) 3191XTtoggle_invisible_pointer (struct frame *f, int invisible)
3199{ 3192{
3200 block_input (); 3193 block_input ();
3201 if (invisible) 3194 if (invisible)
@@ -3804,7 +3797,7 @@ static XMotionEvent last_mouse_motion_event;
3804static Lisp_Object last_mouse_motion_frame; 3797static Lisp_Object last_mouse_motion_frame;
3805 3798
3806static int 3799static int
3807note_mouse_movement (FRAME_PTR frame, XMotionEvent *event) 3800note_mouse_movement (struct frame *frame, XMotionEvent *event)
3808{ 3801{
3809 last_mouse_movement_time = event->time; 3802 last_mouse_movement_time = event->time;
3810 last_mouse_motion_event = *event; 3803 last_mouse_motion_event = *event;
@@ -3880,11 +3873,11 @@ redo_mouse_highlight (void)
3880 movement. */ 3873 movement. */
3881 3874
3882static void 3875static void
3883XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, 3876XTmouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
3884 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, 3877 enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y,
3885 Time *timestamp) 3878 Time *timestamp)
3886{ 3879{
3887 FRAME_PTR f1; 3880 struct frame *f1;
3888 3881
3889 block_input (); 3882 block_input ();
3890 3883
@@ -4423,7 +4416,8 @@ xg_scroll_callback (GtkRange *range,
4423 gdouble position; 4416 gdouble position;
4424 int part = -1, whole = 0, portion = 0; 4417 int part = -1, whole = 0, portion = 0;
4425 GtkAdjustment *adj = GTK_ADJUSTMENT (gtk_range_get_adjustment (range)); 4418 GtkAdjustment *adj = GTK_ADJUSTMENT (gtk_range_get_adjustment (range));
4426 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (range), XG_FRAME_DATA); 4419 struct frame *f = (struct frame *) g_object_get_data (G_OBJECT (range),
4420 XG_FRAME_DATA);
4427 4421
4428 if (xg_ignore_gtk_scrollbar) return FALSE; 4422 if (xg_ignore_gtk_scrollbar) return FALSE;
4429 position = gtk_adjustment_get_value (adj); 4423 position = gtk_adjustment_get_value (adj);
@@ -5040,7 +5034,7 @@ x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, int rebuild
5040{ 5034{
5041 int dragging = ! NILP (bar->dragging); 5035 int dragging = ! NILP (bar->dragging);
5042 Window w = bar->x_window; 5036 Window w = bar->x_window;
5043 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); 5037 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
5044 GC gc = f->output_data.x->normal_gc; 5038 GC gc = f->output_data.x->normal_gc;
5045 5039
5046 /* If the display is already accurate, do nothing. */ 5040 /* If the display is already accurate, do nothing. */
@@ -5381,7 +5375,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
5381 `*redeem_scroll_bar_hook' is applied to its window before the judgment. */ 5375 `*redeem_scroll_bar_hook' is applied to its window before the judgment. */
5382 5376
5383static void 5377static void
5384XTcondemn_scroll_bars (FRAME_PTR frame) 5378XTcondemn_scroll_bars (struct frame *frame)
5385{ 5379{
5386 /* Transfer all the scroll bars to FRAME_CONDEMNED_SCROLL_BARS. */ 5380 /* Transfer all the scroll bars to FRAME_CONDEMNED_SCROLL_BARS. */
5387 while (! NILP (FRAME_SCROLL_BARS (frame))) 5381 while (! NILP (FRAME_SCROLL_BARS (frame)))
@@ -5449,7 +5443,7 @@ XTredeem_scroll_bar (struct window *window)
5449 last call to `*condemn_scroll_bars_hook'. */ 5443 last call to `*condemn_scroll_bars_hook'. */
5450 5444
5451static void 5445static void
5452XTjudge_scroll_bars (FRAME_PTR f) 5446XTjudge_scroll_bars (struct frame *f)
5453{ 5447{
5454 Lisp_Object bar, next; 5448 Lisp_Object bar, next;
5455 5449
@@ -5485,7 +5479,7 @@ static void
5485x_scroll_bar_expose (struct scroll_bar *bar, XEvent *event) 5479x_scroll_bar_expose (struct scroll_bar *bar, XEvent *event)
5486{ 5480{
5487 Window w = bar->x_window; 5481 Window w = bar->x_window;
5488 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); 5482 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
5489 GC gc = f->output_data.x->normal_gc; 5483 GC gc = f->output_data.x->normal_gc;
5490 int width_trim = VERTICAL_SCROLL_BAR_WIDTH_TRIM; 5484 int width_trim = VERTICAL_SCROLL_BAR_WIDTH_TRIM;
5491 5485
@@ -5584,7 +5578,7 @@ x_scroll_bar_handle_click (struct scroll_bar *bar, XEvent *event, struct input_e
5584static void 5578static void
5585x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event) 5579x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event)
5586{ 5580{
5587 FRAME_PTR f = XFRAME (XWINDOW (bar->window)->frame); 5581 struct frame *f = XFRAME (XWINDOW (bar->window)->frame);
5588 5582
5589 last_mouse_movement_time = event->xmotion.time; 5583 last_mouse_movement_time = event->xmotion.time;
5590 5584
@@ -5612,13 +5606,13 @@ x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event)
5612 on the scroll bar. */ 5606 on the scroll bar. */
5613 5607
5614static void 5608static void
5615x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, 5609x_scroll_bar_report_motion (struct frame **fp, Lisp_Object *bar_window,
5616 enum scroll_bar_part *part, Lisp_Object *x, 5610 enum scroll_bar_part *part, Lisp_Object *x,
5617 Lisp_Object *y, Time *timestamp) 5611 Lisp_Object *y, Time *timestamp)
5618{ 5612{
5619 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); 5613 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);
5620 Window w = bar->x_window; 5614 Window w = bar->x_window;
5621 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); 5615 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
5622 int win_x, win_y; 5616 int win_x, win_y;
5623 Window dummy_window; 5617 Window dummy_window;
5624 int dummy_coord; 5618 int dummy_coord;
@@ -5686,7 +5680,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window,
5686 redraw them. */ 5680 redraw them. */
5687 5681
5688static void 5682static void
5689x_scroll_bar_clear (FRAME_PTR f) 5683x_scroll_bar_clear (struct frame *f)
5690{ 5684{
5691#ifndef USE_TOOLKIT_SCROLL_BARS 5685#ifndef USE_TOOLKIT_SCROLL_BARS
5692 Lisp_Object bar; 5686 Lisp_Object bar;
@@ -6975,14 +6969,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6975 && event.xbutton.same_screen) 6969 && event.xbutton.same_screen)
6976 { 6970 {
6977 SET_SAVED_BUTTON_EVENT; 6971 SET_SAVED_BUTTON_EVENT;
6978 XSETFRAME (last_mouse_press_frame, f);
6979 *finish = X_EVENT_DROP; 6972 *finish = X_EVENT_DROP;
6980 } 6973 }
6981 else if (event.type == ButtonPress)
6982 {
6983 last_mouse_press_frame = Qnil;
6984 goto OTHER;
6985 }
6986 else 6974 else
6987 goto OTHER; 6975 goto OTHER;
6988#endif /* USE_X_TOOLKIT || USE_GTK */ 6976#endif /* USE_X_TOOLKIT || USE_GTK */
@@ -8537,7 +8525,7 @@ do_ewmh_fullscreen (struct frame *f)
8537} 8525}
8538 8526
8539static void 8527static void
8540XTfullscreen_hook (FRAME_PTR f) 8528XTfullscreen_hook (struct frame *f)
8541{ 8529{
8542 if (FRAME_VISIBLE_P (f)) 8530 if (FRAME_VISIBLE_P (f))
8543 { 8531 {
@@ -8938,7 +8926,7 @@ x_lower_frame (struct frame *f)
8938/* Request focus with XEmbed */ 8926/* Request focus with XEmbed */
8939 8927
8940void 8928void
8941xembed_request_focus (FRAME_PTR f) 8929xembed_request_focus (struct frame *f)
8942{ 8930{
8943 /* See XEmbed Protocol Specification at 8931 /* See XEmbed Protocol Specification at
8944 http://freedesktop.org/wiki/Specifications/xembed-spec */ 8932 http://freedesktop.org/wiki/Specifications/xembed-spec */
@@ -8950,7 +8938,7 @@ xembed_request_focus (FRAME_PTR f)
8950/* Activate frame with Extended Window Manager Hints */ 8938/* Activate frame with Extended Window Manager Hints */
8951 8939
8952void 8940void
8953x_ewmh_activate_frame (FRAME_PTR f) 8941x_ewmh_activate_frame (struct frame *f)
8954{ 8942{
8955 /* See Window Manager Specification/Extended Window Manager Hints at 8943 /* See Window Manager Specification/Extended Window Manager Hints at
8956 http://freedesktop.org/wiki/Specifications/wm-spec */ 8944 http://freedesktop.org/wiki/Specifications/wm-spec */
@@ -8968,7 +8956,7 @@ x_ewmh_activate_frame (FRAME_PTR f)
8968} 8956}
8969 8957
8970static void 8958static void
8971XTframe_raise_lower (FRAME_PTR f, int raise_flag) 8959XTframe_raise_lower (struct frame *f, int raise_flag)
8972{ 8960{
8973 if (raise_flag) 8961 if (raise_flag)
8974 x_raise_frame (f); 8962 x_raise_frame (f);
@@ -9452,6 +9440,19 @@ x_free_frame_resources (struct frame *f)
9452 unload_color (f, f->output_data.x->black_relief.pixel); 9440 unload_color (f, f->output_data.x->black_relief.pixel);
9453 9441
9454 x_free_gcs (f); 9442 x_free_gcs (f);
9443
9444 /* Free extra GCs allocated by x_setup_relief_colors. */
9445 if (f->output_data.x->white_relief.gc)
9446 {
9447 XFreeGC (dpyinfo->display, f->output_data.x->white_relief.gc);
9448 f->output_data.x->white_relief.gc = 0;
9449 }
9450 if (f->output_data.x->black_relief.gc)
9451 {
9452 XFreeGC (dpyinfo->display, f->output_data.x->black_relief.gc);
9453 f->output_data.x->black_relief.gc = 0;
9454 }
9455
9455 XFlush (FRAME_X_DISPLAY (f)); 9456 XFlush (FRAME_X_DISPLAY (f));
9456 } 9457 }
9457 9458
@@ -9817,18 +9818,11 @@ get_bits_and_offset (long unsigned int mask, int *bits, int *offset)
9817/* Return 1 if display DISPLAY is available for use, 0 otherwise. 9818/* Return 1 if display DISPLAY is available for use, 0 otherwise.
9818 But don't permanently open it, just test its availability. */ 9819 But don't permanently open it, just test its availability. */
9819 9820
9820int 9821bool
9821x_display_ok (const char *display) 9822x_display_ok (const char *display)
9822{ 9823{
9823 int dpy_ok = 1; 9824 Display *dpy = XOpenDisplay (display);
9824 Display *dpy; 9825 return dpy ? (XCloseDisplay (dpy), 1) : 0;
9825
9826 dpy = XOpenDisplay (display);
9827 if (dpy)
9828 XCloseDisplay (dpy);
9829 else
9830 dpy_ok = 0;
9831 return dpy_ok;
9832} 9826}
9833 9827
9834#ifdef USE_GTK 9828#ifdef USE_GTK
@@ -10728,9 +10722,6 @@ syms_of_xterm (void)
10728 DEFSYM (Qvendor_specific_keysyms, "vendor-specific-keysyms"); 10722 DEFSYM (Qvendor_specific_keysyms, "vendor-specific-keysyms");
10729 DEFSYM (Qlatin_1, "latin-1"); 10723 DEFSYM (Qlatin_1, "latin-1");
10730 10724
10731 staticpro (&last_mouse_press_frame);
10732 last_mouse_press_frame = Qnil;
10733
10734#ifdef USE_GTK 10725#ifdef USE_GTK
10735 xg_default_icon_file = build_pure_c_string ("icons/hicolor/scalable/apps/emacs.svg"); 10726 xg_default_icon_file = build_pure_c_string ("icons/hicolor/scalable/apps/emacs.svg");
10736 staticpro (&xg_default_icon_file); 10727 staticpro (&xg_default_icon_file);
diff --git a/src/xterm.h b/src/xterm.h
index 6bdc708220b..5324ef628e7 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -403,7 +403,7 @@ extern Lisp_Object x_display_name_list;
403extern struct x_display_info *x_display_info_for_display (Display *); 403extern struct x_display_info *x_display_info_for_display (Display *);
404 404
405extern struct x_display_info *x_term_init (Lisp_Object, char *, char *); 405extern struct x_display_info *x_term_init (Lisp_Object, char *, char *);
406extern int x_display_ok (const char *); 406extern bool x_display_ok (const char *);
407 407
408extern void select_visual (struct x_display_info *); 408extern void select_visual (struct x_display_info *);
409 409
@@ -590,7 +590,6 @@ struct x_output
590 XIC xic; 590 XIC xic;
591 XIMStyle xic_style; 591 XIMStyle xic_style;
592 XFontSet xic_xfs; 592 XFontSet xic_xfs;
593 char *xic_base_fontname;
594#endif 593#endif
595 594
596 /* Relief GCs, colors etc. */ 595 /* Relief GCs, colors etc. */
@@ -754,7 +753,6 @@ enum
754#define FRAME_X_XIM_STYLES(f) (FRAME_X_DISPLAY_INFO (f)->xim_styles) 753#define FRAME_X_XIM_STYLES(f) (FRAME_X_DISPLAY_INFO (f)->xim_styles)
755#define FRAME_XIC_STYLE(f) ((f)->output_data.x->xic_style) 754#define FRAME_XIC_STYLE(f) ((f)->output_data.x->xic_style)
756#define FRAME_XIC_FONTSET(f) ((f)->output_data.x->xic_xfs) 755#define FRAME_XIC_FONTSET(f) ((f)->output_data.x->xic_xfs)
757#define FRAME_XIC_BASE_FONTNAME(f) ((f)->output_data.x->xic_base_fontname)
758 756
759/* Value is the smallest width of any character in any font on frame F. */ 757/* Value is the smallest width of any character in any font on frame F. */
760 758
@@ -1031,8 +1029,6 @@ extern void destroy_frame_xic (struct frame *);
1031extern void xic_set_preeditarea (struct window *, int, int); 1029extern void xic_set_preeditarea (struct window *, int, int);
1032extern void xic_set_statusarea (struct frame *); 1030extern void xic_set_statusarea (struct frame *);
1033extern void xic_set_xfontset (struct frame *, const char *); 1031extern void xic_set_xfontset (struct frame *, const char *);
1034extern int x_pixel_width (struct frame *);
1035extern int x_pixel_height (struct frame *);
1036extern bool x_defined_color (struct frame *, const char *, XColor *, bool); 1032extern bool x_defined_color (struct frame *, const char *, XColor *, bool);
1037#ifdef HAVE_X_I18N 1033#ifdef HAVE_X_I18N
1038extern void free_frame_xic (struct frame *); 1034extern void free_frame_xic (struct frame *);