diff options
Diffstat (limited to 'chrome')
35 files changed, 85 insertions, 93 deletions
diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc index ff8eca1..0ac3a1a 100644 --- a/chrome/browser/chromeos/login/screen_locker.cc +++ b/chrome/browser/chromeos/login/screen_locker.cc @@ -229,7 +229,7 @@ class LockWindow : public views::NativeWidgetGtk { // Sets the widget to move the focus to when clearning the native // widget's focus. void set_toplevel_focus_widget(GtkWidget* widget) { - gtk_widget_set_can_focus(widget, TRUE); + GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS); toplevel_focus_widget_ = widget; } diff --git a/chrome/browser/chromeos/native_dialog_window.cc b/chrome/browser/chromeos/native_dialog_window.cc index 0af1279..48c959d 100644 --- a/chrome/browser/chromeos/native_dialog_window.cc +++ b/chrome/browser/chromeos/native_dialog_window.cc @@ -33,7 +33,7 @@ GtkWidget* GetDialogDefaultWidget(GtkDialog* dialog) { GList* current = children; while (current) { GtkWidget* widget = reinterpret_cast<GtkWidget*>(current->data); - if (gtk_widget_has_default(widget)) { + if (GTK_WIDGET_HAS_DEFAULT(widget)) { default_widget = widget; break; } diff --git a/chrome/browser/platform_util_common_linux.cc b/chrome/browser/platform_util_common_linux.cc index 47f9888..8b8be92 100644 --- a/chrome/browser/platform_util_common_linux.cc +++ b/chrome/browser/platform_util_common_linux.cc @@ -77,7 +77,7 @@ void ActivateWindow(gfx::NativeWindow window) { } bool IsVisible(gfx::NativeView view) { - return gtk_widget_get_visible(view); + return GTK_WIDGET_VISIBLE(view); } void SimpleErrorBox(gfx::NativeWindow parent, diff --git a/chrome/browser/renderer_host/gtk_key_bindings_handler.cc b/chrome/browser/renderer_host/gtk_key_bindings_handler.cc index 9a0179d..52b1b6b 100644 --- a/chrome/browser/renderer_host/gtk_key_bindings_handler.cc +++ b/chrome/browser/renderer_host/gtk_key_bindings_handler.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -54,7 +54,7 @@ GtkWidget* GtkKeyBindingsHandler::CreateNewHandler() { // Prevents it from handling any events by itself. gtk_widget_set_sensitive(GTK_WIDGET(handler), FALSE); gtk_widget_set_events(GTK_WIDGET(handler), 0); - gtk_widget_set_can_focus(GTK_WIDGET(handler), TRUE); + GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(handler), GTK_CAN_FOCUS); #if !GTK_CHECK_VERSION(2, 14, 0) // "move-focus", "move-viewport", "select-all" and "toggle-cursor-visible" diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc index c6aeee0..5098093 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc @@ -119,7 +119,7 @@ class RenderWidgetHostViewGtkWidget { GDK_FOCUS_CHANGE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); - gtk_widget_set_can_focus(widget, TRUE); + GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS); g_signal_connect(widget, "expose-event", G_CALLBACK(OnExposeEvent), host_view); @@ -321,7 +321,7 @@ class RenderWidgetHostViewGtkWidget { // TODO(evanm): why is this necessary here but not in test shell? // This logic is the same as GtkButton. - if (event->type == GDK_BUTTON_PRESS && !gtk_widget_has_focus(widget)) + if (event->type == GDK_BUTTON_PRESS && !GTK_WIDGET_HAS_FOCUS(widget)) gtk_widget_grab_focus(widget); host_view->is_popup_first_mouse_release_ = false; @@ -695,7 +695,8 @@ void RenderWidgetHostViewGtk::Hide() { } bool RenderWidgetHostViewGtk::IsShowing() { - return gtk_widget_get_visible(view_.get()); + // TODO(jcivelli): use gtk_widget_get_visible once we build with GTK 2.18. + return (GTK_WIDGET_FLAGS(view_.get()) & GTK_VISIBLE) != 0; } gfx::Rect RenderWidgetHostViewGtk::GetViewBounds() const { diff --git a/chrome/browser/ui/browser_list_gtk.cc b/chrome/browser/ui/browser_list_gtk.cc index 3934345..bb01d4d 100644 --- a/chrome/browser/ui/browser_list_gtk.cc +++ b/chrome/browser/ui/browser_list_gtk.cc @@ -18,7 +18,7 @@ void BrowserList::AllBrowsersClosedAndAppExiting() { // window or the toplevel associated with drop down windows crashes. // We further filter to only close dialogs, as blindly closing all windows // causes problems with things like status icons. - if (gtk_widget_get_visible(GTK_WIDGET(window)) && + if (GTK_WIDGET_VISIBLE(GTK_WIDGET(window)) && (GTK_IS_DIALOG(GTK_WIDGET(window)))) gtk_widget_destroy(GTK_WIDGET(window)); } diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc index 9c3c0c0..a0902d9 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc @@ -510,7 +510,7 @@ void BookmarkBarGtk::SetInstructionState() { } void BookmarkBarGtk::SetChevronState() { - if (!gtk_widget_get_visible(bookmark_hbox_)) + if (!GTK_WIDGET_VISIBLE(bookmark_hbox_)) return; if (show_instructions_) { @@ -519,7 +519,7 @@ void BookmarkBarGtk::SetChevronState() { } int extra_space = 0; - if (gtk_widget_get_visible(overflow_button_)) + if (GTK_WIDGET_VISIBLE(overflow_button_)) extra_space = overflow_button_->allocation.width; int overflow_idx = GetFirstHiddenBookmark(extra_space, NULL); @@ -1103,7 +1103,7 @@ gboolean BookmarkBarGtk::OnButtonPressed(GtkWidget* sender, GdkEventButton* event) { last_pressed_coordinates_ = gfx::Point(event->x, event->y); - if (event->button == 3 && gtk_widget_get_visible(bookmark_hbox_)) { + if (event->button == 3 && GTK_WIDGET_VISIBLE(bookmark_hbox_)) { const BookmarkNode* node = GetNodeForToolButton(sender); DCHECK(node); DCHECK(page_navigator_); diff --git a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc index 9c6e71c8..e1b0577 100644 --- a/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc +++ b/chrome/browser/ui/gtk/browser_actions_toolbar_gtk.cc @@ -392,8 +392,7 @@ BrowserActionsToolbarGtk::BrowserActionsToolbarGtk(Browser* browser) GtkWidget* gripper = gtk_button_new(); gtk_widget_set_size_request(gripper, kResizeGripperWidth, -1); - gtk_widget_set_can_focus(gripper, FALSE); - + GTK_WIDGET_UNSET_FLAGS(gripper, GTK_CAN_FOCUS); gtk_widget_add_events(gripper, GDK_POINTER_MOTION_MASK); signals_.Connect(gripper, "motion-notify-event", G_CALLBACK(OnGripperMotionNotifyThunk), this); @@ -598,7 +597,7 @@ void BrowserActionsToolbarGtk::BrowserActionAdded(const Extension* extension, return; // Animate the addition if we are showing all browser action buttons. - if (!gtk_widget_get_visible(overflow_area_)) { + if (!GTK_WIDGET_VISIBLE(overflow_area_)) { AnimateToShowNIcons(button_count()); model_->SetVisibleIconCount(button_count()); } @@ -615,7 +614,7 @@ void BrowserActionsToolbarGtk::BrowserActionRemoved( RemoveButtonForExtension(extension); - if (!gtk_widget_get_visible(overflow_area_)) { + if (!GTK_WIDGET_VISIBLE(overflow_area_)) { AnimateToShowNIcons(button_count()); model_->SetVisibleIconCount(button_count()); } @@ -733,7 +732,7 @@ void BrowserActionsToolbarGtk::UpdateChevronVisibility() { } if (button_count() > showing_icon_count) { - if (!gtk_widget_get_visible(overflow_area_)) { + if (!GTK_WIDGET_VISIBLE(overflow_area_)) { if (drag_button_) { // During drags, when the overflow chevron shows for the first time, // take that much space away from |button_hbox_| to make the drag look diff --git a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc index b8389a0..71fadf1 100644 --- a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc +++ b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc @@ -211,7 +211,7 @@ void BrowserToolbarGtk::Init(Profile* profile, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)).c_str()); g_signal_connect(wrench_button, "button-press-event", G_CALLBACK(OnMenuButtonPressEventThunk), this); - gtk_widget_set_can_focus(wrench_button, FALSE); + GTK_WIDGET_UNSET_FLAGS(wrench_button, GTK_CAN_FOCUS); // Put the wrench button in a box so that we can paint the update notification // over it. @@ -301,7 +301,7 @@ void BrowserToolbarGtk::EnabledStateChangedForCommand(int id, bool enabled) { break; } if (widget) { - if (!enabled && gtk_widget_get_state(widget) == GTK_STATE_PRELIGHT) { + if (!enabled && GTK_WIDGET_STATE(widget) == GTK_STATE_PRELIGHT) { // If we're disabling a widget, GTK will helpfully restore it to its // previous state when we re-enable it, even if that previous state // is the prelight. This looks bad. See the bug for a simple repro. diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index 28b4ade..a3d5fec 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -2075,7 +2075,7 @@ gboolean BrowserWindowGtk::OnButtonPressEvent(GtkWidget* widget, // Ignore clicks that are in/below the browser toolbar. GtkWidget* toolbar = toolbar_->widget(); - if (!gtk_widget_get_visible(toolbar)) { + if (!GTK_WIDGET_VISIBLE(toolbar)) { // If the toolbar is not showing, use the location of web contents as the // boundary of where to ignore clicks. toolbar = render_area_vbox_; diff --git a/chrome/browser/ui/gtk/crypto_module_password_dialog.cc b/chrome/browser/ui/gtk/crypto_module_password_dialog.cc index b9c9f6e..7713b2f 100644 --- a/chrome/browser/ui/gtk/crypto_module_password_dialog.cc +++ b/chrome/browser/ui/gtk/crypto_module_password_dialog.cc @@ -122,7 +122,7 @@ CryptoModulePasswordDialog::CryptoModulePasswordDialog( IDS_CRYPTO_MODULE_AUTH_DIALOG_OK_BUTTON_LABEL).c_str(), GTK_STOCK_OK, GTK_RESPONSE_ACCEPT); - gtk_widget_set_can_default(ok_button, TRUE); + GTK_WIDGET_SET_FLAGS(ok_button, GTK_CAN_DEFAULT); gtk_dialog_set_default_response(GTK_DIALOG(dialog_), GTK_RESPONSE_ACCEPT); // Select an appropriate text for the reason. diff --git a/chrome/browser/ui/gtk/custom_button.cc b/chrome/browser/ui/gtk/custom_button.cc index a46e244..9cd2d98 100644 --- a/chrome/browser/ui/gtk/custom_button.cc +++ b/chrome/browser/ui/gtk/custom_button.cc @@ -71,7 +71,7 @@ gboolean CustomDrawButtonBase::OnExpose(GtkWidget* widget, GdkEventExpose* e, gdouble hover_state) { int paint_state = paint_override_ >= 0 ? - paint_override_ : gtk_widget_get_state(widget); + paint_override_ : GTK_WIDGET_STATE(widget); // If the paint state is PRELIGHT then set it to NORMAL (we will paint the // hover state according to |hover_state_|). @@ -273,7 +273,7 @@ CustomDrawButton::~CustomDrawButton() { void CustomDrawButton::Init() { widget_.Own(gtk_chrome_button_new()); - gtk_widget_set_can_focus(widget(), FALSE); + GTK_WIDGET_UNSET_FLAGS(widget(), GTK_CAN_FOCUS); g_signal_connect(widget(), "expose-event", G_CALLBACK(OnCustomExposeThunk), this); hover_controller_.Init(widget()); diff --git a/chrome/browser/ui/gtk/download/download_item_gtk.cc b/chrome/browser/ui/gtk/download/download_item_gtk.cc index 19238769..e189c93 100644 --- a/chrome/browser/ui/gtk/download/download_item_gtk.cc +++ b/chrome/browser/ui/gtk/download/download_item_gtk.cc @@ -116,7 +116,7 @@ DownloadItemGtk::DownloadItemGtk(DownloadShelfGtk* parent_shelf, G_CALLBACK(OnClickThunk), this); g_signal_connect(body_.get(), "button-press-event", G_CALLBACK(OnButtonPressThunk), this); - gtk_widget_set_can_focus(body_.get(), FALSE); + GTK_WIDGET_UNSET_FLAGS(body_.get(), GTK_CAN_FOCUS); // Remove internal padding on the button. GtkRcStyle* no_padding_style = gtk_rc_style_new(); no_padding_style->xthickness = 0; @@ -156,7 +156,7 @@ DownloadItemGtk::DownloadItemGtk(DownloadShelfGtk* parent_shelf, menu_button_ = gtk_button_new(); gtk_widget_set_app_paintable(menu_button_, TRUE); - gtk_widget_set_can_focus(menu_button_, FALSE); + GTK_WIDGET_UNSET_FLAGS(menu_button_, GTK_CAN_FOCUS); g_signal_connect(menu_button_, "expose-event", G_CALLBACK(OnExposeThunk), this); g_signal_connect(menu_button_, "button-press-event", @@ -716,7 +716,7 @@ gboolean DownloadItemGtk::OnHboxExpose(GtkWidget* widget, GdkEventExpose* e) { GtkShadowType body_shadow = GTK_BUTTON(body_.get())->depressed ? GTK_SHADOW_IN : GTK_SHADOW_OUT; gtk_paint_box(style, widget->window, - gtk_widget_get_state(body_.get()), + static_cast<GtkStateType>(GTK_WIDGET_STATE(body_.get())), body_shadow, &left_clip, widget, "button", x, y, width, height); @@ -724,7 +724,7 @@ gboolean DownloadItemGtk::OnHboxExpose(GtkWidget* widget, GdkEventExpose* e) { GtkShadowType menu_shadow = GTK_BUTTON(menu_button_)->depressed ? GTK_SHADOW_IN : GTK_SHADOW_OUT; gtk_paint_box(style, widget->window, - gtk_widget_get_state(menu_button_), + static_cast<GtkStateType>(GTK_WIDGET_STATE(menu_button_)), menu_shadow, &right_clip, widget, "button", x, y, width, height); @@ -735,7 +735,7 @@ gboolean DownloadItemGtk::OnHboxExpose(GtkWidget* widget, GdkEventExpose* e) { // the conservative side). GtkAllocation arrow_allocation = arrow_->allocation; gtk_paint_vline(style, widget->window, - gtk_widget_get_state(widget), + static_cast<GtkStateType>(GTK_WIDGET_STATE(widget)), &e->area, widget, "button", arrow_allocation.y, arrow_allocation.y + arrow_allocation.height, @@ -751,9 +751,9 @@ gboolean DownloadItemGtk::OnExpose(GtkWidget* widget, GdkEventExpose* e) { NineBox* nine_box = NULL; // If true, this widget is |body_|, otherwise it is |menu_button_|. - if (gtk_widget_get_state(widget) == GTK_STATE_PRELIGHT) + if (GTK_WIDGET_STATE(widget) == GTK_STATE_PRELIGHT) nine_box = is_body ? body_nine_box_prelight_ : menu_nine_box_prelight_; - else if (gtk_widget_get_state(widget) == GTK_STATE_ACTIVE) + else if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE) nine_box = is_body ? body_nine_box_active_ : menu_nine_box_active_; else nine_box = is_body ? body_nine_box_normal_ : menu_nine_box_normal_; diff --git a/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc b/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc index 825e042..767e4a8 100644 --- a/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc @@ -144,8 +144,8 @@ void ExtensionInstalledBubbleGtk::ShowInternal() { // If the widget is not visible then browser_window could be incognito // with this extension disabled. Try showing it on the chevron. // If that fails, fall back to default position. - if (reference_widget && !gtk_widget_get_visible(reference_widget)) { - reference_widget = gtk_widget_get_visible(toolbar->chevron()) ? + if (reference_widget && !GTK_WIDGET_VISIBLE(reference_widget)) { + reference_widget = GTK_WIDGET_VISIBLE(toolbar->chevron()) ? toolbar->chevron() : NULL; } } else if (type_ == PAGE_ACTION) { diff --git a/chrome/browser/ui/gtk/find_bar_gtk.cc b/chrome/browser/ui/gtk/find_bar_gtk.cc index 1c8914f..439a815 100644 --- a/chrome/browser/ui/gtk/find_bar_gtk.cc +++ b/chrome/browser/ui/gtk/find_bar_gtk.cc @@ -437,7 +437,7 @@ gfx::Rect FindBarGtk::GetDialogPosition(gfx::Rect avoid_overlapping_rect) { } bool FindBarGtk::IsFindBarVisible() { - return gtk_widget_get_visible(widget()); + return GTK_WIDGET_VISIBLE(widget()); } void FindBarGtk::RestoreSavedFocus() { @@ -686,7 +686,7 @@ void FindBarGtk::AdjustTextAlignment() { // Use keymap or widget direction if content does not have strong direction. // It matches the behavior of GtkEntry. if (content_dir == PANGO_DIRECTION_NEUTRAL) { - if (gtk_widget_has_focus(text_entry_)) { + if (GTK_WIDGET_HAS_FOCUS(text_entry_)) { content_dir = gdk_keymap_get_direction( gdk_keymap_get_for_display(gtk_widget_get_display(text_entry_))); } else { diff --git a/chrome/browser/ui/gtk/gtk_chrome_button.cc b/chrome/browser/ui/gtk/gtk_chrome_button.cc index 83b301f..d9ed9a2 100644 --- a/chrome/browser/ui/gtk/gtk_chrome_button.cc +++ b/chrome/browser/ui/gtk/gtk_chrome_button.cc @@ -85,14 +85,14 @@ static void gtk_chrome_button_init(GtkChromeButton* button) { priv->use_gtk_rendering = FALSE; priv->hover_state = -1.0; - gtk_widget_set_can_focus(GTK_WIDGET(button), FALSE); + GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS); } static gboolean gtk_chrome_button_expose(GtkWidget* widget, GdkEventExpose* event) { GtkChromeButtonPrivate *priv = GTK_CHROME_BUTTON_GET_PRIVATE(widget); int paint_state = priv->paint_state < 0 ? - gtk_widget_get_state(widget) : priv->paint_state; + GTK_WIDGET_STATE(widget) : priv->paint_state; if (priv->use_gtk_rendering) { // We have the superclass handle this expose when we aren't using custom diff --git a/chrome/browser/ui/gtk/gtk_chrome_link_button.cc b/chrome/browser/ui/gtk/gtk_chrome_link_button.cc index 2a3bf83..8aca67a 100644 --- a/chrome/browser/ui/gtk/gtk_chrome_link_button.cc +++ b/chrome/browser/ui/gtk/gtk_chrome_link_button.cc @@ -111,7 +111,7 @@ static void gtk_chrome_link_button_style_changed(GtkChromeLinkButton* button) { // changed his GTK style. gtk_chrome_link_button_set_text(button); - if (gtk_widget_get_visible(GTK_WIDGET(button))) + if (GTK_WIDGET_VISIBLE(button)) gtk_widget_queue_draw(GTK_WIDGET(button)); } @@ -120,10 +120,10 @@ static gboolean gtk_chrome_link_button_expose(GtkWidget* widget, GtkChromeLinkButton* button = GTK_CHROME_LINK_BUTTON(widget); GtkWidget* label = button->label; - if (gtk_widget_get_state(widget) == GTK_STATE_ACTIVE && button->is_normal) { + if (GTK_WIDGET_STATE(widget) == GTK_STATE_ACTIVE && button->is_normal) { gtk_label_set_markup(GTK_LABEL(label), button->pressed_markup); button->is_normal = FALSE; - } else if (gtk_widget_get_state(widget) != GTK_STATE_ACTIVE && + } else if (GTK_WIDGET_STATE(widget) != GTK_STATE_ACTIVE && !button->is_normal) { gtk_label_set_markup(GTK_LABEL(label), button->using_native_theme ? button->native_markup : @@ -135,9 +135,9 @@ static gboolean gtk_chrome_link_button_expose(GtkWidget* widget, gtk_container_propagate_expose(GTK_CONTAINER(widget), label, event); // Draw the focus rectangle. - if (gtk_widget_has_focus(widget)) { + if (GTK_WIDGET_HAS_FOCUS(widget)) { gtk_paint_focus(widget->style, widget->window, - gtk_widget_get_state(widget), + static_cast<GtkStateType>(GTK_WIDGET_STATE(widget)), &event->area, widget, NULL, widget->allocation.x, widget->allocation.y, widget->allocation.width, widget->allocation.height); @@ -228,7 +228,7 @@ void gtk_chrome_link_button_set_use_gtk_theme(GtkChromeLinkButton* button, gtk_chrome_link_button_set_text(button); - if (gtk_widget_get_visible(GTK_WIDGET(button))) + if (GTK_WIDGET_VISIBLE(button)) gtk_widget_queue_draw(GTK_WIDGET(button)); } } @@ -240,7 +240,7 @@ void gtk_chrome_link_button_set_label(GtkChromeLinkButton* button, gtk_chrome_link_button_set_text(button); - if (gtk_widget_get_visible(GTK_WIDGET(button))) + if (GTK_WIDGET_VISIBLE(button)) gtk_widget_queue_draw(GTK_WIDGET(button)); } @@ -255,7 +255,7 @@ void gtk_chrome_link_button_set_normal_color(GtkChromeLinkButton* button, gtk_chrome_link_button_set_text(button); - if (gtk_widget_get_visible(GTK_WIDGET(button))) + if (GTK_WIDGET_VISIBLE(button)) gtk_widget_queue_draw(GTK_WIDGET(button)); } diff --git a/chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.cc b/chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.cc index e549f86..4f8d857 100644 --- a/chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.cc +++ b/chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.cc @@ -27,12 +27,12 @@ struct SizeAllocateData { }; void CountVisibleChildren(GtkWidget* child, gpointer userdata) { - if (gtk_widget_get_visible(child)) + if (GTK_WIDGET_VISIBLE(child)) ++(*reinterpret_cast<int*>(userdata)); } void SumChildrenWidthRequisition(GtkWidget* child, gpointer userdata) { - if (gtk_widget_get_visible(child)) { + if (GTK_WIDGET_VISIBLE(child)) { GtkRequisition req; gtk_widget_get_child_requisition(child, &req); (*reinterpret_cast<int*>(userdata)) += std::max(req.width, 0); @@ -40,14 +40,14 @@ void SumChildrenWidthRequisition(GtkWidget* child, gpointer userdata) { } void ShowInvisibleChildren(GtkWidget* child, gpointer userdata) { - if (!gtk_widget_get_visible(child)) { + if (!GTK_WIDGET_VISIBLE(child)) { gtk_widget_show(child); ++(*reinterpret_cast<int*>(userdata)); } } void ChildSizeAllocate(GtkWidget* child, gpointer userdata) { - if (!gtk_widget_get_visible(child)) + if (!GTK_WIDGET_VISIBLE(child)) return; SizeAllocateData* data = reinterpret_cast<SizeAllocateData*>(userdata); diff --git a/chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox_unittest.cc b/chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox_unittest.cc index 17e7e48..226ebe7 100644 --- a/chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox_unittest.cc +++ b/chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox_unittest.cc @@ -198,7 +198,7 @@ class GtkChromeShrinkableHBoxTest : public testing::Test { NULL, NULL, &padding, NULL); ChildData data; - data.visible = gtk_widget_get_visible(child); + data.visible = GTK_WIDGET_VISIBLE(child); data.padding = padding; data.x = child->allocation.x; data.width = child->allocation.width; diff --git a/chrome/browser/ui/gtk/gtk_custom_menu_item.cc b/chrome/browser/ui/gtk/gtk_custom_menu_item.cc index fe0c0c1..4e54c21 100644 --- a/chrome/browser/ui/gtk/gtk_custom_menu_item.cc +++ b/chrome/browser/ui/gtk/gtk_custom_menu_item.cc @@ -171,7 +171,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) && + if (GTK_WIDGET_VISIBLE(widget) && GTK_WIDGET_MAPPED(widget) && gtk_bin_get_child(GTK_BIN(widget))) { // We skip the drawing in the GtkMenuItem class it draws the highlighted @@ -212,7 +212,8 @@ static void gtk_custom_menu_item_expose_button(GtkWidget* hbox, int height = last_button->allocation.height; gtk_paint_box(hbox->style, hbox->window, - gtk_widget_get_state(current_button), + static_cast<GtkStateType>( + GTK_WIDGET_STATE(current_button)), GTK_SHADOW_OUT, ¤t_button->allocation, hbox, "button", x, y, width, height); @@ -252,7 +253,8 @@ static gboolean gtk_custom_menu_item_hbox_expose(GtkWidget* widget, gtk_bin_get_child(GTK_BIN(current_button))->allocation; int half_offset = widget->style->xthickness / 2; gtk_paint_vline(widget->style, widget->window, - gtk_widget_get_state(current_button), + static_cast<GtkStateType>( + GTK_WIDGET_STATE(current_button)), &event->area, widget, "button", child_alloc.y, child_alloc.y + child_alloc.height, diff --git a/chrome/browser/ui/gtk/gtk_expanded_container.cc b/chrome/browser/ui/gtk/gtk_expanded_container.cc index 625de24..e0cf510 100644 --- a/chrome/browser/ui/gtk/gtk_expanded_container.cc +++ b/chrome/browser/ui/gtk/gtk_expanded_container.cc @@ -34,7 +34,7 @@ void GetChildPosition(GtkWidget* container, GtkWidget* child, int* x, int* y) { } void ChildSizeAllocate(GtkWidget* child, gpointer userdata) { - if (!gtk_widget_get_visible(child)) + if (!GTK_WIDGET_VISIBLE(child)) return; SizeAllocateData* data = reinterpret_cast<SizeAllocateData*>(userdata); diff --git a/chrome/browser/ui/gtk/gtk_floating_container.cc b/chrome/browser/ui/gtk/gtk_floating_container.cc index 5309fc4..e3891a6 100644 --- a/chrome/browser/ui/gtk/gtk_floating_container.cc +++ b/chrome/browser/ui/gtk/gtk_floating_container.cc @@ -147,7 +147,7 @@ static void gtk_floating_container_remove(GtkContainer* container, if (child->widget == widget) { removed_child = true; - gboolean was_visible = gtk_widget_get_visible(GTK_WIDGET(widget)); + gboolean was_visible = GTK_WIDGET_VISIBLE(widget); gtk_widget_unparent(widget); @@ -156,7 +156,7 @@ static void gtk_floating_container_remove(GtkContainer* container, g_list_free(children); g_free(child); - if (was_visible && gtk_widget_get_visible(GTK_WIDGET(container))) + if (was_visible && GTK_WIDGET_VISIBLE(container)) gtk_widget_queue_resize(GTK_WIDGET(container)); break; @@ -236,7 +236,7 @@ static void gtk_floating_container_size_allocate(GtkWidget* widget, reinterpret_cast<GtkFloatingContainerChild*>(children->data); children = children->next; - if (gtk_widget_get_visible(GTK_WIDGET(child->widget))) { + if (GTK_WIDGET_VISIBLE(child->widget)) { gtk_widget_size_request(child->widget, &child_requisition); child_allocation.x = allocation->x + child->x; child_allocation.y = allocation->y + child->y; diff --git a/chrome/browser/ui/gtk/gtk_util.cc b/chrome/browser/ui/gtk/gtk_util.cc index 8bdfa04..ff9604b 100644 --- a/chrome/browser/ui/gtk/gtk_util.cc +++ b/chrome/browser/ui/gtk/gtk_util.cc @@ -80,7 +80,7 @@ gboolean OnMouseButtonPressed(GtkWidget* widget, GdkEventButton* event, gpointer userdata) { if (event->type == GDK_BUTTON_PRESS) { if (gtk_button_get_focus_on_click(GTK_BUTTON(widget)) && - !gtk_widget_has_focus(widget)) { + !GTK_WIDGET_HAS_FOCUS(widget)) { gtk_widget_grab_focus(widget); } @@ -933,7 +933,7 @@ WindowOpenDisposition DispositionForCurrentButtonPressEvent() { bool GrabAllInput(GtkWidget* widget) { guint time = gtk_get_current_event_time(); - if (!gtk_widget_get_visible(widget)) + if (!GTK_WIDGET_VISIBLE(widget)) return false; if (!gdk_pointer_grab(widget->window, TRUE, @@ -1187,7 +1187,7 @@ string16 GetStockPreferencesMenuLabel() { bool IsWidgetAncestryVisible(GtkWidget* widget) { GtkWidget* parent = widget; - while (parent && gtk_widget_get_visible(parent)) + while (parent && GTK_WIDGET_VISIBLE(parent)) parent = parent->parent; return !parent; } diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc index a038b76..4047e23 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc @@ -130,7 +130,7 @@ const double kContentSettingBottomColor[] = { 0xff / 255.0, // If widget is visible, increment the int pointed to by count. // Suitible for use with gtk_container_foreach. void CountVisibleWidgets(GtkWidget* widget, gpointer count) { - if (gtk_widget_get_visible(widget)) + if (GTK_WIDGET_VISIBLE(widget)) *static_cast<int*>(count) += 1; } @@ -1158,13 +1158,10 @@ void LocationBarViewGtk::AdjustChildrenVisibility() { // Only one of |tab_to_search_alignment_| and |tab_to_search_hint_| can be // visible at the same time. - if (!show_selected_keyword_ && - gtk_widget_get_visible(tab_to_search_alignment_)) { + if (!show_selected_keyword_ && GTK_WIDGET_VISIBLE(tab_to_search_alignment_)) gtk_widget_hide(tab_to_search_alignment_); - } else if (!show_keyword_hint_ && - gtk_widget_get_visible(tab_to_search_hint_)) { + else if (!show_keyword_hint_ && GTK_WIDGET_VISIBLE(tab_to_search_hint_)) gtk_widget_hide(tab_to_search_hint_); - } if (show_selected_keyword_) { GtkRequisition box, full_label, partial_label; @@ -1174,7 +1171,7 @@ void LocationBarViewGtk::AdjustChildrenVisibility() { int full_partial_width_diff = full_label.width - partial_label.width; int full_box_width; int partial_box_width; - if (gtk_widget_get_visible(tab_to_search_full_label_)) { + if (GTK_WIDGET_VISIBLE(tab_to_search_full_label_)) { full_box_width = box.width; partial_box_width = full_box_width - full_partial_width_diff; } else { @@ -1267,10 +1264,6 @@ LocationBarViewGtk::ContentSettingImageViewGtk::~ContentSettingImageViewGtk() { content_setting_bubble_->Close(); } -bool LocationBarViewGtk::ContentSettingImageViewGtk::IsVisible() { - return gtk_widget_get_visible(widget()); -} - void LocationBarViewGtk::ContentSettingImageViewGtk::UpdateFromTabContents( TabContents* tab_contents) { content_setting_image_model_->UpdateFromTabContents(tab_contents); @@ -1469,10 +1462,6 @@ LocationBarViewGtk::PageActionViewGtk::~PageActionViewGtk() { g_object_unref(last_icon_pixbuf_); } -bool LocationBarViewGtk::PageActionViewGtk::IsVisible() { - return gtk_widget_get_visible(widget()); -} - void LocationBarViewGtk::PageActionViewGtk::UpdateVisibility( TabContents* contents, const GURL& url) { // Save this off so we can pass it back to the extension when the action gets diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.h b/chrome/browser/ui/gtk/location_bar_view_gtk.h index f76373c..75c981a 100644 --- a/chrome/browser/ui/gtk/location_bar_view_gtk.h +++ b/chrome/browser/ui/gtk/location_bar_view_gtk.h @@ -157,7 +157,7 @@ class LocationBarViewGtk : public AutocompleteEditController, void set_profile(Profile* profile) { profile_ = profile; } - bool IsVisible(); + bool IsVisible() { return GTK_WIDGET_VISIBLE(widget()); } void UpdateFromTabContents(TabContents* tab_contents); // Overridden from ui::AnimationDelegate: @@ -228,7 +228,7 @@ class LocationBarViewGtk : public AutocompleteEditController, preview_enabled_ = preview_enabled; } - bool IsVisible(); + bool IsVisible() { return GTK_WIDGET_VISIBLE(widget()); } // Called to notify the PageAction that it should determine whether to be // visible or hidden. |contents| is the TabContents that is active, |url| diff --git a/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc index af78f35..062470b 100644 --- a/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc +++ b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc @@ -287,7 +287,7 @@ void BalloonViewImpl::Show(Balloon* balloon) { gtk_widget_set_tooltip_text(close_button_->widget(), dismiss_text.c_str()); g_signal_connect(close_button_->widget(), "clicked", G_CALLBACK(OnCloseButtonThunk), this); - gtk_widget_set_can_focus(close_button_->widget(), FALSE); + GTK_WIDGET_UNSET_FLAGS(close_button_->widget(), GTK_CAN_FOCUS); GtkWidget* close_alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); gtk_alignment_set_padding(GTK_ALIGNMENT(close_alignment), kShelfVerticalMargin, kShelfVerticalMargin, @@ -304,7 +304,7 @@ void BalloonViewImpl::Show(Balloon* balloon) { options_text.c_str()); g_signal_connect(options_menu_button_->widget(), "button-press-event", G_CALLBACK(OnOptionsMenuButtonThunk), this); - gtk_widget_set_can_focus(options_menu_button_->widget(), FALSE); + GTK_WIDGET_UNSET_FLAGS(options_menu_button_->widget(), GTK_CAN_FOCUS); GtkWidget* options_alignment = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); gtk_alignment_set_padding(GTK_ALIGNMENT(options_alignment), kShelfVerticalMargin, kShelfVerticalMargin, diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc b/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc index d409577..bb8bfc2 100644 --- a/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc +++ b/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc @@ -280,7 +280,7 @@ OmniboxPopupViewGtk::OmniboxPopupViewGtk(const gfx::Font& font, font_(font.DeriveFont(kEditFontAdjust)), ignore_mouse_drag_(false), opened_(false) { - gtk_widget_set_can_focus(window_, FALSE); + GTK_WIDGET_UNSET_FLAGS(window_, GTK_CAN_FOCUS); // Don't allow the window to be resized. This also forces the window to // shrink down to the size of its child contents. gtk_window_set_resizable(GTK_WINDOW(window_), FALSE); diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc index 5a00a15..e8c5b8c 100644 --- a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc +++ b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc @@ -1257,7 +1257,7 @@ gboolean OmniboxViewGtk::HandleViewButtonPress(GtkWidget* sender, // determine whether we should select all of the text when the button is // released. button_1_pressed_ = true; - text_view_focused_before_button_press_ = gtk_widget_has_focus(text_view_); + text_view_focused_before_button_press_ = GTK_WIDGET_HAS_FOCUS(text_view_); text_selected_during_click_ = false; #endif @@ -1698,7 +1698,7 @@ void OmniboxViewGtk::HandleViewMoveFocus(GtkWidget* widget, handled = true; #endif - if (!handled && gtk_widget_get_visible(instant_view_)) + if (!handled && GTK_WIDGET_VISIBLE(instant_view_)) handled = model_->CommitSuggestedText(true); if (!handled) { diff --git a/chrome/browser/ui/gtk/reload_button_gtk.cc b/chrome/browser/ui/gtk/reload_button_gtk.cc index 86bff0a..9dd6a36 100644 --- a/chrome/browser/ui/gtk/reload_button_gtk.cc +++ b/chrome/browser/ui/gtk/reload_button_gtk.cc @@ -49,7 +49,7 @@ ReloadButtonGtk::ReloadButtonGtk(LocationBarViewGtk* location_bar, g_signal_connect(widget(), "expose-event", G_CALLBACK(OnExposeThunk), this); g_signal_connect(widget(), "leave-notify-event", G_CALLBACK(OnLeaveNotifyThunk), this); - gtk_widget_set_can_focus(widget(), FALSE); + GTK_WIDGET_UNSET_FLAGS(widget(), GTK_CAN_FOCUS); gtk_widget_set_has_tooltip(widget(), TRUE); g_signal_connect(widget(), "query-tooltip", G_CALLBACK(OnQueryTooltipThunk), @@ -83,7 +83,7 @@ void ReloadButtonGtk::ChangeMode(Mode mode, bool force) { // If the change is forced, or the user isn't hovering the icon, or it's safe // to change it to the other image type, make the change immediately; // otherwise we'll let it happen later. - if (force || ((gtk_widget_get_state(widget()) == GTK_STATE_NORMAL) && + if (force || ((GTK_WIDGET_STATE(widget()) == GTK_STATE_NORMAL) && !testing_mouse_hovered_) || ((mode == MODE_STOP) ? !double_click_timer_.IsRunning() : (visible_mode_ != MODE_STOP))) { double_click_timer_.Stop(); @@ -231,7 +231,8 @@ void ReloadButtonGtk::UpdateThemeButtons() { widget()->style, (visible_mode_ == MODE_RELOAD) ? GTK_STOCK_REFRESH : GTK_STOCK_STOP); if (icon_set) { - GtkStateType state = gtk_widget_get_state(widget()); + GtkStateType state = static_cast<GtkStateType>( + GTK_WIDGET_STATE(widget())); if (visible_mode_ == MODE_STOP && stop_.paint_override() != -1) state = static_cast<GtkStateType>(stop_.paint_override()); diff --git a/chrome/browser/ui/gtk/rounded_window.cc b/chrome/browser/ui/gtk/rounded_window.cc index 03d98d6..79e38e7 100644 --- a/chrome/browser/ui/gtk/rounded_window.cc +++ b/chrome/browser/ui/gtk/rounded_window.cc @@ -279,7 +279,7 @@ void ActAsRoundedWindow( g_object_set_data_full(G_OBJECT(widget), kRoundedData, data, FreeRoundedWindowData); - if (gtk_widget_get_visible(widget)) + if (GTK_WIDGET_VISIBLE(widget)) gtk_widget_queue_draw(widget); } @@ -289,7 +289,7 @@ void StopActingAsRoundedWindow(GtkWidget* widget) { if (GTK_WIDGET_REALIZED(widget)) gdk_window_shape_combine_mask(widget->window, NULL, 0, 0); - if (gtk_widget_get_visible(widget)) + if (GTK_WIDGET_VISIBLE(widget)) gtk_widget_queue_draw(widget); } diff --git a/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc b/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc index 6b1b2f8..aa25e15b 100644 --- a/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc +++ b/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc @@ -379,7 +379,7 @@ void SSLClientCertificateSelector::OnPromptShown(GtkWidget* widget, if (!root_widget_.get() || !GTK_WIDGET_TOPLEVEL(gtk_widget_get_toplevel(root_widget_.get()))) return; - gtk_widget_set_can_default(select_button_, TRUE); + GTK_WIDGET_SET_FLAGS(select_button_, GTK_CAN_DEFAULT); gtk_widget_grab_default(select_button_); } diff --git a/chrome/browser/ui/gtk/tabs/tab_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_gtk.cc index acc0957..3447826 100644 --- a/chrome/browser/ui/gtk/tabs/tab_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_gtk.cc @@ -236,7 +236,7 @@ bool TabGtk::IsSelected() const { } bool TabGtk::IsVisible() const { - return gtk_widget_get_visible(event_box_); + return GTK_WIDGET_FLAGS(event_box_) & GTK_VISIBLE; } void TabGtk::SetVisible(bool visible) const { diff --git a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc index 1ec659d..dda7ae0 100644 --- a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc @@ -358,7 +358,7 @@ bool TabRendererGtk::IsSelected() const { } bool TabRendererGtk::IsVisible() const { - return gtk_widget_get_visible(tab_.get()); + return GTK_WIDGET_FLAGS(tab_.get()) & GTK_VISIBLE; } void TabRendererGtk::SetVisible(bool visible) const { @@ -1016,7 +1016,7 @@ CustomDrawButton* TabRendererGtk::MakeCloseButton() { G_CALLBACK(OnEnterNotifyEventThunk), this); g_signal_connect(button->widget(), "leave-notify-event", G_CALLBACK(OnLeaveNotifyEventThunk), this); - gtk_widget_set_can_focus(button->widget(), FALSE); + GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS); gtk_fixed_put(GTK_FIXED(tab_.get()), button->widget(), 0, 0); return button; diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc index 130bc92..9a7c251 100644 --- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc @@ -1108,7 +1108,7 @@ void TabStripGtk::TabMiniStateChanged(TabContentsWrapper* contents, int index) { // Don't animate if the window isn't visible yet. The window won't be visible // when dragging a mini-tab to a new window. if (window_ && window_->window() && - gtk_widget_get_visible(GTK_WIDGET(window_->window()))) { + GTK_WIDGET_VISIBLE(GTK_WIDGET(window_->window()))) { StartMiniTabAnimation(index); } else { Layout(); @@ -2127,7 +2127,7 @@ CustomDrawButton* TabStripGtk::MakeNewTabButton() { gtk_util::SetButtonTriggersNavigation(button->widget()); g_signal_connect(button->widget(), "clicked", G_CALLBACK(OnNewTabClickedThunk), this); - gtk_widget_set_can_focus(button->widget(), FALSE); + GTK_WIDGET_UNSET_FLAGS(button->widget(), GTK_CAN_FOCUS); gtk_fixed_put(GTK_FIXED(tabstrip_.get()), button->widget(), 0, 0); return button; diff --git a/chrome/browser/ui/login/login_prompt_gtk.cc b/chrome/browser/ui/login/login_prompt_gtk.cc index a003729..670b466 100644 --- a/chrome/browser/ui/login/login_prompt_gtk.cc +++ b/chrome/browser/ui/login/login_prompt_gtk.cc @@ -176,7 +176,7 @@ void LoginHandlerGtk::OnPromptHierarchyChanged(GtkWidget* sender, // Now that we have attached ourself to the window, we can make our OK // button the default action and mess with the focus. - gtk_widget_set_can_default(ok_, TRUE); + GTK_WIDGET_SET_FLAGS(ok_, GTK_CAN_DEFAULT); gtk_widget_grab_default(ok_); } |