Use shellwm.takeover_keybinding for Alt-F1 and Alt-F2

This fixes a regression where we weren't using the correct event
timestamps, because for both of these we were sending an XClientMessage
to ourself.

https://bugzilla.gnome.org/show_bug.cgi?id=596262
This commit is contained in:
Colin Walters 2009-09-24 22:53:16 -04:00
parent 4bff2675ae
commit 3564d78d30
2 changed files with 9 additions and 45 deletions

View File

@ -79,6 +79,15 @@ function start() {
// Make sure not more than one run dialog is shown. // Make sure not more than one run dialog is shown.
getRunDialog().open(); getRunDialog().open();
}); });
let shellwm = global.window_manager;
shellwm.takeover_keybinding("panel_main_menu");
shellwm.connect("keybinding::panel_main_menu", function () {
overview.toggle();
});
shellwm.takeover_keybinding("panel_run_dialog");
shellwm.connect("keybinding::panel_run_dialog", function () {
getRunDialog().open();
});
overview = new Overview.Overview(); overview = new Overview.Overview();
chrome = new Chrome.Chrome(); chrome = new Chrome.Chrome();

View File

@ -192,13 +192,6 @@ gnome_shell_plugin_constructed (GObject *object)
shell_plugin->gjs_context = gjs_context_new_with_search_path(search_path); shell_plugin->gjs_context = gjs_context_new_with_search_path(search_path);
g_strfreev(search_path); g_strfreev(search_path);
shell_plugin->panel_action = XInternAtom (meta_display_get_xdisplay (display),
"_GNOME_PANEL_ACTION", FALSE);
shell_plugin->panel_action_run_dialog = XInternAtom (meta_display_get_xdisplay (display),
"_GNOME_PANEL_ACTION_RUN_DIALOG", FALSE);
shell_plugin->panel_action_main_menu = XInternAtom (meta_display_get_xdisplay (display),
"_GNOME_PANEL_ACTION_MAIN_MENU", FALSE);
if (!gjs_context_eval (shell_plugin->gjs_context, if (!gjs_context_eval (shell_plugin->gjs_context,
"const Main = imports.ui.main; Main.start();", "const Main = imports.ui.main; Main.start();",
-1, -1,
@ -318,48 +311,10 @@ gnome_shell_plugin_kill_effect (MutterPlugin *plugin,
actor, events); actor, events);
} }
static gboolean
handle_panel_event (GnomeShellPlugin *shell_plugin,
XEvent *xev)
{
MutterPlugin *plugin = MUTTER_PLUGIN (shell_plugin);
MetaScreen *screen;
MetaDisplay *display;
XClientMessageEvent *xev_client;
Window root;
screen = mutter_plugin_get_screen (plugin);
display = meta_screen_get_display (screen);
if (xev->type != ClientMessage)
return FALSE;
root = meta_screen_get_xroot (screen);
xev_client = (XClientMessageEvent*) xev;
if (!(xev_client->window == root &&
xev_client->message_type == shell_plugin->panel_action &&
xev_client->format == 32))
return FALSE;
if (xev_client->data.l[0] == shell_plugin->panel_action_run_dialog)
g_signal_emit_by_name (shell_global_get (), "panel-run-dialog",
(guint32) xev_client->data.l[1]);
else if (xev_client->data.l[0] == shell_plugin->panel_action_main_menu)
g_signal_emit_by_name (shell_global_get (), "panel-main-menu",
(guint32) xev_client->data.l[1]);
return TRUE;
}
static gboolean static gboolean
gnome_shell_plugin_xevent_filter (MutterPlugin *plugin, gnome_shell_plugin_xevent_filter (MutterPlugin *plugin,
XEvent *xev) XEvent *xev)
{ {
GnomeShellPlugin *shell_plugin = GNOME_SHELL_PLUGIN (plugin);
if (handle_panel_event (shell_plugin, xev))
return TRUE;
return clutter_x11_handle_event (xev) != CLUTTER_X11_FILTER_CONTINUE; return clutter_x11_handle_event (xev) != CLUTTER_X11_FILTER_CONTINUE;
} }