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:
parent
51883734f5
commit
d1a9d9dddc
2 changed files with 20 additions and 0 deletions
|
|
@ -189,6 +189,8 @@ mod imp {
|
||||||
|
|
||||||
#[template_child]
|
#[template_child]
|
||||||
apply_button: TemplateChild<gtk::Button>,
|
apply_button: TemplateChild<gtk::Button>,
|
||||||
|
#[template_child]
|
||||||
|
apply_button_click: TemplateChild<gtk::GestureClick>,
|
||||||
|
|
||||||
#[template_child]
|
#[template_child]
|
||||||
selection_move: TemplateChild<gtk::GestureDrag>,
|
selection_move: TemplateChild<gtk::GestureDrag>,
|
||||||
|
|
@ -281,6 +283,21 @@ mod imp {
|
||||||
self.selection.set_cursor_from_name(Some("move"));
|
self.selection.set_cursor_from_name(Some("move"));
|
||||||
self.apply_button.set_cursor_from_name(Some("default"));
|
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
|
// Drag begin
|
||||||
self.selection_move.connect_drag_begin(glib::clone!(
|
self.selection_move.connect_drag_begin(glib::clone!(
|
||||||
#[weak]
|
#[weak]
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,9 @@
|
||||||
<class name="osd" />
|
<class name="osd" />
|
||||||
<class name="apply-button" />
|
<class name="apply-button" />
|
||||||
</style>
|
</style>
|
||||||
|
<child>
|
||||||
|
<object class="GtkGestureClick" id="apply_button_click" />
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<property name="child">
|
<property name="child">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue