diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-22 22:09:08 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-22 22:09:08 +0000 |
commit | a5e71c95acee9dce58d009ad60fabfba2bfc5db9 (patch) | |
tree | 4f908bfc8d913cee290189b264a8c8fed20181f4 /ash/wm/capture_controller.cc | |
parent | 64c7184cbc0095b18dd2ae0f92074c35ac884df3 (diff) | |
download | chromium_src-a5e71c95acee9dce58d009ad60fabfba2bfc5db9.zip chromium_src-a5e71c95acee9dce58d009ad60fabfba2bfc5db9.tar.gz chromium_src-a5e71c95acee9dce58d009ad60fabfba2bfc5db9.tar.bz2 |
Update capture on all root windows
This is necessary to properly forward all events on all root windows
to the captured window and release when capture is cleared.
Original plan was is to do native capture, but it turns out to be difficult
(at least on chromeos/X11) because we need to warp the pointer to other window and handle mouse event there to support multiple displays layouts (see http://codereview.chromium.org/10581008/)
This also update Window::ConvertPointToWindow so that it accepts
windows on different root windows.
BUG=123160
TEST=ExtendedDesktopText.{Capture|ConvertPoint}
Review URL: https://chromiumcodereview.appspot.com/10638008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143722 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/capture_controller.cc')
-rw-r--r-- | ash/wm/capture_controller.cc | 46 |
1 files changed, 7 insertions, 39 deletions
diff --git a/ash/wm/capture_controller.cc b/ash/wm/capture_controller.cc index 60794ce..e000ab8 100644 --- a/ash/wm/capture_controller.cc +++ b/ash/wm/capture_controller.cc @@ -31,48 +31,16 @@ void CaptureController::SetCapture(aura::Window* new_capture_window) { DCHECK(!new_capture_window || new_capture_window->GetRootWindow()); DCHECK(!capture_window_ || capture_window_->GetRootWindow()); - // TODO(oshima): Call this on all root windows. - Shell::GetPrimaryRootWindow()->gesture_recognizer()-> - TransferEventsTo(capture_window_, new_capture_window); - aura::Window* old_capture_window = capture_window_; - aura::RootWindow* old_capture_root_window = - old_capture_window ? old_capture_window->GetRootWindow() : NULL; - aura::RootWindow* new_capture_root_window = - new_capture_window ? new_capture_window->GetRootWindow() : NULL; - capture_window_ = new_capture_window; - // Release native input if the capture is either release on or - // moved from old root window. - if (old_capture_window && - (!new_capture_window || - new_capture_root_window != old_capture_root_window)) - old_capture_root_window->ReleaseNativeCapture(); - - // Capture native input if new capture is set, or moved to - // new root window. - if (new_capture_window && - (!old_capture_window || - old_capture_root_window != new_capture_root_window)) - new_capture_root_window->SetNativeCapture(); - - if (new_capture_root_window && - new_capture_root_window == old_capture_root_window) { - // Capture changed within the same root window. - new_capture_root_window->UpdateCapture(old_capture_window, - new_capture_window); - - } else if (new_capture_root_window && - new_capture_root_window != old_capture_root_window) { - // Either new window is captured, or the capture changed between different - // root windows, - if (old_capture_root_window) - old_capture_root_window->UpdateCapture(old_capture_window, NULL); - new_capture_root_window->UpdateCapture(NULL, capture_window_); - } else if (old_capture_root_window) { - // Capture is released. - old_capture_root_window->UpdateCapture(old_capture_window, NULL); + Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); + for (Shell::RootWindowList::iterator iter = root_windows.begin(); + iter != root_windows.end(); ++iter) { + aura::RootWindow* root_window = *iter; + root_window->gesture_recognizer()-> + TransferEventsTo(old_capture_window, new_capture_window); + root_window->UpdateCapture(old_capture_window, new_capture_window); } return; } |