[mutter/wayland] MonitorConfig: remove holes generated by disabling the laptop lid
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wayland] MonitorConfig: remove holes generated by disabling the laptop lid
- Date: Mon, 16 Sep 2013 20:43:21 +0000 (UTC)
commit d25275fa8d2cdba9c34fa799c2968524126723bb
Author: Giovanni Campagna <gcampagn redhat com>
Date: Wed Sep 4 16:31:57 2013 +0200
MonitorConfig: remove holes generated by disabling the laptop lid
No, holes in the framebuffer are not a good a thing: windows can
get lost there, and the user can get very confused.
Instead, compact the monitors that where previously after.
https://bugzilla.gnome.org/show_bug.cgi?id=707473
src/core/monitor-config.c | 25 +++++++++++++++++++------
1 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/src/core/monitor-config.c b/src/core/monitor-config.c
index 31fd0c1..f07b93e 100644
--- a/src/core/monitor-config.c
+++ b/src/core/monitor-config.c
@@ -914,6 +914,8 @@ make_laptop_lid_config (MetaConfiguration *reference)
MetaConfiguration *new;
unsigned int i;
gboolean has_primary;
+ int x_after, y_after;
+ int x_offset, y_offset;
g_assert (reference->n_outputs > 1);
@@ -922,6 +924,8 @@ make_laptop_lid_config (MetaConfiguration *reference)
new->keys = g_new0 (MetaOutputKey, reference->n_outputs);
new->outputs = g_new0 (MetaOutputConfig, reference->n_outputs);
+ x_after = G_MAXINT; y_after = G_MAXINT;
+ x_offset = 0; y_offset = 0;
for (i = 0; i < new->n_outputs; i++)
{
MetaOutputKey *current_key = &reference->keys[i];
@@ -934,13 +938,22 @@ make_laptop_lid_config (MetaConfiguration *reference)
if (g_str_has_prefix (current_key->connector, "LVDS") ||
g_str_has_prefix (current_key->connector, "eDP"))
- new->outputs[i].enabled = FALSE;
+ {
+ new->outputs[i].enabled = FALSE;
+ x_after = current_output->rect.x;
+ y_after = current_output->rect.y;
+ x_offset = current_output->rect.width;
+ y_offset = current_output->rect.height;
+ }
else
- /* This can potentially leave a "hole" in the screen,
- but this is actually a good thing, as it means windows
- don't move around.
- */
- new->outputs[i] = *current_output;
+ {
+ new->outputs[i] = *current_output;
+
+ if (new->outputs[i].rect.x > x_after)
+ new->outputs[i].rect.x -= x_offset;
+ if (new->outputs[i].rect.y > y_after)
+ new->outputs[i].rect.y -= y_offset;
+ }
}
has_primary = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]