]> code.delx.au - gnu-emacs/blobdiff - src/xterm.h
(x_top_window_to_frame): Declare this function.
[gnu-emacs] / src / xterm.h
index 05bae039844d27247624fa1ceb1afdf90e82ac2c..ae126a099f92bc1cd1221ab5217e1b81f0a65f81 100644 (file)
@@ -28,6 +28,15 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <X/Xlib.h>
 #endif /* HAVE_X11 */
 
+#ifdef USE_X_TOOLKIT
+#include <X11/StringDefs.h>
+#include <X11/IntrinsicP.h>    /* CoreP.h needs this */
+#include <X11/CoreP.h>         /* foul, but we need this to use our own
+                                  window inside a widget instead of one 
+                                  that Xt creates... */
+#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.  */
 
@@ -64,12 +73,21 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
    with X11R3 or X11R4 by looking for the flag macros for R4 structure
    members that R3 doesn't have.  */
 #ifdef PBaseSize
+/* AIX 3.1's X is somewhere between X11R3 and X11R4.  It has
+   PBaseSize, but not XWithdrawWindow, XSetWMName, XSetWMNormalHints,
+   XSetWMIconName.  
+   AIX 3.2 is at least X11R4.  */
+#if (!defined AIX) || (defined AIX3_2)
 #define HAVE_X11R4
 #endif
+#endif
 
 #ifdef XlibSpecificationRelease
 #if XlibSpecificationRelease >= 5
 #define HAVE_X11R5
+/* In case someone has X11R5 on AIX 3.1,
+   make sure HAVE_X11R4 is defined as well as HAVE_X11R5.  */
+#define HAVE_X11R4
 #endif
 #endif
 
@@ -88,8 +106,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define Color XColor
 
 #define XExposeRegionEvent XExposeEvent
-#define Bitmap Pixmap                  /* In X11, Bitmaps are are kind of
-                                          Pixmap. */
+#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))
@@ -171,45 +189,24 @@ struct event_queue
 /* Queue for mouse clicks.  */
 extern struct event_queue x_mouse_queue;
 
-/* Mechanism for interlocking between main program level
-   and input interrupt level.  */
-
-/* Nonzero during a critical section.  At such a time, an input interrupt
-   does nothing but set `x_pending_input'.  */
-extern int x_input_blocked;
-
-/* Nonzero means an input interrupt has arrived
-   during the current critical section.  */
-extern int x_pending_input;
-
-/* Begin critical section. */
-#define BLOCK_INPUT (x_input_blocked++)
-
-/* End critical section. */
-#ifdef SIGIO
-/* If doing interrupt input, and an interrupt came in when input was blocked,
-   reinvoke the interrupt handler now to deal with it.  */
-#define UNBLOCK_INPUT \
-  ((x_input_blocked--, (x_input_blocked < 0 ? (abort (), 0) : 0)),     \
-   (x_input_blocked == 0 && x_pending_input != 0 ? (kill (0, SIGIO), 0) : 0))
-#else
-#define UNBLOCK_INPUT \
-  (x_input_blocked--, (x_input_blocked < 0 ? (abort (), 0) : 0))
-#endif
-
-#define TOTALLY_UNBLOCK_INPUT (x_input_blocked = 0)
-#define UNBLOCK_INPUT_RESIGNAL UNBLOCK_INPUT
-
 /* 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 ();
+
 extern struct frame *x_window_to_frame ();
 
+#ifdef USE_X_TOOLKIT
+extern struct frame *x_any_window_to_frame ();
+extern struct frame *x_top_window_to_frame ();
+#endif
+
 /* The frame (if any) which has the X window that has keyboard focus.
    Zero if none.  This is examined by Ffocus_frame in xfns.c */
 
-struct frame *x_focus_frame;
+extern struct frame *x_focus_frame;
 
 #ifdef HAVE_X11
 /* Variables associated with the X display screen this emacs is using. */
@@ -269,6 +266,9 @@ struct x_display
   /* Size of the X window in pixels. */
   int pixel_height, pixel_width;
 
+  /* Height of a line, in pixels.  */
+  int line_height;
+
 #ifdef HAVE_X11
   /* The tiled border used when the mouse is out of the frame. */
   Pixmap border_tile;
@@ -297,6 +297,18 @@ struct x_display
      Usually but not always RootWindow.  */
   Window parent_desc;
 
+#ifdef USE_X_TOOLKIT
+  /* The widget of this screen.  This is the window of a "shell" widget.  */
+  Widget widget;
+  /* The XmPanedWindows...  */
+  Widget column_widget;
+  /* The widget of the edit portion of this screen; the window in
+     "window_desc" is inside of this.  */
+  Widget edit_widget;
+
+  Widget menubar_widget;
+#endif
+
   /* 1 for bitmap icon, 0 for text icon.  */
   int icon_bitmap_flag;
 
@@ -309,12 +321,14 @@ struct x_display
   PIX_TYPE cursor_pixel;
   PIX_TYPE border_pixel;
   PIX_TYPE mouse_pixel;
+  PIX_TYPE cursor_foreground_pixel;
 
   /* Descriptor for the cursor in use for this window.  */
 #ifdef HAVE_X11
   Cursor text_cursor;
   Cursor nontext_cursor;
   Cursor modeline_cursor;
+  Cursor cross_cursor;
 #else
   Cursor cursor;
 #endif
@@ -351,8 +365,38 @@ struct x_display
   /* The size of the extra width currently allotted for vertical
      scroll bars, in pixels.  */
   int vertical_scroll_bar_extra;
+
+  /* Table of parameter faces for this frame.  Any X resources (pixel
+     values, fonts) referred to here have been allocated explicitly
+     for this face, and should be freed if we change the face.  */
+  struct face **param_faces;
+  int n_param_faces;
+
+  /* Table of computed faces for this frame.  These are the faces
+     whose indexes go into the upper bits of a glyph, computed by
+     combining the parameter faces specified by overlays, text
+     properties, and what have you.  The X resources mentioned here
+     are all shared with parameter faces.  */
+  struct face **computed_faces;
+  int n_computed_faces;                /* How many are valid */
+  int size_computed_faces;     /* How many are allocated */
+
+  /* This is the gravity value for the specified window position.  */
+  int win_gravity;
 };
 
+/* Get at the computed faces of an X window frame.  */
+#define FRAME_PARAM_FACES(f) ((f)->display.x->param_faces)
+#define FRAME_N_PARAM_FACES(f) ((f)->display.x->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) ((f)->display.x->computed_faces)
+#define FRAME_N_COMPUTED_FACES(f) ((f)->display.x->n_computed_faces)
+#define FRAME_SIZE_COMPUTED_FACES(f) ((f)->display.x->size_computed_faces)
+#define FRAME_DEFAULT_FACE(f) ((f)->display.x->computed_faces[0])
+#define FRAME_MODE_LINE_FACE(f) ((f)->display.x->computed_faces[1])
+
 /* Return the window associated with the frame F.  */
 #define FRAME_X_WINDOW(f) ((f)->display.x->window_desc)
 
@@ -363,13 +407,13 @@ struct x_display
 #define FRAME_DESIRED_CURSOR(f) ((f)->display.x->desired_cursor)
 
 \f
-/* When X windows are used, a glyf may be a 16 bit unsigned datum.
+/* 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 glyf gives
+   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. */
 
@@ -474,7 +518,7 @@ struct scroll_bar {
 /* Return the outside pixel height for a vertical scroll bar HEIGHT
    rows high on frame F.  */
 #define VERTICAL_SCROLL_BAR_PIXEL_HEIGHT(f, height) \
-  ((height) * FONT_HEIGHT ((f)->display.x->font))
+  ((height) * (f)->display.x->line_height)
 
 /* Return the inside width of a vertical scroll bar, given the outside
    width.  */
@@ -505,11 +549,11 @@ struct scroll_bar {
    (used when relating to the rest of the screen) and inside width
    (used when sizing and drawing the scroll bar window itself).
 
-   The handle moves up and down/back and forth in a rectange inset
+   The handle moves up and down/back and forth in a rectangle inset
    from the edges of the scroll bar.  These are widths by which we
    inset the handle boundaries from the scroll bar edges.  */
 #define VERTICAL_SCROLL_BAR_LEFT_BORDER (2)
-#define VERTICAL_SCROLL_BAR_RIGHT_BORDER (3)
+#define VERTICAL_SCROLL_BAR_RIGHT_BORDER (2)
 #define VERTICAL_SCROLL_BAR_TOP_BORDER (2)
 #define VERTICAL_SCROLL_BAR_BOTTOM_BORDER (2)
 
@@ -525,7 +569,7 @@ struct scroll_bar {
    at ROW/COL.  */
 #define CHAR_TO_PIXEL_ROW(f, row) \
   ((f)->display.x->internal_border_width \
-   + (row) * FONT_HEIGHT ((f)->display.x->font))
+   + (row) * (f)->display.x->line_height)
 #define CHAR_TO_PIXEL_COL(f, col) \
   ((f)->display.x->internal_border_width \
    + (col) * FONT_WIDTH ((f)->display.x->font))
@@ -543,10 +587,10 @@ struct scroll_bar {
 
 /* Return the row/column (zero-based) of the character cell containing 
    the pixel on FRAME at ROW/COL.  */
-#define PIXEL_TO_CHAR_ROW(frame, row) \
+#define PIXEL_TO_CHAR_ROW(f, row) \
   (((row) - (f)->display.x->internal_border_width) \
-   / FONT_HEIGHT ((f)->display.x->font))
-#define PIXEL_TO_CHAR_COL(frame, col) \
+   / (f)->display.x->line_height)
+#define PIXEL_TO_CHAR_COL(f, col) \
   (((col) - (f)->display.x->internal_border_width) \
    / FONT_WIDTH ((f)->display.x->font))
 
@@ -587,3 +631,47 @@ struct selection_input_event
   (((struct selection_input_event *) (eventp))->property)
 #define SELECTION_EVENT_TIME(eventp)   \
   (((struct selection_input_event *) (eventp))->time)
+
+\f
+/* Interface to the face code functions.  */
+
+/* Create the first two computed faces for a frame -- the ones that
+   have GC's.  */
+extern void init_frame_faces (/* FRAME_PTR */);
+
+/* Free the resources for the faces associated with a frame.  */
+extern void free_frame_faces (/* FRAME_PTR */);
+
+/* Given a computed face, find or make an equivalent display face
+   in face_vector, and return a pointer to it.  */
+extern struct face *intern_face (/* FRAME_PTR, struct face * */);
+
+/* Given a frame and a face name, return the face's ID number, or
+   zero if it isn't a recognized face name.  */
+extern int face_name_id_number (/* FRAME_PTR, Lisp_Object */);
+
+/* Return non-zero if FONT1 and FONT2 have the same size bounding box.
+   We assume that they're both character-cell fonts.  */
+extern int same_size_fonts (/* XFontStruct *, XFontStruct * */);
+
+/* Recompute the GC's for the default and modeline faces.
+   We call this after changing frame parameters on which those GC's
+   depend.  */
+extern void recompute_basic_faces (/* FRAME_PTR */);
+
+/* Return the face ID associated with a buffer position POS.  Store
+   into *ENDPTR the next position at which a different face is
+   needed.  This does not take account of glyphs that specify their
+   own face codes.  F is the frame in use for display, and W is a
+   window displaying the current buffer.
+
+   REGION_BEG, REGION_END delimit the region, so it can be highlighted.  */
+extern int compute_char_face (/* FRAME_PTR frame,
+                                struct window *w,
+                                int pos,
+                                int region_beg, int region_end,
+                                int *endptr */);
+/* Return the face ID to use to display a special glyph which selects
+   FACE_CODE as the face ID, assuming that ordinarily the face would
+   be BASIC_FACE.  F is the frame.  */
+extern int compute_glyph_face (/* FRAME_PTR, int */);