Merge from trunk.
[bpt/emacs.git] / src / termhooks.h
index a24b305..9cea0c1 100644 (file)
@@ -18,21 +18,17 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-\f
+#ifndef EMACS_TERMHOOKS_H
+#define EMACS_TERMHOOKS_H
+
 /* Miscellanea.   */
 
 #include "systime.h" /* for Time */
 
 INLINE_HEADER_BEGIN
-#ifndef TERMHOOKS_INLINE
-# define TERMHOOKS_INLINE INLINE
-#endif
-
-struct glyph;
-struct frame;
-\f
 
 enum scroll_bar_part {
+  scroll_bar_nowhere = -1,
   scroll_bar_above_handle,
   scroll_bar_handle,
   scroll_bar_below_handle,
@@ -44,12 +40,18 @@ enum scroll_bar_part {
   scroll_bar_move_ratio
 };
 
-/* If the value of the frame parameter changed, whis hook is called.
-   For example, if going from fullscreen to not fullscreen this hook
-   may do something OS dependent, like extended window manager hints on X11.  */
-extern void (*fullscreen_hook) (struct frame *f);
+/* Output method of a terminal (and frames on this terminal, respectively).  */
+
+enum output_method
+{
+  output_initial,
+  output_termcap,
+  output_x_window,
+  output_msdos_raw,
+  output_w32,
+  output_ns
+};
 
-\f
 /* Input queue declarations and hooks.  */
 
 enum event_kind
@@ -172,6 +174,8 @@ enum event_kind
      `switch-frame' events in kbd_buffer_get_event, if necessary.  */
   FOCUS_IN_EVENT,
 
+  FOCUS_OUT_EVENT,
+
   /* Generated when mouse moves over window not currently selected.  */
   SELECT_WINDOW_EVENT,
 
@@ -212,6 +216,11 @@ enum event_kind
   , NS_NONKEY_EVENT
 #endif
 
+#ifdef USE_FILE_NOTIFY
+  /* File or directory was changed.  */
+  , FILE_NOTIFY_EVENT
+#endif
+
 };
 
 /* If a struct input_event has a kind which is SELECTION_REQUEST_EVENT
@@ -243,16 +252,8 @@ struct input_event
   Lisp_Object x, y;
   Time timestamp;
 
-  /* This is padding just to put the frame_or_window field
-     past the size of struct selection_input_event.  */
-  int *padding[2];
-
-  /* This field is copied into a vector while the event is in the queue,
-     so that garbage collections won't kill it.  */
-  /* In a menu_bar_event, this is a cons cell whose car is the frame
-     and whose cdr is the Lisp object that is the event's value.  */
-  /* This field is last so that struct selection_input_event
-     does not overlap with it.  */
+  /* This field is copied into a vector while the event is in
+     the queue, so that garbage collections won't kill it.  */
   Lisp_Object frame_or_window;
 
   /* Additional event argument.  This is used for TOOL_BAR_EVENTs and
@@ -322,11 +323,6 @@ extern void term_mouse_moveto (int, int);
 extern struct tty_display_info *gpm_tty;
 #endif
 
-\f
-struct ns_display_info;
-struct x_display_info;
-struct w32_display_info;
-
 /* Terminal-local parameters. */
 struct terminal
 {
@@ -385,7 +381,7 @@ struct terminal
   struct image_cache *image_cache;
 #endif /* HAVE_WINDOW_SYSTEM */
 
-  /* Device-type dependent data shared amongst all frames on this terminal. */
+  /* Device-type dependent data shared amongst all frames on this terminal.  */
   union display_info
   {
     struct tty_display_info *tty;     /* termchar.h */
@@ -406,31 +402,23 @@ struct terminal
      the function `set-keyboard-coding-system'.  */
   struct coding_system *keyboard_coding;
 
-  /* Terminal characteristics. */
-  /* XXX Are these really used on non-termcap displays? */
+  /* Terminal characteristics.  */
+  /* XXX Are these really used on non-termcap displays?  */
 
   int must_write_spaces;       /* Nonzero means spaces in the text must
                                   actually be output; can't just skip over
                                   some columns to leave them blank.  */
-  int fast_clear_end_of_line;   /* Nonzero means terminal has a `ce' string */
+  int fast_clear_end_of_line;   /* Nonzero means terminal has a `ce' string */
 
-  int line_ins_del_ok;          /* Terminal can insert and delete lines */
-  int char_ins_del_ok;          /* Terminal can insert and delete chars */
+  int line_ins_del_ok;          /* Terminal can insert and delete lines */
+  int char_ins_del_ok;          /* Terminal can insert and delete chars */
   int scroll_region_ok;         /* Terminal supports setting the scroll
-                                   window */
+                                   window */
   int scroll_region_cost;      /* Cost of setting the scroll window,
-                                   measured in characters. */
+                                   measured in characters.  */
   int memory_below_frame;      /* Terminal remembers lines scrolled
-                                   off bottom */
+                                   off bottom */
 
-#if 0  /* These are not used anywhere. */
-  /* EMACS_INT baud_rate; */   /* Output speed in baud */
-  int min_padding_speed;       /* Speed below which no padding necessary. */
-  int dont_calculate_costs;     /* Nonzero means don't bother computing
-                                   various cost tables; we won't use them. */
-#endif
-
-\f
   /* Window-based redisplay interface for this device (0 for tty
      devices). */
   struct redisplay_interface *rif;
@@ -478,10 +466,7 @@ struct terminal
      Otherwise, set *bar_window to Qnil, and *x and *y to the column and
      row of the character cell the mouse is over.
 
-     Set *time to the time the mouse was at the returned position.
-
-     This should clear mouse_moved until the next motion
-     event arrives.  */
+     Set *time to the time the mouse was at the returned position.  */
   void (*mouse_position_hook) (struct frame **f, int,
                                Lisp_Object *bar_window,
                                enum scroll_bar_part *part,
@@ -489,11 +474,6 @@ struct terminal
                                Lisp_Object *y,
                                Time *);
 
-  /* The window system handling code should set this if the mouse has
-     moved since the last call to the mouse_position_hook.  Calling that
-     hook should clear this.  */
-  int mouse_moved;
-
   /* When a frame's focus redirection is changed, this hook tells the
      window system code to re-decide where to put the highlight.  Under
      X, this means that Emacs lies about where the focus is.  */
@@ -511,7 +491,7 @@ struct terminal
      windows.  */
   void (*frame_raise_lower_hook) (struct frame *f, int raise_flag);
 
-  /* If the value of the frame parameter changed, whis hook is called.
+  /* If the value of the frame parameter changed, this hook is called.
      For example, if going from fullscreen to not fullscreen this hook
      may do something OS dependent, like extended window manager hints on X11.  */
   void (*fullscreen_hook) (struct frame *f);
@@ -625,18 +605,18 @@ struct terminal
 
 /* Most code should use these functions to set Lisp fields in struct
    terminal.  */
-TERMHOOKS_INLINE void
+INLINE void
 tset_charset_list (struct terminal *t, Lisp_Object val)
 {
   t->charset_list = val;
 }
-TERMHOOKS_INLINE void
+INLINE void
 tset_selection_alist (struct terminal *t, Lisp_Object val)
 {
   t->Vselection_alist = val;
 }
 
-/* Chain of all terminal devices currently in use. */
+/* Chain of all terminal devices currently in use.  */
 extern struct terminal *terminal_list;
 
 #define FRAME_MUST_WRITE_SPACES(f) ((f)->terminal->must_write_spaces)
@@ -657,14 +637,16 @@ extern struct terminal *terminal_list;
 
 #define FRAME_TERMINAL(f) ((f)->terminal)
 
-/* Return true if the terminal device is not suspended. */
-#define TERMINAL_ACTIVE_P(d) (((d)->type != output_termcap && (d)->type !=output_msdos_raw) || (d)->display_info.tty->input)
+/* Return true if the terminal device is not suspended.  */
+#define TERMINAL_ACTIVE_P(d)                                           \
+  (((d)->type != output_termcap && (d)->type != output_msdos_raw)      \
+   || (d)->display_info.tty->input)
 
-extern struct terminal *get_terminal (Lisp_Object terminal, int);
+extern struct terminal *get_terminal (Lisp_Object terminal, bool);
 extern struct terminal *create_terminal (void);
 extern void delete_terminal (struct terminal *);
 
-/* The initial terminal device, created by initial_term_init. */
+/* The initial terminal device, created by initial_term_init.  */
 extern struct terminal *initial_terminal;
 
 extern unsigned char *encode_terminal_code (struct glyph *, int,
@@ -674,4 +656,14 @@ extern unsigned char *encode_terminal_code (struct glyph *, int,
 extern void close_gpm (int gpm_fd);
 #endif
 
+#ifdef WINDOWSNT
+extern int cursorX (struct tty_display_info *);
+extern int cursorY (struct tty_display_info *);
+#else
+#define cursorX(t)  curX(t)
+#define cursorY(t)  curY(t)
+#endif
+
 INLINE_HEADER_END
+
+#endif /* EMACS_TERMHOOKS_H */