summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2021-08-17 15:05:11 -0600
committerLuke Shumaker <lukeshu@parabola.nu>2021-08-17 15:05:11 -0600
commit4e283763effe2efc511314ccc8743724fcdfdb2b (patch)
tree49a46f729d62bf561515b37430b27cfeb52a4c1e
parent53ee3144a5d9716bcd47dc499c713c2d20985f48 (diff)
Revert "pcr/wmii-hg: removed"
This reverts commit 6cfe3aa3f84067b0990262b07c71b5806a3493dc.
-rw-r--r--pcr/wmii-hg/PKGBUILD61
-rw-r--r--pcr/wmii-hg/fix-for-weird-xinerama-settings.patch64
2 files changed, 125 insertions, 0 deletions
diff --git a/pcr/wmii-hg/PKGBUILD b/pcr/wmii-hg/PKGBUILD
new file mode 100644
index 000000000..5c5cfc979
--- /dev/null
+++ b/pcr/wmii-hg/PKGBUILD
@@ -0,0 +1,61 @@
+# Maintainer: Luke Shumaker <lukeshu@sbcglobal.net>
+
+# Maintainer (Arch): Sergej Pupykin <pupykin.s+arch@gmail.com>
+# Contributor (Arch): Jeffrey 'jf' Lim <jfs.world@gmail.com>
+
+pkgname=wmii-hg
+pkgver=2823
+pkgdesc="A small, dynamic window manager for X11"
+url="https://code.google.com/p/wmii/"
+license=("MIT")
+
+provides=("wmii")
+conflicts=("wmii")
+
+pkgrel=3
+arch=("i686" "x86_64")
+depends=('libxft' 'libxrandr' 'libxinerama')
+makedepends=('txt2tags' 'libixp') # libixp is statically linked
+
+source=("https://repo.parabola.nu/other/${pkgname}/${pkgname}-${pkgver}.tar.gz"
+ fix-for-weird-xinerama-settings.patch)
+md5sums=('8228a299cb83258ab3988b6131d2cbb8'
+ 'd8f045136a7bdf3d8ccc1001085c3c17')
+
+mkdepends=('mercurial')
+mksource=("$pkgname-$pkgver::hg+https://code.google.com/p/wmii/#revision=${pkgver}")
+mkmd5sums=('SKIP')
+mksource() {
+ # don't include this precompiled binary (probably included by accident)
+ rm "${srcdir}/${pkgname}-${pkgver}/lib/libutf/libutf.a"
+}
+
+prepare() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ patch -p1 -N -i ../fix-for-weird-xinerama-settings.patch
+ sed -i 's# !=#!=#' mk/hdr.mk
+
+ sed -i 's|PREFIX = /usr/local|PREFIX = /usr|' config.mk
+ sed -i 's|ETC = $(PREFIX)/etc|ETC = /etc|' config.mk
+ sed -i 's|PYTHON = .*|PYTHON = python2|' config.mk
+ sed -i '/^CFLAGS += -O2$/d' config.mk
+ echo 'CFLAGS += -O2' >> config.mk
+}
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+
+ export LDFLAGS+=',--no-as-needed'
+ export MAKEFLAGS="-j1"
+ make
+}
+
+package() {
+ cd "$srcdir/$pkgname-$pkgver"
+ make DESTDIR="$pkgdir" install
+
+ install -Dm644 img/wmii.png "${pkgdir}"/usr/share/pixmaps/wmii.png
+ install -Dm644 debian/file/wmii.desktop "${pkgdir}"/usr/share/xsessions/wmii.desktop
+ install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
+}
diff --git a/pcr/wmii-hg/fix-for-weird-xinerama-settings.patch b/pcr/wmii-hg/fix-for-weird-xinerama-settings.patch
new file mode 100644
index 000000000..c61f36eea
--- /dev/null
+++ b/pcr/wmii-hg/fix-for-weird-xinerama-settings.patch
@@ -0,0 +1,64 @@
+I (Luke Shumaker) wrote this patch to fix a bug where if Xinerama is
+(mis)configured such that there are two screens with the same size and
+position, then wmii removes both of them from the list, resulting in
+nscreens=0, which causes a segfault when it tries to dereference
+screen[0]. This is the case by default with a recent version of the
+drivers for my Nvidia 9400GT (where the DVI and VGA ports mirror
+eachother).
+
+Plus, the code's more efficient now, because it does everything in
+place, instead of needing to malloc another list.
+
+diff -ru wmii-hg-2823.orig/cmd/wmii/main.c wmii-hg-2823/cmd/wmii/main.c
+--- wmii-hg-2823.orig/cmd/wmii/main.c 1989-12-31 19:00:00.000000000 -0500
++++ wmii-hg-2823/cmd/wmii/main.c 2015-01-15 23:51:34.325953828 -0500
+@@ -163,7 +163,7 @@
+ void
+ init_screens(void) {
+ static int old_n, old_nscreens;
+- Rectangle *rects, *r;
++ Rectangle *rects;
+ View *v;
+ int i, j, n, m;
+
+@@ -178,23 +178,27 @@
+
+ /* Reallocate screens, zero any new ones. */
+ rects = xinerama_screens(&n);
+- r = malloc(n * sizeof *r);
+
+ /* Weed out subsumed/cloned screens */
+- for(m=-1; m < n; n=m) {
+- for(i=n-1, m=0; i >= 0; i--) {
+- for(j=0; j < n; j++)
+- if (i != j &&
+- eqrect(rects[i],
+- rect_intersection(rects[i], rects[j])))
+- break;
+- if (j == n)
+- r[m++] = rects[i];
++ for(m=0, i=0; i < n; i++) {
++ for(j=0; j < n; j++) {
++ if (i != j &&
++ /* rects[i] is entirely contained in rects[j] */
++ eqrect(rects[i], rect_intersection(rects[i], rects[j])) &&
++ /* but if they are the same, accept the first */
++ (i > j || ! eqrect(rects[i], rects[j]))) {
++ /* remove rects[i] from rects[] */
++ break;
++ }
++ }
++ if (j < n) { /* hit "break" */
++ /* remove rects[i] from rects[] */
++ n--;
++ for(j=i; j < n; j++)
++ rects[j] = rects[j+1];
++ i--;
+ }
+- for(i=m-1, j=0; i >= 0; i--)
+- rects[j++] = r[i];
+ }
+- free(r);
+
+ m = nscreens;
+ nscreens_new = keep_screens ? max(n, nscreens) : n;