GNOME Bugzilla – Bug 792876
Cannot add bookmark with a touch device
Last modified: 2018-01-24 20:57:38 UTC
Using a tablet it is not possible to add a new bookmark. Every press on the star in the location bar does nothing.
In ephy-location-entry.c we register a button press event callback icon_button_press_event_cb, which emits the lock-clicked and bookmark-clicked signals. I guess we need a touch event callback as well.
Also (of course) for the primary icon within the entry. Double checked it: occures on wayland and on x.
Beside the fact that it is very hard to hit those buttons with a finger i could debug it: - It receives a GDK_TOUCH_BEGIN for the finger - That's why the check for GDK_BUTTON_PRESS with button == 1 fails - Adjusting it to check also for GDK_TOUCH_BEGIN works fine. - Not sure if this is the correct solution...
Created attachment 367394 [details] [review] Allow prmary and secondary actions to be opened with touch Adding the patch. Regarding my above comment: It is the correct patch as the callback delivers a GdkEvent and the my assumption that it is always a button event is false. Time for a rest :)
Review of attachment 367394 [details] [review]: Thanks for fixing touch! I was thinking this was a handler for GtkWidget::button-press-event, and was going to complain that getting a touch event here was crazy. But it's not, it's a handler for GtkEntry::icon-press. That's exceptionally confusing! So this makes sense. But can you additionally attach another patch to rename icon_button_press_event_cb() to icon_button_icon_press_event_cb(), which should be a somewhat less-confusing name? ::: lib/widgets/ephy-location-entry.c @@ +731,1 @@ state == 0 /* left */) { My remaining reservation is that this state == 0 check doesn't seem to make sense. It seems to be checking for the left mouse button, but that's already ensured above by event->button == 1. (Yay for magic values and no defined constants!) And checking that state == 0 doesn't seem like the right way to check for the left mouse button in the state anyway: the right check should surely be (state & GDK_BUTTON1_MASK). So I think this state == 0 does not make sense for mouse button press either, nor for touch events. I would remove this line as well, and see if anything breaks. ;)
Created attachment 367397 [details] [review] Allow prmary and secondary actions to be opened with touch - V2 As requested renamed function icon_button_press_event_cb() to icon_button_icon_press_event_cb() as it fooled both of us :) Also removed state check, it has no impact to mouse and touch behaviour.
Looks good, thanks. Will be in 3.26.6.