Skip to content

Commit 7782cd2

Browse files
jenshannoschwalmTurboGit
authored andcommitted
Fix mask manager handling
For UI responsivness we want to avoid further processing if possible, so we do some tests and possibly return immediately. *module is either the module having focus or the mask manager (module == NULL) We can skip further processing if we have 1. a module and it's not enabled 2. the mask manager and it is not expanded
1 parent 4e4d718 commit 7782cd2

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

src/develop/masks/masks.c

+18-7
Original file line numberDiff line numberDiff line change
@@ -1095,23 +1095,34 @@ gboolean dt_masks_events_mouse_enter(dt_iop_module_t *module)
10951095
return FALSE;
10961096
}
10971097

1098+
// return true in case of something has been exposed
10981099
gboolean dt_masks_events_mouse_moved(dt_iop_module_t *module,
10991100
const float pzx,
11001101
const float pzy,
11011102
const double pressure,
11021103
const int which,
11031104
const float zoom_scale)
11041105
{
1105-
// if the module is disabled, formms aren't being shown, so there's no point
1106-
// in passing along mouse events to them
1107-
if(!module || !module->enabled)
1108-
return FALSE;
1106+
/* For UI responsivness we want to avoid further processing if possible,
1107+
so we do some tests and possibly return immediately.
1108+
*module is either the module having focus or the mask manager (module == NULL)
1109+
1110+
We can skip further processing if we have
1111+
1. a module and it's not enabled
1112+
2. the mask manager and it is not expanded
1113+
*/
1114+
const gboolean skipped = (module && !module->enabled)
1115+
|| (!module && !dt_lib_gui_get_expanded(dt_lib_get_module("masks")));
1116+
dt_print(DT_DEBUG_VERBOSE,
1117+
"[dt_masks_events_mouse_moved] %s %s",
1118+
module ? module->so->op : "mask manager",
1119+
skipped ? "skipped" : "");
1120+
1121+
if(skipped) return FALSE;
11091122

1110-
// record mouse position even if there are no masks visible
11111123
dt_masks_form_gui_t *gui = darktable.develop->form_gui;
11121124
dt_masks_form_t *form = darktable.develop->form_visible;
11131125

1114-
11151126
if(gui)
11161127
{
11171128
// This assume that if this event is generated the mouse is over
@@ -1128,7 +1139,7 @@ gboolean dt_masks_events_mouse_moved(dt_iop_module_t *module,
11281139

11291140
if(gui) _set_hinter_message(gui, form);
11301141

1131-
return rep;
1142+
return rep != 0;
11321143
}
11331144

11341145
gboolean dt_masks_events_button_released(dt_iop_module_t *module,

0 commit comments

Comments
 (0)