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