aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMorten Welinder1994-10-17 08:42:36 +0000
committerMorten Welinder1994-10-17 08:42:36 +0000
commit87485d6fc91710d31c0ed046744f5f7a95f11115 (patch)
tree267385687729bec531f289670a15063c4d6bae52 /src
parentef88bd2dc02b0b4e709a216a02760f43f18e00d6 (diff)
downloademacs-87485d6fc91710d31c0ed046744f5f7a95f11115.tar.gz
emacs-87485d6fc91710d31c0ed046744f5f7a95f11115.zip
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in18
-rw-r--r--src/config.in4
-rw-r--r--src/dispextern.h16
-rw-r--r--src/dispnew.c8
-rw-r--r--src/dosfns.c40
-rw-r--r--src/dosfns.h3
-rw-r--r--src/editfns.c26
-rw-r--r--src/emacs.c5
-rw-r--r--src/fileio.c6
-rw-r--r--src/frame.c70
-rw-r--r--src/frame.h28
-rw-r--r--src/keyboard.c14
-rw-r--r--src/lisp.h14
-rw-r--r--src/msdos.c636
-rw-r--r--src/msdos.h85
-rw-r--r--src/puresize.h11
-rw-r--r--src/s/msdos.h19
-rw-r--r--src/sysdep.c24
-rw-r--r--src/window.c2
-rw-r--r--src/xdisp.c18
-rw-r--r--src/xfaces.c85
-rw-r--r--src/xmenu.c11
-rw-r--r--src/xterm.c3
23 files changed, 1061 insertions, 85 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index 2696a57c53d..9b713af27a6 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -455,6 +455,17 @@ ALL_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_MACHINE LD_SWITCH_SITE $(LDFLAGS)
455#define MKTIME_OBJ mktime.o 455#define MKTIME_OBJ mktime.o
456#endif 456#endif
457 457
458#ifdef MSDOS
459#ifdef HAVE_X_WINDOWS
460#define MSDOS_OBJ dosfns.o msdos.o
461#else
462#define MSDOS_OBJ dosfns.o msdos.o xfaces.o xmenu.o
463#endif
464#else
465#define MSDOS_OBJ
466#endif
467
468
458/* lastfile must follow all files 469/* lastfile must follow all files
459 whose initialized data areas should be dumped as pure by dump-emacs. */ 470 whose initialized data areas should be dumped as pure by dump-emacs. */
460obj= dispnew.o frame.o scroll.o xdisp.o window.o \ 471obj= dispnew.o frame.o scroll.o xdisp.o window.o \
@@ -468,7 +479,7 @@ obj= dispnew.o frame.o scroll.o xdisp.o window.o \
468 abbrev.o syntax.o UNEXEC mocklisp.o bytecode.o \ 479 abbrev.o syntax.o UNEXEC mocklisp.o bytecode.o \
469 process.o callproc.o \ 480 process.o callproc.o \
470 region-cache.o \ 481 region-cache.o \
471 doprnt.o strftime.o MKTIME_OBJ GETLOADAVG_OBJ 482 doprnt.o strftime.o MKTIME_OBJ GETLOADAVG_OBJ MSDOS_OBJ
472 483
473/* Object files used on some machine or other. 484/* Object files used on some machine or other.
474 These go in the DOC file on all machines 485 These go in the DOC file on all machines
@@ -551,7 +562,7 @@ otherobj= $(termcapobj) lastfile.o $(mallocobj) $(allocaobj) $(widgetobj)
551#endif 562#endif
552 563
553#ifdef MSDOS 564#ifdef MSDOS
554#define MSDOS_SUPPORT ${lispdir}ls-lisp.elc ${lispdir}disp-tab.elc ${lispdir}dos-fns.elc ${lispdir}mouse.elc 565#define MSDOS_SUPPORT ${lispdir}ls-lisp.elc ${lispdir}disp-tab.elc ${lispdir}dos-fns.elc ${lispdir}mouse.elc ${lispdir}faces.elc
555#else 566#else
556#define MSDOS_SUPPORT 567#define MSDOS_SUPPORT
557#endif 568#endif
@@ -808,6 +819,7 @@ dispnew.o: dispnew.c commands.h frame.h window.h buffer.h dispextern.h \
808 termchar.h termopts.h termhooks.h cm.h disptab.h systty.h systime.h $(config_h) 819 termchar.h termopts.h termhooks.h cm.h disptab.h systty.h systime.h $(config_h)
809doc.o: doc.c $(config_h) paths.h buffer.h keyboard.h 820doc.o: doc.c $(config_h) paths.h buffer.h keyboard.h
810doprnt.o: doprnt.c $(config_h) 821doprnt.o: doprnt.c $(config_h)
822dosfns.o: buffer.h termchar.h termhooks.h frame.h msdos.h dosfns.h $(config_h)
811editfns.o: editfns.c window.h buffer.h systime.h INTERVAL_SRC $(config_h) 823editfns.o: editfns.c window.h buffer.h systime.h INTERVAL_SRC $(config_h)
812emacs.o: emacs.c commands.h systty.h syssignal.h process.h INTERVAL_SRC $(config_h) 824emacs.o: emacs.c commands.h systty.h syssignal.h process.h INTERVAL_SRC $(config_h)
813fileio.o: fileio.c window.h buffer.h systime.h INTERVAL_SRC $(config_h) 825fileio.o: fileio.c window.h buffer.h systime.h INTERVAL_SRC $(config_h)
@@ -825,6 +837,8 @@ keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \
825lastfile.o: lastfile.c $(config_h) 837lastfile.o: lastfile.c $(config_h)
826macros.o: macros.c window.h buffer.h commands.h macros.h $(config_h) 838macros.o: macros.c window.h buffer.h commands.h macros.h $(config_h)
827malloc.o: malloc.c $(config_h) 839malloc.o: malloc.c $(config_h)
840msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h \
841 termopts.h frame.h window.h $(config_h)
828mktime.o: mktime.c $(config_h) 842mktime.o: mktime.c $(config_h)
829gmalloc.o: gmalloc.c $(config_h) 843gmalloc.o: gmalloc.c $(config_h)
830ralloc.o: ralloc.c $(config_h) 844ralloc.o: ralloc.c $(config_h)
diff --git a/src/config.in b/src/config.in
index 87ff13fef59..cc6fa84668a 100644
--- a/src/config.in
+++ b/src/config.in
@@ -64,9 +64,11 @@ and this notice must be preserved on all copies. */
64/* Define if netdb.h declares h_errno. */ 64/* Define if netdb.h declares h_errno. */
65#undef HAVE_H_ERRNO 65#undef HAVE_H_ERRNO
66 66
67/* If we're using any sort of window system, define MULTI_FRAME. */ 67/* If we're using any sort of window system, define some consequences. */
68#ifdef HAVE_X_WINDOWS 68#ifdef HAVE_X_WINDOWS
69#define MULTI_FRAME 69#define MULTI_FRAME
70#define HAVE_FACES
71#define HAVE_MOUSE
70#endif 72#endif
71 73
72/* Define USE_TEXT_PROPERTIES to support visual and other properties 74/* Define USE_TEXT_PROPERTIES to support visual and other properties
diff --git a/src/dispextern.h b/src/dispextern.h
index 8d5f23ab2e2..d62797195ca 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -17,13 +17,22 @@ You should have received a copy of the GNU General Public License
17along with GNU Emacs; see the file COPYING. If not, write to 17along with GNU Emacs; see the file COPYING. If not, write to
18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19 19
20#ifndef _DISPEXTERN_H_
21#define _DISPEXTERN_H_
22
20/* Nonzero means last display completed and cursor is really at 23/* Nonzero means last display completed and cursor is really at
21 cursX, cursY. Zero means it was preempted. */ 24 cursX, cursY. Zero means it was preempted. */
22extern int display_completed; 25extern int display_completed;
23 26
24#ifdef HAVE_X_WINDOWS 27#ifdef HAVE_X_WINDOWS
25#include <X11/Xlib.h> 28#include <X11/Xlib.h>
29#endif
30
31#ifdef MSDOS
32#include "msdos.h"
33#endif
26 34
35#ifdef HAVE_FACES
27struct face 36struct face
28 { 37 {
29 /* If this is non-zero, it is a GC we can use without modification 38 /* If this is non-zero, it is a GC we can use without modification
@@ -62,7 +71,7 @@ typedef struct face *FACE;
62#define FACE_STIPPLE(f) ((f)->stipple) 71#define FACE_STIPPLE(f) ((f)->stipple)
63#define FACE_UNDERLINE_P(f) ((f)->underline) 72#define FACE_UNDERLINE_P(f) ((f)->underline)
64 73
65#else /* Not X */ 74#else /* not HAVE_FACES */
66 75
67typedef int FACE; 76typedef int FACE;
68 77
@@ -73,7 +82,8 @@ typedef int FACE;
73 82
74#define FACE_HIGHLIGHT(f) ((f) & 0x1) 83#define FACE_HIGHLIGHT(f) ((f) & 0x1)
75#define FACE_UNDERLINE(f) ((f) & 0x2) 84#define FACE_UNDERLINE(f) ((f) & 0x2)
76#endif /* Not X */ 85
86#endif /* not HAVE_FACES */
77 87
78 88
79/* This structure is used for the actual display of text on a frame. 89/* This structure is used for the actual display of text on a frame.
@@ -164,3 +174,5 @@ struct frame_glyphs
164 174
165extern void get_display_line (); 175extern void get_display_line ();
166extern Lisp_Object sit_for (); 176extern Lisp_Object sit_for ();
177
178#endif /* not _DISPEXTERN_H_ */
diff --git a/src/dispnew.c b/src/dispnew.c
index c91354bad1a..eb20a71a281 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -121,13 +121,15 @@ Lisp_Object Vstandard_display_table;
121int cursor_in_echo_area; 121int cursor_in_echo_area;
122 122
123/* The currently selected frame. 123/* The currently selected frame.
124 In a single-frame version, this variable always remains 0. */ 124 In a single-frame version, this variable always holds the address of
125 the_only_frame. */
125 126
126FRAME_PTR selected_frame; 127FRAME_PTR selected_frame;
127 128
128/* A frame which is not just a minibuffer, or 0 if there are no such 129/* A frame which is not just a minibuffer, or 0 if there are no such
129 frames. This is usually the most recent such frame that was 130 frames. This is usually the most recent such frame that was
130 selected. In a single-frame version, this variable always remains 0. */ 131 selected. In a single-frame version, this variable always holds
132 the address of the_only_frame. */
131FRAME_PTR last_nonminibuf_frame; 133FRAME_PTR last_nonminibuf_frame;
132 134
133/* In a single-frame version, the information that would otherwise 135/* In a single-frame version, the information that would otherwise
@@ -1086,7 +1088,7 @@ direct_output_for_insert (g)
1086 1088
1087 { 1089 {
1088 int face = 0; 1090 int face = 0;
1089#ifdef HAVE_X_WINDOWS 1091#ifdef HAVE_FACES
1090 int dummy; 1092 int dummy;
1091 1093
1092 if (FRAME_X_P (frame)) 1094 if (FRAME_X_P (frame))
diff --git a/src/dosfns.c b/src/dosfns.c
index 3eeb08c1c9c..148c57ee3c7 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -137,6 +137,37 @@ REGISTERS should be a vector produced by `make-register' and\n\
137 return regs; 137 return regs;
138} 138}
139 139
140#ifndef HAVE_X_WINDOWS
141/* Later we might want to control the mouse interface with this function,
142 e.g., with respect to non-80 column screen modes. */
143
144DEFUN ("msdos-mouse-p", Fmsdos_mouse_p, Smsdos_mouse_p, 0, 0, 0, "\
145Report whether a mouse is present.")
146 ()
147{
148 if (have_mouse)
149 return Qt;
150 else
151 return Qnil;
152}
153
154DEFUN ("set-mouse-position", Fset_mouse_position, Sset_mouse_position, 3, 3, 0,
155 "Move the mouse pointer to the center of character cell (X,Y) in FRAME.\n\
156WARNING: If you use this under X windows,\n\
157you should call `unfocus-frame' afterwards.")
158 (frame, x, y)
159 Lisp_Object frame, x, y;
160{
161 mouse_moveto (XINT (x), XINT (y));
162}
163
164/* Function to translate colour names to integers. See lisp/term/pc-win.el
165 for its definition. */
166
167Lisp_Object Qmsdos_color_translate;
168#endif
169
170
140int dos_country_code; 171int dos_country_code;
141int dos_codepage; 172int dos_codepage;
142Lisp_Object Vdos_version; 173Lisp_Object Vdos_version;
@@ -148,7 +179,9 @@ init_dosfns ()
148 _go32_dpmi_seginfo info; 179 _go32_dpmi_seginfo info;
149 _go32_dpmi_registers dpmiregs; 180 _go32_dpmi_registers dpmiregs;
150 181
182#ifndef SYSTEM_MALLOC
151 get_lim_data (); /* why the hell isn't this called elsewhere? */ 183 get_lim_data (); /* why the hell isn't this called elsewhere? */
184#endif
152 185
153 regs.x.ax = 0x3000; 186 regs.x.ax = 0x3000;
154 intdos (&regs, &regs); 187 intdos (&regs, &regs);
@@ -195,6 +228,13 @@ syms_of_dosfns ()
195 defsubr (&Smode25); 228 defsubr (&Smode25);
196 defsubr (&Smode4350); 229 defsubr (&Smode4350);
197 defsubr (&Sint86); 230 defsubr (&Sint86);
231#ifndef HAVE_X_WINDOWS
232 defsubr (&Smsdos_mouse_p);
233 defsubr (&Sset_mouse_position);
234
235 Qmsdos_color_translate = intern ("msdos-color-translate");
236 staticpro (&Qmsdos_color_translate);
237#endif
198 238
199 DEFVAR_INT ("dos-country-code", &dos_country_code, 239 DEFVAR_INT ("dos-country-code", &dos_country_code,
200 "The country code returned by Dos when Emacs was started.\n\ 240 "The country code returned by Dos when Emacs was started.\n\
diff --git a/src/dosfns.h b/src/dosfns.h
index f27b344bb5c..7b727855fb1 100644
--- a/src/dosfns.h
+++ b/src/dosfns.h
@@ -21,3 +21,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
21extern int dos_country_code; 21extern int dos_country_code;
22extern int dos_codepage; 22extern int dos_codepage;
23extern Lisp_Object Vdos_version; 23extern Lisp_Object Vdos_version;
24#ifndef HAVE_X_WINDOWS
25extern Lisp_Object Qmsdos_color_translate;
26#endif
diff --git a/src/editfns.c b/src/editfns.c
index 85b0d0978aa..1b54160d525 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -64,7 +64,14 @@ init_editfns ()
64#endif /* not CANNOT_DUMP */ 64#endif /* not CANNOT_DUMP */
65 65
66 pw = (struct passwd *) getpwuid (getuid ()); 66 pw = (struct passwd *) getpwuid (getuid ());
67#ifdef MSDOS
68 /* We let the real user name default to "root" because that's quite
69 accurate on MSDOG and because it lets Emacs find the init file.
70 (The DVX libraries override the Djgpp libraries here.) */
71 Vuser_real_name = build_string (pw ? pw->pw_name : "root");
72#else
67 Vuser_real_name = build_string (pw ? pw->pw_name : "unknown"); 73 Vuser_real_name = build_string (pw ? pw->pw_name : "unknown");
74#endif
68 75
69 /* Get the effective user name, by consulting environment variables, 76 /* Get the effective user name, by consulting environment variables,
70 or the effective uid if those are unset. */ 77 or the effective uid if those are unset. */
@@ -483,19 +490,30 @@ If POS is out of range, the value is nil.")
483 return val; 490 return val;
484} 491}
485 492
486DEFUN ("user-login-name", Fuser_login_name, Suser_login_name, 0, 0, 0, 493DEFUN ("user-login-name", Fuser_login_name, Suser_login_name, 0, 1, 0,
487 "Return the name under which the user logged in, as a string.\n\ 494 "Return the name under which the user logged in, as a string.\n\
488This is based on the effective uid, not the real uid.\n\ 495This is based on the effective uid, not the real uid.\n\
489Also, if the environment variable LOGNAME or USER is set,\n\ 496Also, if the environment variable LOGNAME or USER is set,\n\
490that determines the value of this function.") 497that determines the value of this function.\n\n\
491 () 498If optional argument UID is an integer, return the login name of the user\n\
499with that uid, or nil if there is no such user.")
500 (uid)
501 Lisp_Object uid;
492{ 502{
503 struct passwd *pw;
504
493 /* Set up the user name info if we didn't do it before. 505 /* Set up the user name info if we didn't do it before.
494 (That can happen if Emacs is dumpable 506 (That can happen if Emacs is dumpable
495 but you decide to run `temacs -l loadup' and not dump. */ 507 but you decide to run `temacs -l loadup' and not dump. */
496 if (INTEGERP (Vuser_name)) 508 if (INTEGERP (Vuser_name))
497 init_editfns (); 509 init_editfns ();
498 return Vuser_name; 510
511 if (NILP (uid))
512 return Vuser_name;
513
514 CHECK_NUMBER (uid, 0);
515 pw = (struct passwd *) getpwuid (XINT (uid));
516 return (pw ? build_string (pw->pw_name) : Qnil);
499} 517}
500 518
501DEFUN ("user-real-login-name", Fuser_real_login_name, Suser_real_login_name, 519DEFUN ("user-real-login-name", Fuser_real_login_name, Suser_real_login_name,
diff --git a/src/emacs.c b/src/emacs.c
index f00860ffe07..a943a0788d5 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -787,6 +787,11 @@ Usage: %s [-t term] [--terminal term] [-nw] [--no-windows] [--batch]\n\
787#endif /* HAVE_X_MENU */ 787#endif /* HAVE_X_MENU */
788#endif /* HAVE_X_WINDOWS */ 788#endif /* HAVE_X_WINDOWS */
789 789
790#if defined (MSDOS) && !defined (HAVE_X_WINDOWS)
791 syms_of_xfaces ();
792 syms_of_xmenu ();
793#endif
794
790#ifdef SYMS_SYSTEM 795#ifdef SYMS_SYSTEM
791 SYMS_SYSTEM; 796 SYMS_SYSTEM;
792#endif 797#endif
diff --git a/src/fileio.c b/src/fileio.c
index 88e51bacec2..a7fe29e174b 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -753,7 +753,13 @@ See also the function `substitute-in-file-name'.")
753 The EQ test avoids infinite recursion. */ 753 The EQ test avoids infinite recursion. */
754 if (! NILP (defalt) && !EQ (defalt, name) 754 if (! NILP (defalt) && !EQ (defalt, name)
755 /* This saves time in a common case. */ 755 /* This saves time in a common case. */
756#ifdef MSDOS
757 && (XSTRING (defalt)->size < 3
758 || XSTRING (defalt)->data[1] != ':'
759 || XSTRING (defalt)->data[2] != '/'))
760#else
756 && XSTRING (defalt)->data[0] != '/') 761 && XSTRING (defalt)->data[0] != '/')
762#endif
757 { 763 {
758 struct gcpro gcpro1; 764 struct gcpro gcpro1;
759 765
diff --git a/src/frame.c b/src/frame.c
index 5c6e44e936a..14fc9388b1a 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -24,6 +24,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
24#include "frame.h" 24#include "frame.h"
25#include "termhooks.h" 25#include "termhooks.h"
26#include "window.h" 26#include "window.h"
27#ifdef MSDOS
28#include "msdos.h"
29#endif
27 30
28#ifdef MULTI_FRAME 31#ifdef MULTI_FRAME
29 32
@@ -95,7 +98,8 @@ extern Lisp_Object Fredirect_frame_focus ();
95DEFUN ("framep", Fframep, Sframep, 1, 1, 0, 98DEFUN ("framep", Fframep, Sframep, 1, 1, 0,
96 "Return non-nil if OBJECT is a frame.\n\ 99 "Return non-nil if OBJECT is a frame.\n\
97Value is t for a termcap frame (a character-only terminal),\n\ 100Value is t for a termcap frame (a character-only terminal),\n\
98`x' for an Emacs frame that is really an X window.\n\ 101`x' for an Emacs frame that is really an X window,\n\
102`pc' for a direct-write MS-DOS frame.\n\
99Also see `live-frame-p'.") 103Also see `live-frame-p'.")
100 (object) 104 (object)
101 Lisp_Object object; 105 Lisp_Object object;
@@ -108,6 +112,7 @@ Also see `live-frame-p'.")
108 return Qt; 112 return Qt;
109 case output_x_window: 113 case output_x_window:
110 return Qx; 114 return Qx;
115 /* The `pc' case is in the Fframep below. */
111 default: 116 default:
112 abort (); 117 abort ();
113 } 118 }
@@ -1855,6 +1860,8 @@ DEFUN ("selected-frame", Fselected_frame, Sselected_frame, 0, 0, 0,
1855 0) 1860 0)
1856 () 1861 ()
1857{ 1862{
1863 /* For your possible information, this code is unfolded into the
1864 second WINDOW_FRAME in frame.h. */
1858 Lisp_Object tem; 1865 Lisp_Object tem;
1859 XSETFASTINT (tem, 0); 1866 XSETFASTINT (tem, 0);
1860 return tem; 1867 return tem;
@@ -1888,6 +1895,10 @@ DEFUN ("framep", Fframep, Sframep, 1, 1, 0,
1888 (object) 1895 (object)
1889 Lisp_Object object; 1896 Lisp_Object object;
1890{ 1897{
1898#ifdef MSDOS
1899 if (FRAME_X_P (object))
1900 return intern ("pc");
1901#endif
1891 return Qnil; 1902 return Qnil;
1892} 1903}
1893 1904
@@ -2029,6 +2040,22 @@ DEFUN ("mouse-position", Fmouse_position, Smouse_position, 0, 0, 0,
2029 0) 2040 0)
2030 () 2041 ()
2031{ 2042{
2043#ifdef HAVE_MOUSE
2044 if (mouse_position_hook)
2045 {
2046 FRAME_PTR f;
2047 Lisp_Object lispy_dummy;
2048 enum scroll_bar_part party_dummy;
2049 Lisp_Object x, y;
2050 unsigned long long_dummy;
2051
2052 (*mouse_position_hook) (&f,
2053 &lispy_dummy, &party_dummy,
2054 &x, &y,
2055 &long_dummy);
2056 return Fcons (Fselected_frame (), Fcons (x, y));
2057 }
2058#endif
2032 return Fcons (Qnil, Fcons (Qnil, Qnil)); 2059 return Fcons (Qnil, Fcons (Qnil, Qnil));
2033} 2060}
2034 2061
@@ -2068,6 +2095,22 @@ DEFUN ("frame-parameters", Fframe_parameters, Sframe_parameters, 0, 1, 0,
2068 return Qnil; 2095 return Qnil;
2069 2096
2070 alist = Qnil; 2097 alist = Qnil;
2098#ifdef MSDOS
2099 if (FRAME_X_P (f))
2100 {
2101 static char *colornames[16] =
2102 {
2103 "black", "blue", "green", "cyan", "red", "magenta", "brown",
2104 "lightgray", "darkgray", "lightblue", "lightgreen", "lightcyan",
2105 "lightred", "lightmagenta", "yellow", "white"
2106 };
2107 store_in_alist (&alist, intern ("foreground-color"),
2108 build_string (colornames[FRAME_FOREGROUND_PIXEL (f)]));
2109 store_in_alist (&alist, intern ("background-color"),
2110 build_string (colornames[FRAME_BACKGROUND_PIXEL (f)]));
2111 }
2112#endif
2113 store_in_alist (&alist, intern ("font"), build_string ("default"));
2071 store_in_alist (&alist, Qname, build_string ("emacs")); 2114 store_in_alist (&alist, Qname, build_string ("emacs"));
2072 store_in_alist (&alist, Qheight, make_number (FRAME_HEIGHT (f))); 2115 store_in_alist (&alist, Qheight, make_number (FRAME_HEIGHT (f)));
2073 store_in_alist (&alist, Qwidth, make_number (FRAME_WIDTH (f))); 2116 store_in_alist (&alist, Qwidth, make_number (FRAME_WIDTH (f)));
@@ -2087,6 +2130,10 @@ DEFUN ("modify-frame-parameters", Fmodify_frame_parameters,
2087 (frame, alist) 2130 (frame, alist)
2088 Lisp_Object frame, alist; 2131 Lisp_Object frame, alist;
2089{ 2132{
2133#ifdef MSDOS
2134 if (FRAME_X_P (frame))
2135 IT_set_frame_parameters (XFRAME (frame), alist);
2136#endif
2090 return Qnil; 2137 return Qnil;
2091} 2138}
2092 2139
@@ -2100,6 +2147,15 @@ DEFUN ("frame-live-p", Fframe_live_p, Sframe_live_p, 1, 1, 0,
2100 return Qt; 2147 return Qt;
2101} 2148}
2102 2149
2150DEFUN ("frame-list", Fframe_list, Sframe_list, 0, 0, 0,
2151 /* Don't confuse make-docfile by having two doc strings for this function.
2152 make-docfile does not pay attention to #if, for good reason! */
2153 0)
2154 ()
2155{
2156 return Fcons (Fselected_frame (), Qnil);
2157}
2158
2103syms_of_frame () 2159syms_of_frame ()
2104{ 2160{
2105 Qheight = intern ("height"); 2161 Qheight = intern ("height");
@@ -2141,6 +2197,18 @@ syms_of_frame ()
2141 defsubr (&Sframe_parameters); 2197 defsubr (&Sframe_parameters);
2142 defsubr (&Smodify_frame_parameters); 2198 defsubr (&Smodify_frame_parameters);
2143 defsubr (&Sframe_live_p); 2199 defsubr (&Sframe_live_p);
2200 defsubr (&Sframe_list);
2201
2202#ifdef MSDOS
2203 /* A comment in dispnew.c says the_only_frame is not protected. */
2204 the_only_frame.face_alist = Qnil;
2205 staticpro (&the_only_frame.face_alist);
2206 the_only_frame.menu_bar_items = Qnil;
2207 staticpro (&the_only_frame.menu_bar_items);
2208 the_only_frame.menu_bar_vector = Qnil;
2209 staticpro (&the_only_frame.menu_bar_vector);
2210 the_only_frame.menu_bar_items = menu_bar_items (Qnil);
2211#endif
2144} 2212}
2145 2213
2146keys_of_frame () 2214keys_of_frame ()
diff --git a/src/frame.h b/src/frame.h
index 6ef68499a3c..f9969d2c812 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -37,7 +37,7 @@ extern int message_buf_print;
37 having miscellaneous random variables scattered about. */ 37 having miscellaneous random variables scattered about. */
38 38
39enum output_method 39enum output_method
40{ output_termcap, output_x_window }; 40{ output_termcap, output_x_window, output_msdos_raw };
41 41
42struct frame 42struct frame
43{ 43{
@@ -382,23 +382,35 @@ extern Lisp_Object Vterminal_frame;
382 382
383/* These definitions are used in a single-frame version of Emacs. */ 383/* These definitions are used in a single-frame version of Emacs. */
384 384
385#define FRAME_PTR int
386
387/* A frame we use to store all the data concerning the screen when we 385/* A frame we use to store all the data concerning the screen when we
388 don't have multiple frames. Remember, if you store any data in it 386 don't have multiple frames. Remember, if you store any data in it
389 which needs to be protected from GC, you should staticpro that 387 which needs to be protected from GC, you should staticpro that
390 element explicitly. */ 388 element explicitly. */
391extern struct frame the_only_frame; 389extern struct frame the_only_frame;
392 390
393extern EMACS_INT selected_frame; 391typedef struct frame *FRAME_PTR;
394extern EMACS_INT last_nonminibuf_frame; 392#ifdef __GNUC__
393/* A function call for always getting 0 is overkill, so... */
394#define WINDOW_FRAME(w) ({ Lisp_Object tem; XSETFASTINT (tem, 0); tem; })
395#else
396#define WINDOW_FRAME(w) (Fselected_frame ())
397#endif
398#define XSETFRAME(p, v) (p = WINDOW_FRAME (***bogus***))
399#define XFRAME(frame) (&the_only_frame)
395 400
396#define XFRAME(f) selected_frame 401extern FRAME_PTR selected_frame;
397#define WINDOW_FRAME(w) selected_frame 402extern FRAME_PTR last_nonminibuf_frame;
398 403
399#define FRAME_LIVE_P(f) 1 404#define FRAME_LIVE_P(f) 1
405#ifdef MSDOS
406/* The following definitions could also be used in the non-MSDOS case,
407 but the constants below lead to better code. */
408#define FRAME_TERMCAP_P(f) (the_only_frame.output_method == output_termcap)
409#define FRAME_X_P(f) (the_only_frame.output_method != output_termcap)
410#else
400#define FRAME_TERMCAP_P(f) 1 411#define FRAME_TERMCAP_P(f) 1
401#define FRAME_X_P(f) 0 412#define FRAME_X_P(f) 0
413#endif
402#define FRAME_MINIBUF_ONLY_P(f) 0 414#define FRAME_MINIBUF_ONLY_P(f) 0
403#define FRAME_HAS_MINIBUF_P(f) 1 415#define FRAME_HAS_MINIBUF_P(f) 1
404#define FRAME_CURRENT_GLYPHS(f) (the_only_frame.current_glyphs) 416#define FRAME_CURRENT_GLYPHS(f) (the_only_frame.current_glyphs)
@@ -455,7 +467,7 @@ extern EMACS_INT last_nonminibuf_frame;
455 `for' loop which traverses Vframe_list using LIST_VAR and 467 `for' loop which traverses Vframe_list using LIST_VAR and
456 FRAME_VAR. */ 468 FRAME_VAR. */
457#define FOR_EACH_FRAME(list_var, frame_var) \ 469#define FOR_EACH_FRAME(list_var, frame_var) \
458 for (list_var = Qt; XSETFASTINT (frame_var, selected_frame), ! NILP (list_var); list_var = Qnil) 470 for (list_var = Qt; frame_var = WINDOW_FRAME (***bogus***), ! NILP (list_var); list_var = Qnil)
459 471
460#endif /* not MULTI_FRAME */ 472#endif /* not MULTI_FRAME */
461 473
diff --git a/src/keyboard.c b/src/keyboard.c
index ddaf4752382..a8a983c3dae 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2228,7 +2228,7 @@ kbd_buffer_get_event ()
2228 } 2228 }
2229#endif 2229#endif
2230 2230
2231#if defined(MULTI_FRAME) || defined(HAVE_MOUSE) 2231#if defined (MULTI_FRAME) || defined (HAVE_MOUSE)
2232 /* If we didn't decide to make a switch-frame event, go ahead and 2232 /* If we didn't decide to make a switch-frame event, go ahead and
2233 return a mouse-motion event. */ 2233 return a mouse-motion event. */
2234 if (NILP (obj)) 2234 if (NILP (obj))
@@ -2617,7 +2617,7 @@ make_lispy_event (event)
2617 / sizeof (lispy_function_keys[0]))); 2617 / sizeof (lispy_function_keys[0])));
2618 break; 2618 break;
2619 2619
2620#if defined(MULTI_FRAME) || defined(HAVE_MOUSE) 2620#if defined (MULTI_FRAME) || defined (HAVE_MOUSE)
2621 /* A mouse click. Figure out where it is, decide whether it's 2621 /* A mouse click. Figure out where it is, decide whether it's
2622 a press, click or drag, and build the appropriate structure. */ 2622 a press, click or drag, and build the appropriate structure. */
2623 case mouse_click: 2623 case mouse_click:
@@ -2861,7 +2861,7 @@ make_lispy_event (event)
2861 } 2861 }
2862} 2862}
2863 2863
2864#if defined(MULTI_FRAME) || defined(HAVE_MOUSE) 2864#if defined (MULTI_FRAME) || defined (HAVE_MOUSE)
2865 2865
2866static Lisp_Object 2866static Lisp_Object
2867make_lispy_movement (frame, bar_window, part, x, y, time) 2867make_lispy_movement (frame, bar_window, part, x, y, time)
@@ -3430,7 +3430,6 @@ gobble_input (expected)
3430 sigsetmask (mask); 3430 sigsetmask (mask);
3431 } 3431 }
3432 else 3432 else
3433#endif
3434#ifdef POLL_FOR_INPUT 3433#ifdef POLL_FOR_INPUT
3435 if (read_socket_hook && !interrupt_input && poll_suppress_count == 0) 3434 if (read_socket_hook && !interrupt_input && poll_suppress_count == 0)
3436 { 3435 {
@@ -3441,6 +3440,7 @@ gobble_input (expected)
3441 } 3440 }
3442 else 3441 else
3443#endif 3442#endif
3443#endif
3444 read_avail_input (expected); 3444 read_avail_input (expected);
3445#endif 3445#endif
3446} 3446}
@@ -4058,8 +4058,7 @@ read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu)
4058 if (mapno >= nmaps) 4058 if (mapno >= nmaps)
4059 return Qnil; 4059 return Qnil;
4060 4060
4061#ifdef HAVE_X_WINDOWS 4061#if (defined (HAVE_X_WINDOWS) && defined (HAVE_X_MENU)) || defined (MSDOS)
4062#ifdef HAVE_X_MENU
4063 /* If we got to this point via a mouse click, 4062 /* If we got to this point via a mouse click,
4064 use a real menu for mouse selection. */ 4063 use a real menu for mouse selection. */
4065 if (EVENT_HAS_PARAMETERS (prev_event)) 4064 if (EVENT_HAS_PARAMETERS (prev_event))
@@ -4091,8 +4090,7 @@ read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu)
4091 *used_mouse_menu = 1; 4090 *used_mouse_menu = 1;
4092 return value; 4091 return value;
4093 } 4092 }
4094#endif /* HAVE_X_MENU */ 4093#endif /* (HAVE_X_WINDOWS && HAVE_X_MENU) || MSDOS */
4095#endif /* HAVE_X_WINDOWS */
4096 return Qnil ; 4094 return Qnil ;
4097} 4095}
4098 4096
diff --git a/src/lisp.h b/src/lisp.h
index a4d1ddfee6c..e5b0c367ee2 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -697,7 +697,7 @@ typedef unsigned char UCHAR;
697 pretty quickly. */ 697 pretty quickly. */
698#define GLYPH unsigned int 698#define GLYPH unsigned int
699 699
700#ifdef HAVE_X_WINDOWS 700#ifdef HAVE_FACES
701/* The FAST macros assume that we already know we're in an X window. */ 701/* The FAST macros assume that we already know we're in an X window. */
702 702
703/* Given a character code and a face ID, return the appropriate glyph. */ 703/* Given a character code and a face ID, return the appropriate glyph. */
@@ -714,11 +714,11 @@ typedef unsigned char UCHAR;
714 : FAST_MAKE_GLYPH (char, face)) 714 : FAST_MAKE_GLYPH (char, face))
715#define GLYPH_CHAR(f, g) (FRAME_TERMCAP_P (f) ? (g) : FAST_GLYPH_CHAR (g)) 715#define GLYPH_CHAR(f, g) (FRAME_TERMCAP_P (f) ? (g) : FAST_GLYPH_CHAR (g))
716#define GLYPH_FACE(f, g) (FRAME_TERMCAP_P (f) ? (0) : FAST_GLYPH_FACE (g)) 716#define GLYPH_FACE(f, g) (FRAME_TERMCAP_P (f) ? (0) : FAST_GLYPH_FACE (g))
717#else 717#else /* not HAVE_FACES */
718#define MAKE_GLYPH(f, char, face) (char) 718#define MAKE_GLYPH(f, char, face) (char)
719#define GLYPH_CHAR(f, g) (g) 719#define GLYPH_CHAR(f, g) (g)
720#define GLYPH_FACE(f, g) (g) 720#define GLYPH_FACE(f, g) (g)
721#endif 721#endif /* not HAVE_FACES */
722 722
723/* The ID of the mode line highlighting face. */ 723/* The ID of the mode line highlighting face. */
724#define GLYPH_MODE_LINE_FACE 1 724#define GLYPH_MODE_LINE_FACE 1
@@ -744,7 +744,15 @@ typedef unsigned char UCHAR;
744#define BUFFERP(x) (XTYPE ((x)) == Lisp_Buffer) 744#define BUFFERP(x) (XTYPE ((x)) == Lisp_Buffer)
745#define SUBRP(x) (XTYPE ((x)) == Lisp_Subr) 745#define SUBRP(x) (XTYPE ((x)) == Lisp_Subr)
746#define PROCESSP(x) (XTYPE ((x)) == Lisp_Process) 746#define PROCESSP(x) (XTYPE ((x)) == Lisp_Process)
747#ifdef MULTI_FRAME
747#define FRAMEP(x) (XTYPE ((x)) == Lisp_Frame) 748#define FRAMEP(x) (XTYPE ((x)) == Lisp_Frame)
749#else
750#ifdef MSDOS
751/* We could use this in the !MSDOS case also, but we prefer a compile-time
752 error message in case FRAMEP is used. */
753#define FRAMEP(x) (EQ (x, Fselected_frame ()))
754#endif
755#endif
748#define WINDOWP(x) (XTYPE ((x)) == Lisp_Window) 756#define WINDOWP(x) (XTYPE ((x)) == Lisp_Window)
749#define WINDOW_CONFIGURATIONP(x) (XTYPE ((x)) == Lisp_Window_Configuration) 757#define WINDOW_CONFIGURATIONP(x) (XTYPE ((x)) == Lisp_Window_Configuration)
750#ifdef LISP_FLOAT_TYPE 758#ifdef LISP_FLOAT_TYPE
diff --git a/src/msdos.c b/src/msdos.c
index 8cc91c9bae5..d0a881c5a68 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -34,7 +34,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
34#include "msdos.h" 34#include "msdos.h"
35#include "systime.h" 35#include "systime.h"
36#include "termhooks.h" 36#include "termhooks.h"
37#include "dispextern.h"
38#include "termopts.h"
37#include "frame.h" 39#include "frame.h"
40#include "window.h"
38#include <go32.h> 41#include <go32.h>
39#include <pc.h> 42#include <pc.h>
40#include <ctype.h> 43#include <ctype.h>
@@ -355,7 +358,7 @@ dos_rawgetc ()
355 + (ctrl_p ? ctrl_modifier : 0) 358 + (ctrl_p ? ctrl_modifier : 0)
356 + (alt_p ? meta_modifier : 0); 359 + (alt_p ? meta_modifier : 0);
357 /* EMACS == Enter Meta Alt Control Shift */ 360 /* EMACS == Enter Meta Alt Control Shift */
358 event.frame_or_window = selected_frame; 361 XSETFRAME (event.frame_or_window, selected_frame);
359 gettimeofday (&tv, NULL); 362 gettimeofday (&tv, NULL);
360 event.timestamp = tv.tv_usec; 363 event.timestamp = tv.tv_usec;
361 kbd_buffer_store_event (&event); 364 kbd_buffer_store_event (&event);
@@ -389,7 +392,7 @@ dos_rawgetc ()
389 + (press ? down_modifier : up_modifier); 392 + (press ? down_modifier : up_modifier);
390 event.x = x; 393 event.x = x;
391 event.y = y; 394 event.y = y;
392 event.frame_or_window = selected_frame; 395 XSETFRAME (event.frame_or_window, selected_frame);
393 gettimeofday (&tv, NULL); 396 gettimeofday (&tv, NULL);
394 event.timestamp = tv.tv_usec; 397 event.timestamp = tv.tv_usec;
395 kbd_buffer_store_event (&event); 398 kbd_buffer_store_event (&event);
@@ -690,9 +693,9 @@ init_environment (argc, argv, skip_args)
690 693
691 /* Find our root from argv[0]. Assuming argv[0] is, say, 694 /* Find our root from argv[0]. Assuming argv[0] is, say,
692 "c:/emacs/bin/emacs.exe" our root will be "c:/emacs". */ 695 "c:/emacs/bin/emacs.exe" our root will be "c:/emacs". */
693 len = strlen (argv[0]); 696 _fixpath (argv[0], root = alloca (MAXPATHLEN + 20));
694 root = alloca (len + 10); /* A little extra space for the stuff below. */ 697 strlwr (root);
695 strcpy (root, argv[0]); 698 len = strlen (root);
696 while (len > 0 && root[len] != '/' && root[len] != ':') 699 while (len > 0 && root[len] != '/' && root[len] != ':')
697 len--; 700 len--;
698 root[len] = '\0'; 701 root[len] = '\0';
@@ -714,6 +717,11 @@ init_environment (argc, argv, skip_args)
714 terminal is the default. */ 717 terminal is the default. */
715 setenv ("TERM", "internal", 0); 718 setenv ("TERM", "internal", 0);
716 719
720#ifdef HAVE_X_WINDOWS
721 /* Emacs expects DISPLAY to be set. */
722 setenv ("DISPLAY", "unix:0.0", 0);
723#endif
724
717 /* SHELL is a bit tricky -- COMSPEC is the closest we come, but we must 725 /* SHELL is a bit tricky -- COMSPEC is the closest we come, but we must
718 downcase it and mirror the backslashes. */ 726 downcase it and mirror the backslashes. */
719 s = getenv ("COMSPEC"); 727 s = getenv ("COMSPEC");
@@ -847,6 +855,8 @@ output_string1:
847} 855}
848 856
849static int internal_terminal = 0; 857static int internal_terminal = 0;
858static int highlight;
859
850#undef fflush 860#undef fflush
851 861
852int 862int
@@ -953,14 +963,241 @@ internal_flush (f)
953 fflush (f); 963 fflush (f);
954} 964}
955 965
966#ifndef HAVE_X_WINDOWS
967static void
968rien_du_tout ()
969{
970 /* Rien du tout, cela va sans dire! */
971}
972
973static
974IT_ring_bell ()
975{
976 if (visible_bell)
977 {
978 /* This creates an xor-mask that will swap the default fore- and
979 background colors. */
980 if (have_mouse) mouse_off ();
981 do_visible_bell (((the_only_x_display.foreground_pixel
982 ^ the_only_x_display.background_pixel)
983 * 0x11) & 0x7f);
984 if (have_mouse) mouse_on ();
985 }
986 else
987 /* Write it directly to ms-dos -- don't let it go through our terminal
988 emulator. This way the mouse cursor won't blink. */
989 write (1, "\007", 1);
990}
991
992static void
993IT_set_face (int face)
994{
995 struct face *fp;
996 extern struct face *intern_face (/* FRAME_PTR, struct face * */);
997
998 if (face == 1 || (face == 0 && highlight))
999 fp = FRAME_MODE_LINE_FACE (foo);
1000 else if (face <= 0 || face >= FRAME_N_COMPUTED_FACES (foo))
1001 fp = FRAME_DEFAULT_FACE (foo);
1002 else
1003 fp = intern_face (selected_frame, FRAME_COMPUTED_FACES (foo)[face]);
1004 putchar ('\e');
1005 putchar ('A');
1006 putchar ((FACE_BACKGROUND (fp) << 4) | FACE_FOREGROUND (fp));
1007}
1008
1009static
1010IT_write_glyphs (GLYPH *str, int len)
1011{
1012 int face = -1;
1013 int newface;
1014
1015 while (len > 0)
1016 {
1017 newface = FAST_GLYPH_FACE (*str);
1018 if (newface != face)
1019 IT_set_face ((face = newface));
1020 putchar (FAST_GLYPH_CHAR (*str));
1021 str++, len--;
1022 }
1023}
1024
1025static
1026IT_clear_end_of_line (first_unused)
1027{
1028 putchar ('\e');
1029 putchar ('E');
1030}
1031
1032static
1033IT_cursor_to (int y, int x)
1034{
1035 putchar ('\e');
1036 putchar ('@');
1037 putchar (y);
1038 putchar (x);
1039}
1040
1041IT_reassert_line_highlight (new, vpos)
1042 int new, vpos;
1043{
1044 highlight = new;
1045 IT_set_face (0); /* To possibly clear the highlighting. */
1046}
1047
1048static
1049IT_change_line_highlight (new_highlight, vpos, first_unused_hpos)
1050{
1051 highlight = new_highlight;
1052 IT_set_face (0); /* To possibly clear the highlighting. */
1053 IT_cursor_to (vpos, 0);
1054 IT_clear_end_of_line (first_unused_hpos);
1055}
1056
1057static
1058IT_update_begin ()
1059{
1060 highlight = 0;
1061 IT_set_face (0); /* To possibly clear the highlighting. */
1062}
1063
1064/* This was more or less copied from xterm.c */
1065static void
1066IT_set_menu_bar_lines (window, n)
1067 Lisp_Object window;
1068 int n;
1069{
1070 struct window *w = XWINDOW (window);
1071
1072 XSETFASTINT (w->top, XFASTINT (w->top) + n);
1073 XSETFASTINT (w->height, XFASTINT (w->height) - n);
1074
1075 /* Handle just the top child in a vertical split. */
1076 if (!NILP (w->vchild))
1077 IT_set_menu_bar_lines (w->vchild, n);
1078
1079 /* Adjust all children in a horizontal split. */
1080 for (window = w->hchild; !NILP (window); window = w->next)
1081 {
1082 w = XWINDOW (window);
1083 IT_set_menu_bar_lines (window, n);
1084 }
1085}
1086
1087void
1088IT_set_frame_parameters (frame, alist)
1089 FRAME_PTR frame;
1090 Lisp_Object alist;
1091{
1092 Lisp_Object tail;
1093 int redraw;
1094 extern unsigned long load_color ();
1095 FRAME_PTR f = (FRAME_PTR) &the_only_frame;
1096
1097 redraw = 0;
1098 for (tail = alist; CONSP (tail); tail = Fcdr (tail))
1099 {
1100 Lisp_Object elt, prop, val;
1101
1102 elt = Fcar (tail);
1103 prop = Fcar (elt);
1104 val = Fcdr (elt);
1105 CHECK_SYMBOL (prop, 1);
1106
1107 if (EQ (prop, intern ("foreground-color")))
1108 {
1109 unsigned long new_color = load_color (f, val);
1110 if (new_color != ~0)
1111 {
1112 FRAME_FOREGROUND_PIXEL (f) = new_color;
1113 redraw = 1;
1114 }
1115 }
1116 else if (EQ (prop, intern ("background-color")))
1117 {
1118 unsigned long new_color = load_color (f, val);
1119 if (new_color != ~0)
1120 {
1121 FRAME_BACKGROUND_PIXEL (f) = new_color & ~8;
1122 redraw = 1;
1123 }
1124 }
1125 else if (EQ (prop, intern ("menu-bar-lines")))
1126 {
1127 int new;
1128 int old = FRAME_MENU_BAR_LINES (the_only_frame);
1129
1130 if (INTEGERP (val))
1131 new = XINT (val);
1132 else
1133 new = 0;
1134 FRAME_MENU_BAR_LINES (f) = new;
1135 IT_set_menu_bar_lines (the_only_frame.root_window, new - old);
1136 }
1137 }
1138
1139 if (redraw)
1140 {
1141 recompute_basic_faces (f);
1142 Fredraw_frame (Fselected_frame ());
1143 }
1144}
1145
1146/* Similar to the_only_frame. */
1147struct x_display the_only_x_display;
1148
1149/* This is never dereferenced. */
1150Display *x_current_display;
1151
1152#endif /* !HAVE_X_WINDOWS */
1153
956/* Do we need the internal terminal? */ 1154/* Do we need the internal terminal? */
957void 1155void
958internal_terminal_init () 1156internal_terminal_init ()
959{ 1157{
960 char *term = getenv ("TERM"); 1158 char *term = getenv ("TERM");
961 1159
1160#ifdef HAVE_X_WINDOWS
1161 if (!inhibit_window_system)
1162 return;
1163#endif
1164
962 internal_terminal 1165 internal_terminal
963 = (!noninteractive) && term && !strcmp (term, "internal"); 1166 = (!noninteractive) && term && !strcmp (term, "internal");
1167
1168#ifndef HAVE_X_WINDOWS
1169 if (internal_terminal && !inhibit_window_system)
1170 {
1171 Vwindow_system = intern ("pc");
1172 Vwindow_system_version = make_number (1);
1173
1174 bzero (&the_only_x_display, sizeof the_only_x_display);
1175 the_only_x_display.background_pixel = 7; /* White */
1176 the_only_x_display.foreground_pixel = 0; /* Black */
1177 the_only_x_display.line_height = 1;
1178 the_only_frame.display.x = &the_only_x_display;
1179 the_only_frame.output_method = output_msdos_raw;
1180
1181 init_frame_faces ((FRAME_PTR) &the_only_frame);
1182
1183 ring_bell_hook = IT_ring_bell;
1184 write_glyphs_hook = IT_write_glyphs;
1185 cursor_to_hook = raw_cursor_to_hook = IT_cursor_to;
1186 clear_end_of_line_hook = IT_clear_end_of_line;
1187 change_line_highlight_hook = IT_change_line_highlight;
1188 update_begin_hook = IT_update_begin;
1189 reassert_line_highlight_hook = IT_reassert_line_highlight;
1190
1191 /* These hooks are called by term.c without being checked. */
1192 set_terminal_modes_hook
1193 = reset_terminal_modes_hook
1194 = update_end_hook
1195 = set_terminal_window_hook
1196 = (void *)rien_du_tout;
1197 }
1198 else
1199 the_only_frame.output_method = output_termcap;
1200#endif
964} 1201}
965 1202
966/* When time zones are set from Ms-Dos too may C-libraries are playing 1203/* When time zones are set from Ms-Dos too may C-libraries are playing
@@ -1043,10 +1280,9 @@ install_ctrl_break_check ()
1043 } 1280 }
1044} 1281}
1045 1282
1046 1283/* Mouse routines follow. Coordinates are in screen positions and zero
1047/* Mouse routines under devellopment follow. Coordinates are in screen 1284 based. Mouse buttons are numbered from left to right and also zero
1048 positions and zero based. Mouse buttons are numbered from left to 1285 based. */
1049 right and also zero based. */
1050 1286
1051static int mouse_button_translate[NUM_MOUSE_BUTTONS]; 1287static int mouse_button_translate[NUM_MOUSE_BUTTONS];
1052static int mouse_button_count; 1288static int mouse_button_count;
@@ -1132,6 +1368,17 @@ mouse_released (b, xp, yp)
1132 return (regs.x.bx != 0); 1368 return (regs.x.bx != 0);
1133} 1369}
1134 1370
1371static void
1372mouse_get_xy (int *x, int *y)
1373{
1374 union REGS regs;
1375
1376 regs.x.ax = 0x0003;
1377 int86 (0x33, &regs, &regs);
1378 *x = regs.x.cx / 8;
1379 *y = regs.x.dx / 8;
1380}
1381
1135void 1382void
1136mouse_get_pos (f, bar_window, part, x, y, time) 1383mouse_get_pos (f, bar_window, part, x, y, time)
1137 FRAME_PTR *f; 1384 FRAME_PTR *f;
@@ -1139,6 +1386,7 @@ mouse_get_pos (f, bar_window, part, x, y, time)
1139 enum scroll_bar_part *part; 1386 enum scroll_bar_part *part;
1140 unsigned long *time; 1387 unsigned long *time;
1141{ 1388{
1389 int ix, iy;
1142 union REGS regs; 1390 union REGS regs;
1143 struct timeval tv; 1391 struct timeval tv;
1144 1392
@@ -1147,25 +1395,22 @@ mouse_get_pos (f, bar_window, part, x, y, time)
1147 *f = selected_frame; 1395 *f = selected_frame;
1148 *bar_window = Qnil; 1396 *bar_window = Qnil;
1149 gettimeofday (&tv, NULL); 1397 gettimeofday (&tv, NULL);
1150 *x = make_number (regs.x.cx / 8); 1398 mouse_get_xy (&ix, &iy);
1151 *y = make_number (regs.x.dx / 8);
1152 *time = tv.tv_usec;
1153 mouse_moved = 0; 1399 mouse_moved = 0;
1400 *x = make_number (ix);
1401 *y = make_number (iy);
1402 *time = tv.tv_usec;
1154} 1403}
1155 1404
1156void 1405void
1157mouse_check_moved () 1406mouse_check_moved ()
1158{ 1407{
1159 union REGS regs; 1408 int x, y;
1160 1409
1161 regs.x.ax = 0x0003; 1410 mouse_get_xy (&x, &y);
1162 int86 (0x33, &regs, &regs); 1411 mouse_moved |= (x != mouse_last_x || y != mouse_last_y);
1163 if (regs.x.cx != mouse_last_x || regs.x.dx != mouse_last_y) 1412 mouse_last_x = x;
1164 { 1413 mouse_last_y = y;
1165 mouse_moved = 1;
1166 mouse_last_x = regs.x.cx;
1167 mouse_last_y = regs.x.dx;
1168 }
1169} 1414}
1170 1415
1171int 1416int
@@ -1174,6 +1419,10 @@ mouse_init1 ()
1174 union REGS regs; 1419 union REGS regs;
1175 int present; 1420 int present;
1176 1421
1422#ifdef HAVE_X_WINDOWS
1423 if (!inhibit_window_system)
1424 return 0;
1425#endif
1177 if (!internal_terminal) 1426 if (!internal_terminal)
1178 return 0; 1427 return 0;
1179 1428
@@ -1211,6 +1460,7 @@ mouse_init1 ()
1211 return present; 1460 return present;
1212} 1461}
1213 1462
1463#ifndef HAVE_X_WINDOWS
1214/* See xterm.c for more info. */ 1464/* See xterm.c for more info. */
1215void 1465void
1216pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip) 1466pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip)
@@ -1237,5 +1487,349 @@ glyph_to_pixel_coords (f, x, y, pix_x, pix_y)
1237 *pix_x = x; 1487 *pix_x = x;
1238 *pix_y = y; 1488 *pix_y = y;
1239} 1489}
1490
1491/* Simulation of X's menus. Nothing too fancy here -- just make it work
1492 for now.
1493
1494 Actually, I don't know the meaning of all the parameters of the functions
1495 here -- I only know how they are called by xmenu.c. I could of course
1496 grab the nearest Xlib manual (down the hall, second-to-last door on the
1497 left), but I don't think it's worth the effort. */
1498
1499static XMenu *
1500IT_menu_create ()
1501{
1502 XMenu *menu;
1503
1504 menu = (XMenu *) xmalloc (sizeof (XMenu));
1505 menu->allocated = menu->count = menu->panecount = menu->width = 0;
1506 return menu;
1507}
1508
1509/* Allocate some (more) memory for MENU ensuring that there is room for one
1510 for item. */
1511static void
1512IT_menu_make_room (XMenu *menu)
1513{
1514 if (menu->allocated == 0)
1515 {
1516 int count = menu->allocated = 10;
1517 menu->text = (char **) xmalloc (count * sizeof (char *));
1518 menu->submenu = (XMenu **) xmalloc (count * sizeof (XMenu *));
1519 menu->panenumber = (int *) xmalloc (count * sizeof (int));
1520 }
1521 else if (menu->allocated == menu->count)
1522 {
1523 int count = menu->allocated = menu->allocated + 10;
1524 menu->text
1525 = (char **) xrealloc (menu->text, count * sizeof (char *));
1526 menu->submenu
1527 = (XMenu **) xrealloc (menu->submenu, count * sizeof (XMenu *));
1528 menu->panenumber
1529 = (int *) xrealloc (menu->panenumber, count * sizeof (int));
1530 }
1531}
1532
1533/* Search the given menu structure for a given pane number. */
1534static XMenu *
1535IT_menu_search_pane (XMenu *menu, int pane)
1536{
1537 int i;
1538 XMenu *try;
1539
1540 for (i = 0; i < menu->count; i++)
1541 if (menu->submenu[i])
1542 if (pane == menu->panenumber[i])
1543 return menu->submenu[i];
1544 else
1545 if ((try = IT_menu_search_pane (menu->submenu[i], pane)))
1546 return try;
1547 return (XMenu *) 0;
1548}
1549
1550/* Determine how much screen space a given menu needs. */
1551static void
1552IT_menu_calc_size (XMenu *menu, int *width, int *height)
1553{
1554 int i, h2, w2, maxsubwidth, maxheight;
1555
1556 maxsubwidth = 0;
1557 maxheight = menu->count;
1558 for (i = 0; i < menu->count; i++)
1559 {
1560 if (menu->submenu[i])
1561 {
1562 IT_menu_calc_size (menu->submenu[i], &w2, &h2);
1563 if (w2 > maxsubwidth) maxsubwidth = w2;
1564 if (i + h2 > maxheight) maxheight = i + h2;
1565 }
1566 }
1567 *width = menu->width + maxsubwidth;
1568 *height = maxheight;
1569}
1570
1571/* Display MENU at (X,Y) using FACES. */
1572static void
1573IT_menu_display (XMenu *menu, int y, int x, int *faces)
1574{
1575 int i, j, face, width;
1576 GLYPH *text, *p;
1577 char *q;
1578 int mx, my;
1579 int enabled, mousehere;
1580 int row, col;
1581
1582 width = menu->width;
1583 text = (GLYPH *) xmalloc ((width + 2) * sizeof (GLYPH));
1584 ScreenGetCursor (&row, &col);
1585 mouse_get_xy (&mx, &my);
1586 mouse_off ();
1587 (*update_begin_hook) ();
1588 for (i = 0; i < menu->count; i++)
1589 {
1590 (*cursor_to_hook) (y + i, x);
1591 enabled
1592 = (!menu->submenu[i] && menu->panenumber[i]) || (menu->submenu[i]);
1593 mousehere = (y + i == my && x <= mx && mx < x + width + 2);
1594 face = faces[enabled + mousehere * 2];
1595 p = text;
1596 *p++ = FAST_MAKE_GLYPH (' ', face);
1597 for (j = 0, q = menu->text[i]; *q; j++)
1598 *p++ = FAST_MAKE_GLYPH (*q++, face);
1599 for (; j < width; j++)
1600 *p++ = FAST_MAKE_GLYPH (' ', face);
1601 *p++ = FAST_MAKE_GLYPH (menu->submenu[i] ? 16 : ' ', face);
1602 (*write_glyphs_hook) (text, width + 2);
1603 }
1604 internal_flush (stdout);
1605 (*update_end_hook) ();
1606 mouse_on ();
1607 ScreenSetCursor (row, col);
1608 xfree (text);
1609}
1610
1611/* Create a brand new menu structure. */
1612XMenu *
1613XMenuCreate (int foo, int bar)
1614{
1615 return IT_menu_create ();
1616}
1617
1618/* Create a new pane and place it on the outer-most level. It is not
1619 clear that it should be placed out there, but I don't know what else
1620 to do. */
1621int
1622XMenuAddPane (XMenu *menu, char *txt, int enable)
1623{
1624 int len;
1625
1626 if (!enable)
1627 abort ();
1628
1629 IT_menu_make_room (menu);
1630 menu->submenu[menu->count] = IT_menu_create ();
1631 menu->text[menu->count] = txt;
1632 menu->panenumber[menu->count] = ++menu->panecount;
1633 menu->count++;
1634 if ((len = strlen (txt)) > menu->width) menu->width = len;
1635 return menu->panecount;
1636}
1637
1638/* Create a new item in a menu pane. */
1639int
1640XMenuAddSelection (XMenu *menu, int pane, int foo, char *txt, int enable)
1641{
1642 int len;
1643
1644 if (pane)
1645 if (!(menu = IT_menu_search_pane (menu, pane)))
1646 return XM_FAILURE;
1647 IT_menu_make_room (menu);
1648 menu->submenu[menu->count] = (XMenu *) 0;
1649 menu->text[menu->count] = txt;
1650 menu->panenumber[menu->count] = enable;
1651 menu->count++;
1652 if ((len = strlen (txt)) > menu->width) menu->width = len;
1653 return XM_SUCCESS;
1654}
1655
1656/* Decide where the menu would be placed if requested at (X,Y). */
1657XMenuLocate (XMenu *menu, int foo1, int foo2, int x, int y,
1658 int *ulx, int *uly, int *width, int *height)
1659{
1660 if (menu->count == 1 && menu->submenu[0])
1661 /* Special case: the menu consists of only one pane. */
1662 IT_menu_calc_size (menu->submenu[0], width, height);
1663 else
1664 IT_menu_calc_size (menu, width, height);
1665 *ulx = x + 1;
1666 *uly = y;
1667 *width += 2;
1668}
1669
1670typedef struct
1671{
1672 void *screen_behind;
1673 XMenu *menu;
1674 int pane;
1675 int x, y;
1676} IT_menu_state;
1677
1678
1679/* Display menu, wait for user's response, and return that response. */
1680int
1681XMenuActivate (XMenu *menu, int *pane, int *selidx,
1682 int x0, int y0, unsigned ButtonMask, char **txt)
1683{
1684 IT_menu_state *state;
1685 int statecount;
1686 int x, y, i, b;
1687 int screensize;
1688 int faces[4], selectface;
1689 int leave, result, onepane;
1690
1691 /* Just in case we got here without a mouse present... */
1692 if (!have_mouse)
1693 return XM_IA_SELECT;
1694
1695 state = alloca (menu->panecount * sizeof (IT_menu_state));
1696 screensize = ScreenRows () * ScreenCols () * 2;
1697 faces[0]
1698 = compute_glyph_face (&the_only_frame,
1699 face_name_id_number
1700 (&the_only_frame,
1701 intern ("msdos-menu-passive-face")),
1702 0);
1703 faces[1]
1704 = compute_glyph_face (&the_only_frame,
1705 face_name_id_number
1706 (&the_only_frame,
1707 intern ("msdos-menu-active-face")),
1708 0);
1709 selectface
1710 = face_name_id_number (&the_only_frame, intern ("msdos-menu-select-face"));
1711 faces[2] = compute_glyph_face (&the_only_frame, selectface, faces[0]);
1712 faces[3] = compute_glyph_face (&the_only_frame, selectface, faces[1]);
1713
1714 statecount = 1;
1715 state[0].menu = menu;
1716 mouse_off ();
1717 ScreenRetrieve (state[0].screen_behind = xmalloc (screensize));
1718 mouse_on ();
1719 if ((onepane = menu->count == 1 && menu->submenu[0]))
1720 {
1721 menu->width = menu->submenu[0]->width;
1722 state[0].menu = menu->submenu[0];
1723 }
1724 else
1725 {
1726 state[0].menu = menu;
1727 }
1728 state[0].x = x0 - 1;
1729 state[0].y = y0;
1730 state[0].pane = onepane;
1731
1732 mouse_last_x = -1; /* A hack that forces display. */
1733 leave = 0;
1734 while (!leave)
1735 {
1736 mouse_check_moved ();
1737 if (mouse_moved)
1738 {
1739 mouse_moved = 0;
1740 result = XM_IA_SELECT;
1741 mouse_get_xy (&x, &y);
1742 for (i = 0; i < statecount; i++)
1743 if (state[i].x <= x && x < state[i].x + state[i].menu->width + 2)
1744 {
1745 int dy = y - state[i].y;
1746 if (0 <= dy && dy < state[i].menu->count)
1747 {
1748 if (!state[i].menu->submenu[dy])
1749 if (state[i].menu->panenumber[dy])
1750 result = XM_SUCCESS;
1751 else
1752 result = XM_IA_SELECT;
1753 *pane = state[i].pane - 1;
1754 *selidx = dy;
1755 /* We hit some part of a menu, so drop extra menues that
1756 have been opened. That does not include an open and
1757 active submenu. */
1758 if (i != statecount - 2
1759 || state[i].menu->submenu[dy] != state[i+1].menu)
1760 while (i != statecount - 1)
1761 {
1762 statecount--;
1763 mouse_off ();
1764 ScreenUpdate (state[statecount].screen_behind);
1765 mouse_on ();
1766 xfree (state[statecount].screen_behind);
1767 }
1768 if (i == statecount - 1 && state[i].menu->submenu[dy])
1769 {
1770 IT_menu_display (state[i].menu,
1771 state[i].y,
1772 state[i].x,
1773 faces);
1774 state[statecount].menu = state[i].menu->submenu[dy];
1775 state[statecount].pane = state[i].menu->panenumber[dy];
1776 mouse_off ();
1777 ScreenRetrieve (state[statecount].screen_behind
1778 = xmalloc (screensize));
1779 mouse_on ();
1780 state[statecount].x
1781 = state[i].x + state[i].menu->width + 2;
1782 state[statecount].y = y;
1783 statecount++;
1784 }
1785 }
1786 }
1787 IT_menu_display (state[statecount - 1].menu,
1788 state[statecount - 1].y,
1789 state[statecount - 1].x,
1790 faces);
1791 }
1792 for (b = 0; b < mouse_button_count; b++)
1793 {
1794 (void) mouse_pressed (b, &x, &y);
1795 if (mouse_released (b, &x, &y))
1796 leave = 1;
1797 }
1798 }
1799
1800 mouse_off ();
1801 ScreenUpdate (state[0].screen_behind);
1802 mouse_on ();
1803 while (statecount--)
1804 xfree (state[statecount].screen_behind);
1805 return result;
1806}
1807
1808/* Dispose of a menu. */
1809XMenuDestroy (XMenu *menu)
1810{
1811 int i;
1812 if (menu->allocated)
1813 {
1814 for (i = 0; i < menu->count; i++)
1815 if (menu->submenu[i])
1816 XMenuDestroy (menu->submenu[i]);
1817 xfree (menu->text);
1818 xfree (menu->submenu);
1819 xfree (menu->panenumber);
1820 }
1821 xfree (menu);
1822}
1823
1824int x_pixel_width (struct frame *f)
1825{
1826 return FRAME_WIDTH(f);
1827}
1828
1829int x_pixel_height (struct frame *f)
1830{
1831 return FRAME_HEIGHT(f);
1832}
1833#endif /* !HAVE_X_WINDOWS */
1240 1834
1241#endif /* MSDOS */ 1835#endif /* MSDOS */
diff --git a/src/msdos.h b/src/msdos.h
index f566da2160f..37a576a11c4 100644
--- a/src/msdos.h
+++ b/src/msdos.h
@@ -17,7 +17,9 @@ You should have received a copy of the GNU General Public License
17along with GNU Emacs; see the file COPYING. If not, write to 17along with GNU Emacs; see the file COPYING. If not, write to
18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19 19
20#include <time.h> 20#ifndef _MSDOS_H_
21#define _MSDOS_H_
22
21#include <dpmi.h> 23#include <dpmi.h>
22 24
23int dos_ttraw (); 25int dos_ttraw ();
@@ -29,7 +31,7 @@ void sleep_or_kbd_hit (int, int);
29char *rootrelativepath (char *); 31char *rootrelativepath (char *);
30void init_environment (); 32void init_environment ();
31void internal_terminal_init (); 33void internal_terminal_init ();
32#ifndef _stdio_h_ 34#ifdef _stdio_h_
33int internal_flush (FILE *); 35int internal_flush (FILE *);
34#endif 36#endif
35void ctrl_break_func (_go32_dpmi_registers *); 37void ctrl_break_func (_go32_dpmi_registers *);
@@ -45,3 +47,82 @@ void mouse_check_moved ();
45int mouse_pressed (int, int *, int *); 47int mouse_pressed (int, int *, int *);
46int mouse_released (int, int *, int *); 48int mouse_released (int, int *, int *);
47void init_gettimeofday (); 49void init_gettimeofday ();
50
51#ifndef HAVE_X_WINDOWS
52/* Dummy types. */
53typedef int XFontStruct;
54typedef int GC;
55typedef int Pixmap;
56typedef int Display;
57typedef int Window;
58#define PIX_TYPE int
59#define XDISPLAY
60
61/* This is a cut-down version of the one in xterm.h, which see. */
62struct x_display
63{
64 int left_pos;
65 int top_pos;
66 int line_height;
67 PIX_TYPE background_pixel;
68 PIX_TYPE foreground_pixel;
69 XFontStruct *font;
70 struct face **param_faces;
71 int n_param_faces;
72 struct face **computed_faces;
73 int n_computed_faces;
74 int size_computed_faces;
75};
76
77extern struct x_display the_only_x_display;
78extern Display *x_current_display;
79
80#define FRAME_PARAM_FACES(f) (the_only_x_display.param_faces)
81#define FRAME_N_PARAM_FACES(f) (the_only_x_display.n_param_faces)
82#define FRAME_DEFAULT_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[0])
83#define FRAME_MODE_LINE_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[1])
84#define FRAME_COMPUTED_FACES(f) (the_only_x_display.computed_faces)
85#define FRAME_N_COMPUTED_FACES(f) (the_only_x_display.n_computed_faces)
86#define FRAME_SIZE_COMPUTED_FACES(f) (the_only_x_display.size_computed_faces)
87#define FRAME_DEFAULT_FACE(f) (the_only_x_display.computed_faces[0])
88#define FRAME_MODE_LINE_FACE(f) (the_only_x_display.computed_faces[1])
89#define FRAME_X_DISPLAY(f) ((Display *) 0)
90#define FRAME_FOREGROUND_PIXEL(f) (the_only_x_display.foreground_pixel)
91#define FRAME_BACKGROUND_PIXEL(f) (the_only_x_display.background_pixel)
92#define FRAME_FONT(f) (the_only_x_display.font)
93
94#define XFreeGC (void)
95#define same_size_fonts(foo,bar) (1)
96#define unload_font(p1,p2)
97#define unload_color(p1,p2)
98#define x_destroy_bitmap(p1,p2)
99#define load_pixmap(p1,p2,p3,p4) (0)
100#define XGetGeometry(p1,p2,p3,p4,p5,p6,p7,p8,p9)
101#define DisplayWidth(p1,p2) (the_only_frame.width)
102#define DisplayHeight(p1,p2) (the_only_frame.height)
103#define XMenuSetAEQ (void)
104#define XMenuSetFreeze (void)
105#define XMenuRecompute (void)
106#define FONT_WIDTH(foo) 1
107/* Function `getcbrk' is the most harmless I can think of right now... */
108#define check_x if (FRAME_TERMCAP_P (bar)) error ("Not running under a windows system."); else getcbrk
109#define XM_FAILURE -1
110#define XM_SUCCESS 1
111#define XM_NO_SELECT 2
112#define XM_IA_SELECT 3
113#define ButtonReleaseMask 0
114
115typedef struct x_menu_struct
116{
117 int count;
118 char **text;
119 struct x_menu_struct **submenu;
120 int *panenumber; /* Also used as enable. */
121 int allocated;
122 int panecount;
123 int width;
124} XMenu;
125
126#endif /* not HAVE_X_WINDOWS */
127
128#endif /* not _MSDOS_H_ */
diff --git a/src/puresize.h b/src/puresize.h
index d7a30f3821a..713606ef21a 100644
--- a/src/puresize.h
+++ b/src/puresize.h
@@ -29,11 +29,18 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
29 29
30/* First define a measure of the amount of data we have. */ 30/* First define a measure of the amount of data we have. */
31 31
32/* A system configuration file may set this to request a certain extra
33 amount of storage. This is a lot more update-robust that defining
34 BASE_PURESIZE or even PURESIZE directly. */
35#ifndef SYSTEM_PURESIZE_EXTRA
36#define SYSTEM_PURESIZE_EXTRA 0
37#endif
38
32#ifndef BASE_PURESIZE 39#ifndef BASE_PURESIZE
33#ifdef MULTI_FRAME 40#ifdef MULTI_FRAME
34#define BASE_PURESIZE 265000 41#define BASE_PURESIZE (265000 + SYSTEM_PURESIZE_EXTRA)
35#else 42#else
36#define BASE_PURESIZE 220000 43#define BASE_PURESIZE (220000 + SYSTEM_PURESIZE_EXTRA)
37#endif 44#endif
38#endif 45#endif
39 46
diff --git a/src/s/msdos.h b/src/s/msdos.h
index f1d2d1efb47..a3a050afa7a 100644
--- a/src/s/msdos.h
+++ b/src/s/msdos.h
@@ -169,7 +169,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
169 169
170#define ORDINARY_LINK 170#define ORDINARY_LINK
171 171
172/* command.com does not under stand `...` so we define this. */ 172/* command.com does not understand `...` so we define this. */
173#define LIB_GCC -Lgcc 173#define LIB_GCC -Lgcc
174#define DONT_NEED_ENVIRON 174#define DONT_NEED_ENVIRON
175#define SEPCHAR ';' 175#define SEPCHAR ';'
@@ -215,8 +215,19 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
215/* Mode line description of a buffer's type. */ 215/* Mode line description of a buffer's type. */
216#define MODE_LINE_BINARY_TEXT(buf) (NILP(buf->buffer_file_type) ? "T" : "B") 216#define MODE_LINE_BINARY_TEXT(buf) (NILP(buf->buffer_file_type) ? "T" : "B")
217 217
218/* We need a little extra space, see ../../lisp/loadup.el */
219#define PURESIZE 240000
220
221/* We have (the code to control) a mouse. */ 218/* We have (the code to control) a mouse. */
222#define HAVE_MOUSE 219#define HAVE_MOUSE
220
221/* We have support for faces. */
222#define HAVE_FACES
223
224/* Define one of these for easier conditionals. */
225#ifdef HAVE_X_WINDOWS
226/* We need a little extra space, see ../../lisp/loadup.el */
227#define SYSTEM_PURESIZE_EXTRA 15000
228#define HAVE_X11R5
229#define LIBX11_SYSTEM -lxext -lsys
230#else
231/* We need a little extra space, see ../../lisp/loadup.el */
232#define SYSTEM_PURESIZE_EXTRA 30000
233#endif
diff --git a/src/sysdep.c b/src/sysdep.c
index ac9853a724f..ad78bc65a92 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1148,7 +1148,11 @@ init_sys_modes ()
1148 1148
1149 EMACS_GET_TTY (input_fd, &old_tty); 1149 EMACS_GET_TTY (input_fd, &old_tty);
1150 1150
1151#ifdef HAVE_X_WINDOWS
1152 /* Emacs' window system on MSDOG uses the `internal terminal' and therefore
1153 needs the initialization code below. */
1151 if (!read_socket_hook && EQ (Vwindow_system, Qnil)) 1154 if (!read_socket_hook && EQ (Vwindow_system, Qnil))
1155#endif
1152 { 1156 {
1153 tty = old_tty; 1157 tty = old_tty;
1154 1158
@@ -1300,7 +1304,8 @@ init_sys_modes ()
1300 tty.ltchars = new_ltchars; 1304 tty.ltchars = new_ltchars;
1301#endif /* HAVE_LTCHARS */ 1305#endif /* HAVE_LTCHARS */
1302#ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */ 1306#ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */
1303 internal_terminal_init (); 1307 if (!term_initted)
1308 internal_terminal_init ();
1304 dos_ttraw (); 1309 dos_ttraw ();
1305#endif 1310#endif
1306 1311
@@ -1510,9 +1515,22 @@ reset_sys_modes ()
1510 } 1515 }
1511 if (!term_initted) 1516 if (!term_initted)
1512 return; 1517 return;
1518#ifdef HAVE_X_WINDOWS
1519 /* Emacs' window system on MSDOG uses the `internal terminal' and therefore
1520 needs the clean-up code below. */
1513 if (read_socket_hook || !EQ (Vwindow_system, Qnil)) 1521 if (read_socket_hook || !EQ (Vwindow_system, Qnil))
1514 return; 1522 return;
1523#endif
1515 cursor_to (FRAME_HEIGHT (selected_frame) - 1, 0); 1524 cursor_to (FRAME_HEIGHT (selected_frame) - 1, 0);
1525#ifdef MSDOS
1526 if (!EQ (Vwindow_system, Qnil))
1527 {
1528 /* Change to grey on white. */
1529 putchar ('\e');
1530 putchar ('A');
1531 putchar (7);
1532 }
1533#endif
1516 clear_end_of_line (FRAME_WIDTH (selected_frame)); 1534 clear_end_of_line (FRAME_WIDTH (selected_frame));
1517 /* clear_end_of_line may move the cursor */ 1535 /* clear_end_of_line may move the cursor */
1518 cursor_to (FRAME_HEIGHT (selected_frame) - 1, 0); 1536 cursor_to (FRAME_HEIGHT (selected_frame) - 1, 0);
@@ -1704,11 +1722,7 @@ kbd_input_ast ()
1704 struct input_event e; 1722 struct input_event e;
1705 e.kind = ascii_keystroke; 1723 e.kind = ascii_keystroke;
1706 XSETINT (e.code, c); 1724 XSETINT (e.code, c);
1707#ifdef MULTI_FRAME
1708 XSETFRAME (e.frame_or_window, selected_frame); 1725 XSETFRAME (e.frame_or_window, selected_frame);
1709#else
1710 e.frame_or_window = Qnil;
1711#endif
1712 kbd_buffer_store_event (&e); 1726 kbd_buffer_store_event (&e);
1713 } 1727 }
1714 if (input_available_clear_time) 1728 if (input_available_clear_time)
diff --git a/src/window.c b/src/window.c
index fcb163f42fa..c6c95e68405 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3184,6 +3184,8 @@ init_window_once ()
3184#else /* not MULTI_FRAME */ 3184#else /* not MULTI_FRAME */
3185 extern Lisp_Object get_minibuffer (); 3185 extern Lisp_Object get_minibuffer ();
3186 3186
3187 selected_frame = last_nonminibuf_frame = &the_only_frame;
3188
3187 minibuf_window = make_window (); 3189 minibuf_window = make_window ();
3188 FRAME_ROOT_WINDOW (selected_frame) = make_window (); 3190 FRAME_ROOT_WINDOW (selected_frame) = make_window ();
3189 3191
diff --git a/src/xdisp.c b/src/xdisp.c
index cbcad61400e..a024ffa7c56 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -742,7 +742,7 @@ redisplay ()
742 { 742 {
743 Lisp_Object tail, frame; 743 Lisp_Object tail, frame;
744 744
745#ifdef HAVE_X_WINDOWS 745#ifdef HAVE_FACES
746 /* Clear the face cache, only when we do a full redisplay 746 /* Clear the face cache, only when we do a full redisplay
747 and not too often either. */ 747 and not too often either. */
748 if (clear_face_cache_count > 1000) 748 if (clear_face_cache_count > 1000)
@@ -1959,7 +1959,7 @@ copy_part_of_rope (f, to, s, from, len, face)
1959 int last_code = -1; 1959 int last_code = -1;
1960 int last_merged = 0; 1960 int last_merged = 0;
1961 1961
1962#ifdef HAVE_X_WINDOWS 1962#ifdef HAVE_FACES
1963 if (! FRAME_TERMCAP_P (f)) 1963 if (! FRAME_TERMCAP_P (f))
1964 while (n--) 1964 while (n--)
1965 { 1965 {
@@ -2004,7 +2004,7 @@ fix_glyph (f, glyph, cface)
2004 GLYPH glyph; 2004 GLYPH glyph;
2005 int cface; 2005 int cface;
2006{ 2006{
2007#ifdef HAVE_X_WINDOWS 2007#ifdef HAVE_FACES
2008 if (! FRAME_TERMCAP_P (f)) 2008 if (! FRAME_TERMCAP_P (f))
2009 { 2009 {
2010 if (FAST_GLYPH_FACE (glyph) != 0) 2010 if (FAST_GLYPH_FACE (glyph) != 0)
@@ -2273,7 +2273,7 @@ display_text_line (w, start, vpos, hpos, taboffset)
2273 break; 2273 break;
2274#endif 2274#endif
2275 2275
2276#ifdef HAVE_X_WINDOWS 2276#ifdef HAVE_FACES
2277 /* Did we hit a face change? Figure out what face we should 2277 /* Did we hit a face change? Figure out what face we should
2278 use now. We also hit this the first time through the 2278 use now. We also hit this the first time through the
2279 loop, to see what face we should start with. */ 2279 loop, to see what face we should start with. */
@@ -2329,7 +2329,7 @@ display_text_line (w, start, vpos, hpos, taboffset)
2329 copy_part_of_rope (f, p1prev, p1prev, invis_vector_contents, 2329 copy_part_of_rope (f, p1prev, p1prev, invis_vector_contents,
2330 (p1 - p1prev), current_face); 2330 (p1 - p1prev), current_face);
2331 } 2331 }
2332#ifdef HAVE_X_WINDOWS 2332#ifdef HAVE_FACES
2333 /* Draw the face of the newline character as extending all the 2333 /* Draw the face of the newline character as extending all the
2334 way to the end of the frame line. */ 2334 way to the end of the frame line. */
2335 if (current_face) 2335 if (current_face)
@@ -2366,7 +2366,7 @@ display_text_line (w, start, vpos, hpos, taboffset)
2366 copy_part_of_rope (f, p1prev, p1prev, invis_vector_contents, 2366 copy_part_of_rope (f, p1prev, p1prev, invis_vector_contents,
2367 (p1 - p1prev), current_face); 2367 (p1 - p1prev), current_face);
2368 } 2368 }
2369#ifdef HAVE_X_WINDOWS 2369#ifdef HAVE_FACES
2370 /* Draw the face of the newline character as extending all the 2370 /* Draw the face of the newline character as extending all the
2371 way to the end of the frame line. */ 2371 way to the end of the frame line. */
2372 if (current_face) 2372 if (current_face)
@@ -2607,7 +2607,7 @@ display_text_line (w, start, vpos, hpos, taboffset)
2607 2607
2608 if (len > width) 2608 if (len > width)
2609 len = width; 2609 len = width;
2610#ifdef HAVE_X_WINDOWS 2610#ifdef HAVE_FACES
2611 if (!NULL_INTERVAL_P (XSTRING (Voverlay_arrow_string)->intervals)) 2611 if (!NULL_INTERVAL_P (XSTRING (Voverlay_arrow_string)->intervals))
2612 { 2612 {
2613 /* If the arrow string has text props, obey them when displaying. */ 2613 /* If the arrow string has text props, obey them when displaying. */
@@ -2624,7 +2624,7 @@ display_text_line (w, start, vpos, hpos, taboffset)
2624 } 2624 }
2625 } 2625 }
2626 else 2626 else
2627#endif /* HAVE_X_WINDOWS */ 2627#endif /* HAVE_FACES */
2628 { 2628 {
2629 for (i = 0; i < len; i++) 2629 for (i = 0; i < len; i++)
2630 leftmargin[i] = p[i]; 2630 leftmargin[i] = p[i];
@@ -2727,7 +2727,7 @@ display_mode_line (w)
2727 if (XFASTINT (w->width) == FRAME_WIDTH (f) 2727 if (XFASTINT (w->width) == FRAME_WIDTH (f)
2728 || XFASTINT (XWINDOW (w->parent)->width) == FRAME_WIDTH (f)) 2728 || XFASTINT (XWINDOW (w->parent)->width) == FRAME_WIDTH (f))
2729 FRAME_DESIRED_GLYPHS (f)->highlight[vpos] = mode_line_inverse_video; 2729 FRAME_DESIRED_GLYPHS (f)->highlight[vpos] = mode_line_inverse_video;
2730#ifdef HAVE_X_WINDOWS 2730#ifdef HAVE_FACES
2731 else if (! FRAME_TERMCAP_P (f)) 2731 else if (! FRAME_TERMCAP_P (f))
2732 { 2732 {
2733 /* For a partial width window, explicitly set face of each glyph. */ 2733 /* For a partial width window, explicitly set face of each glyph. */
diff --git a/src/xfaces.c b/src/xfaces.c
index 3400be71332..2a466e6d64b 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -25,9 +25,14 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
25#include <config.h> 25#include <config.h>
26#include "lisp.h" 26#include "lisp.h"
27 27
28#ifdef HAVE_X_WINDOWS 28#ifdef HAVE_FACES
29 29
30#ifdef HAVE_X_WINDOWS
30#include "xterm.h" 31#include "xterm.h"
32#endif
33#ifdef MSDOS
34#include "dosfns.h"
35#endif
31#include "buffer.h" 36#include "buffer.h"
32#include "dispextern.h" 37#include "dispextern.h"
33#include "frame.h" 38#include "frame.h"
@@ -35,6 +40,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
35#include "window.h" 40#include "window.h"
36#include "intervals.h" 41#include "intervals.h"
37 42
43#ifdef HAVE_X_WINDOWS
38/* Compensate for bug in Xos.h on some systems, on which it requires 44/* Compensate for bug in Xos.h on some systems, on which it requires
39 time.h. On some such systems, Xos.h tries to redefine struct 45 time.h. On some such systems, Xos.h tries to redefine struct
40 timeval and struct timezone if USG is #defined while it is 46 timeval and struct timezone if USG is #defined while it is
@@ -52,7 +58,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
52#include <X11/Xos.h> 58#include <X11/Xos.h>
53 59
54#endif 60#endif
55 61#endif /* HAVE_X_WINDOWS */
56 62
57/* An explanation of the face data structures. */ 63/* An explanation of the face data structures. */
58 64
@@ -205,6 +211,7 @@ face_eql (face1, face2)
205 211
206/* Managing graphics contexts of faces. */ 212/* Managing graphics contexts of faces. */
207 213
214#ifdef HAVE_X_WINDOWS
208/* Given a computed face, construct its graphics context if necessary. */ 215/* Given a computed face, construct its graphics context if necessary. */
209 216
210struct face * 217struct face *
@@ -454,6 +461,55 @@ load_pixmap (f, name, w_ptr, h_ptr)
454 461
455 return bitmap_id; 462 return bitmap_id;
456} 463}
464
465#else /* !HAVE_X_WINDOWS */
466
467/* Stubs for MSDOS when not under X. */
468
469struct face *
470intern_face (f, face)
471 struct frame *f;
472 struct face *face;
473{
474 return face;
475}
476
477void
478clear_face_cache ()
479{
480 /* No action. */
481}
482
483static void
484build_face (f, face)
485 struct frame *f;
486 struct face *face;
487{
488 face->gc = 1;
489}
490
491#ifdef MSDOS
492unsigned long
493load_color (f, name)
494 FRAME_PTR f;
495 Lisp_Object name;
496{
497 Lisp_Object result;
498
499 if (NILP (name))
500 return FACE_DEFAULT;
501
502 CHECK_STRING (name, 0);
503 result = call1 (Qmsdos_color_translate, name);
504 if (INTEGERP (result))
505 return XINT (result);
506 else
507 Fsignal (Qerror, Fcons (build_string ("undefined color"),
508 Fcons (name, Qnil)));
509}
510#endif
511#endif /* !HAVE_X_WINDOWS */
512
457 513
458/* Managing parameter face arrays for frames. */ 514/* Managing parameter face arrays for frames. */
459 515
@@ -471,6 +527,7 @@ init_frame_faces (f)
471 new_computed_face (f, FRAME_PARAM_FACES (f)[1]); 527 new_computed_face (f, FRAME_PARAM_FACES (f)[1]);
472 recompute_basic_faces (f); 528 recompute_basic_faces (f);
473 529
530#ifdef MULTI_FRAME
474 /* Find another X frame. */ 531 /* Find another X frame. */
475 { 532 {
476 Lisp_Object tail, frame, result; 533 Lisp_Object tail, frame, result;
@@ -499,6 +556,7 @@ init_frame_faces (f)
499 ensure_face_ready (f, i); 556 ensure_face_ready (f, i);
500 } 557 }
501 } 558 }
559#endif /* MULTI_FRAME */
502} 560}
503 561
504 562
@@ -627,6 +685,7 @@ ensure_face_ready (f, id)
627 FRAME_PARAM_FACES (f) [id] = allocate_face (); 685 FRAME_PARAM_FACES (f) [id] = allocate_face ();
628} 686}
629 687
688#ifdef HAVE_X_WINDOWS
630/* Return non-zero if FONT1 and FONT2 have the same width. 689/* Return non-zero if FONT1 and FONT2 have the same width.
631 We do not check the height, because we can now deal with 690 We do not check the height, because we can now deal with
632 different heights. 691 different heights.
@@ -667,6 +726,7 @@ frame_update_line_height (f)
667 f->display.x->line_height = biggest; 726 f->display.x->line_height = biggest;
668 return 1; 727 return 1;
669} 728}
729#endif /* not HAVE_X_WINDOWS */
670 730
671/* Modify face TO by copying from FROM all properties which have 731/* Modify face TO by copying from FROM all properties which have
672 nondefault settings. */ 732 nondefault settings. */
@@ -1001,18 +1061,17 @@ DEFUN ("make-face-internal", Fmake_face_internal, Smake_face_internal, 1, 1, 0,
1001 (face_id) 1061 (face_id)
1002 Lisp_Object face_id; 1062 Lisp_Object face_id;
1003{ 1063{
1004 Lisp_Object rest; 1064 Lisp_Object rest, frame;
1005 int id = XINT (face_id); 1065 int id = XINT (face_id);
1006 1066
1007 CHECK_NUMBER (face_id, 0); 1067 CHECK_NUMBER (face_id, 0);
1008 if (id < 0 || id >= next_face_id) 1068 if (id < 0 || id >= next_face_id)
1009 error ("Face id out of range"); 1069 error ("Face id out of range");
1010 1070
1011 for (rest = Vframe_list; !NILP (rest); rest = XCONS (rest)->cdr) 1071 FOR_EACH_FRAME (rest, frame)
1012 { 1072 {
1013 struct frame *f = XFRAME (XCONS (rest)->car); 1073 if (FRAME_X_P (XFRAME (frame)))
1014 if (FRAME_X_P (f)) 1074 ensure_face_ready (XFRAME (frame), id);
1015 ensure_face_ready (f, id);
1016 } 1075 }
1017 return Qnil; 1076 return Qnil;
1018} 1077}
@@ -1046,6 +1105,9 @@ DEFUN ("set-face-attribute-internal", Fset_face_attribute_internal,
1046 1105
1047 if (EQ (attr_name, intern ("font"))) 1106 if (EQ (attr_name, intern ("font")))
1048 { 1107 {
1108#if defined (MSDOS) && !defined (HAVE_X_WINDOWS)
1109 face->font = 0; /* The one and only font. */
1110#else
1049 XFontStruct *font = load_font (f, attr_value); 1111 XFontStruct *font = load_font (f, attr_value);
1050 if (face->font != f->display.x->font) 1112 if (face->font != f->display.x->font)
1051 unload_font (f, face->font); 1113 unload_font (f, face->font);
@@ -1055,6 +1117,7 @@ DEFUN ("set-face-attribute-internal", Fset_face_attribute_internal,
1055 /* Must clear cache, since it might contain the font 1117 /* Must clear cache, since it might contain the font
1056 we just got rid of. */ 1118 we just got rid of. */
1057 garbaged = 1; 1119 garbaged = 1;
1120#endif
1058 } 1121 }
1059 else if (EQ (attr_name, intern ("foreground"))) 1122 else if (EQ (attr_name, intern ("foreground")))
1060 { 1123 {
@@ -1067,6 +1130,9 @@ DEFUN ("set-face-attribute-internal", Fset_face_attribute_internal,
1067 { 1130 {
1068 unsigned long new_color = load_color (f, attr_value); 1131 unsigned long new_color = load_color (f, attr_value);
1069 unload_color (f, face->background); 1132 unload_color (f, face->background);
1133#if defined (MSDOS) && !defined (HAVE_X_WINDOWS)
1134 new_color &= ~8; /* Bright would give blinking characters. */
1135#endif
1070 face->background = new_color; 1136 face->background = new_color;
1071 garbaged = 1; 1137 garbaged = 1;
1072 } 1138 }
@@ -1147,7 +1213,9 @@ syms_of_xfaces ()
1147The region is highlighted with this face\n\ 1213The region is highlighted with this face\n\
1148when Transient Mark mode is enabled and the mark is active."); 1214when Transient Mark mode is enabled and the mark is active.");
1149 1215
1216#ifdef HAVE_X_WINDOWS
1150 defsubr (&Spixmap_spec_p); 1217 defsubr (&Spixmap_spec_p);
1218#endif
1151 defsubr (&Sframe_face_alist); 1219 defsubr (&Sframe_face_alist);
1152 defsubr (&Sset_frame_face_alist); 1220 defsubr (&Sset_frame_face_alist);
1153 defsubr (&Smake_face_internal); 1221 defsubr (&Smake_face_internal);
@@ -1155,5 +1223,4 @@ when Transient Mark mode is enabled and the mark is active.");
1155 defsubr (&Sinternal_next_face_id); 1223 defsubr (&Sinternal_next_face_id);
1156} 1224}
1157 1225
1158#endif /* HAVE_X_WINDOWS */ 1226#endif /* HAVE_FACES */
1159
diff --git a/src/xmenu.c b/src/xmenu.c
index 10732855e8a..c44b23f9115 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -42,9 +42,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
42#include "blockinput.h" 42#include "blockinput.h"
43#include "puresize.h" 43#include "puresize.h"
44 44
45#ifdef HAVE_X_WINDOWS
45/* This may include sys/types.h, and that somehow loses 46/* This may include sys/types.h, and that somehow loses
46 if this is not done before the other system files. */ 47 if this is not done before the other system files. */
47#include "xterm.h" 48#include "xterm.h"
49#endif
48 50
49/* Load sys/types.h if not already loaded. 51/* Load sys/types.h if not already loaded.
50 In some systems loading it twice is suicidal. */ 52 In some systems loading it twice is suicidal. */
@@ -54,7 +56,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
54 56
55#include "dispextern.h" 57#include "dispextern.h"
56 58
59#ifdef HAVE_X_WINDOWS
57#include "../oldXMenu/XMenu.h" 60#include "../oldXMenu/XMenu.h"
61#endif
58 62
59#ifdef USE_X_TOOLKIT 63#ifdef USE_X_TOOLKIT
60#include <X11/Xlib.h> 64#include <X11/Xlib.h>
@@ -759,7 +763,6 @@ cached information about equivalent key sequences.")
759 if (FRAMEP (window)) 763 if (FRAMEP (window))
760 { 764 {
761 f = XFRAME (window); 765 f = XFRAME (window);
762
763 xpos = 0; 766 xpos = 0;
764 ypos = 0; 767 ypos = 0;
765 } 768 }
@@ -1969,11 +1972,13 @@ xdialog_show (f, menubarp, keymaps, title, error)
1969 } 1972 }
1970 pop_down: 1973 pop_down:
1971 1974
1975#ifdef HAVE_X_WINDOWS
1972 /* State that no mouse buttons are now held. 1976 /* State that no mouse buttons are now held.
1973 That is not necessarily true, but the fiction leads to reasonable 1977 That is not necessarily true, but the fiction leads to reasonable
1974 results, and it is a pain to ask which are actually held now 1978 results, and it is a pain to ask which are actually held now
1975 or track this in the loop above. */ 1979 or track this in the loop above. */
1976 x_mouse_grabbed = 0; 1980 x_mouse_grabbed = 0;
1981#endif
1977 1982
1978 /* Unread any events that we got but did not handle. */ 1983 /* Unread any events that we got but did not handle. */
1979 while (queue != NULL) 1984 while (queue != NULL)
@@ -2071,6 +2076,7 @@ xmenu_show (f, x, y, menubarp, keymaps, title, error)
2071 return Qnil; 2076 return Qnil;
2072 } 2077 }
2073 2078
2079#ifdef HAVE_X_WINDOWS
2074 /* Adjust coordinates to relative to the outer (window manager) window. */ 2080 /* Adjust coordinates to relative to the outer (window manager) window. */
2075 { 2081 {
2076 Window child; 2082 Window child;
@@ -2097,6 +2103,7 @@ xmenu_show (f, x, y, menubarp, keymaps, title, error)
2097 y += win_y; 2103 y += win_y;
2098 } 2104 }
2099 } 2105 }
2106#endif /* HAVE_X_WINDOWS */
2100 2107
2101 /* Adjust coordinates to be root-window-relative. */ 2108 /* Adjust coordinates to be root-window-relative. */
2102 x += f->display.x->left_pos; 2109 x += f->display.x->left_pos;
@@ -2282,11 +2289,13 @@ xmenu_show (f, x, y, menubarp, keymaps, title, error)
2282 } 2289 }
2283 XMenuDestroy (XDISPLAY menu); 2290 XMenuDestroy (XDISPLAY menu);
2284 2291
2292#ifdef HAVE_X_WINDOWS
2285 /* State that no mouse buttons are now held. 2293 /* State that no mouse buttons are now held.
2286 (The oldXMenu code doesn't track this info for us.) 2294 (The oldXMenu code doesn't track this info for us.)
2287 That is not necessarily true, but the fiction leads to reasonable 2295 That is not necessarily true, but the fiction leads to reasonable
2288 results, and it is a pain to ask which are actually held now. */ 2296 results, and it is a pain to ask which are actually held now. */
2289 x_mouse_grabbed = 0; 2297 x_mouse_grabbed = 0;
2298#endif
2290 2299
2291 return entry; 2300 return entry;
2292} 2301}
diff --git a/src/xterm.c b/src/xterm.c
index a43c795126e..167eafaf001 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -5590,8 +5590,11 @@ Check the DISPLAY environment variable or use \"-d\"\n",
5590 x_watch_cut_buffer_cache (); 5590 x_watch_cut_buffer_cache ();
5591#endif 5591#endif
5592 5592
5593#ifdef subprocesses
5594 /* This is only needed for distinguishing keyboard and process input. */
5593 if (ConnectionNumber (x_current_display) != 0) 5595 if (ConnectionNumber (x_current_display) != 0)
5594 change_keyboard_wait_descriptor (ConnectionNumber (x_current_display)); 5596 change_keyboard_wait_descriptor (ConnectionNumber (x_current_display));
5597#endif
5595 change_input_fd (ConnectionNumber (x_current_display)); 5598 change_input_fd (ConnectionNumber (x_current_display));
5596 5599
5597#ifndef F_SETOWN_BUG 5600#ifndef F_SETOWN_BUG