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

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

Issue 417002: GTK bookmark manager polish.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: typo Created 11 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/bookmark_manager_gtk.cc
===================================================================
--- chrome/browser/gtk/bookmark_manager_gtk.cc (revision 32561)
+++ chrome/browser/gtk/bookmark_manager_gtk.cc (working copy)
@@ -1158,9 +1158,9 @@
// 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 @@
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 @@
// 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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698