(U+6215): Apply new conventions for glyph granularity.
[chise/xemacs-chise.git.1] / src / events.h
index 266505d..a6ce474 100644 (file)
@@ -22,8 +22,8 @@ Boston, MA 02111-1307, USA.  */
 
 /* Synched up with: Not in FSF. */
 
 
 /* Synched up with: Not in FSF. */
 
-#ifndef _XEMACS_EVENTS_H_
-#define _XEMACS_EVENTS_H_
+#ifndef INCLUDED_events_h_
+#define INCLUDED_events_h_
 
 #include "systime.h"
 
 
 #include "systime.h"
 
@@ -40,7 +40,8 @@ Boston, MA 02111-1307, USA.  */
    multiple heterogeneous machines, X11 and SunView, or X11 and NeXT, for
    example, then it will be necessary to construct an event_stream structure
    that can cope with the given types.  Currently, the only implemented
    multiple heterogeneous machines, X11 and SunView, or X11 and NeXT, for
    example, then it will be necessary to construct an event_stream structure
    that can cope with the given types.  Currently, the only implemented
-   event_streams are for dumb-ttys, and for X11 plus dumb-ttys.
+   event_streams are for dumb-ttys, and for X11 plus dumb-ttys,
+   and for mswindows.
 
    To implement this for one window system is relatively simple.
    To implement this for multiple window systems is trickier and may
 
    To implement this for one window system is relatively simple.
    To implement this for multiple window systems is trickier and may
@@ -129,10 +130,9 @@ Boston, MA 02111-1307, USA.  */
  event_stream layer to translate to this format.
 
  NOTE: #### All timestamps should be measured as milliseconds since XEmacs
  event_stream layer to translate to this format.
 
  NOTE: #### All timestamps should be measured as milliseconds since XEmacs
-       started.  Currently many or most events have a 0 as their
-       timestamp value, and for other timestamps, they are raw server
-       timestamps. (The X protocol doesn't provide any easy way of
-       translating between server time and real process time; yuck.)
+       started.  Currently they are raw server timestamps. (The X protocol
+       doesn't provide any easy way of translating between server time and
+       real process time; yuck.)
 
  Every event type has the following structures:
 
 
  Every event type has the following structures:
 
@@ -175,6 +175,7 @@ Boston, MA 02111-1307, USA.  */
                        If this is an integer, it will be in the printing
                        ASCII range: >32 and <127.
     modifiers          Bucky-bits on that key: control, meta, etc.
                        If this is an integer, it will be in the printing
                        ASCII range: >32 and <127.
     modifiers          Bucky-bits on that key: control, meta, etc.
+                        Also includes buttons.
                        For many keys, Shift is not a bit; that is implicit
                        in the keyboard layout.
 
                        For many keys, Shift is not a bit; that is implicit
                        in the keyboard layout.
 
@@ -182,12 +183,12 @@ Boston, MA 02111-1307, USA.  */
  button_release_event
     button             What button went down or up.
     modifiers          Bucky-bits on that button: shift, control, meta, etc.
  button_release_event
     button             What button went down or up.
     modifiers          Bucky-bits on that button: shift, control, meta, etc.
+                        Also includes other buttons (not the one pressed).
     x, y               Where it was at the button-state-change (in pixels).
 
  pointer_motion_event
     x, y               Where it was after it moved (in pixels).
     modifiers          Bucky-bits down when the motion was detected.
     x, y               Where it was at the button-state-change (in pixels).
 
  pointer_motion_event
     x, y               Where it was after it moved (in pixels).
     modifiers          Bucky-bits down when the motion was detected.
-                       (Possibly not all window systems will provide this?)
 
  process_event
     process            the XEmacs "process" object in question
 
  process_event
     process            the XEmacs "process" object in question
@@ -275,9 +276,9 @@ Boston, MA 02111-1307, USA.  */
   The Create stream pair function is passed two void* values, which identify
   process-dependent 'handles'. The process implementation uses these handles
   to communicate with child processes. The function must be prepared to receive
   The Create stream pair function is passed two void* values, which identify
   process-dependent 'handles'. The process implementation uses these handles
   to communicate with child processes. The function must be prepared to receive
-  handle types of any process implementation. Since there only one process
+  handle types of any process implementation. Since only one process
   implementation exists in a particular XEmacs configuration, preprocessing
   implementation exists in a particular XEmacs configuration, preprocessing
-  is a mean of compiling in the support for the code which deals with particular
+  is a means of compiling in the support for the code which deals with particular
   handle types.
 
   For example, a unixoid type loop, which relies on file descriptors, may be
   handle types.
 
   For example, a unixoid type loop, which relies on file descriptors, may be
@@ -316,27 +317,26 @@ Boston, MA 02111-1307, USA.  */
 #define USID_DONTHASH ((USID)0)
 
 \f
 #define USID_DONTHASH ((USID)0)
 
 \f
-struct Lisp_Event;
-struct Lisp_Process;
-
 struct event_stream
 {
   int  (*event_pending_p)      (int);
 struct event_stream
 {
   int  (*event_pending_p)      (int);
-  void (*next_event_cb)                (struct Lisp_Event *);
-  void (*handle_magic_event_cb)        (struct Lisp_Event *);
+  void (*next_event_cb)                (Lisp_Event *);
+  void (*handle_magic_event_cb)        (Lisp_Event *);
   int  (*add_timeout_cb)       (EMACS_TIME);
   void (*remove_timeout_cb)    (int);
   void (*select_console_cb)    (struct console *);
   void (*unselect_console_cb)  (struct console *);
   int  (*add_timeout_cb)       (EMACS_TIME);
   void (*remove_timeout_cb)    (int);
   void (*select_console_cb)    (struct console *);
   void (*unselect_console_cb)  (struct console *);
-  void (*select_process_cb)    (struct Lisp_Process *);
-  void (*unselect_process_cb)  (struct Lisp_Process *);
+  void (*select_process_cb)    (Lisp_Process *);
+  void (*unselect_process_cb)  (Lisp_Process *);
   void (*quit_p_cb)            (void);
   void (*quit_p_cb)            (void);
+  void (*force_event_pending)  (struct frame* f);
   USID (*create_stream_pair_cb) (void* /* inhandle*/, void* /*outhandle*/ ,
                                 Lisp_Object* /* instream */,
                                 Lisp_Object* /* outstream */,
                                 int /* flags */);
   USID (*delete_stream_pair_cb) (Lisp_Object /* instream */,
                                 Lisp_Object /* outstream */);
   USID (*create_stream_pair_cb) (void* /* inhandle*/, void* /*outhandle*/ ,
                                 Lisp_Object* /* instream */,
                                 Lisp_Object* /* outstream */,
                                 int /* flags */);
   USID (*delete_stream_pair_cb) (Lisp_Object /* instream */,
                                 Lisp_Object /* outstream */);
+  int (*current_event_timestamp_cb) (struct console *);
 };
 
 /* Flags for create_stream_pair_cb() FLAGS parameter */
 };
 
 /* Flags for create_stream_pair_cb() FLAGS parameter */
@@ -368,20 +368,20 @@ typedef enum emacs_event_type
 struct key_data
 {
   Lisp_Object       keysym;
 struct key_data
 {
   Lisp_Object       keysym;
-  unsigned char     modifiers;
+  int              modifiers;
 };
 
 struct button_data
 {
   int               button;
 };
 
 struct button_data
 {
   int               button;
-  unsigned char     modifiers;
+  int              modifiers;
   int               x, y;
 };
 
 struct motion_data
 {
   int               x, y;
   int               x, y;
 };
 
 struct motion_data
 {
   int               x, y;
-  unsigned char     modifiers;
+  int              modifiers;
 };
 
 struct process_data
 };
 
 struct process_data
@@ -408,7 +408,7 @@ struct misc_user_data
   Lisp_Object       function;
   Lisp_Object      object;
   int               button;
   Lisp_Object       function;
   Lisp_Object      object;
   int               button;
-  unsigned char     modifiers;
+  int              modifiers;
   int               x, y;
 };
 
   int               x, y;
 };
 
@@ -422,11 +422,18 @@ struct magic_eval_data
 # include <X11/Xlib.h>
 #endif
 
 # include <X11/Xlib.h>
 #endif
 
+#ifdef HAVE_GTK
+#include <gdk/gdk.h>
+#endif
+
 union magic_data
 {
 #ifdef HAVE_TTY
   char             underlying_tty_event;
 #endif
 union magic_data
 {
 #ifdef HAVE_TTY
   char             underlying_tty_event;
 #endif
+#ifdef HAVE_GTK
+  GdkEvent         underlying_gdk_event;
+#endif
 #ifdef HAVE_X_WINDOWS
   XEvent           underlying_x_event;
 #endif
 #ifdef HAVE_X_WINDOWS
   XEvent           underlying_x_event;
 #endif
@@ -450,9 +457,10 @@ struct Lisp_Timeout
                                   should the one after that
                                   occur? */
 };
                                   should the one after that
                                   occur? */
 };
+typedef struct Lisp_Timeout Lisp_Timeout;
 
 
-DECLARE_LRECORD (timeout, struct Lisp_Timeout);
-#define XTIMEOUT(x) XRECORD (x, timeout, struct Lisp_Timeout)
+DECLARE_LRECORD (timeout, Lisp_Timeout);
+#define XTIMEOUT(x) XRECORD (x, timeout, Lisp_Timeout)
 #define XSETTIMEOUT(x, p) XSETRECORD (x, p, timeout)
 #define TIMEOUTP(x) RECORDP (x, timeout)
 #define CHECK_TIMEOUT(x) CHECK_RECORD (x, timeout)
 #define XSETTIMEOUT(x, p) XSETRECORD (x, p, timeout)
 #define TIMEOUTP(x) RECORDP (x, timeout)
 #define CHECK_TIMEOUT(x) CHECK_RECORD (x, timeout)
@@ -485,8 +493,8 @@ struct Lisp_Event
     } event;
 };
 
     } event;
 };
 
-DECLARE_LRECORD (event, struct Lisp_Event);
-#define XEVENT(x) XRECORD (x, event, struct Lisp_Event)
+DECLARE_LRECORD (event, Lisp_Event);
+#define XEVENT(x) XRECORD (x, event, Lisp_Event)
 #define XSETEVENT(x, p) XSETRECORD (x, p, event)
 #define EVENTP(x) RECORDP (x, event)
 #define CHECK_EVENT(x) CHECK_RECORD (x, event)
 #define XSETEVENT(x, p) XSETRECORD (x, p, event)
 #define EVENTP(x) RECORDP (x, event)
 #define CHECK_EVENT(x) CHECK_RECORD (x, event)
@@ -532,10 +540,11 @@ EXFUN (Fmake_event, 2);
 extern Lisp_Object QKbackspace, QKdelete, QKescape, QKlinefeed, QKreturn;
 extern Lisp_Object QKspace, QKtab, Qmouse_event_p, Vcharacter_set_property;
 extern Lisp_Object Qcancel_mode_internal;
 extern Lisp_Object QKbackspace, QKdelete, QKescape, QKlinefeed, QKreturn;
 extern Lisp_Object QKspace, QKtab, Qmouse_event_p, Vcharacter_set_property;
 extern Lisp_Object Qcancel_mode_internal;
+extern Lisp_Object Vmodifier_keys_sticky_time;
 
 
-/* Note: under X Windows, MOD_ALT is generated by the Alt key if there are
+/* Note: under X Windows, XEMACS_MOD_ALT is generated by the Alt key if there are
    both Alt and Meta keys.  If there are no Meta keys, then Alt generates
    both Alt and Meta keys.  If there are no Meta keys, then Alt generates
-   MOD_META instead.
+   XEMACS_MOD_META instead.
  */
 
 #ifdef emacs
  */
 
 #ifdef emacs
@@ -543,12 +552,12 @@ extern Lisp_Object Qcancel_mode_internal;
 #define KEYSYM(x) (intern (x))
 
 /* from events.c */
 #define KEYSYM(x) (intern (x))
 
 /* from events.c */
-void format_event_object (char *buf, struct Lisp_Event *e, int brief);
-void character_to_event (Emchar c, struct Lisp_Event *event,
+void format_event_object (char *buf, Lisp_Event *e, int brief);
+void character_to_event (Emchar c, Lisp_Event *event,
                         struct console *con,
                         int use_console_meta_flag,
                         int do_backspace_mapping);
                         struct console *con,
                         int use_console_meta_flag,
                         int do_backspace_mapping);
-void zero_event (struct Lisp_Event *e);
+void zero_event (Lisp_Event *e);
 void deallocate_event_chain (Lisp_Object event);
 Lisp_Object event_chain_tail (Lisp_Object event);
 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail);
 void deallocate_event_chain (Lisp_Object event);
 Lisp_Object event_chain_tail (Lisp_Object event);
 void enqueue_event (Lisp_Object event, Lisp_Object *head, Lisp_Object *tail);
@@ -565,17 +574,19 @@ Lisp_Object copy_event_chain (Lisp_Object event_chain);
 /* True if this is a non-internal event
    (keyboard press, menu, scrollbar, mouse button) */
 int command_event_p (Lisp_Object event);
 /* True if this is a non-internal event
    (keyboard press, menu, scrollbar, mouse button) */
 int command_event_p (Lisp_Object event);
+void define_self_inserting_symbol (Lisp_Object, Lisp_Object);
+Emchar event_to_character (Lisp_Event *, int, int, int);
 struct console *event_console_or_selected (Lisp_Object event);
 
 /* from event-stream.c */
 Lisp_Object allocate_command_builder (Lisp_Object console);
 void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object);
 struct console *event_console_or_selected (Lisp_Object event);
 
 /* from event-stream.c */
 Lisp_Object allocate_command_builder (Lisp_Object console);
 void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object);
-void event_stream_next_event (struct Lisp_Event *event);
-void event_stream_handle_magic_event (struct Lisp_Event *event);
+void event_stream_next_event (Lisp_Event *event);
+void event_stream_handle_magic_event (Lisp_Event *event);
 void event_stream_select_console   (struct console *con);
 void event_stream_unselect_console (struct console *con);
 void event_stream_select_console   (struct console *con);
 void event_stream_unselect_console (struct console *con);
-void event_stream_select_process   (struct Lisp_Process *proc);
-void event_stream_unselect_process (struct Lisp_Process *proc);
+void event_stream_select_process   (Lisp_Process *proc);
+void event_stream_unselect_process (Lisp_Process *proc);
 USID event_stream_create_stream_pair (void* inhandle, void* outhandle,
                Lisp_Object* instream, Lisp_Object* outstream, int flags);
 USID event_stream_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream);
 USID event_stream_create_stream_pair (void* inhandle, void* outhandle,
                Lisp_Object* instream, Lisp_Object* outstream, int flags);
 USID event_stream_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream);
@@ -638,9 +649,9 @@ extern int fake_event_occurred;
 
 int event_stream_unixoid_select_console   (struct console *con);
 int event_stream_unixoid_unselect_console (struct console *con);
 
 int event_stream_unixoid_select_console   (struct console *con);
 int event_stream_unixoid_unselect_console (struct console *con);
-int event_stream_unixoid_select_process   (struct Lisp_Process *proc);
-int event_stream_unixoid_unselect_process (struct Lisp_Process *proc);
-int read_event_from_tty_or_stream_desc (struct Lisp_Event *event,
+int event_stream_unixoid_select_process   (Lisp_Process *proc);
+int event_stream_unixoid_unselect_process (Lisp_Process *proc);
+int read_event_from_tty_or_stream_desc (Lisp_Event *event,
                                        struct console *con, int fd);
 USID event_stream_unixoid_create_stream_pair (void* inhandle, void* outhandle,
                                             Lisp_Object* instream,
                                        struct console *con, int fd);
 USID event_stream_unixoid_create_stream_pair (void* inhandle, void* outhandle,
                                             Lisp_Object* instream,
@@ -660,4 +671,60 @@ USID event_stream_unixoid_delete_stream_pair (Lisp_Object instream,
 
 #endif /* emacs */
 
 
 #endif /* emacs */
 
-#endif /* _XEMACS_EVENTS_H_ */
+/* #### a hack, until accelerator shit is cleaned up */
+
+/* This structure is what we use to encapsulate the state of a command sequence
+   being composed; key events are executed by adding themselves to the command
+   builder; if the command builder is then complete (does not still represent
+   a prefix key sequence) it executes the corresponding command.
+ */
+struct command_builder
+{
+  struct lcrecord_header header;
+  Lisp_Object console; /* back pointer to the console this command
+                         builder is for */
+  /* Qnil, or a Lisp_Event representing the first event read
+   *  after the last command completed.  Threaded. */
+  /* #### NYI */
+  Lisp_Object prefix_events;
+  /* Qnil, or a Lisp_Event representing event in the current
+   *  keymap-lookup sequence.  Subsequent events are threaded via
+   *  the event's next slot */
+  Lisp_Object current_events;
+  /* Last elt of above  */
+  Lisp_Object most_current_event;
+  /* Last elt before function map code took over. What this means is:
+     All prefixes up to (but not including) this event have non-nil
+     bindings, but the prefix including this event has a nil binding.
+     Any events in the chain after this one were read solely because
+     we're part of a possible function key.  If we end up with
+     something that's not part of a possible function key, we have to
+     unread all of those events. */
+  Lisp_Object last_non_munged_event;
+  /* One set of values for function-key-map, one for key-translation-map */
+  struct munging_key_translation
+  {
+    /* First event that can begin a possible function key sequence
+       (to be translated according to function-key-map).  Normally
+       this is the first event in the chain.  However, once we've
+       translated a sequence through function-key-map, this will point
+       to the first event after the translated sequence: we don't ever
+       want to translate any events twice through function-key-map, or
+       things could get really screwed up (e.g. if the user created a
+       translation loop).  If this is nil, then the next-read event is
+       the first that can begin a function key sequence. */
+    Lisp_Object first_mungeable_event;
+  } munge_me[2];
+
+  Bufbyte *echo_buf;
+  Bytecount echo_buf_length;          /* size of echo_buf */
+  Bytecount echo_buf_index;           /* index into echo_buf
+                                      * -1 before doing echoing for new cmd */
+  /* Self-insert-command is magic in that it doesn't always push an undo-
+     boundary: up to 20 consecutive self-inserts can happen before an undo-
+     boundary is pushed.  This variable is that counter.
+     */
+  int self_insert_countdown;
+};
+
+#endif /* INCLUDED_events_h_ */