[gtk+] Formatting fixes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Formatting fixes
- Date: Sun, 13 Mar 2011 02:25:46 +0000 (UTC)
commit 4a44f3f6e1ebbc63a3d52522deb8be58acb5bc86
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Mar 12 21:22:27 2011 -0500
Formatting fixes
gtk/gtkaccelgroup.c | 786 ++++++++++++++++++++++++++-------------------------
1 files changed, 396 insertions(+), 390 deletions(-)
---
diff --git a/gtk/gtkaccelgroup.c b/gtk/gtkaccelgroup.c
index 7f09e67..f131d06 100644
--- a/gtk/gtkaccelgroup.c
+++ b/gtk/gtkaccelgroup.c
@@ -8,7 +8,7 @@
*
* This library 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
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
@@ -21,7 +21,7 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
@@ -39,7 +39,8 @@
/**
* SECTION:gtkaccelgroup
- * @Short_description: Groups of global keyboard accelerators for an entire GtkWindow
+ * @Short_description: Groups of global keyboard accelerators for an
+ * entire GtkWindow
* @Title: Accelerator Groups
* @See_also:gtk_window_add_accel_group(), gtk_accel_map_change_entry(),
* gtk_item_factory_new(), gtk_label_new_with_mnemonic()
@@ -50,7 +51,7 @@
* #GtkAccelGroup directly; instead, when using #GtkUIManager, GTK+
* automatically sets up the accelerators for your menus in the ui
* manager's #GtkAccelGroup.
- *
+ *
* Note that <firstterm>accelerators</firstterm> are different from
* <firstterm>mnemonics</firstterm>. Accelerators are shortcuts for
* activating a menu item; they appear alongside the menu item they're a
@@ -132,20 +133,20 @@ gtk_accel_group_class_init (GtkAccelGroupClass *class)
*
* The accel-activate signal is an implementation detail of
* #GtkAccelGroup and not meant to be used by applications.
- *
+ *
* Returns: %TRUE if the accelerator was activated
*/
signal_accel_activate =
g_signal_new (I_("accel-activate"),
- G_OBJECT_CLASS_TYPE (class),
- G_SIGNAL_DETAILED,
- 0,
- _gtk_boolean_handled_accumulator, NULL,
- _gtk_marshal_BOOLEAN__OBJECT_UINT_FLAGS,
- G_TYPE_BOOLEAN, 3,
- G_TYPE_OBJECT,
- G_TYPE_UINT,
- GDK_TYPE_MODIFIER_TYPE);
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_DETAILED,
+ 0,
+ _gtk_boolean_handled_accumulator, NULL,
+ _gtk_marshal_BOOLEAN__OBJECT_UINT_FLAGS,
+ G_TYPE_BOOLEAN, 3,
+ G_TYPE_OBJECT,
+ G_TYPE_UINT,
+ GDK_TYPE_MODIFIER_TYPE);
/**
* GtkAccelGroup::accel-changed:
* @accel_group: the #GtkAccelGroup which received the signal
@@ -154,23 +155,23 @@ gtk_accel_group_class_init (GtkAccelGroupClass *class)
* @accel_closure: the #GClosure of the accelerator
*
* The accel-changed signal is emitted when a #GtkAccelGroupEntry
- * is added to or removed from the accel group.
+ * is added to or removed from the accel group.
*
- * Widgets like #GtkAccelLabel which display an associated
- * accelerator should connect to this signal, and rebuild
+ * Widgets like #GtkAccelLabel which display an associated
+ * accelerator should connect to this signal, and rebuild
* their visual representation if the @accel_closure is theirs.
*/
signal_accel_changed =
g_signal_new (I_("accel-changed"),
- G_OBJECT_CLASS_TYPE (class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_DETAILED,
- G_STRUCT_OFFSET (GtkAccelGroupClass, accel_changed),
- NULL, NULL,
- _gtk_marshal_VOID__UINT_FLAGS_BOXED,
- G_TYPE_NONE, 3,
- G_TYPE_UINT,
- GDK_TYPE_MODIFIER_TYPE,
- G_TYPE_CLOSURE);
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_DETAILED,
+ G_STRUCT_OFFSET (GtkAccelGroupClass, accel_changed),
+ NULL, NULL,
+ _gtk_marshal_VOID__UINT_FLAGS_BOXED,
+ G_TYPE_NONE, 3,
+ G_TYPE_UINT,
+ GDK_TYPE_MODIFIER_TYPE,
+ G_TYPE_CLOSURE);
g_type_class_add_private (object_class, sizeof (GtkAccelGroupPrivate));
}
@@ -180,17 +181,17 @@ gtk_accel_group_finalize (GObject *object)
{
GtkAccelGroup *accel_group = GTK_ACCEL_GROUP (object);
guint i;
-
+
for (i = 0; i < accel_group->priv->n_accels; i++)
{
GtkAccelGroupEntry *entry = &accel_group->priv->priv_accels[i];
if (entry->accel_path_quark)
- {
- const gchar *accel_path = g_quark_to_string (entry->accel_path_quark);
+ {
+ const gchar *accel_path = g_quark_to_string (entry->accel_path_quark);
- _gtk_accel_map_remove_group (accel_path, accel_group);
- }
+ _gtk_accel_map_remove_group (accel_path, accel_group);
+ }
g_closure_remove_invalidate_notifier (entry->closure, accel_group, accel_closure_invalidate);
/* remove quick_accel_add() refcount */
@@ -241,8 +242,8 @@ gtk_accel_group_init (GtkAccelGroup *accel_group)
/**
* gtk_accel_group_new:
* @returns: a new #GtkAccelGroup object
- *
- * Creates a new #GtkAccelGroup.
+ *
+ * Creates a new #GtkAccelGroup.
*/
GtkAccelGroup*
gtk_accel_group_new (void)
@@ -258,7 +259,7 @@ gtk_accel_group_new (void)
* gtk_accel_group_unlock().
*
* Returns: %TRUE if there are 1 or more locks on the @accel_group,
- * %FALSE otherwise.
+ * %FALSE otherwise.
*
* Since: 2.14
*/
@@ -291,14 +292,14 @@ gtk_accel_group_get_modifier_mask (GtkAccelGroup *accel_group)
static void
accel_group_weak_ref_detach (GSList *free_list,
- GObject *stale_object)
+ GObject *stale_object)
{
GSList *slist;
-
+
for (slist = free_list; slist; slist = slist->next)
{
GtkAccelGroup *accel_group;
-
+
accel_group = slist->data;
accel_group->priv->acceleratables = g_slist_remove (accel_group->priv->acceleratables, stale_object);
g_object_unref (accel_group);
@@ -309,65 +310,66 @@ accel_group_weak_ref_detach (GSList *free_list,
void
_gtk_accel_group_attach (GtkAccelGroup *accel_group,
- GObject *object)
+ GObject *object)
{
GSList *slist;
-
+
g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group));
g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (g_slist_find (accel_group->priv->acceleratables, object) == NULL);
-
+
g_object_ref (accel_group);
accel_group->priv->acceleratables = g_slist_prepend (accel_group->priv->acceleratables, object);
slist = g_object_get_qdata (object, quark_acceleratable_groups);
if (slist)
g_object_weak_unref (object,
- (GWeakNotify) accel_group_weak_ref_detach,
- slist);
+ (GWeakNotify) accel_group_weak_ref_detach,
+ slist);
slist = g_slist_prepend (slist, accel_group);
g_object_set_qdata (object, quark_acceleratable_groups, slist);
g_object_weak_ref (object,
- (GWeakNotify) accel_group_weak_ref_detach,
- slist);
+ (GWeakNotify) accel_group_weak_ref_detach,
+ slist);
}
void
_gtk_accel_group_detach (GtkAccelGroup *accel_group,
- GObject *object)
+ GObject *object)
{
GSList *slist;
-
+
g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group));
g_return_if_fail (G_IS_OBJECT (object));
g_return_if_fail (g_slist_find (accel_group->priv->acceleratables, object) != NULL);
-
+
accel_group->priv->acceleratables = g_slist_remove (accel_group->priv->acceleratables, object);
slist = g_object_get_qdata (object, quark_acceleratable_groups);
g_object_weak_unref (object,
- (GWeakNotify) accel_group_weak_ref_detach,
- slist);
+ (GWeakNotify) accel_group_weak_ref_detach,
+ slist);
slist = g_slist_remove (slist, accel_group);
g_object_set_qdata (object, quark_acceleratable_groups, slist);
if (slist)
g_object_weak_ref (object,
- (GWeakNotify) accel_group_weak_ref_detach,
- slist);
+ (GWeakNotify) accel_group_weak_ref_detach,
+ slist);
g_object_unref (accel_group);
}
/**
* gtk_accel_groups_from_object:
- * @object: a #GObject, usually a #GtkWindow
+ * @object: a #GObject, usually a #GtkWindow
*
* Gets a list of all accel groups which are attached to @object.
*
- * Returns: (element-type GtkAccelGroup) (transfer none): a list of all accel groups which are attached to @object
+ * Returns: (element-type GtkAccelGroup) (transfer none): a list of
+ * all accel groups which are attached to @object
*/
GSList*
gtk_accel_groups_from_object (GObject *object)
{
g_return_val_if_fail (G_IS_OBJECT (object), NULL);
-
+
return g_object_get_qdata (object, quark_acceleratable_groups);
}
@@ -380,14 +382,13 @@ gtk_accel_groups_from_object (GObject *object)
* @returns: (transfer none): the key of the first entry passing
* @find_func. The key is owned by GTK+ and must not be freed.
*
- * Finds the first entry in an accelerator group for which
+ * Finds the first entry in an accelerator group for which
* @find_func returns %TRUE and returns its #GtkAccelKey.
- *
*/
GtkAccelKey*
-gtk_accel_group_find (GtkAccelGroup *accel_group,
- GtkAccelGroupFindFunc find_func,
- gpointer data)
+gtk_accel_group_find (GtkAccelGroup *accel_group,
+ GtkAccelGroupFindFunc find_func,
+ gpointer data)
{
GtkAccelKey *key = NULL;
guint i;
@@ -398,11 +399,11 @@ gtk_accel_group_find (GtkAccelGroup *accel_group,
g_object_ref (accel_group);
for (i = 0; i < accel_group->priv->n_accels; i++)
if (find_func (&accel_group->priv->priv_accels[i].key,
- accel_group->priv->priv_accels[i].closure,
- data))
+ accel_group->priv->priv_accels[i].closure,
+ data))
{
- key = &accel_group->priv->priv_accels[i].key;
- break;
+ key = &accel_group->priv->priv_accels[i].key;
+ break;
}
g_object_unref (accel_group);
@@ -412,7 +413,7 @@ gtk_accel_group_find (GtkAccelGroup *accel_group,
/**
* gtk_accel_group_lock:
* @accel_group: a #GtkAccelGroup
- *
+ *
* Locks the given accelerator group.
*
* Locking an acelerator group prevents the accelerators contained
@@ -427,7 +428,7 @@ void
gtk_accel_group_lock (GtkAccelGroup *accel_group)
{
g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group));
-
+
accel_group->priv->lock_count += 1;
if (accel_group->priv->lock_count == 1) {
@@ -439,7 +440,7 @@ gtk_accel_group_lock (GtkAccelGroup *accel_group)
/**
* gtk_accel_group_unlock:
* @accel_group: a #GtkAccelGroup
- *
+ *
* Undoes the last call to gtk_accel_group_lock() on this @accel_group.
*/
void
@@ -458,7 +459,7 @@ gtk_accel_group_unlock (GtkAccelGroup *accel_group)
static void
accel_closure_invalidate (gpointer data,
- GClosure *closure)
+ GClosure *closure)
{
GtkAccelGroup *accel_group = GTK_ACCEL_GROUP (data);
@@ -467,7 +468,7 @@ accel_closure_invalidate (gpointer data,
static int
bsearch_compare_accels (const void *d1,
- const void *d2)
+ const void *d2)
{
const GtkAccelGroupEntry *entry1 = d1;
const GtkAccelGroupEntry *entry2 = d2;
@@ -479,12 +480,12 @@ bsearch_compare_accels (const void *d1,
}
static void
-quick_accel_add (GtkAccelGroup *accel_group,
- guint accel_key,
- GdkModifierType accel_mods,
- GtkAccelFlags accel_flags,
- GClosure *closure,
- GQuark path_quark)
+quick_accel_add (GtkAccelGroup *accel_group,
+ guint accel_key,
+ GdkModifierType accel_mods,
+ GtkAccelFlags accel_flags,
+ GClosure *closure,
+ GQuark path_quark)
{
guint pos, i = accel_group->priv->n_accels++;
GtkAccelGroupEntry key;
@@ -499,14 +500,14 @@ quick_accel_add (GtkAccelGroup *accel_group,
/* insert at position, ref closure */
accel_group->priv->priv_accels = g_renew (GtkAccelGroupEntry, accel_group->priv->priv_accels, accel_group->priv->n_accels);
g_memmove (accel_group->priv->priv_accels + pos + 1, accel_group->priv->priv_accels + pos,
- (i - pos) * sizeof (accel_group->priv->priv_accels[0]));
+ (i - pos) * sizeof (accel_group->priv->priv_accels[0]));
accel_group->priv->priv_accels[pos].key.accel_key = accel_key;
accel_group->priv->priv_accels[pos].key.accel_mods = accel_mods;
accel_group->priv->priv_accels[pos].key.accel_flags = accel_flags;
accel_group->priv->priv_accels[pos].closure = g_closure_ref (closure);
accel_group->priv->priv_accels[pos].accel_path_quark = path_quark;
g_closure_sink (closure);
-
+
/* handle closure invalidation and reverse lookups */
g_closure_add_invalidate_notifier (closure, accel_group, accel_closure_invalidate);
@@ -521,18 +522,18 @@ quick_accel_add (GtkAccelGroup *accel_group,
GQuark accel_quark = g_quark_from_string (accel_name);
g_free (accel_name);
-
+
/* setup handler */
g_signal_connect_closure_by_id (accel_group, signal_accel_activate, accel_quark, closure, FALSE);
-
+
/* and notify */
g_signal_emit (accel_group, signal_accel_changed, accel_quark, accel_key, accel_mods, closure);
}
}
static void
-quick_accel_remove (GtkAccelGroup *accel_group,
- guint pos)
+quick_accel_remove (GtkAccelGroup *accel_group,
+ guint pos)
{
GQuark accel_quark = 0;
GtkAccelGroupEntry *entry = accel_group->priv->priv_accels + pos;
@@ -553,9 +554,9 @@ quick_accel_remove (GtkAccelGroup *accel_group,
g_closure_remove_invalidate_notifier (entry->closure, accel_group, accel_closure_invalidate);
if (accel_quark)
g_signal_handlers_disconnect_matched (accel_group,
- G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_CLOSURE,
- signal_accel_activate, accel_quark,
- closure, NULL, NULL);
+ G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_CLOSURE,
+ signal_accel_activate, accel_quark,
+ closure, NULL, NULL);
/* clean up accel path notification */
if (entry->accel_path_quark)
_gtk_accel_map_remove_group (g_quark_to_string (entry->accel_path_quark), accel_group);
@@ -563,7 +564,7 @@ quick_accel_remove (GtkAccelGroup *accel_group,
/* physically remove */
accel_group->priv->n_accels -= 1;
g_memmove (entry, entry + 1,
- (accel_group->priv->n_accels - pos) * sizeof (accel_group->priv->priv_accels[0]));
+ (accel_group->priv->n_accels - pos) * sizeof (accel_group->priv->priv_accels[0]));
/* and notify */
if (accel_quark)
@@ -574,10 +575,10 @@ quick_accel_remove (GtkAccelGroup *accel_group,
}
static GtkAccelGroupEntry*
-quick_accel_find (GtkAccelGroup *accel_group,
- guint accel_key,
- GdkModifierType accel_mods,
- guint *count_p)
+quick_accel_find (GtkAccelGroup *accel_group,
+ guint accel_key,
+ GdkModifierType accel_mods,
+ guint *count_p)
{
GtkAccelGroupEntry *entry;
GtkAccelGroupEntry key;
@@ -590,48 +591,48 @@ quick_accel_find (GtkAccelGroup *accel_group,
key.key.accel_key = accel_key;
key.key.accel_mods = accel_mods;
entry = bsearch (&key, accel_group->priv->priv_accels, accel_group->priv->n_accels,
- sizeof (accel_group->priv->priv_accels[0]), bsearch_compare_accels);
-
+ sizeof (accel_group->priv->priv_accels[0]), bsearch_compare_accels);
+
if (!entry)
return NULL;
/* step back to the first member */
for (; entry > accel_group->priv->priv_accels; entry--)
if (entry[-1].key.accel_key != accel_key ||
- entry[-1].key.accel_mods != accel_mods)
+ entry[-1].key.accel_mods != accel_mods)
break;
/* count equal members */
for (; entry + *count_p < accel_group->priv->priv_accels + accel_group->priv->n_accels; (*count_p)++)
if (entry[*count_p].key.accel_key != accel_key ||
- entry[*count_p].key.accel_mods != accel_mods)
+ entry[*count_p].key.accel_mods != accel_mods)
break;
return entry;
}
/**
* gtk_accel_group_connect:
- * @accel_group: the accelerator group to install an accelerator in
- * @accel_key: key value of the accelerator
- * @accel_mods: modifier combination of the accelerator
- * @accel_flags: a flag mask to configure this accelerator
- * @closure: closure to be executed upon accelerator activation
+ * @accel_group: the accelerator group to install an accelerator in
+ * @accel_key: key value of the accelerator
+ * @accel_mods: modifier combination of the accelerator
+ * @accel_flags: a flag mask to configure this accelerator
+ * @closure: closure to be executed upon accelerator activation
*
- * Installs an accelerator in this group. When @accel_group is being activated
- * in response to a call to gtk_accel_groups_activate(), @closure will be
- * invoked if the @accel_key and @accel_mods from gtk_accel_groups_activate()
- * match those of this connection.
+ * Installs an accelerator in this group. When @accel_group is being
+ * activated in response to a call to gtk_accel_groups_activate(),
+ * @closure will be invoked if the @accel_key and @accel_mods from
+ * gtk_accel_groups_activate() match those of this connection.
*
* The signature used for the @closure is that of #GtkAccelGroupActivate.
- *
- * Note that, due to implementation details, a single closure can only be
- * connected to one accelerator group.
+ *
+ * Note that, due to implementation details, a single closure can
+ * only be connected to one accelerator group.
*/
void
-gtk_accel_group_connect (GtkAccelGroup *accel_group,
- guint accel_key,
- GdkModifierType accel_mods,
- GtkAccelFlags accel_flags,
- GClosure *closure)
+gtk_accel_group_connect (GtkAccelGroup *accel_group,
+ guint accel_key,
+ GdkModifierType accel_mods,
+ GtkAccelFlags accel_flags,
+ GClosure *closure)
{
g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group));
g_return_if_fail (closure != NULL);
@@ -641,34 +642,34 @@ gtk_accel_group_connect (GtkAccelGroup *accel_group,
g_object_ref (accel_group);
if (!closure->is_invalid)
quick_accel_add (accel_group,
- gdk_keyval_to_lower (accel_key),
- accel_mods, accel_flags, closure, 0);
+ gdk_keyval_to_lower (accel_key),
+ accel_mods, accel_flags, closure, 0);
g_object_unref (accel_group);
}
/**
* gtk_accel_group_connect_by_path:
- * @accel_group: the accelerator group to install an accelerator in
- * @accel_path: path used for determining key and modifiers.
- * @closure: closure to be executed upon accelerator activation
+ * @accel_group: the accelerator group to install an accelerator in
+ * @accel_path: path used for determining key and modifiers
+ * @closure: closure to be executed upon accelerator activation
*
- * Installs an accelerator in this group, using an accelerator path to look
- * up the appropriate key and modifiers (see gtk_accel_map_add_entry()).
- * When @accel_group is being activated in response to a call to
- * gtk_accel_groups_activate(), @closure will be invoked if the @accel_key and
- * @accel_mods from gtk_accel_groups_activate() match the key and modifiers
- * for the path.
+ * Installs an accelerator in this group, using an accelerator path
+ * to look up the appropriate key and modifiers (see
+ * gtk_accel_map_add_entry()). When @accel_group is being activated
+ * in response to a call to gtk_accel_groups_activate(), @closure will
+ * be invoked if the @accel_key and @accel_mods from
+ * gtk_accel_groups_activate() match the key and modifiers for the path.
*
* The signature used for the @closure is that of #GtkAccelGroupActivate.
- *
- * Note that @accel_path string will be stored in a #GQuark. Therefore, if you
- * pass a static string, you can save some memory by interning it first with
- * g_intern_static_string().
+ *
+ * Note that @accel_path string will be stored in a #GQuark. Therefore,
+ * if you pass a static string, you can save some memory by interning it
+ * first with g_intern_static_string().
*/
void
-gtk_accel_group_connect_by_path (GtkAccelGroup *accel_group,
- const gchar *accel_path,
- GClosure *closure)
+gtk_accel_group_connect_by_path (GtkAccelGroup *accel_group,
+ const gchar *accel_path,
+ GClosure *closure)
{
guint accel_key = 0;
GdkModifierType accel_mods = 0;
@@ -690,7 +691,7 @@ gtk_accel_group_connect_by_path (GtkAccelGroup *accel_group,
}
quick_accel_add (accel_group, accel_key, accel_mods, GTK_ACCEL_VISIBLE, closure,
- g_quark_from_string (accel_path));
+ g_quark_from_string (accel_path));
g_object_unref (accel_group);
}
@@ -698,9 +699,9 @@ gtk_accel_group_connect_by_path (GtkAccelGroup *accel_group,
/**
* gtk_accel_group_disconnect:
* @accel_group: the accelerator group to remove an accelerator from
- * @closure: (allow-none): the closure to remove from this accelerator group, or %NULL
- * to remove all closures
- * @returns: %TRUE if the closure was found and got disconnected
+ * @closure: (allow-none): the closure to remove from this accelerator
+ * group, or %NULL to remove all closures
+ * @returns: %TRUE if the closure was found and got disconnected
*
* Removes an accelerator previously installed through
* gtk_accel_group_connect().
@@ -709,7 +710,7 @@ gtk_accel_group_connect_by_path (GtkAccelGroup *accel_group,
*/
gboolean
gtk_accel_group_disconnect (GtkAccelGroup *accel_group,
- GClosure *closure)
+ GClosure *closure)
{
guint i;
@@ -718,29 +719,29 @@ gtk_accel_group_disconnect (GtkAccelGroup *accel_group,
for (i = 0; i < accel_group->priv->n_accels; i++)
if (accel_group->priv->priv_accels[i].closure == closure)
{
- g_object_ref (accel_group);
- quick_accel_remove (accel_group, i);
- g_object_unref (accel_group);
- return TRUE;
+ g_object_ref (accel_group);
+ quick_accel_remove (accel_group, i);
+ g_object_unref (accel_group);
+ return TRUE;
}
return FALSE;
}
/**
* gtk_accel_group_disconnect_key:
- * @accel_group: the accelerator group to install an accelerator in
- * @accel_key: key value of the accelerator
- * @accel_mods: modifier combination of the accelerator
- * @returns: %TRUE if there was an accelerator which could be
- * removed, %FALSE otherwise
+ * @accel_group: the accelerator group to install an accelerator in
+ * @accel_key: key value of the accelerator
+ * @accel_mods: modifier combination of the accelerator
+ * @returns: %TRUE if there was an accelerator which could be
+ * removed, %FALSE otherwise
*
* Removes an accelerator previously installed through
* gtk_accel_group_connect().
*/
gboolean
-gtk_accel_group_disconnect_key (GtkAccelGroup *accel_group,
- guint accel_key,
- GdkModifierType accel_mods)
+gtk_accel_group_disconnect_key (GtkAccelGroup *accel_group,
+ guint accel_key,
+ GdkModifierType accel_mods)
{
GtkAccelGroupEntry *entries;
GSList *slist, *clist = NULL;
@@ -750,7 +751,7 @@ gtk_accel_group_disconnect_key (GtkAccelGroup *accel_group,
g_return_val_if_fail (GTK_IS_ACCEL_GROUP (accel_group), FALSE);
g_object_ref (accel_group);
-
+
accel_key = gdk_keyval_to_lower (accel_key);
entries = quick_accel_find (accel_group, accel_key, accel_mods, &n);
while (n--)
@@ -776,7 +777,7 @@ gtk_accel_group_disconnect_key (GtkAccelGroup *accel_group,
void
_gtk_accel_group_reconnect (GtkAccelGroup *accel_group,
- GQuark accel_path_quark)
+ GQuark accel_path_quark)
{
GSList *slist, *clist = NULL;
guint i;
@@ -788,9 +789,9 @@ _gtk_accel_group_reconnect (GtkAccelGroup *accel_group,
for (i = 0; i < accel_group->priv->n_accels; i++)
if (accel_group->priv->priv_accels[i].accel_path_quark == accel_path_quark)
{
- GClosure *closure = g_closure_ref (accel_group->priv->priv_accels[i].closure);
+ GClosure *closure = g_closure_ref (accel_group->priv->priv_accels[i].closure);
- clist = g_slist_prepend (clist, closure);
+ clist = g_slist_prepend (clist, closure);
}
for (slist = clist; slist; slist = slist->next)
@@ -816,23 +817,23 @@ _gtk_accel_group_get_accelerables (GtkAccelGroup *accel_group)
/**
* gtk_accel_group_query:
- * @accel_group: the accelerator group to query
- * @accel_key: key value of the accelerator
- * @accel_mods: modifier combination of the accelerator
- * @n_entries: (allow-none): location to return the number of entries found,
- * or %NULL
+ * @accel_group: the accelerator group to query
+ * @accel_key: key value of the accelerator
+ * @accel_mods: modifier combination of the accelerator
+ * @n_entries: (allow-none): location to return the number
+ * of entries found, or %NULL
* @returns: (transfer none) (array length=n_entries): an array of
- * @n_entries #GtkAccelGroupEntry elements, or %NULL. The array is
- * owned by GTK+ and must not be freed.
+ * @n_entries #GtkAccelGroupEntry elements, or %NULL. The array
+ * is owned by GTK+ and must not be freed.
*
- * Queries an accelerator group for all entries matching @accel_key and
- * @accel_mods.
+ * Queries an accelerator group for all entries matching @accel_key
+ * and @accel_mods.
*/
GtkAccelGroupEntry*
-gtk_accel_group_query (GtkAccelGroup *accel_group,
- guint accel_key,
- GdkModifierType accel_mods,
- guint *n_entries)
+gtk_accel_group_query (GtkAccelGroup *accel_group,
+ guint accel_key,
+ GdkModifierType accel_mods,
+ guint *n_entries)
{
GtkAccelGroupEntry *entries;
guint n;
@@ -851,9 +852,9 @@ gtk_accel_group_query (GtkAccelGroup *accel_group,
* gtk_accel_group_from_accel_closure:
* @closure: a #GClosure
* @returns: (transfer none): the #GtkAccelGroup to which @closure
- * is connected, or %NULL.
+ * is connected, or %NULL
*
- * Finds the #GtkAccelGroup to which @closure is connected;
+ * Finds the #GtkAccelGroup to which @closure is connected;
* see gtk_accel_group_connect().
*/
GtkAccelGroup*
@@ -863,12 +864,13 @@ gtk_accel_group_from_accel_closure (GClosure *closure)
g_return_val_if_fail (closure != NULL, NULL);
- /* a few remarks on what we do here. in general, we need a way to reverse lookup
- * accel_groups from closures that are being used in accel groups. this could
- * be done e.g via a hashtable. it is however cheaper (memory wise) to just
- * use the invalidation notifier on the closure itself (which we need to install
- * anyway), that contains the accel group as data which, besides needing to peek
- * a bit at closure internals, works just as good.
+ /* A few remarks on what we do here. in general, we need a way to
+ * reverse lookup accel_groups from closures that are being used in
+ * accel groups. this could be done e.g via a hashtable. it is however
+ * cheaper (memory wise) to just use the invalidation notifier on the
+ * closure itself (which we need to install anyway), that contains the
+ * accel group as data which, besides needing to peek a bit at closure
+ * internals, works just as good.
*/
for (i = 0; i < G_CLOSURE_N_NOTIFIERS (closure); i++)
if (closure->notifiers[i].notify == accel_closure_invalidate)
@@ -879,58 +881,59 @@ gtk_accel_group_from_accel_closure (GClosure *closure)
/**
* gtk_accel_group_activate:
- * @accel_group: a #GtkAccelGroup
- * @accel_quark: the quark for the accelerator name
+ * @accel_group: a #GtkAccelGroup
+ * @accel_quark: the quark for the accelerator name
* @acceleratable: the #GObject, usually a #GtkWindow, on which
- * to activate the accelerator.
- * @accel_key: accelerator keyval from a key event
- * @accel_mods: keyboard state mask from a key event
- *
- * Finds the first accelerator in @accel_group
- * that matches @accel_key and @accel_mods, and
- * activates it.
+ * to activate the accelerator
+ * @accel_key: accelerator keyval from a key event
+ * @accel_mods: keyboard state mask from a key event
+ *
+ * Finds the first accelerator in @accel_group that matches
+ * @accel_key and @accel_mods, and activates it.
*
- * Returns: %TRUE if an accelerator was activated and handled this keypress
+ * Returns: %TRUE if an accelerator was activated and handled
+ * this keypress
*/
gboolean
gtk_accel_group_activate (GtkAccelGroup *accel_group,
- GQuark accel_quark,
- GObject *acceleratable,
- guint accel_key,
+ GQuark accel_quark,
+ GObject *acceleratable,
+ guint accel_key,
GdkModifierType accel_mods)
{
gboolean was_handled;
g_return_val_if_fail (GTK_IS_ACCEL_GROUP (accel_group), FALSE);
g_return_val_if_fail (G_IS_OBJECT (acceleratable), FALSE);
-
+
was_handled = FALSE;
g_signal_emit (accel_group, signal_accel_activate, accel_quark,
- acceleratable, accel_key, accel_mods, &was_handled);
+ acceleratable, accel_key, accel_mods, &was_handled);
return was_handled;
}
/**
* gtk_accel_groups_activate:
- * @object: the #GObject, usually a #GtkWindow, on which
- * to activate the accelerator.
- * @accel_key: accelerator keyval from a key event
- * @accel_mods: keyboard state mask from a key event
- *
+ * @object: the #GObject, usually a #GtkWindow, on which
+ * to activate the accelerator
+ * @accel_key: accelerator keyval from a key event
+ * @accel_mods: keyboard state mask from a key event
+ *
* Finds the first accelerator in any #GtkAccelGroup attached
* to @object that matches @accel_key and @accel_mods, and
* activates that accelerator.
*
- * Returns: %TRUE if an accelerator was activated and handled this keypress
+ * Returns: %TRUE if an accelerator was activated and handled
+ * this keypress
*/
gboolean
-gtk_accel_groups_activate (GObject *object,
- guint accel_key,
- GdkModifierType accel_mods)
+gtk_accel_groups_activate (GObject *object,
+ guint accel_key,
+ GdkModifierType accel_mods)
{
g_return_val_if_fail (G_IS_OBJECT (object), FALSE);
-
+
if (gtk_accelerator_valid (accel_key, accel_mods))
{
gchar *accel_name;
@@ -940,20 +943,20 @@ gtk_accel_groups_activate (GObject *object,
accel_name = gtk_accelerator_name (accel_key, (accel_mods & gtk_accelerator_get_default_mod_mask ()));
accel_quark = g_quark_from_string (accel_name);
g_free (accel_name);
-
+
for (slist = gtk_accel_groups_from_object (object); slist; slist = slist->next)
- if (gtk_accel_group_activate (slist->data, accel_quark, object, accel_key, accel_mods))
- return TRUE;
+ if (gtk_accel_group_activate (slist->data, accel_quark, object, accel_key, accel_mods))
+ return TRUE;
}
-
+
return FALSE;
}
/**
* gtk_accelerator_valid:
- * @keyval: a GDK keyval
+ * @keyval: a GDK keyval
* @modifiers: modifier mask
- * @returns: %TRUE if the accelerator is valid
+ * @returns: %TRUE if the accelerator is valid
*
* Determines whether a given keyval and modifier mask constitute
* a valid keyboard accelerator. For example, the #GDK_KEY_a keyval
@@ -962,17 +965,19 @@ gtk_accel_groups_activate (GObject *object,
* as an accelerator.
*/
gboolean
-gtk_accelerator_valid (guint keyval,
- GdkModifierType modifiers)
+gtk_accelerator_valid (guint keyval,
+ GdkModifierType modifiers)
{
static const guint invalid_accelerator_vals[] = {
- GDK_KEY_Shift_L, GDK_KEY_Shift_R, GDK_KEY_Shift_Lock, GDK_KEY_Caps_Lock, GDK_KEY_ISO_Lock,
- GDK_KEY_Control_L, GDK_KEY_Control_R, GDK_KEY_Meta_L, GDK_KEY_Meta_R,
- GDK_KEY_Alt_L, GDK_KEY_Alt_R, GDK_KEY_Super_L, GDK_KEY_Super_R, GDK_KEY_Hyper_L, GDK_KEY_Hyper_R,
- GDK_KEY_ISO_Level3_Shift, GDK_KEY_ISO_Next_Group, GDK_KEY_ISO_Prev_Group,
+ GDK_KEY_Shift_L, GDK_KEY_Shift_R, GDK_KEY_Shift_Lock,
+ GDK_KEY_Caps_Lock, GDK_KEY_ISO_Lock, GDK_KEY_Control_L,
+ GDK_KEY_Control_R, GDK_KEY_Meta_L, GDK_KEY_Meta_R,
+ GDK_KEY_Alt_L, GDK_KEY_Alt_R, GDK_KEY_Super_L, GDK_KEY_Super_R,
+ GDK_KEY_Hyper_L, GDK_KEY_Hyper_R, GDK_KEY_ISO_Level3_Shift,
+ GDK_KEY_ISO_Next_Group, GDK_KEY_ISO_Prev_Group,
GDK_KEY_ISO_First_Group, GDK_KEY_ISO_Last_Group,
GDK_KEY_Mode_switch, GDK_KEY_Num_Lock, GDK_KEY_Multi_key,
- GDK_KEY_Scroll_Lock, GDK_KEY_Sys_Req,
+ GDK_KEY_Scroll_Lock, GDK_KEY_Sys_Req,
GDK_KEY_Tab, GDK_KEY_ISO_Left_Tab, GDK_KEY_KP_Tab,
GDK_KEY_First_Virtual_Screen, GDK_KEY_Prev_Virtual_Screen,
GDK_KEY_Next_Virtual_Screen, GDK_KEY_Last_Virtual_Screen,
@@ -987,7 +992,7 @@ gtk_accelerator_valid (guint keyval,
const guint *ac_val;
modifiers &= GDK_MODIFIER_MASK;
-
+
if (keyval <= 0xFF)
return keyval >= 0x20;
@@ -995,19 +1000,19 @@ gtk_accelerator_valid (guint keyval,
while (*ac_val)
{
if (keyval == *ac_val++)
- return FALSE;
+ return FALSE;
}
if (!modifiers)
{
ac_val = invalid_unmodified_vals;
while (*ac_val)
- {
- if (keyval == *ac_val++)
- return FALSE;
- }
+ {
+ if (keyval == *ac_val++)
+ return FALSE;
+ }
}
-
+
return TRUE;
}
@@ -1015,263 +1020,264 @@ static inline gboolean
is_alt (const gchar *string)
{
return ((string[0] == '<') &&
- (string[1] == 'a' || string[1] == 'A') &&
- (string[2] == 'l' || string[2] == 'L') &&
- (string[3] == 't' || string[3] == 'T') &&
- (string[4] == '>'));
+ (string[1] == 'a' || string[1] == 'A') &&
+ (string[2] == 'l' || string[2] == 'L') &&
+ (string[3] == 't' || string[3] == 'T') &&
+ (string[4] == '>'));
}
static inline gboolean
is_ctl (const gchar *string)
{
return ((string[0] == '<') &&
- (string[1] == 'c' || string[1] == 'C') &&
- (string[2] == 't' || string[2] == 'T') &&
- (string[3] == 'l' || string[3] == 'L') &&
- (string[4] == '>'));
+ (string[1] == 'c' || string[1] == 'C') &&
+ (string[2] == 't' || string[2] == 'T') &&
+ (string[3] == 'l' || string[3] == 'L') &&
+ (string[4] == '>'));
}
static inline gboolean
is_modx (const gchar *string)
{
return ((string[0] == '<') &&
- (string[1] == 'm' || string[1] == 'M') &&
- (string[2] == 'o' || string[2] == 'O') &&
- (string[3] == 'd' || string[3] == 'D') &&
- (string[4] >= '1' && string[4] <= '5') &&
- (string[5] == '>'));
+ (string[1] == 'm' || string[1] == 'M') &&
+ (string[2] == 'o' || string[2] == 'O') &&
+ (string[3] == 'd' || string[3] == 'D') &&
+ (string[4] >= '1' && string[4] <= '5') &&
+ (string[5] == '>'));
}
static inline gboolean
is_ctrl (const gchar *string)
{
return ((string[0] == '<') &&
- (string[1] == 'c' || string[1] == 'C') &&
- (string[2] == 't' || string[2] == 'T') &&
- (string[3] == 'r' || string[3] == 'R') &&
- (string[4] == 'l' || string[4] == 'L') &&
- (string[5] == '>'));
+ (string[1] == 'c' || string[1] == 'C') &&
+ (string[2] == 't' || string[2] == 'T') &&
+ (string[3] == 'r' || string[3] == 'R') &&
+ (string[4] == 'l' || string[4] == 'L') &&
+ (string[5] == '>'));
}
static inline gboolean
is_shft (const gchar *string)
{
return ((string[0] == '<') &&
- (string[1] == 's' || string[1] == 'S') &&
- (string[2] == 'h' || string[2] == 'H') &&
- (string[3] == 'f' || string[3] == 'F') &&
- (string[4] == 't' || string[4] == 'T') &&
- (string[5] == '>'));
+ (string[1] == 's' || string[1] == 'S') &&
+ (string[2] == 'h' || string[2] == 'H') &&
+ (string[3] == 'f' || string[3] == 'F') &&
+ (string[4] == 't' || string[4] == 'T') &&
+ (string[5] == '>'));
}
static inline gboolean
is_shift (const gchar *string)
{
return ((string[0] == '<') &&
- (string[1] == 's' || string[1] == 'S') &&
- (string[2] == 'h' || string[2] == 'H') &&
- (string[3] == 'i' || string[3] == 'I') &&
- (string[4] == 'f' || string[4] == 'F') &&
- (string[5] == 't' || string[5] == 'T') &&
- (string[6] == '>'));
+ (string[1] == 's' || string[1] == 'S') &&
+ (string[2] == 'h' || string[2] == 'H') &&
+ (string[3] == 'i' || string[3] == 'I') &&
+ (string[4] == 'f' || string[4] == 'F') &&
+ (string[5] == 't' || string[5] == 'T') &&
+ (string[6] == '>'));
}
static inline gboolean
is_control (const gchar *string)
{
return ((string[0] == '<') &&
- (string[1] == 'c' || string[1] == 'C') &&
- (string[2] == 'o' || string[2] == 'O') &&
- (string[3] == 'n' || string[3] == 'N') &&
- (string[4] == 't' || string[4] == 'T') &&
- (string[5] == 'r' || string[5] == 'R') &&
- (string[6] == 'o' || string[6] == 'O') &&
- (string[7] == 'l' || string[7] == 'L') &&
- (string[8] == '>'));
+ (string[1] == 'c' || string[1] == 'C') &&
+ (string[2] == 'o' || string[2] == 'O') &&
+ (string[3] == 'n' || string[3] == 'N') &&
+ (string[4] == 't' || string[4] == 'T') &&
+ (string[5] == 'r' || string[5] == 'R') &&
+ (string[6] == 'o' || string[6] == 'O') &&
+ (string[7] == 'l' || string[7] == 'L') &&
+ (string[8] == '>'));
}
static inline gboolean
is_release (const gchar *string)
{
return ((string[0] == '<') &&
- (string[1] == 'r' || string[1] == 'R') &&
- (string[2] == 'e' || string[2] == 'E') &&
- (string[3] == 'l' || string[3] == 'L') &&
- (string[4] == 'e' || string[4] == 'E') &&
- (string[5] == 'a' || string[5] == 'A') &&
- (string[6] == 's' || string[6] == 'S') &&
- (string[7] == 'e' || string[7] == 'E') &&
- (string[8] == '>'));
+ (string[1] == 'r' || string[1] == 'R') &&
+ (string[2] == 'e' || string[2] == 'E') &&
+ (string[3] == 'l' || string[3] == 'L') &&
+ (string[4] == 'e' || string[4] == 'E') &&
+ (string[5] == 'a' || string[5] == 'A') &&
+ (string[6] == 's' || string[6] == 'S') &&
+ (string[7] == 'e' || string[7] == 'E') &&
+ (string[8] == '>'));
}
static inline gboolean
is_meta (const gchar *string)
{
return ((string[0] == '<') &&
- (string[1] == 'm' || string[1] == 'M') &&
- (string[2] == 'e' || string[2] == 'E') &&
- (string[3] == 't' || string[3] == 'T') &&
- (string[4] == 'a' || string[4] == 'A') &&
- (string[5] == '>'));
+ (string[1] == 'm' || string[1] == 'M') &&
+ (string[2] == 'e' || string[2] == 'E') &&
+ (string[3] == 't' || string[3] == 'T') &&
+ (string[4] == 'a' || string[4] == 'A') &&
+ (string[5] == '>'));
}
static inline gboolean
is_super (const gchar *string)
{
return ((string[0] == '<') &&
- (string[1] == 's' || string[1] == 'S') &&
- (string[2] == 'u' || string[2] == 'U') &&
- (string[3] == 'p' || string[3] == 'P') &&
- (string[4] == 'e' || string[4] == 'E') &&
- (string[5] == 'r' || string[5] == 'R') &&
- (string[6] == '>'));
+ (string[1] == 's' || string[1] == 'S') &&
+ (string[2] == 'u' || string[2] == 'U') &&
+ (string[3] == 'p' || string[3] == 'P') &&
+ (string[4] == 'e' || string[4] == 'E') &&
+ (string[5] == 'r' || string[5] == 'R') &&
+ (string[6] == '>'));
}
static inline gboolean
is_hyper (const gchar *string)
{
return ((string[0] == '<') &&
- (string[1] == 'h' || string[1] == 'H') &&
- (string[2] == 'y' || string[2] == 'Y') &&
- (string[3] == 'p' || string[3] == 'P') &&
- (string[4] == 'e' || string[4] == 'E') &&
- (string[5] == 'r' || string[5] == 'R') &&
- (string[6] == '>'));
+ (string[1] == 'h' || string[1] == 'H') &&
+ (string[2] == 'y' || string[2] == 'Y') &&
+ (string[3] == 'p' || string[3] == 'P') &&
+ (string[4] == 'e' || string[4] == 'E') &&
+ (string[5] == 'r' || string[5] == 'R') &&
+ (string[6] == '>'));
}
/**
* gtk_accelerator_parse:
- * @accelerator: string representing an accelerator
- * @accelerator_key: (out): return location for accelerator keyval
+ * @accelerator: string representing an accelerator
+ * @accelerator_key: (out): return location for accelerator keyval
* @accelerator_mods: (out): return location for accelerator modifier mask
*
* Parses a string representing an accelerator. The
- * format looks like "<Control>a" or "<Shift><Alt>F1" or
- * "<Release>z" (the last one is for key release).
+ * format looks like "<Control>a" or "<Shift><Alt>F1"
+ * or "<Release>z" (the last one is for key release).
+ *
* The parser is fairly liberal and allows lower or upper case,
* and also abbreviations such as "<Ctl>" and "<Ctrl>".
- * Key names are parsed using gdk_keyval_from_name(). For character keys the
- * name is not the symbol, but the lowercase name, e.g. one would use
- * "<Ctrl>minus" instead of "<Ctrl>-".
+ * Key names are parsed using gdk_keyval_from_name(). For character
+ * keys the name is not the symbol, but the lowercase name, e.g. one
+ * would use "<Ctrl>minus" instead of "<Ctrl>-".
*
* If the parse fails, @accelerator_key and @accelerator_mods will
* be set to 0 (zero).
*/
void
gtk_accelerator_parse (const gchar *accelerator,
- guint *accelerator_key,
- GdkModifierType *accelerator_mods)
+ guint *accelerator_key,
+ GdkModifierType *accelerator_mods)
{
guint keyval;
GdkModifierType mods;
gint len;
-
+
if (accelerator_key)
*accelerator_key = 0;
if (accelerator_mods)
*accelerator_mods = 0;
g_return_if_fail (accelerator != NULL);
-
+
keyval = 0;
mods = 0;
len = strlen (accelerator);
while (len)
{
if (*accelerator == '<')
- {
- if (len >= 9 && is_release (accelerator))
- {
- accelerator += 9;
- len -= 9;
- mods |= GDK_RELEASE_MASK;
- }
- else if (len >= 9 && is_control (accelerator))
- {
- accelerator += 9;
- len -= 9;
- mods |= GDK_CONTROL_MASK;
- }
- else if (len >= 7 && is_shift (accelerator))
- {
- accelerator += 7;
- len -= 7;
- mods |= GDK_SHIFT_MASK;
- }
- else if (len >= 6 && is_shft (accelerator))
- {
- accelerator += 6;
- len -= 6;
- mods |= GDK_SHIFT_MASK;
- }
- else if (len >= 6 && is_ctrl (accelerator))
- {
- accelerator += 6;
- len -= 6;
- mods |= GDK_CONTROL_MASK;
- }
- else if (len >= 6 && is_modx (accelerator))
- {
- static const guint mod_vals[] = {
- GDK_MOD1_MASK, GDK_MOD2_MASK, GDK_MOD3_MASK,
- GDK_MOD4_MASK, GDK_MOD5_MASK
- };
-
- len -= 6;
- accelerator += 4;
- mods |= mod_vals[*accelerator - '1'];
- accelerator += 2;
- }
- else if (len >= 5 && is_ctl (accelerator))
- {
- accelerator += 5;
- len -= 5;
- mods |= GDK_CONTROL_MASK;
- }
- else if (len >= 5 && is_alt (accelerator))
- {
- accelerator += 5;
- len -= 5;
- mods |= GDK_MOD1_MASK;
- }
+ {
+ if (len >= 9 && is_release (accelerator))
+ {
+ accelerator += 9;
+ len -= 9;
+ mods |= GDK_RELEASE_MASK;
+ }
+ else if (len >= 9 && is_control (accelerator))
+ {
+ accelerator += 9;
+ len -= 9;
+ mods |= GDK_CONTROL_MASK;
+ }
+ else if (len >= 7 && is_shift (accelerator))
+ {
+ accelerator += 7;
+ len -= 7;
+ mods |= GDK_SHIFT_MASK;
+ }
+ else if (len >= 6 && is_shft (accelerator))
+ {
+ accelerator += 6;
+ len -= 6;
+ mods |= GDK_SHIFT_MASK;
+ }
+ else if (len >= 6 && is_ctrl (accelerator))
+ {
+ accelerator += 6;
+ len -= 6;
+ mods |= GDK_CONTROL_MASK;
+ }
+ else if (len >= 6 && is_modx (accelerator))
+ {
+ static const guint mod_vals[] = {
+ GDK_MOD1_MASK, GDK_MOD2_MASK, GDK_MOD3_MASK,
+ GDK_MOD4_MASK, GDK_MOD5_MASK
+ };
+
+ len -= 6;
+ accelerator += 4;
+ mods |= mod_vals[*accelerator - '1'];
+ accelerator += 2;
+ }
+ else if (len >= 5 && is_ctl (accelerator))
+ {
+ accelerator += 5;
+ len -= 5;
+ mods |= GDK_CONTROL_MASK;
+ }
+ else if (len >= 5 && is_alt (accelerator))
+ {
+ accelerator += 5;
+ len -= 5;
+ mods |= GDK_MOD1_MASK;
+ }
else if (len >= 6 && is_meta (accelerator))
- {
- accelerator += 6;
- len -= 6;
- mods |= GDK_META_MASK;
- }
+ {
+ accelerator += 6;
+ len -= 6;
+ mods |= GDK_META_MASK;
+ }
else if (len >= 7 && is_hyper (accelerator))
- {
- accelerator += 7;
- len -= 7;
- mods |= GDK_HYPER_MASK;
- }
+ {
+ accelerator += 7;
+ len -= 7;
+ mods |= GDK_HYPER_MASK;
+ }
else if (len >= 7 && is_super (accelerator))
- {
- accelerator += 7;
- len -= 7;
- mods |= GDK_SUPER_MASK;
- }
- else
- {
- gchar last_ch;
-
- last_ch = *accelerator;
- while (last_ch && last_ch != '>')
- {
- last_ch = *accelerator;
- accelerator += 1;
- len -= 1;
- }
- }
- }
+ {
+ accelerator += 7;
+ len -= 7;
+ mods |= GDK_SUPER_MASK;
+ }
+ else
+ {
+ gchar last_ch;
+
+ last_ch = *accelerator;
+ while (last_ch && last_ch != '>')
+ {
+ last_ch = *accelerator;
+ accelerator += 1;
+ len -= 1;
+ }
+ }
+ }
else
- {
- keyval = gdk_keyval_from_name (accelerator);
- accelerator += len;
- len -= len;
- }
+ {
+ keyval = gdk_keyval_from_name (accelerator);
+ accelerator += len;
+ len -= len;
+ }
}
-
+
if (accelerator_key)
*accelerator_key = gdk_keyval_to_lower (keyval);
if (accelerator_mods)
@@ -1280,7 +1286,7 @@ gtk_accelerator_parse (const gchar *accelerator,
/**
* gtk_accelerator_name:
- * @accelerator_key: accelerator keyval
+ * @accelerator_key: accelerator keyval
* @accelerator_mods: accelerator modifier mask
*
* Converts an accelerator keyval and modifier mask
@@ -1295,7 +1301,7 @@ gtk_accelerator_parse (const gchar *accelerator,
*/
gchar*
gtk_accelerator_name (guint accelerator_key,
- GdkModifierType accelerator_mods)
+ GdkModifierType accelerator_mods)
{
static const gchar text_release[] = "<Release>";
static const gchar text_shift[] = "<Shift>";
@@ -1409,11 +1415,11 @@ gtk_accelerator_name (guint accelerator_key,
/**
* gtk_accelerator_get_label:
- * @accelerator_key: accelerator keyval
+ * @accelerator_key: accelerator keyval
* @accelerator_mods: accelerator modifier mask
- *
- * Converts an accelerator keyval and modifier mask into a string
- * which can be used to represent the accelerator to the user.
+ *
+ * Converts an accelerator keyval and modifier mask into a string
+ * which can be used to represent the accelerator to the user.
*
* Returns: a newly-allocated string representing the accelerator.
*
@@ -1421,19 +1427,19 @@ gtk_accelerator_name (guint accelerator_key,
*/
gchar*
gtk_accelerator_get_label (guint accelerator_key,
- GdkModifierType accelerator_mods)
+ GdkModifierType accelerator_mods)
{
GtkAccelLabelClass *klass;
gchar *label;
klass = g_type_class_ref (GTK_TYPE_ACCEL_LABEL);
- label = _gtk_accel_label_class_get_accelerator_label (klass,
- accelerator_key,
- accelerator_mods);
+ label = _gtk_accel_label_class_get_accelerator_label (klass,
+ accelerator_key,
+ accelerator_mods);
g_type_class_unref (klass); /* klass is kept alive since gtk uses static types */
return label;
-}
+}
/**
* gtk_accelerator_set_default_mod_mask:
@@ -1441,9 +1447,9 @@ gtk_accelerator_get_label (guint accelerator_key,
*
* Sets the modifiers that will be considered significant for keyboard
* accelerators. The default mod mask is #GDK_CONTROL_MASK |
- * #GDK_SHIFT_MASK | #GDK_MOD1_MASK | #GDK_SUPER_MASK |
- * #GDK_HYPER_MASK | #GDK_META_MASK, that is, Control, Shift, Alt,
- * Super, Hyper and Meta. Other modifiers will by default be ignored
+ * #GDK_SHIFT_MASK | #GDK_MOD1_MASK | #GDK_SUPER_MASK |
+ * #GDK_HYPER_MASK | #GDK_META_MASK, that is, Control, Shift, Alt,
+ * Super, Hyper and Meta. Other modifiers will by default be ignored
* by #GtkAccelGroup.
* You must include at least the three modifiers Control, Shift
* and Alt in any value you pass to this function.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]