diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 54 | ||||
| -rw-r--r-- | src/dispextern.h | 48 | ||||
| -rw-r--r-- | src/dispnew.c | 8 | ||||
| -rw-r--r-- | src/msdos.c | 596 | ||||
| -rw-r--r-- | src/msdos.h | 2 | ||||
| -rw-r--r-- | src/termchar.h | 23 | ||||
| -rw-r--r-- | src/xdisp.c | 89 | ||||
| -rw-r--r-- | src/xmenu.c | 5 |
8 files changed, 244 insertions, 581 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 2d46e42e17b..3dacd9a5e63 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,57 @@ | |||
| 1 | 2010-10-30 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * xdisp.c (coords_in_mouse_face_p): Move prototype out of the | ||
| 4 | HAVE_WINDOW_SYSTEM conditional. | ||
| 5 | (x_y_to_hpos_vpos, frame_to_window_pixel_xy): Move out of the | ||
| 6 | HAVE_WINDOW_SYSTEM block. | ||
| 7 | (try_window_id) [HAVE_GPM || MSDOS]: Call | ||
| 8 | x_clear_window_mouse_face. | ||
| 9 | (draw_row_with_mouse_face): Implementation for HAVE_WINDOW_SYSTEM | ||
| 10 | systems. | ||
| 11 | (show_mouse_face): Call it, instead of calling draw_glyphs directly. | ||
| 12 | (show_mouse_face, clear_mouse_face, coords_in_mouse_face_p) | ||
| 13 | (cursor_in_mouse_face_p, rows_from_pos_range) | ||
| 14 | (mouse_face_from_buffer_pos, mouse_face_from_string_pos) | ||
| 15 | (note_mode_line_or_margin_highlight, note_mouse_highlight) | ||
| 16 | (x_clear_window_mouse_face, cancel_mouse_face): Move out of the | ||
| 17 | HAVE_WINDOW_SYSTEM block. Ifdef away window-system specific | ||
| 18 | fragments. | ||
| 19 | (note_mouse_highlight): Call popup_activated for MSDOS as well. | ||
| 20 | Clear mouse highlight if pointer is over glyphs whose OBJECT is an | ||
| 21 | integer. | ||
| 22 | (mouse_face_from_buffer_pos): Add parentheses around && within ||. | ||
| 23 | |||
| 24 | * xmenu.c (popup_activated): Don't define on MSDOS. | ||
| 25 | |||
| 26 | * dispnew.c (mirror_make_current): Set Y coordinate of the | ||
| 27 | mode-line and header-line rows. | ||
| 28 | |||
| 29 | * termchar.h (struct tty_display_info): Define mouse_face_* | ||
| 30 | members not only for MSDOS. Delete stray whitespace. | ||
| 31 | <mouse_face_beg_x, mouse_face_beg_y, mouse_face_overlay>: New | ||
| 32 | struct members. | ||
| 33 | |||
| 34 | * dispextern.h (DPYINFO_DEFINED) [HAVE_X_WINDOWS]: Define. | ||
| 35 | (DPYINFO_DEFINED) [HAVE_NTGUI]: Define. | ||
| 36 | (DPYINFO_DEFINED) [HAVE_NS]: Define. | ||
| 37 | (Display_Info) [!DPYINFO_DEFINED]: Define here. | ||
| 38 | (FRAME_X_DISPLAY_INFO) [HAVE_GPM]: Define. | ||
| 39 | (FRAME_X_DISPLAY_INFO): Define to NULL if not defined. | ||
| 40 | (frame_to_window_pixel_xy, note_mouse_highlight) | ||
| 41 | (x_clear_window_mouse_face, cancel_mouse_face, clear_mouse_face) | ||
| 42 | (show_mouse_face, cursor_in_mouse_face_p): Move prototypes out of | ||
| 43 | HAVE_WINDOW_SYSTEM conditional. | ||
| 44 | (draw_row_with_mouse_face): Declare prototype. | ||
| 45 | |||
| 46 | * msdos.h (Display_Info): Don't define here. | ||
| 47 | |||
| 48 | * msdos.c (show_mouse_face, clear_mouse_face) | ||
| 49 | (fast_find_position, IT_note_mode_line_highlight) | ||
| 50 | (IT_note_mouse_highlight): Functions deleted. | ||
| 51 | (IT_frame_up_to_date, dos_rawgetc): Call note_mouse_highlight | ||
| 52 | instead of IT_note_mouse_highlight. | ||
| 53 | (draw_row_with_mouse_face, popup_activated): New functions. | ||
| 54 | |||
| 1 | 2010-10-29 Eli Zaretskii <eliz@gnu.org> | 55 | 2010-10-29 Eli Zaretskii <eliz@gnu.org> |
| 2 | 56 | ||
| 3 | * emacs.c (main): Call syms_of_filelock unconditionally. | 57 | * emacs.c (main): Call syms_of_filelock unconditionally. |
diff --git a/src/dispextern.h b/src/dispextern.h index 20e074d2393..c9006c8e57e 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -43,12 +43,9 @@ typedef struct { | |||
| 43 | 43 | ||
| 44 | #endif /* HAVE_X_WINDOWS */ | 44 | #endif /* HAVE_X_WINDOWS */ |
| 45 | 45 | ||
| 46 | #ifdef MSDOS | ||
| 47 | #include "msdos.h" | ||
| 48 | #endif | ||
| 49 | |||
| 50 | #ifdef HAVE_X_WINDOWS | 46 | #ifdef HAVE_X_WINDOWS |
| 51 | typedef struct x_display_info Display_Info; | 47 | typedef struct x_display_info Display_Info; |
| 48 | #define DPYINFO_DEFINED 1 | ||
| 52 | typedef XImage * XImagePtr; | 49 | typedef XImage * XImagePtr; |
| 53 | typedef XImagePtr XImagePtr_or_DC; | 50 | typedef XImagePtr XImagePtr_or_DC; |
| 54 | #define NativeRectangle XRectangle | 51 | #define NativeRectangle XRectangle |
| @@ -57,6 +54,7 @@ typedef XImagePtr XImagePtr_or_DC; | |||
| 57 | #ifdef HAVE_NTGUI | 54 | #ifdef HAVE_NTGUI |
| 58 | #include "w32gui.h" | 55 | #include "w32gui.h" |
| 59 | typedef struct w32_display_info Display_Info; | 56 | typedef struct w32_display_info Display_Info; |
| 57 | #define DPYINFO_DEFINED 1 | ||
| 60 | typedef XImage *XImagePtr; | 58 | typedef XImage *XImagePtr; |
| 61 | typedef HDC XImagePtr_or_DC; | 59 | typedef HDC XImagePtr_or_DC; |
| 62 | #endif | 60 | #endif |
| @@ -65,10 +63,32 @@ typedef HDC XImagePtr_or_DC; | |||
| 65 | #include "nsgui.h" | 63 | #include "nsgui.h" |
| 66 | /* following typedef needed to accomodate the MSDOS port, believe it or not */ | 64 | /* following typedef needed to accomodate the MSDOS port, believe it or not */ |
| 67 | typedef struct ns_display_info Display_Info; | 65 | typedef struct ns_display_info Display_Info; |
| 66 | #define DPYINFO_DEFINED 1 | ||
| 68 | typedef Pixmap XImagePtr; | 67 | typedef Pixmap XImagePtr; |
| 69 | typedef XImagePtr XImagePtr_or_DC; | 68 | typedef XImagePtr XImagePtr_or_DC; |
| 70 | #endif | 69 | #endif |
| 71 | 70 | ||
| 71 | #ifndef DPYINFO_DEFINED | ||
| 72 | typedef struct tty_display_info Display_Info; | ||
| 73 | typedef int Cursor; | ||
| 74 | #define No_Cursor (0) | ||
| 75 | #endif | ||
| 76 | |||
| 77 | #undef DPYINFO_DEFINED | ||
| 78 | |||
| 79 | #ifdef MSDOS | ||
| 80 | /* This defines FRAME_X_DISPLAY_INFO for MSDOS. */ | ||
| 81 | #include "msdos.h" | ||
| 82 | #endif | ||
| 83 | |||
| 84 | #ifdef HAVE_GPM | ||
| 85 | #define FRAME_X_DISPLAY_INFO(f) gpm_tty | ||
| 86 | #endif | ||
| 87 | |||
| 88 | #ifndef FRAME_X_DISPLAY_INFO | ||
| 89 | #define FRAME_X_DISPLAY_INFO(f) NULL | ||
| 90 | #endif | ||
| 91 | |||
| 72 | #ifndef NativeRectangle | 92 | #ifndef NativeRectangle |
| 73 | #define NativeRectangle int | 93 | #define NativeRectangle int |
| 74 | #endif | 94 | #endif |
| @@ -3017,28 +3037,30 @@ extern void x_update_cursor (struct frame *, int); | |||
| 3017 | extern void x_clear_cursor (struct window *); | 3037 | extern void x_clear_cursor (struct window *); |
| 3018 | extern void x_draw_vertical_border (struct window *w); | 3038 | extern void x_draw_vertical_border (struct window *w); |
| 3019 | 3039 | ||
| 3020 | extern void frame_to_window_pixel_xy (struct window *, int *, int *); | ||
| 3021 | extern int get_glyph_string_clip_rects (struct glyph_string *, | 3040 | extern int get_glyph_string_clip_rects (struct glyph_string *, |
| 3022 | NativeRectangle *, int); | 3041 | NativeRectangle *, int); |
| 3023 | extern void get_glyph_string_clip_rect (struct glyph_string *, | 3042 | extern void get_glyph_string_clip_rect (struct glyph_string *, |
| 3024 | NativeRectangle *nr); | 3043 | NativeRectangle *nr); |
| 3025 | extern Lisp_Object find_hot_spot (Lisp_Object, int, int); | 3044 | extern Lisp_Object find_hot_spot (Lisp_Object, int, int); |
| 3026 | extern void note_mouse_highlight (struct frame *, int, int); | ||
| 3027 | extern void x_clear_window_mouse_face (struct window *); | ||
| 3028 | extern void cancel_mouse_face (struct frame *); | ||
| 3029 | 3045 | ||
| 3030 | extern void handle_tool_bar_click (struct frame *, | 3046 | extern void handle_tool_bar_click (struct frame *, |
| 3031 | int, int, int, unsigned int); | 3047 | int, int, int, unsigned int); |
| 3032 | 3048 | ||
| 3033 | /* msdos.c defines its own versions of these functions. */ | 3049 | extern void expose_frame (struct frame *, int, int, int, int); |
| 3050 | extern int x_intersect_rectangles (XRectangle *, XRectangle *, | ||
| 3051 | XRectangle *); | ||
| 3052 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 3053 | |||
| 3054 | extern void frame_to_window_pixel_xy (struct window *, int *, int *); | ||
| 3055 | extern void note_mouse_highlight (struct frame *, int, int); | ||
| 3056 | extern void x_clear_window_mouse_face (struct window *); | ||
| 3057 | extern void cancel_mouse_face (struct frame *); | ||
| 3034 | extern int clear_mouse_face (Display_Info *); | 3058 | extern int clear_mouse_face (Display_Info *); |
| 3035 | extern void show_mouse_face (Display_Info *, enum draw_glyphs_face); | 3059 | extern void show_mouse_face (Display_Info *, enum draw_glyphs_face); |
| 3036 | extern int cursor_in_mouse_face_p (struct window *w); | 3060 | extern int cursor_in_mouse_face_p (struct window *w); |
| 3061 | extern void draw_row_with_mouse_face (struct window *, int, struct glyph_row *, | ||
| 3062 | int, int, enum draw_glyphs_face); | ||
| 3037 | 3063 | ||
| 3038 | extern void expose_frame (struct frame *, int, int, int, int); | ||
| 3039 | extern int x_intersect_rectangles (XRectangle *, XRectangle *, | ||
| 3040 | XRectangle *); | ||
| 3041 | #endif | ||
| 3042 | 3064 | ||
| 3043 | /* Flags passed to try_window. */ | 3065 | /* Flags passed to try_window. */ |
| 3044 | #define TRY_WINDOW_CHECK_MARGINS (1 << 0) | 3066 | #define TRY_WINDOW_CHECK_MARGINS (1 << 0) |
diff --git a/src/dispnew.c b/src/dispnew.c index 44dad60473d..deb42f47639 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -2893,6 +2893,14 @@ mirror_make_current (struct window *w, int frame_row) | |||
| 2893 | else | 2893 | else |
| 2894 | swap_glyph_pointers (desired_row, current_row); | 2894 | swap_glyph_pointers (desired_row, current_row); |
| 2895 | current_row->enabled_p = 1; | 2895 | current_row->enabled_p = 1; |
| 2896 | |||
| 2897 | /* Set the Y coordinate of the mode/header line's row. | ||
| 2898 | It is needed in draw_row_with_mouse_face to find the | ||
| 2899 | screen coordinates. (Window-based redisplay sets | ||
| 2900 | this in update_window, but no one seems to do that | ||
| 2901 | for frame-based redisplay.) */ | ||
| 2902 | if (current_row->mode_line_p) | ||
| 2903 | current_row->y = row; | ||
| 2896 | } | 2904 | } |
| 2897 | } | 2905 | } |
| 2898 | 2906 | ||
diff --git a/src/msdos.c b/src/msdos.c index 0957221f597..c676ed91a64 100644 --- a/src/msdos.c +++ b/src/msdos.c | |||
| @@ -941,551 +941,78 @@ static Lisp_Object last_mouse_window; | |||
| 941 | 941 | ||
| 942 | static int mouse_preempted = 0; /* non-zero when XMenu gobbles mouse events */ | 942 | static int mouse_preempted = 0; /* non-zero when XMenu gobbles mouse events */ |
| 943 | 943 | ||
| 944 | /* Set the mouse pointer shape according to whether it is in the | 944 | int |
| 945 | area where the mouse highlight is in effect. */ | 945 | popup_activated (void) |
| 946 | static void | ||
| 947 | IT_set_mouse_pointer (int mode) | ||
| 948 | { | 946 | { |
| 949 | /* A no-op for now. DOS text-mode mouse pointer doesn't offer too | 947 | return mouse_preempted; |
| 950 | many possibilities to change its shape, and the available | ||
| 951 | functionality pretty much sucks (e.g., almost every reasonable | ||
| 952 | shape will conceal the character it is on). Since the color of | ||
| 953 | the pointer changes in the highlighted area, it is not clear to | ||
| 954 | me whether anything else is required, anyway. */ | ||
| 955 | } | 948 | } |
| 956 | 949 | ||
| 957 | /* Display the active region described by mouse_face_* | 950 | /* Draw TEXT_AREA glyphs between START and END of glyph row ROW on |
| 958 | in its mouse-face if HL > 0, in its normal face if HL = 0. */ | 951 | window W, starting at x-position X. X is relative to TEXT_AREA |
| 959 | static void | 952 | in W. HL is a face override for drawing the glyphs. */ |
| 960 | show_mouse_face (struct tty_display_info *dpyinfo, int hl) | 953 | void |
| 954 | draw_row_with_mouse_face (struct window *w, int x, struct glyph_row *row, | ||
| 955 | int start_hpos, int end_hpos, | ||
| 956 | enum draw_glyphs_face hl) | ||
| 961 | { | 957 | { |
| 962 | struct window *w = XWINDOW (dpyinfo->mouse_face_window); | ||
| 963 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 958 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 964 | int i; | ||
| 965 | struct face *fp; | ||
| 966 | struct tty_display_info *tty = FRAME_TTY (f); | 959 | struct tty_display_info *tty = FRAME_TTY (f); |
| 967 | 960 | ||
| 968 | 961 | if (hl == DRAW_MOUSE_FACE) | |
| 969 | /* If window is in the process of being destroyed, don't bother | ||
| 970 | doing anything. */ | ||
| 971 | if (w->current_matrix == NULL) | ||
| 972 | goto set_cursor_shape; | ||
| 973 | |||
| 974 | /* Recognize when we are called to operate on rows that don't exist | ||
| 975 | anymore. This can happen when a window is split. */ | ||
| 976 | if (dpyinfo->mouse_face_end_row >= w->current_matrix->nrows) | ||
| 977 | goto set_cursor_shape; | ||
| 978 | |||
| 979 | /* There's no sense to do anything if the mouse face isn't realized. */ | ||
| 980 | if (hl > 0) | ||
| 981 | { | ||
| 982 | if (dpyinfo->mouse_face_hidden) | ||
| 983 | goto set_cursor_shape; | ||
| 984 | |||
| 985 | fp = FACE_FROM_ID (SELECTED_FRAME(), dpyinfo->mouse_face_face_id); | ||
| 986 | if (!fp) | ||
| 987 | goto set_cursor_shape; | ||
| 988 | } | ||
| 989 | |||
| 990 | /* Note that mouse_face_beg_row etc. are window relative. */ | ||
| 991 | for (i = dpyinfo->mouse_face_beg_row; | ||
| 992 | i <= dpyinfo->mouse_face_end_row; | ||
| 993 | i++) | ||
| 994 | { | 962 | { |
| 995 | int start_hpos, end_hpos; | 963 | int vpos = row->y + WINDOW_TOP_EDGE_Y (w); |
| 996 | struct glyph_row *row = MATRIX_ROW (w->current_matrix, i); | 964 | int kstart = start_hpos + WINDOW_LEFT_EDGE_X (w); |
| 997 | 965 | int nglyphs = end_hpos - start_hpos; | |
| 998 | /* Don't do anything if row doesn't have valid contents. */ | 966 | int offset = ScreenPrimary + 2*(vpos*screen_size_X + kstart) + 1; |
| 999 | if (!row->enabled_p) | 967 | int start_offset = offset; |
| 1000 | continue; | ||
| 1001 | 968 | ||
| 1002 | /* For all but the first row, the highlight starts at column 0. */ | 969 | if (tty->termscript) |
| 1003 | if (i == dpyinfo->mouse_face_beg_row) | 970 | fprintf (tty->termscript, "\n<MH+ %d-%d:%d>", |
| 1004 | start_hpos = dpyinfo->mouse_face_beg_col; | 971 | kstart, kstart + nglyphs - 1, vpos); |
| 1005 | else | ||
| 1006 | start_hpos = 0; | ||
| 1007 | |||
| 1008 | if (i == dpyinfo->mouse_face_end_row) | ||
| 1009 | end_hpos = dpyinfo->mouse_face_end_col; | ||
| 1010 | else | ||
| 1011 | end_hpos = row->used[TEXT_AREA]; | ||
| 1012 | |||
| 1013 | if (end_hpos <= start_hpos) | ||
| 1014 | continue; | ||
| 1015 | /* Record that some glyphs of this row are displayed in | ||
| 1016 | mouse-face. */ | ||
| 1017 | row->mouse_face_p = hl > 0; | ||
| 1018 | if (hl > 0) | ||
| 1019 | { | ||
| 1020 | int vpos = row->y + WINDOW_TOP_EDGE_Y (w); | ||
| 1021 | int kstart = start_hpos + WINDOW_LEFT_EDGE_X (w); | ||
| 1022 | int nglyphs = end_hpos - start_hpos; | ||
| 1023 | int offset = ScreenPrimary + 2*(vpos*screen_size_X + kstart) + 1; | ||
| 1024 | int start_offset = offset; | ||
| 1025 | |||
| 1026 | if (tty->termscript) | ||
| 1027 | fprintf (tty->termscript, "\n<MH+ %d-%d:%d>", | ||
| 1028 | kstart, kstart + nglyphs - 1, vpos); | ||
| 1029 | |||
| 1030 | mouse_off (); | ||
| 1031 | IT_set_face (dpyinfo->mouse_face_face_id); | ||
| 1032 | /* Since we are going to change only the _colors_ of the | ||
| 1033 | displayed text, there's no need to go through all the | ||
| 1034 | pain of generating and encoding the text from the glyphs. | ||
| 1035 | Instead, we simply poke the attribute byte of each | ||
| 1036 | affected position in video memory with the colors | ||
| 1037 | computed by IT_set_face! */ | ||
| 1038 | _farsetsel (_dos_ds); | ||
| 1039 | while (nglyphs--) | ||
| 1040 | { | ||
| 1041 | _farnspokeb (offset, ScreenAttrib); | ||
| 1042 | offset += 2; | ||
| 1043 | } | ||
| 1044 | if (screen_virtual_segment) | ||
| 1045 | dosv_refresh_virtual_screen (start_offset, end_hpos - start_hpos); | ||
| 1046 | mouse_on (); | ||
| 1047 | } | ||
| 1048 | else | ||
| 1049 | { | ||
| 1050 | /* We are removing a previously-drawn mouse highlight. The | ||
| 1051 | safest way to do so is to redraw the glyphs anew, since | ||
| 1052 | all kinds of faces and display tables could have changed | ||
| 1053 | behind our back. */ | ||
| 1054 | int nglyphs = end_hpos - start_hpos; | ||
| 1055 | int save_x = new_pos_X, save_y = new_pos_Y; | ||
| 1056 | |||
| 1057 | if (end_hpos >= row->used[TEXT_AREA]) | ||
| 1058 | nglyphs = row->used[TEXT_AREA] - start_hpos; | ||
| 1059 | |||
| 1060 | /* IT_write_glyphs writes at cursor position, so we need to | ||
| 1061 | temporarily move cursor coordinates to the beginning of | ||
| 1062 | the highlight region. */ | ||
| 1063 | new_pos_X = start_hpos + WINDOW_LEFT_EDGE_X (w); | ||
| 1064 | new_pos_Y = row->y + WINDOW_TOP_EDGE_Y (w); | ||
| 1065 | |||
| 1066 | if (tty->termscript) | ||
| 1067 | fprintf (tty->termscript, "<MH- %d-%d:%d>", | ||
| 1068 | new_pos_X, new_pos_X + nglyphs - 1, new_pos_Y); | ||
| 1069 | IT_write_glyphs (f, row->glyphs[TEXT_AREA] + start_hpos, nglyphs); | ||
| 1070 | if (tty->termscript) | ||
| 1071 | fputs ("\n", tty->termscript); | ||
| 1072 | new_pos_X = save_x; | ||
| 1073 | new_pos_Y = save_y; | ||
| 1074 | } | ||
| 1075 | } | ||
| 1076 | |||
| 1077 | set_cursor_shape: | ||
| 1078 | /* Change the mouse pointer shape. */ | ||
| 1079 | IT_set_mouse_pointer (hl); | ||
| 1080 | } | ||
| 1081 | |||
| 1082 | /* Clear out the mouse-highlighted active region. | ||
| 1083 | Redraw it un-highlighted first. */ | ||
| 1084 | static void | ||
| 1085 | clear_mouse_face (struct tty_display_info *dpyinfo) | ||
| 1086 | { | ||
| 1087 | if (!dpyinfo->mouse_face_hidden && ! NILP (dpyinfo->mouse_face_window)) | ||
| 1088 | show_mouse_face (dpyinfo, 0); | ||
| 1089 | |||
| 1090 | dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; | ||
| 1091 | dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; | ||
| 1092 | dpyinfo->mouse_face_window = Qnil; | ||
| 1093 | } | ||
| 1094 | |||
| 1095 | /* Find the glyph matrix position of buffer position POS in window W. | ||
| 1096 | *HPOS and *VPOS are set to the positions found. W's current glyphs | ||
| 1097 | must be up to date. If POS is above window start return (0, 0). | ||
| 1098 | If POS is after end of W, return end of last line in W. */ | ||
| 1099 | static int | ||
| 1100 | fast_find_position (struct window *w, int pos, int *hpos, int *vpos) | ||
| 1101 | { | ||
| 1102 | int i, lastcol, line_start_position, maybe_next_line_p = 0; | ||
| 1103 | int yb = window_text_bottom_y (w); | ||
| 1104 | struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0), *best_row = row; | ||
| 1105 | |||
| 1106 | while (row->y < yb) | ||
| 1107 | { | ||
| 1108 | if (row->used[TEXT_AREA]) | ||
| 1109 | line_start_position = row->glyphs[TEXT_AREA]->charpos; | ||
| 1110 | else | ||
| 1111 | line_start_position = 0; | ||
| 1112 | |||
| 1113 | if (line_start_position > pos) | ||
| 1114 | break; | ||
| 1115 | /* If the position sought is the end of the buffer, | ||
| 1116 | don't include the blank lines at the bottom of the window. */ | ||
| 1117 | else if (line_start_position == pos | ||
| 1118 | && pos == BUF_ZV (XBUFFER (w->buffer))) | ||
| 1119 | { | ||
| 1120 | maybe_next_line_p = 1; | ||
| 1121 | break; | ||
| 1122 | } | ||
| 1123 | else if (line_start_position > 0) | ||
| 1124 | best_row = row; | ||
| 1125 | |||
| 1126 | /* Don't overstep the last matrix row, lest we get into the | ||
| 1127 | never-never land... */ | ||
| 1128 | if (row->y + 1 >= yb) | ||
| 1129 | break; | ||
| 1130 | |||
| 1131 | ++row; | ||
| 1132 | } | ||
| 1133 | |||
| 1134 | /* Find the right column within BEST_ROW. */ | ||
| 1135 | lastcol = 0; | ||
| 1136 | row = best_row; | ||
| 1137 | for (i = 0; i < row->used[TEXT_AREA]; i++) | ||
| 1138 | { | ||
| 1139 | struct glyph *glyph = row->glyphs[TEXT_AREA] + i; | ||
| 1140 | int charpos; | ||
| 1141 | |||
| 1142 | charpos = glyph->charpos; | ||
| 1143 | if (charpos == pos) | ||
| 1144 | { | ||
| 1145 | *hpos = i; | ||
| 1146 | *vpos = row->y; | ||
| 1147 | return 1; | ||
| 1148 | } | ||
| 1149 | else if (charpos > pos) | ||
| 1150 | break; | ||
| 1151 | else if (charpos > 0) | ||
| 1152 | lastcol = i; | ||
| 1153 | } | ||
| 1154 | |||
| 1155 | /* If we're looking for the end of the buffer, | ||
| 1156 | and we didn't find it in the line we scanned, | ||
| 1157 | use the start of the following line. */ | ||
| 1158 | if (maybe_next_line_p) | ||
| 1159 | { | ||
| 1160 | ++row; | ||
| 1161 | lastcol = 0; | ||
| 1162 | } | ||
| 1163 | |||
| 1164 | *vpos = row->y; | ||
| 1165 | *hpos = lastcol + 1; | ||
| 1166 | return 0; | ||
| 1167 | } | ||
| 1168 | |||
| 1169 | /* Take proper action when mouse has moved to the mode or top line of | ||
| 1170 | window W, x-position X. MODE_LINE_P non-zero means mouse is on the | ||
| 1171 | mode line. X is relative to the start of the text display area of | ||
| 1172 | W, so the width of fringes and scroll bars must be subtracted | ||
| 1173 | to get a position relative to the start of the mode line. */ | ||
| 1174 | static void | ||
| 1175 | IT_note_mode_line_highlight (struct window *w, int x, int mode_line_p) | ||
| 1176 | { | ||
| 1177 | struct glyph_row *row; | ||
| 1178 | |||
| 1179 | if (mode_line_p) | ||
| 1180 | row = MATRIX_MODE_LINE_ROW (w->current_matrix); | ||
| 1181 | else | ||
| 1182 | row = MATRIX_HEADER_LINE_ROW (w->current_matrix); | ||
| 1183 | 972 | ||
| 1184 | if (row->enabled_p) | 973 | mouse_off (); |
| 1185 | { | 974 | IT_set_face (tty->mouse_face_face_id); |
| 1186 | struct glyph *glyph, *end; | 975 | /* Since we are going to change only the _colors_ of already |
| 1187 | Lisp_Object help; | 976 | displayed text, there's no need to go through all the pain of |
| 1188 | 977 | generating and encoding the text from the glyphs. Instead, | |
| 1189 | /* Find the glyph under X. */ | 978 | we simply poke the attribute byte of each affected position |
| 1190 | glyph = (row->glyphs[TEXT_AREA] | 979 | in video memory with the colors computed by IT_set_face! */ |
| 1191 | + x | 980 | _farsetsel (_dos_ds); |
| 1192 | /* in case someone implements scroll bars some day... */ | 981 | while (nglyphs--) |
| 1193 | - WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w)); | ||
| 1194 | end = glyph + row->used[TEXT_AREA]; | ||
| 1195 | if (glyph < end | ||
| 1196 | && STRINGP (glyph->object) | ||
| 1197 | && STRING_INTERVALS (glyph->object) | ||
| 1198 | && glyph->charpos >= 0 | ||
| 1199 | && glyph->charpos < SCHARS (glyph->object)) | ||
| 1200 | { | 982 | { |
| 1201 | /* If we're on a string with `help-echo' text property, | 983 | _farnspokeb (offset, ScreenAttrib); |
| 1202 | arrange for the help to be displayed. This is done by | 984 | offset += 2; |
| 1203 | setting the global variable help_echo to the help string. */ | ||
| 1204 | help = Fget_text_property (make_number (glyph->charpos), | ||
| 1205 | Qhelp_echo, glyph->object); | ||
| 1206 | if (!NILP (help)) | ||
| 1207 | { | ||
| 1208 | help_echo_string = help; | ||
| 1209 | XSETWINDOW (help_echo_window, w); | ||
| 1210 | help_echo_object = glyph->object; | ||
| 1211 | help_echo_pos = glyph->charpos; | ||
| 1212 | } | ||
| 1213 | } | 985 | } |
| 986 | if (screen_virtual_segment) | ||
| 987 | dosv_refresh_virtual_screen (start_offset, end_hpos - start_hpos); | ||
| 988 | mouse_on (); | ||
| 1214 | } | 989 | } |
| 1215 | } | 990 | else if (hl == DRAW_NORMAL_TEXT) |
| 1216 | |||
| 1217 | /* Take proper action when the mouse has moved to position X, Y on | ||
| 1218 | frame F as regards highlighting characters that have mouse-face | ||
| 1219 | properties. Also de-highlighting chars where the mouse was before. | ||
| 1220 | X and Y can be negative or out of range. */ | ||
| 1221 | static void | ||
| 1222 | IT_note_mouse_highlight (struct frame *f, int x, int y) | ||
| 1223 | { | ||
| 1224 | struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | ||
| 1225 | enum window_part part = ON_NOTHING; | ||
| 1226 | Lisp_Object window; | ||
| 1227 | struct window *w; | ||
| 1228 | |||
| 1229 | /* When a menu is active, don't highlight because this looks odd. */ | ||
| 1230 | if (mouse_preempted) | ||
| 1231 | return; | ||
| 1232 | |||
| 1233 | if (NILP (Vmouse_highlight) | ||
| 1234 | || !f->glyphs_initialized_p) | ||
| 1235 | return; | ||
| 1236 | |||
| 1237 | dpyinfo->mouse_face_mouse_x = x; | ||
| 1238 | dpyinfo->mouse_face_mouse_y = y; | ||
| 1239 | dpyinfo->mouse_face_mouse_frame = f; | ||
| 1240 | |||
| 1241 | if (dpyinfo->mouse_face_defer) | ||
| 1242 | return; | ||
| 1243 | |||
| 1244 | if (gc_in_progress) | ||
| 1245 | { | ||
| 1246 | dpyinfo->mouse_face_deferred_gc = 1; | ||
| 1247 | return; | ||
| 1248 | } | ||
| 1249 | |||
| 1250 | /* Which window is that in? */ | ||
| 1251 | window = window_from_coordinates (f, x, y, &part, &x, &y, 0); | ||
| 1252 | |||
| 1253 | /* If we were displaying active text in another window, clear that. */ | ||
| 1254 | if (! EQ (window, dpyinfo->mouse_face_window)) | ||
| 1255 | clear_mouse_face (dpyinfo); | ||
| 1256 | |||
| 1257 | /* Not on a window -> return. */ | ||
| 1258 | if (!WINDOWP (window)) | ||
| 1259 | return; | ||
| 1260 | |||
| 1261 | /* Convert to window-relative coordinates. */ | ||
| 1262 | w = XWINDOW (window); | ||
| 1263 | |||
| 1264 | if (part == ON_MODE_LINE || part == ON_HEADER_LINE) | ||
| 1265 | { | ||
| 1266 | /* Mouse is on the mode or top line. */ | ||
| 1267 | IT_note_mode_line_highlight (w, x, part == ON_MODE_LINE); | ||
| 1268 | return; | ||
| 1269 | } | ||
| 1270 | |||
| 1271 | IT_set_mouse_pointer (0); | ||
| 1272 | |||
| 1273 | /* Are we in a window whose display is up to date? | ||
| 1274 | And verify the buffer's text has not changed. */ | ||
| 1275 | if (part == ON_TEXT | ||
| 1276 | && EQ (w->window_end_valid, w->buffer) | ||
| 1277 | && XFASTINT (w->last_modified) == BUF_MODIFF (XBUFFER (w->buffer)) | ||
| 1278 | && (XFASTINT (w->last_overlay_modified) | ||
| 1279 | == BUF_OVERLAY_MODIFF (XBUFFER (w->buffer)))) | ||
| 1280 | { | 991 | { |
| 1281 | int pos, i, nrows = w->current_matrix->nrows; | 992 | /* We are removing a previously-drawn mouse highlight. The |
| 1282 | struct glyph_row *row; | 993 | safest way to do so is to redraw the glyphs anew, since all |
| 1283 | struct glyph *glyph; | 994 | kinds of faces and display tables could have changed behind |
| 995 | our back. */ | ||
| 996 | int nglyphs = end_hpos - start_hpos; | ||
| 997 | int save_x = new_pos_X, save_y = new_pos_Y; | ||
| 998 | |||
| 999 | if (end_hpos >= row->used[TEXT_AREA]) | ||
| 1000 | nglyphs = row->used[TEXT_AREA] - start_hpos; | ||
| 1001 | |||
| 1002 | /* IT_write_glyphs writes at cursor position, so we need to | ||
| 1003 | temporarily move cursor coordinates to the beginning of | ||
| 1004 | the highlight region. */ | ||
| 1005 | new_pos_X = start_hpos + WINDOW_LEFT_EDGE_X (w); | ||
| 1006 | new_pos_Y = row->y + WINDOW_TOP_EDGE_Y (w); | ||
| 1284 | 1007 | ||
| 1285 | /* Find the glyph under X/Y. */ | 1008 | if (tty->termscript) |
| 1286 | glyph = NULL; | 1009 | fprintf (tty->termscript, "<MH- %d-%d:%d>", |
| 1287 | if (y >= 0 && y < nrows) | 1010 | new_pos_X, new_pos_X + nglyphs - 1, new_pos_Y); |
| 1288 | { | 1011 | IT_write_glyphs (f, row->glyphs[TEXT_AREA] + start_hpos, nglyphs); |
| 1289 | row = MATRIX_ROW (w->current_matrix, y); | 1012 | if (tty->termscript) |
| 1290 | /* Give up if some row before the one we are looking for is | 1013 | fputs ("\n", tty->termscript); |
| 1291 | not enabled. */ | 1014 | new_pos_X = save_x; |
| 1292 | for (i = 0; i <= y; i++) | 1015 | new_pos_Y = save_y; |
| 1293 | if (!MATRIX_ROW (w->current_matrix, i)->enabled_p) | ||
| 1294 | break; | ||
| 1295 | if (i > y /* all rows upto and including the one at Y are enabled */ | ||
| 1296 | && row->displays_text_p | ||
| 1297 | && x < window_box_width (w, TEXT_AREA)) | ||
| 1298 | { | ||
| 1299 | glyph = row->glyphs[TEXT_AREA]; | ||
| 1300 | if (x >= row->used[TEXT_AREA]) | ||
| 1301 | glyph = NULL; | ||
| 1302 | else | ||
| 1303 | { | ||
| 1304 | glyph += x; | ||
| 1305 | if (!BUFFERP (glyph->object)) | ||
| 1306 | glyph = NULL; | ||
| 1307 | } | ||
| 1308 | } | ||
| 1309 | } | ||
| 1310 | |||
| 1311 | /* Clear mouse face if X/Y not over text. */ | ||
| 1312 | if (glyph == NULL) | ||
| 1313 | { | ||
| 1314 | clear_mouse_face (dpyinfo); | ||
| 1315 | return; | ||
| 1316 | } | ||
| 1317 | |||
| 1318 | if (!BUFFERP (glyph->object)) | ||
| 1319 | abort (); | ||
| 1320 | pos = glyph->charpos; | ||
| 1321 | |||
| 1322 | /* Check for mouse-face and help-echo. */ | ||
| 1323 | { | ||
| 1324 | Lisp_Object mouse_face, overlay, position, *overlay_vec; | ||
| 1325 | int noverlays, obegv, ozv; | ||
| 1326 | struct buffer *obuf; | ||
| 1327 | |||
| 1328 | /* If we get an out-of-range value, return now; avoid an error. */ | ||
| 1329 | if (pos > BUF_Z (XBUFFER (w->buffer))) | ||
| 1330 | return; | ||
| 1331 | |||
| 1332 | /* Make the window's buffer temporarily current for | ||
| 1333 | overlays_at and compute_char_face. */ | ||
| 1334 | obuf = current_buffer; | ||
| 1335 | current_buffer = XBUFFER (w->buffer); | ||
| 1336 | obegv = BEGV; | ||
| 1337 | ozv = ZV; | ||
| 1338 | BEGV = BEG; | ||
| 1339 | ZV = Z; | ||
| 1340 | |||
| 1341 | /* Is this char mouse-active or does it have help-echo? */ | ||
| 1342 | XSETINT (position, pos); | ||
| 1343 | |||
| 1344 | /* Put all the overlays we want in a vector in overlay_vec. */ | ||
| 1345 | GET_OVERLAYS_AT (pos, overlay_vec, noverlays, NULL, 0); | ||
| 1346 | /* Sort overlays into increasing priority order. */ | ||
| 1347 | noverlays = sort_overlays (overlay_vec, noverlays, w); | ||
| 1348 | |||
| 1349 | /* Check mouse-face highlighting. */ | ||
| 1350 | if (! (EQ (window, dpyinfo->mouse_face_window) | ||
| 1351 | && y >= dpyinfo->mouse_face_beg_row | ||
| 1352 | && y <= dpyinfo->mouse_face_end_row | ||
| 1353 | && (y > dpyinfo->mouse_face_beg_row | ||
| 1354 | || x >= dpyinfo->mouse_face_beg_col) | ||
| 1355 | && (y < dpyinfo->mouse_face_end_row | ||
| 1356 | || x < dpyinfo->mouse_face_end_col | ||
| 1357 | || dpyinfo->mouse_face_past_end))) | ||
| 1358 | { | ||
| 1359 | /* Clear the display of the old active region, if any. */ | ||
| 1360 | clear_mouse_face (dpyinfo); | ||
| 1361 | |||
| 1362 | /* Find highest priority overlay that has a mouse-face prop. */ | ||
| 1363 | overlay = Qnil; | ||
| 1364 | for (i = noverlays - 1; i >= 0; --i) | ||
| 1365 | { | ||
| 1366 | mouse_face = Foverlay_get (overlay_vec[i], Qmouse_face); | ||
| 1367 | if (!NILP (mouse_face)) | ||
| 1368 | { | ||
| 1369 | overlay = overlay_vec[i]; | ||
| 1370 | break; | ||
| 1371 | } | ||
| 1372 | } | ||
| 1373 | |||
| 1374 | /* If no overlay applies, get a text property. */ | ||
| 1375 | if (NILP (overlay)) | ||
| 1376 | mouse_face = Fget_text_property (position, Qmouse_face, | ||
| 1377 | w->buffer); | ||
| 1378 | |||
| 1379 | /* Handle the overlay case. */ | ||
| 1380 | if (! NILP (overlay)) | ||
| 1381 | { | ||
| 1382 | /* Find the range of text around this char that | ||
| 1383 | should be active. */ | ||
| 1384 | Lisp_Object before, after; | ||
| 1385 | EMACS_INT ignore; | ||
| 1386 | |||
| 1387 | before = Foverlay_start (overlay); | ||
| 1388 | after = Foverlay_end (overlay); | ||
| 1389 | /* Record this as the current active region. */ | ||
| 1390 | fast_find_position (w, XFASTINT (before), | ||
| 1391 | &dpyinfo->mouse_face_beg_col, | ||
| 1392 | &dpyinfo->mouse_face_beg_row); | ||
| 1393 | dpyinfo->mouse_face_past_end | ||
| 1394 | = !fast_find_position (w, XFASTINT (after), | ||
| 1395 | &dpyinfo->mouse_face_end_col, | ||
| 1396 | &dpyinfo->mouse_face_end_row); | ||
| 1397 | dpyinfo->mouse_face_window = window; | ||
| 1398 | dpyinfo->mouse_face_face_id | ||
| 1399 | = face_at_buffer_position (w, pos, 0, 0, | ||
| 1400 | &ignore, pos + 1, | ||
| 1401 | !dpyinfo->mouse_face_hidden, | ||
| 1402 | -1); | ||
| 1403 | |||
| 1404 | /* Display it as active. */ | ||
| 1405 | show_mouse_face (dpyinfo, 1); | ||
| 1406 | } | ||
| 1407 | /* Handle the text property case. */ | ||
| 1408 | else if (! NILP (mouse_face)) | ||
| 1409 | { | ||
| 1410 | /* Find the range of text around this char that | ||
| 1411 | should be active. */ | ||
| 1412 | Lisp_Object before, after, beginning, end; | ||
| 1413 | EMACS_INT ignore; | ||
| 1414 | |||
| 1415 | beginning = Fmarker_position (w->start); | ||
| 1416 | XSETINT (end, (BUF_Z (XBUFFER (w->buffer)) | ||
| 1417 | - XFASTINT (w->window_end_pos))); | ||
| 1418 | before | ||
| 1419 | = Fprevious_single_property_change (make_number (pos + 1), | ||
| 1420 | Qmouse_face, | ||
| 1421 | w->buffer, beginning); | ||
| 1422 | after | ||
| 1423 | = Fnext_single_property_change (position, Qmouse_face, | ||
| 1424 | w->buffer, end); | ||
| 1425 | /* Record this as the current active region. */ | ||
| 1426 | fast_find_position (w, XFASTINT (before), | ||
| 1427 | &dpyinfo->mouse_face_beg_col, | ||
| 1428 | &dpyinfo->mouse_face_beg_row); | ||
| 1429 | dpyinfo->mouse_face_past_end | ||
| 1430 | = !fast_find_position (w, XFASTINT (after), | ||
| 1431 | &dpyinfo->mouse_face_end_col, | ||
| 1432 | &dpyinfo->mouse_face_end_row); | ||
| 1433 | dpyinfo->mouse_face_window = window; | ||
| 1434 | dpyinfo->mouse_face_face_id | ||
| 1435 | = face_at_buffer_position (w, pos, 0, 0, | ||
| 1436 | &ignore, pos + 1, | ||
| 1437 | !dpyinfo->mouse_face_hidden, | ||
| 1438 | -1); | ||
| 1439 | |||
| 1440 | /* Display it as active. */ | ||
| 1441 | show_mouse_face (dpyinfo, 1); | ||
| 1442 | } | ||
| 1443 | } | ||
| 1444 | |||
| 1445 | /* Look for a `help-echo' property. */ | ||
| 1446 | { | ||
| 1447 | Lisp_Object help; | ||
| 1448 | |||
| 1449 | /* Check overlays first. */ | ||
| 1450 | help = Qnil; | ||
| 1451 | for (i = noverlays - 1; i >= 0 && NILP (help); --i) | ||
| 1452 | { | ||
| 1453 | overlay = overlay_vec[i]; | ||
| 1454 | help = Foverlay_get (overlay, Qhelp_echo); | ||
| 1455 | } | ||
| 1456 | |||
| 1457 | if (!NILP (help)) | ||
| 1458 | { | ||
| 1459 | help_echo_string = help; | ||
| 1460 | help_echo_window = window; | ||
| 1461 | help_echo_object = overlay; | ||
| 1462 | help_echo_pos = pos; | ||
| 1463 | } | ||
| 1464 | /* Try text properties. */ | ||
| 1465 | else if (NILP (help) | ||
| 1466 | && ((STRINGP (glyph->object) | ||
| 1467 | && glyph->charpos >= 0 | ||
| 1468 | && glyph->charpos < SCHARS (glyph->object)) | ||
| 1469 | || (BUFFERP (glyph->object) | ||
| 1470 | && glyph->charpos >= BEGV | ||
| 1471 | && glyph->charpos < ZV))) | ||
| 1472 | { | ||
| 1473 | help = Fget_text_property (make_number (glyph->charpos), | ||
| 1474 | Qhelp_echo, glyph->object); | ||
| 1475 | if (!NILP (help)) | ||
| 1476 | { | ||
| 1477 | help_echo_string = help; | ||
| 1478 | help_echo_window = window; | ||
| 1479 | help_echo_object = glyph->object; | ||
| 1480 | help_echo_pos = glyph->charpos; | ||
| 1481 | } | ||
| 1482 | } | ||
| 1483 | } | ||
| 1484 | |||
| 1485 | BEGV = obegv; | ||
| 1486 | ZV = ozv; | ||
| 1487 | current_buffer = obuf; | ||
| 1488 | } | ||
| 1489 | } | 1016 | } |
| 1490 | } | 1017 | } |
| 1491 | 1018 | ||
| @@ -1769,9 +1296,9 @@ IT_frame_up_to_date (struct frame *f) | |||
| 1769 | { | 1296 | { |
| 1770 | BLOCK_INPUT; | 1297 | BLOCK_INPUT; |
| 1771 | if (dpyinfo->mouse_face_mouse_frame) | 1298 | if (dpyinfo->mouse_face_mouse_frame) |
| 1772 | IT_note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, | 1299 | note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, |
| 1773 | dpyinfo->mouse_face_mouse_x, | 1300 | dpyinfo->mouse_face_mouse_x, |
| 1774 | dpyinfo->mouse_face_mouse_y); | 1301 | dpyinfo->mouse_face_mouse_y); |
| 1775 | dpyinfo->mouse_face_deferred_gc = 0; | 1302 | dpyinfo->mouse_face_deferred_gc = 0; |
| 1776 | UNBLOCK_INPUT; | 1303 | UNBLOCK_INPUT; |
| 1777 | } | 1304 | } |
| @@ -3192,8 +2719,7 @@ dos_rawgetc (void) | |||
| 3192 | previous_help_echo_string = help_echo_string; | 2719 | previous_help_echo_string = help_echo_string; |
| 3193 | help_echo_string = help_echo_object = help_echo_window = Qnil; | 2720 | help_echo_string = help_echo_object = help_echo_window = Qnil; |
| 3194 | help_echo_pos = -1; | 2721 | help_echo_pos = -1; |
| 3195 | IT_note_mouse_highlight (SELECTED_FRAME(), | 2722 | note_mouse_highlight (SELECTED_FRAME(), mouse_last_x, mouse_last_y); |
| 3196 | mouse_last_x, mouse_last_y); | ||
| 3197 | /* If the contents of the global variable help_echo has | 2723 | /* If the contents of the global variable help_echo has |
| 3198 | changed, generate a HELP_EVENT. */ | 2724 | changed, generate a HELP_EVENT. */ |
| 3199 | if (!NILP (help_echo_string) || !NILP (previous_help_echo_string)) | 2725 | if (!NILP (help_echo_string) || !NILP (previous_help_echo_string)) |
diff --git a/src/msdos.h b/src/msdos.h index fe9964af25e..7b50abe31e1 100644 --- a/src/msdos.h +++ b/src/msdos.h | |||
| @@ -52,8 +52,6 @@ typedef int XRectangle; | |||
| 52 | #define PIX_TYPE unsigned long | 52 | #define PIX_TYPE unsigned long |
| 53 | #define XDISPLAY | 53 | #define XDISPLAY |
| 54 | 54 | ||
| 55 | typedef struct tty_display_info Display_Info; | ||
| 56 | |||
| 57 | extern struct tty_display_info the_only_display_info; | 55 | extern struct tty_display_info the_only_display_info; |
| 58 | 56 | ||
| 59 | #define FRAME_X_DISPLAY(f) ((Display *) 0) | 57 | #define FRAME_X_DISPLAY(f) ((Display *) 0) |
diff --git a/src/termchar.h b/src/termchar.h index 8135ac723e5..1b4cd0891da 100644 --- a/src/termchar.h +++ b/src/termchar.h | |||
| @@ -34,18 +34,18 @@ struct tty_output | |||
| 34 | struct tty_display_info | 34 | struct tty_display_info |
| 35 | { | 35 | { |
| 36 | struct tty_display_info *next; /* Chain of all tty devices. */ | 36 | struct tty_display_info *next; /* Chain of all tty devices. */ |
| 37 | 37 | ||
| 38 | char *name; /* The name of the device file or 0 if | 38 | char *name; /* The name of the device file or 0 if |
| 39 | stdin/stdout. */ | 39 | stdin/stdout. */ |
| 40 | char *type; /* The type of the tty. */ | 40 | char *type; /* The type of the tty. */ |
| 41 | 41 | ||
| 42 | /* Input/output */ | 42 | /* Input/output */ |
| 43 | 43 | ||
| 44 | FILE *input; /* The stream to be used for terminal input. | 44 | FILE *input; /* The stream to be used for terminal input. |
| 45 | NULL if the terminal is suspended. */ | 45 | NULL if the terminal is suspended. */ |
| 46 | FILE *output; /* The stream to be used for terminal output. | 46 | FILE *output; /* The stream to be used for terminal output. |
| 47 | NULL if the terminal is suspended. */ | 47 | NULL if the terminal is suspended. */ |
| 48 | 48 | ||
| 49 | FILE *termscript; /* If nonzero, send all terminal output | 49 | FILE *termscript; /* If nonzero, send all terminal output |
| 50 | characters to this stream also. */ | 50 | characters to this stream also. */ |
| 51 | 51 | ||
| @@ -65,22 +65,24 @@ struct tty_display_info | |||
| 65 | /* Redisplay. */ | 65 | /* Redisplay. */ |
| 66 | 66 | ||
| 67 | Lisp_Object top_frame; /* The topmost frame on this tty. */ | 67 | Lisp_Object top_frame; /* The topmost frame on this tty. */ |
| 68 | 68 | ||
| 69 | /* The previous frame we displayed on this tty. */ | 69 | /* The previous frame we displayed on this tty. */ |
| 70 | struct frame *previous_frame; | 70 | struct frame *previous_frame; |
| 71 | int previous_color_mode; | 71 | int previous_color_mode; |
| 72 | 72 | ||
| 73 | #ifdef MSDOS | ||
| 74 | /* These variables describe the range of text currently shown in its | 73 | /* These variables describe the range of text currently shown in its |
| 75 | mouse-face, together with the window they apply to. As long as | 74 | mouse-face, together with the window they apply to. As long as |
| 76 | the mouse stays within this range, we need not redraw anything on | 75 | the mouse stays within this range, we need not redraw anything on |
| 77 | its account. Rows and columns are glyph matrix positions in | 76 | its account. Rows and columns are glyph matrix positions in |
| 78 | MOUSE_FACE_WINDOW. */ | 77 | MOUSE_FACE_WINDOW. */ |
| 79 | int mouse_face_beg_row, mouse_face_beg_col; | 78 | int mouse_face_beg_row, mouse_face_beg_col; |
| 79 | int mouse_face_beg_x, mouse_face_beg_y; | ||
| 80 | int mouse_face_end_row, mouse_face_end_col; | 80 | int mouse_face_end_row, mouse_face_end_col; |
| 81 | int mouse_face_end_x, mouse_face_end_y; | ||
| 81 | int mouse_face_past_end; | 82 | int mouse_face_past_end; |
| 82 | Lisp_Object mouse_face_window; | 83 | Lisp_Object mouse_face_window; |
| 83 | int mouse_face_face_id; | 84 | int mouse_face_face_id; |
| 85 | Lisp_Object mouse_face_overlay; | ||
| 84 | 86 | ||
| 85 | /* 1 if a mouse motion event came and we didn't handle it right away because | 87 | /* 1 if a mouse motion event came and we didn't handle it right away because |
| 86 | gc was in progress. */ | 88 | gc was in progress. */ |
| @@ -96,7 +98,6 @@ struct tty_display_info | |||
| 96 | 98 | ||
| 97 | /* Nonzero means that the mouse highlight should not be shown. */ | 99 | /* Nonzero means that the mouse highlight should not be shown. */ |
| 98 | int mouse_face_hidden; | 100 | int mouse_face_hidden; |
| 99 | #endif /* !MSDOS */ | ||
| 100 | 101 | ||
| 101 | /* Buffer used internally by termcap (see tgetent in the Termcap | 102 | /* Buffer used internally by termcap (see tgetent in the Termcap |
| 102 | manual). Only init_tty and delete_tty should change this. */ | 103 | manual). Only init_tty and delete_tty should change this. */ |
| @@ -190,12 +191,12 @@ struct tty_display_info | |||
| 190 | int RPov; /* # chars to start a TS_repeat */ | 191 | int RPov; /* # chars to start a TS_repeat */ |
| 191 | 192 | ||
| 192 | int delete_in_insert_mode; /* delete mode == insert mode */ | 193 | int delete_in_insert_mode; /* delete mode == insert mode */ |
| 193 | 194 | ||
| 194 | int se_is_so; /* 1 if same string both enters and leaves | 195 | int se_is_so; /* 1 if same string both enters and leaves |
| 195 | standout mode */ | 196 | standout mode */ |
| 196 | 197 | ||
| 197 | int costs_set; /* Nonzero if costs have been calculated. */ | 198 | int costs_set; /* Nonzero if costs have been calculated. */ |
| 198 | 199 | ||
| 199 | int insert_mode; /* Nonzero when in insert mode. */ | 200 | int insert_mode; /* Nonzero when in insert mode. */ |
| 200 | int standout_mode; /* Nonzero when in standout mode. */ | 201 | int standout_mode; /* Nonzero when in standout mode. */ |
| 201 | 202 | ||
| @@ -214,7 +215,7 @@ struct tty_display_info | |||
| 214 | lines from those operations. */ | 215 | lines from those operations. */ |
| 215 | 216 | ||
| 216 | int specified_window; | 217 | int specified_window; |
| 217 | 218 | ||
| 218 | /* Flag used in tty_show/hide_cursor. */ | 219 | /* Flag used in tty_show/hide_cursor. */ |
| 219 | 220 | ||
| 220 | int cursor_hidden; | 221 | int cursor_hidden; |
diff --git a/src/xdisp.c b/src/xdisp.c index c9af2ba88ec..6339bb900af 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -1085,12 +1085,13 @@ static void notice_overwritten_cursor (struct window *, | |||
| 1085 | int, int, int, int); | 1085 | int, int, int, int); |
| 1086 | static void append_stretch_glyph (struct it *, Lisp_Object, | 1086 | static void append_stretch_glyph (struct it *, Lisp_Object, |
| 1087 | int, int, int); | 1087 | int, int, int); |
| 1088 | static int coords_in_mouse_face_p (struct window *, int, int); | ||
| 1089 | |||
| 1090 | 1088 | ||
| 1091 | 1089 | ||
| 1092 | #endif /* HAVE_WINDOW_SYSTEM */ | 1090 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 1093 | 1091 | ||
| 1092 | static int coords_in_mouse_face_p (struct window *, int, int); | ||
| 1093 | |||
| 1094 | |||
| 1094 | 1095 | ||
| 1095 | /*********************************************************************** | 1096 | /*********************************************************************** |
| 1096 | Window display dimensions | 1097 | Window display dimensions |
| @@ -1782,8 +1783,6 @@ glyph_to_pixel_coords (struct window *w, int hpos, int vpos, | |||
| 1782 | } | 1783 | } |
| 1783 | 1784 | ||
| 1784 | 1785 | ||
| 1785 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 1786 | |||
| 1787 | /* Find the glyph under window-relative coordinates X/Y in window W. | 1786 | /* Find the glyph under window-relative coordinates X/Y in window W. |
| 1788 | Consider only glyphs from buffer text, i.e. no glyphs from overlay | 1787 | Consider only glyphs from buffer text, i.e. no glyphs from overlay |
| 1789 | strings. Return in *HPOS and *VPOS the row and column number of | 1788 | strings. Return in *HPOS and *VPOS the row and column number of |
| @@ -1866,7 +1865,6 @@ x_y_to_hpos_vpos (struct window *w, int x, int y, int *hpos, int *vpos, | |||
| 1866 | return glyph; | 1865 | return glyph; |
| 1867 | } | 1866 | } |
| 1868 | 1867 | ||
| 1869 | |||
| 1870 | /* EXPORT: | 1868 | /* EXPORT: |
| 1871 | Convert frame-relative x/y to coordinates relative to window W. | 1869 | Convert frame-relative x/y to coordinates relative to window W. |
| 1872 | Takes pseudo-windows into account. */ | 1870 | Takes pseudo-windows into account. */ |
| @@ -1889,6 +1887,8 @@ frame_to_window_pixel_xy (struct window *w, int *x, int *y) | |||
| 1889 | } | 1887 | } |
| 1890 | } | 1888 | } |
| 1891 | 1889 | ||
| 1890 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 1891 | |||
| 1892 | /* EXPORT: | 1892 | /* EXPORT: |
| 1893 | Return in RECTS[] at most N clipping rectangles for glyph string S. | 1893 | Return in RECTS[] at most N clipping rectangles for glyph string S. |
| 1894 | Return the number of stored rectangles. */ | 1894 | Return the number of stored rectangles. */ |
| @@ -15903,6 +15903,9 @@ try_window_id (struct window *w) | |||
| 15903 | + (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) | 15903 | + (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) |
| 15904 | + window_internal_height (w)); | 15904 | + window_internal_height (w)); |
| 15905 | 15905 | ||
| 15906 | #if defined (HAVE_GPM) || defined (MSDOS) | ||
| 15907 | x_clear_window_mouse_face (w); | ||
| 15908 | #endif | ||
| 15906 | /* Perform the operation on the screen. */ | 15909 | /* Perform the operation on the screen. */ |
| 15907 | if (dvpos > 0) | 15910 | if (dvpos > 0) |
| 15908 | { | 15911 | { |
| @@ -23608,6 +23611,16 @@ x_clear_cursor (struct window *w) | |||
| 23608 | update_window_cursor (w, 0); | 23611 | update_window_cursor (w, 0); |
| 23609 | } | 23612 | } |
| 23610 | 23613 | ||
| 23614 | void | ||
| 23615 | draw_row_with_mouse_face (struct frame *w, int start_x, struct glyph_row *row, | ||
| 23616 | int start_hpos, int end_hpos, | ||
| 23617 | enum draw_glyphs_face draw) | ||
| 23618 | { | ||
| 23619 | draw_glyphs (w, start_x, row, TEXT_AREA, start_hpos, end_hpos, draw, 0); | ||
| 23620 | } | ||
| 23621 | |||
| 23622 | |||
| 23623 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 23611 | 23624 | ||
| 23612 | /* EXPORT: | 23625 | /* EXPORT: |
| 23613 | Display the active region described by mouse_face_* according to DRAW. */ | 23626 | Display the active region described by mouse_face_* according to DRAW. */ |
| @@ -23695,15 +23708,15 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) | |||
| 23695 | 23708 | ||
| 23696 | if (end_hpos > start_hpos) | 23709 | if (end_hpos > start_hpos) |
| 23697 | { | 23710 | { |
| 23698 | draw_glyphs (w, start_x, row, TEXT_AREA, | 23711 | draw_row_with_mouse_face (w, start_x, row, |
| 23699 | start_hpos, end_hpos, | 23712 | start_hpos, end_hpos, draw); |
| 23700 | draw, 0); | ||
| 23701 | 23713 | ||
| 23702 | row->mouse_face_p | 23714 | row->mouse_face_p |
| 23703 | = draw == DRAW_MOUSE_FACE || draw == DRAW_IMAGE_RAISED; | 23715 | = draw == DRAW_MOUSE_FACE || draw == DRAW_IMAGE_RAISED; |
| 23704 | } | 23716 | } |
| 23705 | } | 23717 | } |
| 23706 | 23718 | ||
| 23719 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 23707 | /* When we've written over the cursor, arrange for it to | 23720 | /* When we've written over the cursor, arrange for it to |
| 23708 | be displayed again. */ | 23721 | be displayed again. */ |
| 23709 | if (phys_cursor_on_p && !w->phys_cursor_on_p) | 23722 | if (phys_cursor_on_p && !w->phys_cursor_on_p) |
| @@ -23714,8 +23727,10 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) | |||
| 23714 | w->phys_cursor.x, w->phys_cursor.y); | 23727 | w->phys_cursor.x, w->phys_cursor.y); |
| 23715 | UNBLOCK_INPUT; | 23728 | UNBLOCK_INPUT; |
| 23716 | } | 23729 | } |
| 23730 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 23717 | } | 23731 | } |
| 23718 | 23732 | ||
| 23733 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 23719 | /* Change the mouse cursor. */ | 23734 | /* Change the mouse cursor. */ |
| 23720 | if (draw == DRAW_NORMAL_TEXT && !EQ (dpyinfo->mouse_face_window, f->tool_bar_window)) | 23735 | if (draw == DRAW_NORMAL_TEXT && !EQ (dpyinfo->mouse_face_window, f->tool_bar_window)) |
| 23721 | FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor); | 23736 | FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor); |
| @@ -23723,6 +23738,8 @@ show_mouse_face (Display_Info *dpyinfo, enum draw_glyphs_face draw) | |||
| 23723 | FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor); | 23738 | FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor); |
| 23724 | else | 23739 | else |
| 23725 | FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor); | 23740 | FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->nontext_cursor); |
| 23741 | |||
| 23742 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 23726 | } | 23743 | } |
| 23727 | 23744 | ||
| 23728 | /* EXPORT: | 23745 | /* EXPORT: |
| @@ -24066,13 +24083,13 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 24066 | start_charpos); | 24083 | start_charpos); |
| 24067 | /* If pos == 0, it means before_string came from an | 24084 | /* If pos == 0, it means before_string came from an |
| 24068 | overlay, not from a buffer position. */ | 24085 | overlay, not from a buffer position. */ |
| 24069 | if (!pos || pos >= start_charpos && pos < end_charpos) | 24086 | if (!pos || (pos >= start_charpos && pos < end_charpos)) |
| 24070 | break; | 24087 | break; |
| 24071 | } | 24088 | } |
| 24072 | else if (EQ (glyph->object, after_string)) | 24089 | else if (EQ (glyph->object, after_string)) |
| 24073 | { | 24090 | { |
| 24074 | pos = string_buffer_position (w, after_string, end_charpos); | 24091 | pos = string_buffer_position (w, after_string, end_charpos); |
| 24075 | if (!pos || pos >= start_charpos && pos < end_charpos) | 24092 | if (!pos || (pos >= start_charpos && pos < end_charpos)) |
| 24076 | break; | 24093 | break; |
| 24077 | } | 24094 | } |
| 24078 | x += glyph->pixel_width; | 24095 | x += glyph->pixel_width; |
| @@ -24116,13 +24133,13 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 24116 | pos = string_buffer_position (w, before_string, start_charpos); | 24133 | pos = string_buffer_position (w, before_string, start_charpos); |
| 24117 | /* If pos == 0, it means before_string came from an | 24134 | /* If pos == 0, it means before_string came from an |
| 24118 | overlay, not from a buffer position. */ | 24135 | overlay, not from a buffer position. */ |
| 24119 | if (!pos || pos >= start_charpos && pos < end_charpos) | 24136 | if (!pos || (pos >= start_charpos && pos < end_charpos)) |
| 24120 | break; | 24137 | break; |
| 24121 | } | 24138 | } |
| 24122 | else if (EQ (glyph->object, after_string)) | 24139 | else if (EQ (glyph->object, after_string)) |
| 24123 | { | 24140 | { |
| 24124 | pos = string_buffer_position (w, after_string, end_charpos); | 24141 | pos = string_buffer_position (w, after_string, end_charpos); |
| 24125 | if (!pos || pos >= start_charpos && pos < end_charpos) | 24142 | if (!pos || (pos >= start_charpos && pos < end_charpos)) |
| 24126 | break; | 24143 | break; |
| 24127 | } | 24144 | } |
| 24128 | } | 24145 | } |
| @@ -24180,13 +24197,13 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 24180 | if (EQ (end->object, before_string)) | 24197 | if (EQ (end->object, before_string)) |
| 24181 | { | 24198 | { |
| 24182 | pos = string_buffer_position (w, before_string, start_charpos); | 24199 | pos = string_buffer_position (w, before_string, start_charpos); |
| 24183 | if (!pos || pos >= start_charpos && pos < end_charpos) | 24200 | if (!pos || (pos >= start_charpos && pos < end_charpos)) |
| 24184 | break; | 24201 | break; |
| 24185 | } | 24202 | } |
| 24186 | else if (EQ (end->object, after_string)) | 24203 | else if (EQ (end->object, after_string)) |
| 24187 | { | 24204 | { |
| 24188 | pos = string_buffer_position (w, after_string, end_charpos); | 24205 | pos = string_buffer_position (w, after_string, end_charpos); |
| 24189 | if (!pos || pos >= start_charpos && pos < end_charpos) | 24206 | if (!pos || (pos >= start_charpos && pos < end_charpos)) |
| 24190 | break; | 24207 | break; |
| 24191 | } | 24208 | } |
| 24192 | } | 24209 | } |
| @@ -24230,13 +24247,13 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 24230 | if (EQ (end->object, before_string)) | 24247 | if (EQ (end->object, before_string)) |
| 24231 | { | 24248 | { |
| 24232 | pos = string_buffer_position (w, before_string, start_charpos); | 24249 | pos = string_buffer_position (w, before_string, start_charpos); |
| 24233 | if (!pos || pos >= start_charpos && pos < end_charpos) | 24250 | if (!pos || (pos >= start_charpos && pos < end_charpos)) |
| 24234 | break; | 24251 | break; |
| 24235 | } | 24252 | } |
| 24236 | else if (EQ (end->object, after_string)) | 24253 | else if (EQ (end->object, after_string)) |
| 24237 | { | 24254 | { |
| 24238 | pos = string_buffer_position (w, after_string, end_charpos); | 24255 | pos = string_buffer_position (w, after_string, end_charpos); |
| 24239 | if (!pos || pos >= start_charpos && pos < end_charpos) | 24256 | if (!pos || (pos >= start_charpos && pos < end_charpos)) |
| 24240 | break; | 24257 | break; |
| 24241 | } | 24258 | } |
| 24242 | x += end->pixel_width; | 24259 | x += end->pixel_width; |
| @@ -24460,6 +24477,8 @@ mouse_face_from_string_pos (struct window *w, Display_Info *dpyinfo, | |||
| 24460 | } | 24477 | } |
| 24461 | } | 24478 | } |
| 24462 | 24479 | ||
| 24480 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 24481 | |||
| 24463 | /* See if position X, Y is within a hot-spot of an image. */ | 24482 | /* See if position X, Y is within a hot-spot of an image. */ |
| 24464 | 24483 | ||
| 24465 | static int | 24484 | static int |
| @@ -24630,6 +24649,8 @@ define_frame_cursor1 (struct frame *f, Cursor cursor, Lisp_Object pointer) | |||
| 24630 | FRAME_RIF (f)->define_frame_cursor (f, cursor); | 24649 | FRAME_RIF (f)->define_frame_cursor (f, cursor); |
| 24631 | } | 24650 | } |
| 24632 | 24651 | ||
| 24652 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 24653 | |||
| 24633 | /* Take proper action when mouse has moved to the mode or header line | 24654 | /* Take proper action when mouse has moved to the mode or header line |
| 24634 | or marginal area AREA of window W, x-position X and y-position Y. | 24655 | or marginal area AREA of window W, x-position X and y-position Y. |
| 24635 | X is relative to the start of the text display area of W, so the | 24656 | X is relative to the start of the text display area of W, so the |
| @@ -24643,7 +24664,11 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, | |||
| 24643 | struct window *w = XWINDOW (window); | 24664 | struct window *w = XWINDOW (window); |
| 24644 | struct frame *f = XFRAME (w->frame); | 24665 | struct frame *f = XFRAME (w->frame); |
| 24645 | Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | 24666 | Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
| 24667 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 24646 | Cursor cursor = FRAME_X_OUTPUT (f)->nontext_cursor; | 24668 | Cursor cursor = FRAME_X_OUTPUT (f)->nontext_cursor; |
| 24669 | #else | ||
| 24670 | Cursor cursor = No_Cursor; | ||
| 24671 | #endif | ||
| 24647 | Lisp_Object pointer = Qnil; | 24672 | Lisp_Object pointer = Qnil; |
| 24648 | int dx, dy, width, height; | 24673 | int dx, dy, width, height; |
| 24649 | EMACS_INT charpos; | 24674 | EMACS_INT charpos; |
| @@ -24695,6 +24720,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, | |||
| 24695 | 24720 | ||
| 24696 | help = Qnil; | 24721 | help = Qnil; |
| 24697 | 24722 | ||
| 24723 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 24698 | if (IMAGEP (object)) | 24724 | if (IMAGEP (object)) |
| 24699 | { | 24725 | { |
| 24700 | Lisp_Object image_map, hotspot; | 24726 | Lisp_Object image_map, hotspot; |
| @@ -24731,6 +24757,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, | |||
| 24731 | if (NILP (pointer)) | 24757 | if (NILP (pointer)) |
| 24732 | pointer = Fplist_get (XCDR (object), QCpointer); | 24758 | pointer = Fplist_get (XCDR (object), QCpointer); |
| 24733 | } | 24759 | } |
| 24760 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 24734 | 24761 | ||
| 24735 | if (STRINGP (string)) | 24762 | if (STRINGP (string)) |
| 24736 | { | 24763 | { |
| @@ -24750,6 +24777,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, | |||
| 24750 | } | 24777 | } |
| 24751 | } | 24778 | } |
| 24752 | 24779 | ||
| 24780 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 24753 | if (NILP (pointer)) | 24781 | if (NILP (pointer)) |
| 24754 | pointer = Fget_text_property (pos, Qpointer, string); | 24782 | pointer = Fget_text_property (pos, Qpointer, string); |
| 24755 | 24783 | ||
| @@ -24763,6 +24791,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, | |||
| 24763 | if (!KEYMAPP (map)) | 24791 | if (!KEYMAPP (map)) |
| 24764 | cursor = dpyinfo->vertical_scroll_bar_cursor; | 24792 | cursor = dpyinfo->vertical_scroll_bar_cursor; |
| 24765 | } | 24793 | } |
| 24794 | #endif | ||
| 24766 | 24795 | ||
| 24767 | /* Change the mouse face according to what is under X/Y. */ | 24796 | /* Change the mouse face according to what is under X/Y. */ |
| 24768 | mouse_face = Fget_text_property (pos, Qmouse_face, string); | 24797 | mouse_face = Fget_text_property (pos, Qmouse_face, string); |
| @@ -24895,7 +24924,9 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, | |||
| 24895 | else if ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)) | 24924 | else if ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)) |
| 24896 | clear_mouse_face (dpyinfo); | 24925 | clear_mouse_face (dpyinfo); |
| 24897 | } | 24926 | } |
| 24927 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 24898 | define_frame_cursor1 (f, cursor, pointer); | 24928 | define_frame_cursor1 (f, cursor, pointer); |
| 24929 | #endif | ||
| 24899 | } | 24930 | } |
| 24900 | 24931 | ||
| 24901 | 24932 | ||
| @@ -24917,7 +24948,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 24917 | struct buffer *b; | 24948 | struct buffer *b; |
| 24918 | 24949 | ||
| 24919 | /* When a menu is active, don't highlight because this looks odd. */ | 24950 | /* When a menu is active, don't highlight because this looks odd. */ |
| 24920 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NS) | 24951 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NS) || defined (MSDOS) |
| 24921 | if (popup_activated ()) | 24952 | if (popup_activated ()) |
| 24922 | return; | 24953 | return; |
| 24923 | #endif | 24954 | #endif |
| @@ -24961,6 +24992,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 24961 | w = XWINDOW (window); | 24992 | w = XWINDOW (window); |
| 24962 | frame_to_window_pixel_xy (w, &x, &y); | 24993 | frame_to_window_pixel_xy (w, &x, &y); |
| 24963 | 24994 | ||
| 24995 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 24964 | /* Handle tool-bar window differently since it doesn't display a | 24996 | /* Handle tool-bar window differently since it doesn't display a |
| 24965 | buffer. */ | 24997 | buffer. */ |
| 24966 | if (EQ (window, f->tool_bar_window)) | 24998 | if (EQ (window, f->tool_bar_window)) |
| @@ -24968,6 +25000,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 24968 | note_tool_bar_highlight (f, x, y); | 25000 | note_tool_bar_highlight (f, x, y); |
| 24969 | return; | 25001 | return; |
| 24970 | } | 25002 | } |
| 25003 | #endif | ||
| 24971 | 25004 | ||
| 24972 | /* Mouse is on the mode, header line or margin? */ | 25005 | /* Mouse is on the mode, header line or margin? */ |
| 24973 | if (part == ON_MODE_LINE || part == ON_HEADER_LINE | 25006 | if (part == ON_MODE_LINE || part == ON_HEADER_LINE |
| @@ -24977,6 +25010,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 24977 | return; | 25010 | return; |
| 24978 | } | 25011 | } |
| 24979 | 25012 | ||
| 25013 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 24980 | if (part == ON_VERTICAL_BORDER) | 25014 | if (part == ON_VERTICAL_BORDER) |
| 24981 | { | 25015 | { |
| 24982 | cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor; | 25016 | cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor; |
| @@ -24987,6 +25021,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 24987 | cursor = FRAME_X_OUTPUT (f)->nontext_cursor; | 25021 | cursor = FRAME_X_OUTPUT (f)->nontext_cursor; |
| 24988 | else | 25022 | else |
| 24989 | cursor = FRAME_X_OUTPUT (f)->text_cursor; | 25023 | cursor = FRAME_X_OUTPUT (f)->text_cursor; |
| 25024 | #endif | ||
| 24990 | 25025 | ||
| 24991 | /* Are we in a window whose display is up to date? | 25026 | /* Are we in a window whose display is up to date? |
| 24992 | And verify the buffer's text has not changed. */ | 25027 | And verify the buffer's text has not changed. */ |
| @@ -25010,6 +25045,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 25010 | /* Find the glyph under X/Y. */ | 25045 | /* Find the glyph under X/Y. */ |
| 25011 | glyph = x_y_to_hpos_vpos (w, x, y, &hpos, &vpos, &dx, &dy, &area); | 25046 | glyph = x_y_to_hpos_vpos (w, x, y, &hpos, &vpos, &dx, &dy, &area); |
| 25012 | 25047 | ||
| 25048 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 25013 | /* Look for :pointer property on image. */ | 25049 | /* Look for :pointer property on image. */ |
| 25014 | if (glyph != NULL && glyph->type == IMAGE_GLYPH) | 25050 | if (glyph != NULL && glyph->type == IMAGE_GLYPH) |
| 25015 | { | 25051 | { |
| @@ -25051,11 +25087,18 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 25051 | pointer = Fplist_get (XCDR (img->spec), QCpointer); | 25087 | pointer = Fplist_get (XCDR (img->spec), QCpointer); |
| 25052 | } | 25088 | } |
| 25053 | } | 25089 | } |
| 25090 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 25054 | 25091 | ||
| 25055 | /* Clear mouse face if X/Y not over text. */ | 25092 | /* Clear mouse face if X/Y not over text. */ |
| 25056 | if (glyph == NULL | 25093 | if (glyph == NULL |
| 25057 | || area != TEXT_AREA | 25094 | || area != TEXT_AREA |
| 25058 | || !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p | 25095 | || !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p |
| 25096 | /* Glyph's OBJECT is an integer for glyphs inserted by the | ||
| 25097 | display engine for its internal purposes, like truncation | ||
| 25098 | and continuation glyphs and blanks beyond the end of | ||
| 25099 | line's text on text terminals. If we are over such a | ||
| 25100 | glyph, we are not over any text. */ | ||
| 25101 | || INTEGERP (glyph->object) | ||
| 25059 | /* R2L rows have a stretch glyph at their front, which | 25102 | /* R2L rows have a stretch glyph at their front, which |
| 25060 | stands for no text, whereas L2R rows have no glyphs at | 25103 | stands for no text, whereas L2R rows have no glyphs at |
| 25061 | all beyond the end of text. Treat such stretch glyphs | 25104 | all beyond the end of text. Treat such stretch glyphs |
| @@ -25067,6 +25110,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 25067 | { | 25110 | { |
| 25068 | if (clear_mouse_face (dpyinfo)) | 25111 | if (clear_mouse_face (dpyinfo)) |
| 25069 | cursor = No_Cursor; | 25112 | cursor = No_Cursor; |
| 25113 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 25070 | if (NILP (pointer)) | 25114 | if (NILP (pointer)) |
| 25071 | { | 25115 | { |
| 25072 | if (area != TEXT_AREA) | 25116 | if (area != TEXT_AREA) |
| @@ -25074,6 +25118,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 25074 | else | 25118 | else |
| 25075 | pointer = Vvoid_text_area_pointer; | 25119 | pointer = Vvoid_text_area_pointer; |
| 25076 | } | 25120 | } |
| 25121 | #endif | ||
| 25077 | goto set_cursor; | 25122 | goto set_cursor; |
| 25078 | } | 25123 | } |
| 25079 | 25124 | ||
| @@ -25323,6 +25368,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 25323 | } | 25368 | } |
| 25324 | } | 25369 | } |
| 25325 | 25370 | ||
| 25371 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 25326 | /* Look for a `pointer' property. */ | 25372 | /* Look for a `pointer' property. */ |
| 25327 | if (NILP (pointer)) | 25373 | if (NILP (pointer)) |
| 25328 | { | 25374 | { |
| @@ -25363,6 +25409,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 25363 | Qpointer, object); | 25409 | Qpointer, object); |
| 25364 | } | 25410 | } |
| 25365 | } | 25411 | } |
| 25412 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 25366 | 25413 | ||
| 25367 | BEGV = obegv; | 25414 | BEGV = obegv; |
| 25368 | ZV = ozv; | 25415 | ZV = ozv; |
| @@ -25371,7 +25418,13 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 25371 | 25418 | ||
| 25372 | set_cursor: | 25419 | set_cursor: |
| 25373 | 25420 | ||
| 25421 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 25374 | define_frame_cursor1 (f, cursor, pointer); | 25422 | define_frame_cursor1 (f, cursor, pointer); |
| 25423 | #else | ||
| 25424 | /* This is here to prevent a compiler error, due to "label at end of | ||
| 25425 | compound statement". */ | ||
| 25426 | return; | ||
| 25427 | #endif | ||
| 25375 | } | 25428 | } |
| 25376 | 25429 | ||
| 25377 | 25430 | ||
| @@ -25414,8 +25467,6 @@ cancel_mouse_face (struct frame *f) | |||
| 25414 | } | 25467 | } |
| 25415 | 25468 | ||
| 25416 | 25469 | ||
| 25417 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 25418 | |||
| 25419 | 25470 | ||
| 25420 | /*********************************************************************** | 25471 | /*********************************************************************** |
| 25421 | Exposure Events | 25472 | Exposure Events |
diff --git a/src/xmenu.c b/src/xmenu.c index 60b1c2b4595..44f1721d65e 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -2533,13 +2533,16 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | |||
| 2533 | 2533 | ||
| 2534 | #endif /* HAVE_MENUS */ | 2534 | #endif /* HAVE_MENUS */ |
| 2535 | 2535 | ||
| 2536 | /* Detect if a dialog or menu has been posted. */ | 2536 | #ifndef MSDOS |
| 2537 | /* Detect if a dialog or menu has been posted. MSDOS has its own | ||
| 2538 | implementation on msdos.c. */ | ||
| 2537 | 2539 | ||
| 2538 | int | 2540 | int |
| 2539 | popup_activated (void) | 2541 | popup_activated (void) |
| 2540 | { | 2542 | { |
| 2541 | return popup_activated_flag; | 2543 | return popup_activated_flag; |
| 2542 | } | 2544 | } |
| 2545 | #endif /* not MSDOS */ | ||
| 2543 | 2546 | ||
| 2544 | /* The following is used by delayed window autoselection. */ | 2547 | /* The following is used by delayed window autoselection. */ |
| 2545 | 2548 | ||