Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions src/core/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -3718,6 +3718,50 @@ meta_display_get_primary_monitor (MetaDisplay *display)
return 0;
}

/**
* meta_display_get_monitor_name:
* @display: a #MetaDisplay
* @monitor: the monitor number
*
* Return value: (transfer none): the monitor vendor name
*/
const gchar*
meta_display_get_monitor_name (MetaDisplay *display,
int monitor)
{
MetaBackend *backend = meta_get_backend ();
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
#ifndef G_DISABLE_CHECKS
int n_logical_monitors =
meta_monitor_manager_get_num_logical_monitors (monitor_manager);
#endif

g_return_val_if_fail (META_IS_DISPLAY (display), NULL);
g_return_val_if_fail (monitor >= 0 && monitor < n_logical_monitors, NULL);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like if we were to set G_DISABLE_CHECKS the build would break (n_logical_monitors)... it's the same in surrounding methods.


GList *l;

for (l = monitor_manager->logical_monitors; l; l = l->next) {
MetaLogicalMonitor *other = l->data;

if (other->number != monitor) {
continue;
}

GList *m;
for (m = other->monitors; m; m = m->next)
{
MetaMonitor *monitor = m->data;
const char* name = meta_monitor_get_display_name (monitor);
if (name != NULL) {
return name;
}
}
}
return NULL;
}

/**
* meta_display_get_monitor_geometry:
* @display: a #MetaDisplay
Expand Down
4 changes: 4 additions & 0 deletions src/meta/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ int meta_display_get_primary_monitor (MetaDisplay *display);
META_EXPORT
int meta_display_get_current_monitor (MetaDisplay *display);

META_EXPORT
const gchar* meta_display_get_monitor_name (MetaDisplay *display,
int monitor);

META_EXPORT
void meta_display_get_monitor_geometry (MetaDisplay *display,
int monitor,
Expand Down
Loading