2006-10-01 18:30:10 -04:00
|
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
|
Comprehensively rename to Mutter
Code:
All references in the code not related to themes, keybindings, or
GConf were changed from 'metacity' to 'mutter'. This includes, among other
things, strings, comments, the atoms used in the message protocol, and
the envvars used for debugging. The GConf schema file was reduced to
the 3 settings new to mutter.
The overall version was brought up to 2.27 to match current gnome.
Structure:
All files named '*metacity*' were renamed '*mutter*' with appropriate
changes in the automake system. Files removed are
doc/creating_themes, src/themes, doc/metacity-theme.dtd,
metacity.doap. These files will eventually end up in an external
gnome-wm-data module.
Installation location:
On the filesystem the mutter-plugindir was change from
$(libdir)/metacity/plugins/clutter to just $(libdir)/mutter/plugins.
The mutter-plugins.pc.in reflects these changes.
Note:
mutter.desktop.in and mutter-wm.desktop both continue to have
X-GNOME-WMSettingsModule=metacity set. This allows
gnome-control-center to continue using libmetacity.so for
configuration. This is fine since most the general keybindings and wm
settings are being read from /apps/metacity/* in gconf.
2009-06-10 06:29:20 -04:00
|
|
|
|
/* Mutter preferences */
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
|
|
|
|
/*
|
2002-07-06 12:50:48 -04:00
|
|
|
|
* Copyright (C) 2001 Havoc Pennington, Copyright (C) 2002 Red Hat Inc.
|
2006-01-10 14:43:21 -05:00
|
|
|
|
* Copyright (C) 2006 Elijah Newren
|
2008-06-13 19:10:32 -04:00
|
|
|
|
* Copyright (C) 2008 Thomas Thurman
|
2001-12-09 17:41:12 -05:00
|
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
#include "prefs.h"
|
2002-04-28 00:52:26 -04:00
|
|
|
|
#include "ui.h"
|
2001-12-09 17:41:12 -05:00
|
|
|
|
#include "util.h"
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#ifdef HAVE_GCONF
|
2001-12-09 17:41:12 -05:00
|
|
|
|
#include <gconf/gconf-client.h>
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#endif
|
2001-12-09 17:41:12 -05:00
|
|
|
|
#include <string.h>
|
2002-07-11 00:10:44 -04:00
|
|
|
|
#include <stdlib.h>
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
2003-02-22 17:43:13 -05:00
|
|
|
|
#define MAX_REASONABLE_WORKSPACES 36
|
2003-02-23 21:16:09 -05:00
|
|
|
|
|
|
|
|
|
#define MAX_COMMANDS (32 + NUM_EXTRA_COMMANDS)
|
|
|
|
|
#define NUM_EXTRA_COMMANDS 2
|
|
|
|
|
#define SCREENSHOT_COMMAND_IDX (MAX_COMMANDS - 2)
|
|
|
|
|
#define WIN_SCREENSHOT_COMMAND_IDX (MAX_COMMANDS - 1)
|
2002-11-03 14:06:39 -05:00
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
|
/* If you add a key, it needs updating in init() and in the gconf
|
2008-02-23 01:16:03 -05:00
|
|
|
|
* notify listener and of course in the .schemas file.
|
|
|
|
|
*
|
|
|
|
|
* Keys which are handled by one of the unified handlers below are
|
|
|
|
|
* not given a name here, because the purpose of the unified handlers
|
|
|
|
|
* is that keys should be referred to exactly once.
|
2001-12-09 17:41:12 -05:00
|
|
|
|
*/
|
|
|
|
|
#define KEY_TITLEBAR_FONT "/apps/metacity/general/titlebar_font"
|
2001-12-09 22:55:26 -05:00
|
|
|
|
#define KEY_NUM_WORKSPACES "/apps/metacity/general/num_workspaces"
|
2008-08-31 18:55:18 -04:00
|
|
|
|
#define KEY_COMPOSITOR "/apps/metacity/general/compositing_manager"
|
2005-01-26 03:43:38 -05:00
|
|
|
|
#define KEY_GNOME_ACCESSIBILITY "/desktop/gnome/interface/accessibility"
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
2002-07-11 00:10:44 -04:00
|
|
|
|
#define KEY_COMMAND_PREFIX "/apps/metacity/keybinding_commands/command_"
|
2004-10-13 04:32:10 -04:00
|
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
|
#define KEY_TERMINAL_DIR "/desktop/gnome/applications/terminal"
|
|
|
|
|
#define KEY_TERMINAL_COMMAND KEY_TERMINAL_DIR "/exec"
|
2004-10-13 04:32:10 -04:00
|
|
|
|
|
Comprehensively rename to Mutter
Code:
All references in the code not related to themes, keybindings, or
GConf were changed from 'metacity' to 'mutter'. This includes, among other
things, strings, comments, the atoms used in the message protocol, and
the envvars used for debugging. The GConf schema file was reduced to
the 3 settings new to mutter.
The overall version was brought up to 2.27 to match current gnome.
Structure:
All files named '*metacity*' were renamed '*mutter*' with appropriate
changes in the automake system. Files removed are
doc/creating_themes, src/themes, doc/metacity-theme.dtd,
metacity.doap. These files will eventually end up in an external
gnome-wm-data module.
Installation location:
On the filesystem the mutter-plugindir was change from
$(libdir)/metacity/plugins/clutter to just $(libdir)/mutter/plugins.
The mutter-plugins.pc.in reflects these changes.
Note:
mutter.desktop.in and mutter-wm.desktop both continue to have
X-GNOME-WMSettingsModule=metacity set. This allows
gnome-control-center to continue using libmetacity.so for
configuration. This is fine since most the general keybindings and wm
settings are being read from /apps/metacity/* in gconf.
2009-06-10 06:29:20 -04:00
|
|
|
|
#define KEY_OVERLAY_KEY "/apps/mutter/general/overlay_key"
|
2002-04-28 00:52:26 -04:00
|
|
|
|
#define KEY_SCREEN_BINDINGS_PREFIX "/apps/metacity/global_keybindings"
|
|
|
|
|
#define KEY_WINDOW_BINDINGS_PREFIX "/apps/metacity/window_keybindings"
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
#define KEY_LIST_BINDINGS_SUFFIX "_list"
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
|
#define KEY_WORKSPACE_NAME_PREFIX "/apps/metacity/workspace_names/name_"
|
|
|
|
|
|
Comprehensively rename to Mutter
Code:
All references in the code not related to themes, keybindings, or
GConf were changed from 'metacity' to 'mutter'. This includes, among other
things, strings, comments, the atoms used in the message protocol, and
the envvars used for debugging. The GConf schema file was reduced to
the 3 settings new to mutter.
The overall version was brought up to 2.27 to match current gnome.
Structure:
All files named '*metacity*' were renamed '*mutter*' with appropriate
changes in the automake system. Files removed are
doc/creating_themes, src/themes, doc/metacity-theme.dtd,
metacity.doap. These files will eventually end up in an external
gnome-wm-data module.
Installation location:
On the filesystem the mutter-plugindir was change from
$(libdir)/metacity/plugins/clutter to just $(libdir)/mutter/plugins.
The mutter-plugins.pc.in reflects these changes.
Note:
mutter.desktop.in and mutter-wm.desktop both continue to have
X-GNOME-WMSettingsModule=metacity set. This allows
gnome-control-center to continue using libmetacity.so for
configuration. This is fine since most the general keybindings and wm
settings are being read from /apps/metacity/* in gconf.
2009-06-10 06:29:20 -04:00
|
|
|
|
#define KEY_CLUTTER_PLUGINS "/apps/mutter/general/clutter_plugins"
|
2003-01-28 10:07:43 -05:00
|
|
|
|
|
Comprehensively rename to Mutter
Code:
All references in the code not related to themes, keybindings, or
GConf were changed from 'metacity' to 'mutter'. This includes, among other
things, strings, comments, the atoms used in the message protocol, and
the envvars used for debugging. The GConf schema file was reduced to
the 3 settings new to mutter.
The overall version was brought up to 2.27 to match current gnome.
Structure:
All files named '*metacity*' were renamed '*mutter*' with appropriate
changes in the automake system. Files removed are
doc/creating_themes, src/themes, doc/metacity-theme.dtd,
metacity.doap. These files will eventually end up in an external
gnome-wm-data module.
Installation location:
On the filesystem the mutter-plugindir was change from
$(libdir)/metacity/plugins/clutter to just $(libdir)/mutter/plugins.
The mutter-plugins.pc.in reflects these changes.
Note:
mutter.desktop.in and mutter-wm.desktop both continue to have
X-GNOME-WMSettingsModule=metacity set. This allows
gnome-control-center to continue using libmetacity.so for
configuration. This is fine since most the general keybindings and wm
settings are being read from /apps/metacity/* in gconf.
2009-06-10 06:29:20 -04:00
|
|
|
|
#define KEY_LIVE_HIDDEN_WINDOWS "/apps/mutter/general/live_hidden_windows"
|
2008-10-24 05:07:24 -04:00
|
|
|
|
|
2009-02-02 09:09:04 -05:00
|
|
|
|
#define KEY_NO_TAB_POPUP "/apps/metacity/general/no_tab_popup"
|
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#ifdef HAVE_GCONF
|
2002-02-07 22:34:26 -05:00
|
|
|
|
static GConfClient *default_client = NULL;
|
2001-12-09 17:41:12 -05:00
|
|
|
|
static GList *changes = NULL;
|
|
|
|
|
static guint changed_idle;
|
2002-12-08 14:17:17 -05:00
|
|
|
|
static GList *listeners = NULL;
|
2008-11-22 14:10:50 -05:00
|
|
|
|
#endif
|
2002-12-08 14:17:17 -05:00
|
|
|
|
|
Fix various initialization and default issues, especially for
2006-01-20 Elijah Newren <newren gmail com>
Fix various initialization and default issues, especially for
--disable-gconf. Make --disable-gconf actually work. #326661.
* configure.in: Fix compilation with --disable-gconf
* src/metacity.schemas.in: Add a note that if any defaults are
changed in this file, src/prefs.c may need to be updated to
reflect the change
* src/prefs.c: set various static global vars to the right default
value, (meta_prefs_init): get the titlebar_font and current_theme
handled better when not using gconf, (struct MetaSimpleKeyMapping,
screen_string_bindings, window_string_bindings): helper vars to
allow some keybindings to work even without gconf,
(init_bindings): initialize bindings for the without-gconf case
too, (init_commands): make sure these are all NULL for the
non-gconf case so that we don't access random memory,
(init_workspace_names): just give these all a default name for the
non-gconf case,
(meta_prefs_change_workspace_name): actually change the name for
the non-gconf case too
2006-01-20 17:42:25 -05:00
|
|
|
|
static gboolean use_system_font = FALSE;
|
2001-12-09 17:41:12 -05:00
|
|
|
|
static PangoFontDescription *titlebar_font = NULL;
|
2002-10-07 19:14:40 -04:00
|
|
|
|
static MetaVirtualModifier mouse_button_mods = Mod1Mask;
|
2001-12-09 17:41:12 -05:00
|
|
|
|
static MetaFocusMode focus_mode = META_FOCUS_MODE_CLICK;
|
2006-04-12 14:01:20 -04:00
|
|
|
|
static MetaFocusNewWindows focus_new_windows = META_FOCUS_NEW_WINDOWS_SMART;
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 14:35:03 -05:00
|
|
|
|
static gboolean raise_on_click = TRUE;
|
2002-02-06 22:07:56 -05:00
|
|
|
|
static char* current_theme = NULL;
|
2001-12-09 22:55:26 -05:00
|
|
|
|
static int num_workspaces = 4;
|
2007-02-17 16:34:00 -05:00
|
|
|
|
static MetaActionTitlebar action_double_click_titlebar = META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE;
|
2007-03-09 20:15:14 -05:00
|
|
|
|
static MetaActionTitlebar action_middle_click_titlebar = META_ACTION_TITLEBAR_LOWER;
|
|
|
|
|
static MetaActionTitlebar action_right_click_titlebar = META_ACTION_TITLEBAR_MENU;
|
2002-01-27 00:50:34 -05:00
|
|
|
|
static gboolean application_based = FALSE;
|
2002-04-30 23:23:46 -04:00
|
|
|
|
static gboolean disable_workarounds = FALSE;
|
2002-05-23 22:23:46 -04:00
|
|
|
|
static gboolean auto_raise = FALSE;
|
|
|
|
|
static gboolean auto_raise_delay = 500;
|
Fix various initialization and default issues, especially for
2006-01-20 Elijah Newren <newren gmail com>
Fix various initialization and default issues, especially for
--disable-gconf. Make --disable-gconf actually work. #326661.
* configure.in: Fix compilation with --disable-gconf
* src/metacity.schemas.in: Add a note that if any defaults are
changed in this file, src/prefs.c may need to be updated to
reflect the change
* src/prefs.c: set various static global vars to the right default
value, (meta_prefs_init): get the titlebar_font and current_theme
handled better when not using gconf, (struct MetaSimpleKeyMapping,
screen_string_bindings, window_string_bindings): helper vars to
allow some keybindings to work even without gconf,
(init_bindings): initialize bindings for the without-gconf case
too, (init_commands): make sure these are all NULL for the
non-gconf case so that we don't access random memory,
(init_workspace_names): just give these all a default name for the
non-gconf case,
(meta_prefs_change_workspace_name): actually change the name for
the non-gconf case too
2006-01-20 17:42:25 -05:00
|
|
|
|
static gboolean provide_visual_bell = FALSE;
|
2003-01-28 10:07:43 -05:00
|
|
|
|
static gboolean bell_is_audible = TRUE;
|
2003-10-12 02:25:38 -04:00
|
|
|
|
static gboolean reduced_resources = FALSE;
|
2005-01-26 03:43:38 -05:00
|
|
|
|
static gboolean gnome_accessibility = FALSE;
|
2008-06-29 17:57:39 -04:00
|
|
|
|
static gboolean gnome_animations = TRUE;
|
2005-07-11 09:25:08 -04:00
|
|
|
|
static char *cursor_theme = NULL;
|
|
|
|
|
static int cursor_size = 24;
|
2006-02-16 15:26:05 -05:00
|
|
|
|
static gboolean compositing_manager = FALSE;
|
2009-01-27 16:05:42 -05:00
|
|
|
|
static gboolean resize_with_right_button = FALSE;
|
2003-10-12 02:25:38 -04:00
|
|
|
|
|
Fix various initialization and default issues, especially for
2006-01-20 Elijah Newren <newren gmail com>
Fix various initialization and default issues, especially for
--disable-gconf. Make --disable-gconf actually work. #326661.
* configure.in: Fix compilation with --disable-gconf
* src/metacity.schemas.in: Add a note that if any defaults are
changed in this file, src/prefs.c may need to be updated to
reflect the change
* src/prefs.c: set various static global vars to the right default
value, (meta_prefs_init): get the titlebar_font and current_theme
handled better when not using gconf, (struct MetaSimpleKeyMapping,
screen_string_bindings, window_string_bindings): helper vars to
allow some keybindings to work even without gconf,
(init_bindings): initialize bindings for the without-gconf case
too, (init_commands): make sure these are all NULL for the
non-gconf case so that we don't access random memory,
(init_workspace_names): just give these all a default name for the
non-gconf case,
(meta_prefs_change_workspace_name): actually change the name for
the non-gconf case too
2006-01-20 17:42:25 -05:00
|
|
|
|
static MetaVisualBellType visual_bell_type = META_VISUAL_BELL_FULLSCREEN_FLASH;
|
2007-07-22 02:39:29 -04:00
|
|
|
|
static MetaButtonLayout button_layout;
|
2002-11-03 14:06:39 -05:00
|
|
|
|
|
2003-02-23 21:16:09 -05:00
|
|
|
|
/* The screenshot commands are at the end */
|
2002-11-03 14:06:39 -05:00
|
|
|
|
static char *commands[MAX_COMMANDS] = { NULL, };
|
|
|
|
|
|
2004-10-13 04:32:10 -04:00
|
|
|
|
static char *terminal_command = NULL;
|
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
|
static char *workspace_names[MAX_REASONABLE_WORKSPACES] = { NULL, };
|
|
|
|
|
|
2008-10-31 08:33:37 -04:00
|
|
|
|
static gboolean clutter_plugins_overridden = FALSE;
|
2008-09-18 11:09:11 -04:00
|
|
|
|
static GSList *clutter_plugins = NULL;
|
|
|
|
|
|
2008-10-24 05:07:24 -04:00
|
|
|
|
static gboolean live_hidden_windows = FALSE;
|
|
|
|
|
|
2009-02-02 09:09:04 -05:00
|
|
|
|
static gboolean no_tab_popup = FALSE;
|
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#ifdef HAVE_GCONF
|
2008-02-23 01:16:03 -05:00
|
|
|
|
static gboolean handle_preference_update_enum (const gchar *key, GConfValue *value);
|
|
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
|
static gboolean update_key_binding (const char *name,
|
|
|
|
|
const char *value);
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
static gboolean find_and_update_list_binding (MetaKeyPref *bindings,
|
|
|
|
|
const char *name,
|
|
|
|
|
GSList *value);
|
2008-11-22 14:02:54 -05:00
|
|
|
|
static gboolean update_key_list_binding (const char *name,
|
|
|
|
|
GSList *value);
|
2002-07-11 00:10:44 -04:00
|
|
|
|
static gboolean update_command (const char *name,
|
|
|
|
|
const char *value);
|
2002-11-03 14:06:39 -05:00
|
|
|
|
static gboolean update_workspace_name (const char *name,
|
|
|
|
|
const char *value);
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
|
|
|
|
static void change_notify (GConfClient *client,
|
|
|
|
|
guint cnxn_id,
|
|
|
|
|
GConfEntry *entry,
|
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
|
static char* gconf_key_for_workspace_name (int i);
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
|
static void queue_changed (MetaPreference pref);
|
|
|
|
|
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
META_LIST_OF_STRINGS,
|
|
|
|
|
META_LIST_OF_GCONFVALUE_STRINGS
|
|
|
|
|
} MetaStringListType;
|
|
|
|
|
|
|
|
|
|
static gboolean update_list_binding (MetaKeyPref *binding,
|
|
|
|
|
GSList *value,
|
|
|
|
|
MetaStringListType type_of_value);
|
|
|
|
|
|
2008-02-23 16:02:05 -05:00
|
|
|
|
static void cleanup_error (GError **error);
|
|
|
|
|
static gboolean get_bool (const char *key, gboolean *val);
|
|
|
|
|
static void maybe_give_disable_workarounds_warning (void);
|
|
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
|
static void titlebar_handler (MetaPreference, const gchar*, gboolean*);
|
|
|
|
|
static void theme_name_handler (MetaPreference, const gchar*, gboolean*);
|
|
|
|
|
static void mouse_button_mods_handler (MetaPreference, const gchar*, gboolean*);
|
|
|
|
|
static void button_layout_handler (MetaPreference, const gchar*, gboolean*);
|
|
|
|
|
|
2008-02-23 01:16:03 -05:00
|
|
|
|
#endif /* HAVE_GCONF */
|
|
|
|
|
|
|
|
|
|
static gboolean update_binding (MetaKeyPref *binding,
|
|
|
|
|
const char *value);
|
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
|
static void init_bindings (void);
|
|
|
|
|
static void init_commands (void);
|
|
|
|
|
static void init_workspace_names (void);
|
2008-02-23 16:02:05 -05:00
|
|
|
|
|
|
|
|
|
#ifndef HAVE_GCONF
|
2007-07-22 02:39:29 -04:00
|
|
|
|
static void init_button_layout (void);
|
2008-02-23 16:02:05 -05:00
|
|
|
|
#endif /* !HAVE_GCONF */
|
2002-12-08 14:17:17 -05:00
|
|
|
|
|
2008-02-23 01:16:03 -05:00
|
|
|
|
#ifdef HAVE_GCONF
|
2008-02-23 16:02:05 -05:00
|
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
MetaPrefsChangedFunc func;
|
|
|
|
|
gpointer data;
|
|
|
|
|
} MetaPrefsListener;
|
|
|
|
|
|
2008-02-23 01:16:03 -05:00
|
|
|
|
static GConfEnumStringPair symtab_focus_mode[] =
|
|
|
|
|
{
|
|
|
|
|
{ META_FOCUS_MODE_CLICK, "click" },
|
|
|
|
|
{ META_FOCUS_MODE_SLOPPY, "sloppy" },
|
|
|
|
|
{ META_FOCUS_MODE_MOUSE, "mouse" },
|
|
|
|
|
{ 0, NULL },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static GConfEnumStringPair symtab_focus_new_windows[] =
|
|
|
|
|
{
|
|
|
|
|
{ META_FOCUS_NEW_WINDOWS_SMART, "smart" },
|
|
|
|
|
{ META_FOCUS_NEW_WINDOWS_STRICT, "strict" },
|
|
|
|
|
{ 0, NULL },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static GConfEnumStringPair symtab_visual_bell_type[] =
|
|
|
|
|
{
|
|
|
|
|
/* Note to the reader: 0 is an invalid value; these start at 1. */
|
|
|
|
|
{ META_VISUAL_BELL_FULLSCREEN_FLASH, "fullscreen" },
|
|
|
|
|
{ META_VISUAL_BELL_FRAME_FLASH, "frame_flash" },
|
|
|
|
|
{ 0, NULL },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static GConfEnumStringPair symtab_titlebar_action[] =
|
|
|
|
|
{
|
|
|
|
|
{ META_ACTION_TITLEBAR_TOGGLE_SHADE, "toggle_shade" },
|
|
|
|
|
{ META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE, "toggle_maximize" },
|
2008-03-02 20:58:54 -05:00
|
|
|
|
{ META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_HORIZONTALLY,
|
|
|
|
|
"toggle_maximize_horizontally" },
|
|
|
|
|
{ META_ACTION_TITLEBAR_TOGGLE_MAXIMIZE_VERTICALLY,
|
|
|
|
|
"toggle_maximize_vertically" },
|
2008-02-23 01:16:03 -05:00
|
|
|
|
{ META_ACTION_TITLEBAR_MINIMIZE, "minimize" },
|
|
|
|
|
{ META_ACTION_TITLEBAR_NONE, "none" },
|
|
|
|
|
{ META_ACTION_TITLEBAR_LOWER, "lower" },
|
|
|
|
|
{ META_ACTION_TITLEBAR_MENU, "menu" },
|
|
|
|
|
{ META_ACTION_TITLEBAR_TOGGLE_SHADE, "toggle_shade" },
|
|
|
|
|
{ 0, NULL },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The details of one preference which is constrained to be
|
|
|
|
|
* one of a small number of string values-- in other words,
|
|
|
|
|
* an enumeration.
|
|
|
|
|
*
|
|
|
|
|
* We could have done this other ways. One particularly attractive
|
|
|
|
|
* possibility would have been to represent the entire symbol table
|
|
|
|
|
* as a space-separated string literal in the list of symtabs, so
|
|
|
|
|
* the focus mode enums could have been represented simply by
|
|
|
|
|
* "click sloppy mouse". However, the simplicity gained would have
|
|
|
|
|
* been outweighed by the bugs caused when the ordering of the enum
|
|
|
|
|
* strings got out of sync with the actual enum statement. Also,
|
|
|
|
|
* there is existing library code to use this kind of symbol tables.
|
|
|
|
|
*
|
|
|
|
|
* Other things we might consider doing to clean this up in the
|
|
|
|
|
* future include:
|
|
|
|
|
*
|
|
|
|
|
* - most of the keys begin with the same prefix, and perhaps we
|
|
|
|
|
* could assume it if they don't start with a slash
|
|
|
|
|
*
|
|
|
|
|
* - there are several cases where a single identifier could be used
|
|
|
|
|
* to generate an entire entry, and perhaps this could be done
|
|
|
|
|
* with a macro. (This would reduce clarity, however, and is
|
|
|
|
|
* probably a bad thing.)
|
2008-02-23 16:02:05 -05:00
|
|
|
|
*
|
2008-03-06 12:59:20 -05:00
|
|
|
|
* - these types all begin with a gchar* (and contain a MetaPreference)
|
|
|
|
|
* and we can factor out the repeated code in the handlers by taking
|
|
|
|
|
* advantage of this using some kind of union arrangement.
|
2008-02-23 01:16:03 -05:00
|
|
|
|
*/
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
gchar *key;
|
2008-06-13 19:10:32 -04:00
|
|
|
|
MetaPreference pref;
|
2008-02-23 01:16:03 -05:00
|
|
|
|
GConfEnumStringPair *symtab;
|
|
|
|
|
gpointer target;
|
|
|
|
|
} MetaEnumPreference;
|
|
|
|
|
|
2008-02-23 16:02:05 -05:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
gchar *key;
|
|
|
|
|
MetaPreference pref;
|
2008-06-13 19:10:32 -04:00
|
|
|
|
gboolean *target;
|
2008-02-23 16:02:05 -05:00
|
|
|
|
gboolean becomes_true_on_destruction;
|
|
|
|
|
} MetaBoolPreference;
|
|
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
gchar *key;
|
|
|
|
|
MetaPreference pref;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A handler. Many of the string preferences aren't stored as
|
|
|
|
|
* strings and need parsing; others of them have default values
|
|
|
|
|
* which can't be solved in the general case. If you include a
|
|
|
|
|
* function pointer here, it will be called before the string
|
|
|
|
|
* value is written out to the target variable.
|
|
|
|
|
*
|
|
|
|
|
* The function is passed two arguments: the preference, and
|
|
|
|
|
* the new string as a gchar*. It returns a gboolean;
|
|
|
|
|
* only if this is true, the listeners will be informed that
|
|
|
|
|
* the preference has changed.
|
|
|
|
|
*
|
|
|
|
|
* This may be NULL. If it is, see "target", below.
|
|
|
|
|
*/
|
|
|
|
|
void (*handler) (MetaPreference pref,
|
|
|
|
|
const gchar *string_value,
|
|
|
|
|
gboolean *inform_listeners);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Where to write the incoming string.
|
|
|
|
|
*
|
2008-06-13 19:10:32 -04:00
|
|
|
|
* This must be NULL if the handler is non-NULL.
|
2008-03-06 12:59:20 -05:00
|
|
|
|
* If the incoming string is NULL, no change will be made.
|
|
|
|
|
*/
|
|
|
|
|
gchar **target;
|
|
|
|
|
|
|
|
|
|
} MetaStringPreference;
|
|
|
|
|
|
2008-06-13 19:10:32 -04:00
|
|
|
|
#define METAINTPREFERENCE_NO_CHANGE_ON_DESTROY G_MININT
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
gchar *key;
|
|
|
|
|
MetaPreference pref;
|
|
|
|
|
gint *target;
|
|
|
|
|
/**
|
|
|
|
|
* Minimum and maximum values of the integer.
|
|
|
|
|
* If the new value is out of bounds, it will be discarded with a warning.
|
|
|
|
|
*/
|
|
|
|
|
gint minimum, maximum;
|
|
|
|
|
/**
|
|
|
|
|
* Value to use if the key is destroyed.
|
|
|
|
|
* If this is METAINTPREFERENCE_NO_CHANGE_ON_DESTROY, it will
|
|
|
|
|
* not be changed when the key is destroyed.
|
|
|
|
|
*/
|
|
|
|
|
gint value_if_destroyed;
|
|
|
|
|
} MetaIntPreference;
|
|
|
|
|
|
|
|
|
|
/* FIXMEs: */
|
|
|
|
|
/* @@@ Don't use NULL lines at the end; glib can tell you how big it is */
|
Comprehensively rename to Mutter
Code:
All references in the code not related to themes, keybindings, or
GConf were changed from 'metacity' to 'mutter'. This includes, among other
things, strings, comments, the atoms used in the message protocol, and
the envvars used for debugging. The GConf schema file was reduced to
the 3 settings new to mutter.
The overall version was brought up to 2.27 to match current gnome.
Structure:
All files named '*metacity*' were renamed '*mutter*' with appropriate
changes in the automake system. Files removed are
doc/creating_themes, src/themes, doc/metacity-theme.dtd,
metacity.doap. These files will eventually end up in an external
gnome-wm-data module.
Installation location:
On the filesystem the mutter-plugindir was change from
$(libdir)/metacity/plugins/clutter to just $(libdir)/mutter/plugins.
The mutter-plugins.pc.in reflects these changes.
Note:
mutter.desktop.in and mutter-wm.desktop both continue to have
X-GNOME-WMSettingsModule=metacity set. This allows
gnome-control-center to continue using libmetacity.so for
configuration. This is fine since most the general keybindings and wm
settings are being read from /apps/metacity/* in gconf.
2009-06-10 06:29:20 -04:00
|
|
|
|
/* @@@ /apps/mutter/general should be assumed if first char is not / */
|
2008-06-13 19:10:32 -04:00
|
|
|
|
/* @@@ Will it ever be possible to merge init and update? If not, why not? */
|
|
|
|
|
|
2008-02-23 01:16:03 -05:00
|
|
|
|
static MetaEnumPreference preferences_enum[] =
|
|
|
|
|
{
|
|
|
|
|
{ "/apps/metacity/general/focus_new_windows",
|
2008-06-13 19:10:32 -04:00
|
|
|
|
META_PREF_FOCUS_NEW_WINDOWS,
|
2008-02-23 01:16:03 -05:00
|
|
|
|
symtab_focus_new_windows,
|
|
|
|
|
&focus_new_windows,
|
|
|
|
|
},
|
|
|
|
|
{ "/apps/metacity/general/focus_mode",
|
2008-06-13 19:10:32 -04:00
|
|
|
|
META_PREF_FOCUS_MODE,
|
2008-02-23 01:16:03 -05:00
|
|
|
|
symtab_focus_mode,
|
|
|
|
|
&focus_mode,
|
|
|
|
|
},
|
|
|
|
|
{ "/apps/metacity/general/visual_bell_type",
|
2008-06-13 19:10:32 -04:00
|
|
|
|
META_PREF_VISUAL_BELL_TYPE,
|
2008-02-23 01:16:03 -05:00
|
|
|
|
symtab_visual_bell_type,
|
|
|
|
|
&visual_bell_type,
|
|
|
|
|
},
|
|
|
|
|
{ "/apps/metacity/general/action_double_click_titlebar",
|
2008-06-13 19:10:32 -04:00
|
|
|
|
META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR,
|
2008-02-23 01:16:03 -05:00
|
|
|
|
symtab_titlebar_action,
|
|
|
|
|
&action_double_click_titlebar,
|
|
|
|
|
},
|
|
|
|
|
{ "/apps/metacity/general/action_middle_click_titlebar",
|
2008-06-13 19:10:32 -04:00
|
|
|
|
META_PREF_ACTION_MIDDLE_CLICK_TITLEBAR,
|
2008-02-23 01:16:03 -05:00
|
|
|
|
symtab_titlebar_action,
|
|
|
|
|
&action_middle_click_titlebar,
|
|
|
|
|
},
|
|
|
|
|
{ "/apps/metacity/general/action_right_click_titlebar",
|
2008-06-13 19:10:32 -04:00
|
|
|
|
META_PREF_ACTION_RIGHT_CLICK_TITLEBAR,
|
2008-02-23 01:16:03 -05:00
|
|
|
|
symtab_titlebar_action,
|
|
|
|
|
&action_right_click_titlebar,
|
|
|
|
|
},
|
2008-06-13 19:10:32 -04:00
|
|
|
|
{ NULL, 0, NULL, NULL },
|
2008-02-23 01:16:03 -05:00
|
|
|
|
};
|
|
|
|
|
|
2008-02-23 16:02:05 -05:00
|
|
|
|
static MetaBoolPreference preferences_bool[] =
|
|
|
|
|
{
|
|
|
|
|
{ "/apps/metacity/general/raise_on_click",
|
|
|
|
|
META_PREF_RAISE_ON_CLICK,
|
2008-06-13 19:10:32 -04:00
|
|
|
|
&raise_on_click,
|
2008-02-23 16:02:05 -05:00
|
|
|
|
TRUE,
|
|
|
|
|
},
|
|
|
|
|
{ "/apps/metacity/general/titlebar_uses_system_font",
|
|
|
|
|
META_PREF_TITLEBAR_FONT, /* note! shares a pref */
|
2008-06-13 19:10:32 -04:00
|
|
|
|
&use_system_font,
|
2008-02-23 16:02:05 -05:00
|
|
|
|
TRUE,
|
|
|
|
|
},
|
|
|
|
|
{ "/apps/metacity/general/application_based",
|
|
|
|
|
META_PREF_APPLICATION_BASED,
|
2008-06-13 19:10:32 -04:00
|
|
|
|
NULL, /* feature is known but disabled */
|
2008-02-23 16:02:05 -05:00
|
|
|
|
FALSE,
|
|
|
|
|
},
|
|
|
|
|
{ "/apps/metacity/general/disable_workarounds",
|
|
|
|
|
META_PREF_DISABLE_WORKAROUNDS,
|
2008-06-13 19:10:32 -04:00
|
|
|
|
&disable_workarounds,
|
2008-02-23 16:02:05 -05:00
|
|
|
|
FALSE,
|
|
|
|
|
},
|
|
|
|
|
{ "/apps/metacity/general/auto_raise",
|
|
|
|
|
META_PREF_AUTO_RAISE,
|
2008-06-13 19:10:32 -04:00
|
|
|
|
&auto_raise,
|
2008-02-23 16:02:05 -05:00
|
|
|
|
FALSE,
|
|
|
|
|
},
|
|
|
|
|
{ "/apps/metacity/general/visual_bell",
|
|
|
|
|
META_PREF_VISUAL_BELL,
|
2008-06-13 19:10:32 -04:00
|
|
|
|
&provide_visual_bell, /* FIXME: change the name: it's confusing */
|
2008-02-23 16:02:05 -05:00
|
|
|
|
FALSE,
|
|
|
|
|
},
|
|
|
|
|
{ "/apps/metacity/general/audible_bell",
|
|
|
|
|
META_PREF_AUDIBLE_BELL,
|
2008-06-13 19:10:32 -04:00
|
|
|
|
&bell_is_audible, /* FIXME: change the name: it's confusing */
|
2008-02-23 16:02:05 -05:00
|
|
|
|
FALSE,
|
|
|
|
|
},
|
|
|
|
|
{ "/apps/metacity/general/reduced_resources",
|
|
|
|
|
META_PREF_REDUCED_RESOURCES,
|
2008-06-13 19:10:32 -04:00
|
|
|
|
&reduced_resources,
|
2008-02-23 16:02:05 -05:00
|
|
|
|
FALSE,
|
|
|
|
|
},
|
|
|
|
|
{ "/desktop/gnome/interface/accessibility",
|
|
|
|
|
META_PREF_GNOME_ACCESSIBILITY,
|
2008-06-13 19:10:32 -04:00
|
|
|
|
&gnome_accessibility,
|
2008-02-23 16:02:05 -05:00
|
|
|
|
FALSE,
|
|
|
|
|
},
|
2008-06-29 17:57:39 -04:00
|
|
|
|
{ "/desktop/gnome/interface/enable_animations",
|
|
|
|
|
META_PREF_GNOME_ANIMATIONS,
|
|
|
|
|
&gnome_animations,
|
|
|
|
|
TRUE,
|
|
|
|
|
},
|
2008-02-23 16:02:05 -05:00
|
|
|
|
{ "/apps/metacity/general/compositing_manager",
|
|
|
|
|
META_PREF_COMPOSITING_MANAGER,
|
2008-06-13 19:10:32 -04:00
|
|
|
|
&compositing_manager,
|
2008-02-23 16:02:05 -05:00
|
|
|
|
FALSE,
|
|
|
|
|
},
|
2009-01-27 16:05:42 -05:00
|
|
|
|
{ "/apps/metacity/general/resize_with_right_button",
|
|
|
|
|
META_PREF_RESIZE_WITH_RIGHT_BUTTON,
|
|
|
|
|
&resize_with_right_button,
|
|
|
|
|
FALSE,
|
|
|
|
|
},
|
Comprehensively rename to Mutter
Code:
All references in the code not related to themes, keybindings, or
GConf were changed from 'metacity' to 'mutter'. This includes, among other
things, strings, comments, the atoms used in the message protocol, and
the envvars used for debugging. The GConf schema file was reduced to
the 3 settings new to mutter.
The overall version was brought up to 2.27 to match current gnome.
Structure:
All files named '*metacity*' were renamed '*mutter*' with appropriate
changes in the automake system. Files removed are
doc/creating_themes, src/themes, doc/metacity-theme.dtd,
metacity.doap. These files will eventually end up in an external
gnome-wm-data module.
Installation location:
On the filesystem the mutter-plugindir was change from
$(libdir)/metacity/plugins/clutter to just $(libdir)/mutter/plugins.
The mutter-plugins.pc.in reflects these changes.
Note:
mutter.desktop.in and mutter-wm.desktop both continue to have
X-GNOME-WMSettingsModule=metacity set. This allows
gnome-control-center to continue using libmetacity.so for
configuration. This is fine since most the general keybindings and wm
settings are being read from /apps/metacity/* in gconf.
2009-06-10 06:29:20 -04:00
|
|
|
|
{ "/apps/mutter/general/live_hidden_windows",
|
2008-10-24 05:07:24 -04:00
|
|
|
|
META_PREF_LIVE_HIDDEN_WINDOWS,
|
|
|
|
|
&live_hidden_windows,
|
|
|
|
|
FALSE,
|
|
|
|
|
},
|
2009-02-02 09:09:04 -05:00
|
|
|
|
{ "/apps/metacity/general/no_tab_popup",
|
|
|
|
|
META_PREF_NO_TAB_POPUP,
|
|
|
|
|
&no_tab_popup,
|
|
|
|
|
FALSE,
|
|
|
|
|
},
|
2008-06-13 19:10:32 -04:00
|
|
|
|
{ NULL, 0, NULL, FALSE },
|
2008-02-23 16:02:05 -05:00
|
|
|
|
};
|
2008-02-23 01:16:03 -05:00
|
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
|
static MetaStringPreference preferences_string[] =
|
|
|
|
|
{
|
|
|
|
|
{ "/apps/metacity/general/mouse_button_modifier",
|
|
|
|
|
META_PREF_MOUSE_BUTTON_MODS,
|
|
|
|
|
mouse_button_mods_handler,
|
|
|
|
|
NULL,
|
|
|
|
|
},
|
|
|
|
|
{ "/apps/metacity/general/theme",
|
|
|
|
|
META_PREF_THEME,
|
|
|
|
|
theme_name_handler,
|
|
|
|
|
NULL,
|
|
|
|
|
},
|
|
|
|
|
{ KEY_TITLEBAR_FONT,
|
|
|
|
|
META_PREF_TITLEBAR_FONT,
|
|
|
|
|
titlebar_handler,
|
|
|
|
|
NULL,
|
|
|
|
|
},
|
|
|
|
|
{ KEY_TERMINAL_COMMAND,
|
|
|
|
|
META_PREF_TERMINAL_COMMAND,
|
|
|
|
|
NULL,
|
|
|
|
|
&terminal_command,
|
|
|
|
|
},
|
|
|
|
|
{ "/apps/metacity/general/button_layout",
|
|
|
|
|
META_PREF_BUTTON_LAYOUT,
|
|
|
|
|
button_layout_handler,
|
|
|
|
|
NULL,
|
|
|
|
|
},
|
|
|
|
|
{ "/desktop/gnome/peripherals/mouse/cursor_theme",
|
|
|
|
|
META_PREF_CURSOR_THEME,
|
|
|
|
|
NULL,
|
|
|
|
|
&cursor_theme,
|
|
|
|
|
},
|
|
|
|
|
{ NULL, 0, NULL, NULL },
|
|
|
|
|
};
|
|
|
|
|
|
2008-06-13 19:10:32 -04:00
|
|
|
|
static MetaIntPreference preferences_int[] =
|
|
|
|
|
{
|
|
|
|
|
{ "/apps/metacity/general/num_workspaces",
|
|
|
|
|
META_PREF_NUM_WORKSPACES,
|
|
|
|
|
&num_workspaces,
|
|
|
|
|
/* I would actually recommend we change the destroy value to 4
|
|
|
|
|
* and get rid of METAINTPREFERENCE_NO_CHANGE_ON_DESTROY entirely.
|
|
|
|
|
* -- tthurman
|
|
|
|
|
*/
|
|
|
|
|
1, MAX_REASONABLE_WORKSPACES, METAINTPREFERENCE_NO_CHANGE_ON_DESTROY,
|
|
|
|
|
},
|
|
|
|
|
{ "/apps/metacity/general/auto_raise_delay",
|
|
|
|
|
META_PREF_AUTO_RAISE_DELAY,
|
|
|
|
|
&auto_raise_delay,
|
|
|
|
|
0, 10000, 0,
|
|
|
|
|
/* @@@ Get rid of MAX_REASONABLE_AUTO_RAISE_DELAY */
|
|
|
|
|
},
|
|
|
|
|
{ "/desktop/gnome/peripherals/mouse/cursor_size",
|
|
|
|
|
META_PREF_CURSOR_SIZE,
|
|
|
|
|
&cursor_size,
|
|
|
|
|
1, 128, 24,
|
|
|
|
|
},
|
|
|
|
|
{ NULL, 0, NULL, 0, 0, 0, },
|
|
|
|
|
};
|
|
|
|
|
|
2008-02-23 01:16:03 -05:00
|
|
|
|
static void
|
|
|
|
|
handle_preference_init_enum (void)
|
|
|
|
|
{
|
|
|
|
|
MetaEnumPreference *cursor = preferences_enum;
|
|
|
|
|
|
|
|
|
|
while (cursor->key!=NULL)
|
|
|
|
|
{
|
|
|
|
|
char *value;
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
|
if (cursor->target==NULL)
|
|
|
|
|
{
|
|
|
|
|
++cursor;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-23 01:16:03 -05:00
|
|
|
|
value = gconf_client_get_string (default_client,
|
2008-03-06 12:59:20 -05:00
|
|
|
|
cursor->key,
|
|
|
|
|
&error);
|
2008-02-23 01:16:03 -05:00
|
|
|
|
cleanup_error (&error);
|
|
|
|
|
|
|
|
|
|
if (value==NULL)
|
2008-03-06 12:59:20 -05:00
|
|
|
|
{
|
|
|
|
|
++cursor;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2008-02-23 01:16:03 -05:00
|
|
|
|
|
|
|
|
|
if (!gconf_string_to_enum (cursor->symtab,
|
|
|
|
|
value,
|
|
|
|
|
(gint *) cursor->target))
|
|
|
|
|
meta_warning (_("GConf key '%s' is set to an invalid value\n"),
|
|
|
|
|
cursor->key);
|
|
|
|
|
|
|
|
|
|
g_free (value);
|
|
|
|
|
|
|
|
|
|
++cursor;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-23 16:02:05 -05:00
|
|
|
|
static void
|
|
|
|
|
handle_preference_init_bool (void)
|
|
|
|
|
{
|
|
|
|
|
MetaBoolPreference *cursor = preferences_bool;
|
|
|
|
|
|
|
|
|
|
while (cursor->key!=NULL)
|
|
|
|
|
{
|
|
|
|
|
if (cursor->target!=NULL)
|
|
|
|
|
get_bool (cursor->key, cursor->target);
|
|
|
|
|
|
|
|
|
|
++cursor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
maybe_give_disable_workarounds_warning ();
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
|
static void
|
|
|
|
|
handle_preference_init_string (void)
|
|
|
|
|
{
|
|
|
|
|
MetaStringPreference *cursor = preferences_string;
|
|
|
|
|
|
|
|
|
|
while (cursor->key!=NULL)
|
|
|
|
|
{
|
|
|
|
|
char *value;
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
gboolean dummy = TRUE;
|
|
|
|
|
|
|
|
|
|
/* the string "value" will be newly allocated */
|
|
|
|
|
value = gconf_client_get_string (default_client,
|
|
|
|
|
cursor->key,
|
|
|
|
|
&error);
|
2009-02-03 05:15:23 -05:00
|
|
|
|
|
|
|
|
|
if (error || !value)
|
|
|
|
|
{
|
|
|
|
|
cleanup_error (&error);
|
|
|
|
|
++cursor;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2008-03-06 12:59:20 -05:00
|
|
|
|
|
|
|
|
|
if (cursor->handler)
|
|
|
|
|
{
|
|
|
|
|
if (cursor->target)
|
|
|
|
|
meta_bug ("%s has both a target and a handler\n", cursor->key);
|
|
|
|
|
|
|
|
|
|
cursor->handler (cursor->pref, value, &dummy);
|
|
|
|
|
|
|
|
|
|
g_free (value);
|
|
|
|
|
}
|
|
|
|
|
else if (cursor->target)
|
|
|
|
|
{
|
|
|
|
|
if (*(cursor->target))
|
|
|
|
|
g_free (*(cursor->target));
|
|
|
|
|
|
|
|
|
|
*(cursor->target) = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
++cursor;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-13 19:10:32 -04:00
|
|
|
|
static void
|
|
|
|
|
handle_preference_init_int (void)
|
|
|
|
|
{
|
|
|
|
|
MetaIntPreference *cursor = preferences_int;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (cursor->key!=NULL)
|
|
|
|
|
{
|
|
|
|
|
gint value;
|
|
|
|
|
GError *error = NULL;
|
|
|
|
|
|
|
|
|
|
value = gconf_client_get_int (default_client,
|
|
|
|
|
cursor->key,
|
|
|
|
|
&error);
|
|
|
|
|
cleanup_error (&error);
|
|
|
|
|
|
|
|
|
|
if (value < cursor->minimum || value > cursor->maximum)
|
|
|
|
|
{
|
|
|
|
|
meta_warning (_("%d stored in GConf key %s is out of range %d to %d\n"),
|
|
|
|
|
value, cursor->key, cursor->minimum, cursor->maximum);
|
|
|
|
|
/* Former behaviour for out-of-range values was:
|
|
|
|
|
* - number of workspaces was clamped;
|
|
|
|
|
* - auto raise delay was always reset to zero even if too high!;
|
|
|
|
|
* - cursor size was ignored.
|
|
|
|
|
*
|
|
|
|
|
* These seem to be meaningless variations. If they did
|
|
|
|
|
* have meaning we could have put them into MetaIntPreference.
|
|
|
|
|
* The last of these is the closest to how we behave for
|
|
|
|
|
* other types, so I think we should standardise on that.
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
else if (cursor->target)
|
|
|
|
|
*cursor->target = value;
|
|
|
|
|
|
|
|
|
|
++cursor;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-23 01:16:03 -05:00
|
|
|
|
static gboolean
|
|
|
|
|
handle_preference_update_enum (const gchar *key, GConfValue *value)
|
|
|
|
|
{
|
|
|
|
|
MetaEnumPreference *cursor = preferences_enum;
|
|
|
|
|
gint old_value;
|
|
|
|
|
|
|
|
|
|
while (cursor->key!=NULL && strcmp (key, cursor->key)!=0)
|
|
|
|
|
++cursor;
|
|
|
|
|
|
|
|
|
|
if (cursor->key==NULL)
|
|
|
|
|
/* Didn't recognise that key. */
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
/* Setting it to null (that is, removing it) always means
|
|
|
|
|
* "don't change".
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (value==NULL)
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
/* Check the type. Enums are always strings. */
|
|
|
|
|
|
|
|
|
|
if (value->type != GCONF_VALUE_STRING)
|
|
|
|
|
{
|
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
|
key);
|
|
|
|
|
/* But we did recognise it. */
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We need to know whether the value changes, so
|
|
|
|
|
* store the current value away.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
old_value = * ((gint *) cursor->target);
|
|
|
|
|
|
|
|
|
|
/* Now look it up... */
|
|
|
|
|
|
|
|
|
|
if (!gconf_string_to_enum (cursor->symtab,
|
|
|
|
|
gconf_value_get_string (value),
|
|
|
|
|
(gint *) cursor->target))
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* We found it, but it was invalid. Complain.
|
|
|
|
|
*
|
|
|
|
|
* FIXME: This replicates the original behaviour, but in the future
|
|
|
|
|
* we might consider reverting invalid keys to their original values.
|
|
|
|
|
* (We know the old value, so we can look up a suitable string in
|
|
|
|
|
* the symtab.)
|
2008-10-27 08:30:18 -04:00
|
|
|
|
*
|
|
|
|
|
* (Empty comment follows so the translators don't see this.)
|
2008-02-23 01:16:03 -05:00
|
|
|
|
*/
|
2008-10-27 08:30:18 -04:00
|
|
|
|
|
|
|
|
|
/* */
|
2008-02-23 01:16:03 -05:00
|
|
|
|
meta_warning (_("GConf key '%s' is set to an invalid value\n"),
|
|
|
|
|
key);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Did it change? If so, tell the listeners about it. */
|
|
|
|
|
|
|
|
|
|
if (old_value != *((gint *) cursor->target))
|
|
|
|
|
queue_changed (cursor->pref);
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-23 16:02:05 -05:00
|
|
|
|
static gboolean
|
|
|
|
|
handle_preference_update_bool (const gchar *key, GConfValue *value)
|
|
|
|
|
{
|
|
|
|
|
MetaBoolPreference *cursor = preferences_bool;
|
|
|
|
|
gboolean old_value;
|
|
|
|
|
|
|
|
|
|
while (cursor->key!=NULL && strcmp (key, cursor->key)!=0)
|
|
|
|
|
++cursor;
|
|
|
|
|
|
|
|
|
|
if (cursor->key==NULL)
|
|
|
|
|
/* Didn't recognise that key. */
|
|
|
|
|
return FALSE;
|
2008-04-03 13:36:32 -04:00
|
|
|
|
|
|
|
|
|
if (cursor->target==NULL)
|
|
|
|
|
/* No work for us to do. */
|
|
|
|
|
return TRUE;
|
2008-02-23 16:02:05 -05:00
|
|
|
|
|
|
|
|
|
if (value==NULL)
|
|
|
|
|
{
|
|
|
|
|
/* Value was destroyed; let's get out of here. */
|
|
|
|
|
|
|
|
|
|
if (cursor->becomes_true_on_destruction)
|
|
|
|
|
/* This preserves the behaviour of the old system, but
|
|
|
|
|
* for all I know that might have been an oversight.
|
|
|
|
|
*/
|
|
|
|
|
*((gboolean *)cursor->target) = TRUE;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Check the type. */
|
|
|
|
|
|
|
|
|
|
if (value->type != GCONF_VALUE_BOOL)
|
|
|
|
|
{
|
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
|
key);
|
|
|
|
|
/* But we did recognise it. */
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We need to know whether the value changes, so
|
|
|
|
|
* store the current value away.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
old_value = * ((gboolean *) cursor->target);
|
|
|
|
|
|
|
|
|
|
/* Now look it up... */
|
|
|
|
|
|
|
|
|
|
*((gboolean *) cursor->target) = gconf_value_get_bool (value);
|
|
|
|
|
|
|
|
|
|
/* Did it change? If so, tell the listeners about it. */
|
|
|
|
|
|
|
|
|
|
if (old_value != *((gboolean *) cursor->target))
|
|
|
|
|
queue_changed (cursor->pref);
|
|
|
|
|
|
|
|
|
|
if (cursor->pref==META_PREF_DISABLE_WORKAROUNDS)
|
|
|
|
|
maybe_give_disable_workarounds_warning ();
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
|
static gboolean
|
|
|
|
|
handle_preference_update_string (const gchar *key, GConfValue *value)
|
|
|
|
|
{
|
|
|
|
|
MetaStringPreference *cursor = preferences_string;
|
|
|
|
|
const gchar *value_as_string;
|
|
|
|
|
gboolean inform_listeners = TRUE;
|
|
|
|
|
|
|
|
|
|
while (cursor->key!=NULL && strcmp (key, cursor->key)!=0)
|
|
|
|
|
++cursor;
|
|
|
|
|
|
|
|
|
|
if (cursor->key==NULL)
|
|
|
|
|
/* Didn't recognise that key. */
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (value==NULL)
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
/* Check the type. */
|
|
|
|
|
|
|
|
|
|
if (value->type != GCONF_VALUE_STRING)
|
|
|
|
|
{
|
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
|
key);
|
|
|
|
|
/* But we did recognise it. */
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Docs: "The returned string is not a copy, don't try to free it." */
|
|
|
|
|
value_as_string = gconf_value_get_string (value);
|
|
|
|
|
|
|
|
|
|
if (cursor->handler)
|
|
|
|
|
cursor->handler (cursor->pref, value_as_string, &inform_listeners);
|
|
|
|
|
else if (cursor->target)
|
|
|
|
|
{
|
|
|
|
|
if (*(cursor->target))
|
|
|
|
|
g_free(*(cursor->target));
|
|
|
|
|
|
|
|
|
|
if (value_as_string!=NULL)
|
|
|
|
|
*(cursor->target) = g_strdup (value_as_string);
|
|
|
|
|
else
|
|
|
|
|
*(cursor->target) = NULL;
|
|
|
|
|
|
|
|
|
|
inform_listeners =
|
|
|
|
|
(value_as_string==NULL && *(cursor->target)==NULL) ||
|
|
|
|
|
(value_as_string!=NULL && *(cursor->target)!=NULL &&
|
|
|
|
|
strcmp (value_as_string, *(cursor->target))==0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (inform_listeners)
|
|
|
|
|
queue_changed (cursor->pref);
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-13 19:10:32 -04:00
|
|
|
|
static gboolean
|
|
|
|
|
handle_preference_update_int (const gchar *key, GConfValue *value)
|
|
|
|
|
{
|
|
|
|
|
MetaIntPreference *cursor = preferences_int;
|
|
|
|
|
gint new_value;
|
|
|
|
|
|
|
|
|
|
while (cursor->key!=NULL && strcmp (key, cursor->key)!=0)
|
|
|
|
|
++cursor;
|
|
|
|
|
|
|
|
|
|
if (cursor->key==NULL)
|
|
|
|
|
/* Didn't recognise that key. */
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (cursor->target==NULL)
|
|
|
|
|
/* No work for us to do. */
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
if (value==NULL)
|
|
|
|
|
{
|
|
|
|
|
/* Value was destroyed. */
|
|
|
|
|
|
|
|
|
|
if (cursor->value_if_destroyed != METAINTPREFERENCE_NO_CHANGE_ON_DESTROY)
|
|
|
|
|
*((gint *)cursor->target) = cursor->value_if_destroyed;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Check the type. */
|
|
|
|
|
|
|
|
|
|
if (value->type != GCONF_VALUE_INT)
|
|
|
|
|
{
|
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
|
key);
|
|
|
|
|
/* But we did recognise it. */
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
new_value = gconf_value_get_int (value);
|
|
|
|
|
|
|
|
|
|
if (new_value < cursor->minimum || new_value > cursor->maximum)
|
|
|
|
|
{
|
|
|
|
|
meta_warning (_("%d stored in GConf key %s is out of range %d to %d\n"),
|
|
|
|
|
new_value, cursor->key,
|
|
|
|
|
cursor->minimum, cursor->maximum);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Did it change? If so, tell the listeners about it. */
|
|
|
|
|
|
|
|
|
|
if (*cursor->target != new_value)
|
|
|
|
|
{
|
|
|
|
|
*cursor->target = new_value;
|
|
|
|
|
queue_changed (cursor->pref);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
|
/* Listeners. */
|
|
|
|
|
/****************************************************************************/
|
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
|
void
|
|
|
|
|
meta_prefs_add_listener (MetaPrefsChangedFunc func,
|
|
|
|
|
gpointer data)
|
|
|
|
|
{
|
|
|
|
|
MetaPrefsListener *l;
|
|
|
|
|
|
|
|
|
|
l = g_new (MetaPrefsListener, 1);
|
|
|
|
|
l->func = func;
|
|
|
|
|
l->data = data;
|
|
|
|
|
|
|
|
|
|
listeners = g_list_prepend (listeners, l);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
meta_prefs_remove_listener (MetaPrefsChangedFunc func,
|
|
|
|
|
gpointer data)
|
|
|
|
|
{
|
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
|
|
tmp = listeners;
|
|
|
|
|
while (tmp != NULL)
|
|
|
|
|
{
|
|
|
|
|
MetaPrefsListener *l = tmp->data;
|
|
|
|
|
|
|
|
|
|
if (l->func == func &&
|
|
|
|
|
l->data == data)
|
|
|
|
|
{
|
|
|
|
|
g_free (l);
|
|
|
|
|
listeners = g_list_delete_link (listeners, tmp);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
meta_bug ("Did not find listener to remove\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
emit_changed (MetaPreference pref)
|
|
|
|
|
{
|
|
|
|
|
GList *tmp;
|
|
|
|
|
GList *copy;
|
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
|
meta_topic (META_DEBUG_PREFS, "Notifying listeners that pref %s changed\n",
|
|
|
|
|
meta_preference_to_string (pref));
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
|
|
|
|
copy = g_list_copy (listeners);
|
|
|
|
|
|
|
|
|
|
tmp = copy;
|
2008-03-06 12:59:20 -05:00
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
|
while (tmp != NULL)
|
|
|
|
|
{
|
|
|
|
|
MetaPrefsListener *l = tmp->data;
|
|
|
|
|
|
|
|
|
|
(* l->func) (pref, l->data);
|
2008-03-06 12:59:20 -05:00
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
|
tmp = tmp->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_list_free (copy);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
changed_idle_handler (gpointer data)
|
|
|
|
|
{
|
|
|
|
|
GList *tmp;
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
queue_changed (MetaPreference pref)
|
|
|
|
|
{
|
2002-11-03 14:06:39 -05:00
|
|
|
|
meta_topic (META_DEBUG_PREFS, "Queueing change of pref %s\n",
|
|
|
|
|
meta_preference_to_string (pref));
|
2008-03-06 12:59:20 -05:00
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
|
if (g_list_find (changes, GINT_TO_POINTER (pref)) == NULL)
|
|
|
|
|
changes = g_list_prepend (changes, GINT_TO_POINTER (pref));
|
|
|
|
|
else
|
2002-11-03 14:06:39 -05:00
|
|
|
|
meta_topic (META_DEBUG_PREFS, "Change of pref %s was already pending\n",
|
|
|
|
|
meta_preference_to_string (pref));
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
|
|
|
|
/* add idle at priority below the gconf notify idle */
|
2001-12-09 17:41:12 -05:00
|
|
|
|
if (changed_idle == 0)
|
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 01:41:13 -04:00
|
|
|
|
changed_idle = g_idle_add_full (META_PRIORITY_PREFS_NOTIFY,
|
2002-04-28 00:52:26 -04:00
|
|
|
|
changed_idle_handler, NULL, NULL);
|
2001-12-09 17:41:12 -05:00
|
|
|
|
}
|
2008-05-28 00:10:08 -04:00
|
|
|
|
|
|
|
|
|
#else /* HAVE_GCONF */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
meta_prefs_add_listener (MetaPrefsChangedFunc func,
|
|
|
|
|
gpointer data)
|
|
|
|
|
{
|
|
|
|
|
/* Nothing, because they have gconf turned off */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
meta_prefs_remove_listener (MetaPrefsChangedFunc func,
|
|
|
|
|
gpointer data)
|
|
|
|
|
{
|
|
|
|
|
/* Nothing, because they have gconf turned off */
|
|
|
|
|
}
|
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#endif /* HAVE_GCONF */
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
2008-06-13 19:10:32 -04:00
|
|
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
|
/* Initialisation. */
|
|
|
|
|
/****************************************************************************/
|
2008-05-28 00:10:08 -04:00
|
|
|
|
|
2008-11-22 14:10:50 -05:00
|
|
|
|
#ifdef HAVE_GCONF
|
2008-06-13 19:10:32 -04:00
|
|
|
|
/* @@@ again, use glib's ability to tell you the size of the array */
|
2008-03-06 12:59:20 -05:00
|
|
|
|
static gchar *gconf_dirs_we_are_interested_in[] = {
|
|
|
|
|
"/apps/metacity",
|
Comprehensively rename to Mutter
Code:
All references in the code not related to themes, keybindings, or
GConf were changed from 'metacity' to 'mutter'. This includes, among other
things, strings, comments, the atoms used in the message protocol, and
the envvars used for debugging. The GConf schema file was reduced to
the 3 settings new to mutter.
The overall version was brought up to 2.27 to match current gnome.
Structure:
All files named '*metacity*' were renamed '*mutter*' with appropriate
changes in the automake system. Files removed are
doc/creating_themes, src/themes, doc/metacity-theme.dtd,
metacity.doap. These files will eventually end up in an external
gnome-wm-data module.
Installation location:
On the filesystem the mutter-plugindir was change from
$(libdir)/metacity/plugins/clutter to just $(libdir)/mutter/plugins.
The mutter-plugins.pc.in reflects these changes.
Note:
mutter.desktop.in and mutter-wm.desktop both continue to have
X-GNOME-WMSettingsModule=metacity set. This allows
gnome-control-center to continue using libmetacity.so for
configuration. This is fine since most the general keybindings and wm
settings are being read from /apps/metacity/* in gconf.
2009-06-10 06:29:20 -04:00
|
|
|
|
"/apps/mutter",
|
2008-03-06 12:59:20 -05:00
|
|
|
|
KEY_TERMINAL_DIR,
|
|
|
|
|
KEY_GNOME_ACCESSIBILITY,
|
|
|
|
|
"/desktop/gnome/peripherals/mouse",
|
2008-06-29 17:57:39 -04:00
|
|
|
|
"/desktop/gnome/interface",
|
2008-03-06 12:59:20 -05:00
|
|
|
|
NULL,
|
|
|
|
|
};
|
2008-11-22 14:10:50 -05:00
|
|
|
|
#endif
|
2008-03-06 12:59:20 -05:00
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
|
void
|
|
|
|
|
meta_prefs_init (void)
|
|
|
|
|
{
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#ifdef HAVE_GCONF
|
2001-12-09 17:41:12 -05:00
|
|
|
|
GError *err = NULL;
|
2008-03-06 12:59:20 -05:00
|
|
|
|
gchar **gconf_dir_cursor;
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
2002-02-07 22:34:26 -05:00
|
|
|
|
if (default_client != NULL)
|
2001-12-09 17:41:12 -05:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* returns a reference which we hold forever */
|
2002-02-07 22:34:26 -05:00
|
|
|
|
default_client = gconf_client_get_default ();
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
|
for (gconf_dir_cursor=gconf_dirs_we_are_interested_in;
|
|
|
|
|
*gconf_dir_cursor!=NULL;
|
|
|
|
|
gconf_dir_cursor++)
|
|
|
|
|
{
|
|
|
|
|
gconf_client_add_dir (default_client,
|
|
|
|
|
*gconf_dir_cursor,
|
|
|
|
|
GCONF_CLIENT_PRELOAD_RECURSIVE,
|
|
|
|
|
&err);
|
|
|
|
|
cleanup_error (&err);
|
|
|
|
|
}
|
2005-07-11 09:25:08 -04:00
|
|
|
|
|
2008-02-23 16:02:05 -05:00
|
|
|
|
/* Pick up initial values. */
|
2008-02-23 01:16:03 -05:00
|
|
|
|
|
|
|
|
|
handle_preference_init_enum ();
|
2008-02-23 16:02:05 -05:00
|
|
|
|
handle_preference_init_bool ();
|
2008-03-06 12:59:20 -05:00
|
|
|
|
handle_preference_init_string ();
|
2008-06-13 19:10:32 -04:00
|
|
|
|
handle_preference_init_int ();
|
2008-02-23 01:16:03 -05:00
|
|
|
|
|
2008-10-31 08:33:37 -04:00
|
|
|
|
if (!clutter_plugins_overridden)
|
|
|
|
|
clutter_plugins = gconf_client_get_list (default_client, KEY_CLUTTER_PLUGINS,
|
|
|
|
|
GCONF_VALUE_STRING, &err);
|
2008-09-18 11:09:11 -04:00
|
|
|
|
|
|
|
|
|
cleanup_error (&err);
|
|
|
|
|
|
2008-06-13 19:10:32 -04:00
|
|
|
|
/* @@@ Is there any reason we don't do the add_dir here? */
|
2008-03-06 12:59:20 -05:00
|
|
|
|
for (gconf_dir_cursor=gconf_dirs_we_are_interested_in;
|
|
|
|
|
*gconf_dir_cursor!=NULL;
|
|
|
|
|
gconf_dir_cursor++)
|
|
|
|
|
{
|
|
|
|
|
gconf_client_notify_add (default_client,
|
|
|
|
|
*gconf_dir_cursor,
|
|
|
|
|
change_notify,
|
|
|
|
|
NULL,
|
|
|
|
|
NULL,
|
|
|
|
|
&err);
|
|
|
|
|
cleanup_error (&err);
|
|
|
|
|
}
|
|
|
|
|
|
Fix various initialization and default issues, especially for
2006-01-20 Elijah Newren <newren gmail com>
Fix various initialization and default issues, especially for
--disable-gconf. Make --disable-gconf actually work. #326661.
* configure.in: Fix compilation with --disable-gconf
* src/metacity.schemas.in: Add a note that if any defaults are
changed in this file, src/prefs.c may need to be updated to
reflect the change
* src/prefs.c: set various static global vars to the right default
value, (meta_prefs_init): get the titlebar_font and current_theme
handled better when not using gconf, (struct MetaSimpleKeyMapping,
screen_string_bindings, window_string_bindings): helper vars to
allow some keybindings to work even without gconf,
(init_bindings): initialize bindings for the without-gconf case
too, (init_commands): make sure these are all NULL for the
non-gconf case so that we don't access random memory,
(init_workspace_names): just give these all a default name for the
non-gconf case,
(meta_prefs_change_workspace_name): actually change the name for
the non-gconf case too
2006-01-20 17:42:25 -05:00
|
|
|
|
#else /* HAVE_GCONF */
|
2008-03-06 12:59:20 -05:00
|
|
|
|
|
Fix various initialization and default issues, especially for
2006-01-20 Elijah Newren <newren gmail com>
Fix various initialization and default issues, especially for
--disable-gconf. Make --disable-gconf actually work. #326661.
* configure.in: Fix compilation with --disable-gconf
* src/metacity.schemas.in: Add a note that if any defaults are
changed in this file, src/prefs.c may need to be updated to
reflect the change
* src/prefs.c: set various static global vars to the right default
value, (meta_prefs_init): get the titlebar_font and current_theme
handled better when not using gconf, (struct MetaSimpleKeyMapping,
screen_string_bindings, window_string_bindings): helper vars to
allow some keybindings to work even without gconf,
(init_bindings): initialize bindings for the without-gconf case
too, (init_commands): make sure these are all NULL for the
non-gconf case so that we don't access random memory,
(init_workspace_names): just give these all a default name for the
non-gconf case,
(meta_prefs_change_workspace_name): actually change the name for
the non-gconf case too
2006-01-20 17:42:25 -05:00
|
|
|
|
/* Set defaults for some values that can't be set at initialization time of
|
|
|
|
|
* the static globals. In the case of the theme, note that there is code
|
|
|
|
|
* elsewhere that will do everything possible to fallback to an existing theme
|
|
|
|
|
* if the one here does not exist.
|
|
|
|
|
*/
|
|
|
|
|
titlebar_font = pango_font_description_from_string ("Sans Bold 10");
|
|
|
|
|
current_theme = g_strdup ("Atlanta");
|
2007-07-22 02:39:29 -04:00
|
|
|
|
|
|
|
|
|
init_button_layout();
|
2003-10-12 02:25:38 -04:00
|
|
|
|
#endif /* HAVE_GCONF */
|
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
|
init_bindings ();
|
2002-07-11 00:10:44 -04:00
|
|
|
|
init_commands ();
|
2002-11-03 14:06:39 -05:00
|
|
|
|
init_workspace_names ();
|
2001-12-09 17:41:12 -05:00
|
|
|
|
}
|
|
|
|
|
|
2008-06-13 19:10:32 -04:00
|
|
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
|
/* Updates. */
|
|
|
|
|
/****************************************************************************/
|
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#ifdef HAVE_GCONF
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
2008-02-23 01:16:03 -05:00
|
|
|
|
gboolean (*preference_update_handler[]) (const gchar*, GConfValue*) = {
|
|
|
|
|
handle_preference_update_enum,
|
2008-02-23 16:02:05 -05:00
|
|
|
|
handle_preference_update_bool,
|
2008-03-06 12:59:20 -05:00
|
|
|
|
handle_preference_update_string,
|
2008-06-13 19:10:32 -04:00
|
|
|
|
handle_preference_update_int,
|
2008-02-23 01:16:03 -05:00
|
|
|
|
NULL
|
|
|
|
|
};
|
2007-04-24 23:30:17 -04:00
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
|
static void
|
|
|
|
|
change_notify (GConfClient *client,
|
|
|
|
|
guint cnxn_id,
|
|
|
|
|
GConfEntry *entry,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
const char *key;
|
|
|
|
|
GConfValue *value;
|
2008-02-23 01:16:03 -05:00
|
|
|
|
gint i=0;
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
|
|
|
|
key = gconf_entry_get_key (entry);
|
|
|
|
|
value = gconf_entry_get_value (entry);
|
2002-10-07 19:14:40 -04:00
|
|
|
|
|
2008-02-23 01:16:03 -05:00
|
|
|
|
/* First, search for a handler that might know what to do. */
|
2002-10-07 19:14:40 -04:00
|
|
|
|
|
2008-02-23 16:02:05 -05:00
|
|
|
|
/* FIXME: When this is all working, since the first item in every
|
|
|
|
|
* array is the gchar* of the key, there's no reason we can't
|
|
|
|
|
* find the correct record for that key here and save code duplication.
|
|
|
|
|
*/
|
|
|
|
|
|
2008-02-23 01:16:03 -05:00
|
|
|
|
while (preference_update_handler[i]!=NULL)
|
|
|
|
|
{
|
|
|
|
|
if (preference_update_handler[i] (key, value))
|
2008-11-22 14:02:54 -05:00
|
|
|
|
goto out; /* Get rid of this eventually */
|
2002-10-07 19:14:40 -04:00
|
|
|
|
|
2008-02-23 01:16:03 -05:00
|
|
|
|
i++;
|
2002-10-07 19:14:40 -04:00
|
|
|
|
}
|
2008-11-22 14:02:54 -05:00
|
|
|
|
|
|
|
|
|
if (g_str_has_prefix (key, KEY_WINDOW_BINDINGS_PREFIX) ||
|
|
|
|
|
g_str_has_prefix (key, KEY_SCREEN_BINDINGS_PREFIX))
|
2002-04-28 00:52:26 -04:00
|
|
|
|
{
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
if (g_str_has_suffix (key, KEY_LIST_BINDINGS_SUFFIX))
|
2002-04-28 00:52:26 -04:00
|
|
|
|
{
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
GSList *list;
|
|
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_LIST)
|
|
|
|
|
{
|
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
|
key);
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
list = value ? gconf_value_get_list (value) : NULL;
|
|
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
|
if (update_key_list_binding (key, list))
|
|
|
|
|
queue_changed (META_PREF_KEYBINDINGS);
|
2002-04-28 00:52:26 -04:00
|
|
|
|
}
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const char *str;
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
if (value && value->type != GCONF_VALUE_STRING)
|
|
|
|
|
{
|
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
|
key);
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
str = value ? gconf_value_get_string (value) : NULL;
|
|
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
|
if (update_key_binding (key, str))
|
|
|
|
|
queue_changed (META_PREF_KEYBINDINGS);
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
}
|
2002-04-28 00:52:26 -04:00
|
|
|
|
}
|
2006-03-25 06:47:31 -05:00
|
|
|
|
else if (g_str_has_prefix (key, KEY_COMMAND_PREFIX))
|
2002-07-11 00:10:44 -04:00
|
|
|
|
{
|
|
|
|
|
const char *str;
|
|
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_STRING)
|
|
|
|
|
{
|
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
|
key);
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
str = value ? gconf_value_get_string (value) : NULL;
|
|
|
|
|
|
|
|
|
|
if (update_command (key, str))
|
|
|
|
|
queue_changed (META_PREF_COMMANDS);
|
2002-05-23 22:23:46 -04:00
|
|
|
|
}
|
2006-03-25 06:47:31 -05:00
|
|
|
|
else if (g_str_has_prefix (key, KEY_WORKSPACE_NAME_PREFIX))
|
2002-11-03 14:06:39 -05:00
|
|
|
|
{
|
|
|
|
|
const char *str;
|
|
|
|
|
|
|
|
|
|
if (value && value->type != GCONF_VALUE_STRING)
|
|
|
|
|
{
|
|
|
|
|
meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
|
|
|
|
|
key);
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
str = value ? gconf_value_get_string (value) : NULL;
|
|
|
|
|
|
|
|
|
|
if (update_workspace_name (key, str))
|
|
|
|
|
queue_changed (META_PREF_WORKSPACE_NAMES);
|
|
|
|
|
}
|
2008-12-02 18:13:11 -05:00
|
|
|
|
else if (g_str_equal (key, KEY_OVERLAY_KEY))
|
|
|
|
|
{
|
|
|
|
|
queue_changed (META_PREF_KEYBINDINGS);
|
|
|
|
|
}
|
2008-10-31 08:33:37 -04:00
|
|
|
|
else if (g_str_equal (key, KEY_CLUTTER_PLUGINS) && !clutter_plugins_overridden)
|
2008-09-18 11:09:11 -04:00
|
|
|
|
{
|
|
|
|
|
GError *err = NULL;
|
|
|
|
|
GSList *l;
|
|
|
|
|
|
|
|
|
|
l = gconf_client_get_list (default_client, KEY_CLUTTER_PLUGINS,
|
|
|
|
|
GCONF_VALUE_STRING, &err);
|
|
|
|
|
|
|
|
|
|
if (!l)
|
|
|
|
|
{
|
|
|
|
|
cleanup_error (&err);
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clutter_plugins = l;
|
|
|
|
|
queue_changed (META_PREF_CLUTTER_PLUGINS);
|
|
|
|
|
}
|
2002-01-27 00:50:34 -05:00
|
|
|
|
else
|
|
|
|
|
{
|
Comprehensively rename to Mutter
Code:
All references in the code not related to themes, keybindings, or
GConf were changed from 'metacity' to 'mutter'. This includes, among other
things, strings, comments, the atoms used in the message protocol, and
the envvars used for debugging. The GConf schema file was reduced to
the 3 settings new to mutter.
The overall version was brought up to 2.27 to match current gnome.
Structure:
All files named '*metacity*' were renamed '*mutter*' with appropriate
changes in the automake system. Files removed are
doc/creating_themes, src/themes, doc/metacity-theme.dtd,
metacity.doap. These files will eventually end up in an external
gnome-wm-data module.
Installation location:
On the filesystem the mutter-plugindir was change from
$(libdir)/metacity/plugins/clutter to just $(libdir)/mutter/plugins.
The mutter-plugins.pc.in reflects these changes.
Note:
mutter.desktop.in and mutter-wm.desktop both continue to have
X-GNOME-WMSettingsModule=metacity set. This allows
gnome-control-center to continue using libmetacity.so for
configuration. This is fine since most the general keybindings and wm
settings are being read from /apps/metacity/* in gconf.
2009-06-10 06:29:20 -04:00
|
|
|
|
meta_topic (META_DEBUG_PREFS, "Key %s doesn't mean anything to Mutter\n",
|
2002-11-03 14:06:39 -05:00
|
|
|
|
key);
|
2002-01-27 00:50:34 -05:00
|
|
|
|
}
|
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
|
out:
|
|
|
|
|
/* nothing */
|
2002-08-10 11:55:18 -04:00
|
|
|
|
return; /* AIX compiler wants something after a label like out: */
|
2001-12-09 17:41:12 -05:00
|
|
|
|
}
|
2008-02-23 16:02:05 -05:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
cleanup_error (GError **error)
|
|
|
|
|
{
|
|
|
|
|
if (*error)
|
|
|
|
|
{
|
|
|
|
|
meta_warning ("%s\n", (*error)->message);
|
|
|
|
|
|
|
|
|
|
g_error_free (*error);
|
|
|
|
|
*error = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* get_bool returns TRUE if *val is filled in, FALSE otherwise */
|
2008-06-13 19:10:32 -04:00
|
|
|
|
/* @@@ probably worth moving this inline; only used once */
|
2008-02-23 16:02:05 -05:00
|
|
|
|
static gboolean
|
|
|
|
|
get_bool (const char *key, gboolean *val)
|
|
|
|
|
{
|
|
|
|
|
GError *err = NULL;
|
|
|
|
|
GConfValue *value;
|
|
|
|
|
gboolean filled_in = FALSE;
|
|
|
|
|
|
|
|
|
|
value = gconf_client_get (default_client, key, &err);
|
|
|
|
|
cleanup_error (&err);
|
|
|
|
|
if (value)
|
|
|
|
|
{
|
|
|
|
|
if (value->type == GCONF_VALUE_BOOL)
|
|
|
|
|
{
|
|
|
|
|
*val = gconf_value_get_bool (value);
|
|
|
|
|
filled_in = TRUE;
|
|
|
|
|
}
|
|
|
|
|
gconf_value_free (value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return filled_in;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Special case: give a warning the first time disable_workarounds
|
|
|
|
|
* is turned on.
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
maybe_give_disable_workarounds_warning (void)
|
|
|
|
|
{
|
|
|
|
|
static gboolean first_disable = TRUE;
|
|
|
|
|
|
|
|
|
|
if (first_disable && disable_workarounds)
|
|
|
|
|
{
|
|
|
|
|
first_disable = FALSE;
|
|
|
|
|
|
|
|
|
|
meta_warning (_("Workarounds for broken applications disabled. "
|
|
|
|
|
"Some applications may not behave properly.\n"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#endif /* HAVE_GCONF */
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
2002-10-07 19:14:40 -04:00
|
|
|
|
MetaVirtualModifier
|
|
|
|
|
meta_prefs_get_mouse_button_mods (void)
|
|
|
|
|
{
|
|
|
|
|
return mouse_button_mods;
|
|
|
|
|
}
|
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
|
MetaFocusMode
|
|
|
|
|
meta_prefs_get_focus_mode (void)
|
|
|
|
|
{
|
|
|
|
|
return focus_mode;
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-12 14:01:20 -04:00
|
|
|
|
MetaFocusNewWindows
|
|
|
|
|
meta_prefs_get_focus_new_windows (void)
|
|
|
|
|
{
|
|
|
|
|
return focus_new_windows;
|
|
|
|
|
}
|
|
|
|
|
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 14:35:03 -05:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_raise_on_click (void)
|
|
|
|
|
{
|
|
|
|
|
/* Force raise_on_click on for click-to-focus, as requested by Havoc
|
|
|
|
|
* in #326156.
|
|
|
|
|
*/
|
|
|
|
|
return raise_on_click || focus_mode == META_FOCUS_MODE_CLICK;
|
|
|
|
|
}
|
|
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
|
const char*
|
|
|
|
|
meta_prefs_get_theme (void)
|
|
|
|
|
{
|
|
|
|
|
return current_theme;
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-11 09:25:08 -04:00
|
|
|
|
const char*
|
|
|
|
|
meta_prefs_get_cursor_theme (void)
|
|
|
|
|
{
|
|
|
|
|
return cursor_theme;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
meta_prefs_get_cursor_size (void)
|
|
|
|
|
{
|
|
|
|
|
return cursor_size;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-13 19:10:32 -04:00
|
|
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
|
/* Handlers for string preferences. */
|
|
|
|
|
/****************************************************************************/
|
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#ifdef HAVE_GCONF
|
2008-03-06 12:59:20 -05:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
titlebar_handler (MetaPreference pref,
|
|
|
|
|
const gchar *string_value,
|
|
|
|
|
gboolean *inform_listeners)
|
2001-12-09 17:41:12 -05:00
|
|
|
|
{
|
2008-10-27 08:30:18 -04:00
|
|
|
|
PangoFontDescription *new_desc = NULL;
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
2008-10-27 07:52:47 -04:00
|
|
|
|
if (string_value)
|
|
|
|
|
new_desc = pango_font_description_from_string (string_value);
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
|
if (new_desc == NULL)
|
2001-12-09 17:41:12 -05:00
|
|
|
|
{
|
2008-03-06 12:59:20 -05:00
|
|
|
|
meta_warning (_("Could not parse font description "
|
|
|
|
|
"\"%s\" from GConf key %s\n"),
|
2008-10-27 07:52:47 -04:00
|
|
|
|
string_value ? string_value : "(null)",
|
2008-03-06 12:59:20 -05:00
|
|
|
|
KEY_TITLEBAR_FONT);
|
|
|
|
|
|
|
|
|
|
*inform_listeners = FALSE;
|
|
|
|
|
|
|
|
|
|
return;
|
2001-12-09 17:41:12 -05:00
|
|
|
|
}
|
|
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
|
/* Is the new description the same as the old? */
|
|
|
|
|
|
|
|
|
|
if (titlebar_font &&
|
2001-12-09 17:41:12 -05:00
|
|
|
|
pango_font_description_equal (new_desc, titlebar_font))
|
|
|
|
|
{
|
|
|
|
|
pango_font_description_free (new_desc);
|
2008-03-06 12:59:20 -05:00
|
|
|
|
*inform_listeners = FALSE;
|
|
|
|
|
return;
|
2001-12-09 17:41:12 -05:00
|
|
|
|
}
|
2008-03-06 12:59:20 -05:00
|
|
|
|
|
|
|
|
|
/* No, so free the old one and put ours in instead. */
|
|
|
|
|
|
|
|
|
|
if (titlebar_font)
|
|
|
|
|
pango_font_description_free (titlebar_font);
|
|
|
|
|
|
|
|
|
|
titlebar_font = new_desc;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
theme_name_handler (MetaPreference pref,
|
|
|
|
|
const gchar *string_value,
|
|
|
|
|
gboolean *inform_listeners)
|
|
|
|
|
{
|
2009-01-27 21:08:09 -05:00
|
|
|
|
g_free (current_theme);
|
|
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
|
/* Fallback crackrock */
|
|
|
|
|
if (string_value == NULL)
|
|
|
|
|
current_theme = g_strdup ("Atlanta");
|
2001-12-09 17:41:12 -05:00
|
|
|
|
else
|
2008-03-06 12:59:20 -05:00
|
|
|
|
current_theme = g_strdup (string_value);
|
|
|
|
|
}
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
|
static void
|
|
|
|
|
mouse_button_mods_handler (MetaPreference pref,
|
|
|
|
|
const gchar *string_value,
|
|
|
|
|
gboolean *inform_listeners)
|
|
|
|
|
{
|
|
|
|
|
MetaVirtualModifier mods;
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
2008-03-06 22:02:44 -05:00
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2008-03-06 12:59:20 -05:00
|
|
|
|
"Mouse button modifier has new gconf value \"%s\"\n",
|
|
|
|
|
string_value);
|
2008-10-26 13:25:42 -04:00
|
|
|
|
if (string_value && meta_ui_parse_modifier (string_value, &mods))
|
2008-03-06 12:59:20 -05:00
|
|
|
|
{
|
|
|
|
|
mouse_button_mods = mods;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
*inform_listeners = FALSE;
|
2001-12-09 17:41:12 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-12 13:44:55 -04:00
|
|
|
|
static gboolean
|
|
|
|
|
button_layout_equal (const MetaButtonLayout *a,
|
|
|
|
|
const MetaButtonLayout *b)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
|
while (i < MAX_BUTTONS_PER_CORNER)
|
|
|
|
|
{
|
|
|
|
|
if (a->left_buttons[i] != b->left_buttons[i])
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (a->right_buttons[i] != b->right_buttons[i])
|
|
|
|
|
return FALSE;
|
2008-02-29 15:41:07 -05:00
|
|
|
|
if (a->left_buttons_has_spacer[i] != b->left_buttons_has_spacer[i])
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (a->right_buttons_has_spacer[i] != b->right_buttons_has_spacer[i])
|
|
|
|
|
return FALSE;
|
2002-10-12 13:44:55 -04:00
|
|
|
|
++i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static MetaButtonFunction
|
|
|
|
|
button_function_from_string (const char *str)
|
|
|
|
|
{
|
2008-03-06 12:59:20 -05:00
|
|
|
|
/* FIXME: gconf_string_to_enum is the obvious way to do this */
|
|
|
|
|
|
2002-10-12 13:44:55 -04:00
|
|
|
|
if (strcmp (str, "menu") == 0)
|
|
|
|
|
return META_BUTTON_FUNCTION_MENU;
|
|
|
|
|
else if (strcmp (str, "minimize") == 0)
|
|
|
|
|
return META_BUTTON_FUNCTION_MINIMIZE;
|
|
|
|
|
else if (strcmp (str, "maximize") == 0)
|
|
|
|
|
return META_BUTTON_FUNCTION_MAXIMIZE;
|
|
|
|
|
else if (strcmp (str, "close") == 0)
|
|
|
|
|
return META_BUTTON_FUNCTION_CLOSE;
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
|
else if (strcmp (str, "shade") == 0)
|
|
|
|
|
return META_BUTTON_FUNCTION_SHADE;
|
|
|
|
|
else if (strcmp (str, "above") == 0)
|
|
|
|
|
return META_BUTTON_FUNCTION_ABOVE;
|
|
|
|
|
else if (strcmp (str, "stick") == 0)
|
|
|
|
|
return META_BUTTON_FUNCTION_STICK;
|
|
|
|
|
else
|
|
|
|
|
/* don't know; give up */
|
2002-10-12 13:44:55 -04:00
|
|
|
|
return META_BUTTON_FUNCTION_LAST;
|
|
|
|
|
}
|
|
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
|
static MetaButtonFunction
|
|
|
|
|
button_opposite_function (MetaButtonFunction ofwhat)
|
|
|
|
|
{
|
|
|
|
|
switch (ofwhat)
|
|
|
|
|
{
|
|
|
|
|
case META_BUTTON_FUNCTION_SHADE:
|
|
|
|
|
return META_BUTTON_FUNCTION_UNSHADE;
|
|
|
|
|
case META_BUTTON_FUNCTION_UNSHADE:
|
|
|
|
|
return META_BUTTON_FUNCTION_SHADE;
|
|
|
|
|
|
|
|
|
|
case META_BUTTON_FUNCTION_ABOVE:
|
|
|
|
|
return META_BUTTON_FUNCTION_UNABOVE;
|
|
|
|
|
case META_BUTTON_FUNCTION_UNABOVE:
|
|
|
|
|
return META_BUTTON_FUNCTION_ABOVE;
|
|
|
|
|
|
|
|
|
|
case META_BUTTON_FUNCTION_STICK:
|
|
|
|
|
return META_BUTTON_FUNCTION_UNSTICK;
|
|
|
|
|
case META_BUTTON_FUNCTION_UNSTICK:
|
|
|
|
|
return META_BUTTON_FUNCTION_STICK;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return META_BUTTON_FUNCTION_LAST;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
|
static void
|
|
|
|
|
button_layout_handler (MetaPreference pref,
|
|
|
|
|
const gchar *string_value,
|
|
|
|
|
gboolean *inform_listeners)
|
2002-10-12 13:44:55 -04:00
|
|
|
|
{
|
|
|
|
|
MetaButtonLayout new_layout;
|
2008-10-27 07:52:47 -04:00
|
|
|
|
char **sides = NULL;
|
2002-10-12 13:44:55 -04:00
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
/* We need to ignore unknown button functions, for
|
|
|
|
|
* compat with future versions
|
|
|
|
|
*/
|
|
|
|
|
|
2008-10-27 07:52:47 -04:00
|
|
|
|
if (string_value)
|
|
|
|
|
sides = g_strsplit (string_value, ":", 2);
|
2002-10-12 13:44:55 -04:00
|
|
|
|
|
2008-10-27 07:52:47 -04:00
|
|
|
|
if (sides != NULL && sides[0] != NULL)
|
2002-10-12 13:44:55 -04:00
|
|
|
|
{
|
|
|
|
|
char **buttons;
|
|
|
|
|
int b;
|
|
|
|
|
gboolean used[META_BUTTON_FUNCTION_LAST];
|
|
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
|
while (i < META_BUTTON_FUNCTION_LAST)
|
|
|
|
|
{
|
|
|
|
|
used[i] = FALSE;
|
2008-02-29 15:41:07 -05:00
|
|
|
|
new_layout.left_buttons_has_spacer[i] = FALSE;
|
2002-10-12 13:44:55 -04:00
|
|
|
|
++i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buttons = g_strsplit (sides[0], ",", -1);
|
|
|
|
|
i = 0;
|
|
|
|
|
b = 0;
|
|
|
|
|
while (buttons[b] != NULL)
|
|
|
|
|
{
|
|
|
|
|
MetaButtonFunction f = button_function_from_string (buttons[b]);
|
2008-02-29 15:41:07 -05:00
|
|
|
|
if (i > 0 && strcmp("spacer", buttons[b]) == 0)
|
2002-10-12 13:44:55 -04:00
|
|
|
|
{
|
2008-02-29 15:41:07 -05:00
|
|
|
|
new_layout.left_buttons_has_spacer[i-1] = TRUE;
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
|
f = button_opposite_function (f);
|
|
|
|
|
|
|
|
|
|
if (f != META_BUTTON_FUNCTION_LAST)
|
2008-02-29 15:41:07 -05:00
|
|
|
|
{
|
|
|
|
|
new_layout.left_buttons_has_spacer[i-2] = TRUE;
|
|
|
|
|
}
|
2002-10-12 13:44:55 -04:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2008-02-29 15:41:07 -05:00
|
|
|
|
if (f != META_BUTTON_FUNCTION_LAST && !used[f])
|
|
|
|
|
{
|
|
|
|
|
new_layout.left_buttons[i] = f;
|
|
|
|
|
used[f] = TRUE;
|
|
|
|
|
++i;
|
|
|
|
|
|
|
|
|
|
f = button_opposite_function (f);
|
|
|
|
|
|
|
|
|
|
if (f != META_BUTTON_FUNCTION_LAST)
|
|
|
|
|
new_layout.left_buttons[i++] = f;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
meta_topic (META_DEBUG_PREFS, "Ignoring unknown or already-used button name \"%s\"\n",
|
|
|
|
|
buttons[b]);
|
|
|
|
|
}
|
2002-10-12 13:44:55 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
++b;
|
|
|
|
|
}
|
|
|
|
|
|
2007-07-22 02:39:29 -04:00
|
|
|
|
new_layout.left_buttons[i] = META_BUTTON_FUNCTION_LAST;
|
2008-02-29 15:41:07 -05:00
|
|
|
|
new_layout.left_buttons_has_spacer[i] = FALSE;
|
2007-07-22 02:39:29 -04:00
|
|
|
|
|
2002-10-12 13:44:55 -04:00
|
|
|
|
g_strfreev (buttons);
|
|
|
|
|
}
|
|
|
|
|
|
2008-10-27 07:52:47 -04:00
|
|
|
|
if (sides != NULL && sides[0] != NULL && sides[1] != NULL)
|
2002-10-12 13:44:55 -04:00
|
|
|
|
{
|
|
|
|
|
char **buttons;
|
|
|
|
|
int b;
|
|
|
|
|
gboolean used[META_BUTTON_FUNCTION_LAST];
|
|
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
|
while (i < META_BUTTON_FUNCTION_LAST)
|
|
|
|
|
{
|
|
|
|
|
used[i] = FALSE;
|
2008-02-29 15:41:07 -05:00
|
|
|
|
new_layout.right_buttons_has_spacer[i] = FALSE;
|
2002-10-12 13:44:55 -04:00
|
|
|
|
++i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buttons = g_strsplit (sides[1], ",", -1);
|
|
|
|
|
i = 0;
|
|
|
|
|
b = 0;
|
|
|
|
|
while (buttons[b] != NULL)
|
|
|
|
|
{
|
|
|
|
|
MetaButtonFunction f = button_function_from_string (buttons[b]);
|
2008-02-29 15:41:07 -05:00
|
|
|
|
if (i > 0 && strcmp("spacer", buttons[b]) == 0)
|
2002-10-12 13:44:55 -04:00
|
|
|
|
{
|
2008-02-29 15:41:07 -05:00
|
|
|
|
new_layout.right_buttons_has_spacer[i-1] = TRUE;
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
|
f = button_opposite_function (f);
|
|
|
|
|
if (f != META_BUTTON_FUNCTION_LAST)
|
2008-02-29 15:41:07 -05:00
|
|
|
|
{
|
|
|
|
|
new_layout.right_buttons_has_spacer[i-2] = TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-10-12 13:44:55 -04:00
|
|
|
|
else
|
|
|
|
|
{
|
2008-02-29 15:41:07 -05:00
|
|
|
|
if (f != META_BUTTON_FUNCTION_LAST && !used[f])
|
|
|
|
|
{
|
|
|
|
|
new_layout.right_buttons[i] = f;
|
|
|
|
|
used[f] = TRUE;
|
|
|
|
|
++i;
|
|
|
|
|
|
|
|
|
|
f = button_opposite_function (f);
|
|
|
|
|
|
|
|
|
|
if (f != META_BUTTON_FUNCTION_LAST)
|
|
|
|
|
new_layout.right_buttons[i++] = f;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
meta_topic (META_DEBUG_PREFS, "Ignoring unknown or already-used button name \"%s\"\n",
|
|
|
|
|
buttons[b]);
|
|
|
|
|
}
|
2002-10-12 13:44:55 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
++b;
|
|
|
|
|
}
|
|
|
|
|
|
2007-07-22 02:39:29 -04:00
|
|
|
|
new_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST;
|
2008-02-29 15:41:07 -05:00
|
|
|
|
new_layout.right_buttons_has_spacer[i] = FALSE;
|
2007-07-22 02:39:29 -04:00
|
|
|
|
|
2002-10-12 13:44:55 -04:00
|
|
|
|
g_strfreev (buttons);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_strfreev (sides);
|
|
|
|
|
|
2007-07-22 02:39:29 -04:00
|
|
|
|
/* 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++)
|
2008-02-29 15:41:07 -05:00
|
|
|
|
{
|
|
|
|
|
rtl_layout.right_buttons[j] = new_layout.left_buttons[i - j - 1];
|
|
|
|
|
if (j == 0)
|
|
|
|
|
rtl_layout.right_buttons_has_spacer[i - 1] = new_layout.left_buttons_has_spacer[i - j - 1];
|
|
|
|
|
else
|
|
|
|
|
rtl_layout.right_buttons_has_spacer[j - 1] = new_layout.left_buttons_has_spacer[i - j - 1];
|
|
|
|
|
}
|
2007-07-22 02:39:29 -04:00
|
|
|
|
rtl_layout.right_buttons[j] = META_BUTTON_FUNCTION_LAST;
|
2008-02-29 15:41:07 -05:00
|
|
|
|
rtl_layout.right_buttons_has_spacer[j] = FALSE;
|
2007-07-22 02:39:29 -04:00
|
|
|
|
|
|
|
|
|
for (i = 0; new_layout.right_buttons[i] != META_BUTTON_FUNCTION_LAST; i++);
|
|
|
|
|
for (j = 0; j < i; j++)
|
2008-02-29 15:41:07 -05:00
|
|
|
|
{
|
|
|
|
|
rtl_layout.left_buttons[j] = new_layout.right_buttons[i - j - 1];
|
|
|
|
|
if (j == 0)
|
|
|
|
|
rtl_layout.left_buttons_has_spacer[i - 1] = new_layout.right_buttons_has_spacer[i - j - 1];
|
|
|
|
|
else
|
|
|
|
|
rtl_layout.left_buttons_has_spacer[j - 1] = new_layout.right_buttons_has_spacer[i - j - 1];
|
|
|
|
|
}
|
2007-07-22 02:39:29 -04:00
|
|
|
|
rtl_layout.left_buttons[j] = META_BUTTON_FUNCTION_LAST;
|
2008-02-29 15:41:07 -05:00
|
|
|
|
rtl_layout.left_buttons_has_spacer[j] = FALSE;
|
2007-07-22 02:39:29 -04:00
|
|
|
|
|
|
|
|
|
new_layout = rtl_layout;
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
|
if (button_layout_equal (&button_layout, &new_layout))
|
|
|
|
|
{
|
|
|
|
|
/* Same as before, so duck out */
|
|
|
|
|
*inform_listeners = FALSE;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
button_layout = new_layout;
|
|
|
|
|
}
|
2002-10-12 13:44:55 -04:00
|
|
|
|
}
|
2008-03-06 12:59:20 -05:00
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#endif /* HAVE_GCONF */
|
2002-10-12 13:44:55 -04:00
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
|
const PangoFontDescription*
|
|
|
|
|
meta_prefs_get_titlebar_font (void)
|
|
|
|
|
{
|
2002-05-23 22:55:54 -04:00
|
|
|
|
if (use_system_font)
|
2001-12-09 17:41:12 -05:00
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return titlebar_font;
|
|
|
|
|
}
|
|
|
|
|
|
2001-12-09 22:55:26 -05:00
|
|
|
|
int
|
|
|
|
|
meta_prefs_get_num_workspaces (void)
|
|
|
|
|
{
|
|
|
|
|
return num_workspaces;
|
|
|
|
|
}
|
|
|
|
|
|
2002-01-27 00:50:34 -05:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_application_based (void)
|
|
|
|
|
{
|
2002-12-08 14:17:17 -05:00
|
|
|
|
return FALSE; /* For now, we never want this to do anything */
|
|
|
|
|
|
2002-01-27 00:50:34 -05:00
|
|
|
|
return application_based;
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-30 23:23:46 -04:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_disable_workarounds (void)
|
|
|
|
|
{
|
|
|
|
|
return disable_workarounds;
|
|
|
|
|
}
|
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#ifdef HAVE_GCONF
|
2002-05-23 22:23:46 -04:00
|
|
|
|
#define MAX_REASONABLE_AUTO_RAISE_DELAY 10000
|
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#endif /* HAVE_GCONF */
|
2002-05-23 22:23:46 -04:00
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#ifdef WITH_VERBOSE_MODE
|
2001-12-09 17:41:12 -05:00
|
|
|
|
const char*
|
|
|
|
|
meta_preference_to_string (MetaPreference pref)
|
|
|
|
|
{
|
2008-03-06 12:59:20 -05:00
|
|
|
|
/* FIXME: another case for gconf_string_to_enum */
|
2001-12-09 17:41:12 -05:00
|
|
|
|
switch (pref)
|
|
|
|
|
{
|
2002-10-07 19:14:40 -04:00
|
|
|
|
case META_PREF_MOUSE_BUTTON_MODS:
|
|
|
|
|
return "MOUSE_BUTTON_MODS";
|
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
|
case META_PREF_FOCUS_MODE:
|
|
|
|
|
return "FOCUS_MODE";
|
|
|
|
|
|
2006-04-12 14:01:20 -04:00
|
|
|
|
case META_PREF_FOCUS_NEW_WINDOWS:
|
|
|
|
|
return "FOCUS_NEW_WINDOWS";
|
|
|
|
|
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 14:35:03 -05:00
|
|
|
|
case META_PREF_RAISE_ON_CLICK:
|
|
|
|
|
return "RAISE_ON_CLICK";
|
|
|
|
|
|
2002-02-06 22:07:56 -05:00
|
|
|
|
case META_PREF_THEME:
|
|
|
|
|
return "THEME";
|
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
|
case META_PREF_TITLEBAR_FONT:
|
|
|
|
|
return "TITLEBAR_FONT";
|
|
|
|
|
|
2001-12-09 22:55:26 -05:00
|
|
|
|
case META_PREF_NUM_WORKSPACES:
|
|
|
|
|
return "NUM_WORKSPACES";
|
2002-01-27 00:50:34 -05:00
|
|
|
|
|
|
|
|
|
case META_PREF_APPLICATION_BASED:
|
|
|
|
|
return "APPLICATION_BASED";
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
|
case META_PREF_KEYBINDINGS:
|
|
|
|
|
return "KEYBINDINGS";
|
2002-04-30 23:23:46 -04:00
|
|
|
|
|
|
|
|
|
case META_PREF_DISABLE_WORKAROUNDS:
|
|
|
|
|
return "DISABLE_WORKAROUNDS";
|
2002-05-23 22:23:46 -04:00
|
|
|
|
|
2002-10-18 17:22:27 -04:00
|
|
|
|
case META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR:
|
|
|
|
|
return "ACTION_DOUBLE_CLICK_TITLEBAR";
|
|
|
|
|
|
2007-04-24 23:30:17 -04:00
|
|
|
|
case META_PREF_ACTION_MIDDLE_CLICK_TITLEBAR:
|
|
|
|
|
return "ACTION_MIDDLE_CLICK_TITLEBAR";
|
|
|
|
|
|
|
|
|
|
case META_PREF_ACTION_RIGHT_CLICK_TITLEBAR:
|
|
|
|
|
return "ACTION_RIGHT_CLICK_TITLEBAR";
|
|
|
|
|
|
2002-05-23 22:23:46 -04:00
|
|
|
|
case META_PREF_AUTO_RAISE:
|
|
|
|
|
return "AUTO_RAISE";
|
|
|
|
|
|
|
|
|
|
case META_PREF_AUTO_RAISE_DELAY:
|
|
|
|
|
return "AUTO_RAISE_DELAY";
|
2002-07-11 00:10:44 -04:00
|
|
|
|
|
|
|
|
|
case META_PREF_COMMANDS:
|
|
|
|
|
return "COMMANDS";
|
2002-10-03 22:28:57 -04:00
|
|
|
|
|
2004-10-13 04:32:10 -04:00
|
|
|
|
case META_PREF_TERMINAL_COMMAND:
|
|
|
|
|
return "TERMINAL_COMMAND";
|
|
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
|
case META_PREF_BUTTON_LAYOUT:
|
|
|
|
|
return "BUTTON_LAYOUT";
|
2002-11-19 22:57:20 -05:00
|
|
|
|
|
|
|
|
|
case META_PREF_WORKSPACE_NAMES:
|
|
|
|
|
return "WORKSPACE_NAMES";
|
2003-01-28 10:07:43 -05:00
|
|
|
|
|
|
|
|
|
case META_PREF_VISUAL_BELL:
|
|
|
|
|
return "VISUAL_BELL";
|
|
|
|
|
|
|
|
|
|
case META_PREF_AUDIBLE_BELL:
|
|
|
|
|
return "AUDIBLE_BELL";
|
|
|
|
|
|
|
|
|
|
case META_PREF_VISUAL_BELL_TYPE:
|
|
|
|
|
return "VISUAL_BELL_TYPE";
|
2003-10-12 02:25:38 -04:00
|
|
|
|
|
|
|
|
|
case META_PREF_REDUCED_RESOURCES:
|
|
|
|
|
return "REDUCED_RESOURCES";
|
2006-01-20 17:03:56 -05:00
|
|
|
|
|
2005-01-26 03:43:38 -05:00
|
|
|
|
case META_PREF_GNOME_ACCESSIBILITY:
|
|
|
|
|
return "GNOME_ACCESSIBILTY";
|
2006-01-20 17:03:56 -05:00
|
|
|
|
|
2008-06-29 17:57:39 -04:00
|
|
|
|
case META_PREF_GNOME_ANIMATIONS:
|
|
|
|
|
return "GNOME_ANIMATIONS";
|
|
|
|
|
|
2005-10-25 12:43:01 -04:00
|
|
|
|
case META_PREF_CURSOR_THEME:
|
|
|
|
|
return "CURSOR_THEME";
|
2006-01-20 17:03:56 -05:00
|
|
|
|
|
2005-10-25 12:43:01 -04:00
|
|
|
|
case META_PREF_CURSOR_SIZE:
|
|
|
|
|
return "CURSOR_SIZE";
|
2006-02-16 15:26:05 -05:00
|
|
|
|
|
|
|
|
|
case META_PREF_COMPOSITING_MANAGER:
|
|
|
|
|
return "COMPOSITING_MANAGER";
|
2009-01-27 16:05:42 -05:00
|
|
|
|
|
|
|
|
|
case META_PREF_RESIZE_WITH_RIGHT_BUTTON:
|
|
|
|
|
return "RESIZE_WITH_RIGHT_BUTTON";
|
2009-05-07 17:56:27 -04:00
|
|
|
|
|
2008-09-18 11:09:11 -04:00
|
|
|
|
case META_PREF_CLUTTER_PLUGINS:
|
|
|
|
|
return "CLUTTER_PLUGINS";
|
2009-05-07 17:56:27 -04:00
|
|
|
|
|
2008-10-24 05:07:24 -04:00
|
|
|
|
case META_PREF_LIVE_HIDDEN_WINDOWS:
|
|
|
|
|
return "LIVE_HIDDEN_WINDOWS";
|
2009-05-07 17:56:27 -04:00
|
|
|
|
|
2009-02-02 09:09:04 -05:00
|
|
|
|
case META_PREF_NO_TAB_POPUP:
|
|
|
|
|
return "NO_TAB_POPUP";
|
2001-12-09 17:41:12 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "(unknown)";
|
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
2002-03-10 13:36:08 -05:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
meta_prefs_set_num_workspaces (int n_workspaces)
|
|
|
|
|
{
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#ifdef HAVE_GCONF
|
2002-03-10 13:36:08 -05:00
|
|
|
|
GError *err;
|
|
|
|
|
|
|
|
|
|
if (default_client == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (n_workspaces < 1)
|
|
|
|
|
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,
|
|
|
|
|
n_workspaces,
|
|
|
|
|
&err);
|
|
|
|
|
|
|
|
|
|
if (err)
|
|
|
|
|
{
|
|
|
|
|
meta_warning (_("Error setting number of workspaces to %d: %s\n"),
|
|
|
|
|
num_workspaces,
|
|
|
|
|
err->message);
|
|
|
|
|
g_error_free (err);
|
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#endif /* HAVE_GCONF */
|
2002-03-10 13:36:08 -05:00
|
|
|
|
}
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
2008-10-21 21:02:45 -04:00
|
|
|
|
#define keybind(name, handler, param, flags, stroke, description) \
|
2009-03-20 16:28:13 -04:00
|
|
|
|
{ #name, stroke, NULL, !!(flags & BINDING_REVERSES), !!(flags & BINDING_PER_WINDOW) },
|
2008-11-22 14:02:54 -05:00
|
|
|
|
static MetaKeyPref key_bindings[] = {
|
|
|
|
|
#include "all-keybindings.h"
|
2009-03-20 16:28:13 -04:00
|
|
|
|
{ NULL, NULL, NULL, FALSE }
|
2002-04-28 00:52:26 -04:00
|
|
|
|
};
|
2008-10-21 21:02:45 -04:00
|
|
|
|
#undef keybind
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
2008-12-02 18:13:11 -05:00
|
|
|
|
static MetaKeyCombo overlay_key_combo = { 0, 0, 0 };
|
|
|
|
|
|
|
|
|
|
/* These bindings are for modifiers alone, so they need special handling */
|
|
|
|
|
static void
|
|
|
|
|
init_special_bindings (void)
|
|
|
|
|
{
|
|
|
|
|
#ifdef HAVE_GCONF
|
|
|
|
|
char *val;
|
|
|
|
|
GError *err = NULL;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Default values for bindings which are global, but take special handling */
|
|
|
|
|
meta_ui_parse_accelerator ("Super_L", &overlay_key_combo.keysym,
|
|
|
|
|
&overlay_key_combo.keycode,
|
|
|
|
|
&overlay_key_combo.modifiers);
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_GCONF
|
|
|
|
|
val = gconf_client_get_string (default_client, KEY_OVERLAY_KEY, &err);
|
|
|
|
|
cleanup_error (&err);
|
|
|
|
|
|
|
|
|
|
if (val && meta_ui_parse_accelerator (val, &overlay_key_combo.keysym,
|
|
|
|
|
&overlay_key_combo.keycode,
|
|
|
|
|
&overlay_key_combo.modifiers))
|
|
|
|
|
;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
|
"Failed to parse value for overlay_key\n");
|
|
|
|
|
}
|
|
|
|
|
g_free (val);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
|
static void
|
|
|
|
|
init_bindings (void)
|
|
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
|
#ifdef HAVE_GCONF
|
|
|
|
|
int i = 0;
|
2002-04-28 00:52:26 -04:00
|
|
|
|
GError *err;
|
|
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
|
while (key_bindings[i].name)
|
2002-04-28 00:52:26 -04:00
|
|
|
|
{
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
GSList *list_val, *tmp;
|
2002-04-28 00:52:26 -04:00
|
|
|
|
char *str_val;
|
|
|
|
|
char *key;
|
2008-11-22 14:02:54 -05:00
|
|
|
|
|
|
|
|
|
key = g_strconcat (key_bindings[i].per_window?
|
|
|
|
|
KEY_WINDOW_BINDINGS_PREFIX:
|
|
|
|
|
KEY_SCREEN_BINDINGS_PREFIX,
|
|
|
|
|
"/",
|
|
|
|
|
key_bindings[i].name, NULL);
|
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
|
err = NULL;
|
|
|
|
|
str_val = gconf_client_get_string (default_client, key, &err);
|
|
|
|
|
cleanup_error (&err);
|
|
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
|
update_binding (&key_bindings[i], str_val);
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
|
|
|
|
g_free (str_val);
|
|
|
|
|
g_free (key);
|
|
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
|
key = g_strconcat (key_bindings[i].per_window?
|
|
|
|
|
KEY_WINDOW_BINDINGS_PREFIX:
|
|
|
|
|
KEY_SCREEN_BINDINGS_PREFIX,
|
|
|
|
|
"/",
|
|
|
|
|
key_bindings[i].name,
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
KEY_LIST_BINDINGS_SUFFIX, NULL);
|
|
|
|
|
|
|
|
|
|
err = NULL;
|
|
|
|
|
|
|
|
|
|
list_val = gconf_client_get_list (default_client, key, GCONF_VALUE_STRING, &err);
|
|
|
|
|
cleanup_error (&err);
|
2008-11-22 14:02:54 -05:00
|
|
|
|
|
|
|
|
|
update_list_binding (&key_bindings[i], list_val, META_LIST_OF_STRINGS);
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
|
|
|
|
|
tmp = list_val;
|
|
|
|
|
while (tmp)
|
|
|
|
|
{
|
|
|
|
|
g_free (tmp->data);
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
|
}
|
|
|
|
|
g_slist_free (list_val);
|
|
|
|
|
g_free (key);
|
|
|
|
|
|
Fix various initialization and default issues, especially for
2006-01-20 Elijah Newren <newren gmail com>
Fix various initialization and default issues, especially for
--disable-gconf. Make --disable-gconf actually work. #326661.
* configure.in: Fix compilation with --disable-gconf
* src/metacity.schemas.in: Add a note that if any defaults are
changed in this file, src/prefs.c may need to be updated to
reflect the change
* src/prefs.c: set various static global vars to the right default
value, (meta_prefs_init): get the titlebar_font and current_theme
handled better when not using gconf, (struct MetaSimpleKeyMapping,
screen_string_bindings, window_string_bindings): helper vars to
allow some keybindings to work even without gconf,
(init_bindings): initialize bindings for the without-gconf case
too, (init_commands): make sure these are all NULL for the
non-gconf case so that we don't access random memory,
(init_workspace_names): just give these all a default name for the
non-gconf case,
(meta_prefs_change_workspace_name): actually change the name for
the non-gconf case too
2006-01-20 17:42:25 -05:00
|
|
|
|
++i;
|
|
|
|
|
}
|
2008-12-02 18:13:11 -05:00
|
|
|
|
|
Fix various initialization and default issues, especially for
2006-01-20 Elijah Newren <newren gmail com>
Fix various initialization and default issues, especially for
--disable-gconf. Make --disable-gconf actually work. #326661.
* configure.in: Fix compilation with --disable-gconf
* src/metacity.schemas.in: Add a note that if any defaults are
changed in this file, src/prefs.c may need to be updated to
reflect the change
* src/prefs.c: set various static global vars to the right default
value, (meta_prefs_init): get the titlebar_font and current_theme
handled better when not using gconf, (struct MetaSimpleKeyMapping,
screen_string_bindings, window_string_bindings): helper vars to
allow some keybindings to work even without gconf,
(init_bindings): initialize bindings for the without-gconf case
too, (init_commands): make sure these are all NULL for the
non-gconf case so that we don't access random memory,
(init_workspace_names): just give these all a default name for the
non-gconf case,
(meta_prefs_change_workspace_name): actually change the name for
the non-gconf case too
2006-01-20 17:42:25 -05:00
|
|
|
|
#else /* HAVE_GCONF */
|
|
|
|
|
int i = 0;
|
2009-03-20 16:28:13 -04:00
|
|
|
|
while (key_bindings[i].name)
|
Fix various initialization and default issues, especially for
2006-01-20 Elijah Newren <newren gmail com>
Fix various initialization and default issues, especially for
--disable-gconf. Make --disable-gconf actually work. #326661.
* configure.in: Fix compilation with --disable-gconf
* src/metacity.schemas.in: Add a note that if any defaults are
changed in this file, src/prefs.c may need to be updated to
reflect the change
* src/prefs.c: set various static global vars to the right default
value, (meta_prefs_init): get the titlebar_font and current_theme
handled better when not using gconf, (struct MetaSimpleKeyMapping,
screen_string_bindings, window_string_bindings): helper vars to
allow some keybindings to work even without gconf,
(init_bindings): initialize bindings for the without-gconf case
too, (init_commands): make sure these are all NULL for the
non-gconf case so that we don't access random memory,
(init_workspace_names): just give these all a default name for the
non-gconf case,
(meta_prefs_change_workspace_name): actually change the name for
the non-gconf case too
2006-01-20 17:42:25 -05:00
|
|
|
|
{
|
2009-03-20 16:28:13 -04:00
|
|
|
|
if (key_bindings[i].default_keybinding)
|
|
|
|
|
{
|
|
|
|
|
/* Set the binding */
|
|
|
|
|
update_binding (&key_bindings[i], NULL);
|
|
|
|
|
}
|
Fix various initialization and default issues, especially for
2006-01-20 Elijah Newren <newren gmail com>
Fix various initialization and default issues, especially for
--disable-gconf. Make --disable-gconf actually work. #326661.
* configure.in: Fix compilation with --disable-gconf
* src/metacity.schemas.in: Add a note that if any defaults are
changed in this file, src/prefs.c may need to be updated to
reflect the change
* src/prefs.c: set various static global vars to the right default
value, (meta_prefs_init): get the titlebar_font and current_theme
handled better when not using gconf, (struct MetaSimpleKeyMapping,
screen_string_bindings, window_string_bindings): helper vars to
allow some keybindings to work even without gconf,
(init_bindings): initialize bindings for the without-gconf case
too, (init_commands): make sure these are all NULL for the
non-gconf case so that we don't access random memory,
(init_workspace_names): just give these all a default name for the
non-gconf case,
(meta_prefs_change_workspace_name): actually change the name for
the non-gconf case too
2006-01-20 17:42:25 -05:00
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
|
++i;
|
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#endif /* HAVE_GCONF */
|
2008-12-02 18:13:11 -05:00
|
|
|
|
|
|
|
|
|
init_special_bindings ();
|
2002-04-28 00:52:26 -04:00
|
|
|
|
}
|
|
|
|
|
|
2002-07-11 00:10:44 -04:00
|
|
|
|
static void
|
|
|
|
|
init_commands (void)
|
|
|
|
|
{
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#ifdef HAVE_GCONF
|
2002-07-11 00:10:44 -04:00
|
|
|
|
int i;
|
|
|
|
|
GError *err;
|
|
|
|
|
|
|
|
|
|
i = 0;
|
2002-11-03 14:06:39 -05:00
|
|
|
|
while (i < MAX_COMMANDS)
|
2002-07-11 00:10:44 -04:00
|
|
|
|
{
|
|
|
|
|
char *str_val;
|
|
|
|
|
char *key;
|
|
|
|
|
|
|
|
|
|
key = meta_prefs_get_gconf_key_for_command (i);
|
|
|
|
|
|
|
|
|
|
err = NULL;
|
|
|
|
|
str_val = gconf_client_get_string (default_client, key, &err);
|
|
|
|
|
cleanup_error (&err);
|
|
|
|
|
|
|
|
|
|
update_command (key, str_val);
|
|
|
|
|
|
|
|
|
|
g_free (str_val);
|
|
|
|
|
g_free (key);
|
|
|
|
|
|
|
|
|
|
++i;
|
|
|
|
|
}
|
Fix various initialization and default issues, especially for
2006-01-20 Elijah Newren <newren gmail com>
Fix various initialization and default issues, especially for
--disable-gconf. Make --disable-gconf actually work. #326661.
* configure.in: Fix compilation with --disable-gconf
* src/metacity.schemas.in: Add a note that if any defaults are
changed in this file, src/prefs.c may need to be updated to
reflect the change
* src/prefs.c: set various static global vars to the right default
value, (meta_prefs_init): get the titlebar_font and current_theme
handled better when not using gconf, (struct MetaSimpleKeyMapping,
screen_string_bindings, window_string_bindings): helper vars to
allow some keybindings to work even without gconf,
(init_bindings): initialize bindings for the without-gconf case
too, (init_commands): make sure these are all NULL for the
non-gconf case so that we don't access random memory,
(init_workspace_names): just give these all a default name for the
non-gconf case,
(meta_prefs_change_workspace_name): actually change the name for
the non-gconf case too
2006-01-20 17:42:25 -05:00
|
|
|
|
#else
|
|
|
|
|
int i;
|
|
|
|
|
for (i = 0; i < MAX_COMMANDS; i++)
|
|
|
|
|
commands[i] = NULL;
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#endif /* HAVE_GCONF */
|
2002-07-11 00:10:44 -04:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
|
static void
|
|
|
|
|
init_workspace_names (void)
|
|
|
|
|
{
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#ifdef HAVE_GCONF
|
2002-11-03 14:06:39 -05:00
|
|
|
|
int i;
|
|
|
|
|
GError *err;
|
|
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
|
while (i < MAX_REASONABLE_WORKSPACES)
|
|
|
|
|
{
|
|
|
|
|
char *str_val;
|
|
|
|
|
char *key;
|
|
|
|
|
|
|
|
|
|
key = gconf_key_for_workspace_name (i);
|
|
|
|
|
|
|
|
|
|
err = NULL;
|
|
|
|
|
str_val = gconf_client_get_string (default_client, key, &err);
|
|
|
|
|
cleanup_error (&err);
|
|
|
|
|
|
|
|
|
|
update_workspace_name (key, str_val);
|
|
|
|
|
|
2002-11-19 22:57:20 -05:00
|
|
|
|
g_assert (workspace_names[i] != NULL);
|
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
|
g_free (str_val);
|
|
|
|
|
g_free (key);
|
|
|
|
|
|
|
|
|
|
++i;
|
|
|
|
|
}
|
Fix various initialization and default issues, especially for
2006-01-20 Elijah Newren <newren gmail com>
Fix various initialization and default issues, especially for
--disable-gconf. Make --disable-gconf actually work. #326661.
* configure.in: Fix compilation with --disable-gconf
* src/metacity.schemas.in: Add a note that if any defaults are
changed in this file, src/prefs.c may need to be updated to
reflect the change
* src/prefs.c: set various static global vars to the right default
value, (meta_prefs_init): get the titlebar_font and current_theme
handled better when not using gconf, (struct MetaSimpleKeyMapping,
screen_string_bindings, window_string_bindings): helper vars to
allow some keybindings to work even without gconf,
(init_bindings): initialize bindings for the without-gconf case
too, (init_commands): make sure these are all NULL for the
non-gconf case so that we don't access random memory,
(init_workspace_names): just give these all a default name for the
non-gconf case,
(meta_prefs_change_workspace_name): actually change the name for
the non-gconf case too
2006-01-20 17:42:25 -05:00
|
|
|
|
#else
|
|
|
|
|
int i;
|
|
|
|
|
for (i = 0; i < MAX_REASONABLE_WORKSPACES; i++)
|
|
|
|
|
workspace_names[i] = g_strdup_printf (_("Workspace %d"), i + 1);
|
|
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
|
"Initialized workspace names\n");
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#endif /* HAVE_GCONF */
|
2002-11-03 14:06:39 -05:00
|
|
|
|
}
|
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
|
static gboolean
|
|
|
|
|
update_binding (MetaKeyPref *binding,
|
|
|
|
|
const char *value)
|
|
|
|
|
{
|
|
|
|
|
unsigned int keysym;
|
Patch from Ed Catmur to fix keybindings with hex-values (coming from
2006-08-21 Elijah Newren <newren gmail com>
Patch from Ed Catmur to fix keybindings with hex-values (coming
from special extended keyboard keys). #140448.
* src/keybindings.c (struct _MetaKeyBinding): change keycode from
KeyCode to unsigned int (comment from Elijah: why???),
(reload_keycodes): only grab keysyms for keybindings that have
them, (count_bindings, rebuild_binding_table): bindings can be
valid either due to a valid keysym or a valid keycode,
(display_get_keybinding_action, meta_change_keygrab,
process_tab_grab, process_workspace_switch_grab): handle keycode
as well as keysym
* src/prefs.[ch] (struct MetaKeyCombo, update_binding,
update_list_binding): handle keycode as well as keysym
* src/ui.[ch] (meta_ui_accelerator_parse): new function special
cases strings of the form "0x[0-9a-fA-F]+" and otherwise calling
gtk_accelerator_parse(), (meta_ui_parse_accelerator,
meta_ui_parse_modifier): call meta_ui_accelerator_parse instead of
gtk_accelerator_parse.
2006-08-21 15:06:26 -04:00
|
|
|
|
unsigned int keycode;
|
2002-07-13 23:16:41 -04:00
|
|
|
|
MetaVirtualModifier mods;
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
MetaKeyCombo *combo;
|
2002-04-28 00:52:26 -04:00
|
|
|
|
gboolean changed;
|
2008-11-22 14:02:54 -05:00
|
|
|
|
|
2009-03-20 16:28:13 -04:00
|
|
|
|
if (value == NULL)
|
|
|
|
|
value = binding->default_keybinding;
|
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
|
"Binding \"%s\" has new gconf value \"%s\"\n",
|
|
|
|
|
binding->name, value ? value : "none");
|
|
|
|
|
|
|
|
|
|
keysym = 0;
|
Patch from Ed Catmur to fix keybindings with hex-values (coming from
2006-08-21 Elijah Newren <newren gmail com>
Patch from Ed Catmur to fix keybindings with hex-values (coming
from special extended keyboard keys). #140448.
* src/keybindings.c (struct _MetaKeyBinding): change keycode from
KeyCode to unsigned int (comment from Elijah: why???),
(reload_keycodes): only grab keysyms for keybindings that have
them, (count_bindings, rebuild_binding_table): bindings can be
valid either due to a valid keysym or a valid keycode,
(display_get_keybinding_action, meta_change_keygrab,
process_tab_grab, process_workspace_switch_grab): handle keycode
as well as keysym
* src/prefs.[ch] (struct MetaKeyCombo, update_binding,
update_list_binding): handle keycode as well as keysym
* src/ui.[ch] (meta_ui_accelerator_parse): new function special
cases strings of the form "0x[0-9a-fA-F]+" and otherwise calling
gtk_accelerator_parse(), (meta_ui_parse_accelerator,
meta_ui_parse_modifier): call meta_ui_accelerator_parse instead of
gtk_accelerator_parse.
2006-08-21 15:06:26 -04:00
|
|
|
|
keycode = 0;
|
2002-07-13 23:16:41 -04:00
|
|
|
|
mods = 0;
|
2002-04-28 00:52:26 -04:00
|
|
|
|
if (value)
|
|
|
|
|
{
|
Patch from Ed Catmur to fix keybindings with hex-values (coming from
2006-08-21 Elijah Newren <newren gmail com>
Patch from Ed Catmur to fix keybindings with hex-values (coming
from special extended keyboard keys). #140448.
* src/keybindings.c (struct _MetaKeyBinding): change keycode from
KeyCode to unsigned int (comment from Elijah: why???),
(reload_keycodes): only grab keysyms for keybindings that have
them, (count_bindings, rebuild_binding_table): bindings can be
valid either due to a valid keysym or a valid keycode,
(display_get_keybinding_action, meta_change_keygrab,
process_tab_grab, process_workspace_switch_grab): handle keycode
as well as keysym
* src/prefs.[ch] (struct MetaKeyCombo, update_binding,
update_list_binding): handle keycode as well as keysym
* src/ui.[ch] (meta_ui_accelerator_parse): new function special
cases strings of the form "0x[0-9a-fA-F]+" and otherwise calling
gtk_accelerator_parse(), (meta_ui_parse_accelerator,
meta_ui_parse_modifier): call meta_ui_accelerator_parse instead of
gtk_accelerator_parse.
2006-08-21 15:06:26 -04:00
|
|
|
|
if (!meta_ui_parse_accelerator (value, &keysym, &keycode, &mods))
|
2002-04-28 00:52:26 -04:00
|
|
|
|
{
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
|
"Failed to parse new gconf value\n");
|
2002-10-07 19:14:40 -04:00
|
|
|
|
meta_warning (_("\"%s\" found in configuration database is not a valid value for keybinding \"%s\"\n"),
|
2002-04-28 00:52:26 -04:00
|
|
|
|
value, binding->name);
|
2006-02-27 17:44:47 -05:00
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
/* If there isn't already a first element, make one. */
|
|
|
|
|
if (!binding->bindings)
|
|
|
|
|
{
|
|
|
|
|
MetaKeyCombo *blank = g_malloc0 (sizeof (MetaKeyCombo));
|
|
|
|
|
binding->bindings = g_slist_alloc();
|
|
|
|
|
binding->bindings->data = blank;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
combo = binding->bindings->data;
|
|
|
|
|
|
2008-02-17 17:43:28 -05:00
|
|
|
|
#ifdef HAVE_GCONF
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
/* Bug 329676: Bindings which can be shifted must not have no modifiers,
|
2008-11-22 14:02:54 -05:00
|
|
|
|
* nor only SHIFT as a modifier.
|
|
|
|
|
*/
|
2006-02-27 17:44:47 -05:00
|
|
|
|
|
|
|
|
|
if (binding->add_shift &&
|
|
|
|
|
0 != keysym &&
|
|
|
|
|
(META_VIRTUAL_SHIFT_MASK == mods || 0 == mods))
|
|
|
|
|
{
|
|
|
|
|
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,
|
|
|
|
|
value);
|
|
|
|
|
|
2006-05-15 02:59:30 -04:00
|
|
|
|
old_setting = meta_ui_accelerator_name (combo->keysym,
|
|
|
|
|
combo->modifiers);
|
|
|
|
|
|
2006-02-27 17:44:47 -05:00
|
|
|
|
if (!strcmp(old_setting, value))
|
|
|
|
|
{
|
|
|
|
|
/* We were about to set it to the same value
|
|
|
|
|
* that it had originally! This must be caused
|
|
|
|
|
* by getting an invalid string back from
|
|
|
|
|
* meta_ui_accelerator_name. Bail out now
|
|
|
|
|
* so we don't get into an infinite loop.
|
|
|
|
|
*/
|
2006-05-15 02:59:30 -04:00
|
|
|
|
g_free (old_setting);
|
2006-02-27 17:44:47 -05:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
meta_warning ("Reverting \"%s\" to %s.\n",
|
|
|
|
|
binding->name,
|
|
|
|
|
old_setting);
|
|
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
|
/* FIXME: add_shift is currently screen_bindings only, but
|
|
|
|
|
* there's no really good reason it should always be.
|
|
|
|
|
* So we shouldn't blindly add KEY_SCREEN_BINDINGS_PREFIX
|
|
|
|
|
* onto here.
|
|
|
|
|
*/
|
2006-02-27 17:44:47 -05:00
|
|
|
|
key = g_strconcat (KEY_SCREEN_BINDINGS_PREFIX, "/",
|
|
|
|
|
binding->name, NULL);
|
|
|
|
|
|
|
|
|
|
gconf_client_set_string (gconf_client_get_default (),
|
|
|
|
|
key, old_setting, &err);
|
|
|
|
|
|
|
|
|
|
if (err)
|
|
|
|
|
{
|
|
|
|
|
meta_warning ("Error while reverting keybinding: %s\n",
|
|
|
|
|
err->message);
|
|
|
|
|
g_error_free (err);
|
|
|
|
|
err = NULL;
|
2002-04-28 00:52:26 -04:00
|
|
|
|
}
|
2006-02-27 17:44:47 -05:00
|
|
|
|
|
|
|
|
|
g_free (old_setting);
|
|
|
|
|
g_free (key);
|
|
|
|
|
|
|
|
|
|
/* The call to gconf_client_set_string() will cause this function
|
|
|
|
|
* to be called again with the new value, so there's no need to
|
|
|
|
|
* carry on.
|
|
|
|
|
*/
|
|
|
|
|
return TRUE;
|
2002-04-28 00:52:26 -04:00
|
|
|
|
}
|
2008-02-17 17:43:28 -05:00
|
|
|
|
#endif
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
|
|
|
|
changed = FALSE;
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
if (keysym != combo->keysym ||
|
Patch from Ed Catmur to fix keybindings with hex-values (coming from
2006-08-21 Elijah Newren <newren gmail com>
Patch from Ed Catmur to fix keybindings with hex-values (coming
from special extended keyboard keys). #140448.
* src/keybindings.c (struct _MetaKeyBinding): change keycode from
KeyCode to unsigned int (comment from Elijah: why???),
(reload_keycodes): only grab keysyms for keybindings that have
them, (count_bindings, rebuild_binding_table): bindings can be
valid either due to a valid keysym or a valid keycode,
(display_get_keybinding_action, meta_change_keygrab,
process_tab_grab, process_workspace_switch_grab): handle keycode
as well as keysym
* src/prefs.[ch] (struct MetaKeyCombo, update_binding,
update_list_binding): handle keycode as well as keysym
* src/ui.[ch] (meta_ui_accelerator_parse): new function special
cases strings of the form "0x[0-9a-fA-F]+" and otherwise calling
gtk_accelerator_parse(), (meta_ui_parse_accelerator,
meta_ui_parse_modifier): call meta_ui_accelerator_parse instead of
gtk_accelerator_parse.
2006-08-21 15:06:26 -04:00
|
|
|
|
keycode != combo->keycode ||
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
mods != combo->modifiers)
|
2002-04-28 00:52:26 -04:00
|
|
|
|
{
|
|
|
|
|
changed = TRUE;
|
|
|
|
|
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
combo->keysym = keysym;
|
Patch from Ed Catmur to fix keybindings with hex-values (coming from
2006-08-21 Elijah Newren <newren gmail com>
Patch from Ed Catmur to fix keybindings with hex-values (coming
from special extended keyboard keys). #140448.
* src/keybindings.c (struct _MetaKeyBinding): change keycode from
KeyCode to unsigned int (comment from Elijah: why???),
(reload_keycodes): only grab keysyms for keybindings that have
them, (count_bindings, rebuild_binding_table): bindings can be
valid either due to a valid keysym or a valid keycode,
(display_get_keybinding_action, meta_change_keygrab,
process_tab_grab, process_workspace_switch_grab): handle keycode
as well as keysym
* src/prefs.[ch] (struct MetaKeyCombo, update_binding,
update_list_binding): handle keycode as well as keysym
* src/ui.[ch] (meta_ui_accelerator_parse): new function special
cases strings of the form "0x[0-9a-fA-F]+" and otherwise calling
gtk_accelerator_parse(), (meta_ui_parse_accelerator,
meta_ui_parse_modifier): call meta_ui_accelerator_parse instead of
gtk_accelerator_parse.
2006-08-21 15:06:26 -04:00
|
|
|
|
combo->keycode = keycode;
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
combo->modifiers = mods;
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
Patch from Ed Catmur to fix keybindings with hex-values (coming from
2006-08-21 Elijah Newren <newren gmail com>
Patch from Ed Catmur to fix keybindings with hex-values (coming
from special extended keyboard keys). #140448.
* src/keybindings.c (struct _MetaKeyBinding): change keycode from
KeyCode to unsigned int (comment from Elijah: why???),
(reload_keycodes): only grab keysyms for keybindings that have
them, (count_bindings, rebuild_binding_table): bindings can be
valid either due to a valid keysym or a valid keycode,
(display_get_keybinding_action, meta_change_keygrab,
process_tab_grab, process_workspace_switch_grab): handle keycode
as well as keysym
* src/prefs.[ch] (struct MetaKeyCombo, update_binding,
update_list_binding): handle keycode as well as keysym
* src/ui.[ch] (meta_ui_accelerator_parse): new function special
cases strings of the form "0x[0-9a-fA-F]+" and otherwise calling
gtk_accelerator_parse(), (meta_ui_parse_accelerator,
meta_ui_parse_modifier): call meta_ui_accelerator_parse instead of
gtk_accelerator_parse.
2006-08-21 15:06:26 -04:00
|
|
|
|
"New keybinding for \"%s\" is keysym = 0x%x keycode = 0x%x mods = 0x%x\n",
|
|
|
|
|
binding->name, combo->keysym, combo->keycode,
|
|
|
|
|
combo->modifiers);
|
2002-04-28 00:52:26 -04:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
|
"Keybinding for \"%s\" is unchanged\n", binding->name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return changed;
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-23 01:16:03 -05:00
|
|
|
|
#ifdef HAVE_GCONF
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
static gboolean
|
|
|
|
|
update_list_binding (MetaKeyPref *binding,
|
|
|
|
|
GSList *value,
|
|
|
|
|
MetaStringListType type_of_value)
|
|
|
|
|
{
|
|
|
|
|
unsigned int keysym;
|
Patch from Ed Catmur to fix keybindings with hex-values (coming from
2006-08-21 Elijah Newren <newren gmail com>
Patch from Ed Catmur to fix keybindings with hex-values (coming
from special extended keyboard keys). #140448.
* src/keybindings.c (struct _MetaKeyBinding): change keycode from
KeyCode to unsigned int (comment from Elijah: why???),
(reload_keycodes): only grab keysyms for keybindings that have
them, (count_bindings, rebuild_binding_table): bindings can be
valid either due to a valid keysym or a valid keycode,
(display_get_keybinding_action, meta_change_keygrab,
process_tab_grab, process_workspace_switch_grab): handle keycode
as well as keysym
* src/prefs.[ch] (struct MetaKeyCombo, update_binding,
update_list_binding): handle keycode as well as keysym
* src/ui.[ch] (meta_ui_accelerator_parse): new function special
cases strings of the form "0x[0-9a-fA-F]+" and otherwise calling
gtk_accelerator_parse(), (meta_ui_parse_accelerator,
meta_ui_parse_modifier): call meta_ui_accelerator_parse instead of
gtk_accelerator_parse.
2006-08-21 15:06:26 -04:00
|
|
|
|
unsigned int keycode;
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
MetaVirtualModifier mods;
|
|
|
|
|
gboolean changed = FALSE;
|
|
|
|
|
const gchar *pref_string;
|
|
|
|
|
GSList *pref_iterator = value, *tmp;
|
|
|
|
|
MetaKeyCombo *combo;
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
* element is the one governed by update_binding. We only handle the
|
|
|
|
|
* subsequent elements.
|
|
|
|
|
*/
|
|
|
|
|
MetaKeyCombo *blank = g_malloc0 (sizeof (MetaKeyCombo));
|
|
|
|
|
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.
|
|
|
|
|
*/
|
|
|
|
|
tmp = binding->bindings->next;
|
|
|
|
|
while (tmp)
|
|
|
|
|
{
|
|
|
|
|
g_free (tmp->data);
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
|
}
|
|
|
|
|
g_slist_free (binding->bindings->next);
|
|
|
|
|
binding->bindings->next = NULL;
|
|
|
|
|
|
|
|
|
|
while (pref_iterator)
|
|
|
|
|
{
|
|
|
|
|
keysym = 0;
|
Patch from Ed Catmur to fix keybindings with hex-values (coming from
2006-08-21 Elijah Newren <newren gmail com>
Patch from Ed Catmur to fix keybindings with hex-values (coming
from special extended keyboard keys). #140448.
* src/keybindings.c (struct _MetaKeyBinding): change keycode from
KeyCode to unsigned int (comment from Elijah: why???),
(reload_keycodes): only grab keysyms for keybindings that have
them, (count_bindings, rebuild_binding_table): bindings can be
valid either due to a valid keysym or a valid keycode,
(display_get_keybinding_action, meta_change_keygrab,
process_tab_grab, process_workspace_switch_grab): handle keycode
as well as keysym
* src/prefs.[ch] (struct MetaKeyCombo, update_binding,
update_list_binding): handle keycode as well as keysym
* src/ui.[ch] (meta_ui_accelerator_parse): new function special
cases strings of the form "0x[0-9a-fA-F]+" and otherwise calling
gtk_accelerator_parse(), (meta_ui_parse_accelerator,
meta_ui_parse_modifier): call meta_ui_accelerator_parse instead of
gtk_accelerator_parse.
2006-08-21 15:06:26 -04:00
|
|
|
|
keycode = 0;
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
mods = 0;
|
|
|
|
|
|
|
|
|
|
if (!pref_iterator->data)
|
|
|
|
|
{
|
|
|
|
|
pref_iterator = pref_iterator->next;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (type_of_value)
|
|
|
|
|
{
|
|
|
|
|
case META_LIST_OF_STRINGS:
|
|
|
|
|
pref_string = pref_iterator->data;
|
|
|
|
|
break;
|
|
|
|
|
case META_LIST_OF_GCONFVALUE_STRINGS:
|
|
|
|
|
pref_string = gconf_value_get_string (pref_iterator->data);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
}
|
|
|
|
|
|
Patch from Ed Catmur to fix keybindings with hex-values (coming from
2006-08-21 Elijah Newren <newren gmail com>
Patch from Ed Catmur to fix keybindings with hex-values (coming
from special extended keyboard keys). #140448.
* src/keybindings.c (struct _MetaKeyBinding): change keycode from
KeyCode to unsigned int (comment from Elijah: why???),
(reload_keycodes): only grab keysyms for keybindings that have
them, (count_bindings, rebuild_binding_table): bindings can be
valid either due to a valid keysym or a valid keycode,
(display_get_keybinding_action, meta_change_keygrab,
process_tab_grab, process_workspace_switch_grab): handle keycode
as well as keysym
* src/prefs.[ch] (struct MetaKeyCombo, update_binding,
update_list_binding): handle keycode as well as keysym
* src/ui.[ch] (meta_ui_accelerator_parse): new function special
cases strings of the form "0x[0-9a-fA-F]+" and otherwise calling
gtk_accelerator_parse(), (meta_ui_parse_accelerator,
meta_ui_parse_modifier): call meta_ui_accelerator_parse instead of
gtk_accelerator_parse.
2006-08-21 15:06:26 -04:00
|
|
|
|
if (!meta_ui_parse_accelerator (pref_string, &keysym, &keycode, &mods))
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
{
|
|
|
|
|
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 keybinding \"%s\"\n"),
|
|
|
|
|
pref_string, binding->name);
|
|
|
|
|
|
|
|
|
|
/* Should we remove this value from the list in gconf? */
|
|
|
|
|
pref_iterator = pref_iterator->next;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Bug 329676: Bindings which can be shifted must not have no modifiers,
|
|
|
|
|
* nor only SHIFT as a modifier.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (binding->add_shift &&
|
|
|
|
|
0 != keysym &&
|
|
|
|
|
(META_VIRTUAL_SHIFT_MASK == mods || 0 == mods))
|
|
|
|
|
{
|
|
|
|
|
meta_warning ("Cannot bind \"%s\" to %s: it needs a modifier "
|
|
|
|
|
"such as Ctrl or Alt.\n",
|
|
|
|
|
binding->name,
|
|
|
|
|
pref_string);
|
|
|
|
|
|
|
|
|
|
/* Should we remove this value from the list in gconf? */
|
|
|
|
|
|
|
|
|
|
pref_iterator = pref_iterator->next;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
changed = TRUE;
|
|
|
|
|
|
|
|
|
|
combo = g_malloc0 (sizeof (MetaKeyCombo));
|
|
|
|
|
combo->keysym = keysym;
|
Patch from Ed Catmur to fix keybindings with hex-values (coming from
2006-08-21 Elijah Newren <newren gmail com>
Patch from Ed Catmur to fix keybindings with hex-values (coming
from special extended keyboard keys). #140448.
* src/keybindings.c (struct _MetaKeyBinding): change keycode from
KeyCode to unsigned int (comment from Elijah: why???),
(reload_keycodes): only grab keysyms for keybindings that have
them, (count_bindings, rebuild_binding_table): bindings can be
valid either due to a valid keysym or a valid keycode,
(display_get_keybinding_action, meta_change_keygrab,
process_tab_grab, process_workspace_switch_grab): handle keycode
as well as keysym
* src/prefs.[ch] (struct MetaKeyCombo, update_binding,
update_list_binding): handle keycode as well as keysym
* src/ui.[ch] (meta_ui_accelerator_parse): new function special
cases strings of the form "0x[0-9a-fA-F]+" and otherwise calling
gtk_accelerator_parse(), (meta_ui_parse_accelerator,
meta_ui_parse_modifier): call meta_ui_accelerator_parse instead of
gtk_accelerator_parse.
2006-08-21 15:06:26 -04:00
|
|
|
|
combo->keycode = keycode;
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
combo->modifiers = mods;
|
|
|
|
|
binding->bindings->next = g_slist_prepend (binding->bindings->next, combo);
|
|
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
Patch from Ed Catmur to fix keybindings with hex-values (coming from
2006-08-21 Elijah Newren <newren gmail com>
Patch from Ed Catmur to fix keybindings with hex-values (coming
from special extended keyboard keys). #140448.
* src/keybindings.c (struct _MetaKeyBinding): change keycode from
KeyCode to unsigned int (comment from Elijah: why???),
(reload_keycodes): only grab keysyms for keybindings that have
them, (count_bindings, rebuild_binding_table): bindings can be
valid either due to a valid keysym or a valid keycode,
(display_get_keybinding_action, meta_change_keygrab,
process_tab_grab, process_workspace_switch_grab): handle keycode
as well as keysym
* src/prefs.[ch] (struct MetaKeyCombo, update_binding,
update_list_binding): handle keycode as well as keysym
* src/ui.[ch] (meta_ui_accelerator_parse): new function special
cases strings of the form "0x[0-9a-fA-F]+" and otherwise calling
gtk_accelerator_parse(), (meta_ui_parse_accelerator,
meta_ui_parse_modifier): call meta_ui_accelerator_parse instead of
gtk_accelerator_parse.
2006-08-21 15:06:26 -04:00
|
|
|
|
"New keybinding for \"%s\" is keysym = 0x%x keycode = 0x%x mods = 0x%x\n",
|
|
|
|
|
binding->name, keysym, keycode, mods);
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
|
|
|
|
|
pref_iterator = pref_iterator->next;
|
|
|
|
|
}
|
|
|
|
|
return changed;
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
|
static const gchar*
|
|
|
|
|
relative_key (const gchar* key)
|
|
|
|
|
{
|
|
|
|
|
const gchar* end;
|
|
|
|
|
|
|
|
|
|
end = strrchr (key, '/');
|
|
|
|
|
|
|
|
|
|
++end;
|
|
|
|
|
|
|
|
|
|
return end;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return value is TRUE if a preference changed and we need to
|
|
|
|
|
* notify
|
|
|
|
|
*/
|
|
|
|
|
static gboolean
|
|
|
|
|
find_and_update_binding (MetaKeyPref *bindings,
|
|
|
|
|
const char *name,
|
|
|
|
|
const char *value)
|
|
|
|
|
{
|
|
|
|
|
const char *key;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (*name == '/')
|
|
|
|
|
key = relative_key (name);
|
|
|
|
|
else
|
|
|
|
|
key = name;
|
|
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
|
while (bindings[i].name &&
|
|
|
|
|
strcmp (key, bindings[i].name) != 0)
|
|
|
|
|
++i;
|
|
|
|
|
|
|
|
|
|
if (bindings[i].name)
|
|
|
|
|
return update_binding (&bindings[i], value);
|
|
|
|
|
else
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2008-11-22 14:02:54 -05:00
|
|
|
|
update_key_binding (const char *name,
|
2002-04-28 00:52:26 -04:00
|
|
|
|
const char *value)
|
|
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
|
return find_and_update_binding (key_bindings, name, value);
|
2002-04-28 00:52:26 -04:00
|
|
|
|
}
|
|
|
|
|
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
static gboolean
|
|
|
|
|
find_and_update_list_binding (MetaKeyPref *bindings,
|
|
|
|
|
const char *name,
|
|
|
|
|
GSList *value)
|
|
|
|
|
{
|
|
|
|
|
const char *key;
|
|
|
|
|
int i;
|
|
|
|
|
gchar *name_without_suffix = g_strdup(name);
|
|
|
|
|
|
|
|
|
|
name_without_suffix[strlen(name_without_suffix) - strlen(KEY_LIST_BINDINGS_SUFFIX)] = 0;
|
|
|
|
|
|
|
|
|
|
if (*name_without_suffix == '/')
|
|
|
|
|
key = relative_key (name_without_suffix);
|
|
|
|
|
else
|
|
|
|
|
key = name_without_suffix;
|
|
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
|
while (bindings[i].name &&
|
|
|
|
|
strcmp (key, bindings[i].name) != 0)
|
|
|
|
|
++i;
|
|
|
|
|
|
|
|
|
|
g_free (name_without_suffix);
|
|
|
|
|
|
|
|
|
|
if (bindings[i].name)
|
|
|
|
|
return update_list_binding (&bindings[i], value, META_LIST_OF_GCONFVALUE_STRINGS);
|
|
|
|
|
else
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2008-11-22 14:02:54 -05:00
|
|
|
|
update_key_list_binding (const char *name,
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
GSList *value)
|
|
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
|
return find_and_update_list_binding (key_bindings, name, value);
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
}
|
|
|
|
|
|
2002-07-11 00:10:44 -04:00
|
|
|
|
static gboolean
|
|
|
|
|
update_command (const char *name,
|
|
|
|
|
const char *value)
|
|
|
|
|
{
|
|
|
|
|
char *p;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
p = strrchr (name, '_');
|
|
|
|
|
if (p == NULL)
|
|
|
|
|
{
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
|
"Command %s has no underscore?\n", name);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
++p;
|
|
|
|
|
|
2003-02-23 21:16:09 -05:00
|
|
|
|
if (g_ascii_isdigit (*p))
|
2002-07-11 00:10:44 -04:00
|
|
|
|
{
|
2003-02-23 21:16:09 -05:00
|
|
|
|
i = atoi (p);
|
|
|
|
|
i -= 1; /* count from 0 not 1 */
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
p = strrchr (name, '/');
|
|
|
|
|
++p;
|
|
|
|
|
|
|
|
|
|
if (strcmp (p, "command_screenshot") == 0)
|
|
|
|
|
{
|
|
|
|
|
i = SCREENSHOT_COMMAND_IDX;
|
|
|
|
|
}
|
|
|
|
|
else if (strcmp (p, "command_window_screenshot") == 0)
|
|
|
|
|
{
|
|
|
|
|
i = WIN_SCREENSHOT_COMMAND_IDX;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
|
"Command %s doesn't end in number?\n", name);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2002-07-11 00:10:44 -04:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
|
if (i >= MAX_COMMANDS)
|
2002-07-11 00:10:44 -04:00
|
|
|
|
{
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
|
"Command %d is too highly numbered, ignoring\n", i);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
|
if ((commands[i] == NULL && value == NULL) ||
|
|
|
|
|
(commands[i] && value && strcmp (commands[i], value) == 0))
|
|
|
|
|
{
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
|
"Command %d is unchanged\n", i);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-11 00:10:44 -04:00
|
|
|
|
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;
|
|
|
|
|
}
|
2004-10-13 04:32:10 -04:00
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#endif /* HAVE_GCONF */
|
2002-07-11 00:10:44 -04:00
|
|
|
|
|
|
|
|
|
const char*
|
|
|
|
|
meta_prefs_get_command (int i)
|
|
|
|
|
{
|
2002-11-03 14:06:39 -05:00
|
|
|
|
g_return_val_if_fail (i >= 0 && i < MAX_COMMANDS, NULL);
|
2002-07-11 00:10:44 -04:00
|
|
|
|
|
|
|
|
|
return commands[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char*
|
|
|
|
|
meta_prefs_get_gconf_key_for_command (int i)
|
|
|
|
|
{
|
|
|
|
|
char *key;
|
2003-02-23 21:16:09 -05:00
|
|
|
|
|
|
|
|
|
switch (i)
|
|
|
|
|
{
|
|
|
|
|
case SCREENSHOT_COMMAND_IDX:
|
|
|
|
|
key = g_strdup (KEY_COMMAND_PREFIX "screenshot");
|
|
|
|
|
break;
|
|
|
|
|
case WIN_SCREENSHOT_COMMAND_IDX:
|
|
|
|
|
key = g_strdup (KEY_COMMAND_PREFIX "window_screenshot");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
key = g_strdup_printf (KEY_COMMAND_PREFIX"%d", i + 1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2002-07-11 00:10:44 -04:00
|
|
|
|
|
|
|
|
|
return key;
|
|
|
|
|
}
|
|
|
|
|
|
2004-10-13 04:32:10 -04:00
|
|
|
|
const char*
|
|
|
|
|
meta_prefs_get_terminal_command (void)
|
|
|
|
|
{
|
|
|
|
|
return terminal_command;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char*
|
|
|
|
|
meta_prefs_get_gconf_key_for_terminal_command (void)
|
|
|
|
|
{
|
|
|
|
|
return KEY_TERMINAL_COMMAND;
|
|
|
|
|
}
|
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#ifdef HAVE_GCONF
|
2002-11-03 14:06:39 -05:00
|
|
|
|
static gboolean
|
|
|
|
|
update_workspace_name (const char *name,
|
|
|
|
|
const char *value)
|
|
|
|
|
{
|
|
|
|
|
char *p;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
p = strrchr (name, '_');
|
|
|
|
|
if (p == NULL)
|
|
|
|
|
{
|
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
|
"Workspace name %s has no underscore?\n", name);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
++p;
|
|
|
|
|
|
|
|
|
|
if (!g_ascii_isdigit (*p))
|
|
|
|
|
{
|
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
|
"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,
|
|
|
|
|
"Workspace name %d is too highly numbered, ignoring\n", i);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-19 22:57:20 -05:00
|
|
|
|
if (workspace_names[i] && value && strcmp (workspace_names[i], value) == 0)
|
2002-11-03 14:06:39 -05:00
|
|
|
|
{
|
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
|
"Workspace name %d is unchanged\n", i);
|
|
|
|
|
return FALSE;
|
2002-11-19 22:57:20 -05:00
|
|
|
|
}
|
|
|
|
|
|
2002-12-08 09:59:14 -05:00
|
|
|
|
/* This is a bad hack. We have to treat empty string as
|
|
|
|
|
* "unset" because the root window property can't contain
|
|
|
|
|
* null. So it gets empty string instead and we don't want
|
|
|
|
|
* that to result in setting the empty string as a value that
|
|
|
|
|
* overrides "unset".
|
|
|
|
|
*/
|
|
|
|
|
if (value != NULL && *value != '\0')
|
2002-11-19 22:57:20 -05:00
|
|
|
|
{
|
|
|
|
|
g_free (workspace_names[i]);
|
|
|
|
|
workspace_names[i] = g_strdup (value);
|
|
|
|
|
}
|
2002-11-03 14:06:39 -05:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* use a default name */
|
|
|
|
|
char *d;
|
2002-11-19 22:57:20 -05:00
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
|
d = g_strdup_printf (_("Workspace %d"), i + 1);
|
|
|
|
|
if (workspace_names[i] && strcmp (workspace_names[i], d) == 0)
|
|
|
|
|
{
|
|
|
|
|
g_free (d);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2002-11-19 22:57:20 -05:00
|
|
|
|
g_free (workspace_names[i]);
|
2002-11-03 14:06:39 -05:00
|
|
|
|
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;
|
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#endif /* HAVE_GCONF */
|
2002-11-03 14:06:39 -05:00
|
|
|
|
|
|
|
|
|
const char*
|
|
|
|
|
meta_prefs_get_workspace_name (int i)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (i >= 0 && i < MAX_REASONABLE_WORKSPACES, NULL);
|
2002-11-19 22:57:20 -05:00
|
|
|
|
|
|
|
|
|
g_assert (workspace_names[i] != NULL);
|
2002-11-19 23:54:01 -05:00
|
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
|
"Getting workspace name for %d: \"%s\"\n",
|
|
|
|
|
i, workspace_names[i]);
|
2002-11-03 14:06:39 -05:00
|
|
|
|
|
|
|
|
|
return workspace_names[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
meta_prefs_change_workspace_name (int i,
|
|
|
|
|
const char *name)
|
|
|
|
|
{
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#ifdef HAVE_GCONF
|
2002-11-03 14:06:39 -05:00
|
|
|
|
char *key;
|
|
|
|
|
GError *err;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (i >= 0 && i < MAX_REASONABLE_WORKSPACES);
|
|
|
|
|
|
2002-11-19 23:54:01 -05:00
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
|
"Changing name of workspace %d to %s\n",
|
|
|
|
|
i, name ? name : "none");
|
|
|
|
|
|
|
|
|
|
/* This is a bad hack. We have to treat empty string as
|
|
|
|
|
* "unset" because the root window property can't contain
|
|
|
|
|
* null. So it gets empty string instead and we don't want
|
|
|
|
|
* that to result in setting the empty string as a value that
|
|
|
|
|
* overrides "unset".
|
|
|
|
|
*/
|
|
|
|
|
if (name && *name == '\0')
|
|
|
|
|
name = NULL;
|
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
|
if ((name == NULL && workspace_names[i] == NULL) ||
|
|
|
|
|
(name && workspace_names[i] && strcmp (name, workspace_names[i]) == 0))
|
|
|
|
|
{
|
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
|
"Workspace %d already has name %s\n",
|
|
|
|
|
i, name ? name : "none");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
key = gconf_key_for_workspace_name (i);
|
|
|
|
|
|
|
|
|
|
err = NULL;
|
2002-12-15 13:51:29 -05:00
|
|
|
|
if (name != NULL)
|
|
|
|
|
gconf_client_set_string (default_client,
|
|
|
|
|
key, name,
|
|
|
|
|
&err);
|
|
|
|
|
else
|
|
|
|
|
gconf_client_unset (default_client,
|
|
|
|
|
key, &err);
|
2002-11-03 14:06:39 -05:00
|
|
|
|
|
2002-12-15 13:51:29 -05:00
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
|
if (err)
|
|
|
|
|
{
|
|
|
|
|
meta_warning (_("Error setting name for workspace %d to \"%s\": %s\n"),
|
|
|
|
|
i, name ? name : "none",
|
|
|
|
|
err->message);
|
|
|
|
|
g_error_free (err);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_free (key);
|
Fix various initialization and default issues, especially for
2006-01-20 Elijah Newren <newren gmail com>
Fix various initialization and default issues, especially for
--disable-gconf. Make --disable-gconf actually work. #326661.
* configure.in: Fix compilation with --disable-gconf
* src/metacity.schemas.in: Add a note that if any defaults are
changed in this file, src/prefs.c may need to be updated to
reflect the change
* src/prefs.c: set various static global vars to the right default
value, (meta_prefs_init): get the titlebar_font and current_theme
handled better when not using gconf, (struct MetaSimpleKeyMapping,
screen_string_bindings, window_string_bindings): helper vars to
allow some keybindings to work even without gconf,
(init_bindings): initialize bindings for the without-gconf case
too, (init_commands): make sure these are all NULL for the
non-gconf case so that we don't access random memory,
(init_workspace_names): just give these all a default name for the
non-gconf case,
(meta_prefs_change_workspace_name): actually change the name for
the non-gconf case too
2006-01-20 17:42:25 -05:00
|
|
|
|
#else
|
|
|
|
|
g_free (workspace_names[i]);
|
|
|
|
|
workspace_names[i] = g_strdup (name);
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#endif /* HAVE_GCONF */
|
2002-11-03 14:06:39 -05:00
|
|
|
|
}
|
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#ifdef HAVE_GCONF
|
2002-11-03 14:06:39 -05:00
|
|
|
|
static char*
|
|
|
|
|
gconf_key_for_workspace_name (int i)
|
|
|
|
|
{
|
|
|
|
|
char *key;
|
|
|
|
|
|
|
|
|
|
key = g_strdup_printf (KEY_WORKSPACE_NAME_PREFIX"%d", i + 1);
|
|
|
|
|
|
|
|
|
|
return key;
|
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
|
#endif /* HAVE_GCONF */
|
2002-11-03 14:06:39 -05:00
|
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
|
void
|
2002-10-12 13:44:55 -04:00
|
|
|
|
meta_prefs_get_button_layout (MetaButtonLayout *button_layout_p)
|
2002-10-03 22:28:57 -04:00
|
|
|
|
{
|
2002-10-12 13:44:55 -04:00
|
|
|
|
*button_layout_p = button_layout;
|
2002-10-03 22:28:57 -04:00
|
|
|
|
}
|
|
|
|
|
|
2003-01-28 10:07:43 -05:00
|
|
|
|
gboolean
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 19:18:22 -04:00
|
|
|
|
meta_prefs_get_visual_bell (void)
|
2003-01-28 10:07:43 -05:00
|
|
|
|
{
|
|
|
|
|
return provide_visual_bell;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gboolean
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 19:18:22 -04:00
|
|
|
|
meta_prefs_bell_is_audible (void)
|
2003-01-28 10:07:43 -05:00
|
|
|
|
{
|
|
|
|
|
return bell_is_audible;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MetaVisualBellType
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 19:18:22 -04:00
|
|
|
|
meta_prefs_get_visual_bell_type (void)
|
2003-01-28 10:07:43 -05:00
|
|
|
|
{
|
|
|
|
|
return visual_bell_type;
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
|
void
|
2008-11-22 14:02:54 -05:00
|
|
|
|
meta_prefs_get_key_bindings (const MetaKeyPref **bindings,
|
2002-04-28 00:52:26 -04:00
|
|
|
|
int *n_bindings)
|
|
|
|
|
{
|
|
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
|
*bindings = key_bindings;
|
|
|
|
|
*n_bindings = (int) G_N_ELEMENTS (key_bindings) - 1;
|
2002-04-28 00:52:26 -04:00
|
|
|
|
}
|
2002-10-18 17:22:27 -04:00
|
|
|
|
|
2008-12-02 18:13:11 -05:00
|
|
|
|
void
|
|
|
|
|
meta_prefs_get_overlay_binding (MetaKeyCombo *combo)
|
|
|
|
|
{
|
|
|
|
|
*combo = overlay_key_combo;
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-17 16:34:00 -05:00
|
|
|
|
MetaActionTitlebar
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 19:18:22 -04:00
|
|
|
|
meta_prefs_get_action_double_click_titlebar (void)
|
2002-10-18 17:22:27 -04:00
|
|
|
|
{
|
|
|
|
|
return action_double_click_titlebar;
|
|
|
|
|
}
|
2002-04-28 00:52:26 -04:00
|
|
|
|
|
2007-03-09 20:15:14 -05:00
|
|
|
|
MetaActionTitlebar
|
|
|
|
|
meta_prefs_get_action_middle_click_titlebar (void)
|
|
|
|
|
{
|
|
|
|
|
return action_middle_click_titlebar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MetaActionTitlebar
|
|
|
|
|
meta_prefs_get_action_right_click_titlebar (void)
|
|
|
|
|
{
|
|
|
|
|
return action_right_click_titlebar;
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-23 22:23:46 -04:00
|
|
|
|
gboolean
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 19:18:22 -04:00
|
|
|
|
meta_prefs_get_auto_raise (void)
|
2002-05-23 22:23:46 -04:00
|
|
|
|
{
|
|
|
|
|
return auto_raise;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 19:18:22 -04:00
|
|
|
|
meta_prefs_get_auto_raise_delay (void)
|
2002-05-23 22:23:46 -04:00
|
|
|
|
{
|
|
|
|
|
return auto_raise_delay;
|
|
|
|
|
}
|
2002-06-08 23:44:16 -04:00
|
|
|
|
|
2003-10-12 02:25:38 -04:00
|
|
|
|
gboolean
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 19:18:22 -04:00
|
|
|
|
meta_prefs_get_reduced_resources (void)
|
2003-10-12 02:25:38 -04:00
|
|
|
|
{
|
|
|
|
|
return reduced_resources;
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-26 03:43:38 -05:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_gnome_accessibility ()
|
|
|
|
|
{
|
|
|
|
|
return gnome_accessibility;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-29 17:57:39 -04:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_gnome_animations ()
|
|
|
|
|
{
|
|
|
|
|
return gnome_animations;
|
|
|
|
|
}
|
|
|
|
|
|
2002-06-08 23:44:16 -04:00
|
|
|
|
MetaKeyBindingAction
|
2002-07-13 23:16:41 -04:00
|
|
|
|
meta_prefs_get_keybinding_action (const char *name)
|
2002-06-08 23:44:16 -04:00
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
|
i = G_N_ELEMENTS (key_bindings) - 2; /* -2 for dummy entry at end */
|
2002-06-09 00:04:19 -04:00
|
|
|
|
while (i >= 0)
|
2002-06-08 23:44:16 -04:00
|
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
|
if (strcmp (key_bindings[i].name, name) == 0)
|
2002-06-08 23:44:16 -04:00
|
|
|
|
return (MetaKeyBindingAction) i;
|
2002-06-09 00:04:19 -04:00
|
|
|
|
|
|
|
|
|
--i;
|
2002-06-08 23:44:16 -04:00
|
|
|
|
}
|
2002-06-09 00:04:19 -04:00
|
|
|
|
|
2002-06-08 23:44:16 -04:00
|
|
|
|
return META_KEYBINDING_ACTION_NONE;
|
|
|
|
|
}
|
|
|
|
|
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
/* This is used by the menu system to decide what key binding
|
|
|
|
|
* to display next to an option. We return the first non-disabled
|
|
|
|
|
* binding, if any.
|
|
|
|
|
*/
|
2002-09-26 21:40:17 -04:00
|
|
|
|
void
|
|
|
|
|
meta_prefs_get_window_binding (const char *name,
|
|
|
|
|
unsigned int *keysym,
|
|
|
|
|
MetaVirtualModifier *modifiers)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
|
i = G_N_ELEMENTS (key_bindings) - 2; /* -2 for dummy entry at end */
|
2002-09-26 21:40:17 -04:00
|
|
|
|
while (i >= 0)
|
|
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
|
if (key_bindings[i].per_window &&
|
|
|
|
|
strcmp (key_bindings[i].name, name) == 0)
|
2002-09-26 21:40:17 -04:00
|
|
|
|
{
|
2008-11-22 14:02:54 -05:00
|
|
|
|
GSList *s = key_bindings[i].bindings;
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
|
|
|
|
|
while (s)
|
|
|
|
|
{
|
|
|
|
|
MetaKeyCombo *c = s->data;
|
|
|
|
|
|
|
|
|
|
if (c->keysym!=0 || c->modifiers!=0)
|
|
|
|
|
{
|
|
|
|
|
*keysym = c->keysym;
|
|
|
|
|
*modifiers = c->modifiers;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
s = s->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Not found; return the disabled value */
|
|
|
|
|
*keysym = *modifiers = 0;
|
2002-09-26 21:40:17 -04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
--i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
}
|
2006-02-16 15:26:05 -05:00
|
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_compositing_manager (void)
|
|
|
|
|
{
|
|
|
|
|
return compositing_manager;
|
|
|
|
|
}
|
2007-07-22 02:39:29 -04:00
|
|
|
|
|
2009-01-27 16:05:42 -05:00
|
|
|
|
guint
|
|
|
|
|
meta_prefs_get_mouse_button_resize (void)
|
|
|
|
|
{
|
|
|
|
|
return resize_with_right_button ? 3: 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
guint
|
|
|
|
|
meta_prefs_get_mouse_button_menu (void)
|
|
|
|
|
{
|
|
|
|
|
return resize_with_right_button ? 2: 3;
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-31 18:55:18 -04:00
|
|
|
|
void
|
|
|
|
|
meta_prefs_set_compositing_manager (gboolean whether)
|
|
|
|
|
{
|
2008-09-06 18:01:56 -04:00
|
|
|
|
#ifdef HAVE_GCONF
|
2008-08-31 18:55:18 -04:00
|
|
|
|
GError *err = NULL;
|
|
|
|
|
|
|
|
|
|
gconf_client_set_bool (default_client,
|
|
|
|
|
KEY_COMPOSITOR,
|
|
|
|
|
whether,
|
|
|
|
|
&err);
|
|
|
|
|
|
|
|
|
|
if (err)
|
|
|
|
|
{
|
|
|
|
|
meta_warning (_("Error setting compositor status: %s\n"),
|
|
|
|
|
err->message);
|
|
|
|
|
g_error_free (err);
|
|
|
|
|
}
|
2008-09-06 18:01:56 -04:00
|
|
|
|
#else
|
|
|
|
|
compositing_manager = whether;
|
|
|
|
|
#endif
|
2008-08-31 18:55:18 -04:00
|
|
|
|
}
|
|
|
|
|
|
2008-09-18 11:09:11 -04:00
|
|
|
|
GSList *
|
|
|
|
|
meta_prefs_get_clutter_plugins (void)
|
|
|
|
|
{
|
|
|
|
|
return clutter_plugins;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
meta_prefs_set_clutter_plugins (GSList *list)
|
|
|
|
|
{
|
|
|
|
|
GError *err = NULL;
|
|
|
|
|
|
|
|
|
|
gconf_client_set_list (default_client,
|
|
|
|
|
KEY_CLUTTER_PLUGINS,
|
|
|
|
|
GCONF_VALUE_STRING,
|
|
|
|
|
list,
|
|
|
|
|
&err);
|
|
|
|
|
|
|
|
|
|
if (err)
|
|
|
|
|
{
|
|
|
|
|
meta_warning (_("Error setting clutter plugin list: %s\n"),
|
|
|
|
|
err->message);
|
|
|
|
|
g_error_free (err);
|
|
|
|
|
}
|
|
|
|
|
}
|
2008-10-31 08:33:37 -04:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
meta_prefs_override_clutter_plugins (GSList *list)
|
|
|
|
|
{
|
|
|
|
|
GSList *l;
|
|
|
|
|
|
|
|
|
|
clutter_plugins_overridden = TRUE;
|
|
|
|
|
clutter_plugins = NULL;
|
|
|
|
|
|
|
|
|
|
for (l = list; l; l = l->next)
|
|
|
|
|
clutter_plugins = g_slist_prepend (clutter_plugins, g_strdup(l->data));
|
|
|
|
|
|
|
|
|
|
clutter_plugins = g_slist_reverse (clutter_plugins);
|
|
|
|
|
}
|
2008-09-18 11:09:11 -04:00
|
|
|
|
|
2008-10-24 05:07:24 -04:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_live_hidden_windows (void)
|
|
|
|
|
{
|
2008-10-27 08:29:49 -04:00
|
|
|
|
#if 0
|
2008-10-24 05:07:24 -04:00
|
|
|
|
return live_hidden_windows;
|
2008-10-27 08:29:49 -04:00
|
|
|
|
#else
|
|
|
|
|
return TRUE;
|
|
|
|
|
#endif
|
2008-10-24 05:07:24 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
meta_prefs_set_live_hidden_windows (gboolean whether)
|
|
|
|
|
{
|
|
|
|
|
#ifdef HAVE_GCONF
|
|
|
|
|
GError *err = NULL;
|
|
|
|
|
|
|
|
|
|
gconf_client_set_bool (default_client,
|
|
|
|
|
KEY_LIVE_HIDDEN_WINDOWS,
|
|
|
|
|
whether,
|
|
|
|
|
&err);
|
|
|
|
|
|
|
|
|
|
if (err)
|
|
|
|
|
{
|
|
|
|
|
meta_warning (_("Error setting live hidden windows status status: %s\n"),
|
|
|
|
|
err->message);
|
|
|
|
|
g_error_free (err);
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
live_hidden_windows = whether;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-02 09:09:04 -05:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_no_tab_popup (void)
|
|
|
|
|
{
|
|
|
|
|
return no_tab_popup;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
meta_prefs_set_no_tab_popup (gboolean whether)
|
|
|
|
|
{
|
|
|
|
|
#ifdef HAVE_GCONF
|
|
|
|
|
GError *err = NULL;
|
|
|
|
|
|
|
|
|
|
gconf_client_set_bool (default_client,
|
|
|
|
|
KEY_NO_TAB_POPUP,
|
|
|
|
|
whether,
|
|
|
|
|
&err);
|
|
|
|
|
|
|
|
|
|
if (err)
|
|
|
|
|
{
|
|
|
|
|
meta_warning (_("Error setting no tab popup status: %s\n"),
|
|
|
|
|
err->message);
|
|
|
|
|
g_error_free (err);
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
no_tab_popup = whether;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
meta_prefs_override_no_tab_popup (gboolean whether)
|
|
|
|
|
{
|
|
|
|
|
no_tab_popup = whether;
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-23 16:02:05 -05:00
|
|
|
|
#ifndef HAVE_GCONF
|
2007-07-22 02:39:29 -04:00
|
|
|
|
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
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
/* buttons in the group on the right side */
|
|
|
|
|
META_BUTTON_FUNCTION_MINIMIZE,
|
|
|
|
|
META_BUTTON_FUNCTION_MAXIMIZE,
|
|
|
|
|
META_BUTTON_FUNCTION_CLOSE,
|
|
|
|
|
META_BUTTON_FUNCTION_LAST
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
MetaButtonLayout button_layout_rtl = {
|
|
|
|
|
{
|
|
|
|
|
/* buttons in the group on the left side */
|
|
|
|
|
META_BUTTON_FUNCTION_CLOSE,
|
|
|
|
|
META_BUTTON_FUNCTION_MAXIMIZE,
|
|
|
|
|
META_BUTTON_FUNCTION_MINIMIZE,
|
|
|
|
|
META_BUTTON_FUNCTION_LAST
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
/* buttons in the group on the right side */
|
|
|
|
|
META_BUTTON_FUNCTION_MENU,
|
|
|
|
|
META_BUTTON_FUNCTION_LAST
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
button_layout = meta_ui_get_direction() == META_UI_DIRECTION_LTR ?
|
|
|
|
|
button_layout_ltr : button_layout_rtl;
|
|
|
|
|
};
|
2008-02-23 16:02:05 -05:00
|
|
|
|
|
|
|
|
|
#endif
|