diff options
| -rw-r--r-- | unity-shared/UScreen.cpp | 12 | ||||
| -rw-r--r-- | unity-shared/UScreen.h | 2 |
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); |
