Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions js/ui/screenshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,18 @@ class SelectArea {
}

_onButtonRelease(actor, event) {
// The selection is finished on the first release. Ignore any further
// press/release pairs arriving during the 100ms fade-out - each of
// them used to overwrite the result and schedule another _ungrab(),
// and the second popModal() would take the 'incorrect pop' error path
// after tearing down the X grab, aborting _ungrab() before
// this._group.destroy(): the fullscreen overlay stayed on screen and
// the panel appeared frozen.
if (!this.active || this._finishing)
return Clutter.EVENT_PROPAGATE;

this._finishing = true;

this._result = this._getGeometry();
this._group.ease({
opacity: 0,
Expand All @@ -419,6 +431,12 @@ class SelectArea {
}

_ungrab() {
// One-shot guard, NOT this.active: Escape legitimately calls
// _ungrab() before any selection started (active is still false).
if (this._ungrabbed)
return;
this._ungrabbed = true;

this.active = false;

if (this.stage_event_id > 0) {
Expand Down Expand Up @@ -522,6 +540,18 @@ class PickColor {
}

_onButtonRelease(actor, event) {
// The selection is finished on the first release. Ignore any further
// press/release pairs arriving during the 100ms fade-out - each of
// them used to overwrite the result and schedule another _ungrab(),
// and the second popModal() would take the 'incorrect pop' error path
// after tearing down the X grab, aborting _ungrab() before
// this._group.destroy(): the fullscreen overlay stayed on screen and
// the panel appeared frozen.
if (!this.active || this._finishing)
return Clutter.EVENT_PROPAGATE;

this._finishing = true;

this._result = this._getGeometry();
this._group.ease({
opacity: 0,
Expand All @@ -535,6 +565,12 @@ class PickColor {
}

_ungrab() {
// One-shot guard, NOT this.active: Escape legitimately calls
// _ungrab() before any selection started (active is still false).
if (this._ungrabbed)
return;
this._ungrabbed = true;

this.active = false;

if (this.stage_event_id > 0) {
Expand Down Expand Up @@ -657,6 +693,10 @@ class SelectWindow {
if (window === null)
return Clutter.EVENT_STOP;

if (this._finishing)
return Clutter.EVENT_STOP;
this._finishing = true;

this._result = window;
this._group.ease({
opacity: 0,
Expand All @@ -671,6 +711,10 @@ class SelectWindow {
}

_ungrab() {
if (this._ungrabbed)
return;
this._ungrabbed = true;

Main.popModal(this._group);
global.unset_cursor();
this.emit('finished', this._result);
Expand Down
Loading