edit/crop: Work around gesture bug

After clicking the "apply crop" button, the drag button to change the
selection is getting stuck. Adding manual claim for the click gesture
for the button early fixes this.
This commit is contained in:
Sophie Herold 2025-01-29 01:16:58 +01:00
parent 51883734f5
commit d1a9d9dddc
2 changed files with 20 additions and 0 deletions

View file

@ -189,6 +189,8 @@ mod imp {
#[template_child]
apply_button: TemplateChild<gtk::Button>,
#[template_child]
apply_button_click: TemplateChild<gtk::GestureClick>,
#[template_child]
selection_move: TemplateChild<gtk::GestureDrag>,
@ -281,6 +283,21 @@ mod imp {
self.selection.set_cursor_from_name(Some("move"));
self.apply_button.set_cursor_from_name(Some("default"));
// Gesture bug workaround
self.apply_button_click.connect_begin(move |gesture, _| {
gesture.set_state(gtk::EventSequenceState::Claimed);
});
self.apply_button_click.connect_released(glib::clone!(
#[weak]
obj,
move |_, _, x, y| {
if obj.imp().apply_button.contains(x, y) {
let _ = obj.activate_action("edit-crop.apply-crop", None);
}
}
));
// Drag begin
self.selection_move.connect_drag_begin(glib::clone!(
#[weak]

View file

@ -49,6 +49,9 @@
<class name="osd" />
<class name="apply-button" />
</style>
<child>
<object class="GtkGestureClick" id="apply_button_click" />
</child>
</object>
</child>
<property name="child">