forked from AuroraMiddleware/gtk
Propagate key press events not just to focus/window but also to
Thu Nov 15 12:54:36 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkwindow.c (gtk_window_key_press_event): Propagate key press events not just to focus/window but also to intermediate widgets. * gtk/gtknotebook.c: Handle Ctrl-PageUp/Ctrl-PageDown to switch pages. (Needs some work on handling focus when switching pages.)
This commit is contained in:
parent
0f9b242203
commit
c344b3f905
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
Thu Nov 15 12:54:36 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkwindow.c (gtk_window_key_press_event): Propagate
|
||||
key press events not just to focus/window but also to
|
||||
intermediate widgets.
|
||||
|
||||
* gtk/gtknotebook.c: Handle Ctrl-PageUp/Ctrl-PageDown
|
||||
to switch pages. (Needs some work on handling focus
|
||||
when switching pages.)
|
||||
|
||||
Fri Nov 16 14:06:31 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtknotebook.c: Fix child allocations to be relative to
|
||||
|
@ -1,3 +1,13 @@
|
||||
Thu Nov 15 12:54:36 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkwindow.c (gtk_window_key_press_event): Propagate
|
||||
key press events not just to focus/window but also to
|
||||
intermediate widgets.
|
||||
|
||||
* gtk/gtknotebook.c: Handle Ctrl-PageUp/Ctrl-PageDown
|
||||
to switch pages. (Needs some work on handling focus
|
||||
when switching pages.)
|
||||
|
||||
Fri Nov 16 14:06:31 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtknotebook.c: Fix child allocations to be relative to
|
||||
|
@ -1,3 +1,13 @@
|
||||
Thu Nov 15 12:54:36 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkwindow.c (gtk_window_key_press_event): Propagate
|
||||
key press events not just to focus/window but also to
|
||||
intermediate widgets.
|
||||
|
||||
* gtk/gtknotebook.c: Handle Ctrl-PageUp/Ctrl-PageDown
|
||||
to switch pages. (Needs some work on handling focus
|
||||
when switching pages.)
|
||||
|
||||
Fri Nov 16 14:06:31 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtknotebook.c: Fix child allocations to be relative to
|
||||
|
@ -1,3 +1,13 @@
|
||||
Thu Nov 15 12:54:36 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkwindow.c (gtk_window_key_press_event): Propagate
|
||||
key press events not just to focus/window but also to
|
||||
intermediate widgets.
|
||||
|
||||
* gtk/gtknotebook.c: Handle Ctrl-PageUp/Ctrl-PageDown
|
||||
to switch pages. (Needs some work on handling focus
|
||||
when switching pages.)
|
||||
|
||||
Fri Nov 16 14:06:31 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtknotebook.c: Fix child allocations to be relative to
|
||||
|
@ -1,3 +1,13 @@
|
||||
Thu Nov 15 12:54:36 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkwindow.c (gtk_window_key_press_event): Propagate
|
||||
key press events not just to focus/window but also to
|
||||
intermediate widgets.
|
||||
|
||||
* gtk/gtknotebook.c: Handle Ctrl-PageUp/Ctrl-PageDown
|
||||
to switch pages. (Needs some work on handling focus
|
||||
when switching pages.)
|
||||
|
||||
Fri Nov 16 14:06:31 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtknotebook.c: Fix child allocations to be relative to
|
||||
|
@ -1,3 +1,13 @@
|
||||
Thu Nov 15 12:54:36 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkwindow.c (gtk_window_key_press_event): Propagate
|
||||
key press events not just to focus/window but also to
|
||||
intermediate widgets.
|
||||
|
||||
* gtk/gtknotebook.c: Handle Ctrl-PageUp/Ctrl-PageDown
|
||||
to switch pages. (Needs some work on handling focus
|
||||
when switching pages.)
|
||||
|
||||
Fri Nov 16 14:06:31 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtknotebook.c: Fix child allocations to be relative to
|
||||
|
@ -1,3 +1,13 @@
|
||||
Thu Nov 15 12:54:36 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkwindow.c (gtk_window_key_press_event): Propagate
|
||||
key press events not just to focus/window but also to
|
||||
intermediate widgets.
|
||||
|
||||
* gtk/gtknotebook.c: Handle Ctrl-PageUp/Ctrl-PageDown
|
||||
to switch pages. (Needs some work on handling focus
|
||||
when switching pages.)
|
||||
|
||||
Fri Nov 16 14:06:31 2001 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtknotebook.c: Fix child allocations to be relative to
|
||||
|
@ -49,6 +49,7 @@ enum {
|
||||
SWITCH_PAGE,
|
||||
FOCUS_TAB,
|
||||
SELECT_PAGE,
|
||||
CHANGE_CURRENT_PAGE,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@ -117,6 +118,9 @@ static void gtk_notebook_select_page (GtkNotebook *notebook,
|
||||
gboolean move_focus);
|
||||
static void gtk_notebook_focus_tab (GtkNotebook *notebook,
|
||||
GtkNotebookTab type);
|
||||
static void gtk_notebook_change_current_page (GtkNotebook *notebook,
|
||||
gint offset);
|
||||
|
||||
|
||||
/*** GtkObject Methods ***/
|
||||
static void gtk_notebook_destroy (GtkObject *object);
|
||||
@ -315,6 +319,7 @@ gtk_notebook_class_init (GtkNotebookClass *class)
|
||||
|
||||
class->focus_tab = gtk_notebook_focus_tab;
|
||||
class->select_page = gtk_notebook_select_page;
|
||||
class->change_current_page = gtk_notebook_change_current_page;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_PAGE,
|
||||
@ -454,6 +459,15 @@ gtk_notebook_class_init (GtkNotebookClass *class)
|
||||
gtk_marshal_VOID__BOOLEAN,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_BOOLEAN);
|
||||
notebook_signals[CHANGE_CURRENT_PAGE] =
|
||||
g_signal_new ("change_current_page",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
G_STRUCT_OFFSET (GtkNotebookClass, change_current_page),
|
||||
NULL, NULL,
|
||||
gtk_marshal_VOID__INT,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_INT);
|
||||
|
||||
binding_set = gtk_binding_set_by_class (object_class);
|
||||
gtk_binding_entry_add_signal (binding_set,
|
||||
@ -489,6 +503,15 @@ gtk_notebook_class_init (GtkNotebookClass *class)
|
||||
GDK_KP_End, 0,
|
||||
"focus_tab", 1,
|
||||
GTK_TYPE_NOTEBOOK_TAB, GTK_NOTEBOOK_TAB_LAST);
|
||||
|
||||
gtk_binding_entry_add_signal (binding_set,
|
||||
GDK_Page_Up, GDK_CONTROL_MASK,
|
||||
"change_current_page", 1,
|
||||
G_TYPE_INT, -1);
|
||||
gtk_binding_entry_add_signal (binding_set,
|
||||
GDK_Page_Down, GDK_CONTROL_MASK,
|
||||
"change_current_page", 1,
|
||||
G_TYPE_INT, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -547,6 +570,25 @@ gtk_notebook_focus_tab (GtkNotebook *notebook,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_notebook_change_current_page (GtkNotebook *notebook,
|
||||
gint offset)
|
||||
{
|
||||
GList *current = NULL;
|
||||
|
||||
if (notebook->cur_page)
|
||||
current = g_list_find (notebook->children, notebook->cur_page);
|
||||
|
||||
while (offset != 0)
|
||||
{
|
||||
current = gtk_notebook_search_page (notebook, current, offset < 0 ? STEP_PREV : STEP_NEXT, TRUE);
|
||||
offset += offset < 0 ? 1 : -1;
|
||||
}
|
||||
|
||||
if (current)
|
||||
gtk_notebook_switch_page (notebook, current->data, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_notebook_new:
|
||||
*
|
||||
|
@ -94,12 +94,12 @@ struct _GtkNotebookClass
|
||||
guint page_num);
|
||||
|
||||
/* Action signals for keybindings */
|
||||
void (* select_page) (GtkNotebook *notebook,
|
||||
gboolean move_focus);
|
||||
|
||||
void (* focus_tab) (GtkNotebook *notebook,
|
||||
GtkNotebookTab type);
|
||||
|
||||
void (* select_page) (GtkNotebook *notebook,
|
||||
gboolean move_focus);
|
||||
void (* focus_tab) (GtkNotebook *notebook,
|
||||
GtkNotebookTab type);
|
||||
void (* change_current_page) (GtkNotebook *notebook,
|
||||
gint offset);
|
||||
};
|
||||
|
||||
/***********************************************************
|
||||
|
@ -3485,6 +3485,7 @@ gtk_window_key_press_event (GtkWidget *widget,
|
||||
GdkEventKey *event)
|
||||
{
|
||||
GtkWindow *window;
|
||||
GtkWidget *focus;
|
||||
gboolean handled;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE);
|
||||
@ -3493,10 +3494,31 @@ gtk_window_key_press_event (GtkWidget *widget,
|
||||
window = GTK_WINDOW (widget);
|
||||
|
||||
handled = FALSE;
|
||||
|
||||
if (window->focus_widget && window->focus_widget != widget &&
|
||||
GTK_WIDGET_IS_SENSITIVE (window->focus_widget))
|
||||
handled = gtk_widget_event (window->focus_widget, (GdkEvent*) event);
|
||||
|
||||
focus = window->focus_widget;
|
||||
if (focus)
|
||||
g_object_ref (focus);
|
||||
|
||||
while (!handled &&
|
||||
focus && focus != widget &&
|
||||
gtk_widget_get_toplevel (focus) == widget)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
|
||||
if (GTK_WIDGET_IS_SENSITIVE (focus))
|
||||
handled = gtk_widget_event (focus, (GdkEvent*) event);
|
||||
|
||||
parent = focus->parent;
|
||||
if (parent)
|
||||
g_object_ref (parent);
|
||||
|
||||
g_object_unref (focus);
|
||||
|
||||
focus = parent;
|
||||
}
|
||||
|
||||
if (focus)
|
||||
g_object_unref (focus);
|
||||
|
||||
if (!handled)
|
||||
handled = gtk_window_mnemonic_activate (window,
|
||||
|
Loading…
Reference in New Issue
Block a user