Try to make sure that we have some focused widget on map. (#50339)

Wed Jan 30 13:55:59 2002  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkwindow.c (gtk_window_show): Try to make
	sure that we have some focused widget on map. (#50339)

	* gtk/gtkdialog.c (gtk_dialog_map): Handling picking
	a focus widget here differently so that if a
	response button gets picked, it's the default one.

	* tests/testgtk.c (make_message_dialog): Set the
	default response for the dialogs.
This commit is contained in:
Owen Taylor 2002-01-30 18:58:31 +00:00 committed by Owen Taylor
parent 4e8a284f86
commit 2a9af2ff42
9 changed files with 139 additions and 9 deletions

View File

@ -1,6 +1,18 @@
Wed Jan 30 13:55:59 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_show): Try to make
sure that we have some focused widget on map. (#50339)
* gtk/gtkdialog.c (gtk_dialog_map): Handling picking
a focus widget here differently so that if a
response button gets picked, it's the default one.
* tests/testgtk.c (make_message_dialog): Set the
default response for the dialogs.
Tue Jan 29 22:52:36 2002 Owen Taylor <otaylor@redhat.com>
* 1.3.13
* Released 1.3.13
* configure.in: Micro version 13, interface, binary
age 0. Require GLIB-1.3.13, Pango 0.24.

View File

@ -1,6 +1,18 @@
Wed Jan 30 13:55:59 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_show): Try to make
sure that we have some focused widget on map. (#50339)
* gtk/gtkdialog.c (gtk_dialog_map): Handling picking
a focus widget here differently so that if a
response button gets picked, it's the default one.
* tests/testgtk.c (make_message_dialog): Set the
default response for the dialogs.
Tue Jan 29 22:52:36 2002 Owen Taylor <otaylor@redhat.com>
* 1.3.13
* Released 1.3.13
* configure.in: Micro version 13, interface, binary
age 0. Require GLIB-1.3.13, Pango 0.24.

View File

@ -1,6 +1,18 @@
Wed Jan 30 13:55:59 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_show): Try to make
sure that we have some focused widget on map. (#50339)
* gtk/gtkdialog.c (gtk_dialog_map): Handling picking
a focus widget here differently so that if a
response button gets picked, it's the default one.
* tests/testgtk.c (make_message_dialog): Set the
default response for the dialogs.
Tue Jan 29 22:52:36 2002 Owen Taylor <otaylor@redhat.com>
* 1.3.13
* Released 1.3.13
* configure.in: Micro version 13, interface, binary
age 0. Require GLIB-1.3.13, Pango 0.24.

View File

@ -1,6 +1,18 @@
Wed Jan 30 13:55:59 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_show): Try to make
sure that we have some focused widget on map. (#50339)
* gtk/gtkdialog.c (gtk_dialog_map): Handling picking
a focus widget here differently so that if a
response button gets picked, it's the default one.
* tests/testgtk.c (make_message_dialog): Set the
default response for the dialogs.
Tue Jan 29 22:52:36 2002 Owen Taylor <otaylor@redhat.com>
* 1.3.13
* Released 1.3.13
* configure.in: Micro version 13, interface, binary
age 0. Require GLIB-1.3.13, Pango 0.24.

View File

@ -1,6 +1,18 @@
Wed Jan 30 13:55:59 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_show): Try to make
sure that we have some focused widget on map. (#50339)
* gtk/gtkdialog.c (gtk_dialog_map): Handling picking
a focus widget here differently so that if a
response button gets picked, it's the default one.
* tests/testgtk.c (make_message_dialog): Set the
default response for the dialogs.
Tue Jan 29 22:52:36 2002 Owen Taylor <otaylor@redhat.com>
* 1.3.13
* Released 1.3.13
* configure.in: Micro version 13, interface, binary
age 0. Require GLIB-1.3.13, Pango 0.24.

View File

@ -1,6 +1,18 @@
Wed Jan 30 13:55:59 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_show): Try to make
sure that we have some focused widget on map. (#50339)
* gtk/gtkdialog.c (gtk_dialog_map): Handling picking
a focus widget here differently so that if a
response button gets picked, it's the default one.
* tests/testgtk.c (make_message_dialog): Set the
default response for the dialogs.
Tue Jan 29 22:52:36 2002 Owen Taylor <otaylor@redhat.com>
* 1.3.13
* Released 1.3.13
* configure.in: Micro version 13, interface, binary
age 0. Require GLIB-1.3.13, Pango 0.24.

View File

@ -1,6 +1,18 @@
Wed Jan 30 13:55:59 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_show): Try to make
sure that we have some focused widget on map. (#50339)
* gtk/gtkdialog.c (gtk_dialog_map): Handling picking
a focus widget here differently so that if a
response button gets picked, it's the default one.
* tests/testgtk.c (make_message_dialog): Set the
default response for the dialogs.
Tue Jan 29 22:52:36 2002 Owen Taylor <otaylor@redhat.com>
* 1.3.13
* Released 1.3.13
* configure.in: Micro version 13, interface, binary
age 0. Require GLIB-1.3.13, Pango 0.24.

View File

@ -57,6 +57,7 @@ static void gtk_dialog_get_property (GObject *object,
GParamSpec *pspec);
static void gtk_dialog_style_set (GtkWidget *widget,
GtkStyle *prev_style);
static void gtk_dialog_map (GtkWidget *widget);
static void gtk_dialog_close (GtkDialog *dialog);
@ -116,6 +117,7 @@ gtk_dialog_class_init (GtkDialogClass *class)
gobject_class->set_property = gtk_dialog_set_property;
gobject_class->get_property = gtk_dialog_get_property;
widget_class->map = gtk_dialog_map;
widget_class->style_set = gtk_dialog_style_set;
class->close = gtk_dialog_close;
@ -296,6 +298,45 @@ gtk_dialog_delete_event_handler (GtkWidget *widget,
return FALSE;
}
/* A far too tricky heuristic for getting the right initial
* focus widget if none was set. What we do is we focus the first
* widget in the tab chain, but if this results in the focus
* ending up on one of the response widgets _other_ than the
* default response, we focus the default response instead.
*/
static void
gtk_dialog_map (GtkWidget *widget)
{
GtkWindow *window = GTK_WINDOW (widget);
GtkDialog *dialog = GTK_DIALOG (widget);
GTK_WIDGET_CLASS (parent_class)->map (widget);
if (!window->focus_widget)
{
GList *children, *tmp_list;
g_signal_emit_by_name (window, "move_focus", GTK_DIR_TAB_FORWARD);
tmp_list = children = gtk_container_get_children (GTK_CONTAINER (dialog->action_area));
while (tmp_list)
{
GtkWidget *child = tmp_list->data;
if (child == window->focus_widget && child != window->default_widget && window->default_widget)
{
gtk_widget_grab_focus (window->default_widget);
break;
}
tmp_list = tmp_list->next;
}
g_list_free (children);
}
}
static void
gtk_dialog_style_set (GtkWidget *widget,
GtkStyle *prev_style)

View File

@ -2980,12 +2980,12 @@ gtk_window_show (GtkWidget *widget)
GtkWindow *window = GTK_WINDOW (widget);
GtkContainer *container = GTK_CONTAINER (window);
gboolean need_resize;
GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
need_resize = container->need_resize || !GTK_WIDGET_REALIZED (widget);
container->need_resize = FALSE;
if (need_resize)
{
GtkWindowGeometryInfo *info = gtk_window_get_geometry_info (window, TRUE);
@ -3046,6 +3046,11 @@ gtk_window_show (GtkWidget *widget)
gtk_widget_map (widget);
/* Try to make sure that we have some focused widget
*/
if (!window->focus_widget)
gtk_window_move_focus (window, GTK_DIR_TAB_FORWARD);
if (window->modal)
gtk_grab_add (widget);
}