Skip to content

Commit 6c9eb40

Browse files
committed
Add some temporary logging to rootcause issues
1 parent aee0dc0 commit 6c9eb40

2 files changed

Lines changed: 89 additions & 9 deletions

File tree

src/gui/gtk.c

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -740,21 +740,45 @@ static gboolean _input_event(GtkWidget *widget,
740740
case GDK_TOUCHPAD_PINCH:
741741
case GDK_TOUCHPAD_SWIPE:
742742
_touchpad = gdk_event_get_source_device(event);
743+
if(_touchpad)
744+
{
745+
dt_print(DT_DEBUG_INPUT,
746+
"[touchpad] gesture event type=%d source='%s' source_type=%d",
747+
event->type,
748+
gdk_device_get_name(_touchpad),
749+
gdk_device_get_source(_touchpad));
750+
}
751+
else
752+
{
753+
dt_print(DT_DEBUG_INPUT,
754+
"[touchpad] gesture event type=%d without source device",
755+
event->type);
756+
}
743757
break;
744758
default:
745759
break;
746760
}
747761

748-
if(event->type == GDK_TOUCHPAD_PINCH)
749762
if(event->type == GDK_TOUCHPAD_PINCH && _touchpad_gestures_enabled())
750763
{
751764
const GdkEventTouchpadPinch *pinch = &event->touchpad_pinch;
765+
dt_print(DT_DEBUG_INPUT,
766+
"[touchpad] pinch x=%.2f y=%.2f phase=%d scale=%.6f state=0x%x",
767+
pinch->x, pinch->y, pinch->phase, pinch->scale, pinch->state);
752768
if(dt_view_manager_gesture_pinch(darktable.view_manager, pinch->x, pinch->y,
753769
pinch->phase, pinch->scale, pinch->state & 0xf))
754770
{
755771
gtk_widget_queue_draw(widget);
756772
return TRUE;
757773
}
774+
775+
dt_print(DT_DEBUG_INPUT,
776+
"[touchpad] pinch ignored by current view");
777+
}
778+
else if(event->type == GDK_TOUCHPAD_PINCH)
779+
{
780+
dt_print(DT_DEBUG_INPUT,
781+
"[touchpad] pinch received but disabled by preference darkroom/ui/touchpad_gestures");
758782
}
759783

760784
return FALSE;
@@ -766,31 +790,60 @@ static gboolean _scrolled(GtkWidget *widget,
766790
{
767791
(void)user_data;
768792
GdkDevice *device = gdk_event_get_source_device((GdkEvent *)event);
769-
770-
if(_touchpad_gestures_enabled()
771-
&& !dt_modifier_is(event->state, GDK_CONTROL_MASK)
772-
&& ((device && gdk_device_get_source(device) == GDK_SOURCE_TOUCHPAD)
773-
|| device == _touchpad)
793+
const gboolean touchpad_enabled = _touchpad_gestures_enabled();
794+
const gboolean ctrl_pressed = dt_modifier_is(event->state, GDK_CONTROL_MASK);
795+
const gboolean is_touchpad_source = device && gdk_device_get_source(device) == GDK_SOURCE_TOUCHPAD;
796+
const gboolean matches_last_gesture_device = (device == _touchpad);
797+
798+
if(touchpad_enabled
799+
&& !ctrl_pressed
800+
&& (is_touchpad_source || matches_last_gesture_device)
774801
&& event->direction == GDK_SCROLL_SMOOTH && !event->is_stop)
775802
{
776803
gdouble delta_x = 0.0, delta_y = 0.0;
777804
if(!dt_gui_get_scroll_deltas(event, &delta_x, &delta_y))
805+
{
806+
dt_print(DT_DEBUG_INPUT,
807+
"[touchpad] smooth scroll ignored (likely pointer emulated), source='%s' source_type=%d",
808+
device ? gdk_device_get_name(device) : "<none>",
809+
device ? gdk_device_get_source(device) : -1);
778810
return TRUE;
811+
}
779812

780813
delta_x *= DT_UI_SCROLL_SMOOTH_DELTA_SCALE;
781814
delta_y *= DT_UI_SCROLL_SMOOTH_DELTA_SCALE;
782815
if((delta_x != 0.0 || delta_y != 0.0)
783816
&& dt_view_manager_gesture_pan(darktable.view_manager, event->x, event->y,
784817
delta_x, delta_y, event->state & 0xf))
785818
{
819+
dt_print(DT_DEBUG_INPUT,
820+
"[touchpad] pan x=%.2f y=%.2f dx=%.3f dy=%.3f source='%s'",
821+
event->x, event->y, delta_x, delta_y,
822+
device ? gdk_device_get_name(device) : "<none>");
786823
gtk_widget_queue_draw(widget);
787824
return TRUE;
788825
}
789826
}
827+
else if(event->direction == GDK_SCROLL_SMOOTH && !event->is_stop)
828+
{
829+
dt_print(DT_DEBUG_INPUT,
830+
"[touchpad] smooth scroll not treated as pan: enabled=%d ctrl=%d touchpad_source=%d matches_last_gesture=%d source='%s' source_type=%d",
831+
touchpad_enabled,
832+
ctrl_pressed,
833+
is_touchpad_source,
834+
matches_last_gesture_device,
835+
device ? gdk_device_get_name(device) : "<none>",
836+
device ? gdk_device_get_source(device) : -1);
837+
}
790838

791839
int delta_y;
792840
if(dt_gui_get_scroll_unit_delta(event, &delta_y))
793841
{
842+
dt_print(DT_DEBUG_INPUT,
843+
"[scroll] discrete fallback x=%.2f y=%.2f up=%d state=0x%x source='%s' source_type=%d",
844+
event->x, event->y, delta_y < 0, event->state,
845+
device ? gdk_device_get_name(device) : "<none>",
846+
device ? gdk_device_get_source(device) : -1);
794847
dt_view_manager_scrolled(darktable.view_manager, event->x, event->y,
795848
delta_y < 0,
796849
event->state & 0xf);

src/views/darkroom.c

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4192,25 +4192,43 @@ gboolean gesture_pinch(dt_view_t *self,
41924192
{
41934193
dt_develop_t *dev = self->data;
41944194
if(!dev) return FALSE;
4195-
(void)state;
4195+
41964196
const double pinch_step_ratio = 1.1;
41974197

41984198
static double pinch_last_scale = 0.0;
41994199

42004200
if(phase == GDK_TOUCHPAD_GESTURE_PHASE_BEGIN)
42014201
{
42024202
pinch_last_scale = scale > 0.0 ? scale : 1.0;
4203+
dt_print(DT_DEBUG_INPUT,
4204+
"[darkroom pinch] begin x=%.2f y=%.2f scale=%.6f state=0x%x last=%.6f",
4205+
x, y, scale, state, pinch_last_scale);
42034206
return TRUE;
42044207
}
42054208
else if(phase == GDK_TOUCHPAD_GESTURE_PHASE_END
42064209
|| phase == GDK_TOUCHPAD_GESTURE_PHASE_CANCEL)
42074210
{
4211+
dt_print(DT_DEBUG_INPUT,
4212+
"[darkroom pinch] end/cancel phase=%d x=%.2f y=%.2f scale=%.6f state=0x%x",
4213+
phase, x, y, scale, state);
42084214
pinch_last_scale = 0.0;
42094215
return TRUE;
42104216
}
42114217

4212-
if(phase != GDK_TOUCHPAD_GESTURE_PHASE_UPDATE) return FALSE;
4213-
if(pinch_last_scale <= 0.0 || scale <= 0.0) return FALSE;
4218+
if(phase != GDK_TOUCHPAD_GESTURE_PHASE_UPDATE)
4219+
{
4220+
dt_print(DT_DEBUG_INPUT,
4221+
"[darkroom pinch] ignored phase=%d x=%.2f y=%.2f scale=%.6f state=0x%x",
4222+
phase, x, y, scale, state);
4223+
return FALSE;
4224+
}
4225+
if(pinch_last_scale <= 0.0 || scale <= 0.0)
4226+
{
4227+
dt_print(DT_DEBUG_INPUT,
4228+
"[darkroom pinch] invalid scale update last=%.6f scale=%.6f",
4229+
pinch_last_scale, scale);
4230+
return FALSE;
4231+
}
42144232

42154233
const double ratio = scale / pinch_last_scale;
42164234
int zoom_step = -1;
@@ -4221,9 +4239,18 @@ gboolean gesture_pinch(dt_view_t *self,
42214239

42224240
if(zoom_step >= 0)
42234241
{
4242+
dt_print(DT_DEBUG_INPUT,
4243+
"[darkroom pinch] zoom step=%d x=%.2f y=%.2f ratio=%.6f scale=%.6f last=%.6f",
4244+
zoom_step, x, y, ratio, scale, pinch_last_scale);
42244245
dt_dev_zoom_move(&dev->full, DT_ZOOM_SCROLL, 0.0f, zoom_step, x, y, FALSE);
42254246
pinch_last_scale = scale;
42264247
}
4248+
else
4249+
{
4250+
dt_print(DT_DEBUG_INPUT,
4251+
"[darkroom pinch] below threshold ratio=%.6f scale=%.6f last=%.6f",
4252+
ratio, scale, pinch_last_scale);
4253+
}
42274254

42284255
return TRUE;
42294256
}

0 commit comments

Comments
 (0)