[xiph-commits] r12515 - trunk/sushivision

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Fri Feb 23 03:01:13 PST 2007


Author: xiphmont
Date: 2007-02-23 03:01:12 -0800 (Fri, 23 Feb 2007)
New Revision: 12515

Modified:
   trunk/sushivision/gtksucks.c
   trunk/sushivision/gtksucks.h
Log:
Add new calls for freezing box packing sizes without queueing spurious resize events.



Modified: trunk/sushivision/gtksucks.c
===================================================================
--- trunk/sushivision/gtksucks.c	2007-02-22 17:03:27 UTC (rev 12514)
+++ trunk/sushivision/gtksucks.c	2007-02-23 11:01:12 UTC (rev 12515)
@@ -389,3 +389,62 @@
 
   return combo_box;
 }
+
+/**********************************************************************/
+/* Gtk has an annoying habit of 'overresizing'; superfluous resize
+   events within panels that cause all hell to break loose for a
+   while, only to have the panel finally look exactly like it did when
+   it started.  This happens especially with expander widgets.  There
+   are two problems: One, it's ugly as Hell to click an expander and
+   have the whole window freak out just to make a little space.
+   Second, having the Plot resize will trigger a recompute, which
+   could seriously screw the user.
+
+   The below lets us freeze/unfreeze an auto-resizing box's
+   child at its current size without queueing resize events. */
+
+void gtk_box_freeze_child (GtkBox *box,
+			   GtkWidget *child){
+  GList *list;
+  GtkBoxChild *child_info = NULL;
+
+  g_return_if_fail (GTK_IS_BOX (box));
+  g_return_if_fail (GTK_IS_WIDGET (child));
+
+  list = box->children;
+  while (list){
+    child_info = list->data;
+    if (child_info->widget == child)
+      break;
+
+    list = list->next;
+  }
+
+  if (list){
+    child_info->expand = FALSE;
+    child_info->fill = FALSE;
+  }
+}
+
+void gtk_box_unfreeze_child (GtkBox *box,
+			     GtkWidget *child){
+  GList *list;
+  GtkBoxChild *child_info = NULL;
+  
+  g_return_if_fail (GTK_IS_BOX (box));
+  g_return_if_fail (GTK_IS_WIDGET (child));
+
+  list = box->children;
+  while (list){
+    child_info = list->data;
+    if (child_info->widget == child)
+      break;
+
+    list = list->next;
+  }
+
+  if (list){
+    child_info->expand = TRUE;
+    child_info->fill = TRUE;
+  }
+}

Modified: trunk/sushivision/gtksucks.h
===================================================================
--- trunk/sushivision/gtksucks.h	2007-02-22 17:03:27 UTC (rev 12514)
+++ trunk/sushivision/gtksucks.h	2007-02-23 11:01:12 UTC (rev 12515)
@@ -42,4 +42,7 @@
 extern void gtk_menu_alter_item_right(GtkMenu *m, int pos, char *text);
 extern GtkWidget * gtk_combo_box_new_markup (void);
 
+extern void gtk_box_freeze_child (GtkBox *box, GtkWidget *child);
+extern void gtk_box_unfreeze_child (GtkBox *box, GtkWidget *child);
+
 #endif



More information about the commits mailing list