1
0
Fork 0

monitor-manager: Derive logical monitor position from top left CRTC

Derive the logical monitor position not by looking at the main output
(the (0, 0) tile), but the one that is placed on the top-left corner.
This might be the non-main output on certain transformations.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
Jonas Ådahl 2017-03-21 16:38:45 +08:00
parent d804ecbd95
commit af4017de49

View file

@ -158,11 +158,25 @@ static void
derive_monitor_layout (MetaMonitor *monitor,
MetaRectangle *layout)
{
MetaOutput *main_output;
GList *outputs;
GList *l;
int x = INT_MAX;
int y = INT_MAX;
main_output = meta_monitor_get_main_output (monitor);
layout->x = main_output->crtc->rect.x;
layout->y = main_output->crtc->rect.y;
outputs = meta_monitor_get_outputs (monitor);
for (l = outputs; l; l = l->next)
{
MetaOutput *output = l->data;
if (!output->crtc)
continue;
x = MIN (x, output->crtc->rect.x);
y = MIN (y, output->crtc->rect.y);
}
layout->x = x;
layout->y = y;
meta_monitor_derive_dimensions (monitor, &layout->width, &layout->height);
}