get xorg/x11 working on Darwin
This commit is contained in:
parent
48c5574f5a
commit
5ea8497933
|
@ -30,6 +30,6 @@ stdenv.mkDerivation rec {
|
||||||
description = "Allows testing the fonts available in an X server";
|
description = "Allows testing the fonts available in an X server";
|
||||||
license = "free";
|
license = "free";
|
||||||
maintainers = with stdenv.lib.maintainers; [viric];
|
maintainers = with stdenv.lib.maintainers; [viric];
|
||||||
platforms = with stdenv.lib.platforms; linux;
|
platforms = with stdenv.lib.platforms; linux ++ darwin;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,6 @@ stdenv.mkDerivation rec {
|
||||||
description = "Lists the fonts available in the X server";
|
description = "Lists the fonts available in the X server";
|
||||||
license = "free";
|
license = "free";
|
||||||
maintainers = with stdenv.lib.maintainers; [viric];
|
maintainers = with stdenv.lib.maintainers; [viric];
|
||||||
platforms = with stdenv.lib.platforms; linux;
|
platforms = with stdenv.lib.platforms; linux ++ darwin;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,6 @@ stdenv.mkDerivation rec {
|
||||||
homepage = http://invisible-island.net/xterm;
|
homepage = http://invisible-island.net/xterm;
|
||||||
license = "BSD";
|
license = "BSD";
|
||||||
maintainers = with stdenv.lib.maintainers; [viric];
|
maintainers = with stdenv.lib.maintainers; [viric];
|
||||||
platforms = with stdenv.lib.platforms; linux;
|
platforms = with stdenv.lib.platforms; linux ++ darwin;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,27 @@
|
||||||
{ stdenv, fetchurl, libXi, libXrandr, libXxf86vm, mesa, x11 }:
|
{ stdenv, lib, fetchurl, libXi, libXrandr, libXxf86vm, mesa, x11, autoreconfHook }:
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
let version = "2.8.1";
|
||||||
name = "freeglut-2.8.1";
|
in stdenv.mkDerivation {
|
||||||
|
name = "freeglut-${version}";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = mirror://sourceforge/freeglut/freeglut-2.8.1.tar.gz;
|
url = "mirror://sourceforge/freeglut/freeglut-${version}.tar.gz";
|
||||||
sha256 = "16lrxxxd9ps9l69y3zsw6iy0drwjsp6m26d1937xj71alqk6dr6x";
|
sha256 = "16lrxxxd9ps9l69y3zsw6iy0drwjsp6m26d1937xj71alqk6dr6x";
|
||||||
};
|
};
|
||||||
|
|
||||||
configureFlags = "--" + (if stdenv.isDarwin then "disable" else "enable") + "-warnings";
|
buildInputs = [
|
||||||
|
libXi libXrandr libXxf86vm mesa x11
|
||||||
|
] ++ lib.optionals stdenv.isDarwin [
|
||||||
|
autoreconfHook
|
||||||
|
];
|
||||||
|
|
||||||
|
postPatch = lib.optionalString stdenv.isDarwin ''
|
||||||
|
substituteInPlace Makefile.am --replace \
|
||||||
|
"SUBDIRS = src include progs doc" \
|
||||||
|
"SUBDIRS = src include doc"
|
||||||
|
'';
|
||||||
|
|
||||||
|
configureFlags = [ "--enable-warnings" ];
|
||||||
|
|
||||||
buildInputs = [ libXi libXrandr libXxf86vm mesa x11 ];
|
|
||||||
# patches = [ ./0001-remove-typedefs-now-living-in-mesa.patch ];
|
# patches = [ ./0001-remove-typedefs-now-living-in-mesa.patch ];
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
{ stdenv, stdenvAdapters, gccApple, fetchurl, pkgconfig, intltool, flex, bison
|
||||||
|
, python, libxml2Python, file, expat, makedepend, xorg, llvm, libffi, libvdpau
|
||||||
|
, enableTextureFloats ? false # Texture floats are patented, see docs/patents.txt
|
||||||
|
, enableExtraFeatures ? false # not maintained
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
version = "8.0.5";
|
||||||
|
self = stdenv.mkDerivation rec {
|
||||||
|
name = "mesa-${version}";
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "ftp://ftp.freedesktop.org/pub/mesa/older-versions/8.x/${version}/MesaLib-${version}.tar.bz2";
|
||||||
|
sha256 = "0pjs8x51c0i6mawgd4w03lxpyx5fnx7rc8plr8jfsscf9yiqs6si";
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [ pkgconfig python makedepend flex bison ];
|
||||||
|
|
||||||
|
buildInputs = with xorg; [
|
||||||
|
glproto dri2proto libXfixes libXi libXmu
|
||||||
|
intltool expat libxml2Python llvm
|
||||||
|
presentproto
|
||||||
|
libX11 libXext libxcb libXt libxshmfence
|
||||||
|
libffi libvdpau
|
||||||
|
];
|
||||||
|
|
||||||
|
postUnpack = ''
|
||||||
|
ln -s darwin $sourceRoot/configs/current
|
||||||
|
'';
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
./patches/0003-mesa-fix-per-level-max-texture-size-error-checking.patch
|
||||||
|
./patches/0008-glsl-initialise-const-force-glsl-extension-warning-i.patch
|
||||||
|
./patches/0009-mesa-test-for-GL_EXT_framebuffer_sRGB-in-glPopAttrib.patch
|
||||||
|
./patches/0011-Apple-glFlush-is-not-needed-with-CGLFlushDrawable.patch
|
||||||
|
./patches/0012-glapi-Avoid-heap-corruption-in-_glapi_table.patch
|
||||||
|
./patches/0013-darwin-Fix-test-for-kCGLPFAOpenGLProfile-support-at-.patch
|
||||||
|
./patches/1001-appleglx-Improve-error-reporting-if-CGLChoosePixelFo.patch
|
||||||
|
./patches/1002-darwin-Write-errors-in-choosing-the-pixel-format-to-.patch
|
||||||
|
./patches/1003-darwin-Guard-Core-Profile-usage-behind-a-testing-env.patch
|
||||||
|
./patches/patch-src-mapi-vgapi-Makefile.diff
|
||||||
|
];
|
||||||
|
|
||||||
|
postPatch = "patchShebangs .";
|
||||||
|
|
||||||
|
configurePhase = ":";
|
||||||
|
|
||||||
|
makeFlags = "INSTALL_DIR=\${out} CC=cc CXX=c++";
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
passthru = { inherit version; };
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "An open source implementation of OpenGL";
|
||||||
|
homepage = http://www.mesa3d.org/;
|
||||||
|
license = "bsd";
|
||||||
|
platforms = stdenv.lib.platforms.darwin;
|
||||||
|
maintainers = with stdenv.lib.maintainers; [ cstrahan ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in self // { driverLink = self; }
|
|
@ -0,0 +1,147 @@
|
||||||
|
From 9cf1afbf8ae87ddbb29b24a0f9f2724e9e2935c1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Brian Paul <brianp@vmware.com>
|
||||||
|
Date: Tue, 4 Sep 2012 20:17:15 -0600
|
||||||
|
Subject: [PATCH 03/13] mesa: fix per-level max texture size error checking
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
This is a long-standing omission in Mesa's texture image size checking.
|
||||||
|
We need to take the mipmap level into consideration when checking if the
|
||||||
|
width, height and depth are too large.
|
||||||
|
|
||||||
|
Fixes the new piglit max-texture-size-level test.
|
||||||
|
Thanks to Stéphane Marchesin for finding this problem.
|
||||||
|
|
||||||
|
Note: This is a candidate for the stable branches.
|
||||||
|
|
||||||
|
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
|
||||||
|
(cherry picked from commit 771e7b6d884bb4294a89f276a904d90b28efb90a)
|
||||||
|
---
|
||||||
|
src/mesa/main/teximage.c | 36 +++++++++++++++++++++---------------
|
||||||
|
1 file changed, 21 insertions(+), 15 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
|
||||||
|
index 3aecc0f..ed22fa9 100644
|
||||||
|
--- a/src/mesa/main/teximage.c
|
||||||
|
+++ b/src/mesa/main/teximage.c
|
||||||
|
@@ -1251,11 +1251,12 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
|
||||||
|
|
||||||
|
switch (target) {
|
||||||
|
case GL_PROXY_TEXTURE_1D:
|
||||||
|
- maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
|
||||||
|
- if (width < 2 * border || width > 2 * border + maxSize)
|
||||||
|
- return GL_FALSE;
|
||||||
|
if (level >= ctx->Const.MaxTextureLevels)
|
||||||
|
return GL_FALSE;
|
||||||
|
+ maxSize = 1 << (ctx->Const.MaxTextureLevels - 1); /* level zero size */
|
||||||
|
+ maxSize >>= level; /* level size */
|
||||||
|
+ if (width < 2 * border || width > 2 * border + maxSize)
|
||||||
|
+ return GL_FALSE;
|
||||||
|
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
|
||||||
|
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
|
||||||
|
return GL_FALSE;
|
||||||
|
@@ -1263,13 +1264,14 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
|
||||||
|
return GL_TRUE;
|
||||||
|
|
||||||
|
case GL_PROXY_TEXTURE_2D:
|
||||||
|
+ if (level >= ctx->Const.MaxTextureLevels)
|
||||||
|
+ return GL_FALSE;
|
||||||
|
maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
|
||||||
|
+ maxSize >>= level;
|
||||||
|
if (width < 2 * border || width > 2 * border + maxSize)
|
||||||
|
return GL_FALSE;
|
||||||
|
if (height < 2 * border || height > 2 * border + maxSize)
|
||||||
|
return GL_FALSE;
|
||||||
|
- if (level >= ctx->Const.MaxTextureLevels)
|
||||||
|
- return GL_FALSE;
|
||||||
|
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
|
||||||
|
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
|
||||||
|
return GL_FALSE;
|
||||||
|
@@ -1279,15 +1281,16 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
|
||||||
|
return GL_TRUE;
|
||||||
|
|
||||||
|
case GL_PROXY_TEXTURE_3D:
|
||||||
|
+ if (level >= ctx->Const.Max3DTextureLevels)
|
||||||
|
+ return GL_FALSE;
|
||||||
|
maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
|
||||||
|
+ maxSize >>= level;
|
||||||
|
if (width < 2 * border || width > 2 * border + maxSize)
|
||||||
|
return GL_FALSE;
|
||||||
|
if (height < 2 * border || height > 2 * border + maxSize)
|
||||||
|
return GL_FALSE;
|
||||||
|
if (depth < 2 * border || depth > 2 * border + maxSize)
|
||||||
|
return GL_FALSE;
|
||||||
|
- if (level >= ctx->Const.Max3DTextureLevels)
|
||||||
|
- return GL_FALSE;
|
||||||
|
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
|
||||||
|
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
|
||||||
|
return GL_FALSE;
|
||||||
|
@@ -1299,23 +1302,24 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
|
||||||
|
return GL_TRUE;
|
||||||
|
|
||||||
|
case GL_PROXY_TEXTURE_RECTANGLE_NV:
|
||||||
|
+ if (level != 0)
|
||||||
|
+ return GL_FALSE;
|
||||||
|
maxSize = ctx->Const.MaxTextureRectSize;
|
||||||
|
if (width < 0 || width > maxSize)
|
||||||
|
return GL_FALSE;
|
||||||
|
if (height < 0 || height > maxSize)
|
||||||
|
return GL_FALSE;
|
||||||
|
- if (level != 0)
|
||||||
|
- return GL_FALSE;
|
||||||
|
return GL_TRUE;
|
||||||
|
|
||||||
|
case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
|
||||||
|
+ if (level >= ctx->Const.MaxCubeTextureLevels)
|
||||||
|
+ return GL_FALSE;
|
||||||
|
maxSize = 1 << (ctx->Const.MaxCubeTextureLevels - 1);
|
||||||
|
+ maxSize >>= level;
|
||||||
|
if (width < 2 * border || width > 2 * border + maxSize)
|
||||||
|
return GL_FALSE;
|
||||||
|
if (height < 2 * border || height > 2 * border + maxSize)
|
||||||
|
return GL_FALSE;
|
||||||
|
- if (level >= ctx->Const.MaxCubeTextureLevels)
|
||||||
|
- return GL_FALSE;
|
||||||
|
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
|
||||||
|
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
|
||||||
|
return GL_FALSE;
|
||||||
|
@@ -1325,13 +1329,14 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
|
||||||
|
return GL_TRUE;
|
||||||
|
|
||||||
|
case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
|
||||||
|
+ if (level >= ctx->Const.MaxTextureLevels)
|
||||||
|
+ return GL_FALSE;
|
||||||
|
maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
|
||||||
|
+ maxSize >>= level;
|
||||||
|
if (width < 2 * border || width > 2 * border + maxSize)
|
||||||
|
return GL_FALSE;
|
||||||
|
if (height < 1 || height > ctx->Const.MaxArrayTextureLayers)
|
||||||
|
return GL_FALSE;
|
||||||
|
- if (level >= ctx->Const.MaxTextureLevels)
|
||||||
|
- return GL_FALSE;
|
||||||
|
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
|
||||||
|
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
|
||||||
|
return GL_FALSE;
|
||||||
|
@@ -1339,15 +1344,16 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
|
||||||
|
return GL_TRUE;
|
||||||
|
|
||||||
|
case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
|
||||||
|
+ if (level >= ctx->Const.MaxTextureLevels)
|
||||||
|
+ return GL_FALSE;
|
||||||
|
maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
|
||||||
|
+ maxSize >>= level;
|
||||||
|
if (width < 2 * border || width > 2 * border + maxSize)
|
||||||
|
return GL_FALSE;
|
||||||
|
if (height < 2 * border || height > 2 * border + maxSize)
|
||||||
|
return GL_FALSE;
|
||||||
|
if (depth < 1 || depth > ctx->Const.MaxArrayTextureLayers)
|
||||||
|
return GL_FALSE;
|
||||||
|
- if (level >= ctx->Const.MaxTextureLevels)
|
||||||
|
- return GL_FALSE;
|
||||||
|
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
|
||||||
|
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
|
||||||
|
return GL_FALSE;
|
||||||
|
--
|
||||||
|
1.9.2
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
From db8cb2250335a93cad6e877e634116e5cd6b42fc Mon Sep 17 00:00:00 2001
|
||||||
|
From: Dave Airlie <airlied@redhat.com>
|
||||||
|
Date: Tue, 13 Mar 2012 14:53:25 +0000
|
||||||
|
Subject: [PATCH 08/13] glsl: initialise const force glsl extension warning in
|
||||||
|
fake ctx
|
||||||
|
|
||||||
|
valgrind complained about an uninitialised value being used in
|
||||||
|
glsl_parser_extras.cpp, and this was the one it was giving out about.
|
||||||
|
|
||||||
|
Just initialise the value in the fakectx.
|
||||||
|
|
||||||
|
Signed-off-by: Dave Airlie <airlied@redhat.com>
|
||||||
|
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48057
|
||||||
|
(cherry picked from commit b78a77f979b21a84aecb6fa4f19a2ed51a48c306)
|
||||||
|
---
|
||||||
|
src/glsl/builtins/tools/generate_builtins.py | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py
|
||||||
|
index 72d12bb..bd15c4d 100755
|
||||||
|
--- a/src/glsl/builtins/tools/generate_builtins.py
|
||||||
|
+++ b/src/glsl/builtins/tools/generate_builtins.py
|
||||||
|
@@ -156,6 +156,7 @@ read_builtins(GLenum target, const char *protos, const char **functions, unsigne
|
||||||
|
fakeCtx.API = API_OPENGL;
|
||||||
|
fakeCtx.Const.GLSLVersion = 130;
|
||||||
|
fakeCtx.Extensions.ARB_ES2_compatibility = true;
|
||||||
|
+ fakeCtx.Const.ForceGLSLExtensionsWarn = false;
|
||||||
|
gl_shader *sh = _mesa_new_shader(NULL, 0, target);
|
||||||
|
struct _mesa_glsl_parse_state *st =
|
||||||
|
new(sh) _mesa_glsl_parse_state(&fakeCtx, target, sh);
|
||||||
|
--
|
||||||
|
1.9.2
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
From 2286bd68a832a4d4908d50e1a4496853e1f3305a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Brian Paul <brianp@vmware.com>
|
||||||
|
Date: Mon, 27 Aug 2012 21:52:07 -0600
|
||||||
|
Subject: [PATCH 09/13] mesa: test for GL_EXT_framebuffer_sRGB in glPopAttrib()
|
||||||
|
|
||||||
|
To avoid spurious GL_INVALID_ENUM errors if the extension isn't supported.
|
||||||
|
(cherry picked from commit 1aee8803f83f7ae24d9c2150c70afff2b1ee4c2f)
|
||||||
|
---
|
||||||
|
src/mesa/main/attrib.c | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
|
||||||
|
index 225ac89..cc384c7 100644
|
||||||
|
--- a/src/mesa/main/attrib.c
|
||||||
|
+++ b/src/mesa/main/attrib.c
|
||||||
|
@@ -993,7 +993,8 @@ _mesa_PopAttrib(void)
|
||||||
|
_mesa_ClampColorARB(GL_CLAMP_READ_COLOR_ARB, color->ClampReadColor);
|
||||||
|
|
||||||
|
/* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */
|
||||||
|
- _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB, color->sRGBEnabled);
|
||||||
|
+ if (ctx->Extensions.EXT_framebuffer_sRGB)
|
||||||
|
+ _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB, color->sRGBEnabled);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GL_CURRENT_BIT:
|
||||||
|
--
|
||||||
|
1.9.2
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
From 9c50093adff0c7531ab32a7ec9ce3b91712b4d20 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||||
|
Date: Sat, 20 Jul 2013 10:25:28 -0700
|
||||||
|
Subject: [PATCH 11/13] Apple: glFlush() is not needed with CGLFlushDrawable()
|
||||||
|
|
||||||
|
<rdar://problem/14496373>
|
||||||
|
|
||||||
|
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||||
|
(cherry picked from commit fa5ed99d8e809fb86e486a40273a4a6971055398)
|
||||||
|
---
|
||||||
|
src/glx/apple/apple_glx.c | 2 --
|
||||||
|
1 file changed, 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/glx/apple/apple_glx.c b/src/glx/apple/apple_glx.c
|
||||||
|
index 56cff64..4e2aa33 100644
|
||||||
|
--- a/src/glx/apple/apple_glx.c
|
||||||
|
+++ b/src/glx/apple/apple_glx.c
|
||||||
|
@@ -132,8 +132,6 @@ apple_glx_swap_buffers(void *ptr)
|
||||||
|
{
|
||||||
|
struct apple_glx_context *ac = ptr;
|
||||||
|
|
||||||
|
- /* This may not be needed with CGLFlushDrawable: */
|
||||||
|
- glFlush();
|
||||||
|
apple_cgl.flush_drawable(ac->context_obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
1.9.2
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
From 629600450b3845a768c0edc92ea3f444d03a2738 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||||
|
Date: Tue, 20 May 2014 01:37:58 -0700
|
||||||
|
Subject: [PATCH 12/13] glapi: Avoid heap corruption in _glapi_table
|
||||||
|
|
||||||
|
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||||
|
Reviewed-by: Chia-I Wu <olv@lunarg.com>
|
||||||
|
(cherry picked from commit ff5456d1acf6f627a6837be3f3f37c6a268c9e8e)
|
||||||
|
---
|
||||||
|
src/mapi/glapi/gen/gl_gentable.py | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/mapi/glapi/gen/gl_gentable.py b/src/mapi/glapi/gen/gl_gentable.py
|
||||||
|
index 5657e32..0d0a02d 100644
|
||||||
|
--- a/src/mapi/glapi/gen/gl_gentable.py
|
||||||
|
+++ b/src/mapi/glapi/gen/gl_gentable.py
|
||||||
|
@@ -111,7 +111,7 @@ __glapi_gentable_set_remaining_noop(struct _glapi_table *disp) {
|
||||||
|
|
||||||
|
struct _glapi_table *
|
||||||
|
_glapi_create_table_from_handle(void *handle, const char *symbol_prefix) {
|
||||||
|
- struct _glapi_table *disp = calloc(1, sizeof(struct _glapi_table));
|
||||||
|
+ struct _glapi_table *disp = calloc(1, _glapi_get_dispatch_table_size() * sizeof(_glapi_proc));
|
||||||
|
char symboln[512];
|
||||||
|
|
||||||
|
if(!disp)
|
||||||
|
--
|
||||||
|
1.9.2
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
From ba59a779ed41e08fa16805c1c60da39885546d0e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||||
|
Date: Tue, 20 May 2014 10:53:00 -0700
|
||||||
|
Subject: [PATCH 13/13] darwin: Fix test for kCGLPFAOpenGLProfile support at
|
||||||
|
runtime
|
||||||
|
|
||||||
|
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||||
|
(cherry picked from commit 7a109268ab5b3544e7f7b99e84ef1fdf54023fb4)
|
||||||
|
---
|
||||||
|
src/glx/apple/apple_visual.c | 14 +++++++++-----
|
||||||
|
1 file changed, 9 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c
|
||||||
|
index 282934f..238c248 100644
|
||||||
|
--- a/src/glx/apple/apple_visual.c
|
||||||
|
+++ b/src/glx/apple/apple_visual.c
|
||||||
|
@@ -73,11 +73,15 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
|
||||||
|
GLint vsref = 0;
|
||||||
|
CGLError error = 0;
|
||||||
|
|
||||||
|
- /* Request an OpenGL 3.2 profile if one is available */
|
||||||
|
- if(apple_cgl.version_major > 1 || (apple_cgl.version_major == 1 && apple_cgl.version_minor >= 3)) {
|
||||||
|
- attr[numattr++] = kCGLPFAOpenGLProfile;
|
||||||
|
- attr[numattr++] = kCGLOGLPVersion_3_2_Core;
|
||||||
|
- }
|
||||||
|
+ /* Request an OpenGL 3.2 profile if one is available and supported */
|
||||||
|
+ attr[numattr++] = kCGLPFAOpenGLProfile;
|
||||||
|
+ attr[numattr++] = kCGLOGLPVersion_3_2_Core;
|
||||||
|
+
|
||||||
|
+ /* Test for kCGLPFAOpenGLProfile support at runtime and roll it out if not supported */
|
||||||
|
+ attr[numattr] = 0;
|
||||||
|
+ error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
|
||||||
|
+ if (error == kCGLBadAttribute)
|
||||||
|
+ numattr -= 2;
|
||||||
|
|
||||||
|
if (offscreen) {
|
||||||
|
apple_glx_diagnostic
|
||||||
|
--
|
||||||
|
1.9.2
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
From f0702d6e631bb912a230c081463bb51a0dde1bff Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jon TURNEY <jon.turney@dronecode.org.uk>
|
||||||
|
Date: Mon, 12 May 2014 15:38:26 +0100
|
||||||
|
Subject: [PATCH 1001/1003] appleglx: Improve error reporting if
|
||||||
|
CGLChoosePixelFormat() didn't find any matching pixel formats.
|
||||||
|
|
||||||
|
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
|
||||||
|
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||||
|
(cherry picked from commit 002a3a74273b81dfb226e1c3f0a8c18525ed0af4)
|
||||||
|
---
|
||||||
|
src/glx/apple/apple_visual.c | 5 +++++
|
||||||
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c
|
||||||
|
index 238c248..c6ede51 100644
|
||||||
|
--- a/src/glx/apple/apple_visual.c
|
||||||
|
+++ b/src/glx/apple/apple_visual.c
|
||||||
|
@@ -167,4 +167,9 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
|
||||||
|
fprintf(stderr, "error: %s\n", apple_cgl.error_string(error));
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ if (!*pfobj) {
|
||||||
|
+ fprintf(stderr, "No matching pixelformats found, perhaps try using LIBGL_ALLOW_SOFTWARE\n");
|
||||||
|
+ abort();
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
--
|
||||||
|
1.9.2 (Apple Git-49)
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
From 1b2f877c8ef052b183c1f20ece6c6e4a7bfd237c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||||
|
Date: Sat, 24 May 2014 14:13:33 -0700
|
||||||
|
Subject: [PATCH 1002/1003] darwin: Write errors in choosing the pixel format
|
||||||
|
to the crash log
|
||||||
|
|
||||||
|
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||||
|
(cherry picked from commit 9eb1d36c978a9b15ae2e999c630492dfffd7f165)
|
||||||
|
---
|
||||||
|
src/glx/apple/apple_visual.c | 18 ++++++++++++++++--
|
||||||
|
1 file changed, 16 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c
|
||||||
|
index c6ede51..951b213 100644
|
||||||
|
--- a/src/glx/apple/apple_visual.c
|
||||||
|
+++ b/src/glx/apple/apple_visual.c
|
||||||
|
@@ -63,6 +63,16 @@ enum
|
||||||
|
MAX_ATTR = 60
|
||||||
|
};
|
||||||
|
|
||||||
|
+static char __crashreporter_info_buff__[4096] = { 0 };
|
||||||
|
+static const char *__crashreporter_info__ __attribute__((__used__)) =
|
||||||
|
+ &__crashreporter_info_buff__[0];
|
||||||
|
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
|
||||||
|
+// This is actually a toolchain requirement, but I'm not sure the correct check,
|
||||||
|
+// but it should be fine to just only include it for Leopard and later. This line
|
||||||
|
+// just tells the linker to never strip this symbol (such as for space optimization)
|
||||||
|
+__asm__ (".desc ___crashreporter_info__, 0x10");
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
void
|
||||||
|
apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * mode,
|
||||||
|
bool * double_buffered, bool * uses_stereo,
|
||||||
|
@@ -164,12 +174,16 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
|
||||||
|
error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
- fprintf(stderr, "error: %s\n", apple_cgl.error_string(error));
|
||||||
|
+ snprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__),
|
||||||
|
+ "CGLChoosePixelFormat error: %s\n", apple_cgl.error_string(error));
|
||||||
|
+ fprintf(stderr, "%s", __crashreporter_info_buff__);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!*pfobj) {
|
||||||
|
- fprintf(stderr, "No matching pixelformats found, perhaps try using LIBGL_ALLOW_SOFTWARE\n");
|
||||||
|
+ snprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__),
|
||||||
|
+ "No matching pixelformats found, perhaps try using LIBGL_ALLOW_SOFTWARE\n");
|
||||||
|
+ fprintf(stderr, "%s", __crashreporter_info_buff__);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
--
|
||||||
|
1.9.2 (Apple Git-49)
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
From 9d6e12eb6b06202519e48a7321f32944d7a34b0f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||||
|
Date: Sat, 24 May 2014 14:08:16 -0700
|
||||||
|
Subject: [PATCH 1003/1003] darwin: Guard Core Profile usage behind a testing
|
||||||
|
envvar
|
||||||
|
|
||||||
|
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||||
|
(cherry picked from commit 04ce3be4010305902cc5ae81e8e0c8550d043a1e)
|
||||||
|
---
|
||||||
|
src/glx/apple/apple_visual.c | 30 ++++++++++++++++++++----------
|
||||||
|
1 file changed, 20 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c
|
||||||
|
index 951b213..046581b 100644
|
||||||
|
--- a/src/glx/apple/apple_visual.c
|
||||||
|
+++ b/src/glx/apple/apple_visual.c
|
||||||
|
@@ -82,16 +82,7 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
|
||||||
|
int numattr = 0;
|
||||||
|
GLint vsref = 0;
|
||||||
|
CGLError error = 0;
|
||||||
|
-
|
||||||
|
- /* Request an OpenGL 3.2 profile if one is available and supported */
|
||||||
|
- attr[numattr++] = kCGLPFAOpenGLProfile;
|
||||||
|
- attr[numattr++] = kCGLOGLPVersion_3_2_Core;
|
||||||
|
-
|
||||||
|
- /* Test for kCGLPFAOpenGLProfile support at runtime and roll it out if not supported */
|
||||||
|
- attr[numattr] = 0;
|
||||||
|
- error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
|
||||||
|
- if (error == kCGLBadAttribute)
|
||||||
|
- numattr -= 2;
|
||||||
|
+ bool use_core_profile = getenv("LIBGL_PROFILE_CORE");
|
||||||
|
|
||||||
|
if (offscreen) {
|
||||||
|
apple_glx_diagnostic
|
||||||
|
@@ -167,12 +158,31 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
|
||||||
|
attr[numattr++] = mode->samples;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /* Debugging support for Core profiles to support newer versions of OpenGL */
|
||||||
|
+ if (use_core_profile) {
|
||||||
|
+ attr[numattr++] = kCGLPFAOpenGLProfile;
|
||||||
|
+ attr[numattr++] = kCGLOGLPVersion_3_2_Core;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
attr[numattr++] = 0;
|
||||||
|
|
||||||
|
assert(numattr < MAX_ATTR);
|
||||||
|
|
||||||
|
error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
|
||||||
|
|
||||||
|
+ if ((error == kCGLBadAttribute || vsref == 0) && use_core_profile) {
|
||||||
|
+ apple_glx_diagnostic
|
||||||
|
+ ("Trying again without CoreProfile: error=%s, vsref=%d\n", apple_cgl.error_string(error), vsref);
|
||||||
|
+
|
||||||
|
+ if (!error)
|
||||||
|
+ apple_cgl.destroy_pixel_format(*pfobj);
|
||||||
|
+
|
||||||
|
+ numattr -= 3;
|
||||||
|
+ attr[numattr++] = 0;
|
||||||
|
+
|
||||||
|
+ error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (error) {
|
||||||
|
snprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__),
|
||||||
|
"CGLChoosePixelFormat error: %s\n", apple_cgl.error_string(error));
|
||||||
|
--
|
||||||
|
1.9.2 (Apple Git-49)
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
--- a/src/mapi/vgapi/Makefile 2012-11-30 12:06:24.000000000 -0500
|
||||||
|
+++ b/src/mapi/vgapi/Makefile 2012-11-30 12:06:52.000000000 -0500
|
||||||
|
@@ -75,6 +75,8 @@
|
||||||
|
install-headers:
|
||||||
|
$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/VG
|
||||||
|
$(INSTALL) -m 644 $(TOP)/include/VG/*.h $(DESTDIR)$(INSTALL_INC_DIR)/VG
|
||||||
|
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/KHR
|
||||||
|
+ $(INSTALL) -m 644 $(TOP)/include/KHR/*.h $(DESTDIR)$(INSTALL_INC_DIR)/KHR
|
||||||
|
|
||||||
|
install: default install-headers install-pc
|
||||||
|
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
|
|
@ -0,0 +1,27 @@
|
||||||
|
{ stdenv, lib, fetchurl, xorg, pixman, pkgconfig }:
|
||||||
|
|
||||||
|
let version = "1.3.1";
|
||||||
|
in stdenv.mkDerivation {
|
||||||
|
name = "quartz-wm-${version}";
|
||||||
|
src = fetchurl {
|
||||||
|
url = "http://xquartz-dl.macosforge.org/src/quartz-wm-${version}.tar.xz";
|
||||||
|
sha256 = "1j8zd3p7rhay1s3sxq6anw78k5s59mx44xpqla2ianl62346a5g9";
|
||||||
|
};
|
||||||
|
patches = [
|
||||||
|
./no_title_crash.patch
|
||||||
|
./extern-patch.patch
|
||||||
|
];
|
||||||
|
buildInputs = [
|
||||||
|
xorg.libXinerama
|
||||||
|
xorg.libAppleWM
|
||||||
|
xorg.applewmproto
|
||||||
|
xorg.libXrandr
|
||||||
|
xorg.libXext
|
||||||
|
pixman
|
||||||
|
pkgconfig
|
||||||
|
];
|
||||||
|
meta = with lib; {
|
||||||
|
license = licenses.apsl20;
|
||||||
|
platforms = platforms.darwin;
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
diff --git a/src/x-list.h b/src/x-list.h
|
||||||
|
index bb85c02..059c88b 100644
|
||||||
|
--- a/src/x-list.h
|
||||||
|
+++ b/src/x-list.h
|
||||||
|
@@ -39,7 +39,7 @@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef X_EXTERN
|
||||||
|
-# define X_EXTERN __private_extern__
|
||||||
|
+# define X_EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
X_EXTERN void X_PFX (list_free_1) (x_list *node);
|
|
@ -0,0 +1,25 @@
|
||||||
|
commit c28527b1340c51f2b492a31e49127106cebbfc5d
|
||||||
|
Author: Jeremy Huddleston <jeremyhu@apple.com>
|
||||||
|
Date: Fri Jun 1 10:38:37 2012 -0700
|
||||||
|
|
||||||
|
Fix a crash when minimizing windows without titles
|
||||||
|
|
||||||
|
<rdar://problem/11575791>
|
||||||
|
|
||||||
|
Regression-from: 21f210c923aa5d79400ce46275084f2636c92bd9
|
||||||
|
|
||||||
|
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
|
||||||
|
|
||||||
|
diff --git a/src/x-window.m b/src/x-window.m
|
||||||
|
index a210c6a..e3b9066 100644
|
||||||
|
--- a/src/x-window.m
|
||||||
|
+++ b/src/x-window.m
|
||||||
|
@@ -2139,7 +2139,7 @@ - (void) do_collapse
|
||||||
|
if (wid == XP_NULL_NATIVE_WINDOW_ID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
- title_c = strdup([_title UTF8String]);
|
||||||
|
+ title_c = strdup([[self title] UTF8String]);
|
||||||
|
assert(title_c);
|
||||||
|
|
||||||
|
err = qwm_dock_minimize_item_with_title_async (wid, title_c);
|
|
@ -0,0 +1,33 @@
|
||||||
|
From ec6007e6f7772a90713c9c51c64359229961ce27 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||||
|
Date: Sun, 6 Apr 2014 05:32:00 -0700
|
||||||
|
Subject: [PATCH] XQuartz: Ensure we wait for the server thread to terminate
|
||||||
|
|
||||||
|
AKA: XQuartz 2.7.5 doesn't delete its /tmp/.X$d-lock
|
||||||
|
|
||||||
|
http://xquartz.macosforge.org/trac/ticket/823
|
||||||
|
|
||||||
|
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||||
|
---
|
||||||
|
hw/xquartz/X11Controller.m | 5 ++---
|
||||||
|
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
|
||||||
|
index 5445c6f..022e832 100644
|
||||||
|
--- a/hw/xquartz/X11Controller.m
|
||||||
|
+++ b/hw/xquartz/X11Controller.m
|
||||||
|
@@ -942,9 +942,8 @@ extern char *bundle_id_prefix;
|
||||||
|
/* shutdown the X server, it will exit () for us. */
|
||||||
|
DarwinSendDDXEvent(kXquartzQuit, 0);
|
||||||
|
|
||||||
|
- /* In case it doesn't, exit anyway after a while. */
|
||||||
|
- remain = 10000000;
|
||||||
|
- while ((remain = usleep(remain)) > 0) ;
|
||||||
|
+ /* In case it doesn't, exit anyway after 5s. */
|
||||||
|
+ [NSThread sleepForTimeInterval:5.0];
|
||||||
|
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
1.9.1
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
From d36a301fb3d0f2c7a3d81cbda3fd21d8d36038e5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeremy Huddleston <jeremyhu@apple.com>
|
||||||
|
Date: Fri, 13 Jan 2012 12:00:57 -0800
|
||||||
|
Subject: [PATCH 5000/5004] sdksyms.sh: Use CPPFLAGS, not CFLAGS
|
||||||
|
|
||||||
|
CFLAGS can include flags which are not useful to the preprocessor
|
||||||
|
or can even cause it to fail. This fixes a build issue on darwin
|
||||||
|
when building for more than one architecture.
|
||||||
|
|
||||||
|
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
|
||||||
|
Reviewed-by: Keith Packard <keithp@keithp.com>
|
||||||
|
---
|
||||||
|
hw/xfree86/Makefile.am | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
|
||||||
|
index c3899b5..4f48b85 100644
|
||||||
|
--- a/hw/xfree86/Makefile.am
|
||||||
|
+++ b/hw/xfree86/Makefile.am
|
||||||
|
@@ -38,7 +38,7 @@ DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw os-support \
|
||||||
|
bin_PROGRAMS = Xorg
|
||||||
|
nodist_Xorg_SOURCES = sdksyms.c
|
||||||
|
|
||||||
|
-AM_CFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
|
||||||
|
+AM_CPPFLAGS = $(DIX_CFLAGS) @XORG_CFLAGS@
|
||||||
|
INCLUDES = $(XORG_INCS) -I$(srcdir)/parser -I$(top_srcdir)/miext/cw \
|
||||||
|
-I$(srcdir)/ddc -I$(srcdir)/i2c -I$(srcdir)/modes -I$(srcdir)/ramdac \
|
||||||
|
-I$(srcdir)/dri -I$(srcdir)/dri2
|
||||||
|
@@ -115,7 +115,7 @@ CLEANFILES = sdksyms.c sdksyms.dep
|
||||||
|
EXTRA_DIST += sdksyms.sh
|
||||||
|
|
||||||
|
sdksyms.dep sdksyms.c: sdksyms.sh
|
||||||
|
- $(AM_V_GEN)CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CFLAGS) $(AM_CFLAGS) $(INCLUDES)
|
||||||
|
+ $(AM_V_GEN)CPP='$(CPP)' AWK='$(AWK)' $(SHELL) $(srcdir)/sdksyms.sh $(top_srcdir) $(CPPFLAGS) $(AM_CPPFLAGS) $(INCLUDES)
|
||||||
|
|
||||||
|
SDKSYMS_DEP = sdksyms.dep
|
||||||
|
include $(SDKSYMS_DEP)
|
||||||
|
--
|
||||||
|
1.8.4.1
|
||||||
|
|
|
@ -0,0 +1,165 @@
|
||||||
|
From 9ca14507a31338fad40d430445a4a4cb8106bc9b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeremy Huddleston <jeremyhu@apple.com>
|
||||||
|
Date: Fri, 30 Apr 2010 13:08:25 -0700
|
||||||
|
Subject: [PATCH 5001/5004] Workaround the GC clipping problem in miPaintWindow
|
||||||
|
and add some debugging output.
|
||||||
|
|
||||||
|
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
|
||||||
|
---
|
||||||
|
mi/miexpose.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
|
||||||
|
1 file changed, 94 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/mi/miexpose.c b/mi/miexpose.c
|
||||||
|
index 8b7c93f..3e972f7 100644
|
||||||
|
--- a/mi/miexpose.c
|
||||||
|
+++ b/mi/miexpose.c
|
||||||
|
@@ -489,7 +489,8 @@ void RootlessSetPixmapOfAncestors(WindowPtr pWin);
|
||||||
|
void RootlessStartDrawing(WindowPtr pWin);
|
||||||
|
void RootlessDamageRegion(WindowPtr pWin, RegionPtr prgn);
|
||||||
|
Bool IsFramedWindow(WindowPtr pWin);
|
||||||
|
-#endif
|
||||||
|
+#include "../fb/fb.h"
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
void
|
||||||
|
miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
|
||||||
|
@@ -518,23 +519,37 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
|
||||||
|
Bool solid = TRUE;
|
||||||
|
DrawablePtr drawable = &pWin->drawable;
|
||||||
|
|
||||||
|
+#ifdef XQUARTZ_CLIP_DEBUG
|
||||||
|
+ ErrorF("START %d BS %d (pR = %ld)\n", what, pWin->backgroundState, ParentRelative);
|
||||||
|
+ ErrorF(" Rgn: %d %d %d %d\n", prgn->extents.x1, prgn->extents.y1,
|
||||||
|
+ prgn->extents.x2 - prgn->extents.x1,
|
||||||
|
+ prgn->extents.y2 - prgn->extents.y1);
|
||||||
|
+ ErrorF(" Win: %d %d (%d %d) %d %d\n", pWin->origin.x, pWin->origin.y,
|
||||||
|
+ pWin->winSize.extents.x1, pWin->winSize.extents.y1,
|
||||||
|
+ pWin->winSize.extents.x2 - pWin->winSize.extents.x1,
|
||||||
|
+ pWin->winSize.extents.y2 - pWin->winSize.extents.y1);
|
||||||
|
+ ErrorF(" Draw: %d %d %d %d\n", pWin->drawable.x, pWin->drawable.y,
|
||||||
|
+ pWin->drawable.width, pWin->drawable.height);
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#ifdef ROOTLESS
|
||||||
|
if (!drawable || drawable->type == UNDRAWABLE_WINDOW)
|
||||||
|
return;
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+ if (what == PW_BACKGROUND)
|
||||||
|
+ {
|
||||||
|
+#ifdef ROOTLESS
|
||||||
|
+ if(IsFramedWindow(pWin)) {
|
||||||
|
+ RootlessStartDrawing(pWin);
|
||||||
|
+ RootlessDamageRegion(pWin, prgn);
|
||||||
|
|
||||||
|
- if (IsFramedWindow(pWin)) {
|
||||||
|
- RootlessStartDrawing(pWin);
|
||||||
|
- RootlessDamageRegion(pWin, prgn);
|
||||||
|
-
|
||||||
|
- if (pWin->backgroundState == ParentRelative) {
|
||||||
|
- if ((what == PW_BACKGROUND) ||
|
||||||
|
- (what == PW_BORDER && !pWin->borderIsPixel))
|
||||||
|
+ if(pWin->backgroundState == ParentRelative) {
|
||||||
|
RootlessSetPixmapOfAncestors(pWin);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
- }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
- if (what == PW_BACKGROUND) {
|
||||||
|
while (pWin->backgroundState == ParentRelative)
|
||||||
|
pWin = pWin->parent;
|
||||||
|
|
||||||
|
@@ -559,6 +574,18 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
|
||||||
|
else {
|
||||||
|
PixmapPtr pixmap;
|
||||||
|
|
||||||
|
+#ifdef ROOTLESS
|
||||||
|
+ if(IsFramedWindow(pWin)) {
|
||||||
|
+ RootlessStartDrawing(pWin);
|
||||||
|
+ RootlessDamageRegion(pWin, prgn);
|
||||||
|
+
|
||||||
|
+ if(!pWin->borderIsPixel &&
|
||||||
|
+ pWin->backgroundState == ParentRelative) {
|
||||||
|
+ RootlessSetPixmapOfAncestors(pWin);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
tile_x_off = drawable->x;
|
||||||
|
tile_y_off = drawable->y;
|
||||||
|
|
||||||
|
@@ -567,6 +594,12 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
|
||||||
|
return;
|
||||||
|
pixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) drawable);
|
||||||
|
drawable = &pixmap->drawable;
|
||||||
|
+
|
||||||
|
+#ifdef XQUARTZ_CLIP_DEBUG
|
||||||
|
+ ErrorF(" Draw: %d %d %d %d\n",
|
||||||
|
+ drawable->x, drawable->y, drawable->width, drawable->height);
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
#ifdef COMPOSITE
|
||||||
|
draw_x_off = pixmap->screen_x;
|
||||||
|
draw_y_off = pixmap->screen_y;
|
||||||
|
@@ -629,6 +662,57 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
|
||||||
|
ChangeGC(NullClient, pGC, gcmask, gcval);
|
||||||
|
ValidateGC(drawable, pGC);
|
||||||
|
|
||||||
|
+#ifdef XQUARTZ_CLIP_DEBUG
|
||||||
|
+ ErrorF(" GC: %d %d %d %d\n",
|
||||||
|
+ pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
|
||||||
|
+ pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
|
||||||
|
+ pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifdef XQUARTZ
|
||||||
|
+ /* Looks like our clipping isn't set right for some reason:
|
||||||
|
+ * http://xquartz.macosforge.org/trac/ticket/290
|
||||||
|
+ */
|
||||||
|
+ if(what == PW_BORDER) {
|
||||||
|
+
|
||||||
|
+#if 0
|
||||||
|
+ if(solid) {
|
||||||
|
+#if 1
|
||||||
|
+ fbFillRegionSolid(&pWin->drawable,
|
||||||
|
+ prgn,
|
||||||
|
+ 0,
|
||||||
|
+ fbReplicatePixel(fill.pixel,
|
||||||
|
+ pWin->drawable.bitsPerPixel));
|
||||||
|
+#else
|
||||||
|
+ fbFillRegionSolid(drawable,
|
||||||
|
+ prgn,
|
||||||
|
+ 0,
|
||||||
|
+ fbReplicatePixel(fill.pixel,
|
||||||
|
+ drawable->bitsPerPixel));
|
||||||
|
+#endif
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+ pGC->pCompositeClip->extents.x1 += prgn->extents.x1;
|
||||||
|
+ pGC->pCompositeClip->extents.y1 += prgn->extents.y1;
|
||||||
|
+ pGC->pCompositeClip->extents.x2 += prgn->extents.x1;
|
||||||
|
+ pGC->pCompositeClip->extents.y2 += prgn->extents.y1;
|
||||||
|
+
|
||||||
|
+ if(pGC->pCompositeClip->extents.x2 > drawable->pScreen->width)
|
||||||
|
+ pGC->pCompositeClip->extents.x2 = drawable->pScreen->width;
|
||||||
|
+ if(pGC->pCompositeClip->extents.y2 > drawable->pScreen->height)
|
||||||
|
+ pGC->pCompositeClip->extents.y2 = drawable->pScreen->height;
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+#ifdef XQUARTZ_CLIP_DEBUG
|
||||||
|
+ ErrorF(" GC: %d %d %d %d\n",
|
||||||
|
+ pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.y1,
|
||||||
|
+ pGC->pCompositeClip->extents.x2 - pGC->pCompositeClip->extents.x1,
|
||||||
|
+ pGC->pCompositeClip->extents.y2 - pGC->pCompositeClip->extents.y1);
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
numRects = RegionNumRects(prgn);
|
||||||
|
pbox = RegionRects(prgn);
|
||||||
|
for (i = numRects; --i >= 0; pbox++, prect++) {
|
||||||
|
--
|
||||||
|
1.8.4.1
|
||||||
|
|
|
@ -0,0 +1,316 @@
|
||||||
|
From 07f9e0beaf66ec9de1455a305c87ab642968f3f1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeremy Huddleston <jeremyhu@apple.com>
|
||||||
|
Date: Fri, 12 Feb 2010 19:48:52 -0800
|
||||||
|
Subject: [PATCH 5002/5004] fb: Revert fb changes that broke XQuartz
|
||||||
|
|
||||||
|
http://bugs.freedesktop.org/show_bug.cgi?id=26124
|
||||||
|
|
||||||
|
Revert "Fix source pictures getting random transforms after 2d6a8f668342a5190cdf43b5."
|
||||||
|
Revert "fb: Adjust transform or composite coordinates for pixman operations"
|
||||||
|
|
||||||
|
http://bugs.freedesktop.org/26124
|
||||||
|
|
||||||
|
This reverts commit a72c65e9176c51de95db2fdbf4c5d946a4911695.
|
||||||
|
This reverts commit a6bd5d2e482a5aa84acb3d4932e2a166d8670ef1.
|
||||||
|
|
||||||
|
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
|
||||||
|
---
|
||||||
|
fb/fb.h | 3 +--
|
||||||
|
fb/fbpict.c | 82 ++++++++++++++++++-------------------------------------------
|
||||||
|
fb/fbtrap.c | 43 ++++++++++++++------------------
|
||||||
|
3 files changed, 43 insertions(+), 85 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/fb/fb.h b/fb/fb.h
|
||||||
|
index b869d12..895b148 100644
|
||||||
|
--- a/fb/fb.h
|
||||||
|
+++ b/fb/fb.h
|
||||||
|
@@ -1686,8 +1686,7 @@ fbFillRegionSolid(DrawablePtr pDrawable,
|
||||||
|
RegionPtr pRegion, FbBits and, FbBits xor);
|
||||||
|
|
||||||
|
extern _X_EXPORT pixman_image_t *image_from_pict(PicturePtr pict,
|
||||||
|
- Bool has_clip,
|
||||||
|
- int *xoff, int *yoff);
|
||||||
|
+ Bool has_clip);
|
||||||
|
|
||||||
|
extern _X_EXPORT void free_pixman_pict(PicturePtr, pixman_image_t *);
|
||||||
|
|
||||||
|
diff --git a/fb/fbpict.c b/fb/fbpict.c
|
||||||
|
index 2804ff4..80c2a91 100644
|
||||||
|
--- a/fb/fbpict.c
|
||||||
|
+++ b/fb/fbpict.c
|
||||||
|
@@ -46,23 +46,18 @@ fbComposite(CARD8 op,
|
||||||
|
INT16 yMask, INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
|
||||||
|
{
|
||||||
|
pixman_image_t *src, *mask, *dest;
|
||||||
|
- int src_xoff, src_yoff;
|
||||||
|
- int msk_xoff, msk_yoff;
|
||||||
|
- int dst_xoff, dst_yoff;
|
||||||
|
-
|
||||||
|
miCompositeSourceValidate(pSrc);
|
||||||
|
if (pMask)
|
||||||
|
miCompositeSourceValidate(pMask);
|
||||||
|
|
||||||
|
- src = image_from_pict(pSrc, FALSE, &src_xoff, &src_yoff);
|
||||||
|
- mask = image_from_pict(pMask, FALSE, &msk_xoff, &msk_yoff);
|
||||||
|
- dest = image_from_pict(pDst, TRUE, &dst_xoff, &dst_yoff);
|
||||||
|
+ src = image_from_pict(pSrc, TRUE);
|
||||||
|
+ mask = image_from_pict(pMask, TRUE);
|
||||||
|
+ dest = image_from_pict(pDst, TRUE);
|
||||||
|
|
||||||
|
if (src && dest && !(pMask && !mask)) {
|
||||||
|
pixman_image_composite(op, src, mask, dest,
|
||||||
|
- xSrc + src_xoff, ySrc + src_yoff,
|
||||||
|
- xMask + msk_xoff, yMask + msk_yoff,
|
||||||
|
- xDst + dst_xoff, yDst + dst_yoff, width, height);
|
||||||
|
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
|
||||||
|
+ width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
free_pixman_pict(pSrc, src);
|
||||||
|
@@ -293,20 +288,22 @@ create_conical_gradient_image(PictGradient * gradient)
|
||||||
|
}
|
||||||
|
|
||||||
|
static pixman_image_t *
|
||||||
|
-create_bits_picture(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
|
||||||
|
+create_bits_picture(PicturePtr pict, Bool has_clip)
|
||||||
|
{
|
||||||
|
- PixmapPtr pixmap;
|
||||||
|
FbBits *bits;
|
||||||
|
FbStride stride;
|
||||||
|
- int bpp;
|
||||||
|
+ int bpp, xoff, yoff;
|
||||||
|
pixman_image_t *image;
|
||||||
|
|
||||||
|
- fbGetDrawablePixmap(pict->pDrawable, pixmap, *xoff, *yoff);
|
||||||
|
- fbGetPixmapBitsData(pixmap, bits, stride, bpp);
|
||||||
|
+ fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
|
||||||
|
+
|
||||||
|
+ bits = (FbBits*)((CARD8*)bits +
|
||||||
|
+ (pict->pDrawable->y + yoff) * stride * sizeof(FbBits) +
|
||||||
|
+ (pict->pDrawable->x + xoff) * (bpp / 8));
|
||||||
|
|
||||||
|
image = pixman_image_create_bits((pixman_format_code_t) pict->format,
|
||||||
|
- pixmap->drawable.width,
|
||||||
|
- pixmap->drawable.height, (uint32_t *) bits,
|
||||||
|
+ pict->pDrawable->width,
|
||||||
|
+ pict->pDrawable->height, (uint32_t *) bits,
|
||||||
|
stride * sizeof(FbStride));
|
||||||
|
|
||||||
|
if (!image)
|
||||||
|
@@ -333,57 +330,31 @@ create_bits_picture(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
|
||||||
|
if (pict->clientClipType != CT_NONE)
|
||||||
|
pixman_image_set_has_client_clip(image, TRUE);
|
||||||
|
|
||||||
|
- if (*xoff || *yoff)
|
||||||
|
- pixman_region_translate(pict->pCompositeClip, *xoff, *yoff);
|
||||||
|
+ pixman_region_translate (pict->pCompositeClip, - pict->pDrawable->x, - pict->pDrawable->y);
|
||||||
|
|
||||||
|
pixman_image_set_clip_region(image, pict->pCompositeClip);
|
||||||
|
|
||||||
|
- if (*xoff || *yoff)
|
||||||
|
- pixman_region_translate(pict->pCompositeClip, -*xoff, -*yoff);
|
||||||
|
+ pixman_region_translate (pict->pCompositeClip, pict->pDrawable->x, pict->pDrawable->y);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Indexed table */
|
||||||
|
if (pict->pFormat->index.devPrivate)
|
||||||
|
pixman_image_set_indexed(image, pict->pFormat->index.devPrivate);
|
||||||
|
|
||||||
|
- /* Add in drawable origin to position within the image */
|
||||||
|
- *xoff += pict->pDrawable->x;
|
||||||
|
- *yoff += pict->pDrawable->y;
|
||||||
|
-
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
static pixman_image_t *image_from_pict_internal(PicturePtr pict, Bool has_clip,
|
||||||
|
- int *xoff, int *yoff,
|
||||||
|
Bool is_alpha_map);
|
||||||
|
|
||||||
|
static void
|
||||||
|
-set_image_properties(pixman_image_t * image, PicturePtr pict, Bool has_clip,
|
||||||
|
- int *xoff, int *yoff, Bool is_alpha_map)
|
||||||
|
+set_image_properties(pixman_image_t * image, PicturePtr pict, Bool is_alpha_map)
|
||||||
|
{
|
||||||
|
pixman_repeat_t repeat;
|
||||||
|
pixman_filter_t filter;
|
||||||
|
|
||||||
|
if (pict->transform) {
|
||||||
|
- /* For source images, adjust the transform to account
|
||||||
|
- * for the drawable offset within the pixman image,
|
||||||
|
- * then set the offset to 0 as it will be used
|
||||||
|
- * to compute positions within the transformed image.
|
||||||
|
- */
|
||||||
|
- if (!has_clip) {
|
||||||
|
- struct pixman_transform adjusted;
|
||||||
|
-
|
||||||
|
- adjusted = *pict->transform;
|
||||||
|
- pixman_transform_translate(&adjusted,
|
||||||
|
- NULL,
|
||||||
|
- pixman_int_to_fixed(*xoff),
|
||||||
|
- pixman_int_to_fixed(*yoff));
|
||||||
|
- pixman_image_set_transform(image, &adjusted);
|
||||||
|
- *xoff = 0;
|
||||||
|
- *yoff = 0;
|
||||||
|
- }
|
||||||
|
- else
|
||||||
|
- pixman_image_set_transform(image, pict->transform);
|
||||||
|
+ pixman_image_set_transform(image, pict->transform);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (pict->repeatType) {
|
||||||
|
@@ -411,10 +382,8 @@ set_image_properties(pixman_image_t * image, PicturePtr pict, Bool has_clip,
|
||||||
|
* as the alpha map for this operation
|
||||||
|
*/
|
||||||
|
if (pict->alphaMap && !is_alpha_map) {
|
||||||
|
- int alpha_xoff, alpha_yoff;
|
||||||
|
pixman_image_t *alpha_map =
|
||||||
|
- image_from_pict_internal(pict->alphaMap, FALSE, &alpha_xoff,
|
||||||
|
- &alpha_yoff, TRUE);
|
||||||
|
+ image_from_pict_internal(pict->alphaMap, TRUE, TRUE);
|
||||||
|
|
||||||
|
pixman_image_set_alpha_map(image, alpha_map, pict->alphaOrigin.x,
|
||||||
|
pict->alphaOrigin.y);
|
||||||
|
@@ -448,8 +417,7 @@ set_image_properties(pixman_image_t * image, PicturePtr pict, Bool has_clip,
|
||||||
|
}
|
||||||
|
|
||||||
|
static pixman_image_t *
|
||||||
|
-image_from_pict_internal(PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
|
||||||
|
- Bool is_alpha_map)
|
||||||
|
+image_from_pict_internal(PicturePtr pict, Bool has_clip, Bool is_alpha_map)
|
||||||
|
{
|
||||||
|
pixman_image_t *image = NULL;
|
||||||
|
|
||||||
|
@@ -457,7 +425,7 @@ image_from_pict_internal(PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (pict->pDrawable) {
|
||||||
|
- image = create_bits_picture(pict, has_clip, xoff, yoff);
|
||||||
|
+ image = create_bits_picture(pict, has_clip);
|
||||||
|
}
|
||||||
|
else if (pict->pSourcePict) {
|
||||||
|
SourcePict *sp = pict->pSourcePict;
|
||||||
|
@@ -475,19 +443,17 @@ image_from_pict_internal(PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
|
||||||
|
else if (sp->type == SourcePictTypeConical)
|
||||||
|
image = create_conical_gradient_image(gradient);
|
||||||
|
}
|
||||||
|
- *xoff = *yoff = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (image)
|
||||||
|
- set_image_properties(image, pict, has_clip, xoff, yoff, is_alpha_map);
|
||||||
|
-
|
||||||
|
+ set_image_properties (image, pict, is_alpha_map);
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
|
pixman_image_t *
|
||||||
|
-image_from_pict(PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
|
||||||
|
+image_from_pict (PicturePtr pict, Bool has_clip)
|
||||||
|
{
|
||||||
|
- return image_from_pict_internal(pict, has_clip, xoff, yoff, FALSE);
|
||||||
|
+ return image_from_pict_internal (pict, has_clip, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
|
||||||
|
index bf82f8f..0145ce9 100644
|
||||||
|
--- a/fb/fbtrap.c
|
||||||
|
+++ b/fb/fbtrap.c
|
||||||
|
@@ -36,13 +36,12 @@ fbAddTraps(PicturePtr pPicture,
|
||||||
|
INT16 x_off, INT16 y_off, int ntrap, xTrap * traps)
|
||||||
|
{
|
||||||
|
pixman_image_t *image;
|
||||||
|
- int dst_xoff, dst_yoff;
|
||||||
|
|
||||||
|
- if (!(image = image_from_pict(pPicture, FALSE, &dst_xoff, &dst_yoff)))
|
||||||
|
- return;
|
||||||
|
-
|
||||||
|
- pixman_add_traps(image, x_off + dst_xoff, y_off + dst_yoff,
|
||||||
|
- ntrap, (pixman_trap_t *) traps);
|
||||||
|
+ if (!(image = image_from_pict (pPicture, FALSE)))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ pixman_add_traps(image, x_off, y_off,
|
||||||
|
+ ntrap, (pixman_trap_t *)traps);
|
||||||
|
|
||||||
|
free_pixman_pict(pPicture, image);
|
||||||
|
}
|
||||||
|
@@ -52,13 +51,12 @@ fbRasterizeTrapezoid(PicturePtr pPicture,
|
||||||
|
xTrapezoid * trap, int x_off, int y_off)
|
||||||
|
{
|
||||||
|
pixman_image_t *image;
|
||||||
|
- int dst_xoff, dst_yoff;
|
||||||
|
|
||||||
|
- if (!(image = image_from_pict(pPicture, FALSE, &dst_xoff, &dst_yoff)))
|
||||||
|
+ if (!(image = image_from_pict (pPicture, FALSE)))
|
||||||
|
return;
|
||||||
|
|
||||||
|
- pixman_rasterize_trapezoid(image, (pixman_trapezoid_t *) trap,
|
||||||
|
- x_off + dst_xoff, y_off + dst_yoff);
|
||||||
|
+ pixman_rasterize_trapezoid(image, (pixman_trapezoid_t *)trap,
|
||||||
|
+ x_off, y_off);
|
||||||
|
|
||||||
|
free_pixman_pict(pPicture, image);
|
||||||
|
}
|
||||||
|
@@ -68,14 +66,12 @@ fbAddTriangles(PicturePtr pPicture,
|
||||||
|
INT16 x_off, INT16 y_off, int ntri, xTriangle * tris)
|
||||||
|
{
|
||||||
|
pixman_image_t *image;
|
||||||
|
- int dst_xoff, dst_yoff;
|
||||||
|
|
||||||
|
- if (!(image = image_from_pict(pPicture, FALSE, &dst_xoff, &dst_yoff)))
|
||||||
|
+ if (!(image = image_from_pict (pPicture, FALSE)))
|
||||||
|
return;
|
||||||
|
-
|
||||||
|
- pixman_add_triangles(image,
|
||||||
|
- dst_xoff + x_off, dst_yoff + y_off,
|
||||||
|
- ntri, (pixman_triangle_t *) tris);
|
||||||
|
+
|
||||||
|
+ pixman_add_triangles(image, x_off, y_off, ntri,
|
||||||
|
+ (pixman_triangle_t *)tris);
|
||||||
|
|
||||||
|
free_pixman_pict(pPicture, image);
|
||||||
|
}
|
||||||
|
@@ -98,13 +94,11 @@ fbShapes(CompositeShapesFunc composite,
|
||||||
|
int16_t ySrc, int nshapes, int shape_size, const uint8_t * shapes)
|
||||||
|
{
|
||||||
|
pixman_image_t *src, *dst;
|
||||||
|
- int src_xoff, src_yoff;
|
||||||
|
- int dst_xoff, dst_yoff;
|
||||||
|
|
||||||
|
miCompositeSourceValidate(pSrc);
|
||||||
|
|
||||||
|
- src = image_from_pict(pSrc, FALSE, &src_xoff, &src_yoff);
|
||||||
|
- dst = image_from_pict(pDst, TRUE, &dst_xoff, &dst_yoff);
|
||||||
|
+ src = image_from_pict(pSrc, FALSE);
|
||||||
|
+ dst = image_from_pict(pDst, TRUE);
|
||||||
|
|
||||||
|
if (src && dst) {
|
||||||
|
pixman_format_code_t format;
|
||||||
|
@@ -121,9 +115,8 @@ fbShapes(CompositeShapesFunc composite,
|
||||||
|
|
||||||
|
for (i = 0; i < nshapes; ++i) {
|
||||||
|
composite(op, src, dst, format,
|
||||||
|
- xSrc + src_xoff,
|
||||||
|
- ySrc + src_yoff,
|
||||||
|
- dst_xoff, dst_yoff, 1, shapes + i * shape_size);
|
||||||
|
+ xSrc, ySrc, 0, 0,
|
||||||
|
+ 1, shapes + i * shape_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
@@ -143,8 +136,8 @@ fbShapes(CompositeShapesFunc composite,
|
||||||
|
}
|
||||||
|
|
||||||
|
composite(op, src, dst, format,
|
||||||
|
- xSrc + src_xoff,
|
||||||
|
- ySrc + src_yoff, dst_xoff, dst_yoff, nshapes, shapes);
|
||||||
|
+ xSrc, ySrc, 0, 0,
|
||||||
|
+ nshapes, shapes);
|
||||||
|
}
|
||||||
|
|
||||||
|
DamageRegionProcessPending(pDst->pDrawable);
|
||||||
|
--
|
||||||
|
1.8.4.1
|
||||||
|
|
|
@ -0,0 +1,230 @@
|
||||||
|
From 4a0444a2773bddc3abbf5305a344001ecfe9378c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||||
|
Date: Tue, 18 Dec 2012 01:03:38 -0800
|
||||||
|
Subject: [PATCH 5003/5004] fb: Revert fb changes that broke XQuartz
|
||||||
|
|
||||||
|
http://bugs.freedesktop.org/show_bug.cgi?id=26124
|
||||||
|
|
||||||
|
Revert "Use new pixman_glyph_cache_t API that will be in pixman 0.28.0"
|
||||||
|
|
||||||
|
This reverts commit 9cbcb5bd6a5360a128d15b77a02d8d3351f74366.
|
||||||
|
---
|
||||||
|
configure.ac | 2 +-
|
||||||
|
fb/fb.h | 3 --
|
||||||
|
fb/fbpict.c | 153 +---------------------------------------------------------
|
||||||
|
fb/fbscreen.c | 1 -
|
||||||
|
4 files changed, 2 insertions(+), 157 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/configure.ac b/configure.ac
|
||||||
|
index 8797df5..99a1e62 100644
|
||||||
|
--- a/configure.ac
|
||||||
|
+++ b/configure.ac
|
||||||
|
@@ -811,7 +811,7 @@ LIBPCIACCESS="pciaccess >= 0.12.901"
|
||||||
|
LIBUDEV="libudev >= 143"
|
||||||
|
LIBSELINUX="libselinux >= 2.0.86"
|
||||||
|
LIBDBUS="dbus-1 >= 1.0"
|
||||||
|
-LIBPIXMAN="pixman-1 >= 0.27.2"
|
||||||
|
+LIBPIXMAN="pixman-1 >= 0.21.8"
|
||||||
|
|
||||||
|
dnl Pixman is always required, but we separate it out so we can link
|
||||||
|
dnl specific modules against it
|
||||||
|
diff --git a/fb/fb.h b/fb/fb.h
|
||||||
|
index 895b148..cc5759c 100644
|
||||||
|
--- a/fb/fb.h
|
||||||
|
+++ b/fb/fb.h
|
||||||
|
@@ -1344,9 +1344,6 @@ extern _X_EXPORT void
|
||||||
|
extern _X_EXPORT Bool
|
||||||
|
fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats);
|
||||||
|
|
||||||
|
-extern _X_EXPORT void
|
||||||
|
-fbDestroyGlyphCache(void);
|
||||||
|
-
|
||||||
|
/*
|
||||||
|
* fbpixmap.c
|
||||||
|
*/
|
||||||
|
diff --git a/fb/fbpict.c b/fb/fbpict.c
|
||||||
|
index 80c2a91..dc0ca3c 100644
|
||||||
|
--- a/fb/fbpict.c
|
||||||
|
+++ b/fb/fbpict.c
|
||||||
|
@@ -65,156 +65,6 @@ fbComposite(CARD8 op,
|
||||||
|
free_pixman_pict(pDst, dest);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static pixman_glyph_cache_t *glyphCache;
|
||||||
|
-
|
||||||
|
-void
|
||||||
|
-fbDestroyGlyphCache(void)
|
||||||
|
-{
|
||||||
|
- if (glyphCache)
|
||||||
|
- {
|
||||||
|
- pixman_glyph_cache_destroy (glyphCache);
|
||||||
|
- glyphCache = NULL;
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-static void
|
||||||
|
-fbUnrealizeGlyph(ScreenPtr pScreen,
|
||||||
|
- GlyphPtr pGlyph)
|
||||||
|
-{
|
||||||
|
- if (glyphCache)
|
||||||
|
- pixman_glyph_cache_remove (glyphCache, pGlyph, NULL);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-static void
|
||||||
|
-fbGlyphs(CARD8 op,
|
||||||
|
- PicturePtr pSrc,
|
||||||
|
- PicturePtr pDst,
|
||||||
|
- PictFormatPtr maskFormat,
|
||||||
|
- INT16 xSrc,
|
||||||
|
- INT16 ySrc, int nlist,
|
||||||
|
- GlyphListPtr list,
|
||||||
|
- GlyphPtr *glyphs)
|
||||||
|
-{
|
||||||
|
-#define N_STACK_GLYPHS 512
|
||||||
|
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
|
||||||
|
- pixman_glyph_t stack_glyphs[N_STACK_GLYPHS];
|
||||||
|
- pixman_glyph_t *pglyphs = stack_glyphs;
|
||||||
|
- pixman_image_t *srcImage, *dstImage;
|
||||||
|
- int srcXoff, srcYoff, dstXoff, dstYoff;
|
||||||
|
- GlyphPtr glyph;
|
||||||
|
- int n_glyphs;
|
||||||
|
- int x, y;
|
||||||
|
- int i, n;
|
||||||
|
- int xDst = list->xOff, yDst = list->yOff;
|
||||||
|
-
|
||||||
|
- miCompositeSourceValidate(pSrc);
|
||||||
|
-
|
||||||
|
- n_glyphs = 0;
|
||||||
|
- for (i = 0; i < nlist; ++i)
|
||||||
|
- n_glyphs += list[i].len;
|
||||||
|
-
|
||||||
|
- if (!glyphCache)
|
||||||
|
- glyphCache = pixman_glyph_cache_create();
|
||||||
|
-
|
||||||
|
- pixman_glyph_cache_freeze (glyphCache);
|
||||||
|
-
|
||||||
|
- if (n_glyphs > N_STACK_GLYPHS) {
|
||||||
|
- if (!(pglyphs = malloc (n_glyphs * sizeof (pixman_glyph_t))))
|
||||||
|
- goto out;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- i = 0;
|
||||||
|
- x = y = 0;
|
||||||
|
- while (nlist--) {
|
||||||
|
- x += list->xOff;
|
||||||
|
- y += list->yOff;
|
||||||
|
- n = list->len;
|
||||||
|
- while (n--) {
|
||||||
|
- const void *g;
|
||||||
|
-
|
||||||
|
- glyph = *glyphs++;
|
||||||
|
-
|
||||||
|
- if (!(g = pixman_glyph_cache_lookup (glyphCache, glyph, NULL))) {
|
||||||
|
- pixman_image_t *glyphImage;
|
||||||
|
- PicturePtr pPicture;
|
||||||
|
- int xoff, yoff;
|
||||||
|
-
|
||||||
|
- pPicture = GetGlyphPicture(glyph, pScreen);
|
||||||
|
- if (!pPicture) {
|
||||||
|
- n_glyphs--;
|
||||||
|
- goto next;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (!(glyphImage = image_from_pict(pPicture, FALSE, &xoff, &yoff)))
|
||||||
|
- goto out;
|
||||||
|
-
|
||||||
|
- g = pixman_glyph_cache_insert(glyphCache, glyph, NULL,
|
||||||
|
- glyph->info.x,
|
||||||
|
- glyph->info.y,
|
||||||
|
- glyphImage);
|
||||||
|
-
|
||||||
|
- free_pixman_pict(pPicture, glyphImage);
|
||||||
|
-
|
||||||
|
- if (!g)
|
||||||
|
- goto out;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- pglyphs[i].x = x;
|
||||||
|
- pglyphs[i].y = y;
|
||||||
|
- pglyphs[i].glyph = g;
|
||||||
|
- i++;
|
||||||
|
-
|
||||||
|
- next:
|
||||||
|
- x += glyph->info.xOff;
|
||||||
|
- y += glyph->info.yOff;
|
||||||
|
- }
|
||||||
|
- list++;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (!(srcImage = image_from_pict(pSrc, FALSE, &srcXoff, &srcYoff)))
|
||||||
|
- goto out;
|
||||||
|
-
|
||||||
|
- if (!(dstImage = image_from_pict(pDst, TRUE, &dstXoff, &dstYoff)))
|
||||||
|
- goto out_free_src;
|
||||||
|
-
|
||||||
|
- if (maskFormat) {
|
||||||
|
- pixman_format_code_t format;
|
||||||
|
- pixman_box32_t extents;
|
||||||
|
- int x, y;
|
||||||
|
-
|
||||||
|
- format = maskFormat->format | (maskFormat->depth << 24);
|
||||||
|
-
|
||||||
|
- pixman_glyph_get_extents(glyphCache, n_glyphs, pglyphs, &extents);
|
||||||
|
-
|
||||||
|
- x = extents.x1;
|
||||||
|
- y = extents.y1;
|
||||||
|
-
|
||||||
|
- pixman_composite_glyphs(op, srcImage, dstImage, format,
|
||||||
|
- xSrc + srcXoff + xDst, ySrc + srcYoff + yDst,
|
||||||
|
- x, y,
|
||||||
|
- x + dstXoff, y + dstYoff,
|
||||||
|
- extents.x2 - extents.x1,
|
||||||
|
- extents.y2 - extents.y1,
|
||||||
|
- glyphCache, n_glyphs, pglyphs);
|
||||||
|
- }
|
||||||
|
- else {
|
||||||
|
- pixman_composite_glyphs_no_mask(op, srcImage, dstImage,
|
||||||
|
- xSrc + srcXoff - xDst, ySrc + srcYoff - yDst,
|
||||||
|
- dstXoff, dstYoff,
|
||||||
|
- glyphCache, n_glyphs, pglyphs);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- free_pixman_pict(pDst, dstImage);
|
||||||
|
-
|
||||||
|
-out_free_src:
|
||||||
|
- free_pixman_pict(pSrc, srcImage);
|
||||||
|
-
|
||||||
|
-out:
|
||||||
|
- pixman_glyph_cache_thaw(glyphCache);
|
||||||
|
- if (pglyphs != stack_glyphs)
|
||||||
|
- free(pglyphs);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
static pixman_image_t *
|
||||||
|
create_solid_fill_image(PicturePtr pict)
|
||||||
|
{
|
||||||
|
@@ -473,8 +323,7 @@ fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
|
||||||
|
return FALSE;
|
||||||
|
ps = GetPictureScreen(pScreen);
|
||||||
|
ps->Composite = fbComposite;
|
||||||
|
- ps->Glyphs = fbGlyphs;
|
||||||
|
- ps->UnrealizeGlyph = fbUnrealizeGlyph;
|
||||||
|
+ ps->Glyphs = miGlyphs;
|
||||||
|
ps->CompositeRects = miCompositeRects;
|
||||||
|
ps->RasterizeTrapezoid = fbRasterizeTrapezoid;
|
||||||
|
ps->Trapezoids = fbTrapezoids;
|
||||||
|
diff --git a/fb/fbscreen.c b/fb/fbscreen.c
|
||||||
|
index f9080a4..7c7d656 100644
|
||||||
|
--- a/fb/fbscreen.c
|
||||||
|
+++ b/fb/fbscreen.c
|
||||||
|
@@ -32,7 +32,6 @@ fbCloseScreen(ScreenPtr pScreen)
|
||||||
|
int d;
|
||||||
|
DepthPtr depths = pScreen->allowedDepths;
|
||||||
|
|
||||||
|
- fbDestroyGlyphCache();
|
||||||
|
for (d = 0; d < pScreen->numDepths; d++)
|
||||||
|
free(depths[d].vids);
|
||||||
|
free(depths);
|
||||||
|
--
|
||||||
|
1.8.4.1
|
||||||
|
|
|
@ -0,0 +1,297 @@
|
||||||
|
From bd9fce8b74f5358e4d7e5ce9b5cdd8fd195bb3fd Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||||
|
Date: Sat, 2 Nov 2013 11:00:23 -0700
|
||||||
|
Subject: [PATCH 5004/5004] Use old miTrapezoids and miTriangles routines
|
||||||
|
|
||||||
|
Reverts commits:
|
||||||
|
788ccb9a8bcf6a4fb4054c507111eec3338fb969
|
||||||
|
566f1931ee2916269e164e114bffaf2da1d039d1
|
||||||
|
|
||||||
|
http://xquartz.macosforge.org/trac/ticket/525
|
||||||
|
|
||||||
|
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||||
|
---
|
||||||
|
fb/fbpict.c | 2 -
|
||||||
|
render/mipict.c | 4 +-
|
||||||
|
render/mipict.h | 27 ++++++++++++++
|
||||||
|
render/mitrap.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
render/mitri.c | 61 +++++++++++++++++++++++++++++++
|
||||||
|
5 files changed, 201 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/fb/fbpict.c b/fb/fbpict.c
|
||||||
|
index dc0ca3c..276ff06 100644
|
||||||
|
--- a/fb/fbpict.c
|
||||||
|
+++ b/fb/fbpict.c
|
||||||
|
@@ -326,10 +326,8 @@ fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
|
||||||
|
ps->Glyphs = miGlyphs;
|
||||||
|
ps->CompositeRects = miCompositeRects;
|
||||||
|
ps->RasterizeTrapezoid = fbRasterizeTrapezoid;
|
||||||
|
- ps->Trapezoids = fbTrapezoids;
|
||||||
|
ps->AddTraps = fbAddTraps;
|
||||||
|
ps->AddTriangles = fbAddTriangles;
|
||||||
|
- ps->Triangles = fbTriangles;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
diff --git a/render/mipict.c b/render/mipict.c
|
||||||
|
index 2e64b20..d21b58a 100644
|
||||||
|
--- a/render/mipict.c
|
||||||
|
+++ b/render/mipict.c
|
||||||
|
@@ -595,8 +595,8 @@ miPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
|
||||||
|
ps->Composite = 0; /* requires DDX support */
|
||||||
|
ps->Glyphs = miGlyphs;
|
||||||
|
ps->CompositeRects = miCompositeRects;
|
||||||
|
- ps->Trapezoids = 0;
|
||||||
|
- ps->Triangles = 0;
|
||||||
|
+ ps->Trapezoids = miTrapezoids;
|
||||||
|
+ ps->Triangles = miTriangles;
|
||||||
|
|
||||||
|
ps->RasterizeTrapezoid = 0; /* requires DDX support */
|
||||||
|
ps->AddTraps = 0; /* requires DDX support */
|
||||||
|
diff --git a/render/mipict.h b/render/mipict.h
|
||||||
|
index 9436228..7ee2991 100644
|
||||||
|
--- a/render/mipict.h
|
||||||
|
+++ b/render/mipict.h
|
||||||
|
@@ -122,6 +122,16 @@ miCompositeRects(CARD8 op,
|
||||||
|
xRenderColor * color, int nRect, xRectangle *rects);
|
||||||
|
|
||||||
|
extern _X_EXPORT void
|
||||||
|
+miTriangles (CARD8 op,
|
||||||
|
+ PicturePtr pSrc,
|
||||||
|
+ PicturePtr pDst,
|
||||||
|
+ PictFormatPtr maskFormat,
|
||||||
|
+ INT16 xSrc,
|
||||||
|
+ INT16 ySrc,
|
||||||
|
+ int ntri,
|
||||||
|
+ xTriangle *tris);
|
||||||
|
+
|
||||||
|
+extern _X_EXPORT void
|
||||||
|
|
||||||
|
miTriStrip(CARD8 op,
|
||||||
|
PicturePtr pSrc,
|
||||||
|
@@ -137,10 +147,27 @@ miTriFan(CARD8 op,
|
||||||
|
PictFormatPtr maskFormat,
|
||||||
|
INT16 xSrc, INT16 ySrc, int npoints, xPointFixed * points);
|
||||||
|
|
||||||
|
+extern _X_EXPORT PicturePtr
|
||||||
|
+miCreateAlphaPicture (ScreenPtr pScreen,
|
||||||
|
+ PicturePtr pDst,
|
||||||
|
+ PictFormatPtr pPictFormat,
|
||||||
|
+ CARD16 width,
|
||||||
|
+ CARD16 height);
|
||||||
|
+
|
||||||
|
extern _X_EXPORT void
|
||||||
|
miTrapezoidBounds(int ntrap, xTrapezoid * traps, BoxPtr box);
|
||||||
|
|
||||||
|
extern _X_EXPORT void
|
||||||
|
+miTrapezoids (CARD8 op,
|
||||||
|
+ PicturePtr pSrc,
|
||||||
|
+ PicturePtr pDst,
|
||||||
|
+ PictFormatPtr maskFormat,
|
||||||
|
+ INT16 xSrc,
|
||||||
|
+ INT16 ySrc,
|
||||||
|
+ int ntrap,
|
||||||
|
+ xTrapezoid *traps);
|
||||||
|
+
|
||||||
|
+extern _X_EXPORT void
|
||||||
|
miPointFixedBounds(int npoint, xPointFixed * points, BoxPtr bounds);
|
||||||
|
|
||||||
|
extern _X_EXPORT void
|
||||||
|
diff --git a/render/mitrap.c b/render/mitrap.c
|
||||||
|
index 17b6dcd..71c1857 100644
|
||||||
|
--- a/render/mitrap.c
|
||||||
|
+++ b/render/mitrap.c
|
||||||
|
@@ -34,6 +34,55 @@
|
||||||
|
#include "picturestr.h"
|
||||||
|
#include "mipict.h"
|
||||||
|
|
||||||
|
+PicturePtr
|
||||||
|
+miCreateAlphaPicture (ScreenPtr pScreen,
|
||||||
|
+ PicturePtr pDst,
|
||||||
|
+ PictFormatPtr pPictFormat,
|
||||||
|
+ CARD16 width,
|
||||||
|
+ CARD16 height)
|
||||||
|
+{
|
||||||
|
+ PixmapPtr pPixmap;
|
||||||
|
+ PicturePtr pPicture;
|
||||||
|
+ GCPtr pGC;
|
||||||
|
+ int error;
|
||||||
|
+ xRectangle rect;
|
||||||
|
+
|
||||||
|
+ if (width > 32767 || height > 32767)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ if (!pPictFormat)
|
||||||
|
+ {
|
||||||
|
+ if (pDst->polyEdge == PolyEdgeSharp)
|
||||||
|
+ pPictFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
|
||||||
|
+ else
|
||||||
|
+ pPictFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
|
||||||
|
+ if (!pPictFormat)
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height,
|
||||||
|
+ pPictFormat->depth, 0);
|
||||||
|
+ if (!pPixmap)
|
||||||
|
+ return 0;
|
||||||
|
+ pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
|
||||||
|
+ if (!pGC)
|
||||||
|
+ {
|
||||||
|
+ (*pScreen->DestroyPixmap) (pPixmap);
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ ValidateGC (&pPixmap->drawable, pGC);
|
||||||
|
+ rect.x = 0;
|
||||||
|
+ rect.y = 0;
|
||||||
|
+ rect.width = width;
|
||||||
|
+ rect.height = height;
|
||||||
|
+ (*pGC->ops->PolyFillRect)(&pPixmap->drawable, pGC, 1, &rect);
|
||||||
|
+ FreeScratchGC (pGC);
|
||||||
|
+ pPicture = CreatePicture (0, &pPixmap->drawable, pPictFormat,
|
||||||
|
+ 0, 0, serverClient, &error);
|
||||||
|
+ (*pScreen->DestroyPixmap) (pPixmap);
|
||||||
|
+ return pPicture;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static xFixed
|
||||||
|
miLineFixedX(xLineFixed * l, xFixed y, Bool ceil)
|
||||||
|
{
|
||||||
|
@@ -79,3 +128,65 @@ miTrapezoidBounds(int ntrap, xTrapezoid * traps, BoxPtr box)
|
||||||
|
box->x2 = x2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+miTrapezoids (CARD8 op,
|
||||||
|
+ PicturePtr pSrc,
|
||||||
|
+ PicturePtr pDst,
|
||||||
|
+ PictFormatPtr maskFormat,
|
||||||
|
+ INT16 xSrc,
|
||||||
|
+ INT16 ySrc,
|
||||||
|
+ int ntrap,
|
||||||
|
+ xTrapezoid *traps)
|
||||||
|
+{
|
||||||
|
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
|
||||||
|
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * Check for solid alpha add
|
||||||
|
+ */
|
||||||
|
+ if (op == PictOpAdd && miIsSolidAlpha (pSrc))
|
||||||
|
+ {
|
||||||
|
+ for (; ntrap; ntrap--, traps++)
|
||||||
|
+ (*ps->RasterizeTrapezoid) (pDst, traps, 0, 0);
|
||||||
|
+ }
|
||||||
|
+ else if (maskFormat)
|
||||||
|
+ {
|
||||||
|
+ PicturePtr pPicture;
|
||||||
|
+ BoxRec bounds;
|
||||||
|
+ INT16 xDst, yDst;
|
||||||
|
+ INT16 xRel, yRel;
|
||||||
|
+
|
||||||
|
+ xDst = traps[0].left.p1.x >> 16;
|
||||||
|
+ yDst = traps[0].left.p1.y >> 16;
|
||||||
|
+
|
||||||
|
+ miTrapezoidBounds (ntrap, traps, &bounds);
|
||||||
|
+ if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
|
||||||
|
+ return;
|
||||||
|
+ pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat,
|
||||||
|
+ bounds.x2 - bounds.x1,
|
||||||
|
+ bounds.y2 - bounds.y1);
|
||||||
|
+ if (!pPicture)
|
||||||
|
+ return;
|
||||||
|
+ for (; ntrap; ntrap--, traps++)
|
||||||
|
+ (*ps->RasterizeTrapezoid) (pPicture, traps,
|
||||||
|
+ -bounds.x1, -bounds.y1);
|
||||||
|
+ xRel = bounds.x1 + xSrc - xDst;
|
||||||
|
+ yRel = bounds.y1 + ySrc - yDst;
|
||||||
|
+ CompositePicture (op, pSrc, pPicture, pDst,
|
||||||
|
+ xRel, yRel, 0, 0, bounds.x1, bounds.y1,
|
||||||
|
+ bounds.x2 - bounds.x1,
|
||||||
|
+ bounds.y2 - bounds.y1);
|
||||||
|
+ FreePicture (pPicture, 0);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ if (pDst->polyEdge == PolyEdgeSharp)
|
||||||
|
+ maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
|
||||||
|
+ else
|
||||||
|
+ maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
|
||||||
|
+ for (; ntrap; ntrap--, traps++)
|
||||||
|
+ miTrapezoids (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, traps);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
diff --git a/render/mitri.c b/render/mitri.c
|
||||||
|
index 922f22a..bdca9ca 100644
|
||||||
|
--- a/render/mitri.c
|
||||||
|
+++ b/render/mitri.c
|
||||||
|
@@ -65,3 +65,64 @@ miTriangleBounds(int ntri, xTriangle * tris, BoxPtr bounds)
|
||||||
|
{
|
||||||
|
miPointFixedBounds(ntri * 3, (xPointFixed *) tris, bounds);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+miTriangles (CARD8 op,
|
||||||
|
+ PicturePtr pSrc,
|
||||||
|
+ PicturePtr pDst,
|
||||||
|
+ PictFormatPtr maskFormat,
|
||||||
|
+ INT16 xSrc,
|
||||||
|
+ INT16 ySrc,
|
||||||
|
+ int ntri,
|
||||||
|
+ xTriangle *tris)
|
||||||
|
+{
|
||||||
|
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
|
||||||
|
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * Check for solid alpha add
|
||||||
|
+ */
|
||||||
|
+ if (op == PictOpAdd && miIsSolidAlpha (pSrc))
|
||||||
|
+ {
|
||||||
|
+ (*ps->AddTriangles) (pDst, 0, 0, ntri, tris);
|
||||||
|
+ }
|
||||||
|
+ else if (maskFormat)
|
||||||
|
+ {
|
||||||
|
+ BoxRec bounds;
|
||||||
|
+ PicturePtr pPicture;
|
||||||
|
+ INT16 xDst, yDst;
|
||||||
|
+ INT16 xRel, yRel;
|
||||||
|
+
|
||||||
|
+ xDst = tris[0].p1.x >> 16;
|
||||||
|
+ yDst = tris[0].p1.y >> 16;
|
||||||
|
+
|
||||||
|
+ miTriangleBounds (ntri, tris, &bounds);
|
||||||
|
+ if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1)
|
||||||
|
+ return;
|
||||||
|
+ pPicture = miCreateAlphaPicture (pScreen, pDst, maskFormat,
|
||||||
|
+ bounds.x2 - bounds.x1,
|
||||||
|
+ bounds.y2 - bounds.y1);
|
||||||
|
+ if (!pPicture)
|
||||||
|
+ return;
|
||||||
|
+ (*ps->AddTriangles) (pPicture, -bounds.x1, -bounds.y1, ntri, tris);
|
||||||
|
+
|
||||||
|
+ xRel = bounds.x1 + xSrc - xDst;
|
||||||
|
+ yRel = bounds.y1 + ySrc - yDst;
|
||||||
|
+ CompositePicture (op, pSrc, pPicture, pDst,
|
||||||
|
+ xRel, yRel, 0, 0, bounds.x1, bounds.y1,
|
||||||
|
+ bounds.x2 - bounds.x1, bounds.y2 - bounds.y1);
|
||||||
|
+ FreePicture (pPicture, 0);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ if (pDst->polyEdge == PolyEdgeSharp)
|
||||||
|
+ maskFormat = PictureMatchFormat (pScreen, 1, PICT_a1);
|
||||||
|
+ else
|
||||||
|
+ maskFormat = PictureMatchFormat (pScreen, 8, PICT_a8);
|
||||||
|
+
|
||||||
|
+ for (; ntri; ntri--, tris++)
|
||||||
|
+ miTriangles (op, pSrc, pDst, maskFormat, xSrc, ySrc, 1, tris);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
--
|
||||||
|
1.8.4.1
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
cstrahan:
|
||||||
|
|
||||||
|
This patch makes it possible (and necessary) to specify the default
|
||||||
|
shell, xterm client, and startx script from environment variables. These
|
||||||
|
defaults are used when launching the XQuartz.app, which in turn needs to know
|
||||||
|
how to start the X server. I've patched `command_from_prefs' so that it ignores
|
||||||
|
the preferences settings and immediately sets them to whatever the environment
|
||||||
|
variables are.
|
||||||
|
|
||||||
|
When developing an installable package for XQuartz/XQuartz.app, we'll need to
|
||||||
|
set an `LSEnvironment' entry in the plist for the XQuartz.app, we'll also need
|
||||||
|
to wrap the XQuartz.app/Contents/MacOS/X11 script (the Xquartz server will
|
||||||
|
invoke this script during initialization. See stub.patch for more details.).
|
||||||
|
|
||||||
|
diff --git a/hw/xquartz/mach-startup/bundle-main.c b/hw/xquartz/mach-startup/bundle-main.c
|
||||||
|
index b403662..b1e2070 100644
|
||||||
|
--- a/hw/xquartz/mach-startup/bundle-main.c
|
||||||
|
+++ b/hw/xquartz/mach-startup/bundle-main.c
|
||||||
|
@@ -77,13 +77,7 @@ FatalError(const char *f, ...) _X_ATTRIBUTE_PRINTF(1, 2) _X_NORETURN;
|
||||||
|
|
||||||
|
extern int noPanoramiXExtension;
|
||||||
|
|
||||||
|
-#define DEFAULT_CLIENT X11BINDIR "/xterm"
|
||||||
|
-#define DEFAULT_STARTX X11BINDIR "/startx -- " X11BINDIR "/Xquartz"
|
||||||
|
-#define DEFAULT_SHELL "/bin/sh"
|
||||||
|
-
|
||||||
|
-#ifndef BUILD_DATE
|
||||||
|
#define BUILD_DATE ""
|
||||||
|
-#endif
|
||||||
|
#ifndef XSERVER_VERSION
|
||||||
|
#define XSERVER_VERSION "?"
|
||||||
|
#endif
|
||||||
|
@@ -718,14 +712,14 @@ main(int argc, char **argv, char **envp)
|
||||||
|
pid_t child1, child2;
|
||||||
|
int status;
|
||||||
|
|
||||||
|
- pref_app_to_run = command_from_prefs("app_to_run", DEFAULT_CLIENT);
|
||||||
|
+ pref_app_to_run = command_from_prefs("app_to_run", getenv("XQUARTZ_DEFAULT_CLIENT"));
|
||||||
|
assert(pref_app_to_run);
|
||||||
|
|
||||||
|
- pref_login_shell = command_from_prefs("login_shell", DEFAULT_SHELL);
|
||||||
|
+ pref_login_shell = command_from_prefs("login_shell", getenv("XQUARTZ_DEFAULT_SHELL"));
|
||||||
|
assert(pref_login_shell);
|
||||||
|
|
||||||
|
pref_startx_script = command_from_prefs("startx_script",
|
||||||
|
- DEFAULT_STARTX);
|
||||||
|
+ getenv("XQUARTZ_DEFAULT_STARTX"));
|
||||||
|
assert(pref_startx_script);
|
||||||
|
|
||||||
|
/* Do the fork-twice trick to avoid having to reap zombies */
|
||||||
|
@@ -804,10 +798,12 @@ execute(const char *command)
|
||||||
|
static char *
|
||||||
|
command_from_prefs(const char *key, const char *default_value)
|
||||||
|
{
|
||||||
|
+ if (default_value == NULL)
|
||||||
|
+ return NULL;
|
||||||
|
+
|
||||||
|
char *command = NULL;
|
||||||
|
|
||||||
|
CFStringRef cfKey;
|
||||||
|
- CFPropertyListRef PlistRef;
|
||||||
|
|
||||||
|
if (!key)
|
||||||
|
return NULL;
|
||||||
|
@@ -817,40 +813,24 @@ command_from_prefs(const char *key, const char *default_value)
|
||||||
|
if (!cfKey)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
- PlistRef = CFPreferencesCopyAppValue(cfKey,
|
||||||
|
- kCFPreferencesCurrentApplication);
|
||||||
|
+ CFStringRef cfDefaultValue = CFStringCreateWithCString(
|
||||||
|
+ NULL, default_value, kCFStringEncodingASCII);
|
||||||
|
+ int len = strlen(default_value) + 1;
|
||||||
|
|
||||||
|
- if ((PlistRef == NULL) ||
|
||||||
|
- (CFGetTypeID(PlistRef) != CFStringGetTypeID())) {
|
||||||
|
- CFStringRef cfDefaultValue = CFStringCreateWithCString(
|
||||||
|
- NULL, default_value, kCFStringEncodingASCII);
|
||||||
|
- int len = strlen(default_value) + 1;
|
||||||
|
+ if (!cfDefaultValue)
|
||||||
|
+ goto command_from_prefs_out;
|
||||||
|
|
||||||
|
- if (!cfDefaultValue)
|
||||||
|
- goto command_from_prefs_out;
|
||||||
|
+ CFPreferencesSetAppValue(cfKey, cfDefaultValue,
|
||||||
|
+ kCFPreferencesCurrentApplication);
|
||||||
|
+ CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
|
||||||
|
+ CFRelease(cfDefaultValue);
|
||||||
|
|
||||||
|
- CFPreferencesSetAppValue(cfKey, cfDefaultValue,
|
||||||
|
- kCFPreferencesCurrentApplication);
|
||||||
|
- CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
|
||||||
|
- CFRelease(cfDefaultValue);
|
||||||
|
-
|
||||||
|
- command = (char *)malloc(len * sizeof(char));
|
||||||
|
- if (!command)
|
||||||
|
- goto command_from_prefs_out;
|
||||||
|
- strcpy(command, default_value);
|
||||||
|
- }
|
||||||
|
- else {
|
||||||
|
- int len = CFStringGetLength((CFStringRef)PlistRef) + 1;
|
||||||
|
- command = (char *)malloc(len * sizeof(char));
|
||||||
|
- if (!command)
|
||||||
|
- goto command_from_prefs_out;
|
||||||
|
- CFStringGetCString((CFStringRef)PlistRef, command, len,
|
||||||
|
- kCFStringEncodingASCII);
|
||||||
|
- }
|
||||||
|
+ command = (char *)malloc(len * sizeof(char));
|
||||||
|
+ if (!command)
|
||||||
|
+ goto command_from_prefs_out;
|
||||||
|
+ strcpy(command, default_value);
|
||||||
|
|
||||||
|
command_from_prefs_out:
|
||||||
|
- if (PlistRef)
|
||||||
|
- CFRelease(PlistRef);
|
||||||
|
if (cfKey)
|
||||||
|
CFRelease(cfKey);
|
||||||
|
return command;
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,46 @@
|
||||||
|
These are functions, not function pointers, so they always evaluate to true.
|
||||||
|
|
||||||
|
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m
|
||||||
|
index 5445c6f..8574bf1 100644
|
||||||
|
--- a/hw/xquartz/X11Controller.m
|
||||||
|
+++ b/hw/xquartz/X11Controller.m
|
||||||
|
@@ -364,7 +364,6 @@ extern char *bundle_id_prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
|
||||||
|
- if (asl_log_descriptor) {
|
||||||
|
char *asl_sender;
|
||||||
|
aslmsg amsg = asl_new(ASL_TYPE_MSG);
|
||||||
|
assert(amsg);
|
||||||
|
@@ -394,7 +393,6 @@ extern char *bundle_id_prefix;
|
||||||
|
asl_log_descriptor(aslc, amsg, ASL_LEVEL_NOTICE, stderr_pipe[0], ASL_LOG_DESCRIPTOR_READ);
|
||||||
|
|
||||||
|
asl_free(amsg);
|
||||||
|
- }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Do the fork-twice trick to avoid having to reap zombies */
|
||||||
|
@@ -414,11 +412,9 @@ extern char *bundle_id_prefix;
|
||||||
|
|
||||||
|
case 0: /* child2 */
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
|
||||||
|
- if (asl_log_descriptor) {
|
||||||
|
/* Replace our stdout/stderr */
|
||||||
|
dup2(stdout_pipe[1], STDOUT_FILENO);
|
||||||
|
dup2(stderr_pipe[1], STDERR_FILENO);
|
||||||
|
- }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* close all open files except for standard streams */
|
||||||
|
@@ -443,11 +439,9 @@ extern char *bundle_id_prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
|
||||||
|
- if (asl_log_descriptor) {
|
||||||
|
/* Close the write ends of the pipe */
|
||||||
|
close(stdout_pipe[1]);
|
||||||
|
close(stderr_pipe[1]);
|
||||||
|
- }
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
diff --git a/hw/xquartz/xpr/x-list.new.h b/hw/xquartz/xpr/x-list.h
|
||||||
|
index 28385fd..71f9d26 100644
|
||||||
|
--- a/hw/xquartz/xpr/x-list.new.h
|
||||||
|
+++ b/hw/xquartz/xpr/x-list.h
|
||||||
|
@@ -45,6 +45,7 @@ struct x_list_struct {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef X_EXTERN
|
||||||
|
+#define __private_extern__ extern
|
||||||
|
#define X_EXTERN __private_extern__
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
cstrahan:
|
||||||
|
|
||||||
|
When the X / Xquartz server initiallizes, it starts the XQuartz.app and
|
||||||
|
hands-off the display FD. To start the XQuartz.app, Xquartz normally uses some
|
||||||
|
system calls to get the path of the application by app bundle id, and then
|
||||||
|
executes the Contents/MacOS/X11 script contained inside, which in turn executes
|
||||||
|
Contents/MacOS/X11.bin (the actual app).
|
||||||
|
|
||||||
|
This patch replaces that discovery technique with a simple call to
|
||||||
|
`getenv'. In order to make Xquartz actually work, we'll need another wrapper
|
||||||
|
that sets the `XQUARTZ_X11' environment variable to point to the `X11' script.
|
||||||
|
|
||||||
|
diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c
|
||||||
|
index 756e4ef..3313a55 100644
|
||||||
|
--- a/hw/xquartz/mach-startup/stub.c
|
||||||
|
+++ b/hw/xquartz/mach-startup/stub.c
|
||||||
|
@@ -61,54 +61,16 @@ aslclient aslc;
|
||||||
|
static void
|
||||||
|
set_x11_path(void)
|
||||||
|
{
|
||||||
|
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
|
||||||
|
-
|
||||||
|
- CFURLRef appURL = NULL;
|
||||||
|
- OSStatus osstatus =
|
||||||
|
- LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(
|
||||||
|
- kX11AppBundleId), nil, nil, &appURL);
|
||||||
|
-
|
||||||
|
- switch (osstatus) {
|
||||||
|
- case noErr:
|
||||||
|
- if (appURL == NULL) {
|
||||||
|
- asl_log(
|
||||||
|
- aslc, NULL, ASL_LEVEL_ERR,
|
||||||
|
- "Xquartz: Invalid response from LSFindApplicationForInfo(%s)",
|
||||||
|
- kX11AppBundleId);
|
||||||
|
- exit(1);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (!CFURLGetFileSystemRepresentation(appURL, true,
|
||||||
|
- (unsigned char *)x11_path,
|
||||||
|
- sizeof(x11_path))) {
|
||||||
|
- asl_log(aslc, NULL, ASL_LEVEL_ERR,
|
||||||
|
- "Xquartz: Error resolving URL for %s",
|
||||||
|
- kX11AppBundleId);
|
||||||
|
- exit(3);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- strlcat(x11_path, kX11AppBundlePath, sizeof(x11_path));
|
||||||
|
- asl_log(aslc, NULL, ASL_LEVEL_INFO, "Xquartz: X11.app = %s", x11_path);
|
||||||
|
- break;
|
||||||
|
-
|
||||||
|
- case kLSApplicationNotFoundErr:
|
||||||
|
- asl_log(aslc, NULL, ASL_LEVEL_ERR,
|
||||||
|
- "Xquartz: Unable to find application for %s",
|
||||||
|
- kX11AppBundleId);
|
||||||
|
- exit(10);
|
||||||
|
-
|
||||||
|
- default:
|
||||||
|
- asl_log(aslc, NULL, ASL_LEVEL_ERR,
|
||||||
|
- "Xquartz: Unable to find application for %s, error code = %d",
|
||||||
|
- kX11AppBundleId,
|
||||||
|
- (int)osstatus);
|
||||||
|
- exit(11);
|
||||||
|
+ char *xquartzX11 = getenv("XQUARTZ_X11");
|
||||||
|
+ if (xquartzX11) {
|
||||||
|
+ strlcpy(x11_path, xquartzX11,
|
||||||
|
+ sizeof(x11_path));
|
||||||
|
+ } else {
|
||||||
|
+ asl_log(
|
||||||
|
+ aslc, NULL, ASL_LEVEL_ERR,
|
||||||
|
+ "Xquartz: XQUARTZ_X11 environment variable not set");
|
||||||
|
+ exit(1);
|
||||||
|
}
|
||||||
|
-#else
|
||||||
|
- /* TODO: Make Tiger smarter... but TBH, this should never get called on Tiger... */
|
||||||
|
- strlcpy(x11_path, "/Applications/Utilities/X11.app/Contents/MacOS/X11",
|
||||||
|
- sizeof(x11_path));
|
||||||
|
-#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
File diff suppressed because it is too large
Load Diff
|
@ -230,6 +230,11 @@ args: with args;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
|
mkDerivation = name: attrs:
|
||||||
|
let newAttrs = (overrides."\${name}" or (x: x)) attrs;
|
||||||
|
stdenv = newAttrs.stdenv or args.stdenv;
|
||||||
|
in stdenv.mkDerivation (removeAttrs newAttrs [ "stdenv" ]);
|
||||||
|
|
||||||
overrides = import ./overrides.nix {inherit args xorg;};
|
overrides = import ./overrides.nix {inherit args xorg;};
|
||||||
|
|
||||||
xorg = rec {
|
xorg = rec {
|
||||||
|
@ -261,7 +266,7 @@ foreach my $pkg (sort (keys %pkgURLs)) {
|
||||||
$extraAttrs = "" unless defined $extraAttrs;
|
$extraAttrs = "" unless defined $extraAttrs;
|
||||||
|
|
||||||
print OUT <<EOF
|
print OUT <<EOF
|
||||||
$pkg = (stdenv.mkDerivation ((if overrides ? $pkg then overrides.$pkg else x: x) {
|
$pkg = (mkDerivation "$pkg" {
|
||||||
name = "$pkgNames{$pkg}";
|
name = "$pkgNames{$pkg}";
|
||||||
builder = ./builder.sh;
|
builder = ./builder.sh;
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
|
@ -269,7 +274,7 @@ foreach my $pkg (sort (keys %pkgURLs)) {
|
||||||
sha256 = "$pkgHashes{$pkg}";
|
sha256 = "$pkgHashes{$pkg}";
|
||||||
};
|
};
|
||||||
buildInputs = [pkgconfig $inputs];$extraAttrs
|
buildInputs = [pkgconfig $inputs];$extraAttrs
|
||||||
})) // {inherit $inputs;};
|
}) // {inherit $inputs;};
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
{ args, xorg }:
|
{ args, xorg }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
inherit (args) stdenv;
|
||||||
|
inherit (stdenv) lib isDarwin;
|
||||||
|
inherit (lib) overrideDerivation;
|
||||||
|
|
||||||
setMalloc0ReturnsNullCrossCompiling = ''
|
setMalloc0ReturnsNullCrossCompiling = ''
|
||||||
if test -n "$crossConfig"; then
|
if test -n "$crossConfig"; then
|
||||||
configureFlags="$configureFlags --enable-malloc0returnsnull";
|
configureFlags="$configureFlags --enable-malloc0returnsnull";
|
||||||
|
@ -75,8 +79,13 @@ in
|
||||||
|
|
||||||
libXfont = attrs: attrs // {
|
libXfont = attrs: attrs // {
|
||||||
propagatedBuildInputs = [ args.freetype ]; # propagate link reqs. like bzip2
|
propagatedBuildInputs = [ args.freetype ]; # propagate link reqs. like bzip2
|
||||||
|
# prevents "misaligned_stack_error_entering_dyld_stub_binder"
|
||||||
|
configureFlags = lib.optionals isDarwin [
|
||||||
|
"CFLAGS=-O0"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
libXxf86vm = attrs: attrs // {
|
libXxf86vm = attrs: attrs // {
|
||||||
preConfigure = setMalloc0ReturnsNullCrossCompiling;
|
preConfigure = setMalloc0ReturnsNullCrossCompiling;
|
||||||
};
|
};
|
||||||
|
@ -219,20 +228,16 @@ in
|
||||||
# 2: I think pkgconfig/ is supposed to be in /lib/
|
# 2: I think pkgconfig/ is supposed to be in /lib/
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
ln -s share "$out/etc"
|
ln -s share "$out/etc"
|
||||||
mkdir "$out/lib" && ln -s ../share/pkgconfig "$out/lib/"
|
mkdir -p "$out/lib" && ln -s ../share/pkgconfig "$out/lib/"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
xorgserver = with xorg; attrs: attrs // {
|
xorgserver = with xorg; attrs: attrs //
|
||||||
configureFlags = [
|
(let
|
||||||
"--enable-xcsecurity" # enable SECURITY extension
|
version = (builtins.parseDrvName attrs.name).version;
|
||||||
"--with-default-font-path= " # there were only paths containing "${prefix}",
|
commonBuildInputs = attrs.buildInputs ++ [ xtrans ];
|
||||||
# and there are no fonts in this package anyway
|
commonPropagatedBuildInputs = [
|
||||||
];
|
args.zlib args.mesa args.dbus.libs
|
||||||
patches = [ ./xorgserver-xkbcomp-path.patch ];
|
|
||||||
buildInputs = attrs.buildInputs ++ [ xtrans ];
|
|
||||||
propagatedBuildInputs =
|
|
||||||
[ args.zlib args.udev args.mesa args.dbus.libs
|
|
||||||
xf86bigfontproto glproto xf86driproto
|
xf86bigfontproto glproto xf86driproto
|
||||||
compositeproto scrnsaverproto resourceproto
|
compositeproto scrnsaverproto resourceproto
|
||||||
xf86dgaproto
|
xf86dgaproto
|
||||||
|
@ -242,14 +247,86 @@ in
|
||||||
libpciaccess inputproto xextproto randrproto renderproto
|
libpciaccess inputproto xextproto randrproto renderproto
|
||||||
dri2proto kbproto xineramaproto resourceproto scrnsaverproto videoproto
|
dri2proto kbproto xineramaproto resourceproto scrnsaverproto videoproto
|
||||||
];
|
];
|
||||||
postInstall =
|
commonPatches = [ ./xorgserver-xkbcomp-path.patch ];
|
||||||
''
|
# XQuartz requires two compilations: the first to get X / XQuartz,
|
||||||
|
# and the second to get Xvfb, Xnest, etc.
|
||||||
|
darwinOtherX = overrideDerivation xorgserver (oldAttrs: {
|
||||||
|
stdenv = args.stdenv;
|
||||||
|
configureFlags = oldAttrs.configureFlags ++ [
|
||||||
|
"--disable-xquartz"
|
||||||
|
"--enable-xorg"
|
||||||
|
"--enable-xvfb"
|
||||||
|
"--enable-xnest"
|
||||||
|
"--enable-kdrive"
|
||||||
|
];
|
||||||
|
postInstall = ":"; # prevent infinite recursion
|
||||||
|
});
|
||||||
|
in
|
||||||
|
if (!isDarwin)
|
||||||
|
then {
|
||||||
|
buildInputs = commonBuildInputs;
|
||||||
|
propagatedBuildInputs = commonPropagatedBuildInputs ++ lib.optionals stdenv.isLinux [
|
||||||
|
args.udev
|
||||||
|
];
|
||||||
|
patches = commonPatches;
|
||||||
|
configureFlags = [
|
||||||
|
"--enable-xcsecurity" # enable SECURITY extension
|
||||||
|
"--with-default-font-path=" # there were only paths containing "${prefix}",
|
||||||
|
# and there are no fonts in this package anyway
|
||||||
|
];
|
||||||
|
postInstall = ''
|
||||||
rm -fr $out/share/X11/xkb/compiled
|
rm -fr $out/share/X11/xkb/compiled
|
||||||
ln -s /var/tmp $out/share/X11/xkb/compiled
|
ln -s /var/tmp $out/share/X11/xkb/compiled
|
||||||
'';
|
'';
|
||||||
passthru.version = (builtins.parseDrvName attrs.name).version; # needed by virtualbox guest additions
|
passthru.version = version; # needed by virtualbox guest additions
|
||||||
|
} else {
|
||||||
|
stdenv = args.clangStdenv;
|
||||||
|
name = "xorg-server-1.14.6";
|
||||||
|
src = args.fetchurl {
|
||||||
|
url = mirror://xorg/individual/xserver/xorg-server-1.14.6.tar.bz2;
|
||||||
|
sha256 = "0c57vp1z0p38dj5gfipkmlw6bvbz1mrr0sb3sbghdxxdyq4kzcz8";
|
||||||
};
|
};
|
||||||
|
buildInputs = commonBuildInputs;
|
||||||
|
propagatedBuildInputs = commonPropagatedBuildInputs ++ [
|
||||||
|
libAppleWM applewmproto
|
||||||
|
];
|
||||||
|
patches = commonPatches ++ [
|
||||||
|
./darwin/0001-XQuartz-Ensure-we-wait-for-the-server-thread-to-term.patch
|
||||||
|
./darwin/5000-sdksyms.sh-Use-CPPFLAGS-not-CFLAGS.patch
|
||||||
|
./darwin/5001-Workaround-the-GC-clipping-problem-in-miPaintWindow-.patch
|
||||||
|
./darwin/5002-fb-Revert-fb-changes-that-broke-XQuartz.patch
|
||||||
|
./darwin/5003-fb-Revert-fb-changes-that-broke-XQuartz.patch
|
||||||
|
./darwin/5004-Use-old-miTrapezoids-and-miTriangles-routines.patch
|
||||||
|
./darwin/private-extern.patch
|
||||||
|
./darwin/bundle_main.patch
|
||||||
|
./darwin/stub.patch
|
||||||
|
./darwin/function-pointer-test.patch
|
||||||
|
];
|
||||||
|
configureFlags = [
|
||||||
|
# note: --enable-xquartz is auto
|
||||||
|
"CPPFLAGS=-I${./darwin/dri}"
|
||||||
|
"--with-default-font-path="
|
||||||
|
"--with-apple-application-name=XQuartz"
|
||||||
|
"--with-apple-applications-dir=\${out}/Applications"
|
||||||
|
"--with-bundle-id-prefix=org.nixos.xquartz"
|
||||||
|
"--with-sha1=CommonCrypto"
|
||||||
|
];
|
||||||
|
preConfigure = ''
|
||||||
|
ensureDir $out/Applications
|
||||||
|
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -Wno-error"
|
||||||
|
'';
|
||||||
|
postInstall = ''
|
||||||
|
rm -fr $out/share/X11/xkb/compiled
|
||||||
|
ln -s /var/tmp $out/share/X11/xkb/compiled
|
||||||
|
|
||||||
|
cp -rT ${darwinOtherX}/bin $out/bin
|
||||||
|
rm -f $out/bin/X
|
||||||
|
ln -s Xquartz $out/bin/X
|
||||||
|
|
||||||
|
cp ${darwinOtherX}/share/man -rT $out/share/man
|
||||||
|
'' ;
|
||||||
|
passthru.version = version;
|
||||||
|
});
|
||||||
|
|
||||||
lndir = attrs: attrs // {
|
lndir = attrs: attrs // {
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
|
@ -272,7 +349,14 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
xinit = attrs: attrs // {
|
xinit = attrs: attrs // {
|
||||||
configureFlags = "--with-xserver=${xorg.xorgserver}/bin/X";
|
stdenv = if isDarwin then args.clangStdenv else stdenv;
|
||||||
|
configureFlags = [
|
||||||
|
"--with-xserver=${xorg.xorgserver}/bin/X"
|
||||||
|
] ++ lib.optionals isDarwin [
|
||||||
|
"--with-bundle-id-prefix=org.nixos.xquartz"
|
||||||
|
"--with-launchdaemons-dir=\${out}/LaunchDaemons"
|
||||||
|
"--with-launchagents-dir=\${out}/LaunchAgents"
|
||||||
|
];
|
||||||
propagatedBuildInputs = [ xorg.xauth ];
|
propagatedBuildInputs = [ xorg.xauth ];
|
||||||
prePatch = ''
|
prePatch = ''
|
||||||
sed -i 's|^defaultserverargs="|&-logfile \"$HOME/.xorg.log\"|p' startx.cpp
|
sed -i 's|^defaultserverargs="|&-logfile \"$HOME/.xorg.log\"|p' startx.cpp
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set "$(dirname "$0")"/X11.bin "${@}"
|
||||||
|
|
||||||
|
export XQUARTZ_DEFAULT_CLIENT="@DEFAULT_CLIENT@"
|
||||||
|
export XQUARTZ_DEFAULT_SHELL="@DEFAULT_SHELL@"
|
||||||
|
export XQUARTZ_DEFAULT_STARTX="@DEFAULT_STARTX@"
|
||||||
|
export FONTCONFIG_FILE="@FONTCONFIG_FILE@"
|
||||||
|
|
||||||
|
if [ -x ~/.x11run ]; then
|
||||||
|
exec ~/.x11run "${@}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $(basename "${SHELL}") in
|
||||||
|
bash) exec -l "${SHELL}" --login -c 'exec "${@}"' - "${@}" ;;
|
||||||
|
ksh|sh|zsh) exec -l "${SHELL}" -c 'exec "${@}"' - "${@}" ;;
|
||||||
|
csh|tcsh) exec -l "${SHELL}" -c 'exec $argv:q' "${@}" ;;
|
||||||
|
es|rc) exec -l "${SHELL}" -l -c 'exec $*' "${@}" ;;
|
||||||
|
*) exec "${@}" ;;
|
||||||
|
esac
|
|
@ -0,0 +1,187 @@
|
||||||
|
{ stdenv, lib, buildEnv, makeFontsConf, gnused, writeScript, xorg, bashInteractive, substituteAll, xterm, makeWrapper, ruby
|
||||||
|
, openssl, quartz-wm, fontconfig, xkeyboard_config, xlsfonts, xfontsel
|
||||||
|
, ttf_bitstream_vera, freefont_ttf, liberation_ttf
|
||||||
|
, shell ? "${bashInteractive}/bin/bash"
|
||||||
|
}:
|
||||||
|
|
||||||
|
# ------------
|
||||||
|
# Installation
|
||||||
|
# ------------
|
||||||
|
#
|
||||||
|
# First, assuming you've previously installed XQuartz from macosforge.com,
|
||||||
|
# unload and remove the existing launch agents:
|
||||||
|
#
|
||||||
|
# $ sudo launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
|
||||||
|
# $ sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist
|
||||||
|
# $ sudo rm /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
|
||||||
|
# $ sudo rm /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist
|
||||||
|
#
|
||||||
|
# (You will need to log out for the above changes to take effect.)
|
||||||
|
#
|
||||||
|
# Then install xquartz from nixpkgs:
|
||||||
|
#
|
||||||
|
# $ nix-env -i xquartz
|
||||||
|
# $ xquartz-install
|
||||||
|
#
|
||||||
|
# You'll also want to add the following to your shell's profile (after you
|
||||||
|
# source nix.sh, so $NIX_LINK points to your user profile):
|
||||||
|
#
|
||||||
|
# if [ "$(uname)" = "Darwin" -a -n "$NIX_LINK" -a -f $NIX_LINK/etc/X11/fonts.conf ]; then
|
||||||
|
# export FONTCONFIG_FILE=$NIX_LINK/etc/X11/fonts.conf
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# A note about dependencies:
|
||||||
|
# Xquartz wants to exec XQuartz.app, XQuartz.app wants to exec xstart, and
|
||||||
|
# xstart wants to exec Xquartz, so we must bundle all three to prevent a cycle.
|
||||||
|
# Coincidentally, this also makes it trivial to install launch agents/daemons
|
||||||
|
# that point into the user's profile.
|
||||||
|
|
||||||
|
let
|
||||||
|
shellEscape = x: "'${lib.replaceChars ["'"] [("'\\'" + "'")] x}'";
|
||||||
|
installer = writeScript "xquartz-install" ''
|
||||||
|
NIX_LINK=$HOME/.nix-profile
|
||||||
|
|
||||||
|
tmpdir=$(/usr/bin/mktemp -d $TMPDIR/xquartz-installer-XXXXXXXX)
|
||||||
|
agentName=org.nixos.xquartz.startx.plist
|
||||||
|
daemonName=org.nixos.xquartz.privileged_startx.plist
|
||||||
|
sed=${gnused}/bin/sed
|
||||||
|
|
||||||
|
cp ${./org.nixos.xquartz.startx.plist} $tmpdir/$agentName
|
||||||
|
$sed -i "s|@LAUNCHD_STARTX@|$NIX_LINK/etc/X11/xinit/launchd_startx|" $tmpdir/$agentName
|
||||||
|
$sed -i "s|@STARTX@|$NIX_LINK/bin/startx|" $tmpdir/$agentName
|
||||||
|
$sed -i "s|@XQUARTZ@|$NIX_LINK/bin/Xquartz|" $tmpdir/$agentName
|
||||||
|
|
||||||
|
cp ${./org.nixos.xquartz.privileged_startx.plist} $tmpdir/$daemonName
|
||||||
|
$sed -i "s|@PRIVILEGED_STARTX@|$NIX_LINK/lib/X11/xinit/privileged_startx|" $tmpdir/$daemonName
|
||||||
|
$sed -i "s|@PRIVILEGED_STARTX_D@|$NIX_LINK/lib/X11/xinit/privileged_startx.d|" $tmpdir/$daemonName
|
||||||
|
|
||||||
|
sudo cp $tmpdir/$agentName /Library/LaunchAgents/$agentName
|
||||||
|
sudo cp $tmpdir/$daemonName /Library/LaunchDaemons/$daemonName
|
||||||
|
sudo launchctl load -w /Library/LaunchAgents/$agentName
|
||||||
|
sudo launchctl load -w /Library/LaunchDaemons/$daemonName
|
||||||
|
'';
|
||||||
|
fontDirs = [
|
||||||
|
xorg.fontbhttf
|
||||||
|
xorg.fontbhlucidatypewriter100dpi
|
||||||
|
xorg.fontbhlucidatypewriter75dpi
|
||||||
|
ttf_bitstream_vera
|
||||||
|
freefont_ttf
|
||||||
|
liberation_ttf
|
||||||
|
xorg.fontbh100dpi
|
||||||
|
xorg.fontmiscmisc
|
||||||
|
xorg.fontcursormisc
|
||||||
|
];
|
||||||
|
fontsConf = makeFontsConf {
|
||||||
|
fontDirectories = fontDirs ++ [
|
||||||
|
"/Library/Fonts"
|
||||||
|
"~/Library/Fonts"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
fonts = import ./system-fonts.nix {
|
||||||
|
inherit stdenv xorg fontDirs;
|
||||||
|
};
|
||||||
|
# any X related programs expected to be available via $PATH
|
||||||
|
env = buildEnv {
|
||||||
|
name = "xquartz-env";
|
||||||
|
pathsToLink = [ "/bin" ];
|
||||||
|
paths = with xorg; [
|
||||||
|
# non-xorg
|
||||||
|
quartz-wm xterm fontconfig
|
||||||
|
# xorg
|
||||||
|
xlsfonts xfontsel
|
||||||
|
bdftopcf fontutil iceauth libXpm lndir luit makedepend mkfontdir
|
||||||
|
mkfontscale sessreg setxkbmap smproxy twm x11perf xauth xbacklight xclock
|
||||||
|
xcmsdb xcursorgen xdm xdpyinfo xdriinfo xev xeyes xfs xgamma xhost
|
||||||
|
xinput xkbcomp xkbevd xkbutils xkill xlsatoms xlsclients xmessage xmodmap
|
||||||
|
xpr xprop xrandr xrdb xrefresh xset xsetroot xvinfo xwd xwininfo xwud
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in stdenv.mkDerivation {
|
||||||
|
name = "xquartz";
|
||||||
|
buildInputs = [ ruby makeWrapper ];
|
||||||
|
unpackPhase = "sourceRoot=.";
|
||||||
|
buildPhase = ":";
|
||||||
|
installPhase = ''
|
||||||
|
cp -rT ${xorg.xinit} $out
|
||||||
|
chmod -R u+w $out
|
||||||
|
cp -rT ${xorg.xorgserver} $out
|
||||||
|
chmod -R u+w $out
|
||||||
|
|
||||||
|
cp ${installer} $out/bin/xquartz-install
|
||||||
|
|
||||||
|
rm -r $out/LaunchAgents
|
||||||
|
|
||||||
|
fontsConfPath=$out/etc/X11/fonts.conf
|
||||||
|
cp ${fontsConf} $fontsConfPath
|
||||||
|
|
||||||
|
cp ${./startx} $out/bin/startx
|
||||||
|
substituteInPlace $out/bin/startx \
|
||||||
|
--replace "@PATH@" "$out/bin:${env}" \
|
||||||
|
--replace "@XAUTH@" "${xorg.xauth}/bin/xauth" \
|
||||||
|
--replace "@FONT_CACHE@" "$out/bin/font_cache" \
|
||||||
|
--replace "@PRIVILEGED_STARTX@" "$out/lib/X11/xinit/privileged_startx" \
|
||||||
|
--replace "@DEFAULT_SERVER@" "$out/bin/Xquartz" \
|
||||||
|
--replace "@DEFAULT_CLIENT@" "${xterm}/bin/xterm" \
|
||||||
|
--replace "@XINIT@" "$out/bin/xinit" \
|
||||||
|
--replace "@XINITRC@" "$out/etc/X11/xinit/xinitrc" \
|
||||||
|
--replace "@XKEYBOARD_CONFIG@" "${xkeyboard_config}/etc/X11/xkb" \
|
||||||
|
--replace "@FONTCONFIG_FILE@" "$fontsConfPath"
|
||||||
|
|
||||||
|
wrapProgram $out/bin/Xquartz \
|
||||||
|
--set XQUARTZ_X11 $out/Applications/XQuartz.app/Contents/MacOS/X11 \
|
||||||
|
--set XKB_BINDIR "${xorg.xkbcomp}/bin"
|
||||||
|
|
||||||
|
defaultStartX="$out/bin/startx -- $out/bin/Xquartz"
|
||||||
|
|
||||||
|
ruby ${./patch_plist.rb} \
|
||||||
|
${shellEscape (builtins.toXML {
|
||||||
|
XQUARTZ_DEFAULT_CLIENT = "${xterm}/bin/xterm";
|
||||||
|
XQUARTZ_DEFAULT_SHELL = "${shell}";
|
||||||
|
XQUARTZ_DEFAULT_STARTX = "@STARTX@";
|
||||||
|
FONTCONFIG_FILE = "@FONTCONFIG_FILE@";
|
||||||
|
XKB_BINDIR = "${xorg.xkbcomp}/bin";
|
||||||
|
})} \
|
||||||
|
$out/Applications/XQuartz.app/Contents/Info.plist
|
||||||
|
substituteInPlace $out/Applications/XQuartz.app/Contents/Info.plist \
|
||||||
|
--replace "@STARTX@" "$defaultStartX" \
|
||||||
|
--replace "@FONTCONFIG_FILE@" "$fontsConfPath"
|
||||||
|
|
||||||
|
rm $out/lib/X11/xinit/privileged_startx.d/*
|
||||||
|
cp ${./privileged} $out/lib/X11/xinit/privileged_startx.d/privileged
|
||||||
|
substituteInPlace $out/lib/X11/xinit/privileged_startx.d/privileged \
|
||||||
|
--replace "@PATH@" "$out/bin:${env}" \
|
||||||
|
--replace "@FONTCONFIG_FILE@" "$fontsConfPath" \
|
||||||
|
--replace "@FONT_CACHE@" "$out/bin/font_cache"
|
||||||
|
|
||||||
|
cp ${./font_cache} $out/bin/font_cache
|
||||||
|
substituteInPlace $out/bin/font_cache \
|
||||||
|
--replace "@PATH@" "$out/bin:${env}" \
|
||||||
|
--replace "@ENCODINGSDIR@" "${xorg.encodings}/share/fonts/X11/encodings" \
|
||||||
|
--replace "@MKFONTDIR@" "${xorg.mkfontdir}/bin/mkfontdir" \
|
||||||
|
--replace "@MKFONTSCALE@" "${xorg.mkfontscale}/bin/mkfontscale" \
|
||||||
|
--replace "@FC_CACHE@" "${fontconfig}/bin/fc-cache" \
|
||||||
|
--replace "@FONTCONFIG_FILE@" "$fontsConfPath"
|
||||||
|
|
||||||
|
cp ${./xinitrc} $out/etc/X11/xinit/xinitrc
|
||||||
|
substituteInPlace $out/etc/X11/xinit/xinitrc \
|
||||||
|
--replace "@PATH@" "$out/bin:${env}" \
|
||||||
|
--replace "@XSET@" "${xorg.xset}/bin/xset" \
|
||||||
|
--replace "@XMODMAP@" "${xorg.xmodmap}/bin/xmodmap" \
|
||||||
|
--replace "@XRDB@" "${xorg.xrdb}/bin/xrdb" \
|
||||||
|
--replace "@SYSTEM_FONTS@" "${fonts}/share/X11-fonts/" \
|
||||||
|
--replace "@QUARTZ_WM@" "${quartz-wm}/bin/quartz-wm" \
|
||||||
|
--replace "@FONTCONFIG_FILE@" "$fontsConfPath"
|
||||||
|
|
||||||
|
cp ${./X11} $out/Applications/XQuartz.app/Contents/MacOS/X11
|
||||||
|
substituteInPlace $out/Applications/XQuartz.app/Contents/MacOS/X11 \
|
||||||
|
--replace "@DEFAULT_SHELL@" "${shell}" \
|
||||||
|
--replace "@DEFAULT_STARTX@" "$defaultStartX" \
|
||||||
|
--replace "@DEFAULT_CLIENT@" "${xterm}/bin/xterm" \
|
||||||
|
--replace "@FONTCONFIG_FILE@" "$fontsConfPath"
|
||||||
|
'';
|
||||||
|
meta = with lib; {
|
||||||
|
platforms = platforms.darwin;
|
||||||
|
maintainers = with maintainers; [ cstrahan ];
|
||||||
|
license = licenses.mit;
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,240 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
export PATH=@PATH@:$PATH
|
||||||
|
|
||||||
|
export FONTCONFIG_FILE="@FONTCONFIG_FILE@"
|
||||||
|
ENCODINGSDIR="@ENCODINGSDIR@"
|
||||||
|
FC_LOCKFILE=""
|
||||||
|
|
||||||
|
# Are we caching system fonts or user fonts?
|
||||||
|
system=0
|
||||||
|
|
||||||
|
# Are we including OSX font dirs ({/,~/,/System/}Library/Fonts)
|
||||||
|
osxfonts=1
|
||||||
|
|
||||||
|
# Do we want to force a recache?
|
||||||
|
force=0
|
||||||
|
|
||||||
|
# How noisy are we?
|
||||||
|
verbose=0
|
||||||
|
|
||||||
|
# Check if the data in the given directory is newer than its cache
|
||||||
|
check_dirty() {
|
||||||
|
local dir=$1
|
||||||
|
local fontfiles=""
|
||||||
|
local retval=1
|
||||||
|
|
||||||
|
# If the dir does not exist, we just exit
|
||||||
|
if [[ ! -d "${dir}" ]]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create a list of all files in the dir
|
||||||
|
# Filter out config / cache files. Ugly... counting down the day until
|
||||||
|
# xfs finally goes away
|
||||||
|
fontfiles="$(find ${dir}/ -maxdepth 1 -type f | awk '$0 !~ /fonts\..*$|^.*\.dir$/ {print}')"
|
||||||
|
|
||||||
|
# Fonts were deleted (or never there). Kill off the caches
|
||||||
|
if [[ -z "${fontfiles}" ]] ; then
|
||||||
|
local f
|
||||||
|
for f in "${dir}"/fonts.* "${dir}"/encodings.dir; do
|
||||||
|
if [[ -f ${f} ]] ; then
|
||||||
|
rm -f "${f}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Force a recache
|
||||||
|
if [[ ${force} == 1 ]] ; then
|
||||||
|
retval=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If we don't have our caches, we are dirty
|
||||||
|
if [[ ! -f "${dir}/fonts.list" || ! -f "${dir}/fonts.dir" || ! -f "${dir}/encodings.dir" ]]; then
|
||||||
|
retval=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check that no files were added or removed....
|
||||||
|
if [[ "${retval}" -ne 0 && "$(cat ${dir}/fonts.list)" != "${fontfiles}" ]] ; then
|
||||||
|
retval=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check that no files were updated....
|
||||||
|
if [[ "${retval}" -ne 0 ]] ; then
|
||||||
|
local changed="$(find ${dir}/ -type f -cnewer ${dir}/fonts.dir | awk '$0 !~ /fonts\..*$|^.*\.dir$/ {print}')"
|
||||||
|
|
||||||
|
if [[ -n "${changed}" ]] ; then
|
||||||
|
retval=0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Recreate fonts.list since something changed
|
||||||
|
if [[ "${retval}" == 0 ]] ; then
|
||||||
|
echo "${fontfiles}" > "${dir}"/fonts.list
|
||||||
|
fi
|
||||||
|
|
||||||
|
return ${retval}
|
||||||
|
}
|
||||||
|
|
||||||
|
get_fontdirs() {
|
||||||
|
local d
|
||||||
|
if [[ $system == 1 ]] ; then
|
||||||
|
if [[ $osxfonts == 1 ]] ; then
|
||||||
|
find {/System/,/}Library/Fonts -type d
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [[ $osxfonts == 1 && -d "${HOME}/Library/Fonts" ]] ; then
|
||||||
|
find "${HOME}/Library/Fonts" -type d
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -d "${HOME}/.fonts" ]] ; then
|
||||||
|
find "${HOME}/.fonts" -type d
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
setup_fontdirs() {
|
||||||
|
local x=""
|
||||||
|
local fontdirs=""
|
||||||
|
local changed="no"
|
||||||
|
|
||||||
|
umask 022
|
||||||
|
|
||||||
|
if [[ $system == 1 ]] ; then
|
||||||
|
echo "font_cache: Scanning system font directories to generate X11 font caches"
|
||||||
|
else
|
||||||
|
echo "font_cache: Scanning user font directories to generate X11 font caches"
|
||||||
|
fi
|
||||||
|
|
||||||
|
OIFS=$IFS
|
||||||
|
IFS='
|
||||||
|
'
|
||||||
|
for x in $(get_fontdirs) ; do
|
||||||
|
if [[ -d "${x}" ]] && check_dirty "${x}" ; then
|
||||||
|
if [[ -z "${fontdirs}" ]] ; then
|
||||||
|
fontdirs="${x}"
|
||||||
|
else
|
||||||
|
fontdirs="${fontdirs}${IFS}${x}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -n "${fontdirs}" ]] ; then
|
||||||
|
echo "font_cache: Making fonts.dir for updated directories."
|
||||||
|
for x in ${fontdirs} ; do
|
||||||
|
if [[ $verbose == 1 ]] ; then
|
||||||
|
echo "font_cache: ${x}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# First, generate fonts.scale for scaleable fonts that might be there
|
||||||
|
@MKFONTSCALE@ \
|
||||||
|
-a $ENCODINGSDIR/encodings.dir \
|
||||||
|
-a $ENCODINGSDIR/large/encodings.dir \
|
||||||
|
-- ${x}
|
||||||
|
|
||||||
|
# Next, generate fonts.dir
|
||||||
|
if [[ $verbose == 1 ]] ; then
|
||||||
|
@MKFONTDIR@ \
|
||||||
|
-e $ENCODINGSDIR \
|
||||||
|
-e $ENCODINGSDIR/large \
|
||||||
|
-- ${x}
|
||||||
|
else
|
||||||
|
@MKFONTDIR@ \
|
||||||
|
-e $ENCODINGSDIR \
|
||||||
|
-e $ENCODINGSDIR/large \
|
||||||
|
-- ${x} > /dev/null
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
IFS=$OIFS
|
||||||
|
|
||||||
|
# Finally, update fontconfig's cache
|
||||||
|
echo "font_cache: Updating FC cache"
|
||||||
|
if [[ $system == 1 ]] ; then
|
||||||
|
@FC_CACHE@ -s \
|
||||||
|
$([[ $force == 1 ]] && echo "-f -r") \
|
||||||
|
$([[ $verbose == 1 ]] && echo "-v")
|
||||||
|
else
|
||||||
|
@FC_CACHE@ \
|
||||||
|
$([[ $force == 1 ]] && echo "-f -r") \
|
||||||
|
$([[ $verbose == 1 ]] && echo "-v")
|
||||||
|
fi
|
||||||
|
echo "font_cache: Done"
|
||||||
|
}
|
||||||
|
|
||||||
|
do_usage() {
|
||||||
|
echo "font_cache [options]"
|
||||||
|
echo " -f, --force : Force cache recreation"
|
||||||
|
echo " -n, --no-osxfonts : Just cache X11 font directories"
|
||||||
|
echo " (-n just pertains to XFont cache, not fontconfig)"
|
||||||
|
echo " -s, --system : Cache system font dirs instead of user dirs"
|
||||||
|
echo " -v, --verbose : Verbose Output"
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
[[ -r "${FC_LOCKFILE}" ]] && rm -f "${FC_LOCKFILE}"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
while [[ $# -gt 0 ]] ; do
|
||||||
|
case $1 in
|
||||||
|
-s|--system) system=1 ;;
|
||||||
|
-f|--force) force=1 ;;
|
||||||
|
-v|--verbose) verbose=1 ;;
|
||||||
|
-n|--no-osxfonts) osxfonts=0 ;;
|
||||||
|
--help) do_usage ; exit 0 ;;
|
||||||
|
*) do_usage ; exit 1 ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ $system == 1 ]] ; then
|
||||||
|
FC_LOCKFILE="/tmp/font_cache.$UID.lock"
|
||||||
|
elif [[ -w "${TMPDIR}" ]] ; then
|
||||||
|
FC_LOCKFILE="${TMPDIR}/font_cache.lock"
|
||||||
|
elif [[ -w "/tmp" ]] ; then
|
||||||
|
FC_LOCKFILE="/tmp/font_cache.$UID.lock"
|
||||||
|
else
|
||||||
|
FC_LOCKFILE="${HOME}/.font_cache.lock"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -x /usr/bin/lockfile ]] ; then
|
||||||
|
if /usr/bin/lockfile -r 0 -l 240 -s 4 -! "${FC_LOCKFILE}" ; then
|
||||||
|
echo "font_cache is already running." >&2
|
||||||
|
echo "If you believe this to be erroneous, please remove ${FC_LOCKFILE}." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [[ -r "${FC_LOCKFILE}" ]] ; then
|
||||||
|
read OLD_PID < "${FC_LOCKFILE}"
|
||||||
|
if kill -0 ${OLD_PID} >& /dev/null ; then
|
||||||
|
echo "font_cache is already running with PID ${OLD_PID}." >&2
|
||||||
|
echo "If you believe this to be erroneous, please remove ${FC_LOCKFILE}." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Removing stale ${FC_LOCKFILE}" >&2
|
||||||
|
rm -f "${FC_LOCKFILE}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $$ > "${FC_LOCKFILE}"
|
||||||
|
|
||||||
|
if [[ ! -r "${FC_LOCKFILE}" ]] ; then
|
||||||
|
echo "Unable to write to ${FC_LOCKFILE}." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Now make sure we didn't collide mid-air
|
||||||
|
read OLD_PID < "${FC_LOCKFILE}"
|
||||||
|
if [[ $$ != ${OLD_PID} ]] ; then
|
||||||
|
echo "font_cache is already running with PID ${OLD_PID}." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
trap cleanup SIGINT SIGQUIT SIGABRT SIGTERM
|
||||||
|
|
||||||
|
setup_fontdirs
|
||||||
|
|
||||||
|
rm -f "${FC_LOCKFILE}"
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>Label</key>
|
||||||
|
<string>org.nixos.xquartz.privileged_startx</string>
|
||||||
|
<key>ProgramArguments</key>
|
||||||
|
<array>
|
||||||
|
<string>@PRIVILEGED_STARTX@</string>
|
||||||
|
<string>-d</string>
|
||||||
|
<string>@PRIVILEGED_STARTX_D@</string>
|
||||||
|
</array>
|
||||||
|
<key>MachServices</key>
|
||||||
|
<dict>
|
||||||
|
<key>org.nixos.xquartz.privileged_startx</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
<key>TimeOut</key>
|
||||||
|
<integer>120</integer>
|
||||||
|
<key>EnableTransactions</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>Label</key>
|
||||||
|
<string>org.nixos.xquartz.startx</string>
|
||||||
|
<key>ProgramArguments</key>
|
||||||
|
<array>
|
||||||
|
<string>@LAUNCHD_STARTX@</string>
|
||||||
|
<string>@STARTX@</string>
|
||||||
|
<string>--</string>
|
||||||
|
<string>@XQUARTZ@</string>
|
||||||
|
</array>
|
||||||
|
<key>Sockets</key>
|
||||||
|
<dict>
|
||||||
|
<key>org.nixos.xquartz:0</key>
|
||||||
|
<dict>
|
||||||
|
<key>SecureSocketWithKey</key>
|
||||||
|
<string>DISPLAY</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<key>ServiceIPC</key>
|
||||||
|
<true/>
|
||||||
|
<key>EnableTransactions</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
|
@ -0,0 +1,47 @@
|
||||||
|
require 'rexml/document'
|
||||||
|
|
||||||
|
# This script is for setting environment variables in OSX applications.
|
||||||
|
#
|
||||||
|
# This script takes two arguments:
|
||||||
|
# 1) A Nix attrset serialized via `builtins.toXML'
|
||||||
|
# 2) The path to an OSX app's Info.plist file.
|
||||||
|
|
||||||
|
def main(serialized_attrs, plist_path)
|
||||||
|
env = attrs_to_hash(serialized_attrs)
|
||||||
|
doc = REXML::Document.new(File.open(plist_path, &:read))
|
||||||
|
topmost_dict = doc.root.elements.detect { |e| e.name == "dict" }
|
||||||
|
topmost_dict.add_element("key").tap do |key|
|
||||||
|
key.text = "LSEnvironment"
|
||||||
|
end
|
||||||
|
topmost_dict.add_element(env_to_dict(env))
|
||||||
|
|
||||||
|
formatter = REXML::Formatters::Pretty.new(2)
|
||||||
|
formatter.compact = true
|
||||||
|
formatter.write(doc, File.open(plist_path, "w"))
|
||||||
|
end
|
||||||
|
|
||||||
|
# Convert a `builtins.toXML' serialized attrs to a hash.
|
||||||
|
# This assumes the values are strings.
|
||||||
|
def attrs_to_hash(serialized_attrs)
|
||||||
|
hash = {}
|
||||||
|
env_vars = REXML::Document.new(serialized_attrs)
|
||||||
|
env_vars.root.elements[1].elements.each do |attr|
|
||||||
|
name = attr.attribute("name")
|
||||||
|
value = attr.elements.first.attribute("value")
|
||||||
|
hash[name] = value
|
||||||
|
end
|
||||||
|
hash
|
||||||
|
end
|
||||||
|
|
||||||
|
def env_to_dict(env)
|
||||||
|
dict = REXML::Element.new("dict")
|
||||||
|
env.each do |k, v|
|
||||||
|
key = dict.add_element("key")
|
||||||
|
key.text = k
|
||||||
|
string = dict.add_element("string")
|
||||||
|
string.text = v
|
||||||
|
end
|
||||||
|
dict
|
||||||
|
end
|
||||||
|
|
||||||
|
main(ARGV[0], ARGV[1])
|
|
@ -0,0 +1,43 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
export PATH=@PATH@:$PATH
|
||||||
|
export FONTCONFIG_FILE="@FONTCONFIG_FILE@"
|
||||||
|
|
||||||
|
# Our usage of mktemp fails with GNU, so prefer /usr/bin to hopefully
|
||||||
|
# get BSD mktemp
|
||||||
|
if [ -x /usr/bin/mktemp ] ; then
|
||||||
|
MKTEMP=/usr/bin/mktemp
|
||||||
|
else
|
||||||
|
MKTEMP=mktemp
|
||||||
|
fi
|
||||||
|
|
||||||
|
STAT=/usr/bin/stat
|
||||||
|
|
||||||
|
for dir in /tmp/.ICE-unix /tmp/.X11-unix /tmp/.font-unix ; do
|
||||||
|
success=0
|
||||||
|
for attempt in 1 2 3 4 5 ; do
|
||||||
|
check=`${STAT} -f '%#p %u %g' ${dir} 2> /dev/null`
|
||||||
|
if [ "${check}" = "041777 0 0" ] ; then
|
||||||
|
success=1
|
||||||
|
break
|
||||||
|
elif [ -n "${check}" ] ; then
|
||||||
|
saved=$(${MKTEMP} -d ${dir}-XXXXXXXX)
|
||||||
|
mv ${dir} ${saved}
|
||||||
|
echo "${dir} exists but is insecure. It has been moved into ${saved}" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if $dir exists and is a symlink (ie protect against a race)
|
||||||
|
if ${MKTEMP} -d ${dir} >& /dev/null ; then
|
||||||
|
chmod 1777 $dir
|
||||||
|
chown root:wheel $dir
|
||||||
|
success=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "${success}" -eq 0 ] ; then
|
||||||
|
echo "Could not successfully create ${dir}" >&2
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
@FONT_CACHE@ -s &
|
|
@ -0,0 +1,232 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# vim :set ts=4 sw=4 sts=4 et :
|
||||||
|
|
||||||
|
#
|
||||||
|
# This is just a sample implementation of a slightly less primitive
|
||||||
|
# interface than xinit. It looks for user .xinitrc and .xserverrc
|
||||||
|
# files, then system xinitrc and xserverrc files, else lets xinit choose
|
||||||
|
# its default. The system xinitrc should probably do things like check
|
||||||
|
# for .Xresources files and merge them in, start up a window manager,
|
||||||
|
# and pop a clock and several xterms.
|
||||||
|
#
|
||||||
|
# Site administrators are STRONGLY urged to write nicer versions.
|
||||||
|
#
|
||||||
|
|
||||||
|
unset DBUS_SESSION_BUS_ADDRESS
|
||||||
|
unset SESSION_MANAGER
|
||||||
|
|
||||||
|
|
||||||
|
# Bourne shell does not automatically export modified environment variables
|
||||||
|
# so export the new PATH just in case the user changes the shell
|
||||||
|
export PATH=@PATH@:$PATH
|
||||||
|
|
||||||
|
export FONTCONFIG_FILE="@FONTCONFIG_FILE@"
|
||||||
|
|
||||||
|
userclientrc=$HOME/.xinitrc
|
||||||
|
sysclientrc=@XINITRC@
|
||||||
|
|
||||||
|
userserverrc=$HOME/.xserverrc
|
||||||
|
sysserverrc=@XINITRC@
|
||||||
|
defaultclient=@DEFAULT_CLIENT@ # xterm
|
||||||
|
defaultserver=@DEFAULT_SERVER@
|
||||||
|
defaultclientargs=""
|
||||||
|
defaultserverargs=""
|
||||||
|
defaultdisplay=":0"
|
||||||
|
clientargs=""
|
||||||
|
serverargs=""
|
||||||
|
|
||||||
|
export X11_PREFS_DOMAIN=org.nixos.xquartz".X11"
|
||||||
|
|
||||||
|
# Initialize defaults (this will cut down on "safe" error messages)
|
||||||
|
if ! /usr/bin/defaults read $X11_PREFS_DOMAIN cache_fonts > /dev/null 2>&1 ; then
|
||||||
|
/usr/bin/defaults write $X11_PREFS_DOMAIN cache_fonts -bool true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! /usr/bin/defaults read $X11_PREFS_DOMAIN no_auth > /dev/null 2>&1 ; then
|
||||||
|
/usr/bin/defaults write $X11_PREFS_DOMAIN no_auth -bool false
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! /usr/bin/defaults read $X11_PREFS_DOMAIN nolisten_tcp > /dev/null 2>&1 ; then
|
||||||
|
/usr/bin/defaults write $X11_PREFS_DOMAIN nolisten_tcp -bool true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# First, start caching fonts
|
||||||
|
if [ x`/usr/bin/defaults read $X11_PREFS_DOMAIN cache_fonts` = x1 ] ; then
|
||||||
|
@FONT_CACHE@ &
|
||||||
|
fi
|
||||||
|
|
||||||
|
# a race to create /tmp/.X11-unix
|
||||||
|
@PRIVILEGED_STARTX@
|
||||||
|
|
||||||
|
if [ x`/usr/bin/defaults read $X11_PREFS_DOMAIN no_auth` = x0 ] ; then
|
||||||
|
enable_xauth=1
|
||||||
|
else
|
||||||
|
enable_xauth=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x`defaults read $X11_PREFS_DOMAIN nolisten_tcp` = x1 ] ; then
|
||||||
|
defaultserverargs="$defaultserverargs -nolisten tcp"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# The second check is the real one. The first is to hopefully avoid
|
||||||
|
# needless syslog spamming.
|
||||||
|
if /usr/bin/defaults read $X11_PREFS_DOMAIN 2> /dev/null | grep -q 'dpi' && /usr/bin/defaults read $X11_PREFS_DOMAIN dpi > /dev/null 2>&1 ; then
|
||||||
|
defaultserverargs="$defaultserverargs -dpi `/usr/bin/defaults read $X11_PREFS_DOMAIN dpi`"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Automatically determine an unused $DISPLAY
|
||||||
|
d=0
|
||||||
|
while true ; do
|
||||||
|
[ -e /tmp/.X$d-lock ] || break
|
||||||
|
d=$(($d + 1))
|
||||||
|
done
|
||||||
|
defaultdisplay=":$d"
|
||||||
|
unset d
|
||||||
|
|
||||||
|
whoseargs="client"
|
||||||
|
while [ x"$1" != x ]; do
|
||||||
|
case "$1" in
|
||||||
|
# '' required to prevent cpp from treating "/*" as a C comment.
|
||||||
|
/''*|\./''*)
|
||||||
|
if [ "$whoseargs" = "client" ]; then
|
||||||
|
if [ x"$client" = x ] && [ x"$clientargs" = x ]; then
|
||||||
|
client="$1"
|
||||||
|
else
|
||||||
|
clientargs="$clientargs $1"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ x"$server" = x ] && [ x"$serverargs" = x ]; then
|
||||||
|
server="$1"
|
||||||
|
else
|
||||||
|
serverargs="$serverargs $1"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
whoseargs="server"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ "$whoseargs" = "client" ]; then
|
||||||
|
clientargs="$clientargs $1"
|
||||||
|
else
|
||||||
|
# display must be the FIRST server argument
|
||||||
|
if [ x"$serverargs" = x ] && \
|
||||||
|
expr "$1" : ':[0-9][0-9]*$' > /dev/null 2>&1; then
|
||||||
|
display="$1"
|
||||||
|
else
|
||||||
|
serverargs="$serverargs $1"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
# process client arguments
|
||||||
|
if [ x"$client" = x ]; then
|
||||||
|
client=$defaultclient
|
||||||
|
|
||||||
|
# For compatibility reasons, only use startxrc if there were no client command line arguments
|
||||||
|
if [ x"$clientargs" = x ]; then
|
||||||
|
if [ -f "$userclientrc" ]; then
|
||||||
|
client=$userclientrc
|
||||||
|
elif [ -f "$sysclientrc" ]; then
|
||||||
|
client=$sysclientrc
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if no client arguments, use defaults
|
||||||
|
if [ x"$clientargs" = x ]; then
|
||||||
|
clientargs=$defaultclientargs
|
||||||
|
fi
|
||||||
|
|
||||||
|
# process server arguments
|
||||||
|
if [ x"$server" = x ]; then
|
||||||
|
server=$defaultserver
|
||||||
|
|
||||||
|
# For compatibility reasons, only use xserverrc if there were no server command line arguments
|
||||||
|
if [ x"$serverargs" = x -a x"$display" = x ]; then
|
||||||
|
if [ -f "$userserverrc" ]; then
|
||||||
|
server=$userserverrc
|
||||||
|
elif [ -f "$sysserverrc" ]; then
|
||||||
|
server=$sysserverrc
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if no server arguments, use defaults
|
||||||
|
if [ x"$serverargs" = x ]; then
|
||||||
|
serverargs=$defaultserverargs
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if no display, use default
|
||||||
|
if [ x"$display" = x ]; then
|
||||||
|
display=$defaultdisplay
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ x"$enable_xauth" = x1 ] ; then
|
||||||
|
if [ x"$XAUTHORITY" = x ]; then
|
||||||
|
XAUTHORITY=$HOME/.Xauthority
|
||||||
|
export XAUTHORITY
|
||||||
|
fi
|
||||||
|
|
||||||
|
removelist=
|
||||||
|
|
||||||
|
# set up default Xauth info for this machine
|
||||||
|
hostname=`/bin/hostname`
|
||||||
|
|
||||||
|
authdisplay=${display:-:0}
|
||||||
|
|
||||||
|
mcookie=`/usr/bin/openssl rand -hex 16`
|
||||||
|
|
||||||
|
if test x"$mcookie" = x; then
|
||||||
|
echo "Couldn't create cookie"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
dummy=0
|
||||||
|
|
||||||
|
# create a file with auth information for the server. ':0' is a dummy.
|
||||||
|
xserverauthfile=$HOME/.serverauth.$$
|
||||||
|
trap "rm -f '$xserverauthfile'" HUP INT QUIT ILL TRAP KILL BUS TERM
|
||||||
|
@XAUTH@ -q -f "$xserverauthfile" << EOF
|
||||||
|
add :$dummy . $mcookie
|
||||||
|
EOF
|
||||||
|
|
||||||
|
xserverauthfilequoted=$(echo ${xserverauthfile} | sed "s/'/'\\\\''/g")
|
||||||
|
serverargs=${serverargs}" -auth '"${xserverauthfilequoted}"'"
|
||||||
|
|
||||||
|
# now add the same credentials to the client authority file
|
||||||
|
# if '$displayname' already exists do not overwrite it as another
|
||||||
|
# server man need it. Add them to the '$xserverauthfile' instead.
|
||||||
|
for displayname in $authdisplay $hostname$authdisplay; do
|
||||||
|
authcookie=`@XAUTH@ list "$displayname" \
|
||||||
|
| sed -n "s/.*$displayname[[:space:]*].*[[:space:]*]//p"` 2>/dev/null;
|
||||||
|
if [ "z${authcookie}" = "z" ] ; then
|
||||||
|
@XAUTH@ -q << EOF
|
||||||
|
add $displayname . $mcookie
|
||||||
|
EOF
|
||||||
|
removelist="$displayname $removelist"
|
||||||
|
else
|
||||||
|
dummy=$(($dummy+1));
|
||||||
|
@XAUTH@ -q -f "$xserverauthfile" << EOF
|
||||||
|
add :$dummy . $authcookie
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval @XINIT@ \"$client\" $clientargs -- \"$server\" $display $serverargs "-xkbdir" "@XKEYBOARD_CONFIG@"
|
||||||
|
retval=$?
|
||||||
|
|
||||||
|
if [ x"$enable_xauth" = x1 ] ; then
|
||||||
|
if [ x"$removelist" != x ]; then
|
||||||
|
@XAUTH@ remove $removelist
|
||||||
|
fi
|
||||||
|
if [ x"$xserverauthfile" != x ]; then
|
||||||
|
rm -f "$xserverauthfile"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit $retval
|
|
@ -0,0 +1,36 @@
|
||||||
|
{ stdenv, xorg, fontDirs }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "xquartz-system-fonts";
|
||||||
|
buildInputs = [
|
||||||
|
xorg.mkfontdir xorg.mkfontscale
|
||||||
|
];
|
||||||
|
buildCommand = ''
|
||||||
|
source $stdenv/setup
|
||||||
|
|
||||||
|
for i in ${toString fontDirs} ; do
|
||||||
|
if [ -d $i/ ]; then
|
||||||
|
list="$list $i";
|
||||||
|
fi;
|
||||||
|
done
|
||||||
|
list=$(find $list -name fonts.dir -o -name '*.ttf' -o -name '*.otf');
|
||||||
|
fontDirs=''';
|
||||||
|
for i in $list ; do
|
||||||
|
fontDirs="$fontDirs $(dirname $i)";
|
||||||
|
done;
|
||||||
|
mkdir -p $out/share/X11-fonts/;
|
||||||
|
find $fontDirs -type f -o -type l | while read i; do
|
||||||
|
j="''${i##*/}"
|
||||||
|
if ! test -e "$out/share/X11-fonts/''${j}"; then
|
||||||
|
ln -s "$i" "$out/share/X11-fonts/''${j}";
|
||||||
|
fi;
|
||||||
|
done;
|
||||||
|
cd $out/share/X11-fonts/
|
||||||
|
rm fonts.dir
|
||||||
|
rm fonts.scale
|
||||||
|
rm fonts.alias
|
||||||
|
mkfontdir
|
||||||
|
mkfontscale
|
||||||
|
cat $( find ${xorg.fontalias}/ -name fonts.alias) >fonts.alias
|
||||||
|
'';
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
export PATH=@PATH@:$PATH
|
||||||
|
|
||||||
|
userresources=$HOME/.Xresources
|
||||||
|
usermodmap=$HOME/.Xmodmap
|
||||||
|
|
||||||
|
# Fix ridiculously slow key repeat.
|
||||||
|
@XSET@ r rate
|
||||||
|
|
||||||
|
# merge in defaults and keymaps
|
||||||
|
|
||||||
|
if [ -f "$userresources" ]; then
|
||||||
|
if [ -x /usr/bin/cpp ] ; then
|
||||||
|
@XRDB@ -merge "$userresources"
|
||||||
|
else
|
||||||
|
@XRDB@ -nocpp -merge "$userresources"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$usermodmap" ]; then
|
||||||
|
@XMODMAP@ "$usermodmap"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fontpath="@SYSTEM_FONTS@"
|
||||||
|
[ -e "$HOME"/.fonts/fonts.dir ] && fontpath="$fontpath,$HOME/.fonts"
|
||||||
|
[ -e "$HOME"/Library/Fonts/fonts.dir ] && fontpath="$fontpath,$HOME/Library/Fonts"
|
||||||
|
[ -e /Library/Fonts/fonts.dir ] && fontpath="$fontpath,/Library/Fonts"
|
||||||
|
[ -e /System/Library/Fonts/fonts.dir ] && fontpath="$fontpath,/System/Library/Fonts"
|
||||||
|
@XSET@ fp= "$fontpath"
|
||||||
|
unset fontpath
|
||||||
|
|
||||||
|
if [ -d "${HOME}/.xinitrc.d" ] ; then
|
||||||
|
for f in "${HOME}"/.xinitrc.d/*.sh ; do
|
||||||
|
[ -x "$f" ] && . "$f"
|
||||||
|
done
|
||||||
|
unset f
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec @QUARTZ_WM@
|
|
@ -164,7 +164,7 @@ let
|
||||||
|
|
||||||
### Symbolic names.
|
### Symbolic names.
|
||||||
|
|
||||||
x11 = if stdenv.isDarwin then darwinX11AndOpenGL else xlibsWrapper;
|
x11 = xlibsWrapper;
|
||||||
|
|
||||||
# `xlibs' is the set of X library components. This used to be the
|
# `xlibs' is the set of X library components. This used to be the
|
||||||
# old modular X llibraries project (called `xlibs') but now it's just
|
# old modular X llibraries project (called `xlibs') but now it's just
|
||||||
|
@ -4548,8 +4548,7 @@ let
|
||||||
|
|
||||||
freealut = callPackage ../development/libraries/freealut { };
|
freealut = callPackage ../development/libraries/freealut { };
|
||||||
|
|
||||||
freeglut = if stdenv.isDarwin then darwinX11AndOpenGL else
|
freeglut = callPackage ../development/libraries/freeglut { };
|
||||||
callPackage ../development/libraries/freeglut { };
|
|
||||||
|
|
||||||
freetype = callPackage ../development/libraries/freetype { };
|
freetype = callPackage ../development/libraries/freetype { };
|
||||||
|
|
||||||
|
@ -5666,25 +5665,22 @@ let
|
||||||
|
|
||||||
mesaSupported = lib.elem system lib.platforms.mesaPlatforms;
|
mesaSupported = lib.elem system lib.platforms.mesaPlatforms;
|
||||||
|
|
||||||
mesa_original = callPackage ../development/libraries/mesa {
|
mesaDarwinOr = alternative: if stdenv.isDarwin
|
||||||
|
then callPackage ../development/libraries/mesa-darwin { }
|
||||||
|
else alternative;
|
||||||
|
mesa_noglu = mesaDarwinOr (callPackage ../development/libraries/mesa {
|
||||||
# makes it slower, but during runtime we link against just mesa_drivers
|
# makes it slower, but during runtime we link against just mesa_drivers
|
||||||
# through /run/opengl-driver*, which is overriden according to config.grsecurity
|
# through /run/opengl-driver*, which is overriden according to config.grsecurity
|
||||||
grsecEnabled = true;
|
grsecEnabled = true;
|
||||||
};
|
});
|
||||||
|
mesa_glu = mesaDarwinOr (callPackage ../development/libraries/mesa-glu { });
|
||||||
mesa_noglu = if stdenv.isDarwin
|
|
||||||
then darwinX11AndOpenGL // { driverLink = mesa_noglu; }
|
|
||||||
else mesa_original;
|
|
||||||
mesa_drivers = let
|
mesa_drivers = let
|
||||||
mo = mesa_original.override { grsecEnabled = config.grsecurity or false; };
|
mo = mesa_noglu.override { grsecEnabled = config.grsecurity or false; };
|
||||||
in mo.drivers;
|
in mo.drivers;
|
||||||
mesa_glu = callPackage ../development/libraries/mesa-glu { };
|
mesa = mesaDarwinOr (buildEnv {
|
||||||
mesa = if stdenv.isDarwin then darwinX11AndOpenGL
|
|
||||||
else buildEnv {
|
|
||||||
name = "mesa-${mesa_noglu.version}";
|
name = "mesa-${mesa_noglu.version}";
|
||||||
paths = [ mesa_glu mesa_noglu ];
|
paths = [ mesa_noglu mesa_glu ];
|
||||||
};
|
});
|
||||||
darwinX11AndOpenGL = callPackage ../os-specific/darwin/native-x11-and-opengl { };
|
|
||||||
|
|
||||||
metaEnvironment = recurseIntoAttrs (let callPackage = newScope pkgs.metaEnvironment; in rec {
|
metaEnvironment = recurseIntoAttrs (let callPackage = newScope pkgs.metaEnvironment; in rec {
|
||||||
sdfLibrary = callPackage ../development/libraries/sdf-library { aterm = aterm28; };
|
sdfLibrary = callPackage ../development/libraries/sdf-library { aterm = aterm28; };
|
||||||
|
@ -7012,12 +7008,17 @@ let
|
||||||
|
|
||||||
xinetd = callPackage ../servers/xinetd { };
|
xinetd = callPackage ../servers/xinetd { };
|
||||||
|
|
||||||
|
xquartz = callPackage ../servers/x11/xquartz { };
|
||||||
|
quartz-wm = callPackage ../servers/x11/quartz-wm { stdenv = clangStdenv; };
|
||||||
|
|
||||||
xorg = recurseIntoAttrs (import ../servers/x11/xorg/default.nix {
|
xorg = recurseIntoAttrs (import ../servers/x11/xorg/default.nix {
|
||||||
inherit fetchurl fetchgit fetchpatch stdenv pkgconfig intltool freetype fontconfig
|
inherit clangStdenv fetchurl fetchgit fetchpatch stdenv pkgconfig intltool freetype fontconfig
|
||||||
libxslt expat libdrm libpng zlib perl mesa_drivers
|
libxslt expat libpng zlib perl mesa_drivers
|
||||||
dbus libuuid openssl gperf m4
|
dbus libuuid openssl gperf m4
|
||||||
autoconf automake libtool xmlto asciidoc udev flex bison python mtdev pixman;
|
autoconf automake libtool xmlto asciidoc flex bison python mtdev pixman;
|
||||||
mesa = mesa_noglu;
|
mesa = mesa_noglu;
|
||||||
|
udev = if stdenv.isLinux then udev else null;
|
||||||
|
libdrm = if stdenv.isLinux then libdrm else null;
|
||||||
} // {
|
} // {
|
||||||
xf86videointel-testing = callPackage ../servers/x11/xorg/xf86-video-intel-testing.nix { };
|
xf86videointel-testing = callPackage ../servers/x11/xorg/xf86-video-intel-testing.nix { };
|
||||||
});
|
});
|
||||||
|
|
|
@ -382,21 +382,21 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
xorg = {
|
xorg = {
|
||||||
fontadobe100dpi = linux;
|
fontadobe100dpi = linux ++ darwin;
|
||||||
fontadobe75dpi = linux;
|
fontadobe75dpi = linux ++ darwin;
|
||||||
fontbh100dpi = linux;
|
fontbh100dpi = linux ++ darwin;
|
||||||
fontbhlucidatypewriter100dpi = linux;
|
fontbhlucidatypewriter100dpi = linux ++ darwin;
|
||||||
fontbhlucidatypewriter75dpi = linux;
|
fontbhlucidatypewriter75dpi = linux ++ darwin;
|
||||||
fontbhttf = linux;
|
fontbhttf = linux ++ darwin;
|
||||||
fontcursormisc = linux;
|
fontcursormisc = linux ++ darwin;
|
||||||
fontmiscmisc = linux;
|
fontmiscmisc = linux ++ darwin;
|
||||||
iceauth = linux;
|
iceauth = linux ++ darwin;
|
||||||
libX11 = linux;
|
libX11 = linux ++ darwin;
|
||||||
lndir = all;
|
lndir = all ++ darwin;
|
||||||
setxkbmap = linux;
|
setxkbmap = linux ++ darwin;
|
||||||
xauth = linux;
|
xauth = linux ++ darwin;
|
||||||
xbitmaps = linux;
|
xbitmaps = linux ++ darwin;
|
||||||
xev = linux;
|
xev = linux ++ darwin;
|
||||||
xf86inputevdev = linux;
|
xf86inputevdev = linux;
|
||||||
xf86inputkeyboard = linux;
|
xf86inputkeyboard = linux;
|
||||||
xf86inputmouse = linux;
|
xf86inputmouse = linux;
|
||||||
|
@ -408,18 +408,18 @@ let
|
||||||
xf86videovesa = linux;
|
xf86videovesa = linux;
|
||||||
xf86videovmware = linux;
|
xf86videovmware = linux;
|
||||||
xf86videomodesetting = linux;
|
xf86videomodesetting = linux;
|
||||||
xfs = linux;
|
xfs = linux ++ darwin;
|
||||||
xinput = linux;
|
xinput = linux ++ darwin;
|
||||||
xkbcomp = linux;
|
xkbcomp = linux ++ darwin;
|
||||||
xlsclients = linux;
|
xlsclients = linux ++ darwin;
|
||||||
xmessage = linux;
|
xmessage = linux ++ darwin;
|
||||||
xorgserver = linux;
|
xorgserver = linux ++ darwin;
|
||||||
xprop = linux;
|
xprop = linux ++ darwin;
|
||||||
xrandr = linux;
|
xrandr = linux ++ darwin;
|
||||||
xrdb = linux;
|
xrdb = linux ++ darwin;
|
||||||
xset = linux;
|
xset = linux ++ darwin;
|
||||||
xsetroot = linux;
|
xsetroot = linux ++ darwin;
|
||||||
xwininfo = linux;
|
xwininfo = linux ++ darwin;
|
||||||
};
|
};
|
||||||
|
|
||||||
xfce = {
|
xfce = {
|
||||||
|
|
Loading…
Reference in New Issue