GtkWindow changes
- From: Owen Taylor <otaylor redhat com>
- To: gtk-devel-list gnome org
- Cc: timj gtk org
- Subject: GtkWindow changes
- Date: 24 Sep 2001 16:40:26 -0400
To fix a lot of problems we are having with resizing
(http://bugzilla.gnome.org/show_bug.cgi?id=60623), I'm about
to commit the following patch to gtk_window_move_resize().
Clearly, this code hasn't been rewritten enough times ;-)
The main fix here is the change so that the check
(widget->allocation.width != new_request.width ||
widget->allocation.height != new_request.height))
Applies hints_changed as well as configure_request_changed -
there is a change to the pos_changed-only case as well to
run the resize queue immediately, partly as an optimization, but
also because I think we might not get a ConfigureNotify back,
especially if the new position is the same place as we
currently are.
Regards,
Owen
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.2325
diff -u -p -r1.2325 ChangeLog
--- ChangeLog 2001/09/24 16:54:39 1.2325
+++ ChangeLog 2001/09/24 20:20:26
@@ -1,3 +1,16 @@
+Mon Sep 24 15:09:08 2001 Owen Taylor <otaylor redhat com>
+
+ * gtk/gtkwindow.c (gtk_window_move_resize): Don't wait for a
+ response back from the window manager if our size hasn't changed
+ since we won't get a response back from the window manager;
+ there was code in there to do this, but it was in the wrong
+ place so if the hints change and the size didn't we'd expect
+ a response.
+
+ Also, optimize the position-only-changed case by running
+ the resize queue immediately, and clean up some comments
+ for the changes.
+
Mon Sep 24 12:48:25 2001 Owen Taylor <otaylor redhat com>
* gtk/gtknotebook.h: Add a compat macro that got lost.
Index: gtk/gtkwindow.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkwindow.c,v
retrieving revision 1.155
diff -u -p -r1.155 gtkwindow.c
--- gtk/gtkwindow.c 2001/09/24 16:54:41 1.155
+++ gtk/gtkwindow.c 2001/09/24 20:20:26
@@ -3959,34 +3959,9 @@ gtk_window_move_resize (GtkWindow *windo
info->last.configure_request.y != new_request.y)
configure_request_pos_changed = TRUE;
- /* To change, we must be different from BOTH the last request, and
- * also our current size as received from the most recent configure
- * notify.
- *
- * If different from last request, it means some sizing
- * parameters have changed; but one possible such sizing
- * parameter could be the current size.
- *
- * We never want to re-request our current size, because that could
- * lead to some strange infinite loops if a window manager did
- * something insane but ICCCM-compliant such as add 2 to all
- * requested sizes. (i.e. if the WM always assigned a size that
- * was a function of the requested size, rather than a constraint
- * applied to requested size - so that requesting current size
- * did not result in getting that size back)
- *
- * So here we detect and prevent any attempt to set size
- * to current size.
- *
- * (FIXME I think some race may be possible here, but
- * perhaps avoided by configure_request_count?)
- */
if ((info->last.configure_request.width != new_request.width ||
- info->last.configure_request.height != new_request.height) &&
- (widget->allocation.width != new_request.width ||
- widget->allocation.height != new_request.height))
+ info->last.configure_request.height != new_request.height))
configure_request_size_changed = TRUE;
-
hints_changed = FALSE;
@@ -4199,24 +4174,24 @@ gtk_window_move_resize (GtkWindow *windo
gtk_widget_queue_resize (widget); /* migth recurse for GTK_RESIZE_IMMEDIATE */
}
}
- else if (configure_request_pos_changed ||
- configure_request_size_changed ||
- hints_changed)
+ else if ((configure_request_size_changed || hints_changed) &&
+ (widget->allocation.width != new_request.width ||
+ widget->allocation.height != new_request.height))
+
{
/* We are in one of the following situations:
* A. configure_request_size_changed
* our requisition has changed and we need a different window size,
* so we request it from the window manager.
- * B. !configure_request_size_changed
- * the window manager wouldn't assign us the size we requested, in this
- * case we don't try to request a new size with every resize.
- * C. !configure_request_size_changed && hints_changed
+ * B. !configure_request_size_changed && hints_changed
* the window manager rejects our size, but we have just changed the
- * window manager hints, so there's a certain chance our request will
+ * window manager hints, so there's a chance our request will
* be honoured this time, so we try again.
- * D. configure_request_pos_changed
- * we need to move to a new position, in which case we can also request
- * a new size since any of A-C might also apply.
+ *
+ * However, if the new requisition is the same as the current allocation,
+ * we don't request it again, since we won't get a ConfigureNotify back from
+ * the window manager unless it decides to change our requisition. If
+ * we don't get the ConfigureNotify back, the resize queue will never be run.
*/
/* Now send the configure request */
@@ -4281,8 +4256,22 @@ gtk_window_move_resize (GtkWindow *windo
}
else
{
- /* Not requesting anything new from WM, just had a queue resize
- * for some reason, so handle the resize queue
+ /* Handle any position changes.
+ */
+ if (configure_request_pos_changed)
+ {
+ if (window->frame)
+ {
+ gdk_window_move (window->frame,
+ new_request.x - window->frame_left,
+ new_request.y - window->frame_top);
+ }
+ else
+ gdk_window_move (widget->window,
+ new_request.x, new_request.y);
+ }
+
+ /* And run the resize queue.
*/
if (container->resize_widgets)
gtk_container_resize_children (container);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]