messageTray: fix dwelling during mouse-down
If the user has the mouse down - for example when they are selecting text and dragging - then the attempt to get a modal grab will fail. grabHelper: allow the .grab() function to fail and do nothing in this modal case if the grab fails. messageTray: handle grab failure and don't pop up the tray. Change the logic for tray dwelling so that we only try to pop up the tray once while the pointer is in the dwell area - this avoids the possiility that the tray will pop up once the user releases the mouse. https://bugzilla.gnome.org/show_bug.cgi?id=682385
This commit is contained in:
@ -128,7 +128,9 @@ const GrabHelper = new Lang.Class({
|
||||
// on the owner of the GrabHelper. As long as there is at least one
|
||||
// { modal: true } actor on the grab stack, the grab will be kept.
|
||||
// When the last { modal: true } actor is ungrabbed, then the modal
|
||||
// will be dropped.
|
||||
// will be dropped. A modal grab can fail if there is already a grab
|
||||
// in effect from aother application; in this case the function returns
|
||||
// false and nothing happens. Non-modal grabs can never fail.
|
||||
//
|
||||
// If @params contains { grabFocus: true }, then if you call grab()
|
||||
// while the shell is outside the overview, it will set the stage
|
||||
@ -151,10 +153,12 @@ const GrabHelper = new Lang.Class({
|
||||
let newFocus = params.actor;
|
||||
|
||||
if (this.isActorGrabbed(params.actor))
|
||||
return;
|
||||
return true;
|
||||
|
||||
if (this._grabFocusCount == 0 && this._modalCount == 0)
|
||||
this._fullGrab(hadFocus, params.modal, params.grabFocus);
|
||||
if (this._grabFocusCount == 0 && this._modalCount == 0) {
|
||||
if (!this._fullGrab(hadFocus, params.modal, params.grabFocus))
|
||||
return false;
|
||||
}
|
||||
|
||||
params.savedFocus = focus;
|
||||
this._grabStack.push(params);
|
||||
@ -166,19 +170,22 @@ const GrabHelper = new Lang.Class({
|
||||
this._grabFocusCount++;
|
||||
|
||||
_navigateActor(newFocus, hadFocus);
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
_fullGrab: function(hadFocus, modal, grabFocus) {
|
||||
let metaDisplay = global.screen.get_display();
|
||||
|
||||
if (modal) {
|
||||
if (!Main.pushModal(this._owner))
|
||||
return false;
|
||||
}
|
||||
|
||||
this._grabbedFromKeynav = hadFocus;
|
||||
this._preGrabInputMode = global.stage_input_mode;
|
||||
this._prevFocusedWindow = null;
|
||||
|
||||
if (modal) {
|
||||
Main.pushModal(this._owner);
|
||||
}
|
||||
|
||||
if (grabFocus) {
|
||||
this._prevFocusedWindow = metaDisplay.focus_window;
|
||||
if (this._preGrabInputMode == Shell.StageInputMode.NONREACTIVE ||
|
||||
@ -193,6 +200,8 @@ const GrabHelper = new Lang.Class({
|
||||
this._keyFocusNotifyId = global.stage.connect('notify::key-focus', Lang.bind(this, this._onKeyFocusChanged));
|
||||
this._focusWindowChangedId = metaDisplay.connect('notify::focus-window', Lang.bind(this, this._focusWindowChanged));
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
// ignoreRelease:
|
||||
|
Reference in New Issue
Block a user