diff options
author | Mx Kookie <kookie@spacekookie.de> | 2020-10-31 19:35:09 +0100 |
---|---|---|
committer | Mx Kookie <kookie@spacekookie.de> | 2020-10-31 19:35:09 +0100 |
commit | c4625b175f8200f643fd6e11010932ea44c78433 (patch) | |
tree | bce3f89888c8ac3991fa5569a878a9eab6801ccc /infra/libkookie/nixpkgs/pkgs/tools/X11/xpra | |
parent | 49f735974dd103039ddc4cb576bb76555164a9e7 (diff) | |
parent | d661aa56a8843e991261510c1bb28fdc2f6975ae (diff) |
Add 'infra/libkookie/' from commit 'd661aa56a8843e991261510c1bb28fdc2f6975ae'
git-subtree-dir: infra/libkookie
git-subtree-mainline: 49f735974dd103039ddc4cb576bb76555164a9e7
git-subtree-split: d661aa56a8843e991261510c1bb28fdc2f6975ae
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/tools/X11/xpra')
7 files changed, 416 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/0002-Constant-DPI.patch b/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/0002-Constant-DPI.patch new file mode 100644 index 000000000000..f91e53d1e493 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/0002-Constant-DPI.patch @@ -0,0 +1,96 @@ +--- a/src/dummy.h 2016-12-17 23:02:53.396287041 +0100 ++++ b/src/dummy.h 2016-12-17 23:03:30.319616550 +0100 +@@ -51,6 +51,7 @@ + /* options */ + OptionInfoPtr Options; + Bool swCursor; ++ Bool constantDPI; + /* proc pointer */ + CloseScreenProcPtr CloseScreen; + xf86CursorInfoPtr CursorInfo; +--- a/src/dummy_driver.c 2016-12-14 21:54:20.000000000 +0100 ++++ b/src/dummy_driver.c 2016-12-17 23:04:59.916416126 +0100 +@@ -17,6 +17,12 @@ + /* All drivers using the mi colormap manipulation need this */ + #include "micmap.h" + ++#ifdef RANDR ++#include "randrstr.h" ++#endif ++ ++#include "windowstr.h" ++ + /* identifying atom needed by magnifiers */ + #include <X11/Xatom.h> + #include "property.h" +@@ -115,11 +121,15 @@ + }; + + typedef enum { +- OPTION_SW_CURSOR ++ OPTION_SW_CURSOR, ++ OPTION_CONSTANT_DPI + } DUMMYOpts; + + static const OptionInfoRec DUMMYOptions[] = { + { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, ++#ifdef RANDR ++ { OPTION_CONSTANT_DPI, "ConstantDPI", OPTV_BOOLEAN, {0}, FALSE }, ++#endif + { -1, NULL, OPTV_NONE, {0}, FALSE } + }; + +@@ -359,6 +369,7 @@ + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, dPtr->Options); + + xf86GetOptValBool(dPtr->Options, OPTION_SW_CURSOR,&dPtr->swCursor); ++ xf86GetOptValBool(dPtr->Options, OPTION_CONSTANT_DPI, &dPtr->constantDPI); + + if (device->videoRam != 0) { + pScrn->videoRam = device->videoRam; +@@ -639,10 +650,45 @@ + return TRUE; + } + ++const char *XDPY_PROPERTY = "dummy-constant-xdpi"; ++const char *YDPY_PROPERTY = "dummy-constant-ydpi"; ++static int get_dpi_value(WindowPtr root, const char *property_name, int default_dpi) ++{ ++ PropertyPtr prop; ++ Atom type_atom = MakeAtom("CARDINAL", 8, TRUE); ++ Atom prop_atom = MakeAtom(property_name, strlen(property_name), FALSE); ++ ++ for (prop = wUserProps(root); prop; prop = prop->next) { ++ if (prop->propertyName == prop_atom && prop->type == type_atom && prop->data) { ++ int v = (int) (*((CARD32 *) prop->data)); ++ if ((v>0) && (v<4096)) { ++ xf86DrvMsg(0, X_INFO, "get_constant_dpi_value() found property \"%s\" with value=%i\n", property_name, (int) v); ++ return (int) v; ++ } ++ break; ++ } ++ } ++ return default_dpi; ++} ++ + /* Mandatory */ + Bool + DUMMYSwitchMode(SWITCH_MODE_ARGS_DECL) + { ++ SCRN_INFO_PTR(arg); ++#ifdef RANDR ++ DUMMYPtr dPtr = DUMMYPTR(pScrn); ++ if (dPtr->constantDPI) { ++ int xDpi = get_dpi_value(pScrn->pScreen->root, XDPY_PROPERTY, pScrn->xDpi); ++ int yDpi = get_dpi_value(pScrn->pScreen->root, YDPY_PROPERTY, pScrn->yDpi); ++ //25.4 mm per inch: (254/10) ++ pScrn->pScreen->mmWidth = mode->HDisplay * 254 / xDpi / 10; ++ pScrn->pScreen->mmHeight = mode->VDisplay * 254 / yDpi / 10; ++ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "mm(dpi %ix%i)=%ix%i\n", xDpi, yDpi, pScrn->pScreen->mmWidth, pScrn->pScreen->mmHeight); ++ RRScreenSizeNotify(pScrn->pScreen); ++ RRTellChanged(pScrn->pScreen); ++ } ++#endif + return TRUE; + } + diff --git a/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/0003-fix-pointer-limits.patch b/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/0003-fix-pointer-limits.patch new file mode 100644 index 000000000000..3dbb6fd179ff --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/0003-fix-pointer-limits.patch @@ -0,0 +1,39 @@ +--- xf86-video-dummy-0.3.6/src/dummy_driver.c 2014-11-05 19:24:02.668656601 +0700 ++++ xf86-video-dummy-0.3.6.new/src/dummy_driver.c 2014-11-05 19:37:53.076061853 +0700 +@@ -55,6 +55,9 @@ + #include <X11/extensions/xf86dgaproto.h> + #endif + ++/* Needed for fixing pointer limits on resize */ ++#include "inputstr.h" ++ + /* Mandatory functions */ + static const OptionInfoRec * DUMMYAvailableOptions(int chipid, int busid); + static void DUMMYIdentify(int flags); +@@ -713,6 +716,26 @@ + RRTellChanged(pScrn->pScreen); + } + #endif ++ //ensure the screen dimensions are also updated: ++ pScrn->pScreen->width = mode->HDisplay; ++ pScrn->pScreen->height = mode->VDisplay; ++ pScrn->virtualX = mode->HDisplay; ++ pScrn->virtualY = mode->VDisplay; ++ pScrn->frameX1 = mode->HDisplay; ++ pScrn->frameY1 = mode->VDisplay; ++ ++ //ensure the pointer uses the new limits too: ++ DeviceIntPtr pDev; ++ SpritePtr pSprite; ++ for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { ++ if (pDev->spriteInfo!=NULL && pDev->spriteInfo->sprite!=NULL) { ++ pSprite = pDev->spriteInfo->sprite; ++ pSprite->hotLimits.x2 = mode->HDisplay; ++ pSprite->hotLimits.y2 = mode->VDisplay; ++ pSprite->physLimits.x2 = mode->HDisplay; ++ pSprite->physLimits.y2 = mode->VDisplay; ++ } ++ } + return TRUE; + } + diff --git a/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/0005-support-for-30-bit-depth-in-dummy-driver.patch b/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/0005-support-for-30-bit-depth-in-dummy-driver.patch new file mode 100644 index 000000000000..567db3fc3865 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/0005-support-for-30-bit-depth-in-dummy-driver.patch @@ -0,0 +1,41 @@ +--- a/src/dummy.h 2016-12-17 23:33:33.279533389 +0100 ++++ b/src/dummy.h 2016-12-17 23:33:56.695739166 +0100 +@@ -69,7 +69,7 @@ + int overlay_offset; + int videoKey; + int interlace; +- dummy_colors colors[256]; ++ dummy_colors colors[1024]; + pointer* FBBase; + Bool (*CreateWindow)() ; /* wrapped CreateWindow */ + Bool prop; +--- a/src/dummy_driver.c 2016-12-17 23:33:47.446657886 +0100 ++++ b/src/dummy_driver.c 2016-12-17 23:33:56.696739175 +0100 +@@ -317,6 +317,7 @@ + case 15: + case 16: + case 24: ++ case 30: + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, +@@ -331,8 +332,8 @@ + pScrn->rgbBits = 8; + + /* Get the depth24 pixmap format */ +- if (pScrn->depth == 24 && pix24bpp == 0) +- pix24bpp = xf86GetBppFromDepth(pScrn, 24); ++ if (pScrn->depth >= 24 && pix24bpp == 0) ++ pix24bpp = xf86GetBppFromDepth(pScrn, pScrn->depth); + + /* + * This must happen after pScrn->display has been set because +@@ -623,7 +624,7 @@ + if(!miCreateDefColormap(pScreen)) + return FALSE; + +- if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, ++ if (!xf86HandleColormaps(pScreen, 1024, pScrn->rgbBits, + DUMMYLoadPalette, NULL, + CMAP_PALETTED_TRUECOLOR + | CMAP_RELOAD_ON_MODE_SWITCH)) diff --git a/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/default.nix b/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/default.nix new file mode 100644 index 000000000000..7f46e017c367 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/default.nix @@ -0,0 +1,124 @@ +{ stdenv, lib, fetchurl, callPackage, substituteAll, python3, pkgconfig, writeText +, xorg, gtk3, glib, pango, cairo, gdk-pixbuf, atk +, wrapGAppsHook, xorgserver, getopt, xauth, utillinux, which +, ffmpeg, x264, libvpx, libwebp, x265 +, libfakeXinerama +, gst_all_1, pulseaudio, gobject-introspection +, pam }: + +with lib; + +let + inherit (python3.pkgs) cython buildPythonApplication; + + xf86videodummy = xorg.xf86videodummy.overrideDerivation (p: { + patches = [ + ./0002-Constant-DPI.patch + ./0003-fix-pointer-limits.patch + ./0005-support-for-30-bit-depth-in-dummy-driver.patch + ]; + }); + + xorgModulePaths = writeText "module-paths" '' + Section "Files" + ModulePath "${xorgserver}/lib/xorg/modules" + ModulePath "${xorgserver}/lib/xorg/modules/extensions" + ModulePath "${xorgserver}/lib/xorg/modules/drivers" + ModulePath "${xf86videodummy}/lib/xorg/modules/drivers" + EndSection + ''; + +in buildPythonApplication rec { + pname = "xpra"; + version = "4.0.2"; + + src = fetchurl { + url = "https://xpra.org/src/${pname}-${version}.tar.xz"; + sha256 = "1cs39jzi59hkl421xmhi549ndmdfzkg0ap45f4nlsn9zr9zwmp3x"; + }; + + patches = [ + (substituteAll { + src = ./fix-paths.patch; + inherit (xorg) xkeyboardconfig; + inherit libfakeXinerama; + }) + ./fix-41106.patch + ]; + + postPatch = '' + substituteInPlace setup.py --replace '/usr/include/security' '${pam}/include/security' + ''; + + nativeBuildInputs = [ pkgconfig wrapGAppsHook ]; + buildInputs = with xorg; [ + libX11 xorgproto libXrender libXi + libXtst libXfixes libXcomposite libXdamage + libXrandr libxkbfile + ] ++ [ + cython + + pango cairo gdk-pixbuf atk.out gtk3 glib + + ffmpeg libvpx x264 libwebp x265 + + gst_all_1.gstreamer + gst_all_1.gst-plugins-base + gst_all_1.gst-plugins-good + gst_all_1.gst-plugins-bad + gst_all_1.gst-libav + + pam + gobject-introspection + ]; + propagatedBuildInputs = with python3.pkgs; [ + pillow rencode pycrypto cryptography pycups lz4 dbus-python + netifaces numpy pygobject3 pycairo gst-python pam + pyopengl paramiko opencv4 python-uinput pyxdg + ipaddress idna + ]; + + # error: 'import_cairo' defined but not used + NIX_CFLAGS_COMPILE = "-Wno-error=unused-function"; + + setupPyBuildFlags = [ + "--with-Xdummy" + "--without-strict" + "--with-gtk3" + # Override these, setup.py checks for headers in /usr/* paths + "--with-pam" + "--with-vsock" + ]; + + dontWrapGApps = true; + preFixup = '' + makeWrapperArgs+=( + "''${gappsWrapperArgs[@]}" + --set XPRA_INSTALL_PREFIX "$out" + --set XPRA_COMMAND "$out/bin/xpra" + --prefix LD_LIBRARY_PATH : ${libfakeXinerama}/lib + --prefix PATH : ${stdenv.lib.makeBinPath [ getopt xorgserver xauth which utillinux pulseaudio ]} + ) + ''; + + # append module paths to xorg.conf + postInstall = '' + cat ${xorgModulePaths} >> $out/etc/xpra/xorg.conf + ''; + + doCheck = false; + + enableParallelBuilding = true; + + passthru = { inherit xf86videodummy; }; + + meta = { + homepage = "http://xpra.org/"; + downloadPage = "https://xpra.org/src/"; + downloadURLRegexp = "xpra-.*[.]tar[.]xz$"; + description = "Persistent remote applications for X"; + platforms = platforms.linux; + license = licenses.gpl2; + maintainers = with maintainers; [ tstrobel offline numinit ]; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/fix-41106.patch b/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/fix-41106.patch new file mode 100644 index 000000000000..d0834543aa9f --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/fix-41106.patch @@ -0,0 +1,15 @@ +diff --git a/xpra/server/server_util.py b/xpra/server/server_util.py +index dd7c7c1..066b9ff 100644 +--- a/xpra/server/server_util.py ++++ b/xpra/server/server_util.py +@@ -37,6 +37,10 @@ def sh_quotemeta(s): + return b"'" + s.replace(b"'", b"'\\''") + b"'" + + def xpra_runner_shell_script(xpra_file, starting_dir, socket_dir): ++ # Nixpkgs contortion: ++ # xpra_file points to a shell wrapper, not to the python script. ++ dirname, basename = os.path.split(xpra_file) ++ xpra_file = os.path.join(dirname, "."+basename+"-wrapped") + script = [] + script.append(b"#!/bin/sh\n") + for var, value in os.environb.items(): diff --git a/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/fix-paths.patch b/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/fix-paths.patch new file mode 100644 index 000000000000..70bd9027a1a8 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/fix-paths.patch @@ -0,0 +1,68 @@ +diff --git a/setup.py b/setup.py +index f962330..b02b6dd 100755 +--- a/setup.py ++++ b/setup.py +@@ -2224,11 +2224,7 @@ if v4l2_ENABLED: + videodev2_h = "/usr/include/linux/videodev2.h" + constants_pxi = "xpra/codecs/v4l2/constants.pxi" + if not os.path.exists(videodev2_h) or should_rebuild(videodev2_h, constants_pxi): +- ENABLE_DEVICE_CAPS = 0 +- if os.path.exists(videodev2_h): +- with open(videodev2_h) as f: +- hdata = f.read() +- ENABLE_DEVICE_CAPS = int(hdata.find("device_caps")>=0) ++ ENABLE_DEVICE_CAPS = 1 + with open(constants_pxi, "wb") as f: + f.write(b"DEF ENABLE_DEVICE_CAPS=%i" % ENABLE_DEVICE_CAPS) + cython_add(Extension("xpra.codecs.v4l2.pusher", + +diff --git a/xpra/x11/bindings/keyboard_bindings.pyx b/xpra/x11/bindings/keyboard_bindings.pyx +index bd7023d..064c6b5 100644 +--- a/xpra/x11/bindings/keyboard_bindings.pyx ++++ b/xpra/x11/bindings/keyboard_bindings.pyx +@@ -21,7 +21,7 @@ from libc.stdlib cimport free, malloc + + DEF PATH_MAX = 1024 + DEF DFLT_XKB_RULES_FILE = b"base" +-DEF DFLT_XKB_CONFIG_ROOT = b"/usr/share/X11/xkb" ++DEF DFLT_XKB_CONFIG_ROOT = b"@xkeyboardconfig@/share/X11/xkb" + + ################################### + # Headers, python magic +diff --git a/xpra/x11/fakeXinerama.py b/xpra/x11/fakeXinerama.py +index c867258..617af7c 100755 +--- a/xpra/x11/fakeXinerama.py ++++ b/xpra/x11/fakeXinerama.py +@@ -22,31 +22,7 @@ fakeXinerama_config_files = [ + ] + + def find_libfakeXinerama(): +- libname = "fakeXinerama" +- try: +- from ctypes.util import find_library +- flibname = find_library("fakeXinerama") +- if flibname: +- libname = flibname +- except Exception: +- pass +- if POSIX: +- for lib_dir in os.environ.get("LD_LIBRARY_PATH", "/usr/lib").split(os.pathsep): +- lib_path = os.path.join(lib_dir, libname) +- if not os.path.exists(lib_dir): +- continue +- if os.path.exists(lib_path) and os.path.isfile(lib_path): +- return lib_path +- if LINUX: +- try: +- libpath = find_lib_ldconfig("fakeXinerama") +- if libpath: +- return libpath +- except Exception as e: +- log("find_libfakeXinerama()", exc_info=True) +- log.error("Error: cannot launch ldconfig -p to locate libfakeXinerama:") +- log.error(" %s", e) +- return find_lib(libname) ++ return "@libfakeXinerama@/lib/libfakeXinerama.so.1.0" + + current_xinerama_config = None + diff --git a/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/libfakeXinerama.nix b/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/libfakeXinerama.nix new file mode 100644 index 000000000000..e43043d78f2e --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/tools/X11/xpra/libfakeXinerama.nix @@ -0,0 +1,33 @@ +{ stdenv, fetchurl, libX11, libXinerama }: + +stdenv.mkDerivation rec { + pname = "libfakeXinerama"; + version = "0.1.0"; + + src = fetchurl { + url = "https://www.xpra.org/src/${pname}-${version}.tar.bz2"; + sha256 = "0gxb8jska2anbb3c1m8asbglgnwylgdr44x9lr8yh91hjxsqadkx"; + }; + + buildInputs = [ libX11 libXinerama ]; + + buildPhase = '' + gcc -O2 -Wall fakeXinerama.c -fPIC -o libfakeXinerama.so.1.0 -shared + ''; + + installPhase = '' + mkdir -p $out/lib + cp libfakeXinerama.so.1.0 $out/lib + ln -s libfakeXinerama.so.1.0 $out/lib/libXinerama.so.1.0 + ln -s libXinerama.so.1.0 $out/lib/libXinerama.so.1 + ln -s libXinerama.so.1 $out/lib/libXinerama.so + ''; + + meta = with stdenv.lib; { + homepage = "http://xpra.org/"; + description = "fakeXinerama for Xpra"; + platforms = platforms.linux; + maintainers = [ maintainers.tstrobel ]; + license = licenses.gpl2; + }; +} |