diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-11 20:03:27 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-11 20:03:27 +0000 |
commit | 9b9132764e73e69d9cc940dd485b52e00cf68fd4 (patch) | |
tree | ab73a7372309433efb4e2ed19bc7da8e2ce455a8 | |
parent | e8b0ae43f76c496313addc4e8337bd7862d478ef (diff) | |
download | chromium_src-9b9132764e73e69d9cc940dd485b52e00cf68fd4.zip chromium_src-9b9132764e73e69d9cc940dd485b52e00cf68fd4.tar.gz chromium_src-9b9132764e73e69d9cc940dd485b52e00cf68fd4.tar.bz2 |
GTK: More GSEALing.
BUG=79722
TEST=none
Review URL: http://codereview.chromium.org/9147044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117267 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/tab_contents/chrome_tab_contents_view_wrapper_gtk.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/about_chrome_dialog.cc | 3 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc | 43 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/bubble/bubble_gtk.cc | 9 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/chrome_gtk_frame.cc | 10 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/custom_button.cc | 5 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/download/download_shelf_gtk.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.cc | 5 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/gtk_custom_menu.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/gtk_custom_menu_item.cc | 10 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/gtk_util.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/nine_box.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc | 2 | ||||
-rw-r--r-- | content/browser/tab_contents/web_drag_dest_gtk.cc | 15 | ||||
-rw-r--r-- | ui/base/gtk/gtk_compat.h | 4 |
17 files changed, 78 insertions, 62 deletions
diff --git a/chrome/browser/tab_contents/chrome_tab_contents_view_wrapper_gtk.cc b/chrome/browser/tab_contents/chrome_tab_contents_view_wrapper_gtk.cc index 0297a73..e6e5115 100644 --- a/chrome/browser/tab_contents/chrome_tab_contents_view_wrapper_gtk.cc +++ b/chrome/browser/tab_contents/chrome_tab_contents_view_wrapper_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. @@ -140,7 +140,7 @@ void ChromeTabContentsViewWrapperGtk::OnSetFloatingPosition( // Place each ConstrainedWindow in the center of the view. GtkWidget* widget = constrained_window_->widget(); - DCHECK(widget->parent == floating_.get()); + DCHECK(gtk_widget_get_parent(widget) == floating_.get()); GtkRequisition requisition; gtk_widget_size_request(widget, &requisition); diff --git a/chrome/browser/ui/gtk/about_chrome_dialog.cc b/chrome/browser/ui/gtk/about_chrome_dialog.cc index f92d988..e5a5959 100644 --- a/chrome/browser/ui/gtk/about_chrome_dialog.cc +++ b/chrome/browser/ui/gtk/about_chrome_dialog.cc @@ -83,7 +83,8 @@ const char* GetChromiumUrl() { gboolean OnEventBoxExpose(GtkWidget* event_box, GdkEventExpose* expose, gboolean user_data) { - cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(event_box->window)); + cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE( + gtk_widget_get_window(event_box))); gdk_cairo_rectangle(cr, &expose->area); cairo_clip(cr); diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc index 2af9ff7..16dfdc8 100644 --- a/chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.cc +++ b/chrome/browser/ui/gtk/bookmarks/bookmark_utils_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. @@ -324,7 +324,8 @@ void WriteBookmarksToSelection(const std::vector<const BookmarkNode*>& nodes, Pickle pickle; data.WriteToPickle(profile, &pickle); - gtk_selection_data_set(selection_data, selection_data->target, + gtk_selection_data_set(selection_data, + gtk_selection_data_get_target(selection_data), kBitsInAByte, static_cast<const guchar*>(pickle.data()), pickle.size()); @@ -335,7 +336,7 @@ void WriteBookmarksToSelection(const std::vector<const BookmarkNode*>& nodes, std::string utf8_text = nodes[0]->url().spec() + "\n" + UTF16ToUTF8(nodes[0]->GetTitle()); gtk_selection_data_set(selection_data, - selection_data->target, + gtk_selection_data_get_target(selection_data), kBitsInAByte, reinterpret_cast<const guchar*>(utf8_text.c_str()), utf8_text.length()); @@ -394,22 +395,26 @@ std::vector<const BookmarkNode*> GetNodesFromSelection( if (dnd_success) *dnd_success = FALSE; - if (selection_data && selection_data->length > 0) { - if (context && delete_selection_data && context->action == GDK_ACTION_MOVE) - *delete_selection_data = TRUE; - - switch (target_type) { - case ui::CHROME_BOOKMARK_ITEM: { - if (dnd_success) - *dnd_success = TRUE; - Pickle pickle(reinterpret_cast<char*>(selection_data->data), - selection_data->length); - BookmarkNodeData drag_data; - drag_data.ReadFromPickle(&pickle); - return drag_data.GetNodes(profile); - } - default: { - DLOG(ERROR) << "Unsupported drag received type: " << target_type; + if (selection_data) { + gint length = gtk_selection_data_get_length(selection_data); + if (length > 0) { + if (context && delete_selection_data && + context->action == GDK_ACTION_MOVE) + *delete_selection_data = TRUE; + + switch (target_type) { + case ui::CHROME_BOOKMARK_ITEM: { + if (dnd_success) + *dnd_success = TRUE; + Pickle pickle(reinterpret_cast<const char*>( + gtk_selection_data_get_data(selection_data)), length); + BookmarkNodeData drag_data; + drag_data.ReadFromPickle(&pickle); + return drag_data.GetNodes(profile); + } + default: { + DLOG(ERROR) << "Unsupported drag received type: " << target_type; + } } } } diff --git a/chrome/browser/ui/gtk/bubble/bubble_gtk.cc b/chrome/browser/ui/gtk/bubble/bubble_gtk.cc index 1035f42..c4c35a6 100644 --- a/chrome/browser/ui/gtk/bubble/bubble_gtk.cc +++ b/chrome/browser/ui/gtk/bubble/bubble_gtk.cc @@ -461,7 +461,7 @@ gboolean BubbleGtk::OnGtkAccelerator(GtkAccelGroup* group, gboolean BubbleGtk::OnExpose(GtkWidget* widget, GdkEventExpose* expose) { // TODO(erg): This whole method will need to be rewritten in cairo. - GdkDrawable* drawable = GDK_DRAWABLE(window_->window); + GdkDrawable* drawable = GDK_DRAWABLE(gtk_widget_get_window(window_)); GdkGC* gc = gdk_gc_new(drawable); gdk_gc_set_rgb_fg_color(gc, &kFrameColor); @@ -494,14 +494,15 @@ gboolean BubbleGtk::OnButtonPress(GtkWidget* widget, // check that it falls within our bounds, since we've grabbed the pointer and // some events that actually occurred in other windows will be reported with // respect to our window). - if (event->window == window_->window && + GdkWindow* gdk_window = gtk_widget_get_window(window_); + if (event->window == gdk_window && (mask_region_ && gdk_region_point_in(mask_region_, event->x, event->y))) { return FALSE; // Propagate. } // Our content widget got a click. - if (event->window != window_->window && - gdk_window_get_toplevel(event->window) == window_->window) { + if (event->window != gdk_window && + gdk_window_get_toplevel(event->window) == gdk_window) { return FALSE; } diff --git a/chrome/browser/ui/gtk/chrome_gtk_frame.cc b/chrome/browser/ui/gtk/chrome_gtk_frame.cc index d649ba70..1c0dc74 100644 --- a/chrome/browser/ui/gtk/chrome_gtk_frame.cc +++ b/chrome/browser/ui/gtk/chrome_gtk_frame.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. @@ -145,11 +145,9 @@ static void chrome_gtk_frame_init(ChromeGtkFrame* frame) { } GtkWidget* chrome_gtk_frame_new(void) { - GtkWindow* window = - GTK_WINDOW(g_object_new(chrome_gtk_frame_get_type(), NULL)); - window->type = GTK_WINDOW_TOPLEVEL; - return GTK_WIDGET(window); + return GTK_WIDGET(g_object_new(chrome_gtk_frame_get_type(), + "type", GTK_WINDOW_TOPLEVEL, + NULL)); } - G_END_DECLS diff --git a/chrome/browser/ui/gtk/custom_button.cc b/chrome/browser/ui/gtk/custom_button.cc index 447f6c8..f64ed13 100644 --- a/chrome/browser/ui/gtk/custom_button.cc +++ b/chrome/browser/ui/gtk/custom_button.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. @@ -91,7 +91,8 @@ gboolean CustomDrawButtonBase::OnExpose(GtkWidget* widget, if (animating_hover && (!hover_pixbuf || !hover_pixbuf->valid())) return FALSE; - cairo_t* cairo_context = gdk_cairo_create(GDK_DRAWABLE(widget->window)); + cairo_t* cairo_context = gdk_cairo_create(GDK_DRAWABLE( + gtk_widget_get_window(widget))); GtkAllocation allocation; gtk_widget_get_allocation(widget, &allocation); cairo_translate(cairo_context, allocation.x, allocation.y); diff --git a/chrome/browser/ui/gtk/download/download_shelf_gtk.cc b/chrome/browser/ui/gtk/download/download_shelf_gtk.cc index 2ed9a4e..10d77cc 100644 --- a/chrome/browser/ui/gtk/download/download_shelf_gtk.cc +++ b/chrome/browser/ui/gtk/download/download_shelf_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. @@ -195,7 +195,7 @@ void DownloadShelfGtk::Show() { void DownloadShelfGtk::Close() { // When we are closing, we can vertically overlap the render view. Make sure // we are on top. - gdk_window_raise(shelf_.get()->window); + gdk_window_raise(gtk_widget_get_window(shelf_.get())); slide_widget_->Close(); browser_->UpdateDownloadShelfVisibility(false); int num_in_progress = 0; diff --git a/chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.cc b/chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.cc index d08058a..03b9244 100644 --- a/chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.cc +++ b/chrome/browser/ui/gtk/fullscreen_exit_bubble_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. @@ -190,7 +190,7 @@ bool FullscreenExitBubbleGtk::WindowContainsPoint(gfx::Point pos) { } bool FullscreenExitBubbleGtk::IsWindowActive() { - if (!widget()->parent) + if (!gtk_widget_get_parent(widget())) return false; GtkWindow* window = GTK_WINDOW( gtk_widget_get_ancestor(widget(), GTK_TYPE_WINDOW)); diff --git a/chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.cc b/chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.cc index 138ba39..a4b8da6 100644 --- a/chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.cc +++ b/chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.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. @@ -51,7 +51,8 @@ void ChildSizeAllocate(GtkWidget* child, gpointer userdata) { return; SizeAllocateData* data = reinterpret_cast<SizeAllocateData*>(userdata); - GtkAllocation child_allocation = child->allocation; + GtkAllocation child_allocation; + gtk_widget_get_allocation(child, &child_allocation); if (data->homogeneous) { // Make sure the child is not overlapped with others' boundary. diff --git a/chrome/browser/ui/gtk/gtk_custom_menu.cc b/chrome/browser/ui/gtk/gtk_custom_menu.cc index f6119dd..bfa5a97 100644 --- a/chrome/browser/ui/gtk/gtk_custom_menu.cc +++ b/chrome/browser/ui/gtk/gtk_custom_menu.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. @@ -17,7 +17,7 @@ static gint gtk_menu_shell_is_item(GtkMenuShell* menu_shell, g_return_val_if_fail(GTK_IS_MENU_SHELL(menu_shell), FALSE); g_return_val_if_fail(child != NULL, FALSE); - parent = child->parent; + parent = gtk_widget_get_parent(child); while (GTK_IS_MENU_SHELL(parent)) { if (parent == reinterpret_cast<GtkWidget*>(menu_shell)) return TRUE; @@ -34,7 +34,7 @@ static GtkWidget* gtk_menu_shell_get_item(GtkMenuShell* menu_shell, GtkWidget* menu_item = gtk_get_event_widget(event); while (menu_item && !GTK_IS_MENU_ITEM(menu_item)) - menu_item = menu_item->parent; + menu_item = gtk_widget_get_parent(menu_item); if (menu_item && gtk_menu_shell_is_item(menu_shell, menu_item)) return menu_item; diff --git a/chrome/browser/ui/gtk/gtk_custom_menu_item.cc b/chrome/browser/ui/gtk/gtk_custom_menu_item.cc index 9fb1fb6..b52652d 100644 --- a/chrome/browser/ui/gtk/gtk_custom_menu_item.cc +++ b/chrome/browser/ui/gtk/gtk_custom_menu_item.cc @@ -92,8 +92,9 @@ static void set_selected(GtkCustomMenuItem* item, GtkWidget* selected) { // label has been (re)created. (Label values can change dynamically.) static void on_button_label_set(GObject* object) { GtkButton* button = GTK_BUTTON(object); - gtk_widget_set_sensitive(GTK_BIN(button)->child, FALSE); - gtk_misc_set_padding(GTK_MISC(GTK_BIN(button)->child), 2, 0); + GtkWidget* child = gtk_bin_get_child(GTK_BIN(button)); + gtk_widget_set_sensitive(child, FALSE); + gtk_misc_set_padding(GTK_MISC(child), 2, 0); } static void gtk_custom_menu_item_finalize(GObject *object); @@ -261,8 +262,9 @@ static gboolean gtk_custom_menu_item_hbox_expose(GtkWidget* widget, 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(gtk_widget_get_style(widget), + GtkStyle* style = gtk_widget_get_style(widget); + int half_offset = style->xthickness / 2; + gtk_paint_vline(style, gtk_widget_get_window(widget), gtk_widget_get_state(current_button), &event->area, widget, "button", diff --git a/chrome/browser/ui/gtk/gtk_util.cc b/chrome/browser/ui/gtk/gtk_util.cc index c963216..f8e0e59 100644 --- a/chrome/browser/ui/gtk/gtk_util.cc +++ b/chrome/browser/ui/gtk/gtk_util.cc @@ -108,8 +108,9 @@ int GetCharacterWidthForPixels(GtkWidget* widget, int pixel_width) { << " widget must be realized to compute font metrics correctly"; PangoContext* context = gtk_widget_create_pango_context(widget); + GtkStyle* style = gtk_widget_get_style(widget); PangoFontMetrics* metrics = pango_context_get_metrics(context, - widget->style->font_desc, pango_context_get_language(context)); + style->font_desc, pango_context_get_language(context)); // This technique (max of char and digit widths) matches the code in // gtklabel.c. @@ -280,8 +281,9 @@ void GetWidgetSizeFromCharacters( DCHECK(gtk_widget_get_realized(widget)) << " widget must be realized to compute font metrics correctly"; PangoContext* context = gtk_widget_create_pango_context(widget); + GtkStyle* style = gtk_widget_get_style(widget); PangoFontMetrics* metrics = pango_context_get_metrics(context, - widget->style->font_desc, pango_context_get_language(context)); + style->font_desc, pango_context_get_language(context)); if (width) { *width = static_cast<int>( pango_font_metrics_get_approximate_char_width(metrics) * diff --git a/chrome/browser/ui/gtk/nine_box.cc b/chrome/browser/ui/gtk/nine_box.cc index 66f623f..5b951ef 100644 --- a/chrome/browser/ui/gtk/nine_box.cc +++ b/chrome/browser/ui/gtk/nine_box.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. @@ -138,7 +138,7 @@ void NineBox::RenderToWidgetWithOpacity(GtkWidget* dst, double opacity) const { if (x2 < x1 || y2 < y1) return; - cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(dst->window)); + cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(dst))); // 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. 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 356462f..4dd49e4 100644 --- a/chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc +++ b/chrome/browser/ui/gtk/omnibox/omnibox_popup_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. @@ -91,8 +91,8 @@ const char* kLRE = "\xe2\x80\xaa"; // Return a Rect covering the whole area of |window|. gfx::Rect GetWindowRect(GdkWindow* window) { - gint width, height; - gdk_drawable_get_size(GDK_DRAWABLE(window), &width, &height); + gint width = gdk_window_get_width(window); + gint height = gdk_window_get_height(window); return gfx::Rect(width, height); } diff --git a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc index f7a41ff..2b75203 100644 --- a/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc +++ b/chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc @@ -1207,7 +1207,7 @@ gboolean OmniboxViewGtk::HandleKeyRelease(GtkWidget* widget, if (event->keyval == GDK_Control_L || event->keyval == GDK_Control_R) { // Round trip to query the control state after the release. This allows // you to release one control key while still holding another control key. - GdkDisplay* display = gdk_drawable_get_display(event->window); + GdkDisplay* display = gdk_window_get_display(event->window); GdkModifierType mod; gdk_display_get_pointer(display, NULL, NULL, NULL, &mod); if (!(mod & GDK_CONTROL_MASK)) diff --git a/content/browser/tab_contents/web_drag_dest_gtk.cc b/content/browser/tab_contents/web_drag_dest_gtk.cc index 5dc5cc5..1a66354 100644 --- a/content/browser/tab_contents/web_drag_dest_gtk.cc +++ b/content/browser/tab_contents/web_drag_dest_gtk.cc @@ -145,17 +145,18 @@ void WebDragDestGtk::OnDragDataReceived( // Decode the data. gint data_length = gtk_selection_data_get_length(data); const guchar* raw_data = gtk_selection_data_get_data(data); + GdkAtom target = gtk_selection_data_get_target(data); if (raw_data && data_length > 0) { // If the source can't provide us with valid data for a requested target, // raw_data will be NULL. - if (data->target == ui::GetAtomForTarget(ui::TEXT_PLAIN)) { + if (target == ui::GetAtomForTarget(ui::TEXT_PLAIN)) { guchar* text = gtk_selection_data_get_text(data); if (text) { drop_data_->plain_text = UTF8ToUTF16(std::string(reinterpret_cast<const char*>(text))); g_free(text); } - } else if (data->target == ui::GetAtomForTarget(ui::TEXT_URI_LIST)) { + } else if (target == ui::GetAtomForTarget(ui::TEXT_URI_LIST)) { gchar** uris = gtk_selection_data_get_uris(data); if (uris) { drop_data_->url = GURL(); @@ -180,13 +181,13 @@ void WebDragDestGtk::OnDragDataReceived( } g_strfreev(uris); } - } else if (data->target == ui::GetAtomForTarget(ui::TEXT_HTML)) { + } else if (target == ui::GetAtomForTarget(ui::TEXT_HTML)) { // TODO(estade): Can the html have a non-UTF8 encoding? drop_data_->text_html = UTF8ToUTF16(std::string(reinterpret_cast<const char*>(raw_data), data_length)); // We leave the base URL empty. - } else if (data->target == ui::GetAtomForTarget(ui::NETSCAPE_URL)) { + } else if (target == ui::GetAtomForTarget(ui::NETSCAPE_URL)) { std::string netscape_url(reinterpret_cast<const char*>(raw_data), data_length); size_t split = netscape_url.find_first_of('\n'); @@ -195,9 +196,9 @@ void WebDragDestGtk::OnDragDataReceived( if (split < netscape_url.size() - 1) drop_data_->url_title = UTF8ToUTF16(netscape_url.substr(split + 1)); } - } else if (data->target == ui::GetAtomForTarget(ui::CHROME_NAMED_URL)) { + } else if (target == ui::GetAtomForTarget(ui::CHROME_NAMED_URL)) { ui::ExtractNamedURL(data, &drop_data_->url, &drop_data_->url_title); - } else if (data->target == ui::GetAtomForTarget(ui::CUSTOM_DATA)) { + } else if (target == ui::GetAtomForTarget(ui::CUSTOM_DATA)) { ui::ReadCustomDataIntoMap( raw_data, data_length, &drop_data_->custom_data); } @@ -208,7 +209,7 @@ void WebDragDestGtk::OnDragDataReceived( // URL bookmark. // Note that bookmark drag data is encoded in the same format for both // GTK and Views, hence we can share the same logic here. - if (delegate() && data->target == delegate()->GetBookmarkTargetAtom()) { + if (delegate() && target == delegate()->GetBookmarkTargetAtom()) { if (raw_data && data_length > 0) { delegate()->OnReceiveDataFromGtk(data); } else { diff --git a/ui/base/gtk/gtk_compat.h b/ui/base/gtk/gtk_compat.h index 4ca12df..3c3b29f 100644 --- a/ui/base/gtk/gtk_compat.h +++ b/ui/base/gtk/gtk_compat.h @@ -70,6 +70,10 @@ inline void gdk_pixmap_get_size(GdkPixmap* pixmap, gint* width, gint* height) { gdk_drawable_get_size(GDK_DRAWABLE(pixmap), width, height); } +inline GdkDisplay* gdk_window_get_display(GdkWindow* window) { + return gdk_drawable_get_display(GDK_DRAWABLE(window)); +} + inline int gdk_window_get_height(GdkWindow* window) { int height; gdk_drawable_get_size(GDK_DRAWABLE(window), NULL, &height); |