summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiovanni Campagna <gcampagn@redhat.com>2013-08-16 17:39:07 +0200
committerGiovanni Campagna <gcampagna@src.gnome.org>2013-08-18 00:47:53 +0200
commit0986b660be36f2e046b230e52ef4ee79152fa118 (patch)
tree605b0ebc78d4c4aee8ab938f27e5d73cd29a0ee7
parent3bb5086173a537fa4c66b2adadcd9c9a1dbe4807 (diff)
downloadmutter-0986b660be36f2e046b230e52ef4ee79152fa118.tar.gz
MonitorXrandr: resize the framebuffer prior to setting the CRTC configuration
Otherwise X11 will trim the new configuration and disable outputs outside the screen. https://bugzilla.gnome.org/show_bug.cgi?id=705670
-rw-r--r--src/core/monitor-xrandr.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/core/monitor-xrandr.c b/src/core/monitor-xrandr.c
index c8e189ef7..73817bb9e 100644
--- a/src/core/monitor-xrandr.c
+++ b/src/core/monitor-xrandr.c
@@ -44,6 +44,11 @@
#define ALL_WL_TRANSFORMS ((1 << (WL_OUTPUT_TRANSFORM_FLIPPED_270 + 1)) - 1)
+/* Look for DPI_FALLBACK in:
+ * http://git.gnome.org/browse/gnome-settings-daemon/tree/plugins/xsettings/gsd-xsettings-manager.c
+ * for the reasoning */
+#define DPI_FALLBACK 96.0
+
struct _MetaMonitorManagerXrandr
{
MetaMonitorManager parent_instance;
@@ -651,9 +656,42 @@ meta_monitor_manager_xrandr_apply_configuration (MetaMonitorManager *manager,
{
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager);
unsigned i;
+ int width, height, width_mm, height_mm;
meta_display_grab (meta_get_display ());
+ width = 0; height = 0;
+ for (i = 0; i < n_crtcs; i++)
+ {
+ MetaCRTCInfo *crtc_info = crtcs[i];
+
+ if (crtc_info->mode == NULL)
+ continue;
+
+ if (meta_monitor_transform_is_rotated (crtc_info->transform))
+ {
+ width = MAX (width, crtc_info->x + crtc_info->mode->height);
+ height = MAX (height, crtc_info->y + crtc_info->mode->width);
+ }
+ else
+ {
+ width = MAX (width, crtc_info->x + crtc_info->mode->width);
+ height = MAX (height, crtc_info->y + crtc_info->mode->height);
+ }
+ }
+
+ g_assert (width > 0 && height > 0);
+ /* The 'physical size' of an X screen is meaningless if that screen
+ * can consist of many monitors. So just pick a size that make the
+ * dpi 96.
+ *
+ * Firefox and Evince apparently believe what X tells them.
+ */
+ width_mm = (width / DPI_FALLBACK) * 25.4 + 0.5;
+ height_mm = (height / DPI_FALLBACK) * 25.4 + 0.5;
+ XRRSetScreenSize (manager_xrandr->xdisplay, DefaultRootWindow (manager_xrandr->xdisplay),
+ width, height, width_mm, height_mm);
+
for (i = 0; i < n_crtcs; i++)
{
MetaCRTCInfo *crtc_info = crtcs[i];