]> code.delx.au - gnu-emacs/blobdiff - src/termhooks.h
Merge from emacs--devo--0
[gnu-emacs] / src / termhooks.h
index 3fea7c366fb07aed4338a91a396a5998761c64ac..1ca9234cac218bc6f711d33b121c9bd03fbc1bdd 100644 (file)
@@ -1,6 +1,6 @@
-/* Parameters and display hooks for output devices.
+/* Parameters and display hooks for terminal devices.
    Copyright (C) 1985, 1986, 1993, 1994, 2002, 2003, 2004,
-                 2005 Free Software Foundation, Inc.
+                 2005, 2006, 2007 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -43,6 +43,11 @@ 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) P_ ((struct frame *f));
+
 \f
 /* Input queue declarations and hooks.  */
 
@@ -129,7 +134,7 @@ enum event_kind
                                   by MS-Windows scroll bar controls. */
 #endif
   SELECTION_REQUEST_EVENT,     /* Another X client wants a selection from us.
-                                  See `struct selection_event'.  */
+                                  See `struct selection_input_event'.  */
   SELECTION_CLEAR_EVENT,       /* Another X client cleared our selection.  */
   BUFFER_SWITCH_EVENT,         /* A process filter has switched buffers.  */
   DELETE_WINDOW_EVENT,         /* An X client said "delete this window".  */
@@ -144,14 +149,14 @@ enum event_kind
   DRAG_N_DROP_EVENT,           /* A drag-n-drop event is generated when
                                   files selected outside of Emacs are dropped
                                   onto an Emacs window.
-                                  Currently used only on Windows NT.
                                   .modifiers holds the state of the
                                   modifier keys.
                                   .x and .y give the mouse position,
                                   in characters, within the window.
-                                  .frame_or_window is a cons of the frame
-                                  in which the drop was made and a list of
-                                  the filenames of the dropped files.
+                                  .frame_or_window is the frame in
+                                  which the drop was made.
+                                  .arg is a platform-dependent
+                                  representation of the dropped items.
                                   .timestamp gives a timestamp (in
                                   milliseconds) for the click.  */
   USER_SIGNAL_EVENT,           /* A user signal.
@@ -177,12 +182,26 @@ enum event_kind
 
   /* Queued from XTread_socket when session manager sends
      save yourself before shutdown. */
-  SAVE_SESSION_EVENT
+  SAVE_SESSION_EVENT,
+
+#ifdef MAC_OS
+  /* Generated when an Apple event, a HICommand event, or a Services
+     menu event is received and the corresponding handler is
+     registered.  Members `x' and `y' are for the event class and ID
+     symbols, respectively.  Member `arg' is a Lisp object converted
+     from the received Apple event.  Parameters for non-Apple events
+     are converted to those in Apple events.  */
+  MAC_APPLE_EVENT,
+#endif
+
+#ifdef HAVE_GPM
+  GPM_CLICK_EVENT
+#endif
 };
 
 /* If a struct input_event has a kind which is SELECTION_REQUEST_EVENT
    or SELECTION_CLEAR_EVENT, then its contents are really described
-   by `struct selection_event'; see xterm.h.  */
+   by `struct selection_input_event'; see xterm.h.  */
 
 /* The keyboard input buffer is an array of these structures.  Each one
    represents some sort of input event - a keystroke, a mouse click, or
@@ -208,7 +227,7 @@ struct input_event
   unsigned long timestamp;
 
   /* This is padding just to put the frame_or_window field
-     past the size of struct selection_event.  */
+     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,
@@ -275,37 +294,60 @@ enum {
   meta_modifier        =  CHAR_META    /* Under X, the XK_Meta_[LR] keysyms.  */
 };
 
+#ifdef HAVE_GPM
+#include <gpm.h>
+extern int handle_one_term_event (struct tty_display_info *, Gpm_Event *, struct input_event *);
+extern void term_mouse_moveto (int, int);
+
+/* Nonzero means mouse is enabled on Linux console */
+extern int term_gpm;
+
+/* The id of the terminal device for which we have gpm support.  */
+extern int gpm_tty;
+#endif
+
 #endif /* CONSP */
 
 \f
-/* Device-local parameters. */
-struct device
+struct mac_display_info;
+struct w32_display_info;
+
+/* Terminal-local parameters. */
+struct terminal
 {
-  /* Chain of all display devices. */
-  struct device *next_device;
+  /* Chain of all terminal devices. */
+  struct terminal *next_terminal;
 
-  /* Unique id for this display device. */
+  /* Unique id for this terminal device. */
   int id;
 
-  /* The number of frames that are on this device. */
+  /* The number of frames that are on this terminal. */
   int reference_count;
-  
-  /* The type of the display device. */
+
+  /* Nonzero while deleting this terminal.  Used to protect against
+     recursive calls to delete_terminal_hook.  */
+  int deleted;
+
+  /* The type of the terminal device. */
   enum output_method type;
 
-  /* The name of the display device.  Do not use this to identify the device. */
+  /* The name of the terminal device.  Do not use this to uniquely
+     identify a terminal; the same device may be opened multiple
+     times. */
   char *name;
 
 #ifdef MULTI_KBOARD
-  /* The device's keyboard object. */
+  /* The terminal's keyboard object. */
   struct kboard *kboard;
 #endif
 
-  /* Device-type dependent data shared amongst all frames on this display. */
+  /* Device-type dependent data shared amongst all frames on this terminal. */
   union display_info
   {
     struct tty_display_info *tty;     /* termchar.h */
     struct x_display_info *x;         /* xterm.h */
+    struct w32_display_info *w32;     /* w32term.h */
+    struct mac_display_info *mac;     /* macterm.h */
   } display_info;
 
 \f
@@ -320,6 +362,9 @@ struct device
      the function `set-keyboard-coding-system'.  */
   struct coding_system *keyboard_coding;
 
+  /* Parameter alist of this terminal.  */
+  Lisp_Object param_alist;
+  
   /* Terminal characteristics. */
   /* XXX Are these really used on non-termcap displays? */
   
@@ -368,8 +413,8 @@ struct device
   
   void (*ring_bell_hook) P_ ((struct frame *f));
   
-  void (*reset_terminal_modes_hook) P_ ((struct device *));
-  void (*set_terminal_modes_hook) P_ ((struct device *));
+  void (*reset_terminal_modes_hook) P_ ((struct terminal *));
+  void (*set_terminal_modes_hook) P_ ((struct terminal *));
 
   void (*update_begin_hook) P_ ((struct frame *));
   void (*update_end_hook) P_ ((struct frame *));
@@ -415,7 +460,7 @@ struct device
   /* If we're displaying frames using a window system that can stack
      frames on top of each other, this hook allows you to bring a frame
      to the front, or bury it behind all the other windows.  If this
-     hook is zero, that means the device we're displaying on doesn't
+     hook is zero, that means the terminal we're displaying on doesn't
      support overlapping frames, so there's no need to raise or lower
      anything.
      
@@ -424,6 +469,11 @@ struct device
      windows.  */
   void (*frame_raise_lower_hook) P_ ((struct frame *f, int raise));
 
+  /* 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.  */
+  void (*fullscreen_hook) P_ ((struct frame *f));
+    
   \f
   /* Scroll bar hooks.  */
 
@@ -499,10 +549,10 @@ struct device
 \f
   /* Called to read input events.
 
-     DEVICE indicates which display device to read from.  Input events
-     should be read into BUF, the size of which is given in SIZE.
-     EXPECTED is non-zero if the caller suspects that new input is
-     available.
+     TERMINAL indicates which terminal device to read from.  Input
+     events should be read into BUF, the size of which is given in
+     SIZE.  EXPECTED is non-zero if the caller suspects that new input
+     is available.
 
      A positive return value indicates that that many input events
      where read into BUF.
@@ -512,11 +562,11 @@ struct device
 
      XXX Please note that a non-zero value of EXPECTED only means that
      there is available input on at least one of the currently opened
-     display devices -- but not necessarily on this device.
+     terminal devices -- but not necessarily on this device.
      Therefore, in most cases EXPECTED should be simply ignored.
 
      XXX This documentation needs to be updated.  */
-  int (*read_socket_hook) P_ ((struct device *device,
+  int (*read_socket_hook) P_ ((struct terminal *terminal,
                                int expected,
                                struct input_event *hold_quit));
 
@@ -525,43 +575,43 @@ struct device
 
 \f
   /* Called to delete the device-specific portions of a frame that is
-     on this display device. */
+     on this terminal device. */
   void (*delete_frame_hook) P_ ((struct frame *));
 
-  /* Called after the last frame on this device is deleted, or when
+  /* Called after the last frame on this terminal is deleted, or when
      the display device was closed (hangup).
      
-     If this is NULL, then the generic delete_device is called
-     instead.  Otherwise the hook must call delete_device itself.
+     If this is NULL, then the generic delete_terminal is called
+     instead.  Otherwise the hook must call delete_terminal itself.
 
      The hook must check for and close any live frames that are still
-     on the device.  Fdelete_frame ensures that there are no live
-     frames on the device when it calls this hook, so infinite
+     on the terminal.  Fdelete_frame ensures that there are no live
+     frames on the terminal when it calls this hook, so infinite
      recursion is prevented.  */
-  void (*delete_device_hook) P_ ((struct device *));
+  void (*delete_terminal_hook) P_ ((struct terminal *));
 };
 
 
-/* Chain of all display devices currently in use. */
-extern struct device *device_list;
+/* Chain of all terminal devices currently in use. */
+extern struct terminal *terminal_list;
 
-#define FRAME_MUST_WRITE_SPACES(f) ((f)->device->must_write_spaces)
-#define FRAME_FAST_CLEAR_END_OF_LINE(f) ((f)->device->fast_clear_end_of_line)
-#define FRAME_LINE_INS_DEL_OK(f) ((f)->device->line_ins_del_ok)
-#define FRAME_CHAR_INS_DEL_OK(f) ((f)->device->char_ins_del_ok)
-#define FRAME_SCROLL_REGION_OK(f) ((f)->device->scroll_region_ok)
-#define FRAME_SCROLL_REGION_COST(f) ((f)->device->scroll_region_cost)
-#define FRAME_MEMORY_BELOW_FRAME(f) ((f)->device->memory_below_frame)
+#define FRAME_MUST_WRITE_SPACES(f) ((f)->terminal->must_write_spaces)
+#define FRAME_FAST_CLEAR_END_OF_LINE(f) ((f)->terminal->fast_clear_end_of_line)
+#define FRAME_LINE_INS_DEL_OK(f) ((f)->terminal->line_ins_del_ok)
+#define FRAME_CHAR_INS_DEL_OK(f) ((f)->terminal->char_ins_del_ok)
+#define FRAME_SCROLL_REGION_OK(f) ((f)->terminal->scroll_region_ok)
+#define FRAME_SCROLL_REGION_COST(f) ((f)->terminal->scroll_region_cost)
+#define FRAME_MEMORY_BELOW_FRAME(f) ((f)->terminal->memory_below_frame)
 
-#define FRAME_TERMINAL_CODING(f) ((f)->device->terminal_coding)
-#define FRAME_KEYBOARD_CODING(f) ((f)->device->keyboard_coding)
+#define FRAME_TERMINAL_CODING(f) ((f)->terminal->terminal_coding)
+#define FRAME_KEYBOARD_CODING(f) ((f)->terminal->keyboard_coding)
 
-#define DEVICE_TERMINAL_CODING(d) ((d)->terminal_coding)
-#define DEVICE_KEYBOARD_CODING(d) ((d)->keyboard_coding)
+#define TERMINAL_TERMINAL_CODING(d) ((d)->terminal_coding)
+#define TERMINAL_KEYBOARD_CODING(d) ((d)->keyboard_coding)
 
-#define FRAME_RIF(f) ((f)->device->rif)
+#define FRAME_RIF(f) ((f)->terminal->rif)
 
-#define FRAME_DEVICE(f) ((f)->device)
+#define FRAME_TERMINAL(f) ((f)->terminal)
 
 /* FRAME_WINDOW_P tests whether the frame is a window, and is
    defined to be the predicate for the window system being used.  */
@@ -579,14 +629,16 @@ extern struct device *device_list;
 #define FRAME_WINDOW_P(f) (0)
 #endif
 
-/* Return true if the display device is not suspended. */
-#define DEVICE_ACTIVE_P(d) ((d)->type != output_termcap || (d)->display_info.tty->input)
+/* Return true if the terminal device is not suspended. */
+#define TERMINAL_ACTIVE_P(d) ((d)->type != output_termcap || (d)->display_info.tty->input)
 
-extern struct device *create_device P_ ((void));
-extern void delete_device P_ ((struct device *));
+extern Lisp_Object get_terminal_param P_ ((struct terminal *, Lisp_Object));
+extern struct terminal *get_terminal P_ ((Lisp_Object terminal, int));
+extern struct terminal *create_terminal P_ ((void));
+extern void delete_terminal P_ ((struct terminal *));
 
-/* The initial display device, created by initial_term_init. */
-extern struct device *initial_device;
+/* The initial terminal device, created by initial_term_init. */
+extern struct terminal *initial_terminal;
 
 /* arch-tag: 33a00ecc-52b5-4186-a410-8801ac9f087d
    (do not change this comment) */