diff options
| author | Jason Rumney | 2001-01-18 09:19:39 +0000 |
|---|---|---|
| committer | Jason Rumney | 2001-01-18 09:19:39 +0000 |
| commit | c2cc16fa2bbed0a5836b324279cace562df9b7d2 (patch) | |
| tree | da714b30323970f3d92cae948be3576b4eddba22 /src | |
| parent | 9be82109cf415740771cdd7207e76739cdbff5bd (diff) | |
| download | emacs-c2cc16fa2bbed0a5836b324279cace562df9b7d2.tar.gz emacs-c2cc16fa2bbed0a5836b324279cace562df9b7d2.zip | |
(x_produce_stretch_glyph): Only use Qspace when GLYPH_DEBUG is defined.
(x_produce_glyphs): Don't xassert `it->descent > 0'; this isn't
true for images with `:ascent 100'.
(x_set_mouse_face_gc): If the last used mouse face has gone in the
meantime, use face MOUSE_FACE_ID.
If first glyph isn't a character glyph, use the ASCII NUL
character to determine the face.
(expose_area): Do not treat left margin specially.
(note_mode_line_highlight): If no local_map, check global keymap.
(note_mouse_highlight): Initialize overlay.
(clear_mouse_face): Don't return if tip_frame is non-nil.
(show_scroll_bars): Remove unused function.
(w32_read_socket) [WM_KILLFOCUS]: Set help_echo to Qnil.
(x_draw_bar_cursor): Remove extra test for out of bounds cursor.
Clip to row.
(x_erase_phys_cursor): Don't apply XWINDOW to variable that may be nil.
(x_free_frame_resources): Unload relief colors.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 23 | ||||
| -rw-r--r-- | src/w32term.c | 501 |
2 files changed, 307 insertions, 217 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 52319b2c352..fd8ee2a6cb2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,26 @@ | |||
| 1 | 2001-01-18 Jason Rumney <jasonr@gnu.org> | ||
| 2 | |||
| 3 | * w32term.c (x_produce_stretch_glyph): Only use Qspace when | ||
| 4 | GLYPH_DEBUG is defined. | ||
| 5 | (x_produce_glyphs): Don't xassert `it->descent > 0'; this isn't | ||
| 6 | true for images with `:ascent 100'. | ||
| 7 | (x_set_mouse_face_gc): If the last used mouse face has gone in the | ||
| 8 | meantime, use face MOUSE_FACE_ID. | ||
| 9 | If first glyph isn't a character glyph, use the ASCII NUL | ||
| 10 | character to determine the face. | ||
| 11 | (expose_area): Do not treat left margin specially. | ||
| 12 | (note_mode_line_highlight): If no local_map, check global keymap. | ||
| 13 | (note_mouse_highlight): Initialize overlay. | ||
| 14 | (clear_mouse_face): Don't return if tip_frame is | ||
| 15 | non-nil. | ||
| 16 | (show_scroll_bars): Remove unused function. | ||
| 17 | (w32_read_socket) [WM_KILLFOCUS]: Set help_echo to Qnil. | ||
| 18 | (x_draw_bar_cursor): Remove extra test for out of bounds cursor. | ||
| 19 | Clip to row. | ||
| 20 | (x_erase_phys_cursor): Don't apply XWINDOW to variable that may be | ||
| 21 | nil. | ||
| 22 | (x_free_frame_resources): Unload relief colors. | ||
| 23 | |||
| 1 | 2001-01-17 Gerd Moellmann <gerd@gnu.org> | 24 | 2001-01-17 Gerd Moellmann <gerd@gnu.org> |
| 2 | 25 | ||
| 3 | * xdisp.c (forward_to_next_line_start): Avoid calling | 26 | * xdisp.c (forward_to_next_line_start): Avoid calling |
diff --git a/src/w32term.c b/src/w32term.c index 4f233ef4736..0af66377c76 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Implementation of GUI terminal on the Microsoft W32 API. | 1 | /* Implementation of GUI terminal on the Microsoft W32 API. |
| 2 | Copyright (C) 1989, 93, 94, 95, 96, 1997, 1998, 1999, 2000 | 2 | Copyright (C) 1989, 93, 94, 95, 96, 1997, 1998, 1999, 2000, 2001 |
| 3 | Free Software Foundation, Inc. | 3 | Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| @@ -56,10 +56,12 @@ Boston, MA 02111-1307, USA. */ | |||
| 56 | #include "composite.h" | 56 | #include "composite.h" |
| 57 | #include "coding.h" | 57 | #include "coding.h" |
| 58 | 58 | ||
| 59 | #undef min | 59 | #ifndef min |
| 60 | #undef max | 60 | #define min(a,b) ((a) < (b) ? (a) : (b)) |
| 61 | #define min(x, y) (((x) < (y)) ? (x) : (y)) | 61 | #endif |
| 62 | #define max(x, y) (((x) > (y)) ? (x) : (y)) | 62 | #ifndef max |
| 63 | #define max(a,b) ((a) > (b) ? (a) : (b)) | ||
| 64 | #endif | ||
| 63 | 65 | ||
| 64 | #define abs(x) ((x) < 0 ? -(x) : (x)) | 66 | #define abs(x) ((x) < 0 ? -(x) : (x)) |
| 65 | 67 | ||
| @@ -339,7 +341,6 @@ static void set_output_cursor P_ ((struct cursor_pos *)); | |||
| 339 | static struct glyph *x_y_to_hpos_vpos P_ ((struct window *, int, int, | 341 | static struct glyph *x_y_to_hpos_vpos P_ ((struct window *, int, int, |
| 340 | int *, int *, int *)); | 342 | int *, int *, int *)); |
| 341 | static void note_mode_line_highlight P_ ((struct window *, int, int)); | 343 | static void note_mode_line_highlight P_ ((struct window *, int, int)); |
| 342 | static void x_check_font P_ ((struct frame *, XFontStruct *)); | ||
| 343 | static void note_mouse_highlight P_ ((struct frame *, int, int)); | 344 | static void note_mouse_highlight P_ ((struct frame *, int, int)); |
| 344 | static void note_tool_bar_highlight P_ ((struct frame *f, int, int)); | 345 | static void note_tool_bar_highlight P_ ((struct frame *f, int, int)); |
| 345 | static void w32_handle_tool_bar_click P_ ((struct frame *, | 346 | static void w32_handle_tool_bar_click P_ ((struct frame *, |
| @@ -395,11 +396,11 @@ void x_display_cursor P_ ((struct window *w, int, int, int, int, int)); | |||
| 395 | void x_display_and_set_cursor P_ ((struct window *, int, int, int, int, int)); | 396 | void x_display_and_set_cursor P_ ((struct window *, int, int, int, int, int)); |
| 396 | static void w32_draw_bitmap P_ ((struct window *, HDC hdc, struct glyph_row *, | 397 | static void w32_draw_bitmap P_ ((struct window *, HDC hdc, struct glyph_row *, |
| 397 | enum bitmap_type)); | 398 | enum bitmap_type)); |
| 399 | static void w32_clip_to_row P_ ((struct window *, struct glyph_row *, | ||
| 400 | HDC, int)); | ||
| 398 | static int x_phys_cursor_in_rect_p P_ ((struct window *, RECT *)); | 401 | static int x_phys_cursor_in_rect_p P_ ((struct window *, RECT *)); |
| 399 | static void x_draw_row_bitmaps P_ ((struct window *, struct glyph_row *)); | 402 | static void x_draw_row_bitmaps P_ ((struct window *, struct glyph_row *)); |
| 400 | static void note_overwritten_text_cursor P_ ((struct window *, int, int)); | 403 | static void note_overwritten_text_cursor P_ ((struct window *, int, int)); |
| 401 | static void w32_clip_to_row P_ ((struct window *, struct glyph_row *, | ||
| 402 | HDC, int)); | ||
| 403 | 404 | ||
| 404 | static Lisp_Object Qvendor_specific_keysyms; | 405 | static Lisp_Object Qvendor_specific_keysyms; |
| 405 | 406 | ||
| @@ -690,6 +691,7 @@ x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p) | |||
| 690 | x_display_and_set_cursor (w, 1, output_cursor.hpos, | 691 | x_display_and_set_cursor (w, 1, output_cursor.hpos, |
| 691 | output_cursor.vpos, | 692 | output_cursor.vpos, |
| 692 | output_cursor.x, output_cursor.y); | 693 | output_cursor.x, output_cursor.y); |
| 694 | |||
| 693 | x_draw_vertical_border (w); | 695 | x_draw_vertical_border (w); |
| 694 | UNBLOCK_INPUT; | 696 | UNBLOCK_INPUT; |
| 695 | } | 697 | } |
| @@ -1006,6 +1008,7 @@ w32_reassert_line_highlight (new, vpos) | |||
| 1006 | abort (); | 1008 | abort (); |
| 1007 | } | 1009 | } |
| 1008 | 1010 | ||
| 1011 | |||
| 1009 | /* Call this when about to modify line at position VPOS and change | 1012 | /* Call this when about to modify line at position VPOS and change |
| 1010 | whether it is highlighted. Not used for W32 frames. Aborts when | 1013 | whether it is highlighted. Not used for W32 frames. Aborts when |
| 1011 | called. */ | 1014 | called. */ |
| @@ -1027,6 +1030,7 @@ x_change_line_highlight (new_highlight, vpos, y, first_unused_hpos) | |||
| 1027 | abort (); | 1030 | abort (); |
| 1028 | } | 1031 | } |
| 1029 | 1032 | ||
| 1033 | |||
| 1030 | /* This is called when starting Emacs and when restarting after | 1034 | /* This is called when starting Emacs and when restarting after |
| 1031 | suspend. When starting Emacs, no window is mapped. And nothing | 1035 | suspend. When starting Emacs, no window is mapped. And nothing |
| 1032 | must be done to Emacs's own window if it is suspended (though that | 1036 | must be done to Emacs's own window if it is suspended (though that |
| @@ -1831,7 +1835,10 @@ x_produce_stretch_glyph (it) | |||
| 1831 | struct it *it; | 1835 | struct it *it; |
| 1832 | { | 1836 | { |
| 1833 | /* (space :width WIDTH :height HEIGHT. */ | 1837 | /* (space :width WIDTH :height HEIGHT. */ |
| 1834 | extern Lisp_Object QCwidth, QCheight, QCascent, Qspace; | 1838 | #if GLYPH_DEBUG |
| 1839 | extern Lisp_Object Qspace; | ||
| 1840 | #endif | ||
| 1841 | extern Lisp_Object QCwidth, QCheight, QCascent; | ||
| 1835 | extern Lisp_Object QCrelative_width, QCrelative_height; | 1842 | extern Lisp_Object QCrelative_width, QCrelative_height; |
| 1836 | extern Lisp_Object QCalign_to; | 1843 | extern Lisp_Object QCalign_to; |
| 1837 | Lisp_Object prop, plist; | 1844 | Lisp_Object prop, plist; |
| @@ -2203,7 +2210,6 @@ x_produce_glyphs (it) | |||
| 2203 | it->nglyphs = 1; | 2210 | it->nglyphs = 1; |
| 2204 | it->ascent = FONT_BASE (font) + boff; | 2211 | it->ascent = FONT_BASE (font) + boff; |
| 2205 | it->descent = FONT_DESCENT (font) - boff; | 2212 | it->descent = FONT_DESCENT (font) - boff; |
| 2206 | |||
| 2207 | if (face->box != FACE_NO_BOX) | 2213 | if (face->box != FACE_NO_BOX) |
| 2208 | { | 2214 | { |
| 2209 | int thick = face->box_line_width; | 2215 | int thick = face->box_line_width; |
| @@ -2513,8 +2519,9 @@ x_produce_glyphs (it) | |||
| 2513 | else if (it->what == IT_STRETCH) | 2519 | else if (it->what == IT_STRETCH) |
| 2514 | x_produce_stretch_glyph (it); | 2520 | x_produce_stretch_glyph (it); |
| 2515 | 2521 | ||
| 2516 | /* Accumulate dimensions. */ | 2522 | /* Accumulate dimensions. Note: can't assume that it->descent > 0 |
| 2517 | xassert (it->ascent >= 0 && it->descent > 0); | 2523 | because this isn't true for images with `:ascent 100'. */ |
| 2524 | xassert (it->ascent >= 0 && it->descent >= 0); | ||
| 2518 | if (it->area == TEXT_AREA) | 2525 | if (it->area == TEXT_AREA) |
| 2519 | it->current_x += it->pixel_width; | 2526 | it->current_x += it->pixel_width; |
| 2520 | 2527 | ||
| @@ -2548,14 +2555,12 @@ x_estimate_mode_line_height (f, face_id) | |||
| 2548 | height = FONT_HEIGHT (face->font); | 2555 | height = FONT_HEIGHT (face->font); |
| 2549 | height += 2 * face->box_line_width; | 2556 | height += 2 * face->box_line_width; |
| 2550 | } | 2557 | } |
| 2551 | |||
| 2552 | } | 2558 | } |
| 2553 | 2559 | ||
| 2554 | return height; | 2560 | return height; |
| 2555 | } | 2561 | } |
| 2556 | 2562 | ||
| 2557 | 2563 | ||
| 2558 | |||
| 2559 | /*********************************************************************** | 2564 | /*********************************************************************** |
| 2560 | Glyph display | 2565 | Glyph display |
| 2561 | ***********************************************************************/ | 2566 | ***********************************************************************/ |
| @@ -2737,13 +2742,13 @@ static int x_left_overwritten P_ ((struct glyph_string *)); | |||
| 2737 | static int x_left_overwriting P_ ((struct glyph_string *)); | 2742 | static int x_left_overwriting P_ ((struct glyph_string *)); |
| 2738 | static int x_right_overwritten P_ ((struct glyph_string *)); | 2743 | static int x_right_overwritten P_ ((struct glyph_string *)); |
| 2739 | static int x_right_overwriting P_ ((struct glyph_string *)); | 2744 | static int x_right_overwriting P_ ((struct glyph_string *)); |
| 2740 | static int x_fill_glyph_string P_ ((struct glyph_string *, int, int, | 2745 | static int x_fill_glyph_string P_ ((struct glyph_string *, int, int, int, |
| 2741 | int, int)); | 2746 | int)); |
| 2742 | static void w32_init_glyph_string P_ ((struct glyph_string *, HDC hdc, | 2747 | static void w32_init_glyph_string P_ ((struct glyph_string *, HDC hdc, |
| 2743 | wchar_t *, struct window *, | 2748 | wchar_t *, struct window *, |
| 2744 | struct glyph_row *, | 2749 | struct glyph_row *, |
| 2745 | enum glyph_row_area, int, | 2750 | enum glyph_row_area, int, |
| 2746 | enum draw_glyphs_face)); | 2751 | enum draw_glyphs_face)); |
| 2747 | static int x_draw_glyphs P_ ((struct window *, int , struct glyph_row *, | 2752 | static int x_draw_glyphs P_ ((struct window *, int , struct glyph_row *, |
| 2748 | enum glyph_row_area, int, int, | 2753 | enum glyph_row_area, int, int, |
| 2749 | enum draw_glyphs_face, int *, int *, int)); | 2754 | enum draw_glyphs_face, int *, int *, int)); |
| @@ -2780,6 +2785,13 @@ static void w32_draw_box_rect P_ ((struct glyph_string *, int, int, int, int, | |||
| 2780 | int, int, int, RECT *)); | 2785 | int, int, int, RECT *)); |
| 2781 | static void x_fix_overlapping_area P_ ((struct window *, struct glyph_row *, | 2786 | static void x_fix_overlapping_area P_ ((struct window *, struct glyph_row *, |
| 2782 | enum glyph_row_area)); | 2787 | enum glyph_row_area)); |
| 2788 | static int x_fill_stretch_glyph_string P_ ((struct glyph_string *, | ||
| 2789 | struct glyph_row *, | ||
| 2790 | enum glyph_row_area, int, int)); | ||
| 2791 | |||
| 2792 | #if GLYPH_DEBUG | ||
| 2793 | static void x_check_font P_ ((struct frame *, XFontStruct *)); | ||
| 2794 | #endif | ||
| 2783 | 2795 | ||
| 2784 | 2796 | ||
| 2785 | /* Append the list of glyph strings with head H and tail T to the list | 2797 | /* Append the list of glyph strings with head H and tail T to the list |
| @@ -2898,10 +2910,16 @@ x_set_mouse_face_gc (s) | |||
| 2898 | int face_id; | 2910 | int face_id; |
| 2899 | struct face *face; | 2911 | struct face *face; |
| 2900 | 2912 | ||
| 2901 | /* What face has to be used for the mouse face? */ | 2913 | /* What face has to be used last for the mouse face? */ |
| 2902 | face_id = FRAME_W32_DISPLAY_INFO (s->f)->mouse_face_face_id; | 2914 | face_id = FRAME_W32_DISPLAY_INFO (s->f)->mouse_face_face_id; |
| 2903 | face = FACE_FROM_ID (s->f, face_id); | 2915 | face = FACE_FROM_ID (s->f, face_id); |
| 2904 | face_id = FACE_FOR_CHAR (s->f, face, s->first_glyph->u.ch); | 2916 | if (face == NULL) |
| 2917 | face = FACE_FROM_ID (s->f, MOUSE_FACE_ID); | ||
| 2918 | |||
| 2919 | if (s->first_glyph->type == CHAR_GLYPH) | ||
| 2920 | face_id = FACE_FOR_CHAR (s->f, face, s->first_glyph->u.ch); | ||
| 2921 | else | ||
| 2922 | face_id = FACE_FOR_CHAR (s->f, face, 0); | ||
| 2905 | s->face = FACE_FROM_ID (s->f, face_id); | 2923 | s->face = FACE_FROM_ID (s->f, face_id); |
| 2906 | PREPARE_FACE_FOR_DISPLAY (s->f, s->face); | 2924 | PREPARE_FACE_FOR_DISPLAY (s->f, s->face); |
| 2907 | 2925 | ||
| @@ -4088,8 +4106,8 @@ x_draw_image_glyph_string (s) | |||
| 4088 | flickering. */ | 4106 | flickering. */ |
| 4089 | s->stippled_p = s->face->stipple != 0; | 4107 | s->stippled_p = s->face->stipple != 0; |
| 4090 | if (height > s->img->height | 4108 | if (height > s->img->height |
| 4091 | || s->img->vmargin | ||
| 4092 | || s->img->hmargin | 4109 | || s->img->hmargin |
| 4110 | || s->img->vmargin | ||
| 4093 | #if 0 /* TODO: image mask */ | 4111 | #if 0 /* TODO: image mask */ |
| 4094 | || s->img->mask | 4112 | || s->img->mask |
| 4095 | #endif | 4113 | #endif |
| @@ -4105,9 +4123,9 @@ x_draw_image_glyph_string (s) | |||
| 4105 | #if 0 /* TODO: image mask */ | 4123 | #if 0 /* TODO: image mask */ |
| 4106 | if (s->img->mask) | 4124 | if (s->img->mask) |
| 4107 | { | 4125 | { |
| 4108 | /* Create a pixmap as large as the glyph string Fill it with | 4126 | /* Create a pixmap as large as the glyph string. Fill it |
| 4109 | the background color. Copy the image to it, using its | 4127 | with the background color. Copy the image to it, using |
| 4110 | mask. Copy the temporary pixmap to the display. */ | 4128 | its mask. Copy the temporary pixmap to the display. */ |
| 4111 | Screen *screen = FRAME_X_SCREEN (s->f); | 4129 | Screen *screen = FRAME_X_SCREEN (s->f); |
| 4112 | int depth = DefaultDepthOfScreen (screen); | 4130 | int depth = DefaultDepthOfScreen (screen); |
| 4113 | 4131 | ||
| @@ -4363,11 +4381,12 @@ static int x_fill_composite_glyph_string P_ ((struct glyph_string *, | |||
| 4363 | struct face **, int)); | 4381 | struct face **, int)); |
| 4364 | 4382 | ||
| 4365 | 4383 | ||
| 4366 | /* Load glyph string S with a composition components specified by S->cmp. | 4384 | /* Fill glyph string S with composition components specified by S->cmp. |
| 4385 | |||
| 4367 | FACES is an array of faces for all components of this composition. | 4386 | FACES is an array of faces for all components of this composition. |
| 4368 | S->gidx is the index of the first component for S. | 4387 | S->gidx is the index of the first component for S. |
| 4369 | OVERLAPS_P non-zero means S should draw the foreground only, and | 4388 | OVERLAPS_P non-zero means S should draw the foreground only, and |
| 4370 | use its lines physical height for clipping. | 4389 | use its physical height for clipping. |
| 4371 | 4390 | ||
| 4372 | Value is the index of a component not in S. */ | 4391 | Value is the index of a component not in S. */ |
| 4373 | 4392 | ||
| @@ -4421,11 +4440,12 @@ x_fill_composite_glyph_string (s, faces, overlaps_p) | |||
| 4421 | } | 4440 | } |
| 4422 | 4441 | ||
| 4423 | 4442 | ||
| 4424 | /* Load glyph string S with a sequence of characters. | 4443 | /* Fill glyph string S from a sequence of character glyphs. |
| 4444 | |||
| 4425 | FACE_ID is the face id of the string. START is the index of the | 4445 | FACE_ID is the face id of the string. START is the index of the |
| 4426 | first glyph to consider, END is the index of the last + 1. | 4446 | first glyph to consider, END is the index of the last + 1. |
| 4427 | OVERLAPS_P non-zero means S should draw the foreground only, and | 4447 | OVERLAPS_P non-zero means S should draw the foreground only, and |
| 4428 | use its lines physical height for clipping. | 4448 | use its physical height for clipping. |
| 4429 | 4449 | ||
| 4430 | Value is the index of the first glyph not in S. */ | 4450 | Value is the index of the first glyph not in S. */ |
| 4431 | 4451 | ||
| @@ -4847,7 +4867,6 @@ x_draw_glyphs (w, x, row, area, start, end, hl, real_start, real_end, | |||
| 4847 | end = min (end, row->used[area]); | 4867 | end = min (end, row->used[area]); |
| 4848 | start = max (0, start); | 4868 | start = max (0, start); |
| 4849 | start = min (end, start); | 4869 | start = min (end, start); |
| 4850 | |||
| 4851 | if (real_start) | 4870 | if (real_start) |
| 4852 | *real_start = start; | 4871 | *real_start = start; |
| 4853 | if (real_end) | 4872 | if (real_end) |
| @@ -5544,20 +5563,9 @@ expose_area (w, row, r, area) | |||
| 5544 | struct glyph *last; | 5563 | struct glyph *last; |
| 5545 | int first_x, start_x, x; | 5564 | int first_x, start_x, x; |
| 5546 | 5565 | ||
| 5547 | /* Set x to the window-relative start position for drawing glyphs of | ||
| 5548 | AREA. The first glyph of the text area can be partially visible. | ||
| 5549 | The first glyphs of other areas cannot. */ | ||
| 5550 | if (area == LEFT_MARGIN_AREA) | ||
| 5551 | x = 0; | ||
| 5552 | else if (area == TEXT_AREA) | ||
| 5553 | x = row->x + window_box_width (w, LEFT_MARGIN_AREA); | ||
| 5554 | else | ||
| 5555 | x = (window_box_width (w, LEFT_MARGIN_AREA) | ||
| 5556 | + window_box_width (w, TEXT_AREA)); | ||
| 5557 | |||
| 5558 | if (area == TEXT_AREA && row->fill_line_p) | 5566 | if (area == TEXT_AREA && row->fill_line_p) |
| 5559 | /* If row extends face to end of line write the whole line. */ | 5567 | /* If row extends face to end of line write the whole line. */ |
| 5560 | x_draw_glyphs (w, x, row, area, | 5568 | x_draw_glyphs (w, 0, row, area, |
| 5561 | 0, row->used[area], | 5569 | 0, row->used[area], |
| 5562 | row->inverse_p ? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT, | 5570 | row->inverse_p ? DRAW_INVERSE_VIDEO : DRAW_NORMAL_TEXT, |
| 5563 | NULL, NULL, 0); | 5571 | NULL, NULL, 0); |
| @@ -6158,7 +6166,6 @@ note_mouse_movement (frame, msg) | |||
| 6158 | { | 6166 | { |
| 6159 | frame->mouse_moved = 1; | 6167 | frame->mouse_moved = 1; |
| 6160 | last_mouse_scroll_bar = Qnil; | 6168 | last_mouse_scroll_bar = Qnil; |
| 6161 | |||
| 6162 | note_mouse_highlight (frame, LOWORD (msg->lParam), HIWORD (msg->lParam)); | 6169 | note_mouse_highlight (frame, LOWORD (msg->lParam), HIWORD (msg->lParam)); |
| 6163 | } | 6170 | } |
| 6164 | } | 6171 | } |
| @@ -6283,7 +6290,7 @@ frame_to_window_pixel_xy (w, x, y) | |||
| 6283 | } | 6290 | } |
| 6284 | 6291 | ||
| 6285 | 6292 | ||
| 6286 | /* Take proper action when mouse has moved to the mode or top line of | 6293 | /* Take proper action when mouse has moved to the mode or header line of |
| 6287 | window W, x-position X. MODE_LINE_P non-zero means mouse is on the | 6294 | window W, x-position X. MODE_LINE_P non-zero means mouse is on the |
| 6288 | mode line. X is relative to the start of the text display area of | 6295 | mode line. X is relative to the start of the text display area of |
| 6289 | W, so the width of bitmap areas and scroll bars must be subtracted | 6296 | W, so the width of bitmap areas and scroll bars must be subtracted |
| @@ -6315,6 +6322,7 @@ note_mode_line_highlight (w, x, mode_line_p) | |||
| 6315 | end = glyph + row->used[TEXT_AREA]; | 6322 | end = glyph + row->used[TEXT_AREA]; |
| 6316 | x0 = - (FRAME_LEFT_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f) | 6323 | x0 = - (FRAME_LEFT_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f) |
| 6317 | + FRAME_X_LEFT_FLAGS_AREA_WIDTH (f)); | 6324 | + FRAME_X_LEFT_FLAGS_AREA_WIDTH (f)); |
| 6325 | |||
| 6318 | while (glyph < end | 6326 | while (glyph < end |
| 6319 | && x >= x0 + glyph->pixel_width) | 6327 | && x >= x0 + glyph->pixel_width) |
| 6320 | { | 6328 | { |
| @@ -6346,6 +6354,13 @@ note_mode_line_highlight (w, x, mode_line_p) | |||
| 6346 | Qlocal_map, glyph->object); | 6354 | Qlocal_map, glyph->object); |
| 6347 | if (KEYMAPP (map)) | 6355 | if (KEYMAPP (map)) |
| 6348 | cursor = f->output_data.w32->nontext_cursor; | 6356 | cursor = f->output_data.w32->nontext_cursor; |
| 6357 | else | ||
| 6358 | { | ||
| 6359 | map = Fget_text_property (make_number (glyph->charpos), | ||
| 6360 | Qkeymap, glyph->object); | ||
| 6361 | if (KEYMAPP (map)) | ||
| 6362 | cursor = f->output_data.w32->nontext_cursor; | ||
| 6363 | } | ||
| 6349 | } | 6364 | } |
| 6350 | } | 6365 | } |
| 6351 | 6366 | ||
| @@ -6600,7 +6615,7 @@ note_mouse_highlight (f, x, y) | |||
| 6600 | Lisp_Object help, overlay; | 6615 | Lisp_Object help, overlay; |
| 6601 | 6616 | ||
| 6602 | /* Check overlays first. */ | 6617 | /* Check overlays first. */ |
| 6603 | help = Qnil; | 6618 | help = overlay = Qnil; |
| 6604 | for (i = noverlays - 1; i >= 0 && NILP (help); --i) | 6619 | for (i = noverlays - 1; i >= 0 && NILP (help); --i) |
| 6605 | { | 6620 | { |
| 6606 | overlay = overlay_vec[i]; | 6621 | overlay = overlay_vec[i]; |
| @@ -7073,8 +7088,11 @@ void | |||
| 7073 | clear_mouse_face (dpyinfo) | 7088 | clear_mouse_face (dpyinfo) |
| 7074 | struct w32_display_info *dpyinfo; | 7089 | struct w32_display_info *dpyinfo; |
| 7075 | { | 7090 | { |
| 7091 | #if 0 /* This prevents redrawing tool bar items when changing from one | ||
| 7092 | to another while a tooltip is open, so don't do it. */ | ||
| 7076 | if (!NILP (tip_frame)) | 7093 | if (!NILP (tip_frame)) |
| 7077 | return; | 7094 | return; |
| 7095 | #endif | ||
| 7078 | 7096 | ||
| 7079 | if (! NILP (dpyinfo->mouse_face_window)) | 7097 | if (! NILP (dpyinfo->mouse_face_window)) |
| 7080 | show_mouse_face (dpyinfo, DRAW_NORMAL_TEXT); | 7098 | show_mouse_face (dpyinfo, DRAW_NORMAL_TEXT); |
| @@ -7674,13 +7692,16 @@ w32_condemn_scroll_bars (frame) | |||
| 7674 | } | 7692 | } |
| 7675 | } | 7693 | } |
| 7676 | 7694 | ||
| 7695 | |||
| 7677 | /* Un-mark WINDOW's scroll bar for deletion in this judgment cycle. | 7696 | /* Un-mark WINDOW's scroll bar for deletion in this judgment cycle. |
| 7678 | Note that WINDOW isn't necessarily condemned at all. */ | 7697 | Note that WINDOW isn't necessarily condemned at all. */ |
| 7698 | |||
| 7679 | static void | 7699 | static void |
| 7680 | w32_redeem_scroll_bar (window) | 7700 | w32_redeem_scroll_bar (window) |
| 7681 | struct window *window; | 7701 | struct window *window; |
| 7682 | { | 7702 | { |
| 7683 | struct scroll_bar *bar; | 7703 | struct scroll_bar *bar; |
| 7704 | struct frame *f; | ||
| 7684 | 7705 | ||
| 7685 | /* We can't redeem this window's scroll bar if it doesn't have one. */ | 7706 | /* We can't redeem this window's scroll bar if it doesn't have one. */ |
| 7686 | if (NILP (window->vertical_scroll_bar)) | 7707 | if (NILP (window->vertical_scroll_bar)) |
| @@ -7689,36 +7710,33 @@ w32_redeem_scroll_bar (window) | |||
| 7689 | bar = XSCROLL_BAR (window->vertical_scroll_bar); | 7710 | bar = XSCROLL_BAR (window->vertical_scroll_bar); |
| 7690 | 7711 | ||
| 7691 | /* Unlink it from the condemned list. */ | 7712 | /* Unlink it from the condemned list. */ |
| 7692 | { | 7713 | f = XFRAME (WINDOW_FRAME (window)); |
| 7693 | FRAME_PTR f = XFRAME (WINDOW_FRAME (window)); | 7714 | if (NILP (bar->prev)) |
| 7694 | 7715 | { | |
| 7695 | if (NILP (bar->prev)) | 7716 | /* If the prev pointer is nil, it must be the first in one of |
| 7696 | { | 7717 | the lists. */ |
| 7697 | /* If the prev pointer is nil, it must be the first in one of | 7718 | if (EQ (FRAME_SCROLL_BARS (f), window->vertical_scroll_bar)) |
| 7698 | the lists. */ | 7719 | /* It's not condemned. Everything's fine. */ |
| 7699 | if (EQ (FRAME_SCROLL_BARS (f), window->vertical_scroll_bar)) | 7720 | return; |
| 7700 | /* It's not condemned. Everything's fine. */ | 7721 | else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), |
| 7701 | return; | 7722 | window->vertical_scroll_bar)) |
| 7702 | else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), | 7723 | FRAME_CONDEMNED_SCROLL_BARS (f) = bar->next; |
| 7703 | window->vertical_scroll_bar)) | 7724 | else |
| 7704 | FRAME_CONDEMNED_SCROLL_BARS (f) = bar->next; | 7725 | /* If its prev pointer is nil, it must be at the front of |
| 7705 | else | 7726 | one or the other! */ |
| 7706 | /* If its prev pointer is nil, it must be at the front of | 7727 | abort (); |
| 7707 | one or the other! */ | 7728 | } |
| 7708 | abort (); | 7729 | else |
| 7709 | } | 7730 | XSCROLL_BAR (bar->prev)->next = bar->next; |
| 7710 | else | ||
| 7711 | XSCROLL_BAR (bar->prev)->next = bar->next; | ||
| 7712 | 7731 | ||
| 7713 | if (! NILP (bar->next)) | 7732 | if (! NILP (bar->next)) |
| 7714 | XSCROLL_BAR (bar->next)->prev = bar->prev; | 7733 | XSCROLL_BAR (bar->next)->prev = bar->prev; |
| 7715 | 7734 | ||
| 7716 | bar->next = FRAME_SCROLL_BARS (f); | 7735 | bar->next = FRAME_SCROLL_BARS (f); |
| 7717 | bar->prev = Qnil; | 7736 | bar->prev = Qnil; |
| 7718 | XSETVECTOR (FRAME_SCROLL_BARS (f), bar); | 7737 | XSETVECTOR (FRAME_SCROLL_BARS (f), bar); |
| 7719 | if (! NILP (bar->next)) | 7738 | if (! NILP (bar->next)) |
| 7720 | XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); | 7739 | XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); |
| 7721 | } | ||
| 7722 | } | 7740 | } |
| 7723 | 7741 | ||
| 7724 | /* Remove all scroll bars on FRAME that haven't been saved since the | 7742 | /* Remove all scroll bars on FRAME that haven't been saved since the |
| @@ -7757,7 +7775,7 @@ w32_judge_scroll_bars (f) | |||
| 7757 | mark bits. */ | 7775 | mark bits. */ |
| 7758 | 7776 | ||
| 7759 | static int | 7777 | static int |
| 7760 | x_scroll_bar_handle_click (bar, msg, emacs_event) | 7778 | w32_scroll_bar_handle_click (bar, msg, emacs_event) |
| 7761 | struct scroll_bar *bar; | 7779 | struct scroll_bar *bar; |
| 7762 | W32Msg *msg; | 7780 | W32Msg *msg; |
| 7763 | struct input_event *emacs_event; | 7781 | struct input_event *emacs_event; |
| @@ -7976,20 +7994,6 @@ x_scroll_bar_clear (f) | |||
| 7976 | } | 7994 | } |
| 7977 | } | 7995 | } |
| 7978 | 7996 | ||
| 7979 | show_scroll_bars (f, how) | ||
| 7980 | FRAME_PTR f; | ||
| 7981 | int how; | ||
| 7982 | { | ||
| 7983 | Lisp_Object bar; | ||
| 7984 | |||
| 7985 | for (bar = FRAME_SCROLL_BARS (f); VECTORP (bar); | ||
| 7986 | bar = XSCROLL_BAR (bar)->next) | ||
| 7987 | { | ||
| 7988 | HWND window = SCROLL_BAR_W32_WINDOW (XSCROLL_BAR (bar)); | ||
| 7989 | my_show_window (f, window, how); | ||
| 7990 | } | ||
| 7991 | } | ||
| 7992 | |||
| 7993 | 7997 | ||
| 7994 | /* The main W32 event-reading loop - w32_read_socket. */ | 7998 | /* The main W32 event-reading loop - w32_read_socket. */ |
| 7995 | 7999 | ||
| @@ -8348,7 +8352,7 @@ w32_read_socket (sd, bufp, numchars, expected) | |||
| 8348 | 8352 | ||
| 8349 | if (bar && numchars >= 1) | 8353 | if (bar && numchars >= 1) |
| 8350 | { | 8354 | { |
| 8351 | if (x_scroll_bar_handle_click (bar, &msg, bufp)) | 8355 | if (w32_scroll_bar_handle_click (bar, &msg, bufp)) |
| 8352 | { | 8356 | { |
| 8353 | bufp++; | 8357 | bufp++; |
| 8354 | count++; | 8358 | count++; |
| @@ -8514,8 +8518,6 @@ w32_read_socket (sd, bufp, numchars, expected) | |||
| 8514 | 8518 | ||
| 8515 | if (f) | 8519 | if (f) |
| 8516 | { | 8520 | { |
| 8517 | Lisp_Object frame; | ||
| 8518 | |||
| 8519 | if (f == dpyinfo->w32_focus_event_frame) | 8521 | if (f == dpyinfo->w32_focus_event_frame) |
| 8520 | dpyinfo->w32_focus_event_frame = 0; | 8522 | dpyinfo->w32_focus_event_frame = 0; |
| 8521 | 8523 | ||
| @@ -8536,11 +8538,13 @@ w32_read_socket (sd, bufp, numchars, expected) | |||
| 8536 | the mouse leaves the frame. */ | 8538 | the mouse leaves the frame. */ |
| 8537 | if (any_help_event_p) | 8539 | if (any_help_event_p) |
| 8538 | { | 8540 | { |
| 8541 | Lisp_Object frame; | ||
| 8539 | int n; | 8542 | int n; |
| 8540 | 8543 | ||
| 8541 | XSETFRAME (frame, f); | 8544 | XSETFRAME (frame, f); |
| 8542 | n = gen_help_event (bufp, numchars, Qnil, frame, | 8545 | help_echo = Qnil; |
| 8543 | Qnil, Qnil, 0); | 8546 | n = gen_help_event (bufp, numchars, |
| 8547 | Qnil, frame, Qnil, Qnil, 0); | ||
| 8544 | bufp += n, count += n, numchars -=n; | 8548 | bufp += n, count += n, numchars -=n; |
| 8545 | } | 8549 | } |
| 8546 | } | 8550 | } |
| @@ -8831,45 +8835,41 @@ x_draw_bar_cursor (w, row, width) | |||
| 8831 | struct glyph_row *row; | 8835 | struct glyph_row *row; |
| 8832 | int width; | 8836 | int width; |
| 8833 | { | 8837 | { |
| 8834 | /* If cursor hpos is out of bounds, don't draw garbage. This can | 8838 | struct frame *f = XFRAME (w->frame); |
| 8835 | happen in mini-buffer windows when switching between echo area | 8839 | struct glyph *cursor_glyph; |
| 8836 | glyphs and mini-buffer. */ | 8840 | int x; |
| 8837 | if (w->phys_cursor.hpos < row->used[TEXT_AREA]) | 8841 | HDC hdc; |
| 8838 | { | ||
| 8839 | struct frame *f = XFRAME (w->frame); | ||
| 8840 | struct glyph *cursor_glyph; | ||
| 8841 | int x; | ||
| 8842 | HDC hdc; | ||
| 8843 | |||
| 8844 | cursor_glyph = get_phys_cursor_glyph (w); | ||
| 8845 | if (cursor_glyph == NULL) | ||
| 8846 | return; | ||
| 8847 | |||
| 8848 | /* If on an image, draw like a normal cursor. That's usually better | ||
| 8849 | visible than drawing a bar, esp. if the image is large so that | ||
| 8850 | the bar might not be in the window. */ | ||
| 8851 | if (cursor_glyph->type == IMAGE_GLYPH) | ||
| 8852 | { | ||
| 8853 | struct glyph_row *row; | ||
| 8854 | row = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos); | ||
| 8855 | x_draw_phys_cursor_glyph (w, row, DRAW_CURSOR); | ||
| 8856 | } | ||
| 8857 | else | ||
| 8858 | { | ||
| 8859 | 8842 | ||
| 8860 | x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); | 8843 | /* If cursor is out of bounds, don't draw garbage. This can happen |
| 8844 | in mini-buffer windows when switching between echo area glyphs | ||
| 8845 | and mini-buffer. */ | ||
| 8846 | cursor_glyph = get_phys_cursor_glyph (w); | ||
| 8847 | if (cursor_glyph == NULL) | ||
| 8848 | return; | ||
| 8861 | 8849 | ||
| 8862 | if (width < 0) | 8850 | /* If on an image, draw like a normal cursor. That's usually better |
| 8863 | width = f->output_data.w32->cursor_width; | 8851 | visible than drawing a bar, esp. if the image is large so that |
| 8852 | the bar might not be in the window. */ | ||
| 8853 | if (cursor_glyph->type == IMAGE_GLYPH) | ||
| 8854 | { | ||
| 8855 | struct glyph_row *row; | ||
| 8856 | row = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos); | ||
| 8857 | x_draw_phys_cursor_glyph (w, row, DRAW_CURSOR); | ||
| 8858 | } | ||
| 8859 | else | ||
| 8860 | { | ||
| 8861 | if (width < 0) | ||
| 8862 | width = f->output_data.w32->cursor_width; | ||
| 8864 | 8863 | ||
| 8865 | hdc = get_frame_dc (f); | 8864 | x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); |
| 8866 | w32_fill_area (f, hdc, f->output_data.w32->cursor_pixel, | 8865 | hdc = get_frame_dc (f); |
| 8867 | x, | 8866 | w32_clip_to_row (w, row, hdc, 0); |
| 8868 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), | 8867 | w32_fill_area (f, hdc, f->output_data.w32->cursor_pixel, |
| 8869 | min (cursor_glyph->pixel_width, width), | 8868 | x, |
| 8870 | row->height); | 8869 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y), |
| 8871 | release_frame_dc (f, hdc); | 8870 | min (cursor_glyph->pixel_width, width), |
| 8872 | } | 8871 | row->height); |
| 8872 | release_frame_dc (f, hdc); | ||
| 8873 | } | 8873 | } |
| 8874 | } | 8874 | } |
| 8875 | 8875 | ||
| @@ -8964,7 +8964,8 @@ x_erase_phys_cursor (w) | |||
| 8964 | 8964 | ||
| 8965 | /* If the cursor is in the mouse face area, redisplay that when | 8965 | /* If the cursor is in the mouse face area, redisplay that when |
| 8966 | we clear the cursor. */ | 8966 | we clear the cursor. */ |
| 8967 | if (w == XWINDOW (dpyinfo->mouse_face_window) | 8967 | if (! NILP (dpyinfo->mouse_face_window) |
| 8968 | && w == XWINDOW (dpyinfo->mouse_face_window) | ||
| 8968 | && (vpos > dpyinfo->mouse_face_beg_row | 8969 | && (vpos > dpyinfo->mouse_face_beg_row |
| 8969 | || (vpos == dpyinfo->mouse_face_beg_row | 8970 | || (vpos == dpyinfo->mouse_face_beg_row |
| 8970 | && hpos >= dpyinfo->mouse_face_beg_col)) | 8971 | && hpos >= dpyinfo->mouse_face_beg_col)) |
| @@ -9277,6 +9278,30 @@ x_bitmap_icon (f, icon) | |||
| 9277 | } | 9278 | } |
| 9278 | 9279 | ||
| 9279 | 9280 | ||
| 9281 | /************************************************************************ | ||
| 9282 | Handling X errors | ||
| 9283 | ************************************************************************/ | ||
| 9284 | |||
| 9285 | /* Display Error Handling functions not used on W32. Listing them here | ||
| 9286 | helps diff stay in step when comparing w32term.c with xterm.c. | ||
| 9287 | |||
| 9288 | x_error_catcher (display, error) | ||
| 9289 | x_catch_errors (dpy) | ||
| 9290 | x_catch_errors_unwind (old_val) | ||
| 9291 | x_check_errors (dpy, format) | ||
| 9292 | x_had_errors_p (dpy) | ||
| 9293 | x_clear_errors (dpy) | ||
| 9294 | x_uncatch_errors (dpy, count) | ||
| 9295 | x_trace_wire () | ||
| 9296 | x_connection_signal (signalnum) | ||
| 9297 | x_connection_closed (dpy, error_message) | ||
| 9298 | x_error_quitter (display, error) | ||
| 9299 | x_error_handler (display, error) | ||
| 9300 | x_io_error_quitter (display) | ||
| 9301 | |||
| 9302 | */ | ||
| 9303 | |||
| 9304 | |||
| 9280 | /* Changing the font of the frame. */ | 9305 | /* Changing the font of the frame. */ |
| 9281 | 9306 | ||
| 9282 | /* Give frame F the font named FONTNAME as its default font, and | 9307 | /* Give frame F the font named FONTNAME as its default font, and |
| @@ -9358,92 +9383,20 @@ x_new_fontset (f, fontsetname) | |||
| 9358 | return build_string (fontsetname); | 9383 | return build_string (fontsetname); |
| 9359 | } | 9384 | } |
| 9360 | 9385 | ||
| 9386 | |||
| 9387 | /*********************************************************************** | ||
| 9388 | TODO: W32 Input Methods | ||
| 9389 | ***********************************************************************/ | ||
| 9390 | /* Listing missing functions from xterm.c helps diff stay in step. | ||
| 9361 | 9391 | ||
| 9362 | #if GLYPH_DEBUG | 9392 | xim_destroy_callback (xim, client_data, call_data) |
| 9363 | 9393 | xim_open_dpy (dpyinfo, resource_name) | |
| 9364 | /* Check that FONT is valid on frame F. It is if it can be found in F's | 9394 | struct xim_inst_t |
| 9365 | font table. */ | 9395 | xim_instantiate_callback (display, client_data, call_data) |
| 9366 | 9396 | xim_initialize (dpyinfo, resource_name) | |
| 9367 | static void | 9397 | xim_close_dpy (dpyinfo) |
| 9368 | x_check_font (f, font) | ||
| 9369 | struct frame *f; | ||
| 9370 | XFontStruct *font; | ||
| 9371 | { | ||
| 9372 | int i; | ||
| 9373 | struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); | ||
| 9374 | |||
| 9375 | xassert (font != NULL); | ||
| 9376 | |||
| 9377 | for (i = 0; i < dpyinfo->n_fonts; i++) | ||
| 9378 | if (dpyinfo->font_table[i].name | ||
| 9379 | && font == dpyinfo->font_table[i].font) | ||
| 9380 | break; | ||
| 9381 | |||
| 9382 | xassert (i < dpyinfo->n_fonts); | ||
| 9383 | } | ||
| 9384 | |||
| 9385 | #endif /* GLYPH_DEBUG != 0 */ | ||
| 9386 | |||
| 9387 | /* Set *W to the minimum width, *H to the minimum font height of FONT. | ||
| 9388 | Note: There are (broken) X fonts out there with invalid XFontStruct | ||
| 9389 | min_bounds contents. For example, handa@etl.go.jp reports that | ||
| 9390 | "-adobe-courier-medium-r-normal--*-180-*-*-m-*-iso8859-1" fonts | ||
| 9391 | have font->min_bounds.width == 0. */ | ||
| 9392 | |||
| 9393 | static INLINE void | ||
| 9394 | x_font_min_bounds (font, w, h) | ||
| 9395 | XFontStruct *font; | ||
| 9396 | int *w, *h; | ||
| 9397 | { | ||
| 9398 | /* | ||
| 9399 | * TODO: Windows does not appear to offer min bound, only | ||
| 9400 | * average and maximum width, and maximum height. | ||
| 9401 | */ | ||
| 9402 | *h = FONT_HEIGHT (font); | ||
| 9403 | *w = FONT_WIDTH (font); | ||
| 9404 | } | ||
| 9405 | |||
| 9406 | |||
| 9407 | /* Compute the smallest character width and smallest font height over | ||
| 9408 | all fonts available on frame F. Set the members smallest_char_width | ||
| 9409 | and smallest_font_height in F's x_display_info structure to | ||
| 9410 | the values computed. Value is non-zero if smallest_font_height or | ||
| 9411 | smallest_char_width become smaller than they were before. */ | ||
| 9412 | |||
| 9413 | int | ||
| 9414 | x_compute_min_glyph_bounds (f) | ||
| 9415 | struct frame *f; | ||
| 9416 | { | ||
| 9417 | int i; | ||
| 9418 | struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); | ||
| 9419 | XFontStruct *font; | ||
| 9420 | int old_width = dpyinfo->smallest_char_width; | ||
| 9421 | int old_height = dpyinfo->smallest_font_height; | ||
| 9422 | |||
| 9423 | dpyinfo->smallest_font_height = 100000; | ||
| 9424 | dpyinfo->smallest_char_width = 100000; | ||
| 9425 | |||
| 9426 | for (i = 0; i < dpyinfo->n_fonts; ++i) | ||
| 9427 | if (dpyinfo->font_table[i].name) | ||
| 9428 | { | ||
| 9429 | struct font_info *fontp = dpyinfo->font_table + i; | ||
| 9430 | int w, h; | ||
| 9431 | |||
| 9432 | font = (XFontStruct *) fontp->font; | ||
| 9433 | xassert (font != (XFontStruct *) ~0); | ||
| 9434 | x_font_min_bounds (font, &w, &h); | ||
| 9435 | |||
| 9436 | dpyinfo->smallest_font_height = min (dpyinfo->smallest_font_height, h); | ||
| 9437 | dpyinfo->smallest_char_width = min (dpyinfo->smallest_char_width, w); | ||
| 9438 | } | ||
| 9439 | |||
| 9440 | xassert (dpyinfo->smallest_char_width > 0 | ||
| 9441 | && dpyinfo->smallest_font_height > 0); | ||
| 9442 | 9398 | ||
| 9443 | return (dpyinfo->n_fonts == 1 | 9399 | */ |
| 9444 | || dpyinfo->smallest_char_width < old_width | ||
| 9445 | || dpyinfo->smallest_font_height < old_height); | ||
| 9446 | } | ||
| 9447 | 9400 | ||
| 9448 | 9401 | ||
| 9449 | /* Calculate the absolute position in frame F | 9402 | /* Calculate the absolute position in frame F |
| @@ -9459,7 +9412,8 @@ x_calc_absolute_position (f) | |||
| 9459 | pt.x = pt.y = 0; | 9412 | pt.x = pt.y = 0; |
| 9460 | 9413 | ||
| 9461 | /* Find the position of the outside upper-left corner of | 9414 | /* Find the position of the outside upper-left corner of |
| 9462 | the inner window, with respect to the outer window. */ | 9415 | the inner window, with respect to the outer window. |
| 9416 | But do this only if we will need the results. */ | ||
| 9463 | if (f->output_data.w32->parent_desc != FRAME_W32_DISPLAY_INFO (f)->root_window) | 9417 | if (f->output_data.w32->parent_desc != FRAME_W32_DISPLAY_INFO (f)->root_window) |
| 9464 | { | 9418 | { |
| 9465 | BLOCK_INPUT; | 9419 | BLOCK_INPUT; |
| @@ -9546,6 +9500,7 @@ x_set_offset (f, xoff, yoff, change_gravity) | |||
| 9546 | If CHANGE_GRAVITY is 1, we change to top-left-corner window gravity | 9500 | If CHANGE_GRAVITY is 1, we change to top-left-corner window gravity |
| 9547 | for this size change and subsequent size changes. | 9501 | for this size change and subsequent size changes. |
| 9548 | Otherwise we leave the window gravity unchanged. */ | 9502 | Otherwise we leave the window gravity unchanged. */ |
| 9503 | |||
| 9549 | void | 9504 | void |
| 9550 | x_set_window_size (f, change_gravity, cols, rows) | 9505 | x_set_window_size (f, change_gravity, cols, rows) |
| 9551 | struct frame *f; | 9506 | struct frame *f; |
| @@ -9910,6 +9865,7 @@ x_iconify_frame (f) | |||
| 9910 | 9865 | ||
| 9911 | UNBLOCK_INPUT; | 9866 | UNBLOCK_INPUT; |
| 9912 | } | 9867 | } |
| 9868 | |||
| 9913 | 9869 | ||
| 9914 | /* Free X resources of frame F. */ | 9870 | /* Free X resources of frame F. */ |
| 9915 | 9871 | ||
| @@ -9932,7 +9888,11 @@ x_free_frame_resources (f) | |||
| 9932 | unload_color (f, f->output_data.w32->cursor_foreground_pixel); | 9888 | unload_color (f, f->output_data.w32->cursor_foreground_pixel); |
| 9933 | unload_color (f, f->output_data.w32->border_pixel); | 9889 | unload_color (f, f->output_data.w32->border_pixel); |
| 9934 | unload_color (f, f->output_data.w32->mouse_pixel); | 9890 | unload_color (f, f->output_data.w32->mouse_pixel); |
| 9935 | 9891 | if (f->output_data.w32->white_relief.allocated_p) | |
| 9892 | unload_color (f, f->output_data.w32->white_relief.pixel); | ||
| 9893 | if (f->output_data.w32->black_relief.allocated_p) | ||
| 9894 | unload_color (f, f->output_data.w32->black_relief.pixel); | ||
| 9895 | |||
| 9936 | if (FRAME_FACE_CACHE (f)) | 9896 | if (FRAME_FACE_CACHE (f)) |
| 9937 | free_frame_faces (f); | 9897 | free_frame_faces (f); |
| 9938 | 9898 | ||
| @@ -9972,6 +9932,7 @@ x_destroy_window (f) | |||
| 9972 | 9932 | ||
| 9973 | dpyinfo->reference_count--; | 9933 | dpyinfo->reference_count--; |
| 9974 | } | 9934 | } |
| 9935 | |||
| 9975 | 9936 | ||
| 9976 | /* Setting window manager hints. */ | 9937 | /* Setting window manager hints. */ |
| 9977 | 9938 | ||
| @@ -10014,7 +9975,113 @@ x_wm_set_icon_position (f, icon_x, icon_y) | |||
| 10014 | #endif | 9975 | #endif |
| 10015 | } | 9976 | } |
| 10016 | 9977 | ||
| 9978 | |||
| 9979 | /*********************************************************************** | ||
| 9980 | Fonts | ||
| 9981 | ***********************************************************************/ | ||
| 9982 | |||
| 9983 | /* The following functions are listed here to help diff stay in step | ||
| 9984 | with xterm.c. See w32fns.c for definitions. | ||
| 9985 | |||
| 9986 | x_get_font_info (f, font_idx) | ||
| 9987 | x_list_fonts (f, pattern, size, maxnames) | ||
| 9988 | |||
| 9989 | */ | ||
| 9990 | |||
| 9991 | #if GLYPH_DEBUG | ||
| 9992 | |||
| 9993 | /* Check that FONT is valid on frame F. It is if it can be found in F's | ||
| 9994 | font table. */ | ||
| 9995 | |||
| 9996 | static void | ||
| 9997 | x_check_font (f, font) | ||
| 9998 | struct frame *f; | ||
| 9999 | XFontStruct *font; | ||
| 10000 | { | ||
| 10001 | int i; | ||
| 10002 | struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); | ||
| 10003 | |||
| 10004 | xassert (font != NULL); | ||
| 10017 | 10005 | ||
| 10006 | for (i = 0; i < dpyinfo->n_fonts; i++) | ||
| 10007 | if (dpyinfo->font_table[i].name | ||
| 10008 | && font == dpyinfo->font_table[i].font) | ||
| 10009 | break; | ||
| 10010 | |||
| 10011 | xassert (i < dpyinfo->n_fonts); | ||
| 10012 | } | ||
| 10013 | |||
| 10014 | #endif /* GLYPH_DEBUG != 0 */ | ||
| 10015 | |||
| 10016 | /* Set *W to the minimum width, *H to the minimum font height of FONT. | ||
| 10017 | Note: There are (broken) X fonts out there with invalid XFontStruct | ||
| 10018 | min_bounds contents. For example, handa@etl.go.jp reports that | ||
| 10019 | "-adobe-courier-medium-r-normal--*-180-*-*-m-*-iso8859-1" fonts | ||
| 10020 | have font->min_bounds.width == 0. */ | ||
| 10021 | |||
| 10022 | static INLINE void | ||
| 10023 | x_font_min_bounds (font, w, h) | ||
| 10024 | XFontStruct *font; | ||
| 10025 | int *w, *h; | ||
| 10026 | { | ||
| 10027 | /* | ||
| 10028 | * TODO: Windows does not appear to offer min bound, only | ||
| 10029 | * average and maximum width, and maximum height. | ||
| 10030 | */ | ||
| 10031 | *h = FONT_HEIGHT (font); | ||
| 10032 | *w = FONT_WIDTH (font); | ||
| 10033 | } | ||
| 10034 | |||
| 10035 | |||
| 10036 | /* Compute the smallest character width and smallest font height over | ||
| 10037 | all fonts available on frame F. Set the members smallest_char_width | ||
| 10038 | and smallest_font_height in F's x_display_info structure to | ||
| 10039 | the values computed. Value is non-zero if smallest_font_height or | ||
| 10040 | smallest_char_width become smaller than they were before. */ | ||
| 10041 | |||
| 10042 | int | ||
| 10043 | x_compute_min_glyph_bounds (f) | ||
| 10044 | struct frame *f; | ||
| 10045 | { | ||
| 10046 | int i; | ||
| 10047 | struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); | ||
| 10048 | XFontStruct *font; | ||
| 10049 | int old_width = dpyinfo->smallest_char_width; | ||
| 10050 | int old_height = dpyinfo->smallest_font_height; | ||
| 10051 | |||
| 10052 | dpyinfo->smallest_font_height = 100000; | ||
| 10053 | dpyinfo->smallest_char_width = 100000; | ||
| 10054 | |||
| 10055 | for (i = 0; i < dpyinfo->n_fonts; ++i) | ||
| 10056 | if (dpyinfo->font_table[i].name) | ||
| 10057 | { | ||
| 10058 | struct font_info *fontp = dpyinfo->font_table + i; | ||
| 10059 | int w, h; | ||
| 10060 | |||
| 10061 | font = (XFontStruct *) fontp->font; | ||
| 10062 | xassert (font != (XFontStruct *) ~0); | ||
| 10063 | x_font_min_bounds (font, &w, &h); | ||
| 10064 | |||
| 10065 | dpyinfo->smallest_font_height = min (dpyinfo->smallest_font_height, h); | ||
| 10066 | dpyinfo->smallest_char_width = min (dpyinfo->smallest_char_width, w); | ||
| 10067 | } | ||
| 10068 | |||
| 10069 | xassert (dpyinfo->smallest_char_width > 0 | ||
| 10070 | && dpyinfo->smallest_font_height > 0); | ||
| 10071 | |||
| 10072 | return (dpyinfo->n_fonts == 1 | ||
| 10073 | || dpyinfo->smallest_char_width < old_width | ||
| 10074 | || dpyinfo->smallest_font_height < old_height); | ||
| 10075 | } | ||
| 10076 | |||
| 10077 | /* The following functions are listed here to help diff stay in step | ||
| 10078 | with xterm.c. See w32fns.c for definitions. | ||
| 10079 | |||
| 10080 | x_load_font (f, fontname, size) | ||
| 10081 | x_query_font (f, fontname) | ||
| 10082 | x_find_ccl_program (fontp) | ||
| 10083 | |||
| 10084 | */ | ||
| 10018 | 10085 | ||
| 10019 | /*********************************************************************** | 10086 | /*********************************************************************** |
| 10020 | Initialization | 10087 | Initialization |