diff options
| author | Karoly Lorentey | 2004-02-17 01:52:25 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2004-02-17 01:52:25 +0000 |
| commit | e581a4668750ed98d77f13500c983439770ec600 (patch) | |
| tree | ccbc5c82753658d45458e9306feb41203ae3757b /src | |
| parent | 806c1866e6cdfe84bd8353dda02c4c8c61267480 (diff) | |
| parent | 0f98bc23509b4e909cc92237e4b082c6866da258 (diff) | |
| download | emacs-e581a4668750ed98d77f13500c983439770ec600.tar.gz emacs-e581a4668750ed98d77f13500c983439770ec600.zip | |
Merged in changes from CVS HEAD
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-71
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-72
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-73
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-74
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-75
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-76
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-77
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-78
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-79
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-80
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-81
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-82
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-83
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-84
Add lisp/emacs-lisp/macroexp.el
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-85
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-86
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-87
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-88
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-89
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-90
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-91
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-92
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-93
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-94
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-95
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-96
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-97
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-77
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 289 | ||||
| -rw-r--r-- | src/Makefile.in | 3 | ||||
| -rw-r--r-- | src/atimer.c | 4 | ||||
| -rw-r--r-- | src/buffer.c | 22 | ||||
| -rw-r--r-- | src/data.c | 15 | ||||
| -rw-r--r-- | src/dispextern.h | 97 | ||||
| -rw-r--r-- | src/dispnew.c | 22 | ||||
| -rw-r--r-- | src/editfns.c | 4 | ||||
| -rw-r--r-- | src/emacs.c | 9 | ||||
| -rw-r--r-- | src/fns.c | 24 | ||||
| -rw-r--r-- | src/frame.h | 4 | ||||
| -rw-r--r-- | src/fringe.c | 1362 | ||||
| -rw-r--r-- | src/keyboard.c | 1 | ||||
| -rw-r--r-- | src/keymap.c | 24 | ||||
| -rw-r--r-- | src/lisp.h | 5 | ||||
| -rw-r--r-- | src/macfns.c | 23 | ||||
| -rw-r--r-- | src/macterm.c | 93 | ||||
| -rw-r--r-- | src/makefile.w32-in | 3 | ||||
| -rw-r--r-- | src/minibuf.c | 210 | ||||
| -rw-r--r-- | src/process.c | 2 | ||||
| -rw-r--r-- | src/region-cache.c | 4 | ||||
| -rw-r--r-- | src/sysdep.c | 2 | ||||
| -rw-r--r-- | src/w32fns.c | 28 | ||||
| -rw-r--r-- | src/w32select.c | 5 | ||||
| -rw-r--r-- | src/w32term.c | 86 | ||||
| -rw-r--r-- | src/window.c | 4 | ||||
| -rw-r--r-- | src/xdisp.c | 787 | ||||
| -rw-r--r-- | src/xfaces.c | 1 | ||||
| -rw-r--r-- | src/xfns.c | 273 | ||||
| -rw-r--r-- | src/xselect.c | 384 | ||||
| -rw-r--r-- | src/xterm.c | 61 | ||||
| -rw-r--r-- | src/xterm.h | 17 |
32 files changed, 2798 insertions, 1070 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 76d63cab844..179b7a16a48 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,285 @@ | |||
| 1 | 2004-02-16 Stephen Eglen <stephen@gnu.org> | ||
| 2 | |||
| 3 | * fringe.c (init_fringe_bitmap): Define j in MAC_OS code. | ||
| 4 | |||
| 5 | 2004-02-15 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 6 | |||
| 7 | * data.c (Fbyteorder): | ||
| 8 | * fringe.c (Fdefine_fringe_bitmap): | ||
| 9 | * xdisp.c (handle_single_display_prop): | ||
| 10 | * xselect.c (x_handle_dnd_message): Lisp_Object/int mixup. | ||
| 11 | |||
| 12 | 2004-02-16 Jason Rumney <jasonr@gnu.org> | ||
| 13 | |||
| 14 | * w32term.c (w32_draw_fringe_bitmap): Handle overlay fringe bitmaps. | ||
| 15 | |||
| 16 | 2004-02-15 Steven Tamm <steventamm@mac.com> | ||
| 17 | |||
| 18 | * macterm.c (Vmac_emulate_three_button_mouse): New variable for | ||
| 19 | controlling emulation of a three button mouse with option and | ||
| 20 | command keys. | ||
| 21 | (Qreverse, mac_get_enumlated_btn): Handle the emulation | ||
| 22 | (mac_event_to_emacs_modifiers, XTread_socket): Ditto | ||
| 23 | |||
| 24 | 2004-02-15 Kim F. Storm <storm@cua.dk> | ||
| 25 | |||
| 26 | * buffer.c (syms_of_buffer): Doc fix for indicate-buffer-boundaries. | ||
| 27 | |||
| 28 | * fringe.c (init_fringe_bitmap) [MAC_OS, WORDS_BIG_ENDIAN]: | ||
| 29 | Perform byte-swapping. | ||
| 30 | |||
| 31 | 2004-02-14 Kim F. Storm <storm@cua.dk> | ||
| 32 | |||
| 33 | * dispextern.h (struct draw_fringe_bitmap_params): Change member | ||
| 34 | bits from char to short to facilitate wider bitmaps. | ||
| 35 | (struct redisplay_interface): Fix prototype of define_fringe_bitmap | ||
| 36 | member. | ||
| 37 | |||
| 38 | * fringe.c (struct fringe_bitmap): Change member bits from char to | ||
| 39 | short to facilitate 16 bits wide bitmaps. Modify all standard | ||
| 40 | bitmaps accordingly. | ||
| 41 | (BYTES_PER_BITMAP_ROW, STANDARD_BITMAP_HEIGHT): New macros. | ||
| 42 | (FRBITS): Use STANDARD_BITMAP_HEIGHT instead of just sizeof. | ||
| 43 | (draw_fringe_bitmap): Ditto. | ||
| 44 | (init_fringe_bitmap) [MAC_OS]: Don't bitswap. | ||
| 45 | (init_fringe_bitmap) [HAVE_X_WINDOWS]: Enhance bitswapping to | ||
| 46 | handle up to 16 bits wide bitmaps. | ||
| 47 | (Fdefine_fringe_bitmap): Doc fix. Handle wider bitmaps. | ||
| 48 | (Ffringe_bitmaps_at_pos): Add missing arg declarations. | ||
| 49 | |||
| 50 | * macterm.c (mac_draw_bitmap): Handle 16 bits wide bitmaps directly. | ||
| 51 | (x_draw_fringe_bitmap): Use enhanced mac_draw_bitmap, so we no longer | ||
| 52 | need to call mac_create_bitmap_from_bitmap_data and mac_free_bitmap. | ||
| 53 | |||
| 54 | * w32term.c (w32_define_fringe_bitmap): Bitmaps are now 16 bits wide, | ||
| 55 | so it is no longer necessary to expand them here. | ||
| 56 | |||
| 57 | * xterm.c (x_draw_fringe_bitmap): Handle wider bitmaps (max 16 bits). | ||
| 58 | |||
| 59 | 2004-02-12 Kim F. Storm <storm@cua.dk> | ||
| 60 | |||
| 61 | * window.c (Fwindow_fringes): Doc fix. | ||
| 62 | |||
| 63 | 2004-02-10 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 64 | |||
| 65 | * xselect.c (x_get_foreign_selection): Add new optional parameter | ||
| 66 | time_stamp. | ||
| 67 | (Fx_get_selection_internal): Ditto, pass time_stamp to | ||
| 68 | x_get_foreign_selection. | ||
| 69 | |||
| 70 | * data.c (Fbyteorder): New function. | ||
| 71 | |||
| 72 | 2004-02-09 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 73 | |||
| 74 | * atimer.c: Move include stdio.h to same place as in other files. | ||
| 75 | |||
| 76 | * region-cache.c: Ditto. | ||
| 77 | |||
| 78 | * sysdep.c: Ditto. | ||
| 79 | |||
| 80 | * xfaces.c: Ditto. | ||
| 81 | |||
| 82 | 2004-02-09 Sam Steingold <sds@gnu.org> | ||
| 83 | |||
| 84 | * w32term.c (w32_draw_fringe_bitmap): Fixed a typo in the last patch. | ||
| 85 | |||
| 86 | 2004-02-09 Kim F. Storm <storm@cua.dk> | ||
| 87 | |||
| 88 | * fringe.c: New file. Move original fringe related declarations | ||
| 89 | and code from dispextern.h and xdisp.c here. | ||
| 90 | Rework code to support user defined fringe bitmaps, redefining | ||
| 91 | standard bitmaps, ability to overlay user defined bitmap with | ||
| 92 | overlay arrow bitmap, and add faces to bitmaps. | ||
| 93 | (Voverflow_newline_into_fringe): Declare here. | ||
| 94 | (enum fringe_bitmap_align): New enum. | ||
| 95 | (..._bits): All bitmaps are now defined without bitswapping; that | ||
| 96 | is now done in init_fringe_once (if necessary). | ||
| 97 | (standard_bitmaps): New array with specifications for the | ||
| 98 | standard fringe bitmaps. | ||
| 99 | (fringe_faces): New array. | ||
| 100 | (valid_fringe_bitmap_id_p): New function. | ||
| 101 | (draw_fringe_bitmap_1): Rename from draw_fringe_bitmap. | ||
| 102 | (draw_fringe_bitmap): New function which draws fringe bitmap, | ||
| 103 | possibly overlaying bitmap with cursor in right fringe or the | ||
| 104 | overlay arrow in the left fringe. | ||
| 105 | (update_window_fringes): Do not handle overlay arrow here. | ||
| 106 | Compare and copy fringe bitmap faces. | ||
| 107 | (init_fringe_bitmap): New function. | ||
| 108 | (Fdefine_fringe_bitmap, Fdestroy_fringe_bitmap): New DEFUNs to | ||
| 109 | define and destroy user defined fringe bitmaps. | ||
| 110 | (Fset_fringe_bitmap_face): New DEFUN to set face for a fringe bitmap. | ||
| 111 | (Ffringe_bitmaps_at_pos): New DEFUN to read current fringe bitmaps. | ||
| 112 | (syms_of_fringe): New function. Defsubr new DEFUNs. | ||
| 113 | DEFVAR_LISP Voverflow_newline_into_fringe. | ||
| 114 | (init_fringe_once, init_fringe): New functions. | ||
| 115 | (w32_init_fringe, w32_reset_fringes) [WINDOWS_NT]: New functions. | ||
| 116 | |||
| 117 | * Makefile.in (obj): Add fringe.o. | ||
| 118 | (fringe.o): New dependencies. | ||
| 119 | |||
| 120 | * dispextern.h (FRINGE_ID_BITS): New definition for number of | ||
| 121 | bits allocated to hold a fringe number. Increase number of bits | ||
| 122 | from 4 to 8 to allow user defined fringe bitmaps. | ||
| 123 | (struct glyph_row, struct it): New members left_user_fringe_bitmap, | ||
| 124 | left_user_fringe_face_id, right_user_fringe_bitmap, | ||
| 125 | right_user_fringe_face_id. | ||
| 126 | (enum fringe_bitmap_type, struct fringe_bitmap, fringe_bitmaps): | ||
| 127 | Move to new file fringe.c. | ||
| 128 | (MAX_FRINGE_BITMAPS): Define here. | ||
| 129 | (struct draw_fringe_bitmap_params): New members bits, cursor_p, | ||
| 130 | and overlay_p. Change member which to int. | ||
| 131 | (struct redisplay_interface): New members define_fringe_bitmap | ||
| 132 | and destroy_fringe_bitmap. | ||
| 133 | (valid_fringe_bitmap_id_p): Add prototype. | ||
| 134 | (w32_init_fringe, w32_reset_fringes) [WINDOWS_NT]: Add prototypes. | ||
| 135 | |||
| 136 | * dispnew.c (row_equal_p): Compare fringe bitmap faces and overlay | ||
| 137 | arrows. | ||
| 138 | (update_frame): Do flush_display if force_flush_display_p to | ||
| 139 | ensure display (specifically fringes) are updated in a timely | ||
| 140 | manner when resizing the frame by dragging the mouse. | ||
| 141 | (update_window_line): Update row if overlay arrow changed. | ||
| 142 | (scrolling_window): Redraw fringe bitmaps if fringe bitmap faces | ||
| 143 | or overlay arrow changed. | ||
| 144 | |||
| 145 | * emacs.c (main) [HAVE_WINDOW_SYSTEM]: Call init_fringe_once, | ||
| 146 | syms_of_fringe, and init_fringe. | ||
| 147 | |||
| 148 | * frame.h (struct frame): New member force_flush_display_p. | ||
| 149 | |||
| 150 | * lisp.h (syms_of_fringe, init_fringe, init_fringe_once): | ||
| 151 | Add prototypes. | ||
| 152 | |||
| 153 | * macterm.c (mac_draw_bitmap): Add overlay_p arg. | ||
| 154 | (x_draw_fringe_bitmap): Handle overlayed fringe bitmaps; | ||
| 155 | thanks to YAMAMOTO Mitsuharu for advice on how to do this. | ||
| 156 | Use cursor color for displaying cursor in fringe. | ||
| 157 | (x_redisplay_interface): Add null handlers for | ||
| 158 | define_fringe_bitmap and destroy_fringe_bitmap functions. | ||
| 159 | |||
| 160 | * w32term.c (w32_draw_fringe_bitmap): Copy unadapted code from | ||
| 161 | xterm.c to handle overlayed fringe bitmaps and to use cursor color | ||
| 162 | for displaying cursor in fringe. | ||
| 163 | (w32_define_fringe_bitmap, w32_destroy_fringe_bitmap): New W32 | ||
| 164 | specific functions to define and destroy fringe bitmaps in fringe_bmp. | ||
| 165 | (w32_redisplay_interface): Add them to redisplay_interface. | ||
| 166 | (w32_term_init): Call w32_init_fringe instead of explicitly | ||
| 167 | defining fringe bitmaps in fringe_bmp array. | ||
| 168 | (x_delete_display): Call w32_reset_fringes instead of explicitly | ||
| 169 | destroying fringe bitmaps in fringe_bmp array. | ||
| 170 | |||
| 171 | * xdisp.c (Voverflow_newline_into_fringe, syms_of_xdisp) | ||
| 172 | (left_bits, right_bits, up_arrow_bits, down_arrow_bits) | ||
| 173 | (continued_bits, continuation_bits, ov_bits, first_line_bits) | ||
| 174 | (last_line_bits, filled_box_cursor_bits, hollow_box_cursor_bits) | ||
| 175 | (bar_cursor_bits, hbar_cursor_bits, zv_bits, hollow_square_bits) | ||
| 176 | (fringe_bitmaps, draw_fringe_bitmap, draw_row_fringe_bitmaps) | ||
| 177 | (draw_window_fringes, compute_fringe_widths, update_window_fringes): | ||
| 178 | Move fringe handling vars and code to new file fringe.c. | ||
| 179 | (handle_display_prop): Handle left-fringe and right-fringe | ||
| 180 | display properties; store user fringe bitmaps in iterator. | ||
| 181 | (move_it_in_display_line_to): Handle cursor in fringe at eob. | ||
| 182 | (clear_garbaged_frames): Set force_flush_display_p if resized. | ||
| 183 | (redisplay_window): Redraw fringe bitmaps if not just_this_one_p. | ||
| 184 | (display_line): Handle cursor in fringe at eob. | ||
| 185 | (display_line): Set row user fringe bitmaps from iterator. | ||
| 186 | |||
| 187 | * xterm.c (x_draw_fringe_bitmap): Handle overlayed fringe bitmaps. | ||
| 188 | Use cursor color for displaying cursor in fringe. | ||
| 189 | (x_redisplay_interface): Add null handlers for | ||
| 190 | define_fringe_bitmap and destroy_fringe_bitmap functions. | ||
| 191 | |||
| 192 | 2004-02-07 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 193 | |||
| 194 | * macfns.c (Fx_change_window_property): Make doc string and | ||
| 195 | parameters same as for X version. | ||
| 196 | |||
| 197 | * w32fns.c (Fx_change_window_property): Ditto. | ||
| 198 | |||
| 199 | 2004-02-07 Kim F. Storm <storm@cua.dk> | ||
| 200 | |||
| 201 | * xdisp.c (hscroll_window_tree): Position cursor near to right | ||
| 202 | margin in hscrolled window when jumping to end of line (rather | ||
| 203 | than centering cursor). | ||
| 204 | |||
| 205 | * process.c (wait_reading_process_input): Don't do adaptive read | ||
| 206 | buffering if waiting for a specific process. | ||
| 207 | |||
| 208 | 2004-02-05 Luc Teirlinck <teirllm@auburn.edu> | ||
| 209 | |||
| 210 | * minibuf.c (Fminibufferp, Fread_from_minibuffer) | ||
| 211 | (Fread_minibuffer, Feval_minibuffer) | ||
| 212 | (Fread_string, Fread_no_blanks_input) | ||
| 213 | (Fcompleting_read): Doc fixes. | ||
| 214 | (syms_of_minibuf): Doc fixes for minibuffer-completion-table and | ||
| 215 | completion-regexp-list. Define Qcase_fold_search and staticpro it. | ||
| 216 | (read_minibuf): Fix initial comment. | ||
| 217 | (Ftry_completion, Fall_completions, Ftest_completion): Bind | ||
| 218 | case-fold-serach to the value of completion-ignore-case when | ||
| 219 | checking completion-regexp-list. | ||
| 220 | (Fdisplay_completion_list): Make it handle arguments that are | ||
| 221 | symbols. Doc fix. | ||
| 222 | |||
| 223 | 2004-02-05 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 224 | |||
| 225 | * xterm.h: Add declaration of free_frame_menubar. | ||
| 226 | |||
| 227 | * xfns.c (x_create_bitmap_mask): Removed unused variable depth. | ||
| 228 | (x_set_menu_bar_lines): Added ! defined USE_GTK for olines. | ||
| 229 | (Fx_change_window_property): Add declaration of parameters type and | ||
| 230 | format. Remove unused variable cons. | ||
| 231 | |||
| 232 | * xselect.c: Include stdio,h. | ||
| 233 | |||
| 234 | 2004-02-05 Kenichi Handa <handa@m17n.org> | ||
| 235 | |||
| 236 | * fns.c (Fset_char_table_range): Fix previous change. | ||
| 237 | |||
| 238 | * buffer.c (Fset_buffer_multibyte): Fix docstring. | ||
| 239 | |||
| 240 | 2004-02-04 Luc Teirlinck <teirllm@auburn.edu> | ||
| 241 | |||
| 242 | * editfns.c (Fchar_after, Fchar_before): Doc fixes. | ||
| 243 | |||
| 244 | 2004-02-04 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 245 | |||
| 246 | * keymap.c (Vmouse_events): Rename from Vmenu_events. | ||
| 247 | (syms_of_keymap): Add mouse-[45], header-line, and mode-line to it. | ||
| 248 | |||
| 249 | 2004-02-04 Kenichi Handa <handa@m17n.org> | ||
| 250 | |||
| 251 | * fns.c (Fset_char_table_range): Handle charsets ascii, | ||
| 252 | eight-bit-control, and eight-bit-graphic correctly. | ||
| 253 | |||
| 254 | 2004-02-03 Jason Rumney <jasonr@gnu.org> | ||
| 255 | |||
| 256 | * w32select.c (Fw32_set_clipboard_data): Make coding iso2022 safe. | ||
| 257 | |||
| 258 | * w32fns.c (x_to_w32_font): Likewise. | ||
| 259 | |||
| 260 | 2004-02-03 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 261 | |||
| 262 | * xterm.h: Add x_handle_dnd_message, x_check_property_data, | ||
| 263 | x_fill_property_data, x_property_data_to_lisp and check_x_display_info. | ||
| 264 | |||
| 265 | * xterm.c (handle_one_xevent): Call x_handle_dnd_message for | ||
| 266 | ClientMessages. | ||
| 267 | |||
| 268 | * xselect.c: Include termhooks.h and X11/Xproto.h | ||
| 269 | (x_check_property_data, x_fill_property_data) | ||
| 270 | (x_property_data_to_lisp, mouse_position_for_drop) | ||
| 271 | (Fx_get_atom_name, x_handle_dnd_message): New functions for DND support. | ||
| 272 | (Fx_send_client_event): Move here from xfns.c. | ||
| 273 | (syms_of_xselect): Add Sx_get_atom_name and Sx_send_client_message. | ||
| 274 | |||
| 275 | * xfns.c (x-send-client-message): Move to xselect.c | ||
| 276 | (Fx_change_window_property): Add optional arguments TYPE, FORMAT and | ||
| 277 | OUTER_P. | ||
| 278 | (Fx_window_property): Add optional arguments TYPE, SOURCE, DELETE_P, | ||
| 279 | VECTOR_RET_P. Handle AnyPropertyType. Call x_property_data_to_lisp | ||
| 280 | if vector_ret_p is true. | ||
| 281 | (syms_of_xfns): Sx_send_client_message moved to xselect.c. | ||
| 282 | |||
| 1 | 2004-02-02 Eli Zaretskii <eliz@elta.co.il> | 283 | 2004-02-02 Eli Zaretskii <eliz@elta.co.il> |
| 2 | 284 | ||
| 3 | * fileio.c (Fcopy_file): If NEWNAME is a directory, expand the | 285 | * fileio.c (Fcopy_file): If NEWNAME is a directory, expand the |
| @@ -43,10 +325,9 @@ | |||
| 43 | 325 | ||
| 44 | 2004-01-27 Steven Tamm <steventamm@mac.com> | 326 | 2004-01-27 Steven Tamm <steventamm@mac.com> |
| 45 | 327 | ||
| 46 | * macterm.c (make_mac_frame, make_mac_terminal_frame): Move | 328 | * macterm.c (make_mac_frame, make_mac_terminal_frame): |
| 47 | setting of scroll bars from make_mac_frame to | 329 | Move setting of scroll bars from make_mac_frame to |
| 48 | make_mac_terminal_frame to prevent clobbering of | 330 | make_mac_terminal_frame to prevent clobbering of scroll-bar-mode. |
| 49 | scroll-bar-mode. | ||
| 50 | 331 | ||
| 51 | 2004-01-26 Richard M. Stallman <rms@gnu.org> | 332 | 2004-01-26 Richard M. Stallman <rms@gnu.org> |
| 52 | 333 | ||
diff --git a/src/Makefile.in b/src/Makefile.in index 94579aed476..ac9cae31061 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -571,7 +571,7 @@ XMENU_OBJ = xmenu.o | |||
| 571 | 571 | ||
| 572 | /* lastfile must follow all files | 572 | /* lastfile must follow all files |
| 573 | whose initialized data areas should be dumped as pure by dump-emacs. */ | 573 | whose initialized data areas should be dumped as pure by dump-emacs. */ |
| 574 | obj= dispnew.o frame.o scroll.o xdisp.o $(XMENU_OBJ) window.o \ | 574 | obj= dispnew.o frame.o scroll.o xdisp.o fringe.o $(XMENU_OBJ) window.o \ |
| 575 | charset.o coding.o category.o ccl.o \ | 575 | charset.o coding.o category.o ccl.o \ |
| 576 | cm.o term.o xfaces.o $(XOBJ) \ | 576 | cm.o term.o xfaces.o $(XOBJ) \ |
| 577 | emacs.o keyboard.o macros.o keymap.o sysdep.o \ | 577 | emacs.o keyboard.o macros.o keymap.o sysdep.o \ |
| @@ -1075,6 +1075,7 @@ filemode.o: filemode.c $(config_h) | |||
| 1075 | frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \ | 1075 | frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \ |
| 1076 | blockinput.h atimer.h systime.h buffer.h charset.h fontset.h \ | 1076 | blockinput.h atimer.h systime.h buffer.h charset.h fontset.h \ |
| 1077 | msdos.h dosfns.h dispextern.h $(config_h) | 1077 | msdos.h dosfns.h dispextern.h $(config_h) |
| 1078 | fringe.o: fringe.c dispextern.h frame.h window.h buffer.h $(config_h) | ||
| 1078 | fontset.o: dispextern.h fontset.h fontset.c ccl.h buffer.h charset.h frame.h \ | 1079 | fontset.o: dispextern.h fontset.h fontset.c ccl.h buffer.h charset.h frame.h \ |
| 1079 | keyboard.h termhooks.h $(config_h) | 1080 | keyboard.h termhooks.h $(config_h) |
| 1080 | getloadavg.o: getloadavg.c $(config_h) | 1081 | getloadavg.o: getloadavg.c $(config_h) |
diff --git a/src/atimer.c b/src/atimer.c index 6b0e0777886..2ddc7427f56 100644 --- a/src/atimer.c +++ b/src/atimer.c | |||
| @@ -19,13 +19,13 @@ the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |||
| 19 | Boston, MA 02111-1307, USA. */ | 19 | Boston, MA 02111-1307, USA. */ |
| 20 | 20 | ||
| 21 | #include <config.h> | 21 | #include <config.h> |
| 22 | #include <lisp.h> | ||
| 23 | #include <signal.h> | 22 | #include <signal.h> |
| 23 | #include <stdio.h> | ||
| 24 | #include <lisp.h> | ||
| 24 | #include <syssignal.h> | 25 | #include <syssignal.h> |
| 25 | #include <systime.h> | 26 | #include <systime.h> |
| 26 | #include <blockinput.h> | 27 | #include <blockinput.h> |
| 27 | #include <atimer.h> | 28 | #include <atimer.h> |
| 28 | #include <stdio.h> | ||
| 29 | 29 | ||
| 30 | #ifdef HAVE_UNISTD_H | 30 | #ifdef HAVE_UNISTD_H |
| 31 | #include <unistd.h> | 31 | #include <unistd.h> |
diff --git a/src/buffer.c b/src/buffer.c index fa5a9c85c2d..ad1dde93da7 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -2081,7 +2081,9 @@ DEFUN ("set-buffer-multibyte", Fset_buffer_multibyte, Sset_buffer_multibyte, | |||
| 2081 | If FLAG is t, this makes the buffer a multibyte buffer. | 2081 | If FLAG is t, this makes the buffer a multibyte buffer. |
| 2082 | If FLAG is nil, this makes the buffer a single-byte buffer. | 2082 | If FLAG is nil, this makes the buffer a single-byte buffer. |
| 2083 | The buffer contents remain unchanged as a sequence of bytes | 2083 | The buffer contents remain unchanged as a sequence of bytes |
| 2084 | but the contents viewed as characters do change. */) | 2084 | but the contents viewed as characters do change. |
| 2085 | If the multibyte flag was really changed, undo information of the | ||
| 2086 | current buffer is cleared. */) | ||
| 2085 | (flag) | 2087 | (flag) |
| 2086 | Lisp_Object flag; | 2088 | Lisp_Object flag; |
| 2087 | { | 2089 | { |
| @@ -5637,10 +5639,20 @@ window-systems. */); | |||
| 5637 | DEFVAR_PER_BUFFER ("indicate-buffer-boundaries", | 5639 | DEFVAR_PER_BUFFER ("indicate-buffer-boundaries", |
| 5638 | ¤t_buffer->indicate_buffer_boundaries, Qnil, | 5640 | ¤t_buffer->indicate_buffer_boundaries, Qnil, |
| 5639 | doc: /* *Visually indicate buffer boundaries and scrolling. | 5641 | doc: /* *Visually indicate buffer boundaries and scrolling. |
| 5640 | If non-nil, the first and last line of the buffer are marked in the left and | 5642 | If non-nil, the first and last line of the buffer are marked in the fringe |
| 5641 | right fringe of a window on window-systems. | 5643 | of a window on window-systems with angle bitmaps, or if the window can be |
| 5642 | In addition, if value is t, the top and bottom line of the window are marked | 5644 | scrolled, the top and bottom line of the window are marked with up and down |
| 5643 | with up and down arrow bitmaps in the right fringe if window can be scrolled. */); | 5645 | arrow bitmaps. |
| 5646 | If value is `left' or `right', both angle and arrow bitmaps are displayed in | ||
| 5647 | the left or right fringe, resp. Any other non-nil value causes the | ||
| 5648 | bitmap on the top line to be displayed in the left fringe, and the | ||
| 5649 | bitmap on the bottom line in the right fringe. | ||
| 5650 | If value is a cons (ANGLES . ARROWS), the car specifies the position | ||
| 5651 | of the angle bitmaps, and the cdr specifies the position of the arrow | ||
| 5652 | bitmaps. For example, (t . right) places the top angle bitmap in left | ||
| 5653 | fringe, the bottom angle bitmap in right fringe, and both arrow | ||
| 5654 | bitmaps in right fringe. To show just the angle bitmaps in the left | ||
| 5655 | fringe, but no arrow bitmaps, use (left . nil). */); | ||
| 5644 | 5656 | ||
| 5645 | DEFVAR_PER_BUFFER ("scroll-up-aggressively", | 5657 | DEFVAR_PER_BUFFER ("scroll-up-aggressively", |
| 5646 | ¤t_buffer->scroll_up_aggressively, Qnil, | 5658 | ¤t_buffer->scroll_up_aggressively, Qnil, |
diff --git a/src/data.c b/src/data.c index c4e3937f3fa..bff2baaed27 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -2879,6 +2879,20 @@ DEFUN ("lognot", Flognot, Slognot, 1, 1, 0, | |||
| 2879 | XSETINT (number, ~XINT (number)); | 2879 | XSETINT (number, ~XINT (number)); |
| 2880 | return number; | 2880 | return number; |
| 2881 | } | 2881 | } |
| 2882 | |||
| 2883 | DEFUN ("byteorder", Fbyteorder, Sbyteorder, 0, 0, 0, | ||
| 2884 | doc: /* Return the byteorder for the machine. | ||
| 2885 | Returns 66 (ASCII uppercase B) for big endian machines or 108 (ASCII | ||
| 2886 | lowercase l) for small endian machines. */) | ||
| 2887 | () | ||
| 2888 | { | ||
| 2889 | unsigned i = 0x04030201; | ||
| 2890 | int order = *(char *)&i == 4 ? 66 : 108; | ||
| 2891 | |||
| 2892 | return make_number (order); | ||
| 2893 | } | ||
| 2894 | |||
| 2895 | |||
| 2882 | 2896 | ||
| 2883 | void | 2897 | void |
| 2884 | syms_of_data () | 2898 | syms_of_data () |
| @@ -3281,6 +3295,7 @@ syms_of_data () | |||
| 3281 | defsubr (&Sadd1); | 3295 | defsubr (&Sadd1); |
| 3282 | defsubr (&Ssub1); | 3296 | defsubr (&Ssub1); |
| 3283 | defsubr (&Slognot); | 3297 | defsubr (&Slognot); |
| 3298 | defsubr (&Sbyteorder); | ||
| 3284 | defsubr (&Ssubr_arity); | 3299 | defsubr (&Ssubr_arity); |
| 3285 | 3300 | ||
| 3286 | XSYMBOL (Qwholenump)->function = XSYMBOL (Qnatnump)->function; | 3301 | XSYMBOL (Qwholenump)->function = XSYMBOL (Qnatnump)->function; |
diff --git a/src/dispextern.h b/src/dispextern.h index e157a2ff3e6..48893aa133d 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -126,6 +126,9 @@ enum window_part | |||
| 126 | ON_RIGHT_MARGIN | 126 | ON_RIGHT_MARGIN |
| 127 | }; | 127 | }; |
| 128 | 128 | ||
| 129 | /* Number of bits allocated to store fringe bitmap numbers. */ | ||
| 130 | #define FRINGE_ID_BITS 8 | ||
| 131 | |||
| 129 | 132 | ||
| 130 | 133 | ||
| 131 | /*********************************************************************** | 134 | /*********************************************************************** |
| @@ -710,10 +713,28 @@ struct glyph_row | |||
| 710 | struct display_pos end; | 713 | struct display_pos end; |
| 711 | 714 | ||
| 712 | /* Left fringe bitmap number (enum fringe_bitmap_type). */ | 715 | /* Left fringe bitmap number (enum fringe_bitmap_type). */ |
| 713 | unsigned left_fringe_bitmap : 4; | 716 | unsigned left_user_fringe_bitmap : FRINGE_ID_BITS; |
| 717 | |||
| 718 | /* Face of the left fringe glyph. */ | ||
| 719 | unsigned left_user_fringe_face_id : FACE_ID_BITS; | ||
| 720 | |||
| 721 | /* Right fringe bitmap number (enum fringe_bitmap_type). */ | ||
| 722 | unsigned right_user_fringe_bitmap : FRINGE_ID_BITS; | ||
| 723 | |||
| 724 | /* Face of the right fringe glyph. */ | ||
| 725 | unsigned right_user_fringe_face_id : FACE_ID_BITS; | ||
| 726 | |||
| 727 | /* Left fringe bitmap number (enum fringe_bitmap_type). */ | ||
| 728 | unsigned left_fringe_bitmap : FRINGE_ID_BITS; | ||
| 729 | |||
| 730 | /* Face of the left fringe glyph. */ | ||
| 731 | unsigned left_fringe_face_id : FACE_ID_BITS; | ||
| 714 | 732 | ||
| 715 | /* Right fringe bitmap number (enum fringe_bitmap_type). */ | 733 | /* Right fringe bitmap number (enum fringe_bitmap_type). */ |
| 716 | unsigned right_fringe_bitmap : 4; | 734 | unsigned right_fringe_bitmap : FRINGE_ID_BITS; |
| 735 | |||
| 736 | /* Face of the right fringe glyph. */ | ||
| 737 | unsigned right_fringe_face_id : FACE_ID_BITS; | ||
| 717 | 738 | ||
| 718 | /* 1 means that we must draw the bitmaps of this row. */ | 739 | /* 1 means that we must draw the bitmaps of this row. */ |
| 719 | unsigned redraw_fringe_bitmaps_p : 1; | 740 | unsigned redraw_fringe_bitmaps_p : 1; |
| @@ -1609,35 +1630,6 @@ extern int face_change_count; | |||
| 1609 | Fringes | 1630 | Fringes |
| 1610 | ***********************************************************************/ | 1631 | ***********************************************************************/ |
| 1611 | 1632 | ||
| 1612 | enum fringe_bitmap_type | ||
| 1613 | { | ||
| 1614 | NO_FRINGE_BITMAP = 0, | ||
| 1615 | LEFT_TRUNCATION_BITMAP, | ||
| 1616 | RIGHT_TRUNCATION_BITMAP, | ||
| 1617 | UP_ARROW_BITMAP, | ||
| 1618 | DOWN_ARROW_BITMAP, | ||
| 1619 | CONTINUED_LINE_BITMAP, | ||
| 1620 | CONTINUATION_LINE_BITMAP, | ||
| 1621 | OVERLAY_ARROW_BITMAP, | ||
| 1622 | FIRST_LINE_BITMAP, | ||
| 1623 | LAST_LINE_BITMAP, | ||
| 1624 | FILLED_BOX_CURSOR_BITMAP, | ||
| 1625 | HOLLOW_BOX_CURSOR_BITMAP, | ||
| 1626 | BAR_CURSOR_BITMAP, | ||
| 1627 | HBAR_CURSOR_BITMAP, | ||
| 1628 | ZV_LINE_BITMAP, | ||
| 1629 | HOLLOW_SQUARE_BITMAP, | ||
| 1630 | MAX_FRINGE_BITMAPS | ||
| 1631 | }; | ||
| 1632 | |||
| 1633 | struct fringe_bitmap | ||
| 1634 | { | ||
| 1635 | int width; | ||
| 1636 | int height; | ||
| 1637 | int period; | ||
| 1638 | unsigned char *bits; | ||
| 1639 | }; | ||
| 1640 | |||
| 1641 | /* Structure used to describe where and how to draw a fringe bitmap. | 1633 | /* Structure used to describe where and how to draw a fringe bitmap. |
| 1642 | WHICH is the fringe bitmap to draw. WD and H is the (adjusted) | 1634 | WHICH is the fringe bitmap to draw. WD and H is the (adjusted) |
| 1643 | width and height of the bitmap, DH is the height adjustment (if | 1635 | width and height of the bitmap, DH is the height adjustment (if |
| @@ -1648,14 +1640,17 @@ struct fringe_bitmap | |||
| 1648 | 1640 | ||
| 1649 | struct draw_fringe_bitmap_params | 1641 | struct draw_fringe_bitmap_params |
| 1650 | { | 1642 | { |
| 1651 | enum fringe_bitmap_type which; | 1643 | int which; /* enum fringe_bitmap_type */ |
| 1644 | unsigned short *bits; | ||
| 1652 | int wd, h, dh; | 1645 | int wd, h, dh; |
| 1653 | int x, y; | 1646 | int x, y; |
| 1654 | int bx, nx, by, ny; | 1647 | int bx, nx, by, ny; |
| 1648 | unsigned cursor_p : 1; | ||
| 1649 | unsigned overlay_p : 1; | ||
| 1655 | struct face *face; | 1650 | struct face *face; |
| 1656 | }; | 1651 | }; |
| 1657 | 1652 | ||
| 1658 | extern struct fringe_bitmap fringe_bitmaps[MAX_FRINGE_BITMAPS]; | 1653 | #define MAX_FRINGE_BITMAPS (1<<FRINGE_ID_BITS) |
| 1659 | 1654 | ||
| 1660 | 1655 | ||
| 1661 | /*********************************************************************** | 1656 | /*********************************************************************** |
| @@ -2025,6 +2020,18 @@ struct it | |||
| 2025 | /* Horizontal matrix position reached in move_it_in_display_line. | 2020 | /* Horizontal matrix position reached in move_it_in_display_line. |
| 2026 | Only set there, not in display_line. */ | 2021 | Only set there, not in display_line. */ |
| 2027 | int hpos; | 2022 | int hpos; |
| 2023 | |||
| 2024 | /* Left fringe bitmap number (enum fringe_bitmap_type). */ | ||
| 2025 | unsigned left_user_fringe_bitmap : FRINGE_ID_BITS; | ||
| 2026 | |||
| 2027 | /* Face of the left fringe glyph. */ | ||
| 2028 | unsigned left_user_fringe_face_id : FACE_ID_BITS; | ||
| 2029 | |||
| 2030 | /* Right fringe bitmap number (enum fringe_bitmap_type). */ | ||
| 2031 | unsigned right_user_fringe_bitmap : FRINGE_ID_BITS; | ||
| 2032 | |||
| 2033 | /* Face of the right fringe glyph. */ | ||
| 2034 | unsigned right_user_fringe_face_id : FACE_ID_BITS; | ||
| 2028 | }; | 2035 | }; |
| 2029 | 2036 | ||
| 2030 | 2037 | ||
| @@ -2181,6 +2188,11 @@ struct redisplay_interface | |||
| 2181 | void (*draw_fringe_bitmap) P_ ((struct window *w, struct glyph_row *row, | 2188 | void (*draw_fringe_bitmap) P_ ((struct window *w, struct glyph_row *row, |
| 2182 | struct draw_fringe_bitmap_params *p)); | 2189 | struct draw_fringe_bitmap_params *p)); |
| 2183 | 2190 | ||
| 2191 | /* Define and destroy fringe bitmap no. WHICH. */ | ||
| 2192 | void (*define_fringe_bitmap) P_ ((int which, unsigned short *bits, | ||
| 2193 | int h, int wd)); | ||
| 2194 | void (*destroy_fringe_bitmap) P_ ((int which)); | ||
| 2195 | |||
| 2184 | /* Get metrics of character CHAR2B in FONT of type FONT_TYPE. | 2196 | /* Get metrics of character CHAR2B in FONT of type FONT_TYPE. |
| 2185 | Value is null if CHAR2B is not contained in the font. */ | 2197 | Value is null if CHAR2B is not contained in the font. */ |
| 2186 | XCharStruct * (*per_char_metric) P_ ((XFontStruct *font, XChar2b *char2b, | 2198 | XCharStruct * (*per_char_metric) P_ ((XFontStruct *font, XChar2b *char2b, |
| @@ -2526,11 +2538,6 @@ void move_it_past_eol P_ ((struct it *)); | |||
| 2526 | int in_display_vector_p P_ ((struct it *)); | 2538 | int in_display_vector_p P_ ((struct it *)); |
| 2527 | int frame_mode_line_height P_ ((struct frame *)); | 2539 | int frame_mode_line_height P_ ((struct frame *)); |
| 2528 | void highlight_trailing_whitespace P_ ((struct frame *, struct glyph_row *)); | 2540 | void highlight_trailing_whitespace P_ ((struct frame *, struct glyph_row *)); |
| 2529 | void draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, int)); | ||
| 2530 | void draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *)); | ||
| 2531 | void draw_window_fringes P_ ((struct window *)); | ||
| 2532 | int update_window_fringes P_ ((struct window *, int)); | ||
| 2533 | void compute_fringe_widths P_ ((struct frame *, int)); | ||
| 2534 | extern Lisp_Object Qtool_bar; | 2541 | extern Lisp_Object Qtool_bar; |
| 2535 | extern Lisp_Object Vshow_trailing_whitespace; | 2542 | extern Lisp_Object Vshow_trailing_whitespace; |
| 2536 | extern int mode_line_in_non_selected_windows; | 2543 | extern int mode_line_in_non_selected_windows; |
| @@ -2600,6 +2607,20 @@ extern int x_intersect_rectangles P_ ((XRectangle *, XRectangle *, | |||
| 2600 | XRectangle *)); | 2607 | XRectangle *)); |
| 2601 | #endif | 2608 | #endif |
| 2602 | 2609 | ||
| 2610 | /* Defined in fringe.c */ | ||
| 2611 | |||
| 2612 | int valid_fringe_bitmap_id_p (int); | ||
| 2613 | void draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, int)); | ||
| 2614 | void draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *)); | ||
| 2615 | void draw_window_fringes P_ ((struct window *)); | ||
| 2616 | int update_window_fringes P_ ((struct window *, int)); | ||
| 2617 | void compute_fringe_widths P_ ((struct frame *, int)); | ||
| 2618 | |||
| 2619 | #ifdef WINDOWS_NT | ||
| 2620 | void w32_init_fringe P_ ((void)); | ||
| 2621 | void w32_reset_fringes P_ ((void)); | ||
| 2622 | #endif | ||
| 2623 | |||
| 2603 | /* Defined in sysdep.c */ | 2624 | /* Defined in sysdep.c */ |
| 2604 | 2625 | ||
| 2605 | void get_tty_size P_ ((int, int *, int *)); | 2626 | void get_tty_size P_ ((int, int *, int *)); |
diff --git a/src/dispnew.c b/src/dispnew.c index 1bd54a589c4..aaf3c440f34 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -1503,7 +1503,10 @@ row_equal_p (w, a, b, mouse_face_p) | |||
| 1503 | if (a->fill_line_p != b->fill_line_p | 1503 | if (a->fill_line_p != b->fill_line_p |
| 1504 | || a->cursor_in_fringe_p != b->cursor_in_fringe_p | 1504 | || a->cursor_in_fringe_p != b->cursor_in_fringe_p |
| 1505 | || a->left_fringe_bitmap != b->left_fringe_bitmap | 1505 | || a->left_fringe_bitmap != b->left_fringe_bitmap |
| 1506 | || a->left_fringe_face_id != b->left_fringe_face_id | ||
| 1506 | || a->right_fringe_bitmap != b->right_fringe_bitmap | 1507 | || a->right_fringe_bitmap != b->right_fringe_bitmap |
| 1508 | || a->right_fringe_face_id != b->right_fringe_face_id | ||
| 1509 | || a->overlay_arrow_p != b->overlay_arrow_p | ||
| 1507 | || a->exact_window_width_line_p != b->exact_window_width_line_p | 1510 | || a->exact_window_width_line_p != b->exact_window_width_line_p |
| 1508 | || a->overlapped_p != b->overlapped_p | 1511 | || a->overlapped_p != b->overlapped_p |
| 1509 | || (MATRIX_ROW_CONTINUATION_LINE_P (a) | 1512 | || (MATRIX_ROW_CONTINUATION_LINE_P (a) |
| @@ -3820,10 +3823,15 @@ update_frame (f, force_p, inhibit_hairy_id_p) | |||
| 3820 | paused_p = update_window_tree (root_window, force_p); | 3823 | paused_p = update_window_tree (root_window, force_p); |
| 3821 | update_end (f); | 3824 | update_end (f); |
| 3822 | 3825 | ||
| 3823 | #if 0 /* This flush is a performance bottleneck under X, | 3826 | /* This flush is a performance bottleneck under X, |
| 3824 | and it doesn't seem to be necessary anyway. */ | 3827 | and it doesn't seem to be necessary anyway (in general). |
| 3825 | FRAME_RIF (f)->flush_display (f); | 3828 | It is necessary when resizing the window with the mouse, or |
| 3826 | #endif | 3829 | at least the fringes are not redrawn in a timely manner. ++kfs */ |
| 3830 | if (f->force_flush_display_p) | ||
| 3831 | { | ||
| 3832 | FRAME_RIF (f)->flush_display (f); | ||
| 3833 | f->force_flush_display_p = 0; | ||
| 3834 | } | ||
| 3827 | } | 3835 | } |
| 3828 | else | 3836 | else |
| 3829 | { | 3837 | { |
| @@ -4524,6 +4532,7 @@ update_window_line (w, vpos, mouse_face_overwritten_p) | |||
| 4524 | || desired_row->y != current_row->y | 4532 | || desired_row->y != current_row->y |
| 4525 | || desired_row->visible_height != current_row->visible_height | 4533 | || desired_row->visible_height != current_row->visible_height |
| 4526 | || desired_row->cursor_in_fringe_p != current_row->cursor_in_fringe_p | 4534 | || desired_row->cursor_in_fringe_p != current_row->cursor_in_fringe_p |
| 4535 | || desired_row->overlay_arrow_p != current_row->overlay_arrow_p | ||
| 4527 | || current_row->redraw_fringe_bitmaps_p | 4536 | || current_row->redraw_fringe_bitmaps_p |
| 4528 | || desired_row->mode_line_p != current_row->mode_line_p | 4537 | || desired_row->mode_line_p != current_row->mode_line_p |
| 4529 | || desired_row->exact_window_width_line_p != current_row->exact_window_width_line_p | 4538 | || desired_row->exact_window_width_line_p != current_row->exact_window_width_line_p |
| @@ -5032,7 +5041,10 @@ scrolling_window (w, header_line_p) | |||
| 5032 | to_overlapped_p = to->overlapped_p; | 5041 | to_overlapped_p = to->overlapped_p; |
| 5033 | if (!from->mode_line_p && !w->pseudo_window_p | 5042 | if (!from->mode_line_p && !w->pseudo_window_p |
| 5034 | && (to->left_fringe_bitmap != from->left_fringe_bitmap | 5043 | && (to->left_fringe_bitmap != from->left_fringe_bitmap |
| 5035 | || to->right_fringe_bitmap != from->right_fringe_bitmap)) | 5044 | || to->right_fringe_bitmap != from->right_fringe_bitmap |
| 5045 | || to->left_fringe_face_id != from->left_fringe_face_id | ||
| 5046 | || to->right_fringe_face_id != from->right_fringe_face_id | ||
| 5047 | || to->overlay_arrow_p != from->overlay_arrow_p)) | ||
| 5036 | from->redraw_fringe_bitmaps_p = 1; | 5048 | from->redraw_fringe_bitmaps_p = 1; |
| 5037 | assign_row (to, from); | 5049 | assign_row (to, from); |
| 5038 | to->enabled_p = 1, from->enabled_p = 0; | 5050 | to->enabled_p = 1, from->enabled_p = 0; |
diff --git a/src/editfns.c b/src/editfns.c index d3039ca0273..9a1ce81f316 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -1138,7 +1138,7 @@ DEFUN ("eolp", Feolp, Seolp, 0, 0, 0, | |||
| 1138 | 1138 | ||
| 1139 | DEFUN ("char-after", Fchar_after, Schar_after, 0, 1, 0, | 1139 | DEFUN ("char-after", Fchar_after, Schar_after, 0, 1, 0, |
| 1140 | doc: /* Return character in current buffer at position POS. | 1140 | doc: /* Return character in current buffer at position POS. |
| 1141 | POS is an integer or a marker. | 1141 | POS is an integer or a marker and defaults to point. |
| 1142 | If POS is out of range, the value is nil. */) | 1142 | If POS is out of range, the value is nil. */) |
| 1143 | (pos) | 1143 | (pos) |
| 1144 | Lisp_Object pos; | 1144 | Lisp_Object pos; |
| @@ -1171,7 +1171,7 @@ If POS is out of range, the value is nil. */) | |||
| 1171 | 1171 | ||
| 1172 | DEFUN ("char-before", Fchar_before, Schar_before, 0, 1, 0, | 1172 | DEFUN ("char-before", Fchar_before, Schar_before, 0, 1, 0, |
| 1173 | doc: /* Return character in current buffer preceding position POS. | 1173 | doc: /* Return character in current buffer preceding position POS. |
| 1174 | POS is an integer or a marker. | 1174 | POS is an integer or a marker and defaults to point. |
| 1175 | If POS is out of range, the value is nil. */) | 1175 | If POS is out of range, the value is nil. */) |
| 1176 | (pos) | 1176 | (pos) |
| 1177 | Lisp_Object pos; | 1177 | Lisp_Object pos; |
diff --git a/src/emacs.c b/src/emacs.c index 4f66e4bdb07..20c6295e2e2 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -1236,6 +1236,9 @@ main (argc, argv | |||
| 1236 | 1236 | ||
| 1237 | init_window_once (); /* Init the window system. */ | 1237 | init_window_once (); /* Init the window system. */ |
| 1238 | init_fileio_once (); /* Must precede any path manipulation. */ | 1238 | init_fileio_once (); /* Must precede any path manipulation. */ |
| 1239 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 1240 | init_fringe_once (); /* Swap bitmaps if necessary. */ | ||
| 1241 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 1239 | } | 1242 | } |
| 1240 | 1243 | ||
| 1241 | init_alloc (); | 1244 | init_alloc (); |
| @@ -1500,6 +1503,9 @@ main (argc, argv | |||
| 1500 | #endif /* WINDOWSNT */ | 1503 | #endif /* WINDOWSNT */ |
| 1501 | syms_of_window (); | 1504 | syms_of_window (); |
| 1502 | syms_of_xdisp (); | 1505 | syms_of_xdisp (); |
| 1506 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 1507 | syms_of_fringe (); | ||
| 1508 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 1503 | #ifdef HAVE_X_WINDOWS | 1509 | #ifdef HAVE_X_WINDOWS |
| 1504 | syms_of_xterm (); | 1510 | syms_of_xterm (); |
| 1505 | syms_of_xfns (); | 1511 | syms_of_xfns (); |
| @@ -1581,6 +1587,9 @@ main (argc, argv | |||
| 1581 | #endif /* HAVE_X_WINDOWS */ | 1587 | #endif /* HAVE_X_WINDOWS */ |
| 1582 | init_fns (); | 1588 | init_fns (); |
| 1583 | init_xdisp (); | 1589 | init_xdisp (); |
| 1590 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 1591 | init_fringe (); | ||
| 1592 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 1584 | init_macros (); | 1593 | init_macros (); |
| 1585 | init_editfns (); | 1594 | init_editfns (); |
| 1586 | init_floatfns (); | 1595 | init_floatfns (); |
| @@ -2512,14 +2512,26 @@ character set, or a character code. Return VALUE. */) | |||
| 2512 | else if (SYMBOLP (range)) | 2512 | else if (SYMBOLP (range)) |
| 2513 | { | 2513 | { |
| 2514 | Lisp_Object charset_info; | 2514 | Lisp_Object charset_info; |
| 2515 | int charset_id; | ||
| 2515 | 2516 | ||
| 2516 | charset_info = Fget (range, Qcharset); | 2517 | charset_info = Fget (range, Qcharset); |
| 2517 | CHECK_VECTOR (charset_info); | 2518 | if (! VECTORP (charset_info) |
| 2518 | 2519 | || ! NATNUMP (AREF (charset_info, 0)) | |
| 2519 | return Faset (char_table, | 2520 | || (charset_id = XINT (AREF (charset_info, 0)), |
| 2520 | make_number (XINT (XVECTOR (charset_info)->contents[0]) | 2521 | ! CHARSET_DEFINED_P (charset_id))) |
| 2521 | + 128), | 2522 | error ("Invalid charset: %s", SDATA (SYMBOL_NAME (range))); |
| 2522 | value); | 2523 | |
| 2524 | if (charset_id == CHARSET_ASCII) | ||
| 2525 | for (i = 0; i < 128; i++) | ||
| 2526 | XCHAR_TABLE (char_table)->contents[i] = value; | ||
| 2527 | else if (charset_id == CHARSET_8_BIT_CONTROL) | ||
| 2528 | for (i = 128; i < 160; i++) | ||
| 2529 | XCHAR_TABLE (char_table)->contents[i] = value; | ||
| 2530 | else if (charset_id == CHARSET_8_BIT_GRAPHIC) | ||
| 2531 | for (i = 160; i < 256; i++) | ||
| 2532 | XCHAR_TABLE (char_table)->contents[i] = value; | ||
| 2533 | else | ||
| 2534 | XCHAR_TABLE (char_table)->contents[charset_id + 128] = value; | ||
| 2523 | } | 2535 | } |
| 2524 | else if (INTEGERP (range)) | 2536 | else if (INTEGERP (range)) |
| 2525 | Faset (char_table, range, value); | 2537 | Faset (char_table, range, value); |
diff --git a/src/frame.h b/src/frame.h index 14806b2bc04..5037ffd0553 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -438,6 +438,10 @@ struct frame | |||
| 438 | Clear the frame in clear_garbaged_frames if set. */ | 438 | Clear the frame in clear_garbaged_frames if set. */ |
| 439 | unsigned resized_p : 1; | 439 | unsigned resized_p : 1; |
| 440 | 440 | ||
| 441 | /* Set to non-zero in when we want for force a flush_display in | ||
| 442 | update_frame, usually after resizing the frame. */ | ||
| 443 | unsigned force_flush_display_p : 1; | ||
| 444 | |||
| 441 | /* All display backends seem to need these two pixel values. */ | 445 | /* All display backends seem to need these two pixel values. */ |
| 442 | unsigned long background_pixel; | 446 | unsigned long background_pixel; |
| 443 | unsigned long foreground_pixel; | 447 | unsigned long foreground_pixel; |
diff --git a/src/fringe.c b/src/fringe.c new file mode 100644 index 00000000000..bd93b4cfce5 --- /dev/null +++ b/src/fringe.c | |||
| @@ -0,0 +1,1362 @@ | |||
| 1 | /* Fringe handling (split from xdisp.c). | ||
| 2 | Copyright (C) 1985,86,87,88,93,94,95,97,98,99,2000,01,02,03,04 | ||
| 3 | Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | This file is part of GNU Emacs. | ||
| 6 | |||
| 7 | GNU Emacs is free software; you can redistribute it and/or modify | ||
| 8 | it under the terms of the GNU General Public License as published by | ||
| 9 | the Free Software Foundation; either version 2, or (at your option) | ||
| 10 | any later version. | ||
| 11 | |||
| 12 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | GNU General Public License for more details. | ||
| 16 | |||
| 17 | You should have received a copy of the GNU General Public License | ||
| 18 | along with GNU Emacs; see the file COPYING. If not, write to | ||
| 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 20 | Boston, MA 02111-1307, USA. */ | ||
| 21 | |||
| 22 | #include <config.h> | ||
| 23 | #include <stdio.h> | ||
| 24 | |||
| 25 | #include "lisp.h" | ||
| 26 | #include "frame.h" | ||
| 27 | #include "window.h" | ||
| 28 | #include "dispextern.h" | ||
| 29 | #include "buffer.h" | ||
| 30 | #include "blockinput.h" | ||
| 31 | #include "termhooks.h" | ||
| 32 | |||
| 33 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 34 | |||
| 35 | extern Lisp_Object Qtop, Qbottom, Qcenter; | ||
| 36 | |||
| 37 | /* Non-nil means that newline may flow into the right fringe. */ | ||
| 38 | |||
| 39 | Lisp_Object Voverflow_newline_into_fringe; | ||
| 40 | |||
| 41 | |||
| 42 | enum fringe_bitmap_type | ||
| 43 | { | ||
| 44 | NO_FRINGE_BITMAP = 0, | ||
| 45 | UNDEF_FRINGE_BITMAP, | ||
| 46 | LEFT_TRUNCATION_BITMAP, | ||
| 47 | RIGHT_TRUNCATION_BITMAP, | ||
| 48 | UP_ARROW_BITMAP, | ||
| 49 | DOWN_ARROW_BITMAP, | ||
| 50 | CONTINUED_LINE_BITMAP, | ||
| 51 | CONTINUATION_LINE_BITMAP, | ||
| 52 | OVERLAY_ARROW_BITMAP, | ||
| 53 | TOP_LEFT_ANGLE_BITMAP, | ||
| 54 | TOP_RIGHT_ANGLE_BITMAP, | ||
| 55 | BOTTOM_LEFT_ANGLE_BITMAP, | ||
| 56 | BOTTOM_RIGHT_ANGLE_BITMAP, | ||
| 57 | LEFT_BRACKET_BITMAP, | ||
| 58 | RIGHT_BRACKET_BITMAP, | ||
| 59 | FILLED_BOX_CURSOR_BITMAP, | ||
| 60 | HOLLOW_BOX_CURSOR_BITMAP, | ||
| 61 | HOLLOW_SQUARE_BITMAP, | ||
| 62 | BAR_CURSOR_BITMAP, | ||
| 63 | HBAR_CURSOR_BITMAP, | ||
| 64 | ZV_LINE_BITMAP, | ||
| 65 | MAX_STANDARD_FRINGE_BITMAPS | ||
| 66 | }; | ||
| 67 | |||
| 68 | enum fringe_bitmap_align | ||
| 69 | { | ||
| 70 | ALIGN_BITMAP_CENTER = 0, | ||
| 71 | ALIGN_BITMAP_TOP, | ||
| 72 | ALIGN_BITMAP_BOTTOM | ||
| 73 | }; | ||
| 74 | |||
| 75 | struct fringe_bitmap | ||
| 76 | { | ||
| 77 | unsigned short *bits; | ||
| 78 | unsigned height : 8; | ||
| 79 | unsigned width : 8; | ||
| 80 | unsigned period : 8; | ||
| 81 | unsigned align : 2; | ||
| 82 | unsigned dynamic : 1; | ||
| 83 | }; | ||
| 84 | |||
| 85 | |||
| 86 | /*********************************************************************** | ||
| 87 | Fringe bitmaps | ||
| 88 | ***********************************************************************/ | ||
| 89 | |||
| 90 | /* Undefined bitmap. A question mark. */ | ||
| 91 | /* | ||
| 92 | ..xxxx.. | ||
| 93 | .xxxxxx. | ||
| 94 | xx....xx | ||
| 95 | xx....xx | ||
| 96 | ....xx.. | ||
| 97 | ...xx... | ||
| 98 | ...xx... | ||
| 99 | ........ | ||
| 100 | ...xx... | ||
| 101 | ...xx... | ||
| 102 | */ | ||
| 103 | static unsigned short unknown_bits[] = { | ||
| 104 | 0x3c, 0x7e, 0x7e, 0x0c, 0x18, 0x18, 0x00, 0x18, 0x18}; | ||
| 105 | |||
| 106 | /* An arrow like this: `<-'. */ | ||
| 107 | /* | ||
| 108 | ...xx... | ||
| 109 | ..xx.... | ||
| 110 | .xx..... | ||
| 111 | xxxxxx.. | ||
| 112 | xxxxxx.. | ||
| 113 | .xx..... | ||
| 114 | ..xx.... | ||
| 115 | ...xx... | ||
| 116 | */ | ||
| 117 | static unsigned short left_arrow_bits[] = { | ||
| 118 | 0x18, 0x30, 0x60, 0xfc, 0xfc, 0x60, 0x30, 0x18}; | ||
| 119 | |||
| 120 | |||
| 121 | /* Right truncation arrow bitmap `->'. */ | ||
| 122 | /* | ||
| 123 | ...xx... | ||
| 124 | ....xx.. | ||
| 125 | .....xx. | ||
| 126 | ..xxxxxx | ||
| 127 | ..xxxxxx | ||
| 128 | .....xx. | ||
| 129 | ....xx.. | ||
| 130 | ...xx... | ||
| 131 | */ | ||
| 132 | static unsigned short right_arrow_bits[] = { | ||
| 133 | 0x18, 0x0c, 0x06, 0x3f, 0x3f, 0x06, 0x0c, 0x18}; | ||
| 134 | |||
| 135 | |||
| 136 | /* Up arrow bitmap. */ | ||
| 137 | /* | ||
| 138 | ...xx... | ||
| 139 | ..xxxx.. | ||
| 140 | .xxxxxx. | ||
| 141 | xxxxxxxx | ||
| 142 | ...xx... | ||
| 143 | ...xx... | ||
| 144 | ...xx... | ||
| 145 | ...xx... | ||
| 146 | */ | ||
| 147 | static unsigned short up_arrow_bits[] = { | ||
| 148 | 0x18, 0x3c, 0x7e, 0xff, 0x18, 0x18, 0x18, 0x18}; | ||
| 149 | |||
| 150 | |||
| 151 | /* Down arrow bitmap. */ | ||
| 152 | /* | ||
| 153 | ...xx... | ||
| 154 | ...xx... | ||
| 155 | ...xx... | ||
| 156 | ...xx... | ||
| 157 | xxxxxxxx | ||
| 158 | .xxxxxx. | ||
| 159 | ..xxxx.. | ||
| 160 | ...xx... | ||
| 161 | */ | ||
| 162 | static unsigned short down_arrow_bits[] = { | ||
| 163 | 0x18, 0x18, 0x18, 0x18, 0xff, 0x7e, 0x3c, 0x18}; | ||
| 164 | |||
| 165 | /* Marker for continued lines. */ | ||
| 166 | /* | ||
| 167 | ..xxxx.. | ||
| 168 | ..xxxxx. | ||
| 169 | ......xx | ||
| 170 | ..x..xxx | ||
| 171 | ..xxxxxx | ||
| 172 | ..xxxxx. | ||
| 173 | ..xxxx.. | ||
| 174 | ..xxxxx. | ||
| 175 | */ | ||
| 176 | static unsigned short continued_bits[] = { | ||
| 177 | 0x3c, 0x3e, 0x03, 0x27, 0x3f, 0x3e, 0x3c, 0x3e}; | ||
| 178 | |||
| 179 | /* Marker for continuation lines. */ | ||
| 180 | /* | ||
| 181 | ..xxxx.. | ||
| 182 | .xxxxx.. | ||
| 183 | xx...... | ||
| 184 | xxx..x.. | ||
| 185 | xxxxxx.. | ||
| 186 | .xxxxx.. | ||
| 187 | ..xxxx.. | ||
| 188 | .xxxxx.. | ||
| 189 | */ | ||
| 190 | static unsigned short continuation_bits[] = { | ||
| 191 | 0x3c, 0x7c, 0xc0, 0xe4, 0xfc, 0x7c, 0x3c, 0x7c}; | ||
| 192 | |||
| 193 | /* Overlay arrow bitmap. A triangular arrow. */ | ||
| 194 | /* | ||
| 195 | xx...... | ||
| 196 | xxxx.... | ||
| 197 | xxxxx... | ||
| 198 | xxxxxx.. | ||
| 199 | xxxxxx.. | ||
| 200 | xxxxx... | ||
| 201 | xxxx.... | ||
| 202 | xx...... | ||
| 203 | */ | ||
| 204 | static unsigned short ov_bits[] = { | ||
| 205 | 0xc0, 0xf0, 0xf8, 0xfc, 0xfc, 0xf8, 0xf0, 0xc0}; | ||
| 206 | |||
| 207 | #if 0 | ||
| 208 | /* Reverse Overlay arrow bitmap. A triangular arrow. */ | ||
| 209 | /* | ||
| 210 | ......xx | ||
| 211 | ....xxxx | ||
| 212 | ...xxxxx | ||
| 213 | ..xxxxxx | ||
| 214 | ..xxxxxx | ||
| 215 | ...xxxxx | ||
| 216 | ....xxxx | ||
| 217 | ......xx | ||
| 218 | */ | ||
| 219 | static unsigned short rev_ov_bits[] = { | ||
| 220 | 0x03, 0x0f, 0x1f, 0x3f, 0x3f, 0x1f, 0x0f, 0x03}; | ||
| 221 | #endif | ||
| 222 | |||
| 223 | /* First line bitmap. An top-left angle. */ | ||
| 224 | /* | ||
| 225 | xxxxxx.. | ||
| 226 | xxxxxx.. | ||
| 227 | xx...... | ||
| 228 | xx...... | ||
| 229 | xx...... | ||
| 230 | xx...... | ||
| 231 | xx...... | ||
| 232 | ........ | ||
| 233 | */ | ||
| 234 | static unsigned short top_left_angle_bits[] = { | ||
| 235 | 0xfc, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00}; | ||
| 236 | |||
| 237 | /* First line bitmap. An right-up angle. */ | ||
| 238 | /* | ||
| 239 | ..xxxxxx | ||
| 240 | ..xxxxxx | ||
| 241 | ......xx | ||
| 242 | ......xx | ||
| 243 | ......xx | ||
| 244 | ......xx | ||
| 245 | ......xx | ||
| 246 | ........ | ||
| 247 | */ | ||
| 248 | static unsigned short top_right_angle_bits[] = { | ||
| 249 | 0x3f, 0x3f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00}; | ||
| 250 | |||
| 251 | /* Last line bitmap. An left-down angle. */ | ||
| 252 | /* | ||
| 253 | ........ | ||
| 254 | xx...... | ||
| 255 | xx...... | ||
| 256 | xx...... | ||
| 257 | xx...... | ||
| 258 | xx...... | ||
| 259 | xxxxxx.. | ||
| 260 | xxxxxx.. | ||
| 261 | */ | ||
| 262 | static unsigned short bottom_left_angle_bits[] = { | ||
| 263 | 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xfc}; | ||
| 264 | |||
| 265 | /* Last line bitmap. An right-down angle. */ | ||
| 266 | /* | ||
| 267 | ........ | ||
| 268 | ......xx | ||
| 269 | ......xx | ||
| 270 | ......xx | ||
| 271 | ......xx | ||
| 272 | ......xx | ||
| 273 | ..xxxxxx | ||
| 274 | ..xxxxxx | ||
| 275 | */ | ||
| 276 | static unsigned short bottom_right_angle_bits[] = { | ||
| 277 | 0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x3f, 0x3f}; | ||
| 278 | |||
| 279 | /* First/last line bitmap. An left bracket. */ | ||
| 280 | /* | ||
| 281 | xxxxxx.. | ||
| 282 | xxxxxx.. | ||
| 283 | xx...... | ||
| 284 | xx...... | ||
| 285 | xx...... | ||
| 286 | xx...... | ||
| 287 | xx...... | ||
| 288 | xx...... | ||
| 289 | xxxxxx.. | ||
| 290 | xxxxxx.. | ||
| 291 | */ | ||
| 292 | static unsigned short left_bracket_bits[] = { | ||
| 293 | 0xfc, 0xfc, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xfc}; | ||
| 294 | |||
| 295 | /* First/last line bitmap. An right bracket. */ | ||
| 296 | /* | ||
| 297 | ..xxxxxx | ||
| 298 | ..xxxxxx | ||
| 299 | ......xx | ||
| 300 | ......xx | ||
| 301 | ......xx | ||
| 302 | ......xx | ||
| 303 | ......xx | ||
| 304 | ......xx | ||
| 305 | ..xxxxxx | ||
| 306 | ..xxxxxx | ||
| 307 | */ | ||
| 308 | static unsigned short right_bracket_bits[] = { | ||
| 309 | 0x3f, 0x3f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x3f, 0x3f}; | ||
| 310 | |||
| 311 | /* Filled box cursor bitmap. A filled box; max 13 pixels high. */ | ||
| 312 | /* | ||
| 313 | xxxxxxx. | ||
| 314 | xxxxxxx. | ||
| 315 | xxxxxxx. | ||
| 316 | xxxxxxx. | ||
| 317 | xxxxxxx. | ||
| 318 | xxxxxxx. | ||
| 319 | xxxxxxx. | ||
| 320 | xxxxxxx. | ||
| 321 | xxxxxxx. | ||
| 322 | xxxxxxx. | ||
| 323 | xxxxxxx. | ||
| 324 | xxxxxxx. | ||
| 325 | xxxxxxx. | ||
| 326 | */ | ||
| 327 | static unsigned short filled_box_cursor_bits[] = { | ||
| 328 | 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe}; | ||
| 329 | |||
| 330 | /* Hollow box cursor bitmap. A hollow box; max 13 pixels high. */ | ||
| 331 | /* | ||
| 332 | xxxxxxx. | ||
| 333 | x.....x. | ||
| 334 | x.....x. | ||
| 335 | x.....x. | ||
| 336 | x.....x. | ||
| 337 | x.....x. | ||
| 338 | x.....x. | ||
| 339 | x.....x. | ||
| 340 | x.....x. | ||
| 341 | x.....x. | ||
| 342 | x.....x. | ||
| 343 | x.....x. | ||
| 344 | xxxxxxx. | ||
| 345 | */ | ||
| 346 | static unsigned short hollow_box_cursor_bits[] = { | ||
| 347 | 0xfe, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfe}; | ||
| 348 | |||
| 349 | /* Bar cursor bitmap. A vertical bar; max 13 pixels high. */ | ||
| 350 | /* | ||
| 351 | xx...... | ||
| 352 | xx...... | ||
| 353 | xx...... | ||
| 354 | xx...... | ||
| 355 | xx...... | ||
| 356 | xx...... | ||
| 357 | xx...... | ||
| 358 | xx...... | ||
| 359 | xx...... | ||
| 360 | xx...... | ||
| 361 | xx...... | ||
| 362 | xx...... | ||
| 363 | xx...... | ||
| 364 | */ | ||
| 365 | static unsigned short bar_cursor_bits[] = { | ||
| 366 | 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0}; | ||
| 367 | |||
| 368 | /* HBar cursor bitmap. A horisontal bar; 2 pixels high. */ | ||
| 369 | /* | ||
| 370 | xxxxxxx. | ||
| 371 | xxxxxxx. | ||
| 372 | */ | ||
| 373 | static unsigned short hbar_cursor_bits[] = { | ||
| 374 | 0xfe, 0xfe}; | ||
| 375 | |||
| 376 | |||
| 377 | /* Bitmap drawn to indicate lines not displaying text if | ||
| 378 | `indicate-empty-lines' is non-nil. */ | ||
| 379 | /* | ||
| 380 | ........ | ||
| 381 | ..xxxx.. | ||
| 382 | ........ | ||
| 383 | ........ | ||
| 384 | ..xxxx.. | ||
| 385 | ........ | ||
| 386 | */ | ||
| 387 | static unsigned short zv_bits[] = { | ||
| 388 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 389 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 390 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 391 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 392 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 393 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 394 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 395 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00}; | ||
| 396 | |||
| 397 | /* Hollow square bitmap. */ | ||
| 398 | /* | ||
| 399 | .xxxxxx. | ||
| 400 | .x....x. | ||
| 401 | .x....x. | ||
| 402 | .x....x. | ||
| 403 | .x....x. | ||
| 404 | .xxxxxx. | ||
| 405 | */ | ||
| 406 | static unsigned short hollow_square_bits[] = { | ||
| 407 | 0x7e, 0x42, 0x42, 0x42, 0x42, 0x7e}; | ||
| 408 | |||
| 409 | |||
| 410 | #define BYTES_PER_BITMAP_ROW (sizeof (unsigned short)) | ||
| 411 | #define STANDARD_BITMAP_HEIGHT(bits) (sizeof (bits)/BYTES_PER_BITMAP_ROW) | ||
| 412 | #define FRBITS(bits) bits, STANDARD_BITMAP_HEIGHT (bits) | ||
| 413 | |||
| 414 | struct fringe_bitmap standard_bitmaps[MAX_STANDARD_FRINGE_BITMAPS] = | ||
| 415 | { | ||
| 416 | { NULL, 0, 0, 0, 0, 0 }, /* NO_FRINGE_BITMAP */ | ||
| 417 | { FRBITS (unknown_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | ||
| 418 | { FRBITS (left_arrow_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | ||
| 419 | { FRBITS (right_arrow_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | ||
| 420 | { FRBITS (up_arrow_bits), 8, 0, ALIGN_BITMAP_TOP, 0 }, | ||
| 421 | { FRBITS (down_arrow_bits), 8, 0, ALIGN_BITMAP_BOTTOM, 0 }, | ||
| 422 | { FRBITS (continued_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | ||
| 423 | { FRBITS (continuation_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | ||
| 424 | { FRBITS (ov_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | ||
| 425 | { FRBITS (top_left_angle_bits), 8, 0, ALIGN_BITMAP_TOP, 0 }, | ||
| 426 | { FRBITS (top_right_angle_bits), 8, 0, ALIGN_BITMAP_TOP, 0 }, | ||
| 427 | { FRBITS (bottom_left_angle_bits), 8, 0, ALIGN_BITMAP_BOTTOM, 0 }, | ||
| 428 | { FRBITS (bottom_right_angle_bits), 8, 0, ALIGN_BITMAP_BOTTOM, 0 }, | ||
| 429 | { FRBITS (left_bracket_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | ||
| 430 | { FRBITS (right_bracket_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | ||
| 431 | { FRBITS (filled_box_cursor_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | ||
| 432 | { FRBITS (hollow_box_cursor_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | ||
| 433 | { FRBITS (hollow_square_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | ||
| 434 | { FRBITS (bar_cursor_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | ||
| 435 | { FRBITS (hbar_cursor_bits), 8, 0, ALIGN_BITMAP_BOTTOM, 0 }, | ||
| 436 | { FRBITS (zv_bits), 8, 3, ALIGN_BITMAP_TOP, 0 }, | ||
| 437 | }; | ||
| 438 | |||
| 439 | static struct fringe_bitmap *fringe_bitmaps[MAX_FRINGE_BITMAPS]; | ||
| 440 | static unsigned fringe_faces[MAX_FRINGE_BITMAPS]; | ||
| 441 | |||
| 442 | static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS; | ||
| 443 | |||
| 444 | /* Return 1 if FRINGE_ID is a valid fringe bitmap id. */ | ||
| 445 | |||
| 446 | int | ||
| 447 | valid_fringe_bitmap_id_p (fringe_id) | ||
| 448 | int fringe_id; | ||
| 449 | { | ||
| 450 | return (fringe_id >= NO_FRINGE_BITMAP | ||
| 451 | && fringe_id < max_used_fringe_bitmap | ||
| 452 | && (fringe_id < MAX_STANDARD_FRINGE_BITMAPS | ||
| 453 | || fringe_bitmaps[fringe_id] != NULL)); | ||
| 454 | } | ||
| 455 | |||
| 456 | /* Draw the bitmap WHICH in one of the left or right fringes of | ||
| 457 | window W. ROW is the glyph row for which to display the bitmap; it | ||
| 458 | determines the vertical position at which the bitmap has to be | ||
| 459 | drawn. | ||
| 460 | LEFT_P is 1 for left fringe, 0 for right fringe. | ||
| 461 | */ | ||
| 462 | |||
| 463 | void | ||
| 464 | draw_fringe_bitmap_1 (w, row, left_p, overlay, which) | ||
| 465 | struct window *w; | ||
| 466 | struct glyph_row *row; | ||
| 467 | int left_p, overlay; | ||
| 468 | enum fringe_bitmap_type which; | ||
| 469 | { | ||
| 470 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | ||
| 471 | struct draw_fringe_bitmap_params p; | ||
| 472 | struct fringe_bitmap *fb; | ||
| 473 | int period; | ||
| 474 | int face_id = DEFAULT_FACE_ID; | ||
| 475 | |||
| 476 | p.cursor_p = 0; | ||
| 477 | p.overlay_p = (overlay & 1) == 1; | ||
| 478 | p.cursor_p = (overlay & 2) == 2; | ||
| 479 | |||
| 480 | if (which != NO_FRINGE_BITMAP) | ||
| 481 | { | ||
| 482 | } | ||
| 483 | else if (left_p) | ||
| 484 | { | ||
| 485 | which = row->left_fringe_bitmap; | ||
| 486 | face_id = row->left_fringe_face_id; | ||
| 487 | } | ||
| 488 | else | ||
| 489 | { | ||
| 490 | which = row->right_fringe_bitmap; | ||
| 491 | face_id = row->right_fringe_face_id; | ||
| 492 | } | ||
| 493 | |||
| 494 | if (face_id == DEFAULT_FACE_ID) | ||
| 495 | face_id = fringe_faces[which]; | ||
| 496 | |||
| 497 | fb = fringe_bitmaps[which]; | ||
| 498 | if (fb == NULL) | ||
| 499 | fb = &standard_bitmaps[which < MAX_STANDARD_FRINGE_BITMAPS | ||
| 500 | ? which : UNDEF_FRINGE_BITMAP]; | ||
| 501 | |||
| 502 | period = fb->period; | ||
| 503 | |||
| 504 | /* Convert row to frame coordinates. */ | ||
| 505 | p.y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); | ||
| 506 | |||
| 507 | p.which = which; | ||
| 508 | p.bits = fb->bits; | ||
| 509 | p.wd = fb->width; | ||
| 510 | |||
| 511 | p.h = fb->height; | ||
| 512 | p.dh = (period > 0 ? (p.y % period) : 0); | ||
| 513 | p.h -= p.dh; | ||
| 514 | /* Clip bitmap if too high. */ | ||
| 515 | if (p.h > row->height) | ||
| 516 | p.h = row->height; | ||
| 517 | |||
| 518 | p.face = FACE_FROM_ID (f, face_id); | ||
| 519 | |||
| 520 | if (p.face == NULL) | ||
| 521 | { | ||
| 522 | /* Why does this happen? ++kfs */ | ||
| 523 | return; | ||
| 524 | } | ||
| 525 | |||
| 526 | PREPARE_FACE_FOR_DISPLAY (f, p.face); | ||
| 527 | |||
| 528 | /* Clear left fringe if no bitmap to draw or if bitmap doesn't fill | ||
| 529 | the fringe. */ | ||
| 530 | p.bx = -1; | ||
| 531 | if (left_p) | ||
| 532 | { | ||
| 533 | int wd = WINDOW_LEFT_FRINGE_WIDTH (w); | ||
| 534 | int x = window_box_left (w, (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | ||
| 535 | ? LEFT_MARGIN_AREA | ||
| 536 | : TEXT_AREA)); | ||
| 537 | if (p.wd > wd) | ||
| 538 | p.wd = wd; | ||
| 539 | p.x = x - p.wd - (wd - p.wd) / 2; | ||
| 540 | |||
| 541 | if (p.wd < wd || row->height > p.h) | ||
| 542 | { | ||
| 543 | /* If W has a vertical border to its left, don't draw over it. */ | ||
| 544 | wd -= ((!WINDOW_LEFTMOST_P (w) | ||
| 545 | && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w)) | ||
| 546 | ? 1 : 0); | ||
| 547 | p.bx = x - wd; | ||
| 548 | p.nx = wd; | ||
| 549 | } | ||
| 550 | } | ||
| 551 | else | ||
| 552 | { | ||
| 553 | int x = window_box_right (w, | ||
| 554 | (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | ||
| 555 | ? RIGHT_MARGIN_AREA | ||
| 556 | : TEXT_AREA)); | ||
| 557 | int wd = WINDOW_RIGHT_FRINGE_WIDTH (w); | ||
| 558 | if (p.wd > wd) | ||
| 559 | p.wd = wd; | ||
| 560 | p.x = x + (wd - p.wd) / 2; | ||
| 561 | /* Clear right fringe if no bitmap to draw of if bitmap doesn't fill | ||
| 562 | the fringe. */ | ||
| 563 | if (p.wd < wd || row->height > p.h) | ||
| 564 | { | ||
| 565 | p.bx = x; | ||
| 566 | p.nx = wd; | ||
| 567 | } | ||
| 568 | } | ||
| 569 | |||
| 570 | if (p.bx >= 0) | ||
| 571 | { | ||
| 572 | int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); | ||
| 573 | |||
| 574 | p.by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, row->y)); | ||
| 575 | p.ny = row->visible_height; | ||
| 576 | } | ||
| 577 | |||
| 578 | /* Adjust y to the offset in the row to start drawing the bitmap. */ | ||
| 579 | switch (fb->align) | ||
| 580 | { | ||
| 581 | case ALIGN_BITMAP_CENTER: | ||
| 582 | p.y += (row->height - p.h) / 2; | ||
| 583 | break; | ||
| 584 | case ALIGN_BITMAP_BOTTOM: | ||
| 585 | p.h = fb->height; | ||
| 586 | p.y += (row->visible_height - p.h); | ||
| 587 | break; | ||
| 588 | case ALIGN_BITMAP_TOP: | ||
| 589 | break; | ||
| 590 | } | ||
| 591 | |||
| 592 | FRAME_RIF (f)->draw_fringe_bitmap (w, row, &p); | ||
| 593 | } | ||
| 594 | |||
| 595 | void | ||
| 596 | draw_fringe_bitmap (w, row, left_p) | ||
| 597 | struct window *w; | ||
| 598 | struct glyph_row *row; | ||
| 599 | int left_p; | ||
| 600 | { | ||
| 601 | int overlay = 0; | ||
| 602 | |||
| 603 | if (!left_p && row->cursor_in_fringe_p) | ||
| 604 | { | ||
| 605 | int cursor = NO_FRINGE_BITMAP; | ||
| 606 | |||
| 607 | switch (w->phys_cursor_type) | ||
| 608 | { | ||
| 609 | case HOLLOW_BOX_CURSOR: | ||
| 610 | if (row->visible_height >= STANDARD_BITMAP_HEIGHT (hollow_box_cursor_bits)) | ||
| 611 | cursor = HOLLOW_BOX_CURSOR_BITMAP; | ||
| 612 | else | ||
| 613 | cursor = HOLLOW_SQUARE_BITMAP; | ||
| 614 | break; | ||
| 615 | case FILLED_BOX_CURSOR: | ||
| 616 | cursor = FILLED_BOX_CURSOR_BITMAP; | ||
| 617 | break; | ||
| 618 | case BAR_CURSOR: | ||
| 619 | cursor = BAR_CURSOR_BITMAP; | ||
| 620 | break; | ||
| 621 | case HBAR_CURSOR: | ||
| 622 | cursor = HBAR_CURSOR_BITMAP; | ||
| 623 | break; | ||
| 624 | case NO_CURSOR: | ||
| 625 | default: | ||
| 626 | w->phys_cursor_on_p = 0; | ||
| 627 | row->cursor_in_fringe_p = 0; | ||
| 628 | break; | ||
| 629 | } | ||
| 630 | if (cursor != NO_FRINGE_BITMAP) | ||
| 631 | { | ||
| 632 | draw_fringe_bitmap_1 (w, row, 0, 2, cursor); | ||
| 633 | overlay = cursor == FILLED_BOX_CURSOR_BITMAP ? 3 : 1; | ||
| 634 | } | ||
| 635 | } | ||
| 636 | |||
| 637 | draw_fringe_bitmap_1 (w, row, left_p, overlay, NO_FRINGE_BITMAP); | ||
| 638 | |||
| 639 | if (left_p && row->overlay_arrow_p) | ||
| 640 | draw_fringe_bitmap_1 (w, row, 1, 1, OVERLAY_ARROW_BITMAP); | ||
| 641 | } | ||
| 642 | |||
| 643 | |||
| 644 | /* Draw fringe bitmaps for glyph row ROW on window W. Call this | ||
| 645 | function with input blocked. */ | ||
| 646 | |||
| 647 | void | ||
| 648 | draw_row_fringe_bitmaps (w, row) | ||
| 649 | struct window *w; | ||
| 650 | struct glyph_row *row; | ||
| 651 | { | ||
| 652 | xassert (interrupt_input_blocked); | ||
| 653 | |||
| 654 | /* If row is completely invisible, because of vscrolling, we | ||
| 655 | don't have to draw anything. */ | ||
| 656 | if (row->visible_height <= 0) | ||
| 657 | return; | ||
| 658 | |||
| 659 | if (WINDOW_LEFT_FRINGE_WIDTH (w) != 0) | ||
| 660 | draw_fringe_bitmap (w, row, 1); | ||
| 661 | |||
| 662 | if (WINDOW_RIGHT_FRINGE_WIDTH (w) != 0) | ||
| 663 | draw_fringe_bitmap (w, row, 0); | ||
| 664 | } | ||
| 665 | |||
| 666 | /* Draw the fringes of window W. Only fringes for rows marked for | ||
| 667 | update in redraw_fringe_bitmaps_p are drawn. */ | ||
| 668 | |||
| 669 | void | ||
| 670 | draw_window_fringes (w) | ||
| 671 | struct window *w; | ||
| 672 | { | ||
| 673 | struct glyph_row *row; | ||
| 674 | int yb = window_text_bottom_y (w); | ||
| 675 | int nrows = w->current_matrix->nrows; | ||
| 676 | int y = 0, rn; | ||
| 677 | |||
| 678 | if (w->pseudo_window_p) | ||
| 679 | return; | ||
| 680 | |||
| 681 | for (y = 0, rn = 0, row = w->current_matrix->rows; | ||
| 682 | y < yb && rn < nrows; | ||
| 683 | y += row->height, ++row, ++rn) | ||
| 684 | { | ||
| 685 | if (!row->redraw_fringe_bitmaps_p) | ||
| 686 | continue; | ||
| 687 | draw_row_fringe_bitmaps (w, row); | ||
| 688 | row->redraw_fringe_bitmaps_p = 0; | ||
| 689 | } | ||
| 690 | } | ||
| 691 | |||
| 692 | |||
| 693 | /* Recalculate the bitmaps to show in the fringes of window W. | ||
| 694 | If FORCE_P is 0, only mark rows with modified bitmaps for update in | ||
| 695 | redraw_fringe_bitmaps_p; else mark all rows for update. */ | ||
| 696 | |||
| 697 | int | ||
| 698 | update_window_fringes (w, force_p) | ||
| 699 | struct window *w; | ||
| 700 | int force_p; | ||
| 701 | { | ||
| 702 | struct glyph_row *row, *cur = 0; | ||
| 703 | int yb = window_text_bottom_y (w); | ||
| 704 | int rn, nrows = w->current_matrix->nrows; | ||
| 705 | int y; | ||
| 706 | int redraw_p = 0; | ||
| 707 | Lisp_Object ind; | ||
| 708 | int boundary_pos = 0, arrow_pos = 0; | ||
| 709 | int empty_pos = 0; | ||
| 710 | |||
| 711 | if (w->pseudo_window_p) | ||
| 712 | return 0; | ||
| 713 | |||
| 714 | if (!MINI_WINDOW_P (w) | ||
| 715 | && (ind = XBUFFER (w->buffer)->indicate_buffer_boundaries, !NILP (ind))) | ||
| 716 | { | ||
| 717 | int do_eob = 1, do_bob = 1; | ||
| 718 | Lisp_Object arrows; | ||
| 719 | |||
| 720 | if (CONSP (ind)) | ||
| 721 | arrows = XCDR (ind), ind = XCAR (ind); | ||
| 722 | else | ||
| 723 | arrows = ind; | ||
| 724 | |||
| 725 | if (EQ (ind, Qleft)) | ||
| 726 | boundary_pos = -1; | ||
| 727 | else if (EQ (ind, Qright)) | ||
| 728 | boundary_pos = 1; | ||
| 729 | |||
| 730 | if (EQ (arrows, Qleft)) | ||
| 731 | arrow_pos = -1; | ||
| 732 | else if (EQ (arrows, Qright)) | ||
| 733 | arrow_pos = 1; | ||
| 734 | |||
| 735 | for (y = 0, rn = 0; | ||
| 736 | y < yb && rn < nrows; | ||
| 737 | y += row->height, ++rn) | ||
| 738 | { | ||
| 739 | unsigned indicate_bob_p, indicate_top_line_p; | ||
| 740 | unsigned indicate_eob_p, indicate_bottom_line_p; | ||
| 741 | |||
| 742 | row = w->desired_matrix->rows + rn; | ||
| 743 | if (!row->enabled_p) | ||
| 744 | row = w->current_matrix->rows + rn; | ||
| 745 | |||
| 746 | indicate_bob_p = row->indicate_bob_p; | ||
| 747 | indicate_top_line_p = row->indicate_top_line_p; | ||
| 748 | indicate_eob_p = row->indicate_eob_p; | ||
| 749 | indicate_bottom_line_p = row->indicate_bottom_line_p; | ||
| 750 | |||
| 751 | row->indicate_bob_p = row->indicate_top_line_p = 0; | ||
| 752 | row->indicate_eob_p = row->indicate_bottom_line_p = 0; | ||
| 753 | |||
| 754 | if (!NILP (ind) | ||
| 755 | && MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer))) | ||
| 756 | row->indicate_bob_p = do_bob, do_bob = 0; | ||
| 757 | else if (!NILP (arrows) | ||
| 758 | && (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) == rn) | ||
| 759 | row->indicate_top_line_p = 1; | ||
| 760 | |||
| 761 | if (!NILP (ind) | ||
| 762 | && MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer))) | ||
| 763 | row->indicate_eob_p = do_eob, do_eob = 0; | ||
| 764 | else if (!NILP (arrows) | ||
| 765 | && y + row->height >= yb) | ||
| 766 | row->indicate_bottom_line_p = 1; | ||
| 767 | |||
| 768 | if (indicate_bob_p != row->indicate_bob_p | ||
| 769 | || indicate_top_line_p != row->indicate_top_line_p | ||
| 770 | || indicate_eob_p != row->indicate_eob_p | ||
| 771 | || indicate_bottom_line_p != row->indicate_bottom_line_p) | ||
| 772 | row->redraw_fringe_bitmaps_p = 1; | ||
| 773 | } | ||
| 774 | } | ||
| 775 | |||
| 776 | if (EQ (XBUFFER (w->buffer)->indicate_empty_lines, Qright)) | ||
| 777 | empty_pos = 1; | ||
| 778 | else if (EQ (XBUFFER (w->buffer)->indicate_empty_lines, Qleft)) | ||
| 779 | empty_pos = -1; | ||
| 780 | |||
| 781 | for (y = 0, rn = 0; | ||
| 782 | y < yb && rn < nrows; | ||
| 783 | y += row->height, rn++) | ||
| 784 | { | ||
| 785 | enum fringe_bitmap_type left, right; | ||
| 786 | unsigned left_face_id, right_face_id; | ||
| 787 | |||
| 788 | row = w->desired_matrix->rows + rn; | ||
| 789 | cur = w->current_matrix->rows + rn; | ||
| 790 | if (!row->enabled_p) | ||
| 791 | row = cur; | ||
| 792 | |||
| 793 | left_face_id = right_face_id = DEFAULT_FACE_ID; | ||
| 794 | |||
| 795 | /* Decide which bitmap to draw in the left fringe. */ | ||
| 796 | if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0) | ||
| 797 | left = NO_FRINGE_BITMAP; | ||
| 798 | else if (row->left_user_fringe_bitmap != NO_FRINGE_BITMAP) | ||
| 799 | { | ||
| 800 | left = row->left_user_fringe_bitmap; | ||
| 801 | left_face_id = row->left_user_fringe_face_id; | ||
| 802 | } | ||
| 803 | #if 0 /* this is now done via an overlay */ | ||
| 804 | else if (row->overlay_arrow_p) | ||
| 805 | left = OVERLAY_ARROW_BITMAP; | ||
| 806 | #endif | ||
| 807 | else if (row->indicate_bob_p && boundary_pos <= 0) | ||
| 808 | left = ((row->indicate_eob_p && boundary_pos < 0) | ||
| 809 | ? LEFT_BRACKET_BITMAP : TOP_LEFT_ANGLE_BITMAP); | ||
| 810 | else if (row->indicate_eob_p && boundary_pos < 0) | ||
| 811 | left = BOTTOM_LEFT_ANGLE_BITMAP; | ||
| 812 | else if (row->truncated_on_left_p) | ||
| 813 | left = LEFT_TRUNCATION_BITMAP; | ||
| 814 | else if (MATRIX_ROW_CONTINUATION_LINE_P (row)) | ||
| 815 | left = CONTINUATION_LINE_BITMAP; | ||
| 816 | else if (row->indicate_empty_line_p && empty_pos <= 0) | ||
| 817 | left = ZV_LINE_BITMAP; | ||
| 818 | else if (row->indicate_top_line_p && arrow_pos <= 0) | ||
| 819 | left = UP_ARROW_BITMAP; | ||
| 820 | else if (row->indicate_bottom_line_p && arrow_pos < 0) | ||
| 821 | left = DOWN_ARROW_BITMAP; | ||
| 822 | else | ||
| 823 | left = NO_FRINGE_BITMAP; | ||
| 824 | |||
| 825 | /* Decide which bitmap to draw in the right fringe. */ | ||
| 826 | if (WINDOW_RIGHT_FRINGE_WIDTH (w) == 0) | ||
| 827 | right = NO_FRINGE_BITMAP; | ||
| 828 | else if (row->right_user_fringe_bitmap != NO_FRINGE_BITMAP) | ||
| 829 | { | ||
| 830 | right = row->right_user_fringe_bitmap; | ||
| 831 | right_face_id = row->right_user_fringe_face_id; | ||
| 832 | } | ||
| 833 | else if (row->indicate_bob_p && boundary_pos > 0) | ||
| 834 | right = ((row->indicate_eob_p && boundary_pos >= 0) | ||
| 835 | ? RIGHT_BRACKET_BITMAP : TOP_RIGHT_ANGLE_BITMAP); | ||
| 836 | else if (row->indicate_eob_p && boundary_pos >= 0) | ||
| 837 | right = BOTTOM_RIGHT_ANGLE_BITMAP; | ||
| 838 | else if (row->truncated_on_right_p) | ||
| 839 | right = RIGHT_TRUNCATION_BITMAP; | ||
| 840 | else if (row->continued_p) | ||
| 841 | right = CONTINUED_LINE_BITMAP; | ||
| 842 | else if (row->indicate_top_line_p && arrow_pos > 0) | ||
| 843 | right = UP_ARROW_BITMAP; | ||
| 844 | else if (row->indicate_bottom_line_p && arrow_pos >= 0) | ||
| 845 | right = DOWN_ARROW_BITMAP; | ||
| 846 | else if (row->indicate_empty_line_p | ||
| 847 | && (empty_pos > 0 | ||
| 848 | || (WINDOW_LEFT_FRINGE_WIDTH (w) == 0 && empty_pos == 0))) | ||
| 849 | right = ZV_LINE_BITMAP; | ||
| 850 | else | ||
| 851 | right = NO_FRINGE_BITMAP; | ||
| 852 | |||
| 853 | if (force_p | ||
| 854 | || row->y != cur->y | ||
| 855 | || row->visible_height != cur->visible_height | ||
| 856 | || left != cur->left_fringe_bitmap | ||
| 857 | || right != cur->right_fringe_bitmap | ||
| 858 | || left_face_id != cur->left_fringe_face_id | ||
| 859 | || right_face_id != cur->right_fringe_face_id | ||
| 860 | || cur->redraw_fringe_bitmaps_p) | ||
| 861 | { | ||
| 862 | redraw_p = row->redraw_fringe_bitmaps_p = cur->redraw_fringe_bitmaps_p = 1; | ||
| 863 | cur->left_fringe_bitmap = left; | ||
| 864 | cur->right_fringe_bitmap = right; | ||
| 865 | cur->left_fringe_face_id = left_face_id; | ||
| 866 | cur->right_fringe_face_id = right_face_id; | ||
| 867 | } | ||
| 868 | |||
| 869 | if (row->overlay_arrow_p != cur->overlay_arrow_p) | ||
| 870 | { | ||
| 871 | redraw_p = row->redraw_fringe_bitmaps_p = cur->redraw_fringe_bitmaps_p = 1; | ||
| 872 | cur->overlay_arrow_p = row->overlay_arrow_p; | ||
| 873 | } | ||
| 874 | |||
| 875 | row->left_fringe_bitmap = left; | ||
| 876 | row->right_fringe_bitmap = right; | ||
| 877 | row->left_fringe_face_id = left_face_id; | ||
| 878 | row->right_fringe_face_id = right_face_id; | ||
| 879 | } | ||
| 880 | |||
| 881 | return redraw_p; | ||
| 882 | } | ||
| 883 | |||
| 884 | |||
| 885 | /* Compute actual fringe widths for frame F. | ||
| 886 | |||
| 887 | If REDRAW is 1, redraw F if the fringe settings was actually | ||
| 888 | modified and F is visible. | ||
| 889 | |||
| 890 | Since the combined left and right fringe must occupy an integral | ||
| 891 | number of columns, we may need to add some pixels to each fringe. | ||
| 892 | Typically, we add an equal amount (+/- 1 pixel) to each fringe, | ||
| 893 | but a negative width value is taken literally (after negating it). | ||
| 894 | |||
| 895 | We never make the fringes narrower than specified. It is planned | ||
| 896 | to make fringe bitmaps customizable and expandable, and at that | ||
| 897 | time, the user will typically specify the minimum number of pixels | ||
| 898 | needed for his bitmaps, so we shouldn't select anything less than | ||
| 899 | what is specified. | ||
| 900 | */ | ||
| 901 | |||
| 902 | void | ||
| 903 | compute_fringe_widths (f, redraw) | ||
| 904 | struct frame *f; | ||
| 905 | int redraw; | ||
| 906 | { | ||
| 907 | int o_left = FRAME_LEFT_FRINGE_WIDTH (f); | ||
| 908 | int o_right = FRAME_RIGHT_FRINGE_WIDTH (f); | ||
| 909 | int o_cols = FRAME_FRINGE_COLS (f); | ||
| 910 | |||
| 911 | Lisp_Object left_fringe = Fassq (Qleft_fringe, f->param_alist); | ||
| 912 | Lisp_Object right_fringe = Fassq (Qright_fringe, f->param_alist); | ||
| 913 | int left_fringe_width, right_fringe_width; | ||
| 914 | |||
| 915 | if (!NILP (left_fringe)) | ||
| 916 | left_fringe = Fcdr (left_fringe); | ||
| 917 | if (!NILP (right_fringe)) | ||
| 918 | right_fringe = Fcdr (right_fringe); | ||
| 919 | |||
| 920 | left_fringe_width = ((NILP (left_fringe) || !INTEGERP (left_fringe)) ? 8 : | ||
| 921 | XINT (left_fringe)); | ||
| 922 | right_fringe_width = ((NILP (right_fringe) || !INTEGERP (right_fringe)) ? 8 : | ||
| 923 | XINT (right_fringe)); | ||
| 924 | |||
| 925 | if (left_fringe_width || right_fringe_width) | ||
| 926 | { | ||
| 927 | int left_wid = left_fringe_width >= 0 ? left_fringe_width : -left_fringe_width; | ||
| 928 | int right_wid = right_fringe_width >= 0 ? right_fringe_width : -right_fringe_width; | ||
| 929 | int conf_wid = left_wid + right_wid; | ||
| 930 | int font_wid = FRAME_COLUMN_WIDTH (f); | ||
| 931 | int cols = (left_wid + right_wid + font_wid-1) / font_wid; | ||
| 932 | int real_wid = cols * font_wid; | ||
| 933 | if (left_wid && right_wid) | ||
| 934 | { | ||
| 935 | if (left_fringe_width < 0) | ||
| 936 | { | ||
| 937 | /* Left fringe width is fixed, adjust right fringe if necessary */ | ||
| 938 | FRAME_LEFT_FRINGE_WIDTH (f) = left_wid; | ||
| 939 | FRAME_RIGHT_FRINGE_WIDTH (f) = real_wid - left_wid; | ||
| 940 | } | ||
| 941 | else if (right_fringe_width < 0) | ||
| 942 | { | ||
| 943 | /* Right fringe width is fixed, adjust left fringe if necessary */ | ||
| 944 | FRAME_LEFT_FRINGE_WIDTH (f) = real_wid - right_wid; | ||
| 945 | FRAME_RIGHT_FRINGE_WIDTH (f) = right_wid; | ||
| 946 | } | ||
| 947 | else | ||
| 948 | { | ||
| 949 | /* Adjust both fringes with an equal amount. | ||
| 950 | Note that we are doing integer arithmetic here, so don't | ||
| 951 | lose a pixel if the total width is an odd number. */ | ||
| 952 | int fill = real_wid - conf_wid; | ||
| 953 | FRAME_LEFT_FRINGE_WIDTH (f) = left_wid + fill/2; | ||
| 954 | FRAME_RIGHT_FRINGE_WIDTH (f) = right_wid + fill - fill/2; | ||
| 955 | } | ||
| 956 | } | ||
| 957 | else if (left_fringe_width) | ||
| 958 | { | ||
| 959 | FRAME_LEFT_FRINGE_WIDTH (f) = real_wid; | ||
| 960 | FRAME_RIGHT_FRINGE_WIDTH (f) = 0; | ||
| 961 | } | ||
| 962 | else | ||
| 963 | { | ||
| 964 | FRAME_LEFT_FRINGE_WIDTH (f) = 0; | ||
| 965 | FRAME_RIGHT_FRINGE_WIDTH (f) = real_wid; | ||
| 966 | } | ||
| 967 | FRAME_FRINGE_COLS (f) = cols; | ||
| 968 | } | ||
| 969 | else | ||
| 970 | { | ||
| 971 | FRAME_LEFT_FRINGE_WIDTH (f) = 0; | ||
| 972 | FRAME_RIGHT_FRINGE_WIDTH (f) = 0; | ||
| 973 | FRAME_FRINGE_COLS (f) = 0; | ||
| 974 | } | ||
| 975 | |||
| 976 | if (redraw && FRAME_VISIBLE_P (f)) | ||
| 977 | if (o_left != FRAME_LEFT_FRINGE_WIDTH (f) || | ||
| 978 | o_right != FRAME_RIGHT_FRINGE_WIDTH (f) || | ||
| 979 | o_cols != FRAME_FRINGE_COLS (f)) | ||
| 980 | redraw_frame (f); | ||
| 981 | } | ||
| 982 | |||
| 983 | DEFUN ("destroy-fringe-bitmap", Fdestroy_fringe_bitmap, Sdestroy_fringe_bitmap, | ||
| 984 | 1, 1, 0, | ||
| 985 | doc: /* Destroy fringe bitmap WHICH. | ||
| 986 | If WHICH overrides a standard fringe bitmap, the original bitmap is restored. */) | ||
| 987 | (which) | ||
| 988 | Lisp_Object which; | ||
| 989 | { | ||
| 990 | int n; | ||
| 991 | struct fringe_bitmap **fbp; | ||
| 992 | |||
| 993 | CHECK_NUMBER (which); | ||
| 994 | if (n = XINT (which), n >= max_used_fringe_bitmap) | ||
| 995 | return Qnil; | ||
| 996 | |||
| 997 | fringe_faces[n] = FRINGE_FACE_ID; | ||
| 998 | |||
| 999 | fbp = &fringe_bitmaps[n]; | ||
| 1000 | if (*fbp && (*fbp)->dynamic) | ||
| 1001 | { | ||
| 1002 | /* XXX Is SELECTED_FRAME OK here? */ | ||
| 1003 | if (FRAME_RIF (SELECTED_FRAME ())->destroy_fringe_bitmap) | ||
| 1004 | FRAME_RIF (SELECTED_FRAME ())->destroy_fringe_bitmap (n); | ||
| 1005 | xfree (*fbp); | ||
| 1006 | *fbp = NULL; | ||
| 1007 | } | ||
| 1008 | |||
| 1009 | while (max_used_fringe_bitmap > MAX_STANDARD_FRINGE_BITMAPS | ||
| 1010 | && fringe_bitmaps[max_used_fringe_bitmap - 1] == NULL) | ||
| 1011 | max_used_fringe_bitmap--; | ||
| 1012 | |||
| 1013 | return Qnil; | ||
| 1014 | } | ||
| 1015 | |||
| 1016 | |||
| 1017 | /* Initialize bitmap bit. | ||
| 1018 | |||
| 1019 | On X, we bit-swap the built-in bitmaps and reduce bitmap | ||
| 1020 | from short to char array if width is <= 8 bits. | ||
| 1021 | |||
| 1022 | On MAC with big-endian CPU, we need to byte-swap each short. | ||
| 1023 | |||
| 1024 | On W32 and MAC (little endian), there's no need to do this. | ||
| 1025 | */ | ||
| 1026 | |||
| 1027 | void | ||
| 1028 | init_fringe_bitmap (which, fb, once_p) | ||
| 1029 | enum fringe_bitmap_type which; | ||
| 1030 | struct fringe_bitmap *fb; | ||
| 1031 | int once_p; | ||
| 1032 | { | ||
| 1033 | if (once_p || fb->dynamic) | ||
| 1034 | { | ||
| 1035 | #if defined (HAVE_X_WINDOWS) | ||
| 1036 | static unsigned char swap_nibble[16] | ||
| 1037 | = { 0x0, 0x8, 0x4, 0xc, /* 0000 1000 0100 1100 */ | ||
| 1038 | 0x2, 0xa, 0x6, 0xe, /* 0010 1010 0110 1110 */ | ||
| 1039 | 0x1, 0x9, 0x5, 0xd, /* 0001 1001 0101 1101 */ | ||
| 1040 | 0x3, 0xb, 0x7, 0xf }; /* 0011 1011 0111 1111 */ | ||
| 1041 | unsigned short *bits = fb->bits; | ||
| 1042 | int j; | ||
| 1043 | |||
| 1044 | if (fb->width <= 8) | ||
| 1045 | { | ||
| 1046 | unsigned char *cbits = (unsigned char *)fb->bits; | ||
| 1047 | for (j = 0; j < fb->height; j++) | ||
| 1048 | { | ||
| 1049 | unsigned short b = *bits++; | ||
| 1050 | unsigned char c; | ||
| 1051 | c = (unsigned char)((swap_nibble[b & 0xf] << 4) | ||
| 1052 | | (swap_nibble[(b>>4) & 0xf])); | ||
| 1053 | *cbits++ = (c >> (8 - fb->width)); | ||
| 1054 | } | ||
| 1055 | } | ||
| 1056 | else | ||
| 1057 | { | ||
| 1058 | for (j = 0; j < fb->height; j++) | ||
| 1059 | { | ||
| 1060 | unsigned short b = *bits; | ||
| 1061 | b = (unsigned short)((swap_nibble[b & 0xf] << 12) | ||
| 1062 | | (swap_nibble[(b>>4) & 0xf] << 8) | ||
| 1063 | | (swap_nibble[(b>>8) & 0xf] << 4) | ||
| 1064 | | (swap_nibble[(b>>12) & 0xf])); | ||
| 1065 | *bits++ = (b >> (16 - fb->width)); | ||
| 1066 | } | ||
| 1067 | } | ||
| 1068 | #endif /* HAVE_X_WINDOWS */ | ||
| 1069 | |||
| 1070 | #if defined (MAC_OS) && defined (WORDS_BIG_ENDIAN) | ||
| 1071 | unsigned short *bits = fb->bits; | ||
| 1072 | int j; | ||
| 1073 | for (j = 0; j < fb->height; j++) | ||
| 1074 | { | ||
| 1075 | unsigned short b = *bits; | ||
| 1076 | *bits++ = ((b >> 8) & 0xff) | ((b & 0xff) << 8); | ||
| 1077 | } | ||
| 1078 | #endif /* MAC_OS && WORDS_BIG_ENDIAN */ | ||
| 1079 | } | ||
| 1080 | |||
| 1081 | if (!once_p) | ||
| 1082 | { | ||
| 1083 | Fdestroy_fringe_bitmap (make_number (which)); | ||
| 1084 | |||
| 1085 | /* XXX Is SELECTED_FRAME OK here? */ | ||
| 1086 | if (FRAME_RIF (SELECTED_FRAME ())->define_fringe_bitmap) | ||
| 1087 | FRAME_RIF (SELECTED_FRAME ())->define_fringe_bitmap (which, fb->bits, fb->height, fb->width); | ||
| 1088 | |||
| 1089 | fringe_bitmaps[which] = fb; | ||
| 1090 | if (which >= max_used_fringe_bitmap) | ||
| 1091 | max_used_fringe_bitmap = which + 1; | ||
| 1092 | } | ||
| 1093 | } | ||
| 1094 | |||
| 1095 | |||
| 1096 | DEFUN ("define-fringe-bitmap", Fdefine_fringe_bitmap, Sdefine_fringe_bitmap, | ||
| 1097 | 1, 5, 0, | ||
| 1098 | doc: /* Define a fringe bitmap from BITS of height HEIGHT and width WIDTH. | ||
| 1099 | BITS is either a string or a vector of integers. | ||
| 1100 | HEIGHT is height of bitmap. If HEIGHT is nil, use length of BITS. | ||
| 1101 | WIDTH must be an integer between 1 and 16, or nil which defaults to 8. | ||
| 1102 | Optional forth arg ALIGN may be one of `top', `center', or `bottom', | ||
| 1103 | indicating the positioning of the bitmap relative to the rows where it | ||
| 1104 | is used; the default is to center the bitmap. Fourth arg may also be a | ||
| 1105 | list (ALIGN PERIODIC) where PERIODIC non-nil specifies that the bitmap | ||
| 1106 | should be repeated. | ||
| 1107 | Optional fifth argument WHICH is bitmap number to redefine. | ||
| 1108 | Return new bitmap number, or nil of no more free bitmap slots. */) | ||
| 1109 | (bits, height, width, align, which) | ||
| 1110 | Lisp_Object bits, height, width, align, which; | ||
| 1111 | { | ||
| 1112 | Lisp_Object len; | ||
| 1113 | int n, h, i, j; | ||
| 1114 | unsigned short *b; | ||
| 1115 | struct fringe_bitmap fb, *xfb; | ||
| 1116 | int fill1 = 0, fill2 = 0; | ||
| 1117 | |||
| 1118 | if (!STRINGP (bits) && !VECTORP (bits)) | ||
| 1119 | bits = wrong_type_argument (Qstringp, bits); | ||
| 1120 | |||
| 1121 | len = Flength (bits); | ||
| 1122 | |||
| 1123 | if (NILP (height)) | ||
| 1124 | h = fb.height = XINT (len); | ||
| 1125 | else | ||
| 1126 | { | ||
| 1127 | CHECK_NUMBER (height); | ||
| 1128 | fb.height = min (XINT (height), 255); | ||
| 1129 | if (fb.height > XINT (len)) | ||
| 1130 | { | ||
| 1131 | h = XINT (len); | ||
| 1132 | fill1 = (fb.height - h) / 2; | ||
| 1133 | fill2 = fb.height - h - fill1; | ||
| 1134 | } | ||
| 1135 | } | ||
| 1136 | |||
| 1137 | if (NILP (width)) | ||
| 1138 | fb.width = 8; | ||
| 1139 | else | ||
| 1140 | { | ||
| 1141 | CHECK_NUMBER (width); | ||
| 1142 | fb.width = min (XINT (width), 255); | ||
| 1143 | } | ||
| 1144 | |||
| 1145 | fb.period = 0; | ||
| 1146 | fb.align = ALIGN_BITMAP_CENTER; | ||
| 1147 | |||
| 1148 | if (CONSP (align)) | ||
| 1149 | { | ||
| 1150 | Lisp_Object period = XCDR (align); | ||
| 1151 | if (CONSP (period)) | ||
| 1152 | { | ||
| 1153 | period = XCAR (period); | ||
| 1154 | if (!NILP (period)) | ||
| 1155 | { | ||
| 1156 | fb.period = fb.height; | ||
| 1157 | fb.height = 255; | ||
| 1158 | } | ||
| 1159 | } | ||
| 1160 | align = XCAR (align); | ||
| 1161 | } | ||
| 1162 | if (EQ (align, Qtop)) | ||
| 1163 | fb.align = ALIGN_BITMAP_TOP; | ||
| 1164 | else if (EQ (align, Qbottom)) | ||
| 1165 | fb.align = ALIGN_BITMAP_BOTTOM; | ||
| 1166 | else if (!NILP (align) && !EQ (align, Qcenter)) | ||
| 1167 | error ("Bad align argument"); | ||
| 1168 | |||
| 1169 | if (NILP (which)) | ||
| 1170 | { | ||
| 1171 | if (max_used_fringe_bitmap < MAX_FRINGE_BITMAPS) | ||
| 1172 | n = max_used_fringe_bitmap++; | ||
| 1173 | else | ||
| 1174 | { | ||
| 1175 | for (n = MAX_STANDARD_FRINGE_BITMAPS; | ||
| 1176 | n < MAX_FRINGE_BITMAPS; | ||
| 1177 | n++) | ||
| 1178 | if (fringe_bitmaps[n] == NULL) | ||
| 1179 | break; | ||
| 1180 | if (n == MAX_FRINGE_BITMAPS) | ||
| 1181 | return Qnil; | ||
| 1182 | } | ||
| 1183 | which = make_number (n); | ||
| 1184 | } | ||
| 1185 | else | ||
| 1186 | { | ||
| 1187 | CHECK_NUMBER (which); | ||
| 1188 | n = XINT (which); | ||
| 1189 | if (n <= NO_FRINGE_BITMAP || n >= MAX_FRINGE_BITMAPS) | ||
| 1190 | error ("Invalid fringe bitmap number"); | ||
| 1191 | } | ||
| 1192 | |||
| 1193 | fb.dynamic = 1; | ||
| 1194 | |||
| 1195 | xfb = (struct fringe_bitmap *)xmalloc (sizeof fb | ||
| 1196 | + fb.height * BYTES_PER_BITMAP_ROW); | ||
| 1197 | fb.bits = b = (unsigned short *)(xfb+1); | ||
| 1198 | bzero (b, fb.height); | ||
| 1199 | |||
| 1200 | j = 0; | ||
| 1201 | while (j < fb.height) | ||
| 1202 | { | ||
| 1203 | for (i = 0; i < fill1 && j < fb.height; i++) | ||
| 1204 | b[j++] = 0; | ||
| 1205 | for (i = 0; i < h && j < fb.height; i++) | ||
| 1206 | { | ||
| 1207 | Lisp_Object elt = Faref (bits, make_number (i)); | ||
| 1208 | b[j++] = NUMBERP (elt) ? XINT (elt) : 0; | ||
| 1209 | } | ||
| 1210 | for (i = 0; i < fill2 && j < fb.height; i++) | ||
| 1211 | b[j++] = 0; | ||
| 1212 | } | ||
| 1213 | |||
| 1214 | *xfb = fb; | ||
| 1215 | |||
| 1216 | init_fringe_bitmap (n, xfb, 0); | ||
| 1217 | |||
| 1218 | return which; | ||
| 1219 | } | ||
| 1220 | |||
| 1221 | DEFUN ("set-fringe-bitmap-face", Fset_fringe_bitmap_face, Sset_fringe_bitmap_face, | ||
| 1222 | 1, 2, 0, | ||
| 1223 | doc: /* Set face for fringe bitmap FRINGE-ID to FACE. | ||
| 1224 | If FACE is nil, reset face to default fringe face. */) | ||
| 1225 | (fringe_id, face) | ||
| 1226 | Lisp_Object fringe_id, face; | ||
| 1227 | { | ||
| 1228 | int face_id; | ||
| 1229 | |||
| 1230 | CHECK_NUMBER (fringe_id); | ||
| 1231 | if (!valid_fringe_bitmap_id_p (XINT (fringe_id))) | ||
| 1232 | error ("Invalid fringe id"); | ||
| 1233 | |||
| 1234 | if (!NILP (face)) | ||
| 1235 | { | ||
| 1236 | face_id = lookup_named_face (SELECTED_FRAME (), face, 'A'); | ||
| 1237 | if (face_id < 0) | ||
| 1238 | error ("No such face"); | ||
| 1239 | } | ||
| 1240 | else | ||
| 1241 | face_id = FRINGE_FACE_ID; | ||
| 1242 | |||
| 1243 | fringe_faces [XINT (fringe_id)] = face_id; | ||
| 1244 | |||
| 1245 | return Qnil; | ||
| 1246 | } | ||
| 1247 | |||
| 1248 | DEFUN ("fringe-bitmaps-at-pos", Ffringe_bitmaps_at_pos, Sfringe_bitmaps_at_pos, | ||
| 1249 | 0, 2, 0, | ||
| 1250 | doc: /* Return fringe bitmaps of row containing position POS in window WINDOW. | ||
| 1251 | If WINDOW is nil, use selected window. If POS is nil, use value of point | ||
| 1252 | in that window. Return value is a cons (LEFT . RIGHT) where LEFT and RIGHT | ||
| 1253 | are the fringe bitmap numbers for the bitmaps in the left and right fringe, | ||
| 1254 | resp. Return nil if POS is not visible in WINDOW. */) | ||
| 1255 | (pos, window) | ||
| 1256 | Lisp_Object pos, window; | ||
| 1257 | { | ||
| 1258 | struct window *w; | ||
| 1259 | struct buffer *old_buffer = NULL; | ||
| 1260 | struct glyph_row *row; | ||
| 1261 | int textpos; | ||
| 1262 | |||
| 1263 | if (NILP (window)) | ||
| 1264 | window = selected_window; | ||
| 1265 | CHECK_WINDOW (window); | ||
| 1266 | w = XWINDOW (window); | ||
| 1267 | |||
| 1268 | if (!NILP (pos)) | ||
| 1269 | { | ||
| 1270 | CHECK_NUMBER_COERCE_MARKER (pos); | ||
| 1271 | textpos = XINT (pos); | ||
| 1272 | } | ||
| 1273 | else if (w == XWINDOW (selected_window)) | ||
| 1274 | textpos = PT; | ||
| 1275 | else | ||
| 1276 | textpos = XMARKER (w->pointm)->charpos; | ||
| 1277 | |||
| 1278 | row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | ||
| 1279 | row = row_containing_pos (w, textpos, row, NULL, 0); | ||
| 1280 | if (row) | ||
| 1281 | return Fcons (make_number (row->left_fringe_bitmap), | ||
| 1282 | make_number (row->right_fringe_bitmap)); | ||
| 1283 | else | ||
| 1284 | return Qnil; | ||
| 1285 | } | ||
| 1286 | |||
| 1287 | |||
| 1288 | /*********************************************************************** | ||
| 1289 | Initialization | ||
| 1290 | ***********************************************************************/ | ||
| 1291 | |||
| 1292 | void | ||
| 1293 | syms_of_fringe () | ||
| 1294 | { | ||
| 1295 | |||
| 1296 | defsubr (&Sdestroy_fringe_bitmap); | ||
| 1297 | defsubr (&Sdefine_fringe_bitmap); | ||
| 1298 | defsubr (&Sfringe_bitmaps_at_pos); | ||
| 1299 | defsubr (&Sset_fringe_bitmap_face); | ||
| 1300 | |||
| 1301 | DEFVAR_LISP ("overflow-newline-into-fringe", &Voverflow_newline_into_fringe, | ||
| 1302 | doc: /* *Non-nil means that newline may flow into the right fringe. | ||
| 1303 | This means that display lines which are exactly as wide as the window | ||
| 1304 | (not counting the final newline) will only occupy one screen line, by | ||
| 1305 | showing (or hiding) the final newline in the right fringe; when point | ||
| 1306 | is at the final newline, the cursor is shown in the right fringe. | ||
| 1307 | If nil, also continue lines which are exactly as wide as the window. */); | ||
| 1308 | Voverflow_newline_into_fringe = Qt; | ||
| 1309 | |||
| 1310 | } | ||
| 1311 | |||
| 1312 | /* Initialize this module when Emacs starts. */ | ||
| 1313 | |||
| 1314 | void | ||
| 1315 | init_fringe_once () | ||
| 1316 | { | ||
| 1317 | enum fringe_bitmap_type bt; | ||
| 1318 | |||
| 1319 | for (bt = NO_FRINGE_BITMAP + 1; bt < MAX_STANDARD_FRINGE_BITMAPS; bt++) | ||
| 1320 | init_fringe_bitmap(bt, &standard_bitmaps[bt], 1); | ||
| 1321 | } | ||
| 1322 | |||
| 1323 | void | ||
| 1324 | init_fringe () | ||
| 1325 | { | ||
| 1326 | int i; | ||
| 1327 | |||
| 1328 | bzero (fringe_bitmaps, sizeof fringe_bitmaps); | ||
| 1329 | for (i = 0; i < MAX_FRINGE_BITMAPS; i++) | ||
| 1330 | fringe_faces[i] = FRINGE_FACE_ID; | ||
| 1331 | } | ||
| 1332 | |||
| 1333 | #ifdef HAVE_NTGUI | ||
| 1334 | |||
| 1335 | void | ||
| 1336 | w32_init_fringe () | ||
| 1337 | { | ||
| 1338 | enum fringe_bitmap_type bt; | ||
| 1339 | |||
| 1340 | for (bt = NO_FRINGE_BITMAP + 1; bt < MAX_STANDARD_FRINGE_BITMAPS; bt++) | ||
| 1341 | { | ||
| 1342 | struct fringe_bitmap *fb = &standard_bitmaps[bt]; | ||
| 1343 | rif->define_fringe_bitmap (bt, fb->bits, fb->height, fb->width); | ||
| 1344 | } | ||
| 1345 | } | ||
| 1346 | |||
| 1347 | void | ||
| 1348 | w32_reset_fringes () | ||
| 1349 | { | ||
| 1350 | /* Destroy row bitmaps. */ | ||
| 1351 | int bt; | ||
| 1352 | |||
| 1353 | for (bt = NO_FRINGE_BITMAP + 1; bt < max_used_fringe_bitmap; bt++) | ||
| 1354 | rif->destroy_fringe_bitmap (bt); | ||
| 1355 | } | ||
| 1356 | |||
| 1357 | #endif /* HAVE_NTGUI */ | ||
| 1358 | |||
| 1359 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 1360 | |||
| 1361 | /* arch-tag: 04596920-43eb-473d-b319-82712338162d | ||
| 1362 | (do not change this comment) */ | ||
diff --git a/src/keyboard.c b/src/keyboard.c index 11e1d18c7d5..8223049d79d 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -1322,6 +1322,7 @@ cancel_hourglass_unwind (arg) | |||
| 1322 | Lisp_Object arg; | 1322 | Lisp_Object arg; |
| 1323 | { | 1323 | { |
| 1324 | cancel_hourglass (); | 1324 | cancel_hourglass (); |
| 1325 | return Qnil; | ||
| 1325 | } | 1326 | } |
| 1326 | #endif | 1327 | #endif |
| 1327 | 1328 | ||
diff --git a/src/keymap.c b/src/keymap.c index d03c84aa69d..4cea62c10fb 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Manipulation of keymaps | 1 | /* Manipulation of keymaps |
| 2 | Copyright (C) 1985, 86,87,88,93,94,95,98,99, 2000, 2001 | 2 | Copyright (C) 1985, 86,87,88,93,94,95,98,99, 2000, 01, 2004 |
| 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. |
| @@ -2321,7 +2321,7 @@ shadow_lookup (shadow, key, flag) | |||
| 2321 | return Qnil; | 2321 | return Qnil; |
| 2322 | } | 2322 | } |
| 2323 | 2323 | ||
| 2324 | static Lisp_Object Vmenu_events; | 2324 | static Lisp_Object Vmouse_events; |
| 2325 | 2325 | ||
| 2326 | /* This function can GC if Flookup_key autoloads any keymaps. */ | 2326 | /* This function can GC if Flookup_key autoloads any keymaps. */ |
| 2327 | 2327 | ||
| @@ -2378,7 +2378,7 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap) | |||
| 2378 | /* if (nomenus && !ascii_sequence_p (this)) */ | 2378 | /* if (nomenus && !ascii_sequence_p (this)) */ |
| 2379 | if (nomenus && XINT (last) >= 0 | 2379 | if (nomenus && XINT (last) >= 0 |
| 2380 | && SYMBOLP (tem = Faref (this, make_number (0))) | 2380 | && SYMBOLP (tem = Faref (this, make_number (0))) |
| 2381 | && !NILP (Fmemq (XCAR (parse_modifiers (tem)), Vmenu_events))) | 2381 | && !NILP (Fmemq (XCAR (parse_modifiers (tem)), Vmouse_events))) |
| 2382 | /* If no menu entries should be returned, skip over the | 2382 | /* If no menu entries should be returned, skip over the |
| 2383 | keymaps bound to `menu-bar' and `tool-bar' and other | 2383 | keymaps bound to `menu-bar' and `tool-bar' and other |
| 2384 | non-ascii prefixes like `C-down-mouse-2'. */ | 2384 | non-ascii prefixes like `C-down-mouse-2'. */ |
| @@ -3710,13 +3710,17 @@ This keymap works like `function-key-map', but comes after that, | |||
| 3710 | and applies even for keys that have ordinary bindings. */); | 3710 | and applies even for keys that have ordinary bindings. */); |
| 3711 | Vkey_translation_map = Qnil; | 3711 | Vkey_translation_map = Qnil; |
| 3712 | 3712 | ||
| 3713 | staticpro (&Vmenu_events); | 3713 | staticpro (&Vmouse_events); |
| 3714 | Vmenu_events = Fcons (intern ("menu-bar"), | 3714 | Vmouse_events = Fcons (intern ("menu-bar"), |
| 3715 | Fcons (intern ("tool-bar"), | 3715 | Fcons (intern ("tool-bar"), |
| 3716 | Fcons (intern ("mouse-1"), | 3716 | Fcons (intern ("header-line"), |
| 3717 | Fcons (intern ("mouse-2"), | 3717 | Fcons (intern ("mode-line"), |
| 3718 | Fcons (intern ("mouse-3"), | 3718 | Fcons (intern ("mouse-1"), |
| 3719 | Qnil))))); | 3719 | Fcons (intern ("mouse-2"), |
| 3720 | Fcons (intern ("mouse-3"), | ||
| 3721 | Fcons (intern ("mouse-4"), | ||
| 3722 | Fcons (intern ("mouse-5"), | ||
| 3723 | Qnil))))))))); | ||
| 3720 | 3724 | ||
| 3721 | 3725 | ||
| 3722 | Qsingle_key_description = intern ("single-key-description"); | 3726 | Qsingle_key_description = intern ("single-key-description"); |
diff --git a/src/lisp.h b/src/lisp.h index 570d5ff9757..a0bc2af24bb 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -2301,6 +2301,11 @@ EXFUN (Ftruncate, 2); | |||
| 2301 | extern void init_floatfns P_ ((void)); | 2301 | extern void init_floatfns P_ ((void)); |
| 2302 | extern void syms_of_floatfns P_ ((void)); | 2302 | extern void syms_of_floatfns P_ ((void)); |
| 2303 | 2303 | ||
| 2304 | /* Defined in fringe.c */ | ||
| 2305 | extern void syms_of_fringe P_ ((void)); | ||
| 2306 | extern void init_fringe P_ ((void)); | ||
| 2307 | extern void init_fringe_once P_ ((void)); | ||
| 2308 | |||
| 2304 | /* Defined in insdel.c */ | 2309 | /* Defined in insdel.c */ |
| 2305 | extern Lisp_Object Qinhibit_modification_hooks; | 2310 | extern Lisp_Object Qinhibit_modification_hooks; |
| 2306 | extern void move_gap P_ ((int)); | 2311 | extern void move_gap P_ ((int)); |
diff --git a/src/macfns.c b/src/macfns.c index 0f87556fb1e..a01811048fe 100644 --- a/src/macfns.c +++ b/src/macfns.c | |||
| @@ -7792,12 +7792,25 @@ x_kill_gs_process (pixmap, f) | |||
| 7792 | ***********************************************************************/ | 7792 | ***********************************************************************/ |
| 7793 | 7793 | ||
| 7794 | DEFUN ("x-change-window-property", Fx_change_window_property, | 7794 | DEFUN ("x-change-window-property", Fx_change_window_property, |
| 7795 | Sx_change_window_property, 2, 3, 0, | 7795 | Sx_change_window_property, 2, 6, 0, |
| 7796 | doc: /* Change window property PROP to VALUE on the X window of FRAME. | 7796 | doc: /* Change window property PROP to VALUE on the X window of FRAME. |
| 7797 | PROP and VALUE must be strings. FRAME nil or omitted means use the | 7797 | VALUE may be a string or a list of conses, numbers and/or strings. |
| 7798 | selected frame. Value is VALUE. */) | 7798 | If an element in the list is a string, it is converted to |
| 7799 | (prop, value, frame) | 7799 | an Atom and the value of the Atom is used. If an element is a cons, |
| 7800 | Lisp_Object frame, prop, value; | 7800 | it is converted to a 32 bit number where the car is the 16 top bits and the |
| 7801 | cdr is the lower 16 bits. | ||
| 7802 | FRAME nil or omitted means use the selected frame. | ||
| 7803 | If TYPE is given and non-nil, it is the name of the type of VALUE. | ||
| 7804 | If TYPE is not given or nil, the type is STRING. | ||
| 7805 | FORMAT gives the size in bits of each element if VALUE is a list. | ||
| 7806 | It must be one of 8, 16 or 32. | ||
| 7807 | If VALUE is a string or FORMAT is nil or not given, FORMAT defaults to 8. | ||
| 7808 | If OUTER_P is non-nil, the property is changed for the outer X window of | ||
| 7809 | FRAME. Default is to change on the edit X window. | ||
| 7810 | |||
| 7811 | Value is VALUE. */) | ||
| 7812 | (prop, value, frame, type, format, outer_p) | ||
| 7813 | Lisp_Object prop, value, frame, type, format, outer_p; | ||
| 7801 | { | 7814 | { |
| 7802 | #if 0 /* MAC_TODO : port window properties to Mac */ | 7815 | #if 0 /* MAC_TODO : port window properties to Mac */ |
| 7803 | struct frame *f = check_x_frame (frame); | 7816 | struct frame *f = check_x_frame (frame); |
diff --git a/src/macterm.c b/src/macterm.c index 9c7c497c00b..8bcee4a86c3 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -467,15 +467,21 @@ XClearWindow (display, w) | |||
| 467 | /* Mac replacement for XCopyArea. */ | 467 | /* Mac replacement for XCopyArea. */ |
| 468 | 468 | ||
| 469 | static void | 469 | static void |
| 470 | mac_draw_bitmap (display, w, gc, x, y, bitmap) | 470 | mac_draw_bitmap (display, w, gc, x, y, width, height, bits, overlay_p) |
| 471 | Display *display; | 471 | Display *display; |
| 472 | WindowPtr w; | 472 | WindowPtr w; |
| 473 | GC gc; | 473 | GC gc; |
| 474 | int x, y; | 474 | int x, y, width, height; |
| 475 | BitMap *bitmap; | 475 | unsigned short *bits; |
| 476 | int overlay_p; | ||
| 476 | { | 477 | { |
| 478 | BitMap bitmap; | ||
| 477 | Rect r; | 479 | Rect r; |
| 478 | 480 | ||
| 481 | bitmap.rowBytes = sizeof(unsigned short); | ||
| 482 | bitmap.baseAddr = bits; | ||
| 483 | SetRect (&(bitmap.bounds), 0, 0, width, height); | ||
| 484 | |||
| 479 | #if TARGET_API_MAC_CARBON | 485 | #if TARGET_API_MAC_CARBON |
| 480 | SetPort (GetWindowPort (w)); | 486 | SetPort (GetWindowPort (w)); |
| 481 | #else | 487 | #else |
| @@ -483,7 +489,7 @@ mac_draw_bitmap (display, w, gc, x, y, bitmap) | |||
| 483 | #endif | 489 | #endif |
| 484 | 490 | ||
| 485 | mac_set_colors (gc); | 491 | mac_set_colors (gc); |
| 486 | SetRect (&r, x, y, x + bitmap->bounds.right, y + bitmap->bounds.bottom); | 492 | SetRect (&r, x, y, x + bitmap.bounds.right, y + bitmap.bounds.bottom); |
| 487 | 493 | ||
| 488 | #if TARGET_API_MAC_CARBON | 494 | #if TARGET_API_MAC_CARBON |
| 489 | { | 495 | { |
| @@ -491,11 +497,13 @@ mac_draw_bitmap (display, w, gc, x, y, bitmap) | |||
| 491 | 497 | ||
| 492 | LockPortBits (GetWindowPort (w)); | 498 | LockPortBits (GetWindowPort (w)); |
| 493 | pmh = GetPortPixMap (GetWindowPort (w)); | 499 | pmh = GetPortPixMap (GetWindowPort (w)); |
| 494 | CopyBits (bitmap, (BitMap *) *pmh, &(bitmap->bounds), &r, srcCopy, 0); | 500 | CopyBits (&bitmap, (BitMap *) *pmh, &(bitmap.bounds), &r, |
| 501 | overlay_p ? srcOr : srcCopy, 0); | ||
| 495 | UnlockPortBits (GetWindowPort (w)); | 502 | UnlockPortBits (GetWindowPort (w)); |
| 496 | } | 503 | } |
| 497 | #else /* not TARGET_API_MAC_CARBON */ | 504 | #else /* not TARGET_API_MAC_CARBON */ |
| 498 | CopyBits (bitmap, &(w->portBits), &(bitmap->bounds), &r, srcCopy, 0); | 505 | CopyBits (&bitmap, &(w->portBits), &(bitmap.bounds), &r, |
| 506 | overlay_p ? srcOr : srcCopy, 0); | ||
| 499 | #endif /* not TARGET_API_MAC_CARBON */ | 507 | #endif /* not TARGET_API_MAC_CARBON */ |
| 500 | } | 508 | } |
| 501 | 509 | ||
| @@ -1313,7 +1321,7 @@ x_draw_fringe_bitmap (w, row, p) | |||
| 1313 | else | 1321 | else |
| 1314 | x_clip_to_row (w, row, gc); | 1322 | x_clip_to_row (w, row, gc); |
| 1315 | 1323 | ||
| 1316 | if (p->bx >= 0) | 1324 | if (p->bx >= 0 && !p->overlay_p) |
| 1317 | { | 1325 | { |
| 1318 | XGCValues gcv; | 1326 | XGCValues gcv; |
| 1319 | gcv.foreground = face->background; | 1327 | gcv.foreground = face->background; |
| @@ -1339,18 +1347,18 @@ x_draw_fringe_bitmap (w, row, p) | |||
| 1339 | #endif | 1347 | #endif |
| 1340 | } | 1348 | } |
| 1341 | 1349 | ||
| 1342 | if (p->which != NO_FRINGE_BITMAP) | 1350 | if (p->which) |
| 1343 | { | 1351 | { |
| 1344 | unsigned char *bits = fringe_bitmaps[p->which].bits + p->dh; | 1352 | unsigned short *bits = p->bits + p->dh; |
| 1345 | BitMap bitmap; | ||
| 1346 | 1353 | ||
| 1347 | mac_create_bitmap_from_bitmap_data (&bitmap, bits, p->wd, p->h); | 1354 | gcv.foreground = (p->cursor_p |
| 1348 | gcv.foreground = face->foreground; | 1355 | ? (p->overlay_p ? face->background |
| 1356 | : f->output_data.mac->cursor_pixel) | ||
| 1357 | : face->foreground); | ||
| 1349 | gcv.background = face->background; | 1358 | gcv.background = face->background; |
| 1350 | 1359 | ||
| 1351 | mac_draw_bitmap (display, window, &gcv, p->x, p->y, &bitmap); | 1360 | mac_draw_bitmap (display, window, &gcv, p->x, p->y, |
| 1352 | 1361 | p->wd, p->h, bits, p->overlay_p); | |
| 1353 | mac_free_bitmap (&bitmap); | ||
| 1354 | } | 1362 | } |
| 1355 | 1363 | ||
| 1356 | mac_reset_clipping (display, window); | 1364 | mac_reset_clipping (display, window); |
| @@ -6455,12 +6463,19 @@ static long app_sleep_time = WNE_SLEEP_AT_RESUME; | |||
| 6455 | 6463 | ||
| 6456 | Boolean terminate_flag = false; | 6464 | Boolean terminate_flag = false; |
| 6457 | 6465 | ||
| 6466 | /* Contains the string "reverse", which is a constant for mouse button emu.*/ | ||
| 6467 | Lisp_Object Qreverse; | ||
| 6468 | |||
| 6458 | /* True if using command key as meta key. */ | 6469 | /* True if using command key as meta key. */ |
| 6459 | Lisp_Object Vmac_command_key_is_meta; | 6470 | Lisp_Object Vmac_command_key_is_meta; |
| 6460 | 6471 | ||
| 6461 | /* True if the ctrl and meta keys should be reversed. */ | 6472 | /* True if the ctrl and meta keys should be reversed. */ |
| 6462 | Lisp_Object Vmac_reverse_ctrl_meta; | 6473 | Lisp_Object Vmac_reverse_ctrl_meta; |
| 6463 | 6474 | ||
| 6475 | /* True if the option and command modifiers should be used to emulate | ||
| 6476 | a three button mouse */ | ||
| 6477 | Lisp_Object Vmac_emulate_three_button_mouse; | ||
| 6478 | |||
| 6464 | #if USE_CARBON_EVENTS | 6479 | #if USE_CARBON_EVENTS |
| 6465 | /* True if the mouse wheel button (i.e. button 4) should map to | 6480 | /* True if the mouse wheel button (i.e. button 4) should map to |
| 6466 | mouse-2, instead of mouse-3. */ | 6481 | mouse-2, instead of mouse-3. */ |
| @@ -6533,6 +6548,20 @@ mac_to_emacs_modifiers (EventModifiers mods) | |||
| 6533 | return result; | 6548 | return result; |
| 6534 | } | 6549 | } |
| 6535 | 6550 | ||
| 6551 | static int | ||
| 6552 | mac_get_emulated_btn ( UInt32 modifiers ) | ||
| 6553 | { | ||
| 6554 | int result = 0; | ||
| 6555 | if (Vmac_emulate_three_button_mouse != Qnil) { | ||
| 6556 | int cmdIs3 = (Vmac_emulate_three_button_mouse != Qreverse); | ||
| 6557 | if (modifiers & controlKey) | ||
| 6558 | result = cmdIs3 ? 2 : 1; | ||
| 6559 | else if (modifiers & optionKey) | ||
| 6560 | result = cmdIs3 ? 1 : 2; | ||
| 6561 | } | ||
| 6562 | return result; | ||
| 6563 | } | ||
| 6564 | |||
| 6536 | #if USE_CARBON_EVENTS | 6565 | #if USE_CARBON_EVENTS |
| 6537 | /* Obtains the event modifiers from the event ref and then calls | 6566 | /* Obtains the event modifiers from the event ref and then calls |
| 6538 | mac_to_emacs_modifiers. */ | 6567 | mac_to_emacs_modifiers. */ |
| @@ -6542,6 +6571,11 @@ mac_event_to_emacs_modifiers (EventRef eventRef) | |||
| 6542 | UInt32 mods = 0; | 6571 | UInt32 mods = 0; |
| 6543 | GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL, | 6572 | GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL, |
| 6544 | sizeof (UInt32), NULL, &mods); | 6573 | sizeof (UInt32), NULL, &mods); |
| 6574 | if (Vmac_emulate_three_button_mouse != Qnil && | ||
| 6575 | GetEventClass(eventRef) == kEventClassMouse) | ||
| 6576 | { | ||
| 6577 | mods &= ~(optionKey & cmdKey); | ||
| 6578 | } | ||
| 6545 | return mac_to_emacs_modifiers (mods); | 6579 | return mac_to_emacs_modifiers (mods); |
| 6546 | } | 6580 | } |
| 6547 | 6581 | ||
| @@ -6556,7 +6590,14 @@ mac_get_mouse_btn (EventRef ref) | |||
| 6556 | switch (result) | 6590 | switch (result) |
| 6557 | { | 6591 | { |
| 6558 | case kEventMouseButtonPrimary: | 6592 | case kEventMouseButtonPrimary: |
| 6559 | return 0; | 6593 | if (Vmac_emulate_three_button_mouse == Qnil) |
| 6594 | return 0; | ||
| 6595 | else { | ||
| 6596 | UInt32 mods = 0; | ||
| 6597 | GetEventParameter (ref, kEventParamKeyModifiers, typeUInt32, NULL, | ||
| 6598 | sizeof (UInt32), NULL, &mods); | ||
| 6599 | return mac_get_emulated_btn(mods); | ||
| 6600 | } | ||
| 6560 | case kEventMouseButtonSecondary: | 6601 | case kEventMouseButtonSecondary: |
| 6561 | return NILP (Vmac_wheel_button_is_mouse_2) ? 1 : 2; | 6602 | return NILP (Vmac_wheel_button_is_mouse_2) ? 1 : 2; |
| 6562 | case kEventMouseButtonTertiary: | 6603 | case kEventMouseButtonTertiary: |
| @@ -7692,7 +7733,7 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 7692 | #if USE_CARBON_EVENTS | 7733 | #if USE_CARBON_EVENTS |
| 7693 | bufp->code = mac_get_mouse_btn (eventRef); | 7734 | bufp->code = mac_get_mouse_btn (eventRef); |
| 7694 | #else | 7735 | #else |
| 7695 | bufp->code = 0; /* only one mouse button */ | 7736 | bufp_.code = mac_get_emulate_btn (er.modifiers); |
| 7696 | #endif | 7737 | #endif |
| 7697 | bufp->kind = SCROLL_BAR_CLICK_EVENT; | 7738 | bufp->kind = SCROLL_BAR_CLICK_EVENT; |
| 7698 | bufp->frame_or_window = tracked_scroll_bar->window; | 7739 | bufp->frame_or_window = tracked_scroll_bar->window; |
| @@ -7760,7 +7801,7 @@ XTread_socket (struct input_event *bufp, int numchars, int expected) | |||
| 7760 | #if USE_CARBON_EVENTS | 7801 | #if USE_CARBON_EVENTS |
| 7761 | bufp->code = mac_get_mouse_btn (eventRef); | 7802 | bufp->code = mac_get_mouse_btn (eventRef); |
| 7762 | #else | 7803 | #else |
| 7763 | bufp->code = 0; /* only one mouse button */ | 7804 | bufp_.code = mac_get_emulate_btn (er.modifiers); |
| 7764 | #endif | 7805 | #endif |
| 7765 | XSETINT (bufp->x, mouse_loc.h); | 7806 | XSETINT (bufp->x, mouse_loc.h); |
| 7766 | XSETINT (bufp->y, mouse_loc.v); | 7807 | XSETINT (bufp->y, mouse_loc.v); |
| @@ -8517,6 +8558,8 @@ static struct redisplay_interface x_redisplay_interface = | |||
| 8517 | x_get_glyph_overhangs, | 8558 | x_get_glyph_overhangs, |
| 8518 | x_fix_overlapping_area, | 8559 | x_fix_overlapping_area, |
| 8519 | x_draw_fringe_bitmap, | 8560 | x_draw_fringe_bitmap, |
| 8561 | 0, /* define_fringe_bitmap */ | ||
| 8562 | 0, /* destroy_fringe_bitmap */ | ||
| 8520 | mac_per_char_metric, | 8563 | mac_per_char_metric, |
| 8521 | mac_encode_char, | 8564 | mac_encode_char, |
| 8522 | NULL, /* mac_compute_glyph_string_overhangs */ | 8565 | NULL, /* mac_compute_glyph_string_overhangs */ |
| @@ -8636,6 +8679,9 @@ syms_of_macterm () | |||
| 8636 | 8679 | ||
| 8637 | Fprovide (intern ("mac-carbon"), Qnil); | 8680 | Fprovide (intern ("mac-carbon"), Qnil); |
| 8638 | 8681 | ||
| 8682 | staticpro (&Qreverse); | ||
| 8683 | Qreverse = intern ("reverse"); | ||
| 8684 | |||
| 8639 | staticpro (&x_display_name_list); | 8685 | staticpro (&x_display_name_list); |
| 8640 | x_display_name_list = Qnil; | 8686 | x_display_name_list = Qnil; |
| 8641 | 8687 | ||
| @@ -8680,6 +8726,17 @@ Otherwise the option key is used. */); | |||
| 8680 | useful for non-standard keyboard layouts. */); | 8726 | useful for non-standard keyboard layouts. */); |
| 8681 | Vmac_reverse_ctrl_meta = Qnil; | 8727 | Vmac_reverse_ctrl_meta = Qnil; |
| 8682 | 8728 | ||
| 8729 | DEFVAR_LISP ("mac-emulate-three-button-mouse", | ||
| 8730 | &Vmac_emulate_three_button_mouse, | ||
| 8731 | doc: /* t means that when the option-key is held down while pressing the | ||
| 8732 | mouse button, the click will register as mouse-2 and while the | ||
| 8733 | command-key is held down, the click will register as mouse-3. | ||
| 8734 | 'reverse means that the the option-key will register for mouse-3 | ||
| 8735 | and the command-key will register for mouse-2. nil means that | ||
| 8736 | not emulation should be done and the modifiers should be placed | ||
| 8737 | on the mouse-1 event. */); | ||
| 8738 | Vmac_emulate_three_button_mouse = Qnil; | ||
| 8739 | |||
| 8683 | #if USE_CARBON_EVENTS | 8740 | #if USE_CARBON_EVENTS |
| 8684 | DEFVAR_LISP ("mac-wheel-button-is-mouse-2", &Vmac_wheel_button_is_mouse_2, | 8741 | DEFVAR_LISP ("mac-wheel-button-is-mouse-2", &Vmac_wheel_button_is_mouse_2, |
| 8685 | doc: /* Non-nil means that the wheel button will be treated as mouse-2 and | 8742 | doc: /* Non-nil means that the wheel button will be treated as mouse-2 and |
diff --git a/src/makefile.w32-in b/src/makefile.w32-in index bd5ad98571c..1007e3940b0 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in | |||
| @@ -118,7 +118,8 @@ OBJ1 = $(BLD)/abbrev.$(O) \ | |||
| 118 | $(BLD)/coding.$(O) \ | 118 | $(BLD)/coding.$(O) \ |
| 119 | $(BLD)/category.$(O) \ | 119 | $(BLD)/category.$(O) \ |
| 120 | $(BLD)/ccl.$(O) \ | 120 | $(BLD)/ccl.$(O) \ |
| 121 | $(BLD)/fontset.$(O) | 121 | $(BLD)/fontset.$(O) \ |
| 122 | $(BLD)/fringe.$(O) | ||
| 122 | 123 | ||
| 123 | WIN32OBJ = $(BLD)/w32term.$(O) \ | 124 | WIN32OBJ = $(BLD)/w32term.$(O) \ |
| 124 | $(BLD)/w32xfns.$(O) \ | 125 | $(BLD)/w32xfns.$(O) \ |
diff --git a/src/minibuf.c b/src/minibuf.c index 6124054f3c0..1f5a114540d 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -132,6 +132,8 @@ Lisp_Object Qminibuffer_default; | |||
| 132 | 132 | ||
| 133 | Lisp_Object Qcurrent_input_method, Qactivate_input_method; | 133 | Lisp_Object Qcurrent_input_method, Qactivate_input_method; |
| 134 | 134 | ||
| 135 | Lisp_Object Qcase_fold_search; | ||
| 136 | |||
| 135 | extern Lisp_Object Qmouse_face; | 137 | extern Lisp_Object Qmouse_face; |
| 136 | 138 | ||
| 137 | extern Lisp_Object Qfield; | 139 | extern Lisp_Object Qfield; |
| @@ -322,7 +324,8 @@ read_minibuf_noninteractive (map, initial, prompt, backup_n, expflag, | |||
| 322 | DEFUN ("minibufferp", Fminibufferp, | 324 | DEFUN ("minibufferp", Fminibufferp, |
| 323 | Sminibufferp, 0, 1, 0, | 325 | Sminibufferp, 0, 1, 0, |
| 324 | doc: /* Return t if BUFFER is a minibuffer. | 326 | doc: /* Return t if BUFFER is a minibuffer. |
| 325 | No argument or nil as argument means use current buffer as BUFFER.*/) | 327 | No argument or nil as argument means use current buffer as BUFFER. |
| 328 | BUFFER can be a buffer or a buffer name. */) | ||
| 326 | (buffer) | 329 | (buffer) |
| 327 | Lisp_Object buffer; | 330 | Lisp_Object buffer; |
| 328 | { | 331 | { |
| @@ -411,9 +414,9 @@ minibuffer_completion_contents () | |||
| 411 | with initial position HISTPOS. INITIAL should be a string or a | 414 | with initial position HISTPOS. INITIAL should be a string or a |
| 412 | cons of a string and an integer. BACKUP_N should be <= 0, or | 415 | cons of a string and an integer. BACKUP_N should be <= 0, or |
| 413 | Qnil, which is equivalent to 0. If INITIAL is a cons, BACKUP_N is | 416 | Qnil, which is equivalent to 0. If INITIAL is a cons, BACKUP_N is |
| 414 | ignored and replaced with an integer that puts point N characters | 417 | ignored and replaced with an integer that puts point at one-indexed |
| 415 | from the beginning of INITIAL, where N is the CDR of INITIAL, or at | 418 | position N in INITIAL, where N is the CDR of INITIAL, or at the |
| 416 | the beginning of INITIAL if N <= 0. | 419 | beginning of INITIAL if N <= 0. |
| 417 | 420 | ||
| 418 | Normally return the result as a string (the text that was read), | 421 | Normally return the result as a string (the text that was read), |
| 419 | but if EXPFLAG is nonzero, read it and return the object read. | 422 | but if EXPFLAG is nonzero, read it and return the object read. |
| @@ -898,23 +901,22 @@ read_minibuf_unwind (data) | |||
| 898 | 901 | ||
| 899 | DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1, 7, 0, | 902 | DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1, 7, 0, |
| 900 | doc: /* Read a string from the minibuffer, prompting with string PROMPT. | 903 | doc: /* Read a string from the minibuffer, prompting with string PROMPT. |
| 901 | If optional second arg INITIAL-CONTENTS is non-nil, it is a string | 904 | The optional second arg INITIAL-CONTENTS is an obsolete alternative to |
| 902 | to be inserted into the minibuffer before reading input. | 905 | DEFAULT-VALUE. It normally should be nil in new code, except when |
| 903 | If INITIAL-CONTENTS is (STRING . POSITION), the initial input | 906 | HIST is a cons. It is discussed in more detail below. |
| 904 | is STRING, but point is placed at position POSITION in the minibuffer. | ||
| 905 | Third arg KEYMAP is a keymap to use whilst reading; | 907 | Third arg KEYMAP is a keymap to use whilst reading; |
| 906 | if omitted or nil, the default is `minibuffer-local-map'. | 908 | if omitted or nil, the default is `minibuffer-local-map'. |
| 907 | If fourth arg READ is non-nil, then interpret the result as a Lisp object | 909 | If fourth arg READ is non-nil, then interpret the result as a Lisp object |
| 908 | and return that object: | 910 | and return that object: |
| 909 | in other words, do `(car (read-from-string INPUT-STRING))' | 911 | in other words, do `(car (read-from-string INPUT-STRING))' |
| 910 | Fifth arg HIST, if non-nil, specifies a history list | 912 | Fifth arg HIST, if non-nil, specifies a history list and optionally |
| 911 | and optionally the initial position in the list. | 913 | the initial position in the list. It can be a symbol, which is the |
| 912 | It can be a symbol, which is the history list variable to use, | 914 | history list variable to use, or it can be a cons cell |
| 913 | or it can be a cons cell (HISTVAR . HISTPOS). | 915 | (HISTVAR . HISTPOS). In that case, HISTVAR is the history list variable |
| 914 | In that case, HISTVAR is the history list variable to use, | 916 | to use, and HISTPOS is the initial position for use by the minibuffer |
| 915 | and HISTPOS is the initial position (the position in the list | 917 | history commands. For consistency, you should also specify that |
| 916 | which INITIAL-CONTENTS corresponds to). | 918 | element of the history as the value of INITIAL-CONTENTS. Positions |
| 917 | Positions are counted starting from 1 at the beginning of the list. | 919 | are counted starting from 1 at the beginning of the list. |
| 918 | Sixth arg DEFAULT-VALUE is the default value. If non-nil, it is available | 920 | Sixth arg DEFAULT-VALUE is the default value. If non-nil, it is available |
| 919 | for history commands; but, unless READ is non-nil, `read-from-minibuffer' | 921 | for history commands; but, unless READ is non-nil, `read-from-minibuffer' |
| 920 | does NOT return DEFAULT-VALUE if the user enters empty input! It returns | 922 | does NOT return DEFAULT-VALUE if the user enters empty input! It returns |
| @@ -923,7 +925,19 @@ Seventh arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits | |||
| 923 | the current input method and the setting of `enable-multibyte-characters'. | 925 | the current input method and the setting of `enable-multibyte-characters'. |
| 924 | If the variable `minibuffer-allow-text-properties' is non-nil, | 926 | If the variable `minibuffer-allow-text-properties' is non-nil, |
| 925 | then the string which is returned includes whatever text properties | 927 | then the string which is returned includes whatever text properties |
| 926 | were present in the minibuffer. Otherwise the value has no text properties. */) | 928 | were present in the minibuffer. Otherwise the value has no text properties. |
| 929 | |||
| 930 | The remainder of this documentation string describes the | ||
| 931 | INITIAL-CONTENTS argument in more detail. It is only relevant when | ||
| 932 | studying existing code, or when HIST is a cons. If non-nil, | ||
| 933 | INITIAL-CONTENTS is a string to be inserted into the minibuffer before | ||
| 934 | reading input. Normally, point is put at the end of that string. | ||
| 935 | However, if INITIAL-CONTENTS is \(STRING . POSITION), the initial | ||
| 936 | input is STRING, but point is placed at _one-indexed_ position | ||
| 937 | POSITION in the minibuffer. Any integer value less than or equal to | ||
| 938 | one puts point at the beginning of the string. *Note* that this | ||
| 939 | behavior differs from the way such arguments are used in `completing-read' | ||
| 940 | and some related functions, which use zero-indexing for POSITION. */) | ||
| 927 | (prompt, initial_contents, keymap, read, hist, default_value, inherit_input_method) | 941 | (prompt, initial_contents, keymap, read, hist, default_value, inherit_input_method) |
| 928 | Lisp_Object prompt, initial_contents, keymap, read, hist, default_value; | 942 | Lisp_Object prompt, initial_contents, keymap, read, hist, default_value; |
| 929 | Lisp_Object inherit_input_method; | 943 | Lisp_Object inherit_input_method; |
| @@ -963,9 +977,11 @@ If the variable `minibuffer-allow-text-properties' is non-nil, | |||
| 963 | } | 977 | } |
| 964 | 978 | ||
| 965 | DEFUN ("read-minibuffer", Fread_minibuffer, Sread_minibuffer, 1, 2, 0, | 979 | DEFUN ("read-minibuffer", Fread_minibuffer, Sread_minibuffer, 1, 2, 0, |
| 966 | doc: /* Return a Lisp object read using the minibuffer. | 980 | doc: /* Return a Lisp object read using the minibuffer, unevaluated. |
| 967 | Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS | 981 | Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS |
| 968 | is a string to insert in the minibuffer before reading. */) | 982 | is a string to insert in the minibuffer before reading. |
| 983 | \(INITIAL-CONTENTS can also be a cons of a string and an integer. Such | ||
| 984 | arguments are used as in `read-from-minibuffer') */) | ||
| 969 | (prompt, initial_contents) | 985 | (prompt, initial_contents) |
| 970 | Lisp_Object prompt, initial_contents; | 986 | Lisp_Object prompt, initial_contents; |
| 971 | { | 987 | { |
| @@ -978,7 +994,9 @@ is a string to insert in the minibuffer before reading. */) | |||
| 978 | DEFUN ("eval-minibuffer", Feval_minibuffer, Seval_minibuffer, 1, 2, 0, | 994 | DEFUN ("eval-minibuffer", Feval_minibuffer, Seval_minibuffer, 1, 2, 0, |
| 979 | doc: /* Return value of Lisp expression read using the minibuffer. | 995 | doc: /* Return value of Lisp expression read using the minibuffer. |
| 980 | Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS | 996 | Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS |
| 981 | is a string to insert in the minibuffer before reading. */) | 997 | is a string to insert in the minibuffer before reading. |
| 998 | \(INITIAL-CONTENTS can also be a cons of a string and an integer. Such | ||
| 999 | arguments are used as in `read-from-minibuffer') */) | ||
| 982 | (prompt, initial_contents) | 1000 | (prompt, initial_contents) |
| 983 | Lisp_Object prompt, initial_contents; | 1001 | Lisp_Object prompt, initial_contents; |
| 984 | { | 1002 | { |
| @@ -990,6 +1008,9 @@ is a string to insert in the minibuffer before reading. */) | |||
| 990 | DEFUN ("read-string", Fread_string, Sread_string, 1, 5, 0, | 1008 | DEFUN ("read-string", Fread_string, Sread_string, 1, 5, 0, |
| 991 | doc: /* Read a string from the minibuffer, prompting with string PROMPT. | 1009 | doc: /* Read a string from the minibuffer, prompting with string PROMPT. |
| 992 | If non-nil, second arg INITIAL-INPUT is a string to insert before reading. | 1010 | If non-nil, second arg INITIAL-INPUT is a string to insert before reading. |
| 1011 | This argument has been superseded by DEFAULT-VALUE and should normally | ||
| 1012 | be nil in new code. It behaves as in `read-from-minibuffer'. See the | ||
| 1013 | documentation string of that function for details. | ||
| 993 | The third arg HISTORY, if non-nil, specifies a history list | 1014 | The third arg HISTORY, if non-nil, specifies a history list |
| 994 | and optionally the initial position in the list. | 1015 | and optionally the initial position in the list. |
| 995 | See `read-from-minibuffer' for details of HISTORY argument. | 1016 | See `read-from-minibuffer' for details of HISTORY argument. |
| @@ -1013,9 +1034,14 @@ Fifth arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits | |||
| 1013 | 1034 | ||
| 1014 | DEFUN ("read-no-blanks-input", Fread_no_blanks_input, Sread_no_blanks_input, 1, 3, 0, | 1035 | DEFUN ("read-no-blanks-input", Fread_no_blanks_input, Sread_no_blanks_input, 1, 3, 0, |
| 1015 | doc: /* Read a string from the terminal, not allowing blanks. | 1036 | doc: /* Read a string from the terminal, not allowing blanks. |
| 1016 | Prompt with PROMPT, and provide INITIAL as an initial value of the input string. | 1037 | Prompt with PROMPT. Whitespace terminates the input. If INITIAL is |
| 1038 | non-nil, it should be a string, which is used as initial input, with | ||
| 1039 | point positioned at the end, so that SPACE will accept the input. | ||
| 1040 | \(Actually, INITIAL can also be a cons of a string and an integer. | ||
| 1041 | Such values are treated as in `read-from-minibuffer', but are normally | ||
| 1042 | not useful in this function.) | ||
| 1017 | Third arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits | 1043 | Third arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits |
| 1018 | the current input method and the setting of `enable-multibyte-characters'. */) | 1044 | the current input method and the setting of`enable-multibyte-characters'. */) |
| 1019 | (prompt, initial, inherit_input_method) | 1045 | (prompt, initial, inherit_input_method) |
| 1020 | Lisp_Object prompt, initial, inherit_input_method; | 1046 | Lisp_Object prompt, initial, inherit_input_method; |
| 1021 | { | 1047 | { |
| @@ -1243,7 +1269,7 @@ is used to further constrain the set of candidates. */) | |||
| 1243 | && (tem = Fcompare_strings (eltstring, make_number (0), | 1269 | && (tem = Fcompare_strings (eltstring, make_number (0), |
| 1244 | make_number (SCHARS (string)), | 1270 | make_number (SCHARS (string)), |
| 1245 | string, make_number (0), Qnil, | 1271 | string, make_number (0), Qnil, |
| 1246 | completion_ignore_case ?Qt : Qnil), | 1272 | completion_ignore_case ? Qt : Qnil), |
| 1247 | EQ (Qt, tem))) | 1273 | EQ (Qt, tem))) |
| 1248 | { | 1274 | { |
| 1249 | /* Yes. */ | 1275 | /* Yes. */ |
| @@ -1252,15 +1278,20 @@ is used to further constrain the set of candidates. */) | |||
| 1252 | XSETFASTINT (zero, 0); | 1278 | XSETFASTINT (zero, 0); |
| 1253 | 1279 | ||
| 1254 | /* Ignore this element if it fails to match all the regexps. */ | 1280 | /* Ignore this element if it fails to match all the regexps. */ |
| 1255 | for (regexps = Vcompletion_regexp_list; CONSP (regexps); | 1281 | { |
| 1256 | regexps = XCDR (regexps)) | 1282 | int count = SPECPDL_INDEX (); |
| 1257 | { | 1283 | specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil); |
| 1258 | tem = Fstring_match (XCAR (regexps), eltstring, zero); | 1284 | for (regexps = Vcompletion_regexp_list; CONSP (regexps); |
| 1259 | if (NILP (tem)) | 1285 | regexps = XCDR (regexps)) |
| 1260 | break; | 1286 | { |
| 1261 | } | 1287 | tem = Fstring_match (XCAR (regexps), eltstring, zero); |
| 1262 | if (CONSP (regexps)) | 1288 | if (NILP (tem)) |
| 1263 | continue; | 1289 | break; |
| 1290 | } | ||
| 1291 | unbind_to (count, Qnil); | ||
| 1292 | if (CONSP (regexps)) | ||
| 1293 | continue; | ||
| 1294 | } | ||
| 1264 | 1295 | ||
| 1265 | /* Ignore this element if there is a predicate | 1296 | /* Ignore this element if there is a predicate |
| 1266 | and the predicate doesn't like it. */ | 1297 | and the predicate doesn't like it. */ |
| @@ -1498,15 +1529,20 @@ are ignored unless STRING itself starts with a space. */) | |||
| 1498 | XSETFASTINT (zero, 0); | 1529 | XSETFASTINT (zero, 0); |
| 1499 | 1530 | ||
| 1500 | /* Ignore this element if it fails to match all the regexps. */ | 1531 | /* Ignore this element if it fails to match all the regexps. */ |
| 1501 | for (regexps = Vcompletion_regexp_list; CONSP (regexps); | 1532 | { |
| 1502 | regexps = XCDR (regexps)) | 1533 | int count = SPECPDL_INDEX (); |
| 1503 | { | 1534 | specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil); |
| 1504 | tem = Fstring_match (XCAR (regexps), eltstring, zero); | 1535 | for (regexps = Vcompletion_regexp_list; CONSP (regexps); |
| 1505 | if (NILP (tem)) | 1536 | regexps = XCDR (regexps)) |
| 1506 | break; | 1537 | { |
| 1507 | } | 1538 | tem = Fstring_match (XCAR (regexps), eltstring, zero); |
| 1508 | if (CONSP (regexps)) | 1539 | if (NILP (tem)) |
| 1509 | continue; | 1540 | break; |
| 1541 | } | ||
| 1542 | unbind_to (count, Qnil); | ||
| 1543 | if (CONSP (regexps)) | ||
| 1544 | continue; | ||
| 1545 | } | ||
| 1510 | 1546 | ||
| 1511 | /* Ignore this element if there is a predicate | 1547 | /* Ignore this element if there is a predicate |
| 1512 | and the predicate doesn't like it. */ | 1548 | and the predicate doesn't like it. */ |
| @@ -1542,7 +1578,7 @@ Lisp_Object Vminibuffer_completing_file_name; | |||
| 1542 | DEFUN ("completing-read", Fcompleting_read, Scompleting_read, 2, 8, 0, | 1578 | DEFUN ("completing-read", Fcompleting_read, Scompleting_read, 2, 8, 0, |
| 1543 | doc: /* Read a string in the minibuffer, with completion. | 1579 | doc: /* Read a string in the minibuffer, with completion. |
| 1544 | PROMPT is a string to prompt with; normally it ends in a colon and a space. | 1580 | PROMPT is a string to prompt with; normally it ends in a colon and a space. |
| 1545 | TABLE is an alist whose elements' cars are strings, or an obarray. | 1581 | TABLE can be an list of strings, an alist, an obarray or a hash table. |
| 1546 | TABLE can also be a function to do the completion itself. | 1582 | TABLE can also be a function to do the completion itself. |
| 1547 | PREDICATE limits completion to a subset of TABLE. | 1583 | PREDICATE limits completion to a subset of TABLE. |
| 1548 | See `try-completion' and `all-completions' for more details | 1584 | See `try-completion' and `all-completions' for more details |
| @@ -1551,26 +1587,30 @@ See `try-completion' and `all-completions' for more details | |||
| 1551 | If REQUIRE-MATCH is non-nil, the user is not allowed to exit unless | 1587 | If REQUIRE-MATCH is non-nil, the user is not allowed to exit unless |
| 1552 | the input is (or completes to) an element of TABLE or is null. | 1588 | the input is (or completes to) an element of TABLE or is null. |
| 1553 | If it is also not t, typing RET does not exit if it does non-null completion. | 1589 | If it is also not t, typing RET does not exit if it does non-null completion. |
| 1554 | If the input is null, `completing-read' returns an empty string, | 1590 | If the input is null, `completing-read' returns DEF, or an empty string |
| 1555 | regardless of the value of REQUIRE-MATCH. | 1591 | if DEF is nil, regardless of the value of REQUIRE-MATCH. |
| 1556 | 1592 | ||
| 1557 | If INITIAL-INPUT is non-nil, insert it in the minibuffer initially. | 1593 | If INITIAL-INPUT is non-nil, insert it in the minibuffer initially, |
| 1558 | If it is (STRING . POSITION), the initial input | 1594 | with point positioned at the end. |
| 1559 | is STRING, but point is placed POSITION characters into the string. | 1595 | If it is (STRING . POSITION), the initial input is STRING, but point |
| 1560 | This feature is deprecated--it is best to pass nil for INITIAL-INPUT | 1596 | is placed at _zero-indexed_ position POSITION in STRING. (*Note* |
| 1561 | and supply the default value DEF instead. The user can yank the | 1597 | that this is different from `read-from-minibuffer' and related |
| 1562 | default value into the minibuffer easily using \\[next-history-element]. | 1598 | functions, which use one-indexing for POSITION.) This feature is |
| 1563 | 1599 | deprecated--it is best to pass nil for INITIAL-INPUT and supply the | |
| 1564 | HIST, if non-nil, specifies a history list | 1600 | default value DEF instead. The user can yank the default value into |
| 1565 | and optionally the initial position in the list. | 1601 | the minibuffer easily using \\[next-history-element]. |
| 1566 | It can be a symbol, which is the history list variable to use, | 1602 | |
| 1567 | or it can be a cons cell (HISTVAR . HISTPOS). | 1603 | HIST, if non-nil, specifies a history list and optionally the initial |
| 1568 | In that case, HISTVAR is the history list variable to use, | 1604 | position in the list. It can be a symbol, which is the history list |
| 1569 | and HISTPOS is the initial position (the position in the list | 1605 | variable to use, or it can be a cons cell (HISTVAR . HISTPOS). In |
| 1570 | which INITIAL-INPUT corresponds to). | 1606 | that case, HISTVAR is the history list variable to use, and HISTPOS |
| 1571 | Positions are counted starting from 1 at the beginning of the list. | 1607 | is the initial position (the position in the list used by the |
| 1572 | The variable `history-length' controls the maximum length of a | 1608 | minibuffer history commands). For consistency, you should also |
| 1573 | history list. | 1609 | specify that element of the history as the value of |
| 1610 | INITIAL-CONTENTS. (This is the only case in which you should use | ||
| 1611 | INITIAL-INPUT instead of DEF.) Positions are counted starting from | ||
| 1612 | 1 at the beginning of the list. The variable `history-length' | ||
| 1613 | controls the maximum length of a history list. | ||
| 1574 | 1614 | ||
| 1575 | DEF, if non-nil, is the default value. | 1615 | DEF, if non-nil, is the default value. |
| 1576 | 1616 | ||
| @@ -1737,20 +1777,27 @@ the values STRING, PREDICATE and `lambda'. */) | |||
| 1737 | return call3 (alist, string, predicate, Qlambda); | 1777 | return call3 (alist, string, predicate, Qlambda); |
| 1738 | 1778 | ||
| 1739 | /* Reject this element if it fails to match all the regexps. */ | 1779 | /* Reject this element if it fails to match all the regexps. */ |
| 1740 | for (regexps = Vcompletion_regexp_list; CONSP (regexps); | 1780 | { |
| 1741 | regexps = XCDR (regexps)) | 1781 | int count = SPECPDL_INDEX (); |
| 1742 | { | 1782 | specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil); |
| 1743 | if (NILP (Fstring_match (XCAR (regexps), | 1783 | for (regexps = Vcompletion_regexp_list; CONSP (regexps); |
| 1744 | SYMBOLP (tem) ? string : tem, | 1784 | regexps = XCDR (regexps)) |
| 1745 | Qnil))) | 1785 | { |
| 1746 | return Qnil; | 1786 | if (NILP (Fstring_match (XCAR (regexps), |
| 1747 | } | 1787 | SYMBOLP (tem) ? string : tem, |
| 1788 | Qnil))) | ||
| 1789 | return unbind_to (count, Qnil); | ||
| 1790 | } | ||
| 1791 | unbind_to (count, Qnil); | ||
| 1792 | } | ||
| 1748 | 1793 | ||
| 1749 | /* Finally, check the predicate. */ | 1794 | /* Finally, check the predicate. */ |
| 1750 | if (!NILP (predicate)) | 1795 | if (!NILP (predicate)) |
| 1751 | return HASH_TABLE_P (alist) | 1796 | { |
| 1752 | ? call2 (predicate, tem, HASH_VALUE (XHASH_TABLE (alist), i)) | 1797 | return HASH_TABLE_P (alist) |
| 1753 | : call1 (predicate, tem); | 1798 | ? call2 (predicate, tem, HASH_VALUE (XHASH_TABLE (alist), i)) |
| 1799 | : call1 (predicate, tem); | ||
| 1800 | } | ||
| 1754 | else | 1801 | else |
| 1755 | return Qt; | 1802 | return Qt; |
| 1756 | } | 1803 | } |
| @@ -2212,6 +2259,8 @@ DEFUN ("display-completion-list", Fdisplay_completion_list, Sdisplay_completion_ | |||
| 2212 | doc: /* Display the list of completions, COMPLETIONS, using `standard-output'. | 2259 | doc: /* Display the list of completions, COMPLETIONS, using `standard-output'. |
| 2213 | Each element may be just a symbol or string | 2260 | Each element may be just a symbol or string |
| 2214 | or may be a list of two strings to be printed as if concatenated. | 2261 | or may be a list of two strings to be printed as if concatenated. |
| 2262 | If it is a list of two strings, the first is the actual completion | ||
| 2263 | alternative, the second serves as annotation. | ||
| 2215 | `standard-output' must be a buffer. | 2264 | `standard-output' must be a buffer. |
| 2216 | The actual completion alternatives, as inserted, are given `mouse-face' | 2265 | The actual completion alternatives, as inserted, are given `mouse-face' |
| 2217 | properties of `highlight'. | 2266 | properties of `highlight'. |
| @@ -2252,6 +2301,8 @@ It can find the completion buffer in `standard-output'. */) | |||
| 2252 | startpos = Qnil; | 2301 | startpos = Qnil; |
| 2253 | 2302 | ||
| 2254 | elt = Fcar (tail); | 2303 | elt = Fcar (tail); |
| 2304 | if (SYMBOLP (elt)) | ||
| 2305 | elt = SYMBOL_NAME (elt); | ||
| 2255 | /* Compute the length of this element. */ | 2306 | /* Compute the length of this element. */ |
| 2256 | if (CONSP (elt)) | 2307 | if (CONSP (elt)) |
| 2257 | { | 2308 | { |
| @@ -2563,6 +2614,9 @@ syms_of_minibuf () | |||
| 2563 | Qactivate_input_method = intern ("activate-input-method"); | 2614 | Qactivate_input_method = intern ("activate-input-method"); |
| 2564 | staticpro (&Qactivate_input_method); | 2615 | staticpro (&Qactivate_input_method); |
| 2565 | 2616 | ||
| 2617 | Qcase_fold_search = intern ("case-fold-search"); | ||
| 2618 | staticpro (&Qcase_fold_search); | ||
| 2619 | |||
| 2566 | DEFVAR_LISP ("read-buffer-function", &Vread_buffer_function, | 2620 | DEFVAR_LISP ("read-buffer-function", &Vread_buffer_function, |
| 2567 | doc: /* If this is non-nil, `read-buffer' does its work by calling this function. */); | 2621 | doc: /* If this is non-nil, `read-buffer' does its work by calling this function. */); |
| 2568 | Vread_buffer_function = Qnil; | 2622 | Vread_buffer_function = Qnil; |
| @@ -2597,7 +2651,8 @@ This variable makes a difference whenever the minibuffer window is active. */); | |||
| 2597 | 2651 | ||
| 2598 | DEFVAR_LISP ("minibuffer-completion-table", &Vminibuffer_completion_table, | 2652 | DEFVAR_LISP ("minibuffer-completion-table", &Vminibuffer_completion_table, |
| 2599 | doc: /* Alist or obarray used for completion in the minibuffer. | 2653 | doc: /* Alist or obarray used for completion in the minibuffer. |
| 2600 | This becomes the ALIST argument to `try-completion' and `all-completion'. | 2654 | This becomes the ALIST argument to `try-completion' and `all-completions'. |
| 2655 | The value can also be a list of strings or a hash table. | ||
| 2601 | 2656 | ||
| 2602 | The value may alternatively be a function, which is given three arguments: | 2657 | The value may alternatively be a function, which is given three arguments: |
| 2603 | STRING, the current buffer contents; | 2658 | STRING, the current buffer contents; |
| @@ -2644,7 +2699,12 @@ Some uses of the echo area also raise that frame (since they use it too). */); | |||
| 2644 | minibuffer_auto_raise = 0; | 2699 | minibuffer_auto_raise = 0; |
| 2645 | 2700 | ||
| 2646 | DEFVAR_LISP ("completion-regexp-list", &Vcompletion_regexp_list, | 2701 | DEFVAR_LISP ("completion-regexp-list", &Vcompletion_regexp_list, |
| 2647 | doc: /* List of regexps that should restrict possible completions. */); | 2702 | doc: /* List of regexps that should restrict possible completions. |
| 2703 | The basic completion functions only consider a completion acceptable | ||
| 2704 | if it matches all regular expressions in this list, with | ||
| 2705 | `case-fold-search' bound to the value of `completion-ignore-case'. | ||
| 2706 | See Info node `(elisp)Basic Completion', for a description of these | ||
| 2707 | functions. */); | ||
| 2648 | Vcompletion_regexp_list = Qnil; | 2708 | Vcompletion_regexp_list = Qnil; |
| 2649 | 2709 | ||
| 2650 | DEFVAR_BOOL ("minibuffer-allow-text-properties", | 2710 | DEFVAR_BOOL ("minibuffer-allow-text-properties", |
diff --git a/src/process.c b/src/process.c index be6094438e9..3e4b5dbc673 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -4262,7 +4262,7 @@ wait_reading_process_input (time_limit, microsecs, read_kbd, do_display) | |||
| 4262 | else | 4262 | else |
| 4263 | Available = input_wait_mask; | 4263 | Available = input_wait_mask; |
| 4264 | check_connect = (num_pending_connects > 0); | 4264 | check_connect = (num_pending_connects > 0); |
| 4265 | check_delay = process_output_delay_count; | 4265 | check_delay = wait_channel >= 0 ? 0 : process_output_delay_count; |
| 4266 | } | 4266 | } |
| 4267 | 4267 | ||
| 4268 | /* If frame size has changed or the window is newly mapped, | 4268 | /* If frame size has changed or the window is newly mapped, |
diff --git a/src/region-cache.c b/src/region-cache.c index fc9d3f98de0..251382a5a0e 100644 --- a/src/region-cache.c +++ b/src/region-cache.c | |||
| @@ -21,12 +21,12 @@ Boston, MA 02111-1307, USA. */ | |||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | #include <config.h> | 23 | #include <config.h> |
| 24 | #include <stdio.h> | ||
| 25 | |||
| 24 | #include "lisp.h" | 26 | #include "lisp.h" |
| 25 | #include "buffer.h" | 27 | #include "buffer.h" |
| 26 | #include "region-cache.h" | 28 | #include "region-cache.h" |
| 27 | 29 | ||
| 28 | #include <stdio.h> | ||
| 29 | |||
| 30 | 30 | ||
| 31 | /* Data structures. */ | 31 | /* Data structures. */ |
| 32 | 32 | ||
diff --git a/src/sysdep.c b/src/sysdep.c index 73b7fb70a99..febf59253e1 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 24 | #endif | 24 | #endif |
| 25 | 25 | ||
| 26 | #include <signal.h> | 26 | #include <signal.h> |
| 27 | #include <stdio.h> | ||
| 27 | #include <setjmp.h> | 28 | #include <setjmp.h> |
| 28 | #ifdef HAVE_UNISTD_H | 29 | #ifdef HAVE_UNISTD_H |
| 29 | #include <unistd.h> | 30 | #include <unistd.h> |
| @@ -82,7 +83,6 @@ static int delete_exited_processes; | |||
| 82 | #undef fwrite | 83 | #undef fwrite |
| 83 | #endif | 84 | #endif |
| 84 | 85 | ||
| 85 | #include <stdio.h> | ||
| 86 | #include <sys/types.h> | 86 | #include <sys/types.h> |
| 87 | #include <sys/stat.h> | 87 | #include <sys/stat.h> |
| 88 | #include <errno.h> | 88 | #include <errno.h> |
diff --git a/src/w32fns.c b/src/w32fns.c index 1854c3908bd..3b53bade2ad 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -5558,6 +5558,11 @@ x_to_w32_font (lpxstr, lplogfont) | |||
| 5558 | (Fcheck_coding_system (Vlocale_coding_system), &coding); | 5558 | (Fcheck_coding_system (Vlocale_coding_system), &coding); |
| 5559 | coding.src_multibyte = 1; | 5559 | coding.src_multibyte = 1; |
| 5560 | coding.dst_multibyte = 1; | 5560 | coding.dst_multibyte = 1; |
| 5561 | /* Need to set COMPOSITION_DISABLED, otherwise Emacs crashes in | ||
| 5562 | encode_coding_iso2022 trying to dereference a null pointer. */ | ||
| 5563 | coding.composing = COMPOSITION_DISABLED; | ||
| 5564 | if (coding.type == coding_type_iso2022) | ||
| 5565 | coding.flags |= CODING_FLAG_ISO_SAFE; | ||
| 5561 | bufsize = encoding_buffer_size (&coding, strlen (name)); | 5566 | bufsize = encoding_buffer_size (&coding, strlen (name)); |
| 5562 | buf = (unsigned char *) alloca (bufsize); | 5567 | buf = (unsigned char *) alloca (bufsize); |
| 5563 | coding.mode |= CODING_MODE_LAST_BLOCK; | 5568 | coding.mode |= CODING_MODE_LAST_BLOCK; |
| @@ -12400,12 +12405,25 @@ x_kill_gs_process (pixmap, f) | |||
| 12400 | ***********************************************************************/ | 12405 | ***********************************************************************/ |
| 12401 | 12406 | ||
| 12402 | DEFUN ("x-change-window-property", Fx_change_window_property, | 12407 | DEFUN ("x-change-window-property", Fx_change_window_property, |
| 12403 | Sx_change_window_property, 2, 3, 0, | 12408 | Sx_change_window_property, 2, 6, 0, |
| 12404 | doc: /* Change window property PROP to VALUE on the X window of FRAME. | 12409 | doc: /* Change window property PROP to VALUE on the X window of FRAME. |
| 12405 | PROP and VALUE must be strings. FRAME nil or omitted means use the | 12410 | VALUE may be a string or a list of conses, numbers and/or strings. |
| 12406 | selected frame. Value is VALUE. */) | 12411 | If an element in the list is a string, it is converted to |
| 12407 | (prop, value, frame) | 12412 | an Atom and the value of the Atom is used. If an element is a cons, |
| 12408 | Lisp_Object frame, prop, value; | 12413 | it is converted to a 32 bit number where the car is the 16 top bits and the |
| 12414 | cdr is the lower 16 bits. | ||
| 12415 | FRAME nil or omitted means use the selected frame. | ||
| 12416 | If TYPE is given and non-nil, it is the name of the type of VALUE. | ||
| 12417 | If TYPE is not given or nil, the type is STRING. | ||
| 12418 | FORMAT gives the size in bits of each element if VALUE is a list. | ||
| 12419 | It must be one of 8, 16 or 32. | ||
| 12420 | If VALUE is a string or FORMAT is nil or not given, FORMAT defaults to 8. | ||
| 12421 | If OUTER_P is non-nil, the property is changed for the outer X window of | ||
| 12422 | FRAME. Default is to change on the edit X window. | ||
| 12423 | |||
| 12424 | Value is VALUE. */) | ||
| 12425 | (prop, value, frame, type, format, outer_p) | ||
| 12426 | Lisp_Object prop, value, frame, type, format, outer_p; | ||
| 12409 | { | 12427 | { |
| 12410 | #if 0 /* TODO : port window properties to W32 */ | 12428 | #if 0 /* TODO : port window properties to W32 */ |
| 12411 | struct frame *f = check_x_frame (frame); | 12429 | struct frame *f = check_x_frame (frame); |
diff --git a/src/w32select.c b/src/w32select.c index 6533f4b660d..940cce35772 100644 --- a/src/w32select.c +++ b/src/w32select.c | |||
| @@ -212,6 +212,11 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data, | |||
| 212 | } | 212 | } |
| 213 | coding.src_multibyte = 1; | 213 | coding.src_multibyte = 1; |
| 214 | coding.dst_multibyte = 0; | 214 | coding.dst_multibyte = 0; |
| 215 | /* Need to set COMPOSITION_DISABLED, otherwise Emacs crashes in | ||
| 216 | encode_coding_iso2022 trying to dereference a null pointer. */ | ||
| 217 | coding.composing = COMPOSITION_DISABLED; | ||
| 218 | if (coding.type == coding_type_iso2022) | ||
| 219 | coding.flags |= CODING_FLAG_ISO_SAFE; | ||
| 215 | Vnext_selection_coding_system = Qnil; | 220 | Vnext_selection_coding_system = Qnil; |
| 216 | coding.mode |= CODING_MODE_LAST_BLOCK; | 221 | coding.mode |= CODING_MODE_LAST_BLOCK; |
| 217 | bufsize = encoding_buffer_size (&coding, nbytes); | 222 | bufsize = encoding_buffer_size (&coding, nbytes); |
diff --git a/src/w32term.c b/src/w32term.c index 834df6ef88f..82db82826e8 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -698,28 +698,46 @@ w32_draw_fringe_bitmap (w, row, p) | |||
| 698 | else | 698 | else |
| 699 | w32_clip_to_row (w, row, hdc); | 699 | w32_clip_to_row (w, row, hdc); |
| 700 | 700 | ||
| 701 | if (p->bx >= 0) | 701 | if (p->bx >= 0 && !p->overlay_p) |
| 702 | { | 702 | { |
| 703 | w32_fill_area (f, hdc, face->background, | 703 | w32_fill_area (f, hdc, face->background, |
| 704 | p->bx, p->by, p->nx, p->ny); | 704 | p->bx, p->by, p->nx, p->ny); |
| 705 | } | 705 | } |
| 706 | 706 | ||
| 707 | if (p->which != NO_FRINGE_BITMAP) | 707 | if (p->which) |
| 708 | { | 708 | { |
| 709 | HBITMAP pixmap = fringe_bmp[p->which]; | 709 | HBITMAP pixmap = fringe_bmp[p->which]; |
| 710 | HDC compat_hdc; | 710 | HDC compat_hdc; |
| 711 | HANDLE horig_obj; | 711 | HANDLE horig_obj; |
| 712 | 712 | ||
| 713 | compat_hdc = CreateCompatibleDC (hdc); | 713 | compat_hdc = CreateCompatibleDC (hdc); |
| 714 | |||
| 714 | SaveDC (hdc); | 715 | SaveDC (hdc); |
| 715 | 716 | ||
| 716 | horig_obj = SelectObject (compat_hdc, pixmap); | 717 | horig_obj = SelectObject (compat_hdc, pixmap); |
| 717 | SetTextColor (hdc, face->background); | 718 | SetTextColor (hdc, face->background); |
| 718 | SetBkColor (hdc, face->foreground); | 719 | SetBkColor (hdc, p->cursor_p |
| 720 | ? (p->overlay_p ? face->background | ||
| 721 | : f->output_data.w32->cursor_pixel) | ||
| 722 | : face->foreground); | ||
| 719 | 723 | ||
| 720 | BitBlt (hdc, p->x, p->y, p->wd, p->h, | 724 | /* Paint overlays transparently. */ |
| 721 | compat_hdc, 0, p->dh, | 725 | if (p->overlay_p) |
| 722 | SRCCOPY); | 726 | { |
| 727 | BitBlt (hdc, p->x, p->y, p->wd, p->h, | ||
| 728 | compat_hdc, 0, p->dh, | ||
| 729 | DSTINVERT); | ||
| 730 | BitBlt (hdc, p->x, p->y, p->wd, p->h, | ||
| 731 | compat_hdc, 0, p->dh, | ||
| 732 | MERGEPAINT); | ||
| 733 | BitBlt (hdc, p->x, p->y, p->wd, p->h, | ||
| 734 | compat_hdc, 0, p->dh, | ||
| 735 | DSTINVERT); | ||
| 736 | } | ||
| 737 | else | ||
| 738 | BitBlt (hdc, p->x, p->y, p->wd, p->h, | ||
| 739 | compat_hdc, 0, p->dh, | ||
| 740 | SRCCOPY); | ||
| 723 | 741 | ||
| 724 | SelectObject (compat_hdc, horig_obj); | 742 | SelectObject (compat_hdc, horig_obj); |
| 725 | DeleteDC (compat_hdc); | 743 | DeleteDC (compat_hdc); |
| @@ -731,6 +749,25 @@ w32_draw_fringe_bitmap (w, row, p) | |||
| 731 | release_frame_dc (f, hdc); | 749 | release_frame_dc (f, hdc); |
| 732 | } | 750 | } |
| 733 | 751 | ||
| 752 | static void | ||
| 753 | w32_define_fringe_bitmap (which, bits, h, wd) | ||
| 754 | int which; | ||
| 755 | unsigned short *bits; | ||
| 756 | int h, wd; | ||
| 757 | { | ||
| 758 | fringe_bmp[which] = CreateBitmap (wd, h, 1, 1, bits); | ||
| 759 | } | ||
| 760 | |||
| 761 | static void | ||
| 762 | w32_destroy_fringe_bitmap (which) | ||
| 763 | int which; | ||
| 764 | { | ||
| 765 | if (fringe_bmp[which]) | ||
| 766 | DeleteObject (fringe_bmp[which]); | ||
| 767 | fringe_bmp[which] = 0; | ||
| 768 | } | ||
| 769 | |||
| 770 | |||
| 734 | 771 | ||
| 735 | /* This is called when starting Emacs and when restarting after | 772 | /* This is called when starting Emacs and when restarting after |
| 736 | suspend. When starting Emacs, no window is mapped. And nothing | 773 | suspend. When starting Emacs, no window is mapped. And nothing |
| @@ -6220,32 +6257,7 @@ w32_term_init (display_name, xrm_option, resource_name) | |||
| 6220 | horizontally reflected compared to how they appear on X, so we | 6257 | horizontally reflected compared to how they appear on X, so we |
| 6221 | need to bitswap and convert to unsigned shorts before creating | 6258 | need to bitswap and convert to unsigned shorts before creating |
| 6222 | the bitmaps. */ | 6259 | the bitmaps. */ |
| 6223 | { | 6260 | w32_init_fringe (); |
| 6224 | int i, j; | ||
| 6225 | |||
| 6226 | for (i = NO_FRINGE_BITMAP + 1; i < MAX_FRINGE_BITMAPS; i++) | ||
| 6227 | { | ||
| 6228 | int h = fringe_bitmaps[i].height; | ||
| 6229 | int wd = fringe_bitmaps[i].width; | ||
| 6230 | unsigned short *w32bits | ||
| 6231 | = (unsigned short *)alloca (h * sizeof (unsigned short)); | ||
| 6232 | unsigned short *wb = w32bits; | ||
| 6233 | unsigned char *bits = fringe_bitmaps[i].bits; | ||
| 6234 | for (j = 0; j < h; j++) | ||
| 6235 | { | ||
| 6236 | static unsigned char swap_nibble[16] | ||
| 6237 | = { 0x0, 0x8, 0x4, 0xc, /* 0000 1000 0100 1100 */ | ||
| 6238 | 0x2, 0xa, 0x6, 0xe, /* 0010 1010 0110 1110 */ | ||
| 6239 | 0x1, 0x9, 0x5, 0xd, /* 0001 1001 0101 1101 */ | ||
| 6240 | 0x3, 0xb, 0x7, 0xf }; /* 0011 1011 0111 1111 */ | ||
| 6241 | |||
| 6242 | unsigned char b = *bits++; | ||
| 6243 | *wb++ = (unsigned short)((swap_nibble[b & 0xf]<<4) | ||
| 6244 | | (swap_nibble[(b>>4) & 0xf])); | ||
| 6245 | } | ||
| 6246 | fringe_bmp[i] = CreateBitmap (wd, h, 1, 1, w32bits); | ||
| 6247 | } | ||
| 6248 | } | ||
| 6249 | 6261 | ||
| 6250 | #ifndef F_SETOWN_BUG | 6262 | #ifndef F_SETOWN_BUG |
| 6251 | #ifdef F_SETOWN | 6263 | #ifdef F_SETOWN |
| @@ -6313,13 +6325,7 @@ x_delete_display (dpyinfo) | |||
| 6313 | xfree (dpyinfo->font_table); | 6325 | xfree (dpyinfo->font_table); |
| 6314 | xfree (dpyinfo->w32_id_name); | 6326 | xfree (dpyinfo->w32_id_name); |
| 6315 | 6327 | ||
| 6316 | /* Destroy row bitmaps. */ | 6328 | w32_reset_fringes (); |
| 6317 | { | ||
| 6318 | int i; | ||
| 6319 | |||
| 6320 | for (i = NO_FRINGE_BITMAP + 1; i < MAX_FRINGE_BITMAPS; i++) | ||
| 6321 | DeleteObject (fringe_bmp[i]); | ||
| 6322 | } | ||
| 6323 | } | 6329 | } |
| 6324 | 6330 | ||
| 6325 | /* Set up use of W32. */ | 6331 | /* Set up use of W32. */ |
| @@ -6350,6 +6356,8 @@ static struct redisplay_interface w32_redisplay_interface = | |||
| 6350 | w32_get_glyph_overhangs, | 6356 | w32_get_glyph_overhangs, |
| 6351 | x_fix_overlapping_area, | 6357 | x_fix_overlapping_area, |
| 6352 | w32_draw_fringe_bitmap, | 6358 | w32_draw_fringe_bitmap, |
| 6359 | w32_define_fringe_bitmap, | ||
| 6360 | w32_destroy_fringe_bitmap, | ||
| 6353 | w32_per_char_metric, | 6361 | w32_per_char_metric, |
| 6354 | w32_encode_char, | 6362 | w32_encode_char, |
| 6355 | NULL, /* w32_compute_glyph_string_overhangs */ | 6363 | NULL, /* w32_compute_glyph_string_overhangs */ |
diff --git a/src/window.c b/src/window.c index 363c8d0eaff..8f971ab0260 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -6018,9 +6018,7 @@ DEFUN ("window-fringes", Fwindow_fringes, Swindow_fringes, | |||
| 6018 | 0, 1, 0, | 6018 | 0, 1, 0, |
| 6019 | doc: /* Get width of fringes of window WINDOW. | 6019 | doc: /* Get width of fringes of window WINDOW. |
| 6020 | If WINDOW is omitted or nil, use the currently selected window. | 6020 | If WINDOW is omitted or nil, use the currently selected window. |
| 6021 | Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). | 6021 | Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */) |
| 6022 | If a window specific fringe width is not set, its width will be returned | ||
| 6023 | as nil. */) | ||
| 6024 | (window) | 6022 | (window) |
| 6025 | Lisp_Object window; | 6023 | Lisp_Object window; |
| 6026 | { | 6024 | { |
diff --git a/src/xdisp.c b/src/xdisp.c index 0e678b34897..edd7cc62e61 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -311,10 +311,7 @@ extern Lisp_Object Qscroll_bar; | |||
| 311 | Lisp_Object Vshow_trailing_whitespace; | 311 | Lisp_Object Vshow_trailing_whitespace; |
| 312 | 312 | ||
| 313 | #ifdef HAVE_WINDOW_SYSTEM | 313 | #ifdef HAVE_WINDOW_SYSTEM |
| 314 | /* Non-nil means that newline may flow into the right fringe. */ | 314 | extern Lisp_Object Voverflow_newline_into_fringe; |
| 315 | |||
| 316 | Lisp_Object Voverflow_newline_into_fringe; | ||
| 317 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 318 | 315 | ||
| 319 | /* Test if overflow newline into fringe. Called with iterator IT | 316 | /* Test if overflow newline into fringe. Called with iterator IT |
| 320 | at or past right window margin, and with IT->current_x set. */ | 317 | at or past right window margin, and with IT->current_x set. */ |
| @@ -325,6 +322,8 @@ Lisp_Object Voverflow_newline_into_fringe; | |||
| 325 | && WINDOW_RIGHT_FRINGE_WIDTH (it->w) > 0 \ | 322 | && WINDOW_RIGHT_FRINGE_WIDTH (it->w) > 0 \ |
| 326 | && it->current_x == it->last_visible_x) | 323 | && it->current_x == it->last_visible_x) |
| 327 | 324 | ||
| 325 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 326 | |||
| 328 | /* Non-nil means show the text cursor in void text areas | 327 | /* Non-nil means show the text cursor in void text areas |
| 329 | i.e. in blank areas after eol and eob. This used to be | 328 | i.e. in blank areas after eol and eob. This used to be |
| 330 | the default in 21.3. */ | 329 | the default in 21.3. */ |
| @@ -3275,6 +3274,8 @@ handle_display_prop (it) | |||
| 3275 | && !EQ (XCAR (prop), Qraise) | 3274 | && !EQ (XCAR (prop), Qraise) |
| 3276 | /* Marginal area specifications. */ | 3275 | /* Marginal area specifications. */ |
| 3277 | && !(CONSP (XCAR (prop)) && EQ (XCAR (XCAR (prop)), Qmargin)) | 3276 | && !(CONSP (XCAR (prop)) && EQ (XCAR (XCAR (prop)), Qmargin)) |
| 3277 | && !EQ (XCAR (prop), Qleft_fringe) | ||
| 3278 | && !EQ (XCAR (prop), Qright_fringe) | ||
| 3278 | && !NILP (XCAR (prop))) | 3279 | && !NILP (XCAR (prop))) |
| 3279 | { | 3280 | { |
| 3280 | for (; CONSP (prop); prop = XCDR (prop)) | 3281 | for (; CONSP (prop); prop = XCDR (prop)) |
| @@ -3481,6 +3482,43 @@ handle_single_display_prop (it, prop, object, position, | |||
| 3481 | } | 3482 | } |
| 3482 | #endif /* HAVE_WINDOW_SYSTEM */ | 3483 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 3483 | } | 3484 | } |
| 3485 | else if (CONSP (prop) | ||
| 3486 | && (EQ (XCAR (prop), Qleft_fringe) | ||
| 3487 | || EQ (XCAR (prop), Qright_fringe)) | ||
| 3488 | && CONSP (XCDR (prop))) | ||
| 3489 | { | ||
| 3490 | unsigned face_id = DEFAULT_FACE_ID; | ||
| 3491 | |||
| 3492 | /* `(left-fringe BITMAP FACE)'. */ | ||
| 3493 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) | ||
| 3494 | return 0; | ||
| 3495 | |||
| 3496 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 3497 | value = XCAR (XCDR (prop)); | ||
| 3498 | if (!NUMBERP (value) | ||
| 3499 | || !valid_fringe_bitmap_id_p (XINT (value))) | ||
| 3500 | return 0; | ||
| 3501 | |||
| 3502 | if (CONSP (XCDR (XCDR (prop)))) | ||
| 3503 | { | ||
| 3504 | Lisp_Object face_name = XCAR (XCDR (XCDR (prop))); | ||
| 3505 | face_id = lookup_named_face (it->f, face_name, 'A'); | ||
| 3506 | if (face_id < 0) | ||
| 3507 | return 0; | ||
| 3508 | } | ||
| 3509 | |||
| 3510 | if (EQ (XCAR (prop), Qleft_fringe)) | ||
| 3511 | { | ||
| 3512 | it->left_user_fringe_bitmap = XINT (value); | ||
| 3513 | it->left_user_fringe_face_id = face_id; | ||
| 3514 | } | ||
| 3515 | else | ||
| 3516 | { | ||
| 3517 | it->right_user_fringe_bitmap = XINT (value); | ||
| 3518 | it->right_user_fringe_face_id = face_id; | ||
| 3519 | } | ||
| 3520 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 3521 | } | ||
| 3484 | else if (!it->string_from_display_prop_p) | 3522 | else if (!it->string_from_display_prop_p) |
| 3485 | { | 3523 | { |
| 3486 | /* `((margin left-margin) VALUE)' or `((margin right-margin) | 3524 | /* `((margin left-margin) VALUE)' or `((margin right-margin) |
| @@ -5610,7 +5648,11 @@ move_it_in_display_line_to (it, to_charpos, to_x, op) | |||
| 5610 | #ifdef HAVE_WINDOW_SYSTEM | 5648 | #ifdef HAVE_WINDOW_SYSTEM |
| 5611 | if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) | 5649 | if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) |
| 5612 | { | 5650 | { |
| 5613 | get_next_display_element (it); | 5651 | if (!get_next_display_element (it)) |
| 5652 | { | ||
| 5653 | result = MOVE_POS_MATCH_OR_ZV; | ||
| 5654 | break; | ||
| 5655 | } | ||
| 5614 | if (ITERATOR_AT_END_OF_LINE_P (it)) | 5656 | if (ITERATOR_AT_END_OF_LINE_P (it)) |
| 5615 | { | 5657 | { |
| 5616 | result = MOVE_NEWLINE_OR_CR; | 5658 | result = MOVE_NEWLINE_OR_CR; |
| @@ -5678,7 +5720,11 @@ move_it_in_display_line_to (it, to_charpos, to_x, op) | |||
| 5678 | #ifdef HAVE_WINDOW_SYSTEM | 5720 | #ifdef HAVE_WINDOW_SYSTEM |
| 5679 | if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) | 5721 | if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) |
| 5680 | { | 5722 | { |
| 5681 | get_next_display_element (it); | 5723 | if (!get_next_display_element (it)) |
| 5724 | { | ||
| 5725 | result = MOVE_POS_MATCH_OR_ZV; | ||
| 5726 | break; | ||
| 5727 | } | ||
| 5682 | if (ITERATOR_AT_END_OF_LINE_P (it)) | 5728 | if (ITERATOR_AT_END_OF_LINE_P (it)) |
| 5683 | { | 5729 | { |
| 5684 | result = MOVE_NEWLINE_OR_CR; | 5730 | result = MOVE_NEWLINE_OR_CR; |
| @@ -7614,7 +7660,10 @@ clear_garbaged_frames () | |||
| 7614 | if (FRAME_VISIBLE_P (f) && FRAME_GARBAGED_P (f)) | 7660 | if (FRAME_VISIBLE_P (f) && FRAME_GARBAGED_P (f)) |
| 7615 | { | 7661 | { |
| 7616 | if (f->resized_p) | 7662 | if (f->resized_p) |
| 7617 | Fredraw_frame (frame); | 7663 | { |
| 7664 | Fredraw_frame (frame); | ||
| 7665 | f->force_flush_display_p = 1; | ||
| 7666 | } | ||
| 7618 | clear_current_matrices (f); | 7667 | clear_current_matrices (f); |
| 7619 | changed_count++; | 7668 | changed_count++; |
| 7620 | f->garbaged = 0; | 7669 | f->garbaged = 0; |
| @@ -8928,536 +8977,6 @@ note_tool_bar_highlight (f, x, y) | |||
| 8928 | 8977 | ||
| 8929 | 8978 | ||
| 8930 | 8979 | ||
| 8931 | /*********************************************************************** | ||
| 8932 | Fringes | ||
| 8933 | ***********************************************************************/ | ||
| 8934 | |||
| 8935 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 8936 | |||
| 8937 | /* Notice that all bitmaps bits are "mirrored". */ | ||
| 8938 | |||
| 8939 | /* An arrow like this: `<-'. */ | ||
| 8940 | /* | ||
| 8941 | ...xx... | ||
| 8942 | ....xx.. | ||
| 8943 | .....xx. | ||
| 8944 | ..xxxxxx | ||
| 8945 | ..xxxxxx | ||
| 8946 | .....xx. | ||
| 8947 | ....xx.. | ||
| 8948 | ...xx... | ||
| 8949 | */ | ||
| 8950 | static unsigned char left_bits[] = { | ||
| 8951 | 0x18, 0x0c, 0x06, 0x3f, 0x3f, 0x06, 0x0c, 0x18}; | ||
| 8952 | |||
| 8953 | |||
| 8954 | /* Right truncation arrow bitmap `->'. */ | ||
| 8955 | /* | ||
| 8956 | ...xx... | ||
| 8957 | ..xx.... | ||
| 8958 | .xx..... | ||
| 8959 | xxxxxx.. | ||
| 8960 | xxxxxx.. | ||
| 8961 | .xx..... | ||
| 8962 | ..xx.... | ||
| 8963 | ...xx... | ||
| 8964 | */ | ||
| 8965 | static unsigned char right_bits[] = { | ||
| 8966 | 0x18, 0x30, 0x60, 0xfc, 0xfc, 0x60, 0x30, 0x18}; | ||
| 8967 | |||
| 8968 | |||
| 8969 | /* Up arrow bitmap. */ | ||
| 8970 | /* | ||
| 8971 | ...xx... | ||
| 8972 | ..xxxx.. | ||
| 8973 | .xxxxxx. | ||
| 8974 | xxxxxxxx | ||
| 8975 | ...xx... | ||
| 8976 | ...xx... | ||
| 8977 | ...xx... | ||
| 8978 | ...xx... | ||
| 8979 | */ | ||
| 8980 | static unsigned char up_arrow_bits[] = { | ||
| 8981 | 0x18, 0x3c, 0x7e, 0xff, 0x18, 0x18, 0x18, 0x18}; | ||
| 8982 | |||
| 8983 | |||
| 8984 | /* Down arrow bitmap. */ | ||
| 8985 | /* | ||
| 8986 | ...xx... | ||
| 8987 | ...xx... | ||
| 8988 | ...xx... | ||
| 8989 | ...xx... | ||
| 8990 | xxxxxxxx | ||
| 8991 | .xxxxxx. | ||
| 8992 | ..xxxx.. | ||
| 8993 | ...xx... | ||
| 8994 | */ | ||
| 8995 | static unsigned char down_arrow_bits[] = { | ||
| 8996 | 0x18, 0x18, 0x18, 0x18, 0xff, 0x7e, 0x3c, 0x18}; | ||
| 8997 | |||
| 8998 | /* Marker for continued lines. */ | ||
| 8999 | /* | ||
| 9000 | ..xxxx.. | ||
| 9001 | .xxxxx.. | ||
| 9002 | xx...... | ||
| 9003 | xxx..x.. | ||
| 9004 | xxxxxx.. | ||
| 9005 | .xxxxx.. | ||
| 9006 | ..xxxx.. | ||
| 9007 | .xxxxx.. | ||
| 9008 | */ | ||
| 9009 | static unsigned char continued_bits[] = { | ||
| 9010 | 0x3c, 0x7c, 0xc0, 0xe4, 0xfc, 0x7c, 0x3c, 0x7c}; | ||
| 9011 | |||
| 9012 | /* Marker for continuation lines. */ | ||
| 9013 | /* | ||
| 9014 | ..xxxx.. | ||
| 9015 | ..xxxxx. | ||
| 9016 | ......xx | ||
| 9017 | ..x..xxx | ||
| 9018 | ..xxxxxx | ||
| 9019 | ..xxxxx. | ||
| 9020 | ..xxxx.. | ||
| 9021 | ..xxxxx. | ||
| 9022 | */ | ||
| 9023 | static unsigned char continuation_bits[] = { | ||
| 9024 | 0x3c, 0x3e, 0x03, 0x27, 0x3f, 0x3e, 0x3c, 0x3e}; | ||
| 9025 | |||
| 9026 | /* Overlay arrow bitmap. A triangular arrow. */ | ||
| 9027 | /* | ||
| 9028 | ......xx | ||
| 9029 | ....xxxx | ||
| 9030 | ...xxxxx | ||
| 9031 | ..xxxxxx | ||
| 9032 | ..xxxxxx | ||
| 9033 | ...xxxxx | ||
| 9034 | ....xxxx | ||
| 9035 | ......xx | ||
| 9036 | */ | ||
| 9037 | static unsigned char ov_bits[] = { | ||
| 9038 | 0x03, 0x0f, 0x1f, 0x3f, 0x3f, 0x1f, 0x0f, 0x03}; | ||
| 9039 | |||
| 9040 | |||
| 9041 | /* First line bitmap. An left-up angle. */ | ||
| 9042 | /* | ||
| 9043 | ..xxxxxx | ||
| 9044 | ..xxxxxx | ||
| 9045 | ......xx | ||
| 9046 | ......xx | ||
| 9047 | ......xx | ||
| 9048 | ......xx | ||
| 9049 | ......xx | ||
| 9050 | ........ | ||
| 9051 | */ | ||
| 9052 | static unsigned char first_line_bits[] = { | ||
| 9053 | 0x3f, 0x3f, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00}; | ||
| 9054 | |||
| 9055 | |||
| 9056 | /* Last line bitmap. An left-down angle. */ | ||
| 9057 | /* | ||
| 9058 | ........ | ||
| 9059 | xx...... | ||
| 9060 | xx...... | ||
| 9061 | xx...... | ||
| 9062 | xx...... | ||
| 9063 | xx...... | ||
| 9064 | xxxxxx.. | ||
| 9065 | xxxxxx.. | ||
| 9066 | */ | ||
| 9067 | static unsigned char last_line_bits[] = { | ||
| 9068 | 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xfc, 0xfc}; | ||
| 9069 | |||
| 9070 | /* Filled box cursor bitmap. A filled box; max 13 pixels high. */ | ||
| 9071 | /* | ||
| 9072 | .xxxxxxx | ||
| 9073 | .xxxxxxx | ||
| 9074 | .xxxxxxx | ||
| 9075 | .xxxxxxx | ||
| 9076 | .xxxxxxx | ||
| 9077 | .xxxxxxx | ||
| 9078 | .xxxxxxx | ||
| 9079 | .xxxxxxx | ||
| 9080 | .xxxxxxx | ||
| 9081 | .xxxxxxx | ||
| 9082 | .xxxxxxx | ||
| 9083 | .xxxxxxx | ||
| 9084 | .xxxxxxx | ||
| 9085 | */ | ||
| 9086 | static unsigned char filled_box_cursor_bits[] = { | ||
| 9087 | 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f}; | ||
| 9088 | |||
| 9089 | /* Hollow box cursor bitmap. A hollow box; max 13 pixels high. */ | ||
| 9090 | /* | ||
| 9091 | .xxxxxxx | ||
| 9092 | .x.....x | ||
| 9093 | .x.....x | ||
| 9094 | .x.....x | ||
| 9095 | .x.....x | ||
| 9096 | .x.....x | ||
| 9097 | .x.....x | ||
| 9098 | .x.....x | ||
| 9099 | .x.....x | ||
| 9100 | .x.....x | ||
| 9101 | .x.....x | ||
| 9102 | .x.....x | ||
| 9103 | .xxxxxxx | ||
| 9104 | */ | ||
| 9105 | static unsigned char hollow_box_cursor_bits[] = { | ||
| 9106 | 0x7f, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x7f}; | ||
| 9107 | |||
| 9108 | /* Bar cursor bitmap. A vertical bar; max 13 pixels high. */ | ||
| 9109 | /* | ||
| 9110 | ......xx | ||
| 9111 | ......xx | ||
| 9112 | ......xx | ||
| 9113 | ......xx | ||
| 9114 | ......xx | ||
| 9115 | ......xx | ||
| 9116 | ......xx | ||
| 9117 | ......xx | ||
| 9118 | ......xx | ||
| 9119 | ......xx | ||
| 9120 | ......xx | ||
| 9121 | ......xx | ||
| 9122 | ......xx | ||
| 9123 | */ | ||
| 9124 | static unsigned char bar_cursor_bits[] = { | ||
| 9125 | 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}; | ||
| 9126 | |||
| 9127 | /* HBar cursor bitmap. A horisontal bar; 2 pixels high. */ | ||
| 9128 | /* | ||
| 9129 | .xxxxxxx | ||
| 9130 | .xxxxxxx | ||
| 9131 | */ | ||
| 9132 | static unsigned char hbar_cursor_bits[] = { | ||
| 9133 | 0x7f, 0x7f}; | ||
| 9134 | |||
| 9135 | |||
| 9136 | /* Bitmap drawn to indicate lines not displaying text if | ||
| 9137 | `indicate-empty-lines' is non-nil. */ | ||
| 9138 | static unsigned char zv_bits[] = { | ||
| 9139 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 9140 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 9141 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 9142 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 9143 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 9144 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 9145 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | ||
| 9146 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00}; | ||
| 9147 | |||
| 9148 | /* Hollow square bitmap. */ | ||
| 9149 | /* | ||
| 9150 | .xxxxxx. | ||
| 9151 | .x....x. | ||
| 9152 | .x....x. | ||
| 9153 | .x....x. | ||
| 9154 | .x....x. | ||
| 9155 | .xxxxxx. | ||
| 9156 | */ | ||
| 9157 | static unsigned char hollow_square_bits[] = { | ||
| 9158 | 0x7e, 0x42, 0x42, 0x42, 0x42, 0x7e}; | ||
| 9159 | |||
| 9160 | |||
| 9161 | struct fringe_bitmap fringe_bitmaps[MAX_FRINGE_BITMAPS] = | ||
| 9162 | { | ||
| 9163 | { 0, 0, 0, NULL /* NO_FRINGE_BITMAP */ }, | ||
| 9164 | { 8, sizeof (left_bits), 0, left_bits }, | ||
| 9165 | { 8, sizeof (right_bits), 0, right_bits }, | ||
| 9166 | { 8, sizeof (up_arrow_bits), -1, up_arrow_bits }, | ||
| 9167 | { 8, sizeof (down_arrow_bits), -2, down_arrow_bits }, | ||
| 9168 | { 8, sizeof (continued_bits), 0, continued_bits }, | ||
| 9169 | { 8, sizeof (continuation_bits), 0, continuation_bits }, | ||
| 9170 | { 8, sizeof (ov_bits), 0, ov_bits }, | ||
| 9171 | { 8, sizeof (first_line_bits), -1, first_line_bits }, | ||
| 9172 | { 8, sizeof (last_line_bits), -2, last_line_bits }, | ||
| 9173 | { 8, sizeof (filled_box_cursor_bits), 0, filled_box_cursor_bits }, | ||
| 9174 | { 8, sizeof (hollow_box_cursor_bits), 0, hollow_box_cursor_bits }, | ||
| 9175 | { 8, sizeof (bar_cursor_bits), 0, bar_cursor_bits }, | ||
| 9176 | { 8, sizeof (hbar_cursor_bits), -2, hbar_cursor_bits }, | ||
| 9177 | { 8, sizeof (zv_bits), 3, zv_bits }, | ||
| 9178 | { 8, sizeof (hollow_square_bits), 0, hollow_square_bits }, | ||
| 9179 | }; | ||
| 9180 | |||
| 9181 | |||
| 9182 | /* Draw the bitmap WHICH in one of the left or right fringes of | ||
| 9183 | window W. ROW is the glyph row for which to display the bitmap; it | ||
| 9184 | determines the vertical position at which the bitmap has to be | ||
| 9185 | drawn. | ||
| 9186 | LEFT_P is 1 for left fringe, 0 for right fringe. | ||
| 9187 | */ | ||
| 9188 | |||
| 9189 | void | ||
| 9190 | draw_fringe_bitmap (w, row, left_p) | ||
| 9191 | struct window *w; | ||
| 9192 | struct glyph_row *row; | ||
| 9193 | int left_p; | ||
| 9194 | { | ||
| 9195 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | ||
| 9196 | struct draw_fringe_bitmap_params p; | ||
| 9197 | enum fringe_bitmap_type which; | ||
| 9198 | int period; | ||
| 9199 | |||
| 9200 | if (left_p) | ||
| 9201 | which = row->left_fringe_bitmap; | ||
| 9202 | else if (!row->cursor_in_fringe_p) | ||
| 9203 | which = row->right_fringe_bitmap; | ||
| 9204 | else | ||
| 9205 | switch (w->phys_cursor_type) | ||
| 9206 | { | ||
| 9207 | case HOLLOW_BOX_CURSOR: | ||
| 9208 | if (row->visible_height >= sizeof(hollow_box_cursor_bits)) | ||
| 9209 | which = HOLLOW_BOX_CURSOR_BITMAP; | ||
| 9210 | else | ||
| 9211 | which = HOLLOW_SQUARE_BITMAP; | ||
| 9212 | break; | ||
| 9213 | case FILLED_BOX_CURSOR: | ||
| 9214 | which = FILLED_BOX_CURSOR_BITMAP; | ||
| 9215 | break; | ||
| 9216 | case BAR_CURSOR: | ||
| 9217 | which = BAR_CURSOR_BITMAP; | ||
| 9218 | break; | ||
| 9219 | case HBAR_CURSOR: | ||
| 9220 | which = HBAR_CURSOR_BITMAP; | ||
| 9221 | break; | ||
| 9222 | case NO_CURSOR: | ||
| 9223 | default: | ||
| 9224 | w->phys_cursor_on_p = 0; | ||
| 9225 | row->cursor_in_fringe_p = 0; | ||
| 9226 | which = row->right_fringe_bitmap; | ||
| 9227 | break; | ||
| 9228 | } | ||
| 9229 | |||
| 9230 | period = fringe_bitmaps[which].period; | ||
| 9231 | |||
| 9232 | /* Convert row to frame coordinates. */ | ||
| 9233 | p.y = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); | ||
| 9234 | |||
| 9235 | p.which = which; | ||
| 9236 | p.wd = fringe_bitmaps[which].width; | ||
| 9237 | |||
| 9238 | p.h = fringe_bitmaps[which].height; | ||
| 9239 | p.dh = (period > 0 ? (p.y % period) : 0); | ||
| 9240 | p.h -= p.dh; | ||
| 9241 | /* Clip bitmap if too high. */ | ||
| 9242 | if (p.h > row->height) | ||
| 9243 | p.h = row->height; | ||
| 9244 | |||
| 9245 | p.face = FACE_FROM_ID (f, FRINGE_FACE_ID); | ||
| 9246 | PREPARE_FACE_FOR_DISPLAY (f, p.face); | ||
| 9247 | |||
| 9248 | /* Clear left fringe if no bitmap to draw or if bitmap doesn't fill | ||
| 9249 | the fringe. */ | ||
| 9250 | p.bx = -1; | ||
| 9251 | if (left_p) | ||
| 9252 | { | ||
| 9253 | int wd = WINDOW_LEFT_FRINGE_WIDTH (w); | ||
| 9254 | int x = window_box_left (w, (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | ||
| 9255 | ? LEFT_MARGIN_AREA | ||
| 9256 | : TEXT_AREA)); | ||
| 9257 | if (p.wd > wd) | ||
| 9258 | p.wd = wd; | ||
| 9259 | p.x = x - p.wd - (wd - p.wd) / 2; | ||
| 9260 | |||
| 9261 | if (p.wd < wd || row->height > p.h) | ||
| 9262 | { | ||
| 9263 | /* If W has a vertical border to its left, don't draw over it. */ | ||
| 9264 | wd -= ((!WINDOW_LEFTMOST_P (w) | ||
| 9265 | && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w)) | ||
| 9266 | ? 1 : 0); | ||
| 9267 | p.bx = x - wd; | ||
| 9268 | p.nx = wd; | ||
| 9269 | } | ||
| 9270 | } | ||
| 9271 | else | ||
| 9272 | { | ||
| 9273 | int x = window_box_right (w, | ||
| 9274 | (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | ||
| 9275 | ? RIGHT_MARGIN_AREA | ||
| 9276 | : TEXT_AREA)); | ||
| 9277 | int wd = WINDOW_RIGHT_FRINGE_WIDTH (w); | ||
| 9278 | if (p.wd > wd) | ||
| 9279 | p.wd = wd; | ||
| 9280 | p.x = x + (wd - p.wd) / 2; | ||
| 9281 | /* Clear right fringe if no bitmap to draw of if bitmap doesn't fill | ||
| 9282 | the fringe. */ | ||
| 9283 | if (p.wd < wd || row->height > p.h) | ||
| 9284 | { | ||
| 9285 | p.bx = x; | ||
| 9286 | p.nx = wd; | ||
| 9287 | } | ||
| 9288 | } | ||
| 9289 | |||
| 9290 | if (p.bx >= 0) | ||
| 9291 | { | ||
| 9292 | int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); | ||
| 9293 | |||
| 9294 | p.by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, row->y)); | ||
| 9295 | p.ny = row->visible_height; | ||
| 9296 | } | ||
| 9297 | |||
| 9298 | /* Adjust y to the offset in the row to start drawing the bitmap. */ | ||
| 9299 | if (period == 0) | ||
| 9300 | p.y += (row->height - p.h) / 2; | ||
| 9301 | else if (period == -2) | ||
| 9302 | { | ||
| 9303 | p.h = fringe_bitmaps[which].height; | ||
| 9304 | p.y += (row->visible_height - p.h); | ||
| 9305 | } | ||
| 9306 | |||
| 9307 | FRAME_RIF (f)->draw_fringe_bitmap (w, row, &p); | ||
| 9308 | } | ||
| 9309 | |||
| 9310 | /* Draw fringe bitmaps for glyph row ROW on window W. Call this | ||
| 9311 | function with input blocked. */ | ||
| 9312 | |||
| 9313 | void | ||
| 9314 | draw_row_fringe_bitmaps (w, row) | ||
| 9315 | struct window *w; | ||
| 9316 | struct glyph_row *row; | ||
| 9317 | { | ||
| 9318 | xassert (interrupt_input_blocked); | ||
| 9319 | |||
| 9320 | /* If row is completely invisible, because of vscrolling, we | ||
| 9321 | don't have to draw anything. */ | ||
| 9322 | if (row->visible_height <= 0) | ||
| 9323 | return; | ||
| 9324 | |||
| 9325 | if (WINDOW_LEFT_FRINGE_WIDTH (w) != 0) | ||
| 9326 | draw_fringe_bitmap (w, row, 1); | ||
| 9327 | |||
| 9328 | if (WINDOW_RIGHT_FRINGE_WIDTH (w) != 0) | ||
| 9329 | draw_fringe_bitmap (w, row, 0); | ||
| 9330 | } | ||
| 9331 | |||
| 9332 | /* Draw the fringes of window W. Only fringes for rows marked for | ||
| 9333 | update in redraw_fringe_bitmaps_p are drawn. */ | ||
| 9334 | |||
| 9335 | void | ||
| 9336 | draw_window_fringes (w) | ||
| 9337 | struct window *w; | ||
| 9338 | { | ||
| 9339 | struct glyph_row *row; | ||
| 9340 | int yb = window_text_bottom_y (w); | ||
| 9341 | int nrows = w->current_matrix->nrows; | ||
| 9342 | int y = 0, rn; | ||
| 9343 | |||
| 9344 | if (w->pseudo_window_p) | ||
| 9345 | return; | ||
| 9346 | |||
| 9347 | for (y = 0, rn = 0, row = w->current_matrix->rows; | ||
| 9348 | y < yb && rn < nrows; | ||
| 9349 | y += row->height, ++row, ++rn) | ||
| 9350 | { | ||
| 9351 | if (!row->redraw_fringe_bitmaps_p) | ||
| 9352 | continue; | ||
| 9353 | draw_row_fringe_bitmaps (w, row); | ||
| 9354 | row->redraw_fringe_bitmaps_p = 0; | ||
| 9355 | } | ||
| 9356 | } | ||
| 9357 | |||
| 9358 | |||
| 9359 | /* Compute actual fringe widths for frame F. | ||
| 9360 | |||
| 9361 | If REDRAW is 1, redraw F if the fringe settings was actually | ||
| 9362 | modified and F is visible. | ||
| 9363 | |||
| 9364 | Since the combined left and right fringe must occupy an integral | ||
| 9365 | number of columns, we may need to add some pixels to each fringe. | ||
| 9366 | Typically, we add an equal amount (+/- 1 pixel) to each fringe, | ||
| 9367 | but a negative width value is taken literally (after negating it). | ||
| 9368 | |||
| 9369 | We never make the fringes narrower than specified. It is planned | ||
| 9370 | to make fringe bitmaps customizable and expandable, and at that | ||
| 9371 | time, the user will typically specify the minimum number of pixels | ||
| 9372 | needed for his bitmaps, so we shouldn't select anything less than | ||
| 9373 | what is specified. | ||
| 9374 | */ | ||
| 9375 | |||
| 9376 | void | ||
| 9377 | compute_fringe_widths (f, redraw) | ||
| 9378 | struct frame *f; | ||
| 9379 | int redraw; | ||
| 9380 | { | ||
| 9381 | int o_left = FRAME_LEFT_FRINGE_WIDTH (f); | ||
| 9382 | int o_right = FRAME_RIGHT_FRINGE_WIDTH (f); | ||
| 9383 | int o_cols = FRAME_FRINGE_COLS (f); | ||
| 9384 | |||
| 9385 | Lisp_Object left_fringe = Fassq (Qleft_fringe, f->param_alist); | ||
| 9386 | Lisp_Object right_fringe = Fassq (Qright_fringe, f->param_alist); | ||
| 9387 | int left_fringe_width, right_fringe_width; | ||
| 9388 | |||
| 9389 | if (!NILP (left_fringe)) | ||
| 9390 | left_fringe = Fcdr (left_fringe); | ||
| 9391 | if (!NILP (right_fringe)) | ||
| 9392 | right_fringe = Fcdr (right_fringe); | ||
| 9393 | |||
| 9394 | left_fringe_width = ((NILP (left_fringe) || !INTEGERP (left_fringe)) ? 8 : | ||
| 9395 | XINT (left_fringe)); | ||
| 9396 | right_fringe_width = ((NILP (right_fringe) || !INTEGERP (right_fringe)) ? 8 : | ||
| 9397 | XINT (right_fringe)); | ||
| 9398 | |||
| 9399 | if (left_fringe_width || right_fringe_width) | ||
| 9400 | { | ||
| 9401 | int left_wid = left_fringe_width >= 0 ? left_fringe_width : -left_fringe_width; | ||
| 9402 | int right_wid = right_fringe_width >= 0 ? right_fringe_width : -right_fringe_width; | ||
| 9403 | int conf_wid = left_wid + right_wid; | ||
| 9404 | int font_wid = FRAME_COLUMN_WIDTH (f); | ||
| 9405 | int cols = (left_wid + right_wid + font_wid-1) / font_wid; | ||
| 9406 | int real_wid = cols * font_wid; | ||
| 9407 | if (left_wid && right_wid) | ||
| 9408 | { | ||
| 9409 | if (left_fringe_width < 0) | ||
| 9410 | { | ||
| 9411 | /* Left fringe width is fixed, adjust right fringe if necessary */ | ||
| 9412 | FRAME_LEFT_FRINGE_WIDTH (f) = left_wid; | ||
| 9413 | FRAME_RIGHT_FRINGE_WIDTH (f) = real_wid - left_wid; | ||
| 9414 | } | ||
| 9415 | else if (right_fringe_width < 0) | ||
| 9416 | { | ||
| 9417 | /* Right fringe width is fixed, adjust left fringe if necessary */ | ||
| 9418 | FRAME_LEFT_FRINGE_WIDTH (f) = real_wid - right_wid; | ||
| 9419 | FRAME_RIGHT_FRINGE_WIDTH (f) = right_wid; | ||
| 9420 | } | ||
| 9421 | else | ||
| 9422 | { | ||
| 9423 | /* Adjust both fringes with an equal amount. | ||
| 9424 | Note that we are doing integer arithmetic here, so don't | ||
| 9425 | lose a pixel if the total width is an odd number. */ | ||
| 9426 | int fill = real_wid - conf_wid; | ||
| 9427 | FRAME_LEFT_FRINGE_WIDTH (f) = left_wid + fill/2; | ||
| 9428 | FRAME_RIGHT_FRINGE_WIDTH (f) = right_wid + fill - fill/2; | ||
| 9429 | } | ||
| 9430 | } | ||
| 9431 | else if (left_fringe_width) | ||
| 9432 | { | ||
| 9433 | FRAME_LEFT_FRINGE_WIDTH (f) = real_wid; | ||
| 9434 | FRAME_RIGHT_FRINGE_WIDTH (f) = 0; | ||
| 9435 | } | ||
| 9436 | else | ||
| 9437 | { | ||
| 9438 | FRAME_LEFT_FRINGE_WIDTH (f) = 0; | ||
| 9439 | FRAME_RIGHT_FRINGE_WIDTH (f) = real_wid; | ||
| 9440 | } | ||
| 9441 | FRAME_FRINGE_COLS (f) = cols; | ||
| 9442 | } | ||
| 9443 | else | ||
| 9444 | { | ||
| 9445 | FRAME_LEFT_FRINGE_WIDTH (f) = 0; | ||
| 9446 | FRAME_RIGHT_FRINGE_WIDTH (f) = 0; | ||
| 9447 | FRAME_FRINGE_COLS (f) = 0; | ||
| 9448 | } | ||
| 9449 | |||
| 9450 | if (redraw && FRAME_VISIBLE_P (f)) | ||
| 9451 | if (o_left != FRAME_LEFT_FRINGE_WIDTH (f) || | ||
| 9452 | o_right != FRAME_RIGHT_FRINGE_WIDTH (f) || | ||
| 9453 | o_cols != FRAME_FRINGE_COLS (f)) | ||
| 9454 | redraw_frame (f); | ||
| 9455 | } | ||
| 9456 | |||
| 9457 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 9458 | |||
| 9459 | |||
| 9460 | |||
| 9461 | /************************************************************************ | 8980 | /************************************************************************ |
| 9462 | Horizontal scrolling | 8981 | Horizontal scrolling |
| 9463 | ************************************************************************/ | 8982 | ************************************************************************/ |
| @@ -9558,7 +9077,10 @@ hscroll_window_tree (window) | |||
| 9558 | 9077 | ||
| 9559 | /* Position cursor in window. */ | 9078 | /* Position cursor in window. */ |
| 9560 | if (!hscroll_relative_p && hscroll_step_abs == 0) | 9079 | if (!hscroll_relative_p && hscroll_step_abs == 0) |
| 9561 | hscroll = max (0, it.current_x - text_area_width / 2) | 9080 | hscroll = max (0, (it.current_x |
| 9081 | - (ITERATOR_AT_END_OF_LINE_P (&it) | ||
| 9082 | ? (text_area_width - 4 * FRAME_COLUMN_WIDTH (it.f)) | ||
| 9083 | : (text_area_width / 2)))) | ||
| 9562 | / FRAME_COLUMN_WIDTH (it.f); | 9084 | / FRAME_COLUMN_WIDTH (it.f); |
| 9563 | else if (w->cursor.x >= text_area_width - h_margin) | 9085 | else if (w->cursor.x >= text_area_width - h_margin) |
| 9564 | { | 9086 | { |
| @@ -11674,136 +11196,6 @@ set_vertical_scroll_bar (w) | |||
| 11674 | (w, end - start, whole, start); | 11196 | (w, end - start, whole, start); |
| 11675 | } | 11197 | } |
| 11676 | 11198 | ||
| 11677 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 11678 | |||
| 11679 | /* Recalculate the bitmaps to show in the fringes of window W. | ||
| 11680 | If FORCE_P is 0, only mark rows with modified bitmaps for update in | ||
| 11681 | redraw_fringe_bitmaps_p; else mark all rows for update. */ | ||
| 11682 | |||
| 11683 | int | ||
| 11684 | update_window_fringes (w, force_p) | ||
| 11685 | struct window *w; | ||
| 11686 | int force_p; | ||
| 11687 | { | ||
| 11688 | struct glyph_row *row, *cur = 0; | ||
| 11689 | int yb = window_text_bottom_y (w); | ||
| 11690 | int rn, nrows = w->current_matrix->nrows; | ||
| 11691 | int y; | ||
| 11692 | int redraw_p = 0; | ||
| 11693 | Lisp_Object ind; | ||
| 11694 | |||
| 11695 | if (w->pseudo_window_p) | ||
| 11696 | return 0; | ||
| 11697 | |||
| 11698 | if (!MINI_WINDOW_P (w) | ||
| 11699 | && (ind = XBUFFER (w->buffer)->indicate_buffer_boundaries, !NILP (ind))) | ||
| 11700 | { | ||
| 11701 | int do_eob = 1, do_bob = 1; | ||
| 11702 | |||
| 11703 | for (y = 0, rn = 0; | ||
| 11704 | y < yb && rn < nrows; | ||
| 11705 | y += row->height, ++rn) | ||
| 11706 | { | ||
| 11707 | unsigned indicate_bob_p, indicate_top_line_p; | ||
| 11708 | unsigned indicate_eob_p, indicate_bottom_line_p; | ||
| 11709 | |||
| 11710 | row = w->desired_matrix->rows + rn; | ||
| 11711 | if (!row->enabled_p) | ||
| 11712 | row = w->current_matrix->rows + rn; | ||
| 11713 | |||
| 11714 | indicate_bob_p = row->indicate_bob_p; | ||
| 11715 | indicate_top_line_p = row->indicate_top_line_p; | ||
| 11716 | indicate_eob_p = row->indicate_eob_p; | ||
| 11717 | indicate_bottom_line_p = row->indicate_bottom_line_p; | ||
| 11718 | |||
| 11719 | row->indicate_bob_p = row->indicate_top_line_p = 0; | ||
| 11720 | row->indicate_eob_p = row->indicate_bottom_line_p = 0; | ||
| 11721 | |||
| 11722 | if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer))) | ||
| 11723 | row->indicate_bob_p = do_bob, do_bob = 0; | ||
| 11724 | else if (EQ (ind, Qt) | ||
| 11725 | && (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) == rn) | ||
| 11726 | row->indicate_top_line_p = 1; | ||
| 11727 | |||
| 11728 | if (MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer))) | ||
| 11729 | row->indicate_eob_p = do_eob, do_eob = 0; | ||
| 11730 | else if (EQ (ind, Qt) | ||
| 11731 | && y + row->height >= yb) | ||
| 11732 | row->indicate_bottom_line_p = 1; | ||
| 11733 | |||
| 11734 | if (indicate_bob_p != row->indicate_bob_p | ||
| 11735 | || indicate_top_line_p != row->indicate_top_line_p | ||
| 11736 | || indicate_eob_p != row->indicate_eob_p | ||
| 11737 | || indicate_bottom_line_p != row->indicate_bottom_line_p) | ||
| 11738 | row->redraw_fringe_bitmaps_p = 1; | ||
| 11739 | } | ||
| 11740 | } | ||
| 11741 | |||
| 11742 | for (y = 0, rn = 0; | ||
| 11743 | y < yb && rn < nrows; | ||
| 11744 | y += row->height, rn++) | ||
| 11745 | { | ||
| 11746 | enum fringe_bitmap_type left, right; | ||
| 11747 | |||
| 11748 | row = w->desired_matrix->rows + rn; | ||
| 11749 | cur = w->current_matrix->rows + rn; | ||
| 11750 | if (!row->enabled_p) | ||
| 11751 | row = cur; | ||
| 11752 | |||
| 11753 | /* Decide which bitmap to draw in the left fringe. */ | ||
| 11754 | if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0) | ||
| 11755 | left = NO_FRINGE_BITMAP; | ||
| 11756 | else if (row->overlay_arrow_p) | ||
| 11757 | left = OVERLAY_ARROW_BITMAP; | ||
| 11758 | else if (row->truncated_on_left_p) | ||
| 11759 | left = LEFT_TRUNCATION_BITMAP; | ||
| 11760 | else if (MATRIX_ROW_CONTINUATION_LINE_P (row)) | ||
| 11761 | left = CONTINUATION_LINE_BITMAP; | ||
| 11762 | else if (row->indicate_empty_line_p) | ||
| 11763 | left = ZV_LINE_BITMAP; | ||
| 11764 | else if (row->indicate_bob_p) | ||
| 11765 | left = FIRST_LINE_BITMAP; | ||
| 11766 | else | ||
| 11767 | left = NO_FRINGE_BITMAP; | ||
| 11768 | |||
| 11769 | /* Decide which bitmap to draw in the right fringe. */ | ||
| 11770 | if (WINDOW_RIGHT_FRINGE_WIDTH (w) == 0) | ||
| 11771 | right = NO_FRINGE_BITMAP; | ||
| 11772 | else if (row->truncated_on_right_p) | ||
| 11773 | right = RIGHT_TRUNCATION_BITMAP; | ||
| 11774 | else if (row->continued_p) | ||
| 11775 | right = CONTINUED_LINE_BITMAP; | ||
| 11776 | else if (row->indicate_eob_p) | ||
| 11777 | right = LAST_LINE_BITMAP; | ||
| 11778 | else if (row->indicate_top_line_p) | ||
| 11779 | right = UP_ARROW_BITMAP; | ||
| 11780 | else if (row->indicate_bottom_line_p) | ||
| 11781 | right = DOWN_ARROW_BITMAP; | ||
| 11782 | else if (row->indicate_empty_line_p && WINDOW_LEFT_FRINGE_WIDTH (w) == 0) | ||
| 11783 | right = ZV_LINE_BITMAP; | ||
| 11784 | else | ||
| 11785 | right = NO_FRINGE_BITMAP; | ||
| 11786 | |||
| 11787 | if (force_p | ||
| 11788 | || row->y != cur->y | ||
| 11789 | || row->visible_height != cur->visible_height | ||
| 11790 | || left != cur->left_fringe_bitmap | ||
| 11791 | || right != cur->right_fringe_bitmap | ||
| 11792 | || cur->redraw_fringe_bitmaps_p) | ||
| 11793 | { | ||
| 11794 | redraw_p = row->redraw_fringe_bitmaps_p = cur->redraw_fringe_bitmaps_p = 1; | ||
| 11795 | cur->left_fringe_bitmap = left; | ||
| 11796 | cur->right_fringe_bitmap = right; | ||
| 11797 | } | ||
| 11798 | |||
| 11799 | row->left_fringe_bitmap = left; | ||
| 11800 | row->right_fringe_bitmap = right; | ||
| 11801 | } | ||
| 11802 | |||
| 11803 | return redraw_p; | ||
| 11804 | } | ||
| 11805 | |||
| 11806 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 11807 | 11199 | ||
| 11808 | /* Redisplay leaf window WINDOW. JUST_THIS_ONE_P non-zero means only | 11200 | /* Redisplay leaf window WINDOW. JUST_THIS_ONE_P non-zero means only |
| 11809 | selected_window is redisplayed. | 11201 | selected_window is redisplayed. |
| @@ -12494,6 +11886,7 @@ redisplay_window (window, just_this_one_p) | |||
| 12494 | 11886 | ||
| 12495 | #ifdef HAVE_WINDOW_SYSTEM | 11887 | #ifdef HAVE_WINDOW_SYSTEM |
| 12496 | if (update_window_fringes (w, 0) | 11888 | if (update_window_fringes (w, 0) |
| 11889 | && !just_this_one_p | ||
| 12497 | && (used_current_matrix_p || overlay_arrow_seen) | 11890 | && (used_current_matrix_p || overlay_arrow_seen) |
| 12498 | && !w->pseudo_window_p) | 11891 | && !w->pseudo_window_p) |
| 12499 | { | 11892 | { |
| @@ -14835,6 +14228,11 @@ display_line (it) | |||
| 14835 | display the cursor there under X. Set the charpos of the | 14228 | display the cursor there under X. Set the charpos of the |
| 14836 | first glyph of blank lines not corresponding to any text | 14229 | first glyph of blank lines not corresponding to any text |
| 14837 | to -1. */ | 14230 | to -1. */ |
| 14231 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 14232 | if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) | ||
| 14233 | row->exact_window_width_line_p = 1; | ||
| 14234 | else | ||
| 14235 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 14838 | if ((append_space (it, 1) && row->used[TEXT_AREA] == 1) | 14236 | if ((append_space (it, 1) && row->used[TEXT_AREA] == 1) |
| 14839 | || row->used[TEXT_AREA] == 0) | 14237 | || row->used[TEXT_AREA] == 0) |
| 14840 | { | 14238 | { |
| @@ -14947,8 +14345,14 @@ display_line (it) | |||
| 14947 | #ifdef HAVE_WINDOW_SYSTEM | 14345 | #ifdef HAVE_WINDOW_SYSTEM |
| 14948 | if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) | 14346 | if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) |
| 14949 | { | 14347 | { |
| 14950 | get_next_display_element (it); | 14348 | if (!get_next_display_element (it)) |
| 14951 | if (ITERATOR_AT_END_OF_LINE_P (it)) | 14349 | { |
| 14350 | row->exact_window_width_line_p = 1; | ||
| 14351 | it->continuation_lines_width = 0; | ||
| 14352 | row->continued_p = 0; | ||
| 14353 | row->ends_at_zv_p = 1; | ||
| 14354 | } | ||
| 14355 | else if (ITERATOR_AT_END_OF_LINE_P (it)) | ||
| 14952 | { | 14356 | { |
| 14953 | row->continued_p = 0; | 14357 | row->continued_p = 0; |
| 14954 | row->exact_window_width_line_p = 1; | 14358 | row->exact_window_width_line_p = 1; |
| @@ -15053,7 +14457,7 @@ display_line (it) | |||
| 15053 | it->max_phys_ascent + it->max_phys_descent); | 14457 | it->max_phys_ascent + it->max_phys_descent); |
| 15054 | 14458 | ||
| 15055 | /* End of this display line if row is continued. */ | 14459 | /* End of this display line if row is continued. */ |
| 15056 | if (row->continued_p) | 14460 | if (row->continued_p || row->ends_at_zv_p) |
| 15057 | break; | 14461 | break; |
| 15058 | } | 14462 | } |
| 15059 | 14463 | ||
| @@ -15119,7 +14523,15 @@ display_line (it) | |||
| 15119 | /* Don't truncate if we can overflow newline into fringe. */ | 14523 | /* Don't truncate if we can overflow newline into fringe. */ |
| 15120 | if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) | 14524 | if (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) |
| 15121 | { | 14525 | { |
| 15122 | get_next_display_element (it); | 14526 | if (!get_next_display_element (it)) |
| 14527 | { | ||
| 14528 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 14529 | it->continuation_lines_width = 0; | ||
| 14530 | row->ends_at_zv_p = 1; | ||
| 14531 | row->exact_window_width_line_p = 1; | ||
| 14532 | break; | ||
| 14533 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 14534 | } | ||
| 15123 | if (ITERATOR_AT_END_OF_LINE_P (it)) | 14535 | if (ITERATOR_AT_END_OF_LINE_P (it)) |
| 15124 | { | 14536 | { |
| 15125 | row->exact_window_width_line_p = 1; | 14537 | row->exact_window_width_line_p = 1; |
| @@ -15196,6 +14608,17 @@ display_line (it) | |||
| 15196 | /* Remember the position at which this line ends. */ | 14608 | /* Remember the position at which this line ends. */ |
| 15197 | row->end = it->current; | 14609 | row->end = it->current; |
| 15198 | 14610 | ||
| 14611 | /* Save fringe bitmaps in this row. */ | ||
| 14612 | row->left_user_fringe_bitmap = it->left_user_fringe_bitmap; | ||
| 14613 | row->left_user_fringe_face_id = it->left_user_fringe_face_id; | ||
| 14614 | row->right_user_fringe_bitmap = it->right_user_fringe_bitmap; | ||
| 14615 | row->right_user_fringe_face_id = it->right_user_fringe_face_id; | ||
| 14616 | |||
| 14617 | it->left_user_fringe_bitmap = 0; | ||
| 14618 | it->left_user_fringe_face_id = 0; | ||
| 14619 | it->right_user_fringe_bitmap = 0; | ||
| 14620 | it->right_user_fringe_face_id = 0; | ||
| 14621 | |||
| 15199 | /* Maybe set the cursor. */ | 14622 | /* Maybe set the cursor. */ |
| 15200 | if (it->w->cursor.vpos < 0 | 14623 | if (it->w->cursor.vpos < 0 |
| 15201 | && PT >= MATRIX_ROW_START_CHARPOS (row) | 14624 | && PT >= MATRIX_ROW_START_CHARPOS (row) |
| @@ -20555,8 +19978,7 @@ on_hot_spot_p (hot_spot, x, y) | |||
| 20555 | return inside; | 19978 | return inside; |
| 20556 | } | 19979 | } |
| 20557 | } | 19980 | } |
| 20558 | else | 19981 | return 0; |
| 20559 | return 0; | ||
| 20560 | } | 19982 | } |
| 20561 | 19983 | ||
| 20562 | Lisp_Object | 19984 | Lisp_Object |
| @@ -20595,10 +20017,8 @@ Returns the alist element for the first matching AREA in MAP. */) | |||
| 20595 | if (NILP (map)) | 20017 | if (NILP (map)) |
| 20596 | return Qnil; | 20018 | return Qnil; |
| 20597 | 20019 | ||
| 20598 | if (!INTEGERP (x)) | 20020 | CHECK_NUMBER (x); |
| 20599 | wrong_type_argument (Qintegerp, x); | 20021 | CHECK_NUMBER (y); |
| 20600 | if (!INTEGERP (y)) | ||
| 20601 | wrong_type_argument (Qintegerp, y); | ||
| 20602 | 20022 | ||
| 20603 | return find_hot_spot (map, XINT (x), XINT (y)); | 20023 | return find_hot_spot (map, XINT (x), XINT (y)); |
| 20604 | } | 20024 | } |
| @@ -22016,17 +21436,6 @@ wide as that tab on the display. */); | |||
| 22016 | The face used for trailing whitespace is `trailing-whitespace'. */); | 21436 | The face used for trailing whitespace is `trailing-whitespace'. */); |
| 22017 | Vshow_trailing_whitespace = Qnil; | 21437 | Vshow_trailing_whitespace = Qnil; |
| 22018 | 21438 | ||
| 22019 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 22020 | DEFVAR_LISP ("overflow-newline-into-fringe", &Voverflow_newline_into_fringe, | ||
| 22021 | doc: /* *Non-nil means that newline may flow into the right fringe. | ||
| 22022 | This means that display lines which are exactly as wide as the window | ||
| 22023 | (not counting the final newline) will only occupy one screen line, by | ||
| 22024 | showing (or hiding) the final newline in the right fringe; when point | ||
| 22025 | is at the final newline, the cursor is shown in the right fringe. | ||
| 22026 | If nil, also continue lines which are exactly as wide as the window. */); | ||
| 22027 | Voverflow_newline_into_fringe = Qt; | ||
| 22028 | #endif | ||
| 22029 | |||
| 22030 | DEFVAR_LISP ("void-text-area-pointer", &Vvoid_text_area_pointer, | 21439 | DEFVAR_LISP ("void-text-area-pointer", &Vvoid_text_area_pointer, |
| 22031 | doc: /* *The pointer shape to show in void text areas. | 21440 | doc: /* *The pointer shape to show in void text areas. |
| 22032 | Nil means to show the text pointer. Other options are `arrow', `text', | 21441 | Nil means to show the text pointer. Other options are `arrow', `text', |
diff --git a/src/xfaces.c b/src/xfaces.c index fc23b3e2b24..7761282f9eb 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -192,6 +192,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 192 | used to fill in unspecified attributes of the default face. */ | 192 | used to fill in unspecified attributes of the default face. */ |
| 193 | 193 | ||
| 194 | #include <config.h> | 194 | #include <config.h> |
| 195 | #include <stdio.h> | ||
| 195 | #include <sys/types.h> | 196 | #include <sys/types.h> |
| 196 | #include <sys/stat.h> | 197 | #include <sys/stat.h> |
| 197 | #include <stdio.h> /* This needs to be before termchar.h */ | 198 | #include <stdio.h> /* This needs to be before termchar.h */ |
diff --git a/src/xfns.c b/src/xfns.c index 6e51965c248..a649ddd1068 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -775,7 +775,6 @@ x_create_bitmap_mask (f, id) | |||
| 775 | unsigned long x, y, xp, xm, yp, ym; | 775 | unsigned long x, y, xp, xm, yp, ym; |
| 776 | GC gc; | 776 | GC gc; |
| 777 | 777 | ||
| 778 | int depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f)); | ||
| 779 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | 778 | struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
| 780 | 779 | ||
| 781 | if (!(id > 0)) | 780 | if (!(id > 0)) |
| @@ -1597,7 +1596,7 @@ x_set_menu_bar_lines (f, value, oldval) | |||
| 1597 | Lisp_Object value, oldval; | 1596 | Lisp_Object value, oldval; |
| 1598 | { | 1597 | { |
| 1599 | int nlines; | 1598 | int nlines; |
| 1600 | #ifndef USE_X_TOOLKIT | 1599 | #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) |
| 1601 | int olines = FRAME_MENU_BAR_LINES (f); | 1600 | int olines = FRAME_MENU_BAR_LINES (f); |
| 1602 | #endif | 1601 | #endif |
| 1603 | 1602 | ||
| @@ -4292,125 +4291,6 @@ x_sync (f) | |||
| 4292 | 4291 | ||
| 4293 | 4292 | ||
| 4294 | /*********************************************************************** | 4293 | /*********************************************************************** |
| 4295 | General X functions exposed to Elisp. | ||
| 4296 | ***********************************************************************/ | ||
| 4297 | |||
| 4298 | DEFUN ("x-send-client-message", Fx_send_client_event, | ||
| 4299 | Sx_send_client_message, 6, 6, 0, | ||
| 4300 | doc: /* Send a client message of MESSAGE-TYPE to window DEST on DISPLAY. | ||
| 4301 | |||
| 4302 | For DISPLAY, specify either a frame or a display name (a string). | ||
| 4303 | If DISPLAY is nil, that stands for the selected frame's display. | ||
| 4304 | DEST may be an integer, in which case it is a Window id. The value 0 may | ||
| 4305 | be used to send to the root window of the DISPLAY. | ||
| 4306 | If DEST is a frame the event is sent to the outer window of that frame. | ||
| 4307 | Nil means the currently selected frame. | ||
| 4308 | If DEST is the string "PointerWindow" the event is sent to the window that | ||
| 4309 | contains the pointer. If DEST is the string "InputFocus" the event is | ||
| 4310 | sent to the window that has the input focus. | ||
| 4311 | FROM is the frame sending the event. Use nil for currently selected frame. | ||
| 4312 | MESSAGE-TYPE is the name of an Atom as a string. | ||
| 4313 | FORMAT must be one of 8, 16 or 32 and determines the size of the values in | ||
| 4314 | bits. VALUES is a list of integer and/or strings containing the values to | ||
| 4315 | send. If a value is a string, it is converted to an Atom and the value of | ||
| 4316 | the Atom is sent. If more values than fits into the event is given, | ||
| 4317 | the excessive values are ignored. */) | ||
| 4318 | (display, dest, from, message_type, format, values) | ||
| 4319 | Lisp_Object display, dest, from, message_type, format, values; | ||
| 4320 | { | ||
| 4321 | struct x_display_info *dpyinfo = check_x_display_info (display); | ||
| 4322 | Window wdest; | ||
| 4323 | XEvent event; | ||
| 4324 | Lisp_Object cons; | ||
| 4325 | int i; | ||
| 4326 | int max_nr_values = (int) sizeof (event.xclient.data.b); | ||
| 4327 | struct frame *f = check_x_frame (from); | ||
| 4328 | |||
| 4329 | CHECK_STRING (message_type); | ||
| 4330 | CHECK_NUMBER (format); | ||
| 4331 | CHECK_CONS (values); | ||
| 4332 | |||
| 4333 | for (cons = values; CONSP (cons); cons = XCDR (cons)) | ||
| 4334 | { | ||
| 4335 | Lisp_Object o = XCAR (cons); | ||
| 4336 | |||
| 4337 | if (! INTEGERP (o) && ! STRINGP (o)) | ||
| 4338 | error ("Bad data in VALUES, must be integer or string"); | ||
| 4339 | } | ||
| 4340 | |||
| 4341 | event.xclient.type = ClientMessage; | ||
| 4342 | event.xclient.format = XFASTINT (format); | ||
| 4343 | |||
| 4344 | if (event.xclient.format != 8 && event.xclient.format != 16 | ||
| 4345 | && event.xclient.format != 32) | ||
| 4346 | error ("FORMAT must be one of 8, 16 or 32"); | ||
| 4347 | if (event.xclient.format == 16) max_nr_values /= 2; | ||
| 4348 | if (event.xclient.format == 32) max_nr_values /= 4; | ||
| 4349 | |||
| 4350 | if (FRAMEP (dest) || NILP (dest)) | ||
| 4351 | { | ||
| 4352 | struct frame *fdest = check_x_frame (dest); | ||
| 4353 | wdest = FRAME_OUTER_WINDOW (fdest); | ||
| 4354 | } | ||
| 4355 | else if (STRINGP (dest)) | ||
| 4356 | { | ||
| 4357 | if (strcmp (SDATA (dest), "PointerWindow") == 0) | ||
| 4358 | wdest = PointerWindow; | ||
| 4359 | else if (strcmp (SDATA (dest), "InputFocus") == 0) | ||
| 4360 | wdest = InputFocus; | ||
| 4361 | else | ||
| 4362 | error ("DEST as a string must be one of PointerWindow or InputFocus"); | ||
| 4363 | } | ||
| 4364 | else | ||
| 4365 | { | ||
| 4366 | CHECK_NUMBER (dest); | ||
| 4367 | wdest = (Window) XFASTINT (dest); | ||
| 4368 | if (wdest == 0) wdest = dpyinfo->root_window; | ||
| 4369 | } | ||
| 4370 | |||
| 4371 | BLOCK_INPUT; | ||
| 4372 | for (cons = values, i = 0; | ||
| 4373 | CONSP (cons) && i < max_nr_values; | ||
| 4374 | cons = XCDR (cons), ++i) | ||
| 4375 | { | ||
| 4376 | Lisp_Object o = XCAR (cons); | ||
| 4377 | long val; | ||
| 4378 | |||
| 4379 | if (INTEGERP (o)) | ||
| 4380 | val = XINT (o); | ||
| 4381 | else if (STRINGP (o)) | ||
| 4382 | val = XInternAtom (dpyinfo->display, SDATA (o), False); | ||
| 4383 | |||
| 4384 | if (event.xclient.format == 8) | ||
| 4385 | event.xclient.data.b[i] = (char) val; | ||
| 4386 | else if (event.xclient.format == 16) | ||
| 4387 | event.xclient.data.s[i] = (short) val; | ||
| 4388 | else | ||
| 4389 | event.xclient.data.l[i] = val; | ||
| 4390 | } | ||
| 4391 | |||
| 4392 | for ( ; i < max_nr_values; ++i) | ||
| 4393 | if (event.xclient.format == 8) | ||
| 4394 | event.xclient.data.b[i] = 0; | ||
| 4395 | else if (event.xclient.format == 16) | ||
| 4396 | event.xclient.data.s[i] = 0; | ||
| 4397 | else | ||
| 4398 | event.xclient.data.l[i] = 0; | ||
| 4399 | |||
| 4400 | event.xclient.message_type | ||
| 4401 | = XInternAtom (dpyinfo->display, SDATA (message_type), False); | ||
| 4402 | event.xclient.display = dpyinfo->display; | ||
| 4403 | event.xclient.window = FRAME_OUTER_WINDOW (f); | ||
| 4404 | |||
| 4405 | XSendEvent (dpyinfo->display, wdest, False, 0xffff, &event); | ||
| 4406 | |||
| 4407 | XFlush (dpyinfo->display); | ||
| 4408 | UNBLOCK_INPUT; | ||
| 4409 | |||
| 4410 | return Qnil; | ||
| 4411 | } | ||
| 4412 | |||
| 4413 | /*********************************************************************** | ||
| 4414 | Image types | 4294 | Image types |
| 4415 | ***********************************************************************/ | 4295 | ***********************************************************************/ |
| 4416 | 4296 | ||
| @@ -9601,24 +9481,85 @@ x_kill_gs_process (pixmap, f) | |||
| 9601 | ***********************************************************************/ | 9481 | ***********************************************************************/ |
| 9602 | 9482 | ||
| 9603 | DEFUN ("x-change-window-property", Fx_change_window_property, | 9483 | DEFUN ("x-change-window-property", Fx_change_window_property, |
| 9604 | Sx_change_window_property, 2, 3, 0, | 9484 | Sx_change_window_property, 2, 6, 0, |
| 9605 | doc: /* Change window property PROP to VALUE on the X window of FRAME. | 9485 | doc: /* Change window property PROP to VALUE on the X window of FRAME. |
| 9606 | PROP and VALUE must be strings. FRAME nil or omitted means use the | 9486 | PROP must be a string. |
| 9607 | selected frame. Value is VALUE. */) | 9487 | VALUE may be a string or a list of conses, numbers and/or strings. |
| 9608 | (prop, value, frame) | 9488 | If an element in the list is a string, it is converted to |
| 9609 | Lisp_Object frame, prop, value; | 9489 | an Atom and the value of the Atom is used. If an element is a cons, |
| 9490 | it is converted to a 32 bit number where the car is the 16 top bits and the | ||
| 9491 | cdr is the lower 16 bits. | ||
| 9492 | FRAME nil or omitted means use the selected frame. | ||
| 9493 | If TYPE is given and non-nil, it is the name of the type of VALUE. | ||
| 9494 | If TYPE is not given or nil, the type is STRING. | ||
| 9495 | FORMAT gives the size in bits of each element if VALUE is a list. | ||
| 9496 | It must be one of 8, 16 or 32. | ||
| 9497 | If VALUE is a string or FORMAT is nil or not given, FORMAT defaults to 8. | ||
| 9498 | If OUTER_P is non-nil, the property is changed for the outer X window of | ||
| 9499 | FRAME. Default is to change on the edit X window. | ||
| 9500 | |||
| 9501 | Value is VALUE. */) | ||
| 9502 | (prop, value, frame, type, format, outer_p) | ||
| 9503 | Lisp_Object prop, value, frame, type, format, outer_p; | ||
| 9610 | { | 9504 | { |
| 9611 | struct frame *f = check_x_frame (frame); | 9505 | struct frame *f = check_x_frame (frame); |
| 9612 | Atom prop_atom; | 9506 | Atom prop_atom; |
| 9507 | Atom target_type = XA_STRING; | ||
| 9508 | int element_format = 8; | ||
| 9509 | unsigned char *data; | ||
| 9510 | int nelements; | ||
| 9511 | Window w; | ||
| 9613 | 9512 | ||
| 9614 | CHECK_STRING (prop); | 9513 | CHECK_STRING (prop); |
| 9615 | CHECK_STRING (value); | 9514 | |
| 9515 | if (! NILP (format)) | ||
| 9516 | { | ||
| 9517 | CHECK_NUMBER (format); | ||
| 9518 | element_format = XFASTINT (format); | ||
| 9519 | |||
| 9520 | if (element_format != 8 && element_format != 16 | ||
| 9521 | && element_format != 32) | ||
| 9522 | error ("FORMAT must be one of 8, 16 or 32"); | ||
| 9523 | } | ||
| 9524 | |||
| 9525 | if (CONSP (value)) | ||
| 9526 | { | ||
| 9527 | nelements = x_check_property_data (value); | ||
| 9528 | if (nelements == -1) | ||
| 9529 | error ("Bad data in VALUE, must be number, string or cons"); | ||
| 9530 | |||
| 9531 | if (element_format == 8) | ||
| 9532 | data = (unsigned char *) xmalloc (nelements); | ||
| 9533 | else if (element_format == 16) | ||
| 9534 | data = (unsigned char *) xmalloc (nelements*2); | ||
| 9535 | else | ||
| 9536 | data = (unsigned char *) xmalloc (nelements*4); | ||
| 9537 | |||
| 9538 | x_fill_property_data (FRAME_X_DISPLAY (f), value, data, element_format); | ||
| 9539 | } | ||
| 9540 | else | ||
| 9541 | { | ||
| 9542 | CHECK_STRING (value); | ||
| 9543 | data = SDATA (value); | ||
| 9544 | nelements = SCHARS (value); | ||
| 9545 | } | ||
| 9616 | 9546 | ||
| 9617 | BLOCK_INPUT; | 9547 | BLOCK_INPUT; |
| 9618 | prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SDATA (prop), False); | 9548 | prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SDATA (prop), False); |
| 9619 | XChangeProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 9549 | if (! NILP (type)) |
| 9620 | prop_atom, XA_STRING, 8, PropModeReplace, | 9550 | { |
| 9621 | SDATA (value), SCHARS (value)); | 9551 | CHECK_STRING (type); |
| 9552 | target_type = XInternAtom (FRAME_X_DISPLAY (f), SDATA (type), False); | ||
| 9553 | } | ||
| 9554 | |||
| 9555 | if (! NILP (outer_p)) w = FRAME_OUTER_WINDOW (f); | ||
| 9556 | else w = FRAME_X_WINDOW (f); | ||
| 9557 | |||
| 9558 | XChangeProperty (FRAME_X_DISPLAY (f), w, | ||
| 9559 | prop_atom, target_type, element_format, PropModeReplace, | ||
| 9560 | data, nelements); | ||
| 9561 | |||
| 9562 | if (CONSP (value)) xfree (data); | ||
| 9622 | 9563 | ||
| 9623 | /* Make sure the property is set when we return. */ | 9564 | /* Make sure the property is set when we return. */ |
| 9624 | XFlush (FRAME_X_DISPLAY (f)); | 9565 | XFlush (FRAME_X_DISPLAY (f)); |
| @@ -9652,13 +9593,20 @@ FRAME nil or omitted means use the selected frame. Value is PROP. */) | |||
| 9652 | 9593 | ||
| 9653 | 9594 | ||
| 9654 | DEFUN ("x-window-property", Fx_window_property, Sx_window_property, | 9595 | DEFUN ("x-window-property", Fx_window_property, Sx_window_property, |
| 9655 | 1, 2, 0, | 9596 | 1, 6, 0, |
| 9656 | doc: /* Value is the value of window property PROP on FRAME. | 9597 | doc: /* Value is the value of window property PROP on FRAME. |
| 9657 | If FRAME is nil or omitted, use the selected frame. Value is nil | 9598 | If FRAME is nil or omitted, use the selected frame. |
| 9658 | if FRAME hasn't a property with name PROP or if PROP has no string | 9599 | If TYPE is nil or omitted, get the property as a string. Otherwise TYPE |
| 9659 | value. */) | 9600 | is the name of the Atom that denotes the type expected. |
| 9660 | (prop, frame) | 9601 | If SOURCE is non-nil, get the property on that window instead of from |
| 9661 | Lisp_Object prop, frame; | 9602 | FRAME. The number 0 denotes the root window. |
| 9603 | If DELETE_P is non-nil, delete the property after retreiving it. | ||
| 9604 | If VECTOR_RET_P is non-nil, don't return a string but a vector of values. | ||
| 9605 | |||
| 9606 | Value is nil if FRAME hasn't a property with name PROP or if PROP has | ||
| 9607 | no value of TYPE. */) | ||
| 9608 | (prop, frame, type, source, delete_p, vector_ret_p) | ||
| 9609 | Lisp_Object prop, frame, type, source, delete_p, vector_ret_p; | ||
| 9662 | { | 9610 | { |
| 9663 | struct frame *f = check_x_frame (frame); | 9611 | struct frame *f = check_x_frame (frame); |
| 9664 | Atom prop_atom; | 9612 | Atom prop_atom; |
| @@ -9666,14 +9614,43 @@ value. */) | |||
| 9666 | Lisp_Object prop_value = Qnil; | 9614 | Lisp_Object prop_value = Qnil; |
| 9667 | char *tmp_data = NULL; | 9615 | char *tmp_data = NULL; |
| 9668 | Atom actual_type; | 9616 | Atom actual_type; |
| 9617 | Atom target_type = XA_STRING; | ||
| 9669 | int actual_format; | 9618 | int actual_format; |
| 9670 | unsigned long actual_size, bytes_remaining; | 9619 | unsigned long actual_size, bytes_remaining; |
| 9620 | Window target_window = FRAME_X_WINDOW (f); | ||
| 9621 | struct gcpro gcpro1; | ||
| 9671 | 9622 | ||
| 9623 | GCPRO1 (prop_value); | ||
| 9672 | CHECK_STRING (prop); | 9624 | CHECK_STRING (prop); |
| 9625 | |||
| 9626 | if (! NILP (source)) | ||
| 9627 | { | ||
| 9628 | if (NUMBERP (source)) | ||
| 9629 | { | ||
| 9630 | if (FLOATP (source)) | ||
| 9631 | target_window = (Window) XFLOAT (source); | ||
| 9632 | else | ||
| 9633 | target_window = XFASTINT (source); | ||
| 9634 | |||
| 9635 | if (target_window == 0) | ||
| 9636 | target_window = FRAME_X_DISPLAY_INFO (f)->root_window; | ||
| 9637 | } | ||
| 9638 | else if (CONSP (source)) | ||
| 9639 | target_window = cons_to_long (source); | ||
| 9640 | } | ||
| 9641 | |||
| 9673 | BLOCK_INPUT; | 9642 | BLOCK_INPUT; |
| 9643 | if (STRINGP (type)) | ||
| 9644 | { | ||
| 9645 | if (strcmp ("AnyPropertyType", SDATA (type)) == 0) | ||
| 9646 | target_type = AnyPropertyType; | ||
| 9647 | else | ||
| 9648 | target_type = XInternAtom (FRAME_X_DISPLAY (f), SDATA (type), False); | ||
| 9649 | } | ||
| 9650 | |||
| 9674 | prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SDATA (prop), False); | 9651 | prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SDATA (prop), False); |
| 9675 | rc = XGetWindowProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 9652 | rc = XGetWindowProperty (FRAME_X_DISPLAY (f), target_window, |
| 9676 | prop_atom, 0, 0, False, XA_STRING, | 9653 | prop_atom, 0, 0, False, target_type, |
| 9677 | &actual_type, &actual_format, &actual_size, | 9654 | &actual_type, &actual_format, &actual_size, |
| 9678 | &bytes_remaining, (unsigned char **) &tmp_data); | 9655 | &bytes_remaining, (unsigned char **) &tmp_data); |
| 9679 | if (rc == Success) | 9656 | if (rc == Success) |
| @@ -9683,19 +9660,29 @@ value. */) | |||
| 9683 | XFree (tmp_data); | 9660 | XFree (tmp_data); |
| 9684 | tmp_data = NULL; | 9661 | tmp_data = NULL; |
| 9685 | 9662 | ||
| 9686 | rc = XGetWindowProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 9663 | rc = XGetWindowProperty (FRAME_X_DISPLAY (f), target_window, |
| 9687 | prop_atom, 0, bytes_remaining, | 9664 | prop_atom, 0, bytes_remaining, |
| 9688 | False, XA_STRING, | 9665 | ! NILP (delete_p), target_type, |
| 9689 | &actual_type, &actual_format, | 9666 | &actual_type, &actual_format, |
| 9690 | &actual_size, &bytes_remaining, | 9667 | &actual_size, &bytes_remaining, |
| 9691 | (unsigned char **) &tmp_data); | 9668 | (unsigned char **) &tmp_data); |
| 9692 | if (rc == Success && tmp_data) | 9669 | if (rc == Success && tmp_data) |
| 9693 | prop_value = make_string (tmp_data, size); | 9670 | { |
| 9671 | if (NILP (vector_ret_p)) | ||
| 9672 | prop_value = make_string (tmp_data, size); | ||
| 9673 | else | ||
| 9674 | prop_value = x_property_data_to_lisp (f, | ||
| 9675 | (unsigned char *) tmp_data, | ||
| 9676 | actual_type, | ||
| 9677 | actual_format, | ||
| 9678 | actual_size); | ||
| 9679 | } | ||
| 9694 | 9680 | ||
| 9695 | XFree (tmp_data); | 9681 | if (tmp_data) XFree (tmp_data); |
| 9696 | } | 9682 | } |
| 9697 | 9683 | ||
| 9698 | UNBLOCK_INPUT; | 9684 | UNBLOCK_INPUT; |
| 9685 | UNGCPRO; | ||
| 9699 | return prop_value; | 9686 | return prop_value; |
| 9700 | } | 9687 | } |
| 9701 | 9688 | ||
| @@ -10752,7 +10739,6 @@ selection dialog's entry field, if MUSTMATCH is non-nil.") | |||
| 10752 | int count = specpdl_ptr - specpdl; | 10739 | int count = specpdl_ptr - specpdl; |
| 10753 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | 10740 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| 10754 | char *cdef_file; | 10741 | char *cdef_file; |
| 10755 | char *cprompt; | ||
| 10756 | 10742 | ||
| 10757 | GCPRO5 (prompt, dir, default_filename, mustmatch, file); | 10743 | GCPRO5 (prompt, dir, default_filename, mustmatch, file); |
| 10758 | CHECK_STRING (prompt); | 10744 | CHECK_STRING (prompt); |
| @@ -11110,7 +11096,6 @@ meaning don't clear the cache. */); | |||
| 11110 | defsubr (&Sx_close_connection); | 11096 | defsubr (&Sx_close_connection); |
| 11111 | defsubr (&Sx_display_list); | 11097 | defsubr (&Sx_display_list); |
| 11112 | defsubr (&Sx_synchronize); | 11098 | defsubr (&Sx_synchronize); |
| 11113 | defsubr (&Sx_send_client_message); | ||
| 11114 | defsubr (&Sx_focus_frame); | 11099 | defsubr (&Sx_focus_frame); |
| 11115 | defsubr (&Sx_backspace_delete_keys_p); | 11100 | defsubr (&Sx_backspace_delete_keys_p); |
| 11116 | 11101 | ||
diff --git a/src/xselect.c b/src/xselect.c index e1dbb4601dc..637b39272b7 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 23 | /* Rewritten by jwz */ | 23 | /* Rewritten by jwz */ |
| 24 | 24 | ||
| 25 | #include <config.h> | 25 | #include <config.h> |
| 26 | #include <stdio.h> /* termhooks.h needs this */ | ||
| 26 | #include "lisp.h" | 27 | #include "lisp.h" |
| 27 | #include "xterm.h" /* for all of the X includes */ | 28 | #include "xterm.h" /* for all of the X includes */ |
| 28 | #include "dispextern.h" /* frame.h seems to want this */ | 29 | #include "dispextern.h" /* frame.h seems to want this */ |
| @@ -30,6 +31,9 @@ Boston, MA 02111-1307, USA. */ | |||
| 30 | #include "blockinput.h" | 31 | #include "blockinput.h" |
| 31 | #include "buffer.h" | 32 | #include "buffer.h" |
| 32 | #include "process.h" | 33 | #include "process.h" |
| 34 | #include "termhooks.h" | ||
| 35 | |||
| 36 | #include <X11/Xproto.h> | ||
| 33 | 37 | ||
| 34 | struct prop_location; | 38 | struct prop_location; |
| 35 | 39 | ||
| @@ -50,7 +54,9 @@ static struct prop_location *expect_property_change P_ ((Display *, Window, | |||
| 50 | static void unexpect_property_change P_ ((struct prop_location *)); | 54 | static void unexpect_property_change P_ ((struct prop_location *)); |
| 51 | static Lisp_Object wait_for_property_change_unwind P_ ((Lisp_Object)); | 55 | static Lisp_Object wait_for_property_change_unwind P_ ((Lisp_Object)); |
| 52 | static void wait_for_property_change P_ ((struct prop_location *)); | 56 | static void wait_for_property_change P_ ((struct prop_location *)); |
| 53 | static Lisp_Object x_get_foreign_selection P_ ((Lisp_Object, Lisp_Object)); | 57 | static Lisp_Object x_get_foreign_selection P_ ((Lisp_Object, |
| 58 | Lisp_Object, | ||
| 59 | Lisp_Object)); | ||
| 54 | static void x_get_window_property P_ ((Display *, Window, Atom, | 60 | static void x_get_window_property P_ ((Display *, Window, Atom, |
| 55 | unsigned char **, int *, | 61 | unsigned char **, int *, |
| 56 | Atom *, int *, unsigned long *, int)); | 62 | Atom *, int *, unsigned long *, int)); |
| @@ -1223,8 +1229,8 @@ static Window reading_selection_window; | |||
| 1223 | Converts this to Lisp data and returns it. */ | 1229 | Converts this to Lisp data and returns it. */ |
| 1224 | 1230 | ||
| 1225 | static Lisp_Object | 1231 | static Lisp_Object |
| 1226 | x_get_foreign_selection (selection_symbol, target_type) | 1232 | x_get_foreign_selection (selection_symbol, target_type, time_stamp) |
| 1227 | Lisp_Object selection_symbol, target_type; | 1233 | Lisp_Object selection_symbol, target_type, time_stamp; |
| 1228 | { | 1234 | { |
| 1229 | struct frame *sf = SELECTED_FRAME (); | 1235 | struct frame *sf = SELECTED_FRAME (); |
| 1230 | Window requestor_window; | 1236 | Window requestor_window; |
| @@ -1252,6 +1258,18 @@ x_get_foreign_selection (selection_symbol, target_type) | |||
| 1252 | else | 1258 | else |
| 1253 | type_atom = symbol_to_x_atom (dpyinfo, display, target_type); | 1259 | type_atom = symbol_to_x_atom (dpyinfo, display, target_type); |
| 1254 | 1260 | ||
| 1261 | if (! NILP (time_stamp)) | ||
| 1262 | { | ||
| 1263 | if (CONSP (time_stamp)) | ||
| 1264 | requestor_time = (Time) cons_to_long (time_stamp); | ||
| 1265 | else if (INTEGERP (time_stamp)) | ||
| 1266 | requestor_time = (Time) XUINT (time_stamp); | ||
| 1267 | else if (FLOATP (time_stamp)) | ||
| 1268 | requestor_time = (Time) XFLOAT (time_stamp); | ||
| 1269 | else | ||
| 1270 | error ("TIME_STAMP must be cons or number"); | ||
| 1271 | } | ||
| 1272 | |||
| 1255 | BLOCK_INPUT; | 1273 | BLOCK_INPUT; |
| 1256 | 1274 | ||
| 1257 | count = x_catch_errors (display); | 1275 | count = x_catch_errors (display); |
| @@ -1943,13 +1961,15 @@ anything that the functions on `selection-converter-alist' know about. */) | |||
| 1943 | will block until all of the data has arrived. */ | 1961 | will block until all of the data has arrived. */ |
| 1944 | 1962 | ||
| 1945 | DEFUN ("x-get-selection-internal", Fx_get_selection_internal, | 1963 | DEFUN ("x-get-selection-internal", Fx_get_selection_internal, |
| 1946 | Sx_get_selection_internal, 2, 2, 0, | 1964 | Sx_get_selection_internal, 2, 3, 0, |
| 1947 | doc: /* Return text selected from some X window. | 1965 | doc: /* Return text selected from some X window. |
| 1948 | SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. | 1966 | SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. |
| 1949 | \(Those are literal upper-case symbol names, since that's what X expects.) | 1967 | \(Those are literal upper-case symbol names, since that's what X expects.) |
| 1950 | TYPE is the type of data desired, typically `STRING'. */) | 1968 | TYPE is the type of data desired, typically `STRING'. |
| 1951 | (selection_symbol, target_type) | 1969 | TIME_STAMP is the time to use in the XConvertSelection call for foreign |
| 1952 | Lisp_Object selection_symbol, target_type; | 1970 | selections. If omitted, defaults to the time for the last event. */) |
| 1971 | (selection_symbol, target_type, time_stamp) | ||
| 1972 | Lisp_Object selection_symbol, target_type, time_stamp; | ||
| 1953 | { | 1973 | { |
| 1954 | Lisp_Object val = Qnil; | 1974 | Lisp_Object val = Qnil; |
| 1955 | struct gcpro gcpro1, gcpro2; | 1975 | struct gcpro gcpro1, gcpro2; |
| @@ -1973,7 +1993,7 @@ TYPE is the type of data desired, typically `STRING'. */) | |||
| 1973 | 1993 | ||
| 1974 | if (NILP (val)) | 1994 | if (NILP (val)) |
| 1975 | { | 1995 | { |
| 1976 | val = x_get_foreign_selection (selection_symbol, target_type); | 1996 | val = x_get_foreign_selection (selection_symbol, target_type, time_stamp); |
| 1977 | goto DONE; | 1997 | goto DONE; |
| 1978 | } | 1998 | } |
| 1979 | 1999 | ||
| @@ -2310,6 +2330,351 @@ Positive means shift the values forward, negative means backward. */) | |||
| 2310 | 2330 | ||
| 2311 | #endif | 2331 | #endif |
| 2312 | 2332 | ||
| 2333 | /*********************************************************************** | ||
| 2334 | Drag and drop support | ||
| 2335 | ***********************************************************************/ | ||
| 2336 | /* Check that lisp values are of correct type for x_fill_property_data. | ||
| 2337 | That is, number, string or a cons with two numbers (low and high 16 | ||
| 2338 | bit parts of a 32 bit number). */ | ||
| 2339 | |||
| 2340 | int | ||
| 2341 | x_check_property_data (data) | ||
| 2342 | Lisp_Object data; | ||
| 2343 | { | ||
| 2344 | Lisp_Object iter; | ||
| 2345 | int size = 0; | ||
| 2346 | |||
| 2347 | for (iter = data; CONSP (iter) && size != -1; iter = XCDR (iter), ++size) | ||
| 2348 | { | ||
| 2349 | Lisp_Object o = XCAR (iter); | ||
| 2350 | |||
| 2351 | if (! NUMBERP (o) && ! STRINGP (o) && ! CONSP (o)) | ||
| 2352 | size = -1; | ||
| 2353 | else if (CONSP (o) && | ||
| 2354 | (! NUMBERP (XCAR (o)) || ! NUMBERP (XCDR (o)))) | ||
| 2355 | size = -1; | ||
| 2356 | } | ||
| 2357 | |||
| 2358 | return size; | ||
| 2359 | } | ||
| 2360 | |||
| 2361 | /* Convert lisp values to a C array. Values may be a number, a string | ||
| 2362 | which is taken as an X atom name and converted to the atom value, or | ||
| 2363 | a cons containing the two 16 bit parts of a 32 bit number. | ||
| 2364 | |||
| 2365 | DPY is the display use to look up X atoms. | ||
| 2366 | DATA is a Lisp list of values to be converted. | ||
| 2367 | RET is the C array that contains the converted values. It is assumed | ||
| 2368 | it is big enough to hol all values. | ||
| 2369 | FORMAT is 8, 16 or 32 and gives the size in bits for each C value to | ||
| 2370 | be stored in RET. */ | ||
| 2371 | |||
| 2372 | void | ||
| 2373 | x_fill_property_data (dpy, data, ret, format) | ||
| 2374 | Display *dpy; | ||
| 2375 | Lisp_Object data; | ||
| 2376 | void *ret; | ||
| 2377 | int format; | ||
| 2378 | { | ||
| 2379 | CARD32 val; | ||
| 2380 | CARD32 *d32 = (CARD32 *) ret; | ||
| 2381 | CARD16 *d16 = (CARD16 *) ret; | ||
| 2382 | CARD8 *d08 = (CARD8 *) ret; | ||
| 2383 | Lisp_Object iter; | ||
| 2384 | |||
| 2385 | for (iter = data; CONSP (iter); iter = XCDR (iter)) | ||
| 2386 | { | ||
| 2387 | Lisp_Object o = XCAR (iter); | ||
| 2388 | |||
| 2389 | if (INTEGERP (o)) | ||
| 2390 | val = (CARD32) XFASTINT (o); | ||
| 2391 | else if (FLOATP (o)) | ||
| 2392 | val = (CARD32) XFLOAT (o); | ||
| 2393 | else if (CONSP (o)) | ||
| 2394 | val = (CARD32) cons_to_long (o); | ||
| 2395 | else if (STRINGP (o)) | ||
| 2396 | { | ||
| 2397 | BLOCK_INPUT; | ||
| 2398 | val = XInternAtom (dpy, (char *) SDATA (o), False); | ||
| 2399 | UNBLOCK_INPUT; | ||
| 2400 | } | ||
| 2401 | else | ||
| 2402 | error ("Wrong type, must be string, number or cons"); | ||
| 2403 | |||
| 2404 | if (format == 8) | ||
| 2405 | *d08++ = (CARD8) val; | ||
| 2406 | else if (format == 16) | ||
| 2407 | *d16++ = (CARD16) val; | ||
| 2408 | else | ||
| 2409 | *d32++ = val; | ||
| 2410 | } | ||
| 2411 | } | ||
| 2412 | |||
| 2413 | /* Convert an array of C values to a Lisp list. | ||
| 2414 | F is the frame to be used to look up X atoms if the TYPE is XA_ATOM. | ||
| 2415 | DATA is a C array of values to be converted. | ||
| 2416 | TYPE is the type of the data. Only XA_ATOM is special, it converts | ||
| 2417 | each number in DATA to its corresponfing X atom as a symbol. | ||
| 2418 | FORMAT is 8, 16 or 32 and gives the size in bits for each C value to | ||
| 2419 | be stored in RET. | ||
| 2420 | SIZE is the number of elements in DATA. | ||
| 2421 | |||
| 2422 | Also see comment for selection_data_to_lisp_data above. */ | ||
| 2423 | |||
| 2424 | Lisp_Object | ||
| 2425 | x_property_data_to_lisp (f, data, type, format, size) | ||
| 2426 | struct frame *f; | ||
| 2427 | unsigned char *data; | ||
| 2428 | Atom type; | ||
| 2429 | int format; | ||
| 2430 | unsigned long size; | ||
| 2431 | { | ||
| 2432 | return selection_data_to_lisp_data (FRAME_X_DISPLAY (f), | ||
| 2433 | data, size*format/8, type, format); | ||
| 2434 | } | ||
| 2435 | |||
| 2436 | /* Get the mouse position frame relative coordinates. */ | ||
| 2437 | |||
| 2438 | static void | ||
| 2439 | mouse_position_for_drop (f, x, y) | ||
| 2440 | FRAME_PTR f; | ||
| 2441 | int *x; | ||
| 2442 | int *y; | ||
| 2443 | { | ||
| 2444 | Window root, dummy_window; | ||
| 2445 | int dummy; | ||
| 2446 | |||
| 2447 | BLOCK_INPUT; | ||
| 2448 | |||
| 2449 | XQueryPointer (FRAME_X_DISPLAY (f), | ||
| 2450 | DefaultRootWindow (FRAME_X_DISPLAY (f)), | ||
| 2451 | |||
| 2452 | /* The root window which contains the pointer. */ | ||
| 2453 | &root, | ||
| 2454 | |||
| 2455 | /* Window pointer is on, not used */ | ||
| 2456 | &dummy_window, | ||
| 2457 | |||
| 2458 | /* The position on that root window. */ | ||
| 2459 | x, y, | ||
| 2460 | |||
| 2461 | /* x/y in dummy_window coordinates, not used. */ | ||
| 2462 | &dummy, &dummy, | ||
| 2463 | |||
| 2464 | /* Modifier keys and pointer buttons, about which | ||
| 2465 | we don't care. */ | ||
| 2466 | (unsigned int *) &dummy); | ||
| 2467 | |||
| 2468 | |||
| 2469 | /* Absolute to relative. */ | ||
| 2470 | *x -= f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f); | ||
| 2471 | *y -= f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f); | ||
| 2472 | |||
| 2473 | UNBLOCK_INPUT; | ||
| 2474 | } | ||
| 2475 | |||
| 2476 | DEFUN ("x-get-atom-name", Fx_get_atom_name, | ||
| 2477 | Sx_get_atom_name, 1, 2, 0, | ||
| 2478 | doc: /* Return the X atom name for VALUE as a string. | ||
| 2479 | VALUE may be a number or a cons where the car is the upper 16 bits and | ||
| 2480 | the cdr is the lower 16 bits of a 32 bit value. | ||
| 2481 | Use the display for FRAME or the current frame if FRAME is not given or nil. | ||
| 2482 | |||
| 2483 | If the value is 0 or the atom is not known, return the empty string. */) | ||
| 2484 | (value, frame) | ||
| 2485 | Lisp_Object value, frame; | ||
| 2486 | { | ||
| 2487 | struct frame *f = check_x_frame (frame); | ||
| 2488 | char *name = 0; | ||
| 2489 | Lisp_Object ret = Qnil; | ||
| 2490 | int count; | ||
| 2491 | Display *dpy = FRAME_X_DISPLAY (f); | ||
| 2492 | Atom atom; | ||
| 2493 | |||
| 2494 | if (INTEGERP (value)) | ||
| 2495 | atom = (Atom) XUINT (value); | ||
| 2496 | else if (FLOATP (value)) | ||
| 2497 | atom = (Atom) XFLOAT (value); | ||
| 2498 | else if (CONSP (value)) | ||
| 2499 | atom = (Atom) cons_to_long (value); | ||
| 2500 | else | ||
| 2501 | error ("Wrong type, value must be number or cons"); | ||
| 2502 | |||
| 2503 | BLOCK_INPUT; | ||
| 2504 | count = x_catch_errors (dpy); | ||
| 2505 | |||
| 2506 | name = atom ? XGetAtomName (dpy, atom) : ""; | ||
| 2507 | |||
| 2508 | if (! x_had_errors_p (dpy)) | ||
| 2509 | ret = make_string (name, strlen (name)); | ||
| 2510 | |||
| 2511 | x_uncatch_errors (dpy, count); | ||
| 2512 | |||
| 2513 | if (atom && name) XFree (name); | ||
| 2514 | if (NILP (ret)) ret = make_string ("", 0); | ||
| 2515 | |||
| 2516 | UNBLOCK_INPUT; | ||
| 2517 | |||
| 2518 | return ret; | ||
| 2519 | } | ||
| 2520 | |||
| 2521 | /* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT. | ||
| 2522 | TODO: Check if this client event really is a DND event? */ | ||
| 2523 | |||
| 2524 | int | ||
| 2525 | x_handle_dnd_message (f, event, dpyinfo, bufp) | ||
| 2526 | struct frame *f; | ||
| 2527 | XClientMessageEvent *event; | ||
| 2528 | struct x_display_info *dpyinfo; | ||
| 2529 | struct input_event *bufp; | ||
| 2530 | { | ||
| 2531 | Lisp_Object vec; | ||
| 2532 | Lisp_Object frame; | ||
| 2533 | unsigned long size = (8*sizeof (event->data))/event->format; | ||
| 2534 | int x, y; | ||
| 2535 | |||
| 2536 | XSETFRAME (frame, f); | ||
| 2537 | |||
| 2538 | vec = Fmake_vector (make_number (4), Qnil); | ||
| 2539 | AREF (vec, 0) = SYMBOL_NAME (x_atom_to_symbol (FRAME_X_DISPLAY (f), | ||
| 2540 | event->message_type)); | ||
| 2541 | AREF (vec, 1) = frame; | ||
| 2542 | AREF (vec, 2) = make_number (event->format); | ||
| 2543 | AREF (vec, 3) = x_property_data_to_lisp (f, | ||
| 2544 | event->data.b, | ||
| 2545 | event->message_type, | ||
| 2546 | event->format, | ||
| 2547 | size); | ||
| 2548 | |||
| 2549 | mouse_position_for_drop (f, &x, &y); | ||
| 2550 | bufp->kind = DRAG_N_DROP_EVENT; | ||
| 2551 | bufp->frame_or_window = Fcons (frame, vec); | ||
| 2552 | bufp->timestamp = CurrentTime; | ||
| 2553 | bufp->x = make_number (x); | ||
| 2554 | bufp->y = make_number (y); | ||
| 2555 | bufp->arg = Qnil; | ||
| 2556 | bufp->modifiers = 0; | ||
| 2557 | |||
| 2558 | return 1; | ||
| 2559 | } | ||
| 2560 | |||
| 2561 | DEFUN ("x-send-client-message", Fx_send_client_event, | ||
| 2562 | Sx_send_client_message, 6, 6, 0, | ||
| 2563 | doc: /* Send a client message of MESSAGE-TYPE to window DEST on DISPLAY. | ||
| 2564 | |||
| 2565 | For DISPLAY, specify either a frame or a display name (a string). | ||
| 2566 | If DISPLAY is nil, that stands for the selected frame's display. | ||
| 2567 | DEST may be a number, in which case it is a Window id. The value 0 may | ||
| 2568 | be used to send to the root window of the DISPLAY. | ||
| 2569 | If DEST is a cons, it is converted to a 32 bit number | ||
| 2570 | with the high 16 bits from the car and the lower 16 bit from the cdr. That | ||
| 2571 | number is then used as a window id. | ||
| 2572 | If DEST is a frame the event is sent to the outer window of that frame. | ||
| 2573 | Nil means the currently selected frame. | ||
| 2574 | If DEST is the string "PointerWindow" the event is sent to the window that | ||
| 2575 | contains the pointer. If DEST is the string "InputFocus" the event is | ||
| 2576 | sent to the window that has the input focus. | ||
| 2577 | FROM is the frame sending the event. Use nil for currently selected frame. | ||
| 2578 | MESSAGE-TYPE is the name of an Atom as a string. | ||
| 2579 | FORMAT must be one of 8, 16 or 32 and determines the size of the values in | ||
| 2580 | bits. VALUES is a list of numbers, cons and/or strings containing the values | ||
| 2581 | to send. If a value is a string, it is converted to an Atom and the value of | ||
| 2582 | the Atom is sent. If a value is a cons, it is converted to a 32 bit number | ||
| 2583 | with the high 16 bits from the car and the lower 16 bit from the cdr. | ||
| 2584 | If more values than fits into the event is given, the excessive values | ||
| 2585 | are ignored. */) | ||
| 2586 | (display, dest, from, message_type, format, values) | ||
| 2587 | Lisp_Object display, dest, from, message_type, format, values; | ||
| 2588 | { | ||
| 2589 | struct x_display_info *dpyinfo = check_x_display_info (display); | ||
| 2590 | Window wdest; | ||
| 2591 | XEvent event; | ||
| 2592 | Lisp_Object cons; | ||
| 2593 | int size; | ||
| 2594 | struct frame *f = check_x_frame (from); | ||
| 2595 | int count; | ||
| 2596 | int to_root; | ||
| 2597 | |||
| 2598 | CHECK_STRING (message_type); | ||
| 2599 | CHECK_NUMBER (format); | ||
| 2600 | CHECK_CONS (values); | ||
| 2601 | |||
| 2602 | if (x_check_property_data (values) == -1) | ||
| 2603 | error ("Bad data in VALUES, must be number, cons or string"); | ||
| 2604 | |||
| 2605 | event.xclient.type = ClientMessage; | ||
| 2606 | event.xclient.format = XFASTINT (format); | ||
| 2607 | |||
| 2608 | if (event.xclient.format != 8 && event.xclient.format != 16 | ||
| 2609 | && event.xclient.format != 32) | ||
| 2610 | error ("FORMAT must be one of 8, 16 or 32"); | ||
| 2611 | |||
| 2612 | if (FRAMEP (dest) || NILP (dest)) | ||
| 2613 | { | ||
| 2614 | struct frame *fdest = check_x_frame (dest); | ||
| 2615 | wdest = FRAME_OUTER_WINDOW (fdest); | ||
| 2616 | } | ||
| 2617 | else if (STRINGP (dest)) | ||
| 2618 | { | ||
| 2619 | if (strcmp (SDATA (dest), "PointerWindow") == 0) | ||
| 2620 | wdest = PointerWindow; | ||
| 2621 | else if (strcmp (SDATA (dest), "InputFocus") == 0) | ||
| 2622 | wdest = InputFocus; | ||
| 2623 | else | ||
| 2624 | error ("DEST as a string must be one of PointerWindow or InputFocus"); | ||
| 2625 | } | ||
| 2626 | else if (INTEGERP (dest)) | ||
| 2627 | wdest = (Window) XFASTINT (dest); | ||
| 2628 | else if (FLOATP (dest)) | ||
| 2629 | wdest = (Window) XFLOAT (dest); | ||
| 2630 | else if (CONSP (dest)) | ||
| 2631 | { | ||
| 2632 | if (! NUMBERP (XCAR (dest)) || ! NUMBERP (XCDR (dest))) | ||
| 2633 | error ("Both car and cdr for DEST must be numbers"); | ||
| 2634 | else | ||
| 2635 | wdest = (Window) cons_to_long (dest); | ||
| 2636 | } | ||
| 2637 | else | ||
| 2638 | error ("DEST must be a frame, nil, string, number or cons"); | ||
| 2639 | |||
| 2640 | if (wdest == 0) wdest = dpyinfo->root_window; | ||
| 2641 | to_root = wdest == dpyinfo->root_window; | ||
| 2642 | |||
| 2643 | for (cons = values, size = 0; CONSP (cons); cons = XCDR (cons), ++size) | ||
| 2644 | ; | ||
| 2645 | |||
| 2646 | BLOCK_INPUT; | ||
| 2647 | |||
| 2648 | event.xclient.message_type | ||
| 2649 | = XInternAtom (dpyinfo->display, SDATA (message_type), False); | ||
| 2650 | event.xclient.display = dpyinfo->display; | ||
| 2651 | |||
| 2652 | /* Some clients (metacity for example) expects sending window to be here | ||
| 2653 | when sending to the root window. */ | ||
| 2654 | event.xclient.window = to_root ? FRAME_OUTER_WINDOW (f) : wdest; | ||
| 2655 | |||
| 2656 | memset (event.xclient.data.b, 0, sizeof (event.xclient.data.b)); | ||
| 2657 | x_fill_property_data (dpyinfo->display, values, event.xclient.data.b, | ||
| 2658 | event.xclient.format); | ||
| 2659 | |||
| 2660 | /* If event mask is 0 the event is sent to the client that created | ||
| 2661 | the destination window. But if we are sending to the root window, | ||
| 2662 | there is no such client. Then we set the event mask to 0xffff. The | ||
| 2663 | event then goes to clients selecting for events on the root window. */ | ||
| 2664 | count = x_catch_errors (dpyinfo->display); | ||
| 2665 | { | ||
| 2666 | int propagate = to_root ? False : True; | ||
| 2667 | unsigned mask = to_root ? 0xffff : 0; | ||
| 2668 | XSendEvent (dpyinfo->display, wdest, propagate, mask, &event); | ||
| 2669 | XFlush (dpyinfo->display); | ||
| 2670 | } | ||
| 2671 | x_uncatch_errors (dpyinfo->display, count); | ||
| 2672 | UNBLOCK_INPUT; | ||
| 2673 | |||
| 2674 | return Qnil; | ||
| 2675 | } | ||
| 2676 | |||
| 2677 | |||
| 2313 | void | 2678 | void |
| 2314 | syms_of_xselect () | 2679 | syms_of_xselect () |
| 2315 | { | 2680 | { |
| @@ -2325,6 +2690,9 @@ syms_of_xselect () | |||
| 2325 | defsubr (&Sx_rotate_cut_buffers_internal); | 2690 | defsubr (&Sx_rotate_cut_buffers_internal); |
| 2326 | #endif | 2691 | #endif |
| 2327 | 2692 | ||
| 2693 | defsubr (&Sx_get_atom_name); | ||
| 2694 | defsubr (&Sx_send_client_message); | ||
| 2695 | |||
| 2328 | reading_selection_reply = Fcons (Qnil, Qnil); | 2696 | reading_selection_reply = Fcons (Qnil, Qnil); |
| 2329 | staticpro (&reading_selection_reply); | 2697 | staticpro (&reading_selection_reply); |
| 2330 | reading_selection_window = 0; | 2698 | reading_selection_window = 0; |
diff --git a/src/xterm.c b/src/xterm.c index 2d60a534a42..321e9fa3f2f 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -716,7 +716,7 @@ x_draw_fringe_bitmap (w, row, p) | |||
| 716 | else | 716 | else |
| 717 | x_clip_to_row (w, row, gc); | 717 | x_clip_to_row (w, row, gc); |
| 718 | 718 | ||
| 719 | if (p->bx >= 0) | 719 | if (p->bx >= 0 && !p->overlay_p) |
| 720 | { | 720 | { |
| 721 | /* In case the same realized face is used for fringes and | 721 | /* In case the same realized face is used for fringes and |
| 722 | for something displayed in the text (e.g. face `region' on | 722 | for something displayed in the text (e.g. face `region' on |
| @@ -734,20 +734,49 @@ x_draw_fringe_bitmap (w, row, p) | |||
| 734 | XSetForeground (display, face->gc, face->foreground); | 734 | XSetForeground (display, face->gc, face->foreground); |
| 735 | } | 735 | } |
| 736 | 736 | ||
| 737 | if (p->which != NO_FRINGE_BITMAP) | 737 | if (p->which) |
| 738 | { | 738 | { |
| 739 | unsigned char *bits = fringe_bitmaps[p->which].bits + p->dh; | 739 | unsigned char *bits; |
| 740 | Pixmap pixmap; | 740 | Pixmap pixmap, clipmask = (Pixmap) 0; |
| 741 | int depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f)); | 741 | int depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f)); |
| 742 | XGCValues gcv; | ||
| 743 | |||
| 744 | if (p->wd > 8) | ||
| 745 | bits = (unsigned char *)(p->bits + p->dh); | ||
| 746 | else | ||
| 747 | bits = (unsigned char *)p->bits + p->dh; | ||
| 742 | 748 | ||
| 743 | /* Draw the bitmap. I believe these small pixmaps can be cached | 749 | /* Draw the bitmap. I believe these small pixmaps can be cached |
| 744 | by the server. */ | 750 | by the server. */ |
| 745 | pixmap = XCreatePixmapFromBitmapData (display, window, bits, p->wd, p->h, | 751 | pixmap = XCreatePixmapFromBitmapData (display, window, bits, p->wd, p->h, |
| 746 | face->foreground, | 752 | (p->cursor_p |
| 753 | ? (p->overlay_p ? face->background | ||
| 754 | : f->output_data.x->cursor_pixel) | ||
| 755 | : face->foreground), | ||
| 747 | face->background, depth); | 756 | face->background, depth); |
| 757 | |||
| 758 | if (p->overlay_p) | ||
| 759 | { | ||
| 760 | clipmask = XCreatePixmapFromBitmapData (display, | ||
| 761 | FRAME_X_DISPLAY_INFO (f)->root_window, | ||
| 762 | bits, p->wd, p->h, | ||
| 763 | 1, 0, 1); | ||
| 764 | gcv.clip_mask = clipmask; | ||
| 765 | gcv.clip_x_origin = p->x; | ||
| 766 | gcv.clip_y_origin = p->y; | ||
| 767 | XChangeGC (display, gc, GCClipMask | GCClipXOrigin | GCClipYOrigin, &gcv); | ||
| 768 | } | ||
| 769 | |||
| 748 | XCopyArea (display, pixmap, window, gc, 0, 0, | 770 | XCopyArea (display, pixmap, window, gc, 0, 0, |
| 749 | p->wd, p->h, p->x, p->y); | 771 | p->wd, p->h, p->x, p->y); |
| 750 | XFreePixmap (display, pixmap); | 772 | XFreePixmap (display, pixmap); |
| 773 | |||
| 774 | if (p->overlay_p) | ||
| 775 | { | ||
| 776 | gcv.clip_mask = (Pixmap) 0; | ||
| 777 | XChangeGC (display, gc, GCClipMask, &gcv); | ||
| 778 | XFreePixmap (display, clipmask); | ||
| 779 | } | ||
| 751 | } | 780 | } |
| 752 | 781 | ||
| 753 | XSetClipMask (display, gc, None); | 782 | XSetClipMask (display, gc, None); |
| @@ -5943,7 +5972,25 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 5943 | } | 5972 | } |
| 5944 | #endif /* USE_TOOLKIT_SCROLL_BARS */ | 5973 | #endif /* USE_TOOLKIT_SCROLL_BARS */ |
| 5945 | else | 5974 | else |
| 5946 | goto OTHER; | 5975 | { |
| 5976 | struct frame *f | ||
| 5977 | = x_any_window_to_frame (dpyinfo, event.xclient.window); | ||
| 5978 | |||
| 5979 | if (f) | ||
| 5980 | { | ||
| 5981 | int ret = x_handle_dnd_message (f, &event.xclient, | ||
| 5982 | dpyinfo, bufp); | ||
| 5983 | if (ret > 0) | ||
| 5984 | { | ||
| 5985 | ++bufp, ++count, --numchars; | ||
| 5986 | } | ||
| 5987 | |||
| 5988 | if (ret != 0) | ||
| 5989 | *finish = X_EVENT_DROP; | ||
| 5990 | } | ||
| 5991 | else | ||
| 5992 | goto OTHER; | ||
| 5993 | } | ||
| 5947 | } | 5994 | } |
| 5948 | break; | 5995 | break; |
| 5949 | 5996 | ||
| @@ -10877,6 +10924,8 @@ static struct redisplay_interface x_redisplay_interface = | |||
| 10877 | x_get_glyph_overhangs, | 10924 | x_get_glyph_overhangs, |
| 10878 | x_fix_overlapping_area, | 10925 | x_fix_overlapping_area, |
| 10879 | x_draw_fringe_bitmap, | 10926 | x_draw_fringe_bitmap, |
| 10927 | 0, /* define_fringe_bitmap */ | ||
| 10928 | 0, /* destroy_fringe_bitmap */ | ||
| 10880 | x_per_char_metric, | 10929 | x_per_char_metric, |
| 10881 | x_encode_char, | 10930 | x_encode_char, |
| 10882 | x_compute_glyph_string_overhangs, | 10931 | x_compute_glyph_string_overhangs, |
diff --git a/src/xterm.h b/src/xterm.h index 8eb8604ae75..45de640f165 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -1009,8 +1009,24 @@ extern void x_handle_selection_request P_ ((struct input_event *)); | |||
| 1009 | extern void x_handle_selection_clear P_ ((struct input_event *)); | 1009 | extern void x_handle_selection_clear P_ ((struct input_event *)); |
| 1010 | extern void x_clear_frame_selections P_ ((struct frame *)); | 1010 | extern void x_clear_frame_selections P_ ((struct frame *)); |
| 1011 | 1011 | ||
| 1012 | extern int x_handle_dnd_message P_ ((struct frame *, | ||
| 1013 | XClientMessageEvent *, | ||
| 1014 | struct x_display_info *, | ||
| 1015 | struct input_event *bufp)); | ||
| 1016 | extern int x_check_property_data P_ ((Lisp_Object)); | ||
| 1017 | extern void x_fill_property_data P_ ((Display *, | ||
| 1018 | Lisp_Object, | ||
| 1019 | void *, | ||
| 1020 | int)); | ||
| 1021 | extern Lisp_Object x_property_data_to_lisp P_ ((struct frame *, | ||
| 1022 | unsigned char *, | ||
| 1023 | Atom, | ||
| 1024 | int, | ||
| 1025 | unsigned long)); | ||
| 1026 | |||
| 1012 | /* Defined in xfns.c */ | 1027 | /* Defined in xfns.c */ |
| 1013 | 1028 | ||
| 1029 | extern struct x_display_info * check_x_display_info P_ ((Lisp_Object frame)); | ||
| 1014 | extern int have_menus_p P_ ((void)); | 1030 | extern int have_menus_p P_ ((void)); |
| 1015 | extern int x_bitmap_height P_ ((struct frame *, int)); | 1031 | extern int x_bitmap_height P_ ((struct frame *, int)); |
| 1016 | extern int x_bitmap_width P_ ((struct frame *, int)); | 1032 | extern int x_bitmap_width P_ ((struct frame *, int)); |
| @@ -1062,6 +1078,7 @@ extern void x_free_dpy_colors P_ ((Display *, Screen *, Colormap, | |||
| 1062 | extern void x_activate_menubar P_ ((struct frame *)); | 1078 | extern void x_activate_menubar P_ ((struct frame *)); |
| 1063 | extern int popup_activated P_ ((void)); | 1079 | extern int popup_activated P_ ((void)); |
| 1064 | extern void initialize_frame_menubar P_ ((struct frame *)); | 1080 | extern void initialize_frame_menubar P_ ((struct frame *)); |
| 1081 | extern void free_frame_menubar P_ ((struct frame *)); | ||
| 1065 | 1082 | ||
| 1066 | /* Defined in widget.c */ | 1083 | /* Defined in widget.c */ |
| 1067 | 1084 | ||