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

Unified Diff: chrome/browser/gtk/tab_contents_drag_source.cc

Issue 668125: Basic DragImage implementation.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/gtk/tab_contents_drag_source.h ('k') | chrome/browser/renderer_host/render_view_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/tab_contents_drag_source.cc
===================================================================
--- chrome/browser/gtk/tab_contents_drag_source.cc (revision 41111)
+++ chrome/browser/gtk/tab_contents_drag_source.cc (working copy)
@@ -6,6 +6,7 @@
#include <string>
+#include "app/gfx/gtk_util.h"
#include "app/gtk_dnd_util.h"
#include "base/file_util.h"
#include "base/mime_util.h"
@@ -69,7 +70,9 @@
}
void TabContentsDragSource::StartDragging(const WebDropData& drop_data,
- GdkEventButton* last_mouse_down) {
+ GdkEventButton* last_mouse_down,
+ const SkBitmap& image,
+ const gfx::Point& image_offset) {
int targets_mask = 0;
if (!drop_data.plain_text.empty())
@@ -98,6 +101,8 @@
}
drop_data_.reset(new WebDropData(drop_data));
+ drag_image_ = image;
+ image_offset_ = image_offset;
GtkTargetList* list = GtkDndUtil::GetTargetListFromCodeMask(targets_mask);
if (targets_mask & GtkDndUtil::CHROME_WEBDROP_FILE_CONTENTS) {
@@ -303,6 +308,14 @@
generated_download_file_name.value().c_str()),
generated_download_file_name.value().length());
}
+
+ if (!drag_image_.isNull()) {
+ GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&drag_image_);
+ gtk_drag_set_icon_pixbuf(drag_context, pixbuf,
+ image_offset_.x(), image_offset_.y());
+ // Let the drag take ownership.
+ g_object_unref(pixbuf);
+ }
}
void TabContentsDragSource::OnDragEnd(GdkDragContext* drag_context,
« no previous file with comments | « chrome/browser/gtk/tab_contents_drag_source.h ('k') | chrome/browser/renderer_host/render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698