OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/gtk/bookmark_manager_gtk.h" | 5 #include "chrome/browser/gtk/bookmark_manager_gtk.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "app/gtk_dnd_util.h" | 10 #include "app/gtk_dnd_util.h" |
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 // If a user double clicks, we will get two button presses in a row without | 1176 // If a user double clicks, we will get two button presses in a row without |
1177 // any intervening mouse up, hence we must flush delayed mousedowns here as | 1177 // any intervening mouse up, hence we must flush delayed mousedowns here as |
1178 // well as in the button release handler. | 1178 // well as in the button release handler. |
1179 if (bm->delaying_mousedown_) { | 1179 if (bm->delaying_mousedown_) { |
1180 bm->SendDelayedMousedown(); | 1180 bm->SendDelayedMousedown(); |
1181 return FALSE; | 1181 return FALSE; |
1182 } | 1182 } |
1183 | 1183 |
1184 GtkTreePath* path; | 1184 GtkTreePath* path; |
1185 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tree_view), | 1185 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tree_view), |
1186 static_cast<gint>(event->x), | 1186 event->x, event->y, &path, NULL, NULL, NULL); |
1187 static_cast<gint>(event->y), &path, | |
1188 NULL, NULL, NULL); | |
1189 | 1187 |
1190 if (path == NULL) | 1188 if (path == NULL) |
1191 return TRUE; | 1189 return TRUE; |
1192 | 1190 |
1193 if (gtk_tree_selection_path_is_selected(bm->right_selection(), path)) { | 1191 if (gtk_tree_selection_path_is_selected(bm->right_selection(), path)) { |
1194 bm->mousedown_event_ = *event; | 1192 bm->mousedown_event_ = *event; |
1195 bm->delaying_mousedown_ = true; | 1193 bm->delaying_mousedown_ = true; |
1196 gtk_tree_path_free(path); | 1194 gtk_tree_path_free(path); |
1197 return TRUE; | 1195 return TRUE; |
1198 } | 1196 } |
1199 | 1197 |
1200 gtk_tree_path_free(path); | 1198 gtk_tree_path_free(path); |
1201 return FALSE; | 1199 return FALSE; |
1202 } | 1200 } |
1203 | 1201 |
1204 // static | 1202 // static |
1205 gboolean BookmarkManagerGtk::OnRightTreeViewMotion( | 1203 gboolean BookmarkManagerGtk::OnRightTreeViewMotion( |
1206 GtkWidget* tree_view, GdkEventMotion* event, BookmarkManagerGtk* bm) { | 1204 GtkWidget* tree_view, GdkEventMotion* event, BookmarkManagerGtk* bm) { |
1207 // This handler is only used for the multi-drag workaround. | 1205 // This handler is only used for the multi-drag workaround. |
1208 if (!bm->delaying_mousedown_) | 1206 if (!bm->delaying_mousedown_) |
1209 return FALSE; | 1207 return FALSE; |
1210 | 1208 |
1211 if (gtk_drag_check_threshold(tree_view, | 1209 if (gtk_drag_check_threshold(tree_view, |
1212 static_cast<gint>(bm->mousedown_event_.x), | 1210 bm->mousedown_event_.x, |
1213 static_cast<gint>(bm->mousedown_event_.y), | 1211 bm->mousedown_event_.y, |
1214 static_cast<gint>(event->x), | 1212 event->x, |
1215 static_cast<gint>(event->y))) { | 1213 event->y)) { |
1216 bm->delaying_mousedown_ = false; | 1214 bm->delaying_mousedown_ = false; |
1217 GtkTargetList* targets = GtkDndUtil::GetTargetListFromCodeMask( | 1215 GtkTargetList* targets = GtkDndUtil::GetTargetListFromCodeMask( |
1218 GtkDndUtil::CHROME_BOOKMARK_ITEM | | 1216 GtkDndUtil::CHROME_BOOKMARK_ITEM | |
1219 GtkDndUtil::TEXT_URI_LIST); | 1217 GtkDndUtil::TEXT_URI_LIST); |
1220 gtk_drag_begin(tree_view, targets, GDK_ACTION_MOVE, | 1218 gtk_drag_begin(tree_view, targets, GDK_ACTION_MOVE, |
1221 1, reinterpret_cast<GdkEvent*>(event)); | 1219 1, reinterpret_cast<GdkEvent*>(event)); |
1222 // The drag adds a ref; let it own the list. | 1220 // The drag adds a ref; let it own the list. |
1223 gtk_target_list_unref(targets); | 1221 gtk_target_list_unref(targets); |
1224 } | 1222 } |
1225 | 1223 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 modifier & gtk_accelerator_get_default_mod_mask()); | 1414 modifier & gtk_accelerator_get_default_mod_mask()); |
1417 // The only accelerator we have registered is ctrl+w, so any other value is a | 1415 // The only accelerator we have registered is ctrl+w, so any other value is a |
1418 // non-fatal error. | 1416 // non-fatal error. |
1419 DCHECK_EQ(keyval, static_cast<guint>(GDK_w)); | 1417 DCHECK_EQ(keyval, static_cast<guint>(GDK_w)); |
1420 DCHECK_EQ(modifier, GDK_CONTROL_MASK); | 1418 DCHECK_EQ(modifier, GDK_CONTROL_MASK); |
1421 | 1419 |
1422 gtk_widget_destroy(bookmark_manager->window_); | 1420 gtk_widget_destroy(bookmark_manager->window_); |
1423 | 1421 |
1424 return TRUE; | 1422 return TRUE; |
1425 } | 1423 } |
OLD | NEW |