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 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 // If a user double clicks, we will get two button presses in a row without | 1177 // If a user double clicks, we will get two button presses in a row without |
1178 // any intervening mouse up, hence we must flush delayed mousedowns here as | 1178 // any intervening mouse up, hence we must flush delayed mousedowns here as |
1179 // well as in the button release handler. | 1179 // well as in the button release handler. |
1180 if (bm->delaying_mousedown_) { | 1180 if (bm->delaying_mousedown_) { |
1181 bm->SendDelayedMousedown(); | 1181 bm->SendDelayedMousedown(); |
1182 return FALSE; | 1182 return FALSE; |
1183 } | 1183 } |
1184 | 1184 |
1185 GtkTreePath* path; | 1185 GtkTreePath* path; |
1186 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tree_view), | 1186 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(tree_view), |
1187 event->x, event->y, &path, NULL, NULL, NULL); | 1187 static_cast<gint>(event->x), |
| 1188 static_cast<gint>(event->y), |
| 1189 &path, NULL, NULL, NULL); |
1188 | 1190 |
1189 if (path == NULL) | 1191 if (path == NULL) |
1190 return TRUE; | 1192 return TRUE; |
1191 | 1193 |
1192 if (gtk_tree_selection_path_is_selected(bm->right_selection(), path)) { | 1194 if (gtk_tree_selection_path_is_selected(bm->right_selection(), path)) { |
1193 bm->mousedown_event_ = *event; | 1195 bm->mousedown_event_ = *event; |
1194 bm->delaying_mousedown_ = true; | 1196 bm->delaying_mousedown_ = true; |
1195 gtk_tree_path_free(path); | 1197 gtk_tree_path_free(path); |
1196 return TRUE; | 1198 return TRUE; |
1197 } | 1199 } |
1198 | 1200 |
1199 gtk_tree_path_free(path); | 1201 gtk_tree_path_free(path); |
1200 return FALSE; | 1202 return FALSE; |
1201 } | 1203 } |
1202 | 1204 |
1203 // static | 1205 // static |
1204 gboolean BookmarkManagerGtk::OnRightTreeViewMotion( | 1206 gboolean BookmarkManagerGtk::OnRightTreeViewMotion( |
1205 GtkWidget* tree_view, GdkEventMotion* event, BookmarkManagerGtk* bm) { | 1207 GtkWidget* tree_view, GdkEventMotion* event, BookmarkManagerGtk* bm) { |
1206 // This handler is only used for the multi-drag workaround. | 1208 // This handler is only used for the multi-drag workaround. |
1207 if (!bm->delaying_mousedown_) | 1209 if (!bm->delaying_mousedown_) |
1208 return FALSE; | 1210 return FALSE; |
1209 | 1211 |
1210 if (gtk_drag_check_threshold(tree_view, | 1212 if (gtk_drag_check_threshold(tree_view, |
1211 bm->mousedown_event_.x, | 1213 static_cast<gint>(bm->mousedown_event_.x), |
1212 bm->mousedown_event_.y, | 1214 static_cast<gint>(bm->mousedown_event_.y), |
1213 event->x, | 1215 static_cast<gint>(event->x), |
1214 event->y)) { | 1216 static_cast<gint>(event->y))) { |
1215 bm->delaying_mousedown_ = false; | 1217 bm->delaying_mousedown_ = false; |
1216 GtkTargetList* targets = GtkDndUtil::GetTargetListFromCodeMask( | 1218 GtkTargetList* targets = GtkDndUtil::GetTargetListFromCodeMask( |
1217 GtkDndUtil::CHROME_BOOKMARK_ITEM | | 1219 GtkDndUtil::CHROME_BOOKMARK_ITEM | |
1218 GtkDndUtil::TEXT_URI_LIST); | 1220 GtkDndUtil::TEXT_URI_LIST); |
1219 gtk_drag_begin(tree_view, targets, GDK_ACTION_MOVE, | 1221 gtk_drag_begin(tree_view, targets, GDK_ACTION_MOVE, |
1220 1, reinterpret_cast<GdkEvent*>(event)); | 1222 1, reinterpret_cast<GdkEvent*>(event)); |
1221 // The drag adds a ref; let it own the list. | 1223 // The drag adds a ref; let it own the list. |
1222 gtk_target_list_unref(targets); | 1224 gtk_target_list_unref(targets); |
1223 } | 1225 } |
1224 | 1226 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1415 modifier & gtk_accelerator_get_default_mod_mask()); | 1417 modifier & gtk_accelerator_get_default_mod_mask()); |
1416 // The only accelerator we have registered is ctrl+w, so any other value is a | 1418 // The only accelerator we have registered is ctrl+w, so any other value is a |
1417 // non-fatal error. | 1419 // non-fatal error. |
1418 DCHECK_EQ(keyval, static_cast<guint>(GDK_w)); | 1420 DCHECK_EQ(keyval, static_cast<guint>(GDK_w)); |
1419 DCHECK_EQ(modifier, GDK_CONTROL_MASK); | 1421 DCHECK_EQ(modifier, GDK_CONTROL_MASK); |
1420 | 1422 |
1421 gtk_widget_destroy(bookmark_manager->window_); | 1423 gtk_widget_destroy(bookmark_manager->window_); |
1422 | 1424 |
1423 return TRUE; | 1425 return TRUE; |
1424 } | 1426 } |
OLD | NEW |