mirror of
https://github.com/brl/mutter.git
synced 2025-08-05 08:04:50 +00:00
MonitorXrandr: check the event timestamps before reconfiguring
If, checking the event timestamps, we see that a new configuration was explicitly requested by an another XRandR client, don't proceed to apply the intended configuration again, even if looking at the EDIDs it appears that the outputs changed. This works around some buggy Xorg drivers (qxl, vbox) that generate a new serial number everytime the user resizes the host window. https://bugzilla.gnome.org/show_bug.cgi?id=706735
This commit is contained in:
@@ -55,6 +55,8 @@ typedef struct {
|
||||
char *serial;
|
||||
} MetaOutputKey;
|
||||
|
||||
/* Keep this structure packed, so that we
|
||||
can use memcmp */
|
||||
typedef struct {
|
||||
gboolean enabled;
|
||||
MetaRectangle rect;
|
||||
@@ -147,6 +149,13 @@ output_key_equal (const MetaOutputKey *one,
|
||||
strcmp (one->serial, two->serial) == 0;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
output_config_equal (const MetaOutputConfig *one,
|
||||
const MetaOutputConfig *two)
|
||||
{
|
||||
return memcmp (one, two, sizeof (MetaOutputConfig)) == 0;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
config_hash (gconstpointer data)
|
||||
{
|
||||
@@ -180,6 +189,30 @@ config_equal (gconstpointer one,
|
||||
return ok;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
config_equal_full (gconstpointer one,
|
||||
gconstpointer two)
|
||||
{
|
||||
const MetaConfiguration *c_one = one;
|
||||
const MetaConfiguration *c_two = two;
|
||||
unsigned int i;
|
||||
gboolean ok;
|
||||
|
||||
if (c_one->n_outputs != c_two->n_outputs)
|
||||
return FALSE;
|
||||
|
||||
ok = TRUE;
|
||||
for (i = 0; i < c_one->n_outputs && ok; i++)
|
||||
{
|
||||
ok = output_key_equal (&c_one->keys[i],
|
||||
&c_two->keys[i]);
|
||||
ok = ok && output_config_equal (&c_one->outputs[i],
|
||||
&c_two->outputs[i]);
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_config_init (MetaMonitorConfig *self)
|
||||
{
|
||||
@@ -1243,6 +1276,12 @@ meta_monitor_config_update_current (MetaMonitorConfig *self,
|
||||
init_config_from_output (¤t->outputs[i], &outputs[i]);
|
||||
}
|
||||
|
||||
if (self->current && config_equal_full (current, self->current))
|
||||
{
|
||||
config_free (current);
|
||||
return;
|
||||
}
|
||||
|
||||
if (self->current && !self->current_is_stored)
|
||||
config_free (self->current);
|
||||
|
||||
|
Reference in New Issue
Block a user