(read_char): When an event from unread-command-events
[bpt/emacs.git] / src / xterm.h
index 81d1a7c..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.
 
@@ -106,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,
@@ -350,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;
 
@@ -367,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
@@ -480,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.  */
@@ -683,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;
@@ -699,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;
@@ -753,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
@@ -911,6 +924,7 @@ 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.  */
 
@@ -963,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));
@@ -976,6 +991,9 @@ 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 */
 
@@ -1002,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 *));