widget.button: Release the button when the mouse leave

This isn't correct, but it avoid a bug where the button stay
pressed forever if the mouse leave while it's pressed.
This commit is contained in:
Emmanuel Lepage Vallee 2016-05-09 23:14:55 -04:00
parent c1d9e58f94
commit ca02ec1bbe
1 changed files with 3 additions and 0 deletions

View File

@ -39,6 +39,9 @@ function button.new(args)
end
w:set_image(args.image)
w:buttons(abutton({}, 1, function () orig_set_image(w, img_press) end, function () orig_set_image(w, img_release) end))
w:connect_signal("mouse::leave", function(self) orig_set_image(self, img_release) end)
return w
end