summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-20 01:58:19 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-20 01:58:19 +0000
commit7c2b1ea1b9ecf78f90ebf13baa5de6ed4d4587d3 (patch)
tree3d45fc83efc473661d23dd60d09227fbb95c1882 /chrome/browser
parentf63881e697b09868c1ddcea92e8dba0681f68685 (diff)
downloadchromium_src-7c2b1ea1b9ecf78f90ebf13baa5de6ed4d4587d3.zip
chromium_src-7c2b1ea1b9ecf78f90ebf13baa5de6ed4d4587d3.tar.gz
chromium_src-7c2b1ea1b9ecf78f90ebf13baa5de6ed4d4587d3.tar.bz2
GTK bookmark manager polish.
1. on right tree view, deselect everything when user presses below lowest row. This is not native gtktreeview behavior, but it is used in windows and by nautilus via libegg, so it matches user expectations. 2. allow default left click handler to run on right tree view. This allows a left click below the lowest row to cause the tree view pane to take focus. 3. continue blocking empty drags. BUG=27869,27872 Review URL: http://codereview.chromium.org/417002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32585 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/gtk/bookmark_manager_gtk.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/chrome/browser/gtk/bookmark_manager_gtk.cc b/chrome/browser/gtk/bookmark_manager_gtk.cc
index a6465ff..a0a939d 100644
--- a/chrome/browser/gtk/bookmark_manager_gtk.cc
+++ b/chrome/browser/gtk/bookmark_manager_gtk.cc
@@ -1158,9 +1158,9 @@ void BookmarkManagerGtk::OnRightTreeViewFocusIn(
// We do a couple things in this handler.
//
-// 1. Ignore left clicks that occur below the lowest row so we don't try to
-// start an empty drag, or allow the user to start a drag on the selected
-// row by dragging on whitespace. This is the path == NULL return.
+// 1. On left clicks that occur below the lowest row, unselect all selected
+// rows. This is not a native GtkTreeView behavior, but it is added by libegg
+// and is thus present in Nautilus. This is the path == NULL path.
// 2. Cache left clicks that occur on an already active selection. If the user
// begins a drag, then we will throw away this event and initiate a drag on the
// tree view manually. If the user doesn't begin a drag (e.g. just releases the
@@ -1197,8 +1197,12 @@ gboolean BookmarkManagerGtk::OnRightTreeViewButtonPress(
static_cast<gint>(event->y),
&path, NULL, NULL, NULL);
- if (path == NULL)
- return TRUE;
+ if (path == NULL) {
+ // Checking that the widget already has focus matches libegg behavior.
+ if (GTK_WIDGET_HAS_FOCUS(tree_view))
+ gtk_tree_selection_unselect_all(bm->right_selection());
+ return FALSE;
+ }
if (gtk_tree_selection_path_is_selected(bm->right_selection(), path)) {
bm->mousedown_event_ = *event;
@@ -1214,7 +1218,12 @@ gboolean BookmarkManagerGtk::OnRightTreeViewButtonPress(
// static
gboolean BookmarkManagerGtk::OnRightTreeViewMotion(
GtkWidget* tree_view, GdkEventMotion* event, BookmarkManagerGtk* bm) {
- // This handler is only used for the multi-drag workaround.
+ // Swallow motion events when no row is selected. This prevents the initiation
+ // of empty drags.
+ if (gtk_tree_selection_count_selected_rows(bm->right_selection()) == 0)
+ return TRUE;
+
+ // Otherwise this handler is only used for the multi-drag workaround.
if (!bm->delaying_mousedown_)
return FALSE;