(read_char): When an event from unread-command-events
[bpt/emacs.git] / src / xterm.h
index c93ba8f..a1f0e38 100644 (file)
@@ -1,5 +1,6 @@
 /* Definitions and headers for communication with X protocol.
-   Copyright (C) 1989, 1993, 1994, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1989, 1993, 1994, 1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -77,8 +78,7 @@ Boston, MA 02111-1307, USA.  */
 #define HAVE_X11R4
 #endif
 
-#ifdef HAVE_X11R5
-#define HAVE_X_I18N
+#ifdef HAVE_X_I18N
 #include <X11/Xlocale.h>
 #endif
 \f
@@ -107,17 +107,6 @@ Boston, MA 02111-1307, USA.  */
    | EnterWindowMask           \
    | VisibilityChangeMask)
 
-/* 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_non_menubar_window_to_frame ();
-extern struct frame *x_top_window_to_frame ();
-#endif
-
 enum text_cursor_kinds
 {
   NO_CURSOR = -1,
@@ -351,8 +340,24 @@ struct x_display_info
   XIM xim;
   XIMStyles *xim_styles;
 #endif
+
+  /* If non-null, a cache of the colors in the color map.  Don't
+     use this directly, call x_color_cells instead.  */
+  XColor *color_cells;
+  int ncolor_cells;
 };
 
+/* This checks to make sure we have a display.  */
+extern void check_x P_ ((void));
+
+extern struct frame *x_window_to_frame P_ ((struct x_display_info *, int));
+
+#ifdef USE_X_TOOLKIT
+extern struct frame *x_any_window_to_frame P_ ((struct x_display_info *, int));
+extern struct frame *x_non_menubar_window_to_frame P_ ((struct x_display_info *, int));
+extern struct frame *x_top_window_to_frame P_ ((struct x_display_info *, int));
+#endif
+
 /* This is a chain of structures for all the X displays currently in use.  */
 extern struct x_display_info *x_display_list;
 
@@ -368,15 +373,17 @@ extern Lisp_Object Vx_pixel_size_width_font_regexp;
 /* A flag to control how to display unibyte 8-bit character.  */
 extern int unibyte_display_via_language_environment;
 
-struct x_display_info *x_display_info_for_display P_ ((Display *));
-struct x_display_info *x_display_info_for_name ();
+extern struct x_display_info *x_display_info_for_display P_ ((Display *));
+extern struct x_display_info *x_display_info_for_name P_ ((Lisp_Object));
 
-extern struct x_display_info *x_term_init ();
+extern struct x_display_info *x_term_init P_ ((Lisp_Object, char *, char *));
 
 extern Lisp_Object x_list_fonts P_ ((struct frame *, Lisp_Object, int, int));
 extern void select_visual P_ ((struct x_display_info *));
-extern struct font_info *x_get_font_info(), *x_load_font (), *x_query_font ();
-extern void x_find_ccl_program();
+extern struct font_info *x_get_font_info P_ ((struct frame *f, int));
+extern struct font_info *x_load_font P_ ((struct frame *, char *, int));
+extern struct font_info *x_query_font P_ ((struct frame *, char *));
+extern void x_find_ccl_program P_ ((struct font_info *));
 \f
 /* Each X frame object points to its own struct x_output object
    in the output_data.x field.  The x_output structure contains
@@ -481,6 +488,7 @@ struct x_output
   Cursor modeline_cursor;
   Cursor cross_cursor;
   Cursor busy_cursor;
+  Cursor horizontal_drag_cursor;
 
   /* Window whose cursor is busy_cursor.  This window is temporarily
      mapped to display a busy-cursor.  */
@@ -684,8 +692,8 @@ struct x_output
    We use struct scroll_bar as a template for accessing fields of the
    vector.  */
 
-struct scroll_bar {
-
+struct scroll_bar
+{
   /* These fields are shared by all vectors.  */
   EMACS_INT size_from_Lisp_Vector_struct;
   struct Lisp_Vector *next_from_Lisp_Vector_struct;
@@ -700,9 +708,6 @@ struct scroll_bar {
      32-bit quantity, we store it split into two 32-bit values.  */
   Lisp_Object x_window_low, x_window_high;
 
-  /* Same as above for the widget.  */
-  Lisp_Object x_widget_low, x_widget_high;
-
   /* The position and size of the scroll bar in pixels, relative to the
      frame.  */
   Lisp_Object top, left, width, height;
@@ -754,13 +759,20 @@ struct scroll_bar {
 #define SET_SCROLL_BAR_X_WINDOW(ptr, id) \
   (SCROLL_BAR_UNPACK ((ptr)->x_window_low, (ptr)->x_window_high, (int) id))
 
-/* Extract the X widget of the scroll bar from a struct scroll_bar.  */
-#define SCROLL_BAR_X_WIDGET(ptr) \
-  ((Widget) SCROLL_BAR_PACK ((ptr)->x_widget_low, (ptr)->x_widget_high))
+/* Extract the X widget of the scroll bar from a struct scroll_bar.
+   XtWindowToWidget should be fast enough since Xt uses a hash table
+   to map windows to widgets.  */
+
+#define SCROLL_BAR_X_WIDGET(dpy, ptr) \
+  XtWindowToWidget (dpy, SCROLL_BAR_X_WINDOW (ptr))
 
 /* Store a widget id in a struct scroll_bar.  */
-#define SET_SCROLL_BAR_X_WIDGET(ptr, w) \
-  (SCROLL_BAR_UNPACK ((ptr)->x_widget_low, (ptr)->x_widget_high, (int) w))
+
+#define SET_SCROLL_BAR_X_WIDGET(ptr, w)                \
+  do {                                         \
+    Window window = XtWindow (w);              \
+    SET_SCROLL_BAR_X_WINDOW (ptr, window);     \
+} while (0)
 
 
 /* Return the inside width of a vertical scroll bar, given the outside
@@ -895,6 +907,8 @@ struct window;
 struct glyph_matrix;
 struct frame;
 struct input_event;
+struct face;
+struct image;
 
 /* From xselect.c.  */
 
@@ -903,24 +917,14 @@ void x_handle_property_notify P_ ((XPropertyEvent *));
 
 /* From xfns.c.  */
 
-void x_real_positions P_ ((struct frame *, int *, int *));
-void x_destroy_bitmap P_ ((struct frame *, int));
-int x_create_bitmap_from_file P_ ((struct frame *, Lisp_Object));
-int x_create_bitmap_from_data P_ ((struct frame *, char *, unsigned,
-                                  unsigned));
-void x_reference_bitmap P_ ((struct frame *, int));
-void x_sync P_ ((struct frame *));
-int x_bitmap_pixmap P_ ((struct frame *, int));
-void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
-int x_bitmap_height P_ ((struct frame *, int));
-int x_bitmap_width P_ ((struct frame *, int));
-int defined_color P_ ((struct frame *, char *, XColor *, int));
 Lisp_Object display_x_get_resource P_ ((struct x_display_info *,
                                        Lisp_Object, Lisp_Object,
                                        Lisp_Object, Lisp_Object));
 struct frame *check_x_frame P_ ((Lisp_Object));
 EXFUN (Fx_display_color_p, 1);
 EXFUN (Fx_display_grayscale_p, 1);
+int image_ascent P_ ((struct image *, struct face *));
+extern void x_free_gcs P_ ((struct frame *));
 
 /* From xrdb.c.  */
 
@@ -973,6 +977,7 @@ extern void x_lower_frame P_ ((struct frame *));
 extern void x_make_frame_visible P_ ((struct frame *));
 extern void x_make_frame_invisible P_ ((struct frame *));
 extern void x_iconify_frame P_ ((struct frame *));
+extern void x_free_frame_resources P_ ((struct frame *));
 extern void x_destroy_window P_ ((struct frame *));
 extern void x_wm_set_size_hint P_ ((struct frame *, long, int));
 extern void x_wm_set_window_state P_ ((struct frame *, int));
@@ -980,8 +985,15 @@ extern void x_wm_set_icon_pixmap P_ ((struct frame *, int));
 extern void x_wm_set_icon_position P_ ((struct frame *, int, int));
 extern void x_delete_display P_ ((struct x_display_info *));
 extern void x_initialize P_ ((void));
-void x_display_cursor P_ ((struct window *, int, int, int, int, int));
-void x_update_cursor P_ ((struct frame *, int));
+extern void x_display_cursor P_ ((struct window *, int, int, int, int, int));
+extern void x_update_cursor P_ ((struct frame *, int));
+extern unsigned long x_copy_color P_ ((struct frame *, unsigned long));
+#ifdef USE_X_TOOLKIT
+extern XtAppContext Xt_app_con;
+#endif
+extern void x_query_colors P_ ((struct frame *f, XColor *, int));
+extern void x_query_color P_ ((struct frame *f, XColor *));
+extern void x_clear_area P_ ((Display *, Window, int, int, int, int, int));
 
 /* Defined in xselect.c */
 
@@ -1008,6 +1020,8 @@ extern void x_report_frame_params P_ ((struct frame *, Lisp_Object *));
 extern int defined_color P_ ((struct frame *, char *, XColor *, int));
 extern void x_set_border_pixel P_ ((struct frame *, int));
 extern void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
+extern unsigned char * x_encode_text P_ ((Lisp_Object, Lisp_Object,
+                                         int *, int *));
 extern void x_implicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
 extern void create_frame_xic P_ ((struct frame *));
 extern void destroy_frame_xic P_ ((struct frame *));
@@ -1020,6 +1034,12 @@ extern int x_char_width P_ ((struct frame *));
 extern int x_char_height P_ ((struct frame *));
 extern int x_screen_planes P_ ((struct frame *));
 extern void x_sync P_ ((struct frame *));
+extern enum text_cursor_kinds x_specified_cursor_type P_ ((Lisp_Object, int *));
+extern int x_defined_color P_ ((struct frame *, char *, XColor *, int));
+#ifdef HAVE_X_I18N
+extern void free_frame_xic P_ ((struct frame *));
+#endif
+extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
 
 /* Defined in xfaces.c */