summaryrefslogtreecommitdiffstats
path: root/ui/gfx/screen_gtk.cc
diff options
context:
space:
mode:
authordominik.rottsches@intel.com <dominik.rottsches@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-12 13:17:30 +0000
committerdominik.rottsches@intel.com <dominik.rottsches@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-12 13:17:30 +0000
commit850a5090a9633304f89dd32683b0c23f6c91aa63 (patch)
tree1f38c7d0c80b490646d7cb877f03d43b7ca8a228 /ui/gfx/screen_gtk.cc
parentc99e16f358ed88ad8acec67acd3db52a10a0b9ed (diff)
downloadchromium_src-850a5090a9633304f89dd32683b0c23f6c91aa63.zip
chromium_src-850a5090a9633304f89dd32683b0c23f6c91aa63.tar.gz
chromium_src-850a5090a9633304f89dd32683b0c23f6c91aa63.tar.bz2
Implements display overlap algorithm for GTK. Needs to be implemented manually
since gdk only provides a function to do display matching using a window handle (cmp. gdk-screen-get-monitor-at-window()). BUG=135681 TEST=Manually tested on a dual screen configuration under Unity by drag a tab out of one tabstrip on the primary display to a new spot on the secondary display and back for example. R=oshima@chromium.org Review URL: https://chromiumcodereview.appspot.com/23579005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222774 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/screen_gtk.cc')
-rw-r--r--ui/gfx/screen_gtk.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/ui/gfx/screen_gtk.cc b/ui/gfx/screen_gtk.cc
index 372b6a6..ac2464b 100644
--- a/ui/gfx/screen_gtk.cc
+++ b/ui/gfx/screen_gtk.cc
@@ -162,8 +162,21 @@ class ScreenGtk : public gfx::Screen {
// Returns the display that most closely intersects the provided bounds.
virtual gfx::Display GetDisplayMatching(
const gfx::Rect& match_rect) const OVERRIDE {
- // TODO(thestig) Implement multi-monitor support.
- return GetPrimaryDisplay();
+ std::vector<gfx::Display> displays = GetAllDisplays();
+ gfx::Display maxIntersectDisplay;
+ gfx::Rect maxIntersection;
+ for (std::vector<gfx::Display>::iterator it = displays.begin();
+ it != displays.end(); ++it) {
+ gfx::Rect displayIntersection = it->bounds();
+ displayIntersection.Intersect(match_rect);
+ if (displayIntersection.size().GetArea() >
+ maxIntersection.size().GetArea()) {
+ maxIntersectDisplay = *it;
+ maxIntersection = displayIntersection;
+ }
+ }
+ return maxIntersectDisplay.is_valid() ?
+ maxIntersectDisplay : GetPrimaryDisplay();
}
// Returns the primary display.