mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-19 01:10:57 -08:00
Make quitting actually work in Haiku file dialogs
* src/haiku_support.h: (be_popup_file_dialog) * src/haiku_support.cc (be_popup_file_dialog): New parameter `maybe_quit_function'. * src/haikufns.c (Fhaiku_read_file_name): Pass `maybe_quit' as the maybe_quit_function.
This commit is contained in:
parent
1d3020908b
commit
af729b1dfd
3 changed files with 14 additions and 5 deletions
|
|
@ -2624,7 +2624,8 @@ char *
|
|||
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. */
|
||||
|
|
@ -2635,7 +2636,6 @@ be_popup_file_dialog (int open_p, const char *default_dir, int must_match_p, int
|
|||
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;
|
||||
|
|
@ -2660,6 +2660,7 @@ be_popup_file_dialog (int open_p, const char *default_dir, int must_match_p, int
|
|||
|
||||
panel->Show ();
|
||||
panel->Window ()->Show ();
|
||||
unblock_input_function ();
|
||||
|
||||
void *buf = alloca (200);
|
||||
while (1)
|
||||
|
|
@ -2669,19 +2670,26 @@ be_popup_file_dialog (int open_p, const char *default_dir, int must_match_p, int
|
|||
|
||||
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 ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -740,7 +740,8 @@ extern "C"
|
|||
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 *);
|
||||
|
|
|
|||
|
|
@ -2236,7 +2236,7 @@ Optional arg SAVE_TEXT, if non-nil, specifies some text to show in the entry fie
|
|||
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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue