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

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

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 2 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
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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 return GetPrimaryDisplay(); 134 return GetPrimaryDisplay();
135 } 135 }
136 136
137 // static 137 // static
138 gfx::Display Screen::GetPrimaryDisplay() { 138 gfx::Display Screen::GetPrimaryDisplay() {
139 gfx::Rect bounds = NativePrimaryMonitorBounds(); 139 gfx::Rect bounds = NativePrimaryMonitorBounds();
140 // TODO(oshima): Implement ID and Observer. 140 // TODO(oshima): Implement ID and Observer.
141 gfx::Display display(0, bounds); 141 gfx::Display display(0, bounds);
142 gfx::Rect rect; 142 gfx::Rect rect;
143 if (GetScreenWorkArea(&rect)) { 143 if (GetScreenWorkArea(&rect)) {
144 display.set_work_area(rect.Intersect(bounds)); 144 rect.Intersect(bounds);
145 display.set_work_area(rect);
145 } else { 146 } else {
146 // Return the best we've got. 147 // Return the best we've got.
147 display.set_work_area(bounds); 148 display.set_work_area(bounds);
148 } 149 }
149 return display; 150 return display;
150 } 151 }
151 152
152 // static 153 // static
153 int Screen::GetNumDisplays() { 154 int Screen::GetNumDisplays() {
154 // This query is kinda bogus for Linux -- do we want number of X screens? 155 // This query is kinda bogus for Linux -- do we want number of X screens?
155 // The number of monitors Xinerama has? We'll just use whatever GDK uses. 156 // The number of monitors Xinerama has? We'll just use whatever GDK uses.
156 GdkScreen* screen = gdk_screen_get_default(); 157 GdkScreen* screen = gdk_screen_get_default();
157 return gdk_screen_get_n_monitors(screen); 158 return gdk_screen_get_n_monitors(screen);
158 } 159 }
159 160
160 } // namespace gfx 161 } // namespace gfx
OLDNEW
« ui/gfx/rect_f.h ('K') | « ui/gfx/render_text_win.cc ('k') | ui/gfx/screen_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698