Re: Problems with underlined accelerator keys
- From: Damon Chaplin <damon karuna freeserve co uk>
- To: gtk-devel-list redhat com
- Subject: Re: Problems with underlined accelerator keys
- Date: Wed, 08 Sep 1999 12:56:38 +0100
Here is the patch which adds the option to skip particular accelerators
when the object to emit the signal on is not mapped & visible.
Using this it is possible to use conflicting underlined keys on different
notebook pages. e.g. You can use '_Top' on one page and '_Title' on another
and both will work OK. All you need to do is use a separate GtkAccelGroup
for each notebook page.
It seems to work (though I'm not an expert on mapped/visibility issues).
It shouldn't affect existing code.
There is one slight problem - the GtkEntry & GtkText widgets have bindings
set up for Alt+B, Alt+D and Alt+F, which overrides any underlined accelerator key.
I think these bindings will have to be removed if we want to support underlined
accelerator keys. Alt+F is always used for the '_File' menu, so that is causing
problems already.
Damon
This is against GTK+ 1.2.3.
--- gtkaccelgroup.h.orig Wed Feb 24 10:14:56 1999
+++ gtkaccelgroup.h Wed Sep 8 11:54:52 1999
@@ -58,7 +58,11 @@
* again?
*/
GTK_ACCEL_LOCKED = 1 << 2,
- GTK_ACCEL_MASK = 0x07
+
+ /* Only emits the signal if the object receiving it is mapped & visible. */
+ GTK_ACCEL_EMIT_ONLY_WHEN_OBJECT_VISIBLE = 1 << 3,
+
+ GTK_ACCEL_MASK = 0x0F
} GtkAccelFlags;
struct _GtkAccelGroup
--- gtkaccelgroup.c.orig Tue Apr 13 21:20:08 1999
+++ gtkaccelgroup.c Wed Sep 8 12:29:40 1999
@@ -262,8 +262,12 @@
g_return_val_if_fail (accel_group != NULL, FALSE);
entry = gtk_accel_group_lookup (accel_group, accel_key, accel_mods);
- if (entry && entry->signal_id &&
- (!GTK_IS_WIDGET (entry->object) || GTK_WIDGET_IS_SENSITIVE (entry->object
)))
+ if (entry && entry->signal_id
+ && (!GTK_IS_WIDGET (entry->object)
+ || GTK_WIDGET_IS_SENSITIVE (entry->object))
+ && (!(entry->accel_flags & GTK_ACCEL_EMIT_ONLY_WHEN_OBJECT_VISIBLE)
+ || (GTK_WIDGET_MAPPED (entry->object)
+ && GTK_WIDGET_VISIBLE (entry->object))))
{
gtk_signal_emit (entry->object, entry->signal_id);
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]