be_popup_file_dialog (int open_p, const char *default_dir, int must_match_p, int dir_only_p,
void *window, const char *save_text, const char *prompt,
void (*block_input_function) (void),
- void (*unblock_input_function) (void))
+ void (*unblock_input_function) (void),
+ void (*maybe_quit_function) (void))
{
ptrdiff_t idx = c_specpdl_idx_from_cxx ();
/* setjmp/longjmp is UB with automatic objects. */
BMessage *msg = new BMessage ('FPSE');
BFilePanel *panel = new BFilePanel (open_p ? B_OPEN_PANEL : B_SAVE_PANEL,
NULL, NULL, mode);
- unblock_input_function ();
struct popup_file_dialog_data dat;
dat.entry = path;
panel->Show ();
panel->Window ()->Show ();
+ unblock_input_function ();
void *buf = alloca (200);
while (1)
if (!haiku_read_with_timeout (&type, buf, 200, 100000))
{
+ block_input_function ();
if (type != FILE_PANEL_EVENT)
haiku_write (type, buf);
else if (!ptr)
ptr = (char *) ((struct haiku_file_panel_event *) buf)->ptr;
+ unblock_input_function ();
+
+ maybe_quit_function ();
}
ssize_t b_s;
+ block_input_function ();
haiku_read_size (&b_s);
- if (!b_s || b_s == -1 || ptr || panel->Window ()->IsHidden ())
+ if (!b_s || ptr || panel->Window ()->IsHidden ())
{
c_unbind_to_nil_from_cxx (idx);
+ unblock_input_function ();
return ptr;
}
+ unblock_input_function ();
}
}
int dir_only_p, void *window, const char *save_text,
const char *prompt,
void (*block_input_function) (void),
- void (*unblock_input_function) (void));
+ void (*unblock_input_function) (void),
+ void (*maybe_quit_function) (void));
extern void
record_c_unwind_protect_from_cxx (void (*) (void *), void *);
FRAME_HAIKU_WINDOW (f),
!NILP (save_text) ? SSDATA (ENCODE_UTF_8 (save_text)) : NULL,
SSDATA (ENCODE_UTF_8 (prompt)),
- block_input, unblock_input);
+ block_input, unblock_input, maybe_quit);
unbind_to (idx, Qnil);