aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2010-11-01 22:19:17 +0200
committerEli Zaretskii2010-11-01 22:19:17 +0200
commit34574c0221167dd73b20cd645e240316e83dd6f8 (patch)
tree009eb29bda8b11b8f358fd71d36d08fea3b603e9 /src
parentbbf534ce52f044f79773e91f558227c3e9a1727b (diff)
downloademacs-34574c0221167dd73b20cd645e240316e83dd6f8.tar.gz
emacs-34574c0221167dd73b20cd645e240316e83dd6f8.zip
REALLY finish coding portable mouse highlight.
msdos.c (dos_set_window_size, draw_row_with_mouse_face) (IT_update_begin, IT_update_end, IT_frame_up_to_date) (internal_terminal_init, dos_rawgetc): Replace Display_Info with Mouse_HLInfo everywhere where mouse_face_* members were accessed for mouse highlight purposes.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/msdos.c96
2 files changed, 55 insertions, 47 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ce84ba0f2e5..43167c12a63 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,11 @@
12010-11-01 Eli Zaretskii <eliz@gnu.org> 12010-11-01 Eli Zaretskii <eliz@gnu.org>
2 2
3 * msdos.c (dos_set_window_size, draw_row_with_mouse_face)
4 (IT_update_begin, IT_update_end, IT_frame_up_to_date)
5 (internal_terminal_init, dos_rawgetc): Replace Display_Info with
6 Mouse_HLInfo everywhere where mouse_face_* members were accessed
7 for mouse highlight purposes.
8
3 * nsterm.m (ns_update_window_begin, ns_update_window_end) 9 * nsterm.m (ns_update_window_begin, ns_update_window_end)
4 (ns_update_end, x_destroy_window, ns_frame_up_to_date) 10 (ns_update_end, x_destroy_window, ns_frame_up_to_date)
5 (ns_dumpglyphs_box_or_relief, ns_maybe_dumpglyphs_background) 11 (ns_dumpglyphs_box_or_relief, ns_maybe_dumpglyphs_background)
diff --git a/src/msdos.c b/src/msdos.c
index c676ed91a64..9826beb1721 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -584,14 +584,14 @@ dos_set_window_size (int *rows, int *cols)
584 if (current_rows != *rows || current_cols != *cols) 584 if (current_rows != *rows || current_cols != *cols)
585 { 585 {
586 struct frame *f = SELECTED_FRAME(); 586 struct frame *f = SELECTED_FRAME();
587 struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 587 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
588 Lisp_Object window = dpyinfo->mouse_face_window; 588 Lisp_Object window = hlinfo->mouse_face_window;
589 589
590 if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f) 590 if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f)
591 { 591 {
592 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; 592 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
593 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; 593 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
594 dpyinfo->mouse_face_window = Qnil; 594 hlinfo->mouse_face_window = Qnil;
595 } 595 }
596 } 596 }
597 597
@@ -957,6 +957,7 @@ draw_row_with_mouse_face (struct window *w, int x, struct glyph_row *row,
957{ 957{
958 struct frame *f = XFRAME (WINDOW_FRAME (w)); 958 struct frame *f = XFRAME (WINDOW_FRAME (w));
959 struct tty_display_info *tty = FRAME_TTY (f); 959 struct tty_display_info *tty = FRAME_TTY (f);
960 Mouse_HLInfo *hlinfo = &tty->mouse_highlight;
960 961
961 if (hl == DRAW_MOUSE_FACE) 962 if (hl == DRAW_MOUSE_FACE)
962 { 963 {
@@ -971,7 +972,7 @@ draw_row_with_mouse_face (struct window *w, int x, struct glyph_row *row,
971 kstart, kstart + nglyphs - 1, vpos); 972 kstart, kstart + nglyphs - 1, vpos);
972 973
973 mouse_off (); 974 mouse_off ();
974 IT_set_face (tty->mouse_face_face_id); 975 IT_set_face (hlinfo->mouse_face_face_id);
975 /* Since we are going to change only the _colors_ of already 976 /* Since we are going to change only the _colors_ of already
976 displayed text, there's no need to go through all the pain of 977 displayed text, there's no need to go through all the pain of
977 generating and encoding the text from the glyphs. Instead, 978 generating and encoding the text from the glyphs. Instead,
@@ -1216,7 +1217,8 @@ static void
1216IT_update_begin (struct frame *f) 1217IT_update_begin (struct frame *f)
1217{ 1218{
1218 struct tty_display_info *display_info = FRAME_X_DISPLAY_INFO (f); 1219 struct tty_display_info *display_info = FRAME_X_DISPLAY_INFO (f);
1219 struct frame *mouse_face_frame = display_info->mouse_face_mouse_frame; 1220 Mouse_HLInfo *hlinfo = &display_info->mouse_highlight;
1221 struct frame *mouse_face_frame = hlinfo->mouse_face_mouse_frame;
1220 1222
1221 if (display_info->termscript) 1223 if (display_info->termscript)
1222 fprintf (display_info->termscript, "\n\n<UPDATE_BEGIN"); 1224 fprintf (display_info->termscript, "\n\n<UPDATE_BEGIN");
@@ -1226,28 +1228,28 @@ IT_update_begin (struct frame *f)
1226 if (f && f == mouse_face_frame) 1228 if (f && f == mouse_face_frame)
1227 { 1229 {
1228 /* Don't do highlighting for mouse motion during the update. */ 1230 /* Don't do highlighting for mouse motion during the update. */
1229 display_info->mouse_face_defer = 1; 1231 hlinfo->mouse_face_defer = 1;
1230 1232
1231 /* If F needs to be redrawn, simply forget about any prior mouse 1233 /* If F needs to be redrawn, simply forget about any prior mouse
1232 highlighting. */ 1234 highlighting. */
1233 if (FRAME_GARBAGED_P (f)) 1235 if (FRAME_GARBAGED_P (f))
1234 display_info->mouse_face_window = Qnil; 1236 hlinfo->mouse_face_window = Qnil;
1235 1237
1236 /* Can we tell that this update does not affect the window 1238 /* Can we tell that this update does not affect the window
1237 where the mouse highlight is? If so, no need to turn off. 1239 where the mouse highlight is? If so, no need to turn off.
1238 Likewise, don't do anything if none of the enabled rows 1240 Likewise, don't do anything if none of the enabled rows
1239 contains glyphs highlighted in mouse face. */ 1241 contains glyphs highlighted in mouse face. */
1240 if (!NILP (display_info->mouse_face_window) 1242 if (!NILP (hlinfo->mouse_face_window)
1241 && WINDOWP (display_info->mouse_face_window)) 1243 && WINDOWP (hlinfo->mouse_face_window))
1242 { 1244 {
1243 struct window *w = XWINDOW (display_info->mouse_face_window); 1245 struct window *w = XWINDOW (hlinfo->mouse_face_window);
1244 int i; 1246 int i;
1245 1247
1246 /* If the mouse highlight is in the window that was deleted 1248 /* If the mouse highlight is in the window that was deleted
1247 (e.g., if it was popped by completion), clear highlight 1249 (e.g., if it was popped by completion), clear highlight
1248 unconditionally. */ 1250 unconditionally. */
1249 if (NILP (w->buffer)) 1251 if (NILP (w->buffer))
1250 display_info->mouse_face_window = Qnil; 1252 hlinfo->mouse_face_window = Qnil;
1251 else 1253 else
1252 { 1254 {
1253 for (i = 0; i < w->desired_matrix->nrows; ++i) 1255 for (i = 0; i < w->desired_matrix->nrows; ++i)
@@ -1257,18 +1259,18 @@ IT_update_begin (struct frame *f)
1257 } 1259 }
1258 1260
1259 if (NILP (w->buffer) || i < w->desired_matrix->nrows) 1261 if (NILP (w->buffer) || i < w->desired_matrix->nrows)
1260 clear_mouse_face (display_info); 1262 clear_mouse_face (hlinfo);
1261 } 1263 }
1262 } 1264 }
1263 else if (mouse_face_frame && !FRAME_LIVE_P (mouse_face_frame)) 1265 else if (mouse_face_frame && !FRAME_LIVE_P (mouse_face_frame))
1264 { 1266 {
1265 /* If the frame with mouse highlight was deleted, invalidate the 1267 /* If the frame with mouse highlight was deleted, invalidate the
1266 highlight info. */ 1268 highlight info. */
1267 display_info->mouse_face_beg_row = display_info->mouse_face_beg_col = -1; 1269 hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
1268 display_info->mouse_face_end_row = display_info->mouse_face_end_col = -1; 1270 hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
1269 display_info->mouse_face_window = Qnil; 1271 hlinfo->mouse_face_window = Qnil;
1270 display_info->mouse_face_deferred_gc = 0; 1272 hlinfo->mouse_face_deferred_gc = 0;
1271 display_info->mouse_face_mouse_frame = NULL; 1273 hlinfo->mouse_face_mouse_frame = NULL;
1272 } 1274 }
1273 1275
1274 UNBLOCK_INPUT; 1276 UNBLOCK_INPUT;
@@ -1281,25 +1283,25 @@ IT_update_end (struct frame *f)
1281 1283
1282 if (dpyinfo->termscript) 1284 if (dpyinfo->termscript)
1283 fprintf (dpyinfo->termscript, "\n<UPDATE_END\n"); 1285 fprintf (dpyinfo->termscript, "\n<UPDATE_END\n");
1284 dpyinfo->mouse_face_defer = 0; 1286 dpyinfo->mouse_highlight.mouse_face_defer = 0;
1285} 1287}
1286 1288
1287static void 1289static void
1288IT_frame_up_to_date (struct frame *f) 1290IT_frame_up_to_date (struct frame *f)
1289{ 1291{
1290 struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 1292 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
1291 Lisp_Object new_cursor, frame_desired_cursor; 1293 Lisp_Object new_cursor, frame_desired_cursor;
1292 struct window *sw; 1294 struct window *sw;
1293 1295
1294 if (dpyinfo->mouse_face_deferred_gc 1296 if (hlinfo->mouse_face_deferred_gc
1295 || (f && f == dpyinfo->mouse_face_mouse_frame)) 1297 || (f && f == hlinfo->mouse_face_mouse_frame))
1296 { 1298 {
1297 BLOCK_INPUT; 1299 BLOCK_INPUT;
1298 if (dpyinfo->mouse_face_mouse_frame) 1300 if (hlinfo->mouse_face_mouse_frame)
1299 note_mouse_highlight (dpyinfo->mouse_face_mouse_frame, 1301 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
1300 dpyinfo->mouse_face_mouse_x, 1302 hlinfo->mouse_face_mouse_x,
1301 dpyinfo->mouse_face_mouse_y); 1303 hlinfo->mouse_face_mouse_y);
1302 dpyinfo->mouse_face_deferred_gc = 0; 1304 hlinfo->mouse_face_deferred_gc = 0;
1303 UNBLOCK_INPUT; 1305 UNBLOCK_INPUT;
1304 } 1306 }
1305 1307
@@ -1844,18 +1846,18 @@ internal_terminal_init (void)
1844 if (colors[1] >= 0 && colors[1] < 16) 1846 if (colors[1] >= 0 && colors[1] < 16)
1845 FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = colors[1]; 1847 FRAME_BACKGROUND_PIXEL (SELECTED_FRAME ()) = colors[1];
1846 } 1848 }
1847 the_only_display_info.mouse_face_mouse_frame = NULL; 1849 the_only_display_info.mouse_highlight.mouse_face_mouse_frame = NULL;
1848 the_only_display_info.mouse_face_deferred_gc = 0; 1850 the_only_display_info.mouse_highlight.mouse_face_deferred_gc = 0;
1849 the_only_display_info.mouse_face_beg_row = 1851 the_only_display_info.mouse_highlight.mouse_face_beg_row =
1850 the_only_display_info.mouse_face_beg_col = -1; 1852 the_only_display_info.mouse_highlight.mouse_face_beg_col = -1;
1851 the_only_display_info.mouse_face_end_row = 1853 the_only_display_info.mouse_highlight.mouse_face_end_row =
1852 the_only_display_info.mouse_face_end_col = -1; 1854 the_only_display_info.mouse_highlight.mouse_face_end_col = -1;
1853 the_only_display_info.mouse_face_face_id = DEFAULT_FACE_ID; 1855 the_only_display_info.mouse_highlight.mouse_face_face_id = DEFAULT_FACE_ID;
1854 the_only_display_info.mouse_face_window = Qnil; 1856 the_only_display_info.mouse_highlight.mouse_face_window = Qnil;
1855 the_only_display_info.mouse_face_mouse_x = 1857 the_only_display_info.mouse_highlight.mouse_face_mouse_x =
1856 the_only_display_info.mouse_face_mouse_y = 0; 1858 the_only_display_info.mouse_highlight.mouse_face_mouse_y = 0;
1857 the_only_display_info.mouse_face_defer = 0; 1859 the_only_display_info.mouse_highlight.mouse_face_defer = 0;
1858 the_only_display_info.mouse_face_hidden = 0; 1860 the_only_display_info.mouse_highlight.mouse_face_hidden = 0;
1859 1861
1860 if (have_mouse) /* detected in dos_ttraw, which see */ 1862 if (have_mouse) /* detected in dos_ttraw, which see */
1861 { 1863 {
@@ -2443,7 +2445,7 @@ dos_rawgetc (void)
2443{ 2445{
2444 struct input_event event; 2446 struct input_event event;
2445 union REGS regs; 2447 union REGS regs;
2446 struct tty_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (SELECTED_FRAME()); 2448 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (SELECTED_FRAME());
2447 EVENT_INIT (event); 2449 EVENT_INIT (event);
2448 2450
2449#ifndef HAVE_X_WINDOWS 2451#ifndef HAVE_X_WINDOWS
@@ -2653,10 +2655,10 @@ dos_rawgetc (void)
2653 if (code == 0) 2655 if (code == 0)
2654 continue; 2656 continue;
2655 2657
2656 if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)) 2658 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight))
2657 { 2659 {
2658 clear_mouse_face (dpyinfo); 2660 clear_mouse_face (hlinfo);
2659 dpyinfo->mouse_face_hidden = 1; 2661 hlinfo->mouse_face_hidden = 1;
2660 } 2662 }
2661 2663
2662 if (code >= 0x100) 2664 if (code >= 0x100)
@@ -2684,10 +2686,10 @@ dos_rawgetc (void)
2684 might need to update mouse highlight. */ 2686 might need to update mouse highlight. */
2685 if (mouse_last_x != mouse_prev_x || mouse_last_y != mouse_prev_y) 2687 if (mouse_last_x != mouse_prev_x || mouse_last_y != mouse_prev_y)
2686 { 2688 {
2687 if (dpyinfo->mouse_face_hidden) 2689 if (hlinfo->mouse_face_hidden)
2688 { 2690 {
2689 dpyinfo->mouse_face_hidden = 0; 2691 hlinfo->mouse_face_hidden = 0;
2690 clear_mouse_face (dpyinfo); 2692 clear_mouse_face (hlinfo);
2691 } 2693 }
2692 2694
2693 /* Generate SELECT_WINDOW_EVENTs when needed. */ 2695 /* Generate SELECT_WINDOW_EVENTs when needed. */