mirror of
https://github.com/elementary/gala.git
synced 2024-08-16 18:40:27 +03:00
Allow to cancel screenshot when pressing ESC (#463)
This commit is contained in:
parent
bbd5963da5
commit
df0022c4b8
@ -139,6 +139,10 @@ namespace Gala
|
||||
yield;
|
||||
selection_area.destroy ();
|
||||
|
||||
if (selection_area.cancelled) {
|
||||
throw new GLib.IOError.CANCELLED ("Operation was cancelled");
|
||||
}
|
||||
|
||||
yield wait_stage_repaint ();
|
||||
selection_area.get_selection_rectangle (out x, out y, out width, out height);
|
||||
}
|
||||
|
@ -16,13 +16,15 @@
|
||||
//
|
||||
|
||||
namespace Gala
|
||||
{
|
||||
{
|
||||
public class SelectionArea : Clutter.Actor
|
||||
{
|
||||
public signal void closed ();
|
||||
|
||||
public WindowManager wm { get; construct; }
|
||||
|
||||
public bool cancelled { get; private set; }
|
||||
|
||||
private ModalProxy? modal_proxy;
|
||||
private Gdk.Point start_point;
|
||||
private Gdk.Point end_point;
|
||||
@ -58,6 +60,7 @@ namespace Gala
|
||||
{
|
||||
if (e.keyval == Clutter.Key.Escape) {
|
||||
close ();
|
||||
cancelled = true;
|
||||
closed ();
|
||||
return true;
|
||||
}
|
||||
@ -87,6 +90,7 @@ namespace Gala
|
||||
|
||||
if (!dragging) {
|
||||
close ();
|
||||
cancelled = true;
|
||||
closed ();
|
||||
return true;
|
||||
}
|
||||
@ -167,4 +171,4 @@ namespace Gala
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user