Make the bindings in src/core/*-bindings.h generate GConf schemas too.

2008-10-12  Thomas Thurman  <tthurman@gnome.org>

        Make the bindings in src/core/*-bindings.h generate
        GConf schemas too.  Note that there's an i18n issue
        (documented in schema-bindings.c) which will be fixed
        next checkin.

        * src/core/schema-bindings.c: major fixup to make it
          ready for use as part of the actual build process.
        * src/Makefile.am: added magic to make it call schema-bindings
          after it builds it.
        * src/core/window-bindings.h: added comments;
          also, window menu was listed variously as alt-Space
          and alt-Print; it should have been alt-Space.
        * src/metacity.schemas.in.in: renamed from s/\.in$//,
          sentinel added for the generated bindings,
          warning at the top now untrue, and removed.


svn path=/trunk/; revision=3952
This commit is contained in:
Thomas Thurman 2008-10-12 23:29:09 +00:00 committed by Thomas James Alexander Thurman
parent ff0fa107a4
commit 48f1dd5a7e
6 changed files with 602 additions and 2343 deletions

View File

@ -1,3 +1,21 @@
2008-10-12 Thomas Thurman <tthurman@gnome.org>
Make the bindings in src/core/*-bindings.h generate
GConf schemas too. Note that there's an i18n issue
(documented in schema-bindings.c) which will be fixed
next checkin.
* src/core/schema-bindings.c: major fixup to make it
ready for use as part of the actual build process.
* src/Makefile.am: added magic to make it call schema-bindings
after it builds it.
* src/core/window-bindings.h: added comments;
also, window menu was listed variously as alt-Space
and alt-Print; it should have been alt-Space.
* src/metacity.schemas.in.in: renamed from s/\.in$//,
sentinel added for the generated bindings,
warning at the top now untrue, and removed.
2008-10-12 Thomas Thurman <tthurman@gnome.org>
Fix annoying bug where alt-tab and friends would jump

View File

@ -136,6 +136,17 @@ metacity_theme_viewer_SOURCES= \
metacity_dialog_SOURCES= \
ui/metacity-dialog.c
if GCONF_SCHEMAS_INSTALL
schema_bindings_SOURCES = \
core/schema-bindings.c
schema_bindings_LDADD = @METACITY_LIBS@
metacity.schemas.in: schema_bindings
@echo Generating keybinding schemas...
./schema_bindings > metacity.schemas.in
endif
bin_PROGRAMS=metacity metacity-theme-viewer
libexec_PROGRAMS=metacity-dialog
@ -148,7 +159,7 @@ testboxes_SOURCES=include/util.h core/util.c include/boxes.h core/boxes.c core/t
testgradient_SOURCES=ui/gradient.h ui/gradient.c ui/testgradient.c
testasyncgetprop_SOURCES=core/async-getprop.h core/async-getprop.c core/testasyncgetprop.c
noinst_PROGRAMS=testboxes testgradient testasyncgetprop
noinst_PROGRAMS=testboxes testgradient testasyncgetprop schema_bindings
testboxes_LDADD= @METACITY_LIBS@
testgradient_LDADD= @METACITY_LIBS@

View File

@ -26,13 +26,23 @@
* the GConf .schemas file.
*
* FIXME: also need to make 50-metacity-desktop-key.xml
*
* FIXME: this actually breaks i18n because the schemas.in->schemas process
* doesn't recognise the concatenated strings, and so we will have to do
* them ourselves; this will need to be fixed before the next release.
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <glib.h>
#define _(x) x
static void single_stanza (gboolean is_window, char *name, char *default_value,
gboolean can_reverse, gboolean going_backwards,
char *short_description, char *long_description);
char *liberal, *could_go_backwards, *could_go_forwards;
const char* window_string = \
@ -50,7 +60,7 @@ const char* window_string = \
" </locale>\n" \
" </schema>\n\n\n";
void
static void
single_stanza (gboolean is_window, char *name, char *default_value,
gboolean can_reverse, gboolean going_backwards,
char *short_description, char *long_description)
@ -94,11 +104,13 @@ single_stanza (gboolean is_window, char *name, char *default_value,
}
if (going_backwards)
printf (could_go_forwards);
printf ("%s\n", could_go_forwards);
else
printf (could_go_backwards);
printf ("%s\n", could_go_backwards);
}
printf (" %s\n", liberal);
printf (" </long>\n");
printf (" </locale>\n");
printf (" </schema>\n\n\n");
@ -108,9 +120,36 @@ single_stanza (gboolean is_window, char *name, char *default_value,
g_free (long_description);
}
void
static void produce_bindings ();
static void
produce_bindings ()
{
FILE *metacity_schemas_in_in = fopen("metacity.schemas.in.in", "r");
if (!metacity_schemas_in_in)
{
g_error ("Cannot compile without metacity.schemas.in.in: %s\n",
strerror (errno));
}
while (!feof (metacity_schemas_in_in))
{
/* 10240 is ridiculous overkill; we're writing the input file and
* the lines are always 80 chars or less.
*/
char buffer[10240];
fgets (buffer, sizeof (buffer), metacity_schemas_in_in);
if (strstr (buffer, "<!-- GENERATED -->"))
break;
printf ("%s", buffer);
}
if (!feof (metacity_schemas_in_in))
{
#define item(name, suffix, param, short, long, keystroke) \
single_stanza (TRUE, #name suffix, \
keystroke, \
@ -127,15 +166,30 @@ produce_bindings ()
short, long);
#include "screen-bindings.h"
#undef item
}
while (!feof (metacity_schemas_in_in))
{
char buffer[10240];
fgets (buffer, sizeof (buffer), metacity_schemas_in_in);
printf ("%s", buffer);
}
fclose (metacity_schemas_in_in);
}
int
main ()
{
/* XXX: TODO: find out what/how gdk i18ns the keycaps as, and add a
* translator comment
/* Translators: Please don't translate "Control", "Shift", etc, since these
* are hardcoded (in gtk/gtkaccelgroup.c; it's not metacity's fault).
* "disabled" must also stay as it is.
*/
liberal = g_markup_escape_text(_("The parser is fairly liberal and allows "\
liberal = g_markup_escape_text(_("The format looks like \"<Control>a\" or "
"<Shift><Alt>F1\". \n"\
"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);
@ -154,6 +208,8 @@ main ()
g_free (could_go_forwards);
g_free (could_go_backwards);
g_free (liberal);
return 0;
}
/* eof schema-bindings.c */

View File

@ -59,6 +59,11 @@
* Some code out there wants only the entries which have a default
* binding (i.e. whose sixth parameter is not NULL). You can get only these
* by defining ONLY_BOUND_BY_DEFAULT before you include this file.
*
* Possible future work:
* - merge with screen-bindings.h somehow
* - ONLY_BOUND_BY_DEFAULT is crack, get rid of it
* - "suffix" is confusing; write it out in full
*/
#ifndef item
@ -68,7 +73,7 @@
item (activate_window_menu, "", 0,
_("Activate window menu"),
_("The keybinding used to activate the window menu."),
"<Alt>Print")
"<Alt>Space")
#ifndef ONLY_BOUND_BY_DEFAULT

File diff suppressed because it is too large Load Diff

503
src/metacity.schemas.in.in Normal file
View File

@ -0,0 +1,503 @@
<gconfschemafile>
<schemalist>
<!-- General preferences -->
<schema>
<key>/schemas/apps/metacity/general/mouse_button_modifier</key>
<applyto>/apps/metacity/general/mouse_button_modifier</applyto>
<owner>metacity</owner>
<type>string</type>
<default>&lt;Alt&gt;</default>
<locale name="C">
<short>Modifier to use for modified window click actions</short>
<long>
Clicking a window while holding down this modifier key
will move the window (left click), resize the window
(middle click), or show the window menu (right click).
Modifier is expressed as "&lt;Alt&gt;" or "&lt;Super&gt;"
for example.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/button_layout</key>
<applyto>/apps/metacity/general/button_layout</applyto>
<owner>metacity</owner>
<type>string</type>
<default>menu:minimize,maximize,close</default>
<locale name="C">
<short>Arrangement of buttons on the titlebar</short>
<long>
Arrangement of buttons on the titlebar. The
value should be a string, such as
"menu:minimize,maximize,spacer,close"; the colon separates the
left corner of the window from the right corner, and
the button names are comma-separated. Duplicate buttons
are not allowed. Unknown button names are silently ignored
so that buttons can be added in future metacity versions
without breaking older versions.
A special spacer tag can be used to insert some space between
two adjacent buttons.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/focus_mode</key>
<applyto>/apps/metacity/general/focus_mode</applyto>
<owner>metacity</owner>
<type>string</type>
<default>click</default>
<locale name="C">
<short>Window focus mode</short>
<long>
The window focus mode indicates how windows are activated.
It has three possible values; "click" means windows must
be clicked in order to focus them, "sloppy" means windows
are focused when the mouse enters the window, and "mouse" means
windows are focused when the mouse enters the window and
unfocused when the mouse leaves the window.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/focus_new_windows</key>
<applyto>/apps/metacity/general/focus_new_windows</applyto>
<owner>metacity</owner>
<type>string</type>
<default>smart</default>
<locale name="C">
<short>Control how new windows get focus</short>
<long>
This option provides additional control over how newly created
windows get focus. It has two possible values; "smart" applies
the user's normal focus mode, and "strict" results in windows
started from a terminal not being given focus.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/raise_on_click</key>
<applyto>/apps/metacity/general/raise_on_click</applyto>
<owner>metacity</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short>Whether raising should be a side-effect of other user
interactions</short>
<long>
Many actions (e.g. clicking in the client area, moving or resizing the window)
normally raise the window as a side-effect. Setting this option to false, which
is strongly discouraged, will decouple raising from other user actions, and
ignore raise requests generated by applications. See
http://bugzilla.gnome.org/show_bug.cgi?id=445447#c6.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/action_double_click_titlebar</key>
<applyto>/apps/metacity/general/action_double_click_titlebar</applyto>
<owner>metacity</owner>
<type>string</type>
<default>toggle_maximize</default>
<locale name="C">
<short>Action on title bar double-click</short>
<long>
This option determines the effects of double-clicking on the
title bar. Current valid options are
'toggle_shade', which will shade/unshade the window,
'toggle_maximize' which will maximize/unmaximize the window,
'toggle_maximize_horizontally' and 'toggle_maximize_vertically'
which will maximize/unmaximize the window in that direction only,
'minimize' which will minimize the window,
'shade' which will roll the window up,
'menu' which will display the window menu,
'lower' which will put the window behind all the others,
and 'none' which will not do anything.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/action_middle_click_titlebar</key>
<applyto>/apps/metacity/general/action_middle_click_titlebar</applyto>
<owner>metacity</owner>
<type>string</type>
<default>lower</default>
<locale name="C">
<short>Action on title bar middle-click</short>
<long>
This option determines the effects of middle-clicking on the
title bar. Current valid options are
'toggle_shade', which will shade/unshade the window,
'toggle_maximize' which will maximize/unmaximize the window,
'toggle_maximize_horizontally' and 'toggle_maximize_vertically'
which will maximize/unmaximize the window in that direction only,
'minimize' which will minimize the window,
'shade' which will roll the window up,
'menu' which will display the window menu,
'lower' which will put the window behind all the others,
and 'none' which will not do anything.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/action_right_click_titlebar</key>
<applyto>/apps/metacity/general/action_right_click_titlebar</applyto>
<owner>metacity</owner>
<type>string</type>
<default>menu</default>
<locale name="C">
<short>Action on title bar right-click</short>
<long>
This option determines the effects of right-clicking on the
title bar. Current valid options are
'toggle_shade', which will shade/unshade the window,
'toggle_maximize' which will maximize/unmaximize the window,
'toggle_maximize_horizontally' and 'toggle_maximize_vertically'
which will maximize/unmaximize the window in that direction only,
'minimize' which will minimize the window,
'shade' which will roll the window up,
'menu' which will display the window menu,
'lower' which will put the window behind all the others,
and 'none' which will not do anything.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/auto_raise</key>
<applyto>/apps/metacity/general/auto_raise</applyto>
<owner>metacity</owner>
<type>bool</type>
<default>false</default>
<locale name="C">
<short>Automatically raises the focused window</short>
<long>
If set to true, and the focus mode is either "sloppy" or "mouse"
then the focused window will be automatically raised after a
delay specified by the auto_raise_delay key. This is not related
to clicking on a window to raise it, nor to entering a window
during drag-and-drop.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/auto_raise_delay</key>
<applyto>/apps/metacity/general/auto_raise_delay</applyto>
<owner>metacity</owner>
<type>int</type>
<default>500</default>
<locale name="C">
<short>Delay in milliseconds for the auto raise option</short>
<long>
The time delay before raising a window if auto_raise is set to
true. The delay is given in thousandths of a second.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/theme</key>
<applyto>/apps/metacity/general/theme</applyto>
<owner>metacity</owner>
<type>string</type>
<default>Clearlooks</default>
<locale name="C">
<short>Current theme</short>
<long>
The theme determines the appearance of window borders,
titlebar, and so forth.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/titlebar_uses_system_font</key>
<applyto>/apps/metacity/general/titlebar_uses_system_font</applyto>
<owner>metacity</owner>
<type>bool</type>
<default>false</default>
<locale name="C">
<short>Use standard system font in window titles</short>
<long>
If true, ignore the titlebar_font
option, and use the standard application font for window
titles.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/titlebar_font</key>
<applyto>/apps/metacity/general/titlebar_font</applyto>
<owner>metacity</owner>
<type>string</type>
<default>Sans Bold 10</default>
<locale name="C">
<short>Window title font</short>
<long>
A font description string describing a font for window
titlebars. The size from the description will only be used if the
titlebar_font_size option is set to 0. Also, this option is
disabled if the titlebar_uses_desktop_font option is set to true.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/num_workspaces</key>
<applyto>/apps/metacity/general/num_workspaces</applyto>
<owner>metacity</owner>
<type>int</type>
<default>4</default>
<locale name="C">
<short>Number of workspaces</short>
<long>
Number of workspaces. Must be more than zero, and has a fixed
maximum to prevent making the desktop unusable by accidentally
asking for too many workspaces.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/visual_bell</key>
<applyto>/apps/metacity/general/visual_bell</applyto>
<owner>metacity</owner>
<type>bool</type>
<default>false</default>
<locale name="C">
<short>Enable Visual Bell</short>
<long>
Turns on a visual indication when an application or the system
issues a 'bell' or 'beep'; useful for the hard-of-hearing and for
use in noisy environments.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/audible_bell</key>
<applyto>/apps/metacity/general/audible_bell</applyto>
<owner>metacity</owner>
<type>bool</type>
<default>true</default>
<locale name="C">
<short>System Bell is Audible</short>
<long>
Determines whether applications or the system can generate
audible 'beeps'; may be used in conjunction with 'visual bell' to
allow silent 'beeps'.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/visual_bell_type</key>
<applyto>/apps/metacity/general/visual_bell_type</applyto>
<owner>metacity</owner>
<type>string</type>
<default>fullscreen</default>
<locale name="C">
<short>Visual Bell Type</short>
<long>
Tells Metacity how to implement the visual indication that the
system bell or another application 'bell' indicator has been
rung. Currently there are two valid values, "fullscreen", which
causes a fullscreen white-black flash, and "frame_flash" which
causes the titlebar of the application which sent the bell signal
to flash. If the application which sent the bell is unknown (as
is usually the case for the default "system beep"), the currently
focused window's titlebar is flashed.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/compositing_manager</key>
<applyto>/apps/metacity/general/compositing_manager</applyto>
<owner>metacity</owner>
<type>bool</type>
<default>false</default>
<locale name="C">
<short>Compositing Manager</short>
<long>
Determines whether Metacity is a compositing manager.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/workspace_names/name</key>
<applyto>/apps/metacity/workspace_names/name_1</applyto>
<applyto>/apps/metacity/workspace_names/name_2</applyto>
<applyto>/apps/metacity/workspace_names/name_3</applyto>
<applyto>/apps/metacity/workspace_names/name_4</applyto>
<applyto>/apps/metacity/workspace_names/name_5</applyto>
<applyto>/apps/metacity/workspace_names/name_6</applyto>
<applyto>/apps/metacity/workspace_names/name_7</applyto>
<applyto>/apps/metacity/workspace_names/name_8</applyto>
<applyto>/apps/metacity/workspace_names/name_9</applyto>
<applyto>/apps/metacity/workspace_names/name_10</applyto>
<applyto>/apps/metacity/workspace_names/name_11</applyto>
<applyto>/apps/metacity/workspace_names/name_12</applyto>
<applyto>/apps/metacity/workspace_names/name_13</applyto>
<applyto>/apps/metacity/workspace_names/name_14</applyto>
<applyto>/apps/metacity/workspace_names/name_15</applyto>
<applyto>/apps/metacity/workspace_names/name_16</applyto>
<owner>metacity</owner>
<type>string</type>
<default></default>
<locale name="C">
<short>Name of workspace</short>
<long>
The name of a workspace.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/reduced_resources</key>
<applyto>/apps/metacity/general/reduced_resources</applyto>
<owner>metacity</owner>
<type>bool</type>
<default>false</default>
<locale name="C">
<short>If true, trade off usability for less resource usage</short>
<long>
If true, metacity will give the user less feedback by using
wireframes, avoiding animations, or other means. This is a
significant reduction in usability for many users, but may allow
legacy applications to continue working, and may also be a
useful tradeoff for terminal servers. However, the wireframe
feature is disabled when accessibility is on.
</long>
</locale>
</schema>
<!-- Keybindings -->
<schema>
<key>/schemas/apps/metacity/global_keybindings/run_command</key>
<applyto>/apps/metacity/global_keybindings/run_command_1</applyto>
<applyto>/apps/metacity/global_keybindings/run_command_2</applyto>
<applyto>/apps/metacity/global_keybindings/run_command_3</applyto>
<applyto>/apps/metacity/global_keybindings/run_command_4</applyto>
<applyto>/apps/metacity/global_keybindings/run_command_5</applyto>
<applyto>/apps/metacity/global_keybindings/run_command_6</applyto>
<applyto>/apps/metacity/global_keybindings/run_command_7</applyto>
<applyto>/apps/metacity/global_keybindings/run_command_8</applyto>
<applyto>/apps/metacity/global_keybindings/run_command_9</applyto>
<applyto>/apps/metacity/global_keybindings/run_command_10</applyto>
<applyto>/apps/metacity/global_keybindings/run_command_11</applyto>
<applyto>/apps/metacity/global_keybindings/run_command_12</applyto>
<owner>metacity</owner>
<type>string</type>
<default>disabled</default>
<locale name="C">
<short>Run a defined command</short>
<long>
The keybinding that runs the correspondingly-numbered
command in /apps/metacity/keybinding_commands
The format looks like "&lt;Control&gt;a" or
"&lt;Shift&gt;&lt;Alt&gt;F1".
The parser is fairly liberal and allows lower or upper case,
and also abbreviations such as "&lt;Ctl&gt;" and
"&lt;Ctrl&gt;". If you set the option to the special string
"disabled", then there will be no keybinding for this
action.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/keybinding_commands/command</key>
<applyto>/apps/metacity/keybinding_commands/command_1</applyto>
<applyto>/apps/metacity/keybinding_commands/command_2</applyto>
<applyto>/apps/metacity/keybinding_commands/command_3</applyto>
<applyto>/apps/metacity/keybinding_commands/command_4</applyto>
<applyto>/apps/metacity/keybinding_commands/command_5</applyto>
<applyto>/apps/metacity/keybinding_commands/command_6</applyto>
<applyto>/apps/metacity/keybinding_commands/command_7</applyto>
<applyto>/apps/metacity/keybinding_commands/command_8</applyto>
<applyto>/apps/metacity/keybinding_commands/command_9</applyto>
<applyto>/apps/metacity/keybinding_commands/command_10</applyto>
<applyto>/apps/metacity/keybinding_commands/command_11</applyto>
<applyto>/apps/metacity/keybinding_commands/command_12</applyto>
<owner>metacity</owner>
<type>string</type>
<default> </default>
<locale name="C">
<short>Commands to run in response to keybindings</short>
<long>
The /apps/metacity/global_keybindings/run_command_N
keys define keybindings that correspond to these commands.
Pressing the keybinding for run_command_N will
execute command_N.
</long>
</locale>
</schema>
<!-- Schemas below are generated by schema-bindings.c when this file
becomes metacity.schemas.in
-->
<!-- GENERATED -->
<!-- Not used and/or crackrock -->
<schema>
<key>/schemas/apps/metacity/general/application_based</key>
<applyto>/apps/metacity/general/application_based</applyto>
<owner>metacity</owner>
<type>bool</type>
<default>false</default>
<locale name="C">
<short>(Not implemented) Navigation works in terms of applications not windows</short>
<long>
If true, then Metacity works in terms of applications rather than
windows. The concept is a bit abstract, but in general an
application-based setup is more like the Mac and less like
Windows. When you focus a window in application-based mode, all
the windows in the application will be raised. Also, in
application-based mode, focus clicks are not passed through to
windows in other applications. Application-based mode is,
however, largely unimplemented at the moment.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/metacity/general/disable_workarounds</key>
<applyto>/apps/metacity/general/disable_workarounds</applyto>
<owner>metacity</owner>
<type>bool</type>
<default>false</default>
<locale name="C">
<short>Disable misfeatures that are required by old or broken
applications</short>
<long>
Some applications disregard specifications in ways that result in
window manager misfeatures. This option puts Metacity in a
rigorously correct mode, which gives a more consistent user
interface, provided one does not need to run any misbehaving
applications.
</long>
</locale>
</schema>
</schemalist>
</gconfschemafile>