2006-10-01 22:30:10 +00:00
|
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
|
/*
|
2002-07-06 16:50:48 +00:00
|
|
|
|
* Copyright (C) 2001 Havoc Pennington, Copyright (C) 2002 Red Hat Inc.
|
2006-01-10 19:43:21 +00:00
|
|
|
|
* Copyright (C) 2006 Elijah Newren
|
2008-06-13 23:10:32 +00:00
|
|
|
|
* Copyright (C) 2008 Thomas Thurman
|
2011-06-24 16:14:15 +00:00
|
|
|
|
* Copyright (C) 2010 Milan Bouchet-Valat, Copyright (C) 2011 Red Hat Inc.
|
|
|
|
|
*
|
2001-12-09 22:41:12 +00:00
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
|
* 02111-1307, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
2013-03-11 15:52:36 +00:00
|
|
|
|
/**
|
|
|
|
|
* SECTION:prefs
|
|
|
|
|
* @title: Preferences
|
|
|
|
|
* @short_description: Mutter preferences
|
|
|
|
|
*/
|
|
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
|
#include <config.h>
|
2011-03-06 00:29:12 +00:00
|
|
|
|
#include <meta/prefs.h>
|
2002-04-28 04:52:26 +00:00
|
|
|
|
#include "ui.h"
|
2011-03-06 00:29:12 +00:00
|
|
|
|
#include <meta/util.h>
|
|
|
|
|
#include "meta-plugin-manager.h"
|
2011-06-24 16:14:15 +00:00
|
|
|
|
#include <glib.h>
|
|
|
|
|
#include <gio/gio.h>
|
2001-12-09 22:41:12 +00:00
|
|
|
|
#include <string.h>
|
2002-07-11 04:10:44 +00:00
|
|
|
|
#include <stdlib.h>
|
2011-10-28 01:05:43 +00:00
|
|
|
|
#include "keybindings-private.h"
|
2001-12-09 22:41:12 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
/* If you add a key, it needs updating in init() and in the gsettings
|
2008-02-23 06:16:03 +00:00
|
|
|
|
* notify listener and of course in the .schemas file.
|
|
|
|
|
*
|
|
|
|
|
* Keys which are handled by one of the unified handlers below are
|
|
|
|
|
* not given a name here, because the purpose of the unified handlers
|
|
|
|
|
* is that keys should be referred to exactly once.
|
2001-12-09 22:41:12 +00:00
|
|
|
|
*/
|
2011-06-24 16:14:15 +00:00
|
|
|
|
#define KEY_TITLEBAR_FONT "titlebar-font"
|
|
|
|
|
#define KEY_NUM_WORKSPACES "num-workspaces"
|
|
|
|
|
#define KEY_WORKSPACE_NAMES "workspace-names"
|
2004-10-13 08:32:10 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
/* Keys from "foreign" schemas */
|
|
|
|
|
#define KEY_GNOME_ACCESSIBILITY "toolkit-accessibility"
|
|
|
|
|
#define KEY_GNOME_ANIMATIONS "enable-animations"
|
|
|
|
|
#define KEY_GNOME_CURSOR_THEME "cursor-theme"
|
|
|
|
|
#define KEY_GNOME_CURSOR_SIZE "cursor-size"
|
2013-04-10 09:57:16 +00:00
|
|
|
|
#define KEY_XKB_OPTIONS "xkb-options"
|
2004-10-13 08:32:10 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
#define KEY_OVERLAY_KEY "overlay-key"
|
|
|
|
|
#define KEY_WORKSPACES_ONLY_ON_PRIMARY "workspaces-only-on-primary"
|
|
|
|
|
#define KEY_NO_TAB_POPUP "no-tab-popup"
|
2002-04-28 04:52:26 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
/* These are the different schemas we are keeping
|
|
|
|
|
* a GSettings instance for */
|
|
|
|
|
#define SCHEMA_GENERAL "org.gnome.desktop.wm.preferences"
|
|
|
|
|
#define SCHEMA_MUTTER "org.gnome.mutter"
|
|
|
|
|
#define SCHEMA_INTERFACE "org.gnome.desktop.interface"
|
2013-04-10 09:57:16 +00:00
|
|
|
|
#define SCHEMA_INPUT_SOURCES "org.gnome.desktop.input-sources"
|
2002-11-03 19:06:39 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
#define SETTINGS(s) g_hash_table_lookup (settings_schemas, (s))
|
2009-02-02 14:09:04 +00:00
|
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
|
static GList *changes = NULL;
|
|
|
|
|
static guint changed_idle;
|
2002-12-08 19:17:17 +00:00
|
|
|
|
static GList *listeners = NULL;
|
2011-06-24 16:14:15 +00:00
|
|
|
|
static GHashTable *settings_schemas;
|
2002-12-08 19:17:17 +00:00
|
|
|
|
|
Fix various initialization and default issues, especially for
2006-01-20 Elijah Newren <newren gmail com>
Fix various initialization and default issues, especially for
--disable-gconf. Make --disable-gconf actually work. #326661.
* configure.in: Fix compilation with --disable-gconf
* src/metacity.schemas.in: Add a note that if any defaults are
changed in this file, src/prefs.c may need to be updated to
reflect the change
* src/prefs.c: set various static global vars to the right default
value, (meta_prefs_init): get the titlebar_font and current_theme
handled better when not using gconf, (struct MetaSimpleKeyMapping,
screen_string_bindings, window_string_bindings): helper vars to
allow some keybindings to work even without gconf,
(init_bindings): initialize bindings for the without-gconf case
too, (init_commands): make sure these are all NULL for the
non-gconf case so that we don't access random memory,
(init_workspace_names): just give these all a default name for the
non-gconf case,
(meta_prefs_change_workspace_name): actually change the name for
the non-gconf case too
2006-01-20 22:42:25 +00:00
|
|
|
|
static gboolean use_system_font = FALSE;
|
2001-12-09 22:41:12 +00:00
|
|
|
|
static PangoFontDescription *titlebar_font = NULL;
|
2002-10-07 23:14:40 +00:00
|
|
|
|
static MetaVirtualModifier mouse_button_mods = Mod1Mask;
|
2012-08-10 21:22:46 +00:00
|
|
|
|
static MetaKeyCombo overlay_key_combo = { 0, 0, 0 };
|
2011-06-24 16:14:15 +00:00
|
|
|
|
static GDesktopFocusMode focus_mode = G_DESKTOP_FOCUS_MODE_CLICK;
|
|
|
|
|
static GDesktopFocusNewWindows focus_new_windows = G_DESKTOP_FOCUS_NEW_WINDOWS_SMART;
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 19:35:03 +00:00
|
|
|
|
static gboolean raise_on_click = TRUE;
|
2010-09-10 09:55:20 +00:00
|
|
|
|
static gboolean attach_modal_dialogs = FALSE;
|
2002-02-07 03:07:56 +00:00
|
|
|
|
static char* current_theme = NULL;
|
2001-12-10 03:55:26 +00:00
|
|
|
|
static int num_workspaces = 4;
|
2011-06-24 16:14:15 +00:00
|
|
|
|
static GDesktopTitlebarAction action_double_click_titlebar = G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE;
|
|
|
|
|
static GDesktopTitlebarAction action_middle_click_titlebar = G_DESKTOP_TITLEBAR_ACTION_LOWER;
|
|
|
|
|
static GDesktopTitlebarAction action_right_click_titlebar = G_DESKTOP_TITLEBAR_ACTION_MENU;
|
2012-03-08 00:29:58 +00:00
|
|
|
|
static gboolean dynamic_workspaces = FALSE;
|
2002-05-01 03:23:46 +00:00
|
|
|
|
static gboolean disable_workarounds = FALSE;
|
2002-05-24 02:23:46 +00:00
|
|
|
|
static gboolean auto_raise = FALSE;
|
|
|
|
|
static gboolean auto_raise_delay = 500;
|
2012-08-29 02:38:54 +00:00
|
|
|
|
static gboolean focus_change_on_pointer_rest = FALSE;
|
2011-11-14 14:22:30 +00:00
|
|
|
|
static gboolean bell_is_visible = FALSE;
|
2003-01-28 15:07:43 +00:00
|
|
|
|
static gboolean bell_is_audible = TRUE;
|
2005-01-26 08:43:38 +00:00
|
|
|
|
static gboolean gnome_accessibility = FALSE;
|
2008-06-29 21:57:39 +00:00
|
|
|
|
static gboolean gnome_animations = TRUE;
|
2005-07-11 13:25:08 +00:00
|
|
|
|
static char *cursor_theme = NULL;
|
|
|
|
|
static int cursor_size = 24;
|
2011-07-20 06:14:58 +00:00
|
|
|
|
static int draggable_border_width = 10;
|
2009-01-27 21:05:42 +00:00
|
|
|
|
static gboolean resize_with_right_button = FALSE;
|
2010-09-24 18:28:12 +00:00
|
|
|
|
static gboolean edge_tiling = FALSE;
|
2009-06-19 15:30:37 +00:00
|
|
|
|
static gboolean force_fullscreen = TRUE;
|
2012-07-01 17:25:08 +00:00
|
|
|
|
static gboolean ignore_request_hide_titlebar = FALSE;
|
2012-09-08 09:34:27 +00:00
|
|
|
|
static gboolean auto_maximize = TRUE;
|
2003-10-12 06:25:38 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
static GDesktopVisualBellType visual_bell_type = G_DESKTOP_VISUAL_BELL_FULLSCREEN_FLASH;
|
2007-07-22 06:39:29 +00:00
|
|
|
|
static MetaButtonLayout button_layout;
|
2002-11-03 19:06:39 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
/* NULL-terminated array */
|
|
|
|
|
static char **workspace_names = NULL;
|
2002-11-03 19:06:39 +00:00
|
|
|
|
|
2011-02-28 12:48:28 +00:00
|
|
|
|
static gboolean workspaces_only_on_primary = FALSE;
|
2008-10-24 09:07:24 +00:00
|
|
|
|
|
2009-02-02 14:09:04 +00:00
|
|
|
|
static gboolean no_tab_popup = FALSE;
|
|
|
|
|
|
2013-04-10 09:57:16 +00:00
|
|
|
|
static char *iso_next_group_option = NULL;
|
2008-02-23 06:16:03 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
static void handle_preference_update_enum (GSettings *settings,
|
|
|
|
|
gchar *key);
|
|
|
|
|
static gboolean update_binding (MetaKeyPref *binding,
|
|
|
|
|
gchar **strokes);
|
|
|
|
|
static gboolean update_key_binding (const char *key,
|
|
|
|
|
gchar **strokes);
|
2010-02-18 19:04:05 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
static void settings_changed (GSettings *settings,
|
|
|
|
|
gchar *key,
|
|
|
|
|
gpointer data);
|
|
|
|
|
static void bindings_changed (GSettings *settings,
|
|
|
|
|
gchar *key,
|
|
|
|
|
gpointer data);
|
2001-12-09 22:41:12 +00:00
|
|
|
|
|
2002-12-08 19:17:17 +00:00
|
|
|
|
static void queue_changed (MetaPreference pref);
|
|
|
|
|
|
2008-02-23 21:02:05 +00:00
|
|
|
|
static void maybe_give_disable_workarounds_warning (void);
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
static gboolean titlebar_handler (GVariant*, gpointer*, gpointer);
|
|
|
|
|
static gboolean theme_name_handler (GVariant*, gpointer*, gpointer);
|
|
|
|
|
static gboolean mouse_button_mods_handler (GVariant*, gpointer*, gpointer);
|
|
|
|
|
static gboolean button_layout_handler (GVariant*, gpointer*, gpointer);
|
2012-08-10 21:22:46 +00:00
|
|
|
|
static gboolean overlay_key_handler (GVariant*, gpointer*, gpointer);
|
2013-04-10 09:57:16 +00:00
|
|
|
|
static gboolean iso_next_group_handler (GVariant*, gpointer*, gpointer);
|
2008-02-23 06:16:03 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
static void do_override (char *key, char *schema);
|
2008-02-23 06:16:03 +00:00
|
|
|
|
|
2002-12-08 19:17:17 +00:00
|
|
|
|
static void init_bindings (void);
|
2008-02-23 21:02:05 +00:00
|
|
|
|
|
|
|
|
|
|
2008-03-06 17:59:20 +00:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
MetaPrefsChangedFunc func;
|
|
|
|
|
gpointer data;
|
|
|
|
|
} MetaPrefsListener;
|
|
|
|
|
|
2008-02-23 06:16:03 +00:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
char *key;
|
|
|
|
|
char *schema;
|
2008-06-13 23:10:32 +00:00
|
|
|
|
MetaPreference pref;
|
2011-06-24 16:14:15 +00:00
|
|
|
|
} MetaBasePreference;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
MetaBasePreference base;
|
2008-02-23 06:16:03 +00:00
|
|
|
|
gpointer target;
|
|
|
|
|
} MetaEnumPreference;
|
|
|
|
|
|
2008-02-23 21:02:05 +00:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
MetaBasePreference base;
|
2008-06-13 23:10:32 +00:00
|
|
|
|
gboolean *target;
|
2008-02-23 21:02:05 +00:00
|
|
|
|
} MetaBoolPreference;
|
|
|
|
|
|
2011-11-02 15:34:45 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* MetaStringPreference:
|
|
|
|
|
* @handler: (allow-none): A handler. Many of the string preferences
|
|
|
|
|
* aren't stored as strings and need parsing; others of them have
|
|
|
|
|
* default values which can't be solved in the general case. If you
|
|
|
|
|
* include a function pointer here, it will be called 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.
|
|
|
|
|
* @target: (allow-none): Where to write the incoming string.
|
|
|
|
|
* This must be %NULL if the handler is non-%NULL.
|
|
|
|
|
* If the incoming string is %NULL, no change will be made.
|
|
|
|
|
*/
|
2008-03-06 17:59:20 +00:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
MetaBasePreference base;
|
|
|
|
|
GSettingsGetMapping handler;
|
2008-03-06 17:59:20 +00:00
|
|
|
|
gchar **target;
|
|
|
|
|
} MetaStringPreference;
|
|
|
|
|
|
2013-05-12 13:37:05 +00:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
MetaBasePreference base;
|
|
|
|
|
GSettingsGetMapping handler;
|
|
|
|
|
gchar ***target;
|
|
|
|
|
} MetaStringArrayPreference;
|
|
|
|
|
|
2008-06-13 23:10:32 +00:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
MetaBasePreference base;
|
2008-06-13 23:10:32 +00:00
|
|
|
|
gint *target;
|
|
|
|
|
} MetaIntPreference;
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
|
|
|
|
|
/* All preferences that are not keybindings must be listed here,
|
|
|
|
|
* plus in the GSettings schemas and the MetaPreference enum.
|
|
|
|
|
*/
|
|
|
|
|
|
2008-06-13 23:10:32 +00:00
|
|
|
|
/* FIXMEs: */
|
|
|
|
|
/* @@@ Don't use NULL lines at the end; glib can tell you how big it is */
|
|
|
|
|
|
2008-02-23 06:16:03 +00:00
|
|
|
|
static MetaEnumPreference preferences_enum[] =
|
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "focus-new-windows",
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_FOCUS_NEW_WINDOWS,
|
|
|
|
|
},
|
2008-02-23 06:16:03 +00:00
|
|
|
|
&focus_new_windows,
|
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "focus-mode",
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_FOCUS_MODE,
|
|
|
|
|
},
|
2008-02-23 06:16:03 +00:00
|
|
|
|
&focus_mode,
|
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "visual-bell-type",
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_VISUAL_BELL_TYPE,
|
|
|
|
|
},
|
2008-02-23 06:16:03 +00:00
|
|
|
|
&visual_bell_type,
|
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "action-double-click-titlebar",
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR,
|
|
|
|
|
},
|
2008-02-23 06:16:03 +00:00
|
|
|
|
&action_double_click_titlebar,
|
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "action-middle-click-titlebar",
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_ACTION_MIDDLE_CLICK_TITLEBAR,
|
|
|
|
|
},
|
2008-02-23 06:16:03 +00:00
|
|
|
|
&action_middle_click_titlebar,
|
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "action-right-click-titlebar",
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_ACTION_RIGHT_CLICK_TITLEBAR,
|
|
|
|
|
},
|
2008-02-23 06:16:03 +00:00
|
|
|
|
&action_right_click_titlebar,
|
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{ { NULL, 0, 0 }, NULL },
|
2008-02-23 06:16:03 +00:00
|
|
|
|
};
|
|
|
|
|
|
2008-02-23 21:02:05 +00:00
|
|
|
|
static MetaBoolPreference preferences_bool[] =
|
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "attach-modal-dialogs",
|
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
|
META_PREF_ATTACH_MODAL_DIALOGS,
|
|
|
|
|
},
|
2010-09-10 09:55:20 +00:00
|
|
|
|
&attach_modal_dialogs,
|
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "raise-on-click",
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_RAISE_ON_CLICK,
|
|
|
|
|
},
|
2008-06-13 23:10:32 +00:00
|
|
|
|
&raise_on_click,
|
2008-02-23 21:02:05 +00:00
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "titlebar-uses-system-font",
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_TITLEBAR_FONT, /* note! shares a pref */
|
|
|
|
|
},
|
2008-06-13 23:10:32 +00:00
|
|
|
|
&use_system_font,
|
2008-02-23 21:02:05 +00:00
|
|
|
|
},
|
2012-03-08 00:29:58 +00:00
|
|
|
|
{
|
|
|
|
|
{ "dynamic-workspaces",
|
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
|
META_PREF_DYNAMIC_WORKSPACES,
|
|
|
|
|
},
|
|
|
|
|
&dynamic_workspaces,
|
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "disable-workarounds",
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_DISABLE_WORKAROUNDS,
|
|
|
|
|
},
|
2008-06-13 23:10:32 +00:00
|
|
|
|
&disable_workarounds,
|
2008-02-23 21:02:05 +00:00
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "auto-raise",
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_AUTO_RAISE,
|
|
|
|
|
},
|
2008-06-13 23:10:32 +00:00
|
|
|
|
&auto_raise,
|
2008-02-23 21:02:05 +00:00
|
|
|
|
},
|
2012-08-29 02:38:54 +00:00
|
|
|
|
{
|
|
|
|
|
{ "focus-change-on-pointer-rest",
|
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
|
META_PREF_FOCUS_CHANGE_ON_POINTER_REST,
|
|
|
|
|
},
|
|
|
|
|
&focus_change_on_pointer_rest
|
|
|
|
|
},
|
2011-11-14 14:22:30 +00:00
|
|
|
|
{
|
|
|
|
|
{ "visual-bell",
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_VISUAL_BELL,
|
|
|
|
|
},
|
|
|
|
|
&bell_is_visible, /* FIXME: change the name: it's confusing */
|
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "audible-bell",
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_AUDIBLE_BELL,
|
|
|
|
|
},
|
2008-06-13 23:10:32 +00:00
|
|
|
|
&bell_is_audible, /* FIXME: change the name: it's confusing */
|
2008-02-23 21:02:05 +00:00
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ KEY_GNOME_ACCESSIBILITY,
|
|
|
|
|
SCHEMA_INTERFACE,
|
|
|
|
|
META_PREF_GNOME_ACCESSIBILITY,
|
|
|
|
|
},
|
2008-06-13 23:10:32 +00:00
|
|
|
|
&gnome_accessibility,
|
2008-02-23 21:02:05 +00:00
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ KEY_GNOME_ANIMATIONS,
|
|
|
|
|
SCHEMA_INTERFACE,
|
|
|
|
|
META_PREF_GNOME_ANIMATIONS,
|
|
|
|
|
},
|
2008-06-29 21:57:39 +00:00
|
|
|
|
&gnome_animations,
|
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "resize-with-right-button",
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_RESIZE_WITH_RIGHT_BUTTON,
|
|
|
|
|
},
|
2009-01-27 21:05:42 +00:00
|
|
|
|
&resize_with_right_button,
|
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "edge-tiling",
|
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
|
META_PREF_EDGE_TILING,
|
|
|
|
|
},
|
2010-09-24 18:28:12 +00:00
|
|
|
|
&edge_tiling,
|
2010-06-24 18:41:28 +00:00
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "workspaces-only-on-primary",
|
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
|
META_PREF_WORKSPACES_ONLY_ON_PRIMARY,
|
|
|
|
|
},
|
2011-02-28 12:48:28 +00:00
|
|
|
|
&workspaces_only_on_primary,
|
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ KEY_NO_TAB_POPUP,
|
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
|
META_PREF_NO_TAB_POPUP,
|
|
|
|
|
},
|
2009-02-02 14:09:04 +00:00
|
|
|
|
&no_tab_popup,
|
|
|
|
|
},
|
2012-09-08 09:34:27 +00:00
|
|
|
|
{
|
|
|
|
|
{ "auto-maximize",
|
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
|
META_PREF_AUTO_MAXIMIZE,
|
|
|
|
|
},
|
|
|
|
|
&auto_maximize,
|
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{ { NULL, 0, 0 }, NULL },
|
2008-02-23 21:02:05 +00:00
|
|
|
|
};
|
2008-02-23 06:16:03 +00:00
|
|
|
|
|
2008-03-06 17:59:20 +00:00
|
|
|
|
static MetaStringPreference preferences_string[] =
|
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "mouse-button-modifier",
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_MOUSE_BUTTON_MODS,
|
|
|
|
|
},
|
2008-03-06 17:59:20 +00:00
|
|
|
|
mouse_button_mods_handler,
|
|
|
|
|
NULL,
|
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "theme",
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_THEME,
|
|
|
|
|
},
|
2008-03-06 17:59:20 +00:00
|
|
|
|
theme_name_handler,
|
|
|
|
|
NULL,
|
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ KEY_TITLEBAR_FONT,
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_TITLEBAR_FONT,
|
|
|
|
|
},
|
2008-03-06 17:59:20 +00:00
|
|
|
|
titlebar_handler,
|
|
|
|
|
NULL,
|
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "button-layout",
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_BUTTON_LAYOUT,
|
|
|
|
|
},
|
2008-03-06 17:59:20 +00:00
|
|
|
|
button_layout_handler,
|
|
|
|
|
NULL,
|
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "cursor-theme",
|
|
|
|
|
SCHEMA_INTERFACE,
|
|
|
|
|
META_PREF_CURSOR_THEME,
|
|
|
|
|
},
|
2008-03-06 17:59:20 +00:00
|
|
|
|
NULL,
|
|
|
|
|
&cursor_theme,
|
|
|
|
|
},
|
2012-08-10 21:22:46 +00:00
|
|
|
|
{
|
|
|
|
|
{ "overlay-key",
|
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
|
META_PREF_KEYBINDINGS,
|
|
|
|
|
},
|
|
|
|
|
overlay_key_handler,
|
|
|
|
|
NULL,
|
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{ { NULL, 0, 0 }, NULL },
|
2008-03-06 17:59:20 +00:00
|
|
|
|
};
|
|
|
|
|
|
2013-05-12 13:37:05 +00:00
|
|
|
|
static MetaStringArrayPreference preferences_string_array[] =
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
{ KEY_WORKSPACE_NAMES,
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_KEYBINDINGS,
|
|
|
|
|
},
|
|
|
|
|
NULL,
|
|
|
|
|
&workspace_names,
|
|
|
|
|
},
|
2013-04-10 09:57:16 +00:00
|
|
|
|
{
|
|
|
|
|
{ KEY_XKB_OPTIONS,
|
|
|
|
|
SCHEMA_INPUT_SOURCES,
|
|
|
|
|
META_PREF_KEYBINDINGS,
|
|
|
|
|
},
|
|
|
|
|
iso_next_group_handler,
|
|
|
|
|
NULL,
|
|
|
|
|
},
|
2013-05-12 13:37:05 +00:00
|
|
|
|
{ { NULL, 0, 0 }, NULL },
|
|
|
|
|
};
|
|
|
|
|
|
2008-06-13 23:10:32 +00:00
|
|
|
|
static MetaIntPreference preferences_int[] =
|
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ KEY_NUM_WORKSPACES,
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_NUM_WORKSPACES,
|
|
|
|
|
},
|
|
|
|
|
&num_workspaces
|
2008-06-13 23:10:32 +00:00
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "auto-raise-delay",
|
|
|
|
|
SCHEMA_GENERAL,
|
|
|
|
|
META_PREF_AUTO_RAISE_DELAY,
|
|
|
|
|
},
|
|
|
|
|
&auto_raise_delay
|
2008-06-13 23:10:32 +00:00
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "cursor-size",
|
|
|
|
|
SCHEMA_INTERFACE,
|
|
|
|
|
META_PREF_CURSOR_SIZE,
|
|
|
|
|
},
|
|
|
|
|
&cursor_size
|
2008-06-13 23:10:32 +00:00
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{
|
|
|
|
|
{ "draggable-border-width",
|
|
|
|
|
SCHEMA_MUTTER,
|
|
|
|
|
META_PREF_DRAGGABLE_BORDER_WIDTH,
|
|
|
|
|
},
|
|
|
|
|
&draggable_border_width
|
2011-07-20 06:14:58 +00:00
|
|
|
|
},
|
2011-06-24 16:14:15 +00:00
|
|
|
|
{ { NULL, 0, 0 }, NULL },
|
2008-06-13 23:10:32 +00:00
|
|
|
|
};
|
|
|
|
|
|
2010-04-12 21:39:27 +00:00
|
|
|
|
/*
|
2011-06-24 16:14:15 +00: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 21:39:27 +00:00
|
|
|
|
*/
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
char *key;
|
|
|
|
|
char *new_schema;
|
2010-04-12 21:39:27 +00:00
|
|
|
|
} MetaPrefsOverriddenKey;
|
|
|
|
|
|
|
|
|
|
static GSList *overridden_keys;
|
|
|
|
|
|
2008-02-23 06:16:03 +00:00
|
|
|
|
static void
|
|
|
|
|
handle_preference_init_enum (void)
|
|
|
|
|
{
|
|
|
|
|
MetaEnumPreference *cursor = preferences_enum;
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
while (cursor->base.key != NULL)
|
2008-02-23 06:16:03 +00:00
|
|
|
|
{
|
2008-03-06 17:59:20 +00:00
|
|
|
|
if (cursor->target==NULL)
|
2011-06-24 16:14:15 +00:00
|
|
|
|
continue;
|
2008-02-23 06:16:03 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
*((gint *) cursor->target) =
|
|
|
|
|
g_settings_get_enum (SETTINGS (cursor->base.schema), cursor->base.key);
|
2008-02-23 06:16:03 +00:00
|
|
|
|
|
|
|
|
|
++cursor;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-02-23 21:02:05 +00:00
|
|
|
|
static void
|
|
|
|
|
handle_preference_init_bool (void)
|
|
|
|
|
{
|
|
|
|
|
MetaBoolPreference *cursor = preferences_bool;
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
while (cursor->base.key != NULL)
|
2008-02-23 21:02:05 +00:00
|
|
|
|
{
|
|
|
|
|
if (cursor->target!=NULL)
|
2011-06-24 16:14:15 +00:00
|
|
|
|
*cursor->target =
|
|
|
|
|
g_settings_get_boolean (SETTINGS (cursor->base.schema),
|
|
|
|
|
cursor->base.key);
|
2008-02-23 21:02:05 +00:00
|
|
|
|
|
|
|
|
|
++cursor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
maybe_give_disable_workarounds_warning ();
|
|
|
|
|
}
|
|
|
|
|
|
2008-03-06 17:59:20 +00:00
|
|
|
|
static void
|
|
|
|
|
handle_preference_init_string (void)
|
|
|
|
|
{
|
|
|
|
|
MetaStringPreference *cursor = preferences_string;
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
while (cursor->base.key != NULL)
|
2008-03-06 17:59:20 +00:00
|
|
|
|
{
|
|
|
|
|
char *value;
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
/* Complex keys have a mapping function to check validity */
|
2008-03-06 17:59:20 +00:00
|
|
|
|
if (cursor->handler)
|
|
|
|
|
{
|
|
|
|
|
if (cursor->target)
|
2011-06-24 16:14:15 +00:00
|
|
|
|
meta_bug ("%s has both a target and a handler\n", cursor->base.key);
|
2008-03-06 17:59:20 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
g_settings_get_mapped (SETTINGS (cursor->base.schema),
|
|
|
|
|
cursor->base.key, cursor->handler, NULL);
|
2008-03-06 17:59:20 +00:00
|
|
|
|
}
|
2011-06-24 16:14:15 +00:00
|
|
|
|
else
|
2008-03-06 17:59:20 +00:00
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (!cursor->target)
|
|
|
|
|
meta_bug ("%s must have handler or target\n", cursor->base.key);
|
|
|
|
|
|
2008-03-06 17:59:20 +00:00
|
|
|
|
if (*(cursor->target))
|
|
|
|
|
g_free (*(cursor->target));
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
value = g_settings_get_string (SETTINGS (cursor->base.schema),
|
|
|
|
|
cursor->base.key);
|
|
|
|
|
|
2008-03-06 17:59:20 +00:00
|
|
|
|
*(cursor->target) = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
++cursor;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-12 13:37:05 +00:00
|
|
|
|
static void
|
|
|
|
|
handle_preference_init_string_array (void)
|
|
|
|
|
{
|
|
|
|
|
MetaStringArrayPreference *cursor = preferences_string_array;
|
|
|
|
|
|
|
|
|
|
while (cursor->base.key != NULL)
|
|
|
|
|
{
|
|
|
|
|
char **value;
|
|
|
|
|
|
|
|
|
|
/* Complex keys have a mapping function to check validity */
|
|
|
|
|
if (cursor->handler)
|
|
|
|
|
{
|
|
|
|
|
if (cursor->target)
|
|
|
|
|
meta_bug ("%s has both a target and a handler\n", cursor->base.key);
|
|
|
|
|
|
|
|
|
|
g_settings_get_mapped (SETTINGS (cursor->base.schema),
|
|
|
|
|
cursor->base.key, cursor->handler, NULL);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (!cursor->target)
|
|
|
|
|
meta_bug ("%s must have handler or target\n", cursor->base.key);
|
|
|
|
|
|
|
|
|
|
if (*(cursor->target))
|
|
|
|
|
g_strfreev (*(cursor->target));
|
|
|
|
|
|
|
|
|
|
value = g_settings_get_strv (SETTINGS (cursor->base.schema),
|
|
|
|
|
cursor->base.key);
|
|
|
|
|
|
|
|
|
|
*(cursor->target) = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
++cursor;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-13 23:10:32 +00:00
|
|
|
|
static void
|
|
|
|
|
handle_preference_init_int (void)
|
|
|
|
|
{
|
|
|
|
|
MetaIntPreference *cursor = preferences_int;
|
|
|
|
|
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
while (cursor->base.key != NULL)
|
2008-06-13 23:10:32 +00:00
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (cursor->target)
|
|
|
|
|
*cursor->target = g_settings_get_int (SETTINGS (cursor->base.schema),
|
|
|
|
|
cursor->base.key);
|
2008-06-13 23:10:32 +00:00
|
|
|
|
|
|
|
|
|
++cursor;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
static void
|
|
|
|
|
handle_preference_update_enum (GSettings *settings,
|
|
|
|
|
gchar *key)
|
2008-02-23 06:16:03 +00:00
|
|
|
|
{
|
|
|
|
|
MetaEnumPreference *cursor = preferences_enum;
|
|
|
|
|
gint old_value;
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
while (cursor->base.key != NULL && strcmp (key, cursor->base.key) != 0)
|
2008-02-23 06:16:03 +00:00
|
|
|
|
++cursor;
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (cursor->base.key == NULL)
|
2008-02-23 06:16:03 +00:00
|
|
|
|
/* Didn't recognise that key. */
|
2011-06-24 16:14:15 +00:00
|
|
|
|
return;
|
2008-02-23 06:16:03 +00:00
|
|
|
|
|
|
|
|
|
/* We need to know whether the value changes, so
|
|
|
|
|
* store the current value away.
|
|
|
|
|
*/
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
old_value = * ((gint *)cursor->target);
|
|
|
|
|
*((gint *)cursor->target) =
|
|
|
|
|
g_settings_get_enum (SETTINGS (cursor->base.schema), key);
|
2008-02-23 06:16:03 +00:00
|
|
|
|
|
|
|
|
|
/* Did it change? If so, tell the listeners about it. */
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (old_value != *((gint *)cursor->target))
|
|
|
|
|
queue_changed (cursor->base.pref);
|
2008-02-23 06:16:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
static void
|
|
|
|
|
handle_preference_update_bool (GSettings *settings,
|
|
|
|
|
gchar *key)
|
2008-02-23 21:02:05 +00:00
|
|
|
|
{
|
|
|
|
|
MetaBoolPreference *cursor = preferences_bool;
|
|
|
|
|
gboolean old_value;
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
while (cursor->base.key != NULL && strcmp (key, cursor->base.key) != 0)
|
2008-02-23 21:02:05 +00:00
|
|
|
|
++cursor;
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (cursor->base.key == NULL || cursor->target == NULL)
|
|
|
|
|
/* Unknown key or no work for us to do. */
|
|
|
|
|
return;
|
2008-02-23 21:02:05 +00:00
|
|
|
|
|
|
|
|
|
/* We need to know whether the value changes, so
|
|
|
|
|
* store the current value away.
|
|
|
|
|
*/
|
2011-06-24 16:14:15 +00:00
|
|
|
|
old_value = *((gboolean *) cursor->target);
|
2008-02-23 21:02:05 +00:00
|
|
|
|
|
|
|
|
|
/* Now look it up... */
|
2011-06-24 16:14:15 +00:00
|
|
|
|
*((gboolean *) cursor->target) =
|
|
|
|
|
g_settings_get_boolean (SETTINGS (cursor->base.schema), key);
|
2008-02-23 21:02:05 +00:00
|
|
|
|
|
|
|
|
|
/* Did it change? If so, tell the listeners about it. */
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (old_value != *((gboolean *)cursor->target))
|
|
|
|
|
queue_changed (cursor->base.pref);
|
2008-02-23 21:02:05 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (cursor->base.pref==META_PREF_DISABLE_WORKAROUNDS)
|
2008-02-23 21:02:05 +00:00
|
|
|
|
maybe_give_disable_workarounds_warning ();
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
static void
|
|
|
|
|
handle_preference_update_string (GSettings *settings,
|
|
|
|
|
gchar *key)
|
2008-03-06 17:59:20 +00:00
|
|
|
|
{
|
|
|
|
|
MetaStringPreference *cursor = preferences_string;
|
2011-06-24 16:14:15 +00:00
|
|
|
|
char *value;
|
|
|
|
|
gboolean inform_listeners = FALSE;
|
2008-03-06 17:59:20 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
while (cursor->base.key != NULL && strcmp (key, cursor->base.key) != 0)
|
2008-03-06 17:59:20 +00:00
|
|
|
|
++cursor;
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (cursor->base.key==NULL)
|
2008-03-06 17:59:20 +00:00
|
|
|
|
/* Didn't recognise that key. */
|
2011-06-24 16:14:15 +00:00
|
|
|
|
return;
|
2008-03-06 17:59:20 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
/* Complex keys have a mapping function to check validity */
|
|
|
|
|
if (cursor->handler)
|
2008-03-06 17:59:20 +00:00
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (cursor->target)
|
|
|
|
|
meta_bug ("%s has both a target and a handler\n", cursor->base.key);
|
|
|
|
|
|
|
|
|
|
g_settings_get_mapped (SETTINGS (cursor->base.schema),
|
|
|
|
|
cursor->base.key, cursor->handler, NULL);
|
2008-03-06 17:59:20 +00:00
|
|
|
|
}
|
2011-06-24 16:14:15 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (!cursor->target)
|
|
|
|
|
meta_bug ("%s must have handler or target\n", cursor->base.key);
|
2008-03-06 17:59:20 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
value = g_settings_get_string (SETTINGS (cursor->base.schema),
|
|
|
|
|
cursor->base.key);
|
|
|
|
|
|
|
|
|
|
inform_listeners = (g_strcmp0 (value, *(cursor->target)) != 0);
|
2008-03-06 17:59:20 +00:00
|
|
|
|
|
|
|
|
|
if (*(cursor->target))
|
|
|
|
|
g_free(*(cursor->target));
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
*(cursor->target) = value;
|
2008-03-06 17:59:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (inform_listeners)
|
2011-06-24 16:14:15 +00:00
|
|
|
|
queue_changed (cursor->base.pref);
|
2008-03-06 17:59:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-12 13:37:05 +00:00
|
|
|
|
static void
|
|
|
|
|
handle_preference_update_string_array (GSettings *settings,
|
|
|
|
|
gchar *key)
|
|
|
|
|
{
|
|
|
|
|
MetaStringArrayPreference *cursor = preferences_string_array;
|
|
|
|
|
gboolean inform_listeners = FALSE;
|
|
|
|
|
|
|
|
|
|
while (cursor->base.key != NULL && strcmp (key, cursor->base.key) != 0)
|
|
|
|
|
++cursor;
|
|
|
|
|
|
|
|
|
|
if (cursor->base.key==NULL)
|
|
|
|
|
/* Didn't recognise that key. */
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Complex keys have a mapping function to check validity */
|
|
|
|
|
if (cursor->handler)
|
|
|
|
|
{
|
|
|
|
|
if (cursor->target)
|
|
|
|
|
meta_bug ("%s has both a target and a handler\n", cursor->base.key);
|
|
|
|
|
|
|
|
|
|
g_settings_get_mapped (SETTINGS (cursor->base.schema),
|
|
|
|
|
cursor->base.key, cursor->handler, NULL);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
char **values, **previous;
|
|
|
|
|
int n_values, n_previous, i;
|
|
|
|
|
|
|
|
|
|
if (!cursor->target)
|
|
|
|
|
meta_bug ("%s must have handler or target\n", cursor->base.key);
|
|
|
|
|
|
|
|
|
|
values = g_settings_get_strv (SETTINGS (cursor->base.schema),
|
|
|
|
|
cursor->base.key);
|
|
|
|
|
n_values = g_strv_length (values);
|
|
|
|
|
previous = *(cursor->target);
|
|
|
|
|
n_previous = previous ? g_strv_length (previous) : 0;
|
|
|
|
|
|
|
|
|
|
inform_listeners = n_previous != n_values;
|
|
|
|
|
for (i = 0; i < n_values && !inform_listeners; i++)
|
|
|
|
|
inform_listeners = g_strcmp0 (values[i], previous[i]) != 0;
|
|
|
|
|
|
|
|
|
|
if (*(cursor->target))
|
|
|
|
|
g_strfreev (*(cursor->target));
|
|
|
|
|
*(cursor->target) = values;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (inform_listeners)
|
|
|
|
|
queue_changed (cursor->base.pref);
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
static void
|
|
|
|
|
handle_preference_update_int (GSettings *settings,
|
|
|
|
|
gchar *key)
|
2008-06-13 23:10:32 +00:00
|
|
|
|
{
|
|
|
|
|
MetaIntPreference *cursor = preferences_int;
|
|
|
|
|
gint new_value;
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
while (cursor->base.key != NULL && strcmp (key, cursor->base.key) != 0)
|
2008-06-13 23:10:32 +00:00
|
|
|
|
++cursor;
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (cursor->base.key == NULL || cursor->target == NULL)
|
|
|
|
|
/* Unknown key or no work for us to do. */
|
|
|
|
|
return;
|
2008-06-13 23:10:32 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
new_value = g_settings_get_int (SETTINGS (cursor->base.schema), key);
|
2008-06-13 23:10:32 +00:00
|
|
|
|
|
|
|
|
|
/* Did it change? If so, tell the listeners about it. */
|
|
|
|
|
if (*cursor->target != new_value)
|
|
|
|
|
{
|
|
|
|
|
*cursor->target = new_value;
|
2011-06-24 16:14:15 +00:00
|
|
|
|
queue_changed (cursor->base.pref);
|
2008-06-13 23:10:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
|
/* Listeners. */
|
|
|
|
|
/****************************************************************************/
|
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* meta_prefs_add_listener: (skip)
|
2013-02-15 18:42:08 +00:00
|
|
|
|
* @func: a #MetaPrefsChangedFunc
|
|
|
|
|
* @user_data: data passed to the function
|
2010-09-01 19:39:53 +00:00
|
|
|
|
*
|
|
|
|
|
*/
|
2001-12-09 22:41:12 +00:00
|
|
|
|
void
|
|
|
|
|
meta_prefs_add_listener (MetaPrefsChangedFunc func,
|
2012-11-16 20:23:47 +00:00
|
|
|
|
gpointer user_data)
|
2001-12-09 22:41:12 +00:00
|
|
|
|
{
|
|
|
|
|
MetaPrefsListener *l;
|
|
|
|
|
|
|
|
|
|
l = g_new (MetaPrefsListener, 1);
|
|
|
|
|
l->func = func;
|
2012-11-16 20:23:47 +00:00
|
|
|
|
l->data = user_data;
|
2001-12-09 22:41:12 +00:00
|
|
|
|
|
|
|
|
|
listeners = g_list_prepend (listeners, l);
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-01 19:39:53 +00:00
|
|
|
|
/**
|
|
|
|
|
* meta_prefs_remove_listener: (skip)
|
2013-02-15 18:42:08 +00:00
|
|
|
|
* @func: a #MetaPrefsChangedFunc
|
|
|
|
|
* @user_data: data passed to the function
|
2010-09-01 19:39:53 +00:00
|
|
|
|
*
|
|
|
|
|
*/
|
2001-12-09 22:41:12 +00:00
|
|
|
|
void
|
|
|
|
|
meta_prefs_remove_listener (MetaPrefsChangedFunc func,
|
2012-11-16 20:23:47 +00:00
|
|
|
|
gpointer user_data)
|
2001-12-09 22:41:12 +00:00
|
|
|
|
{
|
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
|
|
tmp = listeners;
|
|
|
|
|
while (tmp != NULL)
|
|
|
|
|
{
|
|
|
|
|
MetaPrefsListener *l = tmp->data;
|
|
|
|
|
|
|
|
|
|
if (l->func == func &&
|
2012-11-16 20:23:47 +00:00
|
|
|
|
l->data == user_data)
|
2001-12-09 22:41:12 +00:00
|
|
|
|
{
|
|
|
|
|
g_free (l);
|
|
|
|
|
listeners = g_list_delete_link (listeners, tmp);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 19:06:39 +00:00
|
|
|
|
meta_topic (META_DEBUG_PREFS, "Notifying listeners that pref %s changed\n",
|
|
|
|
|
meta_preference_to_string (pref));
|
2001-12-09 22:41:12 +00:00
|
|
|
|
|
|
|
|
|
copy = g_list_copy (listeners);
|
|
|
|
|
|
|
|
|
|
tmp = copy;
|
2008-03-06 17:59:20 +00:00
|
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
|
while (tmp != NULL)
|
|
|
|
|
{
|
|
|
|
|
MetaPrefsListener *l = tmp->data;
|
|
|
|
|
|
|
|
|
|
(* l->func) (pref, l->data);
|
2008-03-06 17:59:20 +00:00
|
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
|
tmp = tmp->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_list_free (copy);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
changed_idle_handler (gpointer data)
|
|
|
|
|
{
|
|
|
|
|
GList *tmp;
|
|
|
|
|
GList *copy;
|
|
|
|
|
|
|
|
|
|
changed_idle = 0;
|
|
|
|
|
|
|
|
|
|
copy = g_list_copy (changes); /* reentrancy paranoia */
|
|
|
|
|
|
|
|
|
|
g_list_free (changes);
|
|
|
|
|
changes = NULL;
|
|
|
|
|
|
|
|
|
|
tmp = copy;
|
|
|
|
|
while (tmp != NULL)
|
|
|
|
|
{
|
|
|
|
|
MetaPreference pref = GPOINTER_TO_INT (tmp->data);
|
|
|
|
|
|
|
|
|
|
emit_changed (pref);
|
|
|
|
|
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_list_free (copy);
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
queue_changed (MetaPreference pref)
|
|
|
|
|
{
|
2002-11-03 19:06:39 +00:00
|
|
|
|
meta_topic (META_DEBUG_PREFS, "Queueing change of pref %s\n",
|
|
|
|
|
meta_preference_to_string (pref));
|
2008-03-06 17:59:20 +00:00
|
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
|
if (g_list_find (changes, GINT_TO_POINTER (pref)) == NULL)
|
|
|
|
|
changes = g_list_prepend (changes, GINT_TO_POINTER (pref));
|
|
|
|
|
else
|
2002-11-03 19:06:39 +00:00
|
|
|
|
meta_topic (META_DEBUG_PREFS, "Change of pref %s was already pending\n",
|
|
|
|
|
meta_preference_to_string (pref));
|
2002-04-28 04:52:26 +00:00
|
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
|
if (changed_idle == 0)
|
on unminimize, queue calc_showing on all transients
2002-05-05 Havoc Pennington <hp@pobox.com>
* src/window.c (meta_window_unminimize): on unminimize, queue
calc_showing on all transients
(meta_window_activate): on activate, unminimize all a window's
ancestors, not just the window itself.
* src/workspace.c (set_work_area_hint): don't increment "tmp" by
16 unsigned long, increment by 4
* src/window.c (meta_window_free): if a window isn't minimized,
restore its WM_STATE to NormalState instead of IconicState,
since IconicState on initial window map means that the window
should be minimized.
* src/workspace.c (meta_workspace_invalidate_work_area): queue an
idle to recompute the work area hint.
(set_work_area_hint): we need 4*num_workspaces ints, not just
num_workspaces.
* src/screen.c (meta_screen_new): add work_area_idle field,
handle it on screen shutdown
* src/common.h (META_PRIORITY_PREFS_NOTIFY,
META_PRIORITY_WORK_AREA_HINT): define some idle priorities
* src/window.c (meta_window_calc_showing): hide windows if
their parent window is minimized
(meta_window_minimize): also queue_calc_showing on all
transients of the window being minimized
* src/place.c (constrain_placement): function to apply
placement-time-only constraints, such as "not off the left of the
screen"
(meta_window_place): put dialogs down a bit over their parent,
not right at the top.
(meta_window_place): when centering a dialog, center it
on the current xinerama screen, rather than the entire
screen.
* src/screen.c (meta_screen_get_current_xinerama): new function,
but not implemented
2002-05-05 05:41:13 +00:00
|
|
|
|
changed_idle = g_idle_add_full (META_PRIORITY_PREFS_NOTIFY,
|
2002-04-28 04:52:26 +00:00
|
|
|
|
changed_idle_handler, NULL, NULL);
|
2001-12-09 22:41:12 +00:00
|
|
|
|
}
|
2008-05-28 04:10:08 +00:00
|
|
|
|
|
2008-06-13 23:10:32 +00:00
|
|
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
|
/* Initialisation. */
|
|
|
|
|
/****************************************************************************/
|
2008-05-28 04:10:08 +00:00
|
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
|
void
|
|
|
|
|
meta_prefs_init (void)
|
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
GSettings *settings;
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
/* 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_signal_connect (settings, "changed::" KEY_GNOME_CURSOR_SIZE,
|
|
|
|
|
G_CALLBACK (settings_changed), NULL);
|
|
|
|
|
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_INTERFACE), settings);
|
|
|
|
|
|
2013-04-10 09:57:16 +00:00
|
|
|
|
settings = g_settings_new (SCHEMA_INPUT_SOURCES);
|
|
|
|
|
g_signal_connect (settings, "changed::" KEY_XKB_OPTIONS,
|
|
|
|
|
G_CALLBACK (settings_changed), NULL);
|
|
|
|
|
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_INPUT_SOURCES), settings);
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
|
|
|
|
|
for (tmp = overridden_keys; tmp; tmp = tmp->next)
|
|
|
|
|
{
|
|
|
|
|
MetaPrefsOverriddenKey *override = tmp->data;
|
|
|
|
|
do_override (override->key, override->new_schema);
|
2008-03-06 17:59:20 +00:00
|
|
|
|
}
|
2005-07-11 13:25:08 +00:00
|
|
|
|
|
2010-04-12 21:42:46 +00:00
|
|
|
|
/* Pick up initial values. */
|
|
|
|
|
|
|
|
|
|
handle_preference_init_enum ();
|
|
|
|
|
handle_preference_init_bool ();
|
|
|
|
|
handle_preference_init_string ();
|
2013-05-12 13:37:05 +00:00
|
|
|
|
handle_preference_init_string_array ();
|
2010-04-12 21:42:46 +00:00
|
|
|
|
handle_preference_init_int ();
|
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
|
init_bindings ();
|
2001-12-09 22:41:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-04-12 21:39:27 +00:00
|
|
|
|
static gboolean
|
2011-06-24 16:14:15 +00:00
|
|
|
|
find_pref (void *prefs,
|
|
|
|
|
size_t pref_size,
|
|
|
|
|
const char *search_key,
|
|
|
|
|
MetaBasePreference **pref)
|
2010-04-12 21:39:27 +00:00
|
|
|
|
{
|
2010-04-13 18:40:31 +00:00
|
|
|
|
void *p = prefs;
|
2010-04-12 21:39:27 +00:00
|
|
|
|
|
2010-04-13 18:40:31 +00:00
|
|
|
|
while (TRUE)
|
2010-04-12 21:39:27 +00:00
|
|
|
|
{
|
2010-04-13 18:40:31 +00:00
|
|
|
|
char **key = p;
|
|
|
|
|
if (*key == NULL)
|
|
|
|
|
break;
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (strcmp (*key, search_key) == 0)
|
|
|
|
|
{
|
|
|
|
|
*pref = p;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2010-04-13 18:40:31 +00:00
|
|
|
|
|
|
|
|
|
p = (guchar *)p + pref_size;
|
2010-04-12 21:39:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
do_override (char *key,
|
|
|
|
|
char *schema)
|
2010-04-12 21:39:27 +00:00
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
MetaBasePreference *pref;
|
|
|
|
|
GSettings *settings;
|
|
|
|
|
char *detailed_signal;
|
|
|
|
|
gpointer data;
|
|
|
|
|
guint handler_id;
|
2010-04-12 21:39:27 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00: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 21:39:27 +00:00
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
meta_warning ("Can't override preference key, \"%s\" not found\n", key);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2010-04-13 18:40:31 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00: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 18:40:31 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00: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 21:39:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
detailed_signal = g_strdup_printf ("changed::%s", key);
|
|
|
|
|
handler_id = g_signal_connect (settings, detailed_signal,
|
|
|
|
|
G_CALLBACK (settings_changed), NULL);
|
2011-12-19 03:55:26 +00:00
|
|
|
|
g_free (detailed_signal);
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
g_object_set_data (G_OBJECT (settings), key, GUINT_TO_POINTER (handler_id));
|
|
|
|
|
|
|
|
|
|
settings_changed (settings, key, NULL);
|
2010-04-12 21:39:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
|
2010-04-12 21:39:27 +00:00
|
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
|
* meta_prefs_override_preference_schema:
|
2011-06-24 16:14:15 +00:00
|
|
|
|
* @key: the preference name
|
2011-11-02 15:34:45 +00:00
|
|
|
|
* @schema: new schema for preference @key
|
2010-04-12 21:39:27 +00:00
|
|
|
|
*
|
2011-06-24 16:14:15 +00: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 21:39:27 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2011-06-24 16:14:15 +00:00
|
|
|
|
meta_prefs_override_preference_schema (const char *key, const char *schema)
|
2010-04-12 21:39:27 +00: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 16:14:15 +00:00
|
|
|
|
if (strcmp (tmp_overridden->key, key) == 0 &&
|
|
|
|
|
strcmp (tmp_overridden->new_schema, schema) == 0)
|
2010-04-12 21:39:27 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
overridden = NULL;
|
|
|
|
|
|
|
|
|
|
for (tmp = overridden_keys; tmp; tmp = tmp->next)
|
|
|
|
|
{
|
|
|
|
|
MetaPrefsOverriddenKey *tmp_overridden = tmp->data;
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (strcmp (tmp_overridden->key, key) == 0)
|
|
|
|
|
overridden = tmp_overridden;
|
2010-04-12 21:39:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (overridden)
|
2010-04-12 21:39:27 +00:00
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
g_free (overridden->new_schema);
|
|
|
|
|
overridden->new_schema = g_strdup (schema);
|
2010-04-12 21:39:27 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2011-06-24 16:14:15 +00: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 21:39:27 +00:00
|
|
|
|
}
|
2011-06-24 16:14:15 +00:00
|
|
|
|
|
|
|
|
|
if (settings_schemas != NULL)
|
|
|
|
|
do_override (overridden->key, overridden->new_schema);
|
2010-04-12 21:39:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-06-13 23:10:32 +00:00
|
|
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
|
/* Updates. */
|
|
|
|
|
/****************************************************************************/
|
|
|
|
|
|
2007-04-25 03:30:17 +00:00
|
|
|
|
|
2010-04-12 21:39:27 +00:00
|
|
|
|
static void
|
2011-06-24 16:14:15 +00:00
|
|
|
|
settings_changed (GSettings *settings,
|
|
|
|
|
gchar *key,
|
|
|
|
|
gpointer data)
|
2010-04-12 21:39:27 +00:00
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
GVariant *value;
|
|
|
|
|
const GVariantType *type;
|
|
|
|
|
MetaEnumPreference *cursor;
|
|
|
|
|
gboolean found_enum;
|
2010-04-12 21:39:27 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
value = g_settings_get_value (settings, key);
|
|
|
|
|
type = g_variant_get_type (value);
|
2002-10-07 23:14:40 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (g_variant_type_equal (type, G_VARIANT_TYPE_BOOLEAN))
|
|
|
|
|
handle_preference_update_bool (settings, key);
|
|
|
|
|
else if (g_variant_type_equal (type, G_VARIANT_TYPE_INT32))
|
|
|
|
|
handle_preference_update_int (settings, key);
|
2013-05-12 13:37:05 +00:00
|
|
|
|
else if (g_variant_type_equal (type, G_VARIANT_TYPE_STRING_ARRAY))
|
|
|
|
|
handle_preference_update_string_array (settings, key);
|
2011-06-24 16:14:15 +00:00
|
|
|
|
else if (g_variant_type_equal (type, G_VARIANT_TYPE_STRING))
|
2002-04-28 04:52:26 +00:00
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
cursor = preferences_enum;
|
|
|
|
|
found_enum = FALSE;
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
while (cursor->base.key != NULL)
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
{
|
2002-04-28 04:52:26 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (strcmp (key, cursor->base.key) == 0)
|
|
|
|
|
found_enum = TRUE;
|
2002-11-03 19:06:39 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
cursor++;
|
2002-11-03 19:06:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (found_enum)
|
|
|
|
|
handle_preference_update_enum (settings, key);
|
|
|
|
|
else
|
|
|
|
|
handle_preference_update_string (settings, key);
|
2002-11-03 19:06:39 +00:00
|
|
|
|
}
|
2002-01-27 05:50:34 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
/* Someone added a preference of an unhandled type */
|
|
|
|
|
g_assert_not_reached ();
|
2002-01-27 05:50:34 +00:00
|
|
|
|
}
|
2008-02-23 21:02:05 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
g_variant_unref (value);
|
2008-02-23 21:02:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
static void
|
|
|
|
|
bindings_changed (GSettings *settings,
|
|
|
|
|
gchar *key,
|
|
|
|
|
gpointer data)
|
2008-02-23 21:02:05 +00:00
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
gchar **strokes;
|
|
|
|
|
strokes = g_settings_get_strv (settings, key);
|
2008-02-23 21:02:05 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (update_key_binding (key, strokes))
|
|
|
|
|
queue_changed (META_PREF_KEYBINDINGS);
|
2008-02-23 21:02:05 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
g_strfreev (strokes);
|
2008-02-23 21:02:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2011-11-02 15:34:45 +00:00
|
|
|
|
* maybe_give_disable_workaround_warning:
|
|
|
|
|
*
|
2008-02-23 21:02:05 +00:00
|
|
|
|
* Special case: give a warning the first time disable_workarounds
|
|
|
|
|
* is turned on.
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
maybe_give_disable_workarounds_warning (void)
|
|
|
|
|
{
|
|
|
|
|
static gboolean first_disable = TRUE;
|
|
|
|
|
|
|
|
|
|
if (first_disable && disable_workarounds)
|
|
|
|
|
{
|
|
|
|
|
first_disable = FALSE;
|
|
|
|
|
|
|
|
|
|
meta_warning (_("Workarounds for broken applications disabled. "
|
|
|
|
|
"Some applications may not behave properly.\n"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-07 23:14:40 +00:00
|
|
|
|
MetaVirtualModifier
|
|
|
|
|
meta_prefs_get_mouse_button_mods (void)
|
|
|
|
|
{
|
|
|
|
|
return mouse_button_mods;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
GDesktopFocusMode
|
2001-12-09 22:41:12 +00:00
|
|
|
|
meta_prefs_get_focus_mode (void)
|
|
|
|
|
{
|
|
|
|
|
return focus_mode;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
GDesktopFocusNewWindows
|
2006-04-12 18:01:20 +00:00
|
|
|
|
meta_prefs_get_focus_new_windows (void)
|
|
|
|
|
{
|
|
|
|
|
return focus_new_windows;
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-10 09:55:20 +00:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_attach_modal_dialogs (void)
|
|
|
|
|
{
|
|
|
|
|
return attach_modal_dialogs;
|
|
|
|
|
}
|
|
|
|
|
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 19:35:03 +00:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_raise_on_click (void)
|
|
|
|
|
{
|
|
|
|
|
/* Force raise_on_click on for click-to-focus, as requested by Havoc
|
|
|
|
|
* in #326156.
|
|
|
|
|
*/
|
2011-06-24 16:14:15 +00:00
|
|
|
|
return raise_on_click || focus_mode == G_DESKTOP_FOCUS_MODE_CLICK;
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 19:35:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
|
const char*
|
|
|
|
|
meta_prefs_get_theme (void)
|
|
|
|
|
{
|
|
|
|
|
return current_theme;
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-11 13:25:08 +00:00
|
|
|
|
const char*
|
|
|
|
|
meta_prefs_get_cursor_theme (void)
|
|
|
|
|
{
|
|
|
|
|
return cursor_theme;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
meta_prefs_get_cursor_size (void)
|
|
|
|
|
{
|
|
|
|
|
return cursor_size;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-13 23:10:32 +00:00
|
|
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
|
/* Handlers for string preferences. */
|
|
|
|
|
/****************************************************************************/
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
titlebar_handler (GVariant *value,
|
|
|
|
|
gpointer *result,
|
|
|
|
|
gpointer data)
|
2001-12-09 22:41:12 +00:00
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
PangoFontDescription *desc;
|
|
|
|
|
const gchar *string_value;
|
2001-12-09 22:41:12 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
*result = NULL; /* ignored */
|
|
|
|
|
string_value = g_variant_get_string (value, NULL);
|
|
|
|
|
desc = pango_font_description_from_string (string_value);
|
2001-12-09 22:41:12 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (desc == NULL)
|
2001-12-09 22:41:12 +00:00
|
|
|
|
{
|
2008-03-06 17:59:20 +00:00
|
|
|
|
meta_warning (_("Could not parse font description "
|
2011-06-24 16:14:15 +00:00
|
|
|
|
"\"%s\" from GSettings key %s\n"),
|
2008-10-27 11:52:47 +00:00
|
|
|
|
string_value ? string_value : "(null)",
|
2008-03-06 17:59:20 +00:00
|
|
|
|
KEY_TITLEBAR_FONT);
|
2011-06-24 16:14:15 +00:00
|
|
|
|
return FALSE;
|
2001-12-09 22:41:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-03-06 17:59:20 +00:00
|
|
|
|
/* Is the new description the same as the old? */
|
|
|
|
|
if (titlebar_font &&
|
2011-06-24 16:14:15 +00:00
|
|
|
|
pango_font_description_equal (desc, titlebar_font))
|
2001-12-09 22:41:12 +00:00
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
pango_font_description_free (desc);
|
2001-12-09 22:41:12 +00:00
|
|
|
|
}
|
2011-06-24 16:14:15 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (titlebar_font)
|
|
|
|
|
pango_font_description_free (titlebar_font);
|
2008-03-06 17:59:20 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
titlebar_font = desc;
|
|
|
|
|
queue_changed (META_PREF_TITLEBAR_FONT);
|
|
|
|
|
}
|
2008-03-06 17:59:20 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
return TRUE;
|
2008-03-06 17:59:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
theme_name_handler (GVariant *value,
|
|
|
|
|
gpointer *result,
|
|
|
|
|
gpointer data)
|
2008-03-06 17:59:20 +00:00
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
const gchar *string_value;
|
2009-01-28 02:08:09 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
*result = NULL; /* ignored */
|
|
|
|
|
string_value = g_variant_get_string (value, NULL);
|
|
|
|
|
|
|
|
|
|
if (!string_value || !*string_value)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (g_strcmp0 (current_theme, string_value) != 0)
|
|
|
|
|
{
|
|
|
|
|
if (current_theme)
|
|
|
|
|
g_free (current_theme);
|
|
|
|
|
|
|
|
|
|
current_theme = g_strdup (string_value);
|
|
|
|
|
queue_changed (META_PREF_THEME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
2008-03-06 17:59:20 +00:00
|
|
|
|
}
|
2001-12-09 22:41:12 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
mouse_button_mods_handler (GVariant *value,
|
|
|
|
|
gpointer *result,
|
|
|
|
|
gpointer data)
|
2008-03-06 17:59:20 +00:00
|
|
|
|
{
|
|
|
|
|
MetaVirtualModifier mods;
|
2011-06-24 16:14:15 +00:00
|
|
|
|
const gchar *string_value;
|
2001-12-09 22:41:12 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
*result = NULL; /* ignored */
|
|
|
|
|
string_value = g_variant_get_string (value, NULL);
|
|
|
|
|
|
|
|
|
|
if (!string_value || !meta_ui_parse_modifier (string_value, &mods))
|
2008-03-06 17:59:20 +00:00
|
|
|
|
{
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2011-06-24 16:14:15 +00:00
|
|
|
|
"Failed to parse new GSettings value\n");
|
2008-03-06 17:59:20 +00:00
|
|
|
|
|
|
|
|
|
meta_warning (_("\"%s\" found in configuration database is "
|
|
|
|
|
"not a valid value for mouse button modifier\n"),
|
|
|
|
|
string_value);
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
return FALSE;
|
2001-12-09 22:41:12 +00:00
|
|
|
|
}
|
2011-06-24 16:14:15 +00:00
|
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
|
"Mouse button modifier has new GSettings value \"%s\"\n",
|
|
|
|
|
string_value);
|
|
|
|
|
|
|
|
|
|
if (mods != mouse_button_mods)
|
|
|
|
|
{
|
|
|
|
|
mouse_button_mods = mods;
|
|
|
|
|
queue_changed (META_PREF_MOUSE_BUTTON_MODS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
2001-12-09 22:41:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-10-12 17:44:55 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
button_layout_equal (const MetaButtonLayout *a,
|
|
|
|
|
const MetaButtonLayout *b)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
|
while (i < MAX_BUTTONS_PER_CORNER)
|
|
|
|
|
{
|
|
|
|
|
if (a->left_buttons[i] != b->left_buttons[i])
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (a->right_buttons[i] != b->right_buttons[i])
|
|
|
|
|
return FALSE;
|
2008-02-29 20:41:07 +00:00
|
|
|
|
if (a->left_buttons_has_spacer[i] != b->left_buttons_has_spacer[i])
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (a->right_buttons_has_spacer[i] != b->right_buttons_has_spacer[i])
|
|
|
|
|
return FALSE;
|
2002-10-12 17:44:55 +00:00
|
|
|
|
++i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
/*
|
|
|
|
|
* This conversion cannot be handled by GSettings since
|
|
|
|
|
* several values are stored in the same key (as a string).
|
|
|
|
|
*/
|
2002-10-12 17:44:55 +00:00
|
|
|
|
static MetaButtonFunction
|
|
|
|
|
button_function_from_string (const char *str)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp (str, "menu") == 0)
|
|
|
|
|
return META_BUTTON_FUNCTION_MENU;
|
|
|
|
|
else if (strcmp (str, "minimize") == 0)
|
|
|
|
|
return META_BUTTON_FUNCTION_MINIMIZE;
|
|
|
|
|
else if (strcmp (str, "maximize") == 0)
|
|
|
|
|
return META_BUTTON_FUNCTION_MAXIMIZE;
|
|
|
|
|
else if (strcmp (str, "close") == 0)
|
|
|
|
|
return META_BUTTON_FUNCTION_CLOSE;
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
|
else if (strcmp (str, "shade") == 0)
|
|
|
|
|
return META_BUTTON_FUNCTION_SHADE;
|
|
|
|
|
else if (strcmp (str, "above") == 0)
|
|
|
|
|
return META_BUTTON_FUNCTION_ABOVE;
|
|
|
|
|
else if (strcmp (str, "stick") == 0)
|
|
|
|
|
return META_BUTTON_FUNCTION_STICK;
|
|
|
|
|
else
|
|
|
|
|
/* don't know; give up */
|
2002-10-12 17:44:55 +00: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 16:56:47 +00: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 16:14:15 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
button_layout_handler (GVariant *value,
|
|
|
|
|
gpointer *result,
|
|
|
|
|
gpointer data)
|
2002-10-12 17:44:55 +00:00
|
|
|
|
{
|
|
|
|
|
MetaButtonLayout new_layout;
|
2011-06-24 16:14:15 +00:00
|
|
|
|
const gchar *string_value;
|
2008-10-27 11:52:47 +00:00
|
|
|
|
char **sides = NULL;
|
2002-10-12 17:44:55 +00:00
|
|
|
|
int i;
|
2011-06-24 16:14:15 +00:00
|
|
|
|
|
2002-10-12 17:44:55 +00:00
|
|
|
|
/* We need to ignore unknown button functions, for
|
|
|
|
|
* compat with future versions
|
|
|
|
|
*/
|
2011-06-24 16:14:15 +00:00
|
|
|
|
|
|
|
|
|
*result = NULL; /* ignored */
|
|
|
|
|
string_value = g_variant_get_string (value, NULL);
|
|
|
|
|
|
2008-10-27 11:52:47 +00:00
|
|
|
|
if (string_value)
|
|
|
|
|
sides = g_strsplit (string_value, ":", 2);
|
2002-10-12 17:44:55 +00:00
|
|
|
|
|
2011-07-23 21:58:06 +00:00
|
|
|
|
i = 0;
|
2008-10-27 11:52:47 +00:00
|
|
|
|
if (sides != NULL && sides[0] != NULL)
|
2002-10-12 17:44:55 +00:00
|
|
|
|
{
|
|
|
|
|
char **buttons;
|
|
|
|
|
int b;
|
|
|
|
|
gboolean used[META_BUTTON_FUNCTION_LAST];
|
|
|
|
|
|
|
|
|
|
while (i < META_BUTTON_FUNCTION_LAST)
|
|
|
|
|
{
|
|
|
|
|
used[i] = FALSE;
|
2008-02-29 20:41:07 +00:00
|
|
|
|
new_layout.left_buttons_has_spacer[i] = FALSE;
|
2002-10-12 17:44:55 +00:00
|
|
|
|
++i;
|
|
|
|
|
}
|
2011-06-24 16:14:15 +00:00
|
|
|
|
|
2002-10-12 17:44:55 +00:00
|
|
|
|
buttons = g_strsplit (sides[0], ",", -1);
|
|
|
|
|
i = 0;
|
|
|
|
|
b = 0;
|
|
|
|
|
while (buttons[b] != NULL)
|
|
|
|
|
{
|
|
|
|
|
MetaButtonFunction f = button_function_from_string (buttons[b]);
|
2008-02-29 20:41:07 +00:00
|
|
|
|
if (i > 0 && strcmp("spacer", buttons[b]) == 0)
|
2002-10-12 17:44:55 +00:00
|
|
|
|
{
|
2008-02-29 20:41:07 +00:00
|
|
|
|
new_layout.left_buttons_has_spacer[i-1] = TRUE;
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
|
f = button_opposite_function (f);
|
|
|
|
|
|
|
|
|
|
if (f != META_BUTTON_FUNCTION_LAST)
|
2008-02-29 20:41:07 +00:00
|
|
|
|
{
|
|
|
|
|
new_layout.left_buttons_has_spacer[i-2] = TRUE;
|
|
|
|
|
}
|
2002-10-12 17:44:55 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2008-02-29 20:41:07 +00:00
|
|
|
|
if (f != META_BUTTON_FUNCTION_LAST && !used[f])
|
|
|
|
|
{
|
|
|
|
|
new_layout.left_buttons[i] = f;
|
|
|
|
|
used[f] = TRUE;
|
|
|
|
|
++i;
|
|
|
|
|
|
|
|
|
|
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 17:44:55 +00:00
|
|
|
|
}
|
2011-06-24 16:14:15 +00:00
|
|
|
|
|
2002-10-12 17:44:55 +00:00
|
|
|
|
++b;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_strfreev (buttons);
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-28 22:04:17 +00:00
|
|
|
|
for (; i < MAX_BUTTONS_PER_CORNER; i++)
|
|
|
|
|
{
|
|
|
|
|
new_layout.left_buttons[i] = META_BUTTON_FUNCTION_LAST;
|
|
|
|
|
new_layout.left_buttons_has_spacer[i] = FALSE;
|
|
|
|
|
}
|
2011-07-23 21:58:06 +00:00
|
|
|
|
|
|
|
|
|
i = 0;
|
2008-10-27 11:52:47 +00:00
|
|
|
|
if (sides != NULL && sides[0] != NULL && sides[1] != NULL)
|
2002-10-12 17:44:55 +00:00
|
|
|
|
{
|
|
|
|
|
char **buttons;
|
|
|
|
|
int b;
|
|
|
|
|
gboolean used[META_BUTTON_FUNCTION_LAST];
|
|
|
|
|
|
|
|
|
|
while (i < META_BUTTON_FUNCTION_LAST)
|
|
|
|
|
{
|
|
|
|
|
used[i] = FALSE;
|
2008-02-29 20:41:07 +00:00
|
|
|
|
new_layout.right_buttons_has_spacer[i] = FALSE;
|
2002-10-12 17:44:55 +00:00
|
|
|
|
++i;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buttons = g_strsplit (sides[1], ",", -1);
|
|
|
|
|
i = 0;
|
|
|
|
|
b = 0;
|
|
|
|
|
while (buttons[b] != NULL)
|
|
|
|
|
{
|
|
|
|
|
MetaButtonFunction f = button_function_from_string (buttons[b]);
|
2008-02-29 20:41:07 +00:00
|
|
|
|
if (i > 0 && strcmp("spacer", buttons[b]) == 0)
|
2002-10-12 17:44:55 +00:00
|
|
|
|
{
|
2008-02-29 20:41:07 +00:00
|
|
|
|
new_layout.right_buttons_has_spacer[i-1] = TRUE;
|
Added "above" to the list of flags a frame can have, so that we know when
* common.h: Added "above" to the list of flags a frame can have, so
that we know when to mark it as always on top. Added six grab ops,
one to do and one to undo each of the three new titlebar buttons
(shade, above, stick). Added six new button functions, similarly.
(#96229)
* frame.c (meta_frame_get_flags): If a frame has the WM_STATE_ABOVE X
attribute, set META_FRAME_ABOVE in its flags.
* frames.c (meta_frames_apply_shapes): Allow variable amounts of
rounding. (#113162)
* frames.c (show_tip_now, meta_frames_paint_to_drawable, control_rect,
get_control): extend handling of existing buttons to the
3*2 new kinds of button. (#96229)
* frames.c (meta_frames_button_press_event): translate clicks on the 3*2
new kinds of button to the new grab ops. (#96229)
* frames.c (meta_frames_button_release_event): implement the various
actions for the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_update_prelit_control,
meta_frames_motion_notify_event): extend existing motion
notifications for buttons to the 3*2 new kinds of button. (#96229)
* frames.c (meta_frames_set_window_background): handle specified
background colours and alpha transparency. (#151261)
* frames.h (MetaFrameControl): New control types for the 3*2 new kinds
of button. (#96229)
* iconcache.[ch] (meta_read_icons): use theme's fallback icons if a
window has no icon; use metacity's fallback icons only if the theme
does not provide any. (#11363)
* iconcache.[ch] (meta_invalidate_default_icons (new function)): clear
icon cache on windows using default icons, and update them. (#11363)
* main.c (main): added \n to error message.
* prefs.c (button_function_from_string): extend for 3 new button
types. (#96229)
* prefs.c (button_opposite_function (new function)): return a button
function's inverse (shade -> unshade, etc) (#96229)
* prefs.c (update_button_layout): allocate space for a button's
inverse, if it has one. (#96229)
* theme-parser.c (ParseState): add state for fallback icons (#11363)
* theme-parser.c (ParseInfo): add format_version; remove
menu_icon_* (#114305)
* theme-parser.c (parse_positive_integer): add lookup for integer
constants (#331356)
* theme-parser.c (parse_rounding (new function)): parse window
rounding amount (#113162)
* theme-parser.c (parse_alpha): don't set error if the number can't
be parsed since it'll already be set; change tolerance in comparison
from 1e6 to 1e-6
* theme-parser.c (parse_color (new function)): parse colour, including
possible constant lookup.
* theme-parser.c (parse_toplevel_element): allow defining of various
new kinds of constant; allow
hide_buttons (#121639) and more detailed rounding attributes on
<frame_geometry> (#113162); allow background and alpha attributes on
<frame_style>; (#151261) remove support for <menu_icon> except as
stub; (#114305) add support for loading stock images (#113465); add
support for <fallback>. (#11363))
* theme-parser.c (parse_draw_op_element): add from and to attribute
for arcs. (#121603)
* theme-parser.c (parse_style_element): add check for theme version
supporting a button function. (#96229)
* theme-parser.c (parse_style_set_element): add ability for shaded
windows to be resizable (#114304)
* theme-parser.c (meta_theme_load): add theme versioning routine.
* theme.c ( meta_frame_layout_get_borders): return rectangles for
the new 3*2 kinds of button, except where they're
inapplicable. (#96229)
* theme.c (meta_frame_layout_calc_geometry): don't format buttons on
windows with no buttons (#121639); strip the 3*2 new kinds of button
correctly (#96229); allow variable amounts of rounding (#113162).
* theme.c (meta_frame_style_new): set alpha to 255 by
default. (#151261)
* theme.c (meta_frame_style_unref): free colour spec if
allocated. (#151261)
* theme.c (meta_frame_style_validate): it's only an error not to
include a button if that button is valid in the current
theme. (#96229)
* theme.c (button_rect): return rectangles for the new 3*2 kinds
of button. (#96229)
* theme.c (meta_frame_style_set_unref): free differently resizable
shaded styles. (#114304)
* theme.c (get_style): look up differently resizable styles
for shaded windows. (#114304)
* theme.c (free_menu_ops (removed function), get_menu_icon
(removed function), meta_theme_draw_menu_icon (removed function),
meta_menu_icon_type_from_string (removed function),
meta_menu_icon_type_to_string (removed function),
meta_theme_free, meta_theme_validate): removed menu icon code. (#114305)
* theme.c (meta_theme_load_image): add size_of_theme_icons
parameter. (#113465)
* theme.c (meta_theme_define_color_constant (new function),
meta_theme_lookup_color_constant (new function)): allow
definition of colour constants. (#129747)
* theme.c (meta_button_type_from_string, meta_button_type_to_string):
add the 3*2 new kinds of button. (#96229)
* theme.c (meta_theme_earliest_version_with_button (new function)):
return the theme version each button was introduced in. (#96229)
* theme.h ( MetaFrameLayout): add "hide_buttons" flag (#121639) and
corner radiuses. (#113162)
* theme.h (MetaFrameGeometry): add rectangles for the 3*2 new
buttons. (#96229)
* theme.h (MetaButtonType): the 3*2 new buttons. (#96229)
* theme.h (MetaFrameStyle): add window_background_color and
window_background_alpha so that we can specify background on a
<frame_style>. (#151261)
* theme.h (MetaFrameStyleSet): shaded_styles gets resize
dimension. (#114304)
* theme.h (MetaTheme): added format_version, color_constants
hash, (#129747) fallback_icon and fallback_mini_icon, (#11363)
and removed menu_icons. (#114305)
* theme.h (META_THEME_ALLOWS (new macro)): return whether a theme
supports a given feature. Also, several macros representing
new features in v2.
* ui.c (meta_ui_set_current_theme)): also invalidate default
icons. (#11363)
* window.[ch] (meta_window_update_icon_now)): became
non-static. (#11363)
2006-10-07 16:56:47 +00:00
|
|
|
|
f = button_opposite_function (f);
|
|
|
|
|
if (f != META_BUTTON_FUNCTION_LAST)
|
2008-02-29 20:41:07 +00:00
|
|
|
|
{
|
|
|
|
|
new_layout.right_buttons_has_spacer[i-2] = TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
2002-10-12 17:44:55 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2008-02-29 20:41:07 +00:00
|
|
|
|
if (f != META_BUTTON_FUNCTION_LAST && !used[f])
|
|
|
|
|
{
|
|
|
|
|
new_layout.right_buttons[i] = f;
|
|
|
|
|
used[f] = TRUE;
|
|
|
|
|
++i;
|
|
|
|
|
|
|
|
|
|
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 17:44:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
++b;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_strfreev (buttons);
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-28 22:04:17 +00:00
|
|
|
|
for (; i < MAX_BUTTONS_PER_CORNER; i++)
|
|
|
|
|
{
|
|
|
|
|
new_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST;
|
|
|
|
|
new_layout.right_buttons_has_spacer[i] = FALSE;
|
|
|
|
|
}
|
2011-07-23 21:58:06 +00:00
|
|
|
|
|
2002-10-12 17:44:55 +00:00
|
|
|
|
g_strfreev (sides);
|
|
|
|
|
|
2007-07-22 06:39:29 +00:00
|
|
|
|
/* Invert the button layout for RTL languages */
|
|
|
|
|
if (meta_ui_get_direction() == META_UI_DIRECTION_RTL)
|
|
|
|
|
{
|
|
|
|
|
MetaButtonLayout rtl_layout;
|
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
for (i = 0; new_layout.left_buttons[i] != META_BUTTON_FUNCTION_LAST; i++);
|
|
|
|
|
for (j = 0; j < i; j++)
|
2008-02-29 20:41:07 +00:00
|
|
|
|
{
|
|
|
|
|
rtl_layout.right_buttons[j] = new_layout.left_buttons[i - j - 1];
|
|
|
|
|
if (j == 0)
|
|
|
|
|
rtl_layout.right_buttons_has_spacer[i - 1] = new_layout.left_buttons_has_spacer[i - j - 1];
|
|
|
|
|
else
|
|
|
|
|
rtl_layout.right_buttons_has_spacer[j - 1] = new_layout.left_buttons_has_spacer[i - j - 1];
|
|
|
|
|
}
|
2012-11-28 22:04:17 +00:00
|
|
|
|
for (; j < MAX_BUTTONS_PER_CORNER; j++)
|
|
|
|
|
{
|
|
|
|
|
rtl_layout.right_buttons[j] = META_BUTTON_FUNCTION_LAST;
|
|
|
|
|
rtl_layout.right_buttons_has_spacer[j] = FALSE;
|
|
|
|
|
}
|
2007-07-22 06:39:29 +00:00
|
|
|
|
|
|
|
|
|
for (i = 0; new_layout.right_buttons[i] != META_BUTTON_FUNCTION_LAST; i++);
|
|
|
|
|
for (j = 0; j < i; j++)
|
2008-02-29 20:41:07 +00:00
|
|
|
|
{
|
|
|
|
|
rtl_layout.left_buttons[j] = new_layout.right_buttons[i - j - 1];
|
|
|
|
|
if (j == 0)
|
|
|
|
|
rtl_layout.left_buttons_has_spacer[i - 1] = new_layout.right_buttons_has_spacer[i - j - 1];
|
|
|
|
|
else
|
|
|
|
|
rtl_layout.left_buttons_has_spacer[j - 1] = new_layout.right_buttons_has_spacer[i - j - 1];
|
|
|
|
|
}
|
2012-11-28 22:04:17 +00:00
|
|
|
|
for (; j < MAX_BUTTONS_PER_CORNER; j++)
|
|
|
|
|
{
|
|
|
|
|
rtl_layout.left_buttons[j] = META_BUTTON_FUNCTION_LAST;
|
|
|
|
|
rtl_layout.left_buttons_has_spacer[j] = FALSE;
|
|
|
|
|
}
|
2007-07-22 06:39:29 +00:00
|
|
|
|
|
|
|
|
|
new_layout = rtl_layout;
|
|
|
|
|
}
|
2011-06-24 16:14:15 +00:00
|
|
|
|
|
|
|
|
|
if (!button_layout_equal (&button_layout, &new_layout))
|
2008-03-06 17:59:20 +00:00
|
|
|
|
{
|
|
|
|
|
button_layout = new_layout;
|
2011-06-24 16:14:15 +00:00
|
|
|
|
emit_changed (META_PREF_BUTTON_LAYOUT);
|
2008-03-06 17:59:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2002-10-12 17:44:55 +00:00
|
|
|
|
|
2012-08-10 21:22:46 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
overlay_key_handler (GVariant *value,
|
|
|
|
|
gpointer *result,
|
|
|
|
|
gpointer data)
|
|
|
|
|
{
|
|
|
|
|
MetaKeyCombo combo;
|
|
|
|
|
const gchar *string_value;
|
|
|
|
|
|
|
|
|
|
*result = NULL; /* ignored */
|
|
|
|
|
string_value = g_variant_get_string (value, NULL);
|
|
|
|
|
|
|
|
|
|
if (string_value && meta_ui_parse_accelerator (string_value, &combo.keysym,
|
|
|
|
|
&combo.keycode,
|
|
|
|
|
&combo.modifiers))
|
|
|
|
|
;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
|
|
|
|
"Failed to parse value for overlay-key\n");
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (overlay_key_combo.keysym != combo.keysym ||
|
|
|
|
|
overlay_key_combo.keycode != combo.keycode ||
|
|
|
|
|
overlay_key_combo.modifiers != combo.modifiers)
|
|
|
|
|
{
|
|
|
|
|
overlay_key_combo = combo;
|
|
|
|
|
queue_changed (META_PREF_KEYBINDINGS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-10 09:57:16 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
iso_next_group_handler (GVariant *value,
|
|
|
|
|
gpointer *result,
|
|
|
|
|
gpointer data)
|
|
|
|
|
{
|
|
|
|
|
const char **xkb_options, **p;
|
|
|
|
|
const char *option = NULL;
|
|
|
|
|
gboolean changed = FALSE;
|
|
|
|
|
|
|
|
|
|
*result = NULL; /* ignored */
|
|
|
|
|
xkb_options = g_variant_get_strv (value, NULL);
|
|
|
|
|
|
|
|
|
|
for (p = xkb_options; p && *p; ++p)
|
|
|
|
|
if (g_str_has_prefix (*p, "grp:"))
|
|
|
|
|
{
|
|
|
|
|
option = (*p + 4);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
changed = (g_strcmp0 (option, iso_next_group_option) != 0);
|
|
|
|
|
|
|
|
|
|
if (changed)
|
|
|
|
|
{
|
|
|
|
|
g_free (iso_next_group_option);
|
|
|
|
|
iso_next_group_option = g_strdup (option);
|
|
|
|
|
queue_changed (META_PREF_KEYBINDINGS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_free (xkb_options);
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
|
const PangoFontDescription*
|
|
|
|
|
meta_prefs_get_titlebar_font (void)
|
|
|
|
|
{
|
2002-05-24 02:55:54 +00:00
|
|
|
|
if (use_system_font)
|
2001-12-09 22:41:12 +00:00
|
|
|
|
return NULL;
|
|
|
|
|
else
|
|
|
|
|
return titlebar_font;
|
|
|
|
|
}
|
|
|
|
|
|
2001-12-10 03:55:26 +00:00
|
|
|
|
int
|
|
|
|
|
meta_prefs_get_num_workspaces (void)
|
|
|
|
|
{
|
|
|
|
|
return num_workspaces;
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-08 00:29:58 +00:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_dynamic_workspaces (void)
|
|
|
|
|
{
|
|
|
|
|
return dynamic_workspaces;
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-01 03:23:46 +00:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_disable_workarounds (void)
|
|
|
|
|
{
|
|
|
|
|
return disable_workarounds;
|
|
|
|
|
}
|
|
|
|
|
|
2002-12-08 19:17:17 +00:00
|
|
|
|
#ifdef WITH_VERBOSE_MODE
|
2001-12-09 22:41:12 +00:00
|
|
|
|
const char*
|
|
|
|
|
meta_preference_to_string (MetaPreference pref)
|
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
/* TODO: better handled via GLib enum nicknames */
|
2001-12-09 22:41:12 +00:00
|
|
|
|
switch (pref)
|
|
|
|
|
{
|
2002-10-07 23:14:40 +00:00
|
|
|
|
case META_PREF_MOUSE_BUTTON_MODS:
|
|
|
|
|
return "MOUSE_BUTTON_MODS";
|
|
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
|
case META_PREF_FOCUS_MODE:
|
|
|
|
|
return "FOCUS_MODE";
|
|
|
|
|
|
2006-04-12 18:01:20 +00:00
|
|
|
|
case META_PREF_FOCUS_NEW_WINDOWS:
|
|
|
|
|
return "FOCUS_NEW_WINDOWS";
|
|
|
|
|
|
2010-09-10 09:55:20 +00:00
|
|
|
|
case META_PREF_ATTACH_MODAL_DIALOGS:
|
|
|
|
|
return "ATTACH_MODAL_DIALOGS";
|
|
|
|
|
|
Add a raise on click option, basically only because all the major distros
2006-01-10 Elijah Newren <newren@gmail.com>
Add a raise on click option, basically only because all the major
distros are patching it in anyway. See #326156.
* src/metacity.schemas.in: add the new gconf key and explanation
* src/prefs.[ch] (#define KEY_RAISE_ON_CLICK, static gboolean
raise_on_click, update_raise_on_click, meta_prefs_init,
change_notify, meta_prefs_get_raise_on_click,
meta_preference_to_string):
Add all the normal preference handling stuff for this new
raise-on-click option.
* src/core.c (meta_core_show_window_menu):
* src/display.c (event_callback, meta_display_begin_grab_op):
* src/window.c (window_activate, meta_window_configure_request, ):
Only raise the window if in raise_on_click mode.
* src/display.c (meta_display_begin_grab_op,
meta_display_end_grab_op, meta_display_check_threshold_reached):
* src/display.h (struct MetaDisplay):
* src/window.c (meta_window_handle_mouse_grab_op_event):
if not in raise-on-click mode only raise on button release if the
click didn't start a move or resize operation; needs a few extra
MetaDisplay fields to handle this
* src/core.c (meta_core_user_lower_and_unfocus):
no need to do the MRU shuffling if not maintaining the stacking
order == MRU order invariant
* src/frames.c (meta_frames_button_press_event):
* src/window.c (meta_window_begin_grab_op):
remove an unneeded window raising that is already handled elsewhere
2006-01-10 19:35:03 +00:00
|
|
|
|
case META_PREF_RAISE_ON_CLICK:
|
|
|
|
|
return "RAISE_ON_CLICK";
|
|
|
|
|
|
2002-02-07 03:07:56 +00:00
|
|
|
|
case META_PREF_THEME:
|
|
|
|
|
return "THEME";
|
|
|
|
|
|
2001-12-09 22:41:12 +00:00
|
|
|
|
case META_PREF_TITLEBAR_FONT:
|
|
|
|
|
return "TITLEBAR_FONT";
|
|
|
|
|
|
2001-12-10 03:55:26 +00:00
|
|
|
|
case META_PREF_NUM_WORKSPACES:
|
|
|
|
|
return "NUM_WORKSPACES";
|
2002-01-27 05:50:34 +00:00
|
|
|
|
|
2008-11-22 19:02:54 +00:00
|
|
|
|
case META_PREF_KEYBINDINGS:
|
|
|
|
|
return "KEYBINDINGS";
|
2002-05-01 03:23:46 +00:00
|
|
|
|
|
|
|
|
|
case META_PREF_DISABLE_WORKAROUNDS:
|
|
|
|
|
return "DISABLE_WORKAROUNDS";
|
2002-05-24 02:23:46 +00:00
|
|
|
|
|
2002-10-18 21:22:27 +00:00
|
|
|
|
case META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR:
|
|
|
|
|
return "ACTION_DOUBLE_CLICK_TITLEBAR";
|
|
|
|
|
|
2007-04-25 03:30:17 +00:00
|
|
|
|
case META_PREF_ACTION_MIDDLE_CLICK_TITLEBAR:
|
|
|
|
|
return "ACTION_MIDDLE_CLICK_TITLEBAR";
|
|
|
|
|
|
|
|
|
|
case META_PREF_ACTION_RIGHT_CLICK_TITLEBAR:
|
|
|
|
|
return "ACTION_RIGHT_CLICK_TITLEBAR";
|
|
|
|
|
|
2002-05-24 02:23:46 +00:00
|
|
|
|
case META_PREF_AUTO_RAISE:
|
|
|
|
|
return "AUTO_RAISE";
|
|
|
|
|
|
|
|
|
|
case META_PREF_AUTO_RAISE_DELAY:
|
|
|
|
|
return "AUTO_RAISE_DELAY";
|
2002-07-11 04:10:44 +00:00
|
|
|
|
|
2012-08-29 02:38:54 +00:00
|
|
|
|
case META_PREF_FOCUS_CHANGE_ON_POINTER_REST:
|
|
|
|
|
return "FOCUS_CHANGE_ON_POINTER_REST";
|
|
|
|
|
|
2002-10-04 02:28:57 +00:00
|
|
|
|
case META_PREF_BUTTON_LAYOUT:
|
|
|
|
|
return "BUTTON_LAYOUT";
|
2002-11-20 03:57:20 +00:00
|
|
|
|
|
|
|
|
|
case META_PREF_WORKSPACE_NAMES:
|
|
|
|
|
return "WORKSPACE_NAMES";
|
2003-01-28 15:07:43 +00:00
|
|
|
|
|
|
|
|
|
case META_PREF_VISUAL_BELL:
|
|
|
|
|
return "VISUAL_BELL";
|
|
|
|
|
|
|
|
|
|
case META_PREF_AUDIBLE_BELL:
|
|
|
|
|
return "AUDIBLE_BELL";
|
|
|
|
|
|
|
|
|
|
case META_PREF_VISUAL_BELL_TYPE:
|
|
|
|
|
return "VISUAL_BELL_TYPE";
|
2003-10-12 06:25:38 +00:00
|
|
|
|
|
2005-01-26 08:43:38 +00:00
|
|
|
|
case META_PREF_GNOME_ACCESSIBILITY:
|
|
|
|
|
return "GNOME_ACCESSIBILTY";
|
2006-01-20 22:03:56 +00:00
|
|
|
|
|
2008-06-29 21:57:39 +00:00
|
|
|
|
case META_PREF_GNOME_ANIMATIONS:
|
|
|
|
|
return "GNOME_ANIMATIONS";
|
|
|
|
|
|
2005-10-25 16:43:01 +00:00
|
|
|
|
case META_PREF_CURSOR_THEME:
|
|
|
|
|
return "CURSOR_THEME";
|
2006-01-20 22:03:56 +00:00
|
|
|
|
|
2005-10-25 16:43:01 +00:00
|
|
|
|
case META_PREF_CURSOR_SIZE:
|
|
|
|
|
return "CURSOR_SIZE";
|
2006-02-16 20:26:05 +00:00
|
|
|
|
|
2009-01-27 21:05:42 +00:00
|
|
|
|
case META_PREF_RESIZE_WITH_RIGHT_BUTTON:
|
|
|
|
|
return "RESIZE_WITH_RIGHT_BUTTON";
|
2009-05-07 21:56:27 +00:00
|
|
|
|
|
2010-09-24 18:28:12 +00:00
|
|
|
|
case META_PREF_EDGE_TILING:
|
|
|
|
|
return "EDGE_TILING";
|
2010-06-24 18:41:28 +00:00
|
|
|
|
|
2009-06-19 15:30:37 +00:00
|
|
|
|
case META_PREF_FORCE_FULLSCREEN:
|
|
|
|
|
return "FORCE_FULLSCREEN";
|
|
|
|
|
|
2011-02-28 12:48:28 +00:00
|
|
|
|
case META_PREF_WORKSPACES_ONLY_ON_PRIMARY:
|
|
|
|
|
return "WORKSPACES_ONLY_ON_PRIMARY";
|
|
|
|
|
|
2009-02-02 14:09:04 +00:00
|
|
|
|
case META_PREF_NO_TAB_POPUP:
|
|
|
|
|
return "NO_TAB_POPUP";
|
2011-07-20 06:14:58 +00:00
|
|
|
|
|
|
|
|
|
case META_PREF_DRAGGABLE_BORDER_WIDTH:
|
|
|
|
|
return "DRAGGABLE_BORDER_WIDTH";
|
2012-03-12 00:00:47 +00:00
|
|
|
|
|
|
|
|
|
case META_PREF_DYNAMIC_WORKSPACES:
|
|
|
|
|
return "DYNAMIC_WORKSPACES";
|
2012-09-08 09:34:27 +00:00
|
|
|
|
|
|
|
|
|
case META_PREF_AUTO_MAXIMIZE:
|
|
|
|
|
return "AUTO_MAXIMIZE";
|
2001-12-09 22:41:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return "(unknown)";
|
|
|
|
|
}
|
2002-12-08 19:17:17 +00:00
|
|
|
|
#endif /* WITH_VERBOSE_MODE */
|
2002-03-10 18:36:08 +00:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
meta_prefs_set_num_workspaces (int n_workspaces)
|
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
MetaBasePreference *pref;
|
2002-03-10 18:36:08 +00:00
|
|
|
|
|
2013-04-17 08:04:49 +00:00
|
|
|
|
if (find_pref (preferences_int, sizeof(MetaIntPreference),
|
|
|
|
|
KEY_NUM_WORKSPACES, &pref))
|
|
|
|
|
{
|
|
|
|
|
g_settings_set_int (SETTINGS (pref->schema),
|
|
|
|
|
KEY_NUM_WORKSPACES,
|
|
|
|
|
n_workspaces);
|
|
|
|
|
}
|
2002-03-10 18:36:08 +00:00
|
|
|
|
}
|
2002-04-28 04:52:26 +00:00
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
|
static GHashTable *key_bindings;
|
2002-04-28 04:52:26 +00:00
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
|
static void
|
|
|
|
|
meta_key_pref_free (MetaKeyPref *pref)
|
|
|
|
|
{
|
|
|
|
|
update_binding (pref, NULL);
|
|
|
|
|
|
|
|
|
|
g_free (pref->name);
|
2012-03-27 14:42:42 +00:00
|
|
|
|
g_object_unref (pref->settings);
|
2011-10-28 01:05:43 +00:00
|
|
|
|
|
|
|
|
|
g_free (pref);
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-02 23:13:11 +00:00
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
|
static void
|
|
|
|
|
init_bindings (void)
|
|
|
|
|
{
|
2012-08-29 21:07:34 +00:00
|
|
|
|
MetaKeyPref *pref;
|
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
|
key_bindings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
|
|
|
|
|
(GDestroyNotify)meta_key_pref_free);
|
2012-08-29 21:07:34 +00:00
|
|
|
|
|
|
|
|
|
pref = g_new0 (MetaKeyPref, 1);
|
|
|
|
|
pref->name = g_strdup ("overlay-key");
|
|
|
|
|
pref->action = META_KEYBINDING_ACTION_OVERLAY_KEY;
|
|
|
|
|
pref->bindings = g_slist_prepend (pref->bindings, &overlay_key_combo);
|
|
|
|
|
pref->builtin = 1;
|
|
|
|
|
|
|
|
|
|
g_hash_table_insert (key_bindings, g_strdup ("overlay-key"), pref);
|
2002-07-11 04:10:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
update_binding (MetaKeyPref *binding,
|
2011-06-24 16:14:15 +00:00
|
|
|
|
gchar **strokes)
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
{
|
2013-03-31 18:18:54 +00:00
|
|
|
|
GSList *old_bindings, *a, *b;
|
|
|
|
|
gboolean changed;
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
unsigned int keysym;
|
Patch from Ed Catmur to fix keybindings with hex-values (coming from
2006-08-21 Elijah Newren <newren gmail com>
Patch from Ed Catmur to fix keybindings with hex-values (coming
from special extended keyboard keys). #140448.
* src/keybindings.c (struct _MetaKeyBinding): change keycode from
KeyCode to unsigned int (comment from Elijah: why???),
(reload_keycodes): only grab keysyms for keybindings that have
them, (count_bindings, rebuild_binding_table): bindings can be
valid either due to a valid keysym or a valid keycode,
(display_get_keybinding_action, meta_change_keygrab,
process_tab_grab, process_workspace_switch_grab): handle keycode
as well as keysym
* src/prefs.[ch] (struct MetaKeyCombo, update_binding,
update_list_binding): handle keycode as well as keysym
* src/ui.[ch] (meta_ui_accelerator_parse): new function special
cases strings of the form "0x[0-9a-fA-F]+" and otherwise calling
gtk_accelerator_parse(), (meta_ui_parse_accelerator,
meta_ui_parse_modifier): call meta_ui_accelerator_parse instead of
gtk_accelerator_parse.
2006-08-21 19:06:26 +00:00
|
|
|
|
unsigned int keycode;
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
MetaVirtualModifier mods;
|
|
|
|
|
MetaKeyCombo *combo;
|
2011-06-24 16:14:15 +00:00
|
|
|
|
int i;
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2011-06-24 16:14:15 +00:00
|
|
|
|
"Binding \"%s\" has new GSettings value\n",
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
binding->name);
|
2011-06-24 16:14:15 +00:00
|
|
|
|
|
2013-03-31 18:18:54 +00:00
|
|
|
|
old_bindings = binding->bindings;
|
2011-06-24 16:14:15 +00:00
|
|
|
|
binding->bindings = NULL;
|
2013-03-31 18:18:54 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
for (i = 0; strokes && strokes[i]; i++)
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
{
|
|
|
|
|
keysym = 0;
|
Patch from Ed Catmur to fix keybindings with hex-values (coming from
2006-08-21 Elijah Newren <newren gmail com>
Patch from Ed Catmur to fix keybindings with hex-values (coming
from special extended keyboard keys). #140448.
* src/keybindings.c (struct _MetaKeyBinding): change keycode from
KeyCode to unsigned int (comment from Elijah: why???),
(reload_keycodes): only grab keysyms for keybindings that have
them, (count_bindings, rebuild_binding_table): bindings can be
valid either due to a valid keysym or a valid keycode,
(display_get_keybinding_action, meta_change_keygrab,
process_tab_grab, process_workspace_switch_grab): handle keycode
as well as keysym
* src/prefs.[ch] (struct MetaKeyCombo, update_binding,
update_list_binding): handle keycode as well as keysym
* src/ui.[ch] (meta_ui_accelerator_parse): new function special
cases strings of the form "0x[0-9a-fA-F]+" and otherwise calling
gtk_accelerator_parse(), (meta_ui_parse_accelerator,
meta_ui_parse_modifier): call meta_ui_accelerator_parse instead of
gtk_accelerator_parse.
2006-08-21 19:06:26 +00:00
|
|
|
|
keycode = 0;
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
mods = 0;
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (!meta_ui_parse_accelerator (strokes[i], &keysym, &keycode, &mods))
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
{
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
2011-06-24 16:14:15 +00:00
|
|
|
|
"Failed to parse new GSettings value\n");
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
meta_warning (_("\"%s\" found in configuration database is not a valid value for keybinding \"%s\"\n"),
|
2011-06-24 16:14:15 +00:00
|
|
|
|
strokes[i], binding->name);
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
/* Value is kept and will thus be removed next time we save the key.
|
|
|
|
|
* Changing the key in response to a modification could lead to cyclic calls. */
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Bug 329676: Bindings which can be shifted must not have no modifiers,
|
|
|
|
|
* nor only SHIFT as a modifier.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (binding->add_shift &&
|
|
|
|
|
0 != keysym &&
|
|
|
|
|
(META_VIRTUAL_SHIFT_MASK == mods || 0 == mods))
|
|
|
|
|
{
|
|
|
|
|
meta_warning ("Cannot bind \"%s\" to %s: it needs a modifier "
|
|
|
|
|
"such as Ctrl or Alt.\n",
|
2011-06-24 16:14:15 +00:00
|
|
|
|
binding->name, strokes[i]);
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
/* Value is kept and will thus be removed next time we save the key.
|
|
|
|
|
* Changing the key in response to a modification could lead to cyclic calls. */
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
combo = g_malloc0 (sizeof (MetaKeyCombo));
|
|
|
|
|
combo->keysym = keysym;
|
Patch from Ed Catmur to fix keybindings with hex-values (coming from
2006-08-21 Elijah Newren <newren gmail com>
Patch from Ed Catmur to fix keybindings with hex-values (coming
from special extended keyboard keys). #140448.
* src/keybindings.c (struct _MetaKeyBinding): change keycode from
KeyCode to unsigned int (comment from Elijah: why???),
(reload_keycodes): only grab keysyms for keybindings that have
them, (count_bindings, rebuild_binding_table): bindings can be
valid either due to a valid keysym or a valid keycode,
(display_get_keybinding_action, meta_change_keygrab,
process_tab_grab, process_workspace_switch_grab): handle keycode
as well as keysym
* src/prefs.[ch] (struct MetaKeyCombo, update_binding,
update_list_binding): handle keycode as well as keysym
* src/ui.[ch] (meta_ui_accelerator_parse): new function special
cases strings of the form "0x[0-9a-fA-F]+" and otherwise calling
gtk_accelerator_parse(), (meta_ui_parse_accelerator,
meta_ui_parse_modifier): call meta_ui_accelerator_parse instead of
gtk_accelerator_parse.
2006-08-21 19:06:26 +00:00
|
|
|
|
combo->keycode = keycode;
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
combo->modifiers = mods;
|
2011-06-24 16:14:15 +00:00
|
|
|
|
binding->bindings = g_slist_prepend (binding->bindings, combo);
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
|
|
|
|
|
meta_topic (META_DEBUG_KEYBINDINGS,
|
Patch from Ed Catmur to fix keybindings with hex-values (coming from
2006-08-21 Elijah Newren <newren gmail com>
Patch from Ed Catmur to fix keybindings with hex-values (coming
from special extended keyboard keys). #140448.
* src/keybindings.c (struct _MetaKeyBinding): change keycode from
KeyCode to unsigned int (comment from Elijah: why???),
(reload_keycodes): only grab keysyms for keybindings that have
them, (count_bindings, rebuild_binding_table): bindings can be
valid either due to a valid keysym or a valid keycode,
(display_get_keybinding_action, meta_change_keygrab,
process_tab_grab, process_workspace_switch_grab): handle keycode
as well as keysym
* src/prefs.[ch] (struct MetaKeyCombo, update_binding,
update_list_binding): handle keycode as well as keysym
* src/ui.[ch] (meta_ui_accelerator_parse): new function special
cases strings of the form "0x[0-9a-fA-F]+" and otherwise calling
gtk_accelerator_parse(), (meta_ui_parse_accelerator,
meta_ui_parse_modifier): call meta_ui_accelerator_parse instead of
gtk_accelerator_parse.
2006-08-21 19:06:26 +00:00
|
|
|
|
"New keybinding for \"%s\" is keysym = 0x%x keycode = 0x%x mods = 0x%x\n",
|
|
|
|
|
binding->name, keysym, keycode, mods);
|
2011-06-24 16:14:15 +00:00
|
|
|
|
}
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
|
2013-02-17 20:50:08 +00:00
|
|
|
|
binding->bindings = g_slist_reverse (binding->bindings);
|
|
|
|
|
|
2013-03-31 18:18:54 +00:00
|
|
|
|
a = old_bindings;
|
|
|
|
|
b = binding->bindings;
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_slist_free_full (old_bindings, g_free);
|
|
|
|
|
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
return changed;
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-28 04:52:26 +00:00
|
|
|
|
static gboolean
|
2010-02-16 16:57:00 +00:00
|
|
|
|
update_key_binding (const char *key,
|
2011-06-24 16:14:15 +00:00
|
|
|
|
gchar **strokes)
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
{
|
2011-10-28 01:05:43 +00:00
|
|
|
|
MetaKeyPref *pref = g_hash_table_lookup (key_bindings, key);
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
|
if (pref)
|
|
|
|
|
return update_binding (pref, strokes);
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
else
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2004-10-13 08:32:10 +00:00
|
|
|
|
const char*
|
2011-06-24 16:14:15 +00:00
|
|
|
|
meta_prefs_get_workspace_name (int i)
|
2004-10-13 08:32:10 +00:00
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
const char *name;
|
2004-10-13 08:32:10 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (!workspace_names ||
|
|
|
|
|
g_strv_length (workspace_names) < (guint)i + 1 ||
|
|
|
|
|
!*workspace_names[i])
|
2002-11-03 19:06:39 +00:00
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
char *generated_name = g_strdup_printf (_("Workspace %d"), i + 1);
|
|
|
|
|
name = g_intern_string (generated_name);
|
|
|
|
|
g_free (generated_name);
|
2002-11-20 03:57:20 +00:00
|
|
|
|
}
|
2002-11-03 19:06:39 +00:00
|
|
|
|
else
|
2011-06-24 16:14:15 +00:00
|
|
|
|
name = workspace_names[i];
|
2002-11-20 03:57:20 +00:00
|
|
|
|
|
2002-11-03 19:06:39 +00:00
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
2011-06-24 16:14:15 +00:00
|
|
|
|
"Getting name of workspace %d: \"%s\"\n", i, name);
|
2002-11-03 19:06:39 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
return name;
|
2002-11-03 19:06:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2011-06-24 16:14:15 +00:00
|
|
|
|
meta_prefs_change_workspace_name (int num,
|
2002-11-03 19:06:39 +00:00
|
|
|
|
const char *name)
|
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
GVariantBuilder builder;
|
|
|
|
|
int n_workspace_names, i;
|
2002-11-03 19:06:39 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
g_return_if_fail (num >= 0);
|
2002-11-03 19:06:39 +00:00
|
|
|
|
|
2002-11-20 04:54:01 +00:00
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
|
"Changing name of workspace %d to %s\n",
|
2011-06-24 16:14:15 +00:00
|
|
|
|
num, name ? name : "none");
|
2002-11-20 04:54:01 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
/* NULL and empty string both mean "default" here,
|
|
|
|
|
* and we also need to match the name against its default value
|
|
|
|
|
* to avoid saving it literally. */
|
|
|
|
|
if (g_strcmp0 (name, meta_prefs_get_workspace_name (num)) == 0)
|
2002-11-03 19:06:39 +00:00
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
if (!name || !*name)
|
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
|
"Workspace %d already uses default name\n", num);
|
|
|
|
|
else
|
|
|
|
|
meta_topic (META_DEBUG_PREFS,
|
|
|
|
|
"Workspace %d already has name %s\n", num, name);
|
2002-11-03 19:06:39 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
g_variant_builder_init (&builder, G_VARIANT_TYPE_STRING_ARRAY);
|
|
|
|
|
n_workspace_names = workspace_names ? g_strv_length (workspace_names) : 0;
|
2002-11-03 19:06:39 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
for (i = 0; i < MAX (num + 1, n_workspace_names); i++)
|
2002-11-03 19:06:39 +00:00
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
const char *value;
|
|
|
|
|
|
|
|
|
|
if (i == num)
|
|
|
|
|
value = name ? name : "";
|
|
|
|
|
else if (i < n_workspace_names)
|
|
|
|
|
value = workspace_names[i] ? workspace_names[i] : "";
|
|
|
|
|
else
|
|
|
|
|
value = "";
|
|
|
|
|
|
|
|
|
|
g_variant_builder_add (&builder, "s", value);
|
2002-11-03 19:06:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
g_settings_set_value (SETTINGS (SCHEMA_GENERAL), KEY_WORKSPACE_NAMES,
|
|
|
|
|
g_variant_builder_end (&builder));
|
2002-11-03 19:06:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-11-28 22:32:09 +00:00
|
|
|
|
/**
|
|
|
|
|
* meta_prefs_get_button_layout:
|
|
|
|
|
* @button_layout: (out):
|
|
|
|
|
*/
|
2002-10-04 02:28:57 +00:00
|
|
|
|
void
|
2002-10-12 17:44:55 +00:00
|
|
|
|
meta_prefs_get_button_layout (MetaButtonLayout *button_layout_p)
|
2002-10-04 02:28:57 +00:00
|
|
|
|
{
|
2002-10-12 17:44:55 +00:00
|
|
|
|
*button_layout_p = button_layout;
|
2002-10-04 02:28:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-11-14 14:22:30 +00:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_visual_bell (void)
|
|
|
|
|
{
|
|
|
|
|
return bell_is_visible;
|
|
|
|
|
}
|
|
|
|
|
|
2003-01-28 15:07:43 +00:00
|
|
|
|
gboolean
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 23:18:22 +00:00
|
|
|
|
meta_prefs_bell_is_audible (void)
|
2003-01-28 15:07:43 +00:00
|
|
|
|
{
|
|
|
|
|
return bell_is_audible;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
GDesktopVisualBellType
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 23:18:22 +00:00
|
|
|
|
meta_prefs_get_visual_bell_type (void)
|
2003-01-28 15:07:43 +00:00
|
|
|
|
{
|
|
|
|
|
return visual_bell_type;
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_add_keybinding (const char *name,
|
2012-03-27 14:42:42 +00:00
|
|
|
|
GSettings *settings,
|
2011-10-28 01:05:43 +00:00
|
|
|
|
MetaKeyBindingAction action,
|
|
|
|
|
MetaKeyBindingFlags flags)
|
2002-04-28 04:52:26 +00:00
|
|
|
|
{
|
2011-10-28 01:05:43 +00:00
|
|
|
|
MetaKeyPref *pref;
|
|
|
|
|
char **strokes;
|
2012-03-27 14:42:42 +00:00
|
|
|
|
guint id;
|
2011-10-28 01:05:43 +00:00
|
|
|
|
|
|
|
|
|
if (g_hash_table_lookup (key_bindings, name))
|
|
|
|
|
{
|
|
|
|
|
meta_warning ("Trying to re-add keybinding \"%s\".\n", name);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pref = g_new0 (MetaKeyPref, 1);
|
|
|
|
|
pref->name = g_strdup (name);
|
2012-03-27 14:42:42 +00:00
|
|
|
|
pref->settings = g_object_ref (settings);
|
2011-10-28 01:05:43 +00:00
|
|
|
|
pref->action = action;
|
|
|
|
|
pref->bindings = NULL;
|
|
|
|
|
pref->add_shift = (flags & META_KEY_BINDING_REVERSES) != 0;
|
|
|
|
|
pref->per_window = (flags & META_KEY_BINDING_PER_WINDOW) != 0;
|
2011-11-04 18:18:57 +00:00
|
|
|
|
pref->builtin = (flags & META_KEY_BINDING_BUILTIN) != 0;
|
2011-10-28 01:05:43 +00:00
|
|
|
|
|
|
|
|
|
strokes = g_settings_get_strv (settings, name);
|
|
|
|
|
update_binding (pref, strokes);
|
|
|
|
|
g_strfreev (strokes);
|
|
|
|
|
|
|
|
|
|
g_hash_table_insert (key_bindings, g_strdup (name), pref);
|
|
|
|
|
|
2012-03-27 14:42:42 +00:00
|
|
|
|
if (pref->builtin)
|
|
|
|
|
{
|
|
|
|
|
if (g_object_get_data (G_OBJECT (settings), "changed-signal") == NULL)
|
|
|
|
|
{
|
|
|
|
|
id = g_signal_connect (settings, "changed",
|
|
|
|
|
G_CALLBACK (bindings_changed), NULL);
|
|
|
|
|
g_object_set_data (G_OBJECT (settings), "changed-signal", GUINT_TO_POINTER (id));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
2011-11-04 18:18:57 +00:00
|
|
|
|
{
|
|
|
|
|
char *changed_signal = g_strdup_printf ("changed::%s", name);
|
|
|
|
|
id = g_signal_connect (settings, changed_signal,
|
|
|
|
|
G_CALLBACK (bindings_changed), NULL);
|
|
|
|
|
g_free (changed_signal);
|
|
|
|
|
|
|
|
|
|
g_object_set_data (G_OBJECT (settings), name, GUINT_TO_POINTER (id));
|
|
|
|
|
|
|
|
|
|
queue_changed (META_PREF_KEYBINDINGS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 14:42:42 +00:00
|
|
|
|
id = GPOINTER_TO_UINT (g_object_steal_data (G_OBJECT (pref->settings), name));
|
|
|
|
|
g_signal_handler_disconnect (pref->settings, id);
|
2011-11-04 18:18:57 +00:00
|
|
|
|
|
|
|
|
|
g_hash_table_remove (key_bindings, name);
|
|
|
|
|
|
|
|
|
|
queue_changed (META_PREF_KEYBINDINGS);
|
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2011-11-04 18:18:57 +00:00
|
|
|
|
* meta_prefs_get_keybindings:
|
2011-11-02 15:34:45 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: (element-type MetaKeyPref) (transfer container):
|
2011-10-28 01:05:43 +00:00
|
|
|
|
*/
|
|
|
|
|
GList *
|
|
|
|
|
meta_prefs_get_keybindings ()
|
|
|
|
|
{
|
|
|
|
|
return g_hash_table_get_values (key_bindings);
|
2002-04-28 04:52:26 +00:00
|
|
|
|
}
|
2002-10-18 21:22:27 +00:00
|
|
|
|
|
2008-12-02 23:13:11 +00:00
|
|
|
|
void
|
|
|
|
|
meta_prefs_get_overlay_binding (MetaKeyCombo *combo)
|
|
|
|
|
{
|
|
|
|
|
*combo = overlay_key_combo;
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-10 09:57:16 +00:00
|
|
|
|
const char *
|
|
|
|
|
meta_prefs_get_iso_next_group_option (void)
|
|
|
|
|
{
|
|
|
|
|
return iso_next_group_option;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
GDesktopTitlebarAction
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 23:18:22 +00:00
|
|
|
|
meta_prefs_get_action_double_click_titlebar (void)
|
2002-10-18 21:22:27 +00:00
|
|
|
|
{
|
|
|
|
|
return action_double_click_titlebar;
|
|
|
|
|
}
|
2002-04-28 04:52:26 +00:00
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
GDesktopTitlebarAction
|
2007-03-10 01:15:14 +00:00
|
|
|
|
meta_prefs_get_action_middle_click_titlebar (void)
|
|
|
|
|
{
|
|
|
|
|
return action_middle_click_titlebar;
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-24 16:14:15 +00:00
|
|
|
|
GDesktopTitlebarAction
|
2007-03-10 01:15:14 +00:00
|
|
|
|
meta_prefs_get_action_right_click_titlebar (void)
|
|
|
|
|
{
|
|
|
|
|
return action_right_click_titlebar;
|
|
|
|
|
}
|
|
|
|
|
|
2002-05-24 02:23:46 +00:00
|
|
|
|
gboolean
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 23:18:22 +00:00
|
|
|
|
meta_prefs_get_auto_raise (void)
|
2002-05-24 02:23:46 +00:00
|
|
|
|
{
|
|
|
|
|
return auto_raise;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
A load of fixes of issues reported by sparse. Closes bug #152849
2004-09-17 Kjartan Maraas <kmaraas@gnome.org>
* src/bell.c: (meta_bell_flash_screen):
* src/compositor.c:
* src/effects.c: (meta_effects_draw_box_animation):
* src/fixedtip.c: (meta_fixed_tip_show):
* src/frame.c: (find_argb_visual):
* src/frames.c: (unsigned_long_hash), (meta_frames_manage_window),
(meta_frames_apply_shapes):
* src/iconcache.c: (find_largest_sizes), (find_best_size):
* src/keybindings.c: (meta_spawn_command_line_async_on_screen):
* src/main.c: (main):
* src/menu.c: (meta_window_menu_new):
* src/prefs.c: (meta_prefs_get_visual_bell),
(meta_prefs_bell_is_audible), (meta_prefs_get_visual_bell_type),
(meta_prefs_get_action_double_click_titlebar),
(meta_prefs_get_auto_raise), (meta_prefs_get_auto_raise_delay),
(meta_prefs_get_reduced_resources):
* src/screen.c: (meta_create_offscreen_window):
* src/tabpopup.c: (meta_ui_tab_popup_get_selected):
* src/theme-parser.c: (meta_theme_load):
* src/theme.c: (meta_gtk_widget_get_font_desc):
* src/tools/metacity-mag.c: (mouse_press), (begin_area_grab):
* src/util.c: (meta_unsigned_long_hash): A load of fixes of issues
reported by sparse. Closes bug #152849
2004-09-16 23:18:22 +00:00
|
|
|
|
meta_prefs_get_auto_raise_delay (void)
|
2002-05-24 02:23:46 +00:00
|
|
|
|
{
|
|
|
|
|
return auto_raise_delay;
|
|
|
|
|
}
|
2002-06-09 03:44:16 +00:00
|
|
|
|
|
2012-08-29 02:38:54 +00:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_focus_change_on_pointer_rest ()
|
|
|
|
|
{
|
|
|
|
|
return focus_change_on_pointer_rest;
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-26 08:43:38 +00:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_gnome_accessibility ()
|
|
|
|
|
{
|
|
|
|
|
return gnome_accessibility;
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-29 21:57:39 +00:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_gnome_animations ()
|
|
|
|
|
{
|
|
|
|
|
return gnome_animations;
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-24 18:41:28 +00:00
|
|
|
|
gboolean
|
2010-09-24 18:28:12 +00:00
|
|
|
|
meta_prefs_get_edge_tiling ()
|
2010-06-24 18:41:28 +00:00
|
|
|
|
{
|
2010-09-24 18:28:12 +00:00
|
|
|
|
return edge_tiling;
|
2010-06-24 18:41:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-08 09:34:27 +00:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_auto_maximize (void)
|
|
|
|
|
{
|
|
|
|
|
return auto_maximize;
|
|
|
|
|
}
|
|
|
|
|
|
2002-06-09 03:44:16 +00:00
|
|
|
|
MetaKeyBindingAction
|
2002-07-14 03:16:41 +00:00
|
|
|
|
meta_prefs_get_keybinding_action (const char *name)
|
2002-06-09 03:44:16 +00:00
|
|
|
|
{
|
2011-10-28 01:05:43 +00:00
|
|
|
|
MetaKeyPref *pref = g_hash_table_lookup (key_bindings, name);
|
2002-06-09 03:44:16 +00:00
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
|
return pref ? pref->action
|
|
|
|
|
: META_KEYBINDING_ACTION_NONE;
|
2002-06-09 03:44:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
/* This is used by the menu system to decide what key binding
|
|
|
|
|
* to display next to an option. We return the first non-disabled
|
|
|
|
|
* binding, if any.
|
|
|
|
|
*/
|
2002-09-27 01:40:17 +00:00
|
|
|
|
void
|
|
|
|
|
meta_prefs_get_window_binding (const char *name,
|
|
|
|
|
unsigned int *keysym,
|
|
|
|
|
MetaVirtualModifier *modifiers)
|
|
|
|
|
{
|
2011-10-28 01:05:43 +00:00
|
|
|
|
MetaKeyPref *pref = g_hash_table_lookup (key_bindings, name);
|
2002-09-27 01:40:17 +00:00
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
|
if (pref->per_window)
|
2002-09-27 01:40:17 +00:00
|
|
|
|
{
|
2011-10-28 01:05:43 +00:00
|
|
|
|
GSList *s = pref->bindings;
|
|
|
|
|
|
|
|
|
|
while (s)
|
2002-09-27 01:40:17 +00:00
|
|
|
|
{
|
2011-10-28 01:05:43 +00:00
|
|
|
|
MetaKeyCombo *c = s->data;
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
|
if (c->keysym != 0 || c->modifiers != 0)
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
{
|
2011-10-28 01:05:43 +00:00
|
|
|
|
*keysym = c->keysym;
|
|
|
|
|
*modifiers = c->modifiers;
|
|
|
|
|
return;
|
Allow any keybinding pref to be specified either with <foo>, a string, or
2004-04-17 Thomas Thurman <thomas@thurman.org.uk>
* keybindings.c (count_bindings, rebuild_binding_table):
* prefs.c (change_notify, screen_bindings,
window_bindings, init_bindings, update_binding,
find_and_update_list_binding, update_list_binding,
meta_prefs_get_window_binding): Allow any keybinding pref
to be specified either with <foo>, a string, or <foo>_list,
a list of strings, or both. Fixes #164831.
2006-04-17 17:23:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-10-28 01:05:43 +00:00
|
|
|
|
s = s->next;
|
2002-09-27 01:40:17 +00:00
|
|
|
|
}
|
2011-10-28 01:05:43 +00:00
|
|
|
|
|
|
|
|
|
/* Not found; return the disabled value */
|
|
|
|
|
*keysym = *modifiers = 0;
|
|
|
|
|
return;
|
2002-09-27 01:40:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
}
|
2006-02-16 20:26:05 +00:00
|
|
|
|
|
2012-12-17 12:30:01 +00:00
|
|
|
|
gint
|
2009-01-27 21:05:42 +00:00
|
|
|
|
meta_prefs_get_mouse_button_resize (void)
|
|
|
|
|
{
|
|
|
|
|
return resize_with_right_button ? 3: 2;
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-17 12:30:01 +00:00
|
|
|
|
gint
|
2009-01-27 21:05:42 +00:00
|
|
|
|
meta_prefs_get_mouse_button_menu (void)
|
|
|
|
|
{
|
|
|
|
|
return resize_with_right_button ? 2: 3;
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-19 15:30:37 +00:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_force_fullscreen (void)
|
|
|
|
|
{
|
|
|
|
|
return force_fullscreen;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-28 12:48:28 +00:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_workspaces_only_on_primary (void)
|
|
|
|
|
{
|
|
|
|
|
return workspaces_only_on_primary;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-02-02 14:09:04 +00:00
|
|
|
|
gboolean
|
|
|
|
|
meta_prefs_get_no_tab_popup (void)
|
|
|
|
|
{
|
|
|
|
|
return no_tab_popup;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
meta_prefs_set_no_tab_popup (gboolean whether)
|
|
|
|
|
{
|
2011-06-24 16:14:15 +00:00
|
|
|
|
MetaBasePreference *pref;
|
2009-02-02 14:09:04 +00:00
|
|
|
|
|
2013-04-17 08:04:49 +00:00
|
|
|
|
if (find_pref (preferences_bool, sizeof(MetaBoolPreference),
|
|
|
|
|
KEY_NO_TAB_POPUP, &pref))
|
|
|
|
|
{
|
|
|
|
|
g_settings_set_boolean (SETTINGS (pref->schema), KEY_NO_TAB_POPUP, whether);
|
|
|
|
|
}
|
2009-02-02 14:09:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-07-20 06:14:58 +00:00
|
|
|
|
int
|
|
|
|
|
meta_prefs_get_draggable_border_width (void)
|
|
|
|
|
{
|
|
|
|
|
return draggable_border_width;
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-19 15:30:37 +00:00
|
|
|
|
void
|
|
|
|
|
meta_prefs_set_force_fullscreen (gboolean whether)
|
|
|
|
|
{
|
|
|
|
|
force_fullscreen = whether;
|
|
|
|
|
}
|
2012-07-01 17:25:08 +00: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;
|
|
|
|
|
}
|