OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/gtk/tabs/tab_gtk.h" | 5 #include "chrome/browser/ui/gtk/tabs/tab_gtk.h" |
6 | 6 |
7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
319 } | 319 } |
320 | 320 |
321 void TabGtk::DestroyDragWidget() { | 321 void TabGtk::DestroyDragWidget() { |
322 if (drag_widget_) { | 322 if (drag_widget_) { |
323 gtk_widget_destroy(drag_widget_); | 323 gtk_widget_destroy(drag_widget_); |
324 drag_widget_ = NULL; | 324 drag_widget_ = NULL; |
325 } | 325 } |
326 } | 326 } |
327 | 327 |
328 void TabGtk::StartDragging(gfx::Point drag_offset) { | 328 void TabGtk::StartDragging(gfx::Point drag_offset) { |
329 // If the tab is not selected don't start the drag operation. | |
sky
2012/07/18 22:26:46
Add a comment that since the drag is processed aft
Cris Neckar
2012/07/19 18:18:56
Done.
| |
330 if (!IsSelected()) | |
331 return; | |
332 | |
329 CreateDragWidget(); | 333 CreateDragWidget(); |
330 | 334 |
331 GtkTargetList* list = ui::GetTargetListFromCodeMask(ui::CHROME_TAB); | 335 GtkTargetList* list = ui::GetTargetListFromCodeMask(ui::CHROME_TAB); |
332 gtk_drag_begin(drag_widget_, list, GDK_ACTION_MOVE, | 336 gtk_drag_begin(drag_widget_, list, GDK_ACTION_MOVE, |
333 1, // Drags are always initiated by the left button. | 337 1, // Drags are always initiated by the left button. |
334 last_mouse_down_); | 338 last_mouse_down_); |
335 // gtk_drag_begin adds a reference to list, so unref it here. | 339 // gtk_drag_begin adds a reference to list, so unref it here. |
336 gtk_target_list_unref(list); | 340 gtk_target_list_unref(list); |
337 delegate_->MaybeStartDrag(this, drag_offset); | 341 delegate_->MaybeStartDrag(this, drag_offset); |
338 } | 342 } |
(...skipping 14 matching lines...) Expand all Loading... | |
353 gdk_event_free(last_mouse_down_); | 357 gdk_event_free(last_mouse_down_); |
354 last_mouse_down_ = NULL; | 358 last_mouse_down_ = NULL; |
355 } | 359 } |
356 | 360 |
357 // Notify the drag helper that we're done with any potential drag operations. | 361 // Notify the drag helper that we're done with any potential drag operations. |
358 // Clean up the drag helper, which is re-created on the next mouse press. | 362 // Clean up the drag helper, which is re-created on the next mouse press. |
359 delegate_->EndDrag(canceled); | 363 delegate_->EndDrag(canceled); |
360 | 364 |
361 observer_.reset(); | 365 observer_.reset(); |
362 } | 366 } |
OLD | NEW |