summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorerg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-15 20:00:09 +0000
committererg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-15 20:00:09 +0000
commitc24c7c8dcfaeafe953ec7e0d6067769a7f3172ff (patch)
tree466654581551faa17bd4dd1bb294eead705e82ff /chrome
parent8a2c825470801c0d201f17ca106e9e24616299cb (diff)
downloadchromium_src-c24c7c8dcfaeafe953ec7e0d6067769a7f3172ff.zip
chromium_src-c24c7c8dcfaeafe953ec7e0d6067769a7f3172ff.tar.gz
chromium_src-c24c7c8dcfaeafe953ec7e0d6067769a7f3172ff.tar.bz2
GTK: Closing in on being completely GSEALed.
BUG=79722 Review URL: http://codereview.chromium.org/9359052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122132 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.cc3
-rw-r--r--chrome/browser/ui/gtk/browser_titlebar.cc6
-rw-r--r--chrome/browser/ui/gtk/browser_toolbar_gtk.cc6
-rw-r--r--chrome/browser/ui/gtk/browser_window_gtk.cc6
-rw-r--r--chrome/browser/ui/gtk/gtk_theme_service.cc5
-rw-r--r--chrome/browser/ui/gtk/gtk_util.cc4
-rw-r--r--chrome/browser/ui/gtk/infobars/infobar_gtk.cc2
-rw-r--r--chrome/browser/ui/gtk/location_bar_view_gtk.cc6
-rw-r--r--chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc6
-rw-r--r--chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc16
-rw-r--r--chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc9
-rw-r--r--chrome/browser/ui/gtk/tab_contents_container_gtk.cc6
-rw-r--r--chrome/browser/ui/gtk/tabs/dragged_view_gtk.cc31
-rw-r--r--chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc2
-rw-r--r--chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc27
-rw-r--r--chrome/browser/ui/gtk/tabs/tab_strip_gtk.h4
16 files changed, 82 insertions, 57 deletions
diff --git a/chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.cc b/chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.cc
index c65d110..bebb0b8 100644
--- a/chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.cc
+++ b/chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.cc
@@ -117,7 +117,8 @@ void AutofillPopupViewGtk::HideInternal() {
void AutofillPopupViewGtk::InvalidateRow(size_t row) {
GdkRectangle row_rect = GetRectForRow(
row, bounds_.width(), row_height_).ToGdkRectangle();
- gdk_window_invalidate_rect(window_->window, &row_rect, FALSE);
+ GdkWindow* gdk_window = gtk_widget_get_window(window_);
+ gdk_window_invalidate_rect(gdk_window, &row_rect, FALSE);
}
gboolean AutofillPopupViewGtk::HandleButtonRelease(GtkWidget* widget,
diff --git a/chrome/browser/ui/gtk/browser_titlebar.cc b/chrome/browser/ui/gtk/browser_titlebar.cc
index 900398f..89474d5 100644
--- a/chrome/browser/ui/gtk/browser_titlebar.cc
+++ b/chrome/browser/ui/gtk/browser_titlebar.cc
@@ -47,6 +47,7 @@
#include "grit/theme_resources.h"
#include "grit/theme_resources_standard.h"
#include "grit/ui_resources.h"
+#include "ui/base/gtk/gtk_compat.h"
#include "ui/base/gtk/gtk_hig_constants.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
@@ -989,9 +990,10 @@ void BrowserTitlebar::SendEnterNotifyToCloseButtonIfUnderMouse() {
g_value_set_boolean(&return_value, false);
GdkEvent* event = gdk_event_new(GDK_ENTER_NOTIFY);
- event->crossing.window = GTK_BUTTON(close_button_->widget())->event_window;
+ event->crossing.window =
+ gtk_button_get_event_window(GTK_BUTTON(close_button_->widget()));
event->crossing.send_event = FALSE;
- event->crossing.subwindow = close_button_->widget()->window;
+ event->crossing.subwindow = gtk_widget_get_window(close_button_->widget());
event->crossing.time = gtk_util::XTimeNow();
event->crossing.x = x;
event->crossing.y = y;
diff --git a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc
index 8cc64ac..7dc8832 100644
--- a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -477,7 +477,7 @@ gboolean BrowserToolbarGtk::OnAlignmentExpose(GtkWidget* widget,
if (theme_service_->UsingNativeTheme())
return FALSE;
- cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window));
+ cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(widget));
gdk_cairo_rectangle(cr, &e->area);
cairo_clip(cr);
@@ -624,7 +624,7 @@ void BrowserToolbarGtk::OnDragDataReceived(GtkWidget* widget,
return;
}
- GURL url(reinterpret_cast<char*>(data->data));
+ GURL url(reinterpret_cast<const char*>(gtk_selection_data_get_data(data)));
if (!url.is_valid())
return;
diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc
index 23e4a9a..572971c 100644
--- a/chrome/browser/ui/gtk/browser_window_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_window_gtk.cc
@@ -422,7 +422,7 @@ gboolean BrowserWindowGtk::OnCustomFrameExpose(GtkWidget* widget,
TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::OnCustomFrameExpose");
// Draw the default background.
- cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window));
+ cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(widget));
gdk_cairo_rectangle(cr, &event->area);
cairo_clip(cr);
@@ -2006,8 +2006,10 @@ gfx::Size BrowserWindowGtk::GetNonClientFrameSize() const {
}
void BrowserWindowGtk::InvalidateWindow() {
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(GTK_WIDGET(window_), &allocation);
gdk_window_invalidate_rect(gtk_widget_get_window(GTK_WIDGET(window_)),
- &GTK_WIDGET(window_)->allocation, TRUE);
+ &allocation, TRUE);
}
void BrowserWindowGtk::SaveWindowPosition() {
diff --git a/chrome/browser/ui/gtk/gtk_theme_service.cc b/chrome/browser/ui/gtk/gtk_theme_service.cc
index cdec924..9973886 100644
--- a/chrome/browser/ui/gtk/gtk_theme_service.cc
+++ b/chrome/browser/ui/gtk/gtk_theme_service.cc
@@ -498,7 +498,8 @@ void GtkThemeService::GetScrollbarColors(GdkColor* thumb_active_color,
const int kWidth = 100;
const int kHeight = 20;
GtkStyle* style = gtk_rc_get_style(scrollbar);
- GdkPixmap* pm = gdk_pixmap_new(window->window, kWidth, kHeight, -1);
+ GdkWindow* gdk_window = gtk_widget_get_window(window);
+ GdkPixmap* pm = gdk_pixmap_new(gdk_window, kWidth, kHeight, -1);
GdkRectangle rect = { 0, 0, kWidth, kHeight };
unsigned char data[3 * kWidth * kHeight];
for (int i = 0; i < 3; ++i) {
@@ -1098,7 +1099,7 @@ gboolean GtkThemeService::OnSeparatorExpose(GtkWidget* widget,
if (UsingNativeTheme())
return FALSE;
- cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window));
+ cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(widget));
gdk_cairo_rectangle(cr, &event->area);
cairo_clip(cr);
diff --git a/chrome/browser/ui/gtk/gtk_util.cc b/chrome/browser/ui/gtk/gtk_util.cc
index 4aa5a8a..c424f51 100644
--- a/chrome/browser/ui/gtk/gtk_util.cc
+++ b/chrome/browser/ui/gtk/gtk_util.cc
@@ -336,7 +336,7 @@ void SetWindowSizeFromResources(GtkWindow* window,
// controls, we should allow that too, so be careful to pick the
// wider of the resources size and the natural window size.
- gtk_widget_show_all(GTK_BIN(window)->child);
+ gtk_widget_show_all(gtk_bin_get_child(GTK_BIN(window)));
GtkRequisition requisition;
gtk_widget_size_request(GTK_WIDGET(window), &requisition);
gtk_widget_set_size_request(
@@ -1116,7 +1116,7 @@ string16 GetStockPreferencesMenuLabel() {
bool IsWidgetAncestryVisible(GtkWidget* widget) {
GtkWidget* parent = widget;
while (parent && gtk_widget_get_visible(parent))
- parent = parent->parent;
+ parent = gtk_widget_get_parent(parent);
return !parent;
}
diff --git a/chrome/browser/ui/gtk/infobars/infobar_gtk.cc b/chrome/browser/ui/gtk/infobars/infobar_gtk.cc
index b8c84a4..4a32209 100644
--- a/chrome/browser/ui/gtk/infobars/infobar_gtk.cc
+++ b/chrome/browser/ui/gtk/infobars/infobar_gtk.cc
@@ -219,7 +219,7 @@ gboolean InfoBarGtk::OnBackgroundExpose(GtkWidget* sender,
gtk_widget_get_allocation(sender, &allocation);
const int height = allocation.height;
- cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window));
+ cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(sender));
gdk_cairo_rectangle(cr, &event->area);
cairo_clip(cr);
diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk.cc b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
index aac4398..0ff213e 100644
--- a/chrome/browser/ui/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/ui/gtk/location_bar_view_gtk.cc
@@ -457,7 +457,7 @@ void LocationBarViewGtk::Update(const WebContents* contents) {
if (theme_service_->UsingNativeTheme()) {
// In GTK mode, we need our parent to redraw, as it draws the text entry
// border.
- gtk_widget_queue_draw(widget()->parent);
+ gtk_widget_queue_draw(gtk_widget_get_parent(widget()));
} else {
gtk_widget_queue_draw(widget());
}
@@ -1018,7 +1018,7 @@ void LocationBarViewGtk::SetKeywordHintLabel(const string16& keyword) {
}
void LocationBarViewGtk::ShowFirstRunBubbleInternal() {
- if (!location_entry_.get() || !widget()->window)
+ if (!location_entry_.get() || !gtk_widget_get_window(widget()))
return;
gfx::Rect bounds = gtk_util::WidgetBounds(location_icon_image_);
@@ -1395,7 +1395,7 @@ gboolean LocationBarViewGtk::ContentSettingImageViewGtk::OnExpose(
gtk_widget_get_allocation(sender, &allocation);
const int height = allocation.height;
- cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window));
+ cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(sender));
gdk_cairo_rectangle(cr, &event->area);
cairo_clip(cr);
diff --git a/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc
index c5d6b8a..f701151 100644
--- a/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc
+++ b/chrome/browser/ui/gtk/notifications/balloon_view_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -415,7 +415,7 @@ void BalloonViewImpl::OnCloseButton(GtkWidget* widget) {
gboolean BalloonViewImpl::OnContentsExpose(GtkWidget* sender,
GdkEventExpose* event) {
TRACE_EVENT0("ui::gtk", "BalloonViewImpl::OnContentsExpose");
- cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window));
+ cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(sender));
gdk_cairo_rectangle(cr, &event->area);
cairo_clip(cr);
@@ -439,7 +439,7 @@ gboolean BalloonViewImpl::OnContentsExpose(GtkWidget* sender,
gboolean BalloonViewImpl::OnExpose(GtkWidget* sender, GdkEventExpose* event) {
TRACE_EVENT0("ui::gtk", "BalloonViewImpl::OnExpose");
- cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(sender->window));
+ cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(sender));
gdk_cairo_rectangle(cr, &event->area);
cairo_clip(cr);
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 4dd49e4..83fdf94 100644
--- a/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc
+++ b/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc
@@ -351,9 +351,10 @@ bool OmniboxPopupViewGtk::IsOpen() const {
void OmniboxPopupViewGtk::InvalidateLine(size_t line) {
// TODO(deanm): Is it possible to use some constant for the width, instead
// of having to query the width of the window?
+ GdkWindow* gdk_window = gtk_widget_get_window(GTK_WIDGET(window_));
GdkRectangle line_rect = GetRectForLine(
- line, GetWindowRect(window_->window).width()).ToGdkRectangle();
- gdk_window_invalidate_rect(window_->window, &line_rect, FALSE);
+ line, GetWindowRect(gdk_window).width()).ToGdkRectangle();
+ gdk_window_invalidate_rect(gdk_window, &line_rect, FALSE);
}
void OmniboxPopupViewGtk::UpdatePopupAppearance() {
@@ -385,7 +386,8 @@ gfx::Rect OmniboxPopupViewGtk::GetTargetBounds() {
void OmniboxPopupViewGtk::PaintUpdatesNow() {
// Paint our queued invalidations now, synchronously.
- gdk_window_process_updates(window_->window, FALSE);
+ GdkWindow* gdk_window = gtk_widget_get_window(window_);
+ gdk_window_process_updates(gdk_window, FALSE);
}
void OmniboxPopupViewGtk::OnDragCanceled() {
@@ -439,8 +441,10 @@ void OmniboxPopupViewGtk::Observe(int type,
void OmniboxPopupViewGtk::Show(size_t num_results) {
gint origin_x, origin_y;
- gdk_window_get_origin(location_bar_->window, &origin_x, &origin_y);
- GtkAllocation allocation = location_bar_->allocation;
+ GdkWindow* gdk_window = gtk_widget_get_window(location_bar_);
+ gdk_window_get_origin(gdk_window, &origin_x, &origin_y);
+ GtkAllocation allocation;
+ gtk_widget_get_allocation(location_bar_, &allocation);
int horizontal_offset = 1;
gtk_window_move(GTK_WINDOW(window_),
@@ -587,7 +591,7 @@ gboolean OmniboxPopupViewGtk::HandleExpose(GtkWidget* widget,
if (window_rect.width() < (kIconAreaWidth * 3))
return TRUE;
- cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window));
+ cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(widget));
gdk_cairo_rectangle(cr, &event->area);
cairo_clip(cr);
diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc
index 2b75203..667f448 100644
--- a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc
+++ b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc
@@ -1296,7 +1296,8 @@ gboolean OmniboxViewGtk::HandleViewFocusIn(GtkWidget* sender,
update_popup_without_focus_ = false;
GdkModifierType modifiers;
- gdk_window_get_pointer(text_view_->window, NULL, NULL, &modifiers);
+ GdkWindow* gdk_window = gtk_widget_get_window(text_view_);
+ gdk_window_get_pointer(gdk_window, NULL, NULL, &modifiers);
model_->OnSetFocus((modifiers & GDK_CONTROL_MASK) != 0);
controller_->OnSetFocus();
// TODO(deanm): Some keyword hit business, etc here.
@@ -1551,7 +1552,8 @@ void OmniboxViewGtk::HandleDragDataReceived(GtkWidget* sender,
// Don't try to PasteAndGo on drops originating from this omnibox. However, do
// allow default behavior for such drags.
- if (context->source_window == text_view_->window)
+ if (gdk_drag_context_get_source_window(context) ==
+ gtk_widget_get_window(text_view_))
return;
guchar* text = gtk_selection_data_get_text(selection_data);
@@ -1815,10 +1817,11 @@ gfx::Font OmniboxViewGtk::GetFont() {
// If we haven't initialized the text view yet, just create a temporary one
// whose style we can grab.
GtkWidget* widget = text_view_ ? text_view_ : gtk_text_view_new();
+ GtkStyle* gtk_style = gtk_widget_get_style(widget);
GtkRcStyle* rc_style = gtk_widget_get_modifier_style(widget);
gfx::Font font((rc_style && rc_style->font_desc) ?
rc_style->font_desc :
- widget->style->font_desc);
+ gtk_style->font_desc);
if (!text_view_)
g_object_unref(g_object_ref_sink(widget));
diff --git a/chrome/browser/ui/gtk/tab_contents_container_gtk.cc b/chrome/browser/ui/gtk/tab_contents_container_gtk.cc
index 75154e8..2b99961 100644
--- a/chrome/browser/ui/gtk/tab_contents_container_gtk.cc
+++ b/chrome/browser/ui/gtk/tab_contents_container_gtk.cc
@@ -132,7 +132,7 @@ void TabContentsContainerGtk::PackTab(TabContentsWrapper* tab) {
gfx::NativeView widget = tab->web_contents()->GetNativeView();
if (widget) {
- if (widget->parent != expanded_)
+ if (gtk_widget_get_parent(widget) != expanded_)
gtk_container_add(GTK_CONTAINER(expanded_), widget);
gtk_widget_show(widget);
}
@@ -140,8 +140,8 @@ void TabContentsContainerGtk::PackTab(TabContentsWrapper* tab) {
// We need to make sure that we are below the findbar.
// Sometimes the content native view will be null.
if (tab->web_contents()->GetContentNativeView()) {
- GdkWindow* content_gdk_window =
- tab->web_contents()->GetContentNativeView()->window;
+ GdkWindow* content_gdk_window = gtk_widget_get_window(
+ tab->web_contents()->GetContentNativeView());
if (content_gdk_window)
gdk_window_lower(content_gdk_window);
}
diff --git a/chrome/browser/ui/gtk/tabs/dragged_view_gtk.cc b/chrome/browser/ui/gtk/tabs/dragged_view_gtk.cc
index a5ed4d3..dda2448 100644
--- a/chrome/browser/ui/gtk/tabs/dragged_view_gtk.cc
+++ b/chrome/browser/ui/gtk/tabs/dragged_view_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -143,8 +143,10 @@ void DraggedViewGtk::Attach(
Resize(dragged_tab_width);
- if (ui::IsScreenComposited())
- gdk_window_set_opacity(container_->window, kOpaqueAlpha);
+ if (ui::IsScreenComposited()) {
+ GdkWindow* gdk_window = gtk_widget_get_window(container_);
+ gdk_window_set_opacity(gdk_window, kOpaqueAlpha);
+ }
}
void DraggedViewGtk::Resize(int width) {
@@ -156,8 +158,10 @@ void DraggedViewGtk::Detach() {
attached_ = false;
ResizeContainer();
- if (ui::IsScreenComposited())
- gdk_window_set_opacity(container_->window, kTransparentAlpha);
+ if (ui::IsScreenComposited()) {
+ GdkWindow* gdk_window = gtk_widget_get_window(container_);
+ gdk_window_set_opacity(gdk_window, kTransparentAlpha);
+ }
}
void DraggedViewGtk::Update() {
@@ -207,8 +211,9 @@ void DraggedViewGtk::AnimateToBounds(const gfx::Rect& bounds,
animation_callback_ = callback;
gint x, y, width, height;
- gdk_window_get_origin(container_->window, &x, &y);
- gdk_window_get_geometry(container_->window, NULL, NULL,
+ GdkWindow* gdk_window = gtk_widget_get_window(container_);
+ gdk_window_get_origin(gdk_window, &x, &y);
+ gdk_window_get_geometry(gdk_window, NULL, NULL,
&width, &height, NULL);
animation_start_bounds_ = gfx::Rect(x, y, width, height);
@@ -230,7 +235,8 @@ void DraggedViewGtk::AnimationProgressed(const ui::Animation* animation) {
int x = animation_start_bounds_.x() +
static_cast<int>(delta_x * animation->GetCurrentValue());
int y = animation_end_bounds_.y();
- gdk_window_move(container_->window, x, y);
+ GdkWindow* gdk_window = gtk_widget_get_window(container_);
+ gdk_window_move(gdk_window, x, y);
}
void DraggedViewGtk::AnimationEnded(const ui::Animation* animation) {
@@ -313,7 +319,7 @@ void DraggedViewGtk::SetContainerColorMap() {
}
void DraggedViewGtk::SetContainerTransparency() {
- cairo_t* cairo_context = gdk_cairo_create(container_->window);
+ cairo_t* cairo_context = gdk_cairo_create(gtk_widget_get_window(container_));
if (!cairo_context)
return;
@@ -372,7 +378,8 @@ void DraggedViewGtk::SetContainerShapeMask() {
cairo_destroy(cairo_context);
// Set the shape mask.
- gdk_window_shape_combine_mask(container_->window, pixmap, 0, 0);
+ GdkWindow* gdk_window = gtk_widget_get_window(container_);
+ gdk_window_shape_combine_mask(gdk_window, pixmap, 0, 0);
g_object_unref(pixmap);
}
@@ -401,10 +408,10 @@ gboolean DraggedViewGtk::OnExpose(GtkWidget* widget, GdkEventExpose* event) {
allocation.width - kTwiceDragFrameBorderSize,
allocation.height - tab_height -
kDragFrameBorderSize),
- GDK_DRAWABLE(widget->window));
+ GDK_DRAWABLE(gtk_widget_get_window(widget)));
}
- cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window));
+ cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(widget));
// Draw the border.
if (!attached_) {
cairo_set_line_width(cr, kDragFrameBorderSize);
diff --git a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc
index 3230214..74f21fc 100644
--- a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc
+++ b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc
@@ -813,7 +813,7 @@ void TabRendererGtk::MoveCloseButtonWidget() {
}
void TabRendererGtk::PaintTab(GtkWidget* widget, GdkEventExpose* event) {
- cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window));
+ cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(widget));
gdk_cairo_rectangle(cr, &event->area);
cairo_clip(cr);
diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
index 1d5435a..0863e02 100644
--- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
+++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
@@ -1450,9 +1450,12 @@ void TabStripGtk::GenerateIdealBounds() {
void TabStripGtk::LayoutNewTabButton(double last_tab_right,
double unselected_width) {
GtkWidget* toplevel = gtk_widget_get_ancestor(widget(), GTK_TYPE_WINDOW);
- bool is_maximized = toplevel &&
- ((gdk_window_get_state(toplevel->window) & GDK_WINDOW_STATE_MAXIMIZED)
- != 0);
+ bool is_maximized = false;
+ if (toplevel) {
+ GdkWindow* gdk_window = gtk_widget_get_window(toplevel);
+ is_maximized = (gdk_window_get_state(gdk_window) &
+ GDK_WINDOW_STATE_MAXIMIZED) != 0;
+ }
int y = is_maximized ? 0 : kNewTabButtonVOffset;
int height = newtab_surface_bounds_.height() + kNewTabButtonVOffset - y;
@@ -1750,7 +1753,7 @@ void TabStripGtk::SetDropIndex(int index, bool drop_before) {
drop_bounds.width(), drop_bounds.height());
}
-bool TabStripGtk::CompleteDrop(guchar* data, bool is_plain_text) {
+bool TabStripGtk::CompleteDrop(const guchar* data, bool is_plain_text) {
if (!drop_info_.get())
return false;
@@ -1767,11 +1770,11 @@ bool TabStripGtk::CompleteDrop(guchar* data, bool is_plain_text) {
if (is_plain_text) {
AutocompleteMatch match;
model_->profile()->GetAutocompleteClassifier()->Classify(
- UTF8ToUTF16(reinterpret_cast<char*>(data)), string16(), false, false,
- &match, NULL);
+ UTF8ToUTF16(reinterpret_cast<const char*>(data)), string16(),
+ false, false, &match, NULL);
url = match.destination_url;
} else {
- std::string url_string(reinterpret_cast<char*>(data));
+ std::string url_string(reinterpret_cast<const char*>(data));
url = GURL(url_string.substr(0, url_string.find_first_of('\n')));
}
if (!url.is_valid())
@@ -1824,7 +1827,7 @@ gboolean TabStripGtk::DropInfo::OnExposeEvent(GtkWidget* widget,
SetContainerShapeMask();
}
- cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window));
+ cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(widget));
gdk_cairo_rectangle(cr, &event->area);
cairo_clip(cr);
@@ -1852,7 +1855,7 @@ void TabStripGtk::DropInfo::SetContainerColorMap() {
// Sets full transparency for the container window. This is used if
// compositing is available for the screen.
void TabStripGtk::DropInfo::SetContainerTransparency() {
- cairo_t* cairo_context = gdk_cairo_create(container->window);
+ cairo_t* cairo_context = gdk_cairo_create(gtk_widget_get_window(container));
if (!cairo_context)
return;
@@ -1890,7 +1893,8 @@ void TabStripGtk::DropInfo::SetContainerShapeMask() {
cairo_destroy(cairo_context);
// Set the shape mask.
- gdk_window_shape_combine_mask(container->window, pixmap, 0, 0);
+ GdkWindow* gdk_window = gtk_widget_get_window(container);
+ gdk_window_shape_combine_mask(gdk_window, pixmap, 0, 0);
g_object_unref(pixmap);
}
@@ -2157,7 +2161,8 @@ gboolean TabStripGtk::OnDragDataReceived(GtkWidget* widget,
if (info == ui::TEXT_URI_LIST ||
info == ui::NETSCAPE_URL ||
info == ui::TEXT_PLAIN) {
- success = CompleteDrop(data->data, info == ui::TEXT_PLAIN);
+ success = CompleteDrop(gtk_selection_data_get_data(data),
+ info == ui::TEXT_PLAIN);
}
gtk_drag_finish(context, success, FALSE, time);
diff --git a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h
index 2795b24..b104ab5 100644
--- a/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h
+++ b/chrome/browser/ui/gtk/tabs/tab_strip_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -394,7 +394,7 @@ class TabStripGtk : public TabStripModelObserver,
// Determines whether the data is acceptable by the tabstrip and opens a new
// tab with the data as URL if it is. Returns true if the drop was
// successful.
- bool CompleteDrop(guchar* data, bool is_plain_text);
+ bool CompleteDrop(const guchar* data, bool is_plain_text);
// Returns the image to use for indicating a drop on a tab. If is_down is
// true, this returns an arrow pointing down.