diff options
| author | Richard M. Stallman | 1996-06-10 21:03:05 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-06-10 21:03:05 +0000 |
| commit | 3bb1f22f68d7110cd77fcdd090c35b21fa96c6ad (patch) | |
| tree | a0b8d8f696c851ebca33d5335e2ef20615d3b66e /src | |
| parent | 964efc336323e05325bcc913a79cf2854011818b (diff) | |
| download | emacs-3bb1f22f68d7110cd77fcdd090c35b21fa96c6ad.tar.gz emacs-3bb1f22f68d7110cd77fcdd090c35b21fa96c6ad.zip | |
(check_x): Fix error message.
(x_set_menu_bar_lines): New function, copied from xfns.c.
(IT_set_frame_parameters): Use selected_frame instead of
the_only_frame.
(internal_terminal_init): Use selected_frame instead of the_only_frame.
(check_x): New function, replacing macro in msdos.h.
(XMenuActivate): Use selected_frame instead of
the_only_frame. Don't let the title for the "Buffers" popup
include a number when it is split into several menus.
Diffstat (limited to 'src')
| -rw-r--r-- | src/msdos.c | 99 |
1 files changed, 72 insertions, 27 deletions
diff --git a/src/msdos.c b/src/msdos.c index b5218406f3b..a157e1c84bc 100644 --- a/src/msdos.c +++ b/src/msdos.c | |||
| @@ -677,7 +677,10 @@ IT_update_end () | |||
| 677 | { | 677 | { |
| 678 | } | 678 | } |
| 679 | 679 | ||
| 680 | /* This was more or less copied from xterm.c */ | 680 | /* This was more or less copied from xterm.c |
| 681 | |||
| 682 | Nowadays, the corresponding function under X is `x_set_menu_bar_lines_1' | ||
| 683 | on xfns.c */ | ||
| 681 | 684 | ||
| 682 | static void | 685 | static void |
| 683 | IT_set_menu_bar_lines (window, n) | 686 | IT_set_menu_bar_lines (window, n) |
| @@ -702,6 +705,32 @@ IT_set_menu_bar_lines (window, n) | |||
| 702 | } | 705 | } |
| 703 | } | 706 | } |
| 704 | 707 | ||
| 708 | /* This was copied from xfns.c */ | ||
| 709 | |||
| 710 | void | ||
| 711 | x_set_menu_bar_lines (f, value, oldval) | ||
| 712 | struct frame *f; | ||
| 713 | Lisp_Object value, oldval; | ||
| 714 | { | ||
| 715 | int nlines; | ||
| 716 | int olines = FRAME_MENU_BAR_LINES (f); | ||
| 717 | |||
| 718 | /* Right now, menu bars don't work properly in minibuf-only frames; | ||
| 719 | most of the commands try to apply themselves to the minibuffer | ||
| 720 | frame itslef, and get an error because you can't switch buffers | ||
| 721 | in or split the minibuffer window. */ | ||
| 722 | if (FRAME_MINIBUF_ONLY_P (f)) | ||
| 723 | return; | ||
| 724 | |||
| 725 | if (INTEGERP (value)) | ||
| 726 | nlines = XINT (value); | ||
| 727 | else | ||
| 728 | nlines = 0; | ||
| 729 | |||
| 730 | FRAME_MENU_BAR_LINES (f) = nlines; | ||
| 731 | IT_set_menu_bar_lines (f->root_window, nlines - olines); | ||
| 732 | } | ||
| 733 | |||
| 705 | /* IT_set_terminal_modes is called when emacs is started, | 734 | /* IT_set_terminal_modes is called when emacs is started, |
| 706 | resumed, and whenever the screen is redrawn! */ | 735 | resumed, and whenever the screen is redrawn! */ |
| 707 | 736 | ||
| @@ -813,14 +842,13 @@ IT_set_terminal_window (void) | |||
| 813 | } | 842 | } |
| 814 | 843 | ||
| 815 | void | 844 | void |
| 816 | IT_set_frame_parameters (frame, alist) | 845 | IT_set_frame_parameters (f, alist) |
| 817 | FRAME_PTR frame; | 846 | FRAME_PTR f; |
| 818 | Lisp_Object alist; | 847 | Lisp_Object alist; |
| 819 | { | 848 | { |
| 820 | Lisp_Object tail; | 849 | Lisp_Object tail; |
| 821 | int redraw; | 850 | int redraw; |
| 822 | extern unsigned long load_color (); | 851 | extern unsigned long load_color (); |
| 823 | FRAME_PTR f = (FRAME_PTR) &the_only_frame; | ||
| 824 | 852 | ||
| 825 | redraw = 0; | 853 | redraw = 0; |
| 826 | for (tail = alist; CONSP (tail); tail = Fcdr (tail)) | 854 | for (tail = alist; CONSP (tail); tail = Fcdr (tail)) |
| @@ -855,23 +883,14 @@ IT_set_frame_parameters (frame, alist) | |||
| 855 | } | 883 | } |
| 856 | } | 884 | } |
| 857 | else if (EQ (prop, intern ("menu-bar-lines"))) | 885 | else if (EQ (prop, intern ("menu-bar-lines"))) |
| 858 | { | 886 | x_set_menu_bar_lines (f, val, 0); |
| 859 | int new; | ||
| 860 | int old = FRAME_MENU_BAR_LINES (the_only_frame); | ||
| 861 | |||
| 862 | if (INTEGERP (val)) | ||
| 863 | new = XINT (val); | ||
| 864 | else | ||
| 865 | new = 0; | ||
| 866 | FRAME_MENU_BAR_LINES (f) = new; | ||
| 867 | IT_set_menu_bar_lines (the_only_frame.root_window, new - old); | ||
| 868 | } | ||
| 869 | } | 887 | } |
| 870 | 888 | ||
| 871 | if (redraw) | 889 | if (redraw) |
| 872 | { | 890 | { |
| 873 | recompute_basic_faces (f); | 891 | recompute_basic_faces (f); |
| 874 | Fredraw_frame (Fselected_frame ()); | 892 | if (f == selected_frame) |
| 893 | redraw_frame (f); | ||
| 875 | } | 894 | } |
| 876 | } | 895 | } |
| 877 | 896 | ||
| @@ -900,7 +919,7 @@ internal_terminal_init () | |||
| 900 | #ifndef HAVE_X_WINDOWS | 919 | #ifndef HAVE_X_WINDOWS |
| 901 | if (!internal_terminal || inhibit_window_system) | 920 | if (!internal_terminal || inhibit_window_system) |
| 902 | { | 921 | { |
| 903 | the_only_frame.output_method = output_termcap; | 922 | selected_frame->output_method = output_termcap; |
| 904 | return; | 923 | return; |
| 905 | } | 924 | } |
| 906 | 925 | ||
| @@ -929,11 +948,9 @@ internal_terminal_init () | |||
| 929 | the_only_x_display.background_pixel = colors[1]; | 948 | the_only_x_display.background_pixel = colors[1]; |
| 930 | } | 949 | } |
| 931 | the_only_x_display.line_height = 1; | 950 | the_only_x_display.line_height = 1; |
| 932 | the_only_frame.output_data.x = &the_only_x_display; | ||
| 933 | the_only_frame.output_method = output_msdos_raw; | ||
| 934 | the_only_x_display.font = (XFontStruct *)1; /* must *not* be zero */ | 951 | the_only_x_display.font = (XFontStruct *)1; /* must *not* be zero */ |
| 935 | 952 | ||
| 936 | init_frame_faces ((FRAME_PTR) &the_only_frame); | 953 | init_frame_faces (selected_frame); |
| 937 | 954 | ||
| 938 | ring_bell_hook = IT_ring_bell; | 955 | ring_bell_hook = IT_ring_bell; |
| 939 | write_glyphs_hook = IT_write_glyphs; | 956 | write_glyphs_hook = IT_write_glyphs; |
| @@ -967,6 +984,19 @@ dos_get_saved_screen (screen, rows, cols) | |||
| 967 | return 0; | 984 | return 0; |
| 968 | #endif | 985 | #endif |
| 969 | } | 986 | } |
| 987 | |||
| 988 | #ifndef HAVE_X_WINDOWS | ||
| 989 | |||
| 990 | /* We are not X, but we can emulate it well enough for our needs... */ | ||
| 991 | void | ||
| 992 | check_x (void) | ||
| 993 | { | ||
| 994 | if (! FRAME_MSDOS_P (selected_frame)) | ||
| 995 | error ("Not running under a windows system"); | ||
| 996 | } | ||
| 997 | |||
| 998 | #endif | ||
| 999 | |||
| 970 | 1000 | ||
| 971 | /* ----------------------- Keyboard control ---------------------- | 1001 | /* ----------------------- Keyboard control ---------------------- |
| 972 | * | 1002 | * |
| @@ -1930,6 +1960,7 @@ XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx, | |||
| 1930 | int faces[4], selectface; | 1960 | int faces[4], selectface; |
| 1931 | int leave, result, onepane; | 1961 | int leave, result, onepane; |
| 1932 | int title_faces[4]; /* face to display the menu title */ | 1962 | int title_faces[4]; /* face to display the menu title */ |
| 1963 | int buffers_num_deleted = 0; | ||
| 1933 | 1964 | ||
| 1934 | /* Just in case we got here without a mouse present... */ | 1965 | /* Just in case we got here without a mouse present... */ |
| 1935 | if (have_mouse <= 0) | 1966 | if (have_mouse <= 0) |
| @@ -1938,21 +1969,21 @@ XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx, | |||
| 1938 | state = alloca (menu->panecount * sizeof (struct IT_menu_state)); | 1969 | state = alloca (menu->panecount * sizeof (struct IT_menu_state)); |
| 1939 | screensize = screen_size * 2; | 1970 | screensize = screen_size * 2; |
| 1940 | faces[0] | 1971 | faces[0] |
| 1941 | = compute_glyph_face (&the_only_frame, | 1972 | = compute_glyph_face (selected_frame, |
| 1942 | face_name_id_number | 1973 | face_name_id_number |
| 1943 | (&the_only_frame, | 1974 | (selected_frame, |
| 1944 | intern ("msdos-menu-passive-face")), | 1975 | intern ("msdos-menu-passive-face")), |
| 1945 | 0); | 1976 | 0); |
| 1946 | faces[1] | 1977 | faces[1] |
| 1947 | = compute_glyph_face (&the_only_frame, | 1978 | = compute_glyph_face (selected_frame, |
| 1948 | face_name_id_number | 1979 | face_name_id_number |
| 1949 | (&the_only_frame, | 1980 | (selected_frame, |
| 1950 | intern ("msdos-menu-active-face")), | 1981 | intern ("msdos-menu-active-face")), |
| 1951 | 0); | 1982 | 0); |
| 1952 | selectface | 1983 | selectface |
| 1953 | = face_name_id_number (&the_only_frame, intern ("msdos-menu-select-face")); | 1984 | = face_name_id_number (selected_frame, intern ("msdos-menu-select-face")); |
| 1954 | faces[2] = compute_glyph_face (&the_only_frame, selectface, faces[0]); | 1985 | faces[2] = compute_glyph_face (selected_frame, selectface, faces[0]); |
| 1955 | faces[3] = compute_glyph_face (&the_only_frame, selectface, faces[1]); | 1986 | faces[3] = compute_glyph_face (selected_frame, selectface, faces[1]); |
| 1956 | 1987 | ||
| 1957 | /* Make sure the menu title is always displayed with | 1988 | /* Make sure the menu title is always displayed with |
| 1958 | `msdos-menu-active-face', no matter where the mouse pointer is. */ | 1989 | `msdos-menu-active-face', no matter where the mouse pointer is. */ |
| @@ -1960,11 +1991,25 @@ XMenuActivate (Display *foo, XMenu *menu, int *pane, int *selidx, | |||
| 1960 | title_faces[i] = faces[3]; | 1991 | title_faces[i] = faces[3]; |
| 1961 | 1992 | ||
| 1962 | statecount = 1; | 1993 | statecount = 1; |
| 1994 | |||
| 1995 | /* Don't let the title for the "Buffers" popup menu include a | ||
| 1996 | digit (which is ugly). | ||
| 1997 | |||
| 1998 | This is a terrible kludge, but I think the "Buffers" case is | ||
| 1999 | the only one where the title includes a number, so it doesn't | ||
| 2000 | seem to be necessary to make this more general. */ | ||
| 2001 | if (strncmp (menu->text[0], "Buffers 1", 9) == 0) | ||
| 2002 | { | ||
| 2003 | menu->text[0][7] = '\0'; | ||
| 2004 | buffers_num_deleted = 1; | ||
| 2005 | } | ||
| 1963 | state[0].menu = menu; | 2006 | state[0].menu = menu; |
| 1964 | mouse_off (); | 2007 | mouse_off (); |
| 1965 | ScreenRetrieve (state[0].screen_behind = xmalloc (screensize)); | 2008 | ScreenRetrieve (state[0].screen_behind = xmalloc (screensize)); |
| 1966 | 2009 | ||
| 1967 | IT_menu_display (menu, y0 - 1, x0 - 1, title_faces); /* display menu title */ | 2010 | IT_menu_display (menu, y0 - 1, x0 - 1, title_faces); /* display menu title */ |
| 2011 | if (buffers_num_deleted) | ||
| 2012 | menu->text[0][7] = ' '; | ||
| 1968 | if ((onepane = menu->count == 1 && menu->submenu[0])) | 2013 | if ((onepane = menu->count == 1 && menu->submenu[0])) |
| 1969 | { | 2014 | { |
| 1970 | menu->width = menu->submenu[0]->width; | 2015 | menu->width = menu->submenu[0]->width; |