[902] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] gtk_accelerator_table_modifier_mask() proposal

daemon@ATHENA.MIT.EDU (Tim Janik)
Fri Sep 5 01:42:28 1997

From: Tim Janik <Tim.Janik@Hamburg.Netsurf.DE>
Date: Fri, 5 Sep 1997 07:46:19 +0200 (CEST)
To: gtk-list@redhat.com
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com


hi,

i'd like to propose the implementation of

void gtk_accelerator_table_modifier_mask (GtkAcceleratorTable *table,
				          guint8               modifier_mask);


if an accelerator for e.g. a menu item is bound to
accelerator_key=133  (<- 'q')
accelerator_mods=8   (<- GDK_MOD1_MASK i.e. <Alt>)

it can be invoked by pressing <Alt>-Q and then e.g. quit an application.
i just spend several hours to track down a "bug" because gubi only exited
on <Alt>-Q after i "reinstalled" the accelerator on the selected menu item
by pressing <Alt>-Q.

finaly i found out i had num-lock turned on all the time (harglfn!).
this caused
accelerator_mods=24  (<- GDK_MOD1_MASK | GDK_MOD2_MASK)

stupid me...

if we put add a general mask for the modifiers to each GtkAcceleratorTable
and use it in gtk_accelerator_table_check() to mask out any unneeded
modifiers, <Alt>-Q and else stuff will work regardless of num-lock,
shift-lock and else disturbances.

  struct _GtkAcceleratorTable
  {
    GList *entries[256];
+   guint8 modifier_mask;
    gint ref_count;
  };

+ void gtk_accelerator_table_modifier_mask (GtkAcceleratorTable *table,
+                                           guint8               modifier_mask);


i'm not to sure about the modifier_mask being located in each
GtkAcceleratorTable, may be this should be a static variable in
gtkaccelerator.c?

comments, suggestions?

i'll post a patch within 2 or 3 days to the list for one of the solutions
if nobody contradicts.


---
ciaoTJ


--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post