Author: AlbrechtS
Date: 2009-04-13 15:47:21 -0700 (Mon, 13 Apr 2009)
New Revision: 6763
Log:
Modified fix for STR #2150, as discussed, and added Fl::pushed(0) in
innards() to prevent multiple popup dialogs from callbacks when dragging
valuators (STR #2159).
Modified:
branches/branch-1.3/CHANGES
branches/branch-1.3/src/fl_ask.cxx
Modified: branches/branch-1.3/CHANGES
===================================================================
--- branches/branch-1.3/CHANGES 2009-04-13 18:53:24 UTC (rev 6762)
+++ branches/branch-1.3/CHANGES 2009-04-13 22:47:21 UTC (rev 6763)
@@ -1,9 +1,11 @@
CHANGES IN FLTK 1.3.0
+ - Fix for multiple popups, when dragging and calling fl_alert()
+ and friends from the callback (STR #2159)
+ - Avoiding crashes for recursive common dialogs (this does not
+ fix the issue at hand yet) (STR #1986, 2150)
- Added OS X cursor control to Fl_Input (STR #2169)
- Fixed control key keycodes with modifiers on OS X
- - Avoiding crashes for recursive common dialogs (this does not
- fix the issue at hand yet) (STR #1986, 2150)
- Added menu shortcut alignment for OS X
- Fixed bad system menu hadling in OS X (STR #2153)
- Fixed File Input mouse pointer dragging (STR #2181)
Modified: branches/branch-1.3/src/fl_ask.cxx
===================================================================
--- branches/branch-1.3/src/fl_ask.cxx 2009-04-13 18:53:24 UTC (rev 6762)
+++ branches/branch-1.3/src/fl_ask.cxx 2009-04-13 22:47:21 UTC (rev 6763)
@@ -56,6 +56,8 @@
Fl_Font fl_message_font_ = FL_HELVETICA;
Fl_Fontsize fl_message_size_ = 14;
+static char avoidRecursion = 0;
+
static Fl_Window *makeform() {
if (message_form) {
message_form->size(410,103);
@@ -176,8 +178,8 @@
const char *b1,
const char *b2)
{
- static char avoidRecursion = 0;
- if (avoidRecursion) return -1;
+ Fl::pushed(0); // stop dragging (STR #2159)
+
avoidRecursion = 1;
makeform();
@@ -215,7 +217,7 @@
Fl_Window* g = Fl::grab();
if (g) // do an alternative grab to avoid floating menus, if possible
Fl::grab(message_form);
- int r;
+ int r = 0;
for (;;) {
Fl_Widget *o = Fl::readqueue();
if (!o) Fl::wait();
@@ -296,11 +298,14 @@
/** Shows an information message dialog box.
\note Common dialog boxes are application modal. No more than one common
dialog box
- can be open at any time. Request for additional dialog boxes are ignored.
+ can be open at any time. Requests for additional dialog boxes are ignored.
\param[in] fmt can be used as an sprintf-like format and variables for the
message text
*/
void fl_message(const char *fmt, ...) {
+
+ if (avoidRecursion) return;
+
va_list ap;
fl_beep(FL_BEEP_MESSAGE);
@@ -315,11 +320,14 @@
/** Shows an alert message dialog box
\note Common dialog boxes are application modal. No more than one common
dialog box
- can be open at any time. Request for additional dialog boxes are ignored.
+ can be open at any time. Requests for additional dialog boxes are ignored.
\param[in] fmt can be used as an sprintf-like format and variables for the
message text
*/
void fl_alert(const char *fmt, ...) {
+
+ if (avoidRecursion) return;
+
va_list ap;
fl_beep(FL_BEEP_ERROR);
@@ -334,13 +342,16 @@
this dialog features 2 yes/no buttons
\note Common dialog boxes are application modal. No more than one common
dialog box
- can be open at any time. Request for additional dialog boxes are ignored.
+ can be open at any time. Requests for additional dialog boxes are ignored.
\param[in] fmt can be used as an sprintf-like format and variables for the
message text
\retval 0 if the no button is selected or another dialog box is still open
\retval 1 if yes is selected
*/
int fl_ask(const char *fmt, ...) {
+
+ if (avoidRecursion) return 0;
+
va_list ap;
fl_beep(FL_BEEP_QUESTION);
@@ -356,7 +367,7 @@
this dialog features up to 3 customizable choice buttons
\note Common dialog boxes are application modal. No more than one common
dialog box
- can be open at any time. Request for additional dialog boxes are ignored.
+ can be open at any time. Requests for additional dialog boxes are ignored.
\param[in] fmt can be used as an sprintf-like format and variables for the
message text
\param[in] b0 text label of button 0
@@ -367,6 +378,9 @@
\retval 2 if the third button with \p b2 text is selected
*/
int fl_choice(const char*fmt,const char *b0,const char *b1,const char *b2,...){
+
+ if (avoidRecursion) return 0;
+
va_list ap;
fl_beep(FL_BEEP_QUESTION);
@@ -400,13 +414,16 @@
/** Shows an input dialog displaying the \p fmt message
\note Common dialog boxes are application modal. No more than one common
dialog box
- can be open at any time. Request for additional dialog boxes are ignored.
+ can be open at any time. Requests for additional dialog boxes are ignored.
\param[in] fmt can be used as an sprintf-like format and variables for the
message text
\param[in] defstr defines the default returned string if no text is entered
\return the user string input if OK was pushed, NULL if Cancel was pushed
or another dialog box was still open
*/
const char* fl_input(const char *fmt, const char *defstr, ...) {
+
+ if (avoidRecursion) return 0;
+
fl_beep(FL_BEEP_QUESTION);
va_list ap;
@@ -422,13 +439,16 @@
'*' characters are displayed instead.
\note Common dialog boxes are application modal. No more than one common
dialog box
- can be open at any time. Request for additional dialog boxes are ignored.
+ can be open at any time. Requests for additional dialog boxes are ignored.
\param[in] fmt can be used as an sprintf-like format and variables for the
message text
\param[in] defstr defines the default returned string if no text is entered
\return the user string input if OK was pushed, NULL if Cancel was pushed
or aother dialog box was still open
*/
const char *fl_password(const char *fmt, const char *defstr, ...) {
+
+ if (avoidRecursion) return 0;
+
fl_beep(FL_BEEP_PASSWORD);
va_list ap;
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit