Re: gtk_window_get_accel_group()



Tim Janik <timj@gtk.org> writes:

> 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).

The question is not whether we should allow more than one
accel group per window. Sure, that is sometimes necessary.

But there is often _one_ accel group that corresponds exactly
to the window. The question is whether we should add
some convenience functionality to make it easier to manage
that accel group.

Regards,
                                        Owen




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