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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 9808010: Keep the mouse cursor within desktop (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "content/browser/renderer_host/backing_store_skia.h" 10 #include "content/browser/renderer_host/backing_store_skia.h"
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 bool RenderWidgetHostViewAura::LockMouse() { 613 bool RenderWidgetHostViewAura::LockMouse() {
614 aura::RootWindow* root_window = window_->GetRootWindow(); 614 aura::RootWindow* root_window = window_->GetRootWindow();
615 if (!root_window) 615 if (!root_window)
616 return false; 616 return false;
617 617
618 if (mouse_locked_) 618 if (mouse_locked_)
619 return true; 619 return true;
620 620
621 mouse_locked_ = true; 621 mouse_locked_ = true;
622 622
623 // TODO(oshima): Support Window::ConfineCursorToWindow.
varunjain 2012/03/23 16:56:01 Please also make sure that we are ok with mouse lo
oshima 2012/03/23 18:25:09 will do.
623 root_window->SetCapture(window_); 624 root_window->SetCapture(window_);
624 if (root_window->ConfineCursorToWindow()) { 625 root_window->ShowCursor(false);
625 root_window->ShowCursor(false); 626 synthetic_move_sent_ = true;
626 synthetic_move_sent_ = true; 627 root_window->MoveCursorTo(window_->bounds().CenterPoint());
627 root_window->MoveCursorTo(window_->bounds().CenterPoint()); 628 if (aura::client::GetTooltipClient(root_window))
628 if (aura::client::GetTooltipClient(root_window)) 629 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false);
629 aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false); 630 return true;
630 return true;
631 } else {
632 mouse_locked_ = false;
633 root_window->ReleaseCapture(window_);
634 return false;
635 }
636 } 631 }
637 632
638 void RenderWidgetHostViewAura::UnlockMouse() { 633 void RenderWidgetHostViewAura::UnlockMouse() {
639 aura::RootWindow* root_window = window_->GetRootWindow(); 634 aura::RootWindow* root_window = window_->GetRootWindow();
640 if (!mouse_locked_ || !root_window) 635 if (!mouse_locked_ || !root_window)
641 return; 636 return;
642 637
643 mouse_locked_ = false; 638 mouse_locked_ = false;
644 639
645 root_window->ReleaseCapture(window_); 640 root_window->ReleaseCapture(window_);
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 WebKit::WebScreenInfo* results) { 1209 WebKit::WebScreenInfo* results) {
1215 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); 1210 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize();
1216 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); 1211 results->rect = WebKit::WebRect(0, 0, size.width(), size.height());
1217 results->availableRect = results->rect; 1212 results->availableRect = results->rect;
1218 // TODO(derat): Don't hardcode this? 1213 // TODO(derat): Don't hardcode this?
1219 results->depth = 24; 1214 results->depth = 24;
1220 results->depthPerComponent = 8; 1215 results->depthPerComponent = 8;
1221 results->verticalDPI = 96; 1216 results->verticalDPI = 96;
1222 results->horizontalDPI = 96; 1217 results->horizontalDPI = 96;
1223 } 1218 }
OLDNEW
« no previous file with comments | « base/message_pump_x.h ('k') | ui/aura/aura.gyp » ('j') | ui/aura/root_window_host_linux.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698