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

Side by Side Diff: ui/gfx/screen_gtk.cc

Issue 11270042: Add non-member non-mutating methods for common gfx::Rect operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 1 month 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
« no previous file with comments | « ui/gfx/rect_unittest.cc ('k') | ui/gfx/screen_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/gfx/screen.h" 5 #include "ui/gfx/screen.h"
6 6
7 #include <gdk/gdkx.h> 7 #include <gdk/gdkx.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 return GetPrimaryDisplay(); 150 return GetPrimaryDisplay();
151 } 151 }
152 152
153 // Returns the primary display. 153 // Returns the primary display.
154 virtual gfx::Display GetPrimaryDisplay() const OVERRIDE { 154 virtual gfx::Display GetPrimaryDisplay() const OVERRIDE {
155 gfx::Rect bounds = NativePrimaryMonitorBounds(); 155 gfx::Rect bounds = NativePrimaryMonitorBounds();
156 // TODO(oshima): Implement ID and Observer. 156 // TODO(oshima): Implement ID and Observer.
157 gfx::Display display(0, bounds); 157 gfx::Display display(0, bounds);
158 gfx::Rect rect; 158 gfx::Rect rect;
159 if (GetScreenWorkArea(&rect)) { 159 if (GetScreenWorkArea(&rect)) {
160 bounds.Intersect(rect); 160 display.set_work_area(gfx::IntersectRects(rect, bounds));
161 display.set_work_area(bounds);
162 } else { 161 } else {
163 // Return the best we've got. 162 // Return the best we've got.
164 display.set_work_area(bounds); 163 display.set_work_area(bounds);
165 } 164 }
166 return display; 165 return display;
167 } 166 }
168 167
169 private: 168 private:
170 DISALLOW_COPY_AND_ASSIGN(ScreenGtk); 169 DISALLOW_COPY_AND_ASSIGN(ScreenGtk);
171 }; 170 };
172 171
173 } // namespace 172 } // namespace
174 173
175 namespace gfx { 174 namespace gfx {
176 175
177 Screen* CreateNativeScreen() { 176 Screen* CreateNativeScreen() {
178 return new ScreenGtk; 177 return new ScreenGtk;
179 } 178 }
180 179
181 } // namespace gfx 180 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/rect_unittest.cc ('k') | ui/gfx/screen_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698