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

Unified Diff: ash/wm/partial_screenshot_view.cc

Issue 9969149: SetCapture of mouse events in partial screenshot. Mouse events are routed to the capture window. I… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add OnCaptureLost Created 8 years, 8 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
« no previous file with comments | « ash/wm/partial_screenshot_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/partial_screenshot_view.cc
diff --git a/ash/wm/partial_screenshot_view.cc b/ash/wm/partial_screenshot_view.cc
index 23bdda448a46e4a2bd75dcafa3ecb78bc68b7bdc..0fa4f8ea85d9061a82ea353443bbe0a282804a0a 100644
--- a/ash/wm/partial_screenshot_view.cc
+++ b/ash/wm/partial_screenshot_view.cc
@@ -10,6 +10,7 @@
#include "ash/wm/partial_screenshot_event_filter.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
+#include "ui/base/events.h"
#include "ui/base/cursor/cursor.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/rect.h"
@@ -56,6 +57,11 @@ void PartialScreenshotView::StartPartialScreenshot(
widget->GetNativeView()->SetName("PartialScreenshotView");
widget->StackAtTop();
widget->Show();
+ // Captures mouse events in case that context menu already captures the
+ // events. This will close the context menu.
+ // TODO(mukai): introduce stacking mechanism to capture window to
sky 2012/04/12 15:30:45 To have menus stay on screen in this scenario will
Jun Mukai 2012/04/13 06:11:28 Then, removed the TODO.
+ // prevent closing menus.
+ widget->GetNativeView()->SetCapture(ui::CW_LOCK_MOUSE | ui::CW_LOCK_TOUCH);
view->set_window(widget->GetNativeWindow());
Shell::GetInstance()->partial_screenshot_filter()->Activate(view);
@@ -85,6 +91,10 @@ void PartialScreenshotView::OnPaint(gfx::Canvas* canvas) {
}
}
+void PartialScreenshotView::OnMouseCaptureLost() {
+ Cancel();
+}
+
bool PartialScreenshotView::OnMousePressed(const views::MouseEvent& event) {
start_position_ = event.location();
return true;
« no previous file with comments | « ash/wm/partial_screenshot_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698