void
WaitForChoice (struct font_selection_dialog_message *msg,
- void (*process_pending_signals_function) (void))
+ void (*process_pending_signals_function) (void),
+ bool (*should_quit_function) (void))
{
int32 reply_type;
struct object_wait_info infos[2];
if (infos[0].events & B_EVENT_READ)
process_pending_signals_function ();
+ if (should_quit_function ())
+ goto cancel;
+
infos[0].events = B_EVENT_READ;
infos[1].events = B_EVENT_READ;
}
bool
be_select_font (void (*process_pending_signals_function) (void),
+ bool (*should_quit_function) (void),
haiku_font_family_or_style *family,
haiku_font_family_or_style *style,
bool allow_monospace_only)
}
dialog->Show ();
- dialog->WaitForChoice (&msg, process_pending_signals_function);
+ dialog->WaitForChoice (&msg, process_pending_signals_function,
+ should_quit_function);
if (!dialog->LockLooper ())
gui_abort ("Failed to lock font selection dialog looper");
extern bool be_drag_and_drop_in_progress (void);
extern bool be_replay_menu_bar_event (void *, struct haiku_menu_bar_click_event *);
-extern bool be_select_font (void (*process_pending_signals_function) (void),
+extern bool be_select_font (void (*) (void), bool (*) (void),
haiku_font_family_or_style *,
haiku_font_family_or_style *, bool);
#ifdef __cplusplus
.list_family = haikufont_list_family
};
+static bool
+haikufont_should_quit_popup (void)
+{
+ return !NILP (Vquit_flag);
+}
+
DEFUN ("x-select-font", Fx_select_font, Sx_select_font, 0, 2, 0,
doc: /* Read a font using a native dialog.
Return a font spec describing the font chosen by the user.
error ("Trying to use a menu from within a menu-entry");
popup_activated_p++;
- rc = be_select_font (process_pending_signals, &family, &style,
+ rc = be_select_font (process_pending_signals,
+ haikufont_should_quit_popup,
+ &family, &style,
!NILP (exclude_proportional));
popup_activated_p--;