summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-17 21:45:48 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-17 21:45:48 +0000
commit87cfdd95bc7d5c97d8e6b0286798d1c198079cce (patch)
tree50456d86b137b9268f9cc8bc43ca679daf61f645
parentade58821601fc22d85a05c5d0962d40693cfbe30 (diff)
downloadchromium_src-87cfdd95bc7d5c97d8e6b0286798d1c198079cce.zip
chromium_src-87cfdd95bc7d5c97d8e6b0286798d1c198079cce.tar.gz
chromium_src-87cfdd95bc7d5c97d8e6b0286798d1c198079cce.tar.bz2
GTK: Get rid of default drag icon for tab drags.
I guess this regressed at some point. BUG=none TEST=none Review URL: http://codereview.chromium.org/209002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26491 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/gtk/tabs/tab_gtk.cc16
-rw-r--r--chrome/browser/gtk/tabs/tab_gtk.h11
2 files changed, 18 insertions, 9 deletions
diff --git a/chrome/browser/gtk/tabs/tab_gtk.cc b/chrome/browser/gtk/tabs/tab_gtk.cc
index ca9b93d..3850da9 100644
--- a/chrome/browser/gtk/tabs/tab_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_gtk.cc
@@ -17,12 +17,6 @@
namespace {
-void SetEmptyDragIcon(GtkWidget* widget) {
- GdkPixbuf* pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 1, 1);
- gtk_drag_source_set_icon_pixbuf(widget, pixbuf);
- g_object_unref(pixbuf);
-}
-
// Returns the width of the title for the current font, in pixels.
int GetTitleWidth(gfx::Font* font, std::wstring title) {
DCHECK(font);
@@ -208,6 +202,14 @@ gboolean TabGtk::OnDragFailed(GtkWidget* widget, GdkDragContext* context,
return TRUE;
}
+// static
+void TabGtk::OnDragBegin(GtkWidget* widget, GdkDragContext* context,
+ TabGtk* tab) {
+ GdkPixbuf* pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 1, 1);
+ gtk_drag_set_icon_pixbuf(context, pixbuf, 0, 0);
+ g_object_unref(pixbuf);
+}
+
///////////////////////////////////////////////////////////////////////////////
// TabGtk, MessageLoop::Observer implementation:
@@ -301,6 +303,8 @@ void TabGtk::CreateDragWidget() {
drag_widget_ = gtk_invisible_new();
g_signal_connect(drag_widget_, "drag-failed",
G_CALLBACK(OnDragFailed), this);
+ g_signal_connect_after(drag_widget_, "drag-begin",
+ G_CALLBACK(OnDragBegin), this);
}
void TabGtk::DestroyDragWidget() {
diff --git a/chrome/browser/gtk/tabs/tab_gtk.h b/chrome/browser/gtk/tabs/tab_gtk.h
index 2cd6d93..5c3c662 100644
--- a/chrome/browser/gtk/tabs/tab_gtk.h
+++ b/chrome/browser/gtk/tabs/tab_gtk.h
@@ -111,9 +111,14 @@ class TabGtk : public TabRendererGtk,
static gboolean OnButtonReleaseEvent(GtkWidget* widget, GdkEventButton* event,
TabGtk* tab);
- // drag-failed handler that is emitted when the drag is finished. The signal
- // is drag-failed, but that is only in the gtk sense in that we never used
- // the drag-n-drop API to transfer drop data.
+ // drag-begin is emitted when the drag is started. We connect so that we can
+ // set the drag icon to a transparent pixbuf.
+ static void OnDragBegin(GtkWidget* widget, GdkDragContext* context,
+ TabGtk* tab);
+
+ // drag-failed is emitted when the drag is finished. In our case the signal
+ // does not imply failure as we don't use the drag-n-drop API to transfer drop
+ // data.
static gboolean OnDragFailed(GtkWidget* widget, GdkDragContext* context,
GtkDragResult result, TabGtk* tab);