X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fevents.c;h=d445146bf56c1c7b91c0aff5952195f5e8688f97;hb=7c1dff53c61110634f084d4ce395b6fd01cfef69;hp=1e5f9db5a3dbe51a6b5421933e0f037a9e40545e;hpb=59eec5f21669e81977b5b1fe9bf717cab49cf7fb;p=chise%2Fxemacs-chise.git.1 diff --git a/src/events.c b/src/events.c index 1e5f9db..d445146 100644 --- a/src/events.c +++ b/src/events.c @@ -30,7 +30,8 @@ Boston, MA 02111-1307, USA. */ #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" @@ -124,7 +125,7 @@ mark_event (Lisp_Object obj) case dead_event: break; default: - abort (); + ABORT (); } mark_object (event->channel); return event->next; @@ -218,7 +219,7 @@ event_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) /* 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); @@ -268,6 +269,12 @@ event_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) { 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 == @@ -284,7 +291,7 @@ event_equal (Lisp_Object obj1, Lisp_Object obj2, int depth) &e2->event.magic.underlying_mswindows_event, sizeof (union magic_data))); #endif - abort (); + ABORT (); return 1; /* not reached */ } @@ -338,6 +345,10 @@ event_hash (Lisp_Object obj, int depth) 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); @@ -350,7 +361,7 @@ event_hash (Lisp_Object obj, int depth) if (CONSOLE_MSWINDOWS_P (con)) return HASH2 (hash, e->event.magic.underlying_mswindows_event); #endif - abort (); + ABORT (); return 0; } @@ -359,7 +370,7 @@ event_hash (Lisp_Object obj, int depth) return hash; default: - abort (); + ABORT (); } return 0; /* unreached */ @@ -675,7 +686,7 @@ WARNING: the event object returned may be a reused one; see the function e->event.misc.y = coord_y; break; default: - abort(); + ABORT(); } } @@ -736,18 +747,18 @@ that it is safe to do so. 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 */ @@ -762,11 +773,11 @@ that it is safe to do so. } 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)) { @@ -814,7 +825,7 @@ deallocate_event_chain (Lisp_Object event_chain) /* 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) @@ -901,7 +912,7 @@ event_chain_count (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 @@ -917,7 +928,7 @@ event_chain_find_previous (Lisp_Object event_chain, Lisp_Object event) event_chain = XEVENT_NEXT (event_chain); } - abort (); + ABORT (); return Qnil; } @@ -1071,7 +1082,7 @@ event_to_character (Lisp_Event *event, 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 */ @@ -1145,46 +1156,48 @@ Note that specifying both ALLOW-META and ALLOW-NON-ASCII is ambiguous, as } 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; @@ -1267,6 +1280,13 @@ format_event_object (char *buf, Lisp_Event *event, int brief) { 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)); @@ -1287,7 +1307,7 @@ format_event_object (char *buf, Lisp_Event *event, int brief) 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) @@ -1339,7 +1359,7 @@ format_event_object (char *buf, Lisp_Event *event, int brief) } } else - abort (); + ABORT (); if (mouse_p) strncpy (buf, "up", 4); } @@ -1445,7 +1465,7 @@ empty The event has been allocated but not assigned. return Qempty; default: - abort (); + ABORT (); return Qnil; } } @@ -1463,11 +1483,10 @@ See also `current-event-timestamp'. /* 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. @@ -1527,7 +1546,7 @@ This will be a character if the event is associated with one, else a symbol. } 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)) { @@ -1839,9 +1858,9 @@ event_pixel_translation (Lisp_Object event, int *char_x, int *char_y, || 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; @@ -2122,7 +2141,7 @@ If the event did not occur over a toolbar button, nil is returned. } 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)) { @@ -2192,7 +2211,7 @@ This is in the form of a property list (alternating keyword/value pairs). switch (e->event_type) { - default: abort (); + default: ABORT (); case process_event: props = cons3 (Qprocess, e->event.process.process, props);