mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-11 11:20:12 +00:00
set RECEIVES_DEFAULT on init, and a button press on the widget doesn't
Mon Jan 25 11:05:10 1999 George Lebl <jirka@5z.com> * gtk/gtkbutton.c: set RECEIVES_DEFAULT on init, and a button press on the widget doesn't grab default anymore * gtk/gtkcheckbutton.c,gtk/gtkoptionmenu.c,gtk/gtkradiobutton.c: unset RECEIVES_DEFAULT on init * gtk/gtkwidget.[ch]: add a RECEIVES_DEFAULT flag to widget flags * gtk/gtkwindow.c,gtk/gtkplug.c: on pressing <enter>, activate the focused widget if it is a RECEIVES_DEFAULT widget, no matter what the current default_widget is * gtk/gtkwindow.c: on focus change, migrate the HAS_DEFAULT flag to CAN_DEFAULT widgets if they RECEIVE_DEFAULT as well or migrate it back to the default_widget if the focus widget doesn't "RECEIVE_DEFAULT"
This commit is contained in:
parent
8ac2b1dda6
commit
4b8095d525
20
ChangeLog
20
ChangeLog
@ -1,3 +1,23 @@
|
|||||||
|
Mon Jan 25 11:05:10 1999 George Lebl <jirka@5z.com>
|
||||||
|
|
||||||
|
* gtk/gtkbutton.c: set RECEIVES_DEFAULT on init, and a
|
||||||
|
button press on the widget doesn't grab default anymore
|
||||||
|
|
||||||
|
* gtk/gtkcheckbutton.c,gtk/gtkoptionmenu.c,gtk/gtkradiobutton.c:
|
||||||
|
unset RECEIVES_DEFAULT on init
|
||||||
|
|
||||||
|
* gtk/gtkwidget.[ch]: add a RECEIVES_DEFAULT flag to widget
|
||||||
|
flags
|
||||||
|
|
||||||
|
* gtk/gtkwindow.c,gtk/gtkplug.c: on pressing <enter>, activate
|
||||||
|
the focused widget if it is a RECEIVES_DEFAULT widget,
|
||||||
|
no matter what the current default_widget is
|
||||||
|
|
||||||
|
* gtk/gtkwindow.c: on focus change, migrate the HAS_DEFAULT
|
||||||
|
flag to CAN_DEFAULT widgets if they RECEIVE_DEFAULT as well
|
||||||
|
or migrate it back to the default_widget if the focus widget
|
||||||
|
doesn't "RECEIVE_DEFAULT"
|
||||||
|
|
||||||
Sun Jan 24 18:09:24 1999 Owen Taylor <otaylor@redhat.com>
|
Sun Jan 24 18:09:24 1999 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gdk/gdkdnd.c (motif_read_initiator_info): Byteswap
|
* gdk/gdkdnd.c (motif_read_initiator_info): Byteswap
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
Mon Jan 25 11:05:10 1999 George Lebl <jirka@5z.com>
|
||||||
|
|
||||||
|
* gtk/gtkbutton.c: set RECEIVES_DEFAULT on init, and a
|
||||||
|
button press on the widget doesn't grab default anymore
|
||||||
|
|
||||||
|
* gtk/gtkcheckbutton.c,gtk/gtkoptionmenu.c,gtk/gtkradiobutton.c:
|
||||||
|
unset RECEIVES_DEFAULT on init
|
||||||
|
|
||||||
|
* gtk/gtkwidget.[ch]: add a RECEIVES_DEFAULT flag to widget
|
||||||
|
flags
|
||||||
|
|
||||||
|
* gtk/gtkwindow.c,gtk/gtkplug.c: on pressing <enter>, activate
|
||||||
|
the focused widget if it is a RECEIVES_DEFAULT widget,
|
||||||
|
no matter what the current default_widget is
|
||||||
|
|
||||||
|
* gtk/gtkwindow.c: on focus change, migrate the HAS_DEFAULT
|
||||||
|
flag to CAN_DEFAULT widgets if they RECEIVE_DEFAULT as well
|
||||||
|
or migrate it back to the default_widget if the focus widget
|
||||||
|
doesn't "RECEIVE_DEFAULT"
|
||||||
|
|
||||||
Sun Jan 24 18:09:24 1999 Owen Taylor <otaylor@redhat.com>
|
Sun Jan 24 18:09:24 1999 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gdk/gdkdnd.c (motif_read_initiator_info): Byteswap
|
* gdk/gdkdnd.c (motif_read_initiator_info): Byteswap
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
Mon Jan 25 11:05:10 1999 George Lebl <jirka@5z.com>
|
||||||
|
|
||||||
|
* gtk/gtkbutton.c: set RECEIVES_DEFAULT on init, and a
|
||||||
|
button press on the widget doesn't grab default anymore
|
||||||
|
|
||||||
|
* gtk/gtkcheckbutton.c,gtk/gtkoptionmenu.c,gtk/gtkradiobutton.c:
|
||||||
|
unset RECEIVES_DEFAULT on init
|
||||||
|
|
||||||
|
* gtk/gtkwidget.[ch]: add a RECEIVES_DEFAULT flag to widget
|
||||||
|
flags
|
||||||
|
|
||||||
|
* gtk/gtkwindow.c,gtk/gtkplug.c: on pressing <enter>, activate
|
||||||
|
the focused widget if it is a RECEIVES_DEFAULT widget,
|
||||||
|
no matter what the current default_widget is
|
||||||
|
|
||||||
|
* gtk/gtkwindow.c: on focus change, migrate the HAS_DEFAULT
|
||||||
|
flag to CAN_DEFAULT widgets if they RECEIVE_DEFAULT as well
|
||||||
|
or migrate it back to the default_widget if the focus widget
|
||||||
|
doesn't "RECEIVE_DEFAULT"
|
||||||
|
|
||||||
Sun Jan 24 18:09:24 1999 Owen Taylor <otaylor@redhat.com>
|
Sun Jan 24 18:09:24 1999 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gdk/gdkdnd.c (motif_read_initiator_info): Byteswap
|
* gdk/gdkdnd.c (motif_read_initiator_info): Byteswap
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
Mon Jan 25 11:05:10 1999 George Lebl <jirka@5z.com>
|
||||||
|
|
||||||
|
* gtk/gtkbutton.c: set RECEIVES_DEFAULT on init, and a
|
||||||
|
button press on the widget doesn't grab default anymore
|
||||||
|
|
||||||
|
* gtk/gtkcheckbutton.c,gtk/gtkoptionmenu.c,gtk/gtkradiobutton.c:
|
||||||
|
unset RECEIVES_DEFAULT on init
|
||||||
|
|
||||||
|
* gtk/gtkwidget.[ch]: add a RECEIVES_DEFAULT flag to widget
|
||||||
|
flags
|
||||||
|
|
||||||
|
* gtk/gtkwindow.c,gtk/gtkplug.c: on pressing <enter>, activate
|
||||||
|
the focused widget if it is a RECEIVES_DEFAULT widget,
|
||||||
|
no matter what the current default_widget is
|
||||||
|
|
||||||
|
* gtk/gtkwindow.c: on focus change, migrate the HAS_DEFAULT
|
||||||
|
flag to CAN_DEFAULT widgets if they RECEIVE_DEFAULT as well
|
||||||
|
or migrate it back to the default_widget if the focus widget
|
||||||
|
doesn't "RECEIVE_DEFAULT"
|
||||||
|
|
||||||
Sun Jan 24 18:09:24 1999 Owen Taylor <otaylor@redhat.com>
|
Sun Jan 24 18:09:24 1999 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gdk/gdkdnd.c (motif_read_initiator_info): Byteswap
|
* gdk/gdkdnd.c (motif_read_initiator_info): Byteswap
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
Mon Jan 25 11:05:10 1999 George Lebl <jirka@5z.com>
|
||||||
|
|
||||||
|
* gtk/gtkbutton.c: set RECEIVES_DEFAULT on init, and a
|
||||||
|
button press on the widget doesn't grab default anymore
|
||||||
|
|
||||||
|
* gtk/gtkcheckbutton.c,gtk/gtkoptionmenu.c,gtk/gtkradiobutton.c:
|
||||||
|
unset RECEIVES_DEFAULT on init
|
||||||
|
|
||||||
|
* gtk/gtkwidget.[ch]: add a RECEIVES_DEFAULT flag to widget
|
||||||
|
flags
|
||||||
|
|
||||||
|
* gtk/gtkwindow.c,gtk/gtkplug.c: on pressing <enter>, activate
|
||||||
|
the focused widget if it is a RECEIVES_DEFAULT widget,
|
||||||
|
no matter what the current default_widget is
|
||||||
|
|
||||||
|
* gtk/gtkwindow.c: on focus change, migrate the HAS_DEFAULT
|
||||||
|
flag to CAN_DEFAULT widgets if they RECEIVE_DEFAULT as well
|
||||||
|
or migrate it back to the default_widget if the focus widget
|
||||||
|
doesn't "RECEIVE_DEFAULT"
|
||||||
|
|
||||||
Sun Jan 24 18:09:24 1999 Owen Taylor <otaylor@redhat.com>
|
Sun Jan 24 18:09:24 1999 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gdk/gdkdnd.c (motif_read_initiator_info): Byteswap
|
* gdk/gdkdnd.c (motif_read_initiator_info): Byteswap
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
Mon Jan 25 11:05:10 1999 George Lebl <jirka@5z.com>
|
||||||
|
|
||||||
|
* gtk/gtkbutton.c: set RECEIVES_DEFAULT on init, and a
|
||||||
|
button press on the widget doesn't grab default anymore
|
||||||
|
|
||||||
|
* gtk/gtkcheckbutton.c,gtk/gtkoptionmenu.c,gtk/gtkradiobutton.c:
|
||||||
|
unset RECEIVES_DEFAULT on init
|
||||||
|
|
||||||
|
* gtk/gtkwidget.[ch]: add a RECEIVES_DEFAULT flag to widget
|
||||||
|
flags
|
||||||
|
|
||||||
|
* gtk/gtkwindow.c,gtk/gtkplug.c: on pressing <enter>, activate
|
||||||
|
the focused widget if it is a RECEIVES_DEFAULT widget,
|
||||||
|
no matter what the current default_widget is
|
||||||
|
|
||||||
|
* gtk/gtkwindow.c: on focus change, migrate the HAS_DEFAULT
|
||||||
|
flag to CAN_DEFAULT widgets if they RECEIVE_DEFAULT as well
|
||||||
|
or migrate it back to the default_widget if the focus widget
|
||||||
|
doesn't "RECEIVE_DEFAULT"
|
||||||
|
|
||||||
Sun Jan 24 18:09:24 1999 Owen Taylor <otaylor@redhat.com>
|
Sun Jan 24 18:09:24 1999 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gdk/gdkdnd.c (motif_read_initiator_info): Byteswap
|
* gdk/gdkdnd.c (motif_read_initiator_info): Byteswap
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
Mon Jan 25 11:05:10 1999 George Lebl <jirka@5z.com>
|
||||||
|
|
||||||
|
* gtk/gtkbutton.c: set RECEIVES_DEFAULT on init, and a
|
||||||
|
button press on the widget doesn't grab default anymore
|
||||||
|
|
||||||
|
* gtk/gtkcheckbutton.c,gtk/gtkoptionmenu.c,gtk/gtkradiobutton.c:
|
||||||
|
unset RECEIVES_DEFAULT on init
|
||||||
|
|
||||||
|
* gtk/gtkwidget.[ch]: add a RECEIVES_DEFAULT flag to widget
|
||||||
|
flags
|
||||||
|
|
||||||
|
* gtk/gtkwindow.c,gtk/gtkplug.c: on pressing <enter>, activate
|
||||||
|
the focused widget if it is a RECEIVES_DEFAULT widget,
|
||||||
|
no matter what the current default_widget is
|
||||||
|
|
||||||
|
* gtk/gtkwindow.c: on focus change, migrate the HAS_DEFAULT
|
||||||
|
flag to CAN_DEFAULT widgets if they RECEIVE_DEFAULT as well
|
||||||
|
or migrate it back to the default_widget if the focus widget
|
||||||
|
doesn't "RECEIVE_DEFAULT"
|
||||||
|
|
||||||
Sun Jan 24 18:09:24 1999 Owen Taylor <otaylor@redhat.com>
|
Sun Jan 24 18:09:24 1999 Owen Taylor <otaylor@redhat.com>
|
||||||
|
|
||||||
* gdk/gdkdnd.c (motif_read_initiator_info): Byteswap
|
* gdk/gdkdnd.c (motif_read_initiator_info): Byteswap
|
||||||
|
@ -205,7 +205,7 @@ gtk_button_class_init (GtkButtonClass *klass)
|
|||||||
static void
|
static void
|
||||||
gtk_button_init (GtkButton *button)
|
gtk_button_init (GtkButton *button)
|
||||||
{
|
{
|
||||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_FOCUS);
|
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_FOCUS | GTK_RECEIVES_DEFAULT);
|
||||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_NO_WINDOW);
|
GTK_WIDGET_UNSET_FLAGS (button, GTK_NO_WINDOW);
|
||||||
|
|
||||||
button->child = NULL;
|
button->child = NULL;
|
||||||
@ -672,8 +672,6 @@ gtk_button_button_press (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
button = GTK_BUTTON (widget);
|
button = GTK_BUTTON (widget);
|
||||||
|
|
||||||
if (GTK_WIDGET_CAN_DEFAULT (widget) && (event->button == 1))
|
|
||||||
gtk_widget_grab_default (widget);
|
|
||||||
if (!GTK_WIDGET_HAS_FOCUS (widget))
|
if (!GTK_WIDGET_HAS_FOCUS (widget))
|
||||||
gtk_widget_grab_focus (widget);
|
gtk_widget_grab_focus (widget);
|
||||||
|
|
||||||
|
@ -95,6 +95,7 @@ static void
|
|||||||
gtk_check_button_init (GtkCheckButton *check_button)
|
gtk_check_button_init (GtkCheckButton *check_button)
|
||||||
{
|
{
|
||||||
GTK_WIDGET_SET_FLAGS (check_button, GTK_NO_WINDOW);
|
GTK_WIDGET_SET_FLAGS (check_button, GTK_NO_WINDOW);
|
||||||
|
GTK_WIDGET_UNSET_FLAGS (check_button, GTK_RECEIVES_DEFAULT);
|
||||||
GTK_TOGGLE_BUTTON (check_button)->draw_indicator = TRUE;
|
GTK_TOGGLE_BUTTON (check_button)->draw_indicator = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ static void
|
|||||||
gtk_option_menu_init (GtkOptionMenu *option_menu)
|
gtk_option_menu_init (GtkOptionMenu *option_menu)
|
||||||
{
|
{
|
||||||
GTK_WIDGET_SET_FLAGS (option_menu, GTK_CAN_FOCUS);
|
GTK_WIDGET_SET_FLAGS (option_menu, GTK_CAN_FOCUS);
|
||||||
GTK_WIDGET_UNSET_FLAGS (option_menu, GTK_CAN_DEFAULT);
|
GTK_WIDGET_UNSET_FLAGS (option_menu, GTK_CAN_DEFAULT | GTK_RECEIVES_DEFAULT);
|
||||||
|
|
||||||
option_menu->menu = NULL;
|
option_menu->menu = NULL;
|
||||||
option_menu->menu_item = NULL;
|
option_menu->menu_item = NULL;
|
||||||
|
@ -204,7 +204,9 @@ gtk_plug_key_press_event (GtkWidget *widget,
|
|||||||
break;
|
break;
|
||||||
case GDK_Return:
|
case GDK_Return:
|
||||||
case GDK_KP_Enter:
|
case GDK_KP_Enter:
|
||||||
if (window->default_widget)
|
if (window->default_widget &&
|
||||||
|
(!window->focus_widget ||
|
||||||
|
!GTK_WIDGET_RECEIVES_DEFAULT (window->focus_widget)))
|
||||||
{
|
{
|
||||||
gtk_widget_activate (window->default_widget);
|
gtk_widget_activate (window->default_widget);
|
||||||
return_val = TRUE;
|
return_val = TRUE;
|
||||||
|
@ -99,6 +99,7 @@ static void
|
|||||||
gtk_radio_button_init (GtkRadioButton *radio_button)
|
gtk_radio_button_init (GtkRadioButton *radio_button)
|
||||||
{
|
{
|
||||||
GTK_WIDGET_SET_FLAGS (radio_button, GTK_NO_WINDOW);
|
GTK_WIDGET_SET_FLAGS (radio_button, GTK_NO_WINDOW);
|
||||||
|
GTK_WIDGET_UNSET_FLAGS (radio_button, GTK_RECEIVES_DEFAULT);
|
||||||
|
|
||||||
GTK_TOGGLE_BUTTON (radio_button)->active = TRUE;
|
GTK_TOGGLE_BUTTON (radio_button)->active = TRUE;
|
||||||
|
|
||||||
|
@ -107,6 +107,7 @@ enum {
|
|||||||
ARG_HAS_FOCUS,
|
ARG_HAS_FOCUS,
|
||||||
ARG_CAN_DEFAULT,
|
ARG_CAN_DEFAULT,
|
||||||
ARG_HAS_DEFAULT,
|
ARG_HAS_DEFAULT,
|
||||||
|
ARG_RECEIVES_DEFAULT,
|
||||||
ARG_COMPOSITE_CHILD,
|
ARG_COMPOSITE_CHILD,
|
||||||
ARG_STYLE,
|
ARG_STYLE,
|
||||||
ARG_EVENTS,
|
ARG_EVENTS,
|
||||||
@ -276,6 +277,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
gtk_object_add_arg_type ("GtkWidget::has_focus", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HAS_FOCUS);
|
gtk_object_add_arg_type ("GtkWidget::has_focus", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HAS_FOCUS);
|
||||||
gtk_object_add_arg_type ("GtkWidget::can_default", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_CAN_DEFAULT);
|
gtk_object_add_arg_type ("GtkWidget::can_default", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_CAN_DEFAULT);
|
||||||
gtk_object_add_arg_type ("GtkWidget::has_default", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HAS_DEFAULT);
|
gtk_object_add_arg_type ("GtkWidget::has_default", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HAS_DEFAULT);
|
||||||
|
gtk_object_add_arg_type ("GtkWidget::receives_default", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_RECEIVES_DEFAULT);
|
||||||
gtk_object_add_arg_type ("GtkWidget::composite_child", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_COMPOSITE_CHILD);
|
gtk_object_add_arg_type ("GtkWidget::composite_child", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_COMPOSITE_CHILD);
|
||||||
gtk_object_add_arg_type ("GtkWidget::style", GTK_TYPE_STYLE, GTK_ARG_READWRITE, ARG_STYLE);
|
gtk_object_add_arg_type ("GtkWidget::style", GTK_TYPE_STYLE, GTK_ARG_READWRITE, ARG_STYLE);
|
||||||
gtk_object_add_arg_type ("GtkWidget::events", GTK_TYPE_GDK_EVENT_MASK, GTK_ARG_READWRITE, ARG_EVENTS);
|
gtk_object_add_arg_type ("GtkWidget::events", GTK_TYPE_GDK_EVENT_MASK, GTK_ARG_READWRITE, ARG_EVENTS);
|
||||||
@ -838,6 +840,12 @@ gtk_widget_set_arg (GtkObject *object,
|
|||||||
if (GTK_VALUE_BOOL (*arg))
|
if (GTK_VALUE_BOOL (*arg))
|
||||||
gtk_widget_grab_default (widget);
|
gtk_widget_grab_default (widget);
|
||||||
break;
|
break;
|
||||||
|
case ARG_RECEIVES_DEFAULT:
|
||||||
|
if (GTK_VALUE_BOOL (*arg))
|
||||||
|
GTK_WIDGET_SET_FLAGS (widget, GTK_RECEIVES_DEFAULT);
|
||||||
|
else
|
||||||
|
GTK_WIDGET_UNSET_FLAGS (widget, GTK_RECEIVES_DEFAULT);
|
||||||
|
break;
|
||||||
case ARG_COMPOSITE_CHILD:
|
case ARG_COMPOSITE_CHILD:
|
||||||
if (GTK_VALUE_BOOL(*arg))
|
if (GTK_VALUE_BOOL(*arg))
|
||||||
GTK_WIDGET_SET_FLAGS (widget, GTK_COMPOSITE_CHILD);
|
GTK_WIDGET_SET_FLAGS (widget, GTK_COMPOSITE_CHILD);
|
||||||
@ -940,6 +948,9 @@ gtk_widget_get_arg (GtkObject *object,
|
|||||||
case ARG_HAS_DEFAULT:
|
case ARG_HAS_DEFAULT:
|
||||||
GTK_VALUE_BOOL (*arg) = (GTK_WIDGET_HAS_DEFAULT (widget) != FALSE);
|
GTK_VALUE_BOOL (*arg) = (GTK_WIDGET_HAS_DEFAULT (widget) != FALSE);
|
||||||
break;
|
break;
|
||||||
|
case ARG_RECEIVES_DEFAULT:
|
||||||
|
GTK_VALUE_BOOL (*arg) = (GTK_WIDGET_RECEIVES_DEFAULT (widget) != FALSE);
|
||||||
|
break;
|
||||||
case ARG_COMPOSITE_CHILD:
|
case ARG_COMPOSITE_CHILD:
|
||||||
GTK_VALUE_BOOL (*arg) = (GTK_WIDGET_COMPOSITE_CHILD (widget) != FALSE);
|
GTK_VALUE_BOOL (*arg) = (GTK_WIDGET_COMPOSITE_CHILD (widget) != FALSE);
|
||||||
break;
|
break;
|
||||||
|
@ -51,7 +51,8 @@ typedef enum
|
|||||||
GTK_RC_STYLE = 1 << 16,
|
GTK_RC_STYLE = 1 << 16,
|
||||||
GTK_COMPOSITE_CHILD = 1 << 17,
|
GTK_COMPOSITE_CHILD = 1 << 17,
|
||||||
GTK_NO_REPARENT = 1 << 18,
|
GTK_NO_REPARENT = 1 << 18,
|
||||||
GTK_APP_PAINTABLE = 1 << 19
|
GTK_APP_PAINTABLE = 1 << 19,
|
||||||
|
GTK_RECEIVES_DEFAULT = 1 << 20
|
||||||
} GtkWidgetFlags;
|
} GtkWidgetFlags;
|
||||||
|
|
||||||
/* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer.
|
/* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer.
|
||||||
@ -90,6 +91,7 @@ typedef enum
|
|||||||
#define GTK_WIDGET_RC_STYLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE) != 0)
|
#define GTK_WIDGET_RC_STYLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE) != 0)
|
||||||
#define GTK_WIDGET_COMPOSITE_CHILD(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_COMPOSITE_CHILD) != 0)
|
#define GTK_WIDGET_COMPOSITE_CHILD(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_COMPOSITE_CHILD) != 0)
|
||||||
#define GTK_WIDGET_APP_PAINTABLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_APP_PAINTABLE) != 0)
|
#define GTK_WIDGET_APP_PAINTABLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_APP_PAINTABLE) != 0)
|
||||||
|
#define GTK_WIDGET_RECEIVES_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RECEIVES_DEFAULT) != 0)
|
||||||
|
|
||||||
/* Macros for setting and clearing widget flags.
|
/* Macros for setting and clearing widget flags.
|
||||||
*/
|
*/
|
||||||
|
@ -1033,7 +1033,9 @@ gtk_window_key_press_event (GtkWidget *widget,
|
|||||||
break;
|
break;
|
||||||
case GDK_Return:
|
case GDK_Return:
|
||||||
case GDK_KP_Enter:
|
case GDK_KP_Enter:
|
||||||
if (window->default_widget)
|
if (window->default_widget &&
|
||||||
|
(!window->focus_widget ||
|
||||||
|
!GTK_WIDGET_RECEIVES_DEFAULT (window->focus_widget)))
|
||||||
{
|
{
|
||||||
gtk_widget_activate (window->default_widget);
|
gtk_widget_activate (window->default_widget);
|
||||||
handled = TRUE;
|
handled = TRUE;
|
||||||
@ -1494,16 +1496,31 @@ gtk_window_real_set_focus (GtkWindow *window,
|
|||||||
GtkWidget *focus)
|
GtkWidget *focus)
|
||||||
{
|
{
|
||||||
GdkEventFocus event;
|
GdkEventFocus event;
|
||||||
|
gboolean def_flags = 0;
|
||||||
|
|
||||||
g_return_if_fail (window != NULL);
|
g_return_if_fail (window != NULL);
|
||||||
g_return_if_fail (GTK_IS_WINDOW (window));
|
g_return_if_fail (GTK_IS_WINDOW (window));
|
||||||
|
|
||||||
|
if (window->default_widget)
|
||||||
|
def_flags = GTK_WIDGET_HAS_DEFAULT (window->default_widget);
|
||||||
|
|
||||||
if (window->focus_widget)
|
if (window->focus_widget)
|
||||||
{
|
{
|
||||||
event.type = GDK_FOCUS_CHANGE;
|
event.type = GDK_FOCUS_CHANGE;
|
||||||
event.window = window->focus_widget->window;
|
event.window = window->focus_widget->window;
|
||||||
event.in = FALSE;
|
event.in = FALSE;
|
||||||
|
|
||||||
|
if (GTK_WIDGET_RECEIVES_DEFAULT (window->focus_widget) &&
|
||||||
|
(window->focus_widget != window->default_widget))
|
||||||
|
{
|
||||||
|
GTK_WIDGET_UNSET_FLAGS (window->focus_widget, GTK_HAS_DEFAULT);
|
||||||
|
/* if any widget had the default set there should be
|
||||||
|
a default_widget, but might not so this is a sanity
|
||||||
|
check */
|
||||||
|
if (window->default_widget)
|
||||||
|
GTK_WIDGET_SET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_widget_event (window->focus_widget, (GdkEvent*) &event);
|
gtk_widget_event (window->focus_widget, (GdkEvent*) &event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1514,9 +1531,32 @@ gtk_window_real_set_focus (GtkWindow *window,
|
|||||||
event.type = GDK_FOCUS_CHANGE;
|
event.type = GDK_FOCUS_CHANGE;
|
||||||
event.window = window->focus_widget->window;
|
event.window = window->focus_widget->window;
|
||||||
event.in = TRUE;
|
event.in = TRUE;
|
||||||
|
|
||||||
|
if (window->default_widget)
|
||||||
|
{
|
||||||
|
if (GTK_WIDGET_RECEIVES_DEFAULT (window->focus_widget) &&
|
||||||
|
(window->focus_widget != window->default_widget))
|
||||||
|
{
|
||||||
|
if (GTK_WIDGET_CAN_DEFAULT (window->focus_widget))
|
||||||
|
GTK_WIDGET_SET_FLAGS (window->focus_widget, GTK_HAS_DEFAULT);
|
||||||
|
GTK_WIDGET_UNSET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GTK_WIDGET_SET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gtk_widget_event (window->focus_widget, (GdkEvent*) &event);
|
gtk_widget_event (window->focus_widget, (GdkEvent*) &event);
|
||||||
}
|
}
|
||||||
|
else if (window->default_widget)
|
||||||
|
{
|
||||||
|
GTK_WIDGET_SET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (window->default_widget &&
|
||||||
|
(def_flags != GTK_WIDGET_FLAGS (window->default_widget)))
|
||||||
|
gtk_widget_queue_draw (window->default_widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user