2006-10-01 22:30:10 +00:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
/*
|
2002-07-06 16:50:48 +00:00
|
|
|
* Copyright (C) 2001 Havoc Pennington, Copyright (C) 2002 Red Hat Inc.
|
2006-01-10 19:43:21 +00:00
|
|
|
* Copyright (C) 2006 Elijah Newren
|
2008-06-13 23:10:32 +00:00
|
|
|
* Copyright (C) 2008 Thomas Thurman
|
2011-06-24 16:14:15 +00:00
|
|
|
* Copyright (C) 2010 Milan Bouchet-Valat, Copyright (C) 2011 Red Hat Inc.
|
|
|
|
*
|
2001-12-09 22:41:12 +00: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.
|
2014-05-02 13:34:02 +00:00
|
|
|
*
|
2001-12-09 22:41:12 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-01-12 01:42:06 +00:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2001-12-09 22:41:12 +00:00
|
|
|
*/
|
|
|
|
|
2013-03-11 15:52:36 +00:00
|
|
|
/**
|
|
|
|
* SECTION:prefs
|
|
|
|
* @title: Preferences
|
|
|
|
* @short_description: Mutter preferences
|
|
|
|
*/
|
|
|
|
|
2018-07-10 08:36:24 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
#include <glib.h>
|
|
|
|
#include <gio/gio.h>
|
2001-12-09 22:41:12 +00:00
|
|
|
#include <string.h>
|
2002-07-11 04:10:44 +00:00
|
|
|
#include <stdlib.h>
|
2018-07-10 08:36:24 +00:00
|
|
|
|
|
|
|
#include "compositor/meta-plugin-manager.h"
|
|
|
|
#include "core/keybindings-private.h"
|
|
|
|
#include "core/meta-accel-parse.h"
|
|
|
|
#include "core/util-private.h"
|
|
|
|
#include "meta/prefs.h"
|
2018-07-06 17:22:26 +00:00
|
|
|
#include "x11/meta-x11-display-private.h"
|
2001-12-09 22:41:12 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
/* If you add a key, it needs updating in init() and in the gsettings
|
2008-02-23 06:16:03 +00: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 22:41:12 +00:00
|
|
|
*/
|
2011-06-24 16:14:15 +00:00
|
|
|
#define KEY_TITLEBAR_FONT "titlebar-font"
|
|
|
|
#define KEY_NUM_WORKSPACES "num-workspaces"
|
|
|
|
#define KEY_WORKSPACE_NAMES "workspace-names"
|
2004-10-13 08:32:10 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
/* Keys from "foreign" schemas */
|
|
|
|
#define KEY_GNOME_ACCESSIBILITY "toolkit-accessibility"
|
|
|
|
#define KEY_GNOME_ANIMATIONS "enable-animations"
|
|
|
|
#define KEY_GNOME_CURSOR_THEME "cursor-theme"
|
2018-07-06 17:22:26 +00:00
|
|
|
#define KEY_GNOME_CURSOR_SIZE "cursor-size"
|
2013-04-10 09:57:16 +00:00
|
|
|
#define KEY_XKB_OPTIONS "xkb-options"
|
2004-10-13 08:32:10 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
#define KEY_OVERLAY_KEY "overlay-key"
|
|
|
|
#define KEY_WORKSPACES_ONLY_ON_PRIMARY "workspaces-only-on-primary"
|
2019-07-15 11:13:45 +00:00
|
|
|
#define KEY_LOCATE_POINTER "locate-pointer"
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
/* These are the different schemas we are keeping
|
|
|
|
* a GSettings instance for */
|
|
|
|
#define SCHEMA_GENERAL "org.gnome.desktop.wm.preferences"
|
|
|
|
#define SCHEMA_MUTTER "org.gnome.mutter"
|
|
|
|
#define SCHEMA_INTERFACE "org.gnome.desktop.interface"
|
2013-04-10 09:57:16 +00:00
|
|
|
#define SCHEMA_INPUT_SOURCES "org.gnome.desktop.input-sources"
|
2014-05-23 21:14:51 +00:00
|
|
|
#define SCHEMA_XSETTINGS "org.gnome.settings-daemon.plugins.xsettings"
|
2014-08-15 22:21:13 +00:00
|
|
|
#define SCHEMA_MOUSE "org.gnome.settings-daemon.peripherals.mouse"
|
2002-11-03 19:06:39 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
#define SETTINGS(s) g_hash_table_lookup (settings_schemas, (s))
|
2009-02-02 14:09:04 +00:00
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
static GList *changes = NULL;
|
|
|
|
static guint changed_idle;
|
2002-12-08 19:17:17 +00:00
|
|
|
static GList *listeners = NULL;
|
2011-06-24 16:14:15 +00:00
|
|
|
static GHashTable *settings_schemas;
|
2002-12-08 19:17:17 +00: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 22:42:25 +00:00
|
|
|
static gboolean use_system_font = FALSE;
|
2001-12-09 22:41:12 +00:00
|
|
|
static PangoFontDescription *titlebar_font = NULL;
|
2002-10-07 23:14:40 +00:00
|
|
|
static MetaVirtualModifier mouse_button_mods = Mod1Mask;
|
2012-08-10 21:22:46 +00:00
|
|
|
static MetaKeyCombo overlay_key_combo = { 0, 0, 0 };
|
2019-02-20 10:53:54 +00:00
|
|
|
static MetaKeyCombo locate_pointer_key_combo = { 0, 0, 0 };
|
2011-06-24 16:14:15 +00:00
|
|
|
static GDesktopFocusMode focus_mode = G_DESKTOP_FOCUS_MODE_CLICK;
|
|
|
|
static GDesktopFocusNewWindows focus_new_windows = G_DESKTOP_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 19:35:03 +00:00
|
|
|
static gboolean raise_on_click = TRUE;
|
2014-04-25 13:26:24 +00:00
|
|
|
static gboolean center_new_windows = FALSE;
|
2010-09-10 09:55:20 +00:00
|
|
|
static gboolean attach_modal_dialogs = FALSE;
|
2001-12-10 03:55:26 +00:00
|
|
|
static int num_workspaces = 4;
|
2011-06-24 16:14:15 +00:00
|
|
|
static GDesktopTitlebarAction action_double_click_titlebar = G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE;
|
|
|
|
static GDesktopTitlebarAction action_middle_click_titlebar = G_DESKTOP_TITLEBAR_ACTION_LOWER;
|
|
|
|
static GDesktopTitlebarAction action_right_click_titlebar = G_DESKTOP_TITLEBAR_ACTION_MENU;
|
2012-03-08 00:29:58 +00:00
|
|
|
static gboolean dynamic_workspaces = FALSE;
|
2002-05-01 03:23:46 +00:00
|
|
|
static gboolean disable_workarounds = FALSE;
|
2002-05-24 02:23:46 +00:00
|
|
|
static gboolean auto_raise = FALSE;
|
|
|
|
static gboolean auto_raise_delay = 500;
|
2012-08-29 02:38:54 +00:00
|
|
|
static gboolean focus_change_on_pointer_rest = FALSE;
|
2011-11-14 14:22:30 +00:00
|
|
|
static gboolean bell_is_visible = FALSE;
|
2003-01-28 15:07:43 +00:00
|
|
|
static gboolean bell_is_audible = TRUE;
|
2005-01-26 08:43:38 +00:00
|
|
|
static gboolean gnome_accessibility = FALSE;
|
2008-06-29 21:57:39 +00:00
|
|
|
static gboolean gnome_animations = TRUE;
|
2019-07-15 11:13:45 +00:00
|
|
|
static gboolean locate_pointer_is_enabled = FALSE;
|
2020-02-21 20:03:16 +00:00
|
|
|
static unsigned int check_alive_timeout = 5000;
|
2005-07-11 13:25:08 +00:00
|
|
|
static char *cursor_theme = NULL;
|
2015-09-16 07:47:31 +00:00
|
|
|
/* cursor_size will, when running as an X11 compositing window manager, be the
|
|
|
|
* actual cursor size, multiplied with the global window scaling factor. On
|
|
|
|
* Wayland, it will be the actual cursor size retrieved from gsettings.
|
|
|
|
*/
|
2005-07-11 13:25:08 +00:00
|
|
|
static int cursor_size = 24;
|
2011-07-20 06:14:58 +00:00
|
|
|
static int draggable_border_width = 10;
|
2014-08-15 22:21:13 +00:00
|
|
|
static int drag_threshold;
|
2009-01-27 21:05:42 +00:00
|
|
|
static gboolean resize_with_right_button = FALSE;
|
2010-09-24 18:28:12 +00:00
|
|
|
static gboolean edge_tiling = FALSE;
|
2009-06-19 15:30:37 +00:00
|
|
|
static gboolean force_fullscreen = TRUE;
|
2012-09-08 09:34:27 +00:00
|
|
|
static gboolean auto_maximize = TRUE;
|
2019-03-10 18:30:12 +00:00
|
|
|
static gboolean show_fallback_app_menu = TRUE;
|
2003-10-12 06:25:38 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
static GDesktopVisualBellType visual_bell_type = G_DESKTOP_VISUAL_BELL_FULLSCREEN_FLASH;
|
2007-07-22 06:39:29 +00:00
|
|
|
static MetaButtonLayout button_layout;
|
2002-11-03 19:06:39 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
/* NULL-terminated array */
|
|
|
|
static char **workspace_names = NULL;
|
2002-11-03 19:06:39 +00:00
|
|
|
|
2011-02-28 12:48:28 +00:00
|
|
|
static gboolean workspaces_only_on_primary = FALSE;
|
2008-10-24 09:07:24 +00:00
|
|
|
|
2013-04-10 09:57:16 +00:00
|
|
|
static char *iso_next_group_option = NULL;
|
2008-02-23 06:16:03 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
static void handle_preference_update_enum (GSettings *settings,
|
|
|
|
gchar *key);
|
|
|
|
static gboolean update_binding (MetaKeyPref *binding,
|
|
|
|
gchar **strokes);
|
|
|
|
static gboolean update_key_binding (const char *key,
|
|
|
|
gchar **strokes);
|
2010-02-18 19:04:05 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
static void settings_changed (GSettings *settings,
|
|
|
|
gchar *key,
|
|
|
|
gpointer data);
|
|
|
|
static void bindings_changed (GSettings *settings,
|
|
|
|
gchar *key,
|
|
|
|
gpointer data);
|
2001-12-09 22:41:12 +00:00
|
|
|
|
2002-12-08 19:17:17 +00:00
|
|
|
static void queue_changed (MetaPreference pref);
|
|
|
|
|
2008-02-23 21:02:05 +00:00
|
|
|
static void maybe_give_disable_workarounds_warning (void);
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
static gboolean titlebar_handler (GVariant*, gpointer*, gpointer);
|
|
|
|
static gboolean mouse_button_mods_handler (GVariant*, gpointer*, gpointer);
|
|
|
|
static gboolean button_layout_handler (GVariant*, gpointer*, gpointer);
|
2012-08-10 21:22:46 +00:00
|
|
|
static gboolean overlay_key_handler (GVariant*, gpointer*, gpointer);
|
2019-02-20 10:53:54 +00:00
|
|
|
static gboolean locate_pointer_key_handler (GVariant*, gpointer*, gpointer);
|
2019-07-15 11:13:45 +00:00
|
|
|
|
2013-04-10 09:57:16 +00:00
|
|
|
static gboolean iso_next_group_handler (GVariant*, gpointer*, gpointer);
|
2008-02-23 06:16:03 +00:00
|
|
|
|
2002-12-08 19:17:17 +00:00
|
|
|
static void init_bindings (void);
|
2008-02-23 21:02:05 +00:00
|
|
|
|
2008-03-06 17:59:20 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
MetaPrefsChangedFunc func;
|
|
|
|
gpointer data;
|
|
|
|
} MetaPrefsListener;
|
|
|
|
|
2008-02-23 06:16:03 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2015-09-23 23:13:59 +00:00
|
|
|
const char *key;
|
|
|
|
const char *schema;
|
2008-06-13 23:10:32 +00:00
|
|
|
MetaPreference pref;
|
2011-06-24 16:14:15 +00:00
|
|
|
} MetaBasePreference;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
MetaBasePreference base;
|
2008-02-23 06:16:03 +00:00
|
|
|
gpointer target;
|
|
|
|
} MetaEnumPreference;
|
|
|
|
|
2008-02-23 21:02:05 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
MetaBasePreference base;
|
2008-06-13 23:10:32 +00:00
|
|
|
gboolean *target;
|
2008-02-23 21:02:05 +00:00
|
|
|
} MetaBoolPreference;
|
|
|
|
|
2011-11-02 15:34:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* MetaStringPreference:
|
2014-05-28 19:44:23 +00:00
|
|
|
* @handler: (nullable): A handler. Many of the string preferences
|
2011-11-02 15:34:45 +00:00
|
|
|
* 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 instead of writing
|
|
|
|
* the string value out to the target variable.
|
|
|
|
* The function will be passed to g_settings_get_mapped() and should
|
|
|
|
* return %TRUE if the mapping was successful and %FALSE otherwise.
|
|
|
|
* In the former case the function is expected to handle the result
|
|
|
|
* of the conversion itself and call queue_changed() appropriately;
|
|
|
|
* in particular the @result (out) parameter as returned by
|
|
|
|
* g_settings_get_mapped() will be ignored in all cases.
|
|
|
|
* This may be %NULL. If it is, see "target", below.
|
2014-05-28 19:44:23 +00:00
|
|
|
* @target: (nullable): Where to write the incoming string.
|
2011-11-02 15:34:45 +00:00
|
|
|
* This must be %NULL if the handler is non-%NULL.
|
|
|
|
* If the incoming string is %NULL, no change will be made.
|
|
|
|
*/
|
2008-03-06 17:59:20 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
MetaBasePreference base;
|
|
|
|
GSettingsGetMapping handler;
|
2008-03-06 17:59:20 +00:00
|
|
|
gchar **target;
|
|
|
|
} MetaStringPreference;
|
|
|
|
|
2013-05-12 13:37:05 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
MetaBasePreference base;
|
|
|
|
GSettingsGetMapping handler;
|
|
|
|
gchar ***target;
|
|
|
|
} MetaStringArrayPreference;
|
|
|
|
|
2008-06-13 23:10:32 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
MetaBasePreference base;
|
2008-06-13 23:10:32 +00:00
|
|
|
gint *target;
|
|
|
|
} MetaIntPreference;
|
|
|
|
|
2020-02-21 20:03:16 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
MetaBasePreference base;
|
|
|
|
unsigned int *target;
|
|
|
|
} MetaUintPreference;
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
|
|
|
/* All preferences that are not keybindings must be listed here,
|
|
|
|
* plus in the GSettings schemas and the MetaPreference enum.
|
|
|
|
*/
|
|
|
|
|
2008-06-13 23:10:32 +00:00
|
|
|
/* FIXMEs: */
|
|
|
|
/* @@@ Don't use NULL lines at the end; glib can tell you how big it is */
|
|
|
|
|
2008-02-23 06:16:03 +00:00
|
|
|
static MetaEnumPreference preferences_enum[] =
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "focus-new-windows",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_FOCUS_NEW_WINDOWS,
|
|
|
|
},
|
2008-02-23 06:16:03 +00:00
|
|
|
&focus_new_windows,
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "focus-mode",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_FOCUS_MODE,
|
|
|
|
},
|
2008-02-23 06:16:03 +00:00
|
|
|
&focus_mode,
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "visual-bell-type",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_VISUAL_BELL_TYPE,
|
|
|
|
},
|
2008-02-23 06:16:03 +00:00
|
|
|
&visual_bell_type,
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "action-double-click-titlebar",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR,
|
|
|
|
},
|
2008-02-23 06:16:03 +00:00
|
|
|
&action_double_click_titlebar,
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "action-middle-click-titlebar",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_ACTION_MIDDLE_CLICK_TITLEBAR,
|
|
|
|
},
|
2008-02-23 06:16:03 +00:00
|
|
|
&action_middle_click_titlebar,
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "action-right-click-titlebar",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_ACTION_RIGHT_CLICK_TITLEBAR,
|
|
|
|
},
|
2008-02-23 06:16:03 +00:00
|
|
|
&action_right_click_titlebar,
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{ { NULL, 0, 0 }, NULL },
|
2008-02-23 06:16:03 +00:00
|
|
|
};
|
|
|
|
|
2008-02-23 21:02:05 +00:00
|
|
|
static MetaBoolPreference preferences_bool[] =
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "attach-modal-dialogs",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_ATTACH_MODAL_DIALOGS,
|
|
|
|
},
|
2010-09-10 09:55:20 +00:00
|
|
|
&attach_modal_dialogs,
|
|
|
|
},
|
2014-04-25 13:26:24 +00:00
|
|
|
{
|
|
|
|
{ "center-new-windows",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_CENTER_NEW_WINDOWS,
|
|
|
|
},
|
|
|
|
¢er_new_windows,
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "raise-on-click",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_RAISE_ON_CLICK,
|
|
|
|
},
|
2008-06-13 23:10:32 +00:00
|
|
|
&raise_on_click,
|
2008-02-23 21:02:05 +00:00
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "titlebar-uses-system-font",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_TITLEBAR_FONT, /* note! shares a pref */
|
|
|
|
},
|
2008-06-13 23:10:32 +00:00
|
|
|
&use_system_font,
|
2008-02-23 21:02:05 +00:00
|
|
|
},
|
2012-03-08 00:29:58 +00:00
|
|
|
{
|
|
|
|
{ "dynamic-workspaces",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_DYNAMIC_WORKSPACES,
|
|
|
|
},
|
|
|
|
&dynamic_workspaces,
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "disable-workarounds",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_DISABLE_WORKAROUNDS,
|
|
|
|
},
|
2008-06-13 23:10:32 +00:00
|
|
|
&disable_workarounds,
|
2008-02-23 21:02:05 +00:00
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "auto-raise",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_AUTO_RAISE,
|
|
|
|
},
|
2008-06-13 23:10:32 +00:00
|
|
|
&auto_raise,
|
2008-02-23 21:02:05 +00:00
|
|
|
},
|
2012-08-29 02:38:54 +00:00
|
|
|
{
|
|
|
|
{ "focus-change-on-pointer-rest",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_FOCUS_CHANGE_ON_POINTER_REST,
|
|
|
|
},
|
|
|
|
&focus_change_on_pointer_rest
|
|
|
|
},
|
2011-11-14 14:22:30 +00:00
|
|
|
{
|
|
|
|
{ "visual-bell",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_VISUAL_BELL,
|
|
|
|
},
|
|
|
|
&bell_is_visible, /* FIXME: change the name: it's confusing */
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "audible-bell",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_AUDIBLE_BELL,
|
|
|
|
},
|
2008-06-13 23:10:32 +00:00
|
|
|
&bell_is_audible, /* FIXME: change the name: it's confusing */
|
2008-02-23 21:02:05 +00:00
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ KEY_GNOME_ACCESSIBILITY,
|
|
|
|
SCHEMA_INTERFACE,
|
|
|
|
META_PREF_GNOME_ACCESSIBILITY,
|
|
|
|
},
|
2008-06-13 23:10:32 +00:00
|
|
|
&gnome_accessibility,
|
2008-02-23 21:02:05 +00:00
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ KEY_GNOME_ANIMATIONS,
|
|
|
|
SCHEMA_INTERFACE,
|
|
|
|
META_PREF_GNOME_ANIMATIONS,
|
|
|
|
},
|
2008-06-29 21:57:39 +00:00
|
|
|
&gnome_animations,
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "resize-with-right-button",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_RESIZE_WITH_RIGHT_BUTTON,
|
|
|
|
},
|
2009-01-27 21:05:42 +00:00
|
|
|
&resize_with_right_button,
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "edge-tiling",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_EDGE_TILING,
|
|
|
|
},
|
2010-09-24 18:28:12 +00:00
|
|
|
&edge_tiling,
|
2010-06-24 18:41:28 +00:00
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "workspaces-only-on-primary",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_WORKSPACES_ONLY_ON_PRIMARY,
|
|
|
|
},
|
2011-02-28 12:48:28 +00:00
|
|
|
&workspaces_only_on_primary,
|
|
|
|
},
|
2012-09-08 09:34:27 +00:00
|
|
|
{
|
|
|
|
{ "auto-maximize",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_AUTO_MAXIMIZE,
|
|
|
|
},
|
|
|
|
&auto_maximize,
|
|
|
|
},
|
2019-07-15 11:13:45 +00:00
|
|
|
{
|
|
|
|
{ KEY_LOCATE_POINTER,
|
|
|
|
SCHEMA_INTERFACE,
|
|
|
|
META_PREF_LOCATE_POINTER,
|
|
|
|
},
|
|
|
|
&locate_pointer_is_enabled,
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{ { NULL, 0, 0 }, NULL },
|
2008-02-23 21:02:05 +00:00
|
|
|
};
|
2008-02-23 06:16:03 +00:00
|
|
|
|
2008-03-06 17:59:20 +00:00
|
|
|
static MetaStringPreference preferences_string[] =
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "mouse-button-modifier",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_MOUSE_BUTTON_MODS,
|
|
|
|
},
|
2008-03-06 17:59:20 +00:00
|
|
|
mouse_button_mods_handler,
|
|
|
|
NULL,
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ KEY_TITLEBAR_FONT,
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_TITLEBAR_FONT,
|
|
|
|
},
|
2008-03-06 17:59:20 +00:00
|
|
|
titlebar_handler,
|
|
|
|
NULL,
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "button-layout",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_BUTTON_LAYOUT,
|
|
|
|
},
|
2008-03-06 17:59:20 +00:00
|
|
|
button_layout_handler,
|
|
|
|
NULL,
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "cursor-theme",
|
|
|
|
SCHEMA_INTERFACE,
|
|
|
|
META_PREF_CURSOR_THEME,
|
|
|
|
},
|
2008-03-06 17:59:20 +00:00
|
|
|
NULL,
|
|
|
|
&cursor_theme,
|
|
|
|
},
|
2012-08-10 21:22:46 +00:00
|
|
|
{
|
|
|
|
{ "overlay-key",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_KEYBINDINGS,
|
|
|
|
},
|
|
|
|
overlay_key_handler,
|
|
|
|
NULL,
|
|
|
|
},
|
2019-02-20 10:53:54 +00:00
|
|
|
{
|
|
|
|
{ "locate-pointer-key",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_KEYBINDINGS,
|
|
|
|
},
|
|
|
|
locate_pointer_key_handler,
|
|
|
|
NULL,
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{ { NULL, 0, 0 }, NULL },
|
2008-03-06 17:59:20 +00:00
|
|
|
};
|
|
|
|
|
2013-05-12 13:37:05 +00:00
|
|
|
static MetaStringArrayPreference preferences_string_array[] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{ KEY_WORKSPACE_NAMES,
|
|
|
|
SCHEMA_GENERAL,
|
2015-01-09 02:34:14 +00:00
|
|
|
META_PREF_WORKSPACE_NAMES,
|
2013-05-12 13:37:05 +00:00
|
|
|
},
|
|
|
|
NULL,
|
|
|
|
&workspace_names,
|
|
|
|
},
|
2013-04-10 09:57:16 +00:00
|
|
|
{
|
|
|
|
{ KEY_XKB_OPTIONS,
|
|
|
|
SCHEMA_INPUT_SOURCES,
|
|
|
|
META_PREF_KEYBINDINGS,
|
|
|
|
},
|
|
|
|
iso_next_group_handler,
|
|
|
|
NULL,
|
|
|
|
},
|
2013-05-12 13:37:05 +00:00
|
|
|
{ { NULL, 0, 0 }, NULL },
|
|
|
|
};
|
|
|
|
|
2008-06-13 23:10:32 +00:00
|
|
|
static MetaIntPreference preferences_int[] =
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ KEY_NUM_WORKSPACES,
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_NUM_WORKSPACES,
|
|
|
|
},
|
|
|
|
&num_workspaces
|
2008-06-13 23:10:32 +00:00
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "auto-raise-delay",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_AUTO_RAISE_DELAY,
|
|
|
|
},
|
|
|
|
&auto_raise_delay
|
2008-06-13 23:10:32 +00:00
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{
|
|
|
|
{ "draggable-border-width",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_DRAGGABLE_BORDER_WIDTH,
|
|
|
|
},
|
|
|
|
&draggable_border_width
|
2011-07-20 06:14:58 +00:00
|
|
|
},
|
2014-08-15 22:21:13 +00:00
|
|
|
{
|
|
|
|
{ "drag-threshold",
|
|
|
|
SCHEMA_MOUSE,
|
|
|
|
META_PREF_DRAG_THRESHOLD,
|
|
|
|
},
|
|
|
|
&drag_threshold
|
|
|
|
},
|
2018-07-06 17:22:26 +00:00
|
|
|
{
|
|
|
|
{ "cursor-size",
|
|
|
|
SCHEMA_INTERFACE,
|
|
|
|
META_PREF_CURSOR_SIZE,
|
|
|
|
},
|
|
|
|
&cursor_size
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
{ { NULL, 0, 0 }, NULL },
|
2008-06-13 23:10:32 +00:00
|
|
|
};
|
|
|
|
|
2020-02-21 20:03:16 +00:00
|
|
|
static MetaUintPreference preferences_uint[] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{ "check-alive-timeout",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_CHECK_ALIVE_TIMEOUT,
|
|
|
|
},
|
|
|
|
&check_alive_timeout,
|
|
|
|
},
|
|
|
|
{ { NULL, 0, 0 }, NULL },
|
|
|
|
};
|
|
|
|
|
2008-02-23 06:16:03 +00:00
|
|
|
static void
|
|
|
|
handle_preference_init_enum (void)
|
|
|
|
{
|
|
|
|
MetaEnumPreference *cursor = preferences_enum;
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
while (cursor->base.key != NULL)
|
2008-02-23 06:16:03 +00:00
|
|
|
{
|
2008-03-06 17:59:20 +00:00
|
|
|
if (cursor->target==NULL)
|
2011-06-24 16:14:15 +00:00
|
|
|
continue;
|
2008-02-23 06:16:03 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
*((gint *) cursor->target) =
|
|
|
|
g_settings_get_enum (SETTINGS (cursor->base.schema), cursor->base.key);
|
2008-02-23 06:16:03 +00:00
|
|
|
|
|
|
|
++cursor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-23 21:02:05 +00:00
|
|
|
static void
|
|
|
|
handle_preference_init_bool (void)
|
|
|
|
{
|
|
|
|
MetaBoolPreference *cursor = preferences_bool;
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
while (cursor->base.key != NULL)
|
2008-02-23 21:02:05 +00:00
|
|
|
{
|
|
|
|
if (cursor->target!=NULL)
|
2011-06-24 16:14:15 +00:00
|
|
|
*cursor->target =
|
|
|
|
g_settings_get_boolean (SETTINGS (cursor->base.schema),
|
|
|
|
cursor->base.key);
|
2008-02-23 21:02:05 +00:00
|
|
|
|
|
|
|
++cursor;
|
|
|
|
}
|
|
|
|
|
|
|
|
maybe_give_disable_workarounds_warning ();
|
|
|
|
}
|
|
|
|
|
2008-03-06 17:59:20 +00:00
|
|
|
static void
|
|
|
|
handle_preference_init_string (void)
|
|
|
|
{
|
|
|
|
MetaStringPreference *cursor = preferences_string;
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
while (cursor->base.key != NULL)
|
2008-03-06 17:59:20 +00:00
|
|
|
{
|
|
|
|
char *value;
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
/* Complex keys have a mapping function to check validity */
|
2008-03-06 17:59:20 +00:00
|
|
|
if (cursor->handler)
|
|
|
|
{
|
|
|
|
if (cursor->target)
|
2011-06-24 16:14:15 +00:00
|
|
|
meta_bug ("%s has both a target and a handler\n", cursor->base.key);
|
2008-03-06 17:59:20 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
g_settings_get_mapped (SETTINGS (cursor->base.schema),
|
|
|
|
cursor->base.key, cursor->handler, NULL);
|
2008-03-06 17:59:20 +00:00
|
|
|
}
|
2011-06-24 16:14:15 +00:00
|
|
|
else
|
2008-03-06 17:59:20 +00:00
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
if (!cursor->target)
|
|
|
|
meta_bug ("%s must have handler or target\n", cursor->base.key);
|
|
|
|
|
2014-12-29 03:50:25 +00:00
|
|
|
g_free (*(cursor->target));
|
2008-03-06 17:59:20 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
value = g_settings_get_string (SETTINGS (cursor->base.schema),
|
|
|
|
cursor->base.key);
|
|
|
|
|
2008-03-06 17:59:20 +00:00
|
|
|
*(cursor->target) = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
++cursor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-12 13:37:05 +00:00
|
|
|
static void
|
|
|
|
handle_preference_init_string_array (void)
|
|
|
|
{
|
|
|
|
MetaStringArrayPreference *cursor = preferences_string_array;
|
|
|
|
|
|
|
|
while (cursor->base.key != NULL)
|
|
|
|
{
|
|
|
|
char **value;
|
|
|
|
|
|
|
|
/* Complex keys have a mapping function to check validity */
|
|
|
|
if (cursor->handler)
|
|
|
|
{
|
|
|
|
if (cursor->target)
|
|
|
|
meta_bug ("%s has both a target and a handler\n", cursor->base.key);
|
|
|
|
|
|
|
|
g_settings_get_mapped (SETTINGS (cursor->base.schema),
|
|
|
|
cursor->base.key, cursor->handler, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!cursor->target)
|
|
|
|
meta_bug ("%s must have handler or target\n", cursor->base.key);
|
|
|
|
|
|
|
|
if (*(cursor->target))
|
|
|
|
g_strfreev (*(cursor->target));
|
|
|
|
|
|
|
|
value = g_settings_get_strv (SETTINGS (cursor->base.schema),
|
|
|
|
cursor->base.key);
|
|
|
|
|
|
|
|
*(cursor->target) = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
++cursor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-06-13 23:10:32 +00:00
|
|
|
static void
|
|
|
|
handle_preference_init_int (void)
|
|
|
|
{
|
|
|
|
MetaIntPreference *cursor = preferences_int;
|
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
while (cursor->base.key != NULL)
|
2008-06-13 23:10:32 +00:00
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
if (cursor->target)
|
|
|
|
*cursor->target = g_settings_get_int (SETTINGS (cursor->base.schema),
|
|
|
|
cursor->base.key);
|
2008-06-13 23:10:32 +00:00
|
|
|
|
|
|
|
++cursor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-21 20:03:16 +00:00
|
|
|
static void
|
|
|
|
handle_preference_init_uint (void)
|
|
|
|
{
|
|
|
|
MetaUintPreference *cursor = preferences_uint;
|
|
|
|
|
|
|
|
while (cursor->base.key != NULL)
|
|
|
|
{
|
|
|
|
if (cursor->target)
|
|
|
|
*cursor->target = g_settings_get_uint (SETTINGS (cursor->base.schema),
|
|
|
|
cursor->base.key);
|
|
|
|
|
|
|
|
++cursor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
static void
|
|
|
|
handle_preference_update_enum (GSettings *settings,
|
|
|
|
gchar *key)
|
2008-02-23 06:16:03 +00:00
|
|
|
{
|
|
|
|
MetaEnumPreference *cursor = preferences_enum;
|
|
|
|
gint old_value;
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
while (cursor->base.key != NULL && strcmp (key, cursor->base.key) != 0)
|
2008-02-23 06:16:03 +00:00
|
|
|
++cursor;
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
if (cursor->base.key == NULL)
|
2008-02-23 06:16:03 +00:00
|
|
|
/* Didn't recognise that key. */
|
2011-06-24 16:14:15 +00:00
|
|
|
return;
|
2008-02-23 06:16:03 +00:00
|
|
|
|
|
|
|
/* We need to know whether the value changes, so
|
|
|
|
* store the current value away.
|
|
|
|
*/
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
old_value = * ((gint *)cursor->target);
|
|
|
|
*((gint *)cursor->target) =
|
|
|
|
g_settings_get_enum (SETTINGS (cursor->base.schema), key);
|
2008-02-23 06:16:03 +00:00
|
|
|
|
|
|
|
/* Did it change? If so, tell the listeners about it. */
|
2011-06-24 16:14:15 +00:00
|
|
|
if (old_value != *((gint *)cursor->target))
|
|
|
|
queue_changed (cursor->base.pref);
|
2008-02-23 06:16:03 +00:00
|
|
|
}
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
static void
|
|
|
|
handle_preference_update_bool (GSettings *settings,
|
|
|
|
gchar *key)
|
2008-02-23 21:02:05 +00:00
|
|
|
{
|
|
|
|
MetaBoolPreference *cursor = preferences_bool;
|
|
|
|
gboolean old_value;
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
while (cursor->base.key != NULL && strcmp (key, cursor->base.key) != 0)
|
2008-02-23 21:02:05 +00:00
|
|
|
++cursor;
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
if (cursor->base.key == NULL || cursor->target == NULL)
|
|
|
|
/* Unknown key or no work for us to do. */
|
|
|
|
return;
|
2008-02-23 21:02:05 +00:00
|
|
|
|
|
|
|
/* We need to know whether the value changes, so
|
|
|
|
* store the current value away.
|
|
|
|
*/
|
2011-06-24 16:14:15 +00:00
|
|
|
old_value = *((gboolean *) cursor->target);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2008-02-23 21:02:05 +00:00
|
|
|
/* Now look it up... */
|
2011-06-24 16:14:15 +00:00
|
|
|
*((gboolean *) cursor->target) =
|
|
|
|
g_settings_get_boolean (SETTINGS (cursor->base.schema), key);
|
2008-02-23 21:02:05 +00:00
|
|
|
|
|
|
|
/* Did it change? If so, tell the listeners about it. */
|
2011-06-24 16:14:15 +00:00
|
|
|
if (old_value != *((gboolean *)cursor->target))
|
|
|
|
queue_changed (cursor->base.pref);
|
2008-02-23 21:02:05 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
if (cursor->base.pref==META_PREF_DISABLE_WORKAROUNDS)
|
2008-02-23 21:02:05 +00:00
|
|
|
maybe_give_disable_workarounds_warning ();
|
|
|
|
}
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
static void
|
|
|
|
handle_preference_update_string (GSettings *settings,
|
|
|
|
gchar *key)
|
2008-03-06 17:59:20 +00:00
|
|
|
{
|
|
|
|
MetaStringPreference *cursor = preferences_string;
|
2011-06-24 16:14:15 +00:00
|
|
|
char *value;
|
|
|
|
gboolean inform_listeners = FALSE;
|
2008-03-06 17:59:20 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
while (cursor->base.key != NULL && strcmp (key, cursor->base.key) != 0)
|
2008-03-06 17:59:20 +00:00
|
|
|
++cursor;
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
if (cursor->base.key==NULL)
|
2008-03-06 17:59:20 +00:00
|
|
|
/* Didn't recognise that key. */
|
2011-06-24 16:14:15 +00:00
|
|
|
return;
|
2008-03-06 17:59:20 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
/* Complex keys have a mapping function to check validity */
|
|
|
|
if (cursor->handler)
|
2008-03-06 17:59:20 +00:00
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
if (cursor->target)
|
|
|
|
meta_bug ("%s has both a target and a handler\n", cursor->base.key);
|
|
|
|
|
|
|
|
g_settings_get_mapped (SETTINGS (cursor->base.schema),
|
|
|
|
cursor->base.key, cursor->handler, NULL);
|
2008-03-06 17:59:20 +00:00
|
|
|
}
|
2011-06-24 16:14:15 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!cursor->target)
|
|
|
|
meta_bug ("%s must have handler or target\n", cursor->base.key);
|
2008-03-06 17:59:20 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
value = g_settings_get_string (SETTINGS (cursor->base.schema),
|
|
|
|
cursor->base.key);
|
|
|
|
|
|
|
|
inform_listeners = (g_strcmp0 (value, *(cursor->target)) != 0);
|
2008-03-06 17:59:20 +00:00
|
|
|
|
2014-12-29 03:50:25 +00:00
|
|
|
g_free(*(cursor->target));
|
2008-03-06 17:59:20 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
*(cursor->target) = value;
|
2008-03-06 17:59:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (inform_listeners)
|
2011-06-24 16:14:15 +00:00
|
|
|
queue_changed (cursor->base.pref);
|
2008-03-06 17:59:20 +00:00
|
|
|
}
|
|
|
|
|
2013-05-12 13:37:05 +00:00
|
|
|
static void
|
|
|
|
handle_preference_update_string_array (GSettings *settings,
|
|
|
|
gchar *key)
|
|
|
|
{
|
|
|
|
MetaStringArrayPreference *cursor = preferences_string_array;
|
|
|
|
gboolean inform_listeners = FALSE;
|
|
|
|
|
|
|
|
while (cursor->base.key != NULL && strcmp (key, cursor->base.key) != 0)
|
|
|
|
++cursor;
|
|
|
|
|
|
|
|
if (cursor->base.key==NULL)
|
|
|
|
/* Didn't recognise that key. */
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Complex keys have a mapping function to check validity */
|
|
|
|
if (cursor->handler)
|
|
|
|
{
|
|
|
|
if (cursor->target)
|
|
|
|
meta_bug ("%s has both a target and a handler\n", cursor->base.key);
|
|
|
|
|
|
|
|
g_settings_get_mapped (SETTINGS (cursor->base.schema),
|
|
|
|
cursor->base.key, cursor->handler, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char **values, **previous;
|
|
|
|
int n_values, n_previous, i;
|
|
|
|
|
|
|
|
if (!cursor->target)
|
|
|
|
meta_bug ("%s must have handler or target\n", cursor->base.key);
|
|
|
|
|
|
|
|
values = g_settings_get_strv (SETTINGS (cursor->base.schema),
|
|
|
|
cursor->base.key);
|
|
|
|
n_values = g_strv_length (values);
|
|
|
|
previous = *(cursor->target);
|
|
|
|
n_previous = previous ? g_strv_length (previous) : 0;
|
|
|
|
|
|
|
|
inform_listeners = n_previous != n_values;
|
|
|
|
for (i = 0; i < n_values && !inform_listeners; i++)
|
|
|
|
inform_listeners = g_strcmp0 (values[i], previous[i]) != 0;
|
|
|
|
|
|
|
|
if (*(cursor->target))
|
|
|
|
g_strfreev (*(cursor->target));
|
|
|
|
*(cursor->target) = values;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (inform_listeners)
|
|
|
|
queue_changed (cursor->base.pref);
|
|
|
|
}
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
static void
|
|
|
|
handle_preference_update_int (GSettings *settings,
|
|
|
|
gchar *key)
|
2008-06-13 23:10:32 +00:00
|
|
|
{
|
|
|
|
MetaIntPreference *cursor = preferences_int;
|
|
|
|
gint new_value;
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
while (cursor->base.key != NULL && strcmp (key, cursor->base.key) != 0)
|
2008-06-13 23:10:32 +00:00
|
|
|
++cursor;
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
if (cursor->base.key == NULL || cursor->target == NULL)
|
|
|
|
/* Unknown key or no work for us to do. */
|
|
|
|
return;
|
2008-06-13 23:10:32 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
new_value = g_settings_get_int (SETTINGS (cursor->base.schema), key);
|
2008-06-13 23:10:32 +00:00
|
|
|
|
|
|
|
/* Did it change? If so, tell the listeners about it. */
|
|
|
|
if (*cursor->target != new_value)
|
|
|
|
{
|
|
|
|
*cursor->target = new_value;
|
2011-06-24 16:14:15 +00:00
|
|
|
queue_changed (cursor->base.pref);
|
2008-06-13 23:10:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-21 20:03:16 +00:00
|
|
|
static void
|
|
|
|
handle_preference_update_uint (GSettings *settings,
|
|
|
|
char *key)
|
|
|
|
{
|
|
|
|
MetaUintPreference *cursor = preferences_uint;
|
|
|
|
unsigned int new_value;
|
|
|
|
|
|
|
|
while (cursor->base.key && strcmp (key, cursor->base.key) != 0)
|
|
|
|
++cursor;
|
|
|
|
|
|
|
|
if (!cursor->base.key || !cursor->target)
|
|
|
|
return;
|
|
|
|
|
|
|
|
new_value = g_settings_get_uint (SETTINGS (cursor->base.schema), key);
|
|
|
|
|
|
|
|
if (*cursor->target != new_value)
|
|
|
|
{
|
|
|
|
*cursor->target = new_value;
|
|
|
|
queue_changed (cursor->base.pref);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2008-06-13 23:10:32 +00:00
|
|
|
/****************************************************************************/
|
|
|
|
/* Listeners. */
|
|
|
|
/****************************************************************************/
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_prefs_add_listener: (skip)
|
2013-02-15 18:42:08 +00:00
|
|
|
* @func: a #MetaPrefsChangedFunc
|
|
|
|
* @user_data: data passed to the function
|
2010-09-01 19:39:53 +00:00
|
|
|
*
|
|
|
|
*/
|
2001-12-09 22:41:12 +00:00
|
|
|
void
|
|
|
|
meta_prefs_add_listener (MetaPrefsChangedFunc func,
|
2012-11-16 20:23:47 +00:00
|
|
|
gpointer user_data)
|
2001-12-09 22:41:12 +00:00
|
|
|
{
|
|
|
|
MetaPrefsListener *l;
|
|
|
|
|
|
|
|
l = g_new (MetaPrefsListener, 1);
|
|
|
|
l->func = func;
|
2012-11-16 20:23:47 +00:00
|
|
|
l->data = user_data;
|
2001-12-09 22:41:12 +00:00
|
|
|
|
|
|
|
listeners = g_list_prepend (listeners, l);
|
|
|
|
}
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
/**
|
|
|
|
* meta_prefs_remove_listener: (skip)
|
2013-02-15 18:42:08 +00:00
|
|
|
* @func: a #MetaPrefsChangedFunc
|
|
|
|
* @user_data: data passed to the function
|
2010-09-01 19:39:53 +00:00
|
|
|
*
|
|
|
|
*/
|
2001-12-09 22:41:12 +00:00
|
|
|
void
|
|
|
|
meta_prefs_remove_listener (MetaPrefsChangedFunc func,
|
2012-11-16 20:23:47 +00:00
|
|
|
gpointer user_data)
|
2001-12-09 22:41:12 +00:00
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
tmp = listeners;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaPrefsListener *l = tmp->data;
|
|
|
|
|
|
|
|
if (l->func == func &&
|
2012-11-16 20:23:47 +00:00
|
|
|
l->data == user_data)
|
2001-12-09 22:41:12 +00:00
|
|
|
{
|
|
|
|
g_free (l);
|
|
|
|
listeners = g_list_delete_link (listeners, tmp);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
emit_changed (MetaPreference pref)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
GList *copy;
|
|
|
|
|
2002-11-03 19:06:39 +00:00
|
|
|
meta_topic (META_DEBUG_PREFS, "Notifying listeners that pref %s changed\n",
|
|
|
|
meta_preference_to_string (pref));
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
copy = g_list_copy (listeners);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
tmp = copy;
|
2008-03-06 17:59:20 +00:00
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaPrefsListener *l = tmp->data;
|
|
|
|
|
|
|
|
(* l->func) (pref, l->data);
|
2008-03-06 17:59:20 +00:00
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (copy);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
changed_idle_handler (gpointer data)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
GList *copy;
|
|
|
|
|
|
|
|
changed_idle = 0;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
copy = g_list_copy (changes); /* reentrancy paranoia */
|
|
|
|
|
|
|
|
g_list_free (changes);
|
|
|
|
changes = NULL;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
tmp = copy;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaPreference pref = GPOINTER_TO_INT (tmp->data);
|
|
|
|
|
|
|
|
emit_changed (pref);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (copy);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
queue_changed (MetaPreference pref)
|
|
|
|
{
|
2002-11-03 19:06:39 +00:00
|
|
|
meta_topic (META_DEBUG_PREFS, "Queueing change of pref %s\n",
|
2014-05-02 13:34:02 +00:00
|
|
|
meta_preference_to_string (pref));
|
2008-03-06 17:59:20 +00:00
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
if (g_list_find (changes, GINT_TO_POINTER (pref)) == NULL)
|
|
|
|
changes = g_list_prepend (changes, GINT_TO_POINTER (pref));
|
|
|
|
else
|
2002-11-03 19:06:39 +00:00
|
|
|
meta_topic (META_DEBUG_PREFS, "Change of pref %s was already pending\n",
|
|
|
|
meta_preference_to_string (pref));
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
if (changed_idle == 0)
|
2014-04-10 16:58:58 +00:00
|
|
|
{
|
|
|
|
changed_idle = g_idle_add_full (META_PRIORITY_PREFS_NOTIFY,
|
|
|
|
changed_idle_handler, NULL, NULL);
|
|
|
|
g_source_set_name_by_id (changed_idle, "[mutter] changed_idle_handler");
|
|
|
|
}
|
2001-12-09 22:41:12 +00:00
|
|
|
}
|
2008-05-28 04:10:08 +00:00
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2008-06-13 23:10:32 +00:00
|
|
|
/****************************************************************************/
|
|
|
|
/* Initialisation. */
|
|
|
|
/****************************************************************************/
|
2008-05-28 04:10:08 +00:00
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
void
|
|
|
|
meta_prefs_init (void)
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
GSettings *settings;
|
|
|
|
|
|
|
|
settings_schemas = g_hash_table_new_full (g_str_hash, g_str_equal,
|
|
|
|
g_free, g_object_unref);
|
|
|
|
|
|
|
|
settings = g_settings_new (SCHEMA_GENERAL);
|
|
|
|
g_signal_connect (settings, "changed", G_CALLBACK (settings_changed), NULL);
|
|
|
|
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_GENERAL), settings);
|
|
|
|
|
|
|
|
settings = g_settings_new (SCHEMA_MUTTER);
|
|
|
|
g_signal_connect (settings, "changed", G_CALLBACK (settings_changed), NULL);
|
|
|
|
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_MUTTER), settings);
|
|
|
|
|
2014-08-16 00:23:45 +00:00
|
|
|
settings = g_settings_new (SCHEMA_MOUSE);
|
|
|
|
g_signal_connect (settings, "changed", G_CALLBACK (settings_changed), NULL);
|
|
|
|
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_MOUSE), settings);
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
/* Individual keys we watch outside of our schemas */
|
|
|
|
settings = g_settings_new (SCHEMA_INTERFACE);
|
|
|
|
g_signal_connect (settings, "changed::" KEY_GNOME_ACCESSIBILITY,
|
|
|
|
G_CALLBACK (settings_changed), NULL);
|
|
|
|
g_signal_connect (settings, "changed::" KEY_GNOME_ANIMATIONS,
|
|
|
|
G_CALLBACK (settings_changed), NULL);
|
|
|
|
g_signal_connect (settings, "changed::" KEY_GNOME_CURSOR_THEME,
|
|
|
|
G_CALLBACK (settings_changed), NULL);
|
2018-07-06 17:22:26 +00:00
|
|
|
g_signal_connect (settings, "changed::" KEY_GNOME_CURSOR_SIZE,
|
|
|
|
G_CALLBACK (settings_changed), NULL);
|
2019-07-15 11:13:45 +00:00
|
|
|
g_signal_connect (settings, "changed::" KEY_LOCATE_POINTER,
|
|
|
|
G_CALLBACK (settings_changed), NULL);
|
2011-06-24 16:14:15 +00:00
|
|
|
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_INTERFACE), settings);
|
|
|
|
|
2013-04-10 09:57:16 +00:00
|
|
|
settings = g_settings_new (SCHEMA_INPUT_SOURCES);
|
|
|
|
g_signal_connect (settings, "changed::" KEY_XKB_OPTIONS,
|
|
|
|
G_CALLBACK (settings_changed), NULL);
|
|
|
|
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_INPUT_SOURCES), settings);
|
|
|
|
|
2010-04-12 21:42:46 +00:00
|
|
|
/* Pick up initial values. */
|
|
|
|
|
|
|
|
handle_preference_init_enum ();
|
|
|
|
handle_preference_init_bool ();
|
|
|
|
handle_preference_init_string ();
|
2013-05-12 13:37:05 +00:00
|
|
|
handle_preference_init_string_array ();
|
2010-04-12 21:42:46 +00:00
|
|
|
handle_preference_init_int ();
|
2020-02-21 20:03:16 +00:00
|
|
|
handle_preference_init_uint ();
|
2010-04-12 21:42:46 +00:00
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
init_bindings ();
|
2001-12-09 22:41:12 +00:00
|
|
|
}
|
|
|
|
|
2010-04-12 21:39:27 +00:00
|
|
|
static gboolean
|
2011-06-24 16:14:15 +00:00
|
|
|
find_pref (void *prefs,
|
|
|
|
size_t pref_size,
|
|
|
|
const char *search_key,
|
|
|
|
MetaBasePreference **pref)
|
2010-04-12 21:39:27 +00:00
|
|
|
{
|
2010-04-13 18:40:31 +00:00
|
|
|
void *p = prefs;
|
2010-04-12 21:39:27 +00:00
|
|
|
|
2010-04-13 18:40:31 +00:00
|
|
|
while (TRUE)
|
2010-04-12 21:39:27 +00:00
|
|
|
{
|
2010-04-13 18:40:31 +00:00
|
|
|
char **key = p;
|
|
|
|
if (*key == NULL)
|
|
|
|
break;
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
if (strcmp (*key, search_key) == 0)
|
|
|
|
{
|
|
|
|
*pref = p;
|
|
|
|
return TRUE;
|
|
|
|
}
|
2010-04-13 18:40:31 +00:00
|
|
|
|
|
|
|
p = (guchar *)p + pref_size;
|
2010-04-12 21:39:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
2008-06-13 23:10:32 +00:00
|
|
|
/****************************************************************************/
|
|
|
|
/* Updates. */
|
|
|
|
/****************************************************************************/
|
|
|
|
|
2007-04-25 03:30:17 +00:00
|
|
|
|
2010-04-12 21:39:27 +00:00
|
|
|
static void
|
2011-06-24 16:14:15 +00:00
|
|
|
settings_changed (GSettings *settings,
|
|
|
|
gchar *key,
|
|
|
|
gpointer data)
|
2010-04-12 21:39:27 +00:00
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
GVariant *value;
|
|
|
|
const GVariantType *type;
|
|
|
|
MetaEnumPreference *cursor;
|
|
|
|
gboolean found_enum;
|
2010-04-12 21:39:27 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
value = g_settings_get_value (settings, key);
|
|
|
|
type = g_variant_get_type (value);
|
2002-10-07 23:14:40 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
if (g_variant_type_equal (type, G_VARIANT_TYPE_BOOLEAN))
|
|
|
|
handle_preference_update_bool (settings, key);
|
|
|
|
else if (g_variant_type_equal (type, G_VARIANT_TYPE_INT32))
|
|
|
|
handle_preference_update_int (settings, key);
|
2020-02-21 20:03:16 +00:00
|
|
|
else if (g_variant_type_equal (type, G_VARIANT_TYPE_UINT32))
|
|
|
|
handle_preference_update_uint (settings, key);
|
2013-05-12 13:37:05 +00:00
|
|
|
else if (g_variant_type_equal (type, G_VARIANT_TYPE_STRING_ARRAY))
|
|
|
|
handle_preference_update_string_array (settings, key);
|
2011-06-24 16:14:15 +00:00
|
|
|
else if (g_variant_type_equal (type, G_VARIANT_TYPE_STRING))
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
cursor = preferences_enum;
|
|
|
|
found_enum = 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 17:23:09 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
while (cursor->base.key != NULL)
|
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 17:23:09 +00:00
|
|
|
{
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
if (strcmp (key, cursor->base.key) == 0)
|
|
|
|
found_enum = TRUE;
|
2002-11-03 19:06:39 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
cursor++;
|
2002-11-03 19:06:39 +00:00
|
|
|
}
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
if (found_enum)
|
|
|
|
handle_preference_update_enum (settings, key);
|
|
|
|
else
|
|
|
|
handle_preference_update_string (settings, key);
|
2002-11-03 19:06:39 +00:00
|
|
|
}
|
2002-01-27 05:50:34 +00:00
|
|
|
else
|
|
|
|
{
|
2014-08-19 18:06:10 +00:00
|
|
|
/* Unknown preference type. This quite likely simply isn't
|
|
|
|
* a preference we track changes to. */
|
2002-01-27 05:50:34 +00:00
|
|
|
}
|
2008-02-23 21:02:05 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
g_variant_unref (value);
|
2008-02-23 21:02:05 +00:00
|
|
|
}
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
static void
|
|
|
|
bindings_changed (GSettings *settings,
|
|
|
|
gchar *key,
|
|
|
|
gpointer data)
|
2008-02-23 21:02:05 +00:00
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
gchar **strokes;
|
|
|
|
strokes = g_settings_get_strv (settings, key);
|
2008-02-23 21:02:05 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
if (update_key_binding (key, strokes))
|
|
|
|
queue_changed (META_PREF_KEYBINDINGS);
|
2008-02-23 21:02:05 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
g_strfreev (strokes);
|
2008-02-23 21:02:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
* maybe_give_disable_workaround_warning:
|
|
|
|
*
|
2008-02-23 21:02:05 +00:00
|
|
|
* 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;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2008-02-23 21:02:05 +00:00
|
|
|
if (first_disable && disable_workarounds)
|
|
|
|
{
|
|
|
|
first_disable = FALSE;
|
|
|
|
|
2013-09-11 08:37:36 +00:00
|
|
|
meta_warning ("Workarounds for broken applications disabled. "
|
|
|
|
"Some applications may not behave properly.\n");
|
2008-02-23 21:02:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-07 23:14:40 +00:00
|
|
|
MetaVirtualModifier
|
|
|
|
meta_prefs_get_mouse_button_mods (void)
|
|
|
|
{
|
|
|
|
return mouse_button_mods;
|
|
|
|
}
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
GDesktopFocusMode
|
2001-12-09 22:41:12 +00:00
|
|
|
meta_prefs_get_focus_mode (void)
|
|
|
|
{
|
|
|
|
return focus_mode;
|
|
|
|
}
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
GDesktopFocusNewWindows
|
2006-04-12 18:01:20 +00:00
|
|
|
meta_prefs_get_focus_new_windows (void)
|
|
|
|
{
|
|
|
|
return focus_new_windows;
|
|
|
|
}
|
|
|
|
|
2014-04-25 13:26:24 +00:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_center_new_windows (void)
|
|
|
|
{
|
|
|
|
return center_new_windows;
|
|
|
|
}
|
|
|
|
|
2010-09-10 09:55:20 +00:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_attach_modal_dialogs (void)
|
|
|
|
{
|
|
|
|
return attach_modal_dialogs;
|
|
|
|
}
|
|
|
|
|
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 19:35:03 +00:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_raise_on_click (void)
|
|
|
|
{
|
2014-12-29 06:36:27 +00:00
|
|
|
return raise_on_click;
|
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 19:35:03 +00:00
|
|
|
}
|
|
|
|
|
2014-05-23 21:14:51 +00:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_show_fallback_app_menu (void)
|
|
|
|
{
|
|
|
|
return show_fallback_app_menu;
|
|
|
|
}
|
|
|
|
|
2017-08-26 20:43:57 +00:00
|
|
|
void
|
|
|
|
meta_prefs_set_show_fallback_app_menu (gboolean whether)
|
|
|
|
{
|
|
|
|
gboolean changed = FALSE;
|
|
|
|
|
|
|
|
changed = (show_fallback_app_menu == !whether);
|
|
|
|
|
|
|
|
show_fallback_app_menu = whether;
|
|
|
|
|
|
|
|
if (changed)
|
|
|
|
queue_changed (META_PREF_BUTTON_LAYOUT);
|
|
|
|
}
|
|
|
|
|
2005-07-11 13:25:08 +00:00
|
|
|
const char*
|
|
|
|
meta_prefs_get_cursor_theme (void)
|
|
|
|
{
|
|
|
|
return cursor_theme;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
meta_prefs_get_cursor_size (void)
|
|
|
|
{
|
2014-07-28 07:57:08 +00:00
|
|
|
return cursor_size;
|
2005-07-11 13:25:08 +00:00
|
|
|
}
|
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2008-06-13 23:10:32 +00:00
|
|
|
/****************************************************************************/
|
|
|
|
/* Handlers for string preferences. */
|
|
|
|
/****************************************************************************/
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
static gboolean
|
|
|
|
titlebar_handler (GVariant *value,
|
|
|
|
gpointer *result,
|
|
|
|
gpointer data)
|
2001-12-09 22:41:12 +00:00
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
PangoFontDescription *desc;
|
|
|
|
const gchar *string_value;
|
2001-12-09 22:41:12 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
*result = NULL; /* ignored */
|
|
|
|
string_value = g_variant_get_string (value, NULL);
|
|
|
|
desc = pango_font_description_from_string (string_value);
|
2001-12-09 22:41:12 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
if (desc == NULL)
|
2001-12-09 22:41:12 +00:00
|
|
|
{
|
2013-09-11 08:37:36 +00:00
|
|
|
meta_warning ("Could not parse font description "
|
|
|
|
"\"%s\" from GSettings key %s\n",
|
2008-10-27 11:52:47 +00:00
|
|
|
string_value ? string_value : "(null)",
|
2008-03-06 17:59:20 +00:00
|
|
|
KEY_TITLEBAR_FONT);
|
2011-06-24 16:14:15 +00:00
|
|
|
return FALSE;
|
2001-12-09 22:41:12 +00:00
|
|
|
}
|
|
|
|
|
2008-03-06 17:59:20 +00:00
|
|
|
/* Is the new description the same as the old? */
|
|
|
|
if (titlebar_font &&
|
2011-06-24 16:14:15 +00:00
|
|
|
pango_font_description_equal (desc, titlebar_font))
|
2001-12-09 22:41:12 +00:00
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
pango_font_description_free (desc);
|
2001-12-09 22:41:12 +00:00
|
|
|
}
|
2011-06-24 16:14:15 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (titlebar_font)
|
|
|
|
pango_font_description_free (titlebar_font);
|
2008-03-06 17:59:20 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
titlebar_font = desc;
|
|
|
|
queue_changed (META_PREF_TITLEBAR_FONT);
|
|
|
|
}
|
2008-03-06 17:59:20 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
return TRUE;
|
2008-03-06 17:59:20 +00:00
|
|
|
}
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
static gboolean
|
|
|
|
mouse_button_mods_handler (GVariant *value,
|
|
|
|
gpointer *result,
|
|
|
|
gpointer data)
|
2008-03-06 17:59:20 +00:00
|
|
|
{
|
|
|
|
MetaVirtualModifier mods;
|
2011-06-24 16:14:15 +00:00
|
|
|
const gchar *string_value;
|
2001-12-09 22:41:12 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
*result = NULL; /* ignored */
|
|
|
|
string_value = g_variant_get_string (value, NULL);
|
|
|
|
|
2014-04-07 14:48:16 +00:00
|
|
|
if (!string_value || !meta_parse_modifier (string_value, &mods))
|
2008-03-06 17:59:20 +00:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2011-06-24 16:14:15 +00:00
|
|
|
"Failed to parse new GSettings value\n");
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2013-09-11 08:37:36 +00:00
|
|
|
meta_warning ("\"%s\" found in configuration database is "
|
|
|
|
"not a valid value for mouse button modifier\n",
|
2008-03-06 17:59:20 +00:00
|
|
|
string_value);
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
return FALSE;
|
2001-12-09 22:41:12 +00:00
|
|
|
}
|
2011-06-24 16:14:15 +00:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Mouse button modifier has new GSettings value \"%s\"\n",
|
|
|
|
string_value);
|
|
|
|
|
|
|
|
if (mods != mouse_button_mods)
|
|
|
|
{
|
|
|
|
mouse_button_mods = mods;
|
|
|
|
queue_changed (META_PREF_MOUSE_BUTTON_MODS);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2001-12-09 22:41:12 +00:00
|
|
|
}
|
|
|
|
|
2002-10-12 17:44:55 +00:00
|
|
|
static gboolean
|
|
|
|
button_layout_equal (const MetaButtonLayout *a,
|
|
|
|
const MetaButtonLayout *b)
|
2014-05-02 13:34:02 +00:00
|
|
|
{
|
2002-10-12 17:44:55 +00:00
|
|
|
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 20:41:07 +00: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 17:44:55 +00:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
/*
|
|
|
|
* This conversion cannot be handled by GSettings since
|
|
|
|
* several values are stored in the same key (as a string).
|
|
|
|
*/
|
2002-10-12 17:44:55 +00:00
|
|
|
static MetaButtonFunction
|
|
|
|
button_function_from_string (const char *str)
|
|
|
|
{
|
|
|
|
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;
|
2014-05-02 13:34:02 +00:00
|
|
|
else
|
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 16:56:47 +00:00
|
|
|
/* don't know; give up */
|
2002-10-12 17:44:55 +00:00
|
|
|
return META_BUTTON_FUNCTION_LAST;
|
|
|
|
}
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
static gboolean
|
|
|
|
button_layout_handler (GVariant *value,
|
|
|
|
gpointer *result,
|
|
|
|
gpointer data)
|
2002-10-12 17:44:55 +00:00
|
|
|
{
|
|
|
|
MetaButtonLayout new_layout;
|
2011-06-24 16:14:15 +00:00
|
|
|
const gchar *string_value;
|
2008-10-27 11:52:47 +00:00
|
|
|
char **sides = NULL;
|
2002-10-12 17:44:55 +00:00
|
|
|
int i;
|
2011-06-24 16:14:15 +00:00
|
|
|
|
2002-10-12 17:44:55 +00:00
|
|
|
/* We need to ignore unknown button functions, for
|
|
|
|
* compat with future versions
|
|
|
|
*/
|
2011-06-24 16:14:15 +00:00
|
|
|
|
|
|
|
*result = NULL; /* ignored */
|
|
|
|
string_value = g_variant_get_string (value, NULL);
|
|
|
|
|
2008-10-27 11:52:47 +00:00
|
|
|
if (string_value)
|
|
|
|
sides = g_strsplit (string_value, ":", 2);
|
2002-10-12 17:44:55 +00:00
|
|
|
|
2011-07-23 21:58:06 +00:00
|
|
|
i = 0;
|
2008-10-27 11:52:47 +00:00
|
|
|
if (sides != NULL && sides[0] != NULL)
|
2002-10-12 17:44:55 +00:00
|
|
|
{
|
|
|
|
char **buttons;
|
|
|
|
int b;
|
|
|
|
gboolean used[META_BUTTON_FUNCTION_LAST];
|
|
|
|
|
|
|
|
while (i < META_BUTTON_FUNCTION_LAST)
|
|
|
|
{
|
|
|
|
used[i] = FALSE;
|
2008-02-29 20:41:07 +00:00
|
|
|
new_layout.left_buttons_has_spacer[i] = FALSE;
|
2002-10-12 17:44:55 +00:00
|
|
|
++i;
|
|
|
|
}
|
2011-06-24 16:14:15 +00:00
|
|
|
|
2002-10-12 17:44:55 +00:00
|
|
|
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 20:41:07 +00:00
|
|
|
if (i > 0 && strcmp("spacer", buttons[b]) == 0)
|
2002-10-12 17:44:55 +00:00
|
|
|
{
|
2008-02-29 20:41:07 +00:00
|
|
|
new_layout.left_buttons_has_spacer[i-1] = TRUE;
|
2002-10-12 17:44:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-02-29 20:41:07 +00:00
|
|
|
if (f != META_BUTTON_FUNCTION_LAST && !used[f])
|
|
|
|
{
|
|
|
|
new_layout.left_buttons[i] = f;
|
|
|
|
used[f] = TRUE;
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_PREFS, "Ignoring unknown or already-used button name \"%s\"\n",
|
|
|
|
buttons[b]);
|
|
|
|
}
|
2002-10-12 17:44:55 +00:00
|
|
|
}
|
2011-06-24 16:14:15 +00:00
|
|
|
|
2002-10-12 17:44:55 +00:00
|
|
|
++b;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_strfreev (buttons);
|
|
|
|
}
|
|
|
|
|
2012-11-28 22:04:17 +00:00
|
|
|
for (; i < MAX_BUTTONS_PER_CORNER; i++)
|
|
|
|
{
|
|
|
|
new_layout.left_buttons[i] = META_BUTTON_FUNCTION_LAST;
|
|
|
|
new_layout.left_buttons_has_spacer[i] = FALSE;
|
|
|
|
}
|
2011-07-23 21:58:06 +00:00
|
|
|
|
|
|
|
i = 0;
|
2008-10-27 11:52:47 +00:00
|
|
|
if (sides != NULL && sides[0] != NULL && sides[1] != NULL)
|
2002-10-12 17:44:55 +00:00
|
|
|
{
|
|
|
|
char **buttons;
|
|
|
|
int b;
|
|
|
|
gboolean used[META_BUTTON_FUNCTION_LAST];
|
|
|
|
|
|
|
|
while (i < META_BUTTON_FUNCTION_LAST)
|
|
|
|
{
|
|
|
|
used[i] = FALSE;
|
2008-02-29 20:41:07 +00:00
|
|
|
new_layout.right_buttons_has_spacer[i] = FALSE;
|
2002-10-12 17:44:55 +00:00
|
|
|
++i;
|
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-12 17:44:55 +00:00
|
|
|
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 20:41:07 +00:00
|
|
|
if (i > 0 && strcmp("spacer", buttons[b]) == 0)
|
2002-10-12 17:44:55 +00:00
|
|
|
{
|
2008-02-29 20:41:07 +00:00
|
|
|
new_layout.right_buttons_has_spacer[i-1] = TRUE;
|
|
|
|
}
|
2002-10-12 17:44:55 +00:00
|
|
|
else
|
|
|
|
{
|
2008-02-29 20:41:07 +00:00
|
|
|
if (f != META_BUTTON_FUNCTION_LAST && !used[f])
|
|
|
|
{
|
|
|
|
new_layout.right_buttons[i] = f;
|
|
|
|
used[f] = TRUE;
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_PREFS, "Ignoring unknown or already-used button name \"%s\"\n",
|
|
|
|
buttons[b]);
|
|
|
|
}
|
2002-10-12 17:44:55 +00:00
|
|
|
}
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-10-12 17:44:55 +00:00
|
|
|
++b;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_strfreev (buttons);
|
|
|
|
}
|
|
|
|
|
2012-11-28 22:04:17 +00:00
|
|
|
for (; i < MAX_BUTTONS_PER_CORNER; i++)
|
|
|
|
{
|
|
|
|
new_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST;
|
|
|
|
new_layout.right_buttons_has_spacer[i] = FALSE;
|
|
|
|
}
|
2011-07-23 21:58:06 +00:00
|
|
|
|
2002-10-12 17:44:55 +00:00
|
|
|
g_strfreev (sides);
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2007-07-22 06:39:29 +00:00
|
|
|
/* Invert the button layout for RTL languages */
|
2014-08-18 02:57:51 +00:00
|
|
|
if (meta_get_locale_direction() == META_LOCALE_DIRECTION_RTL)
|
2014-08-18 03:00:05 +00:00
|
|
|
{
|
|
|
|
MetaButtonLayout rtl_layout;
|
|
|
|
int j;
|
|
|
|
|
|
|
|
for (i = 0; new_layout.left_buttons[i] != META_BUTTON_FUNCTION_LAST; i++);
|
|
|
|
for (j = 0; j < i; j++)
|
|
|
|
{
|
|
|
|
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];
|
|
|
|
}
|
|
|
|
for (; j < MAX_BUTTONS_PER_CORNER; j++)
|
|
|
|
{
|
|
|
|
rtl_layout.right_buttons[j] = META_BUTTON_FUNCTION_LAST;
|
|
|
|
rtl_layout.right_buttons_has_spacer[j] = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; new_layout.right_buttons[i] != META_BUTTON_FUNCTION_LAST; i++);
|
|
|
|
for (j = 0; j < i; j++)
|
|
|
|
{
|
|
|
|
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];
|
|
|
|
}
|
|
|
|
for (; j < MAX_BUTTONS_PER_CORNER; j++)
|
|
|
|
{
|
|
|
|
rtl_layout.left_buttons[j] = META_BUTTON_FUNCTION_LAST;
|
|
|
|
rtl_layout.left_buttons_has_spacer[j] = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
new_layout = rtl_layout;
|
|
|
|
}
|
2011-06-24 16:14:15 +00:00
|
|
|
|
|
|
|
if (!button_layout_equal (&button_layout, &new_layout))
|
2008-03-06 17:59:20 +00:00
|
|
|
{
|
|
|
|
button_layout = new_layout;
|
2011-06-24 16:14:15 +00:00
|
|
|
emit_changed (META_PREF_BUTTON_LAYOUT);
|
2008-03-06 17:59:20 +00:00
|
|
|
}
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2002-10-12 17:44:55 +00:00
|
|
|
|
2012-08-10 21:22:46 +00:00
|
|
|
static gboolean
|
|
|
|
overlay_key_handler (GVariant *value,
|
|
|
|
gpointer *result,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
MetaKeyCombo combo;
|
|
|
|
const gchar *string_value;
|
|
|
|
|
|
|
|
*result = NULL; /* ignored */
|
|
|
|
string_value = g_variant_get_string (value, NULL);
|
|
|
|
|
2015-01-07 02:59:53 +00:00
|
|
|
if (string_value && meta_parse_accelerator (string_value, &combo))
|
2012-08-10 21:22:46 +00:00
|
|
|
;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Failed to parse value for overlay-key\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2015-01-07 02:59:53 +00:00
|
|
|
combo.modifiers = 0;
|
|
|
|
|
2012-08-10 21:22:46 +00:00
|
|
|
if (overlay_key_combo.keysym != combo.keysym ||
|
2015-01-07 02:35:32 +00:00
|
|
|
overlay_key_combo.keycode != combo.keycode)
|
2012-08-10 21:22:46 +00:00
|
|
|
{
|
|
|
|
overlay_key_combo = combo;
|
|
|
|
queue_changed (META_PREF_KEYBINDINGS);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-02-20 10:53:54 +00:00
|
|
|
static gboolean
|
|
|
|
locate_pointer_key_handler (GVariant *value,
|
|
|
|
gpointer *result,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
MetaKeyCombo combo;
|
|
|
|
const gchar *string_value;
|
|
|
|
|
|
|
|
*result = NULL; /* ignored */
|
|
|
|
string_value = g_variant_get_string (value, NULL);
|
|
|
|
|
|
|
|
if (!string_value || !meta_parse_accelerator (string_value, &combo))
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Failed to parse value for locate-pointer-key\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
combo.modifiers = 0;
|
|
|
|
|
|
|
|
if (locate_pointer_key_combo.keysym != combo.keysym ||
|
|
|
|
locate_pointer_key_combo.keycode != combo.keycode)
|
|
|
|
{
|
|
|
|
locate_pointer_key_combo = combo;
|
|
|
|
queue_changed (META_PREF_KEYBINDINGS);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-04-10 09:57:16 +00:00
|
|
|
static gboolean
|
|
|
|
iso_next_group_handler (GVariant *value,
|
|
|
|
gpointer *result,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
const char **xkb_options, **p;
|
|
|
|
const char *option = NULL;
|
|
|
|
gboolean changed = FALSE;
|
|
|
|
|
|
|
|
*result = NULL; /* ignored */
|
|
|
|
xkb_options = g_variant_get_strv (value, NULL);
|
|
|
|
|
|
|
|
for (p = xkb_options; p && *p; ++p)
|
|
|
|
if (g_str_has_prefix (*p, "grp:"))
|
|
|
|
{
|
|
|
|
option = (*p + 4);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
changed = (g_strcmp0 (option, iso_next_group_option) != 0);
|
|
|
|
|
|
|
|
if (changed)
|
|
|
|
{
|
|
|
|
g_free (iso_next_group_option);
|
|
|
|
iso_next_group_option = g_strdup (option);
|
|
|
|
queue_changed (META_PREF_KEYBINDINGS);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (xkb_options);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
const PangoFontDescription*
|
|
|
|
meta_prefs_get_titlebar_font (void)
|
|
|
|
{
|
2002-05-24 02:55:54 +00:00
|
|
|
if (use_system_font)
|
2001-12-09 22:41:12 +00:00
|
|
|
return NULL;
|
|
|
|
else
|
|
|
|
return titlebar_font;
|
|
|
|
}
|
|
|
|
|
2001-12-10 03:55:26 +00:00
|
|
|
int
|
|
|
|
meta_prefs_get_num_workspaces (void)
|
|
|
|
{
|
|
|
|
return num_workspaces;
|
|
|
|
}
|
|
|
|
|
2012-03-08 00:29:58 +00:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_dynamic_workspaces (void)
|
|
|
|
{
|
|
|
|
return dynamic_workspaces;
|
|
|
|
}
|
|
|
|
|
2002-05-01 03:23:46 +00:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_disable_workarounds (void)
|
|
|
|
{
|
|
|
|
return disable_workarounds;
|
|
|
|
}
|
|
|
|
|
2002-12-08 19:17:17 +00:00
|
|
|
#ifdef WITH_VERBOSE_MODE
|
2001-12-09 22:41:12 +00:00
|
|
|
const char*
|
|
|
|
meta_preference_to_string (MetaPreference pref)
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
/* TODO: better handled via GLib enum nicknames */
|
2001-12-09 22:41:12 +00:00
|
|
|
switch (pref)
|
|
|
|
{
|
2002-10-07 23:14:40 +00:00
|
|
|
case META_PREF_MOUSE_BUTTON_MODS:
|
|
|
|
return "MOUSE_BUTTON_MODS";
|
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
case META_PREF_FOCUS_MODE:
|
|
|
|
return "FOCUS_MODE";
|
|
|
|
|
2006-04-12 18:01:20 +00:00
|
|
|
case META_PREF_FOCUS_NEW_WINDOWS:
|
|
|
|
return "FOCUS_NEW_WINDOWS";
|
|
|
|
|
2014-04-25 13:26:24 +00:00
|
|
|
case META_PREF_CENTER_NEW_WINDOWS:
|
|
|
|
return "CENTER_NEW_WINDOWS";
|
|
|
|
|
2010-09-10 09:55:20 +00:00
|
|
|
case META_PREF_ATTACH_MODAL_DIALOGS:
|
|
|
|
return "ATTACH_MODAL_DIALOGS";
|
|
|
|
|
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 19:35:03 +00:00
|
|
|
case META_PREF_RAISE_ON_CLICK:
|
|
|
|
return "RAISE_ON_CLICK";
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
case META_PREF_TITLEBAR_FONT:
|
|
|
|
return "TITLEBAR_FONT";
|
|
|
|
|
2001-12-10 03:55:26 +00:00
|
|
|
case META_PREF_NUM_WORKSPACES:
|
|
|
|
return "NUM_WORKSPACES";
|
2002-01-27 05:50:34 +00:00
|
|
|
|
2008-11-22 19:02:54 +00:00
|
|
|
case META_PREF_KEYBINDINGS:
|
|
|
|
return "KEYBINDINGS";
|
2002-05-01 03:23:46 +00:00
|
|
|
|
|
|
|
case META_PREF_DISABLE_WORKAROUNDS:
|
|
|
|
return "DISABLE_WORKAROUNDS";
|
2002-05-24 02:23:46 +00:00
|
|
|
|
2002-10-18 21:22:27 +00:00
|
|
|
case META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR:
|
|
|
|
return "ACTION_DOUBLE_CLICK_TITLEBAR";
|
|
|
|
|
2007-04-25 03:30:17 +00: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-24 02:23:46 +00:00
|
|
|
case META_PREF_AUTO_RAISE:
|
|
|
|
return "AUTO_RAISE";
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2002-05-24 02:23:46 +00:00
|
|
|
case META_PREF_AUTO_RAISE_DELAY:
|
|
|
|
return "AUTO_RAISE_DELAY";
|
2002-07-11 04:10:44 +00:00
|
|
|
|
2012-08-29 02:38:54 +00:00
|
|
|
case META_PREF_FOCUS_CHANGE_ON_POINTER_REST:
|
|
|
|
return "FOCUS_CHANGE_ON_POINTER_REST";
|
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
case META_PREF_BUTTON_LAYOUT:
|
|
|
|
return "BUTTON_LAYOUT";
|
2002-11-20 03:57:20 +00:00
|
|
|
|
|
|
|
case META_PREF_WORKSPACE_NAMES:
|
|
|
|
return "WORKSPACE_NAMES";
|
2003-01-28 15:07:43 +00: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 06:25:38 +00:00
|
|
|
|
2005-01-26 08:43:38 +00:00
|
|
|
case META_PREF_GNOME_ACCESSIBILITY:
|
|
|
|
return "GNOME_ACCESSIBILTY";
|
2006-01-20 22:03:56 +00:00
|
|
|
|
2008-06-29 21:57:39 +00:00
|
|
|
case META_PREF_GNOME_ANIMATIONS:
|
|
|
|
return "GNOME_ANIMATIONS";
|
|
|
|
|
2005-10-25 16:43:01 +00:00
|
|
|
case META_PREF_CURSOR_THEME:
|
|
|
|
return "CURSOR_THEME";
|
2006-01-20 22:03:56 +00:00
|
|
|
|
2005-10-25 16:43:01 +00:00
|
|
|
case META_PREF_CURSOR_SIZE:
|
|
|
|
return "CURSOR_SIZE";
|
2006-02-16 20:26:05 +00:00
|
|
|
|
2009-01-27 21:05:42 +00:00
|
|
|
case META_PREF_RESIZE_WITH_RIGHT_BUTTON:
|
|
|
|
return "RESIZE_WITH_RIGHT_BUTTON";
|
2009-05-07 21:56:27 +00:00
|
|
|
|
2010-09-24 18:28:12 +00:00
|
|
|
case META_PREF_EDGE_TILING:
|
|
|
|
return "EDGE_TILING";
|
2010-06-24 18:41:28 +00:00
|
|
|
|
2009-06-19 15:30:37 +00:00
|
|
|
case META_PREF_FORCE_FULLSCREEN:
|
|
|
|
return "FORCE_FULLSCREEN";
|
|
|
|
|
2011-02-28 12:48:28 +00:00
|
|
|
case META_PREF_WORKSPACES_ONLY_ON_PRIMARY:
|
|
|
|
return "WORKSPACES_ONLY_ON_PRIMARY";
|
|
|
|
|
2011-07-20 06:14:58 +00:00
|
|
|
case META_PREF_DRAGGABLE_BORDER_WIDTH:
|
|
|
|
return "DRAGGABLE_BORDER_WIDTH";
|
2012-03-12 00:00:47 +00:00
|
|
|
|
2014-08-15 22:21:13 +00:00
|
|
|
case META_PREF_DRAG_THRESHOLD:
|
2016-06-18 00:08:20 +00:00
|
|
|
return "DRAG_THRESHOLD";
|
2014-08-15 22:21:13 +00:00
|
|
|
|
2012-03-12 00:00:47 +00:00
|
|
|
case META_PREF_DYNAMIC_WORKSPACES:
|
|
|
|
return "DYNAMIC_WORKSPACES";
|
2012-09-08 09:34:27 +00:00
|
|
|
|
|
|
|
case META_PREF_AUTO_MAXIMIZE:
|
|
|
|
return "AUTO_MAXIMIZE";
|
2019-07-15 11:13:45 +00:00
|
|
|
|
|
|
|
case META_PREF_LOCATE_POINTER:
|
|
|
|
return "LOCATE_POINTER";
|
2020-02-21 20:03:16 +00:00
|
|
|
|
|
|
|
case META_PREF_CHECK_ALIVE_TIMEOUT:
|
|
|
|
return "CHECK_ALIVE_TIMEOUT";
|
2001-12-09 22:41:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return "(unknown)";
|
|
|
|
}
|
2002-12-08 19:17:17 +00:00
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
2002-03-10 18:36:08 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
meta_prefs_set_num_workspaces (int n_workspaces)
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
MetaBasePreference *pref;
|
2002-03-10 18:36:08 +00:00
|
|
|
|
2013-04-17 08:04:49 +00:00
|
|
|
if (find_pref (preferences_int, sizeof(MetaIntPreference),
|
|
|
|
KEY_NUM_WORKSPACES, &pref))
|
|
|
|
{
|
|
|
|
g_settings_set_int (SETTINGS (pref->schema),
|
|
|
|
KEY_NUM_WORKSPACES,
|
|
|
|
n_workspaces);
|
|
|
|
}
|
2002-03-10 18:36:08 +00:00
|
|
|
}
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
static GHashTable *key_bindings;
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
static void
|
|
|
|
meta_key_pref_free (MetaKeyPref *pref)
|
|
|
|
{
|
|
|
|
update_binding (pref, NULL);
|
|
|
|
|
|
|
|
g_free (pref->name);
|
2012-03-27 14:42:42 +00:00
|
|
|
g_object_unref (pref->settings);
|
2011-10-28 01:05:43 +00:00
|
|
|
|
|
|
|
g_free (pref);
|
|
|
|
}
|
|
|
|
|
2008-12-02 23:13:11 +00:00
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
static void
|
|
|
|
init_bindings (void)
|
|
|
|
{
|
2012-08-29 21:07:34 +00:00
|
|
|
MetaKeyPref *pref;
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
key_bindings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
|
|
|
|
(GDestroyNotify)meta_key_pref_free);
|
2012-08-29 21:07:34 +00:00
|
|
|
|
|
|
|
pref = g_new0 (MetaKeyPref, 1);
|
|
|
|
pref->name = g_strdup ("overlay-key");
|
|
|
|
pref->action = META_KEYBINDING_ACTION_OVERLAY_KEY;
|
2014-02-25 18:49:16 +00:00
|
|
|
pref->combos = g_slist_prepend (pref->combos, &overlay_key_combo);
|
2012-08-29 21:07:34 +00:00
|
|
|
pref->builtin = 1;
|
|
|
|
|
2019-05-16 08:58:27 +00:00
|
|
|
g_hash_table_insert (key_bindings, g_strdup (pref->name), pref);
|
2019-02-20 10:53:54 +00:00
|
|
|
|
|
|
|
pref = g_new0 (MetaKeyPref, 1);
|
|
|
|
pref->name = g_strdup ("locate-pointer-key");
|
|
|
|
pref->action = META_KEYBINDING_ACTION_LOCATE_POINTER_KEY;
|
|
|
|
pref->combos = g_slist_prepend (pref->combos, &locate_pointer_key_combo);
|
|
|
|
pref->builtin = 1;
|
|
|
|
|
2019-05-16 08:58:27 +00:00
|
|
|
g_hash_table_insert (key_bindings, g_strdup (pref->name), pref);
|
2002-07-11 04:10:44 +00:00
|
|
|
}
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
static gboolean
|
|
|
|
update_binding (MetaKeyPref *binding,
|
2011-06-24 16:14:15 +00:00
|
|
|
gchar **strokes)
|
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 17:23:09 +00:00
|
|
|
{
|
2014-02-25 18:49:16 +00:00
|
|
|
GSList *old_combos, *a, *b;
|
2013-03-31 18:18:54 +00:00
|
|
|
gboolean changed;
|
2011-06-24 16:14:15 +00:00
|
|
|
int i;
|
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 17:23:09 +00:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2011-06-24 16:14:15 +00:00
|
|
|
"Binding \"%s\" has new GSettings value\n",
|
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 17:23:09 +00:00
|
|
|
binding->name);
|
2011-06-24 16:14:15 +00:00
|
|
|
|
2014-02-25 18:49:16 +00:00
|
|
|
old_combos = binding->combos;
|
|
|
|
binding->combos = NULL;
|
2013-03-31 18:18:54 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
for (i = 0; strokes && strokes[i]; i++)
|
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 17:23:09 +00:00
|
|
|
{
|
2015-01-07 02:59:53 +00:00
|
|
|
MetaKeyCombo *combo;
|
|
|
|
|
|
|
|
combo = g_malloc0 (sizeof (MetaKeyCombo));
|
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 17:23:09 +00:00
|
|
|
|
2015-01-07 02:59:53 +00:00
|
|
|
if (!meta_parse_accelerator (strokes[i], combo))
|
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 17:23:09 +00:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2011-06-24 16:14:15 +00:00
|
|
|
"Failed to parse new GSettings value\n");
|
2013-09-11 08:37:36 +00:00
|
|
|
meta_warning ("\"%s\" found in configuration database is not a valid value for keybinding \"%s\"\n",
|
2011-06-24 16:14:15 +00:00
|
|
|
strokes[i], binding->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 17:23:09 +00:00
|
|
|
|
2015-01-07 02:59:53 +00:00
|
|
|
g_free (combo);
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
/* Value is kept and will thus be removed next time we save the key.
|
|
|
|
* Changing the key in response to a modification could lead to cyclic calls. */
|
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 17:23:09 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-02-25 18:49:16 +00:00
|
|
|
binding->combos = g_slist_prepend (binding->combos, combo);
|
2011-06-24 16:14:15 +00: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 17:23:09 +00:00
|
|
|
|
2014-02-25 18:49:16 +00:00
|
|
|
binding->combos = g_slist_reverse (binding->combos);
|
2013-02-17 20:50:08 +00:00
|
|
|
|
2014-02-25 18:49:16 +00:00
|
|
|
a = old_combos;
|
|
|
|
b = binding->combos;
|
2013-03-31 18:18:54 +00:00
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
if ((!a && b) || (a && !b))
|
|
|
|
{
|
|
|
|
changed = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (!a && !b)
|
|
|
|
{
|
|
|
|
changed = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (memcmp (a->data, b->data, sizeof (MetaKeyCombo)) != 0)
|
|
|
|
{
|
|
|
|
changed = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
a = a->next;
|
|
|
|
b = b->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-25 18:49:16 +00:00
|
|
|
g_slist_free_full (old_combos, g_free);
|
2013-03-31 18:18:54 +00: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 17:23:09 +00:00
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
static gboolean
|
2010-02-16 16:57:00 +00:00
|
|
|
update_key_binding (const char *key,
|
2011-06-24 16:14:15 +00:00
|
|
|
gchar **strokes)
|
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 17:23:09 +00:00
|
|
|
{
|
2011-10-28 01:05:43 +00:00
|
|
|
MetaKeyPref *pref = g_hash_table_lookup (key_bindings, key);
|
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 17:23:09 +00:00
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
if (pref)
|
|
|
|
return update_binding (pref, strokes);
|
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 17:23:09 +00:00
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-10-13 08:32:10 +00:00
|
|
|
const char*
|
2011-06-24 16:14:15 +00:00
|
|
|
meta_prefs_get_workspace_name (int i)
|
2004-10-13 08:32:10 +00:00
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
const char *name;
|
2004-10-13 08:32:10 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
if (!workspace_names ||
|
|
|
|
g_strv_length (workspace_names) < (guint)i + 1 ||
|
|
|
|
!*workspace_names[i])
|
2002-11-03 19:06:39 +00:00
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
char *generated_name = g_strdup_printf (_("Workspace %d"), i + 1);
|
|
|
|
name = g_intern_string (generated_name);
|
|
|
|
g_free (generated_name);
|
2002-11-20 03:57:20 +00:00
|
|
|
}
|
2002-11-03 19:06:39 +00:00
|
|
|
else
|
2011-06-24 16:14:15 +00:00
|
|
|
name = workspace_names[i];
|
2002-11-20 03:57:20 +00:00
|
|
|
|
2002-11-03 19:06:39 +00:00
|
|
|
meta_topic (META_DEBUG_PREFS,
|
2011-06-24 16:14:15 +00:00
|
|
|
"Getting name of workspace %d: \"%s\"\n", i, name);
|
2002-11-03 19:06:39 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
return name;
|
2002-11-03 19:06:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2011-06-24 16:14:15 +00:00
|
|
|
meta_prefs_change_workspace_name (int num,
|
2002-11-03 19:06:39 +00:00
|
|
|
const char *name)
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
GVariantBuilder builder;
|
|
|
|
int n_workspace_names, i;
|
2014-05-02 13:34:02 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
g_return_if_fail (num >= 0);
|
2002-11-03 19:06:39 +00:00
|
|
|
|
2002-11-20 04:54:01 +00:00
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
"Changing name of workspace %d to %s\n",
|
2011-06-24 16:14:15 +00:00
|
|
|
num, name ? name : "none");
|
2002-11-20 04:54:01 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
/* NULL and empty string both mean "default" here,
|
|
|
|
* and we also need to match the name against its default value
|
|
|
|
* to avoid saving it literally. */
|
|
|
|
if (g_strcmp0 (name, meta_prefs_get_workspace_name (num)) == 0)
|
2002-11-03 19:06:39 +00:00
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
if (!name || !*name)
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
"Workspace %d already uses default name\n", num);
|
|
|
|
else
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
"Workspace %d already has name %s\n", num, name);
|
2002-11-03 19:06:39 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
g_variant_builder_init (&builder, G_VARIANT_TYPE_STRING_ARRAY);
|
|
|
|
n_workspace_names = workspace_names ? g_strv_length (workspace_names) : 0;
|
2002-11-03 19:06:39 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
for (i = 0; i < MAX (num + 1, n_workspace_names); i++)
|
2002-11-03 19:06:39 +00:00
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
const char *value;
|
|
|
|
|
|
|
|
if (i == num)
|
|
|
|
value = name ? name : "";
|
|
|
|
else if (i < n_workspace_names)
|
|
|
|
value = workspace_names[i] ? workspace_names[i] : "";
|
|
|
|
else
|
|
|
|
value = "";
|
|
|
|
|
|
|
|
g_variant_builder_add (&builder, "s", value);
|
2002-11-03 19:06:39 +00:00
|
|
|
}
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
g_settings_set_value (SETTINGS (SCHEMA_GENERAL), KEY_WORKSPACE_NAMES,
|
|
|
|
g_variant_builder_end (&builder));
|
2002-11-03 19:06:39 +00:00
|
|
|
}
|
|
|
|
|
2012-11-28 22:32:09 +00:00
|
|
|
/**
|
|
|
|
* meta_prefs_get_button_layout:
|
|
|
|
* @button_layout: (out):
|
|
|
|
*/
|
2002-10-04 02:28:57 +00:00
|
|
|
void
|
2002-10-12 17:44:55 +00:00
|
|
|
meta_prefs_get_button_layout (MetaButtonLayout *button_layout_p)
|
2002-10-04 02:28:57 +00:00
|
|
|
{
|
2002-10-12 17:44:55 +00:00
|
|
|
*button_layout_p = button_layout;
|
2002-10-04 02:28:57 +00:00
|
|
|
}
|
|
|
|
|
2011-11-14 14:22:30 +00:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_visual_bell (void)
|
|
|
|
{
|
|
|
|
return bell_is_visible;
|
|
|
|
}
|
|
|
|
|
2003-01-28 15:07:43 +00: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 23:18:22 +00:00
|
|
|
meta_prefs_bell_is_audible (void)
|
2003-01-28 15:07:43 +00:00
|
|
|
{
|
|
|
|
return bell_is_audible;
|
|
|
|
}
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
GDesktopVisualBellType
|
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 23:18:22 +00:00
|
|
|
meta_prefs_get_visual_bell_type (void)
|
2003-01-28 15:07:43 +00:00
|
|
|
{
|
|
|
|
return visual_bell_type;
|
|
|
|
}
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
gboolean
|
|
|
|
meta_prefs_add_keybinding (const char *name,
|
2012-03-27 14:42:42 +00:00
|
|
|
GSettings *settings,
|
2011-10-28 01:05:43 +00:00
|
|
|
MetaKeyBindingAction action,
|
|
|
|
MetaKeyBindingFlags flags)
|
2002-04-28 04:52:26 +00:00
|
|
|
{
|
2011-10-28 01:05:43 +00:00
|
|
|
MetaKeyPref *pref;
|
|
|
|
char **strokes;
|
2012-03-27 14:42:42 +00:00
|
|
|
guint id;
|
2011-10-28 01:05:43 +00:00
|
|
|
|
|
|
|
if (g_hash_table_lookup (key_bindings, name))
|
|
|
|
{
|
|
|
|
meta_warning ("Trying to re-add keybinding \"%s\".\n", name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
pref = g_new0 (MetaKeyPref, 1);
|
|
|
|
pref->name = g_strdup (name);
|
2012-03-27 14:42:42 +00:00
|
|
|
pref->settings = g_object_ref (settings);
|
2011-10-28 01:05:43 +00:00
|
|
|
pref->action = action;
|
2014-02-25 18:49:16 +00:00
|
|
|
pref->combos = NULL;
|
2011-11-04 18:18:57 +00:00
|
|
|
pref->builtin = (flags & META_KEY_BINDING_BUILTIN) != 0;
|
2011-10-28 01:05:43 +00:00
|
|
|
|
2012-03-27 14:42:42 +00:00
|
|
|
if (pref->builtin)
|
|
|
|
{
|
|
|
|
if (g_object_get_data (G_OBJECT (settings), "changed-signal") == NULL)
|
|
|
|
{
|
|
|
|
id = g_signal_connect (settings, "changed",
|
|
|
|
G_CALLBACK (bindings_changed), NULL);
|
|
|
|
g_object_set_data (G_OBJECT (settings), "changed-signal", GUINT_TO_POINTER (id));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2011-11-04 18:18:57 +00:00
|
|
|
{
|
|
|
|
char *changed_signal = g_strdup_printf ("changed::%s", name);
|
|
|
|
id = g_signal_connect (settings, changed_signal,
|
|
|
|
G_CALLBACK (bindings_changed), NULL);
|
|
|
|
g_free (changed_signal);
|
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (settings), name, GUINT_TO_POINTER (id));
|
|
|
|
|
|
|
|
queue_changed (META_PREF_KEYBINDINGS);
|
|
|
|
}
|
|
|
|
|
2015-03-20 19:49:45 +00:00
|
|
|
strokes = g_settings_get_strv (settings, name);
|
|
|
|
update_binding (pref, strokes);
|
|
|
|
g_strfreev (strokes);
|
|
|
|
|
|
|
|
g_hash_table_insert (key_bindings, g_strdup (name), pref);
|
|
|
|
|
2011-11-04 18:18:57 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_prefs_remove_keybinding (const char *name)
|
|
|
|
{
|
|
|
|
MetaKeyPref *pref;
|
2019-11-16 00:25:52 +00:00
|
|
|
gulong id;
|
2011-11-04 18:18:57 +00:00
|
|
|
|
|
|
|
pref = g_hash_table_lookup (key_bindings, name);
|
|
|
|
if (!pref)
|
|
|
|
{
|
|
|
|
meta_warning ("Trying to remove non-existent keybinding \"%s\".\n", name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pref->builtin)
|
|
|
|
{
|
|
|
|
meta_warning ("Trying to remove builtin keybinding \"%s\".\n", name);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2012-03-27 14:42:42 +00:00
|
|
|
id = GPOINTER_TO_UINT (g_object_steal_data (G_OBJECT (pref->settings), name));
|
2019-11-16 00:25:52 +00:00
|
|
|
g_clear_signal_handler (&id, pref->settings);
|
2011-11-04 18:18:57 +00:00
|
|
|
|
|
|
|
g_hash_table_remove (key_bindings, name);
|
|
|
|
|
|
|
|
queue_changed (META_PREF_KEYBINDINGS);
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GList *
|
2015-01-07 01:58:42 +00:00
|
|
|
meta_prefs_get_keybindings (void)
|
2011-10-28 01:05:43 +00:00
|
|
|
{
|
|
|
|
return g_hash_table_get_values (key_bindings);
|
2002-04-28 04:52:26 +00:00
|
|
|
}
|
2002-10-18 21:22:27 +00:00
|
|
|
|
2014-05-02 13:34:02 +00:00
|
|
|
void
|
2008-12-02 23:13:11 +00:00
|
|
|
meta_prefs_get_overlay_binding (MetaKeyCombo *combo)
|
|
|
|
{
|
|
|
|
*combo = overlay_key_combo;
|
|
|
|
}
|
|
|
|
|
2019-02-20 10:53:54 +00:00
|
|
|
void
|
|
|
|
meta_prefs_get_locate_pointer_binding (MetaKeyCombo *combo)
|
|
|
|
{
|
|
|
|
*combo = locate_pointer_key_combo;
|
|
|
|
}
|
|
|
|
|
2019-07-15 11:13:45 +00:00
|
|
|
gboolean
|
|
|
|
meta_prefs_is_locate_pointer_enabled (void)
|
|
|
|
{
|
|
|
|
return locate_pointer_is_enabled;
|
|
|
|
}
|
|
|
|
|
2020-02-21 20:03:16 +00:00
|
|
|
unsigned int
|
|
|
|
meta_prefs_get_check_alive_timeout (void)
|
|
|
|
{
|
|
|
|
return check_alive_timeout;
|
|
|
|
}
|
|
|
|
|
2013-04-10 09:57:16 +00:00
|
|
|
const char *
|
|
|
|
meta_prefs_get_iso_next_group_option (void)
|
|
|
|
{
|
|
|
|
return iso_next_group_option;
|
|
|
|
}
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
GDesktopTitlebarAction
|
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 23:18:22 +00:00
|
|
|
meta_prefs_get_action_double_click_titlebar (void)
|
2002-10-18 21:22:27 +00:00
|
|
|
{
|
|
|
|
return action_double_click_titlebar;
|
|
|
|
}
|
2002-04-28 04:52:26 +00:00
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
GDesktopTitlebarAction
|
2007-03-10 01:15:14 +00:00
|
|
|
meta_prefs_get_action_middle_click_titlebar (void)
|
|
|
|
{
|
|
|
|
return action_middle_click_titlebar;
|
|
|
|
}
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
GDesktopTitlebarAction
|
2007-03-10 01:15:14 +00:00
|
|
|
meta_prefs_get_action_right_click_titlebar (void)
|
|
|
|
{
|
|
|
|
return action_right_click_titlebar;
|
|
|
|
}
|
|
|
|
|
2002-05-24 02:23:46 +00: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 23:18:22 +00:00
|
|
|
meta_prefs_get_auto_raise (void)
|
2002-05-24 02:23:46 +00: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 23:18:22 +00:00
|
|
|
meta_prefs_get_auto_raise_delay (void)
|
2002-05-24 02:23:46 +00:00
|
|
|
{
|
|
|
|
return auto_raise_delay;
|
|
|
|
}
|
2002-06-09 03:44:16 +00:00
|
|
|
|
2012-08-29 02:38:54 +00:00
|
|
|
gboolean
|
2015-01-07 01:58:42 +00:00
|
|
|
meta_prefs_get_focus_change_on_pointer_rest (void)
|
2012-08-29 02:38:54 +00:00
|
|
|
{
|
|
|
|
return focus_change_on_pointer_rest;
|
|
|
|
}
|
|
|
|
|
2005-01-26 08:43:38 +00:00
|
|
|
gboolean
|
2015-01-07 01:58:42 +00:00
|
|
|
meta_prefs_get_gnome_accessibility (void)
|
2005-01-26 08:43:38 +00:00
|
|
|
{
|
|
|
|
return gnome_accessibility;
|
|
|
|
}
|
|
|
|
|
2008-06-29 21:57:39 +00:00
|
|
|
gboolean
|
2015-01-07 01:58:42 +00:00
|
|
|
meta_prefs_get_gnome_animations (void)
|
2008-06-29 21:57:39 +00:00
|
|
|
{
|
|
|
|
return gnome_animations;
|
|
|
|
}
|
|
|
|
|
2010-06-24 18:41:28 +00:00
|
|
|
gboolean
|
2015-01-07 01:58:42 +00:00
|
|
|
meta_prefs_get_edge_tiling (void)
|
2010-06-24 18:41:28 +00:00
|
|
|
{
|
2010-09-24 18:28:12 +00:00
|
|
|
return edge_tiling;
|
2010-06-24 18:41:28 +00:00
|
|
|
}
|
|
|
|
|
2012-09-08 09:34:27 +00:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_auto_maximize (void)
|
|
|
|
{
|
|
|
|
return auto_maximize;
|
|
|
|
}
|
|
|
|
|
2002-06-09 03:44:16 +00:00
|
|
|
MetaKeyBindingAction
|
2002-07-14 03:16:41 +00:00
|
|
|
meta_prefs_get_keybinding_action (const char *name)
|
2002-06-09 03:44:16 +00:00
|
|
|
{
|
2011-10-28 01:05:43 +00:00
|
|
|
MetaKeyPref *pref = g_hash_table_lookup (key_bindings, name);
|
2002-06-09 03:44:16 +00:00
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
return pref ? pref->action
|
|
|
|
: META_KEYBINDING_ACTION_NONE;
|
2002-06-09 03:44:16 +00:00
|
|
|
}
|
|
|
|
|
2012-12-17 12:30:01 +00:00
|
|
|
gint
|
2009-01-27 21:05:42 +00:00
|
|
|
meta_prefs_get_mouse_button_resize (void)
|
|
|
|
{
|
|
|
|
return resize_with_right_button ? 3: 2;
|
|
|
|
}
|
|
|
|
|
2012-12-17 12:30:01 +00:00
|
|
|
gint
|
2009-01-27 21:05:42 +00:00
|
|
|
meta_prefs_get_mouse_button_menu (void)
|
|
|
|
{
|
|
|
|
return resize_with_right_button ? 2: 3;
|
|
|
|
}
|
|
|
|
|
2009-06-19 15:30:37 +00:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_force_fullscreen (void)
|
|
|
|
{
|
|
|
|
return force_fullscreen;
|
|
|
|
}
|
|
|
|
|
2011-02-28 12:48:28 +00:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_workspaces_only_on_primary (void)
|
|
|
|
{
|
|
|
|
return workspaces_only_on_primary;
|
|
|
|
}
|
|
|
|
|
2011-07-20 06:14:58 +00:00
|
|
|
int
|
|
|
|
meta_prefs_get_draggable_border_width (void)
|
|
|
|
{
|
|
|
|
return draggable_border_width;
|
|
|
|
}
|
|
|
|
|
2014-08-15 22:21:13 +00:00
|
|
|
int
|
|
|
|
meta_prefs_get_drag_threshold (void)
|
|
|
|
{
|
|
|
|
return drag_threshold;
|
|
|
|
}
|
|
|
|
|
2009-06-19 15:30:37 +00:00
|
|
|
void
|
|
|
|
meta_prefs_set_force_fullscreen (gboolean whether)
|
|
|
|
{
|
|
|
|
force_fullscreen = whether;
|
|
|
|
}
|