diff options
| author | Karoly Lorentey | 2005-10-12 16:14:04 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-10-12 16:14:04 +0000 |
| commit | 734b679135207a8623dc460eb8d108befe080d46 (patch) | |
| tree | dcf30cc27a815776015688ca275b66671c6406dc /src | |
| parent | 0ff21b4e57b1dc7c714c21c9eea1a4906630ecf2 (diff) | |
| parent | cc9e7d9176843a243ca4217229302c1b396dbb6e (diff) | |
| download | emacs-734b679135207a8623dc460eb8d108befe080d46.tar.gz emacs-734b679135207a8623dc460eb8d108befe080d46.zip | |
Merged from miles@gnu.org--gnu-2005 (patch 578-592)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-578
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-579
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-580
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-581
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-582
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-583
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-584
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-585
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-586
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-587
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-588
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-589
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-590
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-591
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-592
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-424
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 200 | ||||
| -rw-r--r-- | src/dispextern.h | 24 | ||||
| -rw-r--r-- | src/dispnew.c | 49 | ||||
| -rw-r--r-- | src/emacs.c | 5 | ||||
| -rw-r--r-- | src/frame.c | 10 | ||||
| -rw-r--r-- | src/image.c | 153 | ||||
| -rw-r--r-- | src/keyboard.c | 38 | ||||
| -rw-r--r-- | src/macgui.h | 13 | ||||
| -rw-r--r-- | src/macterm.c | 889 | ||||
| -rw-r--r-- | src/macterm.h | 84 | ||||
| -rw-r--r-- | src/w32term.c | 126 | ||||
| -rw-r--r-- | src/window.c | 34 | ||||
| -rw-r--r-- | src/xdisp.c | 336 | ||||
| -rw-r--r-- | src/xfaces.c | 6 | ||||
| -rw-r--r-- | src/xfns.c | 2 | ||||
| -rw-r--r-- | src/xterm.c | 91 |
16 files changed, 1230 insertions, 830 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index adb5b204953..d8c93e96754 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,188 @@ | |||
| 1 | 2005-10-12 Kim F. Storm <storm@cua.dk> | ||
| 2 | |||
| 3 | * xdisp.c (remember_mouse_glyph): New generic version based on | ||
| 4 | glyph_rect and remember_mouse_glyph from xterm.c enhanced to | ||
| 5 | properly handle all different window areas. | ||
| 6 | |||
| 7 | * dispextern.h (remember_mouse_glyph): Add prototype. | ||
| 8 | |||
| 9 | * xterm.c (glyph_rect, remember_mouse_glyph): Remove X versions. | ||
| 10 | (note_mouse_movement, XTmouse_position): Use generic | ||
| 11 | remember_mouse_glyph, add last_mouse_glyph arg. | ||
| 12 | |||
| 13 | * w32term.c (note_mouse_movement): Fix last_mouse_glyph check. | ||
| 14 | (glyph_rect, remember_mouse_glyph): Remove w32 specific versions. | ||
| 15 | (note_mouse_movement, w32_mouse_position): Use generic | ||
| 16 | remember_mouse_glyph, add last_mouse_glyph arg. | ||
| 17 | |||
| 18 | * macterm.c (note_mouse_movement): Add call to remember_mouse_glyph. | ||
| 19 | (glyph_rect, remember_mouse_glyph): Remove mac specific versions. | ||
| 20 | (XTmouse_position): Adapt to use generic remember_mouse_glyph | ||
| 21 | instead of pixel_to_glyph_coords. | ||
| 22 | |||
| 23 | * window.c (coordinates_in_window): Fix x position for ON_RIGHT_MARGIN. | ||
| 24 | Fix x position for ON_TEXT when left margin width > 0. | ||
| 25 | |||
| 26 | 2005-10-11 Kim F. Storm <storm@cua.dk> | ||
| 27 | |||
| 28 | * window.c (coordinates_in_window): Fix y position for ON_SCROLL_BAR. | ||
| 29 | |||
| 30 | * keyboard.c (make_lispy_position): Fix buffer calculations for | ||
| 31 | mouse click or movement in right fringe and the margins. | ||
| 32 | |||
| 33 | 2005-10-11 Juanma Barranquero <lekktu@gmail.com> | ||
| 34 | |||
| 35 | * image.c (fn_jpeg_stdio_src): Don't define it. | ||
| 36 | (init_jpeg_functions): Don't initialize `fn_jpeg_stdio_src'. | ||
| 37 | (our_common_init_source): Rename from `our_init_source'. | ||
| 38 | (our_common_term_source): Rename from `our_term_source'. | ||
| 39 | (our_memory_fill_input_buffer): Rename from | ||
| 40 | `our_fill_input_buffer'. | ||
| 41 | (our_memory_skip_input_data): Rename from `our_skip_input_data'. | ||
| 42 | (jpeg_memory_src): Use the new names. | ||
| 43 | (struct jpeg_stdio_mgr): New struct. | ||
| 44 | (JPEG_STDIO_BUFFER_SIZE): New constant. | ||
| 45 | (our_stdio_fill_input_buffer, our_stdio_skip_input_data) | ||
| 46 | (jpeg_file_src): New functions. | ||
| 47 | (jpeg_load): Use `jpeg_file_src' instead of `fn_jpeg_stdio_src'. | ||
| 48 | |||
| 49 | 2005-10-11 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 50 | |||
| 51 | * macterm.c (PER_CHAR_METRIC): Remove unused macro. | ||
| 52 | (fm_font_family_alist): New variable. | ||
| 53 | (syms_of_macterm): Initialize and staticpro it. | ||
| 54 | (decode_mac_font_name): Replace '-' in family name with '_' if it | ||
| 55 | occurs just once. Lower family name. | ||
| 56 | (parse_x_font_name): Rename from x_font_name_to_mac_font_name. | ||
| 57 | All uses changed. Remove argument MF and code conversion for it. | ||
| 58 | Add argument SIZE. Rename argument MF_DECODED to FAMILY, and CS | ||
| 59 | to CHARSET. Parse font size. Lower family name. Return integer | ||
| 60 | value for status of parsing. | ||
| 61 | (init_font_name_table) [USE_ATSUI]: Use decode_mac_font_name. | ||
| 62 | Don't use Fdowncase because family name is already lowered by | ||
| 63 | decode_mac_font_name. | ||
| 64 | (init_font_name_table): Always call decode_mac_font_name. Add | ||
| 65 | pair of family name and its reference to fm_font_family_alist. | ||
| 66 | (mac_clear_font_name_table): Clear fm_font_family_alist. | ||
| 67 | (XLoadQueryFont): Move font size parsing part to parse_x_font_name. | ||
| 68 | Lookup fm_font_family_alist to get font family reference. | ||
| 69 | (XLoadQueryFont) [USE_ATSUI]: Don't use Fdowncase because family | ||
| 70 | name is already lowered by parse_x_font_name. | ||
| 71 | |||
| 72 | 2005-10-11 Kim F. Storm <storm@cua.dk> | ||
| 73 | |||
| 74 | * xterm.c (glyph_rect): Return 0 if position is outside text area. | ||
| 75 | |||
| 76 | * keyboard.c (make_lispy_position): Fix buffer position calculation for | ||
| 77 | mouse click or movement in fringe. | ||
| 78 | |||
| 79 | 2005-10-10 Jason Rumney <jasonr@gnu.org> | ||
| 80 | |||
| 81 | * xterm.c (remember_mouse_glyph): New function. | ||
| 82 | (note_mouse_movement): Use it to remember the current glyph if changed. | ||
| 83 | (XTmouse_position): Fix calculation of fake glyph under mouse. | ||
| 84 | Move code to calculate glyph under mouse into remember_mouse_glyph. | ||
| 85 | |||
| 86 | 2005-10-10 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 87 | |||
| 88 | * emacs.c (USAGE3, standard_args): -nb => -nbi. | ||
| 89 | |||
| 90 | 2005-10-10 Juanma Barranquero <lekktu@gmail.com> | ||
| 91 | |||
| 92 | * frame.c (Fredirect_frame_focus): Fix typos in docstring. | ||
| 93 | (next_frame, prev_frame, set_term_frame_name): Make static. | ||
| 94 | |||
| 95 | * window.c (Fwindow_tree): Fix spelling. | ||
| 96 | |||
| 97 | 2005-10-09 Romain Francoise <romain@orebokech.com> | ||
| 98 | |||
| 99 | * window.c (Fwindow_end): Don't try to redisplay if non-interactive. | ||
| 100 | |||
| 101 | 2005-10-09 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 102 | |||
| 103 | * emacs.c (standard_args): Remove options -i, -itype, --icon-type. | ||
| 104 | Add options -nb, --no-bitmap-icon. | ||
| 105 | |||
| 106 | * xfns.c (Fx_create_frame): Make bitmapIcon have default on. | ||
| 107 | |||
| 108 | 2005-10-08 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 109 | |||
| 110 | * macgui.h (MAX_CLIP_RECTS): New define. | ||
| 111 | (struct _XGC): New member clip_region. | ||
| 112 | (struct _XGC) [MAC_OSX && USE_ATSUI]: New members n_clip_rects and | ||
| 113 | clip_rects. | ||
| 114 | |||
| 115 | * macterm.c (GC_CLIP_REGION): New macro. | ||
| 116 | (saved_port_clip_region): New variable. | ||
| 117 | (mac_begin_clip, mac_end_clip): New functions. | ||
| 118 | (XDrawLine, mac_erase_rectangle, mac_draw_bitmap, XFillRectangle) | ||
| 119 | (mac_draw_rectangle, mac_draw_string_common, mac_copy_area) | ||
| 120 | (mac_copy_area_with_mask, mac_scroll_area): Use them. | ||
| 121 | (mac_set_clip_rectangle, mac_reset_clipping): Remove functions. | ||
| 122 | [USE_ATSUI] (atsu_get_text_layout_with_text_ptr) | ||
| 123 | [MAC_OS_X_VERSION_MAX_ALLOWED < 1020]: Specify kATSLineFractDisable. | ||
| 124 | (mac_draw_string_common) [MAC_OSX && USE_ATSUI]: Clip to clipping | ||
| 125 | rectangles stored in gc. | ||
| 126 | (XFreeGC): Dispose of clipping region. | ||
| 127 | (mac_set_clip_rectangles, mac_reset_clip_rectangles): New functions. | ||
| 128 | (x_draw_fringe_bitmap, x_set_glyph_string_clipping) | ||
| 129 | (x_draw_relief_rect, x_draw_box_rect, x_draw_stretch_glyph_string) | ||
| 130 | (x_draw_glyph_string, x_clip_to_row, x_draw_hollow_cursor) | ||
| 131 | (x_draw_bar_cursor): Use them. | ||
| 132 | (x_set_glyph_string_clipping): Use get_glyph_string_clip_rects to | ||
| 133 | get multiple clipping rectangles. | ||
| 134 | |||
| 135 | * macterm.h (mac_term_init): Add types to extern. | ||
| 136 | (struct mac_output): Remove members mWP and pending_menu_activation. | ||
| 137 | Put members scroll_bar_foreground_pixel and | ||
| 138 | scroll_bar_background_pixel in #if 0. | ||
| 139 | (FRAME_MAC_WINDOW, FRAME_X_WINDOW): Use window_desc. | ||
| 140 | |||
| 141 | * xfaces.c (x_create_gc, x_free_gc) [MAC_OS]: Add BLOCK_INPUT. | ||
| 142 | Add debug code. | ||
| 143 | |||
| 144 | 2005-10-08 Kim F. Storm <storm@cua.dk> | ||
| 145 | |||
| 146 | * window.c (window_tree, Fwindow_tree): Rename fns added 2005-10-04. | ||
| 147 | |||
| 148 | 2005-10-07 Kim F. Storm <storm@cua.dk> | ||
| 149 | |||
| 150 | * dispnew.c (redraw_overlapped_rows, redraw_overlapping_rows) | ||
| 151 | [!HAVE_WINDOW_SYSTEM]: Don't declare them... | ||
| 152 | (update_window) [!HAVE_WINDOW_SYSTEM]: ...and don't call them. | ||
| 153 | |||
| 154 | 2005-10-07 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 155 | |||
| 156 | * dispextern.h (struct glyph_string): Rename member for_overlaps_p | ||
| 157 | to for_overlaps. Now occupy 3 bits. | ||
| 158 | (OVERLAPS_PRED, OVERLAPS_SUCC, OVERLAPS_BOTH) | ||
| 159 | (OVERLAPS_ERASED_CURSOR): New defines. | ||
| 160 | (struct redisplay_interface): Add new OVERLAPS arg to member | ||
| 161 | fix_overlapping_area. | ||
| 162 | (x_fix_overlapping_area): Add new OVERLAPS arg. | ||
| 163 | (get_glyph_string_clip_rects): Add extern. | ||
| 164 | |||
| 165 | * dispnew.c (redraw_overlapping_rows): Call | ||
| 166 | rif->fix_overlapping_area with new OVERLAPS arg as redrawn part. | ||
| 167 | |||
| 168 | * xdisp.c: Rename member for_overlaps_p in struct glyph_string to | ||
| 169 | for_overlaps. | ||
| 170 | (get_glyph_string_clip_rects): New function created from | ||
| 171 | get_glyph_string_clip_rect. Set clipping rectangles according to the | ||
| 172 | value of for_overlaps. Enable to store multiple clipping rectangles. | ||
| 173 | (get_glyph_string_clip_rect): Use get_glyph_string_clip_rects. | ||
| 174 | (fill_composite_glyph_string, fill_glyph_string, draw_glyphs): | ||
| 175 | Rename argument OVERLAPS_P to OVERLAPS. All uses in macros changed. | ||
| 176 | (x_fix_overlapping_area): Add OVERLAPS arg. Pass it to draw_glyphs. | ||
| 177 | (draw_phys_cursor_glyph): Set width of erased cursor to use it for | ||
| 178 | calculating clipping rectangles later. Call x_fix_overlapping_area | ||
| 179 | with new OVERLAPS arg to draw only erased cursor area. | ||
| 180 | (expose_overlaps): Call x_fix_overlapping_area with new OVERLAPS arg | ||
| 181 | to draw overlaps in both preceding and succeeding rows. | ||
| 182 | |||
| 183 | * xterm.c, w32term.c, macterm.c: Rename member for_overlaps_p in | ||
| 184 | struct glyph_string to for_overlaps. | ||
| 185 | |||
| 1 | 2005-10-04 Kim F. Storm <storm@cua.dk> | 186 | 2005-10-04 Kim F. Storm <storm@cua.dk> |
| 2 | 187 | ||
| 3 | * window.c (window_split_tree): New function. | 188 | * window.c (window_split_tree): New function. |
| @@ -130,9 +315,9 @@ | |||
| 130 | 315 | ||
| 131 | * systime.h (get_operating_system_release): ... here. | 316 | * systime.h (get_operating_system_release): ... here. |
| 132 | 317 | ||
| 133 | * xterm.c (set_vertical_scroll_bar): Move prototype ... | 318 | * xterm.c (handle_one_xevent): Refer to union field to match the |
| 134 | (handle_one_xevent): Refer to union field to match the type | 319 | type required by the function definition. |
| 135 | required by the function definition. | 320 | (set_vertical_scroll_bar): Move prototype ... |
| 136 | 321 | ||
| 137 | * xterm.h: ... here. | 322 | * xterm.h: ... here. |
| 138 | 323 | ||
| @@ -1483,7 +1668,7 @@ | |||
| 1483 | 2005-06-04 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | 1668 | 2005-06-04 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> |
| 1484 | 1669 | ||
| 1485 | * macmenu.c (cleanup_popup_menu): New function. | 1670 | * macmenu.c (cleanup_popup_menu): New function. |
| 1486 | (Fx_popup_menu): unwind protect cleanup_popup_menu in case | 1671 | (Fx_popup_menu): Unwind protect cleanup_popup_menu in case |
| 1487 | mac_menu_show Quit:s. | 1672 | mac_menu_show Quit:s. |
| 1488 | (mac_menu_show): Quit on cancel if not popped up on click (i.e. | 1673 | (mac_menu_show): Quit on cancel if not popped up on click (i.e. |
| 1489 | a dialog). | 1674 | a dialog). |
| @@ -3658,7 +3843,7 @@ | |||
| 3658 | [TARGET_API_MAC_CARBON] (Fx_file_dialog): Use MAXPATHLEN for size | 3843 | [TARGET_API_MAC_CARBON] (Fx_file_dialog): Use MAXPATHLEN for size |
| 3659 | of filename string. Set event callback function when creating | 3844 | of filename string. Set event callback function when creating |
| 3660 | dialog boxes. Add code conversions for filenames. Don't dispose | 3845 | dialog boxes. Add code conversions for filenames. Don't dispose |
| 3661 | apple event descriptor record if failed to create it. | 3846 | of apple event descriptor record if failed to create it. |
| 3662 | 3847 | ||
| 3663 | * macterm.c: Include sys/param.h. | 3848 | * macterm.c: Include sys/param.h. |
| 3664 | [USE_CARBON_EVENTS] (mac_handle_window_event): Add handler for | 3849 | [USE_CARBON_EVENTS] (mac_handle_window_event): Add handler for |
| @@ -6765,7 +6950,8 @@ | |||
| 6765 | (x_scroll_bar_handle_click): Set `(PORTION . WHOLE)' part in a | 6950 | (x_scroll_bar_handle_click): Set `(PORTION . WHOLE)' part in a |
| 6766 | scroll-bar click event. | 6951 | scroll-bar click event. |
| 6767 | (mac_define_frame_cursor): Change the pointer shape. | 6952 | (mac_define_frame_cursor): Change the pointer shape. |
| 6768 | (x_free_frame_resources): Reset tip_window to NULL when it is disposed. | 6953 | (x_free_frame_resources): Reset tip_window to NULL when it is |
| 6954 | disposed of. | ||
| 6769 | [!TARGET_API_MAC_CARBON] (arrow_cursor): New variable. | 6955 | [!TARGET_API_MAC_CARBON] (arrow_cursor): New variable. |
| 6770 | [!TARGET_API_MAC_CARBON] (do_init_managers): Initialize arrow_cursor. | 6956 | [!TARGET_API_MAC_CARBON] (do_init_managers): Initialize arrow_cursor. |
| 6771 | (do_window_update): Don't do anything if the updated window is the | 6957 | (do_window_update): Don't do anything if the updated window is the |
| @@ -16784,7 +16970,7 @@ | |||
| 16784 | * w32.c (sys_getpeername, fcntl): New functions. | 16970 | * w32.c (sys_getpeername, fcntl): New functions. |
| 16785 | (_sys_read_ahead): Temporarily block on non-blocking sockets. | 16971 | (_sys_read_ahead): Temporarily block on non-blocking sockets. |
| 16786 | 16972 | ||
| 16787 | * w32proc.c: include sys/file.h. | 16973 | * w32proc.c: Include sys/file.h. |
| 16788 | 16974 | ||
| 16789 | 2002-05-03 Colin Walters <walters@verbum.org> | 16975 | 2002-05-03 Colin Walters <walters@verbum.org> |
| 16790 | 16976 | ||
diff --git a/src/dispextern.h b/src/dispextern.h index dda23310ffa..078726aa5c8 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -1177,10 +1177,18 @@ struct glyph_string | |||
| 1177 | stipple pattern. */ | 1177 | stipple pattern. */ |
| 1178 | unsigned stippled_p : 1; | 1178 | unsigned stippled_p : 1; |
| 1179 | 1179 | ||
| 1180 | /* 1 means only the foreground of this glyph string must be drawn, | 1180 | #define OVERLAPS_PRED (1 << 0) |
| 1181 | and we should use the physical height of the line this glyph | 1181 | #define OVERLAPS_SUCC (1 << 1) |
| 1182 | string appears in as clip rect. */ | 1182 | #define OVERLAPS_BOTH (OVERLAPS_PRED | OVERLAPS_SUCC) |
| 1183 | unsigned for_overlaps_p : 1; | 1183 | #define OVERLAPS_ERASED_CURSOR (1 << 2) |
| 1184 | /* Non-zero means only the foreground of this glyph string must be | ||
| 1185 | drawn, and we should use the physical height of the line this | ||
| 1186 | glyph string appears in as clip rect. If the value is | ||
| 1187 | OVERLAPS_ERASED_CURSOR, the clip rect is restricted to the rect | ||
| 1188 | of the erased cursor. OVERLAPS_PRED and OVERLAPS_SUCC mean we | ||
| 1189 | draw overlaps with the preceding and the succeeding rows, | ||
| 1190 | respectively. */ | ||
| 1191 | unsigned for_overlaps : 3; | ||
| 1184 | 1192 | ||
| 1185 | /* The GC to use for drawing this glyph string. */ | 1193 | /* The GC to use for drawing this glyph string. */ |
| 1186 | #if defined(HAVE_X_WINDOWS) || defined(MAC_OS) | 1194 | #if defined(HAVE_X_WINDOWS) || defined(MAC_OS) |
| @@ -2261,7 +2269,7 @@ struct redisplay_interface | |||
| 2261 | This function is called from redraw_overlapping_rows after | 2269 | This function is called from redraw_overlapping_rows after |
| 2262 | desired rows have been made current. */ | 2270 | desired rows have been made current. */ |
| 2263 | void (*fix_overlapping_area) P_ ((struct window *w, struct glyph_row *row, | 2271 | void (*fix_overlapping_area) P_ ((struct window *w, struct glyph_row *row, |
| 2264 | enum glyph_row_area area)); | 2272 | enum glyph_row_area area, int)); |
| 2265 | 2273 | ||
| 2266 | #ifdef HAVE_WINDOW_SYSTEM | 2274 | #ifdef HAVE_WINDOW_SYSTEM |
| 2267 | 2275 | ||
| @@ -2598,6 +2606,8 @@ int estimate_mode_line_height P_ ((struct frame *, enum face_id)); | |||
| 2598 | void pixel_to_glyph_coords P_ ((struct frame *, int, int, int *, int *, | 2606 | void pixel_to_glyph_coords P_ ((struct frame *, int, int, int *, int *, |
| 2599 | NativeRectangle *, int)); | 2607 | NativeRectangle *, int)); |
| 2600 | int glyph_to_pixel_coords P_ ((struct window *, int, int, int *, int *)); | 2608 | int glyph_to_pixel_coords P_ ((struct window *, int, int, int *, int *)); |
| 2609 | void remember_mouse_glyph P_ ((struct frame *, int, int, NativeRectangle *)); | ||
| 2610 | |||
| 2601 | void mark_window_display_accurate P_ ((Lisp_Object, int)); | 2611 | void mark_window_display_accurate P_ ((Lisp_Object, int)); |
| 2602 | void redisplay_preserve_echo_area P_ ((int)); | 2612 | void redisplay_preserve_echo_area P_ ((int)); |
| 2603 | void set_cursor_from_row P_ ((struct window *, struct glyph_row *, | 2613 | void set_cursor_from_row P_ ((struct window *, struct glyph_row *, |
| @@ -2655,7 +2665,7 @@ extern int x_stretch_cursor_p; | |||
| 2655 | extern struct cursor_pos output_cursor; | 2665 | extern struct cursor_pos output_cursor; |
| 2656 | 2666 | ||
| 2657 | extern void x_fix_overlapping_area P_ ((struct window *, struct glyph_row *, | 2667 | extern void x_fix_overlapping_area P_ ((struct window *, struct glyph_row *, |
| 2658 | enum glyph_row_area)); | 2668 | enum glyph_row_area, int)); |
| 2659 | extern void draw_phys_cursor_glyph P_ ((struct window *, | 2669 | extern void draw_phys_cursor_glyph P_ ((struct window *, |
| 2660 | struct glyph_row *, | 2670 | struct glyph_row *, |
| 2661 | enum draw_glyphs_face)); | 2671 | enum draw_glyphs_face)); |
| @@ -2673,6 +2683,8 @@ extern void x_clear_cursor P_ ((struct window *)); | |||
| 2673 | extern void x_draw_vertical_border P_ ((struct window *w)); | 2683 | extern void x_draw_vertical_border P_ ((struct window *w)); |
| 2674 | 2684 | ||
| 2675 | extern void frame_to_window_pixel_xy P_ ((struct window *, int *, int *)); | 2685 | extern void frame_to_window_pixel_xy P_ ((struct window *, int *, int *)); |
| 2686 | extern int get_glyph_string_clip_rects P_ ((struct glyph_string *, | ||
| 2687 | NativeRectangle *, int)); | ||
| 2676 | extern void get_glyph_string_clip_rect P_ ((struct glyph_string *, | 2688 | extern void get_glyph_string_clip_rect P_ ((struct glyph_string *, |
| 2677 | NativeRectangle *nr)); | 2689 | NativeRectangle *nr)); |
| 2678 | extern Lisp_Object find_hot_spot P_ ((Lisp_Object, int, int)); | 2690 | extern Lisp_Object find_hot_spot P_ ((Lisp_Object, int, int)); |
diff --git a/src/dispnew.c b/src/dispnew.c index 2a4c7599757..095400eb70d 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -3960,6 +3960,7 @@ update_single_window (w, force_p) | |||
| 3960 | } | 3960 | } |
| 3961 | } | 3961 | } |
| 3962 | 3962 | ||
| 3963 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 3963 | 3964 | ||
| 3964 | /* Redraw lines from the current matrix of window W that are | 3965 | /* Redraw lines from the current matrix of window W that are |
| 3965 | overlapped by other rows. YB is bottom-most y-position in W. */ | 3966 | overlapped by other rows. YB is bottom-most y-position in W. */ |
| @@ -4036,23 +4037,33 @@ redraw_overlapping_rows (w, yb) | |||
| 4036 | 4037 | ||
| 4037 | if (row->overlapping_p && i > 0 && bottom_y < yb) | 4038 | if (row->overlapping_p && i > 0 && bottom_y < yb) |
| 4038 | { | 4039 | { |
| 4039 | if (row->used[LEFT_MARGIN_AREA]) | 4040 | int overlaps = 0; |
| 4040 | rif->fix_overlapping_area (w, row, LEFT_MARGIN_AREA); | 4041 | |
| 4041 | 4042 | if (MATRIX_ROW_OVERLAPS_PRED_P (row) | |
| 4042 | if (row->used[TEXT_AREA]) | 4043 | && !MATRIX_ROW (w->current_matrix, i - 1)->overlapped_p) |
| 4043 | rif->fix_overlapping_area (w, row, TEXT_AREA); | 4044 | overlaps |= OVERLAPS_PRED; |
| 4044 | 4045 | if (MATRIX_ROW_OVERLAPS_SUCC_P (row) | |
| 4045 | if (row->used[RIGHT_MARGIN_AREA]) | 4046 | && !MATRIX_ROW (w->current_matrix, i + 1)->overlapped_p) |
| 4046 | rif->fix_overlapping_area (w, row, RIGHT_MARGIN_AREA); | 4047 | overlaps |= OVERLAPS_SUCC; |
| 4047 | 4048 | ||
| 4048 | /* Record in neighbour rows that ROW overwrites part of their | 4049 | if (overlaps) |
| 4049 | display. */ | 4050 | { |
| 4050 | if (row->phys_ascent > row->ascent && i > 0) | 4051 | if (row->used[LEFT_MARGIN_AREA]) |
| 4051 | MATRIX_ROW (w->current_matrix, i - 1)->overlapped_p = 1; | 4052 | rif->fix_overlapping_area (w, row, LEFT_MARGIN_AREA, overlaps); |
| 4052 | if ((row->phys_height - row->phys_ascent | 4053 | |
| 4053 | > row->height - row->ascent) | 4054 | if (row->used[TEXT_AREA]) |
| 4054 | && bottom_y < yb) | 4055 | rif->fix_overlapping_area (w, row, TEXT_AREA, overlaps); |
| 4055 | MATRIX_ROW (w->current_matrix, i + 1)->overlapped_p = 1; | 4056 | |
| 4057 | if (row->used[RIGHT_MARGIN_AREA]) | ||
| 4058 | rif->fix_overlapping_area (w, row, RIGHT_MARGIN_AREA, overlaps); | ||
| 4059 | |||
| 4060 | /* Record in neighbour rows that ROW overwrites part of | ||
| 4061 | their display. */ | ||
| 4062 | if (overlaps & OVERLAPS_PRED) | ||
| 4063 | MATRIX_ROW (w->current_matrix, i - 1)->overlapped_p = 1; | ||
| 4064 | if (overlaps & OVERLAPS_SUCC) | ||
| 4065 | MATRIX_ROW (w->current_matrix, i + 1)->overlapped_p = 1; | ||
| 4066 | } | ||
| 4056 | } | 4067 | } |
| 4057 | 4068 | ||
| 4058 | if (bottom_y >= yb) | 4069 | if (bottom_y >= yb) |
| @@ -4060,6 +4071,8 @@ redraw_overlapping_rows (w, yb) | |||
| 4060 | } | 4071 | } |
| 4061 | } | 4072 | } |
| 4062 | 4073 | ||
| 4074 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 4075 | |||
| 4063 | 4076 | ||
| 4064 | #ifdef GLYPH_DEBUG | 4077 | #ifdef GLYPH_DEBUG |
| 4065 | 4078 | ||
| @@ -4220,11 +4233,13 @@ update_window (w, force_p) | |||
| 4220 | /* Fix the appearance of overlapping/overlapped rows. */ | 4233 | /* Fix the appearance of overlapping/overlapped rows. */ |
| 4221 | if (!paused_p && !w->pseudo_window_p) | 4234 | if (!paused_p && !w->pseudo_window_p) |
| 4222 | { | 4235 | { |
| 4236 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 4223 | if (changed_p && rif->fix_overlapping_area) | 4237 | if (changed_p && rif->fix_overlapping_area) |
| 4224 | { | 4238 | { |
| 4225 | redraw_overlapped_rows (w, yb); | 4239 | redraw_overlapped_rows (w, yb); |
| 4226 | redraw_overlapping_rows (w, yb); | 4240 | redraw_overlapping_rows (w, yb); |
| 4227 | } | 4241 | } |
| 4242 | #endif | ||
| 4228 | 4243 | ||
| 4229 | /* Make cursor visible at cursor position of W. */ | 4244 | /* Make cursor visible at cursor position of W. */ |
| 4230 | set_window_cursor_after_update (w); | 4245 | set_window_cursor_after_update (w); |
diff --git a/src/emacs.c b/src/emacs.c index 278c9e78ef2..b49c9588933 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -312,7 +312,7 @@ Display options:\n\ | |||
| 312 | --fullscreen, -fs make first frame fullscreen\n\ | 312 | --fullscreen, -fs make first frame fullscreen\n\ |
| 313 | --fullwidth, -fw make the first frame wide as the screen\n\ | 313 | --fullwidth, -fw make the first frame wide as the screen\n\ |
| 314 | --geometry, -g GEOMETRY window geometry\n\ | 314 | --geometry, -g GEOMETRY window geometry\n\ |
| 315 | --icon-type, -i use picture of gnu for Emacs icon\n\ | 315 | --no-bitmap-icon, -nbi do not use picture of gnu for Emacs icon\n\ |
| 316 | --iconic start Emacs in iconified state\n\ | 316 | --iconic start Emacs in iconified state\n\ |
| 317 | --internal-border, -ib WIDTH width between text and main border\n\ | 317 | --internal-border, -ib WIDTH width between text and main border\n\ |
| 318 | --line-spacing, -lsp PIXELS additional space to put between lines\n\ | 318 | --line-spacing, -lsp PIXELS additional space to put between lines\n\ |
| @@ -1831,8 +1831,7 @@ struct standard_args standard_args[] = | |||
| 1831 | { "-u", "--user", 30, 1 }, | 1831 | { "-u", "--user", 30, 1 }, |
| 1832 | { "-user", 0, 30, 1 }, | 1832 | { "-user", 0, 30, 1 }, |
| 1833 | { "-debug-init", "--debug-init", 20, 0 }, | 1833 | { "-debug-init", "--debug-init", 20, 0 }, |
| 1834 | { "-i", "--icon-type", 15, 0 }, | 1834 | { "-nbi", "--no-bitmap-icon", 15, 0 }, |
| 1835 | { "-itype", 0, 15, 0 }, | ||
| 1836 | { "-iconic", "--iconic", 15, 0 }, | 1835 | { "-iconic", "--iconic", 15, 0 }, |
| 1837 | { "-D", "--basic-display", 12, 0}, | 1836 | { "-D", "--basic-display", 12, 0}, |
| 1838 | { "-basic-display", 0, 12, 0}, | 1837 | { "-basic-display", 0, 12, 0}, |
diff --git a/src/frame.c b/src/frame.c index 5ebdf7f11d8..8d45ddc33f2 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -1096,7 +1096,7 @@ DEFUN ("frame-list", Fframe_list, Sframe_list, | |||
| 1096 | If MINIBUF is 0, include all visible and iconified frames. | 1096 | If MINIBUF is 0, include all visible and iconified frames. |
| 1097 | Otherwise, include all frames. */ | 1097 | Otherwise, include all frames. */ |
| 1098 | 1098 | ||
| 1099 | Lisp_Object | 1099 | static Lisp_Object |
| 1100 | next_frame (frame, minibuf) | 1100 | next_frame (frame, minibuf) |
| 1101 | Lisp_Object frame; | 1101 | Lisp_Object frame; |
| 1102 | Lisp_Object minibuf; | 1102 | Lisp_Object minibuf; |
| @@ -1176,7 +1176,7 @@ next_frame (frame, minibuf) | |||
| 1176 | If MINIBUF is 0, include all visible and iconified frames. | 1176 | If MINIBUF is 0, include all visible and iconified frames. |
| 1177 | Otherwise, include all frames. */ | 1177 | Otherwise, include all frames. */ |
| 1178 | 1178 | ||
| 1179 | Lisp_Object | 1179 | static Lisp_Object |
| 1180 | prev_frame (frame, minibuf) | 1180 | prev_frame (frame, minibuf) |
| 1181 | Lisp_Object frame; | 1181 | Lisp_Object frame; |
| 1182 | Lisp_Object minibuf; | 1182 | Lisp_Object minibuf; |
| @@ -2043,7 +2043,7 @@ Focus redirection is useful for temporarily redirecting keystrokes to | |||
| 2043 | a surrogate minibuffer frame when a frame doesn't have its own | 2043 | a surrogate minibuffer frame when a frame doesn't have its own |
| 2044 | minibuffer window. | 2044 | minibuffer window. |
| 2045 | 2045 | ||
| 2046 | A frame's focus redirection can be changed by select-frame. If frame | 2046 | A frame's focus redirection can be changed by `select-frame'. If frame |
| 2047 | FOO is selected, and then a different frame BAR is selected, any | 2047 | FOO is selected, and then a different frame BAR is selected, any |
| 2048 | frames redirecting their focus to FOO are shifted to redirect their | 2048 | frames redirecting their focus to FOO are shifted to redirect their |
| 2049 | focus to BAR. This allows focus redirection to work properly when the | 2049 | focus to BAR. This allows focus redirection to work properly when the |
| @@ -2051,7 +2051,7 @@ user switches from one frame to another using `select-window'. | |||
| 2051 | 2051 | ||
| 2052 | This means that a frame whose focus is redirected to itself is treated | 2052 | This means that a frame whose focus is redirected to itself is treated |
| 2053 | differently from a frame whose focus is redirected to nil; the former | 2053 | differently from a frame whose focus is redirected to nil; the former |
| 2054 | is affected by select-frame, while the latter is not. | 2054 | is affected by `select-frame', while the latter is not. |
| 2055 | 2055 | ||
| 2056 | The redirection lasts until `redirect-frame-focus' is called to change it. */) | 2056 | The redirection lasts until `redirect-frame-focus' is called to change it. */) |
| 2057 | (frame, focus_frame) | 2057 | (frame, focus_frame) |
| @@ -2186,7 +2186,7 @@ frame_name_fnn_p (str, len) | |||
| 2186 | /* Set the name of the terminal frame. Also used by MSDOS frames. | 2186 | /* Set the name of the terminal frame. Also used by MSDOS frames. |
| 2187 | Modeled after x_set_name which is used for WINDOW frames. */ | 2187 | Modeled after x_set_name which is used for WINDOW frames. */ |
| 2188 | 2188 | ||
| 2189 | void | 2189 | static void |
| 2190 | set_term_frame_name (f, name) | 2190 | set_term_frame_name (f, name) |
| 2191 | struct frame *f; | 2191 | struct frame *f; |
| 2192 | Lisp_Object name; | 2192 | Lisp_Object name; |
diff --git a/src/image.c b/src/image.c index 3b6969b0c28..2463c24a33a 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -6358,7 +6358,6 @@ DEF_IMGLIB_FN (jpeg_finish_decompress); | |||
| 6358 | DEF_IMGLIB_FN (jpeg_destroy_decompress); | 6358 | DEF_IMGLIB_FN (jpeg_destroy_decompress); |
| 6359 | DEF_IMGLIB_FN (jpeg_read_header); | 6359 | DEF_IMGLIB_FN (jpeg_read_header); |
| 6360 | DEF_IMGLIB_FN (jpeg_read_scanlines); | 6360 | DEF_IMGLIB_FN (jpeg_read_scanlines); |
| 6361 | DEF_IMGLIB_FN (jpeg_stdio_src); | ||
| 6362 | DEF_IMGLIB_FN (jpeg_std_error); | 6361 | DEF_IMGLIB_FN (jpeg_std_error); |
| 6363 | DEF_IMGLIB_FN (jpeg_resync_to_restart); | 6362 | DEF_IMGLIB_FN (jpeg_resync_to_restart); |
| 6364 | 6363 | ||
| @@ -6374,7 +6373,6 @@ init_jpeg_functions (Lisp_Object libraries) | |||
| 6374 | LOAD_IMGLIB_FN (library, jpeg_read_scanlines); | 6373 | LOAD_IMGLIB_FN (library, jpeg_read_scanlines); |
| 6375 | LOAD_IMGLIB_FN (library, jpeg_start_decompress); | 6374 | LOAD_IMGLIB_FN (library, jpeg_start_decompress); |
| 6376 | LOAD_IMGLIB_FN (library, jpeg_read_header); | 6375 | LOAD_IMGLIB_FN (library, jpeg_read_header); |
| 6377 | LOAD_IMGLIB_FN (library, jpeg_stdio_src); | ||
| 6378 | LOAD_IMGLIB_FN (library, jpeg_CreateDecompress); | 6376 | LOAD_IMGLIB_FN (library, jpeg_CreateDecompress); |
| 6379 | LOAD_IMGLIB_FN (library, jpeg_destroy_decompress); | 6377 | LOAD_IMGLIB_FN (library, jpeg_destroy_decompress); |
| 6380 | LOAD_IMGLIB_FN (library, jpeg_std_error); | 6378 | LOAD_IMGLIB_FN (library, jpeg_std_error); |
| @@ -6400,7 +6398,6 @@ jpeg_resync_to_restart_wrapper(cinfo, desired) | |||
| 6400 | #define fn_jpeg_destroy_decompress jpeg_destroy_decompress | 6398 | #define fn_jpeg_destroy_decompress jpeg_destroy_decompress |
| 6401 | #define fn_jpeg_read_header jpeg_read_header | 6399 | #define fn_jpeg_read_header jpeg_read_header |
| 6402 | #define fn_jpeg_read_scanlines jpeg_read_scanlines | 6400 | #define fn_jpeg_read_scanlines jpeg_read_scanlines |
| 6403 | #define fn_jpeg_stdio_src jpeg_stdio_src | ||
| 6404 | #define fn_jpeg_std_error jpeg_std_error | 6401 | #define fn_jpeg_std_error jpeg_std_error |
| 6405 | #define jpeg_resync_to_restart_wrapper jpeg_resync_to_restart | 6402 | #define jpeg_resync_to_restart_wrapper jpeg_resync_to_restart |
| 6406 | 6403 | ||
| @@ -6427,7 +6424,17 @@ my_error_exit (cinfo) | |||
| 6427 | libjpeg.doc from the JPEG lib distribution. */ | 6424 | libjpeg.doc from the JPEG lib distribution. */ |
| 6428 | 6425 | ||
| 6429 | static void | 6426 | static void |
| 6430 | our_init_source (cinfo) | 6427 | our_common_init_source (cinfo) |
| 6428 | j_decompress_ptr cinfo; | ||
| 6429 | { | ||
| 6430 | } | ||
| 6431 | |||
| 6432 | |||
| 6433 | /* Method to terminate data source. Called by | ||
| 6434 | jpeg_finish_decompress() after all data has been processed. */ | ||
| 6435 | |||
| 6436 | static void | ||
| 6437 | our_common_term_source (cinfo) | ||
| 6431 | j_decompress_ptr cinfo; | 6438 | j_decompress_ptr cinfo; |
| 6432 | { | 6439 | { |
| 6433 | } | 6440 | } |
| @@ -6438,7 +6445,7 @@ our_init_source (cinfo) | |||
| 6438 | so this only adds a fake end of input marker at the end. */ | 6445 | so this only adds a fake end of input marker at the end. */ |
| 6439 | 6446 | ||
| 6440 | static boolean | 6447 | static boolean |
| 6441 | our_fill_input_buffer (cinfo) | 6448 | our_memory_fill_input_buffer (cinfo) |
| 6442 | j_decompress_ptr cinfo; | 6449 | j_decompress_ptr cinfo; |
| 6443 | { | 6450 | { |
| 6444 | /* Insert a fake EOI marker. */ | 6451 | /* Insert a fake EOI marker. */ |
| @@ -6458,7 +6465,7 @@ our_fill_input_buffer (cinfo) | |||
| 6458 | is the JPEG data source manager. */ | 6465 | is the JPEG data source manager. */ |
| 6459 | 6466 | ||
| 6460 | static void | 6467 | static void |
| 6461 | our_skip_input_data (cinfo, num_bytes) | 6468 | our_memory_skip_input_data (cinfo, num_bytes) |
| 6462 | j_decompress_ptr cinfo; | 6469 | j_decompress_ptr cinfo; |
| 6463 | long num_bytes; | 6470 | long num_bytes; |
| 6464 | { | 6471 | { |
| @@ -6475,16 +6482,6 @@ our_skip_input_data (cinfo, num_bytes) | |||
| 6475 | } | 6482 | } |
| 6476 | 6483 | ||
| 6477 | 6484 | ||
| 6478 | /* Method to terminate data source. Called by | ||
| 6479 | jpeg_finish_decompress() after all data has been processed. */ | ||
| 6480 | |||
| 6481 | static void | ||
| 6482 | our_term_source (cinfo) | ||
| 6483 | j_decompress_ptr cinfo; | ||
| 6484 | { | ||
| 6485 | } | ||
| 6486 | |||
| 6487 | |||
| 6488 | /* Set up the JPEG lib for reading an image from DATA which contains | 6485 | /* Set up the JPEG lib for reading an image from DATA which contains |
| 6489 | LEN bytes. CINFO is the decompression info structure created for | 6486 | LEN bytes. CINFO is the decompression info structure created for |
| 6490 | reading the image. */ | 6487 | reading the image. */ |
| @@ -6508,16 +6505,130 @@ jpeg_memory_src (cinfo, data, len) | |||
| 6508 | } | 6505 | } |
| 6509 | 6506 | ||
| 6510 | src = (struct jpeg_source_mgr *) cinfo->src; | 6507 | src = (struct jpeg_source_mgr *) cinfo->src; |
| 6511 | src->init_source = our_init_source; | 6508 | src->init_source = our_common_init_source; |
| 6512 | src->fill_input_buffer = our_fill_input_buffer; | 6509 | src->fill_input_buffer = our_memory_fill_input_buffer; |
| 6513 | src->skip_input_data = our_skip_input_data; | 6510 | src->skip_input_data = our_memory_skip_input_data; |
| 6514 | src->resync_to_restart = jpeg_resync_to_restart_wrapper; /* Use default method. */ | 6511 | src->resync_to_restart = jpeg_resync_to_restart_wrapper; /* Use default method. */ |
| 6515 | src->term_source = our_term_source; | 6512 | src->term_source = our_common_term_source; |
| 6516 | src->bytes_in_buffer = len; | 6513 | src->bytes_in_buffer = len; |
| 6517 | src->next_input_byte = data; | 6514 | src->next_input_byte = data; |
| 6518 | } | 6515 | } |
| 6519 | 6516 | ||
| 6520 | 6517 | ||
| 6518 | struct jpeg_stdio_mgr | ||
| 6519 | { | ||
| 6520 | struct jpeg_source_mgr mgr; | ||
| 6521 | boolean finished; | ||
| 6522 | FILE *file; | ||
| 6523 | JOCTET *buffer; | ||
| 6524 | }; | ||
| 6525 | |||
| 6526 | |||
| 6527 | /* Size of buffer to read JPEG from file. | ||
| 6528 | Not too big, as we want to use alloc_small. */ | ||
| 6529 | #define JPEG_STDIO_BUFFER_SIZE 8192 | ||
| 6530 | |||
| 6531 | |||
| 6532 | /* Fill input buffer method for JPEG data source manager. Called | ||
| 6533 | whenever more data is needed. The data is read from a FILE *. */ | ||
| 6534 | |||
| 6535 | static boolean | ||
| 6536 | our_stdio_fill_input_buffer (cinfo) | ||
| 6537 | j_decompress_ptr cinfo; | ||
| 6538 | { | ||
| 6539 | struct jpeg_stdio_mgr *src; | ||
| 6540 | |||
| 6541 | src = (struct jpeg_stdio_mgr *) cinfo->src; | ||
| 6542 | if (!src->finished) | ||
| 6543 | { | ||
| 6544 | size_t bytes; | ||
| 6545 | |||
| 6546 | bytes = fread (src->buffer, 1, JPEG_STDIO_BUFFER_SIZE, src->file); | ||
| 6547 | if (bytes > 0) | ||
| 6548 | src->mgr.bytes_in_buffer = bytes; | ||
| 6549 | else | ||
| 6550 | { | ||
| 6551 | WARNMS (cinfo, JWRN_JPEG_EOF); | ||
| 6552 | src->finished = 1; | ||
| 6553 | src->buffer[0] = (JOCTET) 0xFF; | ||
| 6554 | src->buffer[1] = (JOCTET) JPEG_EOI; | ||
| 6555 | src->mgr.bytes_in_buffer = 2; | ||
| 6556 | } | ||
| 6557 | src->mgr.next_input_byte = src->buffer; | ||
| 6558 | } | ||
| 6559 | |||
| 6560 | return 1; | ||
| 6561 | } | ||
| 6562 | |||
| 6563 | |||
| 6564 | /* Method to skip over NUM_BYTES bytes in the image data. CINFO->src | ||
| 6565 | is the JPEG data source manager. */ | ||
| 6566 | |||
| 6567 | static void | ||
| 6568 | our_stdio_skip_input_data (cinfo, num_bytes) | ||
| 6569 | j_decompress_ptr cinfo; | ||
| 6570 | long num_bytes; | ||
| 6571 | { | ||
| 6572 | struct jpeg_stdio_mgr *src; | ||
| 6573 | src = (struct jpeg_stdio_mgr *) cinfo->src; | ||
| 6574 | |||
| 6575 | while (num_bytes > 0 && !src->finished) | ||
| 6576 | { | ||
| 6577 | if (num_bytes <= src->mgr.bytes_in_buffer) | ||
| 6578 | { | ||
| 6579 | src->mgr.bytes_in_buffer -= num_bytes; | ||
| 6580 | src->mgr.next_input_byte += num_bytes; | ||
| 6581 | break; | ||
| 6582 | } | ||
| 6583 | else | ||
| 6584 | { | ||
| 6585 | num_bytes -= src->mgr.bytes_in_buffer; | ||
| 6586 | src->mgr.bytes_in_buffer = 0; | ||
| 6587 | src->mgr.next_input_byte = NULL; | ||
| 6588 | |||
| 6589 | our_stdio_fill_input_buffer (cinfo); | ||
| 6590 | } | ||
| 6591 | } | ||
| 6592 | } | ||
| 6593 | |||
| 6594 | |||
| 6595 | /* Set up the JPEG lib for reading an image from a FILE *. | ||
| 6596 | CINFO is the decompression info structure created for | ||
| 6597 | reading the image. */ | ||
| 6598 | |||
| 6599 | static void | ||
| 6600 | jpeg_file_src (cinfo, fp) | ||
| 6601 | j_decompress_ptr cinfo; | ||
| 6602 | FILE *fp; | ||
| 6603 | { | ||
| 6604 | struct jpeg_stdio_mgr *src; | ||
| 6605 | |||
| 6606 | if (cinfo->src != NULL) | ||
| 6607 | src = (struct jpeg_stdio_mgr *) cinfo->src; | ||
| 6608 | else | ||
| 6609 | { | ||
| 6610 | /* First time for this JPEG object? */ | ||
| 6611 | cinfo->src = (struct jpeg_source_mgr *) | ||
| 6612 | (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, | ||
| 6613 | sizeof (struct jpeg_stdio_mgr)); | ||
| 6614 | src = (struct jpeg_stdio_mgr *) cinfo->src; | ||
| 6615 | src->buffer = (JOCTET *) | ||
| 6616 | (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, | ||
| 6617 | JPEG_STDIO_BUFFER_SIZE); | ||
| 6618 | } | ||
| 6619 | |||
| 6620 | src->file = fp; | ||
| 6621 | src->finished = 0; | ||
| 6622 | src->mgr.init_source = our_common_init_source; | ||
| 6623 | src->mgr.fill_input_buffer = our_stdio_fill_input_buffer; | ||
| 6624 | src->mgr.skip_input_data = our_stdio_skip_input_data; | ||
| 6625 | src->mgr.resync_to_restart = jpeg_resync_to_restart_wrapper; /* Use default method. */ | ||
| 6626 | src->mgr.term_source = our_common_term_source; | ||
| 6627 | src->mgr.bytes_in_buffer = 0; | ||
| 6628 | src->mgr.next_input_byte = NULL; | ||
| 6629 | } | ||
| 6630 | |||
| 6631 | |||
| 6521 | /* Load image IMG for use on frame F. Patterned after example.c | 6632 | /* Load image IMG for use on frame F. Patterned after example.c |
| 6522 | from the JPEG lib. */ | 6633 | from the JPEG lib. */ |
| 6523 | 6634 | ||
| @@ -6601,7 +6712,7 @@ jpeg_load (f, img) | |||
| 6601 | fn_jpeg_CreateDecompress (&cinfo, JPEG_LIB_VERSION, sizeof (cinfo)); | 6712 | fn_jpeg_CreateDecompress (&cinfo, JPEG_LIB_VERSION, sizeof (cinfo)); |
| 6602 | 6713 | ||
| 6603 | if (NILP (specified_data)) | 6714 | if (NILP (specified_data)) |
| 6604 | fn_jpeg_stdio_src (&cinfo, (FILE *) fp); | 6715 | jpeg_file_src (&cinfo, (FILE *) fp); |
| 6605 | else | 6716 | else |
| 6606 | jpeg_memory_src (&cinfo, SDATA (specified_data), | 6717 | jpeg_memory_src (&cinfo, SDATA (specified_data), |
| 6607 | SBYTES (specified_data)); | 6718 | SBYTES (specified_data)); |
diff --git a/src/keyboard.c b/src/keyboard.c index 786e97d7d89..4937cc445bd 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -5144,20 +5144,37 @@ make_lispy_position (f, x, y, time) | |||
| 5144 | &object, &dx, &dy, &width, &height); | 5144 | &object, &dx, &dy, &width, &height); |
| 5145 | if (STRINGP (string)) | 5145 | if (STRINGP (string)) |
| 5146 | string_info = Fcons (string, make_number (charpos)); | 5146 | string_info = Fcons (string, make_number (charpos)); |
| 5147 | if (part == ON_LEFT_MARGIN) | ||
| 5148 | wx = 0; | ||
| 5149 | else | ||
| 5150 | wx = window_box_right_offset (w, TEXT_AREA) - 1; | ||
| 5151 | } | ||
| 5152 | else if (part == ON_LEFT_FRINGE) | ||
| 5153 | { | ||
| 5154 | posn = Qleft_fringe; | ||
| 5155 | rx = 0; | ||
| 5156 | dx = wx; | ||
| 5157 | wx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | ||
| 5158 | ? 0 | ||
| 5159 | : window_box_width (w, LEFT_MARGIN_AREA)); | ||
| 5160 | dx -= wx; | ||
| 5147 | } | 5161 | } |
| 5148 | else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE) | 5162 | else if (part == ON_RIGHT_FRINGE) |
| 5149 | { | 5163 | { |
| 5150 | posn = (part == ON_LEFT_FRINGE) ? Qleft_fringe : Qright_fringe; | 5164 | posn = Qright_fringe; |
| 5151 | rx = 0; | 5165 | rx = 0; |
| 5152 | dx = wx; | 5166 | dx = wx; |
| 5153 | if (part == ON_RIGHT_FRINGE) | 5167 | wx = (window_box_width (w, LEFT_MARGIN_AREA) |
| 5154 | dx -= (window_box_width (w, LEFT_MARGIN_AREA) | 5168 | + window_box_width (w, TEXT_AREA) |
| 5155 | + window_box_width (w, TEXT_AREA) | 5169 | + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) |
| 5156 | + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | 5170 | ? window_box_width (w, RIGHT_MARGIN_AREA) |
| 5157 | ? window_box_width (w, RIGHT_MARGIN_AREA) | 5171 | : 0)); |
| 5158 | : 0)); | 5172 | dx -= wx; |
| 5159 | else if (!WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) | 5173 | } |
| 5160 | dx -= window_box_width (w, LEFT_MARGIN_AREA); | 5174 | else |
| 5175 | { | ||
| 5176 | /* Note: We have no special posn for part == ON_SCROLL_BAR. */ | ||
| 5177 | wx = max (WINDOW_LEFT_MARGIN_WIDTH (w), wx); | ||
| 5161 | } | 5178 | } |
| 5162 | 5179 | ||
| 5163 | if (textpos < 0) | 5180 | if (textpos < 0) |
| @@ -5166,7 +5183,6 @@ make_lispy_position (f, x, y, time) | |||
| 5166 | struct display_pos p; | 5183 | struct display_pos p; |
| 5167 | int dx2, dy2; | 5184 | int dx2, dy2; |
| 5168 | int width2, height2; | 5185 | int width2, height2; |
| 5169 | wx = max (WINDOW_LEFT_MARGIN_WIDTH (w), wx); | ||
| 5170 | string2 = buffer_posn_from_coords (w, &wx, &wy, &p, | 5186 | string2 = buffer_posn_from_coords (w, &wx, &wy, &p, |
| 5171 | &object2, &dx2, &dy2, | 5187 | &object2, &dx2, &dy2, |
| 5172 | &width2, &height2); | 5188 | &width2, &height2); |
diff --git a/src/macgui.h b/src/macgui.h index 378dbcd9e5c..6e2adb092c6 100644 --- a/src/macgui.h +++ b/src/macgui.h | |||
| @@ -192,6 +192,19 @@ typedef struct _XGC | |||
| 192 | 192 | ||
| 193 | /* QuickDraw background color. */ | 193 | /* QuickDraw background color. */ |
| 194 | RGBColor back_color; | 194 | RGBColor back_color; |
| 195 | |||
| 196 | #define MAX_CLIP_RECTS 2 | ||
| 197 | /* QuickDraw clipping region. */ | ||
| 198 | RgnHandle clip_region; | ||
| 199 | |||
| 200 | #if defined (MAC_OSX) && USE_ATSUI | ||
| 201 | /* Number of clipping rectangles used in Quartz 2D drawing. */ | ||
| 202 | int n_clip_rects; | ||
| 203 | |||
| 204 | /* Clipping rectangles used in Quartz 2D drawing. The y-coordinate | ||
| 205 | is in QuickDraw's. */ | ||
| 206 | CGRect clip_rects[MAX_CLIP_RECTS]; | ||
| 207 | #endif | ||
| 195 | } *GC; | 208 | } *GC; |
| 196 | 209 | ||
| 197 | #define GCForeground (1L<<2) | 210 | #define GCForeground (1L<<2) |
diff --git a/src/macterm.c b/src/macterm.c index c9d91607573..83561639cbf 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -270,8 +270,38 @@ extern void menubar_selection_callback (FRAME_PTR, int); | |||
| 270 | #define GC_FORE_COLOR(gc) (&(gc)->fore_color) | 270 | #define GC_FORE_COLOR(gc) (&(gc)->fore_color) |
| 271 | #define GC_BACK_COLOR(gc) (&(gc)->back_color) | 271 | #define GC_BACK_COLOR(gc) (&(gc)->back_color) |
| 272 | #define GC_FONT(gc) ((gc)->xgcv.font) | 272 | #define GC_FONT(gc) ((gc)->xgcv.font) |
| 273 | #define GC_CLIP_REGION(gc) ((gc)->clip_region) | ||
| 273 | #define MAC_WINDOW_NORMAL_GC(w) (((mac_output *) GetWRefCon (w))->normal_gc) | 274 | #define MAC_WINDOW_NORMAL_GC(w) (((mac_output *) GetWRefCon (w))->normal_gc) |
| 274 | 275 | ||
| 276 | static RgnHandle saved_port_clip_region = NULL; | ||
| 277 | |||
| 278 | static void | ||
| 279 | mac_begin_clip (region) | ||
| 280 | RgnHandle region; | ||
| 281 | { | ||
| 282 | static RgnHandle new_region = NULL; | ||
| 283 | |||
| 284 | if (saved_port_clip_region == NULL) | ||
| 285 | saved_port_clip_region = NewRgn (); | ||
| 286 | if (new_region == NULL) | ||
| 287 | new_region = NewRgn (); | ||
| 288 | |||
| 289 | if (region) | ||
| 290 | { | ||
| 291 | GetClip (saved_port_clip_region); | ||
| 292 | SectRgn (saved_port_clip_region, region, new_region); | ||
| 293 | SetClip (new_region); | ||
| 294 | } | ||
| 295 | } | ||
| 296 | |||
| 297 | static void | ||
| 298 | mac_end_clip (region) | ||
| 299 | RgnHandle region; | ||
| 300 | { | ||
| 301 | if (region) | ||
| 302 | SetClip (saved_port_clip_region); | ||
| 303 | } | ||
| 304 | |||
| 275 | 305 | ||
| 276 | /* X display function emulation */ | 306 | /* X display function emulation */ |
| 277 | 307 | ||
| @@ -297,8 +327,10 @@ XDrawLine (display, w, gc, x1, y1, x2, y2) | |||
| 297 | 327 | ||
| 298 | RGBForeColor (GC_FORE_COLOR (gc)); | 328 | RGBForeColor (GC_FORE_COLOR (gc)); |
| 299 | 329 | ||
| 330 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 300 | MoveTo (x1, y1); | 331 | MoveTo (x1, y1); |
| 301 | LineTo (x2, y2); | 332 | LineTo (x2, y2); |
| 333 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 302 | } | 334 | } |
| 303 | 335 | ||
| 304 | void | 336 | void |
| @@ -339,7 +371,9 @@ mac_erase_rectangle (w, gc, x, y, width, height) | |||
| 339 | RGBBackColor (GC_BACK_COLOR (gc)); | 371 | RGBBackColor (GC_BACK_COLOR (gc)); |
| 340 | SetRect (&r, x, y, x + width, y + height); | 372 | SetRect (&r, x, y, x + width, y + height); |
| 341 | 373 | ||
| 374 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 342 | EraseRect (&r); | 375 | EraseRect (&r); |
| 376 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 343 | 377 | ||
| 344 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (w))); | 378 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (w))); |
| 345 | } | 379 | } |
| @@ -406,6 +440,7 @@ mac_draw_bitmap (display, w, gc, x, y, width, height, bits, overlay_p) | |||
| 406 | RGBBackColor (GC_BACK_COLOR (gc)); | 440 | RGBBackColor (GC_BACK_COLOR (gc)); |
| 407 | SetRect (&r, x, y, x + width, y + height); | 441 | SetRect (&r, x, y, x + width, y + height); |
| 408 | 442 | ||
| 443 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 409 | #if TARGET_API_MAC_CARBON | 444 | #if TARGET_API_MAC_CARBON |
| 410 | LockPortBits (GetWindowPort (w)); | 445 | LockPortBits (GetWindowPort (w)); |
| 411 | CopyBits (&bitmap, GetPortBitMapForCopyBits (GetWindowPort (w)), | 446 | CopyBits (&bitmap, GetPortBitMapForCopyBits (GetWindowPort (w)), |
| @@ -415,41 +450,12 @@ mac_draw_bitmap (display, w, gc, x, y, width, height, bits, overlay_p) | |||
| 415 | CopyBits (&bitmap, &(w->portBits), &(bitmap.bounds), &r, | 450 | CopyBits (&bitmap, &(w->portBits), &(bitmap.bounds), &r, |
| 416 | overlay_p ? srcOr : srcCopy, 0); | 451 | overlay_p ? srcOr : srcCopy, 0); |
| 417 | #endif /* not TARGET_API_MAC_CARBON */ | 452 | #endif /* not TARGET_API_MAC_CARBON */ |
| 453 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 418 | 454 | ||
| 419 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (w))); | 455 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (w))); |
| 420 | } | 456 | } |
| 421 | 457 | ||
| 422 | 458 | ||
| 423 | /* Mac replacement for XSetClipRectangles. */ | ||
| 424 | |||
| 425 | static void | ||
| 426 | mac_set_clip_rectangle (display, w, r) | ||
| 427 | Display *display; | ||
| 428 | WindowPtr w; | ||
| 429 | Rect *r; | ||
| 430 | { | ||
| 431 | SetPortWindowPort (w); | ||
| 432 | |||
| 433 | ClipRect (r); | ||
| 434 | } | ||
| 435 | |||
| 436 | |||
| 437 | /* Mac replacement for XSetClipMask. */ | ||
| 438 | |||
| 439 | static void | ||
| 440 | mac_reset_clipping (display, w) | ||
| 441 | Display *display; | ||
| 442 | WindowPtr w; | ||
| 443 | { | ||
| 444 | Rect r; | ||
| 445 | |||
| 446 | SetPortWindowPort (w); | ||
| 447 | |||
| 448 | SetRect (&r, -32767, -32767, 32767, 32767); | ||
| 449 | ClipRect (&r); | ||
| 450 | } | ||
| 451 | |||
| 452 | |||
| 453 | /* Mac replacement for XCreateBitmapFromBitmapData. */ | 459 | /* Mac replacement for XCreateBitmapFromBitmapData. */ |
| 454 | 460 | ||
| 455 | static void | 461 | static void |
| @@ -577,7 +583,9 @@ XFillRectangle (display, w, gc, x, y, width, height) | |||
| 577 | RGBForeColor (GC_FORE_COLOR (gc)); | 583 | RGBForeColor (GC_FORE_COLOR (gc)); |
| 578 | SetRect (&r, x, y, x + width, y + height); | 584 | SetRect (&r, x, y, x + width, y + height); |
| 579 | 585 | ||
| 586 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 580 | PaintRect (&r); /* using foreground color of gc */ | 587 | PaintRect (&r); /* using foreground color of gc */ |
| 588 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 581 | } | 589 | } |
| 582 | 590 | ||
| 583 | 591 | ||
| @@ -625,7 +633,9 @@ mac_draw_rectangle (display, w, gc, x, y, width, height) | |||
| 625 | RGBForeColor (GC_FORE_COLOR (gc)); | 633 | RGBForeColor (GC_FORE_COLOR (gc)); |
| 626 | SetRect (&r, x, y, x + width + 1, y + height + 1); | 634 | SetRect (&r, x, y, x + width + 1, y + height + 1); |
| 627 | 635 | ||
| 636 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 628 | FrameRect (&r); /* using foreground color of gc */ | 637 | FrameRect (&r); /* using foreground color of gc */ |
| 638 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 629 | } | 639 | } |
| 630 | 640 | ||
| 631 | 641 | ||
| @@ -678,7 +688,7 @@ atsu_get_text_layout_with_text_ptr (text, text_length, style, text_layout) | |||
| 678 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 | 688 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 |
| 679 | kATSLineDisableAllLayoutOperations | kATSLineUseDeviceMetrics | 689 | kATSLineDisableAllLayoutOperations | kATSLineUseDeviceMetrics |
| 680 | #else | 690 | #else |
| 681 | kATSLineIsDisplayOnly | 691 | kATSLineIsDisplayOnly | kATSLineFractDisable |
| 682 | #endif | 692 | #endif |
| 683 | ; | 693 | ; |
| 684 | ATSUAttributeValuePtr values[] = {&line_layout}; | 694 | ATSUAttributeValuePtr values[] = {&line_layout}; |
| @@ -782,10 +792,12 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, | |||
| 782 | if (NILP (Vmac_use_core_graphics)) | 792 | if (NILP (Vmac_use_core_graphics)) |
| 783 | { | 793 | { |
| 784 | #endif | 794 | #endif |
| 795 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 785 | MoveTo (x, y); | 796 | MoveTo (x, y); |
| 786 | ATSUDrawText (text_layout, | 797 | ATSUDrawText (text_layout, |
| 787 | kATSUFromTextBeginning, kATSUToTextEnd, | 798 | kATSUFromTextBeginning, kATSUToTextEnd, |
| 788 | kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc); | 799 | kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc); |
| 800 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 789 | #ifdef MAC_OSX | 801 | #ifdef MAC_OSX |
| 790 | } | 802 | } |
| 791 | else | 803 | else |
| @@ -793,7 +805,6 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, | |||
| 793 | CGrafPtr port; | 805 | CGrafPtr port; |
| 794 | CGContextRef context; | 806 | CGContextRef context; |
| 795 | Rect rect; | 807 | Rect rect; |
| 796 | RgnHandle region = NewRgn (); | ||
| 797 | float port_height; | 808 | float port_height; |
| 798 | ATSUAttributeTag tags[] = {kATSUCGContextTag}; | 809 | ATSUAttributeTag tags[] = {kATSUCGContextTag}; |
| 799 | ByteCount sizes[] = {sizeof (CGContextRef)}; | 810 | ByteCount sizes[] = {sizeof (CGContextRef)}; |
| @@ -803,16 +814,15 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, | |||
| 803 | QDBeginCGContext (port, &context); | 814 | QDBeginCGContext (port, &context); |
| 804 | GetPortBounds (port, &rect); | 815 | GetPortBounds (port, &rect); |
| 805 | port_height = rect.bottom - rect.top; | 816 | port_height = rect.bottom - rect.top; |
| 806 | GetClip (region); | 817 | if (gc->n_clip_rects) |
| 807 | GetRegionBounds (region, &rect); | 818 | { |
| 808 | /* XXX: This is not correct if the clip region is not a | 819 | CGContextTranslateCTM (context, 0, port_height); |
| 809 | simple rectangle. */ | 820 | CGContextScaleCTM (context, 1, -1); |
| 810 | CGContextClipToRect (context, | 821 | CGContextClipToRects (context, gc->clip_rects, |
| 811 | CGRectMake (rect.left, | 822 | gc->n_clip_rects); |
| 812 | port_height - rect.bottom, | 823 | CGContextScaleCTM (context, 1, -1); |
| 813 | rect.right - rect.left, | 824 | CGContextTranslateCTM (context, 0, -port_height); |
| 814 | rect.bottom - rect.top)); | 825 | } |
| 815 | DisposeRgn (region); | ||
| 816 | CGContextSetRGBFillColor | 826 | CGContextSetRGBFillColor |
| 817 | (context, | 827 | (context, |
| 818 | RED_FROM_ULONG (gc->xgcv.foreground) / 255.0, | 828 | RED_FROM_ULONG (gc->xgcv.foreground) / 255.0, |
| @@ -843,8 +853,10 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, | |||
| 843 | TextFace (GC_FONT (gc)->mac_fontface); | 853 | TextFace (GC_FONT (gc)->mac_fontface); |
| 844 | TextMode (mode); | 854 | TextMode (mode); |
| 845 | 855 | ||
| 856 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 846 | MoveTo (x, y); | 857 | MoveTo (x, y); |
| 847 | DrawText (buf, 0, nchars * bytes_per_char); | 858 | DrawText (buf, 0, nchars * bytes_per_char); |
| 859 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 848 | #if USE_ATSUI | 860 | #if USE_ATSUI |
| 849 | } | 861 | } |
| 850 | #endif | 862 | #endif |
| @@ -943,6 +955,7 @@ mac_copy_area (display, src, dest, gc, src_x, src_y, width, height, dest_x, | |||
| 943 | ForeColor (blackColor); | 955 | ForeColor (blackColor); |
| 944 | BackColor (whiteColor); | 956 | BackColor (whiteColor); |
| 945 | 957 | ||
| 958 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 946 | LockPixels (GetGWorldPixMap (src)); | 959 | LockPixels (GetGWorldPixMap (src)); |
| 947 | #if TARGET_API_MAC_CARBON | 960 | #if TARGET_API_MAC_CARBON |
| 948 | LockPortBits (GetWindowPort (dest)); | 961 | LockPortBits (GetWindowPort (dest)); |
| @@ -955,6 +968,7 @@ mac_copy_area (display, src, dest, gc, src_x, src_y, width, height, dest_x, | |||
| 955 | &src_r, &dest_r, srcCopy, 0); | 968 | &src_r, &dest_r, srcCopy, 0); |
| 956 | #endif /* not TARGET_API_MAC_CARBON */ | 969 | #endif /* not TARGET_API_MAC_CARBON */ |
| 957 | UnlockPixels (GetGWorldPixMap (src)); | 970 | UnlockPixels (GetGWorldPixMap (src)); |
| 971 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 958 | 972 | ||
| 959 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (dest))); | 973 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (dest))); |
| 960 | } | 974 | } |
| @@ -981,6 +995,7 @@ mac_copy_area_with_mask (display, src, mask, dest, gc, src_x, src_y, | |||
| 981 | ForeColor (blackColor); | 995 | ForeColor (blackColor); |
| 982 | BackColor (whiteColor); | 996 | BackColor (whiteColor); |
| 983 | 997 | ||
| 998 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 984 | LockPixels (GetGWorldPixMap (src)); | 999 | LockPixels (GetGWorldPixMap (src)); |
| 985 | LockPixels (GetGWorldPixMap (mask)); | 1000 | LockPixels (GetGWorldPixMap (mask)); |
| 986 | #if TARGET_API_MAC_CARBON | 1001 | #if TARGET_API_MAC_CARBON |
| @@ -995,6 +1010,7 @@ mac_copy_area_with_mask (display, src, mask, dest, gc, src_x, src_y, | |||
| 995 | #endif /* not TARGET_API_MAC_CARBON */ | 1010 | #endif /* not TARGET_API_MAC_CARBON */ |
| 996 | UnlockPixels (GetGWorldPixMap (mask)); | 1011 | UnlockPixels (GetGWorldPixMap (mask)); |
| 997 | UnlockPixels (GetGWorldPixMap (src)); | 1012 | UnlockPixels (GetGWorldPixMap (src)); |
| 1013 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 998 | 1014 | ||
| 999 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (dest))); | 1015 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (dest))); |
| 1000 | } | 1016 | } |
| @@ -1031,7 +1047,9 @@ mac_scroll_area (display, w, gc, src_x, src_y, width, height, dest_x, dest_y) | |||
| 1031 | color mapping in CopyBits. Otherwise, it will be slow. */ | 1047 | color mapping in CopyBits. Otherwise, it will be slow. */ |
| 1032 | ForeColor (blackColor); | 1048 | ForeColor (blackColor); |
| 1033 | BackColor (whiteColor); | 1049 | BackColor (whiteColor); |
| 1050 | mac_begin_clip (GC_CLIP_REGION (gc)); | ||
| 1034 | CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0); | 1051 | CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0); |
| 1052 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 1035 | 1053 | ||
| 1036 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (w))); | 1054 | RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (w))); |
| 1037 | #endif /* not TARGET_API_MAC_CARBON */ | 1055 | #endif /* not TARGET_API_MAC_CARBON */ |
| @@ -1166,6 +1184,8 @@ XFreeGC (display, gc) | |||
| 1166 | Display *display; | 1184 | Display *display; |
| 1167 | GC gc; | 1185 | GC gc; |
| 1168 | { | 1186 | { |
| 1187 | if (gc->clip_region) | ||
| 1188 | DisposeRgn (gc->clip_region); | ||
| 1169 | xfree (gc); | 1189 | xfree (gc); |
| 1170 | } | 1190 | } |
| 1171 | 1191 | ||
| @@ -1236,6 +1256,70 @@ XSetFont (display, gc, font) | |||
| 1236 | } | 1256 | } |
| 1237 | 1257 | ||
| 1238 | 1258 | ||
| 1259 | /* Mac replacement for XSetClipRectangles. */ | ||
| 1260 | |||
| 1261 | static void | ||
| 1262 | mac_set_clip_rectangles (display, gc, rectangles, n) | ||
| 1263 | Display *display; | ||
| 1264 | GC gc; | ||
| 1265 | Rect *rectangles; | ||
| 1266 | int n; | ||
| 1267 | { | ||
| 1268 | int i; | ||
| 1269 | |||
| 1270 | if (n < 0 || n > MAX_CLIP_RECTS) | ||
| 1271 | abort (); | ||
| 1272 | if (n == 0) | ||
| 1273 | { | ||
| 1274 | if (gc->clip_region) | ||
| 1275 | { | ||
| 1276 | DisposeRgn (gc->clip_region); | ||
| 1277 | gc->clip_region = NULL; | ||
| 1278 | } | ||
| 1279 | } | ||
| 1280 | else | ||
| 1281 | { | ||
| 1282 | if (gc->clip_region == NULL) | ||
| 1283 | gc->clip_region = NewRgn (); | ||
| 1284 | RectRgn (gc->clip_region, rectangles); | ||
| 1285 | if (n > 1) | ||
| 1286 | { | ||
| 1287 | RgnHandle region = NewRgn (); | ||
| 1288 | |||
| 1289 | for (i = 1; i < n; i++) | ||
| 1290 | { | ||
| 1291 | RectRgn (region, rectangles + i); | ||
| 1292 | UnionRgn (gc->clip_region, region, gc->clip_region); | ||
| 1293 | } | ||
| 1294 | DisposeRgn (region); | ||
| 1295 | } | ||
| 1296 | } | ||
| 1297 | #if defined (MAC_OSX) && USE_ATSUI | ||
| 1298 | gc->n_clip_rects = n; | ||
| 1299 | |||
| 1300 | for (i = 0; i < n; i++) | ||
| 1301 | { | ||
| 1302 | Rect *rect = rectangles + i; | ||
| 1303 | |||
| 1304 | gc->clip_rects[i] = CGRectMake (rect->left, rect->top, | ||
| 1305 | rect->right - rect->left, | ||
| 1306 | rect->bottom - rect->top); | ||
| 1307 | } | ||
| 1308 | #endif | ||
| 1309 | } | ||
| 1310 | |||
| 1311 | |||
| 1312 | /* Mac replacement for XSetClipMask. */ | ||
| 1313 | |||
| 1314 | static INLINE void | ||
| 1315 | mac_reset_clip_rectangles (display, gc) | ||
| 1316 | Display *display; | ||
| 1317 | GC gc; | ||
| 1318 | { | ||
| 1319 | mac_set_clip_rectangles (display, gc, NULL, 0); | ||
| 1320 | } | ||
| 1321 | |||
| 1322 | |||
| 1239 | /* Mac replacement for XSetWindowBackground. */ | 1323 | /* Mac replacement for XSetWindowBackground. */ |
| 1240 | 1324 | ||
| 1241 | void | 1325 | void |
| @@ -1647,7 +1731,7 @@ x_draw_fringe_bitmap (w, row, p) | |||
| 1647 | XSetForeground (display, face->gc, gcv.foreground); | 1731 | XSetForeground (display, face->gc, gcv.foreground); |
| 1648 | } | 1732 | } |
| 1649 | 1733 | ||
| 1650 | mac_reset_clipping (display, window); | 1734 | mac_reset_clip_rectangles (display, gc); |
| 1651 | } | 1735 | } |
| 1652 | 1736 | ||
| 1653 | 1737 | ||
| @@ -1682,19 +1766,6 @@ static XCharStruct *x_per_char_metric P_ ((XFontStruct *, XChar2b *)); | |||
| 1682 | static int mac_encode_char P_ ((int, XChar2b *, struct font_info *, int *)); | 1766 | static int mac_encode_char P_ ((int, XChar2b *, struct font_info *, int *)); |
| 1683 | 1767 | ||
| 1684 | 1768 | ||
| 1685 | /* Return a pointer to per-char metric information in FONT of a | ||
| 1686 | character pointed by B which is a pointer to an XChar2b. */ | ||
| 1687 | |||
| 1688 | #define PER_CHAR_METRIC(font, b) \ | ||
| 1689 | ((font)->per_char \ | ||
| 1690 | ? ((font)->per_char + (b)->byte2 - (font)->min_char_or_byte2 \ | ||
| 1691 | + (((font)->min_byte1 || (font)->max_byte1) \ | ||
| 1692 | ? (((b)->byte1 - (font)->min_byte1) \ | ||
| 1693 | * ((font)->max_char_or_byte2 - (font)->min_char_or_byte2 + 1)) \ | ||
| 1694 | : 0)) \ | ||
| 1695 | : &((font)->max_bounds)) | ||
| 1696 | |||
| 1697 | |||
| 1698 | /* Get metrics of character CHAR2B in FONT. Value is null if CHAR2B | 1769 | /* Get metrics of character CHAR2B in FONT. Value is null if CHAR2B |
| 1699 | is not contained in the font. */ | 1770 | is not contained in the font. */ |
| 1700 | 1771 | ||
| @@ -2122,9 +2193,11 @@ static INLINE void | |||
| 2122 | x_set_glyph_string_clipping (s) | 2193 | x_set_glyph_string_clipping (s) |
| 2123 | struct glyph_string *s; | 2194 | struct glyph_string *s; |
| 2124 | { | 2195 | { |
| 2125 | Rect r; | 2196 | Rect rects[MAX_CLIP_RECTS]; |
| 2126 | get_glyph_string_clip_rect (s, &r); | 2197 | int n; |
| 2127 | mac_set_clip_rectangle (s->display, s->window, &r); | 2198 | |
| 2199 | n = get_glyph_string_clip_rects (s, rects, MAX_CLIP_RECTS); | ||
| 2200 | mac_set_clip_rectangles (s->display, s->gc, rects, n); | ||
| 2128 | } | 2201 | } |
| 2129 | 2202 | ||
| 2130 | 2203 | ||
| @@ -2320,7 +2393,7 @@ x_draw_glyph_string_foreground (s) | |||
| 2320 | XDrawImageString is usually faster than XDrawString.) Always | 2393 | XDrawImageString is usually faster than XDrawString.) Always |
| 2321 | use XDrawImageString when drawing the cursor so that there is | 2394 | use XDrawImageString when drawing the cursor so that there is |
| 2322 | no chance that characters under a box cursor are invisible. */ | 2395 | no chance that characters under a box cursor are invisible. */ |
| 2323 | if (s->for_overlaps_p | 2396 | if (s->for_overlaps |
| 2324 | || (s->background_filled_p && s->hl != DRAW_CURSOR)) | 2397 | || (s->background_filled_p && s->hl != DRAW_CURSOR)) |
| 2325 | #endif | 2398 | #endif |
| 2326 | { | 2399 | { |
| @@ -2341,7 +2414,7 @@ x_draw_glyph_string_foreground (s) | |||
| 2341 | { | 2414 | { |
| 2342 | if (s->two_byte_p) | 2415 | if (s->two_byte_p) |
| 2343 | XDrawImageString16 (s->display, s->window, s->gc, x, | 2416 | XDrawImageString16 (s->display, s->window, s->gc, x, |
| 2344 | s->ybase - boff, s->char2b, s->nchars); | 2417 | s->ybase - boff, s->char2b, s->nchars); |
| 2345 | else | 2418 | else |
| 2346 | XDrawImageString (s->display, s->window, s->gc, x, | 2419 | XDrawImageString (s->display, s->window, s->gc, x, |
| 2347 | s->ybase - boff, char1b, s->nchars); | 2420 | s->ybase - boff, char1b, s->nchars); |
| @@ -2749,7 +2822,7 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width, | |||
| 2749 | gc = f->output_data.mac->white_relief.gc; | 2822 | gc = f->output_data.mac->white_relief.gc; |
| 2750 | else | 2823 | else |
| 2751 | gc = f->output_data.mac->black_relief.gc; | 2824 | gc = f->output_data.mac->black_relief.gc; |
| 2752 | mac_set_clip_rectangle (dpy, window, clip_rect); | 2825 | mac_set_clip_rectangles (dpy, gc, clip_rect, 1); |
| 2753 | 2826 | ||
| 2754 | /* Top. */ | 2827 | /* Top. */ |
| 2755 | if (top_p) | 2828 | if (top_p) |
| @@ -2764,13 +2837,12 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width, | |||
| 2764 | XDrawLine (dpy, window, gc, | 2837 | XDrawLine (dpy, window, gc, |
| 2765 | left_x + i, top_y + i, left_x + i, bottom_y - i); | 2838 | left_x + i, top_y + i, left_x + i, bottom_y - i); |
| 2766 | 2839 | ||
| 2767 | mac_reset_clipping (dpy, window); | 2840 | mac_reset_clip_rectangles (dpy, gc); |
| 2768 | if (raised_p) | 2841 | if (raised_p) |
| 2769 | gc = f->output_data.mac->black_relief.gc; | 2842 | gc = f->output_data.mac->black_relief.gc; |
| 2770 | else | 2843 | else |
| 2771 | gc = f->output_data.mac->white_relief.gc; | 2844 | gc = f->output_data.mac->white_relief.gc; |
| 2772 | mac_set_clip_rectangle (dpy, window, | 2845 | mac_set_clip_rectangles (dpy, gc, clip_rect, 1); |
| 2773 | clip_rect); | ||
| 2774 | 2846 | ||
| 2775 | /* Bottom. */ | 2847 | /* Bottom. */ |
| 2776 | if (bot_p) | 2848 | if (bot_p) |
| @@ -2785,7 +2857,7 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width, | |||
| 2785 | XDrawLine (dpy, window, gc, | 2857 | XDrawLine (dpy, window, gc, |
| 2786 | right_x - i, top_y + i + 1, right_x - i, bottom_y - i - 1); | 2858 | right_x - i, top_y + i + 1, right_x - i, bottom_y - i - 1); |
| 2787 | 2859 | ||
| 2788 | mac_reset_clipping (dpy, window); | 2860 | mac_reset_clip_rectangles (dpy, gc); |
| 2789 | } | 2861 | } |
| 2790 | 2862 | ||
| 2791 | 2863 | ||
| @@ -2807,7 +2879,7 @@ x_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width, | |||
| 2807 | 2879 | ||
| 2808 | XGetGCValues (s->display, s->gc, GCForeground, &xgcv); | 2880 | XGetGCValues (s->display, s->gc, GCForeground, &xgcv); |
| 2809 | XSetForeground (s->display, s->gc, s->face->box_color); | 2881 | XSetForeground (s->display, s->gc, s->face->box_color); |
| 2810 | mac_set_clip_rectangle (s->display, s->window, clip_rect); | 2882 | mac_set_clip_rectangles (s->display, s->gc, clip_rect, 1); |
| 2811 | 2883 | ||
| 2812 | /* Top. */ | 2884 | /* Top. */ |
| 2813 | XFillRectangle (s->display, s->window, s->gc, | 2885 | XFillRectangle (s->display, s->window, s->gc, |
| @@ -2828,7 +2900,7 @@ x_draw_box_rect (s, left_x, top_y, right_x, bottom_y, width, | |||
| 2828 | right_x - width + 1, top_y, width, bottom_y - top_y + 1); | 2900 | right_x - width + 1, top_y, width, bottom_y - top_y + 1); |
| 2829 | 2901 | ||
| 2830 | XSetForeground (s->display, s->gc, xgcv.foreground); | 2902 | XSetForeground (s->display, s->gc, xgcv.foreground); |
| 2831 | mac_reset_clipping (s->display, s->window); | 2903 | mac_reset_clip_rectangles (s->display, s->gc); |
| 2832 | } | 2904 | } |
| 2833 | 2905 | ||
| 2834 | 2906 | ||
| @@ -3182,7 +3254,6 @@ x_draw_image_glyph_string (s) | |||
| 3182 | x_set_glyph_string_clipping (s); | 3254 | x_set_glyph_string_clipping (s); |
| 3183 | mac_copy_area (s->display, pixmap, s->window, s->gc, | 3255 | mac_copy_area (s->display, pixmap, s->window, s->gc, |
| 3184 | 0, 0, s->background_width, s->height, s->x, s->y); | 3256 | 0, 0, s->background_width, s->height, s->x, s->y); |
| 3185 | mac_reset_clipping (s->display, s->window); | ||
| 3186 | XFreePixmap (s->display, pixmap); | 3257 | XFreePixmap (s->display, pixmap); |
| 3187 | } | 3258 | } |
| 3188 | else | 3259 | else |
| @@ -3234,7 +3305,7 @@ x_draw_stretch_glyph_string (s) | |||
| 3234 | gc = s->face->gc; | 3305 | gc = s->face->gc; |
| 3235 | 3306 | ||
| 3236 | get_glyph_string_clip_rect (s, &r); | 3307 | get_glyph_string_clip_rect (s, &r); |
| 3237 | mac_set_clip_rectangle (s->display, s->window, &r); | 3308 | mac_set_clip_rectangles (s->display, gc, &r, 1); |
| 3238 | 3309 | ||
| 3239 | #if 0 /* MAC_TODO: stipple */ | 3310 | #if 0 /* MAC_TODO: stipple */ |
| 3240 | if (s->face->stipple) | 3311 | if (s->face->stipple) |
| @@ -3247,8 +3318,6 @@ x_draw_stretch_glyph_string (s) | |||
| 3247 | else | 3318 | else |
| 3248 | #endif /* MAC_TODO */ | 3319 | #endif /* MAC_TODO */ |
| 3249 | mac_erase_rectangle (s->window, gc, x, y, w, h); | 3320 | mac_erase_rectangle (s->window, gc, x, y, w, h); |
| 3250 | |||
| 3251 | mac_reset_clipping (s->display, s->window); | ||
| 3252 | } | 3321 | } |
| 3253 | } | 3322 | } |
| 3254 | else if (!s->background_filled_p) | 3323 | else if (!s->background_filled_p) |
| @@ -3271,7 +3340,7 @@ x_draw_glyph_string (s) | |||
| 3271 | draw a cursor, draw the background of the successor first so that | 3340 | draw a cursor, draw the background of the successor first so that |
| 3272 | S can draw into it. This makes S->next use XDrawString instead | 3341 | S can draw into it. This makes S->next use XDrawString instead |
| 3273 | of XDrawImageString. */ | 3342 | of XDrawImageString. */ |
| 3274 | if (s->next && s->right_overhang && !s->for_overlaps_p | 3343 | if (s->next && s->right_overhang && !s->for_overlaps |
| 3275 | && s->next->hl != DRAW_CURSOR) | 3344 | && s->next->hl != DRAW_CURSOR) |
| 3276 | { | 3345 | { |
| 3277 | xassert (s->next->img == NULL); | 3346 | xassert (s->next->img == NULL); |
| @@ -3285,7 +3354,7 @@ x_draw_glyph_string (s) | |||
| 3285 | 3354 | ||
| 3286 | /* Draw relief (if any) in advance for char/composition so that the | 3355 | /* Draw relief (if any) in advance for char/composition so that the |
| 3287 | glyph string can be drawn over it. */ | 3356 | glyph string can be drawn over it. */ |
| 3288 | if (!s->for_overlaps_p | 3357 | if (!s->for_overlaps |
| 3289 | && s->face->box != FACE_NO_BOX | 3358 | && s->face->box != FACE_NO_BOX |
| 3290 | && (s->first_glyph->type == CHAR_GLYPH | 3359 | && (s->first_glyph->type == CHAR_GLYPH |
| 3291 | || s->first_glyph->type == COMPOSITE_GLYPH)) | 3360 | || s->first_glyph->type == COMPOSITE_GLYPH)) |
| @@ -3311,7 +3380,7 @@ x_draw_glyph_string (s) | |||
| 3311 | break; | 3380 | break; |
| 3312 | 3381 | ||
| 3313 | case CHAR_GLYPH: | 3382 | case CHAR_GLYPH: |
| 3314 | if (s->for_overlaps_p) | 3383 | if (s->for_overlaps) |
| 3315 | s->background_filled_p = 1; | 3384 | s->background_filled_p = 1; |
| 3316 | else | 3385 | else |
| 3317 | x_draw_glyph_string_background (s, 0); | 3386 | x_draw_glyph_string_background (s, 0); |
| @@ -3319,7 +3388,7 @@ x_draw_glyph_string (s) | |||
| 3319 | break; | 3388 | break; |
| 3320 | 3389 | ||
| 3321 | case COMPOSITE_GLYPH: | 3390 | case COMPOSITE_GLYPH: |
| 3322 | if (s->for_overlaps_p || s->gidx > 0) | 3391 | if (s->for_overlaps || s->gidx > 0) |
| 3323 | s->background_filled_p = 1; | 3392 | s->background_filled_p = 1; |
| 3324 | else | 3393 | else |
| 3325 | x_draw_glyph_string_background (s, 1); | 3394 | x_draw_glyph_string_background (s, 1); |
| @@ -3330,7 +3399,7 @@ x_draw_glyph_string (s) | |||
| 3330 | abort (); | 3399 | abort (); |
| 3331 | } | 3400 | } |
| 3332 | 3401 | ||
| 3333 | if (!s->for_overlaps_p) | 3402 | if (!s->for_overlaps) |
| 3334 | { | 3403 | { |
| 3335 | /* Draw underline. */ | 3404 | /* Draw underline. */ |
| 3336 | if (s->face->underline_p) | 3405 | if (s->face->underline_p) |
| @@ -3397,7 +3466,7 @@ x_draw_glyph_string (s) | |||
| 3397 | } | 3466 | } |
| 3398 | 3467 | ||
| 3399 | /* Reset clipping. */ | 3468 | /* Reset clipping. */ |
| 3400 | mac_reset_clipping (s->display, s->window); | 3469 | mac_reset_clip_rectangles (s->display, s->gc); |
| 3401 | } | 3470 | } |
| 3402 | 3471 | ||
| 3403 | /* Shift display to make room for inserted glyphs. */ | 3472 | /* Shift display to make room for inserted glyphs. */ |
| @@ -4121,6 +4190,8 @@ note_mouse_movement (frame, pos) | |||
| 4121 | frame->mouse_moved = 1; | 4190 | frame->mouse_moved = 1; |
| 4122 | last_mouse_scroll_bar = Qnil; | 4191 | last_mouse_scroll_bar = Qnil; |
| 4123 | note_mouse_highlight (frame, pos->h, pos->v); | 4192 | note_mouse_highlight (frame, pos->h, pos->v); |
| 4193 | /* Remember which glyph we're now on. */ | ||
| 4194 | remember_mouse_glyph (frame, pos->h, pos->v, &last_mouse_glyph); | ||
| 4124 | } | 4195 | } |
| 4125 | } | 4196 | } |
| 4126 | 4197 | ||
| @@ -4129,9 +4200,6 @@ note_mouse_movement (frame, pos) | |||
| 4129 | Mouse Face | 4200 | Mouse Face |
| 4130 | ************************************************************************/ | 4201 | ************************************************************************/ |
| 4131 | 4202 | ||
| 4132 | static int glyph_rect P_ ((struct frame *f, int, int, Rect *)); | ||
| 4133 | |||
| 4134 | |||
| 4135 | /* MAC TODO: This should be called from somewhere (or removed) ++KFS */ | 4203 | /* MAC TODO: This should be called from somewhere (or removed) ++KFS */ |
| 4136 | 4204 | ||
| 4137 | static void | 4205 | static void |
| @@ -4145,110 +4213,6 @@ redo_mouse_highlight () | |||
| 4145 | } | 4213 | } |
| 4146 | 4214 | ||
| 4147 | 4215 | ||
| 4148 | /* Try to determine frame pixel position and size of the glyph under | ||
| 4149 | frame pixel coordinates X/Y on frame F . Return the position and | ||
| 4150 | size in *RECT. Value is non-zero if we could compute these | ||
| 4151 | values. */ | ||
| 4152 | |||
| 4153 | static int | ||
| 4154 | glyph_rect (f, x, y, rect) | ||
| 4155 | struct frame *f; | ||
| 4156 | int x, y; | ||
| 4157 | Rect *rect; | ||
| 4158 | { | ||
| 4159 | Lisp_Object window; | ||
| 4160 | |||
| 4161 | window = window_from_coordinates (f, x, y, 0, &x, &y, 0); | ||
| 4162 | |||
| 4163 | if (!NILP (window)) | ||
| 4164 | { | ||
| 4165 | struct window *w = XWINDOW (window); | ||
| 4166 | struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | ||
| 4167 | struct glyph_row *end = r + w->current_matrix->nrows - 1; | ||
| 4168 | |||
| 4169 | for (; r < end && r->enabled_p; ++r) | ||
| 4170 | if (r->y <= y && r->y + r->height > y) | ||
| 4171 | { | ||
| 4172 | /* Found the row at y. */ | ||
| 4173 | struct glyph *g = r->glyphs[TEXT_AREA]; | ||
| 4174 | struct glyph *end = g + r->used[TEXT_AREA]; | ||
| 4175 | int gx; | ||
| 4176 | |||
| 4177 | rect->top = WINDOW_TO_FRAME_PIXEL_Y (w, r->y); | ||
| 4178 | rect->bottom = rect->top + r->height; | ||
| 4179 | |||
| 4180 | if (x < r->x) | ||
| 4181 | { | ||
| 4182 | /* x is to the left of the first glyph in the row. */ | ||
| 4183 | /* Shouldn't this be a pixel value? | ||
| 4184 | WINDOW_LEFT_EDGE_X (w) seems to be the right value. | ||
| 4185 | ++KFS */ | ||
| 4186 | rect->left = WINDOW_LEFT_EDGE_COL (w); | ||
| 4187 | rect->right = WINDOW_TO_FRAME_PIXEL_X (w, r->x); | ||
| 4188 | return 1; | ||
| 4189 | } | ||
| 4190 | |||
| 4191 | for (gx = r->x; g < end; gx += g->pixel_width, ++g) | ||
| 4192 | if (gx <= x && gx + g->pixel_width > x) | ||
| 4193 | { | ||
| 4194 | /* x is on a glyph. */ | ||
| 4195 | rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx); | ||
| 4196 | rect->right = rect->left + g->pixel_width; | ||
| 4197 | return 1; | ||
| 4198 | } | ||
| 4199 | |||
| 4200 | /* x is to the right of the last glyph in the row. */ | ||
| 4201 | rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx); | ||
| 4202 | /* Shouldn't this be a pixel value? | ||
| 4203 | WINDOW_RIGHT_EDGE_X (w) seems to be the right value. | ||
| 4204 | ++KFS */ | ||
| 4205 | rect->right = WINDOW_RIGHT_EDGE_COL (w); | ||
| 4206 | return 1; | ||
| 4207 | } | ||
| 4208 | } | ||
| 4209 | |||
| 4210 | /* The y is not on any row. */ | ||
| 4211 | return 0; | ||
| 4212 | } | ||
| 4213 | |||
| 4214 | /* MAC TODO: This should be called from somewhere (or removed) ++KFS */ | ||
| 4215 | |||
| 4216 | /* Record the position of the mouse in last_mouse_glyph. */ | ||
| 4217 | static void | ||
| 4218 | remember_mouse_glyph (f1, gx, gy) | ||
| 4219 | struct frame * f1; | ||
| 4220 | int gx, gy; | ||
| 4221 | { | ||
| 4222 | if (!glyph_rect (f1, gx, gy, &last_mouse_glyph)) | ||
| 4223 | { | ||
| 4224 | int width = FRAME_SMALLEST_CHAR_WIDTH (f1); | ||
| 4225 | int height = FRAME_SMALLEST_FONT_HEIGHT (f1); | ||
| 4226 | |||
| 4227 | /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to | ||
| 4228 | round down even for negative values. */ | ||
| 4229 | if (gx < 0) | ||
| 4230 | gx -= width - 1; | ||
| 4231 | if (gy < 0) | ||
| 4232 | gy -= height - 1; | ||
| 4233 | #if 0 | ||
| 4234 | /* This was the original code from XTmouse_position, but it seems | ||
| 4235 | to give the position of the glyph diagonally next to the one | ||
| 4236 | the mouse is over. */ | ||
| 4237 | gx = (gx + width - 1) / width * width; | ||
| 4238 | gy = (gy + height - 1) / height * height; | ||
| 4239 | #else | ||
| 4240 | gx = gx / width * width; | ||
| 4241 | gy = gy / height * height; | ||
| 4242 | #endif | ||
| 4243 | |||
| 4244 | last_mouse_glyph.left = gx; | ||
| 4245 | last_mouse_glyph.top = gy; | ||
| 4246 | last_mouse_glyph.right = gx + width; | ||
| 4247 | last_mouse_glyph.bottom = gy + height; | ||
| 4248 | } | ||
| 4249 | } | ||
| 4250 | |||
| 4251 | |||
| 4252 | static struct frame * | 4216 | static struct frame * |
| 4253 | mac_focus_frame (dpyinfo) | 4217 | mac_focus_frame (dpyinfo) |
| 4254 | struct mac_display_info *dpyinfo; | 4218 | struct mac_display_info *dpyinfo; |
| @@ -4264,18 +4228,18 @@ mac_focus_frame (dpyinfo) | |||
| 4264 | 4228 | ||
| 4265 | 4229 | ||
| 4266 | /* Return the current position of the mouse. | 4230 | /* Return the current position of the mouse. |
| 4267 | *fp should be a frame which indicates which display to ask about. | 4231 | *FP should be a frame which indicates which display to ask about. |
| 4268 | 4232 | ||
| 4269 | If the mouse movement started in a scroll bar, set *fp, *bar_window, | 4233 | If the mouse movement started in a scroll bar, set *FP, *BAR_WINDOW, |
| 4270 | and *part to the frame, window, and scroll bar part that the mouse | 4234 | and *PART to the frame, window, and scroll bar part that the mouse |
| 4271 | is over. Set *x and *y to the portion and whole of the mouse's | 4235 | is over. Set *X and *Y to the portion and whole of the mouse's |
| 4272 | position on the scroll bar. | 4236 | position on the scroll bar. |
| 4273 | 4237 | ||
| 4274 | If the mouse movement started elsewhere, set *fp to the frame the | 4238 | If the mouse movement started elsewhere, set *FP to the frame the |
| 4275 | mouse is on, *bar_window to nil, and *x and *y to the character cell | 4239 | mouse is on, *BAR_WINDOW to nil, and *X and *Y to the character cell |
| 4276 | the mouse is over. | 4240 | the mouse is over. |
| 4277 | 4241 | ||
| 4278 | Set *time to the server time-stamp for the time at which the mouse | 4242 | Set *TIME to the server time-stamp for the time at which the mouse |
| 4279 | was at this position. | 4243 | was at this position. |
| 4280 | 4244 | ||
| 4281 | Don't store anything if we don't have a valid set of values to report. | 4245 | Don't store anything if we don't have a valid set of values to report. |
| @@ -4292,11 +4256,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) | |||
| 4292 | Lisp_Object *x, *y; | 4256 | Lisp_Object *x, *y; |
| 4293 | unsigned long *time; | 4257 | unsigned long *time; |
| 4294 | { | 4258 | { |
| 4295 | Point mouse_pos; | 4259 | FRAME_PTR f1; |
| 4296 | int ignore1, ignore2; | ||
| 4297 | struct frame *f = mac_focus_frame (FRAME_MAC_DISPLAY_INFO (*fp)); | ||
| 4298 | WindowPtr wp = FRAME_MAC_WINDOW (f); | ||
| 4299 | Lisp_Object frame, tail; | ||
| 4300 | 4260 | ||
| 4301 | BLOCK_INPUT; | 4261 | BLOCK_INPUT; |
| 4302 | 4262 | ||
| @@ -4304,25 +4264,43 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) | |||
| 4304 | x_scroll_bar_report_motion (fp, bar_window, part, x, y, time); | 4264 | x_scroll_bar_report_motion (fp, bar_window, part, x, y, time); |
| 4305 | else | 4265 | else |
| 4306 | { | 4266 | { |
| 4267 | Lisp_Object frame, tail; | ||
| 4268 | |||
| 4307 | /* Clear the mouse-moved flag for every frame on this display. */ | 4269 | /* Clear the mouse-moved flag for every frame on this display. */ |
| 4308 | FOR_EACH_FRAME (tail, frame) | 4270 | FOR_EACH_FRAME (tail, frame) |
| 4309 | XFRAME (frame)->mouse_moved = 0; | 4271 | XFRAME (frame)->mouse_moved = 0; |
| 4310 | 4272 | ||
| 4311 | last_mouse_scroll_bar = Qnil; | 4273 | last_mouse_scroll_bar = Qnil; |
| 4312 | 4274 | ||
| 4313 | SetPortWindowPort (wp); | 4275 | if (FRAME_MAC_DISPLAY_INFO (*fp)->grabbed && last_mouse_frame |
| 4314 | 4276 | && FRAME_LIVE_P (last_mouse_frame)) | |
| 4315 | GetMouse (&mouse_pos); | 4277 | f1 = last_mouse_frame; |
| 4316 | 4278 | else | |
| 4317 | pixel_to_glyph_coords (f, mouse_pos.h, mouse_pos.v, &ignore1, &ignore2, | 4279 | f1 = mac_focus_frame (FRAME_MAC_DISPLAY_INFO (*fp)); |
| 4318 | &last_mouse_glyph, insist); | ||
| 4319 | 4280 | ||
| 4320 | *bar_window = Qnil; | 4281 | if (f1) |
| 4321 | *part = scroll_bar_handle; | 4282 | { |
| 4322 | *fp = f; | 4283 | /* Ok, we found a frame. Store all the values. |
| 4323 | XSETINT (*x, mouse_pos.h); | 4284 | last_mouse_glyph is a rectangle used to reduce the |
| 4324 | XSETINT (*y, mouse_pos.v); | 4285 | generation of mouse events. To not miss any motion |
| 4325 | *time = last_mouse_movement_time; | 4286 | events, we must divide the frame into rectangles of the |
| 4287 | size of the smallest character that could be displayed | ||
| 4288 | on it, i.e. into the same rectangles that matrices on | ||
| 4289 | the frame are divided into. */ | ||
| 4290 | Point mouse_pos; | ||
| 4291 | |||
| 4292 | SetPortWindowPort (FRAME_MAC_WINDOW (f1)); | ||
| 4293 | GetMouse (&mouse_pos); | ||
| 4294 | remember_mouse_glyph (f1, mouse_pos.h, mouse_pos.v, | ||
| 4295 | &last_mouse_glyph); | ||
| 4296 | |||
| 4297 | *bar_window = Qnil; | ||
| 4298 | *part = 0; | ||
| 4299 | *fp = f1; | ||
| 4300 | XSETINT (*x, mouse_pos.h); | ||
| 4301 | XSETINT (*y, mouse_pos.v); | ||
| 4302 | *time = last_mouse_movement_time; | ||
| 4303 | } | ||
| 4326 | } | 4304 | } |
| 4327 | 4305 | ||
| 4328 | UNBLOCK_INPUT; | 4306 | UNBLOCK_INPUT; |
| @@ -5270,7 +5248,7 @@ x_clip_to_row (w, row, area, gc) | |||
| 5270 | clip_rect.right = clip_rect.left + window_width; | 5248 | clip_rect.right = clip_rect.left + window_width; |
| 5271 | clip_rect.bottom = clip_rect.top + row->visible_height; | 5249 | clip_rect.bottom = clip_rect.top + row->visible_height; |
| 5272 | 5250 | ||
| 5273 | mac_set_clip_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), &clip_rect); | 5251 | mac_set_clip_rectangles (FRAME_MAC_DISPLAY (f), gc, &clip_rect, 1); |
| 5274 | } | 5252 | } |
| 5275 | 5253 | ||
| 5276 | 5254 | ||
| @@ -5313,7 +5291,7 @@ x_draw_hollow_cursor (w, row) | |||
| 5313 | /* Set clipping, draw the rectangle, and reset clipping again. */ | 5291 | /* Set clipping, draw the rectangle, and reset clipping again. */ |
| 5314 | x_clip_to_row (w, row, TEXT_AREA, gc); | 5292 | x_clip_to_row (w, row, TEXT_AREA, gc); |
| 5315 | mac_draw_rectangle (dpy, FRAME_MAC_WINDOW (f), gc, x, y, wd, h); | 5293 | mac_draw_rectangle (dpy, FRAME_MAC_WINDOW (f), gc, x, y, wd, h); |
| 5316 | mac_reset_clipping (dpy, FRAME_MAC_WINDOW (f)); | 5294 | mac_reset_clip_rectangles (dpy, gc); |
| 5317 | } | 5295 | } |
| 5318 | 5296 | ||
| 5319 | 5297 | ||
| @@ -5397,7 +5375,7 @@ x_draw_bar_cursor (w, row, width, kind) | |||
| 5397 | cursor_glyph->pixel_width, | 5375 | cursor_glyph->pixel_width, |
| 5398 | width); | 5376 | width); |
| 5399 | 5377 | ||
| 5400 | mac_reset_clipping (dpy, FRAME_MAC_WINDOW (f)); | 5378 | mac_reset_clip_rectangles (dpy, gc); |
| 5401 | } | 5379 | } |
| 5402 | } | 5380 | } |
| 5403 | 5381 | ||
| @@ -6761,7 +6739,13 @@ static char **font_name_table = NULL; | |||
| 6761 | static int font_name_table_size = 0; | 6739 | static int font_name_table_size = 0; |
| 6762 | static int font_name_count = 0; | 6740 | static int font_name_count = 0; |
| 6763 | 6741 | ||
| 6742 | /* Alist linking font family names to Font Manager font family | ||
| 6743 | references (which can also be used as QuickDraw font IDs). We use | ||
| 6744 | an alist because hash tables are not ready when the terminal frame | ||
| 6745 | for Mac OS Classic is created. */ | ||
| 6746 | static Lisp_Object fm_font_family_alist; | ||
| 6764 | #if USE_ATSUI | 6747 | #if USE_ATSUI |
| 6748 | /* Hash table linking font family names to ATSU font IDs. */ | ||
| 6765 | static Lisp_Object atsu_font_id_hash; | 6749 | static Lisp_Object atsu_font_id_hash; |
| 6766 | #endif | 6750 | #endif |
| 6767 | 6751 | ||
| @@ -6811,24 +6795,39 @@ decode_mac_font_name (name, size, coding_system) | |||
| 6811 | struct coding_system coding; | 6795 | struct coding_system coding; |
| 6812 | char *buf, *p; | 6796 | char *buf, *p; |
| 6813 | 6797 | ||
| 6814 | for (p = name; *p; p++) | 6798 | if (!NILP (coding_system) && !NILP (Fcoding_system_p (coding_system))) |
| 6815 | if (!isascii (*p) || iscntrl (*p)) | 6799 | { |
| 6816 | break; | 6800 | for (p = name; *p; p++) |
| 6801 | if (!isascii (*p) || iscntrl (*p)) | ||
| 6802 | break; | ||
| 6817 | 6803 | ||
| 6818 | if (*p == '\0' | 6804 | if (*p) |
| 6819 | || NILP (coding_system) || NILP (Fcoding_system_p (coding_system))) | 6805 | { |
| 6820 | return; | 6806 | setup_coding_system (coding_system, &coding); |
| 6807 | coding.src_multibyte = 0; | ||
| 6808 | coding.dst_multibyte = 1; | ||
| 6809 | coding.mode |= CODING_MODE_LAST_BLOCK; | ||
| 6810 | coding.composing = COMPOSITION_DISABLED; | ||
| 6811 | buf = (char *) alloca (size); | ||
| 6812 | |||
| 6813 | decode_coding (&coding, name, buf, strlen (name), size - 1); | ||
| 6814 | bcopy (buf, name, coding.produced); | ||
| 6815 | name[coding.produced] = '\0'; | ||
| 6816 | } | ||
| 6817 | } | ||
| 6821 | 6818 | ||
| 6822 | setup_coding_system (coding_system, &coding); | 6819 | /* If there's just one occurrence of '-' in the family name, it is |
| 6823 | coding.src_multibyte = 0; | 6820 | replaced with '_'. (More than one occurrence of '-' means a |
| 6824 | coding.dst_multibyte = 1; | 6821 | "FOUNDRY-FAMILY-CHARSET"-style name.) */ |
| 6825 | coding.mode |= CODING_MODE_LAST_BLOCK; | 6822 | p = strchr (name, '-'); |
| 6826 | coding.composing = COMPOSITION_DISABLED; | 6823 | if (p && strchr (p + 1, '-') == NULL) |
| 6827 | buf = (char *) alloca (size); | 6824 | *p = '_'; |
| 6828 | 6825 | ||
| 6829 | decode_coding (&coding, name, buf, strlen (name), size - 1); | 6826 | for (p = name; *p; p++) |
| 6830 | bcopy (buf, name, coding.produced); | 6827 | /* On Mac OS X 10.3, tolower also converts non-ASCII characters |
| 6831 | name[coding.produced] = '\0'; | 6828 | for some locales. */ |
| 6829 | if (isascii (*p)) | ||
| 6830 | *p = tolower (*p); | ||
| 6832 | } | 6831 | } |
| 6833 | 6832 | ||
| 6834 | 6833 | ||
| @@ -6867,32 +6866,46 @@ mac_to_x_fontname (name, size, style, charset) | |||
| 6867 | } | 6866 | } |
| 6868 | 6867 | ||
| 6869 | 6868 | ||
| 6870 | /* Convert an X font spec to the corresponding mac font name, which | 6869 | /* Parse fully-specified and instantiated X11 font spec XF, and store |
| 6871 | can then be passed to GetFNum after conversion to a Pascal string. | 6870 | the results to FAMILY, *SIZE, *STYLE, and CHARSET. Return 1 if the |
| 6872 | For ordinary Mac fonts, this should just be their names, like | 6871 | parsing succeeded, and 0 otherwise. For FAMILY and CHARSET, the |
| 6873 | "monaco", "Taipei", etc. Fonts converted from the GNU intlfonts | 6872 | caller must allocate at least 256 and 32 bytes respectively. For |
| 6874 | collection contain their charset designation in their names, like | 6873 | ordinary Mac fonts, the value stored to FAMILY should just be their |
| 6875 | "ETL-Fixed-iso8859-1", "ETL-Fixed-koi8-r", etc. Both types of font | 6874 | names, like "monaco", "Taipei", etc. Fonts converted from the GNU |
| 6876 | names are handled accordingly. */ | 6875 | intlfonts collection contain their charset designation in their |
| 6877 | static void | 6876 | names, like "ETL-Fixed-iso8859-1", "ETL-Fixed-koi8-r", etc. Both |
| 6878 | x_font_name_to_mac_font_name (xf, mf, mf_decoded, style, cs) | 6877 | types of font names are handled accordingly. */ |
| 6879 | char *xf, *mf, *mf_decoded; | 6878 | |
| 6879 | const int kDefaultFontSize = 12; | ||
| 6880 | |||
| 6881 | static int | ||
| 6882 | parse_x_font_name (xf, family, size, style, charset) | ||
| 6883 | char *xf, *family; | ||
| 6884 | int *size; | ||
| 6880 | Style *style; | 6885 | Style *style; |
| 6881 | char *cs; | 6886 | char *charset; |
| 6882 | { | 6887 | { |
| 6883 | Str31 foundry; | 6888 | Str31 foundry, weight; |
| 6884 | Str255 family; | 6889 | int point_size, avgwidth; |
| 6885 | char weight[20], slant[2], *p; | 6890 | char slant[2], *p; |
| 6886 | Lisp_Object charset_info, coding_system = Qnil; | ||
| 6887 | struct coding_system coding; | ||
| 6888 | 6891 | ||
| 6889 | strcpy (mf, ""); | 6892 | if (sscanf (xf, "-%31[^-]-%255[^-]-%31[^-]-%1[^-]-%*[^-]-%*[^-]-%d-%d-%*[^-]-%*[^-]-%*c-%d-%31s", |
| 6893 | foundry, family, weight, slant, size, | ||
| 6894 | &point_size, &avgwidth, charset) != 8 | ||
| 6895 | && sscanf (xf, "-%31[^-]-%255[^-]-%31[^-]-%1[^-]-%*[^-]--%d-%d-%*[^-]-%*[^-]-%*c-%d-%31s", | ||
| 6896 | foundry, family, weight, slant, size, | ||
| 6897 | &point_size, &avgwidth, charset) != 8) | ||
| 6898 | return 0; | ||
| 6890 | 6899 | ||
| 6891 | if (sscanf (xf, "-%31[^-]-%255[^-]-%19[^-]-%1[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*c-%*[^-]-%31s", | 6900 | if (*size == 0) |
| 6892 | foundry, family, weight, slant, cs) != 5 && | 6901 | { |
| 6893 | sscanf (xf, "-%31[^-]-%255[^-]-%19[^-]-%1[^-]-%*[^-]--%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*c-%*[^-]-%31s", | 6902 | if (point_size > 0) |
| 6894 | foundry, family, weight, slant, cs) != 5) | 6903 | *size = point_size / 10; |
| 6895 | return; | 6904 | else if (avgwidth > 0) |
| 6905 | *size = avgwidth / 10; | ||
| 6906 | } | ||
| 6907 | if (*size == 0) | ||
| 6908 | *size = kDefaultFontSize; | ||
| 6896 | 6909 | ||
| 6897 | *style = normal; | 6910 | *style = normal; |
| 6898 | if (strcmp (weight, "bold") == 0) | 6911 | if (strcmp (weight, "bold") == 0) |
| @@ -6900,32 +6913,31 @@ x_font_name_to_mac_font_name (xf, mf, mf_decoded, style, cs) | |||
| 6900 | if (*slant == 'i') | 6913 | if (*slant == 'i') |
| 6901 | *style |= italic; | 6914 | *style |= italic; |
| 6902 | 6915 | ||
| 6903 | charset_info = Fassoc (build_string (cs), Vmac_charset_info_alist); | 6916 | if (NILP (Fassoc (build_string (charset), Vmac_charset_info_alist))) |
| 6904 | if (!NILP (charset_info)) | ||
| 6905 | { | 6917 | { |
| 6906 | strcpy (mf_decoded, family); | 6918 | int foundry_len = strlen (foundry), family_len = strlen (family); |
| 6907 | coding_system = Fcar (Fcdr (Fcdr (charset_info))); | 6919 | |
| 6920 | if (foundry_len + family_len + strlen (charset) + 2 < sizeof (Str255)) | ||
| 6921 | { | ||
| 6922 | /* Like sprintf (family, "%s-%s-%s", foundry, family, charset), | ||
| 6923 | but take overlap into account. */ | ||
| 6924 | memmove (family + foundry_len + 1, family, family_len); | ||
| 6925 | memcpy (family, foundry, foundry_len); | ||
| 6926 | family[foundry_len] = '-'; | ||
| 6927 | family[foundry_len + 1 + family_len] = '-'; | ||
| 6928 | strcpy (family + foundry_len + 1 + family_len + 1, charset); | ||
| 6929 | } | ||
| 6930 | else | ||
| 6931 | return 0; | ||
| 6908 | } | 6932 | } |
| 6909 | else | ||
| 6910 | sprintf (mf_decoded, "%s-%s-%s", foundry, family, cs); | ||
| 6911 | 6933 | ||
| 6912 | for (p = mf_decoded; *p; p++) | 6934 | for (p = family; *p; p++) |
| 6913 | if (!isascii (*p) || iscntrl (*p)) | 6935 | /* On Mac OS X 10.3, tolower also converts non-ASCII characters |
| 6914 | break; | 6936 | for some locales. */ |
| 6937 | if (isascii (*p)) | ||
| 6938 | *p = tolower (*p); | ||
| 6915 | 6939 | ||
| 6916 | if (*p == '\0' | 6940 | return 1; |
| 6917 | || NILP (coding_system) || NILP (Fcoding_system_p (coding_system))) | ||
| 6918 | strcpy (mf, mf_decoded); | ||
| 6919 | else | ||
| 6920 | { | ||
| 6921 | setup_coding_system (coding_system, &coding); | ||
| 6922 | coding.src_multibyte = 1; | ||
| 6923 | coding.dst_multibyte = 0; | ||
| 6924 | coding.mode |= CODING_MODE_LAST_BLOCK; | ||
| 6925 | encode_coding (&coding, mf_decoded, mf, | ||
| 6926 | strlen (mf_decoded), sizeof (Str255) - 1); | ||
| 6927 | mf[coding.produced] = '\0'; | ||
| 6928 | } | ||
| 6929 | } | 6941 | } |
| 6930 | 6942 | ||
| 6931 | 6943 | ||
| @@ -7002,6 +7014,8 @@ init_font_name_table () | |||
| 7002 | kFontMacintoshPlatform, kFontNoScript, | 7014 | kFontMacintoshPlatform, kFontNoScript, |
| 7003 | kFontNoLanguage, name_len, name, | 7015 | kFontNoLanguage, name_len, name, |
| 7004 | NULL, NULL); | 7016 | NULL, NULL); |
| 7017 | if (err == noErr) | ||
| 7018 | decode_mac_font_name (name, name_len + 1, Qnil); | ||
| 7005 | if (err == noErr | 7019 | if (err == noErr |
| 7006 | && *name != '.' | 7020 | && *name != '.' |
| 7007 | && (prev_name == NULL | 7021 | && (prev_name == NULL |
| @@ -7017,7 +7031,7 @@ init_font_name_table () | |||
| 7017 | bold, cs)); | 7031 | bold, cs)); |
| 7018 | add_font_name_table_entry (mac_to_x_fontname (name, 0, | 7032 | add_font_name_table_entry (mac_to_x_fontname (name, 0, |
| 7019 | italic | bold, cs)); | 7033 | italic | bold, cs)); |
| 7020 | Fputhash (Fdowncase (make_unibyte_string (name, name_len)), | 7034 | Fputhash (make_unibyte_string (name, name_len), |
| 7021 | long_to_cons (font_ids[i]), atsu_font_id_hash); | 7035 | long_to_cons (font_ids[i]), atsu_font_id_hash); |
| 7022 | xfree (prev_name); | 7036 | xfree (prev_name); |
| 7023 | prev_name = name; | 7037 | prev_name = name; |
| @@ -7067,12 +7081,14 @@ init_font_name_table () | |||
| 7067 | sc = GetTextEncodingBase (encoding); | 7081 | sc = GetTextEncodingBase (encoding); |
| 7068 | text_encoding_info = assq_no_quit (make_number (sc), | 7082 | text_encoding_info = assq_no_quit (make_number (sc), |
| 7069 | text_encoding_info_alist); | 7083 | text_encoding_info_alist); |
| 7070 | if (!NILP (text_encoding_info)) | 7084 | if (NILP (text_encoding_info)) |
| 7071 | decode_mac_font_name (name, sizeof (name), | ||
| 7072 | XCAR (XCDR (text_encoding_info))); | ||
| 7073 | else | ||
| 7074 | text_encoding_info = assq_no_quit (make_number (kTextEncodingMacRoman), | 7085 | text_encoding_info = assq_no_quit (make_number (kTextEncodingMacRoman), |
| 7075 | text_encoding_info_alist); | 7086 | text_encoding_info_alist); |
| 7087 | decode_mac_font_name (name, sizeof (name), | ||
| 7088 | XCAR (XCDR (text_encoding_info))); | ||
| 7089 | fm_font_family_alist = Fcons (Fcons (build_string (name), | ||
| 7090 | make_number (ff)), | ||
| 7091 | fm_font_family_alist); | ||
| 7076 | 7092 | ||
| 7077 | /* Point the instance iterator at the current font family. */ | 7093 | /* Point the instance iterator at the current font family. */ |
| 7078 | if (FMResetFontFamilyInstanceIterator (ff, &ffii) != noErr) | 7094 | if (FMResetFontFamilyInstanceIterator (ff, &ffii) != noErr) |
| @@ -7151,12 +7167,14 @@ init_font_name_table () | |||
| 7151 | scriptcode = FontToScript (fontnum); | 7167 | scriptcode = FontToScript (fontnum); |
| 7152 | text_encoding_info = assq_no_quit (make_number (scriptcode), | 7168 | text_encoding_info = assq_no_quit (make_number (scriptcode), |
| 7153 | text_encoding_info_alist); | 7169 | text_encoding_info_alist); |
| 7154 | if (!NILP (text_encoding_info)) | 7170 | if (NILP (text_encoding_info)) |
| 7155 | decode_mac_font_name (name, sizeof (name), | ||
| 7156 | XCAR (XCDR (text_encoding_info))); | ||
| 7157 | else | ||
| 7158 | text_encoding_info = assq_no_quit (make_number (smRoman), | 7171 | text_encoding_info = assq_no_quit (make_number (smRoman), |
| 7159 | text_encoding_info_alist); | 7172 | text_encoding_info_alist); |
| 7173 | decode_mac_font_name (name, sizeof (name), | ||
| 7174 | XCAR (XCDR (text_encoding_info))); | ||
| 7175 | fm_font_family_alist = Fcons (Fcons (build_string (name), | ||
| 7176 | make_number (fontnum)), | ||
| 7177 | fm_font_family_alist); | ||
| 7160 | do | 7178 | do |
| 7161 | { | 7179 | { |
| 7162 | HLock (font_handle); | 7180 | HLock (font_handle); |
| @@ -7212,6 +7230,7 @@ mac_clear_font_name_table () | |||
| 7212 | xfree (font_name_table); | 7230 | xfree (font_name_table); |
| 7213 | font_name_table = NULL; | 7231 | font_name_table = NULL; |
| 7214 | font_name_table_size = font_name_count = 0; | 7232 | font_name_table_size = font_name_count = 0; |
| 7233 | fm_font_family_alist = Qnil; | ||
| 7215 | } | 7234 | } |
| 7216 | 7235 | ||
| 7217 | 7236 | ||
| @@ -7520,9 +7539,6 @@ is_fully_specified_xlfd (char *p) | |||
| 7520 | } | 7539 | } |
| 7521 | 7540 | ||
| 7522 | 7541 | ||
| 7523 | const int kDefaultFontSize = 12; | ||
| 7524 | |||
| 7525 | |||
| 7526 | /* XLoadQueryFont creates and returns an internal representation for a | 7542 | /* XLoadQueryFont creates and returns an internal representation for a |
| 7527 | font in a MacFontStruct struct. There is really no concept | 7543 | font in a MacFontStruct struct. There is really no concept |
| 7528 | corresponding to "loading" a font on the Mac. But we check its | 7544 | corresponding to "loading" a font on the Mac. But we check its |
| @@ -7532,12 +7548,9 @@ const int kDefaultFontSize = 12; | |||
| 7532 | static MacFontStruct * | 7548 | static MacFontStruct * |
| 7533 | XLoadQueryFont (Display *dpy, char *fontname) | 7549 | XLoadQueryFont (Display *dpy, char *fontname) |
| 7534 | { | 7550 | { |
| 7535 | int i, size, point_size, avgwidth, is_two_byte_font, char_width; | 7551 | int i, size, char_width; |
| 7536 | char *name; | 7552 | char *name; |
| 7537 | GrafPtr port; | 7553 | Str255 family; |
| 7538 | SInt16 old_fontnum, old_fontsize; | ||
| 7539 | Style old_fontface; | ||
| 7540 | Str255 mfontname, mfontname_decoded; | ||
| 7541 | Str31 charset; | 7554 | Str31 charset; |
| 7542 | SInt16 fontnum; | 7555 | SInt16 fontnum; |
| 7543 | #if USE_ATSUI | 7556 | #if USE_ATSUI |
| @@ -7551,10 +7564,6 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7551 | short scriptcode; | 7564 | short scriptcode; |
| 7552 | #endif | 7565 | #endif |
| 7553 | MacFontStruct *font; | 7566 | MacFontStruct *font; |
| 7554 | FontInfo the_fontinfo; | ||
| 7555 | #ifdef MAC_OSX | ||
| 7556 | UInt32 old_flags, new_flags; | ||
| 7557 | #endif | ||
| 7558 | 7567 | ||
| 7559 | if (is_fully_specified_xlfd (fontname)) | 7568 | if (is_fully_specified_xlfd (fontname)) |
| 7560 | name = fontname; | 7569 | name = fontname; |
| @@ -7568,32 +7577,9 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7568 | name = SDATA (XCAR (matched_fonts)); | 7577 | name = SDATA (XCAR (matched_fonts)); |
| 7569 | } | 7578 | } |
| 7570 | 7579 | ||
| 7571 | GetPort (&port); /* save the current font number used */ | 7580 | if (parse_x_font_name (name, family, &size, &fontface, charset) == 0) |
| 7572 | #if TARGET_API_MAC_CARBON | 7581 | return NULL; |
| 7573 | old_fontnum = GetPortTextFont (port); | ||
| 7574 | old_fontsize = GetPortTextSize (port); | ||
| 7575 | old_fontface = GetPortTextFace (port); | ||
| 7576 | #else | ||
| 7577 | old_fontnum = port->txFont; | ||
| 7578 | old_fontsize = port->txSize; | ||
| 7579 | old_fontface = port->txFace; | ||
| 7580 | #endif | ||
| 7581 | |||
| 7582 | if (sscanf (name, "-%*[^-]-%*[^-]-%*[^-]-%*c-%*[^-]--%d-%d-%*[^-]-%*[^-]-%*c-%d-%*s", &size, &point_size, &avgwidth) != 3) | ||
| 7583 | size = 0; | ||
| 7584 | else | ||
| 7585 | { | ||
| 7586 | if (size == 0) | ||
| 7587 | if (point_size > 0) | ||
| 7588 | size = point_size / 10; | ||
| 7589 | else if (avgwidth > 0) | ||
| 7590 | size = avgwidth / 10; | ||
| 7591 | } | ||
| 7592 | if (size == 0) | ||
| 7593 | size = kDefaultFontSize; | ||
| 7594 | 7582 | ||
| 7595 | x_font_name_to_mac_font_name (name, mfontname, mfontname_decoded, | ||
| 7596 | &fontface, charset); | ||
| 7597 | #if USE_ATSUI | 7583 | #if USE_ATSUI |
| 7598 | if (strcmp (charset, "iso10646-1") == 0) /* XXX */ | 7584 | if (strcmp (charset, "iso10646-1") == 0) /* XXX */ |
| 7599 | { | 7585 | { |
| @@ -7610,10 +7596,8 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7610 | ATSUFontFeatureType types[] = {kAllTypographicFeaturesType}; | 7596 | ATSUFontFeatureType types[] = {kAllTypographicFeaturesType}; |
| 7611 | ATSUFontFeatureSelector selectors[] = {kAllTypeFeaturesOffSelector}; | 7597 | ATSUFontFeatureSelector selectors[] = {kAllTypeFeaturesOffSelector}; |
| 7612 | Lisp_Object font_id_cons; | 7598 | Lisp_Object font_id_cons; |
| 7613 | 7599 | ||
| 7614 | font_id_cons = Fgethash (Fdowncase | 7600 | font_id_cons = Fgethash (make_unibyte_string (family, strlen (family)), |
| 7615 | (make_unibyte_string (mfontname, | ||
| 7616 | strlen (mfontname))), | ||
| 7617 | atsu_font_id_hash, Qnil); | 7601 | atsu_font_id_hash, Qnil); |
| 7618 | if (NILP (font_id_cons)) | 7602 | if (NILP (font_id_cons)) |
| 7619 | return NULL; | 7603 | return NULL; |
| @@ -7634,24 +7618,21 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7634 | scriptcode = kTextEncodingMacUnicode; | 7618 | scriptcode = kTextEncodingMacUnicode; |
| 7635 | } | 7619 | } |
| 7636 | else | 7620 | else |
| 7637 | { | ||
| 7638 | #endif | 7621 | #endif |
| 7639 | c2pstr (mfontname); | 7622 | { |
| 7623 | Lisp_Object tmp = Fassoc (build_string (family), fm_font_family_alist); | ||
| 7624 | |||
| 7625 | if (NILP (tmp)) | ||
| 7626 | return NULL; | ||
| 7627 | fontnum = XINT (XCDR (tmp)); | ||
| 7640 | #if TARGET_API_MAC_CARBON | 7628 | #if TARGET_API_MAC_CARBON |
| 7641 | fontnum = FMGetFontFamilyFromName (mfontname); | 7629 | if (FMGetFontFamilyTextEncoding (fontnum, &encoding) != noErr) |
| 7642 | if (fontnum == kInvalidFontFamily | 7630 | return NULL; |
| 7643 | || FMGetFontFamilyTextEncoding (fontnum, &encoding) != noErr) | 7631 | scriptcode = GetTextEncodingBase (encoding); |
| 7644 | return NULL; | ||
| 7645 | scriptcode = GetTextEncodingBase (encoding); | ||
| 7646 | #else | 7632 | #else |
| 7647 | GetFNum (mfontname, &fontnum); | 7633 | scriptcode = FontToScript (fontnum); |
| 7648 | if (fontnum == 0) | ||
| 7649 | return NULL; | ||
| 7650 | scriptcode = FontToScript (fontnum); | ||
| 7651 | #endif | 7634 | #endif |
| 7652 | #if USE_ATSUI | ||
| 7653 | } | 7635 | } |
| 7654 | #endif | ||
| 7655 | 7636 | ||
| 7656 | font = (MacFontStruct *) xmalloc (sizeof (struct MacFontStruct)); | 7637 | font = (MacFontStruct *) xmalloc (sizeof (struct MacFontStruct)); |
| 7657 | 7638 | ||
| @@ -7670,7 +7651,7 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7670 | if (scriptcode == smJapanese && strcmp (charset, "jisx0201.1976-0") == 0) | 7651 | if (scriptcode == smJapanese && strcmp (charset, "jisx0201.1976-0") == 0) |
| 7671 | font->mac_scriptcode = smRoman; | 7652 | font->mac_scriptcode = smRoman; |
| 7672 | 7653 | ||
| 7673 | font->full_name = mac_to_x_fontname (mfontname_decoded, size, fontface, charset); | 7654 | font->full_name = mac_to_x_fontname (family, size, fontface, charset); |
| 7674 | 7655 | ||
| 7675 | #if USE_ATSUI | 7656 | #if USE_ATSUI |
| 7676 | if (font->mac_style) | 7657 | if (font->mac_style) |
| @@ -7755,130 +7736,149 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7755 | font->max_char_or_byte2 = 0xff; | 7736 | font->max_char_or_byte2 = 0xff; |
| 7756 | } | 7737 | } |
| 7757 | else | 7738 | else |
| 7739 | #endif | ||
| 7758 | { | 7740 | { |
| 7741 | GrafPtr port; | ||
| 7742 | SInt16 old_fontnum, old_fontsize; | ||
| 7743 | Style old_fontface; | ||
| 7744 | FontInfo the_fontinfo; | ||
| 7745 | int is_two_byte_font; | ||
| 7746 | |||
| 7747 | /* Save the current font number used. */ | ||
| 7748 | GetPort (&port); | ||
| 7749 | #if TARGET_API_MAC_CARBON | ||
| 7750 | old_fontnum = GetPortTextFont (port); | ||
| 7751 | old_fontsize = GetPortTextSize (port); | ||
| 7752 | old_fontface = GetPortTextFace (port); | ||
| 7753 | #else | ||
| 7754 | old_fontnum = port->txFont; | ||
| 7755 | old_fontsize = port->txSize; | ||
| 7756 | old_fontface = port->txFace; | ||
| 7759 | #endif | 7757 | #endif |
| 7760 | is_two_byte_font = font->mac_scriptcode == smJapanese || | ||
| 7761 | font->mac_scriptcode == smTradChinese || | ||
| 7762 | font->mac_scriptcode == smSimpChinese || | ||
| 7763 | font->mac_scriptcode == smKorean; | ||
| 7764 | 7758 | ||
| 7765 | TextFont (fontnum); | 7759 | TextFont (fontnum); |
| 7766 | TextSize (size); | 7760 | TextSize (size); |
| 7767 | TextFace (fontface); | 7761 | TextFace (fontface); |
| 7768 | 7762 | ||
| 7769 | GetFontInfo (&the_fontinfo); | 7763 | GetFontInfo (&the_fontinfo); |
| 7770 | 7764 | ||
| 7771 | font->ascent = the_fontinfo.ascent; | 7765 | font->ascent = the_fontinfo.ascent; |
| 7772 | font->descent = the_fontinfo.descent; | 7766 | font->descent = the_fontinfo.descent; |
| 7773 | 7767 | ||
| 7774 | if (is_two_byte_font) | 7768 | is_two_byte_font = (font->mac_scriptcode == smJapanese |
| 7775 | { | 7769 | || font->mac_scriptcode == smTradChinese |
| 7776 | font->min_byte1 = 0xa1; | 7770 | || font->mac_scriptcode == smSimpChinese |
| 7777 | font->max_byte1 = 0xfe; | 7771 | || font->mac_scriptcode == smKorean); |
| 7778 | font->min_char_or_byte2 = 0xa1; | ||
| 7779 | font->max_char_or_byte2 = 0xfe; | ||
| 7780 | 7772 | ||
| 7781 | /* Use the width of an "ideographic space" of that font because | 7773 | if (is_two_byte_font) |
| 7782 | the_fontinfo.widMax returns the wrong width for some fonts. */ | 7774 | { |
| 7783 | switch (font->mac_scriptcode) | 7775 | font->min_byte1 = 0xa1; |
| 7784 | { | 7776 | font->max_byte1 = 0xfe; |
| 7785 | case smJapanese: | 7777 | font->min_char_or_byte2 = 0xa1; |
| 7786 | font->min_byte1 = 0x81; | 7778 | font->max_char_or_byte2 = 0xfe; |
| 7787 | font->max_byte1 = 0xfc; | 7779 | |
| 7788 | font->min_char_or_byte2 = 0x40; | 7780 | /* Use the width of an "ideographic space" of that font |
| 7789 | font->max_char_or_byte2 = 0xfc; | 7781 | because the_fontinfo.widMax returns the wrong width for |
| 7790 | char_width = StringWidth("\p\x81\x40"); | 7782 | some fonts. */ |
| 7791 | break; | 7783 | switch (font->mac_scriptcode) |
| 7792 | case smTradChinese: | 7784 | { |
| 7793 | font->min_char_or_byte2 = 0x40; | 7785 | case smJapanese: |
| 7794 | char_width = StringWidth("\p\xa1\x40"); | 7786 | font->min_byte1 = 0x81; |
| 7795 | break; | 7787 | font->max_byte1 = 0xfc; |
| 7796 | case smSimpChinese: | 7788 | font->min_char_or_byte2 = 0x40; |
| 7797 | char_width = StringWidth("\p\xa1\xa1"); | 7789 | font->max_char_or_byte2 = 0xfc; |
| 7798 | break; | 7790 | char_width = StringWidth("\p\x81\x40"); |
| 7799 | case smKorean: | 7791 | break; |
| 7800 | char_width = StringWidth("\p\xa1\xa1"); | 7792 | case smTradChinese: |
| 7801 | break; | 7793 | font->min_char_or_byte2 = 0x40; |
| 7802 | } | 7794 | char_width = StringWidth("\p\xa1\x40"); |
| 7803 | } | 7795 | break; |
| 7804 | else | 7796 | case smSimpChinese: |
| 7805 | { | 7797 | char_width = StringWidth("\p\xa1\xa1"); |
| 7806 | font->min_byte1 = font->max_byte1 = 0; | 7798 | break; |
| 7807 | font->min_char_or_byte2 = 0x20; | 7799 | case smKorean: |
| 7808 | font->max_char_or_byte2 = 0xff; | 7800 | char_width = StringWidth("\p\xa1\xa1"); |
| 7801 | break; | ||
| 7802 | } | ||
| 7803 | } | ||
| 7804 | else | ||
| 7805 | { | ||
| 7806 | font->min_byte1 = font->max_byte1 = 0; | ||
| 7807 | font->min_char_or_byte2 = 0x20; | ||
| 7808 | font->max_char_or_byte2 = 0xff; | ||
| 7809 | 7809 | ||
| 7810 | /* Do this instead of use the_fontinfo.widMax, which incorrectly | 7810 | /* Do this instead of use the_fontinfo.widMax, which |
| 7811 | returns 15 for 12-point Monaco! */ | 7811 | incorrectly returns 15 for 12-point Monaco! */ |
| 7812 | char_width = CharWidth ('m'); | 7812 | char_width = CharWidth ('m'); |
| 7813 | } | 7813 | } |
| 7814 | 7814 | ||
| 7815 | if (is_two_byte_font) | 7815 | if (is_two_byte_font) |
| 7816 | { | 7816 | { |
| 7817 | font->per_char = NULL; | 7817 | font->per_char = NULL; |
| 7818 | 7818 | ||
| 7819 | if (fontface & italic) | 7819 | if (fontface & italic) |
| 7820 | font->max_bounds.rbearing = char_width + 1; | 7820 | font->max_bounds.rbearing = char_width + 1; |
| 7821 | else | 7821 | else |
| 7822 | font->max_bounds.rbearing = char_width; | 7822 | font->max_bounds.rbearing = char_width; |
| 7823 | font->max_bounds.lbearing = 0; | 7823 | font->max_bounds.lbearing = 0; |
| 7824 | font->max_bounds.width = char_width; | 7824 | font->max_bounds.width = char_width; |
| 7825 | font->max_bounds.ascent = the_fontinfo.ascent; | 7825 | font->max_bounds.ascent = the_fontinfo.ascent; |
| 7826 | font->max_bounds.descent = the_fontinfo.descent; | 7826 | font->max_bounds.descent = the_fontinfo.descent; |
| 7827 | 7827 | ||
| 7828 | font->min_bounds = font->max_bounds; | 7828 | font->min_bounds = font->max_bounds; |
| 7829 | } | 7829 | } |
| 7830 | else | 7830 | else |
| 7831 | { | 7831 | { |
| 7832 | int c, min_width, max_width; | 7832 | int c, min_width, max_width; |
| 7833 | Rect char_bounds, min_bounds, max_bounds; | 7833 | Rect char_bounds, min_bounds, max_bounds; |
| 7834 | char ch; | 7834 | char ch; |
| 7835 | 7835 | ||
| 7836 | font->per_char = xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1)); | 7836 | font->per_char = xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1)); |
| 7837 | bzero (font->per_char, sizeof (XCharStruct) * (0xff - 0x20 + 1)); | ||
| 7837 | 7838 | ||
| 7838 | min_width = max_width = char_width; | 7839 | min_width = max_width = char_width; |
| 7839 | SetRect (&min_bounds, -32767, -32767, 32767, 32767); | 7840 | SetRect (&min_bounds, -32767, -32767, 32767, 32767); |
| 7840 | SetRect (&max_bounds, 0, 0, 0, 0); | 7841 | SetRect (&max_bounds, 0, 0, 0, 0); |
| 7841 | for (c = 0x20; c <= 0xff; c++) | 7842 | for (c = 0x20; c <= 0xff; c++) |
| 7842 | { | ||
| 7843 | ch = c; | ||
| 7844 | char_width = CharWidth (ch); | ||
| 7845 | QDTextBounds (1, &ch, &char_bounds); | ||
| 7846 | STORE_XCHARSTRUCT (font->per_char[c - 0x20], | ||
| 7847 | char_width, char_bounds); | ||
| 7848 | /* Some Japanese fonts (in SJIS encoding) return 0 as the | ||
| 7849 | character width of 0x7f. */ | ||
| 7850 | if (char_width > 0) | ||
| 7851 | { | 7843 | { |
| 7852 | min_width = min (min_width, char_width); | 7844 | ch = c; |
| 7853 | max_width = max (max_width, char_width); | 7845 | char_width = CharWidth (ch); |
| 7846 | QDTextBounds (1, &ch, &char_bounds); | ||
| 7847 | STORE_XCHARSTRUCT (font->per_char[c - 0x20], | ||
| 7848 | char_width, char_bounds); | ||
| 7849 | /* Some Japanese fonts (in SJIS encoding) return 0 as | ||
| 7850 | the character width of 0x7f. */ | ||
| 7851 | if (char_width > 0) | ||
| 7852 | { | ||
| 7853 | min_width = min (min_width, char_width); | ||
| 7854 | max_width = max (max_width, char_width); | ||
| 7855 | } | ||
| 7856 | if (!EmptyRect (&char_bounds)) | ||
| 7857 | { | ||
| 7858 | SetRect (&min_bounds, | ||
| 7859 | max (min_bounds.left, char_bounds.left), | ||
| 7860 | max (min_bounds.top, char_bounds.top), | ||
| 7861 | min (min_bounds.right, char_bounds.right), | ||
| 7862 | min (min_bounds.bottom, char_bounds.bottom)); | ||
| 7863 | UnionRect (&max_bounds, &char_bounds, &max_bounds); | ||
| 7864 | } | ||
| 7854 | } | 7865 | } |
| 7855 | if (!EmptyRect (&char_bounds)) | 7866 | STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds); |
| 7867 | STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds); | ||
| 7868 | if (min_width == max_width | ||
| 7869 | && max_bounds.left >= 0 && max_bounds.right <= max_width) | ||
| 7856 | { | 7870 | { |
| 7857 | SetRect (&min_bounds, | 7871 | /* Fixed width and no overhangs. */ |
| 7858 | max (min_bounds.left, char_bounds.left), | 7872 | xfree (font->per_char); |
| 7859 | max (min_bounds.top, char_bounds.top), | 7873 | font->per_char = NULL; |
| 7860 | min (min_bounds.right, char_bounds.right), | ||
| 7861 | min (min_bounds.bottom, char_bounds.bottom)); | ||
| 7862 | UnionRect (&max_bounds, &char_bounds, &max_bounds); | ||
| 7863 | } | 7874 | } |
| 7864 | } | 7875 | } |
| 7865 | STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds); | ||
| 7866 | STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds); | ||
| 7867 | if (min_width == max_width | ||
| 7868 | && max_bounds.left >= 0 && max_bounds.right <= max_width) | ||
| 7869 | { | ||
| 7870 | /* Fixed width and no overhangs. */ | ||
| 7871 | xfree (font->per_char); | ||
| 7872 | font->per_char = NULL; | ||
| 7873 | } | ||
| 7874 | } | ||
| 7875 | 7876 | ||
| 7876 | TextFont (old_fontnum); /* restore previous font number, size and face */ | 7877 | /* Restore previous font number, size and face. */ |
| 7877 | TextSize (old_fontsize); | 7878 | TextFont (old_fontnum); |
| 7878 | TextFace (old_fontface); | 7879 | TextSize (old_fontsize); |
| 7879 | #if USE_ATSUI | 7880 | TextFace (old_fontface); |
| 7880 | } | 7881 | } |
| 7881 | #endif | ||
| 7882 | 7882 | ||
| 7883 | return font; | 7883 | return font; |
| 7884 | } | 7884 | } |
| @@ -10907,14 +10907,17 @@ syms_of_macterm () | |||
| 10907 | staticpro (&Qreverse); | 10907 | staticpro (&Qreverse); |
| 10908 | Qreverse = intern ("reverse"); | 10908 | Qreverse = intern ("reverse"); |
| 10909 | 10909 | ||
| 10910 | staticpro (&Qmac_ready_for_drag_n_drop); | ||
| 10911 | Qmac_ready_for_drag_n_drop = intern ("mac-ready-for-drag-n-drop"); | ||
| 10912 | |||
| 10910 | staticpro (&x_display_name_list); | 10913 | staticpro (&x_display_name_list); |
| 10911 | x_display_name_list = Qnil; | 10914 | x_display_name_list = Qnil; |
| 10912 | 10915 | ||
| 10913 | staticpro (&last_mouse_scroll_bar); | 10916 | staticpro (&last_mouse_scroll_bar); |
| 10914 | last_mouse_scroll_bar = Qnil; | 10917 | last_mouse_scroll_bar = Qnil; |
| 10915 | 10918 | ||
| 10916 | Qmac_ready_for_drag_n_drop = intern ("mac-ready-for-drag-n-drop"); | 10919 | staticpro (&fm_font_family_alist); |
| 10917 | staticpro (&Qmac_ready_for_drag_n_drop); | 10920 | fm_font_family_alist = Qnil; |
| 10918 | 10921 | ||
| 10919 | #if USE_ATSUI | 10922 | #if USE_ATSUI |
| 10920 | staticpro (&atsu_font_id_hash); | 10923 | staticpro (&atsu_font_id_hash); |
diff --git a/src/macterm.h b/src/macterm.h index 948fa486aba..ed645317990 100644 --- a/src/macterm.h +++ b/src/macterm.h | |||
| @@ -39,8 +39,8 @@ Boston, MA 02110-1301, USA. */ | |||
| 39 | #define BLACK_PIX_DEFAULT(f) RGB_TO_ULONG(0,0,0) | 39 | #define BLACK_PIX_DEFAULT(f) RGB_TO_ULONG(0,0,0) |
| 40 | #define WHITE_PIX_DEFAULT(f) RGB_TO_ULONG(255,255,255) | 40 | #define WHITE_PIX_DEFAULT(f) RGB_TO_ULONG(255,255,255) |
| 41 | 41 | ||
| 42 | #define FONT_WIDTH(f) ((f)->max_bounds.width) | 42 | #define FONT_WIDTH(f) ((f)->max_bounds.width) |
| 43 | #define FONT_HEIGHT(f) ((f)->ascent + (f)->descent) | 43 | #define FONT_HEIGHT(f) ((f)->ascent + (f)->descent) |
| 44 | #define FONT_BASE(f) ((f)->ascent) | 44 | #define FONT_BASE(f) ((f)->ascent) |
| 45 | #define FONT_DESCENT(f) ((f)->descent) | 45 | #define FONT_DESCENT(f) ((f)->descent) |
| 46 | 46 | ||
| @@ -82,16 +82,8 @@ struct mac_display_info | |||
| 82 | /* Whether the screen supports color */ | 82 | /* Whether the screen supports color */ |
| 83 | int color_p; | 83 | int color_p; |
| 84 | 84 | ||
| 85 | #if 0 | ||
| 86 | /* Number of bits per pixel on this screen. */ | ||
| 87 | int n_cbits; | ||
| 88 | #endif | ||
| 89 | |||
| 90 | /* Dimensions of this screen. */ | 85 | /* Dimensions of this screen. */ |
| 91 | int height, width; | 86 | int height, width; |
| 92 | #if 0 | ||
| 93 | int height_in,width_in; | ||
| 94 | #endif | ||
| 95 | 87 | ||
| 96 | /* Mask of things that cause the mouse to be grabbed. */ | 88 | /* Mask of things that cause the mouse to be grabbed. */ |
| 97 | int grabbed; | 89 | int grabbed; |
| @@ -111,33 +103,12 @@ struct mac_display_info | |||
| 111 | /* Resource data base */ | 103 | /* Resource data base */ |
| 112 | XrmDatabase xrdb; | 104 | XrmDatabase xrdb; |
| 113 | 105 | ||
| 114 | #if 0 | ||
| 115 | /* color palette information. */ | ||
| 116 | int has_palette; | ||
| 117 | struct w32_palette_entry * color_list; | ||
| 118 | unsigned num_colors; | ||
| 119 | HPALETTE palette; | ||
| 120 | |||
| 121 | /* deferred action flags checked when starting frame update. */ | ||
| 122 | int regen_palette; | ||
| 123 | |||
| 124 | /* Keystroke that has been faked by Emacs and will be ignored when | ||
| 125 | received; value is reset after key is received. */ | ||
| 126 | int faked_key; | ||
| 127 | |||
| 128 | #endif | ||
| 129 | |||
| 130 | /* A table of all the fonts we have already loaded. */ | 106 | /* A table of all the fonts we have already loaded. */ |
| 131 | struct font_info *font_table; | 107 | struct font_info *font_table; |
| 132 | 108 | ||
| 133 | /* The current capacity of font_table. */ | 109 | /* The current capacity of font_table. */ |
| 134 | int font_table_size; | 110 | int font_table_size; |
| 135 | 111 | ||
| 136 | /* The number of fonts actually stored in the font table. | ||
| 137 | font_table[n] is used and valid iff 0 <= n < n_fonts. 0 <= | ||
| 138 | n_fonts <= font_table_size. and font_table[i].name != 0. */ | ||
| 139 | int n_fonts; | ||
| 140 | |||
| 141 | /* Minimum width over all characters in all fonts in font_table. */ | 112 | /* Minimum width over all characters in all fonts in font_table. */ |
| 142 | int smallest_char_width; | 113 | int smallest_char_width; |
| 143 | 114 | ||
| @@ -148,7 +119,7 @@ struct mac_display_info | |||
| 148 | GC scratch_cursor_gc; | 119 | GC scratch_cursor_gc; |
| 149 | 120 | ||
| 150 | /* These variables describe the range of text currently shown in its | 121 | /* These variables describe the range of text currently shown in its |
| 151 | mouse-face, together with the window they apply to. As long as | 122 | mouse-face, together with the window they apply to. As long as |
| 152 | the mouse stays within this range, we need not redraw anything on | 123 | the mouse stays within this range, we need not redraw anything on |
| 153 | its account. Rows and columns are glyph matrix positions in | 124 | its account. Rows and columns are glyph matrix positions in |
| 154 | MOUSE_FACE_WINDOW. */ | 125 | MOUSE_FACE_WINDOW. */ |
| @@ -168,7 +139,6 @@ struct mac_display_info | |||
| 168 | /* FRAME and X, Y position of mouse when last checked for | 139 | /* FRAME and X, Y position of mouse when last checked for |
| 169 | highlighting. X and Y can be negative or out of range for the frame. */ | 140 | highlighting. X and Y can be negative or out of range for the frame. */ |
| 170 | struct frame *mouse_face_mouse_frame; | 141 | struct frame *mouse_face_mouse_frame; |
| 171 | |||
| 172 | int mouse_face_mouse_x, mouse_face_mouse_y; | 142 | int mouse_face_mouse_x, mouse_face_mouse_y; |
| 173 | 143 | ||
| 174 | /* Nonzero means defer mouse-motion highlighting. */ | 144 | /* Nonzero means defer mouse-motion highlighting. */ |
| @@ -181,6 +151,11 @@ struct mac_display_info | |||
| 181 | 151 | ||
| 182 | char *mac_id_name; | 152 | char *mac_id_name; |
| 183 | 153 | ||
| 154 | /* The number of fonts actually stored in the font table. | ||
| 155 | font_table[n] is used and valid iff 0 <= n < n_fonts. 0 <= | ||
| 156 | n_fonts <= font_table_size and font_table[i].name != 0. */ | ||
| 157 | int n_fonts; | ||
| 158 | |||
| 184 | /* Pointer to bitmap records. */ | 159 | /* Pointer to bitmap records. */ |
| 185 | struct mac_bitmap_record *bitmaps; | 160 | struct mac_bitmap_record *bitmaps; |
| 186 | 161 | ||
| @@ -237,7 +212,7 @@ extern int unibyte_display_via_language_environment; | |||
| 237 | extern struct x_display_info *x_display_info_for_display P_ ((Display *)); | 212 | extern struct x_display_info *x_display_info_for_display P_ ((Display *)); |
| 238 | extern struct x_display_info *x_display_info_for_name P_ ((Lisp_Object)); | 213 | extern struct x_display_info *x_display_info_for_name P_ ((Lisp_Object)); |
| 239 | 214 | ||
| 240 | extern struct mac_display_info *mac_term_init (); | 215 | extern struct mac_display_info *mac_term_init P_ ((Lisp_Object, char *, char *)); |
| 241 | 216 | ||
| 242 | extern Lisp_Object x_list_fonts P_ ((struct frame *, Lisp_Object, int, int)); | 217 | extern Lisp_Object x_list_fonts P_ ((struct frame *, Lisp_Object, int, int)); |
| 243 | extern struct font_info *x_get_font_info P_ ((struct frame *f, int)); | 218 | extern struct font_info *x_get_font_info P_ ((struct frame *f, int)); |
| @@ -262,33 +237,8 @@ struct mac_output { | |||
| 262 | /* Menubar "widget" handle. */ | 237 | /* Menubar "widget" handle. */ |
| 263 | int menubar_widget; | 238 | int menubar_widget; |
| 264 | 239 | ||
| 265 | Window mWP; /* pointer to QuickDraw window */ | ||
| 266 | FRAME_PTR mFP; /* points back to the frame struct */ | 240 | FRAME_PTR mFP; /* points back to the frame struct */ |
| 267 | 241 | ||
| 268 | #if 0 | ||
| 269 | int mNumCols; /* number of characters per column */ | ||
| 270 | int mNumRows; /* number of characters per row */ | ||
| 271 | int mLineHeight; /* height of one line of text in pixels */ | ||
| 272 | int mCharWidth; /* width of one character in pixels */ | ||
| 273 | int mHomeX; /* X pixel coordinate of lower left | ||
| 274 | corner of character at (0, 0) */ | ||
| 275 | int mHomeY; /* Y pixel coordinate of lower left | ||
| 276 | corner of character at (0, 0) */ | ||
| 277 | int mHighlight; /* current highlight state (0 = off). */ | ||
| 278 | int mTermWinSize; /* num of lines from top of window | ||
| 279 | affected by ins_del_lines; set by | ||
| 280 | set_terminal_window. */ | ||
| 281 | #endif /* 0 */ | ||
| 282 | |||
| 283 | #if 0 | ||
| 284 | /* stuffs used by xfaces.c */ | ||
| 285 | struct face **param_faces; | ||
| 286 | int n_param_faces; | ||
| 287 | struct face **computed_faces; | ||
| 288 | int n_computed_faces; | ||
| 289 | int size_computed_faces; | ||
| 290 | #endif | ||
| 291 | |||
| 292 | /* Here are the Graphics Contexts for the default font. */ | 242 | /* Here are the Graphics Contexts for the default font. */ |
| 293 | GC normal_gc; /* Normal video */ | 243 | GC normal_gc; /* Normal video */ |
| 294 | GC reverse_gc; /* Reverse video */ | 244 | GC reverse_gc; /* Reverse video */ |
| @@ -322,6 +272,7 @@ struct mac_output { | |||
| 322 | unsigned long mouse_pixel; | 272 | unsigned long mouse_pixel; |
| 323 | unsigned long cursor_foreground_pixel; | 273 | unsigned long cursor_foreground_pixel; |
| 324 | 274 | ||
| 275 | #if 0 | ||
| 325 | /* Foreground color for scroll bars. A value of -1 means use the | 276 | /* Foreground color for scroll bars. A value of -1 means use the |
| 326 | default (black for non-toolkit scroll bars). */ | 277 | default (black for non-toolkit scroll bars). */ |
| 327 | unsigned long scroll_bar_foreground_pixel; | 278 | unsigned long scroll_bar_foreground_pixel; |
| @@ -330,6 +281,7 @@ struct mac_output { | |||
| 330 | default (background color of the frame for non-toolkit scroll | 281 | default (background color of the frame for non-toolkit scroll |
| 331 | bars). */ | 282 | bars). */ |
| 332 | unsigned long scroll_bar_background_pixel; | 283 | unsigned long scroll_bar_background_pixel; |
| 284 | #endif | ||
| 333 | 285 | ||
| 334 | /* Descriptor for the cursor in use for this window. */ | 286 | /* Descriptor for the cursor in use for this window. */ |
| 335 | Cursor text_cursor; | 287 | Cursor text_cursor; |
| @@ -357,10 +309,6 @@ struct mac_output { | |||
| 357 | ControlRef hourglass_control; | 309 | ControlRef hourglass_control; |
| 358 | #endif | 310 | #endif |
| 359 | 311 | ||
| 360 | #if 0 | ||
| 361 | DWORD dwStyle; | ||
| 362 | #endif | ||
| 363 | |||
| 364 | /* This is the Emacs structure for the display this frame is on. */ | 312 | /* This is the Emacs structure for the display this frame is on. */ |
| 365 | /* struct w32_display_info *display_info; */ | 313 | /* struct w32_display_info *display_info; */ |
| 366 | 314 | ||
| @@ -377,10 +325,6 @@ struct mac_output { | |||
| 377 | /* Nonzero means a menu command is being processed. */ | 325 | /* Nonzero means a menu command is being processed. */ |
| 378 | char menu_command_in_progress; | 326 | char menu_command_in_progress; |
| 379 | 327 | ||
| 380 | /* Nonzero means menubar is about to become active, but should be | ||
| 381 | brought up to date first. */ | ||
| 382 | volatile char pending_menu_activation; | ||
| 383 | |||
| 384 | /* Relief GCs, colors etc. */ | 328 | /* Relief GCs, colors etc. */ |
| 385 | struct relief | 329 | struct relief |
| 386 | { | 330 | { |
| @@ -404,8 +348,8 @@ typedef struct mac_output mac_output; | |||
| 404 | #define FRAME_X_OUTPUT(f) ((f)->output_data.mac) | 348 | #define FRAME_X_OUTPUT(f) ((f)->output_data.mac) |
| 405 | 349 | ||
| 406 | /* Return the Mac window used for displaying data in frame F. */ | 350 | /* Return the Mac window used for displaying data in frame F. */ |
| 407 | #define FRAME_MAC_WINDOW(f) ((f)->output_data.mac->mWP) | 351 | #define FRAME_MAC_WINDOW(f) ((f)->output_data.mac->window_desc) |
| 408 | #define FRAME_X_WINDOW(f) ((f)->output_data.mac->mWP) | 352 | #define FRAME_X_WINDOW(f) ((f)->output_data.mac->window_desc) |
| 409 | 353 | ||
| 410 | #define FRAME_FONT(f) ((f)->output_data.mac->font) | 354 | #define FRAME_FONT(f) ((f)->output_data.mac->font) |
| 411 | #define FRAME_FONTSET(f) ((f)->output_data.mac->fontset) | 355 | #define FRAME_FONTSET(f) ((f)->output_data.mac->fontset) |
| @@ -528,7 +472,7 @@ struct scroll_bar { | |||
| 528 | 472 | ||
| 529 | /* Return the inside width of a vertical scroll bar, given the outside | 473 | /* Return the inside width of a vertical scroll bar, given the outside |
| 530 | width. */ | 474 | width. */ |
| 531 | #define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(f,width) \ | 475 | #define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(f, width) \ |
| 532 | ((width) \ | 476 | ((width) \ |
| 533 | - VERTICAL_SCROLL_BAR_LEFT_BORDER \ | 477 | - VERTICAL_SCROLL_BAR_LEFT_BORDER \ |
| 534 | - VERTICAL_SCROLL_BAR_RIGHT_BORDER \ | 478 | - VERTICAL_SCROLL_BAR_RIGHT_BORDER \ |
diff --git a/src/w32term.c b/src/w32term.c index eb3d58b41fa..5f268867e8b 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -1567,7 +1567,7 @@ x_draw_glyph_string_foreground (s) | |||
| 1567 | else | 1567 | else |
| 1568 | x = s->x; | 1568 | x = s->x; |
| 1569 | 1569 | ||
| 1570 | if (s->for_overlaps_p || (s->background_filled_p && s->hl != DRAW_CURSOR)) | 1570 | if (s->for_overlaps || (s->background_filled_p && s->hl != DRAW_CURSOR)) |
| 1571 | SetBkMode (s->hdc, TRANSPARENT); | 1571 | SetBkMode (s->hdc, TRANSPARENT); |
| 1572 | else | 1572 | else |
| 1573 | SetBkMode (s->hdc, OPAQUE); | 1573 | SetBkMode (s->hdc, OPAQUE); |
| @@ -2448,7 +2448,7 @@ x_draw_glyph_string (s) | |||
| 2448 | /* If S draws into the background of its successor, draw the | 2448 | /* If S draws into the background of its successor, draw the |
| 2449 | background of the successor first so that S can draw into it. | 2449 | background of the successor first so that S can draw into it. |
| 2450 | This makes S->next use XDrawString instead of XDrawImageString. */ | 2450 | This makes S->next use XDrawString instead of XDrawImageString. */ |
| 2451 | if (s->next && s->right_overhang && !s->for_overlaps_p) | 2451 | if (s->next && s->right_overhang && !s->for_overlaps) |
| 2452 | { | 2452 | { |
| 2453 | xassert (s->next->img == NULL); | 2453 | xassert (s->next->img == NULL); |
| 2454 | x_set_glyph_string_gc (s->next); | 2454 | x_set_glyph_string_gc (s->next); |
| @@ -2461,7 +2461,7 @@ x_draw_glyph_string (s) | |||
| 2461 | 2461 | ||
| 2462 | /* Draw relief (if any) in advance for char/composition so that the | 2462 | /* Draw relief (if any) in advance for char/composition so that the |
| 2463 | glyph string can be drawn over it. */ | 2463 | glyph string can be drawn over it. */ |
| 2464 | if (!s->for_overlaps_p | 2464 | if (!s->for_overlaps |
| 2465 | && s->face->box != FACE_NO_BOX | 2465 | && s->face->box != FACE_NO_BOX |
| 2466 | && (s->first_glyph->type == CHAR_GLYPH | 2466 | && (s->first_glyph->type == CHAR_GLYPH |
| 2467 | || s->first_glyph->type == COMPOSITE_GLYPH)) | 2467 | || s->first_glyph->type == COMPOSITE_GLYPH)) |
| @@ -2487,7 +2487,7 @@ x_draw_glyph_string (s) | |||
| 2487 | break; | 2487 | break; |
| 2488 | 2488 | ||
| 2489 | case CHAR_GLYPH: | 2489 | case CHAR_GLYPH: |
| 2490 | if (s->for_overlaps_p) | 2490 | if (s->for_overlaps) |
| 2491 | s->background_filled_p = 1; | 2491 | s->background_filled_p = 1; |
| 2492 | else | 2492 | else |
| 2493 | x_draw_glyph_string_background (s, 0); | 2493 | x_draw_glyph_string_background (s, 0); |
| @@ -2495,7 +2495,7 @@ x_draw_glyph_string (s) | |||
| 2495 | break; | 2495 | break; |
| 2496 | 2496 | ||
| 2497 | case COMPOSITE_GLYPH: | 2497 | case COMPOSITE_GLYPH: |
| 2498 | if (s->for_overlaps_p || s->gidx > 0) | 2498 | if (s->for_overlaps || s->gidx > 0) |
| 2499 | s->background_filled_p = 1; | 2499 | s->background_filled_p = 1; |
| 2500 | else | 2500 | else |
| 2501 | x_draw_glyph_string_background (s, 1); | 2501 | x_draw_glyph_string_background (s, 1); |
| @@ -2506,7 +2506,7 @@ x_draw_glyph_string (s) | |||
| 2506 | abort (); | 2506 | abort (); |
| 2507 | } | 2507 | } |
| 2508 | 2508 | ||
| 2509 | if (!s->for_overlaps_p) | 2509 | if (!s->for_overlaps) |
| 2510 | { | 2510 | { |
| 2511 | /* Draw underline. */ | 2511 | /* Draw underline. */ |
| 2512 | if (s->face->underline_p | 2512 | if (s->face->underline_p |
| @@ -3204,8 +3204,6 @@ construct_drag_n_drop (result, msg, f) | |||
| 3204 | static MSG last_mouse_motion_event; | 3204 | static MSG last_mouse_motion_event; |
| 3205 | static Lisp_Object last_mouse_motion_frame; | 3205 | static Lisp_Object last_mouse_motion_frame; |
| 3206 | 3206 | ||
| 3207 | static void remember_mouse_glyph P_ ((struct frame *, int, int)); | ||
| 3208 | |||
| 3209 | static void | 3207 | static void |
| 3210 | note_mouse_movement (frame, msg) | 3208 | note_mouse_movement (frame, msg) |
| 3211 | FRAME_PTR frame; | 3209 | FRAME_PTR frame; |
| @@ -3227,9 +3225,9 @@ note_mouse_movement (frame, msg) | |||
| 3227 | 3225 | ||
| 3228 | /* Has the mouse moved off the glyph it was on at the last sighting? */ | 3226 | /* Has the mouse moved off the glyph it was on at the last sighting? */ |
| 3229 | else if (mouse_x < last_mouse_glyph.left | 3227 | else if (mouse_x < last_mouse_glyph.left |
| 3230 | || mouse_x > last_mouse_glyph.right | 3228 | || mouse_x >= last_mouse_glyph.right |
| 3231 | || mouse_y < last_mouse_glyph.top | 3229 | || mouse_y < last_mouse_glyph.top |
| 3232 | || mouse_y > last_mouse_glyph.bottom) | 3230 | || mouse_y >= last_mouse_glyph.bottom) |
| 3233 | { | 3231 | { |
| 3234 | frame->mouse_moved = 1; | 3232 | frame->mouse_moved = 1; |
| 3235 | last_mouse_scroll_bar = Qnil; | 3233 | last_mouse_scroll_bar = Qnil; |
| @@ -3238,7 +3236,7 @@ note_mouse_movement (frame, msg) | |||
| 3238 | gets called when mouse tracking is enabled but we also need | 3236 | gets called when mouse tracking is enabled but we also need |
| 3239 | to keep track of the mouse for help_echo and highlighting at | 3237 | to keep track of the mouse for help_echo and highlighting at |
| 3240 | other times. */ | 3238 | other times. */ |
| 3241 | remember_mouse_glyph (frame, mouse_x, mouse_y); | 3239 | remember_mouse_glyph (frame, mouse_x, mouse_y, &last_mouse_glyph); |
| 3242 | } | 3240 | } |
| 3243 | } | 3241 | } |
| 3244 | 3242 | ||
| @@ -3250,8 +3248,6 @@ note_mouse_movement (frame, msg) | |||
| 3250 | static struct scroll_bar *x_window_to_scroll_bar (); | 3248 | static struct scroll_bar *x_window_to_scroll_bar (); |
| 3251 | static void x_scroll_bar_report_motion (); | 3249 | static void x_scroll_bar_report_motion (); |
| 3252 | static void x_check_fullscreen P_ ((struct frame *)); | 3250 | static void x_check_fullscreen P_ ((struct frame *)); |
| 3253 | static int glyph_rect P_ ((struct frame *f, int, int, RECT *)); | ||
| 3254 | |||
| 3255 | 3251 | ||
| 3256 | static void | 3252 | static void |
| 3257 | redo_mouse_highlight () | 3253 | redo_mouse_highlight () |
| @@ -3270,108 +3266,6 @@ w32_define_cursor (window, cursor) | |||
| 3270 | { | 3266 | { |
| 3271 | PostMessage (window, WM_EMACS_SETCURSOR, (WPARAM) cursor, 0); | 3267 | PostMessage (window, WM_EMACS_SETCURSOR, (WPARAM) cursor, 0); |
| 3272 | } | 3268 | } |
| 3273 | |||
| 3274 | /* Try to determine frame pixel position and size of the glyph under | ||
| 3275 | frame pixel coordinates X/Y on frame F . Return the position and | ||
| 3276 | size in *RECT. Value is non-zero if we could compute these | ||
| 3277 | values. */ | ||
| 3278 | |||
| 3279 | static int | ||
| 3280 | glyph_rect (f, x, y, rect) | ||
| 3281 | struct frame *f; | ||
| 3282 | int x, y; | ||
| 3283 | RECT *rect; | ||
| 3284 | { | ||
| 3285 | Lisp_Object window; | ||
| 3286 | |||
| 3287 | window = window_from_coordinates (f, x, y, 0, &x, &y, 0); | ||
| 3288 | |||
| 3289 | if (!NILP (window)) | ||
| 3290 | { | ||
| 3291 | struct window *w = XWINDOW (window); | ||
| 3292 | struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | ||
| 3293 | struct glyph_row *end = r + w->current_matrix->nrows - 1; | ||
| 3294 | |||
| 3295 | for (; r < end && r->enabled_p; ++r) | ||
| 3296 | if (r->y <= y && r->y + r->height > y) | ||
| 3297 | { | ||
| 3298 | /* Found the row at y. */ | ||
| 3299 | struct glyph *g = r->glyphs[TEXT_AREA]; | ||
| 3300 | struct glyph *end = g + r->used[TEXT_AREA]; | ||
| 3301 | int gx; | ||
| 3302 | |||
| 3303 | rect->top = WINDOW_TO_FRAME_PIXEL_Y (w, r->y); | ||
| 3304 | rect->bottom = rect->top + r->height; | ||
| 3305 | |||
| 3306 | if (x < r->x) | ||
| 3307 | { | ||
| 3308 | /* x is to the left of the first glyph in the row. */ | ||
| 3309 | /* Shouldn't this be a pixel value? | ||
| 3310 | WINDOW_LEFT_EDGE_X (w) seems to be the right value. | ||
| 3311 | ++KFS */ | ||
| 3312 | rect->left = WINDOW_LEFT_EDGE_COL (w); | ||
| 3313 | rect->right = WINDOW_TO_FRAME_PIXEL_X (w, r->x); | ||
| 3314 | return 1; | ||
| 3315 | } | ||
| 3316 | |||
| 3317 | for (gx = r->x; g < end; gx += g->pixel_width, ++g) | ||
| 3318 | if (gx <= x && gx + g->pixel_width > x) | ||
| 3319 | { | ||
| 3320 | /* x is on a glyph. */ | ||
| 3321 | rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx); | ||
| 3322 | rect->right = rect->left + g->pixel_width; | ||
| 3323 | return 1; | ||
| 3324 | } | ||
| 3325 | |||
| 3326 | /* x is to the right of the last glyph in the row. */ | ||
| 3327 | rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx); | ||
| 3328 | /* Shouldn't this be a pixel value? | ||
| 3329 | WINDOW_RIGHT_EDGE_X (w) seems to be the right value. | ||
| 3330 | ++KFS */ | ||
| 3331 | rect->right = WINDOW_RIGHT_EDGE_COL (w); | ||
| 3332 | return 1; | ||
| 3333 | } | ||
| 3334 | } | ||
| 3335 | |||
| 3336 | /* The y is not on any row. */ | ||
| 3337 | return 0; | ||
| 3338 | } | ||
| 3339 | |||
| 3340 | /* Record the position of the mouse in last_mouse_glyph. */ | ||
| 3341 | static void | ||
| 3342 | remember_mouse_glyph (f1, gx, gy) | ||
| 3343 | struct frame * f1; | ||
| 3344 | int gx, gy; | ||
| 3345 | { | ||
| 3346 | if (!glyph_rect (f1, gx, gy, &last_mouse_glyph)) | ||
| 3347 | { | ||
| 3348 | int width = FRAME_SMALLEST_CHAR_WIDTH (f1); | ||
| 3349 | int height = FRAME_SMALLEST_FONT_HEIGHT (f1); | ||
| 3350 | |||
| 3351 | /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to | ||
| 3352 | round down even for negative values. */ | ||
| 3353 | if (gx < 0) | ||
| 3354 | gx -= width - 1; | ||
| 3355 | if (gy < 0) | ||
| 3356 | gy -= height - 1; | ||
| 3357 | #if 0 | ||
| 3358 | /* This was the original code from XTmouse_position, but it seems | ||
| 3359 | to give the position of the glyph diagonally next to the one | ||
| 3360 | the mouse is over. */ | ||
| 3361 | gx = (gx + width - 1) / width * width; | ||
| 3362 | gy = (gy + height - 1) / height * height; | ||
| 3363 | #else | ||
| 3364 | gx = gx / width * width; | ||
| 3365 | gy = gy / height * height; | ||
| 3366 | #endif | ||
| 3367 | |||
| 3368 | last_mouse_glyph.left = gx; | ||
| 3369 | last_mouse_glyph.top = gy; | ||
| 3370 | last_mouse_glyph.right = gx + width; | ||
| 3371 | last_mouse_glyph.bottom = gy + height; | ||
| 3372 | } | ||
| 3373 | } | ||
| 3374 | |||
| 3375 | /* Return the current position of the mouse. | 3269 | /* Return the current position of the mouse. |
| 3376 | *fp should be a frame which indicates which display to ask about. | 3270 | *fp should be a frame which indicates which display to ask about. |
| 3377 | 3271 | ||
| @@ -3474,7 +3368,7 @@ w32_mouse_position (fp, insist, bar_window, part, x, y, time) | |||
| 3474 | || insist); | 3368 | || insist); |
| 3475 | #else | 3369 | #else |
| 3476 | ScreenToClient (FRAME_W32_WINDOW (f1), &pt); | 3370 | ScreenToClient (FRAME_W32_WINDOW (f1), &pt); |
| 3477 | remember_mouse_glyph (f1, pt.x, pt.y); | 3371 | remember_mouse_glyph (f1, pt.x, pt.y, &last_mouse_glyph); |
| 3478 | #endif | 3372 | #endif |
| 3479 | 3373 | ||
| 3480 | *bar_window = Qnil; | 3374 | *bar_window = Qnil; |
diff --git a/src/window.c b/src/window.c index 9a78ef1ed36..7b3f28ac799 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -684,7 +684,10 @@ coordinates_in_window (w, x, y) | |||
| 684 | 684 | ||
| 685 | /* Outside any interesting column? */ | 685 | /* Outside any interesting column? */ |
| 686 | if (*x < left_x || *x > right_x) | 686 | if (*x < left_x || *x > right_x) |
| 687 | return ON_SCROLL_BAR; | 687 | { |
| 688 | *y -= top_y; | ||
| 689 | return ON_SCROLL_BAR; | ||
| 690 | } | ||
| 688 | 691 | ||
| 689 | lmargin_width = window_box_width (w, LEFT_MARGIN_AREA); | 692 | lmargin_width = window_box_width (w, LEFT_MARGIN_AREA); |
| 690 | rmargin_width = window_box_width (w, RIGHT_MARGIN_AREA); | 693 | rmargin_width = window_box_width (w, RIGHT_MARGIN_AREA); |
| @@ -741,9 +744,9 @@ coordinates_in_window (w, x, y) | |||
| 741 | ? (*x < right_x - WINDOW_RIGHT_FRINGE_WIDTH (w)) | 744 | ? (*x < right_x - WINDOW_RIGHT_FRINGE_WIDTH (w)) |
| 742 | : (*x >= right_x - rmargin_width))) | 745 | : (*x >= right_x - rmargin_width))) |
| 743 | { | 746 | { |
| 744 | *x -= right_x; | 747 | *x -= right_x - rmargin_width; |
| 745 | if (!WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) | 748 | if (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) |
| 746 | *x -= WINDOW_RIGHT_FRINGE_WIDTH (w); | 749 | *x += WINDOW_RIGHT_FRINGE_WIDTH (w); |
| 747 | *y -= top_y; | 750 | *y -= top_y; |
| 748 | return ON_RIGHT_MARGIN; | 751 | return ON_RIGHT_MARGIN; |
| 749 | } | 752 | } |
| @@ -755,7 +758,7 @@ coordinates_in_window (w, x, y) | |||
| 755 | } | 758 | } |
| 756 | 759 | ||
| 757 | /* Everything special ruled out - must be on text area */ | 760 | /* Everything special ruled out - must be on text area */ |
| 758 | *x -= left_x + WINDOW_LEFT_FRINGE_WIDTH (w); | 761 | *x -= text_left; |
| 759 | *y -= top_y; | 762 | *y -= top_y; |
| 760 | return ON_TEXT; | 763 | return ON_TEXT; |
| 761 | } | 764 | } |
| @@ -1031,7 +1034,8 @@ if it isn't already recorded. */) | |||
| 1031 | 1034 | ||
| 1032 | if (! NILP (update) | 1035 | if (! NILP (update) |
| 1033 | && ! (! NILP (w->window_end_valid) | 1036 | && ! (! NILP (w->window_end_valid) |
| 1034 | && XFASTINT (w->last_modified) >= MODIFF)) | 1037 | && XFASTINT (w->last_modified) >= MODIFF) |
| 1038 | && !noninteractive) | ||
| 1035 | { | 1039 | { |
| 1036 | struct text_pos startp; | 1040 | struct text_pos startp; |
| 1037 | struct it it; | 1041 | struct it it; |
| @@ -6234,7 +6238,7 @@ usage: (save-window-excursion BODY ...) */) | |||
| 6234 | ***********************************************************************/ | 6238 | ***********************************************************************/ |
| 6235 | 6239 | ||
| 6236 | static Lisp_Object | 6240 | static Lisp_Object |
| 6237 | window_split_tree (w) | 6241 | window_tree (w) |
| 6238 | struct window *w; | 6242 | struct window *w; |
| 6239 | { | 6243 | { |
| 6240 | Lisp_Object tail = Qnil; | 6244 | Lisp_Object tail = Qnil; |
| @@ -6247,10 +6251,10 @@ window_split_tree (w) | |||
| 6247 | XSETWINDOW (wn, w); | 6251 | XSETWINDOW (wn, w); |
| 6248 | if (!NILP (w->hchild)) | 6252 | if (!NILP (w->hchild)) |
| 6249 | wn = Fcons (Qnil, Fcons (Fwindow_edges (wn), | 6253 | wn = Fcons (Qnil, Fcons (Fwindow_edges (wn), |
| 6250 | window_split_tree (XWINDOW (w->hchild)))); | 6254 | window_tree (XWINDOW (w->hchild)))); |
| 6251 | else if (!NILP (w->vchild)) | 6255 | else if (!NILP (w->vchild)) |
| 6252 | wn = Fcons (Qt, Fcons (Fwindow_edges (wn), | 6256 | wn = Fcons (Qt, Fcons (Fwindow_edges (wn), |
| 6253 | window_split_tree (XWINDOW (w->vchild)))); | 6257 | window_tree (XWINDOW (w->vchild)))); |
| 6254 | 6258 | ||
| 6255 | if (NILP (result)) | 6259 | if (NILP (result)) |
| 6256 | { | 6260 | { |
| @@ -6270,17 +6274,17 @@ window_split_tree (w) | |||
| 6270 | 6274 | ||
| 6271 | 6275 | ||
| 6272 | 6276 | ||
| 6273 | DEFUN ("window-split-tree", Fwindow_split_tree, Swindow_split_tree, | 6277 | DEFUN ("window-tree", Fwindow_tree, Swindow_tree, |
| 6274 | 0, 1, 0, | 6278 | 0, 1, 0, |
| 6275 | doc: /* Return the window split tree for frame FRAME. | 6279 | doc: /* Return the window tree for frame FRAME. |
| 6276 | 6280 | ||
| 6277 | The return value is a list of the form (ROOT MINI), where ROOT | 6281 | The return value is a list of the form (ROOT MINI), where ROOT |
| 6278 | represents the window split tree of the frame's root window, and MINI | 6282 | represents the window tree of the frame's root window, and MINI |
| 6279 | is the frame's minibuffer window. | 6283 | is the frame's minibuffer window. |
| 6280 | 6284 | ||
| 6281 | If the root window is not split, ROOT is the root window itself. | 6285 | If the root window is not split, ROOT is the root window itself. |
| 6282 | Otherwise, ROOT is a list (DIR EDGES W1 W2 ...) where DIR is nil for a | 6286 | Otherwise, ROOT is a list (DIR EDGES W1 W2 ...) where DIR is nil for a |
| 6283 | horisontal split, and t for a vertical split, EDGES gives the combined | 6287 | horizontal split, and t for a vertical split, EDGES gives the combined |
| 6284 | size and position of the subwindows in the split, and the rest of the | 6288 | size and position of the subwindows in the split, and the rest of the |
| 6285 | elements are the subwindows in the split. Each of the subwindows may | 6289 | elements are the subwindows in the split. Each of the subwindows may |
| 6286 | again be a window or a list representing a window split, and so on. | 6290 | again be a window or a list representing a window split, and so on. |
| @@ -6303,7 +6307,7 @@ selected frame. */) | |||
| 6303 | if (!FRAME_LIVE_P (f)) | 6307 | if (!FRAME_LIVE_P (f)) |
| 6304 | return Qnil; | 6308 | return Qnil; |
| 6305 | 6309 | ||
| 6306 | return window_split_tree (XWINDOW (FRAME_ROOT_WINDOW (f))); | 6310 | return window_tree (XWINDOW (FRAME_ROOT_WINDOW (f))); |
| 6307 | } | 6311 | } |
| 6308 | 6312 | ||
| 6309 | 6313 | ||
| @@ -7112,7 +7116,7 @@ The selected frame is the one whose configuration has changed. */); | |||
| 7112 | defsubr (&Sset_window_configuration); | 7116 | defsubr (&Sset_window_configuration); |
| 7113 | defsubr (&Scurrent_window_configuration); | 7117 | defsubr (&Scurrent_window_configuration); |
| 7114 | defsubr (&Ssave_window_excursion); | 7118 | defsubr (&Ssave_window_excursion); |
| 7115 | defsubr (&Swindow_split_tree); | 7119 | defsubr (&Swindow_tree); |
| 7116 | defsubr (&Sset_window_margins); | 7120 | defsubr (&Sset_window_margins); |
| 7117 | defsubr (&Swindow_margins); | 7121 | defsubr (&Swindow_margins); |
| 7118 | defsubr (&Sset_window_fringes); | 7122 | defsubr (&Sset_window_fringes); |
diff --git a/src/xdisp.c b/src/xdisp.c index 2c66481a8c3..013d3955c6f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -1755,15 +1755,20 @@ frame_to_window_pixel_xy (w, x, y) | |||
| 1755 | } | 1755 | } |
| 1756 | 1756 | ||
| 1757 | /* EXPORT: | 1757 | /* EXPORT: |
| 1758 | Return in *R the clipping rectangle for glyph string S. */ | 1758 | Return in RECTS[] at most N clipping rectangles for glyph string S. |
| 1759 | Return the number of stored rectangles. */ | ||
| 1759 | 1760 | ||
| 1760 | void | 1761 | int |
| 1761 | get_glyph_string_clip_rect (s, nr) | 1762 | get_glyph_string_clip_rects (s, rects, n) |
| 1762 | struct glyph_string *s; | 1763 | struct glyph_string *s; |
| 1763 | NativeRectangle *nr; | 1764 | NativeRectangle *rects; |
| 1765 | int n; | ||
| 1764 | { | 1766 | { |
| 1765 | XRectangle r; | 1767 | XRectangle r; |
| 1766 | 1768 | ||
| 1769 | if (n <= 0) | ||
| 1770 | return 0; | ||
| 1771 | |||
| 1767 | if (s->row->full_width_p) | 1772 | if (s->row->full_width_p) |
| 1768 | { | 1773 | { |
| 1769 | /* Draw full-width. X coordinates are relative to S->w->left_col. */ | 1774 | /* Draw full-width. X coordinates are relative to S->w->left_col. */ |
| @@ -1806,10 +1811,27 @@ get_glyph_string_clip_rect (s, nr) | |||
| 1806 | /* If S draws overlapping rows, it's sufficient to use the top and | 1811 | /* If S draws overlapping rows, it's sufficient to use the top and |
| 1807 | bottom of the window for clipping because this glyph string | 1812 | bottom of the window for clipping because this glyph string |
| 1808 | intentionally draws over other lines. */ | 1813 | intentionally draws over other lines. */ |
| 1809 | if (s->for_overlaps_p) | 1814 | if (s->for_overlaps) |
| 1810 | { | 1815 | { |
| 1811 | r.y = WINDOW_HEADER_LINE_HEIGHT (s->w); | 1816 | r.y = WINDOW_HEADER_LINE_HEIGHT (s->w); |
| 1812 | r.height = window_text_bottom_y (s->w) - r.y; | 1817 | r.height = window_text_bottom_y (s->w) - r.y; |
| 1818 | |||
| 1819 | /* Alas, the above simple strategy does not work for the | ||
| 1820 | environments with anti-aliased text: if the same text is | ||
| 1821 | drawn onto the same place multiple times, it gets thicker. | ||
| 1822 | If the overlap we are processing is for the erased cursor, we | ||
| 1823 | take the intersection with the rectagle of the cursor. */ | ||
| 1824 | if (s->for_overlaps & OVERLAPS_ERASED_CURSOR) | ||
| 1825 | { | ||
| 1826 | XRectangle rc, r_save = r; | ||
| 1827 | |||
| 1828 | rc.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (s->w, s->w->phys_cursor.x); | ||
| 1829 | rc.y = s->w->phys_cursor.y; | ||
| 1830 | rc.width = s->w->phys_cursor_width; | ||
| 1831 | rc.height = s->w->phys_cursor_height; | ||
| 1832 | |||
| 1833 | x_intersect_rectangles (&r_save, &rc, &r); | ||
| 1834 | } | ||
| 1813 | } | 1835 | } |
| 1814 | else | 1836 | else |
| 1815 | { | 1837 | { |
| @@ -1868,11 +1890,71 @@ get_glyph_string_clip_rect (s, nr) | |||
| 1868 | } | 1890 | } |
| 1869 | } | 1891 | } |
| 1870 | 1892 | ||
| 1893 | if ((s->for_overlaps & OVERLAPS_BOTH) == 0 | ||
| 1894 | || (s->for_overlaps & OVERLAPS_BOTH) == OVERLAPS_BOTH && n == 1) | ||
| 1895 | { | ||
| 1896 | #ifdef CONVERT_FROM_XRECT | ||
| 1897 | CONVERT_FROM_XRECT (r, *rects); | ||
| 1898 | #else | ||
| 1899 | *rects = r; | ||
| 1900 | #endif | ||
| 1901 | return 1; | ||
| 1902 | } | ||
| 1903 | else | ||
| 1904 | { | ||
| 1905 | /* If we are processing overlapping and allowed to return | ||
| 1906 | multiple clipping rectangles, we exclude the row of the glyph | ||
| 1907 | string from the clipping rectangle. This is to avoid drawing | ||
| 1908 | the same text on the environment with anti-aliasing. */ | ||
| 1871 | #ifdef CONVERT_FROM_XRECT | 1909 | #ifdef CONVERT_FROM_XRECT |
| 1872 | CONVERT_FROM_XRECT (r, *nr); | 1910 | XRectangle rs[2]; |
| 1873 | #else | 1911 | #else |
| 1874 | *nr = r; | 1912 | XRectangle *rs = rects; |
| 1875 | #endif | 1913 | #endif |
| 1914 | int i = 0, row_y = WINDOW_TO_FRAME_PIXEL_Y (s->w, s->row->y); | ||
| 1915 | |||
| 1916 | if (s->for_overlaps & OVERLAPS_PRED) | ||
| 1917 | { | ||
| 1918 | rs[i] = r; | ||
| 1919 | if (r.y + r.height > row_y) | ||
| 1920 | if (r.y < row_y) | ||
| 1921 | rs[i].height = row_y - r.y; | ||
| 1922 | else | ||
| 1923 | rs[i].height = 0; | ||
| 1924 | i++; | ||
| 1925 | } | ||
| 1926 | if (s->for_overlaps & OVERLAPS_SUCC) | ||
| 1927 | { | ||
| 1928 | rs[i] = r; | ||
| 1929 | if (r.y < row_y + s->row->visible_height) | ||
| 1930 | if (r.y + r.height > row_y + s->row->visible_height) | ||
| 1931 | { | ||
| 1932 | rs[i].y = row_y + s->row->visible_height; | ||
| 1933 | rs[i].height = r.y + r.height - rs[i].y; | ||
| 1934 | } | ||
| 1935 | else | ||
| 1936 | rs[i].height = 0; | ||
| 1937 | i++; | ||
| 1938 | } | ||
| 1939 | |||
| 1940 | n = i; | ||
| 1941 | #ifdef CONVERT_FROM_XRECT | ||
| 1942 | for (i = 0; i < n; i++) | ||
| 1943 | CONVERT_FROM_XRECT (rs[i], rects[i]); | ||
| 1944 | #endif | ||
| 1945 | return n; | ||
| 1946 | } | ||
| 1947 | } | ||
| 1948 | |||
| 1949 | /* EXPORT: | ||
| 1950 | Return in *NR the clipping rectangle for glyph string S. */ | ||
| 1951 | |||
| 1952 | void | ||
| 1953 | get_glyph_string_clip_rect (s, nr) | ||
| 1954 | struct glyph_string *s; | ||
| 1955 | NativeRectangle *nr; | ||
| 1956 | { | ||
| 1957 | get_glyph_string_clip_rects (s, nr, 1); | ||
| 1876 | } | 1958 | } |
| 1877 | 1959 | ||
| 1878 | 1960 | ||
| @@ -1932,6 +2014,181 @@ get_phys_cursor_geometry (w, row, glyph, heightp) | |||
| 1932 | return WINDOW_TO_FRAME_PIXEL_Y (w, y); | 2014 | return WINDOW_TO_FRAME_PIXEL_Y (w, y); |
| 1933 | } | 2015 | } |
| 1934 | 2016 | ||
| 2017 | /* | ||
| 2018 | * Remember which glyph the mouse is over. | ||
| 2019 | */ | ||
| 2020 | |||
| 2021 | void | ||
| 2022 | remember_mouse_glyph (f, gx, gy, rect) | ||
| 2023 | struct frame *f; | ||
| 2024 | int gx, gy; | ||
| 2025 | NativeRectangle *rect; | ||
| 2026 | { | ||
| 2027 | Lisp_Object window; | ||
| 2028 | struct window *w; | ||
| 2029 | struct glyph_row *r, *gr, *end_row; | ||
| 2030 | enum window_part part; | ||
| 2031 | enum glyph_row_area area; | ||
| 2032 | int x, y, width, height; | ||
| 2033 | |||
| 2034 | /* Try to determine frame pixel position and size of the glyph under | ||
| 2035 | frame pixel coordinates X/Y on frame F. */ | ||
| 2036 | |||
| 2037 | window = window_from_coordinates (f, gx, gy, &part, &x, &y, 0); | ||
| 2038 | if (NILP (window)) | ||
| 2039 | { | ||
| 2040 | width = FRAME_SMALLEST_CHAR_WIDTH (f); | ||
| 2041 | height = FRAME_SMALLEST_FONT_HEIGHT (f); | ||
| 2042 | goto virtual_glyph; | ||
| 2043 | } | ||
| 2044 | |||
| 2045 | w = XWINDOW (window); | ||
| 2046 | width = WINDOW_FRAME_COLUMN_WIDTH (w); | ||
| 2047 | height = WINDOW_FRAME_LINE_HEIGHT (w); | ||
| 2048 | |||
| 2049 | r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | ||
| 2050 | end_row = r + w->current_matrix->nrows - 1; | ||
| 2051 | |||
| 2052 | if (w->pseudo_window_p) | ||
| 2053 | { | ||
| 2054 | area = TEXT_AREA; | ||
| 2055 | part = ON_MODE_LINE; /* Don't adjust margin. */ | ||
| 2056 | goto text_glyph; | ||
| 2057 | } | ||
| 2058 | |||
| 2059 | switch (part) | ||
| 2060 | { | ||
| 2061 | case ON_LEFT_MARGIN: | ||
| 2062 | area = LEFT_MARGIN_AREA; | ||
| 2063 | goto text_glyph; | ||
| 2064 | |||
| 2065 | case ON_RIGHT_MARGIN: | ||
| 2066 | area = RIGHT_MARGIN_AREA; | ||
| 2067 | goto text_glyph; | ||
| 2068 | |||
| 2069 | case ON_TEXT: | ||
| 2070 | case ON_MODE_LINE: | ||
| 2071 | case ON_HEADER_LINE: | ||
| 2072 | area = TEXT_AREA; | ||
| 2073 | |||
| 2074 | text_glyph: | ||
| 2075 | gr = 0; gy = 0; | ||
| 2076 | for (; r < end_row && r->enabled_p; ++r) | ||
| 2077 | if (r->y + r->height > y) | ||
| 2078 | { | ||
| 2079 | gr = r; gy = r->y; | ||
| 2080 | break; | ||
| 2081 | } | ||
| 2082 | |||
| 2083 | if (gr && gy <= y) | ||
| 2084 | { | ||
| 2085 | struct glyph *g = gr->glyphs[area]; | ||
| 2086 | struct glyph *end = g + gr->used[area]; | ||
| 2087 | |||
| 2088 | height = gr->height; | ||
| 2089 | for (gx = gr->x; g < end; gx += g->pixel_width, ++g) | ||
| 2090 | if (gx + g->pixel_width > x) | ||
| 2091 | break; | ||
| 2092 | |||
| 2093 | if (g < end) | ||
| 2094 | width = g->pixel_width; | ||
| 2095 | else | ||
| 2096 | { | ||
| 2097 | /* Use nominal char spacing at end of line. */ | ||
| 2098 | x -= gx; | ||
| 2099 | gx += (x / width) * width; | ||
| 2100 | } | ||
| 2101 | |||
| 2102 | if (part != ON_MODE_LINE && part != ON_HEADER_LINE) | ||
| 2103 | gx += window_box_left_offset (w, area); | ||
| 2104 | } | ||
| 2105 | else | ||
| 2106 | { | ||
| 2107 | /* Use nominal line height at end of window. */ | ||
| 2108 | gx = (x / width) * width; | ||
| 2109 | y -= gy; | ||
| 2110 | gy += (y / height) * height; | ||
| 2111 | } | ||
| 2112 | break; | ||
| 2113 | |||
| 2114 | case ON_LEFT_FRINGE: | ||
| 2115 | gx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | ||
| 2116 | ? WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w) | ||
| 2117 | : window_box_right_offset (w, LEFT_MARGIN_AREA)); | ||
| 2118 | width = WINDOW_LEFT_FRINGE_WIDTH (w); | ||
| 2119 | goto row_glyph; | ||
| 2120 | |||
| 2121 | case ON_RIGHT_FRINGE: | ||
| 2122 | gx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | ||
| 2123 | ? window_box_right_offset (w, RIGHT_MARGIN_AREA) | ||
| 2124 | : window_box_right_offset (w, TEXT_AREA)); | ||
| 2125 | width = WINDOW_RIGHT_FRINGE_WIDTH (w); | ||
| 2126 | goto row_glyph; | ||
| 2127 | |||
| 2128 | case ON_SCROLL_BAR: | ||
| 2129 | gx = (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) | ||
| 2130 | ? 0 | ||
| 2131 | : (window_box_right_offset (w, RIGHT_MARGIN_AREA) | ||
| 2132 | + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | ||
| 2133 | ? WINDOW_RIGHT_FRINGE_WIDTH (w) | ||
| 2134 | : 0))); | ||
| 2135 | width = WINDOW_SCROLL_BAR_AREA_WIDTH (w); | ||
| 2136 | |||
| 2137 | row_glyph: | ||
| 2138 | gr = 0, gy = 0; | ||
| 2139 | for (; r < end_row && r->enabled_p; ++r) | ||
| 2140 | if (r->y + r->height > y) | ||
| 2141 | { | ||
| 2142 | gr = r; gy = r->y; | ||
| 2143 | break; | ||
| 2144 | } | ||
| 2145 | |||
| 2146 | if (gr && gy <= y) | ||
| 2147 | height = gr->height; | ||
| 2148 | else | ||
| 2149 | { | ||
| 2150 | /* Use nominal line height at end of window. */ | ||
| 2151 | y -= gy; | ||
| 2152 | gy += (y / height) * height; | ||
| 2153 | } | ||
| 2154 | break; | ||
| 2155 | |||
| 2156 | default: | ||
| 2157 | ; | ||
| 2158 | virtual_glyph: | ||
| 2159 | /* If there is no glyph under the mouse, then we divide the screen | ||
| 2160 | into a grid of the smallest glyph in the frame, and use that | ||
| 2161 | as our "glyph". */ | ||
| 2162 | |||
| 2163 | /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to | ||
| 2164 | round down even for negative values. */ | ||
| 2165 | if (gx < 0) | ||
| 2166 | gx -= width - 1; | ||
| 2167 | if (gy < 0) | ||
| 2168 | gy -= height - 1; | ||
| 2169 | |||
| 2170 | gx = (gx / width) * width; | ||
| 2171 | gy = (gy / height) * height; | ||
| 2172 | |||
| 2173 | goto store_rect; | ||
| 2174 | } | ||
| 2175 | |||
| 2176 | gx += WINDOW_LEFT_EDGE_X (w); | ||
| 2177 | gy += WINDOW_TOP_EDGE_Y (w); | ||
| 2178 | |||
| 2179 | store_rect: | ||
| 2180 | STORE_NATIVE_RECT (*rect, gx, gy, width, height); | ||
| 2181 | |||
| 2182 | /* Visible feedback for debugging. */ | ||
| 2183 | #if 0 | ||
| 2184 | #if HAVE_X_WINDOWS | ||
| 2185 | XDrawRectangle (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | ||
| 2186 | f->output_data.x->normal_gc, | ||
| 2187 | gx, gy, width, height); | ||
| 2188 | #endif | ||
| 2189 | #endif | ||
| 2190 | } | ||
| 2191 | |||
| 1935 | 2192 | ||
| 1936 | #endif /* HAVE_WINDOW_SYSTEM */ | 2193 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 1937 | 2194 | ||
| @@ -18035,22 +18292,23 @@ get_glyph_face_and_encoding (f, glyph, char2b, two_byte_p) | |||
| 18035 | 18292 | ||
| 18036 | FACES is an array of faces for all components of this composition. | 18293 | FACES is an array of faces for all components of this composition. |
| 18037 | S->gidx is the index of the first component for S. | 18294 | S->gidx is the index of the first component for S. |
| 18038 | OVERLAPS_P non-zero means S should draw the foreground only, and | 18295 | |
| 18039 | use its physical height for clipping. | 18296 | OVERLAPS non-zero means S should draw the foreground only, and use |
| 18297 | its physical height for clipping. See also draw_glyphs. | ||
| 18040 | 18298 | ||
| 18041 | Value is the index of a component not in S. */ | 18299 | Value is the index of a component not in S. */ |
| 18042 | 18300 | ||
| 18043 | static int | 18301 | static int |
| 18044 | fill_composite_glyph_string (s, faces, overlaps_p) | 18302 | fill_composite_glyph_string (s, faces, overlaps) |
| 18045 | struct glyph_string *s; | 18303 | struct glyph_string *s; |
| 18046 | struct face **faces; | 18304 | struct face **faces; |
| 18047 | int overlaps_p; | 18305 | int overlaps; |
| 18048 | { | 18306 | { |
| 18049 | int i; | 18307 | int i; |
| 18050 | 18308 | ||
| 18051 | xassert (s); | 18309 | xassert (s); |
| 18052 | 18310 | ||
| 18053 | s->for_overlaps_p = overlaps_p; | 18311 | s->for_overlaps = overlaps; |
| 18054 | 18312 | ||
| 18055 | s->face = faces[s->gidx]; | 18313 | s->face = faces[s->gidx]; |
| 18056 | s->font = s->face->font; | 18314 | s->font = s->face->font; |
| @@ -18094,16 +18352,16 @@ fill_composite_glyph_string (s, faces, overlaps_p) | |||
| 18094 | 18352 | ||
| 18095 | FACE_ID is the face id of the string. START is the index of the | 18353 | FACE_ID is the face id of the string. START is the index of the |
| 18096 | first glyph to consider, END is the index of the last + 1. | 18354 | first glyph to consider, END is the index of the last + 1. |
| 18097 | OVERLAPS_P non-zero means S should draw the foreground only, and | 18355 | OVERLAPS non-zero means S should draw the foreground only, and use |
| 18098 | use its physical height for clipping. | 18356 | its physical height for clipping. See also draw_glyphs. |
| 18099 | 18357 | ||
| 18100 | Value is the index of the first glyph not in S. */ | 18358 | Value is the index of the first glyph not in S. */ |
| 18101 | 18359 | ||
| 18102 | static int | 18360 | static int |
| 18103 | fill_glyph_string (s, face_id, start, end, overlaps_p) | 18361 | fill_glyph_string (s, face_id, start, end, overlaps) |
| 18104 | struct glyph_string *s; | 18362 | struct glyph_string *s; |
| 18105 | int face_id; | 18363 | int face_id; |
| 18106 | int start, end, overlaps_p; | 18364 | int start, end, overlaps; |
| 18107 | { | 18365 | { |
| 18108 | struct glyph *glyph, *last; | 18366 | struct glyph *glyph, *last; |
| 18109 | int voffset; | 18367 | int voffset; |
| @@ -18113,7 +18371,7 @@ fill_glyph_string (s, face_id, start, end, overlaps_p) | |||
| 18113 | xassert (s->nchars == 0); | 18371 | xassert (s->nchars == 0); |
| 18114 | xassert (start >= 0 && end > start); | 18372 | xassert (start >= 0 && end > start); |
| 18115 | 18373 | ||
| 18116 | s->for_overlaps_p = overlaps_p, | 18374 | s->for_overlaps = overlaps, |
| 18117 | glyph = s->row->glyphs[s->area] + start; | 18375 | glyph = s->row->glyphs[s->area] + start; |
| 18118 | last = s->row->glyphs[s->area] + end; | 18376 | last = s->row->glyphs[s->area] + end; |
| 18119 | voffset = glyph->voffset; | 18377 | voffset = glyph->voffset; |
| @@ -18590,7 +18848,7 @@ compute_overhangs_and_x (s, x, backward_p) | |||
| 18590 | INIT_GLYPH_STRING (s, char2b, w, row, area, START, HL); \ | 18848 | INIT_GLYPH_STRING (s, char2b, w, row, area, START, HL); \ |
| 18591 | append_glyph_string (&HEAD, &TAIL, s); \ | 18849 | append_glyph_string (&HEAD, &TAIL, s); \ |
| 18592 | s->x = (X); \ | 18850 | s->x = (X); \ |
| 18593 | START = fill_glyph_string (s, face_id, START, END, overlaps_p); \ | 18851 | START = fill_glyph_string (s, face_id, START, END, overlaps); \ |
| 18594 | } \ | 18852 | } \ |
| 18595 | while (0) | 18853 | while (0) |
| 18596 | 18854 | ||
| @@ -18643,7 +18901,7 @@ compute_overhangs_and_x (s, x, backward_p) | |||
| 18643 | if (n == 0) \ | 18901 | if (n == 0) \ |
| 18644 | first_s = s; \ | 18902 | first_s = s; \ |
| 18645 | \ | 18903 | \ |
| 18646 | n = fill_composite_glyph_string (s, faces, overlaps_p); \ | 18904 | n = fill_composite_glyph_string (s, faces, overlaps); \ |
| 18647 | } \ | 18905 | } \ |
| 18648 | \ | 18906 | \ |
| 18649 | ++START; \ | 18907 | ++START; \ |
| @@ -18712,20 +18970,26 @@ compute_overhangs_and_x (s, x, backward_p) | |||
| 18712 | DRAW_IMAGE_SUNKEN draw an image with a sunken relief around it | 18970 | DRAW_IMAGE_SUNKEN draw an image with a sunken relief around it |
| 18713 | DRAW_IMAGE_RAISED draw an image with a raised relief around it | 18971 | DRAW_IMAGE_RAISED draw an image with a raised relief around it |
| 18714 | 18972 | ||
| 18715 | If OVERLAPS_P is non-zero, draw only the foreground of characters | 18973 | If OVERLAPS is non-zero, draw only the foreground of characters and |
| 18716 | and clip to the physical height of ROW. | 18974 | clip to the physical height of ROW. Non-zero value also defines |
| 18975 | the overlapping part to be drawn: | ||
| 18976 | |||
| 18977 | OVERLAPS_PRED overlap with preceding rows | ||
| 18978 | OVERLAPS_SUCC overlap with succeeding rows | ||
| 18979 | OVERLAPS_BOTH overlap with both preceding/succeeding rows | ||
| 18980 | OVERLAPS_ERASED_CURSOR overlap with erased cursor area | ||
| 18717 | 18981 | ||
| 18718 | Value is the x-position reached, relative to AREA of W. */ | 18982 | Value is the x-position reached, relative to AREA of W. */ |
| 18719 | 18983 | ||
| 18720 | static int | 18984 | static int |
| 18721 | draw_glyphs (w, x, row, area, start, end, hl, overlaps_p) | 18985 | draw_glyphs (w, x, row, area, start, end, hl, overlaps) |
| 18722 | struct window *w; | 18986 | struct window *w; |
| 18723 | int x; | 18987 | int x; |
| 18724 | struct glyph_row *row; | 18988 | struct glyph_row *row; |
| 18725 | enum glyph_row_area area; | 18989 | enum glyph_row_area area; |
| 18726 | int start, end; | 18990 | int start, end; |
| 18727 | enum draw_glyphs_face hl; | 18991 | enum draw_glyphs_face hl; |
| 18728 | int overlaps_p; | 18992 | int overlaps; |
| 18729 | { | 18993 | { |
| 18730 | struct glyph_string *head, *tail; | 18994 | struct glyph_string *head, *tail; |
| 18731 | struct glyph_string *s; | 18995 | struct glyph_string *s; |
| @@ -18774,7 +19038,7 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_p) | |||
| 18774 | /* If there are any glyphs with lbearing < 0 or rbearing > width in | 19038 | /* If there are any glyphs with lbearing < 0 or rbearing > width in |
| 18775 | the row, redraw some glyphs in front or following the glyph | 19039 | the row, redraw some glyphs in front or following the glyph |
| 18776 | strings built above. */ | 19040 | strings built above. */ |
| 18777 | if (head && !overlaps_p && row->contains_overlapping_glyphs_p) | 19041 | if (head && !overlaps && row->contains_overlapping_glyphs_p) |
| 18778 | { | 19042 | { |
| 18779 | int dummy_x = 0; | 19043 | int dummy_x = 0; |
| 18780 | struct glyph_string *h, *t; | 19044 | struct glyph_string *h, *t; |
| @@ -18867,7 +19131,7 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_p) | |||
| 18867 | /* When drawing overlapping rows, only the glyph strings' | 19131 | /* When drawing overlapping rows, only the glyph strings' |
| 18868 | foreground is drawn, which doesn't erase a cursor | 19132 | foreground is drawn, which doesn't erase a cursor |
| 18869 | completely. */ | 19133 | completely. */ |
| 18870 | && !overlaps_p) | 19134 | && !overlaps) |
| 18871 | { | 19135 | { |
| 18872 | int x0 = clip_head ? clip_head->x : (head ? head->x : x); | 19136 | int x0 = clip_head ? clip_head->x : (head ? head->x : x); |
| 18873 | int x1 = (clip_tail ? clip_tail->x + clip_tail->background_width | 19137 | int x1 = (clip_tail ? clip_tail->x + clip_tail->background_width |
| @@ -20600,13 +20864,15 @@ notice_overwritten_cursor (w, area, x0, x1, y0, y1) | |||
| 20600 | #ifdef HAVE_WINDOW_SYSTEM | 20864 | #ifdef HAVE_WINDOW_SYSTEM |
| 20601 | 20865 | ||
| 20602 | /* EXPORT for RIF: | 20866 | /* EXPORT for RIF: |
| 20603 | Fix the display of area AREA of overlapping row ROW in window W. */ | 20867 | Fix the display of area AREA of overlapping row ROW in window W |
| 20868 | with respect to the overlapping part OVERLAPS. */ | ||
| 20604 | 20869 | ||
| 20605 | void | 20870 | void |
| 20606 | x_fix_overlapping_area (w, row, area) | 20871 | x_fix_overlapping_area (w, row, area, overlaps) |
| 20607 | struct window *w; | 20872 | struct window *w; |
| 20608 | struct glyph_row *row; | 20873 | struct glyph_row *row; |
| 20609 | enum glyph_row_area area; | 20874 | enum glyph_row_area area; |
| 20875 | int overlaps; | ||
| 20610 | { | 20876 | { |
| 20611 | int i, x; | 20877 | int i, x; |
| 20612 | 20878 | ||
| @@ -20629,7 +20895,7 @@ x_fix_overlapping_area (w, row, area) | |||
| 20629 | 20895 | ||
| 20630 | draw_glyphs (w, start_x, row, area, | 20896 | draw_glyphs (w, start_x, row, area, |
| 20631 | start, i, | 20897 | start, i, |
| 20632 | DRAW_NORMAL_TEXT, 1); | 20898 | DRAW_NORMAL_TEXT, overlaps); |
| 20633 | } | 20899 | } |
| 20634 | else | 20900 | else |
| 20635 | { | 20901 | { |
| @@ -20671,13 +20937,17 @@ draw_phys_cursor_glyph (w, row, hl) | |||
| 20671 | are redrawn. */ | 20937 | are redrawn. */ |
| 20672 | else if (hl == DRAW_NORMAL_TEXT && row->overlapped_p) | 20938 | else if (hl == DRAW_NORMAL_TEXT && row->overlapped_p) |
| 20673 | { | 20939 | { |
| 20940 | w->phys_cursor_width = x1 - w->phys_cursor.x; | ||
| 20941 | |||
| 20674 | if (row > w->current_matrix->rows | 20942 | if (row > w->current_matrix->rows |
| 20675 | && MATRIX_ROW_OVERLAPS_SUCC_P (row - 1)) | 20943 | && MATRIX_ROW_OVERLAPS_SUCC_P (row - 1)) |
| 20676 | x_fix_overlapping_area (w, row - 1, TEXT_AREA); | 20944 | x_fix_overlapping_area (w, row - 1, TEXT_AREA, |
| 20945 | OVERLAPS_ERASED_CURSOR); | ||
| 20677 | 20946 | ||
| 20678 | if (MATRIX_ROW_BOTTOM_Y (row) < window_text_bottom_y (w) | 20947 | if (MATRIX_ROW_BOTTOM_Y (row) < window_text_bottom_y (w) |
| 20679 | && MATRIX_ROW_OVERLAPS_PRED_P (row + 1)) | 20948 | && MATRIX_ROW_OVERLAPS_PRED_P (row + 1)) |
| 20680 | x_fix_overlapping_area (w, row + 1, TEXT_AREA); | 20949 | x_fix_overlapping_area (w, row + 1, TEXT_AREA, |
| 20950 | OVERLAPS_ERASED_CURSOR); | ||
| 20681 | } | 20951 | } |
| 20682 | } | 20952 | } |
| 20683 | } | 20953 | } |
| @@ -22467,13 +22737,13 @@ expose_overlaps (w, first_overlapping_row, last_overlapping_row) | |||
| 22467 | xassert (row->enabled_p && !row->mode_line_p); | 22737 | xassert (row->enabled_p && !row->mode_line_p); |
| 22468 | 22738 | ||
| 22469 | if (row->used[LEFT_MARGIN_AREA]) | 22739 | if (row->used[LEFT_MARGIN_AREA]) |
| 22470 | x_fix_overlapping_area (w, row, LEFT_MARGIN_AREA); | 22740 | x_fix_overlapping_area (w, row, LEFT_MARGIN_AREA, OVERLAPS_BOTH); |
| 22471 | 22741 | ||
| 22472 | if (row->used[TEXT_AREA]) | 22742 | if (row->used[TEXT_AREA]) |
| 22473 | x_fix_overlapping_area (w, row, TEXT_AREA); | 22743 | x_fix_overlapping_area (w, row, TEXT_AREA, OVERLAPS_BOTH); |
| 22474 | 22744 | ||
| 22475 | if (row->used[RIGHT_MARGIN_AREA]) | 22745 | if (row->used[RIGHT_MARGIN_AREA]) |
| 22476 | x_fix_overlapping_area (w, row, RIGHT_MARGIN_AREA); | 22746 | x_fix_overlapping_area (w, row, RIGHT_MARGIN_AREA, OVERLAPS_BOTH); |
| 22477 | } | 22747 | } |
| 22478 | } | 22748 | } |
| 22479 | 22749 | ||
diff --git a/src/xfaces.c b/src/xfaces.c index 729d43ccd5f..4d9ee22b43f 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -793,7 +793,10 @@ x_create_gc (f, mask, xgcv) | |||
| 793 | XGCValues *xgcv; | 793 | XGCValues *xgcv; |
| 794 | { | 794 | { |
| 795 | GC gc; | 795 | GC gc; |
| 796 | BLOCK_INPUT; | ||
| 796 | gc = XCreateGC (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), mask, xgcv); | 797 | gc = XCreateGC (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), mask, xgcv); |
| 798 | UNBLOCK_INPUT; | ||
| 799 | IF_DEBUG (++ngcs); | ||
| 797 | return gc; | 800 | return gc; |
| 798 | } | 801 | } |
| 799 | 802 | ||
| @@ -802,7 +805,10 @@ x_free_gc (f, gc) | |||
| 802 | struct frame *f; | 805 | struct frame *f; |
| 803 | GC gc; | 806 | GC gc; |
| 804 | { | 807 | { |
| 808 | BLOCK_INPUT; | ||
| 809 | IF_DEBUG (xassert (--ngcs >= 0)); | ||
| 805 | XFreeGC (FRAME_MAC_DISPLAY (f), gc); | 810 | XFreeGC (FRAME_MAC_DISPLAY (f), gc); |
| 811 | UNBLOCK_INPUT; | ||
| 806 | } | 812 | } |
| 807 | 813 | ||
| 808 | #endif /* MAC_OS */ | 814 | #endif /* MAC_OS */ |
diff --git a/src/xfns.c b/src/xfns.c index 84521939ec2..47c146237a7 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -3294,7 +3294,7 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3294 | 3294 | ||
| 3295 | /* We need to do this after creating the X window, so that the | 3295 | /* We need to do this after creating the X window, so that the |
| 3296 | icon-creation functions can say whose icon they're describing. */ | 3296 | icon-creation functions can say whose icon they're describing. */ |
| 3297 | x_default_parameter (f, parms, Qicon_type, Qnil, | 3297 | x_default_parameter (f, parms, Qicon_type, Qt, |
| 3298 | "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL); | 3298 | "bitmapIcon", "BitmapIcon", RES_TYPE_SYMBOL); |
| 3299 | 3299 | ||
| 3300 | x_default_parameter (f, parms, Qauto_raise, Qnil, | 3300 | x_default_parameter (f, parms, Qauto_raise, Qnil, |
diff --git a/src/xterm.c b/src/xterm.c index 26f297f1024..30a43995a57 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -1310,7 +1310,7 @@ x_draw_glyph_string_foreground (s) | |||
| 1310 | XDrawImageString is usually faster than XDrawString.) Always | 1310 | XDrawImageString is usually faster than XDrawString.) Always |
| 1311 | use XDrawImageString when drawing the cursor so that there is | 1311 | use XDrawImageString when drawing the cursor so that there is |
| 1312 | no chance that characters under a box cursor are invisible. */ | 1312 | no chance that characters under a box cursor are invisible. */ |
| 1313 | if (s->for_overlaps_p | 1313 | if (s->for_overlaps |
| 1314 | || (s->background_filled_p && s->hl != DRAW_CURSOR)) | 1314 | || (s->background_filled_p && s->hl != DRAW_CURSOR)) |
| 1315 | { | 1315 | { |
| 1316 | /* Draw characters with 16-bit or 8-bit functions. */ | 1316 | /* Draw characters with 16-bit or 8-bit functions. */ |
| @@ -2616,7 +2616,7 @@ x_draw_glyph_string (s) | |||
| 2616 | /* If S draws into the background of its successor, draw the | 2616 | /* If S draws into the background of its successor, draw the |
| 2617 | background of the successor first so that S can draw into it. | 2617 | background of the successor first so that S can draw into it. |
| 2618 | This makes S->next use XDrawString instead of XDrawImageString. */ | 2618 | This makes S->next use XDrawString instead of XDrawImageString. */ |
| 2619 | if (s->next && s->right_overhang && !s->for_overlaps_p) | 2619 | if (s->next && s->right_overhang && !s->for_overlaps) |
| 2620 | { | 2620 | { |
| 2621 | xassert (s->next->img == NULL); | 2621 | xassert (s->next->img == NULL); |
| 2622 | x_set_glyph_string_gc (s->next); | 2622 | x_set_glyph_string_gc (s->next); |
| @@ -2629,7 +2629,7 @@ x_draw_glyph_string (s) | |||
| 2629 | 2629 | ||
| 2630 | /* Draw relief (if any) in advance for char/composition so that the | 2630 | /* Draw relief (if any) in advance for char/composition so that the |
| 2631 | glyph string can be drawn over it. */ | 2631 | glyph string can be drawn over it. */ |
| 2632 | if (!s->for_overlaps_p | 2632 | if (!s->for_overlaps |
| 2633 | && s->face->box != FACE_NO_BOX | 2633 | && s->face->box != FACE_NO_BOX |
| 2634 | && (s->first_glyph->type == CHAR_GLYPH | 2634 | && (s->first_glyph->type == CHAR_GLYPH |
| 2635 | || s->first_glyph->type == COMPOSITE_GLYPH)) | 2635 | || s->first_glyph->type == COMPOSITE_GLYPH)) |
| @@ -2655,7 +2655,7 @@ x_draw_glyph_string (s) | |||
| 2655 | break; | 2655 | break; |
| 2656 | 2656 | ||
| 2657 | case CHAR_GLYPH: | 2657 | case CHAR_GLYPH: |
| 2658 | if (s->for_overlaps_p) | 2658 | if (s->for_overlaps) |
| 2659 | s->background_filled_p = 1; | 2659 | s->background_filled_p = 1; |
| 2660 | else | 2660 | else |
| 2661 | x_draw_glyph_string_background (s, 0); | 2661 | x_draw_glyph_string_background (s, 0); |
| @@ -2663,7 +2663,7 @@ x_draw_glyph_string (s) | |||
| 2663 | break; | 2663 | break; |
| 2664 | 2664 | ||
| 2665 | case COMPOSITE_GLYPH: | 2665 | case COMPOSITE_GLYPH: |
| 2666 | if (s->for_overlaps_p || s->gidx > 0) | 2666 | if (s->for_overlaps || s->gidx > 0) |
| 2667 | s->background_filled_p = 1; | 2667 | s->background_filled_p = 1; |
| 2668 | else | 2668 | else |
| 2669 | x_draw_glyph_string_background (s, 1); | 2669 | x_draw_glyph_string_background (s, 1); |
| @@ -2674,7 +2674,7 @@ x_draw_glyph_string (s) | |||
| 2674 | abort (); | 2674 | abort (); |
| 2675 | } | 2675 | } |
| 2676 | 2676 | ||
| 2677 | if (!s->for_overlaps_p) | 2677 | if (!s->for_overlaps) |
| 2678 | { | 2678 | { |
| 2679 | /* Draw underline. */ | 2679 | /* Draw underline. */ |
| 2680 | if (s->face->underline_p) | 2680 | if (s->face->underline_p) |
| @@ -3613,6 +3613,8 @@ note_mouse_movement (frame, event) | |||
| 3613 | frame->mouse_moved = 1; | 3613 | frame->mouse_moved = 1; |
| 3614 | last_mouse_scroll_bar = Qnil; | 3614 | last_mouse_scroll_bar = Qnil; |
| 3615 | note_mouse_highlight (frame, event->x, event->y); | 3615 | note_mouse_highlight (frame, event->x, event->y); |
| 3616 | /* Remember which glyph we're now on. */ | ||
| 3617 | remember_mouse_glyph (frame, event->x, event->y, &last_mouse_glyph); | ||
| 3616 | } | 3618 | } |
| 3617 | } | 3619 | } |
| 3618 | 3620 | ||
| @@ -3632,56 +3634,6 @@ redo_mouse_highlight () | |||
| 3632 | } | 3634 | } |
| 3633 | 3635 | ||
| 3634 | 3636 | ||
| 3635 | static int glyph_rect P_ ((struct frame *f, int, int, XRectangle *)); | ||
| 3636 | |||
| 3637 | |||
| 3638 | /* Try to determine frame pixel position and size of the glyph under | ||
| 3639 | frame pixel coordinates X/Y on frame F . Return the position and | ||
| 3640 | size in *RECT. Value is non-zero if we could compute these | ||
| 3641 | values. */ | ||
| 3642 | |||
| 3643 | static int | ||
| 3644 | glyph_rect (f, x, y, rect) | ||
| 3645 | struct frame *f; | ||
| 3646 | int x, y; | ||
| 3647 | XRectangle *rect; | ||
| 3648 | { | ||
| 3649 | Lisp_Object window; | ||
| 3650 | struct window *w; | ||
| 3651 | struct glyph_row *r, *end_row; | ||
| 3652 | |||
| 3653 | window = window_from_coordinates (f, x, y, 0, &x, &y, 0); | ||
| 3654 | if (NILP (window)) | ||
| 3655 | return 0; | ||
| 3656 | |||
| 3657 | w = XWINDOW (window); | ||
| 3658 | r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | ||
| 3659 | end_row = r + w->current_matrix->nrows - 1; | ||
| 3660 | |||
| 3661 | for (; r < end_row && r->enabled_p; ++r) | ||
| 3662 | { | ||
| 3663 | if (r->y >= y) | ||
| 3664 | { | ||
| 3665 | struct glyph *g = r->glyphs[TEXT_AREA]; | ||
| 3666 | struct glyph *end = g + r->used[TEXT_AREA]; | ||
| 3667 | int gx = r->x; | ||
| 3668 | while (g < end && gx < x) | ||
| 3669 | gx += g->pixel_width, ++g; | ||
| 3670 | if (g < end) | ||
| 3671 | { | ||
| 3672 | rect->width = g->pixel_width; | ||
| 3673 | rect->height = r->height; | ||
| 3674 | rect->x = WINDOW_TO_FRAME_PIXEL_X (w, gx); | ||
| 3675 | rect->y = WINDOW_TO_FRAME_PIXEL_Y (w, r->y); | ||
| 3676 | return 1; | ||
| 3677 | } | ||
| 3678 | break; | ||
| 3679 | } | ||
| 3680 | } | ||
| 3681 | |||
| 3682 | return 0; | ||
| 3683 | } | ||
| 3684 | |||
| 3685 | 3637 | ||
| 3686 | /* Return the current position of the mouse. | 3638 | /* Return the current position of the mouse. |
| 3687 | *FP should be a frame which indicates which display to ask about. | 3639 | *FP should be a frame which indicates which display to ask about. |
| @@ -3870,32 +3822,7 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time) | |||
| 3870 | on it, i.e. into the same rectangles that matrices on | 3822 | on it, i.e. into the same rectangles that matrices on |
| 3871 | the frame are divided into. */ | 3823 | the frame are divided into. */ |
| 3872 | 3824 | ||
| 3873 | int width, height, gx, gy; | 3825 | remember_mouse_glyph (f1, win_x, win_y, &last_mouse_glyph); |
| 3874 | XRectangle rect; | ||
| 3875 | |||
| 3876 | if (glyph_rect (f1, win_x, win_y, &rect)) | ||
| 3877 | last_mouse_glyph = rect; | ||
| 3878 | else | ||
| 3879 | { | ||
| 3880 | width = FRAME_SMALLEST_CHAR_WIDTH (f1); | ||
| 3881 | height = FRAME_SMALLEST_FONT_HEIGHT (f1); | ||
| 3882 | gx = win_x; | ||
| 3883 | gy = win_y; | ||
| 3884 | |||
| 3885 | /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to | ||
| 3886 | round down even for negative values. */ | ||
| 3887 | if (gx < 0) | ||
| 3888 | gx -= width - 1; | ||
| 3889 | if (gy < 0) | ||
| 3890 | gy -= height - 1; | ||
| 3891 | gx = (gx + width - 1) / width * width; | ||
| 3892 | gy = (gy + height - 1) / height * height; | ||
| 3893 | |||
| 3894 | last_mouse_glyph.width = width; | ||
| 3895 | last_mouse_glyph.height = height; | ||
| 3896 | last_mouse_glyph.x = gx; | ||
| 3897 | last_mouse_glyph.y = gy; | ||
| 3898 | } | ||
| 3899 | 3826 | ||
| 3900 | *bar_window = Qnil; | 3827 | *bar_window = Qnil; |
| 3901 | *part = 0; | 3828 | *part = 0; |