Commit 53171867 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Patch from Matthias Clasen (#54488)

Fri Feb 22 19:17:46 2002  Owen Taylor  <otaylor@redhat.com>

        Patch from Matthias Clasen (#54488)

        * gtk/gtkwindow.c: Set/unset HAS_FOCUS flags here,
        and do ::has-focus notifications.

        * gtk/gtkclist.c gtk/gtkentry.c gtk/gtksocket.c
        gtk/gtktext.c gtk/gtktextview.c gtk/gtkwidget.c:
        Remove unecessary focus_in/out handles and unecessary
        flag setting.

        * gtk/gtkwidget.c: Adda missing notification on ::parent.
parent a504db9e
Fri Feb 22 19:17:46 2002 Owen Taylor <otaylor@redhat.com>
Patch from Matthias Clasen (#54488)
* gtk/gtkwindow.c: Set/unset HAS_FOCUS flags here,
and do ::has-focus notifications.
* gtk/gtkclist.c gtk/gtkentry.c gtk/gtksocket.c
gtk/gtktext.c gtk/gtktextview.c gtk/gtkwidget.c:
Remove unecessary focus_in/out handles and unecessary
flag setting.
* gtk/gtkwidget.c: Adda missing notification on ::parent.
Fri Feb 22 18:36:45 2002 Owen Taylor <otaylor@redhat.com>
Fixes for AIX compilation from Miroslaw Dobrzanski-Neumann,
......
Fri Feb 22 19:17:46 2002 Owen Taylor <otaylor@redhat.com>
Patch from Matthias Clasen (#54488)
* gtk/gtkwindow.c: Set/unset HAS_FOCUS flags here,
and do ::has-focus notifications.
* gtk/gtkclist.c gtk/gtkentry.c gtk/gtksocket.c
gtk/gtktext.c gtk/gtktextview.c gtk/gtkwidget.c:
Remove unecessary focus_in/out handles and unecessary
flag setting.
* gtk/gtkwidget.c: Adda missing notification on ::parent.
Fri Feb 22 18:36:45 2002 Owen Taylor <otaylor@redhat.com>
Fixes for AIX compilation from Miroslaw Dobrzanski-Neumann,
......
Fri Feb 22 19:17:46 2002 Owen Taylor <otaylor@redhat.com>
Patch from Matthias Clasen (#54488)
* gtk/gtkwindow.c: Set/unset HAS_FOCUS flags here,
and do ::has-focus notifications.
* gtk/gtkclist.c gtk/gtkentry.c gtk/gtksocket.c
gtk/gtktext.c gtk/gtktextview.c gtk/gtkwidget.c:
Remove unecessary focus_in/out handles and unecessary
flag setting.
* gtk/gtkwidget.c: Adda missing notification on ::parent.
Fri Feb 22 18:36:45 2002 Owen Taylor <otaylor@redhat.com>
Fixes for AIX compilation from Miroslaw Dobrzanski-Neumann,
......
Fri Feb 22 19:17:46 2002 Owen Taylor <otaylor@redhat.com>
Patch from Matthias Clasen (#54488)
* gtk/gtkwindow.c: Set/unset HAS_FOCUS flags here,
and do ::has-focus notifications.
* gtk/gtkclist.c gtk/gtkentry.c gtk/gtksocket.c
gtk/gtktext.c gtk/gtktextview.c gtk/gtkwidget.c:
Remove unecessary focus_in/out handles and unecessary
flag setting.
* gtk/gtkwidget.c: Adda missing notification on ::parent.
Fri Feb 22 18:36:45 2002 Owen Taylor <otaylor@redhat.com>
Fixes for AIX compilation from Miroslaw Dobrzanski-Neumann,
......
Fri Feb 22 19:17:46 2002 Owen Taylor <otaylor@redhat.com>
Patch from Matthias Clasen (#54488)
* gtk/gtkwindow.c: Set/unset HAS_FOCUS flags here,
and do ::has-focus notifications.
* gtk/gtkclist.c gtk/gtkentry.c gtk/gtksocket.c
gtk/gtktext.c gtk/gtktextview.c gtk/gtkwidget.c:
Remove unecessary focus_in/out handles and unecessary
flag setting.
* gtk/gtkwidget.c: Adda missing notification on ::parent.
Fri Feb 22 18:36:45 2002 Owen Taylor <otaylor@redhat.com>
Fixes for AIX compilation from Miroslaw Dobrzanski-Neumann,
......
Fri Feb 22 19:17:46 2002 Owen Taylor <otaylor@redhat.com>
Patch from Matthias Clasen (#54488)
* gtk/gtkwindow.c: Set/unset HAS_FOCUS flags here,
and do ::has-focus notifications.
* gtk/gtkclist.c gtk/gtkentry.c gtk/gtksocket.c
gtk/gtktext.c gtk/gtktextview.c gtk/gtkwidget.c:
Remove unecessary focus_in/out handles and unecessary
flag setting.
* gtk/gtkwidget.c: Adda missing notification on ::parent.
Fri Feb 22 18:36:45 2002 Owen Taylor <otaylor@redhat.com>
Fixes for AIX compilation from Miroslaw Dobrzanski-Neumann,
......
Fri Feb 22 19:17:46 2002 Owen Taylor <otaylor@redhat.com>
Patch from Matthias Clasen (#54488)
* gtk/gtkwindow.c: Set/unset HAS_FOCUS flags here,
and do ::has-focus notifications.
* gtk/gtkclist.c gtk/gtkentry.c gtk/gtksocket.c
gtk/gtktext.c gtk/gtktextview.c gtk/gtkwidget.c:
Remove unecessary focus_in/out handles and unecessary
flag setting.
* gtk/gtkwidget.c: Adda missing notification on ::parent.
Fri Feb 22 18:36:45 2002 Owen Taylor <otaylor@redhat.com>
Fixes for AIX compilation from Miroslaw Dobrzanski-Neumann,
......
......@@ -6544,14 +6544,7 @@ static gint
gtk_clist_focus_in (GtkWidget *widget,
GdkEventFocus *event)
{
GtkCList *clist;
g_return_val_if_fail (GTK_IS_CLIST (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
clist = GTK_CLIST (widget);
GtkCList *clist = GTK_CLIST (widget);
if (clist->selection_mode == GTK_SELECTION_BROWSE &&
clist->selection == NULL && clist->focus_row > -1)
......@@ -6575,17 +6568,10 @@ static gint
gtk_clist_focus_out (GtkWidget *widget,
GdkEventFocus *event)
{
GtkCList *clist;
g_return_val_if_fail (GTK_IS_CLIST (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
GtkCList *clist = GTK_CLIST (widget);
gtk_clist_draw_focus (widget);
clist = GTK_CLIST (widget);
GTK_CLIST_GET_CLASS (widget)->resync_selection (clist, (GdkEvent *) event);
return FALSE;
......
......@@ -1567,7 +1567,6 @@ gtk_entry_focus_in (GtkWidget *widget,
{
GtkEntry *entry = GTK_ENTRY (widget);
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
gtk_widget_queue_draw (widget);
entry->need_im_reset = TRUE;
......@@ -1588,7 +1587,6 @@ gtk_entry_focus_out (GtkWidget *widget,
{
GtkEntry *entry = GTK_ENTRY (widget);
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
gtk_widget_queue_draw (widget);
entry->need_im_reset = TRUE;
......
......@@ -731,16 +731,9 @@ gtk_socket_focus_in_event (GtkWidget *widget, GdkEventFocus *event)
{
GtkSocket *socket = GTK_SOCKET (widget);
if (!GTK_WIDGET_HAS_FOCUS (widget))
{
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
if (socket->plug_window)
{
send_xembed_message (socket, XEMBED_FOCUS_IN, XEMBED_FOCUS_CURRENT, 0, 0,
gtk_get_current_event_time ());
}
}
if (socket->plug_window)
send_xembed_message (socket, XEMBED_FOCUS_IN, XEMBED_FOCUS_CURRENT, 0, 0,
gtk_get_current_event_time ());
return TRUE;
}
......@@ -750,8 +743,6 @@ gtk_socket_focus_out_event (GtkWidget *widget, GdkEventFocus *event)
{
GtkSocket *socket = GTK_SOCKET (widget);
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
#if 0
GtkWidget *toplevel;
toplevel = gtk_widget_get_toplevel (widget);
......
......@@ -255,10 +255,6 @@ static gint gtk_text_motion_notify (GtkWidget *widget,
GdkEventMotion *event);
static gint gtk_text_key_press (GtkWidget *widget,
GdkEventKey *event);
static gint gtk_text_focus_in (GtkWidget *widget,
GdkEventFocus *event);
static gint gtk_text_focus_out (GtkWidget *widget,
GdkEventFocus *event);
static void move_gap (GtkText* text, guint index);
static void make_forward_space (GtkText* text, guint len);
......@@ -576,8 +572,6 @@ gtk_text_class_init (GtkTextClass *class)
widget_class->button_release_event = gtk_text_button_release;
widget_class->motion_notify_event = gtk_text_motion_notify;
widget_class->key_press_event = gtk_text_key_press;
widget_class->focus_in_event = gtk_text_focus_in;
widget_class->focus_out_event = gtk_text_focus_out;
old_editable_class->set_editable = gtk_text_real_set_editable;
......@@ -2177,30 +2171,6 @@ gtk_text_key_press (GtkWidget *widget,
return return_val;
}
static gint
gtk_text_focus_in (GtkWidget *widget,
GdkEventFocus *event)
{
g_return_val_if_fail (GTK_IS_TEXT (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
TDEBUG (("in gtk_text_focus_in\n"));
return (* GTK_WIDGET_CLASS (parent_class)->focus_in_event) (widget, event);
}
static gint
gtk_text_focus_out (GtkWidget *widget,
GdkEventFocus *event)
{
g_return_val_if_fail (GTK_IS_TEXT (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
TDEBUG (("in gtk_text_focus_out\n"));
return (* GTK_WIDGET_CLASS (parent_class)->focus_out_event) (widget, event);
}
static void
gtk_text_adjustment (GtkAdjustment *adjustment,
GtkText *text)
......
......@@ -3909,7 +3909,6 @@ gtk_text_view_focus_in_event (GtkWidget *widget, GdkEventFocus *event)
{
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
gtk_widget_queue_draw (widget);
DV(g_print (G_STRLOC": focus_in_event\n"));
......@@ -3936,7 +3935,6 @@ gtk_text_view_focus_out_event (GtkWidget *widget, GdkEventFocus *event)
{
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
gtk_widget_queue_draw (widget);
DV(g_print (G_STRLOC": focus_out_event\n"));
......
......@@ -2892,7 +2892,6 @@ static gboolean
gtk_widget_real_focus_in_event (GtkWidget *widget,
GdkEventFocus *event)
{
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
gtk_widget_queue_draw (widget);
return FALSE;
......@@ -2902,7 +2901,6 @@ static gboolean
gtk_widget_real_focus_out_event (GtkWidget *widget,
GdkEventFocus *event)
{
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
gtk_widget_queue_draw (widget);
return FALSE;
......@@ -3226,6 +3224,8 @@ gtk_widget_reparent (GtkWidget *widget,
gtk_widget_reparent_container_child (widget,
gtk_widget_get_parent_window (widget));
}
g_object_notify (G_OBJECT (widget), "parent");
}
}
......
......@@ -3627,12 +3627,35 @@ gtk_window_leave_notify_event (GtkWidget *widget,
return FALSE;
}
static void
do_focus_change (GtkWidget *widget,
gboolean in)
{
GdkEventFocus fevent;
g_object_ref (widget);
if (in)
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
else
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
fevent.type = GDK_FOCUS_CHANGE;
fevent.window = widget->window;
fevent.in = in;
gtk_widget_event (widget, (GdkEvent*) &fevent);
g_object_notify (G_OBJECT (widget), "has_focus");
g_object_unref (widget);
}
static gint
gtk_window_focus_in_event (GtkWidget *widget,
GdkEventFocus *event)
{
GtkWindow *window = GTK_WINDOW (widget);
GdkEventFocus fevent;
/* It appears spurious focus in events can occur when
* the window is hidden. So we'll just check to see if
......@@ -3646,13 +3669,7 @@ gtk_window_focus_in_event (GtkWidget *widget,
if (window->focus_widget &&
window->focus_widget != widget &&
!GTK_WIDGET_HAS_FOCUS (window->focus_widget))
{
fevent.type = GDK_FOCUS_CHANGE;
fevent.window = window->focus_widget->window;
fevent.in = TRUE;
gtk_widget_event (window->focus_widget, (GdkEvent*) &fevent);
}
do_focus_change (window->focus_widget, TRUE);
}
return FALSE;
......@@ -3663,20 +3680,13 @@ gtk_window_focus_out_event (GtkWidget *widget,
GdkEventFocus *event)
{
GtkWindow *window = GTK_WINDOW (widget);
GdkEventFocus fevent;
window->has_focus = FALSE;
if (window->focus_widget &&
window->focus_widget != widget &&
GTK_WIDGET_HAS_FOCUS (window->focus_widget))
{
fevent.type = GDK_FOCUS_CHANGE;
fevent.window = window->focus_widget->window;
fevent.in = FALSE;
gtk_widget_event (window->focus_widget, (GdkEvent*) &fevent);
}
do_focus_change (window->focus_widget, FALSE);
return FALSE;
}
......@@ -3786,7 +3796,6 @@ static void
gtk_window_real_set_focus (GtkWindow *window,
GtkWidget *focus)
{
GdkEventFocus event;
gboolean def_flags = 0;
if (window->default_widget)
......@@ -3804,13 +3813,7 @@ gtk_window_real_set_focus (GtkWindow *window,
}
if (window->has_focus)
{
event.type = GDK_FOCUS_CHANGE;
event.window = window->focus_widget->window;
event.in = FALSE;
gtk_widget_event (window->focus_widget, (GdkEvent*) &event);
}
do_focus_change (window->focus_widget, FALSE);
}
window->focus_widget = focus;
......@@ -3828,13 +3831,7 @@ gtk_window_real_set_focus (GtkWindow *window,
}
if (window->has_focus)
{
event.type = GDK_FOCUS_CHANGE;
event.window = window->focus_widget->window;
event.in = TRUE;
gtk_widget_event (window->focus_widget, (GdkEvent*) &event);
}
do_focus_change (window->focus_widget, TRUE);
}
if (window->default_widget &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment