*** empty log message ***
This commit is contained in:
parent
ef88bd2dc0
commit
87485d6fc9
30 changed files with 1091 additions and 102 deletions
|
@ -141,11 +141,14 @@ against the file name, and TYPE is nil for text, t for binary.")
|
|||
(defsubst intdos (regs)
|
||||
(int86 33 regs))
|
||||
|
||||
;;; Fix interface to (X-specific) mouse.el
|
||||
(defalias 'window-frame 'ignore)
|
||||
(defalias 'x-set-selection 'ignore)
|
||||
(fset 'x-get-selection '(lambda (&rest rest) ""))
|
||||
(fmakunbound 'font-menu-add-default)
|
||||
(global-unset-key [C-down-mouse-1])
|
||||
(global-unset-key [C-down-mouse-2])
|
||||
(global-unset-key [C-down-mouse-3])
|
||||
;; Extra stub to functions in src/frame.c
|
||||
;; Emacs aborts during dump if the following don't have a doc string.
|
||||
(defun window-frame (window)
|
||||
"Return the frame that WINDOW resides on."
|
||||
(selected-frame))
|
||||
(defun raise-frame (frame)
|
||||
"Raise FRAME to the top of the desktop."
|
||||
nil)
|
||||
(defun select-frame (frame &optional no-enter)
|
||||
"Select FRAME for input events."
|
||||
(selected-frame))
|
||||
|
|
|
@ -842,7 +842,7 @@ selected frame."
|
|||
|
||||
(let ((frames (frame-list)))
|
||||
(while frames
|
||||
(if (eq (framep (car frames)) 'x)
|
||||
(if (framep (car frames))
|
||||
(let ((frame (car frames))
|
||||
(rest global-face-data))
|
||||
(while rest
|
||||
|
|
|
@ -1495,7 +1495,7 @@ Advanced commands:
|
|||
(make-local-variable 'Info-tag-table-marker)
|
||||
(make-local-variable 'Info-history)
|
||||
(make-local-variable 'Info-index-alternatives)
|
||||
(if (eq (framep (selected-frame)) 'x)
|
||||
(if (memq (framep (selected-frame)) '(x pc))
|
||||
(progn
|
||||
(make-face 'info-node)
|
||||
(make-face 'info-menu-5)
|
||||
|
|
|
@ -100,12 +100,16 @@
|
|||
(progn
|
||||
(load "ls-lisp")
|
||||
(garbage-collect)
|
||||
(load "mouse")
|
||||
(garbage-collect)
|
||||
(load "dos-fns")
|
||||
(garbage-collect)
|
||||
(load "disp-table") ; needed to setup ibm-pc char set, see internal.el
|
||||
(garbage-collect)))
|
||||
(garbage-collect)
|
||||
(if (not (fboundp 'delete-frame))
|
||||
(progn
|
||||
(load "mouse")
|
||||
(garbage-collect)
|
||||
(load "faces")
|
||||
(garbage-collect)))))
|
||||
(if (fboundp 'atan) ; preload some constants and
|
||||
(progn ; floating pt. functions if
|
||||
(garbage-collect) ; we have float support.
|
||||
|
@ -156,7 +160,8 @@
|
|||
"-"
|
||||
(substring name (match-end 0)))))
|
||||
(if (eq system-type 'ms-dos)
|
||||
(setq name (expand-file-name "../etc/DOC"))
|
||||
(setq name (expand-file-name
|
||||
(if (fboundp 'make-frame) "DOC-X" "DOC") "../etc"))
|
||||
(setq name (concat (expand-file-name "../etc/DOC-") name))
|
||||
(if (file-exists-p name)
|
||||
(delete-file name))
|
||||
|
|
|
@ -300,7 +300,7 @@ This should be bound to a mouse drag event."
|
|||
(goto-char (posn-point posn)))
|
||||
;; If mark is highlighted, no need to bounce the cursor.
|
||||
(or (and transient-mark-mode
|
||||
(eq (framep (selected-frame)) 'x))
|
||||
(framep (selected-frame)))
|
||||
(sit-for 1))
|
||||
(push-mark)
|
||||
(set-mark (point))
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
s/^#.*//
|
||||
s/^[ \f\t][ \f\t]*$//
|
||||
s/^ / /
|
||||
/^obj=/s!$! dosfns.o msdos.o!
|
||||
s/\.h\.in/.h-in/
|
||||
s!^ \./temacs! go32 temacs!
|
||||
s!/bin/sh!command.com!
|
||||
|
@ -19,7 +18,9 @@ s!/bin/sh!command.com!
|
|||
/^M_FILE *=/s!@[^@\n]*@!m/intel386.h!
|
||||
/^S_FILE *=/s!@[^@\n]*@!s/msdos.h!
|
||||
/^@SET_MAKE@$/s/@SET_MAKE@//
|
||||
/^.\${libsrc}make-docfile.*>/s!make-docfile!make-docfile -o ../etc/DOC!
|
||||
/^.\${libsrc}make-doc/s!>.*$!!
|
||||
/^.\${libsrc}make-docfile/s!make-docfile!make-docfile -o ../etc/DOC!
|
||||
/^.\${libsrc}make-docfile/s/\$/go32 $/
|
||||
/^[ ]*$/d
|
||||
/^temacs:/s/prefix-args//
|
||||
/^ #/d
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
# ----------------------------------------------------------------------
|
||||
/^#undef LISP_FLOAT_TYPE *$/s/undef/define/
|
||||
/^#undef GNU_MALLOC *$/s/undef/define/
|
||||
# To use the djgpp malloc, deactivate the following line and active the next
|
||||
/^#undef REL_ALLOC *$/s/undef/define/
|
||||
# /^#define GNU_MALLOC *$/s/GNU_MALLOC/SYSTEM_MALLOC/
|
||||
/^#undef HAVE_SYS_TIMEB_H *$/s/undef/define/
|
||||
/^#undef HAVE_SYS_TIME_H *$/s/undef/define/
|
||||
# /^#undef HAVE_UNISTD_H *$/s/undef/define/
|
||||
|
@ -23,8 +25,10 @@
|
|||
/^#undef HAVE_FREXP *$/s/undef/define/
|
||||
/^#undef HAVE_FTIME *$/s/undef/define/
|
||||
/^#undef HAVE_STRERROR *$/s/undef/define/
|
||||
/^#undef HAVE_MKTIME *$/s/undef/define/
|
||||
s/^#define USER_FULL_NAME .*$/#define USER_FULL_NAME (getenv ("NAME"))/
|
||||
s/^#undef STACK_DIRECTION *$/#define STACK_DIRECTION -1/
|
||||
s/^#undef EMACS_CONFIGURATION *$/#define EMACS_CONFIGURATION "i386-unknown-msdos"/
|
||||
s/^#undef EMACS_CONFIG_OPTIONS *$/#define EMACS_CONFIG_OPTIONS "-"/
|
||||
s!^#undef config_opsysfile *$!#define config_opsysfile "s/msdos.h"!
|
||||
s!^#undef config_machfile *$!#define config_machfile "m/intel386.h"!
|
||||
|
|
|
@ -455,6 +455,17 @@ ALL_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_MACHINE LD_SWITCH_SITE $(LDFLAGS)
|
|||
#define MKTIME_OBJ mktime.o
|
||||
#endif
|
||||
|
||||
#ifdef MSDOS
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
#define MSDOS_OBJ dosfns.o msdos.o
|
||||
#else
|
||||
#define MSDOS_OBJ dosfns.o msdos.o xfaces.o xmenu.o
|
||||
#endif
|
||||
#else
|
||||
#define MSDOS_OBJ
|
||||
#endif
|
||||
|
||||
|
||||
/* lastfile must follow all files
|
||||
whose initialized data areas should be dumped as pure by dump-emacs. */
|
||||
obj= 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 \
|
|||
abbrev.o syntax.o UNEXEC mocklisp.o bytecode.o \
|
||||
process.o callproc.o \
|
||||
region-cache.o \
|
||||
doprnt.o strftime.o MKTIME_OBJ GETLOADAVG_OBJ
|
||||
doprnt.o strftime.o MKTIME_OBJ GETLOADAVG_OBJ MSDOS_OBJ
|
||||
|
||||
/* Object files used on some machine or other.
|
||||
These go in the DOC file on all machines
|
||||
|
@ -551,7 +562,7 @@ otherobj= $(termcapobj) lastfile.o $(mallocobj) $(allocaobj) $(widgetobj)
|
|||
#endif
|
||||
|
||||
#ifdef MSDOS
|
||||
#define MSDOS_SUPPORT ${lispdir}ls-lisp.elc ${lispdir}disp-tab.elc ${lispdir}dos-fns.elc ${lispdir}mouse.elc
|
||||
#define MSDOS_SUPPORT ${lispdir}ls-lisp.elc ${lispdir}disp-tab.elc ${lispdir}dos-fns.elc ${lispdir}mouse.elc ${lispdir}faces.elc
|
||||
#else
|
||||
#define MSDOS_SUPPORT
|
||||
#endif
|
||||
|
@ -808,6 +819,7 @@ dispnew.o: dispnew.c commands.h frame.h window.h buffer.h dispextern.h \
|
|||
termchar.h termopts.h termhooks.h cm.h disptab.h systty.h systime.h $(config_h)
|
||||
doc.o: doc.c $(config_h) paths.h buffer.h keyboard.h
|
||||
doprnt.o: doprnt.c $(config_h)
|
||||
dosfns.o: buffer.h termchar.h termhooks.h frame.h msdos.h dosfns.h $(config_h)
|
||||
editfns.o: editfns.c window.h buffer.h systime.h INTERVAL_SRC $(config_h)
|
||||
emacs.o: emacs.c commands.h systty.h syssignal.h process.h INTERVAL_SRC $(config_h)
|
||||
fileio.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 \
|
|||
lastfile.o: lastfile.c $(config_h)
|
||||
macros.o: macros.c window.h buffer.h commands.h macros.h $(config_h)
|
||||
malloc.o: malloc.c $(config_h)
|
||||
msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h \
|
||||
termopts.h frame.h window.h $(config_h)
|
||||
mktime.o: mktime.c $(config_h)
|
||||
gmalloc.o: gmalloc.c $(config_h)
|
||||
ralloc.o: ralloc.c $(config_h)
|
||||
|
|
|
@ -64,9 +64,11 @@ and this notice must be preserved on all copies. */
|
|||
/* Define if netdb.h declares h_errno. */
|
||||
#undef HAVE_H_ERRNO
|
||||
|
||||
/* If we're using any sort of window system, define MULTI_FRAME. */
|
||||
/* If we're using any sort of window system, define some consequences. */
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
#define MULTI_FRAME
|
||||
#define HAVE_FACES
|
||||
#define HAVE_MOUSE
|
||||
#endif
|
||||
|
||||
/* Define USE_TEXT_PROPERTIES to support visual and other properties
|
||||
|
|
|
@ -17,13 +17,22 @@ You should have received a copy of the GNU General Public License
|
|||
along with GNU Emacs; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifndef _DISPEXTERN_H_
|
||||
#define _DISPEXTERN_H_
|
||||
|
||||
/* Nonzero means last display completed and cursor is really at
|
||||
cursX, cursY. Zero means it was preempted. */
|
||||
extern int display_completed;
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef MSDOS
|
||||
#include "msdos.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FACES
|
||||
struct face
|
||||
{
|
||||
/* If this is non-zero, it is a GC we can use without modification
|
||||
|
@ -62,7 +71,7 @@ typedef struct face *FACE;
|
|||
#define FACE_STIPPLE(f) ((f)->stipple)
|
||||
#define FACE_UNDERLINE_P(f) ((f)->underline)
|
||||
|
||||
#else /* Not X */
|
||||
#else /* not HAVE_FACES */
|
||||
|
||||
typedef int FACE;
|
||||
|
||||
|
@ -73,7 +82,8 @@ typedef int FACE;
|
|||
|
||||
#define FACE_HIGHLIGHT(f) ((f) & 0x1)
|
||||
#define FACE_UNDERLINE(f) ((f) & 0x2)
|
||||
#endif /* Not X */
|
||||
|
||||
#endif /* not HAVE_FACES */
|
||||
|
||||
|
||||
/* This structure is used for the actual display of text on a frame.
|
||||
|
@ -164,3 +174,5 @@ struct frame_glyphs
|
|||
|
||||
extern void get_display_line ();
|
||||
extern Lisp_Object sit_for ();
|
||||
|
||||
#endif /* not _DISPEXTERN_H_ */
|
||||
|
|
|
@ -121,13 +121,15 @@ Lisp_Object Vstandard_display_table;
|
|||
int cursor_in_echo_area;
|
||||
|
||||
/* The currently selected frame.
|
||||
In a single-frame version, this variable always remains 0. */
|
||||
In a single-frame version, this variable always holds the address of
|
||||
the_only_frame. */
|
||||
|
||||
FRAME_PTR selected_frame;
|
||||
|
||||
/* A frame which is not just a minibuffer, or 0 if there are no such
|
||||
frames. This is usually the most recent such frame that was
|
||||
selected. In a single-frame version, this variable always remains 0. */
|
||||
selected. In a single-frame version, this variable always holds
|
||||
the address of the_only_frame. */
|
||||
FRAME_PTR last_nonminibuf_frame;
|
||||
|
||||
/* In a single-frame version, the information that would otherwise
|
||||
|
@ -1086,7 +1088,7 @@ direct_output_for_insert (g)
|
|||
|
||||
{
|
||||
int face = 0;
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
#ifdef HAVE_FACES
|
||||
int dummy;
|
||||
|
||||
if (FRAME_X_P (frame))
|
||||
|
|
40
src/dosfns.c
40
src/dosfns.c
|
@ -137,6 +137,37 @@ REGISTERS should be a vector produced by `make-register' and\n\
|
|||
return regs;
|
||||
}
|
||||
|
||||
#ifndef HAVE_X_WINDOWS
|
||||
/* Later we might want to control the mouse interface with this function,
|
||||
e.g., with respect to non-80 column screen modes. */
|
||||
|
||||
DEFUN ("msdos-mouse-p", Fmsdos_mouse_p, Smsdos_mouse_p, 0, 0, 0, "\
|
||||
Report whether a mouse is present.")
|
||||
()
|
||||
{
|
||||
if (have_mouse)
|
||||
return Qt;
|
||||
else
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
DEFUN ("set-mouse-position", Fset_mouse_position, Sset_mouse_position, 3, 3, 0,
|
||||
"Move the mouse pointer to the center of character cell (X,Y) in FRAME.\n\
|
||||
WARNING: If you use this under X windows,\n\
|
||||
you should call `unfocus-frame' afterwards.")
|
||||
(frame, x, y)
|
||||
Lisp_Object frame, x, y;
|
||||
{
|
||||
mouse_moveto (XINT (x), XINT (y));
|
||||
}
|
||||
|
||||
/* Function to translate colour names to integers. See lisp/term/pc-win.el
|
||||
for its definition. */
|
||||
|
||||
Lisp_Object Qmsdos_color_translate;
|
||||
#endif
|
||||
|
||||
|
||||
int dos_country_code;
|
||||
int dos_codepage;
|
||||
Lisp_Object Vdos_version;
|
||||
|
@ -148,7 +179,9 @@ init_dosfns ()
|
|||
_go32_dpmi_seginfo info;
|
||||
_go32_dpmi_registers dpmiregs;
|
||||
|
||||
#ifndef SYSTEM_MALLOC
|
||||
get_lim_data (); /* why the hell isn't this called elsewhere? */
|
||||
#endif
|
||||
|
||||
regs.x.ax = 0x3000;
|
||||
intdos (®s, ®s);
|
||||
|
@ -195,6 +228,13 @@ syms_of_dosfns ()
|
|||
defsubr (&Smode25);
|
||||
defsubr (&Smode4350);
|
||||
defsubr (&Sint86);
|
||||
#ifndef HAVE_X_WINDOWS
|
||||
defsubr (&Smsdos_mouse_p);
|
||||
defsubr (&Sset_mouse_position);
|
||||
|
||||
Qmsdos_color_translate = intern ("msdos-color-translate");
|
||||
staticpro (&Qmsdos_color_translate);
|
||||
#endif
|
||||
|
||||
DEFVAR_INT ("dos-country-code", &dos_country_code,
|
||||
"The country code returned by Dos when Emacs was started.\n\
|
||||
|
|
|
@ -21,3 +21,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
extern int dos_country_code;
|
||||
extern int dos_codepage;
|
||||
extern Lisp_Object Vdos_version;
|
||||
#ifndef HAVE_X_WINDOWS
|
||||
extern Lisp_Object Qmsdos_color_translate;
|
||||
#endif
|
||||
|
|
|
@ -64,7 +64,14 @@ init_editfns ()
|
|||
#endif /* not CANNOT_DUMP */
|
||||
|
||||
pw = (struct passwd *) getpwuid (getuid ());
|
||||
#ifdef MSDOS
|
||||
/* We let the real user name default to "root" because that's quite
|
||||
accurate on MSDOG and because it lets Emacs find the init file.
|
||||
(The DVX libraries override the Djgpp libraries here.) */
|
||||
Vuser_real_name = build_string (pw ? pw->pw_name : "root");
|
||||
#else
|
||||
Vuser_real_name = build_string (pw ? pw->pw_name : "unknown");
|
||||
#endif
|
||||
|
||||
/* Get the effective user name, by consulting environment variables,
|
||||
or the effective uid if those are unset. */
|
||||
|
@ -483,19 +490,30 @@ If POS is out of range, the value is nil.")
|
|||
return val;
|
||||
}
|
||||
|
||||
DEFUN ("user-login-name", Fuser_login_name, Suser_login_name, 0, 0, 0,
|
||||
DEFUN ("user-login-name", Fuser_login_name, Suser_login_name, 0, 1, 0,
|
||||
"Return the name under which the user logged in, as a string.\n\
|
||||
This is based on the effective uid, not the real uid.\n\
|
||||
Also, if the environment variable LOGNAME or USER is set,\n\
|
||||
that determines the value of this function.")
|
||||
()
|
||||
that determines the value of this function.\n\n\
|
||||
If optional argument UID is an integer, return the login name of the user\n\
|
||||
with that uid, or nil if there is no such user.")
|
||||
(uid)
|
||||
Lisp_Object uid;
|
||||
{
|
||||
struct passwd *pw;
|
||||
|
||||
/* Set up the user name info if we didn't do it before.
|
||||
(That can happen if Emacs is dumpable
|
||||
but you decide to run `temacs -l loadup' and not dump. */
|
||||
if (INTEGERP (Vuser_name))
|
||||
init_editfns ();
|
||||
return Vuser_name;
|
||||
|
||||
if (NILP (uid))
|
||||
return Vuser_name;
|
||||
|
||||
CHECK_NUMBER (uid, 0);
|
||||
pw = (struct passwd *) getpwuid (XINT (uid));
|
||||
return (pw ? build_string (pw->pw_name) : Qnil);
|
||||
}
|
||||
|
||||
DEFUN ("user-real-login-name", Fuser_real_login_name, Suser_real_login_name,
|
||||
|
|
|
@ -787,6 +787,11 @@ Usage: %s [-t term] [--terminal term] [-nw] [--no-windows] [--batch]\n\
|
|||
#endif /* HAVE_X_MENU */
|
||||
#endif /* HAVE_X_WINDOWS */
|
||||
|
||||
#if defined (MSDOS) && !defined (HAVE_X_WINDOWS)
|
||||
syms_of_xfaces ();
|
||||
syms_of_xmenu ();
|
||||
#endif
|
||||
|
||||
#ifdef SYMS_SYSTEM
|
||||
SYMS_SYSTEM;
|
||||
#endif
|
||||
|
|
|
@ -753,7 +753,13 @@ See also the function `substitute-in-file-name'.")
|
|||
The EQ test avoids infinite recursion. */
|
||||
if (! NILP (defalt) && !EQ (defalt, name)
|
||||
/* This saves time in a common case. */
|
||||
#ifdef MSDOS
|
||||
&& (XSTRING (defalt)->size < 3
|
||||
|| XSTRING (defalt)->data[1] != ':'
|
||||
|| XSTRING (defalt)->data[2] != '/'))
|
||||
#else
|
||||
&& XSTRING (defalt)->data[0] != '/')
|
||||
#endif
|
||||
{
|
||||
struct gcpro gcpro1;
|
||||
|
||||
|
|
70
src/frame.c
70
src/frame.c
|
@ -24,6 +24,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#include "frame.h"
|
||||
#include "termhooks.h"
|
||||
#include "window.h"
|
||||
#ifdef MSDOS
|
||||
#include "msdos.h"
|
||||
#endif
|
||||
|
||||
#ifdef MULTI_FRAME
|
||||
|
||||
|
@ -95,7 +98,8 @@ extern Lisp_Object Fredirect_frame_focus ();
|
|||
DEFUN ("framep", Fframep, Sframep, 1, 1, 0,
|
||||
"Return non-nil if OBJECT is a frame.\n\
|
||||
Value is t for a termcap frame (a character-only terminal),\n\
|
||||
`x' for an Emacs frame that is really an X window.\n\
|
||||
`x' for an Emacs frame that is really an X window,\n\
|
||||
`pc' for a direct-write MS-DOS frame.\n\
|
||||
Also see `live-frame-p'.")
|
||||
(object)
|
||||
Lisp_Object object;
|
||||
|
@ -108,6 +112,7 @@ Also see `live-frame-p'.")
|
|||
return Qt;
|
||||
case output_x_window:
|
||||
return Qx;
|
||||
/* The `pc' case is in the Fframep below. */
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
|
@ -1855,6 +1860,8 @@ DEFUN ("selected-frame", Fselected_frame, Sselected_frame, 0, 0, 0,
|
|||
0)
|
||||
()
|
||||
{
|
||||
/* For your possible information, this code is unfolded into the
|
||||
second WINDOW_FRAME in frame.h. */
|
||||
Lisp_Object tem;
|
||||
XSETFASTINT (tem, 0);
|
||||
return tem;
|
||||
|
@ -1888,6 +1895,10 @@ DEFUN ("framep", Fframep, Sframep, 1, 1, 0,
|
|||
(object)
|
||||
Lisp_Object object;
|
||||
{
|
||||
#ifdef MSDOS
|
||||
if (FRAME_X_P (object))
|
||||
return intern ("pc");
|
||||
#endif
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
@ -2029,6 +2040,22 @@ DEFUN ("mouse-position", Fmouse_position, Smouse_position, 0, 0, 0,
|
|||
0)
|
||||
()
|
||||
{
|
||||
#ifdef HAVE_MOUSE
|
||||
if (mouse_position_hook)
|
||||
{
|
||||
FRAME_PTR f;
|
||||
Lisp_Object lispy_dummy;
|
||||
enum scroll_bar_part party_dummy;
|
||||
Lisp_Object x, y;
|
||||
unsigned long long_dummy;
|
||||
|
||||
(*mouse_position_hook) (&f,
|
||||
&lispy_dummy, &party_dummy,
|
||||
&x, &y,
|
||||
&long_dummy);
|
||||
return Fcons (Fselected_frame (), Fcons (x, y));
|
||||
}
|
||||
#endif
|
||||
return Fcons (Qnil, Fcons (Qnil, Qnil));
|
||||
}
|
||||
|
||||
|
@ -2068,6 +2095,22 @@ DEFUN ("frame-parameters", Fframe_parameters, Sframe_parameters, 0, 1, 0,
|
|||
return Qnil;
|
||||
|
||||
alist = Qnil;
|
||||
#ifdef MSDOS
|
||||
if (FRAME_X_P (f))
|
||||
{
|
||||
static char *colornames[16] =
|
||||
{
|
||||
"black", "blue", "green", "cyan", "red", "magenta", "brown",
|
||||
"lightgray", "darkgray", "lightblue", "lightgreen", "lightcyan",
|
||||
"lightred", "lightmagenta", "yellow", "white"
|
||||
};
|
||||
store_in_alist (&alist, intern ("foreground-color"),
|
||||
build_string (colornames[FRAME_FOREGROUND_PIXEL (f)]));
|
||||
store_in_alist (&alist, intern ("background-color"),
|
||||
build_string (colornames[FRAME_BACKGROUND_PIXEL (f)]));
|
||||
}
|
||||
#endif
|
||||
store_in_alist (&alist, intern ("font"), build_string ("default"));
|
||||
store_in_alist (&alist, Qname, build_string ("emacs"));
|
||||
store_in_alist (&alist, Qheight, make_number (FRAME_HEIGHT (f)));
|
||||
store_in_alist (&alist, Qwidth, make_number (FRAME_WIDTH (f)));
|
||||
|
@ -2087,6 +2130,10 @@ DEFUN ("modify-frame-parameters", Fmodify_frame_parameters,
|
|||
(frame, alist)
|
||||
Lisp_Object frame, alist;
|
||||
{
|
||||
#ifdef MSDOS
|
||||
if (FRAME_X_P (frame))
|
||||
IT_set_frame_parameters (XFRAME (frame), alist);
|
||||
#endif
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
@ -2100,6 +2147,15 @@ DEFUN ("frame-live-p", Fframe_live_p, Sframe_live_p, 1, 1, 0,
|
|||
return Qt;
|
||||
}
|
||||
|
||||
DEFUN ("frame-list", Fframe_list, Sframe_list, 0, 0, 0,
|
||||
/* Don't confuse make-docfile by having two doc strings for this function.
|
||||
make-docfile does not pay attention to #if, for good reason! */
|
||||
0)
|
||||
()
|
||||
{
|
||||
return Fcons (Fselected_frame (), Qnil);
|
||||
}
|
||||
|
||||
syms_of_frame ()
|
||||
{
|
||||
Qheight = intern ("height");
|
||||
|
@ -2141,6 +2197,18 @@ syms_of_frame ()
|
|||
defsubr (&Sframe_parameters);
|
||||
defsubr (&Smodify_frame_parameters);
|
||||
defsubr (&Sframe_live_p);
|
||||
defsubr (&Sframe_list);
|
||||
|
||||
#ifdef MSDOS
|
||||
/* A comment in dispnew.c says the_only_frame is not protected. */
|
||||
the_only_frame.face_alist = Qnil;
|
||||
staticpro (&the_only_frame.face_alist);
|
||||
the_only_frame.menu_bar_items = Qnil;
|
||||
staticpro (&the_only_frame.menu_bar_items);
|
||||
the_only_frame.menu_bar_vector = Qnil;
|
||||
staticpro (&the_only_frame.menu_bar_vector);
|
||||
the_only_frame.menu_bar_items = menu_bar_items (Qnil);
|
||||
#endif
|
||||
}
|
||||
|
||||
keys_of_frame ()
|
||||
|
|
28
src/frame.h
28
src/frame.h
|
@ -37,7 +37,7 @@ extern int message_buf_print;
|
|||
having miscellaneous random variables scattered about. */
|
||||
|
||||
enum output_method
|
||||
{ output_termcap, output_x_window };
|
||||
{ output_termcap, output_x_window, output_msdos_raw };
|
||||
|
||||
struct frame
|
||||
{
|
||||
|
@ -382,23 +382,35 @@ extern Lisp_Object Vterminal_frame;
|
|||
|
||||
/* These definitions are used in a single-frame version of Emacs. */
|
||||
|
||||
#define FRAME_PTR int
|
||||
|
||||
/* A frame we use to store all the data concerning the screen when we
|
||||
don't have multiple frames. Remember, if you store any data in it
|
||||
which needs to be protected from GC, you should staticpro that
|
||||
element explicitly. */
|
||||
extern struct frame the_only_frame;
|
||||
|
||||
extern EMACS_INT selected_frame;
|
||||
extern EMACS_INT last_nonminibuf_frame;
|
||||
typedef struct frame *FRAME_PTR;
|
||||
#ifdef __GNUC__
|
||||
/* A function call for always getting 0 is overkill, so... */
|
||||
#define WINDOW_FRAME(w) ({ Lisp_Object tem; XSETFASTINT (tem, 0); tem; })
|
||||
#else
|
||||
#define WINDOW_FRAME(w) (Fselected_frame ())
|
||||
#endif
|
||||
#define XSETFRAME(p, v) (p = WINDOW_FRAME (***bogus***))
|
||||
#define XFRAME(frame) (&the_only_frame)
|
||||
|
||||
#define XFRAME(f) selected_frame
|
||||
#define WINDOW_FRAME(w) selected_frame
|
||||
extern FRAME_PTR selected_frame;
|
||||
extern FRAME_PTR last_nonminibuf_frame;
|
||||
|
||||
#define FRAME_LIVE_P(f) 1
|
||||
#ifdef MSDOS
|
||||
/* The following definitions could also be used in the non-MSDOS case,
|
||||
but the constants below lead to better code. */
|
||||
#define FRAME_TERMCAP_P(f) (the_only_frame.output_method == output_termcap)
|
||||
#define FRAME_X_P(f) (the_only_frame.output_method != output_termcap)
|
||||
#else
|
||||
#define FRAME_TERMCAP_P(f) 1
|
||||
#define FRAME_X_P(f) 0
|
||||
#endif
|
||||
#define FRAME_MINIBUF_ONLY_P(f) 0
|
||||
#define FRAME_HAS_MINIBUF_P(f) 1
|
||||
#define FRAME_CURRENT_GLYPHS(f) (the_only_frame.current_glyphs)
|
||||
|
@ -455,7 +467,7 @@ extern EMACS_INT last_nonminibuf_frame;
|
|||
`for' loop which traverses Vframe_list using LIST_VAR and
|
||||
FRAME_VAR. */
|
||||
#define FOR_EACH_FRAME(list_var, frame_var) \
|
||||
for (list_var = Qt; XSETFASTINT (frame_var, selected_frame), ! NILP (list_var); list_var = Qnil)
|
||||
for (list_var = Qt; frame_var = WINDOW_FRAME (***bogus***), ! NILP (list_var); list_var = Qnil)
|
||||
|
||||
#endif /* not MULTI_FRAME */
|
||||
|
||||
|
|
|
@ -2228,7 +2228,7 @@ kbd_buffer_get_event ()
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(MULTI_FRAME) || defined(HAVE_MOUSE)
|
||||
#if defined (MULTI_FRAME) || defined (HAVE_MOUSE)
|
||||
/* If we didn't decide to make a switch-frame event, go ahead and
|
||||
return a mouse-motion event. */
|
||||
if (NILP (obj))
|
||||
|
@ -2617,7 +2617,7 @@ make_lispy_event (event)
|
|||
/ sizeof (lispy_function_keys[0])));
|
||||
break;
|
||||
|
||||
#if defined(MULTI_FRAME) || defined(HAVE_MOUSE)
|
||||
#if defined (MULTI_FRAME) || defined (HAVE_MOUSE)
|
||||
/* A mouse click. Figure out where it is, decide whether it's
|
||||
a press, click or drag, and build the appropriate structure. */
|
||||
case mouse_click:
|
||||
|
@ -2861,7 +2861,7 @@ make_lispy_event (event)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(MULTI_FRAME) || defined(HAVE_MOUSE)
|
||||
#if defined (MULTI_FRAME) || defined (HAVE_MOUSE)
|
||||
|
||||
static Lisp_Object
|
||||
make_lispy_movement (frame, bar_window, part, x, y, time)
|
||||
|
@ -3430,7 +3430,6 @@ gobble_input (expected)
|
|||
sigsetmask (mask);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef POLL_FOR_INPUT
|
||||
if (read_socket_hook && !interrupt_input && poll_suppress_count == 0)
|
||||
{
|
||||
|
@ -3440,6 +3439,7 @@ gobble_input (expected)
|
|||
sigsetmask (mask);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#endif
|
||||
read_avail_input (expected);
|
||||
#endif
|
||||
|
@ -4058,8 +4058,7 @@ read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu)
|
|||
if (mapno >= nmaps)
|
||||
return Qnil;
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
#ifdef HAVE_X_MENU
|
||||
#if (defined (HAVE_X_WINDOWS) && defined (HAVE_X_MENU)) || defined (MSDOS)
|
||||
/* If we got to this point via a mouse click,
|
||||
use a real menu for mouse selection. */
|
||||
if (EVENT_HAS_PARAMETERS (prev_event))
|
||||
|
@ -4091,8 +4090,7 @@ read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu)
|
|||
*used_mouse_menu = 1;
|
||||
return value;
|
||||
}
|
||||
#endif /* HAVE_X_MENU */
|
||||
#endif /* HAVE_X_WINDOWS */
|
||||
#endif /* (HAVE_X_WINDOWS && HAVE_X_MENU) || MSDOS */
|
||||
return Qnil ;
|
||||
}
|
||||
|
||||
|
|
14
src/lisp.h
14
src/lisp.h
|
@ -697,7 +697,7 @@ typedef unsigned char UCHAR;
|
|||
pretty quickly. */
|
||||
#define GLYPH unsigned int
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
#ifdef HAVE_FACES
|
||||
/* The FAST macros assume that we already know we're in an X window. */
|
||||
|
||||
/* Given a character code and a face ID, return the appropriate glyph. */
|
||||
|
@ -714,11 +714,11 @@ typedef unsigned char UCHAR;
|
|||
: FAST_MAKE_GLYPH (char, face))
|
||||
#define GLYPH_CHAR(f, g) (FRAME_TERMCAP_P (f) ? (g) : FAST_GLYPH_CHAR (g))
|
||||
#define GLYPH_FACE(f, g) (FRAME_TERMCAP_P (f) ? (0) : FAST_GLYPH_FACE (g))
|
||||
#else
|
||||
#else /* not HAVE_FACES */
|
||||
#define MAKE_GLYPH(f, char, face) (char)
|
||||
#define GLYPH_CHAR(f, g) (g)
|
||||
#define GLYPH_FACE(f, g) (g)
|
||||
#endif
|
||||
#endif /* not HAVE_FACES */
|
||||
|
||||
/* The ID of the mode line highlighting face. */
|
||||
#define GLYPH_MODE_LINE_FACE 1
|
||||
|
@ -744,7 +744,15 @@ typedef unsigned char UCHAR;
|
|||
#define BUFFERP(x) (XTYPE ((x)) == Lisp_Buffer)
|
||||
#define SUBRP(x) (XTYPE ((x)) == Lisp_Subr)
|
||||
#define PROCESSP(x) (XTYPE ((x)) == Lisp_Process)
|
||||
#ifdef MULTI_FRAME
|
||||
#define FRAMEP(x) (XTYPE ((x)) == Lisp_Frame)
|
||||
#else
|
||||
#ifdef MSDOS
|
||||
/* We could use this in the !MSDOS case also, but we prefer a compile-time
|
||||
error message in case FRAMEP is used. */
|
||||
#define FRAMEP(x) (EQ (x, Fselected_frame ()))
|
||||
#endif
|
||||
#endif
|
||||
#define WINDOWP(x) (XTYPE ((x)) == Lisp_Window)
|
||||
#define WINDOW_CONFIGURATIONP(x) (XTYPE ((x)) == Lisp_Window_Configuration)
|
||||
#ifdef LISP_FLOAT_TYPE
|
||||
|
|
636
src/msdos.c
636
src/msdos.c
|
@ -34,7 +34,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#include "msdos.h"
|
||||
#include "systime.h"
|
||||
#include "termhooks.h"
|
||||
#include "dispextern.h"
|
||||
#include "termopts.h"
|
||||
#include "frame.h"
|
||||
#include "window.h"
|
||||
#include <go32.h>
|
||||
#include <pc.h>
|
||||
#include <ctype.h>
|
||||
|
@ -355,7 +358,7 @@ dos_rawgetc ()
|
|||
+ (ctrl_p ? ctrl_modifier : 0)
|
||||
+ (alt_p ? meta_modifier : 0);
|
||||
/* EMACS == Enter Meta Alt Control Shift */
|
||||
event.frame_or_window = selected_frame;
|
||||
XSETFRAME (event.frame_or_window, selected_frame);
|
||||
gettimeofday (&tv, NULL);
|
||||
event.timestamp = tv.tv_usec;
|
||||
kbd_buffer_store_event (&event);
|
||||
|
@ -389,7 +392,7 @@ dos_rawgetc ()
|
|||
+ (press ? down_modifier : up_modifier);
|
||||
event.x = x;
|
||||
event.y = y;
|
||||
event.frame_or_window = selected_frame;
|
||||
XSETFRAME (event.frame_or_window, selected_frame);
|
||||
gettimeofday (&tv, NULL);
|
||||
event.timestamp = tv.tv_usec;
|
||||
kbd_buffer_store_event (&event);
|
||||
|
@ -690,9 +693,9 @@ init_environment (argc, argv, skip_args)
|
|||
|
||||
/* Find our root from argv[0]. Assuming argv[0] is, say,
|
||||
"c:/emacs/bin/emacs.exe" our root will be "c:/emacs". */
|
||||
len = strlen (argv[0]);
|
||||
root = alloca (len + 10); /* A little extra space for the stuff below. */
|
||||
strcpy (root, argv[0]);
|
||||
_fixpath (argv[0], root = alloca (MAXPATHLEN + 20));
|
||||
strlwr (root);
|
||||
len = strlen (root);
|
||||
while (len > 0 && root[len] != '/' && root[len] != ':')
|
||||
len--;
|
||||
root[len] = '\0';
|
||||
|
@ -714,6 +717,11 @@ init_environment (argc, argv, skip_args)
|
|||
terminal is the default. */
|
||||
setenv ("TERM", "internal", 0);
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
/* Emacs expects DISPLAY to be set. */
|
||||
setenv ("DISPLAY", "unix:0.0", 0);
|
||||
#endif
|
||||
|
||||
/* SHELL is a bit tricky -- COMSPEC is the closest we come, but we must
|
||||
downcase it and mirror the backslashes. */
|
||||
s = getenv ("COMSPEC");
|
||||
|
@ -847,6 +855,8 @@ output_string (x, y, s, c, a)
|
|||
}
|
||||
|
||||
static int internal_terminal = 0;
|
||||
static int highlight;
|
||||
|
||||
#undef fflush
|
||||
|
||||
int
|
||||
|
@ -953,14 +963,241 @@ internal_flush (f)
|
|||
fflush (f);
|
||||
}
|
||||
|
||||
#ifndef HAVE_X_WINDOWS
|
||||
static void
|
||||
rien_du_tout ()
|
||||
{
|
||||
/* Rien du tout, cela va sans dire! */
|
||||
}
|
||||
|
||||
static
|
||||
IT_ring_bell ()
|
||||
{
|
||||
if (visible_bell)
|
||||
{
|
||||
/* This creates an xor-mask that will swap the default fore- and
|
||||
background colors. */
|
||||
if (have_mouse) mouse_off ();
|
||||
do_visible_bell (((the_only_x_display.foreground_pixel
|
||||
^ the_only_x_display.background_pixel)
|
||||
* 0x11) & 0x7f);
|
||||
if (have_mouse) mouse_on ();
|
||||
}
|
||||
else
|
||||
/* Write it directly to ms-dos -- don't let it go through our terminal
|
||||
emulator. This way the mouse cursor won't blink. */
|
||||
write (1, "\007", 1);
|
||||
}
|
||||
|
||||
static void
|
||||
IT_set_face (int face)
|
||||
{
|
||||
struct face *fp;
|
||||
extern struct face *intern_face (/* FRAME_PTR, struct face * */);
|
||||
|
||||
if (face == 1 || (face == 0 && highlight))
|
||||
fp = FRAME_MODE_LINE_FACE (foo);
|
||||
else if (face <= 0 || face >= FRAME_N_COMPUTED_FACES (foo))
|
||||
fp = FRAME_DEFAULT_FACE (foo);
|
||||
else
|
||||
fp = intern_face (selected_frame, FRAME_COMPUTED_FACES (foo)[face]);
|
||||
putchar ('\e');
|
||||
putchar ('A');
|
||||
putchar ((FACE_BACKGROUND (fp) << 4) | FACE_FOREGROUND (fp));
|
||||
}
|
||||
|
||||
static
|
||||
IT_write_glyphs (GLYPH *str, int len)
|
||||
{
|
||||
int face = -1;
|
||||
int newface;
|
||||
|
||||
while (len > 0)
|
||||
{
|
||||
newface = FAST_GLYPH_FACE (*str);
|
||||
if (newface != face)
|
||||
IT_set_face ((face = newface));
|
||||
putchar (FAST_GLYPH_CHAR (*str));
|
||||
str++, len--;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
IT_clear_end_of_line (first_unused)
|
||||
{
|
||||
putchar ('\e');
|
||||
putchar ('E');
|
||||
}
|
||||
|
||||
static
|
||||
IT_cursor_to (int y, int x)
|
||||
{
|
||||
putchar ('\e');
|
||||
putchar ('@');
|
||||
putchar (y);
|
||||
putchar (x);
|
||||
}
|
||||
|
||||
IT_reassert_line_highlight (new, vpos)
|
||||
int new, vpos;
|
||||
{
|
||||
highlight = new;
|
||||
IT_set_face (0); /* To possibly clear the highlighting. */
|
||||
}
|
||||
|
||||
static
|
||||
IT_change_line_highlight (new_highlight, vpos, first_unused_hpos)
|
||||
{
|
||||
highlight = new_highlight;
|
||||
IT_set_face (0); /* To possibly clear the highlighting. */
|
||||
IT_cursor_to (vpos, 0);
|
||||
IT_clear_end_of_line (first_unused_hpos);
|
||||
}
|
||||
|
||||
static
|
||||
IT_update_begin ()
|
||||
{
|
||||
highlight = 0;
|
||||
IT_set_face (0); /* To possibly clear the highlighting. */
|
||||
}
|
||||
|
||||
/* This was more or less copied from xterm.c */
|
||||
static void
|
||||
IT_set_menu_bar_lines (window, n)
|
||||
Lisp_Object window;
|
||||
int n;
|
||||
{
|
||||
struct window *w = XWINDOW (window);
|
||||
|
||||
XSETFASTINT (w->top, XFASTINT (w->top) + n);
|
||||
XSETFASTINT (w->height, XFASTINT (w->height) - n);
|
||||
|
||||
/* Handle just the top child in a vertical split. */
|
||||
if (!NILP (w->vchild))
|
||||
IT_set_menu_bar_lines (w->vchild, n);
|
||||
|
||||
/* Adjust all children in a horizontal split. */
|
||||
for (window = w->hchild; !NILP (window); window = w->next)
|
||||
{
|
||||
w = XWINDOW (window);
|
||||
IT_set_menu_bar_lines (window, n);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
IT_set_frame_parameters (frame, alist)
|
||||
FRAME_PTR frame;
|
||||
Lisp_Object alist;
|
||||
{
|
||||
Lisp_Object tail;
|
||||
int redraw;
|
||||
extern unsigned long load_color ();
|
||||
FRAME_PTR f = (FRAME_PTR) &the_only_frame;
|
||||
|
||||
redraw = 0;
|
||||
for (tail = alist; CONSP (tail); tail = Fcdr (tail))
|
||||
{
|
||||
Lisp_Object elt, prop, val;
|
||||
|
||||
elt = Fcar (tail);
|
||||
prop = Fcar (elt);
|
||||
val = Fcdr (elt);
|
||||
CHECK_SYMBOL (prop, 1);
|
||||
|
||||
if (EQ (prop, intern ("foreground-color")))
|
||||
{
|
||||
unsigned long new_color = load_color (f, val);
|
||||
if (new_color != ~0)
|
||||
{
|
||||
FRAME_FOREGROUND_PIXEL (f) = new_color;
|
||||
redraw = 1;
|
||||
}
|
||||
}
|
||||
else if (EQ (prop, intern ("background-color")))
|
||||
{
|
||||
unsigned long new_color = load_color (f, val);
|
||||
if (new_color != ~0)
|
||||
{
|
||||
FRAME_BACKGROUND_PIXEL (f) = new_color & ~8;
|
||||
redraw = 1;
|
||||
}
|
||||
}
|
||||
else if (EQ (prop, intern ("menu-bar-lines")))
|
||||
{
|
||||
int new;
|
||||
int old = FRAME_MENU_BAR_LINES (the_only_frame);
|
||||
|
||||
if (INTEGERP (val))
|
||||
new = XINT (val);
|
||||
else
|
||||
new = 0;
|
||||
FRAME_MENU_BAR_LINES (f) = new;
|
||||
IT_set_menu_bar_lines (the_only_frame.root_window, new - old);
|
||||
}
|
||||
}
|
||||
|
||||
if (redraw)
|
||||
{
|
||||
recompute_basic_faces (f);
|
||||
Fredraw_frame (Fselected_frame ());
|
||||
}
|
||||
}
|
||||
|
||||
/* Similar to the_only_frame. */
|
||||
struct x_display the_only_x_display;
|
||||
|
||||
/* This is never dereferenced. */
|
||||
Display *x_current_display;
|
||||
|
||||
#endif /* !HAVE_X_WINDOWS */
|
||||
|
||||
/* Do we need the internal terminal? */
|
||||
void
|
||||
internal_terminal_init ()
|
||||
{
|
||||
char *term = getenv ("TERM");
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
if (!inhibit_window_system)
|
||||
return;
|
||||
#endif
|
||||
|
||||
internal_terminal
|
||||
= (!noninteractive) && term && !strcmp (term, "internal");
|
||||
|
||||
#ifndef HAVE_X_WINDOWS
|
||||
if (internal_terminal && !inhibit_window_system)
|
||||
{
|
||||
Vwindow_system = intern ("pc");
|
||||
Vwindow_system_version = make_number (1);
|
||||
|
||||
bzero (&the_only_x_display, sizeof the_only_x_display);
|
||||
the_only_x_display.background_pixel = 7; /* White */
|
||||
the_only_x_display.foreground_pixel = 0; /* Black */
|
||||
the_only_x_display.line_height = 1;
|
||||
the_only_frame.display.x = &the_only_x_display;
|
||||
the_only_frame.output_method = output_msdos_raw;
|
||||
|
||||
init_frame_faces ((FRAME_PTR) &the_only_frame);
|
||||
|
||||
ring_bell_hook = IT_ring_bell;
|
||||
write_glyphs_hook = IT_write_glyphs;
|
||||
cursor_to_hook = raw_cursor_to_hook = IT_cursor_to;
|
||||
clear_end_of_line_hook = IT_clear_end_of_line;
|
||||
change_line_highlight_hook = IT_change_line_highlight;
|
||||
update_begin_hook = IT_update_begin;
|
||||
reassert_line_highlight_hook = IT_reassert_line_highlight;
|
||||
|
||||
/* These hooks are called by term.c without being checked. */
|
||||
set_terminal_modes_hook
|
||||
= reset_terminal_modes_hook
|
||||
= update_end_hook
|
||||
= set_terminal_window_hook
|
||||
= (void *)rien_du_tout;
|
||||
}
|
||||
else
|
||||
the_only_frame.output_method = output_termcap;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* When time zones are set from Ms-Dos too may C-libraries are playing
|
||||
|
@ -1043,10 +1280,9 @@ install_ctrl_break_check ()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* Mouse routines under devellopment follow. Coordinates are in screen
|
||||
positions and zero based. Mouse buttons are numbered from left to
|
||||
right and also zero based. */
|
||||
/* Mouse routines follow. Coordinates are in screen positions and zero
|
||||
based. Mouse buttons are numbered from left to right and also zero
|
||||
based. */
|
||||
|
||||
static int mouse_button_translate[NUM_MOUSE_BUTTONS];
|
||||
static int mouse_button_count;
|
||||
|
@ -1132,6 +1368,17 @@ mouse_released (b, xp, yp)
|
|||
return (regs.x.bx != 0);
|
||||
}
|
||||
|
||||
static void
|
||||
mouse_get_xy (int *x, int *y)
|
||||
{
|
||||
union REGS regs;
|
||||
|
||||
regs.x.ax = 0x0003;
|
||||
int86 (0x33, ®s, ®s);
|
||||
*x = regs.x.cx / 8;
|
||||
*y = regs.x.dx / 8;
|
||||
}
|
||||
|
||||
void
|
||||
mouse_get_pos (f, bar_window, part, x, y, time)
|
||||
FRAME_PTR *f;
|
||||
|
@ -1139,6 +1386,7 @@ mouse_get_pos (f, bar_window, part, x, y, time)
|
|||
enum scroll_bar_part *part;
|
||||
unsigned long *time;
|
||||
{
|
||||
int ix, iy;
|
||||
union REGS regs;
|
||||
struct timeval tv;
|
||||
|
||||
|
@ -1147,25 +1395,22 @@ mouse_get_pos (f, bar_window, part, x, y, time)
|
|||
*f = selected_frame;
|
||||
*bar_window = Qnil;
|
||||
gettimeofday (&tv, NULL);
|
||||
*x = make_number (regs.x.cx / 8);
|
||||
*y = make_number (regs.x.dx / 8);
|
||||
*time = tv.tv_usec;
|
||||
mouse_get_xy (&ix, &iy);
|
||||
mouse_moved = 0;
|
||||
*x = make_number (ix);
|
||||
*y = make_number (iy);
|
||||
*time = tv.tv_usec;
|
||||
}
|
||||
|
||||
void
|
||||
mouse_check_moved ()
|
||||
{
|
||||
union REGS regs;
|
||||
int x, y;
|
||||
|
||||
regs.x.ax = 0x0003;
|
||||
int86 (0x33, ®s, ®s);
|
||||
if (regs.x.cx != mouse_last_x || regs.x.dx != mouse_last_y)
|
||||
{
|
||||
mouse_moved = 1;
|
||||
mouse_last_x = regs.x.cx;
|
||||
mouse_last_y = regs.x.dx;
|
||||
}
|
||||
mouse_get_xy (&x, &y);
|
||||
mouse_moved |= (x != mouse_last_x || y != mouse_last_y);
|
||||
mouse_last_x = x;
|
||||
mouse_last_y = y;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -1174,6 +1419,10 @@ mouse_init1 ()
|
|||
union REGS regs;
|
||||
int present;
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
if (!inhibit_window_system)
|
||||
return 0;
|
||||
#endif
|
||||
if (!internal_terminal)
|
||||
return 0;
|
||||
|
||||
|
@ -1211,6 +1460,7 @@ mouse_init1 ()
|
|||
return present;
|
||||
}
|
||||
|
||||
#ifndef HAVE_X_WINDOWS
|
||||
/* See xterm.c for more info. */
|
||||
void
|
||||
pixel_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)
|
|||
*pix_x = x;
|
||||
*pix_y = y;
|
||||
}
|
||||
|
||||
/* Simulation of X's menus. Nothing too fancy here -- just make it work
|
||||
for now.
|
||||
|
||||
Actually, I don't know the meaning of all the parameters of the functions
|
||||
here -- I only know how they are called by xmenu.c. I could of course
|
||||
grab the nearest Xlib manual (down the hall, second-to-last door on the
|
||||
left), but I don't think it's worth the effort. */
|
||||
|
||||
static XMenu *
|
||||
IT_menu_create ()
|
||||
{
|
||||
XMenu *menu;
|
||||
|
||||
menu = (XMenu *) xmalloc (sizeof (XMenu));
|
||||
menu->allocated = menu->count = menu->panecount = menu->width = 0;
|
||||
return menu;
|
||||
}
|
||||
|
||||
/* Allocate some (more) memory for MENU ensuring that there is room for one
|
||||
for item. */
|
||||
static void
|
||||
IT_menu_make_room (XMenu *menu)
|
||||
{
|
||||
if (menu->allocated == 0)
|
||||
{
|
||||
int count = menu->allocated = 10;
|
||||
menu->text = (char **) xmalloc (count * sizeof (char *));
|
||||
menu->submenu = (XMenu **) xmalloc (count * sizeof (XMenu *));
|
||||
menu->panenumber = (int *) xmalloc (count * sizeof (int));
|
||||
}
|
||||
else if (menu->allocated == menu->count)
|
||||
{
|
||||
int count = menu->allocated = menu->allocated + 10;
|
||||
menu->text
|
||||
= (char **) xrealloc (menu->text, count * sizeof (char *));
|
||||
menu->submenu
|
||||
= (XMenu **) xrealloc (menu->submenu, count * sizeof (XMenu *));
|
||||
menu->panenumber
|
||||
= (int *) xrealloc (menu->panenumber, count * sizeof (int));
|
||||
}
|
||||
}
|
||||
|
||||
/* Search the given menu structure for a given pane number. */
|
||||
static XMenu *
|
||||
IT_menu_search_pane (XMenu *menu, int pane)
|
||||
{
|
||||
int i;
|
||||
XMenu *try;
|
||||
|
||||
for (i = 0; i < menu->count; i++)
|
||||
if (menu->submenu[i])
|
||||
if (pane == menu->panenumber[i])
|
||||
return menu->submenu[i];
|
||||
else
|
||||
if ((try = IT_menu_search_pane (menu->submenu[i], pane)))
|
||||
return try;
|
||||
return (XMenu *) 0;
|
||||
}
|
||||
|
||||
/* Determine how much screen space a given menu needs. */
|
||||
static void
|
||||
IT_menu_calc_size (XMenu *menu, int *width, int *height)
|
||||
{
|
||||
int i, h2, w2, maxsubwidth, maxheight;
|
||||
|
||||
maxsubwidth = 0;
|
||||
maxheight = menu->count;
|
||||
for (i = 0; i < menu->count; i++)
|
||||
{
|
||||
if (menu->submenu[i])
|
||||
{
|
||||
IT_menu_calc_size (menu->submenu[i], &w2, &h2);
|
||||
if (w2 > maxsubwidth) maxsubwidth = w2;
|
||||
if (i + h2 > maxheight) maxheight = i + h2;
|
||||
}
|
||||
}
|
||||
*width = menu->width + maxsubwidth;
|
||||
*height = maxheight;
|
||||
}
|
||||
|
||||
/* Display MENU at (X,Y) using FACES. */
|
||||
static void
|
||||
IT_menu_display (XMenu *menu, int y, int x, int *faces)
|
||||
{
|
||||
int i, j, face, width;
|
||||
GLYPH *text, *p;
|
||||
char *q;
|
||||
int mx, my;
|
||||
int enabled, mousehere;
|
||||
int row, col;
|
||||
|
||||
width = menu->width;
|
||||
text = (GLYPH *) xmalloc ((width + 2) * sizeof (GLYPH));
|
||||
ScreenGetCursor (&row, &col);
|
||||
mouse_get_xy (&mx, &my);
|
||||
mouse_off ();
|
||||
(*update_begin_hook) ();
|
||||
for (i = 0; i < menu->count; i++)
|
||||
{
|
||||
(*cursor_to_hook) (y + i, x);
|
||||
enabled
|
||||
= (!menu->submenu[i] && menu->panenumber[i]) || (menu->submenu[i]);
|
||||
mousehere = (y + i == my && x <= mx && mx < x + width + 2);
|
||||
face = faces[enabled + mousehere * 2];
|
||||
p = text;
|
||||
*p++ = FAST_MAKE_GLYPH (' ', face);
|
||||
for (j = 0, q = menu->text[i]; *q; j++)
|
||||
*p++ = FAST_MAKE_GLYPH (*q++, face);
|
||||
for (; j < width; j++)
|
||||
*p++ = FAST_MAKE_GLYPH (' ', face);
|
||||
*p++ = FAST_MAKE_GLYPH (menu->submenu[i] ? 16 : ' ', face);
|
||||
(*write_glyphs_hook) (text, width + 2);
|
||||
}
|
||||
internal_flush (stdout);
|
||||
(*update_end_hook) ();
|
||||
mouse_on ();
|
||||
ScreenSetCursor (row, col);
|
||||
xfree (text);
|
||||
}
|
||||
|
||||
/* Create a brand new menu structure. */
|
||||
XMenu *
|
||||
XMenuCreate (int foo, int bar)
|
||||
{
|
||||
return IT_menu_create ();
|
||||
}
|
||||
|
||||
/* Create a new pane and place it on the outer-most level. It is not
|
||||
clear that it should be placed out there, but I don't know what else
|
||||
to do. */
|
||||
int
|
||||
XMenuAddPane (XMenu *menu, char *txt, int enable)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (!enable)
|
||||
abort ();
|
||||
|
||||
IT_menu_make_room (menu);
|
||||
menu->submenu[menu->count] = IT_menu_create ();
|
||||
menu->text[menu->count] = txt;
|
||||
menu->panenumber[menu->count] = ++menu->panecount;
|
||||
menu->count++;
|
||||
if ((len = strlen (txt)) > menu->width) menu->width = len;
|
||||
return menu->panecount;
|
||||
}
|
||||
|
||||
/* Create a new item in a menu pane. */
|
||||
int
|
||||
XMenuAddSelection (XMenu *menu, int pane, int foo, char *txt, int enable)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (pane)
|
||||
if (!(menu = IT_menu_search_pane (menu, pane)))
|
||||
return XM_FAILURE;
|
||||
IT_menu_make_room (menu);
|
||||
menu->submenu[menu->count] = (XMenu *) 0;
|
||||
menu->text[menu->count] = txt;
|
||||
menu->panenumber[menu->count] = enable;
|
||||
menu->count++;
|
||||
if ((len = strlen (txt)) > menu->width) menu->width = len;
|
||||
return XM_SUCCESS;
|
||||
}
|
||||
|
||||
/* Decide where the menu would be placed if requested at (X,Y). */
|
||||
XMenuLocate (XMenu *menu, int foo1, int foo2, int x, int y,
|
||||
int *ulx, int *uly, int *width, int *height)
|
||||
{
|
||||
if (menu->count == 1 && menu->submenu[0])
|
||||
/* Special case: the menu consists of only one pane. */
|
||||
IT_menu_calc_size (menu->submenu[0], width, height);
|
||||
else
|
||||
IT_menu_calc_size (menu, width, height);
|
||||
*ulx = x + 1;
|
||||
*uly = y;
|
||||
*width += 2;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *screen_behind;
|
||||
XMenu *menu;
|
||||
int pane;
|
||||
int x, y;
|
||||
} IT_menu_state;
|
||||
|
||||
|
||||
/* Display menu, wait for user's response, and return that response. */
|
||||
int
|
||||
XMenuActivate (XMenu *menu, int *pane, int *selidx,
|
||||
int x0, int y0, unsigned ButtonMask, char **txt)
|
||||
{
|
||||
IT_menu_state *state;
|
||||
int statecount;
|
||||
int x, y, i, b;
|
||||
int screensize;
|
||||
int faces[4], selectface;
|
||||
int leave, result, onepane;
|
||||
|
||||
/* Just in case we got here without a mouse present... */
|
||||
if (!have_mouse)
|
||||
return XM_IA_SELECT;
|
||||
|
||||
state = alloca (menu->panecount * sizeof (IT_menu_state));
|
||||
screensize = ScreenRows () * ScreenCols () * 2;
|
||||
faces[0]
|
||||
= compute_glyph_face (&the_only_frame,
|
||||
face_name_id_number
|
||||
(&the_only_frame,
|
||||
intern ("msdos-menu-passive-face")),
|
||||
0);
|
||||
faces[1]
|
||||
= compute_glyph_face (&the_only_frame,
|
||||
face_name_id_number
|
||||
(&the_only_frame,
|
||||
intern ("msdos-menu-active-face")),
|
||||
0);
|
||||
selectface
|
||||
= face_name_id_number (&the_only_frame, intern ("msdos-menu-select-face"));
|
||||
faces[2] = compute_glyph_face (&the_only_frame, selectface, faces[0]);
|
||||
faces[3] = compute_glyph_face (&the_only_frame, selectface, faces[1]);
|
||||
|
||||
statecount = 1;
|
||||
state[0].menu = menu;
|
||||
mouse_off ();
|
||||
ScreenRetrieve (state[0].screen_behind = xmalloc (screensize));
|
||||
mouse_on ();
|
||||
if ((onepane = menu->count == 1 && menu->submenu[0]))
|
||||
{
|
||||
menu->width = menu->submenu[0]->width;
|
||||
state[0].menu = menu->submenu[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
state[0].menu = menu;
|
||||
}
|
||||
state[0].x = x0 - 1;
|
||||
state[0].y = y0;
|
||||
state[0].pane = onepane;
|
||||
|
||||
mouse_last_x = -1; /* A hack that forces display. */
|
||||
leave = 0;
|
||||
while (!leave)
|
||||
{
|
||||
mouse_check_moved ();
|
||||
if (mouse_moved)
|
||||
{
|
||||
mouse_moved = 0;
|
||||
result = XM_IA_SELECT;
|
||||
mouse_get_xy (&x, &y);
|
||||
for (i = 0; i < statecount; i++)
|
||||
if (state[i].x <= x && x < state[i].x + state[i].menu->width + 2)
|
||||
{
|
||||
int dy = y - state[i].y;
|
||||
if (0 <= dy && dy < state[i].menu->count)
|
||||
{
|
||||
if (!state[i].menu->submenu[dy])
|
||||
if (state[i].menu->panenumber[dy])
|
||||
result = XM_SUCCESS;
|
||||
else
|
||||
result = XM_IA_SELECT;
|
||||
*pane = state[i].pane - 1;
|
||||
*selidx = dy;
|
||||
/* We hit some part of a menu, so drop extra menues that
|
||||
have been opened. That does not include an open and
|
||||
active submenu. */
|
||||
if (i != statecount - 2
|
||||
|| state[i].menu->submenu[dy] != state[i+1].menu)
|
||||
while (i != statecount - 1)
|
||||
{
|
||||
statecount--;
|
||||
mouse_off ();
|
||||
ScreenUpdate (state[statecount].screen_behind);
|
||||
mouse_on ();
|
||||
xfree (state[statecount].screen_behind);
|
||||
}
|
||||
if (i == statecount - 1 && state[i].menu->submenu[dy])
|
||||
{
|
||||
IT_menu_display (state[i].menu,
|
||||
state[i].y,
|
||||
state[i].x,
|
||||
faces);
|
||||
state[statecount].menu = state[i].menu->submenu[dy];
|
||||
state[statecount].pane = state[i].menu->panenumber[dy];
|
||||
mouse_off ();
|
||||
ScreenRetrieve (state[statecount].screen_behind
|
||||
= xmalloc (screensize));
|
||||
mouse_on ();
|
||||
state[statecount].x
|
||||
= state[i].x + state[i].menu->width + 2;
|
||||
state[statecount].y = y;
|
||||
statecount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
IT_menu_display (state[statecount - 1].menu,
|
||||
state[statecount - 1].y,
|
||||
state[statecount - 1].x,
|
||||
faces);
|
||||
}
|
||||
for (b = 0; b < mouse_button_count; b++)
|
||||
{
|
||||
(void) mouse_pressed (b, &x, &y);
|
||||
if (mouse_released (b, &x, &y))
|
||||
leave = 1;
|
||||
}
|
||||
}
|
||||
|
||||
mouse_off ();
|
||||
ScreenUpdate (state[0].screen_behind);
|
||||
mouse_on ();
|
||||
while (statecount--)
|
||||
xfree (state[statecount].screen_behind);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Dispose of a menu. */
|
||||
XMenuDestroy (XMenu *menu)
|
||||
{
|
||||
int i;
|
||||
if (menu->allocated)
|
||||
{
|
||||
for (i = 0; i < menu->count; i++)
|
||||
if (menu->submenu[i])
|
||||
XMenuDestroy (menu->submenu[i]);
|
||||
xfree (menu->text);
|
||||
xfree (menu->submenu);
|
||||
xfree (menu->panenumber);
|
||||
}
|
||||
xfree (menu);
|
||||
}
|
||||
|
||||
int x_pixel_width (struct frame *f)
|
||||
{
|
||||
return FRAME_WIDTH(f);
|
||||
}
|
||||
|
||||
int x_pixel_height (struct frame *f)
|
||||
{
|
||||
return FRAME_HEIGHT(f);
|
||||
}
|
||||
#endif /* !HAVE_X_WINDOWS */
|
||||
|
||||
#endif /* MSDOS */
|
||||
|
|
85
src/msdos.h
85
src/msdos.h
|
@ -17,7 +17,9 @@ You should have received a copy of the GNU General Public License
|
|||
along with GNU Emacs; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <time.h>
|
||||
#ifndef _MSDOS_H_
|
||||
#define _MSDOS_H_
|
||||
|
||||
#include <dpmi.h>
|
||||
|
||||
int dos_ttraw ();
|
||||
|
@ -29,7 +31,7 @@ void sleep_or_kbd_hit (int, int);
|
|||
char *rootrelativepath (char *);
|
||||
void init_environment ();
|
||||
void internal_terminal_init ();
|
||||
#ifndef _stdio_h_
|
||||
#ifdef _stdio_h_
|
||||
int internal_flush (FILE *);
|
||||
#endif
|
||||
void ctrl_break_func (_go32_dpmi_registers *);
|
||||
|
@ -45,3 +47,82 @@ void mouse_check_moved ();
|
|||
int mouse_pressed (int, int *, int *);
|
||||
int mouse_released (int, int *, int *);
|
||||
void init_gettimeofday ();
|
||||
|
||||
#ifndef HAVE_X_WINDOWS
|
||||
/* Dummy types. */
|
||||
typedef int XFontStruct;
|
||||
typedef int GC;
|
||||
typedef int Pixmap;
|
||||
typedef int Display;
|
||||
typedef int Window;
|
||||
#define PIX_TYPE int
|
||||
#define XDISPLAY
|
||||
|
||||
/* This is a cut-down version of the one in xterm.h, which see. */
|
||||
struct x_display
|
||||
{
|
||||
int left_pos;
|
||||
int top_pos;
|
||||
int line_height;
|
||||
PIX_TYPE background_pixel;
|
||||
PIX_TYPE foreground_pixel;
|
||||
XFontStruct *font;
|
||||
struct face **param_faces;
|
||||
int n_param_faces;
|
||||
struct face **computed_faces;
|
||||
int n_computed_faces;
|
||||
int size_computed_faces;
|
||||
};
|
||||
|
||||
extern struct x_display the_only_x_display;
|
||||
extern Display *x_current_display;
|
||||
|
||||
#define FRAME_PARAM_FACES(f) (the_only_x_display.param_faces)
|
||||
#define FRAME_N_PARAM_FACES(f) (the_only_x_display.n_param_faces)
|
||||
#define FRAME_DEFAULT_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[0])
|
||||
#define FRAME_MODE_LINE_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[1])
|
||||
#define FRAME_COMPUTED_FACES(f) (the_only_x_display.computed_faces)
|
||||
#define FRAME_N_COMPUTED_FACES(f) (the_only_x_display.n_computed_faces)
|
||||
#define FRAME_SIZE_COMPUTED_FACES(f) (the_only_x_display.size_computed_faces)
|
||||
#define FRAME_DEFAULT_FACE(f) (the_only_x_display.computed_faces[0])
|
||||
#define FRAME_MODE_LINE_FACE(f) (the_only_x_display.computed_faces[1])
|
||||
#define FRAME_X_DISPLAY(f) ((Display *) 0)
|
||||
#define FRAME_FOREGROUND_PIXEL(f) (the_only_x_display.foreground_pixel)
|
||||
#define FRAME_BACKGROUND_PIXEL(f) (the_only_x_display.background_pixel)
|
||||
#define FRAME_FONT(f) (the_only_x_display.font)
|
||||
|
||||
#define XFreeGC (void)
|
||||
#define same_size_fonts(foo,bar) (1)
|
||||
#define unload_font(p1,p2)
|
||||
#define unload_color(p1,p2)
|
||||
#define x_destroy_bitmap(p1,p2)
|
||||
#define load_pixmap(p1,p2,p3,p4) (0)
|
||||
#define XGetGeometry(p1,p2,p3,p4,p5,p6,p7,p8,p9)
|
||||
#define DisplayWidth(p1,p2) (the_only_frame.width)
|
||||
#define DisplayHeight(p1,p2) (the_only_frame.height)
|
||||
#define XMenuSetAEQ (void)
|
||||
#define XMenuSetFreeze (void)
|
||||
#define XMenuRecompute (void)
|
||||
#define FONT_WIDTH(foo) 1
|
||||
/* Function `getcbrk' is the most harmless I can think of right now... */
|
||||
#define check_x if (FRAME_TERMCAP_P (bar)) error ("Not running under a windows system."); else getcbrk
|
||||
#define XM_FAILURE -1
|
||||
#define XM_SUCCESS 1
|
||||
#define XM_NO_SELECT 2
|
||||
#define XM_IA_SELECT 3
|
||||
#define ButtonReleaseMask 0
|
||||
|
||||
typedef struct x_menu_struct
|
||||
{
|
||||
int count;
|
||||
char **text;
|
||||
struct x_menu_struct **submenu;
|
||||
int *panenumber; /* Also used as enable. */
|
||||
int allocated;
|
||||
int panecount;
|
||||
int width;
|
||||
} XMenu;
|
||||
|
||||
#endif /* not HAVE_X_WINDOWS */
|
||||
|
||||
#endif /* not _MSDOS_H_ */
|
||||
|
|
|
@ -29,11 +29,18 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
|
||||
/* First define a measure of the amount of data we have. */
|
||||
|
||||
/* A system configuration file may set this to request a certain extra
|
||||
amount of storage. This is a lot more update-robust that defining
|
||||
BASE_PURESIZE or even PURESIZE directly. */
|
||||
#ifndef SYSTEM_PURESIZE_EXTRA
|
||||
#define SYSTEM_PURESIZE_EXTRA 0
|
||||
#endif
|
||||
|
||||
#ifndef BASE_PURESIZE
|
||||
#ifdef MULTI_FRAME
|
||||
#define BASE_PURESIZE 265000
|
||||
#define BASE_PURESIZE (265000 + SYSTEM_PURESIZE_EXTRA)
|
||||
#else
|
||||
#define BASE_PURESIZE 220000
|
||||
#define BASE_PURESIZE (220000 + SYSTEM_PURESIZE_EXTRA)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
|
||||
#define ORDINARY_LINK
|
||||
|
||||
/* command.com does not under stand `...` so we define this. */
|
||||
/* command.com does not understand `...` so we define this. */
|
||||
#define LIB_GCC -Lgcc
|
||||
#define DONT_NEED_ENVIRON
|
||||
#define SEPCHAR ';'
|
||||
|
@ -215,8 +215,19 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
/* Mode line description of a buffer's type. */
|
||||
#define MODE_LINE_BINARY_TEXT(buf) (NILP(buf->buffer_file_type) ? "T" : "B")
|
||||
|
||||
/* We need a little extra space, see ../../lisp/loadup.el */
|
||||
#define PURESIZE 240000
|
||||
|
||||
/* We have (the code to control) a mouse. */
|
||||
#define HAVE_MOUSE
|
||||
|
||||
/* We have support for faces. */
|
||||
#define HAVE_FACES
|
||||
|
||||
/* Define one of these for easier conditionals. */
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
/* We need a little extra space, see ../../lisp/loadup.el */
|
||||
#define SYSTEM_PURESIZE_EXTRA 15000
|
||||
#define HAVE_X11R5
|
||||
#define LIBX11_SYSTEM -lxext -lsys
|
||||
#else
|
||||
/* We need a little extra space, see ../../lisp/loadup.el */
|
||||
#define SYSTEM_PURESIZE_EXTRA 30000
|
||||
#endif
|
||||
|
|
24
src/sysdep.c
24
src/sysdep.c
|
@ -1148,7 +1148,11 @@ init_sys_modes ()
|
|||
|
||||
EMACS_GET_TTY (input_fd, &old_tty);
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
/* Emacs' window system on MSDOG uses the `internal terminal' and therefore
|
||||
needs the initialization code below. */
|
||||
if (!read_socket_hook && EQ (Vwindow_system, Qnil))
|
||||
#endif
|
||||
{
|
||||
tty = old_tty;
|
||||
|
||||
|
@ -1300,7 +1304,8 @@ init_sys_modes ()
|
|||
tty.ltchars = new_ltchars;
|
||||
#endif /* HAVE_LTCHARS */
|
||||
#ifdef MSDOS /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */
|
||||
internal_terminal_init ();
|
||||
if (!term_initted)
|
||||
internal_terminal_init ();
|
||||
dos_ttraw ();
|
||||
#endif
|
||||
|
||||
|
@ -1510,9 +1515,22 @@ reset_sys_modes ()
|
|||
}
|
||||
if (!term_initted)
|
||||
return;
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
/* Emacs' window system on MSDOG uses the `internal terminal' and therefore
|
||||
needs the clean-up code below. */
|
||||
if (read_socket_hook || !EQ (Vwindow_system, Qnil))
|
||||
return;
|
||||
#endif
|
||||
cursor_to (FRAME_HEIGHT (selected_frame) - 1, 0);
|
||||
#ifdef MSDOS
|
||||
if (!EQ (Vwindow_system, Qnil))
|
||||
{
|
||||
/* Change to grey on white. */
|
||||
putchar ('\e');
|
||||
putchar ('A');
|
||||
putchar (7);
|
||||
}
|
||||
#endif
|
||||
clear_end_of_line (FRAME_WIDTH (selected_frame));
|
||||
/* clear_end_of_line may move the cursor */
|
||||
cursor_to (FRAME_HEIGHT (selected_frame) - 1, 0);
|
||||
|
@ -1704,11 +1722,7 @@ kbd_input_ast ()
|
|||
struct input_event e;
|
||||
e.kind = ascii_keystroke;
|
||||
XSETINT (e.code, c);
|
||||
#ifdef MULTI_FRAME
|
||||
XSETFRAME (e.frame_or_window, selected_frame);
|
||||
#else
|
||||
e.frame_or_window = Qnil;
|
||||
#endif
|
||||
kbd_buffer_store_event (&e);
|
||||
}
|
||||
if (input_available_clear_time)
|
||||
|
|
|
@ -3184,6 +3184,8 @@ init_window_once ()
|
|||
#else /* not MULTI_FRAME */
|
||||
extern Lisp_Object get_minibuffer ();
|
||||
|
||||
selected_frame = last_nonminibuf_frame = &the_only_frame;
|
||||
|
||||
minibuf_window = make_window ();
|
||||
FRAME_ROOT_WINDOW (selected_frame) = make_window ();
|
||||
|
||||
|
|
18
src/xdisp.c
18
src/xdisp.c
|
@ -742,7 +742,7 @@ redisplay ()
|
|||
{
|
||||
Lisp_Object tail, frame;
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
#ifdef HAVE_FACES
|
||||
/* Clear the face cache, only when we do a full redisplay
|
||||
and not too often either. */
|
||||
if (clear_face_cache_count > 1000)
|
||||
|
@ -1959,7 +1959,7 @@ copy_part_of_rope (f, to, s, from, len, face)
|
|||
int last_code = -1;
|
||||
int last_merged = 0;
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
#ifdef HAVE_FACES
|
||||
if (! FRAME_TERMCAP_P (f))
|
||||
while (n--)
|
||||
{
|
||||
|
@ -2004,7 +2004,7 @@ fix_glyph (f, glyph, cface)
|
|||
GLYPH glyph;
|
||||
int cface;
|
||||
{
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
#ifdef HAVE_FACES
|
||||
if (! FRAME_TERMCAP_P (f))
|
||||
{
|
||||
if (FAST_GLYPH_FACE (glyph) != 0)
|
||||
|
@ -2273,7 +2273,7 @@ display_text_line (w, start, vpos, hpos, taboffset)
|
|||
break;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
#ifdef HAVE_FACES
|
||||
/* Did we hit a face change? Figure out what face we should
|
||||
use now. We also hit this the first time through the
|
||||
loop, to see what face we should start with. */
|
||||
|
@ -2329,7 +2329,7 @@ display_text_line (w, start, vpos, hpos, taboffset)
|
|||
copy_part_of_rope (f, p1prev, p1prev, invis_vector_contents,
|
||||
(p1 - p1prev), current_face);
|
||||
}
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
#ifdef HAVE_FACES
|
||||
/* Draw the face of the newline character as extending all the
|
||||
way to the end of the frame line. */
|
||||
if (current_face)
|
||||
|
@ -2366,7 +2366,7 @@ display_text_line (w, start, vpos, hpos, taboffset)
|
|||
copy_part_of_rope (f, p1prev, p1prev, invis_vector_contents,
|
||||
(p1 - p1prev), current_face);
|
||||
}
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
#ifdef HAVE_FACES
|
||||
/* Draw the face of the newline character as extending all the
|
||||
way to the end of the frame line. */
|
||||
if (current_face)
|
||||
|
@ -2607,7 +2607,7 @@ display_text_line (w, start, vpos, hpos, taboffset)
|
|||
|
||||
if (len > width)
|
||||
len = width;
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
#ifdef HAVE_FACES
|
||||
if (!NULL_INTERVAL_P (XSTRING (Voverlay_arrow_string)->intervals))
|
||||
{
|
||||
/* If the arrow string has text props, obey them when displaying. */
|
||||
|
@ -2624,7 +2624,7 @@ display_text_line (w, start, vpos, hpos, taboffset)
|
|||
}
|
||||
}
|
||||
else
|
||||
#endif /* HAVE_X_WINDOWS */
|
||||
#endif /* HAVE_FACES */
|
||||
{
|
||||
for (i = 0; i < len; i++)
|
||||
leftmargin[i] = p[i];
|
||||
|
@ -2727,7 +2727,7 @@ display_mode_line (w)
|
|||
if (XFASTINT (w->width) == FRAME_WIDTH (f)
|
||||
|| XFASTINT (XWINDOW (w->parent)->width) == FRAME_WIDTH (f))
|
||||
FRAME_DESIRED_GLYPHS (f)->highlight[vpos] = mode_line_inverse_video;
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
#ifdef HAVE_FACES
|
||||
else if (! FRAME_TERMCAP_P (f))
|
||||
{
|
||||
/* For a partial width window, explicitly set face of each glyph. */
|
||||
|
|
85
src/xfaces.c
85
src/xfaces.c
|
@ -25,9 +25,14 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#include <config.h>
|
||||
#include "lisp.h"
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
#ifdef HAVE_FACES
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
#include "xterm.h"
|
||||
#endif
|
||||
#ifdef MSDOS
|
||||
#include "dosfns.h"
|
||||
#endif
|
||||
#include "buffer.h"
|
||||
#include "dispextern.h"
|
||||
#include "frame.h"
|
||||
|
@ -35,6 +40,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#include "window.h"
|
||||
#include "intervals.h"
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
/* Compensate for bug in Xos.h on some systems, on which it requires
|
||||
time.h. On some such systems, Xos.h tries to redefine struct
|
||||
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. */
|
|||
#include <X11/Xos.h>
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* HAVE_X_WINDOWS */
|
||||
|
||||
/* An explanation of the face data structures. */
|
||||
|
||||
|
@ -205,6 +211,7 @@ face_eql (face1, face2)
|
|||
|
||||
/* Managing graphics contexts of faces. */
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
/* Given a computed face, construct its graphics context if necessary. */
|
||||
|
||||
struct face *
|
||||
|
@ -454,6 +461,55 @@ load_pixmap (f, name, w_ptr, h_ptr)
|
|||
|
||||
return bitmap_id;
|
||||
}
|
||||
|
||||
#else /* !HAVE_X_WINDOWS */
|
||||
|
||||
/* Stubs for MSDOS when not under X. */
|
||||
|
||||
struct face *
|
||||
intern_face (f, face)
|
||||
struct frame *f;
|
||||
struct face *face;
|
||||
{
|
||||
return face;
|
||||
}
|
||||
|
||||
void
|
||||
clear_face_cache ()
|
||||
{
|
||||
/* No action. */
|
||||
}
|
||||
|
||||
static void
|
||||
build_face (f, face)
|
||||
struct frame *f;
|
||||
struct face *face;
|
||||
{
|
||||
face->gc = 1;
|
||||
}
|
||||
|
||||
#ifdef MSDOS
|
||||
unsigned long
|
||||
load_color (f, name)
|
||||
FRAME_PTR f;
|
||||
Lisp_Object name;
|
||||
{
|
||||
Lisp_Object result;
|
||||
|
||||
if (NILP (name))
|
||||
return FACE_DEFAULT;
|
||||
|
||||
CHECK_STRING (name, 0);
|
||||
result = call1 (Qmsdos_color_translate, name);
|
||||
if (INTEGERP (result))
|
||||
return XINT (result);
|
||||
else
|
||||
Fsignal (Qerror, Fcons (build_string ("undefined color"),
|
||||
Fcons (name, Qnil)));
|
||||
}
|
||||
#endif
|
||||
#endif /* !HAVE_X_WINDOWS */
|
||||
|
||||
|
||||
/* Managing parameter face arrays for frames. */
|
||||
|
||||
|
@ -471,6 +527,7 @@ init_frame_faces (f)
|
|||
new_computed_face (f, FRAME_PARAM_FACES (f)[1]);
|
||||
recompute_basic_faces (f);
|
||||
|
||||
#ifdef MULTI_FRAME
|
||||
/* Find another X frame. */
|
||||
{
|
||||
Lisp_Object tail, frame, result;
|
||||
|
@ -499,6 +556,7 @@ init_frame_faces (f)
|
|||
ensure_face_ready (f, i);
|
||||
}
|
||||
}
|
||||
#endif /* MULTI_FRAME */
|
||||
}
|
||||
|
||||
|
||||
|
@ -627,6 +685,7 @@ ensure_face_ready (f, id)
|
|||
FRAME_PARAM_FACES (f) [id] = allocate_face ();
|
||||
}
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
/* Return non-zero if FONT1 and FONT2 have the same width.
|
||||
We do not check the height, because we can now deal with
|
||||
different heights.
|
||||
|
@ -667,6 +726,7 @@ frame_update_line_height (f)
|
|||
f->display.x->line_height = biggest;
|
||||
return 1;
|
||||
}
|
||||
#endif /* not HAVE_X_WINDOWS */
|
||||
|
||||
/* Modify face TO by copying from FROM all properties which have
|
||||
nondefault settings. */
|
||||
|
@ -1001,18 +1061,17 @@ DEFUN ("make-face-internal", Fmake_face_internal, Smake_face_internal, 1, 1, 0,
|
|||
(face_id)
|
||||
Lisp_Object face_id;
|
||||
{
|
||||
Lisp_Object rest;
|
||||
Lisp_Object rest, frame;
|
||||
int id = XINT (face_id);
|
||||
|
||||
CHECK_NUMBER (face_id, 0);
|
||||
if (id < 0 || id >= next_face_id)
|
||||
error ("Face id out of range");
|
||||
|
||||
for (rest = Vframe_list; !NILP (rest); rest = XCONS (rest)->cdr)
|
||||
FOR_EACH_FRAME (rest, frame)
|
||||
{
|
||||
struct frame *f = XFRAME (XCONS (rest)->car);
|
||||
if (FRAME_X_P (f))
|
||||
ensure_face_ready (f, id);
|
||||
if (FRAME_X_P (XFRAME (frame)))
|
||||
ensure_face_ready (XFRAME (frame), id);
|
||||
}
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -1046,6 +1105,9 @@ DEFUN ("set-face-attribute-internal", Fset_face_attribute_internal,
|
|||
|
||||
if (EQ (attr_name, intern ("font")))
|
||||
{
|
||||
#if defined (MSDOS) && !defined (HAVE_X_WINDOWS)
|
||||
face->font = 0; /* The one and only font. */
|
||||
#else
|
||||
XFontStruct *font = load_font (f, attr_value);
|
||||
if (face->font != f->display.x->font)
|
||||
unload_font (f, face->font);
|
||||
|
@ -1055,6 +1117,7 @@ DEFUN ("set-face-attribute-internal", Fset_face_attribute_internal,
|
|||
/* Must clear cache, since it might contain the font
|
||||
we just got rid of. */
|
||||
garbaged = 1;
|
||||
#endif
|
||||
}
|
||||
else if (EQ (attr_name, intern ("foreground")))
|
||||
{
|
||||
|
@ -1067,6 +1130,9 @@ DEFUN ("set-face-attribute-internal", Fset_face_attribute_internal,
|
|||
{
|
||||
unsigned long new_color = load_color (f, attr_value);
|
||||
unload_color (f, face->background);
|
||||
#if defined (MSDOS) && !defined (HAVE_X_WINDOWS)
|
||||
new_color &= ~8; /* Bright would give blinking characters. */
|
||||
#endif
|
||||
face->background = new_color;
|
||||
garbaged = 1;
|
||||
}
|
||||
|
@ -1147,7 +1213,9 @@ syms_of_xfaces ()
|
|||
The region is highlighted with this face\n\
|
||||
when Transient Mark mode is enabled and the mark is active.");
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
defsubr (&Spixmap_spec_p);
|
||||
#endif
|
||||
defsubr (&Sframe_face_alist);
|
||||
defsubr (&Sset_frame_face_alist);
|
||||
defsubr (&Smake_face_internal);
|
||||
|
@ -1155,5 +1223,4 @@ when Transient Mark mode is enabled and the mark is active.");
|
|||
defsubr (&Sinternal_next_face_id);
|
||||
}
|
||||
|
||||
#endif /* HAVE_X_WINDOWS */
|
||||
|
||||
#endif /* HAVE_FACES */
|
||||
|
|
11
src/xmenu.c
11
src/xmenu.c
|
@ -42,9 +42,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
#include "blockinput.h"
|
||||
#include "puresize.h"
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
/* This may include sys/types.h, and that somehow loses
|
||||
if this is not done before the other system files. */
|
||||
#include "xterm.h"
|
||||
#endif
|
||||
|
||||
/* Load sys/types.h if not already loaded.
|
||||
In some systems loading it twice is suicidal. */
|
||||
|
@ -54,7 +56,9 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||
|
||||
#include "dispextern.h"
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
#include "../oldXMenu/XMenu.h"
|
||||
#endif
|
||||
|
||||
#ifdef USE_X_TOOLKIT
|
||||
#include <X11/Xlib.h>
|
||||
|
@ -759,7 +763,6 @@ cached information about equivalent key sequences.")
|
|||
if (FRAMEP (window))
|
||||
{
|
||||
f = XFRAME (window);
|
||||
|
||||
xpos = 0;
|
||||
ypos = 0;
|
||||
}
|
||||
|
@ -1969,11 +1972,13 @@ xdialog_show (f, menubarp, keymaps, title, error)
|
|||
}
|
||||
pop_down:
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
/* State that no mouse buttons are now held.
|
||||
That is not necessarily true, but the fiction leads to reasonable
|
||||
results, and it is a pain to ask which are actually held now
|
||||
or track this in the loop above. */
|
||||
x_mouse_grabbed = 0;
|
||||
#endif
|
||||
|
||||
/* Unread any events that we got but did not handle. */
|
||||
while (queue != NULL)
|
||||
|
@ -2071,6 +2076,7 @@ xmenu_show (f, x, y, menubarp, keymaps, title, error)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
/* Adjust coordinates to relative to the outer (window manager) window. */
|
||||
{
|
||||
Window child;
|
||||
|
@ -2097,6 +2103,7 @@ xmenu_show (f, x, y, menubarp, keymaps, title, error)
|
|||
y += win_y;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_X_WINDOWS */
|
||||
|
||||
/* Adjust coordinates to be root-window-relative. */
|
||||
x += f->display.x->left_pos;
|
||||
|
@ -2282,11 +2289,13 @@ xmenu_show (f, x, y, menubarp, keymaps, title, error)
|
|||
}
|
||||
XMenuDestroy (XDISPLAY menu);
|
||||
|
||||
#ifdef HAVE_X_WINDOWS
|
||||
/* State that no mouse buttons are now held.
|
||||
(The oldXMenu code doesn't track this info for us.)
|
||||
That is not necessarily true, but the fiction leads to reasonable
|
||||
results, and it is a pain to ask which are actually held now. */
|
||||
x_mouse_grabbed = 0;
|
||||
#endif
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
|
|
@ -5590,8 +5590,11 @@ Check the DISPLAY environment variable or use \"-d\"\n",
|
|||
x_watch_cut_buffer_cache ();
|
||||
#endif
|
||||
|
||||
#ifdef subprocesses
|
||||
/* This is only needed for distinguishing keyboard and process input. */
|
||||
if (ConnectionNumber (x_current_display) != 0)
|
||||
change_keyboard_wait_descriptor (ConnectionNumber (x_current_display));
|
||||
#endif
|
||||
change_input_fd (ConnectionNumber (x_current_display));
|
||||
|
||||
#ifndef F_SETOWN_BUG
|
||||
|
|
Loading…
Add table
Reference in a new issue