From 1566ee33abe4ec709b6914afa8cbc849c0b6d34c Mon Sep 17 00:00:00 2001 From: B Stack Date: Tue, 16 Feb 2021 16:55:58 -0500 Subject: add xzoom --- xzoom/README.md | 24 ++++++ xzoom/xzoom-0.3.shm.diff | 180 +++++++++++++++++++++++++++++++++++++++++++++ xzoom/xzoom.spec | 80 ++++++++++++++++++++ xzoom/xzoom_0.3-24.diff.gz | Bin 0 -> 8375 bytes 4 files changed, 284 insertions(+) create mode 100644 xzoom/README.md create mode 100644 xzoom/xzoom-0.3.shm.diff create mode 100644 xzoom/xzoom.spec create mode 100644 xzoom/xzoom_0.3-24.diff.gz (limited to 'xzoom') diff --git a/xzoom/README.md b/xzoom/README.md new file mode 100644 index 0000000..e07f5c4 --- /dev/null +++ b/xzoom/README.md @@ -0,0 +1,24 @@ +# Readme for xzoom +## Overview +xzoom is a small screen magnification utility that stays focused on the same spot until you move its focus. + +## Upstream +The original upstream is [https://webdiis.unizar.es/pub/unix/X11/xzoom-0.3.tgz](https://webdiis.unizar.es/pub/unix/X11/xzoom-0.3.tgz). +Debian packages this on [salsa](https://salsa.debian.org/debian/xzoom). +SUSE packages exist too: [1](https://build.opensuse.org/package/show/home:zhonghuaren/xzoom) [2](https://build.opensuse.org/package/show/home:Akoellh/xzoom) + +## Reason for being in stackrpms +Fedora does not package any third-party loupe programs. + +## Alternatives +I could not find my old non-free OS application i.Look, but it runs in Wine anyways. +`kmag` sounds like a decent KDE alternative, but I didn't want to install 127MB of KDE just for a screen magnifier. +GNOME Shell has some built-in viewer, but I do not use GNOME. + +## Dependencies +Distro | Packages +---------- | --------- +Fedora 32 | bash, glibc, libX11, libXext, libXt (these are all standard packages) + +## Differences from upstream +Spec file is modified from the Suse ones to be more Fedora-like, based on [Fedora Packaging Guidelines](https://docs.fedoraproject.org/en-US/packaging-guidelines/). diff --git a/xzoom/xzoom-0.3.shm.diff b/xzoom/xzoom-0.3.shm.diff new file mode 100644 index 0000000..26a1527 --- /dev/null +++ b/xzoom/xzoom-0.3.shm.diff @@ -0,0 +1,180 @@ +Source: https://build.opensuse.org/source/home:Akoellh/xzoom/xzoom-0.3.shm.diff?rev=68bf54e9d06f0bce019d310ccd70d579 +Date: 2021-02-16 +diff -uraN xzoom-0.3.orig/xzoom.c xzoom-0.3/xzoom.c +--- xzoom-0.3.orig/xzoom.c 2017-10-12 17:53:38.446984725 +0200 ++++ xzoom-0.3/xzoom.c 2017-10-12 17:54:46.094982727 +0200 +@@ -28,6 +28,8 @@ + some other minor changes/fixes + tony mancill 2002/02/13 + hacked in support for WM_DELETE_WINDOW ++Egmont Koblinger Added XSHM auto detection, ++ -shm, -noshm and -autoshm option + */ + + #include +@@ -87,6 +89,9 @@ + #define MAGX MAG /* horizontal magnification */ + #define MAGY MAG /* vertical magnification */ + ++int use_xshm = 1; ++int force_xshm = 0; ++ + int xgrab, ygrab; /* where do we take the picture from */ + + int magx = MAGX; +@@ -136,7 +141,7 @@ + + for(i = 0; i < 2; i++) { + +-#ifdef XSHM ++if (use_xshm) { /*#ifdef XSHM*/ + ximage[i] = XShmCreateImage(dpy, + DefaultVisualOfScreen(scr), + DefaultDepthOfScreen(scr), +@@ -172,11 +177,15 @@ + ximage[i]->data = shminfo[i].shmaddr; + shminfo[i].readOnly = False; + +- XShmAttach(dpy, &shminfo[i]); +- XSync(dpy, False); ++ if (XShmAttach(dpy, &shminfo[i]) || force_xshm) { ++ XSync(dpy, False); + +- shmctl(shminfo[i].shmid, IPC_RMID, 0); +-#else ++ shmctl(shminfo[i].shmid, IPC_RMID, 0); ++ } else { ++ use_xshm = 0; ++ } ++} ++if (!use_xshm) { /*#else*/ + char *data; + data = malloc(BitmapUnit(dpy) / 8 * width[i] * height[i]); + +@@ -191,7 +200,7 @@ + exit(-1); + } + +-#endif /* XSHM */ ++} /*#endif*/ /* XSHM */ + } + created_images = True; + } +@@ -204,12 +213,12 @@ + return; + + for(i = 0; i < 2; i++) { +-#ifdef XSHM ++if (use_xshm) { /*#ifdef XSHM*/ + XShmDetach(dpy, &shminfo[i]); /* ask X11 to detach shared segment */ + shmdt(shminfo[i].shmaddr); /* detach it ourselves */ +-#else ++} else { /*#else*/ + free(ximage[i]->data); +-#endif ++} /*#endif*/ + ximage[i]->data = NULL; /* remove refrence to that address */ + XDestroyImage(ximage[i]); /* and destroy image */ + } +@@ -222,6 +231,9 @@ + fprintf(stderr, "Usage: %s [ args ]\n" + "Command line args:\n" + "-display displayname\n" ++ "-shm\n" ++ "-noshm\n" ++ "-autoshm\n" + "-mag magnification [ magnification ]\n" + "-geometry geometry\n" + "-source geometry\n" +@@ -351,6 +363,22 @@ + continue; + } + ++ if(!strcmp(argv[0], "-shm")) { ++ force_xshm = 1; ++ use_xshm = 1; ++ continue; ++ } ++ if(!strcmp(argv[0], "-noshm")) { ++ force_xshm = 0; ++ use_xshm = 0; ++ continue; ++ } ++ if(!strcmp(argv[0], "-autoshm")) { ++ force_xshm = 0; ++ use_xshm = 1; ++ continue; ++ } ++ + if(!strcmp(argv[0], "-mag")) { + ++argv; --argc; + +@@ -818,14 +846,14 @@ + + } + +-#ifdef XSHM ++if (use_xshm) { /*#ifdef XSHM*/ + XShmGetImage(dpy, RootWindowOfScreen(scr), ximage[SRC], + xgrab, ygrab, AllPlanes); +-#else ++} else { /*#else*/ + XGetSubImage(dpy, RootWindowOfScreen(scr), + xgrab, ygrab, width[SRC], height[SRC], AllPlanes, + ZPixmap, ximage[SRC], 0, 0); +-#endif ++} /*#endif*/ + #ifdef FRAME + if(buttonpressed) { /* show the frame */ + DRAW_FRAME(); +@@ -840,11 +868,11 @@ + else if (depth <= 8*sizeof(int)) + scale32(); + +-#ifdef XSHM ++if (use_xshm) { /*#ifdef XSHM*/ + XShmPutImage(dpy, win, gc, ximage[DST], 0, 0, 0, 0, width[DST], height[DST], False); +-#else ++} else { /*#else*/ + XPutImage(dpy, win, gc, ximage[DST], 0, 0, 0, 0, width[DST], height[DST]); +-#endif ++} /*#endif*/ + if(set_title) { + if(magx == magy && !flipx && !flipy && !flipxy) + sprintf(title, "%s x%d", progname, magx); +diff -uraN xzoom-0.3.orig/xzoom.man xzoom-0.3/xzoom.man +--- xzoom-0.3.orig/xzoom.man 2017-10-12 17:53:38.446984725 +0200 ++++ xzoom-0.3/xzoom.man 2017-10-12 17:56:39.442979378 +0200 +@@ -9,6 +9,7 @@ + [ \-display \fIdisplayname\fP ] [ \-mag \fImag\fP [ \fImag\fP ] ] + [ \-x ] [ \-y ] [ \-xy ] + [ \-geometry \fIgeometry\fP ] [ \-source \fIgeometry\fP ] ++[ \-shm ] [ \-noshm ] [ \-autoshm ] + .SH OPTIONS + .LP + .TP 5 +@@ -38,6 +39,16 @@ + The dimensions of this area are multiplied by the magnification to + get the size of \fBxzoom\fR's window. If these dimensions are given + separately (by use of \-geometry ) then an error is reported. ++.TP 5 ++.B \-shm ++Force XSHM extension. ++.TP 5 ++.B \-noshm ++Disable XSHM extension. ++.TP 5 ++.B \-autoshm ++Try to autodetect if XSHM is available. This is the default. Unfortunately ++this is not perfect, sometimes you need to manually give \-noshm. + .br + .SH DESCRIPTION + .IR Xzoom +@@ -148,6 +159,7 @@ + For best performance the shared memory extension for X11 is + used. Xzoom will fail if it is compiled to use XSHM and its + display is not on the local host. ++However, Auto detection of XSHM is far from perfect. + .LP 5 + \(dg + Xzoom is given with no warranty. It was tested only under diff --git a/xzoom/xzoom.spec b/xzoom/xzoom.spec new file mode 100644 index 0000000..7f2c2f7 --- /dev/null +++ b/xzoom/xzoom.spec @@ -0,0 +1,80 @@ +# Startdate: 2021-02-16 +# References +# spec adapted mostly from https://build.opensuse.org/package/view_file/home:Akoellh/xzoom/xzoom.spec?expand=1 +# https://build.opensuse.org/package/show/home:zhonghuaren/xzoom +# https://salsa.debian.org/debian/xzoom +%define debug_package %{nil} +Name: xzoom +Version: 0.3 +Release: 1 +License: X11 +Summary: Magnify part of X display, with real-time updates +Url: https://webdiis.unizar.es/pub/unix/X11 +Group: System/X11/Utilities +Source0: https://webdiis.unizar.es/pub/unix/X11/%{name}-%{version}.tgz +Source1: https://salsa.debian.org/debian/xzoom/-/raw/debian/master/debian/xzoom.desktop +### Debian upstream patch +Patch0: https://cdn-fastly.deb.debian.org/debian/pool/main/x/%{name}/%{name}_0.3-24.diff.gz +Patch1: %{name}-0.3.shm.diff +BuildRequires: imake +BuildRequires: desktop-file-utils +BuildRequires: pkgconfig(xext) +BuildRequires: pkgconfig(xt) + +%description + +Like xmag, xzoom magnifies a section of the X display. Xzoom is different +because it will continuously update the magnified area as the display +changes. It is fast enough to enlarge small animations, for example. + +It can also mirror or rotate a part of the screen. + +%prep +%setup -q +%patch0 -p1 +%patch1 -p1 +cp -p %{SOURCE1} . + +%build +xmkmf +make %{?_smp_mflags} + +%install +install -Dm 755 %{name} $RPM_BUILD_ROOT%{_bindir}/%{name} +install -Dm 644 %{name}.man $RPM_BUILD_ROOT%{_mandir}/man1/%{name}.1 +desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1} + +%posttrans +update-desktop-database 1>/dev/null 2>&1 || : + +%files +%defattr(-,root,root) +%{_bindir}/%{name} +%{_datadir}/applications/%{name}.desktop +%{_mandir}/man1/%{name}.1* +%doc README %{name}.lsm + +%changelog +* Tue Feb 16 2021 B. Stack - 0.3-1 +- Build for Fedora 32 and above + +* Thu Oct 12 2017 - 0.3 +- initial package, based on upstream packages from Debian and Fedora + +* Wed Nov 13 2013 Huaren Zhong 0.3 +- Rebuild for Fedora + +* Tue Apr 12 2011 Fr. Br. George 0.3-alt3 +- BuildRequires recalculated + +* Tue Dec 09 2008 Fr. Br. George 0.3-alt2 +- libXext-devel added + +* Mon Aug 27 2007 Fr. Br. George 0.3-alt1 +- Initial build for ALT + +* Mon Nov 11 2002 - ro@suse.de +- changed neededforbuild to + +* Mon Dec 03 2001 - egmont@suselinux.hu +- Initial release diff --git a/xzoom/xzoom_0.3-24.diff.gz b/xzoom/xzoom_0.3-24.diff.gz new file mode 100644 index 0000000..4b98a2d Binary files /dev/null and b/xzoom/xzoom_0.3-24.diff.gz differ -- cgit