Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7908)

Unified Diff: chrome/browser/ui/gtk/gtk_custom_menu_item.cc

Issue 8773025: GTK: More removal of raw GtkWidget->allocation access. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/gtk/gtk_chrome_link_button.cc ('k') | chrome/browser/ui/gtk/gtk_input_event_box.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/gtk_custom_menu_item.cc
diff --git a/chrome/browser/ui/gtk/gtk_custom_menu_item.cc b/chrome/browser/ui/gtk/gtk_custom_menu_item.cc
index fe0c0c140d8e0364c728784a698c4029018ab92e..61536b55b7f3093195b064e82713ee549e35d72c 100644
--- a/chrome/browser/ui/gtk/gtk_custom_menu_item.cc
+++ b/chrome/browser/ui/gtk/gtk_custom_menu_item.cc
@@ -205,16 +205,22 @@ static void gtk_custom_menu_item_expose_button(GtkWidget* hbox,
if (base::i18n::IsRTL())
std::swap(first_button, last_button);
- int x = first_button->allocation.x;
- int y = first_button->allocation.y;
- int width = last_button->allocation.width + last_button->allocation.x -
- first_button->allocation.x;
- int height = last_button->allocation.height;
+ GtkAllocation first_allocation;
+ gtk_widget_get_allocation(first_button, &first_allocation);
+ GtkAllocation current_allocation;
+ gtk_widget_get_allocation(current_button, &current_allocation);
+ GtkAllocation last_allocation;
+ gtk_widget_get_allocation(last_button, &last_allocation);
+
+ int x = first_allocation.x;
+ int y = first_allocation.y;
+ int width = last_allocation.width + last_allocation.x - first_allocation.x;
+ int height = last_allocation.height;
gtk_paint_box(hbox->style, hbox->window,
gtk_widget_get_state(current_button),
GTK_SHADOW_OUT,
- &current_button->allocation, hbox, "button",
+ &current_allocation, hbox, "button",
x, y, width, height);
// Propagate to the button's children.
@@ -248,16 +254,19 @@ static gboolean gtk_custom_menu_item_hbox_expose(GtkWidget* widget,
GList* next_item = g_list_next(current_item);
if (next_item && GTK_IS_BUTTON(next_item->data)) {
GtkWidget* current_button = GTK_WIDGET(current_item->data);
- GtkAllocation child_alloc =
- gtk_bin_get_child(GTK_BIN(current_button))->allocation;
+ GtkAllocation button_allocation;
+ gtk_widget_get_allocation(current_button, &button_allocation);
+ GtkAllocation child_alloc;
+ gtk_widget_get_allocation(gtk_bin_get_child(GTK_BIN(current_button)),
+ &child_alloc);
int half_offset = widget->style->xthickness / 2;
gtk_paint_vline(widget->style, widget->window,
gtk_widget_get_state(current_button),
&event->area, widget, "button",
child_alloc.y,
child_alloc.y + child_alloc.height,
- current_button->allocation.x +
- current_button->allocation.width - half_offset);
+ button_allocation.x +
+ button_allocation.width - half_offset);
}
}
}
@@ -368,7 +377,8 @@ void gtk_custom_menu_item_receive_motion_event(GtkCustomMenuItem* menu_item,
GList* current = menu_item->button_widgets;
for (; current != NULL; current = current->next) {
GtkWidget* current_widget = GTK_WIDGET(current->data);
- GtkAllocation alloc = current_widget->allocation;
+ GtkAllocation alloc;
+ gtk_widget_get_allocation(current_widget, &alloc);
int offset_x, offset_y;
gtk_widget_translate_coordinates(current_widget, GTK_WIDGET(menu_item),
0, 0, &offset_x, &offset_y);
« no previous file with comments | « chrome/browser/ui/gtk/gtk_chrome_link_button.cc ('k') | chrome/browser/ui/gtk/gtk_input_event_box.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698