diff options
| author | Miles Bader | 2005-10-07 07:15:40 +0000 |
|---|---|---|
| committer | Miles Bader | 2005-10-07 07:15:40 +0000 |
| commit | 00e18f33adde1d2f196fdf9cadf11235cc4fcc8f (patch) | |
| tree | 8c553c9a361da158ba47f3d0ed0429da180d957f /src | |
| parent | ba4c328314c2b01e6dcc3807a0666a644c3f3954 (diff) | |
| parent | 9e1cb4bc96d36af6e8b893d467970a25afead03b (diff) | |
| download | emacs-00e18f33adde1d2f196fdf9cadf11235cc4fcc8f.tar.gz emacs-00e18f33adde1d2f196fdf9cadf11235cc4fcc8f.zip | |
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-88
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 569-579)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 129-132)
- Update from CVS
- Merge from emacs--cvs-trunk--0
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 108 | ||||
| -rw-r--r-- | src/alloc.c | 50 | ||||
| -rw-r--r-- | src/dired.c | 2 | ||||
| -rw-r--r-- | src/dispextern.h | 1 | ||||
| -rw-r--r-- | src/editfns.c | 4 | ||||
| -rw-r--r-- | src/emacs.c | 4 | ||||
| -rw-r--r-- | src/image.c | 4 | ||||
| -rw-r--r-- | src/keyboard.c | 23 | ||||
| -rw-r--r-- | src/macfns.c | 14 | ||||
| -rw-r--r-- | src/macgui.h | 20 | ||||
| -rw-r--r-- | src/macterm.c | 771 | ||||
| -rw-r--r-- | src/minibuf.c | 26 | ||||
| -rw-r--r-- | src/process.c | 2 | ||||
| -rw-r--r-- | src/regex.c | 4 | ||||
| -rw-r--r-- | src/regex.h | 5 | ||||
| -rw-r--r-- | src/systime.h | 8 | ||||
| -rw-r--r-- | src/unexelf.c | 2 | ||||
| -rw-r--r-- | src/window.c | 80 | ||||
| -rw-r--r-- | src/xdisp.c | 3 | ||||
| -rw-r--r-- | src/xfaces.c | 19 | ||||
| -rw-r--r-- | src/xsmfns.c | 2 | ||||
| -rw-r--r-- | src/xterm.c | 4 |
22 files changed, 939 insertions, 217 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index cd25ba97e90..172700a810b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,107 @@ | |||
| 1 | 2005-10-04 Kim F. Storm <storm@cua.dk> | ||
| 2 | |||
| 3 | * window.c (window_split_tree): New function. | ||
| 4 | (Fwindow_split_tree): New defun. | ||
| 5 | (syms_of_window): Defsubr it. | ||
| 6 | |||
| 7 | 2005-10-04 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 8 | |||
| 9 | * macterm.c (mac_invert_rectangle): New function. | ||
| 10 | (XTflash): Use it. | ||
| 11 | |||
| 12 | 2005-10-04 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 13 | |||
| 14 | * regex.h (re_char): Don't expose it in the interface. | ||
| 15 | (re_set_whitespace_regexp): Adjust the arg's type to not use it. | ||
| 16 | |||
| 17 | * regex.c (re_char): Move it back here. | ||
| 18 | (re_set_whitespace_regexp): Change the arg's type to not use it. | ||
| 19 | |||
| 20 | * keyboard.c (make_lispy_event): If point has moved between down and up | ||
| 21 | event, make it a drag, not a click, to mirror what | ||
| 22 | mouse-drag-region expects. | ||
| 23 | |||
| 24 | 2005-10-02 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 25 | |||
| 26 | * lisp.h (fatal): Undo previous change. | ||
| 27 | * term.c (fatal): Undo previous change. | ||
| 28 | |||
| 29 | 2005-10-01 Richard M. Stallman <rms@gnu.org> | ||
| 30 | |||
| 31 | * xfaces.c (face_color_gray_p): Colors close to black count as gray. | ||
| 32 | |||
| 33 | 2005-10-01 Kim F. Storm <storm@cua.dk> | ||
| 34 | |||
| 35 | * xdisp.c (try_window): Skip scroll-margin check if ZV is visible. | ||
| 36 | |||
| 37 | 2005-10-01 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 38 | |||
| 39 | * keyboard.c (init_keyboard) [MAC_OSX]: Don't install SIGINT handler. | ||
| 40 | |||
| 41 | * macfns.c (start_hourglass): Apply 2005-05-07 change for xfns.c. | ||
| 42 | (x_create_tip_frame) [GLYPH_DEBUG]: Uncomment debug code. | ||
| 43 | (Fx_create_frame, x_create_tip_frame) [USE_ATSUI]: | ||
| 44 | Try ATSUI-compatible 12pt Monaco font first. | ||
| 45 | |||
| 46 | * macgui.h (struct _XCharStruct): New member valid_p. | ||
| 47 | (STORE_XCHARSTRUCT): Set valid_p. | ||
| 48 | (struct MacFontStruct) [USE_ATSUI]: New member mac_style. | ||
| 49 | |||
| 50 | * macterm.c (mac_draw_string_common, x_per_char_metric) | ||
| 51 | (mac_compute_glyph_string_overhangs, init_font_name_table) | ||
| 52 | (XLoadQueryFont, mac_unload_font) [USE_ATSUI]: Add ATSUI support. | ||
| 53 | (atsu_get_text_layout_with_text_ptr) [USE_ATSUI]: New function. | ||
| 54 | (x_draw_glyph_string_background) | ||
| 55 | (x_draw_glyph_string_foreground) [MAC_OS8 && USE_ATSUI]: Don't use | ||
| 56 | XDrawImageString. Always draw background and foreground separately. | ||
| 57 | (x_draw_glyph_string_foreground) [USE_ATSUI]: Don't use 8-bit | ||
| 58 | functions for one-byte chars when using ATSUI-compatible fonts. | ||
| 59 | (atsu_font_id_hash) [USE_ATSUI]: New variable. | ||
| 60 | (syms_of_macterm) [USE_ATSUI]: Initialize and staticpro it. | ||
| 61 | (XLoadQueryFont): Set min_byte1, max_byte1, min_char_or_byte2, and | ||
| 62 | max_char_or_byte2 more in detail. | ||
| 63 | (quit_char_comp, mac_check_for_quit_char) [MAC_OSX]: Remove functions. | ||
| 64 | |||
| 65 | 2005-09-30 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 66 | |||
| 67 | * image.c (slurp_file, xbm_read_bitmap_data): Cast to the correct type. | ||
| 68 | * xterm.c (handle_one_xevent, handle_one_xevent): Likewise. | ||
| 69 | |||
| 70 | * unexelf.c (fatal): Fix prototype. | ||
| 71 | |||
| 72 | * term.c (fatal): Implement using varargs. | ||
| 73 | |||
| 74 | * regex.c (re_char): Move typedef ... | ||
| 75 | * regex.h (re_char): ... here. | ||
| 76 | (re_iswctype, re_wctype, re_set_whitespace_regexp): New prototypes. | ||
| 77 | |||
| 78 | * emacs.c (malloc_set_state): Fix return type. | ||
| 79 | (endif): Fix type. | ||
| 80 | |||
| 81 | * lisp.h (fatal): Add argument types. | ||
| 82 | |||
| 83 | * dispextern.h (fatal): Delete prototype. | ||
| 84 | |||
| 85 | * systime.h: (make_time): Prototype moved from ... | ||
| 86 | * editfns.c (make_time): ... here. | ||
| 87 | |||
| 88 | * editfns.c: Move systime.h include after lisp.h. | ||
| 89 | * dired.c: | ||
| 90 | * xsmfns.c: | ||
| 91 | * process.c: Likewise. | ||
| 92 | |||
| 93 | * alloc.c (old_malloc_hook, old_realloc_hook, old_realloc_hook): | ||
| 94 | Add parameter types. | ||
| 95 | (__malloc_hook, __realloc_hook, __free_hook): Fix prototypes. | ||
| 96 | (emacs_blocked_free): Change definition to match __free_hook. | ||
| 97 | (emacs_blocked_malloc): Change definition to match __malloc_hook. | ||
| 98 | (emacs_blocked_realloc): Change definition to match __realloc_hook. | ||
| 99 | |||
| 100 | 2005-09-30 Romain Francoise <romain@orebokech.com> | ||
| 101 | |||
| 102 | * minibuf.c (Fread_buffer): Follow convention for reading from the | ||
| 103 | minibuffer with a default value. Doc fix. | ||
| 104 | |||
| 1 | 2005-09-29 Juri Linkov <juri@jurta.org> | 105 | 2005-09-29 Juri Linkov <juri@jurta.org> |
| 2 | 106 | ||
| 3 | * editfns.c (Fmessage, Fmessage_box, Fmessage_or_box): | 107 | * editfns.c (Fmessage, Fmessage_box, Fmessage_or_box): |
| @@ -48,8 +152,8 @@ | |||
| 48 | 152 | ||
| 49 | 2005-09-23 Dan Nicolaescu <dann@ics.uci.edu> | 153 | 2005-09-23 Dan Nicolaescu <dann@ics.uci.edu> |
| 50 | 154 | ||
| 51 | * s/aix4-2.h (BROKEN_GET_CURRENT_DIR_NAME): Define | 155 | * s/aix4-2.h (BROKEN_GET_CURRENT_DIR_NAME): |
| 52 | BROKEN_GET_CURRENT_DIR_NAME. | 156 | Define BROKEN_GET_CURRENT_DIR_NAME. |
| 53 | 157 | ||
| 54 | * sysdep.c (get_current_dir_name): Also define if | 158 | * sysdep.c (get_current_dir_name): Also define if |
| 55 | BROKEN_GET_CURRENT_DIR_NAME. | 159 | BROKEN_GET_CURRENT_DIR_NAME. |
diff --git a/src/alloc.c b/src/alloc.c index 35bdfc8a93a..5d8b1c1a359 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -547,6 +547,21 @@ DEFUN ("memory-full-p", Fmemory_full_p, Smemory_full_p, 0, 0, 0, | |||
| 547 | return (spare_memory ? Qnil : Qt); | 547 | return (spare_memory ? Qnil : Qt); |
| 548 | } | 548 | } |
| 549 | 549 | ||
| 550 | /* If we released our reserve (due to running out of memory), | ||
| 551 | and we have a fair amount free once again, | ||
| 552 | try to set aside another reserve in case we run out once more. | ||
| 553 | |||
| 554 | This is called when a relocatable block is freed in ralloc.c. */ | ||
| 555 | |||
| 556 | void | ||
| 557 | refill_memory_reserve () | ||
| 558 | { | ||
| 559 | #ifndef SYSTEM_MALLOC | ||
| 560 | if (spare_memory == 0) | ||
| 561 | spare_memory = (char *) malloc ((size_t) SPARE_MEMORY); | ||
| 562 | #endif | ||
| 563 | } | ||
| 564 | |||
| 550 | /* Called if we can't allocate relocatable space for a buffer. */ | 565 | /* Called if we can't allocate relocatable space for a buffer. */ |
| 551 | 566 | ||
| 552 | void | 567 | void |
| @@ -1134,20 +1149,6 @@ allocate_buffer () | |||
| 1134 | 1149 | ||
| 1135 | #ifndef SYSTEM_MALLOC | 1150 | #ifndef SYSTEM_MALLOC |
| 1136 | 1151 | ||
| 1137 | /* If we released our reserve (due to running out of memory), | ||
| 1138 | and we have a fair amount free once again, | ||
| 1139 | try to set aside another reserve in case we run out once more. | ||
| 1140 | |||
| 1141 | This is called when a relocatable block is freed in ralloc.c. */ | ||
| 1142 | |||
| 1143 | void | ||
| 1144 | refill_memory_reserve () | ||
| 1145 | { | ||
| 1146 | if (spare_memory == 0) | ||
| 1147 | spare_memory = (char *) malloc ((size_t) SPARE_MEMORY); | ||
| 1148 | } | ||
| 1149 | |||
| 1150 | |||
| 1151 | /* Arranging to disable input signals while we're in malloc. | 1152 | /* Arranging to disable input signals while we're in malloc. |
| 1152 | 1153 | ||
| 1153 | This only works with GNU malloc. To help out systems which can't | 1154 | This only works with GNU malloc. To help out systems which can't |
| @@ -1161,20 +1162,21 @@ refill_memory_reserve () | |||
| 1161 | #ifndef SYNC_INPUT | 1162 | #ifndef SYNC_INPUT |
| 1162 | 1163 | ||
| 1163 | #ifndef DOUG_LEA_MALLOC | 1164 | #ifndef DOUG_LEA_MALLOC |
| 1164 | extern void * (*__malloc_hook) P_ ((size_t)); | 1165 | extern void * (*__malloc_hook) P_ ((size_t, const void *)); |
| 1165 | extern void * (*__realloc_hook) P_ ((void *, size_t)); | 1166 | extern void * (*__realloc_hook) P_ ((void *, size_t, const void *)); |
| 1166 | extern void (*__free_hook) P_ ((void *)); | 1167 | extern void (*__free_hook) P_ ((void *, const void *)); |
| 1167 | /* Else declared in malloc.h, perhaps with an extra arg. */ | 1168 | /* Else declared in malloc.h, perhaps with an extra arg. */ |
| 1168 | #endif /* DOUG_LEA_MALLOC */ | 1169 | #endif /* DOUG_LEA_MALLOC */ |
| 1169 | static void * (*old_malloc_hook) (); | 1170 | static void * (*old_malloc_hook) P_ ((size_t, const void *)); |
| 1170 | static void * (*old_realloc_hook) (); | 1171 | static void * (*old_realloc_hook) P_ ((void *, size_t, const void*)); |
| 1171 | static void (*old_free_hook) (); | 1172 | static void (*old_free_hook) P_ ((void*, const void*)); |
| 1172 | 1173 | ||
| 1173 | /* This function is used as the hook for free to call. */ | 1174 | /* This function is used as the hook for free to call. */ |
| 1174 | 1175 | ||
| 1175 | static void | 1176 | static void |
| 1176 | emacs_blocked_free (ptr) | 1177 | emacs_blocked_free (ptr, ptr2) |
| 1177 | void *ptr; | 1178 | void *ptr; |
| 1179 | const void *ptr2; | ||
| 1178 | { | 1180 | { |
| 1179 | BLOCK_INPUT_ALLOC; | 1181 | BLOCK_INPUT_ALLOC; |
| 1180 | 1182 | ||
| @@ -1221,8 +1223,9 @@ emacs_blocked_free (ptr) | |||
| 1221 | /* This function is the malloc hook that Emacs uses. */ | 1223 | /* This function is the malloc hook that Emacs uses. */ |
| 1222 | 1224 | ||
| 1223 | static void * | 1225 | static void * |
| 1224 | emacs_blocked_malloc (size) | 1226 | emacs_blocked_malloc (size, ptr) |
| 1225 | size_t size; | 1227 | size_t size; |
| 1228 | const void *ptr; | ||
| 1226 | { | 1229 | { |
| 1227 | void *value; | 1230 | void *value; |
| 1228 | 1231 | ||
| @@ -1268,9 +1271,10 @@ emacs_blocked_malloc (size) | |||
| 1268 | /* This function is the realloc hook that Emacs uses. */ | 1271 | /* This function is the realloc hook that Emacs uses. */ |
| 1269 | 1272 | ||
| 1270 | static void * | 1273 | static void * |
| 1271 | emacs_blocked_realloc (ptr, size) | 1274 | emacs_blocked_realloc (ptr, size, ptr2) |
| 1272 | void *ptr; | 1275 | void *ptr; |
| 1273 | size_t size; | 1276 | size_t size; |
| 1277 | const void *ptr2; | ||
| 1274 | { | 1278 | { |
| 1275 | void *value; | 1279 | void *value; |
| 1276 | 1280 | ||
diff --git a/src/dired.c b/src/dired.c index 4725644ee33..eca05cde0db 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -33,7 +33,6 @@ Boston, MA 02110-1301, USA. */ | |||
| 33 | #include <grp.h> | 33 | #include <grp.h> |
| 34 | #endif | 34 | #endif |
| 35 | 35 | ||
| 36 | #include "systime.h" | ||
| 37 | #include <errno.h> | 36 | #include <errno.h> |
| 38 | 37 | ||
| 39 | #ifdef VMS | 38 | #ifdef VMS |
| @@ -93,6 +92,7 @@ extern struct direct *readdir (); | |||
| 93 | #endif | 92 | #endif |
| 94 | 93 | ||
| 95 | #include "lisp.h" | 94 | #include "lisp.h" |
| 95 | #include "systime.h" | ||
| 96 | #include "buffer.h" | 96 | #include "buffer.h" |
| 97 | #include "commands.h" | 97 | #include "commands.h" |
| 98 | #include "character.h" | 98 | #include "character.h" |
diff --git a/src/dispextern.h b/src/dispextern.h index e6e61ac45fb..db9cd53d042 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2940,7 +2940,6 @@ extern void calculate_costs P_ ((struct frame *)); | |||
| 2940 | extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object)); | 2940 | extern void set_tty_color_mode P_ ((struct frame *, Lisp_Object)); |
| 2941 | extern void tty_setup_colors P_ ((int)); | 2941 | extern void tty_setup_colors P_ ((int)); |
| 2942 | extern void term_init P_ ((char *)); | 2942 | extern void term_init P_ ((char *)); |
| 2943 | extern void fatal P_ ((/* char *, ... */)); | ||
| 2944 | void cursor_to P_ ((int, int)); | 2943 | void cursor_to P_ ((int, int)); |
| 2945 | extern int tty_capable_p P_ ((struct frame *, unsigned, unsigned long, unsigned long)); | 2944 | extern int tty_capable_p P_ ((struct frame *, unsigned, unsigned long, unsigned long)); |
| 2946 | 2945 | ||
diff --git a/src/editfns.c b/src/editfns.c index 2fa6ffcca5c..dad41b3d05d 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -37,6 +37,8 @@ Boston, MA 02110-1301, USA. */ | |||
| 37 | #include <sys/utsname.h> | 37 | #include <sys/utsname.h> |
| 38 | #endif | 38 | #endif |
| 39 | 39 | ||
| 40 | #include "lisp.h" | ||
| 41 | |||
| 40 | /* systime.h includes <sys/time.h> which, on some systems, is required | 42 | /* systime.h includes <sys/time.h> which, on some systems, is required |
| 41 | for <sys/resource.h>; thus systime.h must be included before | 43 | for <sys/resource.h>; thus systime.h must be included before |
| 42 | <sys/resource.h> */ | 44 | <sys/resource.h> */ |
| @@ -48,7 +50,6 @@ Boston, MA 02110-1301, USA. */ | |||
| 48 | 50 | ||
| 49 | #include <ctype.h> | 51 | #include <ctype.h> |
| 50 | 52 | ||
| 51 | #include "lisp.h" | ||
| 52 | #include "intervals.h" | 53 | #include "intervals.h" |
| 53 | #include "buffer.h" | 54 | #include "buffer.h" |
| 54 | #include "character.h" | 55 | #include "character.h" |
| @@ -71,7 +72,6 @@ Boston, MA 02110-1301, USA. */ | |||
| 71 | extern char **environ; | 72 | extern char **environ; |
| 72 | #endif | 73 | #endif |
| 73 | 74 | ||
| 74 | extern Lisp_Object make_time P_ ((time_t)); | ||
| 75 | extern size_t emacs_strftimeu P_ ((char *, size_t, const char *, | 75 | extern size_t emacs_strftimeu P_ ((char *, size_t, const char *, |
| 76 | const struct tm *, int)); | 76 | const struct tm *, int)); |
| 77 | static int tm_diff P_ ((struct tm *, struct tm *)); | 77 | static int tm_diff P_ ((struct tm *, struct tm *)); |
diff --git a/src/emacs.c b/src/emacs.c index c74e729bf6a..a4416354c12 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -148,7 +148,7 @@ void *malloc_state_ptr; | |||
| 148 | /* From glibc, a routine that returns a copy of the malloc internal state. */ | 148 | /* From glibc, a routine that returns a copy of the malloc internal state. */ |
| 149 | extern void *malloc_get_state (); | 149 | extern void *malloc_get_state (); |
| 150 | /* From glibc, a routine that overwrites the malloc internal state. */ | 150 | /* From glibc, a routine that overwrites the malloc internal state. */ |
| 151 | extern void malloc_set_state (); | 151 | extern int malloc_set_state (); |
| 152 | /* Non-zero if the MALLOC_CHECK_ enviroment variable was set while | 152 | /* Non-zero if the MALLOC_CHECK_ enviroment variable was set while |
| 153 | dumping. Used to work around a bug in glibc's malloc. */ | 153 | dumping. Used to work around a bug in glibc's malloc. */ |
| 154 | int malloc_using_checking; | 154 | int malloc_using_checking; |
| @@ -1001,7 +1001,7 @@ main (argc, argv | |||
| 1001 | && !getrlimit (RLIMIT_STACK, &rlim)) | 1001 | && !getrlimit (RLIMIT_STACK, &rlim)) |
| 1002 | { | 1002 | { |
| 1003 | long newlim; | 1003 | long newlim; |
| 1004 | extern int re_max_failures; | 1004 | extern size_t re_max_failures; |
| 1005 | /* Approximate the amount regex.c needs per unit of re_max_failures. */ | 1005 | /* Approximate the amount regex.c needs per unit of re_max_failures. */ |
| 1006 | int ratio = 20 * sizeof (char *); | 1006 | int ratio = 20 * sizeof (char *); |
| 1007 | /* Then add 33% to cover the size of the smaller stacks that regex.c | 1007 | /* Then add 33% to cover the size of the smaller stacks that regex.c |
diff --git a/src/image.c b/src/image.c index bdc78c2d718..3b6969b0c28 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -2178,7 +2178,7 @@ slurp_file (file, size) | |||
| 2178 | 2178 | ||
| 2179 | if (stat (file, &st) == 0 | 2179 | if (stat (file, &st) == 0 |
| 2180 | && (fp = fopen (file, "rb")) != NULL | 2180 | && (fp = fopen (file, "rb")) != NULL |
| 2181 | && (buf = (char *) xmalloc (st.st_size), | 2181 | && (buf = (unsigned char *) xmalloc (st.st_size), |
| 2182 | fread (buf, 1, st.st_size, fp) == st.st_size)) | 2182 | fread (buf, 1, st.st_size, fp) == st.st_size)) |
| 2183 | { | 2183 | { |
| 2184 | *size = st.st_size; | 2184 | *size = st.st_size; |
| @@ -3029,7 +3029,7 @@ xbm_read_bitmap_data (contents, end, width, height, data) | |||
| 3029 | 3029 | ||
| 3030 | bytes_per_line = (*width + 7) / 8 + padding_p; | 3030 | bytes_per_line = (*width + 7) / 8 + padding_p; |
| 3031 | nbytes = bytes_per_line * *height; | 3031 | nbytes = bytes_per_line * *height; |
| 3032 | p = *data = (char *) xmalloc (nbytes); | 3032 | p = *data = (unsigned char *) xmalloc (nbytes); |
| 3033 | 3033 | ||
| 3034 | if (v10) | 3034 | if (v10) |
| 3035 | { | 3035 | { |
diff --git a/src/keyboard.c b/src/keyboard.c index 3eabf6a5a8a..97d4509eeb6 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -5506,13 +5506,23 @@ make_lispy_event (event) | |||
| 5506 | if (CONSP (down) | 5506 | if (CONSP (down) |
| 5507 | && INTEGERP (XCAR (down)) && INTEGERP (XCDR (down))) | 5507 | && INTEGERP (XCAR (down)) && INTEGERP (XCDR (down))) |
| 5508 | { | 5508 | { |
| 5509 | xdiff = XFASTINT (event->x) - XFASTINT (XCAR (down)); | 5509 | xdiff = XINT (event->x) - XINT (XCAR (down)); |
| 5510 | ydiff = XFASTINT (event->y) - XFASTINT (XCDR (down)); | 5510 | ydiff = XINT (event->y) - XINT (XCDR (down)); |
| 5511 | } | 5511 | } |
| 5512 | 5512 | ||
| 5513 | if (xdiff < double_click_fuzz && xdiff > - double_click_fuzz | 5513 | if (xdiff < double_click_fuzz && xdiff > - double_click_fuzz |
| 5514 | && ydiff < double_click_fuzz | 5514 | && ydiff < double_click_fuzz && ydiff > - double_click_fuzz |
| 5515 | && ydiff > - double_click_fuzz) | 5515 | /* Maybe the mouse has moved a lot, caused scrolling, and |
| 5516 | eventually ended up at the same screen position (but | ||
| 5517 | not buffer position) in which case it is a drag, not | ||
| 5518 | a click. */ | ||
| 5519 | /* FIXME: OTOH if the buffer position has changed | ||
| 5520 | because of a timer or process filter rather than | ||
| 5521 | because of mouse movement, it should be considered as | ||
| 5522 | a click. But mouse-drag-region completely ignores | ||
| 5523 | this case and it hasn't caused any real problem, so | ||
| 5524 | it's probably OK to ignore it as well. */ | ||
| 5525 | && EQ (Fcar (Fcdr (start_pos)), Fcar (Fcdr (position)))) | ||
| 5516 | /* Mouse hasn't moved (much). */ | 5526 | /* Mouse hasn't moved (much). */ |
| 5517 | event->modifiers |= click_modifier; | 5527 | event->modifiers |= click_modifier; |
| 5518 | else | 5528 | else |
| @@ -10741,11 +10751,6 @@ init_keyboard () | |||
| 10741 | poll_suppress_count = 1; | 10751 | poll_suppress_count = 1; |
| 10742 | start_polling (); | 10752 | start_polling (); |
| 10743 | #endif | 10753 | #endif |
| 10744 | |||
| 10745 | #ifdef MAC_OSX | ||
| 10746 | /* At least provide an escape route since C-g doesn't work. */ | ||
| 10747 | signal (SIGINT, interrupt_signal); | ||
| 10748 | #endif | ||
| 10749 | } | 10754 | } |
| 10750 | 10755 | ||
| 10751 | /* This type's only use is in syms_of_keyboard, to initialize the | 10756 | /* This type's only use is in syms_of_keyboard, to initialize the |
diff --git a/src/macfns.c b/src/macfns.c index 9d07dc49049..ecee09189f5 100644 --- a/src/macfns.c +++ b/src/macfns.c | |||
| @@ -2532,6 +2532,10 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 2532 | } | 2532 | } |
| 2533 | 2533 | ||
| 2534 | /* Try out a font which we hope has bold and italic variations. */ | 2534 | /* Try out a font which we hope has bold and italic variations. */ |
| 2535 | #if USE_ATSUI | ||
| 2536 | if (! STRINGP (font)) | ||
| 2537 | font = x_new_font (f, "-*-monaco-medium-r-normal--12-*-*-*-*-*-iso10646-1"); | ||
| 2538 | #endif | ||
| 2535 | if (! STRINGP (font)) | 2539 | if (! STRINGP (font)) |
| 2536 | font = x_new_font (f, "-ETL-fixed-medium-r-*--*-160-*-*-*-*-iso8859-1"); | 2540 | font = x_new_font (f, "-ETL-fixed-medium-r-*--*-160-*-*-*-*-iso8859-1"); |
| 2537 | /* If those didn't work, look for something which will at least work. */ | 2541 | /* If those didn't work, look for something which will at least work. */ |
| @@ -3340,6 +3344,10 @@ start_hourglass () | |||
| 3340 | EMACS_TIME delay; | 3344 | EMACS_TIME delay; |
| 3341 | int secs, usecs = 0; | 3345 | int secs, usecs = 0; |
| 3342 | 3346 | ||
| 3347 | /* Don't bother for ttys. */ | ||
| 3348 | if (NILP (Vwindow_system)) | ||
| 3349 | return; | ||
| 3350 | |||
| 3343 | cancel_hourglass (); | 3351 | cancel_hourglass (); |
| 3344 | 3352 | ||
| 3345 | if (INTEGERP (Vhourglass_delay) | 3353 | if (INTEGERP (Vhourglass_delay) |
| @@ -3586,7 +3594,7 @@ x_create_tip_frame (dpyinfo, parms, text) | |||
| 3586 | FRAME_FONTSET (f) = -1; | 3594 | FRAME_FONTSET (f) = -1; |
| 3587 | f->icon_name = Qnil; | 3595 | f->icon_name = Qnil; |
| 3588 | 3596 | ||
| 3589 | #if 0 /* GLYPH_DEBUG TODO: image support. */ | 3597 | #if GLYPH_DEBUG |
| 3590 | image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount; | 3598 | image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount; |
| 3591 | dpyinfo_refcount = dpyinfo->reference_count; | 3599 | dpyinfo_refcount = dpyinfo->reference_count; |
| 3592 | #endif /* GLYPH_DEBUG */ | 3600 | #endif /* GLYPH_DEBUG */ |
| @@ -3630,6 +3638,10 @@ x_create_tip_frame (dpyinfo, parms, text) | |||
| 3630 | } | 3638 | } |
| 3631 | 3639 | ||
| 3632 | /* Try out a font which we hope has bold and italic variations. */ | 3640 | /* Try out a font which we hope has bold and italic variations. */ |
| 3641 | #if USE_ATSUI | ||
| 3642 | if (! STRINGP (font)) | ||
| 3643 | font = x_new_font (f, "-*-monaco-medium-r-normal--12-*-*-*-*-*-iso10646-1"); | ||
| 3644 | #endif | ||
| 3633 | if (! STRINGP (font)) | 3645 | if (! STRINGP (font)) |
| 3634 | font = x_new_font (f, "-ETL-fixed-medium-r-*--*-160-*-*-*-*-iso8859-1"); | 3646 | font = x_new_font (f, "-ETL-fixed-medium-r-*--*-160-*-*-*-*-iso8859-1"); |
| 3635 | /* If those didn't work, look for something which will at least work. */ | 3647 | /* If those didn't work, look for something which will at least work. */ |
diff --git a/src/macgui.h b/src/macgui.h index fc777de03ba..378dbcd9e5c 100644 --- a/src/macgui.h +++ b/src/macgui.h | |||
| @@ -103,6 +103,7 @@ typedef struct _XCharStruct | |||
| 103 | #if 0 | 103 | #if 0 |
| 104 | unsigned short attributes; /* per char flags (not predefined) */ | 104 | unsigned short attributes; /* per char flags (not predefined) */ |
| 105 | #endif | 105 | #endif |
| 106 | unsigned valid_p : 1; | ||
| 106 | } XCharStruct; | 107 | } XCharStruct; |
| 107 | 108 | ||
| 108 | #define STORE_XCHARSTRUCT(xcs, w, bds) \ | 109 | #define STORE_XCHARSTRUCT(xcs, w, bds) \ |
| @@ -110,7 +111,8 @@ typedef struct _XCharStruct | |||
| 110 | (xcs).lbearing = (bds).left, \ | 111 | (xcs).lbearing = (bds).left, \ |
| 111 | (xcs).rbearing = (bds).right, \ | 112 | (xcs).rbearing = (bds).right, \ |
| 112 | (xcs).ascent = -(bds).top, \ | 113 | (xcs).ascent = -(bds).top, \ |
| 113 | (xcs).descent = (bds).bottom) | 114 | (xcs).descent = (bds).bottom, \ |
| 115 | (xcs).valid_p = 1) | ||
| 114 | 116 | ||
| 115 | struct MacFontStruct { | 117 | struct MacFontStruct { |
| 116 | char *full_name; | 118 | char *full_name; |
| @@ -123,19 +125,9 @@ struct MacFontStruct { | |||
| 123 | #else | 125 | #else |
| 124 | short mac_scriptcode; /* Mac OS script code for font used */ | 126 | short mac_scriptcode; /* Mac OS script code for font used */ |
| 125 | #endif | 127 | #endif |
| 126 | 128 | #if USE_ATSUI | |
| 127 | #if 0 | 129 | ATSUStyle mac_style; /* NULL if QuickDraw Text is used */ |
| 128 | SInt16 mFontNum; /* font number of font used in this window */ | 130 | #endif |
| 129 | short mScriptCode; /* Mac OS script code for font used */ | ||
| 130 | int mFontSize; /* size of font */ | ||
| 131 | Style mFontFace; /* plain, bold, italics, etc. */ | ||
| 132 | int mHeight; /* height of one line of text in pixels */ | ||
| 133 | int mWidth; /* width of one character in pixels */ | ||
| 134 | int mAscent; | ||
| 135 | int mDescent; | ||
| 136 | int mLeading; | ||
| 137 | char mTwoByte; /* true for two-byte font */ | ||
| 138 | #endif /* 0 */ | ||
| 139 | 131 | ||
| 140 | /* from Xlib.h */ | 132 | /* from Xlib.h */ |
| 141 | #if 0 | 133 | #if 0 |
diff --git a/src/macterm.c b/src/macterm.c index 90d6a886db6..8001678ab92 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -660,6 +660,79 @@ mac_draw_rectangle_to_pixmap (display, p, gc, x, y, width, height) | |||
| 660 | #endif | 660 | #endif |
| 661 | 661 | ||
| 662 | 662 | ||
| 663 | #if USE_ATSUI | ||
| 664 | static OSStatus | ||
| 665 | atsu_get_text_layout_with_text_ptr (text, text_length, style, text_layout) | ||
| 666 | ConstUniCharArrayPtr text; | ||
| 667 | UniCharCount text_length; | ||
| 668 | ATSUStyle style; | ||
| 669 | ATSUTextLayout *text_layout; | ||
| 670 | { | ||
| 671 | OSStatus err; | ||
| 672 | static ATSUTextLayout saved_text_layout = NULL; /* not reentrant */ | ||
| 673 | |||
| 674 | if (saved_text_layout == NULL) | ||
| 675 | { | ||
| 676 | UniCharCount lengths[] = {kATSUToTextEnd}; | ||
| 677 | ATSUAttributeTag tags[] = {kATSULineLayoutOptionsTag}; | ||
| 678 | ByteCount sizes[] = {sizeof (ATSLineLayoutOptions)}; | ||
| 679 | static ATSLineLayoutOptions line_layout = | ||
| 680 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 | ||
| 681 | kATSLineDisableAllLayoutOperations | kATSLineUseDeviceMetrics | ||
| 682 | #else | ||
| 683 | kATSLineIsDisplayOnly | ||
| 684 | #endif | ||
| 685 | ; | ||
| 686 | ATSUAttributeValuePtr values[] = {&line_layout}; | ||
| 687 | |||
| 688 | err = ATSUCreateTextLayoutWithTextPtr (text, | ||
| 689 | kATSUFromTextBeginning, | ||
| 690 | kATSUToTextEnd, | ||
| 691 | text_length, | ||
| 692 | 1, lengths, &style, | ||
| 693 | &saved_text_layout); | ||
| 694 | if (err == noErr) | ||
| 695 | err = ATSUSetLayoutControls (saved_text_layout, | ||
| 696 | sizeof (tags) / sizeof (tags[0]), | ||
| 697 | tags, sizes, values); | ||
| 698 | /* XXX: Should we do this? */ | ||
| 699 | if (err == noErr) | ||
| 700 | err = ATSUSetTransientFontMatching (saved_text_layout, true); | ||
| 701 | } | ||
| 702 | else | ||
| 703 | { | ||
| 704 | err = ATSUSetRunStyle (saved_text_layout, style, | ||
| 705 | kATSUFromTextBeginning, kATSUToTextEnd); | ||
| 706 | if (err == noErr) | ||
| 707 | err = ATSUSetTextPointerLocation (saved_text_layout, text, | ||
| 708 | kATSUFromTextBeginning, | ||
| 709 | kATSUToTextEnd, | ||
| 710 | text_length); | ||
| 711 | } | ||
| 712 | |||
| 713 | if (err == noErr) | ||
| 714 | *text_layout = saved_text_layout; | ||
| 715 | return err; | ||
| 716 | } | ||
| 717 | #endif | ||
| 718 | |||
| 719 | static void | ||
| 720 | mac_invert_rectangle (display, w, x, y, width, height) | ||
| 721 | Display *display; | ||
| 722 | WindowPtr w; | ||
| 723 | int x, y; | ||
| 724 | unsigned int width, height; | ||
| 725 | { | ||
| 726 | Rect r; | ||
| 727 | |||
| 728 | SetPortWindowPort (w); | ||
| 729 | |||
| 730 | SetRect (&r, x, y, x + width, y + height); | ||
| 731 | |||
| 732 | InvertRect (&r); | ||
| 733 | } | ||
| 734 | |||
| 735 | |||
| 663 | static void | 736 | static void |
| 664 | mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, | 737 | mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, |
| 665 | bytes_per_char) | 738 | bytes_per_char) |
| @@ -684,6 +757,89 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, | |||
| 684 | if (mode != srcOr) | 757 | if (mode != srcOr) |
| 685 | RGBBackColor (GC_BACK_COLOR (gc)); | 758 | RGBBackColor (GC_BACK_COLOR (gc)); |
| 686 | 759 | ||
| 760 | #if USE_ATSUI | ||
| 761 | if (GC_FONT (gc)->mac_style) | ||
| 762 | { | ||
| 763 | OSErr err; | ||
| 764 | ATSUTextLayout text_layout; | ||
| 765 | |||
| 766 | xassert (bytes_per_char == 2); | ||
| 767 | |||
| 768 | #ifndef WORDS_BIG_ENDIAN | ||
| 769 | { | ||
| 770 | int i; | ||
| 771 | Unichar *text = (Unichar *)buf; | ||
| 772 | |||
| 773 | for (i = 0; i < nchars; i++) | ||
| 774 | text[i] = buf[2*i] << 8 | buf[2*i+1]; | ||
| 775 | } | ||
| 776 | #endif | ||
| 777 | err = atsu_get_text_layout_with_text_ptr ((ConstUniCharArrayPtr)buf, | ||
| 778 | nchars, | ||
| 779 | GC_FONT (gc)->mac_style, | ||
| 780 | &text_layout); | ||
| 781 | if (err == noErr) | ||
| 782 | { | ||
| 783 | #ifdef MAC_OSX | ||
| 784 | if (NILP (Vmac_use_core_graphics)) | ||
| 785 | { | ||
| 786 | #endif | ||
| 787 | MoveTo (x, y); | ||
| 788 | ATSUDrawText (text_layout, | ||
| 789 | kATSUFromTextBeginning, kATSUToTextEnd, | ||
| 790 | kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc); | ||
| 791 | #ifdef MAC_OSX | ||
| 792 | } | ||
| 793 | else | ||
| 794 | { | ||
| 795 | CGrafPtr port; | ||
| 796 | CGContextRef context; | ||
| 797 | Rect rect; | ||
| 798 | RgnHandle region = NewRgn (); | ||
| 799 | float port_height; | ||
| 800 | ATSUAttributeTag tags[] = {kATSUCGContextTag}; | ||
| 801 | ByteCount sizes[] = {sizeof (CGContextRef)}; | ||
| 802 | ATSUAttributeValuePtr values[] = {&context}; | ||
| 803 | |||
| 804 | GetPort (&port); | ||
| 805 | QDBeginCGContext (port, &context); | ||
| 806 | GetPortBounds (port, &rect); | ||
| 807 | port_height = rect.bottom - rect.top; | ||
| 808 | GetClip (region); | ||
| 809 | GetRegionBounds (region, &rect); | ||
| 810 | /* XXX: This is not correct if the clip region is not a | ||
| 811 | simple rectangle. */ | ||
| 812 | CGContextClipToRect (context, | ||
| 813 | CGRectMake (rect.left, | ||
| 814 | port_height - rect.bottom, | ||
| 815 | rect.right - rect.left, | ||
| 816 | rect.bottom - rect.top)); | ||
| 817 | DisposeRgn (region); | ||
| 818 | CGContextSetRGBFillColor | ||
| 819 | (context, | ||
| 820 | RED_FROM_ULONG (gc->xgcv.foreground) / 255.0, | ||
| 821 | GREEN_FROM_ULONG (gc->xgcv.foreground) / 255.0, | ||
| 822 | BLUE_FROM_ULONG (gc->xgcv.foreground) / 255.0, | ||
| 823 | 1.0); | ||
| 824 | err = ATSUSetLayoutControls (text_layout, | ||
| 825 | sizeof (tags) / sizeof (tags[0]), | ||
| 826 | tags, sizes, values); | ||
| 827 | if (err == noErr) | ||
| 828 | ATSUDrawText (text_layout, | ||
| 829 | kATSUFromTextBeginning, kATSUToTextEnd, | ||
| 830 | Long2Fix (x), Long2Fix (port_height - y)); | ||
| 831 | ATSUClearLayoutControls (text_layout, | ||
| 832 | sizeof (tags) / sizeof (tags[0]), | ||
| 833 | tags); | ||
| 834 | CGContextSynchronize (context); | ||
| 835 | QDEndCGContext (port, &context); | ||
| 836 | } | ||
| 837 | #endif | ||
| 838 | } | ||
| 839 | } | ||
| 840 | else | ||
| 841 | { | ||
| 842 | #endif | ||
| 687 | TextFont (GC_FONT (gc)->mac_fontnum); | 843 | TextFont (GC_FONT (gc)->mac_fontnum); |
| 688 | TextSize (GC_FONT (gc)->mac_fontsize); | 844 | TextSize (GC_FONT (gc)->mac_fontsize); |
| 689 | TextFace (GC_FONT (gc)->mac_fontface); | 845 | TextFace (GC_FONT (gc)->mac_fontface); |
| @@ -691,6 +847,9 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, | |||
| 691 | 847 | ||
| 692 | MoveTo (x, y); | 848 | MoveTo (x, y); |
| 693 | DrawText (buf, 0, nchars * bytes_per_char); | 849 | DrawText (buf, 0, nchars * bytes_per_char); |
| 850 | #if USE_ATSUI | ||
| 851 | } | ||
| 852 | #endif | ||
| 694 | 853 | ||
| 695 | if (mode != srcOr) | 854 | if (mode != srcOr) |
| 696 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (w))); | 855 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (w))); |
| @@ -1552,6 +1711,61 @@ x_per_char_metric (font, char2b) | |||
| 1552 | 1711 | ||
| 1553 | xassert (font && char2b); | 1712 | xassert (font && char2b); |
| 1554 | 1713 | ||
| 1714 | #if USE_ATSUI | ||
| 1715 | if (font->mac_style) | ||
| 1716 | { | ||
| 1717 | if (char2b->byte1 >= font->min_byte1 | ||
| 1718 | && char2b->byte1 <= font->max_byte1 | ||
| 1719 | && char2b->byte2 >= font->min_char_or_byte2 | ||
| 1720 | && char2b->byte2 <= font->max_char_or_byte2) | ||
| 1721 | { | ||
| 1722 | pcm = (font->per_char | ||
| 1723 | + ((font->max_char_or_byte2 - font->min_char_or_byte2 + 1) | ||
| 1724 | * (char2b->byte1 - font->min_byte1)) | ||
| 1725 | + (char2b->byte2 - font->min_char_or_byte2)); | ||
| 1726 | } | ||
| 1727 | |||
| 1728 | if (pcm && !pcm->valid_p) | ||
| 1729 | { | ||
| 1730 | OSErr err; | ||
| 1731 | ATSUTextLayout text_layout; | ||
| 1732 | UniChar c; | ||
| 1733 | int char_width; | ||
| 1734 | ATSTrapezoid glyph_bounds; | ||
| 1735 | Rect char_bounds; | ||
| 1736 | |||
| 1737 | c = (char2b->byte1 << 8) + char2b->byte2; | ||
| 1738 | BLOCK_INPUT; | ||
| 1739 | err = atsu_get_text_layout_with_text_ptr (&c, 1, | ||
| 1740 | font->mac_style, | ||
| 1741 | &text_layout); | ||
| 1742 | if (err == noErr) | ||
| 1743 | err = ATSUMeasureTextImage (text_layout, | ||
| 1744 | kATSUFromTextBeginning, kATSUToTextEnd, | ||
| 1745 | 0, 0, &char_bounds); | ||
| 1746 | |||
| 1747 | if (err == noErr) | ||
| 1748 | err = ATSUGetGlyphBounds (text_layout, 0, 0, | ||
| 1749 | kATSUFromTextBeginning, kATSUToTextEnd, | ||
| 1750 | kATSUseFractionalOrigins, 1, | ||
| 1751 | &glyph_bounds, NULL); | ||
| 1752 | UNBLOCK_INPUT; | ||
| 1753 | if (err != noErr) | ||
| 1754 | pcm = NULL; | ||
| 1755 | else | ||
| 1756 | { | ||
| 1757 | xassert (glyph_bounds.lowerRight.x - glyph_bounds.lowerLeft.x | ||
| 1758 | == glyph_bounds.upperRight.x - glyph_bounds.upperLeft.x); | ||
| 1759 | |||
| 1760 | char_width = Fix2Long (glyph_bounds.upperRight.x | ||
| 1761 | - glyph_bounds.upperLeft.x); | ||
| 1762 | STORE_XCHARSTRUCT (*pcm, char_width, char_bounds); | ||
| 1763 | } | ||
| 1764 | } | ||
| 1765 | } | ||
| 1766 | else | ||
| 1767 | { | ||
| 1768 | #endif | ||
| 1555 | if (font->per_char != NULL) | 1769 | if (font->per_char != NULL) |
| 1556 | { | 1770 | { |
| 1557 | if (font->min_byte1 == 0 && font->max_byte1 == 0) | 1771 | if (font->min_byte1 == 0 && font->max_byte1 == 0) |
| @@ -1603,6 +1817,9 @@ x_per_char_metric (font, char2b) | |||
| 1603 | && char2b->byte2 <= font->max_char_or_byte2) | 1817 | && char2b->byte2 <= font->max_char_or_byte2) |
| 1604 | pcm = &font->max_bounds; | 1818 | pcm = &font->max_bounds; |
| 1605 | } | 1819 | } |
| 1820 | #if USE_ATSUI | ||
| 1821 | } | ||
| 1822 | #endif | ||
| 1606 | 1823 | ||
| 1607 | return ((pcm == NULL | 1824 | return ((pcm == NULL |
| 1608 | || (pcm->width == 0 && (pcm->rbearing - pcm->lbearing) == 0)) | 1825 | || (pcm->width == 0 && (pcm->rbearing - pcm->lbearing) == 0)) |
| @@ -1930,6 +2147,35 @@ mac_compute_glyph_string_overhangs (s) | |||
| 1930 | Rect r; | 2147 | Rect r; |
| 1931 | MacFontStruct *font = s->font; | 2148 | MacFontStruct *font = s->font; |
| 1932 | 2149 | ||
| 2150 | #if USE_ATSUI | ||
| 2151 | if (font->mac_style) | ||
| 2152 | { | ||
| 2153 | OSErr err; | ||
| 2154 | ATSUTextLayout text_layout; | ||
| 2155 | UniChar *buf; | ||
| 2156 | int i; | ||
| 2157 | |||
| 2158 | SetRect (&r, 0, 0, 0, 0); | ||
| 2159 | buf = xmalloc (sizeof (UniChar) * s->nchars); | ||
| 2160 | if (buf) | ||
| 2161 | { | ||
| 2162 | for (i = 0; i < s->nchars; i++) | ||
| 2163 | buf[i] = (s->char2b[i].byte1 << 8) + s->char2b[i].byte2; | ||
| 2164 | |||
| 2165 | err = atsu_get_text_layout_with_text_ptr (buf, s->nchars, | ||
| 2166 | font->mac_style, | ||
| 2167 | &text_layout); | ||
| 2168 | if (err == noErr) | ||
| 2169 | err = ATSUMeasureTextImage (text_layout, | ||
| 2170 | kATSUFromTextBeginning, | ||
| 2171 | kATSUToTextEnd, | ||
| 2172 | 0, 0, &r); | ||
| 2173 | xfree (buf); | ||
| 2174 | } | ||
| 2175 | } | ||
| 2176 | else | ||
| 2177 | { | ||
| 2178 | #endif | ||
| 1933 | TextFont (font->mac_fontnum); | 2179 | TextFont (font->mac_fontnum); |
| 1934 | TextSize (font->mac_fontsize); | 2180 | TextSize (font->mac_fontsize); |
| 1935 | TextFace (font->mac_fontface); | 2181 | TextFace (font->mac_fontface); |
| @@ -1951,6 +2197,9 @@ mac_compute_glyph_string_overhangs (s) | |||
| 1951 | xfree (buf); | 2197 | xfree (buf); |
| 1952 | } | 2198 | } |
| 1953 | } | 2199 | } |
| 2200 | #if USE_ATSUI | ||
| 2201 | } | ||
| 2202 | #endif | ||
| 1954 | 2203 | ||
| 1955 | s->right_overhang = r.right > s->width ? r.right - s->width : 0; | 2204 | s->right_overhang = r.right > s->width ? r.right - s->width : 0; |
| 1956 | s->left_overhang = r.left < 0 ? -r.left : 0; | 2205 | s->left_overhang = r.left < 0 ? -r.left : 0; |
| @@ -2008,7 +2257,7 @@ x_draw_glyph_string_background (s, force_p) | |||
| 2008 | } | 2257 | } |
| 2009 | else | 2258 | else |
| 2010 | #endif | 2259 | #endif |
| 2011 | #ifdef MAC_OS8 | 2260 | #if defined (MAC_OS8) && !USE_ATSUI |
| 2012 | if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width | 2261 | if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width |
| 2013 | || s->font_not_found_p | 2262 | || s->font_not_found_p |
| 2014 | || s->extends_to_end_of_line_p | 2263 | || s->extends_to_end_of_line_p |
| @@ -2062,11 +2311,15 @@ x_draw_glyph_string_foreground (s) | |||
| 2062 | boff = VCENTER_BASELINE_OFFSET (s->font, s->f) - boff; | 2311 | boff = VCENTER_BASELINE_OFFSET (s->font, s->f) - boff; |
| 2063 | 2312 | ||
| 2064 | /* If we can use 8-bit functions, condense S->char2b. */ | 2313 | /* If we can use 8-bit functions, condense S->char2b. */ |
| 2065 | if (!s->two_byte_p) | 2314 | if (!s->two_byte_p |
| 2315 | #if USE_ATSUI | ||
| 2316 | && GC_FONT (s->gc)->mac_style == NULL | ||
| 2317 | #endif | ||
| 2318 | ) | ||
| 2066 | for (i = 0; i < s->nchars; ++i) | 2319 | for (i = 0; i < s->nchars; ++i) |
| 2067 | char1b[i] = s->char2b[i].byte2; | 2320 | char1b[i] = s->char2b[i].byte2; |
| 2068 | 2321 | ||
| 2069 | #ifdef MAC_OS8 | 2322 | #if defined (MAC_OS8) && !USE_ATSUI |
| 2070 | /* Draw text with XDrawString if background has already been | 2323 | /* Draw text with XDrawString if background has already been |
| 2071 | filled. Otherwise, use XDrawImageString. (Note that | 2324 | filled. Otherwise, use XDrawImageString. (Note that |
| 2072 | XDrawImageString is usually faster than XDrawString.) Always | 2325 | XDrawImageString is usually faster than XDrawString.) Always |
| @@ -2077,14 +2330,18 @@ x_draw_glyph_string_foreground (s) | |||
| 2077 | #endif | 2330 | #endif |
| 2078 | { | 2331 | { |
| 2079 | /* Draw characters with 16-bit or 8-bit functions. */ | 2332 | /* Draw characters with 16-bit or 8-bit functions. */ |
| 2080 | if (s->two_byte_p) | 2333 | if (s->two_byte_p |
| 2334 | #if USE_ATSUI | ||
| 2335 | || GC_FONT (s->gc)->mac_style | ||
| 2336 | #endif | ||
| 2337 | ) | ||
| 2081 | XDrawString16 (s->display, s->window, s->gc, x, | 2338 | XDrawString16 (s->display, s->window, s->gc, x, |
| 2082 | s->ybase - boff, s->char2b, s->nchars); | 2339 | s->ybase - boff, s->char2b, s->nchars); |
| 2083 | else | 2340 | else |
| 2084 | XDrawString (s->display, s->window, s->gc, x, | 2341 | XDrawString (s->display, s->window, s->gc, x, |
| 2085 | s->ybase - boff, char1b, s->nchars); | 2342 | s->ybase - boff, char1b, s->nchars); |
| 2086 | } | 2343 | } |
| 2087 | #ifdef MAC_OS8 | 2344 | #if defined (MAC_OS8) && !USE_ATSUI |
| 2088 | else | 2345 | else |
| 2089 | { | 2346 | { |
| 2090 | if (s->two_byte_p) | 2347 | if (s->two_byte_p) |
| @@ -3251,9 +3508,57 @@ void | |||
| 3251 | XTflash (f) | 3508 | XTflash (f) |
| 3252 | struct frame *f; | 3509 | struct frame *f; |
| 3253 | { | 3510 | { |
| 3511 | /* Get the height not including a menu bar widget. */ | ||
| 3512 | int height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, FRAME_LINES (f)); | ||
| 3513 | /* Height of each line to flash. */ | ||
| 3514 | int flash_height = FRAME_LINE_HEIGHT (f); | ||
| 3515 | /* These will be the left and right margins of the rectangles. */ | ||
| 3516 | int flash_left = FRAME_INTERNAL_BORDER_WIDTH (f); | ||
| 3517 | int flash_right = FRAME_PIXEL_WIDTH (f) - FRAME_INTERNAL_BORDER_WIDTH (f); | ||
| 3518 | |||
| 3519 | int width; | ||
| 3520 | |||
| 3521 | /* Don't flash the area between a scroll bar and the frame | ||
| 3522 | edge it is next to. */ | ||
| 3523 | switch (FRAME_VERTICAL_SCROLL_BAR_TYPE (f)) | ||
| 3524 | { | ||
| 3525 | case vertical_scroll_bar_left: | ||
| 3526 | flash_left += VERTICAL_SCROLL_BAR_WIDTH_TRIM; | ||
| 3527 | break; | ||
| 3528 | |||
| 3529 | case vertical_scroll_bar_right: | ||
| 3530 | flash_right -= VERTICAL_SCROLL_BAR_WIDTH_TRIM; | ||
| 3531 | break; | ||
| 3532 | |||
| 3533 | default: | ||
| 3534 | break; | ||
| 3535 | } | ||
| 3536 | |||
| 3537 | width = flash_right - flash_left; | ||
| 3538 | |||
| 3254 | BLOCK_INPUT; | 3539 | BLOCK_INPUT; |
| 3255 | 3540 | ||
| 3256 | FlashMenuBar (0); | 3541 | /* If window is tall, flash top and bottom line. */ |
| 3542 | if (height > 3 * FRAME_LINE_HEIGHT (f)) | ||
| 3543 | { | ||
| 3544 | mac_invert_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), | ||
| 3545 | flash_left, | ||
| 3546 | (FRAME_INTERNAL_BORDER_WIDTH (f) | ||
| 3547 | + FRAME_TOOL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f)), | ||
| 3548 | width, flash_height); | ||
| 3549 | mac_invert_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), | ||
| 3550 | flash_left, | ||
| 3551 | (height - flash_height | ||
| 3552 | - FRAME_INTERNAL_BORDER_WIDTH (f)), | ||
| 3553 | width, flash_height); | ||
| 3554 | } | ||
| 3555 | else | ||
| 3556 | /* If it is short, flash it all. */ | ||
| 3557 | mac_invert_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), | ||
| 3558 | flash_left, FRAME_INTERNAL_BORDER_WIDTH (f), | ||
| 3559 | width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)); | ||
| 3560 | |||
| 3561 | x_flush (f); | ||
| 3257 | 3562 | ||
| 3258 | { | 3563 | { |
| 3259 | struct timeval wakeup; | 3564 | struct timeval wakeup; |
| @@ -3265,24 +3570,49 @@ XTflash (f) | |||
| 3265 | wakeup.tv_sec += (wakeup.tv_usec / 1000000); | 3570 | wakeup.tv_sec += (wakeup.tv_usec / 1000000); |
| 3266 | wakeup.tv_usec %= 1000000; | 3571 | wakeup.tv_usec %= 1000000; |
| 3267 | 3572 | ||
| 3268 | /* Keep waiting until past the time wakeup. */ | 3573 | /* Keep waiting until past the time wakeup or any input gets |
| 3269 | while (1) | 3574 | available. */ |
| 3575 | while (! detect_input_pending ()) | ||
| 3270 | { | 3576 | { |
| 3271 | struct timeval timeout; | 3577 | struct timeval current; |
| 3578 | struct timeval timeout; | ||
| 3272 | 3579 | ||
| 3273 | EMACS_GET_TIME (timeout); | 3580 | EMACS_GET_TIME (current); |
| 3274 | 3581 | ||
| 3275 | /* In effect, timeout = wakeup - timeout. | 3582 | /* Break if result would be negative. */ |
| 3276 | Break if result would be negative. */ | 3583 | if (timeval_subtract (¤t, wakeup, current)) |
| 3277 | if (timeval_subtract (&timeout, wakeup, timeout)) | 3584 | break; |
| 3278 | break; | ||
| 3279 | 3585 | ||
| 3280 | /* Try to wait that long--but we might wake up sooner. */ | 3586 | /* How long `select' should wait. */ |
| 3281 | select (0, NULL, NULL, NULL, &timeout); | 3587 | timeout.tv_sec = 0; |
| 3588 | timeout.tv_usec = 10000; | ||
| 3589 | |||
| 3590 | /* Try to wait that long--but we might wake up sooner. */ | ||
| 3591 | select (0, NULL, NULL, NULL, &timeout); | ||
| 3282 | } | 3592 | } |
| 3283 | } | 3593 | } |
| 3284 | 3594 | ||
| 3285 | FlashMenuBar (0); | 3595 | /* If window is tall, flash top and bottom line. */ |
| 3596 | if (height > 3 * FRAME_LINE_HEIGHT (f)) | ||
| 3597 | { | ||
| 3598 | mac_invert_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), | ||
| 3599 | flash_left, | ||
| 3600 | (FRAME_INTERNAL_BORDER_WIDTH (f) | ||
| 3601 | + FRAME_TOOL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f)), | ||
| 3602 | width, flash_height); | ||
| 3603 | mac_invert_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), | ||
| 3604 | flash_left, | ||
| 3605 | (height - flash_height | ||
| 3606 | - FRAME_INTERNAL_BORDER_WIDTH (f)), | ||
| 3607 | width, flash_height); | ||
| 3608 | } | ||
| 3609 | else | ||
| 3610 | /* If it is short, flash it all. */ | ||
| 3611 | mac_invert_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), | ||
| 3612 | flash_left, FRAME_INTERNAL_BORDER_WIDTH (f), | ||
| 3613 | width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)); | ||
| 3614 | |||
| 3615 | x_flush (f); | ||
| 3286 | 3616 | ||
| 3287 | UNBLOCK_INPUT; | 3617 | UNBLOCK_INPUT; |
| 3288 | } | 3618 | } |
| @@ -6447,6 +6777,10 @@ static char **font_name_table = NULL; | |||
| 6447 | static int font_name_table_size = 0; | 6777 | static int font_name_table_size = 0; |
| 6448 | static int font_name_count = 0; | 6778 | static int font_name_count = 0; |
| 6449 | 6779 | ||
| 6780 | #if USE_ATSUI | ||
| 6781 | static Lisp_Object atsu_font_id_hash; | ||
| 6782 | #endif | ||
| 6783 | |||
| 6450 | /* Alist linking character set strings to Mac text encoding and Emacs | 6784 | /* Alist linking character set strings to Mac text encoding and Emacs |
| 6451 | coding system. */ | 6785 | coding system. */ |
| 6452 | static Lisp_Object Vmac_charset_info_alist; | 6786 | static Lisp_Object Vmac_charset_info_alist; |
| @@ -6653,6 +6987,74 @@ init_font_name_table () | |||
| 6653 | Lisp_Object text_encoding_info_alist; | 6987 | Lisp_Object text_encoding_info_alist; |
| 6654 | struct gcpro gcpro1; | 6988 | struct gcpro gcpro1; |
| 6655 | 6989 | ||
| 6990 | text_encoding_info_alist = create_text_encoding_info_alist (); | ||
| 6991 | |||
| 6992 | #if USE_ATSUI | ||
| 6993 | if (!NILP (assq_no_quit (make_number (kTextEncodingMacUnicode), | ||
| 6994 | text_encoding_info_alist))) | ||
| 6995 | { | ||
| 6996 | OSErr err; | ||
| 6997 | ItemCount nfonts, i; | ||
| 6998 | ATSUFontID *font_ids = NULL; | ||
| 6999 | Ptr name, prev_name = NULL; | ||
| 7000 | ByteCount name_len; | ||
| 7001 | |||
| 7002 | atsu_font_id_hash = | ||
| 7003 | make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE), | ||
| 7004 | make_float (DEFAULT_REHASH_SIZE), | ||
| 7005 | make_float (DEFAULT_REHASH_THRESHOLD), | ||
| 7006 | Qnil, Qnil, Qnil);; | ||
| 7007 | err = ATSUFontCount (&nfonts); | ||
| 7008 | if (err == noErr) | ||
| 7009 | font_ids = xmalloc (sizeof (ATSUFontID) * nfonts); | ||
| 7010 | if (font_ids) | ||
| 7011 | err = ATSUGetFontIDs (font_ids, nfonts, NULL); | ||
| 7012 | if (err == noErr) | ||
| 7013 | for (i = 0; i < nfonts; i++) | ||
| 7014 | { | ||
| 7015 | err = ATSUFindFontName (font_ids[i], kFontFamilyName, | ||
| 7016 | kFontMacintoshPlatform, kFontNoScript, | ||
| 7017 | kFontNoLanguage, 0, NULL, &name_len, NULL); | ||
| 7018 | if (err != noErr) | ||
| 7019 | continue; | ||
| 7020 | name = xmalloc (name_len + 1); | ||
| 7021 | if (name == NULL) | ||
| 7022 | continue; | ||
| 7023 | name[name_len] = '\0'; | ||
| 7024 | err = ATSUFindFontName (font_ids[i], kFontFamilyName, | ||
| 7025 | kFontMacintoshPlatform, kFontNoScript, | ||
| 7026 | kFontNoLanguage, name_len, name, | ||
| 7027 | NULL, NULL); | ||
| 7028 | if (err == noErr | ||
| 7029 | && *name != '.' | ||
| 7030 | && (prev_name == NULL | ||
| 7031 | || strcmp (name, prev_name) != 0)) | ||
| 7032 | { | ||
| 7033 | static char *cs = "iso10646-1"; | ||
| 7034 | |||
| 7035 | add_font_name_table_entry (mac_to_x_fontname (name, 0, | ||
| 7036 | normal, cs)); | ||
| 7037 | add_font_name_table_entry (mac_to_x_fontname (name, 0, | ||
| 7038 | italic, cs)); | ||
| 7039 | add_font_name_table_entry (mac_to_x_fontname (name, 0, | ||
| 7040 | bold, cs)); | ||
| 7041 | add_font_name_table_entry (mac_to_x_fontname (name, 0, | ||
| 7042 | italic | bold, cs)); | ||
| 7043 | Fputhash (Fdowncase (make_unibyte_string (name, name_len)), | ||
| 7044 | long_to_cons (font_ids[i]), atsu_font_id_hash); | ||
| 7045 | xfree (prev_name); | ||
| 7046 | prev_name = name; | ||
| 7047 | } | ||
| 7048 | else | ||
| 7049 | xfree (name); | ||
| 7050 | } | ||
| 7051 | if (prev_name) | ||
| 7052 | xfree (prev_name); | ||
| 7053 | if (font_ids) | ||
| 7054 | xfree (font_ids); | ||
| 7055 | } | ||
| 7056 | #endif | ||
| 7057 | |||
| 6656 | /* Create a dummy instance iterator here to avoid creating and | 7058 | /* Create a dummy instance iterator here to avoid creating and |
| 6657 | destroying it in the loop. */ | 7059 | destroying it in the loop. */ |
| 6658 | if (FMCreateFontFamilyInstanceIterator (0, &ffii) != noErr) | 7060 | if (FMCreateFontFamilyInstanceIterator (0, &ffii) != noErr) |
| @@ -6665,8 +7067,6 @@ init_font_name_table () | |||
| 6665 | return; | 7067 | return; |
| 6666 | } | 7068 | } |
| 6667 | 7069 | ||
| 6668 | text_encoding_info_alist = create_text_encoding_info_alist (); | ||
| 6669 | |||
| 6670 | GCPRO1 (text_encoding_info_alist); | 7070 | GCPRO1 (text_encoding_info_alist); |
| 6671 | 7071 | ||
| 6672 | while (FMGetNextFontFamily (&ffi, &ff) == noErr) | 7072 | while (FMGetNextFontFamily (&ffi, &ff) == noErr) |
| @@ -7163,6 +7563,9 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7163 | Str255 mfontname, mfontname_decoded; | 7563 | Str255 mfontname, mfontname_decoded; |
| 7164 | Str31 charset; | 7564 | Str31 charset; |
| 7165 | SInt16 fontnum; | 7565 | SInt16 fontnum; |
| 7566 | #if USE_ATSUI | ||
| 7567 | ATSUStyle mac_style = NULL; | ||
| 7568 | #endif | ||
| 7166 | Style fontface; | 7569 | Style fontface; |
| 7167 | #if TARGET_API_MAC_CARBON | 7570 | #if TARGET_API_MAC_CARBON |
| 7168 | TextEncoding encoding; | 7571 | TextEncoding encoding; |
| @@ -7214,6 +7617,48 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7214 | 7617 | ||
| 7215 | x_font_name_to_mac_font_name (name, mfontname, mfontname_decoded, | 7618 | x_font_name_to_mac_font_name (name, mfontname, mfontname_decoded, |
| 7216 | &fontface, charset); | 7619 | &fontface, charset); |
| 7620 | #if USE_ATSUI | ||
| 7621 | if (strcmp (charset, "iso10646-1") == 0) /* XXX */ | ||
| 7622 | { | ||
| 7623 | OSErr err; | ||
| 7624 | ATSUAttributeTag tags[] = {kATSUFontTag, kATSUSizeTag, | ||
| 7625 | kATSUQDBoldfaceTag, kATSUQDItalicTag}; | ||
| 7626 | ByteCount sizes[] = {sizeof (ATSUFontID), sizeof (Fixed), | ||
| 7627 | sizeof (Boolean), sizeof (Boolean)}; | ||
| 7628 | static ATSUFontID font_id; | ||
| 7629 | static Fixed size_fixed; | ||
| 7630 | static Boolean bold_p, italic_p; | ||
| 7631 | ATSUAttributeValuePtr values[] = {&font_id, &size_fixed, | ||
| 7632 | &bold_p, &italic_p}; | ||
| 7633 | ATSUFontFeatureType types[] = {kAllTypographicFeaturesType}; | ||
| 7634 | ATSUFontFeatureSelector selectors[] = {kAllTypeFeaturesOffSelector}; | ||
| 7635 | Lisp_Object font_id_cons; | ||
| 7636 | |||
| 7637 | font_id_cons = Fgethash (Fdowncase | ||
| 7638 | (make_unibyte_string (mfontname, | ||
| 7639 | strlen (mfontname))), | ||
| 7640 | atsu_font_id_hash, Qnil); | ||
| 7641 | if (NILP (font_id_cons)) | ||
| 7642 | return NULL; | ||
| 7643 | font_id = cons_to_long (font_id_cons); | ||
| 7644 | size_fixed = Long2Fix (size); | ||
| 7645 | bold_p = (fontface & bold) != 0; | ||
| 7646 | italic_p = (fontface & italic) != 0; | ||
| 7647 | err = ATSUCreateStyle (&mac_style); | ||
| 7648 | if (err != noErr) | ||
| 7649 | return NULL; | ||
| 7650 | err = ATSUSetFontFeatures (mac_style, sizeof (types) / sizeof (types[0]), | ||
| 7651 | types, selectors); | ||
| 7652 | if (err != noErr) | ||
| 7653 | return NULL; | ||
| 7654 | err = ATSUSetAttributes (mac_style, sizeof (tags) / sizeof (tags[0]), | ||
| 7655 | tags, sizes, values); | ||
| 7656 | fontnum = -1; | ||
| 7657 | scriptcode = kTextEncodingMacUnicode; | ||
| 7658 | } | ||
| 7659 | else | ||
| 7660 | { | ||
| 7661 | #endif | ||
| 7217 | c2pstr (mfontname); | 7662 | c2pstr (mfontname); |
| 7218 | #if TARGET_API_MAC_CARBON | 7663 | #if TARGET_API_MAC_CARBON |
| 7219 | fontnum = FMGetFontFamilyFromName (mfontname); | 7664 | fontnum = FMGetFontFamilyFromName (mfontname); |
| @@ -7227,6 +7672,9 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7227 | return NULL; | 7672 | return NULL; |
| 7228 | scriptcode = FontToScript (fontnum); | 7673 | scriptcode = FontToScript (fontnum); |
| 7229 | #endif | 7674 | #endif |
| 7675 | #if USE_ATSUI | ||
| 7676 | } | ||
| 7677 | #endif | ||
| 7230 | 7678 | ||
| 7231 | font = (MacFontStruct *) xmalloc (sizeof (struct MacFontStruct)); | 7679 | font = (MacFontStruct *) xmalloc (sizeof (struct MacFontStruct)); |
| 7232 | 7680 | ||
| @@ -7234,6 +7682,9 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7234 | font->mac_fontsize = size; | 7682 | font->mac_fontsize = size; |
| 7235 | font->mac_fontface = fontface; | 7683 | font->mac_fontface = fontface; |
| 7236 | font->mac_scriptcode = scriptcode; | 7684 | font->mac_scriptcode = scriptcode; |
| 7685 | #if USE_ATSUI | ||
| 7686 | font->mac_style = mac_style; | ||
| 7687 | #endif | ||
| 7237 | 7688 | ||
| 7238 | /* Apple Japanese (SJIS) font is listed as both | 7689 | /* Apple Japanese (SJIS) font is listed as both |
| 7239 | "*-jisx0208.1983-sjis" (Japanese script) and "*-jisx0201.1976-0" | 7690 | "*-jisx0208.1983-sjis" (Japanese script) and "*-jisx0201.1976-0" |
| @@ -7244,6 +7695,91 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7244 | 7695 | ||
| 7245 | font->full_name = mac_to_x_fontname (mfontname_decoded, size, fontface, charset); | 7696 | font->full_name = mac_to_x_fontname (mfontname_decoded, size, fontface, charset); |
| 7246 | 7697 | ||
| 7698 | #if USE_ATSUI | ||
| 7699 | if (font->mac_style) | ||
| 7700 | { | ||
| 7701 | OSErr err; | ||
| 7702 | ATSUTextLayout text_layout; | ||
| 7703 | UniChar c = 0x20; | ||
| 7704 | Rect char_bounds, min_bounds, max_bounds; | ||
| 7705 | int min_width, max_width; | ||
| 7706 | ATSTrapezoid glyph_bounds; | ||
| 7707 | |||
| 7708 | font->per_char = xmalloc (sizeof (XCharStruct) * 0x10000); | ||
| 7709 | if (font->per_char == NULL) | ||
| 7710 | { | ||
| 7711 | mac_unload_font (&one_mac_display_info, font); | ||
| 7712 | return NULL; | ||
| 7713 | } | ||
| 7714 | bzero (font->per_char, sizeof (XCharStruct) * 0x10000); | ||
| 7715 | |||
| 7716 | err = atsu_get_text_layout_with_text_ptr (&c, 1, | ||
| 7717 | font->mac_style, | ||
| 7718 | &text_layout); | ||
| 7719 | if (err != noErr) | ||
| 7720 | { | ||
| 7721 | mac_unload_font (&one_mac_display_info, font); | ||
| 7722 | return NULL; | ||
| 7723 | } | ||
| 7724 | |||
| 7725 | for (c = 0x20; c <= 0x7e; c++) | ||
| 7726 | { | ||
| 7727 | err = ATSUClearLayoutCache (text_layout, kATSUFromTextBeginning); | ||
| 7728 | if (err == noErr) | ||
| 7729 | err = ATSUMeasureTextImage (text_layout, | ||
| 7730 | kATSUFromTextBeginning, kATSUToTextEnd, | ||
| 7731 | 0, 0, &char_bounds); | ||
| 7732 | if (err == noErr) | ||
| 7733 | err = ATSUGetGlyphBounds (text_layout, 0, 0, | ||
| 7734 | kATSUFromTextBeginning, kATSUToTextEnd, | ||
| 7735 | kATSUseFractionalOrigins, 1, | ||
| 7736 | &glyph_bounds, NULL); | ||
| 7737 | if (err == noErr) | ||
| 7738 | { | ||
| 7739 | xassert (glyph_bounds.lowerRight.x - glyph_bounds.lowerLeft.x | ||
| 7740 | == glyph_bounds.upperRight.x - glyph_bounds.upperLeft.x); | ||
| 7741 | |||
| 7742 | char_width = Fix2Long (glyph_bounds.upperRight.x | ||
| 7743 | - glyph_bounds.upperLeft.x); | ||
| 7744 | STORE_XCHARSTRUCT (font->per_char[c], | ||
| 7745 | char_width, char_bounds); | ||
| 7746 | if (c == 0x20) | ||
| 7747 | { | ||
| 7748 | min_width = max_width = char_width; | ||
| 7749 | min_bounds = max_bounds = char_bounds; | ||
| 7750 | font->ascent = -Fix2Long (glyph_bounds.upperLeft.y); | ||
| 7751 | font->descent = Fix2Long (glyph_bounds.lowerLeft.y); | ||
| 7752 | } | ||
| 7753 | else | ||
| 7754 | { | ||
| 7755 | if (char_width > 0) | ||
| 7756 | { | ||
| 7757 | min_width = min (min_width, char_width); | ||
| 7758 | max_width = max (max_width, char_width); | ||
| 7759 | } | ||
| 7760 | if (!EmptyRect (&char_bounds)) | ||
| 7761 | { | ||
| 7762 | SetRect (&min_bounds, | ||
| 7763 | max (min_bounds.left, char_bounds.left), | ||
| 7764 | max (min_bounds.top, char_bounds.top), | ||
| 7765 | min (min_bounds.right, char_bounds.right), | ||
| 7766 | min (min_bounds.bottom, char_bounds.bottom)); | ||
| 7767 | UnionRect (&max_bounds, &char_bounds, &max_bounds); | ||
| 7768 | } | ||
| 7769 | } | ||
| 7770 | } | ||
| 7771 | } | ||
| 7772 | STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds); | ||
| 7773 | STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds); | ||
| 7774 | |||
| 7775 | font->min_byte1 = 0; | ||
| 7776 | font->max_byte1 = 0xff; | ||
| 7777 | font->min_char_or_byte2 = 0; | ||
| 7778 | font->max_char_or_byte2 = 0xff; | ||
| 7779 | } | ||
| 7780 | else | ||
| 7781 | { | ||
| 7782 | #endif | ||
| 7247 | is_two_byte_font = font->mac_scriptcode == smJapanese || | 7783 | is_two_byte_font = font->mac_scriptcode == smJapanese || |
| 7248 | font->mac_scriptcode == smTradChinese || | 7784 | font->mac_scriptcode == smTradChinese || |
| 7249 | font->mac_scriptcode == smSimpChinese || | 7785 | font->mac_scriptcode == smSimpChinese || |
| @@ -7258,24 +7794,26 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7258 | font->ascent = the_fontinfo.ascent; | 7794 | font->ascent = the_fontinfo.ascent; |
| 7259 | font->descent = the_fontinfo.descent; | 7795 | font->descent = the_fontinfo.descent; |
| 7260 | 7796 | ||
| 7261 | font->min_byte1 = 0; | ||
| 7262 | if (is_two_byte_font) | ||
| 7263 | font->max_byte1 = 1; | ||
| 7264 | else | ||
| 7265 | font->max_byte1 = 0; | ||
| 7266 | font->min_char_or_byte2 = 0x20; | ||
| 7267 | font->max_char_or_byte2 = 0xff; | ||
| 7268 | |||
| 7269 | if (is_two_byte_font) | 7797 | if (is_two_byte_font) |
| 7270 | { | 7798 | { |
| 7799 | font->min_byte1 = 0xa1; | ||
| 7800 | font->max_byte1 = 0xfe; | ||
| 7801 | font->min_char_or_byte2 = 0xa1; | ||
| 7802 | font->max_char_or_byte2 = 0xfe; | ||
| 7803 | |||
| 7271 | /* Use the width of an "ideographic space" of that font because | 7804 | /* Use the width of an "ideographic space" of that font because |
| 7272 | the_fontinfo.widMax returns the wrong width for some fonts. */ | 7805 | the_fontinfo.widMax returns the wrong width for some fonts. */ |
| 7273 | switch (font->mac_scriptcode) | 7806 | switch (font->mac_scriptcode) |
| 7274 | { | 7807 | { |
| 7275 | case smJapanese: | 7808 | case smJapanese: |
| 7809 | font->min_byte1 = 0x81; | ||
| 7810 | font->max_byte1 = 0xfc; | ||
| 7811 | font->min_char_or_byte2 = 0x40; | ||
| 7812 | font->max_char_or_byte2 = 0xfc; | ||
| 7276 | char_width = StringWidth("\p\x81\x40"); | 7813 | char_width = StringWidth("\p\x81\x40"); |
| 7277 | break; | 7814 | break; |
| 7278 | case smTradChinese: | 7815 | case smTradChinese: |
| 7816 | font->min_char_or_byte2 = 0x40; | ||
| 7279 | char_width = StringWidth("\p\xa1\x40"); | 7817 | char_width = StringWidth("\p\xa1\x40"); |
| 7280 | break; | 7818 | break; |
| 7281 | case smSimpChinese: | 7819 | case smSimpChinese: |
| @@ -7287,9 +7825,15 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7287 | } | 7825 | } |
| 7288 | } | 7826 | } |
| 7289 | else | 7827 | else |
| 7290 | /* Do this instead of use the_fontinfo.widMax, which incorrectly | 7828 | { |
| 7291 | returns 15 for 12-point Monaco! */ | 7829 | font->min_byte1 = font->max_byte1 = 0; |
| 7292 | char_width = CharWidth ('m'); | 7830 | font->min_char_or_byte2 = 0x20; |
| 7831 | font->max_char_or_byte2 = 0xff; | ||
| 7832 | |||
| 7833 | /* Do this instead of use the_fontinfo.widMax, which incorrectly | ||
| 7834 | returns 15 for 12-point Monaco! */ | ||
| 7835 | char_width = CharWidth ('m'); | ||
| 7836 | } | ||
| 7293 | 7837 | ||
| 7294 | if (is_two_byte_font) | 7838 | if (is_two_byte_font) |
| 7295 | { | 7839 | { |
| @@ -7308,55 +7852,56 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7308 | } | 7852 | } |
| 7309 | else | 7853 | else |
| 7310 | { | 7854 | { |
| 7311 | font->per_char = (XCharStruct *) | 7855 | int c, min_width, max_width; |
| 7312 | xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1)); | 7856 | Rect char_bounds, min_bounds, max_bounds; |
| 7313 | { | 7857 | char ch; |
| 7314 | int c, min_width, max_width; | 7858 | |
| 7315 | Rect char_bounds, min_bounds, max_bounds; | 7859 | font->per_char = xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1)); |
| 7316 | char ch; | 7860 | |
| 7317 | 7861 | min_width = max_width = char_width; | |
| 7318 | min_width = max_width = char_width; | 7862 | SetRect (&min_bounds, -32767, -32767, 32767, 32767); |
| 7319 | SetRect (&min_bounds, -32767, -32767, 32767, 32767); | 7863 | SetRect (&max_bounds, 0, 0, 0, 0); |
| 7320 | SetRect (&max_bounds, 0, 0, 0, 0); | 7864 | for (c = 0x20; c <= 0xff; c++) |
| 7321 | for (c = 0x20; c <= 0xff; c++) | 7865 | { |
| 7322 | { | 7866 | ch = c; |
| 7323 | ch = c; | 7867 | char_width = CharWidth (ch); |
| 7324 | char_width = CharWidth (ch); | 7868 | QDTextBounds (1, &ch, &char_bounds); |
| 7325 | QDTextBounds (1, &ch, &char_bounds); | 7869 | STORE_XCHARSTRUCT (font->per_char[c - 0x20], |
| 7326 | STORE_XCHARSTRUCT (font->per_char[c - 0x20], | 7870 | char_width, char_bounds); |
| 7327 | char_width, char_bounds); | 7871 | /* Some Japanese fonts (in SJIS encoding) return 0 as the |
| 7328 | /* Some Japanese fonts (in SJIS encoding) return 0 as the | 7872 | character width of 0x7f. */ |
| 7329 | character width of 0x7f. */ | 7873 | if (char_width > 0) |
| 7330 | if (char_width > 0) | 7874 | { |
| 7331 | { | 7875 | min_width = min (min_width, char_width); |
| 7332 | min_width = min (min_width, char_width); | 7876 | max_width = max (max_width, char_width); |
| 7333 | max_width = max (max_width, char_width); | 7877 | } |
| 7334 | } | 7878 | if (!EmptyRect (&char_bounds)) |
| 7335 | if (!EmptyRect (&char_bounds)) | 7879 | { |
| 7336 | { | 7880 | SetRect (&min_bounds, |
| 7337 | SetRect (&min_bounds, | 7881 | max (min_bounds.left, char_bounds.left), |
| 7338 | max (min_bounds.left, char_bounds.left), | 7882 | max (min_bounds.top, char_bounds.top), |
| 7339 | max (min_bounds.top, char_bounds.top), | 7883 | min (min_bounds.right, char_bounds.right), |
| 7340 | min (min_bounds.right, char_bounds.right), | 7884 | min (min_bounds.bottom, char_bounds.bottom)); |
| 7341 | min (min_bounds.bottom, char_bounds.bottom)); | 7885 | UnionRect (&max_bounds, &char_bounds, &max_bounds); |
| 7342 | UnionRect (&max_bounds, &char_bounds, &max_bounds); | 7886 | } |
| 7343 | } | 7887 | } |
| 7344 | } | 7888 | STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds); |
| 7345 | STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds); | 7889 | STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds); |
| 7346 | STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds); | 7890 | if (min_width == max_width |
| 7347 | if (min_width == max_width | 7891 | && max_bounds.left >= 0 && max_bounds.right <= max_width) |
| 7348 | && max_bounds.left >= 0 && max_bounds.right <= max_width) | 7892 | { |
| 7349 | { | 7893 | /* Fixed width and no overhangs. */ |
| 7350 | /* Fixed width and no overhangs. */ | 7894 | xfree (font->per_char); |
| 7351 | xfree (font->per_char); | 7895 | font->per_char = NULL; |
| 7352 | font->per_char = NULL; | 7896 | } |
| 7353 | } | ||
| 7354 | } | ||
| 7355 | } | 7897 | } |
| 7356 | 7898 | ||
| 7357 | TextFont (old_fontnum); /* restore previous font number, size and face */ | 7899 | TextFont (old_fontnum); /* restore previous font number, size and face */ |
| 7358 | TextSize (old_fontsize); | 7900 | TextSize (old_fontsize); |
| 7359 | TextFace (old_fontface); | 7901 | TextFace (old_fontface); |
| 7902 | #if USE_ATSUI | ||
| 7903 | } | ||
| 7904 | #endif | ||
| 7360 | 7905 | ||
| 7361 | return font; | 7906 | return font; |
| 7362 | } | 7907 | } |
| @@ -7370,6 +7915,10 @@ mac_unload_font (dpyinfo, font) | |||
| 7370 | xfree (font->full_name); | 7915 | xfree (font->full_name); |
| 7371 | if (font->per_char) | 7916 | if (font->per_char) |
| 7372 | xfree (font->per_char); | 7917 | xfree (font->per_char); |
| 7918 | #if USE_ATSUI | ||
| 7919 | if (font->mac_style) | ||
| 7920 | ATSUDisposeStyle (font->mac_style); | ||
| 7921 | #endif | ||
| 7373 | xfree (font); | 7922 | xfree (font); |
| 7374 | } | 7923 | } |
| 7375 | 7924 | ||
| @@ -10214,75 +10763,6 @@ init_quit_char_handler () | |||
| 10214 | 10763 | ||
| 10215 | mac_determine_quit_char_modifiers(); | 10764 | mac_determine_quit_char_modifiers(); |
| 10216 | } | 10765 | } |
| 10217 | |||
| 10218 | static Boolean | ||
| 10219 | quit_char_comp (EventRef inEvent, void *inCompData) | ||
| 10220 | { | ||
| 10221 | if (GetEventClass(inEvent) != kEventClassKeyboard) | ||
| 10222 | return false; | ||
| 10223 | if (GetEventKind(inEvent) != kEventRawKeyDown) | ||
| 10224 | return false; | ||
| 10225 | { | ||
| 10226 | UInt32 keyCode; | ||
| 10227 | UInt32 keyModifiers; | ||
| 10228 | GetEventParameter(inEvent, kEventParamKeyCode, | ||
| 10229 | typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode); | ||
| 10230 | if (keyCode != mac_quit_char_keycode) | ||
| 10231 | return false; | ||
| 10232 | GetEventParameter(inEvent, kEventParamKeyModifiers, | ||
| 10233 | typeUInt32, NULL, sizeof(UInt32), NULL, &keyModifiers); | ||
| 10234 | if (keyModifiers != mac_quit_char_modifiers) | ||
| 10235 | return false; | ||
| 10236 | } | ||
| 10237 | return true; | ||
| 10238 | } | ||
| 10239 | |||
| 10240 | void | ||
| 10241 | mac_check_for_quit_char () | ||
| 10242 | { | ||
| 10243 | EventRef event; | ||
| 10244 | static EMACS_TIME last_check_time = { 0, 0 }; | ||
| 10245 | static EMACS_TIME one_second = { 1, 0 }; | ||
| 10246 | EMACS_TIME now, t; | ||
| 10247 | |||
| 10248 | /* If windows are not initialized, return immediately (keep it bouncin'). */ | ||
| 10249 | if (!mac_quit_char_modifiers) | ||
| 10250 | return; | ||
| 10251 | |||
| 10252 | /* Don't check if last check is less than a second ago. */ | ||
| 10253 | EMACS_GET_TIME (now); | ||
| 10254 | EMACS_SUB_TIME (t, now, last_check_time); | ||
| 10255 | if (EMACS_TIME_LT (t, one_second)) | ||
| 10256 | return; | ||
| 10257 | last_check_time = now; | ||
| 10258 | |||
| 10259 | /* Redetermine modifiers because they are based on lisp variables */ | ||
| 10260 | mac_determine_quit_char_modifiers (); | ||
| 10261 | |||
| 10262 | /* Fill the queue with events */ | ||
| 10263 | BLOCK_INPUT; | ||
| 10264 | ReceiveNextEvent (0, NULL, kEventDurationNoWait, false, &event); | ||
| 10265 | event = FindSpecificEventInQueue (GetMainEventQueue (), quit_char_comp, | ||
| 10266 | NULL); | ||
| 10267 | UNBLOCK_INPUT; | ||
| 10268 | if (event) | ||
| 10269 | { | ||
| 10270 | struct input_event e; | ||
| 10271 | |||
| 10272 | /* Use an input_event to emulate what the interrupt handler does. */ | ||
| 10273 | EVENT_INIT (e); | ||
| 10274 | e.kind = ASCII_KEYSTROKE_EVENT; | ||
| 10275 | e.code = quit_char; | ||
| 10276 | e.arg = Qnil; | ||
| 10277 | e.modifiers = NULL; | ||
| 10278 | e.timestamp = EventTimeToTicks (GetEventTime (event)) * (1000/60); | ||
| 10279 | XSETFRAME (e.frame_or_window, mac_focus_frame (&one_mac_display_info)); | ||
| 10280 | /* Remove event from queue to prevent looping. */ | ||
| 10281 | RemoveEventFromQueue (GetMainEventQueue (), event); | ||
| 10282 | ReleaseEvent (event); | ||
| 10283 | kbd_buffer_store_event (&e); | ||
| 10284 | } | ||
| 10285 | } | ||
| 10286 | #endif /* MAC_OSX */ | 10766 | #endif /* MAC_OSX */ |
| 10287 | 10767 | ||
| 10288 | static void | 10768 | static void |
| @@ -10460,6 +10940,11 @@ syms_of_macterm () | |||
| 10460 | Qmac_ready_for_drag_n_drop = intern ("mac-ready-for-drag-n-drop"); | 10940 | Qmac_ready_for_drag_n_drop = intern ("mac-ready-for-drag-n-drop"); |
| 10461 | staticpro (&Qmac_ready_for_drag_n_drop); | 10941 | staticpro (&Qmac_ready_for_drag_n_drop); |
| 10462 | 10942 | ||
| 10943 | #if USE_ATSUI | ||
| 10944 | staticpro (&atsu_font_id_hash); | ||
| 10945 | atsu_font_id_hash = Qnil; | ||
| 10946 | #endif | ||
| 10947 | |||
| 10463 | DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, | 10948 | DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, |
| 10464 | doc: /* If not nil, Emacs uses toolkit scroll bars. */); | 10949 | doc: /* If not nil, Emacs uses toolkit scroll bars. */); |
| 10465 | #ifdef USE_TOOLKIT_SCROLL_BARS | 10950 | #ifdef USE_TOOLKIT_SCROLL_BARS |
diff --git a/src/minibuf.c b/src/minibuf.c index c0624bd29b4..b7f9fd4838c 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -1132,11 +1132,14 @@ DEFUN ("read-buffer", Fread_buffer, Sread_buffer, 1, 3, 0, | |||
| 1132 | Prompt with PROMPT. | 1132 | Prompt with PROMPT. |
| 1133 | Optional second arg DEF is value to return if user enters an empty line. | 1133 | Optional second arg DEF is value to return if user enters an empty line. |
| 1134 | If optional third arg REQUIRE-MATCH is non-nil, | 1134 | If optional third arg REQUIRE-MATCH is non-nil, |
| 1135 | only existing buffer names are allowed. */) | 1135 | only existing buffer names are allowed. |
| 1136 | The argument PROMPT should be a string ending with a colon and a space. */) | ||
| 1136 | (prompt, def, require_match) | 1137 | (prompt, def, require_match) |
| 1137 | Lisp_Object prompt, def, require_match; | 1138 | Lisp_Object prompt, def, require_match; |
| 1138 | { | 1139 | { |
| 1139 | Lisp_Object args[4]; | 1140 | Lisp_Object args[4]; |
| 1141 | unsigned char *s; | ||
| 1142 | int len; | ||
| 1140 | 1143 | ||
| 1141 | if (BUFFERP (def)) | 1144 | if (BUFFERP (def)) |
| 1142 | def = XBUFFER (def)->name; | 1145 | def = XBUFFER (def)->name; |
| @@ -1145,7 +1148,26 @@ If optional third arg REQUIRE-MATCH is non-nil, | |||
| 1145 | { | 1148 | { |
| 1146 | if (!NILP (def)) | 1149 | if (!NILP (def)) |
| 1147 | { | 1150 | { |
| 1148 | args[0] = build_string ("%s(default %s) "); | 1151 | /* A default value was provided: we must change PROMPT, |
| 1152 | editing the default value in before the colon. To achieve | ||
| 1153 | this, we replace PROMPT with a substring that doesn't | ||
| 1154 | contain the terminal space and colon (if present). They | ||
| 1155 | are then added back using Fformat. */ | ||
| 1156 | |||
| 1157 | if (STRINGP (prompt)) | ||
| 1158 | { | ||
| 1159 | s = SDATA (prompt); | ||
| 1160 | len = strlen (s); | ||
| 1161 | if (len >= 2 && s[len - 2] == ':' && s[len - 1] == ' ') | ||
| 1162 | len = len - 2; | ||
| 1163 | else if (len >= 1 && (s[len - 1] == ':' || s[len - 1] == ' ')) | ||
| 1164 | len--; | ||
| 1165 | |||
| 1166 | prompt = make_specified_string (s, -1, len, | ||
| 1167 | STRING_MULTIBYTE (prompt)); | ||
| 1168 | } | ||
| 1169 | |||
| 1170 | args[0] = build_string ("%s (default %s): "); | ||
| 1149 | args[1] = prompt; | 1171 | args[1] = prompt; |
| 1150 | args[2] = def; | 1172 | args[2] = def; |
| 1151 | prompt = Fformat (3, args); | 1173 | prompt = Fformat (3, args); |
diff --git a/src/process.c b/src/process.c index bebced812e8..b66c768c256 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -118,10 +118,10 @@ Boston, MA 02110-1301, USA. */ | |||
| 118 | #include <sys/wait.h> | 118 | #include <sys/wait.h> |
| 119 | #endif | 119 | #endif |
| 120 | 120 | ||
| 121 | #include "lisp.h" | ||
| 121 | #include "systime.h" | 122 | #include "systime.h" |
| 122 | #include "systty.h" | 123 | #include "systty.h" |
| 123 | 124 | ||
| 124 | #include "lisp.h" | ||
| 125 | #include "window.h" | 125 | #include "window.h" |
| 126 | #include "buffer.h" | 126 | #include "buffer.h" |
| 127 | #include "character.h" | 127 | #include "character.h" |
diff --git a/src/regex.c b/src/regex.c index bc1ade0bb6e..412fd1d524d 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -1290,9 +1290,9 @@ static re_char *whitespace_regexp; | |||
| 1290 | 1290 | ||
| 1291 | void | 1291 | void |
| 1292 | re_set_whitespace_regexp (regexp) | 1292 | re_set_whitespace_regexp (regexp) |
| 1293 | re_char *regexp; | 1293 | const char *regexp; |
| 1294 | { | 1294 | { |
| 1295 | whitespace_regexp = regexp; | 1295 | whitespace_regexp = (re_char *) regexp; |
| 1296 | } | 1296 | } |
| 1297 | WEAK_ALIAS (__re_set_syntax, re_set_syntax) | 1297 | WEAK_ALIAS (__re_set_syntax, re_set_syntax) |
| 1298 | 1298 | ||
diff --git a/src/regex.h b/src/regex.h index 68db62d34e0..8a669541ff1 100644 --- a/src/regex.h +++ b/src/regex.h | |||
| @@ -609,8 +609,13 @@ typedef enum { RECC_ERROR = 0, | |||
| 609 | RECC_ASCII, RECC_UNIBYTE | 609 | RECC_ASCII, RECC_UNIBYTE |
| 610 | } re_wctype_t; | 610 | } re_wctype_t; |
| 611 | 611 | ||
| 612 | extern char re_iswctype (int ch, re_wctype_t cc); | ||
| 613 | extern re_wctype_t re_wctype (const unsigned char* str); | ||
| 614 | |||
| 612 | typedef int re_wchar_t; | 615 | typedef int re_wchar_t; |
| 613 | 616 | ||
| 617 | extern void re_set_whitespace_regexp (const char *regexp); | ||
| 618 | |||
| 614 | #endif /* not WIDE_CHAR_SUPPORT */ | 619 | #endif /* not WIDE_CHAR_SUPPORT */ |
| 615 | 620 | ||
| 616 | #endif /* regex.h */ | 621 | #endif /* regex.h */ |
diff --git a/src/systime.h b/src/systime.h index 1d0022e93d7..9851db4cf33 100644 --- a/src/systime.h +++ b/src/systime.h | |||
| @@ -157,6 +157,14 @@ extern int set_file_times __P ((const char *, EMACS_TIME, EMACS_TIME)); | |||
| 157 | /* defined in keyboard.c */ | 157 | /* defined in keyboard.c */ |
| 158 | extern void set_waiting_for_input __P ((EMACS_TIME *)); | 158 | extern void set_waiting_for_input __P ((EMACS_TIME *)); |
| 159 | 159 | ||
| 160 | /* When lisp.h is not included Lisp_Object is not defined (this can | ||
| 161 | happen when this files is used outside the src directory). | ||
| 162 | Use GCPRO1 to determine if lisp.h was included. */ | ||
| 163 | #ifdef GCPRO1 | ||
| 164 | /* defined in dired.c */ | ||
| 165 | extern Lisp_Object make_time __P ((time_t)); | ||
| 166 | #endif | ||
| 167 | |||
| 160 | /* Compare times T1 and T2. Value is 0 if T1 and T2 are the same. | 168 | /* Compare times T1 and T2. Value is 0 if T1 and T2 are the same. |
| 161 | Value is < 0 if T1 is less than T2. Value is > 0 otherwise. */ | 169 | Value is < 0 if T1 is less than T2. Value is > 0 otherwise. */ |
| 162 | 170 | ||
diff --git a/src/unexelf.c b/src/unexelf.c index ee563b36a97..e33a9a1aeb3 100644 --- a/src/unexelf.c +++ b/src/unexelf.c | |||
| @@ -412,7 +412,7 @@ temacs: | |||
| 412 | #include <string.h> | 412 | #include <string.h> |
| 413 | #else | 413 | #else |
| 414 | #include <config.h> | 414 | #include <config.h> |
| 415 | extern void fatal (char *, ...); | 415 | extern void fatal (const char *msgid, ...); |
| 416 | #endif | 416 | #endif |
| 417 | 417 | ||
| 418 | #include <sys/types.h> | 418 | #include <sys/types.h> |
diff --git a/src/window.c b/src/window.c index 198edd3d6d8..9a0d256cdce 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -6225,6 +6225,85 @@ usage: (save-window-excursion BODY ...) */) | |||
| 6225 | return unbind_to (count, val); | 6225 | return unbind_to (count, val); |
| 6226 | } | 6226 | } |
| 6227 | 6227 | ||
| 6228 | |||
| 6229 | |||
| 6230 | /*********************************************************************** | ||
| 6231 | Window Split Tree | ||
| 6232 | ***********************************************************************/ | ||
| 6233 | |||
| 6234 | static Lisp_Object | ||
| 6235 | window_split_tree (w) | ||
| 6236 | struct window *w; | ||
| 6237 | { | ||
| 6238 | Lisp_Object tail = Qnil; | ||
| 6239 | Lisp_Object result = Qnil; | ||
| 6240 | |||
| 6241 | while (w) | ||
| 6242 | { | ||
| 6243 | Lisp_Object wn; | ||
| 6244 | |||
| 6245 | XSETWINDOW (wn, w); | ||
| 6246 | if (!NILP (w->hchild)) | ||
| 6247 | wn = Fcons (Qnil, Fcons (Fwindow_edges (wn), | ||
| 6248 | window_split_tree (XWINDOW (w->hchild)))); | ||
| 6249 | else if (!NILP (w->vchild)) | ||
| 6250 | wn = Fcons (Qt, Fcons (Fwindow_edges (wn), | ||
| 6251 | window_split_tree (XWINDOW (w->vchild)))); | ||
| 6252 | |||
| 6253 | if (NILP (result)) | ||
| 6254 | { | ||
| 6255 | result = tail = Fcons (wn, Qnil); | ||
| 6256 | } | ||
| 6257 | else | ||
| 6258 | { | ||
| 6259 | XSETCDR (tail, Fcons (wn, Qnil)); | ||
| 6260 | tail = XCDR (tail); | ||
| 6261 | } | ||
| 6262 | |||
| 6263 | w = NILP (w->next) ? 0 : XWINDOW (w->next); | ||
| 6264 | } | ||
| 6265 | |||
| 6266 | return result; | ||
| 6267 | } | ||
| 6268 | |||
| 6269 | |||
| 6270 | |||
| 6271 | DEFUN ("window-split-tree", Fwindow_split_tree, Swindow_split_tree, | ||
| 6272 | 0, 1, 0, | ||
| 6273 | doc: /* Return the window split tree for frame FRAME. | ||
| 6274 | |||
| 6275 | The return value is a list of the form (ROOT MINI), where ROOT | ||
| 6276 | represents the window split tree of the frame's root window, and MINI | ||
| 6277 | is the frame's minibuffer window. | ||
| 6278 | |||
| 6279 | If the root window is not split, ROOT is the root window itself. | ||
| 6280 | Otherwise, ROOT is a list (DIR EDGES W1 W2 ...) where DIR is nil for a | ||
| 6281 | horisontal split, and t for a vertical split, EDGES gives the combined | ||
| 6282 | size and position of the subwindows in the split, and the rest of the | ||
| 6283 | elements are the subwindows in the split. Each of the subwindows may | ||
| 6284 | again be a window or a list representing a window split, and so on. | ||
| 6285 | EDGES is a list \(LEFT TOP RIGHT BOTTOM) as returned by `window-edges'. | ||
| 6286 | |||
| 6287 | If FRAME is nil or omitted, return information on the currently | ||
| 6288 | selected frame. */) | ||
| 6289 | (frame) | ||
| 6290 | Lisp_Object frame; | ||
| 6291 | { | ||
| 6292 | Lisp_Object alist; | ||
| 6293 | FRAME_PTR f; | ||
| 6294 | |||
| 6295 | if (NILP (frame)) | ||
| 6296 | frame = selected_frame; | ||
| 6297 | |||
| 6298 | CHECK_FRAME (frame); | ||
| 6299 | f = XFRAME (frame); | ||
| 6300 | |||
| 6301 | if (!FRAME_LIVE_P (f)) | ||
| 6302 | return Qnil; | ||
| 6303 | |||
| 6304 | return window_split_tree (XWINDOW (FRAME_ROOT_WINDOW (f))); | ||
| 6305 | } | ||
| 6306 | |||
| 6228 | 6307 | ||
| 6229 | /*********************************************************************** | 6308 | /*********************************************************************** |
| 6230 | Marginal Areas | 6309 | Marginal Areas |
| @@ -7031,6 +7110,7 @@ The selected frame is the one whose configuration has changed. */); | |||
| 7031 | defsubr (&Sset_window_configuration); | 7110 | defsubr (&Sset_window_configuration); |
| 7032 | defsubr (&Scurrent_window_configuration); | 7111 | defsubr (&Scurrent_window_configuration); |
| 7033 | defsubr (&Ssave_window_excursion); | 7112 | defsubr (&Ssave_window_excursion); |
| 7113 | defsubr (&Swindow_split_tree); | ||
| 7034 | defsubr (&Sset_window_margins); | 7114 | defsubr (&Sset_window_margins); |
| 7035 | defsubr (&Swindow_margins); | 7115 | defsubr (&Swindow_margins); |
| 7036 | defsubr (&Sset_window_fringes); | 7116 | defsubr (&Sset_window_fringes); |
diff --git a/src/xdisp.c b/src/xdisp.c index 27ab728502a..ef125409076 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -12943,7 +12943,8 @@ try_window (window, pos, check_margins) | |||
| 12943 | this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); | 12943 | this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); |
| 12944 | 12944 | ||
| 12945 | if ((w->cursor.y < this_scroll_margin | 12945 | if ((w->cursor.y < this_scroll_margin |
| 12946 | && CHARPOS (pos) > BEGV) | 12946 | && CHARPOS (pos) > BEGV |
| 12947 | && IT_CHARPOS (it) < ZV) | ||
| 12947 | /* rms: considering make_cursor_line_fully_visible_p here | 12948 | /* rms: considering make_cursor_line_fully_visible_p here |
| 12948 | seems to give wrong results. We don't want to recenter | 12949 | seems to give wrong results. We don't want to recenter |
| 12949 | when the last line is partly visible, we want to allow | 12950 | when the last line is partly visible, we want to allow |
diff --git a/src/xfaces.c b/src/xfaces.c index 34bee3298ba..df8dc15f022 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -1475,7 +1475,9 @@ tty_color_name (f, idx) | |||
| 1475 | 1475 | ||
| 1476 | 1476 | ||
| 1477 | /* Return non-zero if COLOR_NAME is a shade of gray (or white or | 1477 | /* Return non-zero if COLOR_NAME is a shade of gray (or white or |
| 1478 | black) on frame F. The algorithm is taken from 20.2 faces.el. */ | 1478 | black) on frame F. |
| 1479 | |||
| 1480 | The criterion implemented here is not a terribly sophisticated one. */ | ||
| 1479 | 1481 | ||
| 1480 | static int | 1482 | static int |
| 1481 | face_color_gray_p (f, color_name) | 1483 | face_color_gray_p (f, color_name) |
| @@ -1486,12 +1488,15 @@ face_color_gray_p (f, color_name) | |||
| 1486 | int gray_p; | 1488 | int gray_p; |
| 1487 | 1489 | ||
| 1488 | if (defined_color (f, color_name, &color, 0)) | 1490 | if (defined_color (f, color_name, &color, 0)) |
| 1489 | gray_p = ((abs (color.red - color.green) | 1491 | gray_p = (/* Any color sufficiently close to black counts as grey. */ |
| 1490 | < max (color.red, color.green) / 20) | 1492 | (color.red < 5000 && color.green < 5000 && color.blue < 5000) |
| 1491 | && (abs (color.green - color.blue) | 1493 | || |
| 1492 | < max (color.green, color.blue) / 20) | 1494 | ((abs (color.red - color.green) |
| 1493 | && (abs (color.blue - color.red) | 1495 | < max (color.red, color.green) / 20) |
| 1494 | < max (color.blue, color.red) / 20)); | 1496 | && (abs (color.green - color.blue) |
| 1497 | < max (color.green, color.blue) / 20) | ||
| 1498 | && (abs (color.blue - color.red) | ||
| 1499 | < max (color.blue, color.red) / 20))); | ||
| 1495 | else | 1500 | else |
| 1496 | gray_p = 0; | 1501 | gray_p = 0; |
| 1497 | 1502 | ||
diff --git a/src/xsmfns.c b/src/xsmfns.c index 0215d562548..e7f3e6fa3e5 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c | |||
| @@ -45,9 +45,9 @@ Boston, MA 02110-1301, USA. */ | |||
| 45 | #include <sys/param.h> | 45 | #include <sys/param.h> |
| 46 | #include <stdio.h> | 46 | #include <stdio.h> |
| 47 | 47 | ||
| 48 | #include "lisp.h" | ||
| 48 | #include "systime.h" | 49 | #include "systime.h" |
| 49 | #include "sysselect.h" | 50 | #include "sysselect.h" |
| 50 | #include "lisp.h" | ||
| 51 | #include "termhooks.h" | 51 | #include "termhooks.h" |
| 52 | #include "termopts.h" | 52 | #include "termopts.h" |
| 53 | #include "xterm.h" | 53 | #include "xterm.h" |
diff --git a/src/xterm.c b/src/xterm.c index 3b94e3b871c..5b7d45fe228 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -6237,7 +6237,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) | |||
| 6237 | if (status_return == XBufferOverflow) | 6237 | if (status_return == XBufferOverflow) |
| 6238 | { | 6238 | { |
| 6239 | copy_bufsiz = nbytes + 1; | 6239 | copy_bufsiz = nbytes + 1; |
| 6240 | copy_bufptr = (char *) alloca (copy_bufsiz); | 6240 | copy_bufptr = (unsigned char *) alloca (copy_bufsiz); |
| 6241 | nbytes = XmbLookupString (FRAME_XIC (f), | 6241 | nbytes = XmbLookupString (FRAME_XIC (f), |
| 6242 | &event.xkey, copy_bufptr, | 6242 | &event.xkey, copy_bufptr, |
| 6243 | copy_bufsiz, &keysym, | 6243 | copy_bufsiz, &keysym, |
| @@ -6255,7 +6255,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) | |||
| 6255 | if (status_return == XBufferOverflow) | 6255 | if (status_return == XBufferOverflow) |
| 6256 | { | 6256 | { |
| 6257 | copy_bufsiz = nbytes + 1; | 6257 | copy_bufsiz = nbytes + 1; |
| 6258 | copy_bufptr = (char *) alloca (copy_bufsiz); | 6258 | copy_bufptr = (unsigned char *) alloca (copy_bufsiz); |
| 6259 | nbytes = Xutf8LookupString (FRAME_XIC (f), | 6259 | nbytes = Xutf8LookupString (FRAME_XIC (f), |
| 6260 | &event.xkey, | 6260 | &event.xkey, |
| 6261 | copy_bufptr, | 6261 | copy_bufptr, |