Follow these steps to patch the X11 support in a standard 18.50 GNU Emacs distribution: 1) Apply the diffs below to change: lisp/x-mouse.el lisp/term/x-win.el src/dispnew.c src/emacs.c src/keyboard.c src/process.c src/x11fns.c src/x11term.c src/x11term.h 2) Install the new files: src/sink_11.h src/sinkmask_11.h ================================= Diffs ================================== diff -rc2 dist-18.50/lisp/x-mouse.el dist-18.51/lisp/x-mouse.el *** dist-18.50/lisp/x-mouse.el Sat Mar 5 13:17:12 1988 --- dist-18.51/lisp/x-mouse.el Mon Mar 21 17:20:10 1988 *************** *** 235,246 **** (and selection (call-interactively selection)))) ! (define-key mouse-map x-button-c-s-middle 'x-help) ! (define-key mouse-map x-button-c-s-left 'x-buffer-menu) ! (define-key mouse-map x-button-right 'x-mouse-select) ! (define-key mouse-map x-button-left 'x-mouse-set-mark) (define-key mouse-map x-button-c-s-right 'x-mouse-keep-one-window) (define-key mouse-map x-button-c-right 'x-mouse-select-and-split) - (define-key mouse-map x-button-middle 'x-mouse-set-point) (define-key mouse-map x-button-s-middle 'x-cut-text) (define-key mouse-map x-button-s-right 'x-paste-text) (define-key mouse-map x-button-c-middle 'x-cut-and-wipe-text) --- 235,282 ---- (and selection (call-interactively selection)))) ! ; Prevent beeps on button-up. If the button isn't bound to anything, it ! ; will beep on button-down. ! (define-key mouse-map x-button-right-up 'x-mouse-ignore) ! (define-key mouse-map x-button-middle-up 'x-mouse-ignore) ! (define-key mouse-map x-button-left-up 'x-mouse-ignore) ! (define-key mouse-map x-button-s-right-up 'x-mouse-ignore) ! (define-key mouse-map x-button-s-middle-up 'x-mouse-ignore) ! (define-key mouse-map x-button-s-left-up 'x-mouse-ignore) ! (define-key mouse-map x-button-m-right-up 'x-mouse-ignore) ! (define-key mouse-map x-button-m-middle-up 'x-mouse-ignore) ! (define-key mouse-map x-button-m-left-up 'x-mouse-ignore) ! (define-key mouse-map x-button-c-right-up 'x-mouse-ignore) ! (define-key mouse-map x-button-c-middle-up 'x-mouse-ignore) ! (define-key mouse-map x-button-c-left-up 'x-mouse-ignore) ! (define-key mouse-map x-button-m-s-right-up 'x-mouse-ignore) ! (define-key mouse-map x-button-m-s-middle-up 'x-mouse-ignore) ! (define-key mouse-map x-button-m-s-left-up 'x-mouse-ignore) ! (define-key mouse-map x-button-c-s-right-up 'x-mouse-ignore) ! (define-key mouse-map x-button-c-s-middle-up 'x-mouse-ignore) ! (define-key mouse-map x-button-c-s-left-up 'x-mouse-ignore) ! (define-key mouse-map x-button-c-m-right-up 'x-mouse-ignore) ! (define-key mouse-map x-button-c-m-middle-up 'x-mouse-ignore) ! (define-key mouse-map x-button-c-m-left-up 'x-mouse-ignore) ! (define-key mouse-map x-button-c-m-s-right-up 'x-mouse-ignore) ! (define-key mouse-map x-button-c-m-s-middle-up 'x-mouse-ignore) ! (define-key mouse-map x-button-c-m-s-left-up 'x-mouse-ignore) ! (define-key mouse-map x-button-c-s-right 'x-mouse-keep-one-window) (define-key mouse-map x-button-c-right 'x-mouse-select-and-split) (define-key mouse-map x-button-s-middle 'x-cut-text) (define-key mouse-map x-button-s-right 'x-paste-text) (define-key mouse-map x-button-c-middle 'x-cut-and-wipe-text) + + (if (or (not (boundp 'window-system-version)) + (eq window-system-version 10)) + (progn + (define-key mouse-map x-button-c-s-middle 'x-help) + (define-key mouse-map x-button-c-s-left 'x-buffer-menu) + (define-key mouse-map x-button-right 'x-mouse-select) + (define-key mouse-map x-button-left 'x-mouse-set-mark) + (define-key mouse-map x-button-middle 'x-mouse-set-point)) + (define-key mouse-map x-button-c-s-middle 'x-mouse-ignore) + (define-key mouse-map x-button-c-s-left 'x-mouse-ignore) + (define-key mouse-map x-button-right 'x-cut-text) + (define-key mouse-map x-button-left 'x-mouse-set-point) + (define-key mouse-map x-button-middle 'x-paste-text)) diff -rc2 dist-18.50/lisp/term/x-win.el dist-18.51/lisp/term/x-win.el *** dist-18.50/lisp/term/x-win.el Sat Mar 5 13:16:00 1988 --- dist-18.51/lisp/term/x-win.el Mon Mar 21 17:20:34 1988 *************** *** 28,45 **** (setq x-switches '((\"-r\" . t) (\"-font\" . \"foo\") (\"-b\" . \"8\")))") ! (setq command-switch-alist ! (append '(("-r" . x-handle-switch) ! ("-i" . x-handle-switch) ! ("-font" . x-handle-switch) ! ("-w" . x-handle-switch) ! ("-b" . x-handle-switch) ! ("-ib" . x-handle-switch) ! ("-fg" . x-handle-switch) ! ("-bg" . x-handle-switch) ! ("-bd" . x-handle-switch) ! ("-cr" . x-handle-switch) ! ("-ms" . x-handle-switch)) ! command-switch-alist)) ;; This is run after the command args are parsed. (defun x-handle-switch (switch) --- 28,68 ---- (setq x-switches '((\"-r\" . t) (\"-font\" . \"foo\") (\"-b\" . \"8\")))") ! (if (or (not (boundp 'window-system-version)) ! (eq window-system-version 10)) ! (setq command-switch-alist ! (append '(("-r" . x-handle-switch) ! ("-i" . x-handle-switch) ! ("-font" . x-handle-switch) ! ("-w" . x-handle-switch) ! ("-b" . x-handle-switch) ! ("-ib" . x-handle-switch) ! ("-fg" . x-handle-switch) ! ("-bg" . x-handle-switch) ! ("-bd" . x-handle-switch) ! ("-cr" . x-handle-switch) ! ("-ms" . x-handle-switch)) ! command-switch-alist)) ! (setq command-switch-alist ! (append '(("-r" . ignore) ! ("-i" . ignore) ! ("-rn" . xignore) ! ("-font" . xignore) ! ("-fn" . xignore) ! ("-wn" . xignore) ! ("-in" . xignore) ! ("-w" . xignore) ! ("-geometry" . xignore) ! ("-b" . xignore) ! ("-ib" . xignore) ! ("-fg" . xignore) ! ("-bg" . xignore) ! ("-bd" . xignore) ! ("-cr" . xignore) ! ("-ms" . xignore)) ! command-switch-alist))) + (defun xignore (&rest ignore) + (setq command-line-args-left (cdr command-line-args-left))) + ;; This is run after the command args are parsed. (defun x-handle-switch (switch) *************** *** 160,173 **** ;; only if Emacs has been compiled to support direct interface to X. ! (if (fboundp 'x-change-display) (progn - ;; xterm.c depends on using interrupt-driven input. - (set-input-mode t nil) - - ;; Not defvar! This is not DEFINING this variable, just specifying - ;; a value for it. - (setq window-setup-hook 'x-pop-up-window) - (require 'x-mouse) (put 'suspend-emacs 'disabled --- 183,201 ---- ;; only if Emacs has been compiled to support direct interface to X. ! (if (eq window-system 'x) (progn (require 'x-mouse) + (if (or (not (boundp 'window-system-version)) + (eq window-system-version 10)) + (progn + ;; xterm.c depends on using interrupt-driven input. + (set-input-mode t nil) + + ;; Not defvar! This is not DEFINING this variable, just specifying + ;; a value for it. + (setq term-setup-hook 'x-pop-up-window) + (while x-switches + (x-handle-switch-1 (car (car x-switches)) (cdr (car x-switches))) + (setq x-switches (cdr x-switches))))) (put 'suspend-emacs 'disabled *************** *** 177,185 **** (substitute-key-definition 'suspend-emacs nil global-map) (substitute-key-definition 'suspend-emacs nil esc-map) ! (substitute-key-definition 'suspend-emacs nil ctl-x-map) ! ;; Not needed any more -- done in C. ! ;; (if (not x-processed-defaults) (x-get-default-args)) ! ;; Process switch settings made by .emacs file. ! (while x-switches ! (x-handle-switch-1 (car (car x-switches)) (cdr (car x-switches))) ! (setq x-switches (cdr x-switches))))) --- 205,207 ---- (substitute-key-definition 'suspend-emacs nil global-map) (substitute-key-definition 'suspend-emacs nil esc-map) ! (substitute-key-definition 'suspend-emacs nil ctl-x-map))) diff -rc2 dist-18.50/src/dispnew.c dist-18.51/src/dispnew.c *** dist-18.50/src/dispnew.c Mon Feb 29 12:46:38 1988 --- dist-18.51/src/dispnew.c Mon Mar 21 17:21:13 1988 *************** *** 95,98 **** --- 95,102 ---- ('x is the only current possibility) */ + Lisp_Object Vwindow_system_version; /* Version of the window system; + current values for 'x are + 10 and 11 */ + /* Nonzero means reading single-character input with prompt so put cursor on minibuffer after the prompt. */ *************** *** 1295,1300 **** #ifdef HAVE_X_WINDOWS extern Lisp_Object Vxterm; Vxterm = Qnil; ! #endif MetaFlag = 0; --- 1299,1306 ---- #ifdef HAVE_X_WINDOWS extern Lisp_Object Vxterm; + extern Lisp_Object Vwindow_system_version; + Vxterm = Qnil; ! #endif /* HAVE_X_WINDOWS */ MetaFlag = 0; *************** *** 1303,1306 **** --- 1309,1313 ---- terminal_type = (char *) 0; + Vxterm = Qnil; if (!inhibit_window_system) { *************** *** 1307,1318 **** #ifdef HAVE_X_WINDOWS extern char *alternate_display; ! if (alternate_display || egetenv ("DISPLAY")) { x_term_init (); Vxterm = Qt; #ifdef X11 ! Vwindow_system = intern ("x11"); #else ! Vwindow_system = intern ("x"); #endif /* X11 */ goto term_init_done; --- 1314,1329 ---- #ifdef HAVE_X_WINDOWS extern char *alternate_display; ! /* Changed to deal with KSH lossage */ ! char *disp = egetenv ("DISPLAY"); ! ! if (alternate_display || (disp && *disp)) { x_term_init (); Vxterm = Qt; + Vwindow_system = intern ("x"); #ifdef X11 ! XSET (Vwindow_system_version, Lisp_Int, 11); #else ! XSET (Vwindow_system_version, Lisp_Int, 10); #endif /* X11 */ goto term_init_done; *************** *** 1376,1379 **** --- 1387,1394 ---- \(such as `x') or nil if emacs is running on an ordinary terminal."); Vwindow_system = Qnil; + DEFVAR_LISP ("window-system-version", &Vwindow_system_version, + "A symbol naming the version of the window-system under which emacs\n\ + is running."); + Vwindow_system_version = Qnil; DEFVAR_BOOL ("cursor-in-echo-area", &cursor_in_echo_area, "Non-nil means put cursor in minibuffer after any message displayed there."); diff -rc2 dist-18.50/src/emacs.c dist-18.51/src/emacs.c *** dist-18.50/src/emacs.c Mon Feb 29 12:46:41 1988 --- dist-18.51/src/emacs.c Mon Feb 29 12:48:28 1988 *************** *** 73,79 **** the display to use. */ char *alternate_display; char **xargv; int xargc; ! #endif /* HAVE_X_WINDOWS */ /* Nonzero means running Emacs without interactive terminal. */ --- 73,82 ---- the display to use. */ char *alternate_display; + #endif /* HAVE_X_WINDOWS */ + + #ifdef X11 char **xargv; int xargc; ! #endif /* X11 */ /* Nonzero means running Emacs without interactive terminal. */ *************** *** 224,231 **** inhibit_window_system = 0; ! #ifdef HAVE_X_WINDOWS xargv = argv; xargc = argc; ! #endif /* Handle the -t switch, which specifies filename to use as terminal */ --- 227,234 ---- inhibit_window_system = 0; ! #ifdef X11 xargv = argv; xargc = argc; ! #endif /* X11 */ /* Handle the -t switch, which specifies filename to use as terminal */ diff -rc2 dist-18.50/src/keyboard.c dist-18.51/src/keyboard.c *** dist-18.50/src/keyboard.c Mon Feb 29 12:46:46 1988 --- dist-18.51/src/keyboard.c Sat Mar 5 12:57:55 1988 *************** *** 960,963 **** --- 960,965 ---- int *addr; { + unsigned char buf[64 * BUFFER_SIZE_FACTOR]; + int i; #ifdef VMS /* On VMS, we always have something in the buffer *************** *** 970,973 **** --- 972,987 ---- else if (ioctl (0, FIONREAD, addr) < 0) *addr = 0; + else if (*addr > 0 && read_socket_hook) { + *addr = (*read_socket_hook) (0, buf, sizeof buf); + for (i = 0; i < *addr; i++) + { + kbd_buffer_store_char (buf[i]); + /* Don't look at input that follows a C-g too closely. + This reduces lossage due to autorepeat on C-g. */ + if (buf[i] == Ctl('G')) + break; + } + *addr = kbd_count; + } #else /* no FIONREAD */ read_avail_input (); diff -rc2 dist-18.50/src/process.c dist-18.51/src/process.c *** dist-18.50/src/process.c Mon Feb 29 12:46:53 1988 --- dist-18.51/src/process.c Mon Mar 21 17:23:35 1988 *************** *** 1233,1237 **** int wait_channel = 0; struct Lisp_Process *wait_proc = 0; ! extern kbd_count; /* Detect when read_kbd is really the address of a Lisp_Process. */ --- 1233,1237 ---- int wait_channel = 0; struct Lisp_Process *wait_proc = 0; ! extern kbd_count, interrupt_input; /* Detect when read_kbd is really the address of a Lisp_Process. */ *************** *** 1380,1385 **** to give it higher priority than subprocesses */ ! if (read_kbd && (kbd_count || !NULL (Vquit_flag))) ! break; if (read_kbd && (Available & ChannelMask (0))) --- 1380,1390 ---- to give it higher priority than subprocesses */ ! if (read_kbd) ! { ! if (interrupt_input && (kbd_count || !NULL (Vquit_flag))) ! break; ! if (!interrupt_input && detect_input_pending()) ! break; ! } if (read_kbd && (Available & ChannelMask (0))) diff -rc2 dist-18.50/src/x11fns.c dist-18.51/src/x11fns.c *** dist-18.50/src/x11fns.c Mon Feb 29 12:46:57 1988 --- dist-18.51/src/x11fns.c Sat Mar 5 12:57:16 1988 *************** *** 103,106 **** --- 103,108 ---- extern int XXpid; + extern char *XXidentity; + extern Display *XXdisplay; extern int bitblt, CursorExists, VisibleX, VisibleY; *************** *** 423,427 **** default_name = (char *) XSTRING (arg)->data; ! value = XGetDefault (progname, default_name); if (value) return build_string (value); --- 425,433 ---- default_name = (char *) XSTRING (arg)->data; ! if (XXidentity) ! value = XGetDefault (XXdisplay, XXidentity, default_name); ! else ! value = XGetDefault (XXdisplay, CLASS, default_name); ! if (value) return build_string (value); *************** *** 657,664 **** sigsetmask (mask); - #if 0 - if (QLength(XXdisplay) > 0) - #endif read_events_block (); - return Qt; } --- 663,666 ---- *************** *** 684,692 **** XSetWindowSize(screen_height,screen_width); sigsetmask (mask); - - #if 0 - if (QLength(XXdisplay) > 0) - read_events_block (); - #endif return Qt; --- 686,689 ---- diff -rc2 dist-18.50/src/x11term.c dist-18.51/src/x11term.c *** dist-18.50/src/x11term.c Mon Feb 29 12:47:04 1988 --- dist-18.51/src/x11term.c Sat Mar 5 12:57:16 1988 *************** *** 23,42 **** /* Thanks to Mark Biggers for all of the Window Manager support */ - /* PLEASE NOTE! - * - * This is only a test copy of the X11 code -- it is NOT suitable - * for distribution beyond test sites!!!! - * - */ - /* ! * $Source: /mit/emacs/src/RCS/xterm_11.c,v $ * $Author: rfrench $ * $Locker: $ ! * $Header: xterm_11.c,v 1.9 88/01/16 15:33:35 rfrench Exp $ */ #ifndef lint ! static char *rcsid_xterm_c = "$Header: xterm_11.c,v 1.9 88/01/16 15:33:35 rfrench Exp $"; #endif lint --- 23,35 ---- /* Thanks to Mark Biggers for all of the Window Manager support */ /* ! * $Source: /mit/emacs/src/RCS/x11term.c,v $ * $Author: rfrench $ * $Locker: $ ! * $Header: x11term.c,v 1.12 88/02/29 14:11:07 rfrench Exp $ */ #ifndef lint ! static char *rcsid_xterm_c = "$Header: x11term.c,v 1.12 88/02/29 14:11:07 rfrench Exp $"; #endif lint *************** *** 54,59 **** * if this is not done before the other system files. */ - /*#include "xdebug.h"*/ - #include "x11term.h" --- 47,50 ---- *************** *** 80,85 **** #include "termchar.h" ! #include "sink.h" ! #include "sinkmask.h" #define min(a,b) ((a)<(b) ? (a) : (b)) --- 71,76 ---- #include "termchar.h" ! #include "sink_11.h" ! #include "sinkmask_11.h" #define min(a,b) ((a)<(b) ? (a) : (b)) *************** *** 96,101 **** #define MAXHEIGHT 300 /* In lines */ - #define CLASS "emacs" /* class id for GNU Emacs, used in .Xdefaults, etc. */ - int pixelwidth,pixelheight; char *progname; --- 87,90 ---- *************** *** 125,130 **** int WindowMapped; ! static char *XXidentity; /* Resource name of this invocation of Emacs */ static char *XXicon_name; /* user-supplied icon info */ static char *XXheader; /* user-supplied window header info */ --- 114,120 ---- int WindowMapped; ! char *XXidentity; /* Resource name of this invocation of Emacs */ static char *XXicon_name; /* user-supplied icon info */ + static int XXicon_usebitmap; /* Use bitmap or not */ static char *XXheader; /* user-supplied window header info */ *************** *** 139,142 **** --- 129,135 ---- int CursorExists; /* during updates cursor is turned off */ + int CursorOutline; /* when the pointer is not in the Emacs + * widow the cursor should be drawn in + * outline form a la xterm */ static int InUpdate; /* many of functions here may be invoked * even if no update in progress; when *************** *** 176,183 **** char *rindex(); - #ifdef BIGDEBUG - char debug_string[500000]; - #endif BIGDEBUG - /* HLmode -- Changes the GX function for output strings. Could be used to * change font. Check an XText library function call. --- 169,172 ---- *************** *** 230,233 **** --- 219,223 ---- if (!initialized) { CursorExists = 0; + CursorOutline = 1; VisibleX = 0; VisibleY = 0; *************** *** 234,244 **** } XTclear_screen (); - #if 0 - #ifdef FIONREAD - ioctl (0, FIONREAD, &stuffpending); - if (stuffpending) - read_events_block (); - #endif - #endif /* 0 */ } --- 224,227 ---- *************** *** 505,522 **** } - /* The following routine is for the deaf or for the pervert who prefers - * that his terminal flashes at him rather than beep at him. - */ - - static int flashedback; - XTflash () { XGCValues gcv_temp; ! struct itimerval itimer; int mask = sigblock (sigmask (SIGIO)); - extern int flashback (); - #ifdef XDEBUG fprintf (stderr, "XTflash\n"); --- 488,497 ---- } XTflash () { XGCValues gcv_temp; ! struct timeval to; int mask = sigblock (sigmask (SIGIO)); #ifdef XDEBUG fprintf (stderr, "XTflash\n"); *************** *** 528,540 **** AllPlanes); - signal (SIGALRM, flashback); - getitimer (ITIMER_REAL, &itimer); - itimer.it_value.tv_usec += 250000; - itimer.it_interval.tv_sec = 0; - itimer.it_interval.tv_usec = 0; - flashedback = 0; - - setitimer (ITIMER_REAL, &itimer, 0); - XFillRectangle (XXdisplay, XXwindow, XXgc_temp, 0, 0, screen_width*XXfontw+2*XXInternalBorder, --- 503,506 ---- *************** *** 544,565 **** sigsetmask (mask); ! while (!flashedback) ! pause (); ! ! XFreeGC(XXdisplay, XXgc_temp); ! } ! ! flashback () ! { ! int mask = sigblock (sigmask (SIGIO) | sigmask (SIGALRM)); ! XFillRectangle (XXdisplay, XXwindow, XXgc_temp, 0, 0, screen_width*XXfontw+2*XXInternalBorder, screen_height*XXfonth+2*XXInternalBorder); XFlush (XXdisplay); - - flashedback = 1; sigsetmask (mask); ! } XTfeep () --- 510,526 ---- sigsetmask (mask); ! to.tv_sec = 0; ! to.tv_usec = 250000; ! ! select(0, 0, 0, 0, &to); ! ! mask = sigblock (sigmask (SIGIO)); XFillRectangle (XXdisplay, XXwindow, XXgc_temp, 0, 0, screen_width*XXfontw+2*XXInternalBorder, screen_height*XXfonth+2*XXInternalBorder); + XFreeGC(XXdisplay, XXgc_temp); XFlush (XXdisplay); sigsetmask (mask); ! } XTfeep () *************** *** 587,590 **** --- 548,552 ---- if (!WindowMapped) { CursorExists = 0; + CursorOutline = 1; return 0; /* Currently the return values are not */ *************** *** 611,615 **** &ActiveScreen[VisibleY+1]->body[VisibleX], 1); ! else XDrawImageString(XXdisplay, XXwindow, XXgc_curs, VisibleX*XXfontw+XXInternalBorder, --- 573,587 ---- &ActiveScreen[VisibleY+1]->body[VisibleX], 1); ! else if (CursorOutline) { ! XDrawImageString(XXdisplay, XXwindow, XXgc_norm, ! VisibleX*XXfontw+XXInternalBorder, ! VisibleY*XXfonth+XXInternalBorder+XXbase, ! &ActiveScreen[VisibleY+1]->body[VisibleX], ! 1); ! XDrawRectangle (XXdisplay, XXwindow, XXgc_norm, ! VisibleX*XXfontw+XXInternalBorder, ! VisibleY*XXfonth+XXInternalBorder, ! XXfontw - 1, XXfonth - 1); ! } else XDrawImageString(XXdisplay, XXwindow, XXgc_curs, VisibleX*XXfontw+XXInternalBorder, *************** *** 623,626 **** --- 595,603 ---- VisibleY*XXfonth+XXInternalBorder, XXfontw, XXfonth, 0); + else if (CursorOutline) + XDrawRectangle (XXdisplay, XXwindow, XXgc_norm, + VisibleX*XXfontw+XXInternalBorder, + VisibleY*XXfonth+XXInternalBorder, + XXfontw - 1, XXfonth - 1); else XFillRectangle (XXdisplay, XXwindow, XXgc_norm, *************** *** 650,653 **** --- 627,631 ---- if (!WindowMapped) { CursorExists = 0; + CursorOutline = 1; sigsetmask (mask); return; *************** *** 946,950 **** #endif ! return (internal_socket_read (bufp, numchars, 0)); } --- 924,928 ---- #endif ! return (internal_socket_read (bufp, numchars)); } *************** *** 1105,1149 **** #endif sun ! #if 0 ! /* All input is supposed to go through ! the usual mechanisms in keyboard.c, which do the actual I/O ! by calling XTread_socket via read_socket_hook. A side-path such ! as this is not clean. ! ! Since keyboard input is normally done in a signal handler, any ! attempt to do it elsewhere is not only unmodular but risks a timing ! error as well. It is also superfluous, unless there is a bug in ! the usual mechanisms or the use of read_socket_hook. If so, fix it ! there; don't create a redundant mechanism here. -- RMS. */ ! ! read_events_block () ! { ! unsigned char buf[64]; ! int i, nread; ! ! #ifdef XDEBUG ! fprintf(stderr,"read_events_block\n"); ! #endif ! ! nread = internal_socket_read (buf, sizeof buf, 0); ! if (!nread) ! return (0); ! ! for (i=0; i < nread; i++) { ! kbd_buffer_store_char (buf[i]); ! /* Don't look at input that follows a C-g too closely. ! * This reduces lossage due to autorepeat on C-g. */ ! if (buf[i] == ('G' & 037)) ! break; ! } ! return (nread); ! } ! ! #endif /* 0 */ ! ! internal_socket_read(bufp, numchars, stopatkey) register unsigned char *bufp; register int numchars; - int stopatkey; { int count,nbytes,rows,cols; --- 1083,1089 ---- #endif sun ! internal_socket_read(bufp, numchars) register unsigned char *bufp; register int numchars; { int count,nbytes,rows,cols; *************** *** 1154,1189 **** KeySym keysym; - extern int input_pending; - count = 0; - #ifdef BIGDEBUG - my_log("Entering internal_socket_read input_pending = %d\n",input_pending); - #endif BIGDEBUG - while (XPending (XXdisplay)) { - if (stopatkey) { - XPeekEvent(XXdisplay,&event); - if ((event.type & 0177) == KeyPress) { - if (XLookupString (&event, - mapping_buf, 20, &keysym, - &status) || - keysym == XK_Left || - keysym == XK_Right || - keysym == XK_Up || - keysym == XK_Down) - return (1); - } - if (((event.type & 0177) == ButtonPress) || - ((event.type & 0177) == ButtonRelease)) - return (1); - } XNextEvent (XXdisplay,&event); event.type &= 0177; /* Mask out XSendEvent indication */ - #ifdef BIGDEBUG - my_log("Got event %d\n",event.type); - #endif BIGDEBUG - switch (event.type) { --- 1094,1103 ---- *************** *** 1191,1194 **** --- 1105,1112 ---- break; + case MappingNotify: + XRefreshKeyboardMapping(&event); + break; + case MapNotify: WindowMapped = 1; *************** *** 1242,1245 **** --- 1160,1181 ---- break; + /* + * NOTE: No 'Focus' management is being done yet. If + * some other window has grabbed the focus, emacs will + * still show a filled cursor whenever the pointer + * enters the emacs window. + */ + case EnterNotify: + CursorToggle (); + CursorOutline = 0; + CursorToggle (); + break; + + case LeaveNotify: + CursorToggle (); + CursorOutline = 1; + CursorToggle (); + break; + case KeyPress: nbytes = XLookupString (&event, *************** *** 1246,1249 **** --- 1182,1190 ---- mapping_buf, 20, &keysym, &status); + /* + * Someday this will be unnecessary as we will + * be able to use XRebindKeysym so XLookupString + * will have already given us the string we want. + */ if (IsFunctionKey(keysym) || IsMiscFunctionKey(keysym)) { *************** *** 1388,1393 **** desiredwindow = option; ! if (option = XGetDefault(XXdisplay, class, "BodyFont")) ! temp_font = option; } --- 1329,1341 ---- desiredwindow = option; ! /* ! * At X11 the .BodyFont was renamed to .Font, (see the resource ! * manager documentation), but allow backward compatibility. ! * First look for .Font and if that fails look at .BodyFont. ! */ ! if (option = XGetDefault(XXdisplay, class, "Font")) ! temp_font = option; ! else if (option = XGetDefault(XXdisplay, class, "BodyFont")) ! temp_font = option; } *************** *** 1398,1401 **** --- 1346,1350 ---- register int xxargc; register char **xxargv; + char *ptr; extern char *getenv (); extern XTinterrupt_signal (); *************** *** 1481,1486 **** --- 1430,1439 ---- XXheader = (char *) NULL; + XXicon_usebitmap = 0; + temp_font = "fixed"; progname = xargv[0]; + if (ptr = rindex(progname, '/')) + progname = ptr+1; XXpid = getpid (); default_window = "=80x24+0+0"; *************** *** 1568,1571 **** --- 1521,1529 ---- xxargv++; } + if (xxargc && !strcmp (*xxargv, "-i")) { + xxargc--; + xxargv++; + XXicon_usebitmap = 1; + } if ((xxargc > 1) && !strcmp (*xxargv, "-b")) { xxargc--; *************** *** 1582,1586 **** xxargv++; } ! if ((xxargc > 1) && !strcmp (*xxargv, "-w")) { xxargc--; xxargv++; --- 1540,1545 ---- xxargv++; } ! if ((xxargc > 1) && (!strcmp (*xxargv, "-w") || ! !strcmp (*xxargv, "-geometry"))) { xxargc--; xxargv++; *************** *** 1773,1783 **** request_sigio(); - #ifdef BIGDEBUG - *debug_string = '\0'; - if (1) { - int dump_log(); - signal(SIGUSR1,dump_log); - } - #endif BIGDEBUG } --- 1732,1735 ---- *************** *** 1859,1866 **** { sigsetmask (mask); - #if 0 - if (QLength (XXdisplay) > 0) - read_events_block (); - #endif return -1; } --- 1811,1814 ---- *************** *** 1878,1885 **** sigsetmask (mask); ! #if 0 ! if (QLength (XXdisplay) > 0) ! read_events_block (); ! #endif return 0; } --- 1826,1830 ---- sigsetmask (mask); ! return 0; } *************** *** 2139,2146 **** XWMHints wmhints; - - wmhints.flags = InputHint | StateHint | - IconPixmapHint | IconMaskHint; wmhints.input = True; wmhints.initial_state = NormalState; --- 2084,2092 ---- XWMHints wmhints; + wmhints.flags = InputHint | StateHint; + if (XXicon_usebitmap) + wmhints.flags |= IconPixmapHint | IconMaskHint; + wmhints.input = True; wmhints.initial_state = NormalState; *************** *** 2149,2153 **** sink_bits, sink_width, sink_height); - SinkMaskPixmap = XCreateBitmapFromData (XXdisplay, w, sink_mask_bits, --- 2095,2098 ---- *************** *** 2154,2159 **** sink_mask_width, sink_mask_height); ! wmhints.icon_pixmap = SinkPixmap; ! wmhints.icon_mask = SinkMaskPixmap; XSetWMHints(XXdisplay, w, &wmhints); --- 2099,2110 ---- sink_mask_width, sink_mask_height); ! if (XXicon_usebitmap) { ! wmhints.icon_pixmap = SinkPixmap; ! wmhints.icon_mask = SinkMaskPixmap; ! } ! else { ! wmhints.icon_pixmap = 0; ! wmhints.icon_mask = 0; ! } XSetWMHints(XXdisplay, w, &wmhints); *************** *** 2186,2189 **** --- 2137,2143 ---- == (XFontStruct *) NULL) { + fprintf (stderr, "X server unable to find requested font '%s'!.\n", + (XXcurrentfont == NULL) ? "(null)" : XXcurrentfont); + fflush (stderr); exit (-98); } *************** *** 2204,2208 **** else { ! desktop = RootWindow(XXdisplay, 0); } --- 2158,2162 ---- else { ! desktop = RootWindow(XXdisplay, DefaultScreen(XXdisplay)); } *************** *** 2240,2243 **** --- 2194,2198 ---- CursorExists = 0; + CursorOutline = 1; VisibleX = 0; VisibleY = 0; *************** *** 2255,2258 **** --- 2210,2214 ---- XSelectInput(XXdisplay, XXwindow, KeyPressMask | ExposureMask | ButtonPressMask | ButtonReleaseMask | + EnterWindowMask | LeaveWindowMask | StructureNotifyMask); *************** *** 2261,2286 **** } - #ifdef BIGDEBUG - - my_log(s,a,b,c,d,e,f,g,h) - char *s; - { - char bfr[256]; - - sprintf(bfr,s,a,b,c,d,e,f,g,h); - - strcat(debug_string,bfr); - } - - dump_log() - { - fputs(debug_string,stderr); - fflush(stderr); - *debug_string = '\0'; - } - - #endif BIGDEBUG - #endif /* HAVE_X_WINDOWS */ - - /*#include "xundebug.h"*/ --- 2217,2219 ---- diff -rc2 dist-18.50/src/x11term.h dist-18.51/src/x11term.h *** dist-18.50/src/x11term.h Mon Feb 29 12:51:43 1988 --- dist-18.51/src/x11term.h Sat Mar 5 12:57:16 1988 *************** *** 1,8 **** ! #include ! #include ! #include ! #include ! #include ! #include #ifndef X11 --- 1,8 ---- ! #include ! #include ! #include ! #include ! #include ! #include #ifndef X11 *************** *** 15,16 **** --- 15,18 ---- #define sigmask(no) (1L << ((no) - 1)) #endif + + #define CLASS "emacs" /* class id for GNU Emacs, used in .Xdefaults, etc. */ ==================================================== New file src/sink_11.h /* $Header: sink_11.h,v 1.1 88/02/06 16:55:50 rfrench Exp $ */ #define sink_width 48 #define sink_height 48 static char sink_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x9f, 0xff, 0xff, 0xff, 0xff, 0x9f, 0x9f, 0xff, 0xff, 0xff, 0xff, 0x00, 0x80, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xbf, 0xff, 0xff, 0xff, 0x7f, 0x03, 0xa0, 0xff, 0xff, 0xff, 0x7f, 0xfd, 0xaf, 0xff, 0xff, 0xff, 0x3f, 0xf9, 0xaf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xaf, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xaf, 0xff, 0xff, 0xff, 0x7f, 0xf8, 0xaf, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xaf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xaf, 0xff, 0xff, 0xff, 0xbf, 0xf7, 0xaf, 0xff, 0xff, 0xff, 0x3f, 0xf3, 0xaf, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xaf, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x20, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xdf, 0xf8, 0xff, 0xff, 0xff, 0x07, 0xcf, 0xf9, 0x0f, 0xff, 0xff, 0xe7, 0xcf, 0xf9, 0xf7, 0xff, 0xff, 0xe7, 0xff, 0xf9, 0xf7, 0x63, 0xfb, 0xe7, 0xff, 0xf9, 0x37, 0x5a, 0xfb, 0xe7, 0xcf, 0xf9, 0xf7, 0x5a, 0xfb, 0xe7, 0xcf, 0xf9, 0xf7, 0x5a, 0xf9, 0xe7, 0xef, 0xf9, 0x0f, 0xdb, 0xfa, 0xe7, 0xff, 0xf9, 0xff, 0xff, 0xff, 0xe7, 0xdf, 0xf9, 0xff, 0xff, 0xff, 0xe7, 0xcf, 0x19, 0xfc, 0xff, 0xff, 0xe7, 0xcf, 0xd9, 0xff, 0xff, 0xff, 0xe7, 0xff, 0xd9, 0x47, 0xce, 0x73, 0xe6, 0xff, 0x19, 0xb6, 0xb5, 0xad, 0xe7, 0xcf, 0xd9, 0xb7, 0xb5, 0x7d, 0xe6, 0xc7, 0xd9, 0xb7, 0xb5, 0xed, 0xe5, 0xef, 0x19, 0xb4, 0x4d, 0x73, 0xe6, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xe3, 0xff, 0x03, 0x80, 0x03, 0x00, 0xf0, 0xef, 0x07, 0x00, 0x01, 0x00, 0xf8, 0xc7, 0xff, 0x3f, 0xf9, 0xff, 0xff, 0xe7, 0xff, 0x7f, 0xfd, 0xe0, 0xff, 0xff, 0xff, 0x7f, 0x7d, 0xdf, 0xff, 0xff, 0xff, 0x7f, 0xbd, 0xb1, 0xff, 0xff, 0xff, 0x7f, 0xbb, 0xae, 0xff, 0xef, 0xff, 0xff, 0xda, 0xae, 0xff, 0xc7, 0xff, 0xff, 0x66, 0xaf, 0xff, 0xe7, 0xff, 0xff, 0xbd, 0xaf, 0xff, 0xff, 0xff, 0xff, 0xc3, 0xaf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xaf, 0xff}; ==================================================== New file src/sinkmask_11.h /* $Header: sinkmask_11.h,v 1.1 88/02/06 16:55:53 rfrench Exp $ */ #define sink_mask_width 48 #define sink_mask_height 48 static char sink_mask_bits[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};