aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2006-03-22 15:16:06 +0000
committerKaroly Lorentey2006-03-22 15:16:06 +0000
commitd4717700cc0b7af6197c19e22bd912e3b1ed67ee (patch)
tree4e2a630584b23f670aff57a512a8f2d8182e39c4 /src
parentf1be5774242454844bf21fbf32e0f6541e2add34 (diff)
parentd63cd76657e12b92a5d7736a15bc9b97a7f9990e (diff)
downloademacs-d4717700cc0b7af6197c19e22bd912e3b1ed67ee.tar.gz
emacs-d4717700cc0b7af6197c19e22bd912e3b1ed67ee.zip
Merged from emacs@sv.gnu.org
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-160 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-161 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-162 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-163 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-164 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-165 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-166 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-167 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-168 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-169 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-170 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-171 Update from CVS: man/mh-e.texi (Folders): Various edits. * emacs@sv.gnu.org/emacs--devo--0--patch-172 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-58 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-59 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-60 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-61 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-62 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-63 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-64 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-534
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog161
-rw-r--r--src/dispextern.h3
-rw-r--r--src/dispnew.c7
-rw-r--r--src/fileio.c1
-rw-r--r--src/fringe.c16
-rw-r--r--src/image.c73
-rw-r--r--src/keymap.c1
-rw-r--r--src/m/mips.h21
-rw-r--r--src/m/pmax.h14
-rw-r--r--src/macterm.c145
-rw-r--r--src/sheap.c6
-rw-r--r--src/unexelf.c82
-rw-r--r--src/w32fns.c8
-rw-r--r--src/window.c4
-rw-r--r--src/xdisp.c49
-rw-r--r--src/xfns.c3
-rw-r--r--src/xterm.c24
-rw-r--r--src/xterm.h1
18 files changed, 536 insertions, 83 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f6edc410276..867306579ab 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,141 @@
12006-03-21 Ken Raeburn <raeburn@raeburn.org>
2
3 * xdisp.c (store_next_glyph): Renamed from append_glyph.
4 (generate_stretch_glyph): Renamed from produce_stretch_glyph.
5 All callers changed accordingly.
6
72006-03-21 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
8
9 * xterm.c: x_session_initialized new variable.
10 (x_term_init): Use x_session_initialized to check if
11 x_session_initialize should be called.
12 (x_initialize): Initialize x_session_initialized.
13
142006-03-21 Kim F. Storm <storm@cua.dk>
15
16 * fringe.c (draw_fringe_bitmap): Don't calculate default overlay arrow
17 bitmap here, but ...
18 (update_window_fringes): ... here, so we can test if it has changed.
19
202006-03-20 Andreas Schwab <schwab@suse.de>
21
22 * dispnew.c (init_display): Check DISPLAY here.
23
24 * emacs.c (main): Don't check here.
25
26 * xterm.c (x_display_ok): Don't use DISPLAY env var.
27
282006-03-20 Stefan Monnier <monnier@iro.umontreal.ca>
29
30 * window.c (window_scroll_pixel_based): Yet another int/Lisp_Object
31 mixup (YAILOM).
32
332006-03-20 Eli Zaretskii <eliz@gnu.org>
34
35 * emacs.c (main): Fix last change.
36
372006-03-20 Kenichi Handa <handa@m17n.org>
38
39 * fileio.c (Fwrite_region): Set visit_file to Qnil before GCPRO it.
40
41 * keymap.c (map_keymap): Set tail to Qnil before GCPRO it.
42
43 * xfns.c (xg_set_icon): Remove unnecessary GCPRO.
44
45 * xterm.c (x_term_init): Remove unnecessary GCPRO.
46
472006-03-19 Kim F. Storm <storm@cua.dk>
48
49 * xdisp.c (set_cursor_from_row): Fix cursor property on overlay string,
50 so it doesn't associate overlay string with following glyph by default.
51 Allow integer property value to specify explicit number of buffer
52 positions associate with overlay string.
53
542006-03-18 Chong Yidong <cyd@stupidchicken.com>
55
56 * xterm.c (x_display_ok): Fix minor bug and compilation warnings.
57
582006-03-18 Nozomu Ando <nand@mac.com>
59
60 * m/pmax.h (BROKEN_NOCOMBRELOC) [__NetBSD__]: Define.
61 (LIB_STANDARD, START_FILES) [__NetBSD__]: Don't define.
62 (START_FILES, RUN_TIME_REMAP, UNEXEC) [__NetBSD__, __OpenBSD__]:
63 Don't redefine.
64
65 * m/mips.h: Don't use unexmips on NetBSD.
66 (LIBS_MACHINE): Move definition lower, so it doesn't use
67 LD_SWITCH_MACHINE, START_FILES, LIB_STANDARD, LIBS_TERMCAP,
68 C_SWITCH_MACHINE, and C_DEBUG_SWITCH.
69
70 * unexelf.c [BROKEN_NOCOMBRELOC]: Include assert.h.
71 (unexec) [BROKEN_NOCOMBRELOC]: Handle platforms whose nocombreloc
72 option is broken (e.g., MIPS/NetBSD).
73
742006-03-18 Craig McDaniel <craigmcd@gmail.com> (tiny change)
75
76 * sheap.c (STATIC_HEAP_SIZE): Enlarge STATIC_HEAP_SIZE to 12MB.
77 Remove the HAVE_X_WINDOWS conditional.
78
792006-03-18 Vivek Dasmohapatra <vivek@etla.org> (tiny change)
80
81 * emacs.c (main): If user asks for a display that is unavailable,
82 simulate -nw.
83
84 * xterm.c (x_display_ok): New function.
85
86 * xterm.h: Add prototype for x_display_ok.
87
882006-03-18 Eli Zaretskii <eliz@gnu.org>
89
90 * w32fns.c (Fw32_select_font): Doc fix.
91
922006-03-16 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
93
94 * image.c [MAC_OS] (XPutPixel, XGetPixel)
95 [!WORDS_BIG_ENDIAN && USE_CG_DRAWING]: Don't use specialized
96 version when depth is 32.
97 (mac_create_cg_image_from_image) [MAC_OS && USE_CG_DRAWING]:
98 New function.
99 (prepare_image_for_display) [MAC_OS && USE_CG_DRAWING]: Use it.
100 (x_clear_image_1) [MAC_OS && USE_CG_DRAWING]: Release CGImage.
101
102 * macterm.c (XCreatePixmap) [!WORDS_BIG_ENDIAN && USE_CG_DRAWING]:
103 Create GWorld in ARGB pixel format.
104 (mac_copy_area, mac_copy_area_with_mask) [USE_CG_DRAWING]:
105 Remove functions.
106 (x_draw_image_foreground) [USE_CG_DRAWING]: Use mac_draw_cg_image
107 instead of mac_copy_area/mac_copy_area_with_mask.
108
1092006-03-15 Kim F. Storm <storm@cua.dk>
110
111 * xdisp.c (extend_face_to_end_of_line): Always add space glyph to
112 empty row. Fixes memory corruption revealed by 2006-03-02 change.
113 (display_tool_bar_line): Skip empty tool-bar line if HEIGHT < 0.
114 (tool_bar_lines_needed): Fix tool-bar display in case the tool-bar
115 width is exactly the same as the window width. Don't count a final
116 empty tool-bar line (pass HEIGHT = -1 to display_tool_bar_line).
117
1182006-03-15 Juanma Barranquero <lekktu@gmail.com>
119
120 * fringe.c (w32_init_fringe, w32_reset_fringes): Revert to being
121 conditional on HAVE_NTGUI, not WINDOWS_NT.
122
1232006-03-15 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
124
125 * dispextern.h (mac_init_fringe) [MAC_OS]: Add prototype.
126
127 * fringe.c (mac_init_fringe) [MAC_OS]: New function.
128
129 * macterm.c (mac_initialize) [USE_CG_DRAWING]: Call mac_init_fringe.
130 (max_fringe_bmp, fringe_bmp) [USE_CG_DRAWING]: New variables.
131 (mac_define_fringe_bitmap, mac_destroy_fringe_bitmap)
132 (mac_draw_cg_image) [USE_CG_DRAWING]: New functions.
133 (mac_draw_bitmap) [USE_CG_DRAWING]: Remove function.
134 (x_draw_fringe_bitmap) [USE_CG_DRAWING]: Use mac_draw_cg_image
135 instead of mac_draw_bitmap.
136 (x_redisplay_interface) [USE_CG_DRAWING]: Set handlers for
137 define_fringe_bitmap and destroy_fringe_bitmap.
138
12006-03-14 Chong Yidong <cyd@stupidchicken.com> 1392006-03-14 Chong Yidong <cyd@stupidchicken.com>
2 140
3 * xterm.c (x_uncatch_errors): Block input for entire function. 141 * xterm.c (x_uncatch_errors): Block input for entire function.
@@ -5,7 +143,7 @@
52006-03-12 Jason Rumney <jasonr@gnu.org> 1432006-03-12 Jason Rumney <jasonr@gnu.org>
6 144
7 * w32fns.c (Fx_create_frame): Remove call to 145 * w32fns.c (Fx_create_frame): Remove call to
8 Qface_set_after_frame_default. (from xfns.c 2003-05-26) 146 Qface_set_after_frame_default (from xfns.c 2003-05-26).
9 147
10 * w32menu.c (Fx_popup_menu): Call w32_free_menu_strings when 148 * w32menu.c (Fx_popup_menu): Call w32_free_menu_strings when
11 finished with the menu. 149 finished with the menu.
@@ -15,7 +153,7 @@
15 (note_mouse_movement): Say mouse moved if current frame differs 153 (note_mouse_movement): Say mouse moved if current frame differs
16 from last_mouse_glyph_frame, and update last_mouse_glyph_frame. 154 from last_mouse_glyph_frame, and update last_mouse_glyph_frame.
17 (w32_mouse_position): Set last_mouse_glyph_frame. 155 (w32_mouse_position): Set last_mouse_glyph_frame.
18 Remove OLD_REDISPLAY_CODE block. 156 Remove OLD_REDISPLAY_CODE block.
19 157
202006-03-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 1582006-03-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
21 159
@@ -68,8 +206,7 @@
68 206
692006-03-11 David Ponce <david@dponce.com> 2072006-03-11 David Ponce <david@dponce.com>
70 208
71 * xfns.c (x_create_tip_frame): Preserve received parms by copying 209 * xfns.c (x_create_tip_frame): Preserve received parms by copying them.
72 them.
73 210
742006-03-11 Eli Zaretskii <eliz@gnu.org> 2112006-03-11 Eli Zaretskii <eliz@gnu.org>
75 212
@@ -90,14 +227,14 @@
90 * keymap.c (describe_map): Shorten string to indicate shadowed binding. 227 * keymap.c (describe_map): Shorten string to indicate shadowed binding.
91 228
92 * vm-limit.c (get_lim_data, lim_data, data_space_start): 229 * vm-limit.c (get_lim_data, lim_data, data_space_start):
93 Moved from mem-limits.h. 230 Move from mem-limits.h.
94 (enum warnlevel): New data type. 231 (enum warnlevel): New data type.
95 (check_memory_limits): Rewrite the logic about warnings. 232 (check_memory_limits): Rewrite the logic about warnings.
96 Use standard `struct rlimit'. Check return values for nonsense. 233 Use standard `struct rlimit'. Check return values for nonsense.
97 (memory_warnings): Always clear lim_data. 234 (memory_warnings): Always clear lim_data.
98 235
99 * mem-limits.h (get_lim_data, lim_data, data_space_start): 236 * mem-limits.h (get_lim_data, lim_data, data_space_start):
100 Moved to vm-limit.c. 237 Move to vm-limit.c.
101 238
102 * xterm.c (x_fully_uncatch_errors, x_catching_errors): New functions. 239 * xterm.c (x_fully_uncatch_errors, x_catching_errors): New functions.
103 240
@@ -193,7 +330,7 @@
193 330
194 * xdisp.c: Minimize the unpleasent visual impact of the requirement 331 * xdisp.c: Minimize the unpleasent visual impact of the requirement
195 that non-toolkit tool-bars must occupy an integral number of screen 332 that non-toolkit tool-bars must occupy an integral number of screen
196 lines, by distributing the rows evenly over the tool-bar screen area. 333 lines, by distributing the rows evenly over the tool-bar screen area.
197 (Vtool_bar_border): New variable. 334 (Vtool_bar_border): New variable.
198 (syms_of_xdisp): DEFVAR_LISP it. 335 (syms_of_xdisp): DEFVAR_LISP it.
199 (display_tool_bar_line): Add HEIGHT arg for desired row height. 336 (display_tool_bar_line): Add HEIGHT arg for desired row height.
@@ -227,9 +364,9 @@
227 364
228 * xterm.h, xterm.c (x_uncatch_errors): Delete unneccessary argument. 365 * xterm.h, xterm.c (x_uncatch_errors): Delete unneccessary argument.
229 366
230 * xterm.c: (x_load_font, x_term_init, XTmouse_position) 367 * xterm.c (x_load_font, x_term_init, XTmouse_position)
231 (handle_one_xevent, x_connection_closed, x_list_fonts): No arg for 368 (handle_one_xevent, x_connection_closed, x_list_fonts):
232 x_uncatch_errors. 369 No arg for x_uncatch_errors.
233 370
234 * xselect.c (x_own_selection, x_decline_selection_request) 371 * xselect.c (x_own_selection, x_decline_selection_request)
235 (x_reply_selection_request, x_get_foreign_selection) 372 (x_reply_selection_request, x_get_foreign_selection)
@@ -357,7 +494,7 @@
357 494
358 * fringe.c (syms_of_fringe) <fringe-bitmaps>: Doc fix. 495 * fringe.c (syms_of_fringe) <fringe-bitmaps>: Doc fix.
359 496
3602006-02-21 Zhang Wei <brep@newsmth.org> 4972006-02-21 Zhang Wei <brep@newsmth.org>
361 498
362 * xfns.c (Fx_file_dialog, Motif and GTK): DECODE_FILE before 499 * xfns.c (Fx_file_dialog, Motif and GTK): DECODE_FILE before
363 returning it. 500 returning it.
@@ -426,7 +563,7 @@
426 (draw_fringe_bitmap_1): Make static. 563 (draw_fringe_bitmap_1): Make static.
427 (get_logical_cursor_bitmap, get_logical_fringe_bitmap): New functions 564 (get_logical_cursor_bitmap, get_logical_fringe_bitmap): New functions
428 to map from logical cursors and indicators to physical bitmaps. 565 to map from logical cursors and indicators to physical bitmaps.
429 (draw_fringe_bitmap): Resolve fringe cursor and overlay-arrow 566 (draw_fringe_bitmap): Resolve fringe cursor and overlay-arrow
430 bitmaps using symbol names instead of bitmap numbers. 567 bitmaps using symbol names instead of bitmap numbers.
431 (update_window_fringes): Use logical indicator symbol names 568 (update_window_fringes): Use logical indicator symbol names
432 instead of bitmap numbers for logical. Add bitmap cache. 569 instead of bitmap numbers for logical. Add bitmap cache.
diff --git a/src/dispextern.h b/src/dispextern.h
index 66ec02d724a..157f49dea6d 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2722,6 +2722,9 @@ void compute_fringe_widths P_ ((struct frame *, int));
2722void w32_init_fringe P_ ((void)); 2722void w32_init_fringe P_ ((void));
2723void w32_reset_fringes P_ ((void)); 2723void w32_reset_fringes P_ ((void));
2724#endif 2724#endif
2725#ifdef MAC_OS
2726void mac_init_fringe P_ ((void));
2727#endif
2725 2728
2726/* Defined in image.c */ 2729/* Defined in image.c */
2727 2730
diff --git a/src/dispnew.c b/src/dispnew.c
index 5f3c8eacc3d..296dbece477 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -6705,6 +6705,13 @@ init_display ()
6705#endif 6705#endif
6706 6706
6707 display_arg = (display != 0 && *display != 0); 6707 display_arg = (display != 0 && *display != 0);
6708
6709 if (display_arg && !x_display_ok (display))
6710 {
6711 fprintf (stderr, "Display %s unavailable, simulating -nw\n",
6712 display);
6713 inhibit_window_system = 1;
6714 }
6708 } 6715 }
6709 6716
6710 if (!inhibit_window_system && display_arg 6717 if (!inhibit_window_system && display_arg
diff --git a/src/fileio.c b/src/fileio.c
index e27f87bcbcf..2248963102a 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5011,6 +5011,7 @@ This does code conversion according to the value of
5011 if (!NILP (start) && !STRINGP (start)) 5011 if (!NILP (start) && !STRINGP (start))
5012 validate_region (&start, &end); 5012 validate_region (&start, &end);
5013 5013
5014 visit_file = Qnil;
5014 GCPRO5 (start, filename, visit, visit_file, lockname); 5015 GCPRO5 (start, filename, visit, visit_file, lockname);
5015 5016
5016 filename = Fexpand_file_name (filename, Qnil); 5017 filename = Fexpand_file_name (filename, Qnil);
diff --git a/src/fringe.c b/src/fringe.c
index 721b572e373..4b8ac34fe09 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -867,10 +867,7 @@ draw_fringe_bitmap (w, row, left_p)
867 draw_fringe_bitmap_1 (w, row, left_p, overlay, NO_FRINGE_BITMAP); 867 draw_fringe_bitmap_1 (w, row, left_p, overlay, NO_FRINGE_BITMAP);
868 868
869 if (left_p && row->overlay_arrow_bitmap != NO_FRINGE_BITMAP) 869 if (left_p && row->overlay_arrow_bitmap != NO_FRINGE_BITMAP)
870 draw_fringe_bitmap_1 (w, row, 1, 1, 870 draw_fringe_bitmap_1 (w, row, 1, 1, row->overlay_arrow_bitmap);
871 (row->overlay_arrow_bitmap < 0
872 ? get_logical_fringe_bitmap (w, Qoverlay_arrow, 0, 0)
873 : row->overlay_arrow_bitmap));
874} 871}
875 872
876 873
@@ -1152,6 +1149,9 @@ update_window_fringes (w, keep_current_p)
1152 } 1149 }
1153 } 1150 }
1154 1151
1152 if (row->overlay_arrow_bitmap < 0)
1153 row->overlay_arrow_bitmap = get_logical_fringe_bitmap (w, Qoverlay_arrow, 0, 0);
1154
1155 if (row->overlay_arrow_bitmap != cur->overlay_arrow_bitmap) 1155 if (row->overlay_arrow_bitmap != cur->overlay_arrow_bitmap)
1156 { 1156 {
1157 redraw_p = row->redraw_fringe_bitmaps_p = cur->redraw_fringe_bitmaps_p = 1; 1157 redraw_p = row->redraw_fringe_bitmaps_p = cur->redraw_fringe_bitmaps_p = 1;
@@ -1695,10 +1695,14 @@ init_fringe ()
1695 } 1695 }
1696} 1696}
1697 1697
1698#ifdef HAVE_NTGUI 1698#if defined (HAVE_NTGUI) || defined (MAC_OS)
1699 1699
1700void 1700void
1701#ifdef HAVE_NTGUI
1701w32_init_fringe () 1702w32_init_fringe ()
1703#else /* MAC_OS */
1704mac_init_fringe ()
1705#endif
1702{ 1706{
1703 int bt; 1707 int bt;
1704 1708
@@ -1711,7 +1715,9 @@ w32_init_fringe ()
1711 rif->define_fringe_bitmap (bt, fb->bits, fb->height, fb->width); 1715 rif->define_fringe_bitmap (bt, fb->bits, fb->height, fb->width);
1712 } 1716 }
1713} 1717}
1718#endif
1714 1719
1720#ifdef HAVE_NTGUI
1715void 1721void
1716w32_reset_fringes () 1722w32_reset_fringes ()
1717{ 1723{
diff --git a/src/image.c b/src/image.c
index ba78a835ef3..8e3a0afe91a 100644
--- a/src/image.c
+++ b/src/image.c
@@ -189,6 +189,7 @@ XPutPixel (ximage, x, y, pixel)
189 PixMapHandle pixmap = GetGWorldPixMap (ximage); 189 PixMapHandle pixmap = GetGWorldPixMap (ximage);
190 short depth = GetPixDepth (pixmap); 190 short depth = GetPixDepth (pixmap);
191 191
192#if defined (WORDS_BIG_ENDIAN) || !USE_CG_DRAWING
192 if (depth == 32) 193 if (depth == 32)
193 { 194 {
194 char *base_addr = GetPixBaseAddr (pixmap); 195 char *base_addr = GetPixBaseAddr (pixmap);
@@ -196,7 +197,9 @@ XPutPixel (ximage, x, y, pixel)
196 197
197 ((unsigned long *) (base_addr + y * row_bytes))[x] = 0xff000000 | pixel; 198 ((unsigned long *) (base_addr + y * row_bytes))[x] = 0xff000000 | pixel;
198 } 199 }
199 else if (depth == 1) 200 else
201#endif
202 if (depth == 1)
200 { 203 {
201 char *base_addr = GetPixBaseAddr (pixmap); 204 char *base_addr = GetPixBaseAddr (pixmap);
202 short row_bytes = GetPixRowBytes (pixmap); 205 short row_bytes = GetPixRowBytes (pixmap);
@@ -233,6 +236,7 @@ XGetPixel (ximage, x, y)
233 PixMapHandle pixmap = GetGWorldPixMap (ximage); 236 PixMapHandle pixmap = GetGWorldPixMap (ximage);
234 short depth = GetPixDepth (pixmap); 237 short depth = GetPixDepth (pixmap);
235 238
239#if defined (WORDS_BIG_ENDIAN) || !USE_CG_DRAWING
236 if (depth == 32) 240 if (depth == 32)
237 { 241 {
238 char *base_addr = GetPixBaseAddr (pixmap); 242 char *base_addr = GetPixBaseAddr (pixmap);
@@ -240,7 +244,9 @@ XGetPixel (ximage, x, y)
240 244
241 return ((unsigned long *) (base_addr + y * row_bytes))[x] & 0x00ffffff; 245 return ((unsigned long *) (base_addr + y * row_bytes))[x] & 0x00ffffff;
242 } 246 }
243 else if (depth == 1) 247 else
248#endif
249 if (depth == 1)
244 { 250 {
245 char *base_addr = GetPixBaseAddr (pixmap); 251 char *base_addr = GetPixBaseAddr (pixmap);
246 short row_bytes = GetPixRowBytes (pixmap); 252 short row_bytes = GetPixRowBytes (pixmap);
@@ -272,6 +278,49 @@ XDestroyImage (ximg)
272{ 278{
273 UnlockPixels (GetGWorldPixMap (ximg)); 279 UnlockPixels (GetGWorldPixMap (ximg));
274} 280}
281
282#if USE_CG_DRAWING
283static CGImageRef
284mac_create_cg_image_from_image (f, img)
285 struct frame *f;
286 struct image *img;
287{
288 Pixmap mask;
289 CGImageRef result = NULL;
290
291 BLOCK_INPUT;
292 if (img->mask)
293 mask = img->mask;
294 else
295 {
296 mask = XCreatePixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
297 img->width, img->height, 1);
298 if (mask)
299 {
300 CGrafPtr old_port;
301 GDHandle old_gdh;
302 Rect r;
303
304 GetGWorld (&old_port, &old_gdh);
305 SetGWorld (mask, NULL);
306 BackColor (blackColor); /* Don't mask. */
307 SetRect (&r, 0, 0, img->width, img->height);
308 EraseRect (&r);
309 SetGWorld (old_port, old_gdh);
310 }
311 }
312 if (mask)
313 {
314 CreateCGImageFromPixMaps (GetGWorldPixMap (img->pixmap),
315 GetGWorldPixMap (mask), &result);
316 if (mask != img->mask)
317 XFreePixmap (FRAME_X_DISPLAY (f), mask);
318 }
319 UNBLOCK_INPUT;
320
321 return result;
322}
323#endif /* USE_CG_DRAWING */
275#endif /* MAC_OS */ 324#endif /* MAC_OS */
276 325
277 326
@@ -1206,6 +1255,18 @@ prepare_image_for_display (f, img)
1206 type dependent loader function. */ 1255 type dependent loader function. */
1207 if (img->pixmap == NO_PIXMAP && !img->load_failed_p) 1256 if (img->pixmap == NO_PIXMAP && !img->load_failed_p)
1208 img->load_failed_p = img->type->load (f, img) == 0; 1257 img->load_failed_p = img->type->load (f, img) == 0;
1258
1259#if defined (MAC_OS) && USE_CG_DRAWING
1260 if (!img->load_failed_p && img->data.ptr_val == NULL)
1261 {
1262 img->data.ptr_val = mac_create_cg_image_from_image (f, img);
1263 if (img->data.ptr_val == NULL)
1264 {
1265 img->load_failed_p = 1;
1266 img->type->free (f, img);
1267 }
1268 }
1269#endif
1209} 1270}
1210 1271
1211 1272
@@ -1452,6 +1513,14 @@ x_clear_image_1 (f, img, pixmap_p, mask_p, colors_p)
1452 img->colors = NULL; 1513 img->colors = NULL;
1453 img->ncolors = 0; 1514 img->ncolors = 0;
1454 } 1515 }
1516
1517#if defined (MAC_OS) && USE_CG_DRAWING
1518 if (img->data.ptr_val)
1519 {
1520 CGImageRelease (img->data.ptr_val);
1521 img->data.ptr_val = NULL;
1522 }
1523#endif
1455} 1524}
1456 1525
1457/* Free X resources of image IMG which is used on frame F. */ 1526/* Free X resources of image IMG which is used on frame F. */
diff --git a/src/keymap.c b/src/keymap.c
index fc7b23f6302..92c67ed1f1a 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -692,6 +692,7 @@ map_keymap (map, fun, args, data, autoload)
692 struct gcpro gcpro1, gcpro2, gcpro3; 692 struct gcpro gcpro1, gcpro2, gcpro3;
693 Lisp_Object tail; 693 Lisp_Object tail;
694 694
695 tail = Qnil;
695 GCPRO3 (map, args, tail); 696 GCPRO3 (map, args, tail);
696 map = get_keymap (map, 1, autoload); 697 map = get_keymap (map, 1, autoload);
697 for (tail = (CONSP (map) && EQ (Qkeymap, XCAR (map))) ? XCDR (map) : map; 698 for (tail = (CONSP (map) && EQ (Qkeymap, XCAR (map))) ? XCDR (map) : map;
diff --git a/src/m/mips.h b/src/m/mips.h
index dc45a99d06b..9ae74178143 100644
--- a/src/m/mips.h
+++ b/src/m/mips.h
@@ -112,10 +112,10 @@ NOTE-END */
112/* This machine requires completely different unexec code 112/* This machine requires completely different unexec code
113 which lives in a separate file. Specify the file name. */ 113 which lives in a separate file. Specify the file name. */
114 114
115#ifndef __linux__ 115#if !defined(__linux__) && !defined(__NetBSD__)
116#undef UNEXEC 116#undef UNEXEC
117#define UNEXEC unexmips.o 117#define UNEXEC unexmips.o
118#endif /* not __linux__ */ 118#endif /* not __linux__ && not __NetBSD__ */
119 119
120/* Describe layout of the address space in an executing process. */ 120/* Describe layout of the address space in an executing process. */
121 121
@@ -142,14 +142,6 @@ NOTE-END */
142#if defined (__NetBSD__) || defined (__OpenBSD__) 142#if defined (__NetBSD__) || defined (__OpenBSD__)
143#else /* bsd with elf */ 143#else /* bsd with elf */
144#define LINKER /bsd43/bin/ld 144#define LINKER /bsd43/bin/ld
145#endif /* bsd with elf */
146#else /* not BSD_SYSTEM */
147
148#if defined(__GNUC__) && defined(_ABIN32)
149#define LIBS_MACHINE
150#else
151#define LIBS_MACHINE -lmld
152#endif
153 145
154#define LD_SWITCH_MACHINE -D 800000 -g3 146#define LD_SWITCH_MACHINE -D 800000 -g3
155#define START_FILES pre-crt0.o /usr/lib/crt1.o 147#define START_FILES pre-crt0.o /usr/lib/crt1.o
@@ -159,6 +151,15 @@ NOTE-END */
159#define C_SWITCH_MACHINE -I/usr/include/bsd 151#define C_SWITCH_MACHINE -I/usr/include/bsd
160#define C_DEBUG_SWITCH -O -g3 152#define C_DEBUG_SWITCH -O -g3
161 153
154#endif /* bsd with elf */
155#else /* not BSD_SYSTEM */
156
157#if defined(__GNUC__) && defined(_ABIN32)
158#define LIBS_MACHINE
159#else
160#define LIBS_MACHINE -lmld
161#endif
162
162#endif /* not BSD_SYSTEM */ 163#endif /* not BSD_SYSTEM */
163#endif /* not NEWSOS5 && not __linux__ */ 164#endif /* not NEWSOS5 && not __linux__ */
164 165
diff --git a/src/m/pmax.h b/src/m/pmax.h
index 911f84d3c8a..c83c514ab98 100644
--- a/src/m/pmax.h
+++ b/src/m/pmax.h
@@ -13,8 +13,12 @@ NOTE-END */
13#ifndef __MIPSEB__ 13#ifndef __MIPSEB__
14#undef WORDS_BIG_ENDIAN 14#undef WORDS_BIG_ENDIAN
15#endif 15#endif
16#if defined (__NetBSD__)
17#define BROKEN_NOCOMBRELOC
18#else
16#undef LIB_STANDARD 19#undef LIB_STANDARD
17#undef START_FILES 20#undef START_FILES
21#endif
18#undef COFF 22#undef COFF
19#undef TERMINFO 23#undef TERMINFO
20#define MAIL_USE_FLOCK 24#define MAIL_USE_FLOCK
@@ -24,18 +28,12 @@ NOTE-END */
24#ifdef MACH 28#ifdef MACH
25#define START_FILES pre-crt0.o /usr/lib/crt0.o 29#define START_FILES pre-crt0.o /usr/lib/crt0.o
26#else 30#else
31#if !defined (__NetBSD__)
27/* This line starts being needed with ultrix 4.0. */ 32/* This line starts being needed with ultrix 4.0. */
28/* You must delete it for version 3.1. */ 33/* You must delete it for version 3.1. */
29#define START_FILES pre-crt0.o /usr/lib/cmplrs/cc/crt0.o 34#define START_FILES pre-crt0.o /usr/lib/cmplrs/cc/crt0.o
30#endif 35#endif
31 36#endif
32#if defined (__NetBSD__) || defined (__OpenBSD__)
33#undef START_FILES
34#define START_FILES pre-crt0.o /usr/lib/crt0.o
35#undef RUN_TIME_REMAP
36#undef UNEXEC
37#define UNEXEC unexelf.o
38#endif /* NetBSD || OpenBSD */
39 37
40/* Supposedly the following will overcome a kernel bug. */ 38/* Supposedly the following will overcome a kernel bug. */
41#undef LD_SWITCH_MACHINE 39#undef LD_SWITCH_MACHINE
diff --git a/src/macterm.c b/src/macterm.c
index d3510dbf516..a51304f21da 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -281,6 +281,11 @@ extern void menubar_selection_callback (FRAME_PTR, int);
281#if USE_CG_DRAWING 281#if USE_CG_DRAWING
282#define FRAME_CG_CONTEXT(f) ((f)->output_data.mac->cg_context) 282#define FRAME_CG_CONTEXT(f) ((f)->output_data.mac->cg_context)
283 283
284/* Fringe bitmaps. */
285
286static int max_fringe_bmp = 0;
287static CGImageRef *fringe_bmp = 0;
288
284static CGContextRef 289static CGContextRef
285mac_begin_cg_clip (f, gc) 290mac_begin_cg_clip (f, gc)
286 struct frame *f; 291 struct frame *f;
@@ -509,6 +514,44 @@ mac_clear_window (f)
509 514
510/* Mac replacement for XCopyArea. */ 515/* Mac replacement for XCopyArea. */
511 516
517#if USE_CG_DRAWING
518static void
519mac_draw_cg_image (image, f, gc, src_x, src_y, width, height,
520 dest_x, dest_y, overlay_p)
521 CGImageRef image;
522 struct frame *f;
523 GC gc;
524 int src_x, src_y;
525 unsigned int width, height;
526 int dest_x, dest_y, overlay_p;
527{
528 CGContextRef context;
529 float port_height = FRAME_PIXEL_HEIGHT (f);
530 CGRect dest_rect = CGRectMake (dest_x, dest_y, width, height);
531
532 context = mac_begin_cg_clip (f, gc);
533 if (!overlay_p)
534 {
535 CG_SET_FILL_COLOR (context, gc->xgcv.background);
536 CGContextFillRect (context, dest_rect);
537 }
538 CGContextClipToRect (context, dest_rect);
539 CGContextScaleCTM (context, 1, -1);
540 CGContextTranslateCTM (context, 0, -port_height);
541 if (CGImageIsMask (image))
542 CG_SET_FILL_COLOR (context, gc->xgcv.foreground);
543 CGContextDrawImage (context,
544 CGRectMake (dest_x - src_x,
545 port_height - (dest_y - src_y
546 + CGImageGetHeight (image)),
547 CGImageGetWidth (image),
548 CGImageGetHeight (image)),
549 image);
550 mac_end_cg_clip (f);
551}
552
553#else /* !USE_CG_DRAWING */
554
512static void 555static void
513mac_draw_bitmap (f, gc, x, y, width, height, bits, overlay_p) 556mac_draw_bitmap (f, gc, x, y, width, height, bits, overlay_p)
514 struct frame *f; 557 struct frame *f;
@@ -524,9 +567,6 @@ mac_draw_bitmap (f, gc, x, y, width, height, bits, overlay_p)
524 bitmap.baseAddr = (char *)bits; 567 bitmap.baseAddr = (char *)bits;
525 SetRect (&(bitmap.bounds), 0, 0, width, height); 568 SetRect (&(bitmap.bounds), 0, 0, width, height);
526 569
527#if USE_CG_DRAWING
528 mac_prepare_for_quickdraw (f);
529#endif
530 SetPortWindowPort (FRAME_MAC_WINDOW (f)); 570 SetPortWindowPort (FRAME_MAC_WINDOW (f));
531 571
532 RGBForeColor (GC_FORE_COLOR (gc)); 572 RGBForeColor (GC_FORE_COLOR (gc));
@@ -552,6 +592,7 @@ mac_draw_bitmap (f, gc, x, y, width, height, bits, overlay_p)
552 592
553 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); 593 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
554} 594}
595#endif /* !USE_CG_DRAWING */
555 596
556 597
557/* Mac replacement for XCreateBitmapFromBitmapData. */ 598/* Mac replacement for XCreateBitmapFromBitmapData. */
@@ -612,7 +653,15 @@ XCreatePixmap (display, w, width, height, depth)
612 SetPortWindowPort (w); 653 SetPortWindowPort (w);
613 654
614 SetRect (&r, 0, 0, width, height); 655 SetRect (&r, 0, 0, width, height);
615 err = NewGWorld (&pixmap, depth, &r, NULL, NULL, 0); 656#if !defined (WORDS_BIG_ENDIAN) && USE_CG_DRAWING
657 if (depth == 1)
658#endif
659 err = NewGWorld (&pixmap, depth, &r, NULL, NULL, 0);
660#if !defined (WORDS_BIG_ENDIAN) && USE_CG_DRAWING
661 else
662 /* CreateCGImageFromPixMaps requires ARGB format. */
663 err = QTNewGWorld (&pixmap, k32ARGBPixelFormat, &r, NULL, NULL, 0);
664#endif
616 if (err != noErr) 665 if (err != noErr)
617 return NULL; 666 return NULL;
618 return pixmap; 667 return pixmap;
@@ -1295,6 +1344,7 @@ mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width)
1295#endif 1344#endif
1296 1345
1297 1346
1347#if !USE_CG_DRAWING
1298/* Mac replacement for XCopyArea: dest must be window. */ 1348/* Mac replacement for XCopyArea: dest must be window. */
1299 1349
1300static void 1350static void
@@ -1308,9 +1358,6 @@ mac_copy_area (src, f, gc, src_x, src_y, width, height, dest_x, dest_y)
1308{ 1358{
1309 Rect src_r, dest_r; 1359 Rect src_r, dest_r;
1310 1360
1311#if USE_CG_DRAWING
1312 mac_prepare_for_quickdraw (f);
1313#endif
1314 SetPortWindowPort (FRAME_MAC_WINDOW (f)); 1361 SetPortWindowPort (FRAME_MAC_WINDOW (f));
1315 1362
1316 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height); 1363 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
@@ -1355,9 +1402,6 @@ mac_copy_area_with_mask (src, mask, f, gc, src_x, src_y,
1355{ 1402{
1356 Rect src_r, dest_r; 1403 Rect src_r, dest_r;
1357 1404
1358#if USE_CG_DRAWING
1359 mac_prepare_for_quickdraw (f);
1360#endif
1361 SetPortWindowPort (FRAME_MAC_WINDOW (f)); 1405 SetPortWindowPort (FRAME_MAC_WINDOW (f));
1362 1406
1363 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height); 1407 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
@@ -1390,6 +1434,7 @@ mac_copy_area_with_mask (src, mask, f, gc, src_x, src_y,
1390 1434
1391 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); 1435 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
1392} 1436}
1437#endif /* !USE_CG_DRAWING */
1393 1438
1394 1439
1395/* Mac replacement for XCopyArea: used only for scrolling. */ 1440/* Mac replacement for XCopyArea: used only for scrolling. */
@@ -2001,9 +2046,12 @@ x_draw_fringe_bitmap (w, row, p)
2001#endif 2046#endif
2002 } 2047 }
2003 2048
2004 if (p->which) 2049 if (p->which
2050#if USE_CG_DRAWING
2051 && p->which < max_fringe_bmp
2052#endif
2053 )
2005 { 2054 {
2006 unsigned short *bits = p->bits + p->dh;
2007 XGCValues gcv; 2055 XGCValues gcv;
2008 2056
2009 XGetGCValues (display, face->gc, GCForeground, &gcv); 2057 XGetGCValues (display, face->gc, GCForeground, &gcv);
@@ -2012,14 +2060,64 @@ x_draw_fringe_bitmap (w, row, p)
2012 ? (p->overlay_p ? face->background 2060 ? (p->overlay_p ? face->background
2013 : f->output_data.mac->cursor_pixel) 2061 : f->output_data.mac->cursor_pixel)
2014 : face->foreground)); 2062 : face->foreground));
2063#if USE_CG_DRAWING
2064 mac_draw_cg_image (fringe_bmp[p->which], f, face->gc, 0, p->dh,
2065 p->wd, p->h, p->x, p->y, p->overlay_p);
2066#else
2015 mac_draw_bitmap (f, face->gc, p->x, p->y, 2067 mac_draw_bitmap (f, face->gc, p->x, p->y,
2016 p->wd, p->h, bits, p->overlay_p); 2068 p->wd, p->h, p->bits + p->dh, p->overlay_p);
2069#endif
2017 XSetForeground (display, face->gc, gcv.foreground); 2070 XSetForeground (display, face->gc, gcv.foreground);
2018 } 2071 }
2019 2072
2020 mac_reset_clip_rectangles (display, face->gc); 2073 mac_reset_clip_rectangles (display, face->gc);
2021} 2074}
2022 2075
2076#if USE_CG_DRAWING
2077static void
2078mac_define_fringe_bitmap (which, bits, h, wd)
2079 int which;
2080 unsigned short *bits;
2081 int h, wd;
2082{
2083 unsigned short *mask_bits;
2084 int i;
2085 CGDataProviderRef provider;
2086
2087 if (which >= max_fringe_bmp)
2088 {
2089 i = max_fringe_bmp;
2090 max_fringe_bmp = which + 20;
2091 fringe_bmp = (CGImageRef *) xrealloc (fringe_bmp, max_fringe_bmp * sizeof (CGImageRef));
2092 while (i < max_fringe_bmp)
2093 fringe_bmp[i++] = 0;
2094 }
2095
2096 for (i = 0; i < h; i++)
2097 bits[i] = ~bits[i];
2098 provider = CGDataProviderCreateWithData (NULL, bits,
2099 sizeof (unsigned short) * h, NULL);
2100 if (provider)
2101 {
2102 fringe_bmp[which] = CGImageMaskCreate (wd, h, 1, 1,
2103 sizeof (unsigned short),
2104 provider, NULL, 0);
2105 CGDataProviderRelease (provider);
2106 }
2107}
2108
2109static void
2110mac_destroy_fringe_bitmap (which)
2111 int which;
2112{
2113 if (which >= max_fringe_bmp)
2114 return;
2115
2116 if (fringe_bmp[which])
2117 CGImageRelease (fringe_bmp[which]);
2118 fringe_bmp[which] = 0;
2119}
2120#endif
2023 2121
2024 2122
2025/* This is called when starting Emacs and when restarting after 2123/* This is called when starting Emacs and when restarting after
@@ -3191,15 +3289,26 @@ x_draw_image_foreground (s)
3191 { 3289 {
3192 x_set_glyph_string_clipping (s); 3290 x_set_glyph_string_clipping (s);
3193 3291
3292#if USE_CG_DRAWING
3293 mac_draw_cg_image (s->img->data.ptr_val,
3294 s->f, s->gc, s->slice.x, s->slice.y,
3295 s->slice.width, s->slice.height, x, y, 1);
3296#endif
3194 if (s->img->mask) 3297 if (s->img->mask)
3298#if !USE_CG_DRAWING
3195 mac_copy_area_with_mask (s->img->pixmap, s->img->mask, 3299 mac_copy_area_with_mask (s->img->pixmap, s->img->mask,
3196 s->f, s->gc, s->slice.x, s->slice.y, 3300 s->f, s->gc, s->slice.x, s->slice.y,
3197 s->slice.width, s->slice.height, x, y); 3301 s->slice.width, s->slice.height, x, y);
3302#else
3303 ;
3304#endif
3198 else 3305 else
3199 { 3306 {
3307#if !USE_CG_DRAWING
3200 mac_copy_area (s->img->pixmap, 3308 mac_copy_area (s->img->pixmap,
3201 s->f, s->gc, s->slice.x, s->slice.y, 3309 s->f, s->gc, s->slice.x, s->slice.y,
3202 s->slice.width, s->slice.height, x, y); 3310 s->slice.width, s->slice.height, x, y);
3311#endif
3203 3312
3204 /* When the image has a mask, we can expect that at 3313 /* When the image has a mask, we can expect that at
3205 least part of a mouse highlight or a block cursor will 3314 least part of a mouse highlight or a block cursor will
@@ -10892,8 +11001,13 @@ static struct redisplay_interface x_redisplay_interface =
10892 x_get_glyph_overhangs, 11001 x_get_glyph_overhangs,
10893 x_fix_overlapping_area, 11002 x_fix_overlapping_area,
10894 x_draw_fringe_bitmap, 11003 x_draw_fringe_bitmap,
11004#if USE_CG_DRAWING
11005 mac_define_fringe_bitmap,
11006 mac_destroy_fringe_bitmap,
11007#else
10895 0, /* define_fringe_bitmap */ 11008 0, /* define_fringe_bitmap */
10896 0, /* destroy_fringe_bitmap */ 11009 0, /* destroy_fringe_bitmap */
11010#endif
10897 mac_per_char_metric, 11011 mac_per_char_metric,
10898 mac_encode_char, 11012 mac_encode_char,
10899 mac_compute_glyph_string_overhangs, 11013 mac_compute_glyph_string_overhangs,
@@ -10970,6 +11084,11 @@ mac_initialize ()
10970 MakeMeTheFrontProcess (); 11084 MakeMeTheFrontProcess ();
10971#endif 11085#endif
10972#endif 11086#endif
11087
11088#if USE_CG_DRAWING
11089 mac_init_fringe ();
11090#endif
11091
10973 UNBLOCK_INPUT; 11092 UNBLOCK_INPUT;
10974} 11093}
10975 11094
diff --git a/src/sheap.c b/src/sheap.c
index 192af4030c6..03da2afa813 100644
--- a/src/sheap.c
+++ b/src/sheap.c
@@ -26,11 +26,7 @@ Boston, MA 02110-1301, USA. */
26 26
27#include <unistd.h> 27#include <unistd.h>
28 28
29#ifdef HAVE_X_WINDOWS 29#define STATIC_HEAP_SIZE (12 * 1024 * 1024)
30#define STATIC_HEAP_SIZE (8 * 1024 * 1024)
31#else
32#define STATIC_HEAP_SIZE (8 * 1024 * 1024)
33#endif
34 30
35int debug_sheap = 0; 31int debug_sheap = 0;
36 32
diff --git a/src/unexelf.c b/src/unexelf.c
index 30a35372544..a236b98eab1 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -433,6 +433,9 @@ extern void fatal (const char *msgid, ...);
433#if __sgi 433#if __sgi
434#include <syms.h> /* for HDRR declaration */ 434#include <syms.h> /* for HDRR declaration */
435#endif /* __sgi */ 435#endif /* __sgi */
436#ifdef BROKEN_NOCOMBRELOC
437#include <assert.h>
438#endif
436 439
437#ifndef MAP_ANON 440#ifndef MAP_ANON
438#ifdef MAP_ANONYMOUS 441#ifdef MAP_ANONYMOUS
@@ -687,6 +690,9 @@ unexec (new_name, old_name, data_start, bss_start, entry_address)
687 int old_mdebug_index; 690 int old_mdebug_index;
688 struct stat stat_buf; 691 struct stat stat_buf;
689 int old_file_size; 692 int old_file_size;
693#ifdef BROKEN_NOCOMBRELOC
694 int unreloc_sections[10], n_unreloc_sections;
695#endif
690 696
691 /* Open the old file, allocate a buffer of the right size, and read 697 /* Open the old file, allocate a buffer of the right size, and read
692 in the file contents. */ 698 in the file contents. */
@@ -1218,6 +1224,7 @@ unexec (new_name, old_name, data_start, bss_start, entry_address)
1218 1224
1219 /* This loop seeks out relocation sections for the data section, so 1225 /* This loop seeks out relocation sections for the data section, so
1220 that it can undo relocations performed by the runtime linker. */ 1226 that it can undo relocations performed by the runtime linker. */
1227#ifndef BROKEN_NOCOMBRELOC
1221 for (n = new_file_h->e_shnum - 1; n; n--) 1228 for (n = new_file_h->e_shnum - 1; n; n--)
1222 { 1229 {
1223 ElfW(Shdr) section = NEW_SECTION_H (n); 1230 ElfW(Shdr) section = NEW_SECTION_H (n);
@@ -1272,6 +1279,81 @@ unexec (new_name, old_name, data_start, bss_start, entry_address)
1272 break; 1279 break;
1273 } 1280 }
1274 } 1281 }
1282#else /* BROKEN_NOCOMBRELOC */
1283 for (n = 1, n_unreloc_sections = 0; n < new_file_h->e_shnum; n++)
1284 if (!strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data")
1285 || !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".sdata")
1286 || !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".lit4")
1287 || !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".lit8")
1288#ifdef IRIX6_5 /* see above */
1289 || !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".got")
1290#endif
1291 || !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".sdata1")
1292 || !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data1"))
1293 {
1294 assert (n_unreloc_sections
1295 < (sizeof (unreloc_sections) / sizeof (unreloc_sections[0])));
1296 unreloc_sections[n_unreloc_sections++] = n;
1297#ifdef DEBUG
1298 fprintf (stderr, "section %d: %s\n", n,
1299 old_section_names + NEW_SECTION_H (n).sh_name);
1300#endif
1301 }
1302
1303 for (n = new_file_h->e_shnum - 1; n; n--)
1304 {
1305 ElfW(Shdr) section = NEW_SECTION_H (n);
1306 caddr_t reloc, end;
1307 ElfW(Addr) addr, offset;
1308 int target;
1309
1310 switch (section.sh_type)
1311 {
1312 default:
1313 break;
1314 case SHT_REL:
1315 case SHT_RELA:
1316 /* This code handles two different size structs, but there should
1317 be no harm in that provided that r_offset is always the first
1318 member. */
1319 for (reloc = old_base + section.sh_offset,
1320 end = reloc + section.sh_size;
1321 reloc < end;
1322 reloc += section.sh_entsize)
1323 {
1324 addr = ((ElfW(Rel) *) reloc)->r_offset;
1325#ifdef __alpha__
1326 /* The Alpha ELF binutils currently have a bug that
1327 sometimes results in relocs that contain all
1328 zeroes. Work around this for now... */
1329 if (addr == 0)
1330 continue;
1331#endif
1332 for (nn = 0; nn < n_unreloc_sections; nn++)
1333 {
1334 target = unreloc_sections[nn];
1335 if (NEW_SECTION_H (target).sh_addr <= addr
1336 && addr < (NEW_SECTION_H (target).sh_addr +
1337 NEW_SECTION_H (target).sh_size))
1338 {
1339 offset = (NEW_SECTION_H (target).sh_addr -
1340 NEW_SECTION_H (target).sh_offset);
1341 memcpy (new_base + addr - offset,
1342 old_base + addr - offset,
1343 sizeof (ElfW(Addr)));
1344#ifdef DEBUG
1345 fprintf (stderr, "unrelocate: [%08lx] <= %08lx\n",
1346 (long) addr,
1347 (long) *((long *) (new_base + addr - offset)));
1348#endif
1349 break;
1350 }
1351 }
1352 }
1353 break;
1354 }
1355 }
1356#endif /* BROKEN_NOCOMBRELOC */
1275 1357
1276 /* Write out new_file, and free the buffers. */ 1358 /* Write out new_file, and free the buffers. */
1277 1359
diff --git a/src/w32fns.c b/src/w32fns.c
index 08b6ed8b1a4..55f4af03d6e 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -7937,8 +7937,12 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
7937 ***********************************************************************/ 7937 ***********************************************************************/
7938 7938
7939DEFUN ("w32-select-font", Fw32_select_font, Sw32_select_font, 0, 2, 0, 7939DEFUN ("w32-select-font", Fw32_select_font, Sw32_select_font, 0, 2, 0,
7940 doc: /* Select a font using the W32 font dialog. 7940 doc: /* Select a font for the named FRAME using the W32 font dialog.
7941Returns an X font string corresponding to the selection. */) 7941Returns an X-style font string corresponding to the selection.
7942
7943If FRAME is omitted or nil, it defaults to the selected frame.
7944If INCLUDE-PROPORTIONAL is non-nil, include proportional fonts
7945in the font selection dialog. */)
7942 (frame, include_proportional) 7946 (frame, include_proportional)
7943 Lisp_Object frame, include_proportional; 7947 Lisp_Object frame, include_proportional;
7944{ 7948{
diff --git a/src/window.c b/src/window.c
index 23a4eb98e4b..cbfc7e02401 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4798,8 +4798,8 @@ window_scroll_pixel_based (window, n, whole, noerror)
4798 possibility of point becoming "stuck" on a tall line when 4798 possibility of point becoming "stuck" on a tall line when
4799 scrolling by one line. */ 4799 scrolling by one line. */
4800 if (window_scroll_pixel_based_preserve_y < 0 4800 if (window_scroll_pixel_based_preserve_y < 0
4801 || (current_kboard->Vlast_command != Qscroll_up 4801 || (!EQ (current_kboard->Vlast_command, Qscroll_up)
4802 && current_kboard->Vlast_command != Qscroll_down)) 4802 && !EQ (current_kboard->Vlast_command, Qscroll_down)))
4803 { 4803 {
4804 start_display (&it, w, start); 4804 start_display (&it, w, start);
4805 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS); 4805 move_it_to (&it, PT, -1, -1, -1, MOVE_TO_POS);
diff --git a/src/xdisp.c b/src/xdisp.c
index 7bdda29fb0f..b80d21ade80 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -9443,7 +9443,12 @@ build_desired_tool_bar_string (f)
9443 HEIGHT specifies the desired height of the tool-bar line. 9443 HEIGHT specifies the desired height of the tool-bar line.
9444 If the actual height of the glyph row is less than HEIGHT, the 9444 If the actual height of the glyph row is less than HEIGHT, the
9445 row's height is increased to HEIGHT, and the icons are centered 9445 row's height is increased to HEIGHT, and the icons are centered
9446 vertically in the new height. */ 9446 vertically in the new height.
9447
9448 If HEIGHT is -1, we are counting needed tool-bar lines, so don't
9449 count a final empty row in case the tool-bar width exactly matches
9450 the window width.
9451*/
9447 9452
9448static void 9453static void
9449display_tool_bar_line (it, height) 9454display_tool_bar_line (it, height)
@@ -9467,7 +9472,12 @@ display_tool_bar_line (it, height)
9467 9472
9468 /* Get the next display element. */ 9473 /* Get the next display element. */
9469 if (!get_next_display_element (it)) 9474 if (!get_next_display_element (it))
9470 break; 9475 {
9476 /* Don't count empty row if we are counting needed tool-bar lines. */
9477 if (height < 0 && !it->hpos)
9478 return;
9479 break;
9480 }
9471 9481
9472 /* Produce glyphs. */ 9482 /* Produce glyphs. */
9473 x_before = it->current_x; 9483 x_before = it->current_x;
@@ -9565,11 +9575,12 @@ tool_bar_lines_needed (f, n_rows)
9565 { 9575 {
9566 it.glyph_row = w->desired_matrix->rows; 9576 it.glyph_row = w->desired_matrix->rows;
9567 clear_glyph_row (it.glyph_row); 9577 clear_glyph_row (it.glyph_row);
9568 display_tool_bar_line (&it, 0); 9578 display_tool_bar_line (&it, -1);
9569 } 9579 }
9570 9580
9581 /* f->n_tool_bar_rows == 0 means "unknown"; -1 means no tool-bar. */
9571 if (n_rows) 9582 if (n_rows)
9572 *n_rows = it.vpos; 9583 *n_rows = it.vpos > 0 ? it.vpos : -1;
9573 9584
9574 return (it.current_y + FRAME_LINE_HEIGHT (f) - 1) / FRAME_LINE_HEIGHT (f); 9585 return (it.current_y + FRAME_LINE_HEIGHT (f) - 1) / FRAME_LINE_HEIGHT (f);
9575} 9586}
@@ -9645,11 +9656,7 @@ redisplay_tool_bar (f)
9645 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1); 9656 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1);
9646 9657
9647 if (f->n_tool_bar_rows == 0) 9658 if (f->n_tool_bar_rows == 0)
9648 { 9659 (void)tool_bar_lines_needed (f, &f->n_tool_bar_rows);
9649 (void)tool_bar_lines_needed (f, &f->n_tool_bar_rows);
9650 if (f->n_tool_bar_rows == 0)
9651 f->n_tool_bar_rows = -1;
9652 }
9653 9660
9654 /* Display as many lines as needed to display all tool-bar items. */ 9661 /* Display as many lines as needed to display all tool-bar items. */
9655 9662
@@ -11607,7 +11614,7 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
11607 x += glyph->pixel_width; 11614 x += glyph->pixel_width;
11608 ++glyph; 11615 ++glyph;
11609 if (cursor_from_overlay_pos 11616 if (cursor_from_overlay_pos
11610 && last_pos > cursor_from_overlay_pos) 11617 && last_pos >= cursor_from_overlay_pos)
11611 { 11618 {
11612 cursor_from_overlay_pos = 0; 11619 cursor_from_overlay_pos = 0;
11613 cursor = 0; 11620 cursor = 0;
@@ -11621,10 +11628,12 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
11621 /* Skip all glyphs from string. */ 11628 /* Skip all glyphs from string. */
11622 do 11629 do
11623 { 11630 {
11631 Lisp_Object cprop;
11624 int pos; 11632 int pos;
11625 if ((cursor == NULL || glyph > cursor) 11633 if ((cursor == NULL || glyph > cursor)
11626 && !NILP (Fget_char_property (make_number ((glyph)->charpos), 11634 && (cprop = Fget_char_property (make_number ((glyph)->charpos),
11627 Qcursor, (glyph)->object)) 11635 Qcursor, (glyph)->object),
11636 !NILP (cprop))
11628 && (pos = string_buffer_position (w, glyph->object, 11637 && (pos = string_buffer_position (w, glyph->object,
11629 string_before_pos), 11638 string_before_pos),
11630 (pos == 0 /* From overlay */ 11639 (pos == 0 /* From overlay */
@@ -11635,14 +11644,15 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos)
11635 Add 1 to last_pos so that if point corresponds to the 11644 Add 1 to last_pos so that if point corresponds to the
11636 glyph right after the overlay, we still use a 'cursor' 11645 glyph right after the overlay, we still use a 'cursor'
11637 property found in that overlay. */ 11646 property found in that overlay. */
11638 cursor_from_overlay_pos = pos == 0 ? last_pos+1 : 0; 11647 cursor_from_overlay_pos = (pos ? 0 : last_pos
11648 + (INTEGERP (cprop) ? XINT (cprop) : 0));
11639 cursor = glyph; 11649 cursor = glyph;
11640 cursor_x = x; 11650 cursor_x = x;
11641 } 11651 }
11642 x += glyph->pixel_width; 11652 x += glyph->pixel_width;
11643 ++glyph; 11653 ++glyph;
11644 } 11654 }
11645 while (glyph < end && STRINGP (glyph->object)); 11655 while (glyph < end && EQ (glyph->object, string_start->object));
11646 } 11656 }
11647 } 11657 }
11648 11658
@@ -15373,6 +15383,7 @@ extend_face_to_end_of_line (it)
15373 face = FACE_FROM_ID (f, it->face_id); 15383 face = FACE_FROM_ID (f, it->face_id);
15374 15384
15375 if (FRAME_WINDOW_P (f) 15385 if (FRAME_WINDOW_P (f)
15386 && it->glyph_row->displays_text_p
15376 && face->box == FACE_NO_BOX 15387 && face->box == FACE_NO_BOX
15377 && face->background == FRAME_BACKGROUND_PIXEL (f) 15388 && face->background == FRAME_BACKGROUND_PIXEL (f)
15378 && !face->stipple) 15389 && !face->stipple)
@@ -19390,7 +19401,7 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps)
19390 Called from x_produce_glyphs when IT->glyph_row is non-null. */ 19401 Called from x_produce_glyphs when IT->glyph_row is non-null. */
19391 19402
19392static INLINE void 19403static INLINE void
19393append_glyph (it) 19404store_next_glyph (it)
19394 struct it *it; 19405 struct it *it;
19395{ 19406{
19396 struct glyph *glyph; 19407 struct glyph *glyph;
@@ -19714,7 +19725,7 @@ append_stretch_glyph (it, object, width, height, ascent)
19714 ASCENT must be in the range 0 <= ASCENT <= 100. */ 19725 ASCENT must be in the range 0 <= ASCENT <= 100. */
19715 19726
19716static void 19727static void
19717produce_stretch_glyph (it) 19728generate_stretch_glyph (it)
19718 struct it *it; 19729 struct it *it;
19719{ 19730{
19720 /* (space :width WIDTH :height HEIGHT ...) */ 19731 /* (space :width WIDTH :height HEIGHT ...) */
@@ -20140,7 +20151,7 @@ x_produce_glyphs (it)
20140 it->ascent + it->descent, ascent); 20151 it->ascent + it->descent, ascent);
20141 } 20152 }
20142 else 20153 else
20143 append_glyph (it); 20154 store_next_glyph (it);
20144 20155
20145 /* If characters with lbearing or rbearing are displayed 20156 /* If characters with lbearing or rbearing are displayed
20146 in this line, record that fact in a flag of the 20157 in this line, record that fact in a flag of the
@@ -20322,7 +20333,7 @@ x_produce_glyphs (it)
20322 take_vertical_position_into_account (it); 20333 take_vertical_position_into_account (it);
20323 20334
20324 if (it->glyph_row) 20335 if (it->glyph_row)
20325 append_glyph (it); 20336 store_next_glyph (it);
20326 } 20337 }
20327 it->multibyte_p = saved_multibyte_p; 20338 it->multibyte_p = saved_multibyte_p;
20328 } 20339 }
@@ -20602,7 +20613,7 @@ x_produce_glyphs (it)
20602 else if (it->what == IT_IMAGE) 20613 else if (it->what == IT_IMAGE)
20603 produce_image_glyph (it); 20614 produce_image_glyph (it);
20604 else if (it->what == IT_STRETCH) 20615 else if (it->what == IT_STRETCH)
20605 produce_stretch_glyph (it); 20616 generate_stretch_glyph (it);
20606 20617
20607 /* Accumulate dimensions. Note: can't assume that it->descent > 0 20618 /* Accumulate dimensions. Note: can't assume that it->descent > 0
20608 because this isn't true for images with `:ascent 100'. */ 20619 because this isn't true for images with `:ascent 100'. */
diff --git a/src/xfns.c b/src/xfns.c
index a350f6a7f90..6433f9172ab 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -799,12 +799,9 @@ xg_set_icon (f, file)
799 FRAME_PTR f; 799 FRAME_PTR f;
800 Lisp_Object file; 800 Lisp_Object file;
801{ 801{
802 struct gcpro gcpro1;
803 int result = 0; 802 int result = 0;
804 Lisp_Object found; 803 Lisp_Object found;
805 804
806 GCPRO1 (found);
807
808 found = x_find_image_file (file); 805 found = x_find_image_file (file);
809 806
810 if (! NILP (found)) 807 if (! NILP (found))
diff --git a/src/xterm.c b/src/xterm.c
index 378373fe791..c17a25cbd05 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10074,6 +10074,10 @@ static XrmOptionDescRec emacs_options[] = {
10074 10074
10075static int x_initialized; 10075static int x_initialized;
10076 10076
10077#ifdef HAVE_X_SM
10078static int x_session_initialized;
10079#endif
10080
10077#ifdef MULTI_KBOARD 10081#ifdef MULTI_KBOARD
10078/* Test whether two display-name strings agree up to the dot that separates 10082/* Test whether two display-name strings agree up to the dot that separates
10079 the screen number from the server number. */ 10083 the screen number from the server number. */
@@ -10151,6 +10155,21 @@ get_bits_and_offset (mask, bits, offset)
10151 *bits = nr; 10155 *bits = nr;
10152} 10156}
10153 10157
10158int
10159x_display_ok (display)
10160 const char * display;
10161{
10162 int dpy_ok = 1;
10163 Display *dpy;
10164
10165 dpy = XOpenDisplay (display);
10166 if (dpy)
10167 XCloseDisplay (dpy);
10168 else
10169 dpy_ok = 0;
10170 return dpy_ok;
10171}
10172
10154struct x_display_info * 10173struct x_display_info *
10155x_term_init (display_name, xrm_option, resource_name) 10174x_term_init (display_name, xrm_option, resource_name)
10156 Lisp_Object display_name; 10175 Lisp_Object display_name;
@@ -10233,11 +10252,9 @@ x_term_init (display_name, xrm_option, resource_name)
10233 10252
10234 /* Load our own gtkrc if it exists. */ 10253 /* Load our own gtkrc if it exists. */
10235 { 10254 {
10236 struct gcpro gcpro1, gcpro2;
10237 char *file = "~/.emacs.d/gtkrc"; 10255 char *file = "~/.emacs.d/gtkrc";
10238 Lisp_Object s, abs_file; 10256 Lisp_Object s, abs_file;
10239 10257
10240 GCPRO2 (s, abs_file);
10241 s = make_string (file, strlen (file)); 10258 s = make_string (file, strlen (file));
10242 abs_file = Fexpand_file_name (s, Qnil); 10259 abs_file = Fexpand_file_name (s, Qnil);
10243 10260
@@ -10899,6 +10916,9 @@ x_initialize ()
10899 last_tool_bar_item = -1; 10916 last_tool_bar_item = -1;
10900 any_help_event_p = 0; 10917 any_help_event_p = 0;
10901 ignore_next_mouse_click_timeout = 0; 10918 ignore_next_mouse_click_timeout = 0;
10919#ifdef HAVE_X_SM
10920 x_session_initialized = 0;
10921#endif
10902 10922
10903#ifdef USE_GTK 10923#ifdef USE_GTK
10904 current_count = -1; 10924 current_count = -1;
diff --git a/src/xterm.h b/src/xterm.h
index b581c0c0159..873b7da2b14 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -423,6 +423,7 @@ extern struct x_display_info *x_display_info_for_display P_ ((Display *));
423extern struct x_display_info *x_display_info_for_name P_ ((Lisp_Object)); 423extern struct x_display_info *x_display_info_for_name P_ ((Lisp_Object));
424 424
425extern struct x_display_info *x_term_init P_ ((Lisp_Object, char *, char *)); 425extern struct x_display_info *x_term_init P_ ((Lisp_Object, char *, char *));
426extern int x_display_ok P_ ((const char *));
426 427
427extern Lisp_Object x_list_fonts P_ ((struct frame *, Lisp_Object, int, int)); 428extern Lisp_Object x_list_fonts P_ ((struct frame *, Lisp_Object, int, int));
428extern void select_visual P_ ((struct x_display_info *)); 429extern void select_visual P_ ((struct x_display_info *));