Export private _gtk_menu_shell_activate() to encapsulate cut-and-paste

Sat Apr  6 06:57:00 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkmenushell.[ch] gtk/gtkmenuitem.c: Export
        private _gtk_menu_shell_activate() to encapsulate
        cut-and-paste code.

        * gtk/gtkmenubar.c: Select the first item on the menu bar
        for F10 rather than acting as if the user pressed <Alt>F
        to select the file manager.
This commit is contained in:
Owen Taylor
2002-04-11 14:28:11 +00:00
committed by Owen Taylor
parent 631b8da93e
commit 03498ba24f
10 changed files with 80 additions and 19 deletions

View File

@ -1,3 +1,13 @@
Sat Apr 6 06:57:00 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.[ch] gtk/gtkmenuitem.c: Export
private _gtk_menu_shell_activate() to encapsulate
cut-and-paste code.
* gtk/gtkmenubar.c: Select the first item on the menu bar
for F10 rather than acting as if the user pressed <Alt>F
to select the file manager.
Tue Apr 9 19:01:28 2002 Owen Taylor <otaylor@redhat.com> Tue Apr 9 19:01:28 2002 Owen Taylor <otaylor@redhat.com>
Fix problems with HandleBox and focusing - #78232 Fix problems with HandleBox and focusing - #78232

View File

@ -1,3 +1,13 @@
Sat Apr 6 06:57:00 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.[ch] gtk/gtkmenuitem.c: Export
private _gtk_menu_shell_activate() to encapsulate
cut-and-paste code.
* gtk/gtkmenubar.c: Select the first item on the menu bar
for F10 rather than acting as if the user pressed <Alt>F
to select the file manager.
Tue Apr 9 19:01:28 2002 Owen Taylor <otaylor@redhat.com> Tue Apr 9 19:01:28 2002 Owen Taylor <otaylor@redhat.com>
Fix problems with HandleBox and focusing - #78232 Fix problems with HandleBox and focusing - #78232

View File

@ -1,3 +1,13 @@
Sat Apr 6 06:57:00 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.[ch] gtk/gtkmenuitem.c: Export
private _gtk_menu_shell_activate() to encapsulate
cut-and-paste code.
* gtk/gtkmenubar.c: Select the first item on the menu bar
for F10 rather than acting as if the user pressed <Alt>F
to select the file manager.
Tue Apr 9 19:01:28 2002 Owen Taylor <otaylor@redhat.com> Tue Apr 9 19:01:28 2002 Owen Taylor <otaylor@redhat.com>
Fix problems with HandleBox and focusing - #78232 Fix problems with HandleBox and focusing - #78232

View File

@ -1,3 +1,13 @@
Sat Apr 6 06:57:00 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.[ch] gtk/gtkmenuitem.c: Export
private _gtk_menu_shell_activate() to encapsulate
cut-and-paste code.
* gtk/gtkmenubar.c: Select the first item on the menu bar
for F10 rather than acting as if the user pressed <Alt>F
to select the file manager.
Tue Apr 9 19:01:28 2002 Owen Taylor <otaylor@redhat.com> Tue Apr 9 19:01:28 2002 Owen Taylor <otaylor@redhat.com>
Fix problems with HandleBox and focusing - #78232 Fix problems with HandleBox and focusing - #78232

View File

@ -1,3 +1,13 @@
Sat Apr 6 06:57:00 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.[ch] gtk/gtkmenuitem.c: Export
private _gtk_menu_shell_activate() to encapsulate
cut-and-paste code.
* gtk/gtkmenubar.c: Select the first item on the menu bar
for F10 rather than acting as if the user pressed <Alt>F
to select the file manager.
Tue Apr 9 19:01:28 2002 Owen Taylor <otaylor@redhat.com> Tue Apr 9 19:01:28 2002 Owen Taylor <otaylor@redhat.com>
Fix problems with HandleBox and focusing - #78232 Fix problems with HandleBox and focusing - #78232

View File

@ -1,3 +1,13 @@
Sat Apr 6 06:57:00 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.[ch] gtk/gtkmenuitem.c: Export
private _gtk_menu_shell_activate() to encapsulate
cut-and-paste code.
* gtk/gtkmenubar.c: Select the first item on the menu bar
for F10 rather than acting as if the user pressed <Alt>F
to select the file manager.
Tue Apr 9 19:01:28 2002 Owen Taylor <otaylor@redhat.com> Tue Apr 9 19:01:28 2002 Owen Taylor <otaylor@redhat.com>
Fix problems with HandleBox and focusing - #78232 Fix problems with HandleBox and focusing - #78232

View File

@ -416,16 +416,14 @@ window_key_press_handler (GtkWidget *widget,
GTK_DIR_TAB_FORWARD, NULL); GTK_DIR_TAB_FORWARD, NULL);
if (menubars) if (menubars)
{ {
GtkMenuShell *menushell = GTK_MENU_SHELL (menubars->data); GtkMenuShell *menu_shell = GTK_MENU_SHELL (menubars->data);
if (menushell->children) _gtk_menu_shell_activate (menu_shell);
{ _gtk_menu_shell_select_first (menu_shell);
gtk_signal_emit_by_name (GTK_OBJECT (menushell->children->data),
"activate_item");
retval = TRUE;
}
g_list_free (menubars); g_list_free (menubars);
retval = TRUE;
} }
} }

View File

@ -779,12 +779,7 @@ gtk_real_menu_item_activate_item (GtkMenuItem *menu_item)
{ {
GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget->parent); GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget->parent);
if (!menu_shell->active) _gtk_menu_shell_activate (menu_shell);
{
gtk_grab_add (GTK_WIDGET (menu_shell));
menu_shell->have_grab = TRUE;
menu_shell->active = TRUE;
}
gtk_menu_shell_select_item (GTK_MENU_SHELL (widget->parent), widget); gtk_menu_shell_select_item (GTK_MENU_SHELL (widget->parent), widget);
gtk_menu_item_popup_submenu (widget); gtk_menu_item_popup_submenu (widget);

View File

@ -440,6 +440,17 @@ gtk_menu_shell_realize (GtkWidget *widget)
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
} }
void
_gtk_menu_shell_activate (GtkMenuShell *menu_shell)
{
if (!menu_shell->active)
{
gtk_grab_add (GTK_WIDGET (menu_shell));
menu_shell->have_grab = TRUE;
menu_shell->active = TRUE;
}
}
static gint static gint
gtk_menu_shell_button_press (GtkWidget *widget, gtk_menu_shell_button_press (GtkWidget *widget,
GdkEventButton *event) GdkEventButton *event)
@ -461,12 +472,8 @@ gtk_menu_shell_button_press (GtkWidget *widget,
} }
else if (!menu_shell->active || !menu_shell->button) else if (!menu_shell->active || !menu_shell->button)
{ {
if (!menu_shell->active) _gtk_menu_shell_activate (menu_shell);
{
gtk_grab_add (GTK_WIDGET (widget));
menu_shell->have_grab = TRUE;
menu_shell->active = TRUE;
}
menu_shell->button = event->button; menu_shell->button = event->button;
menu_item = gtk_menu_shell_get_item (menu_shell, (GdkEvent *)event); menu_item = gtk_menu_shell_get_item (menu_shell, (GdkEvent *)event);

View File

@ -112,6 +112,7 @@ void gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
gboolean force_deactivate); gboolean force_deactivate);
void _gtk_menu_shell_select_first (GtkMenuShell *menu_shell); void _gtk_menu_shell_select_first (GtkMenuShell *menu_shell);
void _gtk_menu_shell_activate (GtkMenuShell *menu_shell);
#ifdef __cplusplus #ifdef __cplusplus
} }