2006-10-01 18:30:10 -04:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
/*
|
2002-07-06 12:50:48 -04:00
|
|
|
* Copyright (C) 2001 Havoc Pennington, Copyright (C) 2002 Red Hat Inc.
|
2006-01-10 14:43:21 -05:00
|
|
|
* Copyright (C) 2006 Elijah Newren
|
2008-06-13 19:10:32 -04:00
|
|
|
* Copyright (C) 2008 Thomas Thurman
|
2011-06-24 12:14:15 -04:00
|
|
|
* Copyright (C) 2010 Milan Bouchet-Valat, Copyright (C) 2011 Red Hat Inc.
|
|
|
|
*
|
2001-12-09 17:41:12 -05:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
2014-05-02 09:34:02 -04:00
|
|
|
*
|
2001-12-09 17:41:12 -05:00
|
|
|
* You should have received a copy of the GNU General Public License
|
2014-01-11 20:42:06 -05:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2001-12-09 17:41:12 -05:00
|
|
|
*/
|
|
|
|
|
2013-03-11 11:52:36 -04:00
|
|
|
/**
|
|
|
|
* SECTION:prefs
|
|
|
|
* @title: Preferences
|
|
|
|
* @short_description: Mutter preferences
|
|
|
|
*/
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
#include <config.h>
|
2011-03-05 19:29:12 -05:00
|
|
|
#include <meta/prefs.h>
|
2013-09-11 04:18:53 -04:00
|
|
|
#include "util-private.h"
|
2011-03-05 19:29:12 -05:00
|
|
|
#include "meta-plugin-manager.h"
|
2011-06-24 12:14:15 -04:00
|
|
|
#include <glib.h>
|
|
|
|
#include <gio/gio.h>
|
2001-12-09 17:41:12 -05:00
|
|
|
#include <string.h>
|
2002-07-11 00:10:44 -04:00
|
|
|
#include <stdlib.h>
|
2011-10-27 21:05:43 -04:00
|
|
|
#include "keybindings-private.h"
|
2014-04-07 10:48:16 -04:00
|
|
|
#include "meta-accel-parse.h"
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
/* If you add a key, it needs updating in init() and in the gsettings
|
2008-02-23 01:16:03 -05:00
|
|
|
* notify listener and of course in the .schemas file.
|
|
|
|
*
|
|
|
|
* Keys which are handled by one of the unified handlers below are
|
|
|
|
* not given a name here, because the purpose of the unified handlers
|
|
|
|
* is that keys should be referred to exactly once.
|
2001-12-09 17:41:12 -05:00
|
|
|
*/
|
2011-06-24 12:14:15 -04:00
|
|
|
#define KEY_TITLEBAR_FONT "titlebar-font"
|
|
|
|
#define KEY_NUM_WORKSPACES "num-workspaces"
|
|
|
|
#define KEY_WORKSPACE_NAMES "workspace-names"
|
2004-10-13 04:32:10 -04:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
/* Keys from "foreign" schemas */
|
|
|
|
#define KEY_GNOME_ACCESSIBILITY "toolkit-accessibility"
|
|
|
|
#define KEY_GNOME_ANIMATIONS "enable-animations"
|
|
|
|
#define KEY_GNOME_CURSOR_THEME "cursor-theme"
|
2013-04-10 05:57:16 -04:00
|
|
|
#define KEY_XKB_OPTIONS "xkb-options"
|
2004-10-13 04:32:10 -04:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
#define KEY_OVERLAY_KEY "overlay-key"
|
|
|
|
#define KEY_WORKSPACES_ONLY_ON_PRIMARY "workspaces-only-on-primary"
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2011-06-24 12:14:15 -04: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 05:57:16 -04:00
|
|
|
#define SCHEMA_INPUT_SOURCES "org.gnome.desktop.input-sources"
|
2014-05-23 17:14:51 -04:00
|
|
|
#define SCHEMA_XSETTINGS "org.gnome.settings-daemon.plugins.xsettings"
|
2014-08-15 18:21:13 -04:00
|
|
|
#define SCHEMA_MOUSE "org.gnome.settings-daemon.peripherals.mouse"
|
2002-11-03 14:06:39 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
#define SETTINGS(s) g_hash_table_lookup (settings_schemas, (s))
|
2009-02-02 09:09:04 -05:00
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
static GList *changes = NULL;
|
|
|
|
static guint changed_idle;
|
2002-12-08 14:17:17 -05:00
|
|
|
static GList *listeners = NULL;
|
2011-06-24 12:14:15 -04:00
|
|
|
static GHashTable *settings_schemas;
|
2002-12-08 14:17:17 -05:00
|
|
|
|
Fix various initialization and default issues, especially for
2006-01-20 Elijah Newren <newren gmail com>
Fix various initialization and default issues, especially for
--disable-gconf. Make --disable-gconf actually work. #326661.
* configure.in: Fix compilation with --disable-gconf
* src/metacity.schemas.in: Add a note that if any defaults are
changed in this file, src/prefs.c may need to be updated to
reflect the change
* src/prefs.c: set various static global vars to the right default
value, (meta_prefs_init): get the titlebar_font and current_theme
handled better when not using gconf, (struct MetaSimpleKeyMapping,
screen_string_bindings, window_string_bindings): helper vars to
allow some keybindings to work even without gconf,
(init_bindings): initialize bindings for the without-gconf case
too, (init_commands): make sure these are all NULL for the
non-gconf case so that we don't access random memory,
(init_workspace_names): just give these all a default name for the
non-gconf case,
(meta_prefs_change_workspace_name): actually change the name for
the non-gconf case too
2006-01-20 17:42:25 -05:00
|
|
|
static gboolean use_system_font = FALSE;
|
2001-12-09 17:41:12 -05:00
|
|
|
static PangoFontDescription *titlebar_font = NULL;
|
2002-10-07 19:14:40 -04:00
|
|
|
static MetaVirtualModifier mouse_button_mods = Mod1Mask;
|
2012-08-10 17:22:46 -04:00
|
|
|
static MetaKeyCombo overlay_key_combo = { 0, 0, 0 };
|
2011-06-24 12:14:15 -04: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 14:35:03 -05:00
|
|
|
static gboolean raise_on_click = TRUE;
|
2014-04-25 09:26:24 -04:00
|
|
|
static gboolean center_new_windows = FALSE;
|
2010-09-10 05:55:20 -04:00
|
|
|
static gboolean attach_modal_dialogs = FALSE;
|
2001-12-09 22:55:26 -05:00
|
|
|
static int num_workspaces = 4;
|
2011-06-24 12:14:15 -04: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-07 19:29:58 -05:00
|
|
|
static gboolean dynamic_workspaces = FALSE;
|
2002-04-30 23:23:46 -04:00
|
|
|
static gboolean disable_workarounds = FALSE;
|
2002-05-23 22:23:46 -04:00
|
|
|
static gboolean auto_raise = FALSE;
|
|
|
|
static gboolean auto_raise_delay = 500;
|
2012-08-28 22:38:54 -04:00
|
|
|
static gboolean focus_change_on_pointer_rest = FALSE;
|
2011-11-14 09:22:30 -05:00
|
|
|
static gboolean bell_is_visible = FALSE;
|
2003-01-28 10:07:43 -05:00
|
|
|
static gboolean bell_is_audible = TRUE;
|
2005-01-26 03:43:38 -05:00
|
|
|
static gboolean gnome_accessibility = FALSE;
|
2008-06-29 17:57:39 -04:00
|
|
|
static gboolean gnome_animations = TRUE;
|
2005-07-11 09:25:08 -04:00
|
|
|
static char *cursor_theme = NULL;
|
|
|
|
static int cursor_size = 24;
|
2011-07-20 02:14:58 -04:00
|
|
|
static int draggable_border_width = 10;
|
2014-08-15 18:21:13 -04:00
|
|
|
static int drag_threshold;
|
2009-01-27 16:05:42 -05:00
|
|
|
static gboolean resize_with_right_button = FALSE;
|
2010-09-24 14:28:12 -04:00
|
|
|
static gboolean edge_tiling = FALSE;
|
2009-06-19 11:30:37 -04:00
|
|
|
static gboolean force_fullscreen = TRUE;
|
2012-07-01 13:25:08 -04:00
|
|
|
static gboolean ignore_request_hide_titlebar = FALSE;
|
2012-09-08 05:34:27 -04:00
|
|
|
static gboolean auto_maximize = TRUE;
|
2014-05-23 17:14:51 -04:00
|
|
|
static gboolean show_fallback_app_menu = FALSE;
|
2003-10-12 02:25:38 -04:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
static GDesktopVisualBellType visual_bell_type = G_DESKTOP_VISUAL_BELL_FULLSCREEN_FLASH;
|
2007-07-22 02:39:29 -04:00
|
|
|
static MetaButtonLayout button_layout;
|
2002-11-03 14:06:39 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
/* NULL-terminated array */
|
|
|
|
static char **workspace_names = NULL;
|
2002-11-03 14:06:39 -05:00
|
|
|
|
2011-02-28 07:48:28 -05:00
|
|
|
static gboolean workspaces_only_on_primary = FALSE;
|
2008-10-24 05:07:24 -04:00
|
|
|
|
2013-04-10 05:57:16 -04:00
|
|
|
static char *iso_next_group_option = NULL;
|
2008-02-23 01:16:03 -05:00
|
|
|
|
2011-06-24 12:14:15 -04: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 14:04:05 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
static void settings_changed (GSettings *settings,
|
|
|
|
gchar *key,
|
|
|
|
gpointer data);
|
|
|
|
static void bindings_changed (GSettings *settings,
|
|
|
|
gchar *key,
|
|
|
|
gpointer data);
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2014-09-13 10:27:20 -04:00
|
|
|
static void shell_shows_app_menu_changed (GtkSettings *settings,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
gpointer data);
|
2014-05-23 17:14:51 -04:00
|
|
|
|
2014-07-28 05:02:03 -04:00
|
|
|
static void update_cursor_size (GtkSettings *settings,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
gpointer data);
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
static void queue_changed (MetaPreference pref);
|
|
|
|
|
2008-02-23 16:02:05 -05:00
|
|
|
static void maybe_give_disable_workarounds_warning (void);
|
|
|
|
|
2011-06-24 12:14:15 -04: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 17:22:46 -04:00
|
|
|
static gboolean overlay_key_handler (GVariant*, gpointer*, gpointer);
|
2013-04-10 05:57:16 -04:00
|
|
|
static gboolean iso_next_group_handler (GVariant*, gpointer*, gpointer);
|
2008-02-23 01:16:03 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
static void do_override (char *key, char *schema);
|
2008-02-23 01:16:03 -05:00
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
static void init_bindings (void);
|
2008-02-23 16:02:05 -05:00
|
|
|
|
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
MetaPrefsChangedFunc func;
|
|
|
|
gpointer data;
|
|
|
|
} MetaPrefsListener;
|
|
|
|
|
2008-02-23 01:16:03 -05:00
|
|
|
typedef struct
|
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
char *key;
|
|
|
|
char *schema;
|
2008-06-13 19:10:32 -04:00
|
|
|
MetaPreference pref;
|
2011-06-24 12:14:15 -04:00
|
|
|
} MetaBasePreference;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
MetaBasePreference base;
|
2008-02-23 01:16:03 -05:00
|
|
|
gpointer target;
|
|
|
|
} MetaEnumPreference;
|
|
|
|
|
2008-02-23 16:02:05 -05:00
|
|
|
typedef struct
|
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
MetaBasePreference base;
|
2008-06-13 19:10:32 -04:00
|
|
|
gboolean *target;
|
2008-02-23 16:02:05 -05:00
|
|
|
} MetaBoolPreference;
|
|
|
|
|
2011-11-02 11:34:45 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* MetaStringPreference:
|
2014-05-28 15:44:23 -04:00
|
|
|
* @handler: (nullable): A handler. Many of the string preferences
|
2011-11-02 11:34:45 -04: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 15:44:23 -04:00
|
|
|
* @target: (nullable): Where to write the incoming string.
|
2011-11-02 11:34:45 -04: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 12:59:20 -05:00
|
|
|
typedef struct
|
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
MetaBasePreference base;
|
|
|
|
GSettingsGetMapping handler;
|
2008-03-06 12:59:20 -05:00
|
|
|
gchar **target;
|
|
|
|
} MetaStringPreference;
|
|
|
|
|
2013-05-12 09:37:05 -04:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
MetaBasePreference base;
|
|
|
|
GSettingsGetMapping handler;
|
|
|
|
gchar ***target;
|
|
|
|
} MetaStringArrayPreference;
|
|
|
|
|
2008-06-13 19:10:32 -04:00
|
|
|
typedef struct
|
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
MetaBasePreference base;
|
2008-06-13 19:10:32 -04:00
|
|
|
gint *target;
|
|
|
|
} MetaIntPreference;
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
|
|
|
|
/* All preferences that are not keybindings must be listed here,
|
|
|
|
* plus in the GSettings schemas and the MetaPreference enum.
|
|
|
|
*/
|
|
|
|
|
2008-06-13 19:10:32 -04:00
|
|
|
/* FIXMEs: */
|
|
|
|
/* @@@ Don't use NULL lines at the end; glib can tell you how big it is */
|
|
|
|
|
2008-02-23 01:16:03 -05:00
|
|
|
static MetaEnumPreference preferences_enum[] =
|
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "focus-new-windows",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_FOCUS_NEW_WINDOWS,
|
|
|
|
},
|
2008-02-23 01:16:03 -05:00
|
|
|
&focus_new_windows,
|
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "focus-mode",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_FOCUS_MODE,
|
|
|
|
},
|
2008-02-23 01:16:03 -05:00
|
|
|
&focus_mode,
|
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "visual-bell-type",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_VISUAL_BELL_TYPE,
|
|
|
|
},
|
2008-02-23 01:16:03 -05:00
|
|
|
&visual_bell_type,
|
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "action-double-click-titlebar",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR,
|
|
|
|
},
|
2008-02-23 01:16:03 -05:00
|
|
|
&action_double_click_titlebar,
|
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "action-middle-click-titlebar",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_ACTION_MIDDLE_CLICK_TITLEBAR,
|
|
|
|
},
|
2008-02-23 01:16:03 -05:00
|
|
|
&action_middle_click_titlebar,
|
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "action-right-click-titlebar",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_ACTION_RIGHT_CLICK_TITLEBAR,
|
|
|
|
},
|
2008-02-23 01:16:03 -05:00
|
|
|
&action_right_click_titlebar,
|
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{ { NULL, 0, 0 }, NULL },
|
2008-02-23 01:16:03 -05:00
|
|
|
};
|
|
|
|
|
2008-02-23 16:02:05 -05:00
|
|
|
static MetaBoolPreference preferences_bool[] =
|
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "attach-modal-dialogs",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_ATTACH_MODAL_DIALOGS,
|
|
|
|
},
|
2010-09-10 05:55:20 -04:00
|
|
|
&attach_modal_dialogs,
|
|
|
|
},
|
2014-04-25 09:26:24 -04:00
|
|
|
{
|
|
|
|
{ "center-new-windows",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_CENTER_NEW_WINDOWS,
|
|
|
|
},
|
|
|
|
¢er_new_windows,
|
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "raise-on-click",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_RAISE_ON_CLICK,
|
|
|
|
},
|
2008-06-13 19:10:32 -04:00
|
|
|
&raise_on_click,
|
2008-02-23 16:02:05 -05:00
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "titlebar-uses-system-font",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_TITLEBAR_FONT, /* note! shares a pref */
|
|
|
|
},
|
2008-06-13 19:10:32 -04:00
|
|
|
&use_system_font,
|
2008-02-23 16:02:05 -05:00
|
|
|
},
|
2012-03-07 19:29:58 -05:00
|
|
|
{
|
|
|
|
{ "dynamic-workspaces",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_DYNAMIC_WORKSPACES,
|
|
|
|
},
|
|
|
|
&dynamic_workspaces,
|
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "disable-workarounds",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_DISABLE_WORKAROUNDS,
|
|
|
|
},
|
2008-06-13 19:10:32 -04:00
|
|
|
&disable_workarounds,
|
2008-02-23 16:02:05 -05:00
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "auto-raise",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_AUTO_RAISE,
|
|
|
|
},
|
2008-06-13 19:10:32 -04:00
|
|
|
&auto_raise,
|
2008-02-23 16:02:05 -05:00
|
|
|
},
|
2012-08-28 22:38:54 -04:00
|
|
|
{
|
|
|
|
{ "focus-change-on-pointer-rest",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_FOCUS_CHANGE_ON_POINTER_REST,
|
|
|
|
},
|
|
|
|
&focus_change_on_pointer_rest
|
|
|
|
},
|
2011-11-14 09:22:30 -05:00
|
|
|
{
|
|
|
|
{ "visual-bell",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_VISUAL_BELL,
|
|
|
|
},
|
|
|
|
&bell_is_visible, /* FIXME: change the name: it's confusing */
|
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "audible-bell",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_AUDIBLE_BELL,
|
|
|
|
},
|
2008-06-13 19:10:32 -04:00
|
|
|
&bell_is_audible, /* FIXME: change the name: it's confusing */
|
2008-02-23 16:02:05 -05:00
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ KEY_GNOME_ACCESSIBILITY,
|
|
|
|
SCHEMA_INTERFACE,
|
|
|
|
META_PREF_GNOME_ACCESSIBILITY,
|
|
|
|
},
|
2008-06-13 19:10:32 -04:00
|
|
|
&gnome_accessibility,
|
2008-02-23 16:02:05 -05:00
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ KEY_GNOME_ANIMATIONS,
|
|
|
|
SCHEMA_INTERFACE,
|
|
|
|
META_PREF_GNOME_ANIMATIONS,
|
|
|
|
},
|
2008-06-29 17:57:39 -04:00
|
|
|
&gnome_animations,
|
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "resize-with-right-button",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_RESIZE_WITH_RIGHT_BUTTON,
|
|
|
|
},
|
2009-01-27 16:05:42 -05:00
|
|
|
&resize_with_right_button,
|
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "edge-tiling",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_EDGE_TILING,
|
|
|
|
},
|
2010-09-24 14:28:12 -04:00
|
|
|
&edge_tiling,
|
2010-06-24 14:41:28 -04:00
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "workspaces-only-on-primary",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_WORKSPACES_ONLY_ON_PRIMARY,
|
|
|
|
},
|
2011-02-28 07:48:28 -05:00
|
|
|
&workspaces_only_on_primary,
|
|
|
|
},
|
2012-09-08 05:34:27 -04:00
|
|
|
{
|
|
|
|
{ "auto-maximize",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_AUTO_MAXIMIZE,
|
|
|
|
},
|
|
|
|
&auto_maximize,
|
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{ { NULL, 0, 0 }, NULL },
|
2008-02-23 16:02:05 -05:00
|
|
|
};
|
2008-02-23 01:16:03 -05:00
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
static MetaStringPreference preferences_string[] =
|
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "mouse-button-modifier",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_MOUSE_BUTTON_MODS,
|
|
|
|
},
|
2008-03-06 12:59:20 -05:00
|
|
|
mouse_button_mods_handler,
|
|
|
|
NULL,
|
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ KEY_TITLEBAR_FONT,
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_TITLEBAR_FONT,
|
|
|
|
},
|
2008-03-06 12:59:20 -05:00
|
|
|
titlebar_handler,
|
|
|
|
NULL,
|
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "button-layout",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_BUTTON_LAYOUT,
|
|
|
|
},
|
2008-03-06 12:59:20 -05:00
|
|
|
button_layout_handler,
|
|
|
|
NULL,
|
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "cursor-theme",
|
|
|
|
SCHEMA_INTERFACE,
|
|
|
|
META_PREF_CURSOR_THEME,
|
|
|
|
},
|
2008-03-06 12:59:20 -05:00
|
|
|
NULL,
|
|
|
|
&cursor_theme,
|
|
|
|
},
|
2012-08-10 17:22:46 -04:00
|
|
|
{
|
|
|
|
{ "overlay-key",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_KEYBINDINGS,
|
|
|
|
},
|
|
|
|
overlay_key_handler,
|
|
|
|
NULL,
|
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{ { NULL, 0, 0 }, NULL },
|
2008-03-06 12:59:20 -05:00
|
|
|
};
|
|
|
|
|
2013-05-12 09:37:05 -04:00
|
|
|
static MetaStringArrayPreference preferences_string_array[] =
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{ KEY_WORKSPACE_NAMES,
|
|
|
|
SCHEMA_GENERAL,
|
2015-01-08 21:34:14 -05:00
|
|
|
META_PREF_WORKSPACE_NAMES,
|
2013-05-12 09:37:05 -04:00
|
|
|
},
|
|
|
|
NULL,
|
|
|
|
&workspace_names,
|
|
|
|
},
|
2013-04-10 05:57:16 -04:00
|
|
|
{
|
|
|
|
{ KEY_XKB_OPTIONS,
|
|
|
|
SCHEMA_INPUT_SOURCES,
|
|
|
|
META_PREF_KEYBINDINGS,
|
|
|
|
},
|
|
|
|
iso_next_group_handler,
|
|
|
|
NULL,
|
|
|
|
},
|
2013-05-12 09:37:05 -04:00
|
|
|
{ { NULL, 0, 0 }, NULL },
|
|
|
|
};
|
|
|
|
|
2008-06-13 19:10:32 -04:00
|
|
|
static MetaIntPreference preferences_int[] =
|
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ KEY_NUM_WORKSPACES,
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_NUM_WORKSPACES,
|
|
|
|
},
|
|
|
|
&num_workspaces
|
2008-06-13 19:10:32 -04:00
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "auto-raise-delay",
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
META_PREF_AUTO_RAISE_DELAY,
|
|
|
|
},
|
|
|
|
&auto_raise_delay
|
2008-06-13 19:10:32 -04:00
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{
|
|
|
|
{ "draggable-border-width",
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
META_PREF_DRAGGABLE_BORDER_WIDTH,
|
|
|
|
},
|
|
|
|
&draggable_border_width
|
2011-07-20 02:14:58 -04:00
|
|
|
},
|
2014-08-15 18:21:13 -04:00
|
|
|
{
|
|
|
|
{ "drag-threshold",
|
|
|
|
SCHEMA_MOUSE,
|
|
|
|
META_PREF_DRAG_THRESHOLD,
|
|
|
|
},
|
|
|
|
&drag_threshold
|
|
|
|
},
|
2011-06-24 12:14:15 -04:00
|
|
|
{ { NULL, 0, 0 }, NULL },
|
2008-06-13 19:10:32 -04:00
|
|
|
};
|
|
|
|
|
2010-04-12 17:39:27 -04:00
|
|
|
/*
|
2011-06-24 12:14:15 -04:00
|
|
|
* This is used to keep track of override schemas used to
|
|
|
|
* override preferences from the "normal" metacity/mutter
|
|
|
|
* schemas; we modify the preferences arrays directly, but
|
|
|
|
* we also need to remember what we have done to handle
|
|
|
|
* subsequent overrides correctly.
|
2010-04-12 17:39:27 -04:00
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
char *key;
|
|
|
|
char *new_schema;
|
2010-04-12 17:39:27 -04:00
|
|
|
} MetaPrefsOverriddenKey;
|
|
|
|
|
|
|
|
static GSList *overridden_keys;
|
|
|
|
|
2008-02-23 01:16:03 -05:00
|
|
|
static void
|
|
|
|
handle_preference_init_enum (void)
|
|
|
|
{
|
|
|
|
MetaEnumPreference *cursor = preferences_enum;
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
while (cursor->base.key != NULL)
|
2008-02-23 01:16:03 -05:00
|
|
|
{
|
2008-03-06 12:59:20 -05:00
|
|
|
if (cursor->target==NULL)
|
2011-06-24 12:14:15 -04:00
|
|
|
continue;
|
2008-02-23 01:16:03 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
*((gint *) cursor->target) =
|
|
|
|
g_settings_get_enum (SETTINGS (cursor->base.schema), cursor->base.key);
|
2008-02-23 01:16:03 -05:00
|
|
|
|
|
|
|
++cursor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-23 16:02:05 -05:00
|
|
|
static void
|
|
|
|
handle_preference_init_bool (void)
|
|
|
|
{
|
|
|
|
MetaBoolPreference *cursor = preferences_bool;
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
while (cursor->base.key != NULL)
|
2008-02-23 16:02:05 -05:00
|
|
|
{
|
|
|
|
if (cursor->target!=NULL)
|
2011-06-24 12:14:15 -04:00
|
|
|
*cursor->target =
|
|
|
|
g_settings_get_boolean (SETTINGS (cursor->base.schema),
|
|
|
|
cursor->base.key);
|
2008-02-23 16:02:05 -05:00
|
|
|
|
|
|
|
++cursor;
|
|
|
|
}
|
|
|
|
|
|
|
|
maybe_give_disable_workarounds_warning ();
|
|
|
|
}
|
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
static void
|
|
|
|
handle_preference_init_string (void)
|
|
|
|
{
|
|
|
|
MetaStringPreference *cursor = preferences_string;
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
while (cursor->base.key != NULL)
|
2008-03-06 12:59:20 -05:00
|
|
|
{
|
|
|
|
char *value;
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
/* Complex keys have a mapping function to check validity */
|
2008-03-06 12:59:20 -05:00
|
|
|
if (cursor->handler)
|
|
|
|
{
|
|
|
|
if (cursor->target)
|
2011-06-24 12:14:15 -04:00
|
|
|
meta_bug ("%s has both a target and a handler\n", cursor->base.key);
|
2008-03-06 12:59:20 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
g_settings_get_mapped (SETTINGS (cursor->base.schema),
|
|
|
|
cursor->base.key, cursor->handler, NULL);
|
2008-03-06 12:59:20 -05:00
|
|
|
}
|
2011-06-24 12:14:15 -04:00
|
|
|
else
|
2008-03-06 12:59:20 -05:00
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
if (!cursor->target)
|
|
|
|
meta_bug ("%s must have handler or target\n", cursor->base.key);
|
|
|
|
|
2014-12-28 22:50:25 -05:00
|
|
|
g_free (*(cursor->target));
|
2008-03-06 12:59:20 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
value = g_settings_get_string (SETTINGS (cursor->base.schema),
|
|
|
|
cursor->base.key);
|
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
*(cursor->target) = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
++cursor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-12 09:37:05 -04: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 19:10:32 -04:00
|
|
|
static void
|
|
|
|
handle_preference_init_int (void)
|
|
|
|
{
|
|
|
|
MetaIntPreference *cursor = preferences_int;
|
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
while (cursor->base.key != NULL)
|
2008-06-13 19:10:32 -04:00
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
if (cursor->target)
|
|
|
|
*cursor->target = g_settings_get_int (SETTINGS (cursor->base.schema),
|
|
|
|
cursor->base.key);
|
2008-06-13 19:10:32 -04:00
|
|
|
|
|
|
|
++cursor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
static void
|
|
|
|
handle_preference_update_enum (GSettings *settings,
|
|
|
|
gchar *key)
|
2008-02-23 01:16:03 -05:00
|
|
|
{
|
|
|
|
MetaEnumPreference *cursor = preferences_enum;
|
|
|
|
gint old_value;
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
while (cursor->base.key != NULL && strcmp (key, cursor->base.key) != 0)
|
2008-02-23 01:16:03 -05:00
|
|
|
++cursor;
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
if (cursor->base.key == NULL)
|
2008-02-23 01:16:03 -05:00
|
|
|
/* Didn't recognise that key. */
|
2011-06-24 12:14:15 -04:00
|
|
|
return;
|
2008-02-23 01:16:03 -05:00
|
|
|
|
|
|
|
/* We need to know whether the value changes, so
|
|
|
|
* store the current value away.
|
|
|
|
*/
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
old_value = * ((gint *)cursor->target);
|
|
|
|
*((gint *)cursor->target) =
|
|
|
|
g_settings_get_enum (SETTINGS (cursor->base.schema), key);
|
2008-02-23 01:16:03 -05:00
|
|
|
|
|
|
|
/* Did it change? If so, tell the listeners about it. */
|
2011-06-24 12:14:15 -04:00
|
|
|
if (old_value != *((gint *)cursor->target))
|
|
|
|
queue_changed (cursor->base.pref);
|
2008-02-23 01:16:03 -05:00
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
static void
|
|
|
|
handle_preference_update_bool (GSettings *settings,
|
|
|
|
gchar *key)
|
2008-02-23 16:02:05 -05:00
|
|
|
{
|
|
|
|
MetaBoolPreference *cursor = preferences_bool;
|
|
|
|
gboolean old_value;
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
while (cursor->base.key != NULL && strcmp (key, cursor->base.key) != 0)
|
2008-02-23 16:02:05 -05:00
|
|
|
++cursor;
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
if (cursor->base.key == NULL || cursor->target == NULL)
|
|
|
|
/* Unknown key or no work for us to do. */
|
|
|
|
return;
|
2008-02-23 16:02:05 -05:00
|
|
|
|
|
|
|
/* We need to know whether the value changes, so
|
|
|
|
* store the current value away.
|
|
|
|
*/
|
2011-06-24 12:14:15 -04:00
|
|
|
old_value = *((gboolean *) cursor->target);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2008-02-23 16:02:05 -05:00
|
|
|
/* Now look it up... */
|
2011-06-24 12:14:15 -04:00
|
|
|
*((gboolean *) cursor->target) =
|
|
|
|
g_settings_get_boolean (SETTINGS (cursor->base.schema), key);
|
2008-02-23 16:02:05 -05:00
|
|
|
|
|
|
|
/* Did it change? If so, tell the listeners about it. */
|
2011-06-24 12:14:15 -04:00
|
|
|
if (old_value != *((gboolean *)cursor->target))
|
|
|
|
queue_changed (cursor->base.pref);
|
2008-02-23 16:02:05 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
if (cursor->base.pref==META_PREF_DISABLE_WORKAROUNDS)
|
2008-02-23 16:02:05 -05:00
|
|
|
maybe_give_disable_workarounds_warning ();
|
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
static void
|
|
|
|
handle_preference_update_string (GSettings *settings,
|
|
|
|
gchar *key)
|
2008-03-06 12:59:20 -05:00
|
|
|
{
|
|
|
|
MetaStringPreference *cursor = preferences_string;
|
2011-06-24 12:14:15 -04:00
|
|
|
char *value;
|
|
|
|
gboolean inform_listeners = FALSE;
|
2008-03-06 12:59:20 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
while (cursor->base.key != NULL && strcmp (key, cursor->base.key) != 0)
|
2008-03-06 12:59:20 -05:00
|
|
|
++cursor;
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
if (cursor->base.key==NULL)
|
2008-03-06 12:59:20 -05:00
|
|
|
/* Didn't recognise that key. */
|
2011-06-24 12:14:15 -04:00
|
|
|
return;
|
2008-03-06 12:59:20 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
/* Complex keys have a mapping function to check validity */
|
|
|
|
if (cursor->handler)
|
2008-03-06 12:59:20 -05:00
|
|
|
{
|
2011-06-24 12:14:15 -04: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 12:59:20 -05:00
|
|
|
}
|
2011-06-24 12:14:15 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!cursor->target)
|
|
|
|
meta_bug ("%s must have handler or target\n", cursor->base.key);
|
2008-03-06 12:59:20 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
value = g_settings_get_string (SETTINGS (cursor->base.schema),
|
|
|
|
cursor->base.key);
|
|
|
|
|
|
|
|
inform_listeners = (g_strcmp0 (value, *(cursor->target)) != 0);
|
2008-03-06 12:59:20 -05:00
|
|
|
|
2014-12-28 22:50:25 -05:00
|
|
|
g_free(*(cursor->target));
|
2008-03-06 12:59:20 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
*(cursor->target) = value;
|
2008-03-06 12:59:20 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (inform_listeners)
|
2011-06-24 12:14:15 -04:00
|
|
|
queue_changed (cursor->base.pref);
|
2008-03-06 12:59:20 -05:00
|
|
|
}
|
|
|
|
|
2013-05-12 09:37:05 -04: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 12:14:15 -04:00
|
|
|
static void
|
|
|
|
handle_preference_update_int (GSettings *settings,
|
|
|
|
gchar *key)
|
2008-06-13 19:10:32 -04:00
|
|
|
{
|
|
|
|
MetaIntPreference *cursor = preferences_int;
|
|
|
|
gint new_value;
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
while (cursor->base.key != NULL && strcmp (key, cursor->base.key) != 0)
|
2008-06-13 19:10:32 -04:00
|
|
|
++cursor;
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
if (cursor->base.key == NULL || cursor->target == NULL)
|
|
|
|
/* Unknown key or no work for us to do. */
|
|
|
|
return;
|
2008-06-13 19:10:32 -04:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
new_value = g_settings_get_int (SETTINGS (cursor->base.schema), key);
|
2008-06-13 19:10:32 -04:00
|
|
|
|
|
|
|
/* Did it change? If so, tell the listeners about it. */
|
|
|
|
if (*cursor->target != new_value)
|
|
|
|
{
|
|
|
|
*cursor->target = new_value;
|
2011-06-24 12:14:15 -04:00
|
|
|
queue_changed (cursor->base.pref);
|
2008-06-13 19:10:32 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2008-06-13 19:10:32 -04:00
|
|
|
/****************************************************************************/
|
|
|
|
/* Listeners. */
|
|
|
|
/****************************************************************************/
|
|
|
|
|
2010-09-01 15:39:53 -04:00
|
|
|
/**
|
|
|
|
* meta_prefs_add_listener: (skip)
|
2013-02-15 13:42:08 -05:00
|
|
|
* @func: a #MetaPrefsChangedFunc
|
|
|
|
* @user_data: data passed to the function
|
2010-09-01 15:39:53 -04:00
|
|
|
*
|
|
|
|
*/
|
2001-12-09 17:41:12 -05:00
|
|
|
void
|
|
|
|
meta_prefs_add_listener (MetaPrefsChangedFunc func,
|
2012-11-16 15:23:47 -05:00
|
|
|
gpointer user_data)
|
2001-12-09 17:41:12 -05:00
|
|
|
{
|
|
|
|
MetaPrefsListener *l;
|
|
|
|
|
|
|
|
l = g_new (MetaPrefsListener, 1);
|
|
|
|
l->func = func;
|
2012-11-16 15:23:47 -05:00
|
|
|
l->data = user_data;
|
2001-12-09 17:41:12 -05:00
|
|
|
|
|
|
|
listeners = g_list_prepend (listeners, l);
|
|
|
|
}
|
|
|
|
|
2010-09-01 15:39:53 -04:00
|
|
|
/**
|
|
|
|
* meta_prefs_remove_listener: (skip)
|
2013-02-15 13:42:08 -05:00
|
|
|
* @func: a #MetaPrefsChangedFunc
|
|
|
|
* @user_data: data passed to the function
|
2010-09-01 15:39:53 -04:00
|
|
|
*
|
|
|
|
*/
|
2001-12-09 17:41:12 -05:00
|
|
|
void
|
|
|
|
meta_prefs_remove_listener (MetaPrefsChangedFunc func,
|
2012-11-16 15:23:47 -05:00
|
|
|
gpointer user_data)
|
2001-12-09 17:41:12 -05:00
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
tmp = listeners;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaPrefsListener *l = tmp->data;
|
|
|
|
|
|
|
|
if (l->func == func &&
|
2012-11-16 15:23:47 -05:00
|
|
|
l->data == user_data)
|
2001-12-09 17:41:12 -05:00
|
|
|
{
|
|
|
|
g_free (l);
|
|
|
|
listeners = g_list_delete_link (listeners, tmp);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
meta_bug ("Did not find listener to remove\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
emit_changed (MetaPreference pref)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
GList *copy;
|
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
meta_topic (META_DEBUG_PREFS, "Notifying listeners that pref %s changed\n",
|
|
|
|
meta_preference_to_string (pref));
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
copy = g_list_copy (listeners);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
tmp = copy;
|
2008-03-06 12:59:20 -05:00
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaPrefsListener *l = tmp->data;
|
|
|
|
|
|
|
|
(* l->func) (pref, l->data);
|
2008-03-06 12:59:20 -05:00
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (copy);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
changed_idle_handler (gpointer data)
|
|
|
|
{
|
|
|
|
GList *tmp;
|
|
|
|
GList *copy;
|
|
|
|
|
|
|
|
changed_idle = 0;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
copy = g_list_copy (changes); /* reentrancy paranoia */
|
|
|
|
|
|
|
|
g_list_free (changes);
|
|
|
|
changes = NULL;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
tmp = copy;
|
|
|
|
while (tmp != NULL)
|
|
|
|
{
|
|
|
|
MetaPreference pref = GPOINTER_TO_INT (tmp->data);
|
|
|
|
|
|
|
|
emit_changed (pref);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
tmp = tmp->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_list_free (copy);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
queue_changed (MetaPreference pref)
|
|
|
|
{
|
2002-11-03 14:06:39 -05:00
|
|
|
meta_topic (META_DEBUG_PREFS, "Queueing change of pref %s\n",
|
2014-05-02 09:34:02 -04:00
|
|
|
meta_preference_to_string (pref));
|
2008-03-06 12:59:20 -05:00
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
if (g_list_find (changes, GINT_TO_POINTER (pref)) == NULL)
|
|
|
|
changes = g_list_prepend (changes, GINT_TO_POINTER (pref));
|
|
|
|
else
|
2002-11-03 14:06:39 -05:00
|
|
|
meta_topic (META_DEBUG_PREFS, "Change of pref %s was already pending\n",
|
|
|
|
meta_preference_to_string (pref));
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
if (changed_idle == 0)
|
2014-04-10 12:58:58 -04: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 17:41:12 -05:00
|
|
|
}
|
2008-05-28 00:10:08 -04:00
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2008-06-13 19:10:32 -04:00
|
|
|
/****************************************************************************/
|
|
|
|
/* Initialisation. */
|
|
|
|
/****************************************************************************/
|
2008-05-28 00:10:08 -04:00
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
void
|
|
|
|
meta_prefs_init (void)
|
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
GSettings *settings;
|
|
|
|
GSList *tmp;
|
|
|
|
|
|
|
|
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-15 20:23:45 -04: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 12:14:15 -04: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);
|
|
|
|
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_INTERFACE), settings);
|
|
|
|
|
2014-09-13 10:27:20 -04:00
|
|
|
g_signal_connect (gtk_settings_get_default (),
|
|
|
|
"notify::gtk-shell-shows-app-menu",
|
|
|
|
G_CALLBACK (shell_shows_app_menu_changed), NULL);
|
2014-05-23 17:14:51 -04:00
|
|
|
|
2014-07-28 05:02:03 -04:00
|
|
|
g_signal_connect (gtk_settings_get_default (), "notify::gtk-cursor-theme-size",
|
|
|
|
G_CALLBACK (update_cursor_size), NULL);
|
|
|
|
|
2013-04-10 05:57:16 -04: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);
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
|
|
|
|
for (tmp = overridden_keys; tmp; tmp = tmp->next)
|
|
|
|
{
|
|
|
|
MetaPrefsOverriddenKey *override = tmp->data;
|
|
|
|
do_override (override->key, override->new_schema);
|
2008-03-06 12:59:20 -05:00
|
|
|
}
|
2005-07-11 09:25:08 -04:00
|
|
|
|
2010-04-12 17:42:46 -04:00
|
|
|
/* Pick up initial values. */
|
|
|
|
|
|
|
|
handle_preference_init_enum ();
|
|
|
|
handle_preference_init_bool ();
|
|
|
|
handle_preference_init_string ();
|
2013-05-12 09:37:05 -04:00
|
|
|
handle_preference_init_string_array ();
|
2010-04-12 17:42:46 -04:00
|
|
|
handle_preference_init_int ();
|
|
|
|
|
2014-07-28 05:02:03 -04:00
|
|
|
update_cursor_size (gtk_settings_get_default (), NULL, NULL);
|
2014-09-13 10:27:20 -04:00
|
|
|
shell_shows_app_menu_changed (gtk_settings_get_default (), NULL, NULL);
|
2014-07-28 05:02:03 -04:00
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
init_bindings ();
|
2001-12-09 17:41:12 -05:00
|
|
|
}
|
|
|
|
|
2010-04-12 17:39:27 -04:00
|
|
|
static gboolean
|
2011-06-24 12:14:15 -04:00
|
|
|
find_pref (void *prefs,
|
|
|
|
size_t pref_size,
|
|
|
|
const char *search_key,
|
|
|
|
MetaBasePreference **pref)
|
2010-04-12 17:39:27 -04:00
|
|
|
{
|
2010-04-13 14:40:31 -04:00
|
|
|
void *p = prefs;
|
2010-04-12 17:39:27 -04:00
|
|
|
|
2010-04-13 14:40:31 -04:00
|
|
|
while (TRUE)
|
2010-04-12 17:39:27 -04:00
|
|
|
{
|
2010-04-13 14:40:31 -04:00
|
|
|
char **key = p;
|
|
|
|
if (*key == NULL)
|
|
|
|
break;
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
if (strcmp (*key, search_key) == 0)
|
|
|
|
{
|
|
|
|
*pref = p;
|
|
|
|
return TRUE;
|
|
|
|
}
|
2010-04-13 14:40:31 -04:00
|
|
|
|
|
|
|
p = (guchar *)p + pref_size;
|
2010-04-12 17:39:27 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
|
|
|
|
static void
|
|
|
|
do_override (char *key,
|
|
|
|
char *schema)
|
2010-04-12 17:39:27 -04:00
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
MetaBasePreference *pref;
|
|
|
|
GSettings *settings;
|
|
|
|
char *detailed_signal;
|
|
|
|
gpointer data;
|
|
|
|
guint handler_id;
|
2010-04-12 17:39:27 -04:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
g_return_if_fail (settings_schemas != NULL);
|
|
|
|
|
|
|
|
if (!find_pref (preferences_enum, sizeof(MetaEnumPreference), key, &pref) &&
|
|
|
|
!find_pref (preferences_bool, sizeof(MetaBoolPreference), key, &pref) &&
|
|
|
|
!find_pref (preferences_string, sizeof(MetaStringPreference), key, &pref) &&
|
|
|
|
!find_pref (preferences_int, sizeof(MetaIntPreference), key, &pref))
|
2010-04-12 17:39:27 -04:00
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
meta_warning ("Can't override preference key, \"%s\" not found\n", key);
|
|
|
|
return;
|
|
|
|
}
|
2010-04-13 14:40:31 -04:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
settings = SETTINGS (pref->schema);
|
|
|
|
data = g_object_get_data (G_OBJECT (settings), key);
|
|
|
|
if (data)
|
|
|
|
{
|
|
|
|
handler_id = GPOINTER_TO_UINT (data);
|
|
|
|
g_signal_handler_disconnect (settings, handler_id);
|
|
|
|
}
|
2010-04-13 14:40:31 -04:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
pref->schema = schema;
|
|
|
|
settings = SETTINGS (pref->schema);
|
|
|
|
if (!settings)
|
|
|
|
{
|
|
|
|
settings = g_settings_new (pref->schema);
|
|
|
|
g_hash_table_insert (settings_schemas, g_strdup (pref->schema), settings);
|
2010-04-12 17:39:27 -04:00
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
detailed_signal = g_strdup_printf ("changed::%s", key);
|
|
|
|
handler_id = g_signal_connect (settings, detailed_signal,
|
|
|
|
G_CALLBACK (settings_changed), NULL);
|
2011-12-18 22:55:26 -05:00
|
|
|
g_free (detailed_signal);
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
g_object_set_data (G_OBJECT (settings), key, GUINT_TO_POINTER (handler_id));
|
|
|
|
|
|
|
|
settings_changed (settings, key, NULL);
|
2010-04-12 17:39:27 -04:00
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
|
2010-04-12 17:39:27 -04:00
|
|
|
/**
|
2011-11-02 11:34:45 -04:00
|
|
|
* meta_prefs_override_preference_schema:
|
2011-06-24 12:14:15 -04:00
|
|
|
* @key: the preference name
|
2011-11-02 11:34:45 -04:00
|
|
|
* @schema: new schema for preference @key
|
2010-04-12 17:39:27 -04:00
|
|
|
*
|
2011-06-24 12:14:15 -04:00
|
|
|
* Specify a schema whose keys are used to override the standard Metacity
|
|
|
|
* keys. This might be used if a plugin expected a different value for
|
|
|
|
* some preference than the Metacity default. While this function can be
|
|
|
|
* called at any point, this function should generally be called in a
|
|
|
|
* plugin's constructor, rather than in its start() method so the preference
|
|
|
|
* isn't first loaded with one value then changed to another value.
|
2010-04-12 17:39:27 -04:00
|
|
|
*/
|
|
|
|
void
|
2011-06-24 12:14:15 -04:00
|
|
|
meta_prefs_override_preference_schema (const char *key, const char *schema)
|
2010-04-12 17:39:27 -04:00
|
|
|
{
|
|
|
|
MetaPrefsOverriddenKey *overridden;
|
|
|
|
GSList *tmp;
|
|
|
|
|
|
|
|
/* Merge identical overrides, this isn't an error */
|
|
|
|
for (tmp = overridden_keys; tmp; tmp = tmp->next)
|
|
|
|
{
|
|
|
|
MetaPrefsOverriddenKey *tmp_overridden = tmp->data;
|
2011-06-24 12:14:15 -04:00
|
|
|
if (strcmp (tmp_overridden->key, key) == 0 &&
|
|
|
|
strcmp (tmp_overridden->new_schema, schema) == 0)
|
2010-04-12 17:39:27 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
overridden = NULL;
|
|
|
|
|
|
|
|
for (tmp = overridden_keys; tmp; tmp = tmp->next)
|
|
|
|
{
|
|
|
|
MetaPrefsOverriddenKey *tmp_overridden = tmp->data;
|
2011-06-24 12:14:15 -04:00
|
|
|
if (strcmp (tmp_overridden->key, key) == 0)
|
|
|
|
overridden = tmp_overridden;
|
2010-04-12 17:39:27 -04:00
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
if (overridden)
|
2010-04-12 17:39:27 -04:00
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
g_free (overridden->new_schema);
|
|
|
|
overridden->new_schema = g_strdup (schema);
|
2010-04-12 17:39:27 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
overridden = g_slice_new (MetaPrefsOverriddenKey);
|
|
|
|
overridden->key = g_strdup (key);
|
|
|
|
overridden->new_schema = g_strdup (schema);
|
|
|
|
|
|
|
|
overridden_keys = g_slist_prepend (overridden_keys, overridden);
|
2010-04-12 17:39:27 -04:00
|
|
|
}
|
2011-06-24 12:14:15 -04:00
|
|
|
|
|
|
|
if (settings_schemas != NULL)
|
|
|
|
do_override (overridden->key, overridden->new_schema);
|
2010-04-12 17:39:27 -04:00
|
|
|
}
|
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2008-06-13 19:10:32 -04:00
|
|
|
/****************************************************************************/
|
|
|
|
/* Updates. */
|
|
|
|
/****************************************************************************/
|
|
|
|
|
2007-04-24 23:30:17 -04:00
|
|
|
|
2010-04-12 17:39:27 -04:00
|
|
|
static void
|
2011-06-24 12:14:15 -04:00
|
|
|
settings_changed (GSettings *settings,
|
|
|
|
gchar *key,
|
|
|
|
gpointer data)
|
2010-04-12 17:39:27 -04:00
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
GVariant *value;
|
|
|
|
const GVariantType *type;
|
|
|
|
MetaEnumPreference *cursor;
|
|
|
|
gboolean found_enum;
|
2010-04-12 17:39:27 -04:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
value = g_settings_get_value (settings, key);
|
|
|
|
type = g_variant_get_type (value);
|
2002-10-07 19:14:40 -04:00
|
|
|
|
2011-06-24 12:14:15 -04: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);
|
2013-05-12 09:37:05 -04:00
|
|
|
else if (g_variant_type_equal (type, G_VARIANT_TYPE_STRING_ARRAY))
|
|
|
|
handle_preference_update_string_array (settings, key);
|
2011-06-24 12:14:15 -04:00
|
|
|
else if (g_variant_type_equal (type, G_VARIANT_TYPE_STRING))
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
2011-06-24 12:14:15 -04: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 13:23:09 -04:00
|
|
|
|
2011-06-24 12:14:15 -04: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 13:23:09 -04:00
|
|
|
{
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
if (strcmp (key, cursor->base.key) == 0)
|
|
|
|
found_enum = TRUE;
|
2002-11-03 14:06:39 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
cursor++;
|
2002-11-03 14:06:39 -05:00
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
if (found_enum)
|
|
|
|
handle_preference_update_enum (settings, key);
|
|
|
|
else
|
|
|
|
handle_preference_update_string (settings, key);
|
2002-11-03 14:06:39 -05:00
|
|
|
}
|
2002-01-27 00:50:34 -05:00
|
|
|
else
|
|
|
|
{
|
2014-08-19 14:06:10 -04:00
|
|
|
/* Unknown preference type. This quite likely simply isn't
|
|
|
|
* a preference we track changes to. */
|
2002-01-27 00:50:34 -05:00
|
|
|
}
|
2008-02-23 16:02:05 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
g_variant_unref (value);
|
2008-02-23 16:02:05 -05:00
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
static void
|
|
|
|
bindings_changed (GSettings *settings,
|
|
|
|
gchar *key,
|
|
|
|
gpointer data)
|
2008-02-23 16:02:05 -05:00
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
gchar **strokes;
|
|
|
|
strokes = g_settings_get_strv (settings, key);
|
2008-02-23 16:02:05 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
if (update_key_binding (key, strokes))
|
|
|
|
queue_changed (META_PREF_KEYBINDINGS);
|
2008-02-23 16:02:05 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
g_strfreev (strokes);
|
2008-02-23 16:02:05 -05:00
|
|
|
}
|
|
|
|
|
2014-05-23 17:14:51 -04:00
|
|
|
static void
|
2014-09-13 10:27:20 -04:00
|
|
|
shell_shows_app_menu_changed (GtkSettings *settings,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
gpointer data)
|
2014-05-23 17:14:51 -04:00
|
|
|
{
|
|
|
|
int shell_shows_app_menu = 1;
|
2014-06-02 18:00:36 -04:00
|
|
|
gboolean changed = FALSE;
|
2014-05-23 17:14:51 -04:00
|
|
|
|
2014-09-13 10:27:20 -04:00
|
|
|
g_object_get (settings,
|
|
|
|
"gtk-shell-shows-app-menu", &shell_shows_app_menu,
|
|
|
|
NULL);
|
2014-05-23 17:14:51 -04:00
|
|
|
|
|
|
|
|
2014-06-02 18:00:36 -04:00
|
|
|
changed = (show_fallback_app_menu == !!shell_shows_app_menu);
|
|
|
|
|
2014-05-23 17:14:51 -04:00
|
|
|
show_fallback_app_menu = !shell_shows_app_menu;
|
2014-06-02 18:00:36 -04:00
|
|
|
|
|
|
|
if (changed)
|
|
|
|
queue_changed (META_PREF_BUTTON_LAYOUT);
|
2014-05-23 17:14:51 -04:00
|
|
|
}
|
|
|
|
|
2014-07-28 05:02:03 -04:00
|
|
|
static void
|
|
|
|
update_cursor_size (GtkSettings *settings,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GdkScreen *screen = gdk_screen_get_default ();
|
|
|
|
GValue value = G_VALUE_INIT;
|
|
|
|
int xsettings_cursor_size = 24;
|
|
|
|
|
|
|
|
g_value_init (&value, G_TYPE_INT);
|
|
|
|
if (gdk_screen_get_setting (screen, "gtk-cursor-theme-size", &value))
|
|
|
|
{
|
|
|
|
xsettings_cursor_size = g_value_get_int (&value);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (xsettings_cursor_size != cursor_size)
|
|
|
|
{
|
|
|
|
cursor_size = xsettings_cursor_size;
|
|
|
|
queue_changed (META_PREF_CURSOR_SIZE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-23 16:02:05 -05:00
|
|
|
/**
|
2011-11-02 11:34:45 -04:00
|
|
|
* maybe_give_disable_workaround_warning:
|
|
|
|
*
|
2008-02-23 16:02:05 -05: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 09:34:02 -04:00
|
|
|
|
2008-02-23 16:02:05 -05:00
|
|
|
if (first_disable && disable_workarounds)
|
|
|
|
{
|
|
|
|
first_disable = FALSE;
|
|
|
|
|
2013-09-11 04:37:36 -04:00
|
|
|
meta_warning ("Workarounds for broken applications disabled. "
|
|
|
|
"Some applications may not behave properly.\n");
|
2008-02-23 16:02:05 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-07 19:14:40 -04:00
|
|
|
MetaVirtualModifier
|
|
|
|
meta_prefs_get_mouse_button_mods (void)
|
|
|
|
{
|
|
|
|
return mouse_button_mods;
|
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
GDesktopFocusMode
|
2001-12-09 17:41:12 -05:00
|
|
|
meta_prefs_get_focus_mode (void)
|
|
|
|
{
|
|
|
|
return focus_mode;
|
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
GDesktopFocusNewWindows
|
2006-04-12 14:01:20 -04:00
|
|
|
meta_prefs_get_focus_new_windows (void)
|
|
|
|
{
|
|
|
|
return focus_new_windows;
|
|
|
|
}
|
|
|
|
|
2014-04-25 09:26:24 -04:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_center_new_windows (void)
|
|
|
|
{
|
|
|
|
return center_new_windows;
|
|
|
|
}
|
|
|
|
|
2010-09-10 05:55:20 -04: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 14:35:03 -05:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_raise_on_click (void)
|
|
|
|
{
|
2014-12-29 01:36:27 -05: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 14:35:03 -05:00
|
|
|
}
|
|
|
|
|
2014-05-23 17:14:51 -04:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_show_fallback_app_menu (void)
|
|
|
|
{
|
|
|
|
return show_fallback_app_menu;
|
|
|
|
}
|
|
|
|
|
2005-07-11 09:25:08 -04:00
|
|
|
const char*
|
|
|
|
meta_prefs_get_cursor_theme (void)
|
|
|
|
{
|
|
|
|
return cursor_theme;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
meta_prefs_get_cursor_size (void)
|
|
|
|
{
|
2014-07-28 03:57:08 -04:00
|
|
|
return cursor_size;
|
2005-07-11 09:25:08 -04:00
|
|
|
}
|
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2008-06-13 19:10:32 -04:00
|
|
|
/****************************************************************************/
|
|
|
|
/* Handlers for string preferences. */
|
|
|
|
/****************************************************************************/
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
static gboolean
|
|
|
|
titlebar_handler (GVariant *value,
|
|
|
|
gpointer *result,
|
|
|
|
gpointer data)
|
2001-12-09 17:41:12 -05:00
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
PangoFontDescription *desc;
|
|
|
|
const gchar *string_value;
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
*result = NULL; /* ignored */
|
|
|
|
string_value = g_variant_get_string (value, NULL);
|
|
|
|
desc = pango_font_description_from_string (string_value);
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
if (desc == NULL)
|
2001-12-09 17:41:12 -05:00
|
|
|
{
|
2013-09-11 04:37:36 -04:00
|
|
|
meta_warning ("Could not parse font description "
|
|
|
|
"\"%s\" from GSettings key %s\n",
|
2008-10-27 07:52:47 -04:00
|
|
|
string_value ? string_value : "(null)",
|
2008-03-06 12:59:20 -05:00
|
|
|
KEY_TITLEBAR_FONT);
|
2011-06-24 12:14:15 -04:00
|
|
|
return FALSE;
|
2001-12-09 17:41:12 -05:00
|
|
|
}
|
|
|
|
|
2008-03-06 12:59:20 -05:00
|
|
|
/* Is the new description the same as the old? */
|
|
|
|
if (titlebar_font &&
|
2011-06-24 12:14:15 -04:00
|
|
|
pango_font_description_equal (desc, titlebar_font))
|
2001-12-09 17:41:12 -05:00
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
pango_font_description_free (desc);
|
2001-12-09 17:41:12 -05:00
|
|
|
}
|
2011-06-24 12:14:15 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (titlebar_font)
|
|
|
|
pango_font_description_free (titlebar_font);
|
2008-03-06 12:59:20 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
titlebar_font = desc;
|
|
|
|
queue_changed (META_PREF_TITLEBAR_FONT);
|
|
|
|
}
|
2008-03-06 12:59:20 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
return TRUE;
|
2008-03-06 12:59:20 -05:00
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
static gboolean
|
|
|
|
mouse_button_mods_handler (GVariant *value,
|
|
|
|
gpointer *result,
|
|
|
|
gpointer data)
|
2008-03-06 12:59:20 -05:00
|
|
|
{
|
|
|
|
MetaVirtualModifier mods;
|
2011-06-24 12:14:15 -04:00
|
|
|
const gchar *string_value;
|
2001-12-09 17:41:12 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
*result = NULL; /* ignored */
|
|
|
|
string_value = g_variant_get_string (value, NULL);
|
|
|
|
|
2014-04-07 10:48:16 -04:00
|
|
|
if (!string_value || !meta_parse_modifier (string_value, &mods))
|
2008-03-06 12:59:20 -05:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2011-06-24 12:14:15 -04:00
|
|
|
"Failed to parse new GSettings value\n");
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2013-09-11 04:37:36 -04:00
|
|
|
meta_warning ("\"%s\" found in configuration database is "
|
|
|
|
"not a valid value for mouse button modifier\n",
|
2008-03-06 12:59:20 -05:00
|
|
|
string_value);
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
return FALSE;
|
2001-12-09 17:41:12 -05:00
|
|
|
}
|
2011-06-24 12:14:15 -04: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 17:41:12 -05:00
|
|
|
}
|
|
|
|
|
2002-10-12 13:44:55 -04:00
|
|
|
static gboolean
|
|
|
|
button_layout_equal (const MetaButtonLayout *a,
|
|
|
|
const MetaButtonLayout *b)
|
2014-05-02 09:34:02 -04:00
|
|
|
{
|
2002-10-12 13:44:55 -04: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 15:41:07 -05:00
|
|
|
if (a->left_buttons_has_spacer[i] != b->left_buttons_has_spacer[i])
|
|
|
|
return FALSE;
|
|
|
|
if (a->right_buttons_has_spacer[i] != b->right_buttons_has_spacer[i])
|
|
|
|
return FALSE;
|
2002-10-12 13:44:55 -04:00
|
|
|
++i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
/*
|
|
|
|
* This conversion cannot be handled by GSettings since
|
|
|
|
* several values are stored in the same key (as a string).
|
|
|
|
*/
|
2002-10-12 13:44:55 -04:00
|
|
|
static MetaButtonFunction
|
|
|
|
button_function_from_string (const char *str)
|
|
|
|
{
|
|
|
|
if (strcmp (str, "menu") == 0)
|
|
|
|
return META_BUTTON_FUNCTION_MENU;
|
2014-05-23 17:14:51 -04:00
|
|
|
else if (strcmp (str, "appmenu") == 0)
|
|
|
|
return META_BUTTON_FUNCTION_APPMENU;
|
2002-10-12 13:44:55 -04:00
|
|
|
else if (strcmp (str, "minimize") == 0)
|
|
|
|
return META_BUTTON_FUNCTION_MINIMIZE;
|
|
|
|
else if (strcmp (str, "maximize") == 0)
|
|
|
|
return META_BUTTON_FUNCTION_MAXIMIZE;
|
|
|
|
else if (strcmp (str, "close") == 0)
|
|
|
|
return META_BUTTON_FUNCTION_CLOSE;
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
else if (strcmp (str, "shade") == 0)
|
|
|
|
return META_BUTTON_FUNCTION_SHADE;
|
|
|
|
else if (strcmp (str, "above") == 0)
|
|
|
|
return META_BUTTON_FUNCTION_ABOVE;
|
|
|
|
else if (strcmp (str, "stick") == 0)
|
|
|
|
return META_BUTTON_FUNCTION_STICK;
|
2014-05-02 09:34:02 -04: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 12:56:47 -04:00
|
|
|
/* don't know; give up */
|
2002-10-12 13:44:55 -04:00
|
|
|
return META_BUTTON_FUNCTION_LAST;
|
|
|
|
}
|
|
|
|
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
static MetaButtonFunction
|
|
|
|
button_opposite_function (MetaButtonFunction ofwhat)
|
|
|
|
{
|
|
|
|
switch (ofwhat)
|
|
|
|
{
|
|
|
|
case META_BUTTON_FUNCTION_SHADE:
|
|
|
|
return META_BUTTON_FUNCTION_UNSHADE;
|
|
|
|
case META_BUTTON_FUNCTION_UNSHADE:
|
|
|
|
return META_BUTTON_FUNCTION_SHADE;
|
|
|
|
|
|
|
|
case META_BUTTON_FUNCTION_ABOVE:
|
|
|
|
return META_BUTTON_FUNCTION_UNABOVE;
|
|
|
|
case META_BUTTON_FUNCTION_UNABOVE:
|
|
|
|
return META_BUTTON_FUNCTION_ABOVE;
|
|
|
|
|
|
|
|
case META_BUTTON_FUNCTION_STICK:
|
|
|
|
return META_BUTTON_FUNCTION_UNSTICK;
|
|
|
|
case META_BUTTON_FUNCTION_UNSTICK:
|
|
|
|
return META_BUTTON_FUNCTION_STICK;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return META_BUTTON_FUNCTION_LAST;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
static gboolean
|
|
|
|
button_layout_handler (GVariant *value,
|
|
|
|
gpointer *result,
|
|
|
|
gpointer data)
|
2002-10-12 13:44:55 -04:00
|
|
|
{
|
|
|
|
MetaButtonLayout new_layout;
|
2011-06-24 12:14:15 -04:00
|
|
|
const gchar *string_value;
|
2008-10-27 07:52:47 -04:00
|
|
|
char **sides = NULL;
|
2002-10-12 13:44:55 -04:00
|
|
|
int i;
|
2011-06-24 12:14:15 -04:00
|
|
|
|
2002-10-12 13:44:55 -04:00
|
|
|
/* We need to ignore unknown button functions, for
|
|
|
|
* compat with future versions
|
|
|
|
*/
|
2011-06-24 12:14:15 -04:00
|
|
|
|
|
|
|
*result = NULL; /* ignored */
|
|
|
|
string_value = g_variant_get_string (value, NULL);
|
|
|
|
|
2008-10-27 07:52:47 -04:00
|
|
|
if (string_value)
|
|
|
|
sides = g_strsplit (string_value, ":", 2);
|
2002-10-12 13:44:55 -04:00
|
|
|
|
2011-07-23 17:58:06 -04:00
|
|
|
i = 0;
|
2008-10-27 07:52:47 -04:00
|
|
|
if (sides != NULL && sides[0] != NULL)
|
2002-10-12 13:44:55 -04:00
|
|
|
{
|
|
|
|
char **buttons;
|
|
|
|
int b;
|
|
|
|
gboolean used[META_BUTTON_FUNCTION_LAST];
|
|
|
|
|
|
|
|
while (i < META_BUTTON_FUNCTION_LAST)
|
|
|
|
{
|
|
|
|
used[i] = FALSE;
|
2008-02-29 15:41:07 -05:00
|
|
|
new_layout.left_buttons_has_spacer[i] = FALSE;
|
2002-10-12 13:44:55 -04:00
|
|
|
++i;
|
|
|
|
}
|
2011-06-24 12:14:15 -04:00
|
|
|
|
2002-10-12 13:44:55 -04: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 15:41:07 -05:00
|
|
|
if (i > 0 && strcmp("spacer", buttons[b]) == 0)
|
2002-10-12 13:44:55 -04:00
|
|
|
{
|
2008-02-29 15:41:07 -05:00
|
|
|
new_layout.left_buttons_has_spacer[i-1] = TRUE;
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
f = button_opposite_function (f);
|
|
|
|
|
|
|
|
if (f != META_BUTTON_FUNCTION_LAST)
|
2008-02-29 15:41:07 -05:00
|
|
|
{
|
|
|
|
new_layout.left_buttons_has_spacer[i-2] = TRUE;
|
|
|
|
}
|
2002-10-12 13:44:55 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-02-29 15:41:07 -05:00
|
|
|
if (f != META_BUTTON_FUNCTION_LAST && !used[f])
|
|
|
|
{
|
|
|
|
new_layout.left_buttons[i] = f;
|
|
|
|
used[f] = TRUE;
|
|
|
|
++i;
|
|
|
|
|
|
|
|
f = button_opposite_function (f);
|
|
|
|
|
|
|
|
if (f != META_BUTTON_FUNCTION_LAST)
|
|
|
|
new_layout.left_buttons[i++] = f;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_PREFS, "Ignoring unknown or already-used button name \"%s\"\n",
|
|
|
|
buttons[b]);
|
|
|
|
}
|
2002-10-12 13:44:55 -04:00
|
|
|
}
|
2011-06-24 12:14:15 -04:00
|
|
|
|
2002-10-12 13:44:55 -04:00
|
|
|
++b;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_strfreev (buttons);
|
|
|
|
}
|
|
|
|
|
2012-11-28 17:04:17 -05: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 17:58:06 -04:00
|
|
|
|
|
|
|
i = 0;
|
2008-10-27 07:52:47 -04:00
|
|
|
if (sides != NULL && sides[0] != NULL && sides[1] != NULL)
|
2002-10-12 13:44:55 -04:00
|
|
|
{
|
|
|
|
char **buttons;
|
|
|
|
int b;
|
|
|
|
gboolean used[META_BUTTON_FUNCTION_LAST];
|
|
|
|
|
|
|
|
while (i < META_BUTTON_FUNCTION_LAST)
|
|
|
|
{
|
|
|
|
used[i] = FALSE;
|
2008-02-29 15:41:07 -05:00
|
|
|
new_layout.right_buttons_has_spacer[i] = FALSE;
|
2002-10-12 13:44:55 -04:00
|
|
|
++i;
|
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-10-12 13:44:55 -04: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 15:41:07 -05:00
|
|
|
if (i > 0 && strcmp("spacer", buttons[b]) == 0)
|
2002-10-12 13:44:55 -04:00
|
|
|
{
|
2008-02-29 15:41:07 -05:00
|
|
|
new_layout.right_buttons_has_spacer[i-1] = TRUE;
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 12:56:47 -04:00
|
|
|
f = button_opposite_function (f);
|
|
|
|
if (f != META_BUTTON_FUNCTION_LAST)
|
2008-02-29 15:41:07 -05:00
|
|
|
{
|
|
|
|
new_layout.right_buttons_has_spacer[i-2] = TRUE;
|
|
|
|
}
|
|
|
|
}
|
2002-10-12 13:44:55 -04:00
|
|
|
else
|
|
|
|
{
|
2008-02-29 15:41:07 -05:00
|
|
|
if (f != META_BUTTON_FUNCTION_LAST && !used[f])
|
|
|
|
{
|
|
|
|
new_layout.right_buttons[i] = f;
|
|
|
|
used[f] = TRUE;
|
|
|
|
++i;
|
|
|
|
|
|
|
|
f = button_opposite_function (f);
|
|
|
|
|
|
|
|
if (f != META_BUTTON_FUNCTION_LAST)
|
|
|
|
new_layout.right_buttons[i++] = f;
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_PREFS, "Ignoring unknown or already-used button name \"%s\"\n",
|
|
|
|
buttons[b]);
|
|
|
|
}
|
2002-10-12 13:44:55 -04:00
|
|
|
}
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-10-12 13:44:55 -04:00
|
|
|
++b;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_strfreev (buttons);
|
|
|
|
}
|
|
|
|
|
2012-11-28 17:04:17 -05: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 17:58:06 -04:00
|
|
|
|
2002-10-12 13:44:55 -04:00
|
|
|
g_strfreev (sides);
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2007-07-22 02:39:29 -04:00
|
|
|
/* Invert the button layout for RTL languages */
|
2014-08-17 22:57:51 -04:00
|
|
|
if (meta_get_locale_direction() == META_LOCALE_DIRECTION_RTL)
|
2014-08-17 23:00:05 -04: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 12:14:15 -04:00
|
|
|
|
|
|
|
if (!button_layout_equal (&button_layout, &new_layout))
|
2008-03-06 12:59:20 -05:00
|
|
|
{
|
|
|
|
button_layout = new_layout;
|
2011-06-24 12:14:15 -04:00
|
|
|
emit_changed (META_PREF_BUTTON_LAYOUT);
|
2008-03-06 12:59:20 -05:00
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
return TRUE;
|
|
|
|
}
|
2002-10-12 13:44:55 -04:00
|
|
|
|
2012-08-10 17:22:46 -04: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-06 21:59:53 -05:00
|
|
|
if (string_value && meta_parse_accelerator (string_value, &combo))
|
2012-08-10 17:22:46 -04:00
|
|
|
;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
"Failed to parse value for overlay-key\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2015-01-06 21:59:53 -05:00
|
|
|
combo.modifiers = 0;
|
|
|
|
|
2012-08-10 17:22:46 -04:00
|
|
|
if (overlay_key_combo.keysym != combo.keysym ||
|
2015-01-06 21:35:32 -05:00
|
|
|
overlay_key_combo.keycode != combo.keycode)
|
2012-08-10 17:22:46 -04:00
|
|
|
{
|
|
|
|
overlay_key_combo = combo;
|
|
|
|
queue_changed (META_PREF_KEYBINDINGS);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-04-10 05:57:16 -04: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 17:41:12 -05:00
|
|
|
const PangoFontDescription*
|
|
|
|
meta_prefs_get_titlebar_font (void)
|
|
|
|
{
|
2002-05-23 22:55:54 -04:00
|
|
|
if (use_system_font)
|
2001-12-09 17:41:12 -05:00
|
|
|
return NULL;
|
|
|
|
else
|
|
|
|
return titlebar_font;
|
|
|
|
}
|
|
|
|
|
2001-12-09 22:55:26 -05:00
|
|
|
int
|
|
|
|
meta_prefs_get_num_workspaces (void)
|
|
|
|
{
|
|
|
|
return num_workspaces;
|
|
|
|
}
|
|
|
|
|
2012-03-07 19:29:58 -05:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_dynamic_workspaces (void)
|
|
|
|
{
|
|
|
|
return dynamic_workspaces;
|
|
|
|
}
|
|
|
|
|
2002-04-30 23:23:46 -04:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_disable_workarounds (void)
|
|
|
|
{
|
|
|
|
return disable_workarounds;
|
|
|
|
}
|
|
|
|
|
2002-12-08 14:17:17 -05:00
|
|
|
#ifdef WITH_VERBOSE_MODE
|
2001-12-09 17:41:12 -05:00
|
|
|
const char*
|
|
|
|
meta_preference_to_string (MetaPreference pref)
|
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
/* TODO: better handled via GLib enum nicknames */
|
2001-12-09 17:41:12 -05:00
|
|
|
switch (pref)
|
|
|
|
{
|
2002-10-07 19:14:40 -04:00
|
|
|
case META_PREF_MOUSE_BUTTON_MODS:
|
|
|
|
return "MOUSE_BUTTON_MODS";
|
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
case META_PREF_FOCUS_MODE:
|
|
|
|
return "FOCUS_MODE";
|
|
|
|
|
2006-04-12 14:01:20 -04:00
|
|
|
case META_PREF_FOCUS_NEW_WINDOWS:
|
|
|
|
return "FOCUS_NEW_WINDOWS";
|
|
|
|
|
2014-04-25 09:26:24 -04:00
|
|
|
case META_PREF_CENTER_NEW_WINDOWS:
|
|
|
|
return "CENTER_NEW_WINDOWS";
|
|
|
|
|
2010-09-10 05:55:20 -04: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 14:35:03 -05:00
|
|
|
case META_PREF_RAISE_ON_CLICK:
|
|
|
|
return "RAISE_ON_CLICK";
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2001-12-09 17:41:12 -05:00
|
|
|
case META_PREF_TITLEBAR_FONT:
|
|
|
|
return "TITLEBAR_FONT";
|
|
|
|
|
2001-12-09 22:55:26 -05:00
|
|
|
case META_PREF_NUM_WORKSPACES:
|
|
|
|
return "NUM_WORKSPACES";
|
2002-01-27 00:50:34 -05:00
|
|
|
|
2008-11-22 14:02:54 -05:00
|
|
|
case META_PREF_KEYBINDINGS:
|
|
|
|
return "KEYBINDINGS";
|
2002-04-30 23:23:46 -04:00
|
|
|
|
|
|
|
case META_PREF_DISABLE_WORKAROUNDS:
|
|
|
|
return "DISABLE_WORKAROUNDS";
|
2002-05-23 22:23:46 -04:00
|
|
|
|
2002-10-18 17:22:27 -04:00
|
|
|
case META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR:
|
|
|
|
return "ACTION_DOUBLE_CLICK_TITLEBAR";
|
|
|
|
|
2007-04-24 23:30:17 -04:00
|
|
|
case META_PREF_ACTION_MIDDLE_CLICK_TITLEBAR:
|
|
|
|
return "ACTION_MIDDLE_CLICK_TITLEBAR";
|
|
|
|
|
|
|
|
case META_PREF_ACTION_RIGHT_CLICK_TITLEBAR:
|
|
|
|
return "ACTION_RIGHT_CLICK_TITLEBAR";
|
|
|
|
|
2002-05-23 22:23:46 -04:00
|
|
|
case META_PREF_AUTO_RAISE:
|
|
|
|
return "AUTO_RAISE";
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2002-05-23 22:23:46 -04:00
|
|
|
case META_PREF_AUTO_RAISE_DELAY:
|
|
|
|
return "AUTO_RAISE_DELAY";
|
2002-07-11 00:10:44 -04:00
|
|
|
|
2012-08-28 22:38:54 -04:00
|
|
|
case META_PREF_FOCUS_CHANGE_ON_POINTER_REST:
|
|
|
|
return "FOCUS_CHANGE_ON_POINTER_REST";
|
|
|
|
|
2002-10-03 22:28:57 -04:00
|
|
|
case META_PREF_BUTTON_LAYOUT:
|
|
|
|
return "BUTTON_LAYOUT";
|
2002-11-19 22:57:20 -05:00
|
|
|
|
|
|
|
case META_PREF_WORKSPACE_NAMES:
|
|
|
|
return "WORKSPACE_NAMES";
|
2003-01-28 10:07:43 -05:00
|
|
|
|
|
|
|
case META_PREF_VISUAL_BELL:
|
|
|
|
return "VISUAL_BELL";
|
|
|
|
|
|
|
|
case META_PREF_AUDIBLE_BELL:
|
|
|
|
return "AUDIBLE_BELL";
|
|
|
|
|
|
|
|
case META_PREF_VISUAL_BELL_TYPE:
|
|
|
|
return "VISUAL_BELL_TYPE";
|
2003-10-12 02:25:38 -04:00
|
|
|
|
2005-01-26 03:43:38 -05:00
|
|
|
case META_PREF_GNOME_ACCESSIBILITY:
|
|
|
|
return "GNOME_ACCESSIBILTY";
|
2006-01-20 17:03:56 -05:00
|
|
|
|
2008-06-29 17:57:39 -04:00
|
|
|
case META_PREF_GNOME_ANIMATIONS:
|
|
|
|
return "GNOME_ANIMATIONS";
|
|
|
|
|
2005-10-25 12:43:01 -04:00
|
|
|
case META_PREF_CURSOR_THEME:
|
|
|
|
return "CURSOR_THEME";
|
2006-01-20 17:03:56 -05:00
|
|
|
|
2005-10-25 12:43:01 -04:00
|
|
|
case META_PREF_CURSOR_SIZE:
|
|
|
|
return "CURSOR_SIZE";
|
2006-02-16 15:26:05 -05:00
|
|
|
|
2009-01-27 16:05:42 -05:00
|
|
|
case META_PREF_RESIZE_WITH_RIGHT_BUTTON:
|
|
|
|
return "RESIZE_WITH_RIGHT_BUTTON";
|
2009-05-07 17:56:27 -04:00
|
|
|
|
2010-09-24 14:28:12 -04:00
|
|
|
case META_PREF_EDGE_TILING:
|
|
|
|
return "EDGE_TILING";
|
2010-06-24 14:41:28 -04:00
|
|
|
|
2009-06-19 11:30:37 -04:00
|
|
|
case META_PREF_FORCE_FULLSCREEN:
|
|
|
|
return "FORCE_FULLSCREEN";
|
|
|
|
|
2011-02-28 07:48:28 -05:00
|
|
|
case META_PREF_WORKSPACES_ONLY_ON_PRIMARY:
|
|
|
|
return "WORKSPACES_ONLY_ON_PRIMARY";
|
|
|
|
|
2011-07-20 02:14:58 -04:00
|
|
|
case META_PREF_DRAGGABLE_BORDER_WIDTH:
|
|
|
|
return "DRAGGABLE_BORDER_WIDTH";
|
2012-03-11 20:00:47 -04:00
|
|
|
|
2014-08-15 18:21:13 -04:00
|
|
|
case META_PREF_DRAG_THRESHOLD:
|
|
|
|
return "DRAG_TRHESHOLD";
|
|
|
|
|
2012-03-11 20:00:47 -04:00
|
|
|
case META_PREF_DYNAMIC_WORKSPACES:
|
|
|
|
return "DYNAMIC_WORKSPACES";
|
2012-09-08 05:34:27 -04:00
|
|
|
|
|
|
|
case META_PREF_AUTO_MAXIMIZE:
|
|
|
|
return "AUTO_MAXIMIZE";
|
2001-12-09 17:41:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return "(unknown)";
|
|
|
|
}
|
2002-12-08 14:17:17 -05:00
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
2002-03-10 13:36:08 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
meta_prefs_set_num_workspaces (int n_workspaces)
|
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
MetaBasePreference *pref;
|
2002-03-10 13:36:08 -05:00
|
|
|
|
2013-04-17 04:04:49 -04: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 13:36:08 -05:00
|
|
|
}
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
static GHashTable *key_bindings;
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
static void
|
|
|
|
meta_key_pref_free (MetaKeyPref *pref)
|
|
|
|
{
|
|
|
|
update_binding (pref, NULL);
|
|
|
|
|
|
|
|
g_free (pref->name);
|
2012-03-27 10:42:42 -04:00
|
|
|
g_object_unref (pref->settings);
|
2011-10-27 21:05:43 -04:00
|
|
|
|
|
|
|
g_free (pref);
|
|
|
|
}
|
|
|
|
|
2008-12-02 18:13:11 -05:00
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
static void
|
|
|
|
init_bindings (void)
|
|
|
|
{
|
2012-08-29 17:07:34 -04:00
|
|
|
MetaKeyPref *pref;
|
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
key_bindings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
|
|
|
|
(GDestroyNotify)meta_key_pref_free);
|
2012-08-29 17:07:34 -04:00
|
|
|
|
|
|
|
pref = g_new0 (MetaKeyPref, 1);
|
|
|
|
pref->name = g_strdup ("overlay-key");
|
|
|
|
pref->action = META_KEYBINDING_ACTION_OVERLAY_KEY;
|
2014-02-25 13:49:16 -05:00
|
|
|
pref->combos = g_slist_prepend (pref->combos, &overlay_key_combo);
|
2012-08-29 17:07:34 -04:00
|
|
|
pref->builtin = 1;
|
|
|
|
|
|
|
|
g_hash_table_insert (key_bindings, g_strdup ("overlay-key"), pref);
|
2002-07-11 00:10:44 -04:00
|
|
|
}
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
static gboolean
|
|
|
|
update_binding (MetaKeyPref *binding,
|
2011-06-24 12:14:15 -04: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 13:23:09 -04:00
|
|
|
{
|
2014-02-25 13:49:16 -05:00
|
|
|
GSList *old_combos, *a, *b;
|
2013-03-31 14:18:54 -04:00
|
|
|
gboolean changed;
|
2011-06-24 12:14:15 -04: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 13:23:09 -04:00
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2011-06-24 12:14:15 -04: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 13:23:09 -04:00
|
|
|
binding->name);
|
2011-06-24 12:14:15 -04:00
|
|
|
|
2014-02-25 13:49:16 -05:00
|
|
|
old_combos = binding->combos;
|
|
|
|
binding->combos = NULL;
|
2013-03-31 14:18:54 -04:00
|
|
|
|
2011-06-24 12:14:15 -04: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 13:23:09 -04:00
|
|
|
{
|
2015-01-06 21:59:53 -05: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 13:23:09 -04:00
|
|
|
|
2015-01-06 21:59:53 -05: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 13:23:09 -04:00
|
|
|
{
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2011-06-24 12:14:15 -04:00
|
|
|
"Failed to parse new GSettings value\n");
|
2013-09-11 04:37:36 -04:00
|
|
|
meta_warning ("\"%s\" found in configuration database is not a valid value for keybinding \"%s\"\n",
|
2011-06-24 12:14:15 -04: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 13:23:09 -04:00
|
|
|
|
2015-01-06 21:59:53 -05:00
|
|
|
g_free (combo);
|
|
|
|
|
2011-06-24 12:14:15 -04: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 13:23:09 -04:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-02-25 13:49:16 -05:00
|
|
|
binding->combos = g_slist_prepend (binding->combos, combo);
|
2011-06-24 12:14:15 -04:00
|
|
|
}
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
|
2014-02-25 13:49:16 -05:00
|
|
|
binding->combos = g_slist_reverse (binding->combos);
|
2013-02-17 15:50:08 -05:00
|
|
|
|
2014-02-25 13:49:16 -05:00
|
|
|
a = old_combos;
|
|
|
|
b = binding->combos;
|
2013-03-31 14:18:54 -04: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 13:49:16 -05:00
|
|
|
g_slist_free_full (old_combos, g_free);
|
2013-03-31 14:18:54 -04:00
|
|
|
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 13:23:09 -04:00
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
|
2002-04-28 00:52:26 -04:00
|
|
|
static gboolean
|
2010-02-16 11:57:00 -05:00
|
|
|
update_key_binding (const char *key,
|
2011-06-24 12:14:15 -04: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 13:23:09 -04:00
|
|
|
{
|
2011-10-27 21:05:43 -04: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 13:23:09 -04:00
|
|
|
|
2011-10-27 21:05:43 -04: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 13:23:09 -04:00
|
|
|
else
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-10-13 04:32:10 -04:00
|
|
|
const char*
|
2011-06-24 12:14:15 -04:00
|
|
|
meta_prefs_get_workspace_name (int i)
|
2004-10-13 04:32:10 -04:00
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
const char *name;
|
2004-10-13 04:32:10 -04:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
if (!workspace_names ||
|
|
|
|
g_strv_length (workspace_names) < (guint)i + 1 ||
|
|
|
|
!*workspace_names[i])
|
2002-11-03 14:06:39 -05:00
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
char *generated_name = g_strdup_printf (_("Workspace %d"), i + 1);
|
|
|
|
name = g_intern_string (generated_name);
|
|
|
|
g_free (generated_name);
|
2002-11-19 22:57:20 -05:00
|
|
|
}
|
2002-11-03 14:06:39 -05:00
|
|
|
else
|
2011-06-24 12:14:15 -04:00
|
|
|
name = workspace_names[i];
|
2002-11-19 22:57:20 -05:00
|
|
|
|
2002-11-03 14:06:39 -05:00
|
|
|
meta_topic (META_DEBUG_PREFS,
|
2011-06-24 12:14:15 -04:00
|
|
|
"Getting name of workspace %d: \"%s\"\n", i, name);
|
2002-11-03 14:06:39 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
return name;
|
2002-11-03 14:06:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2011-06-24 12:14:15 -04:00
|
|
|
meta_prefs_change_workspace_name (int num,
|
2002-11-03 14:06:39 -05:00
|
|
|
const char *name)
|
|
|
|
{
|
2011-06-24 12:14:15 -04:00
|
|
|
GVariantBuilder builder;
|
|
|
|
int n_workspace_names, i;
|
2014-05-02 09:34:02 -04:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
g_return_if_fail (num >= 0);
|
2002-11-03 14:06:39 -05:00
|
|
|
|
2002-11-19 23:54:01 -05:00
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
"Changing name of workspace %d to %s\n",
|
2011-06-24 12:14:15 -04:00
|
|
|
num, name ? name : "none");
|
2002-11-19 23:54:01 -05:00
|
|
|
|
2011-06-24 12:14:15 -04: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 14:06:39 -05:00
|
|
|
{
|
2011-06-24 12:14:15 -04: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 14:06:39 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04: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 14:06:39 -05:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
for (i = 0; i < MAX (num + 1, n_workspace_names); i++)
|
2002-11-03 14:06:39 -05:00
|
|
|
{
|
2011-06-24 12:14:15 -04: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 14:06:39 -05:00
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
g_settings_set_value (SETTINGS (SCHEMA_GENERAL), KEY_WORKSPACE_NAMES,
|
|
|
|
g_variant_builder_end (&builder));
|
2002-11-03 14:06:39 -05:00
|
|
|
}
|
|
|
|
|
2012-11-28 17:32:09 -05:00
|
|
|
/**
|
|
|
|
* meta_prefs_get_button_layout:
|
|
|
|
* @button_layout: (out):
|
|
|
|
*/
|
2002-10-03 22:28:57 -04:00
|
|
|
void
|
2002-10-12 13:44:55 -04:00
|
|
|
meta_prefs_get_button_layout (MetaButtonLayout *button_layout_p)
|
2002-10-03 22:28:57 -04:00
|
|
|
{
|
2002-10-12 13:44:55 -04:00
|
|
|
*button_layout_p = button_layout;
|
2002-10-03 22:28:57 -04:00
|
|
|
}
|
|
|
|
|
2011-11-14 09:22:30 -05:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_visual_bell (void)
|
|
|
|
{
|
|
|
|
return bell_is_visible;
|
|
|
|
}
|
|
|
|
|
2003-01-28 10:07:43 -05:00
|
|
|
gboolean
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 19:18:22 -04:00
|
|
|
meta_prefs_bell_is_audible (void)
|
2003-01-28 10:07:43 -05:00
|
|
|
{
|
|
|
|
return bell_is_audible;
|
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04: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 19:18:22 -04:00
|
|
|
meta_prefs_get_visual_bell_type (void)
|
2003-01-28 10:07:43 -05:00
|
|
|
{
|
|
|
|
return visual_bell_type;
|
|
|
|
}
|
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
gboolean
|
|
|
|
meta_prefs_add_keybinding (const char *name,
|
2012-03-27 10:42:42 -04:00
|
|
|
GSettings *settings,
|
2011-10-27 21:05:43 -04:00
|
|
|
MetaKeyBindingAction action,
|
|
|
|
MetaKeyBindingFlags flags)
|
2002-04-28 00:52:26 -04:00
|
|
|
{
|
2011-10-27 21:05:43 -04:00
|
|
|
MetaKeyPref *pref;
|
|
|
|
char **strokes;
|
2012-03-27 10:42:42 -04:00
|
|
|
guint id;
|
2011-10-27 21:05:43 -04: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 10:42:42 -04:00
|
|
|
pref->settings = g_object_ref (settings);
|
2011-10-27 21:05:43 -04:00
|
|
|
pref->action = action;
|
2014-02-25 13:49:16 -05:00
|
|
|
pref->combos = NULL;
|
2011-11-04 14:18:57 -04:00
|
|
|
pref->builtin = (flags & META_KEY_BINDING_BUILTIN) != 0;
|
2011-10-27 21:05:43 -04: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);
|
|
|
|
|
2012-03-27 10:42:42 -04: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 14:18:57 -04: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);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_prefs_remove_keybinding (const char *name)
|
|
|
|
{
|
|
|
|
MetaKeyPref *pref;
|
|
|
|
guint id;
|
|
|
|
|
|
|
|
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 10:42:42 -04:00
|
|
|
id = GPOINTER_TO_UINT (g_object_steal_data (G_OBJECT (pref->settings), name));
|
|
|
|
g_signal_handler_disconnect (pref->settings, id);
|
2011-11-04 14:18:57 -04:00
|
|
|
|
|
|
|
g_hash_table_remove (key_bindings, name);
|
|
|
|
|
|
|
|
queue_changed (META_PREF_KEYBINDINGS);
|
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GList *
|
2015-01-06 20:58:42 -05:00
|
|
|
meta_prefs_get_keybindings (void)
|
2011-10-27 21:05:43 -04:00
|
|
|
{
|
|
|
|
return g_hash_table_get_values (key_bindings);
|
2002-04-28 00:52:26 -04:00
|
|
|
}
|
2002-10-18 17:22:27 -04:00
|
|
|
|
2014-05-02 09:34:02 -04:00
|
|
|
void
|
2008-12-02 18:13:11 -05:00
|
|
|
meta_prefs_get_overlay_binding (MetaKeyCombo *combo)
|
|
|
|
{
|
|
|
|
*combo = overlay_key_combo;
|
|
|
|
}
|
|
|
|
|
2013-04-10 05:57:16 -04:00
|
|
|
const char *
|
|
|
|
meta_prefs_get_iso_next_group_option (void)
|
|
|
|
{
|
|
|
|
return iso_next_group_option;
|
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04: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 19:18:22 -04:00
|
|
|
meta_prefs_get_action_double_click_titlebar (void)
|
2002-10-18 17:22:27 -04:00
|
|
|
{
|
|
|
|
return action_double_click_titlebar;
|
|
|
|
}
|
2002-04-28 00:52:26 -04:00
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
GDesktopTitlebarAction
|
2007-03-09 20:15:14 -05:00
|
|
|
meta_prefs_get_action_middle_click_titlebar (void)
|
|
|
|
{
|
|
|
|
return action_middle_click_titlebar;
|
|
|
|
}
|
|
|
|
|
2011-06-24 12:14:15 -04:00
|
|
|
GDesktopTitlebarAction
|
2007-03-09 20:15:14 -05:00
|
|
|
meta_prefs_get_action_right_click_titlebar (void)
|
|
|
|
{
|
|
|
|
return action_right_click_titlebar;
|
|
|
|
}
|
|
|
|
|
2002-05-23 22:23:46 -04:00
|
|
|
gboolean
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 19:18:22 -04:00
|
|
|
meta_prefs_get_auto_raise (void)
|
2002-05-23 22:23:46 -04:00
|
|
|
{
|
|
|
|
return auto_raise;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 19:18:22 -04:00
|
|
|
meta_prefs_get_auto_raise_delay (void)
|
2002-05-23 22:23:46 -04:00
|
|
|
{
|
|
|
|
return auto_raise_delay;
|
|
|
|
}
|
2002-06-08 23:44:16 -04:00
|
|
|
|
2012-08-28 22:38:54 -04:00
|
|
|
gboolean
|
2015-01-06 20:58:42 -05:00
|
|
|
meta_prefs_get_focus_change_on_pointer_rest (void)
|
2012-08-28 22:38:54 -04:00
|
|
|
{
|
|
|
|
return focus_change_on_pointer_rest;
|
|
|
|
}
|
|
|
|
|
2005-01-26 03:43:38 -05:00
|
|
|
gboolean
|
2015-01-06 20:58:42 -05:00
|
|
|
meta_prefs_get_gnome_accessibility (void)
|
2005-01-26 03:43:38 -05:00
|
|
|
{
|
|
|
|
return gnome_accessibility;
|
|
|
|
}
|
|
|
|
|
2008-06-29 17:57:39 -04:00
|
|
|
gboolean
|
2015-01-06 20:58:42 -05:00
|
|
|
meta_prefs_get_gnome_animations (void)
|
2008-06-29 17:57:39 -04:00
|
|
|
{
|
|
|
|
return gnome_animations;
|
|
|
|
}
|
|
|
|
|
2010-06-24 14:41:28 -04:00
|
|
|
gboolean
|
2015-01-06 20:58:42 -05:00
|
|
|
meta_prefs_get_edge_tiling (void)
|
2010-06-24 14:41:28 -04:00
|
|
|
{
|
2010-09-24 14:28:12 -04:00
|
|
|
return edge_tiling;
|
2010-06-24 14:41:28 -04:00
|
|
|
}
|
|
|
|
|
2012-09-08 05:34:27 -04:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_auto_maximize (void)
|
|
|
|
{
|
|
|
|
return auto_maximize;
|
|
|
|
}
|
|
|
|
|
2002-06-08 23:44:16 -04:00
|
|
|
MetaKeyBindingAction
|
2002-07-13 23:16:41 -04:00
|
|
|
meta_prefs_get_keybinding_action (const char *name)
|
2002-06-08 23:44:16 -04:00
|
|
|
{
|
2011-10-27 21:05:43 -04:00
|
|
|
MetaKeyPref *pref = g_hash_table_lookup (key_bindings, name);
|
2002-06-08 23:44:16 -04:00
|
|
|
|
2011-10-27 21:05:43 -04:00
|
|
|
return pref ? pref->action
|
|
|
|
: META_KEYBINDING_ACTION_NONE;
|
2002-06-08 23:44:16 -04:00
|
|
|
}
|
|
|
|
|
2012-12-17 07:30:01 -05:00
|
|
|
gint
|
2009-01-27 16:05:42 -05:00
|
|
|
meta_prefs_get_mouse_button_resize (void)
|
|
|
|
{
|
|
|
|
return resize_with_right_button ? 3: 2;
|
|
|
|
}
|
|
|
|
|
2012-12-17 07:30:01 -05:00
|
|
|
gint
|
2009-01-27 16:05:42 -05:00
|
|
|
meta_prefs_get_mouse_button_menu (void)
|
|
|
|
{
|
|
|
|
return resize_with_right_button ? 2: 3;
|
|
|
|
}
|
|
|
|
|
2009-06-19 11:30:37 -04:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_force_fullscreen (void)
|
|
|
|
{
|
|
|
|
return force_fullscreen;
|
|
|
|
}
|
|
|
|
|
2011-02-28 07:48:28 -05:00
|
|
|
gboolean
|
|
|
|
meta_prefs_get_workspaces_only_on_primary (void)
|
|
|
|
{
|
|
|
|
return workspaces_only_on_primary;
|
|
|
|
}
|
|
|
|
|
2011-07-20 02:14:58 -04:00
|
|
|
int
|
|
|
|
meta_prefs_get_draggable_border_width (void)
|
|
|
|
{
|
|
|
|
return draggable_border_width;
|
|
|
|
}
|
|
|
|
|
2014-08-15 18:21:13 -04:00
|
|
|
int
|
|
|
|
meta_prefs_get_drag_threshold (void)
|
|
|
|
{
|
|
|
|
return drag_threshold;
|
|
|
|
}
|
|
|
|
|
2009-06-19 11:30:37 -04:00
|
|
|
void
|
|
|
|
meta_prefs_set_force_fullscreen (gboolean whether)
|
|
|
|
{
|
|
|
|
force_fullscreen = whether;
|
|
|
|
}
|
2012-07-01 13:25:08 -04:00
|
|
|
|
|
|
|
gboolean
|
|
|
|
meta_prefs_get_ignore_request_hide_titlebar (void)
|
|
|
|
{
|
|
|
|
return ignore_request_hide_titlebar;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
meta_prefs_set_ignore_request_hide_titlebar (gboolean whether)
|
|
|
|
{
|
|
|
|
ignore_request_hide_titlebar = whether;
|
|
|
|
}
|