diff --git a/ChangeLog b/ChangeLog index d9e467747e..3931ad9c3b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Sun Sep 03 00:47:08 2000 George Lebl + + * gtk/gtkwidget.h: Add some documenting comments about + GTK_CAN_DEFAULT, GTK_HAS_DEFAULT and GTK_RECEIVES_DEFAULT + just as owen said on irc. + + * gtk/gtkwindow.c (gtk_window_set_default): Don't blindly + set HAS_DEFAULT. Only set it if there isn't another window + holding it (a focus window which RECEIVES_DEFAULT) and only unset + it if the widget is not the focused window with RECEIVES_DEFAULT. + This fixes weird double default bugs in dialogs which has things + call gtk_window_set_default at times. + Fri Sep 1 22:39:07 2000 Owen Taylor * gtk/gtkmenu.[ch] TODO.xml: Apply patch from diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index d9e467747e..3931ad9c3b 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,16 @@ +Sun Sep 03 00:47:08 2000 George Lebl + + * gtk/gtkwidget.h: Add some documenting comments about + GTK_CAN_DEFAULT, GTK_HAS_DEFAULT and GTK_RECEIVES_DEFAULT + just as owen said on irc. + + * gtk/gtkwindow.c (gtk_window_set_default): Don't blindly + set HAS_DEFAULT. Only set it if there isn't another window + holding it (a focus window which RECEIVES_DEFAULT) and only unset + it if the widget is not the focused window with RECEIVES_DEFAULT. + This fixes weird double default bugs in dialogs which has things + call gtk_window_set_default at times. + Fri Sep 1 22:39:07 2000 Owen Taylor * gtk/gtkmenu.[ch] TODO.xml: Apply patch from diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index d9e467747e..3931ad9c3b 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,16 @@ +Sun Sep 03 00:47:08 2000 George Lebl + + * gtk/gtkwidget.h: Add some documenting comments about + GTK_CAN_DEFAULT, GTK_HAS_DEFAULT and GTK_RECEIVES_DEFAULT + just as owen said on irc. + + * gtk/gtkwindow.c (gtk_window_set_default): Don't blindly + set HAS_DEFAULT. Only set it if there isn't another window + holding it (a focus window which RECEIVES_DEFAULT) and only unset + it if the widget is not the focused window with RECEIVES_DEFAULT. + This fixes weird double default bugs in dialogs which has things + call gtk_window_set_default at times. + Fri Sep 1 22:39:07 2000 Owen Taylor * gtk/gtkmenu.[ch] TODO.xml: Apply patch from diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index d9e467747e..3931ad9c3b 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,16 @@ +Sun Sep 03 00:47:08 2000 George Lebl + + * gtk/gtkwidget.h: Add some documenting comments about + GTK_CAN_DEFAULT, GTK_HAS_DEFAULT and GTK_RECEIVES_DEFAULT + just as owen said on irc. + + * gtk/gtkwindow.c (gtk_window_set_default): Don't blindly + set HAS_DEFAULT. Only set it if there isn't another window + holding it (a focus window which RECEIVES_DEFAULT) and only unset + it if the widget is not the focused window with RECEIVES_DEFAULT. + This fixes weird double default bugs in dialogs which has things + call gtk_window_set_default at times. + Fri Sep 1 22:39:07 2000 Owen Taylor * gtk/gtkmenu.[ch] TODO.xml: Apply patch from diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index d9e467747e..3931ad9c3b 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,16 @@ +Sun Sep 03 00:47:08 2000 George Lebl + + * gtk/gtkwidget.h: Add some documenting comments about + GTK_CAN_DEFAULT, GTK_HAS_DEFAULT and GTK_RECEIVES_DEFAULT + just as owen said on irc. + + * gtk/gtkwindow.c (gtk_window_set_default): Don't blindly + set HAS_DEFAULT. Only set it if there isn't another window + holding it (a focus window which RECEIVES_DEFAULT) and only unset + it if the widget is not the focused window with RECEIVES_DEFAULT. + This fixes weird double default bugs in dialogs which has things + call gtk_window_set_default at times. + Fri Sep 1 22:39:07 2000 Owen Taylor * gtk/gtkmenu.[ch] TODO.xml: Apply patch from diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index d9e467747e..3931ad9c3b 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,16 @@ +Sun Sep 03 00:47:08 2000 George Lebl + + * gtk/gtkwidget.h: Add some documenting comments about + GTK_CAN_DEFAULT, GTK_HAS_DEFAULT and GTK_RECEIVES_DEFAULT + just as owen said on irc. + + * gtk/gtkwindow.c (gtk_window_set_default): Don't blindly + set HAS_DEFAULT. Only set it if there isn't another window + holding it (a focus window which RECEIVES_DEFAULT) and only unset + it if the widget is not the focused window with RECEIVES_DEFAULT. + This fixes weird double default bugs in dialogs which has things + call gtk_window_set_default at times. + Fri Sep 1 22:39:07 2000 Owen Taylor * gtk/gtkmenu.[ch] TODO.xml: Apply patch from diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index d9e467747e..3931ad9c3b 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,16 @@ +Sun Sep 03 00:47:08 2000 George Lebl + + * gtk/gtkwidget.h: Add some documenting comments about + GTK_CAN_DEFAULT, GTK_HAS_DEFAULT and GTK_RECEIVES_DEFAULT + just as owen said on irc. + + * gtk/gtkwindow.c (gtk_window_set_default): Don't blindly + set HAS_DEFAULT. Only set it if there isn't another window + holding it (a focus window which RECEIVES_DEFAULT) and only unset + it if the widget is not the focused window with RECEIVES_DEFAULT. + This fixes weird double default bugs in dialogs which has things + call gtk_window_set_default at times. + Fri Sep 1 22:39:07 2000 Owen Taylor * gtk/gtkmenu.[ch] TODO.xml: Apply patch from diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index a22b7b344f..4e2a87e7f6 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -53,14 +53,25 @@ typedef enum GTK_PARENT_SENSITIVE = 1 << 10, GTK_CAN_FOCUS = 1 << 11, GTK_HAS_FOCUS = 1 << 12, + + /* widget is allowed to receive the default via gtk_widget_grab_default + * and will reserve space to draw the default if possible */ GTK_CAN_DEFAULT = 1 << 13, + + /* the widget currently is receiving the default action and should be drawn + * appropriately if possible */ GTK_HAS_DEFAULT = 1 << 14, + GTK_HAS_GRAB = 1 << 15, GTK_RC_STYLE = 1 << 16, GTK_COMPOSITE_CHILD = 1 << 17, GTK_NO_REPARENT = 1 << 18, GTK_APP_PAINTABLE = 1 << 19, + + /* the widget when focused will receive the default action and have + * HAS_DEFAULT set even if there is a different widget set as default */ GTK_RECEIVES_DEFAULT = 1 << 20, + GTK_DOUBLE_BUFFERED = 1 << 21 } GtkWidgetFlags; diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index d9348e2dde..bfd2a46e72 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -471,7 +471,9 @@ gtk_window_set_default (GtkWindow *window, { if (window->default_widget) { - GTK_WIDGET_UNSET_FLAGS (window->default_widget, GTK_HAS_DEFAULT); + if (window->focus_widget != window->default_widget || + !GTK_WIDGET_RECEIVES_DEFAULT (window->default_widget)) + GTK_WIDGET_UNSET_FLAGS (window->default_widget, GTK_HAS_DEFAULT); gtk_widget_draw_default (window->default_widget); } @@ -479,7 +481,9 @@ gtk_window_set_default (GtkWindow *window, if (window->default_widget) { - GTK_WIDGET_SET_FLAGS (window->default_widget, GTK_HAS_DEFAULT); + if (window->focus_widget == NULL || + !GTK_WIDGET_RECEIVES_DEFAULT (window->focus_widget)) + GTK_WIDGET_SET_FLAGS (window->default_widget, GTK_HAS_DEFAULT); gtk_widget_draw_default (window->default_widget); } }