FLUID: minor fixes

This commit is contained in:
Matthias Melcher 2023-08-29 22:50:07 +02:00
parent be657471e7
commit b5a1da9612
5 changed files with 15 additions and 6 deletions

View File

@ -455,7 +455,9 @@ enum Fl_Callback_Reason {
FL_REASON_CHANGED, ///< the value of the widget was modified
FL_REASON_GOT_FOCUS, ///< a widget received focus
FL_REASON_LOST_FOCUS, ///< a widget lost focus
FL_REASON_RELEASED ///< the mouse button was released
FL_REASON_RELEASED, ///< the mouse button was released
FL_REASON_ENTER_KEY, ///< user finished input pressing Enter
FL_REASON_USER = 32 ///< user defined callback reasons
};
/**@}*/ // group: Callback Reasons

View File

@ -134,6 +134,11 @@ const char * const fl_callback_reason_names[] =
"FL_REASON_GOT_FOCUS",
"FL_REASON_LOST_FOCUS",
"FL_REASON_RELEASED",
"FL_REASON_ENTER_KEY",
NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
"FL_REASON_USER", "FL_REASON_USER+1", "FL_REASON_USER+2", "FL_REASON_USER+3",
};
/** @} */

View File

@ -405,7 +405,8 @@ void label_cb(Fl_Input* i, void *v) {
undo_resume();
if (mod) set_modflag(1);
}
if ( (Fl::event() == FL_HIDE) || (Fl::event() == FL_UNFOCUS) )
int r = (int)Fl::callback_reason();
if ( (r == FL_REASON_LOST_FOCUS) || (r == FL_REASON_ENTER_KEY) )
first_change = 1;
}
}
@ -2502,7 +2503,7 @@ void propagate_load(Fl_Group* g, void* v) {
Fl_Widget*const* a = g->array();
for (int i=g->children(); i--;) {
Fl_Widget* o = *a++;
o->do_callback(o,LOAD);
o->do_callback(o, LOAD, FL_REASON_USER);
}
}
}

View File

@ -160,14 +160,15 @@ void undo_cb(Fl_Widget *, void *) {
// Save current file to undo buffer
void undo_checkpoint() {
int undo_item = main_menubar->find_index(undo_cb);
int redo_item = main_menubar->find_index(redo_cb);
// printf("undo_checkpoint(): undo_current=%d, undo_paused=%d, modflag=%d\n",
// undo_current, undo_paused, modflag);
// Don't checkpoint if undo_suspend() has been called...
if (undo_paused) return;
int undo_item = main_menubar->find_index(undo_cb);
int redo_item = main_menubar->find_index(redo_cb);
// Save the current UI to a checkpoint file...
const char *filename = undo_filename(undo_current);
if (!write_file(filename)) {

View File

@ -409,7 +409,7 @@ int Fl_Input::handle_key() {
case FL_KP_Enter:
if (when() & FL_WHEN_ENTER_KEY) {
insert_position(size(), 0);
maybe_do_callback();
maybe_do_callback(FL_REASON_ENTER_KEY);
return 1;
} else if (multiline && !readonly()) {
return replace(insert_position(), mark(), "\n", 1);