Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4938)

Unified Diff: chrome/browser/gtk/tabs/tab_gtk.cc

Issue 218017: GTK: First cut at tab dragging automation.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: comments Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/gtk/tabs/tab_gtk.cc
===================================================================
--- chrome/browser/gtk/tabs/tab_gtk.cc (revision 26890)
+++ chrome/browser/gtk/tabs/tab_gtk.cc (working copy)
@@ -218,24 +218,27 @@
}
void TabGtk::DidProcessEvent(GdkEvent* event) {
- if (event->type != GDK_MOTION_NOTIFY)
+ if (!(event->type == GDK_MOTION_NOTIFY || event->type == GDK_LEAVE_NOTIFY ||
+ event->type == GDK_ENTER_NOTIFY)) {
return;
+ }
if (drag_widget_) {
delegate_->ContinueDrag(NULL);
return;
}
- GdkEventMotion* motion = reinterpret_cast<GdkEventMotion*>(event);
- GdkEventButton* button = reinterpret_cast<GdkEventButton*>(last_mouse_down_);
- bool dragging = gtk_drag_check_threshold(widget(),
- static_cast<gint>(button->x),
- static_cast<gint>(button->y),
- static_cast<gint>(motion->x),
- static_cast<gint>(motion->y));
- if (dragging) {
- StartDragging(gfx::Point(static_cast<int>(button->x),
- static_cast<int>(button->y)));
+ gint old_x = static_cast<gint>(last_mouse_down_->button.x_root);
+ gint old_y = static_cast<gint>(last_mouse_down_->button.y_root);
+ gdouble new_x;
+ gdouble new_y;
+ gdk_event_get_root_coords(event, &new_x, &new_y);
+
+ if (gtk_drag_check_threshold(widget(), old_x, old_y,
+ static_cast<gint>(new_x), static_cast<gint>(new_y))) {
+ StartDragging(gfx::Point(
+ static_cast<int>(last_mouse_down_->button.x),
+ static_cast<int>(last_mouse_down_->button.y)));
}
}

Powered by Google App Engine
This is Rietveld 408576698