diff options
-rw-r--r-- | chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc | 12 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/browser_window_gtk.cc | 7 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/find_bar_gtk.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/gtk_chrome_cookie_view.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/gtk_custom_menu_item.cc | 8 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/nine_box.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/status_icons/status_icon_gtk.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc | 10 | ||||
-rw-r--r-- | ui/base/gtk/gtk_compat.h | 20 | ||||
-rw-r--r-- | ui/gfx/gtk_preserve_window.cc | 14 | ||||
-rw-r--r-- | webkit/plugins/npapi/gtk_plugin_container_manager.cc | 2 |
11 files changed, 51 insertions, 32 deletions
diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc index 537ee5b..671a9c3 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc @@ -426,12 +426,12 @@ void BookmarkBarGtk::Show(BookmarkBar::State old_state, // probably be improved. if (bookmark_bar_state_ == BookmarkBar::DETACHED) { if (theme_service_->UsingNativeTheme()) { - if (GTK_WIDGET_REALIZED(event_box_->parent)) + if (gtk_widget_get_realized(event_box_->parent)) gdk_window_lower(event_box_->parent->window); - if (GTK_WIDGET_REALIZED(event_box_.get())) + if (gtk_widget_get_realized(event_box_.get())) gdk_window_lower(event_box_->window); } else { // Chromium theme mode. - if (GTK_WIDGET_REALIZED(paint_box_)) { + if (gtk_widget_get_realized(paint_box_)) { gdk_window_lower(paint_box_->window); // The event box won't stay below its children's GdkWindows unless we // toggle the above-child property here. If the event box doesn't stay @@ -1395,9 +1395,9 @@ gboolean BookmarkBarGtk::OnEventBoxExpose(GtkWidget* widget, GtkAllocation allocation; gtk_widget_get_allocation(widget, &allocation); - gfx::Rect area = GTK_WIDGET_NO_WINDOW(widget) ? - gfx::Rect(allocation) : - gfx::Rect(0, 0, allocation.width, allocation.height); + gfx::Rect area = gtk_widget_get_has_window(widget) ? + gfx::Rect(0, 0, allocation.width, allocation.height) : + gfx::Rect(allocation); NtpBackgroundUtil::PaintBackgroundDetachedMode(theme_provider, &canvas, area, tab_contents_size.height()); } diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index 5bf1daaf..1591207 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -1986,8 +1986,11 @@ int BrowserWindowGtk::GetXPositionOfLocationIcon(GtkWidget* relative_to) { (location_icon->allocation.width + 1) / 2, 0, &x, NULL); - if (GTK_WIDGET_NO_WINDOW(relative_to)) - x += relative_to->allocation.x; + if (!gtk_widget_get_has_window(relative_to)) { + GtkAllocation allocation; + gtk_widget_get_allocation(relative_to, &allocation); + x += allocation.x; + } return x; } diff --git a/chrome/browser/ui/gtk/find_bar_gtk.cc b/chrome/browser/ui/gtk/find_bar_gtk.cc index 90ad46e..4b9b317 100644 --- a/chrome/browser/ui/gtk/find_bar_gtk.cc +++ b/chrome/browser/ui/gtk/find_bar_gtk.cc @@ -342,7 +342,7 @@ void FindBarGtk::SetFocusAndSelection() { StoreOutsideFocus(); gtk_widget_grab_focus(text_entry_); // Select all the text. - gtk_entry_select_region(GTK_ENTRY(text_entry_), 0, -1); + gtk_editable_select_region(GTK_EDITABLE(text_entry_), 0, -1); } void FindBarGtk::ClearResults(const FindNotificationDetails& results) { @@ -391,7 +391,7 @@ void FindBarGtk::UpdateUIForFindResult(const FindNotificationDetails& result, std::string entry_text(gtk_entry_get_text(GTK_ENTRY(text_entry_))); if (entry_text != find_text_utf8) { SetFindText(find_text); - gtk_entry_select_region(GTK_ENTRY(text_entry_), 0, -1); + gtk_editable_select_region(GTK_EDITABLE(text_entry_), 0, -1); } if (!find_text.empty() && have_valid_range) { diff --git a/chrome/browser/ui/gtk/gtk_chrome_cookie_view.cc b/chrome/browser/ui/gtk/gtk_chrome_cookie_view.cc index b6b5ed3..97e411c 100644 --- a/chrome/browser/ui/gtk/gtk_chrome_cookie_view.cc +++ b/chrome/browser/ui/gtk/gtk_chrome_cookie_view.cc @@ -44,7 +44,7 @@ GtkWidget* InitDetailRow(int row, int label_id, GtkWidget* name_label = InitRowLabel(row, label_id, details_table); *entry = gtk_entry_new(); - gtk_entry_set_editable(GTK_ENTRY(*entry), FALSE); + gtk_editable_set_editable(GTK_EDITABLE(*entry), FALSE); gtk_entry_set_has_frame(GTK_ENTRY(*entry), FALSE); gtk_table_attach_defaults(GTK_TABLE(details_table), *entry, 1, 2, row, row + 1); diff --git a/chrome/browser/ui/gtk/gtk_custom_menu_item.cc b/chrome/browser/ui/gtk/gtk_custom_menu_item.cc index 61536b5..23f5d86 100644 --- a/chrome/browser/ui/gtk/gtk_custom_menu_item.cc +++ b/chrome/browser/ui/gtk/gtk_custom_menu_item.cc @@ -149,8 +149,8 @@ static void gtk_custom_menu_item_class_init(GtkCustomMenuItemClass* klass) { G_SIGNAL_RUN_FIRST, 0, NULL, NULL, - gtk_marshal_NONE__INT, - G_TYPE_NONE, 1, GTK_TYPE_INT); + g_cclosure_marshal_VOID__INT, + G_TYPE_NONE, 1, G_TYPE_INT); custom_menu_item_signals[TRY_BUTTON_PUSHED] = g_signal_new("try-button-pushed", G_TYPE_FROM_CLASS(gobject_class), @@ -158,7 +158,7 @@ static void gtk_custom_menu_item_class_init(GtkCustomMenuItemClass* klass) { 0, NULL, NULL, chrome_marshall_BOOLEAN__INT, - G_TYPE_BOOLEAN, 1, GTK_TYPE_INT); + G_TYPE_BOOLEAN, 1, G_TYPE_INT); } static void gtk_custom_menu_item_finalize(GObject *object) { @@ -172,7 +172,7 @@ static void gtk_custom_menu_item_finalize(GObject *object) { static gint gtk_custom_menu_item_expose(GtkWidget* widget, GdkEventExpose* event) { if (gtk_widget_get_visible(widget) && - GTK_WIDGET_MAPPED(widget) && + gtk_widget_get_mapped(widget) && gtk_bin_get_child(GTK_BIN(widget))) { // We skip the drawing in the GtkMenuItem class it draws the highlighted // background and we don't want that. diff --git a/chrome/browser/ui/gtk/nine_box.cc b/chrome/browser/ui/gtk/nine_box.cc index d43f308..3c3332d 100644 --- a/chrome/browser/ui/gtk/nine_box.cc +++ b/chrome/browser/ui/gtk/nine_box.cc @@ -142,7 +142,7 @@ void NineBox::RenderToWidgetWithOpacity(GtkWidget* dst, double opacity) const { // For widgets that have their own window, the allocation (x,y) coordinates // are GdkWindow relative. For other widgets, the coordinates are relative // to their container. - if (GTK_WIDGET_NO_WINDOW(dst)) { + if (!gtk_widget_get_has_window(dst)) { // Transform our cairo from window to widget coordinates. cairo_translate(cr, allocation.x, allocation.y); } diff --git a/chrome/browser/ui/gtk/status_icons/status_icon_gtk.cc b/chrome/browser/ui/gtk/status_icons/status_icon_gtk.cc index 93c5fc4..3f02e3e 100644 --- a/chrome/browser/ui/gtk/status_icons/status_icon_gtk.cc +++ b/chrome/browser/ui/gtk/status_icons/status_icon_gtk.cc @@ -39,7 +39,7 @@ void StatusIconGtk::SetPressedImage(const SkBitmap& image) { } void StatusIconGtk::SetToolTip(const string16& tool_tip) { - gtk_status_icon_set_tooltip(icon_, UTF16ToUTF8(tool_tip).c_str()); + gtk_status_icon_set_tooltip_text(icon_, UTF16ToUTF8(tool_tip).c_str()); } void StatusIconGtk::DisplayBalloon(const SkBitmap& icon, diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc index 3888294..5884cb1c 100644 --- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc @@ -4,8 +4,8 @@ #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" -#include <algorithm> #include <gtk/gtk.h> +#include <algorithm> #include "base/bind.h" #include "base/i18n/rtl.h" @@ -929,9 +929,11 @@ gfx::Point TabStripGtk::GetTabStripOriginForWidget(GtkWidget* target) { NOTREACHED(); } } - if (GTK_WIDGET_NO_WINDOW(target)) { - x += target->allocation.x; - y += target->allocation.y; + if (!gtk_widget_get_has_window(target)) { + GtkAllocation allocation; + gtk_widget_get_allocation(target, &allocation); + x += allocation.x; + y += allocation.y; } return gfx::Point(x, y); } diff --git a/ui/base/gtk/gtk_compat.h b/ui/base/gtk/gtk_compat.h index b9f7fd2..e5ef326 100644 --- a/ui/base/gtk/gtk_compat.h +++ b/ui/base/gtk/gtk_compat.h @@ -17,6 +17,10 @@ // alphabetically by method. #if !GTK_CHECK_VERSION(2, 20, 0) +inline gboolean gtk_widget_get_mapped(GtkWidget* widget) { + return GTK_WIDGET_MAPPED(widget); +} + inline gboolean gtk_widget_get_realized(GtkWidget* widget) { return GTK_WIDGET_REALIZED(widget); } @@ -24,6 +28,22 @@ inline gboolean gtk_widget_get_realized(GtkWidget* widget) { inline gboolean gtk_widget_is_toplevel(GtkWidget* widget) { return GTK_WIDGET_TOPLEVEL(widget); } + +inline void gtk_widget_set_mapped(GtkWidget* widget, + gboolean mapped) { + if (mapped) + GTK_WIDGET_SET_FLAGS(widget, GTK_MAPPED); + else + GTK_WIDGET_UNSET_FLAGS(widget, GTK_MAPPED); +} + +inline void gtk_widget_set_realized(GtkWidget* widget, + gboolean realized) { + if (realized) + GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED); + else + GTK_WIDGET_UNSET_FLAGS(widget, GTK_REALIZED); +} #endif #if !GTK_CHECK_VERSION(2, 22, 0) diff --git a/ui/gfx/gtk_preserve_window.cc b/ui/gfx/gtk_preserve_window.cc index 79ea818..2706f1e 100644 --- a/ui/gfx/gtk_preserve_window.cc +++ b/ui/gfx/gtk_preserve_window.cc @@ -52,7 +52,7 @@ static void gtk_preserve_window_init(GtkPreserveWindow* widget) { priv->preserve_window = FALSE; // These widgets always have their own window. - gtk_fixed_set_has_window(GTK_FIXED(widget), TRUE); + gtk_widget_set_has_window(GTK_WIDGET(widget), TRUE); } GtkWidget* gtk_preserve_window_new() { @@ -114,14 +114,10 @@ static void gtk_preserve_window_unrealize(GtkWidget* widget) { GtkContainerClass* container_class = GTK_CONTAINER_CLASS(gtk_preserve_window_parent_class); - // Deprecated as of GTK 2.22. Used for compatibility. - // It should be: gtk_widget_get_mapped() - if (GTK_WIDGET_MAPPED(widget)) { + if (gtk_widget_get_mapped(widget)) { widget_class->unmap(widget); - // Deprecated as of GTK 2.22. Used for compatibility. - // It should be: gtk_widget_set_mapped(widget, FALSE) - GTK_WIDGET_UNSET_FLAGS(widget, GTK_MAPPED); + gtk_widget_set_mapped(widget, FALSE); } // This is the behavior from GtkWidget, inherited by GtkFixed. @@ -136,9 +132,7 @@ static void gtk_preserve_window_unrealize(GtkWidget* widget) { gtk_selection_remove_all(widget); gdk_window_set_user_data(widget->window, NULL); - // Deprecated as of GTK 2.22. Used for compatibility. - // It should be: gtk_widget_set_realized(widget, FALSE) - GTK_WIDGET_UNSET_FLAGS(widget, GTK_REALIZED); + gtk_widget_set_realized(widget, FALSE); } else { GTK_WIDGET_CLASS(gtk_preserve_window_parent_class)->unrealize(widget); } diff --git a/webkit/plugins/npapi/gtk_plugin_container_manager.cc b/webkit/plugins/npapi/gtk_plugin_container_manager.cc index 79897e2..8ccf5f4 100644 --- a/webkit/plugins/npapi/gtk_plugin_container_manager.cc +++ b/webkit/plugins/npapi/gtk_plugin_container_manager.cc @@ -66,7 +66,7 @@ void GtkPluginContainerManager::MovePluginContainer( if (!widget) return; - DCHECK(!GTK_WIDGET_NO_WINDOW(widget)); + DCHECK(gtk_widget_get_has_window(widget)); if (!move.visible) { gtk_widget_hide(widget); |