diff --git a/ChangeLog b/ChangeLog index 7bc5305ad..02baa2ab6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,43 @@ +2008-10-06 William Lachance + + Pass modified mouse button events down to panel windows + instead of dealing with them ourselves. Closes #554428. + + * src/core/display.c (prefs_changed_callback): don't grab mouse + buttons on panels + * src/core/window.c (meta_window_new_with_attrs): ditto + +2008-10-05 Thomas Thurman + + 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 + + * tools/ppa-magic.py: experimental tool for Launchpad upload + +2008-10-05 Thomas Thurman + + * metacity.doap: Havoc is an author; Thomas has an email address; + add a ton of release information going back to the early days, + although not right to the beginning. + 2008-09-26 Thomas Thurman * autogen.sh: not all versions of /bin/sh can handle this script, diff --git a/metacity.doap b/metacity.doap index 7775f04ac..0d08f928b 100644 --- a/metacity.doap +++ b/metacity.doap @@ -1,3 +1,4 @@ + - + - + Havoc Pennington - + @@ -61,11 +62,649 @@ Many window managers are like Marshmallow Froot Loops; Metacity is like Cheerios Thomas Thurman + - + + 2.25.1 release + 2008-09-01 + + 2.25.1 + + + + + + 2.25.0 release + 2008-08-18 + + 2.25.0 + + + + + + 2.23.89 release + 2008-08-04 + + 2.23.89 + + + + + + 2.23.55 release + 2008-07-14 + + 2.23.55 + + + + + + 2.23.34 release + 2008-06-16 + + 2.23.34 + + + + + + 2.23.34 release + 2008-06-16 + + 2.23.34 + + + + + + 2.23.34 release + 2008-06-02 + + 2.23.34 + + + + + + 2.23.21 release + 2008-05-26 + + 2.23.21 + + + + + + 2.23.13 release + 2008-04-27 + + 2.23.13 + + + + + + 2.23.8 release + 2008-04-22 + + 2.23.8 + + + + + + 2.23.5 release + 2008-04-06 + + 2.23.5 + + + + + + 2.23.3 release + 2008-03-21 + + 2.23.3 + + + + + + 2.23.2 release + 2008-03-07 + + 2.23.2 + + + + + + 2.23.1 release + 2008-03-06 + + 2.23.1 + + + + + + 2.23.0 release + 2008-02-26 + + 2.23.0 + + + + + + 2.21.13 release + 2008-02-11 + + 2.21.13 + + + + + + 2.21.8 release + 2008-02-03 + + 2.21.8 + + + + + + 2.21.5 release + 2007-12-19 + + 2.21.5 + + + + + + 2.21.3 release + 2007-12-14 + + 2.21.3 + + + + + + 2.21.2 release + 2007-11-17 + + 2.21.2 + + + + + + 2.21.1 release + 2007-11-11 + + 2.21.1 + + + + + + 2.20.0 release + 2007-09-15 + + 2.20.0 + + + + + + 2.19.55 release + 2007-08-07 + + 2.19.55 + + + + + + 2.19.34 release + 2007-07-22 + + 2.19.34 + + + + + + 2.19.21 release + 2007-06-18 + + 2.19.21 + + + + + + 2.19.13 release + 2007-06-10 + + 2.19.13 + + + + + + 2.19.8 release + 2007-06-04 + + 2.19.8 + + + + + + 2.19.5 release + 2007-04-23 + + 2.19.5 + + + + + + 2.19.3 release + 2007-04-16 + + 2.19.3 + + + + + + 2.19.2 release + 2007-04-09 + + 2.19.2 + + + + + + 2.19.1 release + 2007-04-04 + + 2.19.1 + + + + + + 2.17.3 release + 2006-12-10 + + 2.17.3 + + + + + + 2.17.2 release + 2006-11-06 + + 2.17.2 + + + + + + 2.17.1 release + 2006-10-16 + + 2.17.1 + + + + + + 2.17.0 release + 2006-10-07 + + 2.17.0 + + + + + + 2.16.2 release + 2006-09-18 + + 2.16.2 + + + + + + 2.16.1 release + 2006-09-11 + + 2.16.1 + + + + + + 2.16.0 release + 2006-09-04 + + 2.16.0 + + + + + + 2.15.34 release + 2006-08-21 + + 2.15.34 + + + + + + 2.15.21 release + 2006-08-07 + + 2.15.21 + + + + + + 2.15.13 release + 2006-07-24 + + 2.15.13 + + + + + + 2.15.8 release + 2006-07-10 + + 2.15.8 + + + + + + 2.15.5 release + 2006-06-12 + + 2.15.5 + + + + + + 2.15.3 release + 2006-05-15 + + 2.15.3 + + + + + + 2.15.2 release + 2006-04-25 + + 2.15.2 + + + + + + 2.15.1 release + 2006-04-25 + + 2.15.1 + + + + + + 2.15.0 release + 2006-04-24 + + 2.15.0 + + + + + + 2.13.89 release + 2006-02-13 + + 2.13.89 + + + + + + 2.13.55 release + 2006-01-30 + + 2.13.55 + + + + + + 2.13.34 release + 2006-01-20 + + 2.13.34 + + + + + + 2.13.21 release + 2006-01-16 + + 2.13.21 + + + + + + 2.13.13 release + 2006-01-10 + + 2.13.13 + + + + + + 2.13.8 release + 2006-01-02 + + 2.13.8 + + + + + + 2.13.5 release + 2005-12-12 + + 2.13.5 + + + + + + 2.13.3 release + 2005-11-22 + + 2.13.3 + + + + + + 2.13.2 release + 2005-11-19 + + 2.13.2 + + + + + + 2.13.1 release + 2005-11-14 + + 2.13.1 + + + + + + 2.13.0 release + 2005-10-24 + + 2.13.0 + + + + + + 2.12.1 release + 2005-10-03 + + 2.12.1 + + + + + + 2.12.0 release + 2005-09-05 + + 2.12.0 + + + + + + 2.11.3 release + 2005-08-22 + + 2.11.3 + + + + + + 2.11.2 release + 2005-08-08 + + 2.11.2 + + + + + + 2.11.1 release + 2005-07-24 + + 2.11.1 + + + + + + 2.11.0 release + 2005-07-12 + + 2.11.0 + + + + + + 2.10.2 release + 2005-06-27 + + 2.10.2 + + + + + + 2.10.1 release + 2005-04-11 + + 2.10.1 + + + + + + 2.10.0 release + 2005-03-07 + + 2.10.0 + + + + + + 2.8.5 release + 2004-09-13 + + 2.8.5 + + + + + + 2.8.5 release + 2004-09-13 + + 2.8.5 + + + + + + 2.8.4 release + 2004-08-29 + + 2.8.4 + + + + + + 2.8.3 release + 2004-08-15 + + 2.8.3 + + + + + diff --git a/src/core/display.c b/src/core/display.c index a122cc0e8..7d4310d8d 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -4920,8 +4920,11 @@ prefs_changed_callback (MetaPreference pref, while (tmp != NULL) { MetaWindow *w = tmp->data; - meta_display_grab_focus_window_button (display, w); - meta_display_grab_window_buttons (display, w->xwindow); + if (w->type != META_WINDOW_DOCK) + { + meta_display_grab_focus_window_button (display, w); + meta_display_grab_window_buttons (display, w->xwindow); + } tmp = tmp->next; } diff --git a/src/core/keybindings.c b/src/core/keybindings.c index 47ec693a3..20f5a20b8 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); +#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); -/* debug */ 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,48 +3084,31 @@ 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; + + do_choose_window (display, screen, event_window, event, binding, + backwards, TRUE); } static void -handle_tab_backward (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, TRUE, TRUE); + gint backwards = binding->handler->flags & BINDING_IS_REVERSED; + + do_choose_window (display, screen, event_window, event, binding, + backwards, FALSE); } -static void -handle_cycle_forward (MetaDisplay *display, - MetaScreen *screen, - MetaWindow *event_window, - XEvent *event, - MetaKeyBinding *binding) -{ - do_choose_window (display, screen, - event_window, event, binding, FALSE, FALSE); -} - -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); -} static void handle_toggle_fullscreen (MetaDisplay *display, @@ -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 8d107d3bb..b9d0ff82a 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c @@ -2,11 +2,11 @@ /* Metacity preferences */ -/* +/* * Copyright (C) 2001 Havoc Pennington, Copyright (C) 2002 Red Hat Inc. * Copyright (C) 2006 Elijah Newren * 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 @@ -16,7 +16,7 @@ * 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 @@ -584,7 +584,7 @@ handle_preference_init_int (void) { MetaIntPreference *cursor = preferences_int; - + while (cursor->key!=NULL) { gint value; @@ -629,7 +629,7 @@ handle_preference_update_enum (const gchar *key, GConfValue *value) if (cursor->key==NULL) /* Didn't recognise that key. */ return FALSE; - + /* Setting it to null (that is, removing it) always means * "don't change". */ @@ -652,7 +652,7 @@ handle_preference_update_enum (const gchar *key, GConfValue *value) */ old_value = * ((gint *) cursor->target); - + /* Now look it up... */ if (!gconf_string_to_enum (cursor->symtab, @@ -667,7 +667,7 @@ handle_preference_update_enum (const gchar *key, GConfValue *value) * (We know the old value, so we can look up a suitable string in * the symtab.) */ - + meta_warning (_("GConf key '%s' is set to an invalid value\n"), key); return TRUE; @@ -697,7 +697,7 @@ handle_preference_update_bool (const gchar *key, GConfValue *value) if (cursor->target==NULL) /* No work for us to do. */ return TRUE; - + if (value==NULL) { /* Value was destroyed; let's get out of here. */ @@ -726,7 +726,7 @@ handle_preference_update_bool (const gchar *key, GConfValue *value) */ old_value = * ((gboolean *) cursor->target); - + /* Now look it up... */ *((gboolean *) cursor->target) = gconf_value_get_bool (value); @@ -812,7 +812,7 @@ handle_preference_update_int (const gchar *key, GConfValue *value) if (cursor->target==NULL) /* No work for us to do. */ return TRUE; - + if (value==NULL) { /* Value was destroyed. */ @@ -852,7 +852,7 @@ handle_preference_update_int (const gchar *key, GConfValue *value) } return TRUE; - + } @@ -892,7 +892,7 @@ meta_prefs_remove_listener (MetaPrefsChangedFunc func, return; } - + tmp = tmp->next; } @@ -907,9 +907,9 @@ emit_changed (MetaPreference pref) meta_topic (META_DEBUG_PREFS, "Notifying listeners that pref %s changed\n", meta_preference_to_string (pref)); - + copy = g_list_copy (listeners); - + tmp = copy; while (tmp != NULL) @@ -931,24 +931,24 @@ changed_idle_handler (gpointer data) GList *copy; changed_idle = 0; - + copy = g_list_copy (changes); /* reentrancy paranoia */ g_list_free (changes); changes = NULL; - + tmp = copy; while (tmp != NULL) { MetaPreference pref = GPOINTER_TO_INT (tmp->data); emit_changed (pref); - + tmp = tmp->next; } g_list_free (copy); - + return FALSE; } @@ -956,7 +956,7 @@ static void queue_changed (MetaPreference pref) { meta_topic (META_DEBUG_PREFS, "Queueing change of pref %s\n", - meta_preference_to_string (pref)); + meta_preference_to_string (pref)); if (g_list_find (changes, GINT_TO_POINTER (pref)) == NULL) changes = g_list_prepend (changes, GINT_TO_POINTER (pref)); @@ -1009,10 +1009,10 @@ meta_prefs_init (void) #ifdef HAVE_GCONF GError *err = NULL; gchar **gconf_dir_cursor; - + if (default_client != NULL) return; - + /* returns a reference which we hold forever */ default_client = gconf_client_get_default (); @@ -1064,10 +1064,10 @@ meta_prefs_init (void) */ titlebar_font = pango_font_description_from_string ("Sans Bold 10"); current_theme = g_strdup ("Atlanta"); - + init_button_layout(); #endif /* HAVE_GCONF */ - + init_bindings (); init_commands (); init_workspace_names (); @@ -1097,7 +1097,7 @@ change_notify (GConfClient *client, const char *key; GConfValue *value; gint i=0; - + key = gconf_entry_get_key (entry); value = gconf_entry_get_value (entry); @@ -1247,7 +1247,7 @@ change_notify (GConfClient *client, meta_topic (META_DEBUG_PREFS, "Key %s doesn't mean anything to Metacity\n", key); } - + out: /* nothing */ return; /* AIX compiler wants something after a label like out: */ @@ -1259,7 +1259,7 @@ cleanup_error (GError **error) if (*error) { meta_warning ("%s\n", (*error)->message); - + g_error_free (*error); *error = NULL; } @@ -1297,7 +1297,7 @@ static void maybe_give_disable_workarounds_warning (void) { static gboolean first_disable = TRUE; - + if (first_disable && disable_workarounds) { first_disable = FALSE; @@ -1431,7 +1431,7 @@ mouse_button_mods_handler (MetaPreference pref, { meta_topic (META_DEBUG_KEYBINDINGS, "Failed to parse new gconf value\n"); - + meta_warning (_("\"%s\" found in configuration database is " "not a valid value for mouse button modifier\n"), string_value); @@ -1443,7 +1443,7 @@ mouse_button_mods_handler (MetaPreference pref, static gboolean button_layout_equal (const MetaButtonLayout *a, const MetaButtonLayout *b) -{ +{ int i; i = 0; @@ -1482,7 +1482,7 @@ button_function_from_string (const char *str) return META_BUTTON_FUNCTION_ABOVE; else if (strcmp (str, "stick") == 0) return META_BUTTON_FUNCTION_STICK; - else + else /* don't know; give up */ return META_BUTTON_FUNCTION_LAST; } @@ -1520,11 +1520,11 @@ button_layout_handler (MetaPreference pref, MetaButtonLayout new_layout; char **sides; int i; - + /* We need to ignore unknown button functions, for * compat with future versions */ - + sides = g_strsplit (string_value, ":", 2); if (sides[0] != NULL) @@ -1540,7 +1540,7 @@ button_layout_handler (MetaPreference pref, new_layout.left_buttons_has_spacer[i] = FALSE; ++i; } - + buttons = g_strsplit (sides[0], ",", -1); i = 0; b = 0; @@ -1577,13 +1577,13 @@ button_layout_handler (MetaPreference pref, buttons[b]); } } - + ++b; } new_layout.left_buttons[i] = META_BUTTON_FUNCTION_LAST; new_layout.left_buttons_has_spacer[i] = FALSE; - + g_strfreev (buttons); } @@ -1600,7 +1600,7 @@ button_layout_handler (MetaPreference pref, new_layout.right_buttons_has_spacer[i] = FALSE; ++i; } - + buttons = g_strsplit (sides[1], ",", -1); i = 0; b = 0; @@ -1636,24 +1636,24 @@ button_layout_handler (MetaPreference pref, buttons[b]); } } - + ++b; } new_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST; new_layout.right_buttons_has_spacer[i] = FALSE; - + g_strfreev (buttons); } g_strfreev (sides); - + /* Invert the button layout for RTL languages */ if (meta_ui_get_direction() == META_UI_DIRECTION_RTL) { MetaButtonLayout rtl_layout; int j; - + for (i = 0; new_layout.left_buttons[i] != META_BUTTON_FUNCTION_LAST; i++); for (j = 0; j < i; j++) { @@ -1665,7 +1665,7 @@ button_layout_handler (MetaPreference pref, } rtl_layout.right_buttons[j] = META_BUTTON_FUNCTION_LAST; rtl_layout.right_buttons_has_spacer[j] = FALSE; - + for (i = 0; new_layout.right_buttons[i] != META_BUTTON_FUNCTION_LAST; i++); for (j = 0; j < i; j++) { @@ -1680,7 +1680,7 @@ button_layout_handler (MetaPreference pref, new_layout = rtl_layout; } - + if (button_layout_equal (&button_layout, &new_layout)) { /* Same as before, so duck out */ @@ -1713,7 +1713,7 @@ gboolean meta_prefs_get_application_based (void) { return FALSE; /* For now, we never want this to do anything */ - + return application_based; } @@ -1725,7 +1725,7 @@ meta_prefs_get_disable_workarounds (void) #ifdef HAVE_GCONF #define MAX_REASONABLE_AUTO_RAISE_DELAY 10000 - + #endif /* HAVE_GCONF */ #ifdef WITH_VERBOSE_MODE @@ -1746,7 +1746,7 @@ meta_preference_to_string (MetaPreference pref) case META_PREF_RAISE_ON_CLICK: return "RAISE_ON_CLICK"; - + case META_PREF_THEME: return "THEME"; @@ -1779,7 +1779,7 @@ meta_preference_to_string (MetaPreference pref) case META_PREF_AUTO_RAISE: return "AUTO_RAISE"; - + case META_PREF_AUTO_RAISE_DELAY: return "AUTO_RAISE_DELAY"; @@ -1838,7 +1838,7 @@ meta_prefs_set_num_workspaces (int n_workspaces) { #ifdef HAVE_GCONF GError *err; - + if (default_client == NULL) return; @@ -1846,7 +1846,7 @@ meta_prefs_set_num_workspaces (int n_workspaces) n_workspaces = 1; if (n_workspaces > MAX_REASONABLE_WORKSPACES) n_workspaces = MAX_REASONABLE_WORKSPACES; - + err = NULL; gconf_client_set_int (default_client, KEY_NUM_WORKSPACES, @@ -1863,80 +1863,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 @@ -1950,24 +1886,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, "Left" }, - { META_KEYBINDING_WORKSPACE_RIGHT, "Right" }, - { META_KEYBINDING_WORKSPACE_UP, "Up" }, - { META_KEYBINDING_WORKSPACE_DOWN, "Down" }, - { META_KEYBINDING_SWITCH_WINDOWS, "Tab" }, - { META_KEYBINDING_SWITCH_PANELS, "Tab" }, - { META_KEYBINDING_CYCLE_GROUP, "F6" }, - { META_KEYBINDING_CYCLE_WINDOWS, "Escape" }, - { META_KEYBINDING_CYCLE_PANELS, "Escape" }, - { META_KEYBINDING_SHOW_DESKTOP, "d" }, - { META_KEYBINDING_PANEL_MAIN_MENU, "F1" }, - { META_KEYBINDING_PANEL_RUN_DIALOG, "F2" }, - { META_KEYBINDING_COMMAND_SCREENSHOT, "Print" }, - { META_KEYBINDING_COMMAND_WIN_SCREENSHOT, "Print" }, +#define item(name, suffix, param, is_reverse, short, long, keystroke) \ + { #name suffix, keystroke }, +#include "screen-bindings.h" +#undef item { NULL, NULL } }; @@ -1989,7 +1919,7 @@ init_bindings (void) #ifdef HAVE_GCONF int i; GError *err; - + i = 0; while (window_bindings[i].name) { @@ -2006,7 +1936,7 @@ init_bindings (void) update_binding (&window_bindings[i], str_val); - g_free (str_val); + g_free (str_val); g_free (key); key = g_strconcat (KEY_WINDOW_BINDINGS_PREFIX, "/", @@ -2048,7 +1978,7 @@ init_bindings (void) update_binding (&screen_bindings[i], str_val); - g_free (str_val); + g_free (str_val); g_free (key); key = g_strconcat (KEY_SCREEN_BINDINGS_PREFIX, "/", @@ -2078,10 +2008,13 @@ 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. */ - while (strcmp(window_bindings[which].name, + while (strcmp(window_bindings[which].name, window_string_bindings[i].name) != 0) which++; @@ -2096,15 +2029,18 @@ 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. */ - while (strcmp(screen_bindings[which].name, + while (strcmp(screen_bindings[which].name, screen_string_bindings[i].name) != 0) which++; /* Set the binding */ - update_binding (&screen_bindings[which], + update_binding (&screen_bindings[which], screen_string_bindings[i].keybinding); ++i; @@ -2118,7 +2054,7 @@ init_commands (void) #ifdef HAVE_GCONF int i; GError *err; - + i = 0; while (i < MAX_COMMANDS) { @@ -2133,7 +2069,7 @@ init_commands (void) update_command (key, str_val); - g_free (str_val); + g_free (str_val); g_free (key); ++i; @@ -2151,7 +2087,7 @@ init_workspace_names (void) #ifdef HAVE_GCONF int i; GError *err; - + i = 0; while (i < MAX_REASONABLE_WORKSPACES) { @@ -2167,8 +2103,8 @@ init_workspace_names (void) update_workspace_name (key, str_val); g_assert (workspace_names[i] != NULL); - - g_free (str_val); + + g_free (str_val); g_free (key); ++i; @@ -2192,11 +2128,11 @@ update_binding (MetaKeyPref *binding, MetaVirtualModifier mods; MetaKeyCombo *combo; gboolean changed; - + meta_topic (META_DEBUG_KEYBINDINGS, "Binding \"%s\" has new gconf value \"%s\"\n", binding->name, value ? value : "none"); - + keysym = 0; keycode = 0; mods = 0; @@ -2220,7 +2156,7 @@ update_binding (MetaKeyPref *binding, binding->bindings = g_slist_alloc(); binding->bindings->data = blank; } - + combo = binding->bindings->data; #ifdef HAVE_GCONF @@ -2235,7 +2171,7 @@ update_binding (MetaKeyPref *binding, gchar *old_setting; gchar *key; GError *err = NULL; - + meta_warning ("Cannot bind \"%s\" to %s: it needs a modifier " "such as Ctrl or Alt.\n", binding->name, @@ -2262,7 +2198,7 @@ update_binding (MetaKeyPref *binding, key = g_strconcat (KEY_SCREEN_BINDINGS_PREFIX, "/", binding->name, NULL); - + gconf_client_set_string (gconf_client_get_default (), key, old_setting, &err); @@ -2273,7 +2209,7 @@ update_binding (MetaKeyPref *binding, g_error_free (err); err = NULL; } - + g_free (old_setting); g_free (key); @@ -2284,18 +2220,18 @@ update_binding (MetaKeyPref *binding, return TRUE; } #endif - + changed = FALSE; if (keysym != combo->keysym || keycode != combo->keycode || mods != combo->modifiers) { changed = TRUE; - + combo->keysym = keysym; combo->keycode = keycode; combo->modifiers = mods; - + meta_topic (META_DEBUG_KEYBINDINGS, "New keybinding for \"%s\" is keysym = 0x%x keycode = 0x%x mods = 0x%x\n", binding->name, combo->keysym, combo->keycode, @@ -2306,7 +2242,7 @@ update_binding (MetaKeyPref *binding, meta_topic (META_DEBUG_KEYBINDINGS, "Keybinding for \"%s\" is unchanged\n", binding->name); } - + return changed; } @@ -2327,7 +2263,7 @@ update_list_binding (MetaKeyPref *binding, meta_topic (META_DEBUG_KEYBINDINGS, "Binding \"%s\" has new gconf value\n", binding->name); - + if (binding->bindings == NULL) { /* We need to insert a dummy element into the list, because the first @@ -2338,7 +2274,7 @@ update_list_binding (MetaKeyPref *binding, binding->bindings = g_slist_alloc(); binding->bindings->data = blank; } - + /* Okay, so, we're about to provide a new list of key combos for this * action. Delete any pre-existing list. */ @@ -2350,7 +2286,7 @@ update_list_binding (MetaKeyPref *binding, } g_slist_free (binding->bindings->next); binding->bindings->next = NULL; - + while (pref_iterator) { keysym = 0; @@ -2374,7 +2310,7 @@ update_list_binding (MetaKeyPref *binding, default: g_assert_not_reached (); } - + if (!meta_ui_parse_accelerator (pref_string, &keysym, &keycode, &mods)) { meta_topic (META_DEBUG_KEYBINDINGS, @@ -2405,7 +2341,7 @@ update_list_binding (MetaKeyPref *binding, pref_iterator = pref_iterator->next; continue; } - + changed = TRUE; combo = g_malloc0 (sizeof (MetaKeyCombo)); @@ -2419,7 +2355,7 @@ update_list_binding (MetaKeyPref *binding, binding->name, keysym, keycode, mods); pref_iterator = pref_iterator->next; - } + } return changed; } @@ -2427,7 +2363,7 @@ static const gchar* relative_key (const gchar* key) { const gchar* end; - + end = strrchr (key, '/'); ++end; @@ -2439,13 +2375,13 @@ relative_key (const gchar* key) * notify */ static gboolean -find_and_update_binding (MetaKeyPref *bindings, +find_and_update_binding (MetaKeyPref *bindings, const char *name, const char *value) { const char *key; int i; - + if (*name == '/') key = relative_key (name); else @@ -2525,7 +2461,7 @@ update_command (const char *name, { char *p; int i; - + p = strrchr (name, '_'); if (p == NULL) { @@ -2533,7 +2469,7 @@ update_command (const char *name, "Command %s has no underscore?\n", name); return FALSE; } - + ++p; if (g_ascii_isdigit (*p)) @@ -2561,7 +2497,7 @@ update_command (const char *name, return FALSE; } } - + if (i >= MAX_COMMANDS) { meta_topic (META_DEBUG_KEYBINDINGS, @@ -2576,14 +2512,14 @@ update_command (const char *name, "Command %d is unchanged\n", i); return FALSE; } - + g_free (commands[i]); commands[i] = g_strdup (value); meta_topic (META_DEBUG_KEYBINDINGS, "Updated command %d to \"%s\"\n", i, commands[i] ? commands[i] : "none"); - + return TRUE; } @@ -2593,7 +2529,7 @@ const char* meta_prefs_get_command (int i) { g_return_val_if_fail (i >= 0 && i < MAX_COMMANDS, NULL); - + return commands[i]; } @@ -2614,7 +2550,7 @@ meta_prefs_get_gconf_key_for_command (int i) key = g_strdup_printf (KEY_COMMAND_PREFIX"%d", i + 1); break; } - + return key; } @@ -2637,7 +2573,7 @@ update_workspace_name (const char *name, { char *p; int i; - + p = strrchr (name, '_'); if (p == NULL) { @@ -2645,7 +2581,7 @@ update_workspace_name (const char *name, "Workspace name %s has no underscore?\n", name); return FALSE; } - + ++p; if (!g_ascii_isdigit (*p)) @@ -2654,10 +2590,10 @@ update_workspace_name (const char *name, "Workspace name %s doesn't end in number?\n", name); return FALSE; } - + i = atoi (p); i -= 1; /* count from 0 not 1 */ - + if (i >= MAX_REASONABLE_WORKSPACES) { meta_topic (META_DEBUG_PREFS, @@ -2670,7 +2606,7 @@ update_workspace_name (const char *name, meta_topic (META_DEBUG_PREFS, "Workspace name %d is unchanged\n", i); return FALSE; - } + } /* This is a bad hack. We have to treat empty string as * "unset" because the root window property can't contain @@ -2700,11 +2636,11 @@ update_workspace_name (const char *name, workspace_names[i] = d; } } - + meta_topic (META_DEBUG_PREFS, "Updated workspace name %d to \"%s\"\n", i, workspace_names[i] ? workspace_names[i] : "none"); - + return TRUE; } #endif /* HAVE_GCONF */ @@ -2719,7 +2655,7 @@ meta_prefs_get_workspace_name (int i) meta_topic (META_DEBUG_PREFS, "Getting workspace name for %d: \"%s\"\n", i, workspace_names[i]); - + return workspace_names[i]; } @@ -2730,7 +2666,7 @@ meta_prefs_change_workspace_name (int i, #ifdef HAVE_GCONF char *key; GError *err; - + g_return_if_fail (i >= 0 && i < MAX_REASONABLE_WORKSPACES); meta_topic (META_DEBUG_PREFS, @@ -2745,7 +2681,7 @@ meta_prefs_change_workspace_name (int i, */ if (name && *name == '\0') name = NULL; - + if ((name == NULL && workspace_names[i] == NULL) || (name && workspace_names[i] && strcmp (name, workspace_names[i]) == 0)) { @@ -2754,7 +2690,7 @@ meta_prefs_change_workspace_name (int i, i, name ? name : "none"); return; } - + key = gconf_key_for_workspace_name (i); err = NULL; @@ -2766,7 +2702,7 @@ meta_prefs_change_workspace_name (int i, gconf_client_unset (default_client, key, &err); - + if (err) { meta_warning (_("Error setting name for workspace %d to \"%s\": %s\n"), @@ -2774,7 +2710,7 @@ meta_prefs_change_workspace_name (int i, err->message); g_error_free (err); } - + g_free (key); #else g_free (workspace_names[i]); @@ -2787,9 +2723,9 @@ static char* gconf_key_for_workspace_name (int i) { char *key; - + key = g_strdup_printf (KEY_WORKSPACE_NAME_PREFIX"%d", i + 1); - + return key; } #endif /* HAVE_GCONF */ @@ -2822,7 +2758,7 @@ void meta_prefs_get_screen_bindings (const MetaKeyPref **bindings, int *n_bindings) { - + *bindings = screen_bindings; *n_bindings = (int) G_N_ELEMENTS (screen_bindings) - 1; } @@ -2893,7 +2829,7 @@ meta_prefs_get_keybinding_action (const char *name) { if (strcmp (screen_bindings[i].name, name) == 0) return (MetaKeyBindingAction) i; - + --i; } @@ -2936,7 +2872,7 @@ meta_prefs_get_window_binding (const char *name, *keysym = *modifiers = 0; return; } - + --i; } @@ -3031,7 +2967,7 @@ static void init_button_layout(void) { MetaButtonLayout button_layout_ltr = { - { + { /* buttons in the group on the left side */ META_BUTTON_FUNCTION_MENU, META_BUTTON_FUNCTION_LAST @@ -3045,7 +2981,7 @@ init_button_layout(void) } }; MetaButtonLayout button_layout_rtl = { - { + { /* buttons in the group on the left side */ META_BUTTON_FUNCTION_CLOSE, META_BUTTON_FUNCTION_MAXIMIZE, diff --git a/src/core/schema-bindings.c b/src/core/schema-bindings.c index 49b8c4bbb..91d002638 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 @@ -31,7 +33,7 @@ #define _(x) x -char *liberal; +char *liberal, *could_go_backwards, *could_go_forwards; const char* window_string = \ " \n" \ @@ -49,38 +51,108 @@ const char* window_string = \ " \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. > => >, 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 (" \n"); + printf (" /schemas/apps/metacity/%s_keybindings/%s\n", + keybinding_type, name); + printf (" /apps/metacity/%s_keybindings/%s\n", + keybinding_type, name); + printf (" metacity\n"); + printf (" string\n"); + printf (" %s\n", escaped_default_value); + printf (" \n"); + printf (" %s\n", short_description); + printf (" \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 (" \n"); + printf (" \n"); + printf (" \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 \"\" and " \ "\"\". 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 000000000..054d5caca --- /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: .) + * + * 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_() 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."), + "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."), + "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."), + "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."), + "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."), "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."), "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."), "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."), "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."), "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."), + "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."), + "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."), + "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."), + "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 8616cd9be..ab3d8e2fd 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/core/window.c b/src/core/window.c index bbb883799..f16d1019e 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -659,8 +659,11 @@ meta_window_new_with_attrs (MetaDisplay *display, meta_window_ensure_frame (window); meta_window_grab_keys (window); - meta_display_grab_window_buttons (window->display, window->xwindow); - meta_display_grab_focus_window_button (window->display, window); + if (window->type != META_WINDOW_DOCK) + { + meta_display_grab_window_buttons (window->display, window->xwindow); + meta_display_grab_focus_window_button (window->display, window); + } if (window->type == META_WINDOW_DESKTOP || window->type == META_WINDOW_DOCK) diff --git a/src/include/prefs.h b/src/include/prefs.h index ee412c661..4740771a1 100644 --- a/src/include/prefs.h +++ b/src/include/prefs.h @@ -2,10 +2,10 @@ /* Metacity preferences */ -/* +/* * Copyright (C) 2001 Havoc Pennington * Copyright (C) 2006 Elijah Newren - * + * * 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 @@ -15,7 +15,7 @@ * 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 @@ -139,75 +139,11 @@ GSList * meta_prefs_get_clutter_plugins (void); void meta_prefs_set_clutter_plugins (GSList *list); #endif -/* 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, diff --git a/tools/ppa-magic.py b/tools/ppa-magic.py new file mode 100644 index 000000000..5a7e32667 --- /dev/null +++ b/tools/ppa-magic.py @@ -0,0 +1,156 @@ +#!/usr/bin/python +# +# This is a heavily experimental script to upload nightly snapshots +# to Canonical's Launchpad PPA system. +# +# 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. + +import time +import os + +app = 'metacity' +try_number = 1 # if you mess it up within a day +upstream_version = '2.25.0' # should take this from configure.in, really +version = '1:%s~%s-0ubuntu~ppa%d' % (upstream_version, + time.strftime('%Y%m%d'), + try_number) + +pkg_name = app # according to motu people +svn_url = 'http://svn.gnome.org/svn/'+app+'/trunk' +maintainer = 'Thomas Thurman ' +key = 'D5743F03' +basedir = os.getcwd()+'/'+pkg_name # or, if you prefer, '/tmp/'+pkg_name + +def write_to_files(path): + + file(path+'/changelog', 'w').write(\ +pkg_name+""" ("""+version+""") hardy; urgency=low + + * Nightly release from trunk. + + -- """+maintainer+' '+time.strftime("%a, %d %b %Y %H:%M:%S %z")+""" +""") + + file(path+'/rules', 'w').write(\ +"""#!/usr/bin/make -f +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/gnome.mk +""") + + os.chmod(path+'/rules', 0777) + + # Compat should be 6 to keep debhelper happy. + file(path+'/compat', 'w').write(\ +"""6 +""") + + file(path+'/control', 'w').write(\ +"""Source: """+pkg_name+""" +Section: devel +Priority: optional +Maintainer: """+maintainer+""" +Standards-Version: 3.8.0 +Build-Depends: cdbs (>= 0.4.41), + debhelper (>= 5), + gettext, + libgtk2.0-dev (>= 2.10.0-1~), + liborbit2-dev (>= 1:2.10.2-1.1~), + libpopt-dev, + libxml2-dev (>= 2.4.23), + libgconf2-dev (>= 2.6.1-2), + libglade2-dev (>= 2.4.0-1~), + libice-dev, + libsm-dev, + libx11-dev, + libxt-dev, + libxext-dev, + libxrandr-dev, + x11proto-core-dev, + libxinerama-dev, + libstartup-notification0-dev (>= 0.7), + libxml-parser-perl, + gnome-pkg-tools (>= 0.10), + dpkg-dev (>= 1.13.19), + libxcomposite-dev +Homepage: http://blogs.gnome.org/metacity/ + +Package: """+pkg_name+""" +Architecture: any +Depends: ${shlibs:Depends} +Description: Lightweight GTK2 compositing window manager (nightly trunk) + Metacity is a small window manager, using gtk2 to do everything. + . + As the author says, metacity is a "Boring window manager for the adult in + you. Many window managers are like Marshmallow Froot Loops; Metacity is + like Cheerios." + . + This is the nightly trunk upload. It may not be the epitome of stability. +""") + + file(path+'/copyright', 'w').write(\ +"""This package was automatically debianised by a script. + +It was downloaded from """+svn_url+""" + + Upstream Author and Copyright Holder: Havoc Pennington - hp@redhat.com +and others. + +License: + + This package 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 package 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 package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. +""") + +####################### + +if basedir!='.' and basedir!='..' and os.access(basedir, os.F_OK): + os.system('rm -rf '+basedir) + print 'Warning: deleted old version of '+basedir+'.' + +os.system('svn export -q '+svn_url+' '+basedir) +os.mkdir(basedir+'/debian') + +write_to_files(basedir+'/debian') + +os.chdir(basedir) + +# Make sure we get up to having a "configure", or it won't build. +os.system('NOCONFIGURE=1 ./autogen.sh') + +os.chdir(basedir+'/debian') + +os.system('debuild -rfakeroot -S -k'+key) + +os.system('dput -f '+pkg_name+' '+basedir+'_'+version[2:]+'_source.changes') + +# And then we should clean up. +