Fix double click item activation in right pane of bookmark manager.
BUG=none TEST=double click on an unselected item, it should be activated Review URL: http://codereview.chromium.org/155368 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20424 0039d316-1c4b-4281-b951-d872f2087c98
Esse commit está contido em:
@@ -305,7 +305,8 @@ BookmarkManagerGtk::BookmarkManagerGtk(Profile* profile)
|
||||
organize_is_for_left_(true),
|
||||
search_factory_(this),
|
||||
select_file_dialog_(SelectFileDialog::Create(this)),
|
||||
delaying_mousedown_(false) {
|
||||
delaying_mousedown_(false),
|
||||
sending_delayed_mousedown_(false) {
|
||||
InitWidgets();
|
||||
g_signal_connect(window_, "destroy",
|
||||
G_CALLBACK(OnWindowDestroy), this);
|
||||
@@ -762,6 +763,14 @@ void BookmarkManagerGtk::SaveColumnConfiguration() {
|
||||
}
|
||||
}
|
||||
|
||||
void BookmarkManagerGtk::SendDelayedMousedown() {
|
||||
sending_delayed_mousedown_ = true;
|
||||
gtk_propagate_event(right_tree_view_,
|
||||
reinterpret_cast<GdkEvent*>(&mousedown_event_));
|
||||
sending_delayed_mousedown_ = false;
|
||||
delaying_mousedown_ = false;
|
||||
}
|
||||
|
||||
bool BookmarkManagerGtk::RecursiveFind(GtkTreeModel* model, GtkTreeIter* iter,
|
||||
int target) {
|
||||
GValue value = { 0, };
|
||||
@@ -1099,13 +1108,22 @@ void BookmarkManagerGtk::OnRightTreeViewFocusIn(GtkTreeView* tree_view,
|
||||
// static
|
||||
gboolean BookmarkManagerGtk::OnRightTreeViewButtonPress(GtkWidget* tree_view,
|
||||
GdkEventButton* event, BookmarkManagerGtk* bm) {
|
||||
// Always let the cached mousedown sent from OnTreeViewButtonRelease through.
|
||||
if (bm->delaying_mousedown_)
|
||||
// Always let cached mousedown events through.
|
||||
if (bm->sending_delayed_mousedown_) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (event->button != 1)
|
||||
return FALSE;
|
||||
|
||||
// If a user double clicks, we will get two button presses in a row without
|
||||
// any intervening mouse up, hence we must flush delayed mousedowns here as
|
||||
// well as in the button release handler.
|
||||
if (bm->delaying_mousedown_) {
|
||||
bm->SendDelayedMousedown();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GtkTreePath* path;
|
||||
gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tree_view),
|
||||
event->x, event->y, &path, NULL, NULL, NULL);
|
||||
@@ -1157,11 +1175,8 @@ gboolean BookmarkManagerGtk::OnTreeViewButtonRelease(GtkWidget* tree_view,
|
||||
NOTIMPLEMENTED();
|
||||
#endif
|
||||
|
||||
if (bm->delaying_mousedown_ && (tree_view == bm->right_tree_view_)) {
|
||||
gtk_propagate_event(tree_view,
|
||||
reinterpret_cast<GdkEvent*>(&bm->mousedown_event_));
|
||||
bm->delaying_mousedown_ = false;
|
||||
}
|
||||
if (bm->delaying_mousedown_ && (tree_view == bm->right_tree_view_))
|
||||
bm->SendDelayedMousedown();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -122,6 +122,10 @@ class BookmarkManagerGtk : public BookmarkModelObserver,
|
||||
// separately depending on whether the path column is showing.
|
||||
void SaveColumnConfiguration();
|
||||
|
||||
// Flush the saved mousedown. Should only be called when |delaying_mousedown_|
|
||||
// is true.
|
||||
void SendDelayedMousedown();
|
||||
|
||||
GtkTreeSelection* left_selection() {
|
||||
return gtk_tree_view_get_selection(GTK_TREE_VIEW(left_tree_view_));
|
||||
}
|
||||
@@ -246,10 +250,13 @@ class BookmarkManagerGtk : public BookmarkModelObserver,
|
||||
|
||||
scoped_refptr<SelectFileDialog> select_file_dialog_;
|
||||
|
||||
// These two variables used for the workaround for http://crbug.com/15240.
|
||||
// These variables are used for the workaround for http://crbug.com/15240.
|
||||
// The last mouse down we got. Only valid while |delaying_mousedown| is true.
|
||||
GdkEventButton mousedown_event_;
|
||||
bool delaying_mousedown_;
|
||||
// This is true while we are propagating a delayed mousedown. It is used to
|
||||
// tell the button press handler to ignore the event.
|
||||
bool sending_delayed_mousedown_;
|
||||
};
|
||||
|
||||
#endif // CHROME_BROWSER_GTK_BOOKMARK_MANAGER_GTK_H_
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário