Re: gtk_window_get_accel_group()



On 27 Jun 2000, Havoc Pennington wrote:

> 
> Hi,
> 
> Why not add an "accel_group" field to GtkWindow and then provide:
> 
> GtkAccelGroup*
> gtk_window_get_accel_group (GtkWindow *window)
> {
>   /* Lazily create it */
>   if (window->accel_group == NULL)
>     {
>       window->accel_group = gtk_accel_group_new ();
>       gtk_window_add_accel_group (window->accel_group);
>     }
> 
>   return window->accel_group;
> }

there's no such a thing as the _one_ accelerator group for
a window. things like menus (menu bars, popups) come with
accelerator groups, or a set of buttons that you want to
activate with keys. depending on which windows these are
used in, their accelerator groups have to be added to those
windows.

using one accelerator group per window would provide quite some
clashes, imagine two windows in an application that share a
popup menu:
{ "Select All         <C-P>",
  "Invert Selection   <C-I>",
  "Select None      <S-C-N>" }
but have their own "Dismiss" buttons with <C-D> or menu bars
with different items.
within a window, accelerator propagation has to be done for
the window's menu (or the "Dismiss" button) bar and the popup,
and upon accelerator changes, clashes have to be resolved per
window.
so window one has e.g. "Undo Operation <C-Z>" and window2
has "Zero Region <C-Z>" in their menu bars.
with one accelertor group per window, you could use <C-Z>
(or <C-D> for the button) for either of them but not both.
that would be essentilly _one_ accelerator assignment space
per window group that share accelertors for some reason (such
as a common popup).

>  
> Havoc
> 

---
ciaoTJ





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