diff src/xterm.h @ 9655:93ccc7bbae8a

(struct x_display_info): Struct renamed from x_screen. (x_display): x_screen field renamed to display_info. (FRAME_X_DISPLAY): Use new name. (FRAME_X_DISPLAY_INFO): Likewise; also renamed from FRAME_X_SCREEN. (struct x_display_info): New fields *_mod_mask, icon_bitmap_id, connection, xrdb, Xatom..., grabbed, height, width, screen, visual, n_planes. (x_display_list): New variable. (FRAME_X_SCREEN): New macro. (WHITE_PIX_DEFAULT, BLACK_PIX_DEFAULT): Take arg f. (EMACS_CLASS): Macro moved here. (XExposeRegionEvent): Unused macro deleted. (XGetWindowInfo, XGetFont, XLoseFont): Unused macros deleted. (MINWIDTH, MINHEIGHT, MAXWIDTH, MAXHEIGHT): Unused macros deleted. (MAX_FACES_AND_GLYPHS, Bitmap): Unused macros deleted. (struct event_queue): Structure deleted (was unused). (EVENT_BUFFER_SIZE): Macro deleted. (XClear): Macro deleted. Callers use XClearWindow. (XWarpMousePointer): Macro deleted. Callers use XWarpPointer. (XStuffPending): Macro deleted. Callers use XPending. (XHandleError, XHandleIOError): Macros deleted. Callers use XSet...ErrorHandler. (XChangeWindowSize): Macro deleted. Callers use XResizeWindow. (Color): Macro deleted; replaced with XColor. (FONT_TYPE): Macro deleted; replaced with XFontStruct. (PIX_TYPE): Macro deleted; replaced with unsigned long. (ROOT_WINDOW): Macro deleted. (struct x_display_info): New field root_window. All uses changed. (XDISPLAY): Macro deleted. (XFlushQueue): Macro deleted. All callers changed. (DISPLAY_SCREEN_ARG): Maco deleted. (DISPLAY_CELLS): Macro deleted. (WINDOWINFO_TYPE): Macro deleted.
author Richard M. Stallman <rms@gnu.org>
date Sat, 22 Oct 1994 04:39:30 +0000
parents b0cf6d689f7a
children f4fa600e345f
line wrap: on
line diff
--- a/src/xterm.h	Sat Oct 22 04:34:16 1994 +0000
+++ b/src/xterm.h	Sat Oct 22 04:39:30 1994 +0000
@@ -37,18 +37,10 @@
 #include <X11/StringDefs.h>
 #endif
 
-/* Define a queue for X-events.  One such queue is used for mouse clicks.
-   Another is used for expose events.  */
-
-#define EVENT_BUFFER_SIZE 64
-
-/* Max and Min sizes in character columns. */
-#define MINWIDTH 10
-#define MINHEIGHT 10
-#define MAXWIDTH 300
-#define MAXHEIGHT 80
-
-#ifdef HAVE_X11
+/* The class of this X application.  */
+#define EMACS_CLASS "Emacs"
+
+/* Bookkeeping to distinguish X versions.  */
 
 /* HAVE_X11R4 is defined if we have the features of X11R4.  It should
    be defined when we're using X11R5, since X11R5 has the features of
@@ -90,48 +82,33 @@
 #define HAVE_X11R4
 #endif
 #endif
-
-#define PIX_TYPE unsigned long
-#define XDISPLAY x_current_display,
-#define XFlushQueue() XFlush(x_current_display)
-#define BLACK_PIX_DEFAULT BlackPixel (x_current_display, \
-				      XDefaultScreen (x_current_display))
-#define WHITE_PIX_DEFAULT WhitePixel (x_current_display, \
-				      XDefaultScreen (x_current_display))
-#define DISPLAY_SCREEN_ARG x_current_display, \
-				      XDefaultScreen (x_current_display)
-#define DISPLAY_CELLS DisplayCells (x_current_display, XDefaultScreen (x_current_display))
-#define ROOT_WINDOW RootWindow (x_current_display, DefaultScreen (x_current_display))
-#define FONT_TYPE XFontStruct
-#define Color XColor
-
-#define XExposeRegionEvent XExposeEvent
-#define Bitmap Pixmap			/* In X11, Bitmaps are a kind of
-					   Pixmap.  */
-#define WINDOWINFO_TYPE XWindowAttributes
-#define XGetWindowInfo(w, i) XGetWindowAttributes (x_current_display, \
-						   (w), (i))
-#define XGetFont(f) XLoadQueryFont (x_current_display, (f))
-#define XLoseFont(f) XFreeFont (x_current_display, (f))
-#define XStuffPending() XPending (x_current_display)
-#define XClear(w) XClearWindow (x_current_display, (w))
-#define XWarpMousePointer(w,x,y) XWarpPointer (x_current_display, None, w, \
-					       0,0,0,0, x, y)
-#define XHandleError XSetErrorHandler
-#define XHandleIOError XSetIOErrorHandler
-
-#define XChangeWindowSize(w,x,y) XResizeWindow(x_current_display,w,x,y)
+
+#define BLACK_PIX_DEFAULT(f) BlackPixel (FRAME_X_DISPLAY (f), \
+					 XScreenNumberOfScreen (FRAME_X_SCREEN (f)))
+#define WHITE_PIX_DEFAULT(f) WhitePixel (FRAME_X_DISPLAY (f), \
+					 XScreenNumberOfScreen (FRAME_X_SCREEN (f)))
 
 #define FONT_WIDTH(f)	((f)->max_bounds.width)
 #define FONT_HEIGHT(f)	((f)->ascent + (f)->descent)
 #define FONT_BASE(f)    ((f)->ascent)
 
+#define CHECK_X_FRAME(f, frame)			\
+  if (NILP (frame))				\
+    f = selected_frame;				\
+  else						\
+    {						\
+      CHECK_LIVE_FRAME (frame, 0);		\
+      f = XFRAME (frame);			\
+    }						\
+  if (! FRAME_X_P (f))
+
+  
+
 /* The mask of events that text windows always want to receive.  This
    does not include mouse movement events.  It is used when the window
-   is created (in x_window) and when we ask/unask for mouse movement
-   events (in XTmouse_tracking_enable).
+   is created (in x_window) and and in selection processing.
 
-   We do include ButtonReleases in this set because elisp isn't always
+   We do include ButtonReleases in this set because Emacs isn't always
    fast enough to catch them when it wants them, and they're rare
    enough that they don't use much processor time.  */
 
@@ -148,51 +125,6 @@
    | EnterWindowMask		\
    | VisibilityChangeMask)
 
-#else	/* X10 */
-
-#define ConnectionNumber(dpy) dpyno()
-#define PIX_TYPE int
-#define XDISPLAY
-#define XFlushQueue() XFlush()
-#define BLACK_PIX_DEFAULT BlackPixel
-#define WHITE_PIX_DEFAULT WhitePixel
-#define DISPLAY_SCREEN_ARG
-#define DISPLAY_CELLS DisplayCells ()
-#define ROOT_WINDOW RootWindow
-#define XFree free
-#define FONT_TYPE FontInfo
-
-#define WINDOWINFO_TYPE WindowInfo
-#define XGetWindowInfo(w, i) XQueryWindow ((w), (i))
-#define XGetFont(f) XOpenFont ((f))
-#define XLoseFont(f) XCloseFont ((f))
-#define XStuffPending() XPending ()
-#define XWarpMousePointer(w,x,y) XWarpMouse (w,x,y)
-#define XHandleError XErrorHandler
-#define XHandleIOError XIOErrorHandler
-
-#define FONT_WIDTH(f)	((f)->width)
-#define FONT_HEIGHT(f)	((f)->height)
-#define FONT_BASE(f)    ((f)->base)
-
-#define XChangeWindowSize(w,x,y) XChangeWindow(w,x,y)
-
-#endif /* X10 */
-
-struct event_queue
-  {
-    int rindex;			/* Index at which to fetch next. */
-    int windex;			/* Index at which to store next.  */
-    XEvent xrep[EVENT_BUFFER_SIZE];
-  };
-
-/* Queue for mouse clicks.  */
-extern struct event_queue x_mouse_queue;
-
-/* This is the X connection that we are using.  */
-
-extern Display *x_current_display;
-
 /* This checks to make sure we have a display.  */
 extern void check_x ();
 
@@ -208,46 +140,7 @@
 
 extern struct frame *x_focus_frame;
 
-#ifdef HAVE_X11
-/* Variables associated with the X display screen this emacs is using.  */
-
-/* How many screens this X display has.  */
-extern int x_screen_count;
-
-/* The vendor supporting this X server.  */
-extern Lisp_Object Vx_vendor;
-
-/* The vendor's release number for this X server.  */
-extern int x_release;
-
-/* Height of this X screen in pixels.  */
-extern int x_screen_height;
-
-/* Height of this X screen in millimeters.  */
-extern int x_screen_height_mm;
-
-/* Width of this X screen in pixels.  */
-extern int x_screen_width;
-
-/* Width of this X screen in millimeters.  */
-extern int x_screen_width_mm;
-
-/* Does this X screen do backing store?  */
-extern Lisp_Object Vx_backing_store;
-
-/* Does this X screen do save-unders?  */
-extern int x_save_under;
-
-/* Number of planes for this screen.  */
-extern int x_screen_planes;
-
-/* X Visual type of this screen.  */
-extern Lisp_Object Vx_screen_visual;
-
-/* Mask of which mouse buttons are currently held down.  */
-extern unsigned int x_mouse_grabbed;
-
-#endif /* HAVE_X11 */
+extern Visual *select_visual ();
 
 enum text_cursor_kinds {
   filled_box_cursor, hollow_box_cursor, bar_cursor
@@ -256,19 +149,90 @@
 /* For each X display, we have a structure that records
    information about it.  */
 
-struct x_screen
+struct x_display_info
 {
   /* Chain of all x_display structures.  */
-  struct x_display *next;
+  struct x_display_info *next;
+  /* Connection number (normally a file descriptor number).  */
+  int connection;
   /* This says how to access this display in Xlib.  */
-  Display *x_display_value;
+  Display *display;
   /* This records previous values returned by x-list-fonts.  */
   Lisp_Object font_list_cache;
   /* The name of this display.  */
   Lisp_Object name;
   /* Number of frames that are on this display.  */
   int reference_count;
+  /* The Screen this connection is connected to.  */
+  Screen *screen;
+  /* The Visual being used for this display.  */
+  Visual *visual;
+  /* Number of panes on this screen.  */
+  int n_planes;
+  /* Dimensions of this screen.  */
+  int height, width;
+  /* Mask of things that cause the mouse to be grabbed.  */
+  int grabbed;
+  /* Emacs bitmap-id of the default icon bitmap for this frame.
+     Or -1 if none has been allocated yet.  */
+  int icon_bitmap_id;
+  /* The root window of this screen.  */
+  Window root_window;
+
+  /* X Resource data base */
+  XrmDatabase xrdb;
+
+  /* Which modifier keys are on which modifier bits?
+
+     With each keystroke, X returns eight bits indicating which modifier
+     keys were held down when the key was pressed.  The interpretation
+     of the top five modifier bits depends on what keys are attached
+     to them.  If the Meta_L and Meta_R keysyms are on mod5, then mod5
+     is the meta bit.
+
+     meta_mod_mask is a mask containing the bits used for the meta key.
+     It may have more than one bit set, if more than one modifier bit
+     has meta keys on it.  Basically, if EVENT is a KeyPress event,
+     the meta key is pressed if (EVENT.state & meta_mod_mask) != 0.
+
+     shift_lock_mask is LockMask if the XK_Shift_Lock keysym is on the
+     lock modifier bit, or zero otherwise.  Non-alphabetic keys should
+     only be affected by the lock modifier bit if XK_Shift_Lock is in
+     use; XK_Caps_Lock should only affect alphabetic keys.  With this
+     arrangement, the lock modifier should shift the character if
+     (EVENT.state & shift_lock_mask) != 0.  */
+  int meta_mod_mask, shift_lock_mask;
+
+  /* These are like meta_mod_mask, but for different modifiers.  */
+  int alt_mod_mask, super_mod_mask, hyper_mod_mask;
+
+  /* Communication with window managers.  */
+  Atom Xatom_wm_protocols;
+  /* Kinds of protocol things we may receive.  */
+  Atom Xatom_wm_take_focus;
+  Atom Xatom_wm_save_yourself;
+  Atom Xatom_wm_delete_window;
+  /* Atom for indicating window state to the window manager.  */
+  Atom Xatom_wm_change_state;
+  /* Other WM communication */
+  Atom Xatom_wm_configure_denied; /* When our config request is denied */
+  Atom Xatom_wm_window_moved;     /* When the WM moves us.  */
+  /* EditRes protocol */
+  Atom Xatom_editres;
+
+  /* More atoms, which are selection types.  */
+  Atom Xatom_CLIPBOARD, Xatom_TIMESTAMP, Xatom_TEXT, Xatom_DELETE,
+  Xatom_MULTIPLE, Xatom_INCR, Xatom_EMACS_TMP, Xatom_TARGETS, Xatom_NULL,
+  Xatom_ATOM_PAIR;
 };
+
+/* This is a chain of structures for all the X displays currently in use.  */
+extern struct x_display_info *x_display_list;
+
+extern struct x_display_info *x_display_info_for_display ();
+extern struct x_display_info *x_display_info_for_name ();
+
+extern struct x_display_info *x_term_init ();
 
 /* Each X frame object points to its own struct x_display object
    in the display.x field.  The x_display structure contains all
@@ -333,16 +297,16 @@
      icon. */
   int icon_bitmap;
 
-  FONT_TYPE *font;
+  XFontStruct *font;
 
   /* Pixel values used for various purposes.
      border_pixel may be -1 meaning use a gray tile.  */
-  PIX_TYPE background_pixel;
-  PIX_TYPE foreground_pixel;
-  PIX_TYPE cursor_pixel;
-  PIX_TYPE border_pixel;
-  PIX_TYPE mouse_pixel;
-  PIX_TYPE cursor_foreground_pixel;
+  unsigned long background_pixel;
+  unsigned long foreground_pixel;
+  unsigned long cursor_pixel;
+  unsigned long border_pixel;
+  unsigned long mouse_pixel;
+  unsigned long cursor_foreground_pixel;
 
   /* Descriptor for the cursor in use for this window.  */
 #ifdef HAVE_X11
@@ -409,7 +373,7 @@
   int size_hint_flags;
 
   /* This is the Emacs structure for the X display this frame is on.  */
-  struct x_screen *x_screen;
+  struct x_display_info *display_info;
 };
 
 /* Get at the computed faces of an X window frame.  */
@@ -431,10 +395,14 @@
 #define FRAME_BACKGROUND_PIXEL(f) ((f)->display.x->background_pixel)
 #define FRAME_FONT(f) ((f)->display.x->font)
 
-#define FRAME_X_SCREEN(f) ((f)->display.x->x_screen)
+/* This gives the x_display_info structure for the display F is on.  */
+#define FRAME_X_DISPLAY_INFO(f) ((f)->display.x->display_info)
 
 /* This is the `Display *' which frame F is on.  */
-#define FRAME_X_DISPLAY(f) ((f)->display.x->x_screen->x_display_value)
+#define FRAME_X_DISPLAY(f) (FRAME_X_DISPLAY_INFO (f)->display)
+
+/* This is the `Screen *' which frame F is on.  */
+#define FRAME_X_SCREEN(f) (FRAME_X_DISPLAY_INFO (f)->screen)
 
 /* These two really ought to be called FRAME_PIXEL_{WIDTH,HEIGHT}.  */
 #define PIXEL_WIDTH(f) ((f)->display.x->pixel_width)
@@ -443,34 +411,6 @@
 #define FRAME_DESIRED_CURSOR(f) ((f)->display.x->desired_cursor)
 
 
-/* When X windows are used, a glyph may be a 16 bit unsigned datum.
-   The high order byte is the face number and is used as an index
-   in the face table.  A face is a font plus:
-    1) the unhighlighted foreground color,
-    2) the unhighlighted background color.
-   For highlighting, the two colors are exchanged.
-   Face number 0 is unused.  The low order byte of a glyph gives
-   the character within the font.  All fonts are assumed to be
-   fixed width, and to have the same height and width.  */
-
-#ifdef HAVE_X11
-
-/* Face declared in dispextern.h */
-
-#else	/* X10 */
-
-struct face
-{
-  FONT_TYPE *font;	/* Font info for specified font.  */
-  int  fg;		/* Unhighlighted foreground.  */
-  int  bg;		/* Unhighlighted background.  */
-};
-#endif	/* X10 */
-
-#define MAX_FACES_AND_GLYPHS 256
-extern struct face *x_face_table[];
-
-
 /* X-specific scroll bar stuff.  */
 
 /* We represent scroll bars as lisp vectors.  This allows us to place