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

Side by Side Diff: views/widget/widget_gtk.cc

Issue 6685069: Disambiguate OnMouseCaptureLost from OnMouseReleased, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address most TODOs and sync. Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "views/widget/widget_gtk.h" 5 #include "views/widget/widget_gtk.h"
6 6
7 #include <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 #include <gdk/gdkx.h> 8 #include <gdk/gdkx.h>
9 #include <X11/extensions/shape.h> 9 #include <X11/extensions/shape.h>
10 10
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 1265
1266 bool WidgetGtk::ReleaseCaptureOnMouseReleased() { 1266 bool WidgetGtk::ReleaseCaptureOnMouseReleased() {
1267 return true; 1267 return true;
1268 } 1268 }
1269 1269
1270 void WidgetGtk::HandleXGrabBroke() { 1270 void WidgetGtk::HandleXGrabBroke() {
1271 } 1271 }
1272 1272
1273 void WidgetGtk::HandleGtkGrabBroke() { 1273 void WidgetGtk::HandleGtkGrabBroke() {
1274 if (is_mouse_down_) 1274 if (is_mouse_down_)
1275 GetRootView()->ProcessMouseDragCanceled(); 1275 GetRootView()->OnMouseCaptureLost();
1276 is_mouse_down_ = false; 1276 is_mouse_down_ = false;
1277 } 1277 }
1278 1278
1279 //////////////////////////////////////////////////////////////////////////////// 1279 ////////////////////////////////////////////////////////////////////////////////
1280 // WidgetGtk, private: 1280 // WidgetGtk, private:
1281 1281
1282 RootView* WidgetGtk::CreateRootView() { 1282 RootView* WidgetGtk::CreateRootView() {
1283 return new RootView(this); 1283 return new RootView(this);
1284 } 1284 }
1285 1285
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 last_mouse_event_was_move_ = false; 1336 last_mouse_event_was_move_ = false;
1337 MouseEvent mouse_up(ui::ET_MOUSE_RELEASED, x, y, 1337 MouseEvent mouse_up(ui::ET_MOUSE_RELEASED, x, y,
1338 GetFlagsForEventButton(*event)); 1338 GetFlagsForEventButton(*event));
1339 // Release the capture first, that way we don't get confused if 1339 // Release the capture first, that way we don't get confused if
1340 // OnMouseReleased blocks. 1340 // OnMouseReleased blocks.
1341 if (HasNativeCapture() && ReleaseCaptureOnMouseReleased()) 1341 if (HasNativeCapture() && ReleaseCaptureOnMouseReleased())
1342 ReleaseNativeCapture(); 1342 ReleaseNativeCapture();
1343 is_mouse_down_ = false; 1343 is_mouse_down_ = false;
1344 // GTK generates a mouse release at the end of dnd. We need to ignore it. 1344 // GTK generates a mouse release at the end of dnd. We need to ignore it.
1345 if (!drag_data_) 1345 if (!drag_data_)
1346 GetRootView()->OnMouseReleased(mouse_up, false); 1346 GetRootView()->OnMouseReleased(mouse_up);
1347 } 1347 }
1348 1348
1349 bool WidgetGtk::ProcessScroll(GdkEventScroll* event) { 1349 bool WidgetGtk::ProcessScroll(GdkEventScroll* event) {
1350 // An event may come from a contained widget which has its own gdk window. 1350 // An event may come from a contained widget which has its own gdk window.
1351 // Translate it to the widget's coordinates. 1351 // Translate it to the widget's coordinates.
1352 int x = 0, y = 0; 1352 int x = 0, y = 0;
1353 GetContainedWidgetEventCoordinates(event, &x, &y); 1353 GetContainedWidgetEventCoordinates(event, &x, &y);
1354 GdkEventScroll translated_event = *event; 1354 GdkEventScroll translated_event = *event;
1355 translated_event.x = x; 1355 translated_event.x = x;
1356 translated_event.y = y; 1356 translated_event.y = y;
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 1614
1615 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view); 1615 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view);
1616 if (native_widget) 1616 if (native_widget)
1617 children->insert(native_widget); 1617 children->insert(native_widget);
1618 gtk_container_foreach(GTK_CONTAINER(native_view), 1618 gtk_container_foreach(GTK_CONTAINER(native_view),
1619 EnumerateChildWidgetsForNativeWidgets, 1619 EnumerateChildWidgetsForNativeWidgets,
1620 reinterpret_cast<gpointer>(children)); 1620 reinterpret_cast<gpointer>(children));
1621 } 1621 }
1622 1622
1623 } // namespace views 1623 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698