X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/aa36c6d0c478a756cc0a9aca796cbf431be773ee..3b158d1150cbbffc77afef323008623ac5c3e169:/src/keyboard.c
diff --git a/src/keyboard.c b/src/keyboard.c
index fad04920e2..669e85518f 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -20,9 +20,6 @@ along with GNU Emacs. If not, see . */
#include
-#define BLOCKINPUT_INLINE EXTERN_INLINE
-#define KEYBOARD_INLINE EXTERN_INLINE
-
#include "sysstdio.h"
#include "lisp.h"
@@ -292,7 +289,7 @@ static struct input_event * volatile kbd_store_ptr;
at inopportune times. */
/* Symbols to head events. */
-Lisp_Object Qmouse_movement;
+static Lisp_Object Qmouse_movement;
static Lisp_Object Qscroll_bar_movement;
Lisp_Object Qswitch_frame;
static Lisp_Object Qfocus_in, Qfocus_out;
@@ -1699,7 +1696,6 @@ command_loop_1 (void)
Lisp_Object
read_menu_command (void)
{
- Lisp_Object cmd;
Lisp_Object keybuf[30];
ptrdiff_t count = SPECPDL_INDEX ();
int i;
@@ -2624,10 +2620,8 @@ read_char (int commandflag, Lisp_Object map,
if (/* There currently is something in the echo area. */
!NILP (echo_area_buffer[0])
- && (/* And it's either not from echoing. */
- !EQ (echo_area_buffer[0], echo_message_buffer)
- /* Or it's an echo from a different kboard. */
- || echo_kboard != current_kboard
+ && (/* It's an echo from a different kboard. */
+ echo_kboard != current_kboard
/* Or we explicitly allow overwriting whatever there is. */
|| ok_to_echo_at_next_pause == NULL))
cancel_echoing ();
@@ -4389,7 +4383,7 @@ decode_timer (Lisp_Object timer, struct timespec *result)
if (! (VECTORP (timer) && ASIZE (timer) == 9))
return 0;
- vector = XVECTOR (timer)->contents;
+ vector = XVECTOR (timer)->u.contents;
if (! NILP (vector[0]))
return 0;
@@ -5411,6 +5405,20 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
extra_info))));
}
+/* Return non-zero if F is a GUI frame that uses some toolkit-managed
+ menu bar. This really means that Emacs draws and manages the menu
+ bar as part of its normal display, and therefore can compute its
+ geometry. */
+static bool
+toolkit_menubar_in_use (struct frame *f)
+{
+#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NS) || defined (HAVE_NTGUI)
+ return !(!FRAME_WINDOW_P (f));
+#else
+ return false;
+#endif
+}
+
/* Given a struct input_event, build the lisp event which represents
it. If EVENT is 0, build a mouse movement event from the mouse
movement buffer, which should have a movement event in it.
@@ -5562,64 +5570,64 @@ make_lispy_event (struct input_event *event)
if (event->kind == MOUSE_CLICK_EVENT)
{
struct frame *f = XFRAME (event->frame_or_window);
-#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) && ! defined (HAVE_NS)
int row, column;
-#endif
/* Ignore mouse events that were made on frame that
have been deleted. */
if (! FRAME_LIVE_P (f))
return Qnil;
-#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) && ! defined (HAVE_NS)
/* EVENT->x and EVENT->y are frame-relative pixel
coordinates at this place. Under old redisplay, COLUMN
and ROW are set to frame relative glyph coordinates
which are then used to determine whether this click is
in a menu (non-toolkit version). */
- pixel_to_glyph_coords (f, XINT (event->x), XINT (event->y),
- &column, &row, NULL, 1);
-
- /* In the non-toolkit version, clicks on the menu bar
- are ordinary button events in the event buffer.
- Distinguish them, and invoke the menu.
-
- (In the toolkit version, the toolkit handles the menu bar
- and Emacs doesn't know about it until after the user
- makes a selection.) */
- if (row >= 0 && row < FRAME_MENU_BAR_LINES (f)
- && (event->modifiers & down_modifier))
+ if (!toolkit_menubar_in_use (f))
{
- Lisp_Object items, item;
-
- /* Find the menu bar item under `column'. */
- item = Qnil;
- items = FRAME_MENU_BAR_ITEMS (f);
- for (i = 0; i < ASIZE (items); i += 4)
+ pixel_to_glyph_coords (f, XINT (event->x), XINT (event->y),
+ &column, &row, NULL, 1);
+
+ /* In the non-toolkit version, clicks on the menu bar
+ are ordinary button events in the event buffer.
+ Distinguish them, and invoke the menu.
+
+ (In the toolkit version, the toolkit handles the
+ menu bar and Emacs doesn't know about it until
+ after the user makes a selection.) */
+ if (row >= 0 && row < FRAME_MENU_BAR_LINES (f)
+ && (event->modifiers & down_modifier))
{
- Lisp_Object pos, string;
- string = AREF (items, i + 1);
- pos = AREF (items, i + 3);
- if (NILP (string))
- break;
- if (column >= XINT (pos)
- && column < XINT (pos) + SCHARS (string))
+ Lisp_Object items, item;
+
+ /* Find the menu bar item under `column'. */
+ item = Qnil;
+ items = FRAME_MENU_BAR_ITEMS (f);
+ for (i = 0; i < ASIZE (items); i += 4)
{
- item = AREF (items, i);
- break;
+ Lisp_Object pos, string;
+ string = AREF (items, i + 1);
+ pos = AREF (items, i + 3);
+ if (NILP (string))
+ break;
+ if (column >= XINT (pos)
+ && column < XINT (pos) + SCHARS (string))
+ {
+ item = AREF (items, i);
+ break;
+ }
}
- }
- /* ELisp manual 2.4b says (x y) are window relative but
- code says they are frame-relative. */
- position = list4 (event->frame_or_window,
- Qmenu_bar,
- Fcons (event->x, event->y),
- make_number (event->timestamp));
+ /* ELisp manual 2.4b says (x y) are window
+ relative but code says they are
+ frame-relative. */
+ position = list4 (event->frame_or_window,
+ Qmenu_bar,
+ Fcons (event->x, event->y),
+ make_number (event->timestamp));
- return list2 (item, position);
+ return list2 (item, position);
+ }
}
-#endif /* not USE_X_TOOLKIT && not USE_GTK && not HAVE_NS */
position = make_lispy_position (f, event->x, event->y,
event->timestamp);
@@ -7138,7 +7146,8 @@ process_pending_signals (void)
}
/* Undo any number of BLOCK_INPUT calls down to level LEVEL,
- and also (if the level is now 0) reinvoke any pending signal. */
+ and reinvoke any pending signal if the level is now 0 and
+ a fatal error is not already in progress. */
void
unblock_input_to (int level)
@@ -7146,7 +7155,7 @@ unblock_input_to (int level)
interrupt_input_blocked = level;
if (level == 0)
{
- if (pending_signals)
+ if (pending_signals && !fatal_error_in_progress)
process_pending_signals ();
}
else if (level < 0)
@@ -8046,7 +8055,7 @@ process_tool_bar_item (Lisp_Object key, Lisp_Object def, Lisp_Object data, void
discard any previously made item. */
for (i = 0; i < ntool_bar_items; i += TOOL_BAR_ITEM_NSLOTS)
{
- Lisp_Object *v = XVECTOR (tool_bar_items_vector)->contents + i;
+ Lisp_Object *v = XVECTOR (tool_bar_items_vector)->u.contents + i;
if (EQ (key, v[TOOL_BAR_ITEM_KEY]))
{
@@ -8370,7 +8379,7 @@ append_tool_bar_item (void)
/* Append entries from tool_bar_item_properties to the end of
tool_bar_items_vector. */
vcopy (tool_bar_items_vector, ntool_bar_items,
- XVECTOR (tool_bar_item_properties)->contents, TOOL_BAR_ITEM_NSLOTS);
+ XVECTOR (tool_bar_item_properties)->u.contents, TOOL_BAR_ITEM_NSLOTS);
ntool_bar_items += TOOL_BAR_ITEM_NSLOTS;
}
@@ -9921,20 +9930,7 @@ detect_input_pending_run_timers (bool do_display)
get_input_pending (READABLE_EVENTS_DO_TIMERS_NOW);
if (old_timers_run != timers_run && do_display)
- {
- redisplay_preserve_echo_area (8);
- /* The following fixes a bug when using lazy-lock with
- lazy-lock-defer-on-the-fly set to t, i.e. when fontifying
- from an idle timer function. The symptom of the bug is that
- the cursor sometimes doesn't become visible until the next X
- event is processed. --gerd. */
- {
- Lisp_Object tail, frame;
- FOR_EACH_FRAME (tail, frame)
- if (FRAME_RIF (XFRAME (frame)))
- FRAME_RIF (XFRAME (frame))->flush_display (XFRAME (frame));
- }
- }
+ redisplay_preserve_echo_area (8);
return input_pending;
}
@@ -9985,7 +9981,7 @@ DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0,
doc: /* Return vector of last 300 events, not counting those from keyboard macros. */)
(void)
{
- Lisp_Object *keys = XVECTOR (recent_keys)->contents;
+ Lisp_Object *keys = XVECTOR (recent_keys)->u.contents;
Lisp_Object val;
if (total_keys < NUM_RECENT_KEYS)
@@ -10011,7 +10007,7 @@ See also `this-command-keys-vector'. */)
(void)
{
return make_event_array (this_command_key_count,
- XVECTOR (this_command_keys)->contents);
+ XVECTOR (this_command_keys)->u.contents);
}
DEFUN ("this-command-keys-vector", Fthis_command_keys_vector, Sthis_command_keys_vector, 0, 0, 0,
@@ -10023,7 +10019,7 @@ See also `this-command-keys'. */)
(void)
{
return Fvector (this_command_key_count,
- XVECTOR (this_command_keys)->contents);
+ XVECTOR (this_command_keys)->u.contents);
}
DEFUN ("this-single-command-keys", Fthis_single_command_keys,
@@ -10038,7 +10034,7 @@ The value is always a vector. */)
{
return Fvector (this_command_key_count
- this_single_command_key_start,
- (XVECTOR (this_command_keys)->contents
+ (XVECTOR (this_command_keys)->u.contents
+ this_single_command_key_start));
}
@@ -10052,8 +10048,7 @@ shows the events before all translations (except for input methods).
The value is always a vector. */)
(void)
{
- return Fvector (raw_keybuf_count,
- (XVECTOR (raw_keybuf)->contents));
+ return Fvector (raw_keybuf_count, XVECTOR (raw_keybuf)->u.contents);
}
DEFUN ("reset-this-command-lengths", Freset_this_command_lengths,