Commit 8627dbda authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Back out changes to propagate keys to parent menu shells, since that broke

Sun Mar  3 17:03:30 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkmenushell.c gtk/gtkmenubar.[ch]: Back out
        changes to propagate keys to parent menu shells, since
        that broke stuff; rather implement ::cycle-focus as
        a key binding on GtkMenuShell rather than on GtkMenuBar.

        * gtk/gtkmenushell.c (gtk_menu_shell_class_init): Add
        add bindings for ::cycle-focus. (In gtkmenubar.c, were
        mistakently bound to ::move-focus.)
parent d9f81213
Sun Mar 3 17:03:30 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.c gtk/gtkmenubar.[ch]: Back out
changes to propagate keys to parent menu shells, since
that broke stuff; rather implement ::cycle-focus as
a key binding on GtkMenuShell rather than on GtkMenuBar.
* gtk/gtkmenushell.c (gtk_menu_shell_class_init): Add
add bindings for ::cycle-focus. (In gtkmenubar.c, were
mistakently bound to ::move-focus.)
2002-03-03 Tor Lillqvist <tml@iki.fi>
* README.win32: Minor edits.
......
Sun Mar 3 17:03:30 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.c gtk/gtkmenubar.[ch]: Back out
changes to propagate keys to parent menu shells, since
that broke stuff; rather implement ::cycle-focus as
a key binding on GtkMenuShell rather than on GtkMenuBar.
* gtk/gtkmenushell.c (gtk_menu_shell_class_init): Add
add bindings for ::cycle-focus. (In gtkmenubar.c, were
mistakently bound to ::move-focus.)
2002-03-03 Tor Lillqvist <tml@iki.fi>
* README.win32: Minor edits.
......
Sun Mar 3 17:03:30 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.c gtk/gtkmenubar.[ch]: Back out
changes to propagate keys to parent menu shells, since
that broke stuff; rather implement ::cycle-focus as
a key binding on GtkMenuShell rather than on GtkMenuBar.
* gtk/gtkmenushell.c (gtk_menu_shell_class_init): Add
add bindings for ::cycle-focus. (In gtkmenubar.c, were
mistakently bound to ::move-focus.)
2002-03-03 Tor Lillqvist <tml@iki.fi>
* README.win32: Minor edits.
......
Sun Mar 3 17:03:30 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.c gtk/gtkmenubar.[ch]: Back out
changes to propagate keys to parent menu shells, since
that broke stuff; rather implement ::cycle-focus as
a key binding on GtkMenuShell rather than on GtkMenuBar.
* gtk/gtkmenushell.c (gtk_menu_shell_class_init): Add
add bindings for ::cycle-focus. (In gtkmenubar.c, were
mistakently bound to ::move-focus.)
2002-03-03 Tor Lillqvist <tml@iki.fi>
* README.win32: Minor edits.
......
Sun Mar 3 17:03:30 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.c gtk/gtkmenubar.[ch]: Back out
changes to propagate keys to parent menu shells, since
that broke stuff; rather implement ::cycle-focus as
a key binding on GtkMenuShell rather than on GtkMenuBar.
* gtk/gtkmenushell.c (gtk_menu_shell_class_init): Add
add bindings for ::cycle-focus. (In gtkmenubar.c, were
mistakently bound to ::move-focus.)
2002-03-03 Tor Lillqvist <tml@iki.fi>
* README.win32: Minor edits.
......
Sun Mar 3 17:03:30 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.c gtk/gtkmenubar.[ch]: Back out
changes to propagate keys to parent menu shells, since
that broke stuff; rather implement ::cycle-focus as
a key binding on GtkMenuShell rather than on GtkMenuBar.
* gtk/gtkmenushell.c (gtk_menu_shell_class_init): Add
add bindings for ::cycle-focus. (In gtkmenubar.c, were
mistakently bound to ::move-focus.)
2002-03-03 Tor Lillqvist <tml@iki.fi>
* README.win32: Minor edits.
......
Sun Mar 3 17:03:30 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkmenushell.c gtk/gtkmenubar.[ch]: Back out
changes to propagate keys to parent menu shells, since
that broke stuff; rather implement ::cycle-focus as
a key binding on GtkMenuShell rather than on GtkMenuBar.
* gtk/gtkmenushell.c (gtk_menu_shell_class_init): Add
add bindings for ::cycle-focus. (In gtkmenubar.c, were
mistakently bound to ::move-focus.)
2002-03-03 Tor Lillqvist <tml@iki.fi>
* README.win32: Minor edits.
......
......@@ -53,17 +53,8 @@ static gint gtk_menu_bar_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_menu_bar_hierarchy_changed (GtkWidget *widget,
GtkWidget *old_toplevel);
static void gtk_menu_bar_cycle_focus (GtkMenuBar *menubar,
GtkDirectionType dir);
static GtkShadowType get_shadow_type (GtkMenuBar *menubar);
enum {
CYCLE_FOCUS,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
static GtkMenuShellClass *parent_class = NULL;
GtkType
......@@ -91,35 +82,6 @@ gtk_menu_bar_get_type (void)
return menu_bar_type;
}
static guint
binding_signal_new (const gchar *signal_name,
GType itype,
GSignalFlags signal_flags,
GCallback handler,
GSignalAccumulator accumulator,
gpointer accu_data,
GSignalCMarshaller c_marshaller,
GType return_type,
guint n_params,
...)
{
va_list args;
guint signal_id;
g_return_val_if_fail (signal_name != NULL, 0);
va_start (args, n_params);
signal_id = g_signal_new_valist (signal_name, itype, signal_flags,
g_cclosure_new (handler, NULL, NULL),
accumulator, accu_data, c_marshaller,
return_type, n_params, args);
va_end (args);
return signal_id;
}
static void
gtk_menu_bar_class_init (GtkMenuBarClass *class)
{
......@@ -142,16 +104,6 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class)
menu_shell_class->submenu_placement = GTK_TOP_BOTTOM;
signals[CYCLE_FOCUS] =
binding_signal_new ("cycle_focus",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST | GTK_RUN_ACTION,
G_CALLBACK (gtk_menu_bar_cycle_focus),
NULL, NULL,
_gtk_marshal_VOID__ENUM,
GTK_TYPE_NONE, 1,
GTK_TYPE_DIRECTION_TYPE);
binding_set = gtk_binding_set_by_class (class);
gtk_binding_entry_add_signal (binding_set,
GDK_Left, 0,
......@@ -193,22 +145,6 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class)
"move_current", 1,
GTK_TYPE_MENU_DIRECTION_TYPE,
GTK_MENU_DIR_CHILD);
gtk_binding_entry_add_signal (binding_set,
GDK_Tab, GDK_CONTROL_MASK,
"move_focus", 1,
GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_FORWARD);
gtk_binding_entry_add_signal (binding_set,
GDK_KP_Tab, GDK_CONTROL_MASK,
"move_focus", 1,
GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_FORWARD);
gtk_binding_entry_add_signal (binding_set,
GDK_Tab, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
"move_focus", 1,
GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_BACKWARD);
gtk_binding_entry_add_signal (binding_set,
GDK_KP_Tab, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
"move_focus", 1,
GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_BACKWARD);
gtk_widget_class_install_style_property (widget_class,
g_param_spec_enum ("shadow_type",
......@@ -555,9 +491,16 @@ gtk_menu_bar_hierarchy_changed (GtkWidget *widget,
add_to_window (GTK_WINDOW (toplevel), menubar);
}
static void
gtk_menu_bar_cycle_focus (GtkMenuBar *menubar,
GtkDirectionType dir)
/**
* _gtk_menu_bar_cycle_focus:
* @menubar: a #GtkMenuBar
* @dir: direction in which to cycle the focus
*
* Move the focus between menubars in the toplevel.
**/
void
_gtk_menu_bar_cycle_focus (GtkMenuBar *menubar,
GtkDirectionType dir)
{
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (menubar));
......
......@@ -74,6 +74,10 @@ GtkWidget* gtk_menu_bar_new (void);
#define gtk_menu_bar_insert(menu,child,pos) gtk_menu_shell_insert ((GtkMenuShell *)(menu),(child),(pos))
#endif /* GTK_DISABLE_DEPRECATED */
/* Private functions */
void _gtk_menu_bar_cycle_focus (GtkMenuBar *menubar,
GtkDirectionType dir);
#ifdef __cplusplus
}
#endif /* __cplusplus */
......
......@@ -30,6 +30,7 @@
#include "gtkbindings.h"
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtkmenubar.h"
#include "gtkmenuitem.h"
#include "gtkmenushell.h"
#include "gtksignal.h"
......@@ -44,6 +45,7 @@ enum {
MOVE_CURRENT,
ACTIVATE_CURRENT,
CANCEL,
CYCLE_FOCUS,
LAST_SIGNAL
};
......@@ -148,6 +150,8 @@ static void gtk_real_menu_shell_move_current (GtkMenuShell *menu_shell,
static void gtk_real_menu_shell_activate_current (GtkMenuShell *menu_shell,
gboolean force_hide);
static void gtk_real_menu_shell_cancel (GtkMenuShell *menu_shell);
static void gtk_real_menu_shell_cycle_focus (GtkMenuShell *menu_shell,
GtkDirectionType dir);
static GtkContainerClass *parent_class = NULL;
static guint menu_shell_signals[LAST_SIGNAL] = { 0 };
......@@ -178,6 +182,35 @@ gtk_menu_shell_get_type (void)
return menu_shell_type;
}
static guint
binding_signal_new (const gchar *signal_name,
GType itype,
GSignalFlags signal_flags,
GCallback handler,
GSignalAccumulator accumulator,
gpointer accu_data,
GSignalCMarshaller c_marshaller,
GType return_type,
guint n_params,
...)
{
va_list args;
guint signal_id;
g_return_val_if_fail (signal_name != NULL, 0);
va_start (args, n_params);
signal_id = g_signal_new_valist (signal_name, itype, signal_flags,
g_cclosure_new (handler, NULL, NULL),
accumulator, accu_data, c_marshaller,
return_type, n_params, args);
va_end (args);
return signal_id;
}
static void
gtk_menu_shell_class_init (GtkMenuShellClass *klass)
{
......@@ -251,6 +284,16 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
GTK_SIGNAL_OFFSET (GtkMenuShellClass, cancel),
_gtk_marshal_VOID__VOID,
GTK_TYPE_NONE, 0);
menu_shell_signals[CYCLE_FOCUS] =
binding_signal_new ("cycle_focus",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST | GTK_RUN_ACTION,
G_CALLBACK (gtk_real_menu_shell_cycle_focus),
NULL, NULL,
_gtk_marshal_VOID__ENUM,
GTK_TYPE_NONE, 1,
GTK_TYPE_DIRECTION_TYPE);
binding_set = gtk_binding_set_by_class (klass);
gtk_binding_entry_add_signal (binding_set,
......@@ -276,6 +319,22 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
"activate_current", 1,
GTK_TYPE_BOOL,
FALSE);
gtk_binding_entry_add_signal (binding_set,
GDK_Tab, GDK_CONTROL_MASK,
"cycle_focus", 1,
GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_FORWARD);
gtk_binding_entry_add_signal (binding_set,
GDK_KP_Tab, GDK_CONTROL_MASK,
"cycle_focus", 1,
GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_FORWARD);
gtk_binding_entry_add_signal (binding_set,
GDK_Tab, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
"cycle_focus", 1,
GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_BACKWARD);
gtk_binding_entry_add_signal (binding_set,
GDK_KP_Tab, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
"cycle_focus", 1,
GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_BACKWARD);
}
static GtkType
......@@ -559,9 +618,6 @@ gtk_menu_shell_key_press (GtkWidget *widget,
_gtk_window_activate_key (GTK_WINDOW (toplevel), event))
return TRUE;
if (menu_shell->parent_menu_shell)
return gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent *)event);
return FALSE;
}
......@@ -1066,3 +1122,14 @@ gtk_real_menu_shell_cancel (GtkMenuShell *menu_shell)
gtk_menu_shell_deactivate (menu_shell);
gtk_signal_emit (GTK_OBJECT (menu_shell), menu_shell_signals[SELECTION_DONE]);
}
static void
gtk_real_menu_shell_cycle_focus (GtkMenuShell *menu_shell,
GtkDirectionType dir)
{
while (menu_shell && !GTK_IS_MENU_BAR (menu_shell))
menu_shell = GTK_MENU_SHELL (menu_shell->parent_menu_shell);
if (menu_shell)
_gtk_menu_bar_cycle_focus (GTK_MENU_BAR (menu_shell), dir);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment