aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2006-03-19 19:43:57 +0000
committerMiles Bader2006-03-19 19:43:57 +0000
commit292203c9ef2ab5c1bb349b83132c9a51d3dfb274 (patch)
tree50a77103a19396afa0417287910e49e0e1599c31 /src
parentd02f8c18d1f1ecd3389a9290125f840ec54f4054 (diff)
parent531bedc37c5e0b060c51565ba3a17ef471c2b510 (diff)
downloademacs-292203c9ef2ab5c1bb349b83132c9a51d3dfb274.tar.gz
emacs-292203c9ef2ab5c1bb349b83132c9a51d3dfb274.zip
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-46
Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 157-163) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 58-61) - Update from CVS
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog105
-rw-r--r--src/dispextern.h3
-rw-r--r--src/emacs.c12
-rw-r--r--src/fringe.c8
-rw-r--r--src/image.c73
-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/xdisp.c26
-rw-r--r--src/xterm.c28
-rw-r--r--src/xterm.h1
14 files changed, 469 insertions, 63 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5e04b00a872..2081b255094 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,7 +1,96 @@
12006-03-18 Chong Yidong <cyd@stupidchicken.com>
2
3 * xterm.c (x_display_ok): Fix minor bug and compilation warnings.
4
52006-03-18 Nozomu Ando <nand@mac.com>
6
7 * m/pmax.h (BROKEN_NOCOMBRELOC) [__NetBSD__]: Define.
8 (LIB_STANDARD, START_FILES) [__NetBSD__]: Don't define.
9 (START_FILES, RUN_TIME_REMAP, UNEXEC) [__NetBSD__, __OpenBSD__]:
10 Don't redefine.
11
12 * m/mips.h: Don't use unexmips on NetBSD.
13 (LIBS_MACHINE): Move definition lower, so it doesn't use
14 LD_SWITCH_MACHINE, START_FILES, LIB_STANDARD, LIBS_TERMCAP,
15 C_SWITCH_MACHINE, and C_DEBUG_SWITCH.
16
17 * unexelf.c [BROKEN_NOCOMBRELOC]: Include assert.h.
18 (unexec) [BROKEN_NOCOMBRELOC]: Handle platforms whose nocombreloc
19 option is broken (e.g., MIPS/NetBSD).
20
212006-03-18 Craig McDaniel <craigmcd@gmail.com> (tiny change)
22
23 * sheap.c (STATIC_HEAP_SIZE): Enlarge STATIC_HEAP_SIZE to 12MB.
24 Remove the HAVE_X_WINDOWS conditional.
25
262006-03-18 Vivek Dasmohapatra <vivek@etla.org> (tiny change)
27
28 * emacs.c (main): If user asks for a display that is unavailable,
29 simulate -nw.
30
31 * xterm.c (x_display_ok): New function.
32
33 * xterm.h: Add prototype for x_display_ok.
34
352006-03-18 Eli Zaretskii <eliz@gnu.org>
36
37 * w32fns.c (Fw32_select_font): Doc fix.
38
392006-03-16 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
40
41 * image.c [MAC_OS] (XPutPixel, XGetPixel)
42 [!WORDS_BIG_ENDIAN && USE_CG_DRAWING]: Don't use specialized
43 version when depth is 32.
44 (mac_create_cg_image_from_image) [MAC_OS && USE_CG_DRAWING]: New
45 function.
46 (prepare_image_for_display) [MAC_OS && USE_CG_DRAWING]: Use it.
47 (x_clear_image_1) [MAC_OS && USE_CG_DRAWING]: Release CGImage.
48
49 * macterm.c (XCreatePixmap) [!WORDS_BIG_ENDIAN && USE_CG_DRAWING]:
50 Create GWorld in ARGB pixel format.
51 (mac_copy_area, mac_copy_area_with_mask) [USE_CG_DRAWING]: Remove
52 functions.
53 (x_draw_image_foreground) [USE_CG_DRAWING]: Use mac_draw_cg_image
54 instead of mac_copy_area/mac_copy_area_with_mask.
55
562006-03-15 Kim F. Storm <storm@cua.dk>
57
58 * xdisp.c (extend_face_to_end_of_line): Always add space glyph to
59 empty row. Fixes memory corruption revealed by 2006-03-02 change.
60 (display_tool_bar_line): Skip empty tool-bar line if HEIGHT < 0.
61 (tool_bar_lines_needed): Fix tool-bar display in case the tool-bar
62 width is exactly the same as the window width. Don't count a final
63 empty tool-bar line (pass HEIGHT = -1 to display_tool_bar_line).
64
652006-03-15 Juanma Barranquero <lekktu@gmail.com>
66
67 * fringe.c (w32_init_fringe, w32_reset_fringes): Revert to being
68 conditional on HAVE_NTGUI, not WINDOWS_NT.
69
702006-03-15 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
71
72 * dispextern.h (mac_init_fringe) [MAC_OS]: Add prototype.
73
74 * fringe.c (mac_init_fringe) [MAC_OS]: New function.
75
76 * macterm.c (mac_initialize) [USE_CG_DRAWING]: Call mac_init_fringe.
77 (max_fringe_bmp, fringe_bmp) [USE_CG_DRAWING]: New variables.
78 (mac_define_fringe_bitmap, mac_destroy_fringe_bitmap)
79 (mac_draw_cg_image) [USE_CG_DRAWING]: New functions.
80 (mac_draw_bitmap) [USE_CG_DRAWING]: Remove function.
81 (x_draw_fringe_bitmap) [USE_CG_DRAWING]: Use mac_draw_cg_image
82 instead of mac_draw_bitmap.
83 (x_redisplay_interface) [USE_CG_DRAWING]: Set handlers for
84 define_fringe_bitmap and destroy_fringe_bitmap.
85
862006-03-14 Chong Yidong <cyd@stupidchicken.com>
87
88 * xterm.c (x_uncatch_errors): Block input for entire function.
89
12006-03-12 Jason Rumney <jasonr@gnu.org> 902006-03-12 Jason Rumney <jasonr@gnu.org>
2 91
3 * w32fns.c (Fx_create_frame): Remove call to 92 * w32fns.c (Fx_create_frame): Remove call to
4 Qface_set_after_frame_default. (from xfns.c 2003-05-26) 93 Qface_set_after_frame_default (from xfns.c 2003-05-26).
5 94
6 * w32menu.c (Fx_popup_menu): Call w32_free_menu_strings when 95 * w32menu.c (Fx_popup_menu): Call w32_free_menu_strings when
7 finished with the menu. 96 finished with the menu.
@@ -11,7 +100,7 @@
11 (note_mouse_movement): Say mouse moved if current frame differs 100 (note_mouse_movement): Say mouse moved if current frame differs
12 from last_mouse_glyph_frame, and update last_mouse_glyph_frame. 101 from last_mouse_glyph_frame, and update last_mouse_glyph_frame.
13 (w32_mouse_position): Set last_mouse_glyph_frame. 102 (w32_mouse_position): Set last_mouse_glyph_frame.
14 Remove OLD_REDISPLAY_CODE block. 103 Remove OLD_REDISPLAY_CODE block.
15 104
162006-03-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 1052006-03-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
17 106
@@ -189,7 +278,7 @@
189 278
190 * xdisp.c: Minimize the unpleasent visual impact of the requirement 279 * xdisp.c: Minimize the unpleasent visual impact of the requirement
191 that non-toolkit tool-bars must occupy an integral number of screen 280 that non-toolkit tool-bars must occupy an integral number of screen
192 lines, by distributing the rows evenly over the tool-bar screen area. 281 lines, by distributing the rows evenly over the tool-bar screen area.
193 (Vtool_bar_border): New variable. 282 (Vtool_bar_border): New variable.
194 (syms_of_xdisp): DEFVAR_LISP it. 283 (syms_of_xdisp): DEFVAR_LISP it.
195 (display_tool_bar_line): Add HEIGHT arg for desired row height. 284 (display_tool_bar_line): Add HEIGHT arg for desired row height.
@@ -223,9 +312,9 @@
223 312
224 * xterm.h, xterm.c (x_uncatch_errors): Delete unneccessary argument. 313 * xterm.h, xterm.c (x_uncatch_errors): Delete unneccessary argument.
225 314
226 * xterm.c: (x_load_font, x_term_init, XTmouse_position) 315 * xterm.c (x_load_font, x_term_init, XTmouse_position)
227 (handle_one_xevent, x_connection_closed, x_list_fonts): No arg for 316 (handle_one_xevent, x_connection_closed, x_list_fonts):
228 x_uncatch_errors. 317 No arg for x_uncatch_errors.
229 318
230 * xselect.c (x_own_selection, x_decline_selection_request) 319 * xselect.c (x_own_selection, x_decline_selection_request)
231 (x_reply_selection_request, x_get_foreign_selection) 320 (x_reply_selection_request, x_get_foreign_selection)
@@ -353,7 +442,7 @@
353 442
354 * fringe.c (syms_of_fringe) <fringe-bitmaps>: Doc fix. 443 * fringe.c (syms_of_fringe) <fringe-bitmaps>: Doc fix.
355 444
3562006-02-21 Zhang Wei <brep@newsmth.org> 4452006-02-21 Zhang Wei <brep@newsmth.org>
357 446
358 * xfns.c (Fx_file_dialog, Motif and GTK): DECODE_FILE before 447 * xfns.c (Fx_file_dialog, Motif and GTK): DECODE_FILE before
359 returning it. 448 returning it.
@@ -422,7 +511,7 @@
422 (draw_fringe_bitmap_1): Make static. 511 (draw_fringe_bitmap_1): Make static.
423 (get_logical_cursor_bitmap, get_logical_fringe_bitmap): New functions 512 (get_logical_cursor_bitmap, get_logical_fringe_bitmap): New functions
424 to map from logical cursors and indicators to physical bitmaps. 513 to map from logical cursors and indicators to physical bitmaps.
425 (draw_fringe_bitmap): Resolve fringe cursor and overlay-arrow 514 (draw_fringe_bitmap): Resolve fringe cursor and overlay-arrow
426 bitmaps using symbol names instead of bitmap numbers. 515 bitmaps using symbol names instead of bitmap numbers.
427 (update_window_fringes): Use logical indicator symbol names 516 (update_window_fringes): Use logical indicator symbol names
428 instead of bitmap numbers for logical. Add bitmap cache. 517 instead of bitmap numbers for logical. Add bitmap cache.
diff --git a/src/dispextern.h b/src/dispextern.h
index 806b675de73..f6b0fbbbf15 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2729,6 +2729,9 @@ void compute_fringe_widths P_ ((struct frame *, int));
2729void w32_init_fringe P_ ((void)); 2729void w32_init_fringe P_ ((void));
2730void w32_reset_fringes P_ ((void)); 2730void w32_reset_fringes P_ ((void));
2731#endif 2731#endif
2732#ifdef MAC_OS
2733void mac_init_fringe P_ ((void));
2734#endif
2732 2735
2733/* Defined in image.c */ 2736/* Defined in image.c */
2734 2737
diff --git a/src/emacs.c b/src/emacs.c
index 41857b7ccb8..5a09f5d762c 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -53,6 +53,10 @@ Boston, MA 02110-1301, USA. */
53#include "buffer.h" 53#include "buffer.h"
54#include "window.h" 54#include "window.h"
55 55
56#ifdef HAVE_X_WINDOWS
57#include "xterm.h"
58#endif
59
56#include "systty.h" 60#include "systty.h"
57#include "blockinput.h" 61#include "blockinput.h"
58#include "syssignal.h" 62#include "syssignal.h"
@@ -1486,6 +1490,14 @@ main (argc, argv
1486 1490
1487 /* Don't actually discard this arg. */ 1491 /* Don't actually discard this arg. */
1488 skip_args = count_before; 1492 skip_args = count_before;
1493
1494 /* Do not be lenient if the user explicitly asked for a named display. */
1495 if (display_arg != 1 && !x_display_ok (displayname))
1496 {
1497 fprintf (stderr, "Display %s unavailable, simulating -nw\n",
1498 displayname);
1499 inhibit_window_system = 1;
1500 }
1489 } 1501 }
1490#endif 1502#endif
1491 1503
diff --git a/src/fringe.c b/src/fringe.c
index 1a045d7034e..2ce15d27d74 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -1689,10 +1689,14 @@ init_fringe ()
1689 } 1689 }
1690} 1690}
1691 1691
1692#ifdef HAVE_NTGUI 1692#if defined (HAVE_NTGUI) || defined (MAC_OS)
1693 1693
1694void 1694void
1695#ifdef HAVE_NTGUI
1695w32_init_fringe () 1696w32_init_fringe ()
1697#else /* MAC_OS */
1698mac_init_fringe ()
1699#endif
1696{ 1700{
1697 int bt; 1701 int bt;
1698 1702
@@ -1705,7 +1709,9 @@ w32_init_fringe ()
1705 rif->define_fringe_bitmap (bt, fb->bits, fb->height, fb->width); 1709 rif->define_fringe_bitmap (bt, fb->bits, fb->height, fb->width);
1706 } 1710 }
1707} 1711}
1712#endif
1708 1713
1714#ifdef HAVE_NTGUI
1709void 1715void
1710w32_reset_fringes () 1716w32_reset_fringes ()
1711{ 1717{
diff --git a/src/image.c b/src/image.c
index cbdff81eba7..d8a1bc8028b 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/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 fa544df364d..b4b096fa541 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -283,6 +283,11 @@ extern void menubar_selection_callback (FRAME_PTR, int);
283#if USE_CG_DRAWING 283#if USE_CG_DRAWING
284#define FRAME_CG_CONTEXT(f) ((f)->output_data.mac->cg_context) 284#define FRAME_CG_CONTEXT(f) ((f)->output_data.mac->cg_context)
285 285
286/* Fringe bitmaps. */
287
288static int max_fringe_bmp = 0;
289static CGImageRef *fringe_bmp = 0;
290
286static CGContextRef 291static CGContextRef
287mac_begin_cg_clip (f, gc) 292mac_begin_cg_clip (f, gc)
288 struct frame *f; 293 struct frame *f;
@@ -511,6 +516,44 @@ mac_clear_window (f)
511 516
512/* Mac replacement for XCopyArea. */ 517/* Mac replacement for XCopyArea. */
513 518
519#if USE_CG_DRAWING
520static void
521mac_draw_cg_image (image, f, gc, src_x, src_y, width, height,
522 dest_x, dest_y, overlay_p)
523 CGImageRef image;
524 struct frame *f;
525 GC gc;
526 int src_x, src_y;
527 unsigned int width, height;
528 int dest_x, dest_y, overlay_p;
529{
530 CGContextRef context;
531 float port_height = FRAME_PIXEL_HEIGHT (f);
532 CGRect dest_rect = CGRectMake (dest_x, dest_y, width, height);
533
534 context = mac_begin_cg_clip (f, gc);
535 if (!overlay_p)
536 {
537 CG_SET_FILL_COLOR (context, gc->xgcv.background);
538 CGContextFillRect (context, dest_rect);
539 }
540 CGContextClipToRect (context, dest_rect);
541 CGContextScaleCTM (context, 1, -1);
542 CGContextTranslateCTM (context, 0, -port_height);
543 if (CGImageIsMask (image))
544 CG_SET_FILL_COLOR (context, gc->xgcv.foreground);
545 CGContextDrawImage (context,
546 CGRectMake (dest_x - src_x,
547 port_height - (dest_y - src_y
548 + CGImageGetHeight (image)),
549 CGImageGetWidth (image),
550 CGImageGetHeight (image)),
551 image);
552 mac_end_cg_clip (f);
553}
554
555#else /* !USE_CG_DRAWING */
556
514static void 557static void
515mac_draw_bitmap (f, gc, x, y, width, height, bits, overlay_p) 558mac_draw_bitmap (f, gc, x, y, width, height, bits, overlay_p)
516 struct frame *f; 559 struct frame *f;
@@ -526,9 +569,6 @@ mac_draw_bitmap (f, gc, x, y, width, height, bits, overlay_p)
526 bitmap.baseAddr = (char *)bits; 569 bitmap.baseAddr = (char *)bits;
527 SetRect (&(bitmap.bounds), 0, 0, width, height); 570 SetRect (&(bitmap.bounds), 0, 0, width, height);
528 571
529#if USE_CG_DRAWING
530 mac_prepare_for_quickdraw (f);
531#endif
532 SetPortWindowPort (FRAME_MAC_WINDOW (f)); 572 SetPortWindowPort (FRAME_MAC_WINDOW (f));
533 573
534 RGBForeColor (GC_FORE_COLOR (gc)); 574 RGBForeColor (GC_FORE_COLOR (gc));
@@ -554,6 +594,7 @@ mac_draw_bitmap (f, gc, x, y, width, height, bits, overlay_p)
554 594
555 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); 595 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
556} 596}
597#endif /* !USE_CG_DRAWING */
557 598
558 599
559/* Mac replacement for XCreateBitmapFromBitmapData. */ 600/* Mac replacement for XCreateBitmapFromBitmapData. */
@@ -614,7 +655,15 @@ XCreatePixmap (display, w, width, height, depth)
614 SetPortWindowPort (w); 655 SetPortWindowPort (w);
615 656
616 SetRect (&r, 0, 0, width, height); 657 SetRect (&r, 0, 0, width, height);
617 err = NewGWorld (&pixmap, depth, &r, NULL, NULL, 0); 658#if !defined (WORDS_BIG_ENDIAN) && USE_CG_DRAWING
659 if (depth == 1)
660#endif
661 err = NewGWorld (&pixmap, depth, &r, NULL, NULL, 0);
662#if !defined (WORDS_BIG_ENDIAN) && USE_CG_DRAWING
663 else
664 /* CreateCGImageFromPixMaps requires ARGB format. */
665 err = QTNewGWorld (&pixmap, k32ARGBPixelFormat, &r, NULL, NULL, 0);
666#endif
618 if (err != noErr) 667 if (err != noErr)
619 return NULL; 668 return NULL;
620 return pixmap; 669 return pixmap;
@@ -1297,6 +1346,7 @@ mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width)
1297#endif 1346#endif
1298 1347
1299 1348
1349#if !USE_CG_DRAWING
1300/* Mac replacement for XCopyArea: dest must be window. */ 1350/* Mac replacement for XCopyArea: dest must be window. */
1301 1351
1302static void 1352static void
@@ -1310,9 +1360,6 @@ mac_copy_area (src, f, gc, src_x, src_y, width, height, dest_x, dest_y)
1310{ 1360{
1311 Rect src_r, dest_r; 1361 Rect src_r, dest_r;
1312 1362
1313#if USE_CG_DRAWING
1314 mac_prepare_for_quickdraw (f);
1315#endif
1316 SetPortWindowPort (FRAME_MAC_WINDOW (f)); 1363 SetPortWindowPort (FRAME_MAC_WINDOW (f));
1317 1364
1318 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height); 1365 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
@@ -1357,9 +1404,6 @@ mac_copy_area_with_mask (src, mask, f, gc, src_x, src_y,
1357{ 1404{
1358 Rect src_r, dest_r; 1405 Rect src_r, dest_r;
1359 1406
1360#if USE_CG_DRAWING
1361 mac_prepare_for_quickdraw (f);
1362#endif
1363 SetPortWindowPort (FRAME_MAC_WINDOW (f)); 1407 SetPortWindowPort (FRAME_MAC_WINDOW (f));
1364 1408
1365 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height); 1409 SetRect (&src_r, src_x, src_y, src_x + width, src_y + height);
@@ -1392,6 +1436,7 @@ mac_copy_area_with_mask (src, mask, f, gc, src_x, src_y,
1392 1436
1393 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); 1437 RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f)));
1394} 1438}
1439#endif /* !USE_CG_DRAWING */
1395 1440
1396 1441
1397/* Mac replacement for XCopyArea: used only for scrolling. */ 1442/* Mac replacement for XCopyArea: used only for scrolling. */
@@ -2003,9 +2048,12 @@ x_draw_fringe_bitmap (w, row, p)
2003#endif 2048#endif
2004 } 2049 }
2005 2050
2006 if (p->which) 2051 if (p->which
2052#if USE_CG_DRAWING
2053 && p->which < max_fringe_bmp
2054#endif
2055 )
2007 { 2056 {
2008 unsigned short *bits = p->bits + p->dh;
2009 XGCValues gcv; 2057 XGCValues gcv;
2010 2058
2011 XGetGCValues (display, face->gc, GCForeground, &gcv); 2059 XGetGCValues (display, face->gc, GCForeground, &gcv);
@@ -2014,14 +2062,64 @@ x_draw_fringe_bitmap (w, row, p)
2014 ? (p->overlay_p ? face->background 2062 ? (p->overlay_p ? face->background
2015 : f->output_data.mac->cursor_pixel) 2063 : f->output_data.mac->cursor_pixel)
2016 : face->foreground)); 2064 : face->foreground));
2065#if USE_CG_DRAWING
2066 mac_draw_cg_image (fringe_bmp[p->which], f, face->gc, 0, p->dh,
2067 p->wd, p->h, p->x, p->y, p->overlay_p);
2068#else
2017 mac_draw_bitmap (f, face->gc, p->x, p->y, 2069 mac_draw_bitmap (f, face->gc, p->x, p->y,
2018 p->wd, p->h, bits, p->overlay_p); 2070 p->wd, p->h, p->bits + p->dh, p->overlay_p);
2071#endif
2019 XSetForeground (display, face->gc, gcv.foreground); 2072 XSetForeground (display, face->gc, gcv.foreground);
2020 } 2073 }
2021 2074
2022 mac_reset_clip_rectangles (display, face->gc); 2075 mac_reset_clip_rectangles (display, face->gc);
2023} 2076}
2024 2077
2078#if USE_CG_DRAWING
2079static void
2080mac_define_fringe_bitmap (which, bits, h, wd)
2081 int which;
2082 unsigned short *bits;
2083 int h, wd;
2084{
2085 unsigned short *mask_bits;
2086 int i;
2087 CGDataProviderRef provider;
2088
2089 if (which >= max_fringe_bmp)
2090 {
2091 i = max_fringe_bmp;
2092 max_fringe_bmp = which + 20;
2093 fringe_bmp = (CGImageRef *) xrealloc (fringe_bmp, max_fringe_bmp * sizeof (CGImageRef));
2094 while (i < max_fringe_bmp)
2095 fringe_bmp[i++] = 0;
2096 }
2097
2098 for (i = 0; i < h; i++)
2099 bits[i] = ~bits[i];
2100 provider = CGDataProviderCreateWithData (NULL, bits,
2101 sizeof (unsigned short) * h, NULL);
2102 if (provider)
2103 {
2104 fringe_bmp[which] = CGImageMaskCreate (wd, h, 1, 1,
2105 sizeof (unsigned short),
2106 provider, NULL, 0);
2107 CGDataProviderRelease (provider);
2108 }
2109}
2110
2111static void
2112mac_destroy_fringe_bitmap (which)
2113 int which;
2114{
2115 if (which >= max_fringe_bmp)
2116 return;
2117
2118 if (fringe_bmp[which])
2119 CGImageRelease (fringe_bmp[which]);
2120 fringe_bmp[which] = 0;
2121}
2122#endif
2025 2123
2026 2124
2027/* This is called when starting Emacs and when restarting after 2125/* This is called when starting Emacs and when restarting after
@@ -3193,15 +3291,26 @@ x_draw_image_foreground (s)
3193 { 3291 {
3194 x_set_glyph_string_clipping (s); 3292 x_set_glyph_string_clipping (s);
3195 3293
3294#if USE_CG_DRAWING
3295 mac_draw_cg_image (s->img->data.ptr_val,
3296 s->f, s->gc, s->slice.x, s->slice.y,
3297 s->slice.width, s->slice.height, x, y, 1);
3298#endif
3196 if (s->img->mask) 3299 if (s->img->mask)
3300#if !USE_CG_DRAWING
3197 mac_copy_area_with_mask (s->img->pixmap, s->img->mask, 3301 mac_copy_area_with_mask (s->img->pixmap, s->img->mask,
3198 s->f, s->gc, s->slice.x, s->slice.y, 3302 s->f, s->gc, s->slice.x, s->slice.y,
3199 s->slice.width, s->slice.height, x, y); 3303 s->slice.width, s->slice.height, x, y);
3304#else
3305 ;
3306#endif
3200 else 3307 else
3201 { 3308 {
3309#if !USE_CG_DRAWING
3202 mac_copy_area (s->img->pixmap, 3310 mac_copy_area (s->img->pixmap,
3203 s->f, s->gc, s->slice.x, s->slice.y, 3311 s->f, s->gc, s->slice.x, s->slice.y,
3204 s->slice.width, s->slice.height, x, y); 3312 s->slice.width, s->slice.height, x, y);
3313#endif
3205 3314
3206 /* When the image has a mask, we can expect that at 3315 /* When the image has a mask, we can expect that at
3207 least part of a mouse highlight or a block cursor will 3316 least part of a mouse highlight or a block cursor will
@@ -10913,8 +11022,13 @@ static struct redisplay_interface x_redisplay_interface =
10913 x_get_glyph_overhangs, 11022 x_get_glyph_overhangs,
10914 x_fix_overlapping_area, 11023 x_fix_overlapping_area,
10915 x_draw_fringe_bitmap, 11024 x_draw_fringe_bitmap,
11025#if USE_CG_DRAWING
11026 mac_define_fringe_bitmap,
11027 mac_destroy_fringe_bitmap,
11028#else
10916 0, /* define_fringe_bitmap */ 11029 0, /* define_fringe_bitmap */
10917 0, /* destroy_fringe_bitmap */ 11030 0, /* destroy_fringe_bitmap */
11031#endif
10918 mac_per_char_metric, 11032 mac_per_char_metric,
10919 mac_encode_char, 11033 mac_encode_char,
10920 mac_compute_glyph_string_overhangs, 11034 mac_compute_glyph_string_overhangs,
@@ -10990,6 +11104,11 @@ mac_initialize ()
10990 MakeMeTheFrontProcess (); 11104 MakeMeTheFrontProcess ();
10991#endif 11105#endif
10992#endif 11106#endif
11107
11108#if USE_CG_DRAWING
11109 mac_init_fringe ();
11110#endif
11111
10993 UNBLOCK_INPUT; 11112 UNBLOCK_INPUT;
10994} 11113}
10995 11114
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 8c958df3812..bc2e728b49d 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -7999,8 +7999,12 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
7999 ***********************************************************************/ 7999 ***********************************************************************/
8000 8000
8001DEFUN ("w32-select-font", Fw32_select_font, Sw32_select_font, 0, 2, 0, 8001DEFUN ("w32-select-font", Fw32_select_font, Sw32_select_font, 0, 2, 0,
8002 doc: /* Select a font using the W32 font dialog. 8002 doc: /* Select a font for the named FRAME using the W32 font dialog.
8003Returns an X font string corresponding to the selection. */) 8003Returns an X-style font string corresponding to the selection.
8004
8005If FRAME is omitted or nil, it defaults to the selected frame.
8006If INCLUDE-PROPORTIONAL is non-nil, include proportional fonts
8007in the font selection dialog. */)
8004 (frame, include_proportional) 8008 (frame, include_proportional)
8005 Lisp_Object frame, include_proportional; 8009 Lisp_Object frame, include_proportional;
8006{ 8010{
diff --git a/src/xdisp.c b/src/xdisp.c
index 097ba3c9533..3bc9d9b55b4 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -9544,7 +9544,12 @@ build_desired_tool_bar_string (f)
9544 HEIGHT specifies the desired height of the tool-bar line. 9544 HEIGHT specifies the desired height of the tool-bar line.
9545 If the actual height of the glyph row is less than HEIGHT, the 9545 If the actual height of the glyph row is less than HEIGHT, the
9546 row's height is increased to HEIGHT, and the icons are centered 9546 row's height is increased to HEIGHT, and the icons are centered
9547 vertically in the new height. */ 9547 vertically in the new height.
9548
9549 If HEIGHT is -1, we are counting needed tool-bar lines, so don't
9550 count a final empty row in case the tool-bar width exactly matches
9551 the window width.
9552*/
9548 9553
9549static void 9554static void
9550display_tool_bar_line (it, height) 9555display_tool_bar_line (it, height)
@@ -9568,7 +9573,12 @@ display_tool_bar_line (it, height)
9568 9573
9569 /* Get the next display element. */ 9574 /* Get the next display element. */
9570 if (!get_next_display_element (it)) 9575 if (!get_next_display_element (it))
9571 break; 9576 {
9577 /* Don't count empty row if we are counting needed tool-bar lines. */
9578 if (height < 0 && !it->hpos)
9579 return;
9580 break;
9581 }
9572 9582
9573 /* Produce glyphs. */ 9583 /* Produce glyphs. */
9574 x_before = it->current_x; 9584 x_before = it->current_x;
@@ -9666,11 +9676,12 @@ tool_bar_lines_needed (f, n_rows)
9666 { 9676 {
9667 it.glyph_row = w->desired_matrix->rows; 9677 it.glyph_row = w->desired_matrix->rows;
9668 clear_glyph_row (it.glyph_row); 9678 clear_glyph_row (it.glyph_row);
9669 display_tool_bar_line (&it, 0); 9679 display_tool_bar_line (&it, -1);
9670 } 9680 }
9671 9681
9682 /* f->n_tool_bar_rows == 0 means "unknown"; -1 means no tool-bar. */
9672 if (n_rows) 9683 if (n_rows)
9673 *n_rows = it.vpos; 9684 *n_rows = it.vpos > 0 ? it.vpos : -1;
9674 9685
9675 return (it.current_y + FRAME_LINE_HEIGHT (f) - 1) / FRAME_LINE_HEIGHT (f); 9686 return (it.current_y + FRAME_LINE_HEIGHT (f) - 1) / FRAME_LINE_HEIGHT (f);
9676} 9687}
@@ -9746,11 +9757,7 @@ redisplay_tool_bar (f)
9746 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1); 9757 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1);
9747 9758
9748 if (f->n_tool_bar_rows == 0) 9759 if (f->n_tool_bar_rows == 0)
9749 { 9760 (void)tool_bar_lines_needed (f, &f->n_tool_bar_rows);
9750 (void)tool_bar_lines_needed (f, &f->n_tool_bar_rows);
9751 if (f->n_tool_bar_rows == 0)
9752 f->n_tool_bar_rows = -1;
9753 }
9754 9761
9755 /* Display as many lines as needed to display all tool-bar items. */ 9762 /* Display as many lines as needed to display all tool-bar items. */
9756 9763
@@ -15453,6 +15460,7 @@ extend_face_to_end_of_line (it)
15453 face = FACE_FROM_ID (f, it->face_id); 15460 face = FACE_FROM_ID (f, it->face_id);
15454 15461
15455 if (FRAME_WINDOW_P (f) 15462 if (FRAME_WINDOW_P (f)
15463 && it->glyph_row->displays_text_p
15456 && face->box == FACE_NO_BOX 15464 && face->box == FACE_NO_BOX
15457 && face->background == FRAME_BACKGROUND_PIXEL (f) 15465 && face->background == FRAME_BACKGROUND_PIXEL (f)
15458 && !face->stipple) 15466 && !face->stipple)
diff --git a/src/xterm.c b/src/xterm.c
index 1166a68200a..ec6fb395d12 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -7589,18 +7589,17 @@ x_uncatch_errors ()
7589{ 7589{
7590 struct x_error_message_stack *tmp; 7590 struct x_error_message_stack *tmp;
7591 7591
7592 BLOCK_INPUT;
7593
7592 /* The display may have been closed before this function is called. 7594 /* The display may have been closed before this function is called.
7593 Check if it is still open before calling XSync. */ 7595 Check if it is still open before calling XSync. */
7594 if (x_display_info_for_display (x_error_message->dpy) != 0) 7596 if (x_display_info_for_display (x_error_message->dpy) != 0)
7595 { 7597 XSync (x_error_message->dpy, False);
7596 BLOCK_INPUT;
7597 XSync (x_error_message->dpy, False);
7598 UNBLOCK_INPUT;
7599 }
7600 7598
7601 tmp = x_error_message; 7599 tmp = x_error_message;
7602 x_error_message = x_error_message->prev; 7600 x_error_message = x_error_message->prev;
7603 xfree (tmp); 7601 xfree (tmp);
7602 UNBLOCK_INPUT;
7604} 7603}
7605 7604
7606/* If any X protocol errors have arrived since the last call to 7605/* If any X protocol errors have arrived since the last call to
@@ -10345,6 +10344,25 @@ get_bits_and_offset (mask, bits, offset)
10345 *bits = nr; 10344 *bits = nr;
10346} 10345}
10347 10346
10347int
10348x_display_ok (display)
10349 const char * display;
10350{
10351 int dpy_ok = 1;
10352 Display *dpy;
10353
10354 if (!display)
10355 display = getenv("DISPLAY");
10356 if (!display)
10357 return 0;
10358
10359 if ((dpy = XOpenDisplay (display)))
10360 XCloseDisplay (dpy);
10361 else
10362 dpy_ok = 0;
10363 return dpy_ok;
10364}
10365
10348struct x_display_info * 10366struct x_display_info *
10349x_term_init (display_name, xrm_option, resource_name) 10367x_term_init (display_name, xrm_option, resource_name)
10350 Lisp_Object display_name; 10368 Lisp_Object display_name;
diff --git a/src/xterm.h b/src/xterm.h
index ea79d91564f..8e1e06097a8 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 *));