Use new plugin-modality functionality in Mutter

We now have functionality in Mutter to grab the keyboard on behalf
of a plugin. This avoids interactions with the key handling code
in Mutter that could leave the user with an inconsistent state
and no way to get out of it.

src/shell-global.[ch]: Change shell_global_grab_keyboard() and
  shell_global_grab_keyboard() to shell_global_begin_modal()
  shell_global_end_modal() and call mutter_plugin_begin_modal()
  mutter_plugin_end_modal() rather than directly grabbing the
  keyboard.
main.js: Call global.begin_modal/end_modal from Main.startModal()
  and Main.endModal()
altTab.js; Remove call to Main.startModal() - we're letting Mutter
  handle modality for Alt-Tab.
main.js lookingGlass.js overview.js runDialog.js: Rename
  Main.startModal() to Main.beginModal() for consistency with
  naming in mutter and ShellGlobal.

http://bugzilla.gnome.org/show_bug.cgi?id=590686
This commit is contained in:
Owen W. Taylor
2009-08-12 00:22:46 -04:00
parent af9ab5dbb6
commit 799f56fe87
7 changed files with 32 additions and 57 deletions

View File

@ -137,10 +137,11 @@ function _removeUnusedWorkspaces() {
// Used to go into a mode where all keyboard and mouse input goes to
// the stage. Returns true if we successfully grabbed the keyboard and
// went modal, false otherwise
function startModal() {
function beginModal() {
let global = Shell.Global.get();
let timestamp = global.screen.get_display().get_current_time();
if (!global.grab_keyboard())
if (!global.begin_modal(timestamp))
return false;
global.set_stage_input_mode(Shell.StageInputMode.FULLSCREEN);
@ -151,8 +152,9 @@ function startModal() {
function endModal() {
let global = Shell.Global.get();
let timestamp = global.screen.get_display().get_current_time();
global.ungrab_keyboard();
global.end_modal(timestamp);
global.set_stage_input_mode(Shell.StageInputMode.NORMAL);
inModal = false;
}