diff options
| author | Eli Zaretskii | 1999-12-06 16:54:09 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 1999-12-06 16:54:09 +0000 |
| commit | 2d764c783d0ab96cc246f3bb1dad70f2ef56ce0f (patch) | |
| tree | fa1366f693555a3ec65273f478ed95babf1bd0a9 /src/msdos.c | |
| parent | f6737cde3e786b0e8acea4b613aa42cf49fa204c (diff) | |
| download | emacs-2d764c783d0ab96cc246f3bb1dad70f2ef56ce0f.tar.gz emacs-2d764c783d0ab96cc246f3bb1dad70f2ef56ce0f.zip | |
Changes for automatic remapping of X colors on terminal frames:
* xfaces.c (XColor) [!HAVE_X_WINDOWS]: Provide a typedef for non-X
frames.
(Vface_tty_color_alist): Remove.
(tty_defined_color): New function.
(defined_color): Rewrite to support any type of frame.
(tty_color_name): New function.
(face_color_supported_p, Fface_color_gray_p,
Fface_color_supported_p): Support non-X frames.
(load_color): Enclose the color name in quotes, in the log
messages. Remove DOS-specific version of load_color.
(realize_tty_face): Take the supported colors from
tty-color-alist. Support translation of X colors to the closest
tty color, for both MSDOS and tty frames.
[MSDOS]: Don't invert face colors if they were taken from the
frame colors.
(Fface_register_tty_color, Fface_clear_tty_colors): Remove.
* frame.h (struct x_output) [!MSDOS, !WINDOWSNT, !HAVE_X_WINDOWS]:
Define a mostly empty surrogate.
(tty_display): Declare.
* frame.c (make_terminal_frame) [!macintosh]: Don't use
tty_display.
(Fframe_parameters): Don't invert colors of non-FRAME_WINDOW_P
frames when the frame's param_alist includes 'reverse.
(tty_display): Define.
(make_terminal_frame) [!MSDOS]: Assign &tty_display to the
output_data.x member.
(Fframe_parameters): Return foreground and background color names
on tty frames as well, in addition to MSDOS frames.
* msdos.h (DisplayWidth, DisplayHeight): Changes for Lisp_Object
selected_frame.
(struct x_output): Remove unused members; document who uses each
member.
(FRAME_PARAM_FACES, FRAME_N_PARAM_FACES, FRAME_DEFAULT_PARAM_FACE,
FRAME_MODE_LINE_PARAM_FACE, FRAME_COMPUTED_FACES,
FRAME_N_COMPUTED_FACES, FRAME_SIZE_COMPUTED_FACES,
FRAME_DEFAULT_FACE, FRAME_MODE_LINE_FACE, unload_color): Remove
unused macro definintions.
* msdos.c (IT_set_frame_parameters): Don't call
recompute_basic_faces, the next redisplay will, anyway.
(x_current_display): Remove unused variable.
Many functions: changes for Lisp_object selected_frame.
(IT_set_face): If the tty_reverse_p flag is set for the face,
reverse the foreground and background colors.
(Fmsdos_remember_default_colors): New function.
(syms_of_msdos): Defsubr it.
(IT_set_frame_parameters): Use initial_screen_colors[] when
creating a new frame. If the frame parameters include 'reverse,
swap the foreground and background colors.
(internal_terminal_init): Initialize initial_screen_colors to -1.
(syms_of_msdos): Add DEFVAR_BOOL for x-stretch-cursor, to shut up
cus-start.el.
* Makefile.in (lisp, shortlisp): Add lisp/term/tty-colors.elc.
* xfns.c (x_defined_color): Rename from defined_color. All
callers changed.
(Fxw_color_defined_p): Renamed from Fx_color_defined_p;
all callers changed.
(Fxw_color_values): Renamed from Fx_color_values; all callers
changed.
(Fxw_display_color_p): Renamed from Fx_display_color_p; all
callers changed.
(x_window_to_frame, x_any_window_to_frame,
x_non_menubar_window_to_frame, x_menubar_window_to_frame,
x_top_window_to_frame): Use !FRAME_X_P instead of
f->output_data.nothing.
* xterm.h (x_defined_color): Rename from defined_color.
* w32fns.c (x_window_to_frame): Use FRAME_W32_P instead of
f->output_data.nothing.
(Fxw_color_defined_p): Renamed from Fx_color_defined_p;
all callers changed.
(Fxw_color_values): Renamed from Fx_color_values; all callers
changed.
(Fxw_display_color_p): Renamed from Fx_display_color_p; all
callers changed.
* dispextern.h (tty_color_name): Add prototype.
* xmenu.c (menubar_id_to_frame): Use FRAME_WINDOW_P instead of
f->output_data.nothing.
* w32menu.c (menubar_id_to_frame): Likewise.
* w32term.h (w32_output): Declare.
* dosfns.c (Qmsdos_color_translate): Remove.
(msdos_stdcolor_name): Now returns a Lisp_Object.
* dosfns.h (Qmsdos_color_translate): Remove.
* s/msdos.h (INTERNAL_TERMINAL): Add entries for color support.
Diffstat (limited to 'src/msdos.c')
| -rw-r--r-- | src/msdos.c | 229 |
1 files changed, 153 insertions, 76 deletions
diff --git a/src/msdos.c b/src/msdos.c index 7b8d74da31f..450d1273c02 100644 --- a/src/msdos.c +++ b/src/msdos.c | |||
| @@ -253,7 +253,7 @@ mouse_get_pos (f, insist, bar_window, part, x, y, time) | |||
| 253 | FOR_EACH_FRAME (tail, frame) | 253 | FOR_EACH_FRAME (tail, frame) |
| 254 | XFRAME (frame)->mouse_moved = 0; | 254 | XFRAME (frame)->mouse_moved = 0; |
| 255 | 255 | ||
| 256 | *f = selected_frame; | 256 | *f = SELECTED_FRAME(); |
| 257 | *bar_window = Qnil; | 257 | *bar_window = Qnil; |
| 258 | mouse_get_xy (&ix, &iy); | 258 | mouse_get_xy (&ix, &iy); |
| 259 | *time = event_timestamp (); | 259 | *time = event_timestamp (); |
| @@ -267,7 +267,7 @@ mouse_check_moved () | |||
| 267 | int x, y; | 267 | int x, y; |
| 268 | 268 | ||
| 269 | mouse_get_xy (&x, &y); | 269 | mouse_get_xy (&x, &y); |
| 270 | selected_frame->mouse_moved |= (x != mouse_last_x || y != mouse_last_y); | 270 | SELECTED_FRAME()->mouse_moved |= (x != mouse_last_x || y != mouse_last_y); |
| 271 | mouse_last_x = x; | 271 | mouse_last_x = x; |
| 272 | mouse_last_y = y; | 272 | mouse_last_y = y; |
| 273 | } | 273 | } |
| @@ -344,9 +344,6 @@ static int term_setup_done; | |||
| 344 | /* Similar to the_only_frame. */ | 344 | /* Similar to the_only_frame. */ |
| 345 | struct x_output the_only_x_display; | 345 | struct x_output the_only_x_display; |
| 346 | 346 | ||
| 347 | /* This is never dereferenced. */ | ||
| 348 | Display *x_current_display; | ||
| 349 | |||
| 350 | /* Support for DOS/V (allows Japanese characters to be displayed on | 347 | /* Support for DOS/V (allows Japanese characters to be displayed on |
| 351 | standard, non-Japanese, ATs). Only supported for DJGPP v2 and later. */ | 348 | standard, non-Japanese, ATs). Only supported for DJGPP v2 and later. */ |
| 352 | 349 | ||
| @@ -666,12 +663,13 @@ IT_ring_bell (void) | |||
| 666 | static void | 663 | static void |
| 667 | IT_set_face (int face) | 664 | IT_set_face (int face) |
| 668 | { | 665 | { |
| 669 | struct face *fp = FACE_FROM_ID (selected_frame, face); | 666 | struct frame *sf = SELECTED_FRAME(); |
| 667 | struct face *fp = FACE_FROM_ID (sf, face); | ||
| 670 | unsigned long fg, bg; | 668 | unsigned long fg, bg; |
| 671 | 669 | ||
| 672 | if (!fp) | 670 | if (!fp) |
| 673 | { | 671 | { |
| 674 | fp = FACE_FROM_ID (selected_frame, DEFAULT_FACE_ID); | 672 | fp = FACE_FROM_ID (sf, DEFAULT_FACE_ID); |
| 675 | /* The default face for the frame should always be realized and | 673 | /* The default face for the frame should always be realized and |
| 676 | cached. */ | 674 | cached. */ |
| 677 | if (!fp) | 675 | if (!fp) |
| @@ -688,11 +686,11 @@ IT_set_face (int face) | |||
| 688 | switches on this mode (and loses the blinking attribute) at | 686 | switches on this mode (and loses the blinking attribute) at |
| 689 | startup. */ | 687 | startup. */ |
| 690 | if (fg == (unsigned long)-1) | 688 | if (fg == (unsigned long)-1) |
| 691 | fg = highlight ? FRAME_BACKGROUND_PIXEL (selected_frame) | 689 | fg = highlight || fp->tty_reverse_p ? FRAME_BACKGROUND_PIXEL (sf) |
| 692 | : FRAME_FOREGROUND_PIXEL (selected_frame); | 690 | : FRAME_FOREGROUND_PIXEL (sf); |
| 693 | if (bg == (unsigned long)-1) | 691 | if (bg == (unsigned long)-1) |
| 694 | bg = highlight ? FRAME_FOREGROUND_PIXEL (selected_frame) | 692 | bg = highlight || fp->tty_reverse_p ? FRAME_FOREGROUND_PIXEL (sf) |
| 695 | : FRAME_BACKGROUND_PIXEL (selected_frame); | 693 | : FRAME_BACKGROUND_PIXEL (sf); |
| 696 | if (termscript) | 694 | if (termscript) |
| 697 | fprintf (termscript, "<FACE %d%s: %d/%d>", | 695 | fprintf (termscript, "<FACE %d%s: %d/%d>", |
| 698 | face, highlight ? "H" : "", fp->foreground, fp->background); | 696 | face, highlight ? "H" : "", fp->foreground, fp->background); |
| @@ -724,6 +722,7 @@ IT_write_glyphs (struct glyph *str, int str_len) | |||
| 724 | struct coding_system *coding = (CODING_REQUIRE_ENCODING (&terminal_coding) | 722 | struct coding_system *coding = (CODING_REQUIRE_ENCODING (&terminal_coding) |
| 725 | ? &terminal_coding | 723 | ? &terminal_coding |
| 726 | : &safe_terminal_coding); | 724 | : &safe_terminal_coding); |
| 725 | struct frame *sf; | ||
| 727 | 726 | ||
| 728 | /* Do we need to consider conversion of unibyte characters to | 727 | /* Do we need to consider conversion of unibyte characters to |
| 729 | multibyte? */ | 728 | multibyte? */ |
| @@ -735,6 +734,7 @@ IT_write_glyphs (struct glyph *str, int str_len) | |||
| 735 | 734 | ||
| 736 | screen_buf = screen_bp = alloca (str_len * 2); | 735 | screen_buf = screen_bp = alloca (str_len * 2); |
| 737 | screen_buf_end = screen_buf + str_len * 2; | 736 | screen_buf_end = screen_buf + str_len * 2; |
| 737 | sf = SELECTED_FRAME(); | ||
| 738 | 738 | ||
| 739 | /* Since faces get cached and uncached behind our back, we can't | 739 | /* Since faces get cached and uncached behind our back, we can't |
| 740 | rely on their indices in the cache being consistent across | 740 | rely on their indices in the cache being consistent across |
| @@ -783,8 +783,7 @@ IT_write_glyphs (struct glyph *str, int str_len) | |||
| 783 | { | 783 | { |
| 784 | g = !NILP (Vdos_unsupported_char_glyph) | 784 | g = !NILP (Vdos_unsupported_char_glyph) |
| 785 | ? Vdos_unsupported_char_glyph | 785 | ? Vdos_unsupported_char_glyph |
| 786 | : MAKE_GLYPH (selected_frame, '\177', | 786 | : MAKE_GLYPH (sf, '\177', GLYPH_FACE (sf, g)); |
| 787 | GLYPH_FACE (selected_frame, g)); | ||
| 788 | ch = FAST_GLYPH_CHAR (g); | 787 | ch = FAST_GLYPH_CHAR (g); |
| 789 | } | 788 | } |
| 790 | if (COMPOSITE_CHAR_P (ch)) | 789 | if (COMPOSITE_CHAR_P (ch)) |
| @@ -792,7 +791,7 @@ IT_write_glyphs (struct glyph *str, int str_len) | |||
| 792 | /* If CH is a composite character, we can display | 791 | /* If CH is a composite character, we can display |
| 793 | only the first component. */ | 792 | only the first component. */ |
| 794 | g = cmpchar_table[COMPOSITE_CHAR_ID (ch)]->glyph[0], | 793 | g = cmpchar_table[COMPOSITE_CHAR_ID (ch)]->glyph[0], |
| 795 | ch = GLYPH_CHAR (selected_frame, g); | 794 | ch = GLYPH_CHAR (sf, g); |
| 796 | cf = FAST_GLYPH_FACE (g); | 795 | cf = FAST_GLYPH_FACE (g); |
| 797 | } | 796 | } |
| 798 | 797 | ||
| @@ -931,13 +930,13 @@ IT_clear_end_of_line (int first_unused) | |||
| 931 | int offset = 2 * (new_pos_X + screen_size_X * new_pos_Y); | 930 | int offset = 2 * (new_pos_X + screen_size_X * new_pos_Y); |
| 932 | extern int fatal_error_in_progress; | 931 | extern int fatal_error_in_progress; |
| 933 | 932 | ||
| 934 | if (fatal_error_in_progress) | 933 | if (new_pos_X >= first_unused || fatal_error_in_progress) |
| 935 | return; | 934 | return; |
| 936 | 935 | ||
| 937 | IT_set_face (0); | 936 | IT_set_face (0); |
| 938 | if (termscript) | 937 | if (termscript) |
| 939 | fprintf (termscript, "<CLR:EOL>"); | 938 | fprintf (termscript, "<CLR:EOL>"); |
| 940 | i = (j = screen_size_X - new_pos_X) * 2; | 939 | i = (j = first_unused - new_pos_X) * 2; |
| 941 | spaces = sp = alloca (i); | 940 | spaces = sp = alloca (i); |
| 942 | 941 | ||
| 943 | while (--j >= 0) | 942 | while (--j >= 0) |
| @@ -950,6 +949,10 @@ IT_clear_end_of_line (int first_unused) | |||
| 950 | dosmemput (spaces, i, (int)ScreenPrimary + offset); | 949 | dosmemput (spaces, i, (int)ScreenPrimary + offset); |
| 951 | if (screen_virtual_segment) | 950 | if (screen_virtual_segment) |
| 952 | dosv_refresh_virtual_screen (offset, i / 2); | 951 | dosv_refresh_virtual_screen (offset, i / 2); |
| 952 | |||
| 953 | /* clear_end_of_line_raw on term.c leaves the cursor at first_unused. | ||
| 954 | Let's follow their lead, in case someone relies on this. */ | ||
| 955 | new_pos_X = first_unused; | ||
| 953 | } | 956 | } |
| 954 | 957 | ||
| 955 | static void | 958 | static void |
| @@ -1028,9 +1031,15 @@ IT_cmgoto (FRAME_PTR f) | |||
| 1028 | { | 1031 | { |
| 1029 | /* Only set the cursor to where it should be if the display is | 1032 | /* Only set the cursor to where it should be if the display is |
| 1030 | already in sync with the window contents. */ | 1033 | already in sync with the window contents. */ |
| 1031 | int update_cursor_pos = MODIFF == unchanged_modified; | 1034 | int update_cursor_pos = 1; /* MODIFF == unchanged_modified; */ |
| 1035 | |||
| 1036 | /* FIXME: This needs to be rewritten for the new redisplay, or | ||
| 1037 | removed. */ | ||
| 1038 | #if 0 | ||
| 1032 | static int previous_pos_X = -1; | 1039 | static int previous_pos_X = -1; |
| 1033 | 1040 | ||
| 1041 | update_cursor_pos = 1; /* temporary!!! */ | ||
| 1042 | |||
| 1034 | /* If the display is in sync, forget any previous knowledge about | 1043 | /* If the display is in sync, forget any previous knowledge about |
| 1035 | cursor position. This is primarily for unexpected events like | 1044 | cursor position. This is primarily for unexpected events like |
| 1036 | C-g in the minibuffer. */ | 1045 | C-g in the minibuffer. */ |
| @@ -1066,6 +1075,7 @@ IT_cmgoto (FRAME_PTR f) | |||
| 1066 | update_cursor_pos = 1; | 1075 | update_cursor_pos = 1; |
| 1067 | } | 1076 | } |
| 1068 | } | 1077 | } |
| 1078 | #endif | ||
| 1069 | 1079 | ||
| 1070 | if (update_cursor_pos | 1080 | if (update_cursor_pos |
| 1071 | && (current_pos_X != new_pos_X || current_pos_Y != new_pos_Y)) | 1081 | && (current_pos_X != new_pos_X || current_pos_Y != new_pos_Y)) |
| @@ -1088,14 +1098,12 @@ static void | |||
| 1088 | IT_reassert_line_highlight (int new, int vpos) | 1098 | IT_reassert_line_highlight (int new, int vpos) |
| 1089 | { | 1099 | { |
| 1090 | highlight = new; | 1100 | highlight = new; |
| 1091 | IT_set_face (0); /* To possibly clear the highlighting. */ | ||
| 1092 | } | 1101 | } |
| 1093 | 1102 | ||
| 1094 | static void | 1103 | static void |
| 1095 | IT_change_line_highlight (int new_highlight, int y, int vpos, int first_unused_hpos) | 1104 | IT_change_line_highlight (int new_highlight, int y, int vpos, int first_unused_hpos) |
| 1096 | { | 1105 | { |
| 1097 | highlight = new_highlight; | 1106 | highlight = new_highlight; |
| 1098 | IT_set_face (0); /* To possibly clear the highlighting. */ | ||
| 1099 | IT_cursor_to (vpos, 0); | 1107 | IT_cursor_to (vpos, 0); |
| 1100 | IT_clear_end_of_line (first_unused_hpos); | 1108 | IT_clear_end_of_line (first_unused_hpos); |
| 1101 | } | 1109 | } |
| @@ -1104,8 +1112,6 @@ static void | |||
| 1104 | IT_update_begin (struct frame *foo) | 1112 | IT_update_begin (struct frame *foo) |
| 1105 | { | 1113 | { |
| 1106 | highlight = 0; | 1114 | highlight = 0; |
| 1107 | IT_set_face (0); /* To possibly clear the highlighting. */ | ||
| 1108 | screen_face = -1; | ||
| 1109 | } | 1115 | } |
| 1110 | 1116 | ||
| 1111 | static void | 1117 | static void |
| @@ -1341,6 +1347,30 @@ IT_set_terminal_window (int foo) | |||
| 1341 | { | 1347 | { |
| 1342 | } | 1348 | } |
| 1343 | 1349 | ||
| 1350 | /* Remember the screen colors of the curent frame, to serve as the | ||
| 1351 | default colors for newly-created frames. */ | ||
| 1352 | |||
| 1353 | static int initial_screen_colors[2]; | ||
| 1354 | |||
| 1355 | DEFUN ("msdos-remember-default-colors", Fmsdos_remember_default_colors, | ||
| 1356 | Smsdos_remember_default_colors, 1, 1, 0, | ||
| 1357 | "Remember the screen colors of the current frame.") | ||
| 1358 | (frame) | ||
| 1359 | Lisp_Object frame; | ||
| 1360 | { | ||
| 1361 | int reverse; | ||
| 1362 | struct frame *f; | ||
| 1363 | |||
| 1364 | CHECK_FRAME (frame, 0); | ||
| 1365 | f= XFRAME (frame); | ||
| 1366 | reverse = EQ (Fcdr (Fassq (intern ("reverse"), f->param_alist)), Qt); | ||
| 1367 | |||
| 1368 | initial_screen_colors[0] | ||
| 1369 | = reverse ? FRAME_BACKGROUND_PIXEL (f) : FRAME_FOREGROUND_PIXEL (f); | ||
| 1370 | initial_screen_colors[1] | ||
| 1371 | = reverse ? FRAME_FOREGROUND_PIXEL (f) : FRAME_BACKGROUND_PIXEL (f); | ||
| 1372 | } | ||
| 1373 | |||
| 1344 | void | 1374 | void |
| 1345 | IT_set_frame_parameters (f, alist) | 1375 | IT_set_frame_parameters (f, alist) |
| 1346 | struct frame *f; | 1376 | struct frame *f; |
| @@ -1348,18 +1378,29 @@ IT_set_frame_parameters (f, alist) | |||
| 1348 | { | 1378 | { |
| 1349 | Lisp_Object tail; | 1379 | Lisp_Object tail; |
| 1350 | int length = XINT (Flength (alist)); | 1380 | int length = XINT (Flength (alist)); |
| 1351 | int i; | 1381 | int i, j; |
| 1352 | Lisp_Object *parms | 1382 | Lisp_Object *parms |
| 1353 | = (Lisp_Object *) alloca (length * sizeof (Lisp_Object)); | 1383 | = (Lisp_Object *) alloca (length * sizeof (Lisp_Object)); |
| 1354 | Lisp_Object *values | 1384 | Lisp_Object *values |
| 1355 | = (Lisp_Object *) alloca (length * sizeof (Lisp_Object)); | 1385 | = (Lisp_Object *) alloca (length * sizeof (Lisp_Object)); |
| 1356 | int redraw; | 1386 | Lisp_Object qreverse = intern ("reverse"); |
| 1357 | struct face *dflt = NULL; | 1387 | /* Do we have to reverse the foreground and background colors? */ |
| 1358 | 1388 | int reverse = EQ (Fcdr (Fassq (qreverse, f->param_alist)), Qt); | |
| 1359 | if (FRAME_FACE_CACHE (f)) | 1389 | int was_reverse = reverse; |
| 1360 | dflt = FACE_FROM_ID (f, DEFAULT_FACE_ID); | 1390 | int redraw = 0, fg_set = 0, bg_set = 0; |
| 1361 | 1391 | unsigned long orig_fg; | |
| 1362 | redraw = 0; | 1392 | unsigned long orig_bg; |
| 1393 | |||
| 1394 | /* If we are creating a new frame, begin with the original screen colors | ||
| 1395 | used for the initial frame. */ | ||
| 1396 | if (alist == Vdefault_frame_alist | ||
| 1397 | && initial_screen_colors[0] != -1 && initial_screen_colors[1] != -1) | ||
| 1398 | { | ||
| 1399 | FRAME_FOREGROUND_PIXEL (f) = initial_screen_colors[0]; | ||
| 1400 | FRAME_BACKGROUND_PIXEL (f) = initial_screen_colors[1]; | ||
| 1401 | } | ||
| 1402 | orig_fg = FRAME_FOREGROUND_PIXEL (f); | ||
| 1403 | orig_bg = FRAME_BACKGROUND_PIXEL (f); | ||
| 1363 | 1404 | ||
| 1364 | /* Extract parm names and values into those vectors. */ | 1405 | /* Extract parm names and values into those vectors. */ |
| 1365 | i = 0; | 1406 | i = 0; |
| @@ -1374,8 +1415,21 @@ IT_set_frame_parameters (f, alist) | |||
| 1374 | i++; | 1415 | i++; |
| 1375 | } | 1416 | } |
| 1376 | 1417 | ||
| 1418 | j = i; | ||
| 1377 | 1419 | ||
| 1378 | /* Now process them in reverse of specified order. */ | 1420 | for (i = 0; i < j; i++) |
| 1421 | { | ||
| 1422 | Lisp_Object prop = parms[i]; | ||
| 1423 | Lisp_Object val = values[i]; | ||
| 1424 | |||
| 1425 | if (EQ (prop, qreverse)) | ||
| 1426 | reverse = EQ (val, Qt); | ||
| 1427 | } | ||
| 1428 | |||
| 1429 | if (termscript && reverse && !was_reverse) | ||
| 1430 | fprintf (termscript, "<INVERSE-VIDEO>\n"); | ||
| 1431 | |||
| 1432 | /* Now process the alist elements in reverse of specified order. */ | ||
| 1379 | for (i--; i >= 0; i--) | 1433 | for (i--; i >= 0; i--) |
| 1380 | { | 1434 | { |
| 1381 | Lisp_Object prop = parms[i]; | 1435 | Lisp_Object prop = parms[i]; |
| @@ -1383,30 +1437,36 @@ IT_set_frame_parameters (f, alist) | |||
| 1383 | 1437 | ||
| 1384 | if (EQ (prop, Qforeground_color)) | 1438 | if (EQ (prop, Qforeground_color)) |
| 1385 | { | 1439 | { |
| 1386 | unsigned long new_color = load_color (f, NULL, val, | 1440 | unsigned long new_color = load_color (f, NULL, val, reverse |
| 1387 | LFACE_FOREGROUND_INDEX); | 1441 | ? LFACE_BACKGROUND_INDEX |
| 1442 | : LFACE_FOREGROUND_INDEX); | ||
| 1388 | if (new_color != ~0) | 1443 | if (new_color != ~0) |
| 1389 | { | 1444 | { |
| 1390 | if (!dflt) | 1445 | if (reverse) |
| 1391 | abort (); | 1446 | /* FIXME: should the fore-/background of the default |
| 1392 | FRAME_FOREGROUND_PIXEL (f) = new_color; | 1447 | face change here as well? */ |
| 1393 | dflt->foreground = new_color; | 1448 | FRAME_BACKGROUND_PIXEL (f) = new_color; |
| 1449 | else | ||
| 1450 | FRAME_FOREGROUND_PIXEL (f) = new_color; | ||
| 1394 | redraw = 1; | 1451 | redraw = 1; |
| 1452 | fg_set = 1; | ||
| 1395 | if (termscript) | 1453 | if (termscript) |
| 1396 | fprintf (termscript, "<FGCOLOR %lu>\n", new_color); | 1454 | fprintf (termscript, "<FGCOLOR %lu>\n", new_color); |
| 1397 | } | 1455 | } |
| 1398 | } | 1456 | } |
| 1399 | else if (EQ (prop, Qbackground_color)) | 1457 | else if (EQ (prop, Qbackground_color)) |
| 1400 | { | 1458 | { |
| 1401 | unsigned long new_color = load_color (f, NULL, val, | 1459 | unsigned long new_color = load_color (f, NULL, val, reverse |
| 1402 | LFACE_BACKGROUND_INDEX); | 1460 | ? LFACE_FOREGROUND_INDEX |
| 1461 | : LFACE_BACKGROUND_INDEX); | ||
| 1403 | if (new_color != ~0) | 1462 | if (new_color != ~0) |
| 1404 | { | 1463 | { |
| 1405 | if (!dflt) | 1464 | if (reverse) |
| 1406 | abort (); | 1465 | FRAME_FOREGROUND_PIXEL (f) = new_color; |
| 1407 | FRAME_BACKGROUND_PIXEL (f) = new_color; | 1466 | else |
| 1408 | dflt->background = new_color; | 1467 | FRAME_BACKGROUND_PIXEL (f) = new_color; |
| 1409 | redraw = 1; | 1468 | redraw = 1; |
| 1469 | bg_set = 1; | ||
| 1410 | if (termscript) | 1470 | if (termscript) |
| 1411 | fprintf (termscript, "<BGCOLOR %lu>\n", new_color); | 1471 | fprintf (termscript, "<BGCOLOR %lu>\n", new_color); |
| 1412 | } | 1472 | } |
| @@ -1417,27 +1477,29 @@ IT_set_frame_parameters (f, alist) | |||
| 1417 | if (termscript) | 1477 | if (termscript) |
| 1418 | fprintf (termscript, "<TITLE: %s>\n", XSTRING (val)->data); | 1478 | fprintf (termscript, "<TITLE: %s>\n", XSTRING (val)->data); |
| 1419 | } | 1479 | } |
| 1420 | else if (EQ (prop, intern ("reverse")) && EQ (val, Qt)) | ||
| 1421 | { | ||
| 1422 | unsigned long fg = FRAME_FOREGROUND_PIXEL (f); | ||
| 1423 | |||
| 1424 | if (!dflt) | ||
| 1425 | abort (); | ||
| 1426 | FRAME_FOREGROUND_PIXEL (f) = FRAME_BACKGROUND_PIXEL (f); /* FIXME! */ | ||
| 1427 | FRAME_BACKGROUND_PIXEL (f) = fg; | ||
| 1428 | dflt->foreground = FRAME_FOREGROUND_PIXEL (f); | ||
| 1429 | dflt->foreground = fg; | ||
| 1430 | if (termscript) | ||
| 1431 | fprintf (termscript, "<INVERSE-VIDEO>\n"); | ||
| 1432 | } | ||
| 1433 | store_frame_param (f, prop, val); | 1480 | store_frame_param (f, prop, val); |
| 1481 | } | ||
| 1434 | 1482 | ||
| 1483 | /* If they specified "reverse", but not the colors, we need to swap | ||
| 1484 | the current frame colors. */ | ||
| 1485 | if (reverse && !was_reverse) | ||
| 1486 | { | ||
| 1487 | if (!fg_set) | ||
| 1488 | { | ||
| 1489 | FRAME_BACKGROUND_PIXEL (f) = orig_fg; | ||
| 1490 | redraw = 1; | ||
| 1491 | } | ||
| 1492 | if (!bg_set) | ||
| 1493 | { | ||
| 1494 | FRAME_FOREGROUND_PIXEL (f) = orig_bg; | ||
| 1495 | redraw = 1; | ||
| 1496 | } | ||
| 1435 | } | 1497 | } |
| 1436 | 1498 | ||
| 1437 | if (redraw) | 1499 | if (redraw) |
| 1438 | { | 1500 | { |
| 1439 | recompute_basic_faces (f); | 1501 | face_change_count++; /* forces xdisp.c to recompute basic faces */ |
| 1440 | if (f == selected_frame) | 1502 | if (f == SELECTED_FRAME()) |
| 1441 | redraw_frame (f); | 1503 | redraw_frame (f); |
| 1442 | } | 1504 | } |
| 1443 | } | 1505 | } |
| @@ -1454,6 +1516,7 @@ internal_terminal_init () | |||
| 1454 | { | 1516 | { |
| 1455 | char *term = getenv ("TERM"); | 1517 | char *term = getenv ("TERM"); |
| 1456 | char *colors; | 1518 | char *colors; |
| 1519 | struct frame *sf = SELECTED_FRAME(); | ||
| 1457 | 1520 | ||
| 1458 | #ifdef HAVE_X_WINDOWS | 1521 | #ifdef HAVE_X_WINDOWS |
| 1459 | if (!inhibit_window_system) | 1522 | if (!inhibit_window_system) |
| @@ -1469,16 +1532,20 @@ internal_terminal_init () | |||
| 1469 | #ifndef HAVE_X_WINDOWS | 1532 | #ifndef HAVE_X_WINDOWS |
| 1470 | if (!internal_terminal || inhibit_window_system) | 1533 | if (!internal_terminal || inhibit_window_system) |
| 1471 | { | 1534 | { |
| 1472 | selected_frame->output_method = output_termcap; | 1535 | sf->output_method = output_termcap; |
| 1473 | return; | 1536 | return; |
| 1474 | } | 1537 | } |
| 1475 | 1538 | ||
| 1476 | Vwindow_system = intern ("pc"); | 1539 | Vwindow_system = intern ("pc"); |
| 1477 | Vwindow_system_version = make_number (1); | 1540 | Vwindow_system_version = make_number (1); |
| 1541 | sf->output_method = output_msdos_raw; | ||
| 1478 | 1542 | ||
| 1479 | /* If Emacs was dumped on DOS/V machine, forget the stale VRAM address. */ | 1543 | /* If Emacs was dumped on DOS/V machine, forget the stale VRAM address. */ |
| 1480 | screen_old_address = 0; | 1544 | screen_old_address = 0; |
| 1481 | 1545 | ||
| 1546 | /* Forget the stale screen colors as well. */ | ||
| 1547 | initial_screen_colors[0] = initial_screen_colors[1] = -1; | ||
| 1548 | |||
| 1482 | bzero (&the_only_x_display, sizeof the_only_x_display); | 1549 | bzero (&the_only_x_display, sizeof the_only_x_display); |
| 1483 | the_only_x_display.background_pixel = 7; /* White */ | 1550 | the_only_x_display.background_pixel = 7; /* White */ |
| 1484 | the_only_x_display.foreground_pixel = 0; /* Black */ | 1551 | the_only_x_display.foreground_pixel = 0; /* Black */ |
| @@ -1503,7 +1570,7 @@ internal_terminal_init () | |||
| 1503 | the_only_x_display.line_height = 1; | 1570 | the_only_x_display.line_height = 1; |
| 1504 | the_only_x_display.font = (XFontStruct *)1; /* must *not* be zero */ | 1571 | the_only_x_display.font = (XFontStruct *)1; /* must *not* be zero */ |
| 1505 | 1572 | ||
| 1506 | init_frame_faces (selected_frame); | 1573 | init_frame_faces (sf); |
| 1507 | 1574 | ||
| 1508 | ring_bell_hook = IT_ring_bell; | 1575 | ring_bell_hook = IT_ring_bell; |
| 1509 | insert_glyphs_hook = IT_insert_glyphs; | 1576 | insert_glyphs_hook = IT_insert_glyphs; |
| @@ -1548,8 +1615,8 @@ dos_get_saved_screen (screen, rows, cols) | |||
| 1548 | void | 1615 | void |
| 1549 | check_x (void) | 1616 | check_x (void) |
| 1550 | { | 1617 | { |
| 1551 | if (! FRAME_MSDOS_P (selected_frame)) | 1618 | if (! FRAME_MSDOS_P (SELECTED_FRAME())) |
| 1552 | error ("Not running under a windows system"); | 1619 | error ("Not running under a window system"); |
| 1553 | } | 1620 | } |
| 1554 | 1621 | ||
| 1555 | #endif | 1622 | #endif |
| @@ -2081,7 +2148,7 @@ dos_rawgetc () | |||
| 2081 | 2148 | ||
| 2082 | #ifndef HAVE_X_WINDOWS | 2149 | #ifndef HAVE_X_WINDOWS |
| 2083 | /* Maybe put the cursor where it should be. */ | 2150 | /* Maybe put the cursor where it should be. */ |
| 2084 | IT_cmgoto (selected_frame); | 2151 | IT_cmgoto (SELECTED_FRAME()); |
| 2085 | #endif | 2152 | #endif |
| 2086 | 2153 | ||
| 2087 | /* The following condition is equivalent to `kbhit ()', except that | 2154 | /* The following condition is equivalent to `kbhit ()', except that |
| @@ -2294,7 +2361,7 @@ dos_rawgetc () | |||
| 2294 | event.kind = ascii_keystroke; | 2361 | event.kind = ascii_keystroke; |
| 2295 | event.code = code; | 2362 | event.code = code; |
| 2296 | event.modifiers = modifiers; | 2363 | event.modifiers = modifiers; |
| 2297 | XSETFRAME (event.frame_or_window, selected_frame); | 2364 | event.frame_or_window = selected_frame; |
| 2298 | event.timestamp = event_timestamp (); | 2365 | event.timestamp = event_timestamp (); |
| 2299 | kbd_buffer_store_event (&event); | 2366 | kbd_buffer_store_event (&event); |
| 2300 | } | 2367 | } |
| @@ -2344,7 +2411,7 @@ dos_rawgetc () | |||
| 2344 | | (press ? down_modifier : up_modifier); | 2411 | | (press ? down_modifier : up_modifier); |
| 2345 | event.x = x; | 2412 | event.x = x; |
| 2346 | event.y = y; | 2413 | event.y = y; |
| 2347 | XSETFRAME (event.frame_or_window, selected_frame); | 2414 | event.frame_or_window = selected_frame; |
| 2348 | event.timestamp = event_timestamp (); | 2415 | event.timestamp = event_timestamp (); |
| 2349 | kbd_buffer_store_event (&event); | 2416 | kbd_buffer_store_event (&event); |
| 2350 | } | 2417 | } |
| @@ -2503,12 +2570,13 @@ IT_menu_display (XMenu *menu, int y, int x, int *faces) | |||
| 2503 | int mx, my; | 2570 | int mx, my; |
| 2504 | int enabled, mousehere; | 2571 | int enabled, mousehere; |
| 2505 | int row, col; | 2572 | int row, col; |
| 2573 | struct frame *sf = SELECTED_FRAME(); | ||
| 2506 | 2574 | ||
| 2507 | width = menu->width; | 2575 | width = menu->width; |
| 2508 | text = (struct glyph *) xmalloc ((width + 2) * sizeof (struct glyph)); | 2576 | text = (struct glyph *) xmalloc ((width + 2) * sizeof (struct glyph)); |
| 2509 | ScreenGetCursor (&row, &col); | 2577 | ScreenGetCursor (&row, &col); |
| 2510 | mouse_get_xy (&mx, &my); | 2578 | mouse_get_xy (&mx, &my); |
| 2511 | IT_update_begin (selected_frame); | 2579 | IT_update_begin (sf); |
| 2512 | for (i = 0; i < menu->count; i++) | 2580 | for (i = 0; i < menu->count; i++) |
| 2513 | { | 2581 | { |
| 2514 | IT_cursor_to (y + i, x); | 2582 | IT_cursor_to (y + i, x); |
| @@ -2543,7 +2611,7 @@ IT_menu_display (XMenu *menu, int y, int x, int *faces) | |||
| 2543 | p++; | 2611 | p++; |
| 2544 | IT_write_glyphs (text, width + 2); | 2612 | IT_write_glyphs (text, width + 2); |
| 2545 | } | 2613 | } |
| 2546 | IT_update_end (selected_frame); | 2614 | IT_update_end (sf); |
| 2547 | IT_cursor_to (row, col); | 2615 | IT_cursor_to (row, col); |
| 2548 | xfree (text); | 2616 | xfree (text); |
| 2549 | } | 2617 | } |
| @@ -2663,6 +2731,7 @@ XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx, | |||
| 2663 | int leave, result, onepane; | 2731 | int leave, result, onepane; |
| 2664 | int title_faces[4]; /* face to display the menu title */ | 2732 | int title_faces[4]; /* face to display the menu title */ |
| 2665 | int buffers_num_deleted = 0; | 2733 | int buffers_num_deleted = 0; |
| 2734 | struct frame *sf = SELECTED_FRAME(); | ||
| 2666 | 2735 | ||
| 2667 | /* Just in case we got here without a mouse present... */ | 2736 | /* Just in case we got here without a mouse present... */ |
| 2668 | if (have_mouse <= 0) | 2737 | if (have_mouse <= 0) |
| @@ -2681,15 +2750,15 @@ XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx, | |||
| 2681 | state = alloca (menu->panecount * sizeof (struct IT_menu_state)); | 2750 | state = alloca (menu->panecount * sizeof (struct IT_menu_state)); |
| 2682 | screensize = screen_size * 2; | 2751 | screensize = screen_size * 2; |
| 2683 | faces[0] | 2752 | faces[0] |
| 2684 | = lookup_derived_face (selected_frame, intern ("msdos-menu-passive-face"), | 2753 | = lookup_derived_face (sf, intern ("msdos-menu-passive-face"), |
| 2685 | CHARSET_ASCII, DEFAULT_FACE_ID); | 2754 | CHARSET_ASCII, DEFAULT_FACE_ID); |
| 2686 | faces[1] | 2755 | faces[1] |
| 2687 | = lookup_derived_face (selected_frame, intern ("msdos-menu-active-face"), | 2756 | = lookup_derived_face (sf, intern ("msdos-menu-active-face"), |
| 2688 | CHARSET_ASCII, DEFAULT_FACE_ID); | 2757 | CHARSET_ASCII, DEFAULT_FACE_ID); |
| 2689 | selectface = intern ("msdos-menu-select-face"); | 2758 | selectface = intern ("msdos-menu-select-face"); |
| 2690 | faces[2] = lookup_derived_face (selected_frame, selectface, | 2759 | faces[2] = lookup_derived_face (sf, selectface, |
| 2691 | CHARSET_ASCII, faces[0]); | 2760 | CHARSET_ASCII, faces[0]); |
| 2692 | faces[3] = lookup_derived_face (selected_frame, selectface, | 2761 | faces[3] = lookup_derived_face (sf, selectface, |
| 2693 | CHARSET_ASCII, faces[1]); | 2762 | CHARSET_ASCII, faces[1]); |
| 2694 | 2763 | ||
| 2695 | /* Make sure the menu title is always displayed with | 2764 | /* Make sure the menu title is always displayed with |
| @@ -2740,9 +2809,9 @@ XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx, | |||
| 2740 | { | 2809 | { |
| 2741 | if (!mouse_visible) mouse_on (); | 2810 | if (!mouse_visible) mouse_on (); |
| 2742 | mouse_check_moved (); | 2811 | mouse_check_moved (); |
| 2743 | if (selected_frame->mouse_moved) | 2812 | if (sf->mouse_moved) |
| 2744 | { | 2813 | { |
| 2745 | selected_frame->mouse_moved = 0; | 2814 | sf->mouse_moved = 0; |
| 2746 | result = XM_IA_SELECT; | 2815 | result = XM_IA_SELECT; |
| 2747 | mouse_get_xy (&x, &y); | 2816 | mouse_get_xy (&x, &y); |
| 2748 | for (i = 0; i < statecount; i++) | 2817 | for (i = 0; i < statecount; i++) |
| @@ -2924,8 +2993,8 @@ getdefdir (drive, dst) | |||
| 2924 | *p = '\0'; | 2993 | *p = '\0'; |
| 2925 | errno = 0; | 2994 | errno = 0; |
| 2926 | _fixpath (in_path, dst); | 2995 | _fixpath (in_path, dst); |
| 2927 | /* _fixpath can set errno to ENOSYS on non-LFN systems because | 2996 | /* _fixpath can set errno to ENOSYS on non-LFN systems because |
| 2928 | it queries the LFN support, so ignore that error. */ | 2997 | it queries the LFN support, so ignore that error. */ |
| 2929 | if ((errno && errno != ENOSYS) || *dst == '\0') | 2998 | if ((errno && errno != ENOSYS) || *dst == '\0') |
| 2930 | return 0; | 2999 | return 0; |
| 2931 | 3000 | ||
| @@ -4075,11 +4144,12 @@ abort () | |||
| 4075 | } | 4144 | } |
| 4076 | #endif | 4145 | #endif |
| 4077 | 4146 | ||
| 4078 | /* The following two are required so that customization feature | 4147 | /* The following variables are required so that cus-start.el won't |
| 4079 | won't complain about unbound variables. */ | 4148 | complain about unbound variables. */ |
| 4080 | #ifndef HAVE_X_WINDOWS | 4149 | #ifndef HAVE_X_WINDOWS |
| 4081 | /* Search path for bitmap files (xfns.c). */ | 4150 | /* Search path for bitmap files (xfns.c). */ |
| 4082 | Lisp_Object Vx_bitmap_file_path; | 4151 | Lisp_Object Vx_bitmap_file_path; |
| 4152 | int x_stretch_cursor_p; | ||
| 4083 | #endif | 4153 | #endif |
| 4084 | #ifndef subprocesses | 4154 | #ifndef subprocesses |
| 4085 | /* Nonzero means delete a process right away if it exits (process.c). */ | 4155 | /* Nonzero means delete a process right away if it exits (process.c). */ |
| @@ -4095,6 +4165,12 @@ syms_of_msdos () | |||
| 4095 | "List of directories to search for bitmap files for X."); | 4165 | "List of directories to search for bitmap files for X."); |
| 4096 | Vx_bitmap_file_path = decode_env_path ((char *) 0, "."); | 4166 | Vx_bitmap_file_path = decode_env_path ((char *) 0, "."); |
| 4097 | 4167 | ||
| 4168 | DEFVAR_BOOL ("x-stretch-cursor", &x_stretch_cursor_p, | ||
| 4169 | "*Non-nil means draw block cursor as wide as the glyph under it.\n\ | ||
| 4170 | For example, if a block cursor is over a tab, it will be drawn as\n\ | ||
| 4171 | wide as that tab on the display. (No effect on MS-DOS.)"); | ||
| 4172 | x_stretch_cursor_p = 0; | ||
| 4173 | |||
| 4098 | /* The following three are from xfns.c: */ | 4174 | /* The following three are from xfns.c: */ |
| 4099 | Qbackground_color = intern ("background-color"); | 4175 | Qbackground_color = intern ("background-color"); |
| 4100 | staticpro (&Qbackground_color); | 4176 | staticpro (&Qbackground_color); |
| @@ -4117,6 +4193,7 @@ nil means don't delete them until `list-processes' is run."); | |||
| 4117 | defsubr (&Srecent_doskeys); | 4193 | defsubr (&Srecent_doskeys); |
| 4118 | defsubr (&Smsdos_long_file_names); | 4194 | defsubr (&Smsdos_long_file_names); |
| 4119 | defsubr (&Smsdos_downcase_filename); | 4195 | defsubr (&Smsdos_downcase_filename); |
| 4196 | defsubr (&Smsdos_remember_default_colors); | ||
| 4120 | } | 4197 | } |
| 4121 | 4198 | ||
| 4122 | #endif /* MSDOS */ | 4199 | #endif /* MSDOS */ |