treeview: Get rid of gdk_drawable_get_size() usage

This commit is contained in:
Benjamin Otte 2010-09-20 16:44:30 +02:00
parent e10f5e9ad5
commit 21d6aba620

View File

@ -2287,11 +2287,11 @@ gtk_tree_view_size_allocate_columns (GtkWidget *widget,
if (column == tree_view->priv->drag_column) if (column == tree_view->priv->drag_column)
{ {
GtkAllocation drag_allocation; GtkAllocation drag_allocation;
gdk_drawable_get_size (tree_view->priv->drag_window,
&(drag_allocation.width),
&(drag_allocation.height));
drag_allocation.x = 0; drag_allocation.x = 0;
drag_allocation.y = 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, gtk_widget_size_allocate (tree_view->priv->drag_column->button,
&drag_allocation); &drag_allocation);
width += drag_allocation.width; width += drag_allocation.width;
@ -4205,7 +4205,8 @@ invalidate_empty_focus (GtkTreeView *tree_view)
area.x = 0; area.x = 0;
area.y = 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); gdk_window_invalidate_rect (tree_view->priv->bin_window, &area, FALSE);
} }
@ -4221,10 +4222,8 @@ draw_empty_focus (GtkTreeView *tree_view, cairo_t *cr)
if (!gtk_widget_has_focus (widget)) if (!gtk_widget_has_focus (widget))
return; return;
gdk_drawable_get_size (tree_view->priv->bin_window, &w, &h); w = gdk_window_get_width (tree_view->priv->bin_window) - 2;
h = gdk_window_get_height (tree_view->priv->bin_window) - 2;
w -= 2;
h -= 2;
if (w > 0 && h > 0) if (w > 0 && h > 0)
gtk_paint_focus (gtk_widget_get_style (widget), gtk_paint_focus (gtk_widget_get_style (widget),
@ -4388,8 +4387,8 @@ gtk_tree_view_bin_draw (GtkWidget *widget,
style = gtk_widget_get_style (widget); style = gtk_widget_get_style (widget);
gdk_drawable_get_size (tree_view->priv->bin_window, bin_window_width = gdk_window_get_width (tree_view->priv->bin_window);
&bin_window_width, &bin_window_height); bin_window_height = gdk_window_get_height (tree_view->priv->bin_window);
cairo_rectangle (cr, 0, 0, bin_window_width, bin_window_height); cairo_rectangle (cr, 0, 0, bin_window_width, bin_window_height);
cairo_clip (cr); cairo_clip (cr);
if (!gdk_cairo_get_clip_rectangle (cr, &clip)) if (!gdk_cairo_get_clip_rectangle (cr, &clip))
@ -4859,7 +4858,6 @@ gtk_tree_view_bin_draw (GtkWidget *widget,
gint highlight_y = -1; gint highlight_y = -1;
GtkRBTree *tree = NULL; GtkRBTree *tree = NULL;
GtkRBNode *node = NULL; GtkRBNode *node = NULL;
gint width;
switch (tree_view->priv->drag_dest_pos) switch (tree_view->priv->drag_dest_pos)
{ {
@ -4879,8 +4877,6 @@ gtk_tree_view_bin_draw (GtkWidget *widget,
if (tree == NULL) if (tree == NULL)
break; break;
gdk_drawable_get_size (tree_view->priv->bin_window,
&width, NULL);
gtk_paint_focus (style, gtk_paint_focus (style,
cr, cr,
@ -4891,8 +4887,9 @@ gtk_tree_view_bin_draw (GtkWidget *widget,
: (is_last ? "treeview-drop-indicator-right" : "tree-view-drop-indicator-middle" )), : (is_last ? "treeview-drop-indicator-right" : "tree-view-drop-indicator-middle" )),
0, BACKGROUND_FIRST_PIXEL (tree_view, tree, node) 0, BACKGROUND_FIRST_PIXEL (tree_view, tree, node)
- focus_line_width / 2, - focus_line_width / 2,
width, ROW_HEIGHT (tree_view, BACKGROUND_HEIGHT (node)) gdk_window_get_width (tree_view->priv->bin_window),
- focus_line_width + 1); ROW_HEIGHT (tree_view, BACKGROUND_HEIGHT (node))
- focus_line_width + 1);
break; break;
} }
@ -4913,7 +4910,6 @@ gtk_tree_view_bin_draw (GtkWidget *widget,
gtk_widget_has_focus (widget)) gtk_widget_has_focus (widget))
{ {
gint tmp_y, tmp_height; gint tmp_y, tmp_height;
gint width;
GtkStateType focus_rect_state; GtkStateType focus_rect_state;
focus_rect_state = focus_rect_state =
@ -4922,9 +4918,6 @@ gtk_tree_view_bin_draw (GtkWidget *widget,
(flags & GTK_CELL_RENDERER_INSENSITIVE ? GTK_STATE_INSENSITIVE : (flags & GTK_CELL_RENDERER_INSENSITIVE ? GTK_STATE_INSENSITIVE :
GTK_STATE_NORMAL)); GTK_STATE_NORMAL));
gdk_drawable_get_size (tree_view->priv->bin_window,
&width, NULL);
if (draw_hgrid_lines) if (draw_hgrid_lines)
{ {
tmp_y = BACKGROUND_FIRST_PIXEL (tree_view, tree, node) + grid_line_width / 2; tmp_y = BACKGROUND_FIRST_PIXEL (tree_view, tree, node) + grid_line_width / 2;
@ -4944,7 +4937,8 @@ gtk_tree_view_bin_draw (GtkWidget *widget,
? (is_last ? "treeview" : "treeview-left" ) ? (is_last ? "treeview" : "treeview-left" )
: (is_last ? "treeview-right" : "treeview-middle" )), : (is_last ? "treeview-right" : "treeview-middle" )),
0, tmp_y, 0, tmp_y,
width, tmp_height); gdk_window_get_width (tree_view->priv->bin_window),
tmp_height);
} }
y_offset += max_height; y_offset += max_height;
@ -9299,10 +9293,8 @@ gtk_tree_view_set_column_drag_info (GtkTreeView *tree_view,
} }
else else
{ {
gint width; reorder->right_align = gdk_window_get_width (tree_view->priv->header_window)
+ TREE_VIEW_COLUMN_DRAG_DEAD_MULTIPLIER (tree_view);
gdk_drawable_get_size (tree_view->priv->header_window, &width, NULL);
reorder->right_align = width + TREE_VIEW_COLUMN_DRAG_DEAD_MULTIPLIER (tree_view);
} }
} }
} }
@ -9315,7 +9307,6 @@ _gtk_tree_view_column_start_drag (GtkTreeView *tree_view,
GdkEvent *send_event; GdkEvent *send_event;
GtkAllocation allocation; GtkAllocation allocation;
GtkAllocation button_allocation; GtkAllocation button_allocation;
gint x, y, width, height;
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (tree_view)); GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (tree_view));
GdkDisplay *display = gdk_screen_get_display (screen); GdkDisplay *display = gdk_screen_get_display (screen);
@ -9399,9 +9390,6 @@ _gtk_tree_view_column_start_drag (GtkTreeView *tree_view,
tree_view->priv->drag_column = column; tree_view->priv->drag_column = column;
gdk_window_show (tree_view->priv->drag_window); 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)); gtk_widget_grab_focus (GTK_WIDGET (tree_view));
while (gtk_events_pending ()) while (gtk_events_pending ())
gtk_main_iteration (); gtk_main_iteration ();
@ -13772,8 +13760,7 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view,
background_area.y = y; background_area.y = y;
background_area.height = ROW_HEIGHT (tree_view, BACKGROUND_HEIGHT (node)); background_area.height = ROW_HEIGHT (tree_view, BACKGROUND_HEIGHT (node));
gdk_drawable_get_size (tree_view->priv->bin_window, bin_window_width = gdk_window_get_width (tree_view->priv->bin_window);
&bin_window_width, NULL);
surface = gdk_window_create_similar_surface (tree_view->priv->bin_window, surface = gdk_window_create_similar_surface (tree_view->priv->bin_window,
CAIRO_CONTENT_COLOR, CAIRO_CONTENT_COLOR,
@ -14221,9 +14208,8 @@ gtk_tree_view_search_position_func (GtkTreeView *tree_view,
gtk_widget_realize (search_dialog); gtk_widget_realize (search_dialog);
gdk_window_get_origin (tree_window, &tree_x, &tree_y); gdk_window_get_origin (tree_window, &tree_x, &tree_y);
gdk_drawable_get_size (tree_window, tree_width = gdk_window_get_width (tree_window);
&tree_width, tree_height = gdk_window_get_height (tree_window);
&tree_height);
gtk_size_request_get_size (GTK_SIZE_REQUEST (search_dialog), gtk_size_request_get_size (GTK_SIZE_REQUEST (search_dialog),
&requisition, NULL); &requisition, NULL);