]> code.delx.au - gnu-emacs/blobdiff - src/termhooks.h
Add a cross ref to Optional Mode Line
[gnu-emacs] / src / termhooks.h
index d792e277efd28ea41603422842ca806e4aeb5e8f..d21d6ce588a17d6b371f2b13e3c018d399513d40 100644 (file)
@@ -1,14 +1,14 @@
 /* Parameters and display hooks for terminal devices.
 
-Copyright (C) 1985-1986, 1993-1994, 2001-2015 Free Software Foundation,
+Copyright (C) 1985-1986, 1993-1994, 2001-2016 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
 
 GNU Emacs is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -23,12 +23,15 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Miscellanea.   */
 
+#include "lisp.h"
 #include "systime.h" /* for Time */
 
+struct glyph;
+
 INLINE_HEADER_BEGIN
 
 enum scroll_bar_part {
-  scroll_bar_nowhere = -1,
+  scroll_bar_nowhere,
   scroll_bar_above_handle,
   scroll_bar_handle,
   scroll_bar_below_handle,
@@ -37,7 +40,14 @@ enum scroll_bar_part {
   scroll_bar_to_top,
   scroll_bar_to_bottom,
   scroll_bar_end_scroll,
-  scroll_bar_move_ratio
+  scroll_bar_move_ratio,
+  scroll_bar_before_handle,
+  scroll_bar_horizontal_handle,
+  scroll_bar_after_handle,
+  scroll_bar_left_arrow,
+  scroll_bar_right_arrow,
+  scroll_bar_to_leftmost,
+  scroll_bar_to_rightmost
 };
 
 /* Output method of a terminal (and frames on this terminal, respectively).  */
@@ -130,6 +140,19 @@ enum event_kind
                                   whose scroll bar was clicked in.
                                   .timestamp gives a timestamp (in
                                   milliseconds) for the click.  */
+  HORIZONTAL_SCROLL_BAR_CLICK_EVENT,   /* .code gives the number of the mouse button
+                                  that was clicked.
+                                  .modifiers holds the state of the modifier
+                                  keys.
+                                  .part is a lisp symbol indicating which
+                                  part of the scroll bar got clicked.
+                                  .x gives the distance from the start of the
+                                  scroll bar of the click; .y gives the total
+                                  length of the scroll bar.
+                                  .frame_or_window gives the window
+                                  whose scroll bar was clicked in.
+                                  .timestamp gives a timestamp (in
+                                  milliseconds) for the click.  */
   SELECTION_REQUEST_EVENT,     /* Another X client wants a selection from us.
                                   See `struct selection_input_event'.  */
   SELECTION_CLEAR_EVENT,       /* Another X client cleared our selection.  */
@@ -216,6 +239,11 @@ enum event_kind
   , NS_NONKEY_EVENT
 #endif
 
+#ifdef HAVE_XWIDGETS
+  /* events generated by xwidgets*/
+   , XWIDGET_EVENT
+#endif
+
 #ifdef USE_FILE_NOTIFY
   /* File or directory was changed.  */
   , FILE_NOTIFY_EVENT
@@ -223,6 +251,9 @@ enum event_kind
 
 };
 
+/* Bit width of an enum event_kind tag at the start of structs and unions.  */
+enum { EVENT_KIND_WIDTH = 16 };
+
 /* 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_input_event'; see xterm.h.  */
@@ -235,28 +266,36 @@ enum event_kind
 struct input_event
 {
   /* What kind of event was this?  */
-  enum event_kind kind;
+  ENUM_BF (event_kind) kind : EVENT_KIND_WIDTH;
+
+  /* Used in scroll back click events.  */
+  ENUM_BF (scroll_bar_part) part : 16;
 
   /* For an ASCII_KEYSTROKE_EVENT and MULTIBYTE_CHAR_KEYSTROKE_EVENT,
      this is the character.
      For a NON_ASCII_KEYSTROKE_EVENT, this is the keysym code.
-     For a mouse event, this is the button number.
-     For a HELP_EVENT, this is the position within the object
-      (stored in ARG below) where the help was found.  */
-  ptrdiff_t code;
-  enum scroll_bar_part part;
+     For a mouse event, this is the button number.  */
+  unsigned code;
 
-  int modifiers;               /* See enum below for interpretation.  */
+  /* See enum below for interpretation.  */
+  unsigned modifiers;
 
+  /* One would prefer C integers, but HELP_EVENT uses these to
+     record frame or window object and a help form, respectively.  */
   Lisp_Object x, y;
+
+  /* Usually a time as reported by window system-specific event loop.
+     For a HELP_EVENT, this is the position within the object (stored
+     in ARG below) where the help was found.  */
   Time timestamp;
 
   /* 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
-     HELP_EVENTs and avoids calling Fcons during signal handling.  */
+  /* This additional argument is used in attempt to avoid extra consing
+     when building events.  Unfortunately some events have to pass much
+     more data than it's reasonable to pack directly into this structure.  */
   Lisp_Object arg;
 };
 
@@ -352,6 +391,11 @@ struct terminal
     the selection-values.  */
   Lisp_Object Vselection_alist;
 
+  /* If a char-table, this maps characters to terminal glyph codes.
+     If t, the mapping is not available.  If nil, it is not known
+     whether the mapping is available.  */
+  Lisp_Object glyph_code_table;
+
   /* All fields before `next_terminal' should be Lisp_Object and are traced
      by the GC.  All fields afterwards are ignored by the GC.  */
 
@@ -423,7 +467,7 @@ struct terminal
   void (*delete_glyphs_hook) (struct frame *, int);
 
   void (*ring_bell_hook) (struct frame *f);
-  void (*toggle_invisible_pointer_hook) (struct frame *f, int invisible);
+  void (*toggle_invisible_pointer_hook) (struct frame *f, bool invisible);
 
   void (*reset_terminal_modes_hook) (struct terminal *);
   void (*set_terminal_modes_hook) (struct terminal *);
@@ -468,17 +512,24 @@ struct terminal
      support overlapping frames, so there's no need to raise or lower
      anything.
 
-     If RAISE_FLAG is non-zero, F is brought to the front, before all other
-     windows.  If RAISE_FLAG is zero, F is sent to the back, behind all other
+     If RAISE_FLAG, F is brought to the front, before all other
+     windows.  If !RAISE_FLAG, F is sent to the back, behind all other
      windows.  */
-  void (*frame_raise_lower_hook) (struct frame *f, int raise_flag);
+  void (*frame_raise_lower_hook) (struct frame *f, bool raise_flag);
 
   /* 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);
 
-  \f
+  /* This hook is called to display menus.  */
+  Lisp_Object (*menu_show_hook) (struct frame *f, int x, int y, int menuflags,
+                                Lisp_Object title, const char **error_name);
+
+  /* This hook is called to display popup dialog.  */
+  Lisp_Object (*popup_dialog_hook) (struct frame *f, Lisp_Object header,
+                                   Lisp_Object contents);
+
   /* Scroll bar hooks.  */
 
   /* The representation of scroll bars is determined by the code which
@@ -511,6 +562,16 @@ struct terminal
                                         int position);
 
 
+  /* Set the horizontal scroll bar for WINDOW to have its upper left
+     corner at (TOP, LEFT), and be LENGTH rows high.  Set its handle to
+     indicate that we are displaying PORTION characters out of a total
+     of WHOLE characters, starting at POSITION.  If WINDOW doesn't yet
+     have a scroll bar, create one for it.  */
+  void (*set_horizontal_scroll_bar_hook) (struct window *window,
+                                         int portion, int whole,
+                                         int position);
+
+
   /* The following three hooks are used when we're doing a thorough
      redisplay of the frame.  We don't explicitly know which scroll bars
      are going to be deleted, because keeping track of when windows go
@@ -636,17 +697,19 @@ extern struct terminal *terminal_list;
   (t->type == output_ns ? t->display_info.ns->name_list_element : Qnil)
 #endif
 
-extern struct terminal *get_terminal (Lisp_Object terminal, bool);
-extern struct terminal *create_terminal (void);
+extern struct terminal *decode_live_terminal (Lisp_Object);
+extern struct terminal *decode_tty_terminal (Lisp_Object);
+extern struct terminal *get_named_terminal (const char *);
+extern struct terminal *create_terminal (enum output_method,
+                                        struct redisplay_interface *);
 extern void delete_terminal (struct terminal *);
+extern Lisp_Object terminal_glyph_code (struct terminal *, int);
 
 /* The initial terminal device, created by initial_term_init.  */
 extern struct terminal *initial_terminal;
 
-#ifdef DOS_NT
 extern unsigned char *encode_terminal_code (struct glyph *, int,
                                            struct coding_system *);
-#endif
 
 #ifdef HAVE_GPM
 extern void close_gpm (int gpm_fd);