#include "console-tty.h" /* for stuff in character_to_event */
#include "device.h"
#include "console-x.h" /* for x_event_name prototype */
-#include "extents.h" /* Just for the EXTENTP abort check... */
+#include "console-gtk.h" /* for gtk_event_name prototype */
+#include "extents.h" /* Just for the EXTENTP ABORT check... */
#include "events.h"
#include "frame.h"
#include "glyphs.h"
case dead_event:
break;
default:
- abort ();
+ ABORT ();
}
mark_object (event->channel);
return event->next;
/* if (e1->timestamp != e2->timestamp) return 0; */
switch (e1->event_type)
{
- default: abort ();
+ default: ABORT ();
case process_event:
return EQ (e1->event.process.process, e2->event.process.process);
{
struct console *con = XCONSOLE (CDFW_CONSOLE (e1->channel));
+#ifdef HAVE_GTK
+ if (CONSOLE_GTK_P (con))
+ return (!memcmp (&e1->event.magic.underlying_gdk_event,
+ &e2->event.magic.underlying_gdk_event,
+ sizeof (GdkEvent)));
+#endif
#ifdef HAVE_X_WINDOWS
if (CONSOLE_X_P (con))
return (e1->event.magic.underlying_x_event.xany.serial ==
&e2->event.magic.underlying_mswindows_event,
sizeof (union magic_data)));
#endif
- abort ();
+ ABORT ();
return 1; /* not reached */
}
case magic_event:
{
struct console *con = XCONSOLE (CDFW_CONSOLE (EVENT_CHANNEL (e)));
+#ifdef HAVE_GTK
+ if (CONSOLE_GTK_P (con))
+ return HASH2 (hash, e->event.magic.underlying_gdk_event.type);
+#endif
#ifdef HAVE_X_WINDOWS
if (CONSOLE_X_P (con))
return HASH2 (hash, e->event.magic.underlying_x_event.xany.serial);
if (CONSOLE_MSWINDOWS_P (con))
return HASH2 (hash, e->event.magic.underlying_mswindows_event);
#endif
- abort ();
+ ABORT ();
return 0;
}
return hash;
default:
- abort ();
+ ABORT ();
}
return 0; /* unreached */
e->event.misc.y = coord_y;
break;
default:
- abort();
+ ABORT();
}
}
if (EQ (event, Vlast_command_event) ||
EQ (event, Vlast_input_event) ||
EQ (event, Vunread_command_event))
- abort ();
+ ABORT ();
len = XVECTOR_LENGTH (Vthis_command_keys);
for (i = 0; i < len; i++)
if (EQ (event, XVECTOR_DATA (Vthis_command_keys) [i]))
- abort ();
+ ABORT ();
if (!NILP (Vrecent_keys_ring))
{
int recent_ring_len = XVECTOR_LENGTH (Vrecent_keys_ring);
for (i = 0; i < recent_ring_len; i++)
if (EQ (event, XVECTOR_DATA (Vrecent_keys_ring) [i]))
- abort ();
+ ABORT ();
}
}
#endif /* 0 */
}
DEFUN ("copy-event", Fcopy_event, 1, 2, 0, /*
-Make a copy of the given event object.
-If a second argument is given, the first event is copied into the second
-and the second is returned. If the second argument is not supplied (or
-is nil) then a new event will be made as with `make-event'. See also
-the function `deallocate-event'.
+Make a copy of the event object EVENT1.
+If a second event argument EVENT2 is given, EVENT1 is copied into
+EVENT2 and EVENT2 is returned. If EVENT2 is not supplied (or is nil)
+then a new event will be made as with `make-event'. See also the
+function `deallocate-event'.
*/
(event1, event2))
{
/* Return the last event in a chain.
NOTE: You cannot pass nil as a value here! The routine will
- abort if you do. */
+ ABORT if you do. */
Lisp_Object
event_chain_tail (Lisp_Object event_chain)
return n;
}
-/* Find the event before EVENT in an event chain. This aborts
+/* Find the event before EVENT in an event chain. This ABORTs
if the event is not in the chain. */
Lisp_Object
event_chain = XEVENT_NEXT (event_chain);
}
- abort ();
+ ABORT ();
return Qnil;
}
if (CHAR_OR_CHAR_INTP (event->event.key.keysym))
c = XCHAR_OR_CHAR_INT (event->event.key.keysym);
else if (!SYMBOLP (event->event.key.keysym))
- abort ();
+ ABORT ();
else if (allow_non_ascii && !NILP (Vcharacter_set_property)
/* Allow window-system-specific extensibility of
keysym->code mapping */
}
DEFUN ("character-to-event", Fcharacter_to_event, 1, 4, 0, /*
-Convert keystroke CH into an event structure ,replete with bucky bits.
-The keystroke is the first argument, and the event to fill
-in is the second. This function contains knowledge about what the codes
-``mean'' -- for example, the number 9 is converted to the character ``Tab'',
-not the distinct character ``Control-I''.
+Convert KEY-DESCRIPTION into an event structure, replete with bucky bits.
-Note that CH (the keystroke specifier) can be an integer, a character,
-a symbol such as 'clear, or a list such as '(control backspace).
+KEY-DESCRIPTION is the first argument, and the event to fill in is the
+second. This function contains knowledge about what various kinds of
+arguments ``mean'' -- for example, the number 9 is converted to the
+character ``Tab'', not the distinct character ``Control-I''.
-If the optional second argument is an event, it is modified;
-otherwise, a new event object is created.
+KEY-DESCRIPTION can be an integer, a character, a symbol such as 'clear,
+or a list such as '(control backspace).
+
+If the optional second argument EVENT is an event, it is modified and
+returned; otherwise, a new event object is created and returned.
Optional third arg CONSOLE is the console to store in the event, and
defaults to the selected console.
-If CH is an integer or character, the high bit may be interpreted as the
-meta key. (This is done for backward compatibility in lots of places.)
-If USE-CONSOLE-META-FLAG is nil, this will always be the case. If
-USE-CONSOLE-META-FLAG is non-nil, the `meta' flag for CONSOLE affects
-whether the high bit is interpreted as a meta key. (See `set-input-mode'.)
-If you don't want this silly meta interpretation done, you should pass
-in a list containing the character.
+If KEY-DESCRIPTION is an integer or character, the high bit may be
+interpreted as the meta key. (This is done for backward compatibility
+in lots of places.) If USE-CONSOLE-META-FLAG is nil, this will always
+be the case. If USE-CONSOLE-META-FLAG is non-nil, the `meta' flag for
+CONSOLE affects whether the high bit is interpreted as a meta
+key. (See `set-input-mode'.) If you don't want this silly meta
+interpretation done, you should pass in a list containing the
+character.
Beware that character-to-event and event-to-character are not strictly
inverse functions, since events contain much more information than the
-ASCII character set can encode.
+Lisp character object type can encode.
*/
- (ch, event, console, use_console_meta_flag))
+ (keystroke, event, console, use_console_meta_flag))
{
struct console *con = decode_console (console);
if (NILP (event))
event = Fmake_event (Qnil, Qnil);
else
CHECK_LIVE_EVENT (event);
- if (CONSP (ch) || SYMBOLP (ch))
- key_desc_list_to_event (ch, event, 1);
+ if (CONSP (keystroke) || SYMBOLP (keystroke))
+ key_desc_list_to_event (keystroke, event, 1);
else
{
- CHECK_CHAR_COERCE_INT (ch);
- character_to_event (XCHAR (ch), XEVENT (event), con,
+ CHECK_CHAR_COERCE_INT (keystroke);
+ character_to_event (XCHAR (keystroke), XEVENT (event), con,
!NILP (use_console_meta_flag), 1);
}
return event;
{
const char *name = NULL;
+#ifdef HAVE_GTK
+ {
+ Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (event));
+ if (CONSOLE_GTK_P (XCONSOLE (console)))
+ name = gtk_event_name (event->event.magic.underlying_gdk_event.type);
+ }
+#endif
#ifdef HAVE_X_WINDOWS
{
Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (event));
case empty_event: strcpy (buf, "empty"); return;
case dead_event: strcpy (buf, "DEAD-EVENT"); return;
default:
- abort ();
+ ABORT ();
return;
}
#define modprint1(x) do { strcpy (buf, (x)); buf += sizeof (x)-1; } while (0)
}
}
else
- abort ();
+ ABORT ();
if (mouse_p)
strncpy (buf, "up", 4);
}
return Qempty;
default:
- abort ();
+ ABORT ();
return Qnil;
}
}
/* This junk is so that timestamps don't get to be negative, but contain
as many bits as this particular emacs will allow.
*/
- return make_int (((1L << (VALBITS - 1)) - 1) &
- XEVENT (event)->timestamp);
+ return make_int (EMACS_INT_MAX & XEVENT (event)->timestamp);
}
-#define TIMESTAMP_HALFSPACE (1L << (VALBITS - 2))
+#define TIMESTAMP_HALFSPACE (1L << (INT_VALBITS - 2))
DEFUN ("event-timestamp<", Fevent_timestamp_lessp, 2, 2, 0, /*
Return true if timestamp TIME1 is earlier than timestamp TIME2.
}
DEFUN ("event-button", Fevent_button, 1, 1, 0, /*
-Return the button-number of the given button-press or button-release event.
+Return the button-number of the button-press or button-release event EVENT.
*/
(event))
{
|| TOOLBAR_BUTTONP (ret_obj1)
#endif
))
- abort ();
+ ABORT ();
if (!NILP (ret_obj2) && !(EXTENTP (ret_obj2) || CONSP (ret_obj2)))
- abort ();
+ ABORT ();
if (char_x)
*char_x = ret_x;
}
DEFUN ("event-process", Fevent_process, 1, 1, 0, /*
-Return the process of the given process-output event.
+Return the process of the process-output event EVENT.
*/
(event))
{
switch (e->event_type)
{
- default: abort ();
+ default: ABORT ();
case process_event:
props = cons3 (Qprocess, e->event.process.process, props);