grabHelper: Merge _navigateActor() with its only user
https://bugzilla.gnome.org/show_bug.cgi?id=693570
This commit is contained in:
parent
60257f422a
commit
ad1b9b71ae
@ -10,17 +10,6 @@ const St = imports.gi.St;
|
|||||||
const Main = imports.ui.main;
|
const Main = imports.ui.main;
|
||||||
const Params = imports.misc.params;
|
const Params = imports.misc.params;
|
||||||
|
|
||||||
function _navigateActor(actor) {
|
|
||||||
if (!actor)
|
|
||||||
return;
|
|
||||||
|
|
||||||
let needsGrab = true;
|
|
||||||
if (actor instanceof St.Widget)
|
|
||||||
needsGrab = !actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
|
|
||||||
if (needsGrab)
|
|
||||||
actor.grab_key_focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
// GrabHelper:
|
// GrabHelper:
|
||||||
// @owner: the actor that owns the GrabHelper
|
// @owner: the actor that owns the GrabHelper
|
||||||
// @params: optional parameters to pass to Main.pushModal()
|
// @params: optional parameters to pass to Main.pushModal()
|
||||||
@ -178,10 +167,12 @@ const GrabHelper = new Lang.Class({
|
|||||||
if (params.grabFocus && !this._takeFocusGrab(hadFocus))
|
if (params.grabFocus && !this._takeFocusGrab(hadFocus))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (params.focus)
|
if (params.focus) {
|
||||||
params.focus.grab_key_focus();
|
params.focus.grab_key_focus();
|
||||||
else if (hadFocus || params.grabFocus)
|
} else if (newFocus && (hadFocus || params.grabFocus)) {
|
||||||
_navigateActor(newFocus);
|
if (!newFocus.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false))
|
||||||
|
newFocus.grab_key_focus();
|
||||||
|
}
|
||||||
|
|
||||||
if ((params.grabFocus || params.modal) && !this._capturedEventId)
|
if ((params.grabFocus || params.modal) && !this._capturedEventId)
|
||||||
this._capturedEventId = global.stage.connect('captured-event', Lang.bind(this, this._onCapturedEvent));
|
this._capturedEventId = global.stage.connect('captured-event', Lang.bind(this, this._onCapturedEvent));
|
||||||
|
Loading…
Reference in New Issue
Block a user