Only optimize out the full configure handling if we got a gratuitous

Thu May 16 19:49:24 2002  Owen Taylor  <otaylor@redhat.com>
        * gtk/gtkwindow.c (gtk_window_configure_event): Only
        optimize out the full configure handling if we got
        a gratuitous configure event(configure_request_count == 0)
        and the size didn't change.

        * gtk/gtkwindow.c (gtk_window_move_resize): Use
        g_message(), not g_print() for debug spew.b

        * gtk/gtkwindow.c (gtk_window_real_set_focus): Ref
        the old and new focus widgets for the scope of
        the function.

        * gtk/gtksocket.c gtkplug.c: Remove various #if 0'd
        bits of old code.
This commit is contained in:
Owen Taylor 2002-05-16 23:59:23 +00:00 committed by Owen Taylor
parent 20be61eef6
commit 2bf6824ffa
9 changed files with 159 additions and 166 deletions

View File

@ -1,3 +1,20 @@
Thu May 16 19:49:24 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_configure_event): Only
optimize out the full configure handling if we got
a gratuitous configure event(configure_request_count == 0)
and the size didn't change.
* gtk/gtkwindow.c (gtk_window_move_resize): Use
g_message(), not g_print() for debug spew.b
* gtk/gtkwindow.c (gtk_window_real_set_focus): Ref
the old and new focus widgets for the scope of
the function.
* gtk/gtksocket.c gtkplug.c: Remove various #if 0'd
bits of old code.
Thu May 16 18:47:29 2002 Owen Taylor <otaylor@redhat.com> Thu May 16 18:47:29 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_show): Disable the * gtk/gtkwindow.c (gtk_window_show): Disable the

View File

@ -1,3 +1,20 @@
Thu May 16 19:49:24 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_configure_event): Only
optimize out the full configure handling if we got
a gratuitous configure event(configure_request_count == 0)
and the size didn't change.
* gtk/gtkwindow.c (gtk_window_move_resize): Use
g_message(), not g_print() for debug spew.b
* gtk/gtkwindow.c (gtk_window_real_set_focus): Ref
the old and new focus widgets for the scope of
the function.
* gtk/gtksocket.c gtkplug.c: Remove various #if 0'd
bits of old code.
Thu May 16 18:47:29 2002 Owen Taylor <otaylor@redhat.com> Thu May 16 18:47:29 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_show): Disable the * gtk/gtkwindow.c (gtk_window_show): Disable the

View File

@ -1,3 +1,20 @@
Thu May 16 19:49:24 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_configure_event): Only
optimize out the full configure handling if we got
a gratuitous configure event(configure_request_count == 0)
and the size didn't change.
* gtk/gtkwindow.c (gtk_window_move_resize): Use
g_message(), not g_print() for debug spew.b
* gtk/gtkwindow.c (gtk_window_real_set_focus): Ref
the old and new focus widgets for the scope of
the function.
* gtk/gtksocket.c gtkplug.c: Remove various #if 0'd
bits of old code.
Thu May 16 18:47:29 2002 Owen Taylor <otaylor@redhat.com> Thu May 16 18:47:29 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_show): Disable the * gtk/gtkwindow.c (gtk_window_show): Disable the

View File

@ -1,3 +1,20 @@
Thu May 16 19:49:24 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_configure_event): Only
optimize out the full configure handling if we got
a gratuitous configure event(configure_request_count == 0)
and the size didn't change.
* gtk/gtkwindow.c (gtk_window_move_resize): Use
g_message(), not g_print() for debug spew.b
* gtk/gtkwindow.c (gtk_window_real_set_focus): Ref
the old and new focus widgets for the scope of
the function.
* gtk/gtksocket.c gtkplug.c: Remove various #if 0'd
bits of old code.
Thu May 16 18:47:29 2002 Owen Taylor <otaylor@redhat.com> Thu May 16 18:47:29 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_show): Disable the * gtk/gtkwindow.c (gtk_window_show): Disable the

View File

@ -1,3 +1,20 @@
Thu May 16 19:49:24 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_configure_event): Only
optimize out the full configure handling if we got
a gratuitous configure event(configure_request_count == 0)
and the size didn't change.
* gtk/gtkwindow.c (gtk_window_move_resize): Use
g_message(), not g_print() for debug spew.b
* gtk/gtkwindow.c (gtk_window_real_set_focus): Ref
the old and new focus widgets for the scope of
the function.
* gtk/gtksocket.c gtkplug.c: Remove various #if 0'd
bits of old code.
Thu May 16 18:47:29 2002 Owen Taylor <otaylor@redhat.com> Thu May 16 18:47:29 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_show): Disable the * gtk/gtkwindow.c (gtk_window_show): Disable the

View File

@ -1,3 +1,20 @@
Thu May 16 19:49:24 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_configure_event): Only
optimize out the full configure handling if we got
a gratuitous configure event(configure_request_count == 0)
and the size didn't change.
* gtk/gtkwindow.c (gtk_window_move_resize): Use
g_message(), not g_print() for debug spew.b
* gtk/gtkwindow.c (gtk_window_real_set_focus): Ref
the old and new focus widgets for the scope of
the function.
* gtk/gtksocket.c gtkplug.c: Remove various #if 0'd
bits of old code.
Thu May 16 18:47:29 2002 Owen Taylor <otaylor@redhat.com> Thu May 16 18:47:29 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwindow.c (gtk_window_show): Disable the * gtk/gtkwindow.c (gtk_window_show): Disable the

View File

@ -681,23 +681,6 @@ gtk_plug_set_focus (GtkWindow *window,
if (focus && !window->has_focus) if (focus && !window->has_focus)
{ {
#if 0
XEvent xevent;
xevent.xfocus.type = FocusIn;
xevent.xfocus.display = GDK_WINDOW_XDISPLAY (plug->socket_window);
xevent.xfocus.window = GDK_WINDOW_XWINDOW (plug->socket_window);
xevent.xfocus.mode = EMBEDDED_APP_WANTS_FOCUS;
xevent.xfocus.detail = FALSE; /* Don't force */
gdk_error_trap_push ();
XSendEvent (GDK_DISPLAY (),
GDK_WINDOW_XWINDOW (plug->socket_window),
False, NoEventMask, &xevent);
gdk_display_sync (gdk_drawable_get_display (plug->socket_window));
gdk_error_trap_pop ();
#endif
send_xembed_message (plug, XEMBED_REQUEST_FOCUS, 0, 0, 0, send_xembed_message (plug, XEMBED_REQUEST_FOCUS, 0, 0, 0,
gtk_get_current_event_time ()); gtk_get_current_event_time ());
} }
@ -862,19 +845,6 @@ gtk_plug_focus (GtkWidget *widget,
send_xembed_message (plug, message, 0, 0, 0, send_xembed_message (plug, message, 0, 0, 0,
gtk_get_current_event_time ()); gtk_get_current_event_time ());
#if 0
gtk_window_set_focus (GTK_WINDOW (widget), NULL);
gdk_error_trap_push ();
XSetInputFocus (GDK_WINDOW_XDISPLAY (plug->socket_window),
GDK_WINDOW_XWINDOW (plug->socket_window),
RevertToParent, event->time);
gdk_display_sync (gdk_drawable_get_display (plug->socket_window));
gdk_error_trap_pop ();
gtk_plug_forward_key_press (plug, event);
#endif
} }
} }

View File

@ -785,20 +785,6 @@ static gboolean
gtk_socket_focus_out_event (GtkWidget *widget, GdkEventFocus *event) gtk_socket_focus_out_event (GtkWidget *widget, GdkEventFocus *event)
{ {
GtkSocket *socket = GTK_SOCKET (widget); GtkSocket *socket = GTK_SOCKET (widget);
#if 0
GtkWidget *toplevel;
toplevel = gtk_widget_get_toplevel (widget);
if (toplevel && GTK_IS_WINDOW (toplevel))
{
XSetInputFocus (GDK_WINDOW_XDISPLAY (toplevel->window),
GDK_WINDOW_XWINDOW (toplevel->window),
RevertToParent, CurrentTime); /* FIXME? */
}
#endif
if (socket->plug_window) if (socket->plug_window)
{ {
send_xembed_message (socket, XEMBED_FOCUS_OUT, 0, 0, 0, send_xembed_message (socket, XEMBED_FOCUS_OUT, 0, 0, 0,
@ -821,20 +807,6 @@ gtk_socket_claim_focus (GtkSocket *socket)
GTK_WIDGET_SET_FLAGS (socket, GTK_CAN_FOCUS); GTK_WIDGET_SET_FLAGS (socket, GTK_CAN_FOCUS);
gtk_widget_grab_focus (GTK_WIDGET (socket)); gtk_widget_grab_focus (GTK_WIDGET (socket));
GTK_WIDGET_UNSET_FLAGS (socket, GTK_CAN_FOCUS); GTK_WIDGET_UNSET_FLAGS (socket, GTK_CAN_FOCUS);
/* FIXME: we might grab the focus even if we don't have
* it as an app... (and see _focus_in ()) */
if (socket->plug_window)
{
#if 0
gdk_error_trap_push ();
XSetInputFocus (GDK_WINDOW_XDISPLAY (socket->plug_window),
GDK_WINDOW_XWINDOW (socket->plug_window),
RevertToParent, GDK_CURRENT_TIME);
gdk_display_sync (gdk_drawable_get_display (socket->plug_window));
gdk_error_trap_pop ();
#endif
}
} }
static gboolean static gboolean
@ -876,67 +848,6 @@ gtk_socket_focus (GtkWidget *widget, GtkDirectionType direction)
} }
else else
return FALSE; return FALSE;
#if 0
if (!socket->focus_in && socket->plug_window)
{
GdkScreen *screen = gdk_drawable_get_screen (socket->plug_window);
Display *xdisplay = GDK_SCREEN_XDISPLAY (screen);
XEvent xevent;
gtk_socket_claim_focus (socket);
xevent.xkey.type = KeyPress;
xevent.xkey.window = GDK_WINDOW_XWINDOW (socket->plug_window);
xevent.xkey.root = GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (socket->plug_window));
xevent.xkey.time = GDK_CURRENT_TIME;
/* FIXME, the following might cause big problems for
* non-GTK apps */
xevent.xkey.x = 0;
xevent.xkey.y = 0;
xevent.xkey.x_root = 0;
xevent.xkey.y_root = 0;
xevent.xkey.state = 0;
xevent.xkey.same_screen = TRUE; /* FIXME ? */
switch (direction)
{
case GTK_DIR_UP:
xevent.xkey.keycode = XKeysymToKeycode(xdisplay, GDK_Up);
break;
case GTK_DIR_DOWN:
xevent.xkey.keycode = XKeysymToKeycode(xdisplay, GDK_Down);
break;
case GTK_DIR_LEFT:
xevent.xkey.keycode = XKeysymToKeycode(xdisplay, GDK_Left);
break;
case GTK_DIR_RIGHT:
xevent.xkey.keycode = XKeysymToKeycode(xdisplay, GDK_Right);
break;
case GTK_DIR_TAB_FORWARD:
xevent.xkey.keycode = XKeysymToKeycode(xdisplay, GDK_Tab);
break;
case GTK_DIR_TAB_BACKWARD:
xevent.xkey.keycode = XKeysymToKeycode(xdisplay, GDK_Tab);
xevent.xkey.state = ShiftMask;
break;
}
gdk_error_trap_push ();
XSendEvent (GDK_WINDOW_XDISPLAY (socket->plug_window),
GDK_WINDOW_XWINDOW (socket->plug_window),
False, NoEventMask, &xevent);
gdk_display_sync (gdk_drawable_get_display (socket->plug_window));
gdk_error_trap_pop ();
return TRUE;
}
else
{
return FALSE;
}
#endif
} }
static void static void
@ -1400,20 +1311,6 @@ gtk_socket_filter_func (GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data)
{ {
gtk_socket_claim_focus (socket); gtk_socket_claim_focus (socket);
} }
else if (xevent->xfocus.detail == NotifyInferior)
{
#if 0
GtkWidget *toplevel;
toplevel = gtk_widget_get_toplevel (widget);
if (toplevel && GTK_IS_WINDOW (topelevel))
{
XSetInputFocus (GDK_WINDOW_XDISPLAY (toplevel->window),
GDK_WINDOW_XWINDOW (toplevel->window),
RevertToParent, CurrentTime); /* FIXME? */
}
#endif
}
return_val = GDK_FILTER_REMOVE; return_val = GDK_FILTER_REMOVE;
break; break;
case FocusOut: case FocusOut:

View File

@ -3529,6 +3529,7 @@ gtk_window_configure_event (GtkWidget *widget,
GdkEventConfigure *event) GdkEventConfigure *event)
{ {
GtkWindow *window = GTK_WINDOW (widget); GtkWindow *window = GTK_WINDOW (widget);
gboolean expected_reply = window->configure_request_count > 0;
/* window->configure_request_count incremented for each /* window->configure_request_count incremented for each
* configure request, and decremented to a min of 0 for * configure request, and decremented to a min of 0 for
@ -3553,7 +3554,7 @@ gtk_window_configure_event (GtkWidget *widget,
* notifies and can wait to resize when we get them * notifies and can wait to resize when we get them
*/ */
if (window->configure_request_count > 0 || if (!expected_reply &&
(widget->allocation.width == event->width && (widget->allocation.width == event->width &&
widget->allocation.height == event->height)) widget->allocation.height == event->height))
return TRUE; return TRUE;
@ -3897,8 +3898,20 @@ static void
gtk_window_real_set_focus (GtkWindow *window, gtk_window_real_set_focus (GtkWindow *window,
GtkWidget *focus) GtkWidget *focus)
{ {
GtkWidget *old_focus = window->focus_widget;
gboolean def_flags = 0; gboolean def_flags = 0;
if (old_focus)
{
g_object_ref (old_focus);
g_object_freeze_notify (G_OBJECT (old_focus));
}
if (focus)
{
g_object_ref (focus);
g_object_freeze_notify (G_OBJECT (focus));
}
if (window->default_widget) if (window->default_widget)
def_flags = GTK_WIDGET_HAS_DEFAULT (window->default_widget); def_flags = GTK_WIDGET_HAS_DEFAULT (window->default_widget);
@ -3938,6 +3951,17 @@ gtk_window_real_set_focus (GtkWindow *window,
if (window->default_widget && if (window->default_widget &&
(def_flags != GTK_WIDGET_FLAGS (window->default_widget))) (def_flags != GTK_WIDGET_FLAGS (window->default_widget)))
gtk_widget_queue_draw (window->default_widget); gtk_widget_queue_draw (window->default_widget);
if (old_focus)
{
g_object_thaw_notify (G_OBJECT (old_focus));
g_object_unref (old_focus);
}
if (focus)
{
g_object_thaw_notify (G_OBJECT (focus));
g_object_unref (focus);
}
} }
/********************************* /*********************************
@ -4337,38 +4361,38 @@ gtk_window_move_resize (GtkWindow *window)
/* this is the position from the last configure notify */ /* this is the position from the last configure notify */
gdk_window_get_position (widget->window, &notify_x, &notify_y); gdk_window_get_position (widget->window, &notify_x, &notify_y);
g_print ("--- %s ---\n" g_message ("--- %s ---\n"
"last : %d,%d\t%d x %d\n" "last : %d,%d\t%d x %d\n"
"this : %d,%d\t%d x %d\n" "this : %d,%d\t%d x %d\n"
"alloc : %d,%d\t%d x %d\n" "alloc : %d,%d\t%d x %d\n"
"req : \t%d x %d\n" "req : \t%d x %d\n"
"resize: \t%d x %d\n" "resize: \t%d x %d\n"
"size_changed: %d pos_changed: %d hints_changed: %d\n" "size_changed: %d pos_changed: %d hints_changed: %d\n"
"configure_notify_received: %d\n" "configure_notify_received: %d\n"
"configure_request_count: %d\n" "configure_request_count: %d\n"
"position_constraints_changed: %d\n", "position_constraints_changed: %d\n",
window->title ? window->title : "(no title)", window->title ? window->title : "(no title)",
info->last.configure_request.x, info->last.configure_request.x,
info->last.configure_request.y, info->last.configure_request.y,
info->last.configure_request.width, info->last.configure_request.width,
info->last.configure_request.height, info->last.configure_request.height,
new_request.x, new_request.x,
new_request.y, new_request.y,
new_request.width, new_request.width,
new_request.height, new_request.height,
notify_x, notify_y, notify_x, notify_y,
widget->allocation.width, widget->allocation.width,
widget->allocation.height, widget->allocation.height,
widget->requisition.width, widget->requisition.width,
widget->requisition.height, widget->requisition.height,
info->resize_width, info->resize_width,
info->resize_height, info->resize_height,
configure_request_pos_changed, configure_request_pos_changed,
configure_request_size_changed, configure_request_size_changed,
hints_changed, hints_changed,
window->configure_notify_received, window->configure_notify_received,
window->configure_request_count, window->configure_request_count,
info->position_constraints_changed); info->position_constraints_changed);
} }
#endif #endif