dnd: Use pushModal() to grab the keyboard

Currently we "only" grab the keyboard when starting a drag operation,
which does not impede keybindings to be processed. This is at best
not harmful (like workspace switching), but may have unintended effects
otherwise - for instance, the hot corner is disabled, so having the
corresponding keyboard shortcut still active is fairly odd (not to
mention that it leaves the system in a confused state).
Fix this by switching to pushModal()/popModal(), which will push a
dedicated keybinding mode for us.

https://bugzilla.gnome.org/show_bug.cgi?id=700877
This commit is contained in:
Florian Müllner 2013-05-23 15:49:42 +02:00
parent 41ae93dba0
commit 9e56e668e0

View File

@ -147,16 +147,16 @@ const _Draggable = new Lang.Class({
_grabEvents: function() { _grabEvents: function() {
if (!this._eventsGrabbed) { if (!this._eventsGrabbed) {
this._eventsGrabbed = Main.pushModal(_getEventHandlerActor());
if (this._eventsGrabbed)
Clutter.grab_pointer(_getEventHandlerActor()); Clutter.grab_pointer(_getEventHandlerActor());
Clutter.grab_keyboard(_getEventHandlerActor());
this._eventsGrabbed = true;
} }
}, },
_ungrabEvents: function() { _ungrabEvents: function() {
if (this._eventsGrabbed) { if (this._eventsGrabbed) {
Clutter.ungrab_pointer(); Clutter.ungrab_pointer();
Clutter.ungrab_keyboard(); Main.popModal(_getEventHandlerActor());
this._eventsGrabbed = false; this._eventsGrabbed = false;
} }
}, },