summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/browser_actions_toolbar_gtk.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-18 02:39:47 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-18 02:39:47 +0000
commitef6a75dbc49caf22561609d734675e9c36424dc2 (patch)
tree8307dc355bd56fb24d11651aa3d0beed093a3859 /chrome/browser/gtk/browser_actions_toolbar_gtk.cc
parent3e7801ea1a23c5dfa5e5dc5fdac0943a2e814467 (diff)
downloadchromium_src-ef6a75dbc49caf22561609d734675e9c36424dc2.zip
chromium_src-ef6a75dbc49caf22561609d734675e9c36424dc2.tar.gz
chromium_src-ef6a75dbc49caf22561609d734675e9c36424dc2.tar.bz2
gtk: Browser action dragging fixes
1) fix crasher triggered any time a drag from a different source hovers over the browser action bar. 2) fix graphical issue where changes to the ordering could possibly take a few seconds to propagate to other browser windows. BUG=30639 TEST=a) drag a bookmark over the browser action toolbar, don't crash b) open two windows. drag a browser action around, keep holding left mouse button and drag to a distant part of the screen, then release. The positional change should instantly take effect in the second browser window. Review URL: http://codereview.chromium.org/506065 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34925 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/browser_actions_toolbar_gtk.cc')
-rw-r--r--chrome/browser/gtk/browser_actions_toolbar_gtk.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc
index 4fc603d..91782f2 100644
--- a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc
+++ b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc
@@ -301,6 +301,8 @@ void BrowserActionsToolbarGtk::CreateButtonForExtension(Extension* extension,
// We ignore whether the drag was a "success" or "failure" in Gtk's opinion.
g_signal_connect(button->widget(), "drag-end",
G_CALLBACK(&OnDragEndThunk), this);
+ g_signal_connect(button->widget(), "drag-failed",
+ G_CALLBACK(&OnDragFailedThunk), this);
UpdateVisibility();
}
@@ -360,6 +362,10 @@ void BrowserActionsToolbarGtk::DragStarted(BrowserActionButton* button,
gboolean BrowserActionsToolbarGtk::OnDragMotion(GtkWidget* widget,
GdkDragContext* drag_context,
gint x, gint y, guint time) {
+ // Only handle drags we initiated.
+ if (!drag_button_)
+ return FALSE;
+
drop_index_ = x < kButtonSize ? 0 : x / (kButtonSize + kButtonPadding);
// We will go ahead and reorder the child in order to provide visual feedback
// to the user. We don't inform the model that it has moved until the drag
@@ -379,3 +385,13 @@ void BrowserActionsToolbarGtk::OnDragEnd(GtkWidget* button,
drag_button_ = NULL;
drop_index_ = -1;
}
+
+gboolean BrowserActionsToolbarGtk::OnDragFailed(GtkWidget* widget,
+ GdkDragContext* drag_context,
+ GtkDragResult result) {
+ // We connect to this signal and return TRUE so that the default failure
+ // animation (wherein the drag widget floats back to the start of the drag)
+ // does not show, and the drag-end signal is emitted immediately instead of
+ // several seconds later.
+ return TRUE;
+}