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

Unified Diff: base/sys_info_posix.cc

Issue 384070: linux: implement some SysInfo bits to reduce NOTIMPL spew (Closed)
Patch Set: Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/sys_info_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/sys_info_posix.cc
diff --git a/base/sys_info_posix.cc b/base/sys_info_posix.cc
index ffbc204b740652434a6e8ebe36902e2e3c83c6eb..34d9df3b5d40a47a9027c744462a31a2dbe85881 100644
--- a/base/sys_info_posix.cc
+++ b/base/sys_info_posix.cc
@@ -10,6 +10,10 @@
#include <sys/utsname.h>
#include <unistd.h>
+#if !defined(OS_MACOSX)
+#include <gdk/gdk.h>
+#endif
+
#if defined(OS_OPENBSD)
#include <sys/param.h>
#include <sys/sysctl.h>
@@ -126,19 +130,24 @@ std::string SysInfo::CPUArchitecture() {
#if !defined(OS_MACOSX)
// static
void SysInfo::GetPrimaryDisplayDimensions(int* width, int* height) {
- // TODO(port): http://crbug.com/21732
- NOTIMPLEMENTED();
+ // Note that Bad Things Happen if this isn't called from the UI thread,
+ // but also that there's no way to check that from here. :(
+ GdkScreen* screen = gdk_screen_get_default();
if (width)
- *width = 0;
+ *width = gdk_screen_get_width(screen);
if (height)
- *height = 0;
+ *height = gdk_screen_get_height(screen);
}
// static
int SysInfo::DisplayCount() {
- // TODO(port): http://crbug.com/21732
- NOTIMPLEMENTED();
- return 1;
+ // Note that Bad Things Happen if this isn't called from the UI thread,
+ // but also that there's no way to check that from here. :(
+
+ // This query is kinda bogus for Linux -- do we want number of X screens?
+ // The number of monitors Xinerama has? We'll just use whatever GDK uses.
+ GdkScreen* screen = gdk_screen_get_default();
+ return gdk_screen_get_n_monitors(screen);
}
#endif
« no previous file with comments | « no previous file | base/sys_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698