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

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 comments, fix tests, cleanup, etc. 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
« no previous file with comments | « views/widget/root_view.cc ('k') | views/widget/widget_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 1272
1273 bool WidgetGtk::ReleaseCaptureOnMouseReleased() { 1273 bool WidgetGtk::ReleaseCaptureOnMouseReleased() {
1274 return true; 1274 return true;
1275 } 1275 }
1276 1276
1277 void WidgetGtk::HandleXGrabBroke() { 1277 void WidgetGtk::HandleXGrabBroke() {
1278 } 1278 }
1279 1279
1280 void WidgetGtk::HandleGtkGrabBroke() { 1280 void WidgetGtk::HandleGtkGrabBroke() {
1281 if (is_mouse_down_) 1281 if (is_mouse_down_)
1282 GetRootView()->ProcessMouseDragCanceled(); 1282 GetRootView()->OnMouseCaptureLost();
1283 is_mouse_down_ = false; 1283 is_mouse_down_ = false;
1284 } 1284 }
1285 1285
1286 //////////////////////////////////////////////////////////////////////////////// 1286 ////////////////////////////////////////////////////////////////////////////////
1287 // WidgetGtk, private: 1287 // WidgetGtk, private:
1288 1288
1289 RootView* WidgetGtk::CreateRootView() { 1289 RootView* WidgetGtk::CreateRootView() {
1290 return new RootView(this); 1290 return new RootView(this);
1291 } 1291 }
1292 1292
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 last_mouse_event_was_move_ = false; 1343 last_mouse_event_was_move_ = false;
1344 MouseEvent mouse_up(ui::ET_MOUSE_RELEASED, x, y, 1344 MouseEvent mouse_up(ui::ET_MOUSE_RELEASED, x, y,
1345 GetFlagsForEventButton(*event)); 1345 GetFlagsForEventButton(*event));
1346 // Release the capture first, that way we don't get confused if 1346 // Release the capture first, that way we don't get confused if
1347 // OnMouseReleased blocks. 1347 // OnMouseReleased blocks.
1348 if (HasNativeCapture() && ReleaseCaptureOnMouseReleased()) 1348 if (HasNativeCapture() && ReleaseCaptureOnMouseReleased())
1349 ReleaseNativeCapture(); 1349 ReleaseNativeCapture();
1350 is_mouse_down_ = false; 1350 is_mouse_down_ = false;
1351 // GTK generates a mouse release at the end of dnd. We need to ignore it. 1351 // GTK generates a mouse release at the end of dnd. We need to ignore it.
1352 if (!drag_data_) 1352 if (!drag_data_)
1353 GetRootView()->OnMouseReleased(mouse_up, false); 1353 GetRootView()->OnMouseReleased(mouse_up);
1354 } 1354 }
1355 1355
1356 bool WidgetGtk::ProcessScroll(GdkEventScroll* event) { 1356 bool WidgetGtk::ProcessScroll(GdkEventScroll* event) {
1357 // An event may come from a contained widget which has its own gdk window. 1357 // An event may come from a contained widget which has its own gdk window.
1358 // Translate it to the widget's coordinates. 1358 // Translate it to the widget's coordinates.
1359 int x = 0, y = 0; 1359 int x = 0, y = 0;
1360 GetContainedWidgetEventCoordinates(event, &x, &y); 1360 GetContainedWidgetEventCoordinates(event, &x, &y);
1361 GdkEventScroll translated_event = *event; 1361 GdkEventScroll translated_event = *event;
1362 translated_event.x = x; 1362 translated_event.x = x;
1363 translated_event.y = y; 1363 translated_event.y = y;
(...skipping 250 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
« no previous file with comments | « views/widget/root_view.cc ('k') | views/widget/widget_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698