diff options
| author | Miles Bader | 2005-01-16 03:40:12 +0000 |
|---|---|---|
| committer | Miles Bader | 2005-01-16 03:40:12 +0000 |
| commit | 54c4c5465ff6dcf158fc47b5894a688ec356f900 (patch) | |
| tree | 7fd504f98080bd7c498874d3662ef67086a09b66 /src | |
| parent | d570d39f949427c4a5041375529c3748d72c6e3c (diff) | |
| parent | 42187e99f8adc31d93d027b9017160731aab8972 (diff) | |
| download | emacs-54c4c5465ff6dcf158fc47b5894a688ec356f900.tar.gz emacs-54c4c5465ff6dcf158fc47b5894a688ec356f900.zip | |
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-2
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-83
- miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-84
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-3
- miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-4
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-5
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-6
- miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-11
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-12
Remove "-face" suffix from lazy-highlight face name
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-13
- miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-16
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-17
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-18
- miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-21
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-22
<no summary provided>
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-23
- miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-39
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-40
Fix regressions from latest reftex update
* miles@gnu.org--gnu-2005/gnus--rel--5.10--base-0
tag of miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-82
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-1
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-2
Merge from miles@gnu.org--gnu-2004
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-3
Merge from emacs--cvs-trunk--0
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 209 | ||||
| -rw-r--r-- | src/alloc.c | 50 | ||||
| -rw-r--r-- | src/dispextern.h | 4 | ||||
| -rw-r--r-- | src/fns.c | 6 | ||||
| -rw-r--r-- | src/fringe.c | 39 | ||||
| -rw-r--r-- | src/gtkutil.c | 32 | ||||
| -rw-r--r-- | src/keyboard.c | 24 | ||||
| -rw-r--r-- | src/keymap.c | 11 | ||||
| -rw-r--r-- | src/macfns.c | 95 | ||||
| -rw-r--r-- | src/macterm.c | 208 | ||||
| -rw-r--r-- | src/macterm.h | 2 | ||||
| -rw-r--r-- | src/term.c | 4 | ||||
| -rw-r--r-- | src/w32bdf.c | 5 | ||||
| -rw-r--r-- | src/w32fns.c | 22 | ||||
| -rw-r--r-- | src/w32term.c | 10 | ||||
| -rw-r--r-- | src/window.c | 8 | ||||
| -rw-r--r-- | src/xdisp.c | 272 | ||||
| -rw-r--r-- | src/xfaces.c | 63 | ||||
| -rw-r--r-- | src/xmenu.c | 14 | ||||
| -rw-r--r-- | src/xselect.c | 10 | ||||
| -rw-r--r-- | src/xterm.h | 2 |
21 files changed, 842 insertions, 248 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e2da7ae1a5f..18bd89e9dda 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,206 @@ | |||
| 1 | 2005-01-15 Steven Tamm <steventamm@mac.com> | ||
| 2 | |||
| 3 | * macterm.c (Vmac_use_core_graphics): defined for | ||
| 4 | mac-allow-anti-aliasing | ||
| 5 | (syms_of_macterm): Added mac-allow-anti-aliasing | ||
| 6 | (mac_draw_string_common): Use core graphics text rendering if | ||
| 7 | mac-allow-anti-aliasing is enabled. | ||
| 8 | |||
| 9 | * macfns.c (Fx_file_dialog): Save As dialog includes only the | ||
| 10 | file name in the text box. | ||
| 11 | |||
| 12 | 2005-01-15 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 13 | |||
| 14 | * macfns.c (x_set_foreground_color, x_set_background_color): Sync | ||
| 15 | with xfns.c. | ||
| 16 | (mac_window, x_create_tip_frame): Use XSetWindowBackground. | ||
| 17 | * macterm.c (XSetBackground, XSetWindowBackground): New functions. | ||
| 18 | * macterm.h (XSetBackground, XSetWindowBackground): Add externs. | ||
| 19 | |||
| 20 | 2005-01-14 Kim F. Storm <storm@cua.dk> | ||
| 21 | |||
| 22 | * keyboard.c (Fposn_at_x_y): Add optional arg WHOLE. | ||
| 23 | |||
| 24 | 2005-01-13 Richard M. Stallman <rms@gnu.org> | ||
| 25 | |||
| 26 | * keymap.c (Fcurrent_active_maps): Ignore Voverriding_local_map | ||
| 27 | if Voverriding_terminal_local_map is non-nil. | ||
| 28 | |||
| 29 | * keyboard.c (syms_of_keyboard): Doc fix. | ||
| 30 | |||
| 31 | 2005-01-13 Kim F. Storm <storm@cua.dk> | ||
| 32 | |||
| 33 | * xdisp.c (Fformat_mode_line): Fix last change. Remove NO_PROPS arg | ||
| 34 | (specify 0 for FACE instead). Reorder arg list. Doc fix. | ||
| 35 | |||
| 36 | 2005-01-12 Richard M. Stallman <rms@gnu.org> | ||
| 37 | |||
| 38 | * xdisp.c (Fformat_mode_line): New arg FACE specifies a default | ||
| 39 | face property for characters that don't specify one. | ||
| 40 | |||
| 41 | * fns.c (Frequire): Record in load-history unconditionally. | ||
| 42 | |||
| 43 | 2005-01-10 Kim F. Storm <storm@cua.dk> | ||
| 44 | |||
| 45 | * dispextern.h (merge_faces): Rename from merge_into_realized_face. | ||
| 46 | |||
| 47 | * xfaces.c (merge_faces): Rename from merge_into_realized_face. | ||
| 48 | Callers changed. | ||
| 49 | Add support to merge with lisp face id too (if face_name is t). | ||
| 50 | |||
| 51 | * xdisp.c (get_next_display_element, next_element_from_display_vector): | ||
| 52 | Don't lookup lface_id from display table glyphs here; instead use | ||
| 53 | merge_faces to merge the lisp face id into current face. | ||
| 54 | |||
| 55 | 2005-01-09 Kim F. Storm <storm@cua.dk> | ||
| 56 | |||
| 57 | * dispextern.h (struct it): New member dpvec_face_id. | ||
| 58 | (merge_into_realized_face): Add prototype. | ||
| 59 | |||
| 60 | * xfaces.c (merge_into_realized_face): New function. Used to | ||
| 61 | merge escape-glyph face or face from display table into current face. | ||
| 62 | |||
| 63 | * xdisp.c (Vshow_nonbreak_escape): New lisp var. | ||
| 64 | (syms_of_xdisp): DEFVAR_LISP it. | ||
| 65 | (escape_glyph_face): Remove var. | ||
| 66 | (redisplay_window): Don't initialize it. | ||
| 67 | (setup_for_ellipsis, get_next_display_element): | ||
| 68 | Set it->dpvec_face_id to -1. | ||
| 69 | (get_next_display_element): Test Vshow_nonbreak_escape. | ||
| 70 | Do not setup escape_glyph_face. | ||
| 71 | Properly merge escape-glyph face or face from display table with | ||
| 72 | current face for escape and control characters. Set | ||
| 73 | it->dpvec_face_id to relevant face id instead of adding it to each | ||
| 74 | element of display vector. | ||
| 75 | (next_element_from_display_vector): If it->dpvec_face_id is set, | ||
| 76 | use that instead of lface_id from glyph itself. | ||
| 77 | |||
| 78 | 2005-01-08 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 79 | |||
| 80 | * xterm.h (struct x_output): New member, toolbar_detached. | ||
| 81 | |||
| 82 | * gtkutil.c (xg_create_frame_widgets): Set initial tool bar height to | ||
| 83 | 38. | ||
| 84 | (xg_tool_bar_detach_callback): Set toolbar_detached to 1. | ||
| 85 | (xg_tool_bar_attach_callback): Set toolbar_detached to 0. | ||
| 86 | (xg_create_tool_bar): Initialize toolbar_detached. | ||
| 87 | (update_frame_tool_bar): Only set FRAME_TOOLBAR_HEIGHT (f) if | ||
| 88 | toolbar_detached is zero. | ||
| 89 | |||
| 90 | 2005-01-07 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 91 | |||
| 92 | * xmenu.c (create_and_show_popup_menu): Pass zero as button to | ||
| 93 | gtk_menu_popup if not for_click, so callbacks for the menu are called. | ||
| 94 | |||
| 95 | * gtkutil.c (xg_gtk_scroll_destroy, xg_create_scroll_bar) | ||
| 96 | (xg_tool_bar_callback, xg_tool_bar_help_callback) | ||
| 97 | (update_frame_tool_bar): Cast to EMACS_INT to avoid compiler | ||
| 98 | warning. | ||
| 99 | |||
| 100 | * xselect.c (x_get_foreign_selection, x_fill_property_data) | ||
| 101 | (Fx_get_atom_name, Fx_send_client_event): Replace XFLOAT with | ||
| 102 | XFLOAT_DATA to get extract number from Lisp object. | ||
| 103 | |||
| 104 | 2005-01-07 Kim F. Storm <storm@cua.dk> | ||
| 105 | |||
| 106 | * xdisp.c (set_iterator_to_next): Fix 2004-12-13 change. | ||
| 107 | Set stop_charpos to current charpos instead of 0. | ||
| 108 | |||
| 109 | 2005-01-06 Nick Roberts <nickrob@snap.net.nz> | ||
| 110 | |||
| 111 | * xdisp.c (Fformat_mode_line): First arg now required. | ||
| 112 | |||
| 113 | 2005-01-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 114 | |||
| 115 | * macterm.c (XLoadQueryFont): Correctly handle 0 size | ||
| 116 | font widths that are returned from some Japanese fonts. | ||
| 117 | |||
| 118 | 2005-01-06 Kim F. Storm <storm@cua.dk> | ||
| 119 | |||
| 120 | * fringe.c (fringe_faces): Change to Lisp_Object pointer. | ||
| 121 | (draw_fringe_bitmap_1): Lookup user defined fringe faces here. | ||
| 122 | (destroy_fringe_bitmap): Set fringe_faces element to nil. | ||
| 123 | (Fdefine_fringe_bitmap, init_fringe): Change allocation of | ||
| 124 | fringe_faces array and init elements to nil. | ||
| 125 | (Fset_fringe_bitmap_face): Set fringe_faces to face name instead of | ||
| 126 | non-persistent face id. | ||
| 127 | (mark_fringe_data): New function for GC. | ||
| 128 | |||
| 129 | * alloc.c (mark_fringe_data): Declare extern. | ||
| 130 | (Fgarbage_collect): Call mark_fringe_data. | ||
| 131 | |||
| 132 | * alloc.c (overrun_check_free): Invalidate freed memory if | ||
| 133 | XMALLOC_CLEAR_FREE_MEMORY is defined. | ||
| 134 | |||
| 135 | 2005-01-05 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 136 | |||
| 137 | * macfns.c: Include sys/param.h. | ||
| 138 | [TARGET_API_MAC_CARBON] (mac_nav_event_callback): New declaration | ||
| 139 | and function. | ||
| 140 | [TARGET_API_MAC_CARBON] (Fx_file_dialog): Use MAXPATHLEN for size | ||
| 141 | of filename string. Set event callback function when creating | ||
| 142 | dialog boxes. Add code conversions for filenames. Don't dispose | ||
| 143 | apple event descriptor record if failed to create it. | ||
| 144 | |||
| 145 | * macterm.c: Include sys/param.h. | ||
| 146 | [USE_CARBON_EVENTS] (mac_handle_window_event): Add handler for | ||
| 147 | kEventWindowUpdate. | ||
| 148 | (install_window_handler) [USE_CARBON_EVENTS]: Register it. | ||
| 149 | (do_ae_open_documents) [TARGET_API_MAC_CARBON]: Get FSRef instead | ||
| 150 | of FSSpec from apple event descriptor record. | ||
| 151 | (do_ae_open_documents) [TARGET_API_MAC_CARBON]: Use MAXPATHLEN for | ||
| 152 | size of filename string. | ||
| 153 | [TARGET_API_MAC_CARBON] (mac_do_receive_drag): Likewise. | ||
| 154 | [TARGET_API_MAC_CARBON] (mac_do_receive_drag): Return error when a | ||
| 155 | file dialog is in action. | ||
| 156 | [TARGET_API_MAC_CARBON] (mac_do_track_drag): Likewise. Reject | ||
| 157 | only when there are no filename items. Set background color | ||
| 158 | before (un)highlighting the window below the dragged items. | ||
| 159 | (XTread_socket) [!USE_CARBON_EVENTS]: Don't call do_window_update. | ||
| 160 | |||
| 161 | 2005-01-05 Romain Francoise <romain@orebokech.com> | ||
| 162 | |||
| 163 | * term.c (encode_terminal_code): Fix buffer size computation. | ||
| 164 | |||
| 165 | 2005-01-04 Richard M. Stallman <rms@gnu.org> | ||
| 166 | |||
| 167 | * xdisp.c (Fformat_mode_line): Doc fix. | ||
| 168 | |||
| 169 | 2005-01-04 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 170 | |||
| 171 | * alloc.c (refill_memory_reserve): Move. | ||
| 172 | (emacs_blocked_free, emacs_blocked_malloc, emacs_blocked_realloc) | ||
| 173 | (reset_malloc_hooks, uninterrupt_malloc) [SYNC_INPUT]: Don't define. | ||
| 174 | |||
| 175 | 2005-01-03 Richard M. Stallman <rms@gnu.org> | ||
| 176 | |||
| 177 | * window.c (window_scroll_pixel_based): Don't correct preserve_y | ||
| 178 | for CURRENT_HEADER_LINE_HEIGHT when moving backwards. | ||
| 179 | |||
| 180 | 2005-01-03 Jason Rumney <jasonr@gnu.org> | ||
| 181 | |||
| 182 | * w32bdf.c (w32_load_bdf_font): Set fontp->average_width and | ||
| 183 | fontp->space_width to FONT_WIDTH so they are valid. | ||
| 184 | |||
| 185 | * w32fns.c (w32_load_system_font): Set FONT_WIDTH to maximum, not | ||
| 186 | average width. Set fontp->average_width and fontp->space_width to | ||
| 187 | their appropriate values. | ||
| 188 | |||
| 189 | * w32term.c (x_new_font): Set FRAME_COLUMN_WIDTH to | ||
| 190 | fontp->average_width, not FONT_WIDTH. Set FRAME_SPACE_WIDTH to | ||
| 191 | fontp->space_width. | ||
| 192 | |||
| 193 | 2005-01-03 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 194 | |||
| 195 | * macterm.c (x_new_font): Set FRAME_SPACE_WIDTH. | ||
| 196 | (x_font_min_bounds, XLoadQueryFont): Use the correct font width | ||
| 197 | metrics for max and min bounds. | ||
| 198 | (x_load_font): Correctly calculate average font width metrics. | ||
| 199 | |||
| 200 | 2005-01-02 Richard M. Stallman <rms@gnu.org> | ||
| 201 | |||
| 202 | * alloc.c (Fgarbage_collect): Don't truncate_undo_list on dead buffers. | ||
| 203 | |||
| 1 | 2004-12-31 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | 204 | 2004-12-31 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> |
| 2 | 205 | ||
| 3 | * xterm.c (handle_one_xevent): Clear area in expose event for GTK. | 206 | * xterm.c (handle_one_xevent): Clear area in expose event for GTK. |
| @@ -48,7 +251,7 @@ | |||
| 48 | 251 | ||
| 49 | * xterm.c (x_new_font): Set FRAME_COLUMN_WIDTH to | 252 | * xterm.c (x_new_font): Set FRAME_COLUMN_WIDTH to |
| 50 | fontp->average_width, not FONT_WIDTH. Set FRAME_SPACE_WIDTH to | 253 | fontp->average_width, not FONT_WIDTH. Set FRAME_SPACE_WIDTH to |
| 51 | fontp-?space_width.. | 254 | fontp->space_width. |
| 52 | (x_load_font): Calculate fontp->space_width and | 255 | (x_load_font): Calculate fontp->space_width and |
| 53 | fontp->average_width. | 256 | fontp->average_width. |
| 54 | (x_term_init): Initialize dpyinfo->Xatom_AVERAGE_WIDTH. | 257 | (x_term_init): Initialize dpyinfo->Xatom_AVERAGE_WIDTH. |
| @@ -298,6 +501,10 @@ | |||
| 298 | * gtkutil.c (xg_initialize): Install bindings for C-g so that | 501 | * gtkutil.c (xg_initialize): Install bindings for C-g so that |
| 299 | dialogs and menus pop down. | 502 | dialogs and menus pop down. |
| 300 | 503 | ||
| 504 | 2004-12-27 Kenichi Handa <handa@m17n.org> | ||
| 505 | |||
| 506 | * coding.c (code_convert_region): Fix calculation of `ratio'. | ||
| 507 | |||
| 301 | 2004-12-25 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | 508 | 2004-12-25 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> |
| 302 | 509 | ||
| 303 | * gtkutil.c (update_frame_tool_bar): Make the value of | 510 | * gtkutil.c (update_frame_tool_bar): Make the value of |
diff --git a/src/alloc.c b/src/alloc.c index 6c393e9213b..998f736b9c5 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -103,7 +103,7 @@ extern __malloc_size_t __malloc_extra_blocks; | |||
| 103 | that the backend handles concurrent access to malloc within its own threads | 103 | that the backend handles concurrent access to malloc within its own threads |
| 104 | but Emacs code running in the main thread is not included in that control). | 104 | but Emacs code running in the main thread is not included in that control). |
| 105 | 105 | ||
| 106 | When UNBLOCK_INPUT is called, revoke_input_signal may be called. If this | 106 | When UNBLOCK_INPUT is called, reinvoke_input_signal may be called. If this |
| 107 | happens in one of the backend threads we will have two threads that tries | 107 | happens in one of the backend threads we will have two threads that tries |
| 108 | to run Emacs code at once, and the code is not prepared for that. | 108 | to run Emacs code at once, and the code is not prepared for that. |
| 109 | To prevent that, we only call BLOCK/UNBLOCK from the main thread. */ | 109 | To prevent that, we only call BLOCK/UNBLOCK from the main thread. */ |
| @@ -309,6 +309,7 @@ static void mark_glyph_matrix P_ ((struct glyph_matrix *)); | |||
| 309 | static void mark_face_cache P_ ((struct face_cache *)); | 309 | static void mark_face_cache P_ ((struct face_cache *)); |
| 310 | 310 | ||
| 311 | #ifdef HAVE_WINDOW_SYSTEM | 311 | #ifdef HAVE_WINDOW_SYSTEM |
| 312 | extern void mark_fringe_data P_ ((void)); | ||
| 312 | static void mark_image P_ ((struct image *)); | 313 | static void mark_image P_ ((struct image *)); |
| 313 | static void mark_image_cache P_ ((struct frame *)); | 314 | static void mark_image_cache P_ ((struct frame *)); |
| 314 | #endif /* HAVE_WINDOW_SYSTEM */ | 315 | #endif /* HAVE_WINDOW_SYSTEM */ |
| @@ -704,9 +705,14 @@ overrun_check_free (block) | |||
| 704 | val + osize, | 705 | val + osize, |
| 705 | XMALLOC_OVERRUN_CHECK_SIZE)) | 706 | XMALLOC_OVERRUN_CHECK_SIZE)) |
| 706 | abort (); | 707 | abort (); |
| 708 | #ifdef XMALLOC_CLEAR_FREE_MEMORY | ||
| 709 | val -= XMALLOC_OVERRUN_CHECK_SIZE; | ||
| 710 | memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_SIZE*2); | ||
| 711 | #else | ||
| 707 | bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE); | 712 | bzero (val + osize, XMALLOC_OVERRUN_CHECK_SIZE); |
| 708 | val -= XMALLOC_OVERRUN_CHECK_SIZE; | 713 | val -= XMALLOC_OVERRUN_CHECK_SIZE; |
| 709 | bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); | 714 | bzero (val, XMALLOC_OVERRUN_CHECK_SIZE); |
| 715 | #endif | ||
| 710 | } | 716 | } |
| 711 | 717 | ||
| 712 | free (val); | 718 | free (val); |
| @@ -1113,17 +1119,34 @@ allocate_buffer () | |||
| 1113 | } | 1119 | } |
| 1114 | 1120 | ||
| 1115 | 1121 | ||
| 1122 | #ifndef SYSTEM_MALLOC | ||
| 1123 | |||
| 1124 | /* If we released our reserve (due to running out of memory), | ||
| 1125 | and we have a fair amount free once again, | ||
| 1126 | try to set aside another reserve in case we run out once more. | ||
| 1127 | |||
| 1128 | This is called when a relocatable block is freed in ralloc.c. */ | ||
| 1129 | |||
| 1130 | void | ||
| 1131 | refill_memory_reserve () | ||
| 1132 | { | ||
| 1133 | if (spare_memory == 0) | ||
| 1134 | spare_memory = (char *) malloc ((size_t) SPARE_MEMORY); | ||
| 1135 | } | ||
| 1136 | |||
| 1137 | |||
| 1116 | /* Arranging to disable input signals while we're in malloc. | 1138 | /* Arranging to disable input signals while we're in malloc. |
| 1117 | 1139 | ||
| 1118 | This only works with GNU malloc. To help out systems which can't | 1140 | This only works with GNU malloc. To help out systems which can't |
| 1119 | use GNU malloc, all the calls to malloc, realloc, and free | 1141 | use GNU malloc, all the calls to malloc, realloc, and free |
| 1120 | elsewhere in the code should be inside a BLOCK_INPUT/UNBLOCK_INPUT | 1142 | elsewhere in the code should be inside a BLOCK_INPUT/UNBLOCK_INPUT |
| 1121 | pairs; unfortunately, we have no idea what C library functions | 1143 | pair; unfortunately, we have no idea what C library functions |
| 1122 | might call malloc, so we can't really protect them unless you're | 1144 | might call malloc, so we can't really protect them unless you're |
| 1123 | using GNU malloc. Fortunately, most of the major operating systems | 1145 | using GNU malloc. Fortunately, most of the major operating systems |
| 1124 | can use GNU malloc. */ | 1146 | can use GNU malloc. */ |
| 1125 | 1147 | ||
| 1126 | #ifndef SYSTEM_MALLOC | 1148 | #ifndef SYNC_INPUT |
| 1149 | |||
| 1127 | #ifndef DOUG_LEA_MALLOC | 1150 | #ifndef DOUG_LEA_MALLOC |
| 1128 | extern void * (*__malloc_hook) P_ ((size_t)); | 1151 | extern void * (*__malloc_hook) P_ ((size_t)); |
| 1129 | extern void * (*__realloc_hook) P_ ((void *, size_t)); | 1152 | extern void * (*__realloc_hook) P_ ((void *, size_t)); |
| @@ -1182,20 +1205,6 @@ emacs_blocked_free (ptr) | |||
| 1182 | } | 1205 | } |
| 1183 | 1206 | ||
| 1184 | 1207 | ||
| 1185 | /* If we released our reserve (due to running out of memory), | ||
| 1186 | and we have a fair amount free once again, | ||
| 1187 | try to set aside another reserve in case we run out once more. | ||
| 1188 | |||
| 1189 | This is called when a relocatable block is freed in ralloc.c. */ | ||
| 1190 | |||
| 1191 | void | ||
| 1192 | refill_memory_reserve () | ||
| 1193 | { | ||
| 1194 | if (spare_memory == 0) | ||
| 1195 | spare_memory = (char *) malloc ((size_t) SPARE_MEMORY); | ||
| 1196 | } | ||
| 1197 | |||
| 1198 | |||
| 1199 | /* This function is the malloc hook that Emacs uses. */ | 1208 | /* This function is the malloc hook that Emacs uses. */ |
| 1200 | 1209 | ||
| 1201 | static void * | 1210 | static void * |
| @@ -1347,6 +1356,7 @@ uninterrupt_malloc () | |||
| 1347 | __realloc_hook = emacs_blocked_realloc; | 1356 | __realloc_hook = emacs_blocked_realloc; |
| 1348 | } | 1357 | } |
| 1349 | 1358 | ||
| 1359 | #endif /* not SYNC_INPUT */ | ||
| 1350 | #endif /* not SYSTEM_MALLOC */ | 1360 | #endif /* not SYSTEM_MALLOC */ |
| 1351 | 1361 | ||
| 1352 | 1362 | ||
| @@ -4640,7 +4650,7 @@ returns nil, because real GC can't be done. */) | |||
| 4640 | turned off in that buffer. Calling truncate_undo_list on | 4650 | turned off in that buffer. Calling truncate_undo_list on |
| 4641 | Qt tends to return NULL, which effectively turns undo back on. | 4651 | Qt tends to return NULL, which effectively turns undo back on. |
| 4642 | So don't call truncate_undo_list if undo_list is Qt. */ | 4652 | So don't call truncate_undo_list if undo_list is Qt. */ |
| 4643 | if (! EQ (nextb->undo_list, Qt)) | 4653 | if (! NILP (nextb->name) && ! EQ (nextb->undo_list, Qt)) |
| 4644 | truncate_undo_list (nextb); | 4654 | truncate_undo_list (nextb); |
| 4645 | 4655 | ||
| 4646 | /* Shrink buffer gaps, but skip indirect and dead buffers. */ | 4656 | /* Shrink buffer gaps, but skip indirect and dead buffers. */ |
| @@ -4752,6 +4762,10 @@ returns nil, because real GC can't be done. */) | |||
| 4752 | } | 4762 | } |
| 4753 | mark_backtrace (); | 4763 | mark_backtrace (); |
| 4754 | 4764 | ||
| 4765 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 4766 | mark_fringe_data (); | ||
| 4767 | #endif | ||
| 4768 | |||
| 4755 | #if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES | 4769 | #if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES |
| 4756 | mark_stack (); | 4770 | mark_stack (); |
| 4757 | #endif | 4771 | #endif |
diff --git a/src/dispextern.h b/src/dispextern.h index bc63455083b..8a24551260d 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -1841,6 +1841,9 @@ struct it | |||
| 1841 | means that no such character is involved. */ | 1841 | means that no such character is involved. */ |
| 1842 | int dpvec_char_len; | 1842 | int dpvec_char_len; |
| 1843 | 1843 | ||
| 1844 | /* Face id to use for all characters in display vector. -1 if unused. */ | ||
| 1845 | int dpvec_face_id; | ||
| 1846 | |||
| 1844 | /* Face id of the iterator saved in case a glyph from dpvec contains | 1847 | /* Face id of the iterator saved in case a glyph from dpvec contains |
| 1845 | a face. The face is restored when all glyphs from dpvec have | 1848 | a face. The face is restored when all glyphs from dpvec have |
| 1846 | been delivered. */ | 1849 | been delivered. */ |
| @@ -2755,6 +2758,7 @@ int face_at_buffer_position P_ ((struct window *, int, int, int, int *, | |||
| 2755 | int, int)); | 2758 | int, int)); |
| 2756 | int face_at_string_position P_ ((struct window *, Lisp_Object, int, int, int, | 2759 | int face_at_string_position P_ ((struct window *, Lisp_Object, int, int, int, |
| 2757 | int, int *, enum face_id, int)); | 2760 | int, int *, enum face_id, int)); |
| 2761 | int merge_faces P_ ((struct frame *, Lisp_Object, int, int)); | ||
| 2758 | int compute_char_face P_ ((struct frame *, int, Lisp_Object)); | 2762 | int compute_char_face P_ ((struct frame *, int, Lisp_Object)); |
| 2759 | void free_all_realized_faces P_ ((Lisp_Object)); | 2763 | void free_all_realized_faces P_ ((Lisp_Object)); |
| 2760 | void free_realized_face P_ ((struct frame *, struct face *)); | 2764 | void free_realized_face P_ ((struct frame *, struct face *)); |
| @@ -2906,6 +2906,10 @@ The normal messages at start and end of loading FILENAME are suppressed. */) | |||
| 2906 | 2906 | ||
| 2907 | CHECK_SYMBOL (feature); | 2907 | CHECK_SYMBOL (feature); |
| 2908 | 2908 | ||
| 2909 | /* Record the presence of `require' in this file | ||
| 2910 | even if the feature specified is already loaded. */ | ||
| 2911 | LOADHIST_ATTACH (Fcons (Qrequire, feature)); | ||
| 2912 | |||
| 2909 | tem = Fmemq (feature, Vfeatures); | 2913 | tem = Fmemq (feature, Vfeatures); |
| 2910 | 2914 | ||
| 2911 | if (NILP (tem)) | 2915 | if (NILP (tem)) |
| @@ -2913,8 +2917,6 @@ The normal messages at start and end of loading FILENAME are suppressed. */) | |||
| 2913 | int count = SPECPDL_INDEX (); | 2917 | int count = SPECPDL_INDEX (); |
| 2914 | int nesting = 0; | 2918 | int nesting = 0; |
| 2915 | 2919 | ||
| 2916 | LOADHIST_ATTACH (Fcons (Qrequire, feature)); | ||
| 2917 | |||
| 2918 | /* This is to make sure that loadup.el gives a clear picture | 2920 | /* This is to make sure that loadup.el gives a clear picture |
| 2919 | of what files are preloaded and when. */ | 2921 | of what files are preloaded and when. */ |
| 2920 | if (! NILP (Vpurify_flag)) | 2922 | if (! NILP (Vpurify_flag)) |
diff --git a/src/fringe.c b/src/fringe.c index 52273af13ef..0373a736038 100644 --- a/src/fringe.c +++ b/src/fringe.c | |||
| @@ -446,7 +446,7 @@ struct fringe_bitmap standard_bitmaps[MAX_STANDARD_FRINGE_BITMAPS] = | |||
| 446 | }; | 446 | }; |
| 447 | 447 | ||
| 448 | static struct fringe_bitmap **fringe_bitmaps; | 448 | static struct fringe_bitmap **fringe_bitmaps; |
| 449 | static unsigned *fringe_faces; | 449 | static Lisp_Object *fringe_faces; |
| 450 | static int max_fringe_bitmaps; | 450 | static int max_fringe_bitmaps; |
| 451 | 451 | ||
| 452 | static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS; | 452 | static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS; |
| @@ -547,7 +547,13 @@ draw_fringe_bitmap_1 (w, row, left_p, overlay, which) | |||
| 547 | } | 547 | } |
| 548 | 548 | ||
| 549 | if (face_id == DEFAULT_FACE_ID) | 549 | if (face_id == DEFAULT_FACE_ID) |
| 550 | face_id = fringe_faces[which]; | 550 | { |
| 551 | Lisp_Object face; | ||
| 552 | |||
| 553 | if ((face = fringe_faces[which], NILP (face)) | ||
| 554 | || (face_id = lookup_named_face (f, face, 'A', 1), face_id < 0)) | ||
| 555 | face_id = FRINGE_FACE_ID; | ||
| 556 | } | ||
| 551 | 557 | ||
| 552 | fb = fringe_bitmaps[which]; | 558 | fb = fringe_bitmaps[which]; |
| 553 | if (fb == NULL) | 559 | if (fb == NULL) |
| @@ -574,7 +580,8 @@ draw_fringe_bitmap_1 (w, row, left_p, overlay, which) | |||
| 574 | 580 | ||
| 575 | if (p.face == NULL) | 581 | if (p.face == NULL) |
| 576 | { | 582 | { |
| 577 | /* Why does this happen? ++kfs */ | 583 | /* This could happen after clearing face cache. |
| 584 | But it shouldn't happen anymore. ++kfs */ | ||
| 578 | return; | 585 | return; |
| 579 | } | 586 | } |
| 580 | 587 | ||
| @@ -1073,7 +1080,7 @@ destroy_fringe_bitmap (n) | |||
| 1073 | { | 1080 | { |
| 1074 | struct fringe_bitmap **fbp; | 1081 | struct fringe_bitmap **fbp; |
| 1075 | 1082 | ||
| 1076 | fringe_faces[n] = FRINGE_FACE_ID; | 1083 | fringe_faces[n] = Qnil; |
| 1077 | 1084 | ||
| 1078 | fbp = &fringe_bitmaps[n]; | 1085 | fbp = &fringe_bitmaps[n]; |
| 1079 | if (*fbp && (*fbp)->dynamic) | 1086 | if (*fbp && (*fbp)->dynamic) |
| @@ -1294,12 +1301,12 @@ If BITMAP already exists, the existing definition is replaced. */) | |||
| 1294 | = ((struct fringe_bitmap **) | 1301 | = ((struct fringe_bitmap **) |
| 1295 | xrealloc (fringe_bitmaps, max_fringe_bitmaps * sizeof (struct fringe_bitmap *))); | 1302 | xrealloc (fringe_bitmaps, max_fringe_bitmaps * sizeof (struct fringe_bitmap *))); |
| 1296 | fringe_faces | 1303 | fringe_faces |
| 1297 | = (unsigned *) xrealloc (fringe_faces, max_fringe_bitmaps * sizeof (unsigned)); | 1304 | = (unsigned *) xrealloc (fringe_faces, max_fringe_bitmaps * sizeof (Lisp_Object)); |
| 1298 | 1305 | ||
| 1299 | for (; i < max_fringe_bitmaps; i++) | 1306 | for (; i < max_fringe_bitmaps; i++) |
| 1300 | { | 1307 | { |
| 1301 | fringe_bitmaps[i] = NULL; | 1308 | fringe_bitmaps[i] = NULL; |
| 1302 | fringe_faces[i] = FRINGE_FACE_ID; | 1309 | fringe_faces[i] = Qnil; |
| 1303 | } | 1310 | } |
| 1304 | } | 1311 | } |
| 1305 | } | 1312 | } |
| @@ -1357,10 +1364,8 @@ If FACE is nil, reset face to default fringe face. */) | |||
| 1357 | if (face_id < 0) | 1364 | if (face_id < 0) |
| 1358 | error ("No such face"); | 1365 | error ("No such face"); |
| 1359 | } | 1366 | } |
| 1360 | else | ||
| 1361 | face_id = FRINGE_FACE_ID; | ||
| 1362 | 1367 | ||
| 1363 | fringe_faces[n] = face_id; | 1368 | fringe_faces[n] = face; |
| 1364 | 1369 | ||
| 1365 | return Qnil; | 1370 | return Qnil; |
| 1366 | } | 1371 | } |
| @@ -1434,6 +1439,18 @@ You must (require 'fringe) to use fringe bitmap symbols in your programs." */); | |||
| 1434 | Vfringe_bitmaps = Qnil; | 1439 | Vfringe_bitmaps = Qnil; |
| 1435 | } | 1440 | } |
| 1436 | 1441 | ||
| 1442 | /* Garbage collection hook */ | ||
| 1443 | |||
| 1444 | void | ||
| 1445 | mark_fringe_data () | ||
| 1446 | { | ||
| 1447 | int i; | ||
| 1448 | |||
| 1449 | for (i = 0; i < max_fringe_bitmaps; i++) | ||
| 1450 | if (!NILP (fringe_faces[i])) | ||
| 1451 | mark_object (fringe_faces[i]); | ||
| 1452 | } | ||
| 1453 | |||
| 1437 | /* Initialize this module when Emacs starts. */ | 1454 | /* Initialize this module when Emacs starts. */ |
| 1438 | 1455 | ||
| 1439 | void | 1456 | void |
| @@ -1455,12 +1472,12 @@ init_fringe () | |||
| 1455 | fringe_bitmaps | 1472 | fringe_bitmaps |
| 1456 | = (struct fringe_bitmap **) xmalloc (max_fringe_bitmaps * sizeof (struct fringe_bitmap *)); | 1473 | = (struct fringe_bitmap **) xmalloc (max_fringe_bitmaps * sizeof (struct fringe_bitmap *)); |
| 1457 | fringe_faces | 1474 | fringe_faces |
| 1458 | = (unsigned *) xmalloc (max_fringe_bitmaps * sizeof (unsigned)); | 1475 | = (unsigned *) xmalloc (max_fringe_bitmaps * sizeof (Lisp_Object)); |
| 1459 | 1476 | ||
| 1460 | for (i = 0; i < max_fringe_bitmaps; i++) | 1477 | for (i = 0; i < max_fringe_bitmaps; i++) |
| 1461 | { | 1478 | { |
| 1462 | fringe_bitmaps[i] = NULL; | 1479 | fringe_bitmaps[i] = NULL; |
| 1463 | fringe_faces[i] = FRINGE_FACE_ID; | 1480 | fringe_faces[i] = Qnil; |
| 1464 | } | 1481 | } |
| 1465 | } | 1482 | } |
| 1466 | 1483 | ||
diff --git a/src/gtkutil.c b/src/gtkutil.c index 22919230a65..39d5e768dda 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -756,7 +756,7 @@ xg_create_frame_widgets (f) | |||
| 756 | So we cheat a bit by setting a height that is what it will have | 756 | So we cheat a bit by setting a height that is what it will have |
| 757 | later on when tool bar items are added. */ | 757 | later on when tool bar items are added. */ |
| 758 | if (FRAME_EXTERNAL_TOOL_BAR (f) && f->n_tool_bar_items == 0) | 758 | if (FRAME_EXTERNAL_TOOL_BAR (f) && f->n_tool_bar_items == 0) |
| 759 | FRAME_TOOLBAR_HEIGHT (f) = 34; | 759 | FRAME_TOOLBAR_HEIGHT (f) = 38; |
| 760 | 760 | ||
| 761 | 761 | ||
| 762 | /* We don't want this widget double buffered, because we draw on it | 762 | /* We don't want this widget double buffered, because we draw on it |
| @@ -2850,7 +2850,7 @@ xg_gtk_scroll_destroy (widget, data) | |||
| 2850 | gpointer data; | 2850 | gpointer data; |
| 2851 | { | 2851 | { |
| 2852 | gpointer p; | 2852 | gpointer p; |
| 2853 | int id = (int)data; | 2853 | int id = (int) (EMACS_INT) data; /* The EMACS_INT cast avoids a warning. */ |
| 2854 | 2854 | ||
| 2855 | p = g_object_get_data (G_OBJECT (widget), XG_LAST_SB_DATA); | 2855 | p = g_object_get_data (G_OBJECT (widget), XG_LAST_SB_DATA); |
| 2856 | if (p) xfree (p); | 2856 | if (p) xfree (p); |
| @@ -2920,10 +2920,11 @@ xg_create_scroll_bar (f, bar, scroll_callback, scroll_bar_name) | |||
| 2920 | "value-changed", | 2920 | "value-changed", |
| 2921 | scroll_callback, | 2921 | scroll_callback, |
| 2922 | (gpointer) bar); | 2922 | (gpointer) bar); |
| 2923 | /* The EMACS_INT cast avoids a warning. */ | ||
| 2923 | g_signal_connect (G_OBJECT (wscroll), | 2924 | g_signal_connect (G_OBJECT (wscroll), |
| 2924 | "destroy", | 2925 | "destroy", |
| 2925 | G_CALLBACK (xg_gtk_scroll_destroy), | 2926 | G_CALLBACK (xg_gtk_scroll_destroy), |
| 2926 | (gpointer) scroll_id); | 2927 | (gpointer) (EMACS_INT) scroll_id); |
| 2927 | 2928 | ||
| 2928 | /* Connect to button press and button release to detect if any scroll bar | 2929 | /* Connect to button press and button release to detect if any scroll bar |
| 2929 | has the pointer. */ | 2930 | has the pointer. */ |
| @@ -3112,7 +3113,8 @@ xg_tool_bar_callback (w, client_data) | |||
| 3112 | GtkWidget *w; | 3113 | GtkWidget *w; |
| 3113 | gpointer client_data; | 3114 | gpointer client_data; |
| 3114 | { | 3115 | { |
| 3115 | int idx = (int)client_data; | 3116 | /* The EMACS_INT cast avoids a warning. */ |
| 3117 | int idx = (int) (EMACS_INT) client_data; | ||
| 3116 | FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); | 3118 | FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); |
| 3117 | Lisp_Object key, frame; | 3119 | Lisp_Object key, frame; |
| 3118 | struct input_event event; | 3120 | struct input_event event; |
| @@ -3154,6 +3156,8 @@ xg_tool_bar_detach_callback (wbox, w, client_data) | |||
| 3154 | 3156 | ||
| 3155 | if (f) | 3157 | if (f) |
| 3156 | { | 3158 | { |
| 3159 | FRAME_X_OUTPUT (f)->toolbar_detached = 1; | ||
| 3160 | |||
| 3157 | /* When detaching a tool bar, not everything dissapear. There are | 3161 | /* When detaching a tool bar, not everything dissapear. There are |
| 3158 | a few pixels left that are used to drop the tool bar back into | 3162 | a few pixels left that are used to drop the tool bar back into |
| 3159 | place. */ | 3163 | place. */ |
| @@ -3185,11 +3189,13 @@ xg_tool_bar_attach_callback (wbox, w, client_data) | |||
| 3185 | { | 3189 | { |
| 3186 | GtkRequisition req; | 3190 | GtkRequisition req; |
| 3187 | 3191 | ||
| 3192 | FRAME_X_OUTPUT (f)->toolbar_detached = 0; | ||
| 3193 | |||
| 3188 | gtk_widget_size_request (w, &req); | 3194 | gtk_widget_size_request (w, &req); |
| 3189 | FRAME_TOOLBAR_HEIGHT (f) = req.height; | 3195 | FRAME_TOOLBAR_HEIGHT (f) = req.height; |
| 3190 | 3196 | ||
| 3191 | /* The height has changed, resize outer widget and set columns | 3197 | /* The height has changed, resize outer widget and set columns |
| 3192 | rows to what we had before detaching the tool bar. */ | 3198 | rows to what we had before attaching the tool bar. */ |
| 3193 | xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); | 3199 | xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); |
| 3194 | } | 3200 | } |
| 3195 | } | 3201 | } |
| @@ -3209,7 +3215,8 @@ xg_tool_bar_help_callback (w, event, client_data) | |||
| 3209 | GdkEventCrossing *event; | 3215 | GdkEventCrossing *event; |
| 3210 | gpointer client_data; | 3216 | gpointer client_data; |
| 3211 | { | 3217 | { |
| 3212 | int idx = (int)client_data; | 3218 | /* The EMACS_INT cast avoids a warning. */ |
| 3219 | int idx = (int) (EMACS_INT) client_data; | ||
| 3213 | FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); | 3220 | FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); |
| 3214 | Lisp_Object help, frame; | 3221 | Lisp_Object help, frame; |
| 3215 | 3222 | ||
| @@ -3302,6 +3309,8 @@ xg_create_tool_bar (f) | |||
| 3302 | 3309 | ||
| 3303 | x->toolbar_widget = gtk_toolbar_new (); | 3310 | x->toolbar_widget = gtk_toolbar_new (); |
| 3304 | x->handlebox_widget = gtk_handle_box_new (); | 3311 | x->handlebox_widget = gtk_handle_box_new (); |
| 3312 | x->toolbar_detached = 0; | ||
| 3313 | |||
| 3305 | gtk_container_add (GTK_CONTAINER (x->handlebox_widget), | 3314 | gtk_container_add (GTK_CONTAINER (x->handlebox_widget), |
| 3306 | x->toolbar_widget); | 3315 | x->toolbar_widget); |
| 3307 | 3316 | ||
| @@ -3452,11 +3461,12 @@ update_frame_tool_bar (f) | |||
| 3452 | 3461 | ||
| 3453 | gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); | 3462 | gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); |
| 3454 | 3463 | ||
| 3464 | /* The EMACS_INT cast avoids a warning. */ | ||
| 3455 | gtk_toolbar_append_item (GTK_TOOLBAR (x->toolbar_widget), | 3465 | gtk_toolbar_append_item (GTK_TOOLBAR (x->toolbar_widget), |
| 3456 | 0, 0, 0, | 3466 | 0, 0, 0, |
| 3457 | w, | 3467 | w, |
| 3458 | GTK_SIGNAL_FUNC (xg_tool_bar_callback), | 3468 | GTK_SIGNAL_FUNC (xg_tool_bar_callback), |
| 3459 | (gpointer)i); | 3469 | (gpointer) (EMACS_INT) i); |
| 3460 | 3470 | ||
| 3461 | /* Save the image so we can see if an update is needed when | 3471 | /* Save the image so we can see if an update is needed when |
| 3462 | this function is called again. */ | 3472 | this function is called again. */ |
| @@ -3486,14 +3496,15 @@ update_frame_tool_bar (f) | |||
| 3486 | rather than the GtkButton specific signals "enter" and | 3496 | rather than the GtkButton specific signals "enter" and |
| 3487 | "leave", so we can have only one callback. The event | 3497 | "leave", so we can have only one callback. The event |
| 3488 | will tell us what kind of event it is. */ | 3498 | will tell us what kind of event it is. */ |
| 3499 | /* The EMACS_INT cast avoids a warning. */ | ||
| 3489 | g_signal_connect (G_OBJECT (w), | 3500 | g_signal_connect (G_OBJECT (w), |
| 3490 | "enter-notify-event", | 3501 | "enter-notify-event", |
| 3491 | G_CALLBACK (xg_tool_bar_help_callback), | 3502 | G_CALLBACK (xg_tool_bar_help_callback), |
| 3492 | (gpointer)i); | 3503 | (gpointer) (EMACS_INT) i); |
| 3493 | g_signal_connect (G_OBJECT (w), | 3504 | g_signal_connect (G_OBJECT (w), |
| 3494 | "leave-notify-event", | 3505 | "leave-notify-event", |
| 3495 | G_CALLBACK (xg_tool_bar_help_callback), | 3506 | G_CALLBACK (xg_tool_bar_help_callback), |
| 3496 | (gpointer)i); | 3507 | (gpointer) (EMACS_INT) i); |
| 3497 | } | 3508 | } |
| 3498 | } | 3509 | } |
| 3499 | else | 3510 | else |
| @@ -3532,7 +3543,8 @@ update_frame_tool_bar (f) | |||
| 3532 | } | 3543 | } |
| 3533 | 3544 | ||
| 3534 | gtk_widget_size_request (x->toolbar_widget, &new_req); | 3545 | gtk_widget_size_request (x->toolbar_widget, &new_req); |
| 3535 | if (old_req.height != new_req.height) | 3546 | if (old_req.height != new_req.height |
| 3547 | && ! FRAME_X_OUTPUT (f)->toolbar_detached) | ||
| 3536 | { | 3548 | { |
| 3537 | FRAME_TOOLBAR_HEIGHT (f) = new_req.height; | 3549 | FRAME_TOOLBAR_HEIGHT (f) = new_req.height; |
| 3538 | xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); | 3550 | xg_resize_outer_widget (f, FRAME_COLS (f), FRAME_LINES (f)); |
diff --git a/src/keyboard.c b/src/keyboard.c index 29e65d3acda..7efea38121e 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -6845,7 +6845,7 @@ input_available_signal (signo) | |||
| 6845 | #else | 6845 | #else |
| 6846 | SIGNAL_THREAD_CHECK (signo); | 6846 | SIGNAL_THREAD_CHECK (signo); |
| 6847 | #endif | 6847 | #endif |
| 6848 | 6848 | ||
| 6849 | if (input_available_clear_time) | 6849 | if (input_available_clear_time) |
| 6850 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); | 6850 | EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0); |
| 6851 | 6851 | ||
| @@ -10516,17 +10516,19 @@ The elements of this list correspond to the arguments of | |||
| 10516 | return Flist (sizeof (val) / sizeof (val[0]), val); | 10516 | return Flist (sizeof (val) / sizeof (val[0]), val); |
| 10517 | } | 10517 | } |
| 10518 | 10518 | ||
| 10519 | DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, 2, 3, 0, | 10519 | DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, 2, 4, 0, |
| 10520 | doc: /* Return position information for pixel coordinates X and Y. | 10520 | doc: /* Return position information for pixel coordinates X and Y. |
| 10521 | By default, X and Y are relative to text area of the selected window. | 10521 | By default, X and Y are relative to text area of the selected window. |
| 10522 | Optional third arg FRAME_OR_WINDOW non-nil specifies frame or window. | 10522 | Optional third arg FRAME_OR_WINDOW non-nil specifies frame or window. |
| 10523 | If optional fourth arg WHOLE is non-nil, X is relative to the left | ||
| 10524 | edge of the window. | ||
| 10523 | 10525 | ||
| 10524 | The return value is similar to a mouse click position: | 10526 | The return value is similar to a mouse click position: |
| 10525 | (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW) | 10527 | (WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW) |
| 10526 | IMAGE (DX . DY) (WIDTH . HEIGHT)) | 10528 | IMAGE (DX . DY) (WIDTH . HEIGHT)) |
| 10527 | The `posn-' functions access elements of such lists. */) | 10529 | The `posn-' functions access elements of such lists. */) |
| 10528 | (x, y, frame_or_window) | 10530 | (x, y, frame_or_window, whole) |
| 10529 | Lisp_Object x, y, frame_or_window; | 10531 | Lisp_Object x, y, frame_or_window, whole; |
| 10530 | { | 10532 | { |
| 10531 | if (NILP (frame_or_window)) | 10533 | if (NILP (frame_or_window)) |
| 10532 | frame_or_window = selected_window; | 10534 | frame_or_window = selected_window; |
| @@ -10539,7 +10541,10 @@ The `posn-' functions access elements of such lists. */) | |||
| 10539 | 10541 | ||
| 10540 | w = XWINDOW (frame_or_window); | 10542 | w = XWINDOW (frame_or_window); |
| 10541 | XSETINT (x, (WINDOW_TO_FRAME_PIXEL_X (w, XINT (x)) | 10543 | XSETINT (x, (WINDOW_TO_FRAME_PIXEL_X (w, XINT (x)) |
| 10542 | + window_box_left_offset (w, TEXT_AREA))); | 10544 | + (NILP (whole) |
| 10545 | ? window_box_left_offset (w, TEXT_AREA) | ||
| 10546 | : - (WINDOW_LEFT_SCROLL_BAR_COLS (w) | ||
| 10547 | * WINDOW_FRAME_COLUMN_WIDTH (w))))); | ||
| 10543 | XSETINT (y, WINDOW_TO_FRAME_PIXEL_Y (w, XINT (y))); | 10548 | XSETINT (y, WINDOW_TO_FRAME_PIXEL_Y (w, XINT (y))); |
| 10544 | frame_or_window = w->frame; | 10549 | frame_or_window = w->frame; |
| 10545 | } | 10550 | } |
| @@ -10567,7 +10572,7 @@ The `posn-' functions access elements of such lists. */) | |||
| 10567 | 10572 | ||
| 10568 | tem = Fpos_visible_in_window_p (pos, window, Qt); | 10573 | tem = Fpos_visible_in_window_p (pos, window, Qt); |
| 10569 | if (!NILP (tem)) | 10574 | if (!NILP (tem)) |
| 10570 | tem = Fposn_at_x_y (XCAR (tem), XCAR (XCDR (tem)), window); | 10575 | tem = Fposn_at_x_y (XCAR (tem), XCAR (XCDR (tem)), window, Qnil); |
| 10571 | return tem; | 10576 | return tem; |
| 10572 | } | 10577 | } |
| 10573 | 10578 | ||
| @@ -11267,14 +11272,15 @@ The elements of the list are event types that may have menu bar bindings. */); | |||
| 11267 | doc: /* Per-terminal keymap that overrides all other local keymaps. | 11272 | doc: /* Per-terminal keymap that overrides all other local keymaps. |
| 11268 | If this variable is non-nil, it is used as a keymap instead of the | 11273 | If this variable is non-nil, it is used as a keymap instead of the |
| 11269 | buffer's local map, and the minor mode keymaps and text property keymaps. | 11274 | buffer's local map, and the minor mode keymaps and text property keymaps. |
| 11270 | It also overrides `overriding-local-map'. | 11275 | It also replaces `overriding-local-map'. |
| 11276 | |||
| 11271 | This variable is intended to let commands such as `universal-argument' | 11277 | This variable is intended to let commands such as `universal-argument' |
| 11272 | set up a different keymap for reading the next command. */); | 11278 | set up a different keymap for reading the next command. */); |
| 11273 | 11279 | ||
| 11274 | DEFVAR_LISP ("overriding-local-map", &Voverriding_local_map, | 11280 | DEFVAR_LISP ("overriding-local-map", &Voverriding_local_map, |
| 11275 | doc: /* Keymap that overrides all other local keymaps. | 11281 | doc: /* Keymap that overrides all other local keymaps. |
| 11276 | If this variable is non-nil, it is used as a keymap instead of the | 11282 | If this variable is non-nil, it is used as a keymap--replacing the |
| 11277 | buffer's local map, and the minor mode keymaps and text property keymaps. */); | 11283 | buffer's local map, the minor mode keymaps, and char property keymaps. */); |
| 11278 | Voverriding_local_map = Qnil; | 11284 | Voverriding_local_map = Qnil; |
| 11279 | 11285 | ||
| 11280 | DEFVAR_LISP ("overriding-local-map-menu-flag", &Voverriding_local_map_menu_flag, | 11286 | DEFVAR_LISP ("overriding-local-map-menu-flag", &Voverriding_local_map_menu_flag, |
diff --git a/src/keymap.c b/src/keymap.c index 5a7c8b19123..ea0b1843b85 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -1519,10 +1519,13 @@ OLP if non-nil indicates that we should obey `overriding-local-map' and | |||
| 1519 | 1519 | ||
| 1520 | if (!NILP (olp)) | 1520 | if (!NILP (olp)) |
| 1521 | { | 1521 | { |
| 1522 | if (!NILP (Voverriding_local_map)) | ||
| 1523 | keymaps = Fcons (Voverriding_local_map, keymaps); | ||
| 1524 | if (!NILP (current_kboard->Voverriding_terminal_local_map)) | 1522 | if (!NILP (current_kboard->Voverriding_terminal_local_map)) |
| 1525 | keymaps = Fcons (current_kboard->Voverriding_terminal_local_map, keymaps); | 1523 | keymaps = Fcons (current_kboard->Voverriding_terminal_local_map, keymaps); |
| 1524 | /* The doc said that overriding-terminal-local-map should | ||
| 1525 | override overriding-local-map. The code used them both, | ||
| 1526 | but it seems clearer to use just one. rms, jan 2005. */ | ||
| 1527 | else if (!NILP (Voverriding_local_map)) | ||
| 1528 | keymaps = Fcons (Voverriding_local_map, keymaps); | ||
| 1526 | } | 1529 | } |
| 1527 | if (NILP (XCDR (keymaps))) | 1530 | if (NILP (XCDR (keymaps))) |
| 1528 | { | 1531 | { |
| @@ -1530,16 +1533,20 @@ OLP if non-nil indicates that we should obey `overriding-local-map' and | |||
| 1530 | Lisp_Object *maps; | 1533 | Lisp_Object *maps; |
| 1531 | int nmaps, i; | 1534 | int nmaps, i; |
| 1532 | 1535 | ||
| 1536 | /* This usually returns the buffer's local map, | ||
| 1537 | but that can be overridden by a `local-map' property. */ | ||
| 1533 | local = get_local_map (PT, current_buffer, Qlocal_map); | 1538 | local = get_local_map (PT, current_buffer, Qlocal_map); |
| 1534 | if (!NILP (local)) | 1539 | if (!NILP (local)) |
| 1535 | keymaps = Fcons (local, keymaps); | 1540 | keymaps = Fcons (local, keymaps); |
| 1536 | 1541 | ||
| 1542 | /* Now put all the minor mode keymaps on the list. */ | ||
| 1537 | nmaps = current_minor_maps (0, &maps); | 1543 | nmaps = current_minor_maps (0, &maps); |
| 1538 | 1544 | ||
| 1539 | for (i = --nmaps; i >= 0; i--) | 1545 | for (i = --nmaps; i >= 0; i--) |
| 1540 | if (!NILP (maps[i])) | 1546 | if (!NILP (maps[i])) |
| 1541 | keymaps = Fcons (maps[i], keymaps); | 1547 | keymaps = Fcons (maps[i], keymaps); |
| 1542 | 1548 | ||
| 1549 | /* This returns nil unless there is a `keymap' property. */ | ||
| 1543 | local = get_local_map (PT, current_buffer, Qkeymap); | 1550 | local = get_local_map (PT, current_buffer, Qkeymap); |
| 1544 | if (!NILP (local)) | 1551 | if (!NILP (local)) |
| 1545 | keymaps = Fcons (local, keymaps); | 1552 | keymaps = Fcons (local, keymaps); |
diff --git a/src/macfns.c b/src/macfns.c index f40e8354f35..33da9091575 100644 --- a/src/macfns.c +++ b/src/macfns.c | |||
| @@ -55,6 +55,7 @@ static unsigned char gray_bits[] = { | |||
| 55 | #include <ctype.h> | 55 | #include <ctype.h> |
| 56 | #include <sys/types.h> | 56 | #include <sys/types.h> |
| 57 | #include <sys/stat.h> | 57 | #include <sys/stat.h> |
| 58 | #include <sys/param.h> | ||
| 58 | 59 | ||
| 59 | #include <stdlib.h> | 60 | #include <stdlib.h> |
| 60 | #include <string.h> | 61 | #include <string.h> |
| @@ -1384,6 +1385,7 @@ x_set_foreground_color (f, arg, oldval) | |||
| 1384 | struct frame *f; | 1385 | struct frame *f; |
| 1385 | Lisp_Object arg, oldval; | 1386 | Lisp_Object arg, oldval; |
| 1386 | { | 1387 | { |
| 1388 | struct mac_output *mac = f->output_data.mac; | ||
| 1387 | unsigned long fg, old_fg; | 1389 | unsigned long fg, old_fg; |
| 1388 | 1390 | ||
| 1389 | fg = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); | 1391 | fg = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
| @@ -1392,10 +1394,28 @@ x_set_foreground_color (f, arg, oldval) | |||
| 1392 | 1394 | ||
| 1393 | if (FRAME_MAC_WINDOW (f) != 0) | 1395 | if (FRAME_MAC_WINDOW (f) != 0) |
| 1394 | { | 1396 | { |
| 1397 | Display *dpy = FRAME_MAC_DISPLAY (f); | ||
| 1398 | |||
| 1399 | BLOCK_INPUT; | ||
| 1400 | XSetForeground (dpy, mac->normal_gc, fg); | ||
| 1401 | XSetBackground (dpy, mac->reverse_gc, fg); | ||
| 1402 | |||
| 1403 | if (mac->cursor_pixel == old_fg) | ||
| 1404 | { | ||
| 1405 | unload_color (f, mac->cursor_pixel); | ||
| 1406 | mac->cursor_pixel = fg; | ||
| 1407 | XSetBackground (dpy, mac->cursor_gc, mac->cursor_pixel); | ||
| 1408 | } | ||
| 1409 | |||
| 1410 | UNBLOCK_INPUT; | ||
| 1411 | |||
| 1395 | update_face_from_frame_parameter (f, Qforeground_color, arg); | 1412 | update_face_from_frame_parameter (f, Qforeground_color, arg); |
| 1413 | |||
| 1396 | if (FRAME_VISIBLE_P (f)) | 1414 | if (FRAME_VISIBLE_P (f)) |
| 1397 | redraw_frame (f); | 1415 | redraw_frame (f); |
| 1398 | } | 1416 | } |
| 1417 | |||
| 1418 | unload_color (f, old_fg); | ||
| 1399 | } | 1419 | } |
| 1400 | 1420 | ||
| 1401 | void | 1421 | void |
| @@ -1403,11 +1423,24 @@ x_set_background_color (f, arg, oldval) | |||
| 1403 | struct frame *f; | 1423 | struct frame *f; |
| 1404 | Lisp_Object arg, oldval; | 1424 | Lisp_Object arg, oldval; |
| 1405 | { | 1425 | { |
| 1406 | FRAME_BACKGROUND_PIXEL (f) | 1426 | struct mac_output *mac = f->output_data.mac; |
| 1407 | = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f)); | 1427 | unsigned long bg; |
| 1428 | |||
| 1429 | bg = x_decode_color (f, arg, WHITE_PIX_DEFAULT (f)); | ||
| 1430 | unload_color (f, FRAME_BACKGROUND_PIXEL (f)); | ||
| 1431 | FRAME_BACKGROUND_PIXEL (f) = bg; | ||
| 1408 | 1432 | ||
| 1409 | if (FRAME_MAC_WINDOW (f) != 0) | 1433 | if (FRAME_MAC_WINDOW (f) != 0) |
| 1410 | { | 1434 | { |
| 1435 | Display *dpy = FRAME_MAC_DISPLAY (f); | ||
| 1436 | |||
| 1437 | BLOCK_INPUT; | ||
| 1438 | XSetBackground (dpy, mac->normal_gc, bg); | ||
| 1439 | XSetForeground (dpy, mac->reverse_gc, bg); | ||
| 1440 | XSetWindowBackground (dpy, FRAME_MAC_WINDOW (f), bg); | ||
| 1441 | XSetForeground (dpy, mac->cursor_gc, bg); | ||
| 1442 | |||
| 1443 | UNBLOCK_INPUT; | ||
| 1411 | update_face_from_frame_parameter (f, Qbackground_color, arg); | 1444 | update_face_from_frame_parameter (f, Qbackground_color, arg); |
| 1412 | 1445 | ||
| 1413 | if (FRAME_VISIBLE_P (f)) | 1446 | if (FRAME_VISIBLE_P (f)) |
| @@ -2296,6 +2329,10 @@ mac_window (f) | |||
| 2296 | /* so that update events can find this mac_output struct */ | 2329 | /* so that update events can find this mac_output struct */ |
| 2297 | f->output_data.mac->mFP = f; /* point back to emacs frame */ | 2330 | f->output_data.mac->mFP = f; /* point back to emacs frame */ |
| 2298 | 2331 | ||
| 2332 | if (FRAME_MAC_WINDOW (f)) | ||
| 2333 | XSetWindowBackground (FRAME_MAC_DISPLAY(f), FRAME_MAC_WINDOW (f), | ||
| 2334 | FRAME_BACKGROUND_PIXEL (f)); | ||
| 2335 | |||
| 2299 | validate_x_resource_name (); | 2336 | validate_x_resource_name (); |
| 2300 | 2337 | ||
| 2301 | /* x_set_name normally ignores requests to set the name if the | 2338 | /* x_set_name normally ignores requests to set the name if the |
| @@ -3855,6 +3892,8 @@ x_create_tip_frame (dpyinfo, parms, text) | |||
| 3855 | #endif | 3892 | #endif |
| 3856 | { | 3893 | { |
| 3857 | FRAME_MAC_WINDOW (f) = tip_window; | 3894 | FRAME_MAC_WINDOW (f) = tip_window; |
| 3895 | XSetWindowBackground (FRAME_MAC_DISPLAY(f), tip_window, | ||
| 3896 | FRAME_BACKGROUND_PIXEL (f)); | ||
| 3858 | SetWRefCon (tip_window, (long) f->output_data.mac); | 3897 | SetWRefCon (tip_window, (long) f->output_data.mac); |
| 3859 | /* so that update events can find this mac_output struct */ | 3898 | /* so that update events can find this mac_output struct */ |
| 3860 | f->output_data.mac->mFP = f; | 3899 | f->output_data.mac->mFP = f; |
| @@ -4237,6 +4276,9 @@ Value is t if tooltip was open, nil otherwise. */) | |||
| 4237 | File selection dialog | 4276 | File selection dialog |
| 4238 | ***********************************************************************/ | 4277 | ***********************************************************************/ |
| 4239 | 4278 | ||
| 4279 | static pascal void mac_nav_event_callback P_ ((NavEventCallbackMessage, | ||
| 4280 | NavCBRecPtr, void *)); | ||
| 4281 | |||
| 4240 | /** | 4282 | /** |
| 4241 | There is a relatively standard way to do this using applescript to run | 4283 | There is a relatively standard way to do this using applescript to run |
| 4242 | a (choose file) method. However, this doesn't do "the right thing" | 4284 | a (choose file) method. However, this doesn't do "the right thing" |
| @@ -4261,8 +4303,9 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 4261 | Lisp_Object file = Qnil; | 4303 | Lisp_Object file = Qnil; |
| 4262 | int count = SPECPDL_INDEX (); | 4304 | int count = SPECPDL_INDEX (); |
| 4263 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; | 4305 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; |
| 4264 | char filename[1001]; | 4306 | char filename[MAXPATHLEN]; |
| 4265 | int default_filter_index = 1; /* 1: All Files, 2: Directories only */ | 4307 | int default_filter_index = 1; /* 1: All Files, 2: Directories only */ |
| 4308 | static NavEventUPP mac_nav_event_callbackUPP = NULL; | ||
| 4266 | 4309 | ||
| 4267 | GCPRO6 (prompt, dir, default_filename, mustmatch, file, only_dir_p); | 4310 | GCPRO6 (prompt, dir, default_filename, mustmatch, file, only_dir_p); |
| 4268 | CHECK_STRING (prompt); | 4311 | CHECK_STRING (prompt); |
| @@ -4290,16 +4333,20 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 4290 | options.optionFlags |= kNavSelectAllReadableItem; | 4333 | options.optionFlags |= kNavSelectAllReadableItem; |
| 4291 | if (!NILP(prompt)) | 4334 | if (!NILP(prompt)) |
| 4292 | { | 4335 | { |
| 4293 | message = cfstring_create_with_utf8_cstring (SDATA (prompt)); | 4336 | message = |
| 4337 | cfstring_create_with_utf8_cstring (SDATA (ENCODE_UTF_8 (prompt))); | ||
| 4294 | options.message = message; | 4338 | options.message = message; |
| 4295 | } | 4339 | } |
| 4296 | /* Don't set the application, let it use default. | 4340 | /* Don't set the application, let it use default. |
| 4297 | options.clientName = CFSTR ("Emacs"); | 4341 | options.clientName = CFSTR ("Emacs"); |
| 4298 | */ | 4342 | */ |
| 4299 | 4343 | ||
| 4344 | if (mac_nav_event_callbackUPP == NULL) | ||
| 4345 | mac_nav_event_callbackUPP = NewNavEventUPP (mac_nav_event_callback); | ||
| 4346 | |||
| 4300 | if (!NILP (only_dir_p)) | 4347 | if (!NILP (only_dir_p)) |
| 4301 | status = NavCreateChooseFolderDialog(&options, NULL, NULL, NULL, | 4348 | status = NavCreateChooseFolderDialog(&options, mac_nav_event_callbackUPP, |
| 4302 | &dialogRef); | 4349 | NULL, NULL, &dialogRef); |
| 4303 | else if (NILP (mustmatch)) | 4350 | else if (NILP (mustmatch)) |
| 4304 | { | 4351 | { |
| 4305 | /* This is a save dialog */ | 4352 | /* This is a save dialog */ |
| @@ -4309,21 +4356,26 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 4309 | 4356 | ||
| 4310 | if (!NILP(default_filename)) | 4357 | if (!NILP(default_filename)) |
| 4311 | { | 4358 | { |
| 4312 | saveName = | 4359 | Lisp_Object utf8 = ENCODE_UTF_8 (default_filename); |
| 4313 | cfstring_create_with_utf8_cstring (SDATA (default_filename)); | 4360 | char *begPtr = SDATA(utf8); |
| 4361 | char *filePtr = begPtr + SBYTES(utf8); | ||
| 4362 | while (filePtr != begPtr && !IS_DIRECTORY_SEP(filePtr[-1])) | ||
| 4363 | filePtr--; | ||
| 4364 | saveName = cfstring_create_with_utf8_cstring (filePtr); | ||
| 4314 | options.saveFileName = saveName; | 4365 | options.saveFileName = saveName; |
| 4315 | options.optionFlags |= kNavSelectDefaultLocation; | 4366 | options.optionFlags |= kNavSelectDefaultLocation; |
| 4316 | } | 4367 | } |
| 4317 | status = NavCreatePutFileDialog(&options, | 4368 | status = NavCreatePutFileDialog(&options, |
| 4318 | 'TEXT', kNavGenericSignature, | 4369 | 'TEXT', kNavGenericSignature, |
| 4319 | NULL, NULL, &dialogRef); | 4370 | mac_nav_event_callbackUPP, NULL, |
| 4371 | &dialogRef); | ||
| 4320 | } | 4372 | } |
| 4321 | else | 4373 | else |
| 4322 | { | 4374 | { |
| 4323 | /* This is an open dialog*/ | 4375 | /* This is an open dialog*/ |
| 4324 | status = NavCreateChooseFileDialog(&options, fileTypes, | 4376 | status = NavCreateChooseFileDialog(&options, fileTypes, |
| 4325 | NULL, NULL, NULL, NULL, | 4377 | mac_nav_event_callbackUPP, NULL, |
| 4326 | &dialogRef); | 4378 | NULL, NULL, &dialogRef); |
| 4327 | } | 4379 | } |
| 4328 | 4380 | ||
| 4329 | /* Set the default location and continue*/ | 4381 | /* Set the default location and continue*/ |
| @@ -4331,13 +4383,13 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 4331 | if (!NILP(dir)) { | 4383 | if (!NILP(dir)) { |
| 4332 | FSRef defLoc; | 4384 | FSRef defLoc; |
| 4333 | AEDesc defLocAed; | 4385 | AEDesc defLocAed; |
| 4334 | status = FSPathMakeRef(SDATA(dir), &defLoc, NULL); | 4386 | status = FSPathMakeRef(SDATA(ENCODE_FILE(dir)), &defLoc, NULL); |
| 4335 | if (status == noErr) | 4387 | if (status == noErr) |
| 4336 | { | 4388 | { |
| 4337 | AECreateDesc(typeFSRef, &defLoc, sizeof(FSRef), &defLocAed); | 4389 | AECreateDesc(typeFSRef, &defLoc, sizeof(FSRef), &defLocAed); |
| 4338 | NavCustomControl(dialogRef, kNavCtlSetLocation, (void*) &defLocAed); | 4390 | NavCustomControl(dialogRef, kNavCtlSetLocation, (void*) &defLocAed); |
| 4391 | AEDisposeDesc(&defLocAed); | ||
| 4339 | } | 4392 | } |
| 4340 | AEDisposeDesc(&defLocAed); | ||
| 4341 | } | 4393 | } |
| 4342 | 4394 | ||
| 4343 | status = NavDialogRun(dialogRef); | 4395 | status = NavDialogRun(dialogRef); |
| @@ -4363,7 +4415,7 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 4363 | status = NavDialogGetReply(dialogRef, &reply); | 4415 | status = NavDialogGetReply(dialogRef, &reply); |
| 4364 | AECoerceDesc(&reply.selection, typeFSRef, &aed); | 4416 | AECoerceDesc(&reply.selection, typeFSRef, &aed); |
| 4365 | AEGetDescData(&aed, (void *) &fsRef, sizeof (FSRef)); | 4417 | AEGetDescData(&aed, (void *) &fsRef, sizeof (FSRef)); |
| 4366 | FSRefMakePath(&fsRef, (UInt8 *) filename, 1000); | 4418 | FSRefMakePath(&fsRef, (UInt8 *) filename, sizeof (filename)); |
| 4367 | AEDisposeDesc(&aed); | 4419 | AEDisposeDesc(&aed); |
| 4368 | if (reply.saveFileName) | 4420 | if (reply.saveFileName) |
| 4369 | { | 4421 | { |
| @@ -4372,9 +4424,11 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 4372 | if (len && filename[len-1] != '/') | 4424 | if (len && filename[len-1] != '/') |
| 4373 | filename[len++] = '/'; | 4425 | filename[len++] = '/'; |
| 4374 | CFStringGetCString(reply.saveFileName, filename+len, | 4426 | CFStringGetCString(reply.saveFileName, filename+len, |
| 4375 | 1000-len, kCFStringEncodingUTF8); | 4427 | sizeof (filename) - len, |
| 4428 | kCFStringEncodingUTF8); | ||
| 4376 | } | 4429 | } |
| 4377 | file = DECODE_FILE(build_string (filename)); | 4430 | file = DECODE_FILE (make_unibyte_string (filename, |
| 4431 | strlen (filename))); | ||
| 4378 | NavDisposeReply(&reply); | 4432 | NavDisposeReply(&reply); |
| 4379 | } | 4433 | } |
| 4380 | break; | 4434 | break; |
| @@ -4400,6 +4454,15 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 4400 | } | 4454 | } |
| 4401 | 4455 | ||
| 4402 | 4456 | ||
| 4457 | /* Need to register some event callback function for enabling drag and | ||
| 4458 | drop in Navigation Service dialogs. */ | ||
| 4459 | static pascal void | ||
| 4460 | mac_nav_event_callback (selector, parms, data) | ||
| 4461 | NavEventCallbackMessage selector; | ||
| 4462 | NavCBRecPtr parms; | ||
| 4463 | void *data ; | ||
| 4464 | { | ||
| 4465 | } | ||
| 4403 | #endif | 4466 | #endif |
| 4404 | 4467 | ||
| 4405 | /*********************************************************************** | 4468 | /*********************************************************************** |
diff --git a/src/macterm.c b/src/macterm.c index 353a1734258..d35a210e4c6 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -69,6 +69,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 69 | #include <errno.h> | 69 | #include <errno.h> |
| 70 | #include <setjmp.h> | 70 | #include <setjmp.h> |
| 71 | #include <sys/stat.h> | 71 | #include <sys/stat.h> |
| 72 | #include <sys/param.h> | ||
| 72 | 73 | ||
| 73 | #include "keyboard.h" | 74 | #include "keyboard.h" |
| 74 | #include "frame.h" | 75 | #include "frame.h" |
| @@ -102,6 +103,10 @@ Boston, MA 02111-1307, USA. */ | |||
| 102 | 103 | ||
| 103 | Lisp_Object Vx_toolkit_scroll_bars; | 104 | Lisp_Object Vx_toolkit_scroll_bars; |
| 104 | 105 | ||
| 106 | /* If Non-nil, the text will be rendered using Core Graphics text rendering which may anti-alias the text. */ | ||
| 107 | Lisp_Object Vmac_use_core_graphics; | ||
| 108 | |||
| 109 | |||
| 105 | /* Non-zero means that a HELP_EVENT has been generated since Emacs | 110 | /* Non-zero means that a HELP_EVENT has been generated since Emacs |
| 106 | start. */ | 111 | start. */ |
| 107 | 112 | ||
| @@ -726,6 +731,13 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, | |||
| 726 | int nchars, mode, bytes_per_char; | 731 | int nchars, mode, bytes_per_char; |
| 727 | { | 732 | { |
| 728 | SetPortWindowPort (w); | 733 | SetPortWindowPort (w); |
| 734 | #ifdef MAC_OSX | ||
| 735 | UInt32 textFlags, savedFlags; | ||
| 736 | if (!NILP(Vmac_use_core_graphics)) { | ||
| 737 | textFlags = kQDUseCGTextRendering; | ||
| 738 | savedFlags = SwapQDTextFlags(textFlags); | ||
| 739 | } | ||
| 740 | #endif | ||
| 729 | 741 | ||
| 730 | mac_set_colors (gc); | 742 | mac_set_colors (gc); |
| 731 | 743 | ||
| @@ -736,6 +748,10 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, | |||
| 736 | 748 | ||
| 737 | MoveTo (x, y); | 749 | MoveTo (x, y); |
| 738 | DrawText (buf, 0, nchars * bytes_per_char); | 750 | DrawText (buf, 0, nchars * bytes_per_char); |
| 751 | #ifdef MAC_OSX | ||
| 752 | if (!NILP(Vmac_use_core_graphics)) | ||
| 753 | SwapQDTextFlags(savedFlags); | ||
| 754 | #endif | ||
| 739 | } | 755 | } |
| 740 | 756 | ||
| 741 | 757 | ||
| @@ -1092,6 +1108,62 @@ XSetForeground (display, gc, color) | |||
| 1092 | } | 1108 | } |
| 1093 | 1109 | ||
| 1094 | 1110 | ||
| 1111 | /* Mac replacement for XSetBackground. */ | ||
| 1112 | |||
| 1113 | void | ||
| 1114 | XSetBackground (display, gc, color) | ||
| 1115 | Display *display; | ||
| 1116 | GC gc; | ||
| 1117 | unsigned long color; | ||
| 1118 | { | ||
| 1119 | gc->background = color; | ||
| 1120 | } | ||
| 1121 | |||
| 1122 | |||
| 1123 | /* Mac replacement for XSetWindowBackground. */ | ||
| 1124 | |||
| 1125 | void | ||
| 1126 | XSetWindowBackground (display, w, color) | ||
| 1127 | Display *display; | ||
| 1128 | WindowPtr w; | ||
| 1129 | unsigned long color; | ||
| 1130 | { | ||
| 1131 | #if !TARGET_API_MAC_CARBON | ||
| 1132 | AuxWinHandle aw_handle; | ||
| 1133 | CTabHandle ctab_handle; | ||
| 1134 | ColorSpecPtr ct_table; | ||
| 1135 | short ct_size; | ||
| 1136 | #endif | ||
| 1137 | RGBColor bg_color; | ||
| 1138 | |||
| 1139 | bg_color.red = RED16_FROM_ULONG (color); | ||
| 1140 | bg_color.green = GREEN16_FROM_ULONG (color); | ||
| 1141 | bg_color.blue = BLUE16_FROM_ULONG (color); | ||
| 1142 | |||
| 1143 | #if TARGET_API_MAC_CARBON | ||
| 1144 | SetWindowContentColor (w, &bg_color); | ||
| 1145 | #else | ||
| 1146 | if (GetAuxWin (w, &aw_handle)) | ||
| 1147 | { | ||
| 1148 | ctab_handle = (*aw_handle)->awCTable; | ||
| 1149 | HandToHand ((Handle *) &ctab_handle); | ||
| 1150 | ct_table = (*ctab_handle)->ctTable; | ||
| 1151 | ct_size = (*ctab_handle)->ctSize; | ||
| 1152 | while (ct_size > -1) | ||
| 1153 | { | ||
| 1154 | if (ct_table->value == 0) | ||
| 1155 | { | ||
| 1156 | ct_table->rgb = bg_color; | ||
| 1157 | CTabChanged (ctab_handle); | ||
| 1158 | SetWinColor (w, (WCTabHandle) ctab_handle); | ||
| 1159 | } | ||
| 1160 | ct_size--; | ||
| 1161 | } | ||
| 1162 | } | ||
| 1163 | #endif | ||
| 1164 | } | ||
| 1165 | |||
| 1166 | |||
| 1095 | /* Mac replacement for XSetFont. */ | 1167 | /* Mac replacement for XSetFont. */ |
| 1096 | 1168 | ||
| 1097 | static void | 1169 | static void |
| @@ -4963,7 +5035,8 @@ x_new_font (f, fontname) | |||
| 4963 | FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset; | 5035 | FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset; |
| 4964 | FRAME_FONTSET (f) = -1; | 5036 | FRAME_FONTSET (f) = -1; |
| 4965 | 5037 | ||
| 4966 | FRAME_COLUMN_WIDTH (f) = FONT_WIDTH (FRAME_FONT (f)); | 5038 | FRAME_COLUMN_WIDTH (f) = fontp->average_width; |
| 5039 | FRAME_SPACE_WIDTH (f) = fontp->space_width; | ||
| 4967 | FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f)); | 5040 | FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f)); |
| 4968 | 5041 | ||
| 4969 | compute_fringe_widths (f, 1); | 5042 | compute_fringe_widths (f, 1); |
| @@ -6499,12 +6572,8 @@ x_font_min_bounds (font, w, h) | |||
| 6499 | MacFontStruct *font; | 6572 | MacFontStruct *font; |
| 6500 | int *w, *h; | 6573 | int *w, *h; |
| 6501 | { | 6574 | { |
| 6502 | /* | ||
| 6503 | * TODO: Windows does not appear to offer min bound, only | ||
| 6504 | * average and maximum width, and maximum height. | ||
| 6505 | */ | ||
| 6506 | *h = FONT_HEIGHT (font); | 6575 | *h = FONT_HEIGHT (font); |
| 6507 | *w = FONT_WIDTH (font); | 6576 | *w = font->min_bounds.width; |
| 6508 | } | 6577 | } |
| 6509 | 6578 | ||
| 6510 | 6579 | ||
| @@ -6732,17 +6801,28 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 6732 | font->per_char = (XCharStruct *) | 6801 | font->per_char = (XCharStruct *) |
| 6733 | xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1)); | 6802 | xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1)); |
| 6734 | { | 6803 | { |
| 6735 | int c; | 6804 | int c, min_width, max_width; |
| 6736 | 6805 | ||
| 6806 | min_width = max_width = char_width; | ||
| 6737 | for (c = 0x20; c <= 0xff; c++) | 6807 | for (c = 0x20; c <= 0xff; c++) |
| 6738 | { | 6808 | { |
| 6739 | font->per_char[c - 0x20] = font->max_bounds; | 6809 | font->per_char[c - 0x20] = font->max_bounds; |
| 6740 | font->per_char[c - 0x20].width = | 6810 | char_width = CharWidth (c); |
| 6741 | font->per_char[c - 0x20].rbearing = CharWidth (c); | 6811 | font->per_char[c - 0x20].width = char_width; |
| 6742 | } | 6812 | font->per_char[c - 0x20].rbearing = char_width; |
| 6813 | /* Some Japanese fonts (in SJIS encoding) return 0 as the | ||
| 6814 | character width of 0x7f. */ | ||
| 6815 | if (char_width > 0) | ||
| 6816 | { | ||
| 6817 | min_width = min (min_width, char_width); | ||
| 6818 | max_width = max (max_width, char_width); | ||
| 6819 | } | ||
| 6820 | } | ||
| 6821 | font->min_bounds.width = min_width; | ||
| 6822 | font->max_bounds.width = max_width; | ||
| 6743 | } | 6823 | } |
| 6744 | } | 6824 | } |
| 6745 | 6825 | ||
| 6746 | TextFont (old_fontnum); /* restore previous font number, size and face */ | 6826 | TextFont (old_fontnum); /* restore previous font number, size and face */ |
| 6747 | TextSize (old_fontsize); | 6827 | TextSize (old_fontsize); |
| 6748 | TextFace (old_fontface); | 6828 | TextFace (old_fontface); |
| @@ -6847,6 +6927,35 @@ x_load_font (f, fontname, size) | |||
| 6847 | fontp->name = (char *) xmalloc (strlen (font->fontname) + 1); | 6927 | fontp->name = (char *) xmalloc (strlen (font->fontname) + 1); |
| 6848 | bcopy (font->fontname, fontp->name, strlen (font->fontname) + 1); | 6928 | bcopy (font->fontname, fontp->name, strlen (font->fontname) + 1); |
| 6849 | 6929 | ||
| 6930 | if (font->min_bounds.width == font->max_bounds.width) | ||
| 6931 | { | ||
| 6932 | /* Fixed width font. */ | ||
| 6933 | fontp->average_width = fontp->space_width = font->min_bounds.width; | ||
| 6934 | } | ||
| 6935 | else | ||
| 6936 | { | ||
| 6937 | XChar2b char2b; | ||
| 6938 | XCharStruct *pcm; | ||
| 6939 | |||
| 6940 | char2b.byte1 = 0x00, char2b.byte2 = 0x20; | ||
| 6941 | pcm = mac_per_char_metric (font, &char2b, 0); | ||
| 6942 | if (pcm) | ||
| 6943 | fontp->space_width = pcm->width; | ||
| 6944 | else | ||
| 6945 | fontp->space_width = FONT_WIDTH (font); | ||
| 6946 | |||
| 6947 | if (pcm) | ||
| 6948 | { | ||
| 6949 | int width = pcm->width; | ||
| 6950 | for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++) | ||
| 6951 | if ((pcm = mac_per_char_metric (font, &char2b, 0)) != NULL) | ||
| 6952 | width += pcm->width; | ||
| 6953 | fontp->average_width = width / 95; | ||
| 6954 | } | ||
| 6955 | else | ||
| 6956 | fontp->average_width = FONT_WIDTH (font); | ||
| 6957 | } | ||
| 6958 | |||
| 6850 | fontp->full_name = fontp->name; | 6959 | fontp->full_name = fontp->name; |
| 6851 | 6960 | ||
| 6852 | fontp->size = font->max_bounds.width; | 6961 | fontp->size = font->max_bounds.width; |
| @@ -7861,6 +7970,14 @@ mac_handle_window_event (next_handler, event, data) | |||
| 7861 | 7970 | ||
| 7862 | switch (GetEventKind (event)) | 7971 | switch (GetEventKind (event)) |
| 7863 | { | 7972 | { |
| 7973 | case kEventWindowUpdate: | ||
| 7974 | result = CallNextEventHandler (next_handler, event); | ||
| 7975 | if (result != eventNotHandledErr) | ||
| 7976 | return result; | ||
| 7977 | |||
| 7978 | do_window_update (wp); | ||
| 7979 | break; | ||
| 7980 | |||
| 7864 | case kEventWindowBoundsChanging: | 7981 | case kEventWindowBoundsChanging: |
| 7865 | result = CallNextEventHandler (next_handler, event); | 7982 | result = CallNextEventHandler (next_handler, event); |
| 7866 | if (result != eventNotHandledErr) | 7983 | if (result != eventNotHandledErr) |
| @@ -7918,7 +8035,8 @@ install_window_handler (window) | |||
| 7918 | { | 8035 | { |
| 7919 | OSErr err = noErr; | 8036 | OSErr err = noErr; |
| 7920 | #if USE_CARBON_EVENTS | 8037 | #if USE_CARBON_EVENTS |
| 7921 | EventTypeSpec specs[] = {{kEventClassWindow, kEventWindowBoundsChanging}}; | 8038 | EventTypeSpec specs[] = {{kEventClassWindow, kEventWindowUpdate}, |
| 8039 | {kEventClassWindow, kEventWindowBoundsChanging}}; | ||
| 7922 | static EventHandlerUPP handle_window_event_UPP = NULL; | 8040 | static EventHandlerUPP handle_window_event_UPP = NULL; |
| 7923 | 8041 | ||
| 7924 | if (handle_window_event_UPP == NULL) | 8042 | if (handle_window_event_UPP == NULL) |
| @@ -8013,24 +8131,28 @@ do_ae_open_documents(AppleEvent *message, AppleEvent *reply, long refcon) | |||
| 8013 | int i; | 8131 | int i; |
| 8014 | 8132 | ||
| 8015 | /* AE file list is one based so just use that for indexing here. */ | 8133 | /* AE file list is one based so just use that for indexing here. */ |
| 8016 | for (i = 1; (err == noErr) && (i <= num_files_to_open); i++) | 8134 | for (i = 1; i <= num_files_to_open; i++) |
| 8017 | { | 8135 | { |
| 8018 | FSSpec fs; | ||
| 8019 | Str255 path_name, unix_path_name; | ||
| 8020 | #ifdef MAC_OSX | 8136 | #ifdef MAC_OSX |
| 8021 | FSRef fref; | 8137 | FSRef fref; |
| 8022 | #endif | 8138 | char unix_path_name[MAXPATHLEN]; |
| 8139 | |||
| 8140 | err = AEGetNthPtr (&the_desc, i, typeFSRef, &keyword, | ||
| 8141 | &actual_type, &fref, sizeof (FSRef), | ||
| 8142 | &actual_size); | ||
| 8143 | if (err != noErr || actual_type != typeFSRef) | ||
| 8144 | continue; | ||
| 8145 | |||
| 8146 | if (FSRefMakePath (&fref, unix_path_name, sizeof (unix_path_name)) | ||
| 8147 | == noErr) | ||
| 8148 | #else | ||
| 8149 | FSSpec fs; | ||
| 8150 | Str255 path_name, unix_path_name; | ||
| 8023 | 8151 | ||
| 8024 | err = AEGetNthPtr(&the_desc, i, typeFSS, &keyword, &actual_type, | 8152 | err = AEGetNthPtr(&the_desc, i, typeFSS, &keyword, &actual_type, |
| 8025 | (Ptr) &fs, sizeof (fs), &actual_size); | 8153 | (Ptr) &fs, sizeof (fs), &actual_size); |
| 8026 | if (err != noErr) break; | 8154 | if (err != noErr) continue; |
| 8027 | |||
| 8028 | #ifdef MAC_OSX | ||
| 8029 | err = FSpMakeFSRef (&fs, &fref); | ||
| 8030 | if (err != noErr) break; | ||
| 8031 | 8155 | ||
| 8032 | if (FSRefMakePath (&fref, unix_path_name, 255) == noErr) | ||
| 8033 | #else | ||
| 8034 | if (path_from_vol_dir_name (path_name, 255, fs.vRefNum, fs.parID, | 8156 | if (path_from_vol_dir_name (path_name, 255, fs.vRefNum, fs.parID, |
| 8035 | fs.name) && | 8157 | fs.name) && |
| 8036 | mac_to_posix_pathname (path_name, unix_path_name, 255)) | 8158 | mac_to_posix_pathname (path_name, unix_path_name, 255)) |
| @@ -8066,18 +8188,21 @@ mac_do_track_drag (DragTrackingMessage message, WindowPtr window, | |||
| 8066 | FlavorFlags theFlags; | 8188 | FlavorFlags theFlags; |
| 8067 | OSErr result; | 8189 | OSErr result; |
| 8068 | 8190 | ||
| 8191 | if (GetFrontWindowOfClass (kMovableModalWindowClass, false)) | ||
| 8192 | return dragNotAcceptedErr; | ||
| 8193 | |||
| 8069 | switch (message) | 8194 | switch (message) |
| 8070 | { | 8195 | { |
| 8071 | case kDragTrackingEnterHandler: | 8196 | case kDragTrackingEnterHandler: |
| 8072 | CountDragItems (theDrag, &items); | 8197 | CountDragItems (theDrag, &items); |
| 8073 | can_accept = 1; | 8198 | can_accept = 0; |
| 8074 | for (index = 1; index <= items; index++) | 8199 | for (index = 1; index <= items; index++) |
| 8075 | { | 8200 | { |
| 8076 | GetDragItemReferenceNumber (theDrag, index, &theItem); | 8201 | GetDragItemReferenceNumber (theDrag, index, &theItem); |
| 8077 | result = GetFlavorFlags (theDrag, theItem, flavorTypeHFS, &theFlags); | 8202 | result = GetFlavorFlags (theDrag, theItem, flavorTypeHFS, &theFlags); |
| 8078 | if (result != noErr) | 8203 | if (result == noErr) |
| 8079 | { | 8204 | { |
| 8080 | can_accept = 0; | 8205 | can_accept = 1; |
| 8081 | break; | 8206 | break; |
| 8082 | } | 8207 | } |
| 8083 | } | 8208 | } |
| @@ -8088,7 +8213,9 @@ mac_do_track_drag (DragTrackingMessage message, WindowPtr window, | |||
| 8088 | { | 8213 | { |
| 8089 | RgnHandle hilite_rgn = NewRgn (); | 8214 | RgnHandle hilite_rgn = NewRgn (); |
| 8090 | Rect r; | 8215 | Rect r; |
| 8216 | struct frame *f = mac_window_to_frame (window); | ||
| 8091 | 8217 | ||
| 8218 | mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f)); | ||
| 8092 | GetWindowPortBounds (window, &r); | 8219 | GetWindowPortBounds (window, &r); |
| 8093 | OffsetRect (&r, -r.left, -r.top); | 8220 | OffsetRect (&r, -r.left, -r.top); |
| 8094 | RectRgn (hilite_rgn, &r); | 8221 | RectRgn (hilite_rgn, &r); |
| @@ -8104,6 +8231,9 @@ mac_do_track_drag (DragTrackingMessage message, WindowPtr window, | |||
| 8104 | case kDragTrackingLeaveWindow: | 8231 | case kDragTrackingLeaveWindow: |
| 8105 | if (can_accept) | 8232 | if (can_accept) |
| 8106 | { | 8233 | { |
| 8234 | struct frame *f = mac_window_to_frame (window); | ||
| 8235 | |||
| 8236 | mac_set_backcolor (FRAME_BACKGROUND_PIXEL (f)); | ||
| 8107 | HideDragHilite (theDrag); | 8237 | HideDragHilite (theDrag); |
| 8108 | SetThemeCursor (kThemeArrowCursor); | 8238 | SetThemeCursor (kThemeArrowCursor); |
| 8109 | } | 8239 | } |
| @@ -8127,9 +8257,11 @@ mac_do_receive_drag (WindowPtr window, void *handlerRefCon, | |||
| 8127 | OSErr result; | 8257 | OSErr result; |
| 8128 | ItemReference theItem; | 8258 | ItemReference theItem; |
| 8129 | HFSFlavor data; | 8259 | HFSFlavor data; |
| 8130 | FSRef fref; | ||
| 8131 | Size size = sizeof (HFSFlavor); | 8260 | Size size = sizeof (HFSFlavor); |
| 8132 | 8261 | ||
| 8262 | if (GetFrontWindowOfClass (kMovableModalWindowClass, false)) | ||
| 8263 | return dragNotAcceptedErr; | ||
| 8264 | |||
| 8133 | drag_and_drop_file_list = Qnil; | 8265 | drag_and_drop_file_list = Qnil; |
| 8134 | GetDragMouse (theDrag, &mouse, 0L); | 8266 | GetDragMouse (theDrag, &mouse, 0L); |
| 8135 | CountDragItems (theDrag, &items); | 8267 | CountDragItems (theDrag, &items); |
| @@ -8141,11 +8273,11 @@ mac_do_receive_drag (WindowPtr window, void *handlerRefCon, | |||
| 8141 | if (result == noErr) | 8273 | if (result == noErr) |
| 8142 | { | 8274 | { |
| 8143 | #ifdef MAC_OSX | 8275 | #ifdef MAC_OSX |
| 8144 | FSRef frref; | 8276 | FSRef fref; |
| 8277 | char unix_path_name[MAXPATHLEN]; | ||
| 8145 | #else | 8278 | #else |
| 8146 | Str255 path_name; | 8279 | Str255 path_name, unix_path_name; |
| 8147 | #endif | 8280 | #endif |
| 8148 | Str255 unix_path_name; | ||
| 8149 | GetFlavorData (theDrag, theItem, flavorTypeHFS, &data, &size, 0L); | 8281 | GetFlavorData (theDrag, theItem, flavorTypeHFS, &data, &size, 0L); |
| 8150 | #ifdef MAC_OSX | 8282 | #ifdef MAC_OSX |
| 8151 | /* Use Carbon routines, otherwise it converts the file name | 8283 | /* Use Carbon routines, otherwise it converts the file name |
| @@ -8163,8 +8295,6 @@ mac_do_receive_drag (WindowPtr window, void *handlerRefCon, | |||
| 8163 | strlen (unix_path_name)), | 8295 | strlen (unix_path_name)), |
| 8164 | drag_and_drop_file_list); | 8296 | drag_and_drop_file_list); |
| 8165 | } | 8297 | } |
| 8166 | else | ||
| 8167 | continue; | ||
| 8168 | } | 8298 | } |
| 8169 | /* If there are items in the list, construct an event and post it to | 8299 | /* If there are items in the list, construct an event and post it to |
| 8170 | the queue like an interrupt using kbd_buffer_store_event. */ | 8300 | the queue like an interrupt using kbd_buffer_store_event. */ |
| @@ -8724,8 +8854,9 @@ XTread_socket (sd, expected, hold_quit) | |||
| 8724 | if (SendEventToEventTarget (eventRef, toolbox_dispatcher) | 8854 | if (SendEventToEventTarget (eventRef, toolbox_dispatcher) |
| 8725 | != eventNotHandledErr) | 8855 | != eventNotHandledErr) |
| 8726 | break; | 8856 | break; |
| 8727 | #endif | 8857 | #else |
| 8728 | do_window_update ((WindowPtr) er.message); | 8858 | do_window_update ((WindowPtr) er.message); |
| 8859 | #endif | ||
| 8729 | break; | 8860 | break; |
| 8730 | 8861 | ||
| 8731 | case osEvt: | 8862 | case osEvt: |
| @@ -9811,8 +9942,17 @@ Toolbox for processing before Emacs sees it. */); | |||
| 9811 | doc: /* If non-nil, the Mac \"Control\" key is passed on to the Mac | 9942 | doc: /* If non-nil, the Mac \"Control\" key is passed on to the Mac |
| 9812 | Toolbox for processing before Emacs sees it. */); | 9943 | Toolbox for processing before Emacs sees it. */); |
| 9813 | Vmac_pass_control_to_system = Qt; | 9944 | Vmac_pass_control_to_system = Qt; |
| 9945 | |||
| 9946 | DEFVAR_LISP ("mac-pass-control-to-system", &Vmac_pass_control_to_system, | ||
| 9947 | doc: /* If non-nil, the Mac \"Control\" key is passed on to the Mac | ||
| 9948 | Toolbox for processing before Emacs sees it. */); | ||
| 9949 | Vmac_pass_control_to_system = Qt; | ||
| 9814 | #endif | 9950 | #endif |
| 9815 | 9951 | ||
| 9952 | DEFVAR_LISP ("mac-allow-anti-aliasing", &Vmac_use_core_graphics, | ||
| 9953 | doc: /* If non-nil, the text will be rendered using Core Graphics text rendering which may anti-alias the text. */); | ||
| 9954 | Vmac_use_core_graphics = Qnil; | ||
| 9955 | |||
| 9816 | DEFVAR_INT ("mac-keyboard-text-encoding", &mac_keyboard_text_encoding, | 9956 | DEFVAR_INT ("mac-keyboard-text-encoding", &mac_keyboard_text_encoding, |
| 9817 | doc: /* One of the Text Encoding Base constant values defined in the | 9957 | doc: /* One of the Text Encoding Base constant values defined in the |
| 9818 | Basic Text Constants section of Inside Macintosh - Text Encoding | 9958 | Basic Text Constants section of Inside Macintosh - Text Encoding |
diff --git a/src/macterm.h b/src/macterm.h index fd6b066af4c..f32b13000e6 100644 --- a/src/macterm.h +++ b/src/macterm.h | |||
| @@ -602,6 +602,8 @@ extern Pixmap XCreatePixmapFromBitmapData P_ ((Display *, WindowPtr, char *, | |||
| 602 | unsigned int)); | 602 | unsigned int)); |
| 603 | extern void XFreePixmap P_ ((Display *, Pixmap)); | 603 | extern void XFreePixmap P_ ((Display *, Pixmap)); |
| 604 | extern void XSetForeground P_ ((Display *, GC, unsigned long)); | 604 | extern void XSetForeground P_ ((Display *, GC, unsigned long)); |
| 605 | extern void XSetBackground P_ ((Display *, GC, unsigned long)); | ||
| 606 | extern void XSetWindowBackground P_ ((Display *, WindowPtr, unsigned long)); | ||
| 605 | extern void mac_draw_line_to_pixmap P_ ((Display *, Pixmap, GC, int, int, | 607 | extern void mac_draw_line_to_pixmap P_ ((Display *, Pixmap, GC, int, int, |
| 606 | int, int)); | 608 | int, int)); |
| 607 | extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *)); | 609 | extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *)); |
diff --git a/src/term.c b/src/term.c index 6beac594ddf..d53ba74c781 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Terminal control module for terminals described by TERMCAP | 1 | /* Terminal control module for terminals described by TERMCAP |
| 2 | Copyright (C) 1985, 86, 87, 93, 94, 95, 98, 2000, 2001, 2002 | 2 | Copyright (C) 1985, 86, 87, 93, 94, 95, 98, 2000, 2001, 2002, 2005 |
| 3 | Free Software Foundation, Inc. | 3 | Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| @@ -894,7 +894,7 @@ encode_terminal_code (src, src_len, coding) | |||
| 894 | if (! STRING_MULTIBYTE (string)) | 894 | if (! STRING_MULTIBYTE (string)) |
| 895 | string = string_to_multibyte (string); | 895 | string = string_to_multibyte (string); |
| 896 | nbytes = buf - encode_terminal_src; | 896 | nbytes = buf - encode_terminal_src; |
| 897 | if (nbytes + SBYTES (string) < encode_terminal_src_size) | 897 | if (encode_terminal_src_size < nbytes + SBYTES (string)) |
| 898 | { | 898 | { |
| 899 | encode_terminal_src_size = nbytes + SBYTES (string); | 899 | encode_terminal_src_size = nbytes + SBYTES (string); |
| 900 | encode_terminal_src = xrealloc (encode_terminal_src, | 900 | encode_terminal_src = xrealloc (encode_terminal_src, |
diff --git a/src/w32bdf.c b/src/w32bdf.c index a028d51d85a..5f073dc8478 100644 --- a/src/w32bdf.c +++ b/src/w32bdf.c | |||
| @@ -774,7 +774,10 @@ struct font_info *w32_load_bdf_font (struct frame *f, char *fontname, | |||
| 774 | fontp->name = (char *) xmalloc (strlen (fontname) + 1); | 774 | fontp->name = (char *) xmalloc (strlen (fontname) + 1); |
| 775 | bcopy (fontname, fontp->name, strlen (fontname) + 1); | 775 | bcopy (fontname, fontp->name, strlen (fontname) + 1); |
| 776 | fontp->full_name = fontp->name; | 776 | fontp->full_name = fontp->name; |
| 777 | fontp->size = FONT_WIDTH (font); | 777 | /* FIXME: look at BDF spec to see if there are better ways of finding |
| 778 | average_width and space_width, hopefully that don't involve working out | ||
| 779 | the values for ourselves from the data. */ | ||
| 780 | fontp->size = fontp->average_width = fontp->space_width = FONT_WIDTH (font); | ||
| 778 | fontp->height = FONT_HEIGHT (font); | 781 | fontp->height = FONT_HEIGHT (font); |
| 779 | 782 | ||
| 780 | /* The slot `encoding' specifies how to map a character | 783 | /* The slot `encoding' specifies how to map a character |
diff --git a/src/w32fns.c b/src/w32fns.c index df6228b09b1..e05c45c2a4e 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -65,6 +65,7 @@ extern double atof (); | |||
| 65 | extern int w32_console_toggle_lock_key P_ ((int, Lisp_Object)); | 65 | extern int w32_console_toggle_lock_key P_ ((int, Lisp_Object)); |
| 66 | extern void w32_menu_display_help P_ ((HWND, HMENU, UINT, UINT)); | 66 | extern void w32_menu_display_help P_ ((HWND, HMENU, UINT, UINT)); |
| 67 | extern void w32_free_menu_strings P_ ((HWND)); | 67 | extern void w32_free_menu_strings P_ ((HWND)); |
| 68 | extern XCharStruct *w32_per_char_metric P_ ((XFontStruct *, wchar_t *, int)); | ||
| 68 | 69 | ||
| 69 | extern int quit_char; | 70 | extern int quit_char; |
| 70 | 71 | ||
| @@ -4545,7 +4546,7 @@ w32_load_system_font (f,fontname,size) | |||
| 4545 | /* Fill out details in lf according to the font that was | 4546 | /* Fill out details in lf according to the font that was |
| 4546 | actually loaded. */ | 4547 | actually loaded. */ |
| 4547 | lf.lfHeight = font->tm.tmInternalLeading - font->tm.tmHeight; | 4548 | lf.lfHeight = font->tm.tmInternalLeading - font->tm.tmHeight; |
| 4548 | lf.lfWidth = font->tm.tmAveCharWidth; | 4549 | lf.lfWidth = font->tm.tmMaxCharWidth; |
| 4549 | lf.lfWeight = font->tm.tmWeight; | 4550 | lf.lfWeight = font->tm.tmWeight; |
| 4550 | lf.lfItalic = font->tm.tmItalic; | 4551 | lf.lfItalic = font->tm.tmItalic; |
| 4551 | lf.lfCharSet = font->tm.tmCharSet; | 4552 | lf.lfCharSet = font->tm.tmCharSet; |
| @@ -4593,6 +4594,25 @@ w32_load_system_font (f,fontname,size) | |||
| 4593 | fontp->name = (char *) xmalloc (strlen (fontname) + 1); | 4594 | fontp->name = (char *) xmalloc (strlen (fontname) + 1); |
| 4594 | bcopy (fontname, fontp->name, strlen (fontname) + 1); | 4595 | bcopy (fontname, fontp->name, strlen (fontname) + 1); |
| 4595 | 4596 | ||
| 4597 | if (lf.lfPitchAndFamily == FIXED_PITCH) | ||
| 4598 | { | ||
| 4599 | /* Fixed width font. */ | ||
| 4600 | fontp->average_width = fontp->space_width = FONT_WIDTH (font); | ||
| 4601 | } | ||
| 4602 | else | ||
| 4603 | { | ||
| 4604 | wchar_t space = 32; | ||
| 4605 | XCharStruct* pcm; | ||
| 4606 | pcm = w32_per_char_metric (font, &space, ANSI_FONT); | ||
| 4607 | if (pcm) | ||
| 4608 | fontp->space_width = pcm->width; | ||
| 4609 | else | ||
| 4610 | fontp->space_width = FONT_WIDTH (font); | ||
| 4611 | |||
| 4612 | fontp->average_width = font->tm.tmAveCharWidth; | ||
| 4613 | } | ||
| 4614 | |||
| 4615 | |||
| 4596 | fontp->charset = -1; | 4616 | fontp->charset = -1; |
| 4597 | charset = xlfd_charset_of_font (fontname); | 4617 | charset = xlfd_charset_of_font (fontname); |
| 4598 | 4618 | ||
diff --git a/src/w32term.c b/src/w32term.c index 7208a8acf7e..9ed4eb3b64e 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Implementation of GUI terminal on the Microsoft W32 API. | 1 | /* Implementation of GUI terminal on the Microsoft W32 API. |
| 2 | Copyright (C) 1989, 93, 94, 95, 96, 1997, 1998, 1999, 2000, 2001 | 2 | Copyright (C) 1989, 93, 94, 95, 96, 1997, 1998, 1999, 2000, 2001, 2005 |
| 3 | Free Software Foundation, Inc. | 3 | Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| @@ -846,8 +846,7 @@ w32_reset_terminal_modes (void) | |||
| 846 | 846 | ||
| 847 | /* Function prototypes of this page. */ | 847 | /* Function prototypes of this page. */ |
| 848 | 848 | ||
| 849 | static XCharStruct *w32_per_char_metric P_ ((XFontStruct *, | 849 | XCharStruct *w32_per_char_metric P_ ((XFontStruct *, wchar_t *, int)); |
| 850 | wchar_t *, int)); | ||
| 851 | static int w32_encode_char P_ ((int, wchar_t *, struct font_info *, | 850 | static int w32_encode_char P_ ((int, wchar_t *, struct font_info *, |
| 852 | struct charset *, int *)); | 851 | struct charset *, int *)); |
| 853 | 852 | ||
| @@ -985,7 +984,7 @@ w32_native_per_char_metric (font, char2b, font_type, pcm) | |||
| 985 | } | 984 | } |
| 986 | 985 | ||
| 987 | 986 | ||
| 988 | static XCharStruct * | 987 | XCharStruct * |
| 989 | w32_per_char_metric (font, char2b, font_type) | 988 | w32_per_char_metric (font, char2b, font_type) |
| 990 | XFontStruct *font; | 989 | XFontStruct *font; |
| 991 | wchar_t *char2b; | 990 | wchar_t *char2b; |
| @@ -5446,7 +5445,8 @@ x_new_font (f, fontname) | |||
| 5446 | FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset; | 5445 | FRAME_BASELINE_OFFSET (f) = fontp->baseline_offset; |
| 5447 | FRAME_FONTSET (f) = -1; | 5446 | FRAME_FONTSET (f) = -1; |
| 5448 | 5447 | ||
| 5449 | FRAME_COLUMN_WIDTH (f) = FONT_WIDTH (FRAME_FONT (f)); | 5448 | FRAME_COLUMN_WIDTH (f) = fontp->average_width; |
| 5449 | FRAME_SPACE_WIDTH (f) = fontp->space_width; | ||
| 5450 | FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f)); | 5450 | FRAME_LINE_HEIGHT (f) = FONT_HEIGHT (FRAME_FONT (f)); |
| 5451 | 5451 | ||
| 5452 | compute_fringe_widths (f, 1); | 5452 | compute_fringe_widths (f, 1); |
diff --git a/src/window.c b/src/window.c index e0a8427668b..27aa8102290 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -4688,7 +4688,8 @@ window_scroll_pixel_based (window, n, whole, noerror) | |||
| 4688 | ; | 4688 | ; |
| 4689 | else if (preserve_y >= 0) | 4689 | else if (preserve_y >= 0) |
| 4690 | { | 4690 | { |
| 4691 | /* If we have a header line, take account of it. */ | 4691 | /* If we have a header line, take account of it. |
| 4692 | This is necessary because we set it.current_y to 0, above. */ | ||
| 4692 | if (WINDOW_WANTS_HEADER_LINE_P (w)) | 4693 | if (WINDOW_WANTS_HEADER_LINE_P (w)) |
| 4693 | preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w); | 4694 | preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w); |
| 4694 | 4695 | ||
| @@ -4728,9 +4729,14 @@ window_scroll_pixel_based (window, n, whole, noerror) | |||
| 4728 | { | 4729 | { |
| 4729 | SET_TEXT_POS_FROM_MARKER (start, w->start); | 4730 | SET_TEXT_POS_FROM_MARKER (start, w->start); |
| 4730 | start_display (&it, w, start); | 4731 | start_display (&it, w, start); |
| 4732 | #if 0 /* It's wrong to subtract this here | ||
| 4733 | because we called start_display again | ||
| 4734 | and did not alter it.current_y this time. */ | ||
| 4735 | |||
| 4731 | /* If we have a header line, take account of it. */ | 4736 | /* If we have a header line, take account of it. */ |
| 4732 | if (WINDOW_WANTS_HEADER_LINE_P (w)) | 4737 | if (WINDOW_WANTS_HEADER_LINE_P (w)) |
| 4733 | preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w); | 4738 | preserve_y -= CURRENT_HEADER_LINE_HEIGHT (w); |
| 4739 | #endif | ||
| 4734 | 4740 | ||
| 4735 | move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y); | 4741 | move_it_to (&it, -1, -1, preserve_y, -1, MOVE_TO_Y); |
| 4736 | SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); | 4742 | SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); |
diff --git a/src/xdisp.c b/src/xdisp.c index 1ccdf147485..a8b8315e251 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Display generation from window structure and buffer text. | 1 | /* Display generation from window structure and buffer text. |
| 2 | Copyright (C) 1985,86,87,88,93,94,95,97,98,99,2000,01,02,03,04 | 2 | Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1997, 1998, 1999, |
| 3 | Free Software Foundation, Inc. | 3 | 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -319,6 +319,10 @@ extern Lisp_Object Qcursor; | |||
| 319 | 319 | ||
| 320 | Lisp_Object Vshow_trailing_whitespace; | 320 | Lisp_Object Vshow_trailing_whitespace; |
| 321 | 321 | ||
| 322 | /* Non-nil means escape non-break space and hyphens. */ | ||
| 323 | |||
| 324 | Lisp_Object Vshow_nonbreak_escape; | ||
| 325 | |||
| 322 | #ifdef HAVE_WINDOW_SYSTEM | 326 | #ifdef HAVE_WINDOW_SYSTEM |
| 323 | extern Lisp_Object Voverflow_newline_into_fringe; | 327 | extern Lisp_Object Voverflow_newline_into_fringe; |
| 324 | 328 | ||
| @@ -346,7 +350,6 @@ Lisp_Object Qtrailing_whitespace; | |||
| 346 | /* Name and number of the face used to highlight escape glyphs. */ | 350 | /* Name and number of the face used to highlight escape glyphs. */ |
| 347 | 351 | ||
| 348 | Lisp_Object Qescape_glyph; | 352 | Lisp_Object Qescape_glyph; |
| 349 | int escape_glyph_face; | ||
| 350 | 353 | ||
| 351 | /* The symbol `image' which is the car of the lists used to represent | 354 | /* The symbol `image' which is the car of the lists used to represent |
| 352 | images in Lisp. */ | 355 | images in Lisp. */ |
| @@ -3268,6 +3271,7 @@ setup_for_ellipsis (it, len) | |||
| 3268 | 3271 | ||
| 3269 | it->dpvec_char_len = len; | 3272 | it->dpvec_char_len = len; |
| 3270 | it->current.dpvec_index = 0; | 3273 | it->current.dpvec_index = 0; |
| 3274 | it->dpvec_face_id = -1; | ||
| 3271 | 3275 | ||
| 3272 | /* Remember the current face id in case glyphs specify faces. | 3276 | /* Remember the current face id in case glyphs specify faces. |
| 3273 | IT's face is restored in set_iterator_to_next. */ | 3277 | IT's face is restored in set_iterator_to_next. */ |
| @@ -5007,6 +5011,7 @@ get_next_display_element (it) | |||
| 5007 | it->dpvec = v->contents; | 5011 | it->dpvec = v->contents; |
| 5008 | it->dpend = v->contents + v->size; | 5012 | it->dpend = v->contents + v->size; |
| 5009 | it->current.dpvec_index = 0; | 5013 | it->current.dpvec_index = 0; |
| 5014 | it->dpvec_face_id = -1; | ||
| 5010 | it->saved_face_id = it->face_id; | 5015 | it->saved_face_id = it->face_id; |
| 5011 | it->method = next_element_from_display_vector; | 5016 | it->method = next_element_from_display_vector; |
| 5012 | it->ellipsis_p = 0; | 5017 | it->ellipsis_p = 0; |
| @@ -5038,8 +5043,9 @@ get_next_display_element (it) | |||
| 5038 | || (it->c != '\n' && it->c != '\t')) | 5043 | || (it->c != '\n' && it->c != '\t')) |
| 5039 | : (it->multibyte_p | 5044 | : (it->multibyte_p |
| 5040 | ? (!CHAR_PRINTABLE_P (it->c) | 5045 | ? (!CHAR_PRINTABLE_P (it->c) |
| 5041 | || it->c == 0xA0 /* NO-BREAK SPACE */ | 5046 | || (!NILP (Vshow_nonbreak_escape) |
| 5042 | || it->c == 0xAD /* SOFT HYPHEN */) | 5047 | && (it->c == 0xA0 /* NO-BREAK SPACE */ |
| 5048 | || it->c == 0xAD /* SOFT HYPHEN */))) | ||
| 5043 | : (it->c >= 127 | 5049 | : (it->c >= 127 |
| 5044 | && (! unibyte_display_via_language_environment | 5050 | && (! unibyte_display_via_language_environment |
| 5045 | || (UNIBYTE_CHAR_HAS_MULTIBYTE_P (it->c))))))) | 5051 | || (UNIBYTE_CHAR_HAS_MULTIBYTE_P (it->c))))))) |
| @@ -5051,21 +5057,8 @@ get_next_display_element (it) | |||
| 5051 | display. Then, set IT->dpvec to these glyphs. */ | 5057 | display. Then, set IT->dpvec to these glyphs. */ |
| 5052 | GLYPH g; | 5058 | GLYPH g; |
| 5053 | int ctl_len; | 5059 | int ctl_len; |
| 5054 | int face_id = escape_glyph_face; | 5060 | int face_id, lface_id; |
| 5055 | 5061 | GLYPH escape_glyph; | |
| 5056 | /* Find the face id if `escape-glyph' unless we recently did. */ | ||
| 5057 | if (face_id < 0) | ||
| 5058 | { | ||
| 5059 | Lisp_Object tem = Fget (Qescape_glyph, Qface); | ||
| 5060 | if (INTEGERP (tem)) | ||
| 5061 | face_id = XINT (tem); | ||
| 5062 | else | ||
| 5063 | face_id = 0; | ||
| 5064 | /* If there's overflow, use 0 instead. */ | ||
| 5065 | if (FAST_GLYPH_FACE (FAST_MAKE_GLYPH (0, face_id)) != face_id) | ||
| 5066 | face_id = 0; | ||
| 5067 | escape_glyph_face = face_id; | ||
| 5068 | } | ||
| 5069 | 5062 | ||
| 5070 | if (it->c < 128 && it->ctl_arrow_p) | 5063 | if (it->c < 128 && it->ctl_arrow_p) |
| 5071 | { | 5064 | { |
| @@ -5073,62 +5066,83 @@ get_next_display_element (it) | |||
| 5073 | if (it->dp | 5066 | if (it->dp |
| 5074 | && INTEGERP (DISP_CTRL_GLYPH (it->dp)) | 5067 | && INTEGERP (DISP_CTRL_GLYPH (it->dp)) |
| 5075 | && GLYPH_CHAR_VALID_P (XINT (DISP_CTRL_GLYPH (it->dp)))) | 5068 | && GLYPH_CHAR_VALID_P (XINT (DISP_CTRL_GLYPH (it->dp)))) |
| 5076 | g = XINT (DISP_CTRL_GLYPH (it->dp)); | 5069 | { |
| 5070 | g = XINT (DISP_CTRL_GLYPH (it->dp)); | ||
| 5071 | lface_id = FAST_GLYPH_FACE (g); | ||
| 5072 | if (lface_id) | ||
| 5073 | { | ||
| 5074 | g = FAST_GLYPH_CHAR (g); | ||
| 5075 | face_id = merge_faces (it->f, Qt, lface_id, | ||
| 5076 | it->face_id); | ||
| 5077 | } | ||
| 5078 | } | ||
| 5077 | else | 5079 | else |
| 5078 | g = FAST_MAKE_GLYPH ('^', face_id); | 5080 | { |
| 5079 | XSETINT (it->ctl_chars[0], g); | 5081 | /* Merge the escape-glyph face into the current face. */ |
| 5082 | face_id = merge_faces (it->f, Qescape_glyph, 0, | ||
| 5083 | it->face_id); | ||
| 5084 | g = '^'; | ||
| 5085 | } | ||
| 5080 | 5086 | ||
| 5081 | g = FAST_MAKE_GLYPH (it->c ^ 0100, face_id); | 5087 | XSETINT (it->ctl_chars[0], g); |
| 5088 | g = it->c ^ 0100; | ||
| 5082 | XSETINT (it->ctl_chars[1], g); | 5089 | XSETINT (it->ctl_chars[1], g); |
| 5083 | ctl_len = 2; | 5090 | ctl_len = 2; |
| 5091 | goto display_control; | ||
| 5084 | } | 5092 | } |
| 5085 | else if (it->c == 0xA0 || it->c == 0xAD) | 5093 | |
| 5094 | if (it->dp | ||
| 5095 | && INTEGERP (DISP_ESCAPE_GLYPH (it->dp)) | ||
| 5096 | && GLYPH_CHAR_VALID_P (XFASTINT (DISP_ESCAPE_GLYPH (it->dp)))) | ||
| 5086 | { | 5097 | { |
| 5087 | /* Set IT->ctl_chars[0] to the glyph for `\\'. */ | 5098 | escape_glyph = XFASTINT (DISP_ESCAPE_GLYPH (it->dp)); |
| 5088 | if (it->dp | 5099 | lface_id = FAST_GLYPH_FACE (escape_glyph); |
| 5089 | && INTEGERP (DISP_ESCAPE_GLYPH (it->dp)) | 5100 | if (lface_id) |
| 5090 | && GLYPH_CHAR_VALID_P (XINT (DISP_ESCAPE_GLYPH (it->dp)))) | 5101 | { |
| 5091 | g = XINT (DISP_ESCAPE_GLYPH (it->dp)); | 5102 | escape_glyph = FAST_GLYPH_CHAR (escape_glyph); |
| 5092 | else | 5103 | face_id = merge_faces (it->f, Qt, lface_id, |
| 5093 | g = FAST_MAKE_GLYPH ('\\', face_id); | 5104 | it->face_id); |
| 5094 | XSETINT (it->ctl_chars[0], g); | 5105 | } |
| 5106 | } | ||
| 5107 | else | ||
| 5108 | { | ||
| 5109 | /* Merge the escape-glyph face into the current face. */ | ||
| 5110 | face_id = merge_faces (it->f, Qescape_glyph, 0, | ||
| 5111 | it->face_id); | ||
| 5112 | escape_glyph = '\\'; | ||
| 5113 | } | ||
| 5095 | 5114 | ||
| 5096 | g = FAST_MAKE_GLYPH (it->c == 0xAD ? '-' : ' ', face_id); | 5115 | if (it->c == 0xA0 || it->c == 0xAD) |
| 5116 | { | ||
| 5117 | XSETINT (it->ctl_chars[0], escape_glyph); | ||
| 5118 | g = it->c == 0xAD ? '-' : ' '; | ||
| 5097 | XSETINT (it->ctl_chars[1], g); | 5119 | XSETINT (it->ctl_chars[1], g); |
| 5098 | ctl_len = 2; | 5120 | ctl_len = 2; |
| 5121 | goto display_control; | ||
| 5099 | } | 5122 | } |
| 5100 | else | ||
| 5101 | { | ||
| 5102 | unsigned char str[MAX_MULTIBYTE_LENGTH]; | ||
| 5103 | int len; | ||
| 5104 | int i; | ||
| 5105 | GLYPH escape_glyph; | ||
| 5106 | 5123 | ||
| 5107 | /* Set IT->ctl_chars[0] to the glyph for `\\'. */ | 5124 | { |
| 5108 | if (it->dp | 5125 | unsigned char str[MAX_MULTIBYTE_LENGTH]; |
| 5109 | && INTEGERP (DISP_ESCAPE_GLYPH (it->dp)) | 5126 | int len; |
| 5110 | && GLYPH_CHAR_VALID_P (XFASTINT (DISP_ESCAPE_GLYPH (it->dp)))) | 5127 | int i; |
| 5111 | escape_glyph = XFASTINT (DISP_ESCAPE_GLYPH (it->dp)); | ||
| 5112 | else | ||
| 5113 | escape_glyph = FAST_MAKE_GLYPH ('\\', face_id); | ||
| 5114 | 5128 | ||
| 5115 | if (CHAR_BYTE8_P (it->c)) | 5129 | /* Set IT->ctl_chars[0] to the glyph for `\\'. */ |
| 5116 | { | 5130 | if (CHAR_BYTE8_P (it->c)) |
| 5117 | str[0] = CHAR_TO_BYTE8 (it->c); | 5131 | { |
| 5118 | len = 1; | 5132 | str[0] = CHAR_TO_BYTE8 (it->c); |
| 5119 | } | 5133 | len = 1; |
| 5120 | else if (it->c < 256) | 5134 | } |
| 5121 | { | 5135 | else if (it->c < 256) |
| 5122 | str[0] = it->c; | 5136 | { |
| 5123 | len = 1; | 5137 | str[0] = it->c; |
| 5124 | } | 5138 | len = 1; |
| 5125 | else | 5139 | } |
| 5126 | { | 5140 | else |
| 5127 | /* It's an invalid character, which | 5141 | { |
| 5128 | shouldn't happen actually, but due to | 5142 | /* It's an invalid character, which shouldn't |
| 5129 | bugs it may happen. Let's print the char | 5143 | happen actually, but due to bugs it may |
| 5130 | as is, there's not much meaningful we can | 5144 | happen. Let's print the char as is, there's |
| 5131 | do with it. */ | 5145 | not much meaningful we can do with it. */ |
| 5132 | str[0] = it->c; | 5146 | str[0] = it->c; |
| 5133 | str[1] = it->c >> 8; | 5147 | str[1] = it->c >> 8; |
| 5134 | str[2] = it->c >> 16; | 5148 | str[2] = it->c >> 16; |
| @@ -5136,29 +5150,28 @@ get_next_display_element (it) | |||
| 5136 | len = 4; | 5150 | len = 4; |
| 5137 | } | 5151 | } |
| 5138 | 5152 | ||
| 5139 | for (i = 0; i < len; i++) | 5153 | for (i = 0; i < len; i++) |
| 5140 | { | 5154 | { |
| 5141 | XSETINT (it->ctl_chars[i * 4], escape_glyph); | 5155 | XSETINT (it->ctl_chars[i * 4], escape_glyph); |
| 5142 | /* Insert three more glyphs into IT->ctl_chars for | 5156 | /* Insert three more glyphs into IT->ctl_chars for |
| 5143 | the octal display of the character. */ | 5157 | the octal display of the character. */ |
| 5144 | g = FAST_MAKE_GLYPH (((str[i] >> 6) & 7) + '0', | 5158 | g = ((str[i] >> 6) & 7) + '0'; |
| 5145 | face_id); | 5159 | XSETINT (it->ctl_chars[i * 4 + 1], g); |
| 5146 | XSETINT (it->ctl_chars[i * 4 + 1], g); | 5160 | g = ((str[i] >> 3) & 7) + '0'; |
| 5147 | g = FAST_MAKE_GLYPH (((str[i] >> 3) & 7) + '0', | 5161 | XSETINT (it->ctl_chars[i * 4 + 2], g); |
| 5148 | face_id); | 5162 | g = (str[i] & 7) + '0'; |
| 5149 | XSETINT (it->ctl_chars[i * 4 + 2], g); | 5163 | XSETINT (it->ctl_chars[i * 4 + 3], g); |
| 5150 | g = FAST_MAKE_GLYPH ((str[i] & 7) + '0', | 5164 | } |
| 5151 | face_id); | 5165 | ctl_len = len * 4; |
| 5152 | XSETINT (it->ctl_chars[i * 4 + 3], g); | 5166 | } |
| 5153 | } | ||
| 5154 | ctl_len = len * 4; | ||
| 5155 | } | ||
| 5156 | 5167 | ||
| 5168 | display_control: | ||
| 5157 | /* Set up IT->dpvec and return first character from it. */ | 5169 | /* Set up IT->dpvec and return first character from it. */ |
| 5158 | it->dpvec_char_len = it->len; | 5170 | it->dpvec_char_len = it->len; |
| 5159 | it->dpvec = it->ctl_chars; | 5171 | it->dpvec = it->ctl_chars; |
| 5160 | it->dpend = it->dpvec + ctl_len; | 5172 | it->dpend = it->dpvec + ctl_len; |
| 5161 | it->current.dpvec_index = 0; | 5173 | it->current.dpvec_index = 0; |
| 5174 | it->dpvec_face_id = face_id; | ||
| 5162 | it->saved_face_id = it->face_id; | 5175 | it->saved_face_id = it->face_id; |
| 5163 | it->method = next_element_from_display_vector; | 5176 | it->method = next_element_from_display_vector; |
| 5164 | it->ellipsis_p = 0; | 5177 | it->ellipsis_p = 0; |
| @@ -5288,9 +5301,6 @@ set_iterator_to_next (it, reseat_p) | |||
| 5288 | it->dpvec = NULL; | 5301 | it->dpvec = NULL; |
| 5289 | it->current.dpvec_index = -1; | 5302 | it->current.dpvec_index = -1; |
| 5290 | 5303 | ||
| 5291 | /* Recheck faces after display vector */ | ||
| 5292 | it->stop_charpos = 0; | ||
| 5293 | |||
| 5294 | /* Skip over characters which were displayed via IT->dpvec. */ | 5304 | /* Skip over characters which were displayed via IT->dpvec. */ |
| 5295 | if (it->dpvec_char_len < 0) | 5305 | if (it->dpvec_char_len < 0) |
| 5296 | reseat_at_next_visible_line_start (it, 1); | 5306 | reseat_at_next_visible_line_start (it, 1); |
| @@ -5299,6 +5309,9 @@ set_iterator_to_next (it, reseat_p) | |||
| 5299 | it->len = it->dpvec_char_len; | 5309 | it->len = it->dpvec_char_len; |
| 5300 | set_iterator_to_next (it, reseat_p); | 5310 | set_iterator_to_next (it, reseat_p); |
| 5301 | } | 5311 | } |
| 5312 | |||
| 5313 | /* Recheck faces after display vector */ | ||
| 5314 | it->stop_charpos = IT_CHARPOS (*it); | ||
| 5302 | } | 5315 | } |
| 5303 | } | 5316 | } |
| 5304 | else if (it->method == next_element_from_string) | 5317 | else if (it->method == next_element_from_string) |
| @@ -5378,7 +5391,6 @@ next_element_from_display_vector (it) | |||
| 5378 | if (INTEGERP (*it->dpvec) | 5391 | if (INTEGERP (*it->dpvec) |
| 5379 | && GLYPH_CHAR_VALID_P (XFASTINT (*it->dpvec))) | 5392 | && GLYPH_CHAR_VALID_P (XFASTINT (*it->dpvec))) |
| 5380 | { | 5393 | { |
| 5381 | int lface_id; | ||
| 5382 | GLYPH g; | 5394 | GLYPH g; |
| 5383 | 5395 | ||
| 5384 | g = XFASTINT (it->dpvec[it->current.dpvec_index]); | 5396 | g = XFASTINT (it->dpvec[it->current.dpvec_index]); |
| @@ -5388,13 +5400,14 @@ next_element_from_display_vector (it) | |||
| 5388 | /* The entry may contain a face id to use. Such a face id is | 5400 | /* The entry may contain a face id to use. Such a face id is |
| 5389 | the id of a Lisp face, not a realized face. A face id of | 5401 | the id of a Lisp face, not a realized face. A face id of |
| 5390 | zero means no face is specified. */ | 5402 | zero means no face is specified. */ |
| 5391 | lface_id = FAST_GLYPH_FACE (g); | 5403 | if (it->dpvec_face_id >= 0) |
| 5392 | if (lface_id) | 5404 | it->face_id = it->dpvec_face_id; |
| 5405 | else | ||
| 5393 | { | 5406 | { |
| 5394 | /* The function returns -1 if lface_id is invalid. */ | 5407 | int lface_id = FAST_GLYPH_FACE (g); |
| 5395 | int face_id = ascii_face_of_lisp_face (it->f, lface_id); | 5408 | if (lface_id > 0) |
| 5396 | if (face_id >= 0) | 5409 | it->face_id = merge_faces (it->f, Qt, lface_id, |
| 5397 | it->face_id = face_id; | 5410 | it->saved_face_id); |
| 5398 | } | 5411 | } |
| 5399 | } | 5412 | } |
| 5400 | else | 5413 | else |
| @@ -11766,9 +11779,6 @@ redisplay_window (window, just_this_one_p) | |||
| 11766 | *w->desired_matrix->method = 0; | 11779 | *w->desired_matrix->method = 0; |
| 11767 | #endif | 11780 | #endif |
| 11768 | 11781 | ||
| 11769 | /* Force this to be looked up again for each redisp of each window. */ | ||
| 11770 | escape_glyph_face = -1; | ||
| 11771 | |||
| 11772 | specbind (Qinhibit_point_motion_hooks, Qt); | 11782 | specbind (Qinhibit_point_motion_hooks, Qt); |
| 11773 | 11783 | ||
| 11774 | reconsider_clip_changes (w, buffer); | 11784 | reconsider_clip_changes (w, buffer); |
| @@ -16071,22 +16081,30 @@ store_mode_line_string (string, lisp_string, copy_string, field_width, precision | |||
| 16071 | 16081 | ||
| 16072 | 16082 | ||
| 16073 | DEFUN ("format-mode-line", Fformat_mode_line, Sformat_mode_line, | 16083 | DEFUN ("format-mode-line", Fformat_mode_line, Sformat_mode_line, |
| 16074 | 0, 4, 0, | 16084 | 1, 4, 0, |
| 16075 | doc: /* Return the mode-line of selected window as a string. | 16085 | doc: /* Format a string out of a mode line format specification. |
| 16076 | First optional arg FORMAT specifies a different format string (see | 16086 | First arg FORMAT specifies the mode line format (see `mode-line-format' |
| 16077 | `mode-line-format' for details) to use. If FORMAT is t, return | 16087 | for details) to use. |
| 16078 | the buffer's header-line. Second optional arg WINDOW specifies a | 16088 | |
| 16079 | different window to use as the context for the formatting. | 16089 | Optional second arg FACE specifies the face property to put |
| 16080 | If third optional arg NO-PROPS is non-nil, string is not propertized. | 16090 | on all characters for which no face is specified. |
| 16081 | Fourth optional arg BUFFER specifies which buffer to use. */) | 16091 | t means whatever face the window's mode line currently uses |
| 16082 | (format, window, no_props, buffer) | 16092 | \(either `mode-line' or `mode-line-inactive', depending). |
| 16083 | Lisp_Object format, window, no_props, buffer; | 16093 | nil means the default is no face property. |
| 16094 | If FACE is an integer, the value string has no text properties. | ||
| 16095 | |||
| 16096 | Optional third and fourth args WINDOW and BUFFER specify the window | ||
| 16097 | and buffer to use as the context for the formatting (defaults | ||
| 16098 | are the selected window and the window's buffer). */) | ||
| 16099 | (format, face, window, buffer) | ||
| 16100 | Lisp_Object format, face, window, buffer; | ||
| 16084 | { | 16101 | { |
| 16085 | struct it it; | 16102 | struct it it; |
| 16086 | int len; | 16103 | int len; |
| 16087 | struct window *w; | 16104 | struct window *w; |
| 16088 | struct buffer *old_buffer = NULL; | 16105 | struct buffer *old_buffer = NULL; |
| 16089 | enum face_id face_id = DEFAULT_FACE_ID; | 16106 | int face_id = -1; |
| 16107 | int no_props = INTEGERP (face); | ||
| 16090 | 16108 | ||
| 16091 | if (NILP (window)) | 16109 | if (NILP (window)) |
| 16092 | window = selected_window; | 16110 | window = selected_window; |
| @@ -16095,37 +16113,37 @@ Fourth optional arg BUFFER specifies which buffer to use. */) | |||
| 16095 | 16113 | ||
| 16096 | if (NILP (buffer)) | 16114 | if (NILP (buffer)) |
| 16097 | buffer = w->buffer; | 16115 | buffer = w->buffer; |
| 16098 | |||
| 16099 | CHECK_BUFFER (buffer); | 16116 | CHECK_BUFFER (buffer); |
| 16100 | 16117 | ||
| 16101 | if (XBUFFER (buffer) != current_buffer) | 16118 | if (NILP (format)) |
| 16119 | return build_string (""); | ||
| 16120 | |||
| 16121 | if (no_props) | ||
| 16122 | face = Qnil; | ||
| 16123 | |||
| 16124 | if (!NILP (face)) | ||
| 16102 | { | 16125 | { |
| 16103 | old_buffer = current_buffer; | 16126 | if (EQ (face, Qt)) |
| 16104 | set_buffer_internal_1 (XBUFFER (buffer)); | 16127 | face = (EQ (window, selected_window) ? Qmode_line : Qmode_line_inactive); |
| 16128 | face_id = lookup_named_face (XFRAME (WINDOW_FRAME (w)), face, 0, 0); | ||
| 16105 | } | 16129 | } |
| 16106 | 16130 | ||
| 16107 | if (NILP (format) || EQ (format, Qt)) | 16131 | if (face_id < 0) |
| 16132 | face_id = DEFAULT_FACE_ID; | ||
| 16133 | |||
| 16134 | if (XBUFFER (buffer) != current_buffer) | ||
| 16108 | { | 16135 | { |
| 16109 | face_id = (NILP (format) | 16136 | old_buffer = current_buffer; |
| 16110 | ? CURRENT_MODE_LINE_FACE_ID (w) | 16137 | set_buffer_internal_1 (XBUFFER (buffer)); |
| 16111 | : HEADER_LINE_FACE_ID); | ||
| 16112 | format = (NILP (format) | ||
| 16113 | ? current_buffer->mode_line_format | ||
| 16114 | : current_buffer->header_line_format); | ||
| 16115 | } | 16138 | } |
| 16116 | 16139 | ||
| 16117 | init_iterator (&it, w, -1, -1, NULL, face_id); | 16140 | init_iterator (&it, w, -1, -1, NULL, face_id); |
| 16118 | 16141 | ||
| 16119 | if (NILP (no_props)) | 16142 | if (!no_props) |
| 16120 | { | 16143 | { |
| 16121 | mode_line_string_face | 16144 | mode_line_string_face = face; |
| 16122 | = (face_id == MODE_LINE_FACE_ID ? Qmode_line | ||
| 16123 | : face_id == MODE_LINE_INACTIVE_FACE_ID ? Qmode_line_inactive | ||
| 16124 | : face_id == HEADER_LINE_FACE_ID ? Qheader_line : Qnil); | ||
| 16125 | |||
| 16126 | mode_line_string_face_prop | 16145 | mode_line_string_face_prop |
| 16127 | = (NILP (mode_line_string_face) ? Qnil | 16146 | = (NILP (face) ? Qnil : Fcons (Qface, Fcons (face, Qnil))); |
| 16128 | : Fcons (Qface, Fcons (mode_line_string_face, Qnil))); | ||
| 16129 | 16147 | ||
| 16130 | /* We need a dummy last element in mode_line_string_list to | 16148 | /* We need a dummy last element in mode_line_string_list to |
| 16131 | indicate we are building the propertized mode-line string. | 16149 | indicate we are building the propertized mode-line string. |
| @@ -16148,7 +16166,7 @@ Fourth optional arg BUFFER specifies which buffer to use. */) | |||
| 16148 | if (old_buffer) | 16166 | if (old_buffer) |
| 16149 | set_buffer_internal_1 (old_buffer); | 16167 | set_buffer_internal_1 (old_buffer); |
| 16150 | 16168 | ||
| 16151 | if (NILP (no_props)) | 16169 | if (!no_props) |
| 16152 | { | 16170 | { |
| 16153 | Lisp_Object str; | 16171 | Lisp_Object str; |
| 16154 | mode_line_string_list = Fnreverse (mode_line_string_list); | 16172 | mode_line_string_list = Fnreverse (mode_line_string_list); |
| @@ -22498,6 +22516,10 @@ wide as that tab on the display. */); | |||
| 22498 | The face used for trailing whitespace is `trailing-whitespace'. */); | 22516 | The face used for trailing whitespace is `trailing-whitespace'. */); |
| 22499 | Vshow_trailing_whitespace = Qnil; | 22517 | Vshow_trailing_whitespace = Qnil; |
| 22500 | 22518 | ||
| 22519 | DEFVAR_LISP ("show-nonbreak-escape", &Vshow_nonbreak_escape, | ||
| 22520 | doc: /* *Non-nil means display escape character before non-break space and hyphen. */); | ||
| 22521 | Vshow_nonbreak_escape = Qt; | ||
| 22522 | |||
| 22501 | DEFVAR_LISP ("void-text-area-pointer", &Vvoid_text_area_pointer, | 22523 | DEFVAR_LISP ("void-text-area-pointer", &Vvoid_text_area_pointer, |
| 22502 | doc: /* *The pointer shape to show in void text areas. | 22524 | doc: /* *The pointer shape to show in void text areas. |
| 22503 | Nil means to show the text pointer. Other options are `arrow', `text', | 22525 | Nil means to show the text pointer. Other options are `arrow', `text', |
diff --git a/src/xfaces.c b/src/xfaces.c index f866b448d49..468b31ce5d5 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -7881,6 +7881,69 @@ face_at_string_position (w, string, pos, bufpos, region_beg, | |||
| 7881 | } | 7881 | } |
| 7882 | 7882 | ||
| 7883 | 7883 | ||
| 7884 | /* Merge a face into a realized face. | ||
| 7885 | |||
| 7886 | F is frame where faces are (to be) realized. | ||
| 7887 | |||
| 7888 | FACE_NAME is named face to merge. | ||
| 7889 | |||
| 7890 | If FACE_NAME is nil, FACE_ID is face_id of realized face to merge. | ||
| 7891 | |||
| 7892 | If FACE_NAME is t, FACE_ID is lface_id of face to merge. | ||
| 7893 | |||
| 7894 | BASE_FACE_ID is realized face to merge into. | ||
| 7895 | |||
| 7896 | Return new face id. | ||
| 7897 | */ | ||
| 7898 | |||
| 7899 | int | ||
| 7900 | merge_faces (f, face_name, face_id, base_face_id) | ||
| 7901 | struct frame *f; | ||
| 7902 | Lisp_Object face_name; | ||
| 7903 | int face_id, base_face_id; | ||
| 7904 | { | ||
| 7905 | Lisp_Object attrs[LFACE_VECTOR_SIZE]; | ||
| 7906 | struct face *base_face; | ||
| 7907 | |||
| 7908 | base_face = FACE_FROM_ID (f, base_face_id); | ||
| 7909 | if (!base_face) | ||
| 7910 | return base_face_id; | ||
| 7911 | |||
| 7912 | if (EQ (face_name, Qt)) | ||
| 7913 | { | ||
| 7914 | if (face_id < 0 || face_id >= lface_id_to_name_size) | ||
| 7915 | return base_face_id; | ||
| 7916 | face_name = lface_id_to_name[face_id]; | ||
| 7917 | face_id = lookup_derived_face (f, face_name, 0, base_face_id); | ||
| 7918 | if (face_id >= 0) | ||
| 7919 | return face_id; | ||
| 7920 | return base_face_id; | ||
| 7921 | } | ||
| 7922 | |||
| 7923 | /* Begin with attributes from the base face. */ | ||
| 7924 | bcopy (base_face->lface, attrs, sizeof attrs); | ||
| 7925 | |||
| 7926 | if (!NILP (face_name)) | ||
| 7927 | { | ||
| 7928 | if (!merge_named_face (f, face_name, attrs, 0)) | ||
| 7929 | return base_face_id; | ||
| 7930 | } | ||
| 7931 | else | ||
| 7932 | { | ||
| 7933 | struct face *face; | ||
| 7934 | if (face_id < 0) | ||
| 7935 | return base_face_id; | ||
| 7936 | face = FACE_FROM_ID (f, face_id); | ||
| 7937 | if (!face) | ||
| 7938 | return base_face_id; | ||
| 7939 | merge_face_vectors (f, face->lface, attrs, 0); | ||
| 7940 | } | ||
| 7941 | |||
| 7942 | /* Look up a realized face with the given face attributes, | ||
| 7943 | or realize a new one for ASCII characters. */ | ||
| 7944 | return lookup_face (f, attrs, 0, NULL); | ||
| 7945 | } | ||
| 7946 | |||
| 7884 | 7947 | ||
| 7885 | /*********************************************************************** | 7948 | /*********************************************************************** |
| 7886 | Tests | 7949 | Tests |
diff --git a/src/xmenu.c b/src/xmenu.c index 83b8fe91e9e..850b8f4ddf4 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -2454,10 +2454,6 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click) | |||
| 2454 | G_CALLBACK (menu_highlight_callback)); | 2454 | G_CALLBACK (menu_highlight_callback)); |
| 2455 | xg_crazy_callback_abort = 0; | 2455 | xg_crazy_callback_abort = 0; |
| 2456 | 2456 | ||
| 2457 | for (i = 0; i < 5; i++) | ||
| 2458 | if (FRAME_X_DISPLAY_INFO (f)->grabbed & (1 << i)) | ||
| 2459 | break; | ||
| 2460 | |||
| 2461 | if (! for_click) | 2457 | if (! for_click) |
| 2462 | { | 2458 | { |
| 2463 | /* Not invoked by a click. pop up at x/y. */ | 2459 | /* Not invoked by a click. pop up at x/y. */ |
| @@ -2470,8 +2466,16 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click) | |||
| 2470 | popup_x_y.x = x; | 2466 | popup_x_y.x = x; |
| 2471 | popup_x_y.y = y; | 2467 | popup_x_y.y = y; |
| 2472 | popup_x_y.f = f; | 2468 | popup_x_y.f = f; |
| 2473 | } | ||
| 2474 | 2469 | ||
| 2470 | i = 0; /* gtk_menu_popup needs this to be 0 for a non-button popup. */ | ||
| 2471 | } | ||
| 2472 | else | ||
| 2473 | { | ||
| 2474 | for (i = 0; i < 5; i++) | ||
| 2475 | if (FRAME_X_DISPLAY_INFO (f)->grabbed & (1 << i)) | ||
| 2476 | break; | ||
| 2477 | } | ||
| 2478 | |||
| 2475 | /* Display the menu. */ | 2479 | /* Display the menu. */ |
| 2476 | gtk_widget_show_all (menu); | 2480 | gtk_widget_show_all (menu); |
| 2477 | gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 0); | 2481 | gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 0); |
diff --git a/src/xselect.c b/src/xselect.c index 38547ea6bbf..5dd63b9c735 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -1383,7 +1383,7 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp) | |||
| 1383 | else if (INTEGERP (time_stamp)) | 1383 | else if (INTEGERP (time_stamp)) |
| 1384 | requestor_time = (Time) XUINT (time_stamp); | 1384 | requestor_time = (Time) XUINT (time_stamp); |
| 1385 | else if (FLOATP (time_stamp)) | 1385 | else if (FLOATP (time_stamp)) |
| 1386 | requestor_time = (Time) XFLOAT (time_stamp); | 1386 | requestor_time = (Time) XFLOAT_DATA (time_stamp); |
| 1387 | else | 1387 | else |
| 1388 | error ("TIME_STAMP must be cons or number"); | 1388 | error ("TIME_STAMP must be cons or number"); |
| 1389 | } | 1389 | } |
| @@ -2468,7 +2468,7 @@ x_check_property_data (data) | |||
| 2468 | DPY is the display use to look up X atoms. | 2468 | DPY is the display use to look up X atoms. |
| 2469 | DATA is a Lisp list of values to be converted. | 2469 | DATA is a Lisp list of values to be converted. |
| 2470 | RET is the C array that contains the converted values. It is assumed | 2470 | RET is the C array that contains the converted values. It is assumed |
| 2471 | it is big enough to hol all values. | 2471 | it is big enough to hold all values. |
| 2472 | FORMAT is 8, 16 or 32 and gives the size in bits for each C value to | 2472 | FORMAT is 8, 16 or 32 and gives the size in bits for each C value to |
| 2473 | be stored in RET. */ | 2473 | be stored in RET. */ |
| 2474 | 2474 | ||
| @@ -2492,7 +2492,7 @@ x_fill_property_data (dpy, data, ret, format) | |||
| 2492 | if (INTEGERP (o)) | 2492 | if (INTEGERP (o)) |
| 2493 | val = (CARD32) XFASTINT (o); | 2493 | val = (CARD32) XFASTINT (o); |
| 2494 | else if (FLOATP (o)) | 2494 | else if (FLOATP (o)) |
| 2495 | val = (CARD32) XFLOAT (o); | 2495 | val = (CARD32) XFLOAT_DATA (o); |
| 2496 | else if (CONSP (o)) | 2496 | else if (CONSP (o)) |
| 2497 | val = (CARD32) cons_to_long (o); | 2497 | val = (CARD32) cons_to_long (o); |
| 2498 | else if (STRINGP (o)) | 2498 | else if (STRINGP (o)) |
| @@ -2597,7 +2597,7 @@ If the value is 0 or the atom is not known, return the empty string. */) | |||
| 2597 | if (INTEGERP (value)) | 2597 | if (INTEGERP (value)) |
| 2598 | atom = (Atom) XUINT (value); | 2598 | atom = (Atom) XUINT (value); |
| 2599 | else if (FLOATP (value)) | 2599 | else if (FLOATP (value)) |
| 2600 | atom = (Atom) XFLOAT (value); | 2600 | atom = (Atom) XFLOAT_DATA (value); |
| 2601 | else if (CONSP (value)) | 2601 | else if (CONSP (value)) |
| 2602 | atom = (Atom) cons_to_long (value); | 2602 | atom = (Atom) cons_to_long (value); |
| 2603 | else | 2603 | else |
| @@ -2729,7 +2729,7 @@ are ignored. */) | |||
| 2729 | else if (INTEGERP (dest)) | 2729 | else if (INTEGERP (dest)) |
| 2730 | wdest = (Window) XFASTINT (dest); | 2730 | wdest = (Window) XFASTINT (dest); |
| 2731 | else if (FLOATP (dest)) | 2731 | else if (FLOATP (dest)) |
| 2732 | wdest = (Window) XFLOAT (dest); | 2732 | wdest = (Window) XFLOAT_DATA (dest); |
| 2733 | else if (CONSP (dest)) | 2733 | else if (CONSP (dest)) |
| 2734 | { | 2734 | { |
| 2735 | if (! NUMBERP (XCAR (dest)) || ! NUMBERP (XCDR (dest))) | 2735 | if (! NUMBERP (XCAR (dest)) || ! NUMBERP (XCDR (dest))) |
diff --git a/src/xterm.h b/src/xterm.h index e949fced7d8..cf2583981f0 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -502,6 +502,8 @@ struct x_output | |||
| 502 | GtkWidget *toolbar_widget; | 502 | GtkWidget *toolbar_widget; |
| 503 | /* The handle box that makes the tool bar detachable. */ | 503 | /* The handle box that makes the tool bar detachable. */ |
| 504 | GtkWidget *handlebox_widget; | 504 | GtkWidget *handlebox_widget; |
| 505 | /* Non-zero if the tool bar is detached. */ | ||
| 506 | int toolbar_detached; | ||
| 505 | 507 | ||
| 506 | /* The last size hints set. */ | 508 | /* The last size hints set. */ |
| 507 | GdkGeometry size_hints; | 509 | GdkGeometry size_hints; |