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 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
#include <stdio.h>
#include "lisp.h"
+#include "frame.h"
#include "termhooks.h"
#include "keyboard.h"
#include "keymap.h"
-#include "frame.h"
#include "window.h"
#include "blockinput.h"
#include "buffer.h"
static void
grow_menu_items ()
{
- Lisp_Object old;
- int old_size = menu_items_allocated;
- old = menu_items;
-
menu_items_allocated *= 2;
-
- menu_items = Fmake_vector (make_number (menu_items_allocated), Qnil);
- bcopy (XVECTOR (old)->contents, XVECTOR (menu_items)->contents,
- old_size * sizeof (Lisp_Object));
+ menu_items = larger_vector (menu_items, menu_items_allocated, Qnil);
}
/* Begin a submenu. */
enum scroll_bar_part part;
unsigned long time;
- if (mouse_position_hook)
- (*mouse_position_hook) (&new_f, 1, &bar_window,
+ if (FRAME_TERMINAL (new_f)->mouse_position_hook)
+ (*FRAME_TERMINAL (new_f)->mouse_position_hook) (&new_f, 1, &bar_window,
&part, &x, &y, &time);
if (new_f != 0)
XSETFRAME (window, new_f);
((value) + DIALOG_BUTTON_COMMAND_ID_OFFSET)
extern EMACS_TIME timer_check P_ ((int));
+static int quit_dialog_event_loop;
static pascal OSStatus
mac_handle_dialog_event (next_handler, event, data)
{
OSStatus err, result = eventNotHandledErr;
WindowRef window = (WindowRef) data;
- int quit_event_loop_p = 0;
switch (GetEventClass (event))
{
if (DIALOG_BUTTON_COMMAND_ID_P (command.commandID))
{
SetWRefCon (window, command.commandID);
- quit_event_loop_p = 1;
+ quit_dialog_event_loop = 1;
break;
}
switch (char_code)
{
case kEscapeCharCode:
- quit_event_loop_p = 1;
+ quit_dialog_event_loop = 1;
break;
default:
NULL, &key_code);
if (err == noErr)
if (mac_quit_char_key_p (modifiers, key_code))
- quit_event_loop_p = 1;
+ quit_dialog_event_loop = 1;
}
break;
}
abort ();
}
- if (quit_event_loop_p)
+ if (quit_dialog_event_loop)
{
err = QuitEventLoop (GetCurrentEventLoop ());
if (err == noErr)
{
EventTargetRef toolbox_dispatcher = GetEventDispatcherTarget ();
+ quit_dialog_event_loop = 0;
while (1)
{
EMACS_TIME next_time = timer_check (1);
SendEventToEventTarget (event, toolbox_dispatcher);
ReleaseEvent (event);
}
+#ifdef MAC_OSX
else if (err != eventLoopTimedOutErr)
{
if (err == eventLoopQuitErr)
err = noErr;
break;
}
+#else
+ /* The return value of ReceiveNextEvent seems to be
+ unreliable. Use our own global variable instead. */
+ if (quit_dialog_event_loop)
+ {
+ err = noErr;
+ break;
+ }
+#endif
}
}
if (err == noErr)