[gtk+/rendering-cleanup-next] treeview: Get rid of gdk_drawable_get_size() usage



commit 75c49b09a783b44c93478de313d4c608b6385dfe
Author: Benjamin Otte <otte redhat com>
Date:   Mon Sep 20 16:44:30 2010 +0200

    treeview: Get rid of gdk_drawable_get_size() usage

 gtk/gtktreeview.c |   52 +++++++++++++++++++---------------------------------
 1 files changed, 19 insertions(+), 33 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 0fe5e54..a4f754c 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -2285,11 +2285,11 @@ gtk_tree_view_size_allocate_columns (GtkWidget *widget,
       if (column == tree_view->priv->drag_column)
 	{
 	  GtkAllocation drag_allocation;
-	  gdk_drawable_get_size (tree_view->priv->drag_window,
-				 &(drag_allocation.width),
-				 &(drag_allocation.height));
+
 	  drag_allocation.x = 0;
 	  drag_allocation.y = 0;
+          drag_allocation.width = gdk_window_get_width (tree_view->priv->drag_window);
+          drag_allocation.height = gdk_window_get_height (tree_view->priv->drag_window);
 	  gtk_widget_size_allocate (tree_view->priv->drag_column->button,
 				    &drag_allocation);
 	  width += drag_allocation.width;
@@ -4203,7 +4203,8 @@ invalidate_empty_focus (GtkTreeView *tree_view)
 
   area.x = 0;
   area.y = 0;
-  gdk_drawable_get_size (tree_view->priv->bin_window, &area.width, &area.height);
+  area.width = gdk_window_get_width (tree_view->priv->bin_window);
+  area.height = gdk_window_get_height (tree_view->priv->bin_window);
   gdk_window_invalidate_rect (tree_view->priv->bin_window, &area, FALSE);
 }
 
@@ -4219,10 +4220,8 @@ draw_empty_focus (GtkTreeView *tree_view, cairo_t *cr)
   if (!gtk_widget_has_focus (widget))
     return;
 
-  gdk_drawable_get_size (tree_view->priv->bin_window, &w, &h);
-
-  w -= 2;
-  h -= 2;
+  w = gdk_window_get_width (tree_view->priv->bin_window) - 2;
+  h = gdk_window_get_height (tree_view->priv->bin_window) - 2;
 
   if (w > 0 && h > 0)
     gtk_paint_focus (gtk_widget_get_style (widget),
@@ -4386,8 +4385,8 @@ gtk_tree_view_bin_draw (GtkWidget      *widget,
 
   style = gtk_widget_get_style (widget);
 
-  gdk_drawable_get_size (tree_view->priv->bin_window,
-                         &bin_window_width, &bin_window_height);
+  bin_window_width = gdk_window_get_width (tree_view->priv->bin_window);
+  bin_window_height = gdk_window_get_height (tree_view->priv->bin_window);
   cairo_rectangle (cr, 0, 0, bin_window_width, bin_window_height);
   cairo_clip (cr);
   if (!gdk_cairo_get_clip_rectangle (cr, &clip))
@@ -4857,7 +4856,6 @@ gtk_tree_view_bin_draw (GtkWidget      *widget,
           gint highlight_y = -1;
 	  GtkRBTree *tree = NULL;
 	  GtkRBNode *node = NULL;
-	  gint width;
 
           switch (tree_view->priv->drag_dest_pos)
             {
@@ -4877,8 +4875,6 @@ gtk_tree_view_bin_draw (GtkWidget      *widget,
 
 	      if (tree == NULL)
 		break;
-	      gdk_drawable_get_size (tree_view->priv->bin_window,
-				     &width, NULL);
 
 	      gtk_paint_focus (style,
 			       cr,
@@ -4889,8 +4885,9 @@ gtk_tree_view_bin_draw (GtkWidget      *widget,
 			        : (is_last ? "treeview-drop-indicator-right" : "tree-view-drop-indicator-middle" )),
 			        0, BACKGROUND_FIRST_PIXEL (tree_view, tree, node)
 			           - focus_line_width / 2,
-			        width, ROW_HEIGHT (tree_view, BACKGROUND_HEIGHT (node))
-			               - focus_line_width + 1);
+			        gdk_window_get_width (tree_view->priv->bin_window),
+                                ROW_HEIGHT (tree_view, BACKGROUND_HEIGHT (node))
+			           - focus_line_width + 1);
               break;
             }
 
@@ -4911,7 +4908,6 @@ gtk_tree_view_bin_draw (GtkWidget      *widget,
 	  gtk_widget_has_focus (widget))
         {
 	  gint tmp_y, tmp_height;
-	  gint width;
 	  GtkStateType focus_rect_state;
 
 	  focus_rect_state =
@@ -4920,9 +4916,6 @@ gtk_tree_view_bin_draw (GtkWidget      *widget,
 	     (flags & GTK_CELL_RENDERER_INSENSITIVE ? GTK_STATE_INSENSITIVE :
 	      GTK_STATE_NORMAL));
 
-	  gdk_drawable_get_size (tree_view->priv->bin_window,
-				 &width, NULL);
-	  
 	  if (draw_hgrid_lines)
 	    {
 	      tmp_y = BACKGROUND_FIRST_PIXEL (tree_view, tree, node) + grid_line_width / 2;
@@ -4942,7 +4935,8 @@ gtk_tree_view_bin_draw (GtkWidget      *widget,
 			    ? (is_last ? "treeview" : "treeview-left" )
 			    : (is_last ? "treeview-right" : "treeview-middle" )),
 			   0, tmp_y,
-			   width, tmp_height);
+			   gdk_window_get_width (tree_view->priv->bin_window),
+                           tmp_height);
         }
 
       y_offset += max_height;
@@ -9294,10 +9288,8 @@ gtk_tree_view_set_column_drag_info (GtkTreeView       *tree_view,
 	}
       else
 	{
-	  gint width;
-
-	  gdk_drawable_get_size (tree_view->priv->header_window, &width, NULL);
-	  reorder->right_align = width + TREE_VIEW_COLUMN_DRAG_DEAD_MULTIPLIER (tree_view);
+	  reorder->right_align = gdk_window_get_width (tree_view->priv->header_window)
+                                 + TREE_VIEW_COLUMN_DRAG_DEAD_MULTIPLIER (tree_view);
 	}
     }
 }
@@ -9310,7 +9302,6 @@ _gtk_tree_view_column_start_drag (GtkTreeView       *tree_view,
   GdkEvent *send_event;
   GtkAllocation allocation;
   GtkAllocation button_allocation;
-  gint x, y, width, height;
   GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (tree_view));
   GdkDisplay *display = gdk_screen_get_display (screen);
 
@@ -9394,9 +9385,6 @@ _gtk_tree_view_column_start_drag (GtkTreeView       *tree_view,
   tree_view->priv->drag_column = column;
   gdk_window_show (tree_view->priv->drag_window);
 
-  gdk_window_get_origin (tree_view->priv->header_window, &x, &y);
-  gdk_drawable_get_size (tree_view->priv->header_window, &width, &height);
-
   gtk_widget_grab_focus (GTK_WIDGET (tree_view));
   while (gtk_events_pending ())
     gtk_main_iteration ();
@@ -13766,8 +13754,7 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView  *tree_view,
   background_area.y = y;
   background_area.height = ROW_HEIGHT (tree_view, BACKGROUND_HEIGHT (node));
 
-  gdk_drawable_get_size (tree_view->priv->bin_window,
-                         &bin_window_width, NULL);
+  bin_window_width = gdk_window_get_width (tree_view->priv->bin_window);
 
   surface = gdk_window_create_similar_surface (tree_view->priv->bin_window,
                                                CAIRO_CONTENT_COLOR,
@@ -14215,9 +14202,8 @@ gtk_tree_view_search_position_func (GtkTreeView *tree_view,
   gtk_widget_realize (search_dialog);
 
   gdk_window_get_origin (tree_window, &tree_x, &tree_y);
-  gdk_drawable_get_size (tree_window,
-			 &tree_width,
-			 &tree_height);
+  tree_width = gdk_window_get_width (tree_window);
+  tree_height = gdk_window_get_height (tree_window);
   gtk_widget_size_request (search_dialog, &requisition);
 
   if (tree_x + tree_width > gdk_screen_get_width (screen))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]