From adca28f8c23fea96c79347aa278b323539f3eca8 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Sun, 18 Nov 2001 00:34:23 +0000 Subject: [PATCH] Reprioritize key bindings in order of visibility - mnemonics, then Sat Nov 17 19:26:20 2001 Owen Taylor * gtk/gtkwindow.c (gtk_window_key_press_event): Reprioritize key bindings in order of visibility - mnemonics, then accelerators, then send key to the focus widget, then bindings on the GtkWindow. * gtk/gtklayout.h docs/Changes-2.0.txt tests/testgtk.c: Removed the xoffset, yoffset fields of GtkLayout which were identically zero for compat with 1.2, but were no longer compatible with all uses of these fields in 1.2. * gtk/gtkwindow.c (gtk_window_set_default): Remove unused variable. --- ChangeLog | 15 ++++++++++++ ChangeLog.pre-2-0 | 15 ++++++++++++ ChangeLog.pre-2-10 | 15 ++++++++++++ ChangeLog.pre-2-2 | 15 ++++++++++++ ChangeLog.pre-2-4 | 15 ++++++++++++ ChangeLog.pre-2-6 | 15 ++++++++++++ ChangeLog.pre-2-8 | 15 ++++++++++++ docs/Changes-2.0.txt | 4 ++++ gtk/gtklayout.h | 3 --- gtk/gtkwindow.c | 55 ++++++++++++++++++++++---------------------- 10 files changed, 137 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5249d0e485..3d66225564 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +Sat Nov 17 19:26:20 2001 Owen Taylor + + * gtk/gtkwindow.c (gtk_window_key_press_event): Reprioritize + key bindings in order of visibility - mnemonics, then + accelerators, then send key to the focus widget, then + bindings on the GtkWindow. + + * gtk/gtklayout.h docs/Changes-2.0.txt tests/testgtk.c: + Removed the xoffset, yoffset fields of GtkLayout which were + identically zero for compat with 1.2, but were no longer + compatible with all uses of these fields in 1.2. + + * gtk/gtkwindow.c (gtk_window_set_default): Remove + unused variable. + Sat Nov 17 19:08:13 2001 Owen Taylor * tests/testtreeview.c (gtk_tree_model_types_get_type): diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 5249d0e485..3d66225564 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,18 @@ +Sat Nov 17 19:26:20 2001 Owen Taylor + + * gtk/gtkwindow.c (gtk_window_key_press_event): Reprioritize + key bindings in order of visibility - mnemonics, then + accelerators, then send key to the focus widget, then + bindings on the GtkWindow. + + * gtk/gtklayout.h docs/Changes-2.0.txt tests/testgtk.c: + Removed the xoffset, yoffset fields of GtkLayout which were + identically zero for compat with 1.2, but were no longer + compatible with all uses of these fields in 1.2. + + * gtk/gtkwindow.c (gtk_window_set_default): Remove + unused variable. + Sat Nov 17 19:08:13 2001 Owen Taylor * tests/testtreeview.c (gtk_tree_model_types_get_type): diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 5249d0e485..3d66225564 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,18 @@ +Sat Nov 17 19:26:20 2001 Owen Taylor + + * gtk/gtkwindow.c (gtk_window_key_press_event): Reprioritize + key bindings in order of visibility - mnemonics, then + accelerators, then send key to the focus widget, then + bindings on the GtkWindow. + + * gtk/gtklayout.h docs/Changes-2.0.txt tests/testgtk.c: + Removed the xoffset, yoffset fields of GtkLayout which were + identically zero for compat with 1.2, but were no longer + compatible with all uses of these fields in 1.2. + + * gtk/gtkwindow.c (gtk_window_set_default): Remove + unused variable. + Sat Nov 17 19:08:13 2001 Owen Taylor * tests/testtreeview.c (gtk_tree_model_types_get_type): diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 5249d0e485..3d66225564 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,18 @@ +Sat Nov 17 19:26:20 2001 Owen Taylor + + * gtk/gtkwindow.c (gtk_window_key_press_event): Reprioritize + key bindings in order of visibility - mnemonics, then + accelerators, then send key to the focus widget, then + bindings on the GtkWindow. + + * gtk/gtklayout.h docs/Changes-2.0.txt tests/testgtk.c: + Removed the xoffset, yoffset fields of GtkLayout which were + identically zero for compat with 1.2, but were no longer + compatible with all uses of these fields in 1.2. + + * gtk/gtkwindow.c (gtk_window_set_default): Remove + unused variable. + Sat Nov 17 19:08:13 2001 Owen Taylor * tests/testtreeview.c (gtk_tree_model_types_get_type): diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 5249d0e485..3d66225564 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,18 @@ +Sat Nov 17 19:26:20 2001 Owen Taylor + + * gtk/gtkwindow.c (gtk_window_key_press_event): Reprioritize + key bindings in order of visibility - mnemonics, then + accelerators, then send key to the focus widget, then + bindings on the GtkWindow. + + * gtk/gtklayout.h docs/Changes-2.0.txt tests/testgtk.c: + Removed the xoffset, yoffset fields of GtkLayout which were + identically zero for compat with 1.2, but were no longer + compatible with all uses of these fields in 1.2. + + * gtk/gtkwindow.c (gtk_window_set_default): Remove + unused variable. + Sat Nov 17 19:08:13 2001 Owen Taylor * tests/testtreeview.c (gtk_tree_model_types_get_type): diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 5249d0e485..3d66225564 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,18 @@ +Sat Nov 17 19:26:20 2001 Owen Taylor + + * gtk/gtkwindow.c (gtk_window_key_press_event): Reprioritize + key bindings in order of visibility - mnemonics, then + accelerators, then send key to the focus widget, then + bindings on the GtkWindow. + + * gtk/gtklayout.h docs/Changes-2.0.txt tests/testgtk.c: + Removed the xoffset, yoffset fields of GtkLayout which were + identically zero for compat with 1.2, but were no longer + compatible with all uses of these fields in 1.2. + + * gtk/gtkwindow.c (gtk_window_set_default): Remove + unused variable. + Sat Nov 17 19:08:13 2001 Owen Taylor * tests/testtreeview.c (gtk_tree_model_types_get_type): diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 5249d0e485..3d66225564 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,18 @@ +Sat Nov 17 19:26:20 2001 Owen Taylor + + * gtk/gtkwindow.c (gtk_window_key_press_event): Reprioritize + key bindings in order of visibility - mnemonics, then + accelerators, then send key to the focus widget, then + bindings on the GtkWindow. + + * gtk/gtklayout.h docs/Changes-2.0.txt tests/testgtk.c: + Removed the xoffset, yoffset fields of GtkLayout which were + identically zero for compat with 1.2, but were no longer + compatible with all uses of these fields in 1.2. + + * gtk/gtkwindow.c (gtk_window_set_default): Remove + unused variable. + Sat Nov 17 19:08:13 2001 Owen Taylor * tests/testtreeview.c (gtk_tree_model_types_get_type): diff --git a/docs/Changes-2.0.txt b/docs/Changes-2.0.txt index 6c2ceac78a..6e4222577e 100644 --- a/docs/Changes-2.0.txt +++ b/docs/Changes-2.0.txt @@ -528,3 +528,7 @@ Incompatible Changes from GTK+-1.2 to GTK+-2.0: you must make sure you call gtk_container_propagate_expose() correctly, as you must for any NO_WINDOW widgets. +* GtkLayout no longer has the xoffset, yoffset fields, which used + to store the difference between world and window coordinates for + layout->bin_window. These coordinate systems are now always + the same. \ No newline at end of file diff --git a/gtk/gtklayout.h b/gtk/gtklayout.h index 68bb43cb3a..fbefca9b38 100644 --- a/gtk/gtklayout.h +++ b/gtk/gtklayout.h @@ -59,9 +59,6 @@ struct _GtkLayout { guint width; guint height; - guint xoffset; - guint yoffset; - GtkAdjustment *hadjustment; GtkAdjustment *vadjustment; diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index de3e356ed1..27c5eed10d 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -978,8 +978,6 @@ void gtk_window_set_default (GtkWindow *window, GtkWidget *default_widget) { - GtkWidget *old_default; - g_return_if_fail (GTK_IS_WINDOW (window)); if (default_widget) @@ -3526,31 +3524,6 @@ gtk_window_key_press_event (GtkWidget *widget, handled = FALSE; - 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, event->keyval, @@ -3559,6 +3532,34 @@ gtk_window_key_press_event (GtkWidget *widget, if (!handled) handled = gtk_accel_groups_activate (G_OBJECT (window), event->keyval, event->state); + if (!handled) + { + 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); + } + /* Chain up, invokes binding set */ if (!handled && GTK_WIDGET_CLASS (parent_class)->key_press_event) handled = GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event);