OLD | NEW |
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 Loading... |
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 |
OLD | NEW |