gtk_accelerator_table_modifier_mask() proposal




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




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]