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

Unified Diff: chrome/browser/ui/ime/ime_window.cc

Issue 2335503002: Finds the nearest display to show the follow-cursor IME window, instead of using the primary one. (Closed)
Patch Set: .. Created 4 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ime/ime_window.cc
diff --git a/chrome/browser/ui/ime/ime_window.cc b/chrome/browser/ui/ime/ime_window.cc
index 534a5ea5841e07ded582f55ce0f1105c31c02ec6..c23aa9b0b8d237b7fa368c47f04bab1e55d9a2f9 100644
--- a/chrome/browser/ui/ime/ime_window.cc
+++ b/chrome/browser/ui/ime/ime_window.cc
@@ -18,6 +18,7 @@
#include "extensions/common/extension.h"
#include "extensions/common/manifest_handlers/icons_handler.h"
#include "ui/display/display.h"
+#include "ui/display/display_finder.h"
#include "ui/display/screen.h"
#include "ui/gfx/image/image.h"
@@ -101,10 +102,12 @@ void ImeWindow::FollowCursor(const gfx::Rect& cursor_bounds) {
return;
gfx::Rect screen_bounds =
- display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
+ display::FindDisplayNearestPoint(
+ display::Screen::GetScreen()->GetAllDisplays(),
+ gfx::Point(cursor_bounds.x(), cursor_bounds.y()))->bounds();
gfx::Rect window_bounds = native_window_->GetBounds();
- int screen_width = screen_bounds.width();
- int screen_height = screen_bounds.height();
+ int screen_width = screen_bounds.x() + screen_bounds.width();
+ int screen_height = screen_bounds.y() + screen_bounds.height();
int width = window_bounds.width();
int height = window_bounds.height();
// By default, aligns the left of the window client area to the left of the
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698