]> Pileus Git - ~andy/gtk/commitdiff
Add some documenting comments about GTK_CAN_DEFAULT, GTK_HAS_DEFAULT and
authorGeorge Lebl <jirka@5z.com>
Sun, 3 Sep 2000 05:49:34 +0000 (05:49 +0000)
committerGeorge Lebl <jirka@src.gnome.org>
Sun, 3 Sep 2000 05:49:34 +0000 (05:49 +0000)
Sun Sep 03 00:47:08 2000  George Lebl <jirka@5z.com>

* 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.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkwidget.h
gtk/gtkwindow.c

index d9e467747e55dca5c1067b5d7718b762f11a2a89..3931ad9c3b897030a32eba3fc649118411f30842 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+Sun Sep 03 00:47:08 2000  George Lebl <jirka@5z.com>
+
+       * 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  <otaylor@redhat.com>
 
        * gtk/gtkmenu.[ch] TODO.xml: Apply patch from
index d9e467747e55dca5c1067b5d7718b762f11a2a89..3931ad9c3b897030a32eba3fc649118411f30842 100644 (file)
@@ -1,3 +1,16 @@
+Sun Sep 03 00:47:08 2000  George Lebl <jirka@5z.com>
+
+       * 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  <otaylor@redhat.com>
 
        * gtk/gtkmenu.[ch] TODO.xml: Apply patch from
index d9e467747e55dca5c1067b5d7718b762f11a2a89..3931ad9c3b897030a32eba3fc649118411f30842 100644 (file)
@@ -1,3 +1,16 @@
+Sun Sep 03 00:47:08 2000  George Lebl <jirka@5z.com>
+
+       * 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  <otaylor@redhat.com>
 
        * gtk/gtkmenu.[ch] TODO.xml: Apply patch from
index d9e467747e55dca5c1067b5d7718b762f11a2a89..3931ad9c3b897030a32eba3fc649118411f30842 100644 (file)
@@ -1,3 +1,16 @@
+Sun Sep 03 00:47:08 2000  George Lebl <jirka@5z.com>
+
+       * 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  <otaylor@redhat.com>
 
        * gtk/gtkmenu.[ch] TODO.xml: Apply patch from
index d9e467747e55dca5c1067b5d7718b762f11a2a89..3931ad9c3b897030a32eba3fc649118411f30842 100644 (file)
@@ -1,3 +1,16 @@
+Sun Sep 03 00:47:08 2000  George Lebl <jirka@5z.com>
+
+       * 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  <otaylor@redhat.com>
 
        * gtk/gtkmenu.[ch] TODO.xml: Apply patch from
index d9e467747e55dca5c1067b5d7718b762f11a2a89..3931ad9c3b897030a32eba3fc649118411f30842 100644 (file)
@@ -1,3 +1,16 @@
+Sun Sep 03 00:47:08 2000  George Lebl <jirka@5z.com>
+
+       * 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  <otaylor@redhat.com>
 
        * gtk/gtkmenu.[ch] TODO.xml: Apply patch from
index d9e467747e55dca5c1067b5d7718b762f11a2a89..3931ad9c3b897030a32eba3fc649118411f30842 100644 (file)
@@ -1,3 +1,16 @@
+Sun Sep 03 00:47:08 2000  George Lebl <jirka@5z.com>
+
+       * 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  <otaylor@redhat.com>
 
        * gtk/gtkmenu.[ch] TODO.xml: Apply patch from
index a22b7b344f979c6d05d55a50216bb6d2a81e235b..4e2a87e7f6db43fb83d91112cb9cb0d2c638f5da 100644 (file)
@@ -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;
 
index d9348e2dde62d68fc27ba3284e5c91dcac48721c..bfd2a46e72b3a6764e5143693be826272d9a843c 100644 (file)
@@ -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);
        }
     }