@@ -73,6 +73,11 @@ gboolean dt_iop_color_picker_is_visible(const dt_develop_t *dev)
7373 return module_picker || primary_picker ;
7474}
7575
76+ gboolean dt_iop_color_picker_is_area_empty (const dt_pickerbox_t box )
77+ {
78+ return (fabsf (box [2 ] - box [0 ]) < 1e-5f || fabsf (box [3 ] - box [1 ]) < 1e-5f );
79+ }
80+
7681static gboolean _record_point_area (dt_iop_color_picker_t * self )
7782{
7883 const dt_colorpicker_sample_t * const sample =
@@ -201,7 +206,13 @@ static gboolean _color_picker_callback_button_press(GtkWidget *button,
201206 // pull picker's last recorded positions
202207 if (kind & DT_COLOR_PICKER_AREA )
203208 {
204- if ( self -> pick_box [0 ] == 0.0f && self -> pick_box [1 ] == 0.0f
209+ if (flags & DT_COLOR_PICKER_NO_AUTO )
210+ {
211+ // reset coordinates to 0.0f to create a zero-area box,
212+ // requiring the user to drag-select manually
213+ memset (self -> pick_box , 0 , sizeof (self -> pick_box ));
214+ }
215+ else if ( self -> pick_box [0 ] == 0.0f && self -> pick_box [1 ] == 0.0f
205216 && self -> pick_box [2 ] == 1.0f && self -> pick_box [3 ] == 1.0f )
206217 {
207218 dt_boundingbox_t reset = { 0.02f , 0.02f , 0.98f , 0.98f };
@@ -317,6 +328,13 @@ static void _iop_color_picker_pickerdata_ready_callback(gpointer instance,
317328 // iops only need new picker data if the pointer has moved
318329 if (_record_point_area (picker ))
319330 {
331+ // in Area mode, ignore updates where the area is empty (e.g. when using DT_COLOR_PICKER_NO_AUTO
332+ // and the user has not started dragging yet)
333+ if ((picker -> flags & DT_COLOR_PICKER_AREA ) && dt_iop_color_picker_is_area_empty (picker -> pick_box ))
334+ {
335+ return ;
336+ }
337+
320338 if (!module -> blend_data || !blend_color_picker_apply (module , picker -> colorpick , pipe ))
321339 {
322340 if (module -> color_picker_apply )
0 commit comments