home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / lucid / lemacs-19.6 / src / xterm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-26  |  6.4 KB  |  199 lines

  1. /* Definitions and headers for communication with X protocol.
  2.    Copyright (C) 1989, 1992, 1993 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU Emacs.
  5.  
  6. GNU Emacs is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU Emacs is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU Emacs; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #ifndef _EMACS_XTERM_H_
  21. #define _EMACS_XTERM_H_
  22.  
  23. #include <X11/Xlib.h>
  24. #include <X11/cursorfont.h>
  25. #include <X11/Xutil.h>
  26. #include <X11/keysym.h>
  27. #include <X11/Xatom.h>
  28. #include <X11/Xresource.h>
  29.  
  30. #include <X11/Intrinsic.h>  /* must be before lisp.h */
  31.  
  32. #include "blockio.h"
  33.  
  34. #define MAX_LINE_WIDTH(s) (PIXEL_WIDTH (s) \
  35.                 - (2 * (s)->display.x->internal_border_width))
  36.  
  37. struct x_pixmap
  38. {
  39.   Pixmap pixmap, mask;
  40.   GLYPH glyph_id;        /* index into glyph_to_x_pixmaps */
  41.   unsigned short face_id;    /* ~0 means use colors of current face */
  42.   unsigned int width;
  43.   unsigned int height;
  44.   unsigned int depth;        /* 0 depth means this is a bitmap of depth 1,
  45.                    and 1 represents the foreground color.
  46.                    Nonzero depth means that the cells of the
  47.                    pixmap are actual pixel values.  This
  48.                    matters because BlackPixel/WhitePixel vary.
  49.                  */
  50. };
  51.  
  52. extern struct x_pixmap builtin_continuer_pixmap;
  53. extern struct x_pixmap builtin_truncator_pixmap;
  54. extern struct x_pixmap builtin_rarrow_pixmap;
  55.  
  56. extern struct x_pixmap *glyph_to_x_pixmap (GLYPH g);
  57.  
  58.  
  59. #define EOL_CURSOR_WIDTH 4
  60.  
  61. #define XFlushQueue() {BLOCK_INPUT; XFlush(x_current_display); UNBLOCK_INPUT;}
  62. #define FONT_TYPE XFontStruct
  63.  
  64. extern XCharStruct *x_char_info ();
  65.  
  66. #define X_CHAR_WIDTH(font,ch) ((font)->per_char             \
  67.                    ? x_char_info ((font), (ch))->width  \
  68.                    : ((ch), (font)->min_bounds.width))
  69. #define X_DEFAULT_WIDTH(font) (X_CHAR_WIDTH (font, font->default_char))
  70.  
  71. #define FONT_WIDTH(f)    ((f)->max_bounds.width)
  72. #define FONT_HEIGHT(f)    ((f)->ascent + (f)->descent)
  73. #define FONT_BASE(f)    ((f)->ascent)
  74.  
  75. #ifndef sigmask
  76. #define sigmask(no) (1L << ((no) - 1))
  77. #endif
  78.  
  79.  
  80. /* This is the X connection that we are using.  */
  81.  
  82. extern Display *x_current_display;
  83.  
  84. extern struct screen *x_window_to_screen (Window);
  85.  
  86. /* Variables associated with the X display screen this emacs is using. */
  87.  
  88. extern Lisp_Object Vx_gc_pointer_shape;
  89.  
  90.  
  91. #define PIXEL_WIDTH(s) ((s)->display.x->pixel_width)
  92. #define PIXEL_HEIGHT(s) ((s)->display.x->pixel_height)
  93.  
  94. /* Each X screen object points to its own struct x_display object
  95.    in the display.x field.  The x_display structure contains all
  96.    the information that is specific to X windows.  */
  97.  
  98. struct x_display
  99. {
  100.   /* Position of the X window (x and y offsets in root window).  */
  101.   int left_pos;
  102.   int top_pos;
  103.  
  104.   /* Size of the X window in pixels, including internal border. */
  105.   int pixel_height, pixel_width;
  106.  
  107.   /* Here are the Graphics Contexts for the default font. */
  108.   GC normal_gc;                /* Normal video */
  109.   GC reverse_gc;            /* Reverse video */
  110.   GC cursor_gc;                /* cursor drawing */
  111. #ifdef LINE_INFO_COLUMN
  112.   GC line_info_gc;            /* lineinfo column */
  113. #endif
  114.  
  115.   /* Width of the internal border.  This is a line of background color
  116.      just inside the window's border.  When the screen is selected,
  117.      a highlighting is displayed inside the internal border.  */
  118.  
  119.   int internal_border_width;
  120.  
  121. #ifdef LINE_INFO_COLUMN
  122.   /* Width of the line info column.  The line info column appears to
  123.      the left of the left margin, inside the internal border.  It is
  124.      used to display glyphs related to each line. */
  125.   int line_info_column_width;
  126.   int default_line_info_column_width;
  127.  
  128.   PIX_TYPE line_info_background_pixel;
  129. #endif
  130.  
  131. /*  FONT_TYPE *font; */
  132.   int text_height;
  133.  
  134.   /* Flag to set when the X window needs to be completely repainted. */
  135.   int needs_exposure;
  136.  
  137.   /* The widget of this screen.  This is the window of a "shell" widget. */
  138.   Widget widget;
  139.   /* The XmPanedWindows... */
  140.   Widget column_widget;
  141. #ifdef LINE_INFO_WIDGET
  142.   Widget row_widget;
  143.   /* The widget of the line-info widget */
  144.   Widget lineinfo_widget;
  145. #endif
  146.   /* The widget of the edit portion of this screen; the window in
  147.      "window_desc" is inside of this. */
  148.   Widget edit_widget;
  149.  
  150.   Widget menubar_widget;
  151.  
  152. #ifdef ENERGIZE
  153.   /* The Energize property-sheets.  The current_ slots are the ones which are
  154.      actually on the screen.  The desired_ slots are the ones which should
  155.      be there.  Redisplay synchs these.
  156.    */
  157.   int *current_psheets;
  158.   int *desired_psheets;
  159.   int current_psheet_count;
  160.   int desired_psheet_count;
  161.   Lisp_Object current_psheet_buffer;
  162.   Lisp_Object desired_psheet_buffer;
  163. #endif
  164.  
  165.   /* This is true if we own the window, that is, it is not a window that
  166.      was created by another process.  If we don't own the window, we aren't
  167.      allowed to destroy it. "The window" referred to is always window_desc;
  168.      if USE_WIDGET is true, we always own the window inside of the
  169.      edit_widget. */
  170.   char own_window;
  171.  
  172.   /* Whether this screen has the keyboard focus locked on it, whether the
  173.      mouse is in this screen, and whether this is the screen currently
  174.      receiving keyboard input.  In point-to-type mode, focus_p will never
  175.      be true, and mouse_p and input_p will be the same.  In click-to-type
  176.      mode, input_p will be the same as focus_p, and mouse_p will vary.
  177.      Generally, input_p is the only interesting value, but the other two
  178.      are necessary state to correctly interpret the interactions between
  179.      FocusIn, FocusOut, EnterNotify, and LeaveNotify events.
  180.      
  181.      These must be per-screen properties instead of global variables,
  182.      because screens are not necessarily on the same monitor, so more than
  183.      one can have a mouse, and more than one can have keyboard focus.
  184.    */
  185.   char focus_p;
  186. /*  char mouse_p; */
  187. /*  char input_p; */
  188.   
  189.   /* 1 if the screen is completely visible on the display, 0 otherwise.
  190.      if 0 the screen may have been iconified or may be totally
  191.      or parrtially hidden by another X window */
  192.   char totally_visible_p;
  193. };
  194.  
  195. /* Number of pixels below each line. */
  196. extern int x_interline_space;
  197.  
  198. #endif /* _EMACS_XTERM_H_ */
  199.