Fix Linux/Unix potential program hang when dialog pops up while a menu is open (STR #3179).
This patch does not fix all issues though. The hang does not happen anymore, but with some WM's the dialog can show up underneath the menu. This needs more investigation, but this fixes the more important issue. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10550 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
62ed929ea5
commit
eebda637fa
@ -3,7 +3,7 @@
|
||||
//
|
||||
// File chooser widget for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
// Copyright 1998-2010 by Bill Spitzak and others.
|
||||
// Copyright 1998-2015 by Bill Spitzak and others.
|
||||
//
|
||||
// This library is free software. Distribution and use rights are outlined in
|
||||
// the file "COPYING" which should have been included with this file. If this
|
||||
@ -33,6 +33,22 @@ static void callback(Fl_File_Chooser *, void*) {
|
||||
(*current_callback)(fc->value());
|
||||
}
|
||||
|
||||
// Pop up a file chooser dialog window and wait until it is closed...
|
||||
static void popup(Fl_File_Chooser *fc) {
|
||||
fc->show();
|
||||
|
||||
// deactivate Fl::grab(), because it is incompatible with modal windows
|
||||
Fl_Window* g = Fl::grab();
|
||||
if (g) Fl::grab(0);
|
||||
|
||||
while (fc->shown())
|
||||
Fl::wait();
|
||||
|
||||
if (g) // regrab the previous popup menu, if there was one
|
||||
Fl::grab(g);
|
||||
}
|
||||
|
||||
|
||||
/** \addtogroup group_comdlg
|
||||
@{ */
|
||||
|
||||
@ -130,11 +146,7 @@ fl_file_chooser(const char *message, // I - Message in titlebar
|
||||
}
|
||||
|
||||
fc->ok_label(current_label);
|
||||
fc->show();
|
||||
|
||||
while (fc->shown())
|
||||
Fl::wait();
|
||||
|
||||
popup(fc);
|
||||
if (fc->value() && relative) {
|
||||
fl_filename_relative(retname, sizeof(retname), fc->value());
|
||||
|
||||
@ -171,10 +183,7 @@ fl_dir_chooser(const char *message, // I - Message for titlebar
|
||||
fc->label(message);
|
||||
}
|
||||
|
||||
fc->show();
|
||||
|
||||
while (fc->shown())
|
||||
Fl::wait();
|
||||
popup(fc);
|
||||
|
||||
if (fc->value() && relative) {
|
||||
fl_filename_relative(retname, sizeof(retname), fc->value());
|
||||
|
Loading…
Reference in New Issue
Block a user