[gnome-shell] main: use Meta.Display.get_keybinding_action for PrintScreen as well
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] main: use Meta.Display.get_keybinding_action for PrintScreen as well
- Date: Mon, 25 Oct 2010 20:40:47 +0000 (UTC)
commit c217377114a4e885e352d95ac91121ba445810f7
Author: Dan Winship <danw gnome org>
Date: Thu Oct 14 10:38:33 2010 -0400
main: use Meta.Display.get_keybinding_action for PrintScreen as well
(and trigger it on keyrelease rather than keypress, like the other
bindings)
https://bugzilla.gnome.org/show_bug.cgi?id=632151
js/ui/main.js | 69 +++++++++++++++++++++++++-------------------------------
1 files changed, 31 insertions(+), 38 deletions(-)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index cc017e3..8e46209 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -292,13 +292,30 @@ function _removeUnusedWorkspaces() {
function _globalKeyPressHandler(actor, event) {
if (modalCount == 0)
return false;
+ if (event.type() != Clutter.EventType.KEY_RELEASE)
+ return false;
+
+ let symbol = event.get_key_symbol();
+ let keyCode = event.get_key_code();
+ let modifierState = Shell.get_event_state(event);
+ // Check the overview key first, this isn't a Meta.KeyBindingAction yet
+ if (symbol == Clutter.Super_L || symbol == Clutter.Super_R) {
+ // The super key is the default for triggering the overview, and should
+ // get us out of the overview when we are already in it.
+ if (overview.visible)
+ overview.hide();
+
+ return true;
+ }
- let type = event.type();
+ // Whitelist some of the Metacity actions
+ let display = global.screen.get_display();
+ let activeWorkspaceIndex = global.screen.get_active_workspace_index();
- if (type == Clutter.EventType.KEY_PRESS) {
- let symbol = event.get_key_symbol();
- if (symbol == Clutter.Print) {
- // We want to be able to take screenshots of the shell at all times
+ // This relies on the fact that Clutter.ModifierType is the same as Gdk.ModifierType
+ let action = display.get_keybinding_action(keyCode, modifierState);
+ switch (action) {
+ case Meta.KeyBindingAction.COMMAND_SCREENSHOT:
let gconf = GConf.Client.get_default();
let command = gconf.get_string('/apps/metacity/keybinding_commands/command_screenshot');
if (command != null && command != '') {
@@ -306,41 +323,17 @@ function _globalKeyPressHandler(actor, event) {
let p = new Shell.Process({'args' : args});
p.run();
}
-
return true;
- }
- } else if (type == Clutter.EventType.KEY_RELEASE) {
- let symbol = event.get_key_symbol();
- let keyCode = event.get_key_code();
- let modifierState = Shell.get_event_state(event);
- // Check the overview key first, this isn't a Meta.KeyBindingAction yet
- if (symbol == Clutter.Super_L || symbol == Clutter.Super_R) {
- // The super key is the default for triggering the overview, and should
- // get us out of the overview when we are already in it.
- if (overview.visible)
- overview.hide();
-
+ case Meta.KeyBindingAction.WORKSPACE_LEFT:
+ wm.actionMoveWorkspaceLeft();
+ return true;
+ case Meta.KeyBindingAction.WORKSPACE_RIGHT:
+ wm.actionMoveWorkspaceRight();
+ return true;
+ case Meta.KeyBindingAction.PANEL_RUN_DIALOG:
+ case Meta.KeyBindingAction.COMMAND_2:
+ getRunDialog().open();
return true;
- }
-
- // Whitelist some of the Metacity actions
- let display = global.screen.get_display();
- let activeWorkspaceIndex = global.screen.get_active_workspace_index();
-
- // This relies on the fact that Clutter.ModifierType is the same as Gdk.ModifierType
- let action = display.get_keybinding_action(symbol, keyCode, modifierState);
- switch (action) {
- case Meta.KeyBindingAction.WORKSPACE_LEFT:
- wm.actionMoveWorkspaceLeft();
- return true;
- case Meta.KeyBindingAction.WORKSPACE_RIGHT:
- wm.actionMoveWorkspaceRight();
- return true;
- case Meta.KeyBindingAction.PANEL_RUN_DIALOG:
- case Meta.KeyBindingAction.COMMAND_2:
- getRunDialog().open();
- return true;
- }
}
return false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]