summaryrefslogtreecommitdiff
path: root/unity-shared
diff options
authorEleni Maria Stea <elenimaria.stea@canonical.com>2014-02-06 12:07:27 +0200
committerEleni Maria Stea <elenimaria.stea@canonical.com>2014-02-06 12:07:27 +0200
commitfad086972bac5269c8268c3a69be3da31b317918 (patch)
tree16e70216c5cda8af967db5bf1e07f7e4285c97d0 /unity-shared
parent263e092c41ebe736c8ac19d6ac78657edbf4c0f0 (diff)
GetMonitorName now gets the monitor number as a parameter, also, it always
return a non-null std::string (bzr r3643.1.3)
Diffstat (limited to 'unity-shared')
-rw-r--r--unity-shared/UScreen.cpp12
-rw-r--r--unity-shared/UScreen.h2
2 files changed, 6 insertions, 8 deletions
diff --git a/unity-shared/UScreen.cpp b/unity-shared/UScreen.cpp
index d9cc7b626..288f050cf 100644
--- a/unity-shared/UScreen.cpp
+++ b/unity-shared/UScreen.cpp
@@ -96,16 +96,14 @@ nux::Geometry UScreen::GetScreenGeometry()
return nux::Geometry(0, 0, width, height);
}
-const std::string UScreen::GetMonitorName()
+const std::string UScreen::GetMonitorName(int output_number) const
{
- int output_num = GetMonitorWithMouse();
-
- const char *output_name;
- if (!(output_name = gdk_screen_get_monitor_plug_name(screen_, output_num)))
+ auto const &output_name = glib::gchar_to_string(gdk_screen_get_monitor_plug_name(screen_, output_number));
+ if (output_name.empty())
{
- LOG_ERROR(logger) << "Failed to get active monitor name";
- return 0;
+ LOG_ERROR(logger) << "Failed to get monitor name";
}
+
return std::string(output_name);
}
diff --git a/unity-shared/UScreen.h b/unity-shared/UScreen.h
index 22064b43b..fa31f7656 100644
--- a/unity-shared/UScreen.h
+++ b/unity-shared/UScreen.h
@@ -52,7 +52,7 @@ public:
sigc::signal<void, int, std::vector<nux::Geometry>&> changed;
sigc::signal<void> resuming;
- const std::string GetMonitorName();
+ const std::string GetMonitorName(int output_number) const;
private:
void Changed(GdkScreen* screen);