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 guchar* pixels = gdk_pixbuf_get_pixels(pixbuf); | |
254 memset(pixels, 0, 4); | |
Elliot Glaysher
2011/01/21 21:33:06
Try 'gdk_pixbuf_fill(pixbuf, 0);' instead. This sh
| |
253 gtk_drag_set_icon_pixbuf(context, pixbuf, 0, 0); | 255 gtk_drag_set_icon_pixbuf(context, pixbuf, 0, 0); |
254 g_object_unref(pixbuf); | 256 g_object_unref(pixbuf); |
255 } | 257 } |
256 | 258 |
257 /////////////////////////////////////////////////////////////////////////////// | 259 /////////////////////////////////////////////////////////////////////////////// |
258 // TabGtk, MessageLoop::Observer implementation: | 260 // TabGtk, MessageLoop::Observer implementation: |
259 | 261 |
260 void TabGtk::WillProcessEvent(GdkEvent* event) { | 262 void TabGtk::WillProcessEvent(GdkEvent* event) { |
261 // Nothing to do. | 263 // Nothing to do. |
262 } | 264 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
388 gdk_event_free(last_mouse_down_); | 390 gdk_event_free(last_mouse_down_); |
389 last_mouse_down_ = NULL; | 391 last_mouse_down_ = NULL; |
390 } | 392 } |
391 | 393 |
392 // Notify the drag helper that we're done with any potential drag operations. | 394 // 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. | 395 // Clean up the drag helper, which is re-created on the next mouse press. |
394 delegate_->EndDrag(canceled); | 396 delegate_->EndDrag(canceled); |
395 | 397 |
396 observer_.reset(); | 398 observer_.reset(); |
397 } | 399 } |
OLD | NEW |