summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Thurman <tthurman@gnome.org>2008-10-06 00:24:07 +0000
committerThomas James Alexander Thurman <tthurman@src.gnome.org>2008-10-06 00:24:07 +0000
commitb1fb765d8e4714020f39238917cb5be3a147f1ae (patch)
treef31669873b12e322f1b4cf35d205c3004e94b01f
parent9e72d661d6521446bb819d2f785b50868f674dca (diff)
downloadmetacity-b1fb765d8e4714020f39238917cb5be3a147f1ae.tar.gz
Second half of the switch to using x-macros for keybindings so that we
2008-10-05 Thomas Thurman <tthurman@gnome.org> Second half of the switch to using x-macros for keybindings so that we don't have lots of places with the same information which must stay in the same order. This time it's screen bindings. * src/core/screen-bindings.h: New file, containing screen bindings. * src/core/schema-bindings.c: added ability to output screen bindings. * src/core/window-bindings.h: tiny tweak to comment * src/core/keybindings.c: generate function prototypes using s-b.h; several handlers modified to use ints rather than ints cast into pointers, or renamed. * src/include/prefs.h: generate names of bindings using s-b.h; generate screen_handlers using s-b.h; arguments to bindings are ints and not ints cast to pointers; several handler functions renamed to consistent names. * src/core/prefs.c (meta_prefs_set_num_workspaces, init_bindings): generate screen_handlers using s-b.h; generate screen_string_bindings using s-b.h (and add check for null bindings in init_bindings to enable this simply). svn path=/trunk/; revision=3941
-rw-r--r--ChangeLog21
-rw-r--r--src/core/keybindings.c335
-rw-r--r--src/core/prefs.c106
-rw-r--r--src/core/schema-bindings.c110
-rw-r--r--src/core/screen-bindings.h307
-rw-r--r--src/core/window-bindings.h2
-rw-r--r--src/include/prefs.h74
7 files changed, 518 insertions, 437 deletions
diff --git a/ChangeLog b/ChangeLog
index 833cb1c4..bbc7f22f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,26 @@
2008-10-05 Thomas Thurman <tthurman@gnome.org>
+ Second half of the switch to using x-macros for keybindings so that
+ we don't have lots of places with the same information which must
+ stay in the same order. This time it's screen bindings.
+
+ * src/core/screen-bindings.h: New file, containing screen bindings.
+ * src/core/schema-bindings.c: added ability to output screen bindings.
+ * src/core/window-bindings.h: tiny tweak to comment
+ * src/core/keybindings.c: generate function prototypes using s-b.h;
+ several handlers modified to use ints rather than ints cast into
+ pointers, or renamed.
+ * src/include/prefs.h: generate names of bindings using s-b.h;
+ generate screen_handlers using s-b.h;
+ arguments to bindings are ints and not ints cast to pointers;
+ several handler functions renamed to consistent names.
+ * src/core/prefs.c (meta_prefs_set_num_workspaces, init_bindings):
+ generate screen_handlers using s-b.h;
+ generate screen_string_bindings using s-b.h (and add check for
+ null bindings in init_bindings to enable this simply).
+
+2008-10-05 Thomas Thurman <tthurman@gnome.org>
+
* tools/ppa-magic.py: experimental tool for Launchpad upload
2008-10-05 Thomas Thurman <tthurman@gnome.org>
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index c6e29faa..074087f0 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -65,68 +65,27 @@ handle_##name (MetaDisplay *display,\
#include "window-bindings.h"
#undef item
-static void handle_activate_workspace (MetaDisplay *display,
- MetaScreen *screen,
- MetaWindow *window,
- XEvent *event,
- MetaKeyBinding *binding);
-static void handle_tab_forward (MetaDisplay *display,
- MetaScreen *screen,
- MetaWindow *window,
- XEvent *event,
- MetaKeyBinding *binding);
-static void handle_tab_backward (MetaDisplay *display,
- MetaScreen *screen,
- MetaWindow *window,
- XEvent *event,
- MetaKeyBinding *binding);
-static void handle_cycle_forward (MetaDisplay *display,
- MetaScreen *screen,
- MetaWindow *window,
- XEvent *event,
- MetaKeyBinding *binding);
-static void handle_cycle_backward (MetaDisplay *display,
- MetaScreen *screen,
- MetaWindow *window,
- XEvent *event,
- MetaKeyBinding *binding);
-static void handle_toggle_fullscreen (MetaDisplay *display,
- MetaScreen *screen,
- MetaWindow *window,
- XEvent *event,
- MetaKeyBinding *binding);
-static void handle_toggle_desktop (MetaDisplay *display,
- MetaScreen *screen,
- MetaWindow *window,
- XEvent *event,
- MetaKeyBinding *binding);
-static void handle_panel_keybinding (MetaDisplay *display,
- MetaScreen *screen,
- MetaWindow *window,
- XEvent *event,
- MetaKeyBinding *binding);
-static void handle_workspace_switch (MetaDisplay *display,
- MetaScreen *screen,
- MetaWindow *window,
- XEvent *event,
- MetaKeyBinding *binding);
-static void handle_run_command (MetaDisplay *display,
- MetaScreen *screen,
- MetaWindow *window,
- XEvent *event,
- MetaKeyBinding *binding);
-static void handle_spew_mark (MetaDisplay *display,
- MetaScreen *screen,
- MetaWindow *window,
- XEvent *event,
- MetaKeyBinding *binding);
-static void handle_run_terminal (MetaDisplay *display,
- MetaScreen *screen,
- MetaWindow *window,
- XEvent *event,
- MetaKeyBinding *binding);
-
-/* debug */
+#define item(name, suffix, param, can_reverse, short, long, stroke) \
+static void \
+handle_##name (MetaDisplay *display,\
+ MetaScreen *screen,\
+ MetaWindow *window,\
+ XEvent *event,\
+ MetaKeyBinding *binding);
+#include "screen-bindings.h"
+#undef item
+
+/* These can't be bound to anything, but they are used to handle
+ * various other events. TODO: Possibly we should include them as event
+ * handler functions and have some kind of flag to say they're unbindable.
+ */
+
+static void handle_workspace_switch (MetaDisplay *display,
+ MetaScreen *screen,
+ MetaWindow *window,
+ XEvent *event,
+ MetaKeyBinding *binding);
+
static gboolean process_mouse_move_resize_grab (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window,
@@ -162,7 +121,7 @@ typedef struct
{
const char *name;
MetaKeyHandlerFunc func;
- void *data;
+ gint data, flags;
} MetaKeyHandler;
struct _MetaKeyBinding
@@ -176,154 +135,25 @@ struct _MetaKeyBinding
};
static const MetaKeyHandler screen_handlers[] = {
- { META_KEYBINDING_WORKSPACE_1, handle_activate_workspace,
- GINT_TO_POINTER (0) },
- { META_KEYBINDING_WORKSPACE_2, handle_activate_workspace,
- GINT_TO_POINTER (1) },
- { META_KEYBINDING_WORKSPACE_3, handle_activate_workspace,
- GINT_TO_POINTER (2) },
- { META_KEYBINDING_WORKSPACE_4, handle_activate_workspace,
- GINT_TO_POINTER (3) },
- { META_KEYBINDING_WORKSPACE_5, handle_activate_workspace,
- GINT_TO_POINTER (4) },
- { META_KEYBINDING_WORKSPACE_6, handle_activate_workspace,
- GINT_TO_POINTER (5) },
- { META_KEYBINDING_WORKSPACE_7, handle_activate_workspace,
- GINT_TO_POINTER (6) },
- { META_KEYBINDING_WORKSPACE_8, handle_activate_workspace,
- GINT_TO_POINTER (7) },
- { META_KEYBINDING_WORKSPACE_9, handle_activate_workspace,
- GINT_TO_POINTER (8) },
- { META_KEYBINDING_WORKSPACE_10, handle_activate_workspace,
- GINT_TO_POINTER (9) },
- { META_KEYBINDING_WORKSPACE_11, handle_activate_workspace,
- GINT_TO_POINTER (10) },
- { META_KEYBINDING_WORKSPACE_12, handle_activate_workspace,
- GINT_TO_POINTER (11) },
- { META_KEYBINDING_WORKSPACE_LEFT, handle_workspace_switch,
- GINT_TO_POINTER (META_MOTION_LEFT) },
- { META_KEYBINDING_WORKSPACE_RIGHT, handle_workspace_switch,
- GINT_TO_POINTER (META_MOTION_RIGHT) },
- { META_KEYBINDING_WORKSPACE_UP, handle_workspace_switch,
- GINT_TO_POINTER (META_MOTION_UP) },
- { META_KEYBINDING_WORKSPACE_DOWN, handle_workspace_switch,
- GINT_TO_POINTER (META_MOTION_DOWN) },
- { META_KEYBINDING_SWITCH_WINDOWS, handle_tab_forward,
- GINT_TO_POINTER (META_TAB_LIST_NORMAL) },
- { META_KEYBINDING_SWITCH_WINDOWS_BACKWARD, handle_tab_backward,
- GINT_TO_POINTER (META_TAB_LIST_NORMAL) },
- { META_KEYBINDING_SWITCH_PANELS, handle_tab_forward,
- GINT_TO_POINTER (META_TAB_LIST_DOCKS) },
- { META_KEYBINDING_SWITCH_PANELS_BACKWARD, handle_tab_backward,
- GINT_TO_POINTER (META_TAB_LIST_DOCKS) },
- { META_KEYBINDING_SWITCH_GROUP, handle_tab_forward,
- GINT_TO_POINTER (META_TAB_LIST_GROUP) },
- { META_KEYBINDING_SWITCH_GROUP_BACKWARD, handle_tab_backward,
- GINT_TO_POINTER (META_TAB_LIST_GROUP) },
- { META_KEYBINDING_CYCLE_GROUP, handle_cycle_forward,
- GINT_TO_POINTER (META_TAB_LIST_GROUP) },
- { META_KEYBINDING_CYCLE_GROUP_BACKWARD, handle_cycle_backward,
- GINT_TO_POINTER (META_TAB_LIST_GROUP) },
- { META_KEYBINDING_CYCLE_WINDOWS, handle_cycle_forward,
- GINT_TO_POINTER (META_TAB_LIST_NORMAL) },
- { META_KEYBINDING_CYCLE_WINDOWS_BACKWARD, handle_cycle_backward,
- GINT_TO_POINTER (META_TAB_LIST_NORMAL) },
- { META_KEYBINDING_CYCLE_PANELS, handle_cycle_forward,
- GINT_TO_POINTER (META_TAB_LIST_DOCKS) },
- { META_KEYBINDING_CYCLE_PANELS_BACKWARD, handle_cycle_backward,
- GINT_TO_POINTER (META_TAB_LIST_DOCKS) },
- { META_KEYBINDING_SHOW_DESKTOP, handle_toggle_desktop,
- NULL },
- { META_KEYBINDING_PANEL_MAIN_MENU, handle_panel_keybinding,
- GINT_TO_POINTER (META_KEYBINDING_ACTION_PANEL_MAIN_MENU) },
- { META_KEYBINDING_PANEL_RUN_DIALOG, handle_panel_keybinding,
- GINT_TO_POINTER (META_KEYBINDING_ACTION_PANEL_RUN_DIALOG) },
- { META_KEYBINDING_COMMAND_1, handle_run_command,
- GINT_TO_POINTER (0) },
- { META_KEYBINDING_COMMAND_2, handle_run_command,
- GINT_TO_POINTER (1) },
- { META_KEYBINDING_COMMAND_3, handle_run_command,
- GINT_TO_POINTER (2) },
- { META_KEYBINDING_COMMAND_4, handle_run_command,
- GINT_TO_POINTER (3) },
- { META_KEYBINDING_COMMAND_5, handle_run_command,
- GINT_TO_POINTER (4) },
- { META_KEYBINDING_COMMAND_6, handle_run_command,
- GINT_TO_POINTER (5) },
- { META_KEYBINDING_COMMAND_7, handle_run_command,
- GINT_TO_POINTER (6) },
- { META_KEYBINDING_COMMAND_8, handle_run_command,
- GINT_TO_POINTER (7) },
- { META_KEYBINDING_COMMAND_9, handle_run_command,
- GINT_TO_POINTER (8) },
- { META_KEYBINDING_COMMAND_10, handle_run_command,
- GINT_TO_POINTER (9) },
- { META_KEYBINDING_COMMAND_11, handle_run_command,
- GINT_TO_POINTER (10) },
- { META_KEYBINDING_COMMAND_12, handle_run_command,
- GINT_TO_POINTER (11) },
- { META_KEYBINDING_COMMAND_13, handle_run_command,
- GINT_TO_POINTER (12) },
- { META_KEYBINDING_COMMAND_14, handle_run_command,
- GINT_TO_POINTER (13) },
- { META_KEYBINDING_COMMAND_15, handle_run_command,
- GINT_TO_POINTER (14) },
- { META_KEYBINDING_COMMAND_16, handle_run_command,
- GINT_TO_POINTER (15) },
- { META_KEYBINDING_COMMAND_17, handle_run_command,
- GINT_TO_POINTER (16) },
- { META_KEYBINDING_COMMAND_18, handle_run_command,
- GINT_TO_POINTER (17) },
- { META_KEYBINDING_COMMAND_19, handle_run_command,
- GINT_TO_POINTER (18) },
- { META_KEYBINDING_COMMAND_20, handle_run_command,
- GINT_TO_POINTER (19) },
- { META_KEYBINDING_COMMAND_21, handle_run_command,
- GINT_TO_POINTER (20) },
- { META_KEYBINDING_COMMAND_22, handle_run_command,
- GINT_TO_POINTER (21) },
- { META_KEYBINDING_COMMAND_23, handle_run_command,
- GINT_TO_POINTER (22) },
- { META_KEYBINDING_COMMAND_24, handle_run_command,
- GINT_TO_POINTER (23) },
- { META_KEYBINDING_COMMAND_25, handle_run_command,
- GINT_TO_POINTER (24) },
- { META_KEYBINDING_COMMAND_26, handle_run_command,
- GINT_TO_POINTER (25) },
- { META_KEYBINDING_COMMAND_27, handle_run_command,
- GINT_TO_POINTER (26) },
- { META_KEYBINDING_COMMAND_28, handle_run_command,
- GINT_TO_POINTER (27) },
- { META_KEYBINDING_COMMAND_29, handle_run_command,
- GINT_TO_POINTER (28) },
- { META_KEYBINDING_COMMAND_30, handle_run_command,
- GINT_TO_POINTER (29) },
- { META_KEYBINDING_COMMAND_31, handle_run_command,
- GINT_TO_POINTER (30) },
- { META_KEYBINDING_COMMAND_32, handle_run_command,
- GINT_TO_POINTER (31) },
- { META_KEYBINDING_COMMAND_SCREENSHOT, handle_run_command,
- GINT_TO_POINTER (32) },
- { META_KEYBINDING_COMMAND_WIN_SCREENSHOT, handle_run_command,
- GINT_TO_POINTER (33) },
- { META_KEYBINDING_RUN_COMMAND_TERMINAL, handle_run_terminal,
- NULL },
- { META_KEYBINDING_SET_SPEW_MARK, handle_spew_mark, NULL },
- { NULL, NULL, NULL }
+#define item(name, suffix, param, flags, short, long, stroke) \
+ { #name suffix, handle_##name, param, flags },
+#include "screen-bindings.h"
+#undef item
+ { NULL, NULL, 0, 0 }
};
static const MetaKeyHandler window_handlers[] = {
-/* TODO: Eventually, we should stop using GINT_TO_POINTER here, because
- * they're always integers.
+/* FIXME: The flags=1 thing is pretty ugly here, but it'll really have
+ * to wait until and if we merge the window and screen binding files.
*
* TODO: Are window bindings only ever called on non-null windows?
* If so, we can remove the check from all of them.
*/
-#define item(name, suffix, param, a, b, c) { #name, handle_##name, \
- GINT_TO_POINTER (param) },
+#define item(name, suffix, param, short, long, stroke) \
+ { #name suffix, handle_##name, param, 1 },
#include "window-bindings.h"
#undef item
- { NULL, NULL, NULL }
+ { NULL, NULL, 0, 0 }
};
static void
@@ -2490,27 +2320,32 @@ process_tab_grab (MetaDisplay *display,
}
static void
-handle_activate_workspace (MetaDisplay *display,
+handle_switch_to_workspace (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *event_window,
XEvent *event,
MetaKeyBinding *binding)
{
- int which;
+ gint which = binding->handler->data;
MetaWorkspace *workspace;
- which = GPOINTER_TO_INT (binding->handler->data);
-
- workspace = NULL;
if (which < 0)
- {
- workspace = meta_workspace_get_neighbor (screen->active_workspace,
- which);
- }
- else
{
- workspace = meta_screen_get_workspace_by_index (screen, which);
+ /* Negative workspace numbers are directions with respect to the
+ * current workspace. While we could insta-switch here by setting
+ * workspace to the result of meta_workspace_get_neighbor(), when
+ * people request a workspace switch to the left or right via
+ * the keyboard, they actually want a tab popup. So we should
+ * go there instead.
+ *
+ * Note that we're the only caller of that function, so perhaps
+ * we should merge with it.
+ */
+ handle_workspace_switch (display, screen, event_window, event, binding);
+ return;
}
+
+ workspace = meta_screen_get_workspace_by_index (screen, which);
if (workspace)
{
@@ -2649,12 +2484,10 @@ handle_run_command (MetaDisplay *display,
XEvent *event,
MetaKeyBinding *binding)
{
- int which;
+ gint which = binding->handler->data;
const char *command;
GError *err;
- which = GPOINTER_TO_INT (binding->handler->data);
-
command = meta_prefs_get_command (which);
if (command == NULL)
@@ -3023,7 +2856,7 @@ process_workspace_switch_grab (MetaDisplay *display,
}
static void
-handle_toggle_desktop (MetaDisplay *display,
+handle_show_desktop (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window,
XEvent *event,
@@ -3041,21 +2874,20 @@ handle_toggle_desktop (MetaDisplay *display,
}
static void
-handle_panel_keybinding (MetaDisplay *display,
+handle_panel (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window,
XEvent *event,
MetaKeyBinding *binding)
{
- MetaKeyBindingAction action;
+ MetaKeyBindingAction action = binding->handler->data;
Atom action_atom;
XClientMessageEvent ev;
-
- action = GPOINTER_TO_INT (binding->handler->data);
action_atom = None;
switch (action)
{
+ /* FIXME: The numbers are wrong */
case META_KEYBINDING_ACTION_PANEL_MAIN_MENU:
action_atom = display->atom__GNOME_PANEL_ACTION_MAIN_MENU;
break;
@@ -3161,11 +2993,9 @@ do_choose_window (MetaDisplay *display,
gboolean backward,
gboolean show_popup)
{
- MetaTabList type;
+ MetaTabList type = binding->handler->data;
MetaWindow *initial_selection;
-
- type = GPOINTER_TO_INT (binding->handler->data);
-
+
meta_topic (META_DEBUG_KEYBINDINGS,
"Tab list = %u show_popup = %d\n", type, show_popup);
@@ -3254,49 +3084,32 @@ do_choose_window (MetaDisplay *display,
}
static void
-handle_tab_forward (MetaDisplay *display,
+handle_switch (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *event_window,
XEvent *event,
MetaKeyBinding *binding)
{
- do_choose_window (display, screen,
- event_window, event, binding, FALSE, TRUE);
-}
+ gint backwards = binding->handler->flags & BINDING_IS_REVERSED;
-static void
-handle_tab_backward (MetaDisplay *display,
- MetaScreen *screen,
- MetaWindow *event_window,
- XEvent *event,
- MetaKeyBinding *binding)
-{
- do_choose_window (display, screen,
- event_window, event, binding, TRUE, TRUE);
+ do_choose_window (display, screen, event_window, event, binding,
+ backwards, TRUE);
}
static void
-handle_cycle_forward (MetaDisplay *display,
- MetaScreen *screen,
- MetaWindow *event_window,
- XEvent *event,
- MetaKeyBinding *binding)
+handle_cycle (MetaDisplay *display,
+ MetaScreen *screen,
+ MetaWindow *event_window,
+ XEvent *event,
+ MetaKeyBinding *binding)
{
- do_choose_window (display, screen,
- event_window, event, binding, FALSE, FALSE);
-}
+ gint backwards = binding->handler->flags & BINDING_IS_REVERSED;
-static void
-handle_cycle_backward (MetaDisplay *display,
- MetaScreen *screen,
- MetaWindow *event_window,
- XEvent *event,
- MetaKeyBinding *binding)
-{
- do_choose_window (display, screen,
- event_window, event, binding, TRUE, FALSE);
+ do_choose_window (display, screen, event_window, event, binding,
+ backwards, FALSE);
}
+
static void
handle_toggle_fullscreen (MetaDisplay *display,
MetaScreen *screen,
@@ -3476,11 +3289,10 @@ handle_move_to_workspace (MetaDisplay *display,
XEvent *event,
MetaKeyBinding *binding)
{
- int which;
- gboolean flip;
+ gint which = binding->handler->data;
+ gboolean flip = (which < 0);
MetaWorkspace *workspace;
- which = GPOINTER_TO_INT (binding->handler->data);
/* If which is zero or positive, it's a workspace number, and the window
* should move to the workspace with that number.
*
@@ -3488,7 +3300,6 @@ handle_move_to_workspace (MetaDisplay *display,
* position; it's expressed as a member of the MetaMotionDirection enum,
* all of whose members are negative. Such a change is called a flip.
*/
- flip = (which < 0);
if (window == NULL || window->always_sticky)
return;
@@ -3607,11 +3418,9 @@ handle_workspace_switch (MetaDisplay *display,
XEvent *event,
MetaKeyBinding *binding)
{
- int motion;
+ gint motion = binding->handler->data;
unsigned int grab_mask;
- motion = GPOINTER_TO_INT (binding->handler->data);
-
g_assert (motion < 0);
meta_topic (META_DEBUG_KEYBINDINGS,
@@ -3665,7 +3474,7 @@ handle_workspace_switch (MetaDisplay *display,
}
static void
-handle_spew_mark (MetaDisplay *display,
+handle_set_spew_mark (MetaDisplay *display,
MetaScreen *screen,
MetaWindow *window,
XEvent *event,
diff --git a/src/core/prefs.c b/src/core/prefs.c
index dffe71cf..130d52f6 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -1815,80 +1815,16 @@ meta_prefs_set_num_workspaces (int n_workspaces)
#endif /* HAVE_GCONF */
}
-/* Indexes must correspond to MetaKeybindingAction */
static MetaKeyPref screen_bindings[] = {
- { META_KEYBINDING_WORKSPACE_1, NULL, FALSE },
- { META_KEYBINDING_WORKSPACE_2, NULL, FALSE },
- { META_KEYBINDING_WORKSPACE_3, NULL, FALSE },
- { META_KEYBINDING_WORKSPACE_4, NULL, FALSE },
- { META_KEYBINDING_WORKSPACE_5, NULL, FALSE },
- { META_KEYBINDING_WORKSPACE_6, NULL, FALSE },
- { META_KEYBINDING_WORKSPACE_7, NULL, FALSE },
- { META_KEYBINDING_WORKSPACE_8, NULL, FALSE },
- { META_KEYBINDING_WORKSPACE_9, NULL, FALSE },
- { META_KEYBINDING_WORKSPACE_10, NULL, FALSE },
- { META_KEYBINDING_WORKSPACE_11, NULL, FALSE },
- { META_KEYBINDING_WORKSPACE_12, NULL, FALSE },
- { META_KEYBINDING_WORKSPACE_LEFT, NULL, FALSE },
- { META_KEYBINDING_WORKSPACE_RIGHT, NULL, FALSE },
- { META_KEYBINDING_WORKSPACE_UP, NULL, FALSE },
- { META_KEYBINDING_WORKSPACE_DOWN, NULL, FALSE },
- { META_KEYBINDING_SWITCH_GROUP, NULL, TRUE },
- { META_KEYBINDING_SWITCH_GROUP_BACKWARD, NULL, TRUE },
- { META_KEYBINDING_SWITCH_WINDOWS, NULL, TRUE },
- { META_KEYBINDING_SWITCH_WINDOWS_BACKWARD, NULL, TRUE },
- { META_KEYBINDING_SWITCH_PANELS, NULL, TRUE },
- { META_KEYBINDING_SWITCH_PANELS_BACKWARD, NULL, TRUE },
- { META_KEYBINDING_CYCLE_GROUP, NULL, TRUE },
- { META_KEYBINDING_CYCLE_GROUP_BACKWARD, NULL, TRUE },
- { META_KEYBINDING_CYCLE_WINDOWS, NULL, TRUE },
- { META_KEYBINDING_CYCLE_WINDOWS_BACKWARD, NULL, TRUE },
- { META_KEYBINDING_CYCLE_PANELS, NULL, TRUE },
- { META_KEYBINDING_CYCLE_PANELS_BACKWARD, NULL, TRUE },
- { META_KEYBINDING_SHOW_DESKTOP, NULL, FALSE },
- { META_KEYBINDING_PANEL_MAIN_MENU, NULL, FALSE },
- { META_KEYBINDING_PANEL_RUN_DIALOG, NULL, FALSE },
- { META_KEYBINDING_COMMAND_1, NULL, FALSE },
- { META_KEYBINDING_COMMAND_2, NULL, FALSE },
- { META_KEYBINDING_COMMAND_3, NULL, FALSE },
- { META_KEYBINDING_COMMAND_4, NULL, FALSE },
- { META_KEYBINDING_COMMAND_5, NULL, FALSE },
- { META_KEYBINDING_COMMAND_6, NULL, FALSE },
- { META_KEYBINDING_COMMAND_7, NULL, FALSE },
- { META_KEYBINDING_COMMAND_8, NULL, FALSE },
- { META_KEYBINDING_COMMAND_9, NULL, FALSE },
- { META_KEYBINDING_COMMAND_10, NULL, FALSE },
- { META_KEYBINDING_COMMAND_11, NULL, FALSE },
- { META_KEYBINDING_COMMAND_12, NULL, FALSE },
- { META_KEYBINDING_COMMAND_13, NULL, FALSE },
- { META_KEYBINDING_COMMAND_14, NULL, FALSE },
- { META_KEYBINDING_COMMAND_15, NULL, FALSE },
- { META_KEYBINDING_COMMAND_16, NULL, FALSE },
- { META_KEYBINDING_COMMAND_17, NULL, FALSE },
- { META_KEYBINDING_COMMAND_18, NULL, FALSE },
- { META_KEYBINDING_COMMAND_19, NULL, FALSE },
- { META_KEYBINDING_COMMAND_20, NULL, FALSE },
- { META_KEYBINDING_COMMAND_21, NULL, FALSE },
- { META_KEYBINDING_COMMAND_22, NULL, FALSE },
- { META_KEYBINDING_COMMAND_23, NULL, FALSE },
- { META_KEYBINDING_COMMAND_24, NULL, FALSE },
- { META_KEYBINDING_COMMAND_25, NULL, FALSE },
- { META_KEYBINDING_COMMAND_26, NULL, FALSE },
- { META_KEYBINDING_COMMAND_27, NULL, FALSE },
- { META_KEYBINDING_COMMAND_28, NULL, FALSE },
- { META_KEYBINDING_COMMAND_29, NULL, FALSE },
- { META_KEYBINDING_COMMAND_30, NULL, FALSE },
- { META_KEYBINDING_COMMAND_31, NULL, FALSE },
- { META_KEYBINDING_COMMAND_32, NULL, FALSE },
- { META_KEYBINDING_COMMAND_SCREENSHOT, NULL, FALSE },
- { META_KEYBINDING_COMMAND_WIN_SCREENSHOT, NULL, FALSE },
- { META_KEYBINDING_RUN_COMMAND_TERMINAL, NULL, FALSE },
- { META_KEYBINDING_SET_SPEW_MARK, NULL, FALSE },
+#define item(name, suffix, param, has_inverse, short, long, stroke) \
+ { #name suffix, NULL, has_inverse },
+#include "screen-bindings.h"
+#undef item
{ NULL, NULL, FALSE}
};
static MetaKeyPref window_bindings[] = {
-#define item(name, suffix, param, a, b, c) \
+#define item(name, suffix, param, short, long, stroke) \
{ #name suffix, NULL, FALSE },
#include "window-bindings.h"
#undef item
@@ -1902,24 +1838,18 @@ typedef struct
const char *keybinding;
} MetaSimpleKeyMapping;
-/* Name field must occur in the same order as screen_bindings, though entries
- * can be skipped
+/* FIXME: This would be neater if the array only contained entries whose
+ * default keystroke was non-null. You can do this by defining
+ * ONLY_BOUND_BY_DEFAULT around various blocks at the cost of making
+ * the bindings file way more complicated. However, we could stop this being
+ * data and move it into code. Then the compiler would optimise away
+ * the problem lines.
*/
static MetaSimpleKeyMapping screen_string_bindings[] = {
- { META_KEYBINDING_WORKSPACE_LEFT, "<Control><Alt>Left" },
- { META_KEYBINDING_WORKSPACE_RIGHT, "<Control><Alt>Right" },
- { META_KEYBINDING_WORKSPACE_UP, "<Control><Alt>Up" },
- { META_KEYBINDING_WORKSPACE_DOWN, "<Control><Alt>Down" },
- { META_KEYBINDING_SWITCH_WINDOWS, "<Alt>Tab" },
- { META_KEYBINDING_SWITCH_PANELS, "<Control><Alt>Tab" },
- { META_KEYBINDING_CYCLE_GROUP, "<Alt>F6" },
- { META_KEYBINDING_CYCLE_WINDOWS, "<Alt>Escape" },
- { META_KEYBINDING_CYCLE_PANELS, "<Control><Alt>Escape" },
- { META_KEYBINDING_SHOW_DESKTOP, "<Control><Alt>d" },
- { META_KEYBINDING_PANEL_MAIN_MENU, "<Alt>F1" },
- { META_KEYBINDING_PANEL_RUN_DIALOG, "<Alt>F2" },
- { META_KEYBINDING_COMMAND_SCREENSHOT, "Print" },
- { META_KEYBINDING_COMMAND_WIN_SCREENSHOT, "<Alt>Print" },
+#define item(name, suffix, param, is_reverse, short, long, keystroke) \
+ { #name suffix, keystroke },
+#include "screen-bindings.h"
+#undef item
{ NULL, NULL }
};
@@ -2030,6 +1960,9 @@ init_bindings (void)
int which = 0;
while (window_string_bindings[i].name)
{
+ if (window_string_bindings[i].keybinding == NULL)
+ continue;
+
/* Find which window_bindings entry this window_string_bindings entry
* corresponds to.
*/
@@ -2048,6 +1981,9 @@ init_bindings (void)
which = 0;
while (screen_string_bindings[i].name)
{
+ if (screen_string_bindings[i].keybinding == NULL)
+ continue;
+
/* Find which window_bindings entry this window_string_bindings entry
* corresponds to.
*/
diff --git a/src/core/schema-bindings.c b/src/core/schema-bindings.c
index 49b8c4bb..91d00263 100644
--- a/src/core/schema-bindings.c
+++ b/src/core/schema-bindings.c
@@ -22,8 +22,10 @@
/** \file Schema bindings generator.
*
* This program simply takes the items given in the binding lists in
- * window-bindings.h and turns them into a portion of
+ * window-bindings.h and scheme-bindings.h and turns them into a portion of
* the GConf .schemas file.
+ *
+ * FIXME: also need to make 50-metacity-desktop-key.xml
*/
#include <stdio.h>
@@ -31,7 +33,7 @@
#define _(x) x
-char *liberal;
+char *liberal, *could_go_backwards, *could_go_forwards;
const char* window_string = \
" <schema>\n" \
@@ -49,38 +51,108 @@ const char* window_string = \
" </schema>\n\n\n";
void
-produce_window_bindings ()
+single_stanza (gboolean is_window, char *name, char *default_value,
+ gboolean can_reverse, gboolean going_backwards,
+ char *short_description, char *long_description)
{
- /* Escaped versions of each of these fields (i.e. > => &gt;, etc) */
- gchar *esc_short, *esc_long, *esc_key;
+ char *keybinding_type = is_window? "window": "global";
+ char *escaped_default_value;
+
+ if (short_description == NULL || long_description == NULL)
+ /* it must be undocumented, so it can't be in this table */
+ return;
+
+ /* Escape the text. The old values point at constants (literals, actually)
+ * so it doesn't matter that we lose the reference.
+ */
+ short_description = g_markup_escape_text (short_description, -1);
+ long_description = g_markup_escape_text (long_description, -1);
+
+ escaped_default_value = g_markup_escape_text (
+ default_value? default_value: "disabled",
+ -1);
+
+ printf (" <schema>\n");
+ printf (" <key>/schemas/apps/metacity/%s_keybindings/%s</key>\n",
+ keybinding_type, name);
+ printf (" <applyto>/apps/metacity/%s_keybindings/%s</applyto>\n",
+ keybinding_type, name);
+ printf (" <owner>metacity</owner>\n");
+ printf (" <type>string</type>\n");
+ printf (" <default>%s</default>\n", escaped_default_value);
+ printf (" <locale name=\"C\">\n");
+ printf (" <short>%s</short>\n", short_description);
+ printf (" <long>\n");
+ printf (" %s\n", long_description);
+
+ if (can_reverse)
+ {
+ /* I don't think this is very useful, tbh: */
+ if (default_value != NULL)
+ {
+ printf (" (Traditionally %s)\n", escaped_default_value);
+ }
+
+ if (going_backwards)
+ printf (could_go_forwards);
+ else
+ printf (could_go_backwards);
+ }
+
+ printf (" </long>\n");
+ printf (" </locale>\n");
+ printf (" </schema>\n\n\n");
+
+ g_free (escaped_default_value);
+ g_free (short_description);
+ g_free (long_description);
+}
+void
+produce_bindings ()
+{
#define item(name, suffix, param, short, long, keystroke) \
- esc_short = g_markup_escape_text (short, -1);\
- esc_long = g_markup_escape_text (long, -1);\
- if (keystroke) esc_key = g_markup_escape_text (keystroke, -1);\
- printf(\
- window_string, \
- "window", #name, suffix? suffix:"", \
- "window", #name, suffix? suffix:"",\
- keystroke? esc_key: "disabled", \
- esc_short, esc_long, liberal);\
- g_free (esc_short);\
- g_free (esc_long);\
- if (keystroke) g_free (esc_key);
-#include "../src/core/window-bindings.h"
+ single_stanza (TRUE, #name suffix, \
+ keystroke, \
+ FALSE, FALSE, \
+ short, long);
+#include "window-bindings.h"
+#undef item
+
+#define item(name, suffix, param, flags, short, long, keystroke) \
+ single_stanza (FALSE, #name suffix, \
+ keystroke, \
+ flags & BINDING_REVERSES, \
+ flags & BINDING_IS_REVERSED, \
+ short, long);
+#include "screen-bindings.h"
#undef item
}
int
main ()
{
+ /* XXX: TODO: find out what/how gdk i18ns the keycaps as, and add a
+ * translator comment
+ */
liberal = g_markup_escape_text(_("The parser is fairly liberal and allows "\
"lower or upper case, and also abbreviations such as \"<Ctl>\" and " \
"\"<Ctrl>\". If you set the option to the special string " \
"\"disabled\", then there will be no keybinding for this action."), -1);
- produce_window_bindings ();
+ /* These were more dissimilar at some point but have been regularised
+ * for the translators' benefit.
+ */
+ could_go_backwards = g_markup_escape_text (_("Holding the \"shift\" key "
+ "while using this binding reverses the direction of movement."), -1);
+
+ could_go_forwards = g_markup_escape_text (_("Holding the \"shift\" key "
+ "while using this binding makes the direction go forward again."), -1);
+
+ produce_bindings ();
+ g_free (could_go_forwards);
+ g_free (could_go_backwards);
g_free (liberal);
}
diff --git a/src/core/screen-bindings.h b/src/core/screen-bindings.h
new file mode 100644
index 00000000..054d5cac
--- /dev/null
+++ b/src/core/screen-bindings.h
@@ -0,0 +1,307 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+
+/*
+ * Copyright (C) 2008 Thomas Thurman
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
+
+/**
+ * A list of screen keybinding information.
+ *
+ * Each action which can have a keystroke bound to it is listed below.
+ * To use this file, define "item" to be a seven-argument macro (you can
+ * throw any of the arguments you please away), include this file,
+ * and then undefine the macro again.
+ *
+ * (If you aren't familiar with this technique, sometimes called "x-macros",
+ * see DDJ of May 2001: <http://www.ddj.com/cpp/184401387>.)
+ *
+ * This makes it possible to keep all information about all the keybindings
+ * in the same place. The only exception is the code to run when an action
+ * is actually invoked; while we *could* have put that in this file, it would
+ * have made debugging ridiculously difficult. Instead, each action should
+ * have a corresponding static function named handle_<name>() in
+ * keybindings.c.
+ *
+ * (This may merge with window-bindings.h at some point, but traditionally
+ * they have been separate concerns. Meanwhile, it is important that actions
+ * don't have names which clash between the two.)
+ *
+ * Currently, the GConf schemas in src/metacity.schemas also need to be
+ * updated separately. There is a program called schema-bindings.c in this
+ * directory which will fix that, but it needs integrating into the build
+ * process.
+ *
+ * The arguments to item() are:
+ * 1) the name of the binding; a bareword identifier
+ * (it's fine if it happens to clash with a C reserved word)
+ * 2) a string to add to the binding name to make the handler name
+ * (usually the empty string)
+ * 3) an integer parameter to pass to the handler
+ * 4) a set of boolean flags, ORed together:
+ * BINDING_PER_WINDOW - this is a window-based binding
+ * (not used in this file)
+ * BINDING_REVERSES - the binding can reverse if you hold down Shift
+ * BINDING_IS_REVERSED - the same, but the senses are reversed from the
+ * handler's point of view (let me know if I should
+ * explain this better)
+ *
+ * 5) a short description. Mostly, you won't use this.
+ * It must be marked translatable (i.e. inside "_(...)").
+ * 6) like short, except long. Don't include all the stuff about
+ * the parser being fairly liberal.
+ * 7) a string representing the default binding.
+ * If this is NULL, the action is unbound by default.
+ *
+ * Don't try to do XML entity escaping anywhere in the strings.
+ */
+
+#ifndef item
+#error "item () must be defined when you include screen-bindings.h"
+#endif
+
+/***********************************/
+
+#ifndef _BINDINGS_DEFINED_CONSTANTS
+#define _BINDINGS_DEFINED_CONSTANTS 1
+
+#define BINDING_PER_WINDOW 0x01
+#define BINDING_REVERSES 0x02
+#define BINDING_IS_REVERSED 0x06 /* REVERSES is implied */
+
+/* FIXME: There is somewhere better for these; remove them */
+#define PANEL_MAIN_MENU -1
+#define PANEL_RUN_DIALOG -2
+
+#endif /* _BINDINGS_DEFINED_CONSTANTS */
+
+/***********************************/
+
+item (switch_to_workspace, "_1", 1, 0,
+ _("Switch to workspace 1"),
+ _("The keybinding that switches to workspace 1."),
+ NULL)
+item (switch_to_workspace, "_2", 2, 0,
+ _("Switch to workspace 2"),
+ _("The keybinding that switches to workspace 2."),
+ NULL)
+item (switch_to_workspace, "_3", 3, 0,
+ _("Switch to workspace 3"),
+ _("The keybinding that switches to workspace 3."),
+ NULL)
+item (switch_to_workspace, "_4", 4, 0,
+ _("Switch to workspace 4"),
+ _("The keybinding that switches to workspace 4."),
+ NULL)
+item (switch_to_workspace, "_5", 5, 0,
+ _("Switch to workspace 5"),
+ _("The keybinding that switches to workspace 5."),
+ NULL)
+item (switch_to_workspace, "_6", 6, 0,
+ _("Switch to workspace 6"),
+ _("The keybinding that switches to workspace 6."),
+ NULL)
+item (switch_to_workspace, "_7", 7, 0,
+ _("Switch to workspace 7"),
+ _("The keybinding that switches to workspace 7."),
+ NULL)
+item (switch_to_workspace, "_8", 8, 0,
+ _("Switch to workspace 8"),
+ _("The keybinding that switches to workspace 8."),
+ NULL)
+item (switch_to_workspace, "_9", 9, 0,
+ _("Switch to workspace 9"),
+ _("The keybinding that switches to workspace 9."),
+ NULL)
+item (switch_to_workspace, "_10", 10, 0,
+ _("Switch to workspace 10"),
+ _("The keybinding that switches to workspace 10."),
+ NULL)
+item (switch_to_workspace, "_11", 11, 0,
+ _("Switch to workspace 11"),
+ _("The keybinding that switches to workspace 11."),
+ NULL)
+item (switch_to_workspace, "_12", 12, 0,
+ _("Switch to workspace 12"),
+ _("The keybinding that switches to workspace 12."),
+ NULL)
+
+/* META_MOTION_* are negative, and so distinct from workspace numbers,
+ * which are always zero or positive.
+ * If you make use of these constants, you will need to include workspace.h
+ * (which you're probably using already for other reasons anyway).
+ * If your definition of item() throws them away, you don't need to include
+ * workspace.h, of course.
+ */
+
+item (switch_to_workspace, "_left", META_MOTION_LEFT, 0,
+ _("Switch to workspace on the left"),
+ _("The keybinding that switches to the workspace on the left "
+ "of the current workspace."),
+ "<Control><Alt>Left")
+
+item (switch_to_workspace, "_right", META_MOTION_RIGHT, 0,
+ _("Switch to workspace on the right"),
+ _("The keybinding that switches to the workspace on the right "
+ "of the current workspace."),
+ "<Control><Alt>Right")
+
+item (switch_to_workspace, "_up", META_MOTION_UP, 0,
+ _("Switch to workspace above this one"),
+ _("The keybinding that switches to the workspace above "
+ "the current workspace."),
+ "<Control><Alt>Up")
+
+item (switch_to_workspace, "_down", META_MOTION_DOWN, 0,
+ _("Switch to workspace below this one"),
+ _("The keybinding that switches to the workspace below "
+ "the current workspace."),
+ "<Control><Alt>Down")
+
+/***********************************/
+
+/* The ones which have inverses. These can't be bound to any keystroke
+ * containing Shift because Shift will invert their "backwards" state.
+ *
+ * TODO: "NORMAL" and "DOCKS" should be renamed to the same name as their
+ * action, for obviousness.
+ */
+
+item (switch, "_group", META_TAB_LIST_GROUP, BINDING_REVERSES,
+ _("Move between windows of an application with popup"),
+ _("The keybinding used to move focus between windows of an"
+ "application, using a popup window."), NULL)
+item (switch, "_group_backwards", META_TAB_LIST_GROUP, BINDING_IS_REVERSED,
+ _("Move backwards between windows of an application with popup"),
+ _("The keybinding used to move focus backwards between windows"
+ "of an application, using a popup window."), NULL)
+item (switch, "_windows", META_TAB_LIST_NORMAL, BINDING_REVERSES,
+ _("Move between windows with popup"),
+ _("The keybinding used to move focus between windows, "
+ "using a popup window."), "<Alt>Tab")
+item (switch, "_windows_backwards",META_TAB_LIST_NORMAL, BINDING_IS_REVERSED,
+ _("Move focus backwards between windows using popup display"),
+ _("The keybinding used to move focus backwards between windows, "
+ "using a popup window."), NULL)
+item (switch, "_panels", META_TAB_LIST_DOCKS, BINDING_REVERSES,
+ _("Move between panels and the desktop with popup"),
+ _("The keybinding used to move focus between panels and the desktop, "
+ "using a popup window."), "<Control><Alt>Tab")
+item (switch, "_panels_backwards", META_TAB_LIST_DOCKS, BINDING_IS_REVERSED,
+ _("Move backwards between panels and the desktop with popup"),
+ _("The keybinding used to move focus backwards between panels "
+ "and the desktop, using a popup window."), NULL)
+item (cycle, "_group", META_TAB_LIST_GROUP, BINDING_REVERSES,
+ _("Move between windows of an application immediately"),
+ _("The keybinding used to move focus between windows of an "
+ "application without a popup window."), "<Alt>F6")
+item (cycle, "_group_backwards", META_TAB_LIST_GROUP, BINDING_IS_REVERSED,
+ _("Move backwards between windows of an application immediately"),
+ _("The keybinding used to move focus backwards between windows "
+ "of an application without a popup window."), NULL)
+item (cycle, "_windows", META_TAB_LIST_NORMAL, BINDING_REVERSES,
+ _("Move between windows immediately"),
+ _("The keybinding used to move focus between windows without "
+ "a popup window."), "<Alt>Escape")
+item (cycle, "_windows_backwards",META_TAB_LIST_NORMAL, BINDING_IS_REVERSED,
+ _("Move backwards between windows immediately"),
+ _("The keybinding used to move focus backwards between windows "
+ "without a popup window."), NULL)
+item (cycle, "_panels", META_TAB_LIST_DOCKS, BINDING_REVERSES,
+ _("Move between panels and the desktop immediately"),
+ _("The keybinding used to move focus between panels and "
+ "the desktop, without a popup window."), "<Control><Alt>Escape")
+item (cycle, "_panels_backwards", META_TAB_LIST_DOCKS, BINDING_IS_REVERSED,
+ _("Move backward between panels and the desktop immediately"),
+ _("The keybinding used to move focus backwards between panels and "
+ "the desktop, without a popup window."), NULL)
+
+/***********************************/
+
+item (show_desktop, "", 0, 0,
+ _("Hide all windows and focus desktop"),
+ _("The keybinding used to hide all normal windows and set the "
+ "focus to the desktop background."),
+ "<Control><Alt>d")
+item (panel, "_main_menu", META_KEYBINDING_ACTION_PANEL_MAIN_MENU, 0,
+ _("Show the panel menu"),
+ _("The keybinding which shows the panel's main menu."),
+ "<Alt>F1")
+item (panel, "_run_dialog", META_KEYBINDING_ACTION_PANEL_RUN_DIALOG, 0,
+ _("Show the panel run application dialog"),
+ _("The keybinding which display's the panel's \"Run Application\" "
+ "dialog box."),
+ "<Alt>F2")
+
+/* Yes, the param is offset by one. Historical reasons. (Maybe worth fixing
+ * at some point.) The short and long are NULL here because the stanza is
+ * irregularly shaped in metacity.schemas.in. This will probably be fixed
+ * as well.
+ */
+item (run_command, "_1", 0, 0, NULL, NULL, NULL)
+item (run_command, "_2", 1, 0, NULL, NULL, NULL)
+item (run_command, "_3", 2, 0, NULL, NULL, NULL)
+item (run_command, "_4", 3, 0, NULL, NULL, NULL)
+item (run_command, "_5", 4, 0, NULL, NULL, NULL)
+item (run_command, "_6", 5, 0, NULL, NULL, NULL)
+item (run_command, "_7", 6, 0, NULL, NULL, NULL)
+item (run_command, "_8", 7, 0, NULL, NULL, NULL)
+item (run_command, "_9", 8, 0, NULL, NULL, NULL)
+item (run_command, "_10", 9, 0, NULL, NULL, NULL)
+item (run_command, "_11", 10, 0, NULL, NULL, NULL)
+item (run_command, "_12", 11, 0, NULL, NULL, NULL)
+item (run_command, "_13", 12, 0, NULL, NULL, NULL)
+item (run_command, "_14", 13, 0, NULL, NULL, NULL)
+item (run_command, "_15", 14, 0, NULL, NULL, NULL)
+item (run_command, "_16", 15, 0, NULL, NULL, NULL)
+item (run_command, "_17", 16, 0, NULL, NULL, NULL)
+item (run_command, "_18", 17, 0, NULL, NULL, NULL)
+item (run_command, "_19", 18, 0, NULL, NULL, NULL)
+item (run_command, "_20", 19, 0, NULL, NULL, NULL)
+item (run_command, "_21", 20, 0, NULL, NULL, NULL)
+item (run_command, "_22", 21, 0, NULL, NULL, NULL)
+item (run_command, "_23", 22, 0, NULL, NULL, NULL)
+item (run_command, "_24", 23, 0, NULL, NULL, NULL)
+item (run_command, "_25", 24, 0, NULL, NULL, NULL)
+item (run_command, "_26", 25, 0, NULL, NULL, NULL)
+item (run_command, "_27", 26, 0, NULL, NULL, NULL)
+item (run_command, "_28", 27, 0, NULL, NULL, NULL)
+item (run_command, "_29", 28, 0, NULL, NULL, NULL)
+item (run_command, "_30", 29, 0, NULL, NULL, NULL)
+item (run_command, "_31", 30, 0, NULL, NULL, NULL)
+item (run_command, "_32", 31, 0, NULL, NULL, NULL)
+
+item (run_command, "_screenshot", 32, 0,
+ _("Take a screenshot"),
+ _("The keybinding which invokes the panel's screenshot utility."),
+ "Print")
+item (run_command, "_window_screenshot", 33, 0,
+ _("Take a screenshot of a window"),
+ _("The keybinding which invokes the panel's screenshot utility "
+ "to take a screenshot of a window."),
+ "<Alt>Print")
+
+item (run_terminal, "", 0, 0,
+ _("Run a terminal"),
+ _("The keybinding which invokes a terminal."),
+ NULL)
+
+/* No descriptions because this is undocumented */
+item (set_spew_mark, "", 0, 0, NULL, NULL, NULL)
+
+/* eof screen-bindings.h */
+
diff --git a/src/core/window-bindings.h b/src/core/window-bindings.h
index 8616cd9b..ab3d8e2f 100644
--- a/src/core/window-bindings.h
+++ b/src/core/window-bindings.h
@@ -20,7 +20,7 @@
*/
/**
- * \file A list of window binding information.
+ * \file A list of window keybinding information.
*
* Each action which can have a keystroke bound to it is listed below.
* To use this file, define "item" to be a six-argument macro (you can
diff --git a/src/include/prefs.h b/src/include/prefs.h
index 9a4d1285..69f978c7 100644
--- a/src/include/prefs.h
+++ b/src/include/prefs.h
@@ -120,75 +120,11 @@ gboolean meta_prefs_get_compositing_manager (void);
*/
void meta_prefs_set_compositing_manager (gboolean whether);
-/* Screen bindings */
-#define META_KEYBINDING_WORKSPACE_1 "switch_to_workspace_1"
-#define META_KEYBINDING_WORKSPACE_2 "switch_to_workspace_2"
-#define META_KEYBINDING_WORKSPACE_3 "switch_to_workspace_3"
-#define META_KEYBINDING_WORKSPACE_4 "switch_to_workspace_4"
-#define META_KEYBINDING_WORKSPACE_5 "switch_to_workspace_5"
-#define META_KEYBINDING_WORKSPACE_6 "switch_to_workspace_6"
-#define META_KEYBINDING_WORKSPACE_7 "switch_to_workspace_7"
-#define META_KEYBINDING_WORKSPACE_8 "switch_to_workspace_8"
-#define META_KEYBINDING_WORKSPACE_9 "switch_to_workspace_9"
-#define META_KEYBINDING_WORKSPACE_10 "switch_to_workspace_10"
-#define META_KEYBINDING_WORKSPACE_11 "switch_to_workspace_11"
-#define META_KEYBINDING_WORKSPACE_12 "switch_to_workspace_12"
-#define META_KEYBINDING_WORKSPACE_LEFT "switch_to_workspace_left"
-#define META_KEYBINDING_WORKSPACE_RIGHT "switch_to_workspace_right"
-#define META_KEYBINDING_WORKSPACE_UP "switch_to_workspace_up"
-#define META_KEYBINDING_WORKSPACE_DOWN "switch_to_workspace_down"
-#define META_KEYBINDING_SWITCH_GROUP "switch_group"
-#define META_KEYBINDING_SWITCH_GROUP_BACKWARD "switch_group_backward"
-#define META_KEYBINDING_SWITCH_WINDOWS "switch_windows"
-#define META_KEYBINDING_SWITCH_WINDOWS_BACKWARD "switch_windows_backward"
-#define META_KEYBINDING_SWITCH_PANELS "switch_panels"
-#define META_KEYBINDING_SWITCH_PANELS_BACKWARD "switch_panels_backward"
-#define META_KEYBINDING_CYCLE_GROUP "cycle_group"
-#define META_KEYBINDING_CYCLE_GROUP_BACKWARD "cycle_group_backward"
-#define META_KEYBINDING_CYCLE_WINDOWS "cycle_windows"
-#define META_KEYBINDING_CYCLE_WINDOWS_BACKWARD "cycle_windows_backward"
-#define META_KEYBINDING_CYCLE_PANELS "cycle_panels"
-#define META_KEYBINDING_CYCLE_PANELS_BACKWARD "cycle_panels_backward"
-#define META_KEYBINDING_SHOW_DESKTOP "show_desktop"
-#define META_KEYBINDING_PANEL_MAIN_MENU "panel_main_menu"
-#define META_KEYBINDING_PANEL_RUN_DIALOG "panel_run_dialog"
-#define META_KEYBINDING_COMMAND_1 "run_command_1"
-#define META_KEYBINDING_COMMAND_2 "run_command_2"
-#define META_KEYBINDING_COMMAND_3 "run_command_3"
-#define META_KEYBINDING_COMMAND_4 "run_command_4"
-#define META_KEYBINDING_COMMAND_5 "run_command_5"
-#define META_KEYBINDING_COMMAND_6 "run_command_6"
-#define META_KEYBINDING_COMMAND_7 "run_command_7"
-#define META_KEYBINDING_COMMAND_8 "run_command_8"
-#define META_KEYBINDING_COMMAND_9 "run_command_9"
-#define META_KEYBINDING_COMMAND_10 "run_command_10"
-#define META_KEYBINDING_COMMAND_11 "run_command_11"
-#define META_KEYBINDING_COMMAND_12 "run_command_12"
-#define META_KEYBINDING_COMMAND_13 "run_command_13"
-#define META_KEYBINDING_COMMAND_14 "run_command_14"
-#define META_KEYBINDING_COMMAND_15 "run_command_15"
-#define META_KEYBINDING_COMMAND_16 "run_command_16"
-#define META_KEYBINDING_COMMAND_17 "run_command_17"
-#define META_KEYBINDING_COMMAND_18 "run_command_18"
-#define META_KEYBINDING_COMMAND_19 "run_command_19"
-#define META_KEYBINDING_COMMAND_20 "run_command_20"
-#define META_KEYBINDING_COMMAND_21 "run_command_21"
-#define META_KEYBINDING_COMMAND_22 "run_command_22"
-#define META_KEYBINDING_COMMAND_23 "run_command_23"
-#define META_KEYBINDING_COMMAND_24 "run_command_24"
-#define META_KEYBINDING_COMMAND_25 "run_command_25"
-#define META_KEYBINDING_COMMAND_26 "run_command_26"
-#define META_KEYBINDING_COMMAND_27 "run_command_27"
-#define META_KEYBINDING_COMMAND_28 "run_command_28"
-#define META_KEYBINDING_COMMAND_29 "run_command_29"
-#define META_KEYBINDING_COMMAND_30 "run_command_30"
-#define META_KEYBINDING_COMMAND_31 "run_command_31"
-#define META_KEYBINDING_COMMAND_32 "run_command_32"
-#define META_KEYBINDING_COMMAND_SCREENSHOT "run_command_screenshot"
-#define META_KEYBINDING_COMMAND_WIN_SCREENSHOT "run_command_window_screenshot"
-#define META_KEYBINDING_RUN_COMMAND_TERMINAL "run_command_terminal"
-#define META_KEYBINDING_SET_SPEW_MARK "set_spew_mark"
-
+/* XXX FIXME This should be x-macroed, but isn't yet because it would be
+ * difficult (or perhaps impossible) to add the suffixes using the current
+ * system. It needs some more thought, perhaps after the current system
+ * evolves a little.
+ */
typedef enum _MetaKeyBindingAction
{
META_KEYBINDING_ACTION_NONE = -1,