Give subprocess creation a way to find a valid current directory
[bpt/emacs.git] / src / xterm.h
index dd367cf..8098216 100644 (file)
@@ -33,8 +33,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #define EVENT_BUFFER_SIZE 64
 
-#define RES_CLASS "emacs"
-
 /* Max and Min sizes in character columns. */
 #define MINWIDTH 10
 #define MINHEIGHT 10
@@ -42,6 +40,33 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define MAXHEIGHT 80
 
 #ifdef HAVE_X11
+
+/* 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
+   X11R4.  If, in the future, we find we need more of these flags
+   (HAVE_X11R5, for example), code should always be written to test
+   the most recent flag first:
+
+      #ifdef HAVE_X11R5
+        ...
+      #elif HAVE_X11R4
+        ...
+      #elif HAVE_X11
+        ...
+      #endif
+
+   If you ever find yourself writing a "#ifdef HAVE_FOO" clause that
+   looks a lot like another one, consider moving the text into a macro
+   whose definition is configuration-dependent, but whose usage is
+   universal - like the stuff in systime.h.
+
+   It turns out that we can auto-detect whether we're being compiled
+   with X11R3 or X11R4 by looking for the flag macros for R4 structure
+   members that R3 doesn't have.  */
+#ifdef PBaseSize
+#define HAVE_X11R4
+#endif
+
 #define PIX_TYPE unsigned long
 #define XDISPLAY x_current_display,
 #define XFlushQueue() XFlush(x_current_display)
@@ -52,7 +77,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #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, XDefaultScreen (x_current_display))
+#define ROOT_WINDOW RootWindow (x_current_display, DefaultScreen (x_current_display))
 #define FONT_TYPE XFontStruct
 #define Color XColor
 
@@ -77,19 +102,22 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define FONT_HEIGHT(f) ((f)->ascent + (f)->descent)
 #define FONT_BASE(f)    ((f)->ascent)
 
-/* GC values used for drawing non-standard (other face) text. */
-extern XGCValues face_gc_values;                                     
-
 /* The mask of events that text windows always want to receive.  This
-   does not include mouse movement events or button release 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).
-   */
+   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).
+
+   We do include ButtonReleases in this set because elisp 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.  */
 
 #define STANDARD_EVENT_SET      \
   (KeyPressMask                        \
    | ExposureMask              \
    | ButtonPressMask           \
+   | ButtonReleaseMask         \
+   | PointerMotionMask         \
+   | PointerMotionHintMask     \
    | StructureNotifyMask       \
    | FocusChangeMask           \
    | LeaveWindowMask           \
@@ -148,15 +176,12 @@ extern int x_input_blocked;
    during the current critical section.  */
 extern int x_pending_input;
 
-#ifndef sigmask
-#define sigmask(no) (1L << ((no) - 1))
-#endif
-
 /* Begin critical section. */
 #define BLOCK_INPUT (x_input_blocked++)
 
 /* End critical section. */
-#define UNBLOCK_INPUT (x_input_blocked--, (x_input_blocked < 0 ? abort () : 0))
+#define UNBLOCK_INPUT \
+  (x_input_blocked--, (x_input_blocked < 0 ? (abort (), 0) : 0))
 
 #define TOTALLY_UNBLOCK_INPUT (x_input_blocked = 0)
 #define UNBLOCK_INPUT_RESIGNAL UNBLOCK_INPUT
@@ -165,45 +190,45 @@ extern int x_pending_input;
 
 extern Display *x_current_display;
 
-extern struct screen *x_window_to_screen ();
+extern struct frame *x_window_to_frame ();
 
-/* The screen (if any) which has the X window that has keyboard focus.
-   Zero if none.  This is examined by Ffocus_screen in xfns.c */
+/* 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 screen *x_focus_screen;
+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 Lisp_Object x_screen_count;
+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 Lisp_Object x_release;
+extern int x_release;
 
 /* Height of this X screen in pixels. */
-extern Lisp_Object x_screen_height;
+extern int x_screen_height;
 
 /* Height of this X screen in millimeters. */
-extern Lisp_Object x_screen_height_mm;
+extern int x_screen_height_mm;
 
 /* Width of this X screen in pixels. */
-extern Lisp_Object x_screen_width;
+extern int x_screen_width;
 
 /* Width of this X screen in millimeters. */
-extern Lisp_Object x_screen_width_mm;
+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 Lisp_Object x_save_under;
+extern int x_save_under;
 
 /* Number of planes for this screen. */
-extern Lisp_Object x_screen_planes;
+extern int x_screen_planes;
 
 /* X Visual type of this screen. */
 extern Lisp_Object Vx_screen_visual;
@@ -217,7 +242,7 @@ enum text_cursor_kinds {
 #define PIXEL_WIDTH(s) ((s)->display.x->pixel_width)
 #define PIXEL_HEIGHT(s) ((s)->display.x->pixel_height)
 
-/* Each X screen object points to its own struct x_display object
+/* Each X frame object points to its own struct x_display object
    in the display.x field.  The x_display structure contains all
    the information that is specific to X windows.  */
 
@@ -234,7 +259,7 @@ struct x_display
   int pixel_height, pixel_width;
 
 #ifdef HAVE_X11
-  /* The tiled border used when the mouse is out of the screen. */
+  /* The tiled border used when the mouse is out of the frame. */
   Pixmap border_tile;
 
   /* Here are the Graphics Contexts for the default font. */
@@ -244,12 +269,12 @@ struct x_display
 #endif /* HAVE_X11 */
 
   /* Width of the internal border.  This is a line of background color
-     just inside the window's border.  When the screen is selected,
+     just inside the window's border.  When the frame is selected,
      a highlighting is displayed inside the internal border.  */
   int internal_border_width;
 
-  /* The X window used for this screen.
-     May be zero while the screen object is being created
+  /* The X window used for this frame.
+     May be zero while the frame object is being created
      and the X window has not yet been created.  */
   Window window_desc;
 
@@ -301,7 +326,7 @@ struct x_display
 
   /* The name that was associated with the icon, the last time
      it was refreshed.  Usually the same as the name of the
-     buffer in the currently selected window in the screen */
+     buffer in the currently selected window in the frame */
   char *icon_label;
 
   /* Flag to set when the X window needs to be completely repainted. */
@@ -310,7 +335,24 @@ struct x_display
   /* What kind of text cursor is drawn in this window right now?  (If
      there is no cursor (phys_cursor_x < 0), then this means nothing.  */
   enum text_cursor_kinds text_cursor_kind;
+
+  /* These are the current window manager hints.  It seems that
+     XSetWMHints, when presented with an unset bit in the `flags'
+     member of the hints structure, does not leave the corresponding
+     attribute unchanged; rather, it resets that attribute to its
+     default value.  For example, unless you set the `icon_pixmap'
+     field and the `IconPixmapHint' bit, XSetWMHints will forget what
+     your icon pixmap was.  This is rather troublesome, since some of
+     the members (for example, `input' and `icon_pixmap') want to stay
+     the same throughout the execution of Emacs.  So, we keep this
+     structure around, just leaving values in it and adding new bits
+     to the mask as we go.  */
+  XWMHints wm_hints;
 };
+
+/* Return the window associated with the frame F.  */
+#define FRAME_X_WINDOW(f) ((f)->display.x->window_desc)
+
 \f
 /* When X windows are used, a glyf may be a 16 bit unsigned datum.
    The high order byte is the face number and is used as an index
@@ -323,20 +365,8 @@ struct x_display
    fixed width, and to have the same height and width. */
 
 #ifdef HAVE_X11
-/* Table of GC's used for this screen. */
-GC *gc_table;
-
-/* How many GCs are in the table. */
-int gcs_in_use;
 
-struct face
-{
-  GC face_gc;
-  unsigned int foreground;
-  unsigned int background;
-  Pixmap stipple;
-  XFontStruct *font;
-};
+/* Face declared in dispextern.h */
 
 #else  /* X10 */