| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/singleton.h" | 9 #include "base/singleton.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // get a follow up event to tell us the drag has finished (either a | 243 // get a follow up event to tell us the drag has finished (either a |
| 244 // drag-failed or a drag-end). So we post a task to manually end the drag. | 244 // drag-failed or a drag-end). So we post a task to manually end the drag. |
| 245 // If GTK+ does send the drag-failed or drag-end event, we cancel the task. | 245 // If GTK+ does send the drag-failed or drag-end event, we cancel the task. |
| 246 MessageLoop::current()->PostTask(FROM_HERE, | 246 MessageLoop::current()->PostTask(FROM_HERE, |
| 247 drag_end_factory_.NewRunnableMethod(&TabGtk::EndDrag, false)); | 247 drag_end_factory_.NewRunnableMethod(&TabGtk::EndDrag, false)); |
| 248 return TRUE; | 248 return TRUE; |
| 249 } | 249 } |
| 250 | 250 |
| 251 void TabGtk::OnDragBegin(GtkWidget* widget, GdkDragContext* context) { | 251 void TabGtk::OnDragBegin(GtkWidget* widget, GdkDragContext* context) { |
| 252 GdkPixbuf* pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 1, 1); | 252 GdkPixbuf* pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 1, 1); |
| 253 gdk_pixbuf_fill(pixbuf, 0); |
| 253 gtk_drag_set_icon_pixbuf(context, pixbuf, 0, 0); | 254 gtk_drag_set_icon_pixbuf(context, pixbuf, 0, 0); |
| 254 g_object_unref(pixbuf); | 255 g_object_unref(pixbuf); |
| 255 } | 256 } |
| 256 | 257 |
| 257 /////////////////////////////////////////////////////////////////////////////// | 258 /////////////////////////////////////////////////////////////////////////////// |
| 258 // TabGtk, MessageLoop::Observer implementation: | 259 // TabGtk, MessageLoop::Observer implementation: |
| 259 | 260 |
| 260 void TabGtk::WillProcessEvent(GdkEvent* event) { | 261 void TabGtk::WillProcessEvent(GdkEvent* event) { |
| 261 // Nothing to do. | 262 // Nothing to do. |
| 262 } | 263 } |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 gdk_event_free(last_mouse_down_); | 389 gdk_event_free(last_mouse_down_); |
| 389 last_mouse_down_ = NULL; | 390 last_mouse_down_ = NULL; |
| 390 } | 391 } |
| 391 | 392 |
| 392 // Notify the drag helper that we're done with any potential drag operations. | 393 // Notify the drag helper that we're done with any potential drag operations. |
| 393 // Clean up the drag helper, which is re-created on the next mouse press. | 394 // Clean up the drag helper, which is re-created on the next mouse press. |
| 394 delegate_->EndDrag(canceled); | 395 delegate_->EndDrag(canceled); |
| 395 | 396 |
| 396 observer_.reset(); | 397 observer_.reset(); |
| 397 } | 398 } |
| OLD | NEW |