Remove deprecated member access
[projects/chimara/chimara.git] / libchimara / window.c
index e54dfc3ae0f8cf4110333f3d566dc4114195be3b..fb7311e7280a09f0c1300fa026630a2221fcb1c3 100644 (file)
@@ -127,8 +127,6 @@ glk_window_iterate(winid_t win, glui32 *rockptr)
        if(retval && rockptr)
                *rockptr = glk_window_get_rock(retval);
                
-       if(retval)
-               printf("Returning window of type %d and rock %d\n", retval->type, retval->rock);
        return retval;
 }
 
@@ -418,16 +416,16 @@ glk_window_get_root()
  *  A   C   
  * </literallayout></textobject></mediaobject></entry> 
  * </row></tbody></tgroup></informaltable>
- * After the first split, the new pair window (O1, which covers the whole
- * screen) knows that its first child (A) is above the second, and gets 50% of
- * its own area. (A is the key window for this split, but a proportional split
- * doesn't care about key windows.)
+ * The initial window is A. After the first split, the new pair window (O1,
+ * which covers the whole screen) knows that its new child (B) is below A, and
+ * gets 50% of its own area. (B is the key window for this split, but a
+ * proportional split doesn't care about key windows.)
  * 
- * After the second split, all this remains true; O1 knows that its first child
- * gets 50% of its space, and A is O1's key window. But now O1's first child is
- * O2 instead of A. The newer pair window (O2) knows that its first child (C)
- * is above the second, and gets a fixed size of two rows. (As measured in C's
- * font, because C is O2's key window.)
+ * After the <emphasis>second</emphasis> split, all this remains true; O1 knows
+ * that its first child gets 50% of its space, and B is O1's key window. But
+ * now O1's first child is O2 instead of A. The newer pair window (O2) knows
+ * that its first child (C) is above the second, and gets a fixed size of two
+ * rows. (As measured in C's font, because C is O2's key window.)
  * 
  * If we split C, now, the resulting pair will still be two C-font rows high
  * &mdash; that is, tall enough for two lines of whatever font C displays. For
@@ -1010,13 +1008,19 @@ glk_window_clear(winid_t win)
 
                case wintype_Graphics:
                {
+                       GtkAllocation allocation;
+
                        /* Wait for the window's size to be updated */
                        g_mutex_lock(glk_data->arrange_lock);
                        if(glk_data->needs_rearrange)
                                g_cond_wait(glk_data->rearranged, glk_data->arrange_lock);
                        g_mutex_unlock(glk_data->arrange_lock);
 
-                       glk_window_erase_rect(win, 0, 0, win->widget->allocation.width, win->widget->allocation.height);
+                       gdk_threads_enter();
+                       gtk_widget_get_allocation(win->widget, &allocation);
+                       gdk_threads_leave();
+
+                       glk_window_erase_rect(win, 0, 0, allocation.width, allocation.height);
                }
                        break;
                
@@ -1136,6 +1140,7 @@ glk_window_get_size(winid_t win, glui32 *widthptr, glui32 *heightptr)
 {
        VALID_WINDOW(win, return);
 
+       GtkAllocation allocation;
        ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key);
        
     switch(win->type)
@@ -1156,9 +1161,10 @@ glk_window_get_size(winid_t win, glui32 *widthptr, glui32 *heightptr)
                        g_mutex_unlock(glk_data->arrange_lock);
                        
                        gdk_threads_enter();
+                       gtk_widget_get_allocation(win->widget, &allocation);
                        /* Cache the width and height */
-                       win->width = (glui32)(win->widget->allocation.width / win->unit_width);
-                   win->height = (glui32)(win->widget->allocation.height / win->unit_height);
+                       win->width = (glui32)(allocation.width / win->unit_width);
+                   win->height = (glui32)(allocation.height / win->unit_height);
             gdk_threads_leave();
                        
             if(widthptr != NULL)
@@ -1175,10 +1181,11 @@ glk_window_get_size(winid_t win, glui32 *widthptr, glui32 *heightptr)
                        g_mutex_unlock(glk_data->arrange_lock);
                        
             gdk_threads_enter();
+            gtk_widget_get_allocation(win->widget, &allocation);
             if(widthptr != NULL)
-                *widthptr = (glui32)(win->widget->allocation.width / win->unit_width);
+                *widthptr = (glui32)(allocation.width / win->unit_width);
             if(heightptr != NULL)
-                *heightptr = (glui32)(win->widget->allocation.height / win->unit_height);
+                *heightptr = (glui32)(allocation.height / win->unit_height);
             gdk_threads_leave();
             
             break;
@@ -1190,10 +1197,11 @@ glk_window_get_size(winid_t win, glui32 *widthptr, glui32 *heightptr)
                        g_mutex_unlock(glk_data->arrange_lock);
                        
             gdk_threads_enter();
+            gtk_widget_get_allocation(win->widget, &allocation);
             if(widthptr != NULL)
-                *widthptr = (glui32)(win->widget->allocation.width);
+                *widthptr = (glui32)(allocation.width);
             if(heightptr != NULL)
-                *heightptr = (glui32)(win->widget->allocation.height);
+                *heightptr = (glui32)(allocation.height);
             gdk_threads_leave();
             
             break;